From 3596358ea07a128091456bc53d3b969371161ec3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 6 Dec 2022 11:37:45 +0100 Subject: [PATCH 001/591] Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap; under COVARIANCE_MEMORY_OPT --- lib_com/options.h | 4 +- lib_enc/ivas_spar_encoder.c | 136 +++++++++++++++++++++++++++++++++++- lib_enc/ivas_spar_md_enc.c | 9 ++- lib_enc/ivas_stat_enc.h | 2 + 4 files changed, 146 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0ec45254f9..a3cc817f54 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,7 +175,9 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ #define NTT_REDUC_COMP_POC /* Contribution : Complexity reduction of phase spectrum in stereo downmix*/ -#define FIX_ISM_INACTIVE_BITS /* fix bitbudget distribution in inactive frames in ISM format */ +//#define FIX_ISM_INACTIVE_BITS /* fix bitbudget distribution in inactive frames in ISM format */ + +#define COVARIANCE_MEMORY_OPT /* Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index b08eeb5e4b..0dd5346e84 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -325,6 +325,120 @@ ivas_error ivas_spar_enc( } +#ifdef COVARIANCE_MEMORY_OPT +/*-------------------------------------------------------------------* + * ivas_spar_cov_md_process() + * + * Process call for SPAR covariance and MD encoder + *-------------------------------------------------------------------*/ + +static void ivas_spar_cov_md_process( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + BSTR_ENC_HANDLE hMetaData, + const int16_t nchan_inp, + const int16_t sba_order, + float *ppIn_FR_real[IVAS_SPAR_MAX_CH], + float *ppIn_FR_imag[IVAS_SPAR_MAX_CH], + const int16_t transient_det, + const int16_t dtx_vad ) +{ + int16_t i, j, i_ts, b, table_idx; + float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float cov_real_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + float cov_dtx_real_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + ENCODER_CONFIG_HANDLE hEncoderConfig = st_ivas->hEncoderConfig; + SPAR_ENC_HANDLE hSpar = st_ivas->hSpar; + IVAS_QMETADATA_HANDLE hQMetaData = st_ivas->hQMetaData; + + /*-----------------------------------------------------------------------------------------* + * Covariance process + *-----------------------------------------------------------------------------------------*/ + + for ( i = 0; i < nchan_inp; i++ ) + { + for ( j = 0; j < nchan_inp; j++ ) + { + cov_real[i][j] = cov_real_buf[i][j]; + cov_dtx_real[i][j] = cov_dtx_real_buf[i][j]; + } + } + + ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det ); + + /*-----------------------------------------------------------------------------------------* + * Set SPAR bitrates + *-----------------------------------------------------------------------------------------*/ + + table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + + if ( hSpar->hMdEnc->table_idx != table_idx ) + { + hSpar->hMdEnc->table_idx = table_idx; + ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND ); + } + + /*-----------------------------------------------------------------------------------------* + * MetaData encoder + *-----------------------------------------------------------------------------------------*/ + + if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) + { + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); + } + + { + float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + float diffuseness[IVAS_MAX_NUM_BANDS]; + float Wscale_d[IVAS_MAX_NUM_BANDS]; + int16_t d_start_band, d_end_band; + int16_t dirac_band_idx; + + d_start_band = hSpar->enc_param_start_band; + d_end_band = IVAS_MAX_NUM_BANDS; + + for ( b = d_start_band; b < d_end_band; b++ ) + { + dirac_band_idx = hSpar->dirac_to_spar_md_bands[b] - d_start_band; + for ( i_ts = 0; i_ts < hQMetaData->q_direction->cfg.nblocks; i_ts++ ) + { + azi_dirac[b][i_ts] = hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[i_ts]; + ele_dirac[b][i_ts] = hQMetaData->q_direction->band_data[dirac_band_idx].elevation[i_ts]; + } + diffuseness[b] = 1.0f - hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio[0]; + } + + if ( d_start_band >= 6 && dtx_vad == 1 ) + { + mvr2r( hSpar->hMdEnc->spar_md.band_coeffs[d_start_band - 1].P_quant_re, hSpar->hMdEnc->spar_md.band_coeffs[d_start_band - 1].P_re, IVAS_SPAR_MAX_CH - 1 ); + } + + for ( b = d_start_band; b < d_end_band; b++ ) + { + Wscale_d[b] = 1.0f; + for ( i = 1; i < nchan_inp; i++ ) + { + Wscale_d[b] += cov_real[i][i][b] / max( EPSILON, cov_real[0][0][b] ); + } + Wscale_d[b] = Wscale_d[b] / ( 1.0f + (float) sba_order ); /*DirAC normalized signal variance sums to 1 + order*/ + Wscale_d[b] = sqrtf( Wscale_d[b] ); + Wscale_d[b] = min( 2.0f, max( Wscale_d[b], 1.0f ) ); + } + + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? 1 : sba_order, dtx_vad, Wscale_d ); + } + + if ( hSpar->hMdEnc->spar_hoa_md_flag ) + { + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); + } + + return; +} +#endif + + /*-----------------------------------------------------------------------------------------* * Function ivas_spar_enc_process() * @@ -343,10 +457,13 @@ static ivas_error ivas_spar_enc_process( float *p_pcm_tmp[IVAS_SPAR_MAX_CH]; int16_t i, j, b, i_ts, input_frame, transient_det, dtx_vad; int32_t ivas_total_brate, input_Fs; +#ifdef COVARIANCE_MEMORY_OPT + int16_t nchan_inp, sba_order; +#else float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - int16_t nchan_inp, nchan_transport, sba_order; int16_t table_idx; +#endif int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; ivas_error error; const int16_t *order; @@ -523,6 +640,9 @@ static ivas_error ivas_spar_enc_process( } } +#ifdef COVARIANCE_MEMORY_OPT + ivas_spar_cov_md_process( st_ivas, hMetaData, nchan_inp, sba_order, ppIn_FR_real, ppIn_FR_imag, transient_det, dtx_vad ); +#else /*-----------------------------------------------------------------------------------------* * Covariance process *-----------------------------------------------------------------------------------------*/ @@ -531,8 +651,13 @@ static ivas_error ivas_spar_enc_process( { for ( j = 0; j < nchan_inp; j++ ) { +#ifdef COVARIANCE_MEMORY_OPT + cov_real[i][j] = cov_real_buf[i][j]; + cov_dtx_real[i][j] = cov_dtx_real_buf[i][j]; +#else cov_real[i][j] = hSpar->hMdEnc->cov_real[i][j]; cov_dtx_real[i][j] = hSpar->hMdEnc->cov_dtx_real[i][j]; +#endif } } @@ -607,12 +732,17 @@ static ivas_error ivas_spar_enc_process( { ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); } +#endif /*-----------------------------------------------------------------------------------------* * FB mixer *-----------------------------------------------------------------------------------------*/ +#ifdef COVARIANCE_MEMORY_OPT + ivas_fb_mixer_get_in_out_mapping( hSpar->hFbMixer->fb_cfg, st_ivas->nchan_transport, ENC, remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], in_out_mixer_map ); +#else ivas_fb_mixer_get_in_out_mapping( hSpar->hFbMixer->fb_cfg, nchan_transport, ENC, remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], in_out_mixer_map ); +#endif #ifdef DEBUG_SBA_MD_DUMP { @@ -765,7 +895,11 @@ static ivas_error ivas_spar_enc_process( order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; +#ifdef COVARIANCE_MEMORY_OPT + for ( j = 0; j < st_ivas->nchan_transport; j++ ) +#else for ( j = 0; j < nchan_transport; j++ ) +#endif { mvr2r( p_pcm_tmp[j], data_f[order[j]], input_frame ); } diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 09c766b581..24d42b2369 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -147,6 +147,7 @@ ivas_error ivas_spar_md_enc_open( } } +#ifndef COVARIANCE_MEMORY_OPT if ( ( hMdEnc->cov_real = (float ***) count_malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov real matrix" ); @@ -184,7 +185,7 @@ ivas_error ivas_spar_md_enc_open( } } } - +#endif if ( ( hMdEnc->mixer_mat_local = (float ***) count_malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); @@ -249,6 +250,7 @@ void ivas_spar_md_enc_close( count_free( hMdEnc->mixer_mat ); } +#ifndef COVARIANCE_MEMORY_OPT if ( hMdEnc->cov_real != NULL ) { for ( i = 0; i < num_channels; i++ ) @@ -276,7 +278,7 @@ void ivas_spar_md_enc_close( } count_free( hMdEnc->cov_dtx_real ); } - +#endif if ( hMdEnc->mixer_mat_local != NULL ) { for ( i = 0; i < num_channels; i++ ) @@ -363,6 +365,7 @@ static ivas_error ivas_spar_md_enc_init( } } +#ifndef COVARIANCE_MEMORY_OPT for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) @@ -374,7 +377,7 @@ static ivas_error ivas_spar_md_enc_init( } } } - +#endif ivas_clear_band_coeffs( hMdEnc->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdEnc->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdEnc->spar_md_prior.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 0644fcd918..50a4bdbb65 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -638,8 +638,10 @@ typedef struct ivas_spar_md_enc_state_t int16_t num_decorr; float ***mixer_mat; +#ifndef COVARIANCE_MEMORY_OPT float ***cov_real; float ***cov_dtx_real; +#endif float ***mixer_mat_local; ivas_spar_md_com_cfg spar_md_cfg; ivas_arith_coeffs_t arith_coeffs; -- GitLab From 857ec60588aefc5c54adf9ba151ee204544a2a93 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 6 Dec 2022 11:38:53 +0100 Subject: [PATCH 002/591] merge from main --- lib_com/options.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a0f3493559..b75ba0e983 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,14 +175,13 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ #define NTT_REDUC_COMP_POC /* NTT Contribution 10: Complexity reduction of phase spectrum in stereo downmix*/ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ +#define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ //#define FIX_ISM_INACTIVE_BITS /* fix bitbudget distribution in inactive frames in ISM format */ #define COVARIANCE_MEMORY_OPT /* Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ -#define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ - /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif -- GitLab From dcc555206b57ca344a782e0d6869656e53e52425 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 8 Dec 2022 16:25:41 +1100 Subject: [PATCH 003/591] split binaural rendering with fast conv renderer --- Workspace_msvc/lib_debug.vcxproj | 6 +- Workspace_msvc/lib_rend.vcxproj | 5 + apps/decoder.c | 186 +++- apps/renderer.c | 290 +++++- lib_com/common_api_types.h | 19 + lib_com/ivas_cnst.h | 20 + lib_com/ivas_prot.h | 155 +++- lib_com/options.h | 8 +- lib_debug/debug.c | 133 ++- lib_debug/debug.h | 14 +- lib_debug/mem_count.c | 2 +- lib_dec/ivas_dec.c | 31 + lib_dec/ivas_dirac_dec.c | 41 + lib_dec/ivas_init_dec.c | 33 + lib_dec/ivas_mc_param_dec.c | 16 +- lib_dec/ivas_rom_dec.c | 43 + lib_dec/ivas_rom_dec.h | 12 + lib_dec/ivas_sba_dec.c | 12 + lib_dec/ivas_spar_md_dec.c | 4 +- lib_dec/ivas_stat_dec.h | 129 ++- lib_dec/lib_dec.c | 39 +- lib_dec/lib_dec.h | 12 + lib_rend/ivas_binauralRenderer.c | 479 +++++++++- lib_rend/ivas_lib_rend_internal.h | 52 ++ lib_rend/ivas_output_init.c | 12 + lib_rend/ivas_splitRend_lcld_dec.c | 92 ++ lib_rend/ivas_splitRend_lcld_enc.c | 92 ++ lib_rend/ivas_splitRendererPost.c | 1004 ++++++++++++++++++++ lib_rend/ivas_splitRendererPre.c | 1324 +++++++++++++++++++++++++++ lib_rend/ivas_splitRenderer_utils.c | 300 ++++++ lib_rend/lib_rend.c | 267 +++++- lib_rend/lib_rend.h | 25 + 32 files changed, 4774 insertions(+), 83 deletions(-) create mode 100644 lib_rend/ivas_splitRend_lcld_dec.c create mode 100644 lib_rend/ivas_splitRend_lcld_enc.c create mode 100644 lib_rend/ivas_splitRendererPost.c create mode 100644 lib_rend/ivas_splitRendererPre.c create mode 100644 lib_rend/ivas_splitRenderer_utils.c diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 5dc36d4633..ec954e62ff 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_util;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) false @@ -97,7 +97,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_util;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) false @@ -124,7 +124,7 @@ AnySuitable false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_util;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index c3a1268694..af88421f8b 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -200,6 +200,11 @@ + + + + + diff --git a/apps/decoder.c b/apps/decoder.c index 6396e3ab94..29d0e17119 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -76,6 +76,10 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( 3750 ) /*temp buffer size for 1.5 mbps*/ +#endif + #define IVAS_PUBLIC_ORIENT_TRK_REF 0 #define IVAS_PUBLIC_ORIENT_TRK_AVG 1 @@ -114,7 +118,10 @@ typedef struct #ifdef DEBUG_FOA_AGC FILE *agcBitstream; /* temporary */ #endif - +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_MODE splitRendMode; + char *postRendheadrotTrajFileName; #endif } DecArguments; @@ -126,7 +133,13 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, +#ifdef SPLIT_REND_WITH_HEAD_ROT + HeadRotFileReader *postRendheadRotReader, + uint8_t *splitRendBitsBuf, +#endif + IVAS_DEC_HANDLE hIvasDec, + int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING static int16_t app_own_random( int16_t *seed ); @@ -186,8 +199,14 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + HeadRotFileReader *postRendheadRotReader = NULL; +#endif ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + uint8_t splitRendBitsBuf[MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES]; +#endif RenderConfigReader *renderConfigReader = NULL; #ifdef DEBUGGING int32_t noClipping; @@ -284,6 +303,16 @@ int main( goto cleanup; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( arg.splitRendMode == SPLIT_REND_COMB ) + { + if ( ( error = HeadRotationFileReader_open( arg.postRendheadrotTrajFileName, &postRendheadRotReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open post renderer head-rotation file %s \n\n", arg.postRendheadrotTrajFileName ); + goto cleanup; + } + } +#endif /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file @@ -316,9 +345,18 @@ int main( *------------------------------------------------------------------------------------------*/ #ifdef DEBUGGING - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, +#ifdef SPLIT_REND_WITH_HEAD_ROT + arg.splitRendMode, +#endif + arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK ) #else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + arg.enableSplitRendWithHeadRot +#endif + ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -507,7 +545,11 @@ int main( } else { - error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); + error = decodeG192( arg, hBsReader, headRotReader, +#ifdef SPLIT_REND_WITH_HEAD_ROT + postRendheadRotReader, splitRendBitsBuf, +#endif + hIvasDec, pcmBuf ); } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -554,7 +596,9 @@ cleanup: CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); - +#ifdef SPLIT_REND_WITH_HEAD_ROT + HeadRotationFileReader_close( &postRendheadRotReader ); +#endif RenderConfigReader_close( &renderConfigReader ); if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) @@ -666,6 +710,43 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static int8_t parseSplitRendMode( + char *value, + IVAS_SPLIT_REND_MODE *SplitRendMode ) +{ + int16_t temp; + int8_t success; + success = 1; + to_upper( value ); + + temp = (int16_t) atoi( value ); + if ( temp == 0 ) + { + *SplitRendMode = SPLIT_REND_DISABLED; + } +#if 0 + else if ( temp == 1 ) + { + *SplitRendMode = SPLIT_REND_PRE; + } + else if ( temp == 2 ) + { + *SplitRendMode = SPLIT_REND_POST; + } +#endif + else if ( temp == 3 ) + { + *SplitRendMode = SPLIT_REND_COMB; + } + else + { + fprintf( stderr, "Error: Incorrect or unsupported value for split rendering mode specified!\n\n" ); + success = 0; + } + return success ? 0 : -1; +} +#endif /*---------------------------------------------------------------------* * parseCmdlIVAS_dec() * @@ -698,6 +779,10 @@ static bool parseCmdlIVAS_dec( arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + arg->postRendheadrotTrajFileName = NULL; +#endif + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; #ifdef SUPPORT_JBM_TRACEFILE @@ -720,6 +805,10 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->no_diegetic_pan = 0.f; +#ifdef SPLIT_REND_WITH_HEAD_ROT + arg->splitRendMode = SPLIT_REND_DISABLED; +#endif + /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -871,6 +960,41 @@ static bool parseCmdlIVAS_dec( arg->headrotTrajFileName = argv[i]; i++; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( strcmp( argv_to_upper, "-SBRM" ) == 0 ) + { + i++; + + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Head rotation file name not specified!\n\n" ); + usage_dec(); + return false; + } + if ( parseSplitRendMode( argv[i], &arg->splitRendMode ) != 0 ) + { + fprintf( stderr, "Error: Invalid split rendering mode %s \n\n", argv[i] ); + usage_dec(); + return false; + } + i++; + } + else if ( strcmp( argv_to_upper, "-PRTF" ) == 0 ) + { + arg->enableHeadRotation = true; + i++; + + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Head rotation file name not specified!\n\n" ); + usage_dec(); + return false; + } + + arg->postRendheadrotTrajFileName = argv[i]; + i++; + } +#endif else if ( strcmp( argv_to_upper, "-OTR" ) == 0 ) { if ( strlen( argv[i + 1] ) > 3 ) @@ -1079,6 +1203,10 @@ static void usage_dec( void ) fprintf( stdout, " which of the two supported formats is in use.\n" ); fprintf( stdout, " default bitstream file format is G.192\n" ); fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + fprintf( stdout, "-sbrm mode : split rendering mode (0 - disabled, 1 - PRE RENDERER, 2 - POST RENDERER, 3 - COMBINED PRE-POST RENDERING), by default disabled\n" ); + fprintf( stdout, "-prtf File : Head rotation for post renderer specified by external trajectory File (to be used with split rendering)\n" ); +#endif fprintf( stdout, "-hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration\n" ); #ifdef DEBUGGING fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" ); @@ -1126,6 +1254,10 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, +#ifdef SPLIT_REND_WITH_HEAD_ROT + HeadRotFileReader *postRendheadRotReader, + uint8_t *splitRendBitsBuf, +#endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -1151,6 +1283,10 @@ static ivas_error decodeG192( uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_BITS splitRendBits; +#endif + IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { @@ -1172,6 +1308,13 @@ static ivas_error decodeG192( reset_wmops(); #endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + splitRendBits.bits_buf = splitRendBitsBuf; + splitRendBits.bits_read = 0; + splitRendBits.bits_written = 0; + splitRendBits.buf_len = MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES; +#endif + /*------------------------------------------------------------------------------------------* * Loop for every packet (frame) of bitstream data * - Read the bitstream packet @@ -1226,15 +1369,42 @@ static ivas_error decodeG192( goto cleanup; } - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + SPLIT_REND_PRE +#endif + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( arg.splitRendMode == SPLIT_REND_COMB ) + { + if ( ( error = HeadRotationFileReading( postRendheadRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading post rendering head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, SPLIT_REND_POST ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } +#endif } /* Run decoder for one frame (get rendered output) */ - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + &splitRendBits +#endif + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not get samples from decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index 8682232fa0..1fc6a5bad5 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -183,6 +183,10 @@ typedef struct char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_MODE splitRendMode; + char postRendheadRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; +#endif char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientationTracking; @@ -211,6 +215,10 @@ typedef enum CmdLnOptionId_inputMetadata, CmdLnOptionId_listFormats, CmdLnOptionId_inputGain, +#ifdef SPLIT_REND_WITH_HEAD_ROT + CmdLnOptionId_SplitRendMode, + CmdLnOptionId_PostRendtrajFile, +#endif } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -256,6 +264,20 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "tf", .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", }, +#ifdef SPLIT_REND_WITH_HEAD_ROT + { + .id = CmdLnOptionId_SplitRendMode, + .match = "split_bin_rend_mode", + .matchShort = "sbrm", + .description = "Split rendering mode option (only for BINAURAL and BINAURAL_ROOM outputs)", + }, + { + .id = CmdLnOptionId_PostRendtrajFile, + .match = "post_rend_trajectory_file", + .matchShort = "prtf", + .description = "Split rendering option with head tracking data for post renderer (only for BINAURAL and BINAURAL_ROOM outputs)", + }, +#endif { .id = CmdLnOptionId_customHrtfFile, .match = "custom_hrtf", @@ -405,7 +427,13 @@ static void printSupportedAudioConfigs( void ); static IVAS_REND_AudioConfig parseAudioConfig( const char *configString ); -static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer ); +static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t cldfb_in, + HANDLE_CLDFB_FILTER_BANK *cldfbAna +#endif +); static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer ); @@ -558,6 +586,50 @@ static float dBToLin( return powf( 10.0f, gain_dB / 20.0f ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static int16_t rend_openCldfb( + HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], + const int16_t num_in_chs, + const int32_t output_Fs ) +{ + int16_t n; + + for ( n = 0; n < num_in_chs; n++ ) + { + if ( openCldfb( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) != IVAS_ERR_OK ) + { + return -1; + } + } + return 0; +} + +static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS] ) +{ + int16_t n; + for ( n = 0; n < MAX_INPUT_CHANNELS; n++ ) + { + if ( cldfbAna[n] != NULL ) + { + deleteCldfb( &( cldfbAna[n] ) ); + cldfbAna[n] = NULL; + } + } + return; +} + +static int16_t get_cldfb_in_flag( CmdlnArgs *args ) +{ + int16_t cldfb_in; + cldfb_in = 0; + if ( ( args->splitRendMode == SPLIT_REND_PRE ) || ( args->splitRendMode == SPLIT_REND_COMB ) ) + { + cldfb_in = 1; + } + + return cldfb_in; +} +#endif /* ============================================================================ */ @@ -567,6 +639,11 @@ int main( { IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + HeadRotFileReader *postRendHeadRotReader = NULL; + HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS]; + int16_t cldfb_in; +#endif hrtfFileReader *hrtfFileReader = NULL; IsmPositionProvider *positionProvider; RenderConfigReader *renderConfigReader = NULL; @@ -622,6 +699,13 @@ int main( HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( args.splitRendMode == SPLIT_REND_COMB ) && !isEmptyString( args.postRendheadRotationFilePath ) ) + { + HeadRotationFileReader_open( args.postRendheadRotationFilePath, &postRendHeadRotReader ); + } +#endif + if ( !isEmptyString( args.customHrtfFilePath ) ) { hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ); @@ -666,12 +750,22 @@ int main( } const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + const int16_t CLDFBframeSize_smpls = (int16_t) frameSize_smpls * 2; + cldfb_in = get_cldfb_in_flag( &args ); +#endif + IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] = { 0 }; IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 }; - if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + args.splitRendMode +#endif + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -794,6 +888,12 @@ int main( } const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( cldfb_in ) + { + rend_openCldfb( cldfbAna, totalNumInChannels, args.sampleRate ); + } +#endif if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */ && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) ) @@ -829,11 +929,26 @@ int main( inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; inpInt16Buffer = count_malloc( inBufferSize * sizeof( int16_t ) ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( cldfb_in == 0 ) + { + inFloatBuffer = count_malloc( inBufferSize * sizeof( float ) ); + inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; + } + else + { + inFloatBuffer = count_malloc( CLDFBframeSize_smpls * totalNumInChannels * sizeof( float ) ); + inBuffer.config.numSamplesPerChannel = (int16_t) CLDFBframeSize_smpls; + } +#else inFloatBuffer = count_malloc( inBufferSize * sizeof( float ) ); +#endif outInt16Buffer = count_malloc( outBufferSize * sizeof( int16_t ) ); outFloatBuffer = count_malloc( outBufferSize * sizeof( float ) ); - inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; +#ifdef SPLIT_REND_WITH_HEAD_ROT + inBuffer.config.is_cldfb = cldfb_in; +#endif inBuffer.config.numChannels = (int16_t) totalNumInChannels; inBuffer.data = inFloatBuffer; @@ -874,7 +989,12 @@ int main( } /* Convert from int to float and from interleaved to packed */ - convertInputBuffer( inpInt16Buffer, numSamplesRead, frameSize_smpls, num_in_channels, inFloatBuffer ); + convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + inBuffer.config.is_cldfb, cldfbAna +#endif + ); #ifdef DEC_TO_REND_FLOAT_DUMP /* Overwrite from dump file */ float tmp[960 * 16]; @@ -899,13 +1019,33 @@ int main( { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; HeadRotationFileReading( headRotReader, quatBuffer, frame ); - IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ); + IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + SPLIT_REND_PRE +#endif + ); } else { - IVAS_REND_SetHeadRotation( hIvasRend, NULL ); + IVAS_REND_SetHeadRotation( hIvasRend, NULL +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + SPLIT_REND_PRE +#endif + ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /* Read from post renderer head rotation trajectory file if specified */ + if ( postRendHeadRotReader != NULL ) + { + IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; + HeadRotationFileReading( postRendHeadRotReader, quatBuffer, frame ); + IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, SPLIT_REND_POST ); + } +#endif + for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) @@ -1071,6 +1211,13 @@ int main( { MasaFileReader_close( &masaReaders[i] ); } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( cldfb_in ) + { + rend_closeCldfb( cldfbAna ); + } +#endif AudioFileReader_close( &audioReader ); AudioFileWriter_close( &audioWriter ); HeadRotationFileReader_close( &headRotReader ); @@ -1090,6 +1237,10 @@ int main( print_mem_renderer( SRAM_size ); #endif +#ifdef DEBUGGING + dbgclose(); +#endif + return 0; } @@ -1276,6 +1427,44 @@ static int8_t parseDiegeticPan( return success ? 0 : -1; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static int8_t parseSplitRendMode( + char *value, + IVAS_SPLIT_REND_MODE *SplitRendMode ) +{ + int16_t temp; + int8_t success; + success = 1; + to_upper( value ); + + temp = (int16_t) atoi( value ); + if ( temp == 0 ) + { + *SplitRendMode = SPLIT_REND_DISABLED; + } +#if 0 + else if ( temp == 1 ) + { + *SplitRendMode = SPLIT_REND_PRE; + } + else if ( temp == 2 ) + { + *SplitRendMode = SPLIT_REND_POST; + } +#endif + else if ( temp == 3 ) + { + *SplitRendMode = SPLIT_REND_COMB; + } + else + { + fprintf( stderr, "Error: Incorrect or unsupported value for split rendering mode specified!\n\n" ); + success = 0; + } + return success ? 0 : -1; +} +#endif + static int8_t parseOrientationTracking( char *value, int8_t *tracking_type ) @@ -1305,8 +1494,13 @@ static int8_t parseOrientationTracking( static IVAS_REND_AudioConfig parseAudioConfig( const char *configString ) { +#ifndef SPLIT_REND_WITH_HEAD_ROT char charBuf[14]; charBuf[13] = '\0'; +#else + char charBuf[25]; + charBuf[24] = '\0'; +#endif strncpy( charBuf, configString, sizeof( charBuf ) - 1 ); to_upper( charBuf ); @@ -1377,7 +1571,6 @@ static IVAS_REND_AudioConfig parseAudioConfig( { return IVAS_REND_AUDIO_CONFIG_BINAURAL; } - return IVAS_REND_AUDIO_CONFIG_UNKNOWN; } @@ -1467,6 +1660,11 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT + args.splitRendMode = SPLIT_REND_DISABLED; + clearString( args.postRendheadRotationFilePath ); +#endif clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); @@ -1538,6 +1736,20 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case CmdLnOptionId_PostRendtrajFile: + assert( numOptionValues == 1 ); + strncpy( args->postRendheadRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); + break; + case CmdLnOptionId_SplitRendMode: + assert( numOptionValues == 1 ); + if ( parseSplitRendMode( optionValues[0], &args->splitRendMode ) != 0 ) + { + fprintf( stderr, "Unknown option for split rendering mode: %s\n", optionValues[0] ); + exit( -1 ); + } + break; +#endif case CmdLnOptionId_customHrtfFile: assert( numOptionValues == 1 ); strncpy( args->customHrtfFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); @@ -2392,26 +2604,72 @@ static void convertInputBuffer( const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, - float *floatBuffer ) + float *floatBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t cldfb_in, + HANDLE_CLDFB_FILTER_BANK *cldfbAna +#endif +) { int16_t chnl, smpl, i; i = 0; +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( cldfb_in ) + { + int16_t slotIdx, numCldfbBands, numFloatPcmSamples; + float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + numFloatPcmSamples = numFloatSamplesPerChannel >> 1; + numCldfbBands = numFloatPcmSamples / CLDFB_NO_COL_MAX; + /* CLDFB Analysis*/ + assert( numIntSamplesPerChannel <= MAX_OUTPUT_CHANNELS * L_FRAME48k ); + for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) + { + if ( i < numIntSamplesPerChannel ) + { + fIn[chnl][smpl] = (float) intBuffer[i]; + } + else + { + fIn[chnl][smpl] = 0.f; + } - for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) - { + ++i; + } + } for ( chnl = 0; chnl < numChannels; ++chnl ) { - if ( i < numIntSamplesPerChannel ) + for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) { - floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = (float) intBuffer[i]; + cldfbAnalysis_ts( &fIn[chnl][numCldfbBands * slotIdx], + &floatBuffer[( chnl * numFloatSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands )], + &floatBuffer[numCldfbBands + ( chnl * numFloatSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands )], + numCldfbBands, + cldfbAna[chnl] ); } - else + } + } + else +#endif + { + for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) { - floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = 0.f; - } + if ( i < numIntSamplesPerChannel ) + { + floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = (float) intBuffer[i]; + } + else + { + floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = 0.f; + } - ++i; + ++i; + } } } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index fa14ecff23..39cbc82a1a 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -83,6 +83,16 @@ typedef struct } IVAS_QUATERNION; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef struct ivas_split_rend_bits_t +{ + uint8_t *bits_buf; + int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ + int32_t bits_written; + int32_t bits_read; +} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS, *IVAS_SPLIT_REND_BITS_HANDLE; +#endif + typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; @@ -146,5 +156,14 @@ typedef struct _IVAS_JBM_TRACE_DATA } IVAS_JBM_TRACE_DATA; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef enum _IVAS_SPLIT_REND_MODE +{ + SPLIT_REND_DISABLED = -1, + SPLIT_REND_PRE, + SPLIT_REND_POST, + SPLIT_REND_COMB +} IVAS_SPLIT_REND_MODE; +#endif #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4a9ce1e080..0c33ade4d7 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1360,6 +1360,26 @@ typedef enum #define BINAURAL_CONVBANDS 50 /* Bands upto which convolution is performed */ #define BINAURAL_NTAPS_MAX 96 +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define SPLIT_REND_DECOR_ALPHA (0.25f) +#define MAX_YAW_ANGLES (3) +#define MAX_PITCH_ANGLES (1) +#define MAX_ROLL_ANGLES (1) +#define MAX_HEAD_ROT_POSES (MAX_YAW_ANGLES*MAX_PITCH_ANGLES*MAX_ROLL_ANGLES) +#define MAX_SPLIT_REND_MD_BANDS (20) +#define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS) + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) +#define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) +#define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.0f ) +#define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) +#define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f ) +#define IVAS_SPLIT_REND_D_MAX_VAL ( 1.0f ) +#define IVAS_SPLIT_REND_MAX_NUM_BYTES (4000) +#endif +#endif + #define HRTF_SH_ORDER 3 #define HRTF_SH_CHANNELS 16 #define HRTF_NUM_BINS 60 diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c09adab6c8..fea2bef693 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -298,6 +298,10 @@ void stereo_dmx_evs_close_encoder( ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ int16_t *data /* o : output synthesis signal */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits +#endif ); ivas_error ivas_dec_setup( @@ -4339,6 +4343,14 @@ void ivas_quantise_real_values( const int16_t dim ); +ivas_error ivas_deindex_real_index( + const int16_t *index, + const int16_t q_levels, + const float min_value, + const float max_value, + float *quant, + const int16_t num_ch_dim2 ); + void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, @@ -4551,12 +4563,20 @@ void ivas_binaural_cldfb( ); void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ +#else + float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ +#endif + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ); void ivas_binaural_add_LFE( @@ -4638,6 +4658,129 @@ void rotateFrame_sd_cldfb( const int16_t nb_band /* i : number of CLDFB bands to process */ ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + +/*----------------------------------------------------------------------------------* + * Split renderer prototypes + *----------------------------------------------------------------------------------*/ + +void ivas_set_split_rend_setup( + IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ); + +void ivas_init_split_rend_handles( + SPLIT_REND_WRAPPER *hSplitRendWrapper ); + +ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitBinRend, + const int32_t output_Fs, + const IVAS_SPLIT_REND_MODE splitRendMode, + const int16_t is_cldfb_in ); + +void ivas_split_renderer_close( + SPLIT_REND_WRAPPER *hSplitBinRend); + +ivas_error ivas_splitBinLCLDEncOpen( + BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ); + +void ivas_splitBinLCLDEncClose( + BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ); + +void ivas_splitBinLCLDEncProcess( + BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc, + float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + ivas_split_rend_bits_t *pBits ); + +ivas_error ivas_splitBinLCLDDecOpen( + BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ); + +void ivas_splitBinLCLDDecClose( + BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ); + +void ivas_splitBinLCLDDecProcess( + BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, + ivas_split_rend_bits_t *pBits, + float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ); + +ivas_error ivas_splitBinPreRendOpen( + BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + , + const int32_t output_Fs +#endif +); + +ivas_error ivas_splitBinPostRendOpen( + BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, + const int32_t output_Fs ); + +ivas_error ivas_renderMultiBinToSplitBinaural( + SPLIT_REND_WRAPPER *hSplitBin, + ivas_split_rend_bits_t *pBits, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], + const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], + const int16_t max_bands, + float out[][L_FRAME48k]); + +void ivas_rend_CldfbSplitPreRendProcess( + const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t max_bands, + ivas_split_rend_bits_t *pBits ); + +void ivas_rend_CldfbSplitPostRendProcess( + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, + const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], + const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], + float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float output[][L_FRAME48k] ); + +void ivas_splitBinPreRendClose( + BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ); + +void ivas_splitBinPostRendClose( + BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend ); + +void ivas_splitBinPostRendMdDec( + ivas_split_rend_bits_t *pBits, + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, +#endif + const int16_t num_md_bands); + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +void ivas_log_cldfb2wav_data( + float Cldfb_In_Real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + HANDLE_CLDFB_FILTER_BANK *cldfbSyn, + const int16_t num_chs, + const int16_t num_freq_bands, + const int32_t output_Fs, + const char *filename ); +#endif + +void ivas_SplitRenderer_GetRotMd( + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ + float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + ivas_split_rend_bits_t *pBits, + int16_t sf_idx ); + +void ivas_SplitRenderer_PostRenderer( + BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ + float Cldfb_RealBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + int16_t sf_idx, + const IVAS_QUATERNION *Quaternions_ref, + const IVAS_QUATERNION *Quaternions_act ); + +#endif /*----------------------------------------------------------------------------------* * renderer prototypes diff --git a/lib_com/options.h b/lib_com/options.h index 9dc8ab44c8..1f12475cfb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,8 +154,12 @@ #define FIX_VBR_COMPLEXITY /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */ #define FIX_ISM_INACTIVE_BITS /* Issue 230: fix bitbudget distribution in inactive frames in ISM format */ - - +#define SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT +//#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes +#define SPLIT_REND_BASE2_CODING +//#define SPLIT_REND_SKIP_POST_REND +#endif /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_debug/debug.c b/lib_debug/debug.c index 5ee8f10e31..dc3d0cb4d9 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "options.h" #include "prot.h" #ifdef DEBUGGING @@ -54,6 +55,9 @@ #else #endif #include "wmops.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#include "tinywaveout_c.h" +#endif /*-------------------------------------------------------------------* @@ -89,12 +93,19 @@ int16_t debug_level = 0; static FILE *in_fileptr[N_FILEPTR]; static FILE *out_fileptr[N_FILEPTR]; - +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +static WAVEFILEOUT *out_wavfileptr[N_FILEPTR]; +#endif static char *in_filename[N_FILEPTR]; static char *out_filename[N_FILEPTR]; - +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +static char *out_wavfilename[N_FILEPTR]; +#endif static int16_t in_count = 0; static int16_t out_count = 0; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +static int16_t out_wav_count = 0; +#endif static int16_t flag_count = 0; static char *flag_name[N_DBGFLAG]; @@ -390,7 +401,13 @@ void dbgclose() fclose( out_fileptr[i] ); free( out_filename[i] ); } - +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( i = 0; i < out_wav_count; i++ ) + { + CloseWav( out_wavfileptr[i] ); + free( out_wavfilename[i] ); + } +#endif for ( i = 0; i < snr_count; i++ ) { free( snr_name[i] ); @@ -846,4 +863,114 @@ int16_t make_dirs( const char *const pathname ) return 0; } +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +int16_t dbgwrite_wav( + const float *buffer[], /* i : Write buffer */ + const int16_t count_per_ch, /* i : Number of elements */ + const char *const filename, + int32_t fs, + int16_t num_chs ) +{ + int16_t index, i; + int16_t *tmp_buf; + + index = lookup( filename, (const char *const *) out_wavfilename, out_wav_count ); + + if ( index == -1 ) + { + if ( make_dirs( filename ) != 0 ) + { + fprintf( stderr, "dbgwrite: Could not create directory structure for %s. Exiting..\n", filename ); + exit( -1 ); + } + + index = out_wav_count; + out_wavfileptr[index] = CreateWav( (const char *) filename, fs, num_chs, 16 /* const uint32_t writeWaveExt */ ); + out_wavfilename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( out_wavfilename[index], filename ); + out_wav_count++; + } + + if ( out_wavfileptr[index] != NULL ) + { + int16_t j, k; + float tmp; + tmp_buf = (int16_t *) calloc( count_per_ch * num_chs, sizeof( int16_t ) ); + k = 0; + for ( j = 0; j < count_per_ch; j++ ) + { + for ( i = 0; i < num_chs; i++, k++ ) + { + tmp = roundf( buffer[i][j] ); + tmp_buf[k] = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B + : (short) tmp; + } + } + WriteWavShort( out_wavfileptr[index], tmp_buf, count_per_ch * num_chs ); + free( tmp_buf ); + } + else + { + fprintf( stderr, "dbgwrite_wav: Could not write to file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} + + +int16_t dbgwrite_txt( + const float *buffer, /* i : Write buffer */ + const int16_t count, /* i : Number of elements */ + const char *const filename, + const char *const msg_opt ) +{ + int16_t index, i; + + index = lookup( filename, (const char *const *) out_filename, out_count ); + + if ( index == -1 ) + { + if ( make_dirs( filename ) != 0 ) + { + fprintf( stderr, "dbgwrite: Could not create directory structure for %s. Exiting..\n", filename ); + exit( -1 ); + } + + index = out_count; + out_fileptr[index] = fopen( filename, "w" ); + out_filename[index] = malloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); + strcpy( out_filename[index], filename ); + out_count++; + } + + if ( out_fileptr[index] != NULL ) + { + if ( buffer != NULL ) + { + if ( msg_opt == NULL ) + { + for ( i = 0; i < count; i++ ) + { + fprintf( out_fileptr[index], "%f\n", buffer[i] ); + } + } + else + { + for ( i = 0; i < count; i++ ) + { + fprintf( out_fileptr[index], "%s %f\n", msg_opt, buffer[i] ); + } + } + } + } + else + { + fprintf( stderr, "dbgwrite_txt: Could not write to file: %s. Exiting..\n", filename ); + exit( -1 ); + } + + return 0; +} +#endif #endif /* DEBUGGING */ diff --git a/lib_debug/debug.h b/lib_debug/debug.h index abf246674a..e228f11cf4 100644 --- a/lib_debug/debug.h +++ b/lib_debug/debug.h @@ -95,7 +95,19 @@ int16_t dbgwrite( const char *const filename #endif ); - +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +int16_t dbgwrite_wav( + const float *buffer[], /* i : Write buffer */ + const int16_t count_per_ch, /* i : Number of elements */ + const char *const filename, + int32_t fs, + int16_t num_chs ); +int16_t dbgwrite_txt( + const float *buffer, /* i : Write buffer */ + const int16_t count, /* i : Number of elements */ + const char *const filename, + const char *const msg_opt ); +#endif void dbgwrite_mat_repeat( float *buffer, /* i : write buffer */ int16_t nRow, /* i : matrix size (rows) */ diff --git a/lib_debug/mem_count.c b/lib_debug/mem_count.c index 278126d35e..598b023df3 100644 --- a/lib_debug/mem_count.c +++ b/lib_debug/mem_count.c @@ -98,7 +98,7 @@ typedef INT64 int64_t; /* This is the maximum number of allocations for which to keep information. It can be increased if required. */ #ifdef SBA_BR_SWITCHING -#define MAX_INFO_RECORDS 8000 +#define MAX_INFO_RECORDS 9000 #else #define MAX_INFO_RECORDS 3000 #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 5d3a5a10f9..cf887ab725 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -53,6 +53,10 @@ ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t *data /* o : output synthesis signal */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits +#endif ) { int16_t n, output_frame, nchan_out; @@ -85,6 +89,12 @@ ivas_error ivas_dec( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->hDecoderConfig->Opt_splitRendMode != SPLIT_REND_DISABLED ) + { + ivas_set_split_rend_setup( &st_ivas->splitBinRend, hSplitRendBits ); + } +#endif /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ @@ -543,6 +553,27 @@ ivas_error ivas_dec( } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*split rendering process calls*/ + if ( st_ivas->hDecoderConfig->Opt_splitRendMode != SPLIT_REND_DISABLED ) + { + if ( ( st_ivas->splitBinRend.splitrend.hBinHrSplitPreRend != NULL ) && ( st_ivas->splitBinRend.splitrend.hBinHrSplitPostRend != NULL ) ) + { + IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; + int16_t max_band; + hSplitBinRend = &st_ivas->splitBinRend; + max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); + ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, + hSplitBinRend->hSplitRendBits, + hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, + hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, + st_ivas->hHeadTrackData->Quaternions, + st_ivas->hPostRendheadTrackData->Quaternions, max_band, output ); + + dynamic_free( st_ivas->splitBinRend.hMultiBinCldfbData ); + } + } +#endif /*----------------------------------------------------------------* * Write IVAS output channels * - compensation for saturation diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index f2273de26d..8b07d7bb1d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1815,8 +1815,19 @@ void ivas_dirac_dec( /*CLDFB: last output channels reserved to LFT for CICPx*/ float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif +#else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif + int16_t index, num_freq_bands; DIRAC_DEC_STACK_MEM DirAC_mem; @@ -2338,12 +2349,37 @@ void ivas_dirac_dec( /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + st_ivas->hPostRendheadTrackData, +#endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->hBinRenderer->splitRendMode == SPLIT_REND_PRE || st_ivas->hBinRenderer->splitRendMode == SPLIT_REND_COMB ) + { + int16_t pos_idx; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES + 1; pos_idx++ ) +#else + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) +#endif + { + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) + { + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][index_slot + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][index_slot + slot_idx], hDirAC->num_freq_bands ); + } + } + } + } +#endif + /* Inverse CLDFB*/ for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { @@ -2353,8 +2389,13 @@ void ivas_dirac_dec( for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; +#else RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; +#endif } cldfbSynthesis( RealBuffer, diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e51b46779c..5d8d158739 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -564,6 +564,20 @@ ivas_error ivas_init_decoder_front( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->hDecoderConfig->Opt_splitRendMode == SPLIT_REND_COMB ) + { + if ( ( error = ivas_headTrack_open( &( st_ivas->hPostRendheadTrackData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + st_ivas->hPostRendheadTrackData = NULL; + } +#endif + /*-------------------------------------------------------------------* * Allocate HRTF binary handle *--------------------------------------------------------------------*/ @@ -1157,6 +1171,9 @@ ivas_error ivas_init_decoder( { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, hDecoderConfig->output_Fs, hDecoderConfig->Opt_splitRendMode, 1 ); +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -1482,6 +1499,11 @@ void ivas_initialize_handles_dec( /* rendering handles */ st_ivas->hBinRenderer = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + st_ivas->splitBinRend.hMultiBinCldfbData = NULL; + st_ivas->splitBinRend.hSplitRendBits = NULL; + ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend ); +#endif st_ivas->hDiracDecBin = NULL; st_ivas->hLsSetUpConversion = NULL; st_ivas->hEFAPdata = NULL; @@ -1640,6 +1662,10 @@ void ivas_destroy_dec( /* Fastconv binaural renderer handle */ ivas_binRenderer_close( &st_ivas->hBinRenderer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + /* Split binaural renderer handle */ + ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); +#endif /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); @@ -1677,6 +1703,13 @@ void ivas_destroy_dec( count_free( st_ivas->hHeadTrackData ); st_ivas->hHeadTrackData = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->hPostRendheadTrackData != NULL ) + { + count_free( st_ivas->hPostRendheadTrackData ); + st_ivas->hPostRendheadTrackData = NULL; + } +#endif /* Time Domain binaural renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 7557fed214..7b8901fdec 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -799,8 +799,13 @@ void ivas_param_mc_dec( float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#endif float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -1052,7 +1057,11 @@ void ivas_param_mc_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + NULL, +#endif + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, Cldfb_ImagBuffer ); } else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) { @@ -1073,8 +1082,13 @@ void ivas_param_mc_dec( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; +#else RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; +#endif } else { diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index c79bc38019..d481ffa904 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -552,4 +552,47 @@ const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] 0.048207f, 0.10796f, 0.11845f, 0.047886f, 0.035917f, 0.045196f, 0.018863f, 0.015547f, 0.014157f }; +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*----------------------------------------------------------------------* + * split rendering ROM tables + *-----------------------------------------------------------------------*/ +const float split_rend_relative_yaw_angles[MAX_YAW_ANGLES] = {0.0f, -15.0f, 30.0f}; /*actual rotations would be Ref, Ref - 15, Ref - 15 + 30 */ +const float split_rend_relative_pitch_angles[MAX_PITCH_ANGLES] = {0.0f}; +const float split_rend_relative_roll_angles[MAX_ROLL_ANGLES] = {0.0f}; +const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] = +{ + //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 36, 38, 40, 50, 60 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 20, 25, 30, 35, 40, 50, 60 + //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 21, 23, 25, 27, 30, 35, 40, 50, 60 + //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 25, 40, 60 +}; + +const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = { + { 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 }, + { 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 }, + { 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 }, + { 12, 13, 8190 },{ 13, 14, 16382 },{ 14, 14, 16383 } +}; +const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3] = { + /* + { -15, 16, 65532 },{ -14, 16, 65533 },{ -13, 15, 32764 },{ -12, 14, 16380 }, + { -11, 13, 8188 },{ -10, 12, 4092 },{ -9, 11, 2044 },{ -8, 10, 1020 },{ -7, 9, 508 }, + { -6, 8, 252 },{ -5, 7, 124 },{ -4, 6, 60 },{ -3, 5, 28 }, + { -2, 4, 12 },{ -1, 3, 4 },{ 0, 1, 0 },{ 1, 3, 5 }, + { 2, 4, 13 },{ 3, 5, 29 },{ 4, 6, 61 },{ 5, 7, 125 }, + { 6, 8, 253 },{ 7, 9, 509 },{ 8, 10, 1021 },{ 9, 11, 2045 }, + { 10, 12, 4093 },{ 11, 13, 8189 },{ 12, 14, 16381 },{ 13, 15, 32765 }, + { 14, 16, 65534 },{ 15, 16, 65535 }*/ + +{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507}, +{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121}, +{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8}, +{-2,4,9},{-1,3,2},{0,2,0},{1,3,3}, +{2,4,10},{3,4,11},{4,5,26},{5,5,27}, +{6,6,58},{7,6,59},{8,7,122},{9,7,123}, +{10,7,124},{11,8,252},{12,9,508},{13,9,509}, +{14,10,1022},{15,10,1023}, +}; +#endif + /* clang-format on */ diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index febc60e2e5..aa5f48cbe9 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -156,4 +156,16 @@ extern const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENC extern const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS]; extern const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS]; +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*----------------------------------------------------------------------* + * split rendering ROM tables + *-----------------------------------------------------------------------*/ +extern const float split_rend_relative_yaw_angles[MAX_YAW_ANGLES]; +extern const float split_rend_relative_pitch_angles[MAX_PITCH_ANGLES]; +extern const float split_rend_relative_roll_angles[MAX_ROLL_ANGLES]; +extern const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1]; +extern const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; +extern const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3]; +#endif + #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 975fb60480..3c02a05d9b 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -159,6 +159,9 @@ ivas_error ivas_sba_dec_reinit( /* Fastconv binaural renderer handle */ ivas_binRenderer_close( &st_ivas->hBinRenderer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); +#endif /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); @@ -460,6 +463,9 @@ ivas_error ivas_sba_dec_reinit( { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, hDecoderConfig->output_Fs, hDecoderConfig->Opt_splitRendMode, 1 ); +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -794,10 +800,16 @@ ivas_error ivas_sba_dec_reconfigure( { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->Opt_splitRendMode, 1 ); +#endif } else if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) { ivas_binRenderer_close( &st_ivas->hBinRenderer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); +#endif } if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index f316c746cf..4eed6b8ced 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,8 +83,6 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); -static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); - static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode ); @@ -2482,7 +2480,7 @@ static void ivas_parse_parameter_bitstream_dtx( * Deindex real index *-----------------------------------------------------------------------------------------*/ -static ivas_error ivas_deindex_real_index( +ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a18f826921..0b346d0036 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1264,15 +1264,107 @@ typedef struct ivas_binaural_rendering_conv_module_struct float ***filterTapsLeftImag; float ***filterTapsRightReal; float ***filterTapsRightImag; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + float ****filterStatesLeftReal; + float ****filterStatesLeftImag; +#else float ***filterStatesLeftReal; float ***filterStatesLeftImag; +#endif int16_t numTapsArray[BINAURAL_CONVBANDS]; int16_t numTaps; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t numPoses; +#endif } BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE; +#ifdef SPLIT_REND_WITH_HEAD_ROT +/* binaural split rendering head rotation data structure */ +typedef struct ivas_binaural_head_rot_split_rendering_md_struct +{ + float pred_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float pred_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float gd; + int16_t pred_mat_re_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + int16_t pred_mat_im_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + int16_t gd_idx; +} BIN_HR_SPLIT_REND_MD, *BIN_HR_SPLIT_REND_MD_HANDLE; + +typedef struct ivas_split_rend_huffman_cfg_t +{ + const int32_t *codebook; + int16_t min_len; + int16_t max_len; + int16_t sym_len; +} ivas_split_rend_huffman_cfg_t; + +typedef struct ivas_binaural_head_rot_split_rendering_huff_struct +{ + ivas_split_rend_huffman_cfg_t pred; + int16_t pred_idx_trav[IVAS_SPLIT_REND_PRED_QUANT_PNTS]; + int16_t pred_base2_code_len; + ivas_split_rend_huffman_cfg_t gd; + int16_t gd_base2_code_len; + int16_t gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS]; +} BIN_HR_SPLIT_REND_HUFF, *BIN_HR_SPLIT_REND_HUFF_HANDLE; + +typedef struct ivas_binaural_head_rot_split_pre_rendering_struct +{ + BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; + float fix_pos_rot_mat[MAX_YAW_ANGLES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + BIN_HR_SPLIT_REND_HUFF huff_cfg; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS]; +#endif +} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE; + +typedef struct ivas_binaural_head_rot_split_post_rendering_struct +{ + BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; + float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + BIN_HR_SPLIT_REND_HUFF huff_cfg; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float mixer_mat_re[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mixer_mat_im[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float gd_mem[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS]; +#else + float mixer_mat_re[1][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mixer_mat_im[1][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float gd_mem[1][MAX_SPLIT_REND_MD_BANDS]; +#endif + int16_t cf_flag; + HANDLE_CLDFB_FILTER_BANK cldfbSyn[BINAURAL_CHANNELS]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HANDLE_CLDFB_FILTER_BANK cldfbSynReconsBinDec[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS]; +#endif +} BIN_HR_SPLIT_POST_REND, *BIN_HR_SPLIT_POST_REND_HANDLE; + +typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct +{ + void *pLcld_enc; +} BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE; + +typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct +{ + void *pLcld_dec; +} BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE; + +typedef struct +{ + HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; +} CLDFB_HANDLES_WRAPPER, *CLDFB_HANDLES_WRAPPER_HANDLE; +typedef struct +{ + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend; + BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc; + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend; + BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec; + CLDFB_HANDLES_WRAPPER_HANDLE hCldfbHandles; +} SPLIT_REND_WRAPPER; +#endif + /* Fastconv binaural data structure */ typedef struct ivas_binaural_rendering_struct { @@ -1287,14 +1379,15 @@ typedef struct ivas_binaural_rendering_struct int16_t nInChannels; /* number input channels */ int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ - +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_MODE splitRendMode; /*Split rendering mode, pre, post (OR combined in debug mode)*/ +#endif /* Convolution module structure */ BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; /* Variables related to reverb module */ float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; REVERB_STRUCT_HANDLE hReverb; - } BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; @@ -1688,7 +1781,6 @@ typedef struct ivas_render_config_t ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; - } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; @@ -1877,7 +1969,10 @@ typedef struct decoder_config_structure int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t orientation_tracking; /* indicates orientation tracking type */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_MODE Opt_splitRendMode; /* Split rendering mode */ +#endif + int16_t orientation_tracking; /* indicates orientation tracking type */ float no_diegetic_pan; int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ @@ -1889,7 +1984,24 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; - +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef struct +{ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#endif +} IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA, *IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE; +typedef struct +{ + IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE hMultiBinCldfbData; /*scratch buffer for frame by frame processing*/ + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; /*scratch buffer for frame by frame processing*/ + SPLIT_REND_WRAPPER splitrend; +} IVAS_DEC_SPLIT_REND_WRAPPER; +#endif /*----------------------------------------------------------------------------------* * * Main IVAS decoder structure @@ -1975,6 +2087,11 @@ typedef struct Decoder_Struct int32_t noClipping; /* number of clipped samples */ #endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_DEC_SPLIT_REND_WRAPPER splitBinRend; + HEAD_TRACK_DATA_HANDLE hPostRendheadTrackData; +#endif + } Decoder_Struct; /* clang-format on */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index d45527b740..676076fc1f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -95,7 +95,6 @@ static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSampl static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int16_t orientation_tracking, const float no_diegetic_pan ); - /*---------------------------------------------------------------------* * IVAS_DEC_Open() * @@ -388,6 +387,10 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const IVAS_SPLIT_REND_MODE splitRendMode /* i : split rend mode */ +#endif #ifdef DEBUGGING , const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ @@ -444,6 +447,10 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_Headrotation = enableHeadRotation; hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hDecoderConfig->Opt_splitRendMode = splitRendMode; +#endif + /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) { @@ -620,6 +627,10 @@ ivas_error IVAS_DEC_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ int16_t *nOutSamples /* o : number of samples written to output buffer */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits +#endif ) { Decoder_Struct *st_ivas; @@ -646,7 +657,12 @@ ivas_error IVAS_DEC_GetSamples( else if ( hIvasDec->mode == IVAS_DEC_MODE_IVAS ) { /* run the main IVAS decoding routine */ - if ( ( error = ivas_dec( st_ivas, pcmBuf ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dec( st_ivas, pcmBuf +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + hSplitRendBits +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -832,6 +848,10 @@ 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 */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_MODE splitRendMode /* i : flag to determine split rendering mode*/ +#endif ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; @@ -843,6 +863,12 @@ ivas_error IVAS_DEC_FeedHeadTrackData( } hHeadTrackData = hIvasDec->st_ivas->hHeadTrackData; +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( splitRendMode == SPLIT_REND_POST ) + { + hHeadTrackData = hIvasDec->st_ivas->hPostRendheadTrackData; + } +#endif if ( hHeadTrackData == NULL ) { @@ -858,7 +884,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Quaternions[i].z = orientation[i].z; } - hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; + hHeadTrackData->num_quaternions = 0; return IVAS_ERR_OK; } @@ -1345,7 +1371,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hIvasDec->st_ivas->hDecoderConfig->ivas_total_brate = st->total_brate; } - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamplesElse ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamplesElse +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + NULL +#endif + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index f43034c885..4a052ba32b 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -127,6 +127,10 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const IVAS_SPLIT_REND_MODE splitRendMode /* i : split rendering mode */ +#endif #ifdef DEBUGGING , const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ @@ -153,6 +157,10 @@ ivas_error IVAS_DEC_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ int16_t *nOutSamples /* o : number of samples written to output buffer */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits /* o : bitstream output for split rendering mode*/ +#endif ); /*! r: error code */ @@ -173,6 +181,10 @@ 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 */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_MODE splitRendMode /* i : flag to determine split rendering mode*/ +#endif ); /*! r: error code */ diff --git a/lib_rend/ivas_binauralRenderer.c b/lib_rend/ivas_binauralRenderer.c index 09713a6f5c..ff85e0c73b 100644 --- a/lib_rend/ivas_binauralRenderer.c +++ b/lib_rend/ivas_binauralRenderer.c @@ -40,6 +40,11 @@ #include "ivas_rom_rend.h" #include "ivas_rom_com.h" #include "ivas_rom_binauralRenderer.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "ivas_rom_dec.h" +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -58,6 +63,10 @@ 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 */ BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + int16_t pos_idx +#endif ) { int16_t bandIdx, k, chIdx, tapIdx; @@ -68,8 +77,13 @@ static void ivas_binRenderer_filterModule( { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + filterStatesLeftRealPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal[pos_idx][bandIdx][chIdx][0] ); + filterStatesLeftImagPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag[pos_idx][bandIdx][chIdx][0] ); +#else filterStatesLeftRealPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx][0] ); filterStatesLeftImagPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx][0] ); +#endif filterTapsLeftRealPtr = hBinRenderer->hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx]; filterTapsLeftImagPtr = hBinRenderer->hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx]; @@ -112,7 +126,6 @@ static void ivas_binRenderer_filterModule( return; } - /*------------------------------------------------------------------------- * ivas_binRenderer_convModuleOpen() * @@ -128,6 +141,9 @@ static ivas_error ivas_binRenderer_convModuleOpen( { int16_t bandIdx, chIdx; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx; +#endif /*-----------------------------------------------------------------* * prepare library opening @@ -229,7 +245,69 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hBinRenderer->splitRendMode == SPLIT_REND_PRE || hBinRenderer->splitRendMode == SPLIT_REND_COMB ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + hBinRenConvModule->numPoses = MAX_HEAD_ROT_POSES + 1; +#else + hBinRenConvModule->numPoses = MAX_HEAD_ROT_POSES; +#endif + } + else + { + hBinRenConvModule->numPoses = 1; + } + + if ( ( hBinRenConvModule->filterStatesLeftReal = (float ****) count_malloc( hBinRenConvModule->numPoses * sizeof( float *** ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + + if ( ( hBinRenConvModule->filterStatesLeftImag = (float ****) count_malloc( hBinRenConvModule->numPoses * sizeof( float *** ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + + for ( pos_idx = 0; pos_idx < hBinRenConvModule->numPoses; pos_idx++ ) + { + if ( ( hBinRenConvModule->filterStatesLeftReal[pos_idx] = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + + if ( ( hBinRenConvModule->filterStatesLeftImag[pos_idx] = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) + { + if ( ( hBinRenConvModule->filterStatesLeftReal[pos_idx][bandIdx] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + + if ( ( hBinRenConvModule->filterStatesLeftImag[pos_idx][bandIdx] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + + for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) + { + if ( ( hBinRenConvModule->filterStatesLeftReal[pos_idx][bandIdx][chIdx] = (float *) count_malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + + if ( ( hBinRenConvModule->filterStatesLeftImag[pos_idx][bandIdx][chIdx] = (float *) count_malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); + } + } + } + } +#else if ( ( hBinRenConvModule->filterStatesLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); @@ -265,8 +343,10 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } +#endif /* set memories */ + for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) @@ -305,10 +385,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && hRenderConfig->roomAcoustics.use_brir ) { - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftBRIRReal[bandIdx][tmp]; @@ -326,10 +402,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } else { - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTaps ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTaps ); - if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftHRIRReal[bandIdx][tmp]; @@ -349,6 +421,31 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < hBinRenConvModule->numPoses; pos_idx++ ) + { + for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) + { + for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) + { + /* set the memories to zero */ + set_zero( hBinRenConvModule->filterStatesLeftReal[pos_idx][bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); + set_zero( hBinRenConvModule->filterStatesLeftImag[pos_idx][bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); + } + } + } +#else + for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) + { + for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) + { + /* set the memories to zero */ + set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); + set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); + } + } +#endif + hBinRenderer->hBinRenConvModule = hBinRenConvModule; return IVAS_ERR_OK; @@ -474,6 +571,77 @@ static void ivas_binaural_obtain_DMX( return; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*------------------------------------------------------------------------- + * ivas_rend_openCldfbRend() + * + * Allocate and initialize CLDFB fast conv renderer handle + *------------------------------------------------------------------------*/ + +ivas_error ivas_rend_openCldfbRend( + CLDFB_REND_WRAPPER *pCldfbRend, + const IVAS_REND_AudioConfig inConfig, + const IVAS_SPLIT_REND_MODE splitRendMode, + RENDER_CONFIG_DATA *hRendCfg, + const int32_t output_Fs ) +{ + BINAURAL_RENDERER_HANDLE hBinRenderer; + int16_t convBand; + ivas_error error; + AUDIO_CONFIG in_config; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hBinRenderer = (BINAURAL_RENDERER_HANDLE) count_malloc( sizeof( BINAURAL_RENDERER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Renderer\n" ) ); + } + + if ( ( hBinRenderer->hInputSetup = (IVAS_OUTPUT_SETUP_HANDLE) count_malloc( sizeof( IVAS_OUTPUT_SETUP ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for output setup Binaural Renderer\n" ) ); + } + + hBinRenderer->rotInCldfb = 1; + hBinRenderer->splitRendMode = splitRendMode; + + hBinRenderer->ivas_format = SBA_FORMAT; + + hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); + convBand = hBinRenderer->max_band; + + hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ + in_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + + if ( convBand > BINAURAL_CONVBANDS ) + { + hBinRenderer->conv_band = BINAURAL_CONVBANDS; + } + else + { + hBinRenderer->conv_band = convBand; + } + hBinRenderer->hInputSetup->is_loudspeaker_setup = 0; + getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE ); + + /* Allocate memories and buffers needed for convolutional module */ + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, in_config, hRendCfg ) ) != IVAS_ERR_OK ) + { + return error; + } + pCldfbRend->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); + hBinRenderer->hReverb = NULL; + hBinRenderer->hEFAPdata = NULL; + + pCldfbRend->hCldfbRend = hBinRenderer; + + return error; +} +#endif /*------------------------------------------------------------------------- * ivas_binRenderer_open() @@ -509,6 +677,10 @@ ivas_error ivas_binRenderer_open( hBinRenderer->rotInCldfb = 1; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + hBinRenderer->splitRendMode = st_ivas->hDecoderConfig->Opt_splitRendMode; +#endif + /* Declare some common variables needed for renderer */ /* Which format used for binaural rendering (needed for late reverb) ? MC or SBA */ if ( st_ivas->hIntSetup.is_loudspeaker_setup ) @@ -647,6 +819,9 @@ static void ivas_binRenderer_convModuleClose( ) { int16_t bandIdx, chIdx; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t posIdx; +#endif BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; @@ -683,7 +858,39 @@ static void ivas_binRenderer_convModuleClose( count_free( hBinRenConvModule->filterTapsRightImag ); hBinRenConvModule->filterTapsRightImag = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( posIdx = 0; posIdx < hBinRenConvModule->numPoses; posIdx++ ) + { + for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) + { + for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) + { + count_free( hBinRenConvModule->filterStatesLeftReal[posIdx][bandIdx][chIdx] ); + hBinRenConvModule->filterStatesLeftReal[posIdx][bandIdx][chIdx] = NULL; + + count_free( hBinRenConvModule->filterStatesLeftImag[posIdx][bandIdx][chIdx] ); + hBinRenConvModule->filterStatesLeftImag[posIdx][bandIdx][chIdx] = NULL; + } + + count_free( hBinRenConvModule->filterStatesLeftReal[posIdx][bandIdx] ); + hBinRenConvModule->filterStatesLeftReal[posIdx][bandIdx] = NULL; + count_free( hBinRenConvModule->filterStatesLeftImag[posIdx][bandIdx] ); + hBinRenConvModule->filterStatesLeftImag[posIdx][bandIdx] = NULL; + } + + count_free( hBinRenConvModule->filterStatesLeftReal[posIdx] ); + hBinRenConvModule->filterStatesLeftReal[posIdx] = NULL; + + count_free( hBinRenConvModule->filterStatesLeftImag[posIdx] ); + hBinRenConvModule->filterStatesLeftImag[posIdx] = NULL; + } + count_free( hBinRenConvModule->filterStatesLeftReal ); + hBinRenConvModule->filterStatesLeftReal = NULL; + + count_free( hBinRenConvModule->filterStatesLeftImag ); + hBinRenConvModule->filterStatesLeftImag = NULL; +#else for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) @@ -707,7 +914,7 @@ static void ivas_binRenderer_convModuleClose( count_free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; - +#endif count_free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; @@ -715,6 +922,23 @@ static void ivas_binRenderer_convModuleClose( return; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*------------------------------------------------------------------------- + * ivas_rend_openCldfbRend() + * + * Close CLDFB based fastconv binaural renderer memories + *------------------------------------------------------------------------*/ +void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ) +{ + if ( pCldfbRend->hCldfbRend->hInputSetup != NULL ) + { + count_free( pCldfbRend->hCldfbRend->hInputSetup ); + pCldfbRend->hCldfbRend->hInputSetup = NULL; + } + ivas_binRenderer_close( &pCldfbRend->hCldfbRend ); + return; +} +#endif /*------------------------------------------------------------------------- * ivas_binRenderer_close() @@ -801,8 +1025,13 @@ void ivas_binaural_cldfb( { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; /* Implement a 5 msec loops */ @@ -839,7 +1068,13 @@ void ivas_binaural_cldfb( } /* Implement binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + NULL, +#endif + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, + Cldfb_ImagBuffer ); /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) @@ -851,8 +1086,13 @@ void ivas_binaural_cldfb( for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[0][ch][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[0][ch][slot_idx]; +#else RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; +#endif } cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * maxBand] ), maxBand * MAX_PARAM_SPATIAL_SUBFRAMES, st_ivas->cldfbSynDec[ch] ); @@ -862,7 +1102,6 @@ void ivas_binaural_cldfb( return; } - /*------------------------------------------------------------------------- * ivas_binRenderer() * @@ -870,21 +1109,59 @@ void ivas_binaural_cldfb( *-------------------------------------------------------------------------*/ void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ +#else float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ +#endif + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ) { int16_t chIdx, k; int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx, num_poses; +#endif wmops_sub_start( "fastconv_binaural_rendering" ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hBinRenderer->splitRendMode == SPLIT_REND_PRE || hBinRenderer->splitRendMode == SPLIT_REND_COMB ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + num_poses = MAX_HEAD_ROT_POSES + 1; +#else + num_poses = MAX_HEAD_ROT_POSES; +#endif + } + else + { + num_poses = 1; + } +#endif + /* Compute Convolution */ /* memory reset for the binaural output */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + set_zero( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], CLDFB_NO_CHANNELS_MAX ); + set_zero( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], CLDFB_NO_CHANNELS_MAX ); + } + } + } +#else for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { for ( k = 0; k < numTimeSlots; k++ ) @@ -893,6 +1170,7 @@ void ivas_binRenderer( set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); } } +#endif /* Head rotation in HOA3 or CICPx */ if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) @@ -924,7 +1202,94 @@ void ivas_binRenderer( ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, hBinRenderer->hoa_dec_mtx ); } - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], RealBuffer, ImagBuffer, hBinRenderer, 0 ); +#else + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); +#endif + +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*TODO : move this to a separate function*/ + if ( hBinRenderer->splitRendMode == SPLIT_REND_PRE || hBinRenderer->splitRendMode == SPLIT_REND_COMB ) + { + int16_t yaw_idx, pitch_idx, roll_idx; + IVAS_QUATERNION Quaternions_rel, Quaternions_abs, *Quaternions_ref; + float Rmat_local[3][3]; + if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) + { + Quaternions_ref = &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions - 1]; + Quaternions_rel.w = -3.0f; /*euler*/ + Quaternions_abs.w = -3.0f; /*euler*/ + Quat2Euler( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + // Quaternions_abs.x = Quaternions_ref->x; + // Quaternions_abs.y = Quaternions_ref->y; + // Quaternions_abs.z = Quaternions_ref->z; + for ( yaw_idx = 0; yaw_idx < MAX_YAW_ANGLES; yaw_idx++ ) + { + for ( pitch_idx = 0; pitch_idx < MAX_PITCH_ANGLES; pitch_idx++ ) + { + for ( roll_idx = 0; roll_idx < MAX_ROLL_ANGLES; roll_idx++ ) + { + pos_idx = yaw_idx * MAX_PITCH_ANGLES * MAX_ROLL_ANGLES + pitch_idx * MAX_ROLL_ANGLES + roll_idx; + if ( pos_idx == 0 ) + { + continue; + } + + Quaternions_rel.x = split_rend_relative_yaw_angles[yaw_idx]; + Quaternions_rel.y = split_rend_relative_pitch_angles[pitch_idx]; + Quaternions_rel.z = split_rend_relative_roll_angles[roll_idx]; + Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; + Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; + Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; + + + QuatToRotMat( Quaternions_rel, Rmat_local ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + pos_idx +#endif + ); + } + } + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + if ( hPostRendHeadTrackData != NULL ) + { + IVAS_QUATERNION *Quaternions_new1; + IVAS_QUATERNION Quaternions_new; + Quaternions_new1 = &hPostRendHeadTrackData->Quaternions[hPostRendHeadTrackData->num_quaternions++]; + Quaternions_new.w = -3.0f; /*euler*/ + Quat2Euler( *Quaternions_new1, &Quaternions_new.z, &Quaternions_new.y, &Quaternions_new.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quaternions_rel.x = Quaternions_new.x - Quaternions_abs.x; + Quaternions_rel.y = Quaternions_new.y - Quaternions_abs.y; + Quaternions_rel.z = Quaternions_new.z - Quaternions_abs.z; + Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; + Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; + Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; + + QuatToRotMat( Quaternions_rel, Rmat_local ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES], Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES], RealBuffer, ImagBuffer, hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + MAX_HEAD_ROT_POSES +#endif + ); + } +#endif + } + } +#endif + /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) @@ -952,9 +1317,18 @@ void ivas_binRenderer( { for ( k = 0; k < numTimeSlots; k++ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + /* Combine first and second parts to generate binaural output signal with room effect */ + v_add( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); + v_add( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); + } +#else /* Combine first and second parts to generate binaural output signal with room effect */ v_add( Cldfb_RealBuffer_Binaural[chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); v_add( Cldfb_ImagBuffer_Binaural[chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); +#endif } } } @@ -963,3 +1337,72 @@ void ivas_binRenderer( return; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT +void ivas_rend_CldfbMultiBinRendProcess( + const BINAURAL_RENDERER_HANDLE hCldfbRend, + const IVAS_REND_HeadRotData *pHeadRotData, + float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) +{ + int16_t sf_idx, slot_idx, ch_idx, idx, pose_idx; + HEAD_TRACK_DATA head_track; + float Cldfb_RealBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HEAD_TRACK_DATA head_track_post; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif + + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; + for ( ch_idx = 0; ch_idx < hCldfbRend->nInChannels; ch_idx++ ) + { + mvr2r( &Cldfb_In_Real[ch_idx][idx][0], &Cldfb_RealBuffer_sfIn[ch_idx][slot_idx][0], hCldfbRend->max_band ); + mvr2r( &Cldfb_In_Imag[ch_idx][idx][0], &Cldfb_ImagBuffer_sfIn[ch_idx][slot_idx][0], hCldfbRend->max_band ); + } + } + head_track.num_quaternions = 0; + head_track.shd_rot_max_order = -1; + head_track.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + head_track_post.num_quaternions = 0; + head_track_post.shd_rot_max_order = -1; + head_track_post.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositionsPostRend, sf_idx ); +#endif + + ivas_binRenderer( hCldfbRend, &head_track, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + &head_track_post, +#endif + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pose_idx = 0; pose_idx < MAX_HEAD_ROT_POSES + 1; pose_idx++ ) +#else + for ( pose_idx = 0; pose_idx < MAX_HEAD_ROT_POSES; pose_idx++ ) +#endif + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + mvr2r( &Cldfb_RealBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Real[pose_idx][ch_idx][idx][0], hCldfbRend->max_band ); + mvr2r( &Cldfb_ImagBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Imag[pose_idx][ch_idx][idx][0], hCldfbRend->max_band ); + } + } + } + + return; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index f758bc780a..f985b662a0 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -41,6 +41,9 @@ typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_QUATERNION headPositionsPostRend[RENDERER_HEAD_POSITIONS_PER_FRAME]; +#endif float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; @@ -58,6 +61,14 @@ typedef struct HRTFS_HANDLE hHrtfCrend; } CREND_WRAPPER; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef struct +{ + int32_t binaural_latency_ns; + BINAURAL_RENDERER_HANDLE hCldfbRend; +} CLDFB_REND_WRAPPER; +#endif + IVAS_REND_AudioConfigType getAudioConfigType( const IVAS_REND_AudioConfig config ); @@ -75,6 +86,47 @@ ivas_error ivas_rend_openCrend( RENDER_CONFIG_DATA *hRendCfg, const int32_t output_Fs ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +void ivas_rend_CldfbMultiBinRendProcess( + const BINAURAL_RENDERER_HANDLE hCldfbRend, + const IVAS_REND_HeadRotData *pHeadRotData, + float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ); + +ivas_error ivas_rend_openCldfb( + HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], + const IVAS_REND_AudioConfig inConfig, + const int32_t output_Fs ); +ivas_error ivas_rend_openCldfbRend( + CLDFB_REND_WRAPPER *pCldfbRend, + const IVAS_REND_AudioConfig inConfig, + const IVAS_SPLIT_REND_MODE splitRendMode, + RENDER_CONFIG_DATA *hRendCfg, + const int32_t output_Fs ); + +void ivas_split_rend_bitstream_init( ivas_split_rend_bits_t *pBits, const int32_t buf_len_bytes, uint8_t *pbuf ); +void ivas_split_rend_huffman_dec_init_min_max_len( ivas_split_rend_huffman_cfg_t *p_huff_cfg ); +void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg ); +void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); +int16_t wrap_a( int16_t val, int16_t min_val, int16_t max_val ); +void ivas_SplitRenderer_getdiagdiff( + int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + int16_t out_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + const int16_t sign, + const int16_t min_val, + const int16_t max_val ); +void ivas_split_rend_bitstream_write_int32( ivas_split_rend_bits_t *pBits, int32_t val, int32_t bits ); +int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int32_t bits ); +IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( + const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], + int16_t subframe_idx ); + +void ivas_rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS] ); +void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); +#endif + ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, const IVAS_REND_AudioConfig inConfig, diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index e5407abff4..fae2144afe 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -627,3 +627,15 @@ void ivas_renderer_select( return; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT +void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ) +{ + hSplitRendBits->bits_written = 0; + hSplitRendBits->bits_read = 0; + hSplitBinRend->hSplitRendBits = hSplitRendBits; + + hSplitBinRend->hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) dynamic_malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ); + return; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c new file mode 100644 index 0000000000..249acceea7 --- /dev/null +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -0,0 +1,92 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#include "ivas_prot.h" +#include "prot.h" +#include "cnst.h" +#include "ivas_cnst.h" +#include "ivas_rom_rend.h" +#include "ivas_rom_com.h" +#include "ivas_rom_dec.h" +#include "ivas_rom_binauralRenderer.h" +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmops.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +ivas_error ivas_splitBinLCLDDecOpen( + BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ) +{ + ivas_error error; + BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec; + error = IVAS_ERR_OK; + if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) count_malloc( sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) ); + } + + splitBinLCLDDec->pLcld_dec = NULL; // place holder for CLDFB decoder handle + + *hSplitBinLCLDDec = splitBinLCLDDec; + return error; +} + +void ivas_splitBinLCLDDecClose( + BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ) +{ + if ( ( *hSplitBinLCLDDec ) != NULL ) + { + count_free( *hSplitBinLCLDDec ); + *hSplitBinLCLDDec = NULL; + } + return; +} + +void ivas_splitBinLCLDDecProcess( + BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, + ivas_split_rend_bits_t *pBits, + float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) +{ + assert( hSplitBinLCLDDec != NULL ); + assert( Cldfb_Out_Real != NULL ); + assert( Cldfb_Out_Imag != NULL ); + assert( pBits != NULL ); + return; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c new file mode 100644 index 0000000000..355712e327 --- /dev/null +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -0,0 +1,92 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#include "ivas_prot.h" +#include "prot.h" +#include "cnst.h" +#include "ivas_cnst.h" +#include "ivas_rom_rend.h" +#include "ivas_rom_com.h" +#include "ivas_rom_dec.h" +#include "ivas_rom_binauralRenderer.h" +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmops.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +ivas_error ivas_splitBinLCLDEncOpen( + BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ) +{ + ivas_error error; + BIN_HR_SPLIT_LCLD_ENC_HANDLE splitBinLCLDEnc; + error = IVAS_ERR_OK; + if ( ( splitBinLCLDEnc = (BIN_HR_SPLIT_LCLD_ENC_HANDLE) count_malloc( sizeof( BIN_HR_SPLIT_LCLD_ENC ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); + } + + splitBinLCLDEnc->pLcld_enc = NULL; // place holder for CLDFB encoder handle + + *hSplitBinLCLDEnc = splitBinLCLDEnc; + return error; +} + +void ivas_splitBinLCLDEncClose( + BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ) +{ + if ( ( *hSplitBinLCLDEnc ) != NULL ) + { + count_free( *hSplitBinLCLDEnc ); + *hSplitBinLCLDEnc = NULL; + } + return; +} + +void ivas_splitBinLCLDEncProcess( + BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc, + float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + ivas_split_rend_bits_t *pBits ) +{ + assert( hSplitBinLCLDEnc != NULL ); + assert( Cldfb_In_Real != NULL ); + assert( Cldfb_In_Imag != NULL ); + assert( pBits != NULL ); + return; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c new file mode 100644 index 0000000000..56782f4989 --- /dev/null +++ b/lib_rend/ivas_splitRendererPost.c @@ -0,0 +1,1004 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#include +#endif +#include "ivas_prot.h" +#include "prot.h" +#include "cnst.h" +#include "ivas_cnst.h" +#include "ivas_rom_rend.h" +#include "ivas_rom_com.h" +#include "ivas_rom_dec.h" +#include "ivas_rom_binauralRenderer.h" +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmops.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +ivas_error ivas_splitBinPostRendOpen( + BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, + const int32_t output_Fs ) +{ + BIN_HR_SPLIT_POST_REND_HANDLE hBinRend; + ivas_error error; + int16_t ch; + + error = IVAS_ERR_OK; + if ( ( hBinRend = (BIN_HR_SPLIT_POST_REND_HANDLE) count_malloc( sizeof( BIN_HR_SPLIT_POST_REND ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for bin split post renderer Module \n" ) ); + } + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hBinRend->cldfbSyn[ch] = NULL; + } +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hBinRend->cldfbSynReconsBinDec[i][ch] = NULL; + } + } +#endif + + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + if ( ( error = openCldfb( &( hBinRend->cldfbSyn[ch] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + if ( ( error = openCldfb( &( hBinRend->cldfbSynReconsBinDec[i][ch] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif + hBinRend->cf_flag = 0; + set_fix_rotation_mat( hBinRend->fix_pos_rot_mat ); + ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); + *hBinHrSplitPostRend = hBinRend; + + return error; +} + +void ivas_splitBinPostRendClose( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend ) +{ + int16_t ch; + if ( ( *hBinHrSplitPostRend ) != NULL ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + if ( ( *hBinHrSplitPostRend )->cldfbSyn[ch] != NULL ) + { + deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbSyn[ch] ) ); + ( *hBinHrSplitPostRend )->cldfbSyn[ch] = NULL; + } + } +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + if ( ( *hBinHrSplitPostRend )->cldfbSynReconsBinDec[i][ch] != NULL ) + { + deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbSynReconsBinDec[i][ch] ) ); + ( *hBinHrSplitPostRend )->cldfbSynReconsBinDec[i][ch] = NULL; + } + } + } +#endif + + count_free( ( *hBinHrSplitPostRend ) ); + ( *hBinHrSplitPostRend ) = NULL; + } + return; +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_huffman_code_bits_present() + * + * Huffman code bits present + *-----------------------------------------------------------------------------------------*/ + +static int32_t ivas_split_rend_huffman_code_bits_present( + const int32_t *codebook, + const int32_t code, + const int32_t bits, + const int32_t len ) +{ + int32_t index = len + 1; + int32_t i = 0; + int32_t code_t, ind_t, bits_t; + + while ( i < len ) + { + ind_t = codebook[0]; + bits_t = codebook[1]; + code_t = codebook[2]; + if ( ( code == code_t ) && ( bits == bits_t ) ) + { + return ind_t; + } + codebook = codebook + 3; + i++; + } + + return index; +} + +static int16_t ivas_split_rend_huffman_decode_opt( + ivas_split_rend_huffman_cfg_t *huff_cfg, + ivas_split_rend_bits_t *pBits, + const int16_t *idx_trav_list ) +{ + int32_t i, ind, code, num_bits, code_b, num_bits_read; + const int32_t *codebook; + codebook = huff_cfg->codebook; + num_bits_read = 0; + ind = huff_cfg->codebook[0] - 1; + code = 0; + for ( i = 0; i < huff_cfg->sym_len; i++ ) + { + codebook = codebook + idx_trav_list[i] * 3; + num_bits = codebook[1]; + code_b = codebook[2]; + num_bits_read = num_bits - num_bits_read; + code = code << num_bits_read; + if ( num_bits_read > 0 ) + { + code |= ivas_split_rend_bitstream_read_int32( pBits, num_bits_read ); + } + + if ( code == code_b ) + { + ind = codebook[0]; + break; + } + + num_bits_read = num_bits; + codebook = huff_cfg->codebook; + } +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + assert( ind >= huff_cfg->codebook[0] ); +#endif + return (int16_t) ind; +} + +static int16_t ivas_split_rend_huffman_decode( + ivas_split_rend_huffman_cfg_t *huff_cfg, + ivas_split_rend_bits_t *pBits ) +{ + int32_t code, bit, num_bits_read, ind; + + code = ivas_split_rend_bitstream_read_int32( pBits, huff_cfg->min_len ); + num_bits_read = huff_cfg->min_len; + + ind = ivas_split_rend_huffman_code_bits_present( huff_cfg->codebook, code, num_bits_read, huff_cfg->sym_len ); + + while ( ind > huff_cfg->sym_len ) + { + bit = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + num_bits_read += 1; + code = code << 1 | bit; + ind = ivas_split_rend_huffman_code_bits_present( huff_cfg->codebook, code, num_bits_read, huff_cfg->sym_len ); + if ( num_bits_read > huff_cfg->max_len ) + { + assert( 0 ); + } + } + + return (int16_t) ind; +} + +static void ivas_split_rend_unquant_md( + BIN_HR_SPLIT_REND_MD_HANDLE hMd, + int16_t real_only, + float fix_pos_rot_mat[][BINAURAL_CHANNELS] ) +{ + int16_t ch1, ch2; + + ivas_deindex_real_index( + &hMd->pred_mat_re_idx[0][0], + IVAS_SPLIT_REND_PRED_QUANT_PNTS, + IVAS_SPLIT_REND_PRED_MIN_VAL, + IVAS_SPLIT_REND_PRED_MAX_VAL, + &hMd->pred_mat_re[0][0], + BINAURAL_CHANNELS * BINAURAL_CHANNELS ); + ivas_deindex_real_index( + &hMd->pred_mat_im_idx[0][0], + IVAS_SPLIT_REND_PRED_QUANT_PNTS, + IVAS_SPLIT_REND_PRED_MIN_VAL, + IVAS_SPLIT_REND_PRED_MAX_VAL, + &hMd->pred_mat_im[0][0], + BINAURAL_CHANNELS * BINAURAL_CHANNELS ); + ivas_deindex_real_index( + &hMd->gd_idx, + IVAS_SPLIT_REND_D_QUANT_PNTS, + IVAS_SPLIT_REND_D_MIN_VAL, + IVAS_SPLIT_REND_D_MAX_VAL, + &hMd->gd, + 1 ); + + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2]; + // hMd->pred_mat_re[ch1][ch2] = hQMd->pred_mat_re[ch1][ch2]; + } + } + if ( real_only ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd->pred_mat_im[ch1][ch2] = 0.0f; + } + } + } + return; +} + +static void ivas_splitBinPostRendMdBase2Dec( + ivas_split_rend_bits_t *pBits, + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, + const int16_t num_md_bands ) +{ + int16_t sf_idx, real_only, pos_idx, b, ch1, ch2; + int16_t min_pred_idx, min_gd_idx, pred_code_len, gd_code_len; + int16_t code; + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; + + pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; + min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; + min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; + pred_code_len = pHuff_cfg->pred_base2_code_len; + gd_code_len = pHuff_cfg->gd_base2_code_len; + + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( b = 0; b < num_md_bands; b++ ) + { + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); + hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx; + } + } + + if ( real_only == 0 ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); + hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_idx; + } + } + } + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, gd_code_len ); + hMd->gd_idx = code + min_gd_idx; + } + } + } + + return; +} + +static void ivas_splitBinPostRendMdHuffDec( + ivas_split_rend_bits_t *pBits, + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, + const int16_t num_md_bands ) +{ + int16_t pos_idx, b, sf_idx; + int16_t real_only, ch1, ch2; + int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + int16_t min_pred_idx, max_pred_idx; + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; + + pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; + min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; + max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; + real_only = 0; + + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( b = 0; b < num_md_bands; b++ ) + { + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); + } + } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx ); + + if ( real_only == 0 ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); + } + } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx ); + } + hMd->gd_idx = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->gd, pBits, pHuff_cfg->gd_idx_trav ); + // hMd->gd_idx = ivas_split_rend_huffman_decode( &pHuff_cfg->gd, pBits ); + } + } + } + + return; +} + +void ivas_splitBinPostRendMdDec( + ivas_split_rend_bits_t *pBits, + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, +#endif + const int16_t num_md_bands ) +{ + int16_t pos_idx, b, sf_idx; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + int16_t ch1, ch2; +#endif + int16_t real_only, yaw_idx; + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + real_only = 0; + +#ifdef SPLIT_REND_BASE2_CODING + ivas_splitBinPostRendMdBase2Dec( pBits, hBinHrSplitPostRend, num_md_bands ); +#else + ivas_splitBinPostRendMdHuffDec( pBits, hBinHrSplitPostRend, num_md_bands ); +#endif + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + yaw_idx = ( pos_idx / ( MAX_PITCH_ANGLES * MAX_ROLL_ANGLES ) ); + for ( b = 0; b < num_md_bands; b++ ) + { + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + /*verify that MD is decodd correctly*/ + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + int16_t val; + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + if ( abs( hMd->pred_mat_re_idx[ch1][ch2] - val ) > 0 ) + { + assert( 0 ); + } + + if ( real_only == 0 ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + if ( abs( hMd->pred_mat_im_idx[ch1][ch2] - val ) > 0 ) + { + assert( 0 ); + } + } + + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx; + if ( abs( hMd->gd_idx - val ) > 0 ) + { + assert( 0 ); + } + } + } +#endif + + ivas_split_rend_unquant_md( hMd, + real_only, hBinHrSplitPostRend->fix_pos_rot_mat[yaw_idx] ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + /*verify that MD is decodd correctly*/ + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + float val; + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch1][ch2] + + hBinHrSplitPostRend->fix_pos_rot_mat[yaw_idx][ch1][ch2]; + if ( fabs( hMd->pred_mat_re[ch1][ch2] - val ) > 1e-20 ) + { + assert( 0 ); + } + + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch1][ch2]; + if ( fabs( hMd->pred_mat_im[ch1][ch2] - val ) > 1e-20 ) + { + assert( 0 ); + } + + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd; + if ( fabs( hMd->gd - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } +#endif + } + } + } + return; +} + +#define REAL_IMAG_INTERPOLATION +static void wrap_around_angle( float *a ) +{ + if ( ( *a ) > 180.0f ) + { + ( *a ) = ( *a ) - 360; + } + else if ( ( *a ) < -180.0f ) + { + ( *a ) = ( *a ) + 360; + } + return; +} +static void wrap_around_ypr( IVAS_QUATERNION *Quaternions ) +{ + /*only if quat is actually yaw, pitch , roll angles*/ + if ( Quaternions->w == -3.0f ) + { + wrap_around_angle( &Quaternions->x ); + wrap_around_angle( &Quaternions->y ); + wrap_around_angle( &Quaternions->z ); + } + return; +} +static void get_interpolation_vars( + const IVAS_QUATERNION *Quaternions_ref, + const IVAS_QUATERNION *Quaternions_act, + int16_t interp_pose_idx[2], + float *interp_fact ) +{ + IVAS_QUATERNION quaternions_diff, quaternions_diffx[MAX_HEAD_ROT_POSES], quaternions_ref_euler, quaternions_act_euler; + int16_t yaw_idx, pitch_idx, roll_idx, pos_idx; + float min_diff, d1, n1; + int16_t idx1, idx2; + + idx1 = 0; + idx2 = 0; + quaternions_diff.x = 0.0f; + quaternions_diff.y = 0.0f; + quaternions_diff.z = 0.0f; + + for ( yaw_idx = 0; yaw_idx < MAX_YAW_ANGLES; yaw_idx++ ) + { + for ( pitch_idx = 0; pitch_idx < MAX_PITCH_ANGLES; pitch_idx++ ) + { + for ( roll_idx = 0; roll_idx < MAX_ROLL_ANGLES; roll_idx++ ) + { + pos_idx = yaw_idx * MAX_PITCH_ANGLES * MAX_ROLL_ANGLES + pitch_idx * MAX_ROLL_ANGLES + roll_idx; + + quaternions_diff.x += split_rend_relative_yaw_angles[yaw_idx]; + quaternions_diff.y += split_rend_relative_pitch_angles[pitch_idx]; + quaternions_diff.z += split_rend_relative_roll_angles[roll_idx]; + quaternions_diffx[pos_idx].x = quaternions_diff.x; + quaternions_diffx[pos_idx].y = quaternions_diff.y; + quaternions_diffx[pos_idx].z = quaternions_diff.z; + } + } + } + + /*interpolation if actual pose is not same as one of assumed poses*/ + /*get the deviation*/ + Quat2Euler( *Quaternions_ref, &quaternions_ref_euler.z, &quaternions_ref_euler.y, &quaternions_ref_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quat2Euler( *Quaternions_act, &quaternions_act_euler.z, &quaternions_act_euler.y, &quaternions_act_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ + quaternions_diff.w = -3.0f; /*euler*/ + quaternions_diff.x = quaternions_act_euler.x - quaternions_ref_euler.x; + quaternions_diff.y = quaternions_act_euler.y - quaternions_ref_euler.y; + quaternions_diff.z = quaternions_act_euler.z - quaternions_ref_euler.z; + wrap_around_ypr( &quaternions_diff ); + if ( fabs( quaternions_diff.x ) > EPSILON ) + { + min_diff = 360.0f; + /*find the closest pose from assumed poses*/ + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + if ( fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ) < min_diff ) + { + idx1 = pos_idx; + min_diff = (float) fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ); + } + } + + min_diff = 360.0; + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + if ( ( fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ) < min_diff ) && + ( pos_idx != idx1 ) ) + { + idx2 = pos_idx; + min_diff = (float) fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ); + } + } + } + interp_pose_idx[0] = idx1; + interp_pose_idx[1] = idx2; + + if ( idx1 != idx2 ) + { + n1 = quaternions_diffx[idx1].x - quaternions_diffx[idx2].x; + d1 = quaternions_diffx[idx1].x - quaternions_diff.x; + *interp_fact = d1 / n1; + } + else + { + *interp_fact = 0.0f; + } + + return; +} + +static void interpolate_rend_md( + BIN_HR_SPLIT_REND_MD rot_md[][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], + float mix_mat_re[][BINAURAL_CHANNELS], + float mix_mat_im[][BINAURAL_CHANNELS], + float *gd_int, + int16_t sf_idx, + int16_t band_idx, + int16_t interp_pose_idx[2], + float interp_fact ) +{ + int16_t ch_idx1, ch_idx2, idx1, idx2; + float mix_mat_abs1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_ph1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_abs2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_ph2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_abs[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_ph[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float gd1, gd2, diff; + BIN_HR_SPLIT_REND_MD *pRot_md; + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + set_zero( mix_mat_abs1[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_ph1[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_abs1[ch_idx1][ch_idx1] = 1.0f; + + set_zero( mix_mat_abs2[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_ph2[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_abs2[ch_idx1][ch_idx1] = 1.0f; + } + gd1 = 0.0f; + gd2 = 0.0f; + + idx1 = interp_pose_idx[0]; + idx2 = interp_pose_idx[1]; + if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) + { + if ( idx1 != 0 ) + { + pRot_md = &rot_md[idx1 - 1][sf_idx][band_idx]; + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + mix_mat_abs1[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2]; + mix_mat_ph1[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2]; + } + } + gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd; + } + + if ( idx2 != 0 ) + { + pRot_md = &rot_md[idx2 - 1][sf_idx][band_idx]; + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + mix_mat_abs2[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2]; + mix_mat_ph2[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2]; + } + } + gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd; + } + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + diff = mix_mat_abs1[ch_idx1][ch_idx2] - mix_mat_abs2[ch_idx1][ch_idx2]; + mix_mat_abs[ch_idx1][ch_idx2] = mix_mat_abs1[ch_idx1][ch_idx2] - ( diff * interp_fact ); + + diff = mix_mat_ph1[ch_idx1][ch_idx2] - mix_mat_ph2[ch_idx1][ch_idx2]; + mix_mat_ph[ch_idx1][ch_idx2] = mix_mat_ph1[ch_idx1][ch_idx2] - ( diff * interp_fact ); + + mix_mat_re[ch_idx1][ch_idx2] = mix_mat_abs[ch_idx1][ch_idx2]; + mix_mat_im[ch_idx1][ch_idx2] = mix_mat_ph[ch_idx1][ch_idx2]; + } + } + diff = gd1 - gd2; + *gd_int = gd1 - ( diff * interp_fact ); + } + else + { + /*P = P'*/ + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_re[ch_idx1][ch_idx1] = 1.0f; + } + *gd_int = 0.0f; + } + + return; +} + +void ivas_SplitRenderer_PostRenderer( + BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ + float Cldfb_RealBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + int16_t sf_idx, + const IVAS_QUATERNION *Quaternions_ref, + const IVAS_QUATERNION *Quaternions_act ) +{ + int16_t pos_idx, b, brange[2], ch_idx1; + int16_t num_md_bands, slot_idx, b2; + float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int, gd_cf, gd_cf_abs; + int16_t interp_pose_idx[2]; + float interp_fact; + float mix_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif + float fade; + float *pMix_mat_re_prev[BINAURAL_CHANNELS]; + float *pMix_mat_im_prev[BINAURAL_CHANNELS]; + const int16_t *pBand_grouping = SplitRend_band_grouping; + num_md_bands = MAX_SPLIT_REND_MD_BANDS; + + wmops_sub_start( "ivas_SplitRenderer_PostRenderer" ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + pos_idx = MAX_HEAD_ROT_POSES - 1; +#else + pos_idx = 0; +#endif + + get_interpolation_vars( Quaternions_ref, Quaternions_act, interp_pose_idx, &interp_fact ); + for ( b = 0; b < num_md_bands; b++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_re[ch_idx1][ch_idx1] = 1.0f; + } + gd_int = 0.0f; + + interpolate_rend_md( hBinPostRenderer->rot_md, mix_mat_re, mix_mat_im, &gd_int, sf_idx, b, interp_pose_idx, interp_fact ); + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + /*update the prediction matrix with interpolated matrix*/ + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = gd_int; + } + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) +#else + pos_idx = 0; +#endif + { + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES; + for ( b = 0; b < num_md_bands; b++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + if ( hBinPostRenderer->cf_flag ) + { + pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; + pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1]; + mix_mat_re[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] ) + + ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0]; + mix_mat_re[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] ) + + ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1]; + + mix_mat_im[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] ) + + ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0]; + mix_mat_im[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] ) + + ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1]; + } + else + { + mix_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; + mix_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; + mix_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; + mix_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + } + } + + if ( hBinPostRenderer->cf_flag ) + { + gd_cf = fade * hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd + + ( 1 - fade ) * hBinPostRenderer->gd_mem[pos_idx][b]; + } + else + { + gd_cf = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; + } + gd_cf_abs = (float) fabs( gd_cf ); + + brange[0] = pBand_grouping[b]; + brange[1] = pBand_grouping[b + 1]; + for ( b2 = brange[0]; b2 < brange[1]; b2++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + // Apply prediction matrix + IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][slot_idx][b2], + Cldfb_ImagBuffer_Ref_Binaural[0][slot_idx][b2], + mix_mat_re[0][ch_idx1], + mix_mat_im[0][ch_idx1], + tmp_re, + tmp_im ); + pred_out_re[ch_idx1] = tmp_re; + pred_out_im[ch_idx1] = tmp_im; + + IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][slot_idx][b2], + Cldfb_ImagBuffer_Ref_Binaural[1][slot_idx][b2], + mix_mat_re[1][ch_idx1], + mix_mat_im[1][ch_idx1], + tmp_re, + tmp_im ); + pred_out_re[ch_idx1] += tmp_re; + pred_out_im[ch_idx1] += tmp_im; + } + + // Apply decorrelation + if ( 1 ) + { + tmp_re = Cldfb_RealBuffer_Ref_Binaural[0][slot_idx][b2] + Cldfb_RealBuffer_Ref_Binaural[1][slot_idx][b2]; + tmp_im = Cldfb_ImagBuffer_Ref_Binaural[0][slot_idx][b2] + Cldfb_ImagBuffer_Ref_Binaural[1][slot_idx][b2]; + + pred_out_re[0] += ( gd_cf_abs * tmp_re ); + pred_out_im[0] += ( gd_cf_abs * tmp_im ); + pred_out_re[1] += ( gd_cf * tmp_re ); + pred_out_im[1] += ( gd_cf * tmp_im ); + } + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1]; + Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1]; +#else + Cldfb_RealBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1]; + Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1]; +#endif + } + } + } + } + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) +#else + pos_idx = 0; +#endif + { + for ( b = 0; b < num_md_bands; b++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; + hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; + hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; + hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + } + hBinPostRenderer->gd_mem[pos_idx][b] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; + } + } + hBinPostRenderer->cf_flag = 1; + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + { + int16_t num_cldfb_bands; + num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + mvr2r( Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][slot_idx], Cldfb_RealBuffer_Ref_Binaural[ch_idx1][slot_idx], num_cldfb_bands ); + mvr2r( Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][slot_idx], Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][slot_idx], num_cldfb_bands ); + } + } + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + char fname[200] = "recons_out_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + ivas_log_cldfb2wav_data( + Cldfb_RealBuffer_Recons_Binaural[pos_idx], + Cldfb_ImagBuffer_Recons_Binaural[pos_idx], + hBinPostRenderer->cldfbSynReconsBinDec[pos_idx], + BINAURAL_CHANNELS, + num_cldfb_bands, + 48000, + fname ); + } + } +#endif + + wmops_sub_end(); + return; +} + +void ivas_rend_CldfbSplitPostRendProcess( + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, + const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], + const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], + float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float output[][L_FRAME48k] ) +{ + int16_t sf_idx, ch_idx, index_slot, slot_idx, num_cldfb_bands; + float Cldfb_RealBuffer_sfIn[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_sfIn[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + + num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels; + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + index_slot = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + mvr2r( &Cldfb_RealBuffer_Binaural[ch_idx][index_slot][0], &Cldfb_RealBuffer_sfIn[ch_idx][slot_idx][0], num_cldfb_bands ); + mvr2r( &Cldfb_ImagBuffer_Binaural[ch_idx][index_slot][0], &Cldfb_ImagBuffer_sfIn[ch_idx][slot_idx][0], num_cldfb_bands ); + } + } + +#ifndef SPLIT_REND_SKIP_POST_REND + ivas_SplitRenderer_PostRenderer( + hBinHrSplitPostRend, + Cldfb_RealBuffer_sfIn, + Cldfb_ImagBuffer_sfIn, + sf_idx, + &QuaternionsPre[sf_idx], + &QuaternionsPost[sf_idx] ); +#endif + + /* Implement CLDFB synthesis */ + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + + index_slot = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES; + + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_sfIn[ch_idx][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_sfIn[ch_idx][slot_idx]; + } + + cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][index_slot * num_cldfb_bands] ), num_cldfb_bands * MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); + } + } + + return; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c new file mode 100644 index 0000000000..8c37efcef3 --- /dev/null +++ b/lib_rend/ivas_splitRendererPre.c @@ -0,0 +1,1324 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#include +#endif +#include "ivas_prot.h" +#include "prot.h" +#include "cnst.h" +#include "ivas_cnst.h" +#include "ivas_rom_rend.h" +#include "ivas_rom_com.h" +#include "ivas_rom_dec.h" +#include "ivas_rom_binauralRenderer.h" +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmops.h" + + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define MAX_BAND_SMOOTH ( 1 ) +#define SMOOTH_NORM_FACTOR ( 5.0f ) + +static void ivas_mat_mult_2by2_complex( float in_re1[2][2], + float in_im1[2][2], + float in_re2[2][2], + float in_im2[2][2], + float out_re2[2][2], + float out_im2[2][2] ) +{ + int16_t i, j; + float tmp_re, tmp_im; + + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 2; j++ ) + { + + IVAS_CMULT_FLOAT( in_re1[i][0], in_im1[i][0], + in_re2[0][j], in_im2[0][j], tmp_re, tmp_im ); + out_re2[i][j] = tmp_re; + out_im2[i][j] = tmp_im; + IVAS_CMULT_FLOAT( in_re1[i][1], in_im1[i][1], + in_re2[1][j], in_im2[1][j], tmp_re, tmp_im ); + out_re2[i][j] += tmp_re; + out_im2[i][j] += tmp_im; + } + } + return; +} +static void ivas_calc_mat_det_2by2_complex( float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float *det_re, + float *det_im ) +{ + float re1, im1, re2, im2; + IVAS_CMULT_FLOAT( in_re[0][0], in_im[0][0], in_re[1][1], in_im[1][1], re1, im1 ); + IVAS_CMULT_FLOAT( in_re[0][1], in_im[0][1], in_re[1][0], in_im[1][0], re2, im2 ); + *det_re = re1 - re2; + *det_im = im1 - im2; + return; +} + +static int16_t ivas_is_mat_inv_2by2_complex( float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t is_det_zero = 1; + float det, det_re, det_im; + ivas_calc_mat_det_2by2_complex( in_re, in_im, &det_re, &det_im ); + det = ( ( det_re * det_re ) + ( det_im * det_im ) ); + if ( det < EPSILON ) + { + is_det_zero = 0; + } + return is_det_zero; +} + +static void ivas_calc_mat_inv_2by2_complex( + float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float out_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float out_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + float det_re, det_im; + float re, im, det; + ivas_calc_mat_det_2by2_complex( in_re, in_im, &det_re, &det_im ); + det = ( det_re * det_re ) + ( det_im * det_im ); + // assert to catch cases when input is singular matrix + assert( det > 0 ); + det = 1 / det; + + IVAS_CMULT_FLOAT( det_re, -det_im, in_re[1][1], in_im[1][1], re, im ); + out_re[0][0] = re * det; + out_im[0][0] = im * det; + + IVAS_CMULT_FLOAT( det_re, -det_im, in_re[0][1], in_im[0][1], re, im ); + out_re[0][1] = -re * det; + out_im[0][1] = -im * det; + IVAS_CMULT_FLOAT( det_re, -det_im, in_re[1][0], in_im[1][0], re, im ); + out_re[1][0] = -re * det; + out_im[1][0] = -im * det; + IVAS_CMULT_FLOAT( det_re, -det_im, in_re[0][0], in_im[0][0], re, im ); + out_re[1][1] = re * det; + out_im[1][1] = im * det; + return; +} + +static void ComputePredMat( + float cov_ii_re[][BINAURAL_CHANNELS], + float cov_ii_im[][BINAURAL_CHANNELS], + float cov_io_re[][BINAURAL_CHANNELS], + float cov_io_im[][BINAURAL_CHANNELS], + float pred_mat_re[][BINAURAL_CHANNELS], + float pred_mat_im[][BINAURAL_CHANNELS], + int16_t num_chs, + int16_t real_only ) +{ + float cov_ii_local_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + // float cov_ii_local_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_ii_inv_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_ii_inv_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float trace_cov; + int16_t i, j; + + trace_cov = 0.0f; + for ( i = 0; i < num_chs; i++ ) + { + trace_cov += cov_ii_re[i][i]; + } + trace_cov = max( 0.0f, trace_cov ); + if ( trace_cov < EPSILON ) + { + for ( i = 0; i < num_chs; i++ ) + { + /* protection from cases when variance of ref channels is very small */ + set_zero( pred_mat_re[i], BINAURAL_CHANNELS ); + set_zero( pred_mat_im[i], BINAURAL_CHANNELS ); + } + return; + } + + for ( i = 0; i < num_chs; i++ ) + { + mvr2r( cov_ii_re[i], cov_ii_local_re[i], num_chs ); + // mvr2r( cov_ii_im[i], cov_ii_local_im[i], num_chs ); + } + for ( i = 0; i < num_chs; i++ ) + { + cov_ii_local_re[i][i] = cov_ii_re[i][i] + ( trace_cov * 0.0001f ); + // cov_ii_local_im[i][i] = cov_ii_im[i][i] + ( trace_cov * 0.0005f ); + } + + // float det_re, det_im, det; + // ivas_calc_mat_det_2by2_complex( cov_ii_local_re, cov_ii_im, &det_re, &det_im ); + // det = ( ( det_re * det_re ) + ( det_im * det_im ) ); + // det = sqrtf( det ); + // if ( ivas_is_mat_inv_2by2_complex( cov_ii_local_re, cov_ii_im ) ) + // if ( det > 0.0001f ) + if ( ivas_is_mat_inv_2by2_complex( cov_ii_local_re, cov_ii_im ) ) + { + ivas_calc_mat_inv_2by2_complex( cov_ii_local_re, cov_ii_im, cov_ii_inv_re, cov_ii_inv_im ); + ivas_mat_mult_2by2_complex( cov_ii_inv_re, cov_ii_inv_im, cov_io_re, cov_io_im, + pred_mat_re, pred_mat_im ); + } + else + { + // float max_var; + int16_t max_var_idx; + for ( i = 0; i < num_chs; i++ ) + { + set_zero( pred_mat_re[i], BINAURAL_CHANNELS ); + set_zero( pred_mat_im[i], BINAURAL_CHANNELS ); + } + + max_var_idx = 0; + // max_var = cov_ii_local_re[0][0]; + if ( cov_ii_local_re[1][1] > cov_ii_local_re[0][0] ) + { + max_var_idx = 1; + // max_var = cov_ii_local_re[1][1]; + } + + if ( cov_ii_local_re[max_var_idx][max_var_idx] > EPSILON ) + { + for ( j = 0; j < num_chs; j++ ) + { + pred_mat_re[max_var_idx][j] = cov_io_re[max_var_idx][j] / cov_ii_local_re[max_var_idx][max_var_idx]; + pred_mat_im[max_var_idx][j] = cov_io_im[max_var_idx][j] / cov_ii_local_re[max_var_idx][max_var_idx]; + } + } + } + + if ( real_only ) + { + for ( i = 0; i < num_chs; i++ ) + { + set_zero( pred_mat_im[i], BINAURAL_CHANNELS ); + } + } + + return; +} + +static void ComputePostPredCov( + float cov_ii_re[][BINAURAL_CHANNELS], + float cov_ii_im[][BINAURAL_CHANNELS], + float pred_mat_re[][BINAURAL_CHANNELS], + float pred_mat_im[][BINAURAL_CHANNELS], + float postpred_cov_re[][BINAURAL_CHANNELS], + float postpred_cov_im[][BINAURAL_CHANNELS], + int16_t num_chs ) +{ + int16_t i, j; + float dmx_mat_conj_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float dmx_mat_conj_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float temp_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float temp_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + + assert( num_chs == BINAURAL_CHANNELS ); + for ( i = 0; i < num_chs; i++ ) + { + for ( j = 0; j < num_chs; j++ ) + { + dmx_mat_conj_re[i][j] = pred_mat_re[j][i]; + dmx_mat_conj_im[i][j] = -pred_mat_im[j][i]; + + temp_mat_re[i][j] = pred_mat_re[i][j]; + temp_mat_im[i][j] = pred_mat_im[i][j]; + } + set_zero( postpred_cov_re[i], BINAURAL_CHANNELS ); + set_zero( postpred_cov_im[i], BINAURAL_CHANNELS ); + } + + /* 2x2 mult */ + ivas_mat_mult_2by2_complex( dmx_mat_conj_re, dmx_mat_conj_im, cov_ii_re, cov_ii_im, + temp_mat_re, temp_mat_im ); + ivas_mat_mult_2by2_complex( temp_mat_re, temp_mat_im, pred_mat_re, pred_mat_im, + postpred_cov_re, postpred_cov_im ); + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < i; j++ ) + { + postpred_cov_re[i][j] = postpred_cov_re[j][i]; + postpred_cov_im[i][j] = -postpred_cov_im[j][i]; + } + postpred_cov_im[i][i] = 0; + } + + return; +} + +static void ComputeBandedCrossCov( + float Cldfb_RealBuffer1[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer1[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_RealBuffer2[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer2[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float out_cov_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float out_cov_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + int16_t num_chs, + const int16_t *pBand_grouping, + int16_t num_subframes, + int16_t md_band_idx, + int16_t real_only ) +{ + int16_t sf, cldfb_band_idx, ch_idx1, ch_idx2; + int16_t brange[2]; + + for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ ) + { + set_f( out_cov_re[ch_idx1], 0.0f, num_chs ); + set_f( out_cov_im[ch_idx1], 0.0f, num_chs ); + } + brange[0] = pBand_grouping[md_band_idx]; + brange[1] = pBand_grouping[md_band_idx + 1]; + for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 < num_chs; ch_idx2++ ) + { + if ( real_only == 0 ) + { + for ( sf = 0; sf < num_subframes; sf++ ) + { + for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) + { + out_cov_re[ch_idx1][ch_idx2] += + Cldfb_RealBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_idx2][sf][cldfb_band_idx]; + + out_cov_im[ch_idx1][ch_idx2] += + Cldfb_RealBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_idx2][sf][cldfb_band_idx] - + Cldfb_ImagBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_idx2][sf][cldfb_band_idx]; + } + } + } + else + { + for ( sf = 0; sf < num_subframes; sf++ ) + { + for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) + { + out_cov_re[ch_idx1][ch_idx2] += + Cldfb_RealBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_idx2][sf][cldfb_band_idx]; + + out_cov_im[ch_idx1][ch_idx2] = 0.0f; + } + } + } + } + } + + + return; +} + +static void ComputeBandedCov( + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float out_cov_re[][BINAURAL_CHANNELS], + float out_cov_im[][BINAURAL_CHANNELS], + int16_t num_chs, + const int16_t *pBand_grouping, + int16_t num_subframes, + int16_t md_band_idx, + int16_t real_only ) +{ + int16_t sf, cldfb_band_idx, ch_idx1, ch_idx2; + int16_t brange[2]; + + for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ ) + { + set_f( out_cov_re[ch_idx1], 0.0f, num_chs ); + set_f( out_cov_im[ch_idx1], 0.0f, num_chs ); + } + brange[0] = pBand_grouping[md_band_idx]; + brange[1] = pBand_grouping[md_band_idx + 1]; + for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 <= ch_idx1; ch_idx2++ ) + { + if ( ( ch_idx2 != ch_idx1 ) && ( real_only == 0 ) ) + { + for ( sf = 0; sf < num_subframes; sf++ ) + { + for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) + { + out_cov_re[ch_idx1][ch_idx2] += + Cldfb_RealBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_idx2][sf][cldfb_band_idx]; + + out_cov_im[ch_idx1][ch_idx2] += + Cldfb_RealBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_idx2][sf][cldfb_band_idx] - + Cldfb_ImagBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_idx2][sf][cldfb_band_idx]; + } + } + } + else + { + for ( sf = 0; sf < num_subframes; sf++ ) + { + for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) + { + out_cov_re[ch_idx1][ch_idx2] += + Cldfb_RealBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_idx2][sf][cldfb_band_idx]; + + out_cov_im[ch_idx1][ch_idx2] = 0.0f; + } + } + } + } + } + + for ( ch_idx1 = 0; ch_idx1 < num_chs; ch_idx1++ ) + { + for ( ch_idx2 = ch_idx1 + 1; ch_idx2 < num_chs; ch_idx2++ ) + { + out_cov_re[ch_idx1][ch_idx2] = out_cov_re[ch_idx2][ch_idx1]; + out_cov_im[ch_idx1][ch_idx2] = -out_cov_im[ch_idx2][ch_idx1]; + } + } + + + return; +} + +static float GetNormFact( + float cov_ii_re[][BINAURAL_CHANNELS], + float cov_ii_im[][BINAURAL_CHANNELS], + float cov_io_re[][BINAURAL_CHANNELS], + float cov_io_im[][BINAURAL_CHANNELS], + float cov_oo_re[][BINAURAL_CHANNELS] ) +{ + int16_t i, j; + float norm_fact, abs_val; + + norm_fact = 0.0f; + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + IVAS_CALCULATE_ABS( cov_ii_re[i][j], cov_ii_im[i][j], abs_val ); + norm_fact = max( norm_fact, abs_val ); + + IVAS_CALCULATE_ABS( cov_io_re[i][j], cov_io_im[i][j], abs_val ); + norm_fact = max( norm_fact, abs_val ); + + IVAS_CALCULATE_RABS( cov_oo_re[i][j], abs_val ); + norm_fact = max( norm_fact, abs_val ); + } + } + + norm_fact = ( norm_fact > EPSILON ) ? norm_fact : 1.0f; + + norm_fact = PCM16_TO_FLT_FAC / norm_fact; + + return norm_fact; +} + +static void ivas_split_rend_huffman_encode( + ivas_split_rend_huffman_cfg_t *huff_cfg, + int16_t in, + int32_t *hcode, + int32_t *hlen ) +{ + int32_t min_sym_val; + const int32_t *codebook; + + min_sym_val = huff_cfg->codebook[0]; + + codebook = &huff_cfg->codebook[3 * ( in - min_sym_val )]; + *hlen = codebook[1]; + *hcode = codebook[2]; + + return; +} + +static void ivas_split_rend_quant_md( + BIN_HR_SPLIT_REND_MD_HANDLE hMd, + int16_t real_only, + float fix_pos_rot_mat[][BINAURAL_CHANNELS] ) +{ + int16_t ch1, ch2; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd->pred_mat_re[ch1][ch2] -= fix_pos_rot_mat[ch1][ch2]; + hMd->pred_mat_re[ch1][ch2] = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( hMd->pred_mat_re[ch1][ch2], IVAS_SPLIT_REND_PRED_MIN_VAL ) ); + } + } + if ( real_only == 0 ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd->pred_mat_im[ch1][ch2] = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( hMd->pred_mat_im[ch1][ch2], IVAS_SPLIT_REND_PRED_MIN_VAL ) ); + } + } + } + hMd->gd = min( IVAS_SPLIT_REND_D_MAX_VAL, max( hMd->gd, IVAS_SPLIT_REND_D_MIN_VAL ) ); + + ivas_quantise_real_values( &hMd->pred_mat_re[0][0], + IVAS_SPLIT_REND_PRED_QUANT_PNTS, + IVAS_SPLIT_REND_PRED_MIN_VAL, + IVAS_SPLIT_REND_PRED_MAX_VAL, + &hMd->pred_mat_re_idx[0][0], + &hMd->pred_mat_re[0][0], + BINAURAL_CHANNELS * BINAURAL_CHANNELS ); + + ivas_quantise_real_values( &hMd->pred_mat_im[0][0], + IVAS_SPLIT_REND_PRED_QUANT_PNTS, + IVAS_SPLIT_REND_PRED_MIN_VAL, + IVAS_SPLIT_REND_PRED_MAX_VAL, + &hMd->pred_mat_im_idx[0][0], + &hMd->pred_mat_im[0][0], + BINAURAL_CHANNELS * BINAURAL_CHANNELS ); + + ivas_quantise_real_values( &hMd->gd, + IVAS_SPLIT_REND_D_QUANT_PNTS, + IVAS_SPLIT_REND_D_MIN_VAL, + IVAS_SPLIT_REND_D_MAX_VAL, + &hMd->gd_idx, + &hMd->gd, + 1 ); + + return; +} + + +static void ComputeCoeffs( + float cov_ii_re[][BINAURAL_CHANNELS], + float cov_ii_im[][BINAURAL_CHANNELS], + float cov_io_re[][BINAURAL_CHANNELS], + float cov_io_im[][BINAURAL_CHANNELS], + float cov_oo_re[][BINAURAL_CHANNELS], + BIN_HR_SPLIT_REND_MD_HANDLE hMd, + float fix_pos_rot_mat[][BINAURAL_CHANNELS], + int16_t real_only ) +{ + float postpred_cov_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float postpred_cov_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_ii_norm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_ii_norm_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_io_norm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_io_norm_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_oo_norm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float sigma_d, rho_hat, rho, gd, gd2, gl2, gr2, cov_norm_fact; + float aa, bb, cc, dd, sign; + int16_t i, j; + + +#if 1 + + cov_norm_fact = GetNormFact( + cov_ii_re, + cov_ii_im, + cov_io_re, + cov_io_im, + cov_oo_re ); + + // normalize the covariance + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + cov_ii_norm_re[i][j] = cov_ii_re[i][j] * cov_norm_fact; + cov_ii_norm_im[i][j] = cov_ii_im[i][j] * cov_norm_fact; + cov_io_norm_re[i][j] = cov_io_re[i][j] * cov_norm_fact; + cov_io_norm_im[i][j] = cov_io_im[i][j] * cov_norm_fact; + cov_oo_norm_re[i][j] = cov_oo_re[i][j] * cov_norm_fact; + } + } + + ComputePredMat( cov_ii_norm_re, + cov_ii_norm_im, + cov_io_norm_re, + cov_io_norm_im, + hMd->pred_mat_re, + hMd->pred_mat_im, + BINAURAL_CHANNELS, + real_only ); +#else + +#endif + + /*TODO : change this function to real only as thats what is needed*/ + ComputePostPredCov( cov_ii_norm_re, + cov_ii_norm_im, + hMd->pred_mat_re, + hMd->pred_mat_im, + postpred_cov_re, + postpred_cov_im, + BINAURAL_CHANNELS ); + + // normalize everything to +-1 range + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + postpred_cov_re[i][j] *= 1.0f / ( PCM16_TO_FLT_FAC ); + cov_ii_norm_re[i][j] = cov_ii_norm_re[i][j] * 1.0f / ( PCM16_TO_FLT_FAC ); + cov_oo_norm_re[i][j] = cov_oo_norm_re[i][j] * 1.0f / ( PCM16_TO_FLT_FAC ); + } + } + + sigma_d = cov_ii_norm_re[0][0] + cov_ii_norm_re[1][1] + cov_ii_norm_re[0][1] + cov_ii_norm_re[1][0] + EPSILON; + + rho_hat = max( EPSILON, sqrtf( postpred_cov_re[0][0] * postpred_cov_re[1][1] ) ); + rho_hat = postpred_cov_re[0][1] / rho_hat; + rho = max( EPSILON, sqrtf( cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1] ) ); + rho = cov_oo_norm_re[0][1] / rho; + rho_hat = min( max( rho_hat, -0.9999f ), 0.9999f ); + rho = min( max( rho, -0.9999f ), 0.9999f ); + + // Compute decorrelator gain : gd2 = 0; + gd = 0; + gd2 = 0; + + aa = ( sigma_d * sigma_d ) * ( ( rho_hat * rho_hat ) - 1 ) + EPSILON; + bb = -( rho_hat * rho_hat ) * sigma_d * ( cov_oo_norm_re[0][0] + cov_oo_norm_re[1][1] ); + cc = ( rho_hat * rho_hat ) * cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1]; + cc -= cov_oo_norm_re[0][1] * cov_oo_norm_re[0][1]; + + sign = +1.0f; + if ( rho < ( rho_hat - 0.0001 ) ) + { + bb -= 2 * sigma_d * cov_oo_norm_re[0][1]; + sign = -1.0f; + } + else if ( rho > ( rho_hat + 0.0001 ) ) + { + bb += 2 * sigma_d * cov_oo_norm_re[0][1]; + } + dd = bb * bb - ( 4 * aa * cc ); + if ( dd >= 0 ) + { + float gd2_1, gd2_2; + gd2_1 = ( -bb + sqrtf( dd ) ) / ( 2 * aa ); + gd2_2 = ( -bb - sqrtf( dd ) ) / ( 2 * aa ); + if ( ( gd2_1 >= 0 ) && ( gd2_2 >= 0 ) ) + { + gd2 = min( gd2_1, gd2_2 ); + } + else + { + gd2 = max( 0, max( gd2_1, gd2_2 ) ); + } + gd = sign * sqrtf( gd2 ); + } + + gd = min( 1.0f, max( gd, 0.0f ) ); + hMd->gd = SPLIT_REND_DECOR_ALPHA * gd + ( 1 - SPLIT_REND_DECOR_ALPHA ) * hMd->gd; + gd2 = min( gd2, cov_oo_norm_re[0][0] / sigma_d ); + gd2 = min( gd2, cov_oo_norm_re[1][1] / sigma_d ); + + + if ( postpred_cov_re[0][0] > EPSILON ) + { + gl2 = ( cov_oo_norm_re[0][0] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[0][0] ); + gl2 = max( gl2, 1.0f ); + gl2 = sqrtf( gl2 ); + } + else + { + gl2 = 1.0f; + } + if ( postpred_cov_re[1][1] > EPSILON ) + { + gr2 = ( cov_oo_norm_re[1][1] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[1][1] ); + gr2 = max( gr2, 1.0f ); + gr2 = sqrtf( gr2 ); + } + else + { + gr2 = 1.0f; + } + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + hMd->pred_mat_re[i][0] *= gl2; + hMd->pred_mat_re[i][0] = min( 2.0f, max( hMd->pred_mat_re[i][0], -2.0f ) ); + + hMd->pred_mat_re[i][1] *= gr2; + hMd->pred_mat_re[i][1] = min( 2.0f, max( hMd->pred_mat_re[i][1], -2.0f ) ); + } + if ( real_only == 0 ) + { + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + hMd->pred_mat_im[i][0] *= gl2; + hMd->pred_mat_im[i][0] = min( 2.0f, max( hMd->pred_mat_im[i][0], -2.0f ) ); + + hMd->pred_mat_im[i][1] *= gr2; + hMd->pred_mat_im[i][1] = min( 2.0f, max( hMd->pred_mat_im[i][1], -2.0f ) ); + } + } + + ivas_split_rend_quant_md( hMd, real_only, fix_pos_rot_mat ); + return; +} + +static void ivas_SplitRenderer_code_md_base2( + BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], + BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg, + ivas_split_rend_bits_t *pBits, + int16_t sf_idx, + int16_t num_md_bands ) +{ + int16_t real_only, pos_idx, b, ch1, ch2; + int16_t min_pred_idx, min_gd_idx, pred_code_len, gd_code_len; + int32_t code; + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; + min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; + pred_code_len = pHuff_cfg->pred_base2_code_len; + gd_code_len = pHuff_cfg->gd_base2_code_len; + + for ( b = 0; b < num_md_bands; b++ ) + { + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + hMd = &rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + } + } + if ( real_only == 0 ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + } + } + } + code = hMd->gd_idx - min_gd_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, gd_code_len ); + } + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + { + static int num_bits = 0; + static int cntr = 0, sh_cnt = 0; + float fnum_bits; + + cntr++; + sh_cnt++; + + if ( sh_cnt == MAX_PARAM_SPATIAL_SUBFRAMES ) + { + num_bits += pBits->bits_written; + // collect bits for every second + if ( cntr == 200 ) + { + cntr = 0; + fnum_bits = (float) num_bits / 1000.0f; + dbgwrite_txt( &fnum_bits, 1, "split_rend_MD_bitrate.txt", "MD bitrate (kbps)" ); + num_bits = 0; + } + sh_cnt = 0; + } + } +#endif + return; +} + +static void ivas_SplitRenderer_code_md( + BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], + BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg, + ivas_split_rend_bits_t *pBits, + int16_t sf_idx, + int16_t num_md_bands ) +{ + int16_t real_only, pos_idx, b, ch1, ch2; + int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + int16_t min_pred_idx, max_pred_idx; + int32_t code, len; + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + + min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; + max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; + real_only = 0; + for ( b = 0; b < num_md_bands; b++ ) + { + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + hMd = &rot_md[pos_idx][sf_idx][b]; + + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_idx, max_pred_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + if ( real_only == 0 ) + { + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_idx, max_pred_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + } + ivas_split_rend_huffman_encode( &pHuff_cfg->gd, hMd->gd_idx, &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + { + static int num_bits = 0; + static int cntr = 0, sh_cnt = 0; + float fnum_bits; + + cntr++; + sh_cnt++; + + if ( sh_cnt == MAX_PARAM_SPATIAL_SUBFRAMES ) + { + num_bits += pBits->bits_written; + // collect bits for every second + if ( cntr == 200 ) + { + cntr = 0; + fnum_bits = (float) num_bits / 1000.0f; + dbgwrite_txt( &fnum_bits, 1, "split_rend_MD_bitrate.txt", "MD bitrate (kbps)" ); + num_bits = 0; + } + sh_cnt = 0; + } + } +#endif + return; +} + +void ivas_SplitRenderer_GetRotMd( + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ + float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + ivas_split_rend_bits_t *pBits, + int16_t sf_idx ) +{ + float cov_ii_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_oo_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_io_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_ii_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_oo_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float cov_io_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + int16_t real_only = 0; + + int16_t pos_idx, b; + int16_t yaw_idx; + int16_t num_md_bands; + const int16_t *pBand_grouping = SplitRend_band_grouping; + num_md_bands = MAX_SPLIT_REND_MD_BANDS; + + wmops_sub_start( "ivas_SplitRenderer_GetRotMd" ); + + /*compute reference signal covariance*/ + for ( b = 0; b < num_md_bands; b++ ) + { + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[0], + Cldfb_ImagBuffer_Ref_Binaural[0], + cov_ii_re, cov_ii_im, + BINAURAL_CHANNELS, + pBand_grouping, + MAX_PARAM_SPATIAL_SUBFRAMES, b, real_only ); + + /*compute rotated signal covariance*/ + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural[0], + Cldfb_ImagBuffer_Ref_Binaural[0], + Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], + Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + cov_io_re, cov_io_im, + BINAURAL_CHANNELS, + pBand_grouping, + MAX_PARAM_SPATIAL_SUBFRAMES, b, real_only ); + + ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], + Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + cov_oo_re, cov_oo_im, + BINAURAL_CHANNELS, + pBand_grouping, + MAX_PARAM_SPATIAL_SUBFRAMES, b, real_only ); + + yaw_idx = ( pos_idx / ( MAX_PITCH_ANGLES * MAX_ROLL_ANGLES ) ); + ComputeCoeffs( cov_ii_re, + cov_ii_im, + cov_io_re, + cov_io_im, + cov_oo_re, + &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b], + hBinHrSplitPreRend->fix_pos_rot_mat[yaw_idx], + real_only ); + } + } + +#ifdef SPLIT_REND_BASE2_CODING + ivas_SplitRenderer_code_md_base2( + hBinHrSplitPreRend->rot_md, + &hBinHrSplitPreRend->huff_cfg, + pBits, + sf_idx, + num_md_bands ); +#else + ivas_SplitRenderer_code_md( + hBinHrSplitPreRend->rot_md, + &hBinHrSplitPreRend->huff_cfg, + pBits, + sf_idx, + num_md_bands ); +#endif + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + { + int16_t num_cldfb_bands; + num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + char fname[200] = "rotated_ref_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + ivas_log_cldfb2wav_data( + Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], + Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + hBinHrSplitPreRend->cldfbSynRotBinDec[pos_idx], + BINAURAL_CHANNELS, + num_cldfb_bands, + 48000, + fname ); + } + ivas_log_cldfb2wav_data( + Cldfb_RealBuffer_Ref_Binaural[0], + Cldfb_ImagBuffer_Ref_Binaural[0], + hBinHrSplitPreRend->cldfbSynRotBinDec[MAX_HEAD_ROT_POSES], + BINAURAL_CHANNELS, + num_cldfb_bands, + 48000, + "rotated_ref_RefPos.wav" ); + } +#endif + + wmops_sub_end(); + + return; +} + +void ivas_rend_CldfbSplitPreRendProcess( + const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t max_bands, + ivas_split_rend_bits_t *pBits ) +{ + int16_t sf_idx, slot_idx, ch_idx, idx, pos_idx, num_poses; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + num_poses = MAX_HEAD_ROT_POSES + 1; +#else + num_poses = MAX_HEAD_ROT_POSES; +#endif + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + mvr2r( &Cldfb_In_BinReal[pos_idx][ch_idx][idx][0], &Cldfb_RealBuffer_Binaural[pos_idx][ch_idx][slot_idx][0], max_bands ); + mvr2r( &Cldfb_In_BinImag[pos_idx][ch_idx][idx][0], &Cldfb_ImagBuffer_Binaural[pos_idx][ch_idx][slot_idx][0], max_bands ); + } + } + } + + ivas_SplitRenderer_GetRotMd( + hBinHrSplitPreRend, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + pBits, + sf_idx ); + } + + return; +} + +ivas_error ivas_splitBinPreRendOpen( + BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + , + const int32_t output_Fs +#endif +) +{ + BIN_HR_SPLIT_PRE_REND_HANDLE hBinRend; + ivas_error error; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + int16_t ch; +#endif + int16_t pos_idx, sf_idx, bandIdx; + + error = IVAS_ERR_OK; + if ( ( hBinRend = (BIN_HR_SPLIT_PRE_REND_HANDLE) count_malloc( sizeof( BIN_HR_SPLIT_PRE_REND ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for bin split pre renderer Module \n" ) ); + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES + 1; i++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hBinRend->cldfbSynRotBinDec[i][ch] = NULL; + } + } + + for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES + 1; i++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + if ( ( error = openCldfb( &( hBinRend->cldfbSynRotBinDec[i][ch] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( bandIdx = 0; bandIdx < MAX_SPLIT_REND_MD_BANDS; bandIdx++ ) + { + hBinRend->rot_md[pos_idx][sf_idx][bandIdx].gd = 0.0f; + } + } + } + set_fix_rotation_mat( hBinRend->fix_pos_rot_mat ); + ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); + *hBinHrSplitPreRend = hBinRend; + return error; +} + +void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ) +{ + if ( ( *hBinHrSplitPreRend ) != NULL ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + { + int16_t i, n; + for ( i = 0; i < MAX_HEAD_ROT_POSES + 1; i++ ) + { + for ( n = 0; n < BINAURAL_CHANNELS; n++ ) + { + if ( ( *hBinHrSplitPreRend )->cldfbSynRotBinDec[i][n] != NULL ) + { + deleteCldfb( &( ( *hBinHrSplitPreRend )->cldfbSynRotBinDec[i][n] ) ); + ( *hBinHrSplitPreRend )->cldfbSynRotBinDec[i][n] = NULL; + } + } + } + } +#endif + count_free( ( *hBinHrSplitPreRend ) ); + ( *hBinHrSplitPreRend ) = NULL; + } + return; +} + +void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ) +{ + hSplitRendWrapper->hBinHrSplitPostRend = NULL; + hSplitRendWrapper->hBinHrSplitPreRend = NULL; + hSplitRendWrapper->hCldfbHandles = NULL; + hSplitRendWrapper->hSplitBinLCLDDec = NULL; + hSplitRendWrapper->hSplitBinLCLDEnc = NULL; + return; +} + +ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const int32_t OutSampleRate, const IVAS_SPLIT_REND_MODE splitRendMode, const int16_t is_cldfb_in ) +{ + ivas_error error, ch, num_ch; + error = IVAS_ERR_OK; + + if ( is_cldfb_in == 0 ) + { + if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) count_malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) ); + } + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; + for ( ch = 0; ch < num_ch; ch++ ) + { + hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; + } + + for ( ch = 0; ch < num_ch; ch++ ) + { + if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + switch ( splitRendMode ) + { + case SPLIT_REND_PRE: + + error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + , + OutSampleRate +#endif + ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc ); + break; + case SPLIT_REND_POST: + error = ivas_splitBinPostRendOpen( &hSplitRendWrapper->hBinHrSplitPostRend, OutSampleRate ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + break; + case SPLIT_REND_COMB: + error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + , + OutSampleRate +#endif + ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + error = ivas_splitBinPostRendOpen( &hSplitRendWrapper->hBinHrSplitPostRend, OutSampleRate ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec ); + break; + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + + return error; +} + +void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) +{ + if ( hSplitBinRend->hBinHrSplitPreRend != NULL ) + { + ivas_splitBinPreRendClose( &hSplitBinRend->hBinHrSplitPreRend ); + } + if ( hSplitBinRend->hSplitBinLCLDEnc != NULL ) + { + ivas_splitBinLCLDEncClose( &hSplitBinRend->hSplitBinLCLDEnc ); + } + if ( hSplitBinRend->hBinHrSplitPostRend != NULL ) + { + ivas_splitBinPostRendClose( &hSplitBinRend->hBinHrSplitPostRend ); + } + if ( hSplitBinRend->hSplitBinLCLDDec != NULL ) + { + ivas_splitBinLCLDDecClose( &hSplitBinRend->hSplitBinLCLDDec ); + } + + if ( hSplitBinRend->hCldfbHandles != NULL ) + { + hSplitBinRend->hCldfbHandles = NULL; + } + return; +} + +ivas_error ivas_renderMultiBinToSplitBinaural( + SPLIT_REND_WRAPPER *hSplitBin, + ivas_split_rend_bits_t *pBits, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], + const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], + const int16_t max_bands, + float out[][L_FRAME48k] ) +{ + ivas_error error; + error = IVAS_ERR_OK; + if ( hSplitBin->hCldfbHandles != NULL ) + { + /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ + int16_t num_cldfb_bands, ch, slot_idx, pos_idx; + + assert( hSplitBin->hCldfbHandles != NULL ); + num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; + /* CLDFB Analysis*/ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES + 1; pos_idx++ ) +#else + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) +#endif + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + cldfbAnalysis_ts( &( out[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), + Cldfb_In_BinReal[pos_idx][ch][slot_idx], + Cldfb_In_BinImag[pos_idx][ch][slot_idx], + max_bands, + hSplitBin->hCldfbHandles->cldfbAna[ch] ); + } + } + } + } + + ivas_rend_CldfbSplitPreRendProcess( + hSplitBin->hBinHrSplitPreRend, + Cldfb_In_BinReal, + Cldfb_In_BinImag, + max_bands, + pBits ); + + ivas_splitBinLCLDEncProcess( + hSplitBin->hSplitBinLCLDEnc, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0], + pBits ); + + + /*CLFDB decoding and SPLIT post rendering MD based adjustments*/ + { + + ivas_splitBinLCLDDecProcess( + hSplitBin->hSplitBinLCLDDec, + pBits, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0] ); + + ivas_splitBinPostRendMdDec( + pBits, + hSplitBin->hBinHrSplitPostRend, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + hSplitBin->hBinHrSplitPreRend, +#endif + MAX_SPLIT_REND_MD_BANDS ); + + ivas_rend_CldfbSplitPostRendProcess( + hSplitBin->hBinHrSplitPostRend, + QuaternionsPre, + QuaternionsPost, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0], + out ); + } + + return error; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c new file mode 100644 index 0000000000..9d68e424fd --- /dev/null +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -0,0 +1,300 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#include "ivas_prot.h" +#include "prot.h" +#include "cnst.h" +#include "ivas_cnst.h" +#include "ivas_rom_rend.h" +#include "ivas_rom_com.h" +#include "ivas_rom_dec.h" +#include "ivas_rom_binauralRenderer.h" +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmops.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +void ivas_split_rend_bitstream_init( ivas_split_rend_bits_t *pBits, const int32_t buf_len_bytes, uint8_t *pbuf ) +{ + pBits->bits_buf = pbuf; + pBits->buf_len = buf_len_bytes; + pBits->bits_read = 0; + pBits->bits_written = 0; + return; +} + +void ivas_split_rend_huffman_dec_init_min_max_len( + ivas_split_rend_huffman_cfg_t *p_huff_cfg ) +{ + int16_t i, code_len; + const int32_t *codebook; + + codebook = p_huff_cfg->codebook; + + p_huff_cfg->min_len = p_huff_cfg->sym_len; + p_huff_cfg->max_len = 0; + + for ( i = 0; i < p_huff_cfg->sym_len; i++ ) + { + code_len = (int16_t) codebook[1]; + if ( p_huff_cfg->min_len > code_len ) + { + p_huff_cfg->min_len = code_len; + } + if ( p_huff_cfg->max_len < code_len ) + { + p_huff_cfg->max_len = code_len; + } + codebook = codebook + 3; + } + + return; +} + +static int16_t is_idx_present( int16_t *idx_list, const int16_t idx, const int16_t len ) +{ + int16_t i; + for ( i = 0; i < len; i++ ) + { + if ( idx_list[i] == idx ) + { + return 1; + } + } + return 0; +} +static void ivas_split_huff_get_idx_trav_list( int16_t *idx_list, ivas_split_rend_huffman_cfg_t *p_huff_cfg ) +{ + int16_t i, j, min_idx; + int32_t min_bits; + const int32_t *codebook; + + for ( i = 0; i < p_huff_cfg->sym_len; i++ ) + { + idx_list[i] = -1; + } + + for ( i = 0; i < p_huff_cfg->sym_len; i++ ) + { + codebook = p_huff_cfg->codebook; + min_bits = p_huff_cfg->max_len; + min_idx = -1; + for ( j = 0; j < p_huff_cfg->sym_len; j++ ) + { + if ( ( min_bits >= codebook[1] ) && ( is_idx_present( idx_list, j, i + 1 ) == 0 ) ) + { + min_bits = codebook[1]; + min_idx = j; + } + codebook += 3; + } + idx_list[i] = min_idx; + } + + return; +} + +void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg ) +{ + pHuff_cfg->pred.codebook = &ivas_split_rend_huff_pred_consts[0][0]; + pHuff_cfg->pred.sym_len = IVAS_SPLIT_REND_PRED_QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->pred_idx_trav, &pHuff_cfg->pred ); + pHuff_cfg->pred_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->pred.sym_len ) ); + + pHuff_cfg->gd.codebook = &ivas_split_rend_huff_d_consts[0][0]; + pHuff_cfg->gd.sym_len = IVAS_SPLIT_REND_D_QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->gd ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->gd_idx_trav, &pHuff_cfg->gd ); + pHuff_cfg->gd_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->gd.sym_len ) ); + + return; +} + +void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + float yaw_a, cos_yaw, sin_yaw; + int16_t pos_idx; + yaw_a = 0.0f; + for ( pos_idx = 0; pos_idx < MAX_YAW_ANGLES - 1; pos_idx++ ) + { + yaw_a += split_rend_relative_yaw_angles[pos_idx + 1]; + cos_yaw = cosf( EVS_PI * yaw_a / 180.0f ); + sin_yaw = sinf( EVS_PI * yaw_a / 180.0f ); + sin_yaw = 0.0f; + fix_pos_rot_mat[pos_idx][0][0] = cos_yaw; + fix_pos_rot_mat[pos_idx][1][1] = cos_yaw; + fix_pos_rot_mat[pos_idx][0][1] = sin_yaw; + fix_pos_rot_mat[pos_idx][1][0] = -1.0f * sin_yaw; + } + return; +} + +int16_t wrap_a( int16_t val, int16_t min_val, int16_t max_val ) +{ + if ( val < min_val ) + { + val = max_val - min_val + val + 1; + } + if ( val > max_val ) + { + val = min_val + val - max_val - 1; + } + return val; +} + +void ivas_SplitRenderer_getdiagdiff( + int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + int16_t out_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + const int16_t sign, + const int16_t min_val, + const int16_t max_val ) +{ + out_idx[0][0] = in_idx[0][0]; + out_idx[0][1] = in_idx[0][1]; + out_idx[1][1] = in_idx[1][1] + sign * out_idx[0][0]; + out_idx[1][1] = wrap_a( out_idx[1][1], min_val, max_val ); + out_idx[1][0] = in_idx[1][0] + sign * out_idx[0][1]; + out_idx[1][0] = wrap_a( out_idx[1][0], min_val, max_val ); + + return; +} + + +int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int32_t bits ) +{ + int32_t val, k; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + assert( ( pBits->bits_written - pBits->bits_read ) >= bits ); + assert( bits <= 32 ); +#endif + + /* write bit by bit */ + val = 0; + for ( k = bits - 1; k >= 0; k-- ) + { + if ( pBits->bits_buf[pBits->bits_read >> 3] & ( 1 << ( pBits->bits_read & 7 ) ) ) + { + val |= 1 << k; + } + pBits->bits_read++; + } + return val; +} +void ivas_split_rend_bitstream_write_int32( ivas_split_rend_bits_t *pBits, int32_t val, int32_t bits ) +{ + int32_t mask, k; + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + /*protection check*/ + if ( ( pBits->buf_len << 3 ) < ( pBits->bits_written + bits ) ) + { + assert( 0 ); + } +#endif + + mask = 1 << ( bits - 1 ); + /* write bit by bit */ + for ( k = 0; k < bits; k++ ) + { + if ( val & mask ) + { + pBits->bits_buf[pBits->bits_written >> 3] |= ( 1 << ( pBits->bits_written & 7 ) ); + } + else + { + pBits->bits_buf[pBits->bits_written >> 3] &= ~( 1 << ( pBits->bits_written & 7 ) ); + } + pBits->bits_written++; + mask >>= 1; + } + return; +} + + +IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( + const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], + int16_t subframe_idx ) +{ + int16_t idx; + + idx = ( subframe_idx * RENDERER_HEAD_POSITIONS_PER_FRAME ) / MAX_PARAM_SPATIAL_SUBFRAMES; + return headPositions[idx]; +} + + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +void ivas_log_cldfb2wav_data( + float Cldfb_In_Real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + HANDLE_CLDFB_FILTER_BANK *cldfbSyn, + const int16_t num_chs, + const int16_t num_freq_bands, + const int32_t output_Fs, + const char *filename ) +{ + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float pcm_out[BINAURAL_CHANNELS][L_FRAME48k]; + float *pPcm[BINAURAL_CHANNELS]; + float Cldfb_local_Real[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_local_Imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + int16_t sf, ch; + + assert( num_chs <= BINAURAL_CHANNELS ); + for ( ch = 0; ch < num_chs; ch++ ) + { + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + mvr2r( Cldfb_In_Real[ch][sf], Cldfb_local_Real[ch][sf], num_freq_bands ); + mvr2r( Cldfb_In_Imag[ch][sf], Cldfb_local_Imag[ch][sf], num_freq_bands ); + RealBuffer[sf] = Cldfb_local_Real[ch][sf]; + ImagBuffer[sf] = Cldfb_local_Imag[ch][sf]; + } + cldfbSynthesis( RealBuffer, + ImagBuffer, + &( pcm_out[ch][0] ), + num_freq_bands * MAX_PARAM_SPATIAL_SUBFRAMES, + cldfbSyn[ch] ); + pPcm[ch] = pcm_out[ch]; + } + dbgwrite_wav( pPcm, num_freq_bands * MAX_PARAM_SPATIAL_SUBFRAMES, + filename, output_Fs, num_chs ); +} +#endif +#endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 2764aa6a10..f604c309e9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -50,10 +50,15 @@ /* Maximum buffer length (per channel) in samples. * Keep this separate from L_FRAME48k in case we want to support different size later */ -#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) /* Maximum buffer length (total) in samples. */ +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define MAX_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#endif /* Frame size required when rendering to binaural */ #define BINAURAL_RENDERING_FRAME_SIZE_MS 20 @@ -86,6 +91,9 @@ typedef struct const LSSETUP_CUSTOM_STRUCT *pCustomLsOut; const EFAP_WRAPPER *pEfapOutWrapper; const IVAS_REND_HeadRotData *pHeadRotData; +#ifdef SPLIT_REND_WITH_HEAD_ROT + const IVAS_SPLIT_REND_MODE *pSplitRendMode; +#endif /* TODO @Philips : would this be a better place to store the render config data? * bearing in mind we could have multiple inputs to the renderer, we might neeed to accomodate * multiple rendering configurations unless one global one can be used. If this is not relevant, @@ -136,6 +144,10 @@ typedef struct input_base base; pan_matrix hoaDecMtx; CREND_WRAPPER crendWrapper; +#ifdef SPLIT_REND_WITH_HEAD_ROT + CLDFB_REND_WRAPPER cldfbRendWrapper; + SPLIT_REND_WRAPPER splitRendWrapper; +#endif rotation_gains rot_gains_prev; } input_sba; @@ -172,6 +184,9 @@ struct IVAS_REND IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; IVAS_REND_HeadRotData headRotData; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_MODE splitRendMode; +#endif int8_t rendererConfigEnabled; RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ @@ -194,6 +209,40 @@ static float *getSmplPtr( return buffer.data + chnlIdx * buffer.config.numSamplesPerChannel + smplIdx; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static void copyBufferToCLDFBarray( + const IVAS_REND_AudioBuffer buffer, + float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) +{ + uint32_t smplIdx, slotIdx; + uint32_t numCldfbSamples, num_bands; + uint32_t chnlIdx; + const float *readPtr; + + assert( ( buffer.config.is_cldfb == 1 ) && "for time domain input call copyBufferTo2dArray()" ); + readPtr = buffer.data; + numCldfbSamples = ( (uint32_t) buffer.config.numSamplesPerChannel ) >> 1; + num_bands = numCldfbSamples / CLDFB_NO_COL_MAX; + for ( chnlIdx = 0; chnlIdx < (uint32_t) buffer.config.numChannels; ++chnlIdx ) + { + for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; ++slotIdx ) + { + for ( smplIdx = 0; smplIdx < num_bands; ++smplIdx ) + { + re[chnlIdx][slotIdx][smplIdx] = *readPtr++; + } + for ( smplIdx = 0; smplIdx < num_bands; ++smplIdx ) + { + im[chnlIdx][slotIdx][smplIdx] = *readPtr++; + } + } + } + + return; +} +#endif + static void copyBufferTo2dArray( const IVAS_REND_AudioBuffer buffer, float array[MAX_OUTPUT_CHANNELS][L_FRAME48k] ) @@ -202,6 +251,9 @@ static void copyBufferTo2dArray( uint32_t chnlIdx; const float *readPtr; +#ifdef SPLIT_REND_WITH_HEAD_ROT + assert( ( buffer.config.is_cldfb == 0 ) && "for CLDFB input call copyBufferToCLDFBarray()" ); +#endif readPtr = buffer.data; for ( chnlIdx = 0; chnlIdx < (uint32_t) buffer.config.numChannels; ++chnlIdx ) @@ -836,6 +888,12 @@ static void initHeadRotation( { hIvasRend->headRotData.headPositions[i] = quaternionInit(); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) + { + hIvasRend->headRotData.headPositionsPostRend[i] = quaternionInit(); + } +#endif return; } @@ -915,6 +973,9 @@ static rendering_context getRendCtx( ctx.pCustomLsOut = &hIvasRend->customLsOut; ctx.pEfapOutWrapper = &hIvasRend->efapOutWrapper; ctx.pHeadRotData = &hIvasRend->headRotData; +#ifdef SPLIT_REND_WITH_HEAD_ROT + ctx.pSplitRendMode = &hIvasRend->splitRendMode; +#endif return ctx; } @@ -942,7 +1003,6 @@ static CREND_WRAPPER defaultCrendWrapper( return w; } - static ivas_error setRendInputActiveIsm( void *input, const IVAS_REND_AudioConfig inConfig, @@ -1796,7 +1856,24 @@ static ivas_error updateSbaPanGains( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: - error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, *rendCtx.pOutSampleRate ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( *rendCtx.pSplitRendMode ) != SPLIT_REND_DISABLED ) + { + if ( ( *rendCtx.pSplitRendMode ) != SPLIT_REND_POST ) + { + error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, SPLIT_REND_PRE, hRendCfg, *rendCtx.pOutSampleRate ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } + error = ivas_split_renderer_open( &inputSba->splitRendWrapper, *rendCtx.pOutSampleRate, *rendCtx.pSplitRendMode, 1 ); + } + else +#endif + { + error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, *rendCtx.pOutSampleRate ); + } break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_REND_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) @@ -1863,6 +1940,13 @@ static void clearInputSba( { ivas_rend_closeCrend( &inputSba->crendWrapper ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) + { + ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); + } + ivas_split_renderer_close( &inputSba->splitRendWrapper ); +#endif return; } @@ -2125,6 +2209,11 @@ static DecoderDummy *initDecoderDummy( int32_t sampleRate, int16_t numTransChann decDummy->hDecoderConfig->Opt_Headrotation = 0; decDummy->hBinRenderer = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + decDummy->splitBinRend.hSplitRendBits = NULL; + decDummy->splitBinRend.hMultiBinCldfbData = NULL; + ivas_init_split_rend_handles( &decDummy->splitBinRend.splitrend ); +#endif decDummy->hEFAPdata = NULL; decDummy->hHrtf = NULL; decDummy->hHrtfTD = NULL; @@ -2287,7 +2376,12 @@ static void clearInputMasa( input_masa *inputMasa ) ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_REND_AudioConfig outConfig +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_MODE splitRendMode +#endif +) { int16_t i; IVAS_REND_HANDLE hIvasRend; @@ -2327,6 +2421,9 @@ ivas_error IVAS_REND_Open( #ifdef DEBUGGING hIvasRend->numClipping = 0; #endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + hIvasRend->splitRendMode = splitRendMode; +#endif /* Initialize limiter */ if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) @@ -2359,6 +2456,10 @@ ivas_error IVAS_REND_Open( { initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsSba[i].crendWrapper.hCrend = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; + ivas_init_split_rend_handles( &hIvasRend->inputsSba[i].splitRendWrapper ); +#endif } for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { @@ -3047,8 +3148,19 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hIvasRend->inputsSba[i].splitRendWrapper.hBinHrSplitPostRend != NULL ) + { + latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; + latency_ns += IVAS_FB_DEC_DELAY_NS; + *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + } + else +#endif + { + latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; + *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + } } } @@ -3072,7 +3184,9 @@ ivas_error IVAS_REND_FeedInputAudio( ivas_error error; input_base *inputBase; int16_t numInputChannels; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t cldfb2tdSampleFact; +#endif /*-----------------------------------------------------------------* * Validate function arguments *-----------------------------------------------------------------*/ @@ -3081,7 +3195,16 @@ ivas_error IVAS_REND_FeedInputAudio( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1; +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || + ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) +#else if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) +#endif { return IVAS_ERR_INVALID_BUFFER_SIZE; } @@ -3089,8 +3212,13 @@ ivas_error IVAS_REND_FeedInputAudio( { return IVAS_ERR_WRONG_NUM_CHANNELS; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) +#else if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) +#endif { /* Binaural rendering requires specific frame size */ return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -3295,7 +3423,12 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] ) + const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const IVAS_SPLIT_REND_MODE splitRendMode +#endif +) { int16_t i; @@ -3320,9 +3453,21 @@ ivas_error IVAS_REND_SetHeadRotation( else { hIvasRend->headRotData.headRotEnabled = 1; - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( splitRendMode == SPLIT_REND_POST ) + { + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) + { + hIvasRend->headRotData.headPositionsPostRend[i] = headRot[i]; + } + } + else +#endif { - hIvasRend->headRotData.headPositions[i] = headRot[i]; + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) + { + hIvasRend->headRotData.headPositions[i] = headRot[i]; + } } } @@ -4330,6 +4475,88 @@ static ivas_error renderSbaToSba( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error renderMultiBinToSplitBinaural( + SPLIT_REND_WRAPPER *hSplitBin, + ivas_split_rend_bits_t *pBits, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const IVAS_REND_HeadRotData *pHeadRotData, + const int16_t max_bands, + float out[][L_FRAME48k] ) +{ + ivas_error error; + IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES]; + IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t sf_idx; + + error = IVAS_ERR_OK; + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + QuaternionsPre[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); + QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositionsPostRend, sf_idx ); + } + + ivas_renderMultiBinToSplitBinaural( hSplitBin, pBits, Cldfb_In_BinReal, Cldfb_In_BinImag, QuaternionsPre, QuaternionsPost, max_bands, out ); + + return error; +} + +static ivas_error renderSbaToSplitBinaural( + input_sba *sbaInput, + IVAS_REND_AudioBuffer outAudio ) +{ + float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + ivas_error error; + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#endif + ivas_split_rend_bits_t bits; + + wmops_sub_start( "renderSbaToSplitBinaural" ); + error = IVAS_ERR_OK; + + copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + + ivas_rend_CldfbMultiBinRendProcess( + sbaInput->cldfbRendWrapper.hCldfbRend, + sbaInput->base.ctx.pHeadRotData, + Cldfb_RealBuffer, + Cldfb_ImagBuffer, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural ); + + + /*SPLIT pre rendering MD and CLDFB coding*/ + ivas_split_rend_bitstream_init( &bits, + outAudio.config.numChannels * outAudio.config.numSamplesPerChannel * sizeof( float ), + (uint8_t *) outAudio.data ); + + renderMultiBinToSplitBinaural( &sbaInput->splitRendWrapper, + &bits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + sbaInput->base.ctx.pHeadRotData, + sbaInput->cldfbRendWrapper.hCldfbRend->max_band, + tmpCrendBuffer ); + + // TEMP zero out + set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + + wmops_sub_end(); + + return error; +} +#endif + static ivas_error renderSbaToBinaural( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, @@ -4451,10 +4678,18 @@ static ivas_error renderInputSba( { ivas_error error; IVAS_REND_AudioBuffer inAudio; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t cldfb2tdSampleFact; +#endif inAudio = sbaInput->base.inputBuffer; +#ifdef SPLIT_REND_WITH_HEAD_ROT + cldfb2tdSampleFact = ( inAudio.config.is_cldfb ) ? 2 : 1; + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel * cldfb2tdSampleFact ) +#else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) +#endif { /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -4479,7 +4714,17 @@ static ivas_error renderInputSba( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: - error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( *sbaInput->base.ctx.pSplitRendMode ) != SPLIT_REND_DISABLED ) + { + /*TODO : combine this with renderSbaToBinaural*/ + error = renderSbaToSplitBinaural( sbaInput, outAudio ); + } + else +#endif + { + error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); + } break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: error = renderSbaToBinauralRoom( sbaInput, outConfig, outAudio ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index ea4b84d897..498545a9c2 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -53,6 +53,9 @@ typedef struct { int16_t numSamplesPerChannel; int16_t numChannels; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t is_cldfb; +#endif } IVAS_REND_AudioBufferConfig; typedef struct @@ -61,6 +64,20 @@ typedef struct float *data; } IVAS_REND_AudioBuffer; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef struct +{ + int32_t bufLenInBytes; + int32_t bitsWritten; + int32_t bitsRead; +} IVAS_REND_BitstreamBufferConfig; +typedef struct +{ + IVAS_REND_BitstreamBufferConfig config; + uint8_t *bits; +} IVAS_REND_BitstreamBuffer; +#endif + typedef struct { IVAS_REND_AudioBufferConfig config; @@ -150,6 +167,10 @@ ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const int32_t outputSampleRate, /* i : output sampling rate */ const IVAS_REND_AudioConfig outConfig /* i : output audio config */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_SPLIT_REND_MODE splitRendMode /* i : split rendering mode */ +#endif ); /* Note: this will reset custom LFE routings set for any MC input */ @@ -252,6 +273,10 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const IVAS_SPLIT_REND_MODE splitRendMode +#endif ); ivas_error IVAS_REND_GetSamples( -- GitLab From 45cc1b96d208b1dacdca70ddd012a04bfb0fe16d Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 16 Dec 2022 22:56:46 +0200 Subject: [PATCH 004/591] Implementation of contribution 26 - combined objects + MASA (OMASA) input format --- apps/decoder.c | 59 ++ apps/encoder.c | 127 +++ lib_com/ivas_cnst.h | 23 +- lib_com/ivas_ism_config.c | 102 ++- lib_com/ivas_masa_com.c | 249 +++++- lib_com/ivas_prot.h | 166 ++++ lib_com/ivas_rom_com.c | 42 + lib_com/ivas_rom_com.h | 8 + lib_com/ivas_stat_com.h | 4 +- lib_com/options.h | 10 +- lib_dec/ivas_cpe_dec.c | 53 +- lib_dec/ivas_dec.c | 135 ++- lib_dec/ivas_dirac_dec.c | 95 +- lib_dec/ivas_dirac_dec_binaural_functions.c | 388 +++++++- lib_dec/ivas_dirac_output_synthesis_dec.c | 123 ++- lib_dec/ivas_init_dec.c | 175 +++- lib_dec/ivas_ism_metadata_dec.c | 55 +- lib_dec/ivas_ism_param_dec.c | 4 + lib_dec/ivas_ism_renderer.c | 165 ++++ lib_dec/ivas_masa_dec.c | 653 +++++++++++++- lib_dec/ivas_mono_dmx_renderer.c | 17 + lib_dec/ivas_qmetadata_dec.c | 173 +++- lib_dec/ivas_sce_dec.c | 31 +- lib_dec/ivas_stat_dec.h | 55 ++ lib_dec/lib_dec.c | 36 + lib_dec/lib_dec.h | 9 + lib_enc/ivas_cpe_enc.c | 40 +- lib_enc/ivas_enc.c | 96 +- lib_enc/ivas_init_enc.c | 137 ++- lib_enc/ivas_ism_enc.c | 45 +- lib_enc/ivas_ism_metadata_enc.c | 215 ++++- lib_enc/ivas_ism_param_enc.c | 5 + lib_enc/ivas_masa_enc.c | 828 ++++++++++++++++- lib_enc/ivas_omasa_enc.c | 936 ++++++++++++++++++++ lib_enc/ivas_qmetadata_enc.c | 308 ++++++- lib_enc/ivas_sce_enc.c | 10 + lib_enc/ivas_stat_enc.h | 59 ++ lib_enc/lib_enc.c | 97 +- lib_enc/lib_enc.h | 24 + lib_rend/ivas_output_init.c | 20 + 40 files changed, 5663 insertions(+), 114 deletions(-) create mode 100644 lib_enc/ivas_omasa_enc.c diff --git a/apps/decoder.c b/apps/decoder.c index 7f94e19808..79cfb67d4f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -123,6 +123,12 @@ typedef struct #endif #endif +#ifdef MASAISM_EDIT_OBJECTS + bool editing_ism_enabled; + int16_t index_of_edited_ism; + int16_t azimuth_edited_ism; + int16_t elevation_edited_ism; +#endif } DecArguments; @@ -496,6 +502,17 @@ int main( } } +#ifdef MASAISM_EDIT_OBJECTS + /*------------------------------------------------------------------------------------------* + * Set edited object positions + *------------------------------------------------------------------------------------------*/ + + if ( arg.editing_ism_enabled ) + { + IVAS_DEC_SetEditedIsmPositions( hIvasDec, arg.index_of_edited_ism, arg.azimuth_edited_ism, arg.elevation_edited_ism ); + } +#endif + /*-----------------------------------------------------------------* * Decoding *-----------------------------------------------------------------*/ @@ -690,6 +707,9 @@ static bool parseCmdlIVAS_dec( { int16_t i; char argv_to_upper[FILENAME_MAX]; +#ifdef MASAISM_EDIT_OBJECTS + int32_t tmp; +#endif #ifdef DEBUGGING float ftmp; char stmp[FILENAME_MAX]; @@ -731,6 +751,13 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->no_diegetic_pan = 0.f; +#ifdef MASAISM_EDIT_OBJECTS + arg->editing_ism_enabled = false; + arg->index_of_edited_ism = 0; + arg->azimuth_edited_ism = 0; + arg->elevation_edited_ism = 0; +#endif + /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -958,6 +985,38 @@ static bool parseCmdlIVAS_dec( } i++; } +#ifdef MASAISM_EDIT_OBJECTS + else if ( strcmp( argv_to_upper, "-EDIT_ISM" ) == 0 ) /* Edit ISM position: objectID, azimuth (deg), elevation (deg) */ + { + arg->editing_ism_enabled = true; + i++; + + if ( argc - i <= 6 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Edited ISM position parameters not defined! \n\n" ); + usage_dec(); + return false; + } + + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + arg->index_of_edited_ism = tmp; + i++; + } + + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + arg->azimuth_edited_ism = tmp; + i++; + } + + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + arg->elevation_edited_ism = tmp; + i++; + } + } +#endif /*-----------------------------------------------------------------* * Option not recognized diff --git a/apps/encoder.c b/apps/encoder.c index 0bad34878b..af70f8f0a4 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -98,6 +98,14 @@ typedef union _EncInputFormatConfig /* MC details */ IVAS_ENC_MC_LAYOUT mcLayout; +#ifdef MASA_AND_OBJECTS + struct EncMasaIsmConfig + { + int16_t numObjects; + const char *metadataFiles[IVAS_MAX_NUM_OBJECTS]; + IVAS_ENC_MASA_VARIANT masaVariant; + } masa_ism; +#endif } EncInputFormatConfig; /* Struct for storing cmdln arguments */ @@ -488,6 +496,15 @@ int main( goto cleanup; } break; +#ifdef MASA_AND_OBJECTS + case IVAS_ENC_INPUT_MASA_ISM: + if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_ENC_ConfigureForMASAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); + exit( -1 ); + } + break; +#endif default: fprintf( stderr, "\nInvalid input type\n\n" ); goto cleanup; @@ -513,7 +530,12 @@ int main( } } + +#ifdef MASA_AND_OBJECTS + const int16_t numIsmInputs = ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_MASA_ISM ) ? arg.inputFormatConfig.ism.numObjects : 0; +#else const int16_t numIsmInputs = arg.inputFormat == IVAS_ENC_INPUT_ISM ? arg.inputFormatConfig.ism.numObjects : 0; +#endif for ( i = 0; i < numIsmInputs; ++i ) { @@ -1446,6 +1468,100 @@ static bool parseCmdlIVAS_enc( return false; } } +#ifdef MASA_AND_OBJECTS + else if ( strcmp( to_upper( argv[i] ), "-ISM_MASA" ) == 0 ) + { + arg->inputFormat = IVAS_ENC_INPUT_MASA_ISM; + i++; + + if ( i < argc - 5 ) + { + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + i++; + } + + if ( tmp <= 0 ) + { + fprintf( stderr, "Error: Too low number of ISM channels specified!\n\n" ); + usage_enc(); + } + else + { + if ( tmp <= IVAS_MAX_NUM_OBJECTS ) /* number of ISM channels */ + { + arg->inputFormatConfig.masa_ism.numObjects = (int16_t) tmp; + } + else + { + fprintf( stderr, "Error: Too high number of ISM channels!\n\n" ); + usage_enc(); + } + } + } + else + { + fprintf( stderr, "Error: Number of ISM channels not specified!\n\n" ); + usage_enc(); + } + if ( i < argc - 4 ) + { + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + i++; + } + + switch ( tmp ) + { + case 1: + arg->inputFormatConfig.masa_ism.masaVariant = IVAS_ENC_MASA_1CH; + break; + case 2: + arg->inputFormatConfig.masa_ism.masaVariant = IVAS_ENC_MASA_2CH; + break; + default: + fprintf( stderr, "Error: MASA channels must for the moment be 1 or 2.\n\n" ); + usage_enc(); + break; + } + } + + /* read input metadata files */ + for ( j = 0; j < arg->inputFormatConfig.masa_ism.numObjects; j++ ) + { + if ( i < argc - 4 ) + { + if ( strcmp( argv[i], "NULL" ) == 0 || strcmp( argv[i], "null" ) == 0 ) + { + /* no metadata input file -> encode only audio streams */ + arg->inputFormatConfig.masa_ism.metadataFiles[j] = NULL; + } + else + { + arg->inputFormatConfig.masa_ism.metadataFiles[j] = argv[i]; + } + + i++; + } + else + { + fprintf( stderr, "Error: not enough arguments\n\n" ); + usage_enc(); + } + } + + if ( i < argc - 4 ) + { + arg->masaMetadataFile = argv[i]; + i++; + } + else + { + fprintf( stderr, "Error: not enough MASA arguments\n\n" ); + usage_enc(); + } + } +#endif else if ( strcmp( argv_to_upper, "-STEREO_DMX_EVS" ) == 0 ) { arg->inputFormat = IVAS_ENC_INPUT_MONO; @@ -1621,6 +1737,10 @@ static void usage_enc( void ) fprintf( stdout, " 96000, 128000, 160000, 192000, 256000) \n" ); fprintf( stdout, " for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); fprintf( stdout, " 96000, 128000, 160000, 192000, 256000, 384000, 512000) \n" ); +#ifdef MASA_AND_OBJECTS + fprintf( stdout, " for IVAS MASA and objects R = (13200, 16400, 24400, 32000, 48000, 64000, 96000, 128000, \n" ); + fprintf( stdout, " 160000, 192000, 256000, 384000, 512000)\n" ); +#endif fprintf( stdout, " Alternatively, R can be a bitrate switching file which consists of R values\n" ); fprintf( stdout, " indicating the bitrate for each frame in bps. These values are stored in\n" ); fprintf( stdout, " binary format using 4 bytes per value\n" ); @@ -1644,6 +1764,13 @@ static void usage_enc( void ) fprintf( stdout, "-masa Ch File : MASA format \n" ); fprintf( stdout, " where Ch specifies the number of input/transport channels (1 or 2): \n" ); fprintf( stdout, " and File specifies input file containing parametric metadata \n" ); +#ifdef MASA_AND_OBJECTS + fprintf( stdout, "-ism_masa IsmChannels MasaChannels IsmFiles MasaFile : MASA and objects format \n" ); + fprintf( stdout, " where IsmChannels specifies the number of ISms (1-4)\n" ); + fprintf( stdout, " and MasaChannels specifies the number of MASA input/transport channels (1 or 2) \n" ); + fprintf( stdout, " and IsmFiles specify input files containing metadata, one file per object \n" ); + fprintf( stdout, " and MasaFile specifies MASA input file containing parametric metadata \n" ); +#endif fprintf( stdout, "-mc InputConf : Multi-channel format\n" ); fprintf( stdout, " where InputConf specifies the channel configuration: 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4\n" ); fprintf( stdout, " Loudspeaker positions are assumed to have azimuth and elevation as per \n" ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 7306216378..0e1aa45572 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -70,7 +70,9 @@ typedef enum SBA_FORMAT, /* IVAS SBA (ambisonics) format */ MASA_FORMAT, /* IVAS MASA format */ MC_FORMAT, /* IVAS multi-channel format */ - +#ifdef MASA_AND_OBJECTS + MASA_ISM_FORMAT, /* IVAS combined MASA + objects format*/ +#endif } IVAS_FORMAT; @@ -179,7 +181,11 @@ typedef enum #define MAX_CPE ( MAX_TRANSPORT_CHANNELS / CPE_CHANNELS ) /* max. number of CPEs */ #define MAX_BITS_METADATA 2640 /* max. bit-budget of metadata, one channel */ /* IVAS_fmToDo: to be confirmed for final value once mature */ +#ifdef MASA_AND_OBJECTS +#define MAX_NUM_METADATA max( 2, MAX_NUM_OBJECTS + 2 ) /* number of max. metadata (now only 2 for DirAC) */ +#else #define MAX_NUM_METADATA max( 2, MAX_NUM_OBJECTS ) /* number of max. metadata (now only 2 for DirAC) */ +#endif #define IVAS_ENC_DELAY_NS ACELP_LOOK_NS @@ -345,6 +351,12 @@ typedef enum ISM_MODE_NONE, ISM_MODE_DISC, /* discrete ISM */ ISM_MODE_PARAM /* parametric ISM */ +#ifdef MASA_AND_OBJECTS + , + ISM_MASA_MODE_PARAM, /* parametric ISM mode for combined MASA ISM format */ + ISM_MASA_MODE_ONE_OBJ, /* MASA ISM mode when one object is encoded separarately */ + ISM_MASA_MODE_DISC +#endif } ISM_MODE; @@ -1088,6 +1100,12 @@ enum #define MASA_DELTA_AZI_DCT 10 #define MASA_TRANSP_BITS 1 +#ifdef MASA_AND_OBJECTS +#define MASA_ISM_FORMAT_BITS 1 +#define NO_BITS_MASA_ISM_NO_OBJ 2 +#define MASA2TOTAL_THR 0.98f +#define BITS_MASA2TOTTAL_DCT0 6 +#endif #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 #define MASA_LOWBITRATE_MODE_BITS 1 @@ -1143,6 +1161,9 @@ enum #define MASA_ANGLE_AT_EQUATOR_DEG 0.738796268264740f #define MASA_INV_ANGLE_AT_EQUATOR_DEG 1.353553128183453f #define MASA_STEREO_MIN_BITRATE IVAS_24k4 +#ifdef MASA_AND_OBJECTS +#define MAXIMUM_OMASA_FREQ_BANDS 8 /* Corresponds to maximum number of coding bands at 32 kbps */ +#endif #define MASA_BIT_REDUCT_PARAM 10 #define MASA_MAXIMUM_TWO_DIR_BANDS 18 diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index fc4be3127e..4869de36ce 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -96,6 +96,10 @@ ivas_error ivas_ism_config( int32_t element_brate[], /* o : element bitrate per object */ int32_t total_brate[], /* o : total bitrate per object */ int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ +#ifdef MASA_AND_OBJECTS + , + int16_t masa_ism_flag /* i : flag indicating ISM MASA format */ +#endif ) { int16_t ch; @@ -107,9 +111,20 @@ ivas_error ivas_ism_config( int16_t n_ISms; ivas_error error; - error = IVAS_ERR_OK; - n_ISms = nchan_transport; + error = IVAS_ERR_OK; +#ifdef MASA_AND_OBJECTS + if ( masa_ism_flag == 1 ) + { + n_ISms = num_obj; + } + else + { +#endif + n_ISms = nchan_transport; +#ifdef MASA_AND_OBJECTS + } +#endif /* initialization */ ism_metadata_flag_global = 0; @@ -131,7 +146,16 @@ ivas_error ivas_ism_config( /* count ISm common signaling bits */ if ( hIsmMeta != NULL ) { +#ifdef MASA_AND_OBJECTS + nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS; + if ( masa_ism_flag == 0 ) + { + /* the bits for writing the number of objects are counted here for pure ISM modes */ + nb_bits_metadata[0] += num_obj; + } +#else nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; +#endif for ( ch = 0; ch < n_ISms; ch++ ) { @@ -490,3 +514,77 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } +#ifdef MASA_AND_OBJECTS +/*--------------------------------------------------------------- + * ivas_omasa_ism_mode_select() + * + * selects the ISM mode base on bit-rate and number of objects in the combined ISM MASA format mode + * ---------------------------------------------------------------*/ + +/*! r : ISM format mode */ +ISM_MODE ivas_omasa_ism_mode_select( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t no_obj /* i : number of objects */ +) +{ + ISM_MODE ism_mode = ISM_MODE_NONE; + + switch ( no_obj ) + { + case 1: + if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_48k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } + else + { + ism_mode = ISM_MODE_NONE; + } + break; + case 2: + if ( ivas_total_brate >= IVAS_80k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_ONE_OBJ; + } + else if ( ivas_total_brate >= IVAS_48k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } + else + { + ism_mode = ISM_MODE_NONE; + } + break; + case 3: + + case 4: + if ( ivas_total_brate >= IVAS_160k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_80k ) + { + ism_mode = ISM_MASA_MODE_ONE_OBJ; + } + else if ( ivas_total_brate >= IVAS_48k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } + else + { + ism_mode = ISM_MODE_NONE; + } + break; + } + + return ism_mode; +} +#endif diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index f98dcd8414..bf08a0b229 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -66,6 +66,12 @@ void ivas_masa_set_elements( int16_t *element_mode, /* o : element mode */ int16_t *nSCE, /* o : number of SCEs */ int16_t *nCPE /* o : number of CPEs */ +#ifdef MASA_AND_OBJECTS + , + int16_t ivas_format, + const ISM_MODE ism_mode, + int32_t sce_brate +#endif ) { if ( nchan_transport == 2 ) @@ -78,16 +84,43 @@ void ivas_masa_set_elements( *element_mode = IVAS_SCE; /* This is needed for the initialization phase to initialize codec mode to SCE, since it is written first to the file*/ } else +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) + { + + *nCPE = 1; + + if ( *element_mode == -1 ) + { + *element_mode = IVAS_CPE_DFT; /* To have it initialized in case it was not already. */ + } + if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) + { + *element_mode = IVAS_CPE_MDCT; + if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - sce_brate < MIN_BRATE_MDCT_STEREO ) ) + { + *element_mode = IVAS_CPE_DFT; + } + } + } + else +#endif { *nCPE = 1; *nSCE = 0; - if ( ivas_total_brate > IVAS_48k ) + if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) { *element_mode = IVAS_CPE_MDCT; } } hQMetaData->bits_frame_nominal = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ); +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) + { + hQMetaData->bits_frame_nominal -= (int16_t) ( sce_brate / FRAMES_PER_SEC ); + } +#endif } else if ( nchan_transport == 1 ) { @@ -388,3 +421,217 @@ void masa_sample_rate_band_correction( return; } + +#ifdef MASA_AND_OBJECTS +/*--------------------------------------------------------------- + * valid() + * + * Checking validity of the index of an ISM ratio index vector, + * within the indexing function. + *---------------------------------------------------------------*/ +int16_t valid( /* o: valid or not 1/0 */ + int16_t index, /* i: index to be checked */ + int16_t K, /* i: L1 norm to check against */ + int16_t len /* i: vector length */ +) +{ + int16_t out; + int16_t i, sum, elem; + int16_t base[4]; + + sum = 0; + set_s( base, 1, len ); + + + for ( i = 1; i < len; i++ ) + { + base[i] = base[i - 1] * 10; + } + sum = 0; + for ( i = len - 1; i >= 0; i-- ) + { + elem = index / base[i]; + sum += elem; + index -= elem * base[i]; + } + if ( sum <= K ) + { + out = 1; + } + else + { + out = 0; + } + return out; +} + +/*--------------------------------------------------------------- + * reconstruct_ism_ratios() + * + * Obtains ISM ratio values from the quantized indexes + *---------------------------------------------------------------*/ +void reconstruct_ism_ratios( + int16_t *ratio_ism_idx, /* i: index vector */ + int16_t n_ism, /* i: number of components/objects */ + float step, /* i: quantization step */ + float *q_energy_ratio_ism /* o: reconstructed ISM values */ +) +{ + int16_t i; + float sum; + sum = 0; + for ( i = 0; i < n_ism - 1; i++ ) + { + q_energy_ratio_ism[i] = ratio_ism_idx[i] * step; + sum += q_energy_ratio_ism[i]; + } + q_energy_ratio_ism[n_ism - 1] = 1.0f - sum; + return; +} + +/*--------------------------------------------------------------- + * modify_masa_energy_ratios() + * + * Updates energy ratios by taking into account the MASA content contribution + * to the total audio scene + *---------------------------------------------------------------*/ +void modify_masa_energy_ratios( + IVAS_QMETADATA_HANDLE hQMetaData /* i/o: Metadata handle */ +) +{ + int16_t i, m, d, b; + for ( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) + { + if ( hQMetaData->q_direction[0].cfg.nblocks == 1 ) + { + i = 0; + } + else + { + i = m; + } + + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + for ( d = 0; d < hQMetaData->no_directions; d++ ) + { + hQMetaData->q_direction[d].band_data[b].energy_ratio[m] = hQMetaData->q_direction[d].band_data[b].energy_ratio[m] * hQMetaData->masa_to_total_energy_ratio[i][b]; + } + } + } +} + +/*--------------------------------------------------------------- + * ivas_get_stereo_panning_gains() + * + * + *---------------------------------------------------------------*/ +void ivas_get_stereo_panning_gains( + float aziDeg, + float eleDeg, + float panningGains[2] ) +{ + float aziRad, eleRad; + float y, mappedX, aziRadMapped, A, A2, A3; + const float LsAngleRad = 30.0f * PI_OVER_180; + /* Convert azi and ele to an azi value of the cone of confusion */ + aziRad = aziDeg * PI_OVER_180; + eleRad = eleDeg * PI_OVER_180; + y = ( sinf( aziRad ) * cosf( eleRad ) ); + mappedX = sqrtf( max( 0.0f, 1.0f - ( y * y ) ) ); + aziRadMapped = atan2f( y, mappedX ); + + if ( aziRadMapped >= LsAngleRad ) + { /* Left side */ + panningGains[0] = 1.0f; + panningGains[1] = 0.0f; + } + else if ( aziRadMapped <= -LsAngleRad ) + { /* Right side */ + panningGains[0] = 0.0f; + panningGains[1] = 1.0f; + } + else /* Tangent panning law */ + { + A = tanf( aziRadMapped ) / tanf( LsAngleRad ); + A2 = ( A - 1.0f ) / max( 0.001f, A + 1.0f ); + A3 = 1.0f / ( A2 * A2 + 1.0f ); + panningGains[0] = sqrtf( A3 ); + panningGains[1] = sqrtf( 1.0f - A3 ); + } +} + +/*--------------------------------------------------------------- + * distribute_evenly_ism() + * + * Obtain ISM ratio indexes for even content distribution bbetween objects + *---------------------------------------------------------------*/ +void distribute_evenly_ism( + int16_t *idx, /* o: index values */ + int16_t K, /* i: sum of indexes */ + int16_t no_ism /* i: number of objects */ +) +{ + int16_t i; + int16_t sum; + sum = 0; + for ( i = 0; i < no_ism; i++ ) + { + idx[i] = (int16_t) ( K / no_ism ); + sum += idx[i]; + } + assert( sum <= K ); + i = 0; + while ( sum < K ) + { + if ( i == no_ism ) + { + i = 0; + } + idx[i]++; + sum++; + i++; + } +} + +/*--------------------------------------------------------------- + * calculate_cpe_brate_MASA_ISM() + * + * Calculates bitrate for MASA_ISM mode that is not used for separated objects, + * * but for the CPE part (metadata included) + *---------------------------------------------------------------*/ +int32_t /* o: cpe bitrate value */ +calculate_cpe_brate_MASA_ISM( + ISM_MODE ism_mode, /* i: ism mode */ + int32_t ivas_total_brate, /* i: total bit rate for IVAS */ + int16_t n_ism ) /* i: number of objects */ +{ + int32_t cpe_brate; + int16_t k, sce_id; + + k = 0; + + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + cpe_brate = ivas_total_brate - sep_object_brate[k - 2][0]; /* take data from the first column */ + } + else if ( ism_mode == ISM_MASA_MODE_DISC ) + { + cpe_brate = ivas_total_brate; + + for ( sce_id = 0; sce_id < n_ism; sce_id++ ) + { + cpe_brate -= sep_object_brate[k - 2][n_ism - 1]; + } + } + else + { + cpe_brate = ivas_total_brate; + } + return cpe_brate; +} +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7b2ad0a798..8bd1d65bfb 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -741,6 +741,9 @@ ivas_error ivas_ism_config( int32_t element_brate[], /* o : element bitrate per object */ int32_t total_brate[], /* o : total bitrate per object */ int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ +#ifdef MASA_AND_OBJECTS + , int16_t masa_ism_flag /* i : flag indicating ISM MASA format */ +#endif ); void ivas_ism_reset_metadata( @@ -801,6 +804,10 @@ ivas_error ivas_ism_metadata_enc( const int16_t localVAD[], /* i : VAD flag */ const int16_t ism_mode, /* i : ISM mode */ const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ +#ifdef MASA_AND_OBJECTS + , + int16_t n_ism /* i : number of ism-s */ +#endif ); ivas_error ivas_ism_metadata_dec( @@ -3267,6 +3274,10 @@ void ivas_dirac_dec_binaural( const int16_t nchan_transport /* i : number of transport channels */ ); +#ifdef MASA_AND_OBJECTS +void ivas_get_stereo_panning_gains( float aziDeg, float eleDeg, float panningGains[2] ); +#endif + ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ @@ -3455,6 +3466,9 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ +#ifdef MASA_AND_OBJECTS + MASA_ISM_DATA_HANDLE hMasaIsm, /* i : MASA_ISM data structure */ +#endif const int16_t direction_idx, /* i : index for direction (azi and ele) */ const int16_t subframe_idx, /* i : subframe index */ const float *surCohRatio, @@ -4406,6 +4420,13 @@ void ivas_masa_encode( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t Opt_DTX_ON, /* i : DTX on flag */ const int16_t element_mode /* i : element mode */ +#ifdef MASA_AND_OBJECTS + , + ISM_MODE ism_mode, /* i : ISM format mode */ + int16_t nchan_ism, /* i : number of ism channels */ + ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ + int16_t idx_separated_object /* i : index of the separated object */ +#endif ); void ivas_masa_estimate_energy( @@ -4427,8 +4448,59 @@ void ivas_masa_set_elements( int16_t *element_mode, /* o : element mode */ int16_t *nSCE, /* o : number of SCEs */ int16_t *nCPE /* o : number of CPEs */ +#ifdef MASA_AND_OBJECTS + , + int16_t ivas_format, /* i : IVAS format */ + const ISM_MODE ism_mode, /* i : ISM mode */ + int32_t sce_brate /* i : bitrate of SCE */ +#endif +); + +#ifdef MASA_AND_OBJECTS +int16_t valid( + int16_t index, + int16_t K, + int16_t len +); + +void reconstruct_ism_ratios( + int16_t *ratio_ism_idx, + int16_t n_ism, + float step, + float *q_energy_ratio_ism ); +void distribute_evenly_ism( + int16_t *idx, + int16_t K, + int16_t no_ism +); + +int16_t ivas_qmetadata_DecodeExtendedGR( + uint16_t* bitstream, + int16_t* index, + const int16_t alph_size, + const int16_t gr_param +); + +int16_t ivas_qmetadata_encode_extended_gr_length( + const uint16_t value, + const uint16_t alphabet_size, + const int16_t gr_param); + +void ivas_qmetadata_encode_extended_gr( + BSTR_ENC_HANDLE hMetaData, /* i/o: q_metadata handle */ + const uint16_t value, /* i : value to be encoded */ + const uint16_t alphabet_size, /* i : alphabet size */ + const int16_t gr_param); /* i : GR order */ + +int32_t /* o: cpe bitrate value */ +calculate_cpe_brate_MASA_ISM( + ISM_MODE ism_mode, /* i: ism mode */ + int32_t ivas_total_brate, /* i: total bit rate for IVAS */ + int16_t n_ism ); /* i: number of objects */ +#endif + void ivas_masa_set_coding_config( MASA_CODEC_CONFIG* config, /* i/o: MASA coding config structure */ int16_t* band_mapping, /* o : Band mapping used */ @@ -4961,6 +5033,100 @@ void ivas_filter_process( const int16_t length /* i : filter order */ ); +#ifdef MASA_AND_OBJECTS +/* ----------------------------------------------------------------------------------* +* OMASA prototypes +* ----------------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_enc_open( + Encoder_Struct* st_ivas /* i/o: IVAS encoder handle */ +); + +void ivas_omasa_enc_close( + OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ + const int16_t nchan_ism /* i : number of objects */ +); + +void ivas_omasa_set_config( + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ + const int32_t input_Fs /* i : Input sample rate */ +); + +void ivas_omasa_enc( + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + float data_in_f[][L_FRAME48k], /* i : Input audio signals for parameter analysis */ + float data_out_f[][L_FRAME48k], /* o : Transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_inp, /* i : Number of objects for parameter analysis */ + const ISM_MODE ism_mode, /* i : ISM mode */ + float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ + int16_t* idx_separated_object /* o : Index of the separated object */ +); + +ISM_MODE ivas_omasa_ism_mode_select( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t no_obj /* i : number of input ISM's */ +); + +void ivas_merge_masa_transports( + float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ + float data_in_f2[][L_FRAME48k], /* i : Transport audio signals 2 */ + float data_out_f[][L_FRAME48k], /* o : Merged transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t num_transport_channels /* i : Number of transport audio signals */ +); + +void ivas_masa_ism_data_open( + Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ +); + + +void preProcessStereoTransportsForMovedObjects( + Decoder_Struct* st_ivas, + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + uint8_t nBins, + uint8_t firstSubframe, + uint8_t nSubframes +); + +ivas_error ivas_masa_ism_separate_object_renderer_open( + Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_masa_ism_separate_object_render( + Decoder_Struct* st_ivas, /* i/o: IVAS decoder structure */ + float input_f[][L_FRAME48k], /* i : separated object signal */ + float output_f[][L_FRAME48k], /* i/o: output signals */ + const int16_t output_frame /* i : output frame length per channel */ +); + +void ivas_masa_ism_set_edited_objects( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void encode_masa_to_total( + IVAS_QMETADATA_HANDLE hQMetaData, + BSTR_ENC_HANDLE hMetaData +); + +void decode_masa_to_total( + uint16_t* bit_stream, + int16_t* index, + float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + int16_t nbands +); + +void modify_masa_energy_ratios( + IVAS_QMETADATA_HANDLE hQMetaData +); + +#endif /*----------------------------------------------------------------------------------* * TD Binaural Object renderer diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index c824c94a40..7c28e6b4f6 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2779,6 +2779,48 @@ const float McMASA_LFEGain_vectors[64] = -2.14f, 0.26f, 0.84f, 1.02f }; +#ifdef MASA_AND_OBJECTS + +int32_t sep_object_brate[][MAX_NUM_OBJECTS] ={ + {0, 0, 0, 0}, /* 13k2 */ + {0, 0, 0, 0}, /* 16k4 */ + {0, 0, 0, 0}, /* 24k4 */ + {0, 0, 0, 0}, /* 32k */ + {0, 0, 0, 0}, /* 48k */ + {16000, 0, 0, 0}, /* 64k */ + {20000, 16000, 0, 0}, /* 80k */ + {IVAS_32k, 20000, 0, 0}, /* 96k */ + {IVAS_32k, IVAS_24k4, 0, 0}, /* 128k */ + {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ + {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ + {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ + {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ + {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */ +}; +/* column wise DCT matrices for 4 5, and 8 dim */ + float dct4[] = { + 0.5000f, 0.6533f, 0.5000f, 0.2706f, + 0.5000f, 0.2706f, -0.5000f, -0.6533f, + 0.5000f, -0.2706f, -0.5000f, 0.6533f, + 0.5000f, -0.6533f, 0.5000f, -0.2706f + }; + + float dct5[] = { + 0.4472f, 0.6015f, 0.5117f, 0.3717f, 0.1954f, + 0.4472f, 0.3717f, -0.1954f, -0.6015f, -0.5117f, + 0.4472f, 0.0000f, -0.6325f, -0.0000f, 0.6325f, + 0.4472f, -0.3717f, -0.1954f, 0.6015f, -0.5117f, + 0.4472f, -0.6015f, 0.5117f, -0.3717f, 0.1954f + }; + float dct8[] = { + 0.3536f, 0.4904f, 0.4619f, 0.4157f, 0.3536f, 0.2778f, 0.1913f, 0.0975f, 0.3536f, 0.4157f, + 0.1913f, -0.0975f, -0.3536f, -0.4904f, -0.4619f, -0.2778f, 0.3536f, 0.2778f, -0.1913f, -0.4904f, + -0.3536f, 0.0975f, 0.4619f, 0.4157f, 0.3536f, 0.0975f, -0.4619f, -0.2778f, 0.3536f, 0.4157f, + -0.1913f, -0.4904f, 0.3536f, -0.0975f, -0.4619f, 0.2778f, 0.3536f, -0.4157f, -0.1913f, 0.4904f, + 0.3536f, -0.2778f, -0.1913f, 0.4904f, -0.3536f, -0.0975f, 0.4619f, -0.4157f, 0.3536f, -0.4157f, + 0.1913f, 0.0975f, -0.3536f, 0.4904f, -0.4619f, 0.2778f, 0.3536f, -0.4904f, 0.4619f, -0.4157f, + 0.3536f, -0.2778f, 0.1913f, -0.0975f }; +#endif /*----------------------------------------------------------------------------------* * ISM ROM tables diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 2b3755087c..acf2a80924 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -312,6 +312,14 @@ extern const float cb_azi_chan[]; extern const float McMASA_LFEGain_vectors[64]; +#ifdef MASA_AND_OBJECTS +/* MASA and ISM combined format */ +extern int32_t sep_object_brate[][MAX_NUM_OBJECTS]; +extern float dct4[]; +extern float dct5[]; +extern float dct8[]; +#endif + /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 2ec890b57d..ff2606ee62 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -526,7 +526,9 @@ typedef struct ivas_masa_qmetadata_frame_struct int16_t ec_flag; float dir_comp_ratio; uint8_t is_masa_ivas_format; - +#ifdef MASA_AND_OBJECTS + float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* TODO Nokia: This should be moved to some other place and reserved only when needed. */ +#endif } IVAS_QMETADATA, *IVAS_QMETADATA_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index 8a35f4f6f4..528e348ff4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -61,11 +61,11 @@ /*#define MEM_COUNT_DETAILS*/ /* RAM counting tool: print per sub-structure details */ -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO */ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ -/*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_DFT */ /* output most important DFT stereo parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ @@ -174,6 +174,12 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ +#define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ +#ifdef MASA_AND_OBJECTS +#define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ +#endif + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 12b8fcb899..34d3584f7a 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -77,7 +77,9 @@ ivas_error ivas_cpe_dec( Decoder_State **sts; int32_t ivas_total_brate; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t cpe_brate; +#endif error = IVAS_ERR_OK; wmops_sub_start( "ivas_cpe_dec" ); @@ -218,15 +220,33 @@ ivas_error ivas_cpe_dec( /* read DFT Stereo side info */ nb_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); - sts[1]->bit_stream = sts[0]->bit_stream + ivas_total_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; - +#ifdef MASA_AND_OBJECTS + cpe_brate = ivas_total_brate; + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + sts[1]->bit_stream = sts[0]->bit_stream + cpe_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; + } + else + { +#endif + sts[1]->bit_stream = sts[0]->bit_stream + ivas_total_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; +#ifdef MASA_AND_OBJECTS + } +#endif if ( ivas_total_brate == IVAS_SID_5k2 ) { nb_bits -= SID_FORMAT_NBITS; sts[1]->bit_stream -= SID_FORMAT_NBITS; } +#ifdef MASA_AND_OBJECTS + if ( ( ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || + ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) ) ) && + ivas_total_brate > IVAS_SID_5k2 ) +#else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_5k2 ) +#endif { sts[0]->total_brate = hCPE->element_brate; /* Only mono downmix was transmitted in this case */ } @@ -543,7 +563,9 @@ ivas_error create_cpe_dec( Decoder_State *st; int32_t output_Fs; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t cpe_brate; +#endif error = IVAS_ERR_OK; /*-----------------------------------------------------------------* @@ -581,7 +603,11 @@ ivas_error create_cpe_dec( hCPE->lt_es_em = 0.0f; /* Note: nchan_out is considered to be related to the structure. This is nchan_out for CPE and for MASA_format is always 2. */ +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) +#else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) +#endif { hCPE->nchan_out = CPE_CHANNELS; } @@ -589,8 +615,21 @@ ivas_error create_cpe_dec( { hCPE->nchan_out = min( CPE_CHANNELS, st_ivas->hDecoderConfig->nchan_out ); } - +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + cpe_brate = element_brate; + } + else + { + cpe_brate = st_ivas->hDecoderConfig->ivas_total_brate; + } + if ( ( ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || + ( st_ivas->ivas_format == MASA_ISM_FORMAT && cpe_brate < MASA_STEREO_MIN_BITRATE ) ) && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) +#else if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) +#endif { hCPE->nchan_out = 1; } @@ -607,7 +646,11 @@ ivas_error create_cpe_dec( for ( i = 0; i < CPE_CHANNELS; i++ ) { +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || +#else if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MASA_FORMAT || +#endif ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || st_ivas->sba_dirac_stereo_flag ) { if ( ( hCPE->input_mem[i] = (float *) count_malloc( sizeof( float ) * NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 5d3a5a10f9..9ceaa52f68 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -60,11 +60,17 @@ ivas_error ivas_dec( float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */ /* IVAS_fmToDo: buffer can be allocated dynamically based on the actual number of output channels */ int16_t nchan_remapped; float output_lfe_ch[L_FRAME48k]; +#ifdef MASA_AND_OBJECTS + int16_t nb_bits_metadata[MAX_SCE + 1]; +#else int16_t nb_bits_metadata[MAX_SCE]; +#endif int32_t output_Fs, ivas_total_brate; AUDIO_CONFIG output_config; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t ism_brate; +#endif error = IVAS_ERR_OK; wmops_sub_start( "ivas_dec" ); @@ -541,7 +547,134 @@ ivas_error ivas_dec( } } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + ism_brate = 0; + st = st_ivas->hCPE[0]->hCoreCoder[0]; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + ism_brate += st_ivas->hSCE[n]->element_brate; + } + st->bit_stream = &( st_ivas->bit_stream[( ism_brate / FRAMES_PER_SEC )] ); + } + + nb_bits_metadata[0] = 0; + set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); + + /* Set the number of objects for the parametric rendering */ + if ( st_ivas->hDirAC != NULL ) + { + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; + } + else + { + st_ivas->hDirAC->numIsmDirections = 0; + } + } + + /* MASA decoding */ + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Audio signal decoding */ + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + if ( st_ivas->nSCE == 1 ) + { + ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); + } + else + { +#ifdef DEBUGGING + assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); +#endif + } + } + else + { + /* decode ISM format */ + ivas_ism_metadata_dec( ism_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); + + for ( n = 0; n < st_ivas->nSCE - 1; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); + st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + } + } + if ( st_ivas->nCPE == 1 ) + { + ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); + } + + /* HP filtering */ + for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + + /* Set edited object positions, if editing enabled */ + ivas_masa_ism_set_edited_objects( st_ivas ); + + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); + } + else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); + } + else if ( st_ivas->hDirAC ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + mvr2r( output[2], data_separated_objects[0], output_frame ); + } + else + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + } + } + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); + ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); + } + else + { + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); + } + } + } +#endif /*----------------------------------------------------------------* * Write IVAS output channels diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 5f9e908481..b689109ae7 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -300,12 +300,20 @@ ivas_error ivas_dirac_dec_config( hDirAC->panningConf = DIRAC_PANNING_HOA3; nchan_out_woLFE = 1; } +#ifdef MASA_AND_OBJECTS + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.is_loudspeaker_setup ) +#else else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.is_loudspeaker_setup ) +#endif { hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirAC->panningConf = DIRAC_PANNING_VBAP; } +#ifdef MASA_AND_OBJECTS + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && !hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) +#else else if ( st_ivas->ivas_format == MASA_FORMAT && !hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) +#endif { hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; hDirAC->panningConf = DIRAC_PANNING_HOA3; @@ -342,6 +350,10 @@ ivas_error ivas_dirac_dec_config( hDirAC->masa_stereo_type_detect = NULL; } +#ifdef MASA_AND_OBJECTS + hDirAC->numIsmDirections = 0; /* By default, no ism directions, set correct number runtime when needed */ +#endif + /*-----------------------------------------------------------------* * (re)configure sub-modules *-----------------------------------------------------------------*/ @@ -789,12 +801,18 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { + hDirAC->dirac_md_buffer_length = 0; hDirAC->dirac_bs_md_write_idx = 0; hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; + +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) +#else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) +#endif { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; } @@ -836,6 +854,7 @@ ivas_error ivas_dirac_dec_config( hDirAC->diffuseness_vector[i] = (float *) count_malloc( hDirAC->num_freq_bands * sizeof( float ) ); set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); + hDirAC->energy_ratio1[i] = (float *) count_malloc( hDirAC->num_freq_bands * sizeof( float ) ); set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); hDirAC->spreadCoherence[i] = (float *) count_malloc( hDirAC->num_freq_bands * sizeof( float ) ); @@ -843,8 +862,11 @@ ivas_error ivas_dirac_dec_config( hDirAC->surroundingCoherence[i] = (float *) count_malloc( hDirAC->num_freq_bands * sizeof( float ) ); set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } - +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) +#else if ( st_ivas->ivas_format == MASA_FORMAT ) +#endif { hDirAC->azimuth2 = (int16_t **) count_malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); hDirAC->elevation2 = (int16_t **) count_malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); @@ -1563,7 +1585,12 @@ void ivas_qmetadata_to_dirac( int16_t qBand_idx; q_direction = &( hQMetaData->q_direction[0] ); +#ifdef MASA_AND_OBJECTS + hDirAC->numParametricDirections = hQMetaData->no_directions; + hDirAC->numSimultaneousDirections = hDirAC->numParametricDirections + hDirAC->numIsmDirections; +#else hDirAC->numSimultaneousDirections = hQMetaData->no_directions; +#endif if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { @@ -1873,6 +1900,10 @@ void ivas_dirac_dec( float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#ifdef MASA_AND_OBJECTS + float Cldfb_RealBuffer_Temp[2][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ + float Cldfb_ImagBuffer_Temp[2][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ +#endif int16_t index, num_freq_bands; DIRAC_DEC_STACK_MEM DirAC_mem; @@ -2016,6 +2047,9 @@ void ivas_dirac_dec( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, +#ifdef MASA_AND_OBJECTS + st_ivas->hMasaIsmData, +#endif subframe_idx, subframe_idx, surCohRatio, @@ -2027,6 +2061,9 @@ void ivas_dirac_dec( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, +#ifdef MASA_AND_OBJECTS + st_ivas->hMasaIsmData, +#endif subframe_idx, subframe_idx, surCohRatio, @@ -2035,6 +2072,36 @@ void ivas_dirac_dec( } } +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) + { + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) + { + index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; + + /* CLDFB Analysis*/ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + cldfbAnalysis_ts( &( output_f[sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + Cldfb_RealBuffer_Temp[ch][index_slot], + Cldfb_ImagBuffer_Temp[ch][index_slot], + hDirAC->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); + } + } + + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + preProcessStereoTransportsForMovedObjects( st_ivas, + Cldfb_RealBuffer_Temp, + Cldfb_ImagBuffer_Temp, + hDirAC->num_freq_bands, + subframe_idx, + 1 ); + } + } +#endif + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) { index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; @@ -2047,6 +2114,16 @@ void ivas_dirac_dec( mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) + { + for ( ch = 0; ch < nchan_transport; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Temp[ch][index_slot], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Temp[ch][index_slot], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); + } + } +#endif else { /* CLDFB Analysis*/ @@ -2649,19 +2726,35 @@ static void initDiffuseResponses( set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) +#else else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) +#endif { mvr2r( diffuse_response_CICP6, diffuse_response_function, num_channels ); } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_2 ) && ( num_channels == 7 ) ) +#else else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) +#endif { mvr2r( diffuse_response_CICP14, diffuse_response_function, num_channels ); } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) +#else else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) +#endif { mvr2r( diffuse_response_CICP16, diffuse_response_function, num_channels ); } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) +#else else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) +#endif { if ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) { diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index ee02a1bfe1..fc60732864 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -52,6 +52,9 @@ #define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) +#ifdef MASA_AND_OBJECTS +#define STEREO_PREPROCESS_IIR_FACTOR ( 0.9f ) +#endif /*------------------------------------------------------------------------- * Local function prototypes @@ -121,7 +124,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { +#ifdef MASA_AND_OBJECTS + for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) +#else for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) +#endif { set_zero( hBinaural->processMtxRe[j][k], nBins ); set_zero( hBinaural->processMtxIm[j][k], nBins ); @@ -366,8 +373,13 @@ static void ivas_dirac_dec_binaural_internal( { DIRAC_DEC_HANDLE hDirAC; uint8_t slot, ch, nBins, numInChannels; +#ifdef MASA_AND_OBJECTS + float Cldfb_RealBuffer_in[6][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[6][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#else float Cldfb_RealBuffer_in[4][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[4][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#endif float Rmat[3][3]; uint8_t firstSlot, slotEnd; int16_t max_band_decorr; @@ -381,10 +393,24 @@ static void ivas_dirac_dec_binaural_internal( /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) + { + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + numInChannels += (uint8_t) st_ivas->nchan_ism; + } + else + { + numInChannels++; + } + } +#else if ( st_ivas->hOutSetup.separateChannelEnabled ) { numInChannels++; } +#endif Rmat[0][0] = 1.0f; Rmat[0][1] = 0.0f; @@ -502,6 +528,18 @@ static void ivas_dirac_dec_binaural_internal( ivas_sba_prototype_renderer( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSubframe, nSubframes ); } +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + preProcessStereoTransportsForMovedObjects( st_ivas, + Cldfb_RealBuffer_in, + Cldfb_ImagBuffer_in, + nBins, + firstSubframe, + nSubframes ); + } +#endif + if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); @@ -717,7 +755,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Determine target covariance matrix containing target binaural properties */ for ( bin = 0; bin < nBins; bin++ ) { - float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ +#ifdef MASA_AND_OBJECTS + float diffusenessValForDecorrelationReduction = 1.0f; + float diffEneValForDecorrelationReduction; +#endif float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ float diffEne, dirEne, meanEnePerCh; uint16_t dirIndex; @@ -736,7 +778,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric float lRealp, lImagp, rRealp, rImagp; float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; - +#ifdef MASA_AND_OBJECTS + uint8_t isIsmDirection = 0; +#endif if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ { aziDeg = hDirAC->azimuth[dirac_read_idx][bin]; @@ -744,15 +788,55 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format != MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_ISM_FORMAT && dirIndex < hDirAC->numParametricDirections ) ) /* For second of the two simultaneous directions */ +#else else /* For second of the two simultaneous directions */ +#endif { aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; } +#ifdef MASA_AND_OBJECTS + else /* For object directions of MASA_ISM_FORMAT */ + { + isIsmDirection = 1; + uint16_t ismDirIndex; + ismDirIndex = dirIndex - hDirAC->numParametricDirections; + if ( st_ivas->hMasaIsmData->ism_is_edited[ismDirIndex] ) + { + aziDeg = st_ivas->hMasaIsmData->azimuth_ism_edited[ismDirIndex]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism_edited[ismDirIndex]; + } + else + { + aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex]; + } + ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][subframe][bin]; + spreadCoh = 0.0f; + } +#endif diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ +#ifdef MASA_AND_OBJECTS + if ( diffuseness < 0.0f ) + { + diffuseness = 0.0f; + } + if ( isIsmDirection ) + { + /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ + diffusenessValForDecorrelationReduction -= ratio * 0.5f; + } + else + { + diffusenessValForDecorrelationReduction -= ratio; + } +#endif + if ( separateCenterChannelRendering ) { /* In masa + mono rendering mode, the center directions originate from phantom sources, so the @@ -886,13 +970,31 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Add diffuse / ambient part covariance matrix */ diffuseness = max( 0.0f, diffuseness ); diffEne = diffuseness * meanEnePerCh; + surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; + +#ifdef MASA_AND_OBJECTS + diffusenessValForDecorrelationReduction = max( 0.0f, diffusenessValForDecorrelationReduction ); + diffEneValForDecorrelationReduction = diffusenessValForDecorrelationReduction * meanEnePerCh; +#endif + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { if ( !h->renderStereoOutputInsteadOfBinaural ) { /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ +#ifdef MASA_AND_OBJECTS + float spectrumModVal; + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )]; + diffEne *= spectrumModVal; +#else diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )]; +#endif +#ifdef MASA_AND_OBJECTS + /* Modify also the value for decorrelation reduction */ + diffEneValForDecorrelationReduction *= spectrumModVal; +#endif } } h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ @@ -918,7 +1020,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } /* Store parameters for formulating average diffuseness over frame */ +#ifdef MASA_AND_OBJECTS + h->frameMeanDiffuseness[bin] += diffEneValForDecorrelationReduction; +#else h->frameMeanDiffuseness[bin] += diffEne; +#endif frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; } @@ -1004,10 +1110,27 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { uint8_t chA, chB, bin; uint8_t separateCenterChannelRendering; +#ifdef MASA_AND_OBJECTS + uint8_t nchanSeparateChannels; +#endif int16_t nBins; DIRAC_DEC_BIN_HANDLE h; h = st_ivas->hDiracDecBin; +#ifdef MASA_AND_OBJECTS + separateCenterChannelRendering = 0; + nchanSeparateChannels = 0; + if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) + { + separateCenterChannelRendering = 1; + nchanSeparateChannels = 1; + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; + } + } +#else separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; +#endif nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ for ( bin = 0; bin < nBins; bin++ ) @@ -1144,6 +1267,50 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( float gainFactor; int16_t aziDeg = 0; int16_t eleDeg = 0; +#ifdef MASA_AND_OBJECTS + uint8_t instantChange = 0; + + gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); + for ( chB = 0; chB < nchanSeparateChannels; chB++ ) + { + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism[chB]; + } + else + { + aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism; + eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; + instantChange = 1; + } + } + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + h->processMtxRePrev[chA][chB + 2][bin] = h->processMtxRe[chA][chB + 2][bin]; + h->processMtxImPrev[chA][chB + 2][bin] = h->processMtxIm[chA][chB + 2][bin]; + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + h->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; + h->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; + h->processMtxRe[1][chB + 2][bin] = rRealp * gainFactor; + h->processMtxIm[1][chB + 2][bin] = rImagp * gainFactor; + + if ( instantChange ) + { + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + h->processMtxRePrev[chA][chB + 2][bin] = h->processMtxRe[chA][chB + 2][bin]; + h->processMtxImPrev[chA][chB + 2][bin] = h->processMtxIm[chA][chB + 2][bin]; + } + } + } +#else gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -1158,6 +1325,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( h->processMtxIm[0][2][bin] = lImagp * gainFactor; h->processMtxRe[1][2][bin] = rRealp * gainFactor; h->processMtxIm[1][2][bin] = rImagp * gainFactor; +#endif } } @@ -1814,3 +1982,219 @@ static void hrtfShGetHrtf( return; } + +#ifdef MASA_AND_OBJECTS +void preProcessStereoTransportsForMovedObjects( + Decoder_Struct *st_ivas, + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + uint8_t nBins, + uint8_t firstSubframe, + uint8_t nSubframes ) +{ + int16_t subframe, bin, ch, inCh, outCh, ismDirIndex, slot; + DIRAC_DEC_HANDLE hDirAC; + MASA_ISM_DATA_HANDLE hMasaIsmData; + uint8_t enableCentering; + + hDirAC = st_ivas->hDirAC; + hMasaIsmData = st_ivas->hMasaIsmData; + + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) + { + enableCentering = 0; + } + else + { + enableCentering = 1; + } + + /* Bypass processing until first object is moved */ + if ( hMasaIsmData->objectsMoved == 0 ) + { + for ( ismDirIndex = 0; ismDirIndex < hDirAC->numIsmDirections; ismDirIndex++ ) + { + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) + { + hMasaIsmData->objectsMoved = 1; + } + } + if ( hMasaIsmData->objectsMoved == 0 ) + { + /* No objects have moved so far */ + return; + } + } + + /* Perform object-movement based processing */ + for ( subframe = firstSubframe; subframe < ( firstSubframe + nSubframes ); subframe++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + float ismPreprocMtxNew[2][2]; + float ismPreprocMtxIncrement[2][2]; + float eneMove[2]; + float enePreserve[2]; + float ismRatioAcc; + float subframeEne; + float normEnes[2]; + float remainderNormEne; + + set_zero( ismPreprocMtxNew[0], 2 ); + set_zero( ismPreprocMtxNew[1], 2 ); + set_zero( ismPreprocMtxIncrement[0], 2 ); + set_zero( ismPreprocMtxIncrement[1], 2 ); + set_zero( eneMove, 2 ); + set_zero( enePreserve, 2 ); + ismRatioAcc = 0.0f; + subframeEne = 0.0f; + set_zero( normEnes, 2 ); + + /* Determine transport normalized energies and subframe energy */ + for ( slot = subframe * hDirAC->subframe_nbslots; slot < (int16_t) ( ( subframe + 1 ) * hDirAC->subframe_nbslots ); slot++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + normEnes[ch] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; + normEnes[ch] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; + } + } + subframeEne = normEnes[0] + normEnes[1]; + normEnes[0] /= fmaxf( 1e-12f, subframeEne ); + normEnes[1] /= fmaxf( 1e-12f, subframeEne ); + + /* For each ismDir, formulate a mix-matrix that moves object audio signals between + * left and right channels when needed. Make a combined matrix by a ratio-weighted sum */ + for ( ismDirIndex = 0; ismDirIndex < hDirAC->numIsmDirections; ismDirIndex++ ) + { + float panGainsOut[2]; + float panGainsIn[2]; + float ratio; + float panEnesOut[2]; + float panEnesIn[2]; + float centeringFactor; + + ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][subframe][bin]; + ismRatioAcc += ratio; + + /* Get input and output panning gains */ + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex], + hMasaIsmData->elevation_ism[ismDirIndex], + panGainsIn ); + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) + { + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], + hMasaIsmData->elevation_ism_edited[ismDirIndex], + panGainsOut ); + } + else + { + /* When not edited, input and output pan gains are the same */ + for ( ch = 0; ch < 2; ch++ ) + { + panGainsOut[ch] = panGainsIn[ch]; + } + } + + /* Determine pan enes */ + for ( ch = 0; ch < 2; ch++ ) + { + panEnesOut[ch] = panGainsOut[ch] * panGainsOut[ch]; + panEnesIn[ch] = panGainsIn[ch] * panGainsIn[ch]; + } + + if ( enableCentering ) + { + centeringFactor = fmaxf( 0.0f, 2.0f * fabsf( panEnesIn[0] - panEnesOut[0] ) - 1.0f ); + for ( ch = 0; ch < 2; ch++ ) + { + panEnesOut[ch] *= ( 1.0f - centeringFactor ); + panEnesOut[ch] += 0.5f * centeringFactor; + } + } + + for ( ch = 0; ch < 2; ch++ ) + { + float eneMoveThis; + float enePreserveThis; + eneMoveThis = fmaxf( 0.0f, panEnesIn[ch] - panEnesOut[ch] ); + enePreserveThis = panEnesIn[ch] - eneMoveThis; + + eneMove[ch] += ratio * eneMoveThis; + enePreserve[ch] += ratio * enePreserveThis; + + /* Subtract object parts from normEnes */ + normEnes[ch] -= panEnesIn[ch] * ratio; + } + } + /* Any remaining (non-object) energy is set to be preserved at both channels */ + remainderNormEne = fmaxf( 0.0f, ( 1.0f - ismRatioAcc ) - normEnes[0] - normEnes[1] ); + for ( ch = 0; ch < 2; ch++ ) + { + enePreserve[ch] += fmaxf( 0.0f, normEnes[ch] + remainderNormEne / 2.0f ); + } + + /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix */ + for ( ch = 0; ch < 2; ch++ ) + { + float normVal; + hMasaIsmData->eneMoveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->eneMoveIIR[ch][bin] += eneMove[ch] * subframeEne; + hMasaIsmData->enePreserveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->enePreserveIIR[ch][bin] += enePreserve[ch] * subframeEne; + normVal = fmaxf( EPSILON, hMasaIsmData->eneMoveIIR[ch][bin] + hMasaIsmData->enePreserveIIR[ch][bin] ); + ismPreprocMtxNew[ch][ch] = sqrtf( hMasaIsmData->enePreserveIIR[ch][bin] / normVal ); + ismPreprocMtxNew[1 - ch][ch] = sqrtf( hMasaIsmData->eneMoveIIR[ch][bin] / normVal ); + } + + + /* Get increment value for temporal interpolation */ + for ( inCh = 0; inCh < 2; inCh++ ) + { + for ( outCh = 0; outCh < 2; outCh++ ) + { + ismPreprocMtxIncrement[outCh][inCh] = ( ismPreprocMtxNew[outCh][inCh] - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] ) / (float) hDirAC->subframe_nbslots; + } + } + + /* Mix signals */ + for ( slot = subframe * hDirAC->subframe_nbslots; slot < (int16_t) ( ( subframe + 1 ) * hDirAC->subframe_nbslots ); slot++ ) + { + float eqVal; + float outSlotRe[2]; + float outSlotIm[2]; + + set_zero( outSlotRe, 2 ); + set_zero( outSlotIm, 2 ); + + for ( outCh = 0; outCh < 2; outCh++ ) + { + for ( inCh = 0; inCh < 2; inCh++ ) + { + hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] += ismPreprocMtxIncrement[outCh][inCh]; + outSlotRe[outCh] += inRe[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; + outSlotIm[outCh] += inIm[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; + } + } + + /* IIR average the energy measures and determine and apply energy-preserving equalizer */ + hMasaIsmData->preprocEneTarget[bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->preprocEneRealized[bin] *= STEREO_PREPROCESS_IIR_FACTOR; + for ( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->preprocEneTarget[bin] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; + hMasaIsmData->preprocEneTarget[bin] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; + hMasaIsmData->preprocEneRealized[bin] += outSlotRe[ch] * outSlotRe[ch]; + hMasaIsmData->preprocEneRealized[bin] += outSlotIm[ch] * outSlotIm[ch]; + } + eqVal = fminf( 4.0f, sqrtf( hMasaIsmData->preprocEneTarget[bin] / fmaxf( 1e-12f, hMasaIsmData->preprocEneRealized[bin] ) ) ); + for ( ch = 0; ch < 2; ch++ ) + { + inRe[ch][slot][bin] = outSlotRe[ch] * eqVal; + inIm[ch][slot][bin] = outSlotIm[ch] * eqVal; + } + } + } + } +} +#endif diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 79c04f824b..91d6435c78 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -499,6 +499,9 @@ void ivas_dirac_dec_output_synthesis_process_slot( ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, +#ifdef MASA_AND_OBJECTS + NULL, +#endif index_slot, index_slot / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, 2, @@ -1427,8 +1430,11 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - const int16_t direction_idx, /* i : index for direction (azi and ele), can slot index (>2TCs) or subrame index (<=2TCs) */ - const int16_t subframe_idx, /* i : subframe index */ +#ifdef MASA_AND_OBJECTS + MASA_ISM_DATA_HANDLE hMasaIsm, /* i : MASA_ISM data structure */ +#endif + const int16_t direction_idx, /* i : index for direction (azi and ele), can slot index (>2TCs) or subrame index (<=2TCs) */ + const int16_t subframe_idx, /* i : subframe index */ const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat /* i : rotation matrix */ @@ -1463,7 +1469,11 @@ void ivas_dirac_dec_compute_directional_responses( num_channels_dir = hDirAC->num_outputs_dir; azimuth = hDirAC->azimuth[hDirAC->dirac_read_idx]; elevation = hDirAC->elevation[hDirAC->dirac_read_idx]; +#ifdef MASA_AND_OBJECTS + if ( hDirAC->numParametricDirections == 2 ) +#else if ( hDirAC->numSimultaneousDirections == 2 ) +#endif { azimuth2 = hDirAC->azimuth2[direction_idx]; elevation2 = hDirAC->elevation2[direction_idx]; @@ -1521,7 +1531,11 @@ void ivas_dirac_dec_compute_directional_responses( spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); /* Synthesize the second direction and combine the gains */ +#ifdef MASA_AND_OBJECTS + if ( hDirAC->numParametricDirections == 2 ) +#else if ( hDirAC->numSimultaneousDirections == 2 ) +#endif { spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); @@ -1536,6 +1550,56 @@ void ivas_dirac_dec_compute_directional_responses( } } +#ifdef MASA_AND_OBJECTS + if ( hDirAC->numIsmDirections > 0 ) + { + int16_t dir; + float direct_response_temp[MAX_OUTPUT_CHANNELS]; + float direct_response_ism[MAX_OUTPUT_CHANNELS]; + float masaDirect; + float ismDirect; + + set_zero( direct_response_ism, num_channels_dir ); + + for ( dir = 0; dir < hDirAC->numIsmDirections; dir++ ) + { + if ( hMasaIsm->ism_is_edited[dir] ) + { + ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); + } + else + { + ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); + } + + for ( l = 0; l < num_channels_dir; l++ ) + { + direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; + } + } + + masaDirect = hDirAC->energy_ratio1[subframe_idx][k] + EPSILON; + if ( hDirAC->numParametricDirections == 2 ) + { + masaDirect += hDirAC->energy_ratio2[subframe_idx][k]; + } + ismDirect = hMasaIsm->energy_ratio_ism[0][subframe_idx][k]; + for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) + { + ismDirect += hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; + } + + totalDirect = masaDirect + ismDirect; + directRatio[0] = masaDirect / totalDirect; + directRatio[1] = ismDirect / totalDirect; + for ( l = 0; l < num_channels_dir; l++ ) + { + direct_response_hoa[l] *= directRatio[0]; + direct_response_hoa[l] += directRatio[1] * direct_response_ism[l]; + } + } +#endif + /* Synthesize surrounding coherence */ if ( surCohRatio != NULL && surCohRatio[k] > 0.f ) { @@ -1580,7 +1644,12 @@ void ivas_dirac_dec_compute_directional_responses( normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ +#ifdef MASA_AND_OBJECTS + if ( hDirAC->numParametricDirections == 2 ) +#else if ( hDirAC->numSimultaneousDirections == 2 ) +#endif + { spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); @@ -1597,7 +1666,57 @@ void ivas_dirac_dec_compute_directional_responses( } normalizePanningGains( direct_response_ls, num_channels_dir ); } +#ifdef MASA_AND_OBJECTS + if ( hDirAC->numIsmDirections > 0 ) + { + int16_t dir; + float direct_response_temp[MAX_OUTPUT_CHANNELS]; + float direct_response_ism[MAX_OUTPUT_CHANNELS]; + float masaDirect; + float ismDirect; + set_zero( direct_response_ism, num_channels_dir ); + + for ( dir = 0; dir < hDirAC->numIsmDirections; dir++ ) + { + if ( hMasaIsm->ism_is_edited[dir] ) + { + vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir] ); + } + else + { + vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir] ); + } + + for ( l = 0; l < num_channels_dir; l++ ) + { + direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; + } + } + normalizePanningGains( direct_response_ism, num_channels_dir ); + + masaDirect = hDirAC->energy_ratio1[subframe_idx][k] + EPSILON; + if ( hDirAC->numParametricDirections == 2 ) + { + masaDirect += hDirAC->energy_ratio2[subframe_idx][k]; + } + ismDirect = hMasaIsm->energy_ratio_ism[0][subframe_idx][k]; + for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) + { + ismDirect += hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; + } + + totalDirect = masaDirect + ismDirect; + directRatio[0] = masaDirect / totalDirect; + directRatio[1] = ismDirect / totalDirect; + for ( l = 0; l < num_channels_dir; l++ ) + { + direct_response_ls[l] *= directRatio[0]; + direct_response_ls[l] += directRatio[1] * direct_response_ism[l]; + } + normalizePanningGains( direct_response_ls, num_channels_dir ); + } +#endif /* Synthesize surrounding coherence */ if ( surCohRatio != NULL && surCohRatio[k] > 0.f ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e51b46779c..7da5528fb0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -69,6 +69,9 @@ ivas_error ivas_dec_setup( Decoder_State *st; int32_t ivas_total_brate; ivas_error error; +#ifdef MASA_AND_OBJECTS + int32_t cpe_brate; +#endif error = IVAS_ERR_OK; num_bits_read = 0; @@ -183,6 +186,33 @@ ivas_error ivas_dec_setup( } } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + st_ivas->nchan_transport = 2; + /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata*/ + st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 3] + 1; + + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); + + if ( st_ivas->ini_frame > 0 ) + { + /* reconfigure in case a change of operation mode is detected */ + if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) + { + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + } +#endif else if ( st_ivas->ivas_format == MC_FORMAT ) { /* read MC configuration */ @@ -350,15 +380,24 @@ static ivas_error ivas_read_format( case 3: if ( st_ivas->bit_stream[*num_bits_read] ) { + ( *num_bits_read )++; st_ivas->ivas_format = MASA_FORMAT; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->bit_stream[*num_bits_read] ) + { + st_ivas->ivas_format = MASA_ISM_FORMAT; + } + ( *num_bits_read )++; +#endif } else { + ( *num_bits_read )++; st_ivas->ivas_format = SBA_FORMAT; st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); } - ( *num_bits_read )++; + break; } } @@ -615,7 +654,9 @@ ivas_error ivas_init_decoder( AUDIO_CONFIG output_config; DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t sce_brate; +#endif error = IVAS_ERR_OK; output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -931,6 +972,77 @@ ivas_error ivas_init_decoder( } } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); + + k = 0; + sce_brate = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + /* one separated object */ + st_ivas->nSCE = 1; + + sce_brate = sep_object_brate[k - 2][0]; + create_sce_dec( st_ivas, 0, sce_brate ); + + reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + int32_t temp_brate[MAX_SCE]; + st_ivas->nSCE = st_ivas->nchan_ism; /* number of objects */ + + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + + temp_brate[sce_id] = sep_object_brate[k - 2][st_ivas->nSCE - 1]; + sce_brate += temp_brate[sce_id]; + + if ( ( error = create_sce_dec( st_ivas, sce_id, temp_brate[sce_id] ) ) != IVAS_ERR_OK ) + { + return error; + } + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + + if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nSCE, temp_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + ivas_masa_dec_open( st_ivas ); + ivas_masa_ism_data_open( st_ivas ); + + if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) + { + ivas_dirac_dec_open( st_ivas ); + } + + st_ivas->nCPE = 1; + create_cpe_dec( st_ivas, 0, ( ( ivas_total_brate - sce_brate ) / st_ivas->nchan_transport ) * CPE_CHANNELS ); + + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[0]->hCoreCoder[n] ); + } + + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif else if ( st_ivas->ivas_format == MC_FORMAT ) { if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -1492,6 +1604,9 @@ void ivas_initialize_handles_dec( st_ivas->hCrend = NULL; st_ivas->hHrtf = NULL; st_ivas->hoa_dec_mtx = NULL; +#ifdef MASA_AND_OBJECTS + st_ivas->hMasaIsmData = NULL; +#endif st_ivas->hHeadTrackData = NULL; st_ivas->hHrtfTD = NULL; @@ -1670,7 +1785,23 @@ void ivas_destroy_dec( count_free( st_ivas->hMonoDmxRenderer ); st_ivas->hMonoDmxRenderer = NULL; } - +#ifdef MASA_AND_OBJECTS + /* MASA ISM structure */ + if ( st_ivas->hMasaIsmData != NULL ) + { + if ( st_ivas->hMasaIsmData->delayBuffer != NULL ) + { + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + { + count_free( st_ivas->hMasaIsmData->delayBuffer[i] ); + } + count_free( st_ivas->hMasaIsmData->delayBuffer ); + st_ivas->hMasaIsmData->delayBuffer = NULL; + } + count_free( st_ivas->hMasaIsmData ); + st_ivas->hMasaIsmData = NULL; + } +#endif /* Head track data handle */ if ( st_ivas->hHeadTrackData != NULL ) { @@ -1736,6 +1867,43 @@ void ivas_init_dec_get_num_cldfb_instances( case RENDERER_BINAURAL_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC_ROOM: case RENDERER_STEREO_PARAMETRIC: +#ifdef MASA_AND_OBJECTS + if ( st_ivas->nchan_transport == 1 ) + { + *numCldfbAnalyses = st_ivas->nchan_transport + 1; + } + + if ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->hOutSetup.separateChannelEnabled ) + { + *numCldfbAnalyses = st_ivas->nchan_transport + 1; + } + + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + *numCldfbAnalyses += st_ivas->nchan_ism; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + *numCldfbAnalyses = st_ivas->nchan_transport + 1; + } + } + + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + *numCldfbAnalyses += 2; + } + break; + case RENDERER_MONO_DOWNMIX: + if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + /* CLDFB not used in rendering */ + *numCldfbAnalyses = 0; + *numCldfbSyntheses = 0; + } + break; +#else if ( st_ivas->nchan_transport == 1 ) { *numCldfbAnalyses = st_ivas->nchan_transport + 1; @@ -1759,6 +1927,7 @@ void ivas_init_dec_get_num_cldfb_instances( *numCldfbSyntheses = 0; } break; +#endif case RENDERER_DIRAC: if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 6b9f8ec8ba..f2c67c7301 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -126,13 +126,25 @@ ivas_error ivas_ism_metadata_dec( *----------------------------------------------------------------*/ /* read number of objects */ - num_obj = 1; - while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) +#ifdef MASA_AND_OBJECTS + if ( ism_mode != ISM_MASA_MODE_DISC ) { - ( num_obj )++; +#endif + num_obj = 1; + while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) + { + ( num_obj )++; + } + ism_mode = ivas_ism_mode_select( num_obj, ism_total_brate ); +#ifdef MASA_AND_OBJECTS } + else + { + num_obj = *nchan_transport; + } + +#endif - ism_mode = ivas_ism_mode_select( num_obj, ism_total_brate ); if ( ism_mode == ISM_MODE_PARAM ) { @@ -202,7 +214,11 @@ ivas_error ivas_ism_metadata_dec( for ( ch = 0; ch < num_obj; ch++ ) { hIsmMetaData = hIsmMeta[ch]; +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { nb_bits_start = st0->next_bit_pos; } @@ -362,7 +378,11 @@ ivas_error ivas_ism_metadata_dec( } /* save number of metadata bits read */ +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { nb_bits_metadata[ch] = st0->next_bit_pos - nb_bits_start; } @@ -455,13 +475,29 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { - ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); +#ifdef MASA_AND_OBJECTS + int16_t masa_ism_flag = 0; + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) + { + masa_ism_flag = 1; + } +#endif + + ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata +#ifdef MASA_AND_OBJECTS + , + masa_ism_flag +#endif + ); for ( ch = 0; ch < *nchan_transport; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; - +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) @@ -534,7 +570,12 @@ ivas_error create_ism_metadata_dec( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); + ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL +#ifdef MASA_AND_OBJECTS + , + 0 +#endif + ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 8ebf27afb5..61d8f9ebf0 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1022,7 +1022,11 @@ static ivas_error ivas_ism_bitrate_switching( error = IVAS_ERR_OK; +#ifdef MASA_AND_OBJECTS + ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ); +#else ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); +#endif st_ivas->nSCE = st_ivas->nchan_transport; ivas_corecoder_dec_reconfig( st_ivas, nchan_transport_old, 0, nchan_transport_old, 0 ); diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index f27d49b111..b7ec828d2f 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -222,3 +222,168 @@ void ivas_ism_render( } return; } + +#ifdef MASA_AND_OBJECTS +/*-------------------------------------------------------------------------* + * ivas_masa_ism_separate_object_renderer_open() + * + * Open structures, reserve memory, and init values. + *-------------------------------------------------------------------------*/ + +ivas_error ivas_masa_ism_separate_object_renderer_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t interpolator_length; + int16_t i; + + if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) count_malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM renderer \n" ) ); + } + + + for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + { + set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); + } + + interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / 50 ); + for ( i = 0; i < interpolator_length; i++ ) + { + st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length ); + } + + st_ivas->hMasaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES ); + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + st_ivas->hMasaIsmData->delayBuffer_nchan = 1; + } + else + { + st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; + } + + if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) count_malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + { + if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) count_malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + set_zero( st_ivas->hMasaIsmData->delayBuffer[i], st_ivas->hMasaIsmData->delayBuffer_size ); + } + + return IVAS_ERR_OK; +} + + +/*-------------------------------------------------------------------------* + * ivas_masa_ism_separate_object_render() + * + * Rendering separated objects and mixing them to the parametrically rendered signals + *-------------------------------------------------------------------------*/ + +void ivas_masa_ism_separate_object_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float input_f[][L_FRAME48k], /* i : separated object signal */ + float output_f[][L_FRAME48k], /* i/o: output signals */ + const int16_t output_frame /* i : output frame length per channel */ +) +{ + VBAP_HANDLE hVBAPdata; + AUDIO_CONFIG output_config; + int16_t nchan_out_woLFE; + ISM_RENDERER_HANDLE hRendererData; + int16_t j, k, j2; + int16_t obj; + float gains[MAX_OUTPUT_CHANNELS]; + float g1, g2; + int16_t lfe_index; + int16_t azimuth, elevation; + int16_t num_objects; + uint8_t single_separated; + + hVBAPdata = st_ivas->hVBAPdata; + output_config = st_ivas->hDecoderConfig->output_config; + nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + hRendererData = st_ivas->hIsmRendererData; + lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + single_separated = 1; + num_objects = 1; + } + else + { + single_separated = 0; + num_objects = st_ivas->nchan_ism; + } + + for ( obj = 0; obj < num_objects; obj++ ) + { + delay_signal( input_f[obj], output_frame, st_ivas->hMasaIsmData->delayBuffer[obj], st_ivas->hMasaIsmData->delayBuffer_size ); /* Delay the signal to match CLDFB delay */ + + if ( single_separated ) + { + azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism; + elevation = st_ivas->hMasaIsmData->elevation_separated_ism; + } + else + { + azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj]; + elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; + } + + if ( output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_5_1_4 ) + { + /* If no elevation support in output format, then rendering should be done with zero elevation */ + elevation = 0; + } + else if ( output_config == AUDIO_CONFIG_7_1_4 || output_config == AUDIO_CONFIG_5_1_4 ) + { + /* For no negative elevations, it's better to map them to zero */ + elevation = elevation < 0 ? 0 : elevation; + } + + if ( hVBAPdata != NULL ) + { + vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); + } + else + { + ivas_dirac_dec_get_response( azimuth, elevation, gains, st_ivas->hDirAC->hOutSetup.ambisonics_order ); + } + + for ( j = 0; j < nchan_out_woLFE; j++ ) + { + if ( st_ivas->hDirAC->hOutSetup.num_lfe > 0 ) + { + j2 = j + ( j >= lfe_index ); + } + else + { + j2 = j; + } + + if ( fabsf( gains[j] ) > 0.0f || fabsf( hRendererData->prev_gains[obj][j] ) > 0.0f ) + { + for ( k = 0; k < output_frame; k++ ) + { + g1 = hRendererData->interpolator[k]; + g2 = 1.0f - g1; + output_f[j2][k] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k]; + } + } + hRendererData->prev_gains[obj][j] = gains[j]; + } + } + + return; +} +#endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 3df3784405..dcb70abf57 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -70,6 +70,10 @@ static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hM static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); +#ifdef MASA_AND_OBJECTS +static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos ); +static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, int16_t no_ism, int16_t K ); +#endif /*-----------------------------------------------------------------------* * ivas_masa_decode() @@ -91,13 +95,20 @@ ivas_error ivas_masa_decode( IVAS_FORMAT ivas_format; int16_t low_bitrate_mode, tmp_elem_mode; ivas_error error; +#ifdef MASA_AND_OBJECTS + int16_t obj; +#endif error = IVAS_ERR_OK; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; low_bitrate_mode = -1; /* This means that LBR mode is not used. */ +#ifdef MASA_AND_OBJECTS + if ( st_ivas->hOutSetup.separateChannelEnabled || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->hOutSetup.separateChannelEnabled ) +#endif { masa_brate = st_ivas->hCPE[0]->element_brate; } @@ -131,6 +142,24 @@ ivas_error ivas_masa_decode( /* the number of MASA transport channels was read in ivas_dec_setup() */ st->next_bit_pos -= MASA_TRANSP_BITS; *nb_bits_read += MASA_TRANSP_BITS; +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) + { + /* the number of objects was read */ + st->next_bit_pos -= NO_BITS_MASA_ISM_NO_OBJ; + *nb_bits_read += NO_BITS_MASA_ISM_NO_OBJ; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + /* read index of separated object */ + /* no_ism should be > 1*/ + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + } + } +#endif /* Placeholder for descriptive metadata content */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; byteBuffer += st->bit_stream[( st->next_bit_pos )--]; @@ -191,8 +220,39 @@ ivas_error ivas_masa_decode( /* Remove already read bits from the bit budget */ hQMetaData->metadata_max_bits -= *nb_bits_read; + +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos ); + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) + { + if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) + { + st_ivas->hMasaIsmData->azimuth_separated_ism = st_ivas->hMasaIsmData->azimuth_ism[obj]; + st_ivas->hMasaIsmData->elevation_separated_ism = st_ivas->hMasaIsmData->elevation_ism[obj]; + } + } + } + } +#endif + + *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos ); +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Modify spatial metadata based on the MASA-to-total energy ratios */ + modify_masa_energy_ratios( hQMetaData ); + } +#endif /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ if ( hQMetaData->ec_flag == 2 ) { @@ -227,7 +287,12 @@ ivas_error ivas_masa_decode( } ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, - hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE +#ifdef MASA_AND_OBJECTS + , + st_ivas->ivas_format, st_ivas->ism_mode, 0 +#endif + ); hQMetaData->metadata_max_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; @@ -279,17 +344,74 @@ ivas_error ivas_masa_decode( ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, SBA_MODE_NONE, 0 ); } - st->next_bit_pos = next_bit_pos_orig; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( hQMetaData->q_direction == NULL ) + { + if ( ( error = ivas_masa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + if ( st_ivas->hDirAC != NULL ) + { + int16_t i; + int16_t b; + int16_t block; - if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) + for ( i = 0; i < st_ivas->hDirAC->numIsmDirections; i++ ) /* Todo Nokia: Probably there is a better place for this eventually */ + { + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + { + st_ivas->hDirAC->diffuseness_vector[block][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b]; + } + } + } + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + { + st_ivas->hDirAC->diffuseness_vector[block][b] = max( 0.0f, st_ivas->hDirAC->diffuseness_vector[block][b] ); + } + } + } + } +#endif + st->next_bit_pos = next_bit_pos_orig; +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT ) { - st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ivas_total_brate < MASA_STEREO_MIN_BITRATE ? 1 : 0; + int32_t cpe_brate; + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); - if ( ivas_total_brate <= IVAS_SID_5k2 ) + if ( st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) { - st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = 0; + st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = cpe_brate < MASA_STEREO_MIN_BITRATE ? 1 : 0; + + if ( ivas_total_brate <= IVAS_SID_5k2 ) + { + st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = 0; + } } } + else + { +#endif + if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) + { + st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ivas_total_brate < MASA_STEREO_MIN_BITRATE ? 1 : 0; + + if ( ivas_total_brate <= IVAS_SID_5k2 ) + { + st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = 0; + } + } +#ifdef MASA_AND_OBJECTS + } +#endif if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 ) { @@ -321,13 +443,30 @@ ivas_error ivas_masa_dec_open( ) { MASA_DECODER_HANDLE hMasa; - +#ifdef MASA_AND_OBJECTS + int16_t i; + int32_t sce_brate; +#endif if ( ( hMasa = (MASA_DECODER_HANDLE) count_malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } - - ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); +#ifdef MASA_AND_OBJECTS + sce_brate = 0; + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + for ( i = 0; i < st_ivas->nSCE; i++ ) + { + sce_brate += st_ivas->hSCE[i]->element_brate; + } + } +#endif + ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE +#ifdef MASA_AND_OBJECTS + , + st_ivas->ivas_format, st_ivas->ism_mode, sce_brate +#endif + ); mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); @@ -359,7 +498,46 @@ ivas_error ivas_masa_dec_open( return IVAS_ERR_OK; } +#ifdef MASA_AND_OBJECTS +/*-------------------------------------------------------------------* + * ivas_masa_ism_data_open() + * + * + *-------------------------------------------------------------------*/ + +void ivas_masa_ism_data_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + MASA_ISM_DATA_HANDLE hMasaIsmData; + int16_t bin; + int16_t ch; + if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) count_malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) + { + fprintf( stderr, "Can not allocate memory for MASA_ISM data\n" ); + exit( -1 ); + } + + for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->ismPreprocMatrix[ch][ch][bin] = 1.0f; + hMasaIsmData->ismPreprocMatrix[1 - ch][ch][bin] = 0.0f; + hMasaIsmData->eneMoveIIR[ch][bin] = 0.0f; + hMasaIsmData->enePreserveIIR[ch][bin] = 0.0f; + } + hMasaIsmData->preprocEneTarget[bin] = 0.0f; + hMasaIsmData->preprocEneRealized[bin] = 0.0f; + } + hMasaIsmData->objectsMoved = 0; + hMasaIsmData->delayBuffer = NULL; + st_ivas->hMasaIsmData = hMasaIsmData; + + return; +} +#endif /*-----------------------------------------------------------------------* * ivas_masa_dec_close() * @@ -423,14 +601,40 @@ static ivas_error ivas_masa_dec_config( int16_t i; MASA_DECODER_HANDLE hMasa; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t ivas_total_brate; + int32_t sce_brate; +#endif error = IVAS_ERR_OK; hMasa = st_ivas->hMasa; - ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); +#ifdef MASA_AND_OBJECTS + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + sce_brate = 0; + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + for ( i = 0; i < st_ivas->nSCE; i++ ) + { + sce_brate += st_ivas->hSCE[i]->element_brate; + } + } + + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, sce_brate ); + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); + } + else + { + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); + } +#else + ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); +#endif st_ivas->hQMetaData->metadata_max_bits = hMasa->config.max_metadata_bits; st_ivas->hQMetaData->bandMap = hMasa->data.band_mapping; st_ivas->hQMetaData->nchan_transport = st_ivas->nchan_transport; @@ -1024,6 +1228,9 @@ ivas_error ivas_masa_dec_reconfigure( Decoder_State **sts; int32_t ivas_total_brate, last_ivas_total_brate; ivas_error error; +#ifdef MASA_AND_OBJECTS + int32_t sce_brate; +#endif error = IVAS_ERR_OK; @@ -1059,7 +1266,7 @@ ivas_error ivas_masa_dec_reconfigure( sts = st_ivas->hCPE[cpe_id]->hCoreCoder; sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - + /* Todo: Nokia make for MASA_ISM*/ if ( ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate >= MASA_STEREO_MIN_BITRATE ) || ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == FRAME_NO_DATA ) ) { @@ -1086,8 +1293,22 @@ ivas_error ivas_masa_dec_reconfigure( } } } - - ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp ); +#ifdef MASA_AND_OBJECTS + sce_brate = 0; + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + for ( n = 0; n < st_ivas->nSCE; n++ ) + { + sce_brate += st_ivas->hSCE[n]->element_brate; + } + } +#endif + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp +#ifdef MASA_AND_OBJECTS + , + st_ivas->ivas_format, st_ivas->ism_mode, sce_brate +#endif + ); return error; } @@ -1357,3 +1578,407 @@ static void compute_foa_cov_matrix( return; } + +#ifdef MASA_AND_OBJECTS + +static void decode_index_slice( + int16_t index, + int16_t *ratio_idx_ism, + int16_t no_ism, + int16_t K ) +{ + int16_t i, j, sum, elem; + int16_t base[MAX_NUM_OBJECTS]; + + switch ( no_ism ) + { + case 2: + ratio_idx_ism[0] = index; + ratio_idx_ism[1] = K - ratio_idx_ism[0]; + break; + case 3: + case 4: + { + j = 0; + while ( index >= 0 ) + { + if ( valid( j, K, no_ism - 1 ) ) + { + index--; + } + j++; + } + j--; + base[0] = 1; + for ( i = 1; i < no_ism - 1; i++ ) + { + base[i] = base[i - 1] * 10; + } + sum = 0; + for ( i = no_ism - 2; i >= 0; i-- ) + { + elem = j / base[i]; + ratio_idx_ism[no_ism - i - 2] = elem; + sum += elem; + j -= elem * base[i]; + } + ratio_idx_ism[no_ism - 1] = K - sum; + } + + default: + break; + } +} + +static void read_ism_ratio_index( + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t no_ism, + int16_t numCodingBands, + int16_t sf, + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + uint16_t *bit_stream, + int16_t *next_bit_pos, + float *masa_to_total_energy_ratio ) +{ + int16_t b, i; + int16_t index; + int16_t GR_order, differential_subframe; + int16_t buf; + int16_t no_levels_ratio_ism; + no_levels_ratio_ism = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); + if ( sf == 0 ) + { + switch ( no_ism ) + { + case 2: + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + index = 0; + for ( i = 0; i < 3; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + + decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + break; + case 3: + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + /* read first 5 bits */ + index = 0; + for ( i = 0; i < 5; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + if ( index == 31 ) + { + index = 0; + for ( i = 0; i < 3; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + index += 31; + } + + decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + break; + case 4: + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + /* read 7 bits */ + index = 0; + for ( i = 0; i < 7; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + + decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + break; + default: + assert( ( no_ism >= 2 && no_ism <= 4 ) && "Wrong number of objects for MASA_ISM." ); + break; + } + } + else + { + /* read prediciton type */ + differential_subframe = bit_stream[( *next_bit_pos )--]; + /* read GR order */ + GR_order = bit_stream[( *next_bit_pos )--]; + for ( b = 0; b < numCodingBands; b++ ) + { + for ( i = 0; i < no_ism - 1; i++ ) + { + buf = ivas_qmetadata_DecodeExtendedGR( bit_stream, next_bit_pos, 100, GR_order ); + if ( ( buf % 2 ) == 0 ) + { + ratio_ism_idx[b][i] = -( buf >> 1 ); + } + else + { + ratio_ism_idx[b][i] = ( ( buf + 1 ) >> 1 ); + } + } + } + if ( differential_subframe ) + { + /* differential to previous subframe */ + for ( b = 0; b < numCodingBands; b++ ) + { + ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; + for ( i = 0; i < no_ism - 1; i++ ) + { + ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx_prev_sf[b][i]; + ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; + } + } + } + else + { + /* difference to previous subband */ + ratio_ism_idx[0][no_ism - 1] = no_levels_ratio_ism; + /* first subband - differential to previous subframe */ + for ( i = 0; i < no_ism - 1; i++ ) + { + ratio_ism_idx[0][i] = ratio_ism_idx[0][i] + ratio_ism_idx_prev_sf[0][i]; + ratio_ism_idx[0][no_ism - 1] -= ratio_ism_idx[0][i]; + } + /* rest of subbands differential to previous subband */ + for ( b = 1; b < numCodingBands; b++ ) + { + ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; + for ( i = 0; i < no_ism - 1; i++ ) + { + ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx[b - 1][i]; + ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; + } + } + } + } +} + +static void decode_ism_ratios( + uint16_t *bit_stream, + int16_t *next_bit_pos, + IVAS_QMETADATA_HANDLE hQMetaData, + float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t n_ism ) +{ + int16_t sf, band; + int16_t nbands, numSf; + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + + nbands = hQMetaData->q_direction->cfg.nbands; + numSf = hQMetaData->q_direction->cfg.nblocks; + for ( sf = 0; sf < numSf; sf++ ) + { + /* read ism ratio indexes */ + read_ism_ratio_index( ratio_ism_idx, n_ism, nbands, sf, ratio_ism_idx_prev_sf, bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio[sf] ); + + /* save previous subframe index values */ + if ( sf < numSf - 1 ) + { + /* Todo Nokia: can be moved to the read_ism_ratio ... function */ + for ( band = 0; band < nbands; band++ ) + { + mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], n_ism ); + } + } + + /* reconstructed values */ + for ( band = 0; band < nbands; band++ ) + { + reconstruct_ism_ratios( ratio_ism_idx[band], n_ism, 1.0f / (float) ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ), ratio_ism[sf][band] ); + } + } +} + +static int16_t ivas_decode_masaism_metadata( + IVAS_QMETADATA_HANDLE hQMetaData, + MASA_DECODER_HANDLE hMasa, + MASA_ISM_DATA_HANDLE hMasaIsmData, + const int16_t nchan_ism, + uint16_t *bit_stream, + int16_t *next_bit_pos ) +{ + int16_t sf, band, dir, nbands, nblocks, obj, i; + + float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + int16_t *band_mapping; + int16_t b; + float priority[MAX_NUM_OBJECTS]; + int16_t bits_ism[MAX_NUM_OBJECTS], index; + uint16_t idx_el, idx_az; + float azimuth, elevation; + int16_t nb_bits_read; + + nb_bits_read = *next_bit_pos; + nbands = hQMetaData->q_direction->cfg.nbands; + nblocks = hQMetaData->q_direction->cfg.nblocks; + + + /* Read MASA-to-total energy ratios */ + decode_masa_to_total( bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio, nbands ); + if ( nchan_ism > 1 ) + { + /* read ISM ratios */ + decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism ); + + /* calculate priority */ + set_f( priority, 0.0f, nchan_ism ); + for ( sf = 0; sf < nblocks; sf++ ) + { + for ( band = 0; band < nbands; band++ ) + { + for ( obj = 0; obj < nchan_ism; obj++ ) + { + priority[obj] = max( priority[obj], ( energy_ratio_ism[sf][band][obj] * hQMetaData->masa_to_total_energy_ratio[sf][band] ) ); + } + } + } + } + else + { + for ( sf = 0; sf < nblocks; sf++ ) + { + for ( band = 0; band < nbands; band++ ) + { + energy_ratio_ism[sf][band][0] = 1.0f; + } + } + priority[0] = 1; + } + + /* read ISM metadata */ + for ( obj = 0; obj < nchan_ism; obj++ ) + { + bits_ism[obj] = 11 - (int16_t) ( ( 1 - priority[obj] ) * 7 ); + } + + for ( obj = 0; obj < nchan_ism; obj++ ) + { + index = 0; + for ( i = 0; i < bits_ism[obj]; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); + hMasaIsmData->azimuth_ism[obj] = (int16_t) rint( azimuth ); + hMasaIsmData->elevation_ism[obj] = (int16_t) rint( elevation ); + } + + /* Modify ISM metadata based on the MASA-to-total energy ratios */ + for ( sf = 0; sf < nblocks; sf++ ) + { + for ( band = 0; band < nbands; band++ ) + { + for ( dir = 0; dir < nchan_ism; dir++ ) + { + energy_ratio_ism[sf][band][dir] *= ( 1.0f - hQMetaData->masa_to_total_energy_ratio[sf][band] ); + } + } + } + + /* Set data to struct in bins */ + band_mapping = hMasa->data.band_mapping; + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; ++sf ) + { + if ( nblocks == 1 ) + { + i = 0; + } + else + { + i = sf; + } + + for ( dir = 0; dir < nchan_ism; dir++ ) + { + hMasaIsmData->energy_ratio_ism[dir][sf][b] = energy_ratio_ism[i][band][dir]; + } + } + } + } + + return ( nb_bits_read - *next_bit_pos ); +} + +void ivas_masa_ism_set_edited_objects( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t dir; + MASA_ISM_DATA_HANDLE hMasaIsmData; + + hMasaIsmData = st_ivas->hMasaIsmData; + + /* Set positions of the edited objects */ + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + if ( st_ivas->editing_ism_enabled ) + { + hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism] = st_ivas->azimuth_edited; + hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism] = st_ivas->elevation_edited; + } + } + else + { + for ( dir = 0; dir < MAX_NUM_OBJECTS; dir++ ) + { + if ( dir == st_ivas->index_of_edited_ism && st_ivas->editing_ism_enabled ) + { + hMasaIsmData->ism_is_edited[dir] = 1; + hMasaIsmData->azimuth_ism_edited[dir] = st_ivas->azimuth_edited; + hMasaIsmData->elevation_ism_edited[dir] = st_ivas->elevation_edited; + } + else + { + hMasaIsmData->ism_is_edited[dir] = 0; + } + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ && st_ivas->editing_ism_enabled ) + { + if ( st_ivas->hMasaIsmData->idx_separated_ism == st_ivas->index_of_edited_ism ) + { + st_ivas->hMasaIsmData->azimuth_separated_ism = st_ivas->azimuth_edited; + st_ivas->hMasaIsmData->elevation_separated_ism = st_ivas->elevation_edited; + } + } + } +} + + +#endif diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 20b677075e..6edad11925 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -94,6 +94,23 @@ void ivas_mono_downmix_render_passive( MONO_DOWNMIX_RENDERER_HANDLE hDownmix; numInputChannels = st_ivas->nSCE; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) + { + numInputChannels = st_ivas->nchan_transport; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + numInputChannels = st_ivas->nchan_transport + 1; + } + else + { + numInputChannels = st_ivas->nchan_transport + st_ivas->nchan_ism; + } + } +#endif hDownmix = st_ivas->hMonoDmxRenderer; set_zero( proto_signal, output_frame ); diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 059ba752e7..b5b145a30f 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -55,7 +55,9 @@ static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size ); +#ifndef MASA_AND_OBJECTS static int16_t ivas_qmetadata_DecodeExtendedGR( uint16_t *bitstream, int16_t *index, const int16_t alph_size, const int16_t gr_param ); +#endif static int16_t ivas_qmetadata_ReorderElevationDecoded( const int16_t elev_dist, const int16_t elev_avg, const int16_t elev_alph ); @@ -91,6 +93,10 @@ static int16_t read_GR_min_removed_data( uint16_t *bitstream, int16_t *p_bit_pos static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t no_bands, int16_t *no_cv_vec, uint16_t *decoded_index, const int16_t no_symb ); +#ifdef MASA_AND_OBJECTS +static void read_stream_dct_coeffs_omasa( int16_t *q_idx, float *q_dct_data, int16_t len_stream, uint16_t *bit_stream, int16_t *index, int16_t first_line ); +#endif + /*-----------------------------------------------------------------------* * Global function definitions *-----------------------------------------------------------------------*/ @@ -557,6 +563,7 @@ int16_t ivas_qmetadata_dec_decode( bits_dir_target += bits_dir_raw; bits_dir_used += bits_dir; + #ifdef DEBUG_MODE_QMETADATA fprintf( pF, "frame %d: diff %d coh %d surcoh %d ", frame, bits_diff, bits_coherence, bits_sur_coherence ); fprintf( pF, "dir %d %d,%d,%d\n", ec_flag, start_index_0 - *index, total_bits_1dir, bits_dir_raw ); @@ -1573,12 +1580,16 @@ static uint16_t ivas_qmetadata_DecodeQuasiUniform( *------------------------------------------------------------------------*/ /* !r: Value decoded from the bitstream */ -static int16_t ivas_qmetadata_DecodeExtendedGR( - uint16_t *bitstream, /* i : pointer to the bitstream to read */ - int16_t *index, /* i/o: position in the bitstream to start reading (gets updated with reading) */ - const int16_t alph_size, /* i : size of the alphabet, used to calculate the number of bits needed */ - const int16_t gr_param /* i : GR parameter that indicates the limit for the most significant bits (msb) */ -) +#ifndef MASA_AND_OBJECTS +static +#endif + int16_t + ivas_qmetadata_DecodeExtendedGR( + uint16_t *bitstream, /* i : pointer to the bitstream to read */ + int16_t *index, /* i/o: position in the bitstream to start reading (gets updated with reading) */ + const int16_t alph_size, /* i : size of the alphabet, used to calculate the number of bits needed */ + const int16_t gr_param /* i : GR parameter that indicates the limit for the most significant bits (msb) */ + ) { int16_t i, msb_size; uint16_t value; @@ -3289,3 +3300,153 @@ static void decode_combined_index( return; } + +#ifdef MASA_AND_OBJECTS +static void read_stream_dct_coeffs_omasa( + int16_t *q_idx, + float *q_dct_data, + int16_t len_stream, + uint16_t *bit_stream, + int16_t *index, + int16_t first_line ) +{ + int16_t sign, nbits; + int16_t i, j, i_min; + int16_t last_non_null; + float step = 0.1f; + + nbits = 0; + sign = 1; + if ( first_line == 0 ) + { + /* read sign */ + sign = bit_stream[( *index )--]; + if ( sign == 0 ) + { + sign = -1; + } + nbits++; + } + + set_s( q_idx, 0, len_stream ); + /* read DCT 0 component */ + for ( i = 0; i < BITS_MASA2TOTTAL_DCT0; i++ ) + { + q_idx[0] = ( q_idx[0] << 1 ) + bit_stream[( *index )--]; + } + q_idx[0] *= sign; + + if ( q_idx[0] != 0 ) + { + /* read last non null position */ + last_non_null = 0; + j = (int16_t) ceilf( log2f( (float) ( len_stream ) ) ); + for ( i = 0; i < j; i++ ) + { + last_non_null = ( last_non_null << 1 ) + bit_stream[( *index )--]; + } + + nbits += j; + if ( last_non_null > 0 ) + { + /* read index of last index encoded with GR2 */ + i_min = 0; + j = (int16_t) ceilf( log2f( (float) ( last_non_null + 1 ) ) ); + for ( i = 0; i < j; i++ ) + { + i_min = ( i_min << 1 ) + bit_stream[( *index )--]; + } + + nbits += j; + + /* read GR data */ + for ( i = 1; i <= i_min; i++ ) + { + q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, 2 ); + } + for ( i = i_min + 1; i <= last_non_null; i++ ) + { + q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, 0 ); + } + } + } + /* deindex */ + q_dct_data[0] = q_idx[0] * step; + for ( i = 1; i < len_stream; i++ ) + { + if ( ( q_idx[i] % 2 ) == 0 ) + { + q_dct_data[i] = -( q_idx[i] >> 1 ) * step; + } + else + { + q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; + } + } + return; +} + +void decode_masa_to_total( + uint16_t *bit_stream, + int16_t *index, + float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + int16_t nbands ) +{ + int16_t i, j, k; + + int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + + float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], + dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + + + int16_t n_streams, len_stream; + /* Setup coding parameters */ + if ( nbands == 5 ) + { + n_streams = 1; + len_stream = nbands * 4; + } + else if ( nbands == 8 ) + { + n_streams = 4; + len_stream = 8; + } + else + { + n_streams = 4; + len_stream = nbands; + printf( "Unrecognized number of bands!" ); /* To do: finalize this */ + exit( -1 ); + } + set_s( q_idx, 0, nbands * MAX_PARAM_SPATIAL_SUBFRAMES ); + for ( i = 0; i < n_streams; i++ ) + { + read_stream_dct_coeffs_omasa( &q_idx[i * len_stream], &q_dct_data[i * len_stream], len_stream, bit_stream, index, i == 0 ); + } + + + /* inverse DCT2 transform */ + if ( nbands == 5 ) + { + matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); /* reuse of variable*/ + } + else + { + assert( nbands == 8 ); + matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); + } + k = 0; + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = 0; j < nbands; j++ ) + { + masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); + masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); + k++; + } + } +} +#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 97ee2e8336..45fc95f4c2 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -142,7 +142,15 @@ ivas_error ivas_sce_dec( if ( ( st_ivas->hQMetaData != NULL ) && ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) { +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + st->bits_frame_nominal = (int16_t) ( ( hSCE->element_brate / FRAMES_PER_SEC ) - ISM_NB_BITS_METADATA_NOMINAL ); + } + else if ( ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) || ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#else if ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) +#endif { st->bits_frame_nominal = (int16_t) ( hSCE->element_brate / FRAMES_PER_SEC ); } @@ -160,6 +168,7 @@ ivas_error ivas_sce_dec( st->bits_frame_nominal = (int16_t) ( ( hSCE->element_brate / FRAMES_PER_SEC ) - ISM_NB_BITS_METADATA_NOMINAL ); } + /* set "total_brate" */ if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_5k2 ) ) { @@ -169,17 +178,31 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + /* one separated object */ + st->total_brate = hSCE->element_brate; + } + } +#endif else if ( st_ivas->ivas_format != ISM_FORMAT ) /* note: in ISMs, total_brate[] is set in ivas_ism_config() */ { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } - /*----------------------------------------------------------------* - * Core codec configuration - *----------------------------------------------------------------*/ +/*----------------------------------------------------------------* + * Core codec configuration + *----------------------------------------------------------------*/ - /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ +/* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ +#ifdef MASA_AND_OBJECTS + if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) && st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) +#else if ( st_ivas->ivas_format == ISM_FORMAT && st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) +#endif { st->flag_ACELP16k = 0; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 2393a41f2f..c85e9ef9fb 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -657,7 +657,13 @@ typedef struct ivas_dirac_dec_data_structure int16_t spar_to_dirac_write_idx; int16_t dirac_md_buffer_length; +#ifdef MASA_AND_OBJECTS + int16_t numSimultaneousDirections; /* From 1 to 2 + MAX_NUM_OBJECTS */ + int16_t numParametricDirections; /* 1 or 2 */ + int16_t numIsmDirections; /* From 0 to MAX_NUM_OBJECTS */ +#else int16_t numSimultaneousDirections; /* 1 or 2 */ +#endif DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; /*Parameter estimation*/ @@ -1172,6 +1178,35 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; +#ifdef MASA_AND_OBJECTS +/* Data structure for MASA_ISM rendering */ +typedef struct ivas_masa_ism_data_structure +{ + int16_t azimuth_ism[MAX_NUM_OBJECTS]; + int16_t elevation_ism[MAX_NUM_OBJECTS]; + float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + + int16_t azimuth_ism_edited[MAX_NUM_OBJECTS]; + int16_t elevation_ism_edited[MAX_NUM_OBJECTS]; + uint8_t ism_is_edited[MAX_NUM_OBJECTS]; + + int16_t idx_separated_ism; + int16_t azimuth_separated_ism; + int16_t elevation_separated_ism; + + float ismPreprocMatrix[2][2][CLDFB_NO_CHANNELS_MAX]; + uint8_t objectsMoved; + float eneMoveIIR[2][CLDFB_NO_CHANNELS_MAX]; + float enePreserveIIR[2][CLDFB_NO_CHANNELS_MAX]; + float preprocEneTarget[CLDFB_NO_CHANNELS_MAX]; + float preprocEneRealized[CLDFB_NO_CHANNELS_MAX]; + + float **delayBuffer; + int16_t delayBuffer_size; + int16_t delayBuffer_nchan; + +} MASA_ISM_DATA, *MASA_ISM_DATA_HANDLE; +#endif /*----------------------------------------------------------------------------------* * Binaural Rendering structure @@ -1230,8 +1265,13 @@ typedef struct ivas_dirac_dec_binaural_data_structure float ChEneOut[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float ChCrossReOut[CLDFB_NO_CHANNELS_MAX]; float ChCrossImOut[CLDFB_NO_CHANNELS_MAX]; +#ifdef MASA_AND_OBJECTS + float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; +#else float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; /* +1 refers to SeparateChannel */ float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; +#endif float processMtxDecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float diffuseFieldCoherence[CLDFB_NO_CHANNELS_MAX]; @@ -1242,8 +1282,13 @@ typedef struct ivas_dirac_dec_binaural_data_structure REVERB_STRUCT_HANDLE hReverb; uint8_t renderStereoOutputInsteadOfBinaural; float frameMeanDiffuseness[CLDFB_NO_CHANNELS_MAX]; +#ifdef MASA_AND_OBJECTS + float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; +#else float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; +#endif float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ @@ -1961,6 +2006,16 @@ typedef struct Decoder_Struct HEAD_TRACK_DATA_HANDLE hHeadTrackData; /* Head tracking data structure */ RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */ int32_t binaural_latency_ns; /* HRTF binauralization latency in ns */ +#ifdef MASA_AND_OBJECTS + int16_t nchan_ism; /* number of ism channels in combined input format mode */ + MASA_ISM_DATA_HANDLE hMasaIsmData; /* MASA_ISM rendering structure */ + + uint8_t editing_ism_enabled; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t index_of_edited_ism; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t azimuth_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t elevation_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ +#endif + #ifdef DEBUGGING int32_t noClipping; /* number of clipped samples */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 70e0384839..8016e4f75f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -197,6 +197,13 @@ ivas_error IVAS_DEC_Open( st_ivas->sba_planar = 0; st_ivas->sba_analysis_order = 0; +#ifdef MASA_AND_OBJECTS + hIvasDec->st_ivas->editing_ism_enabled = 0; + hIvasDec->st_ivas->index_of_edited_ism = 0; + hIvasDec->st_ivas->azimuth_edited = 0; + hIvasDec->st_ivas->elevation_edited = 0; +#endif + return IVAS_ERR_OK; } @@ -940,6 +947,35 @@ ivas_error IVAS_DEC_GetHrtfHandle( } +#ifdef MASAISM_EDIT_OBJECTS +/*---------------------------------------------------------------------* + * IVAS_DEC_SetEditedIsmPositions( ) + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_SetEditedIsmPositions( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t index_of_edited_ism, /* i : Index of edited ISM */ + int16_t azimuth_edited_ism, /* i : Azimuth */ + int16_t elevation_edited_ism /* i : Elevation */ +) +{ + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + hIvasDec->st_ivas->editing_ism_enabled = 1; + hIvasDec->st_ivas->index_of_edited_ism = index_of_edited_ism; + hIvasDec->st_ivas->azimuth_edited = azimuth_edited_ism; + hIvasDec->st_ivas->elevation_edited = elevation_edited_ism; + + return IVAS_ERR_OK; +} +#endif + + /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderConfig( ) * diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index f43034c885..7231ccf3da 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -278,6 +278,15 @@ ivas_error IVAS_DEC_GetHrtfHandle( IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */ ); +#ifdef MASAISM_EDIT_OBJECTS +ivas_error IVAS_DEC_SetEditedIsmPositions( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t index_of_edited_ism, /* i : Index of edited ISM */ + int16_t azimuth_edited_ism, /* i : Azimuth */ + int16_t elevation_edited_ism /* i : Elevation */ +); +#endif + /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 5c4011fe0c..e5c83ffb20 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -101,6 +101,9 @@ ivas_error ivas_cpe_enc( ENCODER_CONFIG_HANDLE hEncoderConfig; int32_t ivas_total_brate; ivas_error error; +#ifdef MASA_AND_OBJECTS + int32_t cpe_brate; +#endif error = IVAS_ERR_OK; @@ -547,7 +550,9 @@ ivas_error ivas_cpe_enc( * DFT Stereo residual coding * DFT Stereo parameters writing into the bitstream *----------------------------------------------------------------*/ - +#ifdef MASA_AND_OBJECTS + cpe_brate = 0; +#endif if ( hCPE->element_mode == IVAS_CPE_DFT ) { if ( hEncoderConfig->Opt_DTX_ON ) @@ -578,6 +583,33 @@ ivas_error ivas_cpe_enc( } /* Write stereo bitstream */ +#ifdef MASA_AND_OBJECTS + cpe_brate = ivas_total_brate; + + if ( ivas_format == MASA_ISM_FORMAT ) + { + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + } + + if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && cpe_brate < MASA_STEREO_MIN_BITRATE && sts[0]->core_brate != SID_2k40 && sts[0]->core_brate != FRAME_NO_DATA ) + { + nb_bits = 0; /* Only mono downmix is transmitted in this case */ + } + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) ) + { + nb_bits = hCPE->hMetaData->nb_bits_tot; + } + else + { + stereo_dft_enc_write_BS( hCPE, &nb_bits ); + } + + if ( !( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) ) ) + { + /* Residual coding in MDCT domain */ + stereo_dft_enc_res( hCPE->hStereoDft, old_inp_12k8[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal - ( ( ivas_format == MASA_FORMAT ) ? nb_bits_metadata : 0 ) ) ); + } +#else if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && sts[0]->core_brate != SID_2k40 && sts[0]->core_brate != FRAME_NO_DATA ) { nb_bits = 0; /* Only mono downmix is transmitted in this case */ @@ -596,7 +628,7 @@ ivas_error ivas_cpe_enc( /* Residual coding in MDCT domain */ stereo_dft_enc_res( hCPE->hStereoDft, old_inp_12k8[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal - ( ( ivas_format == MASA_FORMAT ) ? nb_bits_metadata : 0 ) ) ); } - +#endif if ( sts[0]->core_brate == FRAME_NO_DATA || sts[0]->core_brate == SID_2k40 ) { assert( ( nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) ) && "Stereo DFT CNG: bit budget is violated" ); @@ -762,7 +794,11 @@ ivas_error create_cpe_enc( for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifdef MASA_AND_OBJECTS + if ( ivas_format == STEREO_FORMAT || ivas_format == MASA_FORMAT || ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == STEREO_FORMAT || ivas_format == MASA_FORMAT || ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) +#endif { if ( ( hCPE->input_mem[n] = (float *) count_malloc( sizeof( float ) * NS2SA( input_Fs, STEREO_DFT_OVL_NS ) ) ) == NULL ) { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 7be1f11c49..bc2b6d33a0 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -61,7 +61,11 @@ ivas_error ivas_enc( ENCODER_CONFIG_HANDLE hEncoderConfig; BSTR_ENC_HANDLE hMetaData; Encoder_State *st; /* used for bitstream handling */ +#ifdef MASA_AND_OBJECTS + int16_t nb_bits_metadata[MAX_SCE + 1]; +#else int16_t nb_bits_metadata[MAX_SCE]; +#endif float data_f[MAX_INPUT_CHANNELS][L_FRAME48k]; /* IVAS_fmToDo: buffer can be allocated dynamically based on the number of analysed channels */ int32_t ivas_total_brate; ivas_error error; @@ -250,7 +254,12 @@ ivas_error ivas_enc( ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, - ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ); + ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 +#ifdef MASA_AND_OBJECTS + , + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0 +#endif + ); } } else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) @@ -289,6 +298,83 @@ ivas_error ivas_enc( } } } +#ifdef MASA_AND_OBJECTS + else if ( ivas_format == MASA_ISM_FORMAT ) + { + float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; + float data_separated_object[L_FRAME48k]; + int16_t idx_separated_object; + + ivas_masa_enc_reconfigure( st_ivas ); + + hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; + + /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */ + if ( ( st_ivas->hEncoderConfig->nchan_inp - st_ivas->nchan_ism ) == 1 ) + { + v_multc( data_f[st_ivas->nchan_ism], 1.0f / SQRT2, data_f[st_ivas->nchan_ism], input_frame ); + mvr2r( data_f[st_ivas->nchan_ism], data_f[st_ivas->nchan_ism + 1], input_frame ); + } + + /* nb_bits_metadata[0] = 0; */ + set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); + if ( st_ivas->hQMetaData != NULL ) + { + /* Configure MASA encoder based on frame parameters */ + ivas_masa_enc_config( st_ivas ); + idx_separated_object = 0; + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Configure oMASA analysis based on MASA config */ + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs ); + } + else + { + st_ivas->nSCE = st_ivas->nchan_ism; + } + /* Estimate TF-tile energy for the input MASA stream */ + ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[st_ivas->nchan_ism] ), input_frame, st_ivas->nchan_transport ); + + /* put audio object data in SCE's */ + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Estimate MASA parameters for the objects */ + ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, data_transport_f, input_frame, st_ivas->nchan_transport, st_ivas->nchan_ism, st_ivas->ism_mode, + data_separated_object, &idx_separated_object ); + } + + /* Encode MASA parameters and write MASA metadata bitstream */ + ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object ); + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Merge transport signals */ + ivas_merge_masa_transports( data_transport_f, &( data_f[st_ivas->nchan_ism] ), data_f, input_frame, st_ivas->nchan_transport ); + } + } + + /* Encode transport signals */ + n = 0; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ); /* there are no metadata bits in SCE in this mode */ + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + /* Analysis, decision about bitrates per channel & core coding */ + if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + { + return error; + } + n = st_ivas->nchan_ism; + } + + if ( st_ivas->nCPE == 1 ) /* Stereo DMX */ + { + ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); + } + } +#endif else if ( ivas_format == MC_FORMAT ) { /* select MC format mode; write MC LS setup; reconfigure the MC format encoder */ @@ -339,7 +425,13 @@ ivas_error ivas_enc( ivas_mcmasa_enc( st_ivas->hMcMasa, st_ivas->hQMetaData, st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport, nchan_inp ); - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 ); + ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 +#ifdef MASA_AND_OBJECTS + , + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0 +#endif + ); + if ( st_ivas->hMcMasa->separateChannelEnabled ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 18280a60e2..b5ed592a34 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_stat_enc.h" +#ifdef MASA_AND_OBJECTS +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -74,10 +77,31 @@ void ivas_write_format( ind = 6; nBits += extra_bits; break; +#ifdef MASA_AND_OBJECTS + case MASA_FORMAT: + ind = 14; + nBits += extra_bits + MASA_ISM_FORMAT_BITS; + break; +#else case MASA_FORMAT: ind = 7; nBits += extra_bits; break; +#endif +#ifdef MASA_AND_OBJECTS + case MASA_ISM_FORMAT: + if ( st_ivas->ism_mode == ISM_MODE_NONE ) + { + ind = 14; /* send MASA format */ + nBits += extra_bits + MASA_ISM_FORMAT_BITS; + } + else + { + ind = 15; + nBits += extra_bits + MASA_ISM_FORMAT_BITS; + } + break; +#endif default: assert( !"Invalid format. Aborting." ); break; @@ -156,7 +180,11 @@ void ivas_write_format_sid( ind = SID_MASA_2TC; } break; - +#ifdef MASA_AND_OBJECTS + case MASA_ISM_FORMAT: /* TODO Nokia: Finalize for SID case */ + ind = 8; + break; +#endif default: assert( !"Reserved SID format symbol written." ); break; @@ -194,7 +222,12 @@ int16_t getNumChanAnalysis( { n = st_ivas->hEncoderConfig->nchan_inp; } - +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + n = st_ivas->hEncoderConfig->nchan_inp; + } +#endif return n; } @@ -299,6 +332,11 @@ void ivas_initialize_handles_enc( /* LFE handle */ st_ivas->hLFE = NULL; +#ifdef MASA_AND_OBJECTS + /* Object MASA handle */ + st_ivas->hOMasa = NULL; +#endif + return; } @@ -519,6 +557,93 @@ ivas_error ivas_init_encoder( } } } +#ifdef MASA_AND_OBJECTS + else if ( ivas_format == MASA_ISM_FORMAT ) + { + int32_t element_brate_tmp[MAX_NUM_OBJECTS]; + int32_t sce_brate; + int16_t k; + + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); + st_ivas->nchan_transport = 2; + create_ism_metadata_enc( st_ivas, st_ivas->nchan_ism, element_brate_tmp ); + /* the values of element_brate_tmp will be re-written in MASA_ISM_FORMAT because they are taken from sep_object_brate[][]*/ + + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + st_ivas->nSCE = st_ivas->nchan_ism; + } + + k = 0; + sce_brate = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + /* use the bitrate for one object */ + sce_brate = sep_object_brate[k - 2][0]; + create_sce_enc( st_ivas, 0, sce_brate ); + + /* prepare bitstream buffers */ + st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list = ind_list[0]; + reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + + st_ivas->hSCE[0]->hMetaData->ind_list = ind_list_metadata[0]; + reset_indices_enc( st_ivas->hSCE[0]->hMetaData, MAX_BITS_METADATA ); + } + else + { + sce_brate = 0; + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + sce_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + create_sce_enc( st_ivas, sce_id, sep_object_brate[k - 2][st_ivas->nSCE - 1] ); + + /* prepare bitstream buffers */ + st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; + reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + + st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; + reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); + } + } + ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); + ivas_masa_enc_open( st_ivas ); + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + ivas_omasa_enc_open( st_ivas ); + } + if ( ivas_total_brate - sce_brate >= MIN_BRATE_MDCT_STEREO ) + { + st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + } + else + { + st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; + } + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - sce_brate ); + + /* prepare bitstream buffers */ + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[st_ivas->nSCE + cpe_id * CPE_CHANNELS + n]; + reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); + } + + /* Metadata only initialized for the last cpe index*/ + if ( cpe_id == st_ivas->nCPE - 1 ) + { + st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; + reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); + } + } + } +#endif else if ( ivas_format == MC_FORMAT ) { st_ivas->mc_mode = ivas_mc_mode_select( hEncoderConfig->mc_input_setup, ivas_total_brate ); @@ -978,6 +1103,14 @@ void ivas_destroy_enc( st_ivas->hMcMasa = NULL; } +#ifdef MASA_AND_OBJECTS + if ( st_ivas->hOMasa != NULL ) + { + ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->nchan_ism ); + st_ivas->hOMasa = NULL; + } +#endif + /* Stereo downmix for EVS encoder handle */ if ( st_ivas->hStereoDmxEVS != NULL ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8e6c059c7b..4c8709ad0a 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -88,7 +88,9 @@ ivas_error ivas_ism_enc( int16_t localVAD_HE_SAD[1]; /* local HE VAD */ int16_t i, nBits; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int16_t n; +#endif error = IVAS_ERR_OK; wmops_sub_start( "ivas_ism_enc" ); @@ -98,7 +100,11 @@ ivas_error ivas_ism_enc( *-----------------------------------------------------------------*/ /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) +#else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) +#endif { hSCE = st_ivas->hSCE[sce_id]; st = hSCE->hCoreCoder[0]; @@ -205,11 +211,34 @@ ivas_error ivas_ism_enc( st_ivas->hDirAC->hParamIsm->flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech && st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i]; } - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm +#ifdef MASA_AND_OBJECTS + , + st_ivas->nSCE +#endif + ); } else /* ISM_MODE_DISC */ { +#ifdef MASA_AND_OBJECTS + int32_t ism_total_brate; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + ism_total_brate = 0; + for ( i = 0; i < st_ivas->nSCE; i++ ) + { + ism_total_brate += st_ivas->hSCE[i]->element_brate; + } + } + else + { + ism_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + } + + ivas_ism_metadata_enc( ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE ); +#else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); +#endif } /*----------------------------------------------------------------* @@ -235,8 +264,20 @@ ivas_error ivas_ism_enc( /*------------------------------------------------------------------* * CoreCoders encoding *-----------------------------------------------------------------*/ +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + n = st_ivas->nSCE; + } + else + { + n = st_ivas->nchan_transport; + } + for ( sce_id = 0; sce_id < n; sce_id++ ) +#else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) +#endif { hSCE = st_ivas->hSCE[sce_id]; st = hSCE->hCoreCoder[0]; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 60550bca0b..139b7806a9 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -142,6 +142,10 @@ ivas_error ivas_ism_metadata_enc( const int16_t localVAD[], /* i : VAD flag */ const int16_t ism_mode, /* i : ISM mode */ const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ +#ifdef MASA_AND_OBJECTS + , + int16_t n_ism /* i : number of ism-s */ +#endif ) { int16_t i, ch, nb_bits_start = 0, diff; @@ -154,7 +158,9 @@ ivas_error ivas_ism_metadata_enc( int16_t ism_imp[MAX_NUM_OBJECTS]; int16_t num_obj, nbands, nblocks; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int16_t n_ch; +#endif error = IVAS_ERR_OK; wmops_sub_start( "ism_meta_enc" ); @@ -167,12 +173,21 @@ ivas_error ivas_ism_metadata_enc( { num_obj = nchan_transport; } +#ifdef MASA_AND_OBJECTS + else if ( ism_mode == ISM_MASA_MODE_DISC ) + { + num_obj = n_ism; + } +#endif else { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } - +#ifdef MASA_AND_OBJECTS + if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( ism_mode == ISM_MODE_DISC ) ) +#endif { /* no metadata encoding in CNG */ wmops_sub_end(); @@ -196,7 +211,11 @@ ivas_error ivas_ism_metadata_enc( { hIsmMeta[ch]->ism_metadata_flag = 1; } +#ifdef MASA_AND_OBJECTS + else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else else if ( ism_mode == ISM_MODE_DISC ) +#endif { hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; @@ -223,11 +242,28 @@ ivas_error ivas_ism_metadata_enc( /*----------------------------------------------------------------* * Rate importance of particular ISm streams *----------------------------------------------------------------*/ +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + n_ch = num_obj; + } + else + { + n_ch = nchan_transport; + } + rate_ism_importance( n_ch, hIsmMeta, hSCE, ism_imp ); + +#else rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); +#endif /* relax the importance decision in "stereo" coding for noisy audio */ +#ifdef MASA_AND_OBJECTS + if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) +#else if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) +#endif { float diff_F; @@ -250,28 +286,47 @@ ivas_error ivas_ism_metadata_enc( * Write ISm common signaling *----------------------------------------------------------------*/ - /* write number of objects - unary coding */ - for ( ch = 1; ch < num_obj; ch++ ) + /*Todo: Nokia check where we transmit the number of objects */ +#ifdef MASA_AND_OBJECTS + if ( ism_mode != ISM_MASA_MODE_DISC ) { - push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); +#endif + /* write number of objects - unary coding */ + for ( ch = 1; ch < num_obj; ch++ ) + { + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); + } + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); +#ifdef MASA_AND_OBJECTS } - push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); - +#endif /* write ISm metadata flag (one per object) */ +#ifdef MASA_AND_OBJECTS + for ( ch = 0; ch < n_ch; ch++ ) +#else for ( ch = 0; ch < nchan_transport; ch++ ) +#endif { push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); } + for ( ch = 0; ch < num_obj; ch++ ) { ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } - +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { /* write VAD flag */ +#ifdef MASA_AND_OBJECTS + for ( ch = 0; ch < n_ch; ch++ ) +#else for ( ch = 0; ch < nchan_transport; ch++ ) +#endif { if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { @@ -298,7 +353,11 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < num_obj; ch++ ) { hIsmMetaData = hIsmMeta[ch]; +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { nb_bits_start = hBstr->nb_bits_tot; } @@ -310,7 +369,11 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); } @@ -416,7 +479,11 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); } @@ -545,7 +612,11 @@ ivas_error ivas_ism_metadata_enc( hIsmMetaData->last_elevation_idx = idx_elevation_abs; /* save number of metadata bits written */ +#ifdef MASA_AND_OBJECTS + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#else if ( ism_mode == ISM_MODE_DISC ) +#endif { nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; } @@ -676,14 +747,39 @@ ivas_error ivas_ism_metadata_enc( /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ - +#ifdef MASA_AND_OBJECTS + ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, + ( ism_mode == ISM_MASA_MODE_DISC ) ); +#else ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); +#endif for ( ch = 0; ch < num_obj; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } +#ifdef MASA_AND_OBJECTS + for ( ch = 0; ch < n_ch; ch++ ) + { + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; + if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; + } + } + + hSCE[ch]->element_brate = element_brate[ch]; + hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; + /* write metadata only in active frames */ + if ( hSCE[0]->hCoreCoder[0]->core_brate > SID_2k40 ) + { + reset_indices_enc( hSCE[ch]->hMetaData, MAX_BITS_METADATA ); + } + } +#else for ( ch = 0; ch < nchan_transport; ch++ ) { if ( ism_mode == ISM_MODE_DISC ) @@ -704,6 +800,7 @@ ivas_error ivas_ism_metadata_enc( reset_indices_enc( hSCE[ch]->hMetaData, MAX_BITS_METADATA ); } } +#endif wmops_sub_end(); @@ -723,20 +820,77 @@ ivas_error create_ism_metadata_enc( ) { int16_t ch, nchan_transport; - - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#ifdef MASA_AND_OBJECTS + nchan_transport = st_ivas->nchan_transport; + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { - nchan_transport = 2; + switch ( st_ivas->ism_mode ) + { + case ISM_MASA_MODE_PARAM: + st_ivas->nCPE = 1; + st_ivas->nSCE = 0; + break; + case ISM_MASA_MODE_ONE_OBJ: + st_ivas->nCPE = 1; + st_ivas->nSCE = 1; + break; + case ISM_MODE_DISC: + st_ivas->nCPE = 1; + st_ivas->nSCE = n_ISms; + break; + case ISM_MASA_MODE_DISC: + st_ivas->nCPE = 1; + st_ivas->nSCE = n_ISms; + break; + case ISM_MODE_NONE: + if ( nchan_transport == 1 ) + { + st_ivas->nSCE = 1; + st_ivas->nCPE = 0; + } + else + { + st_ivas->nSCE = 0; + st_ivas->nCPE = 1; + } + break; + default: + break; + } } else { - nchan_transport = n_ISms; - } +#endif + if ( st_ivas->ism_mode == ISM_MODE_NONE ) + { + nchan_transport = st_ivas->nchan_transport; - st_ivas->nchan_transport = nchan_transport; - st_ivas->nSCE = nchan_transport; - st_ivas->nCPE = 0; + if ( nchan_transport == 1 ) + { + st_ivas->nSCE = 1; + st_ivas->nCPE = 0; + } + else + { + st_ivas->nSCE = 0; + st_ivas->nCPE = 1; + } + } + else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + nchan_transport = 2; + } + else + { + nchan_transport = n_ISms; + } + st_ivas->nchan_transport = nchan_transport; + st_ivas->nSCE = nchan_transport; + st_ivas->nCPE = 0; +#ifdef MASA_AND_OBJECTS + } +#endif /* allocate ISm metadata handles */ for ( ch = 0; ch < n_ISms; ch++ ) { @@ -753,8 +907,29 @@ ivas_error create_ism_metadata_enc( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); - +#ifdef MASA_AND_OBJECTS + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); + } + } + else + { +#endif + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL +#ifdef MASA_AND_OBJECTS + , + 0 +#endif + ); +#ifdef MASA_AND_OBJECTS + } +#endif return IVAS_ERR_OK; } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 8dcdef30b5..7cb259b7f7 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -274,6 +274,7 @@ ivas_error ivas_param_ism_enc_open( /* Assign the number of objects */ hDirAC->hParamIsm->num_obj = st_ivas->hEncoderConfig->nchan_inp; + /* set FB config. */ if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) { @@ -442,7 +443,11 @@ ivas_error ivas_ism_enc_config( st_ivas->nSCE = st_ivas->nchan_transport; st_ivas->nCPE = 0; +#ifdef MASA_AND_OBJECTS + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ); +#else ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); +#endif ivas_corecoder_enc_reconfig( st_ivas, nchan_transport_old, 0, nchan_transport_old ); diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index c2649adc56..05f5892005 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -58,7 +58,26 @@ static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate ); +#ifdef MASA_AND_OBJECTS +static void ivas_merge_masa_metadatas( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); + +static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + ISM_METADATA_HANDLE hIsmMeta[] /* i/o: ISM metadata handles */ +); + +static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format, const ISM_MODE ism_mode ); + + +static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, int16_t no_ism, float masa_to_total_energy_ratio ); + +static int16_t index_slice_enum( const int16_t *ratio_ism_idx, int16_t no_ism ); + +static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, int16_t numCodingBands, int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio ); +#else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); +#endif /*-----------------------------------------------------------------------* @@ -85,7 +104,9 @@ ivas_error ivas_masa_enc_open( MASA_ENCODER_HANDLE hMasa; ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t sce_brate; +#endif error = IVAS_ERR_OK; if ( ( hMasa = (MASA_ENCODER_HANDLE) count_malloc( sizeof( MASA_ENCODER ) ) ) == NULL ) @@ -94,9 +115,14 @@ ivas_error ivas_masa_enc_open( } hEncoderConfig = st_ivas->hEncoderConfig; + generate_gridEq( &( hMasa->data.Sph_Grid16 ) ); +#ifdef MASA_AND_OBJECTS + if ( hEncoderConfig->ivas_format == MASA_FORMAT || hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) +#else if ( hEncoderConfig->ivas_format == MASA_FORMAT ) +#endif { hMasa->data.num_Cldfb_instances = st_ivas->nchan_transport; } @@ -112,14 +138,31 @@ ivas_error ivas_masa_enc_open( return error; } } - +#ifdef MASA_AND_OBJECTS + sce_brate = 0; + if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + for ( i = 0; i < st_ivas->nSCE; i++ ) + { + sce_brate += st_ivas->hSCE[i]->element_brate; + } + } +#endif ivas_masa_set_elements( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, - st_ivas->hQMetaData, &hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + st_ivas->hQMetaData, &hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE +#ifdef MASA_AND_OBJECTS + , + hEncoderConfig->ivas_format, st_ivas->ism_mode, sce_brate +#endif + ); mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); - +#ifdef MASA_AND_OBJECTS + if ( hEncoderConfig->ivas_format == MASA_FORMAT || hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) +#else if ( hEncoderConfig->ivas_format == MASA_FORMAT ) +#endif { for ( i = 0; i < st_ivas->nchan_transport; i++ ) { @@ -158,8 +201,11 @@ void ivas_masa_enc_close( { deleteCldfb( &( hMasa->data.cldfbAnaEnc[i] ) ); } - +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { for ( i = 0; i < nchan_transport; i++ ) { @@ -190,16 +236,27 @@ void ivas_masa_encode( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t Opt_DTX_ON, /* i : DTX on flag */ const int16_t element_mode /* i : element mode */ +#ifdef MASA_AND_OBJECTS + , + ISM_MODE ism_mode, /* i : ISM format mode */ + int16_t nchan_ism, /* i : number of ism channels */ + ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ + int16_t idx_separated_object /* i : index of the separated object */ +#endif ) { MASA_DIRECTIONAL_SPATIAL_META *h_orig_metadata; int16_t i, j; int16_t masa_sid_descriptor; + masa_sid_descriptor = -1; h_orig_metadata = NULL; - +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { /* Create the MASA SID descriptor for the metadata and CPE mode, in order to have the SID frame self-contained. */ if ( Opt_DTX_ON && hQMetaData != NULL ) @@ -234,8 +291,11 @@ void ivas_masa_encode( /* Combine frequency bands and sub-frames */ combine_freqbands_and_subframes( hMasa ); } - +#ifdef MASA_AND_OBJECTS + if ( hMasa->config.numberOfDirections == 2 && hMasa->config.numTwoDirBands < hMasa->config.numCodingBands && ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) ) +#else if ( hMasa->config.numberOfDirections == 2 && hMasa->config.numTwoDirBands < hMasa->config.numCodingBands && ivas_format == MASA_FORMAT ) +#endif { /* Combine directions */ combine_directions( hMasa ); @@ -251,12 +311,30 @@ void ivas_masa_encode( /* Reset qmetadata bit budget */ hQMetaData->metadata_max_bits = hMasa->config.max_metadata_bits; - +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { /* write the number of MASA transport channels */ push_next_indice( hMetaData, nchan_transport - 1, MASA_TRANSP_BITS ); hQMetaData->metadata_max_bits -= MASA_TRANSP_BITS; +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) + { + /* always write the number of objects in ISM_MASA format*/ + push_next_indice( hMetaData, nchan_ism - 1, NO_BITS_MASA_ISM_NO_OBJ ); + hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; + + /* write index of separated object if needed */ + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ && hMasa->data.nchan_ism > 1 ) + { + push_next_indice( hMetaData, idx_separated_object, NO_BITS_MASA_ISM_NO_OBJ ); + hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; + } + } +#endif /* write placeholder data for descriptive metadata */ push_next_indice( hMetaData, 0, MASA_HEADER_BITS ); @@ -279,23 +357,55 @@ void ivas_masa_encode( } /* Move data from encoder to qmetadata */ +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { move_metadata_to_qmetadata( hMasa, hQMetaData ); } +#ifdef MASA_AND_OBJECTS + else if ( ivas_format == MASA_ISM_FORMAT ) + { + ivas_merge_masa_metadatas( hMasa, hQMetaData ); + } +#endif if ( hMasa->config.max_metadata_bits < MINIMUM_BIT_BUDGET_NORMAL_META && !hMasa->config.joinedSubframes ) { +#ifdef MASA_AND_OBJECTS + reduce_metadata_further( hMasa, hQMetaData, ivas_format, ism_mode ); +#else reduce_metadata_further( hMasa, hQMetaData, ivas_format ); - +#endif /* Write low bitrate mode. 1 signals that we have merged through time, 0 signals merge through frequency. */ push_next_indice( hMetaData, hQMetaData->q_direction[0].cfg.nblocks == 1 ? 1 : 0, MASA_LOWBITRATE_MODE_BITS ); hQMetaData->metadata_max_bits -= MASA_LOWBITRATE_MODE_BITS; } +#ifdef MASA_AND_OBJECTS + /* Encode MASA+ISM metadata */ + if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + /* encode MASA/ISM energy ratios */ + ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData ); + } + else + { + hQMetaData->masa_to_total_energy_ratio[0][0] = -1; /* signals NOT to adjust the energy ratios */ + } +#endif /* Encode metadata */ ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + /* Modify spatial metadata based on the MASA-to-total energy ratios */ + modify_masa_energy_ratios( hQMetaData ); + } +#endif *nb_bits_metadata = hMetaData->nb_bits_tot; if ( ivas_format == MASA_FORMAT && Opt_DTX_ON ) @@ -466,19 +576,40 @@ ivas_error ivas_masa_enc_config( uint8_t isActualTwoDir; /* Flag to tell that when there are two directions present in metadata, they both contain meaningful information. */ int32_t ivas_total_brate; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t sce_brate; +#endif error = IVAS_ERR_OK; hMasa = st_ivas->hMasa; hQMetaData = st_ivas->hQMetaData; ivas_format = st_ivas->hEncoderConfig->ivas_format; ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; - +#ifdef MASA_AND_OBJECTS + sce_brate = 0; + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + for ( i = 0; i < st_ivas->nSCE; i++ ) + { + sce_brate += st_ivas->hSCE[i]->element_brate; + } + } +#endif ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, - hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE +#ifdef MASA_AND_OBJECTS + , + ivas_format, st_ivas->ism_mode, sce_brate +#endif + ); hQMetaData->is_masa_ivas_format = 1; + +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { /* Inspect metadata for parameter changes that affect coding. */ detect_metadata_composition( hMasa, &joinedSubframes, &coherencePresent, &isActualTwoDir ); @@ -493,8 +624,18 @@ ivas_error ivas_masa_enc_config( hMasa->config.numberOfDirections = 1; } - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, ivas_total_brate, st_ivas->nchan_transport, ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); - +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT ) + { + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); + } + else + { +#endif + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, ivas_total_brate, st_ivas->nchan_transport, ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); +#ifdef MASA_AND_OBJECTS + } +#endif /* Setup importance weights for two-direction band selection. */ if ( hMasa->config.numberOfDirections == 2 ) { @@ -572,9 +713,17 @@ ivas_error ivas_masa_enc_config( masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs ); /* Transmit stereo signals using a mono downmix at lowest bitrates */ +#ifdef MASA_AND_OBJECTS + if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) +#else if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) +#endif { +#ifdef MASA_AND_OBJECTS + st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ( ivas_total_brate - sce_brate < MASA_STEREO_MIN_BITRATE ) ? 1 : 0; +#else st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ivas_total_brate < MASA_STEREO_MIN_BITRATE ? 1 : 0; +#endif } return error; @@ -1276,7 +1425,12 @@ static void compensate_energy_ratios( static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, - const IVAS_FORMAT ivas_format ) + const IVAS_FORMAT ivas_format +#ifdef MASA_AND_OBJECTS + , + const ISM_MODE ism_mode +#endif +) { int16_t sf; int16_t band; @@ -1299,7 +1453,11 @@ static void reduce_metadata_further( /* Get energy for the input data in 4-subframe, 5-band format */ totalEnergySum = 0.0f; +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) ) /* Energy data is in 4-subframe, 24-band format */ +#else if ( ivas_format == MASA_FORMAT ) /* Energy data is in 4-subframe, 24-band format */ +#endif { for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { @@ -1678,8 +1836,21 @@ void ivas_masa_enc_reconfigure( int16_t n, tmp; int16_t sce_id, cpe_id; int32_t ivas_total_brate; - ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; +#ifdef MASA_AND_OBJECTS + int32_t sce_brate; +#endif + ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; +#ifdef MASA_AND_OBJECTS + sce_brate = 0; + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) + { + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + sce_brate += st_ivas->hSCE[sce_id]->element_brate; + } + } +#endif if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) { for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) @@ -1699,7 +1870,16 @@ void ivas_masa_enc_reconfigure( copy_encoder_config( st_ivas, st_ivas->hCPE[cpe_id]->hCoreCoder[n], 0 ); st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ } - +#ifdef MASA_AND_OBJECTS + if ( ivas_total_brate - sce_brate < MASA_STEREO_MIN_BITRATE || ivas_total_brate - sce_brate < MIN_BRATE_MDCT_STEREO ) + { + st_ivas->hCPE[cpe_id]->element_mode = IVAS_CPE_DFT; + } + else + { + st_ivas->hCPE[cpe_id]->element_mode = IVAS_CPE_MDCT; + } +#else if ( ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { st_ivas->hCPE[cpe_id]->element_mode = IVAS_CPE_DFT; @@ -1712,10 +1892,622 @@ void ivas_masa_enc_reconfigure( { st_ivas->hCPE[cpe_id]->element_mode = IVAS_CPE_MDCT; } +#endif } - ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp ); + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp +#ifdef MASA_AND_OBJECTS + , + st_ivas->hEncoderConfig->ivas_format, st_ivas->ism_mode, sce_brate +#endif + ); } return; } + +#ifdef MASA_AND_OBJECTS +static void ivas_merge_masa_metadatas( + MASA_ENCODER_HANDLE hMasa, + IVAS_QMETADATA_HANDLE hQMeta ) +{ + int16_t sf, band; + uint8_t numCodingBands; + uint8_t numDirections; + uint8_t numSf; + MASA_METADATA_HANDLE hMeta; + float energyTimesRatio1, energyTimesRatio2; + int16_t brange[2]; + float eneBand; + float energyMerged[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + int16_t bin; + + numCodingBands = hMasa->config.numCodingBands; + numDirections = hMasa->config.numberOfDirections; + numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4; + hMeta = &( hMasa->masaMetadata ); + + assert( numDirections == 1 && "MASA metadata merging currently implemented only for 1-direction metadata" ); /* Currently only 1-direction metadata is fed to merging */ + + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + brange[0] = hMasa->data.band_mapping[band]; + brange[1] = hMasa->data.band_mapping[band + 1]; + + /* Compute energies */ + /* MASA energy is in the full 24 band resolution, whereas the ISM energy is already in the coding band resolution */ + eneBand = 0.0f; + for ( bin = brange[0]; bin < brange[1]; bin++ ) + { + eneBand += hMasa->data.energy[sf][bin]; + } + energyMerged[sf][band] = eneBand + hMasa->data.energy_ism[sf][band]; + + /* Compute weights */ + energyTimesRatio1 = hMasa->data.energy_ism[sf][band] * hQMeta->q_direction[0].band_data[band].energy_ratio[sf]; + energyTimesRatio2 = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band]; + + /* Determine combined metadata based on the weights */ + if ( energyTimesRatio2 > energyTimesRatio1 ) + { + hQMeta->q_direction[0].band_data[band].azimuth[sf] = hMeta->directional_meta[0].azimuth[sf][band]; + hQMeta->q_direction[0].band_data[band].elevation[sf] = hMeta->directional_meta[0].elevation[sf][band]; + hQMeta->q_direction[0].band_data[band].energy_ratio[sf] = hMeta->directional_meta[0].energy_ratio[sf][band]; + if ( hQMeta->q_direction[0].coherence_band_data != NULL ) + { + hQMeta->q_direction[0].coherence_band_data[band].spread_coherence[sf] = (uint8_t) roundf( hMeta->directional_meta[0].spread_coherence[sf][band] * UINT8_MAX ); + } + if ( hQMeta->surcoh_band_data != NULL ) + { + hQMeta->surcoh_band_data[band].surround_coherence[sf] = (uint8_t) roundf( hMeta->common_meta.surround_coherence[sf][band] * UINT8_MAX ); + } + } + } + } + + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + hMasa->data.energy[sf][band] = energyMerged[sf][band]; + } + } +} + + +static void quantize_ratio_ism_vector( + float *ratio_ism, + int16_t *idx, + int16_t no_ism, + float masa_to_total_energy_ratio ) +{ + int16_t i, j, best_i, best_i2; + + float dist, div, tmp, dist2, best_dist; + int16_t part_idx_sum, max_sum_idx; + max_sum_idx = ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1; + if ( no_ism > 1 ) + { + + if ( masa_to_total_energy_ratio >= MASA2TOTAL_THR ) + { + distribute_evenly_ism( idx, max_sum_idx, no_ism ); + } + else + { + dist = 0.0f; + div = 1.0f / (float) ( max_sum_idx ); + + part_idx_sum = 0; + + for ( i = 0; i < no_ism; i++ ) + { + idx[i] = (int16_t) ( ( ratio_ism[i] ) * ( max_sum_idx ) ); + part_idx_sum += idx[i]; + + tmp = ( ratio_ism[i] - ( idx[i] * div ) ); + dist += ( tmp * tmp ); + } + best_dist = dist; + best_i2 = -1; + while ( part_idx_sum < max_sum_idx ) + { + best_i = -1; + /* check which index to increase by 1 for a possible improvement */ + + for ( i = 0; i < no_ism; i++ ) + { + idx[i]++; + dist2 = 0.0f; + + + for ( j = 0; j < no_ism; j++ ) + { + tmp = ( ratio_ism[i] - ( idx[i] * div ) ); + dist2 += ( tmp * tmp ); + } + + if ( dist2 < best_dist ) + { + best_i2 = best_i; + best_i = i; + best_dist = dist2; + } + idx[i]--; + } + if ( best_i > -1 ) + { + idx[best_i]++; + part_idx_sum++; + } + else + { + if ( best_i2 > -1 ) + { + idx[best_i2]++; + part_idx_sum++; + } + else + { + idx[no_ism - 1] += max_sum_idx - part_idx_sum; + part_idx_sum = max_sum_idx; + } + } + } + assert( sum_s( idx, no_ism ) == max_sum_idx ); + } + } + else + { + idx[0] = (int16_t) ( ( ratio_ism[0] ) * ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) + 0.5f ); + } + + + return; +} + + +static int16_t index_slice_enum( + const int16_t *ratio_ism_idx, + int16_t no_ism ) +{ + int16_t i; + int16_t x, index; + int16_t base; + + if ( no_ism == 2 ) + { + index = ratio_ism_idx[0]; + } + else + { + x = ratio_ism_idx[no_ism - 2]; + base = 10; + for ( i = no_ism - 3; i >= 0; i-- ) + { + x += ratio_ism_idx[i] * base; + base *= 10; + } + + index = 0; + i = 0; + while ( i <= x ) + { + if ( valid( i, 7, no_ism - 1 ) ) + { + index++; + } + i++; + } + index--; + } + + return index; +} + +static int16_t encode_ratio_ism_subframe( + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t no_ism, + int16_t numCodingBands, + int16_t sf, + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + BSTR_ENC_HANDLE hMetaData, + const float *masa_to_total_energy_ratio ) +{ + int16_t b, i; + int16_t diff_idx[MAX_NUM_OBJECTS], index; + int16_t nbits, nbits0, nbits1, GR_order, GR_order_sb, bits_pos0; + int16_t differential_subframe; + + nbits = 0; + nbits0 = 0; + nbits1 = 0; + + bits_pos0 = hMetaData->nb_bits_tot; + differential_subframe = 1; /* the differences are taken with respect to previous subframe */ + if ( sf == 0 ) /* first subframe */ + { + if ( no_ism == 2 ) + { + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + index = index_slice_enum( ratio_ism_idx[b], no_ism ); + + push_next_indice( hMetaData, index, 3 ); + nbits += 3; + } + } + } + else if ( no_ism == 3 ) + { + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + index = index_slice_enum( ratio_ism_idx[b], no_ism ); + /* there are 36 indices and part of them use 5 bits; 31 is special code to + signal that there are indices larger than 31, represented on extra 3 bits */ + if ( index < 31 ) + { + push_next_indice( hMetaData, index, 5 ); + nbits += 5; + } + else + { + push_next_indice( hMetaData, 31, 5 ); + nbits += 5; + + push_next_indice( hMetaData, index - 31, 3 ); + nbits += 3; + } + } + } + } + else + { + if ( no_ism == 4 ) + { + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + index = index_slice_enum( ratio_ism_idx[b], no_ism ); + push_next_indice( hMetaData, index, 7 ); + nbits += 7; + } + } + } + } +#ifdef DEBUGGING + assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); +#endif + } + else + { + nbits0 = 0; + nbits1 = 0; + for ( b = 0; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + /* transform difference index into positive */ + for ( i = 0; i < no_ism - 1; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + diff_idx[i] = -2 * diff_idx[i]; + } + else + { + diff_idx[i] = 2 * diff_idx[i] - 1; + } + } + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); + } + } + if ( nbits0 < nbits1 ) + { + GR_order = 0; + nbits = nbits0; + } + else + { + GR_order = 1; + nbits = nbits1; + } + + /* try the difference from subband to subband; first subband is compared to previous subframe first subband*/ + /* take difference with respect to previous subframe only for first subband */ + nbits0 = 0; + nbits1 = 0; + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); + /* transform difference index into positive */ + for ( i = 0; i < no_ism - 1; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + diff_idx[i] = -2 * diff_idx[i]; + } + else + { + diff_idx[i] = 2 * diff_idx[i] - 1; + } + } + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); + } + for ( b = 1; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + /* transform difference index into positive */ + for ( i = 0; i < no_ism - 1; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + diff_idx[i] = -2 * diff_idx[i]; + } + else + { + diff_idx[i] = 2 * diff_idx[i] - 1; + } + } + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); + } + } + + if ( nbits0 < nbits1 ) + { + GR_order_sb = 0; + } + else + { + GR_order_sb = 1; + nbits0 = nbits1; + } + + if ( nbits0 < nbits ) + { + differential_subframe = 0; + nbits = nbits0; + GR_order = GR_order_sb; + } + nbits++; /* for GR_order */ + nbits++; /* for the prediction type */ + + /* write prediction type */ + push_next_indice( hMetaData, differential_subframe, 1 ); + /* write GR order */ + push_next_indice( hMetaData, GR_order, 1 ); + /* write data */ + if ( differential_subframe ) + { + for ( b = 0; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + /* transform difference index into positive */ + for ( i = 0; i < no_ism - 1; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + diff_idx[i] = -2 * diff_idx[i]; + } + else + { + diff_idx[i] = 2 * diff_idx[i] - 1; + } + } + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, diff_idx[i], 100, GR_order ); + } + } + } + else + { + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); + /* transform difference index into positive */ + for ( i = 0; i < no_ism - 1; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + diff_idx[i] = -2 * diff_idx[i]; + } + else + { + diff_idx[i] = 2 * diff_idx[i] - 1; + } + } + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, diff_idx[i], 100, GR_order ); + } + for ( b = 1; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + /* transform difference index into positive */ + for ( i = 0; i < no_ism - 1; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + diff_idx[i] = -2 * diff_idx[i]; + } + else + { + diff_idx[i] = 2 * diff_idx[i] - 1; + } + } + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, diff_idx[i], 100, GR_order ); + } + } + } +#ifdef DEBUGGING + assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); +#endif + } + return nbits; +} + + +static void ivas_encode_masaism_metadata( + MASA_ENCODER_HANDLE hMasa, + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + ISM_METADATA_HANDLE hIsmMeta[] /* i/o: ISM metadata handles */ +) +{ + int16_t sf, band; + uint8_t numCodingBands; + uint8_t numSf; + int16_t brange[2]; + float eneBand; + int16_t bin; + int16_t obj; + float priority[MAX_NUM_OBJECTS]; + int16_t bits_ism[MAX_NUM_OBJECTS]; + uint16_t idx_sph; + float theta_q, phi_q; + uint16_t index_theta, index_phi; + float ratio_ism[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + float step; + int16_t inv_step; + + numCodingBands = hMasa->config.numCodingBands; + numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4; + + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + if ( hMasa->data.energy_ism[sf][band] == 0.0f ) + { + hQMetaData->masa_to_total_energy_ratio[sf][band] = 1.0f; + } + else + { + brange[0] = hMasa->data.band_mapping[band]; + brange[1] = hMasa->data.band_mapping[band + 1]; + + eneBand = 0.0f; + for ( bin = brange[0]; bin < brange[1]; bin++ ) + { + eneBand += hMasa->data.energy[sf][bin]; + } + hQMetaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hMasa->data.energy_ism[sf][band] + EPSILON ); + } + } + } + + + encode_masa_to_total( hQMetaData, hMetaData ); + /* quantize ism_ratios */ + if ( hMasa->data.nchan_ism > 1 ) + { + + inv_step = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); + step = 1.0f / inv_step; + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + assert( ( hMasa->data.energy_ratio_ism[sf][band][obj] >= 0 ) && ( hMasa->data.energy_ratio_ism[sf][band][obj] <= 1 ) ); + ratio_ism[band][obj] = hMasa->data.energy_ratio_ism[sf][band][obj]; + } + /* Quantize power ratios */ + quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band] ); + /* reconstructed values */ + reconstruct_ism_ratios( ratio_ism_idx[band], hMasa->data.nchan_ism, step, hMasa->data.q_energy_ratio_ism[sf][band] ); + /* encode vector */ + } + + /* encode data for current subframe */ + encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf] ); + + /* calculate quantized ISM ratios */ + /* save previous subframe indexes */ + for ( band = 0; band < numCodingBands; band++ ) + { + mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], hMasa->data.nchan_ism ); + } + } + + set_f( priority, 0.0f, hMasa->data.nchan_ism ); + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + priority[obj] = max( priority[obj], ( hMasa->data.q_energy_ratio_ism[sf][band][obj] * hQMetaData->masa_to_total_energy_ratio[sf][band] ) ); + } + } + } + } + else + { + priority[0] = 1; + } + + /* decide parameters for ISM metadata quantization */ + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - priority[obj] ) * 7 ); + } + /* this is only the first version */ + /* quantize directions */ + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); + push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); + } +} + + +void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], + float data_in_f2[][L_FRAME48k], + float data_out_f[][L_FRAME48k], + const int16_t input_frame, + const int16_t num_transport_channels ) +{ + int16_t i, j; + + for ( i = 0; i < num_transport_channels; i++ ) + { + for ( j = 0; j < input_frame; j++ ) + { + data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; + } + } +} +#endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c new file mode 100644 index 0000000000..cd1f574346 --- /dev/null +++ b/lib_enc/ivas_omasa_enc.c @@ -0,0 +1,936 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include +#include +#include "string.h" + +#include "ivas_cnst.h" +#include "ivas_prot.h" +#include "options.h" +#include "prot.h" +#include "ivas_rom_com.h" +#include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmops.h" + +#ifdef MASA_AND_OBJECTS + +/*------------------------------------------------------------------------- + * Local function prototypes + *------------------------------------------------------------------------*/ + +static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); + +static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); + +static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t num_transport_channels, const int16_t num_input_channels, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); + +static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ); + +static void computeReferencePower_omasa( const int16_t *band_grouping, float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float *reference_power, const int16_t enc_param_start_band, const int16_t num_freq_bands ); + + +/*--------------------------------------------------------------------------* + * ivas_omasa_enc_open() + * + * + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_enc_open( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +) +{ + int16_t i, j; + float tmp_f; + OMASA_ENC_HANDLE hOMasa; + int16_t numAnalysisChannels; + int16_t input_frame; + ivas_error error; + + error = IVAS_ERR_OK; + + assert( st_ivas->hMasa != NULL && "MASA encoder handle is not present" ); + + if ( ( hOMasa = (OMASA_ENC_HANDLE) count_malloc( sizeof( OMASA_ENC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA encoder\n" ) ); + } + + numAnalysisChannels = st_ivas->nchan_ism; + + /* initialize delay compensation */ + hOMasa->num_samples_delay_comp = NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS ); + tmp_f = ( (float) hOMasa->num_samples_delay_comp ) / (float) ( NS2SA( st_ivas->hEncoderConfig->input_Fs, DIRAC_SLOT_NS ) ); + hOMasa->num_slots_delay_comp = (int16_t) ( tmp_f ); + + if ( tmp_f > hOMasa->num_slots_delay_comp ) + { + hOMasa->num_slots_delay_comp++; + hOMasa->offset_comp = -hOMasa->num_samples_delay_comp; + hOMasa->num_samples_delay_comp = hOMasa->num_slots_delay_comp * NS2SA( st_ivas->hEncoderConfig->input_Fs, DIRAC_SLOT_NS ); + hOMasa->offset_comp += hOMasa->num_samples_delay_comp; + } + else + { + hOMasa->offset_comp = 0; + } + + for ( i = 0; i < numAnalysisChannels; i++ ) + { + hOMasa->delay_buffer[i] = (float *) count_malloc( NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_NS ) * sizeof( float ) ); /* Todo Nokia: Return errors if alloc fails */ + set_zero( hOMasa->delay_buffer[i], NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_NS ) ); + } + + /* open/initialize CLDFB */ + hOMasa->num_Cldfb_instances = numAnalysisChannels; + for ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) + { + openCldfb( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ); + } + + /* intensity 3-dim */ + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + hOMasa->direction_vector_m[i] = (float **) count_malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + hOMasa->direction_vector_m[i][j] = (float *) count_malloc( MAXIMUM_OMASA_FREQ_BANDS * sizeof( float ) ); + set_zero( hOMasa->direction_vector_m[i][j], MAXIMUM_OMASA_FREQ_BANDS ); + } + } + + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + hOMasa->buffer_intensity_real[i][j] = (float *) count_malloc( MAXIMUM_OMASA_FREQ_BANDS * sizeof( float ) ); + set_zero( hOMasa->buffer_intensity_real[i][j], MAXIMUM_OMASA_FREQ_BANDS ); + } + } + + set_zero( hOMasa->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); + + for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + { + set_f( hOMasa->prev_object_dm_gains[i], (float) sqrt( 0.5 ), MASA_MAX_TRANSPORT_CHANNELS ); + } + set_zero( hOMasa->broadband_energy_sm, MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS ); + set_zero( hOMasa->broadband_energy_prev, MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS ); + hOMasa->prev_selected_object = 0; + hOMasa->changing_object = 0; + + input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); + for ( i = 0; i < input_frame; i++ ) + { + hOMasa->interpolator[i] = ( (float) i ) / ( (float) input_frame ); + hOMasa->fade_out_gain[i] = ( 1.0f + cosf( ( (float) i ) / ( (float) input_frame ) * EVS_PI ) ) / 2.0f; + hOMasa->fade_in_gain[i] = 1.0f - hOMasa->fade_out_gain[i]; + } + + hOMasa->index_buffer_intensity = 0; + + st_ivas->hOMasa = hOMasa; + + return error; +} + + +/*--------------------------------------------------------------------------* + * ivas_omasa_enc_close() + * + O + *--------------------------------------------------------------------------*/ + +void ivas_omasa_enc_close( + OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ + const int16_t nchan_ism /* i : number of objects */ +) +{ + int16_t i, j; + + + for ( i = 0; i < nchan_ism; i++ ) + { + count_free( hOMasa->delay_buffer[i] ); + hOMasa->delay_buffer[i] = NULL; + } + + for ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) + { + deleteCldfb( &( hOMasa->cldfbAnaEnc[i] ) ); + } + + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + count_free( hOMasa->direction_vector_m[i][j] ); + hOMasa->direction_vector_m[i][j] = NULL; + } + + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + count_free( hOMasa->buffer_intensity_real[i][j] ); + hOMasa->buffer_intensity_real[i][j] = NULL; + } + + count_free( hOMasa->direction_vector_m[i] ); + hOMasa->direction_vector_m[i] = NULL; + } + + count_free( hOMasa ); + + return; +} + + +/*--------------------------------------------------------------------------* + * ivas_omasa_set_config() + * + * Frame-by-frame config for oMASA + *--------------------------------------------------------------------------*/ + +void ivas_omasa_set_config( + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ + const int32_t input_Fs /* i : Input sample rate */ +) +{ + int16_t i, maxBin; + + /* Determine the number of bands */ + hOMasa->nbands = hMasa->config.numCodingBands; + hOMasa->nCodingBands = hMasa->config.numCodingBands; + + /* Determine the number of subframes */ + hOMasa->nSubframes = hMasa->config.joinedSubframes == TRUE ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES; + + /* Determine band grouping */ + if ( hOMasa->nbands == 24 ) + { + mvs2s( MASA_band_grouping_24, hOMasa->band_grouping, 24 + 1 ); + } + else + { + for ( i = 0; i < hOMasa->nbands + 1; i++ ) + { + hOMasa->band_grouping[i] = MASA_band_grouping_24[hMasa->data.band_mapping[i]]; + } + } + + maxBin = (int16_t) ( input_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + + for ( i = 1; i < hOMasa->nbands + 1; i++ ) + { + if ( hOMasa->band_grouping[i] >= maxBin ) + { + hOMasa->band_grouping[i] = maxBin; + hOMasa->nbands = i; + break; + } + } + + mvs2s( DirAC_block_grouping, hOMasa->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); + if ( hOMasa->nSubframes == 1 ) + { + hOMasa->block_grouping[1] = hOMasa->block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES]; + } +} + + +/*--------------------------------------------------------------------------* + * ivas_omasa_enc() + * + * + *--------------------------------------------------------------------------*/ + +void ivas_omasa_enc( + OMASA_ENC_HANDLE hOMasa, + IVAS_QMETADATA_HANDLE hQMeta, + MASA_ENCODER_HANDLE hMasa, + ISM_METADATA_HANDLE hIsmMeta[], + float data_in_f[][L_FRAME48k], + float data_out_f[][L_FRAME48k], + const int16_t input_frame, + const int16_t nchan_transport, + const int16_t nchan_ism, + const ISM_MODE ism_mode, + float data_separated_object[L_FRAME48k], + int16_t *idx_separated_object ) +{ + int16_t i, j; + + /* Analysis */ + if ( ism_mode == ISM_MODE_NONE ) + { + float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float energyRatio[MASA_FREQUENCY_BANDS]; + float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float surroundingCoherence[MASA_FREQUENCY_BANDS]; + int16_t nBands, nBlocks; + uint8_t fixedDistance = 0; + + nBands = hOMasa->nbands; + nBlocks = hOMasa->nSubframes; + + /* Estimate MASA parameters from the objects */ + ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_ism ); + + /* Set analyzed values to the QMeta struct */ + for ( i = 0; i < nBands; i++ ) + { + for ( j = 0; j < nBlocks; j++ ) + { + hQMeta->q_direction[0].band_data[i].azimuth[j] = azimuth_m_values[j][i]; + hQMeta->q_direction[0].band_data[i].elevation[j] = elevation_m_values[j][i]; + hQMeta->q_direction[0].band_data[i].energy_ratio[j] = energyRatio[i]; /* Only one value is transmitted for all subframes */ + hQMeta->q_direction[0].band_data[i].distance[j] = fixedDistance; + + if ( hQMeta->surcoh_band_data != NULL ) + { + hQMeta->q_direction[0].coherence_band_data[i].spread_coherence[j] = (uint8_t) roundf( spreadCoherence[j][i] * UINT8_MAX ); + hQMeta->surcoh_band_data[i].surround_coherence[j] = (uint8_t) roundf( surroundingCoherence[i] * UINT8_MAX ); + } + } + } + + /* At lower sampling rates, set zeros for higher bands that were not analyzed */ + if ( nBands < hOMasa->nCodingBands ) + { + for ( i = nBands; i < hOMasa->nCodingBands; i++ ) + { + for ( j = 0; j < nBlocks; j++ ) + { + hQMeta->q_direction[0].band_data[i].azimuth[j] = 0.0f; + hQMeta->q_direction[0].band_data[i].elevation[j] = 0.0f; + hQMeta->q_direction[0].band_data[i].energy_ratio[j] = 0.0f; + hQMeta->q_direction[0].band_data[i].distance[j] = 0; + + if ( hQMeta->surcoh_band_data != NULL ) + { + hQMeta->q_direction[0].coherence_band_data[i].spread_coherence[j] = 0; + hQMeta->surcoh_band_data[i].surround_coherence[j] = 0; + } + } + } + } + } + else if ( ism_mode == ISM_MASA_MODE_PARAM ) + { + /* Estimate energies and ratios */ + ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); + } + else + { + float broadband_energy[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; + int16_t loudest_object; + int16_t selected_object; + int16_t nchan_all_inp; + float alpha; + uint8_t fade_out_separate_object; + uint8_t fade_in_separate_object; + + /* Estimate broadband energies */ + nchan_all_inp = nchan_ism + nchan_transport; + set_zero( broadband_energy, nchan_all_inp ); + for ( i = 0; i < nchan_all_inp; i++ ) + { + for ( j = 0; j < input_frame; j++ ) + { + broadband_energy[i] += data_in_f[i][j] * data_in_f[i][j]; + } + } + + /* Temporal averaging */ + alpha = 0.8f; + for ( i = 0; i < nchan_all_inp; i++ ) + { + hOMasa->broadband_energy_sm[i] = ( 1.0f - alpha ) * broadband_energy[i] + alpha * hOMasa->broadband_energy_sm[i]; + } + + /* Determine loudest object */ + loudest_object = 0; + for ( i = 1; i < nchan_ism; i++ ) + { + if ( hOMasa->broadband_energy_sm[i] > hOMasa->broadband_energy_sm[loudest_object] ) + { + loudest_object = i; + } + } + + /* Determine object to separate */ + selected_object = hOMasa->prev_selected_object; + fade_out_separate_object = 0; + fade_in_separate_object = 0; + if ( hOMasa->changing_object ) + { + hOMasa->changing_object = 0; + selected_object = loudest_object; + fade_in_separate_object = 1; + } + else + { + if ( loudest_object != hOMasa->prev_selected_object ) + { + float selected_ene; + float total_ene; + float selected_ratio; + float adaptive_threshold_dB; + float ratio_objects_dB; + float hardswitch_threshold = 0.25f; + + /* Compute the energy of the current and the previous selected object in the current and the previous frame */ + selected_ene = broadband_energy[loudest_object] + broadband_energy[hOMasa->prev_selected_object] + hOMasa->broadband_energy_prev[loudest_object] + hOMasa->broadband_energy_prev[hOMasa->prev_selected_object]; + + /* Compute the energy of all objects and MASA channels in the current and the previous frame */ + total_ene = 0.0f; + for ( i = 0; i < nchan_all_inp; i++ ) + { + total_ene += broadband_energy[i] + hOMasa->broadband_energy_prev[i]; + } + + /* Compute the ratio */ + selected_ratio = selected_ene / ( total_ene + EPSILON ); + + adaptive_threshold_dB = selected_ratio * 9.0f + 1.0f; /* selected ratio = 0 -> 1 dB, selected ratio = 1 -> 10 dB */ + ratio_objects_dB = 10.0f * log10f( hOMasa->broadband_energy_sm[loudest_object] / ( hOMasa->broadband_energy_sm[hOMasa->prev_selected_object] + EPSILON ) ); + + /* Adaptively determine whether to change the separated object. If they are quiet compared to the total energy, change easier, as other signals mask the change. */ + if ( ratio_objects_dB > adaptive_threshold_dB ) + { + if ( selected_ratio < hardswitch_threshold ) /* If low level compared to all audio channels, perform hardswitch */ + { + selected_object = loudest_object; + } + else /* If high level compared to all audio channels, perform switch via fade out fade in */ + { + hOMasa->changing_object = 1; + fade_out_separate_object = 1; + } + } + } + } + + /* Set values for next frame */ + for ( i = 0; i < nchan_all_inp; i++ ) + { + hOMasa->broadband_energy_prev[i] = broadband_energy[i]; + } + hOMasa->prev_selected_object = selected_object; + + /* Separate the selected object */ + *idx_separated_object = selected_object; + mvr2r( data_in_f[selected_object], data_separated_object, input_frame ); + if ( fade_out_separate_object ) + { + v_mult( data_separated_object, hOMasa->fade_out_gain, data_separated_object, input_frame ); + v_mult( data_in_f[selected_object], hOMasa->fade_in_gain, data_in_f[selected_object], input_frame ); + } + else if ( fade_in_separate_object ) + { + v_mult( data_separated_object, hOMasa->fade_in_gain, data_separated_object, input_frame ); + v_mult( data_in_f[selected_object], hOMasa->fade_out_gain, data_in_f[selected_object], input_frame ); + } + else + { + set_zero( data_in_f[selected_object], input_frame ); + } + + /* Estimate energies and ratios */ + ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); + } + + + /* Downmix */ + ivas_omasa_dmx( data_in_f, data_out_f, input_frame, nchan_transport, nchan_ism, hIsmMeta, hOMasa->prev_object_dm_gains, hOMasa->interpolator ); + + return; +} + + +/*--------------------------------------------------------------------------* + * Local functions + *--------------------------------------------------------------------------*/ + +/* Estimate MASA parameters from the objects */ +static void ivas_omasa_param_est_enc( + OMASA_ENC_HANDLE hOMasa, + MASA_ENCODER_HANDLE hMasa, + ISM_METADATA_HANDLE hIsmMeta[], + float data_f[][L_FRAME48k], + float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + float energyRatio[MASA_FREQUENCY_BANDS], + float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + float surroundingCoherence[MASA_FREQUENCY_BANDS], + const int16_t input_frame, + const int16_t nchan_inp ) +{ + float reference_power[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + int16_t ts, i, j, d, k; + int16_t num_freq_bins, num_freq_bands, index; + float dir_v[DIRAC_NUM_DIMS]; + int16_t l_ts; + float Chnl_RealBuffer[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + float Chnl_ImagBuffer[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + float Foa_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + float Foa_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + float diffuseness_vector[MASA_FREQUENCY_BANDS]; + float diffuseness_m[MASA_FREQUENCY_BANDS]; + int16_t band_m_idx, block_m_idx; + float renormalization_factor_diff[MASA_FREQUENCY_BANDS]; + float norm_tmp; + int16_t mrange[2], brange[2]; + + num_freq_bins = hOMasa->cldfbAnaEnc[0]->no_channels; + num_freq_bands = hOMasa->nbands; + l_ts = input_frame / CLDFB_NO_COL_MAX; + + + /* Need to initialize renormalization_factors, and variables to be normalized */ + set_zero( renormalization_factor_diff, hOMasa->nbands ); + set_zero( diffuseness_m, hOMasa->nbands ); + + /* Copy current frame to memory for delay compensation */ + for ( i = 0; i < nchan_inp; i++ ) + { + mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); + } + + /* Compute ISM to FOA matrices */ + for ( i = 0; i < nchan_inp; i++ ) + { + hOMasa->chnlToFoaMtx[0][i] = 1.0f; + hOMasa->chnlToFoaMtx[1][i] = sinf( ( hIsmMeta[i]->azimuth / 180.0f * EVS_PI ) ) * cosf( ( hIsmMeta[i]->elevation / 180.0f * EVS_PI ) ); + hOMasa->chnlToFoaMtx[2][i] = sinf( ( hIsmMeta[i]->elevation / 180.0f * EVS_PI ) ); + hOMasa->chnlToFoaMtx[3][i] = cosf( ( hIsmMeta[i]->azimuth / 180.0f * EVS_PI ) ) * cosf( ( hIsmMeta[i]->elevation / 180.0f * EVS_PI ) ); + } + + /* do processing over all CLDFB time slots */ + for ( block_m_idx = 0; block_m_idx < hOMasa->nSubframes; block_m_idx++ ) + { + mrange[0] = hOMasa->block_grouping[block_m_idx]; + mrange[1] = hOMasa->block_grouping[block_m_idx + 1]; + + for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + hOMasa->direction_vector_m[0][block_m_idx][band_m_idx] = 0.0f; + hOMasa->direction_vector_m[1][block_m_idx][band_m_idx] = 0.0f; + hOMasa->direction_vector_m[2][block_m_idx][band_m_idx] = 0.0f; + } + + set_zero( hMasa->data.energy_ism[block_m_idx], num_freq_bands ); + + for ( ts = mrange[0]; ts < mrange[1]; ts++ ) + { + for ( i = 0; i < nchan_inp; i++ ) + { + if ( ts < hOMasa->num_slots_delay_comp ) + { + cldfbAnalysis_ts( &( hOMasa->delay_buffer[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); + } + else + { + cldfbAnalysis_ts( &( data_f[i][hOMasa->offset_comp + l_ts * ( ts - hOMasa->num_slots_delay_comp )] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); + } + } + + /* Compute energy */ + for ( i = 0; i < num_freq_bands; i++ ) + { + brange[0] = hOMasa->band_grouping[i]; + brange[1] = hOMasa->band_grouping[i + 1]; + for ( j = brange[0]; j < brange[1]; j++ ) + { + for ( k = 0; k < nchan_inp; k++ ) + { + hMasa->data.energy_ism[block_m_idx][i] += Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j]; + } + } + } + + /* Compute FOA */ + /* W */ + mvr2r( Chnl_RealBuffer[0], Foa_RealBuffer[0], num_freq_bins ); + mvr2r( Chnl_ImagBuffer[0], Foa_ImagBuffer[0], num_freq_bins ); + for ( i = 1; i < nchan_inp; i++ ) + { + v_add( Chnl_RealBuffer[i], Foa_RealBuffer[0], Foa_RealBuffer[0], num_freq_bins ); + v_add( Chnl_ImagBuffer[i], Foa_ImagBuffer[0], Foa_ImagBuffer[0], num_freq_bins ); + } + + /* Y */ + v_multc( Chnl_RealBuffer[0], hOMasa->chnlToFoaMtx[1][0], Foa_RealBuffer[1], num_freq_bins ); + v_multc( Chnl_ImagBuffer[0], hOMasa->chnlToFoaMtx[1][0], Foa_ImagBuffer[1], num_freq_bins ); + for ( i = 1; i < nchan_inp; i++ ) + { + v_multc_acc( Chnl_RealBuffer[i], hOMasa->chnlToFoaMtx[1][i], Foa_RealBuffer[1], num_freq_bins ); + v_multc_acc( Chnl_ImagBuffer[i], hOMasa->chnlToFoaMtx[1][i], Foa_ImagBuffer[1], num_freq_bins ); + } + + /* Z */ + v_multc( Chnl_RealBuffer[0], hOMasa->chnlToFoaMtx[2][0], Foa_RealBuffer[2], num_freq_bins ); + v_multc( Chnl_ImagBuffer[0], hOMasa->chnlToFoaMtx[2][0], Foa_ImagBuffer[2], num_freq_bins ); + for ( i = 1; i < nchan_inp; i++ ) + { + v_multc_acc( Chnl_RealBuffer[i], hOMasa->chnlToFoaMtx[2][i], Foa_RealBuffer[2], num_freq_bins ); + v_multc_acc( Chnl_ImagBuffer[i], hOMasa->chnlToFoaMtx[2][i], Foa_ImagBuffer[2], num_freq_bins ); + } + + /* X */ + v_multc( Chnl_RealBuffer[0], hOMasa->chnlToFoaMtx[3][0], Foa_RealBuffer[3], num_freq_bins ); + v_multc( Chnl_ImagBuffer[0], hOMasa->chnlToFoaMtx[3][0], Foa_ImagBuffer[3], num_freq_bins ); + for ( i = 1; i < nchan_inp; i++ ) + { + v_multc_acc( Chnl_RealBuffer[i], hOMasa->chnlToFoaMtx[3][i], Foa_RealBuffer[3], num_freq_bins ); + v_multc_acc( Chnl_ImagBuffer[i], hOMasa->chnlToFoaMtx[3][i], Foa_ImagBuffer[3], num_freq_bins ); + } + + /* Direction estimation */ + computeIntensityVector_enc( hOMasa->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, num_freq_bands, intensity_real ); + computeDirectionVectors( intensity_real[0], intensity_real[1], intensity_real[2], 0, num_freq_bands, direction_vector[0], direction_vector[1], direction_vector[2] ); + + /* Power estimation for diffuseness */ + computeReferencePower_omasa( hOMasa->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, reference_power[ts], 0, num_freq_bands ); + + /* Fill buffers of length "averaging_length" time slots for intensity and energy */ + hOMasa->index_buffer_intensity = ( hOMasa->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + index = hOMasa->index_buffer_intensity; + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + /* only real part needed */ + mvr2r( intensity_real[i], &( hOMasa->buffer_intensity_real[i][index - 1][0] ), num_freq_bands ); + } + mvr2r( reference_power[ts], &( hOMasa->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + + computeDiffuseness( hOMasa->buffer_intensity_real, hOMasa->buffer_energy, num_freq_bands, diffuseness_vector ); + + for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + norm_tmp = reference_power[ts][band_m_idx] * ( 1 - diffuseness_vector[band_m_idx] ); + + hOMasa->direction_vector_m[0][block_m_idx][band_m_idx] += norm_tmp * direction_vector[0][band_m_idx]; + hOMasa->direction_vector_m[1][block_m_idx][band_m_idx] += norm_tmp * direction_vector[1][band_m_idx]; + hOMasa->direction_vector_m[2][block_m_idx][band_m_idx] += norm_tmp * direction_vector[2][band_m_idx]; + + diffuseness_m[band_m_idx] += reference_power[ts][band_m_idx] * diffuseness_vector[band_m_idx]; + renormalization_factor_diff[band_m_idx] += reference_power[ts][band_m_idx]; + } + } + + for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + for ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + dir_v[d] = hOMasa->direction_vector_m[d][block_m_idx][band_m_idx]; + } + ivas_qmetadata_direction_vector_to_azimuth_elevation( dir_v, &azimuth_m_values[block_m_idx][band_m_idx], &elevation_m_values[block_m_idx][band_m_idx] ); + } + + /* Set coherences to zero, as this mode is used at lowest bit rates where the coherences are not transmitted */ + for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + spreadCoherence[block_m_idx][band_m_idx] = 0.0f; + surroundingCoherence[band_m_idx] = 0.0f; + } + } + + /* Determine energy ratios */ + for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + if ( renormalization_factor_diff[band_m_idx] > EPSILON ) + { + diffuseness_m[band_m_idx] /= renormalization_factor_diff[band_m_idx]; + } + else + { + diffuseness_m[band_m_idx] = 0.0f; + } + + energyRatio[band_m_idx] = 1.0f - diffuseness_m[band_m_idx]; + } + + /* Update memory */ + for ( i = 0; i < nchan_inp; i++ ) + { + mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); + } + + return; +} + + +/* Estimate energies and ratios */ +static void ivas_omasa_energy_and_ratio_est( + OMASA_ENC_HANDLE hOMasa, + MASA_ENCODER_HANDLE hMasa, + float data_f[][L_FRAME48k], + const int16_t input_frame, + const int16_t nchan_inp ) +{ + int16_t ts, i, j, k; + int16_t num_freq_bands; + int16_t l_ts; + float Chnl_RealBuffer[MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + float Chnl_ImagBuffer[MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + int16_t block_m_idx; + int16_t mrange[2], brange[2]; + float tftile_energy; + float ism_ratio_sum; + + num_freq_bands = hOMasa->nbands; + l_ts = input_frame / CLDFB_NO_COL_MAX; + + + /* Copy current frame to memory for delay compensation */ + for ( i = 0; i < nchan_inp; i++ ) + { + mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); + } + + /* do processing over all CLDFB time slots */ + for ( block_m_idx = 0; block_m_idx < hOMasa->nSubframes; block_m_idx++ ) + { + mrange[0] = hOMasa->block_grouping[block_m_idx]; + mrange[1] = hOMasa->block_grouping[block_m_idx + 1]; + + /* Reset variable */ + for ( i = 0; i < hOMasa->nbands; i++ ) + { + set_zero( hMasa->data.energy_ratio_ism[block_m_idx][i], nchan_inp ); + } + set_zero( hMasa->data.energy_ism[block_m_idx], num_freq_bands ); + + /* Compute CLDFB */ + for ( ts = mrange[0]; ts < mrange[1]; ts++ ) + { + for ( i = 0; i < nchan_inp; i++ ) + { + if ( ts < hOMasa->num_slots_delay_comp ) + { + cldfbAnalysis_ts( &( hOMasa->delay_buffer[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); + } + else + { + cldfbAnalysis_ts( &( data_f[i][hOMasa->offset_comp + l_ts * ( ts - hOMasa->num_slots_delay_comp )] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); + } + } + + /* Compute energy */ + for ( i = 0; i < num_freq_bands; i++ ) + { + brange[0] = hOMasa->band_grouping[i]; + brange[1] = hOMasa->band_grouping[i + 1]; + for ( j = brange[0]; j < brange[1]; j++ ) + { + for ( k = 0; k < nchan_inp; k++ ) + { + tftile_energy = Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j]; + hMasa->data.energy_ism[block_m_idx][i] += tftile_energy; + hMasa->data.energy_ratio_ism[block_m_idx][i][k] += tftile_energy; + } + } + } + } + + /* Compute ISM energy ratios */ + for ( i = 0; i < num_freq_bands; i++ ) + { + ism_ratio_sum = 0.0f; + for ( j = 0; j < nchan_inp; j++ ) + { + hMasa->data.energy_ratio_ism[block_m_idx][i][j] /= ( hMasa->data.energy_ism[block_m_idx][i] + EPSILON ); + ism_ratio_sum += hMasa->data.energy_ratio_ism[block_m_idx][i][j]; + } + + if ( ism_ratio_sum == 0.0f ) + { + float temp_ism_ratio = 1.0f / ( (float) nchan_inp ); + for ( j = 0; j < nchan_inp; j++ ) + { + hMasa->data.energy_ratio_ism[block_m_idx][i][j] = temp_ism_ratio; + } + } + } + hMasa->data.nchan_ism = nchan_inp; + } + + /* Update memory */ + for ( i = 0; i < nchan_inp; i++ ) + { + mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); + } + + return; +} + + +/* Compute downmix */ +static void ivas_omasa_dmx( + float data_in_f[][L_FRAME48k], + float data_out_f[][L_FRAME48k], + const int16_t input_frame, + const int16_t num_transport_channels, + const int16_t num_input_channels, + ISM_METADATA_HANDLE hIsmMeta[], + float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], + const float interpolator[L_FRAME48k] ) +{ + int16_t i, j, k; + float azimuth, elevation; + float gains[MASA_MAX_TRANSPORT_CHANNELS]; + float g1, g2; + + if ( num_transport_channels == 2 ) + { + for ( i = 0; i < num_transport_channels; i++ ) + { + set_zero( data_out_f[i], input_frame ); + } + + for ( i = 0; i < num_input_channels; i++ ) + { + azimuth = hIsmMeta[i]->azimuth; + elevation = hIsmMeta[i]->elevation; + + ivas_get_stereo_panning_gains( azimuth, elevation, gains ); + + /* Downmix using the panning gains */ + for ( j = 0; j < num_transport_channels; j++ ) + { + if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0 ) + { + for ( k = 0; k < input_frame; k++ ) + { + g1 = interpolator[k]; + g2 = 1.0f - g1; + data_out_f[j][k] += ( g1 * gains[j] + g2 * prev_gains[i][j] ) * data_in_f[i][k]; + } + } + prev_gains[i][j] = gains[j]; + } + } + } + else if ( num_transport_channels == 1 ) + { + for ( i = 0; i < input_frame; i++ ) + { + data_out_f[0][i] = 0.0f; + for ( j = 0; j < num_input_channels; j++ ) + { + data_out_f[0][i] += data_in_f[j][i]; + } + } + } +} + + +static void computeIntensityVector_enc( + const int16_t *band_grouping, + float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], + const int16_t num_frequency_bands, + float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ) +{ + /* Reminder + * X = a + ib; Y = c + id + * X*Y = ac - bd + i(ad +bc) + */ + int16_t i, j; + float real, img; + int16_t brange[2]; + + for ( i = 0; i < num_frequency_bands; i++ ) + { + brange[0] = band_grouping[i]; + brange[1] = band_grouping[i + 1]; + + intensity_real[0][i] = 0; + intensity_real[1][i] = 0; + intensity_real[2][i] = 0; + + for ( j = brange[0]; j < brange[1]; j++ ) + { + real = Cldfb_RealBuffer[0][j]; + img = Cldfb_ImagBuffer[0][j]; + intensity_real[0][i] += Cldfb_RealBuffer[3][j] * real + Cldfb_ImagBuffer[3][j] * img; /* Intensity is XYZ order, audio is WYZX order. */ + intensity_real[1][i] += Cldfb_RealBuffer[1][j] * real + Cldfb_ImagBuffer[1][j] * img; + intensity_real[2][i] += Cldfb_RealBuffer[2][j] * real + Cldfb_ImagBuffer[2][j] * img; + } + } + + return; +} + +static void computeReferencePower_omasa( + const int16_t *band_grouping, /* i : Band grouping for estimation */ + float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ + float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input signal */ + float *reference_power, /* o : Estimated power */ + const int16_t enc_param_start_band, /* i : first band to process */ + const int16_t num_freq_bands /* i : Number of frequency bands */ +) +{ + int16_t brange[2]; + int16_t ch_idx, i, j; + + for ( i = 0; i < num_freq_bands; i++ ) + { + brange[0] = band_grouping[i + enc_param_start_band]; + brange[1] = band_grouping[i + enc_param_start_band + 1]; + reference_power[i] = 0; + + for ( ch_idx = 0; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) + { + /* abs()^2 */ + for ( j = brange[0]; j < brange[1]; j++ ) + { + reference_power[i] += ( Cldfb_RealBuffer[ch_idx][j] * Cldfb_RealBuffer[ch_idx][j] ) + ( Cldfb_ImagBuffer[ch_idx][j] * Cldfb_ImagBuffer[ch_idx][j] ); + } + } + } + + v_multc( reference_power, 0.5f, reference_power, num_freq_bands ); + + return; +} + +#endif /* MASA_AND_OBJECTS */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index c9f0bd70ff..1c9eef86e8 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -64,9 +64,15 @@ static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVA static int16_t ivas_qmetadata_raw_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t nbands, const int16_t start_band ); -static int16_t ivas_qmetadata_encode_extended_gr_length( const uint16_t value, const uint16_t alphabet_size, const int16_t gr_param ); +#ifndef MASA_AND_OBJECTS +static +#endif + int16_t + ivas_qmetadata_encode_extended_gr_length( const uint16_t value, const uint16_t alphabet_size, const int16_t gr_param ); +#ifndef MASA_AND_OBJECTS static void ivas_qmetadata_encode_extended_gr( BSTR_ENC_HANDLE hMetaData, const uint16_t value, const uint16_t alphabet_size, const int16_t gr_param ); +#endif static int16_t ivas_qmetadata_get_optimal_gr_param( uint16_t *unsigned_data, const int16_t count, const int16_t gr_param_count, int16_t *opt_gr_size ); @@ -118,6 +124,10 @@ static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *d static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); +#ifdef MASA_AND_OBJECTS +static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream, BSTR_ENC_HANDLE hMetaData, int16_t first_line ); +#endif + /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_encode() * @@ -2408,11 +2418,14 @@ static int16_t ivas_qmetadata_get_optimal_gr_param( * * *------------------------------------------------------------------------*/ - -static int16_t ivas_qmetadata_encode_extended_gr_length( - const uint16_t value, - const uint16_t alphabet_size, - const int16_t gr_param ) +#ifndef MASA_AND_OBJECTS +static +#endif + int16_t + ivas_qmetadata_encode_extended_gr_length( + const uint16_t value, + const uint16_t alphabet_size, + const int16_t gr_param ) { uint16_t msb_alphabet_size; int16_t bits; @@ -2551,12 +2564,15 @@ static int16_t ivas_qmetadata_reorder_azimuth_index( * * *------------------------------------------------------------------------*/ - -static void ivas_qmetadata_encode_extended_gr( - BSTR_ENC_HANDLE hMetaData, - const uint16_t value, - const uint16_t alphabet_size, - const int16_t gr_param ) +#ifndef MASA_AND_OBJECTS +static +#endif + void + ivas_qmetadata_encode_extended_gr( + BSTR_ENC_HANDLE hMetaData, + const uint16_t value, + const uint16_t alphabet_size, + const int16_t gr_param ) { uint16_t msb_alphabet_size; uint16_t msb, lsb, cnt; @@ -4905,3 +4921,271 @@ static float direction_distance( return d / (float) ( dim1 * dim2 ); } #endif +#ifdef MASA_AND_OBJECTS +static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream, BSTR_ENC_HANDLE hMetaData, int16_t first_line ) +{ + int16_t nb_bits = 0, bits_pos; + int16_t last_non_null; + uint16_t nb_GR_min, i_min, nb_GR; + int16_t i, j; + + bits_pos = hMetaData->nb_bits_tot; + /* write DCT 0 component */ + /* write sign only if not the very first DCT coeff */ + if ( first_line == 0 ) + { + if ( q_idx[0] > 0 ) + { + push_next_indice( hMetaData, 1, 1 ); + push_next_indice( hMetaData, q_idx[0], BITS_MASA2TOTTAL_DCT0 ); /* Todo : define constant */ + } + else + { + push_next_indice( hMetaData, 0, 1 ); + push_next_indice( hMetaData, -q_idx[0], BITS_MASA2TOTTAL_DCT0 ); + } + nb_bits += BITS_MASA2TOTTAL_DCT0 + 1; + } + else + { + push_next_indice( hMetaData, q_idx[0], BITS_MASA2TOTTAL_DCT0 ); + nb_bits += BITS_MASA2TOTTAL_DCT0; + } + + + /* find last non-null position */ + last_non_null = -1; + if ( q_idx[0] != 0 ) + { + last_non_null = len_stream - 1; + while ( ( q_idx[last_non_null] == 0 ) && ( last_non_null >= 0 ) ) + { + last_non_null--; + } + } + if ( last_non_null == -1 ) + { + /* all values are zero; no need to send anything else */ + assert( q_idx[0] == 0 ); + } + else + { + assert( q_idx[0] != 0 ); + /*last_non_null = max(4, last_non_null); */ + + /* write index of last non null index on log2(len_stream) bits */ + j = (int16_t) ceilf( log2f( (float) ( len_stream ) ) ); + push_next_indice( hMetaData, last_non_null, j ); + nb_bits += j; + if ( last_non_null > 0 ) + { + /* find optimum length of the part encoded with GR2 */ + nb_GR_min = 1000; + i_min = 0; + for ( i = 1; i <= last_non_null; i++ ) + { + nb_GR = 0; + for ( j = 1; j <= i; j++ ) + { + nb_GR += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, 2 ); + } + for ( j = i + 1; j <= last_non_null; j++ ) + { + nb_GR += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, 0 ); + } + if ( nb_GR < nb_GR_min ) + { + nb_GR_min = nb_GR; + i_min = i; + } + } + + assert( nb_GR_min < 1000 ); + + + /* write number of indexes encoded with GR2 */ + j = (int16_t) ceilf( log2f( (float) ( last_non_null + 1 ) ) ); + assert( i_min < ( 1 << j ) ); + push_next_indice( hMetaData, i_min, j ); + nb_bits += j; + + /* write GR data */ + for ( i = 1; i <= i_min; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, 2 ); + } + for ( i = i_min + 1; i <= last_non_null; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, 0 ); + } + nb_bits += nb_GR_min; + } + assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); + } + return nb_bits; +} + +void encode_masa_to_total( + IVAS_QMETADATA_HANDLE hQMetaData, + BSTR_ENC_HANDLE hMetaData ) +{ + int16_t i, j, k; + float data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + + + float step = 0.1f; + int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + float dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + float dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; + int16_t nbands; + + int16_t bits_pos, nb_bits; + int16_t n_streams, len_stream; + + nbands = hQMetaData->numCodingBands; +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF = NULL; + static FILE *pF_ratio = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_ism_qidx__enc.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_masa2tot_enc.txt", "w" ); + +#endif + +#ifdef DEBUGGING + assert( ( nbands == 5 || nbands == 8 ) && "Number of subbands in parametric MASA_ISM should be 5 or 8 " ); +#endif + bits_pos = hMetaData->nb_bits_tot; + k = 0; + for ( i = 0; i < nbands; i++ ) + { + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + data[k] = hQMetaData->masa_to_total_energy_ratio[j][i]; + k++; + } + } + + + /* DCT2 transform */ + if ( nbands == 5 ) + { + matrix_product( dct5, nbands, nbands, 0, data, MAX_PARAM_SPATIAL_SUBFRAMES, nbands, 1, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 1, dct_data ); + } + else + { + matrix_product( dct8, nbands, nbands, 0, data, MAX_PARAM_SPATIAL_SUBFRAMES, nbands, 1, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 1, dct_data ); + } + + /* Setup coding parameters */ + if ( nbands == 5 ) + { + n_streams = 1; + len_stream = nbands * MAX_PARAM_SPATIAL_SUBFRAMES; + } + else + { + n_streams = MAX_PARAM_SPATIAL_SUBFRAMES; + len_stream = 8; + } + + for ( k = 0; k < n_streams; k++ ) + { + j = k * len_stream; + /* quantize with fixed common step */ + q_idx[j] = (int16_t) rintf( dct_data[j] / step ); + + if ( q_idx[j] > ( ( 1 << BITS_MASA2TOTTAL_DCT0 ) - 1 ) ) /* limit DCT0 to BITS_MASA2TOTTAL_DCT0 bit representation */ + { + q_idx[j] = ( ( 1 << BITS_MASA2TOTTAL_DCT0 ) - 1 ); + } + q_dct_data[j] = step * q_idx[j]; + if ( q_idx[j] == 0 ) + { + set_s( &q_idx[j], 0, len_stream ); + set_zero( &q_dct_data[j], len_stream ); + } + else + { + for ( i = 1; i < len_stream; i++ ) + { + q_idx[j + i] = (int16_t) rintf( dct_data[j + i] / step ); + q_dct_data[j + i] = step * q_idx[j + i]; + if ( q_idx[j + i] <= 0 ) + { + q_idx[j + i] = -2 * q_idx[j + i]; + } + else + { + q_idx[j + i] = 2 * q_idx[j + i] - 1; + } + } + } + } + + + /* reconstruct masa2total */ + /* inverse DCT2 transform */ + if ( nbands == 5 ) + { + matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); /* reuse of variable*/ + } + else + { + assert( nbands == 8 ); + matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); + } + k = 0; + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = 0; j < nbands; j++ ) + { + hQMetaData->masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); + hQMetaData->masa_to_total_energy_ratio[i][j] = min( 1.0f, hQMetaData->masa_to_total_energy_ratio[i][j] ); + k++; + } + } + + /* write data */ + nb_bits = 0; + for ( i = 0; i < n_streams; i++ ) + { + nb_bits += write_stream_dct_coeffs_omasa( &q_idx[i * len_stream], len_stream, hMetaData, ( i == 0 ) ); + } + + assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); + +#ifdef DEBUG_MODE_QMETADATA + { + + fprintf( pF, "frame %d: ", frame ); + fprintf( pF_ratio, "frame %d: ", frame ); + + + /* direction_distance( elevation_orig, azimuth_orig, q_direction, nbands, nblocks, mat_dist );*/ + for ( i = 0; i < nbands; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + fprintf( pF_ratio, " %5.2f ", hQMetaData->masa_to_total_energy_ratio[j][i] ); + } + } + for ( i = 0; i < 20; i++ ) + { + fprintf( pF, " %4d ", q_idx[i] ); + } + fprintf( pF, "\n" ); + fprintf( pF_ratio, "\n" ); + } +#endif + + return; +} +#endif diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index ba0c27ddd1..e33bdbb078 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -144,7 +144,11 @@ ivas_error ivas_sce_enc( /* set "bits_frame_nominal" */ if ( st_ivas->hQMetaData != NULL && st_ivas->hSpar == NULL ) { +#ifdef MASA_AND_OBJECTS + if ( ( ( st_ivas->mc_mode == MC_MODE_MCMASA ) && ( st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) ) || ( st_ivas->ism_mode >= ISM_MASA_MODE_ONE_OBJ ) ) +#else if ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) +#endif { st->bits_frame_nominal = (int16_t) ( hSCE->element_brate / FRAMES_PER_SEC ); } @@ -330,6 +334,12 @@ ivas_error create_sce_enc( } copy_encoder_config( st_ivas, st, 1 ); +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ism_mode >= ISM_MASA_MODE_PARAM ) + { + st->element_mode = IVAS_SCE; /* To do: Nokia check as this is not optimal and verify if it influences other SCE modes */ + } +#endif st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 0644fcd918..a76ddf692a 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -713,6 +713,13 @@ typedef struct ivas_param_mc_enc_data_structure typedef struct ivas_masa_encoder_data_struct { float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef MASA_AND_OBJECTS + float energy_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* TODO Nokia: Make an own MASAISM struct for these, and reserve it only for OMASA */ + float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + int16_t nchan_ism; + +#endif int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_ENC_CLDFB_INSTANCES]; float *delay_buffer[MASA_MAX_TRANSPORT_CHANNELS]; @@ -796,6 +803,52 @@ typedef struct ivas_mcmasa_enc_data_structure } MCMASA_ENC_DATA, *MCMASA_ENC_HANDLE; +#ifdef MASA_AND_OBJECTS +/*----------------------------------------------------------------------------------* + * Object MASA (OMASA) encoder structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_omasa_enc_data_structure +{ + int16_t nbands; + int16_t nCodingBands; + int16_t nSubframes; + + /* delay compensation */ + float *delay_buffer[MAX_NUM_OBJECTS]; /* Delay buffer for parameter estimation */ + int16_t num_samples_delay_comp; + int16_t num_slots_delay_comp; + int16_t offset_comp; + + /* CLDFB analysis */ + int16_t num_Cldfb_instances; + HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_OBJECTS]; + + /* DirAC parameter estimation */ + float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ + int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; + int16_t block_grouping[5]; + + /* diffuseness */ + int16_t index_buffer_intensity; + float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; + float buffer_energy[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; + + float chnlToFoaMtx[DIRAC_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; + + float interpolator[L_FRAME48k]; + + float prev_object_dm_gains[MAX_NUM_OBJECTS][MASA_MAX_TRANSPORT_CHANNELS]; + float broadband_energy_sm[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; + float broadband_energy_prev[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; + int16_t prev_selected_object; + uint8_t changing_object; + float fade_out_gain[L_FRAME48k]; + float fade_in_gain[L_FRAME48k]; + +} OMASA_ENC_DATA, *OMASA_ENC_HANDLE; +#endif + /*----------------------------------------------------------------------------------* * Stereo CNG handle @@ -1027,6 +1080,9 @@ typedef struct /* high-level encoder parameters */ int16_t nchan_transport; /* number of transport channels */ +#ifdef MASA_AND_OBJECTS + int16_t nchan_ism; +#endif int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t codec_mode; /* Mode1 or Mode2 of core codec */ int16_t last_codec_mode; /* previous frame Mode 1 or 2 */ @@ -1048,6 +1104,9 @@ typedef struct MCT_ENC_HANDLE hMCT; /* MCT handle */ PARAM_MC_ENC_HANDLE hParamMC; /* Parametric MC handle */ MCMASA_ENC_HANDLE hMcMasa; /* Multi-channel MASA data handle */ +#ifdef MASA_AND_OBJECTS + OMASA_ENC_HANDLE hOMasa; /* Object MASA data handle */ +#endif LFE_ENC_HANDLE hLFE; /* LFE data handle */ ISM_MODE ism_mode; /* ISM format mode */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index b3f8dc478d..c3b526f1b2 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -351,6 +351,64 @@ ivas_error IVAS_ENC_ConfigureForStereo( return error; } +#ifdef MASA_AND_OBJECTS +/*---------------------------------------------------------------------* + * IVAS_ENC_ConfigureForMASAObjects() + * + * Configure and initialize the combined MASA and ISM encoder. + *---------------------------------------------------------------------*/ + +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 */ +) +{ + Encoder_Struct *st_ivas; + ivas_error error; + + if ( ( error = doCommonConfigureChecks( hIvasEnc ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( numObjects > MAX_NUM_OBJECTS ) + { + return IVAS_ERR_TOO_MANY_INPUTS; + } + st_ivas = hIvasEnc->st_ivas; + switch ( masaVariant ) + { + case IVAS_ENC_MASA_1CH: + st_ivas->hEncoderConfig->nchan_inp = 1 + numObjects; + st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ + break; + case IVAS_ENC_MASA_2CH: + st_ivas->hEncoderConfig->nchan_inp = 2 + numObjects; + st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ + break; + default: + return IVAS_ERR_INVALID_MASA_CONFIG; + break; + } + + st_ivas = hIvasEnc->st_ivas; + + /* Currently this is true but it is already shown in descriptive metadata that there can be inequality for this. */ + st_ivas->nchan_transport = st_ivas->hEncoderConfig->nchan_inp - numObjects; + + + st_ivas->hEncoderConfig->ivas_format = MASA_ISM_FORMAT; + + st_ivas->nchan_ism = numObjects; + + return configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); +} +#endif /*---------------------------------------------------------------------* * IVAS_ENC_ConfigureForObjects() @@ -418,8 +476,11 @@ ivas_error IVAS_ENC_FeedObjectMetadata( { return IVAS_ERR_NOT_CONFIGURED; } - +#ifdef MASA_AND_OBJECTS + if ( hIvasEnc->st_ivas->hEncoderConfig->ivas_format != ISM_FORMAT && hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) +#else if ( hIvasEnc->st_ivas->hEncoderConfig->ivas_format != ISM_FORMAT ) +#endif { return IVAS_ERR_METADATA_NOT_EXPECTED; } @@ -574,8 +635,11 @@ ivas_error IVAS_ENC_FeedMasaMetadata( { return IVAS_ERR_NOT_CONFIGURED; } - +#ifdef MASA_AND_OBJECTS + if ( hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_FORMAT && hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) +#else if ( hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_FORMAT ) +#endif { return IVAS_ERR_METADATA_NOT_EXPECTED; } @@ -662,7 +726,9 @@ static ivas_error configureEncoder( Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; - +#ifdef MASA_AND_OBJECTS + int32_t cpe_brate; +#endif error = IVAS_ERR_OK; st_ivas = hIvasEnc->st_ivas; @@ -803,6 +869,24 @@ static ivas_error configureEncoder( } } } + +#ifdef MASA_AND_OBJECTS + else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + st_ivas->ism_mode = ivas_omasa_ism_mode_select( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_ism ); + + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_ism ); + + /*adapt element_mode according to the bit-rate*/ + if ( hEncoderConfig->element_mode_init != IVAS_SCE ) + { + if ( cpe_brate >= IVAS_48k ) + { + hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + } + } + } +#endif } else /* EVS mono */ { @@ -1576,7 +1660,12 @@ static ivas_error printConfigInfo_enc( fprintf( stdout, "IVAS mode: Multi-Channel 7.1+4\n" ); } } - +#ifdef MASA_AND_OBJECTS + else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + fprintf( stdout, "IVAS format: MASA and objects format\n" ); + } +#endif /*-----------------------------------------------------------------* * Print CNG update interval, if DTX is activated *-----------------------------------------------------------------*/ diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index dbcb21c989..d66e58e1dd 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -52,6 +52,9 @@ typedef enum _IVAS_ENC_INPUT_FORMAT IVAS_ENC_INPUT_SBA, IVAS_ENC_INPUT_MASA, IVAS_ENC_INPUT_MC, +#ifdef MASA_AND_OBJECTS + IVAS_ENC_INPUT_MASA_ISM, +#endif IVAS_DEC_INPUT_UNKNOWN = 0xffff } IVAS_ENC_INPUT_FORMAT; @@ -96,6 +99,14 @@ typedef enum _IVAS_ENC_MASA_VARIANT IVAS_ENC_MASA_UNDEFINED = 0xffff } IVAS_ENC_MASA_VARIANT; +#ifdef MASA_AND_OBJECTS +typedef enum _IVAS_ENC_COMBINED_FORMAT +{ + IVAS_ENC_MASA_ISM = 1, + IVAS_ENC_COMBINED_UNDEFINED = 0xffff +} IVAS_ENC_COMBINED_FORMAT; +#endif + #ifdef DEBUGGING typedef enum _IVAS_ENC_STEREO_MODE { @@ -185,6 +196,19 @@ ivas_error IVAS_ENC_ConfigureForObjects( const uint16_t numObjects /* i : number of objects to be encoded */ ); +#ifdef MASA_AND_OBJECTS +/*! 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 */ +); +#endif + /*! r: error code */ ivas_error IVAS_ENC_ConfigureForAmbisonics( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index e5407abff4..a69b72f9ce 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -330,8 +330,13 @@ void ivas_renderer_select( } } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) +#else else if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) +#endif { + *internal_config = output_config; if ( output_config == AUDIO_CONFIG_BINAURAL ) { @@ -565,6 +570,21 @@ void ivas_renderer_select( } } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + *renderer_type = RENDERER_DIRAC; + + if ( output_config == AUDIO_CONFIG_MONO ) + { + *renderer_type = RENDERER_MONO_DOWNMIX; + } + else if ( output_config == AUDIO_CONFIG_STEREO ) + { + *renderer_type = RENDERER_STEREO_PARAMETRIC; + } + } +#endif else if ( st_ivas->ivas_format == MC_FORMAT ) { *internal_config = transport_config; -- GitLab From 54394aba7ffb008a6ab7e79db57bed56cb42573f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhold=20B=C3=B6hm?= Date: Thu, 22 Dec 2022 11:52:34 +0100 Subject: [PATCH 005/591] added CLDFB codec implementation --- Workspace_msvc/lib_rend.vcxproj | 15 +- Workspace_msvc/renderer.vcxproj | 6 +- lib_com/ivas_prot.h | 9 +- lib_dec/ivas_stat_dec.h | 20 + lib_rend/ivas_cldfb_trans_codec/Bitstream.c | 226 +++ lib_rend/ivas_cldfb_trans_codec/Bitstream.h | 62 + lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c | 912 +++++++++++ lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h | 32 + lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c | 1226 ++++++++++++++ lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h | 33 + lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c | 1457 +++++++++++++++++ lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h | 305 ++++ lib_rend/ivas_cldfb_trans_codec/NoiseGen.c | 47 + lib_rend/ivas_cldfb_trans_codec/NoiseGen.h | 35 + .../ivas_cldfb_trans_codec/PerceptualModel.c | 160 ++ .../ivas_cldfb_trans_codec/PerceptualModel.h | 18 + .../ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c | 31 + .../ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h | 25 + .../ivas_cldfb_trans_codec/RMSEnvGrouping.c | 378 +++++ .../ivas_cldfb_trans_codec/RMSEnvGrouping.h | 31 + lib_rend/ivas_cldfb_trans_codec/Tables.c | 116 ++ lib_rend/ivas_cldfb_trans_codec/Tables.h | 65 + lib_rend/ivas_splitRend_lcld_dec.c | 111 +- lib_rend/ivas_splitRend_lcld_enc.c | 127 +- lib_rend/ivas_splitRendererPre.c | 20 +- lib_rend/lib_rend.c | 10 +- 26 files changed, 5453 insertions(+), 24 deletions(-) create mode 100644 lib_rend/ivas_cldfb_trans_codec/Bitstream.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/Bitstream.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/NoiseGen.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/NoiseGen.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h create mode 100644 lib_rend/ivas_cldfb_trans_codec/Tables.c create mode 100644 lib_rend/ivas_cldfb_trans_codec/Tables.h diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index af88421f8b..0cef2758b9 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true @@ -197,6 +197,15 @@ + + + + + + + + + diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 6ca03f67dd..250d5c6025 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -86,7 +86,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lib_rend\ivas_cldfb_trans_codec;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -130,7 +130,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lib_rend\ivas_cldfb_trans_codec;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) @@ -180,7 +180,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lib_rend\ivas_cldfb_trans_codec;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fea2bef693..62050015c6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4680,7 +4680,10 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend); ivas_error ivas_splitBinLCLDEncOpen( - BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ); + BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, + int32_t iSampleRate, + int32_t iChannels, + int32_t iDataRate ); void ivas_splitBinLCLDEncClose( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ); @@ -4692,7 +4695,9 @@ void ivas_splitBinLCLDEncProcess( ivas_split_rend_bits_t *pBits ); ivas_error ivas_splitBinLCLDDecOpen( - BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ); + BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, + int32_t iSampleRate, + int32_t iChannels ); void ivas_splitBinLCLDDecClose( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 0b346d0036..65d2af32f9 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -42,6 +42,10 @@ #include "ivas_stat_rend.h" #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "ivas_cldfb_trans_codec/CQMFEncoder.h" +#include "ivas_cldfb_trans_codec/CQMFDecoder.h" +#endif /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) @@ -1344,11 +1348,27 @@ typedef struct ivas_binaural_head_rot_split_post_rendering_struct typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct { void *pLcld_enc; + int32_t iChannels; + CQMFEncoder *psCQMFEncoder; + float ***pppfCQMFReal; + float ***pppfCQMFImag; +#ifdef CLDFB_DEBUG + FILE *cldfbIn; + int numFrame; +#endif } BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE; typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct { void *pLcld_dec; + int32_t iChannels; + CQMFDecoder *psCQMFDecoder; + float ***pppfDecCQMFReal; + float ***pppfDecCQMFImag; +#ifdef CLDFB_DEBUG + FILE *cldfbOut; + int numFrame; +#endif } BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE; typedef struct diff --git a/lib_rend/ivas_cldfb_trans_codec/Bitstream.c b/lib_rend/ivas_cldfb_trans_codec/Bitstream.c new file mode 100644 index 0000000000..e542fcb15e --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/Bitstream.c @@ -0,0 +1,226 @@ +#include "Bitstream.h" + +#include +#include +#include "wmops.h" + +#define MAX_BUFFER 1024 + +static const unsigned int MASKS[] = +{ + 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, + 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, + 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, + 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, +}; + +Bitstream* CreateBitstream(const int iDirection, + const int iMaxBuffer) + +{ + + int n; + Bitstream *psBitstream; + + psBitstream = (Bitstream*)malloc(sizeof(Bitstream)); + + psBitstream->iDirection =iDirection; + psBitstream->iMaxBuffer = iMaxBuffer; + psBitstream->iIndex = 0; + psBitstream->iBufferEnd = 0; + psBitstream->iBufferStart = 0; + psBitstream->iError = BS_ERROR_NONE; + + if(psBitstream->iMaxBuffer == -1){ + psBitstream->iMaxBuffer = MAX_BUFFER; + } + + psBitstream->puchBuffer = (unsigned char*)malloc(sizeof(unsigned char) * psBitstream->iMaxBuffer); + + for(n = 0; n < psBitstream->iMaxBuffer; n ++){ + psBitstream->puchBuffer[n] = 0; + } + + return psBitstream; +} + +void DeleteBitstream(Bitstream *psBitstream) +{ + free(psBitstream->puchBuffer); + free(psBitstream); +} + +void BSFlushBuffer(Bitstream *psBitstream) +{ + memset(psBitstream->puchBuffer,0,psBitstream->iMaxBuffer); + psBitstream->iIndex = 0; + psBitstream->iBufferEnd = 0; + psBitstream->iBufferStart = 0; + psBitstream->iError = BS_ERROR_NONE; +} + +int BSPutBytes(Bitstream *psBitstream, + const unsigned char *puchBytes, + const int iByteCount) +{ + int n; + for(n = 0; n < iByteCount; n ++){ + psBitstream->puchBuffer[psBitstream->iBufferEnd] = puchBytes[n]; + psBitstream->iBufferEnd ++; + } + if(psBitstream->iDirection != BS_READ){ + psBitstream->iError = BS_ERROR_FAIL; + } + + return psBitstream->iError; +} + +int BSGetBytes(Bitstream *psBitstream, + unsigned char *puchBytes, + int iByteCount) +{ + int n; + for(n = 0; n < iByteCount; n++){ + puchBytes[n] = psBitstream->puchBuffer[psBitstream->iBufferStart]; + psBitstream->puchBuffer[psBitstream->iBufferStart] = 0; + psBitstream->iBufferStart ++; + } + if(psBitstream->iDirection != BS_WRITE){ + psBitstream->iError = BS_ERROR_FAIL; + } + + return psBitstream->iError; +} + +int BSByteAlign(Bitstream *psBitstream) +{ + if(psBitstream->iDirection == BS_WRITE){ + if(psBitstream->iIndex & 0x7){ + int iByte; + int iRem; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - (psBitstream->iIndex - (iByte<<3)); + psBitstream->puchBuffer[iByte] &= (0xff ^ MASKS[iRem]); + psBitstream->iIndex += iRem; + } + } + else{ + if(psBitstream->iIndex & 0x7){ + int iByte; + int iRem; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - (psBitstream->iIndex - (iByte<<3)); + psBitstream->iIndex += iRem; + } + } + + return psBitstream->iError; +} + +int BSPutBits(Bitstream *psBitstream, + int iValue, + int iBitCount) +{ + iValue &= MASKS[iBitCount]; + while(iBitCount){ + int iByte; + int iRem; + int iShift; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - (psBitstream->iIndex - (iByte<<3)); //8 - psBitstream->iIndex & 0x7; + + iShift = iBitCount-iRem; + if(iShift <= 0){ + iShift *= -1; + psBitstream->puchBuffer[iByte] += (unsigned char) (iValue<iIndex += iBitCount; + iBitCount = 0; + } + else{ + psBitstream->puchBuffer[iByte] += (unsigned char) (iValue>>iShift); + iValue &= MASKS[iShift]; + psBitstream->iIndex += iRem; + iBitCount -= iRem; + } + } + + if(psBitstream->iDirection != BS_WRITE){ + psBitstream->iError = BS_ERROR_FAIL; + } + + return psBitstream->iError; +} + +int BSGetBits(Bitstream *psBitstream, + int iBitCount) +{ + int iValue = 0; + + while(iBitCount){ + unsigned char uchByte; + int iByte; + int iRem; + int iShift; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - (psBitstream->iIndex - (iByte << 3)); //8 - psBitstream->iIndex & 0x7; + uchByte = psBitstream->puchBuffer[iByte]; + iShift = iBitCount - iRem; + + if(iShift <= 0){ + iShift *= -1; + iValue += (int)((uchByte >> iShift) & MASKS[iBitCount]); + psBitstream->iIndex += iBitCount; + iBitCount = 0; + } + else{ + uchByte &= MASKS[iRem]; + iValue += (((int)uchByte)<iIndex += iRem; + iBitCount -= iRem; + } + } + + if(psBitstream->iDirection != BS_READ){ + psBitstream->iError = BS_ERROR_FAIL; + } + + return iValue; +} + +int BSForceBack(Bitstream *psBitstream, + int iValue, + int iBitCount) +{ + psBitstream->iIndex -= iBitCount; + return (iValue>>iBitCount); +} + +int BSGetByteCount(Bitstream *psBitstream) +{ + int iBytes; + iBytes = psBitstream->iIndex>>3; + if((iBytes << 3) != psBitstream->iIndex){ + iBytes ++; + } + + return iBytes; +} + +unsigned char* BSGetBuffer(Bitstream *psBitstream) +{ + return psBitstream->puchBuffer; +} + +int BSGetAvailableBytes(Bitstream *psBitstream) +{ + return psBitstream->iBufferEnd; +} + +int BSGetError(Bitstream *psBitstream) +{ + return psBitstream->iError; +} diff --git a/lib_rend/ivas_cldfb_trans_codec/Bitstream.h b/lib_rend/ivas_cldfb_trans_codec/Bitstream.h new file mode 100644 index 0000000000..a3e936e59b --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/Bitstream.h @@ -0,0 +1,62 @@ +#ifndef _BITSTREAM_H_ +#define _BITSTREAM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum{BS_READ,BS_WRITE}; +enum{BS_ERROR_NONE,BS_ERROR_FAIL}; + +typedef struct BITSTREAM{ + int iMaxBuffer; + int iDirection; + int iBufferEnd; + int iBufferStart; + int iIndex; + int iError; + unsigned char *puchBuffer; +}Bitstream; + + +Bitstream* CreateBitstream(const int iDirection, + const int iMaxBuffer); + +void DeleteBitstream(Bitstream *psBitstream); + +void BSFlushBuffer(Bitstream *psBitstream); + +int BSPutBytes(Bitstream *psBitstream, + const unsigned char *puchBytes, + const int iByteCount); + +int BSGetBytes(Bitstream *psBitstream, + unsigned char *puchBytes, + int iByteCount); + +int BSByteAlign(Bitstream *psBitstream); + +int BSPutBits(Bitstream *psBitstream, + int iValue, + int iBitCount); + +int BSGetBits(Bitstream *psBitstream, + int iBitCount); + +int BSForceBack(Bitstream *psBitstream, + int iValue, + int iBitCount); + +unsigned char* BSGetBuffer(Bitstream *psBitstream); + +int BSGetByteCount(Bitstream *psBitstream); + +int BSGetAvailableBytes(Bitstream *psBitstream); + +int BSGetError(Bitstream *psBitstream); + +#ifdef __cplusplus +} +#endif + +#endif /* _BITSTREAM_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c new file mode 100644 index 0000000000..40d627e612 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c @@ -0,0 +1,912 @@ +#include "CQMFDecoder.h" + +#include +#include +#include +#include +#include "Tables.h" +#include "wmops.h" +#include "PerceptualModel.h" +#include "RMSEnvDeltaHuff.h" +#include "CQMFHuff.h" +#include "NoiseGen.h" +#include "Bitstream.h" + +typedef struct CQMF_DECODER{ + int iSampleRate; + int iChannels; + int iNumBlocks; + + int iNumBands; + const int *piBandwidths; + + int iMSMode; + int *piMSFlags; + + int iCommonGrouping; + int *piNumGroups; + int **ppiGroupLengths; + + int ***pppiRMSEnvelope; + int ***pppiSMR; + int ***pppiExcitation; + int ***pppiAlloc; + + int iAllocOffset; + + int ***pppiCQMFSignReal; + int ***pppiCQMFSignImag; + int ***pppiQCQMFReal; + int ***pppiQCQMFImag; + + Bitstream *psBSRead; + + NoiseGen *psNoiseGen; + + int iLastError; +}CQMFDecoder; + +CQMFDecoder* CreateCQMFDecoder(const int iSampleRate, + const int iChannels) +{ + int n; + CQMFDecoder *psCQMFDecoder = NULL; + + assert(iSampleRate == 48000); //Fix + + psCQMFDecoder = (CQMFDecoder*)malloc(sizeof(CQMFDecoder)); + psCQMFDecoder->iSampleRate = iSampleRate; + psCQMFDecoder->iChannels = iChannels; + psCQMFDecoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; + psCQMFDecoder->iAllocOffset = 0; + + psCQMFDecoder->iNumBands = MAX_BANDS_48; //Fix + psCQMFDecoder->piBandwidths = c_aiBandwidths48; //Fix + + psCQMFDecoder->iMSMode = 0; + psCQMFDecoder->piMSFlags = (int*)malloc(MAX_BANDS * sizeof(int)); + + psCQMFDecoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo + psCQMFDecoder->piNumGroups = (int*)malloc(psCQMFDecoder->iChannels * sizeof(int)); + psCQMFDecoder->ppiGroupLengths = (int**)malloc(psCQMFDecoder->iChannels * sizeof(int*)); + psCQMFDecoder->pppiRMSEnvelope = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiSMR = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiExcitation = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiAlloc = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + + psCQMFDecoder->pppiCQMFSignReal = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiCQMFSignImag = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiQCQMFReal = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiQCQMFImag = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + for(n = 0; n < iChannels ; n ++){ + int k; + psCQMFDecoder->ppiGroupLengths[n] = (int*)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); + psCQMFDecoder->pppiRMSEnvelope[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiSMR[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiExcitation[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiAlloc[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + + psCQMFDecoder->pppiCQMFSignReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiCQMFSignImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiQCQMFReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiQCQMFImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + psCQMFDecoder->pppiRMSEnvelope[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiSMR[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiExcitation[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiAlloc[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + + psCQMFDecoder->pppiCQMFSignReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiCQMFSignImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiQCQMFReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiQCQMFImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + } + } + + psCQMFDecoder->psBSRead = CreateBitstream(BS_READ,4096); + + psCQMFDecoder->psNoiseGen = NULL;//CreateNoiseGen(); // No noise fill for now + + psCQMFDecoder->iLastError = DECODER_ERROR_NONE; + + return psCQMFDecoder; +} + +void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) +{ + if(psCQMFDecoder != NULL){ + + if(psCQMFDecoder->piMSFlags != NULL){ + free(psCQMFDecoder->piMSFlags); + } + + if(psCQMFDecoder->piNumGroups != NULL){ + free(psCQMFDecoder->piNumGroups); + } + + if(psCQMFDecoder->ppiGroupLengths != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + free(psCQMFDecoder->ppiGroupLengths[n]); + } + free(psCQMFDecoder->ppiGroupLengths); + } + + if(psCQMFDecoder->pppiRMSEnvelope != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiRMSEnvelope[n][k]); + } + free(psCQMFDecoder->pppiRMSEnvelope[n]); + } + free(psCQMFDecoder->pppiRMSEnvelope); + } + + if(psCQMFDecoder->pppiSMR != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiSMR[n][k]); + } + free(psCQMFDecoder->pppiSMR[n]); + } + free(psCQMFDecoder->pppiSMR); + } + + if(psCQMFDecoder->pppiExcitation != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiExcitation[n][k]); + } + free(psCQMFDecoder->pppiExcitation[n]); + } + free(psCQMFDecoder->pppiExcitation); + } + + if(psCQMFDecoder->pppiAlloc != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiAlloc[n][k]); + } + free(psCQMFDecoder->pppiAlloc[n]); + } + free(psCQMFDecoder->pppiAlloc); + } + + if(psCQMFDecoder->pppiCQMFSignReal != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiCQMFSignReal[n][k]); + } + free(psCQMFDecoder->pppiCQMFSignReal[n]); + } + free(psCQMFDecoder->pppiCQMFSignReal); + } + + if(psCQMFDecoder->pppiCQMFSignImag != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiCQMFSignImag[n][k]); + } + free(psCQMFDecoder->pppiCQMFSignImag[n]); + } + free(psCQMFDecoder->pppiCQMFSignImag); + } + + if(psCQMFDecoder->pppiQCQMFReal != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiQCQMFReal[n][k]); + } + free(psCQMFDecoder->pppiQCQMFReal[n]); + } + free(psCQMFDecoder->pppiQCQMFReal); + } + + if(psCQMFDecoder->pppiQCQMFImag != NULL){ + int n; + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFDecoder->pppiQCQMFImag[n][k]); + } + free(psCQMFDecoder->pppiQCQMFImag[n]); + } + free(psCQMFDecoder->pppiQCQMFImag); + } + + if(psCQMFDecoder->psBSRead != NULL){ + DeleteBitstream(psCQMFDecoder->psBSRead); + } + + if(psCQMFDecoder->psNoiseGen != NULL){ + DeleteNoiseGen(psCQMFDecoder->psNoiseGen); + } + + free(psCQMFDecoder); + } +} + +int CQMFDecoderGetError(CQMFDecoder *psCQMFDecoder) +{ + return psCQMFDecoder->iLastError; +} + +static void ApplyRMSEnvelope(const int iNumBands, + const int *piBandwidths, + const int iNumGroups, + const int *piGroupLengths, + const int **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag); + +static void ReplaceSign(const int iNumBlocks, + const int iNumCQMFBands, + const int **ppiSignReal, + const int **ppiSignImag, + float **ppfReal, + float **ppfImag); + +static void InvQuantizeSpectrum(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiQReal, + const int **ppiQImag, + float **ppfReal, + float **ppfImag, + NoiseGen *psNoiseGen); //Nullable + +static void InvMSCoding(const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + const int iMSMode, + const int *piMSFlags, + float ***pppfReal, + float ***pppfImag); + +/* Currently only the number of bands in frame */ +static int ReadHeaderInformation(int *piNumBands, + Bitstream *psBSRead); + +static int ReadMSInformation(const int iNumBands, + int *piMSMode, + int *piMSFlags, + Bitstream *psBSRead); + +static int ReadGroupInformation(const int iChannels, + int *piCommonGrouping, + int *piNumGroups, + int **ppiGroupLengths, + Bitstream *psBSRead); + +static int ReadHuff(const unsigned int (*pauiHuffDecTable)[HUFF_DEC_TABLE_SIZE], + int *piSymbol, + Bitstream *psBSRead); + +static int ReadRMSEnvelope(const int iChannels, + const int *piNumGroups, + const int iNumBands, + int ***pppiRMSEnvelope, + Bitstream *psBSRead); + +static int ReadAllocInformation(int *piAllocOffset, + Bitstream *psBSRead); + +static int ReadCQMFData( const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + int **ppiSignReal, + int **ppiSignImag, + int **ppiQReal, + int **ppiQImag, + Bitstream *psBSRead); + +static void ComputeAllocation(const int iChannels, + const int *piNumGroups, + const int iNumBands, + const int ***pppiSMR, + const int iAllocOffset, + int ***pppiAlloc); + +int DecodeFrame(CQMFDecoder *psCQMFDecoder, + const int iNumBytes, + const unsigned char *puchData, + float ***pppfCQMFReal, + float ***pppfCQMFImag) +{ + int n; + int iBitsRead; + + iBitsRead = 0; + + BSFlushBuffer(psCQMFDecoder->psBSRead); + BSPutBytes(psCQMFDecoder->psBSRead,puchData,iNumBytes); + + iBitsRead += ReadHeaderInformation(&psCQMFDecoder->iNumBands, + psCQMFDecoder->psBSRead); + + if(psCQMFDecoder->iChannels == 2){ + iBitsRead += ReadMSInformation(psCQMFDecoder->iNumBands, + &psCQMFDecoder->iMSMode, + psCQMFDecoder->piMSFlags, + psCQMFDecoder->psBSRead); + } + + iBitsRead += ReadGroupInformation(psCQMFDecoder->iChannels, + &psCQMFDecoder->iCommonGrouping, + psCQMFDecoder->piNumGroups, + psCQMFDecoder->ppiGroupLengths, + psCQMFDecoder->psBSRead); + + iBitsRead += ReadRMSEnvelope(psCQMFDecoder->iChannels, + (const int*)psCQMFDecoder->piNumGroups, + psCQMFDecoder->iNumBands, + psCQMFDecoder->pppiRMSEnvelope, + psCQMFDecoder->psBSRead); + + iBitsRead += ReadAllocInformation(&psCQMFDecoder->iAllocOffset, + psCQMFDecoder->psBSRead); + + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ // This will be updated to support multiple sample rates + int k; + for(k = 0; k < psCQMFDecoder->piNumGroups[n]; k ++){ + PerceptualModel(psCQMFDecoder->iNumBands, + psCQMFDecoder->pppiRMSEnvelope[n][k], + psCQMFDecoder->pppiExcitation[n][k], + psCQMFDecoder->pppiSMR[n][k]); + + } + } + + ComputeAllocation(psCQMFDecoder->iChannels, + (const int*)psCQMFDecoder->piNumGroups, + psCQMFDecoder->iNumBands, + (const int***)psCQMFDecoder->pppiSMR, + psCQMFDecoder->iAllocOffset, + psCQMFDecoder->pppiAlloc); + + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + iBitsRead += ReadCQMFData(psCQMFDecoder->piNumGroups[n], + (const int*)psCQMFDecoder->ppiGroupLengths[n], + psCQMFDecoder->iNumBands, + psCQMFDecoder->piBandwidths, + (const int**)psCQMFDecoder->pppiAlloc[n], + psCQMFDecoder->pppiCQMFSignReal[n], + psCQMFDecoder->pppiCQMFSignImag[n], + psCQMFDecoder->pppiQCQMFReal[n], + psCQMFDecoder->pppiQCQMFImag[n], + psCQMFDecoder->psBSRead); + } + + for(n = 0; n < psCQMFDecoder->iChannels; n ++){ + InvQuantizeSpectrum(psCQMFDecoder->piNumGroups[n], + (const int*)psCQMFDecoder->ppiGroupLengths[n], + psCQMFDecoder->iNumBands, + psCQMFDecoder->piBandwidths, + (const int**)psCQMFDecoder->pppiAlloc[n], + (const int**)psCQMFDecoder->pppiQCQMFReal[n], + (const int**)psCQMFDecoder->pppiQCQMFImag[n], + pppfCQMFReal[n], + pppfCQMFImag[n], + psCQMFDecoder->psNoiseGen); + + ReplaceSign(psCQMFDecoder->iNumBlocks, + CQMF_BANDS, + (const int**)psCQMFDecoder->pppiCQMFSignReal[n], + (const int**)psCQMFDecoder->pppiCQMFSignImag[n], + pppfCQMFReal[n], + pppfCQMFImag[n]); + + + ApplyRMSEnvelope(psCQMFDecoder->iNumBands, + psCQMFDecoder->piBandwidths, + psCQMFDecoder->piNumGroups[n], + (const int*)psCQMFDecoder->ppiGroupLengths[n], + (const int **)psCQMFDecoder->pppiRMSEnvelope[n], + pppfCQMFReal[n], + pppfCQMFImag[n]); + } + + if(psCQMFDecoder->iChannels == 2 && psCQMFDecoder->iMSMode > 0){ + InvMSCoding(psCQMFDecoder->iNumBlocks, + psCQMFDecoder->iNumBands, + psCQMFDecoder->piBandwidths, + psCQMFDecoder->iMSMode, + (const int*)psCQMFDecoder->piMSFlags, + pppfCQMFReal, + pppfCQMFImag); + } + + //printf("Bits Read %d\n",iBitsRead); + + return psCQMFDecoder->iLastError; +} + +static void ApplyRMSEnvelope(const int iNumBands, + const int *piBandwidths, + const int iNumGroups, + const int *piGroupLengths, + const int **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag) +{ + int n; + int iBlockOffset; + + iBlockOffset = 0; + for(n = 0; n < iNumGroups; n ++){ + int k; + + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iRMSEnv; + float fGain; + + iRMSEnv = ppiRMSEnvelope[n][b]; + fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER + iRMSEnv]; + for(m = 0; m < piBandwidths[b]; m ++){ + ppfReal[iBlockOffset][iFBOffset] *= fGain; + ppfImag[iBlockOffset][iFBOffset] *= fGain; + iFBOffset ++; + } + } + iBlockOffset ++; + } + } +} + +static void ReplaceSign(const int iNumBlocks, + const int iNumCQMFBands, + const int **ppiSignReal, + const int **ppiSignImag, + float **ppfReal, + float **ppfImag) +{ + int n; + for(n = 0; n < iNumBlocks; n ++){ + int b; + for(b = 0; b < iNumCQMFBands; b ++){ + if(ppiSignReal[n][b] == 1){ + ppfReal[n][b] = -ppfReal[n][b]; + } + if(ppiSignImag[n][b] == 1){ + ppfImag[n][b] = -ppfImag[n][b]; + } + } + } +} + +static void InvQuantizeSpectrum(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiQReal, + const int **ppiQImag, + float **ppfReal, + float **ppfImag, + NoiseGen *psNoiseGen) // Pass in NULL to swicth off noise gen +{ + int n; + int iBlockOffest; + + iBlockOffest = 0; + for(n = 0; n < iNumGroups; n ++){ + int k; + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iAlloc; + float fInvSCFGain; + + iAlloc = ppiAlloc[n][b]; + fInvSCFGain = c_afInvScaleFactor[iAlloc]; + + if(iAlloc > 0){ + for(m = 0; m < piBandwidths[b]; m ++){ + int iQuantValue; + + iQuantValue = ppiQReal[iBlockOffest][iFBOffset]; + ppfReal[iBlockOffest][iFBOffset] = (float)iQuantValue * fInvSCFGain; + + iQuantValue = ppiQImag[iBlockOffest][iFBOffset]; + ppfImag[iBlockOffest][iFBOffset] = (float)iQuantValue * fInvSCFGain; + + iFBOffset ++; + } + } + else if(psNoiseGen != NULL){ + for(m = 0; m < piBandwidths[b]; m ++){ + ppfReal[iBlockOffest][iFBOffset] = 0.7f * GetNoise(psNoiseGen); + ppfImag[iBlockOffest][iFBOffset] = 0.7f * GetNoise(psNoiseGen); + + iFBOffset ++; + } + } + else{ + iFBOffset += piBandwidths[b]; + } + + } + + iBlockOffest ++; + } + } +} + +static void InvMSCoding(const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + const int iMSMode, + const int *piMSFlags, + float ***pppfReal, + float ***pppfImag) +{ + if(iMSMode > 0){ + int b; + int iFBOffset; + + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + if(piMSFlags[b] == 1){ + int n; + for(n = 0; n < piBandwidths[b]; n ++){ + int k; + for(k = 0; k < iNumBlocks; k ++){ + float fLeftReal; + float fLeftImag; + float fRightReal; + float fRightImag; + + fLeftReal = (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); + fLeftImag = (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); + fRightReal = (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); + fRightImag = (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); + + pppfReal[0][k][iFBOffset] = fLeftReal; + pppfReal[1][k][iFBOffset] = fRightReal; + pppfImag[0][k][iFBOffset] = fLeftImag; + pppfImag[1][k][iFBOffset] = fRightImag; + } + iFBOffset ++; + } + } + else{ + iFBOffset += piBandwidths[b]; + } + } + } +} + +/* Currently only the number of bands in frame */ +static int ReadHeaderInformation(int *piNumBands, + Bitstream *psBSRead) +{ + int iBitsRead; + + iBitsRead = 0; + *piNumBands = BSGetBits(psBSRead, 5); + iBitsRead += 5; + + return iBitsRead; +} + +static int ReadMSInformation(const int iNumBands, + int *piMSMode, + int *piMSFlags, + Bitstream *psBSRead) +{ + int iBitsRead; + + iBitsRead = 0; + *piMSMode = BSGetBits(psBSRead,2); + iBitsRead += 2; + + if(*piMSMode == 0){ + int n; + for(n = 0; n > 16); + } + + if(iVal){ + BSForceBack(psBSRead,iIndex,iVal); + iBitsRead -= iVal; + } + + *piSymbol = iSymbol; + + return iBitsRead; +} + +static int ReadRMSEnvelope(const int iChannels, + const int *piNumGroups, + const int iNumBands, + int ***pppiRMSEnvelope, + Bitstream *psBSRead) +{ + int n; + int iBitsRead; + + iBitsRead = 0; + for(n = 0; n < iChannels; n ++){ + int k; + for(k = 0; k < piNumGroups[n]; k ++){ + int b; + int iLastRMSVal; + + iLastRMSVal = BSGetBits(psBSRead,ENV0_BITS); + iBitsRead += ENV0_BITS; + + iLastRMSVal += ENV_MIN; + pppiRMSEnvelope[n][k][0] = iLastRMSVal; + for(b = 1; b < iNumBands; b ++){ + int iDelta; + + iBitsRead += ReadHuff(c_aaiRMSEnvHuffDec,&iDelta,psBSRead); + + iDelta += ENV_DELTA_MIN; + iLastRMSVal += iDelta; + pppiRMSEnvelope[n][k][b] = iLastRMSVal; + } + } + } + + return iBitsRead; +} + +static int ReadAllocInformation(int *piAllocOffset, + Bitstream *psBSRead) +{ + int iBitsRead; + + iBitsRead = 0; + + *piAllocOffset = BSGetBits(psBSRead,ALLOC_OFFSET_BITS); + *piAllocOffset += MIN_ALLOC_OFFSET; + iBitsRead += ALLOC_OFFSET_BITS; + + return iBitsRead; +} + +static int ReadCQMFData(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + int **ppiSignReal, + int **ppiSignImag, + int **ppiQReal, + int **ppiQImag, + Bitstream *psBSRead) +{ + int n; + int iBitsRead; + int iBlockOffest; + + iBitsRead = 0; + iBlockOffest = 0; + for(n = 0; n < iNumGroups; n ++){ + int k; + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iAlloc; + int iHuffDim; + int iHuffMod; + + iAlloc = ppiAlloc[n][b]; + + iHuffDim = c_aiHuffmanDim[iAlloc]; + iHuffMod = c_aiHuffmanMod[iAlloc]; + + + if(iAlloc > 0){ + const unsigned int (*pauiHuffmanTable)[HUFF_DEC_TABLE_SIZE] = NULL; //const? + + pauiHuffmanTable = GetHuffDecTable(iAlloc); + for(m = 0; m < piBandwidths[b]; m ++){ + int iQuantValue1 = 0; + int iQuantValue2 = 0; + + if(iHuffDim == 2){ + int iSymbol; + + iBitsRead += ReadHuff(pauiHuffmanTable,&iSymbol,psBSRead); + iQuantValue1 = iSymbol / iHuffMod; + iQuantValue2 = iSymbol % iHuffMod; + } + else{ + iBitsRead += ReadHuff(pauiHuffmanTable,&iQuantValue1,psBSRead); + iBitsRead += ReadHuff(pauiHuffmanTable,&iQuantValue2,psBSRead); + } + + ppiQReal[iBlockOffest][iFBOffset] = iQuantValue1; + ppiQImag[iBlockOffest][iFBOffset] = iQuantValue2; + + if(iQuantValue1 > 0){ + ppiSignReal[iBlockOffest][iFBOffset] = BSGetBits(psBSRead,1); + iBitsRead += 1; + } + if(iQuantValue2 > 0){ + ppiSignImag[iBlockOffest][iFBOffset] = BSGetBits(psBSRead,1); + iBitsRead += 1; + } + + iFBOffset ++; + } + } + else{ + iFBOffset += piBandwidths[b]; + } + + } + + iBlockOffest ++; + } + } + + return iBitsRead; +} + +static void ComputeAllocation(const int iChannels, + const int *piNumGroups, + const int iNumBands, + const int ***pppiSMR, + const int iAllocOffset, + int ***pppiAlloc) +{ + int n; + + for(n = 0; n < iChannels; n ++){ + int k; + for(k = 0; k < piNumGroups[n]; k ++){ + int b; + for(b = 0; b < iNumBands; b ++){ + int iAlloc; + iAlloc = ((pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE) >> 5); + iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; + iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; + pppiAlloc[n][k][b] = iAlloc; + } + } + } +} diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h new file mode 100644 index 0000000000..e865343cd9 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h @@ -0,0 +1,32 @@ +#ifndef _CQMF_DECODER_H_ +#define _CQMF_DECODER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define DECODER_ERROR_NONE (0) +#define DECODER_ERROR_FS_NOT_SUPPORTED (-1) +#define DECODER_ERROR_CHAN_NOT_SUPPORTED (-2) +#define DECODER_ERROR_UNKNOWN (-100) + +typedef struct CQMF_DECODER CQMFDecoder; + +CQMFDecoder* CreateCQMFDecoder(const int iSampleRate, + const int iChannels); + +void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder); + +int CQMFDecoderGetError(CQMFDecoder *psCQMFDecoder); + +int DecodeFrame(CQMFDecoder *psCQMFDecoder, + const int iNumBytes, + const unsigned char *puchData, + float ***pppfCQMFReal, + float ***pppfCQMFImag); + +#ifdef __cplusplus +} +#endif + +#endif /* _CQMF_DECODER_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c new file mode 100644 index 0000000000..a7db7969e9 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c @@ -0,0 +1,1226 @@ +#include "CQMFEncoder.h" + +#include +#include +#include +#include +#include "Tables.h" +#include "wmops.h" +#include "RMSEnvGrouping.h" +#include "PerceptualModel.h" +#include "RMSEnvDeltaHuff.h" +#include "CQMFHuff.h" +#include "Bitstream.h" + +typedef struct CQMF_ENCODER{ + int iSampleRate; + int iChannels; + int iNumBlocks; + + int iTargetBitRate; + int iTargetBitsPerFrame; + + int iNumBands; + const int *piBandwidths; + + int iMSMode; + int *piMSFlags; + + RMSEnvelopeGrouping *psRMSEnvelopeGrouping; + + int iCommonGrouping; + int *piNumGroups; + int **ppiGroupLengths; + + int ***pppiRMSEnvelope; + int ***pppiSMR; + int ***pppiExcitation; + int ***pppiAlloc; + + int iAllocOffset; + + int ***pppiCQMFSignReal; + int ***pppiCQMFSignImag; + int ***pppiQCQMFReal; + int ***pppiQCQMFImag; + + Bitstream *psBSWrite; + + int iLastError; +}CQMFEncoder; + +CQMFEncoder* CreateCQMFEncoder(const int iSampleRate, + const int iChannels, + const int iTargetBitRate) +{ + int n; + CQMFEncoder *psCQMFEncoder = NULL; + + assert(iSampleRate == 48000); //Fix + + psCQMFEncoder = (CQMFEncoder*)malloc(sizeof(CQMFEncoder)); + psCQMFEncoder->iSampleRate = iSampleRate; + psCQMFEncoder->iChannels = iChannels; + psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; + psCQMFEncoder->iAllocOffset = 0; + + psCQMFEncoder->iTargetBitRate = iTargetBitRate; + psCQMFEncoder->iTargetBitsPerFrame = iTargetBitRate * CQMF_BLOCKS_PER_FRAME * CQMF_BANDS / iSampleRate; + + psCQMFEncoder->iNumBands = MAX_BANDS_48 - 1; //Fix + psCQMFEncoder->piBandwidths = c_aiBandwidths48; //Fix + + psCQMFEncoder->iMSMode = 0; + psCQMFEncoder->piMSFlags = (int*)malloc(MAX_BANDS * sizeof(int)); + + psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping(psCQMFEncoder->iNumBlocks); + + psCQMFEncoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo + psCQMFEncoder->piNumGroups = (int*)malloc(psCQMFEncoder->iChannels * sizeof(int)); + psCQMFEncoder->ppiGroupLengths = (int**)malloc(psCQMFEncoder->iChannels * sizeof(int*)); + psCQMFEncoder->pppiRMSEnvelope = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + psCQMFEncoder->pppiSMR = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + psCQMFEncoder->pppiExcitation = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + psCQMFEncoder->pppiAlloc = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + + psCQMFEncoder->pppiCQMFSignReal = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + psCQMFEncoder->pppiCQMFSignImag = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + psCQMFEncoder->pppiQCQMFReal = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + psCQMFEncoder->pppiQCQMFImag = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); + for(n = 0; n < iChannels ; n ++){ + int k; + psCQMFEncoder->ppiGroupLengths[n] = (int*)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); + psCQMFEncoder->pppiRMSEnvelope[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFEncoder->pppiSMR[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFEncoder->pppiExcitation[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFEncoder->pppiAlloc[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + + psCQMFEncoder->pppiCQMFSignReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFEncoder->pppiCQMFSignImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFEncoder->pppiQCQMFReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFEncoder->pppiQCQMFImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + psCQMFEncoder->pppiRMSEnvelope[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFEncoder->pppiSMR[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFEncoder->pppiExcitation[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFEncoder->pppiAlloc[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + + psCQMFEncoder->pppiCQMFSignReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFEncoder->pppiCQMFSignImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFEncoder->pppiQCQMFReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFEncoder->pppiQCQMFImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + } + } + + psCQMFEncoder->psBSWrite = CreateBitstream(BS_WRITE,4096); + + psCQMFEncoder->iLastError = ENCODER_ERROR_NONE; + + return psCQMFEncoder; +} + +void DeleteCQMFEncoder(CQMFEncoder *psCQMFEncoder) +{ + if(psCQMFEncoder != NULL){ + + if(psCQMFEncoder->piMSFlags != NULL){ + free(psCQMFEncoder->piMSFlags); + } + + if(psCQMFEncoder->piNumGroups != NULL){ + free(psCQMFEncoder->piNumGroups); + } + + if(psCQMFEncoder->psRMSEnvelopeGrouping != NULL){ + DeleteRMSEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping); + } + + if(psCQMFEncoder->ppiGroupLengths != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + free(psCQMFEncoder->ppiGroupLengths[n]); + } + free(psCQMFEncoder->ppiGroupLengths); + } + + if(psCQMFEncoder->pppiRMSEnvelope != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiRMSEnvelope[n][k]); + } + free(psCQMFEncoder->pppiRMSEnvelope[n]); + } + free(psCQMFEncoder->pppiRMSEnvelope); + } + + if(psCQMFEncoder->pppiSMR != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiSMR[n][k]); + } + free(psCQMFEncoder->pppiSMR[n]); + } + free(psCQMFEncoder->pppiSMR); + } + + if(psCQMFEncoder->pppiExcitation != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiExcitation[n][k]); + } + free(psCQMFEncoder->pppiExcitation[n]); + } + free(psCQMFEncoder->pppiExcitation); + } + + if(psCQMFEncoder->pppiAlloc != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiAlloc[n][k]); + } + free(psCQMFEncoder->pppiAlloc[n]); + } + free(psCQMFEncoder->pppiAlloc); + } + + if(psCQMFEncoder->pppiCQMFSignReal != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiCQMFSignReal[n][k]); + } + free(psCQMFEncoder->pppiCQMFSignReal[n]); + } + free(psCQMFEncoder->pppiCQMFSignReal); + } + + if(psCQMFEncoder->pppiCQMFSignImag != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiCQMFSignImag[n][k]); + } + free(psCQMFEncoder->pppiCQMFSignImag[n]); + } + free(psCQMFEncoder->pppiCQMFSignImag); + } + + if(psCQMFEncoder->pppiQCQMFReal != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiQCQMFReal[n][k]); + } + free(psCQMFEncoder->pppiQCQMFReal[n]); + } + free(psCQMFEncoder->pppiQCQMFReal); + } + + if(psCQMFEncoder->pppiQCQMFImag != NULL){ + int n; + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + int k; + for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ + free(psCQMFEncoder->pppiQCQMFImag[n][k]); + } + free(psCQMFEncoder->pppiQCQMFImag[n]); + } + free(psCQMFEncoder->pppiQCQMFImag); + } + + DeleteBitstream(psCQMFEncoder->psBSWrite); + + free(psCQMFEncoder); + } +} + +int CQMFEncoderGetError(CQMFEncoder *psCQMFEncoder) +{ + return psCQMFEncoder->iLastError; +} + +static void MSModeCalculation(const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int *piMSMode, + int *piMSFlags); + +static void RemoveRMSEnvelope(const int iNumBands, + const int *piBandwidths, + const int iNumGroups, + const int *piGroupLengths, + const int **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag); + +static void RemoveSign(const int iNumBlocks, + const int iNumCQMFBands, + float **ppfReal, + float **ppfImag, + int **ppiSignReal, + int **ppiSignImag); + +static int CountCQMFBits(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiQReal, + const int **ppiQImag); + +/* Currently only the number of bands in frame */ +static int WriteHeaderInformation(const int iNumBands, + Bitstream *psBSWrite); + +static int WriteMSInformation(const int iNumBands, + const int iMSMode, + const int *piMSFlags, + Bitstream *psBSWrite); + +static int WriteGroupInformation(const int iChannels, + const int iCommonGrouping, + const int *piNumGroups, + const int **ppiGroupLengths, + Bitstream *psBSWrite); + +static int WriteRMSEnvelope(const int iChannels, + const int *piNumGroups, + const int iNumBands, + const int ***pppiRMSEnvelope, + Bitstream *psBSWrite); + +static int WriteAllocInformation(const int iAllocOffset, + Bitstream *psBSWrite); + +static int WriteCQMFData(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiSignReal, + const int **ppiSignImag, + const int **ppiQReal, + const int **ppiQImag, + Bitstream *psBSWrite); + +static int ComputeAllocation(const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAvailableBits, + int *piAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag); + +static int ComputeAllocationByPass(const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag); + + + +int EncodeFrame(CQMFEncoder *psCQMFEncoder, + float ***pppfCQMFReal, + float ***pppfCQMFImag, + int *piNumiBytes, + unsigned char *puchData) +{ + int n; + int iAvailableBits; + int iBitsWritten; + int iCQMFBits; + + iAvailableBits = psCQMFEncoder->iTargetBitsPerFrame; // HCBR for now + iBitsWritten = 0; + + + /* Do MS calc here */ + if(psCQMFEncoder->iChannels == 2){ + MSModeCalculation(psCQMFEncoder->iNumBlocks, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + pppfCQMFReal, + pppfCQMFImag, + &psCQMFEncoder->iMSMode, + psCQMFEncoder->piMSFlags); + + if(psCQMFEncoder->iMSMode > 0){ + psCQMFEncoder->iCommonGrouping = 1; // Make sure common grouping is enabled when MS is in use + } + } + + + /* Compute Grouping and RMS Envelopes */ + if(psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1){ + ComputeEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const float***)pppfCQMFReal, + (const float***)pppfCQMFImag, + 8.0, + 20.0, // Use these to trade off RMS Env bits and quantizer loading + &psCQMFEncoder->piNumGroups[0], + psCQMFEncoder->ppiGroupLengths[0], + psCQMFEncoder->pppiRMSEnvelope); + + psCQMFEncoder->piNumGroups[1] = psCQMFEncoder->piNumGroups[0]; + for(n = 0; n < psCQMFEncoder->piNumGroups[0]; n ++){ + psCQMFEncoder->ppiGroupLengths[1][n] = psCQMFEncoder->ppiGroupLengths[0][n]; + } + } + else{ + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + ComputeEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const float***)&pppfCQMFReal[n], + (const float***)&pppfCQMFImag[n], + 8.0, + 20.0, // Use these to trade off RMS Env bits and quantizer loading + &psCQMFEncoder->piNumGroups[n], + psCQMFEncoder->ppiGroupLengths[n], + &psCQMFEncoder->pppiRMSEnvelope[n]); + } + } + + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + RemoveSign(psCQMFEncoder->iNumBlocks, + CQMF_BANDS, + pppfCQMFReal[n], + pppfCQMFImag[n], + psCQMFEncoder->pppiCQMFSignReal[n], + psCQMFEncoder->pppiCQMFSignImag[n]); + + RemoveRMSEnvelope(psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + psCQMFEncoder->piNumGroups[n], + (const int*)psCQMFEncoder->ppiGroupLengths[n], + (const int **)psCQMFEncoder->pppiRMSEnvelope[n], + pppfCQMFReal[n], + pppfCQMFImag[n]); + } + + BSFlushBuffer(psCQMFEncoder->psBSWrite); + iBitsWritten += WriteHeaderInformation(psCQMFEncoder->iNumBands, + psCQMFEncoder->psBSWrite); + + if(psCQMFEncoder->iChannels == 2){ + iBitsWritten += WriteMSInformation(psCQMFEncoder->iNumBands, + psCQMFEncoder->iMSMode, + (const int*)psCQMFEncoder->piMSFlags, + psCQMFEncoder->psBSWrite); + } + + iBitsWritten += WriteGroupInformation(psCQMFEncoder->iChannels, + psCQMFEncoder->iCommonGrouping, + (const int*)psCQMFEncoder->piNumGroups, + (const int**)psCQMFEncoder->ppiGroupLengths, + psCQMFEncoder->psBSWrite); + + iBitsWritten += WriteRMSEnvelope(psCQMFEncoder->iChannels, + (const int*)psCQMFEncoder->piNumGroups, + psCQMFEncoder->iNumBands, + (const int***)psCQMFEncoder->pppiRMSEnvelope, + psCQMFEncoder->psBSWrite); + + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ // This will be updated to support multiple sample rates + int k; + for(k = 0; k < psCQMFEncoder->piNumGroups[n]; k ++){ + PerceptualModel(psCQMFEncoder->iNumBands, + psCQMFEncoder->pppiRMSEnvelope[n][k], + psCQMFEncoder->pppiExcitation[n][k], + psCQMFEncoder->pppiSMR[n][k]); + + } + } + + iAvailableBits -= iBitsWritten; + iCQMFBits = ComputeAllocation(psCQMFEncoder->iChannels, + (const int*)psCQMFEncoder->piNumGroups, + (const int**)psCQMFEncoder->ppiGroupLengths, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const float***)pppfCQMFReal, + (const float***)pppfCQMFImag, + (const int***)psCQMFEncoder->pppiSMR, + iAvailableBits, + &psCQMFEncoder->iAllocOffset, + psCQMFEncoder->pppiAlloc, + psCQMFEncoder->pppiQCQMFReal, + psCQMFEncoder->pppiQCQMFImag); + + iBitsWritten += WriteAllocInformation(psCQMFEncoder->iAllocOffset,psCQMFEncoder->psBSWrite); + + for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + iBitsWritten += WriteCQMFData(psCQMFEncoder->piNumGroups[n], + (const int*)psCQMFEncoder->ppiGroupLengths[n], + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const int**)psCQMFEncoder->pppiAlloc[n], + (const int**)psCQMFEncoder->pppiCQMFSignReal[n], + (const int**)psCQMFEncoder->pppiCQMFSignImag[n], + (const int**)psCQMFEncoder->pppiQCQMFReal[n], + (const int**)psCQMFEncoder->pppiQCQMFImag[n], + psCQMFEncoder->psBSWrite); + } + + BSByteAlign(psCQMFEncoder->psBSWrite); + *piNumiBytes = BSGetByteCount(psCQMFEncoder->psBSWrite); + BSGetBytes(psCQMFEncoder->psBSWrite,puchData,*piNumiBytes); + + //printf("Bits Written %d\n",iBitsWritten); + + return psCQMFEncoder->iLastError; +} + +static void MSModeCalculation(const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int *piMSMode, + int *piMSFlags) +{ + int b; + int iFBOffset; + int iNumMSBands; + + *piMSMode = 0; + iFBOffset = 0; + iNumMSBands = 0; + for(b = 0; b < iNumBands; b ++){ + int n; + float fLeftEnergy; + float fRightEnergy; + float fMidEnergy; + float fSideEnergy; + float fLRRatio; + float fMSRatio; + + fLeftEnergy = 0.0; + fRightEnergy = 0.0; + fMidEnergy = 0.0; + fSideEnergy = 0.0; + + for(n = 0; n < piBandwidths[b]; n ++){ + int k; + for(k = 0; k < iNumBlocks; k ++){ + float fMidReal; + float fMidImag; + float fSideReal; + float fSideImag; + + fMidReal = 0.5f * (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); + fMidImag = 0.5f * (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); + fSideReal = 0.5f * (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); + fSideImag = 0.5f * (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); + + fLeftEnergy += (pppfReal[0][k][iFBOffset] * pppfReal[0][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[0][k][iFBOffset]); + fRightEnergy += (pppfReal[1][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[1][k][iFBOffset] * pppfImag[1][k][iFBOffset]); + fMidEnergy += (fMidReal * fMidReal + fMidImag * fMidImag); + fSideEnergy += (fSideReal * fSideReal + fSideImag * fSideImag); + } + + iFBOffset ++; + } + + fLeftEnergy = log10f(fLeftEnergy + 1e-12f); + fRightEnergy = log10f(fRightEnergy + 1e-12f); + fMidEnergy = log10f(fMidEnergy + 1e-12f); + fSideEnergy = log10f(fSideEnergy + 1e-12f); + + if(fLeftEnergy > fRightEnergy){ + fLRRatio = fLeftEnergy - fRightEnergy; + } + else{ + fLRRatio = fRightEnergy - fLeftEnergy; + } + + if(fMidEnergy > fSideEnergy){ + fMSRatio = fMidEnergy - fSideEnergy; + } + else{ + fMSRatio = fSideEnergy - fMidEnergy; + } + + if(fMSRatio > fLRRatio){ + iNumMSBands ++; + piMSFlags[b] = 1; + } + else{ + piMSFlags[b] = 0; + } + } + + if(iNumMSBands == iNumBands){ + *piMSMode = 1; + } + else if(iNumMSBands > 0){ + *piMSMode = 2; + } + else{ + *piMSMode = 0; + } + + if(*piMSMode > 0){ + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + if(piMSFlags[b] == 1){ + int n; + for(n = 0; n < piBandwidths[b]; n ++){ + int k; + for(k = 0; k < iNumBlocks; k ++){ + float fMidReal; + float fMidImag; + float fSideReal; + float fSideImag; + + fMidReal = 0.5f * (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); + fMidImag = 0.5f * (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); + fSideReal = 0.5f * (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); + fSideImag = 0.5f * (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); + + pppfReal[0][k][iFBOffset] = fMidReal; + pppfReal[1][k][iFBOffset] = fSideReal; + pppfImag[0][k][iFBOffset] = fMidImag; + pppfImag[1][k][iFBOffset] = fSideImag; + } + iFBOffset ++; + } + } + else{ + iFBOffset += piBandwidths[b]; + } + } + } +} + +static void RemoveRMSEnvelope(const int iNumBands, + const int *piBandwidths, + const int iNumGroups, + const int *piGroupLengths, + const int **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag) +{ + int n; + int iBlockOffset; + + iBlockOffset = 0; + for(n = 0; n < iNumGroups; n ++){ + int k; + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iRMSEnv; + float fGain; + + iRMSEnv = ppiRMSEnvelope[n][b]; + fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER - iRMSEnv]; + for(m = 0; m < piBandwidths[b]; m ++){ + ppfReal[iBlockOffset][iFBOffset] *= fGain; + ppfImag[iBlockOffset][iFBOffset] *= fGain; + iFBOffset ++; + } + } + iBlockOffset ++; + } + } +} + +static void RemoveSign(const int iNumBlocks, + const int iNumCQMFBands, + float **ppfReal, + float **ppfImag, + int **ppiSignReal, + int **ppiSignImag) +{ + int n; + for(n = 0; n < iNumBlocks; n ++){ + int b; + for(b = 0; b < iNumCQMFBands; b ++){ + if(ppfReal[n][b] > 0.0){ + ppiSignReal[n][b] = 0; + } + else{ + ppfReal[n][b] = -ppfReal[n][b]; + ppiSignReal[n][b] = 1; + } + if(ppfImag[n][b] > 0.0){ + ppiSignImag[n][b] = 0; + } + else{ + ppfImag[n][b] = -ppfImag[n][b]; + ppiSignImag[n][b] = 1; + } + } + } +} + +/* Rename */ +static void QuantizeSpectrum(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const float **ppfReal, + const float **ppfImag, + int **ppiQReal, + int **ppiQImag) +{ + int n; + int iBlockOffest; + + iBlockOffest = 0; + for(n = 0; n < iNumGroups; n ++){ + int k; + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iAlloc; + int iMaxQuantVal; + float fSCFGain; + + iAlloc = ppiAlloc[n][b]; + fSCFGain = c_afScaleFactor[iAlloc]; + iMaxQuantVal = c_aiQuantMaxValues[iAlloc]; + for(m = 0; m < piBandwidths[b]; m ++){ + int iQuantValue; + + iQuantValue = (int)(fSCFGain * ppfReal[iBlockOffest][iFBOffset] + 0.5); +#ifdef _DEBUG_VERBOSE + if(iQuantValue > iMaxQuantVal){ + printf("Value out of range %d\t%d\t%d\n",iAlloc,iQuantValue,iMaxQuantVal); + iQuantValue = iMaxQuantVal; + } +#else + iQuantValue = (iQuantValue < iMaxQuantVal) ? iQuantValue : iMaxQuantVal; +#endif + ppiQReal[iBlockOffest][iFBOffset] = iQuantValue; + + iQuantValue = (int)(fSCFGain * ppfImag[iBlockOffest][iFBOffset] + 0.5); +#ifdef _DEBUG_VERBOSE + if(iQuantValue > iMaxQuantVal){ + printf("Value out of range %d\t%d\t%d\n",iAlloc,iQuantValue,iMaxQuantVal); + iQuantValue = iMaxQuantVal; + } +#else + iQuantValue = (iQuantValue < iMaxQuantVal) ? iQuantValue : iMaxQuantVal; +#endif + ppiQImag[iBlockOffest][iFBOffset] = iQuantValue; + + iFBOffset ++; + } + + } + + iBlockOffest ++; + } + } +} + +static int CountCQMFBits(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiQReal, + const int **ppiQImag) +{ + int n; + int iBits; + int iBlockOffest; + + iBits = 0; + iBlockOffest = 0; + for(n = 0; n < iNumGroups; n ++){ + int k; + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iAlloc; + int iHuffDim; + int iHuffMod; + + iAlloc = ppiAlloc[n][b]; + + iHuffDim = c_aiHuffmanDim[iAlloc]; + iHuffMod = c_aiHuffmanMod[iAlloc]; + + + if(iAlloc > 0){ + const unsigned int (*pauiHuffmanTable)[2] = NULL; //const? + + pauiHuffmanTable = GetHuffEncTable(iAlloc); + for(m = 0; m < piBandwidths[b]; m ++){ + int iQuantValue1; + int iQuantValue2; + + iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; + iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; + + iBits += (iQuantValue1 > 0) ? 1 : 0; //Sign bit for vals > 0 + iBits += (iQuantValue2 > 0) ? 1 : 0; //Sign bit for vals > 0 + if(iHuffDim == 2){ + iQuantValue1 *= iHuffMod; + iQuantValue1 += iQuantValue2; + iBits += pauiHuffmanTable[iQuantValue1][0]; + } + else{ + iBits += pauiHuffmanTable[iQuantValue1][0]; + iBits += pauiHuffmanTable[iQuantValue2][0]; + } + + iFBOffset ++; + } + } + else{ + iFBOffset += piBandwidths[b]; + } + + } + + iBlockOffest ++; + } + } + + return iBits; +} + +/* Currently only the number of bands in frame */ +static int WriteHeaderInformation(const int iNumBands, + Bitstream *psBSWrite) +{ + int iBitsWritten; + + iBitsWritten = 0; + BSPutBits(psBSWrite,iNumBands,5); + iBitsWritten += 5; + + return iBitsWritten; +} + +static int WriteMSInformation(const int iNumBands, + const int iMSMode, + const int *piMSFlags, + Bitstream *psBSWrite) +{ + int iBitsWritten; + + iBitsWritten = 0; + + BSPutBits(psBSWrite,iMSMode,2); + iBitsWritten += 2; + if(iMSMode == 2){ + int n; + for(n = 0; n < iNumBands; n ++){ + BSPutBits(psBSWrite,piMSFlags[n],1); + iBitsWritten += 1; + } + } + + return iBitsWritten; +} + +static int WriteGroupInformation(const int iChannels, + const int iCommonGrouping, + const int *piNumGroups, + const int **ppiGroupLengths, + Bitstream *psBSWrite) +{ + int iBitsWritten; + + iBitsWritten = 0; + if(iChannels == 2 && iCommonGrouping == 1){ + int k; + + BSPutBits(psBSWrite,iCommonGrouping,1); + iBitsWritten += 1; + + BSPutBits(psBSWrite,(piNumGroups[0] - 1),4); + iBitsWritten += 4; + + for(k = 0; k < piNumGroups[0]; k ++){ + BSPutBits(psBSWrite,(ppiGroupLengths[0][k] - 1),4); + iBitsWritten += 4; + } + } + else if(iChannels == 2){ + int n; + + BSPutBits(psBSWrite,iCommonGrouping,1); + iBitsWritten += 1; + + for(n = 0; n < iChannels; n ++){ + int k; + + BSPutBits(psBSWrite,(piNumGroups[n] - 1),4); + iBitsWritten += 4; + + for(k = 0; k < piNumGroups[n]; k ++){ + BSPutBits(psBSWrite,(ppiGroupLengths[n][k] - 1),4); + iBitsWritten += 4; + } + } + } + else{ + int n; + + for(n = 0; n < iChannels; n ++){ + int k; + + BSPutBits(psBSWrite,(piNumGroups[n] - 1),4); + iBitsWritten += 4; + + for(k = 0; k < piNumGroups[n]; k ++){ + BSPutBits(psBSWrite,(ppiGroupLengths[n][k] - 1),4); + iBitsWritten += 4; + } + } + } + + return iBitsWritten; +} + +static int WriteRMSEnvelope(const int iChannels, + const int *piNumGroups, + const int iNumBands, + const int ***pppiRMSEnvelope, + Bitstream *psBSWrite) +{ + int n; + int iBitsWritten; + + iBitsWritten = 0; + for(n = 0; n < iChannels; n ++){ + int k; + for(k = 0; k < piNumGroups[n]; k ++){ + int b; + int iLastRMSVal; + + iLastRMSVal = pppiRMSEnvelope[n][k][0]; + iLastRMSVal = (iLastRMSVal > ENV_MIN) ? iLastRMSVal : ENV_MIN; + iLastRMSVal = (iLastRMSVal < ENV_MAX) ? iLastRMSVal : ENV_MAX; + BSPutBits(psBSWrite,(iLastRMSVal - ENV_MIN),ENV0_BITS); + iBitsWritten += ENV0_BITS; + + for(b = 1; b < iNumBands; b ++){ + int iDelta; + + iDelta = pppiRMSEnvelope[n][k][b] - iLastRMSVal; + iDelta = (iDelta > ENV_DELTA_MIN) ? iDelta : ENV_DELTA_MIN; + iDelta = (iDelta < ENV_DELTA_MAX) ? iDelta : ENV_DELTA_MAX; + iDelta -= ENV_DELTA_MIN; + + BSPutBits(psBSWrite,c_aaiRMSEnvHuffEnc[iDelta][1],c_aaiRMSEnvHuffEnc[iDelta][0]); + iBitsWritten += c_aaiRMSEnvHuffEnc[iDelta][0]; + + iLastRMSVal = pppiRMSEnvelope[n][k][b]; + } + } + } + + return iBitsWritten; +} + +static int WriteAllocInformation(const int iAllocOffset, + Bitstream *psBSWrite) +{ + int iBitsWritten; + + iBitsWritten = 0; + + if(iAllocOffset < MIN_ALLOC_OFFSET || iAllocOffset > MAX_ALLOC_OFFSET){ + printf("Serious error\n"); + } + + BSPutBits(psBSWrite,(iAllocOffset - MIN_ALLOC_OFFSET),ALLOC_OFFSET_BITS); + iBitsWritten += ALLOC_OFFSET_BITS; + + return iBitsWritten; +} + +static int WriteCQMFData(const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiSignReal, + const int **ppiSignImag, + const int **ppiQReal, + const int **ppiQImag, + Bitstream *psBSWrite) +{ + int n; + int iBitsWritten; + int iBlockOffest; + + iBitsWritten = 0; + iBlockOffest = 0; + + + for(n = 0; n < iNumGroups; n ++){ + int k; + for(k = 0; k < piGroupLengths[n]; k ++){ + int b; + int iFBOffset; + + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + int iAlloc; + int iHuffDim; + int iHuffMod; + + iAlloc = ppiAlloc[n][b]; + + iHuffDim = c_aiHuffmanDim[iAlloc]; + iHuffMod = c_aiHuffmanMod[iAlloc]; + + + if(iAlloc > 0){ + const unsigned int (*pauiHuffmanTable)[2] = NULL; //const? + + pauiHuffmanTable = GetHuffEncTable(iAlloc); + for(m = 0; m < piBandwidths[b]; m ++){ + int iQuantValue1; + int iQuantValue2; + + iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; + iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; + + + if(iHuffDim == 2){ + int iSymbol; + iSymbol = iQuantValue1; + iSymbol *= iHuffMod; + iSymbol += iQuantValue2; + BSPutBits(psBSWrite, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0]); + iBitsWritten += pauiHuffmanTable[iSymbol][0]; + } + else{ + BSPutBits(psBSWrite, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0]); + iBitsWritten += pauiHuffmanTable[iQuantValue1][0]; + BSPutBits(psBSWrite, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0]); + iBitsWritten += pauiHuffmanTable[iQuantValue2][0]; + } + + if(iQuantValue1 > 0){ + BSPutBits(psBSWrite,ppiSignReal[iBlockOffest][iFBOffset],1); + iBitsWritten += 1; + } + if(iQuantValue2 > 0){ + BSPutBits(psBSWrite,ppiSignImag[iBlockOffest][iFBOffset],1); + iBitsWritten += 1; + } + + iFBOffset ++; + } + } + else{ + iFBOffset += piBandwidths[b]; + } + + } + + iBlockOffest ++; + } + } + + return iBitsWritten; +} + +static int ComputeAllocation(const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAvailableBits, + int *piAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag) +{ + int iBitsUsed; + int iDone; + int iDelta; + + iBitsUsed = ALLOC_OFFSET_BITS; // Bits used for Alloc Offset + + iDone = 0; + iDelta = -MIN_ALLOC_OFFSET; + *piAllocOffset = 0; + while(iDone == 0){ + int n; + int iLimitAllocOffset; + iBitsUsed = ALLOC_OFFSET_BITS; + + iLimitAllocOffset = *piAllocOffset; + iLimitAllocOffset = (iLimitAllocOffset > MIN_ALLOC_OFFSET) ? iLimitAllocOffset : MIN_ALLOC_OFFSET; + iLimitAllocOffset = (iLimitAllocOffset < MAX_ALLOC_OFFSET) ? iLimitAllocOffset : MAX_ALLOC_OFFSET; + + for(n = 0; n < iChannels; n ++){ + int k; + for(k = 0; k < piNumGroups[n]; k ++){ + int b; + for(b = 0; b < iNumBands; b ++){ + int iAlloc; + iAlloc = ((pppiSMR[n][k][b] + iLimitAllocOffset * ALLOC_OFFSET_SCALE) >> 5); + iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; + iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; + pppiAlloc[n][k][b] = iAlloc; + } + } + + QuantizeSpectrum(piNumGroups[n], + (const int*)ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int**)pppiAlloc[n], + (const float**)pppfReal[n], + (const float**)pppfImag[n], + pppiQReal[n], + pppiQImag[n]); + + iBitsUsed += CountCQMFBits(piNumGroups[n], + (const int*)ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int**)pppiAlloc[n], + (const int**)pppiQReal[n], + (const int**)pppiQImag[n]); + } + + if(*piAllocOffset <= MIN_ALLOC_OFFSET && iBitsUsed > iAvailableBits){ +#ifdef DEBUG_VERBOSE + printf("Frame can not be coded with the number of bits available\n"); +#endif + //iLastError = ENC_ERROR_STREAM_FAILURE; + return -1; + } + else if(*piAllocOffset >= MAX_ALLOC_OFFSET && iBitsUsed < iAvailableBits){ + *piAllocOffset = MAX_ALLOC_OFFSET; + iDone ++; + } + else{ + if(iDelta == 0 && iBitsUsed > iAvailableBits){ + iDelta = 1; + } + else if(iDelta == 0 && iBitsUsed < iAvailableBits){ + iDone ++; + } + else if(iBitsUsed == iAvailableBits){ + iDone ++; + } + + if(iBitsUsed > iAvailableBits){ + *piAllocOffset -= iDelta; + iDelta >>= 1; + } + else if(iBitsUsed < iAvailableBits){ + *piAllocOffset += iDelta; + iDelta >>= 1; + } + } + + } + + //printf("%d\t%d\t%d\t%d\n",*piAllocOffset,iAvailableBits,iBitsUsed,iAvailableBits - iBitsUsed); + + return iBitsUsed; +} + +static int ComputeAllocationByPass(const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag) +{ + int n; + int iBitsUsed; + + iBitsUsed = ALLOC_OFFSET_BITS; + + for(n = 0; n < iChannels; n ++){ + int k; + for(k = 0; k < piNumGroups[n]; k ++){ + int b; + for(b = 0; b < iNumBands; b ++){ + int iAlloc; + iAlloc = ((pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE) >> 5); + iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; + iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; + pppiAlloc[n][k][b] = iAlloc; + } + } + + QuantizeSpectrum(piNumGroups[n], + (const int*)ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int**)pppiAlloc[n], + (const float**)pppfReal[n], + (const float**)pppfImag[n], + pppiQReal[n], + pppiQImag[n]); + + iBitsUsed += CountCQMFBits(piNumGroups[n], + (const int*)ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int**)pppiAlloc[n], + (const int**)pppiQReal[n], + (const int**)pppiQImag[n]); + } + + return iBitsUsed; +} diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h new file mode 100644 index 0000000000..d509827beb --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h @@ -0,0 +1,33 @@ +#ifndef _CQMF_ENCODER_H_ +#define _CQMF_ENCODER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ENCODER_ERROR_NONE (0) +#define ENCODER_ERROR_FS_NOT_SUPPORTED (-1) +#define ENCODER_ERROR_CHAN_NOT_SUPPORTED (-2) +#define ENCODER_ERROR_UNKNOWN (-100) + +typedef struct CQMF_ENCODER CQMFEncoder; + +CQMFEncoder* CreateCQMFEncoder(const int iSampleRate, + const int iChannels, + const int iTargetBitRate); + +void DeleteCQMFEncoder(CQMFEncoder *psCQMFEncoder); + +int CQMFEncoderGetError(CQMFEncoder *psCQMFEncoder); + +int EncodeFrame(CQMFEncoder *psCQMFEncoder, + float ***pppfCQMFReal, + float ***pppfCQMFImag, + int *piNumiBytes, + unsigned char *puchData); + +#ifdef __cplusplus +} +#endif + +#endif /* _CQMF_ENCODER_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c b/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c new file mode 100644 index 0000000000..ad7e387c72 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c @@ -0,0 +1,1457 @@ +#include "CQMFHuff.h" +#include "wmops.h" + +const unsigned int c_aaiCQMFHuffEnc1[16][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, {0x000b, 0x0001}, + {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0009, 0x0003}, {0x000a, 0x0001}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, +}; + +const unsigned int c_aaiCQMFHuffDec1[4][16] = +{ + {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x00010003, 0x00010003, 0x00010007, 0x00010007, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, +}; + +const unsigned int c_aaiCQMFHuffEnc2[25][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0000}, {0x000c, 0x0001}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, + {0x000c, 0x0002}, {0x000c, 0x0003}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, + {0x000b, 0x0004}, {0x000c, 0x0007}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, + {0x000b, 0x000b}, + +}; + +const unsigned int c_aaiCQMFHuffDec2[4][16] = +{ + {0x0001ffff, 0x00000006, 0x00010005, 0x00010005, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0002ffff, 0x0001000b, 0x0001000b, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, + {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x00000003, 0x00000004, 0x00000008, 0x00000009, 0x0000000d, 0x0000000e, 0x0000000f, 0x00000011, 0x00010010, 0x00010010, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, }, +}; + +const unsigned int c_aaiCQMFHuffEnc3[36][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0006}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, + {0x0007, 0x0001}, {0x000b, 0x0007}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0009, 0x0003}, {0x000b, 0x0008}, + {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000a, 0x0005}, {0x000c, 0x000a}, {0x000b, 0x0009}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, + {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000d, 0x0010}, + {0x000d, 0x0011}, {0x000d, 0x0012}, {0x000d, 0x0013}, {0x000c, 0x000b}, + +}; + +const unsigned int c_aaiCQMFHuffDec3[14][16] = +{ + {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0002ffff, 0x00010008, 0x00010008, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x0001000f, 0x0001000f, 0x00010014, 0x00010014, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0005ffff, 0x0006ffff, 0x0004ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x00000013, 0x00000023, 0x00010003, 0x00010003, 0x00010009, 0x00010009, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, +}; + +const unsigned int c_aaiCQMFHuffEnc4[49][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0004}, {0x000f, 0x0000}, {0x000f, 0x0001}, {0x000f, 0x0002}, {0x0003, 0x0001}, + {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x0005}, {0x000f, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0006, 0x0002}, {0x0006, 0x0003}, + {0x0008, 0x0001}, {0x000d, 0x000a}, {0x000f, 0x0006}, {0x000f, 0x0007}, {0x000f, 0x0008}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0006}, + {0x000c, 0x0007}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000e, 0x000c}, {0x000d, 0x000b}, {0x000f, 0x000c}, {0x000f, 0x000d}, + {0x000f, 0x000e}, {0x000f, 0x000f}, {0x000f, 0x0010}, {0x000f, 0x0011}, {0x000f, 0x0012}, {0x000f, 0x0013}, {0x000f, 0x0014}, {0x000f, 0x0015}, + {0x000f, 0x0016}, {0x000f, 0x0017}, {0x000e, 0x000d}, {0x000e, 0x000e}, {0x000e, 0x000f}, {0x000e, 0x0010}, {0x000e, 0x0011}, {0x000e, 0x0012}, + {0x000e, 0x0013}, + +}; + +const unsigned int c_aaiCQMFHuffDec4[9][16] = +{ + {0x0001ffff, 0x00000008, 0x00010007, 0x00010007, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000010, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x0007ffff, 0x0006ffff, 0x0008ffff, 0x0004ffff, 0x0005ffff, 0x0003ffff, 0x00000017, 0x00000018, 0x00010003, 0x00010003, 0x0001000a, 0x0001000a, 0x00010015, 0x00010015, 0x00010016, 0x00010016, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, + {0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, + {0x00010014, 0x00010014, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, + {0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, + {0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, +}; + +const unsigned int c_aaiCQMFHuffEnc5[64][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000f, 0x000c}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, + {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, {0x000a, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, + {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x000c, 0x0003}, {0x000f, 0x000d}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, + {0x000b, 0x0003}, {0x000a, 0x0003}, {0x000d, 0x0004}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, + {0x000e, 0x0007}, {0x000d, 0x0005}, {0x0010, 0x0015}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, + {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, + {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, + {0x0011, 0x0024}, {0x0011, 0x0025}, {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0011, 0x0028}, {0x0011, 0x0029}, {0x0010, 0x0016}, {0x0010, 0x0017}, +}; + +const unsigned int c_aaiCQMFHuffDec5[27][16] = +{ + {0x0001ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000012, 0x00010011, 0x00010011, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, + {0x0005ffff, 0x0004ffff, 0x0003ffff, 0x00000013, 0x00010003, 0x00010003, 0x00010018, 0x00010018, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, + {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, + {0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x00000022, 0x0000003e, 0x0000003f, 0x00010004, 0x00010004, 0x00010014, 0x00010014, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x0008ffff, 0x0007ffff, 0x0009ffff, 0x000dffff, 0x0006ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, + {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, + {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, +}; + +const unsigned int c_aaiCQMFHuffEnc6[81][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000e, 0x0005}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, + {0x0012, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x000e, 0x0006}, {0x0012, 0x0004}, {0x0012, 0x0005}, + {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000c, 0x0003}, {0x000f, 0x0008}, {0x0012, 0x0008}, + {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x000b, 0x0003}, {0x000a, 0x0003}, {0x000d, 0x0005}, {0x000e, 0x0007}, {0x0011, 0x001c}, + {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0009}, {0x0010, 0x000f}, + {0x0012, 0x0010}, {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0011, 0x001d}, {0x0012, 0x0016}, + {0x0012, 0x0017}, {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, + {0x0012, 0x001f}, {0x0012, 0x0020}, {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, + {0x0012, 0x0027}, {0x0012, 0x0028}, {0x0012, 0x0029}, {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0012, 0x002c}, {0x0012, 0x002d}, {0x0012, 0x002e}, + {0x0012, 0x002f}, {0x0012, 0x0030}, {0x0012, 0x0031}, {0x0012, 0x0032}, {0x0012, 0x0033}, {0x0012, 0x0034}, {0x0012, 0x0035}, {0x0012, 0x0036}, + {0x0012, 0x0037}, + +}; + +const unsigned int c_aaiCQMFHuffDec6[21][16] = +{ + {0x0001ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000014, 0x0001000b, 0x0001000b, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x0005ffff, 0x0004ffff, 0x0003ffff, 0x00000015, 0x00010003, 0x00010003, 0x0001001b, 0x0001001b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, + {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x00010016, 0x00010016, 0x00010026, 0x00010026, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x0008ffff, 0x0009ffff, 0x0007ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0006ffff, 0x00000027, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, + {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, }, + {0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, }, + {0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, }, + {0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, + {0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x00020044, 0x00020044, 0x00020044, 0x00020044, }, + {0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, }, + {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, }, + {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020050, 0x00020050, 0x00020050, 0x00020050, }, +}; + +const unsigned int c_aaiCQMFHuffEnc7[81][2] = +{ + {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0005, 0x0001}, {0x000a, 0x0002}, {0x000d, 0x0005}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, + {0x0012, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0006}, {0x000f, 0x0009}, {0x0012, 0x0004}, + {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0001}, {0x000b, 0x0002}, {0x000e, 0x0006}, {0x0011, 0x0018}, + {0x0011, 0x0019}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x000a, 0x0003}, {0x0009, 0x0003}, {0x000b, 0x0003}, {0x000e, 0x0007}, {0x000f, 0x000a}, + {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x000d, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x000b}, + {0x0011, 0x001a}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0010, 0x000e}, {0x0012, 0x0011}, {0x0010, 0x000f}, + {0x0010, 0x0010}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0010, 0x0011}, {0x0012, 0x0017}, + {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, + {0x0012, 0x0020}, {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, + {0x0012, 0x0028}, {0x0012, 0x0029}, {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0012, 0x002c}, {0x0012, 0x002d}, {0x0012, 0x002e}, {0x0012, 0x002f}, + {0x0011, 0x001b}, + +}; + +const unsigned int c_aaiCQMFHuffDec7[23][16] = +{ + {0x0001ffff, 0x0002ffff, 0x0001000a, 0x0001000a, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, + {0x0004ffff, 0x0003ffff, 0x00010014, 0x00010014, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0008ffff, 0x0007ffff, 0x0006ffff, 0x0005ffff, 0x00010015, 0x00010015, 0x0001001d, 0x0001001d, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00000030, 0x00000036, 0x0001000e, 0x0001000e, 0x0001001f, 0x0001001f, 0x00010027, 0x00010027, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x000effff, 0x000dffff, 0x000bffff, 0x000cffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0009ffff, 0x000affff, 0x0000002d, 0x0000002f, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, + {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, + {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, }, + {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, + {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, + {0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020037, 0x00020037, 0x00020037, 0x00020037, }, + {0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, }, + {0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, }, + {0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020043, 0x00020043, 0x00020043, 0x00020043, }, + {0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020047, 0x00020047, 0x00020047, 0x00020047, }, + {0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, }, + {0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, +}; + +const unsigned int c_aaiCQMFHuffEnc8[121][2] = +{ + {0x0002, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0002}, {0x000d, 0x0003}, {0x0010, 0x0008}, {0x0014, 0x0000}, {0x0014, 0x0001}, + {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0004}, + {0x0010, 0x0009}, {0x0012, 0x0016}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0005, 0x0002}, {0x0005, 0x0003}, + {0x0007, 0x0001}, {0x000b, 0x0002}, {0x000e, 0x0004}, {0x0010, 0x000a}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, + {0x0014, 0x000d}, {0x000a, 0x0003}, {0x0009, 0x0003}, {0x000b, 0x0003}, {0x000d, 0x0005}, {0x0010, 0x000b}, {0x0012, 0x0017}, {0x0014, 0x000e}, + {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0005}, {0x000f, 0x0006}, + {0x0011, 0x000d}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0011, 0x000e}, + {0x000f, 0x0007}, {0x0011, 0x000f}, {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, + {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0013, 0x002a}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0013, 0x002b}, {0x0014, 0x0021}, {0x0014, 0x0022}, + {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, + {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, + {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, + {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, + {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, + {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, + {0x0014, 0x0053}, + +}; + +const unsigned int c_aaiCQMFHuffDec8[17][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, + {0x0004ffff, 0x0003ffff, 0x00010018, 0x00010018, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x0008ffff, 0x0006ffff, 0x0005ffff, 0x0007ffff, 0x00010019, 0x00010019, 0x00010023, 0x00010023, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x000bffff, 0x0009ffff, 0x000affff, 0x00000005, 0x00000010, 0x0000001b, 0x00000025, 0x0001002f, 0x0001002f, 0x00010038, 0x00010038, }, + {0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00010042, 0x00010042, 0x00010045, 0x00010045, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, + {0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000027, 0x00000028, }, + {0x00000029, 0x0000002a, 0x0000002b, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x0000003c, 0x0000003d, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000043, }, + {0x00000044, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, }, + {0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, }, + {0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006a, 0x0000006b, 0x0000006c, 0x0000006d, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, }, +}; + +const unsigned int c_aaiCQMFHuffEnc9[196][2] = +{ + {0x0003, 0x0002}, {0x0002, 0x0002}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x000b, 0x0003}, {0x000f, 0x000e}, {0x0010, 0x0016}, {0x0013, 0x0000}, + {0x0012, 0x004a}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0003, 0x0003}, {0x0002, 0x0003}, + {0x0004, 0x0002}, {0x0008, 0x0003}, {0x000b, 0x0004}, {0x000e, 0x0009}, {0x0011, 0x0028}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, + {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0005, 0x0001}, {0x0004, 0x0003}, {0x0007, 0x0003}, {0x0009, 0x0002}, + {0x000c, 0x0004}, {0x000e, 0x000a}, {0x0010, 0x0017}, {0x0012, 0x004b}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, + {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x000b, 0x0005}, {0x000e, 0x000b}, {0x000f, 0x000f}, + {0x0011, 0x0029}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, + {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0005}, {0x000e, 0x000c}, {0x000f, 0x0010}, {0x0011, 0x002a}, {0x0012, 0x004c}, {0x0013, 0x001a}, + {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x000e, 0x000d}, {0x000d, 0x0007}, + {0x000f, 0x0011}, {0x0010, 0x0018}, {0x0012, 0x004d}, {0x0013, 0x0021}, {0x0012, 0x004e}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, + {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0010, 0x0019}, {0x0010, 0x001a}, {0x0010, 0x001b}, {0x0012, 0x004f}, + {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, + {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0011, 0x002b}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, + {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, + {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, + {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, + {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, + {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, + {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, + {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, + {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, + {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, + {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, + {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, + {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, + +}; + +const unsigned int c_aaiCQMFHuffDec9[30][16] = +{ + {0x0001ffff, 0x00000002, 0x00000010, 0x0000001d, 0x00010000, 0x00010000, 0x0001000e, 0x0001000e, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x0003ffff, 0x0002ffff, 0x00000003, 0x00000011, 0x0000002a, 0x0000002b, 0x0001001e, 0x0001001e, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, + {0x000bffff, 0x0006ffff, 0x0005ffff, 0x0004ffff, 0x00000020, 0x0000003a, 0x00010004, 0x00010004, 0x00010012, 0x00010012, 0x0001002d, 0x0001002d, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, + {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x0001003c, 0x0001003c, 0x00010048, 0x00010048, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, + {0x001cffff, 0x001dffff, 0x0009ffff, 0x000affff, 0x0007ffff, 0x0008ffff, 0x00000006, 0x00000022, 0x00000049, 0x00000054, 0x00000055, 0x00000056, 0x00010005, 0x00010005, 0x0001002f, 0x0001002f, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, }, + {0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x00020057, 0x00020057, 0x00020057, 0x00020057, }, + {0x000fffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, }, + {0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, }, + {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, }, + {0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, }, + {0x00010007, 0x00010007, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00010015, 0x00010015, 0x00010016, 0x00010016, }, + {0x00010045, 0x00010045, 0x0001004b, 0x0001004b, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, + {0x00010053, 0x00010053, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, }, + {0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, }, + {0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, }, + {0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, }, + {0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, }, + {0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, }, + {0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, }, + {0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, }, + {0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, }, + {0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, }, + {0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, }, + {0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, }, + {0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, }, +}; + +const unsigned int c_aaiCQMFHuffEnc10[196][2] = +{ + {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0004, 0x0002}, {0x0006, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0005}, {0x000f, 0x000e}, {0x000f, 0x000f}, + {0x0012, 0x003f}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0003, 0x0005}, {0x0002, 0x0003}, + {0x0004, 0x0003}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000c, 0x0006}, {0x000e, 0x000b}, {0x000f, 0x0010}, {0x0013, 0x0005}, {0x0013, 0x0006}, + {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0007, 0x0002}, + {0x000a, 0x0004}, {0x000c, 0x0007}, {0x000e, 0x000c}, {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0003}, {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000d, 0x0008}, + {0x000f, 0x0011}, {0x0011, 0x0028}, {0x0013, 0x0010}, {0x0012, 0x0040}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, + {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x0009}, {0x000f, 0x0012}, {0x0010, 0x0016}, {0x0013, 0x0015}, + {0x0011, 0x0029}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x000c, 0x0008}, {0x000b, 0x0007}, + {0x000c, 0x0009}, {0x000e, 0x000d}, {0x000f, 0x0013}, {0x0010, 0x0017}, {0x0011, 0x002a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0012, 0x0041}, + {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x000f, 0x0014}, {0x000e, 0x000e}, {0x000e, 0x000f}, {0x000f, 0x0015}, + {0x0012, 0x0042}, {0x0010, 0x0018}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, + {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0010, 0x0019}, {0x0010, 0x001a}, {0x0011, 0x002b}, {0x0010, 0x001b}, {0x0012, 0x0043}, + {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, + {0x0012, 0x0044}, {0x0012, 0x0045}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0012, 0x0046}, {0x0013, 0x0035}, {0x0013, 0x0036}, + {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, + {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, + {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, + {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, + {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, + {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, + {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, + {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, + {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0012, 0x0047}, + {0x0012, 0x0048}, {0x0012, 0x0049}, {0x0012, 0x004a}, {0x0012, 0x004b}, + +}; + +const unsigned int c_aaiCQMFHuffDec10[34][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00000002, 0x00000010, 0x0000001c, 0x0000001d, 0x00010000, 0x00010000, 0x00010001, 0x00010001, 0x0001000e, 0x0001000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0006ffff, 0x0004ffff, 0x0003ffff, 0x0005ffff, 0x0001001f, 0x0001001f, 0x0001002c, 0x0001002c, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x000fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x0007ffff, 0x00000005, 0x00000013, 0x00000021, 0x00000046, 0x00000048, 0x0001002e, 0x0001002e, 0x0001003b, 0x0001003b, 0x00010047, 0x00010047, }, + {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x00010015, 0x00010015, 0x00010030, 0x00010030, 0x0001003d, 0x0001003d, 0x0001004a, 0x0001004a, 0x00010054, 0x00010054, 0x00010057, 0x00010057, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, + {0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, + {0x000effff, 0x0011ffff, 0x0012ffff, 0x000dffff, 0x000bffff, 0x000cffff, 0x0000003e, 0x0000004b, 0x00000059, 0x00000063, 0x00000064, 0x00000066, 0x00010006, 0x00010006, 0x00010007, 0x00010007, }, + {0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020067, 0x00020067, 0x00020067, 0x00020067, }, + {0x0014ffff, 0x0013ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0010ffff, }, + {0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, }, + {0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, }, + {0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, + {0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, }, + {0x00010032, 0x00010032, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, + {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, + {0x00010053, 0x00010053, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, }, + {0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, }, + {0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, }, + {0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, }, + {0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, }, + {0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, }, + {0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, }, + {0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, }, + {0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, }, + {0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, }, + {0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, }, +}; + +const unsigned int c_aaiCQMFHuffEnc11[256][2] = +{ + {0x0004, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0004}, {0x0006, 0x0002}, {0x0008, 0x0003}, {0x000b, 0x0004}, {0x000e, 0x000c}, {0x0010, 0x001e}, + {0x0013, 0x0000}, {0x0012, 0x005b}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, + {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0005, 0x0003}, {0x0008, 0x0004}, {0x000a, 0x0004}, {0x000d, 0x0009}, {0x000f, 0x0011}, + {0x0013, 0x0007}, {0x0012, 0x005c}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0004, 0x0005}, {0x0003, 0x0007}, {0x0005, 0x0004}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000b, 0x0005}, {0x000e, 0x000d}, {0x000f, 0x0012}, + {0x0012, 0x005d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, + {0x0006, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0005}, {0x0008, 0x0005}, {0x000a, 0x0005}, {0x000d, 0x000a}, {0x000f, 0x0013}, {0x0011, 0x0035}, + {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, + {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0005}, {0x000a, 0x0006}, {0x000c, 0x0006}, {0x000e, 0x000e}, {0x000f, 0x0014}, {0x0011, 0x0036}, + {0x0012, 0x005e}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, + {0x000b, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0007}, {0x000c, 0x0007}, {0x000e, 0x000f}, {0x000f, 0x0015}, {0x0011, 0x0037}, {0x0012, 0x005f}, + {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, + {0x000e, 0x0010}, {0x000d, 0x000b}, {0x000e, 0x0011}, {0x000f, 0x0016}, {0x0010, 0x001f}, {0x0012, 0x0060}, {0x0011, 0x0038}, {0x0012, 0x0061}, + {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, + {0x0010, 0x0020}, {0x000f, 0x0017}, {0x0010, 0x0021}, {0x0011, 0x0039}, {0x0011, 0x003a}, {0x0012, 0x0062}, {0x0013, 0x0034}, {0x0013, 0x0035}, + {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, + {0x0012, 0x0063}, {0x0011, 0x003b}, {0x0012, 0x0064}, {0x0012, 0x0065}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, + {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, + {0x0013, 0x004a}, {0x0012, 0x0066}, {0x0013, 0x004b}, {0x0012, 0x0067}, {0x0012, 0x0068}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, + {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, + {0x0013, 0x0057}, {0x0012, 0x0069}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, + {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, + {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, + {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, + {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, + {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, + {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, + {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, + {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, + {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, + {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, + {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, +}; + +const unsigned int c_aaiCQMFHuffDec11[43][16] = +{ + {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000000, 0x00000002, 0x00000020, 0x00010001, 0x00010001, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010021, 0x00010021, }, + {0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x00000004, 0x00000014, 0x00000033, 0x00000040, 0x00000041, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, + {0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x00020051, 0x00020051, 0x00020051, 0x00020051, }, + {0x0014ffff, 0x000bffff, 0x000affff, 0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000044, 0x00000053, 0x00010005, 0x00010005, 0x00010025, 0x00010025, 0x00010050, 0x00010050, 0x00010052, 0x00010052, }, + {0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, }, + {0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020054, 0x00020054, 0x00020054, 0x00020054, }, + {0x00000070, 0x00000072, 0x00010017, 0x00010017, 0x00010027, 0x00010027, 0x00010036, 0x00010036, 0x00010046, 0x00010046, 0x00010055, 0x00010055, 0x00010063, 0x00010063, 0x00010071, 0x00010071, }, + {0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x0011ffff, 0x0010ffff, 0x0012ffff, 0x0013ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000007, 0x00000064, }, + {0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, + {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, + {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, + {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020057, 0x00020057, 0x00020057, 0x00020057, }, + {0x000100fa, 0x000100fa, 0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, + {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, + {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020091, 0x00020091, 0x00020091, 0x00020091, 0x00020093, 0x00020093, 0x00020093, 0x00020093, }, + {0x0018ffff, 0x0017ffff, 0x0019ffff, 0x0015ffff, 0x0016ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, }, + {0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, }, + {0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, }, + {0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, }, + {0x00010008, 0x00010008, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010018, 0x00010018, }, + {0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, + {0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, }, + {0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, }, + {0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010084, 0x00010084, 0x00010085, 0x00010085, }, + {0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, }, + {0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010092, 0x00010092, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, }, + {0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, }, + {0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, }, + {0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, }, + {0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, }, + {0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, }, + {0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, }, + {0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, }, + {0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100d9, 0x000100d9, }, + {0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100e1, 0x000100e1, }, + {0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, }, + {0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, }, + {0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, }, +}; + +const unsigned int c_aaiCQMFHuffEnc12[400][2] = +{ + {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0005, 0x0002}, {0x0007, 0x0003}, {0x000a, 0x0004}, {0x000d, 0x0009}, {0x000f, 0x0011}, + {0x0012, 0x0053}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, + {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0004, 0x0007}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0005, 0x0003}, + {0x0007, 0x0004}, {0x0009, 0x0004}, {0x000c, 0x0008}, {0x000e, 0x000c}, {0x0010, 0x001b}, {0x0011, 0x002e}, {0x0013, 0x009d}, {0x0014, 0x0009}, + {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, + {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x0004}, {0x0008, 0x0004}, {0x000a, 0x0005}, {0x000d, 0x000a}, {0x000f, 0x0012}, + {0x0011, 0x002f}, {0x0013, 0x009e}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, + {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0007, 0x0005}, + {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000e, 0x000d}, {0x000f, 0x0013}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0014, 0x001c}, {0x0014, 0x001d}, + {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, + {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0005}, {0x0009, 0x0006}, {0x000b, 0x0006}, {0x000d, 0x000b}, {0x000e, 0x000e}, {0x0010, 0x001c}, + {0x0012, 0x0054}, {0x0013, 0x009f}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0014, 0x002b}, + {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x000a, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0007}, {0x000b, 0x0007}, + {0x000d, 0x000c}, {0x000e, 0x000f}, {0x000f, 0x0014}, {0x0011, 0x0032}, {0x0013, 0x00a0}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, + {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, + {0x000d, 0x000d}, {0x000c, 0x0009}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000e, 0x0010}, {0x0010, 0x001d}, {0x0010, 0x001e}, {0x0013, 0x00a1}, + {0x0013, 0x00a2}, {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, + {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x000f, 0x0015}, {0x000e, 0x0011}, {0x000f, 0x0016}, {0x000f, 0x0017}, + {0x0010, 0x001f}, {0x0011, 0x0033}, {0x0012, 0x0055}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, + {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, + {0x0011, 0x0034}, {0x0010, 0x0020}, {0x0010, 0x0021}, {0x0011, 0x0035}, {0x0012, 0x0056}, {0x0013, 0x00a3}, {0x0014, 0x0053}, {0x0014, 0x0054}, + {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, + {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0012, 0x0057}, {0x0012, 0x0058}, {0x0014, 0x0061}, {0x0014, 0x0062}, + {0x0012, 0x0059}, {0x0014, 0x0063}, {0x0012, 0x005a}, {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, + {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, + {0x0014, 0x0071}, {0x0012, 0x005b}, {0x0014, 0x0072}, {0x0013, 0x00a4}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, + {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, {0x0014, 0x007e}, + {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, + {0x0014, 0x0087}, {0x0013, 0x00a5}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, + {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, + {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, + {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, + {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0014, 0x00ad}, + {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, + {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, + {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, + {0x0014, 0x00c6}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, + {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, + {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, + {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, + {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, + {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, + {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, + {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, + {0x0014, 0x0106}, {0x0014, 0x0107}, {0x0014, 0x0108}, {0x0014, 0x0109}, {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, + {0x0014, 0x010e}, {0x0014, 0x010f}, {0x0014, 0x0110}, {0x0014, 0x0111}, {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, + {0x0014, 0x0116}, {0x0014, 0x0117}, {0x0014, 0x0118}, {0x0014, 0x0119}, {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, + {0x0014, 0x011e}, {0x0014, 0x011f}, {0x0014, 0x0120}, {0x0014, 0x0121}, {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, + {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, {0x0014, 0x0129}, {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, + {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, {0x0014, 0x0131}, {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, +}; + +const unsigned int c_aaiCQMFHuffDec12[44][16] = +{ + {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000001, 0x00000002, 0x00000014, 0x00000028, 0x0000002a, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010029, 0x00010029, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0000002c, 0x00000052, 0x00010004, 0x00010004, 0x00010018, 0x00010018, 0x0001003f, 0x0001003f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, + {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, + {0x0018ffff, 0x000fffff, 0x000effff, 0x000dffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0000001a, 0x00000079, 0x00010041, 0x00010041, 0x00010054, 0x00010054, 0x00010067, 0x00010067, }, + {0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, + {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, + {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020069, 0x00020069, 0x00020069, 0x00020069, }, + {0x000000a1, 0x000000a2, 0x00010007, 0x00010007, 0x0001002f, 0x0001002f, 0x00010043, 0x00010043, 0x0001006a, 0x0001006a, 0x0001008c, 0x0001008c, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, }, + {0x0029ffff, 0x002affff, 0x002bffff, 0x0017ffff, 0x0015ffff, 0x0014ffff, 0x0016ffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000001c, 0x00000057, 0x0000007d, 0x0000007e, 0x00000090, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, + {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, }, + {0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, + {0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, }, + {0x0001006c, 0x0001006c, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x000100a5, 0x000100a5, 0x000100cb, 0x000100cb, 0x000100e1, 0x000100e1, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, }, + {0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001001e, 0x0001001e, 0x00010031, 0x00010031, 0x00010059, 0x00010059, }, + {0x001affff, 0x001bffff, 0x0019ffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, }, + {0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, }, + {0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, }, + {0x00000026, 0x00000027, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003a, 0x0000003b, 0x00000046, 0x00000047, 0x00000048, 0x00000049, }, + {0x0000006d, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, }, + {0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, }, + {0x0000009d, 0x0000009e, 0x0000009f, 0x000000a6, 0x000000a7, 0x000000a8, 0x000000a9, 0x000000aa, 0x000000ab, 0x000000ac, 0x000000ad, 0x000000ae, 0x000000af, 0x000000b0, 0x000000b1, 0x000000b2, }, + {0x000000b3, 0x000000b6, 0x000000b7, 0x000000b9, 0x000000bb, 0x000000bc, 0x000000bd, 0x000000be, 0x000000bf, 0x000000c0, 0x000000c1, 0x000000c2, 0x000000c3, 0x000000c4, 0x000000c5, 0x000000c6, }, + {0x000000c7, 0x000000c8, 0x000000ca, 0x000000cc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000d8, }, + {0x000000d9, 0x000000da, 0x000000db, 0x000000dc, 0x000000dd, 0x000000de, 0x000000df, 0x000000e0, 0x000000e2, 0x000000e3, 0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, }, + {0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000f3, 0x000000f4, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, 0x000000f9, }, + {0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, }, + {0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, }, + {0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000129, }, + {0x0000012a, 0x0000012b, 0x0000012c, 0x0000012d, 0x0000012e, 0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x00000138, 0x00000139, }, + {0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, 0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00000144, 0x00000145, 0x00000146, 0x00000147, 0x00000148, 0x00000149, }, + {0x0000014a, 0x0000014b, 0x0000014c, 0x0000014d, 0x0000014e, 0x0000014f, 0x00000150, 0x00000151, 0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, }, + {0x0000015a, 0x0000015b, 0x0000015c, 0x0000015d, 0x0000015e, 0x0000015f, 0x00000160, 0x00000161, 0x00000162, 0x00000163, 0x00000164, 0x00000165, 0x00000166, 0x00000167, 0x00000168, 0x00000169, }, + {0x0000016a, 0x0000016b, 0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, }, + {0x0000017a, 0x0000017b, 0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, }, +}; + +const unsigned int c_aaiCQMFHuffEnc13[625][2] = +{ + {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0005}, {0x0008, 0x0006}, {0x000a, 0x0008}, {0x000c, 0x000c}, + {0x000e, 0x0019}, {0x0010, 0x0049}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, + {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0006, 0x0006}, {0x0007, 0x0006}, {0x0009, 0x0007}, + {0x000b, 0x0009}, {0x000d, 0x0011}, {0x000f, 0x002a}, {0x0010, 0x004a}, {0x0011, 0x0084}, {0x0012, 0x0100}, {0x0013, 0x000f}, {0x0013, 0x0010}, + {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, + {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0005, 0x0008}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x0009}, {0x0006, 0x0007}, {0x0008, 0x0007}, + {0x0009, 0x0008}, {0x000b, 0x000a}, {0x000d, 0x0012}, {0x000f, 0x002b}, {0x0012, 0x0101}, {0x0012, 0x0102}, {0x0013, 0x001b}, {0x0013, 0x001c}, + {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, + {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0005, 0x000a}, {0x0004, 0x000d}, {0x0005, 0x000b}, {0x0006, 0x0008}, {0x0007, 0x0007}, + {0x0009, 0x0009}, {0x000a, 0x0009}, {0x000c, 0x000d}, {0x000d, 0x0013}, {0x0010, 0x004b}, {0x0010, 0x004c}, {0x0013, 0x0028}, {0x0013, 0x0029}, + {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, + {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0008}, + {0x0008, 0x0008}, {0x000a, 0x000a}, {0x000b, 0x000b}, {0x000d, 0x0014}, {0x000e, 0x001a}, {0x0011, 0x0085}, {0x0010, 0x004d}, {0x0013, 0x0036}, + {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, + {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0008, 0x0009}, {0x0007, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, {0x000a, 0x000b}, {0x000b, 0x000c}, {0x000c, 0x000e}, {0x000e, 0x001b}, {0x000f, 0x002c}, {0x0011, 0x0086}, {0x0013, 0x0044}, + {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, + {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x000a, 0x000c}, {0x0009, 0x000a}, + {0x0009, 0x000b}, {0x000a, 0x000d}, {0x000b, 0x000d}, {0x000c, 0x000f}, {0x000e, 0x001c}, {0x000e, 0x001d}, {0x0011, 0x0087}, {0x0011, 0x0088}, + {0x0012, 0x0103}, {0x0012, 0x0104}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, + {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x000c, 0x0010}, + {0x000b, 0x000e}, {0x000b, 0x000f}, {0x000c, 0x0011}, {0x000d, 0x0015}, {0x000e, 0x001e}, {0x000f, 0x002d}, {0x0011, 0x0089}, {0x0011, 0x008a}, + {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, + {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, + {0x000e, 0x001f}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000e, 0x0020}, {0x000e, 0x0021}, {0x000f, 0x002e}, {0x0010, 0x004e}, {0x0013, 0x0070}, + {0x0012, 0x0105}, {0x0012, 0x0106}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, + {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, + {0x0013, 0x007f}, {0x0010, 0x004f}, {0x000f, 0x002f}, {0x000f, 0x0030}, {0x000f, 0x0031}, {0x0010, 0x0050}, {0x0011, 0x008b}, {0x0011, 0x008c}, + {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, + {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, + {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0012, 0x0107}, {0x0010, 0x0051}, {0x0010, 0x0052}, {0x0010, 0x0053}, {0x0011, 0x008d}, {0x0011, 0x008e}, + {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, + {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, + {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0011, 0x008f}, {0x0011, 0x0090}, {0x0013, 0x00a5}, {0x0011, 0x0091}, {0x0013, 0x00a6}, + {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, + {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, + {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, + {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, + {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, + {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, + {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, + {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, + {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, + {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, + {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, + {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, + {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, + {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, + {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, + {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, + {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, + {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, + {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, + {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, + {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, + {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, {0x0013, 0x0153}, {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, + {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, {0x0013, 0x015b}, {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, + {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, {0x0013, 0x0163}, {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, + {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, {0x0013, 0x016b}, {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, + {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, {0x0013, 0x0173}, {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, + {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, {0x0013, 0x017b}, {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, + {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, {0x0013, 0x0183}, {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, + {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, {0x0013, 0x018b}, {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, + {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, {0x0013, 0x0193}, {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, + {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, {0x0013, 0x019b}, {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, + {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, {0x0013, 0x01a3}, {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, + {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, {0x0013, 0x01ab}, {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, + {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, {0x0013, 0x01b3}, {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, + {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, {0x0013, 0x01bb}, {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, + {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, {0x0013, 0x01c3}, {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, + {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, {0x0013, 0x01cb}, {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, + {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, {0x0013, 0x01d3}, {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, + {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, {0x0013, 0x01db}, {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, + {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, {0x0013, 0x01e3}, {0x0013, 0x01e4}, {0x0013, 0x01e5}, {0x0013, 0x01e6}, + {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, {0x0013, 0x01ec}, {0x0013, 0x01ed}, {0x0013, 0x01ee}, + {0x0013, 0x01ef}, {0x0013, 0x01f0}, {0x0013, 0x01f1}, {0x0013, 0x01f2}, {0x0013, 0x01f3}, {0x0013, 0x01f4}, {0x0013, 0x01f5}, {0x0013, 0x01f6}, + {0x0013, 0x01f7}, {0x0013, 0x01f8}, {0x0013, 0x01f9}, {0x0013, 0x01fa}, {0x0013, 0x01fb}, {0x0013, 0x01fc}, {0x0013, 0x01fd}, {0x0013, 0x01fe}, + {0x0013, 0x01ff}, + +}; + +const unsigned int c_aaiCQMFHuffDec13[98][16] = +{ + {0x0006ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000001, 0x00000019, 0x0000001b, 0x0000001c, 0x00000033, 0x00000034, 0x0000004c, 0x0001001a, 0x0001001a, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, }, + {0x00010067, 0x00010067, 0x0001007e, 0x0001007e, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x00020036, 0x00020036, 0x00020036, 0x00020036, }, + {0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, + {0x000cffff, 0x000bffff, 0x000affff, 0x0008ffff, 0x0007ffff, 0x0009ffff, 0x00000005, 0x00000037, 0x00000068, 0x0000007d, 0x0000007f, 0x00000080, 0x0001001e, 0x0001001e, 0x0001004f, 0x0001004f, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, + {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020099, 0x00020099, 0x00020099, 0x00020099, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, + {0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, }, + {0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, + {0x000000af, 0x000000b2, 0x00010020, 0x00010020, 0x00010039, 0x00010039, 0x0001006a, 0x0001006a, 0x00010082, 0x00010082, 0x0001009a, 0x0001009a, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, }, + {0x001effff, 0x002fffff, 0x0040ffff, 0x0051ffff, 0x0014ffff, 0x0013ffff, 0x0011ffff, 0x0012ffff, 0x000effff, 0x000dffff, 0x000fffff, 0x0010ffff, 0x00000007, 0x00000052, 0x00000083, 0x0000009b, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, + {0x000200cb, 0x000200cb, 0x000200cb, 0x000200cb, 0x000200cc, 0x000200cc, 0x000200cc, 0x000200cc, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, + {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, }, + {0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, }, + {0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x00020084, 0x00020084, 0x00020084, 0x00020084, }, + {0x0002009c, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, }, + {0x000000e5, 0x000000fb, 0x000000fc, 0x000000fd, 0x00010022, 0x00010022, 0x0001003b, 0x0001003b, 0x00010085, 0x00010085, 0x000100b5, 0x000100b5, 0x000100cd, 0x000100cd, 0x000100e2, 0x000100e2, }, + {0x001cffff, 0x001dffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x00000009, 0x00000023, 0x00000054, 0x00000055, 0x0000006e, 0x000000ce, 0x000000e1, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, }, + {0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, }, + {0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, }, + {0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, }, + {0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, }, + {0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, }, + {0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, }, + {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, }, + {0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200fa, 0x000200fa, 0x000200fa, 0x000200fa, }, + {0x0021ffff, 0x0023ffff, 0x0022ffff, 0x0025ffff, 0x0024ffff, 0x0026ffff, 0x0029ffff, 0x001fffff, 0x0020ffff, 0x0027ffff, 0x0028ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, }, + {0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, }, + {0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, + {0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, }, + {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, + {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010026, 0x00010026, }, + {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, }, + {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, + {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, }, + {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, }, + {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, }, + {0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, }, + {0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, }, + {0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, }, + {0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, }, + {0x000100cf, 0x000100cf, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, }, + {0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, }, + {0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, }, + {0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, }, + {0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, }, + {0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, }, + {0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, }, + {0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, 0x00010112, 0x00010112, 0x00010115, 0x00010115, 0x00010117, 0x00010117, 0x00010118, 0x00010118, }, + {0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, + {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, + {0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, }, + {0x00010131, 0x00010131, 0x00010132, 0x00010132, 0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, }, + {0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, }, + {0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010148, 0x00010148, }, + {0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, }, + {0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, }, + {0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, }, + {0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, }, + {0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, }, + {0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, }, + {0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, }, + {0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, }, + {0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, }, + {0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, }, + {0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, 0x00010194, 0x00010194, 0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, }, + {0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, }, + {0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, }, + {0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, }, + {0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, }, + {0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, }, + {0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, }, + {0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, }, + {0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, }, + {0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, 0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, }, + {0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, }, + {0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, }, + {0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, 0x0061ffff, }, + {0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, }, + {0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, }, + {0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, 0x00010204, 0x00010204, 0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, }, + {0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, }, + {0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, 0x00010214, 0x00010214, 0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, }, + {0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, }, + {0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, 0x00010224, 0x00010224, 0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, }, + {0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, }, + {0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, }, + {0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, }, + {0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, 0x00010244, 0x00010244, 0x00010245, 0x00010245, 0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, }, + {0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, 0x0001024c, 0x0001024c, 0x0001024d, 0x0001024d, 0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, }, + {0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, 0x00010254, 0x00010254, 0x00010255, 0x00010255, 0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, }, + {0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, 0x0001025c, 0x0001025c, 0x0001025d, 0x0001025d, 0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, }, + {0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, 0x00010264, 0x00010264, 0x00010265, 0x00010265, 0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, }, + {0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, 0x0001026c, 0x0001026c, 0x0001026d, 0x0001026d, 0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00010270, 0x00010270, }, +}; + +const unsigned int c_aaiCQMFHuffEnc14[625][2] = +{ + {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0006, 0x0007}, {0x0007, 0x0007}, {0x0009, 0x0009}, {0x000a, 0x000a}, + {0x000c, 0x000e}, {0x000e, 0x0019}, {0x000f, 0x0029}, {0x0010, 0x0046}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, + {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, + {0x0013, 0x000c}, {0x0005, 0x000b}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x000c}, {0x0006, 0x0008}, {0x0008, 0x0008}, + {0x0009, 0x000a}, {0x000b, 0x000c}, {0x000c, 0x000f}, {0x000e, 0x001a}, {0x0010, 0x0047}, {0x0010, 0x0048}, {0x0012, 0x00f1}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, + {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0005, 0x000d}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x000e}, {0x0006, 0x0009}, {0x0007, 0x0008}, + {0x0008, 0x0009}, {0x000a, 0x000b}, {0x000b, 0x000d}, {0x000d, 0x0013}, {0x000e, 0x001b}, {0x0010, 0x0049}, {0x0013, 0x0018}, {0x0013, 0x0019}, + {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, + {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0005, 0x000f}, {0x0004, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x000a}, + {0x0007, 0x0009}, {0x0009, 0x000b}, {0x000a, 0x000c}, {0x000c, 0x0010}, {0x000d, 0x0014}, {0x000f, 0x002a}, {0x0012, 0x00f2}, {0x0013, 0x0025}, + {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, + {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0006, 0x000b}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0006, 0x000c}, + {0x0007, 0x000a}, {0x0008, 0x000a}, {0x000a, 0x000d}, {0x000b, 0x000e}, {0x000c, 0x0011}, {0x000e, 0x001c}, {0x000f, 0x002b}, {0x0011, 0x0081}, + {0x0013, 0x0032}, {0x0012, 0x00f3}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, + {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0007, 0x000b}, {0x0006, 0x000d}, {0x0007, 0x000c}, + {0x0007, 0x000d}, {0x0008, 0x000b}, {0x0009, 0x000c}, {0x000b, 0x000f}, {0x000c, 0x0012}, {0x000d, 0x0015}, {0x000e, 0x001d}, {0x0010, 0x004a}, + {0x0011, 0x0082}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, + {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0009, 0x000d}, {0x0008, 0x000c}, + {0x0008, 0x000d}, {0x0009, 0x000e}, {0x000a, 0x000e}, {0x000b, 0x0010}, {0x000c, 0x0013}, {0x000d, 0x0016}, {0x000e, 0x001e}, {0x000f, 0x002c}, + {0x0010, 0x004b}, {0x0012, 0x00f4}, {0x0012, 0x00f5}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, + {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x000a, 0x000f}, + {0x0009, 0x000f}, {0x000a, 0x0010}, {0x000a, 0x0011}, {0x000b, 0x0011}, {0x000c, 0x0014}, {0x000d, 0x0017}, {0x000e, 0x001f}, {0x000f, 0x002d}, + {0x0010, 0x004c}, {0x0011, 0x0083}, {0x0011, 0x0084}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, + {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, + {0x000c, 0x0015}, {0x000b, 0x0012}, {0x000b, 0x0013}, {0x000c, 0x0016}, {0x000c, 0x0017}, {0x000d, 0x0018}, {0x000e, 0x0020}, {0x000f, 0x002e}, + {0x0011, 0x0085}, {0x0010, 0x004d}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, + {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, + {0x0013, 0x0072}, {0x000e, 0x0021}, {0x000d, 0x0019}, {0x000d, 0x001a}, {0x000d, 0x001b}, {0x000e, 0x0022}, {0x000f, 0x002f}, {0x0010, 0x004e}, + {0x0011, 0x0086}, {0x0011, 0x0087}, {0x0013, 0x0073}, {0x0012, 0x00f6}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, + {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, + {0x0013, 0x0080}, {0x0013, 0x0081}, {0x000f, 0x0030}, {0x000e, 0x0023}, {0x000e, 0x0024}, {0x000e, 0x0025}, {0x0010, 0x004f}, {0x0012, 0x00f7}, + {0x0011, 0x0088}, {0x0012, 0x00f8}, {0x0012, 0x00f9}, {0x0012, 0x00fa}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, + {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, + {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0012, 0x00fb}, {0x0010, 0x0050}, {0x0010, 0x0051}, {0x000f, 0x0031}, {0x0012, 0x00fc}, + {0x0012, 0x00fd}, {0x0012, 0x00fe}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, + {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, + {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0011, 0x0089}, {0x0011, 0x008a}, + {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0011, 0x008b}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, + {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, + {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0012, 0x00ff}, {0x0013, 0x00ba}, + {0x0012, 0x0100}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, + {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, + {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, + {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, + {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, + {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, + {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, + {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, + {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, + {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, + {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, + {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, + {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, + {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, + {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, + {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, + {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, + {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, + {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, + {0x0013, 0x0152}, {0x0013, 0x0153}, {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, + {0x0013, 0x015a}, {0x0013, 0x015b}, {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, + {0x0013, 0x0162}, {0x0013, 0x0163}, {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, + {0x0013, 0x016a}, {0x0013, 0x016b}, {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, + {0x0013, 0x0172}, {0x0013, 0x0173}, {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, + {0x0013, 0x017a}, {0x0013, 0x017b}, {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, + {0x0013, 0x0182}, {0x0013, 0x0183}, {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, + {0x0013, 0x018a}, {0x0013, 0x018b}, {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, + {0x0013, 0x0192}, {0x0013, 0x0193}, {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, + {0x0013, 0x019a}, {0x0013, 0x019b}, {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, + {0x0013, 0x01a2}, {0x0013, 0x01a3}, {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, + {0x0013, 0x01aa}, {0x0013, 0x01ab}, {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, + {0x0013, 0x01b2}, {0x0013, 0x01b3}, {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, + {0x0013, 0x01ba}, {0x0013, 0x01bb}, {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, + {0x0013, 0x01c2}, {0x0013, 0x01c3}, {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, + {0x0013, 0x01ca}, {0x0013, 0x01cb}, {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, + {0x0013, 0x01d2}, {0x0013, 0x01d3}, {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, + {0x0013, 0x01da}, {0x0013, 0x01db}, {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, + {0x0012, 0x0101}, + +}; + +const unsigned int c_aaiCQMFHuffDec14[103][16] = +{ + {0x000affff, 0x0009ffff, 0x0008ffff, 0x0002ffff, 0x0003ffff, 0x0001ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0000001a, 0x0000001b, 0x0000001c, 0x00000033, 0x00000034, 0x0000004c, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, + {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, + {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, + {0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, }, + {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020064, 0x00020064, 0x00020064, 0x00020064, }, + {0x00010037, 0x00010037, 0x00010050, 0x00010050, 0x00010068, 0x00010068, 0x0001007d, 0x0001007d, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00020004, 0x00020004, 0x00020004, 0x00020004, }, + {0x0012ffff, 0x0011ffff, 0x000fffff, 0x0010ffff, 0x000cffff, 0x000bffff, 0x000dffff, 0x000effff, 0x0000001f, 0x00000038, 0x00000069, 0x00000081, 0x00000097, 0x00000098, 0x00010005, 0x00010005, }, + {0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, + {0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, }, + {0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, }, + {0x0001009b, 0x0001009b, 0x000100b3, 0x000100b3, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002009a, 0x0002009a, 0x0002009a, 0x0002009a, 0x000200af, 0x000200af, 0x000200af, 0x000200af, }, + {0x00000053, 0x0000006c, 0x00000084, 0x0000009c, 0x000000b4, 0x000000c8, 0x000000cb, 0x000000cc, 0x00010021, 0x00010021, 0x0001003a, 0x0001003a, 0x0001006b, 0x0001006b, 0x00010083, 0x00010083, }, + {0x0028ffff, 0x0039ffff, 0x004affff, 0x0023ffff, 0x001cffff, 0x001bffff, 0x0019ffff, 0x0018ffff, 0x001affff, 0x0015ffff, 0x0013ffff, 0x0014ffff, 0x0016ffff, 0x0017ffff, 0x00000008, 0x00000022, }, + {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, }, + {0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, }, + {0x000200fc, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, }, + {0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, }, + {0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, }, + {0x000100fa, 0x000100fa, 0x00010116, 0x00010116, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, }, + {0x000200ce, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200fb, 0x000200fb, 0x000200fb, 0x000200fb, }, + {0x00000114, 0x00000115, 0x0001000a, 0x0001000a, 0x00010055, 0x00010055, 0x0001006e, 0x0001006e, 0x0001009f, 0x0001009f, 0x000100b7, 0x000100b7, 0x000100cf, 0x000100cf, 0x000100e6, 0x000100e6, }, + {0x001fffff, 0x001dffff, 0x001effff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0000000b, 0x00000024, 0x00000025, 0x0000003d, 0x00000087, 0x000000a0, 0x000000b8, 0x000000d1, 0x000000e7, 0x000000fe, }, + {0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, }, + {0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, }, + {0x00020148, 0x00020148, 0x00020148, 0x00020148, 0x00020270, 0x00020270, 0x00020270, 0x00020270, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, }, + {0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, }, + {0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, }, + {0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, }, + {0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, 0x0061ffff, 0x0062ffff, 0x0063ffff, 0x0064ffff, 0x0065ffff, 0x0066ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, }, + {0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020071, 0x00020071, 0x00020071, 0x00020071, }, + {0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200eb, 0x000200eb, 0x000200eb, 0x000200eb, 0x000200ff, 0x000200ff, 0x000200ff, 0x000200ff, }, + {0x00020101, 0x00020101, 0x00020101, 0x00020101, 0x00020102, 0x00020102, 0x00020102, 0x00020102, 0x00020103, 0x00020103, 0x00020103, 0x00020103, 0x00020113, 0x00020113, 0x00020113, 0x00020113, }, + {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020118, 0x00020118, 0x00020118, 0x00020118, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x00020146, 0x00020146, 0x00020146, 0x00020146, }, + {0x0031ffff, 0x002dffff, 0x002bffff, 0x002cffff, 0x002effff, 0x002fffff, 0x0032ffff, 0x0037ffff, 0x0029ffff, 0x002affff, 0x0030ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0038ffff, }, + {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, }, + {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, }, + {0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, + {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, + {0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, + {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, }, + {0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, }, + {0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100bb, 0x000100bb, }, + {0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, + {0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010070, 0x00010070, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, }, + {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, + {0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, }, + {0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, }, + {0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100ea, 0x000100ea, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, }, + {0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, + {0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, }, + {0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, }, + {0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, }, + {0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, }, + {0x00010112, 0x00010112, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, + {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, + {0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010133, 0x00010133, }, + {0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, }, + {0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, }, + {0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010147, 0x00010147, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, }, + {0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, }, + {0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, }, + {0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, }, + {0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, }, + {0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, }, + {0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, }, + {0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, }, + {0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, }, + {0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, }, + {0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, 0x00010194, 0x00010194, 0x00010195, 0x00010195, }, + {0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, }, + {0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, }, + {0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, }, + {0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, }, + {0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, }, + {0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, }, + {0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, }, + {0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, }, + {0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, 0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, }, + {0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, }, + {0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, }, + {0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, }, + {0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, }, + {0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, 0x00010204, 0x00010204, 0x00010205, 0x00010205, }, + {0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, }, + {0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, 0x00010214, 0x00010214, 0x00010215, 0x00010215, }, + {0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, }, + {0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, 0x00010224, 0x00010224, 0x00010225, 0x00010225, }, + {0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, }, + {0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, }, + {0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, }, + {0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, 0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, 0x00010244, 0x00010244, 0x00010245, 0x00010245, }, + {0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, 0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, 0x0001024c, 0x0001024c, 0x0001024d, 0x0001024d, }, + {0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, 0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, 0x00010254, 0x00010254, 0x00010255, 0x00010255, }, + {0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, 0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, 0x0001025c, 0x0001025c, 0x0001025d, 0x0001025d, }, + {0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, 0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, 0x00010264, 0x00010264, 0x00010265, 0x00010265, }, + {0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, 0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, 0x0001026c, 0x0001026c, 0x0001026d, 0x0001026d, }, +}; + +const unsigned int c_aaiCQMFHuffEnc15[28][2] = +{ + {0x0003, 0x0001}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0001}, {0x0005, 0x0001}, {0x0006, 0x0001}, + {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000f, 0x0003}, + {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, {0x0011, 0x0007}, + {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, + +}; + +const unsigned int c_aaiCQMFHuffDec15[10][16] = +{ + {0x0001ffff, 0x00000005, 0x00010000, 0x00010000, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, + {0x0002ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x0003ffff, 0x0000000d, 0x0001000c, 0x0001000c, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x0001000f, 0x0001000f, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, +}; + +const unsigned int c_aaiCQMFHuffEnc16[32][2] = +{ + {0x0003, 0x0001}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0001}, {0x0005, 0x0001}, + {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, + {0x0010, 0x0007}, {0x0011, 0x0001}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, + {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, +}; + +const unsigned int c_aaiCQMFHuffDec16[11][16] = +{ + {0x0001ffff, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x0002ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, +}; + +const unsigned int c_aaiCQMFHuffEnc17[41][2] = +{ + {0x0004, 0x0001}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0002}, + {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, + {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x0010, 0x0003}, {0x0011, 0x0005}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, + {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, + {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, + {0x0013, 0x0013}, + +}; + +const unsigned int c_aaiCQMFHuffDec17[7][16] = +{ + {0x0001ffff, 0x00000000, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, }, + {0x0002ffff, 0x0000000c, 0x0001000b, 0x0001000b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003ffff, 0x00000010, 0x0001000f, 0x0001000f, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0005ffff, 0x0006ffff, 0x0004ffff, 0x00000013, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, }, + {0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, }, +}; + +const unsigned int c_aaiCQMFHuffEnc18[40][2] = +{ + {0x0004, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, + {0x0004, 0x0005}, {0x0005, 0x0001}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, + {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0011, 0x0003}, {0x0012, 0x0004}, + {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0012, 0x0005}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, + {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0013, 0x0007}, +}; + +const unsigned int c_aaiCQMFHuffDec18[7][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, }, + {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0004ffff, 0x00000012, 0x00010011, 0x00010011, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x0006ffff, 0x0005ffff, 0x00010015, 0x00010015, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x00000018, 0x00000019, 0x0000001a, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00010027, 0x00010027, }, +}; + +const unsigned int c_aaiCQMFHuffEnc19[47][2] = +{ + {0x0004, 0x0002}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, + {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0007, 0x0002}, + {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000e, 0x0002}, {0x000e, 0x0003}, + {0x0010, 0x0005}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0011, 0x0009}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0001}, {0x0012, 0x0002}, + {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, + {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0012, 0x0011}, + +}; + +const unsigned int c_aaiCQMFHuffDec19[10][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003ffff, 0x00000011, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x0004ffff, 0x00000015, 0x00010014, 0x00010014, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x0005ffff, 0x00000018, 0x00000019, 0x0000001a, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, + {0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, + {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, + {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, +}; + +const unsigned int c_aaiCQMFHuffEnc20[58][2] = +{ + {0x0004, 0x0002}, {0x0003, 0x0005}, {0x0004, 0x0003}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, + {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0002}, + {0x0007, 0x0003}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, + {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0003}, {0x000f, 0x0005}, {0x0011, 0x0007}, + {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0011, 0x0008}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, + {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0011, 0x0009}, + {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, + {0x0011, 0x0012}, {0x0011, 0x0013}, + +}; + +const unsigned int c_aaiCQMFHuffDec20[17][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000002, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00010001, 0x00010001, 0x00010003, 0x00010003, 0x00010004, 0x00010004, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0004ffff, 0x0003ffff, 0x00000011, 0x00000012, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x0006ffff, 0x0005ffff, 0x00000019, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x000fffff, 0x0010ffff, 0x000effff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x0001001e, 0x0001001e, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, + {0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, +}; + +const unsigned int c_aaiCQMFHuffEnc21[70][2] = +{ + {0x0005, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, + {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, + {0x0005, 0x0007}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, + {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, {0x000b, 0x0003}, + {0x000c, 0x0003}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000e, 0x0004}, {0x000f, 0x0007}, {0x000e, 0x0005}, {0x0011, 0x0004}, + {0x0010, 0x000d}, {0x0011, 0x0005}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, + {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, + {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, + {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, + +}; + +const unsigned int c_aaiCQMFHuffDec21[23][16] = +{ + {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, }, + {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x0006ffff, 0x0005ffff, 0x00000018, 0x00000019, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000020, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, + {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, + {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, + {0x0016ffff, 0x0015ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x00000028, 0x00010025, 0x00010025, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, + {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, + {0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, }, + {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, + {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, }, + {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, }, +}; + +const unsigned int c_aaiCQMFHuffEnc22[81][2] = +{ + {0x0005, 0x0004}, {0x0004, 0x0006}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0004, 0x0007}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0005, 0x0007}, + {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0003}, + {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0003}, + {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, + {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000d, 0x0005}, {0x000e, 0x0005}, + {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x0010, 0x0011}, {0x0010, 0x0012}, {0x0011, 0x0000}, {0x0011, 0x0001}, + {0x0011, 0x0002}, {0x0010, 0x0013}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, + {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, + {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, + {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, + {0x0011, 0x0021}, + +}; + +const unsigned int c_aaiCQMFHuffDec22[30][16] = +{ + {0x0005ffff, 0x0006ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x0004ffff, 0x00000001, 0x00000004, 0x0000000a, 0x0000000c, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x0001000b, 0x0001000b, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000017, 0x00000018, 0x00000019, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x000cffff, 0x000bffff, 0x000affff, 0x00000023, 0x00000024, 0x00000025, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, + {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, + {0x001dffff, 0x0000002c, 0x0000002d, 0x00000031, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, }, + {0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, }, + {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, + {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, + {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, + {0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, + {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, + {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, + {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, }, + {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, + {0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, }, + {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, + {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, + {0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, +}; + +const unsigned int c_aaiCQMFHuffEnc23[93][2] = +{ + {0x0005, 0x0004}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, + {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, + {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, + {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x0009, 0x0004}, + {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000b, 0x0003}, {0x000a, 0x0005}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0004}, + {0x000c, 0x0005}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x0010, 0x0014}, {0x000f, 0x000b}, + {0x000f, 0x000c}, {0x000f, 0x000d}, {0x000f, 0x000e}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x000f, 0x000f}, {0x0011, 0x0002}, {0x0011, 0x0003}, + {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, + {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, + {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, + {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, + {0x0011, 0x0024}, {0x0011, 0x0025}, {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0010, 0x0015}, + +}; + +const unsigned int c_aaiCQMFHuffDec23[35][16] = +{ + {0x0006ffff, 0x0007ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, }, + {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x000affff, 0x0008ffff, 0x0009ffff, 0x0000001b, 0x0000001c, 0x0000001d, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, + {0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x000effff, 0x000dffff, 0x000bffff, 0x000cffff, 0x00000027, 0x00000028, 0x00010023, 0x00010023, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0000002e, 0x0000005c, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010035, 0x00010035, }, + {0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, }, + {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, + {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, + {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, + {0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, }, + {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, + {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, + {0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, + {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, }, + {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, + {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, + {0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, + {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, + {0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, }, + {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, }, + {0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, }, +}; + +const unsigned int c_aaiCQMFHuffEnc24[121][2] = +{ + {0x0006, 0x0005}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, + {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, + {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, + {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0004}, {0x0007, 0x0005}, + {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, + {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, + {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000d, 0x0004}, + {0x000c, 0x0007}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, + {0x0010, 0x000f}, {0x000f, 0x000c}, {0x0011, 0x0016}, {0x0010, 0x0010}, {0x000f, 0x000d}, {0x0010, 0x0011}, {0x0012, 0x0000}, {0x0011, 0x0017}, + {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, + {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, + {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0012, 0x0017}, {0x0012, 0x0018}, + {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, {0x0012, 0x0020}, + {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, {0x0012, 0x0028}, + {0x0012, 0x0029}, {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, + {0x0011, 0x001d}, + +}; + +const unsigned int c_aaiCQMFHuffDec24[37][16] = +{ + {0x000dffff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000001, 0x00000002, 0x00000003, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, + {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, + {0x0011ffff, 0x0010ffff, 0x000effff, 0x000fffff, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, + {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, }, + {0x0015ffff, 0x0014ffff, 0x0012ffff, 0x0013ffff, 0x00000034, 0x00000035, 0x00000036, 0x00000038, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x00000043, 0x00000045, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010044, 0x00010044, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, }, + {0x0024ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x00000040, }, + {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, }, + {0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, }, + {0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, + {0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, }, + {0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, + {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, + {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, + {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, + {0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, }, + {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, + {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, }, + {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, }, + {0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020072, 0x00020072, 0x00020072, 0x00020072, }, + {0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, +}; + +const unsigned int c_aaiCQMFHuffEnc25[136][2] = +{ + {0x0006, 0x0006}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, + {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, + {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x0007}, {0x0006, 0x0008}, + {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, + {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, + {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, + {0x0008, 0x0009}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x000a, 0x0004}, {0x000a, 0x0005}, + {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0005}, + {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, + {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000f, 0x0010}, {0x000e, 0x000b}, {0x000f, 0x0011}, {0x0010, 0x001b}, {0x0010, 0x001c}, {0x0010, 0x001d}, + {0x0010, 0x001e}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, + {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0010, 0x001f}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, + {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, {0x0011, 0x0014}, {0x0011, 0x0015}, + {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, {0x0011, 0x001d}, + {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, {0x0011, 0x0024}, {0x0011, 0x0025}, + {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0011, 0x0028}, {0x0011, 0x0029}, {0x0011, 0x002a}, {0x0011, 0x002b}, {0x0011, 0x002c}, {0x0011, 0x002d}, + {0x0011, 0x002e}, {0x0011, 0x002f}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0011, 0x0032}, {0x0011, 0x0033}, {0x0011, 0x0034}, {0x0011, 0x0035}, +}; + +const unsigned int c_aaiCQMFHuffDec25[54][16] = +{ + {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, + {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, + {0x0015ffff, 0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, }, + {0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x001affff, 0x0019ffff, 0x0018ffff, 0x0016ffff, 0x0017ffff, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, }, + {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x0001004a, 0x0001004a, 0x0001004c, 0x0001004c, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, }, + {0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x0000005a, }, + {0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, }, + {0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, + {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, + {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, + {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, + {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, }, + {0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, }, + {0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, }, + {0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, }, + {0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, }, + {0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, + {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, + {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, + {0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, }, + {0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, }, + {0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, }, + {0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, }, + {0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, + {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, }, + {0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, }, + {0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, }, + {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, + {0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, }, + {0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, }, + {0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, + {0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, }, + {0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, }, + {0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, }, +}; + +const unsigned int c_aaiCQMFHuffEnc26[164][2] = +{ + {0x0006, 0x0008}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, + {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, + {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0005, 0x001f}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, + {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, + {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, + {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, + {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x000a, 0x0005}, {0x000a, 0x0006}, + {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, + {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, + {0x000d, 0x0008}, {0x000e, 0x0006}, {0x000d, 0x0009}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0008}, {0x000f, 0x0009}, + {0x000f, 0x000a}, {0x0011, 0x0014}, {0x0010, 0x000b}, {0x000f, 0x000b}, {0x0010, 0x000c}, {0x0012, 0x001b}, {0x0010, 0x000d}, {0x0010, 0x000e}, + {0x0011, 0x0015}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0010, 0x000f}, {0x0012, 0x001e}, {0x0013, 0x0000}, {0x0012, 0x001f}, {0x0013, 0x0001}, + {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0012, 0x0020}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, + {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, + {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, + {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, + {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, + {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, + {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, + {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, + +}; + +const unsigned int c_aaiCQMFHuffDec26[38][16] = +{ + {0x000fffff, 0x0010ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, }, + {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, + {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, + {0x0015ffff, 0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, + {0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, + {0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, + {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, + {0x001affff, 0x0019ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, + {0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, }, + {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, + {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, + {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x0001005b, 0x0001005b, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, + {0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x001dffff, 0x001cffff, 0x001effff, 0x001fffff, 0x001bffff, 0x0000005a, 0x0000005c, 0x0000005e, 0x0000005f, 0x00000063, }, + {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, + {0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, + {0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, }, + {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, }, + {0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, }, + {0x00010065, 0x00010065, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, }, + {0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, }, + {0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, }, + {0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, }, + {0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, }, + {0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, }, +}; + +extern const unsigned int (*GetHuffEncTable(const int iAlloc))[2]; + +extern const unsigned int (*GetHuffDecTable(const int iAlloc))[16]; + diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h b/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h new file mode 100644 index 0000000000..b8103689fe --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h @@ -0,0 +1,305 @@ +#ifndef _CQMF_HUFF_H_ +#define _CQMF_HUFF_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef HUFF_READ_SIZE +#define HUFF_READ_SIZE (4) +#endif + +#ifndef HUFF_DEC_TABLE_SIZE +#define HUFF_DEC_TABLE_SIZE (16) +#endif + +#include // For NULL + +extern const unsigned int c_aaiCQMFHuffEnc1[16][2]; + +extern const unsigned int c_aaiCQMFHuffDec1[4][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc2[25][2]; + +extern const unsigned int c_aaiCQMFHuffDec2[4][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc3[36][2]; + +extern const unsigned int c_aaiCQMFHuffDec3[14][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc4[49][2]; + +extern const unsigned int c_aaiCQMFHuffDec4[9][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc5[64][2]; + +extern const unsigned int c_aaiCQMFHuffDec5[27][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc6[81][2]; + +extern const unsigned int c_aaiCQMFHuffDec6[21][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc7[81][2]; + +extern const unsigned int c_aaiCQMFHuffDec7[23][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc8[121][2]; + +extern const unsigned int c_aaiCQMFHuffDec8[17][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc9[196][2]; + +extern const unsigned int c_aaiCQMFHuffDec9[30][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc10[196][2]; + +extern const unsigned int c_aaiCQMFHuffDec10[34][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc11[256][2]; + +extern const unsigned int c_aaiCQMFHuffDec11[43][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc12[400][2]; + +extern const unsigned int c_aaiCQMFHuffDec12[44][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc13[625][2]; + +extern const unsigned int c_aaiCQMFHuffDec13[98][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc14[625][2]; + +extern const unsigned int c_aaiCQMFHuffDec14[103][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc15[28][2]; + +extern const unsigned int c_aaiCQMFHuffDec15[10][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc16[32][2]; + +extern const unsigned int c_aaiCQMFHuffDec16[11][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc17[41][2]; + +extern const unsigned int c_aaiCQMFHuffDec17[7][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc18[40][2]; + +extern const unsigned int c_aaiCQMFHuffDec18[7][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc19[47][2]; + +extern const unsigned int c_aaiCQMFHuffDec19[10][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc20[58][2]; + +extern const unsigned int c_aaiCQMFHuffDec20[17][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc21[70][2]; + +extern const unsigned int c_aaiCQMFHuffDec21[23][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc22[81][2]; + +extern const unsigned int c_aaiCQMFHuffDec22[30][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc23[93][2]; + +extern const unsigned int c_aaiCQMFHuffDec23[35][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc24[121][2]; + +extern const unsigned int c_aaiCQMFHuffDec24[37][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc25[136][2]; + +extern const unsigned int c_aaiCQMFHuffDec25[54][HUFF_DEC_TABLE_SIZE]; + +extern const unsigned int c_aaiCQMFHuffEnc26[164][2]; + +extern const unsigned int c_aaiCQMFHuffDec26[38][HUFF_DEC_TABLE_SIZE]; + +inline const unsigned int (*GetHuffEncTable(const int iAlloc))[2] +{ + const unsigned int (*pauiHuffmanTable)[2] = NULL; + + switch(iAlloc){ + case 1: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc1; + break; + case 2: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc2; + break; + case 3: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc3; + break; + case 4: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc4; + break; + case 5: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc5; + break; + case 6: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc6; + break; + case 7: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc7; + break; + case 8: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc8; + break; + case 9: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc9; + break; + case 10: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc10; + break; + case 11: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc11; + break; + case 12: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc12; + break; + case 13: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc13; + break; + case 14: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc14; + break; + case 15: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc15; + break; + case 16: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc16; + break; + case 17: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc17; + break; + case 18: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc18; + break; + case 19: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc19; + break; + case 20: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc20; + break; + case 21: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc21; + break; + case 22: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc22; + break; + case 23: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc23; + break; + case 24: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc24; + break; + case 25: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc25; + break; + case 26: + pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc26; + break; + + } + + return pauiHuffmanTable; +} + +inline const unsigned int (*GetHuffDecTable(const int iAlloc))[16] +{ + const unsigned int (*pauiHuffmanTable)[16] = NULL; + + switch(iAlloc){ + case 1: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec1; + break; + case 2: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec2; + break; + case 3: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec3; + break; + case 4: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec4; + break; + case 5: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec5; + break; + case 6: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec6; + break; + case 7: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec7; + break; + case 8: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec8; + break; + case 9: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec9; + break; + case 10: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec10; + break; + case 11: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec11; + break; + case 12: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec12; + break; + case 13: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec13; + break; + case 14: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec14; + break; + case 15: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec15; + break; + case 16: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec16; + break; + case 17: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec17; + break; + case 18: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec18; + break; + case 19: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec19; + break; + case 20: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec20; + break; + case 21: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec21; + break; + case 22: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec22; + break; + case 23: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec23; + break; + case 24: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec24; + break; + case 25: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec25; + break; + case 26: + pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec26; + break; + + } + + return pauiHuffmanTable; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _CQMF_HUFF_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c new file mode 100644 index 0000000000..e2f7ea62b1 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c @@ -0,0 +1,47 @@ +#include "NoiseGen.h" +#include +#include +#include +#include "wmops.h" + +NoiseGen* CreateNoiseGen() +{ + int n; + + NoiseGen *psNoiseGen = NULL; + + psNoiseGen = (NoiseGen*)malloc(sizeof(NoiseGen)); + psNoiseGen->iNoiseBufferLength = 2048; + psNoiseGen->iNoiseBufferMask = 2047; + psNoiseGen->iNoiseBufferIndex = 0; + + psNoiseGen->pfNoiseBuffer = (float*)malloc(psNoiseGen->iNoiseBufferLength * sizeof(float)); + + /* Generate Laplacian distributed noise */ + for(n = 0; n < psNoiseGen->iNoiseBufferLength; n ++){ + float fNoise = 0.0; + float fScale = 0.707f; + fNoise = (float)((rand() & (RAND_MAX - 1)) - (RAND_MAX >> 1)) / (float)RAND_MAX; + + if(fNoise < 0.0){ + fNoise = fScale * logf(1.0f + 1.9999999f * fNoise); + } + else{ + fNoise = -fScale * logf(1.0f - 1.9999999f * fNoise); + } + + psNoiseGen->pfNoiseBuffer[n] = fNoise; + } + + return psNoiseGen; +} + +void DeleteNoiseGen(NoiseGen *psNoiseGen) +{ + free(psNoiseGen->pfNoiseBuffer); + free(psNoiseGen); +} + +extern float GetNoise(NoiseGen *psNoiseGen); + + diff --git a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.h b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.h new file mode 100644 index 0000000000..1a4ccb924c --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.h @@ -0,0 +1,35 @@ +#ifndef _NOISE_GEN_H_ +#define _NOISE_GEN_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct NOISE_GEN{ + int iNoiseBufferLength; + int iNoiseBufferMask; + int iNoiseBufferIndex; + float *pfNoiseBuffer; +}NoiseGen; + +NoiseGen* CreateNoiseGen(); + +void DeleteNoiseGen(NoiseGen *psNoiseGen); + +inline float GetNoise(NoiseGen *psNoiseGen) +{ + float fNoiseSample; + + fNoiseSample = psNoiseGen->pfNoiseBuffer[psNoiseGen->iNoiseBufferIndex]; + psNoiseGen->iNoiseBufferIndex ++; + psNoiseGen->iNoiseBufferIndex &= psNoiseGen->iNoiseBufferMask; + + return fNoiseSample; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _NOISE_GEN_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c b/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c new file mode 100644 index 0000000000..2e7e8568e7 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c @@ -0,0 +1,160 @@ +#include "PerceptualModel.h" +#include "Tables.h" +#include "wmops.h" + +#define LOG_ADD_TABLE_LENGTH (512) + +const int c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { + 0x40, 0x40, 0x3F, 0x3F, 0x3E, 0x3E, 0x3D, 0x3D, 0x3C, 0x3C, 0x3B, 0x3B, 0x3A, 0x3A, 0x39, 0x39, + 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, + 0x31, 0x31, 0x31, 0x30, 0x30, 0x2F, 0x2F, 0x2F, 0x2E, 0x2E, 0x2D, 0x2D, 0x2D, 0x2C, 0x2C, 0x2B, + 0x2B, 0x2B, 0x2A, 0x2A, 0x2A, 0x29, 0x29, 0x29, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26, + 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21, + 0x20, 0x20, 0x20, 0x20, 0x1F, 0x1F, 0x1F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1D, 0x1D, 0x1D, 0x1C, 0x1C, + 0x1C, 0x1C, 0x1B, 0x1B, 0x1B, 0x1B, 0x1A, 0x1A, 0x1A, 0x1A, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15, + 0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, + 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0F, 0x0F, 0x0F, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + + +static inline int LogAdd(int iVal1,int iVal2) +{ + int iRetVal; + + if(iVal1 > iVal2){ + iRetVal = iVal1 - iVal2; + iRetVal = (iRetVal < (LOG_ADD_TABLE_LENGTH - 1)) ? iRetVal : (LOG_ADD_TABLE_LENGTH - 1); + iRetVal = iVal1 + c_aiLogAddTable[iRetVal]; + } + else{ + iRetVal = iVal2 - iVal1; + iRetVal = (iRetVal < (LOG_ADD_TABLE_LENGTH - 1)) ? iRetVal : (LOG_ADD_TABLE_LENGTH - 1); + iRetVal = iVal2 + c_aiLogAddTable[iRetVal]; + } + + return iRetVal; +} + +const int c_aiBandwidthAdjust48[MAX_BANDS_48] = { + 0,0,0,0,0,0,0,0,0,0,0,64,64,64,64,64, + 101,101,128,165,165,180,213,}; + +const int c_aiAbsoluteThresh48[MAX_BANDS_48] = { + -1787,-1787,-1787,-1787,-1787,-1787,-1787,-1787,-1782,-1761,-1737,-1679,-1638,-1613,-1590,-1568, + -1516,-1459,-1395,-1289,-671,-409,-401,}; + +const int c_aiDefaultTheta48[MAX_BANDS_48] = { + 7,7,6,5,5,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4, +}; + +const int c_aaiSpreadFunction48[MAX_BANDS_48][MAX_BANDS_48] = { + 0,-1561,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-289,-4,-1234,-2295,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-569,-229, + -8,-905,-1705,-2324,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-789,-445,-173,-16,-656,-1271,-1765,-2172,-2520,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-961,-616,-340,-136, + -28,-488,-976,-1382,-1729,-2032,-2305,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-1088,-743,-465,-257,-148,-31,-371,-769,-1114,-1417,-1689,-2054,-2483, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1198,-852,-574,-364,-209,-148, + -42,-300,-635,-936,-1207,-1572,-2000,-2376,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-1293,-948,-669,-458,-301,-183,-145,-56,-258,-547,-816,-1179,-1606,-1982,-2311, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1375,-1029,-750,-539,-381,-260,-180,-142, + -68,-231,-487,-846,-1272,-1647,-1976,-2261,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1444, + -1099,-820,-608,-449,-328,-233,-194,-138,-77,-213,-555,-978,-1352,-1681,-1966,-2268, + -2552,-2552,-2552,-2552,-2552,-2552,-1501,-1155,-876,-665,-505,-383,-287,-210,-193,-130, + -79,-298,-711,-1083,-1411,-1696,-1997,-2288,-2550,-2552,-2552,-2552,-2552,-1567,-1221,-942, + -730,-570,-448,-351,-272,-206,-189,-151,-72,-349,-713,-1039,-1324,-1625,-1915,-2177, + -2448,-2552,-2552,-2552,-1650,-1304,-1025,-813,-653,-530,-432,-352,-285,-227,-177,-163, + -69,-297,-613,-895,-1195,-1485,-1746,-2017,-2238,-2401,-2545,-1727,-1381,-1102,-890,-730, + -607,-509,-428,-360,-301,-249,-180,-153,-72,-257,-527,-824,-1112,-1373,-1643,-1865, + -2028,-2171,-1798,-1452,-1173,-960,-800,-677,-579,-498,-430,-370,-317,-246,-192,-145, + -76,-224,-505,-790,-1050,-1320,-1540,-1703,-1847,-1860,-1514,-1234,-1022,-862,-738,-640, + -559,-490,-430,-377,-306,-224,-197,-136,-81,-242,-515,-771,-1040,-1260,-1422,-1566, + -1923,-1577,-1297,-1085,-925,-801,-703,-621,-553,-492,-439,-367,-284,-213,-198,-144, + -83,-235,-479,-744,-963,-1125,-1268,-1986,-1640,-1360,-1148,-988,-864,-766,-684,-615, + -555,-501,-429,-345,-273,-211,-204,-146,-89,-216,-465,-680,-841,-984,-2043,-1697, + -1417,-1205,-1044,-921,-822,-741,-672,-611,-557,-485,-401,-328,-264,-211,-205,-140, + -93,-227,-430,-588,-729,-2104,-1758,-1479,-1266,-1106,-982,-884,-802,-733,-673,-619, + -546,-461,-388,-324,-269,-212,-211,-151,-100,-195,-336,-472,-2163,-1817,-1537,-1324, + -1164,-1040,-942,-860,-791,-731,-676,-604,-519,-445,-380,-325,-268,-226,-219,-147, + -114,-167,-280,-2203,-1857,-1577,-1365,-1205,-1081,-982,-901,-831,-771,-717,-644,-559, + -485,-420,-364,-306,-252,-239,-206,-132,-122,-163,-2224,-1878,-1598,-1386,-1225,-1102, + -1003,-921,-852,-792,-737,-665,-580,-505,-441,-385,-326,-271,-222,-224,-176,-121,-114, +}; + +#define PERCEPTUAL_MODEL_SCALE (64) + +#define PERCEPTUAL_MODEL_SCALE_SHIFT (6) + +#define PERCEPTUAL_MODEL_ALPHA_SCALE (614) + +#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE (6827) + +#define PERCEPTUAL_MODEL_ALPHA_SHIFT (11) + +#define PERCEPTUAL_MODEL_SLGAIN_SHIFT (4) + +void PerceptualModel(const int iMaxQuantBands, + const int *piRMSEnvelope, + int *piExcitation, + int *piSMR) +{ + int n; + + for(n = 0; n < iMaxQuantBands; n ++){ + int iSLOffset; + + piExcitation[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n]; + // Calculate sensation level offset + iSLOffset = c_aiDefaultTheta48[n] * (piExcitation[n] - c_aiAbsoluteThresh48[n]) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT; + //iSLOffset = (iSLOffset > 0) ? iSLOffset : 0; + // Offset envelope by sensation level offset + piExcitation[n] -= iSLOffset; + // Convert to loudness domain (x^0.3) + piExcitation[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; + } + + // Spread excitation function + for(n = 0; n < iMaxQuantBands; n ++){ + int k; + const int *piSpread; + + piSpread = c_aaiSpreadFunction48[n]; + piSMR[n] = piExcitation[n] + piSpread[n]; + for(k = 0; k < iMaxQuantBands; k ++){ + if(k != n){ + piSMR[n] = LogAdd(piSMR[n],piExcitation[k] + piSpread[k]); + } + } + } + + for(n = 0; n < iMaxQuantBands; n ++){ + piSMR[n] = PERCEPTUAL_MODEL_ALPHA_INV_SCALE * piSMR[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; + piSMR[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n] - piSMR[n]; + } +} diff --git a/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h b/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h new file mode 100644 index 0000000000..e9d62c8106 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h @@ -0,0 +1,18 @@ +#ifndef _PERCEPTUAL_MODEL_H_ +#define _PERCEPTUAL_MODEL_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +void PerceptualModel(const int iMaxQuantBands, + const int *piRMSEnvelope, + int *piExcitation, + int *piSMR); + +#ifdef __cplusplus +} +#endif + +#endif /* _PERCEPTUAL_MODEL_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c b/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c new file mode 100644 index 0000000000..9e314fcd08 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c @@ -0,0 +1,31 @@ +#include "RMSEnvDeltaHuff.h" +#include "wmops.h" + +const unsigned int c_aaiRMSEnvHuffEnc[64][2] = +{ + {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0003}, {0x0013, 0x0004}, + {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0012, 0x000b}, {0x000d, 0x0002}, {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000d, 0x0003}, + {0x000b, 0x0002}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0008, 0x0005}, + {0x0008, 0x0006}, {0x0007, 0x0004}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0005, 0x0003}, {0x0004, 0x0002}, {0x0003, 0x0002}, {0x0002, 0x0002}, + {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0008, 0x0007}, {0x0009, 0x0007}, {0x0009, 0x0008}, + {0x0009, 0x0009}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, + {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, +}; + +const unsigned int c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = +{ + {0x0002ffff, 0x0001ffff, 0x0000001d, 0x00000022, 0x0001001e, 0x0001001e, 0x00010021, 0x00010021, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000017, 0x00000018, 0x00000025, 0x00010019, 0x00010019, 0x00010024, 0x00010024, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x0009ffff, 0x0008ffff, 0x0000002c, 0x0000002d, 0x00010010, 0x00010010, 0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x000bffff, 0x000cffff, 0x000affff, 0x00000031, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, + {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, }, + {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, +}; diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h b/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h new file mode 100644 index 0000000000..e7e1059384 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h @@ -0,0 +1,25 @@ +#ifndef _RMS_ENV_DELTA_HUFF_H_ +#define _RMS_ENV_DELTA_HUFF_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef HUFF_READ_SIZE +#define HUFF_READ_SIZE (4) +#endif + +#ifndef HUFF_DEC_TABLE_SIZE +#define HUFF_DEC_TABLE_SIZE (16) +#endif + +extern const unsigned int c_aaiRMSEnvHuffEnc[64][2]; + +extern const unsigned int c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; + +#ifdef __cplusplus +} +#endif + +#endif /* _RMS_ENV_DELTA_HUFF_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c new file mode 100644 index 0000000000..f51051d52d --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c @@ -0,0 +1,378 @@ +#include "RMSEnvGrouping.h" + +/* Double check cost function calculation */ + +#include +#include +#include +#include +#include "wmops.h" +#include "Tables.h" + +typedef struct GMNODE{ + int iGroupStart; + int iGroupLength; + float *pfMergedEnergydB; + struct GMNODE *psNext; +}GMNode; + +typedef struct RMS_ENVELOPE_GROUPING +{ + int iNumBlocks; + int iMaxGroups; + float **ppfBandEnergy; + float **ppfBandEnergydB; + float **ppfWeight; + GMNode *psGMNodes; +}RMSEnvelopeGrouping; + +RMSEnvelopeGrouping* CreateRMSEnvelopeGrouping(int iNumBlocks) +{ + int n; + assert((iNumBlocks & 0x1) == 0); // remove this + + RMSEnvelopeGrouping *psRMSEnvelopeGrouping; + + psRMSEnvelopeGrouping = (RMSEnvelopeGrouping*)malloc(sizeof(RMSEnvelopeGrouping)); + psRMSEnvelopeGrouping->iNumBlocks = iNumBlocks; + psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks >> 1; // Change this + + psRMSEnvelopeGrouping->ppfBandEnergy = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); + psRMSEnvelopeGrouping->ppfBandEnergydB = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); + psRMSEnvelopeGrouping->ppfWeight = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); + for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ + psRMSEnvelopeGrouping->ppfBandEnergy[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); /* 2 for stereo joint group calc */ + psRMSEnvelopeGrouping->ppfBandEnergydB[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); + psRMSEnvelopeGrouping->ppfWeight[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); + } + + psRMSEnvelopeGrouping->psGMNodes = (GMNode*)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(GMNode)); + for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ + psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); + } + + return psRMSEnvelopeGrouping; +} + +void DeleteRMSEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping) +{ + int n; + + for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ + free(psRMSEnvelopeGrouping->ppfBandEnergy[n]); + free(psRMSEnvelopeGrouping->ppfBandEnergydB[n]); + free(psRMSEnvelopeGrouping->ppfWeight[n]); + } + free(psRMSEnvelopeGrouping->ppfBandEnergy); + free(psRMSEnvelopeGrouping->ppfBandEnergydB); + free(psRMSEnvelopeGrouping->ppfWeight); + + for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ + free(psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB); + } + free(psRMSEnvelopeGrouping->psGMNodes); + + free(psRMSEnvelopeGrouping); +} + + +void ComputeBandEnergy(const int iChannels, + const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + float **ppfBandEnergy, + float **ppfBandEnergydB, + float **ppfWeight) +{ + int n; + + for(n = 0; n < iChannels; n ++){ + int k; + int iChanOffset; + + iChanOffset = n * iNumBands; + for(k = 0; k < iNumBlocks; k ++){ + int b; + int iFBOffset; + iFBOffset = 0; + for(b = 0; b < iNumBands; b ++){ + int m; + float fEnergy = 1e-12f; + //float fWeight; + + for(m = 0; m < piBandwidths[b]; m ++){ + fEnergy += (pppfReal[n][k][iFBOffset] * pppfReal[n][k][iFBOffset] + pppfImag[n][k][iFBOffset] * pppfImag[n][k][iFBOffset]); + iFBOffset ++; + } + fEnergy /= (float)(2 * piBandwidths[b]); + ppfBandEnergy[k][iChanOffset + b] = fEnergy; + ppfBandEnergydB[k][iChanOffset + b] = 10.0f * log10f(fEnergy); + + ppfWeight[k][iChanOffset + b] = 1.0; + } + } + } +} + +/* THis is temporary cost function */ +float TryMerge(const int iNumBands, + const int iStartBlock, + const int iGroupLength, + const float fMaxAllowedDiffdB, + const float **ppfBandEnergy, + const float **ppfBandEnergydB, + float *pfMegredEnergydB) +{ + int b; + int n; + float fMeanCost; + float fMaxCost; + float fInvGroupSize = 1.0f / (float)iGroupLength; + float fInvNumBands = 1.0f / (float)iNumBands; + + for(b = 0; b < iNumBands; b ++){ + float fGroupEnergy; + + + fGroupEnergy = 0.0; + for(n = iStartBlock; n < (iStartBlock + iGroupLength); n ++){ + fGroupEnergy += ppfBandEnergy[n][b]; + } + fGroupEnergy *= fInvGroupSize; + fGroupEnergy = 10.0f * log10f(fGroupEnergy); //Note epsolon was added when computing BandEnergy; + + pfMegredEnergydB[b] = fGroupEnergy; + } + + fMeanCost = 0.0; + fMaxCost = 0.0; + for(n = iStartBlock; n < (iStartBlock + iGroupLength); n ++){ + float fMeanAbsDiff; + float fMaxAbsDiff; + + fMeanAbsDiff = 0.0; + fMaxAbsDiff = 0.0; + for(b = 0; b < iNumBands; b ++){ + float fAbsDiff; + + fAbsDiff = fabsf(ppfBandEnergydB[n][b] - pfMegredEnergydB[b]); + fMeanAbsDiff += fAbsDiff; + fMaxAbsDiff = (fMaxAbsDiff > fAbsDiff) ? fMaxAbsDiff : fAbsDiff; + } + fMeanAbsDiff *= fInvNumBands; + + fMeanCost = (fMeanCost > fMeanAbsDiff) ? fMeanCost : fMeanAbsDiff; + fMaxCost = (fMaxCost > fMaxAbsDiff) ? fMaxCost : fMaxAbsDiff; + } + + //printf("%f\t%f\n",fMeanCost,fMaxCost); + + if(fMaxCost > fMaxAllowedDiffdB){ + fMeanCost = 1e12f; //Some large value + } + + return fMeanCost; +} + +void ComputeGreedyGroups(RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int iChannels, + const int iNumBands, + const float fMeanAllowedDiffdB, + const float fMaxAllowedDiffdB) +{ + float fBestMeanCost; + + fBestMeanCost = 0.0; + while(fBestMeanCost < fMeanAllowedDiffdB){ + GMNode *psGMNode; + GMNode *psBestGMNode; + + fBestMeanCost = fMeanAllowedDiffdB; + psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; + psBestGMNode = NULL; + while(psGMNode->psNext != NULL){ + float fMeanCost; + int iGroupLength; + + iGroupLength = psGMNode->iGroupLength + psGMNode->psNext->iGroupLength; + + fMeanCost = TryMerge(iNumBands * iChannels, + psGMNode->iGroupStart, + psGMNode->iGroupLength, + fMaxAllowedDiffdB, + (const float**)psRMSEnvelopeGrouping->ppfBandEnergy, + (const float**)psRMSEnvelopeGrouping->ppfBandEnergydB, + psGMNode->pfMergedEnergydB); + + + if(fMeanCost < fBestMeanCost){ + fBestMeanCost = fMeanCost; + psBestGMNode = psGMNode; + } + + psGMNode = psGMNode->psNext; + } + + if(fBestMeanCost < fMeanAllowedDiffdB && psBestGMNode != NULL && psBestGMNode->psNext != NULL){ + psBestGMNode->iGroupLength += psBestGMNode->psNext->iGroupLength; + psBestGMNode->psNext = psBestGMNode->psNext->psNext; + } + } +} + + +void ComputeRMSEnvelope(const int iChannels, + const int iNumBands, + const int iNumGroups, + const int *piGroupLengths, + const float **ppfBandEnergy, + int ***pppiRMSEnvelope) +{ + int n; + + for(n = 0; n < iChannels; n ++){ + int b; + int iChanOffset; + + iChanOffset = n * iNumBands; + for(b = 0; b < iNumBands; b ++){ + int k; + int iBlockOffset; + + iBlockOffset = 0; + for(k = 0; k < iNumGroups; k ++){ + int m; + float fGroupEnergy; + fGroupEnergy = 0.0; + for(m = 0; m < piGroupLengths[k]; m ++){ + fGroupEnergy += ppfBandEnergy[iBlockOffset][b + iChanOffset]; + iBlockOffset ++; + } + fGroupEnergy /= (float)piGroupLengths[k]; + + pppiRMSEnvelope[n][k][b] = (int)(log2f(fGroupEnergy) + 0.5); + pppiRMSEnvelope[n][k][b] = (pppiRMSEnvelope[n][k][b] > ENV_MIN) ? pppiRMSEnvelope[n][k][b] : ENV_MIN; + pppiRMSEnvelope[n][k][b] = (pppiRMSEnvelope[n][k][b] < ENV_MAX) ? pppiRMSEnvelope[n][k][b] : ENV_MAX; + } + } + } +} + +void LimitRMSEnvelope(const int iBandCount, + const int iRMSDeltaMax, + const int iRMSDeltaMin, + int *piRMSEnvelope) +{ + int iBand; + int iLastSCF; + + /* Increase low envelope values to ensure that the scale factors traces the large values correctly (checking for max deltas) */ + iLastSCF = piRMSEnvelope[iBandCount - 1]; + for(iBand = iBandCount - 2; iBand > -1; iBand --) + { + int iDelta; + + iDelta = iLastSCF - piRMSEnvelope[iBand]; + + if(iDelta > iRMSDeltaMax){ +#ifdef DEBUG_VERBOSE + printf("WARNING ScaleFactor Delta limited\n"); +#endif + piRMSEnvelope[iBand] += (iDelta - iRMSDeltaMax); + } + + iLastSCF = piRMSEnvelope[iBand]; + } + + /* Increase low envelope values to ensure that the envelope traces the large values correctly (checking for min deltas)*/ + iLastSCF = piRMSEnvelope[0]; + for(iBand = 1; iBand < iBandCount; iBand ++){ + int iDelta; + + iDelta = piRMSEnvelope[iBand] - iLastSCF; + + if(iDelta < iRMSDeltaMin){ +#ifdef DEBUG_VERBOSE + printf("WARNING ScaleFactor Delta limited\n"); +#endif + piRMSEnvelope[iBand] += (iRMSDeltaMin - iDelta); + } + + iLastSCF = piRMSEnvelope[iBand]; + } +} + +void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int iChannels, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const float fMeanAllowedDiffdB, + const float fMaxAllowedDiffdB, + int *piNumGroups, + int *piGroupLengths, + int ***pppiRMSEnvelope) +{ + int n; + GMNode *psGMNode; + + /* Compute Band Energies */ + ComputeBandEnergy(iChannels, + psRMSEnvelopeGrouping->iNumBlocks, + iNumBands, + piBandwidths, + pppfReal, + pppfImag, + psRMSEnvelopeGrouping->ppfBandEnergy, + psRMSEnvelopeGrouping->ppfBandEnergydB, + psRMSEnvelopeGrouping->ppfWeight); + + /* Init GMNodes */ + psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0; + psRMSEnvelopeGrouping->psGMNodes[0].iGroupLength = 2; + psRMSEnvelopeGrouping->psGMNodes[0].psNext = NULL; + for(n = 1; n < psRMSEnvelopeGrouping->iMaxGroups; n ++){ + psRMSEnvelopeGrouping->psGMNodes[n - 1].psNext = &psRMSEnvelopeGrouping->psGMNodes[n]; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupStart = n * 2; // change this + psRMSEnvelopeGrouping->psGMNodes[n].iGroupLength = 2; // change this + psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; + } + + /* Perform grouping via Greedy Merge */ + ComputeGreedyGroups(psRMSEnvelopeGrouping, + iChannels, + iNumBands, + fMeanAllowedDiffdB, + fMaxAllowedDiffdB); + + /* Calc Groups from Merge Results */ + *piNumGroups = 0; + psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; + while(psGMNode != NULL){ + piGroupLengths[*piNumGroups] = psGMNode->iGroupLength; + *piNumGroups += 1; + psGMNode = psGMNode->psNext; + } + + /* Compute RMS Envelope given group lengths */ + ComputeRMSEnvelope(iChannels, + iNumBands, + *piNumGroups, + piGroupLengths, + (const float**)psRMSEnvelopeGrouping->ppfBandEnergy, + pppiRMSEnvelope); + + /* Envelope Tenting */ + for(n = 0; n < iChannels; n ++){ + int k; + for(k = 0; k < *piNumGroups; k ++){ + LimitRMSEnvelope(iNumBands, + ENV_DELTA_MAX, + ENV_DELTA_MIN, + pppiRMSEnvelope[n][k]); + } + } +} diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h new file mode 100644 index 0000000000..fa7506935f --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h @@ -0,0 +1,31 @@ +#ifndef _RMS_ENV_GROUPING_H_ +#define _RMS_ENV_GROUPING_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping; + +RMSEnvelopeGrouping* CreateRMSEnvelopeGrouping(int iNumBlocks); + +void DeleteRMSEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping); + +void ComputeEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int iChannels, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const float fMeanAllowedDiffdB, + const float fMaxAllowedDiffdB, + int *piNumGroups, + int *piGroupLengths, + int ***pppiRMSEnvelope); + +#ifdef __cplusplus +} +#endif + +#endif /* _RMS_ENV_GROUPING_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/Tables.c b/lib_rend/ivas_cldfb_trans_codec/Tables.c new file mode 100644 index 0000000000..735c8d21f2 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/Tables.c @@ -0,0 +1,116 @@ +#include "Tables.h" +#include "wmops.h" + +/* Move this to perceptual model ? */ +const int c_aiBandwidths48[MAX_BANDS_48] = { + 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,4,6,6,7,10, +}; + + +const float c_afScaleFactor[ALLOC_TABLE_SIZE] = { + 0.0f, + 0.353553390593f, + 0.420448207627f, + 0.500000000000f, + 0.594603557501f, + 0.707106781187f, + 0.840896415254f, + 1.000000000000f, + 1.189207115003f, + 1.414213562373f, + 1.681792830507f, + 2.000000000000f, + 2.378414230005f, + 2.828427124746f, + 3.363585661015f, + 4.0f, + 4.756828460011f, + 5.656854249492f, + 6.727171322030f, + 8.0f, + 9.513656920022f, + 11.31370849898f, + 13.45434264406f, + 16.00000000000f, + 19.02731384004f, + 22.62741699797f, + 26.90868528812f, //~40dB SNR +}; + +const float c_afInvScaleFactor[ALLOC_TABLE_SIZE] = { + 0.0f, + 2.367513562373095f, + 2.046407115002721f, + 1.775900000000000f, + 1.536446415253715f, + 1.323056781186548f, + 1.132903557501360f, + 0.965800000000000f, + 0.821348207626857f, + 0.695103390593274f, + 0.587801778750680f, + 0.495800000000000f, + 0.418124103813429f, + 0.352176695296637f, + 0.296200889375340f, + 0.249400000000000f, + 0.209812051906714f, + 0.176538347648318f, + 0.148525444687670f, + 0.124900000000000f, + 0.105056025953357f, + 0.088388347648318f, + 0.074325444687670f, + 0.062500000000000f, + 0.052556025953357f, + 0.044194173824159f, + 0.037162722343835f, +}; + +const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE] = { + 2.32830644e-10f, 3.29272254e-10f, 4.65661287e-10f, 6.58544508e-10f, 9.31322575e-10f, 1.31708902e-09f, 1.86264515e-09f, 2.63417803e-09f, + 3.72529030e-09f, 5.26835606e-09f, 7.45058060e-09f, 1.05367121e-08f, 1.49011612e-08f, 2.10734243e-08f, 2.98023224e-08f, 4.21468485e-08f, + 5.96046448e-08f, 8.42936970e-08f, 1.19209290e-07f, 1.68587394e-07f, 2.38418579e-07f, 3.37174788e-07f, 4.76837158e-07f, 6.74349576e-07f, + 9.53674316e-07f, 1.34869915e-06f, 1.90734863e-06f, 2.69739830e-06f, 3.81469727e-06f, 5.39479661e-06f, 7.62939453e-06f, 1.07895932e-05f, + 1.52587891e-05f, 2.15791864e-05f, 3.05175781e-05f, 4.31583729e-05f, 6.10351562e-05f, 8.63167458e-05f, 1.22070312e-04f, 1.72633492e-04f, + 2.44140625e-04f, 3.45266983e-04f, 4.88281250e-04f, 6.90533966e-04f, 9.76562500e-04f, 1.38106793e-03f, 1.95312500e-03f, 2.76213586e-03f, + 3.90625000e-03f, 5.52427173e-03f, 7.81250000e-03f, 1.10485435e-02f, 1.56250000e-02f, 2.20970869e-02f, 3.12500000e-02f, 4.41941738e-02f, + 6.25000000e-02f, 8.83883476e-02f, 1.25000000e-01f, 1.76776695e-01f, 2.50000000e-01f, 3.53553391e-01f, 5.00000000e-01f, 7.07106781e-01f, + 1.00000000e+00f, 1.41421356e+00f, 2.00000000e+00f, 2.82842712e+00f, 4.00000000e+00f, 5.65685425e+00f, 8.00000000e+00f, 1.13137085e+01f, + 1.60000000e+01f, 2.26274170e+01f, 3.20000000e+01f, 4.52548340e+01f, 6.40000000e+01f, 9.05096680e+01f, 1.28000000e+02f, 1.81019336e+02f, + 2.56000000e+02f, 3.62038672e+02f, 5.12000000e+02f, 7.24077344e+02f, 1.02400000e+03f, 1.44815469e+03f, 2.04800000e+03f, 2.89630938e+03f, + 4.09600000e+03f, 5.79261875e+03f, 8.19200000e+03f, 1.15852375e+04f, 1.63840000e+04f, 2.31704750e+04f, 3.27680000e+04f, 4.63409500e+04f, + 6.55360000e+04f, 9.26819000e+04f, 1.31072000e+05f, 1.85363800e+05f, 2.62144000e+05f, 3.70727600e+05f, 5.24288000e+05f, 7.41455200e+05f, + 1.04857600e+06f, 1.48291040e+06f, 2.09715200e+06f, 2.96582080e+06f, 4.19430400e+06f, 5.93164160e+06f, 8.38860800e+06f, 1.18632832e+07f, + 1.67772160e+07f, 2.37265664e+07f, 3.35544320e+07f, 4.74531328e+07f, 6.71088640e+07f, 9.49062656e+07f, 1.34217728e+08f, 1.89812531e+08f, + 2.68435456e+08f, 3.79625062e+08f, 5.36870912e+08f, 7.59250125e+08f, 1.07374182e+09f, 1.51850025e+09f, 2.14748365e+09f, 3.03700050e+09f, + 4.29496730e+09f, +}; + +const int c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { + 0, 3, 4, 5, 6, 7, 8, 8, + 10, 13, 13, 15, 19, 24, 24, 27, + 31, 40, 39, 46, 57, 69, 80, 92, + 120, 135, 163, +}; + +const int c_aiHuffmanDim[ALLOC_TABLE_SIZE] = { + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, +}; + +const int c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { + 0, 4, 5, 6, 7, 8, 9, 9, + 11, 14, 14, 16, 20, 25, 25, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, +}; + +const int c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { + 1, 16, 25, 36, 49, 64, 81, 81, + 121, 196, 196, 256, 400, 625, 625, 28, + 32, 41, 40, 47, 58, 70, 81, 93, + 121, 136, 164, +}; diff --git a/lib_rend/ivas_cldfb_trans_codec/Tables.h b/lib_rend/ivas_cldfb_trans_codec/Tables.h new file mode 100644 index 0000000000..960ee0d231 --- /dev/null +++ b/lib_rend/ivas_cldfb_trans_codec/Tables.h @@ -0,0 +1,65 @@ +#ifndef _TABLES_H_ +#define _TABLES_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define DEBUG_VERBOSE + +#define CQMF_BLOCKS_PER_FRAME (16) +#define CQMF_MAX_BLOCKS_PER_FRAME (16) +#define CQMF_BANDS (60) + +#define MAX_BANDS (23) +#define MAX_BANDS_48 (23) + +extern const int c_aiBandwidths48[MAX_BANDS_48]; // move this + + +#define ENV_MIN (-64) +#define ENV_MAX (64) + +#define ENV0_BITS (7) + +#define ENV_DELTA_MIN (-32) +#define ENV_DELTA_MAX (31) + +#define ENV_RECONSTRUCT_TABLE_SIZE (129) + +#define ENV_RECONSTRUCT_TABLE_CENTER (64) + +#define MIN_ALLOC (0) +#define MAX_ALLOC (26) + +#define ALLOC_OFFSET_SCALE (8) + +#define ALLOC_OFFSET_BITS (8) + +#define MIN_ALLOC_OFFSET (-128) +#define MAX_ALLOC_OFFSET (127) + + + +#define ALLOC_TABLE_SIZE (27) + +extern const float c_afScaleFactor[ALLOC_TABLE_SIZE]; + +extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE]; + +extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE]; + +extern const int c_aiQuantMaxValues[ALLOC_TABLE_SIZE]; + +extern const int c_aiHuffmanDim[ALLOC_TABLE_SIZE]; + +extern const int c_aiHuffmanMod[ALLOC_TABLE_SIZE]; + +extern const int c_aiHuffmanSize[ALLOC_TABLE_SIZE]; + +#ifdef __cplusplus +} +#endif + +#endif /* _TABLES_H_ */ diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index 249acceea7..f89564fffc 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -50,7 +50,9 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_splitBinLCLDDecOpen( - BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ) + BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, + int32_t iSampleRate, + int32_t iChannels ) { ivas_error error; BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec; @@ -62,6 +64,30 @@ ivas_error ivas_splitBinLCLDDecOpen( splitBinLCLDDec->pLcld_dec = NULL; // place holder for CLDFB decoder handle + splitBinLCLDDec->iChannels = iChannels; + splitBinLCLDDec->psCQMFDecoder = CreateCQMFDecoder( iSampleRate, iChannels ); + + splitBinLCLDDec->pppfDecCQMFReal = (float ***) malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDDec->pppfDecCQMFImag = (float ***) malloc( iChannels * sizeof( float ** ) ); + for ( int32_t n = 0; n < splitBinLCLDDec->iChannels; n++ ) + { + splitBinLCLDDec->pppfDecCQMFReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDDec->pppfDecCQMFImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + } + +#ifdef CLDFB_DEBUG + splitBinLCLDDec->numFrame = 0; + char cldfbFilename[50] = "cldfb_out.bin"; + if ( ( splitBinLCLDDec->cldfbOut = fopen( cldfbFilename, "wb" ) ) == NULL ) + { + fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); + exit( -1 ); + } + int num_bands = CLDFB_NO_CHANNELS_MAX; + fwrite( &iChannels, sizeof( int ), 1, splitBinLCLDDec->cldfbOut ); + fwrite( &num_bands, sizeof( int ), 1, splitBinLCLDDec->cldfbOut ); +#endif + *hSplitBinLCLDDec = splitBinLCLDDec; return error; } @@ -71,6 +97,26 @@ void ivas_splitBinLCLDDecClose( { if ( ( *hSplitBinLCLDDec ) != NULL ) { + if ( ( *hSplitBinLCLDDec )->psCQMFDecoder != NULL ) + { + DeleteCQMFDecoder( ( *hSplitBinLCLDDec )->psCQMFDecoder ); + } + + for ( int32_t n = 0; n < ( *hSplitBinLCLDDec )->iChannels; n++ ) + { + free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal[n] ); + free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag[n] ); + } + free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal ); + free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag ); + +#ifdef CLDFB_DEBUG + if ( ( *hSplitBinLCLDDec )->cldfbOut != NULL ) + { + fclose( ( *hSplitBinLCLDDec )->cldfbOut ); + } +#endif + count_free( *hSplitBinLCLDDec ); *hSplitBinLCLDDec = NULL; } @@ -87,6 +133,67 @@ void ivas_splitBinLCLDDecProcess( assert( Cldfb_Out_Real != NULL ); assert( Cldfb_Out_Imag != NULL ); assert( pBits != NULL ); + + int32_t iBytesWritten; + unsigned char auchData[4096]; + unsigned char *bval; + + iBytesWritten = ivas_split_rend_bitstream_read_int32( pBits, 8 * sizeof( uint16_t ) ); +#ifdef CLDFB_DEBUG + printf( "Bytes read = %d\n", iBytesWritten ); +#endif + bval = auchData; + for ( int32_t bytesCount = 0; bytesCount < iBytesWritten; bytesCount++ ) + { + *bval = (uint8_t) ivas_split_rend_bitstream_read_int32( pBits, 8 ); + bval++; + } + + // A conversion is needed for the 3d pointer interface here ........ :( + for ( int32_t n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) + { + for ( int32_t k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + hSplitBinLCLDDec->pppfDecCQMFReal[n][k] = Cldfb_Out_Real[n][k]; + hSplitBinLCLDDec->pppfDecCQMFImag[n][k] = Cldfb_Out_Imag[n][k]; + } + } + + // Initialized with zeros....... :( + for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + { + for ( int n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) + { + hSplitBinLCLDDec->pppfDecCQMFReal[n][k][b] = 0.0; + hSplitBinLCLDDec->pppfDecCQMFImag[n][k][b] = 0.0; + } + } + } + + DecodeFrame( hSplitBinLCLDDec->psCQMFDecoder, iBytesWritten, auchData, hSplitBinLCLDDec->pppfDecCQMFReal, hSplitBinLCLDDec->pppfDecCQMFImag ); + +#ifdef CLDFB_DEBUG + printf( "Frame Decoded = %d\n", ++hSplitBinLCLDDec->numFrame ); + int writeByte = 0; + for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + { + for ( int n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) + { + writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFReal[n][k][b], sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut ); + if ( writeByte != 1 ) + exit( -1 ); + writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFImag[n][k][b], sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut ); + if ( writeByte != 1 ) + exit( -1 ); + } + } + } +#endif + return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index 355712e327..97da222528 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -50,7 +50,10 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_splitBinLCLDEncOpen( - BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ) + BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, + int32_t iSampleRate, + int32_t iChannels, + int32_t iDataRate ) { ivas_error error; BIN_HR_SPLIT_LCLD_ENC_HANDLE splitBinLCLDEnc; @@ -62,6 +65,30 @@ ivas_error ivas_splitBinLCLDEncOpen( splitBinLCLDEnc->pLcld_enc = NULL; // place holder for CLDFB encoder handle + splitBinLCLDEnc->iChannels = iChannels; + splitBinLCLDEnc->psCQMFEncoder = CreateCQMFEncoder( iSampleRate, iChannels, iDataRate ); + + splitBinLCLDEnc->pppfCQMFReal = (float ***) malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDEnc->pppfCQMFImag = (float ***) malloc( iChannels * sizeof( float ** ) ); + for ( int32_t n = 0; n < splitBinLCLDEnc->iChannels; n++ ) + { + splitBinLCLDEnc->pppfCQMFReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDEnc->pppfCQMFImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + } + +#ifdef CLDFB_DEBUG + splitBinLCLDEnc->numFrame = 0; + char cldfbFilename[50] = "cldfb_in_ref.qmf"; + if ( ( splitBinLCLDEnc->cldfbIn = fopen( cldfbFilename, "rb" ) ) == NULL ) + { + fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); + exit( -1 ); + } + int chan, band; + fread( &chan, sizeof( int ), 1, splitBinLCLDEnc->cldfbIn ); + fread( &band, sizeof( int ), 1, splitBinLCLDEnc->cldfbIn ); +#endif + *hSplitBinLCLDEnc = splitBinLCLDEnc; return error; } @@ -71,6 +98,23 @@ void ivas_splitBinLCLDEncClose( { if ( ( *hSplitBinLCLDEnc ) != NULL ) { + DeleteCQMFEncoder( ( *hSplitBinLCLDEnc )->psCQMFEncoder ); + + for ( int32_t n = 0; n < ( *hSplitBinLCLDEnc )->iChannels; n++ ) + { + free( ( *hSplitBinLCLDEnc )->pppfCQMFReal[n] ); + free( ( *hSplitBinLCLDEnc )->pppfCQMFImag[n] ); + } + free( ( *hSplitBinLCLDEnc )->pppfCQMFReal ); + free( ( *hSplitBinLCLDEnc )->pppfCQMFImag ); + +#ifdef CLDFB_DEBUG + if ( ( *hSplitBinLCLDEnc )->cldfbIn != NULL ) + { + fclose( ( *hSplitBinLCLDEnc )->cldfbIn ); + } +#endif + count_free( *hSplitBinLCLDEnc ); *hSplitBinLCLDEnc = NULL; } @@ -87,6 +131,85 @@ void ivas_splitBinLCLDEncProcess( assert( Cldfb_In_Real != NULL ); assert( Cldfb_In_Imag != NULL ); assert( pBits != NULL ); + + int32_t iBytesWritten; + uint16_t ushBytes; + unsigned char auchData[4096]; + unsigned char *bval; + int32_t code; + + iBytesWritten = 4096; + + // A conversion is needed for the 3d pointer interface here ........ :( + for ( int32_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) + { + for ( int32_t k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + hSplitBinLCLDEnc->pppfCQMFReal[n][k] = Cldfb_In_Real[n][k]; + hSplitBinLCLDEnc->pppfCQMFImag[n][k] = Cldfb_In_Imag[n][k]; + } + } + +#ifdef CLDFB_DEBUG + int readByte = 0; + for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + { + for ( int n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) + { +#if 0 + readByte = fread(&hSplitBinLCLDEnc->pppfCQMFReal[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn); + if ( readByte != 1 ) + break; + readByte = fread(&hSplitBinLCLDEnc->pppfCQMFImag[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn); +#else + readByte = fread( &Cldfb_In_Real[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); + if ( readByte != 1 ) + break; + readByte = fread( &Cldfb_In_Imag[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); +#endif + } + } + } + + if ( readByte == 1 ) + { + printf( "Frame Read = %d\n", ++hSplitBinLCLDEnc->numFrame ); + } + else + { + printf( "Writing zeroes...\n" ); + for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + { + for ( int n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) + { + hSplitBinLCLDEnc->pppfCQMFReal[n][k][b] = 0.f; + hSplitBinLCLDEnc->pppfCQMFImag[n][k][b] = 0.f; + } + } + } + } +#endif + + EncodeFrame( hSplitBinLCLDEnc->psCQMFEncoder, hSplitBinLCLDEnc->pppfCQMFReal, hSplitBinLCLDEnc->pppfCQMFImag, &iBytesWritten, auchData ); + + bval = auchData; + ushBytes = (uint16_t) iBytesWritten; + ivas_split_rend_bitstream_write_int32( pBits, (int32_t) ushBytes, 8 * sizeof( uint16_t ) ); + for ( int32_t bytesCount = 0; bytesCount < iBytesWritten; bytesCount++ ) + { + code = (int32_t) *bval; + ivas_split_rend_bitstream_write_int32( pBits, code, 8 ); + bval++; + } + +#ifdef CLDFB_DEBUG + printf( "Bytes written = %d\n", iBytesWritten ); +#endif + return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 8c37efcef3..f5f34302f9 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1169,7 +1169,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, cons { return error; } - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc ); + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, 2, 384000 ); break; case SPLIT_REND_POST: error = ivas_splitBinPostRendOpen( &hSplitRendWrapper->hBinHrSplitPostRend, OutSampleRate ); @@ -1177,7 +1177,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, cons { return error; } - error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec ); + error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec, OutSampleRate, 2 ); if ( error != IVAS_ERR_OK ) { return error; @@ -1194,7 +1194,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, cons { return error; } - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc ); + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, 2, 384000 ); if ( error != IVAS_ERR_OK ) { return error; @@ -1204,7 +1204,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, cons { return error; } - error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec ); + error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec, OutSampleRate, 2 ); break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -1296,12 +1296,6 @@ ivas_error ivas_renderMultiBinToSplitBinaural( /*CLFDB decoding and SPLIT post rendering MD based adjustments*/ { - ivas_splitBinLCLDDecProcess( - hSplitBin->hSplitBinLCLDDec, - pBits, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0] ); - ivas_splitBinPostRendMdDec( pBits, hSplitBin->hBinHrSplitPostRend, @@ -1310,6 +1304,12 @@ ivas_error ivas_renderMultiBinToSplitBinaural( #endif MAX_SPLIT_REND_MD_BANDS ); + ivas_splitBinLCLDDecProcess( + hSplitBin->hSplitBinLCLDDec, + pBits, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0] ); + ivas_rend_CldfbSplitPostRendProcess( hSplitBin->hBinHrSplitPostRend, QuaternionsPre, diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f604c309e9..098ecf562b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1003,6 +1003,7 @@ static CREND_WRAPPER defaultCrendWrapper( return w; } + static ivas_error setRendInputActiveIsm( void *input, const IVAS_REND_AudioConfig inConfig, @@ -1829,7 +1830,8 @@ static ivas_error initSbaPanGainsForSbaOut( return error; } -static ivas_error updateSbaPanGains( +static ivas_error +updateSbaPanGains( input_sba *inputSba, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg ) @@ -3155,7 +3157,11 @@ ivas_error IVAS_REND_GetDelay( latency_ns += IVAS_FB_DEC_DELAY_NS; *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } - else + else if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) + { + latency_ns = 0; + *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + } #endif { latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; -- GitLab From bf339f0d98f5bda084b23be4bb5155882625ee98 Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 16 Jan 2023 09:36:44 +0200 Subject: [PATCH 006/591] update project files --- Workspace_msvc/lib_enc.vcxproj | 1 + Workspace_msvc/lib_enc.vcxproj.filters | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index a2d1e13ae7..21973c8968 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -213,6 +213,7 @@ + diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters index 8fe608e0a6..a0fb055f48 100644 --- a/Workspace_msvc/lib_enc.vcxproj.filters +++ b/Workspace_msvc/lib_enc.vcxproj.filters @@ -584,6 +584,9 @@ enc_ivas_c + + enc_ivas_c + -- GitLab From 7e1872b6c3b4c0c15182120ad1b9260a98a25b24 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Wed, 18 Jan 2023 11:08:25 +1100 Subject: [PATCH 007/591] Rename ivas_cldfb_trans_codec/Bitstream.* to ivas_cldfb_trans_codec/cldfb_codec_bitstream.* to avoid name clash --- .../{Bitstream.c => cldfb_codec_bitstream.c} | 0 .../{Bitstream.h => cldfb_codec_bitstream.h} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename lib_rend/ivas_cldfb_trans_codec/{Bitstream.c => cldfb_codec_bitstream.c} (100%) rename lib_rend/ivas_cldfb_trans_codec/{Bitstream.h => cldfb_codec_bitstream.h} (100%) diff --git a/lib_rend/ivas_cldfb_trans_codec/Bitstream.c b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c similarity index 100% rename from lib_rend/ivas_cldfb_trans_codec/Bitstream.c rename to lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c diff --git a/lib_rend/ivas_cldfb_trans_codec/Bitstream.h b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.h similarity index 100% rename from lib_rend/ivas_cldfb_trans_codec/Bitstream.h rename to lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.h -- GitLab From 84c7598ae14642ed85f08f17f8aecc6e92e541a2 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Wed, 18 Jan 2023 11:18:37 +1100 Subject: [PATCH 008/591] Fix makefile such that code will compile on Mac (and therefore Linux?) --- Makefile | 2 +- lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c | 2 +- lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c | 2 +- lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 141a607b07..d5b9a8781a 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SRC_LIBCOM = lib_com SRC_LIBDEBUG = lib_debug SRC_LIBDEC = lib_dec SRC_LIBENC = lib_enc -SRC_LIBREND = lib_rend +SRC_LIBREND = lib_rend lib_rend/ivas_cldfb_trans_codec SRC_LIBUTIL = lib_util SRC_APP = apps BUILD = build diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c index 40d627e612..370aa0dbd1 100644 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c @@ -10,7 +10,7 @@ #include "RMSEnvDeltaHuff.h" #include "CQMFHuff.h" #include "NoiseGen.h" -#include "Bitstream.h" +#include "cldfb_codec_bitstream.h" typedef struct CQMF_DECODER{ int iSampleRate; diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c index a7db7969e9..6795f9327c 100644 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c @@ -10,7 +10,7 @@ #include "PerceptualModel.h" #include "RMSEnvDeltaHuff.h" #include "CQMFHuff.h" -#include "Bitstream.h" +#include "cldfb_codec_bitstream.h" typedef struct CQMF_ENCODER{ int iSampleRate; diff --git a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c index e542fcb15e..4317e0ec12 100644 --- a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c +++ b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c @@ -1,4 +1,4 @@ -#include "Bitstream.h" +#include "cldfb_codec_bitstream.h" #include #include -- GitLab From 649f4a5d250a0b7b30fc72992becfa00b4f3efc6 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 18 Jan 2023 15:04:44 +1100 Subject: [PATCH 009/591] fixing the msvs project file with new file name --- Workspace_msvc/lib_rend.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 0cef2758b9..979e35246c 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -197,7 +197,7 @@ - + -- GitLab From 295920de2e2c65c546f2f763648f6e56c897db46 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 20 Jan 2023 11:52:44 +1100 Subject: [PATCH 010/591] debugging switch for CLDFB codec --- lib_com/options.h | 1 + lib_rend/ivas_splitRendererPre.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 1f12475cfb..486d61584e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,7 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes #define SPLIT_REND_BASE2_CODING //#define SPLIT_REND_SKIP_POST_REND +//#define SPLIT_REND_SKIP_CLDFB_CODEC #endif /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index f5f34302f9..0ad960cc4a 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1286,11 +1286,13 @@ ivas_error ivas_renderMultiBinToSplitBinaural( max_bands, pBits ); +#ifndef SPLIT_REND_SKIP_CLDFB_CODEC ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0], pBits ); +#endif /*CLFDB decoding and SPLIT post rendering MD based adjustments*/ @@ -1304,11 +1306,13 @@ ivas_error ivas_renderMultiBinToSplitBinaural( #endif MAX_SPLIT_REND_MD_BANDS ); +#ifndef SPLIT_REND_SKIP_CLDFB_CODEC ivas_splitBinLCLDDecProcess( hSplitBin->hSplitBinLCLDDec, pBits, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0] ); +#endif ivas_rend_CldfbSplitPostRendProcess( hSplitBin->hBinHrSplitPostRend, -- GitLab From 55d707f438693d635e549342c7ca2e3953ec61ea Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Sun, 22 Jan 2023 16:57:15 +0200 Subject: [PATCH 011/591] Updates to contribution 26. --- apps/decoder.c | 14 +- lib_com/ivas_cnst.h | 1 + lib_com/ivas_ism_config.c | 28 ++- lib_com/ivas_prot.h | 11 +- lib_com/ivas_rom_com.c | 10 +- lib_dec/ivas_cpe_dec.c | 14 +- lib_dec/ivas_dec.c | 4 + lib_dec/ivas_init_dec.c | 4 +- lib_dec/ivas_masa_dec.c | 58 +++-- lib_dec/ivas_qmetadata_dec.c | 123 +++++++---- lib_enc/ivas_cpe_enc.c | 14 +- lib_enc/ivas_enc.c | 10 +- lib_enc/ivas_masa_enc.c | 387 ++++++++++++++++++++------------- lib_enc/ivas_qmetadata_enc.c | 403 ++++++++++++++++++++++++++--------- 14 files changed, 756 insertions(+), 325 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 79cfb67d4f..7f50bcda88 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -708,7 +708,7 @@ static bool parseCmdlIVAS_dec( int16_t i; char argv_to_upper[FILENAME_MAX]; #ifdef MASAISM_EDIT_OBJECTS - int32_t tmp; + int32_t tmp1; #endif #ifdef DEBUGGING float ftmp; @@ -998,21 +998,21 @@ static bool parseCmdlIVAS_dec( return false; } - if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + if ( sscanf( argv[i], "%d", &tmp1 ) > 0 ) { - arg->index_of_edited_ism = tmp; + arg->index_of_edited_ism = (int16_t) tmp1; i++; } - if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + if ( sscanf( argv[i], "%d", &tmp1 ) > 0 ) { - arg->azimuth_edited_ism = tmp; + arg->azimuth_edited_ism = (int16_t) tmp1; i++; } - if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + if ( sscanf( argv[i], "%d", &tmp1 ) > 0 ) { - arg->elevation_edited_ism = tmp; + arg->elevation_edited_ism = (int16_t) tmp1; i++; } } diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0e1aa45572..339d665031 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1105,6 +1105,7 @@ enum #define NO_BITS_MASA_ISM_NO_OBJ 2 #define MASA2TOTAL_THR 0.98f #define BITS_MASA2TOTTAL_DCT0 6 +#define STEP_M2T 0.1f #endif #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 4869de36ce..2f4279a73c 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -532,11 +532,11 @@ ISM_MODE ivas_omasa_ism_mode_select( switch ( no_obj ) { case 1: - if ( ivas_total_brate >= IVAS_64k ) + if ( ivas_total_brate >= IVAS_24k4 ) { ism_mode = ISM_MASA_MODE_DISC; } - else if ( ivas_total_brate >= IVAS_48k ) + else if ( ivas_total_brate >= IVAS_24k4 ) { ism_mode = ISM_MASA_MODE_PARAM; } @@ -546,7 +546,25 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 2: - if ( ivas_total_brate >= IVAS_80k ) + if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_32k ) + { + ism_mode = ISM_MASA_MODE_ONE_OBJ; + } + /* else if ( ivas_total_brate >= IVAS_32k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } */ + else + { + ism_mode = ISM_MODE_NONE; + } + break; + case 3: + if ( ivas_total_brate >= IVAS_128k ) { ism_mode = ISM_MASA_MODE_DISC; } @@ -563,14 +581,12 @@ ISM_MODE ivas_omasa_ism_mode_select( ism_mode = ISM_MODE_NONE; } break; - case 3: - case 4: if ( ivas_total_brate >= IVAS_160k ) { ism_mode = ISM_MASA_MODE_DISC; } - else if ( ivas_total_brate >= IVAS_80k ) + else if ( ivas_total_brate >= IVAS_64k ) { ism_mode = ISM_MASA_MODE_ONE_OBJ; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8bd1d65bfb..8bcd60e1d5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4425,7 +4425,8 @@ void ivas_masa_encode( ISM_MODE ism_mode, /* i : ISM format mode */ int16_t nchan_ism, /* i : number of ism channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ - int16_t idx_separated_object /* i : index of the separated object */ + int16_t idx_separated_object, /* i : index of the separated object */ + OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ #endif ); @@ -5112,14 +5113,18 @@ void ivas_masa_ism_set_edited_objects( void encode_masa_to_total( IVAS_QMETADATA_HANDLE hQMetaData, - BSTR_ENC_HANDLE hMetaData + BSTR_ENC_HANDLE hMetaData, + int16_t low_bitrate_mode, + int16_t nbands, + int16_t nblocks ); void decode_masa_to_total( uint16_t* bit_stream, int16_t* index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], - int16_t nbands + int16_t nbands, + int16_t nblocks ); void modify_masa_energy_ratios( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 7c28e6b4f6..81c03f4791 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2784,13 +2784,13 @@ const float McMASA_LFEGain_vectors[64] = int32_t sep_object_brate[][MAX_NUM_OBJECTS] ={ {0, 0, 0, 0}, /* 13k2 */ {0, 0, 0, 0}, /* 16k4 */ - {0, 0, 0, 0}, /* 24k4 */ - {0, 0, 0, 0}, /* 32k */ - {0, 0, 0, 0}, /* 48k */ - {16000, 0, 0, 0}, /* 64k */ + {9600, 0, 0, 0}, /* 24k4 */ + {9600, 0, 0, 0}, /* 32k */ + {IVAS_13k2, 0, 0, 0}, /* 48k */ + {16000, IVAS_13k2, 0, 0}, /* 64k */ {20000, 16000, 0, 0}, /* 80k */ {IVAS_32k, 20000, 0, 0}, /* 96k */ - {IVAS_32k, IVAS_24k4, 0, 0}, /* 128k */ + {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 34d3584f7a..1ed3e91c35 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -164,7 +164,19 @@ ivas_error ivas_cpe_dec( { if ( st_ivas->hQMetaData != NULL && ivas_total_brate > IVAS_SID_5k2 ) { - stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.7f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); + } + else + { + +#endif + stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#ifdef MASA_AND_OBJECTS + } +#endif } else { diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 9ceaa52f68..998de0c8a6 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -630,6 +630,10 @@ ivas_error ivas_dec( ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); } + if ( st_ivas->hCPE[0]->nchan_out == 1 ) + { + mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ + } /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7da5528fb0..4e77e6bf5a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -189,10 +189,10 @@ ivas_error ivas_dec_setup( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata*/ - st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 3] + 1; + st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); if ( st_ivas->ini_frame > 0 ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index dcb70abf57..b6d416819d 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -73,6 +73,7 @@ static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); #ifdef MASA_AND_OBJECTS static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos ); static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, int16_t no_ism, int16_t K ); +static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t n_ism, int16_t nbands, int16_t nblocks ); #endif /*-----------------------------------------------------------------------* @@ -139,9 +140,17 @@ ivas_error ivas_masa_decode( { if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { - /* the number of MASA transport channels was read in ivas_dec_setup() */ - st->next_bit_pos -= MASA_TRANSP_BITS; - *nb_bits_read += MASA_TRANSP_BITS; +#ifdef MASA_AND_OBJECTS + if ( ivas_format != MASA_ISM_FORMAT ) + { + /* number of transport channels is always 2 for MASA_ISM format */ +#endif + /* the number of MASA transport channels was read in ivas_dec_setup() */ + st->next_bit_pos -= MASA_TRANSP_BITS; + *nb_bits_read += MASA_TRANSP_BITS; +#ifdef MASA_AND_OBJECTS + } +#endif #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) { @@ -1728,8 +1737,15 @@ static void read_ism_ratio_index( } else { - /* read prediciton type */ - differential_subframe = bit_stream[( *next_bit_pos )--]; + if ( numCodingBands > 1 ) + { + /* read prediction type */ + differential_subframe = bit_stream[( *next_bit_pos )--]; + } + else + { + differential_subframe = 1; + } /* read GR order */ GR_order = bit_stream[( *next_bit_pos )--]; for ( b = 0; b < numCodingBands; b++ ) @@ -1789,15 +1805,16 @@ static void decode_ism_ratios( int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], - int16_t n_ism ) + int16_t n_ism, + int16_t nbands, + int16_t numSf ) { int16_t sf, band; - int16_t nbands, numSf; int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; - nbands = hQMetaData->q_direction->cfg.nbands; - numSf = hQMetaData->q_direction->cfg.nblocks; + + /* hQMetaData->q_direction->cfg.nblocks; */ for ( sf = 0; sf < numSf; sf++ ) { /* read ism ratio indexes */ @@ -1818,6 +1835,23 @@ static void decode_ism_ratios( { reconstruct_ism_ratios( ratio_ism_idx[band], n_ism, 1.0f / (float) ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ), ratio_ism[sf][band] ); } + if ( nbands == 1 ) + { + for ( band = 1; band < 5; band++ ) + { + mvr2r( ratio_ism[sf][0], ratio_ism[sf][band], n_ism ); + } + } + } + if ( numSf == 1 ) + { + for ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + for ( band = 0; band < nbands; band++ ) + { + mvr2r( ratio_ism[0][band], ratio_ism[sf][band], n_ism ); + } + } } } @@ -1842,15 +1876,15 @@ static int16_t ivas_decode_masaism_metadata( nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; - nblocks = hQMetaData->q_direction->cfg.nblocks; + nblocks = hQMetaData->q_direction->cfg.nblocks; /* To do: what if other value than 4? */ /* Read MASA-to-total energy ratios */ - decode_masa_to_total( bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio, nbands ); + decode_masa_to_total( bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio, nbands, nblocks ); if ( nchan_ism > 1 ) { /* read ISM ratios */ - decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism ); + decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism, nbands, nblocks ); /* calculate priority */ set_f( priority, 0.0f, nchan_ism ); diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index b5b145a30f..e26850f737 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -3312,9 +3312,11 @@ static void read_stream_dct_coeffs_omasa( { int16_t sign, nbits; int16_t i, j, i_min; - int16_t last_non_null; - float step = 0.1f; + float step; + int16_t GR1, GR2; + + step = STEP_M2T; nbits = 0; sign = 1; if ( first_line == 0 ) @@ -3338,35 +3340,44 @@ static void read_stream_dct_coeffs_omasa( if ( q_idx[0] != 0 ) { - /* read last non null position */ - last_non_null = 0; - j = (int16_t) ceilf( log2f( (float) ( len_stream ) ) ); - for ( i = 0; i < j; i++ ) - { - last_non_null = ( last_non_null << 1 ) + bit_stream[( *index )--]; - } - - nbits += j; - if ( last_non_null > 0 ) + if ( len_stream >= 8 ) { /* read index of last index encoded with GR2 */ i_min = 0; - j = (int16_t) ceilf( log2f( (float) ( last_non_null + 1 ) ) ); + j = 4; for ( i = 0; i < j; i++ ) { i_min = ( i_min << 1 ) + bit_stream[( *index )--]; } - nbits += j; + /* read GR orders */ + GR1 = bit_stream[( *index )--] + 1; + if ( GR1 == 2 ) + { + GR2 = bit_stream[( *index )--]; + } + else + { + GR2 = 0; + } /* read GR data */ for ( i = 1; i <= i_min; i++ ) { - q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, 2 ); + q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, GR1 ); + } + for ( i = i_min + 1; i < len_stream; i++ ) + { + q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, GR2 ); } - for ( i = i_min + 1; i <= last_non_null; i++ ) + } + else + { + /* read GR order (only one) */ + GR1 = bit_stream[( *index )--]; + for ( i = 1; i < len_stream; i++ ) { - q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, 0 ); + q_idx[i] = ivas_qmetadata_DecodeExtendedGR( bit_stream, index, 100, GR1 ); } } } @@ -3390,7 +3401,8 @@ void decode_masa_to_total( uint16_t *bit_stream, int16_t *index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], - int16_t nbands ) + int16_t nbands, + int16_t nblocks ) { int16_t i, j, k; @@ -3402,24 +3414,16 @@ void decode_masa_to_total( int16_t n_streams, len_stream; /* Setup coding parameters */ - if ( nbands == 5 ) - { - n_streams = 1; - len_stream = nbands * 4; - } - else if ( nbands == 8 ) + n_streams = 1; + len_stream = nbands * nblocks; + if ( len_stream == 32 ) { n_streams = 4; len_stream = 8; } - else - { - n_streams = 4; - len_stream = nbands; - printf( "Unrecognized number of bands!" ); /* To do: finalize this */ - exit( -1 ); - } - set_s( q_idx, 0, nbands * MAX_PARAM_SPATIAL_SUBFRAMES ); + + + set_s( q_idx, 0, nbands * nblocks ); for ( i = 0; i < n_streams; i++ ) { read_stream_dct_coeffs_omasa( &q_idx[i * len_stream], &q_dct_data[i * len_stream], len_stream, bit_stream, index, i == 0 ); @@ -3427,19 +3431,34 @@ void decode_masa_to_total( /* inverse DCT2 transform */ - if ( nbands == 5 ) + switch ( len_stream ) { - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); /* reuse of variable*/ - } - else - { - assert( nbands == 8 ); - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); + case 4: + matrix_product( dct4, nblocks, nblocks, 1, q_dct_data, nblocks, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nblocks ); + break; + case 5: + matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nbands ); + break; + case 8: + matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nbands ); + break; + case 20: + matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ + break; + case 32: + matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); + break; + default: + break; } + k = 0; - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < nblocks; i++ ) { for ( j = 0; j < nbands; j++ ) { @@ -3448,5 +3467,25 @@ void decode_masa_to_total( k++; } } + if ( nblocks == 1 ) + { + for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = 0; j < nbands; j++ ) + { + masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[0][j]; + } + } + } + if ( nbands == 1 ) + { + for ( j = 1; j < 5; j++ ) + { + for ( i = 0; i < nblocks; i++ ) + { + masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[i][0]; + } + } + } } #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index e5c83ffb20..a2675ba1d8 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -271,7 +271,19 @@ ivas_error ivas_cpe_enc( { if ( st_ivas->hQMetaData != NULL ) { - stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) + { + stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.7f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); + } + else + { + +#endif + stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#ifdef MASA_AND_OBJECTS + } +#endif } else { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index bc2b6d33a0..b24233b6eb 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -90,7 +90,11 @@ ivas_error ivas_enc( input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); n_samples_chan = n_samples / nchan_inp; +#ifdef MASA_AND_OBJECTS + set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); +#else set_s( nb_bits_metadata, 0, MAX_SCE ); +#endif #ifdef SBA_BR_SWITCHING sba_reinit_flag = 0; if ( ivas_format == SBA_FORMAT ) @@ -257,7 +261,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0 + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0, NULL #endif ); } @@ -345,7 +349,7 @@ ivas_error ivas_enc( /* Encode MASA parameters and write MASA metadata bitstream */ ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object ); + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Merge transport signals */ @@ -428,7 +432,7 @@ ivas_error ivas_enc( ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 #ifdef MASA_AND_OBJECTS , - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0 + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0, NULL #endif ); diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 05f5892005..fadf8e9fb8 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -64,7 +64,11 @@ static void ivas_merge_masa_metadatas( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[] /* i/o: ISM metadata handles */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t low_bitrate_mode, /* i: is low bitrate more? 1/0 */ + int16_t omasa_nbands, + int16_t omasa_nblocks + ); static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format, const ISM_MODE ism_mode ); @@ -75,6 +79,8 @@ static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, int16_t n static int16_t index_slice_enum( const int16_t *ratio_ism_idx, int16_t no_ism ); static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, int16_t numCodingBands, int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio ); +static void transform_index_and_GR_encode( int16_t *diff_idx, int16_t len, int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); +static void transform_difference_index( int16_t *diff_idx, int16_t *idx, int16_t len ); #else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif @@ -241,7 +247,8 @@ void ivas_masa_encode( ISM_MODE ism_mode, /* i : ISM format mode */ int16_t nchan_ism, /* i : number of ism channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ - int16_t idx_separated_object /* i : index of the separated object */ + int16_t idx_separated_object, /* i : index of the separated object */ + OMASA_ENC_HANDLE hOMasa /* i: OMASA encoder handle */ #endif ) { @@ -249,10 +256,14 @@ void ivas_masa_encode( int16_t i, j; int16_t masa_sid_descriptor; +#ifdef MASA_AND_OBJECTS + int16_t low_bitrate_mode; +#endif masa_sid_descriptor = -1; h_orig_metadata = NULL; #ifdef MASA_AND_OBJECTS + low_bitrate_mode = 0; if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) #else if ( ivas_format == MASA_FORMAT ) @@ -317,13 +328,16 @@ void ivas_masa_encode( if ( ivas_format == MASA_FORMAT ) #endif { + +#ifndef MASA_AND_OBJECTS /* write the number of MASA transport channels */ push_next_indice( hMetaData, nchan_transport - 1, MASA_TRANSP_BITS ); hQMetaData->metadata_max_bits -= MASA_TRANSP_BITS; +#endif #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) { - /* always write the number of objects in ISM_MASA format*/ + /* write the number of objects in ISM_MASA format*/ push_next_indice( hMetaData, nchan_ism - 1, NO_BITS_MASA_ISM_NO_OBJ ); hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; @@ -334,6 +348,12 @@ void ivas_masa_encode( hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; } } + else + { + /* write the number of MASA transport channels */ + push_next_indice( hMetaData, nchan_transport - 1, MASA_TRANSP_BITS ); + hQMetaData->metadata_max_bits -= MASA_TRANSP_BITS; + } #endif /* write placeholder data for descriptive metadata */ @@ -376,6 +396,7 @@ void ivas_masa_encode( { #ifdef MASA_AND_OBJECTS reduce_metadata_further( hMasa, hQMetaData, ivas_format, ism_mode ); + low_bitrate_mode = ( ivas_total_brate <= 32000 ); #else reduce_metadata_further( hMasa, hQMetaData, ivas_format ); #endif @@ -389,7 +410,7 @@ void ivas_masa_encode( if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { /* encode MASA/ISM energy ratios */ - ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData ); + ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes ); } else { @@ -397,7 +418,9 @@ void ivas_masa_encode( } #endif /* Encode metadata */ + ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); + #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { @@ -2107,6 +2130,47 @@ static int16_t index_slice_enum( return index; } +static void transform_difference_index( + int16_t *diff_idx, + int16_t *idx, + int16_t len ) +{ + int16_t i; + for ( i = 0; i < len; i++ ) + { + if ( diff_idx[i] <= 0 ) + { + idx[i] = -2 * diff_idx[i]; + } + else + { + idx[i] = 2 * diff_idx[i] - 1; + } + } + return; +} + + +static void transform_index_and_GR_encode( + int16_t *diff_idx, /* i: differenc eindex to encode */ + int16_t len, /*i: input length */ + int16_t GR_order, /* i: GR order */ + BSTR_ENC_HANDLE hMetaData /* i/o: bitstream */ +) +{ + int16_t i; + int16_t idx[IVAS_MAX_NUM_OBJECTS]; + /* transform difference index into positive */ + transform_difference_index( diff_idx, idx, len ); + /* GR encoding */ + + for ( i = 0; i < len; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, idx[i], 100, GR_order ); + } + return; +} + static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, @@ -2194,20 +2258,8 @@ static int16_t encode_ratio_ism_subframe( { /* take difference with respect to previous subframe */ v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); - /* transform difference index into positive */ - for ( i = 0; i < no_ism - 1; i++ ) - { - if ( diff_idx[i] <= 0 ) - { - diff_idx[i] = -2 * diff_idx[i]; - } - else - { - diff_idx[i] = 2 * diff_idx[i] - 1; - } - } - /* GR encoding */ - + transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); + /* GR encoding estimate length */ for ( i = 0; i < no_ism - 1; i++ ) { nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); @@ -2224,151 +2276,100 @@ static int16_t encode_ratio_ism_subframe( GR_order = 1; nbits = nbits1; } - - /* try the difference from subband to subband; first subband is compared to previous subframe first subband*/ - /* take difference with respect to previous subframe only for first subband */ - nbits0 = 0; - nbits1 = 0; - v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); - /* transform difference index into positive */ - for ( i = 0; i < no_ism - 1; i++ ) + if ( numCodingBands > 1 ) { - if ( diff_idx[i] <= 0 ) - { - diff_idx[i] = -2 * diff_idx[i]; - } - else - { - diff_idx[i] = 2 * diff_idx[i] - 1; - } - } - /* GR encoding */ - - for ( i = 0; i < no_ism - 1; i++ ) - { - nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); - nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); - } - for ( b = 1; b < numCodingBands; b++ ) - { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + /* try the difference from subband to subband; first subband is compared to previous subframe first subband*/ + /* take difference with respect to previous subframe only for first subband */ + nbits0 = 0; + nbits1 = 0; + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); /* transform difference index into positive */ - for ( i = 0; i < no_ism - 1; i++ ) - { - if ( diff_idx[i] <= 0 ) - { - diff_idx[i] = -2 * diff_idx[i]; - } - else - { - diff_idx[i] = 2 * diff_idx[i] - 1; - } - } + transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); /* GR encoding */ - for ( i = 0; i < no_ism - 1; i++ ) { nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); } - } - - if ( nbits0 < nbits1 ) - { - GR_order_sb = 0; - } - else - { - GR_order_sb = 1; - nbits0 = nbits1; - } - - if ( nbits0 < nbits ) - { - differential_subframe = 0; - nbits = nbits0; - GR_order = GR_order_sb; - } - nbits++; /* for GR_order */ - nbits++; /* for the prediction type */ - - /* write prediction type */ - push_next_indice( hMetaData, differential_subframe, 1 ); - /* write GR order */ - push_next_indice( hMetaData, GR_order, 1 ); - /* write data */ - if ( differential_subframe ) - { - for ( b = 0; b < numCodingBands; b++ ) + for ( b = 1; b < numCodingBands; b++ ) { /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); /* transform difference index into positive */ - for ( i = 0; i < no_ism - 1; i++ ) - { - if ( diff_idx[i] <= 0 ) - { - diff_idx[i] = -2 * diff_idx[i]; - } - else - { - diff_idx[i] = 2 * diff_idx[i] - 1; - } - } + transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); /* GR encoding */ for ( i = 0; i < no_ism - 1; i++ ) { - ivas_qmetadata_encode_extended_gr( hMetaData, diff_idx[i], 100, GR_order ); + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); } } - } - else - { - v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); - /* transform difference index into positive */ - for ( i = 0; i < no_ism - 1; i++ ) + + if ( nbits0 < nbits1 ) { - if ( diff_idx[i] <= 0 ) - { - diff_idx[i] = -2 * diff_idx[i]; - } - else - { - diff_idx[i] = 2 * diff_idx[i] - 1; - } + GR_order_sb = 0; + } + else + { + GR_order_sb = 1; + nbits0 = nbits1; } - /* GR encoding */ - for ( i = 0; i < no_ism - 1; i++ ) + if ( nbits0 < nbits ) { - ivas_qmetadata_encode_extended_gr( hMetaData, diff_idx[i], 100, GR_order ); + differential_subframe = 0; + nbits = nbits0; + GR_order = GR_order_sb; } - for ( b = 1; b < numCodingBands; b++ ) + nbits++; /* for GR_order */ + nbits++; /* for the prediction type */ + + /* write prediction type */ + push_next_indice( hMetaData, differential_subframe, 1 ); + /* write GR order */ + push_next_indice( hMetaData, GR_order, 1 ); + /* write data */ + if ( differential_subframe ) { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); - /* transform difference index into positive */ - for ( i = 0; i < no_ism - 1; i++ ) + for ( b = 0; b < numCodingBands; b++ ) { - if ( diff_idx[i] <= 0 ) - { - diff_idx[i] = -2 * diff_idx[i]; - } - else - { - diff_idx[i] = 2 * diff_idx[i] - 1; - } + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); } - /* GR encoding */ + } + else + { + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - for ( i = 0; i < no_ism - 1; i++ ) + for ( b = 1; b < numCodingBands; b++ ) { - ivas_qmetadata_encode_extended_gr( hMetaData, diff_idx[i], 100, GR_order ); + /* take difference with respect to previous subband */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); } } } + else + { + /* only differential wrt previous subframe is possible */ + /* write the differential to subframe case and no bit to signal the difference type */ + + /* write GR order */ + push_next_indice( hMetaData, GR_order, 1 ); + nbits++; /* for GR_order */ + /* write data */ + + for ( b = 0; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); + } + } + #ifdef DEBUGGING assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); #endif @@ -2379,10 +2380,12 @@ static int16_t encode_ratio_ism_subframe( static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[] /* i/o: ISM metadata handles */ -) + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t low_bitrate_mode, /* i: is low bitrate more? 1/0 */ + int16_t omasa_nbands, + int16_t omasa_nblocks ) { int16_t sf, band; uint8_t numCodingBands; @@ -2400,35 +2403,127 @@ static void ivas_encode_masaism_metadata( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; float step; int16_t inv_step; + float energy_ism, energy_ism_ind[MAX_NUM_OBJECTS]; - numCodingBands = hMasa->config.numCodingBands; - numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4; - for ( sf = 0; sf < numSf; sf++ ) + /* use the values from hQMetaData */ + numCodingBands = (uint8_t) hQMetaData->q_direction->cfg.nbands; + numSf = (int8_t) hQMetaData->q_direction->cfg.nblocks; + + + if ( numCodingBands != omasa_nbands ) + { + assert( numCodingBands == 1 ); + + for ( sf = 0; sf < numSf; sf++ ) + { + if ( sum_f( hMasa->data.energy_ism[sf], omasa_nbands ) == 0.0f ) + { + hQMetaData->masa_to_total_energy_ratio[sf][0] = 1.0f; + } + else + { + brange[0] = hMasa->data.band_mapping[0]; + brange[1] = hMasa->data.band_mapping[omasa_nbands]; + eneBand = 0.0f; + for ( bin = brange[0]; bin < brange[1]; bin++ ) + { + eneBand += hMasa->data.energy[sf][bin]; + } + energy_ism = 0.0f; + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + energy_ism_ind[obj] = 0.0f; + } + for ( band = 0; band < omasa_nbands; band++ ) + { + energy_ism += hMasa->data.energy_ism[sf][band]; + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + energy_ism_ind[obj] += hMasa->data.energy_ism[sf][band] * hMasa->data.energy_ratio_ism[sf][band][obj]; + } + } + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + hMasa->data.energy_ratio_ism[sf][0][obj] = energy_ism_ind[obj] / energy_ism; + } + hQMetaData->masa_to_total_energy_ratio[sf][0] = eneBand / ( eneBand + energy_ism + EPSILON ); + } + } + } + else if ( numSf != omasa_nblocks ) { + assert( numSf == 1 ); + for ( band = 0; band < numCodingBands; band++ ) { - if ( hMasa->data.energy_ism[sf][band] == 0.0f ) + energy_ism = 0.0f; /* ISM energy for current subband */ + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + energy_ism_ind[obj] = 0.0f; + } + for ( sf = 0; sf < omasa_nblocks; sf++ ) + { + energy_ism += hMasa->data.energy_ism[sf][band]; + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + energy_ism_ind[obj] += hMasa->data.energy_ism[sf][band] * hMasa->data.energy_ratio_ism[sf][band][obj]; + } + } + if ( energy_ism == 0.0f ) { - hQMetaData->masa_to_total_energy_ratio[sf][band] = 1.0f; + hQMetaData->masa_to_total_energy_ratio[0][band] = 1.0f; } else { + for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + { + hMasa->data.energy_ratio_ism[0][band][obj] = energy_ism_ind[obj] / energy_ism; + } brange[0] = hMasa->data.band_mapping[band]; brange[1] = hMasa->data.band_mapping[band + 1]; eneBand = 0.0f; - for ( bin = brange[0]; bin < brange[1]; bin++ ) + for ( sf = 0; sf < omasa_nblocks; sf++ ) { - eneBand += hMasa->data.energy[sf][bin]; + for ( bin = brange[0]; bin < brange[1]; bin++ ) + { + eneBand += hMasa->data.energy[sf][bin]; + } } - hQMetaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hMasa->data.energy_ism[sf][band] + EPSILON ); + hQMetaData->masa_to_total_energy_ratio[0][band] = eneBand / ( eneBand + energy_ism + EPSILON ); } } } + else + { + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + if ( hMasa->data.energy_ism[sf][band] == 0.0f ) + { + hQMetaData->masa_to_total_energy_ratio[sf][band] = 1.0f; + } + else + { + brange[0] = hMasa->data.band_mapping[band]; + brange[1] = hMasa->data.band_mapping[band + 1]; + + eneBand = 0.0f; + for ( bin = brange[0]; bin < brange[1]; bin++ ) + { + eneBand += hMasa->data.energy[sf][bin]; + } + hQMetaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hMasa->data.energy_ism[sf][band] + EPSILON ); + } + } + } + } + + encode_masa_to_total( hQMetaData, hMetaData, low_bitrate_mode, numCodingBands, numSf ); - encode_masa_to_total( hQMetaData, hMetaData ); /* quantize ism_ratios */ if ( hMasa->data.nchan_ism > 1 ) { diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 1c9eef86e8..fbc98dbe21 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -125,7 +125,9 @@ static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *d static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); #ifdef MASA_AND_OBJECTS -static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream, BSTR_ENC_HANDLE hMetaData, int16_t first_line ); +static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream, BSTR_ENC_HANDLE hMetaData, int16_t first_line, int16_t low_bitrate_mode ); +static int16_t find_optimal_GR_order( int16_t *q_idx, int16_t len, int16_t *GR ); +static int16_t find_optimal_GR_orders( int16_t *q_idx, int16_t len, int16_t len_max_GR1, int16_t *GR1, int16_t *GR2, int16_t *i_min ); #endif /*-----------------------------------------------------------------------* @@ -4922,14 +4924,138 @@ static float direction_distance( } #endif #ifdef MASA_AND_OBJECTS -static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream, BSTR_ENC_HANDLE hMetaData, int16_t first_line ) + +static int16_t divide_GR_orders( + int16_t *q_idx, + int16_t GR1, + int16_t GR2, + int16_t len, + int16_t len_max_GR1, + int16_t *i_min ) +{ + int16_t nb_GR_min; + int16_t i, j, nb_GR; + nb_GR_min = 1000; + *i_min = -1; + for ( i = 0; i < min( len_max_GR1, len ); i++ ) + { + nb_GR = 0; + + for ( j = 0; j <= i; j++ ) + { + nb_GR += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR1 ); + } + for ( j = i + 1; j < len; j++ ) + { + nb_GR += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR2 ); + } + + if ( nb_GR < nb_GR_min ) + { + nb_GR_min = nb_GR; + *i_min = i + 1; + } + } + return nb_GR_min; +} +static int16_t +find_optimal_GR_order( + int16_t *q_idx, + int16_t len, + int16_t *GR ) +{ + int16_t nb_GR_0, nb_GR_1; + int16_t i; + /* find optimum length of the part encoded with GR2 */ + nb_GR_0 = 0; + nb_GR_1 = 0; + for ( i = 0; i < len; i++ ) + { + nb_GR_0 += ivas_qmetadata_encode_extended_gr_length( q_idx[i], 100, 0 ); + nb_GR_1 += ivas_qmetadata_encode_extended_gr_length( q_idx[i], 100, 1 ); + } + + if ( nb_GR_0 < nb_GR_1 ) + { + *GR = 0; + return nb_GR_0; + } + else + { + *GR = 1; + return nb_GR_1; + } +} + + +static int16_t +find_optimal_GR_orders( + int16_t *q_idx, + int16_t len, + int16_t len_max_GR1, + int16_t *GR1, + int16_t *GR2, + int16_t *i_min ) +{ + int16_t nb_GR_20, nb_GR_21, nb_GR_10, nb_GR_min; + int16_t i_min_20, i_min_21, i_min_10; + /* find optimum length of the part encoded with GR2 */ + nb_GR_20 = divide_GR_orders( q_idx, 2, 0, len, len_max_GR1, &i_min_20 ); + nb_GR_21 = divide_GR_orders( q_idx, 2, 1, len, len_max_GR1, &i_min_21 ); + nb_GR_10 = divide_GR_orders( q_idx, 1, 0, len, len_max_GR1, &i_min_10 ); + + if ( nb_GR_20 < nb_GR_21 && nb_GR_20 < nb_GR_10 ) + { + *GR1 = 2; + *GR2 = 0; + nb_GR_min = nb_GR_20; + *i_min = i_min_20; + } + else + { + if ( nb_GR_21 < nb_GR_20 && nb_GR_21 < nb_GR_10 ) + { + *GR1 = 2; + *GR2 = 1; + nb_GR_min = nb_GR_21; + *i_min = i_min_21; + } + else + { + *GR1 = 1; + *GR2 = 0; + nb_GR_min = nb_GR_10; + *i_min = i_min_10; + } + } + return nb_GR_min; +} + +static int16_t write_stream_dct_coeffs_omasa( + int16_t *q_idx, /* i: array of indexes to be written */ + int16_t len_stream, /* i: array length */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream */ + int16_t first_line, /* i: is first line of the matrix? 1/0*/ + int16_t low_bitrate_mode /* i: is low bitrate mode? if yes, limit the number of bits written */ +) { int16_t nb_bits = 0, bits_pos; - int16_t last_non_null; - uint16_t nb_GR_min, i_min, nb_GR; + uint16_t nb_GR_min; int16_t i, j; + int16_t changed, update_needed; + + int16_t GR1, GR2, i_min; + int16_t max_bits; bits_pos = hMetaData->nb_bits_tot; + if ( low_bitrate_mode == 1 ) + { + max_bits = 50; /* To do : find optimal allowed value*/ + } + else + { + max_bits = 1000; + } /* write DCT 0 component */ /* write sign only if not the very first DCT coeff */ if ( first_line == 0 ) @@ -4937,7 +5063,7 @@ static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream if ( q_idx[0] > 0 ) { push_next_indice( hMetaData, 1, 1 ); - push_next_indice( hMetaData, q_idx[0], BITS_MASA2TOTTAL_DCT0 ); /* Todo : define constant */ + push_next_indice( hMetaData, q_idx[0], BITS_MASA2TOTTAL_DCT0 ); } else { @@ -4953,73 +5079,113 @@ static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream } - /* find last non-null position */ - last_non_null = -1; if ( q_idx[0] != 0 ) { - last_non_null = len_stream - 1; - while ( ( q_idx[last_non_null] == 0 ) && ( last_non_null >= 0 ) ) + i_min = 1; + GR2 = 0; + if ( len_stream >= 8 ) { - last_non_null--; + nb_GR_min = find_optimal_GR_orders( &q_idx[1], len_stream - 1, 15, &GR1, &GR2, &i_min ); + } + else + { + nb_GR_min = find_optimal_GR_order( &q_idx[1], len_stream - 1, &GR1 ); } - } - if ( last_non_null == -1 ) - { - /* all values are zero; no need to send anything else */ - assert( q_idx[0] == 0 ); - } - else - { - assert( q_idx[0] != 0 ); - /*last_non_null = max(4, last_non_null); */ - /* write index of last non null index on log2(len_stream) bits */ - j = (int16_t) ceilf( log2f( (float) ( len_stream ) ) ); - push_next_indice( hMetaData, last_non_null, j ); - nb_bits += j; - if ( last_non_null > 0 ) + assert( nb_GR_min < 1000 ); + changed = 1; + update_needed = 0; + while ( len_stream >= 8 && nb_GR_min > max_bits && changed >= 1 ) { - /* find optimum length of the part encoded with GR2 */ - nb_GR_min = 1000; - i_min = 0; - for ( i = 1; i <= last_non_null; i++ ) + update_needed = 1; + changed = 0; + for ( j = len_stream - 1; j > 6; j-- ) { - nb_GR = 0; - for ( j = 1; j <= i; j++ ) + if ( q_idx[j] >= 2 ) { - nb_GR += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, 2 ); + + if ( j > i_min ) + { + changed = 1; + nb_GR_min -= ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR2 ); + q_idx[j] -= 2; + nb_GR_min += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR2 ); + } + else + { + changed = 1; + nb_GR_min -= ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR1 ); + q_idx[j] -= 2; + nb_GR_min += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, 0 ); + } } - for ( j = i + 1; j <= last_non_null; j++ ) + else if ( q_idx[j] == 1 ) { - nb_GR += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, 0 ); + if ( j > i_min ) + { + changed = 1; + nb_GR_min -= ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR2 ); + q_idx[j] -= 1; + + nb_GR_min += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR2 ); + } + else + { + changed = 1; + nb_GR_min -= ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, GR1 ); + q_idx[j] -= 1; + nb_GR_min += ivas_qmetadata_encode_extended_gr_length( q_idx[j], 100, 0 ); + } } - if ( nb_GR < nb_GR_min ) + if ( nb_GR_min < max_bits ) { - nb_GR_min = nb_GR; - i_min = i; + break; } } - - assert( nb_GR_min < 1000 ); - - - /* write number of indexes encoded with GR2 */ - j = (int16_t) ceilf( log2f( (float) ( last_non_null + 1 ) ) ); - assert( i_min < ( 1 << j ) ); - push_next_indice( hMetaData, i_min, j ); - nb_bits += j; - + } + if ( update_needed == 1 ) + { + /* re-calculate */ + /* find optimum length of the part encoded with GR2 */ + nb_GR_min = find_optimal_GR_orders( &q_idx[1], len_stream - 1, 15, &GR1, &GR2, &i_min ); + } + if ( len_stream >= 8 ) + { + /* write number of indexes encoded with GR2 on 4 bits */ + push_next_indice( hMetaData, i_min, 4 ); + nb_bits += 4; + /* write GR orders */ + push_next_indice( hMetaData, GR1 - 1, 1 ); + nb_bits += 1; + if ( GR1 == 2 ) + { + push_next_indice( hMetaData, GR2, 1 ); + nb_bits += 1; + } /* write GR data */ for ( i = 1; i <= i_min; i++ ) { - ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, 2 ); + ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, GR1 ); + } + for ( i = i_min + 1; i < len_stream; i++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, GR2 ); } - for ( i = i_min + 1; i <= last_non_null; i++ ) + } + else + { + /* len_stream <= 8 */ + /* write GR order */ + push_next_indice( hMetaData, GR1, 1 ); + nb_bits += 1; + for ( i = 1; i < len_stream; i++ ) { - ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, 0 ); + ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, GR1 ); } - nb_bits += nb_GR_min; } + + nb_bits += nb_GR_min; + assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); } return nb_bits; @@ -5027,23 +5193,27 @@ static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream void encode_masa_to_total( IVAS_QMETADATA_HANDLE hQMetaData, - BSTR_ENC_HANDLE hMetaData ) + BSTR_ENC_HANDLE hMetaData, + int16_t low_bitrate_mode, + int16_t nbands, + int16_t nblocks ) { int16_t i, j, k; float data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; - float step = 0.1f; + float step = STEP_M2T; + int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; float dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; float dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; - int16_t nbands; + int16_t bits_pos, nb_bits; int16_t n_streams, len_stream; - nbands = hQMetaData->numCodingBands; + #ifdef DEBUG_MODE_QMETADATA static FILE *pF = NULL; static FILE *pF_ratio = NULL; @@ -5055,44 +5225,55 @@ void encode_masa_to_total( #endif -#ifdef DEBUGGING - assert( ( nbands == 5 || nbands == 8 ) && "Number of subbands in parametric MASA_ISM should be 5 or 8 " ); -#endif + bits_pos = hMetaData->nb_bits_tot; k = 0; for ( i = 0; i < nbands; i++ ) { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + for ( j = 0; j < nblocks; j++ ) { data[k] = hQMetaData->masa_to_total_energy_ratio[j][i]; k++; } } - /* DCT2 transform */ - if ( nbands == 5 ) - { - matrix_product( dct5, nbands, nbands, 0, data, MAX_PARAM_SPATIAL_SUBFRAMES, nbands, 1, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 1, dct_data ); - } - else - { - matrix_product( dct8, nbands, nbands, 0, data, MAX_PARAM_SPATIAL_SUBFRAMES, nbands, 1, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 1, dct_data ); + n_streams = 1; + len_stream = nbands * nblocks; + switch ( len_stream ) + { + case 4: + matrix_product( dct4, nblocks, nblocks, 0, data, 1, nblocks, 1, dct_data ); + n_streams = 1; + len_stream = 4; + break; + case 5: + matrix_product( dct5, nbands, nbands, 0, data, 1, nbands, 1, dct_data ); + n_streams = 1; + len_stream = nbands; + break; + case 8: + matrix_product( dct8, nbands, nbands, 0, data, 1, nbands, 1, dct_data ); + n_streams = 1; + len_stream = nbands; + break; + break; + case 20: + matrix_product( dct5, nbands, nbands, 0, data, nblocks, nbands, 1, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 1, dct_data ); + n_streams = 1; + len_stream = nbands * nblocks; + break; + case 32: + matrix_product( dct8, nbands, nbands, 0, data, nblocks, nbands, 1, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 1, dct_data ); + n_streams = nblocks; + len_stream = nbands; + break; + default: + break; } - /* Setup coding parameters */ - if ( nbands == 5 ) - { - n_streams = 1; - len_stream = nbands * MAX_PARAM_SPATIAL_SUBFRAMES; - } - else - { - n_streams = MAX_PARAM_SPATIAL_SUBFRAMES; - len_stream = 8; - } for ( k = 0; k < n_streams; k++ ) { @@ -5129,21 +5310,57 @@ void encode_masa_to_total( } + /* write data */ + nb_bits = 0; + for ( i = 0; i < n_streams; i++ ) + { + nb_bits += write_stream_dct_coeffs_omasa( &q_idx[i * len_stream], len_stream, hMetaData, ( i == 0 ), low_bitrate_mode ); + } + + /* reconstruct masa2total */ - /* inverse DCT2 transform */ - if ( nbands == 5 ) + q_dct_data[0] = q_idx[0] * step; + for ( i = 1; i < len_stream; i++ ) { - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); /* reuse of variable*/ + if ( ( q_idx[i] % 2 ) == 0 ) + { + q_dct_data[i] = -( q_idx[i] >> 1 ) * step; + } + else + { + q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; + } } - else + /* inverse DCT2 transform */ + switch ( len_stream ) { - assert( nbands == 8 ); - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, MAX_PARAM_SPATIAL_SUBFRAMES, 0, dct4, MAX_PARAM_SPATIAL_SUBFRAMES, MAX_PARAM_SPATIAL_SUBFRAMES, 0, q_dct_data ); + case 4: + matrix_product( dct4, nblocks, nblocks, 1, q_dct_data, nblocks, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nblocks ); + break; + case 5: + matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nbands ); + break; + case 8: + matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nbands ); + break; + case 20: + matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ + break; + case 32: + matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); + matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); + break; + default: + break; } + + k = 0; - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < nblocks; i++ ) { for ( j = 0; j < nbands; j++ ) { @@ -5152,14 +5369,6 @@ void encode_masa_to_total( k++; } } - - /* write data */ - nb_bits = 0; - for ( i = 0; i < n_streams; i++ ) - { - nb_bits += write_stream_dct_coeffs_omasa( &q_idx[i * len_stream], len_stream, hMetaData, ( i == 0 ) ); - } - assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); #ifdef DEBUG_MODE_QMETADATA -- GitLab From b843c21ad535d2143ebb12ac8572d531bd406b83 Mon Sep 17 00:00:00 2001 From: advasila Date: Sun, 22 Jan 2023 20:49:18 +0200 Subject: [PATCH 012/591] 1obj DISC from 32k --- lib_com/ivas_ism_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 473491f8fd..7a9dedfc9f 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -532,7 +532,7 @@ ISM_MODE ivas_omasa_ism_mode_select( switch ( no_obj ) { case 1: - if ( ivas_total_brate >= IVAS_24k4 ) + if ( ivas_total_brate >= IVAS_32k ) { ism_mode = ISM_MASA_MODE_DISC; } -- GitLab From 12a463d124a70c63dd650e9ae0abb212e79864a9 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 23 Jan 2023 16:57:06 +1100 Subject: [PATCH 013/591] instrumentation error fixes --- Workspace_msvc/lib_rend.vcxproj | 6 +- lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c | 120 +- lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c | 1667 +++++++++-------- lib_rend/ivas_cldfb_trans_codec/NoiseGen.c | 10 +- .../ivas_cldfb_trans_codec/RMSEnvGrouping.c | 40 +- .../cldfb_codec_bitstream.c | 10 +- lib_rend/ivas_splitRend_lcld_dec.c | 16 +- lib_rend/ivas_splitRend_lcld_enc.c | 16 +- 8 files changed, 1007 insertions(+), 878 deletions(-) diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 979e35246c..1749b8e038 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -89,7 +89,7 @@ Disabled - ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c index 370aa0dbd1..7e388d8242 100644 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c @@ -5,6 +5,8 @@ #include #include #include "Tables.h" +#include "options.h" +#include "prot.h" #include "wmops.h" #include "PerceptualModel.h" #include "RMSEnvDeltaHuff.h" @@ -54,7 +56,7 @@ CQMFDecoder* CreateCQMFDecoder(const int iSampleRate, assert(iSampleRate == 48000); //Fix - psCQMFDecoder = (CQMFDecoder*)malloc(sizeof(CQMFDecoder)); + psCQMFDecoder = (CQMFDecoder*)count_malloc(sizeof(CQMFDecoder)); psCQMFDecoder->iSampleRate = iSampleRate; psCQMFDecoder->iChannels = iChannels; psCQMFDecoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; @@ -64,42 +66,42 @@ CQMFDecoder* CreateCQMFDecoder(const int iSampleRate, psCQMFDecoder->piBandwidths = c_aiBandwidths48; //Fix psCQMFDecoder->iMSMode = 0; - psCQMFDecoder->piMSFlags = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->piMSFlags = (int*)count_malloc(MAX_BANDS * sizeof(int)); psCQMFDecoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo - psCQMFDecoder->piNumGroups = (int*)malloc(psCQMFDecoder->iChannels * sizeof(int)); - psCQMFDecoder->ppiGroupLengths = (int**)malloc(psCQMFDecoder->iChannels * sizeof(int*)); - psCQMFDecoder->pppiRMSEnvelope = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiSMR = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiExcitation = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiAlloc = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - - psCQMFDecoder->pppiCQMFSignReal = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiCQMFSignImag = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiQCQMFReal = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiQCQMFImag = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->piNumGroups = (int*)count_malloc(psCQMFDecoder->iChannels * sizeof(int)); + psCQMFDecoder->ppiGroupLengths = (int**)count_malloc(psCQMFDecoder->iChannels * sizeof(int*)); + psCQMFDecoder->pppiRMSEnvelope = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiSMR = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiExcitation = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiAlloc = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + + psCQMFDecoder->pppiCQMFSignReal = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiCQMFSignImag = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiQCQMFReal = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); + psCQMFDecoder->pppiQCQMFImag = (int***)count_malloc(psCQMFDecoder->iChannels * sizeof(int**)); for(n = 0; n < iChannels ; n ++){ int k; - psCQMFDecoder->ppiGroupLengths[n] = (int*)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); - psCQMFDecoder->pppiRMSEnvelope[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiSMR[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiExcitation[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiAlloc[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->ppiGroupLengths[n] = (int*)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); + psCQMFDecoder->pppiRMSEnvelope[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiSMR[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiExcitation[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiAlloc[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiCQMFSignReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiCQMFSignImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiQCQMFReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiQCQMFImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiCQMFSignReal[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiCQMFSignImag[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiQCQMFReal[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); + psCQMFDecoder->pppiQCQMFImag[n] = (int**)count_malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - psCQMFDecoder->pppiRMSEnvelope[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiSMR[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiExcitation[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiAlloc[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiRMSEnvelope[n][k] = (int*)count_malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiSMR[n][k] = (int*)count_malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiExcitation[n][k] = (int*)count_malloc(MAX_BANDS * sizeof(int)); + psCQMFDecoder->pppiAlloc[n][k] = (int*)count_malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiCQMFSignReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFDecoder->pppiCQMFSignImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFDecoder->pppiQCQMFReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFDecoder->pppiQCQMFImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiCQMFSignReal[n][k] = (int*)count_malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiCQMFSignImag[n][k] = (int*)count_malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiQCQMFReal[n][k] = (int*)count_malloc(CQMF_BANDS * sizeof(int)); + psCQMFDecoder->pppiQCQMFImag[n][k] = (int*)count_malloc(CQMF_BANDS * sizeof(int)); } } @@ -117,19 +119,19 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) if(psCQMFDecoder != NULL){ if(psCQMFDecoder->piMSFlags != NULL){ - free(psCQMFDecoder->piMSFlags); + count_free(psCQMFDecoder->piMSFlags); } if(psCQMFDecoder->piNumGroups != NULL){ - free(psCQMFDecoder->piNumGroups); + count_free(psCQMFDecoder->piNumGroups); } if(psCQMFDecoder->ppiGroupLengths != NULL){ int n; for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - free(psCQMFDecoder->ppiGroupLengths[n]); + count_free(psCQMFDecoder->ppiGroupLengths[n]); } - free(psCQMFDecoder->ppiGroupLengths); + count_free(psCQMFDecoder->ppiGroupLengths); } if(psCQMFDecoder->pppiRMSEnvelope != NULL){ @@ -137,11 +139,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiRMSEnvelope[n][k]); + count_free(psCQMFDecoder->pppiRMSEnvelope[n][k]); } - free(psCQMFDecoder->pppiRMSEnvelope[n]); + count_free(psCQMFDecoder->pppiRMSEnvelope[n]); } - free(psCQMFDecoder->pppiRMSEnvelope); + count_free(psCQMFDecoder->pppiRMSEnvelope); } if(psCQMFDecoder->pppiSMR != NULL){ @@ -149,11 +151,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiSMR[n][k]); + count_free(psCQMFDecoder->pppiSMR[n][k]); } - free(psCQMFDecoder->pppiSMR[n]); + count_free(psCQMFDecoder->pppiSMR[n]); } - free(psCQMFDecoder->pppiSMR); + count_free(psCQMFDecoder->pppiSMR); } if(psCQMFDecoder->pppiExcitation != NULL){ @@ -161,11 +163,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiExcitation[n][k]); + count_free(psCQMFDecoder->pppiExcitation[n][k]); } - free(psCQMFDecoder->pppiExcitation[n]); + count_free(psCQMFDecoder->pppiExcitation[n]); } - free(psCQMFDecoder->pppiExcitation); + count_free(psCQMFDecoder->pppiExcitation); } if(psCQMFDecoder->pppiAlloc != NULL){ @@ -173,11 +175,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiAlloc[n][k]); + count_free(psCQMFDecoder->pppiAlloc[n][k]); } - free(psCQMFDecoder->pppiAlloc[n]); + count_free(psCQMFDecoder->pppiAlloc[n]); } - free(psCQMFDecoder->pppiAlloc); + count_free(psCQMFDecoder->pppiAlloc); } if(psCQMFDecoder->pppiCQMFSignReal != NULL){ @@ -185,11 +187,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiCQMFSignReal[n][k]); + count_free(psCQMFDecoder->pppiCQMFSignReal[n][k]); } - free(psCQMFDecoder->pppiCQMFSignReal[n]); + count_free(psCQMFDecoder->pppiCQMFSignReal[n]); } - free(psCQMFDecoder->pppiCQMFSignReal); + count_free(psCQMFDecoder->pppiCQMFSignReal); } if(psCQMFDecoder->pppiCQMFSignImag != NULL){ @@ -197,11 +199,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiCQMFSignImag[n][k]); + count_free(psCQMFDecoder->pppiCQMFSignImag[n][k]); } - free(psCQMFDecoder->pppiCQMFSignImag[n]); + count_free(psCQMFDecoder->pppiCQMFSignImag[n]); } - free(psCQMFDecoder->pppiCQMFSignImag); + count_free(psCQMFDecoder->pppiCQMFSignImag); } if(psCQMFDecoder->pppiQCQMFReal != NULL){ @@ -209,11 +211,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiQCQMFReal[n][k]); + count_free(psCQMFDecoder->pppiQCQMFReal[n][k]); } - free(psCQMFDecoder->pppiQCQMFReal[n]); + count_free(psCQMFDecoder->pppiQCQMFReal[n]); } - free(psCQMFDecoder->pppiQCQMFReal); + count_free(psCQMFDecoder->pppiQCQMFReal); } if(psCQMFDecoder->pppiQCQMFImag != NULL){ @@ -221,11 +223,11 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) for(n = 0; n < psCQMFDecoder->iChannels; n ++){ int k; for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiQCQMFImag[n][k]); + count_free(psCQMFDecoder->pppiQCQMFImag[n][k]); } - free(psCQMFDecoder->pppiQCQMFImag[n]); + count_free(psCQMFDecoder->pppiQCQMFImag[n]); } - free(psCQMFDecoder->pppiQCQMFImag); + count_free(psCQMFDecoder->pppiQCQMFImag); } if(psCQMFDecoder->psBSRead != NULL){ @@ -236,7 +238,7 @@ void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) DeleteNoiseGen(psCQMFDecoder->psNoiseGen); } - free(psCQMFDecoder); + count_free(psCQMFDecoder); } } diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c index 6795f9327c..5aa13f0fba 100644 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c +++ b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c @@ -5,6 +5,8 @@ #include #include #include "Tables.h" +#include "options.h" +#include "prot.h" #include "wmops.h" #include "RMSEnvGrouping.h" #include "PerceptualModel.h" @@ -12,511 +14,554 @@ #include "CQMFHuff.h" #include "cldfb_codec_bitstream.h" -typedef struct CQMF_ENCODER{ - int iSampleRate; - int iChannels; - int iNumBlocks; - - int iTargetBitRate; - int iTargetBitsPerFrame; - - int iNumBands; - const int *piBandwidths; - - int iMSMode; - int *piMSFlags; - +typedef struct CQMF_ENCODER +{ + int iSampleRate; + int iChannels; + int iNumBlocks; + + int iTargetBitRate; + int iTargetBitsPerFrame; + + int iNumBands; + const int *piBandwidths; + + int iMSMode; + int *piMSFlags; + RMSEnvelopeGrouping *psRMSEnvelopeGrouping; - int iCommonGrouping; - int *piNumGroups; - int **ppiGroupLengths; - - int ***pppiRMSEnvelope; - int ***pppiSMR; - int ***pppiExcitation; - int ***pppiAlloc; - - int iAllocOffset; - - int ***pppiCQMFSignReal; - int ***pppiCQMFSignImag; - int ***pppiQCQMFReal; - int ***pppiQCQMFImag; - - Bitstream *psBSWrite; - - int iLastError; -}CQMFEncoder; - -CQMFEncoder* CreateCQMFEncoder(const int iSampleRate, - const int iChannels, - const int iTargetBitRate) + int iCommonGrouping; + int *piNumGroups; + int **ppiGroupLengths; + + int ***pppiRMSEnvelope; + int ***pppiSMR; + int ***pppiExcitation; + int ***pppiAlloc; + + int iAllocOffset; + + int ***pppiCQMFSignReal; + int ***pppiCQMFSignImag; + int ***pppiQCQMFReal; + int ***pppiQCQMFImag; + + Bitstream *psBSWrite; + + int iLastError; +} CQMFEncoder; + +CQMFEncoder *CreateCQMFEncoder( const int iSampleRate, + const int iChannels, + const int iTargetBitRate ) { int n; CQMFEncoder *psCQMFEncoder = NULL; - - assert(iSampleRate == 48000); //Fix - - psCQMFEncoder = (CQMFEncoder*)malloc(sizeof(CQMFEncoder)); + + assert( iSampleRate == 48000 ); // Fix + + psCQMFEncoder = (CQMFEncoder *) count_malloc( sizeof( CQMFEncoder ) ); psCQMFEncoder->iSampleRate = iSampleRate; psCQMFEncoder->iChannels = iChannels; psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; psCQMFEncoder->iAllocOffset = 0; - + psCQMFEncoder->iTargetBitRate = iTargetBitRate; psCQMFEncoder->iTargetBitsPerFrame = iTargetBitRate * CQMF_BLOCKS_PER_FRAME * CQMF_BANDS / iSampleRate; - - psCQMFEncoder->iNumBands = MAX_BANDS_48 - 1; //Fix - psCQMFEncoder->piBandwidths = c_aiBandwidths48; //Fix - + + psCQMFEncoder->iNumBands = MAX_BANDS_48 - 1; // Fix + psCQMFEncoder->piBandwidths = c_aiBandwidths48; // Fix + psCQMFEncoder->iMSMode = 0; - psCQMFEncoder->piMSFlags = (int*)malloc(MAX_BANDS * sizeof(int)); - - psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping(psCQMFEncoder->iNumBlocks); - + psCQMFEncoder->piMSFlags = (int *) count_malloc( MAX_BANDS * sizeof( int ) ); + + psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psCQMFEncoder->iNumBlocks ); + psCQMFEncoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo - psCQMFEncoder->piNumGroups = (int*)malloc(psCQMFEncoder->iChannels * sizeof(int)); - psCQMFEncoder->ppiGroupLengths = (int**)malloc(psCQMFEncoder->iChannels * sizeof(int*)); - psCQMFEncoder->pppiRMSEnvelope = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiSMR = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiExcitation = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiAlloc = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - - psCQMFEncoder->pppiCQMFSignReal = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiCQMFSignImag = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiQCQMFReal = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiQCQMFImag = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - for(n = 0; n < iChannels ; n ++){ + psCQMFEncoder->piNumGroups = (int *) count_malloc( psCQMFEncoder->iChannels * sizeof( int ) ); + psCQMFEncoder->ppiGroupLengths = (int **) count_malloc( psCQMFEncoder->iChannels * sizeof( int * ) ); + psCQMFEncoder->pppiRMSEnvelope = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + psCQMFEncoder->pppiSMR = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + psCQMFEncoder->pppiExcitation = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + psCQMFEncoder->pppiAlloc = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + + psCQMFEncoder->pppiCQMFSignReal = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + psCQMFEncoder->pppiCQMFSignImag = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + psCQMFEncoder->pppiQCQMFReal = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + psCQMFEncoder->pppiQCQMFImag = (int ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int ** ) ); + for ( n = 0; n < iChannels; n++ ) + { int k; - psCQMFEncoder->ppiGroupLengths[n] = (int*)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); - psCQMFEncoder->pppiRMSEnvelope[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiSMR[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiExcitation[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiAlloc[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - - psCQMFEncoder->pppiCQMFSignReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiCQMFSignImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiQCQMFReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiQCQMFImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - psCQMFEncoder->pppiRMSEnvelope[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFEncoder->pppiSMR[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFEncoder->pppiExcitation[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFEncoder->pppiAlloc[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - - psCQMFEncoder->pppiCQMFSignReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFEncoder->pppiCQMFSignImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFEncoder->pppiQCQMFReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFEncoder->pppiQCQMFImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); + psCQMFEncoder->ppiGroupLengths[n] = (int *) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int ) ); + psCQMFEncoder->pppiRMSEnvelope[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + psCQMFEncoder->pppiSMR[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + psCQMFEncoder->pppiExcitation[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + psCQMFEncoder->pppiAlloc[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + + psCQMFEncoder->pppiCQMFSignReal[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + psCQMFEncoder->pppiCQMFSignImag[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + psCQMFEncoder->pppiQCQMFReal[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + psCQMFEncoder->pppiQCQMFImag[n] = (int **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int * ) ); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + psCQMFEncoder->pppiRMSEnvelope[n][k] = (int *) count_malloc( MAX_BANDS * sizeof( int ) ); + psCQMFEncoder->pppiSMR[n][k] = (int *) count_malloc( MAX_BANDS * sizeof( int ) ); + psCQMFEncoder->pppiExcitation[n][k] = (int *) count_malloc( MAX_BANDS * sizeof( int ) ); + psCQMFEncoder->pppiAlloc[n][k] = (int *) count_malloc( MAX_BANDS * sizeof( int ) ); + + psCQMFEncoder->pppiCQMFSignReal[n][k] = (int *) count_malloc( CQMF_BANDS * sizeof( int ) ); + psCQMFEncoder->pppiCQMFSignImag[n][k] = (int *) count_malloc( CQMF_BANDS * sizeof( int ) ); + psCQMFEncoder->pppiQCQMFReal[n][k] = (int *) count_malloc( CQMF_BANDS * sizeof( int ) ); + psCQMFEncoder->pppiQCQMFImag[n][k] = (int *) count_malloc( CQMF_BANDS * sizeof( int ) ); } } - - psCQMFEncoder->psBSWrite = CreateBitstream(BS_WRITE,4096); + + psCQMFEncoder->psBSWrite = CreateBitstream( BS_WRITE, 4096 ); psCQMFEncoder->iLastError = ENCODER_ERROR_NONE; - + return psCQMFEncoder; } -void DeleteCQMFEncoder(CQMFEncoder *psCQMFEncoder) +void DeleteCQMFEncoder( CQMFEncoder *psCQMFEncoder ) { - if(psCQMFEncoder != NULL){ - - if(psCQMFEncoder->piMSFlags != NULL){ - free(psCQMFEncoder->piMSFlags); + if ( psCQMFEncoder != NULL ) + { + + if ( psCQMFEncoder->piMSFlags != NULL ) + { + count_free( psCQMFEncoder->piMSFlags ); } - - if(psCQMFEncoder->piNumGroups != NULL){ - free(psCQMFEncoder->piNumGroups); + + if ( psCQMFEncoder->piNumGroups != NULL ) + { + count_free( psCQMFEncoder->piNumGroups ); } - - if(psCQMFEncoder->psRMSEnvelopeGrouping != NULL){ - DeleteRMSEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping); + + if ( psCQMFEncoder->psRMSEnvelopeGrouping != NULL ) + { + DeleteRMSEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping ); } - - if(psCQMFEncoder->ppiGroupLengths != NULL){ + + if ( psCQMFEncoder->ppiGroupLengths != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - free(psCQMFEncoder->ppiGroupLengths[n]); + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + count_free( psCQMFEncoder->ppiGroupLengths[n] ); } - free(psCQMFEncoder->ppiGroupLengths); + count_free( psCQMFEncoder->ppiGroupLengths ); } - - if(psCQMFEncoder->pppiRMSEnvelope != NULL){ + + if ( psCQMFEncoder->pppiRMSEnvelope != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiRMSEnvelope[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiRMSEnvelope[n][k] ); } - free(psCQMFEncoder->pppiRMSEnvelope[n]); + count_free( psCQMFEncoder->pppiRMSEnvelope[n] ); } - free(psCQMFEncoder->pppiRMSEnvelope); + count_free( psCQMFEncoder->pppiRMSEnvelope ); } - - if(psCQMFEncoder->pppiSMR != NULL){ + + if ( psCQMFEncoder->pppiSMR != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiSMR[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiSMR[n][k] ); } - free(psCQMFEncoder->pppiSMR[n]); + count_free( psCQMFEncoder->pppiSMR[n] ); } - free(psCQMFEncoder->pppiSMR); + count_free( psCQMFEncoder->pppiSMR ); } - - if(psCQMFEncoder->pppiExcitation != NULL){ + + if ( psCQMFEncoder->pppiExcitation != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiExcitation[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiExcitation[n][k] ); } - free(psCQMFEncoder->pppiExcitation[n]); + count_free( psCQMFEncoder->pppiExcitation[n] ); } - free(psCQMFEncoder->pppiExcitation); + count_free( psCQMFEncoder->pppiExcitation ); } - - if(psCQMFEncoder->pppiAlloc != NULL){ + + if ( psCQMFEncoder->pppiAlloc != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiAlloc[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiAlloc[n][k] ); } - free(psCQMFEncoder->pppiAlloc[n]); + count_free( psCQMFEncoder->pppiAlloc[n] ); } - free(psCQMFEncoder->pppiAlloc); + count_free( psCQMFEncoder->pppiAlloc ); } - - if(psCQMFEncoder->pppiCQMFSignReal != NULL){ + + if ( psCQMFEncoder->pppiCQMFSignReal != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiCQMFSignReal[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiCQMFSignReal[n][k] ); } - free(psCQMFEncoder->pppiCQMFSignReal[n]); + count_free( psCQMFEncoder->pppiCQMFSignReal[n] ); } - free(psCQMFEncoder->pppiCQMFSignReal); + count_free( psCQMFEncoder->pppiCQMFSignReal ); } - - if(psCQMFEncoder->pppiCQMFSignImag != NULL){ + + if ( psCQMFEncoder->pppiCQMFSignImag != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiCQMFSignImag[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiCQMFSignImag[n][k] ); } - free(psCQMFEncoder->pppiCQMFSignImag[n]); + count_free( psCQMFEncoder->pppiCQMFSignImag[n] ); } - free(psCQMFEncoder->pppiCQMFSignImag); + count_free( psCQMFEncoder->pppiCQMFSignImag ); } - - if(psCQMFEncoder->pppiQCQMFReal != NULL){ + + if ( psCQMFEncoder->pppiQCQMFReal != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiQCQMFReal[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiQCQMFReal[n][k] ); } - free(psCQMFEncoder->pppiQCQMFReal[n]); + count_free( psCQMFEncoder->pppiQCQMFReal[n] ); } - free(psCQMFEncoder->pppiQCQMFReal); + count_free( psCQMFEncoder->pppiQCQMFReal ); } - - if(psCQMFEncoder->pppiQCQMFImag != NULL){ + + if ( psCQMFEncoder->pppiQCQMFImag != NULL ) + { int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiQCQMFImag[n][k]); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiQCQMFImag[n][k] ); } - free(psCQMFEncoder->pppiQCQMFImag[n]); + count_free( psCQMFEncoder->pppiQCQMFImag[n] ); } - free(psCQMFEncoder->pppiQCQMFImag); + count_free( psCQMFEncoder->pppiQCQMFImag ); } - - DeleteBitstream(psCQMFEncoder->psBSWrite); - - free(psCQMFEncoder); + + DeleteBitstream( psCQMFEncoder->psBSWrite ); + + count_free( psCQMFEncoder ); } } -int CQMFEncoderGetError(CQMFEncoder *psCQMFEncoder) +int CQMFEncoderGetError( CQMFEncoder *psCQMFEncoder ) { return psCQMFEncoder->iLastError; } -static void MSModeCalculation(const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - float ***pppfReal, - float ***pppfImag, - int *piMSMode, - int *piMSFlags); - -static void RemoveRMSEnvelope(const int iNumBands, - const int *piBandwidths, - const int iNumGroups, - const int *piGroupLengths, - const int **ppiRMSEnvelope, - float **ppfReal, - float **ppfImag); - -static void RemoveSign(const int iNumBlocks, - const int iNumCQMFBands, - float **ppfReal, - float **ppfImag, - int **ppiSignReal, - int **ppiSignImag); - -static int CountCQMFBits(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiQReal, - const int **ppiQImag); +static void MSModeCalculation( const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int *piMSMode, + int *piMSFlags ); + +static void RemoveRMSEnvelope( const int iNumBands, + const int *piBandwidths, + const int iNumGroups, + const int *piGroupLengths, + const int **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag ); + +static void RemoveSign( const int iNumBlocks, + const int iNumCQMFBands, + float **ppfReal, + float **ppfImag, + int **ppiSignReal, + int **ppiSignImag ); + +static int CountCQMFBits( const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiQReal, + const int **ppiQImag ); /* Currently only the number of bands in frame */ -static int WriteHeaderInformation(const int iNumBands, - Bitstream *psBSWrite); - -static int WriteMSInformation(const int iNumBands, - const int iMSMode, - const int *piMSFlags, - Bitstream *psBSWrite); - -static int WriteGroupInformation(const int iChannels, - const int iCommonGrouping, - const int *piNumGroups, - const int **ppiGroupLengths, - Bitstream *psBSWrite); - -static int WriteRMSEnvelope(const int iChannels, - const int *piNumGroups, - const int iNumBands, - const int ***pppiRMSEnvelope, - Bitstream *psBSWrite); - -static int WriteAllocInformation(const int iAllocOffset, - Bitstream *psBSWrite); - -static int WriteCQMFData(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiSignReal, - const int **ppiSignImag, - const int **ppiQReal, - const int **ppiQImag, - Bitstream *psBSWrite); - -static int ComputeAllocation(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAvailableBits, - int *piAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag); - -static int ComputeAllocationByPass(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag); - - - -int EncodeFrame(CQMFEncoder *psCQMFEncoder, - float ***pppfCQMFReal, - float ***pppfCQMFImag, - int *piNumiBytes, - unsigned char *puchData) +static int WriteHeaderInformation( const int iNumBands, + Bitstream *psBSWrite ); + +static int WriteMSInformation( const int iNumBands, + const int iMSMode, + const int *piMSFlags, + Bitstream *psBSWrite ); + +static int WriteGroupInformation( const int iChannels, + const int iCommonGrouping, + const int *piNumGroups, + const int **ppiGroupLengths, + Bitstream *psBSWrite ); + +static int WriteRMSEnvelope( const int iChannels, + const int *piNumGroups, + const int iNumBands, + const int ***pppiRMSEnvelope, + Bitstream *psBSWrite ); + +static int WriteAllocInformation( const int iAllocOffset, + Bitstream *psBSWrite ); + +static int WriteCQMFData( const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiSignReal, + const int **ppiSignImag, + const int **ppiQReal, + const int **ppiQImag, + Bitstream *psBSWrite ); + +static int ComputeAllocation( const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAvailableBits, + int *piAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag ); + +static int ComputeAllocationByPass( const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag ); + + +int EncodeFrame( CQMFEncoder *psCQMFEncoder, + float ***pppfCQMFReal, + float ***pppfCQMFImag, + int *piNumiBytes, + unsigned char *puchData ) { int n; int iAvailableBits; int iBitsWritten; int iCQMFBits; - + iAvailableBits = psCQMFEncoder->iTargetBitsPerFrame; // HCBR for now iBitsWritten = 0; - + /* Do MS calc here */ - if(psCQMFEncoder->iChannels == 2){ - MSModeCalculation(psCQMFEncoder->iNumBlocks, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - pppfCQMFReal, - pppfCQMFImag, - &psCQMFEncoder->iMSMode, - psCQMFEncoder->piMSFlags); - - if(psCQMFEncoder->iMSMode > 0){ + if ( psCQMFEncoder->iChannels == 2 ) + { + MSModeCalculation( psCQMFEncoder->iNumBlocks, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + pppfCQMFReal, + pppfCQMFImag, + &psCQMFEncoder->iMSMode, + psCQMFEncoder->piMSFlags ); + + if ( psCQMFEncoder->iMSMode > 0 ) + { psCQMFEncoder->iCommonGrouping = 1; // Make sure common grouping is enabled when MS is in use } } - - + + /* Compute Grouping and RMS Envelopes */ - if(psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1){ - ComputeEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping, - psCQMFEncoder->iChannels, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const float***)pppfCQMFReal, - (const float***)pppfCQMFImag, - 8.0, - 20.0, // Use these to trade off RMS Env bits and quantizer loading - &psCQMFEncoder->piNumGroups[0], - psCQMFEncoder->ppiGroupLengths[0], - psCQMFEncoder->pppiRMSEnvelope); - + if ( psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1 ) + { + ComputeEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const float ***) pppfCQMFReal, + (const float ***) pppfCQMFImag, + 8.0, + 20.0, // Use these to trade off RMS Env bits and quantizer loading + &psCQMFEncoder->piNumGroups[0], + psCQMFEncoder->ppiGroupLengths[0], + psCQMFEncoder->pppiRMSEnvelope ); + psCQMFEncoder->piNumGroups[1] = psCQMFEncoder->piNumGroups[0]; - for(n = 0; n < psCQMFEncoder->piNumGroups[0]; n ++){ + for ( n = 0; n < psCQMFEncoder->piNumGroups[0]; n++ ) + { psCQMFEncoder->ppiGroupLengths[1][n] = psCQMFEncoder->ppiGroupLengths[0][n]; } } - else{ - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - ComputeEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping, - psCQMFEncoder->iChannels, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const float***)&pppfCQMFReal[n], - (const float***)&pppfCQMFImag[n], - 8.0, - 20.0, // Use these to trade off RMS Env bits and quantizer loading - &psCQMFEncoder->piNumGroups[n], - psCQMFEncoder->ppiGroupLengths[n], - &psCQMFEncoder->pppiRMSEnvelope[n]); + else + { + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + ComputeEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const float ***) &pppfCQMFReal[n], + (const float ***) &pppfCQMFImag[n], + 8.0, + 20.0, // Use these to trade off RMS Env bits and quantizer loading + &psCQMFEncoder->piNumGroups[n], + psCQMFEncoder->ppiGroupLengths[n], + &psCQMFEncoder->pppiRMSEnvelope[n] ); } } - - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - RemoveSign(psCQMFEncoder->iNumBlocks, - CQMF_BANDS, - pppfCQMFReal[n], - pppfCQMFImag[n], - psCQMFEncoder->pppiCQMFSignReal[n], - psCQMFEncoder->pppiCQMFSignImag[n]); - - RemoveRMSEnvelope(psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - psCQMFEncoder->piNumGroups[n], - (const int*)psCQMFEncoder->ppiGroupLengths[n], - (const int **)psCQMFEncoder->pppiRMSEnvelope[n], - pppfCQMFReal[n], - pppfCQMFImag[n]); + + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + RemoveSign( psCQMFEncoder->iNumBlocks, + CQMF_BANDS, + pppfCQMFReal[n], + pppfCQMFImag[n], + psCQMFEncoder->pppiCQMFSignReal[n], + psCQMFEncoder->pppiCQMFSignImag[n] ); + + RemoveRMSEnvelope( psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + psCQMFEncoder->piNumGroups[n], + (const int *) psCQMFEncoder->ppiGroupLengths[n], + (const int **) psCQMFEncoder->pppiRMSEnvelope[n], + pppfCQMFReal[n], + pppfCQMFImag[n] ); } - - BSFlushBuffer(psCQMFEncoder->psBSWrite); - iBitsWritten += WriteHeaderInformation(psCQMFEncoder->iNumBands, - psCQMFEncoder->psBSWrite); - - if(psCQMFEncoder->iChannels == 2){ - iBitsWritten += WriteMSInformation(psCQMFEncoder->iNumBands, - psCQMFEncoder->iMSMode, - (const int*)psCQMFEncoder->piMSFlags, - psCQMFEncoder->psBSWrite); + + BSFlushBuffer( psCQMFEncoder->psBSWrite ); + iBitsWritten += WriteHeaderInformation( psCQMFEncoder->iNumBands, + psCQMFEncoder->psBSWrite ); + + if ( psCQMFEncoder->iChannels == 2 ) + { + iBitsWritten += WriteMSInformation( psCQMFEncoder->iNumBands, + psCQMFEncoder->iMSMode, + (const int *) psCQMFEncoder->piMSFlags, + psCQMFEncoder->psBSWrite ); } - - iBitsWritten += WriteGroupInformation(psCQMFEncoder->iChannels, - psCQMFEncoder->iCommonGrouping, - (const int*)psCQMFEncoder->piNumGroups, - (const int**)psCQMFEncoder->ppiGroupLengths, - psCQMFEncoder->psBSWrite); - - iBitsWritten += WriteRMSEnvelope(psCQMFEncoder->iChannels, - (const int*)psCQMFEncoder->piNumGroups, - psCQMFEncoder->iNumBands, - (const int***)psCQMFEncoder->pppiRMSEnvelope, - psCQMFEncoder->psBSWrite); - - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ // This will be updated to support multiple sample rates + + iBitsWritten += WriteGroupInformation( psCQMFEncoder->iChannels, + psCQMFEncoder->iCommonGrouping, + (const int *) psCQMFEncoder->piNumGroups, + (const int **) psCQMFEncoder->ppiGroupLengths, + psCQMFEncoder->psBSWrite ); + + iBitsWritten += WriteRMSEnvelope( psCQMFEncoder->iChannels, + (const int *) psCQMFEncoder->piNumGroups, + psCQMFEncoder->iNumBands, + (const int ***) psCQMFEncoder->pppiRMSEnvelope, + psCQMFEncoder->psBSWrite ); + + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { // This will be updated to support multiple sample rates int k; - for(k = 0; k < psCQMFEncoder->piNumGroups[n]; k ++){ - PerceptualModel(psCQMFEncoder->iNumBands, - psCQMFEncoder->pppiRMSEnvelope[n][k], - psCQMFEncoder->pppiExcitation[n][k], - psCQMFEncoder->pppiSMR[n][k]); - + for ( k = 0; k < psCQMFEncoder->piNumGroups[n]; k++ ) + { + PerceptualModel( psCQMFEncoder->iNumBands, + psCQMFEncoder->pppiRMSEnvelope[n][k], + psCQMFEncoder->pppiExcitation[n][k], + psCQMFEncoder->pppiSMR[n][k] ); } } - + iAvailableBits -= iBitsWritten; - iCQMFBits = ComputeAllocation(psCQMFEncoder->iChannels, - (const int*)psCQMFEncoder->piNumGroups, - (const int**)psCQMFEncoder->ppiGroupLengths, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const float***)pppfCQMFReal, - (const float***)pppfCQMFImag, - (const int***)psCQMFEncoder->pppiSMR, - iAvailableBits, - &psCQMFEncoder->iAllocOffset, - psCQMFEncoder->pppiAlloc, - psCQMFEncoder->pppiQCQMFReal, - psCQMFEncoder->pppiQCQMFImag); - - iBitsWritten += WriteAllocInformation(psCQMFEncoder->iAllocOffset,psCQMFEncoder->psBSWrite); - - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - iBitsWritten += WriteCQMFData(psCQMFEncoder->piNumGroups[n], - (const int*)psCQMFEncoder->ppiGroupLengths[n], - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const int**)psCQMFEncoder->pppiAlloc[n], - (const int**)psCQMFEncoder->pppiCQMFSignReal[n], - (const int**)psCQMFEncoder->pppiCQMFSignImag[n], - (const int**)psCQMFEncoder->pppiQCQMFReal[n], - (const int**)psCQMFEncoder->pppiQCQMFImag[n], - psCQMFEncoder->psBSWrite); + iCQMFBits = ComputeAllocation( psCQMFEncoder->iChannels, + (const int *) psCQMFEncoder->piNumGroups, + (const int **) psCQMFEncoder->ppiGroupLengths, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const float ***) pppfCQMFReal, + (const float ***) pppfCQMFImag, + (const int ***) psCQMFEncoder->pppiSMR, + iAvailableBits, + &psCQMFEncoder->iAllocOffset, + psCQMFEncoder->pppiAlloc, + psCQMFEncoder->pppiQCQMFReal, + psCQMFEncoder->pppiQCQMFImag ); + + iBitsWritten += WriteAllocInformation( psCQMFEncoder->iAllocOffset, psCQMFEncoder->psBSWrite ); + + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + iBitsWritten += WriteCQMFData( psCQMFEncoder->piNumGroups[n], + (const int *) psCQMFEncoder->ppiGroupLengths[n], + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const int **) psCQMFEncoder->pppiAlloc[n], + (const int **) psCQMFEncoder->pppiCQMFSignReal[n], + (const int **) psCQMFEncoder->pppiCQMFSignImag[n], + (const int **) psCQMFEncoder->pppiQCQMFReal[n], + (const int **) psCQMFEncoder->pppiQCQMFImag[n], + psCQMFEncoder->psBSWrite ); } - - BSByteAlign(psCQMFEncoder->psBSWrite); - *piNumiBytes = BSGetByteCount(psCQMFEncoder->psBSWrite); - BSGetBytes(psCQMFEncoder->psBSWrite,puchData,*piNumiBytes); - - //printf("Bits Written %d\n",iBitsWritten); - + + BSByteAlign( psCQMFEncoder->psBSWrite ); + *piNumiBytes = BSGetByteCount( psCQMFEncoder->psBSWrite ); + BSGetBytes( psCQMFEncoder->psBSWrite, puchData, *piNumiBytes ); + + // printf("Bits Written %d\n",iBitsWritten); + return psCQMFEncoder->iLastError; } -static void MSModeCalculation(const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - float ***pppfReal, - float ***pppfImag, - int *piMSMode, - int *piMSFlags) +static void MSModeCalculation( const int iNumBlocks, + const int iNumBands, + const int *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int *piMSMode, + int *piMSFlags ) { int b; int iFBOffset; int iNumMSBands; - + *piMSMode = 0; iFBOffset = 0; iNumMSBands = 0; - for(b = 0; b < iNumBands; b ++){ + for ( b = 0; b < iNumBands; b++ ) + { int n; float fLeftEnergy; float fRightEnergy; @@ -524,163 +569,190 @@ static void MSModeCalculation(const int iNumBlocks, float fSideEnergy; float fLRRatio; float fMSRatio; - + fLeftEnergy = 0.0; fRightEnergy = 0.0; fMidEnergy = 0.0; fSideEnergy = 0.0; - - for(n = 0; n < piBandwidths[b]; n ++){ + + for ( n = 0; n < piBandwidths[b]; n++ ) + { int k; - for(k = 0; k < iNumBlocks; k ++){ + for ( k = 0; k < iNumBlocks; k++ ) + { float fMidReal; float fMidImag; float fSideReal; float fSideImag; - - fMidReal = 0.5f * (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); - fMidImag = 0.5f * (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); - fSideReal = 0.5f * (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); - fSideImag = 0.5f * (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); - - fLeftEnergy += (pppfReal[0][k][iFBOffset] * pppfReal[0][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[0][k][iFBOffset]); - fRightEnergy += (pppfReal[1][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[1][k][iFBOffset] * pppfImag[1][k][iFBOffset]); - fMidEnergy += (fMidReal * fMidReal + fMidImag * fMidImag); - fSideEnergy += (fSideReal * fSideReal + fSideImag * fSideImag); + + fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); + fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); + fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); + fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); + + fLeftEnergy += ( pppfReal[0][k][iFBOffset] * pppfReal[0][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[0][k][iFBOffset] ); + fRightEnergy += ( pppfReal[1][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[1][k][iFBOffset] * pppfImag[1][k][iFBOffset] ); + fMidEnergy += ( fMidReal * fMidReal + fMidImag * fMidImag ); + fSideEnergy += ( fSideReal * fSideReal + fSideImag * fSideImag ); } - - iFBOffset ++; + + iFBOffset++; } - - fLeftEnergy = log10f(fLeftEnergy + 1e-12f); - fRightEnergy = log10f(fRightEnergy + 1e-12f); - fMidEnergy = log10f(fMidEnergy + 1e-12f); - fSideEnergy = log10f(fSideEnergy + 1e-12f); - - if(fLeftEnergy > fRightEnergy){ + + fLeftEnergy = log10f( fLeftEnergy + 1e-12f ); + fRightEnergy = log10f( fRightEnergy + 1e-12f ); + fMidEnergy = log10f( fMidEnergy + 1e-12f ); + fSideEnergy = log10f( fSideEnergy + 1e-12f ); + + if ( fLeftEnergy > fRightEnergy ) + { fLRRatio = fLeftEnergy - fRightEnergy; } - else{ + else + { fLRRatio = fRightEnergy - fLeftEnergy; } - - if(fMidEnergy > fSideEnergy){ + + if ( fMidEnergy > fSideEnergy ) + { fMSRatio = fMidEnergy - fSideEnergy; } - else{ + else + { fMSRatio = fSideEnergy - fMidEnergy; } - - if(fMSRatio > fLRRatio){ - iNumMSBands ++; + + if ( fMSRatio > fLRRatio ) + { + iNumMSBands++; piMSFlags[b] = 1; } - else{ + else + { piMSFlags[b] = 0; } } - - if(iNumMSBands == iNumBands){ + + if ( iNumMSBands == iNumBands ) + { *piMSMode = 1; } - else if(iNumMSBands > 0){ + else if ( iNumMSBands > 0 ) + { *piMSMode = 2; } - else{ + else + { *piMSMode = 0; } - - if(*piMSMode > 0){ + + if ( *piMSMode > 0 ) + { iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - if(piMSFlags[b] == 1){ + for ( b = 0; b < iNumBands; b++ ) + { + if ( piMSFlags[b] == 1 ) + { int n; - for(n = 0; n < piBandwidths[b]; n ++){ + for ( n = 0; n < piBandwidths[b]; n++ ) + { int k; - for(k = 0; k < iNumBlocks; k ++){ + for ( k = 0; k < iNumBlocks; k++ ) + { float fMidReal; float fMidImag; float fSideReal; float fSideImag; - - fMidReal = 0.5f * (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); - fMidImag = 0.5f * (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); - fSideReal = 0.5f * (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); - fSideImag = 0.5f * (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); - + + fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); + fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); + fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); + fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); + pppfReal[0][k][iFBOffset] = fMidReal; pppfReal[1][k][iFBOffset] = fSideReal; pppfImag[0][k][iFBOffset] = fMidImag; pppfImag[1][k][iFBOffset] = fSideImag; } - iFBOffset ++; + iFBOffset++; } } - else{ + else + { iFBOffset += piBandwidths[b]; } } } } -static void RemoveRMSEnvelope(const int iNumBands, - const int *piBandwidths, - const int iNumGroups, - const int *piGroupLengths, - const int **ppiRMSEnvelope, - float **ppfReal, - float **ppfImag) +static void RemoveRMSEnvelope( const int iNumBands, + const int *piBandwidths, + const int iNumGroups, + const int *piGroupLengths, + const int **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag ) { int n; int iBlockOffset; - + iBlockOffset = 0; - for(n = 0; n < iNumGroups; n ++){ + for ( n = 0; n < iNumGroups; n++ ) + { int k; - for(k = 0; k < piGroupLengths[n]; k ++){ + for ( k = 0; k < piGroupLengths[n]; k++ ) + { int b; int iFBOffset; iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iRMSEnv; + for ( b = 0; b < iNumBands; b++ ) + { + int m; + int iRMSEnv; float fGain; - + iRMSEnv = ppiRMSEnvelope[n][b]; fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER - iRMSEnv]; - for(m = 0; m < piBandwidths[b]; m ++){ + for ( m = 0; m < piBandwidths[b]; m++ ) + { ppfReal[iBlockOffset][iFBOffset] *= fGain; ppfImag[iBlockOffset][iFBOffset] *= fGain; - iFBOffset ++; + iFBOffset++; } } - iBlockOffset ++; + iBlockOffset++; } } } -static void RemoveSign(const int iNumBlocks, - const int iNumCQMFBands, - float **ppfReal, - float **ppfImag, - int **ppiSignReal, - int **ppiSignImag) +static void RemoveSign( const int iNumBlocks, + const int iNumCQMFBands, + float **ppfReal, + float **ppfImag, + int **ppiSignReal, + int **ppiSignImag ) { int n; - for(n = 0; n < iNumBlocks; n ++){ + for ( n = 0; n < iNumBlocks; n++ ) + { int b; - for(b = 0; b < iNumCQMFBands; b ++){ - if(ppfReal[n][b] > 0.0){ + for ( b = 0; b < iNumCQMFBands; b++ ) + { + if ( ppfReal[n][b] > 0.0 ) + { ppiSignReal[n][b] = 0; } - else{ + else + { ppfReal[n][b] = -ppfReal[n][b]; ppiSignReal[n][b] = 1; } - if(ppfImag[n][b] > 0.0){ + if ( ppfImag[n][b] > 0.0 ) + { ppiSignImag[n][b] = 0; } - else{ + else + { ppfImag[n][b] = -ppfImag[n][b]; ppiSignImag[n][b] = 1; } @@ -689,538 +761,587 @@ static void RemoveSign(const int iNumBlocks, } /* Rename */ -static void QuantizeSpectrum(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const float **ppfReal, - const float **ppfImag, - int **ppiQReal, - int **ppiQImag) +static void QuantizeCQMFSpectrum( const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const float **ppfReal, + const float **ppfImag, + int **ppiQReal, + int **ppiQImag ) { int n; int iBlockOffest; - + iBlockOffest = 0; - for(n = 0; n < iNumGroups; n ++){ + for ( n = 0; n < iNumGroups; n++ ) + { int k; - for(k = 0; k < piGroupLengths[n]; k ++){ + for ( k = 0; k < piGroupLengths[n]; k++ ) + { int b; int iFBOffset; - + iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iMaxQuantVal; - float fSCFGain; - + for ( b = 0; b < iNumBands; b++ ) + { + int m; + int iAlloc; + int iMaxQuantVal; + float fSCFGain; + iAlloc = ppiAlloc[n][b]; fSCFGain = c_afScaleFactor[iAlloc]; iMaxQuantVal = c_aiQuantMaxValues[iAlloc]; - for(m = 0; m < piBandwidths[b]; m ++){ + for ( m = 0; m < piBandwidths[b]; m++ ) + { int iQuantValue; - - iQuantValue = (int)(fSCFGain * ppfReal[iBlockOffest][iFBOffset] + 0.5); + + iQuantValue = (int) ( fSCFGain * ppfReal[iBlockOffest][iFBOffset] + 0.5 ); #ifdef _DEBUG_VERBOSE - if(iQuantValue > iMaxQuantVal){ - printf("Value out of range %d\t%d\t%d\n",iAlloc,iQuantValue,iMaxQuantVal); + if ( iQuantValue > iMaxQuantVal ) + { + printf( "Value out of range %d\t%d\t%d\n", iAlloc, iQuantValue, iMaxQuantVal ); iQuantValue = iMaxQuantVal; } #else - iQuantValue = (iQuantValue < iMaxQuantVal) ? iQuantValue : iMaxQuantVal; + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; #endif ppiQReal[iBlockOffest][iFBOffset] = iQuantValue; - - iQuantValue = (int)(fSCFGain * ppfImag[iBlockOffest][iFBOffset] + 0.5); + + iQuantValue = (int) ( fSCFGain * ppfImag[iBlockOffest][iFBOffset] + 0.5 ); #ifdef _DEBUG_VERBOSE - if(iQuantValue > iMaxQuantVal){ - printf("Value out of range %d\t%d\t%d\n",iAlloc,iQuantValue,iMaxQuantVal); + if ( iQuantValue > iMaxQuantVal ) + { + printf( "Value out of range %d\t%d\t%d\n", iAlloc, iQuantValue, iMaxQuantVal ); iQuantValue = iMaxQuantVal; } #else - iQuantValue = (iQuantValue < iMaxQuantVal) ? iQuantValue : iMaxQuantVal; + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; #endif ppiQImag[iBlockOffest][iFBOffset] = iQuantValue; - - iFBOffset ++; + + iFBOffset++; } - } - - iBlockOffest ++; + + iBlockOffest++; } } } -static int CountCQMFBits(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiQReal, - const int **ppiQImag) +static int CountCQMFBits( const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiQReal, + const int **ppiQImag ) { int n; int iBits; int iBlockOffest; - + iBits = 0; iBlockOffest = 0; - for(n = 0; n < iNumGroups; n ++){ + for ( n = 0; n < iNumGroups; n++ ) + { int k; - for(k = 0; k < piGroupLengths[n]; k ++){ + for ( k = 0; k < piGroupLengths[n]; k++ ) + { int b; int iFBOffset; - + iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iHuffDim; - int iHuffMod; - + for ( b = 0; b < iNumBands; b++ ) + { + int m; + int iAlloc; + int iHuffDim; + int iHuffMod; + iAlloc = ppiAlloc[n][b]; - + iHuffDim = c_aiHuffmanDim[iAlloc]; iHuffMod = c_aiHuffmanMod[iAlloc]; - - - if(iAlloc > 0){ - const unsigned int (*pauiHuffmanTable)[2] = NULL; //const? - - pauiHuffmanTable = GetHuffEncTable(iAlloc); - for(m = 0; m < piBandwidths[b]; m ++){ + + + if ( iAlloc > 0 ) + { + const unsigned int( *pauiHuffmanTable )[2] = NULL; // const? + + pauiHuffmanTable = GetHuffEncTable( iAlloc ); + for ( m = 0; m < piBandwidths[b]; m++ ) + { int iQuantValue1; int iQuantValue2; - + iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; - - iBits += (iQuantValue1 > 0) ? 1 : 0; //Sign bit for vals > 0 - iBits += (iQuantValue2 > 0) ? 1 : 0; //Sign bit for vals > 0 - if(iHuffDim == 2){ + + iBits += ( iQuantValue1 > 0 ) ? 1 : 0; // Sign bit for vals > 0 + iBits += ( iQuantValue2 > 0 ) ? 1 : 0; // Sign bit for vals > 0 + if ( iHuffDim == 2 ) + { iQuantValue1 *= iHuffMod; iQuantValue1 += iQuantValue2; iBits += pauiHuffmanTable[iQuantValue1][0]; } - else{ + else + { iBits += pauiHuffmanTable[iQuantValue1][0]; iBits += pauiHuffmanTable[iQuantValue2][0]; } - - iFBOffset ++; + + iFBOffset++; } } - else{ + else + { iFBOffset += piBandwidths[b]; } - } - - iBlockOffest ++; + + iBlockOffest++; } } - + return iBits; } /* Currently only the number of bands in frame */ -static int WriteHeaderInformation(const int iNumBands, - Bitstream *psBSWrite) +static int WriteHeaderInformation( const int iNumBands, + Bitstream *psBSWrite ) { int iBitsWritten; - + iBitsWritten = 0; - BSPutBits(psBSWrite,iNumBands,5); + BSPutBits( psBSWrite, iNumBands, 5 ); iBitsWritten += 5; - + return iBitsWritten; } -static int WriteMSInformation(const int iNumBands, - const int iMSMode, - const int *piMSFlags, - Bitstream *psBSWrite) +static int WriteMSInformation( const int iNumBands, + const int iMSMode, + const int *piMSFlags, + Bitstream *psBSWrite ) { int iBitsWritten; - + iBitsWritten = 0; - - BSPutBits(psBSWrite,iMSMode,2); + + BSPutBits( psBSWrite, iMSMode, 2 ); iBitsWritten += 2; - if(iMSMode == 2){ + if ( iMSMode == 2 ) + { int n; - for(n = 0; n < iNumBands; n ++){ - BSPutBits(psBSWrite,piMSFlags[n],1); + for ( n = 0; n < iNumBands; n++ ) + { + BSPutBits( psBSWrite, piMSFlags[n], 1 ); iBitsWritten += 1; } } - + return iBitsWritten; } -static int WriteGroupInformation(const int iChannels, - const int iCommonGrouping, - const int *piNumGroups, - const int **ppiGroupLengths, - Bitstream *psBSWrite) +static int WriteGroupInformation( const int iChannels, + const int iCommonGrouping, + const int *piNumGroups, + const int **ppiGroupLengths, + Bitstream *psBSWrite ) { int iBitsWritten; - + iBitsWritten = 0; - if(iChannels == 2 && iCommonGrouping == 1){ + if ( iChannels == 2 && iCommonGrouping == 1 ) + { int k; - - BSPutBits(psBSWrite,iCommonGrouping,1); + + BSPutBits( psBSWrite, iCommonGrouping, 1 ); iBitsWritten += 1; - - BSPutBits(psBSWrite,(piNumGroups[0] - 1),4); + + BSPutBits( psBSWrite, ( piNumGroups[0] - 1 ), 4 ); iBitsWritten += 4; - - for(k = 0; k < piNumGroups[0]; k ++){ - BSPutBits(psBSWrite,(ppiGroupLengths[0][k] - 1),4); + + for ( k = 0; k < piNumGroups[0]; k++ ) + { + BSPutBits( psBSWrite, ( ppiGroupLengths[0][k] - 1 ), 4 ); iBitsWritten += 4; } } - else if(iChannels == 2){ + else if ( iChannels == 2 ) + { int n; - - BSPutBits(psBSWrite,iCommonGrouping,1); + + BSPutBits( psBSWrite, iCommonGrouping, 1 ); iBitsWritten += 1; - - for(n = 0; n < iChannels; n ++){ + + for ( n = 0; n < iChannels; n++ ) + { int k; - - BSPutBits(psBSWrite,(piNumGroups[n] - 1),4); + + BSPutBits( psBSWrite, ( piNumGroups[n] - 1 ), 4 ); iBitsWritten += 4; - - for(k = 0; k < piNumGroups[n]; k ++){ - BSPutBits(psBSWrite,(ppiGroupLengths[n][k] - 1),4); + + for ( k = 0; k < piNumGroups[n]; k++ ) + { + BSPutBits( psBSWrite, ( ppiGroupLengths[n][k] - 1 ), 4 ); iBitsWritten += 4; } } } - else{ + else + { int n; - - for(n = 0; n < iChannels; n ++){ + + for ( n = 0; n < iChannels; n++ ) + { int k; - - BSPutBits(psBSWrite,(piNumGroups[n] - 1),4); + + BSPutBits( psBSWrite, ( piNumGroups[n] - 1 ), 4 ); iBitsWritten += 4; - - for(k = 0; k < piNumGroups[n]; k ++){ - BSPutBits(psBSWrite,(ppiGroupLengths[n][k] - 1),4); + + for ( k = 0; k < piNumGroups[n]; k++ ) + { + BSPutBits( psBSWrite, ( ppiGroupLengths[n][k] - 1 ), 4 ); iBitsWritten += 4; } } } - + return iBitsWritten; } -static int WriteRMSEnvelope(const int iChannels, - const int *piNumGroups, - const int iNumBands, - const int ***pppiRMSEnvelope, - Bitstream *psBSWrite) +static int WriteRMSEnvelope( const int iChannels, + const int *piNumGroups, + const int iNumBands, + const int ***pppiRMSEnvelope, + Bitstream *psBSWrite ) { int n; int iBitsWritten; - + iBitsWritten = 0; - for(n = 0; n < iChannels; n ++){ + for ( n = 0; n < iChannels; n++ ) + { int k; - for(k = 0; k < piNumGroups[n]; k ++){ + for ( k = 0; k < piNumGroups[n]; k++ ) + { int b; int iLastRMSVal; - + iLastRMSVal = pppiRMSEnvelope[n][k][0]; - iLastRMSVal = (iLastRMSVal > ENV_MIN) ? iLastRMSVal : ENV_MIN; - iLastRMSVal = (iLastRMSVal < ENV_MAX) ? iLastRMSVal : ENV_MAX; - BSPutBits(psBSWrite,(iLastRMSVal - ENV_MIN),ENV0_BITS); + iLastRMSVal = ( iLastRMSVal > ENV_MIN ) ? iLastRMSVal : ENV_MIN; + iLastRMSVal = ( iLastRMSVal < ENV_MAX ) ? iLastRMSVal : ENV_MAX; + BSPutBits( psBSWrite, ( iLastRMSVal - ENV_MIN ), ENV0_BITS ); iBitsWritten += ENV0_BITS; - - for(b = 1; b < iNumBands; b ++){ + + for ( b = 1; b < iNumBands; b++ ) + { int iDelta; - + iDelta = pppiRMSEnvelope[n][k][b] - iLastRMSVal; - iDelta = (iDelta > ENV_DELTA_MIN) ? iDelta : ENV_DELTA_MIN; - iDelta = (iDelta < ENV_DELTA_MAX) ? iDelta : ENV_DELTA_MAX; + iDelta = ( iDelta > ENV_DELTA_MIN ) ? iDelta : ENV_DELTA_MIN; + iDelta = ( iDelta < ENV_DELTA_MAX ) ? iDelta : ENV_DELTA_MAX; iDelta -= ENV_DELTA_MIN; - - BSPutBits(psBSWrite,c_aaiRMSEnvHuffEnc[iDelta][1],c_aaiRMSEnvHuffEnc[iDelta][0]); + + BSPutBits( psBSWrite, c_aaiRMSEnvHuffEnc[iDelta][1], c_aaiRMSEnvHuffEnc[iDelta][0] ); iBitsWritten += c_aaiRMSEnvHuffEnc[iDelta][0]; - + iLastRMSVal = pppiRMSEnvelope[n][k][b]; } } } - + return iBitsWritten; } -static int WriteAllocInformation(const int iAllocOffset, - Bitstream *psBSWrite) +static int WriteAllocInformation( const int iAllocOffset, + Bitstream *psBSWrite ) { int iBitsWritten; - + iBitsWritten = 0; - - if(iAllocOffset < MIN_ALLOC_OFFSET || iAllocOffset > MAX_ALLOC_OFFSET){ - printf("Serious error\n"); + + if ( iAllocOffset < MIN_ALLOC_OFFSET || iAllocOffset > MAX_ALLOC_OFFSET ) + { + printf( "Serious error\n" ); } - - BSPutBits(psBSWrite,(iAllocOffset - MIN_ALLOC_OFFSET),ALLOC_OFFSET_BITS); + + BSPutBits( psBSWrite, ( iAllocOffset - MIN_ALLOC_OFFSET ), ALLOC_OFFSET_BITS ); iBitsWritten += ALLOC_OFFSET_BITS; - + return iBitsWritten; } -static int WriteCQMFData(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiSignReal, - const int **ppiSignImag, - const int **ppiQReal, - const int **ppiQImag, - Bitstream *psBSWrite) +static int WriteCQMFData( const int iNumGroups, + const int *piGroupLengths, + const int iNumBands, + const int *piBandwidths, + const int **ppiAlloc, + const int **ppiSignReal, + const int **ppiSignImag, + const int **ppiQReal, + const int **ppiQImag, + Bitstream *psBSWrite ) { int n; int iBitsWritten; int iBlockOffest; - + iBitsWritten = 0; iBlockOffest = 0; - - for(n = 0; n < iNumGroups; n ++){ + + for ( n = 0; n < iNumGroups; n++ ) + { int k; - for(k = 0; k < piGroupLengths[n]; k ++){ + for ( k = 0; k < piGroupLengths[n]; k++ ) + { int b; int iFBOffset; - + iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iHuffDim; - int iHuffMod; - + for ( b = 0; b < iNumBands; b++ ) + { + int m; + int iAlloc; + int iHuffDim; + int iHuffMod; + iAlloc = ppiAlloc[n][b]; - + iHuffDim = c_aiHuffmanDim[iAlloc]; iHuffMod = c_aiHuffmanMod[iAlloc]; - - - if(iAlloc > 0){ - const unsigned int (*pauiHuffmanTable)[2] = NULL; //const? - - pauiHuffmanTable = GetHuffEncTable(iAlloc); - for(m = 0; m < piBandwidths[b]; m ++){ + + + if ( iAlloc > 0 ) + { + const unsigned int( *pauiHuffmanTable )[2] = NULL; // const? + + pauiHuffmanTable = GetHuffEncTable( iAlloc ); + for ( m = 0; m < piBandwidths[b]; m++ ) + { int iQuantValue1; int iQuantValue2; - + iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; - - - if(iHuffDim == 2){ + + + if ( iHuffDim == 2 ) + { int iSymbol; iSymbol = iQuantValue1; iSymbol *= iHuffMod; iSymbol += iQuantValue2; - BSPutBits(psBSWrite, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0]); + BSPutBits( psBSWrite, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0] ); iBitsWritten += pauiHuffmanTable[iSymbol][0]; } - else{ - BSPutBits(psBSWrite, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0]); + else + { + BSPutBits( psBSWrite, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0] ); iBitsWritten += pauiHuffmanTable[iQuantValue1][0]; - BSPutBits(psBSWrite, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0]); + BSPutBits( psBSWrite, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0] ); iBitsWritten += pauiHuffmanTable[iQuantValue2][0]; } - - if(iQuantValue1 > 0){ - BSPutBits(psBSWrite,ppiSignReal[iBlockOffest][iFBOffset],1); + + if ( iQuantValue1 > 0 ) + { + BSPutBits( psBSWrite, ppiSignReal[iBlockOffest][iFBOffset], 1 ); iBitsWritten += 1; } - if(iQuantValue2 > 0){ - BSPutBits(psBSWrite,ppiSignImag[iBlockOffest][iFBOffset],1); + if ( iQuantValue2 > 0 ) + { + BSPutBits( psBSWrite, ppiSignImag[iBlockOffest][iFBOffset], 1 ); iBitsWritten += 1; } - - iFBOffset ++; + + iFBOffset++; } } - else{ + else + { iFBOffset += piBandwidths[b]; } - } - - iBlockOffest ++; + + iBlockOffest++; } } - + return iBitsWritten; } -static int ComputeAllocation(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAvailableBits, - int *piAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag) +static int ComputeAllocation( const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAvailableBits, + int *piAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag ) { int iBitsUsed; int iDone; int iDelta; - + iBitsUsed = ALLOC_OFFSET_BITS; // Bits used for Alloc Offset - + iDone = 0; iDelta = -MIN_ALLOC_OFFSET; *piAllocOffset = 0; - while(iDone == 0){ + while ( iDone == 0 ) + { int n; int iLimitAllocOffset; iBitsUsed = ALLOC_OFFSET_BITS; - + iLimitAllocOffset = *piAllocOffset; - iLimitAllocOffset = (iLimitAllocOffset > MIN_ALLOC_OFFSET) ? iLimitAllocOffset : MIN_ALLOC_OFFSET; - iLimitAllocOffset = (iLimitAllocOffset < MAX_ALLOC_OFFSET) ? iLimitAllocOffset : MAX_ALLOC_OFFSET; - - for(n = 0; n < iChannels; n ++){ + iLimitAllocOffset = ( iLimitAllocOffset > MIN_ALLOC_OFFSET ) ? iLimitAllocOffset : MIN_ALLOC_OFFSET; + iLimitAllocOffset = ( iLimitAllocOffset < MAX_ALLOC_OFFSET ) ? iLimitAllocOffset : MAX_ALLOC_OFFSET; + + for ( n = 0; n < iChannels; n++ ) + { int k; - for(k = 0; k < piNumGroups[n]; k ++){ + for ( k = 0; k < piNumGroups[n]; k++ ) + { int b; - for(b = 0; b < iNumBands; b ++){ + for ( b = 0; b < iNumBands; b++ ) + { int iAlloc; - iAlloc = ((pppiSMR[n][k][b] + iLimitAllocOffset * ALLOC_OFFSET_SCALE) >> 5); - iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; - iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; + iAlloc = ( ( pppiSMR[n][k][b] + iLimitAllocOffset * ALLOC_OFFSET_SCALE ) >> 5 ); + iAlloc = ( iAlloc > MIN_ALLOC ) ? iAlloc : MIN_ALLOC; + iAlloc = ( iAlloc < MAX_ALLOC ) ? iAlloc : MAX_ALLOC; pppiAlloc[n][k][b] = iAlloc; } } - - QuantizeSpectrum(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const float**)pppfReal[n], - (const float**)pppfImag[n], - pppiQReal[n], - pppiQImag[n]); - - iBitsUsed += CountCQMFBits(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const int**)pppiQReal[n], - (const int**)pppiQImag[n]); + + QuantizeCQMFSpectrum( piNumGroups[n], + (const int *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int **) pppiAlloc[n], + (const float **) pppfReal[n], + (const float **) pppfImag[n], + pppiQReal[n], + pppiQImag[n] ); + + iBitsUsed += CountCQMFBits( piNumGroups[n], + (const int *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int **) pppiAlloc[n], + (const int **) pppiQReal[n], + (const int **) pppiQImag[n] ); } - - if(*piAllocOffset <= MIN_ALLOC_OFFSET && iBitsUsed > iAvailableBits){ + + if ( *piAllocOffset <= MIN_ALLOC_OFFSET && iBitsUsed > iAvailableBits ) + { #ifdef DEBUG_VERBOSE - printf("Frame can not be coded with the number of bits available\n"); + printf( "Frame can not be coded with the number of bits available\n" ); #endif - //iLastError = ENC_ERROR_STREAM_FAILURE; + // iLastError = ENC_ERROR_STREAM_FAILURE; return -1; } - else if(*piAllocOffset >= MAX_ALLOC_OFFSET && iBitsUsed < iAvailableBits){ + else if ( *piAllocOffset >= MAX_ALLOC_OFFSET && iBitsUsed < iAvailableBits ) + { *piAllocOffset = MAX_ALLOC_OFFSET; - iDone ++; + iDone++; } - else{ - if(iDelta == 0 && iBitsUsed > iAvailableBits){ + else + { + if ( iDelta == 0 && iBitsUsed > iAvailableBits ) + { iDelta = 1; } - else if(iDelta == 0 && iBitsUsed < iAvailableBits){ - iDone ++; + else if ( iDelta == 0 && iBitsUsed < iAvailableBits ) + { + iDone++; } - else if(iBitsUsed == iAvailableBits){ - iDone ++; + else if ( iBitsUsed == iAvailableBits ) + { + iDone++; } - - if(iBitsUsed > iAvailableBits){ + + if ( iBitsUsed > iAvailableBits ) + { *piAllocOffset -= iDelta; iDelta >>= 1; } - else if(iBitsUsed < iAvailableBits){ + else if ( iBitsUsed < iAvailableBits ) + { *piAllocOffset += iDelta; iDelta >>= 1; } } - } - - //printf("%d\t%d\t%d\t%d\n",*piAllocOffset,iAvailableBits,iBitsUsed,iAvailableBits - iBitsUsed); - + + // printf("%d\t%d\t%d\t%d\n",*piAllocOffset,iAvailableBits,iBitsUsed,iAvailableBits - iBitsUsed); + return iBitsUsed; } -static int ComputeAllocationByPass(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag) +static int ComputeAllocationByPass( const int iChannels, + const int *piNumGroups, + const int **ppiGroupLengths, + const int iNumBands, + const int *piBandwidths, + const float ***pppfReal, + const float ***pppfImag, + const int ***pppiSMR, + const int iAllocOffset, + int ***pppiAlloc, + int ***pppiQReal, + int ***pppiQImag ) { int n; int iBitsUsed; - + iBitsUsed = ALLOC_OFFSET_BITS; - - for(n = 0; n < iChannels; n ++){ + + for ( n = 0; n < iChannels; n++ ) + { int k; - for(k = 0; k < piNumGroups[n]; k ++){ + for ( k = 0; k < piNumGroups[n]; k++ ) + { int b; - for(b = 0; b < iNumBands; b ++){ + for ( b = 0; b < iNumBands; b++ ) + { int iAlloc; - iAlloc = ((pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE) >> 5); - iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; - iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; + iAlloc = ( ( pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE ) >> 5 ); + iAlloc = ( iAlloc > MIN_ALLOC ) ? iAlloc : MIN_ALLOC; + iAlloc = ( iAlloc < MAX_ALLOC ) ? iAlloc : MAX_ALLOC; pppiAlloc[n][k][b] = iAlloc; } } - - QuantizeSpectrum(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const float**)pppfReal[n], - (const float**)pppfImag[n], - pppiQReal[n], - pppiQImag[n]); - - iBitsUsed += CountCQMFBits(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const int**)pppiQReal[n], - (const int**)pppiQImag[n]); + + QuantizeCQMFSpectrum( piNumGroups[n], + (const int *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int **) pppiAlloc[n], + (const float **) pppfReal[n], + (const float **) pppfImag[n], + pppiQReal[n], + pppiQImag[n] ); + + iBitsUsed += CountCQMFBits( piNumGroups[n], + (const int *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int **) pppiAlloc[n], + (const int **) pppiQReal[n], + (const int **) pppiQImag[n] ); } - + return iBitsUsed; } diff --git a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c index e2f7ea62b1..03316c92f3 100644 --- a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c +++ b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c @@ -2,6 +2,8 @@ #include #include #include +#include "options.h" +#include "prot.h" #include "wmops.h" NoiseGen* CreateNoiseGen() @@ -10,12 +12,12 @@ NoiseGen* CreateNoiseGen() NoiseGen *psNoiseGen = NULL; - psNoiseGen = (NoiseGen*)malloc(sizeof(NoiseGen)); + psNoiseGen = (NoiseGen*)count_malloc(sizeof(NoiseGen)); psNoiseGen->iNoiseBufferLength = 2048; psNoiseGen->iNoiseBufferMask = 2047; psNoiseGen->iNoiseBufferIndex = 0; - psNoiseGen->pfNoiseBuffer = (float*)malloc(psNoiseGen->iNoiseBufferLength * sizeof(float)); + psNoiseGen->pfNoiseBuffer = (float*)count_malloc(psNoiseGen->iNoiseBufferLength * sizeof(float)); /* Generate Laplacian distributed noise */ for(n = 0; n < psNoiseGen->iNoiseBufferLength; n ++){ @@ -38,8 +40,8 @@ NoiseGen* CreateNoiseGen() void DeleteNoiseGen(NoiseGen *psNoiseGen) { - free(psNoiseGen->pfNoiseBuffer); - free(psNoiseGen); + count_free(psNoiseGen->pfNoiseBuffer); + count_free(psNoiseGen); } extern float GetNoise(NoiseGen *psNoiseGen); diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c index f51051d52d..68cf306c64 100644 --- a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c +++ b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c @@ -6,6 +6,8 @@ #include #include #include +#include "options.h" +#include "prot.h" #include "wmops.h" #include "Tables.h" @@ -29,26 +31,26 @@ typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping* CreateRMSEnvelopeGrouping(int iNumBlocks) { int n; - assert((iNumBlocks & 0x1) == 0); // remove this + //assert((iNumBlocks & 0x1) == 0); // remove this RMSEnvelopeGrouping *psRMSEnvelopeGrouping; - psRMSEnvelopeGrouping = (RMSEnvelopeGrouping*)malloc(sizeof(RMSEnvelopeGrouping)); + psRMSEnvelopeGrouping = (RMSEnvelopeGrouping*)count_malloc(sizeof(RMSEnvelopeGrouping)); psRMSEnvelopeGrouping->iNumBlocks = iNumBlocks; psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks >> 1; // Change this - psRMSEnvelopeGrouping->ppfBandEnergy = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); - psRMSEnvelopeGrouping->ppfBandEnergydB = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); - psRMSEnvelopeGrouping->ppfWeight = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); + psRMSEnvelopeGrouping->ppfBandEnergy = (float**)count_malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); + psRMSEnvelopeGrouping->ppfBandEnergydB = (float**)count_malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); + psRMSEnvelopeGrouping->ppfWeight = (float**)count_malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - psRMSEnvelopeGrouping->ppfBandEnergy[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); /* 2 for stereo joint group calc */ - psRMSEnvelopeGrouping->ppfBandEnergydB[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); - psRMSEnvelopeGrouping->ppfWeight[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); + psRMSEnvelopeGrouping->ppfBandEnergy[n] = (float*)count_malloc(MAX_BANDS * 2 * sizeof(float)); /* 2 for stereo joint group calc */ + psRMSEnvelopeGrouping->ppfBandEnergydB[n] = (float*)count_malloc(MAX_BANDS * 2 * sizeof(float)); + psRMSEnvelopeGrouping->ppfWeight[n] = (float*)count_malloc(MAX_BANDS * 2 * sizeof(float)); } - psRMSEnvelopeGrouping->psGMNodes = (GMNode*)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(GMNode)); + psRMSEnvelopeGrouping->psGMNodes = (GMNode*)count_malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(GMNode)); for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); + psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB = (float*)count_malloc(MAX_BANDS * 2 * sizeof(float)); } return psRMSEnvelopeGrouping; @@ -59,20 +61,20 @@ void DeleteRMSEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping) int n; for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - free(psRMSEnvelopeGrouping->ppfBandEnergy[n]); - free(psRMSEnvelopeGrouping->ppfBandEnergydB[n]); - free(psRMSEnvelopeGrouping->ppfWeight[n]); + count_free(psRMSEnvelopeGrouping->ppfBandEnergy[n]); + count_free(psRMSEnvelopeGrouping->ppfBandEnergydB[n]); + count_free(psRMSEnvelopeGrouping->ppfWeight[n]); } - free(psRMSEnvelopeGrouping->ppfBandEnergy); - free(psRMSEnvelopeGrouping->ppfBandEnergydB); - free(psRMSEnvelopeGrouping->ppfWeight); + count_free(psRMSEnvelopeGrouping->ppfBandEnergy); + count_free(psRMSEnvelopeGrouping->ppfBandEnergydB); + count_free(psRMSEnvelopeGrouping->ppfWeight); for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - free(psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB); + count_free(psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB); } - free(psRMSEnvelopeGrouping->psGMNodes); + count_free(psRMSEnvelopeGrouping->psGMNodes); - free(psRMSEnvelopeGrouping); + count_free(psRMSEnvelopeGrouping); } diff --git a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c index 4317e0ec12..afd7ba3cd4 100644 --- a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c +++ b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c @@ -2,6 +2,8 @@ #include #include +#include "options.h" +#include "prot.h" #include "wmops.h" #define MAX_BUFFER 1024 @@ -22,7 +24,7 @@ Bitstream* CreateBitstream(const int iDirection, int n; Bitstream *psBitstream; - psBitstream = (Bitstream*)malloc(sizeof(Bitstream)); + psBitstream = (Bitstream*)count_malloc(sizeof(Bitstream)); psBitstream->iDirection =iDirection; psBitstream->iMaxBuffer = iMaxBuffer; @@ -35,7 +37,7 @@ Bitstream* CreateBitstream(const int iDirection, psBitstream->iMaxBuffer = MAX_BUFFER; } - psBitstream->puchBuffer = (unsigned char*)malloc(sizeof(unsigned char) * psBitstream->iMaxBuffer); + psBitstream->puchBuffer = (unsigned char*)count_malloc(sizeof(unsigned char) * psBitstream->iMaxBuffer); for(n = 0; n < psBitstream->iMaxBuffer; n ++){ psBitstream->puchBuffer[n] = 0; @@ -46,8 +48,8 @@ Bitstream* CreateBitstream(const int iDirection, void DeleteBitstream(Bitstream *psBitstream) { - free(psBitstream->puchBuffer); - free(psBitstream); + count_free(psBitstream->puchBuffer); + count_free(psBitstream); } void BSFlushBuffer(Bitstream *psBitstream) diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index f89564fffc..0087c1dde3 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -67,12 +67,12 @@ ivas_error ivas_splitBinLCLDDecOpen( splitBinLCLDDec->iChannels = iChannels; splitBinLCLDDec->psCQMFDecoder = CreateCQMFDecoder( iSampleRate, iChannels ); - splitBinLCLDDec->pppfDecCQMFReal = (float ***) malloc( iChannels * sizeof( float ** ) ); - splitBinLCLDDec->pppfDecCQMFImag = (float ***) malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDDec->pppfDecCQMFReal = (float ***) count_malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDDec->pppfDecCQMFImag = (float ***) count_malloc( iChannels * sizeof( float ** ) ); for ( int32_t n = 0; n < splitBinLCLDDec->iChannels; n++ ) { - splitBinLCLDDec->pppfDecCQMFReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); - splitBinLCLDDec->pppfDecCQMFImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDDec->pppfDecCQMFReal[n] = (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDDec->pppfDecCQMFImag[n] = (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); } #ifdef CLDFB_DEBUG @@ -104,11 +104,11 @@ void ivas_splitBinLCLDDecClose( for ( int32_t n = 0; n < ( *hSplitBinLCLDDec )->iChannels; n++ ) { - free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal[n] ); - free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag[n] ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal[n] ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag[n] ); } - free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal ); - free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag ); #ifdef CLDFB_DEBUG if ( ( *hSplitBinLCLDDec )->cldfbOut != NULL ) diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index 97da222528..0dbd00733a 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -68,12 +68,12 @@ ivas_error ivas_splitBinLCLDEncOpen( splitBinLCLDEnc->iChannels = iChannels; splitBinLCLDEnc->psCQMFEncoder = CreateCQMFEncoder( iSampleRate, iChannels, iDataRate ); - splitBinLCLDEnc->pppfCQMFReal = (float ***) malloc( iChannels * sizeof( float ** ) ); - splitBinLCLDEnc->pppfCQMFImag = (float ***) malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDEnc->pppfCQMFReal = (float ***) count_malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDEnc->pppfCQMFImag = (float ***) count_malloc( iChannels * sizeof( float ** ) ); for ( int32_t n = 0; n < splitBinLCLDEnc->iChannels; n++ ) { - splitBinLCLDEnc->pppfCQMFReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); - splitBinLCLDEnc->pppfCQMFImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDEnc->pppfCQMFReal[n] = (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDEnc->pppfCQMFImag[n] = (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); } #ifdef CLDFB_DEBUG @@ -102,11 +102,11 @@ void ivas_splitBinLCLDEncClose( for ( int32_t n = 0; n < ( *hSplitBinLCLDEnc )->iChannels; n++ ) { - free( ( *hSplitBinLCLDEnc )->pppfCQMFReal[n] ); - free( ( *hSplitBinLCLDEnc )->pppfCQMFImag[n] ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFReal[n] ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFImag[n] ); } - free( ( *hSplitBinLCLDEnc )->pppfCQMFReal ); - free( ( *hSplitBinLCLDEnc )->pppfCQMFImag ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFReal ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFImag ); #ifdef CLDFB_DEBUG if ( ( *hSplitBinLCLDEnc )->cldfbIn != NULL ) -- GitLab From 90fc193be972d0d82208b81f8533b64f9dead81a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 23 Jan 2023 12:09:39 +0100 Subject: [PATCH 014/591] initial branch --- lib_dec/ivas_masa_dec.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 986829a015..0eec565504 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1798,6 +1798,8 @@ static void read_ism_ratio_index( } } } + + return; } static void decode_ism_ratios( @@ -1835,6 +1837,7 @@ static void decode_ism_ratios( { reconstruct_ism_ratios( ratio_ism_idx[band], n_ism, 1.0f / (float) ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ), ratio_ism[sf][band] ); } + if ( nbands == 1 ) { for ( band = 1; band < 5; band++ ) @@ -1843,6 +1846,7 @@ static void decode_ism_ratios( } } } + if ( numSf == 1 ) { for ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) @@ -1853,6 +1857,8 @@ static void decode_ism_ratios( } } } + + return; } static int16_t ivas_decode_masaism_metadata( @@ -1969,6 +1975,13 @@ static int16_t ivas_decode_masaism_metadata( return ( nb_bits_read - *next_bit_pos ); } + +/*-------------------------------------------------------------------* + * ivas_masa_ism_set_edited_objects() + * + * + *-------------------------------------------------------------------*/ + void ivas_masa_ism_set_edited_objects( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -2012,6 +2025,8 @@ void ivas_masa_ism_set_edited_objects( } } } + + return; } -- GitLab From 4cef93cda89c12301f5774db0e48a9674005c468 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 23 Jan 2023 12:12:24 +0100 Subject: [PATCH 015/591] add returns --- lib_enc/ivas_masa_enc.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 4d70e7688f..0dbecbcb83 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2171,6 +2171,7 @@ static void transform_index_and_GR_encode( return; } + static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, @@ -2579,6 +2580,7 @@ static void ivas_encode_masaism_metadata( { bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - priority[obj] ) * 7 ); } + /* this is only the first version */ /* quantize directions */ for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) @@ -2586,14 +2588,23 @@ static void ivas_encode_masaism_metadata( idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); } + + return; } -void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], - float data_in_f2[][L_FRAME48k], - float data_out_f[][L_FRAME48k], - const int16_t input_frame, - const int16_t num_transport_channels ) +/*-------------------------------------------------------------------* + * ivas_merge_masa_transports() + * + * Merge MASA transport channels + *-------------------------------------------------------------------*/ + +void ivas_merge_masa_transports( + float data_in_f1[][L_FRAME48k], + float data_in_f2[][L_FRAME48k], + float data_out_f[][L_FRAME48k], + const int16_t input_frame, + const int16_t num_transport_channels ) { int16_t i, j; @@ -2604,5 +2615,7 @@ void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; } } + + return; } #endif -- GitLab From 902f4b4735514b7ab8e016986fc5bef1694981e8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 23 Jan 2023 16:39:04 +0100 Subject: [PATCH 016/591] Transfer defines: - #define MASA_AND_OBJECTS_VE // VA: improve codec print-outs - #define OMASA_BRATE /* VA: combined format bit-budget distribution */ - #define OMASA_BRATE_FIX - #define DEBUG_VA --- Workspace_msvc/lib_dec.vcxproj | 1 + Workspace_msvc/lib_dec.vcxproj.filters | 3 + lib_com/bitstream.c | 34 +++ lib_com/ivas_cnst.h | 5 +- lib_com/ivas_ism_config.c | 182 ++++++++++++++- lib_com/ivas_prot.h | 124 +++++++--- lib_com/ivas_rom_com.c | 29 ++- lib_com/ivas_stat_com.h | 5 + lib_com/options.h | 6 + lib_dec/ivas_cpe_dec.c | 46 +++- lib_dec/ivas_dec.c | 25 ++- lib_dec/ivas_init_dec.c | 11 +- lib_dec/ivas_ism_metadata_dec.c | 55 ++++- lib_dec/ivas_masa_dec.c | 43 ++++ lib_dec/ivas_omasa_dec.c | 106 +++++++++ lib_dec/ivas_sce_dec.c | 11 +- lib_dec/ivas_stat_dec.h | 6 +- lib_dec/lib_dec.c | 11 + lib_enc/ivas_cpe_enc.c | 32 +++ lib_enc/ivas_enc.c | 102 ++++++++- lib_enc/ivas_init_enc.c | 12 +- lib_enc/ivas_ism_enc.c | 28 ++- lib_enc/ivas_ism_metadata_enc.c | 300 ++++++++++++++++++++----- lib_enc/ivas_masa_enc.c | 50 ++++- lib_enc/ivas_omasa_enc.c | 32 +++ lib_enc/ivas_sce_enc.c | 22 +- lib_enc/ivas_stat_enc.h | 10 +- lib_enc/ivas_stereo_mdct_core_enc.c | 4 + lib_enc/lib_enc.c | 7 +- 29 files changed, 1159 insertions(+), 143 deletions(-) create mode 100644 lib_dec/ivas_omasa_dec.c diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 34b63eba78..a89d964e86 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -290,6 +290,7 @@ + diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters index 4dcff8d503..4effb44669 100644 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -503,6 +503,9 @@ dec_ivas_c + + dec_ivas_c + diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index e9d9cd13c5..b90c6d4ac7 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1812,6 +1812,12 @@ ivas_error preview_indices( else { st_ivas->ivas_format = MASA_FORMAT; +#ifdef MASA_AND_OBJECTS_VE + if ( bit_stream[3] ) + { + st_ivas->ivas_format = MASA_ISM_FORMAT; + } +#endif } break; } @@ -1968,6 +1974,34 @@ ivas_error preview_indices( ivas_sba_config( 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 ) ); } +#ifdef MASA_AND_OBJECTS_VE + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + /* read number of objects from the bitstream */ + st_ivas->nchan_transport = 0; + + if ( total_brate != SID_2k40 && total_brate != FRAME_NO_DATA ) + { + st_ivas->ism_mode = ivas_omasa_ism_mode_select( total_brate, st_ivas->nchan_ism ); + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + st_ivas->nchan_transport = 0; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + st_ivas->nchan_transport = 2 * st_ivas->bit_stream[total_brate / FRAMES_PER_SEC - 2] + st_ivas->bit_stream[total_brate / FRAMES_PER_SEC - 3] + 1; + } + + k = (int16_t) ( ( total_brate / FRAMES_PER_SEC ) - 1 ); + + { + st_ivas->nchan_transport++; + k--; + } + } + } +#endif } st_ivas->hDecoderConfig->ivas_total_brate = total_brate; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index fd1f3f10a4..3e36ec27db 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -300,7 +300,7 @@ typedef enum /*----------------------------------------------------------------------------------* - * ISm Constants + * ISM Constants *----------------------------------------------------------------------------------*/ #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ @@ -308,6 +308,9 @@ typedef enum #define ISM_METADATA_VAD_FLAG_BITS 1 #define ISM_METADATA_FLAG_BITS 2 +#ifdef OMASA_BRATE +#define ISM_INACTIVE_IMP 0 /* == ISM_NO_META */ +#endif #define ISM_NO_META 0 #define ISM_LOW_IMP 1 #define ISM_MEDIUM_IMP 2 diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 7a9dedfc9f..b5d12c0da2 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -63,7 +63,11 @@ * Convert bit-budget to bitrate *-------------------------------------------------------------------*/ +#ifdef OMASA_BRATE +void bitbudget_to_brate( +#else static void bitbudget_to_brate( +#endif const int16_t x[], /* i : bitbudgets */ int32_t y[], /* o : bitrates */ const int16_t N /* i : number of entries to be converted */ @@ -98,7 +102,7 @@ ivas_error ivas_ism_config( int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ #ifdef MASA_AND_OBJECTS , - int16_t masa_ism_flag /* i : flag indicating ISM MASA format */ + const int16_t combined_format_flag /* i : flag indicating combined format */ #endif ) { @@ -114,7 +118,7 @@ ivas_error ivas_ism_config( error = IVAS_ERR_OK; #ifdef MASA_AND_OBJECTS - if ( masa_ism_flag == 1 ) + if ( combined_format_flag == 1 ) { n_ISms = num_obj; } @@ -137,6 +141,40 @@ ivas_error ivas_ism_config( } } +#ifdef OMASA_BRATE + /* decision about bitrates per channel */ + if ( combined_format_flag ) + { + /* combined format: decision about bitrates per channel - variable during the session (at one ivas_total_brate) */ + bits_ism = (int16_t) ( ism_total_brate / FRMS_PER_SECOND ); + set_s( bits_element, bits_ism / n_ISms, n_ISms ); + bits_element[n_ISms - 1] += bits_ism % n_ISms; + + /* ISM common signaling bits are counted in MASA MD bit-budget */ + } + else + { + /* ISM format: decision about bitrates per channel - constant during the session (at one ivas_total_brate) */ + bits_ism = (int16_t) ( ism_total_brate / FRMS_PER_SECOND ); + set_s( bits_element, bits_ism / n_ISms, n_ISms ); + bits_element[n_ISms - 1] += bits_ism % n_ISms; + bitbudget_to_brate( bits_element, element_brate, n_ISms ); + + /* count ISm common signaling bits */ + if ( hIsmMeta != NULL ) + { + nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; + + for ( ch = 0; ch < n_ISms; ch++ ) + { + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) + { + nb_bits_metadata[0] += ISM_METADATA_VAD_FLAG_BITS; + } + } + } + } +#else /* decision about bitrates per channel - constant during the session (at one ivas_total_brate) */ bits_ism = (int16_t) ( ism_total_brate / FRMS_PER_SECOND ); set_s( bits_element, bits_ism / n_ISms, n_ISms ); @@ -148,7 +186,7 @@ ivas_error ivas_ism_config( { #ifdef MASA_AND_OBJECTS nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS; - if ( masa_ism_flag == 0 ) + if ( combined_format_flag == 0 ) { /* the bits for writing the number of objects are counted here for pure ISM modes */ nb_bits_metadata[0] += num_obj; @@ -165,6 +203,7 @@ ivas_error ivas_ism_config( } } } +#endif /* split metadata bitbudget equally between channels */ if ( nb_bits_metadata != NULL ) @@ -322,6 +361,31 @@ ivas_error ivas_ism_config( } } +#ifdef OMASA_BRATE + if ( combined_format_flag == 1 ) + { + if ( diff > 0 ) + { + for ( ch = 0; ch < n_ISms; ch++ ) + { + if ( ism_imp[ch] <= ISM_MEDIUM_IMP ) + { + if ( diff > limit_high ) + { + diff += bits_CoreCoder[ch] - limit_high; + bits_CoreCoder[ch] = limit_high; + } + else + { + bits_CoreCoder[ch] += diff; + break; + } + } + } + } + } +#endif + bitbudget_to_brate( bits_CoreCoder, total_brate, n_ISms ); } @@ -330,7 +394,11 @@ ivas_error ivas_ism_config( { int32_t tmpL; tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND; +#ifdef OMASA_BRATE + if ( ism_total_brate != tmpL ) +#else if ( sum_l( element_brate, n_ISms ) != tmpL ) +#endif { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISm bit-budget distribution. Exiting!\n" ); } @@ -603,4 +671,112 @@ ISM_MODE ivas_omasa_ism_mode_select( return ism_mode; } + + +#ifdef OMASA_BRATE +/*--------------------------------------------------------------- + * ivas_interformat_brate() + * + * Bit-budget distribution in case of combined-format coding + * ---------------------------------------------------------------*/ + +#define GAMMA_ISM_LOW_IMP 0.8f +#define GAMMA_ISM_MEDIUM_IMP 1.2f +#define GAMMA_ISM_HIGH_IMP 1.4f + +/*! r: adjusted bitrate */ +int32_t ivas_interformat_brate( + const int32_t element_brate, /* i : element bitrate */ + const int16_t ism_imp /* i : ISM importance flag */ +) +{ + int32_t element_brate_out; + int16_t nBits, limit_low, limit_high; + + nBits = (int16_t) ( element_brate / FRAMES_PER_SEC ); + + if ( ism_imp == ISM_INACTIVE_IMP ) + { + nBits = BITS_ISM_INACTIVE; + } + else if ( ism_imp == ISM_LOW_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP ); + } + else if ( ism_imp == ISM_MEDIUM_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP ); + } + else /* ISM_HIGH_IMP */ + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP ); + } + + limit_low = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC; + if ( ism_imp == ISM_INACTIVE_IMP ) + { + limit_low = BITS_ISM_INACTIVE; + } + else if ( element_brate >= SCE_CORE_16k_LOW_LIMIT ) + { + limit_low = SCE_CORE_16k_LOW_LIMIT / FRAMES_PER_SEC; + } + + limit_high = IVAS_512k / FRAMES_PER_SEC; + if ( element_brate < SCE_CORE_16k_LOW_LIMIT ) + { + limit_high = ACELP_12k8_HIGH_LIMIT / FRMS_PER_SECOND; + } + + nBits = check_bounds_s( nBits, limit_low, limit_high ); + + element_brate_out = nBits * FRAMES_PER_SEC; + + return element_brate_out; +} +#endif + + +#ifdef OMASA_BRATE_FIX +/*--------------------------------------------------------------- + * ivas_combined_format_brate_sanity() + * + * + * ---------------------------------------------------------------*/ + +void ivas_combined_format_brate_sanity( + const int32_t element_brate, /* i : element bitrate */ + const int32_t brate_surplus, /* i : surplus bitrate */ + int16_t nb_bits_metadata[], /* i/o: number of metadata bits */ + const int16_t nchan_ism, /* i : number of objects */ + int16_t *diff_nBits /* o : number of differential bits */ +) +{ + /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by + low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget + for core-coding @12.8 kHz is too high => increase the ISM low-rate mode bit-rate */ + + int16_t nBits_CPE; + nBits_CPE = (int16_t) ( element_brate / FRAMES_PER_SEC ); + nBits_CPE -= nb_bits_metadata[0]; + nBits_CPE += (int16_t) ( brate_surplus / FRAMES_PER_SEC ); + nBits_CPE -= ( WB_TBE_0k35 / FRAMES_PER_SEC ); + nBits_CPE -= nb_bits_metadata[1]; + nBits_CPE -= 14; + + *diff_nBits = 0; + if ( nchan_ism == 1 && element_brate < ACELP_12k8_HIGH_LIMIT ) + { + int16_t limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; + + *diff_nBits = nBits_CPE - limit_high; + if ( *diff_nBits > 0 ) + { + nb_bits_metadata[0] += *diff_nBits; + } + } + + return; +} +#endif #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a9e1540ef4..00298890bd 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -797,10 +797,18 @@ ivas_error ivas_ism_config( int32_t total_brate[], /* o : total bitrate per object */ int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ #ifdef MASA_AND_OBJECTS - , int16_t masa_ism_flag /* i : flag indicating ISM MASA format */ + , const int16_t combined_format_flag /* i : flag indicating combined format */ #endif ); +#ifdef OMASA_BRATE +void bitbudget_to_brate( + const int16_t x[], /* i : bitbudgets */ + int32_t y[], /* o : bitrates */ + const int16_t N /* i : number of entries to be converted */ +); +#endif + void ivas_ism_reset_metadata( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handles */ ); @@ -850,7 +858,11 @@ ivas_error ivas_ism_enc( ); ivas_error ivas_ism_metadata_enc( +#ifdef OMASA_BRATE + int32_t *ism_total_brate, /* i/o: ISms total bitrate */ +#else const int32_t ism_total_brate, /* i : ISms total bitrate */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -861,7 +873,10 @@ ivas_error ivas_ism_metadata_enc( const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ #ifdef MASA_AND_OBJECTS , - int16_t n_ism /* i : number of ism-s */ + const int16_t n_ism /* i : number of objects */ +#ifdef OMASA_BRATE + ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ +#endif #endif ); @@ -4484,10 +4499,10 @@ void ivas_masa_encode( const int16_t element_mode /* i : element mode */ #ifdef MASA_AND_OBJECTS , - ISM_MODE ism_mode, /* i : ISM format mode */ - int16_t nchan_ism, /* i : number of ism channels */ + const ISM_MODE ism_mode, /* i : ISM format mode */ + const int16_t nchan_ism, /* i : number of ism channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ - int16_t idx_separated_object, /* i : index of the separated object */ + const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ #endif ); @@ -5102,56 +5117,93 @@ void ivas_filter_process( const int16_t length /* i : filter order */ ); + #ifdef MASA_AND_OBJECTS /* ----------------------------------------------------------------------------------* * OMASA prototypes * ----------------------------------------------------------------------------------*/ ivas_error ivas_omasa_enc_open( - Encoder_Struct* st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct* st_ivas /* i/o: IVAS encoder handle */ ); void ivas_omasa_enc_close( - OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ - const int16_t nchan_ism /* i : number of objects */ + OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ + const int16_t nchan_ism /* i : number of objects */ ); void ivas_omasa_set_config( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ - const int32_t input_Fs /* i : Input sample rate */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ + const int32_t input_Fs /* i : Input sample rate */ ); void ivas_omasa_enc( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - float data_in_f[][L_FRAME48k], /* i : Input audio signals for parameter analysis */ - float data_out_f[][L_FRAME48k], /* o : Transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const int16_t nchan_inp, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ - float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ - int16_t* idx_separated_object /* o : Index of the separated object */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + float data_in_f[][L_FRAME48k], /* i : Input audio signals for parameter analysis */ + float data_out_f[][L_FRAME48k], /* o : Transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_inp, /* i : Number of objects for parameter analysis */ + const ISM_MODE ism_mode, /* i : ISM mode */ + float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ + int16_t* idx_separated_object /* o : Index of the separated object */ +); + +#ifdef OMASA_BRATE +void ivas_set_surplus_brate_enc( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_set_surplus_brate_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int32_t *ism_total_brate /* i : ISM total bit-rate */ +); + +void set_ism_importance_interformat( + const int32_t ism_total_brate, /* i/o: ISms total bitrate */ + const int16_t nchan_transport, /* i : number of transported channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + const float lp_noise_CPE, /* i : LP filtered total noise estimation */ + int16_t ism_imp[] /* o : ISM importance flags */ +); + +/*! r: adjusted bitrate */ +int32_t ivas_interformat_brate( + const int32_t element_brate, /* i : element bitrate */ + const int16_t ism_imp /* i : ISM importance flag */ ); +#ifdef OMASA_BRATE_FIX +void ivas_combined_format_brate_sanity( + const int32_t element_brate, /* i : element bitrate */ + const int32_t brate_surplus, /* i : surplus bitrate */ + int16_t nb_bits_metadata[], /* i/o: number of metadata bits */ + const int16_t nchan_ism, /* i : number of objects */ + int16_t *diff_nBits /* o : number of differential bits */ +); +#endif +#endif + ISM_MODE ivas_omasa_ism_mode_select( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t no_obj /* i : number of input ISM's */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t no_obj /* i : number of input ISM's */ ); void ivas_merge_masa_transports( - float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ - float data_in_f2[][L_FRAME48k], /* i : Transport audio signals 2 */ - float data_out_f[][L_FRAME48k], /* o : Merged transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t num_transport_channels /* i : Number of transport audio signals */ + float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ + float data_in_f2[][L_FRAME48k], /* i : Transport audio signals 2 */ + float data_out_f[][L_FRAME48k], /* o : Merged transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t num_transport_channels /* i : Number of transport audio signals */ ); void ivas_masa_ism_data_open( - Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); @@ -5165,14 +5217,14 @@ void preProcessStereoTransportsForMovedObjects( ); ivas_error ivas_masa_ism_separate_object_renderer_open( - Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ ); void ivas_masa_ism_separate_object_render( - Decoder_Struct* st_ivas, /* i/o: IVAS decoder structure */ - float input_f[][L_FRAME48k], /* i : separated object signal */ - float output_f[][L_FRAME48k], /* i/o: output signals */ - const int16_t output_frame /* i : output frame length per channel */ + Decoder_Struct* st_ivas, /* i/o: IVAS decoder structure */ + float input_f[][L_FRAME48k], /* i : separated object signal */ + float output_f[][L_FRAME48k], /* i/o: output signals */ + const int16_t output_frame /* i : output frame length per channel */ ); void ivas_masa_ism_set_edited_objects( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 2464229096..d7e3bd208f 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2780,18 +2780,23 @@ const float McMASA_LFEGain_vectors[64] = }; #ifdef MASA_AND_OBJECTS - -int32_t sep_object_brate[][MAX_NUM_OBJECTS] ={ - {0, 0, 0, 0}, /* 13k2 */ - {0, 0, 0, 0}, /* 16k4 */ - {9600, 0, 0, 0}, /* 24k4 */ - {9600, 0, 0, 0}, /* 32k */ - {IVAS_13k2, 0, 0, 0}, /* 48k */ - {16000, IVAS_13k2, 0, 0}, /* 64k */ - {20000, 16000, 0, 0}, /* 80k */ - {IVAS_32k, 20000, 0, 0}, /* 96k */ - {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ - {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ +// VE2Nokia: add "const" to the arrays +int32_t sep_object_brate[][MAX_NUM_OBJECTS] = +{ + {0, 0, 0, 0}, /* 13k2 */ + {0, 0, 0, 0}, /* 16k4 */ + {9600, 0, 0, 0}, /* 24k4 */ + {9600, 0, 0, 0}, /* 32k */ + {IVAS_13k2, 0, 0, 0}, /* 48k */ +#ifdef OMASA_BRATE_FIX + {16000, 12500, 0, 0}, /* 64k */ +#else + {16000, IVAS_13k2, 0, 0}, /* 64k */ +#endif + {20000, 16000, 0, 0}, /* 80k */ + {IVAS_32k, 20000, 0, 0}, /* 96k */ + {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ + {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index da715a482e..57420ceea8 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -58,6 +58,11 @@ typedef struct int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ +#ifdef OMASA_BRATE + int16_t ism_imp; /* ISM importance flag */ + int16_t ism_vad_flag; +#endif + } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index 7b3e297d78..6845dbbcaa 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,12 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ + +#define MASA_AND_OBJECTS_VE // VA: improve codec print-outs +#define OMASA_BRATE /* VA: combined format bit-budget distribution */ +#define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more work needed +#define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files + #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 8c24412dce..45b9ae6b0d 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -233,19 +233,27 @@ ivas_error ivas_cpe_dec( /* read DFT Stereo side info */ nb_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); #ifdef MASA_AND_OBJECTS +#ifdef OMASA_BRATE + cpe_brate = st_ivas->hCPE[0]->element_brate; +#else cpe_brate = ivas_total_brate; +#endif if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifndef OMASA_BRATE cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); +#endif sts[1]->bit_stream = sts[0]->bit_stream + cpe_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; +#ifdef OMASA_BRATE + sts[1]->bit_stream += hCPE->brate_surplus / FRAMES_PER_SEC; +#endif } else - { #endif + { sts[1]->bit_stream = sts[0]->bit_stream + ivas_total_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; -#ifdef MASA_AND_OBJECTS } -#endif + if ( ivas_total_brate == IVAS_SID_5k2 ) { nb_bits -= SID_FORMAT_NBITS; @@ -269,6 +277,14 @@ ivas_error ivas_cpe_dec( /* subtract metadata bitbudget */ sts[0]->total_brate -= ( nb_bits_metadata * FRAMES_PER_SEC ); + +#ifdef OMASA_BRATE + /* subtract bit-rate for combined format coding */ + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + sts[0]->total_brate += hCPE->brate_surplus; + } +#endif } else { @@ -287,6 +303,16 @@ ivas_error ivas_cpe_dec( } else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { +#ifdef OMASA_BRATE + /* compute bit-rate surplus per channel in combined format coding */ + int32_t brate_surplus[CPE_CHANNELS]; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + brate_surplus[0] = ( ( hCPE->brate_surplus / FRAMES_PER_SEC ) >> 1 ) * FRAMES_PER_SEC; + brate_surplus[1] = hCPE->brate_surplus - brate_surplus[0]; + } +#endif + if ( is_DTXrate( ivas_total_brate ) == 1 && ( sts[0]->first_CNG == 0 || sts[1]->first_CNG == 0 ) ) { if ( ( error = initMdctStereoDtxData( hCPE ) ) != IVAS_ERR_OK ) @@ -311,6 +337,15 @@ ivas_error ivas_cpe_dec( } sts[n]->bits_frame_nominal = (int16_t) ( sts[n]->total_brate / FRAMES_PER_SEC ); sts[n]->bits_frame_channel = (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) / n_channels ); + +#ifdef OMASA_BRATE + /* subtract bit-rate for combined format coding */ + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + sts[n]->bits_frame_channel += (int16_t) ( brate_surplus[n] / FRAMES_PER_SEC ); + sts[n]->total_brate += brate_surplus[n]; + } +#endif } if ( !st_ivas->hMCT ) @@ -579,6 +614,7 @@ ivas_error create_cpe_dec( #ifdef MASA_AND_OBJECTS int32_t cpe_brate; #endif + error = IVAS_ERR_OK; /*-----------------------------------------------------------------* @@ -617,7 +653,7 @@ ivas_error create_cpe_dec( /* Note: nchan_out is considered to be related to the structure. This is nchan_out for CPE and for MASA_format is always 2. */ #ifdef MASA_AND_OBJECTS - if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == MC_FORMAT ) + if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == MC_FORMAT ) #else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) #endif @@ -628,6 +664,7 @@ ivas_error create_cpe_dec( { hCPE->nchan_out = min( CPE_CHANNELS, st_ivas->hDecoderConfig->nchan_out ); } + #ifdef MASA_AND_OBJECTS if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -637,6 +674,7 @@ ivas_error create_cpe_dec( { cpe_brate = st_ivas->hDecoderConfig->ivas_total_brate; } + if ( ( ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || ( st_ivas->ivas_format == MASA_ISM_FORMAT && cpe_brate < MASA_STEREO_MIN_BITRATE ) ) && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index d950153165..d0e134f727 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -69,7 +69,7 @@ ivas_error ivas_dec( AUDIO_CONFIG output_config; ivas_error error; #ifdef MASA_AND_OBJECTS - int32_t ism_brate; + int32_t ism_total_brate; #endif error = IVAS_ERR_OK; @@ -550,9 +550,12 @@ ivas_error ivas_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - ism_brate = 0; +#ifndef OMASA_BRATE + ism_total_brate = 0; +#endif st = st_ivas->hCPE[0]->hCoreCoder[0]; +#ifndef OMASA_BRATE if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); @@ -561,10 +564,11 @@ ivas_error ivas_dec( { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { - ism_brate += st_ivas->hSCE[n]->element_brate; + ism_total_brate += st_ivas->hSCE[n]->element_brate; } - st->bit_stream = &( st_ivas->bit_stream[( ism_brate / FRAMES_PER_SEC )] ); + st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); } +#endif nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); @@ -588,6 +592,16 @@ ivas_error ivas_dec( return error; } +#ifdef OMASA_BRATE + /* 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 )] ); +#endif +#ifdef OMASA_BRATE_FIX + ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &n /* temp */ ); +#endif + /* Audio signal decoding */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { @@ -605,7 +619,7 @@ ivas_error ivas_dec( else { /* decode ISM format */ - ivas_ism_metadata_dec( ism_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); + ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); for ( n = 0; n < st_ivas->nSCE - 1; n++ ) { @@ -634,6 +648,7 @@ ivas_error ivas_dec( { mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ } + /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 53d103abe1..dcaf13dbd1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -982,6 +982,13 @@ ivas_error ivas_init_decoder( create_sce_dec( st_ivas, 0, sce_brate ); reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); + +#ifdef OMASA_BRATE // VE: just 'ism_imp' parameter is needed - what about the other parameters? -> TBV + if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); + } +#endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -998,10 +1005,10 @@ ivas_error ivas_init_decoder( { return error; } + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); } - if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nSCE, temp_brate ) ) != IVAS_ERR_OK ) { return error; @@ -1017,7 +1024,7 @@ ivas_error ivas_init_decoder( } st_ivas->nCPE = 1; - create_cpe_dec( st_ivas, 0, ( ( ivas_total_brate - sce_brate ) / st_ivas->nchan_transport ) * CPE_CHANNELS ); + create_cpe_dec( st_ivas, 0, ( ( ivas_total_brate - sce_brate ) / st_ivas->nchan_transport ) * CPE_CHANNELS ); // VE2Nokia: could be simplified - nchan_transport is always 2 here for ( n = 0; n < CPE_CHANNELS; n++ ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 658dcaca4b..0d3b5fa572 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -164,7 +164,17 @@ ivas_error ivas_ism_metadata_dec( /* Read ISm present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) { - ism_imp[ch] = get_next_indice( st0, ISM_METADATA_FLAG_BITS ); +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + /* ISM importance flag is already read in ivas_masa_decode() */ + ism_imp[ch] = hIsmMeta[ch]->ism_imp; + } + else +#endif + { + ism_imp[ch] = get_next_indice( st0, ISM_METADATA_FLAG_BITS ); + } if ( ism_imp[ch] > ISM_NO_META ) { @@ -189,7 +199,17 @@ ivas_error ivas_ism_metadata_dec( { if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - localVAD[ch] = get_next_indice( st0, ISM_METADATA_VAD_FLAG_BITS ); +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + /* VAD flag is already read in ivas_masa_decode() */ + localVAD[ch] = hIsmMeta[ch]->ism_vad_flag; + } + else +#endif + { + localVAD[ch] = get_next_indice( st0, ISM_METADATA_VAD_FLAG_BITS ); + } } else { @@ -469,6 +489,13 @@ ivas_error ivas_ism_metadata_dec( } } +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + ism_metadata_flag_global = 1; + } +#endif + /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ @@ -477,12 +504,22 @@ ivas_error ivas_ism_metadata_dec( { #ifdef MASA_AND_OBJECTS int16_t masa_ism_flag = 0; - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) // VE2Nokia: ISM_MASA_MODE_ONE_OBJ looks obsolete here { masa_ism_flag = 1; } #endif +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + for ( ch = 0; ch < *nchan_transport; ch++ ) + { + element_brate[ch] = hSCE[ch]->element_brate; + } + } +#endif + ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata #ifdef MASA_AND_OBJECTS , @@ -506,7 +543,12 @@ ivas_error ivas_ism_metadata_dec( } } - hSCE[ch]->element_brate = element_brate[ch]; +#ifdef OMASA_BRATE + if ( ism_mode != ISM_MASA_MODE_DISC ) +#endif + { + hSCE[ch]->element_brate = element_brate[ch]; + } hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; } @@ -567,6 +609,11 @@ ivas_error create_ism_metadata_dec( st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#ifdef OMASA_BRATE + st_ivas->hIsmMetaData[ch]->ism_imp = -1; + st_ivas->hIsmMetaData[ch]->ism_vad_flag = 1; +#endif + ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 0eec565504..db86d97fd9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -98,6 +98,9 @@ ivas_error ivas_masa_decode( ivas_error error; #ifdef MASA_AND_OBJECTS int16_t obj; +#ifdef OMASA_BRATE + int16_t i, ch, ism_imp; +#endif #endif error = IVAS_ERR_OK; @@ -167,6 +170,44 @@ ivas_error ivas_masa_decode( st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; } + +#ifdef OMASA_BRATE + /* read ISM importance flag (one per object) */ + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + ism_imp = 0; + for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + { + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + ism_imp = ( ism_imp << 1 ) + byteBuffer; + } + st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) + { + ism_imp = 0; + for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + { + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + ism_imp = ( ism_imp << 1 ) + byteBuffer; + } + st_ivas->hIsmMetaData[ch]->ism_imp = ism_imp; + + /* reset */ + st_ivas->hIsmMetaData[ch]->ism_vad_flag = 1; + if ( st_ivas->hIsmMetaData[ch]->ism_imp == ISM_NO_META ) + { + /* read VAD flag */ + st_ivas->hIsmMetaData[ch]->ism_vad_flag = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read ) += ISM_METADATA_VAD_FLAG_BITS; + } + } + } +#endif } #endif /* Placeholder for descriptive metadata content */ @@ -365,7 +406,9 @@ ivas_error ivas_masa_decode( } if ( st_ivas->hDirAC != NULL ) { +#ifndef OMASA_BRATE int16_t i; +#endif int16_t b; int16_t block; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c new file mode 100644 index 0000000000..eacc84ef46 --- /dev/null +++ b/lib_dec/ivas_omasa_dec.c @@ -0,0 +1,106 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "options.h" +#include +#include "ivas_cnst.h" +#include "ivas_prot.h" +#include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif + + +#ifdef OMASA_BRATE +/*--------------------------------------------------------------------------* + * ivas_set_surplus_brate_dec() + * + * set bit-rate surplus in combined format coding + *--------------------------------------------------------------------------*/ + +void ivas_set_surplus_brate_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int32_t *ism_total_brate /* i/o: ISM total bit-rate */ +) +{ + int16_t n, bits_ism, bits_element[MAX_NUM_OBJECTS]; + int32_t ism_total_brate_ref, element_brate[MAX_NUM_OBJECTS]; + + *ism_total_brate = 0; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + *ism_total_brate = ivas_interformat_brate( st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + + st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - *ism_total_brate; + + /* set 'st->total_brate'; there are no meta-data in ISM_MASA_MODE_ONE_OBJ mode */ + st_ivas->hSCE[0]->hCoreCoder[0]->total_brate = *ism_total_brate; + + st_ivas->hSCE[0]->hCoreCoder[0]->low_rate_mode = 0; + if ( st_ivas->hIsmMetaData[0]->ism_imp == ISM_NO_META ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->low_rate_mode = 1; + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + ism_total_brate_ref = 0; + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + ism_total_brate_ref += st_ivas->hSCE[n]->element_brate; + } + + bits_ism = (int16_t) ( ism_total_brate_ref / FRAMES_PER_SEC ); + set_s( bits_element, bits_ism / st_ivas->nchan_ism, st_ivas->nchan_ism ); + bits_element[st_ivas->nchan_ism - 1] += bits_ism % st_ivas->nchan_ism; + bitbudget_to_brate( bits_element, element_brate, st_ivas->nchan_ism ); + + *ism_total_brate = 0; + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + st_ivas->hSCE[n]->element_brate = element_brate[n]; + + *ism_total_brate += ivas_interformat_brate( st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp ); + } + st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; + + /* 'st->total_brate' is set in ivas_ism_config */ + } + else + { + st_ivas->hCPE[0]->brate_surplus = 0; + } + + return; +} +#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 9a360f22a2..4cd2565a32 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -178,6 +178,9 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } +#ifdef OMASA_BRATE + else if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->ivas_format != MASA_ISM_FORMAT ) /* note: total_brate[] is set in ivas_ism_config() or ivas_set_surplus_brate_dec() */ +#else #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { @@ -189,6 +192,7 @@ ivas_error ivas_sce_dec( } #endif else if ( st_ivas->ivas_format != ISM_FORMAT ) /* note: in ISMs, total_brate[] is set in ivas_ism_config() */ +#endif { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } @@ -199,7 +203,12 @@ ivas_error ivas_sce_dec( /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ #ifdef MASA_AND_OBJECTS - if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) && st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) + if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC +#ifdef OMASA_BRATE + || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ +#endif + ) && + st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) #else if ( st_ivas->ivas_format == ISM_FORMAT && st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) #endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index e028cc6843..30191abcb0 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -670,7 +670,7 @@ typedef struct ivas_dirac_dec_data_structure int16_t numParametricDirections; /* 1 or 2 */ int16_t numIsmDirections; /* From 0 to MAX_NUM_OBJECTS */ #else - int16_t numSimultaneousDirections; /* 1 or 2 */ + int16_t numSimultaneousDirections; /* 1 or 2 */ #endif DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; @@ -963,6 +963,10 @@ typedef struct cpe_dec_data_structure float old_out_mdct[STEREO_MDCT2DFT_FADE_LEN_48k]; float old_outLB_mdct[2 * STEREO_MDCT2DFT_FADE_LEN_48k]; +#ifdef OMASA_BRATE + int32_t brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ +#endif + } CPE_DEC_DATA, *CPE_DEC_HANDLE; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 3c4a1b1a5c..fab25168be 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1880,7 +1880,11 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Input configuration: MASA - %d channel(s)\n", st_ivas->nchan_transport ); } +#ifdef MASA_AND_OBJECTS_VE + else if ( st_ivas->ivas_format == MC_FORMAT ) +#else else /* MC_FORMAT */ +#endif { if ( ( error = get_channel_config( st_ivas->transport_config, &config_str[0] ) ) != IVAS_ERR_OK ) { @@ -1889,7 +1893,14 @@ static ivas_error printConfigInfo_dec( fprintf( stdout, "Input configuration: %s\n", config_str ); } +#ifdef MASA_AND_OBJECTS_VE + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + fprintf( stdout, "Input configuration: combined ISM and MASA (%i separated ISM stream(s)) \n", st_ivas->nchan_transport ); + } +#endif } + get_channel_config( st_ivas->hDecoderConfig->output_config, &config_str[0] ); fprintf( stdout, "Output configuration: %s\n", config_str ); diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 3332855cd7..ac489f0f1f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -306,6 +306,16 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode == IVAS_CPE_MDCT ) { +#ifdef OMASA_BRATE + /* compute bit-rate surplus per channel in combined format coding */ + int32_t brate_surplus[CPE_CHANNELS]; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + brate_surplus[0] = ( ( hCPE->brate_surplus / FRAMES_PER_SEC ) >> 1 ) * FRAMES_PER_SEC; + brate_surplus[1] = hCPE->brate_surplus - brate_surplus[0]; + } +#endif + /* this is just for initialization, the true values of "total_brate" and "bits_frame_channel" are set later */ for ( n = 0; n < n_CoreChannels; n++ ) { @@ -323,6 +333,15 @@ ivas_error ivas_cpe_enc( sts[n]->bits_frame_nominal = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); sts[n]->bits_frame_channel = (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) / n_CoreChannels ); sts[n]->total_brate = hCPE->element_brate / n_CoreChannels; + +#ifdef OMASA_BRATE + /* subtract bit-rate for combined format coding */ + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + sts[n]->bits_frame_channel += (int16_t) ( brate_surplus[n] / FRAMES_PER_SEC ); + sts[n]->total_brate += brate_surplus[n]; + } +#endif } } @@ -562,6 +581,7 @@ ivas_error ivas_cpe_enc( * DFT Stereo residual coding * DFT Stereo parameters writing into the bitstream *----------------------------------------------------------------*/ + #ifdef MASA_AND_OBJECTS cpe_brate = 0; #endif @@ -596,12 +616,16 @@ ivas_error ivas_cpe_enc( /* Write stereo bitstream */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_BRATE + cpe_brate = st_ivas->hCPE[0]->element_brate; +#else cpe_brate = ivas_total_brate; if ( ivas_format == MASA_ISM_FORMAT ) { cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); } +#endif if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && cpe_brate < MASA_STEREO_MIN_BITRATE && sts[0]->core_brate != SID_2k40 && sts[0]->core_brate != FRAME_NO_DATA ) { @@ -655,6 +679,14 @@ ivas_error ivas_cpe_enc( /* subtract metadata bitbudget */ sts[0]->total_brate -= ( nb_bits_metadata * FRAMES_PER_SEC ); + +#ifdef OMASA_BRATE + /* subtract bit-rate for combined format coding */ + if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + sts[0]->total_brate += hCPE->brate_surplus; + } +#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 16e4080040..3bfa8bcfcc 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -310,7 +310,12 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS else if ( ivas_format == MASA_ISM_FORMAT ) { +#ifndef OMASA_BRATE float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; +#endif +#ifdef OMASA_BRATE_FIX + int16_t diff_nBits = 0; +#endif float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; @@ -327,6 +332,61 @@ ivas_error ivas_enc( /* nb_bits_metadata[0] = 0; */ set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); + +#ifdef OMASA_BRATE + /* Configure MASA encoder based on frame parameters */ + ivas_masa_enc_config( st_ivas ); // VE2Nokia: this function should return an error code + idx_separated_object = 0; + + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Configure oMASA analysis based on MASA config */ + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs ); + } + + /* Estimate TF-tile energy for the input MASA stream */ + ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[st_ivas->nchan_ism] ), input_frame, st_ivas->nchan_transport ); + + /* put audio object data in SCE's */ + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + // VE2Nokia: merge the following to one function in order to save some stack memory + float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; + + /* Estimate MASA parameters for the objects */ + ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, data_transport_f, input_frame, st_ivas->nchan_transport, st_ivas->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); + + /* Merge transport signals */ + ivas_merge_masa_transports( data_transport_f, &( data_f[st_ivas->nchan_ism] ), data_f, input_frame, st_ivas->nchan_transport ); + } + + /* Encode ISMs transport channels */ + n = 0; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ); /* there are no metadata bits in SCE in this mode */ // VE2Nokia: this function should return an error code + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + /* Analysis, decision about bitrates per channel & core coding */ + if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + { + return error; + } + n = st_ivas->nchan_ism; + } + + /* Encode MASA parameters and write MASA metadata bitstream */ + ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, + st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); + + /* Configuration of combined-format bit-budget distribution */ + ivas_set_surplus_brate_enc( st_ivas ); + +#ifdef OMASA_BRATE_FIX + ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &diff_nBits ); +#endif +#else if ( st_ivas->hQMetaData != NULL ) { /* Configure MASA encoder based on frame parameters */ @@ -377,11 +437,49 @@ ivas_error ivas_enc( } n = st_ivas->nchan_ism; } +#endif /* OMASA_BRATE */ + + /* Encode MASA transport channels */ + if ( st_ivas->nCPE == 1 ) // VE2Nokia: this condition is not necessary + { + ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); // VE2Nokia: this condition is unnecessary + } + +#ifdef OMASA_BRATE_FIX + if ( st_ivas->nchan_ism == 1 && st_ivas->hCPE[0]->element_brate < ACELP_12k8_HIGH_LIMIT && diff_nBits > 0 ) + { + while ( diff_nBits > 0 ) + { + i = min( diff_nBits, 16 ); + push_indice( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, IND_UNUSED, 0, i ); + diff_nBits -= i; + } + } +#endif - if ( st_ivas->nCPE == 1 ) /* Stereo DMX */ +#ifdef DEBUG_VA + if ( st_ivas->hSCE[0] != NULL ) { - ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); + float tmpF = 0; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); + } + else + { + for ( i = 0; i < st_ivas->nchan_ism; i++ ) + { + tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 ); + } + } + tmpF /= 1000.f; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_ISM" ); + tmpF = ivas_total_brate / 1000.0f - tmpF; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA" ); + tmpF = nb_bits_metadata[0] * 50 / 1000.0f; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MD" ); } +#endif } #endif else if ( ivas_format == MC_FORMAT ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 42c4cec050..cb8217d556 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -570,7 +570,8 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); st_ivas->nchan_transport = 2; - create_ism_metadata_enc( st_ivas, st_ivas->nchan_ism, element_brate_tmp ); + + create_ism_metadata_enc( st_ivas, st_ivas->nchan_ism, element_brate_tmp ); // VE2Nokia: this function should return an error code /* the values of element_brate_tmp will be re-written in MASA_ISM_FORMAT because they are taken from sep_object_brate[][]*/ if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -589,7 +590,7 @@ ivas_error ivas_init_encoder( { /* use the bitrate for one object */ sce_brate = sep_object_brate[k - 2][0]; - create_sce_enc( st_ivas, 0, sce_brate ); + create_sce_enc( st_ivas, 0, sce_brate ); // VE2Nokia: this function should return an error code /* prepare bitstream buffers */ st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list = ind_list[0]; @@ -604,7 +605,7 @@ ivas_error ivas_init_encoder( for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { sce_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; - create_sce_enc( st_ivas, sce_id, sep_object_brate[k - 2][st_ivas->nSCE - 1] ); + create_sce_enc( st_ivas, sce_id, sep_object_brate[k - 2][st_ivas->nSCE - 1] ); // VE2Nokia: this function should return an error code /* prepare bitstream buffers */ st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; @@ -614,8 +615,12 @@ ivas_error ivas_init_encoder( reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); } } + + // VE2Nokia: following functions should return an error code ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); + ivas_masa_enc_open( st_ivas ); + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { ivas_omasa_enc_open( st_ivas ); @@ -628,6 +633,7 @@ ivas_error ivas_init_encoder( { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; } + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - sce_brate ); diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 4a8a2b181f..8e89ed31ee 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -202,10 +202,20 @@ ivas_error ivas_ism_enc( st_ivas->hDirAC->hParamIsm->flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech && st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i]; } - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm + ivas_ism_metadata_enc( +#ifdef OMASA_BRATE + &st_ivas->hEncoderConfig->ivas_total_brate, +#else + st_ivas->hEncoderConfig->ivas_total_brate, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm #ifdef MASA_AND_OBJECTS - , - st_ivas->nSCE + , + st_ivas->nSCE +#ifdef OMASA_BRATE + , + -1 +#endif #endif ); } @@ -226,7 +236,19 @@ ivas_error ivas_ism_enc( ism_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; } +#ifdef OMASA_BRATE + int32_t ism_total_brate_ref = ism_total_brate; + + // VE: change the interface of the following function and call it with 'st_ivas' only + ivas_ism_metadata_enc( &ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ); + + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - ism_total_brate; + } +#else ivas_ism_metadata_enc( ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE ); +#endif #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index fa2c4a1bd9..78997e6e79 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -138,6 +138,75 @@ static void rate_ism_importance( return; } + +#ifdef OMASA_BRATE +/*-------------------------------------------------------------------------* + * set_ism_importance_interformat() + * + * Set the importance of particular ISM streams in combined-format coding + *-------------------------------------------------------------------------*/ + +void set_ism_importance_interformat( + const int32_t ism_total_brate, /* i/o: ISms total bitrate */ + const int16_t nchan_transport, /* i : number of transported channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + const float lp_noise_CPE, /* i : LP filtered total noise estimation */ + int16_t ism_imp[] /* o : ISM importance flags */ +) +{ + Encoder_State *st; + int16_t ch, ctype, active_flag; + + for ( ch = 0; ch < nchan_transport; ch++ ) + { + st = hSCE[ch]->hCoreCoder[0]; + + active_flag = st->vad_flag; + + if ( active_flag == 0 ) + { + if ( st->lp_noise > 15 || lp_noise_CPE - st->lp_noise < 30 ) + { + active_flag = 1; + } + } + + /* do not use the low-rate core-coder mode at highest bit-rates */ + if ( ism_total_brate / nchan_transport > IVAS_48k ) + { + active_flag = 1; + } + + ctype = hSCE[ch]->hCoreCoder[0]->coder_type_raw; + + st->low_rate_mode = 0; + if ( active_flag == 0 ) + { + ism_imp[ch] = ISM_INACTIVE_IMP; + st->low_rate_mode = 1; + } + else if ( ctype == INACTIVE || ctype == UNVOICED ) + { + ism_imp[ch] = ISM_LOW_IMP; + } + else if ( ctype == VOICED ) + { + ism_imp[ch] = ISM_MEDIUM_IMP; + } + else /* GENERIC */ + { + ism_imp[ch] = ISM_HIGH_IMP; + } + + hIsmMeta[ch]->ism_metadata_flag = active_flag; /* flag is needed for the MD coding */ + } + + return; +} +#endif + + /*-------------------------------------------------------------------------* * ivas_ism_metadata_enc() * @@ -145,7 +214,11 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef OMASA_BRATE + int32_t *ism_total_brate, /* i/o: ISms total bitrate */ +#else + const int32_t ism_total_brate, /* i : ISms total bitrate */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -156,7 +229,11 @@ ivas_error ivas_ism_metadata_enc( const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ #ifdef MASA_AND_OBJECTS , - int16_t n_ism /* i : number of ism-s */ + const int16_t n_ism /* i : number of objects */ +#ifdef OMASA_BRATE + , + const float lp_noise_CPE +#endif #endif ) { @@ -213,82 +290,104 @@ ivas_error ivas_ism_metadata_enc( set_s( flag_abs_azimuth, 0, num_obj ); set_s( flag_abs_elevation, 0, num_obj ); - /*----------------------------------------------------------------* - * Set Metadata presence / importance flag - *----------------------------------------------------------------*/ +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + n_ch = num_obj; + } + else + { + n_ch = nchan_transport; + } - for ( ch = 0; ch < num_obj; ch++ ) + if ( ism_mode == ISM_MASA_MODE_DISC ) { - if ( ism_mode == ISM_MODE_PARAM ) + /*----------------------------------------------------------------* + * Rate importance of particular ISm streams in combined format coding + *----------------------------------------------------------------*/ + + set_ism_importance_interformat( *ism_total_brate, n_ch, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); + } + else +#endif + { + /*----------------------------------------------------------------* + * Set Metadata presence / importance flag + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < num_obj; ch++ ) { - hIsmMeta[ch]->ism_metadata_flag = 1; - } + if ( ism_mode == ISM_MODE_PARAM ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + } #ifdef MASA_AND_OBJECTS - else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) + else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) #else - else if ( ism_mode == ISM_MODE_DISC ) + else if ( ism_mode == ISM_MODE_DISC ) #endif - { - hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; - - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - /* send metadata even in inactive segments when noise is audible and metadata are changing */ - diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; - if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - hIsmMeta[ch]->ism_metadata_flag = 1; + /* send metadata even in inactive segments when noise is audible and metadata are changing */ + diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); + diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); + + if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + } } - } - if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) - { - /* at highest bitrates (with TCX core only) metadata are sent in every frame */ - hIsmMeta[ch]->ism_metadata_flag = 1; + if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) + { + /* at highest bitrates (with TCX core only) metadata are sent in every frame */ + hIsmMeta[ch]->ism_metadata_flag = 1; + } } } - } - /*----------------------------------------------------------------* - * Rate importance of particular ISm streams - *----------------------------------------------------------------*/ + /*----------------------------------------------------------------* + * Rate importance of particular ISm streams + *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - if ( ism_mode == ISM_MASA_MODE_DISC ) - { - n_ch = num_obj; - } - else - { - n_ch = nchan_transport; - } + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + n_ch = num_obj; + } + else + { + n_ch = nchan_transport; + } - rate_ism_importance( n_ch, hIsmMeta, hSCE, ism_imp ); + rate_ism_importance( n_ch, hIsmMeta, hSCE, ism_imp ); #else - rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); + rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); #endif - /* relax the importance decision in "stereo" coding for noisy audio */ + /* relax the importance decision in "stereo" coding for noisy audio */ #ifdef MASA_AND_OBJECTS - if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) + if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) #else - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) #endif - { - float diff_F; - - if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) { - for ( ch = 0; ch < num_obj; ch++ ) - { - diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; + float diff_F; - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) + if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) + { + for ( ch = 0; ch < num_obj; ch++ ) { - hIsmMeta[ch]->ism_metadata_flag = 1; - ism_imp[ch] = ISM_LOW_IMP; + diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; + + if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + ism_imp[ch] = ISM_LOW_IMP; + } } } } @@ -312,6 +411,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS } #endif + /* write ISm metadata flag (one per object) */ #ifdef MASA_AND_OBJECTS for ( ch = 0; ch < n_ch; ch++ ) @@ -319,7 +419,17 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_transport; ch++ ) #endif { - push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + /* ISM importance flag will be written in ivas_masa_encode() */ + hIsmMeta[ch]->ism_imp = ism_imp[ch]; + } + else +#endif + { + push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); + } } @@ -340,10 +450,28 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_transport; ch++ ) #endif { +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + /* reset */ + hIsmMeta[ch]->ism_vad_flag = 1; + } +#endif + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* this flag distinguishes between coding of inactive frame and active frame w/o. metadata */ - push_indice( hBstr, IND_ISM_VAD_FLAG, localVAD[ch], ISM_METADATA_VAD_FLAG_BITS ); +#ifdef OMASA_BRATE + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + /* VAD flag will be written in ivas_masa_encode() */ + hIsmMeta[ch]->ism_vad_flag = localVAD[ch]; + } + else +#endif + { + push_indice( hBstr, IND_ISM_VAD_FLAG, localVAD[ch], ISM_METADATA_VAD_FLAG_BITS ); + } } } } @@ -756,12 +884,40 @@ ivas_error ivas_ism_metadata_enc( } } +#ifdef OMASA_BRATE + /*----------------------------------------------------------------* + * Take into account the combined format bit-budget distribution + *----------------------------------------------------------------*/ + + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; + + bits_ism = (int16_t) ( *ism_total_brate / FRAMES_PER_SECOND ); + set_s( bits_element, bits_ism / num_obj, num_obj ); + bits_element[num_obj - 1] += bits_ism % num_obj; + bitbudget_to_brate( bits_element, element_brate, num_obj ); + + *ism_total_brate = 0; + for ( ch = 0; ch < num_obj; ch++ ) + { + *ism_total_brate += ivas_interformat_brate( hSCE[ch]->element_brate, ism_imp[ch] ); + } + ism_metadata_flag_global = 1; + } +#endif + /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ + #ifdef MASA_AND_OBJECTS - ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, - ( ism_mode == ISM_MASA_MODE_DISC ) ); +#ifdef OMASA_BRATE + ivas_ism_config( *ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, ism_mode == ISM_MASA_MODE_DISC ); // VE: this funtion should return an error +#else + + ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, ( ism_mode == ISM_MASA_MODE_DISC ) ); +#endif #else ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); #endif @@ -770,9 +926,31 @@ ivas_error ivas_ism_metadata_enc( { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } + #ifdef MASA_AND_OBJECTS for ( ch = 0; ch < n_ch; ch++ ) { +#ifdef OMASA_BRATE + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; + if ( ism_mode == ISM_MODE_DISC ) + { + if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; + } + + hSCE[ch]->element_brate = element_brate[ch]; + } + else if ( ism_mode == ISM_MASA_MODE_DISC ) + { + if ( ism_imp[ch] == ISM_INACTIVE_IMP ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; + } + } + + hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; @@ -784,6 +962,7 @@ ivas_error ivas_ism_metadata_enc( hSCE[ch]->element_brate = element_brate[ch]; hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; +#endif /* write metadata only in active frames */ if ( hSCE[0]->hCoreCoder[0]->core_brate > SID_2k40 ) @@ -846,7 +1025,7 @@ ivas_error create_ism_metadata_enc( st_ivas->nCPE = 1; st_ivas->nSCE = 1; break; - case ISM_MODE_DISC: + case ISM_MODE_DISC: // VE2Nokia: this cannot happen st_ivas->nCPE = 1; st_ivas->nSCE = n_ISms; break; @@ -855,7 +1034,7 @@ ivas_error create_ism_metadata_enc( st_ivas->nSCE = n_ISms; break; case ISM_MODE_NONE: - if ( nchan_transport == 1 ) + if ( nchan_transport == 1 ) // VE2Nokia: this cannot happen { st_ivas->nSCE = 1; st_ivas->nCPE = 0; @@ -917,6 +1096,11 @@ ivas_error create_ism_metadata_enc( st_ivas->hIsmMetaData[ch]->elevation_diff_cnt = ISM_FEC_MAX - 1; st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; +#ifdef OMASA_BRATE + st_ivas->hIsmMetaData[ch]->ism_imp = -1; + st_ivas->hIsmMetaData[ch]->ism_vad_flag = 1; +#endif + ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } #ifdef MASA_AND_OBJECTS diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 0dbecbcb83..5ae88cead3 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -183,6 +183,10 @@ ivas_error ivas_masa_enc_open( set_zero( hMasa->data.lfeToTotalEnergyRatio, MAX_PARAM_SPATIAL_SUBFRAMES ); hMasa->data.prevq_lfeToTotalEnergyRatio = 0.0f; hMasa->data.prevq_lfeIndex = 0; +#ifdef OMASA_BRATE + hMasa->data.lp_noise_CPE = -1; +#endif + st_ivas->hMasa = hMasa; return error; @@ -244,11 +248,11 @@ void ivas_masa_encode( const int16_t element_mode /* i : element mode */ #ifdef MASA_AND_OBJECTS , - ISM_MODE ism_mode, /* i : ISM format mode */ - int16_t nchan_ism, /* i : number of ism channels */ + const ISM_MODE ism_mode, /* i : ISM format mode */ + const int16_t nchan_ism, /* i : number of ism channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ - int16_t idx_separated_object, /* i : index of the separated object */ - OMASA_ENC_HANDLE hOMasa /* i: OMASA encoder handle */ + const int16_t idx_separated_object, /* i : index of the separated object */ + OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ #endif ) { @@ -347,6 +351,30 @@ void ivas_masa_encode( push_next_indice( hMetaData, idx_separated_object, NO_BITS_MASA_ISM_NO_OBJ ); hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; } + +#ifdef OMASA_BRATE + /* write ISM importance flag (one per object) */ + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; + } + else if ( ism_mode == ISM_MASA_MODE_DISC ) + { + for ( i = 0; i < nchan_ism; i++ ) + { + push_next_indice( hMetaData, hIsmMetaData[i]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; + + if ( hIsmMetaData[i]->ism_metadata_flag == 0 ) + { + /* write VAD flag */ + push_next_indice( hMetaData, hIsmMetaData[i]->ism_vad_flag, ISM_METADATA_VAD_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_VAD_FLAG_BITS; + } + } + } +#endif } else { @@ -749,6 +777,20 @@ ivas_error ivas_masa_enc_config( #endif } +#ifdef OMASA_BRATE + if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT ) + { + st_ivas->hMasa->data.lp_noise_CPE = st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise; + } + else + { + st_ivas->hMasa->data.lp_noise_CPE = ( st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise + st_ivas->hCPE[0]->hCoreCoder[1]->lp_noise ) / CPE_CHANNELS; + } + } +#endif + return error; } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index ae8e49d1a6..b7258bff9f 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -270,6 +270,8 @@ void ivas_omasa_set_config( { hOMasa->block_grouping[1] = hOMasa->block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES]; } + + return; } @@ -484,6 +486,36 @@ void ivas_omasa_enc( } +#ifdef OMASA_BRATE +/*--------------------------------------------------------------------------* + * ivas_set_surplus_brate_enc() + * + * set bit-rate surplus in combined format coding + *--------------------------------------------------------------------------*/ + +void ivas_set_surplus_brate_enc( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +) +{ + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + /* note: ISM st->total_brate is iset in ivas_sce_enc() */ + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + /* it is already set in ivas_ism_enc() */ + } + else + { + st_ivas->hCPE[0]->brate_surplus = 0; + } + + return; +} +#endif + + /*--------------------------------------------------------------------------* * Local functions *--------------------------------------------------------------------------*/ diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index f322c3ad3e..7b986c61f8 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -211,6 +211,19 @@ ivas_error ivas_sce_enc( reset_metadata_spatial( ivas_format, hSCE->hMetaData, hSCE->element_brate, &st->total_brate, st->core_brate, nb_bits_metadata, st_ivas->sba_mode ); +#ifdef OMASA_BRATE + /*----------------------------------------------------------------* + * Combined format coding: get the ISM importance and the bit-rate + *----------------------------------------------------------------*/ + + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); + + st->total_brate = ivas_interformat_brate( hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ) - nb_bits_metadata * FRAMES_PER_SEC; + } +#endif + /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ @@ -229,6 +242,12 @@ ivas_error ivas_sce_enc( { st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); } +#ifdef OMASA_BRATE + else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ && st->low_rate_mode ) + { + st->flag_ACELP16k = 0; + } +#endif else { st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); @@ -329,8 +348,9 @@ ivas_error create_sce_enc( } copy_encoder_config( st_ivas, st, 1 ); + #ifdef MASA_AND_OBJECTS - if ( st_ivas->ism_mode >= ISM_MASA_MODE_PARAM ) + if ( st_ivas->ism_mode >= ISM_MASA_MODE_PARAM ) // VE2Nokia: ??? { st->element_mode = IVAS_SCE; /* To do: Nokia check as this is not optimal and verify if it influences other SCE modes */ } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index f715d1f5f5..bf574dbfcb 100755 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -731,8 +731,11 @@ typedef struct ivas_masa_encoder_data_struct float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t nchan_ism; - +#ifdef OMASA_BRATE + float lp_noise_CPE; /* LP filterend total noise estimation */ +#endif #endif + int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_ENC_CLDFB_INSTANCES]; float *delay_buffer[MASA_MAX_TRANSPORT_CHANNELS]; @@ -930,6 +933,9 @@ typedef struct cpe_enc_data_structure float *input_mem[CPE_CHANNELS]; /* input channels buffers memory; needed to be up-to-date for TD->DFT stereo switching */ +#ifdef OMASA_BRATE + int32_t brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ +#endif #ifdef DEBUGGING int16_t stereo_mode_cmdl; /* stereo mode forced from the commaand-line */ #endif @@ -1095,7 +1101,7 @@ typedef struct /* high-level encoder parameters */ int16_t nchan_transport; /* number of transport channels */ #ifdef MASA_AND_OBJECTS - int16_t nchan_ism; + int16_t nchan_ism; // VE2Nokia: move it under hEncoderConfig, or remove it and replace it by "nchan_inp - 2" in the code #endif int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t codec_mode; /* Mode1 or Mode2 of core codec */ diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 1b8460cf07..f97d80e823 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -436,7 +436,11 @@ void stereo_mdct_core_enc( sts[ch]->total_brate = ( sts[ch]->bits_frame_channel + sts[ch]->side_bits_frame_channel ) * FRAMES_PER_SEC; } stereo_bits += SMDCT_NBBITS_SPLIT_RATIO; +#ifdef OMASA_BRATE + assert( ( sts[0]->total_brate + sts[1]->total_brate + ( stereo_bits + signal_bits + meta_bits ) * FRAMES_PER_SEC ) == hCPE->element_brate + hCPE->brate_surplus ); +#else assert( ( sts[0]->total_brate + sts[1]->total_brate + ( stereo_bits + signal_bits + meta_bits ) * FRAMES_PER_SEC ) == hCPE->element_brate ); +#endif assert( hStereoMdct->split_ratio > 0 && hStereoMdct->split_ratio < SMDCT_BITRATE_RATIO_RANGE ); push_next_indice( hBstr, hStereoMdct->split_ratio, SMDCT_NBBITS_SPLIT_RATIO ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index e163b4810f..09e4b1e03f 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -384,7 +384,7 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( st_ivas = hIvasEnc->st_ivas; switch ( masaVariant ) { - case IVAS_ENC_MASA_1CH: + case IVAS_ENC_MASA_1CH: // VE2Nokia: seems not needeed st_ivas->hEncoderConfig->nchan_inp = 1 + numObjects; st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ break; @@ -1638,9 +1638,14 @@ static ivas_error printConfigInfo_enc( #ifdef MASA_AND_OBJECTS else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { +#ifdef MASA_AND_OBJECTS_VE + fprintf( stdout, "IVAS format: combined ISM and MASA (%i ISM stream(s))\n", hEncoderConfig->nchan_inp - 2 ); +#else fprintf( stdout, "IVAS format: MASA and objects format\n" ); +#endif } #endif + /*-----------------------------------------------------------------* * Print CNG update interval, if DTX is activated *-----------------------------------------------------------------*/ -- GitLab From 190a901b579b2e157d0b1fe7ba3b7cdb4dd0a845 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 23 Jan 2023 20:02:52 +0100 Subject: [PATCH 017/591] two fixes --- lib_com/ivas_rom_com.c | 12 ++++++++---- lib_dec/core_switching_dec.c | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index d7e3bd208f..d9b341460d 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2786,7 +2786,11 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {0, 0, 0, 0}, /* 13k2 */ {0, 0, 0, 0}, /* 16k4 */ {9600, 0, 0, 0}, /* 24k4 */ +#ifdef OMASA_BRATE_FIX + {11000, 0, 0, 0}, /* 32k */ +#else {9600, 0, 0, 0}, /* 32k */ +#endif {IVAS_13k2, 0, 0, 0}, /* 48k */ #ifdef OMASA_BRATE_FIX {16000, 12500, 0, 0}, /* 64k */ @@ -2794,10 +2798,10 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {16000, IVAS_13k2, 0, 0}, /* 64k */ #endif {20000, 16000, 0, 0}, /* 80k */ - {IVAS_32k, 20000, 0, 0}, /* 96k */ - {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ - {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ - {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ + {IVAS_32k, 20000, 0, 0}, /* 96k */ + {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ + {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ + {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 2d0e26b52c..46bb05f7aa 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -1039,7 +1039,11 @@ void bandwidth_switching_detect( { st->bws_cnt1 = 0; } - else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB ) + else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB +#ifdef OMASA_BRATE // VE: !!!!! TBV // VE: this likely breaks BE in pure ISM !!! + && st->last_core_brate != 2450 +#endif + ) { st->bws_cnt1++; } -- GitLab From c9f90ac8595ebb48a2f52d756032f886ab285a14 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 23 Jan 2023 20:21:43 +0100 Subject: [PATCH 018/591] - comments - fix uninitialized value --- lib_com/options.h | 2 +- lib_dec/core_switching_dec.c | 2 +- lib_dec/ivas_cpe_dec.c | 4 ++++ lib_enc/ivas_cpe_enc.c | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6845dbbcaa..e84936ec19 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,7 @@ #define MASA_AND_OBJECTS_VE // VA: improve codec print-outs #define OMASA_BRATE /* VA: combined format bit-budget distribution */ -#define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more work needed +#define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more verification/tuning needed #define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files #endif diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 46bb05f7aa..3692d7653f 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -1040,7 +1040,7 @@ void bandwidth_switching_detect( st->bws_cnt1 = 0; } else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB -#ifdef OMASA_BRATE // VE: !!!!! TBV // VE: this likely breaks BE in pure ISM !!! +#ifdef OMASA_BRATE // VE: !!!!! this breaks BE in pure ISM && st->last_core_brate != 2450 #endif ) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 45b9ae6b0d..99f68de6fc 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -691,6 +691,10 @@ ivas_error create_cpe_dec( set_f( hCPE->prev_synth[n], 0, NS2SA( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ) ); } +#ifdef OMASA_BRATE + hCPE->brate_surplus = 0; +#endif + /*-----------------------------------------------------------------* * DFT stereo I/O Buffers: allocate and initialize *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index ac489f0f1f..b106ac72ad 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -843,6 +843,10 @@ ivas_error create_cpe_enc( hCPE->hFrontVad[0] = NULL; hCPE->hFrontVad[1] = NULL; +#ifdef OMASA_BRATE + hCPE->brate_surplus = 0; +#endif + /*-----------------------------------------------------------------* * Input memory buffer: allocate and initialize *-----------------------------------------------------------------*/ -- GitLab From 6711b5640735a7707cee13848e0582150a33023c Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 10:54:58 +0100 Subject: [PATCH 019/591] - introduce OMASA_BRATE_FIX_ALT --- lib_com/ivas_ism_config.c | 44 +++++++++++++++++++++++++++++++++++++-- lib_com/ivas_prot.h | 9 ++++++++ lib_com/options.h | 3 ++- lib_dec/ivas_core_dec.c | 12 +++++++++++ lib_dec/ivas_dec.c | 2 ++ lib_enc/ivas_core_enc.c | 40 +++++++++++++++++++++++++++++++++++ lib_enc/ivas_enc.c | 8 +++++++ 7 files changed, 115 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index b5d12c0da2..62f7b4bf4b 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -741,9 +741,47 @@ int32_t ivas_interformat_brate( /*--------------------------------------------------------------- * ivas_combined_format_brate_sanity() * - * + * Sanity check in combined format coding * ---------------------------------------------------------------*/ +#ifdef OMASA_BRATE_FIX_ALT +void ivas_combined_format_brate_sanity( + const int32_t element_brate, /* i : element bitrate */ + const int16_t core, /* i : core */ + int32_t *core_brate, /* i/o: core bitrate */ + int16_t *diff_nBits /* o : number of differential bits */ +) +{ + int16_t limit_high, nBits; + + /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by + low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget + for ACELP core-coding @12.8 kHz is too high */ + + if ( element_brate < ACELP_12k8_HIGH_LIMIT ) + { + limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; + nBits = (int16_t) ( *core_brate / FRAMES_PER_SEC ); + + *diff_nBits = nBits - limit_high; + if ( *diff_nBits > 0 ) + { + if ( core == TCX_20_CORE || core == TCX_10_CORE ) + { + *diff_nBits = 0; + } + else /* ACELP core */ + { + *core_brate -= ( *diff_nBits * FRAMES_PER_SEC ); + } + } + } + + return; +} + +#else + void ivas_combined_format_brate_sanity( const int32_t element_brate, /* i : element bitrate */ const int32_t brate_surplus, /* i : surplus bitrate */ @@ -762,7 +800,8 @@ void ivas_combined_format_brate_sanity( nBits_CPE += (int16_t) ( brate_surplus / FRAMES_PER_SEC ); nBits_CPE -= ( WB_TBE_0k35 / FRAMES_PER_SEC ); nBits_CPE -= nb_bits_metadata[1]; - nBits_CPE -= 14; + nBits_CPE -= ( IVAS_FORMAT_SIGNALING_NBITS_SBA + 1 ); + nBits_CPE -= 10; *diff_nBits = 0; if ( nchan_ism == 1 && element_brate < ACELP_12k8_HIGH_LIMIT ) @@ -780,3 +819,4 @@ void ivas_combined_format_brate_sanity( } #endif #endif +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 00298890bd..2308525dc6 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5179,6 +5179,14 @@ int32_t ivas_interformat_brate( ); #ifdef OMASA_BRATE_FIX +#ifdef OMASA_BRATE_FIX_ALT +void ivas_combined_format_brate_sanity( + const int32_t element_brate, /* i : element bitrate */ + const int16_t core, /* i : core */ + int32_t *core_brate, /* i/o: core bitrate */ + int16_t *diff_nBits /* o : number of differential bits */ +); +#else void ivas_combined_format_brate_sanity( const int32_t element_brate, /* i : element bitrate */ const int32_t brate_surplus, /* i : surplus bitrate */ @@ -5188,6 +5196,7 @@ void ivas_combined_format_brate_sanity( ); #endif #endif +#endif ISM_MODE ivas_omasa_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ diff --git a/lib_com/options.h b/lib_com/options.h index e84936ec19..02f5388612 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -164,6 +164,7 @@ #define MASA_AND_OBJECTS_VE // VA: improve codec print-outs #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more verification/tuning needed +#define OMASA_BRATE_FIX_ALT #define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files #endif diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index e5cc40cd47..a9f3d1cb85 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -265,6 +265,18 @@ ivas_error ivas_core_dec( } } + +#ifdef OMASA_BRATE_FIX_ALT + /*------------------------------------------------------------------* + * Sanity check in combined format coding + *-----------------------------------------------------------------*/ + + if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 ) + { + ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, &( sts[0]->core_brate ), &tmps ); + } +#endif + /*------------------------------------------------------------------* * Core Decoding *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index d0e134f727..b12aadc91d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -598,8 +598,10 @@ ivas_error ivas_dec( st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); #endif +#ifndef OMASA_BRATE_FIX_ALT #ifdef OMASA_BRATE_FIX ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &n /* temp */ ); +#endif #endif /* Audio signal decoding */ diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 1ee672efed..78a9f2af1b 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -102,6 +102,9 @@ ivas_error ivas_core_enc( float tdm_lspQ_PCh[M], tdm_lsfQ_PCh[M]; int16_t last_element_mode, tdm_Pitch_reuse_flag; int32_t element_brate, last_element_brate, input_Fs; +#ifdef OMASA_BRATE_FIX_ALT + int16_t diff_nBits; +#endif ivas_error error; push_wmops( "ivas_core_enc" ); @@ -187,6 +190,27 @@ ivas_error ivas_core_enc( } } + +#ifdef OMASA_BRATE_FIX_ALT + /*------------------------------------------------------------------* + * Sanity check in combined format coding + *-----------------------------------------------------------------*/ + + diff_nBits = 0; + if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 ) + { + ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, &( sts[0]->core_brate ), &diff_nBits ); + } + +#ifdef DEBUG_VA + if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT ) + { + diff_nBits = max( diff_nBits, 0 ); + dbgwrite( &diff_nBits, 2, 1, 960, "res/_diff" ); + } +#endif +#endif + /*---------------------------------------------------------------------* * Core Encoding *---------------------------------------------------------------------*/ @@ -405,6 +429,22 @@ ivas_error ivas_core_enc( } } +#ifdef OMASA_BRATE_FIX_ALT + /*------------------------------------------------------------------* + * Write potentially unused bits in combined format coding + *-----------------------------------------------------------------*/ + + if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 ) + { + while ( diff_nBits > 0 ) + { + n = min( diff_nBits, 16 ); + push_indice( sts[0]->hBstr, IND_UNUSED, 0, n ); + diff_nBits -= n; + } + } +#endif + #ifdef DEBUG_MODE_INFO for ( n = 0; n < n_CoreChannels; n++ ) diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 3bfa8bcfcc..554a6bb8d6 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -313,8 +313,10 @@ ivas_error ivas_enc( #ifndef OMASA_BRATE float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; #endif +#ifndef OMASA_BRATE_FIX_ALT #ifdef OMASA_BRATE_FIX int16_t diff_nBits = 0; +#endif #endif float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; @@ -383,9 +385,11 @@ ivas_error ivas_enc( /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_enc( st_ivas ); +#ifndef OMASA_BRATE_FIX_ALT #ifdef OMASA_BRATE_FIX ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &diff_nBits ); #endif +#endif #else if ( st_ivas->hQMetaData != NULL ) { @@ -445,7 +449,10 @@ ivas_error ivas_enc( ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); // VE2Nokia: this condition is unnecessary } +#ifndef OMASA_BRATE_FIX_ALT #ifdef OMASA_BRATE_FIX + diff_nBits = max( diff_nBits, 0 ); + //dbgwrite( &diff_nBits, 2, 1, 960, "res/_diff" ); if ( st_ivas->nchan_ism == 1 && st_ivas->hCPE[0]->element_brate < ACELP_12k8_HIGH_LIMIT && diff_nBits > 0 ) { while ( diff_nBits > 0 ) @@ -456,6 +463,7 @@ ivas_error ivas_enc( } } #endif +#endif #ifdef DEBUG_VA if ( st_ivas->hSCE[0] != NULL ) -- GitLab From 751cc3904f07bbe09069ea2416f6c8c0e19da552 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 14:01:32 +0100 Subject: [PATCH 020/591] - introduce OMASA_BRATE_TD - fix for 2ISM @64 kbps in ROM table --- lib_com/ivas_rom_com.c | 2 +- lib_com/options.h | 3 ++- lib_dec/ivas_cpe_dec.c | 3 +++ lib_dec/ivas_stereo_switching_dec.c | 4 +++ lib_dec/ivas_stereo_td_dec.c | 42 +++++++++++++++++++++++++++++ lib_enc/ivas_cpe_enc.c | 11 ++++++++ lib_enc/ivas_stereo_td_enc.c | 7 +++++ 7 files changed, 70 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index d9b341460d..90c962158d 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2793,7 +2793,7 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = #endif {IVAS_13k2, 0, 0, 0}, /* 48k */ #ifdef OMASA_BRATE_FIX - {16000, 12500, 0, 0}, /* 64k */ + {16000, 12000, 0, 0}, /* 64k */ #else {16000, IVAS_13k2, 0, 0}, /* 64k */ #endif diff --git a/lib_com/options.h b/lib_com/options.h index 02f5388612..033be97812 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -165,6 +165,7 @@ #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more verification/tuning needed #define OMASA_BRATE_FIX_ALT +#define OMASA_BRATE_TD // support of bitrate adaptation n TD stereo - work in progress #define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 99f68de6fc..356789d07f 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -296,6 +296,9 @@ ivas_error ivas_cpe_dec( /* signal bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); +#ifdef OMASA_BRATE_TD + sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); +#endif if ( st_ivas->hQMetaData != NULL ) { sts[1]->bits_frame_channel -= st_ivas->hQMetaData->metadata_max_bits; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 73ca81c997..bed57060a1 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -767,7 +767,11 @@ ivas_error stereo_memory_dec( if ( hCPE->hCoreCoder[0]->bfi == 0 ) { st = hCPE->hCoreCoder[1]; +#ifdef OMASA_BRATE_TD + hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate + hCPE->brate_surplus, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + ( hCPE->brate_surplus / FRAMES_PER_SEC ) - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS ); +#else hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS ); +#endif if ( hCPE->hStereoTD->tdm_LRTD_flag ) { diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index d636d12bd7..5ed7a4ed4b 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -94,10 +94,19 @@ void tdm_configure_dec( int16_t tdm_tmp_SM_LRTD_flag; int16_t mod_ct, core, bits_offset; int16_t idx_LRTD_pri_side, tdm_inst_ratio_idx; +#ifdef OMASA_BRATE_TD + int32_t element_brate_adapt; + int16_t bstr_last_pos; +#endif hStereoTD = hCPE->hStereoTD; sts = hCPE->hCoreCoder; +#ifdef OMASA_BRATE_TD + element_brate_adapt = hCPE->element_brate + hCPE->brate_surplus; + bstr_last_pos = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); +#endif + /*----------------------------------------------------------------* * Decode CoreCoder signaling *----------------------------------------------------------------*/ @@ -123,7 +132,11 @@ void tdm_configure_dec( /* Get few parameters needed to decode the bitrate allocated to each channel */ /* Get the coder_type of the secondary channel (last parameter on 2 bits) */ +#ifdef OMASA_BRATE_TD + sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - nb_bits_metadata - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING ); +#else sts[1]->coder_type = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING ), TDM_SECONDARY_SIGNALLING ); +#endif /* Get the LRTD config flag: 1 = LRTD configuration, favor closer bitrate per channel; 0 = Pri/Sec configuration, bitrates linked wrt. the mono */ @@ -151,19 +164,31 @@ void tdm_configure_dec( *----------------------------------------------------------------*/ /* Get the correlation ratio */ +#ifdef OMASA_BRATE_TD + *tdm_ratio_idx = get_indice_st( sts[0], element_brate_adapt, (int16_t) ( bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS ); +#else *tdm_ratio_idx = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS ); +#endif hStereoTD->tdm_use_IAWB_Ave_lpc = 0; if ( sts[1]->coder_type == INACTIVE ) { /* Get the flag on the LPC reusage type (primary channel of ave LPC */ +#ifdef OMASA_BRATE_TD + hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS ); +#else hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS ); +#endif hStereoTD->tdm_lp_reuse_flag = 1; } else { /* Get the flag on the LPC reusage */ +#ifdef OMASA_BRATE_TD + hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS ); +#else hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS ); +#endif } sts[0]->tdm_LRTD_flag = hStereoTD->tdm_LRTD_flag; /* the flag was already read in function stereo_memory_dec() */ @@ -219,7 +244,11 @@ void tdm_configure_dec( int16_t tmpS = 20; if ( hStereoTD->tdm_LRTD_flag == 0 ) { +#ifdef OMASA_BRATE_TD + tmpS = get_indice_st( sts[0], element_brate_adapt, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); +#else tmpS = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); +#endif } hCPE->hStereoDftDmx->targetGain = usdequant( tmpS, STEREO_TCA_GDMIN, STEREO_TCA_GDSTEP ); hCPE->hStereoDftDmx->targetGain = powf( 10, hCPE->hStereoDftDmx->targetGain ); @@ -228,9 +257,15 @@ void tdm_configure_dec( { if ( hStereoTD->tdm_LRTD_flag == 0 ) { +#ifdef OMASA_BRATE_TD + hCPE->hStereoTCA->refChanIndx = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS, STEREO_BITS_TCA_CHAN ); + hCPE->hStereoTCA->indx_ica_NCShift = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN, STEREO_BITS_TCA_CORRSTATS ); + hCPE->hStereoTCA->indx_ica_gD = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD ); +#else hCPE->hStereoTCA->refChanIndx = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS ), STEREO_BITS_TCA_CHAN ); hCPE->hStereoTCA->indx_ica_NCShift = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN ), STEREO_BITS_TCA_CORRSTATS ); hCPE->hStereoTCA->indx_ica_gD = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); +#endif } else { @@ -265,7 +300,14 @@ void tdm_configure_dec( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ +#ifdef OMASA_BRATE_TD + tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), + &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); +#else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); +#endif return; } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index b106ac72ad..518b5262bf 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -166,6 +166,14 @@ ivas_error ivas_cpe_enc( if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL ) { + +#ifdef OMASA_BRATE_TD // VE: !!!!! temp hack only + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + hCPE->stereo_mode_cmdl = IVAS_CPE_DFT; + } +#endif + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } @@ -396,6 +404,9 @@ ivas_error ivas_cpe_enc( /* signal the bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); +#ifdef OMASA_BRATE_TD + sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); +#endif if ( st_ivas->hQMetaData != NULL ) { sts[1]->bits_frame_channel -= st_ivas->hQMetaData->metadata_max_bits; diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 4823e2b5f1..4858131c34 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -452,7 +452,14 @@ void tdm_configure_enc( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ +#ifdef OMASA_BRATE_TD + tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), + &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); +#else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); +#endif if ( sts[0]->GSC_IVAS_mode > 0 && sts[0]->total_brate <= STEREO_GSC_BIT_RATE_ALLOC ) { -- GitLab From 3f8246afb1a1616ac64b390de954f4dee22f08cd Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 14:43:30 +0100 Subject: [PATCH 021/591] debugging code to force TD stereo --- lib_enc/ivas_cpe_enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 518b5262bf..5e87ea5247 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -171,6 +171,7 @@ ivas_error ivas_cpe_enc( if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { hCPE->stereo_mode_cmdl = IVAS_CPE_DFT; + //hCPE->stereo_mode_cmdl = IVAS_CPE_TD; } #endif -- GitLab From a40cb66218a9a26240a7cb123033aa7e1a05c44b Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 16:08:14 +0100 Subject: [PATCH 022/591] - patch for MDCT stereo 2 x TCX10_CORE (deactivated) --- lib_enc/ivas_masa_enc.c | 2 +- lib_enc/ivas_stereo_mdct_core_enc.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 5ae88cead3..7986196a08 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2160,7 +2160,7 @@ static int16_t index_slice_enum( i = 0; while ( i <= x ) { - if ( valid( i, 7, no_ism - 1 ) ) + if ( valid_ratio_index( i, 7, no_ism - 1 ) ) { index++; } diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index f97d80e823..46f524fa4b 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -175,6 +175,15 @@ void stereo_mdct_core_enc( sts[0]->hTcxEnc->tfm_mem = sts[1]->hTcxEnc->tfm_mem = sqrtf( 0.5f * ( sts[0]->hTcxEnc->tfm_mem * sts[0]->hTcxEnc->tfm_mem + sts[1]->hTcxEnc->tfm_mem * sts[1]->hTcxEnc->tfm_mem ) ); /* RMS */ sts[0]->hTcxEnc->tcxltp_norm_corr_past = sts[1]->hTcxEnc->tcxltp_norm_corr_past = 0.5f * ( sts[0]->hTcxEnc->tcxltp_norm_corr_past + sts[1]->hTcxEnc->tcxltp_norm_corr_past ); + +#if 0 + if ( sts[0]->bits_frame_channel + sts[1]->bits_frame_channel - meta_bits < 495 ) + { + sts[0]->hTranDet->transientDetector.bIsAttackPresent = 0; + sts[1]->hTranDet->transientDetector.bIsAttackPresent = 0; + } +#endif + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -- GitLab From 7972e6ea96fe1d3a9c2af88749d4d1413cded808 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 16:10:20 +0100 Subject: [PATCH 023/591] - add 'ism_mode' parameter to the ivas_interformat_brate() - remove patch for MDCT stereo 2 x TCX10_CORE (deactivated) - rename function valid() to valid_ratio_index() + formatting --- lib_com/ivas_ism_config.c | 11 ++++++- lib_com/ivas_masa_com.c | 57 +++++++++++++++++++++++++-------- lib_com/ivas_prot.h | 31 ++++++++++-------- lib_dec/ivas_masa_dec.c | 2 +- lib_dec/ivas_omasa_dec.c | 4 +-- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 2 +- lib_enc/ivas_sce_enc.c | 2 +- 8 files changed, 76 insertions(+), 35 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 62f7b4bf4b..8774bd9105 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -683,9 +683,11 @@ ISM_MODE ivas_omasa_ism_mode_select( #define GAMMA_ISM_LOW_IMP 0.8f #define GAMMA_ISM_MEDIUM_IMP 1.2f #define GAMMA_ISM_HIGH_IMP 1.4f +#define GAMMA_ISM_HIGH_IMP2 1.35f /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( + const ISM_MODE ism_mode, /* i : ISM mode */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ ) @@ -709,7 +711,14 @@ int32_t ivas_interformat_brate( } else /* ISM_HIGH_IMP */ { - nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP ); + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP2 ); + } + else + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP ); + } } limit_low = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC; diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 920985e81d..9211ec057d 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -422,17 +422,20 @@ void masa_sample_rate_band_correction( return; } + #ifdef MASA_AND_OBJECTS /*--------------------------------------------------------------- - * valid() + * valid_ratio_index() * * Checking validity of the index of an ISM ratio index vector, * within the indexing function. *---------------------------------------------------------------*/ -int16_t valid( /* o: valid or not 1/0 */ - int16_t index, /* i: index to be checked */ - int16_t K, /* i: L1 norm to check against */ - int16_t len /* i: vector length */ + +/*! r: valid or not 1/0 */ +int16_t valid_ratio_index( + int16_t index, /* i : index to be checked */ + const int16_t K, /* i : L1 norm to check against */ + const int16_t len /* i : vector length */ ) { int16_t out; @@ -462,39 +465,47 @@ int16_t valid( /* o: valid or not 1/0 */ { out = 0; } + return out; } + /*--------------------------------------------------------------- * reconstruct_ism_ratios() * * Obtains ISM ratio values from the quantized indexes *---------------------------------------------------------------*/ + void reconstruct_ism_ratios( - int16_t *ratio_ism_idx, /* i: index vector */ - int16_t n_ism, /* i: number of components/objects */ - float step, /* i: quantization step */ - float *q_energy_ratio_ism /* o: reconstructed ISM values */ + int16_t *ratio_ism_idx, /* i : index vector */ + int16_t n_ism, /* i : number of components/objects */ + float step, /* i : quantization step */ + float *q_energy_ratio_ism /* o : reconstructed ISM values */ ) { int16_t i; float sum; + sum = 0; for ( i = 0; i < n_ism - 1; i++ ) { q_energy_ratio_ism[i] = ratio_ism_idx[i] * step; sum += q_energy_ratio_ism[i]; } + q_energy_ratio_ism[n_ism - 1] = 1.0f - sum; + return; } + /*--------------------------------------------------------------- * modify_masa_energy_ratios() * * Updates energy ratios by taking into account the MASA content contribution * to the total audio scene *---------------------------------------------------------------*/ + void modify_masa_energy_ratios( IVAS_QMETADATA_HANDLE hQMetaData /* i/o: Metadata handle */ ) @@ -519,13 +530,18 @@ void modify_masa_energy_ratios( } } } + + return; } + /*--------------------------------------------------------------- * ivas_get_stereo_panning_gains() * * + *---------------------------------------------------------------*/ + void ivas_get_stereo_panning_gains( float aziDeg, float eleDeg, @@ -559,13 +575,17 @@ void ivas_get_stereo_panning_gains( panningGains[0] = sqrtf( A3 ); panningGains[1] = sqrtf( 1.0f - A3 ); } + + return; } + /*--------------------------------------------------------------- * distribute_evenly_ism() * * Obtain ISM ratio indexes for even content distribution bbetween objects *---------------------------------------------------------------*/ + void distribute_evenly_ism( int16_t *idx, /* o: index values */ int16_t K, /* i: sum of indexes */ @@ -574,13 +594,16 @@ void distribute_evenly_ism( { int16_t i; int16_t sum; + sum = 0; for ( i = 0; i < no_ism; i++ ) { idx[i] = (int16_t) ( K / no_ism ); sum += idx[i]; } + assert( sum <= K ); + i = 0; while ( sum < K ) { @@ -592,19 +615,24 @@ void distribute_evenly_ism( sum++; i++; } + + return; } + /*--------------------------------------------------------------- * calculate_cpe_brate_MASA_ISM() * * Calculates bitrate for MASA_ISM mode that is not used for separated objects, * * but for the CPE part (metadata included) *---------------------------------------------------------------*/ -int32_t /* o: cpe bitrate value */ -calculate_cpe_brate_MASA_ISM( - ISM_MODE ism_mode, /* i: ism mode */ - int32_t ivas_total_brate, /* i: total bit rate for IVAS */ - int16_t n_ism ) /* i: number of objects */ + +/*! r: CPE bitrate value */ +int32_t calculate_cpe_brate_MASA_ISM( + const ISM_MODE ism_mode, /* i : ism mode */ + const int32_t ivas_total_brate, /* i : total bit rate for IVAS */ + const int16_t n_ism /* i : number of objects */ +) { int32_t cpe_brate; int16_t k, sce_id; @@ -632,6 +660,7 @@ calculate_cpe_brate_MASA_ISM( { cpe_brate = ivas_total_brate; } + return cpe_brate; } #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2308525dc6..d2101fe446 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4535,10 +4535,11 @@ void ivas_masa_set_elements( ); #ifdef MASA_AND_OBJECTS -int16_t valid( - int16_t index, - int16_t K, - int16_t len +/*! r: valid or not 1/0 */ +int16_t valid_ratio_index( + int16_t index, /* i : index to be checked */ + const int16_t K, /* i : L1 norm to check against */ + const int16_t len /* i : vector length */ ); void reconstruct_ism_ratios( @@ -4567,16 +4568,17 @@ int16_t ivas_qmetadata_encode_extended_gr_length( const int16_t gr_param); void ivas_qmetadata_encode_extended_gr( - BSTR_ENC_HANDLE hMetaData, /* i/o: q_metadata handle */ - const uint16_t value, /* i : value to be encoded */ - const uint16_t alphabet_size, /* i : alphabet size */ - const int16_t gr_param); /* i : GR order */ - -int32_t /* o: cpe bitrate value */ -calculate_cpe_brate_MASA_ISM( - ISM_MODE ism_mode, /* i: ism mode */ - int32_t ivas_total_brate, /* i: total bit rate for IVAS */ - int16_t n_ism ); /* i: number of objects */ + BSTR_ENC_HANDLE hMetaData, /* i/o: q_metadata handle */ + const uint16_t value, /* i : value to be encoded */ + const uint16_t alphabet_size, /* i : alphabet size */ + const int16_t gr_param); /* i : GR order */ + +/*! r: CPE bitrate value */ +int32_t calculate_cpe_brate_MASA_ISM( + const ISM_MODE ism_mode, /* i : ism mode */ + const int32_t ivas_total_brate, /* i : total bit rate for IVAS */ + const int16_t n_ism /* i : number of objects */ +); #endif void ivas_masa_set_coding_config( @@ -5174,6 +5176,7 @@ void set_ism_importance_interformat( /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( + const ISM_MODE ism_mode, /* i : ISM mode */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index db86d97fd9..83c194dbd2 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1654,7 +1654,7 @@ static void decode_index_slice( j = 0; while ( index >= 0 ) { - if ( valid( j, K, no_ism - 1 ) ) + if ( valid_ratio_index( j, K, no_ism - 1 ) ) { index--; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index eacc84ef46..133369e94c 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -59,7 +59,7 @@ void ivas_set_surplus_brate_dec( if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - *ism_total_brate = ivas_interformat_brate( st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + *ism_total_brate = ivas_interformat_brate( st_ivas->ism_mode, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - *ism_total_brate; @@ -90,7 +90,7 @@ void ivas_set_surplus_brate_dec( { st_ivas->hSCE[n]->element_brate = element_brate[n]; - *ism_total_brate += ivas_interformat_brate( st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp ); + *ism_total_brate += ivas_interformat_brate( st_ivas->ism_mode, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp ); } st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 78997e6e79..d2a073d2b8 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -901,7 +901,7 @@ ivas_error ivas_ism_metadata_enc( *ism_total_brate = 0; for ( ch = 0; ch < num_obj; ch++ ) { - *ism_total_brate += ivas_interformat_brate( hSCE[ch]->element_brate, ism_imp[ch] ); + *ism_total_brate += ivas_interformat_brate( ism_mode, hSCE[ch]->element_brate, ism_imp[ch] ); } ism_metadata_flag_global = 1; } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index b7258bff9f..8ef74b4e3a 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -499,7 +499,7 @@ void ivas_set_surplus_brate_enc( { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( st_ivas->ism_mode, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); /* note: ISM st->total_brate is iset in ivas_sce_enc() */ } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 7b986c61f8..de1c0466ce 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -220,7 +220,7 @@ ivas_error ivas_sce_enc( { set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); - st->total_brate = ivas_interformat_brate( hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ) - nb_bits_metadata * FRAMES_PER_SEC; + st->total_brate = ivas_interformat_brate( st_ivas->ism_mode, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ) - nb_bits_metadata * FRAMES_PER_SEC; } #endif -- GitLab From fc2c6e4cba44208ab658396285775e2fb0cbdd6d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 17:14:54 +0100 Subject: [PATCH 024/591] - debug code --- lib_com/options.h | 2 +- lib_enc/ivas_omasa_enc.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 033be97812..faa13745cd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,7 +165,7 @@ #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more verification/tuning needed #define OMASA_BRATE_FIX_ALT -#define OMASA_BRATE_TD // support of bitrate adaptation n TD stereo - work in progress +#define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo - work in progress #define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files #endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 8ef74b4e3a..5ea2b75a3e 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -476,8 +476,11 @@ void ivas_omasa_enc( /* Estimate energies and ratios */ ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); - } +#ifdef DEBUG_VA + dbgwrite( &selected_object, 2, 1, input_frame, "res/selected_object" ); +#endif + } /* Downmix */ ivas_omasa_dmx( data_in_f, data_out_f, input_frame, nchan_transport, nchan_ism, hIsmMeta, hOMasa->prev_object_dm_gains, hOMasa->interpolator ); -- GitLab From 433c2e2f68aaec05ee753fe6c0836ca4ebcfa9b6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 19:59:55 +0100 Subject: [PATCH 025/591] - updates within OMASA_BRATE_TD - remove the encoder hack within OMASA_BRATE_TD --- lib_dec/ivas_stereo_td_dec.c | 8 ++++++-- lib_enc/ivas_cpe_enc.c | 9 --------- lib_enc/ivas_stereo_td_enc.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 5ed7a4ed4b..2e6e447bd7 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -133,7 +133,7 @@ void tdm_configure_dec( /* Get few parameters needed to decode the bitrate allocated to each channel */ /* Get the coder_type of the secondary channel (last parameter on 2 bits) */ #ifdef OMASA_BRATE_TD - sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - nb_bits_metadata - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING ); + sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING ); #else sts[1]->coder_type = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING ), TDM_SECONDARY_SIGNALLING ); #endif @@ -245,7 +245,7 @@ void tdm_configure_dec( if ( hStereoTD->tdm_LRTD_flag == 0 ) { #ifdef OMASA_BRATE_TD - tmpS = get_indice_st( sts[0], element_brate_adapt, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); + tmpS = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD ); #else tmpS = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); #endif @@ -285,7 +285,11 @@ void tdm_configure_dec( #endif /* set the BW of the secondary channel */ +#ifdef OMASA_BRATE_TD + if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel > IVAS_16k4 / FRAMES_PER_SEC ) +#else if ( hStereoTD->tdm_LRTD_flag && hCPE->element_brate > IVAS_13k2 ) +#endif { /* set BW of the secondary channel in LRTD stereo mode as the BW of the primary channel at higher bitrates */ sts[1]->bwidth = sts[0]->bwidth; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 5e87ea5247..536272a94c 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -166,15 +166,6 @@ ivas_error ivas_cpe_enc( if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL ) { - -#ifdef OMASA_BRATE_TD // VE: !!!!! temp hack only - if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) - { - hCPE->stereo_mode_cmdl = IVAS_CPE_DFT; - //hCPE->stereo_mode_cmdl = IVAS_CPE_TD; - } -#endif - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 4858131c34..c42b2fe748 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -419,6 +419,23 @@ void tdm_configure_enc( sts[1]->coder_type = GENERIC; } +#ifdef OMASA_BRATE_TD + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) + { + sts[1]->coder_type = INACTIVE; + hStereoTD->tdm_Pitch_reuse_flag = 0; + hStereoTD->tdm_lp_reuse_flag = 1; + } + + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 14700 ) + { + if ( sts[0]->coder_type == TRANSITION ) + { + sts[0]->coder_type = GENERIC; + } + } +#endif + mod_ct = AUDIO; if ( hCPE->element_brate < IVAS_24k4 ) { @@ -830,4 +847,6 @@ void stereo_tdm_prep_dwnmx( } } } + + return; } -- GitLab From b8248b67c42e26e39528109e3bfb1b982d1ea498 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 20:18:37 +0100 Subject: [PATCH 026/591] merge OMASA_BRATE_FIX and OMASA_BRATE_FIX_ALT into OMASA_BRATE --- lib_com/ivas_ism_config.c | 41 ------------------------------------ lib_com/ivas_prot.h | 13 ------------ lib_com/ivas_rom_com.c | 4 ++-- lib_com/options.h | 4 +--- lib_dec/core_switching_dec.c | 2 +- lib_dec/ivas_core_dec.c | 3 +-- lib_dec/ivas_dec.c | 5 ----- lib_dec/ivas_init_dec.c | 2 +- lib_enc/ivas_core_enc.c | 7 +++--- lib_enc/ivas_enc.c | 26 ----------------------- 10 files changed, 9 insertions(+), 98 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 8774bd9105..215c553168 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -743,17 +743,14 @@ int32_t ivas_interformat_brate( return element_brate_out; } -#endif -#ifdef OMASA_BRATE_FIX /*--------------------------------------------------------------- * ivas_combined_format_brate_sanity() * * Sanity check in combined format coding * ---------------------------------------------------------------*/ -#ifdef OMASA_BRATE_FIX_ALT void ivas_combined_format_brate_sanity( const int32_t element_brate, /* i : element bitrate */ const int16_t core, /* i : core */ @@ -789,43 +786,5 @@ void ivas_combined_format_brate_sanity( return; } -#else - -void ivas_combined_format_brate_sanity( - const int32_t element_brate, /* i : element bitrate */ - const int32_t brate_surplus, /* i : surplus bitrate */ - int16_t nb_bits_metadata[], /* i/o: number of metadata bits */ - const int16_t nchan_ism, /* i : number of objects */ - int16_t *diff_nBits /* o : number of differential bits */ -) -{ - /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by - low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget - for core-coding @12.8 kHz is too high => increase the ISM low-rate mode bit-rate */ - - int16_t nBits_CPE; - nBits_CPE = (int16_t) ( element_brate / FRAMES_PER_SEC ); - nBits_CPE -= nb_bits_metadata[0]; - nBits_CPE += (int16_t) ( brate_surplus / FRAMES_PER_SEC ); - nBits_CPE -= ( WB_TBE_0k35 / FRAMES_PER_SEC ); - nBits_CPE -= nb_bits_metadata[1]; - nBits_CPE -= ( IVAS_FORMAT_SIGNALING_NBITS_SBA + 1 ); - nBits_CPE -= 10; - - *diff_nBits = 0; - if ( nchan_ism == 1 && element_brate < ACELP_12k8_HIGH_LIMIT ) - { - int16_t limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; - - *diff_nBits = nBits_CPE - limit_high; - if ( *diff_nBits > 0 ) - { - nb_bits_metadata[0] += *diff_nBits; - } - } - - return; -} -#endif #endif #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d2101fe446..135c3a6321 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5181,24 +5181,12 @@ int32_t ivas_interformat_brate( const int16_t ism_imp /* i : ISM importance flag */ ); -#ifdef OMASA_BRATE_FIX -#ifdef OMASA_BRATE_FIX_ALT void ivas_combined_format_brate_sanity( const int32_t element_brate, /* i : element bitrate */ const int16_t core, /* i : core */ int32_t *core_brate, /* i/o: core bitrate */ int16_t *diff_nBits /* o : number of differential bits */ ); -#else -void ivas_combined_format_brate_sanity( - const int32_t element_brate, /* i : element bitrate */ - const int32_t brate_surplus, /* i : surplus bitrate */ - int16_t nb_bits_metadata[], /* i/o: number of metadata bits */ - const int16_t nchan_ism, /* i : number of objects */ - int16_t *diff_nBits /* o : number of differential bits */ -); -#endif -#endif #endif ISM_MODE ivas_omasa_ism_mode_select( @@ -5218,7 +5206,6 @@ void ivas_masa_ism_data_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); - void preProcessStereoTransportsForMovedObjects( Decoder_Struct* st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 90c962158d..b42fb64fc4 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2786,13 +2786,13 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {0, 0, 0, 0}, /* 13k2 */ {0, 0, 0, 0}, /* 16k4 */ {9600, 0, 0, 0}, /* 24k4 */ -#ifdef OMASA_BRATE_FIX +#ifdef OMASA_BRATE {11000, 0, 0, 0}, /* 32k */ #else {9600, 0, 0, 0}, /* 32k */ #endif {IVAS_13k2, 0, 0, 0}, /* 48k */ -#ifdef OMASA_BRATE_FIX +#ifdef OMASA_BRATE {16000, 12000, 0, 0}, /* 64k */ #else {16000, IVAS_13k2, 0, 0}, /* 64k */ diff --git a/lib_com/options.h b/lib_com/options.h index faa13745cd..9ce2430088 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,9 +163,7 @@ #define MASA_AND_OBJECTS_VE // VA: improve codec print-outs #define OMASA_BRATE /* VA: combined format bit-budget distribution */ -#define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more verification/tuning needed -#define OMASA_BRATE_FIX_ALT -#define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo - work in progress +#define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo #define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files #endif diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 3692d7653f..8818e0b3ff 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -1040,7 +1040,7 @@ void bandwidth_switching_detect( st->bws_cnt1 = 0; } else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB -#ifdef OMASA_BRATE // VE: !!!!! this breaks BE in pure ISM +#ifdef OMASA_BRATE // VE: !!!!! this breaks BE in pure ISM unless FIX_299_ISM_BWS is activated && st->last_core_brate != 2450 #endif ) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index a9f3d1cb85..777cc74beb 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -265,8 +265,7 @@ ivas_error ivas_core_dec( } } - -#ifdef OMASA_BRATE_FIX_ALT +#ifdef OMASA_BRATE /*------------------------------------------------------------------* * Sanity check in combined format coding *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index b12aadc91d..df5cfb4253 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -597,11 +597,6 @@ ivas_error ivas_dec( ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); -#endif -#ifndef OMASA_BRATE_FIX_ALT -#ifdef OMASA_BRATE_FIX - ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &n /* temp */ ); -#endif #endif /* Audio signal decoding */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index dcaf13dbd1..2c2a26b315 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -983,7 +983,7 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); -#ifdef OMASA_BRATE // VE: just 'ism_imp' parameter is needed - what about the other parameters? -> TBV +#ifdef OMASA_BRATE if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 78a9f2af1b..c4f4b376c6 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -102,7 +102,7 @@ ivas_error ivas_core_enc( float tdm_lspQ_PCh[M], tdm_lsfQ_PCh[M]; int16_t last_element_mode, tdm_Pitch_reuse_flag; int32_t element_brate, last_element_brate, input_Fs; -#ifdef OMASA_BRATE_FIX_ALT +#ifdef OMASA_BRATE int16_t diff_nBits; #endif ivas_error error; @@ -190,8 +190,7 @@ ivas_error ivas_core_enc( } } - -#ifdef OMASA_BRATE_FIX_ALT +#ifdef OMASA_BRATE /*------------------------------------------------------------------* * Sanity check in combined format coding *-----------------------------------------------------------------*/ @@ -429,7 +428,7 @@ ivas_error ivas_core_enc( } } -#ifdef OMASA_BRATE_FIX_ALT +#ifdef OMASA_BRATE /*------------------------------------------------------------------* * Write potentially unused bits in combined format coding *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 554a6bb8d6..be021a9493 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -312,11 +312,6 @@ ivas_error ivas_enc( { #ifndef OMASA_BRATE float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; -#endif -#ifndef OMASA_BRATE_FIX_ALT -#ifdef OMASA_BRATE_FIX - int16_t diff_nBits = 0; -#endif #endif float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; @@ -385,11 +380,6 @@ ivas_error ivas_enc( /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_enc( st_ivas ); -#ifndef OMASA_BRATE_FIX_ALT -#ifdef OMASA_BRATE_FIX - ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &diff_nBits ); -#endif -#endif #else if ( st_ivas->hQMetaData != NULL ) { @@ -449,22 +439,6 @@ ivas_error ivas_enc( ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); // VE2Nokia: this condition is unnecessary } -#ifndef OMASA_BRATE_FIX_ALT -#ifdef OMASA_BRATE_FIX - diff_nBits = max( diff_nBits, 0 ); - //dbgwrite( &diff_nBits, 2, 1, 960, "res/_diff" ); - if ( st_ivas->nchan_ism == 1 && st_ivas->hCPE[0]->element_brate < ACELP_12k8_HIGH_LIMIT && diff_nBits > 0 ) - { - while ( diff_nBits > 0 ) - { - i = min( diff_nBits, 16 ); - push_indice( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, IND_UNUSED, 0, i ); - diff_nBits -= i; - } - } -#endif -#endif - #ifdef DEBUG_VA if ( st_ivas->hSCE[0] != NULL ) { -- GitLab From cb723a90e022e1675c1f977824de7ed691ca658e Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 24 Jan 2023 23:39:10 +0100 Subject: [PATCH 027/591] - FIX_24k4_ISM1_MODE - activate DISC mode at 24.4 kbps 1 object --- lib_com/ivas_ism_config.c | 16 +++++++++++++++- lib_com/options.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 215c553168..dc715e8c69 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -600,14 +600,20 @@ ISM_MODE ivas_omasa_ism_mode_select( switch ( no_obj ) { case 1: +#ifdef FIX_24k4_ISM1_MODE + if ( ivas_total_brate >= IVAS_24k4 ) +#else if ( ivas_total_brate >= IVAS_32k ) +#endif { ism_mode = ISM_MASA_MODE_DISC; } +#ifndef FIX_24k4_ISM1_MODE else if ( ivas_total_brate >= IVAS_24k4 ) { ism_mode = ISM_MASA_MODE_PARAM; } +#endif else { ism_mode = ISM_MODE_NONE; @@ -681,6 +687,7 @@ ISM_MODE ivas_omasa_ism_mode_select( * ---------------------------------------------------------------*/ #define GAMMA_ISM_LOW_IMP 0.8f +#define GAMMA_ISM_LOW_IMP2 0.9f #define GAMMA_ISM_MEDIUM_IMP 1.2f #define GAMMA_ISM_HIGH_IMP 1.4f #define GAMMA_ISM_HIGH_IMP2 1.35f @@ -703,7 +710,14 @@ int32_t ivas_interformat_brate( } else if ( ism_imp == ISM_LOW_IMP ) { - nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP ); + if ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 9600 and 1 object */ + { + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP2 ); + } + else + { + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP ); + } } else if ( ism_imp == ISM_MEDIUM_IMP ) { diff --git a/lib_com/options.h b/lib_com/options.h index 9ce2430088..e7ec2bf9ae 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -161,6 +161,7 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ +#define FIX_24k4_ISM1_MODE // activate DISC mode at 24.4 kbps 1 object #define MASA_AND_OBJECTS_VE // VA: improve codec print-outs #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo -- GitLab From b4e756545a7da5c53c9e3f38afb4b398e459a6ad Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 25 Jan 2023 11:19:49 +1100 Subject: [PATCH 028/591] fix for head tracking input in quat format, added conversion from quat to euler in degrees --- lib_com/ivas_prot.h | 9 +++++++ lib_rend/ivas_binauralRenderer.c | 6 ++--- lib_rend/ivas_rotation.c | 39 +++++++++++++++++++++++++++++++ lib_rend/ivas_splitRendererPost.c | 6 ++--- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 62050015c6..11a8a43505 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4597,6 +4597,15 @@ void Quat2Euler( float *roll /* o : roll */ ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +void Quat2EulerDegree( + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw */ + float *pitch, /* o : pitch */ + float *roll /* o : roll */ +); +#endif + void SHrotmatgen( float SHrotmat[SBA_NHARM_HOA3][SBA_NHARM_HOA3], /* o : SHD rotation matrix */ float Rmat[3][3], /* i : real-space rotation matrix */ diff --git a/lib_rend/ivas_binauralRenderer.c b/lib_rend/ivas_binauralRenderer.c index ff85e0c73b..7df14b2adf 100644 --- a/lib_rend/ivas_binauralRenderer.c +++ b/lib_rend/ivas_binauralRenderer.c @@ -1223,9 +1223,9 @@ void ivas_binRenderer( if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) { Quaternions_ref = &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions - 1]; - Quaternions_rel.w = -3.0f; /*euler*/ - Quaternions_abs.w = -3.0f; /*euler*/ - Quat2Euler( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quaternions_rel.w = -3.0f; /*euler*/ + Quaternions_abs.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ // Quaternions_abs.x = Quaternions_ref->x; // Quaternions_abs.y = Quaternions_ref->y; // Quaternions_abs.z = Quaternions_ref->z; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 1a7cd8b830..dfbe61e08d 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -150,6 +150,45 @@ void QuatToRotMat( return; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*------------------------------------------------------------------------- + * Quat2EulerDegree() + * + * Quaternion handling: calculate corresponding Euler angles in degrees + *------------------------------------------------------------------------*/ +void Quat2EulerDegree( + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw */ + float *pitch, /* o : pitch */ + float *roll /* o : roll */ +) +{ + if ( quat.w != -3.0 ) + { + *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); + *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); + *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); + *yaw *= _180_OVER_PI; + *pitch *= _180_OVER_PI; + *roll *= _180_OVER_PI; + } + else + { + /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention + * + * yaw: rotate scene counter-clockwise in the horizontal plane + * pitch: rotate scene in the median plane, increase elevation with positive values + * roll: rotate scene from the right ear to the top + */ + *yaw = quat.z; + *pitch = quat.y; + *roll = quat.x; + } + + return; +} +#endif + /*------------------------------------------------------------------------- * Quat2Euler() * diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 56782f4989..693d81c61e 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -585,9 +585,9 @@ static void get_interpolation_vars( /*interpolation if actual pose is not same as one of assumed poses*/ /*get the deviation*/ - Quat2Euler( *Quaternions_ref, &quaternions_ref_euler.z, &quaternions_ref_euler.y, &quaternions_ref_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ - Quat2Euler( *Quaternions_act, &quaternions_act_euler.z, &quaternions_act_euler.y, &quaternions_act_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ - quaternions_diff.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_ref, &quaternions_ref_euler.z, &quaternions_ref_euler.y, &quaternions_ref_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quat2EulerDegree( *Quaternions_act, &quaternions_act_euler.z, &quaternions_act_euler.y, &quaternions_act_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ + quaternions_diff.w = -3.0f; /*euler*/ quaternions_diff.x = quaternions_act_euler.x - quaternions_ref_euler.x; quaternions_diff.y = quaternions_act_euler.y - quaternions_ref_euler.y; quaternions_diff.z = quaternions_act_euler.z - quaternions_ref_euler.z; -- GitLab From ae50cf1e2fb2741053f2b9f3156bfc754033873c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 25 Jan 2023 10:23:33 +0100 Subject: [PATCH 029/591] - tuning for 24.4 kbps 1-Obj - introduce file ivas_omasa_com.c - editorial improvements (formatting, 'const', comments) --- Workspace_msvc/lib_com.vcxproj | 3 +- Workspace_msvc/lib_com.vcxproj.filters | 3 + lib_com/ivas_cnst.h | 11 +- lib_com/ivas_ism_config.c | 134 +------------- lib_com/ivas_omasa_com.c | 182 ++++++++++++++++++++ lib_com/ivas_prot.h | 18 +- lib_com/ivas_rom_com.c | 6 + lib_com/options.h | 2 +- lib_dec/ivas_dirac_dec_binaural_functions.c | 25 ++- lib_dec/ivas_qmetadata_dec.c | 30 ++-- lib_enc/ivas_ism_metadata_enc.c | 68 -------- lib_enc/ivas_omasa_enc.c | 124 +++++++++---- lib_enc/ivas_qmetadata_enc.c | 84 +++++---- 13 files changed, 396 insertions(+), 294 deletions(-) create mode 100644 lib_com/ivas_omasa_com.c diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 994b1ec429..43f7d56fe6 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -254,6 +254,7 @@ + @@ -358,4 +359,4 @@ - + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index f9d7920ca2..5b96c4d130 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -463,6 +463,9 @@ common_ivas_c + + common_ivas_c + diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3e36ec27db..ae19110407 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -316,6 +316,11 @@ typedef enum #define ISM_MEDIUM_IMP 2 #define ISM_HIGH_IMP 3 +#ifdef OMASA_BRATE +#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM no meta / inactive frames */ +#define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC ) +#endif + #define ISM_AZIMUTH_NBITS 7 #define ISM_AZIMUTH_MIN -180.0f #define ISM_AZIMUTH_MAX 180.0f @@ -350,9 +355,9 @@ typedef enum ISM_MODE_PARAM /* parametric ISM */ #ifdef MASA_AND_OBJECTS , - ISM_MASA_MODE_PARAM, /* parametric ISM mode for combined MASA ISM format */ - ISM_MASA_MODE_ONE_OBJ, /* MASA ISM mode when one object is encoded separarately */ - ISM_MASA_MODE_DISC + ISM_MASA_MODE_PARAM, /* parametric ISM mode for combined MASA ISM format */ + ISM_MASA_MODE_ONE_OBJ, /* MASA ISM mode when one object is encoded separarately */ + ISM_MASA_MODE_DISC /* MASA ISM mode when all objects are encoded separarately */ #endif } ISM_MODE; diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index dc715e8c69..5a44c7de09 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -50,8 +50,10 @@ #define FRMS_PER_SECOND ( 1000000000 / FRAME_SIZE_NS ) +#ifndef OMASA_BRATE #define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISm inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRMS_PER_SECOND ) +#endif #define BETA_ISM_LOW_IMP 0.6f #define BETA_ISM_MEDIUM_IMP 0.8f @@ -115,7 +117,6 @@ ivas_error ivas_ism_config( int16_t n_ISms; ivas_error error; - error = IVAS_ERR_OK; #ifdef MASA_AND_OBJECTS if ( combined_format_flag == 1 ) @@ -425,11 +426,13 @@ void ivas_ism_reset_metadata( return; } + /*-------------------------------------------------------------------* * ivas_ism_reset_metadata_API() * * Reset ISm metadata parameters *-------------------------------------------------------------------*/ + void ivas_ism_reset_metadata_API( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ) @@ -440,6 +443,7 @@ void ivas_ism_reset_metadata_API( return; } + /*-------------------------------------------------------------------* * ism_quant_meta() * @@ -582,7 +586,9 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } -#ifdef MASA_AND_OBJECTS + + +#ifdef MASA_AND_OBJECTS // VE2Nokia: move this function to the new file ivas_omasa_com.c (?) /*--------------------------------------------------------------- * ivas_omasa_ism_mode_select() * @@ -677,128 +683,4 @@ ISM_MODE ivas_omasa_ism_mode_select( return ism_mode; } - - -#ifdef OMASA_BRATE -/*--------------------------------------------------------------- - * ivas_interformat_brate() - * - * Bit-budget distribution in case of combined-format coding - * ---------------------------------------------------------------*/ - -#define GAMMA_ISM_LOW_IMP 0.8f -#define GAMMA_ISM_LOW_IMP2 0.9f -#define GAMMA_ISM_MEDIUM_IMP 1.2f -#define GAMMA_ISM_HIGH_IMP 1.4f -#define GAMMA_ISM_HIGH_IMP2 1.35f - -/*! r: adjusted bitrate */ -int32_t ivas_interformat_brate( - const ISM_MODE ism_mode, /* i : ISM mode */ - const int32_t element_brate, /* i : element bitrate */ - const int16_t ism_imp /* i : ISM importance flag */ -) -{ - int32_t element_brate_out; - int16_t nBits, limit_low, limit_high; - - nBits = (int16_t) ( element_brate / FRAMES_PER_SEC ); - - if ( ism_imp == ISM_INACTIVE_IMP ) - { - nBits = BITS_ISM_INACTIVE; - } - else if ( ism_imp == ISM_LOW_IMP ) - { - if ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 9600 and 1 object */ - { - nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP2 ); - } - else - { - nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP ); - } - } - else if ( ism_imp == ISM_MEDIUM_IMP ) - { - nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP ); - } - else /* ISM_HIGH_IMP */ - { - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP2 ); - } - else - { - nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP ); - } - } - - limit_low = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC; - if ( ism_imp == ISM_INACTIVE_IMP ) - { - limit_low = BITS_ISM_INACTIVE; - } - else if ( element_brate >= SCE_CORE_16k_LOW_LIMIT ) - { - limit_low = SCE_CORE_16k_LOW_LIMIT / FRAMES_PER_SEC; - } - - limit_high = IVAS_512k / FRAMES_PER_SEC; - if ( element_brate < SCE_CORE_16k_LOW_LIMIT ) - { - limit_high = ACELP_12k8_HIGH_LIMIT / FRMS_PER_SECOND; - } - - nBits = check_bounds_s( nBits, limit_low, limit_high ); - - element_brate_out = nBits * FRAMES_PER_SEC; - - return element_brate_out; -} - - -/*--------------------------------------------------------------- - * ivas_combined_format_brate_sanity() - * - * Sanity check in combined format coding - * ---------------------------------------------------------------*/ - -void ivas_combined_format_brate_sanity( - const int32_t element_brate, /* i : element bitrate */ - const int16_t core, /* i : core */ - int32_t *core_brate, /* i/o: core bitrate */ - int16_t *diff_nBits /* o : number of differential bits */ -) -{ - int16_t limit_high, nBits; - - /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by - low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget - for ACELP core-coding @12.8 kHz is too high */ - - if ( element_brate < ACELP_12k8_HIGH_LIMIT ) - { - limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; - nBits = (int16_t) ( *core_brate / FRAMES_PER_SEC ); - - *diff_nBits = nBits - limit_high; - if ( *diff_nBits > 0 ) - { - if ( core == TCX_20_CORE || core == TCX_10_CORE ) - { - *diff_nBits = 0; - } - else /* ACELP core */ - { - *core_brate -= ( *diff_nBits * FRAMES_PER_SEC ); - } - } - } - - return; -} - -#endif #endif diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c new file mode 100644 index 0000000000..121ea78076 --- /dev/null +++ b/lib_com/ivas_omasa_com.c @@ -0,0 +1,182 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "options.h" +#include +#include "ivas_cnst.h" +#include "ivas_prot.h" +#include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif + + +#ifdef OMASA_BRATE +/*--------------------------------------------------------------- + * Local constants + * ---------------------------------------------------------------*/ + + +#define GAMMA_ISM_LOW_IMP 0.8f +#define GAMMA_ISM_MEDIUM_IMP 1.2f +#define GAMMA_ISM_HIGH_IMP 1.4f + +#define GAMMA_ISM_LOW_IMP2 0.9f +#define GAMMA_ISM_MEDIUM_IMP2 1.2f +#define GAMMA_ISM_HIGH_IMP2 1.35f + + +/*--------------------------------------------------------------- + * ivas_interformat_brate() + * + * Bit-budget distribution in case of combined-format coding + * ---------------------------------------------------------------*/ + +/*! r: adjusted bitrate */ +int32_t ivas_interformat_brate( + const ISM_MODE ism_mode, /* i : ISM mode */ + const int32_t element_brate, /* i : element bitrate */ + const int16_t ism_imp /* i : ISM importance flag */ +) +{ + int32_t element_brate_out; + int16_t nBits, limit_low, limit_high; + + nBits = (int16_t) ( element_brate / FRAMES_PER_SEC ); + + + if ( ism_imp == ISM_INACTIVE_IMP ) + { + nBits = BITS_ISM_INACTIVE; + } + else + { + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || + ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 9600 and 1 object */ + ) + { + if ( ism_imp == ISM_LOW_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP2 ); + } + else if ( ism_imp == ISM_MEDIUM_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP2 ); + } + else /* ISM_HIGH_IMP */ + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP2 ); + } + } + else + { + if ( ism_imp == ISM_LOW_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP ); + } + else if ( ism_imp == ISM_MEDIUM_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP ); + } + else /* ISM_HIGH_IMP */ + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP ); + } + } + } + + limit_low = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC; + if ( ism_imp == ISM_INACTIVE_IMP ) + { + limit_low = BITS_ISM_INACTIVE; + } + else if ( element_brate >= SCE_CORE_16k_LOW_LIMIT ) + { + limit_low = SCE_CORE_16k_LOW_LIMIT / FRAMES_PER_SEC; + } + + limit_high = IVAS_512k / FRAMES_PER_SEC; + if ( element_brate < SCE_CORE_16k_LOW_LIMIT ) + { + limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; + } + + nBits = check_bounds_s( nBits, limit_low, limit_high ); + + element_brate_out = nBits * FRAMES_PER_SEC; + + return element_brate_out; +} + + +/*--------------------------------------------------------------- + * ivas_combined_format_brate_sanity() + * + * Sanity check in combined format coding + * ---------------------------------------------------------------*/ + +void ivas_combined_format_brate_sanity( + const int32_t element_brate, /* i : element bitrate */ + const int16_t core, /* i : core */ + int32_t *core_brate, /* i/o: core bitrate */ + int16_t *diff_nBits /* o : number of differential bits */ +) +{ + int16_t limit_high, nBits; + + /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by + low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget + for ACELP core-coding @12.8 kHz is too high */ + + if ( element_brate < ACELP_12k8_HIGH_LIMIT ) + { + limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; + nBits = (int16_t) ( *core_brate / FRAMES_PER_SEC ); + + *diff_nBits = nBits - limit_high; + if ( *diff_nBits > 0 ) + { + if ( core == TCX_20_CORE || core == TCX_10_CORE ) + { + *diff_nBits = 0; + } + else /* ACELP core */ + { + *core_brate -= ( *diff_nBits * FRAMES_PER_SEC ); + } + } + } + + return; +} + +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 135c3a6321..7b7edd2f34 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5210,9 +5210,9 @@ void preProcessStereoTransportsForMovedObjects( Decoder_Struct* st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - uint8_t nBins, - uint8_t firstSubframe, - uint8_t nSubframes + const uint8_t nBins, + const uint8_t firstSubframe, + const uint8_t nSubframes ); ivas_error ivas_masa_ism_separate_object_renderer_open( @@ -5227,23 +5227,23 @@ void ivas_masa_ism_separate_object_render( ); void ivas_masa_ism_set_edited_objects( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void encode_masa_to_total( IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, - int16_t low_bitrate_mode, - int16_t nbands, - int16_t nblocks + const int16_t low_bitrate_mode, + const int16_t nbands, + const int16_t nblocks ); void decode_masa_to_total( uint16_t* bit_stream, int16_t* index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], - int16_t nbands, - int16_t nblocks + const int16_t nbands, + const int16_t nblocks ); void modify_masa_energy_ratios( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index b42fb64fc4..641a5f5c84 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2780,6 +2780,10 @@ const float McMASA_LFEGain_vectors[64] = }; #ifdef MASA_AND_OBJECTS +/*----------------------------------------------------------------------------------* + * OMASA ROM tables + *----------------------------------------------------------------------------------*/ + // VE2Nokia: add "const" to the arrays int32_t sep_object_brate[][MAX_NUM_OBJECTS] = { @@ -2806,6 +2810,7 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */ }; + /* column wise DCT matrices for 4 5, and 8 dim */ float dct4[] = { 0.5000f, 0.6533f, 0.5000f, 0.2706f, @@ -2821,6 +2826,7 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = 0.4472f, -0.3717f, -0.1954f, 0.6015f, -0.5117f, 0.4472f, -0.6015f, 0.5117f, -0.3717f, 0.1954f }; + float dct8[] = { 0.3536f, 0.4904f, 0.4619f, 0.4157f, 0.3536f, 0.2778f, 0.1913f, 0.0975f, 0.3536f, 0.4157f, 0.1913f, -0.0975f, -0.3536f, -0.4904f, -0.4619f, -0.2778f, 0.3536f, 0.2778f, -0.1913f, -0.4904f, diff --git a/lib_com/options.h b/lib_com/options.h index e7ec2bf9ae..d73306ae58 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c index 7f4511c9c3..af97a8ba78 100644 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ b/lib_dec/ivas_dirac_dec_binaural_functions.c @@ -973,7 +973,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #ifdef MASA_AND_OBJECTS float spectrumModVal; /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ - spectrumModVal = (1.0f - surCoh) + surCoh * surCohEne[min(bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1)]; + spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )]; diffEne *= spectrumModVal; #else idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); @@ -1952,10 +1952,7 @@ static void hrtfShGetHrtf( int16_t k; float shVec[HRTF_SH_CHANNELS]; - ivas_dirac_dec_get_response( aziDeg, - eleDeg, - shVec, - HRTF_SH_ORDER ); + ivas_dirac_dec_get_response( aziDeg, eleDeg, shVec, HRTF_SH_ORDER ); *lRealp = 0.0f; *lImagp = 0.0f; @@ -1972,14 +1969,21 @@ static void hrtfShGetHrtf( return; } + #ifdef MASA_AND_OBJECTS +/*-------------------------------------------------------------------* + * preProcessStereoTransportsForMovedObjects() + * + * + *-------------------------------------------------------------------*/ + void preProcessStereoTransportsForMovedObjects( Decoder_Struct *st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - uint8_t nBins, - uint8_t firstSubframe, - uint8_t nSubframes ) + const uint8_t nBins, + const uint8_t firstSubframe, + const uint8_t nSubframes ) { int16_t subframe, bin, ch, inCh, outCh, ismDirIndex, slot; DIRAC_DEC_HANDLE hDirAC; @@ -2070,6 +2074,7 @@ void preProcessStereoTransportsForMovedObjects( ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex], hMasaIsmData->elevation_ism[ismDirIndex], panGainsIn ); + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) { ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], @@ -2116,6 +2121,7 @@ void preProcessStereoTransportsForMovedObjects( normEnes[ch] -= panEnesIn[ch] * ratio; } } + /* Any remaining (non-object) energy is set to be preserved at both channels */ remainderNormEne = fmaxf( 0.0f, ( 1.0f - ismRatioAcc ) - normEnes[0] - normEnes[1] ); for ( ch = 0; ch < 2; ch++ ) @@ -2136,7 +2142,6 @@ void preProcessStereoTransportsForMovedObjects( ismPreprocMtxNew[1 - ch][ch] = sqrtf( hMasaIsmData->eneMoveIIR[ch][bin] / normVal ); } - /* Get increment value for temporal interpolation */ for ( inCh = 0; inCh < 2; inCh++ ) { @@ -2185,5 +2190,7 @@ void preProcessStereoTransportsForMovedObjects( } } } + + return; } #endif diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 1c8c7b88da..fc12917b8f 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -94,7 +94,7 @@ static int16_t read_GR_min_removed_data( uint16_t *bitstream, int16_t *p_bit_pos static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t no_bands, int16_t *no_cv_vec, uint16_t *decoded_index, const int16_t no_symb ); #ifdef MASA_AND_OBJECTS -static void read_stream_dct_coeffs_omasa( int16_t *q_idx, float *q_dct_data, int16_t len_stream, uint16_t *bit_stream, int16_t *index, int16_t first_line ); +static void read_stream_dct_coeffs_omasa( int16_t *q_idx, float *q_dct_data, const int16_t len_stream, uint16_t *bit_stream, int16_t *index, const int16_t first_line ); #endif /*-----------------------------------------------------------------------* @@ -3302,14 +3302,15 @@ static void decode_combined_index( return; } + #ifdef MASA_AND_OBJECTS static void read_stream_dct_coeffs_omasa( int16_t *q_idx, float *q_dct_data, - int16_t len_stream, + const int16_t len_stream, uint16_t *bit_stream, int16_t *index, - int16_t first_line ) + const int16_t first_line ) { int16_t sign, nbits; int16_t i, j, i_min; @@ -3382,6 +3383,7 @@ static void read_stream_dct_coeffs_omasa( } } } + /* deindex */ q_dct_data[0] = q_idx[0] * step; for ( i = 1; i < len_stream; i++ ) @@ -3395,25 +3397,29 @@ static void read_stream_dct_coeffs_omasa( q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; } } + return; } + +/*------------------------------------------------------------------------- + * decode_masa_to_total() + * + *------------------------------------------------------------------------*/ + void decode_masa_to_total( uint16_t *bit_stream, int16_t *index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], - int16_t nbands, - int16_t nblocks ) + const int16_t nbands, + const int16_t nblocks ) { int16_t i, j, k; - int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; - float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; - - int16_t n_streams, len_stream; + /* Setup coding parameters */ n_streams = 1; len_stream = nbands * nblocks; @@ -3423,14 +3429,12 @@ void decode_masa_to_total( len_stream = 8; } - set_s( q_idx, 0, nbands * nblocks ); for ( i = 0; i < n_streams; i++ ) { read_stream_dct_coeffs_omasa( &q_idx[i * len_stream], &q_dct_data[i * len_stream], len_stream, bit_stream, index, i == 0 ); } - /* inverse DCT2 transform */ switch ( len_stream ) { @@ -3468,6 +3472,7 @@ void decode_masa_to_total( k++; } } + if ( nblocks == 1 ) { for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) @@ -3478,6 +3483,7 @@ void decode_masa_to_total( } } } + if ( nbands == 1 ) { for ( j = 1; j < 5; j++ ) @@ -3488,5 +3494,7 @@ void decode_masa_to_total( } } } + + return; } #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index d2a073d2b8..bd9183f92f 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -139,74 +139,6 @@ static void rate_ism_importance( } -#ifdef OMASA_BRATE -/*-------------------------------------------------------------------------* - * set_ism_importance_interformat() - * - * Set the importance of particular ISM streams in combined-format coding - *-------------------------------------------------------------------------*/ - -void set_ism_importance_interformat( - const int32_t ism_total_brate, /* i/o: ISms total bitrate */ - const int16_t nchan_transport, /* i : number of transported channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - const float lp_noise_CPE, /* i : LP filtered total noise estimation */ - int16_t ism_imp[] /* o : ISM importance flags */ -) -{ - Encoder_State *st; - int16_t ch, ctype, active_flag; - - for ( ch = 0; ch < nchan_transport; ch++ ) - { - st = hSCE[ch]->hCoreCoder[0]; - - active_flag = st->vad_flag; - - if ( active_flag == 0 ) - { - if ( st->lp_noise > 15 || lp_noise_CPE - st->lp_noise < 30 ) - { - active_flag = 1; - } - } - - /* do not use the low-rate core-coder mode at highest bit-rates */ - if ( ism_total_brate / nchan_transport > IVAS_48k ) - { - active_flag = 1; - } - - ctype = hSCE[ch]->hCoreCoder[0]->coder_type_raw; - - st->low_rate_mode = 0; - if ( active_flag == 0 ) - { - ism_imp[ch] = ISM_INACTIVE_IMP; - st->low_rate_mode = 1; - } - else if ( ctype == INACTIVE || ctype == UNVOICED ) - { - ism_imp[ch] = ISM_LOW_IMP; - } - else if ( ctype == VOICED ) - { - ism_imp[ch] = ISM_MEDIUM_IMP; - } - else /* GENERIC */ - { - ism_imp[ch] = ISM_HIGH_IMP; - } - - hIsmMeta[ch]->ism_metadata_flag = active_flag; /* flag is needed for the MD coding */ - } - - return; -} -#endif - - /*-------------------------------------------------------------------------* * ivas_ism_metadata_enc() * diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 5ea2b75a3e..0f50eecd54 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -30,15 +30,12 @@ *******************************************************************************************************/ +#include "options.h" +#include #include #include -#include -#include -#include "string.h" - #include "ivas_cnst.h" #include "ivas_prot.h" -#include "options.h" #include "prot.h" #include "ivas_rom_com.h" #include "ivas_rom_enc.h" @@ -57,7 +54,7 @@ static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HAND static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); -static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t num_transport_channels, const int16_t num_input_channels, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); +static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ); @@ -67,7 +64,7 @@ static void computeReferencePower_omasa( const int16_t *band_grouping, float Cld /*--------------------------------------------------------------------------* * ivas_omasa_enc_open() * - * + * Allocate and initialize OMASA handle *--------------------------------------------------------------------------*/ ivas_error ivas_omasa_enc_open( @@ -173,7 +170,7 @@ ivas_error ivas_omasa_enc_open( /*--------------------------------------------------------------------------* * ivas_omasa_enc_close() * - O + * Close OMASA handle *--------------------------------------------------------------------------*/ void ivas_omasa_enc_close( @@ -183,7 +180,6 @@ void ivas_omasa_enc_close( { int16_t i, j; - for ( i = 0; i < nchan_ism; i++ ) { free( hOMasa->delay_buffer[i] ); @@ -278,7 +274,7 @@ void ivas_omasa_set_config( /*--------------------------------------------------------------------------* * ivas_omasa_enc() * - * + * Main OMASA encoding function *--------------------------------------------------------------------------*/ void ivas_omasa_enc( @@ -490,6 +486,73 @@ void ivas_omasa_enc( #ifdef OMASA_BRATE + +/*-------------------------------------------------------------------------* + * set_ism_importance_interformat() + * + * Set the importance of particular ISM streams in combined-format coding + *-------------------------------------------------------------------------*/ + +void set_ism_importance_interformat( + const int32_t ism_total_brate, /* i/o: ISms total bitrate */ + const int16_t nchan_transport, /* i : number of transported channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + const float lp_noise_CPE, /* i : LP filtered total noise estimation */ + int16_t ism_imp[] /* o : ISM importance flags */ +) +{ + Encoder_State *st; + int16_t ch, ctype, active_flag; + + for ( ch = 0; ch < nchan_transport; ch++ ) + { + st = hSCE[ch]->hCoreCoder[0]; + + active_flag = st->vad_flag; + + if ( active_flag == 0 ) + { + if ( st->lp_noise > 15 || lp_noise_CPE - st->lp_noise < 30 ) + { + active_flag = 1; + } + } + + /* do not use the low-rate core-coder mode at highest bit-rates */ + if ( ism_total_brate / nchan_transport > IVAS_48k ) + { + active_flag = 1; + } + + ctype = hSCE[ch]->hCoreCoder[0]->coder_type_raw; + + st->low_rate_mode = 0; + if ( active_flag == 0 ) + { + ism_imp[ch] = ISM_INACTIVE_IMP; + st->low_rate_mode = 1; + } + else if ( ctype == INACTIVE || ctype == UNVOICED ) + { + ism_imp[ch] = ISM_LOW_IMP; + } + else if ( ctype == VOICED ) + { + ism_imp[ch] = ISM_MEDIUM_IMP; + } + else /* GENERIC */ + { + ism_imp[ch] = ISM_HIGH_IMP; + } + + hIsmMeta[ch]->ism_metadata_flag = active_flag; /* flag is needed for the MD coding */ + } + + return; +} + + /*--------------------------------------------------------------------------* * ivas_set_surplus_brate_enc() * @@ -535,7 +598,7 @@ static void ivas_omasa_param_est_enc( float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], const int16_t input_frame, - const int16_t nchan_inp ) + const int16_t nchan_ism ) { float reference_power[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; int16_t ts, i, j, d, k; @@ -565,13 +628,13 @@ static void ivas_omasa_param_est_enc( set_zero( diffuseness_m, hOMasa->nbands ); /* Copy current frame to memory for delay compensation */ - for ( i = 0; i < nchan_inp; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); } /* Compute ISM to FOA matrices */ - for ( i = 0; i < nchan_inp; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { hOMasa->chnlToFoaMtx[0][i] = 1.0f; hOMasa->chnlToFoaMtx[1][i] = sinf( ( hIsmMeta[i]->azimuth / 180.0f * EVS_PI ) ) * cosf( ( hIsmMeta[i]->elevation / 180.0f * EVS_PI ) ); @@ -596,7 +659,7 @@ static void ivas_omasa_param_est_enc( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - for ( i = 0; i < nchan_inp; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { if ( ts < hOMasa->num_slots_delay_comp ) { @@ -615,7 +678,7 @@ static void ivas_omasa_param_est_enc( brange[1] = hOMasa->band_grouping[i + 1]; for ( j = brange[0]; j < brange[1]; j++ ) { - for ( k = 0; k < nchan_inp; k++ ) + for ( k = 0; k < nchan_ism; k++ ) { hMasa->data.energy_ism[block_m_idx][i] += Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j]; } @@ -626,7 +689,7 @@ static void ivas_omasa_param_est_enc( /* W */ mvr2r( Chnl_RealBuffer[0], Foa_RealBuffer[0], num_freq_bins ); mvr2r( Chnl_ImagBuffer[0], Foa_ImagBuffer[0], num_freq_bins ); - for ( i = 1; i < nchan_inp; i++ ) + for ( i = 1; i < nchan_ism; i++ ) { v_add( Chnl_RealBuffer[i], Foa_RealBuffer[0], Foa_RealBuffer[0], num_freq_bins ); v_add( Chnl_ImagBuffer[i], Foa_ImagBuffer[0], Foa_ImagBuffer[0], num_freq_bins ); @@ -635,7 +698,7 @@ static void ivas_omasa_param_est_enc( /* Y */ v_multc( Chnl_RealBuffer[0], hOMasa->chnlToFoaMtx[1][0], Foa_RealBuffer[1], num_freq_bins ); v_multc( Chnl_ImagBuffer[0], hOMasa->chnlToFoaMtx[1][0], Foa_ImagBuffer[1], num_freq_bins ); - for ( i = 1; i < nchan_inp; i++ ) + for ( i = 1; i < nchan_ism; i++ ) { v_multc_acc( Chnl_RealBuffer[i], hOMasa->chnlToFoaMtx[1][i], Foa_RealBuffer[1], num_freq_bins ); v_multc_acc( Chnl_ImagBuffer[i], hOMasa->chnlToFoaMtx[1][i], Foa_ImagBuffer[1], num_freq_bins ); @@ -644,7 +707,7 @@ static void ivas_omasa_param_est_enc( /* Z */ v_multc( Chnl_RealBuffer[0], hOMasa->chnlToFoaMtx[2][0], Foa_RealBuffer[2], num_freq_bins ); v_multc( Chnl_ImagBuffer[0], hOMasa->chnlToFoaMtx[2][0], Foa_ImagBuffer[2], num_freq_bins ); - for ( i = 1; i < nchan_inp; i++ ) + for ( i = 1; i < nchan_ism; i++ ) { v_multc_acc( Chnl_RealBuffer[i], hOMasa->chnlToFoaMtx[2][i], Foa_RealBuffer[2], num_freq_bins ); v_multc_acc( Chnl_ImagBuffer[i], hOMasa->chnlToFoaMtx[2][i], Foa_ImagBuffer[2], num_freq_bins ); @@ -653,7 +716,7 @@ static void ivas_omasa_param_est_enc( /* X */ v_multc( Chnl_RealBuffer[0], hOMasa->chnlToFoaMtx[3][0], Foa_RealBuffer[3], num_freq_bins ); v_multc( Chnl_ImagBuffer[0], hOMasa->chnlToFoaMtx[3][0], Foa_ImagBuffer[3], num_freq_bins ); - for ( i = 1; i < nchan_inp; i++ ) + for ( i = 1; i < nchan_ism; i++ ) { v_multc_acc( Chnl_RealBuffer[i], hOMasa->chnlToFoaMtx[3][i], Foa_RealBuffer[3], num_freq_bins ); v_multc_acc( Chnl_ImagBuffer[i], hOMasa->chnlToFoaMtx[3][i], Foa_ImagBuffer[3], num_freq_bins ); @@ -724,7 +787,7 @@ static void ivas_omasa_param_est_enc( } /* Update memory */ - for ( i = 0; i < nchan_inp; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); } @@ -843,8 +906,8 @@ static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, - const int16_t num_transport_channels, - const int16_t num_input_channels, + const int16_t nchan_transport, + const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ) @@ -854,14 +917,14 @@ static void ivas_omasa_dmx( float gains[MASA_MAX_TRANSPORT_CHANNELS]; float g1, g2; - if ( num_transport_channels == 2 ) + if ( nchan_transport == 2 ) { - for ( i = 0; i < num_transport_channels; i++ ) + for ( i = 0; i < nchan_transport; i++ ) { set_zero( data_out_f[i], input_frame ); } - for ( i = 0; i < num_input_channels; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { azimuth = hIsmMeta[i]->azimuth; elevation = hIsmMeta[i]->elevation; @@ -869,9 +932,9 @@ static void ivas_omasa_dmx( ivas_get_stereo_panning_gains( azimuth, elevation, gains ); /* Downmix using the panning gains */ - for ( j = 0; j < num_transport_channels; j++ ) + for ( j = 0; j < nchan_transport; j++ ) { - if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0 ) + if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0f ) { for ( k = 0; k < input_frame; k++ ) { @@ -884,17 +947,19 @@ static void ivas_omasa_dmx( } } } - else if ( num_transport_channels == 1 ) + else if ( nchan_transport == 1 ) // VE2Nokia: is ti relevant? { for ( i = 0; i < input_frame; i++ ) { data_out_f[0][i] = 0.0f; - for ( j = 0; j < num_input_channels; j++ ) + for ( j = 0; j < nchan_ism; j++ ) { data_out_f[0][i] += data_in_f[j][i]; } } } + + return; } @@ -935,6 +1000,7 @@ static void computeIntensityVector_enc( return; } + static void computeReferencePower_omasa( const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index d140dc79e6..5fb5427ebe 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -125,11 +125,14 @@ static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *d static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); #ifdef MASA_AND_OBJECTS -static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, int16_t len_stream, BSTR_ENC_HANDLE hMetaData, int16_t first_line, int16_t low_bitrate_mode ); -static int16_t find_optimal_GR_order( int16_t *q_idx, int16_t len, int16_t *GR ); -static int16_t find_optimal_GR_orders( int16_t *q_idx, int16_t len, int16_t len_max_GR1, int16_t *GR1, int16_t *GR2, int16_t *i_min ); +static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, const int16_t len_stream, BSTR_ENC_HANDLE hMetaData, const int16_t first_line, const int16_t low_bitrate_mode ); + +static int16_t find_optimal_GR_order( const int16_t *q_idx, const int16_t len, int16_t *GR ); + +static int16_t find_optimal_GR_orders( const int16_t *q_idx, const int16_t len, const int16_t len_max_GR1, int16_t *GR1, int16_t *GR2, int16_t *i_min ); #endif + /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_encode() * @@ -2769,7 +2772,7 @@ static int16_t truncGR0( *-------------------------------------------------------------------*/ static int16_t truncGR0_chan( - float *data, + const float *data, float *data_hat, uint16_t *data_idx, const int16_t len, @@ -4918,14 +4921,15 @@ static float direction_distance( return d / (float) ( dim1 * dim2 ); } #endif + #ifdef MASA_AND_OBJECTS static int16_t divide_GR_orders( - int16_t *q_idx, - int16_t GR1, - int16_t GR2, - int16_t len, - int16_t len_max_GR1, + const int16_t *q_idx, + const int16_t GR1, + const int16_t GR2, + const int16_t len, + const int16_t len_max_GR1, int16_t *i_min ) { int16_t nb_GR_min; @@ -4951,12 +4955,14 @@ static int16_t divide_GR_orders( *i_min = i + 1; } } + return nb_GR_min; } -static int16_t -find_optimal_GR_order( - int16_t *q_idx, - int16_t len, + + +static int16_t find_optimal_GR_order( + const int16_t *q_idx, + const int16_t len, int16_t *GR ) { int16_t nb_GR_0, nb_GR_1; @@ -4978,16 +4984,16 @@ find_optimal_GR_order( else { *GR = 1; + return nb_GR_1; } } -static int16_t -find_optimal_GR_orders( - int16_t *q_idx, - int16_t len, - int16_t len_max_GR1, +static int16_t find_optimal_GR_orders( + const int16_t *q_idx, + const int16_t len, + const int16_t len_max_GR1, int16_t *GR1, int16_t *GR2, int16_t *i_min ) @@ -5023,15 +5029,17 @@ find_optimal_GR_orders( *i_min = i_min_10; } } + return nb_GR_min; } + static int16_t write_stream_dct_coeffs_omasa( - int16_t *q_idx, /* i: array of indexes to be written */ - int16_t len_stream, /* i: array length */ - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream */ - int16_t first_line, /* i: is first line of the matrix? 1/0*/ - int16_t low_bitrate_mode /* i: is low bitrate mode? if yes, limit the number of bits written */ + int16_t *q_idx, /* i: array of indexes to be written */ + const int16_t len_stream, /* i: array length */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream */ + const int16_t first_line, /* i: is first line of the matrix? 1/0*/ + const int16_t low_bitrate_mode /* i: is low bitrate mode? if yes, limit the number of bits written */ ) { int16_t nb_bits = 0, bits_pos; @@ -5144,6 +5152,7 @@ static int16_t write_stream_dct_coeffs_omasa( /* find optimum length of the part encoded with GR2 */ nb_GR_min = find_optimal_GR_orders( &q_idx[1], len_stream - 1, 15, &GR1, &GR2, &i_min ); } + if ( len_stream >= 8 ) { /* write number of indexes encoded with GR2 on 4 bits */ @@ -5157,11 +5166,13 @@ static int16_t write_stream_dct_coeffs_omasa( push_next_indice( hMetaData, GR2, 1 ); nb_bits += 1; } + /* write GR data */ for ( i = 1; i <= i_min; i++ ) { ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, GR1 ); } + for ( i = i_min + 1; i < len_stream; i++ ) { ivas_qmetadata_encode_extended_gr( hMetaData, q_idx[i], 100, GR2 ); @@ -5183,32 +5194,33 @@ static int16_t write_stream_dct_coeffs_omasa( assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); } + return nb_bits; } + +/*------------------------------------------------------------------------- + * encode_masa_to_total() + * + *------------------------------------------------------------------------*/ + void encode_masa_to_total( IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, - int16_t low_bitrate_mode, - int16_t nbands, - int16_t nblocks ) + const int16_t low_bitrate_mode, + const int16_t nbands, + const int16_t nblocks ) { int16_t i, j, k; float data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; - - float step = STEP_M2T; - int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; float dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; float dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; - - int16_t bits_pos, nb_bits; int16_t n_streams, len_stream; - #ifdef DEBUG_MODE_QMETADATA static FILE *pF = NULL; static FILE *pF_ratio = NULL; @@ -5220,7 +5232,6 @@ void encode_masa_to_total( #endif - bits_pos = hMetaData->nb_bits_tot; k = 0; for ( i = 0; i < nbands; i++ ) @@ -5269,7 +5280,6 @@ void encode_masa_to_total( break; } - for ( k = 0; k < n_streams; k++ ) { j = k * len_stream; @@ -5280,7 +5290,9 @@ void encode_masa_to_total( { q_idx[j] = ( ( 1 << BITS_MASA2TOTTAL_DCT0 ) - 1 ); } + q_dct_data[j] = step * q_idx[j]; + if ( q_idx[j] == 0 ) { set_s( &q_idx[j], 0, len_stream ); @@ -5304,7 +5316,6 @@ void encode_masa_to_total( } } - /* write data */ nb_bits = 0; for ( i = 0; i < n_streams; i++ ) @@ -5312,7 +5323,6 @@ void encode_masa_to_total( nb_bits += write_stream_dct_coeffs_omasa( &q_idx[i * len_stream], len_stream, hMetaData, ( i == 0 ), low_bitrate_mode ); } - /* reconstruct masa2total */ q_dct_data[0] = q_idx[0] * step; for ( i = 1; i < len_stream; i++ ) @@ -5326,6 +5336,7 @@ void encode_masa_to_total( q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; } } + /* inverse DCT2 transform */ switch ( len_stream ) { @@ -5353,7 +5364,6 @@ void encode_masa_to_total( break; } - k = 0; for ( i = 0; i < nblocks; i++ ) { -- GitLab From 7fa3c751e4358bee8405d1024451007c49812489 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 10:45:26 +0100 Subject: [PATCH 030/591] move DEBUG_VA to ivas_set_surplus_brate_enc() --- lib_com/ivas_prot.h | 4 ++++ lib_enc/ivas_enc.c | 29 ++++------------------------- lib_enc/ivas_omasa_enc.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7b7edd2f34..beb170708e 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5158,6 +5158,10 @@ void ivas_omasa_enc( #ifdef OMASA_BRATE void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +#ifdef DEBUG_VA + , + const int16_t *nb_bits_metadata /* i : number of metadata bits */ +#endif ); void ivas_set_surplus_brate_dec( diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index be021a9493..d5ed2963c3 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -378,8 +378,11 @@ ivas_error ivas_enc( st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); /* Configuration of combined-format bit-budget distribution */ +#ifdef DEBUG_VA + ivas_set_surplus_brate_enc( st_ivas, nb_bits_metadata ); +#else ivas_set_surplus_brate_enc( st_ivas ); - +#endif #else if ( st_ivas->hQMetaData != NULL ) { @@ -438,30 +441,6 @@ ivas_error ivas_enc( { ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); // VE2Nokia: this condition is unnecessary } - -#ifdef DEBUG_VA - if ( st_ivas->hSCE[0] != NULL ) - { - float tmpF = 0; - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); - } - else - { - for ( i = 0; i < st_ivas->nchan_ism; i++ ) - { - tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 ); - } - } - tmpF /= 1000.f; - dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_ISM" ); - tmpF = ivas_total_brate / 1000.0f - tmpF; - dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA" ); - tmpF = nb_bits_metadata[0] * 50 / 1000.0f; - dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MD" ); - } -#endif } #endif else if ( ivas_format == MC_FORMAT ) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 0f50eecd54..16758a4d77 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -561,6 +561,10 @@ void set_ism_importance_interformat( void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +#ifdef DEBUG_VA + , + const int16_t *nb_bits_metadata /* i : number of metadata bits */ +#endif ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) @@ -577,6 +581,31 @@ void ivas_set_surplus_brate_enc( st_ivas->hCPE[0]->brate_surplus = 0; } +#ifdef DEBUG_VA + if ( st_ivas->hSCE[0] != NULL ) + { + int16_t input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); + float tmpF = 0; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); + } + else + { + for ( int16_t i = 0; i < st_ivas->nchan_ism; i++ ) + { + tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 ); + } + } + tmpF /= 1000.f; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_ISM" ); /* == ism_total_brate incl. ISM MD */ + tmpF = st_ivas->hEncoderConfig->ivas_total_brate / 1000.0f - tmpF; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA" ); /* == masa_total_brate incl. MASA MD */ + tmpF = nb_bits_metadata[0] * FRAMES_PER_SEC / 1000.0f; + dbgwrite( &tmpF, 4, 1, input_frame, "res/brate_MASA_MD" ); /* == MASA MD bitrate */ + } +#endif + return; } #endif -- GitLab From 49117d2e5355274ca61962fbdd0d89fabca81b57 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 11:16:24 +0100 Subject: [PATCH 031/591] address "VE2Nokia" comments, part 1 --- lib_com/ivas_masa_com.c | 10 +- lib_com/ivas_prot.h | 33 +++-- lib_dec/ivas_dec.c | 287 ++++++++++++++++++++------------------- lib_dec/ivas_init_dec.c | 12 +- lib_dec/ivas_masa_dec.c | 27 ++-- lib_enc/ivas_enc.c | 22 +-- lib_enc/ivas_init_enc.c | 16 +-- lib_enc/ivas_masa_enc.c | 34 +++-- lib_enc/ivas_omasa_enc.c | 29 ++-- 9 files changed, 239 insertions(+), 231 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 9211ec057d..867f9512e8 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -68,9 +68,9 @@ void ivas_masa_set_elements( int16_t *nCPE /* o : number of CPEs */ #ifdef MASA_AND_OBJECTS , - int16_t ivas_format, - const ISM_MODE ism_mode, - int32_t sce_brate + const int16_t ivas_format, /* i : IVAS format */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const int32_t ism_total_brate /* i : initial ISM total bitrate */ #endif ) { @@ -97,7 +97,7 @@ void ivas_masa_set_elements( if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) { *element_mode = IVAS_CPE_MDCT; - if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - sce_brate < MIN_BRATE_MDCT_STEREO ) ) + if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_DFT; } @@ -118,7 +118,7 @@ void ivas_masa_set_elements( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) { - hQMetaData->bits_frame_nominal -= (int16_t) ( sce_brate / FRAMES_PER_SEC ); + hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); } #endif } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index beb170708e..b861e3aa1d 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4528,18 +4528,18 @@ void ivas_masa_set_elements( int16_t *nCPE /* o : number of CPEs */ #ifdef MASA_AND_OBJECTS , - int16_t ivas_format, /* i : IVAS format */ + const int16_t ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ - int32_t sce_brate /* i : bitrate of SCE */ + const int32_t ism_total_brate /* i : initial ISM total bitrate */ #endif ); #ifdef MASA_AND_OBJECTS /*! r: valid or not 1/0 */ int16_t valid_ratio_index( - int16_t index, /* i : index to be checked */ - const int16_t K, /* i : L1 norm to check against */ - const int16_t len /* i : vector length */ + int16_t index, /* i : index to be checked */ + const int16_t K, /* i : L1 norm to check against */ + const int16_t len /* i : vector length */ ); void reconstruct_ism_ratios( @@ -5141,18 +5141,17 @@ void ivas_omasa_set_config( ); void ivas_omasa_enc( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - float data_in_f[][L_FRAME48k], /* i : Input audio signals for parameter analysis */ - float data_out_f[][L_FRAME48k], /* o : Transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const int16_t nchan_inp, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ - float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ - int16_t* idx_separated_object /* o : Index of the separated object */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_ism, /* i : Number of objects for parameter analysis*/ + const ISM_MODE ism_mode, /* i : ISM mode */ + float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ + int16_t* idx_separated_object /* o : Index of the separated object */ ); #ifdef OMASA_BRATE diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index df5cfb4253..a964c53a6c 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -355,6 +355,150 @@ ivas_error ivas_dec( ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { +#ifndef OMASA_BRATE + ism_total_brate = 0; +#endif + st = st_ivas->hCPE[0]->hCoreCoder[0]; + +#ifndef OMASA_BRATE + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + ism_total_brate += st_ivas->hSCE[n]->element_brate; + } + st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); + } +#endif + + nb_bits_metadata[0] = 0; + set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); + + /* Set the number of objects for the parametric rendering */ + if ( st_ivas->hDirAC != NULL ) + { + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; + } + else + { + st_ivas->hDirAC->numIsmDirections = 0; + } + } + + /* MASA decoding */ + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + +#ifdef OMASA_BRATE + /* 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 )] ); +#endif + + /* Audio signal decoding */ + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + if ( st_ivas->nSCE == 1 ) + { + ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); + } + else + { +#ifdef DEBUGGING + assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); +#endif + } + } + else + { + /* decode ISM format */ + ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); + + for ( n = 0; n < st_ivas->nSCE - 1; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); + st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + } + } + if ( st_ivas->nCPE == 1 ) + { + ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); + } + + if ( st_ivas->hCPE[0]->nchan_out == 1 ) + { + mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ + } + + /* HP filtering */ + for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + + /* Set edited object positions, if editing enabled */ + ivas_masa_ism_set_edited_objects( st_ivas ); + + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); + } + else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); + } + else if ( st_ivas->hDirAC ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + mvr2r( output[2], data_separated_objects[0], output_frame ); + } + else + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + } + } + + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); + ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); + } + else + { + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); + } + } + } +#endif else if ( st_ivas->ivas_format == MC_FORMAT ) { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; @@ -547,150 +691,7 @@ ivas_error ivas_dec( } } } -#ifdef MASA_AND_OBJECTS - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) - { -#ifndef OMASA_BRATE - ism_total_brate = 0; -#endif - st = st_ivas->hCPE[0]->hCoreCoder[0]; - -#ifndef OMASA_BRATE - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - ism_total_brate += st_ivas->hSCE[n]->element_brate; - } - st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); - } -#endif - - nb_bits_metadata[0] = 0; - set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); - - /* Set the number of objects for the parametric rendering */ - if ( st_ivas->hDirAC != NULL ) - { - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; - } - else - { - st_ivas->hDirAC->numIsmDirections = 0; - } - } - - /* MASA decoding */ - if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) - { - return error; - } - -#ifdef OMASA_BRATE - /* 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 )] ); -#endif - - /* Audio signal decoding */ - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - if ( st_ivas->nSCE == 1 ) - { - ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); - } - else - { -#ifdef DEBUGGING - assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); -#endif - } - } - else - { - /* decode ISM format */ - ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); - for ( n = 0; n < st_ivas->nSCE - 1; n++ ) - { - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); - st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); - } - } - if ( st_ivas->nCPE == 1 ) - { - ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); - } - - if ( st_ivas->hCPE[0]->nchan_out == 1 ) - { - mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ - } - - /* HP filtering */ - for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) - { - hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); - } - - /* Set edited object positions, if editing enabled */ - ivas_masa_ism_set_edited_objects( st_ivas ); - - /* Rendering */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); - } - else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) - { - ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); - } - else if ( st_ivas->hDirAC ) - { - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - mvr2r( output[2], data_separated_objects[0], output_frame ); - } - else - { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - mvr2r( output[n + 2], data_separated_objects[n], output_frame ); - } - } - - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); - ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); - } - else - { - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); - } - } - } -#endif /*----------------------------------------------------------------* * Write IVAS output channels diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2c2a26b315..f20dbf1f09 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -664,7 +664,7 @@ ivas_error ivas_init_decoder( DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; #ifdef MASA_AND_OBJECTS - int32_t sce_brate; + int32_t ism_total_brate; #endif error = IVAS_ERR_OK; @@ -968,7 +968,7 @@ ivas_error ivas_init_decoder( ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); k = 0; - sce_brate = 0; + ism_total_brate = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { k++; @@ -978,8 +978,8 @@ ivas_error ivas_init_decoder( /* one separated object */ st_ivas->nSCE = 1; - sce_brate = sep_object_brate[k - 2][0]; - create_sce_dec( st_ivas, 0, sce_brate ); + ism_total_brate = sep_object_brate[k - 2][0]; + create_sce_dec( st_ivas, 0, ism_total_brate ); reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); @@ -999,7 +999,7 @@ ivas_error ivas_init_decoder( { temp_brate[sce_id] = sep_object_brate[k - 2][st_ivas->nSCE - 1]; - sce_brate += temp_brate[sce_id]; + ism_total_brate += temp_brate[sce_id]; if ( ( error = create_sce_dec( st_ivas, sce_id, temp_brate[sce_id] ) ) != IVAS_ERR_OK ) { @@ -1024,7 +1024,7 @@ ivas_error ivas_init_decoder( } st_ivas->nCPE = 1; - create_cpe_dec( st_ivas, 0, ( ( ivas_total_brate - sce_brate ) / st_ivas->nchan_transport ) * CPE_CHANNELS ); // VE2Nokia: could be simplified - nchan_transport is always 2 here + create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ); for ( n = 0; n < CPE_CHANNELS; n++ ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 83c194dbd2..06646b2ab9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -497,26 +497,27 @@ ivas_error ivas_masa_dec_open( MASA_DECODER_HANDLE hMasa; #ifdef MASA_AND_OBJECTS int16_t i; - int32_t sce_brate; + int32_t ism_total_brate; #endif + if ( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } #ifdef MASA_AND_OBJECTS - sce_brate = 0; + ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { - sce_brate += st_ivas->hSCE[i]->element_brate; + ism_total_brate += st_ivas->hSCE[i]->element_brate; } } #endif ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS , - st_ivas->ivas_format, st_ivas->ism_mode, sce_brate + st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); @@ -655,7 +656,7 @@ static ivas_error ivas_masa_dec_config( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t ivas_total_brate; - int32_t sce_brate; + int32_t ism_total_brate; #endif error = IVAS_ERR_OK; @@ -664,16 +665,16 @@ static ivas_error ivas_masa_dec_config( #ifdef MASA_AND_OBJECTS ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - sce_brate = 0; + ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { - sce_brate += st_ivas->hSCE[i]->element_brate; + ism_total_brate += st_ivas->hSCE[i]->element_brate; } } - ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, sce_brate ); + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { @@ -696,7 +697,6 @@ static ivas_error ivas_masa_dec_config( return error; } - st_ivas->hQMetaData->numTwoDirBands = st_ivas->hMasa->config.numTwoDirBands; st_ivas->hQMetaData->useLowerRes = 0; @@ -1281,7 +1281,7 @@ ivas_error ivas_masa_dec_reconfigure( int32_t ivas_total_brate, last_ivas_total_brate; ivas_error error; #ifdef MASA_AND_OBJECTS - int32_t sce_brate; + int32_t ism_total_brate; #endif error = IVAS_ERR_OK; @@ -1346,19 +1346,20 @@ ivas_error ivas_masa_dec_reconfigure( } } #ifdef MASA_AND_OBJECTS - sce_brate = 0; + ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( n = 0; n < st_ivas->nSCE; n++ ) { - sce_brate += st_ivas->hSCE[n]->element_brate; + ism_total_brate += st_ivas->hSCE[n]->element_brate; } } #endif + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp #ifdef MASA_AND_OBJECTS , - st_ivas->ivas_format, st_ivas->ism_mode, sce_brate + st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index d5ed2963c3..070554b9e2 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -332,7 +332,10 @@ ivas_error ivas_enc( #ifdef OMASA_BRATE /* Configure MASA encoder based on frame parameters */ - ivas_masa_enc_config( st_ivas ); // VE2Nokia: this function should return an error code + if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } idx_separated_object = 0; if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) @@ -347,21 +350,18 @@ ivas_error ivas_enc( /* put audio object data in SCE's */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { - // VE2Nokia: merge the following to one function in order to save some stack memory - float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; - /* Estimate MASA parameters for the objects */ - ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, data_transport_f, input_frame, st_ivas->nchan_transport, st_ivas->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); - - /* Merge transport signals */ - ivas_merge_masa_transports( data_transport_f, &( data_f[st_ivas->nchan_ism] ), data_f, input_frame, st_ivas->nchan_transport ); + ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, st_ivas->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); } /* Encode ISMs transport channels */ n = 0; if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ); /* there are no metadata bits in SCE in this mode */ // VE2Nokia: this function should return an error code + if ( ( error = ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) /* there are no metadata bits in SCE in this mode */ + { + return error; + } } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -437,9 +437,9 @@ ivas_error ivas_enc( #endif /* OMASA_BRATE */ /* Encode MASA transport channels */ - if ( st_ivas->nCPE == 1 ) // VE2Nokia: this condition is not necessary + if ( ( ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { - ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ); // VE2Nokia: this condition is unnecessary + return error; } } #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index cb8217d556..63bba1d337 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -565,7 +565,7 @@ ivas_error ivas_init_encoder( else if ( ivas_format == MASA_ISM_FORMAT ) { int32_t element_brate_tmp[MAX_NUM_OBJECTS]; - int32_t sce_brate; + int32_t ism_total_brate; int16_t k; st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); @@ -580,7 +580,6 @@ ivas_error ivas_init_encoder( } k = 0; - sce_brate = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { k++; @@ -589,8 +588,8 @@ ivas_error ivas_init_encoder( if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { /* use the bitrate for one object */ - sce_brate = sep_object_brate[k - 2][0]; - create_sce_enc( st_ivas, 0, sce_brate ); // VE2Nokia: this function should return an error code + ism_total_brate = sep_object_brate[k - 2][0]; + create_sce_enc( st_ivas, 0, ism_total_brate ); // VE2Nokia: this function should return an error code /* prepare bitstream buffers */ st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list = ind_list[0]; @@ -601,10 +600,10 @@ ivas_error ivas_init_encoder( } else { - sce_brate = 0; + ism_total_brate = 0; for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { - sce_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; create_sce_enc( st_ivas, sce_id, sep_object_brate[k - 2][st_ivas->nSCE - 1] ); // VE2Nokia: this function should return an error code /* prepare bitstream buffers */ @@ -625,7 +624,8 @@ ivas_error ivas_init_encoder( { ivas_omasa_enc_open( st_ivas ); } - if ( ivas_total_brate - sce_brate >= MIN_BRATE_MDCT_STEREO ) + + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } @@ -636,7 +636,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - sce_brate ); + create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - ism_total_brate ); /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 7986196a08..5fca4c2222 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -111,8 +111,9 @@ ivas_error ivas_masa_enc_open( ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; #ifdef MASA_AND_OBJECTS - int32_t sce_brate; + int32_t ism_total_brate; #endif + error = IVAS_ERR_OK; if ( ( hMasa = (MASA_ENCODER_HANDLE) malloc( sizeof( MASA_ENCODER ) ) ) == NULL ) @@ -145,12 +146,12 @@ ivas_error ivas_masa_enc_open( } } #ifdef MASA_AND_OBJECTS - sce_brate = 0; + ism_total_brate = 0; if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { - sce_brate += st_ivas->hSCE[i]->element_brate; + ism_total_brate += st_ivas->hSCE[i]->element_brate; } } #endif @@ -158,12 +159,13 @@ ivas_error ivas_masa_enc_open( st_ivas->hQMetaData, &hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS , - hEncoderConfig->ivas_format, st_ivas->ism_mode, sce_brate + hEncoderConfig->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); + #ifdef MASA_AND_OBJECTS if ( hEncoderConfig->ivas_format == MASA_FORMAT || hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) #else @@ -628,21 +630,23 @@ ivas_error ivas_masa_enc_config( int32_t ivas_total_brate; ivas_error error; #ifdef MASA_AND_OBJECTS - int32_t sce_brate; + int32_t ism_total_brate; #endif + error = IVAS_ERR_OK; hMasa = st_ivas->hMasa; hQMetaData = st_ivas->hQMetaData; ivas_format = st_ivas->hEncoderConfig->ivas_format; ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + #ifdef MASA_AND_OBJECTS - sce_brate = 0; + ism_total_brate = 0; if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { - sce_brate += st_ivas->hSCE[i]->element_brate; + ism_total_brate += st_ivas->hSCE[i]->element_brate; } } #endif @@ -650,12 +654,11 @@ ivas_error ivas_masa_enc_config( hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS , - ivas_format, st_ivas->ism_mode, sce_brate + ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); hQMetaData->is_masa_ivas_format = 1; - #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) #else @@ -771,7 +774,7 @@ ivas_error ivas_masa_enc_config( #endif { #ifdef MASA_AND_OBJECTS - st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ( ivas_total_brate - sce_brate < MASA_STEREO_MIN_BITRATE ) ? 1 : 0; + st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ( ivas_total_brate - ism_total_brate < MASA_STEREO_MIN_BITRATE ) ? 1 : 0; #else st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ivas_total_brate < MASA_STEREO_MIN_BITRATE ? 1 : 0; #endif @@ -1902,17 +1905,17 @@ void ivas_masa_enc_reconfigure( int16_t sce_id, cpe_id; int32_t ivas_total_brate; #ifdef MASA_AND_OBJECTS - int32_t sce_brate; + int32_t ism_total_brate; #endif ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; #ifdef MASA_AND_OBJECTS - sce_brate = 0; + ism_total_brate = 0; if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { - sce_brate += st_ivas->hSCE[sce_id]->element_brate; + ism_total_brate += st_ivas->hSCE[sce_id]->element_brate; } } #endif @@ -1935,8 +1938,9 @@ void ivas_masa_enc_reconfigure( copy_encoder_config( st_ivas, st_ivas->hCPE[cpe_id]->hCoreCoder[n], 0 ); st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ } + #ifdef MASA_AND_OBJECTS - if ( ivas_total_brate - sce_brate < MASA_STEREO_MIN_BITRATE || ivas_total_brate - sce_brate < MIN_BRATE_MDCT_STEREO ) + if ( ivas_total_brate - ism_total_brate < MASA_STEREO_MIN_BITRATE || ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) { st_ivas->hCPE[cpe_id]->element_mode = IVAS_CPE_DFT; } @@ -1963,7 +1967,7 @@ void ivas_masa_enc_reconfigure( ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp #ifdef MASA_AND_OBJECTS , - st_ivas->hEncoderConfig->ivas_format, st_ivas->ism_mode, sce_brate + st_ivas->hEncoderConfig->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 16758a4d77..d756f063e7 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -278,20 +278,21 @@ void ivas_omasa_set_config( *--------------------------------------------------------------------------*/ void ivas_omasa_enc( - OMASA_ENC_HANDLE hOMasa, - IVAS_QMETADATA_HANDLE hQMeta, - MASA_ENCODER_HANDLE hMasa, - ISM_METADATA_HANDLE hIsmMeta[], - float data_in_f[][L_FRAME48k], - float data_out_f[][L_FRAME48k], - const int16_t input_frame, - const int16_t nchan_transport, - const int16_t nchan_ism, - const ISM_MODE ism_mode, - float data_separated_object[L_FRAME48k], - int16_t *idx_separated_object ) + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ + const ISM_MODE ism_mode, /* i : ISM mode */ + float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ + int16_t *idx_separated_object /* o : Index of the separated object */ +) { int16_t i, j; + float data_out_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; /* Analysis */ if ( ism_mode == ISM_MODE_NONE ) @@ -481,12 +482,14 @@ void ivas_omasa_enc( /* Downmix */ ivas_omasa_dmx( data_in_f, data_out_f, input_frame, nchan_transport, nchan_ism, hIsmMeta, hOMasa->prev_object_dm_gains, hOMasa->interpolator ); + /* Merge transport signals */ + ivas_merge_masa_transports( data_out_f, &( data_in_f[nchan_ism] ), data_in_f, input_frame, nchan_transport ); + return; } #ifdef OMASA_BRATE - /*-------------------------------------------------------------------------* * set_ism_importance_interformat() * -- GitLab From d4c50f64dd8e853c6d1fc208792586c5b8c92238 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 11:49:23 +0100 Subject: [PATCH 032/591] address "VE2Nokia" comments, part 2 --- lib_com/ivas_ism_config.c | 98 --------------------------------- lib_com/ivas_masa_com.c | 5 +- lib_com/ivas_omasa_com.c | 98 +++++++++++++++++++++++++++++++++ lib_com/ivas_prot.h | 10 +++- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_enc/ivas_init_enc.c | 62 ++++++++++----------- lib_enc/ivas_ism_metadata_enc.c | 20 ++----- lib_enc/ivas_omasa_enc.c | 50 +++++++---------- lib_enc/ivas_sce_enc.c | 4 +- 9 files changed, 166 insertions(+), 183 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 5a44c7de09..109e77e5cc 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -586,101 +586,3 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } - - -#ifdef MASA_AND_OBJECTS // VE2Nokia: move this function to the new file ivas_omasa_com.c (?) -/*--------------------------------------------------------------- - * ivas_omasa_ism_mode_select() - * - * selects the ISM mode base on bit-rate and number of objects in the combined ISM MASA format mode - * ---------------------------------------------------------------*/ - -/*! r : ISM format mode */ -ISM_MODE ivas_omasa_ism_mode_select( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t no_obj /* i : number of objects */ -) -{ - ISM_MODE ism_mode = ISM_MODE_NONE; - - switch ( no_obj ) - { - case 1: -#ifdef FIX_24k4_ISM1_MODE - if ( ivas_total_brate >= IVAS_24k4 ) -#else - if ( ivas_total_brate >= IVAS_32k ) -#endif - { - ism_mode = ISM_MASA_MODE_DISC; - } -#ifndef FIX_24k4_ISM1_MODE - else if ( ivas_total_brate >= IVAS_24k4 ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } -#endif - else - { - ism_mode = ISM_MODE_NONE; - } - break; - case 2: - if ( ivas_total_brate >= IVAS_64k ) - { - ism_mode = ISM_MASA_MODE_DISC; - } - else if ( ivas_total_brate >= IVAS_32k ) - { - ism_mode = ISM_MASA_MODE_ONE_OBJ; - } - /* else if ( ivas_total_brate >= IVAS_32k ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } */ - else - { - ism_mode = ISM_MODE_NONE; - } - break; - case 3: - if ( ivas_total_brate >= IVAS_128k ) - { - ism_mode = ISM_MASA_MODE_DISC; - } - else if ( ivas_total_brate >= IVAS_64k ) - { - ism_mode = ISM_MASA_MODE_ONE_OBJ; - } - else if ( ivas_total_brate >= IVAS_48k ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } - else - { - ism_mode = ISM_MODE_NONE; - } - break; - case 4: - if ( ivas_total_brate >= IVAS_160k ) - { - ism_mode = ISM_MASA_MODE_DISC; - } - else if ( ivas_total_brate >= IVAS_64k ) - { - ism_mode = ISM_MASA_MODE_ONE_OBJ; - } - else if ( ivas_total_brate >= IVAS_48k ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } - else - { - ism_mode = ISM_MODE_NONE; - } - break; - } - - return ism_mode; -} -#endif diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 867f9512e8..c8c8f2c3e6 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -511,6 +511,7 @@ void modify_masa_energy_ratios( ) { int16_t i, m, d, b; + for ( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) { if ( hQMetaData->q_direction[0].cfg.nblocks == 1 ) @@ -543,8 +544,8 @@ void modify_masa_energy_ratios( *---------------------------------------------------------------*/ void ivas_get_stereo_panning_gains( - float aziDeg, - float eleDeg, + const float aziDeg, + const float eleDeg, float panningGains[2] ) { float aziRad, eleRad; diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 121ea78076..59dc45abbc 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -55,6 +55,104 @@ #define GAMMA_ISM_HIGH_IMP2 1.35f +#ifdef MASA_AND_OBJECTS +/*--------------------------------------------------------------- + * ivas_omasa_ism_mode_select() + * + * selects the ISM mode base on bit-rate and number of objects in the combined ISM MASA format mode + * ---------------------------------------------------------------*/ + +/*! r : ISM format mode */ +ISM_MODE ivas_omasa_ism_mode_select( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t no_obj /* i : number of objects */ +) +{ + ISM_MODE ism_mode = ISM_MODE_NONE; + + switch ( no_obj ) + { + case 1: +#ifdef FIX_24k4_ISM1_MODE + if ( ivas_total_brate >= IVAS_24k4 ) +#else + if ( ivas_total_brate >= IVAS_32k ) +#endif + { + ism_mode = ISM_MASA_MODE_DISC; + } +#ifndef FIX_24k4_ISM1_MODE + else if ( ivas_total_brate >= IVAS_24k4 ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } +#endif + else + { + ism_mode = ISM_MODE_NONE; + } + break; + case 2: + if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_32k ) + { + ism_mode = ISM_MASA_MODE_ONE_OBJ; + } + /* else if ( ivas_total_brate >= IVAS_32k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } */ + else + { + ism_mode = ISM_MODE_NONE; + } + break; + case 3: + if ( ivas_total_brate >= IVAS_128k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_ONE_OBJ; + } + else if ( ivas_total_brate >= IVAS_48k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } + else + { + ism_mode = ISM_MODE_NONE; + } + break; + case 4: + if ( ivas_total_brate >= IVAS_160k ) + { + ism_mode = ISM_MASA_MODE_DISC; + } + else if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_ONE_OBJ; + } + else if ( ivas_total_brate >= IVAS_48k ) + { + ism_mode = ISM_MASA_MODE_PARAM; + } + else + { + ism_mode = ISM_MODE_NONE; + } + break; + } + + return ism_mode; +} +#endif + + /*--------------------------------------------------------------- * ivas_interformat_brate() * diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b861e3aa1d..018c68eab7 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3346,7 +3346,11 @@ void ivas_dirac_dec_binaural( ); #ifdef MASA_AND_OBJECTS -void ivas_get_stereo_panning_gains( float aziDeg, float eleDeg, float panningGains[2] ); +void ivas_get_stereo_panning_gains( + const float aziDeg, + const float eleDeg, + float panningGains[2] +); #endif ivas_error ivas_binaural_reverb_open( @@ -5121,9 +5125,9 @@ void ivas_filter_process( #ifdef MASA_AND_OBJECTS -/* ----------------------------------------------------------------------------------* +/*----------------------------------------------------------------------------------* * OMASA prototypes -* ----------------------------------------------------------------------------------*/ +*---------------------------------------------------------------------------------*/ ivas_error ivas_omasa_enc_open( Encoder_Struct* st_ivas /* i/o: IVAS encoder handle */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 0d3b5fa572..b5fa185a18 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -504,7 +504,7 @@ ivas_error ivas_ism_metadata_dec( { #ifdef MASA_AND_OBJECTS int16_t masa_ism_flag = 0; - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) // VE2Nokia: ISM_MASA_MODE_ONE_OBJ looks obsolete here + if ( ism_mode == ISM_MASA_MODE_DISC ) { masa_ism_flag = 1; } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 63bba1d337..0e5114bfbe 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -571,12 +571,9 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); st_ivas->nchan_transport = 2; - create_ism_metadata_enc( st_ivas, st_ivas->nchan_ism, element_brate_tmp ); // VE2Nokia: this function should return an error code - /* the values of element_brate_tmp will be re-written in MASA_ISM_FORMAT because they are taken from sep_object_brate[][]*/ - - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + if ( ( error = create_ism_metadata_enc( st_ivas, st_ivas->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) { - st_ivas->nSCE = st_ivas->nchan_ism; + return error; } k = 0; @@ -585,44 +582,42 @@ ivas_error ivas_init_encoder( k++; } - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - /* use the bitrate for one object */ - ism_total_brate = sep_object_brate[k - 2][0]; - create_sce_enc( st_ivas, 0, ism_total_brate ); // VE2Nokia: this function should return an error code + ism_total_brate = 0; - /* prepare bitstream buffers */ - st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list = ind_list[0]; - reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - st_ivas->hSCE[0]->hMetaData->ind_list = ind_list_metadata[0]; - reset_indices_enc( st_ivas->hSCE[0]->hMetaData, MAX_BITS_METADATA ); - } - else + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { - ism_total_brate = 0; - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + if ( ( error = create_sce_enc( st_ivas, sce_id, sep_object_brate[k - 2][st_ivas->nSCE - 1] ) ) != IVAS_ERR_OK ) { - ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; - create_sce_enc( st_ivas, sce_id, sep_object_brate[k - 2][st_ivas->nSCE - 1] ); // VE2Nokia: this function should return an error code + return error; + } - /* prepare bitstream buffers */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + /* prepare bitstream buffers */ + st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; + reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); - } + st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; + reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); } - // VE2Nokia: following functions should return an error code - ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); - ivas_masa_enc_open( st_ivas ); + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { - ivas_omasa_enc_open( st_ivas ); + if ( ( error = ivas_omasa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) @@ -636,7 +631,10 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - ism_total_brate ); + if ( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index bd9183f92f..131a2e3bfc 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -943,6 +943,8 @@ ivas_error create_ism_metadata_enc( ) { int16_t ch, nchan_transport; + + // VE: this part of the code is better to be moved to a separate function, e.g. ivas_set_omasa_TC() #ifdef MASA_AND_OBJECTS nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) @@ -957,25 +959,14 @@ ivas_error create_ism_metadata_enc( st_ivas->nCPE = 1; st_ivas->nSCE = 1; break; - case ISM_MODE_DISC: // VE2Nokia: this cannot happen - st_ivas->nCPE = 1; - st_ivas->nSCE = n_ISms; - break; case ISM_MASA_MODE_DISC: st_ivas->nCPE = 1; st_ivas->nSCE = n_ISms; break; case ISM_MODE_NONE: - if ( nchan_transport == 1 ) // VE2Nokia: this cannot happen - { - st_ivas->nSCE = 1; - st_ivas->nCPE = 0; - } - else - { - st_ivas->nSCE = 0; - st_ivas->nCPE = 1; - } + st_ivas->nSCE = 0; + st_ivas->nCPE = 1; + break; default: break; @@ -1014,6 +1005,7 @@ ivas_error create_ism_metadata_enc( #ifdef MASA_AND_OBJECTS } #endif + /* allocate ISm metadata handles */ for ( ch = 0; ch < n_ISms; ch++ ) { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index d756f063e7..96490893c7 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -949,48 +949,36 @@ static void ivas_omasa_dmx( float gains[MASA_MAX_TRANSPORT_CHANNELS]; float g1, g2; - if ( nchan_transport == 2 ) + + for ( i = 0; i < nchan_transport; i++ ) { - for ( i = 0; i < nchan_transport; i++ ) - { - set_zero( data_out_f[i], input_frame ); - } + set_zero( data_out_f[i], input_frame ); + } - for ( i = 0; i < nchan_ism; i++ ) - { - azimuth = hIsmMeta[i]->azimuth; - elevation = hIsmMeta[i]->elevation; + for ( i = 0; i < nchan_ism; i++ ) + { + azimuth = hIsmMeta[i]->azimuth; + elevation = hIsmMeta[i]->elevation; - ivas_get_stereo_panning_gains( azimuth, elevation, gains ); + ivas_get_stereo_panning_gains( azimuth, elevation, gains ); - /* Downmix using the panning gains */ - for ( j = 0; j < nchan_transport; j++ ) + /* Downmix using the panning gains */ + for ( j = 0; j < nchan_transport; j++ ) + { + if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0f ) { - if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0f ) + for ( k = 0; k < input_frame; k++ ) { - for ( k = 0; k < input_frame; k++ ) - { - g1 = interpolator[k]; - g2 = 1.0f - g1; - data_out_f[j][k] += ( g1 * gains[j] + g2 * prev_gains[i][j] ) * data_in_f[i][k]; - } + g1 = interpolator[k]; + g2 = 1.0f - g1; + data_out_f[j][k] += ( g1 * gains[j] + g2 * prev_gains[i][j] ) * data_in_f[i][k]; } - prev_gains[i][j] = gains[j]; - } - } - } - else if ( nchan_transport == 1 ) // VE2Nokia: is ti relevant? - { - for ( i = 0; i < input_frame; i++ ) - { - data_out_f[0][i] = 0.0f; - for ( j = 0; j < nchan_ism; j++ ) - { - data_out_f[0][i] += data_in_f[j][i]; } + prev_gains[i][j] = gains[j]; } } + return; } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index de1c0466ce..1bfe4773a1 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -350,9 +350,9 @@ ivas_error create_sce_enc( copy_encoder_config( st_ivas, st, 1 ); #ifdef MASA_AND_OBJECTS - if ( st_ivas->ism_mode >= ISM_MASA_MODE_PARAM ) // VE2Nokia: ??? + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { - st->element_mode = IVAS_SCE; /* To do: Nokia check as this is not optimal and verify if it influences other SCE modes */ + st->element_mode = IVAS_SCE; } #endif -- GitLab From af4fb067d299fb6c73ea2b150286f3c8f94ff97c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 12:17:33 +0100 Subject: [PATCH 033/591] address "VE2Nokia" comments, part 3/3 --- lib_com/ivas_rom_com.c | 54 +++++++++++++++++++++------------------- lib_com/ivas_rom_com.h | 15 +++++------ lib_enc/ivas_enc.c | 19 +++++++------- lib_enc/ivas_init_enc.c | 9 +++---- lib_enc/ivas_omasa_enc.c | 4 +-- lib_enc/ivas_stat_enc.h | 6 ++--- lib_enc/lib_enc.c | 17 ++++--------- lib_enc/lib_enc.h | 2 +- 8 files changed, 60 insertions(+), 66 deletions(-) diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 641a5f5c84..4e2ef7b596 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2784,8 +2784,7 @@ const float McMASA_LFEGain_vectors[64] = * OMASA ROM tables *----------------------------------------------------------------------------------*/ -// VE2Nokia: add "const" to the arrays -int32_t sep_object_brate[][MAX_NUM_OBJECTS] = +const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = { {0, 0, 0, 0}, /* 13k2 */ {0, 0, 0, 0}, /* 16k4 */ @@ -2812,29 +2811,34 @@ int32_t sep_object_brate[][MAX_NUM_OBJECTS] = }; /* column wise DCT matrices for 4 5, and 8 dim */ - float dct4[] = { - 0.5000f, 0.6533f, 0.5000f, 0.2706f, - 0.5000f, 0.2706f, -0.5000f, -0.6533f, - 0.5000f, -0.2706f, -0.5000f, 0.6533f, - 0.5000f, -0.6533f, 0.5000f, -0.2706f - }; - - float dct5[] = { - 0.4472f, 0.6015f, 0.5117f, 0.3717f, 0.1954f, - 0.4472f, 0.3717f, -0.1954f, -0.6015f, -0.5117f, - 0.4472f, 0.0000f, -0.6325f, -0.0000f, 0.6325f, - 0.4472f, -0.3717f, -0.1954f, 0.6015f, -0.5117f, - 0.4472f, -0.6015f, 0.5117f, -0.3717f, 0.1954f - }; - - float dct8[] = { - 0.3536f, 0.4904f, 0.4619f, 0.4157f, 0.3536f, 0.2778f, 0.1913f, 0.0975f, 0.3536f, 0.4157f, - 0.1913f, -0.0975f, -0.3536f, -0.4904f, -0.4619f, -0.2778f, 0.3536f, 0.2778f, -0.1913f, -0.4904f, - -0.3536f, 0.0975f, 0.4619f, 0.4157f, 0.3536f, 0.0975f, -0.4619f, -0.2778f, 0.3536f, 0.4157f, - -0.1913f, -0.4904f, 0.3536f, -0.0975f, -0.4619f, 0.2778f, 0.3536f, -0.4157f, -0.1913f, 0.4904f, - 0.3536f, -0.2778f, -0.1913f, 0.4904f, -0.3536f, -0.0975f, 0.4619f, -0.4157f, 0.3536f, -0.4157f, - 0.1913f, 0.0975f, -0.3536f, 0.4904f, -0.4619f, 0.2778f, 0.3536f, -0.4904f, 0.4619f, -0.4157f, - 0.3536f, -0.2778f, 0.1913f, -0.0975f }; +const float dct4[4*4] = +{ + 0.5000f, 0.6533f, 0.5000f, 0.2706f, + 0.5000f, 0.2706f, -0.5000f, -0.6533f, + 0.5000f, -0.2706f, -0.5000f, 0.6533f, + 0.5000f, -0.6533f, 0.5000f, -0.2706f +}; + +const float dct5[5*5] = +{ + 0.4472f, 0.6015f, 0.5117f, 0.3717f, 0.1954f, + 0.4472f, 0.3717f, -0.1954f, -0.6015f, -0.5117f, + 0.4472f, 0.0000f, -0.6325f, -0.0000f, 0.6325f, + 0.4472f, -0.3717f, -0.1954f, 0.6015f, -0.5117f, + 0.4472f, -0.6015f, 0.5117f, -0.3717f, 0.1954f +}; + +const float dct8[8*8] = +{ + 0.3536f, 0.4904f, 0.4619f, 0.4157f, 0.3536f, 0.2778f, 0.1913f, 0.0975f, + 0.3536f, 0.4157f, 0.1913f, -0.0975f, -0.3536f, -0.4904f, -0.4619f, -0.2778f, + 0.3536f, 0.2778f, -0.1913f, -0.4904f, -0.3536f, 0.0975f, 0.4619f, 0.4157f, + 0.3536f, 0.0975f, -0.4619f, -0.2778f, 0.3536f, 0.4157f, -0.1913f, -0.4904f, + 0.3536f, -0.0975f, -0.4619f, 0.2778f, 0.3536f, -0.4157f, -0.1913f, 0.4904f, + 0.3536f, -0.2778f, -0.1913f, 0.4904f, -0.3536f, -0.0975f, 0.4619f, -0.4157f, + 0.3536f, -0.4157f, 0.1913f, 0.0975f, -0.3536f, 0.4904f, -0.4619f, 0.2778f, + 0.3536f, -0.4904f, 0.4619f, -0.4157f, 0.3536f, -0.2778f, 0.1913f, -0.0975f +}; #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index acf2a80924..036538a032 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -256,7 +256,6 @@ extern const uint16_t ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ extern const uint16_t ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; extern const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; - /*----------------------------------------------------------------------------------* * MASA ROM tables *----------------------------------------------------------------------------------*/ @@ -313,11 +312,14 @@ extern const float cb_azi_chan[]; extern const float McMASA_LFEGain_vectors[64]; #ifdef MASA_AND_OBJECTS -/* MASA and ISM combined format */ -extern int32_t sep_object_brate[][MAX_NUM_OBJECTS]; -extern float dct4[]; -extern float dct5[]; -extern float dct8[]; +/*----------------------------------------------------------------------------------* + * MASA and ISM (OMASA) combined format ROM tables + *----------------------------------------------------------------------------------*/ + +extern const int32_t sep_object_brate[][MAX_NUM_OBJECTS]; +extern const float dct4[]; +extern const float dct5[]; +extern const float dct8[]; #endif /*----------------------------------------------------------------------------------* @@ -333,7 +335,6 @@ extern const float ism_elevation_borders[4]; extern const int16_t Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1]; - /*----------------------------------------------------------------------------------* * LFE coding ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 070554b9e2..a9e459bc81 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -266,7 +266,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0, NULL + ISM_MODE_NONE, -1, NULL, -1, NULL #endif ); } @@ -321,10 +321,10 @@ ivas_error ivas_enc( hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */ - if ( ( st_ivas->hEncoderConfig->nchan_inp - st_ivas->nchan_ism ) == 1 ) + if ( ( st_ivas->hEncoderConfig->nchan_inp - hEncoderConfig->nchan_ism ) == 1 ) { - v_multc( data_f[st_ivas->nchan_ism], 1.0f / SQRT2, data_f[st_ivas->nchan_ism], input_frame ); - mvr2r( data_f[st_ivas->nchan_ism], data_f[st_ivas->nchan_ism + 1], input_frame ); + v_multc( data_f[hEncoderConfig->nchan_ism], 1.0f / SQRT2, data_f[hEncoderConfig->nchan_ism], input_frame ); + mvr2r( data_f[hEncoderConfig->nchan_ism], data_f[hEncoderConfig->nchan_ism + 1], input_frame ); } /* nb_bits_metadata[0] = 0; */ @@ -345,13 +345,13 @@ ivas_error ivas_enc( } /* Estimate TF-tile energy for the input MASA stream */ - ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[st_ivas->nchan_ism] ), input_frame, st_ivas->nchan_transport ); + ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); /* put audio object data in SCE's */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Estimate MASA parameters for the objects */ - ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, st_ivas->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); + ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); } /* Encode ISMs transport channels */ @@ -370,12 +370,12 @@ ivas_error ivas_enc( { return error; } - n = st_ivas->nchan_ism; + n = st_ivas->hEncoderConfig->nchan_ism; } /* Encode MASA parameters and write MASA metadata bitstream */ ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); /* Configuration of combined-format bit-budget distribution */ #ifdef DEBUG_VA @@ -496,11 +496,10 @@ ivas_error ivas_enc( ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 #ifdef MASA_AND_OBJECTS , - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, 0, NULL + ISM_MODE_NONE, -1, NULL, -1, NULL #endif ); - if ( st_ivas->hMcMasa->separateChannelEnabled ) { if ( ( error = ivas_sce_enc( st_ivas, 0, data_f[2], input_frame, 0 ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 0e5114bfbe..909115d63e 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -568,10 +568,10 @@ ivas_error ivas_init_encoder( int32_t ism_total_brate; int16_t k; - st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, hEncoderConfig->nchan_ism ); st_ivas->nchan_transport = 2; - if ( ( error = create_ism_metadata_enc( st_ivas, st_ivas->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) + if ( ( error = create_ism_metadata_enc( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) { return error; } @@ -583,8 +583,6 @@ ivas_error ivas_init_encoder( } ism_total_brate = 0; - - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; @@ -601,7 +599,6 @@ ivas_error ivas_init_encoder( reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); } - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { return error; @@ -1103,7 +1100,7 @@ void ivas_destroy_enc( #ifdef MASA_AND_OBJECTS if ( st_ivas->hOMasa != NULL ) { - ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->nchan_ism ); + ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); st_ivas->hOMasa = NULL; } #endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 96490893c7..edc2f77cbf 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -87,7 +87,7 @@ ivas_error ivas_omasa_enc_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA encoder\n" ) ); } - numAnalysisChannels = st_ivas->nchan_ism; + numAnalysisChannels = st_ivas->hEncoderConfig->nchan_ism; /* initialize delay compensation */ hOMasa->num_samples_delay_comp = NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS ); @@ -595,7 +595,7 @@ void ivas_set_surplus_brate_enc( } else { - for ( int16_t i = 0; i < st_ivas->nchan_ism; i++ ) + for ( int16_t i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) { tmpF += st_ivas->hSCE[i]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[i + 1] * 50 ); } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index bf574dbfcb..ed07d884bd 100755 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1057,6 +1057,9 @@ typedef struct encoder_config_structure int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ +#ifdef MASA_AND_OBJECTS + int16_t nchan_ism; /* number of ISM input channels in combined format coding */ +#endif int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ @@ -1100,9 +1103,6 @@ typedef struct /* high-level encoder parameters */ int16_t nchan_transport; /* number of transport channels */ -#ifdef MASA_AND_OBJECTS - int16_t nchan_ism; // VE2Nokia: move it under hEncoderConfig, or remove it and replace it by "nchan_inp - 2" in the code -#endif int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t codec_mode; /* Mode1 or Mode2 of core codec */ int16_t last_codec_mode; /* previous frame Mode 1 or 2 */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 09e4b1e03f..3aaddb3c33 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -366,7 +366,7 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( 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 */ + const int16_t masaVariant /* i : index specifying the number of MASA transport channels */ ) { Encoder_Struct *st_ivas; @@ -384,12 +384,8 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( st_ivas = hIvasEnc->st_ivas; switch ( masaVariant ) { - case IVAS_ENC_MASA_1CH: // VE2Nokia: seems not needeed - st_ivas->hEncoderConfig->nchan_inp = 1 + numObjects; - st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ - break; case IVAS_ENC_MASA_2CH: - st_ivas->hEncoderConfig->nchan_inp = 2 + numObjects; + st_ivas->hEncoderConfig->nchan_inp = CPE_CHANNELS + numObjects; st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ break; default: @@ -401,11 +397,8 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( /* Currently this is true but it is already shown in descriptive metadata that there can be inequality for this. */ st_ivas->nchan_transport = st_ivas->hEncoderConfig->nchan_inp - numObjects; - - st_ivas->hEncoderConfig->ivas_format = MASA_ISM_FORMAT; - - st_ivas->nchan_ism = numObjects; + st_ivas->hEncoderConfig->nchan_ism = numObjects; return configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); } @@ -870,9 +863,9 @@ static ivas_error configureEncoder( #ifdef MASA_AND_OBJECTS else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { - st_ivas->ism_mode = ivas_omasa_ism_mode_select( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_ism ); + st_ivas->ism_mode = ivas_omasa_ism_mode_select( st_ivas->hEncoderConfig->ivas_total_brate, hEncoderConfig->nchan_ism ); - cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_ism ); + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, st_ivas->hEncoderConfig->ivas_total_brate, hEncoderConfig->nchan_ism ); /*adapt element_mode according to the bit-rate*/ if ( hEncoderConfig->element_mode_init != IVAS_SCE ) diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index d66e58e1dd..06b89f85fc 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -205,7 +205,7 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( 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 */ + const int16_t masaVariant /* i : index specifying the number of MASA transport channels */ ); #endif -- GitLab From 57e03bab9d039f7f3365c906cc8e0513d5230d52 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 12:30:21 +0100 Subject: [PATCH 034/591] add error code to return of ivas_masa_ism_data_open() --- lib_com/ivas_omasa_com.c | 3 ++- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_init_dec.c | 13 ++++++++++--- lib_dec/ivas_masa_dec.c | 12 ++++++------ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 59dc45abbc..43f6344daa 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -59,7 +59,8 @@ /*--------------------------------------------------------------- * ivas_omasa_ism_mode_select() * - * selects the ISM mode base on bit-rate and number of objects in the combined ISM MASA format mode + * selects the ISM mode base on IVAS total bit-rate and + * the number of objects in the combined ISM MASA format mode * ---------------------------------------------------------------*/ /*! r : ISM format mode */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 018c68eab7..7057d8d350 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5209,7 +5209,7 @@ void ivas_merge_masa_transports( const int16_t num_transport_channels /* i : Number of transport audio signals */ ); -void ivas_masa_ism_data_open( +ivas_error ivas_masa_ism_data_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f20dbf1f09..eb02830150 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1009,14 +1009,21 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); } - if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nSCE, temp_brate ) ) != IVAS_ERR_OK ) + if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nchan_ism, temp_brate ) ) != IVAS_ERR_OK ) { return error; } } - ivas_masa_dec_open( st_ivas ); - ivas_masa_ism_data_open( st_ivas ); + if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 06646b2ab9..09aff57be9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -558,18 +558,16 @@ ivas_error ivas_masa_dec_open( * *-------------------------------------------------------------------*/ -void ivas_masa_ism_data_open( +ivas_error ivas_masa_ism_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { MASA_ISM_DATA_HANDLE hMasaIsmData; - int16_t bin; - int16_t ch; + int16_t ch, bin; if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) { - fprintf( stderr, "Can not allocate memory for MASA_ISM data\n" ); - exit( -1 ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA ISM data\n" ) ); } for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) @@ -588,9 +586,11 @@ void ivas_masa_ism_data_open( hMasaIsmData->delayBuffer = NULL; st_ivas->hMasaIsmData = hMasaIsmData; - return; + return IVAS_ERR_OK; } #endif + + /*-----------------------------------------------------------------------* * ivas_masa_dec_close() * -- GitLab From bf1c0053a26de0a838e570a7e26478c6f3253397 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 13:02:51 +0100 Subject: [PATCH 035/591] remove DEBUG_MODE_INFO --- lib_com/ivas_prot.h | 2 +- lib_com/options.h | 1 - lib_enc/ivas_core_enc.c | 8 -------- lib_enc/ivas_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 8 ++------ 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7057d8d350..637adbda6e 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5161,7 +5161,7 @@ void ivas_omasa_enc( #ifdef OMASA_BRATE void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -#ifdef DEBUG_VA +#ifdef DEBUG_MODE_INFO , const int16_t *nb_bits_metadata /* i : number of metadata bits */ #endif diff --git a/lib_com/options.h b/lib_com/options.h index d73306ae58..bf239e537c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,7 +165,6 @@ #define MASA_AND_OBJECTS_VE // VA: improve codec print-outs #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo -#define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files #endif diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index c4f4b376c6..a55d6bab69 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -200,14 +200,6 @@ ivas_error ivas_core_enc( { ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, &( sts[0]->core_brate ), &diff_nBits ); } - -#ifdef DEBUG_VA - if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT ) - { - diff_nBits = max( diff_nBits, 0 ); - dbgwrite( &diff_nBits, 2, 1, 960, "res/_diff" ); - } -#endif #endif /*---------------------------------------------------------------------* diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index a9e459bc81..a452b6dbf1 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -378,7 +378,7 @@ ivas_error ivas_enc( st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); /* Configuration of combined-format bit-budget distribution */ -#ifdef DEBUG_VA +#ifdef DEBUG_MODE_INFO ivas_set_surplus_brate_enc( st_ivas, nb_bits_metadata ); #else ivas_set_surplus_brate_enc( st_ivas ); diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index edc2f77cbf..bb2e898af4 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -473,10 +473,6 @@ void ivas_omasa_enc( /* Estimate energies and ratios */ ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); - -#ifdef DEBUG_VA - dbgwrite( &selected_object, 2, 1, input_frame, "res/selected_object" ); -#endif } /* Downmix */ @@ -564,7 +560,7 @@ void set_ism_importance_interformat( void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -#ifdef DEBUG_VA +#ifdef DEBUG_MODE_INFO , const int16_t *nb_bits_metadata /* i : number of metadata bits */ #endif @@ -584,7 +580,7 @@ void ivas_set_surplus_brate_enc( st_ivas->hCPE[0]->brate_surplus = 0; } -#ifdef DEBUG_VA +#ifdef DEBUG_MODE_INFO if ( st_ivas->hSCE[0] != NULL ) { int16_t input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); -- GitLab From 78b6266d59957ac09914d915f3f4599c8dd7872b Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 13:06:12 +0100 Subject: [PATCH 036/591] accept MASA_AND_OBJECTS and FIX_24k4_ISM1_MODE --- lib_com/bitstream.c | 4 ++-- lib_com/ivas_omasa_com.c | 10 ---------- lib_com/options.h | 3 +-- lib_dec/lib_dec.c | 4 ++-- lib_enc/lib_enc.c | 4 ---- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index b90c6d4ac7..42df9966de 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1812,7 +1812,7 @@ ivas_error preview_indices( else { st_ivas->ivas_format = MASA_FORMAT; -#ifdef MASA_AND_OBJECTS_VE +#ifdef MASA_AND_OBJECTS if ( bit_stream[3] ) { st_ivas->ivas_format = MASA_ISM_FORMAT; @@ -1974,7 +1974,7 @@ ivas_error preview_indices( ivas_sba_config( 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 ) ); } -#ifdef MASA_AND_OBJECTS_VE +#ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { /* read number of objects from the bitstream */ diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 43f6344daa..46ebcc6e9d 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -74,20 +74,10 @@ ISM_MODE ivas_omasa_ism_mode_select( switch ( no_obj ) { case 1: -#ifdef FIX_24k4_ISM1_MODE if ( ivas_total_brate >= IVAS_24k4 ) -#else - if ( ivas_total_brate >= IVAS_32k ) -#endif { ism_mode = ISM_MASA_MODE_DISC; } -#ifndef FIX_24k4_ISM1_MODE - else if ( ivas_total_brate >= IVAS_24k4 ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } -#endif else { ism_mode = ISM_MODE_NONE; diff --git a/lib_com/options.h b/lib_com/options.h index bf239e537c..9c1f24fd93 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,8 +161,7 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#define FIX_24k4_ISM1_MODE // activate DISC mode at 24.4 kbps 1 object -#define MASA_AND_OBJECTS_VE // VA: improve codec print-outs + #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index fab25168be..e0dbdc1a75 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1880,7 +1880,7 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Input configuration: MASA - %d channel(s)\n", st_ivas->nchan_transport ); } -#ifdef MASA_AND_OBJECTS_VE +#ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MC_FORMAT ) #else else /* MC_FORMAT */ @@ -1893,7 +1893,7 @@ static ivas_error printConfigInfo_dec( fprintf( stdout, "Input configuration: %s\n", config_str ); } -#ifdef MASA_AND_OBJECTS_VE +#ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { fprintf( stdout, "Input configuration: combined ISM and MASA (%i separated ISM stream(s)) \n", st_ivas->nchan_transport ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 3aaddb3c33..f600d0fa91 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1631,11 +1631,7 @@ static ivas_error printConfigInfo_enc( #ifdef MASA_AND_OBJECTS else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { -#ifdef MASA_AND_OBJECTS_VE fprintf( stdout, "IVAS format: combined ISM and MASA (%i ISM stream(s))\n", hEncoderConfig->nchan_inp - 2 ); -#else - fprintf( stdout, "IVAS format: MASA and objects format\n" ); -#endif } #endif -- GitLab From c2d2b14e5e1d284da22a2f3641494fa524075fd0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 13:10:38 +0100 Subject: [PATCH 037/591] merge OMASA_BRATE_TD into OMASA_BRATE --- lib_com/options.h | 11 ++++------- lib_dec/ivas_cpe_dec.c | 4 +--- lib_dec/ivas_stereo_switching_dec.c | 2 +- lib_dec/ivas_stereo_td_dec.c | 20 ++++++++++---------- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_stereo_td_enc.c | 4 ++-- 6 files changed, 19 insertions(+), 24 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9c1f24fd93..eae524fed2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,14 +157,11 @@ #define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ -#define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ -#ifdef MASA_AND_OBJECTS -#define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ - - -#define OMASA_BRATE /* VA: combined format bit-budget distribution */ -#define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo +#define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ +#ifdef MASA_AND_OBJECTS +#define OMASA_BRATE /* VA: combined format bit-budget distribution */ +#define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 356789d07f..3311e1e501 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -171,7 +171,6 @@ ivas_error ivas_cpe_dec( } else { - #endif stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); #ifdef MASA_AND_OBJECTS @@ -296,7 +295,7 @@ ivas_error ivas_cpe_dec( /* signal bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); #endif if ( st_ivas->hQMetaData != NULL ) @@ -361,7 +360,6 @@ ivas_error ivas_cpe_dec( } } else - { /* subtract metadata bitbudget */ /* IVAS_fmToDo: TBC whether it is not better to distribute the metadata bits equally between 2 channels */ sts[0]->bits_frame_channel -= nb_bits_metadata; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index bed57060a1..eeb53ff011 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -767,7 +767,7 @@ ivas_error stereo_memory_dec( if ( hCPE->hCoreCoder[0]->bfi == 0 ) { st = hCPE->hCoreCoder[1]; -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate + hCPE->brate_surplus, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + ( hCPE->brate_surplus / FRAMES_PER_SEC ) - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS ); #else hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS ); diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 2e6e447bd7..0c6fe6213d 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -94,7 +94,7 @@ void tdm_configure_dec( int16_t tdm_tmp_SM_LRTD_flag; int16_t mod_ct, core, bits_offset; int16_t idx_LRTD_pri_side, tdm_inst_ratio_idx; -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE int32_t element_brate_adapt; int16_t bstr_last_pos; #endif @@ -102,7 +102,7 @@ void tdm_configure_dec( hStereoTD = hCPE->hStereoTD; sts = hCPE->hCoreCoder; -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE element_brate_adapt = hCPE->element_brate + hCPE->brate_surplus; bstr_last_pos = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); #endif @@ -132,7 +132,7 @@ void tdm_configure_dec( /* Get few parameters needed to decode the bitrate allocated to each channel */ /* Get the coder_type of the secondary channel (last parameter on 2 bits) */ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING ); #else sts[1]->coder_type = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING ), TDM_SECONDARY_SIGNALLING ); @@ -164,7 +164,7 @@ void tdm_configure_dec( *----------------------------------------------------------------*/ /* Get the correlation ratio */ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE *tdm_ratio_idx = get_indice_st( sts[0], element_brate_adapt, (int16_t) ( bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS ); #else *tdm_ratio_idx = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS ); @@ -174,7 +174,7 @@ void tdm_configure_dec( if ( sts[1]->coder_type == INACTIVE ) { /* Get the flag on the LPC reusage type (primary channel of ave LPC */ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS ); #else hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS ); @@ -184,7 +184,7 @@ void tdm_configure_dec( else { /* Get the flag on the LPC reusage */ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS ); #else hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS ); @@ -244,7 +244,7 @@ void tdm_configure_dec( int16_t tmpS = 20; if ( hStereoTD->tdm_LRTD_flag == 0 ) { -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE tmpS = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD ); #else tmpS = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); @@ -257,7 +257,7 @@ void tdm_configure_dec( { if ( hStereoTD->tdm_LRTD_flag == 0 ) { -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE hCPE->hStereoTCA->refChanIndx = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS, STEREO_BITS_TCA_CHAN ); hCPE->hStereoTCA->indx_ica_NCShift = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN, STEREO_BITS_TCA_CORRSTATS ); hCPE->hStereoTCA->indx_ica_gD = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD ); @@ -285,7 +285,7 @@ void tdm_configure_dec( #endif /* set the BW of the secondary channel */ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel > IVAS_16k4 / FRAMES_PER_SEC ) #else if ( hStereoTD->tdm_LRTD_flag && hCPE->element_brate > IVAS_13k2 ) @@ -304,7 +304,7 @@ void tdm_configure_dec( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 536272a94c..013e1a2abd 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -396,7 +396,7 @@ ivas_error ivas_cpe_enc( /* signal the bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); #endif if ( st_ivas->hQMetaData != NULL ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index c42b2fe748..8a7c10f5f3 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -419,7 +419,7 @@ void tdm_configure_enc( sts[1]->coder_type = GENERIC; } -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) { sts[1]->coder_type = INACTIVE; @@ -469,7 +469,7 @@ void tdm_configure_enc( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ -#ifdef OMASA_BRATE_TD +#ifdef OMASA_BRATE tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, -- GitLab From cfe0a8b7a20c893f841f6a3d07a13d5caec283a4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Jan 2023 13:30:42 +0100 Subject: [PATCH 038/591] fix for 64 kbps 2 obj; under OMASA_BRATE --- lib_com/ivas_rom_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 4e2ef7b596..6d8d255aed 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2796,7 +2796,7 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = #endif {IVAS_13k2, 0, 0, 0}, /* 48k */ #ifdef OMASA_BRATE - {16000, 12000, 0, 0}, /* 64k */ + {16000, 11700, 0, 0}, /* 64k */ #else {16000, IVAS_13k2, 0, 0}, /* 64k */ #endif -- GitLab From 5d295d691207e93e0e325e76950c09f708a3d922 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 27 Jan 2023 11:46:50 +0100 Subject: [PATCH 039/591] fix compilation when OMASA_BRATE is disabled --- lib_com/ivas_omasa_com.c | 9 ++++----- lib_com/options.h | 2 +- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_enc.c | 18 +++++------------- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 46ebcc6e9d..38733ff97e 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -39,7 +39,7 @@ #include "debug.h" #endif - +#ifdef MASA_AND_OBJECTS #ifdef OMASA_BRATE /*--------------------------------------------------------------- * Local constants @@ -53,9 +53,8 @@ #define GAMMA_ISM_LOW_IMP2 0.9f #define GAMMA_ISM_MEDIUM_IMP2 1.2f #define GAMMA_ISM_HIGH_IMP2 1.35f +#endif - -#ifdef MASA_AND_OBJECTS /*--------------------------------------------------------------- * ivas_omasa_ism_mode_select() * @@ -141,9 +140,9 @@ ISM_MODE ivas_omasa_ism_mode_select( return ism_mode; } -#endif +#ifdef OMASA_BRATE /*--------------------------------------------------------------- * ivas_interformat_brate() * @@ -267,5 +266,5 @@ void ivas_combined_format_brate_sanity( return; } - +#endif #endif diff --git a/lib_com/options.h b/lib_com/options.h index eae524fed2..a6c9939967 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS -#define OMASA_BRATE /* VA: combined format bit-budget distribution */ +//#define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 013e1a2abd..b4d54d397f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -626,7 +626,7 @@ ivas_error ivas_cpe_enc( if ( ivas_format == MASA_ISM_FORMAT ) { - cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, hEncoderConfig->nchan_ism ); } #endif diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index a452b6dbf1..68d0bcb873 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -310,9 +310,6 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS else if ( ivas_format == MASA_ISM_FORMAT ) { -#ifndef OMASA_BRATE - float data_transport_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; -#endif float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; @@ -396,27 +393,22 @@ ivas_error ivas_enc( } else { - st_ivas->nSCE = st_ivas->nchan_ism; + st_ivas->nSCE = hEncoderConfig->nchan_ism; } /* Estimate TF-tile energy for the input MASA stream */ - ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[st_ivas->nchan_ism] ), input_frame, st_ivas->nchan_transport ); + ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); /* put audio object data in SCE's */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Estimate MASA parameters for the objects */ - ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, data_transport_f, input_frame, st_ivas->nchan_transport, st_ivas->nchan_ism, st_ivas->ism_mode, + ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); } /* Encode MASA parameters and write MASA metadata bitstream */ ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, st_ivas->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - /* Merge transport signals */ - ivas_merge_masa_transports( data_transport_f, &( data_f[st_ivas->nchan_ism] ), data_f, input_frame, st_ivas->nchan_transport ); - } + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); } /* Encode transport signals */ @@ -432,7 +424,7 @@ ivas_error ivas_enc( { return error; } - n = st_ivas->nchan_ism; + n = hEncoderConfig->nchan_ism; } #endif /* OMASA_BRATE */ -- GitLab From 7514365119a609914da2913f5c4c19d6f4c54562 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 27 Jan 2023 12:22:39 +0100 Subject: [PATCH 040/591] fix crash due to too high 'max_bits' for residual coding in DFT stereo --- lib_enc/ivas_cpe_enc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index b4d54d397f..6c33d77650 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -630,6 +630,7 @@ ivas_error ivas_cpe_enc( } #endif + /* DFT stereo side bits */ if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && cpe_brate < MASA_STEREO_MIN_BITRATE && sts[0]->core_brate != SID_2k40 && sts[0]->core_brate != FRAME_NO_DATA ) { nb_bits = 0; /* Only mono downmix is transmitted in this case */ @@ -643,10 +644,19 @@ ivas_error ivas_cpe_enc( stereo_dft_enc_write_BS( hCPE, &nb_bits ); } + /* Residual coding in MDCT domain */ if ( !( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) ) ) { - /* Residual coding in MDCT domain */ - stereo_dft_enc_res( hCPE->hStereoDft, old_inp_12k8[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal - ( ( ivas_format == MASA_FORMAT ) ? nb_bits_metadata : 0 ) ) ); + int16_t max_bits = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) + { + max_bits -= nb_bits_metadata; +#ifdef OMASA_BRATE + max_bits += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); +#endif + } + + stereo_dft_enc_res( hCPE->hStereoDft, old_inp_12k8[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, max_bits ); } #else if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && sts[0]->core_brate != SID_2k40 && sts[0]->core_brate != FRAME_NO_DATA ) -- GitLab From e2bca22e00c922f277a1c76f9098ac040d1dadd7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 27 Jan 2023 12:28:03 +0100 Subject: [PATCH 041/591] formatting --- lib_com/options.h | 2 +- lib_enc/ivas_masa_enc.c | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a6c9939967..eae524fed2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS -//#define OMASA_BRATE /* VA: combined format bit-budget distribution */ +#define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #endif diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 5fca4c2222..466b422a85 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -61,25 +61,18 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR #ifdef MASA_AND_OBJECTS static void ivas_merge_masa_metadatas( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); -static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - int16_t low_bitrate_mode, /* i: is low bitrate more? 1/0 */ - int16_t omasa_nbands, - int16_t omasa_nblocks - -); +static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], int16_t low_bitrate_mode, int16_t omasa_nbands, int16_t omasa_nblocks ); static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format, const ISM_MODE ism_mode ); - static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, int16_t no_ism, float masa_to_total_energy_ratio ); static int16_t index_slice_enum( const int16_t *ratio_ism_idx, int16_t no_ism ); static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, int16_t numCodingBands, int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio ); + static void transform_index_and_GR_encode( int16_t *diff_idx, int16_t len, int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); + static void transform_difference_index( int16_t *diff_idx, int16_t *idx, int16_t len ); #else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); -- GitLab From d4ded142c6fab96d83cecdd190f64be9c551f0f8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 28 Jan 2023 14:38:38 +0100 Subject: [PATCH 042/591] add TUNING_96kbps_3obj --- lib_com/ivas_omasa_com.c | 39 ++++++++++++++++++++++++++++----- lib_com/ivas_prot.h | 5 +++-- lib_com/ivas_rom_com.c | 4 ++++ lib_com/options.h | 3 +++ lib_dec/ivas_omasa_dec.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_masa_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 2 +- lib_enc/ivas_sce_enc.c | 2 +- 9 files changed, 49 insertions(+), 14 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 38733ff97e..7729929c96 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -53,6 +53,10 @@ #define GAMMA_ISM_LOW_IMP2 0.9f #define GAMMA_ISM_MEDIUM_IMP2 1.2f #define GAMMA_ISM_HIGH_IMP2 1.35f + +#define GAMMA_ISM_LOW_IMP3 0.85f +#define GAMMA_ISM_MEDIUM_IMP3 1.15f +#define GAMMA_ISM_HIGH_IMP3 1.3f #endif /*--------------------------------------------------------------- @@ -64,13 +68,13 @@ /*! r : ISM format mode */ ISM_MODE ivas_omasa_ism_mode_select( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t no_obj /* i : number of objects */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism /* i : number of input ISM's */ ) { ISM_MODE ism_mode = ISM_MODE_NONE; - switch ( no_obj ) + switch ( nchan_ism ) { case 1: if ( ivas_total_brate >= IVAS_24k4 ) @@ -101,7 +105,11 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 3: +#ifdef TUNING_96kbps_3obj + if ( ivas_total_brate >= IVAS_96k ) +#else if ( ivas_total_brate >= IVAS_128k ) +#endif { ism_mode = ISM_MASA_MODE_DISC; } @@ -152,6 +160,7 @@ ISM_MODE ivas_omasa_ism_mode_select( /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ ) @@ -168,9 +177,27 @@ int32_t ivas_interformat_brate( } else { - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || - ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 9600 and 1 object */ - ) +#ifdef TUNING_96kbps_3obj + if ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism == 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ + { + if ( ism_imp == ISM_LOW_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP3 ); + } + else if ( ism_imp == ISM_MEDIUM_IMP ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP3 ); + } + else /* ISM_HIGH_IMP */ + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP3 ); + } + } + else +#endif + if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || + ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 24400 and 1 object */ + ) { if ( ism_imp == ISM_LOW_IMP ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 784000dbed..557bb7e01b 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4525,7 +4525,7 @@ void ivas_masa_encode( #ifdef MASA_AND_OBJECTS , const ISM_MODE ism_mode, /* i : ISM format mode */ - const int16_t nchan_ism, /* i : number of ism channels */ + const int16_t nchan_ism, /* i : number of ISM channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ @@ -5223,6 +5223,7 @@ void set_ism_importance_interformat( /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ ); @@ -5237,7 +5238,7 @@ void ivas_combined_format_brate_sanity( ISM_MODE ivas_omasa_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t no_obj /* i : number of input ISM's */ + const int16_t nchan_ism /* i : number of input ISM's */ ); void ivas_merge_masa_transports( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 7cf193b0fe..bb4b888665 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2801,7 +2801,11 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {16000, IVAS_13k2, 0, 0}, /* 64k */ #endif {20000, 16000, 0, 0}, /* 80k */ +#ifdef TUNING_96kbps_3obj + {IVAS_32k, 20000, 16000, 0}, /* 96k */ +#else {IVAS_32k, 20000, 0, 0}, /* 96k */ +#endif {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ diff --git a/lib_com/options.h b/lib_com/options.h index 4fb3b2b7e1..28e854a482 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,6 +169,9 @@ #ifdef MASA_AND_OBJECTS #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ + +#define TUNING_96kbps_3obj + #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 133369e94c..fa976ea5d0 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -59,7 +59,7 @@ void ivas_set_surplus_brate_dec( if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - *ism_total_brate = ivas_interformat_brate( st_ivas->ism_mode, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + *ism_total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - *ism_total_brate; @@ -90,7 +90,7 @@ void ivas_set_surplus_brate_dec( { st_ivas->hSCE[n]->element_brate = element_brate[n]; - *ism_total_brate += ivas_interformat_brate( st_ivas->ism_mode, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp ); + *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp ); } st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 1ff51395cb..9126db68cb 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -833,7 +833,7 @@ ivas_error ivas_ism_metadata_enc( *ism_total_brate = 0; for ( ch = 0; ch < num_obj; ch++ ) { - *ism_total_brate += ivas_interformat_brate( ism_mode, hSCE[ch]->element_brate, ism_imp[ch] ); + *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, num_obj, hSCE[ch]->element_brate, ism_imp[ch] ); } ism_metadata_flag_global = 1; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index e041a9bd9e..2f568fb3a3 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -244,7 +244,7 @@ void ivas_masa_encode( #ifdef MASA_AND_OBJECTS , const ISM_MODE ism_mode, /* i : ISM format mode */ - const int16_t nchan_ism, /* i : number of ism channels */ + const int16_t nchan_ism, /* i : number of ISM channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index bb2e898af4..b2587cd902 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -568,7 +568,7 @@ void ivas_set_surplus_brate_enc( { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( st_ivas->ism_mode, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); /* note: ISM st->total_brate is iset in ivas_sce_enc() */ } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 1d5959c21a..7da0110a2c 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -220,7 +220,7 @@ ivas_error ivas_sce_enc( { set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); - st->total_brate = ivas_interformat_brate( st_ivas->ism_mode, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ) - nb_bits_metadata * FRAMES_PER_SEC; + st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ) - nb_bits_metadata * FRAMES_PER_SEC; } #endif -- GitLab From c621abbb2a0d4ae9775c3ed05d87d58af66af075 Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 30 Jan 2023 13:09:53 +0200 Subject: [PATCH 043/591] DISC 3 obj at 96 and DISC 4obj at 128 --- lib_com/ivas_omasa_com.c | 4 ++-- lib_com/ivas_rom_com.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 7729929c96..666fa45e60 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -127,7 +127,7 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 4: - if ( ivas_total_brate >= IVAS_160k ) + if ( ivas_total_brate >= IVAS_128k ) { ism_mode = ISM_MASA_MODE_DISC; } @@ -178,7 +178,7 @@ int32_t ivas_interformat_brate( else { #ifdef TUNING_96kbps_3obj - if ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism == 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ + if ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism >= 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ { if ( ism_imp == ISM_LOW_IMP ) { diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index bb4b888665..16fa9d2c4d 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2806,7 +2806,7 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = #else {IVAS_32k, 20000, 0, 0}, /* 96k */ #endif - {IVAS_32k, IVAS_24k4, 20000, 0}, /* 128k */ + {IVAS_32k, IVAS_24k4, 20000, 16000}, /* 128k */ {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ -- GitLab From 73d4bc3dc1ebed9d80589a9b6ca5177458309c36 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 13:26:44 +0100 Subject: [PATCH 044/591] - add TUNING_48kbps_2obj --- lib_com/ivas_omasa_com.c | 4 ++++ lib_com/ivas_rom_com.c | 38 +++++++++++++++++++++----------------- lib_com/options.h | 1 + 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 666fa45e60..9dfb05bdbe 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -87,7 +87,11 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 2: +#ifdef TUNING_48kbps_2obj + if ( ivas_total_brate >= IVAS_48k ) +#else if ( ivas_total_brate >= IVAS_64k ) +#endif { ism_mode = ISM_MASA_MODE_DISC; } diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 16fa9d2c4d..66f08492f6 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2786,32 +2786,36 @@ const float McMASA_LFEGain_vectors[64] = const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = { - {0, 0, 0, 0}, /* 13k2 */ - {0, 0, 0, 0}, /* 16k4 */ - {9600, 0, 0, 0}, /* 24k4 */ + {0, 0, 0, 0}, /* 13k2 */ + {0, 0, 0, 0}, /* 16k4 */ + {9600, 0, 0, 0}, /* 24k4 */ #ifdef OMASA_BRATE - {11000, 0, 0, 0}, /* 32k */ + {11000, 0, 0, 0}, /* 32k */ #else - {9600, 0, 0, 0}, /* 32k */ + {9600, 0, 0, 0}, /* 32k */ +#endif +#ifdef TUNING_48kbps_2obj + {IVAS_13k2, 9600, 0, 0}, /* 48k */ +#else + {IVAS_13k2, 0, 0, 0}, /* 48k */ #endif - {IVAS_13k2, 0, 0, 0}, /* 48k */ #ifdef OMASA_BRATE - {16000, 11700, 0, 0}, /* 64k */ + {16000, 11700, 0, 0}, /* 64k */ #else - {16000, IVAS_13k2, 0, 0}, /* 64k */ + {16000, IVAS_13k2, 0, 0}, /* 64k */ #endif - {20000, 16000, 0, 0}, /* 80k */ + {20000, 16000, 0, 0}, /* 80k */ #ifdef TUNING_96kbps_3obj - {IVAS_32k, 20000, 16000, 0}, /* 96k */ + {IVAS_32k, 20000, 16000, 0}, /* 96k */ #else - {IVAS_32k, 20000, 0, 0}, /* 96k */ + {IVAS_32k, 20000, 0, 0}, /* 96k */ #endif - {IVAS_32k, IVAS_24k4, 20000, 16000}, /* 128k */ - {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ - {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ - {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ - {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ - {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */ + {IVAS_32k, IVAS_24k4, 20000, 16000}, /* 128k */ + {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ + {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ + {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ + {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ + {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */ }; /* column wise DCT matrices for 4 5, and 8 dim */ diff --git a/lib_com/options.h b/lib_com/options.h index 28e854a482..7ecfb224a3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,7 @@ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define TUNING_96kbps_3obj +#define TUNING_48kbps_2obj #endif -- GitLab From 66176058699af08bacbad30ef74b047fca92ce68 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 13:27:32 +0100 Subject: [PATCH 045/591] fix debugging outpu files output.[sce,cpe] --- lib_dec/ivas_cpe_dec.c | 10 +++++++--- lib_dec/ivas_sce_dec.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index c94997536e..ade4764a21 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -583,9 +583,13 @@ ivas_error ivas_cpe_dec( { dbgwrite( output[j], sizeof( float ), output_frame, 1, fname( debug_dir, "output.cpe", j, cpe_id, DEC ) ); } - tmpF = 0; - dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.sce", 0, cpe_id, DEC ) ); - dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, cpe_id, DEC ) ); + + if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) + { + tmpF = 0; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.sce", 0, cpe_id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, cpe_id, DEC ) ); + } } } #endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 1ca5e01865..9ae6f59abf 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -309,9 +309,13 @@ ivas_error ivas_sce_dec( dbgwrite( &st->element_mode, sizeof( int16_t ), 1, output_frame, fname( debug_dir, "element_mode", 0, sce_id, DEC ) ); dbgwrite( output, sizeof( float ), output_frame, 1, fname( debug_dir, "output.sce", 0, sce_id, DEC ) ); - tmpF = 0; - dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.cpe", 0, sce_id, DEC ) ); - dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, sce_id, DEC ) ); + + if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) + { + tmpF = 0; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.cpe", 0, sce_id, DEC ) ); + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, sce_id, DEC ) ); + } } } #endif -- GitLab From dccd851103a11300e587b01ff53eb7407f44644e Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 13:28:35 +0100 Subject: [PATCH 046/591] correct (C) headers in OMASA added files --- lib_com/ivas_omasa_com.c | 2 +- lib_dec/ivas_omasa_dec.c | 2 +- lib_enc/ivas_omasa_enc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 9dfb05bdbe..b5b3e09f3e 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index fa976ea5d0..6e95f0710f 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index b2587cd902..cd2548701a 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other -- GitLab From 086dbba2db06cba86b0e5bcfdafd3c2602247c48 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 13:44:08 +0100 Subject: [PATCH 047/591] add 'error' returns --- lib_dec/ivas_dec.c | 6 ++++-- lib_dec/ivas_init_dec.c | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index c1d6ab32c4..0bdbeb2d1b 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -459,9 +459,10 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } - if ( st_ivas->nCPE == 1 ) + + if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { - ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); + return error; } if ( st_ivas->hCPE[0]->nchan_out == 1 ) @@ -505,6 +506,7 @@ ivas_error ivas_dec( } ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); + ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cc5252e02d..4aef38566b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1047,7 +1047,10 @@ ivas_error ivas_init_decoder( } st_ivas->nCPE = 1; - create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ); + if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } for ( n = 0; n < CPE_CHANNELS; n++ ) { -- GitLab From 6a83c01b239a65d5047fbb4e35f6a5ef53605a85 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 13:59:34 +0100 Subject: [PATCH 048/591] fix merging issue between FIX_197_CREND_INTERFACE into MASA_AND_OBJECTS --- lib_rend/ivas_stat_rend.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 1b6ca5f75b..4db55ba025 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -241,8 +241,13 @@ typedef struct ivas_dirac_dec_binaural_data_structure float ChEneOut[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float ChCrossReOut[CLDFB_NO_CHANNELS_MAX]; float ChCrossImOut[CLDFB_NO_CHANNELS_MAX]; +#ifdef MASA_AND_OBJECTS + float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; +#else float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; /* +1 refers to SeparateChannel */ float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; +#endif float processMtxDecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float diffuseFieldCoherence[CLDFB_NO_CHANNELS_MAX]; @@ -253,8 +258,13 @@ typedef struct ivas_dirac_dec_binaural_data_structure REVERB_STRUCT_HANDLE hReverb; uint8_t renderStereoOutputInsteadOfBinaural; float frameMeanDiffuseness[CLDFB_NO_CHANNELS_MAX]; +#ifdef MASA_AND_OBJECTS + float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; +#else float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; +#endif float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ -- GitLab From 242310b429e5dc4e5a199500a24bf26e3452b9d9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 14:00:40 +0100 Subject: [PATCH 049/591] cleaning + formatting --- lib_com/ivas_masa_com.c | 1 - lib_dec/ivas_init_dec.c | 2 -- lib_dec/ivas_masa_dec.c | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index c1e8d23656..289bf1e2c6 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -87,7 +87,6 @@ void ivas_masa_set_elements( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) { - *nCPE = 1; if ( *element_mode == -1 ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4aef38566b..e5b51d9451 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1013,7 +1013,6 @@ ivas_error ivas_init_decoder( for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { - temp_brate[sce_id] = sep_object_brate[k - 2][st_ivas->nSCE - 1]; ism_total_brate += temp_brate[sce_id]; @@ -1046,7 +1045,6 @@ ivas_error ivas_init_decoder( ivas_dirac_dec_open( st_ivas ); } - st_ivas->nCPE = 1; if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b33b591684..3ffa921385 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -504,6 +504,7 @@ ivas_error ivas_masa_dec_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } + #ifdef MASA_AND_OBJECTS ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -- GitLab From 7433066a75658207401b3b5879bc977e1f4ea514 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 14:10:01 +0100 Subject: [PATCH 050/591] cleaning + comments --- lib_dec/ivas_init_dec.c | 10 +++++----- lib_enc/ivas_init_enc.c | 42 +++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e5b51d9451..8ff3f19fd7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -915,7 +915,7 @@ ivas_error ivas_init_decoder( } } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? { if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { @@ -1116,7 +1116,7 @@ ivas_error ivas_init_decoder( return error; } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { @@ -1129,7 +1129,7 @@ ivas_error ivas_init_decoder( } } - if ( st_ivas->nCPE > 1 ) + if ( st_ivas->nCPE > 1 ) // VE: TBV - is this needed? { if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1179,7 +1179,7 @@ ivas_error ivas_init_decoder( ivas_mcmasa_split_brate( st_ivas->hOutSetup.separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? { if ( ( error = create_sce_dec( st_ivas, sce_id, brate_sce ) ) != IVAS_ERR_OK ) { @@ -1189,7 +1189,7 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? { st_ivas->element_mode_init = IVAS_CPE_MDCT; /* element_mode_init was IVAS_SCE for SCE initialization */ if ( ( error = create_cpe_dec( st_ivas, cpe_id, brate_cpe ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index d2c6ab278a..4eea31458c 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -506,7 +506,7 @@ ivas_error ivas_init_encoder( } } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? { if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { @@ -626,27 +626,20 @@ ivas_error ivas_init_encoder( st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + if ( ( error = create_cpe_enc( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[st_ivas->nSCE + cpe_id * CPE_CHANNELS + n]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } + return error; + } - /* Metadata only initialized for the last cpe index*/ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } + /* prepare bitstream buffers */ + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[0]->hCoreCoder[n]->hBstr->ind_list = ind_list[st_ivas->nSCE + n]; + reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); } + + st_ivas->hCPE[0]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; + reset_indices_enc( st_ivas->hCPE[0]->hMetaData, MAX_BITS_METADATA ); } #endif else if ( ivas_format == MC_FORMAT ) @@ -654,11 +647,10 @@ ivas_error ivas_init_encoder( st_ivas->mc_mode = ivas_mc_mode_select( hEncoderConfig->mc_input_setup, ivas_total_brate ); hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); - if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nSCE = 0; - st_ivas->nCPE = hEncoderConfig->nchan_inp / 2; + st_ivas->nCPE = hEncoderConfig->nchan_inp / CPE_CHANNELS; for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { @@ -674,6 +666,7 @@ ivas_error ivas_init_encoder( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); } + /* Metadata only initialized for the last CPE index*/ if ( cpe_id == st_ivas->nCPE - 1 ) { @@ -701,14 +694,13 @@ ivas_error ivas_init_encoder( return error; } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? { if ( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { return error; } - /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -755,7 +747,7 @@ ivas_error ivas_init_encoder( ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? { if ( ( error = create_sce_enc( st_ivas, sce_id, brate_sce ) ) != IVAS_ERR_OK ) { @@ -770,7 +762,7 @@ ivas_error ivas_init_encoder( reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; -- GitLab From 8f9cb78d270a4b4f6563b16cadeb4d63b3f5d518 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 17:23:39 +0100 Subject: [PATCH 051/591] tuning within TUNING_48kbps_2obj --- lib_com/ivas_omasa_com.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index b5b3e09f3e..fd09a8adda 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -182,7 +182,11 @@ int32_t ivas_interformat_brate( else { #ifdef TUNING_96kbps_3obj - if ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism >= 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ + if ( ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism >= 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ +#ifdef TUNING_48kbps_2obj + || ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism == 2 && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 48000 and 2 objects */ +#endif + ) { if ( ism_imp == ISM_LOW_IMP ) { -- GitLab From ac2065bc7e5fb107aa1e75f09d82886c3576194d Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Jan 2023 17:25:37 +0100 Subject: [PATCH 052/591] correction of one comment --- lib_com/ivas_omasa_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index fd09a8adda..ff81d8ccd6 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -182,7 +182,7 @@ int32_t ivas_interformat_brate( else { #ifdef TUNING_96kbps_3obj - if ( ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism >= 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ + if ( ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism >= 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects and 128 kbps and 4 objects */ #ifdef TUNING_48kbps_2obj || ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism == 2 && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 48000 and 2 objects */ #endif -- GitLab From b86192005e8e305f7041a28d91e5f563c062a96c Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Mon, 27 Feb 2023 11:41:29 +0200 Subject: [PATCH 053/591] Diffuseness-preserving MASA and ISM metadata merge in low-bitrate OMASA. OMASA metadata bitrate reduction and allocation update. --- lib_com/ivas_masa_com.c | 6 + lib_com/ivas_omasa_com.c | 127 +++++- lib_com/ivas_prot.h | 34 ++ lib_com/ivas_rom_com.c | 8 +- lib_com/ivas_stat_com.h | 11 + lib_com/options.h | 8 +- lib_dec/ivas_cpe_dec.c | 2 +- lib_dec/ivas_masa_dec.c | 393 +++++++++++++++-- lib_enc/ivas_cpe_enc.c | 5 +- lib_enc/ivas_enc.c | 28 +- lib_enc/ivas_ism_enc.c | 5 +- lib_enc/ivas_masa_enc.c | 925 ++++++++++++++++++++++++++++++++++++--- lib_enc/ivas_omasa_enc.c | 106 ++++- 13 files changed, 1549 insertions(+), 109 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 289bf1e2c6..44d316ed88 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -493,6 +493,12 @@ void reconstruct_ism_ratios( } q_energy_ratio_ism[n_ism - 1] = 1.0f - sum; +#ifdef REDUCE_OMASA_META_BITS + if ( q_energy_ratio_ism[n_ism - 1] < 0 ) + { + q_energy_ratio_ism[n_ism - 1] = 0.0f; + } +#endif return; } diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index ff81d8ccd6..f825b41252 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -35,6 +35,9 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" +#ifdef REDUCE_OMASA_META_BITS +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -57,6 +60,11 @@ #define GAMMA_ISM_LOW_IMP3 0.85f #define GAMMA_ISM_MEDIUM_IMP3 1.15f #define GAMMA_ISM_HIGH_IMP3 1.3f +#ifdef TUNING_DISC_3_4obj +#define GAMMA_ISM_LOW_IMP4 0.6f +#define GAMMA_ISM_MEDIUM_IMP4 0.8f +#define GAMMA_ISM_HIGH_IMP4 1.0f +#endif #endif /*--------------------------------------------------------------- @@ -99,17 +107,13 @@ ISM_MODE ivas_omasa_ism_mode_select( { ism_mode = ISM_MASA_MODE_ONE_OBJ; } - /* else if ( ivas_total_brate >= IVAS_32k ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } */ else { ism_mode = ISM_MODE_NONE; } break; case 3: -#ifdef TUNING_96kbps_3obj +#ifdef TUNING_DISC_3_4obj if ( ivas_total_brate >= IVAS_96k ) #else if ( ivas_total_brate >= IVAS_128k ) @@ -131,7 +135,11 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 4: + #ifdef TUNING_DISC_3_4obj if ( ivas_total_brate >= IVAS_128k ) +#else + if ( ivas_total_brate >= IVAS_160k ) + #endif { ism_mode = ISM_MASA_MODE_DISC; } @@ -181,24 +189,20 @@ int32_t ivas_interformat_brate( } else { -#ifdef TUNING_96kbps_3obj - if ( ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism >= 3 && element_brate == 16000 ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects and 128 kbps and 4 objects */ -#ifdef TUNING_48kbps_2obj - || ( ism_mode == ISM_MASA_MODE_DISC && nchan_ism == 2 && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 48000 and 2 objects */ -#endif - ) +#ifdef TUNING_DISC_3_4obj + if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) ) ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ { if ( ism_imp == ISM_LOW_IMP ) { - nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP3 ); + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP4 ); } else if ( ism_imp == ISM_MEDIUM_IMP ) { - nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP3 ); + nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP4 ); } else /* ISM_HIGH_IMP */ { - nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP3 ); + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 ); } } else @@ -209,15 +213,15 @@ int32_t ivas_interformat_brate( { if ( ism_imp == ISM_LOW_IMP ) { - nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP2 ); + nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP3 ); } else if ( ism_imp == ISM_MEDIUM_IMP ) { - nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP2 ); + nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP3 ); } else /* ISM_HIGH_IMP */ { - nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP2 ); + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP3 ); } } else @@ -302,4 +306,93 @@ void ivas_combined_format_brate_sanity( return; } #endif + +#ifdef REDUCE_OMASA_META_BITS +int16_t bits_index_ism_ratio( + int16_t no_ism +) +{ + int16_t bits_index; + + bits_index = 0; + if ( no_ism == 2 ) + { + bits_index = 3; + } + else if ( no_ism == 3 ) + { + bits_index = 6; + } + else if ( no_ism == 4 ) + { + bits_index = 7; + } + else + { + assert( ( no_ism >= 2 && no_ism <= 4 ) && "Wrong number of objects for MASA_ISM." ); + } + return bits_index; +} +#endif + +#ifdef REDUCE_OMASA_META_BITS +void calculate_nbits_meta( + int16_t n_ism, + float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + int16_t numSf, + int16_t numCodingBands, + int16_t *bits_ism, + int16_t idx_sep_obj, + int16_t ism_imp +) +{ + int16_t sf, band, obj; + float priority[MAX_NUM_OBJECTS], max_p; + + + if ( n_ism > 1 ) + { + set_f( priority, 0.0f, n_ism ); + for ( sf = 0; sf < numSf; sf++ ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + for ( obj = 0; obj < n_ism; obj++ ) + { + priority[obj] = max( priority[obj], ( q_energy_ratio_ism[sf][band][obj] * ( 1 - masa_to_total_energy_ratio[sf][band] ) ) ); + } + } + } + } + else + { + priority[0] = 1; + } + + + /* decide parameters for ISM metadata quantization */ + maximum( priority, n_ism, &max_p ); + for ( obj = 0; obj < n_ism; obj++ ) + { + if ( obj == idx_sep_obj ) + { + if ( ism_imp == 3 ) + { + priority[obj] = 1; + } + else if ( ism_imp == 2 ) + { + priority[obj] = ( 1 + max_p ) * 0.5f; + } + else + { + priority[obj] = max_p; + } + } + bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - priority[obj] ) * 7 ); + } + return; +} +#endif #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 557bb7e01b..4e700a7abe 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4529,6 +4529,10 @@ void ivas_masa_encode( ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ +#ifdef REDUCE_OMASA_META_BITS + , + int16_t ism_imp /* i: importance of separated object */ +#endif #endif ); @@ -4604,6 +4608,32 @@ int32_t calculate_cpe_brate_MASA_ISM( const int32_t ivas_total_brate, /* i : total bit rate for IVAS */ const int16_t n_ism /* i : number of objects */ ); +#ifdef OMASA_DIFFUSE_ISM_MERGE +void ivas_merge_masa_metadatas( + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */ + OMASA_SPATIAL_META_HANDLE hMasaMeta /* i: ISM-object metadata to be merged with the MASA metadata */ +); +void ivas_masa_combine_directions( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ +); +#endif /* OMASA_DIFFUSE_ISM_MERGE */ + +#ifdef REDUCE_OMASA_META_BITS +int16_t bits_index_ism_ratio( /* o : number of bits for ISM ratio index */ + int16_t no_ism /* i : number of objects */ +); + +void calculate_nbits_meta( + int16_t n_ism, + float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + int16_t numSf, + int16_t numCodingBands, + int16_t* bits_ism, + int16_t idx_sep_obj, + int16_t ism_imp +); +#endif #endif void ivas_masa_set_coding_config( @@ -5181,6 +5211,10 @@ void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs /* i : Input sample rate */ +#ifdef OMASA_DIFFUSE_ISM_MERGE + , + ISM_MODE ismMode /* i : ISM mode */ +#endif ); void ivas_omasa_enc( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 66f08492f6..ec2b6c5b93 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2805,12 +2805,16 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {16000, IVAS_13k2, 0, 0}, /* 64k */ #endif {20000, 16000, 0, 0}, /* 80k */ -#ifdef TUNING_96kbps_3obj - {IVAS_32k, 20000, 16000, 0}, /* 96k */ +#ifdef TUNING_DISC_3_4obj + {IVAS_32k, 20000, 20000, 0}, /* 96k */ #else {IVAS_32k, 20000, 0, 0}, /* 96k */ #endif +#ifdef TUNING_DISC_3_4obj + {IVAS_32k, IVAS_24k4, 20000, 24000}, /* 128k */ +#else {IVAS_32k, IVAS_24k4, 20000, 16000}, /* 128k */ +#endif {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 9966630d43..d0a79ed586 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -419,6 +419,17 @@ typedef struct ivas_masa_common_spatial_meta_struct } MASA_COMMON_SPATIAL_META; +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE +typedef struct ivas_omasa_meta_struct +{ + uint8_t num_dirs; + MASA_DIRECTIONAL_SPATIAL_META directional_meta[MASA_MAXIMUM_DIRECTIONS]; + MASA_COMMON_SPATIAL_META common_meta; +} OMASA_SPATIAL_META, *OMASA_SPATIAL_META_HANDLE; +#endif +#endif + typedef struct ivas_masa_metadata_frame_struct { MASA_DECRIPTIVE_META descriptive_meta; diff --git a/lib_com/options.h b/lib_com/options.h index 7ecfb224a3..92cbca2b9f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,10 +170,14 @@ #define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#define TUNING_96kbps_3obj + #define TUNING_48kbps_2obj -#endif +#define TUNING_DISC_3_4obj /* Nokia: increase bitrate for objects in DISC mode at 128k 4obj and 96k 3 obj */ +#define REDUCE_OMASA_META_BITS /* Nokia: reduce metadata number of bits and fix directional metadata bit allocation */ +#define OMASA_DIFFUSE_ISM_MERGE /* Nokia: Diffuse-energy retaining merging of ISM and MASA */ + +#endif /* MASA_AND_OBJECTS */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index ade4764a21..c2f3aa7ed9 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -176,6 +176,7 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS } #endif + } else { @@ -370,7 +371,6 @@ ivas_error ivas_cpe_dec( /*----------------------------------------------------------------* * Core codec configuration *----------------------------------------------------------------*/ - for ( n = 0; n < n_channels; n++ ) { /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 3ffa921385..6ac0c3d63f 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -71,9 +71,24 @@ static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hM static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); #ifdef MASA_AND_OBJECTS -static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos ); +static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_separated_object, int16_t ism_imp +#endif +); static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, int16_t no_ism, int16_t K ); -static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t n_ism, int16_t nbands, int16_t nblocks ); +static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t n_ism, int16_t nbands, int16_t nblocks +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_separated_object +#endif +); +#endif +#ifdef REDUCE_OMASA_META_BITS +static void read_ism_ratio_index(int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, int16_t numCodingBands, int16_t sf, + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], uint16_t *bit_stream, int16_t *next_bit_pos, float *masa_to_total_energy_ratio, + int16_t idx_sep_obj, int16_t *num_zeros ); #endif /*-----------------------------------------------------------------------* @@ -100,6 +115,9 @@ ivas_error ivas_masa_decode( int16_t obj; #ifdef OMASA_BRATE int16_t i, ch, ism_imp; +#ifdef REDUCE_OMASA_META_BITS + ism_imp = 0; +#endif #endif #endif @@ -170,6 +188,12 @@ ivas_error ivas_masa_decode( st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; } +#ifdef REDUCE_OMASA_META_BITS + else + { + st_ivas->hMasaIsmData->idx_separated_ism = -1; + } +#endif #ifdef OMASA_BRATE /* read ISM importance flag (one per object) */ @@ -276,7 +300,12 @@ ivas_error ivas_masa_decode( { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { - *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos ); + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos +#ifdef REDUCE_OMASA_META_BITS + , + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp +#endif + ); } if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) @@ -293,7 +322,6 @@ ivas_error ivas_masa_decode( } #endif - *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos ); #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) @@ -1635,11 +1663,11 @@ static void compute_foa_cov_matrix( #ifdef MASA_AND_OBJECTS -static void decode_index_slice( - int16_t index, - int16_t *ratio_idx_ism, - int16_t no_ism, - int16_t K ) +static void decode_index_slice( + int16_t index, /* i: index to decode */ + int16_t *ratio_idx_ism, /* o: decodec array of integers */ + int16_t no_ism, /* i: number of elements in array (objects) */ + int16_t K ) /* i: sum of array elements */ { int16_t i, j, sum, elem; int16_t base[MAX_NUM_OBJECTS]; @@ -1684,6 +1712,273 @@ static void decode_index_slice( } } +#ifdef REDUCE_OMASA_META_BITS +static void read_ism_ratio_index( + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o: ISM read ratio indexes */ + int16_t no_ism, /* i: number of objects */ + int16_t numCodingBands, /* i: number of subbands */ + int16_t sf, /* i: index of subframe */ + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i: previous subframe ISM ratio indexes */ + uint16_t *bit_stream, /* i: bitstream */ + int16_t *next_bit_pos, /* i/o: position in bitstream */ + float *masa_to_total_energy_ratio, /* i: masa to total ratios */ + int16_t idx_sep_obj, /* i: index of separated index, -1 if none*/ + int16_t *num_zeros /* i/o: number of zero values in first subframe for separated object */ +) +{ + int16_t b, i, b_signif; + int16_t index; + int16_t GR_order, differential_subframe; + int16_t buf; + int16_t no_levels_ratio_ism; + int16_t bits_index; + int16_t ratio_ism_idx_ref[MAX_NUM_OBJECTS]; + int16_t idx_sep_obj_local, shift_one; + idx_sep_obj_local = idx_sep_obj; + if ( idx_sep_obj > -1 ) + { + if ( idx_sep_obj == no_ism - 1 && no_ism > 2) + { + idx_sep_obj_local = 0; + } + } + b_signif = 0; + no_levels_ratio_ism = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); + while ( b_signif < numCodingBands && masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR ) + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b_signif], no_levels_ratio_ism, no_ism ); + b_signif++; + } + if ( b_signif == numCodingBands ) + { + return; + } + else + { + + if ( sf == 0 ) + { + bits_index = bits_index_ism_ratio( no_ism ); + + /* read coding type */ + if ( bit_stream[( *next_bit_pos )--] == 1 ) + { + /* independent coding*/ + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + index = 0; + for ( i = 0; i < bits_index; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); + if ( idx_sep_obj > -1 && ratio_ism_idx[b][idx_sep_obj_local] == 0 ) + { + (*num_zeros)++; + } + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + } + else + { + /* differential coding */ + index = 0; + for ( i = 0; i < bits_index; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + decode_index_slice( index, ratio_ism_idx[b_signif], no_ism, no_levels_ratio_ism ); + if ( idx_sep_obj > -1 && ratio_ism_idx[b_signif][idx_sep_obj_local] == 0 ) + { + ( *num_zeros )++; + } + mvs2s( ratio_ism_idx[b_signif], ratio_ism_idx_ref, no_ism ); + for ( b = b_signif + 1; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; + for ( i = 0; i < no_ism - 1; i++ ) + { + buf = ivas_qmetadata_DecodeExtendedGR( bit_stream, next_bit_pos, 100, 0 ); + if ( ( buf % 2 ) == 0 ) + { + ratio_ism_idx[b][i] = -( buf >> 1 ); + } + else + { + ratio_ism_idx[b][i] = ( ( buf + 1 ) >> 1 ); + } + ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx_ref[i]; + ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; + } + mvs2s( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism ); + if ( idx_sep_obj > -1 && ratio_ism_idx[b][idx_sep_obj_local] == 0 ) + { + ( *num_zeros )++; + } + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + } + } + else + { + if ( numCodingBands > 1 ) + { + /* read prediction type */ + differential_subframe = bit_stream[( *next_bit_pos )--]; + } + else + { + differential_subframe = 1; + } + + if ( *num_zeros == numCodingBands ) + { + shift_one = 1; + } + else + { + shift_one = 0; + } + if ( shift_one == 1 && no_ism == 2 ) + { + /* nothing has been sent ; values can be inferred */ + for ( b = b_signif; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + if ( idx_sep_obj_local == 0 ) + { + ratio_ism_idx[b][0] = 0; + ratio_ism_idx[b][1] = 7; + } + else + { + ratio_ism_idx[b][0] = 7; + ratio_ism_idx[b][1] = 0; + } + } + } + } + else + { + /* read GR order */ + GR_order = bit_stream[( *next_bit_pos )--]; + for ( b = b_signif; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + for ( i = 0; i < no_ism - 1 - shift_one; i++ ) + { + buf = ivas_qmetadata_DecodeExtendedGR( bit_stream, next_bit_pos, 100, GR_order ); + if ( ( buf % 2 ) == 0 ) + { + ratio_ism_idx[b][i] = -( buf >> 1 ); + } + else + { + ratio_ism_idx[b][i] = ( ( buf + 1 ) >> 1 ); + } + } + /* insert separated obj */ + if ( shift_one ) + { + for ( i = no_ism - 1; i > idx_sep_obj_local; i-- ) + { + ratio_ism_idx[b][i] = ratio_ism_idx[b][i - 1]; + } + ratio_ism_idx[b][idx_sep_obj_local] = 0; /* this is only difference; need to pdate later as well */ + } + } + } + if ( differential_subframe ) + { + /* differential to previous subframe */ + for ( b = b_signif; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; + for ( i = 0; i < no_ism - 1; i++ ) + { + ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx_prev_sf[b][i]; + if ( shift_one && i == idx_sep_obj_local ) + { + ratio_ism_idx[b][i] = 0; + } + ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; + } + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + } + else + { + /* difference to previous subband */ + ratio_ism_idx[b_signif][no_ism - 1] = no_levels_ratio_ism; + + /* first significant subband - differential to previous subframe */ + for ( i = 0; i < no_ism - 1; i++ ) + { + ratio_ism_idx[b_signif][i] = ratio_ism_idx[b_signif][i] + ratio_ism_idx_prev_sf[b_signif][i]; + if ( shift_one && i == idx_sep_obj_local ) + { + ratio_ism_idx[b_signif][i] = 0; + } + ratio_ism_idx[b_signif][no_ism - 1] -= ratio_ism_idx[b_signif][i]; + } + /* rest of subbands differential to previous subband */ + mvs2s( ratio_ism_idx[b_signif], ratio_ism_idx_ref, no_ism ); + for ( b = b_signif + 1; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; + for ( i = 0; i < no_ism - 1; i++ ) + { + ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx_ref[i]; + if ( shift_one && i == idx_sep_obj_local ) + { + ratio_ism_idx[b][i] = 0; + } + ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; + } + mvs2s( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism ); + } + else + { + /* distribute evenly the objects */ + distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); + } + } + } + } + } + + return; + } +} + + +#else static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, @@ -1846,26 +2141,40 @@ static void read_ism_ratio_index( return; } - +#endif static void decode_ism_ratios( - uint16_t *bit_stream, - int16_t *next_bit_pos, - IVAS_QMETADATA_HANDLE hQMetaData, - float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], - int16_t n_ism, - int16_t nbands, - int16_t numSf ) + uint16_t *bit_stream, /* i: bitstream */ + int16_t *next_bit_pos, /* i/o: position in bitstream */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i: Metadata handle */ + float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o: ISM ratios */ + int16_t n_ism, /* i: number of objects */ + int16_t nbands, /* i: number of subbands */ + int16_t numSf /* i: number of subframes */ +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_separated_object /* i: index of separated object */ +#endif +) { int16_t sf, band; int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; - - +#ifdef REDUCE_OMASA_META_BITS + float tmp; + int16_t num_zeros; + num_zeros = 0; +#endif /* hQMetaData->q_direction->cfg.nblocks; */ for ( sf = 0; sf < numSf; sf++ ) { /* read ism ratio indexes */ - read_ism_ratio_index( ratio_ism_idx, n_ism, nbands, sf, ratio_ism_idx_prev_sf, bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio[sf] ); + read_ism_ratio_index( ratio_ism_idx, n_ism, nbands, sf, ratio_ism_idx_prev_sf, bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio[sf] +#ifdef REDUCE_OMASA_META_BITS + , + idx_separated_object, + &num_zeros +#endif + ); /* save previous subframe index values */ if ( sf < numSf - 1 ) @@ -1882,7 +2191,21 @@ static void decode_ism_ratios( { reconstruct_ism_ratios( ratio_ism_idx[band], n_ism, 1.0f / (float) ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ), ratio_ism[sf][band] ); } - +#ifdef REDUCE_OMASA_META_BITS + if ( ( n_ism > 2 ) && ( idx_separated_object == n_ism - 1 ) ) + { + /* rotate */ + for ( band = 0; band < nbands; band++ ) + { + if ( hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) + { + tmp = ratio_ism[sf][band][n_ism - 1]; + ratio_ism[sf][band][n_ism - 1] = ratio_ism[sf][band][0]; + ratio_ism[sf][band][0] = tmp; + } + } + } +#endif if ( nbands == 1 ) { for ( band = 1; band < 5; band++ ) @@ -1912,14 +2235,22 @@ static int16_t ivas_decode_masaism_metadata( MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, - int16_t *next_bit_pos ) + int16_t *next_bit_pos +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_separated_object, + int16_t ism_imp +#endif +) { int16_t sf, band, dir, nbands, nblocks, obj, i; float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t *band_mapping; int16_t b; +#ifndef REDUCE_OMASA_META_BITS float priority[MAX_NUM_OBJECTS]; +#endif int16_t bits_ism[MAX_NUM_OBJECTS], index; uint16_t idx_el, idx_az; float azimuth, elevation; @@ -1935,8 +2266,13 @@ static int16_t ivas_decode_masaism_metadata( if ( nchan_ism > 1 ) { /* read ISM ratios */ - decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism, nbands, nblocks ); - + decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism, nbands, nblocks +#ifdef REDUCE_OMASA_META_BITS + , + idx_separated_object +#endif + ); +#ifndef REDUCE_OMASA_META_BITS /* calculate priority */ set_f( priority, 0.0f, nchan_ism ); for ( sf = 0; sf < nblocks; sf++ ) @@ -1949,6 +2285,7 @@ static int16_t ivas_decode_masaism_metadata( } } } +#endif } else { @@ -1959,15 +2296,21 @@ static int16_t ivas_decode_masaism_metadata( energy_ratio_ism[sf][band][0] = 1.0f; } } +#ifndef REDUCE_OMASA_META_BITS priority[0] = 1; +#endif } /* read ISM metadata */ +#ifdef REDUCE_OMASA_META_BITS + calculate_nbits_meta( nchan_ism, energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, nblocks, nbands, bits_ism, idx_separated_object, ism_imp ); + +#else for ( obj = 0; obj < nchan_ism; obj++ ) { bits_ism[obj] = 11 - (int16_t) ( ( 1 - priority[obj] ) * 7 ); } - +#endif for ( obj = 0; obj < nchan_ism; obj++ ) { index = 0; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 429d5dac0b..6cd3c43327 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -266,6 +266,7 @@ ivas_error ivas_cpe_enc( sts[n]->element_mode = hCPE->element_mode; } + if ( hCPE->element_mode != IVAS_CPE_MDCT && ( hCPE->element_brate != hCPE->last_element_brate || hCPE->last_element_mode != hCPE->element_mode || sts[0]->ini_frame == 0 || sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ { @@ -274,7 +275,7 @@ ivas_error ivas_cpe_enc( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) { - stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.7f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); + stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } else { @@ -291,6 +292,7 @@ ivas_error ivas_cpe_enc( stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } } + if ( hCPE->element_mode == IVAS_CPE_TD ) { if ( hCPE->hStereoTD->tdm_LRTD_flag ) @@ -702,6 +704,7 @@ ivas_error ivas_cpe_enc( #endif } + /*----------------------------------------------------------------* * Core Encoder *----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 7e94041393..c0bf3caa93 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -267,6 +267,10 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS , ISM_MODE_NONE, -1, NULL, -1, NULL +#ifdef REDUCE_OMASA_META_BITS + , + 0 +#endif #endif ); } @@ -338,7 +342,12 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Configure oMASA analysis based on MASA config */ - ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs ); + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs +#ifdef OMASA_DIFFUSE_ISM_MERGE + , + st_ivas->ism_mode +#endif + ); } /* Estimate TF-tile energy for the input MASA stream */ @@ -372,7 +381,11 @@ ivas_error ivas_enc( /* Encode MASA parameters and write MASA metadata bitstream */ ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa +#ifdef REDUCE_OMASA_META_BITS + ,st_ivas->hIsmMetaData[0]->ism_imp +#endif + ); /* Configuration of combined-format bit-budget distribution */ #ifdef DEBUG_MODE_INFO @@ -389,7 +402,12 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Configure oMASA analysis based on MASA config */ - ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs ); + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, +#ifdef OMASA_DIFFUSE_ISM_MERGE + , + st_ivas->ism_mode +#endif + ); } else { @@ -489,6 +507,10 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS , ISM_MODE_NONE, -1, NULL, -1, NULL +#ifdef REDUCE_OMASA_META_BITS + , + 0 +#endif #endif ); diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8626d9e050..f18e87d9be 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -222,6 +222,9 @@ ivas_error ivas_ism_enc( else /* ISM_MODE_DISC */ { #ifdef MASA_AND_OBJECTS +#ifdef OMASA_BRATE + int32_t ism_total_brate_ref; +#endif int32_t ism_total_brate; if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -237,7 +240,7 @@ ivas_error ivas_ism_enc( } #ifdef OMASA_BRATE - int32_t ism_total_brate_ref = ism_total_brate; + ism_total_brate_ref = ism_total_brate; // VE: change the interface of the following function and call it with 'st_ivas' only ivas_ism_metadata_enc( &ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ); diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 2f568fb3a3..59b76cdd7c 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -45,8 +45,11 @@ *-----------------------------------------------------------------------*/ static void combine_freqbands_and_subframes( MASA_ENCODER_HANDLE hMasa ); - +#ifdef MASA_AND_OBJECTS +#ifndef OMASA_DIFFUSE_ISM_MERGE static void combine_directions( MASA_ENCODER_HANDLE hMasa ); +#endif +#endif static void find_n_largest( const float *input, int16_t *largestIndices, const int16_t numElements, const int16_t numLargest ); @@ -59,21 +62,47 @@ static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate ); #ifdef MASA_AND_OBJECTS +#ifndef OMASA_DIFFUSE_ISM_MERGE static void ivas_merge_masa_metadatas( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); +#endif -static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], int16_t low_bitrate_mode, int16_t omasa_nbands, int16_t omasa_nblocks ); +static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], int16_t low_bitrate_mode, int16_t omasa_nbands, int16_t omasa_nblocks +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_separated_object +#endif +#ifdef REDUCE_OMASA_META_BITS + , + int16_t ism_imp +#endif +); static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format, const ISM_MODE ism_mode ); -static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, int16_t no_ism, float masa_to_total_energy_ratio ); +static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, int16_t no_ism, float masa_to_total_energy_ratio +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_sep_object +#endif +); static int16_t index_slice_enum( const int16_t *ratio_ism_idx, int16_t no_ism ); -static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, int16_t numCodingBands, int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio ); +static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], int16_t no_ism, int16_t numCodingBands, int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio +#ifdef REDUCE_OMASA_META_BITS + , int16_t shift_one, int16_t idx_sep_obj +#endif +); static void transform_index_and_GR_encode( int16_t *diff_idx, int16_t len, int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); static void transform_difference_index( int16_t *diff_idx, int16_t *idx, int16_t len ); +#ifdef REDUCE_OMASA_META_BITS +static void independent_coding_ratio_ism_idx( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const float *masa_to_total_energy_ratio, + int16_t no_ism, int16_t numCodingBands, int16_t bits_index, BSTR_ENC_HANDLE hMetaData ); + +static void remove_sep_obj( int16_t *diff_idx, int16_t no_ism, int16_t idx_sep_obj ); +#endif #else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif @@ -248,6 +277,10 @@ void ivas_masa_encode( ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ +#ifdef REDUCE_OMASA_META_BITS + , + int16_t ism_imp /* i: importance of separated object */ +#endif #endif ) { @@ -307,9 +340,21 @@ void ivas_masa_encode( if ( hMasa->config.numberOfDirections == 2 && hMasa->config.numTwoDirBands < hMasa->config.numCodingBands && ivas_format == MASA_FORMAT ) #endif { +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE + if ( ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) || ( ivas_format != MASA_ISM_FORMAT ) ) + { + /* Combine directions */ + ivas_masa_combine_directions( hMasa ); + } +#else /* Combine directions */ combine_directions( hMasa ); - +#endif +#else + /* Combine directions */ + combine_directions( hMasa ); +#endif /* If we joined all bands, then metadata is now one directional. */ if ( hMasa->config.numTwoDirBands == 0 ) { @@ -401,7 +446,11 @@ void ivas_masa_encode( /* Move data from encoder to qmetadata */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) ) +#endif #else if ( ivas_format == MASA_FORMAT ) #endif @@ -409,10 +458,12 @@ void ivas_masa_encode( move_metadata_to_qmetadata( hMasa, hQMetaData ); } #ifdef MASA_AND_OBJECTS +#ifndef OMASA_DIFFUSE_ISM_MERGE else if ( ivas_format == MASA_ISM_FORMAT ) { ivas_merge_masa_metadatas( hMasa, hQMetaData ); } +#endif #endif if ( hMasa->config.max_metadata_bits < MINIMUM_BIT_BUDGET_NORMAL_META && !hMasa->config.joinedSubframes ) @@ -433,7 +484,15 @@ void ivas_masa_encode( if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { /* encode MASA/ISM energy ratios */ - ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes ); + ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes +#ifdef REDUCE_OMASA_META_BITS + , idx_separated_object +#endif +#ifdef REDUCE_OMASA_META_BITS + , + ism_imp +#endif + ); } else { @@ -441,7 +500,6 @@ void ivas_masa_encode( } #endif /* Encode metadata */ - ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); #ifdef MASA_AND_OBJECTS @@ -485,8 +543,15 @@ void ivas_masa_encode( if ( hMasa->config.numberOfDirections == 2 && hMasa->config.numTwoDirBands < hMasa->config.numCodingBands ) { /* Combine directions */ +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE + ivas_masa_combine_directions( hMasa ); +#else combine_directions( hMasa ); - +#endif +#else + combine_directions( hMasa ); +#endif /* If we joined all bands, then metadata is now one directional. */ if ( hMasa->config.numTwoDirBands == 0 ) { @@ -1021,8 +1086,15 @@ static void combine_freqbands_and_subframes( return; } - +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE +void ivas_masa_combine_directions( +#else static void combine_directions( +#endif +#else +static void combine_directions( +#endif MASA_ENCODER_HANDLE hMasa ) { int16_t i, j, k; @@ -1138,7 +1210,11 @@ static void combine_directions( ambience2dir = 1.0f - ratioSum; hMeta->directional_meta[0].energy_ratio[j][i] = sumVecLen[j][i] / ( hMeta->directional_meta[0].energy_ratio[j][i] + hMeta->directional_meta[1].energy_ratio[j][i] + ambience2dir / 2.0f ); - +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE + hMeta->directional_meta[1].energy_ratio[j][i] = 0.0f; +#endif /* OMASA_DIFFUSE_ISM_MERGE */ +#endif /* MASA_AND_OBJECTS */ if ( computeCoherence ) { ambience1dir = 1.0f - hMeta->directional_meta[0].energy_ratio[j][i]; @@ -1969,16 +2045,30 @@ void ivas_masa_enc_reconfigure( } #ifdef MASA_AND_OBJECTS +#ifdef OMASA_DIFFUSE_ISM_MERGE +void ivas_merge_masa_metadatas( + MASA_ENCODER_HANDLE hMasa, + OMASA_SPATIAL_META_HANDLE hOMasaMeta +#else static void ivas_merge_masa_metadatas( MASA_ENCODER_HANDLE hMasa, - IVAS_QMETADATA_HANDLE hQMeta ) + IVAS_QMETADATA_HANDLE hQMeta +#endif /* OMASA_DIFFUSE_ISM_MERGE */ +) { int16_t sf, band; uint8_t numCodingBands; uint8_t numDirections; uint8_t numSf; MASA_METADATA_HANDLE hMeta; +#ifdef OMASA_DIFFUSE_ISM_MERGE + float energyTimesRatioISM; + float energyTimesRatioMASA[2]; + float total_diff_nrg; +#else float energyTimesRatio1, energyTimesRatio2; +#endif /* OMASA_DIFFUSE_ISM_MERGE */ + int16_t brange[2]; float eneBand; float energyMerged[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; @@ -1989,14 +2079,33 @@ static void ivas_merge_masa_metadatas( numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4; hMeta = &( hMasa->masaMetadata ); +#ifndef OMASA_DIFFUSE_ISM_MERGE assert( numDirections == 1 && "MASA metadata merging currently implemented only for 1-direction metadata" ); /* Currently only 1-direction metadata is fed to merging */ +#endif for ( sf = 0; sf < numSf; sf++ ) { for ( band = 0; band < numCodingBands; band++ ) { +#ifdef OMASA_DIFFUSE_ISM_MERGE + int16_t merge_dest; + float dir_sum; + uint8_t band_n_dirs; + brange[0] = band; + brange[1] = band + 1; + /* TODO: if this stays, remove the unnecessary range loop from the code */ + if ( numDirections == 1 || ( numDirections == 2 && hMasa->data.twoDirBands[band] == 0 ) ) + { + band_n_dirs = 1; + } + else + { + band_n_dirs = 2; + } +#else brange[0] = hMasa->data.band_mapping[band]; brange[1] = hMasa->data.band_mapping[band + 1]; +#endif /* OMASA_DIFFUSE_ISM_MERGE */ /* Compute energies */ /* MASA energy is in the full 24 band resolution, whereas the ISM energy is already in the coding band resolution */ @@ -2008,6 +2117,66 @@ static void ivas_merge_masa_metadatas( energyMerged[sf][band] = eneBand + hMasa->data.energy_ism[sf][band]; /* Compute weights */ +#ifdef OMASA_DIFFUSE_ISM_MERGE + energyTimesRatioMASA[0] = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band]; + if ( band_n_dirs == 2 ) + { + energyTimesRatioMASA[1] = eneBand * hMeta->directional_meta[1].energy_ratio[sf][band]; + } + else + { + energyTimesRatioMASA[1] = 0.0f; + } + /* target is original MASA diffuseness */ + total_diff_nrg = eneBand * hMeta->common_meta.diffuse_to_total_ratio[sf][band]; + /* criterion is mean of ISM ratio and new ratio */ + energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ) ) ) / 2.0 * hMasa->data.energy_ism[sf][band]; + + /* Determine combined metadata based on the weights */ + merge_dest = -1; + if ( ( band_n_dirs == 1 && energyTimesRatioMASA[0] < energyTimesRatioISM ) || + ( band_n_dirs == 2 && energyTimesRatioMASA[0] < energyTimesRatioMASA[1] && energyTimesRatioMASA[0] < energyTimesRatioISM ) ) + { + /* 1dir and ISM the most energetic, or 2dir and ISM the more energetic than MASA1 */ + merge_dest = 0; + } + else if ( band_n_dirs == 2 && energyTimesRatioMASA[1] <= energyTimesRatioMASA[0] && energyTimesRatioMASA[1] < energyTimesRatioISM ) + { + /* 2dir and ISM the most energetic and MASA2 the least energetic */ + merge_dest = 1; + } + + if ( merge_dest >= 0 ) /* replace one MASA with ISM */ + { + hMeta->directional_meta[merge_dest].azimuth[sf][band] = hOMasaMeta->directional_meta[0].azimuth[sf][band]; + hMeta->directional_meta[merge_dest].elevation[sf][band] = hOMasaMeta->directional_meta[0].elevation[sf][band]; + /* limit with the earlier direct-energy ratio */ + dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ); /* new dir ratio */ + hMeta->directional_meta[merge_dest].energy_ratio[sf][band] = min( dir_sum, hOMasaMeta->directional_meta[0].energy_ratio[sf][band] ); /* clip with original ISM dir */ + hMeta->common_meta.diffuse_to_total_ratio[sf][band] = 1.0f - hMeta->directional_meta[merge_dest].energy_ratio[sf][band]; + + if ( hMasa->config.useCoherence ) /* TODO: is this correct condition? */ + { + hMeta->directional_meta[merge_dest].spread_coherence[sf][band] = hOMasaMeta->directional_meta[0].spread_coherence[sf][band]; + hMeta->common_meta.surround_coherence[sf][band] = hOMasaMeta->common_meta.surround_coherence[sf][band]; + } + + /* recompute direct energy ratios to match the diffuse ratio */ + float direct_quota, direct_scaler; + direct_quota = 1.0f - hMeta->common_meta.diffuse_to_total_ratio[sf][band]; + if ( band_n_dirs == 1 ) + { + hMeta->directional_meta[0].energy_ratio[sf][band] = direct_quota; + } + else + { + dir_sum = hMeta->directional_meta[0].energy_ratio[sf][band] + hMeta->directional_meta[1].energy_ratio[sf][band]; + direct_scaler = direct_quota / ( EPSILON + dir_sum ); + hMeta->directional_meta[0].energy_ratio[sf][band] *= direct_scaler; + hMeta->directional_meta[1].energy_ratio[sf][band] *= direct_scaler; + } + } +#else /* OMASA_DIFFUSE_ISM_MERGE */ energyTimesRatio1 = hMasa->data.energy_ism[sf][band] * hQMeta->q_direction[0].band_data[band].energy_ratio[sf]; energyTimesRatio2 = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band]; @@ -2026,6 +2195,7 @@ static void ivas_merge_masa_metadatas( hQMeta->surcoh_band_data[band].surround_coherence[sf] = (uint8_t) roundf( hMeta->common_meta.surround_coherence[sf][band] * UINT8_MAX ); } } +#endif /* OMASA_DIFFUSE_ISM_MERGE */ } } @@ -2043,12 +2213,136 @@ static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, int16_t no_ism, - float masa_to_total_energy_ratio ) + float masa_to_total_energy_ratio +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_sep_object +#endif +) { int16_t i, j, best_i, best_i2; float dist, div, tmp, dist2, best_dist; int16_t part_idx_sum, max_sum_idx; + +#ifdef REDUCE_OMASA_META_BITS + float ratio_ism_loc[MAX_NUM_OBJECTS]; + int16_t no_ism_loc; + max_sum_idx = ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1; + if ( idx_sep_object > -1 ) + { + if ( ratio_ism[idx_sep_object] < 1.0f / (float) ( max_sum_idx )) + { + /* take it out from quantize function */ + mvr2r( ratio_ism, ratio_ism_loc, idx_sep_object ); + mvr2r( &ratio_ism[idx_sep_object+1], &ratio_ism_loc[idx_sep_object], no_ism-idx_sep_object-1 ); + no_ism_loc = no_ism - 1; + } + else + { + no_ism_loc = no_ism; + mvr2r( ratio_ism, ratio_ism_loc, no_ism ); + } + } + else + { + no_ism_loc = no_ism; + mvr2r( ratio_ism, ratio_ism_loc, no_ism ); + } + + + if ( no_ism > 1 ) + { + if ( masa_to_total_energy_ratio >= MASA2TOTAL_THR ) + { + distribute_evenly_ism( idx, max_sum_idx, no_ism ); + } + else + { + if ( no_ism_loc > 1 ) + { + + dist = 0.0f; + div = 1.0f / (float) ( max_sum_idx ); + + part_idx_sum = 0; + + for ( i = 0; i < no_ism_loc; i++ ) + { + idx[i] = (int16_t) ( ( ratio_ism_loc[i] ) * ( max_sum_idx ) ); + part_idx_sum += idx[i]; + + tmp = ( ratio_ism_loc[i] - ( idx[i] * div ) ); + dist += ( tmp * tmp ); + } + best_dist = dist; + best_i2 = -1; + while ( part_idx_sum < max_sum_idx ) + { + best_i = -1; + /* check which index to increase by 1 for a possible improvement */ + + for ( i = 0; i < no_ism_loc; i++ ) + { + idx[i]++; + dist2 = 0.0f; + + + for ( j = 0; j < no_ism_loc; j++ ) + { + tmp = ( ratio_ism_loc[i] - ( idx[i] * div ) ); + dist2 += ( tmp * tmp ); + } + + if ( dist2 < best_dist ) + { + best_i2 = best_i; + best_i = i; + best_dist = dist2; + } + idx[i]--; + } + if ( best_i > -1 ) + { + idx[best_i]++; + part_idx_sum++; + } + else + { + if ( best_i2 > -1 ) + { + idx[best_i2]++; + part_idx_sum++; + } + else + { + idx[no_ism_loc - 1] += max_sum_idx - part_idx_sum; + part_idx_sum = max_sum_idx; + } + } + } + assert( sum_s( idx, no_ism_loc ) == max_sum_idx ); + } + else + { + idx[0] = max_sum_idx; + } + if ( no_ism_loc < no_ism ) + { + /* insert back the ratio of the separated object */ + for ( i = no_ism - 1; i > idx_sep_object; i-- ) + { + idx[i] = idx[i - 1]; + } + idx[idx_sep_object] = 0; + } + } + } + else + { + idx[0] = (int16_t) ( ( ratio_ism[0] ) * ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) + 0.5f ); + } +#else max_sum_idx = ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1; if ( no_ism > 1 ) { @@ -2126,7 +2420,7 @@ static void quantize_ratio_ism_vector( idx[0] = (int16_t) ( ( ratio_ism[0] ) * ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) + 0.5f ); } - +#endif return; } @@ -2210,6 +2504,401 @@ static void transform_index_and_GR_encode( return; } +static int16_t try_differential( + int16_t numCodingBands, + const float * masa_to_total_energy_ratio, + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t no_ism, + int16_t bits_index, + int16_t * p_b_signif) +{ + int16_t b, i; + int16_t nbits0; + int16_t b_signif; + int16_t ratio_ism_idx_ref[MAX_NUM_OBJECTS]; + int16_t diff_idx[MAX_NUM_OBJECTS]; + + + b_signif = 0; + while ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR && b_signif < numCodingBands ) + { + b_signif++; + } + nbits0 = 0; + if ( b_signif < numCodingBands ) + { + nbits0 = bits_index; + mvs2s( ratio_ism_idx[b_signif], ratio_ism_idx_ref, no_ism ); + for ( b = b_signif + 1; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_ref, diff_idx, no_ism ); + mvs2s( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism ); + /* transform difference index into positive */ + transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + } + } + } + } + *p_b_signif = b_signif; + return nbits0; +} + +static void differential_coding_first_subframe( + BSTR_ENC_HANDLE hMetaData, + const float *masa_to_total_energy_ratio, + int16_t b_signif, + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t no_ism, + int16_t numCodingBands, + int16_t bits_index + ) +{ + int16_t index, b; + int16_t ratio_ism_idx_ref[MAX_NUM_OBJECTS]; + int16_t diff_idx[MAX_NUM_OBJECTS]; + + /* differential encoding*/ + push_next_indice( hMetaData, 0, 1 ); + if ( b_signif < numCodingBands ) + { + index = index_slice_enum( ratio_ism_idx[b_signif], no_ism ); + push_next_indice( hMetaData, index, bits_index ); + mvs2s( ratio_ism_idx[b_signif], ratio_ism_idx_ref, no_ism ); + for ( b = b_signif + 1; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_ref, diff_idx, no_ism ); + mvs2s( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism ); + /* transform difference index into positive */ + transform_index_and_GR_encode( diff_idx, no_ism - 1, 0, hMetaData ); + } + } + } +} +#ifdef REDUCE_OMASA_META_BITS +static void independent_coding_ratio_ism_idx( + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i: ISM ratios */ + const float *masa_to_total_energy_ratio, /* i: MASA to total ratios */ + int16_t no_ism, /* i: number of objects */ + int16_t numCodingBands, /* i: number of subbands */ + int16_t bits_index, /* i: number of bits per index */ + BSTR_ENC_HANDLE hMetaData /* i/o: bitstream */ + ) +{ + int16_t b, index; + + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + index = index_slice_enum( ratio_ism_idx[b], no_ism ); + push_next_indice( hMetaData, index, bits_index ); + } + } + +} + +static void remove_sep_obj( + int16_t *diff_idx, /* i/o: array of difference of indexes */ + int16_t no_ism, /* i: number of objects */ + int16_t idx_sep_obj /* i: index of separated object, to be taken out of array */ +) +{ + int16_t i; + for ( i = idx_sep_obj; i < no_ism-1; i++ ) + { + diff_idx[i] = diff_idx[i + 1]; + } + return; +} + +static void estimate_bits_subband_ism_ratio( + int16_t * ratio_ism_idx, + int16_t *ratio_ism_idx_ref, /* ( i/o ) */ + int16_t no_ism, + int16_t shift_one, + int16_t idx_sep_obj, + int16_t * p_nbits0, + int16_t * p_nbits1 +) +{ + int16_t diff_idx[MAX_NUM_OBJECTS]; + int16_t nbits0, nbits1; + int16_t i; + + nbits0 = 0; + nbits1 = 0; + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx, ratio_ism_idx_ref, diff_idx, no_ism ); + if ( shift_one ) + { + remove_sep_obj( diff_idx, no_ism, idx_sep_obj ); + } + /* transform difference index into positive */ + transform_difference_index( diff_idx, diff_idx, no_ism - 1 - shift_one ); + /* GR encoding */ + + for ( i = 0; i < no_ism - 1 - shift_one; i++ ) + { + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); + } + + + *p_nbits0 = nbits0; + *p_nbits1 = nbits1; + return; +} + +static int16_t encode_ratio_ism_subframe( + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t no_ism, + int16_t numCodingBands, + int16_t sf, + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + BSTR_ENC_HANDLE hMetaData, + const float *masa_to_total_energy_ratio, + int16_t shift_one, + int16_t idx_separated_obj +) +{ + int16_t b, b_signif; + int16_t diff_idx[MAX_NUM_OBJECTS]; + int16_t nbits, nbits0, nbits1, GR_order, GR_order_sb, bits_pos0; + int16_t differential_subframe; + + int16_t ratio_ism_idx_ref[MAX_NUM_OBJECTS]; + int16_t bits_index; + int16_t nbits00, nbits11; + int16_t idx_sep_obj_local; + + idx_sep_obj_local = idx_separated_obj; + if ( idx_separated_obj > -1 ) + { + if ( idx_separated_obj == no_ism - 1 ) + { + idx_sep_obj_local = 0; + } + } + nbits = 0; + nbits0 = 0; + nbits1 = 0; + + bits_pos0 = hMetaData->nb_bits_tot; + differential_subframe = 1; /* the differences are taken with respect to previous subframe */ + + /* first subframe */ + bits_index = 0; + if ( sf == 0 ) + { + bits_index = bits_index_ism_ratio( no_ism ); + + nbits = 0; + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + nbits += bits_index; + } + } + + nbits0 = try_differential( numCodingBands, masa_to_total_energy_ratio, ratio_ism_idx, no_ism, bits_index, &b_signif ); + + if ( nbits <= nbits0 && nbits > 0 ) + { + /* independent encoding */ + push_next_indice( hMetaData, 1, 1 ); + independent_coding_ratio_ism_idx( ratio_ism_idx, masa_to_total_energy_ratio, no_ism, numCodingBands, bits_index, hMetaData ); + nbits = nbits + 1; + } + else + { + if ( nbits > 0 ) + { + differential_coding_first_subframe( hMetaData, masa_to_total_energy_ratio, b_signif, ratio_ism_idx, no_ism, numCodingBands, bits_index ); + nbits = nbits0 + 1; + } + } + +#ifdef DEBUGGING + assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); +#endif + } + else + { + /* not first subframe */ + if ( shift_one == 1 && no_ism == 2 ) + { + nbits = 0; + } + else + { + nbits0 = 0; + nbits1 = 0; + + + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + estimate_bits_subband_ism_ratio( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], no_ism, shift_one, idx_sep_obj_local, &nbits00, &nbits11 ); + nbits0 += nbits00; + nbits1 += nbits11; + } + } + if ( nbits0 < nbits1 ) + { + GR_order = 0; + nbits = nbits0; + } + else + { + GR_order = 1; + nbits = nbits1; + } + if ( numCodingBands > 1 ) + { + /* try the difference from subband to subband; first subband is compared to previous subframe first subband*/ + /* take difference with respect to previous subframe only for first subband */ + nbits0 = 0; + nbits1 = 0; + b_signif = 0; + while ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR && b_signif < numCodingBands ) + { + b_signif++; + } + if ( b_signif < numCodingBands ) + { + estimate_bits_subband_ism_ratio( ratio_ism_idx[b_signif], ratio_ism_idx_prev_sf[b_signif], no_ism, shift_one, idx_sep_obj_local, &nbits0, &nbits1 ); + mvs2s( ratio_ism_idx[b_signif], ratio_ism_idx_ref, no_ism ); + + for ( b = b_signif + 1; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + estimate_bits_subband_ism_ratio( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism, shift_one, idx_sep_obj_local, &nbits00, &nbits11 ); + nbits0 += nbits00; + nbits1 += nbits11; + mvs2s( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism ); + } + } + + if ( nbits0 < nbits1 ) + { + GR_order_sb = 0; + } + else + { + GR_order_sb = 1; + nbits0 = nbits1; + } + + if ( nbits0 < nbits ) + { + differential_subframe = 0; + nbits = nbits0; + GR_order = GR_order_sb; + } + + if ( nbits > 0 ) + { + /* write prediction type */ + push_next_indice( hMetaData, differential_subframe, 1 ); + /* write GR order */ + push_next_indice( hMetaData, GR_order, 1 ); + nbits++; /* for the prediction type */ + nbits++; /* for GR_order */ + + /* write data */ + if ( differential_subframe ) + { + for ( b = 0; b < numCodingBands; b++ ) + { + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + if ( shift_one ) + { + remove_sep_obj( diff_idx, no_ism, idx_sep_obj_local ); + } + transform_index_and_GR_encode( diff_idx, no_ism - 1 - shift_one, GR_order, hMetaData ); + } + } + } + else + { + v_sub_s( ratio_ism_idx[b_signif], ratio_ism_idx_prev_sf[b_signif], diff_idx, no_ism ); + if ( shift_one ) + { + remove_sep_obj( diff_idx, no_ism, idx_sep_obj_local ); + } + transform_index_and_GR_encode( diff_idx, no_ism - 1 - shift_one, GR_order, hMetaData ); + mvs2s( ratio_ism_idx[b_signif], ratio_ism_idx_ref, no_ism - shift_one); + for ( b = b_signif + 1; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subband */ + if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) + { + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_ref, diff_idx, no_ism ); + if ( shift_one ) + { + remove_sep_obj( diff_idx, no_ism, idx_sep_obj_local ); + } + transform_index_and_GR_encode( diff_idx, no_ism - 1 - shift_one, GR_order, hMetaData ); + mvs2s( ratio_ism_idx[b], ratio_ism_idx_ref, no_ism - shift_one ); + } + } + } + } + } + } + else + { + /* only differential wrt previous subframe is possible */ + /* write the differential to subframe case and no bit to signal the difference type */ + + if ( nbits > 0 ) + { + /* write GR order */ + push_next_indice( hMetaData, GR_order, 1 ); + nbits++; /* for GR_order */ + /* write data */ + /* only one subband */ + if ( masa_to_total_energy_ratio[0] < MASA2TOTAL_THR ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); + if ( shift_one ) + { + remove_sep_obj( diff_idx, no_ism, idx_sep_obj_local ); + } + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); + } + } + } + + +#ifdef DEBUGGING + assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); +#endif + } + + + } + return nbits; +} + + +#else static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], @@ -2220,7 +2909,7 @@ static int16_t encode_ratio_ism_subframe( BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio ) { - int16_t b, i; + int16_t b, i, b_signif; int16_t diff_idx[MAX_NUM_OBJECTS], index; int16_t nbits, nbits0, nbits1, GR_order, GR_order_sb, bits_pos0; int16_t differential_subframe; @@ -2235,6 +2924,7 @@ static int16_t encode_ratio_ism_subframe( { if ( no_ism == 2 ) { + for ( b = 0; b < numCodingBands; b++ ) { if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) @@ -2245,6 +2935,7 @@ static int16_t encode_ratio_ism_subframe( nbits += 3; } } + } else if ( no_ism == 3 ) { @@ -2322,28 +3013,33 @@ static int16_t encode_ratio_ism_subframe( /* take difference with respect to previous subframe only for first subband */ nbits0 = 0; nbits1 = 0; - v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); - /* transform difference index into positive */ - transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); - /* GR encoding */ - for ( i = 0; i < no_ism - 1; i++ ) - { - nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); - nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); - } - for ( b = 1; b < numCodingBands; b++ ) - { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); /* transform difference index into positive */ transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); /* GR encoding */ - for ( i = 0; i < no_ism - 1; i++ ) { nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); } + + + for ( b = 1; b < numCodingBands; b++ ) + { + + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + /* transform difference index into positive */ + transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); + /* GR encoding */ + + for ( i = 0; i < no_ism - 1; i++ ) + { + nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); + } + } if ( nbits0 < nbits1 ) @@ -2362,35 +3058,38 @@ static int16_t encode_ratio_ism_subframe( nbits = nbits0; GR_order = GR_order_sb; } - nbits++; /* for GR_order */ - nbits++; /* for the prediction type */ - /* write prediction type */ - push_next_indice( hMetaData, differential_subframe, 1 ); - /* write GR order */ - push_next_indice( hMetaData, GR_order, 1 ); - /* write data */ - if ( differential_subframe ) - { - for ( b = 0; b < numCodingBands; b++ ) + nbits++; /* for GR_order */ + nbits++; /* for the prediction type */ + + /* write prediction type */ + push_next_indice( hMetaData, differential_subframe, 1 ); + /* write GR order */ + push_next_indice( hMetaData, GR_order, 1 ); + /* write data */ + if ( differential_subframe ) { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); - transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - } - } - else - { - v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); - transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); + for ( b = 0; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subframe */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - for ( b = 1; b < numCodingBands; b++ ) + } + } + else { - /* take difference with respect to previous subband */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); + + for ( b = 1; b < numCodingBands; b++ ) + { + /* take difference with respect to previous subband */ + v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); + transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); + } } - } + } else { @@ -2408,14 +3107,18 @@ static int16_t encode_ratio_ism_subframe( v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); } + } #ifdef DEBUGGING assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); #endif } + return nbits; } +#endif + static void ivas_encode_masaism_metadata( @@ -2425,7 +3128,13 @@ static void ivas_encode_masaism_metadata( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t low_bitrate_mode, /* i: is low bitrate more? 1/0 */ int16_t omasa_nbands, - int16_t omasa_nblocks ) + int16_t omasa_nblocks +#ifdef REDUCE_OMASA_META_BITS + , + int16_t idx_separated_object, + int16_t ism_imp +#endif +) { int16_t sf, band; uint8_t numCodingBands; @@ -2434,7 +3143,9 @@ static void ivas_encode_masaism_metadata( float eneBand; int16_t bin; int16_t obj; +#ifndef REDUCE_OMASA_META_BITS float priority[MAX_NUM_OBJECTS]; +#endif int16_t bits_ism[MAX_NUM_OBJECTS]; uint16_t idx_sph; float theta_q, phi_q; @@ -2444,6 +3155,10 @@ static void ivas_encode_masaism_metadata( float step; int16_t inv_step; float energy_ism, energy_ism_ind[MAX_NUM_OBJECTS]; +#ifdef REDUCE_OMASA_META_BITS + int16_t tmp, rotate; + int16_t n_ism_tmp, i; +#endif /* use the values from hQMetaData */ @@ -2567,9 +3282,12 @@ static void ivas_encode_masaism_metadata( /* quantize ism_ratios */ if ( hMasa->data.nchan_ism > 1 ) { - inv_step = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); step = 1.0f / inv_step; +#ifdef REDUCE_OMASA_META_BITS + rotate = 0; + n_ism_tmp = 0; +#endif for ( sf = 0; sf < numSf; sf++ ) { for ( band = 0; band < numCodingBands; band++ ) @@ -2580,23 +3298,112 @@ static void ivas_encode_masaism_metadata( ratio_ism[band][obj] = hMasa->data.energy_ratio_ism[sf][band][obj]; } /* Quantize power ratios */ +#ifdef REDUCE_OMASA_META_BITS + quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band], idx_separated_object ); + if ( n_ism_tmp == numCodingBands && ratio_ism_idx[band][idx_separated_object] != 0 && hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) + { + i = 0; + while ( ratio_ism_idx[band][idx_separated_object] > 0 ) + { + if ( i != idx_separated_object ) + { + ratio_ism_idx[band][i]++; + ratio_ism_idx[band][idx_separated_object]--; + } + i++; + if ( i == hMasa->data.nchan_ism ) + { + i = 0; + } + } + } +#else quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band] ); +#endif /* reconstructed values */ reconstruct_ism_ratios( ratio_ism_idx[band], hMasa->data.nchan_ism, step, hMasa->data.q_energy_ratio_ism[sf][band] ); /* encode vector */ } +#ifdef REDUCE_OMASA_META_BITS + if ( ( hMasa->data.nchan_ism > 2 ) && ( idx_separated_object == hMasa->data.nchan_ism - 1 ) ) + { + /* rotate components */ + rotate = 1; + for ( band = 0; band < numCodingBands; band++ ) + { + if ( hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) + { + tmp = ratio_ism_idx[band][hMasa->data.nchan_ism - 1]; + ratio_ism_idx[band][hMasa->data.nchan_ism - 1] = ratio_ism_idx[band][0]; + ratio_ism_idx[band][0] = tmp; + if ( sf == 0 && tmp == 0 ) + { + n_ism_tmp += 1; + } + + if ( n_ism_tmp == numCodingBands ) + { + assert( tmp == 0 ); + } + } + } + } + else + { + if ( idx_separated_object > -1 ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + if ( hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) + { + if ( ratio_ism_idx[band][idx_separated_object] == 0 && sf == 0 ) + { + n_ism_tmp++; + } + } + } + } + } +#endif /* encode data for current subframe */ + +#ifdef REDUCE_OMASA_META_BITS + if ( sf > 0 && n_ism_tmp == numCodingBands ) + { + encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 1, idx_separated_object ); + } + else + { + encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 0, idx_separated_object ); + } +#else encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf] ); +#endif + /* calculate quantized ISM ratios */ /* save previous subframe indexes */ for ( band = 0; band < numCodingBands; band++ ) { mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], hMasa->data.nchan_ism ); } +#ifdef REDUCE_OMASA_META_BITS + if ( rotate ) + { + for ( band = 0; band < numCodingBands; band++ ) + { + if ( hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) + { + tmp = ratio_ism_idx[band][hMasa->data.nchan_ism - 1]; + ratio_ism_idx[band][hMasa->data.nchan_ism - 1] = ratio_ism_idx[band][0]; + ratio_ism_idx[band][0] = tmp; + } + } + } +#endif } - +#ifndef REDUCE_OMASA_META_BITS set_f( priority, 0.0f, hMasa->data.nchan_ism ); for ( sf = 0; sf < numSf; sf++ ) { @@ -2608,19 +3415,25 @@ static void ivas_encode_masaism_metadata( } } } +#endif } +#ifndef REDUCE_OMASA_META_BITS else { priority[0] = 1; } - +#endif +#ifdef REDUCE_OMASA_META_BITS + calculate_nbits_meta( hMasa->data.nchan_ism, hMasa->data.q_energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); +#else /* decide parameters for ISM metadata quantization */ for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) { bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - priority[obj] ) * 7 ); } +#endif - /* this is only the first version */ + /* quantize directions */ for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index cd2548701a..db156c61e7 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -50,7 +50,12 @@ * Local function prototypes *------------------------------------------------------------------------*/ -static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); +static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], +#ifdef OMASA_DIFFUSE_ISM_MERGE + float diffuseness_m[MASA_FREQUENCY_BANDS], +#endif + const int16_t input_frame, + const int16_t nchan_inp ); static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); @@ -126,8 +131,13 @@ ivas_error ivas_omasa_enc_open( for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { +#ifdef OMASA_DIFFUSE_ISM_MERGE + hOMasa->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + set_zero( hOMasa->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); +#else hOMasa->direction_vector_m[i][j] = (float *) malloc( MAXIMUM_OMASA_FREQ_BANDS * sizeof( float ) ); set_zero( hOMasa->direction_vector_m[i][j], MAXIMUM_OMASA_FREQ_BANDS ); +#endif } } @@ -135,8 +145,13 @@ ivas_error ivas_omasa_enc_open( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { +#ifdef OMASA_DIFFUSE_ISM_MERGE + hOMasa->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + set_zero( hOMasa->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); +#else hOMasa->buffer_intensity_real[i][j] = (float *) malloc( MAXIMUM_OMASA_FREQ_BANDS * sizeof( float ) ); set_zero( hOMasa->buffer_intensity_real[i][j], MAXIMUM_OMASA_FREQ_BANDS ); +#endif } } @@ -225,12 +240,28 @@ void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs /* i : Input sample rate */ +#ifdef OMASA_DIFFUSE_ISM_MERGE + , + ISM_MODE ismMode /* i : ISM mode */ +#endif ) { int16_t i, maxBin; /* Determine the number of bands */ +#ifdef OMASA_DIFFUSE_ISM_MERGE + if ( ismMode == ISM_MODE_NONE ) + { + /* use full resolution for the ISM+MASA merge and reduce later */ + hOMasa->nbands = 24; + } + else + { + hOMasa->nbands = hMasa->config.numCodingBands; + } +#else hOMasa->nbands = hMasa->config.numCodingBands; +#endif hOMasa->nCodingBands = hMasa->config.numCodingBands; /* Determine the number of subframes */ @@ -297,6 +328,12 @@ void ivas_omasa_enc( /* Analysis */ if ( ism_mode == ISM_MODE_NONE ) { +#ifdef OMASA_DIFFUSE_ISM_MERGE + OMASA_SPATIAL_META OMasaMeta; /* working memory for the ISM-object MASA-parameters */ + OMASA_SPATIAL_META_HANDLE hOMasaMeta; + int16_t n_bands_orig, n_subframes_orig; + uint8_t numCodingBands_orig, joinedSubframes_orig; +#else float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float energyRatio[MASA_FREQUENCY_BANDS]; @@ -307,9 +344,66 @@ void ivas_omasa_enc( nBands = hOMasa->nbands; nBlocks = hOMasa->nSubframes; +#endif + +#ifdef OMASA_DIFFUSE_ISM_MERGE + hOMasaMeta = &OMasaMeta; + hOMasaMeta->num_dirs = 1; /* TODO: hard-coding for now */ + + /* merge MASA directions before adding ISM to the mixture */ + if ( hMasa->config.numberOfDirections == 2 ) + { + n_bands_orig = hMasa->config.numCodingBands; + hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; + + ivas_masa_combine_directions( hMasa ); + + hMasa->config.numCodingBands = n_bands_orig; + } + + // force computation into high resolution + n_bands_orig = hOMasa->nbands; + n_subframes_orig = hOMasa->nSubframes; + + hOMasa->nbands = MASA_FREQUENCY_BANDS; + hOMasa->nSubframes = MAX_PARAM_SPATIAL_SUBFRAMES; + /* Estimate MASA parameters from the objects */ + /* NB: only first direction is populated */ + /* NB2: in energy_ratios and surround_coherence only first sub-frame contains valid data */ + ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, hOMasaMeta->directional_meta[0].elevation, hOMasaMeta->directional_meta[0].azimuth, hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].spread_coherence, hOMasaMeta->common_meta.surround_coherence[0], + hOMasaMeta->common_meta.diffuse_to_total_ratio[0], + input_frame, nchan_ism ); + + /* copy energy_ratios and surrCoh from first sub-frame to the remaining ones */ + for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + mvr2r( hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].energy_ratio[i], MASA_FREQUENCY_BANDS ); + mvr2r( hOMasaMeta->common_meta.surround_coherence[0], hOMasaMeta->common_meta.surround_coherence[i], MASA_FREQUENCY_BANDS ); + mvr2r( hOMasaMeta->common_meta.diffuse_to_total_ratio[0], hOMasaMeta->common_meta.diffuse_to_total_ratio[i], MASA_FREQUENCY_BANDS ); + } +#else /* Estimate MASA parameters from the objects */ ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_ism ); +#endif + +#ifdef OMASA_DIFFUSE_ISM_MERGE + /* restore resolution parameters */ + hOMasa->nbands = n_bands_orig; + hOMasa->nSubframes = n_subframes_orig; + + /* perform MASA+ISM merge in full resolution */ + numCodingBands_orig = hMasa->config.numCodingBands; + joinedSubframes_orig = hMasa->config.joinedSubframes; + + hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; + hMasa->config.joinedSubframes = 0; + + ivas_merge_masa_metadatas( hMasa, hOMasaMeta ); /* => merge result in hMasa->masaMetadata */ + + hMasa->config.numCodingBands = numCodingBands_orig; + hMasa->config.joinedSubframes = joinedSubframes_orig; +#else /* Set analyzed values to the QMeta struct */ for ( i = 0; i < nBands; i++ ) @@ -349,9 +443,13 @@ void ivas_omasa_enc( } } } +#endif } else if ( ism_mode == ISM_MASA_MODE_PARAM ) { +#ifdef REDUCE_OMASA_META_BITS + *idx_separated_object = -1; +#endif /* Estimate energies and ratios */ ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); } @@ -625,6 +723,9 @@ static void ivas_omasa_param_est_enc( float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], +#ifdef OMASA_DIFFUSE_ISM_MERGE + float diffuseness_m[MASA_FREQUENCY_BANDS], +#endif const int16_t input_frame, const int16_t nchan_ism ) { @@ -640,7 +741,10 @@ static void ivas_omasa_param_est_enc( float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float diffuseness_vector[MASA_FREQUENCY_BANDS]; +#ifndef OMASA_DIFFUSE_ISM_MERGE float diffuseness_m[MASA_FREQUENCY_BANDS]; +#endif + int16_t band_m_idx, block_m_idx; float renormalization_factor_diff[MASA_FREQUENCY_BANDS]; float norm_tmp; -- GitLab From e4789fa66bc098a5578f01ddde4a89cf8f31360d Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 15:10:51 +0100 Subject: [PATCH 054/591] fix MSVC compilation warnings --- lib_com/ivas_masa_com.c | 1 - lib_com/ivas_prot.h | 2 ++ lib_enc/ivas_enc.c | 4 ++++ lib_enc/ivas_masa_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 17 +++++++++-------- lib_enc/ivas_stat_enc.h | 6 +++--- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 8185680d54..c3082f53e1 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -600,7 +600,6 @@ int32_t calculate_cpe_brate_MASA_ISM( int16_t k, sce_id; k = 0; - while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { k++; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index cf2595f1c4..da7a57efa6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5036,7 +5036,9 @@ void ivas_omasa_set_config( void ivas_omasa_enc( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ +#ifndef OMASA_DIFFUSE_ISM_MERGE IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ +#endif MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index e5e4f2860b..a3adbda9b6 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -340,7 +340,11 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Estimate MASA parameters for the objects */ +#ifdef OMASA_DIFFUSE_ISM_MERGE + ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); +#else ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); +#endif } /* Encode ISMs transport channels */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index b7c5b7f707..f31badf9b3 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2136,7 +2136,7 @@ static void ivas_merge_masa_metadata( /* target is original MASA diffuseness */ total_diff_nrg = eneBand * hMeta->common_meta.diffuse_to_total_ratio[sf][band]; /* criterion is mean of ISM ratio and new ratio */ - energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ) ) ) / 2.0 * hMasa->data.energy_ism[sf][band]; + energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.energy_ism[sf][band]; /* Determine combined metadata based on the weights */ merge_dest = -1; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index b82b2c4a4d..8b603c42fc 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -246,7 +246,7 @@ void ivas_omasa_set_config( #endif ) { - int16_t i, maxBin; + uint8_t i, maxBin; /* Determine the number of bands */ #ifdef OMASA_DIFFUSE_ISM_MERGE @@ -280,7 +280,7 @@ void ivas_omasa_set_config( } } - maxBin = (int16_t) ( input_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + maxBin = (uint8_t) ( input_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); for ( i = 1; i < hOMasa->nbands + 1; i++ ) { @@ -309,8 +309,10 @@ void ivas_omasa_set_config( *--------------------------------------------------------------------------*/ void ivas_omasa_enc( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ +#ifndef OMASA_DIFFUSE_ISM_MERGE + IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ +#endif MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -331,7 +333,7 @@ void ivas_omasa_enc( #ifdef OMASA_DIFFUSE_ISM_MERGE OMASA_SPATIAL_META OMasaMeta; /* working memory for the ISM-object MASA-parameters */ OMASA_SPATIAL_META_HANDLE hOMasaMeta; - int16_t n_bands_orig, n_subframes_orig; + uint8_t n_bands_orig, n_subframes_orig; uint8_t numCodingBands_orig, joinedSubframes_orig; #else float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; @@ -361,7 +363,7 @@ void ivas_omasa_enc( hMasa->config.numCodingBands = n_bands_orig; } - // force computation into high resolution + /* force computation into high resolution */ n_bands_orig = hOMasa->nbands; n_subframes_orig = hOMasa->nSubframes; @@ -372,8 +374,7 @@ void ivas_omasa_enc( /* NB: only first direction is populated */ /* NB2: in energy_ratios and surround_coherence only first sub-frame contains valid data */ ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, hOMasaMeta->directional_meta[0].elevation, hOMasaMeta->directional_meta[0].azimuth, hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].spread_coherence, hOMasaMeta->common_meta.surround_coherence[0], - hOMasaMeta->common_meta.diffuse_to_total_ratio[0], - input_frame, nchan_ism ); + hOMasaMeta->common_meta.diffuse_to_total_ratio[0], input_frame, nchan_ism ); /* copy energy_ratios and surrCoh from first sub-frame to the remaining ones */ for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index adcbc6b9ba..c1df19f243 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -841,9 +841,9 @@ typedef struct ivas_mcmasa_enc_data_structure typedef struct ivas_omasa_enc_data_structure { - int16_t nbands; - int16_t nCodingBands; - int16_t nSubframes; + uint8_t nbands; + uint8_t nCodingBands; + uint8_t nSubframes; /* delay compensation */ float *delay_buffer[MAX_NUM_OBJECTS]; /* Delay buffer for parameter estimation */ -- GitLab From 57edb8d536825b92cb0a24f409e0e8ecc9731c1b Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 15:51:27 +0100 Subject: [PATCH 055/591] fix to 4 ISMs 24 kbps case: when all objects are HIGH_IMP, keep 24 kbps bitrate, otherwise increase the 24 kbps bitrate; under FIX_4OBJ_128 --- lib_com/ivas_omasa_com.c | 20 +++++++++++++++++++- lib_com/ivas_prot.h | 3 +++ lib_com/options.h | 3 +++ lib_dec/ivas_omasa_dec.c | 24 ++++++++++++++++++++++-- lib_enc/ivas_ism_metadata_enc.c | 16 +++++++++++++++- lib_enc/ivas_omasa_enc.c | 7 ++++++- lib_enc/ivas_sce_enc.c | 8 +++++++- 7 files changed, 75 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index bccda612fa..a14b4c908c 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -60,12 +60,19 @@ #define GAMMA_ISM_LOW_IMP3 0.85f #define GAMMA_ISM_MEDIUM_IMP3 1.15f #define GAMMA_ISM_HIGH_IMP3 1.3f + #ifdef TUNING_DISC_3_4obj +#ifdef FIX_4OBJ_128 +#define GAMMA_ISM_LOW_IMP4 0.8f +#define GAMMA_ISM_MEDIUM_IMP4 1.0f +#define GAMMA_ISM_HIGH_IMP4 1.2f +#else #define GAMMA_ISM_LOW_IMP4 0.6f #define GAMMA_ISM_MEDIUM_IMP4 0.8f #define GAMMA_ISM_HIGH_IMP4 1.0f #endif #endif +#endif /*--------------------------------------------------------------- * ivas_omasa_ism_mode_select() @@ -175,6 +182,10 @@ int32_t ivas_interformat_brate( const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ +#ifdef FIX_4OBJ_128 + , + const int16_t limit_flag /* i : flag to limit the bitrate increase */ +#endif ) { int32_t element_brate_out; @@ -182,7 +193,6 @@ int32_t ivas_interformat_brate( nBits = (int16_t) ( element_brate / FRAMES_PER_SEC ); - if ( ism_imp == ISM_INACTIVE_IMP ) { nBits = BITS_ISM_INACTIVE; @@ -192,6 +202,14 @@ int32_t ivas_interformat_brate( #ifdef TUNING_DISC_3_4obj if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) ) ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ { + +#ifdef FIX_4OBJ_128 + if ( limit_flag && ( nchan_ism == 4 && element_brate == 24000 ) ) + { + return element_brate; + } +#endif + if ( ism_imp == ISM_LOW_IMP ) { nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP4 ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index da7a57efa6..b20eb35e3b 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5079,6 +5079,9 @@ int32_t ivas_interformat_brate( const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ +#ifdef FIX_4OBJ_128 + , const int16_t limit_flag /* i : flag to limit the bitrate increase */ +#endif ); void ivas_combined_format_brate_sanity( diff --git a/lib_com/options.h b/lib_com/options.h index bf528b6761..d0fda9cf9f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,6 +179,9 @@ #define REDUCE_OMASA_META_BITS /* Nokia: reduce metadata number of bits and fix directional metadata bit allocation */ #define OMASA_DIFFUSE_ISM_MERGE /* Nokia: Diffuse-energy retaining merging of ISM and MASA */ +#define FIX_4OBJ_128 /* VA: fix to 4 ISMs 24 kbps case: when all objects are HIGH_IMP, keep 24 kbps bitrate, otherwise increase the 24 kbps bitrate */ + + #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 6e95f0710f..5ca00ff79e 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -59,7 +59,12 @@ void ivas_set_surplus_brate_dec( if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - *ism_total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + *ism_total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp +#ifdef FIX_4OBJ_128 + , + 0 +#endif + ); st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - *ism_total_brate; @@ -74,6 +79,16 @@ void ivas_set_surplus_brate_dec( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { +#ifdef FIX_4OBJ_128 + int16_t brate_limit_flag = 0; + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + brate_limit_flag += st_ivas->hIsmMetaData[n]->ism_imp; + } + brate_limit_flag = brate_limit_flag >= 10 ? 1 : 0; +#endif + ism_total_brate_ref = 0; for ( n = 0; n < st_ivas->nchan_ism; n++ ) { @@ -90,7 +105,12 @@ void ivas_set_surplus_brate_dec( { st_ivas->hSCE[n]->element_brate = element_brate[n]; - *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp ); + *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp +#ifdef FIX_4OBJ_128 + , + brate_limit_flag +#endif + ); } st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index aacf3dc0b6..43c498bcd0 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -824,6 +824,15 @@ ivas_error ivas_ism_metadata_enc( if ( ism_mode == ISM_MASA_MODE_DISC ) { int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; +#ifdef FIX_4OBJ_128 + int16_t brate_limit_flag = 0; + + for ( ch = 0; ch < num_obj; ch++ ) + { + brate_limit_flag += ism_imp[ch]; + } + brate_limit_flag = brate_limit_flag >= 10 ? 1 : 0; +#endif bits_ism = (int16_t) ( *ism_total_brate / FRAMES_PER_SECOND ); set_s( bits_element, bits_ism / num_obj, num_obj ); @@ -833,7 +842,12 @@ ivas_error ivas_ism_metadata_enc( *ism_total_brate = 0; for ( ch = 0; ch < num_obj; ch++ ) { - *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, num_obj, hSCE[ch]->element_brate, ism_imp[ch] ); + *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, num_obj, hSCE[ch]->element_brate, ism_imp[ch] +#ifdef FIX_4OBJ_128 + , + brate_limit_flag +#endif + ); } ism_metadata_flag_global = 1; } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 8b603c42fc..b7fe8ee27e 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -667,7 +667,12 @@ void ivas_set_surplus_brate_enc( { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ); + st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp +#ifdef FIX_4OBJ_128 + , + 0 +#endif + ); /* note: ISM st->total_brate is iset in ivas_sce_enc() */ } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index c600aa1436..dde49fb9cd 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -229,7 +229,13 @@ ivas_error ivas_sce_enc( { set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); - st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp ) - nb_bits_metadata * FRAMES_PER_SEC; + st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp +#ifdef FIX_4OBJ_128 + , + 0 +#endif + ) - + nb_bits_metadata * FRAMES_PER_SEC; } #endif -- GitLab From 0cc758c2f085cea8450381c7694060ad7b8bce74 Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 6 Mar 2023 18:26:09 +0200 Subject: [PATCH 056/591] fix compilation warnings --- lib_com/ivas_prot.h | 2 ++ lib_enc/ivas_enc.c | 6 +++++- lib_enc/ivas_masa_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4e700a7abe..7adc713c74 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5219,7 +5219,9 @@ void ivas_omasa_set_config( void ivas_omasa_enc( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ +#ifndef OMASA_DIFFUSE_ISM_MERGE IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ +#endif MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index c0bf3caa93..793c1a9885 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -357,7 +357,11 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Estimate MASA parameters for the objects */ - ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); + ivas_omasa_enc( st_ivas->hOMasa, +#ifndef OMASA_DIFFUSE_ISM_MERGE + st_ivas->hQMetaData, +#endif + st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); } /* Encode ISMs transport channels */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 59b76cdd7c..ecfa7f0edb 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2130,7 +2130,7 @@ static void ivas_merge_masa_metadatas( /* target is original MASA diffuseness */ total_diff_nrg = eneBand * hMeta->common_meta.diffuse_to_total_ratio[sf][band]; /* criterion is mean of ISM ratio and new ratio */ - energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ) ) ) / 2.0 * hMasa->data.energy_ism[sf][band]; + energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.energy_ism[sf][band]; /* Determine combined metadata based on the weights */ merge_dest = -1; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index db156c61e7..a647ceeb9e 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -310,7 +310,9 @@ void ivas_omasa_set_config( void ivas_omasa_enc( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ +#ifndef OMASA_DIFFUSE_ISM_MERGE IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ +#endif MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -358,7 +360,7 @@ void ivas_omasa_enc( ivas_masa_combine_directions( hMasa ); - hMasa->config.numCodingBands = n_bands_orig; + hMasa->config.numCodingBands = (int8_t)n_bands_orig; } // force computation into high resolution -- GitLab From 6d5d3f18df800beebf7f05ba73054534b20cbd83 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 7 Mar 2023 15:17:46 +0200 Subject: [PATCH 057/591] fix fp precision --- lib_com/ivas_omasa_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index f825b41252..da3a0cf503 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -390,7 +390,7 @@ void calculate_nbits_meta( priority[obj] = max_p; } } - bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - priority[obj] ) * 7 ); + bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - ( (int16_t) ( priority[obj] * 1000.0f ) ) * 0.001f ) * 7 ); } return; } -- GitLab From aabaaa86e190b40ecd718f9a802b2dbb244e4af6 Mon Sep 17 00:00:00 2001 From: advasila Date: Wed, 8 Mar 2023 11:51:32 +0200 Subject: [PATCH 058/591] remove TUNING_2obj switch --- lib_com/ivas_omasa_com.c | 4 ---- lib_com/ivas_rom_com.c | 4 ---- lib_com/options.h | 1 - 3 files changed, 9 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 0c6c35afab..e248cc5a9d 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -102,11 +102,7 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 2: -#ifdef TUNING_48kbps_2obj if ( ivas_total_brate >= IVAS_48k ) -#else - if ( ivas_total_brate >= IVAS_64k ) -#endif { ism_mode = ISM_MASA_MODE_DISC; } diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index ec2b6c5b93..66db7666f2 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2794,11 +2794,7 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = #else {9600, 0, 0, 0}, /* 32k */ #endif -#ifdef TUNING_48kbps_2obj {IVAS_13k2, 9600, 0, 0}, /* 48k */ -#else - {IVAS_13k2, 0, 0, 0}, /* 48k */ -#endif #ifdef OMASA_BRATE {16000, 11700, 0, 0}, /* 64k */ #else diff --git a/lib_com/options.h b/lib_com/options.h index d0fda9cf9f..4a4fefae31 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#define TUNING_48kbps_2obj #define TUNING_DISC_3_4obj /* Nokia: increase bitrate for objects in DISC mode at 128k 4obj and 96k 3 obj */ #define REDUCE_OMASA_META_BITS /* Nokia: reduce metadata number of bits and fix directional metadata bit allocation */ -- GitLab From a8f5f41389dcb7c7510fb20aa9ea3cc3a8bd8ee4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 8 Mar 2023 15:17:26 +0100 Subject: [PATCH 059/591] - support of bitrate switching in OMASA format; under OMASA_BRATE_SW --- lib_com/ivas_ism_config.c | 28 ++ lib_com/ivas_omasa_com.c | 41 +++ lib_com/ivas_prot.h | 38 ++- lib_com/options.h | 2 + lib_dec/ivas_corecoder_dec_reconfig.c | 2 + lib_dec/ivas_cpe_dec.c | 4 +- lib_dec/ivas_init_dec.c | 39 ++- lib_dec/ivas_ism_metadata_dec.c | 23 +- lib_dec/ivas_ism_renderer.c | 12 +- lib_dec/ivas_masa_dec.c | 45 +-- lib_dec/ivas_omasa_dec.c | 285 ++++++++++++++++++- lib_dec/ivas_stereo_switching_dec.c | 4 + lib_enc/ivas_corecoder_enc_reconfig.c | 16 +- lib_enc/ivas_cpe_enc.c | 6 +- lib_enc/ivas_enc.c | 11 + lib_enc/ivas_ism_metadata_enc.c | 8 +- lib_enc/ivas_masa_enc.c | 6 + lib_enc/ivas_omasa_enc.c | 121 +++++++- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 +- 19 files changed, 628 insertions(+), 67 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 06ccd94a31..c329344804 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -586,3 +586,31 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } + + +#ifdef OMASA_BRATE_SW +/*------------------------------------------------------------------------- + * ivas_ism_metadata_close() + * + * Deallocate ISM metadata handles + *-------------------------------------------------------------------------*/ + +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE *hIsmMetaData, /* i/o: ISM metadata handles */ + const int16_t first_idx /* i : index of first handle to deallocate */ +) +{ + int16_t n; + + for ( n = first_idx; n < MAX_NUM_OBJECTS; n++ ) + { + if ( hIsmMetaData[n] != NULL ) + { + free( hIsmMetaData[n] ); + hIsmMetaData[n] = NULL; + } + } + + return; +} +#endif diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index a14b4c908c..71a452dadd 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -169,6 +169,47 @@ ISM_MODE ivas_omasa_ism_mode_select( } +#ifdef OMASA_BRATE_SW +/*--------------------------------------------------------------- + * ivas_set_omasa_TC() + * + * set number of transport channels in OMASA format + * ---------------------------------------------------------------*/ + +void ivas_set_omasa_TC( + const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of input ISMs */ + int16_t *nSCE, /* o : number of SCEs */ + int16_t *nCPE /* o : number of CPEs */ +) +{ + switch ( ism_mode ) + { + case ISM_MASA_MODE_PARAM: + *nCPE = 1; + *nSCE = 0; + break; + case ISM_MASA_MODE_ONE_OBJ: + *nCPE = 1; + *nSCE = 1; + break; + case ISM_MASA_MODE_DISC: + *nCPE = 1; + *nSCE = nchan_ism; + break; + case ISM_MODE_NONE: + *nCPE = 1; + *nSCE = 0; + break; + default: + break; + } + + return; +} +#endif + + #ifdef OMASA_BRATE /*--------------------------------------------------------------- * ivas_interformat_brate() diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b20eb35e3b..fb117e8e81 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -799,9 +799,16 @@ float ism_dequant_meta( ivas_error set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ float azimuth, /* i : azimuth */ - float elevation /* i : elevation */ + float elevation /* i : elevation */ ); +#ifdef OMASA_BRATE_SW +void ivas_ism_metadata_close( // VE: use it also at the encoder + ISM_METADATA_HANDLE *hIsmMetaData, /* i/o: ISM metadata handles */ + const int16_t first_idx /* i : index of first handle to deallocate */ +); +#endif + ivas_error create_ism_metadata_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t n_ISms, /* i : number of objects */ @@ -5024,13 +5031,23 @@ void ivas_omasa_enc_close( const int16_t nchan_ism /* i : number of objects */ ); +#ifdef OMASA_BRATE_SW +ivas_error ivas_omasa_enc_config( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +ivas_error ivas_omasa_dec_config( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif + void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs /* i : Input sample rate */ #ifdef OMASA_DIFFUSE_ISM_MERGE , - ISM_MODE ismMode /* i : ISM mode */ + const ISM_MODE ismMode /* i : ISM mode */ #endif ); @@ -5061,7 +5078,7 @@ void ivas_set_surplus_brate_enc( void ivas_set_surplus_brate_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int32_t *ism_total_brate /* i : ISM total bit-rate */ + int32_t *ism_total_brate /* i : ISM total bitrate */ ); void set_ism_importance_interformat( @@ -5097,6 +5114,15 @@ ISM_MODE ivas_omasa_ism_mode_select( const int16_t nchan_ism /* i : number of input ISM's */ ); +#ifdef OMASA_BRATE_SW +void ivas_set_omasa_TC( + const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of input ISMs */ + int16_t *nSCE, /* o : number of SCEs */ + int16_t *nCPE /* o : number of CPEs */ +); +#endif + void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ float data_in_f2[][L_FRAME48k], /* i : Transport audio signals 2 */ @@ -5109,6 +5135,12 @@ ivas_error ivas_masa_ism_data_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); +#ifdef OMASA_BRATE_SW +void ivas_masa_ism_data_close( + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +); +#endif + void preProcessStereoTransportsForMovedObjects( Decoder_Struct* st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_com/options.h b/lib_com/options.h index d0fda9cf9f..710803fcbc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -181,6 +181,8 @@ #define FIX_4OBJ_128 /* VA: fix to 4 ISMs 24 kbps case: when all objects are HIGH_IMP, keep 24 kbps bitrate, otherwise increase the 24 kbps bitrate */ +#define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ + #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index bb2b753181..5317781d55 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -512,10 +512,12 @@ ivas_error ivas_cldfb_dec_reconfig( } } } + /* CLDFB Interpolation weights */ if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index eab7b7c340..545dc8fbb3 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -176,7 +176,6 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS } #endif - } else { @@ -711,10 +710,11 @@ ivas_error create_cpe_dec( { #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || + ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || st_ivas->sba_dirac_stereo_flag ) #else if ( st_ivas->ivas_format == STEREO_FORMAT || st_ivas->ivas_format == MASA_FORMAT || -#endif ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || st_ivas->sba_dirac_stereo_flag ) +#endif { if ( ( hCPE->input_mem[i] = (float *) malloc( sizeof( float ) * NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f530e8ecce..2d5a3168f2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -71,7 +71,9 @@ ivas_error ivas_dec_setup( int32_t ivas_total_brate; ivas_error error; #ifdef MASA_AND_OBJECTS +#ifndef OMASA_BRATE_SW int32_t cpe_brate; +#endif #endif error = IVAS_ERR_OK; @@ -159,6 +161,12 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) { st_ivas->hCPE[0]->nchan_out = 1; @@ -170,6 +178,7 @@ ivas_error ivas_dec_setup( return error; } } +#endif } } } @@ -177,8 +186,8 @@ ivas_error ivas_dec_setup( else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ - /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata*/ + /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata */ st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1; st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); @@ -187,6 +196,12 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) { @@ -196,6 +211,7 @@ ivas_error ivas_dec_setup( { return error; } +#endif } } } @@ -1051,10 +1067,17 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); #ifdef OMASA_BRATE +#ifdef OMASA_BRATE_SW + if ( ( error = create_ism_metadata_dec( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } +#endif #endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -1740,7 +1763,11 @@ void ivas_destroy_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { +#ifdef OMASA_BRATE_SW + int16_t i; +#else int16_t i, n; +#endif /* CLDFB handles */ for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) @@ -1807,6 +1834,9 @@ void ivas_destroy_dec( } /* ISM metadata handles */ +#ifdef OMASA_BRATE_SW + ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); +#else for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { if ( st_ivas->hIsmMetaData[n] != NULL ) @@ -1815,6 +1845,7 @@ void ivas_destroy_dec( st_ivas->hIsmMetaData[n] = NULL; } } +#endif /* ISm renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) @@ -1902,8 +1933,12 @@ void ivas_destroy_dec( free( st_ivas->hMonoDmxRenderer ); st_ivas->hMonoDmxRenderer = NULL; } + #ifdef MASA_AND_OBJECTS /* MASA ISM structure */ +#ifdef OMASA_BRATE_SW + ivas_masa_ism_data_close( &st_ivas->hMasaIsmData ); +#else if ( st_ivas->hMasaIsmData != NULL ) { if ( st_ivas->hMasaIsmData->delayBuffer != NULL ) @@ -1919,6 +1954,8 @@ void ivas_destroy_dec( st_ivas->hMasaIsmData = NULL; } #endif +#endif + /* Head track data handle */ if ( st_ivas->hHeadTrackData != NULL ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e72d691768..5e404c0ff9 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -596,10 +596,10 @@ ivas_error ivas_ism_metadata_dec( * Create, allocate, initialize and configure IVAS decoder ISM handles *-------------------------------------------------------------------------*/ -ivas_error create_ism_metadata_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t n_ISms, /* i : number of objects */ - int32_t element_brate_tmp[] /* o : element bitrate per object */ +ivas_error create_ism_metadata_dec( // VE: rename to ivas_ism_metadata_dec_create + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_ISms, /* i : number of objects */ + int32_t element_brate_tmp[] /* o : element bitrate per object */ ) { int16_t ch; @@ -624,12 +624,19 @@ ivas_error create_ism_metadata_dec( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL +#ifdef OMASA_BRATE_SW + if ( element_brate_tmp != NULL ) + { +#endif + ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS - , - 0 + , + 0 +#endif + ); +#ifdef OMASA_BRATE_SW + } #endif - ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index ef890a7482..30a32e03a6 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -252,10 +252,10 @@ void ivas_ism_get_stereo_gains( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------------* - * ivas_masa_ism_separate_object_renderer_open() - * - * Open structures, reserve memory, and init values. - *-------------------------------------------------------------------------*/ +* ivas_masa_ism_separate_object_renderer_open() +* + * Open structures, reserve memory, and init values. + *-------------------------------------------------------------------------*/ ivas_error ivas_masa_ism_separate_object_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -266,10 +266,9 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( 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" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer \n" ) ); } - for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); @@ -296,6 +295,7 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); } + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) { if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index f45b1527ff..6cd00b03e8 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -419,10 +419,12 @@ ivas_error ivas_masa_decode( } } } + if ( st_ivas->hDirAC != NULL ) { ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, SBA_MODE_NONE, 0 ); } + #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { @@ -433,6 +435,7 @@ ivas_error ivas_masa_decode( return error; } } + if ( st_ivas->hDirAC != NULL ) { #ifndef OMASA_BRATE @@ -461,7 +464,9 @@ ivas_error ivas_masa_decode( } } #endif + st->next_bit_pos = next_bit_pos_orig; + #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { @@ -581,45 +586,6 @@ ivas_error ivas_masa_dec_open( return IVAS_ERR_OK; } -#ifdef MASA_AND_OBJECTS -/*-------------------------------------------------------------------* - * ivas_masa_ism_data_open() - * - * - *-------------------------------------------------------------------*/ - -ivas_error ivas_masa_ism_data_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -) -{ - MASA_ISM_DATA_HANDLE hMasaIsmData; - int16_t ch, bin; - - if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA ISM data\n" ) ); - } - - for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) - { - for ( ch = 0; ch < 2; ch++ ) - { - hMasaIsmData->ismPreprocMatrix[ch][ch][bin] = 1.0f; - hMasaIsmData->ismPreprocMatrix[1 - ch][ch][bin] = 0.0f; - hMasaIsmData->eneMoveIIR[ch][bin] = 0.0f; - hMasaIsmData->enePreserveIIR[ch][bin] = 0.0f; - } - hMasaIsmData->preprocEneTarget[bin] = 0.0f; - hMasaIsmData->preprocEneRealized[bin] = 0.0f; - } - hMasaIsmData->objectsMoved = 0; - hMasaIsmData->delayBuffer = NULL; - st_ivas->hMasaIsmData = hMasaIsmData; - - return IVAS_ERR_OK; -} -#endif - /*-----------------------------------------------------------------------* * ivas_masa_dec_close() @@ -1374,6 +1340,7 @@ ivas_error ivas_masa_dec_reconfigure( } } } + #ifdef MASA_AND_OBJECTS ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 5ca00ff79e..98e7b7eeee 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -35,11 +35,294 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" +#ifdef OMASA_BRATE_SW +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif +#ifdef MASA_AND_OBJECTS +/*-------------------------------------------------------------------* + * ivas_masa_ism_data_open() + * + * Allocate and initialize MASA_ISM rendering handle + *-------------------------------------------------------------------*/ + +ivas_error ivas_masa_ism_data_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + MASA_ISM_DATA_HANDLE hMasaIsmData; + int16_t ch, bin; + + if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA ISM data\n" ) ); + } + + for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->ismPreprocMatrix[ch][ch][bin] = 1.0f; + hMasaIsmData->ismPreprocMatrix[1 - ch][ch][bin] = 0.0f; + hMasaIsmData->eneMoveIIR[ch][bin] = 0.0f; + hMasaIsmData->enePreserveIIR[ch][bin] = 0.0f; + } + hMasaIsmData->preprocEneTarget[bin] = 0.0f; + hMasaIsmData->preprocEneRealized[bin] = 0.0f; + } + + hMasaIsmData->objectsMoved = 0; + hMasaIsmData->delayBuffer = NULL; + st_ivas->hMasaIsmData = hMasaIsmData; + + return IVAS_ERR_OK; +} + + +#ifdef OMASA_BRATE_SW +/*-------------------------------------------------------------------* + * ivas_masa_ism_data_close() + * + * Deallocate MASA_ISM rendering handle + *-------------------------------------------------------------------*/ + +void ivas_masa_ism_data_close( + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +) +{ + int16_t i; + + if ( hMasaIsmData == NULL || *hMasaIsmData == NULL ) + { + return; + } + + if ( ( *hMasaIsmData )->delayBuffer != NULL ) + { + for ( i = 0; i < ( *hMasaIsmData )->delayBuffer_nchan; i++ ) + { + free( ( *hMasaIsmData )->delayBuffer[i] ); + } + free( ( *hMasaIsmData )->delayBuffer ); + ( *hMasaIsmData )->delayBuffer = NULL; + } + + free( *hMasaIsmData ); + *hMasaIsmData = NULL; + + return; +} +#endif +#endif + + +#ifdef OMASA_BRATE_SW +/*--------------------------------------------------------------------------* + * ivas_omasa_dec_config() + * + * oMASA decoder configuration + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_dec_config( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t k, n, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; + int32_t ivas_total_brate, ism_total_brate, cpe_brate; + IVAS_FORMAT ivas_format_old; + ISM_MODE ism_mode_old; + ivas_error error; + + /* initializations */ + error = IVAS_ERR_OK; + ism_total_brate = 0; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + /* save previous frame parameters */ + ism_mode_old = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism ); + st_ivas->ism_mode = ism_mode_old; + + ivas_format_old = st_ivas->ivas_format; + if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) + { + st_ivas->ivas_format = MASA_ISM_FORMAT; + } + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + nSCE_old = st_ivas->nSCE; + nchan_hp20_old = getNumChanSynthesis( st_ivas ); + + /* reconstruct parameters */ + st_ivas->ivas_format = ivas_format_old; + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + st_ivas->nchan_ism = 0; + } + + /* set ism_mode of current frame */ + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); + + /* MASA reconfig. */ + cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* OMASA reconfig. */ + if ( st_ivas->hMasaIsmData == NULL && st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + ivas_set_omasa_TC( st_ivas->ism_mode, st_ivas->nchan_ism, &st_ivas->nSCE, &st_ivas->nCPE ); + + /* re-configure hp20 memories */ + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* reconfigure core-coders for ISMs */ + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, -1, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + k = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + } + + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + + if ( ism_mode_old != st_ivas->ism_mode ) + { + /* ISM MD reconfig. */ + n_MD = 0; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + n_MD = 1; + + if ( st_ivas->hIsmMetaData[0] == NULL ) + { + if ( ( error = create_ism_metadata_dec( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + n_MD = st_ivas->nchan_ism; + + ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); + + if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); + + /* CLDFB instances */ + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; + + /* objects renderer reconfig. */ + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + if ( st_ivas->hIsmRendererData == NULL ) + { + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + { + for ( n = 1; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) + { + free( st_ivas->hMasaIsmData->delayBuffer[n] ); + } + + st_ivas->hMasaIsmData->delayBuffer_nchan = 1; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + float tmp[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + + st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; + + mvr2r( st_ivas->hMasaIsmData->delayBuffer[0], tmp, st_ivas->hMasaIsmData->delayBuffer_size ); + free( st_ivas->hMasaIsmData->delayBuffer[0] ); + free( st_ivas->hMasaIsmData->delayBuffer ); + if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + + for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) + { + if ( ( st_ivas->hMasaIsmData->delayBuffer[n] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + set_zero( st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); + } + mvr2r( tmp, st_ivas->hMasaIsmData->delayBuffer[0], st_ivas->hMasaIsmData->delayBuffer_size ); + } + } + else if ( st_ivas->ism_mode != ISM_MASA_MODE_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) + { + for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) + { + free( st_ivas->hMasaIsmData->delayBuffer[n] ); + } + free( st_ivas->hMasaIsmData->delayBuffer ); + st_ivas->hMasaIsmData->delayBuffer = NULL; + + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } + } + + return error; +} +#endif + + #ifdef OMASA_BRATE /*--------------------------------------------------------------------------* * ivas_set_surplus_brate_dec() @@ -49,7 +332,7 @@ void ivas_set_surplus_brate_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int32_t *ism_total_brate /* i/o: ISM total bit-rate */ + int32_t *ism_total_brate /* i/o: ISM total bitrate */ ) { int16_t n, bits_ism, bits_element[MAX_NUM_OBJECTS]; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 20d03915c2..45257627a8 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -880,7 +880,11 @@ ivas_error stereo_memory_dec( * Bitrate switching in MASA format *---------------------------------------------------------------*/ +#ifdef OMASA_BRATE_SW + if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && nchan_transport == 2 ) +#else if ( ivas_format == MASA_FORMAT && nchan_transport == 2 ) +#endif { if ( hCPE->nchan_out == 1 ) { diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e8486d7738..27c855ec6f 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -230,7 +230,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hStereoMdct = NULL; } - /* create missing core coder elements and set element bitrates for alrady existing ones */ + /* create missing core coder elements and set element bitrates for already existing ones */ if ( st_ivas->nSCE > 0 ) { nSCE_existing = min( nSCE_old, st_ivas->nSCE ); @@ -250,7 +250,11 @@ ivas_error ivas_corecoder_enc_reconfig( } /* propagate input audio buffers */ +#ifdef OMASA_BRATE_SW + if ( n_CoreCoder_existing > sce_id && hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) +#else if ( n_CoreCoder_existing > sce_id ) +#endif { mvr2r( input_buff[sce_id], st_ivas->hSCE[sce_id]->hCoreCoder[0]->input_buff, len_inp_memory ); } @@ -259,7 +263,11 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ +#ifdef OMASA_BRATE_SW + if ( sce_id > 0 || hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) +#else if ( sce_id > 0 ) +#endif { reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); } @@ -289,7 +297,13 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n + st_ivas->nSCE ) * MAX_NUM_INDICES; +#ifdef OMASA_BRATE_SW + if ( ( cpe_id * CPE_CHANNELS + n > 0 ) || + ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) || + ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 ) ) +#else if ( cpe_id * CPE_CHANNELS + n > 0 || ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) ) +#endif { reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index cf69b1e333..ab4567ad6f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -268,7 +268,11 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode != IVAS_CPE_MDCT && ( hCPE->element_brate != hCPE->last_element_brate || hCPE->last_element_mode != hCPE->element_mode || - sts[0]->ini_frame == 0 || sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ + sts[0]->ini_frame == 0 || +#ifdef OMASA_BRATE_SW + ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) || +#endif + sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ { if ( st_ivas->hQMetaData != NULL ) { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index a3adbda9b6..fef6c63211 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -300,7 +300,14 @@ ivas_error ivas_enc( float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else ivas_masa_enc_reconfigure( st_ivas ); +#endif hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; @@ -315,6 +322,9 @@ ivas_error ivas_enc( set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); #ifdef OMASA_BRATE +#ifdef OMASA_BRATE_SW + idx_separated_object = 0; +#else /* Configure MASA encoder based on frame parameters */ if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -332,6 +342,7 @@ ivas_error ivas_enc( #endif ); } +#endif /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 43c498bcd0..88a782ccbe 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -958,11 +958,13 @@ ivas_error create_ism_metadata_enc( { int16_t ch, nchan_transport; - // VE: this part of the code is better to be moved to a separate function, e.g. ivas_set_omasa_TC() #ifdef MASA_AND_OBJECTS nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { +#ifdef OMASA_BRATE_SW + ivas_set_omasa_TC( st_ivas->ism_mode, n_ISms, &st_ivas->nSCE, &st_ivas->nCPE ); +#else switch ( st_ivas->ism_mode ) { case ISM_MASA_MODE_PARAM: @@ -985,6 +987,7 @@ ivas_error create_ism_metadata_enc( default: break; } +#endif } else { @@ -1041,12 +1044,13 @@ ivas_error create_ism_metadata_enc( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } + #ifdef MASA_AND_OBJECTS if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); // VE: nchan_transport ????? } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index f31badf9b3..ac8380a503 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -707,6 +707,7 @@ ivas_error ivas_masa_enc_config( } } #endif + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS @@ -714,6 +715,7 @@ ivas_error ivas_masa_enc_config( ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); + hQMetaData->is_masa_ivas_format = 1; #ifdef MASA_AND_OBJECTS @@ -747,6 +749,7 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS } #endif + /* Setup importance weights for two-direction band selection. */ if ( hMasa->config.numberOfDirections == 2 ) { @@ -1977,6 +1980,7 @@ void ivas_masa_enc_reconfigure( #endif ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + #ifdef MASA_AND_OBJECTS ism_total_brate = 0; if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) @@ -1987,6 +1991,7 @@ void ivas_masa_enc_reconfigure( } } #endif + if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) { for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) @@ -2043,6 +2048,7 @@ void ivas_masa_enc_reconfigure( return; } + #ifdef MASA_AND_OBJECTS #ifdef OMASA_DIFFUSE_ISM_MERGE /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index b7fe8ee27e..e739410ffb 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -230,6 +230,123 @@ void ivas_omasa_enc_close( } +#ifdef OMASA_BRATE_SW +/*--------------------------------------------------------------------------* + * ivas_omasa_enc_config() + * + * oMASA encoder configuration + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_enc_config( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +) +{ + int16_t k, sce_id, nSCE_old; + int32_t ivas_total_brate, ism_total_brate; + ISM_MODE ism_mode_old; + ENCODER_CONFIG_HANDLE hEncoderConfig; + ivas_error error; + + error = IVAS_ERR_OK; + hEncoderConfig = st_ivas->hEncoderConfig; + ivas_total_brate = hEncoderConfig->ivas_total_brate; + + + //ivas_masa_enc_reconfigure( st_ivas ); // VE: might not be needed + + + ism_mode_old = st_ivas->ism_mode; + nSCE_old = st_ivas->nSCE; + + st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, hEncoderConfig->nchan_ism ); + st_ivas->nchan_transport = 2; + + /* reconfiguration in case of bitrate switching */ + if ( hEncoderConfig->last_ivas_total_brate != ivas_total_brate ) + { + ivas_set_omasa_TC( st_ivas->ism_mode, hEncoderConfig->nchan_ism, &st_ivas->nSCE, &st_ivas->nCPE ); + + k = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) + { + k++; + } + + ism_total_brate = 0; + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) // VE!!!!! + { + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1 ); + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nSCE, NULL, NULL, NULL, NULL, NULL, NULL, 1 ); + } + + /* reconfigure core-coders for ISMs */ + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, 1, 2, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* re-write IVAS format signalling - actual 'ism_mode' was not known before */ + if ( st_ivas->nSCE > 0 ) + { + reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->next_ind ); + } + else + { + reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind ); + } + + ivas_write_format( st_ivas ); + + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hOMasa == NULL ) + { + if ( ( error = ivas_omasa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hOMasa != NULL ) + { + ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); + st_ivas->hOMasa = NULL; + } + + st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; + + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) + { + hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + } + else + { + hEncoderConfig->element_mode_init = IVAS_CPE_DFT; + } + } + + /* Configure MASA encoder based on frame parameters */ + if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) + { + /* Configure oMASA analysis based on MASA config */ + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); + } + + return error; +} +#endif + + /*--------------------------------------------------------------------------* * ivas_omasa_set_config() * @@ -242,7 +359,7 @@ void ivas_omasa_set_config( const int32_t input_Fs /* i : Input sample rate */ #ifdef OMASA_DIFFUSE_ISM_MERGE , - ISM_MODE ismMode /* i : ISM mode */ + const ISM_MODE ismMode /* i : ISM mode */ #endif ) { @@ -673,7 +790,7 @@ void ivas_set_surplus_brate_enc( 0 #endif ); - /* note: ISM st->total_brate is iset in ivas_sce_enc() */ + /* note: ISM st->total_brate is set in ivas_sce_enc() */ } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 72ac9311c5..89bff9f74a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1038,8 +1038,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { #ifdef MASA_AND_OBJECTS float spectrumModVal; + + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ - spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )]; + spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; diffEne *= spectrumModVal; #else idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); -- GitLab From da8fdcd7936d9162257b25f0edd876319cb79ae3 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 24 Mar 2023 11:59:43 +1100 Subject: [PATCH 060/591] split rendering updates --- Makefile | 2 +- Workspace_msvc/lib_rend.vcxproj | 31 +- Workspace_msvc/lib_util.vcxproj | 2 + .../split_renderer_config_384_3dof.txt | 7 + .../split_renderer_config_384_3dof_hq.txt | 7 + .../split_renderer_config_512_2dof.txt | 7 + .../split_renderer_config_768_1dof.txt | 7 + .../split_renderer_config_fc_384_3dof.txt | 7 + .../split_renderer_config_fc_384_3dof_hq.txt | 7 + .../split_renderer_config_fc_512_2dof.txt | 7 + .../split_renderer_config_fc_768_1dof.txt | 7 + .../split_renderer_config_pcm_1dof.txt | 10 + .../split_renderer_config_pcm_2dof.txt | 10 + .../split_renderer_config_pcm_3dof.txt | 10 + .../split_renderer_config_pcm_3dof_hq.txt | 10 + .../sample_split_rend_script_ivas_enc_dec.py | 138 + .../sample_split_rend_script_ivas_rend.py | 147 + .../post-renderer_pose_files/post_0static.csv | 4 + .../pre_pitch-20static.csv | 4 + .../pre_pitch20static.csv | 4 + .../pre_roll-20static.csv | 4 + .../pre_roll20static.csv | 4 + .../pre_yaw-20pitch-20static.csv | 4 + .../pre_yaw-20static.csv | 4 + .../pre_yaw20pitch20static.csv | 4 + .../pre_yaw20static.csv | 4 + apps/decoder.c | 299 +- apps/renderer.c | 675 ++- lib_com/common_api_types.h | 47 +- lib_com/delay_comp.c | 15 +- lib_com/ivas_cnst.h | 64 +- lib_com/ivas_prot.h | 83 +- lib_com/ivas_tools.c | 1 - lib_com/options.h | 26 +- lib_com/prot.h | 4 + lib_debug/debug.c | 12 +- lib_debug/debug.h | 2 +- lib_debug/mem_count.c | 2 +- lib_dec/ivas_dec.c | 44 +- lib_dec/ivas_dirac_dec.c | 9 +- lib_dec/ivas_init_dec.c | 59 +- lib_dec/ivas_mc_param_dec.c | 3 + lib_dec/ivas_rom_dec.c | 36 +- lib_dec/ivas_rom_dec.h | 18 +- lib_dec/ivas_sba_dec.c | 22 +- lib_dec/ivas_spar_decoder.c | 6 +- lib_dec/ivas_stat_dec.h | 96 +- lib_dec/lib_dec.c | 77 +- lib_dec/lib_dec.h | 11 +- lib_enc/lib_enc.c | 4 + lib_rend/ivas_CQMFDecoder.c | 1375 ++++++ lib_rend/ivas_CQMFDecoder.h | 64 + lib_rend/ivas_CQMFEncoder.c | 2050 ++++++++ lib_rend/ivas_CQMFEncoder.h | 69 + lib_rend/ivas_CQMFHuff.c | 4124 +++++++++++++++++ lib_rend/ivas_CQMFHuff.h | 350 ++ lib_rend/ivas_MSPred.c | 357 ++ lib_rend/ivas_MSPred.h | 62 + lib_rend/ivas_NoiseGen.c | 82 + lib_rend/ivas_NoiseGen.h | 68 + ...rceptualModel.c => ivas_PerceptualModel.c} | 239 +- lib_rend/ivas_PerceptualModel.h | 59 + lib_rend/ivas_PredDecoder.c | 259 ++ lib_rend/ivas_PredDecoder.h | 84 + lib_rend/ivas_PredEncoder.c | 476 ++ lib_rend/ivas_PredEncoder.h | 88 + lib_rend/ivas_PredTables.h | 53 + ...SEnvDeltaHuff.c => ivas_RMSEnvDeltaHuff.c} | 40 +- lib_rend/ivas_RMSEnvDeltaHuff.h | 57 + lib_rend/ivas_RMSEnvGrouping.c | 922 ++++ lib_rend/ivas_RMSEnvGrouping.h | 66 + lib_rend/ivas_Tables.c | 196 + lib_rend/ivas_Tables.h | 126 + lib_rend/ivas_binauralRenderer.c | 198 +- lib_rend/ivas_cldfb_codec_bitstream.c | 307 ++ lib_rend/ivas_cldfb_codec_bitstream.h | 101 + lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c | 912 ---- lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h | 32 - lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c | 1226 ----- lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h | 33 - lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c | 1457 ------ lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h | 305 -- lib_rend/ivas_cldfb_trans_codec/NoiseGen.c | 47 - lib_rend/ivas_cldfb_trans_codec/NoiseGen.h | 35 - .../ivas_cldfb_trans_codec/PerceptualModel.h | 18 - .../ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h | 25 - .../ivas_cldfb_trans_codec/RMSEnvGrouping.c | 378 -- .../ivas_cldfb_trans_codec/RMSEnvGrouping.h | 31 - lib_rend/ivas_cldfb_trans_codec/Tables.c | 116 - lib_rend/ivas_cldfb_trans_codec/Tables.h | 65 - .../cldfb_codec_bitstream.c | 226 - .../cldfb_codec_bitstream.h | 62 - lib_rend/ivas_crend.c | 213 +- lib_rend/ivas_lib_rend_internal.h | 77 +- lib_rend/ivas_output_init.c | 32 +- lib_rend/ivas_render_config.c | 9 +- lib_rend/ivas_rom_binaural_crend_head.c | 392 ++ lib_rend/ivas_rom_rend.h | 4 + lib_rend/ivas_rotation.c | 43 + lib_rend/ivas_splitRend_lcld_dec.c | 152 +- lib_rend/ivas_splitRend_lcld_enc.c | 149 +- lib_rend/ivas_splitRendererPost.c | 1715 +++++-- lib_rend/ivas_splitRendererPre.c | 1555 ++++--- lib_rend/ivas_splitRenderer_utils.c | 356 +- lib_rend/lib_rend.c | 1148 ++++- lib_rend/lib_rend.h | 19 +- lib_util/render_config_reader.c | 52 +- lib_util/split_render_file_read_write.c | 254 + lib_util/split_render_file_read_write.h | 61 + 109 files changed, 18179 insertions(+), 6959 deletions(-) create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt create mode 100644 Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py create mode 100644 Workspace_msvc/sample_split_rend_script_ivas_rend.py create mode 100644 Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv create mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv create mode 100644 lib_rend/ivas_CQMFDecoder.c create mode 100644 lib_rend/ivas_CQMFDecoder.h create mode 100644 lib_rend/ivas_CQMFEncoder.c create mode 100644 lib_rend/ivas_CQMFEncoder.h create mode 100644 lib_rend/ivas_CQMFHuff.c create mode 100644 lib_rend/ivas_CQMFHuff.h create mode 100644 lib_rend/ivas_MSPred.c create mode 100644 lib_rend/ivas_MSPred.h create mode 100644 lib_rend/ivas_NoiseGen.c create mode 100644 lib_rend/ivas_NoiseGen.h rename lib_rend/{ivas_cldfb_trans_codec/PerceptualModel.c => ivas_PerceptualModel.c} (51%) create mode 100644 lib_rend/ivas_PerceptualModel.h create mode 100644 lib_rend/ivas_PredDecoder.c create mode 100644 lib_rend/ivas_PredDecoder.h create mode 100644 lib_rend/ivas_PredEncoder.c create mode 100644 lib_rend/ivas_PredEncoder.h create mode 100644 lib_rend/ivas_PredTables.h rename lib_rend/{ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c => ivas_RMSEnvDeltaHuff.c} (61%) create mode 100644 lib_rend/ivas_RMSEnvDeltaHuff.h create mode 100644 lib_rend/ivas_RMSEnvGrouping.c create mode 100644 lib_rend/ivas_RMSEnvGrouping.h create mode 100644 lib_rend/ivas_Tables.c create mode 100644 lib_rend/ivas_Tables.h create mode 100644 lib_rend/ivas_cldfb_codec_bitstream.c create mode 100644 lib_rend/ivas_cldfb_codec_bitstream.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/NoiseGen.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/NoiseGen.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/Tables.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/Tables.h delete mode 100644 lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c delete mode 100644 lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.h create mode 100644 lib_util/split_render_file_read_write.c create mode 100644 lib_util/split_render_file_read_write.h diff --git a/Makefile b/Makefile index d5b9a8781a..141a607b07 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SRC_LIBCOM = lib_com SRC_LIBDEBUG = lib_debug SRC_LIBDEC = lib_dec SRC_LIBENC = lib_enc -SRC_LIBREND = lib_rend lib_rend/ivas_cldfb_trans_codec +SRC_LIBREND = lib_rend SRC_LIBUTIL = lib_util SRC_APP = apps BUILD = build diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 0cef2758b9..dc739ee392 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -89,7 +89,7 @@ Disabled - ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ivas_cldfb_trans_codec;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true @@ -197,23 +197,26 @@ - - - - - - - - - + + + + + + + + + + + + - + - + diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 3e269dab4b..089554b323 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -157,6 +157,7 @@ + @@ -179,6 +180,7 @@ + diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt new file mode 100644 index 0000000000..a3f6373d69 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt new file mode 100644 index 0000000000..3103a24b50 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 1; + +[GENERAL] +RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt new file mode 100644 index 0000000000..ef74dca52d --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt new file mode 100644 index 0000000000..f1d2ed8168 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt new file mode 100644 index 0000000000..ef12d462c9 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 0; + +[GENERAL] +RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt new file mode 100644 index 0000000000..56b6e2494f --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 1; + +[GENERAL] +RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt new file mode 100644 index 0000000000..6dfcbbf0f8 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt new file mode 100644 index 0000000000..2c7a780f5c --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt @@ -0,0 +1,7 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; + +[GENERAL] +RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt new file mode 100644 index 0000000000..f70f7e67ce --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 50000; +DOF = 1; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt new file mode 100644 index 0000000000..5bf2217ded --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 50000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt new file mode 100644 index 0000000000..193bc890a4 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 70000; +DOF = 3; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt new file mode 100644 index 0000000000..e559a44f33 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 70000; +DOF = 3; +HQMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py new file mode 100644 index 0000000000..4cfd0f32d1 --- /dev/null +++ b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py @@ -0,0 +1,138 @@ +from scipy.io.wavfile import read, write +from scipy import signal +import subprocess +import numpy as np +import sys +import os + +## dimension of following 2 arrays should be same, that is for each file name there should be a tag +file_names = [ +'../scripts/testv/test_HOA3.wav' +]; +file_tags = [ +'test_HOA3' +]; + +## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag +pre_hr_file_names = [ +'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' +]; +post_hr_file_names = [ +'trajectories/post-renderer_pose_files/post_0static.csv' +]; +hr_file_tags = [ +'yaw20static' +]; + +renderers = [ +('fast_conv_768_1dof', 'renderer_configs/split_renderer_config_fc_768_1dof.txt', '0'), +('fast_conv_512_2dof', 'renderer_configs/split_renderer_config_fc_512_2dof.txt', '0'), +('fast_conv_384_3dof', 'renderer_configs/split_renderer_config_fc_384_3dof.txt', '0'), +('fast_conv_384_3dof_hq', 'renderer_configs/split_renderer_config_fc_384_3dof_hq.txt', '0')]; + + +split_rend_file_outs = ['recons_out_pos0.wav', + 'recons_out_pos1.wav', + 'recons_out_pos2.wav', + 'rotated_ref_pos0.wav', + 'rotated_ref_pos1.wav', + 'rotated_ref_pos2.wav', + 'rotated_ref_RefPos.wav', + 'split_rend_MD_bitrate.txt'] + +def check_and_makedir(dir_path): + if not os.path.exists(dir_path): + try: + os.makedirs(dir_path) + except OSError as e: + if e.errno != errno.EEXIST: + raise # raises the error again + + +def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): + check_and_makedir(out_dir); + for idx in range(0, len(file_tags)): + for hr_idx in range(0, len(hr_file_tags)): + for rend in range(0, len(renderers)): + bitrate = '384000'; + filename = file_names[idx]; + file_in = os.path.join(file_dir, filename); + enc_exe = os.path.join(exe_dir, 'IVAS_cod.exe'); + dec_exe = os.path.join(exe_dir, 'IVAS_dec.exe'); + rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); + file_pkt_name = '_'.join([file_tags[idx], bitrate, 'out.pkt']); + file_pkt = os.path.join(out_dir, file_pkt_name); + file_out_name = '_'.join([file_tags[idx], bitrate, renderers[rend][0], 'out.wav']); + file_out = os.path.join(out_dir, file_out_name); + bs_file_out_name = '_'.join([file_tags[idx], '_ivas_dec_out.pkt']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + + print(file_in) + print(file_pkt) + print(bs_file_out) + print(file_out) + + enc_cmd = [ + enc_exe, + '-sba', '3', + '-max_band', 'FB', + bitrate, + '48', + file_in, + file_pkt + ] + + hr_pre_file_name = pre_hr_file_names[hr_idx]; + hr_pre_file = os.path.join(file_dir, hr_pre_file_name); + hr_post_file_name = post_hr_file_names[hr_idx]; + hr_post_file = os.path.join(file_dir, hr_post_file_name); + + dec_cmd = [ + dec_exe, + '-RENDER_CONFIG', renderers[rend][1], + '-t', hr_pre_file, + 'SPLIT_BINAURAL', + '48', + file_pkt, + bs_file_out + ] + print(enc_cmd) + print(dec_cmd) + test_status = subprocess.call(enc_cmd, shell=False) + test_status = subprocess.call(dec_cmd, shell=False) + + post_rend_cmd = [ + rend_exe, + '-i', bs_file_out, + '-if', 'BINAURAL_SPLIT_CLDFB', + '-o', file_out, + '-of', 'BINAURAL', + '-fs', '48', + '-tf', hr_post_file, + ] + print(post_rend_cmd) + test_status = subprocess.call(post_rend_cmd, shell=False) + + if os.path.isfile(file_pkt): + os.remove(file_pkt) + + if os.path.exists(bs_file_out): + os.remove(bs_file_out); + + for fo in split_rend_file_outs: + file_old = os.path.join(os. getcwd(), fo); + file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], fo]); + file_new = os.path.join(out_dir, file_out_name); + if os.path.exists(file_old): + os.rename(file_old, file_new); + + +def main(argv): + print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') + if len(argv) < 3: + return print(len(argv)) + return generate_split_rend_lis_items(*argv[1:]) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend.py b/Workspace_msvc/sample_split_rend_script_ivas_rend.py new file mode 100644 index 0000000000..c6ccd8e422 --- /dev/null +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend.py @@ -0,0 +1,147 @@ +from scipy.io.wavfile import read, write +from scipy import signal +import subprocess +import numpy as np +import sys +import os + +## dimension of following 2 arrays should be same, that is for each file name there should be a tag +file_names = [ +'../scripts/testv/test_HOA3.wav' +]; +file_tags = [ +'test_HOA3' +]; + +## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag +pre_hr_file_names = [ +'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' +]; +post_hr_file_names = [ +'trajectories/post-renderer_pose_files/post_0static.csv' +]; +hr_file_tags = [ +'yaw20static' +]; + +renderers = [ +('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), +('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), +('fast_conv_768_1dof', 'renderer_configs/split_renderer_config_fc_768_1dof.txt', '0'), +('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), +('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), +('fast_conv_512_2dof', 'renderer_configs/split_renderer_config_fc_512_2dof.txt', '0'), +('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), +('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), +('fast_conv_384_3dof', 'renderer_configs/split_renderer_config_fc_384_3dof.txt', '0'), +('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), +('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), +('fast_conv_384_3dof_hq', 'renderer_configs/split_renderer_config_fc_384_3dof_hq.txt', '0')]; + +split_md_file_name = 'split_md.bin'; + +split_rend_file_outs = ['recons_out_pos0.wav', + 'recons_out_pos1.wav', + 'recons_out_pos2.wav', + 'rotated_ref_pos0.wav', + 'rotated_ref_pos1.wav', + 'rotated_ref_pos2.wav', + 'rotated_ref_RefPos.wav', + 'split_rend_MD_bitrate.txt'] + + +def check_and_makedir(dir_path): + if not os.path.exists(dir_path): + try: + os.makedirs(dir_path) + except OSError as e: + if e.errno != errno.EEXIST: + raise # raises the error again + + +def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): + check_and_makedir(out_dir); + for idx in range(0, len(file_tags)): + for hr_idx in range(0, len(hr_file_tags)): + for rend in range(0, len(renderers)): + filename = file_names[idx]; + file_in = os.path.join(file_dir, filename); + rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); + if renderers[rend][2] == '0': + bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_CLDFB'; + else: + bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_PCM'; + md_out_arg = ['-om', split_md_file_name]; + md_in_arg = ['-im', split_md_file_name]; + file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); + file_out = os.path.join(out_dir, file_out_name); + + print(file_in) + print(bs_file_out) + print(file_out) + + hr_pre_file_name = pre_hr_file_names[hr_idx]; + hr_pre_file = os.path.join(file_dir, hr_pre_file_name); + hr_post_file_name = post_hr_file_names[hr_idx]; + hr_post_file = os.path.join(file_dir, hr_post_file_name); + + pre_rend_cmd = [ + rend_exe, + '-rc', renderers[rend][1], + md_out_arg[0], md_out_arg[1], + '-i', file_in, + '-if', 'HOA3', + '-o', bs_file_out, + '-of', out_fmt, + '-fs', '48', + '-tf', hr_pre_file, + ] + + + print(pre_rend_cmd) + test_status = subprocess.call(pre_rend_cmd, shell=False) + + + post_rend_cmd = [ + rend_exe, + md_in_arg[0], md_in_arg[1], + '-i', bs_file_out, + '-if', out_fmt, + '-o', file_out, + '-of', 'BINAURAL', + '-fs', '48', + '-tf', hr_post_file, + ] + + + print(post_rend_cmd) + test_status = subprocess.call(post_rend_cmd, shell=False) + + if os.path.exists(bs_file_out): + os.remove(bs_file_out); + + if os.path.exists(split_md_file_name): + os.remove(split_md_file_name); + + + for fo in split_rend_file_outs: + file_old = os.path.join(os. getcwd(), fo); + file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); + file_new = os.path.join(out_dir, file_out_name); + if os.path.exists(file_old): + os.rename(file_old, file_new); + + +def main(argv): + print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') + if len(argv) < 3: + return print(len(argv)) + return generate_split_rend_lis_items(*argv[1:]) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv b/Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv new file mode 100644 index 0000000000..a292a3576c --- /dev/null +++ b/Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv @@ -0,0 +1,4 @@ +-3,0,0,0 +-3,0,0,0 +-3,0,0,0 +-3,0,0,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv new file mode 100644 index 0000000000..dab3c6940a --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv @@ -0,0 +1,4 @@ +-3,0,-20,0 +-3,0,-20,0 +-3,0,-20,0 +-3,0,-20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv new file mode 100644 index 0000000000..ae6ac9cd9c --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv @@ -0,0 +1,4 @@ +-3,0,20,0 +-3,0,20,0 +-3,0,20,0 +-3,0,20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv new file mode 100644 index 0000000000..5db0b1cab3 --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv @@ -0,0 +1,4 @@ +-3,0,0,-20 +-3,0,0,-20 +-3,0,0,-20 +-3,0,0,-20 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv new file mode 100644 index 0000000000..5bd8c2c4d9 --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv @@ -0,0 +1,4 @@ +-3,0,0,20 +-3,0,0,20 +-3,0,0,20 +-3,0,0,20 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv new file mode 100644 index 0000000000..e48c0a58f5 --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv @@ -0,0 +1,4 @@ +-3,-20,-20,0 +-3,-20,-20,0 +-3,-20,-20,0 +-3,-20,-20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv new file mode 100644 index 0000000000..6e446847a9 --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv @@ -0,0 +1,4 @@ +-3,-20,0,0 +-3,-20,0,0 +-3,-20,0,0 +-3,-20,0,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv new file mode 100644 index 0000000000..58788cc7de --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv @@ -0,0 +1,4 @@ +-3,20,20,0 +-3,20,20,0 +-3,20,20,0 +-3,20,20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv new file mode 100644 index 0000000000..2d674f971b --- /dev/null +++ b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv @@ -0,0 +1,4 @@ +-3,20,0,0 +-3,20,0,0 +-3,20,0,0 +-3,20,0,0 diff --git a/apps/decoder.c b/apps/decoder.c index 29d0e17119..1bd6168c96 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -57,6 +57,9 @@ #include "debug.h" #endif #include "render_config_reader.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "split_render_file_read_write.h" +#endif #define WMC_TOOL_MAN @@ -72,18 +75,19 @@ static #define MIN_NUM_BITS_ACTIVE_FRAME 56 #define NUM_BITS_SID_IVAS_5K2 104 -#define MAX_FRAME_SIZE ( 48000 / 50 ) +#define NUM_FRAMES_PER_SEC 50 +#define MAX_FRAME_SIZE ( 48000 / NUM_FRAMES_PER_SEC ) #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) #ifdef SPLIT_REND_WITH_HEAD_ROT -#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( 3750 ) /*temp buffer size for 1.5 mbps*/ +#define MAX_SPLIT_REND_BITRATE ( 768000 ) +#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #endif #define IVAS_PUBLIC_ORIENT_TRK_REF 0 #define IVAS_PUBLIC_ORIENT_TRK_AVG 1 - typedef struct { char *inputBitstreamFilename; @@ -119,11 +123,6 @@ typedef struct FILE *agcBitstream; /* temporary */ #endif #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_MODE splitRendMode; - char *postRendheadrotTrajFileName; -#endif - } DecArguments; @@ -135,7 +134,6 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, #ifdef SPLIT_REND_WITH_HEAD_ROT - HeadRotFileReader *postRendheadRotReader, uint8_t *splitRendBitsBuf, #endif IVAS_DEC_HANDLE hIvasDec, @@ -199,9 +197,6 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT - HeadRotFileReader *postRendheadRotReader = NULL; -#endif ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -303,16 +298,6 @@ int main( goto cleanup; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.splitRendMode == SPLIT_REND_COMB ) - { - if ( ( error = HeadRotationFileReader_open( arg.postRendheadrotTrajFileName, &postRendheadRotReader ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: Can't open post renderer head-rotation file %s \n\n", arg.postRendheadrotTrajFileName ); - goto cleanup; - } - } -#endif /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file @@ -343,20 +328,17 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ - -#ifdef DEBUGGING - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, #ifdef SPLIT_REND_WITH_HEAD_ROT - arg.splitRendMode, + if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) + { + arg.enableHeadRotation = true; + } #endif +#ifdef DEBUGGING + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK ) #else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - arg.enableSplitRendWithHeadRot -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -459,11 +441,19 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) && ( arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) + { + fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output OR when Split rendering mode is enabled. Exiting. \n" ); + exit( -1 ); + } +#else if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n\n" ); goto cleanup; } +#endif if ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK ) { @@ -547,7 +537,7 @@ int main( { error = decodeG192( arg, hBsReader, headRotReader, #ifdef SPLIT_REND_WITH_HEAD_ROT - postRendheadRotReader, splitRendBitsBuf, + splitRendBitsBuf, #endif hIvasDec, pcmBuf ); } @@ -596,9 +586,6 @@ cleanup: CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - HeadRotationFileReader_close( &postRendheadRotReader ); -#endif RenderConfigReader_close( &renderConfigReader ); if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) @@ -697,6 +684,12 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( { output_config = IVAS_DEC_OUTPUT_BINAURAL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( strcmp( argv_to_upper, "SPLIT_BINAURAL" ) == 0 ) + { + output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB; + } +#endif else if ( strcmp( argv_to_upper, "BINAURAL_ROOM" ) == 0 ) { output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM; @@ -709,44 +702,6 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( return output_config; } - -#ifdef SPLIT_REND_WITH_HEAD_ROT -static int8_t parseSplitRendMode( - char *value, - IVAS_SPLIT_REND_MODE *SplitRendMode ) -{ - int16_t temp; - int8_t success; - success = 1; - to_upper( value ); - - temp = (int16_t) atoi( value ); - if ( temp == 0 ) - { - *SplitRendMode = SPLIT_REND_DISABLED; - } -#if 0 - else if ( temp == 1 ) - { - *SplitRendMode = SPLIT_REND_PRE; - } - else if ( temp == 2 ) - { - *SplitRendMode = SPLIT_REND_POST; - } -#endif - else if ( temp == 3 ) - { - *SplitRendMode = SPLIT_REND_COMB; - } - else - { - fprintf( stderr, "Error: Incorrect or unsupported value for split rendering mode specified!\n\n" ); - success = 0; - } - return success ? 0 : -1; -} -#endif /*---------------------------------------------------------------------* * parseCmdlIVAS_dec() * @@ -779,9 +734,6 @@ static bool parseCmdlIVAS_dec( arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT - arg->postRendheadrotTrajFileName = NULL; -#endif arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; @@ -805,10 +757,6 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->no_diegetic_pan = 0.f; -#ifdef SPLIT_REND_WITH_HEAD_ROT - arg->splitRendMode = SPLIT_REND_DISABLED; -#endif - /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -960,41 +908,6 @@ static bool parseCmdlIVAS_dec( arg->headrotTrajFileName = argv[i]; i++; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( strcmp( argv_to_upper, "-SBRM" ) == 0 ) - { - i++; - - if ( argc - i <= 4 || argv[i][0] == '-' ) - { - fprintf( stderr, "Error: Head rotation file name not specified!\n\n" ); - usage_dec(); - return false; - } - if ( parseSplitRendMode( argv[i], &arg->splitRendMode ) != 0 ) - { - fprintf( stderr, "Error: Invalid split rendering mode %s \n\n", argv[i] ); - usage_dec(); - return false; - } - i++; - } - else if ( strcmp( argv_to_upper, "-PRTF" ) == 0 ) - { - arg->enableHeadRotation = true; - i++; - - if ( argc - i <= 4 || argv[i][0] == '-' ) - { - fprintf( stderr, "Error: Head rotation file name not specified!\n\n" ); - usage_dec(); - return false; - } - - arg->postRendheadrotTrajFileName = argv[i]; - i++; - } -#endif else if ( strcmp( argv_to_upper, "-OTR" ) == 0 ) { if ( strlen( argv[i + 1] ) > 3 ) @@ -1171,8 +1084,13 @@ static void usage_dec( void ) fprintf( stdout, "Mandatory parameters:\n" ); fprintf( stdout, "---------------------\n" ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); + fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM, SPLIT_BINAURAL, EXT\n" ); +#else fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM, EXT\n" ); +#endif fprintf( stdout, " By default, channel order and loudspeaker positions are equal to the\n" ); fprintf( stdout, " encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker\n" ); fprintf( stdout, " layout file. See readme.txt for details.\n" ); @@ -1203,10 +1121,6 @@ static void usage_dec( void ) fprintf( stdout, " which of the two supported formats is in use.\n" ); fprintf( stdout, " default bitstream file format is G.192\n" ); fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - fprintf( stdout, "-sbrm mode : split rendering mode (0 - disabled, 1 - PRE RENDERER, 2 - POST RENDERER, 3 - COMBINED PRE-POST RENDERING), by default disabled\n" ); - fprintf( stdout, "-prtf File : Head rotation for post renderer specified by external trajectory File (to be used with split rendering)\n" ); -#endif fprintf( stdout, "-hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration\n" ); #ifdef DEBUGGING fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" ); @@ -1255,7 +1169,6 @@ static ivas_error decodeG192( BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, #ifdef SPLIT_REND_WITH_HEAD_ROT - HeadRotFileReader *postRendheadRotReader, uint8_t *splitRendBitsBuf, #endif IVAS_DEC_HANDLE hIvasDec, @@ -1285,6 +1198,9 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_BITS splitRendBits; + SplitFileReadWrite *hSplitRendFileReadWrite; + int16_t delayNumSamples_temp; + int32_t delayTimeScale_temp; #endif IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; @@ -1313,6 +1229,7 @@ static ivas_error decodeG192( splitRendBits.bits_read = 0; splitRendBits.bits_written = 0; splitRendBits.buf_len = MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES; + hSplitRendFileReadWrite = NULL; #endif /*------------------------------------------------------------------------------------------* @@ -1362,40 +1279,36 @@ static ivas_error decodeG192( if ( arg.enableHeadRotation ) { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - - if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( headRotReader == NULL ) { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; + for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + Quaternions[i].w = -3.0f; + Quaternions[i].x = 0.0f; + Quaternions[i].y = 0.0f; + Quaternions[i].z = 0.0f; + } + } + else +#endif + { + if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; + } } - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions #ifdef SPLIT_REND_WITH_HEAD_ROT , - SPLIT_REND_PRE + DEFAULT_AXIS #endif ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } - -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.splitRendMode == SPLIT_REND_COMB ) - { - if ( ( error = HeadRotationFileReading( postRendheadRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading post rendering head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, SPLIT_REND_POST ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } -#endif } /* Run decoder for one frame (get rendered output) */ @@ -1437,11 +1350,27 @@ static ivas_error decodeG192( goto cleanup; } - /* Open audio writer and write all previously skipped bad frames now that frame size is known */ - if ( ( error = AudioFileWriter_open( &afWriter, arg.outputWavFilename, arg.output_Fs, nOutChannels ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) { - fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); - goto cleanup; + IVAS_DEC_GetDelay( hIvasDec, &delayNumSamples_temp, &delayTimeScale_temp ); + error = split_rend_writer_open( &hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp, delayTimeScale_temp ); + if ( error != IVAS_ERR_OK ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); + exit( -1 ); + } + afWriter = NULL; + } + else +#endif + { + /* Open audio writer and write all previously skipped bad frames now that frame size is known */ + if ( ( error = AudioFileWriter_open( &afWriter, arg.outputWavFilename, arg.output_Fs, nOutChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); + goto cleanup; + } } int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); @@ -1449,18 +1378,34 @@ static ivas_error decodeG192( for ( i = 0; i < numInitialBadFrames; ++i ) { - if ( delayNumSamples < nOutSamples ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hSplitRendFileReadWrite != NULL ) { - if ( ( error = AudioFileWriter_write( afWriter, zeroBuf, nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) + IVAS_SPLIT_REND_BITS splitRendBitsZero; + splitRendBitsZero.bits_written = 0; + splitRendBitsZero.bits_read = 0; + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; + fprintf( stderr, "\nUnable to write to bitstream file!\n" ); + exit( -1 ); } - delayNumSamples = 0; } else +#endif { - delayNumSamples -= nOutSamples; + if ( delayNumSamples < nOutSamples ) + { + if ( ( error = AudioFileWriter_write( afWriter, zeroBuf, nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + goto cleanup; + } + delayNumSamples = 0; + } + else + { + delayNumSamples -= nOutSamples; + } } } @@ -1569,18 +1514,31 @@ static ivas_error decodeG192( /* Write current frame */ if ( decodedGoodFrame ) { - if ( delayNumSamples < nOutSamples ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hSplitRendFileReadWrite != NULL ) { - if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; + fprintf( stderr, "\nUnable to write to bitstream file!\n" ); + exit( -1 ); } - delayNumSamples = 0; } else +#endif { - delayNumSamples -= nOutSamples; + if ( delayNumSamples < nOutSamples ) + { + if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + goto cleanup; + } + delayNumSamples = 0; + } + else + { + delayNumSamples -= nOutSamples; + } } } @@ -1678,10 +1636,13 @@ static ivas_error decodeG192( /* add zeros at the end to have equal length of synthesized signals */ memset( pcmBuf, 0, zeroPad * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, zeroPad * nOutChannels ) ) != IVAS_ERR_OK ) + if ( afWriter != NULL ) { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; + if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, zeroPad * nOutChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + goto cleanup; + } } /*------------------------------------------------------------------------------------------* @@ -1691,8 +1652,16 @@ static ivas_error decodeG192( decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ cleanup: - - AudioFileWriter_close( &afWriter ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hSplitRendFileReadWrite != NULL ) + { + split_rend_reader_writer_close( &hSplitRendFileReadWrite ); + } + if ( afWriter != NULL ) +#endif + { + AudioFileWriter_close( &afWriter ); + } MasaFileWriter_close( &masaWriter ); for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) { diff --git a/apps/renderer.c b/apps/renderer.c index 1fc6a5bad5..34b2b32f53 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -44,6 +44,9 @@ #include "masa_file_reader.h" #include "prot.h" #include "render_config_reader.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "split_render_file_read_write.h" +#endif #ifdef WMOPS #include "PROM_Size_lib_rend.h" #include "wmops.h" @@ -164,6 +167,10 @@ typedef struct IVAS_CUSTOM_LS_DATA inSetupCustom; RendererInput masaBuses[RENDERER_MAX_MASA_INPUTS]; uint16_t numMasaBuses; +#ifdef SPLIT_REND_WITH_HEAD_ROT + RendererInput binBuses[RENDERER_MAX_BIN_INPUTS]; + uint16_t numBinBuses; +#endif } InputConfig; typedef struct @@ -182,11 +189,10 @@ typedef struct OutputConfig outConfig; char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; - char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_MODE splitRendMode; - char postRendheadRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; + char outMetadataFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #endif + char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientationTracking; @@ -216,8 +222,7 @@ typedef enum CmdLnOptionId_listFormats, CmdLnOptionId_inputGain, #ifdef SPLIT_REND_WITH_HEAD_ROT - CmdLnOptionId_SplitRendMode, - CmdLnOptionId_PostRendtrajFile, + CmdLnOptionId_outputMetadata, #endif } CmdLnOptionId; @@ -238,7 +243,11 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_inputMetadata, .match = "input_metadata", .matchShort = "im", +#ifdef SPLIT_REND_WITH_HEAD_ROT + .description = "Space-separated list of path to metadata files for ISM or MASA inputs or BINAURAL_SPLIT_PCM input mode", +#else .description = "Space-separated list of path to metadata files for ISM or MASA inputs", +#endif }, { .id = CmdLnOptionId_outputFile, @@ -262,20 +271,18 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_trajFile, .match = "trajectory_file", .matchShort = "tf", +#ifdef SPLIT_REND_WITH_HEAD_ROT + .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL, BINAURAL_SPLIT_PCM, BINAURAL_SPLIT_CLDFB and BINAURAL_ROOM outputs)", +#else .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", +#endif }, #ifdef SPLIT_REND_WITH_HEAD_ROT { - .id = CmdLnOptionId_SplitRendMode, - .match = "split_bin_rend_mode", - .matchShort = "sbrm", - .description = "Split rendering mode option (only for BINAURAL and BINAURAL_ROOM outputs)", - }, - { - .id = CmdLnOptionId_PostRendtrajFile, - .match = "post_rend_trajectory_file", - .matchShort = "prtf", - .description = "Split rendering option with head tracking data for post renderer (only for BINAURAL and BINAURAL_ROOM outputs)", + .id = CmdLnOptionId_outputMetadata, + .match = "output_metadata", + .matchShort = "om", + .description = "coded metadata file for BINAURAL_SPLIT_PCM output mode", }, #endif { @@ -435,8 +442,13 @@ static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSa #endif ); -static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer ); - +static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t cldfb_in, + HANDLE_CLDFB_FILTER_BANK *cldfbSyn +#endif +); static IVAS_REND_ReadOnlyAudioBuffer getReadOnlySubBuffer( IVAS_REND_AudioBuffer buffer, const int16_t chBeginIdx, const int16_t numChannels ) { @@ -454,7 +466,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] ) + IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS], +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS] +#endif +) { int16_t totalNumInChannels = 0; int16_t i, numInputChannels; @@ -525,6 +541,24 @@ static int16_t getTotalNumInChannels( totalNumInChannels += numInputChannels; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) + { + if ( splitBinIds[i] == 0 ) + { + /* Skip inactive inputs */ + continue; + } + + if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numInputChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + totalNumInChannels += numInputChannels; + } +#endif + return totalNumInChannels; } @@ -532,7 +566,12 @@ static void setupWithSingleFormatInput( CmdlnArgs args, char *audioFilePath, IsmPositionProvider *positionProvider, - MasaFileReader **masaReaders ) + MasaFileReader **masaReaders +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + SplitFileReadWrite **hhSplitRendFileReadWrite +#endif +) { /* With single-format input, inputFilePath is the path to input audio file. */ strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 ); @@ -578,6 +617,22 @@ static void setupWithSingleFormatInput( } } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( args.inConfig.numBinBuses != 0 ) + { + *hhSplitRendFileReadWrite = NULL; + if ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + ivas_error error; + error = split_rend_reader_open( hhSplitRendFileReadWrite, args.inMetadataFilePaths[0] ); + if ( error != IVAS_ERR_OK ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] ); + exit( -1 ); + } + } + } +#endif } static float dBToLin( @@ -589,7 +644,9 @@ static float dBToLin( #ifdef SPLIT_REND_WITH_HEAD_ROT static int16_t rend_openCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], + HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS], const int16_t num_in_chs, + const int16_t num_out_chs, const int32_t output_Fs ) { int16_t n; @@ -601,10 +658,26 @@ static int16_t rend_openCldfb( return -1; } } + for ( ; n < MAX_INPUT_CHANNELS; n++ ) + { + cldfbAna[n] = NULL; + } + + for ( n = 0; n < num_out_chs; n++ ) + { + if ( openCldfb( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) != IVAS_ERR_OK ) + { + return -1; + } + } + for ( ; n < MAX_INPUT_CHANNELS; n++ ) + { + cldfbSyn[n] = NULL; + } return 0; } -static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS] ) +static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS] ) { int16_t n; for ( n = 0; n < MAX_INPUT_CHANNELS; n++ ) @@ -614,21 +687,59 @@ static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNEL deleteCldfb( &( cldfbAna[n] ) ); cldfbAna[n] = NULL; } + + if ( cldfbSyn[n] != NULL ) + { + deleteCldfb( &( cldfbSyn[n] ) ); + cldfbSyn[n] = NULL; + } } return; } -static int16_t get_cldfb_in_flag( CmdlnArgs *args ) +static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig ) { int16_t cldfb_in; cldfb_in = 0; - if ( ( args->splitRendMode == SPLIT_REND_PRE ) || ( args->splitRendMode == SPLIT_REND_COMB ) ) + if ( renderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { +#ifdef DEBUGGING cldfb_in = 1; +#endif + if ( ( audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) + { + cldfb_in = 1; + } } return cldfb_in; } + +static int16_t is_split_post_rend_mode( CmdlnArgs *args ) +{ + int16_t flag; + flag = 0; + if ( ( args->inConfig.numBinBuses > 0 ) && + ( ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) ) + { + flag = 1; + } + + return flag; +} + +static int16_t is_split_pre_rend_mode( CmdlnArgs *args ) +{ + int16_t flag; + flag = 0; + if ( ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + flag = 1; + } + + return flag; +} #endif /* ============================================================================ */ @@ -640,9 +751,9 @@ int main( IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT - HeadRotFileReader *postRendHeadRotReader = NULL; HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS]; - int16_t cldfb_in; + HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS]; + int16_t cldfb_in, CLDFBframeSize_smpls; #endif hrtfFileReader *hrtfFileReader = NULL; IsmPositionProvider *positionProvider; @@ -654,12 +765,24 @@ int main( AudioFileWriter *audioWriter; int32_t inBufferSize; int32_t outBufferSize; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int32_t bitsBufferSize; +#endif int16_t *inpInt16Buffer; float *inFloatBuffer; int16_t *outInt16Buffer; float *outFloatBuffer; +#ifdef SPLIT_REND_WITH_HEAD_ROT + uint8_t *bitsBufferData; +#endif IVAS_REND_AudioBuffer inBuffer; IVAS_REND_AudioBuffer outBuffer; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_REND_BitstreamBuffer bitsBuffer; + SplitFileReadWrite *hSplitRendFileReadWrite; + int16_t delayNumSamples_temp; + int32_t delayTimeScale_temp; +#endif int16_t numSamplesRead; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig = 0; @@ -686,6 +809,10 @@ int main( hMasaMetadata[i] = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + hSplitRendFileReadWrite = NULL; +#endif + CmdlnArgs args = parseCmdlnArgs( argc, argv ); positionProvider = IsmPositionProvider_open(); @@ -699,13 +826,6 @@ int main( HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( args.splitRendMode == SPLIT_REND_COMB ) && !isEmptyString( args.postRendheadRotationFilePath ) ) - { - HeadRotationFileReader_open( args.postRendheadRotationFilePath, &postRendHeadRotReader ); - } -#endif - if ( !isEmptyString( args.customHrtfFilePath ) ) { hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ); @@ -725,15 +845,37 @@ int main( else { /* With single-format input, all information is given on command line. */ - setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders ); + setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + &hSplitRendFileReadWrite +#endif + ); } int32_t inFileSampleRate = 0; - if ( AudioFileReader_open( &audioReader, audioFilePath, &inFileSampleRate ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*if split renderer is running in post renderer mode*/ + if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); + error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath ); + if ( error != IVAS_ERR_OK ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath ); + exit( -1 ); + } + audioReader = NULL; + } + else +#endif + { + if ( AudioFileReader_open( &audioReader, audioFilePath, &inFileSampleRate ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", audioFilePath ); + exit( -1 ); + } } + if ( args.sampleRate == 0 && inFileSampleRate == 0 ) { fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); @@ -750,22 +892,22 @@ int main( } const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); +#ifndef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT const int16_t CLDFBframeSize_smpls = (int16_t) frameSize_smpls * 2; cldfb_in = get_cldfb_in_flag( &args ); +#endif #endif IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] = { 0 }; IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 }; - - if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig #ifdef SPLIT_REND_WITH_HEAD_ROT - , - args.splitRendMode + IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS] = { 0 }; #endif - ) ) != IVAS_ERR_OK ) + + if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -777,16 +919,30 @@ int main( exit( -1 ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + CLDFBframeSize_smpls = 0; + cldfb_in = 0; +#endif + if ( args.renderConfigFilePath[0] != '\0' ) { IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && !is_split_pre_rend_mode( &args ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) + { + fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output OR when Split pre-rendering mode is enabled. Exiting. \n" ); + exit( -1 ); + } +#else if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" ); exit( -1 ); } +#endif + if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) { @@ -805,8 +961,16 @@ int main( fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); exit( -1 ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( !is_split_post_rend_mode( &args ) ) + { + CLDFBframeSize_smpls = frameSize_smpls * 2; + cldfb_in = get_cldfb_in_flag( args.outConfig.audioConfig, &renderConfig ); + } +#endif } + /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { @@ -872,6 +1036,23 @@ int main( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < args.inConfig.numBinBuses; ++i ) + { + if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.binBuses[i].audioConfig, &splitBinIds[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + if ( ( error = IVAS_REND_SetInputGain( hIvasRend, splitBinIds[i], args.inputGainGlobal * dBToLin( args.inConfig.binBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } +#endif + for ( i = 0; i < args.inConfig.numMasaBuses; ++i ) { if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK ) @@ -887,15 +1068,14 @@ int main( } } - const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds ); + const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( cldfb_in ) - { - rend_openCldfb( cldfbAna, totalNumInChannels, args.sampleRate ); - } + , + splitBinIds #endif + ); - if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */ + if ( ( audioReader != NULL ) && AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */ && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) ) { fprintf( stderr, "Number of channels in input file does not match selected configuration\n" ); @@ -916,11 +1096,48 @@ int main( fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } - if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( cldfb_in ) { - fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); - exit( -1 ); + rend_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ); + } +#endif + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ); + error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp ); + if ( error != IVAS_ERR_OK ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", args.outputFilePath ); + exit( -1 ); + } + audioWriter = NULL; } + else + { + if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ); + error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp ); + if ( error != IVAS_ERR_OK ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", args.outMetadataFilePath ); + exit( -1 ); + } + } +#endif + if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); + exit( -1 ); + } +#ifdef SPLIT_REND_WITH_HEAD_ROT + } +#endif + #ifdef DEC_TO_REND_FLOAT_DUMP printf( "Warning: Renderer executable built with DEC_TO_REND_FLOAT_DUMP enabled!\n" ); printf( " Float dump file (./float_out.wav) will be forced as input.\n" ); @@ -928,23 +1145,41 @@ int main( inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( is_split_pre_rend_mode( &args ) || is_split_post_rend_mode( &args ) ) + { + bitsBufferSize = (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC; + bitsBufferSize = ( bitsBufferSize + 7 ) >> 3; + } + else + { + bitsBufferSize = 0; + } + +#endif + inpInt16Buffer = count_malloc( inBufferSize * sizeof( int16_t ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in == 0 ) { inFloatBuffer = count_malloc( inBufferSize * sizeof( float ) ); inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; + outFloatBuffer = count_malloc( outBufferSize * sizeof( float ) ); + outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; } else { inFloatBuffer = count_malloc( CLDFBframeSize_smpls * totalNumInChannels * sizeof( float ) ); inBuffer.config.numSamplesPerChannel = (int16_t) CLDFBframeSize_smpls; + outFloatBuffer = count_malloc( CLDFBframeSize_smpls * totalNumInChannels * sizeof( float ) ); + outBuffer.config.numSamplesPerChannel = (int16_t) CLDFBframeSize_smpls; } #else inFloatBuffer = count_malloc( inBufferSize * sizeof( float ) ); + outFloatBuffer = count_malloc( outBufferSize * sizeof( float ) ); + outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; #endif outInt16Buffer = count_malloc( outBufferSize * sizeof( int16_t ) ); - outFloatBuffer = count_malloc( outBufferSize * sizeof( float ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT inBuffer.config.is_cldfb = cldfb_in; @@ -952,10 +1187,31 @@ int main( inBuffer.config.numChannels = (int16_t) totalNumInChannels; inBuffer.data = inFloatBuffer; - outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; +#ifdef SPLIT_REND_WITH_HEAD_ROT + outBuffer.config.is_cldfb = cldfb_in; +#endif outBuffer.config.numChannels = (int16_t) numOutChannels; outBuffer.data = outFloatBuffer; + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( bitsBufferSize > 0 ) + { + bitsBufferData = count_malloc( bitsBufferSize * sizeof( uint8_t ) ); + } + else + { + bitsBufferData = NULL; + } + +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + bitsBuffer.bits = bitsBufferData; + bitsBuffer.config.bitsRead = 0; + bitsBuffer.config.bitsWritten = 0; + bitsBuffer.config.bufLenInBytes = bitsBufferSize; +#endif + #ifdef WMOPS reset_wmops(); #endif @@ -975,11 +1231,35 @@ int main( int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; - /* Read the input data */ - if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + numSamplesRead = 0; + if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) ) { - fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); - exit( -1 ); + ivas_error error_tmp; + numSamplesRead = (int16_t) inBufferSize; + error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); + if ( error_tmp != IVAS_ERR_OK ) + { + if ( error_tmp == IVAS_ERR_END_OF_FILE ) + { + numSamplesRead = 0; + } + else + { + fprintf( stderr, "\nUnable to read from bitstream file!\n" ); + exit( -1 ); + } + } + } + if ( audioReader != NULL ) +#endif + { + /* Read the input data */ + if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); + exit( -1 ); + } } if ( numSamplesRead == 0 ) @@ -1022,7 +1302,7 @@ int main( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer #ifdef SPLIT_REND_WITH_HEAD_ROT , - SPLIT_REND_PRE + DEFAULT_AXIS #endif ); } @@ -1031,21 +1311,11 @@ int main( IVAS_REND_SetHeadRotation( hIvasRend, NULL #ifdef SPLIT_REND_WITH_HEAD_ROT , - SPLIT_REND_PRE + DEFAULT_AXIS #endif ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* Read from post renderer head rotation trajectory file if specified */ - if ( postRendHeadRotReader != NULL ) - { - IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; - HeadRotationFileReading( postRendHeadRotReader, quatBuffer, frame ); - IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, SPLIT_REND_POST ); - } -#endif - for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) @@ -1122,25 +1392,65 @@ int main( } } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < args.inConfig.numBinBuses; ++i ) + { + if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.binBuses[i].inputChannelIndex, numChannels ); + + if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, splitBinIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } +#endif - IVAS_REND_GetSamples( hIvasRend, outBuffer ); + IVAS_REND_GetSamples( hIvasRend, outBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + &bitsBuffer +#endif + ); int16_t num_out_channels; num_out_channels = outBuffer.config.numChannels; /* Convert from float to int and from packed to interleaved. * Values in outFloatBuffer are guaranteed to be within range INT16_MIN:INT16_MAX */ - convertOutputBuffer( outFloatBuffer, frameSize_smpls, num_out_channels, outInt16Buffer ); + convertOutputBuffer( outFloatBuffer, outBuffer.config.numSamplesPerChannel, num_out_channels, outInt16Buffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + cldfb_in, + cldfbSyn +#endif + ); if ( delayNumSamples == -1 ) { - if ( args.delayCompensationEnabled ) + if ( args.delayCompensationEnabled +#ifdef SPLIT_REND_WITH_HEAD_ROT + && !is_split_pre_rend_mode( &args ) +#endif + ) { if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); exit( -1 ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( is_split_post_rend_mode( &args ) && ( hSplitRendFileReadWrite != NULL ) ) + { + uint32_t pre_rend_delay_ns; + split_rend_read_pre_rend_delay_ns( hSplitRendFileReadWrite, &pre_rend_delay_ns ); + delayNumSamples += NS2SA( delayTimeScale, pre_rend_delay_ns ); + } +#endif delayNumSamples_orig = delayNumSamples; } else @@ -1150,19 +1460,37 @@ int main( zeroPad = delayNumSamples; } - if ( delayNumSamples < outBufferSize ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( hSplitRendFileReadWrite != NULL ) && is_split_pre_rend_mode( &args ) ) { - if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); + fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); } - delayNumSamples = 0; } - else + if ( audioWriter != NULL ) +#endif { - delayNumSamples -= (int16_t) outBufferSize; + if ( delayNumSamples < outBufferSize ) + { + if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); + exit( -1 ); + } + delayNumSamples = 0; + } + else + { + delayNumSamples -= (int16_t) outBufferSize; + } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + bitsBuffer.config.bitsRead = 0; + bitsBuffer.config.bitsWritten = 0; +#endif + frame++; if ( !args.quietModeEnabled ) @@ -1176,11 +1504,16 @@ int main( } /* add zeros at the end to have equal length of synthesized signals */ - memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( audioWriter != NULL ) +#endif { - fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); + memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + exit( -1 ); + } } if ( !args.quietModeEnabled && args.delayCompensationEnabled ) @@ -1207,6 +1540,12 @@ int main( count_free( inFloatBuffer ); count_free( outInt16Buffer ); count_free( outFloatBuffer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( bitsBufferData != NULL ) + { + count_free( bitsBufferData ); + } +#endif for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { MasaFileReader_close( &masaReaders[i] ); @@ -1215,11 +1554,28 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in ) { - rend_closeCldfb( cldfbAna ); + rend_closeCldfb( cldfbAna, cldfbSyn ); } #endif - AudioFileReader_close( &audioReader ); - AudioFileWriter_close( &audioWriter ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( audioReader != NULL ) +#endif + { + AudioFileReader_close( &audioReader ); + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hSplitRendFileReadWrite != NULL ) + { + split_rend_reader_writer_close( &hSplitRendFileReadWrite ); + } + if ( audioWriter != NULL ) +#endif + { + AudioFileWriter_close( &audioWriter ); + } + HeadRotationFileReader_close( &headRotReader ); hrtfFileReader_close( &hrtfFileReader ); IVAS_REND_Close( &hIvasRend ); @@ -1272,7 +1628,9 @@ static bool parseInConfig( inConfig->numAmbisonicsBuses = 0; inConfig->numMultiChannelBuses = 0; inConfig->numMasaBuses = 0; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + inConfig->numBinBuses = 0; +#endif /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */ strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 ); to_upper( charBuf ); @@ -1308,6 +1666,15 @@ static bool parseInConfig( inConfig->ambisonicsBuses[0].inputChannelIndex = 0; inConfig->ambisonicsBuses[0].gain_dB = 0.0f; break; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + inConfig->numBinBuses = 1; + inConfig->binBuses[0].audioConfig = audioConfig; + inConfig->binBuses[0].inputChannelIndex = 0; + inConfig->binBuses[0].gain_dB = 0.0f; + break; +#endif case IVAS_REND_AUDIO_CONFIG_MASA1: case IVAS_REND_AUDIO_CONFIG_MASA2: inConfig->numMasaBuses = 1; @@ -1427,44 +1794,6 @@ static int8_t parseDiegeticPan( return success ? 0 : -1; } -#ifdef SPLIT_REND_WITH_HEAD_ROT -static int8_t parseSplitRendMode( - char *value, - IVAS_SPLIT_REND_MODE *SplitRendMode ) -{ - int16_t temp; - int8_t success; - success = 1; - to_upper( value ); - - temp = (int16_t) atoi( value ); - if ( temp == 0 ) - { - *SplitRendMode = SPLIT_REND_DISABLED; - } -#if 0 - else if ( temp == 1 ) - { - *SplitRendMode = SPLIT_REND_PRE; - } - else if ( temp == 2 ) - { - *SplitRendMode = SPLIT_REND_POST; - } -#endif - else if ( temp == 3 ) - { - *SplitRendMode = SPLIT_REND_COMB; - } - else - { - fprintf( stderr, "Error: Incorrect or unsupported value for split rendering mode specified!\n\n" ); - success = 0; - } - return success ? 0 : -1; -} -#endif - static int8_t parseOrientationTracking( char *value, int8_t *tracking_type ) @@ -1571,6 +1900,16 @@ static IVAS_REND_AudioConfig parseAudioConfig( { return IVAS_REND_AUDIO_CONFIG_BINAURAL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( strcmp( charBuf, "BINAURAL_SPLIT_PCM" ) == 0 ) + { + return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; + } + if ( strcmp( charBuf, "BINAURAL_SPLIT_CLDFB" ) == 0 ) + { + return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; + } +#endif return IVAS_REND_AUDIO_CONFIG_UNKNOWN; } @@ -1601,10 +1940,19 @@ static bool checkRequiredArgs( fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort ); missingRequiredArg = true; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + const bool singleInputSpecified = args.inConfig.numAudioObjects != 0 || + args.inConfig.numAmbisonicsBuses != 0 || + args.inConfig.numMultiChannelBuses != 0 || + args.inConfig.numMasaBuses != 0 || + args.inConfig.numBinBuses != 0; +#else const bool singleInputSpecified = args.inConfig.numAudioObjects != 0 || args.inConfig.numAmbisonicsBuses != 0 || args.inConfig.numMultiChannelBuses != 0 || args.inConfig.numMasaBuses != 0; +#endif + if ( !args.sceneDescriptionInput && !singleInputSpecified ) { /* Neither scene description input nor single-type input was specified on command line */ @@ -1662,8 +2010,7 @@ static CmdlnArgs defaultArgs( clearString( args.headRotationFilePath ); #ifdef SPLIT_REND_WITH_HEAD_ROT - args.splitRendMode = SPLIT_REND_DISABLED; - clearString( args.postRendheadRotationFilePath ); + clearString( args.outMetadataFilePath ); #endif clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); @@ -1737,17 +2084,9 @@ static void parseOption( strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; #ifdef SPLIT_REND_WITH_HEAD_ROT - case CmdLnOptionId_PostRendtrajFile: + case CmdLnOptionId_outputMetadata: assert( numOptionValues == 1 ); - strncpy( args->postRendheadRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); - break; - case CmdLnOptionId_SplitRendMode: - assert( numOptionValues == 1 ); - if ( parseSplitRendMode( optionValues[0], &args->splitRendMode ) != 0 ) - { - fprintf( stderr, "Unknown option for split rendering mode: %s\n", optionValues[0] ); - exit( -1 ); - } + strncpy( args->outMetadataFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; #endif case CmdLnOptionId_customHrtfFile: @@ -2525,6 +2864,10 @@ static void printSupportedAudioConfigs() "MASAx (input only)", "BINAURAL (output only)", "BINAURAL_ROOM (output only)", +#ifdef SPLIT_REND_WITH_HEAD_ROT + "BINAURAL_SPLIT_PCM", + "BINAURAL_SPLIT_CLDFB", +#endif }; fprintf( stdout, "Supported audio formats:\n" ); @@ -2687,19 +3030,75 @@ static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, - int16_t *intBuffer ) + int16_t *intBuffer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t cldfb_in, + HANDLE_CLDFB_FILTER_BANK *cldfbSyn +#endif +) { int16_t chnl, smpl, i; i = 0; - for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( cldfb_in ) { + int16_t slotIdx, numCldfbBands, numPcmSamples, b; + float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + numPcmSamples = numSamplesPerChannel >> 1; + numCldfbBands = numPcmSamples / CLDFB_NO_COL_MAX; + /* CLDFB Synthesis*/ + for ( chnl = 0; chnl < numChannels; ++chnl ) + { + for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) + { + for ( b = 0; b < numCldfbBands; b++ ) + { + re[chnl][slotIdx][b] = floatBuffer[( chnl * numSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands ) + b]; + im[chnl][slotIdx][b] = floatBuffer[numCldfbBands + ( chnl * numSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands ) + b]; + } + } + } + + /* Implement CLDFB synthesis */ for ( chnl = 0; chnl < numChannels; ++chnl ) { - intBuffer[i] = (int16_t) roundf( floatBuffer[chnl * numSamplesPerChannel + smpl] ); + float *RealBuffer[CLDFB_NO_COL_MAX]; + float *ImagBuffer[CLDFB_NO_COL_MAX]; + + for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) + { + RealBuffer[slotIdx] = re[chnl][slotIdx]; + ImagBuffer[slotIdx] = im[chnl][slotIdx]; + } - ++i; + cldfbSynthesis( RealBuffer, ImagBuffer, &( fIn[chnl][0] ), numCldfbBands * CLDFB_NO_COL_MAX, cldfbSyn[chnl] ); + } + for ( smpl = 0; smpl < numPcmSamples; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) + { + intBuffer[i] = (int16_t) roundf( fIn[chnl][smpl] ); + ++i; + } + } + } + else +#endif + { + + for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) + { + intBuffer[i] = (int16_t) roundf( floatBuffer[chnl * numSamplesPerChannel + smpl] ); + + ++i; + } } } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 39cbc82a1a..35f5954998 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -83,6 +83,19 @@ typedef struct } IVAS_QUATERNION; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef enum +{ + DEFAULT_AXIS, + YAW, + PITCH, + ROLL, + YAW_PITCH, + YAW_ROLL, + PITCH_ROLL +} IVAS_SPLIT_REND_ROT_AXIS; +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct ivas_split_rend_bits_t { @@ -98,7 +111,7 @@ typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) typedef enum { IVAS_RENDER_TYPE_OVERRIDE_NONE, @@ -120,12 +133,32 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ } IVAS_ROOM_ACOUSTICS_CONFIG_DATA; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef struct _IVAS_SPLIT_REND_CONFIG +{ + int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ + int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ + int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ + /*The axis can be set dynamically per frame based on a file input */ + /*possible values: + 1 - (1dof correction. By default YAW correction) + 2 - (2dof correction. By default YAW and PITCH correction) + 3 - (3dof correction. By default YAW, PITCH and ROLL correction) + */ + int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ +} IVAS_SPLIT_REND_CONFIG_DATA; +#endif + typedef struct _IVAS_RENDER_CONFIG { -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; + +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; +#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; typedef struct _IVAS_LS_CUSTOM_LAYOUT @@ -156,14 +189,4 @@ typedef struct _IVAS_JBM_TRACE_DATA } IVAS_JBM_TRACE_DATA; -#ifdef SPLIT_REND_WITH_HEAD_ROT -typedef enum _IVAS_SPLIT_REND_MODE -{ - SPLIT_REND_DISABLED = -1, - SPLIT_REND_PRE, - SPLIT_REND_POST, - SPLIT_REND_COMB -} IVAS_SPLIT_REND_MODE; -#endif - #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 4bcac1555e..3d3b5ddf54 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -57,6 +57,10 @@ int32_t get_delay( HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ RENDERER_TYPE renderer_type, /* i : IVAS rendering type */ const int32_t binaural_latency_ns /* i : binaural renderer HRTF delay in ns */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + AUDIO_CONFIG output_config /* i : decoder output config */ +#endif ) { int32_t delay = 0; @@ -94,12 +98,17 @@ int32_t get_delay( else /* IVAS */ { delay = IVAS_DEC_DELAY_NS; - - if ( hCldfb != NULL || renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) +#endif { - delay += IVAS_FB_DEC_DELAY_NS; + if ( hCldfb != NULL || renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + delay += IVAS_FB_DEC_DELAY_NS; + } } + /* compensate for Binaural renderer HRTF delay */ { delay += binaural_latency_ns; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0c33ade4d7..2046b3de33 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -103,6 +103,9 @@ typedef enum AUDIO_CONFIG_OBA, /* object based audio */ AUDIO_CONFIG_BINAURAL, /* binaural with HRIR */ AUDIO_CONFIG_BINAURAL_ROOM, /* binaural with HRIR and BRIR */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB, /* split binaural with CLDFB coded output */ +#endif AUDIO_CONFIG_ISM1, /* ISM1 */ AUDIO_CONFIG_ISM2, /* ISM2 */ AUDIO_CONFIG_ISM3, /* ISM3 */ @@ -113,7 +116,7 @@ typedef enum } AUDIO_CONFIG; -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) typedef enum { RENDER_TYPE_OVERRIDE_NONE, @@ -1350,6 +1353,18 @@ typedef enum EFAP_DMX_INTENSITY } EFAP_VTX_DMX_TYPE; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef enum +{ + ANY_YAW, + PITCH_ONLY, + ANY_ROLL, + PRED_ONLY, + COM_GAIN_ONLY, + LR_GAIN_ONLY +} IVAS_SPLIT_REND_POSE_TYPE; +#endif + #define VBAP_NUM_SEARCH_SECTORS 4 /*----------------------------------------------------------------------------------* @@ -1362,22 +1377,50 @@ typedef enum #ifdef SPLIT_REND_WITH_HEAD_ROT #define SPLIT_REND_DECOR_ALPHA (0.25f) -#define MAX_YAW_ANGLES (3) -#define MAX_PITCH_ANGLES (1) -#define MAX_ROLL_ANGLES (1) -#define MAX_HEAD_ROT_POSES (MAX_YAW_ANGLES*MAX_PITCH_ANGLES*MAX_ROLL_ANGLES) + +#define SPLIT_REND_MAX_YAW_ONLY_POSES (2) +#define SPLIT_REND_MAX_PITCH_ONLY_POSES (2) +#define SPLIT_REND_MAX_ROLL_ONLY_POSES (2) +#define SPLIT_REND_MAX_ONE_AXIS_MD_POSES (2) +#define MAX_EXTRAPOLATION_ANGLE (15.0f) /* this means additional 15 degrees can be extrapolated on top of MD probing poses*/ + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define MAX_HEAD_ROT_POSES (1 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) +#else +#define MAX_HEAD_ROT_POSES (1 + SPLIT_REND_MAX_YAW_ONLY_POSES) +#endif #define MAX_SPLIT_REND_MD_BANDS (20) #define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS) +#define COMPLEX_MD_BAND_THRESH_LOW (5) -#ifdef SPLIT_REND_WITH_HEAD_ROT + +#define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) #define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) #define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.0f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f) +#define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f) +#define IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS ( IVAS_SPLIT_REND_D_QUANT_PNTS ) +#define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f ) +#else #define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f ) +#endif #define IVAS_SPLIT_REND_D_MAX_VAL ( 1.0f ) + +#define IVAS_SPLIT_REND_PRED_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )) +#define IVAS_SPLIT_REND_PRED_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL )) +#define IVAS_SPLIT_REND_D_Q_STEP (( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL ) / ( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 )) +#define IVAS_SPLIT_REND_D_1BYQ_STEP (( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL )) +#define IVAS_SPLIT_REND_PITCH_G_Q_STEP (( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) / ( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 )) +#define IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP (( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL )) + #define IVAS_SPLIT_REND_MAX_NUM_BYTES (4000) -#endif +#define IVAS_SPLIT_REND_HEAD_POSE_BITS (9) +#define IVAS_SPLIT_REND_DOF_BITS (2) +#define IVAS_SPLIT_REND_HQ_MODE_BITS (1) +#define IVAS_SPLIT_REND_ROT_AXIS_BITS (3) #endif #define HRTF_SH_ORDER 3 @@ -1617,6 +1660,13 @@ typedef enum #define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS ) #define CLDFB_PAR_WEIGHT_START_BAND 7 +#define SIZE_SPLIT_REND_BRATE_TBL (4) +#define SPLIT_REND_256k 256000 +#define SPLIT_REND_384k 384000 +#define SPLIT_REND_512k 512000 +#define SPLIT_REND_768k 768000 +#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k + #endif /* clang-format on */ /* IVAS_CNST_H */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 62050015c6..c0414dc990 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4565,6 +4565,9 @@ void ivas_binaural_cldfb( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, #endif @@ -4597,6 +4600,15 @@ void Quat2Euler( float *roll /* o : roll */ ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +void Quat2EulerDegree( + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw */ + float *pitch, /* o : pitch */ + float *roll /* o : roll */ +); +#endif + void SHrotmatgen( float SHrotmat[SBA_NHARM_HOA3][SBA_NHARM_HOA3], /* o : SHD rotation matrix */ float Rmat[3][3], /* i : real-space rotation matrix */ @@ -4666,15 +4678,20 @@ void rotateFrame_sd_cldfb( void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, + IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, + HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ); void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ); +void ivas_init_split_post_rend_handles( + SPLIT_POST_REND_WRAPPER *hSplitRendWrapper ); ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitBinRend, + const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t output_Fs, - const IVAS_SPLIT_REND_MODE splitRendMode, - const int16_t is_cldfb_in ); + const int16_t is_cldfb_in, + const int16_t is_pcm_out); void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend); @@ -4692,6 +4709,7 @@ void ivas_splitBinLCLDEncProcess( BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int32_t available_bits, ivas_split_rend_bits_t *pBits ); ivas_error ivas_splitBinLCLDDecOpen( @@ -4709,7 +4727,8 @@ void ivas_splitBinLCLDDecProcess( float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ); ivas_error ivas_splitBinPreRendOpen( - BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend + 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 @@ -4718,32 +4737,48 @@ ivas_error ivas_splitBinPreRendOpen( ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, - const int32_t output_Fs ); + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int32_t output_Fs, + const int16_t is_cldfb_in ); + +void ivas_init_multi_bin_pose_data( + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); +void ivas_renderSplitGetMultiBinPoseData( + const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const IVAS_SPLIT_REND_ROT_AXIS rot_axis); ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, + const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], + const int32_t SplitRendBitRate, ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], - const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], const int16_t max_bands, - float out[][L_FRAME48k]); + float out[][L_FRAME48k], + const int16_t low_res_pre_rend_rot, + const int16_t pcm_out +); void ivas_rend_CldfbSplitPreRendProcess( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_bands, - ivas_split_rend_bits_t *pBits ); + ivas_split_rend_bits_t *pBits, + const int32_t target_md_bits, + const int16_t low_res_pre_rend_rot); void ivas_rend_CldfbSplitPostRendProcess( BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, - const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float output[][L_FRAME48k] ); + float output[][L_FRAME48k], + const int16_t is_cldfb_in ); void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ); @@ -4754,6 +4789,7 @@ 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, #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, #endif @@ -4761,29 +4797,30 @@ void ivas_splitBinPostRendMdDec( #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG void ivas_log_cldfb2wav_data( - float Cldfb_In_Real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_Imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], HANDLE_CLDFB_FILTER_BANK *cldfbSyn, const int16_t num_chs, const int16_t num_freq_bands, const int32_t output_Fs, + const int16_t start_slot_idx, + const int16_t md_band_idx, const char *filename ); #endif void ivas_SplitRenderer_GetRotMd( BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ - float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ - ivas_split_rend_bits_t *pBits, - int16_t sf_idx ); + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + int16_t low_res); void ivas_SplitRenderer_PostRenderer( - BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ - float Cldfb_RealBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - int16_t sf_idx, - const IVAS_QUATERNION *Quaternions_ref, - const IVAS_QUATERNION *Quaternions_act ); + BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES]); #endif diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index b8fbaa833f..69ebb519aa 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -1119,7 +1119,6 @@ void v_sort_ind( return; } - /*-------------------------------------------------------------------* * is_IVAS_bitrate() * diff --git a/lib_com/options.h b/lib_com/options.h index 1f12475cfb..1868be25a5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,8 +157,30 @@ #define SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes -#define SPLIT_REND_BASE2_CODING -//#define SPLIT_REND_SKIP_POST_REND +//#define DBG_WAV_WRITER + +#define SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT + +#define SPLIT_REND_ZERO_OUT_YAW_D +//#define SPLIT_REND_REAL_ONLY_ROLL + +//#define SPIT_ABS_SCALING_INTERP + +//#define USE_DOLBY_HRTFS_WITH_LIB_REND_HOA3 + +//#define SPLIT_MD_CODING_DEBUG +#define FIX_376_SBA_ROTATE + + +/*CLDFB CODEC SWITCHES -- START*/ +#define ENABLE_MS_PRED +#define BUG_FIX_03_15_23_INIT_GROUPING +#define FORCE_GROUPS_OF_2 +#define USE_BIT_COUNT_MERGE_COST +#define OPTIMIZE_DPCM_QUANT +/*CLDFB CODEC SWITCHES -- END*/ + + #endif /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 973f15ef5a..d4a03b00a0 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -719,6 +719,10 @@ int32_t get_delay( HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ RENDERER_TYPE renderer_type, /* i : IVAS rendering type */ const int32_t binaural_latency_ns /* i : binaural renderer HRTF delay in ns */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + AUDIO_CONFIG output_config /* i : decoder output config */ +#endif ); void decision_matrix_enc( diff --git a/lib_debug/debug.c b/lib_debug/debug.c index dc3d0cb4d9..3d72aa637b 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -55,7 +55,7 @@ #else #endif #include "wmops.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER #include "tinywaveout_c.h" #endif @@ -93,17 +93,17 @@ int16_t debug_level = 0; static FILE *in_fileptr[N_FILEPTR]; static FILE *out_fileptr[N_FILEPTR]; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER static WAVEFILEOUT *out_wavfileptr[N_FILEPTR]; #endif static char *in_filename[N_FILEPTR]; static char *out_filename[N_FILEPTR]; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER static char *out_wavfilename[N_FILEPTR]; #endif static int16_t in_count = 0; static int16_t out_count = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER static int16_t out_wav_count = 0; #endif @@ -401,7 +401,7 @@ void dbgclose() fclose( out_fileptr[i] ); free( out_filename[i] ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER for ( i = 0; i < out_wav_count; i++ ) { CloseWav( out_wavfileptr[i] ); @@ -863,7 +863,7 @@ int16_t make_dirs( const char *const pathname ) return 0; } -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER int16_t dbgwrite_wav( const float *buffer[], /* i : Write buffer */ const int16_t count_per_ch, /* i : Number of elements */ diff --git a/lib_debug/debug.h b/lib_debug/debug.h index e228f11cf4..49aae558b0 100644 --- a/lib_debug/debug.h +++ b/lib_debug/debug.h @@ -95,7 +95,7 @@ int16_t dbgwrite( const char *const filename #endif ); -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG +#ifdef DBG_WAV_WRITER int16_t dbgwrite_wav( const float *buffer[], /* i : Write buffer */ const int16_t count_per_ch, /* i : Number of elements */ diff --git a/lib_debug/mem_count.c b/lib_debug/mem_count.c index 598b023df3..6315390d07 100644 --- a/lib_debug/mem_count.c +++ b/lib_debug/mem_count.c @@ -98,7 +98,7 @@ typedef INT64 int64_t; /* This is the maximum number of allocations for which to keep information. It can be increased if required. */ #ifdef SBA_BR_SWITCHING -#define MAX_INFO_RECORDS 9000 +#define MAX_INFO_RECORDS 15000 #else #define MAX_INFO_RECORDS 3000 #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index cf887ab725..fd828a6c22 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -89,12 +89,6 @@ ivas_error ivas_dec( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->Opt_splitRendMode != SPLIT_REND_DISABLED ) - { - ivas_set_split_rend_setup( &st_ivas->splitBinRend, hSplitRendBits ); - } -#endif /*----------------------------------------------------------------* * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ @@ -106,6 +100,14 @@ ivas_error ivas_dec( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); + ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hHeadTrackData, hSplitRendBits ); + } +#endif + /*----------------------------------------------------------------* * Decoding + Rendering *----------------------------------------------------------------*/ @@ -555,23 +557,21 @@ ivas_error ivas_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /*split rendering process calls*/ - if ( st_ivas->hDecoderConfig->Opt_splitRendMode != SPLIT_REND_DISABLED ) + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { - if ( ( st_ivas->splitBinRend.splitrend.hBinHrSplitPreRend != NULL ) && ( st_ivas->splitBinRend.splitrend.hBinHrSplitPostRend != NULL ) ) - { - IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; - int16_t max_band; - hSplitBinRend = &st_ivas->splitBinRend; - max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); - ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, - hSplitBinRend->hSplitRendBits, - hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, - hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, - st_ivas->hHeadTrackData->Quaternions, - st_ivas->hPostRendheadTrackData->Quaternions, max_band, output ); - - dynamic_free( st_ivas->splitBinRend.hMultiBinCldfbData ); - } + IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; + int16_t max_band; + hSplitBinRend = &st_ivas->splitBinRend; + max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); + ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, + st_ivas->hHeadTrackData->Quaternions, + st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, + hSplitBinRend->hSplitRendBits, + hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, + hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, + max_band, output, 1, 0 ); + + dynamic_free( st_ivas->splitBinRend.hMultiBinCldfbData ); } #endif /*----------------------------------------------------------------* diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 8b07d7bb1d..e7301685fd 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2349,6 +2349,9 @@ void ivas_dirac_dec( /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, +#ifdef SPLIT_REND_WITH_HEAD_ROT + &st_ivas->splitBinRend.splitrend.multiBinPoseData, +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG st_ivas->hPostRendheadTrackData, #endif @@ -2359,13 +2362,13 @@ void ivas_dirac_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hBinRenderer->splitRendMode == SPLIT_REND_PRE || st_ivas->hBinRenderer->splitRendMode == SPLIT_REND_COMB ) + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { int16_t pos_idx; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES + 1; pos_idx++ ) + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) #else - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) #endif { for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5d8d158739..bf3da79bf8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -564,20 +564,6 @@ ivas_error ivas_init_decoder_front( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->Opt_splitRendMode == SPLIT_REND_COMB ) - { - if ( ( error = ivas_headTrack_open( &( st_ivas->hPostRendheadTrackData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - st_ivas->hPostRendheadTrackData = NULL; - } -#endif - /*-------------------------------------------------------------------* * Allocate HRTF binary handle *--------------------------------------------------------------------*/ @@ -594,7 +580,11 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Binaural Renderer configuration handle *--------------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) { @@ -1167,12 +1157,26 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + } +#endif if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, hDecoderConfig->output_Fs, hDecoderConfig->Opt_splitRendMode, 1 ); + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 1, 0 ); + } #endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) @@ -1665,6 +1669,9 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural renderer handle */ ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); + +#else + #endif /* Parametric binaural renderer handle */ @@ -1703,13 +1710,6 @@ void ivas_destroy_dec( count_free( st_ivas->hHeadTrackData ); st_ivas->hHeadTrackData = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hPostRendheadTrackData != NULL ) - { - count_free( st_ivas->hPostRendheadTrackData ); - st_ivas->hPostRendheadTrackData = NULL; - } -#endif /* Time Domain binaural renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) @@ -1980,7 +1980,11 @@ static ivas_error doSanityChecks_IVAS( if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { if ( !( output_config == AUDIO_CONFIG_BINAURAL || - output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) + output_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) ) { return IVAS_ERROR( IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, "Wrong set-up: Head-rotation not supported in this configuration" ); } @@ -1994,7 +1998,12 @@ static ivas_error doSanityChecks_IVAS( * - FastConv Binaural Renderer: 5 ms by default * * - TD objects Binaural Renderer: 20 ms by default */ - if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) || !( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MC_FORMAT || st_ivas->ivas_format == ISM_FORMAT ) ) + if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) || + !( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MC_FORMAT || st_ivas->ivas_format == ISM_FORMAT ) ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Wrong set-up: Forced subframe resolution parametric binauralization activated for non-binaural output." ); } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 7b8901fdec..e33a0596eb 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1057,6 +1057,9 @@ void ivas_param_mc_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, +#ifdef SPLIT_REND_WITH_HEAD_ROT + &st_ivas->splitBinRend.splitrend.multiBinPoseData, +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG NULL, #endif diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index d481ffa904..efab9efedd 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -556,9 +556,26 @@ const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] /*----------------------------------------------------------------------* * split rendering ROM tables *-----------------------------------------------------------------------*/ -const float split_rend_relative_yaw_angles[MAX_YAW_ANGLES] = {0.0f, -15.0f, 30.0f}; /*actual rotations would be Ref, Ref - 15, Ref - 15 + 30 */ -const float split_rend_relative_pitch_angles[MAX_PITCH_ANGLES] = {0.0f}; -const float split_rend_relative_roll_angles[MAX_ROLL_ANGLES] = {0.0f}; + +/*----------------------------------------------------------------------------------* + * Table of Split rendering bitrates + *----------------------------------------------------------------------------------*/ +const int32_t split_rend_brate_tbl[SIZE_SPLIT_REND_BRATE_TBL] = +{ + SPLIT_REND_256k, SPLIT_REND_384k, SPLIT_REND_512k, SPLIT_REND_768k +}; + +/*rotations in this array are relative to ref rotation */ +const float split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f}; +const float split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f}; +const float split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f}; +const float split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f}; + +const float split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f}; +const float split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f}; +const float split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f}; +const float split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f}; + const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] = { //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 36, 38, 40, 50, 60 @@ -567,6 +584,19 @@ const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] = //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 25, 40, 60 }; +const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = { +{0,8,252},{1,8,253},{2,7,124},{3,6,60},{4,5,28},{5,4,12}, +{6,3,4},{7,1,0},{8,3,5},{9,4,13},{10,5,29},{11,6,61}, +{12,7,125},{13,8,254},{14,8,255} +}; + +const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = { + { 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 }, + { 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 }, + { 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 }, + { 12, 13, 8190 },{ 13, 14, 16382 },{ 14, 14, 16383 } +}; + const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = { { 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 }, { 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 }, diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index aa5f48cbe9..0cbf968d4b 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -160,12 +160,24 @@ extern const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENC /*----------------------------------------------------------------------* * split rendering ROM tables *-----------------------------------------------------------------------*/ -extern const float split_rend_relative_yaw_angles[MAX_YAW_ANGLES]; -extern const float split_rend_relative_pitch_angles[MAX_PITCH_ANGLES]; -extern const float split_rend_relative_roll_angles[MAX_ROLL_ANGLES]; +extern const float split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES]; +extern const float split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES]; +extern const float split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES]; +extern const float split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES]; +extern const float split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES]; + +extern const float split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES]; +extern const float split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES]; +extern const float split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES]; + + +extern const float split_rend_relative_pos_angles[MAX_HEAD_ROT_POSES][3]; extern const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1]; extern const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; extern const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3]; +extern const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; +extern const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; +extern const int32_t split_rend_brate_tbl[]; #endif #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3c02a05d9b..aa300a0a8f 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -446,7 +446,11 @@ ivas_error ivas_sba_dec_reinit( set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); } - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) { @@ -459,12 +463,26 @@ ivas_error ivas_sba_dec_reinit( } if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + } +#endif if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, hDecoderConfig->output_Fs, hDecoderConfig->Opt_splitRendMode, 1 ); + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 1, 0 ); + } #endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index ceed901c1a..678db72276 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1157,7 +1157,11 @@ void ivas_spar_dec_upmixer( } else { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) ) { for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 65d2af32f9..9a71525563 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -43,8 +43,8 @@ #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think #ifdef SPLIT_REND_WITH_HEAD_ROT -#include "ivas_cldfb_trans_codec/CQMFEncoder.h" -#include "ivas_cldfb_trans_codec/CQMFDecoder.h" +#include "ivas_CQMFEncoder.h" +#include "ivas_CQMFDecoder.h" #endif /*----------------------------------------------------------------------------------* @@ -1278,10 +1278,6 @@ typedef struct ivas_binaural_rendering_conv_module_struct int16_t numTapsArray[BINAURAL_CONVBANDS]; int16_t numTaps; -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t numPoses; -#endif - } BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1291,9 +1287,11 @@ typedef struct ivas_binaural_head_rot_split_rendering_md_struct float pred_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float pred_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float gd; + float gd2; int16_t pred_mat_re_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t pred_mat_im_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t gd_idx; + int16_t gd2_idx; } BIN_HR_SPLIT_REND_MD, *BIN_HR_SPLIT_REND_MD_HANDLE; typedef struct ivas_split_rend_huffman_cfg_t @@ -1312,12 +1310,19 @@ typedef struct ivas_binaural_head_rot_split_rendering_huff_struct ivas_split_rend_huffman_cfg_t gd; int16_t gd_base2_code_len; int16_t gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS]; + ivas_split_rend_huffman_cfg_t p_gd; + int16_t p_gd_base2_code_len; + int16_t p_gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS]; + ivas_split_rend_huffman_cfg_t p_gd_diff; + int16_t p_gd_diff_base2_code_len; + int16_t p_gd_diff_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS]; } BIN_HR_SPLIT_REND_HUFF, *BIN_HR_SPLIT_REND_HUFF_HANDLE; typedef struct ivas_binaural_head_rot_split_pre_rendering_struct { BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; - float fix_pos_rot_mat[MAX_YAW_ANGLES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1]; BIN_HR_SPLIT_REND_HUFF huff_cfg; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS]; @@ -1327,7 +1332,11 @@ typedef struct ivas_binaural_head_rot_split_pre_rendering_struct typedef struct ivas_binaural_head_rot_split_post_rendering_struct { BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; + IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t low_Res; + float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1]; BIN_HR_SPLIT_REND_HUFF huff_cfg; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG float mixer_mat_re[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -1339,6 +1348,7 @@ typedef struct ivas_binaural_head_rot_split_post_rendering_struct float gd_mem[1][MAX_SPLIT_REND_MD_BANDS]; #endif int16_t cf_flag; + HANDLE_CLDFB_FILTER_BANK cldfbAna[BINAURAL_CHANNELS]; HANDLE_CLDFB_FILTER_BANK cldfbSyn[BINAURAL_CHANNELS]; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HANDLE_CLDFB_FILTER_BANK cldfbSynReconsBinDec[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS]; @@ -1348,41 +1358,63 @@ typedef struct ivas_binaural_head_rot_split_post_rendering_struct typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct { void *pLcld_enc; - int32_t iChannels; - CQMFEncoder *psCQMFEncoder; - float ***pppfCQMFReal; - float ***pppfCQMFImag; + int32_t iChannels; + CQMFEncoder *psCQMFEncoder; + float ***pppfCQMFReal; + float ***pppfCQMFImag; #ifdef CLDFB_DEBUG - FILE *cldfbIn; - int numFrame; + FILE *cldfbIn; + int numFrame; #endif } BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE; typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct { void *pLcld_dec; - int32_t iChannels; - CQMFDecoder *psCQMFDecoder; - float ***pppfDecCQMFReal; - float ***pppfDecCQMFImag; + int32_t iChannels; + CQMFDecoder *psCQMFDecoder; + float ***pppfDecCQMFReal; + float ***pppfDecCQMFImag; #ifdef CLDFB_DEBUG - FILE *cldfbOut; - int numFrame; + FILE *cldfbOut; + int numFrame; #endif } BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE; typedef struct { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HANDLE_CLDFB_FILTER_BANK cldfbAna[( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS]; +#else HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; +#endif } CLDFB_HANDLES_WRAPPER, *CLDFB_HANDLES_WRAPPER_HANDLE; + +#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct { + int16_t num_poses; + float relative_head_poses[MAX_HEAD_ROT_POSES][3]; + int16_t dof; + int16_t hq_mode; + IVAS_SPLIT_REND_ROT_AXIS rot_axis; +} MULTI_BIN_REND_POSE_DATA; +#endif + +typedef struct +{ + MULTI_BIN_REND_POSE_DATA multiBinPoseData; BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend; BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc; - BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend; - BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec; CLDFB_HANDLES_WRAPPER_HANDLE hCldfbHandles; } SPLIT_REND_WRAPPER; + +typedef struct +{ + MULTI_BIN_REND_POSE_DATA multiBinPoseData; + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend; + BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec; +} SPLIT_POST_REND_WRAPPER; #endif /* Fastconv binaural data structure */ @@ -1399,15 +1431,17 @@ typedef struct ivas_binaural_rendering_struct int16_t nInChannels; /* number input channels */ int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_MODE splitRendMode; /*Split rendering mode, pre, post (OR combined in debug mode)*/ -#endif /* Convolution module structure */ BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; /* Variables related to reverb module */ float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; REVERB_STRUCT_HANDLE hReverb; + +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t numPoses; +#endif + } BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; @@ -1428,6 +1462,9 @@ typedef struct ivas_binaural_head_track_struct float lrSwitchInterpVal; int16_t shd_rot_max_order; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; +#endif } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; @@ -1797,10 +1834,13 @@ typedef struct ivas_roomAcoustics_t typedef struct ivas_render_config_t { -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; +#endif } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; @@ -1989,10 +2029,7 @@ typedef struct decoder_config_structure int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_MODE Opt_splitRendMode; /* Split rendering mode */ -#endif - int16_t orientation_tracking; /* indicates orientation tracking type */ + int16_t orientation_tracking; /* indicates orientation tracking type */ float no_diegetic_pan; int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ @@ -2109,7 +2146,6 @@ typedef struct Decoder_Struct #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_SPLIT_REND_WRAPPER splitBinRend; - HEAD_TRACK_DATA_HANDLE hPostRendheadTrackData; #endif } Decoder_Struct; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 676076fc1f..1261c93b2b 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -36,6 +36,9 @@ #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" #include "jbm_pcmdsp_fifo.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "ivas_rom_dec.h" +#endif #include #include #include @@ -203,6 +206,29 @@ ivas_error IVAS_DEC_Open( } +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*-------------------------------------------------------------------* + * is_SplitRend_BitRate() + * + * check if the bitrate is SPLIT REND supported active bitrate + *-------------------------------------------------------------------*/ +static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) +{ + int16_t j; + + j = 0; + while ( j < SIZE_SPLIT_REND_BRATE_TBL && splitRendBitRate != split_rend_brate_tbl[j] ) + { + j++; + } + if ( j >= SIZE_SPLIT_REND_BRATE_TBL ) + { + return 0; + } + return 1; +} +#endif + /*---------------------------------------------------------------------* * init_decoder_config() * @@ -333,6 +359,12 @@ static AUDIO_CONFIG mapOutputFormat( { output_config = AUDIO_CONFIG_BINAURAL_ROOM; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) + { + output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; + } +#endif else { output_config = AUDIO_CONFIG_INVALID; @@ -387,10 +419,6 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - const IVAS_SPLIT_REND_MODE splitRendMode /* i : split rend mode */ -#endif #ifdef DEBUGGING , const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ @@ -447,10 +475,6 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_Headrotation = enableHeadRotation; hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; -#ifdef SPLIT_REND_WITH_HEAD_ROT - hDecoderConfig->Opt_splitRendMode = splitRendMode; -#endif - /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) { @@ -850,7 +874,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_QUATERNION *orientation /* i : head-tracking data */ #ifdef SPLIT_REND_WITH_HEAD_ROT , - IVAS_SPLIT_REND_MODE splitRendMode /* i : flag to determine split rendering mode*/ + IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif ) { @@ -863,12 +887,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( } hHeadTrackData = hIvasDec->st_ivas->hHeadTrackData; -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( splitRendMode == SPLIT_REND_POST ) - { - hHeadTrackData = hIvasDec->st_ivas->hPostRendheadTrackData; - } -#endif if ( hHeadTrackData == NULL ) { @@ -886,6 +904,10 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->num_quaternions = 0; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hHeadTrackData->sr_pose_pred_axis = rot_axis; +#endif + return IVAS_ERR_OK; } @@ -1010,6 +1032,13 @@ ivas_error IVAS_DEC_GetRenderConfig( mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; + hRCout->split_rend_config.dof = 3; + hRCout->split_rend_config.hq_mode = 0; + hRCout->split_rend_config.codec_delay_ms = 0; +#endif + return IVAS_ERR_OK; } @@ -1054,6 +1083,13 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + hRenderConfig->split_rend_config.splitRendBitRate = renderConfig.split_rend_config.splitRendBitRate; + hRenderConfig->split_rend_config.dof = renderConfig.split_rend_config.dof; + hRenderConfig->split_rend_config.hq_mode = renderConfig.split_rend_config.hq_mode; + hRenderConfig->split_rend_config.codec_delay_ms = renderConfig.split_rend_config.codec_delay_ms; +#endif + return IVAS_ERR_OK; } @@ -1080,8 +1116,11 @@ ivas_error IVAS_DEC_GetDelay( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns, hDecoderConfig->output_config ) ); +#else *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns ) ); +#endif *timeScale = hDecoderConfig->output_Fs; @@ -1705,6 +1744,12 @@ static ivas_error get_channel_config( { strcpy( str, "Binaural_ROOM" ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + strcpy( str, "Split_Binaural" ); + } +#endif else if ( config == AUDIO_CONFIG_EXTERNAL ) { strcpy( str, "External renderer" ); diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 4a052ba32b..d3889c626c 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -59,6 +59,9 @@ typedef enum _IVAS_DEC_OUTPUT_CONFIG IVAS_DEC_OUTPUT_HOA3, IVAS_DEC_OUTPUT_BINAURAL, IVAS_DEC_OUTPUT_BINAURAL_ROOM, +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB, +#endif IVAS_DEC_OUTPUT_EXT, IVAS_DEC_OUTPUT_UNKNOWN = 0xffff } IVAS_DEC_AUDIO_CONFIG; @@ -127,10 +130,6 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation /* i : enable head rotation for binaural output */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - const IVAS_SPLIT_REND_MODE splitRendMode /* i : split rendering mode */ -#endif #ifdef DEBUGGING , const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ @@ -181,9 +180,9 @@ 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 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + #ifdef SPLIT_REND_WITH_HEAD_ROT , - IVAS_SPLIT_REND_MODE splitRendMode /* i : flag to determine split rendering mode*/ + IVAS_SPLIT_REND_ROT_AXIS rot_axis /*i : external control for rotation axis for split rendering*/ #endif ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index b4eb85915e..efbed2baf7 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -951,7 +951,11 @@ ivas_error IVAS_ENC_GetDelay( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0, AUDIO_CONFIG_INVALID ) ); +#else *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0 ) ); +#endif *delay *= hEncoderConfig->nchan_inp; diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c new file mode 100644 index 0000000000..37ae41bca0 --- /dev/null +++ b/lib_rend/ivas_CQMFDecoder.c @@ -0,0 +1,1375 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby +International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der +angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips +N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge +Corporation, and other contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, +Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung +e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph +and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings +Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their +respective contributions in the software. This notice grants no license of any +kind, including but not limited to patent license, nor is any license granted by +implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration +agreement before making contributions. + + This software is provided "AS IS", without any express or implied warranties. +The software is in the development stage. It is intended exclusively for experts +who have experience with such software and solely for the purpose of inspection. +All implied warranties of non-infringement, merchantability and fitness for a +particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing +this software shall be submitted to and settled by the final, binding +jurisdiction of the courts of Munich, Germany in accordance with the laws of the +Federal Republic of Germany excluding its conflict of law rules and the United +Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_CQMFDecoder.h" + +#include "ivas_CQMFHuff.h" +#include "ivas_NoiseGen.h" +#include "ivas_PerceptualModel.h" +#include "ivas_RMSEnvDeltaHuff.h" +#include "ivas_Tables.h" +#include "ivas_cldfb_codec_bitstream.h" +#include "options.h" +#include "prot.h" +#include "wmops.h" +#include +#include +#include +#include +#ifdef ENABLE_MS_PRED +#include "ivas_MSPred.h" +#endif + +#include "ivas_PredDecoder.h" +#include "ivas_lib_rend_internal.h" + +struct CQMF_DECODER +{ + int32_t iSampleRate; + int32_t iChannels; + int32_t iNumBlocks; + + int32_t iNumBands; + const int32_t *piBandwidths; + + int32_t iMSMode; + int32_t *piMSFlags; +#ifdef ENABLE_MS_PRED + int32_t piMSPredCoefs[MAX_BANDS]; + int32_t piLRPhaseDiffs[MAX_BANDS]; +#endif +#ifdef ENABLE_PMOD_ADJUST + int32_t **ppiHiSMRFlags; +#endif + // uint8_t *pReadBuff; + int32_t iCommonGrouping; + int32_t *piNumGroups; + int32_t **ppiGroupLengths; + + int32_t ***pppiRMSEnvelope; + int32_t ***pppiSMR; + int32_t ***pppiExcitation; + int32_t ***pppiAlloc; + + int32_t iAllocOffset; + + int32_t ***pppiCQMFSignReal; + int32_t ***pppiCQMFSignImag; + int32_t ***pppiQCQMFReal; + int32_t ***pppiQCQMFImag; + + PredictionDecoder *psPredictionDecoder; + + + NoiseGen *psNoiseGen; + + int32_t iLastError; +}; + +CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate, + const int32_t iChannels ) +{ + int32_t n; + CQMFDecoder *psCQMFDecoder = NULL; + + assert( iSampleRate == 48000 ); // Fix + + psCQMFDecoder = (CQMFDecoder *) count_malloc( sizeof( CQMFDecoder ) ); + psCQMFDecoder->iSampleRate = iSampleRate; + psCQMFDecoder->iChannels = iChannels; + psCQMFDecoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; + psCQMFDecoder->iAllocOffset = 0; + + psCQMFDecoder->iNumBands = MAX_BANDS_48; // Fix + psCQMFDecoder->piBandwidths = c_aiBandwidths48; // Fix + + psCQMFDecoder->iMSMode = 0; + psCQMFDecoder->piMSFlags = + (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); +#ifdef ENABLE_MS_PRED + for ( n = 0; n < MAX_BANDS; n++ ) + { + psCQMFDecoder->piLRPhaseDiffs[n] = 0; + psCQMFDecoder->piMSPredCoefs[n] = 0; + } +#endif +#ifdef ENABLE_PMOD_ADJUST + psCQMFDecoder->ppiHiSMRFlags = + (int32_t **) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t * ) ); +#endif + + psCQMFDecoder->iCommonGrouping = + 1; // Common grouping always on only impacts stereo + psCQMFDecoder->piNumGroups = + (int32_t *) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ) ); + psCQMFDecoder->ppiGroupLengths = + (int32_t **) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t * ) ); + psCQMFDecoder->pppiRMSEnvelope = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + psCQMFDecoder->pppiSMR = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + psCQMFDecoder->pppiExcitation = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + psCQMFDecoder->pppiAlloc = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + + psCQMFDecoder->pppiCQMFSignReal = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + psCQMFDecoder->pppiCQMFSignImag = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + psCQMFDecoder->pppiQCQMFReal = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + psCQMFDecoder->pppiQCQMFImag = + (int32_t ***) count_malloc( psCQMFDecoder->iChannels * sizeof( int32_t ** ) ); + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; +#ifdef ENABLE_PMOD_ADJUST + psCQMFDecoder->ppiHiSMRFlags[n] = + (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + ; +#endif + psCQMFDecoder->ppiGroupLengths[n] = + (int32_t *) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) ); + psCQMFDecoder->pppiRMSEnvelope[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFDecoder->pppiSMR[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFDecoder->pppiExcitation[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFDecoder->pppiAlloc[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + + psCQMFDecoder->pppiCQMFSignReal[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFDecoder->pppiCQMFSignImag[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFDecoder->pppiQCQMFReal[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFDecoder->pppiQCQMFImag[n] = + (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + psCQMFDecoder->pppiRMSEnvelope[n][k] = + (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + psCQMFDecoder->pppiSMR[n][k] = + (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + psCQMFDecoder->pppiExcitation[n][k] = + (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + psCQMFDecoder->pppiAlloc[n][k] = + (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + + psCQMFDecoder->pppiCQMFSignReal[n][k] = + (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + psCQMFDecoder->pppiCQMFSignImag[n][k] = + (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + psCQMFDecoder->pppiQCQMFReal[n][k] = + (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + psCQMFDecoder->pppiQCQMFImag[n][k] = + (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + } + } + + psCQMFDecoder->psPredictionDecoder = + CreatePredictionDecoder( iChannels, psCQMFDecoder->iNumBlocks ); + // psCQMFDecoder->pReadBuff = + // (uint8_t *) count_malloc( 4096 * sizeof( uint8_t ) ); + psCQMFDecoder->psNoiseGen = + NULL; // CreateNoiseGen(); // No noise fill for now + + psCQMFDecoder->iLastError = DECODER_ERROR_NONE; + + return psCQMFDecoder; +} + +void DeleteCQMFDecoder( CQMFDecoder *psCQMFDecoder ) +{ + if ( psCQMFDecoder != NULL ) + { + + if ( psCQMFDecoder->piMSFlags != NULL ) + { + count_free( psCQMFDecoder->piMSFlags ); + } + + if ( psCQMFDecoder->piNumGroups != NULL ) + { + count_free( psCQMFDecoder->piNumGroups ); + } + + if ( psCQMFDecoder->ppiGroupLengths != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + count_free( psCQMFDecoder->ppiGroupLengths[n] ); + } + count_free( psCQMFDecoder->ppiGroupLengths ); + } + + if ( psCQMFDecoder->pppiRMSEnvelope != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiRMSEnvelope[n][k] ); + } + count_free( psCQMFDecoder->pppiRMSEnvelope[n] ); + } + count_free( psCQMFDecoder->pppiRMSEnvelope ); + } + + if ( psCQMFDecoder->pppiSMR != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiSMR[n][k] ); + } + count_free( psCQMFDecoder->pppiSMR[n] ); + } + count_free( psCQMFDecoder->pppiSMR ); + } + + if ( psCQMFDecoder->pppiExcitation != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiExcitation[n][k] ); + } + count_free( psCQMFDecoder->pppiExcitation[n] ); + } + count_free( psCQMFDecoder->pppiExcitation ); + } + +#ifdef ENABLE_PMOD_ADJUST + if ( psCQMFDecoder->ppiHiSMRFlags != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + count_free( psCQMFDecoder->ppiHiSMRFlags[n] ); + } + count_free( psCQMFDecoder->ppiHiSMRFlags ); + } +#endif + + if ( psCQMFDecoder->pppiAlloc != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiAlloc[n][k] ); + } + count_free( psCQMFDecoder->pppiAlloc[n] ); + } + count_free( psCQMFDecoder->pppiAlloc ); + } + + if ( psCQMFDecoder->pppiCQMFSignReal != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiCQMFSignReal[n][k] ); + } + count_free( psCQMFDecoder->pppiCQMFSignReal[n] ); + } + count_free( psCQMFDecoder->pppiCQMFSignReal ); + } + + if ( psCQMFDecoder->pppiCQMFSignImag != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiCQMFSignImag[n][k] ); + } + count_free( psCQMFDecoder->pppiCQMFSignImag[n] ); + } + count_free( psCQMFDecoder->pppiCQMFSignImag ); + } + + if ( psCQMFDecoder->pppiQCQMFReal != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiQCQMFReal[n][k] ); + } + count_free( psCQMFDecoder->pppiQCQMFReal[n] ); + } + count_free( psCQMFDecoder->pppiQCQMFReal ); + } + + if ( psCQMFDecoder->pppiQCQMFImag != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFDecoder->pppiQCQMFImag[n][k] ); + } + count_free( psCQMFDecoder->pppiQCQMFImag[n] ); + } + count_free( psCQMFDecoder->pppiQCQMFImag ); + } + + // if ( psCQMFDecoder->pReadBuff != NULL ) + //{ + // count_free( psCQMFDecoder->pReadBuff ); + // } + + DeletePredictionDecoder( psCQMFDecoder->psPredictionDecoder ); + + if ( psCQMFDecoder->psNoiseGen != NULL ) + { + DeleteNoiseGen( psCQMFDecoder->psNoiseGen ); + } + + count_free( psCQMFDecoder ); + } +} + +int32_t CQMFDecoderGetError( CQMFDecoder *psCQMFDecoder ) +{ + return psCQMFDecoder->iLastError; +} + +static void ApplyRMSEnvelope( const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t iNumGroups, + const int32_t *piGroupLengths, + int32_t **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag ); + +static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumCQMFBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag ); + +static void +InvQuantizeSpectrum( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, int32_t **ppiAlloc, int32_t **ppiQReal, int32_t **ppiQImag, float **ppfReal, float **ppfImag, + NoiseGen *psNoiseGen ); // Nullable + +static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, +#ifdef ENABLE_MS_PRED + const int32_t *piLRPhaseDiffs, + const int32_t *piMSPredCoefs, +#endif + float ***pppfReal, + float ***pppfImag ); + +/* Currently only the number of bands in frame */ +static int32_t ReadHeaderInformation( int32_t *piNumBands, + ivas_split_rend_bits_t *pBits ); + +static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, +#ifdef ENABLE_MS_PRED + int32_t *piLRPhaseDiffs, + int32_t *piMSPredCoefs, +#endif + ivas_split_rend_bits_t *pBits ); + +static int32_t ReadGroupInformation( const int32_t iChannels, + const int32_t iNumBlocks, + int32_t *piCommonGrouping, + int32_t *piNumGroups, + int32_t **ppiGroupLengths, + ivas_split_rend_bits_t *pBits ); + +static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE], + int32_t *piSymbol, + ivas_split_rend_bits_t *pBits ); + +static int32_t ReadRMSEnvelope( const int32_t iChannels, + const int32_t *piNumGroups, + const int32_t iNumBands, + int32_t ***pppiRMSEnvelope, + ivas_split_rend_bits_t *pBits ); +static int32_t ReadAllocInformation( int32_t *piAllocOffset, + ivas_split_rend_bits_t *pBits ); + +static int32_t +ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits ); + +static void ComputeAllocation( const int32_t iChannels, + const int32_t *piNumGroups, + const int32_t iNumBands, + int32_t ***pppiSMR, + const int32_t iAllocOffset, + int32_t ***pppiAlloc ); + +int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, + ivas_split_rend_bits_t *pBits, + float ***pppfCQMFReal, + float ***pppfCQMFImag ) +{ + int32_t n; + int32_t iBitsRead; + + iBitsRead = 0; + + iBitsRead += + ReadHeaderInformation( &psCQMFDecoder->iNumBands, pBits ); + + if ( psCQMFDecoder->iChannels == 2 ) + { + iBitsRead += ReadMSInformation( + psCQMFDecoder->iNumBands, &psCQMFDecoder->iMSMode, + psCQMFDecoder->piMSFlags, +#ifdef ENABLE_MS_PRED + psCQMFDecoder->piLRPhaseDiffs, psCQMFDecoder->piMSPredCoefs, +#endif + pBits ); + } + iBitsRead += ReadPredictors( psCQMFDecoder->psPredictionDecoder, + pBits ); + + + iBitsRead += ReadGroupInformation( + psCQMFDecoder->iChannels, psCQMFDecoder->iNumBlocks, + &psCQMFDecoder->iCommonGrouping, psCQMFDecoder->piNumGroups, + psCQMFDecoder->ppiGroupLengths, + pBits ); + + iBitsRead += ReadRMSEnvelope( + psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups, + psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope, + pBits ); + +#ifdef ENABLE_PMOD_ADJUST + iBitsRead += + ReadPmodInformation( psCQMFDecoder->ppiHiSMRFlags, psCQMFDecoder->psBSRead, + psCQMFDecoder->iChannels, psCQMFDecoder->iNumBands ); +#endif + + iBitsRead += ReadAllocInformation( &psCQMFDecoder->iAllocOffset, + pBits ); + + if ( psCQMFDecoder->iChannels == 2 && + psCQMFDecoder->iCommonGrouping == 1 ) + { // MS Mode? + int32_t k; + for ( k = 0; k < psCQMFDecoder->piNumGroups[0]; k++ ) + { + PerceptualModelStereo( psCQMFDecoder->iNumBands, psCQMFDecoder->piMSFlags, + psCQMFDecoder->pppiRMSEnvelope[0][k], + psCQMFDecoder->pppiRMSEnvelope[1][k], + psCQMFDecoder->pppiExcitation[0][k], + psCQMFDecoder->pppiExcitation[1][k], + psCQMFDecoder->pppiSMR[0][k], + psCQMFDecoder->pppiSMR[1][k] ); + } + } + else + { + for ( n = 0; n < psCQMFDecoder->iChannels; + n++ ) + { // This will be updated to support multiple sample rates + int32_t k; + for ( k = 0; k < psCQMFDecoder->piNumGroups[n]; k++ ) + { + PerceptualModel( + psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope[n][k], + psCQMFDecoder->pppiExcitation[n][k], psCQMFDecoder->pppiSMR[n][k] ); + } + } + } + + ComputeAllocation( + psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups, + psCQMFDecoder->iNumBands, psCQMFDecoder->pppiSMR, + psCQMFDecoder->iAllocOffset, psCQMFDecoder->pppiAlloc ); + + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + iBitsRead += ReadCQMFData( + psCQMFDecoder->piNumGroups[n], + (const int32_t *) psCQMFDecoder->ppiGroupLengths[n], + psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths, + (const int32_t *) + psCQMFDecoder->psPredictionDecoder->ppiPredBandEnable[n], + psCQMFDecoder->pppiAlloc[n], + psCQMFDecoder->pppiCQMFSignReal[n], psCQMFDecoder->pppiCQMFSignImag[n], + psCQMFDecoder->pppiQCQMFReal[n], psCQMFDecoder->pppiQCQMFImag[n], + pBits ); + } + + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + InvQuantizeSpectrum( psCQMFDecoder->piNumGroups[n], + (const int32_t *) psCQMFDecoder->ppiGroupLengths[n], + psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths, + psCQMFDecoder->pppiAlloc[n], + psCQMFDecoder->pppiQCQMFReal[n], + psCQMFDecoder->pppiQCQMFImag[n], + pppfCQMFReal[n], pppfCQMFImag[n], + psCQMFDecoder->psNoiseGen ); + + ReplaceSign( psCQMFDecoder->iNumBlocks, CQMF_BANDS, + psCQMFDecoder->pppiCQMFSignReal[n], + psCQMFDecoder->pppiCQMFSignImag[n], + pppfCQMFReal[n], pppfCQMFImag[n] ); + } + + ApplyInversePredictros( psCQMFDecoder->psPredictionDecoder, pppfCQMFReal, + pppfCQMFImag ); + + for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) + { + ApplyRMSEnvelope( psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths, + psCQMFDecoder->piNumGroups[n], + (const int32_t *) psCQMFDecoder->ppiGroupLengths[n], + psCQMFDecoder->pppiRMSEnvelope[n], + pppfCQMFReal[n], pppfCQMFImag[n] ); + } + + if ( psCQMFDecoder->iChannels == 2 && psCQMFDecoder->iMSMode > 0 ) + { + InvMSCoding( psCQMFDecoder->iNumBlocks, psCQMFDecoder->iNumBands, + psCQMFDecoder->piBandwidths, psCQMFDecoder->iMSMode, + (const int32_t *) psCQMFDecoder->piMSFlags, +#ifdef ENABLE_MS_PRED + (const int32_t *) psCQMFDecoder->piLRPhaseDiffs, + (const int32_t *) psCQMFDecoder->piMSPredCoefs, +#endif + pppfCQMFReal, pppfCQMFImag ); + } + + return 0; +} + +static void ApplyRMSEnvelope( const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t iNumGroups, + const int32_t *piGroupLengths, + int32_t **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag ) +{ + int32_t n; + int32_t iBlockOffset; + + iBlockOffset = 0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t b; + int32_t iFBOffset; + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + int32_t iRMSEnv; + float fGain; + + iRMSEnv = ppiRMSEnvelope[n][b]; + fGain = + c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER + iRMSEnv]; + for ( m = 0; m < piBandwidths[b]; m++ ) + { + ppfReal[iBlockOffset][iFBOffset] *= fGain; + ppfImag[iBlockOffset][iFBOffset] *= fGain; + iFBOffset++; + } + } + iBlockOffset++; + } + } +} + +static void ReplaceSign( const int32_t iNumBlocks, const int32_t iNumCQMFBands, int32_t **ppiSignReal, int32_t **ppiSignImag, float **ppfReal, float **ppfImag ) +{ + int32_t n; + for ( n = 0; n < iNumBlocks; n++ ) + { + int32_t b; + for ( b = 0; b < iNumCQMFBands; b++ ) + { + if ( ppiSignReal[n][b] == 1 ) + { + ppfReal[n][b] = -ppfReal[n][b]; + } + if ( ppiSignImag[n][b] == 1 ) + { + ppfImag[n][b] = -ppfImag[n][b]; + } + } + } +} + +static void InvQuantizeSpectrum( + const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + int32_t **ppiAlloc, + int32_t **ppiQReal, + int32_t **ppiQImag, + float **ppfReal, + float **ppfImag, + NoiseGen *psNoiseGen ) // Pass in NULL to swicth off noise gen +{ + int32_t n; + int32_t iBlockOffest; + + iBlockOffest = 0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t b; + int32_t iFBOffset; + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + int32_t iAlloc; + float fInvSCFGain; + + iAlloc = ppiAlloc[n][b]; + fInvSCFGain = c_afInvScaleFactor[iAlloc]; + + if ( iAlloc > 0 ) + { + for ( m = 0; m < piBandwidths[b]; m++ ) + { + int32_t iQuantValue; + + iQuantValue = ppiQReal[iBlockOffest][iFBOffset]; + ppfReal[iBlockOffest][iFBOffset] = (float) iQuantValue * fInvSCFGain; + + iQuantValue = ppiQImag[iBlockOffest][iFBOffset]; + ppfImag[iBlockOffest][iFBOffset] = (float) iQuantValue * fInvSCFGain; + + iFBOffset++; + } + } + else if ( psNoiseGen != NULL ) + { + for ( m = 0; m < piBandwidths[b]; m++ ) + { + ppfReal[iBlockOffest][iFBOffset] = 0.7f * GetNoise( psNoiseGen ); + ppfImag[iBlockOffest][iFBOffset] = 0.7f * GetNoise( psNoiseGen ); + + iFBOffset++; + } + } + else + { + iFBOffset += piBandwidths[b]; + } + } + + iBlockOffest++; + } + } +} + +static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, +#ifdef ENABLE_MS_PRED + const int32_t *piLRPhaseDiffs, + const int32_t *piMSPredCoefs, +#endif + float ***pppfReal, + float ***pppfImag ) +{ + if ( iMSMode > 0 ) + { + int32_t b; + int32_t iFBOffset; +#ifdef ENABLE_MS_PRED + int32_t bms = 0; +#if defined SIMPLE_PHASE + void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_m_pi_2, &rot_pm_pi, + &rot_p_pi_2 }; +#endif +#endif + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + if ( piMSFlags[b] == 1 ) + { + int32_t n; +#if defined ENABLE_MS_PRED && defined SIMPLE_PHASE + void ( *pFuncPhaseRotate )( float *, float * ) = + pFuncPhaseRotateOptions[piLRPhaseDiffs[bms]]; +#endif + for ( n = 0; n < piBandwidths[b]; n++ ) + { + int32_t k; + for ( k = 0; k < iNumBlocks; k++ ) + { + float fLeftReal; + float fLeftImag; + float fRightReal; + float fRightImag; +#ifdef ENABLE_MS_PRED + if ( iMSMode == 3 ) + { + float fPred; + fPred = dequantPred( piMSPredCoefs[bms] ); + pppfReal[1][k][iFBOffset] += fPred * pppfReal[0][k][iFBOffset]; + pppfImag[1][k][iFBOffset] += fPred * pppfImag[0][k][iFBOffset]; + } +#endif + fLeftReal = ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); + fLeftImag = ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); + fRightReal = + ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); + fRightImag = + ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); +#ifdef ENABLE_MS_PRED + if ( iMSMode == 3 ) + { +#ifdef SIMPLE_PHASE + ( *pFuncPhaseRotate )( &fRightReal, &fRightImag ); +#else + int32_t phaseIdx; + phaseIdx = piLRPhaseDiffs[bms] - PHASE_MIN_VAL; + cplxmult( &fRightReal, &fRightImag, c_afRotRealImag[phaseIdx][0], + -c_afRotRealImag[phaseIdx][1] ); +#endif + } +#endif + pppfReal[0][k][iFBOffset] = fLeftReal; + pppfReal[1][k][iFBOffset] = fRightReal; + pppfImag[0][k][iFBOffset] = fLeftImag; + pppfImag[1][k][iFBOffset] = fRightImag; + } + iFBOffset++; + } +#ifdef ENABLE_MS_PRED + bms++; +#endif + } + else + { + iFBOffset += piBandwidths[b]; + } + } + } +} + +/* Currently only the number of bands in frame */ +static int32_t ReadHeaderInformation( int32_t *piNumBands, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsRead; + + iBitsRead = 0; + *piNumBands = ivas_split_rend_bitstream_read_int32( pBits, 5 ); + iBitsRead += 5; + + return iBitsRead; +} + +static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, +#ifdef ENABLE_MS_PRED + int32_t *piLRPhaseDiffs, + int32_t *piMSPredCoefs, +#endif + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsRead; + + iBitsRead = 0; + *piMSMode = ivas_split_rend_bitstream_read_int32( pBits, 2 ); + iBitsRead += 2; + + if ( *piMSMode == 0 ) + { + int32_t n; + for ( n = 0; n < iNumBands; n++ ) + { + piMSFlags[n] = 0; + } + } + else if ( *piMSMode == 1 ) + { + int32_t n; + for ( n = 0; n < iNumBands; n++ ) + { + piMSFlags[n] = 1; + } + } + else if ( *piMSMode == 2 ) + { + int32_t n; + for ( n = 0; n < iNumBands; n++ ) + { + piMSFlags[n] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + } + } +#ifdef ENABLE_MS_PRED + else if ( *piMSMode == 3 ) + { + int32_t n; + int32_t iMSPredAll; + int32_t iNumMSPredBands = 0; + int32_t anyNonZero; + iMSPredAll = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + if ( iMSPredAll ) + { + iNumMSPredBands = iNumBands; + for ( n = 0; n < iNumBands; n++ ) + { + piMSFlags[n] = 1; + } + } + else + { + for ( n = 0; n < iNumBands; n++ ) + { + piMSFlags[n] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + if ( piMSFlags[n] ) + { + iNumMSPredBands++; + } + } + } + anyNonZero = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + if ( anyNonZero ) + { +#ifdef SIMPLE_PHASE + for ( n = 0; n < iNumMSPredBands; n++ ) + { + piLRPhaseDiffs[n] = BSGetBits( psBSRead, SIMPLE_PHASE_BITS ); + iBitsRead += SIMPLE_PHASE_BITS; + } +#else + piLRPhaseDiffs[0] = ivas_split_rend_bitstream_read_int32( pBits, PHASE_BAND0_BITS ); + piLRPhaseDiffs[0] += PHASE_MIN_VAL; + iBitsRead += PHASE_BAND0_BITS; + for ( n = 1; n < iNumMSPredBands; n++ ) + { + int32_t tabIdx; + iBitsRead += ReadHuff( c_aaiRMSEnvHuffDec, &tabIdx, pBits ); + piLRPhaseDiffs[n] = tabIdx + ENV_DELTA_MIN; + } + DecodePhase( piLRPhaseDiffs, iNumMSPredBands, PHASE_DIFF_DIM ); +#endif + } + else + { + for ( n = 0; n < iNumMSPredBands; n++ ) + { + piLRPhaseDiffs[n] = 0; + } + } + anyNonZero = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + if ( anyNonZero ) + { + piMSPredCoefs[0] = ivas_split_rend_bitstream_read_int32( pBits, PRED_BAND0_BITS ); + piMSPredCoefs[0] += PRED_MIN_VAL; + iBitsRead += PRED_BAND0_BITS; + for ( n = 1; n < iNumMSPredBands; n++ ) + { + int32_t tabIdx; + iBitsRead += ReadHuff( c_aaiRMSEnvHuffDec, &tabIdx, pBits ); + piMSPredCoefs[n] = tabIdx + ENV_DELTA_MIN; + } + DecodePredCoef( piMSPredCoefs, iNumMSPredBands ); + } + else + { + for ( n = 0; n < iNumMSPredBands; n++ ) + { + piMSPredCoefs[n] = 0; + } + } +#ifdef DEBUG_WRITE_MS_PRED + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "ms_mode_dec.txt", "wt" ); + } + writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSPredBands, + iNumBands, fid, piMSFlags ); + } +#endif + } +#endif + else + { + printf( "ERROR UNSUPPORTED MS MODE\n" ); + } + + return iBitsRead; +} + +static int32_t +ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t *piCommonGrouping, int32_t *piNumGroups, int32_t **ppiGroupLengths, ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsRead; + + iBitsRead = 0; + if ( iChannels == 2 ) + { + *piCommonGrouping = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + + if ( *piCommonGrouping == 1 ) + { + int32_t k; + + piNumGroups[0] = 0; + ppiGroupLengths[0][piNumGroups[0]] = 1; + for ( k = 0; k < ( iNumBlocks - 1 ); k++ ) + { + int32_t iGroupStart; + + iGroupStart = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + + if ( iGroupStart == 1 ) + { + piNumGroups[0]++; + ppiGroupLengths[0][piNumGroups[0]] = 1; + } + else + { + ppiGroupLengths[0][piNumGroups[0]]++; + } + } + piNumGroups[0]++; + + piNumGroups[1] = piNumGroups[0]; + for ( k = 0; k < piNumGroups[1]; k++ ) + { + ppiGroupLengths[1][k] = ppiGroupLengths[0][k]; + } + } + else + { + int32_t c; + + for ( c = 0; c < iChannels; c++ ) + { + int32_t k; + + piNumGroups[c] = 0; + ppiGroupLengths[c][piNumGroups[c]] = 1; + for ( k = 0; k < ( iNumBlocks - 1 ); k++ ) + { + int32_t iGroupStart; + + iGroupStart = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + + if ( iGroupStart == 1 ) + { + piNumGroups[c]++; + ppiGroupLengths[c][piNumGroups[c]] = 1; + } + else + { + ppiGroupLengths[c][piNumGroups[c]]++; + } + } + piNumGroups[c]++; + } + } + } + else + { + int32_t c; + + for ( c = 0; c < iChannels; c++ ) + { + int32_t k; + + piNumGroups[c] = 0; + ppiGroupLengths[c][piNumGroups[c]] = 1; + for ( k = 0; k < ( iNumBlocks - 1 ); k++ ) + { + int32_t iGroupStart; + + iGroupStart = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + + if ( iGroupStart == 1 ) + { + piNumGroups[c]++; + ppiGroupLengths[c][piNumGroups[c]] = 1; + } + else + { + ppiGroupLengths[c][piNumGroups[c]]++; + } + } + piNumGroups[c]++; + } + } + + return iBitsRead; +} + +static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE], + int32_t *piSymbol, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsRead; + int32_t iSymbol; + int32_t iIndex; + int32_t iVal; + + iVal = 0; + iIndex = 0; + iSymbol = 0xFFFF; + iBitsRead = 0; + while ( iSymbol == 0xFFFF ) + { + iIndex = ivas_split_rend_bitstream_read_int32( pBits, HUFF_READ_SIZE ); + iBitsRead += HUFF_READ_SIZE; + + iIndex = pauiHuffDecTable[iVal][iIndex]; + iSymbol = ( iIndex & 0xFFFF ); + + iVal = ( iIndex >> 16 ); + } + + if ( iVal ) + { + BSForceBack( + pBits, + iIndex, iVal ); + iBitsRead -= iVal; + } + + *piSymbol = iSymbol; + + return iBitsRead; +} + +static int32_t ReadRMSEnvelope( const int32_t iChannels, + const int32_t *piNumGroups, + const int32_t iNumBands, + int32_t ***pppiRMSEnvelope, + ivas_split_rend_bits_t *pBits ) +{ + int32_t n; + int32_t iBitsRead; + + iBitsRead = 0; + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < piNumGroups[n]; k++ ) + { + int32_t b; + int32_t iLastRMSVal; + + iLastRMSVal = ivas_split_rend_bitstream_read_int32( pBits, ENV0_BITS ); + iBitsRead += ENV0_BITS; + + iLastRMSVal += ENV_MIN; + pppiRMSEnvelope[n][k][0] = iLastRMSVal; + for ( b = 1; b < iNumBands; b++ ) + { + int32_t iDelta; + + iBitsRead += ReadHuff( c_aaiRMSEnvHuffDec, &iDelta, pBits ); + + iDelta += ENV_DELTA_MIN; + iLastRMSVal += iDelta; + pppiRMSEnvelope[n][k][b] = iLastRMSVal; + } + } + } + + return iBitsRead; +} + +#ifdef ENABLE_PMOD_ADJUST +static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, Bitstream *psBSRead, int32_t iChannels, int32_t iNumBands ) +{ + int32_t iBitsRead; + int32_t c; + iBitsRead = 0; + for ( c = 0; c < iChannels; c++ ) + { + int32_t b; + int32_t iFlags = BSGetBits( psBSRead, 1 ); + iBitsRead += 1; + if ( iFlags ) + { + for ( b = 0; b < iNumBands; b++ ) + { + ppiHiSMRFlags[c][b] = BSGetBits( psBSRead, 1 ); + ; + iBitsRead += 1; + } + } + else + { + for ( b = 0; b < iNumBands; b++ ) + { + ppiHiSMRFlags[c][b] = 0; + } + } + } +#ifdef WRITE_HISMR_FLAGS + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "hismr_dec.txt", "wt" ); + } + for ( c = 0; c < iChannels; c++ ) + { + int32_t b; + for ( b = 0; b < iNumBands; b++ ) + { + if ( c == iChannels - 1 && b == iNumBands - 1 ) + { + fprintf( fid, "%d\n", ppiHiSMRFlags[c][b] ); + } + else + { + fprintf( fid, "%d ", ppiHiSMRFlags[c][b] ); + } + } + } + } +#endif + return iBitsRead; +} +#endif + +static int32_t ReadAllocInformation( int32_t *piAllocOffset, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsRead; + + iBitsRead = 0; + *piAllocOffset = ivas_split_rend_bitstream_read_int32( pBits, ALLOC_OFFSET_BITS ); + *piAllocOffset += MIN_ALLOC_OFFSET; + iBitsRead += ALLOC_OFFSET_BITS; + + return iBitsRead; +} + +static int32_t +ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits ) +{ + int32_t n; + int32_t iBitsRead; + int32_t iBlockOffest; + + iBitsRead = 0; + iBlockOffest = 0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t b; + int32_t iFBOffset; + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + int32_t iAlloc; + int32_t iHuffDim; + int32_t iHuffMod; + + iAlloc = ppiAlloc[n][b]; + + iHuffDim = c_aiHuffmanDim[iAlloc]; + iHuffMod = c_aiHuffmanMod[iAlloc]; + + if ( iAlloc > 0 ) + { + const uint32_t( *pauiHuffmanTable )[HUFF_DEC_TABLE_SIZE] = NULL; + const uint32_t( *pauiHuffmanTableDPCM )[HUFF_DEC_TABLE_SIZE] = NULL; +#ifdef USE_DEMOD_TABLES + const int32_t( *paiDemodTable )[2] = NULL; +#endif + + pauiHuffmanTable = c_apauiHuffDecTables[iAlloc]; + pauiHuffmanTableDPCM = + c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; +#ifdef USE_DEMOD_TABLES + paiDemodTable = c_apaiDemodTables[iAlloc]; +#endif + for ( m = 0; m < piBandwidths[b]; m++ ) + { + int32_t iQuantValue1 = 0; + int32_t iQuantValue2 = 0; + + if ( piPredEnable[iFBOffset] == 1 ) + { + if ( iHuffDim == 2 ) + { + int32_t iSymbol; + iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iSymbol, pBits ); +#ifdef USE_DEMOD_TABLES + iQuantValue1 = paiDemodTable[iSymbol][0]; + iQuantValue2 = paiDemodTable[iSymbol][1]; +#else + iQuantValue1 = iSymbol / iHuffMod; + iQuantValue2 = iSymbol % iHuffMod; +#endif + } + else + { + iBitsRead += + ReadHuff( pauiHuffmanTableDPCM, &iQuantValue1, + pBits ); + iBitsRead += + ReadHuff( pauiHuffmanTableDPCM, &iQuantValue2, + pBits ); + } + } + else + { + if ( iHuffDim == 2 ) + { + int32_t iSymbol; + + iBitsRead += ReadHuff( pauiHuffmanTable, &iSymbol, + pBits ); +#ifdef USE_DEMOD_TABLES + iQuantValue1 = paiDemodTable[iSymbol][0]; + iQuantValue2 = paiDemodTable[iSymbol][1]; +#else + iQuantValue1 = iSymbol / iHuffMod; + iQuantValue2 = iSymbol % iHuffMod; +#endif + } + else + { + iBitsRead += + ReadHuff( pauiHuffmanTable, &iQuantValue1, + pBits ); + iBitsRead += + ReadHuff( pauiHuffmanTable, &iQuantValue2, + pBits ); + } + } + + ppiQReal[iBlockOffest][iFBOffset] = iQuantValue1; + ppiQImag[iBlockOffest][iFBOffset] = iQuantValue2; + + if ( iQuantValue1 > 0 ) + { + ppiSignReal[iBlockOffest][iFBOffset] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + } + if ( iQuantValue2 > 0 ) + { + ppiSignImag[iBlockOffest][iFBOffset] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + } + + iFBOffset++; + } + } + else + { + iFBOffset += piBandwidths[b]; + } + } + + iBlockOffest++; + } + } + + return iBitsRead; +} + +static void ComputeAllocation( const int32_t iChannels, + const int32_t *piNumGroups, + const int32_t iNumBands, + int32_t ***pppiSMR, + const int32_t iAllocOffset, + int32_t ***pppiAlloc ) +{ + int32_t n; + + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < piNumGroups[n]; k++ ) + { + int32_t b; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t iAlloc; + iAlloc = ( ( pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE ) >> 5 ); + iAlloc = ( iAlloc > MIN_ALLOC ) ? iAlloc : MIN_ALLOC; + iAlloc = ( iAlloc < MAX_ALLOC ) ? iAlloc : MAX_ALLOC; + pppiAlloc[n][k][b] = iAlloc; + } + } + } +} diff --git a/lib_rend/ivas_CQMFDecoder.h b/lib_rend/ivas_CQMFDecoder.h new file mode 100644 index 0000000000..a68c2451fb --- /dev/null +++ b/lib_rend/ivas_CQMFDecoder.h @@ -0,0 +1,64 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_CQMF_DECODER_H_ +#define _IVAS_CQMF_DECODER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "lib_rend.h" +#define DECODER_ERROR_NONE ( 0 ) +#define DECODER_ERROR_FS_NOT_SUPPORTED ( -1 ) +#define DECODER_ERROR_CHAN_NOT_SUPPORTED ( -2 ) +#define DECODER_ERROR_UNKNOWN ( -100 ) + + typedef struct CQMF_DECODER CQMFDecoder; + + CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate, + const int32_t iChannels ); + + void DeleteCQMFDecoder( CQMFDecoder *psCQMFDecoder ); + + int32_t CQMFDecoderGetError( CQMFDecoder *psCQMFDecoder ); + + int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, + ivas_split_rend_bits_t *pBits, + float ***pppfCQMFReal, + float ***pppfCQMFImag ); + +#ifdef __cplusplus +} +#endif + +#endif /* _CQMF_DECODER_H_ */ diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c new file mode 100644 index 0000000000..3f2906e7d5 --- /dev/null +++ b/lib_rend/ivas_CQMFEncoder.c @@ -0,0 +1,2050 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_CQMFEncoder.h" + +#include +#include +#include +#include +#include "ivas_Tables.h" +#include "options.h" +#include "prot.h" +#include "wmops.h" +#include "ivas_RMSEnvGrouping.h" +#include "ivas_PerceptualModel.h" +#include "ivas_RMSEnvDeltaHuff.h" +#include "ivas_CQMFHuff.h" +#include "ivas_cldfb_codec_bitstream.h" +#include "ivas_lib_rend_internal.h" +#ifdef ENABLE_MS_PRED +#include "ivas_MSPred.h" +#endif +#ifdef ENABLE_PMOD_ADJUST +#include "ton_corr.h" +#endif + +#include "ivas_PredEncoder.h" + +struct CQMF_ENCODER +{ + int32_t iSampleRate; + int32_t iChannels; + int32_t iNumBlocks; + + int32_t iTargetBitRate; + int32_t iTargetBitsPerFrame; + + int32_t iNumBands; + const int32_t *piBandwidths; + + int32_t iMSMode; + int32_t *piMSFlags; +#ifdef ENABLE_MS_PRED + int32_t piMSPredCoefs[MAX_BANDS]; + int32_t piLRPhaseDiffs[MAX_BANDS]; + int32_t iAllowSidePred; +#endif +#ifdef ENABLE_PMOD_ADJUST + int32_t **ppiHiSMRFlags; +#endif + + RMSEnvelopeGrouping *psRMSEnvelopeGrouping; + + int32_t iCommonGrouping; + int32_t *piNumGroups; + int32_t **ppiGroupLengths; + + int32_t ***pppiRMSEnvelope; + int32_t ***pppiSMR; + int32_t ***pppiExcitation; + int32_t ***pppiAlloc; + + int32_t iAllocOffset; + + int32_t ***pppiCQMFSignReal; + int32_t ***pppiCQMFSignImag; + int32_t ***pppiQCQMFReal; + int32_t ***pppiQCQMFImag; + + + PredictionEncoder *psPredictionEncoder; + int32_t iLastError; +}; + +CQMFEncoder *CreateCQMFEncoder( const int32_t iSampleRate, + const int32_t iChannels, + const int32_t iTargetBitRate, + const int32_t iAllowSidePred ) +{ + int32_t n; + CQMFEncoder *psCQMFEncoder = NULL; + + assert( iSampleRate == 48000 ); // Fix + + psCQMFEncoder = (CQMFEncoder *) count_malloc( sizeof( CQMFEncoder ) ); + psCQMFEncoder->iSampleRate = iSampleRate; + psCQMFEncoder->iChannels = iChannels; + psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; + psCQMFEncoder->iAllocOffset = 0; + + psCQMFEncoder->iTargetBitRate = iTargetBitRate; + psCQMFEncoder->iTargetBitsPerFrame = iTargetBitRate * CQMF_BLOCKS_PER_FRAME * CQMF_BANDS / iSampleRate; + + psCQMFEncoder->iNumBands = MAX_BANDS_48; // Fix + psCQMFEncoder->piBandwidths = c_aiBandwidths48; // Fix + + psCQMFEncoder->iMSMode = 0; + psCQMFEncoder->piMSFlags = (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); +#ifdef ENABLE_MS_PRED + for ( n = 0; n < MAX_BANDS; n++ ) + { + psCQMFEncoder->piLRPhaseDiffs[n] = 0; + psCQMFEncoder->piMSPredCoefs[n] = 0; + } + psCQMFEncoder->iAllowSidePred = iAllowSidePred; +#endif + psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psCQMFEncoder->iNumBlocks ); + + psCQMFEncoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo + psCQMFEncoder->piNumGroups = (int32_t *) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ) ); + psCQMFEncoder->ppiGroupLengths = (int32_t **) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ); + psCQMFEncoder->pppiRMSEnvelope = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + psCQMFEncoder->pppiSMR = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + psCQMFEncoder->pppiExcitation = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + psCQMFEncoder->pppiAlloc = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + + psCQMFEncoder->pppiCQMFSignReal = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + psCQMFEncoder->pppiCQMFSignImag = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + psCQMFEncoder->pppiQCQMFReal = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); + psCQMFEncoder->pppiQCQMFImag = (int32_t ***) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t ** ) ); +#ifdef ENABLE_PMOD_ADJUST + psCQMFEncoder->ppiHiSMRFlags = (int32_t **) count_malloc( psCQMFEncoder->iChannels * sizeof( int32_t * ) ); +#endif + + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; +#ifdef ENABLE_PMOD_ADJUST + psCQMFEncoder->ppiHiSMRFlags[n] = (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + ; +#endif + psCQMFEncoder->ppiGroupLengths[n] = (int32_t *) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t ) ); + psCQMFEncoder->pppiRMSEnvelope[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFEncoder->pppiSMR[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFEncoder->pppiExcitation[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFEncoder->pppiAlloc[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + + psCQMFEncoder->pppiCQMFSignReal[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFEncoder->pppiCQMFSignImag[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFEncoder->pppiQCQMFReal[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + psCQMFEncoder->pppiQCQMFImag[n] = (int32_t **) count_malloc( CQMF_BLOCKS_PER_FRAME * sizeof( int32_t * ) ); + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + psCQMFEncoder->pppiRMSEnvelope[n][k] = (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + psCQMFEncoder->pppiSMR[n][k] = (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + psCQMFEncoder->pppiExcitation[n][k] = (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + psCQMFEncoder->pppiAlloc[n][k] = (int32_t *) count_malloc( MAX_BANDS * sizeof( int32_t ) ); + + psCQMFEncoder->pppiCQMFSignReal[n][k] = (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + psCQMFEncoder->pppiCQMFSignImag[n][k] = (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + psCQMFEncoder->pppiQCQMFReal[n][k] = (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + psCQMFEncoder->pppiQCQMFImag[n][k] = (int32_t *) count_malloc( CQMF_BANDS * sizeof( int32_t ) ); + } + } + + psCQMFEncoder->psPredictionEncoder = CreatePredictionEncoder( iChannels, psCQMFEncoder->iNumBlocks ); + psCQMFEncoder->iLastError = ENCODER_ERROR_NONE; + + return psCQMFEncoder; +} + +void DeleteCQMFEncoder( CQMFEncoder *psCQMFEncoder ) +{ + if ( psCQMFEncoder != NULL ) + { + + if ( psCQMFEncoder->piMSFlags != NULL ) + { + count_free( psCQMFEncoder->piMSFlags ); + } + + if ( psCQMFEncoder->piNumGroups != NULL ) + { + count_free( psCQMFEncoder->piNumGroups ); + } + + if ( psCQMFEncoder->psRMSEnvelopeGrouping != NULL ) + { + DeleteRMSEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping ); + } + + if ( psCQMFEncoder->ppiGroupLengths != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + count_free( psCQMFEncoder->ppiGroupLengths[n] ); + } + count_free( psCQMFEncoder->ppiGroupLengths ); + } +#ifdef ENABLE_PMOD_ADJUST + if ( psCQMFEncoder->ppiHiSMRFlags != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + count_free( psCQMFEncoder->ppiHiSMRFlags[n] ); + } + count_free( psCQMFEncoder->ppiHiSMRFlags ); + } +#endif + if ( psCQMFEncoder->pppiRMSEnvelope != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiRMSEnvelope[n][k] ); + } + count_free( psCQMFEncoder->pppiRMSEnvelope[n] ); + } + count_free( psCQMFEncoder->pppiRMSEnvelope ); + } + + if ( psCQMFEncoder->pppiSMR != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiSMR[n][k] ); + } + count_free( psCQMFEncoder->pppiSMR[n] ); + } + count_free( psCQMFEncoder->pppiSMR ); + } + + if ( psCQMFEncoder->pppiExcitation != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiExcitation[n][k] ); + } + count_free( psCQMFEncoder->pppiExcitation[n] ); + } + count_free( psCQMFEncoder->pppiExcitation ); + } + + if ( psCQMFEncoder->pppiAlloc != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiAlloc[n][k] ); + } + count_free( psCQMFEncoder->pppiAlloc[n] ); + } + count_free( psCQMFEncoder->pppiAlloc ); + } + + if ( psCQMFEncoder->pppiCQMFSignReal != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiCQMFSignReal[n][k] ); + } + count_free( psCQMFEncoder->pppiCQMFSignReal[n] ); + } + count_free( psCQMFEncoder->pppiCQMFSignReal ); + } + + if ( psCQMFEncoder->pppiCQMFSignImag != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiCQMFSignImag[n][k] ); + } + count_free( psCQMFEncoder->pppiCQMFSignImag[n] ); + } + count_free( psCQMFEncoder->pppiCQMFSignImag ); + } + + if ( psCQMFEncoder->pppiQCQMFReal != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiQCQMFReal[n][k] ); + } + count_free( psCQMFEncoder->pppiQCQMFReal[n] ); + } + count_free( psCQMFEncoder->pppiQCQMFReal ); + } + + if ( psCQMFEncoder->pppiQCQMFImag != NULL ) + { + int32_t n; + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < CQMF_BLOCKS_PER_FRAME; k++ ) + { + count_free( psCQMFEncoder->pppiQCQMFImag[n][k] ); + } + count_free( psCQMFEncoder->pppiQCQMFImag[n] ); + } + count_free( psCQMFEncoder->pppiQCQMFImag ); + } + + + DeletePredictionEncoder( psCQMFEncoder->psPredictionEncoder ); + count_free( psCQMFEncoder ); + } +} + +int32_t CQMFEncoderGetError( CQMFEncoder *psCQMFEncoder ) +{ + return psCQMFEncoder->iLastError; +} + +static int32_t MSModeCalculation( const int32_t iNumBlocks, + const int32_t iNumBands, + const int32_t *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int32_t *piMSMode, +#ifdef ENABLE_MS_PRED + int32_t *piLRPhaseDiff, + int32_t *piMSPredCoef, + const int32_t iAllowSidePred, +#endif + int32_t *piMSFlags ); + +static void RemoveRMSEnvelope( const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t iNumGroups, + const int32_t *piGroupLengths, + int32_t **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag ); + + +static int32_t CountCQMFBits( const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t *piPredEnable, + int32_t **ppiAlloc, + int32_t **ppiQReal, + int32_t **ppiQImag ); + +/* Currently only the number of bands in frame */ +static int32_t WriteHeaderInformation( const int32_t iNumBands, + ivas_split_rend_bits_t *pBits ); + +static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, + Bitstream *psBSWrite, + int32_t iChannels, + int32_t iNumBands ); + +static int32_t WriteMSInformation( const int32_t iNumBands, + const int32_t iMSMode, + const int32_t *piMSFlags, +#ifdef ENABLE_MS_PRED + const int32_t *piLRPhaseDiffs, + const int32_t *piMSPredCoefs, + int32_t iNumMSPredBands, +#endif + ivas_split_rend_bits_t *pBits ); + +static int32_t WriteGroupInformation( const int32_t iChannels, + const int32_t iCommonGrouping, + const int32_t *piNumGroups, + int32_t **ppiGroupLengths, + ivas_split_rend_bits_t *pBits ); + +static int32_t WriteRMSEnvelope( const int32_t iChannels, + const int32_t *piNumGroups, + const int32_t iNumBands, + int32_t ***pppiRMSEnvelope, + ivas_split_rend_bits_t *pBits ); + +static int32_t WriteAllocInformation( const int32_t iAllocOffset, + ivas_split_rend_bits_t *pBits ); + +static int32_t WriteCQMFData( const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t *piPredEnable, + int32_t **ppiAlloc, + int32_t **ppiSignReal, + int32_t **ppiSignImag, + int32_t **ppiQReal, + int32_t **ppiQImag, + ivas_split_rend_bits_t *pBits ); + +static int32_t ComputeAllocation( const int32_t iChannels, + const int32_t *piNumGroups, + int32_t **ppiGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int32_t ***pppiSMR, + const int32_t iAvailableBits, + int32_t *piAllocOffset, + int32_t ***pppiAlloc, + int32_t ***pppiQReal, + int32_t ***pppiQImag, + int32_t ***pppiSignReal, + int32_t ***pppiSignImag, + int32_t **ppiPredEnable, + float **ppfA1Real, + float **ppfA1Imag ); + +int32_t EncodeFrame( CQMFEncoder *psCQMFEncoder, float ***pppfCQMFReal, float ***pppfCQMFImag, int32_t *piBitsWritten, const int32_t available_bits, ivas_split_rend_bits_t *pBits ) +{ + int32_t n; + int32_t iAvailableBits, iBitsWritten; + // int32_t iCQMFBits; + int32_t iNumMSBands = 0; + iAvailableBits = available_bits; // HCBR for now + iBitsWritten = 0; + + /* Do MS calc here */ + if ( psCQMFEncoder->iChannels == 2 ) + { + iNumMSBands = MSModeCalculation( psCQMFEncoder->iNumBlocks, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + pppfCQMFReal, + pppfCQMFImag, + &psCQMFEncoder->iMSMode, +#ifdef ENABLE_MS_PRED + psCQMFEncoder->piLRPhaseDiffs, + psCQMFEncoder->piMSPredCoefs, + psCQMFEncoder->iAllowSidePred, +#endif + psCQMFEncoder->piMSFlags ); + + if ( psCQMFEncoder->iMSMode > 0 ) + { + psCQMFEncoder->iCommonGrouping = 1; // Make sure common grouping is enabled when MS is in use + } + } + +#ifdef ENABLE_PMOD_ADJUST + CalcTonQuotas( psCQMFEncoder->iChannels, psCQMFEncoder->iNumBands, psCQMFEncoder->piBandwidths, pppfCQMFReal, pppfCQMFImag, psCQMFEncoder->ppiHiSMRFlags ); +#endif + + /* Compute Grouping and RMS Envelopes */ + if ( psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1 ) + { + ComputeEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + pppfCQMFReal, + pppfCQMFImag, +#ifndef USE_BIT_COUNT_MERGE_COST + 8.0, + 20.0, // Use these to trade off RMS Env bits and quantizer loading +#endif + &psCQMFEncoder->piNumGroups[0], + psCQMFEncoder->ppiGroupLengths[0], + psCQMFEncoder->pppiRMSEnvelope ); + + psCQMFEncoder->piNumGroups[1] = psCQMFEncoder->piNumGroups[0]; + for ( n = 0; n < psCQMFEncoder->piNumGroups[0]; n++ ) + { + psCQMFEncoder->ppiGroupLengths[1][n] = psCQMFEncoder->ppiGroupLengths[0][n]; + } + } + else + { + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + ComputeEnvelopeGrouping( psCQMFEncoder->psRMSEnvelopeGrouping, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + &pppfCQMFReal[n], + &pppfCQMFImag[n], +#ifndef USE_BIT_COUNT_MERGE_COST + 8.0, + 20.0, // Use these to trade off RMS Env bits and quantizer loading +#endif + &psCQMFEncoder->piNumGroups[n], + psCQMFEncoder->ppiGroupLengths[n], + &psCQMFEncoder->pppiRMSEnvelope[n] ); + } + } + + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + RemoveRMSEnvelope( psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + psCQMFEncoder->piNumGroups[n], + (const int32_t *) psCQMFEncoder->ppiGroupLengths[n], + psCQMFEncoder->pppiRMSEnvelope[n], + pppfCQMFReal[n], + pppfCQMFImag[n] ); + } + + ComputePredictors( psCQMFEncoder->psPredictionEncoder, + pppfCQMFReal, + pppfCQMFImag ); + + iBitsWritten += WriteHeaderInformation( psCQMFEncoder->iNumBands, + pBits ); + + if ( psCQMFEncoder->iChannels == 2 ) + { + iBitsWritten += WriteMSInformation( psCQMFEncoder->iNumBands, + psCQMFEncoder->iMSMode, + (const int32_t *) psCQMFEncoder->piMSFlags, +#ifdef ENABLE_MS_PRED + (const int32_t *) psCQMFEncoder->piLRPhaseDiffs, + (const int32_t *) psCQMFEncoder->piMSPredCoefs, + iNumMSBands, +#endif + pBits ); + } + + + iBitsWritten += WritePredictors( psCQMFEncoder->psPredictionEncoder, + pBits ); + + iBitsWritten += WriteGroupInformation( psCQMFEncoder->iChannels, + psCQMFEncoder->iCommonGrouping, + (const int32_t *) psCQMFEncoder->piNumGroups, + psCQMFEncoder->ppiGroupLengths, + pBits ); + + iBitsWritten += WriteRMSEnvelope( psCQMFEncoder->iChannels, + (const int32_t *) psCQMFEncoder->piNumGroups, + psCQMFEncoder->iNumBands, + psCQMFEncoder->pppiRMSEnvelope, + pBits ); + +#ifdef ENABLE_PMOD_ADJUST + iBitsWritten += WritePmodInformation( psCQMFEncoder->ppiHiSMRFlags, + psCQMFEncoder->psBSWrite, + psCQMFEncoder->iChannels, + psCQMFEncoder->iNumBands ); +#endif + + if ( psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1 ) + { + int32_t k; + for ( k = 0; k < psCQMFEncoder->piNumGroups[0]; k++ ) + { + PerceptualModelStereo( psCQMFEncoder->iNumBands, + psCQMFEncoder->piMSFlags, + psCQMFEncoder->pppiRMSEnvelope[0][k], + psCQMFEncoder->pppiRMSEnvelope[1][k], + psCQMFEncoder->pppiExcitation[0][k], + psCQMFEncoder->pppiExcitation[1][k], + psCQMFEncoder->pppiSMR[0][k], + psCQMFEncoder->pppiSMR[1][k] ); + } + } + else + { + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < psCQMFEncoder->piNumGroups[n]; k++ ) + { + PerceptualModel( psCQMFEncoder->iNumBands, + psCQMFEncoder->pppiRMSEnvelope[n][k], + psCQMFEncoder->pppiExcitation[n][k], + psCQMFEncoder->pppiSMR[n][k] ); + } + } + } + + iAvailableBits -= iBitsWritten; + ComputeAllocation( psCQMFEncoder->iChannels, + (const int32_t *) psCQMFEncoder->piNumGroups, + psCQMFEncoder->ppiGroupLengths, + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + pppfCQMFReal, + pppfCQMFImag, + psCQMFEncoder->pppiSMR, + iAvailableBits, + &psCQMFEncoder->iAllocOffset, + psCQMFEncoder->pppiAlloc, + psCQMFEncoder->pppiQCQMFReal, + psCQMFEncoder->pppiQCQMFImag, + psCQMFEncoder->pppiCQMFSignReal, + psCQMFEncoder->pppiCQMFSignImag, + psCQMFEncoder->psPredictionEncoder->ppiPredBandEnable, + psCQMFEncoder->psPredictionEncoder->ppfA1Real, + psCQMFEncoder->psPredictionEncoder->ppfA1Imag ); + + iBitsWritten += WriteAllocInformation( psCQMFEncoder->iAllocOffset, + pBits ); + + for ( n = 0; n < psCQMFEncoder->iChannels; n++ ) + { + iBitsWritten += WriteCQMFData( psCQMFEncoder->piNumGroups[n], + (const int32_t *) psCQMFEncoder->ppiGroupLengths[n], + psCQMFEncoder->iNumBands, + psCQMFEncoder->piBandwidths, + (const int32_t *) psCQMFEncoder->psPredictionEncoder->ppiPredBandEnable[n], + psCQMFEncoder->pppiAlloc[n], + psCQMFEncoder->pppiCQMFSignReal[n], + psCQMFEncoder->pppiCQMFSignImag[n], + psCQMFEncoder->pppiQCQMFReal[n], + psCQMFEncoder->pppiQCQMFImag[n], + pBits ); + } + *piBitsWritten = iBitsWritten; + return 0; +} + +int32_t GetNumGroups( CQMFEncoder *psCQMFEncoder ) +{ + return psCQMFEncoder->piNumGroups[0]; +} + +static int32_t MSModeCalculation( const int32_t iNumBlocks, + const int32_t iNumBands, + const int32_t *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int32_t *piMSMode, +#ifdef ENABLE_MS_PRED + int32_t *piLRPhaseDiffs, + int32_t *piMSPredCoefs, + const int32_t iAllowSidePred, +#endif + int32_t *piMSFlags ) +{ + int32_t b; + int32_t iFBOffset; + int32_t iNumMSBands; +#ifdef ENABLE_MS_PRED + int32_t piMSPredFlags[MAX_BANDS] = { 0 }; + int32_t iNumMSPredBands = 0; + float msBitsReduction = 0.0f; + float msPredBitsReduction = 0.0f; + int32_t msBits; + int32_t msPredBits; + float fPred; +#if defined ENABLE_MS_PRED && defined SIMPLE_PHASE + void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_p_pi_2, &rot_pm_pi, &rot_m_pi_2 }; +#endif + const float one_by_log10_2 = 3.32192809488736f; +#endif + *piMSMode = 0; + iFBOffset = 0; + iNumMSBands = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t n; + float fLeftEnergy; + float fRightEnergy; + float fMidEnergy; + float fSideEnergy; + float fLRRatio; + float fMSRatio; +#ifdef ENABLE_MS_PRED + float fMSPredRatio; + float fMidEnergyPred; + float fSideEnergyPred; + float fLRCovReal = 0.0f; + float fLRCovImag = 0.0f; + int32_t iPhase; + int32_t iPred; + int32_t tabIdx = 0; +#endif + + fLeftEnergy = 0.0f; + fRightEnergy = 0.0f; + fMidEnergy = 0.0; + fSideEnergy = 0.0; + + for ( n = 0; n < piBandwidths[b]; n++ ) + { + int32_t k; + for ( k = 0; k < iNumBlocks; k++ ) + { + float fMidReal; + float fMidImag; + float fSideReal; + float fSideImag; + + fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); + fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); + fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); + fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); + + fLeftEnergy += ( pppfReal[0][k][iFBOffset] * pppfReal[0][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[0][k][iFBOffset] ); + fRightEnergy += ( pppfReal[1][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[1][k][iFBOffset] * pppfImag[1][k][iFBOffset] ); + fMidEnergy += ( fMidReal * fMidReal + fMidImag * fMidImag ); + fSideEnergy += ( fSideReal * fSideReal + fSideImag * fSideImag ); + +#ifdef ENABLE_MS_PRED + fLRCovReal += ( pppfReal[0][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[1][k][iFBOffset] ); + fLRCovImag += ( pppfImag[0][k][iFBOffset] * pppfReal[1][k][iFBOffset] - pppfImag[1][k][iFBOffset] * pppfReal[0][k][iFBOffset] ); +#endif + } + + iFBOffset++; + } +#ifdef ENABLE_MS_PRED + /* compute L/R phase difference if high coherence */ + if ( fLRCovReal * fLRCovReal + fLRCovImag * fLRCovImag > 0.5f * fLeftEnergy * fRightEnergy ) + { + float fPhase = (float) atan2( fLRCovImag, fLRCovReal ); + iPhase = quantPhase( fPhase ); + } + else + { + iPhase = 0; + } + piLRPhaseDiffs[b] = iPhase; + + /* adjust covariance based on phase rotation */ +#ifdef SIMPLE_PHASE + cplxmult( &fLRCovReal, &fLRCovImag, c_afRotRealImagSimple[iPhase][0], -c_afRotRealImagSimple[iPhase][1] ); +#else + tabIdx = iPhase - PHASE_MIN_VAL; + cplxmult( &fLRCovReal, &fLRCovImag, c_afRotRealImag[tabIdx][0], -c_afRotRealImag[tabIdx][1] ); +#endif + /* compute MS prediction coefficient based on LR covariance*/ + fMidEnergyPred = 0.25f * ( fLeftEnergy + fRightEnergy + 2.0f * fLRCovReal ); + fSideEnergyPred = 0.25f * ( fLeftEnergy + fRightEnergy - 2.0f * fLRCovReal ); + + /* M/S prediction */ + fPred = fMidEnergyPred == 0.0f ? 0.0f : 0.25f * ( fLeftEnergy - fRightEnergy ) / fMidEnergyPred; + iPred = quantPred( fPred ); + fPred = dequantPred( iPred ); + piMSPredCoefs[b] = iPred; + + /* evaluation */ + fSideEnergyPred += ( fPred * fPred * fMidEnergyPred - 2.0f * fPred * 0.25f * ( fLeftEnergy - fRightEnergy ) ); + /* -= fPred * fPred * fMidEnergyPred doesn't work because fPred is quantized and does not match MS/MM exactly */ + fMSPredRatio = (float) log10f( ( fMidEnergyPred + 1e-12f ) / ( fSideEnergyPred + 1e-12f ) ); +#endif + fLeftEnergy = log10f( fLeftEnergy + 1e-12f ); + fRightEnergy = log10f( fRightEnergy + 1e-12f ); + fMidEnergy = log10f( fMidEnergy + 1e-12f ); + fSideEnergy = log10f( fSideEnergy + 1e-12f ); + + if ( fLeftEnergy > fRightEnergy ) + { + fLRRatio = fLeftEnergy - fRightEnergy; + } + else + { + fLRRatio = fRightEnergy - fLeftEnergy; + } + + if ( fMidEnergy > fSideEnergy ) + { + fMSRatio = fMidEnergy - fSideEnergy; + } + else + { + fMSRatio = fSideEnergy - fMidEnergy; + } + + if ( fMSRatio > fLRRatio ) + { + iNumMSBands++; + piMSFlags[b] = 1; + } + else + { + piMSFlags[b] = 0; + } +#ifdef ENABLE_MS_PRED + if ( fMSRatio > fLRRatio ) + { + float maskThresShift_dB_by_10 = ( fMSRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f; + msBitsReduction += (float) ( piBandwidths[b] * iNumBlocks * 2 ) * one_by_log10_2 * maskThresShift_dB_by_10; /* * 2 for real/imag */ + } + if ( fMSPredRatio > fLRRatio ) + { + float maskThresShift_dB_by_10 = ( fMSPredRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f; + msPredBitsReduction += (float) ( piBandwidths[b] * iNumBlocks * 2 ) * one_by_log10_2 * maskThresShift_dB_by_10; + iNumMSPredBands++; + piMSPredFlags[b] = 1; + } + else + { + piMSPredFlags[b] = 0; + } +#endif + } + +#ifdef ENABLE_MS_PRED + msPredBits = CountMSBits( iNumBands, 3, piMSPredFlags, piLRPhaseDiffs, piMSPredCoefs ); + msPredBitsReduction = max( msPredBitsReduction - (float) msPredBits, 0.0f ); + msBits = CountMSBits( iNumBands, 2, piMSFlags, NULL, NULL ); + msBitsReduction = max( msBitsReduction - (float) msBits, 0.0f ); +#ifdef DEBUG_WRITE_MS_PRED + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "bit_red.txt", "wt" ); + } + fprintf( fid, "%.1f %.1f %d %d\n", msBitsReduction, msPredBitsReduction, msBits, msPredBits ); + } +#endif + if ( iAllowSidePred && msPredBitsReduction > 1.1f * msBitsReduction ) + { + *piMSMode = 3; + for ( b = 0; b < iNumBands; b++ ) + { + piMSFlags[b] = piMSPredFlags[b]; + } + iNumMSBands = iNumMSPredBands; + } + else +#endif + if ( iNumMSBands == iNumBands ) + { + *piMSMode = 1; + } + else if ( iNumMSBands > 0 ) + { + *piMSMode = 2; + } + else + { + *piMSMode = 0; + } + + if ( *piMSMode > 0 ) + { + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { +#if defined ENABLE_MS_PRED && defined SIMPLE_PHASE + void ( *pFuncPhaseRotate )( float *, float * ) = pFuncPhaseRotateOptions[piLRPhaseDiffs[b]]; +#endif + if ( piMSFlags[b] == 1 ) + { + int32_t n; + for ( n = 0; n < piBandwidths[b]; n++ ) + { + int32_t k; + for ( k = 0; k < iNumBlocks; k++ ) + { + float fMidReal; + float fMidImag; + float fSideReal; + float fSideImag; +#ifdef ENABLE_MS_PRED + if ( *piMSMode == 3 ) + { +#ifdef SIMPLE_PHASE + ( *pFuncPhaseRotate )( &pppfReal[1][k][iFBOffset], &pppfImag[1][k][iFBOffset] ); +#else + int32_t phaseIdx; + + phaseIdx = piLRPhaseDiffs[b] - PHASE_MIN_VAL; + cplxmult( &pppfReal[1][k][iFBOffset], &pppfImag[1][k][iFBOffset], c_afRotRealImag[phaseIdx][0], c_afRotRealImag[phaseIdx][1] ); +#endif + } +#endif + fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); + fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); + fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); + fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); +#ifdef ENABLE_MS_PRED + if ( *piMSMode == 3 ) + { + fPred = dequantPred( piMSPredCoefs[b] ); + fSideReal -= fPred * fMidReal; + fSideImag -= fPred * fMidImag; + } +#endif + pppfReal[0][k][iFBOffset] = fMidReal; + pppfReal[1][k][iFBOffset] = fSideReal; + pppfImag[0][k][iFBOffset] = fMidImag; + pppfImag[1][k][iFBOffset] = fSideImag; + } + iFBOffset++; + } + } + else + { + iFBOffset += piBandwidths[b]; + } + } + } +#ifdef ENABLE_MS_PRED +#ifdef DEBUG_WRITE_MS_PRED + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "ms_mode_enc_raw.txt", "wt" ); + } + writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumBands, iNumBands, fid, piMSFlags ); + } +#endif + if ( *piMSMode == 3 ) + { + /* Differential Coding of Phase Data*/ + PrepEncode( piLRPhaseDiffs, piMSFlags, iNumBands ); + PrepEncode( piMSPredCoefs, piMSFlags, iNumBands ); +#ifdef DEBUG_WRITE_MS_PRED + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "ms_mode_enc.txt", "wt" ); + } + writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSBands, iNumBands, fid, piMSFlags ); + } +#endif + /* Differential Coding*/ +#ifndef SIMPLE_PHASE + EncodePhase( piLRPhaseDiffs, iNumMSBands, PHASE_DIFF_DIM ); +#endif + EncodePredCoef( piMSPredCoefs, iNumMSBands ); +#ifdef DEBUG_WRITE_MS_PRED + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "ms_mode_enc_diff.txt", "wt" ); + } + writeMSPred( piLRPhaseDiffs, piMSPredCoefs, *piMSMode, iNumMSBands, iNumBands, fid, piMSFlags ); + } +#endif + } +#endif + + return iNumMSBands; +} + +static void RemoveRMSEnvelope( const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t iNumGroups, + const int32_t *piGroupLengths, + int32_t **ppiRMSEnvelope, + float **ppfReal, + float **ppfImag ) +{ + int32_t n; + int32_t iBlockOffset; + + iBlockOffset = 0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t b; + int32_t iFBOffset; + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + int32_t iRMSEnv; + float fGain; + + iRMSEnv = ppiRMSEnvelope[n][b]; + fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER - iRMSEnv]; + for ( m = 0; m < piBandwidths[b]; m++ ) + { + ppfReal[iBlockOffset][iFBOffset] *= fGain; + ppfImag[iBlockOffset][iFBOffset] *= fGain; + iFBOffset++; + } + } + iBlockOffset++; + } + } +} + +static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + int32_t **ppiAlloc, + float **ppfReal, + float **ppfImag, + int32_t **ppiQReal, + int32_t **ppiQImag, + int32_t **ppiSignReal, + int32_t **ppiSignImag, + int32_t *piPredEnable, + float *pfA1Real, + float *pfA1Imag ) // Pass in 2 previous value buffers NULLABLE +{ + + int32_t b; + int32_t iFBOffset; + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + for ( m = 0; m < piBandwidths[b]; m++ ) + { + int32_t n; + int32_t iBlockOffset; + float fPrevReal; + float fPrevImag; + + iBlockOffset = 0; + fPrevReal = 0.0; + fPrevImag = 0.0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + int32_t iAlloc; + int32_t iMaxQuantVal; + float fSCFGain; + float fInvSCFGain; + + + iAlloc = ppiAlloc[n][b]; + iMaxQuantVal = c_aiQuantMaxValues[iAlloc]; + fSCFGain = c_afScaleFactor[iAlloc]; + fInvSCFGain = c_afInvScaleFactor[iAlloc]; + + if ( piPredEnable[iFBOffset] == 1 ) + { + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t iQuantValue; + float fPredReal = 0.0; + float fPredImag = 0.0; + float fVal; + + fPredReal = pfA1Real[iFBOffset] * fPrevReal - pfA1Imag[iFBOffset] * fPrevImag; + fPredImag = pfA1Real[iFBOffset] * fPrevImag + pfA1Imag[iFBOffset] * fPrevReal; + + fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; + if ( fVal > 0.0 ) + { + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + ppiSignReal[iBlockOffset][iFBOffset] = 0; + } + else + { + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + ppiSignReal[iBlockOffset][iFBOffset] = 1; + } + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; + + ppiQReal[iBlockOffset][iFBOffset] = iQuantValue; + + fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; + if ( fVal > 0.0 ) + { + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + ppiSignImag[iBlockOffset][iFBOffset] = 0; + } + else + { + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + ppiSignImag[iBlockOffset][iFBOffset] = 1; + } + + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; + ppiQImag[iBlockOffset][iFBOffset] = iQuantValue; + + + if ( ppiSignReal[iBlockOffset][iFBOffset] == 0 ) + { + fPrevReal = fInvSCFGain * (float) ppiQReal[iBlockOffset][iFBOffset] - fPredReal; + } + else + { + fPrevReal = -fInvSCFGain * (float) ppiQReal[iBlockOffset][iFBOffset] - fPredReal; + } + if ( ppiSignImag[iBlockOffset][iFBOffset] == 0 ) + { + fPrevImag = fInvSCFGain * (float) ppiQImag[iBlockOffset][iFBOffset] - fPredImag; + } + else + { + fPrevImag = -fInvSCFGain * (float) ppiQImag[iBlockOffset][iFBOffset] - fPredImag; + } + + iBlockOffset++; + } + } + else + { + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t iQuantValue; + float fVal; + + fVal = ppfReal[iBlockOffset][iFBOffset]; + if ( fVal > 0.0 ) + { + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + ppiSignReal[iBlockOffset][iFBOffset] = 0; + } + else + { + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + ppiSignReal[iBlockOffset][iFBOffset] = 1; + } + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; + + ppiQReal[iBlockOffset][iFBOffset] = iQuantValue; + + fVal = ppfImag[iBlockOffset][iFBOffset]; + if ( fVal > 0.0 ) + { + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + ppiSignImag[iBlockOffset][iFBOffset] = 0; + } + else + { + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + ppiSignImag[iBlockOffset][iFBOffset] = 1; + } + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; + ppiQImag[iBlockOffset][iFBOffset] = iQuantValue; + iBlockOffset++; + } + } + } + + iFBOffset++; + } + } +} + +static void QuantizeSpectrumDPCM( const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + int32_t **ppiAlloc, + float **ppfReal, + float **ppfImag, + int32_t **ppiQReal, + int32_t **ppiQImag, + int32_t **ppiSignReal, + int32_t **ppiSignImag, + int32_t *piPredEnable, + float *pfA1Real, + float *pfA1Imag ) // Pass in 2 previous value buffers NULLABLE +{ + int32_t b; + int32_t iFBOffset; + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + for ( m = 0; m < piBandwidths[b]; m++ ) + { + int32_t n; + int32_t iBlockOffset; + float fPrevReal; + float fPrevImag; + + iBlockOffset = 0; + fPrevReal = 0.0; + fPrevImag = 0.0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + int32_t iAlloc; + int32_t iMaxQuantVal; + float fSCFGain; + float fInvSCFGain; + + + iAlloc = ppiAlloc[n][b]; + iMaxQuantVal = c_aiQuantMaxValues[iAlloc]; + fSCFGain = c_afScaleFactor[iAlloc]; + fInvSCFGain = c_afInvScaleFactor[iAlloc]; + + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t iQuantValue; + float fPredReal = 0.0; + float fPredImag = 0.0; + float fVal; + + if ( piPredEnable[iFBOffset] == 1 ) + { + fPredReal = pfA1Real[iFBOffset] * fPrevReal - pfA1Imag[iFBOffset] * fPrevImag; + fPredImag = pfA1Real[iFBOffset] * fPrevImag + pfA1Imag[iFBOffset] * fPrevReal; + } + else + { // don't need + fPredReal = 0.0; + fPredImag = 0.0; + } + + fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; + if ( fVal > 0.0 ) + { + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + ppiSignReal[iBlockOffset][iFBOffset] = 0; + } + else + { + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + ppiSignReal[iBlockOffset][iFBOffset] = 1; + } +#ifdef _DEBUG_VERBOSE + if ( iQuantValue > iMaxQuantVal ) + { + printf( "Value out of range %d\t%d\t%d\t%d\n", b, iAlloc, iQuantValue, iMaxQuantVal ); + iQuantValue = iMaxQuantVal; + } +#else + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; +#endif + + ppiQReal[iBlockOffset][iFBOffset] = iQuantValue; + + fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; + if ( fVal > 0.0 ) + { + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + ppiSignImag[iBlockOffset][iFBOffset] = 0; + } + else + { + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + ppiSignImag[iBlockOffset][iFBOffset] = 1; + } + +#ifdef _DEBUG_VERBOSE + if ( iQuantValue > iMaxQuantVal ) + { + printf( "Value out of range %d\t%d\t%d\t%d\n", b, iAlloc, iQuantValue, iMaxQuantVal ); + iQuantValue = iMaxQuantVal; + } +#else + iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; +#endif + ppiQImag[iBlockOffset][iFBOffset] = iQuantValue; + + if ( piPredEnable[iFBOffset] == 1 ) + { + if ( ppiSignReal[iBlockOffset][iFBOffset] == 0 ) + { + fPrevReal = fInvSCFGain * (float) ppiQReal[iBlockOffset][iFBOffset] - fPredReal; + } + else + { + fPrevReal = -fInvSCFGain * (float) ppiQReal[iBlockOffset][iFBOffset] - fPredReal; + } + if ( ppiSignImag[iBlockOffset][iFBOffset] == 0 ) + { + fPrevImag = fInvSCFGain * (float) ppiQImag[iBlockOffset][iFBOffset] - fPredImag; + } + else + { + fPrevImag = -fInvSCFGain * (float) ppiQImag[iBlockOffset][iFBOffset] - fPredImag; + } + } + else + { // don't need + fPrevReal = 0.0; + fPrevImag = 0.0; + } + + iBlockOffset++; + } + } + + iFBOffset++; + } + } +} + +static int32_t CountCQMFBits( const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t *piPredEnable, + int32_t **ppiAlloc, + int32_t **ppiQReal, + int32_t **ppiQImag ) +{ + int32_t n; + int32_t iBits; + int32_t iBlockOffest; + + iBits = 0; + iBlockOffest = 0; + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t b; + int32_t iFBOffset; + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + int32_t iAlloc; + int32_t iHuffDim; + int32_t iHuffMod; + + iAlloc = ppiAlloc[n][b]; + + iHuffDim = c_aiHuffmanDim[iAlloc]; + iHuffMod = c_aiHuffmanMod[iAlloc]; + + + if ( iAlloc > 0 ) + { + const uint32_t( *pauiHuffmanTable )[2] = NULL; + const uint32_t( *pauiHuffmanTableDPCM )[2] = NULL; + + // pauiHuffmanTable = GetHuffEncTable(iAlloc); + pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; + pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc]; + for ( m = 0; m < piBandwidths[b]; m++ ) + { + int32_t iQuantValue1; + int32_t iQuantValue2; + + iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; + iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; + + iBits += ( iQuantValue1 > 0 ) ? 1 : 0; // Sign bit for vals > 0 + iBits += ( iQuantValue2 > 0 ) ? 1 : 0; // Sign bit for vals > 0 + + if ( piPredEnable[iFBOffset] == 1 ) + { + if ( iHuffDim == 2 ) + { + iQuantValue1 *= iHuffMod; + iQuantValue1 += iQuantValue2; + iBits += pauiHuffmanTableDPCM[iQuantValue1][0]; + } + else + { + iBits += pauiHuffmanTableDPCM[iQuantValue1][0]; + iBits += pauiHuffmanTableDPCM[iQuantValue2][0]; + } + } + else + { + if ( iHuffDim == 2 ) + { + iQuantValue1 *= iHuffMod; + iQuantValue1 += iQuantValue2; + iBits += pauiHuffmanTable[iQuantValue1][0]; + } + else + { + iBits += pauiHuffmanTable[iQuantValue1][0]; + iBits += pauiHuffmanTable[iQuantValue2][0]; + } + } + + iFBOffset++; + } + } + else + { + iFBOffset += piBandwidths[b]; + } + } + + iBlockOffest++; + } + } + + return iBits; +} + +/* Currently only the number of bands in frame */ +static int32_t WriteHeaderInformation( const int32_t iNumBands, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsWritten; + + iBitsWritten = 0; + ivas_split_rend_bitstream_write_int32( pBits, iNumBands, 5 ); + iBitsWritten += 5; + + return iBitsWritten; +} + +static int32_t WriteMSInformation( const int32_t iNumBands, + const int32_t iMSMode, + const int32_t *piMSFlags, +#ifdef ENABLE_MS_PRED + const int32_t *piLRPhaseDiff, + const int32_t *piMSPredCoef, + int32_t iNumMSPredBands, +#endif + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsWritten; +#ifdef ENABLE_MS_PRED + int32_t iMSPredAll = ( iNumMSPredBands == iNumBands ); +#ifdef DEBUG_WRITE_MS_PRED + int32_t iBitsWrittenTmp = 0; +#endif +#endif + iBitsWritten = 0; + ivas_split_rend_bitstream_write_int32( pBits, iMSMode, 2 ); + iBitsWritten += 2; +#ifdef ENABLE_MS_PRED + if ( iMSMode == 3 ) + { + ivas_split_rend_bitstream_write_int32( pBits, iMSPredAll, 1 ); + iBitsWritten += 1; + } + if ( iMSMode == 2 || ( iMSMode == 3 && !iMSPredAll ) ) +#else + if ( iMSMode == 2 ) +#endif + { + int32_t n; + for ( n = 0; n < iNumBands; n++ ) + { + ivas_split_rend_bitstream_write_int32( pBits, piMSFlags[n], 1 ); + iBitsWritten += 1; + } + } +#ifdef ENABLE_MS_PRED +#ifdef DEBUG_WRITE_MS_PRED + iBitsWrittenTmp = iBitsWritten; +#endif + if ( iMSMode == 3 ) + { + int32_t b; + int32_t anyNonZero; + anyNonZero = 0; + for ( b = 0; b < iNumMSPredBands; b++ ) + { + if ( piLRPhaseDiff[b] != 0 ) + { + anyNonZero = 1; + break; + } + } + ivas_split_rend_bitstream_write_int32( pBits, anyNonZero, 1 ); + iBitsWritten++; + if ( anyNonZero ) + { +#ifdef SIMPLE_PHASE + for ( b = 0; b < iNumMSPredBands; b++ ) + { + BSPutBits( psBSWrite, piLRPhaseDiff[b], SIMPLE_PHASE_BITS ); + iBitsWritten += SIMPLE_PHASE_BITS; + } +#else + ivas_split_rend_bitstream_write_int32( + pBits, piLRPhaseDiff[0] - PHASE_MIN_VAL, PHASE_BAND0_BITS ); + iBitsWritten += PHASE_BAND0_BITS; + for ( b = 1; b < iNumMSPredBands; b++ ) + { + int32_t tabIdx = piLRPhaseDiff[b] - ENV_DELTA_MIN; + ivas_split_rend_bitstream_write_int32( + pBits, c_aaiRMSEnvHuffEnc[tabIdx][1], + c_aaiRMSEnvHuffEnc[tabIdx][0] ); + iBitsWritten += c_aaiRMSEnvHuffEnc[tabIdx][0]; + } +#endif + } + anyNonZero = 0; + for ( b = 0; b < iNumMSPredBands; b++ ) + { + if ( piMSPredCoef[b] != 0 ) + { + anyNonZero = 1; + break; + } + } + ivas_split_rend_bitstream_write_int32( pBits, anyNonZero, + 1 ); + iBitsWritten++; + if ( anyNonZero ) + { + ivas_split_rend_bitstream_write_int32( + pBits, piMSPredCoef[0] - PRED_MIN_VAL, PRED_BAND0_BITS ); + iBitsWritten += PRED_BAND0_BITS; + for ( b = 1; b < iNumMSPredBands; b++ ) + { + int32_t tabIdx = piMSPredCoef[b] - ENV_DELTA_MIN; + ivas_split_rend_bitstream_write_int32( + pBits, c_aaiRMSEnvHuffEnc[tabIdx][1], + c_aaiRMSEnvHuffEnc[tabIdx][0] ); + iBitsWritten += c_aaiRMSEnvHuffEnc[tabIdx][0]; + } + } + } +#ifdef DEBUG_WRITE_MS_PRED + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "ms_pred_bitrate.txt", "wt" ); + } + fprintf( fid, "%f\n", (float) ( ( iBitsWritten - iBitsWrittenTmp ) * ( iMSMode == 3 ) * 50 ) / 1000.0f ); /*kb/s*/ + } +#endif +#endif + + return iBitsWritten; +} + +static int32_t WriteGroupInformation( const int32_t iChannels, + const int32_t iCommonGrouping, + const int32_t *piNumGroups, + int32_t **ppiGroupLengths, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsWritten; + + iBitsWritten = 0; + if ( iChannels == 2 && iCommonGrouping == 1 ) + { + int32_t n; + ivas_split_rend_bitstream_write_int32( pBits, iCommonGrouping, + 1 ); + iBitsWritten += 1; + + for ( n = 0; n < piNumGroups[0]; n++ ) + { + int32_t k; + for ( k = 1; k < ppiGroupLengths[0][n]; k++ ) + { + ivas_split_rend_bitstream_write_int32( pBits, 0, 1 ); + iBitsWritten += 1; + } + if ( n < ( piNumGroups[0] - 1 ) ) + { + ivas_split_rend_bitstream_write_int32( pBits, 1, 1 ); + iBitsWritten += 1; + } + } + } + else if ( iChannels == 2 ) + { + int32_t c; + ivas_split_rend_bitstream_write_int32( pBits, iCommonGrouping, 1 ); + iBitsWritten += 1; + + for ( c = 0; c < iChannels; c++ ) + { + int32_t n; + + for ( n = 0; n < piNumGroups[c]; n++ ) + { + int32_t k; + for ( k = 1; k < ppiGroupLengths[c][n]; k++ ) + { + ivas_split_rend_bitstream_write_int32( pBits, 0, + 1 ); + iBitsWritten += 1; + } + if ( n < ( piNumGroups[c] - 1 ) ) + { + ivas_split_rend_bitstream_write_int32( pBits, 1, 1 ); + iBitsWritten += 1; + } + } + } + } + else + { + int32_t c; + + for ( c = 0; c < iChannels; c++ ) + { + int32_t n; + + for ( n = 0; n < piNumGroups[c]; n++ ) + { + int32_t k; + for ( k = 1; k < ppiGroupLengths[c][n]; k++ ) + { + ivas_split_rend_bitstream_write_int32( pBits, 0, 1 ); + iBitsWritten += 1; + } + if ( n < ( piNumGroups[c] - 1 ) ) + { + ivas_split_rend_bitstream_write_int32( pBits, 1, 1 ); + iBitsWritten += 1; + } + } + } + } + + return iBitsWritten; +} + +static int32_t WriteRMSEnvelope( const int32_t iChannels, + const int32_t *piNumGroups, + const int32_t iNumBands, + int32_t ***pppiRMSEnvelope, + ivas_split_rend_bits_t *pBits ) +{ + int32_t n; + int32_t iBitsWritten; + + iBitsWritten = 0; + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < piNumGroups[n]; k++ ) + { + int32_t b; + int32_t iLastRMSVal; + + iLastRMSVal = pppiRMSEnvelope[n][k][0]; + iLastRMSVal = ( iLastRMSVal > ENV_MIN ) ? iLastRMSVal : ENV_MIN; + iLastRMSVal = ( iLastRMSVal < ENV_MAX ) ? iLastRMSVal : ENV_MAX; + ivas_split_rend_bitstream_write_int32( pBits, ( iLastRMSVal - ENV_MIN ), ENV0_BITS ); + iBitsWritten += ENV0_BITS; + + for ( b = 1; b < iNumBands; b++ ) + { + int32_t iDelta; + + iDelta = pppiRMSEnvelope[n][k][b] - iLastRMSVal; + iDelta = ( iDelta > ENV_DELTA_MIN ) ? iDelta : ENV_DELTA_MIN; + iDelta = ( iDelta < ENV_DELTA_MAX ) ? iDelta : ENV_DELTA_MAX; + iDelta -= ENV_DELTA_MIN; + ivas_split_rend_bitstream_write_int32( + pBits, c_aaiRMSEnvHuffEnc[iDelta][1], + c_aaiRMSEnvHuffEnc[iDelta][0] ); + iBitsWritten += c_aaiRMSEnvHuffEnc[iDelta][0]; + + iLastRMSVal = pppiRMSEnvelope[n][k][b]; + } + } + } + + return iBitsWritten; +} + +#ifdef ENABLE_PMOD_ADJUST +static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, Bitstream *psBSWrite, int32_t iChannels, int32_t iNumBands ) +{ + int32_t iBitsWritten, c, b; + + iBitsWritten = 0; + + for ( c = 0; c < iChannels; c++ ) + { + int32_t anyNonZero = 0; + const int32_t *flags = ppiHiSMRFlags[c]; + for ( b = 0; b < iNumBands; b++ ) + { + if ( flags[b] ) + { + anyNonZero = 1; + break; + } + } + BSPutBits( psBSWrite, anyNonZero, 1 ); + iBitsWritten += 1; + if ( anyNonZero ) + { + for ( b = 0; b < iNumBands; b++ ) + { + BSPutBits( psBSWrite, flags[b], 1 ); + iBitsWritten += 1; + } + } + } +#ifdef WRITE_HISMR_FLAGS + { + static FILE *fid = 0; + if ( !fid ) + { + fid = fopen( "hismr_enc.txt", "wt" ); + } + for ( c = 0; c < iChannels; c++ ) + { + int32_t b; + for ( b = 0; b < iNumBands; b++ ) + { + if ( c == iChannels - 1 && b == iNumBands - 1 ) + { + fprintf( fid, "%d\n", ppiHiSMRFlags[c][b] ); + } + else + { + fprintf( fid, "%d ", ppiHiSMRFlags[c][b] ); + } + } + } + } +#endif + + return iBitsWritten; +} +#endif + +static int32_t WriteAllocInformation( const int32_t iAllocOffset, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsWritten; + + iBitsWritten = 0; + + if ( iAllocOffset < MIN_ALLOC_OFFSET || iAllocOffset > MAX_ALLOC_OFFSET ) + { + printf( "Serious error\n" ); + } + ivas_split_rend_bitstream_write_int32( pBits, + ( iAllocOffset - MIN_ALLOC_OFFSET ), ALLOC_OFFSET_BITS ); + iBitsWritten += ALLOC_OFFSET_BITS; + + return iBitsWritten; +} + +static int32_t WriteCQMFData( const int32_t iNumGroups, + const int32_t *piGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t *piPredEnable, + int32_t **ppiAlloc, + int32_t **ppiSignReal, + int32_t **ppiSignImag, + int32_t **ppiQReal, + int32_t **ppiQImag, + ivas_split_rend_bits_t *pBits ) +{ + int32_t n; + int32_t iBitsWritten; + int32_t iBlockOffest; + + iBitsWritten = 0; + iBlockOffest = 0; + + + for ( n = 0; n < iNumGroups; n++ ) + { + int32_t k; + for ( k = 0; k < piGroupLengths[n]; k++ ) + { + int32_t b; + int32_t iFBOffset; + + iFBOffset = 0; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + int32_t iAlloc; + int32_t iHuffDim; + int32_t iHuffMod; + + iAlloc = ppiAlloc[n][b]; + + iHuffDim = c_aiHuffmanDim[iAlloc]; + iHuffMod = c_aiHuffmanMod[iAlloc]; + + + if ( iAlloc > 0 ) + { + const uint32_t( *pauiHuffmanTable )[2] = NULL; + const uint32_t( *pauiHuffmanTableDPCM )[2] = NULL; + + // pauiHuffmanTable = GetHuffEncTable(iAlloc); + pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; + pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc]; + for ( m = 0; m < piBandwidths[b]; m++ ) + { + int32_t iQuantValue1; + int32_t iQuantValue2; + + iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; + iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; + + if ( piPredEnable[iFBOffset] == 1 ) + { + if ( iHuffDim == 2 ) + { + int32_t iSymbol; + iSymbol = iQuantValue1; + iSymbol *= iHuffMod; + iSymbol += iQuantValue2; + ivas_split_rend_bitstream_write_int32( + pBits, pauiHuffmanTableDPCM[iSymbol][1], + pauiHuffmanTableDPCM[iSymbol][0] ); + iBitsWritten += pauiHuffmanTableDPCM[iSymbol][0]; + } + else + { + ivas_split_rend_bitstream_write_int32( + pBits, pauiHuffmanTableDPCM[iQuantValue1][1], + pauiHuffmanTableDPCM[iQuantValue1][0] ); + iBitsWritten += pauiHuffmanTableDPCM[iQuantValue1][0]; + + ivas_split_rend_bitstream_write_int32( + pBits, + pauiHuffmanTableDPCM[iQuantValue2][1], + pauiHuffmanTableDPCM[iQuantValue2][0] ); + iBitsWritten += pauiHuffmanTableDPCM[iQuantValue2][0]; + } + } + else + { + if ( iHuffDim == 2 ) + { + int32_t iSymbol; + iSymbol = iQuantValue1; + iSymbol *= iHuffMod; + iSymbol += iQuantValue2; + ivas_split_rend_bitstream_write_int32( + pBits, pauiHuffmanTable[iSymbol][1], + pauiHuffmanTable[iSymbol][0] ); + iBitsWritten += pauiHuffmanTable[iSymbol][0]; + } + else + { + ivas_split_rend_bitstream_write_int32( + pBits, pauiHuffmanTable[iQuantValue1][1], + pauiHuffmanTable[iQuantValue1][0] ); + iBitsWritten += pauiHuffmanTable[iQuantValue1][0]; + + ivas_split_rend_bitstream_write_int32( + pBits, pauiHuffmanTable[iQuantValue2][1], + pauiHuffmanTable[iQuantValue2][0] ); + iBitsWritten += pauiHuffmanTable[iQuantValue2][0]; + } + } + + if ( iQuantValue1 > 0 ) + { + ivas_split_rend_bitstream_write_int32( + pBits, ppiSignReal[iBlockOffest][iFBOffset], + 1 ); + iBitsWritten += 1; + } + if ( iQuantValue2 > 0 ) + { + ivas_split_rend_bitstream_write_int32( + pBits, ppiSignImag[iBlockOffest][iFBOffset], 1 ); + iBitsWritten += 1; + } + + iFBOffset++; + } + } + else + { + iFBOffset += piBandwidths[b]; + } + } + + iBlockOffest++; + } + } + + return iBitsWritten; +} + +static int32_t ComputeAllocation( const int32_t iChannels, + const int32_t *piNumGroups, + int32_t **ppiGroupLengths, + const int32_t iNumBands, + const int32_t *piBandwidths, + float ***pppfReal, + float ***pppfImag, + int32_t ***pppiSMR, + const int32_t iAvailableBits, + int32_t *piAllocOffset, + int32_t ***pppiAlloc, + int32_t ***pppiQReal, + int32_t ***pppiQImag, + int32_t ***pppiSignReal, + int32_t ***pppiSignImag, + int32_t **ppiPredEnable, + float **ppfA1Real, + float **ppfA1Imag ) +{ + int32_t iBitsUsed; + int32_t iDone; + int32_t iDelta; + + iBitsUsed = ALLOC_OFFSET_BITS; // Bits used for Alloc Offset + + iDone = 0; + iDelta = -MIN_ALLOC_OFFSET; + *piAllocOffset = 0; + + while ( iDone == 0 ) + { + int32_t n; + int32_t iLimitAllocOffset; + iBitsUsed = ALLOC_OFFSET_BITS; + + iLimitAllocOffset = *piAllocOffset; + iLimitAllocOffset = ( iLimitAllocOffset > MIN_ALLOC_OFFSET ) ? iLimitAllocOffset : MIN_ALLOC_OFFSET; + iLimitAllocOffset = ( iLimitAllocOffset < MAX_ALLOC_OFFSET ) ? iLimitAllocOffset : MAX_ALLOC_OFFSET; + + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < piNumGroups[n]; k++ ) + { + int32_t b; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t iAlloc; + iAlloc = ( ( pppiSMR[n][k][b] + iLimitAllocOffset * ALLOC_OFFSET_SCALE ) >> 5 ); + iAlloc = ( iAlloc > MIN_ALLOC ) ? iAlloc : MIN_ALLOC; + iAlloc = ( iAlloc < MAX_ALLOC ) ? iAlloc : MAX_ALLOC; + pppiAlloc[n][k][b] = iAlloc; + } + } +#ifdef OPTIMIZE_DPCM_QUANT + QuantizeSpectrumDPCM_Opt( piNumGroups[n], + (const int32_t *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + pppiAlloc[n], + pppfReal[n], + pppfImag[n], + pppiQReal[n], + pppiQImag[n], + pppiSignReal[n], + pppiSignImag[n], + ppiPredEnable[n], + ppfA1Real[n], + ppfA1Imag[n] ); +#else + QuantizeSpectrumDPCM( piNumGroups[n], + (const int32_t *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + pppiAlloc[n], + pppfReal[n], + pppfImag[n], + pppiQReal[n], + pppiQImag[n], + pppiSignReal[n], + pppiSignImag[n], + ppiPredEnable[n], + ppfA1Real[n], + ppfA1Imag[n] ); +#endif + + iBitsUsed += CountCQMFBits( piNumGroups[n], + (const int32_t *) ppiGroupLengths[n], + iNumBands, + piBandwidths, + (const int32_t *) ppiPredEnable[n], + pppiAlloc[n], + pppiQReal[n], + pppiQImag[n] ); + } + + if ( *piAllocOffset <= MIN_ALLOC_OFFSET && iBitsUsed > iAvailableBits ) + { +#ifdef DEBUG_VERBOSE + printf( "Frame can not be coded with the number of bits available\n" ); +#endif + // iLastError = ENC_ERROR_STREAM_FAILURE; + return -1; + } + else if ( *piAllocOffset >= MAX_ALLOC_OFFSET && iBitsUsed < iAvailableBits ) + { + *piAllocOffset = MAX_ALLOC_OFFSET; + iDone++; + } + else + { + if ( iDelta == 0 && iBitsUsed > iAvailableBits ) + { + iDelta = 1; + } + else if ( iDelta == 0 && iBitsUsed < iAvailableBits ) + { + iDone++; + } + else if ( iBitsUsed == iAvailableBits ) + { + iDone++; + } + + if ( iBitsUsed > iAvailableBits ) + { + *piAllocOffset -= iDelta; + iDelta >>= 1; + } + else if ( iBitsUsed < iAvailableBits ) + { + *piAllocOffset += iDelta; + iDelta >>= 1; + } + } + } + + // printf("%d\n",*piAllocOffset); + // printf("%d\t%d\t%d\n",pppiAlloc[0][0][0],pppiAlloc[0][0][1],pppiAlloc[0][0][22]); + + // printf("%d\t%d\t%d\t%d\n",*piAllocOffset,iAvailableBits,iBitsUsed,iAvailableBits - iBitsUsed); + + return iBitsUsed; +} diff --git a/lib_rend/ivas_CQMFEncoder.h b/lib_rend/ivas_CQMFEncoder.h new file mode 100644 index 0000000000..3466eae6b4 --- /dev/null +++ b/lib_rend/ivas_CQMFEncoder.h @@ -0,0 +1,69 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_CQMF_ENCODER_H_ +#define _IVAS_CQMF_ENCODER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "lib_rend.h" +#define ENCODER_ERROR_NONE ( 0 ) +#define ENCODER_ERROR_FS_NOT_SUPPORTED ( -1 ) +#define ENCODER_ERROR_CHAN_NOT_SUPPORTED ( -2 ) +#define ENCODER_ERROR_UNKNOWN ( -100 ) + + typedef struct CQMF_ENCODER CQMFEncoder; + + CQMFEncoder *CreateCQMFEncoder( const int32_t iSampleRate, + const int32_t iChannels, + const int32_t iTargetBitRate, + const int32_t iAllowSidePred ); + + void DeleteCQMFEncoder( CQMFEncoder *psCQMFEncoder ); + + int32_t CQMFEncoderGetError( CQMFEncoder *psCQMFEncoder ); + int32_t EncodeFrame( + CQMFEncoder *psCQMFEncoder, + float ***pppfCQMFReal, + float ***pppfCQMFImag, + int32_t *piNumiBites, + const int32_t available_bits, + ivas_split_rend_bits_t *pBits ); + int32_t GetNumGroups( CQMFEncoder *psCQMFEncoder ); + +#ifdef __cplusplus +} +#endif + +#endif /* _CQMF_ENCODER_H_ */ diff --git a/lib_rend/ivas_CQMFHuff.c b/lib_rend/ivas_CQMFHuff.c new file mode 100644 index 0000000000..aea5a98a47 --- /dev/null +++ b/lib_rend/ivas_CQMFHuff.c @@ -0,0 +1,4124 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_CQMFHuff.h" +#include "wmops.h" + +/* clang-format off */ +const uint32_t c_aauiCQMFHuffEnc1[16][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0005, 0x0001}, {0x000b, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x0001}, + {0x0006, 0x0001}, {0x0008, 0x0001}, {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, +}; + +const uint32_t c_aauiCQMFHuffDec1[3][16] = +{ + {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00010003, 0x00010003, 0x00010007, 0x00010007, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +}; + +const uint32_t c_aauiCQMFHuffEnc2[16][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0005, 0x0001}, {0x000c, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000c, 0x0001}, + {0x0006, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000b, 0x0003}, +}; + +const uint32_t c_aauiCQMFHuffDec2[3][16] = +{ + {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00000003, 0x00000007, 0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0001000f, 0x0001000f, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, +}; + +const uint32_t c_aauiCQMFHuffEnc3[25][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, + {0x000d, 0x0002}, {0x000d, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x0009, 0x0001}, + {0x000c, 0x0007}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000d, 0x000c}, + {0x000d, 0x000d}, + +}; + +const uint32_t c_aauiCQMFHuffDec3[10][16] = +{ + {0x0001ffff, 0x00000006, 0x00010001, 0x00010001, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x0000000c, 0x00010007, 0x00010007, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x00000010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, +}; + +const uint32_t c_aauiCQMFHuffEnc4[36][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0010, 0x0000}, {0x0010, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, + {0x0007, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000e, 0x0006}, + {0x0010, 0x0004}, {0x0010, 0x0005}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000e, 0x0007}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0010, 0x0008}, + {0x0010, 0x0009}, {0x0010, 0x000a}, {0x0010, 0x000b}, {0x0010, 0x000c}, {0x0010, 0x000d}, {0x0010, 0x000e}, {0x0010, 0x000f}, {0x0010, 0x0010}, + {0x0010, 0x0011}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, + +}; + +const uint32_t c_aauiCQMFHuffDec4[5][16] = +{ + {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x0000000e, 0x00010008, 0x00010008, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x0004ffff, 0x0003ffff, 0x00010003, 0x00010003, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x0000001f, 0x00000020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, + {0x00000004, 0x00000005, 0x0000000a, 0x0000000b, 0x00000010, 0x00000011, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, }, +}; + +const uint32_t c_aauiCQMFHuffEnc5[36][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, + {0x0007, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0008}, {0x0012, 0x0001}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000c, 0x0001}, + {0x0012, 0x0002}, {0x0012, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000d, 0x0001}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, + {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, + {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0011, 0x000b}, + +}; + +const uint32_t c_aauiCQMFHuffDec5[10][16] = +{ + {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x0000000e, 0x00010008, 0x00010008, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x0003ffff, 0x0000000f, 0x00010009, 0x00010009, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x0004ffff, 0x0005ffff, 0x00010004, 0x00010004, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, + {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, +}; + +const uint32_t c_aauiCQMFHuffEnc6[49][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0003}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0002, 0x0001}, + {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x0010, 0x0004}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, + {0x0008, 0x0001}, {0x000d, 0x0001}, {0x0012, 0x0007}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x000a, 0x0003}, {0x000b, 0x0001}, {0x000c, 0x0001}, + {0x0011, 0x0004}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0010, 0x0005}, {0x000f, 0x0003}, {0x0011, 0x0005}, {0x0014, 0x0009}, + {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0013, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, + {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, + {0x0014, 0x0019}, + +}; + +const uint32_t c_aauiCQMFHuffDec6[7][16] = +{ + {0x0001ffff, 0x00000008, 0x00010001, 0x00010001, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000010, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x0003ffff, 0x00000017, 0x00010016, 0x00010016, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, + {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x00000004, 0x0000000b, 0x0000001c, 0x0001001d, 0x0001001d, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00010024, 0x00010024, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x00000005, 0x00000006, 0x0000000c, 0x0000000d, 0x00000013, 0x00000014, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000025, 0x00000026, }, +}; + +const uint32_t c_aauiCQMFHuffEnc7[64][2] = +{ + {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0002}, {0x0015, 0x0000}, {0x0015, 0x0001}, {0x0015, 0x0002}, + {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000f, 0x0003}, {0x0014, 0x0011}, {0x0015, 0x0003}, {0x0015, 0x0004}, + {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0001}, {0x000b, 0x0001}, {0x0010, 0x0002}, {0x0015, 0x0005}, {0x0015, 0x0006}, {0x0015, 0x0007}, + {0x000a, 0x0001}, {0x0009, 0x0003}, {0x000c, 0x0001}, {0x000f, 0x0004}, {0x0012, 0x0006}, {0x0015, 0x0008}, {0x0015, 0x0009}, {0x0015, 0x000a}, + {0x000f, 0x0005}, {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0012, 0x0007}, {0x0014, 0x0012}, {0x0015, 0x000b}, {0x0015, 0x000c}, {0x0015, 0x000d}, + {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0013, 0x000b}, {0x0014, 0x0015}, {0x0015, 0x000e}, {0x0015, 0x000f}, {0x0015, 0x0010}, {0x0015, 0x0011}, + {0x0015, 0x0012}, {0x0015, 0x0013}, {0x0015, 0x0014}, {0x0015, 0x0015}, {0x0015, 0x0016}, {0x0015, 0x0017}, {0x0015, 0x0018}, {0x0015, 0x0019}, + {0x0015, 0x001a}, {0x0015, 0x001b}, {0x0015, 0x001c}, {0x0015, 0x001d}, {0x0015, 0x001e}, {0x0015, 0x001f}, {0x0015, 0x0020}, {0x0015, 0x0021}, +}; + +const uint32_t c_aauiCQMFHuffDec7[25][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x0003ffff, 0x0004ffff, 0x00010012, 0x00010012, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x0005ffff, 0x0000001a, 0x00010013, 0x00010013, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x0007ffff, 0x0006ffff, 0x00000014, 0x00000022, 0x00010004, 0x00010004, 0x0001000c, 0x0001000c, 0x0001001b, 0x0001001b, 0x00010020, 0x00010020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, + {0x0018ffff, 0x0000000d, 0x00000024, 0x00000028, 0x00000029, 0x0000002b, 0x0001002a, 0x0001002a, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x000effff, 0x000affff, 0x000bffff, 0x000cffff, 0x0008ffff, 0x0009ffff, 0x000dffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, + {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, +}; + +const uint32_t c_aauiCQMFHuffEnc8[81][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0002}, {0x0014, 0x0008}, {0x0017, 0x0000}, {0x0017, 0x0001}, + {0x0017, 0x0002}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0004}, {0x0015, 0x000d}, + {0x0017, 0x0003}, {0x0017, 0x0004}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0001}, {0x000c, 0x0001}, {0x0010, 0x0002}, {0x0013, 0x0005}, + {0x0017, 0x0005}, {0x0017, 0x0006}, {0x0017, 0x0007}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000b, 0x0001}, {0x000f, 0x0004}, {0x0012, 0x0005}, + {0x0016, 0x0015}, {0x0017, 0x0008}, {0x0017, 0x0009}, {0x0017, 0x000a}, {0x000f, 0x0005}, {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0012, 0x0006}, + {0x0014, 0x0009}, {0x0017, 0x000b}, {0x0017, 0x000c}, {0x0017, 0x000d}, {0x0017, 0x000e}, {0x0013, 0x0006}, {0x0012, 0x0007}, {0x0013, 0x0007}, + {0x0015, 0x000e}, {0x0017, 0x000f}, {0x0017, 0x0010}, {0x0017, 0x0011}, {0x0017, 0x0012}, {0x0017, 0x0013}, {0x0016, 0x0016}, {0x0016, 0x0017}, + {0x0015, 0x000f}, {0x0016, 0x0018}, {0x0017, 0x0014}, {0x0017, 0x0015}, {0x0017, 0x0016}, {0x0017, 0x0017}, {0x0017, 0x0018}, {0x0017, 0x0019}, + {0x0017, 0x001a}, {0x0017, 0x001b}, {0x0017, 0x001c}, {0x0017, 0x001d}, {0x0017, 0x001e}, {0x0017, 0x001f}, {0x0017, 0x0020}, {0x0017, 0x0021}, + {0x0017, 0x0022}, {0x0017, 0x0023}, {0x0017, 0x0024}, {0x0017, 0x0025}, {0x0017, 0x0026}, {0x0017, 0x0027}, {0x0017, 0x0028}, {0x0017, 0x0029}, + {0x0016, 0x0019}, + +}; + +const uint32_t c_aauiCQMFHuffDec8[16][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0004ffff, 0x00010014, 0x00010014, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x0005ffff, 0x00000015, 0x0001001d, 0x0001001d, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0007ffff, 0x0006ffff, 0x00000016, 0x00000026, 0x00010004, 0x00010004, 0x0001000d, 0x0001000d, 0x0001001e, 0x0001001e, 0x00010024, 0x00010024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, + {0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x00000028, 0x00010017, 0x00010017, 0x0001002d, 0x0001002d, 0x0001002f, 0x0001002f, }, + {0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, + {0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, }, + {0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, }, + {0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x00010031, 0x00010031, }, + {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, + {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, + {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, }, +}; + +const uint32_t c_aauiCQMFHuffEnc9[100][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000d, 0x0002}, {0x0011, 0x0004}, {0x0014, 0x000a}, {0x0017, 0x0000}, + {0x0017, 0x0001}, {0x0017, 0x0002}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0003}, {0x0010, 0x0004}, + {0x0013, 0x0007}, {0x0016, 0x0018}, {0x0017, 0x0003}, {0x0017, 0x0004}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0008, 0x0002}, {0x000b, 0x0002}, + {0x000e, 0x0002}, {0x0011, 0x0005}, {0x0014, 0x000b}, {0x0016, 0x0019}, {0x0017, 0x0005}, {0x0017, 0x0006}, {0x0009, 0x0003}, {0x0008, 0x0003}, + {0x000b, 0x0003}, {0x000d, 0x0004}, {0x0010, 0x0005}, {0x0012, 0x0006}, {0x0015, 0x000f}, {0x0017, 0x0007}, {0x0017, 0x0008}, {0x0017, 0x0009}, + {0x000d, 0x0005}, {0x000c, 0x0003}, {0x000e, 0x0003}, {0x0010, 0x0006}, {0x0012, 0x0007}, {0x0014, 0x000c}, {0x0017, 0x000a}, {0x0016, 0x001a}, + {0x0017, 0x000b}, {0x0017, 0x000c}, {0x0011, 0x0006}, {0x0010, 0x0007}, {0x0011, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0015, 0x0010}, + {0x0017, 0x000d}, {0x0017, 0x000e}, {0x0017, 0x000f}, {0x0017, 0x0010}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0014, 0x000d}, {0x0015, 0x0011}, + {0x0017, 0x0011}, {0x0016, 0x001b}, {0x0017, 0x0012}, {0x0017, 0x0013}, {0x0017, 0x0014}, {0x0017, 0x0015}, {0x0017, 0x0016}, {0x0015, 0x0012}, + {0x0015, 0x0013}, {0x0017, 0x0017}, {0x0016, 0x001c}, {0x0017, 0x0018}, {0x0017, 0x0019}, {0x0017, 0x001a}, {0x0017, 0x001b}, {0x0017, 0x001c}, + {0x0017, 0x001d}, {0x0017, 0x001e}, {0x0017, 0x001f}, {0x0017, 0x0020}, {0x0017, 0x0021}, {0x0017, 0x0022}, {0x0017, 0x0023}, {0x0017, 0x0024}, + {0x0017, 0x0025}, {0x0017, 0x0026}, {0x0017, 0x0027}, {0x0017, 0x0028}, {0x0017, 0x0029}, {0x0017, 0x002a}, {0x0017, 0x002b}, {0x0017, 0x002c}, + {0x0017, 0x002d}, {0x0017, 0x002e}, {0x0017, 0x002f}, {0x0016, 0x001d}, + +}; + +const uint32_t c_aauiCQMFHuffDec9[22][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0004ffff, 0x00000016, 0x0000001f, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x00000029, 0x00010017, 0x00010017, 0x00010020, 0x00010020, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x000bffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x0000000f, 0x00000022, 0x0000002b, 0x00000033, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, + {0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, + {0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x000fffff, 0x000dffff, 0x000cffff, 0x000effff, 0x00000006, 0x0000001a, 0x0000002d, 0x0000003e, 0x00010010, 0x00010010, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, + {0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, + {0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020041, 0x00020041, 0x00020041, 0x00020041, }, + {0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x00010025, 0x00010025, }, + {0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x0001002e, 0x0001002e, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, + {0x0001003b, 0x0001003b, 0x00010040, 0x00010040, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010049, 0x00010049, }, + {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, + {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, + {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, +}; + +const uint32_t c_aauiCQMFHuffEnc10[169][2] = +{ + {0x0001, 0x0001}, {0x0004, 0x0002}, {0x0005, 0x0002}, {0x0007, 0x0002}, {0x000a, 0x0002}, {0x000e, 0x0004}, {0x0011, 0x0007}, {0x0013, 0x0012}, + {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0004, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0004}, + {0x0007, 0x0003}, {0x000a, 0x0003}, {0x000d, 0x0004}, {0x0010, 0x0007}, {0x0013, 0x0013}, {0x0015, 0x0035}, {0x0016, 0x0005}, {0x0016, 0x0006}, + {0x0016, 0x0007}, {0x0016, 0x0008}, {0x0005, 0x0003}, {0x0004, 0x0005}, {0x0006, 0x0003}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000e, 0x0005}, + {0x0010, 0x0008}, {0x0013, 0x0014}, {0x0014, 0x001d}, {0x0016, 0x0009}, {0x0016, 0x000a}, {0x0016, 0x000b}, {0x0016, 0x000c}, {0x0007, 0x0004}, + {0x0007, 0x0005}, {0x0008, 0x0003}, {0x000a, 0x0004}, {0x000d, 0x0005}, {0x000f, 0x0005}, {0x0011, 0x0008}, {0x0014, 0x001e}, {0x0014, 0x001f}, + {0x0016, 0x000d}, {0x0016, 0x000e}, {0x0016, 0x000f}, {0x0016, 0x0010}, {0x000a, 0x0005}, {0x0009, 0x0003}, {0x000b, 0x0003}, {0x000d, 0x0006}, + {0x000f, 0x0006}, {0x0011, 0x0009}, {0x0013, 0x0015}, {0x0014, 0x0020}, {0x0016, 0x0011}, {0x0016, 0x0012}, {0x0016, 0x0013}, {0x0016, 0x0014}, + {0x0016, 0x0015}, {0x000e, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x000f, 0x0007}, {0x0011, 0x000a}, {0x0012, 0x000c}, {0x0016, 0x0016}, + {0x0016, 0x0017}, {0x0016, 0x0018}, {0x0016, 0x0019}, {0x0016, 0x001a}, {0x0016, 0x001b}, {0x0016, 0x001c}, {0x0011, 0x000b}, {0x0010, 0x0009}, + {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0013, 0x0016}, {0x0016, 0x001d}, {0x0016, 0x001e}, {0x0016, 0x001f}, {0x0016, 0x0020}, {0x0016, 0x0021}, + {0x0016, 0x0022}, {0x0016, 0x0023}, {0x0016, 0x0024}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0012, 0x000d}, {0x0013, 0x0017}, {0x0016, 0x0025}, + {0x0016, 0x0026}, {0x0016, 0x0027}, {0x0016, 0x0028}, {0x0016, 0x0029}, {0x0016, 0x002a}, {0x0016, 0x002b}, {0x0016, 0x002c}, {0x0016, 0x002d}, + {0x0015, 0x0036}, {0x0015, 0x0037}, {0x0014, 0x0023}, {0x0015, 0x0038}, {0x0016, 0x002e}, {0x0016, 0x002f}, {0x0016, 0x0030}, {0x0016, 0x0031}, + {0x0016, 0x0032}, {0x0016, 0x0033}, {0x0016, 0x0034}, {0x0016, 0x0035}, {0x0016, 0x0036}, {0x0016, 0x0037}, {0x0016, 0x0038}, {0x0016, 0x0039}, + {0x0016, 0x003a}, {0x0016, 0x003b}, {0x0016, 0x003c}, {0x0016, 0x003d}, {0x0016, 0x003e}, {0x0016, 0x003f}, {0x0016, 0x0040}, {0x0016, 0x0041}, + {0x0016, 0x0042}, {0x0016, 0x0043}, {0x0016, 0x0044}, {0x0016, 0x0045}, {0x0016, 0x0046}, {0x0016, 0x0047}, {0x0016, 0x0048}, {0x0016, 0x0049}, + {0x0016, 0x004a}, {0x0016, 0x004b}, {0x0016, 0x004c}, {0x0016, 0x004d}, {0x0016, 0x004e}, {0x0016, 0x004f}, {0x0016, 0x0050}, {0x0016, 0x0051}, + {0x0016, 0x0052}, {0x0016, 0x0053}, {0x0016, 0x0054}, {0x0016, 0x0055}, {0x0016, 0x0056}, {0x0016, 0x0057}, {0x0016, 0x0058}, {0x0016, 0x0059}, + {0x0016, 0x005a}, {0x0016, 0x005b}, {0x0016, 0x005c}, {0x0016, 0x005d}, {0x0016, 0x005e}, {0x0016, 0x005f}, {0x0016, 0x0060}, {0x0016, 0x0061}, + {0x0016, 0x0062}, {0x0016, 0x0063}, {0x0016, 0x0064}, {0x0016, 0x0065}, {0x0016, 0x0066}, {0x0016, 0x0067}, {0x0016, 0x0068}, {0x0016, 0x0069}, + {0x0015, 0x0039}, + +}; + +const uint32_t c_aauiCQMFHuffDec10[45][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00000001, 0x0000000d, 0x0000000f, 0x0000001b, 0x0001000e, 0x0001000e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, + {0x0004ffff, 0x0003ffff, 0x0000001d, 0x00000029, 0x00010003, 0x00010003, 0x00010010, 0x00010010, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, + {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001001e, 0x0001001e, 0x00010036, 0x00010036, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, + {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020043, 0x00020043, 0x00020043, 0x00020043, }, + {0x0012ffff, 0x000effff, 0x000dffff, 0x000affff, 0x0009ffff, 0x000bffff, 0x000cffff, 0x00000013, 0x00000020, 0x0000004f, 0x0001002c, 0x0001002c, 0x00010038, 0x00010038, 0x00010044, 0x00010044, }, + {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, + {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, + {0x0000003b, 0x0000005b, 0x0000005c, 0x0000006a, 0x00010007, 0x00010007, 0x00010014, 0x00010014, 0x00010021, 0x00010021, 0x0001003a, 0x0001003a, 0x00010052, 0x00010052, 0x0001005e, 0x0001005e, }, + {0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x00000022, 0x0000002e, 0x0000002f, }, + {0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, + {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, }, + {0x0014ffff, 0x0017ffff, 0x0015ffff, 0x0016ffff, 0x001cffff, 0x0013ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, }, + {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, }, + {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, + {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, + {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, }, + {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, }, + {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x00020055, 0x00020055, 0x00020055, 0x00020055, }, + {0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, }, + {0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, }, + {0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, }, + {0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, }, + {0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, }, + {0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, }, + {0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020075, 0x00020075, 0x00020075, 0x00020075, }, + {0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, }, + {0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, }, + {0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, + {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, 0x00020085, 0x00020085, 0x00020085, 0x00020085, }, + {0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, }, + {0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, }, + {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, + {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, + {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, 0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x00020099, 0x00020099, 0x00020099, 0x00020099, }, + {0x0002009a, 0x0002009a, 0x0002009a, 0x0002009a, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, }, + {0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, + {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, +}; + +const uint32_t c_aauiCQMFHuffEnc11[196][2] = +{ + {0x0001, 0x0001}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x000f, 0x0005}, {0x0012, 0x000d}, + {0x0014, 0x001f}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0004, 0x0004}, {0x0003, 0x0003}, + {0x0005, 0x0004}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000b, 0x0004}, {0x000e, 0x0005}, {0x0010, 0x0007}, {0x0012, 0x000e}, {0x0014, 0x0020}, + {0x0016, 0x0005}, {0x0016, 0x0006}, {0x0016, 0x0007}, {0x0016, 0x0008}, {0x0005, 0x0005}, {0x0004, 0x0005}, {0x0006, 0x0004}, {0x0007, 0x0003}, + {0x000a, 0x0004}, {0x000c, 0x0005}, {0x000e, 0x0006}, {0x0011, 0x000a}, {0x0012, 0x000f}, {0x0015, 0x003b}, {0x0016, 0x0009}, {0x0016, 0x000a}, + {0x0016, 0x000b}, {0x0016, 0x000c}, {0x0007, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000d, 0x0005}, + {0x000f, 0x0006}, {0x0012, 0x0010}, {0x0014, 0x0021}, {0x0016, 0x000d}, {0x0016, 0x000e}, {0x0016, 0x000f}, {0x0016, 0x0010}, {0x0016, 0x0011}, + {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x0006}, {0x000f, 0x0007}, {0x0011, 0x000b}, {0x0013, 0x0017}, + {0x0014, 0x0022}, {0x0016, 0x0012}, {0x0016, 0x0013}, {0x0016, 0x0014}, {0x0016, 0x0015}, {0x0016, 0x0016}, {0x000c, 0x0006}, {0x000b, 0x0007}, + {0x000c, 0x0007}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x0010, 0x0008}, {0x0012, 0x0011}, {0x0014, 0x0023}, {0x0015, 0x003c}, {0x0016, 0x0017}, + {0x0016, 0x0018}, {0x0016, 0x0019}, {0x0016, 0x001a}, {0x0016, 0x001b}, {0x000f, 0x0008}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0009}, + {0x0011, 0x000c}, {0x0013, 0x0018}, {0x0014, 0x0024}, {0x0016, 0x001c}, {0x0016, 0x001d}, {0x0016, 0x001e}, {0x0016, 0x001f}, {0x0016, 0x0020}, + {0x0016, 0x0021}, {0x0016, 0x0022}, {0x0011, 0x000d}, {0x0010, 0x0009}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0014, 0x0025}, {0x0015, 0x003d}, + {0x0014, 0x0026}, {0x0016, 0x0023}, {0x0016, 0x0024}, {0x0016, 0x0025}, {0x0016, 0x0026}, {0x0016, 0x0027}, {0x0016, 0x0028}, {0x0016, 0x0029}, + {0x0014, 0x0027}, {0x0013, 0x0019}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0016, 0x002a}, {0x0016, 0x002b}, {0x0016, 0x002c}, + {0x0016, 0x002d}, {0x0016, 0x002e}, {0x0016, 0x002f}, {0x0016, 0x0030}, {0x0016, 0x0031}, {0x0016, 0x0032}, {0x0014, 0x002b}, {0x0014, 0x002c}, + {0x0014, 0x002d}, {0x0016, 0x0033}, {0x0016, 0x0034}, {0x0016, 0x0035}, {0x0016, 0x0036}, {0x0016, 0x0037}, {0x0016, 0x0038}, {0x0016, 0x0039}, + {0x0016, 0x003a}, {0x0016, 0x003b}, {0x0016, 0x003c}, {0x0016, 0x003d}, {0x0016, 0x003e}, {0x0016, 0x003f}, {0x0016, 0x0040}, {0x0016, 0x0041}, + {0x0016, 0x0042}, {0x0016, 0x0043}, {0x0016, 0x0044}, {0x0016, 0x0045}, {0x0016, 0x0046}, {0x0016, 0x0047}, {0x0016, 0x0048}, {0x0016, 0x0049}, + {0x0016, 0x004a}, {0x0016, 0x004b}, {0x0016, 0x004c}, {0x0016, 0x004d}, {0x0016, 0x004e}, {0x0016, 0x004f}, {0x0016, 0x0050}, {0x0016, 0x0051}, + {0x0016, 0x0052}, {0x0016, 0x0053}, {0x0016, 0x0054}, {0x0016, 0x0055}, {0x0016, 0x0056}, {0x0016, 0x0057}, {0x0016, 0x0058}, {0x0016, 0x0059}, + {0x0016, 0x005a}, {0x0016, 0x005b}, {0x0016, 0x005c}, {0x0016, 0x005d}, {0x0016, 0x005e}, {0x0016, 0x005f}, {0x0016, 0x0060}, {0x0016, 0x0061}, + {0x0016, 0x0062}, {0x0016, 0x0063}, {0x0016, 0x0064}, {0x0016, 0x0065}, {0x0016, 0x0066}, {0x0016, 0x0067}, {0x0016, 0x0068}, {0x0016, 0x0069}, + {0x0016, 0x006a}, {0x0016, 0x006b}, {0x0016, 0x006c}, {0x0016, 0x006d}, {0x0016, 0x006e}, {0x0016, 0x006f}, {0x0016, 0x0070}, {0x0016, 0x0071}, + {0x0016, 0x0072}, {0x0016, 0x0073}, {0x0016, 0x0074}, {0x0016, 0x0075}, + +}; + +const uint32_t c_aauiCQMFHuffDec11[50][16] = +{ + {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000001, 0x0000000e, 0x0000001d, 0x0001000f, 0x0001000f, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0007ffff, 0x0005ffff, 0x0004ffff, 0x0006ffff, 0x00010003, 0x00010003, 0x0001001f, 0x0001001f, 0x0001002a, 0x0001002a, 0x0001002c, 0x0001002c, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x000bffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x00000021, 0x00000046, 0x00000048, 0x00010013, 0x00010013, 0x0001002e, 0x0001002e, 0x0001003b, 0x0001003b, 0x00010047, 0x00010047, }, + {0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, + {0x00010054, 0x00010054, 0x00010057, 0x00010057, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, + {0x0014ffff, 0x0011ffff, 0x0010ffff, 0x000effff, 0x000fffff, 0x000cffff, 0x000dffff, 0x00000015, 0x0000004b, 0x00000063, 0x00010006, 0x00010006, 0x00010030, 0x00010030, 0x0001003d, 0x0001003d, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, }, + {0x00010059, 0x00010059, 0x00010071, 0x00010071, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, + {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, }, + {0x00000017, 0x00000032, 0x00000040, 0x0000004d, 0x0000005a, 0x00000066, 0x00000068, 0x00000070, 0x00000072, 0x00000073, 0x00000074, 0x0000007e, 0x0000007f, 0x00000080, 0x0001003f, 0x0001003f, }, + {0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0013ffff, 0x0012ffff, 0x00000008, }, + {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, + {0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, + {0x001affff, 0x0019ffff, 0x0015ffff, 0x0018ffff, 0x001dffff, 0x0016ffff, 0x0017ffff, 0x001bffff, 0x001cffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, + {0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, + {0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, + {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020035, 0x00020035, 0x00020035, 0x00020035, }, + {0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, + {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, + {0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020069, 0x00020069, 0x00020069, 0x00020069, }, + {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, }, + {0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, }, + {0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, }, + {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, + {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, + {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, 0x00020085, 0x00020085, 0x00020085, 0x00020085, }, + {0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, }, + {0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, }, + {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, + {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, + {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, 0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x00020099, 0x00020099, 0x00020099, 0x00020099, }, + {0x0002009a, 0x0002009a, 0x0002009a, 0x0002009a, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, }, + {0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, + {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, + {0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, }, + {0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, }, + {0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, }, + {0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, }, + {0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b9, 0x000200b9, 0x000200b9, 0x000200b9, }, + {0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200bd, }, + {0x000200be, 0x000200be, 0x000200be, 0x000200be, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, }, +}; + +const uint32_t c_aauiCQMFHuffEnc12[289][2] = +{ + {0x0001, 0x0001}, {0x0004, 0x0004}, {0x0005, 0x0004}, {0x0007, 0x0004}, {0x0008, 0x0002}, {0x000b, 0x0004}, {0x000e, 0x0006}, {0x0010, 0x0009}, + {0x0012, 0x0014}, {0x0013, 0x001f}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0016, 0x0005}, + {0x0016, 0x0006}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0005, 0x0005}, {0x0006, 0x0003}, {0x0008, 0x0003}, {0x000a, 0x0004}, {0x000d, 0x0006}, + {0x000f, 0x0008}, {0x0011, 0x000c}, {0x0013, 0x0020}, {0x0016, 0x0007}, {0x0015, 0x0063}, {0x0016, 0x0008}, {0x0016, 0x0009}, {0x0016, 0x000a}, + {0x0016, 0x000b}, {0x0016, 0x000c}, {0x0005, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0007}, {0x0006, 0x0004}, {0x0008, 0x0004}, {0x000b, 0x0005}, + {0x000d, 0x0007}, {0x0010, 0x000a}, {0x0012, 0x0015}, {0x0015, 0x0064}, {0x0016, 0x000d}, {0x0016, 0x000e}, {0x0016, 0x000f}, {0x0016, 0x0010}, + {0x0016, 0x0011}, {0x0016, 0x0012}, {0x0016, 0x0013}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0008, 0x0005}, {0x000a, 0x0005}, + {0x000c, 0x0005}, {0x000e, 0x0007}, {0x0010, 0x000b}, {0x0012, 0x0016}, {0x0014, 0x0037}, {0x0015, 0x0065}, {0x0016, 0x0014}, {0x0016, 0x0015}, + {0x0016, 0x0016}, {0x0016, 0x0017}, {0x0016, 0x0018}, {0x0016, 0x0019}, {0x0008, 0x0006}, {0x0007, 0x0005}, {0x0008, 0x0007}, {0x000a, 0x0006}, + {0x000c, 0x0006}, {0x000e, 0x0008}, {0x0010, 0x000c}, {0x0011, 0x000d}, {0x0013, 0x0021}, {0x0015, 0x0066}, {0x0016, 0x001a}, {0x0016, 0x001b}, + {0x0016, 0x001c}, {0x0016, 0x001d}, {0x0016, 0x001e}, {0x0016, 0x001f}, {0x0016, 0x0020}, {0x000b, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0007}, + {0x000c, 0x0007}, {0x000e, 0x0009}, {0x000f, 0x0009}, {0x0011, 0x000e}, {0x0013, 0x0022}, {0x0015, 0x0067}, {0x0015, 0x0068}, {0x0016, 0x0021}, + {0x0016, 0x0022}, {0x0016, 0x0023}, {0x0016, 0x0024}, {0x0016, 0x0025}, {0x0016, 0x0026}, {0x0016, 0x0027}, {0x000e, 0x000a}, {0x000d, 0x0008}, + {0x000d, 0x0009}, {0x000e, 0x000b}, {0x000f, 0x000a}, {0x0011, 0x000f}, {0x0013, 0x0023}, {0x0014, 0x0038}, {0x0016, 0x0028}, {0x0016, 0x0029}, + {0x0016, 0x002a}, {0x0016, 0x002b}, {0x0016, 0x002c}, {0x0016, 0x002d}, {0x0016, 0x002e}, {0x0016, 0x002f}, {0x0016, 0x0030}, {0x0010, 0x000d}, + {0x000f, 0x000b}, {0x0010, 0x000e}, {0x0010, 0x000f}, {0x0012, 0x0017}, {0x0013, 0x0024}, {0x0014, 0x0039}, {0x0016, 0x0031}, {0x0016, 0x0032}, + {0x0016, 0x0033}, {0x0016, 0x0034}, {0x0016, 0x0035}, {0x0016, 0x0036}, {0x0016, 0x0037}, {0x0016, 0x0038}, {0x0016, 0x0039}, {0x0016, 0x003a}, + {0x0013, 0x0025}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0016, 0x003b}, + {0x0016, 0x003c}, {0x0016, 0x003d}, {0x0016, 0x003e}, {0x0016, 0x003f}, {0x0016, 0x0040}, {0x0016, 0x0041}, {0x0016, 0x0042}, {0x0016, 0x0043}, + {0x0016, 0x0044}, {0x0015, 0x0069}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0015, 0x006a}, {0x0015, 0x006b}, {0x0015, 0x006c}, {0x0016, 0x0045}, + {0x0016, 0x0046}, {0x0016, 0x0047}, {0x0016, 0x0048}, {0x0016, 0x0049}, {0x0016, 0x004a}, {0x0016, 0x004b}, {0x0016, 0x004c}, {0x0016, 0x004d}, + {0x0016, 0x004e}, {0x0016, 0x004f}, {0x0016, 0x0050}, {0x0016, 0x0051}, {0x0015, 0x006d}, {0x0016, 0x0052}, {0x0016, 0x0053}, {0x0016, 0x0054}, + {0x0016, 0x0055}, {0x0016, 0x0056}, {0x0016, 0x0057}, {0x0016, 0x0058}, {0x0016, 0x0059}, {0x0016, 0x005a}, {0x0016, 0x005b}, {0x0016, 0x005c}, + {0x0016, 0x005d}, {0x0016, 0x005e}, {0x0016, 0x005f}, {0x0016, 0x0060}, {0x0016, 0x0061}, {0x0016, 0x0062}, {0x0016, 0x0063}, {0x0016, 0x0064}, + {0x0016, 0x0065}, {0x0016, 0x0066}, {0x0016, 0x0067}, {0x0016, 0x0068}, {0x0016, 0x0069}, {0x0016, 0x006a}, {0x0016, 0x006b}, {0x0016, 0x006c}, + {0x0016, 0x006d}, {0x0016, 0x006e}, {0x0016, 0x006f}, {0x0016, 0x0070}, {0x0016, 0x0071}, {0x0016, 0x0072}, {0x0016, 0x0073}, {0x0016, 0x0074}, + {0x0016, 0x0075}, {0x0016, 0x0076}, {0x0016, 0x0077}, {0x0016, 0x0078}, {0x0016, 0x0079}, {0x0016, 0x007a}, {0x0016, 0x007b}, {0x0016, 0x007c}, + {0x0016, 0x007d}, {0x0016, 0x007e}, {0x0016, 0x007f}, {0x0016, 0x0080}, {0x0016, 0x0081}, {0x0016, 0x0082}, {0x0016, 0x0083}, {0x0016, 0x0084}, + {0x0016, 0x0085}, {0x0016, 0x0086}, {0x0016, 0x0087}, {0x0016, 0x0088}, {0x0016, 0x0089}, {0x0016, 0x008a}, {0x0016, 0x008b}, {0x0016, 0x008c}, + {0x0016, 0x008d}, {0x0016, 0x008e}, {0x0016, 0x008f}, {0x0016, 0x0090}, {0x0016, 0x0091}, {0x0016, 0x0092}, {0x0016, 0x0093}, {0x0016, 0x0094}, + {0x0016, 0x0095}, {0x0016, 0x0096}, {0x0016, 0x0097}, {0x0016, 0x0098}, {0x0016, 0x0099}, {0x0016, 0x009a}, {0x0016, 0x009b}, {0x0016, 0x009c}, + {0x0016, 0x009d}, {0x0016, 0x009e}, {0x0016, 0x009f}, {0x0016, 0x00a0}, {0x0016, 0x00a1}, {0x0016, 0x00a2}, {0x0016, 0x00a3}, {0x0016, 0x00a4}, + {0x0016, 0x00a5}, {0x0016, 0x00a6}, {0x0016, 0x00a7}, {0x0016, 0x00a8}, {0x0016, 0x00a9}, {0x0016, 0x00aa}, {0x0016, 0x00ab}, {0x0016, 0x00ac}, + {0x0016, 0x00ad}, {0x0016, 0x00ae}, {0x0016, 0x00af}, {0x0016, 0x00b0}, {0x0016, 0x00b1}, {0x0016, 0x00b2}, {0x0016, 0x00b3}, {0x0016, 0x00b4}, + {0x0016, 0x00b5}, {0x0016, 0x00b6}, {0x0016, 0x00b7}, {0x0016, 0x00b8}, {0x0016, 0x00b9}, {0x0016, 0x00ba}, {0x0016, 0x00bb}, {0x0016, 0x00bc}, + {0x0016, 0x00bd}, {0x0016, 0x00be}, {0x0016, 0x00bf}, {0x0016, 0x00c0}, {0x0016, 0x00c1}, {0x0016, 0x00c2}, {0x0016, 0x00c3}, {0x0016, 0x00c4}, + {0x0016, 0x00c5}, + +}; + +const uint32_t c_aauiCQMFHuffDec12[76][16] = +{ + {0x0003ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x00000001, 0x00000011, 0x00000012, 0x00000023, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x0006ffff, 0x0005ffff, 0x00000004, 0x00000015, 0x00000026, 0x00000036, 0x00000044, 0x00000046, 0x00010003, 0x00010003, 0x00010045, 0x00010045, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, + {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020035, 0x00020035, 0x00020035, 0x00020035, }, + {0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, + {0x000bffff, 0x0009ffff, 0x000affff, 0x0007ffff, 0x0008ffff, 0x00000038, 0x00000048, 0x00000058, 0x00010005, 0x00010005, 0x00010027, 0x00010027, 0x00010055, 0x00010055, 0x00010057, 0x00010057, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, + {0x00010018, 0x00010018, 0x0001005a, 0x0001005a, 0x0001006a, 0x0001006a, 0x00010078, 0x00010078, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020069, 0x00020069, 0x00020069, 0x00020069, }, + {0x0018ffff, 0x0029ffff, 0x003affff, 0x0010ffff, 0x0011ffff, 0x000fffff, 0x000cffff, 0x000dffff, 0x000effff, 0x00000007, 0x00000029, 0x0000003a, 0x0000004a, 0x00000077, 0x00000079, 0x0000007a, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, + {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, }, + {0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, }, + {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, }, + {0x004bffff, 0x0012ffff, 0x0015ffff, 0x0013ffff, 0x0014ffff, 0x0016ffff, 0x0017ffff, 0x0000003c, 0x0000006d, 0x0000007d, 0x0000008d, 0x0000008e, 0x0000009a, 0x0000009b, 0x00010009, 0x00010009, }, + {0x0001001a, 0x0001001a, 0x0001004c, 0x0001004c, 0x0001005c, 0x0001005c, 0x0001006c, 0x0001006c, 0x0001007c, 0x0001007c, 0x00010088, 0x00010088, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, }, + {0x0002011f, 0x0002011f, 0x0002011f, 0x0002011f, 0x00020120, 0x00020120, 0x00020120, 0x00020120, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, }, + {0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, }, + {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, + {0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, }, + {0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, }, + {0x0025ffff, 0x001fffff, 0x0019ffff, 0x0020ffff, 0x001effff, 0x0021ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, }, + {0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, + {0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, + {0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, }, + {0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, }, + {0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, + {0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, }, + {0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, }, + {0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020075, 0x00020075, 0x00020075, 0x00020075, }, + {0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, + {0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x00020081, 0x00020081, 0x00020081, 0x00020081, 0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, }, + {0x00020085, 0x00020085, 0x00020085, 0x00020085, 0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, }, + {0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, 0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, }, + {0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, }, + {0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, 0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, }, + {0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, + {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, + {0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, }, + {0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, }, + {0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, }, + {0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, }, + {0x000200b7, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b9, 0x000200b9, 0x000200b9, 0x000200b9, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, }, + {0x000200bb, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200be, 0x000200be, 0x000200be, 0x000200be, }, + {0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, }, + {0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c5, 0x000200c5, 0x000200c5, 0x000200c5, 0x000200c6, 0x000200c6, 0x000200c6, 0x000200c6, }, + {0x000200c7, 0x000200c7, 0x000200c7, 0x000200c7, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200ca, 0x000200ca, 0x000200ca, 0x000200ca, }, + {0x000200cb, 0x000200cb, 0x000200cb, 0x000200cb, 0x000200cc, 0x000200cc, 0x000200cc, 0x000200cc, 0x000200cd, 0x000200cd, 0x000200cd, 0x000200cd, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200ce, }, + {0x000200cf, 0x000200cf, 0x000200cf, 0x000200cf, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200d2, 0x000200d2, 0x000200d2, 0x000200d2, }, + {0x000200d3, 0x000200d3, 0x000200d3, 0x000200d3, 0x000200d4, 0x000200d4, 0x000200d4, 0x000200d4, 0x000200d5, 0x000200d5, 0x000200d5, 0x000200d5, 0x000200d6, 0x000200d6, 0x000200d6, 0x000200d6, }, + {0x000200d7, 0x000200d7, 0x000200d7, 0x000200d7, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200d9, 0x000200d9, 0x000200d9, 0x000200d9, 0x000200da, 0x000200da, 0x000200da, 0x000200da, }, + {0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, }, + {0x000200db, 0x000200db, 0x000200db, 0x000200db, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200de, 0x000200de, 0x000200de, 0x000200de, }, + {0x000200df, 0x000200df, 0x000200df, 0x000200df, 0x000200e0, 0x000200e0, 0x000200e0, 0x000200e0, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e2, 0x000200e2, 0x000200e2, 0x000200e2, }, + {0x000200e3, 0x000200e3, 0x000200e3, 0x000200e3, 0x000200e4, 0x000200e4, 0x000200e4, 0x000200e4, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200e6, 0x000200e6, 0x000200e6, 0x000200e6, }, + {0x000200e7, 0x000200e7, 0x000200e7, 0x000200e7, 0x000200e8, 0x000200e8, 0x000200e8, 0x000200e8, 0x000200e9, 0x000200e9, 0x000200e9, 0x000200e9, 0x000200ea, 0x000200ea, 0x000200ea, 0x000200ea, }, + {0x000200eb, 0x000200eb, 0x000200eb, 0x000200eb, 0x000200ec, 0x000200ec, 0x000200ec, 0x000200ec, 0x000200ed, 0x000200ed, 0x000200ed, 0x000200ed, 0x000200ee, 0x000200ee, 0x000200ee, 0x000200ee, }, + {0x000200ef, 0x000200ef, 0x000200ef, 0x000200ef, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f1, 0x000200f1, 0x000200f1, 0x000200f1, 0x000200f2, 0x000200f2, 0x000200f2, 0x000200f2, }, + {0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f5, 0x000200f5, 0x000200f5, 0x000200f5, 0x000200f6, 0x000200f6, 0x000200f6, 0x000200f6, }, + {0x000200f7, 0x000200f7, 0x000200f7, 0x000200f7, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f9, 0x000200f9, 0x000200f9, 0x000200f9, 0x000200fa, 0x000200fa, 0x000200fa, 0x000200fa, }, + {0x000200fb, 0x000200fb, 0x000200fb, 0x000200fb, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fe, 0x000200fe, 0x000200fe, 0x000200fe, }, + {0x000200ff, 0x000200ff, 0x000200ff, 0x000200ff, 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020101, 0x00020101, 0x00020101, 0x00020101, 0x00020102, 0x00020102, 0x00020102, 0x00020102, }, + {0x00020103, 0x00020103, 0x00020103, 0x00020103, 0x00020104, 0x00020104, 0x00020104, 0x00020104, 0x00020105, 0x00020105, 0x00020105, 0x00020105, 0x00020106, 0x00020106, 0x00020106, 0x00020106, }, + {0x00020107, 0x00020107, 0x00020107, 0x00020107, 0x00020108, 0x00020108, 0x00020108, 0x00020108, 0x00020109, 0x00020109, 0x00020109, 0x00020109, 0x0002010a, 0x0002010a, 0x0002010a, 0x0002010a, }, + {0x0002010b, 0x0002010b, 0x0002010b, 0x0002010b, 0x0002010c, 0x0002010c, 0x0002010c, 0x0002010c, 0x0002010d, 0x0002010d, 0x0002010d, 0x0002010d, 0x0002010e, 0x0002010e, 0x0002010e, 0x0002010e, }, + {0x0002010f, 0x0002010f, 0x0002010f, 0x0002010f, 0x00020110, 0x00020110, 0x00020110, 0x00020110, 0x00020111, 0x00020111, 0x00020111, 0x00020111, 0x00020112, 0x00020112, 0x00020112, 0x00020112, }, + {0x00020113, 0x00020113, 0x00020113, 0x00020113, 0x00020114, 0x00020114, 0x00020114, 0x00020114, 0x00020115, 0x00020115, 0x00020115, 0x00020115, 0x00020116, 0x00020116, 0x00020116, 0x00020116, }, + {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020118, 0x00020118, 0x00020118, 0x00020118, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x0002011a, 0x0002011a, 0x0002011a, 0x0002011a, }, + {0x0002011b, 0x0002011b, 0x0002011b, 0x0002011b, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011e, 0x0002011e, 0x0002011e, 0x0002011e, }, +}; + +const uint32_t c_aauiCQMFHuffEnc13[324][2] = +{ + {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0006, 0x0004}, {0x0008, 0x0005}, {0x000a, 0x0005}, {0x000c, 0x0007}, + {0x000e, 0x000b}, {0x0010, 0x0011}, {0x0012, 0x002d}, {0x0015, 0x0000}, {0x0014, 0x0035}, {0x0015, 0x0001}, {0x0015, 0x0002}, {0x0015, 0x0003}, + {0x0015, 0x0004}, {0x0015, 0x0005}, {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0006, 0x0005}, {0x0008, 0x0006}, + {0x0009, 0x0006}, {0x000c, 0x0008}, {0x000d, 0x0009}, {0x0010, 0x0012}, {0x0011, 0x001a}, {0x0015, 0x0006}, {0x0015, 0x0007}, {0x0015, 0x0008}, + {0x0015, 0x0009}, {0x0015, 0x000a}, {0x0015, 0x000b}, {0x0015, 0x000c}, {0x0005, 0x0007}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x0008}, + {0x0006, 0x0006}, {0x0008, 0x0007}, {0x000a, 0x0006}, {0x000c, 0x0009}, {0x000e, 0x000c}, {0x0010, 0x0013}, {0x0012, 0x002e}, {0x0015, 0x000d}, + {0x0015, 0x000e}, {0x0015, 0x000f}, {0x0015, 0x0010}, {0x0015, 0x0011}, {0x0015, 0x0012}, {0x0015, 0x0013}, {0x0005, 0x0009}, {0x0004, 0x000d}, + {0x0005, 0x000a}, {0x0006, 0x0007}, {0x0007, 0x0005}, {0x0009, 0x0007}, {0x000b, 0x0008}, {0x000d, 0x000a}, {0x000f, 0x000e}, {0x0010, 0x0014}, + {0x0011, 0x001b}, {0x0014, 0x0036}, {0x0015, 0x0014}, {0x0015, 0x0015}, {0x0015, 0x0016}, {0x0015, 0x0017}, {0x0015, 0x0018}, {0x0015, 0x0019}, + {0x0006, 0x0008}, {0x0005, 0x000b}, {0x0006, 0x0009}, {0x0007, 0x0006}, {0x0009, 0x0008}, {0x000a, 0x0007}, {0x000c, 0x000a}, {0x000e, 0x000d}, + {0x0010, 0x0015}, {0x0011, 0x001c}, {0x0013, 0x0053}, {0x0015, 0x001a}, {0x0015, 0x001b}, {0x0015, 0x001c}, {0x0015, 0x001d}, {0x0015, 0x001e}, + {0x0015, 0x001f}, {0x0015, 0x0020}, {0x0008, 0x0008}, {0x0007, 0x0007}, {0x0008, 0x0009}, {0x0009, 0x0009}, {0x000a, 0x0008}, {0x000c, 0x000b}, + {0x000d, 0x000b}, {0x000f, 0x000f}, {0x0010, 0x0016}, {0x0011, 0x001d}, {0x0014, 0x0037}, {0x0015, 0x0021}, {0x0015, 0x0022}, {0x0015, 0x0023}, + {0x0015, 0x0024}, {0x0015, 0x0025}, {0x0015, 0x0026}, {0x0015, 0x0027}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000b, 0x0009}, + {0x000c, 0x000c}, {0x000d, 0x000c}, {0x000f, 0x0010}, {0x0010, 0x0017}, {0x0012, 0x002f}, {0x0015, 0x0028}, {0x0015, 0x0029}, {0x0015, 0x002a}, + {0x0015, 0x002b}, {0x0015, 0x002c}, {0x0015, 0x002d}, {0x0015, 0x002e}, {0x0015, 0x002f}, {0x0015, 0x0030}, {0x000c, 0x000d}, {0x000c, 0x000e}, + {0x000c, 0x000f}, {0x000d, 0x000d}, {0x000e, 0x000e}, {0x000f, 0x0011}, {0x0010, 0x0018}, {0x0011, 0x001e}, {0x0014, 0x0038}, {0x0015, 0x0031}, + {0x0015, 0x0032}, {0x0015, 0x0033}, {0x0015, 0x0034}, {0x0015, 0x0035}, {0x0015, 0x0036}, {0x0015, 0x0037}, {0x0015, 0x0038}, {0x0015, 0x0039}, + {0x000f, 0x0012}, {0x000e, 0x000f}, {0x000e, 0x0010}, {0x000e, 0x0011}, {0x000f, 0x0013}, {0x0010, 0x0019}, {0x0011, 0x001f}, {0x0013, 0x0054}, + {0x0015, 0x003a}, {0x0014, 0x0039}, {0x0015, 0x003b}, {0x0015, 0x003c}, {0x0015, 0x003d}, {0x0015, 0x003e}, {0x0015, 0x003f}, {0x0015, 0x0040}, + {0x0015, 0x0041}, {0x0015, 0x0042}, {0x0010, 0x001a}, {0x000f, 0x0014}, {0x000f, 0x0015}, {0x0010, 0x001b}, {0x0011, 0x0020}, {0x0012, 0x0030}, + {0x0013, 0x0055}, {0x0015, 0x0043}, {0x0015, 0x0044}, {0x0014, 0x003a}, {0x0015, 0x0045}, {0x0015, 0x0046}, {0x0015, 0x0047}, {0x0015, 0x0048}, + {0x0015, 0x0049}, {0x0015, 0x004a}, {0x0015, 0x004b}, {0x0015, 0x004c}, {0x0012, 0x0031}, {0x0011, 0x0021}, {0x0013, 0x0056}, {0x0013, 0x0057}, + {0x0012, 0x0032}, {0x0015, 0x004d}, {0x0015, 0x004e}, {0x0015, 0x004f}, {0x0015, 0x0050}, {0x0015, 0x0051}, {0x0015, 0x0052}, {0x0015, 0x0053}, + {0x0015, 0x0054}, {0x0015, 0x0055}, {0x0015, 0x0056}, {0x0015, 0x0057}, {0x0015, 0x0058}, {0x0015, 0x0059}, {0x0015, 0x005a}, {0x0014, 0x003b}, + {0x0012, 0x0033}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0015, 0x005b}, {0x0015, 0x005c}, {0x0015, 0x005d}, {0x0015, 0x005e}, {0x0015, 0x005f}, + {0x0015, 0x0060}, {0x0015, 0x0061}, {0x0015, 0x0062}, {0x0015, 0x0063}, {0x0015, 0x0064}, {0x0015, 0x0065}, {0x0015, 0x0066}, {0x0015, 0x0067}, + {0x0015, 0x0068}, {0x0015, 0x0069}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, + {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, + {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, + {0x0014, 0x0052}, {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, + {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, + {0x0014, 0x0062}, {0x0014, 0x0063}, {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, + {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, + {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, + {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, + {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, + {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, + {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, + {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, + {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, + +}; + +const uint32_t c_aauiCQMFHuffDec13[89][16] = +{ + {0x0006ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000001, 0x00000012, 0x00000014, 0x00000015, 0x00000025, 0x00000026, 0x00000037, 0x00010013, 0x00010013, }, + {0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, + {0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x000bffff, 0x0009ffff, 0x000affff, 0x0007ffff, 0x0008ffff, 0x00000005, 0x00000017, 0x00000029, 0x0000005a, 0x0000005c, 0x0001003a, 0x0001003a, 0x0001004b, 0x0001004b, 0x0001005b, 0x0001005b, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, }, + {0x0001003c, 0x0001003c, 0x0001006f, 0x0001006f, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, }, + {0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, }, + {0x0012ffff, 0x0011ffff, 0x0010ffff, 0x000fffff, 0x000dffff, 0x000cffff, 0x000effff, 0x00000007, 0x00000019, 0x0000002b, 0x0000004e, 0x0000005f, 0x00000070, 0x0000007e, 0x0000007f, 0x00000080, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, + {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, + {0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, + {0x00010072, 0x00010072, 0x00010083, 0x00010083, 0x00010090, 0x00010090, 0x00010094, 0x00010094, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, + {0x0016ffff, 0x00000009, 0x0000001b, 0x0000002d, 0x0000003f, 0x00000050, 0x00000062, 0x00000073, 0x00000084, 0x00000095, 0x000000a2, 0x000000a5, 0x0001003e, 0x0001003e, 0x00010061, 0x00010061, }, + {0x0021ffff, 0x0024ffff, 0x003dffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0019ffff, 0x0017ffff, 0x0018ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, }, + {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, }, + {0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, }, + {0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, }, + {0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x00020074, 0x00020074, 0x00020074, 0x00020074, }, + {0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, }, + {0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00010052, 0x00010052, 0x00010097, 0x00010097, 0x000100a8, 0x000100a8, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, }, + {0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0000000c, 0x00000041, 0x00000064, 0x00000086, 0x00000099, 0x000000ab, 0x000000c7, 0x000000da, 0x000000db, 0x000000dc, 0x000000dd, }, + {0x000000de, 0x000000df, 0x000000e0, 0x000000e1, 0x000000e2, 0x000000e3, 0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, }, + {0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000f3, 0x000000f4, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, 0x000000f9, 0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, }, + {0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, 0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, }, + {0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, 0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, }, + {0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000129, 0x0000012a, 0x0000012b, 0x0000012c, 0x0000012d, }, + {0x0000012e, 0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, }, + {0x0026ffff, 0x002dffff, 0x0037ffff, 0x0023ffff, 0x0044ffff, 0x002effff, 0x003affff, 0x0022ffff, 0x002cffff, 0x0035ffff, 0x002fffff, 0x0036ffff, 0x0040ffff, 0x0049ffff, 0x0030ffff, 0x0038ffff, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0041ffff, 0x004affff, 0x0042ffff, 0x0025ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0039ffff, 0x003bffff, 0x003cffff, }, + {0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, }, + {0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, + {0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, }, + {0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, }, + {0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, + {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, + {0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, }, + {0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, }, + {0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, }, + {0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, + {0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, }, + {0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, }, + {0x003effff, 0x003fffff, 0x0043ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, }, + {0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, }, + {0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, + {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, + {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, + {0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, }, + {0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, }, + {0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, }, + {0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, }, + {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, + {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, + {0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, }, + {0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, }, + {0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, }, + {0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, }, + {0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, }, + {0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, }, + {0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, }, + {0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, }, + {0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, }, + {0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, }, + {0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, }, + {0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, }, + {0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, }, + {0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, }, +}; + +const uint32_t c_aauiCQMFHuffEnc14[400][2] = +{ + {0x0005, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0006}, {0x0007, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x0008}, + {0x000d, 0x000c}, {0x000f, 0x0013}, {0x0010, 0x001b}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, + {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x000a}, + {0x0005, 0x000b}, {0x0006, 0x0007}, {0x0008, 0x0006}, {0x000a, 0x0007}, {0x000c, 0x000a}, {0x000e, 0x000e}, {0x000f, 0x0014}, {0x0011, 0x002a}, + {0x0012, 0x004a}, {0x0013, 0x0084}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, + {0x0005, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x000d}, {0x0006, 0x0008}, {0x0007, 0x0007}, {0x0008, 0x0007}, {0x000a, 0x0008}, + {0x000c, 0x000b}, {0x000e, 0x000f}, {0x000f, 0x0015}, {0x0012, 0x004b}, {0x0013, 0x0085}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, + {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0005, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x000f}, {0x0005, 0x0010}, + {0x0006, 0x0009}, {0x0008, 0x0008}, {0x0009, 0x0008}, {0x000b, 0x0009}, {0x000d, 0x000d}, {0x000e, 0x0010}, {0x0010, 0x001c}, {0x0011, 0x002b}, + {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, + {0x0006, 0x000a}, {0x0005, 0x0011}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0007, 0x0008}, {0x0008, 0x0009}, {0x000a, 0x0009}, {0x000c, 0x000c}, + {0x000e, 0x0011}, {0x000f, 0x0016}, {0x0010, 0x001d}, {0x0012, 0x004c}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0014, 0x001f}, + {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0007, 0x0009}, {0x0006, 0x000d}, {0x0007, 0x000a}, {0x0007, 0x000b}, + {0x0009, 0x0009}, {0x000a, 0x000a}, {0x000b, 0x000a}, {0x000d, 0x000e}, {0x000f, 0x0017}, {0x0011, 0x002c}, {0x0010, 0x001e}, {0x0014, 0x0024}, + {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0014, 0x002b}, {0x0014, 0x002c}, + {0x0009, 0x000a}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0009, 0x000b}, {0x000a, 0x000b}, {0x000b, 0x000b}, {0x000d, 0x000f}, {0x000e, 0x0012}, + {0x000f, 0x0018}, {0x0011, 0x002d}, {0x0011, 0x002e}, {0x0013, 0x0086}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, + {0x0014, 0x0031}, {0x0014, 0x0032}, {0x0014, 0x0033}, {0x0014, 0x0034}, {0x000b, 0x000c}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000b, 0x000d}, + {0x000c, 0x000d}, {0x000d, 0x0010}, {0x000e, 0x0013}, {0x000f, 0x0019}, {0x0010, 0x001f}, {0x0013, 0x0087}, {0x0014, 0x0035}, {0x0014, 0x0036}, + {0x0013, 0x0088}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, + {0x000d, 0x0011}, {0x000c, 0x000e}, {0x000c, 0x000f}, {0x000d, 0x0012}, {0x000d, 0x0013}, {0x000e, 0x0014}, {0x0010, 0x0020}, {0x0010, 0x0021}, + {0x0012, 0x004d}, {0x0011, 0x002f}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, + {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x000f, 0x001a}, {0x000e, 0x0015}, {0x000e, 0x0016}, {0x000e, 0x0017}, + {0x000f, 0x001b}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0014, 0x0048}, {0x0014, 0x0049}, + {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, + {0x0010, 0x0022}, {0x0010, 0x0023}, {0x0010, 0x0024}, {0x0010, 0x0025}, {0x0011, 0x0032}, {0x0011, 0x0033}, {0x0012, 0x004e}, {0x0012, 0x004f}, + {0x0014, 0x0052}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, + {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0011, 0x0034}, {0x0011, 0x0035}, {0x0012, 0x0050}, {0x0012, 0x0051}, + {0x0013, 0x008e}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, + {0x0014, 0x0063}, {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, + {0x0012, 0x0052}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0014, 0x006b}, {0x0013, 0x0091}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, + {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, + {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0013, 0x0092}, {0x0012, 0x0053}, + {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, + {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, + {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0013, 0x0093}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, + {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, + {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, + {0x0014, 0x00a4}, {0x0014, 0x00a5}, {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, + {0x0014, 0x00ac}, {0x0014, 0x00ad}, {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, + {0x0014, 0x00b4}, {0x0014, 0x00b5}, {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, + {0x0014, 0x00bc}, {0x0014, 0x00bd}, {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, + {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, + {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, + {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, + {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, + {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, + {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, + {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, + {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, +}; + +const uint32_t c_aauiCQMFHuffDec14[53][16] = +{ + {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x00000001, 0x00000014, 0x00000015, 0x00000016, 0x00000029, 0x0000002a, 0x0000003d, }, + {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, + {0x00010054, 0x00010054, 0x00010064, 0x00010064, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, + {0x000fffff, 0x000dffff, 0x000effff, 0x000affff, 0x000bffff, 0x000cffff, 0x0000001a, 0x0000002e, 0x00000041, 0x00000055, 0x00000079, 0x0000007a, 0x00010005, 0x00010005, 0x0001002d, 0x0001002d, }, + {0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, + {0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, + {0x00010007, 0x00010007, 0x00010043, 0x00010043, 0x0001006a, 0x0001006a, 0x0001007d, 0x0001007d, 0x0001008c, 0x0001008c, 0x0001008f, 0x0001008f, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, }, + {0x0024ffff, 0x0018ffff, 0x0017ffff, 0x0015ffff, 0x0014ffff, 0x0016ffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000001c, 0x00000030, 0x00000057, 0x00000090, 0x000000a1, 0x000000a2, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, + {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, }, + {0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, }, + {0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, }, + {0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020092, 0x00020092, 0x00020092, 0x00020092, }, + {0x00010080, 0x00010080, 0x00010093, 0x00010093, 0x000100b4, 0x000100b4, 0x000100b8, 0x000100b8, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x00020031, 0x00020031, 0x00020031, 0x00020031, }, + {0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b7, }, + {0x000000a6, 0x000000a7, 0x000000c8, 0x000000c9, 0x000000ca, 0x000000cb, 0x00010009, 0x00010009, 0x0001001e, 0x0001001e, 0x00010032, 0x00010032, 0x00010059, 0x00010059, 0x0001006c, 0x0001006c, }, + {0x0022ffff, 0x0023ffff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x0000000a, 0x00000046, 0x0000005a, 0x0000006e, 0x00000094, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, + {0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, + {0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, }, + {0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, }, + {0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, }, + {0x000100f2, 0x000100f2, 0x000100f4, 0x000100f4, 0x00010106, 0x00010106, 0x0001011a, 0x0001011a, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, + {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200cf, 0x000200cf, 0x000200cf, 0x000200cf, }, + {0x000200de, 0x000200de, 0x000200de, 0x000200de, 0x000200df, 0x000200df, 0x000200df, 0x000200df, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f0, 0x00020107, 0x00020107, 0x00020107, 0x00020107, }, + {0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x00010021, 0x00010021, 0x00010034, 0x00010034, 0x00010083, 0x00010083, 0x00010095, 0x00010095, }, + {0x00010098, 0x00010098, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100e0, 0x000100e0, 0x000100f1, 0x000100f1, }, + {0x0025ffff, 0x0026ffff, 0x0028ffff, 0x0027ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, }, + {0x0000000d, 0x0000000e, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000035, 0x00000036, 0x00000037, }, + {0x00000038, 0x00000039, 0x0000003a, 0x0000003b, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, }, + {0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x00000096, 0x00000097, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000aa, 0x000000ab, }, + {0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000084, 0x00000085, 0x00000086, }, + {0x000000ac, 0x000000ad, 0x000000ae, 0x000000af, 0x000000b0, 0x000000b1, 0x000000b2, 0x000000b3, 0x000000be, 0x000000bf, 0x000000c0, 0x000000c1, 0x000000c2, 0x000000c3, 0x000000c4, 0x000000c5, }, + {0x000000c6, 0x000000c7, 0x000000d0, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000d8, 0x000000d9, 0x000000da, 0x000000db, 0x000000e1, 0x000000e2, 0x000000e3, 0x000000e4, }, + {0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f3, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, }, + {0x000000f9, 0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000108, 0x00000109, 0x0000010a, }, + {0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, 0x0000011b, }, + {0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000129, 0x0000012a, 0x0000012b, }, + {0x0000012c, 0x0000012d, 0x0000012e, 0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, }, + {0x0000013c, 0x0000013d, 0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00000144, 0x00000145, 0x00000146, 0x00000147, 0x00000148, 0x00000149, 0x0000014a, 0x0000014b, }, + {0x0000014c, 0x0000014d, 0x0000014e, 0x0000014f, 0x00000150, 0x00000151, 0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, }, + {0x0000015c, 0x0000015d, 0x0000015e, 0x0000015f, 0x00000160, 0x00000161, 0x00000162, 0x00000163, 0x00000164, 0x00000165, 0x00000166, 0x00000167, 0x00000168, 0x00000169, 0x0000016a, 0x0000016b, }, + {0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, 0x0000017a, 0x0000017b, }, + {0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, }, +}; + +const uint32_t c_aauiCQMFHuffEnc15[576][2] = +{ + {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0007, 0x0008}, {0x0008, 0x0009}, {0x0009, 0x0008}, + {0x000b, 0x000b}, {0x000d, 0x000e}, {0x000e, 0x0011}, {0x000f, 0x001a}, {0x0012, 0x006e}, {0x0014, 0x0000}, {0x0013, 0x00cc}, {0x0014, 0x0001}, + {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, + {0x0005, 0x000d}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0006, 0x000b}, {0x0007, 0x0009}, {0x0008, 0x000a}, + {0x000a, 0x000a}, {0x000c, 0x000c}, {0x000d, 0x000f}, {0x000f, 0x001b}, {0x0011, 0x003d}, {0x0011, 0x003e}, {0x0013, 0x00cd}, {0x0014, 0x000a}, + {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, + {0x0005, 0x0010}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0006, 0x000c}, {0x0007, 0x000a}, {0x0009, 0x0009}, + {0x000a, 0x000b}, {0x000c, 0x000d}, {0x000e, 0x0012}, {0x0010, 0x0027}, {0x0011, 0x003f}, {0x0012, 0x006f}, {0x0014, 0x0013}, {0x0014, 0x0014}, + {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, + {0x0006, 0x000d}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0006, 0x000e}, {0x0007, 0x000b}, {0x0008, 0x000b}, {0x0009, 0x000a}, + {0x000b, 0x000c}, {0x000c, 0x000e}, {0x000e, 0x0013}, {0x000f, 0x001c}, {0x0011, 0x0040}, {0x0012, 0x0070}, {0x0014, 0x001d}, {0x0014, 0x001e}, + {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0014, 0x0026}, + {0x0006, 0x000f}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0007, 0x000c}, {0x0009, 0x000b}, {0x000a, 0x000c}, + {0x000b, 0x000d}, {0x000d, 0x0010}, {0x000e, 0x0014}, {0x0010, 0x0028}, {0x0011, 0x0041}, {0x0013, 0x00ce}, {0x0014, 0x0027}, {0x0014, 0x0028}, + {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, + {0x0007, 0x000d}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x000c}, {0x0009, 0x000c}, {0x000b, 0x000e}, + {0x000c, 0x000f}, {0x000e, 0x0015}, {0x0010, 0x0029}, {0x0011, 0x0042}, {0x0014, 0x0031}, {0x0014, 0x0032}, {0x0014, 0x0033}, {0x0014, 0x0034}, + {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, + {0x0008, 0x000d}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000e}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x000b, 0x000f}, {0x000c, 0x0010}, + {0x000d, 0x0011}, {0x000f, 0x001d}, {0x0010, 0x002a}, {0x0011, 0x0043}, {0x0014, 0x003d}, {0x0013, 0x00cf}, {0x0014, 0x003e}, {0x0014, 0x003f}, + {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, + {0x0009, 0x000f}, {0x0008, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x000a, 0x000d}, {0x000b, 0x0010}, {0x000c, 0x0011}, {0x000d, 0x0012}, + {0x000e, 0x0016}, {0x0010, 0x002b}, {0x0011, 0x0044}, {0x0012, 0x0071}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, {0x0014, 0x004b}, + {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, {0x0014, 0x0053}, + {0x000b, 0x0011}, {0x000a, 0x000e}, {0x000a, 0x000f}, {0x000b, 0x0012}, {0x000b, 0x0013}, {0x000c, 0x0012}, {0x000d, 0x0013}, {0x000e, 0x0017}, + {0x0010, 0x002c}, {0x0012, 0x0072}, {0x0011, 0x0045}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, + {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, + {0x000c, 0x0013}, {0x000c, 0x0014}, {0x000c, 0x0015}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x000e, 0x0018}, {0x000f, 0x001e}, {0x0010, 0x002d}, + {0x0011, 0x0046}, {0x0011, 0x0047}, {0x0011, 0x0048}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, {0x0014, 0x0063}, + {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, + {0x000e, 0x0019}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000e, 0x001a}, {0x000e, 0x001b}, {0x000f, 0x001f}, {0x0010, 0x002e}, {0x0011, 0x0049}, + {0x0012, 0x0073}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, + {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, + {0x0010, 0x002f}, {0x000f, 0x0020}, {0x0010, 0x0030}, {0x000f, 0x0021}, {0x0010, 0x0031}, {0x0011, 0x004a}, {0x0011, 0x004b}, {0x0012, 0x0074}, + {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0013, 0x00d2}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, + {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, + {0x0012, 0x0075}, {0x0010, 0x0032}, {0x0010, 0x0033}, {0x0011, 0x004c}, {0x0011, 0x004d}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0012, 0x0076}, + {0x0013, 0x00d5}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, + {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, + {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0012, 0x0077}, {0x0012, 0x0078}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0013, 0x00d8}, {0x0014, 0x009b}, + {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, + {0x0014, 0x00a4}, {0x0014, 0x00a5}, {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, + {0x0014, 0x00ac}, {0x0014, 0x00ad}, {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0012, 0x0079}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, + {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, + {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, + {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, + {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, + {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, + {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, + {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, + {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, + {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, + {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, + {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, {0x0014, 0x0106}, {0x0014, 0x0107}, {0x0014, 0x0108}, + {0x0014, 0x0109}, {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, {0x0014, 0x010e}, {0x0014, 0x010f}, {0x0014, 0x0110}, + {0x0014, 0x0111}, {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, {0x0014, 0x0116}, {0x0014, 0x0117}, {0x0014, 0x0118}, + {0x0014, 0x0119}, {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, {0x0014, 0x011e}, {0x0014, 0x011f}, {0x0014, 0x0120}, + {0x0014, 0x0121}, {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, + {0x0014, 0x0129}, {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, + {0x0014, 0x0131}, {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, {0x0014, 0x0136}, {0x0014, 0x0137}, {0x0014, 0x0138}, + {0x0014, 0x0139}, {0x0014, 0x013a}, {0x0014, 0x013b}, {0x0014, 0x013c}, {0x0014, 0x013d}, {0x0014, 0x013e}, {0x0014, 0x013f}, {0x0014, 0x0140}, + {0x0014, 0x0141}, {0x0014, 0x0142}, {0x0014, 0x0143}, {0x0014, 0x0144}, {0x0014, 0x0145}, {0x0014, 0x0146}, {0x0014, 0x0147}, {0x0014, 0x0148}, + {0x0014, 0x0149}, {0x0014, 0x014a}, {0x0014, 0x014b}, {0x0014, 0x014c}, {0x0014, 0x014d}, {0x0014, 0x014e}, {0x0014, 0x014f}, {0x0014, 0x0150}, + {0x0014, 0x0151}, {0x0014, 0x0152}, {0x0014, 0x0153}, {0x0014, 0x0154}, {0x0014, 0x0155}, {0x0014, 0x0156}, {0x0014, 0x0157}, {0x0014, 0x0158}, + {0x0014, 0x0159}, {0x0014, 0x015a}, {0x0014, 0x015b}, {0x0014, 0x015c}, {0x0014, 0x015d}, {0x0014, 0x015e}, {0x0014, 0x015f}, {0x0014, 0x0160}, + {0x0014, 0x0161}, {0x0014, 0x0162}, {0x0014, 0x0163}, {0x0014, 0x0164}, {0x0014, 0x0165}, {0x0014, 0x0166}, {0x0014, 0x0167}, {0x0014, 0x0168}, + {0x0014, 0x0169}, {0x0014, 0x016a}, {0x0014, 0x016b}, {0x0014, 0x016c}, {0x0014, 0x016d}, {0x0014, 0x016e}, {0x0014, 0x016f}, {0x0014, 0x0170}, + {0x0014, 0x0171}, {0x0014, 0x0172}, {0x0014, 0x0173}, {0x0014, 0x0174}, {0x0014, 0x0175}, {0x0014, 0x0176}, {0x0014, 0x0177}, {0x0014, 0x0178}, + {0x0014, 0x0179}, {0x0014, 0x017a}, {0x0014, 0x017b}, {0x0014, 0x017c}, {0x0014, 0x017d}, {0x0014, 0x017e}, {0x0014, 0x017f}, {0x0014, 0x0180}, + {0x0014, 0x0181}, {0x0014, 0x0182}, {0x0014, 0x0183}, {0x0014, 0x0184}, {0x0014, 0x0185}, {0x0014, 0x0186}, {0x0014, 0x0187}, {0x0014, 0x0188}, + {0x0014, 0x0189}, {0x0014, 0x018a}, {0x0014, 0x018b}, {0x0014, 0x018c}, {0x0014, 0x018d}, {0x0014, 0x018e}, {0x0014, 0x018f}, {0x0014, 0x0190}, + {0x0014, 0x0191}, {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0013, 0x00db}, +}; + +const uint32_t c_aauiCQMFHuffDec15[73][16] = +{ + {0x000cffff, 0x000bffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x0002ffff, 0x0001ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000019, 0x0000001a, 0x00000031, 0x00000032, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, + {0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, + {0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, }, + {0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, + {0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x00020060, 0x00020060, 0x00020060, 0x00020060, }, + {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, + {0x00010005, 0x00010005, 0x0001001e, 0x0001001e, 0x00010036, 0x00010036, 0x0001004d, 0x0001004d, 0x00010065, 0x00010065, 0x00010078, 0x00010078, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, }, + {0x0015ffff, 0x0014ffff, 0x0012ffff, 0x0013ffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x00000006, 0x0000001f, 0x0000004e, 0x0000007d, 0x00000090, 0x00000093, 0x000000a9, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, }, + {0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, }, + {0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, }, + {0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, }, + {0x000100ad, 0x000100ad, 0x000100c0, 0x000100c0, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020038, 0x00020038, 0x00020038, 0x00020038, }, + {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, }, + {0x00000097, 0x000000ae, 0x000000c5, 0x000000d8, 0x000000d9, 0x000000da, 0x00010008, 0x00010008, 0x00010050, 0x00010050, 0x00010068, 0x00010068, 0x0001007f, 0x0001007f, 0x00010096, 0x00010096, }, + {0x002fffff, 0x0020ffff, 0x001fffff, 0x001effff, 0x001bffff, 0x001cffff, 0x001dffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x00000021, 0x00000039, 0x00000051, 0x00000080, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, }, + {0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, }, + {0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, }, + {0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, }, + {0x00010109, 0x00010109, 0x0001010b, 0x0001010b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, + {0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x00020081, 0x00020081, 0x00020081, 0x00020081, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200c7, 0x000200c7, 0x000200c7, 0x000200c7, }, + {0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f4, }, + {0x0000010a, 0x0000010c, 0x00000121, 0x00000122, 0x0001000b, 0x0001000b, 0x00010023, 0x00010023, 0x00010053, 0x00010053, 0x00010099, 0x00010099, 0x000100de, 0x000100de, 0x000100f5, 0x000100f5, }, + {0x0024ffff, 0x0022ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x0000003b, 0x0000006b, 0x00000082, 0x0000009a, 0x000000b1, 0x000000c8, 0x000000df, 0x000000f6, 0x00000108, }, + {0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x002dffff, 0x002effff, 0x002affff, 0x002bffff, 0x002cffff, 0x0021ffff, 0x0023ffff, }, + {0x0002013b, 0x0002013b, 0x0002013b, 0x0002013b, 0x00020154, 0x00020154, 0x00020154, 0x00020154, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, }, + {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, }, + {0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, }, + {0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, }, + {0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, }, + {0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, }, + {0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, }, + {0x0001013e, 0x0001013e, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001023f, 0x0001023f, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, }, + {0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f8, }, + {0x0002010f, 0x0002010f, 0x0002010f, 0x0002010f, 0x00020120, 0x00020120, 0x00020120, 0x00020120, 0x00020127, 0x00020127, 0x00020127, 0x00020127, 0x0002013a, 0x0002013a, 0x0002013a, 0x0002013a, }, + {0x00000237, 0x00000238, 0x00000239, 0x0000023a, 0x0000023b, 0x0000023c, 0x0000023d, 0x0000023e, 0x0001000e, 0x0001000e, 0x00010026, 0x00010026, 0x0001006d, 0x0001006d, 0x0001009d, 0x0001009d, }, + {0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x00010112, 0x00010112, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010128, 0x00010128, 0x00010138, 0x00010138, 0x00010139, 0x00010139, }, + {0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, }, + {0x0000000d, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, }, + {0x0000002d, 0x0000002e, 0x0000002f, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000056, 0x00000057, 0x00000058, }, + {0x00000059, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, }, + {0x00000077, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x0000008f, 0x0000009c, 0x0000009e, 0x0000009f, }, + {0x000000a0, 0x000000a1, 0x000000a2, 0x000000a3, 0x000000a4, 0x000000a5, 0x000000a6, 0x000000a7, 0x000000b4, 0x000000b5, 0x000000b6, 0x000000b7, 0x000000b8, 0x000000b9, 0x000000ba, 0x000000bb, }, + {0x000000bc, 0x000000bd, 0x000000be, 0x000000bf, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000e3, }, + {0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f9, 0x000000fa, 0x000000fb, 0x000000fc, }, + {0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000110, 0x00000111, 0x00000113, 0x00000114, 0x00000115, }, + {0x00000116, 0x00000117, 0x00000118, 0x00000119, 0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000129, 0x0000012a, 0x0000012b, 0x0000012c, 0x0000012d, 0x0000012e, }, + {0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x0000013c, 0x0000013d, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, }, + {0x00000144, 0x00000145, 0x00000146, 0x00000147, 0x00000148, 0x00000149, 0x0000014a, 0x0000014b, 0x0000014c, 0x0000014d, 0x0000014e, 0x0000014f, 0x00000150, 0x00000151, 0x00000152, 0x00000153, }, + {0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, 0x0000015c, 0x0000015d, 0x0000015e, 0x0000015f, 0x00000160, 0x00000161, 0x00000162, 0x00000163, 0x00000164, }, + {0x00000165, 0x00000166, 0x00000167, 0x00000168, 0x00000169, 0x0000016a, 0x0000016b, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, }, + {0x00000177, 0x00000178, 0x00000179, 0x0000017a, 0x0000017b, 0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, }, + {0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x00000190, 0x00000191, 0x00000192, 0x00000193, 0x00000194, 0x00000195, 0x00000196, }, + {0x00000197, 0x00000198, 0x00000199, 0x0000019a, 0x0000019b, 0x0000019c, 0x0000019d, 0x0000019e, 0x0000019f, 0x000001a0, 0x000001a1, 0x000001a2, 0x000001a3, 0x000001a4, 0x000001a5, 0x000001a6, }, + {0x000001a7, 0x000001a8, 0x000001a9, 0x000001aa, 0x000001ab, 0x000001ac, 0x000001ad, 0x000001ae, 0x000001af, 0x000001b0, 0x000001b1, 0x000001b2, 0x000001b3, 0x000001b4, 0x000001b5, 0x000001b6, }, + {0x000001b7, 0x000001b8, 0x000001b9, 0x000001ba, 0x000001bb, 0x000001bc, 0x000001bd, 0x000001be, 0x000001bf, 0x000001c0, 0x000001c1, 0x000001c2, 0x000001c3, 0x000001c4, 0x000001c5, 0x000001c6, }, + {0x000001c7, 0x000001c8, 0x000001c9, 0x000001ca, 0x000001cb, 0x000001cc, 0x000001cd, 0x000001ce, 0x000001cf, 0x000001d0, 0x000001d1, 0x000001d2, 0x000001d3, 0x000001d4, 0x000001d5, 0x000001d6, }, + {0x000001d7, 0x000001d8, 0x000001d9, 0x000001da, 0x000001db, 0x000001dc, 0x000001dd, 0x000001de, 0x000001df, 0x000001e0, 0x000001e1, 0x000001e2, 0x000001e3, 0x000001e4, 0x000001e5, 0x000001e6, }, + {0x000001e7, 0x000001e8, 0x000001e9, 0x000001ea, 0x000001eb, 0x000001ec, 0x000001ed, 0x000001ee, 0x000001ef, 0x000001f0, 0x000001f1, 0x000001f2, 0x000001f3, 0x000001f4, 0x000001f5, 0x000001f6, }, + {0x000001f7, 0x000001f8, 0x000001f9, 0x000001fa, 0x000001fb, 0x000001fc, 0x000001fd, 0x000001fe, 0x000001ff, 0x00000200, 0x00000201, 0x00000202, 0x00000203, 0x00000204, 0x00000205, 0x00000206, }, + {0x00000207, 0x00000208, 0x00000209, 0x0000020a, 0x0000020b, 0x0000020c, 0x0000020d, 0x0000020e, 0x0000020f, 0x00000210, 0x00000211, 0x00000212, 0x00000213, 0x00000214, 0x00000215, 0x00000216, }, + {0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, 0x0000021e, 0x0000021f, 0x00000220, 0x00000221, 0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, }, + {0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, 0x0000022e, 0x0000022f, 0x00000230, 0x00000231, 0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, }, +}; + +const uint32_t c_aauiCQMFHuffEnc16[729][2] = +{ + {0x0006, 0x000d}, {0x0005, 0x0010}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x000a}, + {0x0009, 0x000b}, {0x000b, 0x000d}, {0x000c, 0x000e}, {0x000e, 0x0016}, {0x0010, 0x002d}, {0x0011, 0x0051}, {0x0012, 0x008c}, {0x0014, 0x0000}, + {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, + {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0005, 0x0011}, {0x0004, 0x000f}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, + {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0007, 0x000c}, {0x0008, 0x000b}, {0x000a, 0x000c}, {0x000b, 0x000e}, {0x000d, 0x0010}, {0x000e, 0x0017}, + {0x000f, 0x001c}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, + {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0006, 0x0013}, {0x0005, 0x0015}, + {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0006, 0x0014}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0009, 0x000c}, {0x000a, 0x000d}, + {0x000c, 0x000f}, {0x000d, 0x0011}, {0x000f, 0x001d}, {0x0011, 0x0052}, {0x0012, 0x008d}, {0x0012, 0x008e}, {0x0014, 0x0017}, {0x0014, 0x0018}, + {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, + {0x0014, 0x0021}, {0x0006, 0x0015}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0007, 0x000f}, + {0x0008, 0x000c}, {0x0009, 0x000d}, {0x000b, 0x000f}, {0x000c, 0x0010}, {0x000d, 0x0012}, {0x000f, 0x001e}, {0x0012, 0x008f}, {0x0014, 0x0022}, + {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, + {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0006, 0x0018}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0006, 0x0019}, + {0x0006, 0x001a}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000d}, {0x000a, 0x000e}, {0x000b, 0x0010}, {0x000c, 0x0011}, {0x000e, 0x0018}, + {0x0010, 0x002e}, {0x0012, 0x0090}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, + {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0007, 0x0012}, + {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0008, 0x000e}, {0x0009, 0x000e}, {0x000b, 0x0011}, + {0x000c, 0x0012}, {0x000d, 0x0013}, {0x000e, 0x0019}, {0x0010, 0x002f}, {0x0012, 0x0091}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, + {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, + {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0007, 0x0015}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0007, 0x0016}, {0x0007, 0x0017}, {0x0008, 0x000f}, + {0x0009, 0x000f}, {0x000a, 0x000f}, {0x000b, 0x0012}, {0x000d, 0x0014}, {0x000e, 0x001a}, {0x000f, 0x001f}, {0x0013, 0x010f}, {0x0011, 0x0053}, + {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, + {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, {0x0014, 0x0053}, {0x0008, 0x0010}, {0x0007, 0x0018}, {0x0007, 0x0019}, + {0x0008, 0x0011}, {0x0008, 0x0012}, {0x0009, 0x0010}, {0x000a, 0x0010}, {0x000b, 0x0013}, {0x000c, 0x0013}, {0x000e, 0x001b}, {0x000f, 0x0020}, + {0x0010, 0x0030}, {0x0012, 0x0092}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, + {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, + {0x0009, 0x0011}, {0x0008, 0x0013}, {0x0009, 0x0012}, {0x0009, 0x0013}, {0x000a, 0x0011}, {0x000a, 0x0012}, {0x000b, 0x0014}, {0x000c, 0x0014}, + {0x000d, 0x0015}, {0x000e, 0x001c}, {0x000f, 0x0021}, {0x0013, 0x0110}, {0x0012, 0x0093}, {0x0012, 0x0094}, {0x0014, 0x0062}, {0x0014, 0x0063}, + {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, + {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x000b, 0x0015}, {0x000a, 0x0013}, {0x000a, 0x0014}, {0x000a, 0x0015}, {0x000b, 0x0016}, + {0x000c, 0x0015}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000f, 0x0022}, {0x0010, 0x0031}, {0x0012, 0x0095}, {0x0012, 0x0096}, {0x0014, 0x006f}, + {0x0013, 0x0111}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, + {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x000c, 0x0016}, {0x000b, 0x0017}, + {0x000c, 0x0017}, {0x000c, 0x0018}, {0x000c, 0x0019}, {0x000d, 0x0018}, {0x000e, 0x001d}, {0x000f, 0x0023}, {0x000f, 0x0024}, {0x0011, 0x0054}, + {0x0012, 0x0097}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, + {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, + {0x0014, 0x008c}, {0x000e, 0x001e}, {0x000d, 0x0019}, {0x000d, 0x001a}, {0x000d, 0x001b}, {0x000e, 0x001f}, {0x000f, 0x0025}, {0x000f, 0x0026}, + {0x0010, 0x0032}, {0x0010, 0x0033}, {0x0012, 0x0098}, {0x0013, 0x0112}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, + {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, + {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x000f, 0x0027}, {0x000f, 0x0028}, {0x000f, 0x0029}, {0x000f, 0x002a}, + {0x0010, 0x0034}, {0x000f, 0x002b}, {0x0011, 0x0055}, {0x0012, 0x0099}, {0x0012, 0x009a}, {0x0012, 0x009b}, {0x0014, 0x009d}, {0x0013, 0x0113}, + {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, + {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0011, 0x0056}, + {0x0010, 0x0035}, {0x0010, 0x0036}, {0x0010, 0x0037}, {0x0011, 0x0057}, {0x0012, 0x009c}, {0x0012, 0x009d}, {0x0012, 0x009e}, {0x0014, 0x00ad}, + {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, + {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, + {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0012, 0x009f}, {0x0011, 0x0058}, {0x0012, 0x00a0}, {0x0014, 0x00c0}, {0x0011, 0x0059}, {0x0013, 0x0114}, + {0x0012, 0x00a1}, {0x0014, 0x00c1}, {0x0013, 0x0115}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, + {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, + {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, + {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, + {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, + {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, + {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, + {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, + {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, {0x0014, 0x0106}, + {0x0014, 0x0107}, {0x0014, 0x0108}, {0x0014, 0x0109}, {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, {0x0014, 0x010e}, + {0x0014, 0x010f}, {0x0014, 0x0110}, {0x0014, 0x0111}, {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, {0x0014, 0x0116}, + {0x0014, 0x0117}, {0x0014, 0x0118}, {0x0014, 0x0119}, {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, {0x0014, 0x011e}, + {0x0014, 0x011f}, {0x0014, 0x0120}, {0x0014, 0x0121}, {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, {0x0013, 0x0116}, + {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, {0x0014, 0x0129}, {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, + {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, {0x0014, 0x0131}, {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, + {0x0014, 0x0136}, {0x0014, 0x0137}, {0x0014, 0x0138}, {0x0014, 0x0139}, {0x0014, 0x013a}, {0x0014, 0x013b}, {0x0014, 0x013c}, {0x0014, 0x013d}, + {0x0014, 0x013e}, {0x0014, 0x013f}, {0x0014, 0x0140}, {0x0014, 0x0141}, {0x0014, 0x0142}, {0x0014, 0x0143}, {0x0014, 0x0144}, {0x0014, 0x0145}, + {0x0014, 0x0146}, {0x0014, 0x0147}, {0x0014, 0x0148}, {0x0014, 0x0149}, {0x0014, 0x014a}, {0x0014, 0x014b}, {0x0014, 0x014c}, {0x0014, 0x014d}, + {0x0014, 0x014e}, {0x0014, 0x014f}, {0x0014, 0x0150}, {0x0014, 0x0151}, {0x0014, 0x0152}, {0x0014, 0x0153}, {0x0014, 0x0154}, {0x0014, 0x0155}, + {0x0014, 0x0156}, {0x0014, 0x0157}, {0x0014, 0x0158}, {0x0014, 0x0159}, {0x0014, 0x015a}, {0x0014, 0x015b}, {0x0014, 0x015c}, {0x0014, 0x015d}, + {0x0014, 0x015e}, {0x0014, 0x015f}, {0x0014, 0x0160}, {0x0014, 0x0161}, {0x0014, 0x0162}, {0x0014, 0x0163}, {0x0014, 0x0164}, {0x0014, 0x0165}, + {0x0014, 0x0166}, {0x0014, 0x0167}, {0x0014, 0x0168}, {0x0014, 0x0169}, {0x0014, 0x016a}, {0x0014, 0x016b}, {0x0014, 0x016c}, {0x0014, 0x016d}, + {0x0014, 0x016e}, {0x0014, 0x016f}, {0x0014, 0x0170}, {0x0014, 0x0171}, {0x0014, 0x0172}, {0x0014, 0x0173}, {0x0014, 0x0174}, {0x0014, 0x0175}, + {0x0014, 0x0176}, {0x0014, 0x0177}, {0x0014, 0x0178}, {0x0014, 0x0179}, {0x0014, 0x017a}, {0x0014, 0x017b}, {0x0014, 0x017c}, {0x0014, 0x017d}, + {0x0014, 0x017e}, {0x0014, 0x017f}, {0x0014, 0x0180}, {0x0014, 0x0181}, {0x0014, 0x0182}, {0x0014, 0x0183}, {0x0014, 0x0184}, {0x0014, 0x0185}, + {0x0014, 0x0186}, {0x0014, 0x0187}, {0x0014, 0x0188}, {0x0014, 0x0189}, {0x0014, 0x018a}, {0x0014, 0x018b}, {0x0014, 0x018c}, {0x0014, 0x018d}, + {0x0014, 0x018e}, {0x0014, 0x018f}, {0x0014, 0x0190}, {0x0014, 0x0191}, {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, + {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0014, 0x0198}, {0x0014, 0x0199}, {0x0014, 0x019a}, {0x0014, 0x019b}, {0x0014, 0x019c}, {0x0014, 0x019d}, + {0x0014, 0x019e}, {0x0014, 0x019f}, {0x0014, 0x01a0}, {0x0014, 0x01a1}, {0x0014, 0x01a2}, {0x0014, 0x01a3}, {0x0014, 0x01a4}, {0x0014, 0x01a5}, + {0x0014, 0x01a6}, {0x0014, 0x01a7}, {0x0014, 0x01a8}, {0x0014, 0x01a9}, {0x0014, 0x01aa}, {0x0014, 0x01ab}, {0x0014, 0x01ac}, {0x0014, 0x01ad}, + {0x0014, 0x01ae}, {0x0014, 0x01af}, {0x0014, 0x01b0}, {0x0014, 0x01b1}, {0x0014, 0x01b2}, {0x0014, 0x01b3}, {0x0014, 0x01b4}, {0x0014, 0x01b5}, + {0x0014, 0x01b6}, {0x0014, 0x01b7}, {0x0014, 0x01b8}, {0x0014, 0x01b9}, {0x0014, 0x01ba}, {0x0014, 0x01bb}, {0x0014, 0x01bc}, {0x0014, 0x01bd}, + {0x0014, 0x01be}, {0x0014, 0x01bf}, {0x0014, 0x01c0}, {0x0014, 0x01c1}, {0x0014, 0x01c2}, {0x0014, 0x01c3}, {0x0014, 0x01c4}, {0x0014, 0x01c5}, + {0x0014, 0x01c6}, {0x0014, 0x01c7}, {0x0014, 0x01c8}, {0x0014, 0x01c9}, {0x0014, 0x01ca}, {0x0014, 0x01cb}, {0x0014, 0x01cc}, {0x0014, 0x01cd}, + {0x0014, 0x01ce}, {0x0014, 0x01cf}, {0x0014, 0x01d0}, {0x0014, 0x01d1}, {0x0014, 0x01d2}, {0x0014, 0x01d3}, {0x0014, 0x01d4}, {0x0014, 0x01d5}, + {0x0014, 0x01d6}, {0x0014, 0x01d7}, {0x0014, 0x01d8}, {0x0014, 0x01d9}, {0x0014, 0x01da}, {0x0014, 0x01db}, {0x0014, 0x01dc}, {0x0014, 0x01dd}, + {0x0014, 0x01de}, {0x0014, 0x01df}, {0x0014, 0x01e0}, {0x0014, 0x01e1}, {0x0014, 0x01e2}, {0x0014, 0x01e3}, {0x0014, 0x01e4}, {0x0014, 0x01e5}, + {0x0014, 0x01e6}, {0x0014, 0x01e7}, {0x0014, 0x01e8}, {0x0014, 0x01e9}, {0x0014, 0x01ea}, {0x0014, 0x01eb}, {0x0014, 0x01ec}, {0x0014, 0x01ed}, + {0x0014, 0x01ee}, {0x0014, 0x01ef}, {0x0014, 0x01f0}, {0x0014, 0x01f1}, {0x0014, 0x01f2}, {0x0014, 0x01f3}, {0x0014, 0x01f4}, {0x0014, 0x01f5}, + {0x0014, 0x01f6}, {0x0014, 0x01f7}, {0x0014, 0x01f8}, {0x0014, 0x01f9}, {0x0014, 0x01fa}, {0x0014, 0x01fb}, {0x0014, 0x01fc}, {0x0014, 0x01fd}, + {0x0014, 0x01fe}, {0x0014, 0x01ff}, {0x0014, 0x0200}, {0x0014, 0x0201}, {0x0014, 0x0202}, {0x0014, 0x0203}, {0x0014, 0x0204}, {0x0014, 0x0205}, + {0x0014, 0x0206}, {0x0014, 0x0207}, {0x0014, 0x0208}, {0x0014, 0x0209}, {0x0014, 0x020a}, {0x0014, 0x020b}, {0x0014, 0x020c}, {0x0014, 0x020d}, + {0x0014, 0x020e}, {0x0014, 0x020f}, {0x0014, 0x0210}, {0x0014, 0x0211}, {0x0014, 0x0212}, {0x0014, 0x0213}, {0x0014, 0x0214}, {0x0014, 0x0215}, + {0x0013, 0x0117}, + +}; + +const uint32_t c_aauiCQMFHuffDec16[85][16] = +{ + {0x000fffff, 0x000dffff, 0x000effff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0000001c, }, + {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, + {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, + {0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, }, + {0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020003, 0x00020003, 0x00020003, 0x00020003, }, + {0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020036, 0x00020036, 0x00020036, 0x00020036, }, + {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, + {0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020088, 0x00020088, 0x00020088, 0x00020088, }, + {0x00020089, 0x00020089, 0x00020089, 0x00020089, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, }, + {0x000000bd, 0x000000c0, 0x000000c1, 0x000000d9, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010022, 0x00010022, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x00010057, 0x00010057, }, + {0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010087, 0x00010087, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x000100a2, 0x000100a2, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, }, + {0x0019ffff, 0x0017ffff, 0x0018ffff, 0x0015ffff, 0x0016ffff, 0x0012ffff, 0x0010ffff, 0x0011ffff, 0x0013ffff, 0x0014ffff, 0x00000007, 0x00000023, 0x00000058, 0x00000073, 0x0000008d, 0x000000a7, }, + {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, }, + {0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, }, + {0x000200f5, 0x000200f5, 0x000200f5, 0x000200f5, 0x000200f6, 0x000200f6, 0x000200f6, 0x000200f6, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, }, + {0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, }, + {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, }, + {0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f4, }, + {0x0000005b, 0x00000076, 0x00000090, 0x000000c5, 0x000000df, 0x000000f8, 0x0000010e, 0x00000110, 0x00000111, 0x00000112, 0x00010009, 0x00010009, 0x00010025, 0x00010025, 0x0001005a, 0x0001005a, }, + {0x00010075, 0x00010075, 0x0001008f, 0x0001008f, 0x000100aa, 0x000100aa, 0x000100c4, 0x000100c4, 0x000100de, 0x000100de, 0x000100f3, 0x000100f3, 0x000100f7, 0x000100f7, 0x0001010f, 0x0001010f, }, + {0x0032ffff, 0x0043ffff, 0x0025ffff, 0x0023ffff, 0x0024ffff, 0x0021ffff, 0x0020ffff, 0x0022ffff, 0x001cffff, 0x001affff, 0x001bffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0000000a, 0x00000040, }, + {0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, }, + {0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, }, + {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, }, + {0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, }, + {0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, }, + {0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, }, + {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200c6, 0x000200c6, 0x000200c6, 0x000200c6, }, + {0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010149, 0x00010149, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, + {0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x00020114, 0x00020114, 0x00020114, 0x00020114, 0x00020129, 0x00020129, 0x00020129, 0x00020129, 0x0002012d, 0x0002012d, 0x0002012d, 0x0002012d, }, + {0x000000c8, 0x000000fc, 0x00000130, 0x00000131, 0x00000148, 0x00000160, 0x00000161, 0x00000162, 0x00010028, 0x00010028, 0x00010042, 0x00010042, 0x0001005d, 0x0001005d, 0x000100ad, 0x000100ad, }, + {0x000100c7, 0x000100c7, 0x000100e2, 0x000100e2, 0x000100fb, 0x000100fb, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010144, 0x00010144, }, + {0x0054ffff, 0x0031ffff, 0x0030ffff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0027ffff, 0x0026ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x0000000c, 0x00000078, 0x00000093, }, + {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, }, + {0x0002017c, 0x0002017c, 0x0002017c, 0x0002017c, 0x00020180, 0x00020180, 0x00020180, 0x00020180, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, }, + {0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, }, + {0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, + {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200e4, 0x000200e4, 0x000200e4, 0x000200e4, }, + {0x000200e5, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fe, 0x000200fe, 0x000200fe, 0x000200fe, 0x00020118, 0x00020118, 0x00020118, 0x00020118, }, + {0x00020132, 0x00020132, 0x00020132, 0x00020132, 0x0002014b, 0x0002014b, 0x0002014b, 0x0002014b, 0x0002014c, 0x0002014c, 0x0002014c, 0x0002014c, 0x0002014d, 0x0002014d, 0x0002014d, 0x0002014d, }, + {0x00020164, 0x00020164, 0x00020164, 0x00020164, 0x00020165, 0x00020165, 0x00020165, 0x00020165, 0x00020166, 0x00020166, 0x00020166, 0x00020166, 0x0002017a, 0x0002017a, 0x0002017a, 0x0002017a, }, + {0x000100e3, 0x000100e3, 0x00010100, 0x00010100, 0x00010133, 0x00010133, 0x0001014f, 0x0001014f, 0x0001017f, 0x0001017f, 0x00010182, 0x00010182, 0x000101e7, 0x000101e7, 0x000102d8, 0x000102d8, }, + {0x000002d2, 0x000002d3, 0x000002d4, 0x000002d5, 0x000002d6, 0x000002d7, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x000100ae, 0x000100ae, }, + {0x0034ffff, 0x0033ffff, 0x0035ffff, 0x0036ffff, 0x0039ffff, 0x0037ffff, 0x0038ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, }, + {0x0000002f, 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, }, + {0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, }, + {0x0000004f, 0x00000050, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006a, 0x0000006b, 0x0000007c, }, + {0x0000007d, 0x0000007e, 0x0000007f, 0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, }, + {0x000000b9, 0x000000ba, 0x000000bb, 0x000000bc, 0x000000ca, 0x000000cb, 0x000000cc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, }, + {0x000000d6, 0x000000d7, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000ff, }, + {0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, 0x000000a1, 0x000000b0, 0x000000b1, 0x000000b2, 0x000000b3, 0x000000b4, 0x000000b5, 0x000000b6, 0x000000b7, 0x000000b8, }, + {0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, 0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x00000119, 0x0000011a, 0x0000011b, }, + {0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000134, 0x00000135, 0x00000136, }, + {0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, 0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x0000014e, 0x00000150, 0x00000151, }, + {0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, 0x0000015c, 0x0000015d, 0x0000015e, 0x00000167, 0x00000168, 0x00000169, }, + {0x0000016a, 0x0000016b, 0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, }, + {0x0000017d, 0x00000181, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x00000190, }, + {0x00000191, 0x00000192, 0x00000193, 0x00000194, 0x00000195, 0x00000196, 0x00000197, 0x00000198, 0x00000199, 0x0000019a, 0x0000019b, 0x0000019c, 0x0000019d, 0x0000019e, 0x0000019f, 0x000001a0, }, + {0x000001a1, 0x000001a2, 0x000001a3, 0x000001a4, 0x000001a5, 0x000001a6, 0x000001a7, 0x000001a8, 0x000001a9, 0x000001aa, 0x000001ab, 0x000001ac, 0x000001ad, 0x000001ae, 0x000001af, 0x000001b0, }, + {0x000001b1, 0x000001b2, 0x000001b3, 0x000001b4, 0x000001b5, 0x000001b6, 0x000001b7, 0x000001b8, 0x000001b9, 0x000001ba, 0x000001bb, 0x000001bc, 0x000001bd, 0x000001be, 0x000001bf, 0x000001c0, }, + {0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, }, + {0x000001c1, 0x000001c2, 0x000001c3, 0x000001c4, 0x000001c5, 0x000001c6, 0x000001c7, 0x000001c8, 0x000001c9, 0x000001ca, 0x000001cb, 0x000001cc, 0x000001cd, 0x000001ce, 0x000001cf, 0x000001d0, }, + {0x000001d1, 0x000001d2, 0x000001d3, 0x000001d4, 0x000001d5, 0x000001d6, 0x000001d7, 0x000001d8, 0x000001d9, 0x000001da, 0x000001db, 0x000001dc, 0x000001dd, 0x000001de, 0x000001df, 0x000001e0, }, + {0x000001e1, 0x000001e2, 0x000001e3, 0x000001e4, 0x000001e5, 0x000001e6, 0x000001e8, 0x000001e9, 0x000001ea, 0x000001eb, 0x000001ec, 0x000001ed, 0x000001ee, 0x000001ef, 0x000001f0, 0x000001f1, }, + {0x000001f2, 0x000001f3, 0x000001f4, 0x000001f5, 0x000001f6, 0x000001f7, 0x000001f8, 0x000001f9, 0x000001fa, 0x000001fb, 0x000001fc, 0x000001fd, 0x000001fe, 0x000001ff, 0x00000200, 0x00000201, }, + {0x00000202, 0x00000203, 0x00000204, 0x00000205, 0x00000206, 0x00000207, 0x00000208, 0x00000209, 0x0000020a, 0x0000020b, 0x0000020c, 0x0000020d, 0x0000020e, 0x0000020f, 0x00000210, 0x00000211, }, + {0x00000212, 0x00000213, 0x00000214, 0x00000215, 0x00000216, 0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, 0x0000021e, 0x0000021f, 0x00000220, 0x00000221, }, + {0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, 0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, 0x0000022e, 0x0000022f, 0x00000230, 0x00000231, }, + {0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, 0x00000237, 0x00000238, 0x00000239, 0x0000023a, 0x0000023b, 0x0000023c, 0x0000023d, 0x0000023e, 0x0000023f, 0x00000240, 0x00000241, }, + {0x00000242, 0x00000243, 0x00000244, 0x00000245, 0x00000246, 0x00000247, 0x00000248, 0x00000249, 0x0000024a, 0x0000024b, 0x0000024c, 0x0000024d, 0x0000024e, 0x0000024f, 0x00000250, 0x00000251, }, + {0x00000252, 0x00000253, 0x00000254, 0x00000255, 0x00000256, 0x00000257, 0x00000258, 0x00000259, 0x0000025a, 0x0000025b, 0x0000025c, 0x0000025d, 0x0000025e, 0x0000025f, 0x00000260, 0x00000261, }, + {0x00000262, 0x00000263, 0x00000264, 0x00000265, 0x00000266, 0x00000267, 0x00000268, 0x00000269, 0x0000026a, 0x0000026b, 0x0000026c, 0x0000026d, 0x0000026e, 0x0000026f, 0x00000270, 0x00000271, }, + {0x00000272, 0x00000273, 0x00000274, 0x00000275, 0x00000276, 0x00000277, 0x00000278, 0x00000279, 0x0000027a, 0x0000027b, 0x0000027c, 0x0000027d, 0x0000027e, 0x0000027f, 0x00000280, 0x00000281, }, + {0x00000282, 0x00000283, 0x00000284, 0x00000285, 0x00000286, 0x00000287, 0x00000288, 0x00000289, 0x0000028a, 0x0000028b, 0x0000028c, 0x0000028d, 0x0000028e, 0x0000028f, 0x00000290, 0x00000291, }, + {0x00000292, 0x00000293, 0x00000294, 0x00000295, 0x00000296, 0x00000297, 0x00000298, 0x00000299, 0x0000029a, 0x0000029b, 0x0000029c, 0x0000029d, 0x0000029e, 0x0000029f, 0x000002a0, 0x000002a1, }, + {0x000002a2, 0x000002a3, 0x000002a4, 0x000002a5, 0x000002a6, 0x000002a7, 0x000002a8, 0x000002a9, 0x000002aa, 0x000002ab, 0x000002ac, 0x000002ad, 0x000002ae, 0x000002af, 0x000002b0, 0x000002b1, }, + {0x000002b2, 0x000002b3, 0x000002b4, 0x000002b5, 0x000002b6, 0x000002b7, 0x000002b8, 0x000002b9, 0x000002ba, 0x000002bb, 0x000002bc, 0x000002bd, 0x000002be, 0x000002bf, 0x000002c0, 0x000002c1, }, + {0x000002c2, 0x000002c3, 0x000002c4, 0x000002c5, 0x000002c6, 0x000002c7, 0x000002c8, 0x000002c9, 0x000002ca, 0x000002cb, 0x000002cc, 0x000002cd, 0x000002ce, 0x000002cf, 0x000002d0, 0x000002d1, }, +}; + +const uint32_t c_aauiCQMFHuffEnc17[729][2] = +{ + {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000e}, + {0x0008, 0x000f}, {0x0009, 0x000f}, {0x000a, 0x000f}, {0x000c, 0x0011}, {0x000d, 0x0014}, {0x000e, 0x0017}, {0x0010, 0x002d}, {0x0011, 0x004c}, + {0x0012, 0x008a}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, + {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0006, 0x0016}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0006, 0x0017}, + {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0008, 0x0010}, {0x000a, 0x0010}, {0x000b, 0x0011}, {0x000c, 0x0012}, + {0x000e, 0x0018}, {0x000f, 0x0020}, {0x0011, 0x004d}, {0x0013, 0x00e4}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, + {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0006, 0x001a}, {0x0005, 0x001b}, + {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0007, 0x0014}, {0x0008, 0x0011}, {0x0009, 0x0010}, + {0x000a, 0x0011}, {0x000b, 0x0012}, {0x000c, 0x0013}, {0x000e, 0x0019}, {0x000f, 0x0021}, {0x0010, 0x002e}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, + {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, + {0x0014, 0x001c}, {0x0006, 0x001e}, {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, + {0x0007, 0x0015}, {0x0008, 0x0012}, {0x0009, 0x0011}, {0x000a, 0x0012}, {0x000b, 0x0013}, {0x000c, 0x0014}, {0x000e, 0x001a}, {0x000f, 0x0022}, + {0x0010, 0x002f}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, + {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0006, 0x0023}, {0x0006, 0x0024}, {0x0006, 0x0025}, {0x0006, 0x0026}, + {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0007, 0x0016}, {0x0007, 0x0017}, {0x0008, 0x0013}, {0x0009, 0x0012}, {0x000a, 0x0013}, {0x000c, 0x0015}, + {0x000d, 0x0015}, {0x000f, 0x0023}, {0x0010, 0x0030}, {0x0011, 0x004e}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, + {0x0014, 0x002a}, {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0007, 0x0018}, + {0x0006, 0x0029}, {0x0006, 0x002a}, {0x0006, 0x002b}, {0x0006, 0x002c}, {0x0007, 0x0019}, {0x0007, 0x001a}, {0x0008, 0x0014}, {0x0009, 0x0013}, + {0x000a, 0x0014}, {0x000b, 0x0014}, {0x000c, 0x0016}, {0x000d, 0x0016}, {0x000f, 0x0024}, {0x0010, 0x0031}, {0x0011, 0x004f}, {0x0014, 0x0031}, + {0x0014, 0x0032}, {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, + {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0007, 0x001b}, {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0007, 0x001c}, {0x0007, 0x001d}, + {0x0008, 0x0015}, {0x0009, 0x0014}, {0x000a, 0x0015}, {0x000a, 0x0016}, {0x000c, 0x0017}, {0x000d, 0x0017}, {0x000e, 0x001b}, {0x000f, 0x0025}, + {0x0011, 0x0050}, {0x0011, 0x0051}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, + {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0008, 0x0016}, {0x0007, 0x001e}, {0x0007, 0x001f}, + {0x0007, 0x0020}, {0x0007, 0x0021}, {0x0008, 0x0017}, {0x0008, 0x0018}, {0x0009, 0x0015}, {0x000a, 0x0017}, {0x000b, 0x0015}, {0x000c, 0x0018}, + {0x000e, 0x001c}, {0x000e, 0x001d}, {0x0010, 0x0032}, {0x0012, 0x008b}, {0x0012, 0x008c}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, + {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, + {0x0008, 0x0019}, {0x0007, 0x0022}, {0x0007, 0x0023}, {0x0008, 0x001a}, {0x0008, 0x001b}, {0x0009, 0x0016}, {0x0009, 0x0017}, {0x000a, 0x0018}, + {0x000b, 0x0016}, {0x000c, 0x0019}, {0x000d, 0x0018}, {0x000e, 0x001e}, {0x0010, 0x0033}, {0x0011, 0x0052}, {0x0014, 0x0052}, {0x0013, 0x00e9}, + {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, + {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0009, 0x0018}, {0x0008, 0x001c}, {0x0008, 0x001d}, {0x0009, 0x0019}, {0x0009, 0x001a}, + {0x000a, 0x0019}, {0x000a, 0x001a}, {0x000b, 0x0017}, {0x000c, 0x001a}, {0x000d, 0x0019}, {0x000e, 0x001f}, {0x000f, 0x0026}, {0x0010, 0x0034}, + {0x0012, 0x008d}, {0x0013, 0x00ea}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, {0x0014, 0x0063}, + {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x000b, 0x0018}, {0x0009, 0x001b}, + {0x000a, 0x001b}, {0x000a, 0x001c}, {0x000a, 0x001d}, {0x000b, 0x0019}, {0x000b, 0x001a}, {0x000c, 0x001b}, {0x000d, 0x001a}, {0x000e, 0x0020}, + {0x000f, 0x0027}, {0x0012, 0x008e}, {0x0011, 0x0053}, {0x0013, 0x00eb}, {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, + {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, + {0x0014, 0x0076}, {0x000c, 0x001c}, {0x000b, 0x001b}, {0x000b, 0x001c}, {0x000b, 0x001d}, {0x000c, 0x001d}, {0x000c, 0x001e}, {0x000d, 0x001b}, + {0x000d, 0x001c}, {0x000e, 0x0021}, {0x0010, 0x0035}, {0x0010, 0x0036}, {0x0011, 0x0054}, {0x0013, 0x00ec}, {0x0014, 0x0077}, {0x0014, 0x0078}, + {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, + {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x000d, 0x001d}, {0x000c, 0x001f}, {0x000c, 0x0020}, {0x000c, 0x0021}, + {0x000d, 0x001e}, {0x000d, 0x001f}, {0x000e, 0x0022}, {0x000f, 0x0028}, {0x0010, 0x0037}, {0x0010, 0x0038}, {0x0010, 0x0039}, {0x0012, 0x008f}, + {0x0013, 0x00ed}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, + {0x0014, 0x008c}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x000e, 0x0023}, + {0x000d, 0x0020}, {0x000d, 0x0021}, {0x000e, 0x0024}, {0x000e, 0x0025}, {0x000e, 0x0026}, {0x000f, 0x0029}, {0x0010, 0x003a}, {0x0010, 0x003b}, + {0x0012, 0x0090}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, + {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, + {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x000f, 0x002a}, {0x000e, 0x0027}, {0x000f, 0x002b}, {0x000f, 0x002c}, {0x000f, 0x002d}, {0x0010, 0x003c}, + {0x0010, 0x003d}, {0x0011, 0x0055}, {0x0011, 0x0056}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, + {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0014, 0x00ad}, {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, + {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, {0x0012, 0x0091}, {0x0010, 0x003e}, {0x0010, 0x003f}, + {0x0011, 0x0057}, {0x0011, 0x0058}, {0x0011, 0x0059}, {0x0012, 0x0092}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0012, 0x0093}, {0x0014, 0x00b6}, + {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, {0x0014, 0x00be}, + {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, + {0x0013, 0x00f0}, {0x0012, 0x0094}, {0x0012, 0x0095}, {0x0012, 0x0096}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, + {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, + {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, + {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, {0x0012, 0x0097}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, + {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, + {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, + {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, + {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, + {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, {0x0014, 0x0106}, {0x0014, 0x0107}, {0x0014, 0x0108}, {0x0014, 0x0109}, + {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, {0x0014, 0x010e}, {0x0014, 0x010f}, {0x0014, 0x0110}, {0x0014, 0x0111}, + {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, {0x0014, 0x0116}, {0x0014, 0x0117}, {0x0014, 0x0118}, {0x0014, 0x0119}, + {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, {0x0014, 0x011e}, {0x0014, 0x011f}, {0x0014, 0x0120}, {0x0014, 0x0121}, + {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, {0x0014, 0x0129}, + {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, {0x0014, 0x0131}, + {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, {0x0014, 0x0136}, {0x0014, 0x0137}, {0x0014, 0x0138}, {0x0014, 0x0139}, + {0x0014, 0x013a}, {0x0014, 0x013b}, {0x0014, 0x013c}, {0x0014, 0x013d}, {0x0014, 0x013e}, {0x0014, 0x013f}, {0x0014, 0x0140}, {0x0014, 0x0141}, + {0x0014, 0x0142}, {0x0014, 0x0143}, {0x0014, 0x0144}, {0x0014, 0x0145}, {0x0014, 0x0146}, {0x0014, 0x0147}, {0x0014, 0x0148}, {0x0014, 0x0149}, + {0x0014, 0x014a}, {0x0014, 0x014b}, {0x0014, 0x014c}, {0x0014, 0x014d}, {0x0014, 0x014e}, {0x0014, 0x014f}, {0x0014, 0x0150}, {0x0014, 0x0151}, + {0x0014, 0x0152}, {0x0014, 0x0153}, {0x0014, 0x0154}, {0x0014, 0x0155}, {0x0014, 0x0156}, {0x0014, 0x0157}, {0x0014, 0x0158}, {0x0014, 0x0159}, + {0x0014, 0x015a}, {0x0014, 0x015b}, {0x0014, 0x015c}, {0x0014, 0x015d}, {0x0014, 0x015e}, {0x0014, 0x015f}, {0x0014, 0x0160}, {0x0014, 0x0161}, + {0x0014, 0x0162}, {0x0014, 0x0163}, {0x0014, 0x0164}, {0x0014, 0x0165}, {0x0014, 0x0166}, {0x0014, 0x0167}, {0x0014, 0x0168}, {0x0014, 0x0169}, + {0x0014, 0x016a}, {0x0014, 0x016b}, {0x0014, 0x016c}, {0x0014, 0x016d}, {0x0014, 0x016e}, {0x0014, 0x016f}, {0x0014, 0x0170}, {0x0014, 0x0171}, + {0x0014, 0x0172}, {0x0014, 0x0173}, {0x0014, 0x0174}, {0x0014, 0x0175}, {0x0014, 0x0176}, {0x0014, 0x0177}, {0x0014, 0x0178}, {0x0014, 0x0179}, + {0x0014, 0x017a}, {0x0014, 0x017b}, {0x0014, 0x017c}, {0x0014, 0x017d}, {0x0014, 0x017e}, {0x0014, 0x017f}, {0x0014, 0x0180}, {0x0014, 0x0181}, + {0x0014, 0x0182}, {0x0014, 0x0183}, {0x0014, 0x0184}, {0x0014, 0x0185}, {0x0014, 0x0186}, {0x0014, 0x0187}, {0x0014, 0x0188}, {0x0014, 0x0189}, + {0x0014, 0x018a}, {0x0014, 0x018b}, {0x0014, 0x018c}, {0x0014, 0x018d}, {0x0014, 0x018e}, {0x0014, 0x018f}, {0x0014, 0x0190}, {0x0014, 0x0191}, + {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0014, 0x0198}, {0x0014, 0x0199}, + {0x0014, 0x019a}, {0x0014, 0x019b}, {0x0014, 0x019c}, {0x0014, 0x019d}, {0x0014, 0x019e}, {0x0014, 0x019f}, {0x0014, 0x01a0}, {0x0014, 0x01a1}, + {0x0014, 0x01a2}, {0x0014, 0x01a3}, {0x0014, 0x01a4}, {0x0014, 0x01a5}, {0x0014, 0x01a6}, {0x0014, 0x01a7}, {0x0014, 0x01a8}, {0x0014, 0x01a9}, + {0x0014, 0x01aa}, {0x0014, 0x01ab}, {0x0014, 0x01ac}, {0x0014, 0x01ad}, {0x0014, 0x01ae}, {0x0014, 0x01af}, {0x0014, 0x01b0}, {0x0014, 0x01b1}, + {0x0014, 0x01b2}, {0x0014, 0x01b3}, {0x0014, 0x01b4}, {0x0014, 0x01b5}, {0x0014, 0x01b6}, {0x0014, 0x01b7}, {0x0014, 0x01b8}, {0x0014, 0x01b9}, + {0x0014, 0x01ba}, {0x0014, 0x01bb}, {0x0014, 0x01bc}, {0x0014, 0x01bd}, {0x0014, 0x01be}, {0x0014, 0x01bf}, {0x0014, 0x01c0}, {0x0014, 0x01c1}, + {0x0014, 0x01c2}, {0x0014, 0x01c3}, {0x0014, 0x01c4}, {0x0014, 0x01c5}, {0x0014, 0x01c6}, {0x0014, 0x01c7}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, + {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, + {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, + {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, + {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, + {0x0013, 0x0113}, + +}; + +const uint32_t c_aauiCQMFHuffDec17[93][16] = +{ + {0x0010ffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0006ffff, 0x0005ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, }, + {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, + {0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, }, + {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020054, 0x00020054, 0x00020054, 0x00020054, }, + {0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, + {0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, }, + {0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, }, + {0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, + {0x00000024, 0x0000003e, 0x00000059, 0x00000074, 0x0000008e, 0x000000a8, 0x000000bd, 0x000000c2, 0x000000c3, 0x000000d8, 0x000000db, 0x000000dc, 0x000000f4, 0x000000f5, 0x00010004, 0x00010004, }, + {0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0001003d, 0x0001003d, 0x00010058, 0x00010058, 0x00010072, 0x00010072, 0x00010073, 0x00010073, }, + {0x00010087, 0x00010087, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x000100a2, 0x000100a2, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, }, + {0x001effff, 0x001dffff, 0x001cffff, 0x0019ffff, 0x0018ffff, 0x001affff, 0x001bffff, 0x0012ffff, 0x0011ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x00000007, 0x00000008, }, + {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, + {0x00020111, 0x00020111, 0x00020111, 0x00020111, 0x00020112, 0x00020112, 0x00020112, 0x00020112, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, }, + {0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, }, + {0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, }, + {0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, }, + {0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, }, + {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x00020076, 0x00020076, 0x00020076, 0x00020076, }, + {0x0001010e, 0x0001010e, 0x00010113, 0x00010113, 0x00010114, 0x00010114, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, + {0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200c5, 0x000200c5, 0x000200c5, 0x000200c5, }, + {0x000200df, 0x000200df, 0x000200df, 0x000200df, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f9, 0x000200f9, 0x000200f9, 0x000200f9, 0x00020110, 0x00020110, 0x00020110, 0x00020110, }, + {0x00000146, 0x00000147, 0x00010026, 0x00010026, 0x00010041, 0x00010041, 0x0001005c, 0x0001005c, 0x00010091, 0x00010091, 0x000100c6, 0x000100c6, 0x000100e0, 0x000100e0, 0x000100fa, 0x000100fa, }, + {0x0025ffff, 0x0000000b, 0x00000027, 0x00000042, 0x0000005d, 0x00000077, 0x00000092, 0x000000ac, 0x000000c7, 0x000000e1, 0x000000fb, 0x00000115, 0x00000129, 0x0000012d, 0x0000012e, 0x00000145, }, + {0x0040ffff, 0x0039ffff, 0x002dffff, 0x002cffff, 0x002bffff, 0x0028ffff, 0x0026ffff, 0x0027ffff, 0x0029ffff, 0x002affff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, + {0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, }, + {0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, }, + {0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, }, + {0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, }, + {0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, }, + {0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, }, + {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, }, + {0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200e3, 0x000200e3, 0x000200e3, 0x000200e3, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, }, + {0x0001014b, 0x0001014b, 0x00010165, 0x00010165, 0x0001017a, 0x0001017a, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020131, 0x00020131, 0x00020131, 0x00020131, 0x0002014a, 0x0002014a, 0x0002014a, 0x0002014a, 0x0002015f, 0x0002015f, 0x0002015f, 0x0002015f, }, + {0x00020162, 0x00020162, 0x00020162, 0x00020162, 0x00020163, 0x00020163, 0x00020163, 0x00020163, 0x00020164, 0x00020164, 0x00020164, 0x00020164, 0x0002017b, 0x0002017b, 0x0002017b, 0x0002017b, }, + {0x00010029, 0x00010029, 0x00010044, 0x00010044, 0x0001005f, 0x0001005f, 0x00010079, 0x00010079, 0x00010094, 0x00010094, 0x000100af, 0x000100af, 0x000100fe, 0x000100fe, 0x00010118, 0x00010118, }, + {0x0000007a, 0x00000095, 0x000000ca, 0x000000e4, 0x000000ff, 0x00000132, 0x00000133, 0x0000014c, 0x0000014d, 0x0000014e, 0x00000166, 0x00000167, 0x0000017f, 0x00000180, 0x00000196, 0x00000197, }, + {0x003effff, 0x003fffff, 0x0036ffff, 0x0035ffff, 0x0037ffff, 0x0038ffff, 0x0031ffff, 0x002effff, 0x0032ffff, 0x002fffff, 0x0030ffff, 0x0033ffff, 0x0034ffff, 0x0000000e, 0x00000045, 0x00000060, }, + {0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, }, + {0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, }, + {0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, + {0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, }, + {0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, }, + {0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, }, + {0x000200cc, 0x000200cc, 0x000200cc, 0x000200cc, 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x0002014f, 0x0002014f, 0x0002014f, 0x0002014f, }, + {0x000102d5, 0x000102d5, 0x000102d6, 0x000102d6, 0x000102d7, 0x000102d7, 0x000102d8, 0x000102d8, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x000200cb, 0x000200cb, 0x000200cb, 0x000200cb, }, + {0x00020168, 0x00020168, 0x00020168, 0x00020168, 0x00020195, 0x00020195, 0x00020195, 0x00020195, 0x0002019b, 0x0002019b, 0x0002019b, 0x0002019b, 0x0002019e, 0x0002019e, 0x0002019e, 0x0002019e, }, + {0x000201b1, 0x000201b1, 0x000201b1, 0x000201b1, 0x000201b2, 0x000201b2, 0x000201b2, 0x000201b2, 0x000201b3, 0x000201b3, 0x000201b3, 0x000201b3, 0x000201cc, 0x000201cc, 0x000201cc, 0x000201cc, }, + {0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x003bffff, 0x003affff, 0x003cffff, 0x003dffff, }, + {0x00010062, 0x00010062, 0x000100e7, 0x000100e7, 0x00010101, 0x00010101, 0x0001011b, 0x0001011b, 0x00010135, 0x00010135, 0x00010150, 0x00010150, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, }, + {0x000002ae, 0x000002af, 0x000002b0, 0x000002b1, 0x000002b2, 0x000002b3, 0x000002b4, 0x000002b5, 0x0001002b, 0x0001002b, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010061, 0x00010061, }, + {0x000101b0, 0x000101b0, 0x000102b6, 0x000102b6, 0x000102b7, 0x000102b7, 0x000102b8, 0x000102b8, 0x000102b9, 0x000102b9, 0x000102ba, 0x000102ba, 0x000102bb, 0x000102bb, 0x000102bc, 0x000102bc, }, + {0x000102bd, 0x000102bd, 0x000102be, 0x000102be, 0x000102bf, 0x000102bf, 0x000102c0, 0x000102c0, 0x000102c1, 0x000102c1, 0x000102c2, 0x000102c2, 0x000102c3, 0x000102c3, 0x000102c4, 0x000102c4, }, + {0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, 0x000102cc, 0x000102cc, }, + {0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, 0x000102d4, 0x000102d4, }, + {0x0044ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0045ffff, 0x0048ffff, 0x0046ffff, 0x0047ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, }, + {0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x00000063, 0x00000064, 0x00000065, }, + {0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006a, 0x0000006b, 0x0000007c, 0x0000007d, 0x0000007e, 0x0000007f, 0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, }, + {0x00000086, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, 0x000000a1, 0x000000b2, 0x000000b3, 0x000000b4, 0x000000b5, }, + {0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, }, + {0x000000b6, 0x000000b7, 0x000000b8, 0x000000b9, 0x000000ba, 0x000000bb, 0x000000bc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, }, + {0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, 0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, }, + {0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000136, 0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, 0x0000013e, }, + {0x000000d6, 0x000000d7, 0x000000e6, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x00000102, 0x00000103, }, + {0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00000151, 0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, }, + {0x0000015c, 0x0000015d, 0x0000015e, 0x00000169, 0x0000016a, 0x0000016b, 0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, }, + {0x00000176, 0x00000177, 0x00000178, 0x00000179, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, }, + {0x0000018f, 0x00000190, 0x00000191, 0x00000192, 0x00000193, 0x00000194, 0x0000019f, 0x000001a0, 0x000001a1, 0x000001a2, 0x000001a3, 0x000001a4, 0x000001a5, 0x000001a6, 0x000001a7, 0x000001a8, }, + {0x000001a9, 0x000001aa, 0x000001ab, 0x000001ac, 0x000001ad, 0x000001ae, 0x000001af, 0x000001b4, 0x000001b5, 0x000001b6, 0x000001b7, 0x000001b8, 0x000001b9, 0x000001ba, 0x000001bb, 0x000001bc, }, + {0x000001bd, 0x000001be, 0x000001bf, 0x000001c0, 0x000001c1, 0x000001c2, 0x000001c3, 0x000001c4, 0x000001c5, 0x000001c6, 0x000001c7, 0x000001c8, 0x000001c9, 0x000001ca, 0x000001cb, 0x000001cd, }, + {0x000001ce, 0x000001cf, 0x000001d0, 0x000001d1, 0x000001d2, 0x000001d3, 0x000001d4, 0x000001d5, 0x000001d6, 0x000001d7, 0x000001d8, 0x000001d9, 0x000001da, 0x000001db, 0x000001dc, 0x000001dd, }, + {0x000001de, 0x000001df, 0x000001e0, 0x000001e1, 0x000001e2, 0x000001e3, 0x000001e4, 0x000001e5, 0x000001e6, 0x000001e7, 0x000001e8, 0x000001e9, 0x000001ea, 0x000001eb, 0x000001ec, 0x000001ed, }, + {0x000001ee, 0x000001ef, 0x000001f0, 0x000001f1, 0x000001f2, 0x000001f3, 0x000001f4, 0x000001f5, 0x000001f6, 0x000001f7, 0x000001f8, 0x000001f9, 0x000001fa, 0x000001fb, 0x000001fc, 0x000001fd, }, + {0x000001fe, 0x000001ff, 0x00000200, 0x00000201, 0x00000202, 0x00000203, 0x00000204, 0x00000205, 0x00000206, 0x00000207, 0x00000208, 0x00000209, 0x0000020a, 0x0000020b, 0x0000020c, 0x0000020d, }, + {0x0000020e, 0x0000020f, 0x00000210, 0x00000211, 0x00000212, 0x00000213, 0x00000214, 0x00000215, 0x00000216, 0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, }, + {0x0000021e, 0x0000021f, 0x00000220, 0x00000221, 0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, 0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, }, + {0x0000022e, 0x0000022f, 0x00000230, 0x00000231, 0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, 0x00000237, 0x00000238, 0x00000239, 0x0000023a, 0x0000023b, 0x0000023c, 0x0000023d, }, + {0x0000023e, 0x0000023f, 0x00000240, 0x00000241, 0x00000242, 0x00000243, 0x00000244, 0x00000245, 0x00000246, 0x00000247, 0x00000248, 0x00000249, 0x0000024a, 0x0000024b, 0x0000024c, 0x0000024d, }, + {0x0000024e, 0x0000024f, 0x00000250, 0x00000251, 0x00000252, 0x00000253, 0x00000254, 0x00000255, 0x00000256, 0x00000257, 0x00000258, 0x00000259, 0x0000025a, 0x0000025b, 0x0000025c, 0x0000025d, }, + {0x0000025e, 0x0000025f, 0x00000260, 0x00000261, 0x00000262, 0x00000263, 0x00000264, 0x00000265, 0x00000266, 0x00000267, 0x00000268, 0x00000269, 0x0000026a, 0x0000026b, 0x0000026c, 0x0000026d, }, + {0x0000026e, 0x0000026f, 0x00000270, 0x00000271, 0x00000272, 0x00000273, 0x00000274, 0x00000275, 0x00000276, 0x00000277, 0x00000278, 0x00000279, 0x0000027a, 0x0000027b, 0x0000027c, 0x0000027d, }, + {0x0000027e, 0x0000027f, 0x00000280, 0x00000281, 0x00000282, 0x00000283, 0x00000284, 0x00000285, 0x00000286, 0x00000287, 0x00000288, 0x00000289, 0x0000028a, 0x0000028b, 0x0000028c, 0x0000028d, }, + {0x0000028e, 0x0000028f, 0x00000290, 0x00000291, 0x00000292, 0x00000293, 0x00000294, 0x00000295, 0x00000296, 0x00000297, 0x00000298, 0x00000299, 0x0000029a, 0x0000029b, 0x0000029c, 0x0000029d, }, + {0x0000029e, 0x0000029f, 0x000002a0, 0x000002a1, 0x000002a2, 0x000002a3, 0x000002a4, 0x000002a5, 0x000002a6, 0x000002a7, 0x000002a8, 0x000002a9, 0x000002aa, 0x000002ab, 0x000002ac, 0x000002ad, }, +}; + +const uint32_t c_aauiCQMFHuffEnc18[28][2] = +{ + {0x0004, 0x0001}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0002}, + {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, + {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0011, 0x0003}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, + {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0004}, {0x0012, 0x0005}, + +}; + +const uint32_t c_aauiCQMFHuffDec18[6][16] = +{ + {0x0001ffff, 0x00000000, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, }, + {0x0002ffff, 0x0000000c, 0x0001000b, 0x0001000b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003ffff, 0x00000010, 0x0001000f, 0x0001000f, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0005ffff, 0x0004ffff, 0x00010013, 0x00010013, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, +}; + +const uint32_t c_aauiCQMFHuffEnc19[29][2] = +{ + {0x0004, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, + {0x0004, 0x0005}, {0x0005, 0x0001}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, + {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0012, 0x0002}, + {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0012, 0x0003}, + +}; + +const uint32_t c_aauiCQMFHuffDec19[6][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, }, + {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0004ffff, 0x00000012, 0x00010011, 0x00010011, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x0005ffff, 0x00000016, 0x00010015, 0x00010015, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, +}; + +const uint32_t c_aauiCQMFHuffEnc20[32][2] = +{ + {0x0004, 0x0002}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, + {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0006, 0x0002}, {0x0006, 0x0003}, + {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, + {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0011, 0x0001}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, +}; + +const uint32_t c_aauiCQMFHuffDec20[6][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003ffff, 0x00000011, 0x00010010, 0x00010010, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x0004ffff, 0x00000015, 0x00010014, 0x00010014, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x0005ffff, 0x00000019, 0x00010018, 0x00010018, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x0000001b, 0x0000001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, +}; + +const uint32_t c_aauiCQMFHuffEnc21[37][2] = +{ + {0x0005, 0x0002}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, + {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0002}, + {0x0006, 0x0003}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0001}, {0x000b, 0x0001}, + {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0011, 0x0001}, + {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, + +}; + +const uint32_t c_aauiCQMFHuffDec21[7][16] = +{ + {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, + {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0004ffff, 0x00000013, 0x00000014, 0x00000015, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, + {0x0005ffff, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x0006ffff, 0x0000001e, 0x0001001d, 0x0001001d, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x00000020, 0x00000021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, +}; + +const uint32_t c_aauiCQMFHuffEnc22[39][2] = +{ + {0x0005, 0x0002}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, + {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, + {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0002}, {0x0008, 0x0003}, + {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0001}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000c, 0x0001}, {0x000c, 0x0002}, {0x000c, 0x0003}, + {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000f, 0x0001}, {0x000e, 0x0003}, {0x0011, 0x0000}, {0x0010, 0x0001}, {0x0011, 0x0001}, + +}; + +const uint32_t c_aauiCQMFHuffDec22[9][16] = +{ + {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, }, + {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x0006ffff, 0x0005ffff, 0x00000016, 0x00000017, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x0007ffff, 0x0000001d, 0x0000001e, 0x0000001f, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, + {0x0008ffff, 0x00000025, 0x00010022, 0x00010022, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, +}; + +const uint32_t c_aauiCQMFHuffEnc23[46][2] = +{ + {0x0005, 0x0003}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, + {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, + {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, + {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, + {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0001}, {0x000e, 0x0002}, + {0x000e, 0x0003}, {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0011, 0x0001}, + +}; + +const uint32_t c_aauiCQMFHuffDec23[12][16] = +{ + {0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, }, + {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x0008ffff, 0x0007ffff, 0x0000001a, 0x0000001b, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x000affff, 0x0009ffff, 0x00000022, 0x00000023, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, + {0x000bffff, 0x0000002a, 0x00010029, 0x00010029, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, + {0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, +}; + +const uint32_t c_aauiCQMFHuffEnc24[55][2] = +{ + {0x0005, 0x0004}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, + {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, + {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, + {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, + {0x0009, 0x0002}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, {0x000b, 0x0003}, + {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0001}, + {0x000f, 0x0002}, {0x000f, 0x0003}, {0x0010, 0x0001}, {0x0011, 0x0001}, {0x0013, 0x0000}, {0x0012, 0x0001}, {0x0013, 0x0001}, + +}; + +const uint32_t c_aauiCQMFHuffDec24[17][16] = +{ + {0x0008ffff, 0x0009ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, }, + {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x000cffff, 0x000affff, 0x000bffff, 0x0000001d, 0x0000001e, 0x0000001f, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, + {0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, + {0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, + {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, + {0x000fffff, 0x000dffff, 0x000effff, 0x00000028, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, + {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, + {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, + {0x0010ffff, 0x00000032, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, + {0x00010034, 0x00010034, 0x00010036, 0x00010036, 0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, +}; + +const uint32_t c_aauiCQMFHuffEnc25[65][2] = +{ + {0x0005, 0x0005}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x0006}, {0x0004, 0x000f}, {0x0005, 0x0007}, {0x0005, 0x0008}, + {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, + {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0006, 0x0004}, + {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, + {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, + {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0002}, {0x000c, 0x0003}, + {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000d, 0x0003}, {0x000e, 0x0003}, {0x000e, 0x0004}, {0x000f, 0x0003}, {0x000e, 0x0005}, {0x000f, 0x0004}, + {0x0010, 0x0001}, {0x000f, 0x0005}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0011, 0x0001}, {0x0012, 0x0000}, + {0x0012, 0x0001}, + +}; + +const uint32_t c_aauiCQMFHuffDec25[19][16] = +{ + {0x000cffff, 0x000bffff, 0x0002ffff, 0x0001ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000001, 0x00000002, 0x00000003, 0x00000005, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x000fffff, 0x000dffff, 0x000effff, 0x00000022, 0x00000023, 0x00000024, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, + {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, + {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, + {0x0011ffff, 0x0010ffff, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, + {0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, + {0x0012ffff, 0x00000038, 0x0000003a, 0x0000003b, 0x0000003c, 0x0000003d, 0x00010035, 0x00010035, 0x00010037, 0x00010037, 0x00010039, 0x00010039, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, + {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, +}; + +const uint32_t c_aauiCQMFHuffEnc26[77][2] = +{ + {0x0006, 0x0004}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, + {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, + {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, + {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, + {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0004}, + {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, + {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, + {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000e, 0x0002}, {0x000d, 0x0005}, {0x000e, 0x0003}, {0x000e, 0x0004}, + {0x000f, 0x0003}, {0x000e, 0x0005}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, {0x0011, 0x0002}, {0x0012, 0x0001}, {0x0010, 0x0005}, + {0x0012, 0x0002}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, + +}; + +const uint32_t c_aauiCQMFHuffDec26[26][16] = +{ + {0x0010ffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, }, + {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, + {0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, }, + {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x0017ffff, 0x0015ffff, 0x0016ffff, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, + {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, + {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, + {0x0019ffff, 0x0018ffff, 0x00000042, 0x00000043, 0x00000044, 0x00000047, 0x00010040, 0x00010040, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, }, + {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, + {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, +}; + +const uint32_t c_aauiCQMFHuffEnc27[91][2] = +{ + {0x0006, 0x0006}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, + {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, + {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x0007}, {0x0006, 0x0008}, + {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, + {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, + {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, + {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0004}, {0x000a, 0x0005}, + {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, + {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0003}, {0x000e, 0x0004}, + {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000f, 0x0003}, {0x000f, 0x0004}, {0x0010, 0x0003}, {0x000f, 0x0005}, {0x0012, 0x0000}, + {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0012, 0x0003}, {0x0012, 0x0004}, + {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, + +}; + +const uint32_t c_aauiCQMFHuffDec27[28][16] = +{ + {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, + {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, + {0x0014ffff, 0x0013ffff, 0x0011ffff, 0x0012ffff, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x0017ffff, 0x0018ffff, 0x0015ffff, 0x0016ffff, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, + {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, + {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x001affff, 0x001bffff, 0x0019ffff, 0x0000004d, 0x00000050, 0x00000051, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004e, 0x0001004e, 0x00020046, 0x00020046, 0x00020046, 0x00020046, }, + {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, + {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, + {0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, + {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, +}; + +const uint32_t c_aauiCQMFHuffEnc28[109][2] = +{ + {0x0006, 0x0008}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, + {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, + {0x0006, 0x0009}, {0x0005, 0x001f}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, + {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, + {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, + {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, + {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x000a, 0x0005}, + {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000c, 0x0004}, + {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, + {0x000d, 0x0007}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x0010, 0x0004}, {0x000f, 0x0005}, {0x0010, 0x0005}, + {0x000f, 0x0006}, {0x000f, 0x0007}, {0x0010, 0x0006}, {0x0011, 0x0006}, {0x0010, 0x0007}, {0x0013, 0x0000}, {0x0010, 0x0008}, {0x0010, 0x0009}, + {0x0013, 0x0001}, {0x0011, 0x0007}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, + {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, + +}; + +const uint32_t c_aauiCQMFHuffDec28[30][16] = +{ + {0x000fffff, 0x0010ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, }, + {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, + {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, + {0x0015ffff, 0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, + {0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, + {0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, + {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, }, + {0x0019ffff, 0x0018ffff, 0x0016ffff, 0x0017ffff, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, }, + {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, + {0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, + {0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020054, 0x00020054, 0x00020054, 0x00020054, }, + {0x001bffff, 0x001cffff, 0x001dffff, 0x001affff, 0x00000055, 0x00000057, 0x0000005a, 0x0000005c, 0x0000005e, 0x0000005f, 0x00010056, 0x00010056, 0x00010058, 0x00010058, 0x00010059, 0x00010059, }, + {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, }, + {0x0001005d, 0x0001005d, 0x00010060, 0x00010060, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, }, + {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, + {0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, +}; + +const uint32_t c_aauiCQMFHuffEnc29[129][2] = +{ + {0x0006, 0x0009}, {0x0005, 0x0019}, {0x0006, 0x000a}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0006, 0x000b}, {0x0005, 0x001d}, + {0x0005, 0x001e}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0005, 0x001f}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, + {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, + {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, + {0x0006, 0x0022}, {0x0006, 0x0023}, {0x0006, 0x0024}, {0x0006, 0x0025}, {0x0006, 0x0026}, {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0006, 0x0029}, + {0x0006, 0x002a}, {0x0006, 0x002b}, {0x0006, 0x002c}, {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0006, 0x0030}, {0x0006, 0x0031}, + {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, + {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, + {0x0009, 0x000b}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, + {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, + {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, + {0x000d, 0x000b}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, + {0x000f, 0x0007}, {0x0011, 0x0007}, {0x000f, 0x0008}, {0x0012, 0x0000}, {0x000f, 0x0009}, {0x0010, 0x0005}, {0x000f, 0x000a}, {0x000f, 0x000b}, + {0x0012, 0x0001}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, + {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0011, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, + {0x0011, 0x0009}, + +}; + +const uint32_t c_aauiCQMFHuffDec29[34][16] = +{ + {0x000fffff, 0x0010ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, }, + {0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020006, 0x00020006, 0x00020006, 0x00020006, }, + {0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, + {0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, + {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, + {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, + {0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, + {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, }, + {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, }, + {0x0016ffff, 0x0014ffff, 0x0015ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000003b, 0x0000003c, 0x0000003d, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00010030, 0x00010030, }, + {0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, }, + {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, + {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, }, + {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, + {0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, }, + {0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, + {0x001cffff, 0x001bffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x00010050, 0x00010050, 0x00010051, 0x00010051, }, + {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, + {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, }, + {0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, }, + {0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, + {0x0001006a, 0x0001006a, 0x0001006c, 0x0001006c, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, }, + {0x001fffff, 0x0020ffff, 0x0021ffff, 0x001dffff, 0x001effff, 0x0000006d, 0x00000071, 0x00000072, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, }, + {0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, + {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, }, + {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, }, + {0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, + {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, }, +}; + +const uint32_t c_aauiCQMFHuffEnc30[153][2] = +{ + {0x0007, 0x0009}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, + {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, + {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, {0x0006, 0x0023}, {0x0006, 0x0024}, + {0x0006, 0x0025}, {0x0006, 0x0026}, {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0006, 0x0029}, {0x0006, 0x002a}, {0x0006, 0x002b}, {0x0006, 0x002c}, + {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0006, 0x0030}, {0x0006, 0x0031}, {0x0006, 0x0032}, {0x0006, 0x0033}, {0x0006, 0x0034}, + {0x0006, 0x0035}, {0x0006, 0x0036}, {0x0006, 0x0037}, {0x0006, 0x0038}, {0x0006, 0x0039}, {0x0006, 0x003a}, {0x0006, 0x003b}, {0x0006, 0x003c}, + {0x0006, 0x003d}, {0x0006, 0x003e}, {0x0006, 0x003f}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, + {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0007, 0x0015}, {0x0007, 0x0016}, + {0x0007, 0x0017}, {0x0007, 0x0018}, {0x0007, 0x0019}, {0x0007, 0x001a}, {0x0007, 0x001b}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0009, 0x0007}, + {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x000a, 0x0008}, + {0x0009, 0x000f}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000b, 0x0007}, {0x000b, 0x0008}, + {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000c, 0x0008}, {0x000b, 0x000e}, {0x000b, 0x000f}, + {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000d, 0x0008}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000d, 0x0009}, {0x000c, 0x000d}, {0x000d, 0x000a}, + {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000e, 0x0008}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000e, 0x0009}, {0x000e, 0x000a}, + {0x000e, 0x000b}, {0x000e, 0x000c}, {0x000f, 0x0006}, {0x000f, 0x0007}, {0x000f, 0x0008}, {0x0010, 0x0006}, {0x000e, 0x000d}, {0x000e, 0x000e}, + {0x000e, 0x000f}, {0x0010, 0x0007}, {0x000f, 0x0009}, {0x0010, 0x0008}, {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000f, 0x000c}, {0x000f, 0x000d}, + {0x0010, 0x0009}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x000f, 0x000e}, {0x0010, 0x000a}, {0x0011, 0x0003}, {0x0011, 0x0004}, + {0x0011, 0x0005}, {0x000f, 0x000f}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, + {0x0010, 0x000b}, + +}; + +const uint32_t c_aauiCQMFHuffDec30[39][16] = +{ + {0x0010ffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, }, + {0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, + {0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, }, + {0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, + {0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, + {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, + {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, + {0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, + {0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, + {0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, + {0x0000004d, 0x0000004e, 0x00010000, 0x00010000, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, }, + {0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, }, + {0x0017ffff, 0x0018ffff, 0x0016ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, }, + {0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, + {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, + {0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, + {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, + {0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, + {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, }, + {0x001fffff, 0x0020ffff, 0x001dffff, 0x001effff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x00000065, 0x00000068, 0x00000069, 0x0000006b, 0x0000006c, 0x0000006e, 0x0001005e, 0x0001005e, }, + {0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010066, 0x00010066, 0x00010067, 0x00010067, }, + {0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, }, + {0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, }, + {0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, }, + {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, }, + {0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, + {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, + {0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0000007d, 0x00000081, 0x00000083, 0x00000088, 0x0000008d, 0x00000098, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, }, + {0x0001007c, 0x0001007c, 0x00010082, 0x00010082, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x0001008c, 0x0001008c, 0x00010091, 0x00010091, }, + {0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, }, + {0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, }, + {0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, }, + {0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, }, + {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, }, + {0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, }, +}; + +const uint32_t c_aauiCQMFHuffEnc31[181][2] = +{ + {0x0007, 0x000b}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, + {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, {0x0006, 0x0023}, + {0x0006, 0x0024}, {0x0006, 0x0025}, {0x0006, 0x0026}, {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0006, 0x0029}, {0x0006, 0x002a}, {0x0006, 0x002b}, + {0x0006, 0x002c}, {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0006, 0x0030}, {0x0006, 0x0031}, {0x0006, 0x0032}, {0x0006, 0x0033}, + {0x0006, 0x0034}, {0x0006, 0x0035}, {0x0006, 0x0036}, {0x0006, 0x0037}, {0x0006, 0x0038}, {0x0006, 0x0039}, {0x0006, 0x003a}, {0x0006, 0x003b}, + {0x0006, 0x003c}, {0x0006, 0x003d}, {0x0006, 0x003e}, {0x0007, 0x000c}, {0x0006, 0x003f}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, + {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0007, 0x0015}, {0x0007, 0x0016}, {0x0007, 0x0017}, + {0x0007, 0x0018}, {0x0007, 0x0019}, {0x0007, 0x001a}, {0x0007, 0x001b}, {0x0007, 0x001c}, {0x0007, 0x001d}, {0x0007, 0x001e}, {0x0007, 0x001f}, + {0x0007, 0x0020}, {0x0007, 0x0021}, {0x0007, 0x0022}, {0x0007, 0x0023}, {0x0007, 0x0024}, {0x0007, 0x0025}, {0x0007, 0x0026}, {0x0007, 0x0027}, + {0x0007, 0x0028}, {0x0007, 0x0029}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, + {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0008, 0x0012}, {0x0008, 0x0013}, {0x0008, 0x0014}, {0x0008, 0x0015}, {0x0009, 0x0008}, + {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, + {0x0009, 0x0011}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000a, 0x000e}, + {0x000a, 0x000f}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000b, 0x000e}, + {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000b, 0x000f}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000c, 0x000d}, {0x000d, 0x0008}, + {0x000c, 0x000e}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000c, 0x000f}, {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, + {0x000d, 0x000f}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000e, 0x000b}, {0x000e, 0x000c}, {0x000e, 0x000d}, {0x000e, 0x000e}, + {0x000e, 0x000f}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000f, 0x000c}, {0x0010, 0x0009}, {0x000f, 0x000d}, {0x000f, 0x000e}, + {0x0010, 0x000a}, {0x0010, 0x000b}, {0x0010, 0x000c}, {0x0010, 0x000d}, {0x0011, 0x000a}, {0x0010, 0x000e}, {0x000f, 0x000f}, {0x0010, 0x000f}, + {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0010, 0x0010}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0011, 0x000d}, + {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0010, 0x0011}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, + {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, + {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, + +}; + +const uint32_t c_aauiCQMFHuffDec31[43][16] = +{ + {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, + {0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020003, 0x00020003, 0x00020003, 0x00020003, }, + {0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020007, 0x00020007, 0x00020007, 0x00020007, }, + {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, + {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, + {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, + {0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00010000, 0x00010000, 0x0001002b, 0x0001002b, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, }, + {0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, }, + {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, }, + {0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, }, + {0x0019ffff, 0x0018ffff, 0x0016ffff, 0x0017ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, }, + {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, + {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, + {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, }, + {0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, }, + {0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, + {0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, }, + {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, + {0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010072, 0x00010072, }, + {0x0021ffff, 0x0020ffff, 0x001effff, 0x001fffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x00000070, 0x00000071, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000078, 0x0000007b, }, + {0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, }, + {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, }, + {0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, }, + {0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, }, + {0x00020081, 0x00020081, 0x00020081, 0x00020081, 0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, }, + {0x00020085, 0x00020085, 0x00020085, 0x00020085, 0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, }, + {0x0000009c, 0x000000a4, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010096, 0x00010096, }, + {0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0000008d, 0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000095, 0x00000097, }, + {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, }, + {0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, }, + {0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, }, + {0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, + {0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x00020099, 0x00020099, 0x00020099, 0x00020099, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, }, + {0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, }, + {0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, }, + {0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, }, + {0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, }, +}; + +const uint32_t c_aauiCQMFHuffEnc33[16][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, + {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, +}; + +const uint32_t c_aauiCQMFHuffDec33[2][16] = +{ + {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +}; + +const uint32_t c_aauiCQMFHuffEnc34[16][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, + {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, +}; + +const uint32_t c_aauiCQMFHuffDec34[2][16] = +{ + {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +}; + +const uint32_t c_aauiCQMFHuffEnc35[25][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0007, 0x0006}, {0x0009, 0x0000}, {0x0009, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0009, 0x0002}, + {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0007, 0x0007}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, + {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, + +}; + +const uint32_t c_aauiCQMFHuffDec35[9][16] = +{ + {0x0001ffff, 0x00000006, 0x00010001, 0x00010001, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0007ffff, 0x0008ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00010002, 0x00010002, 0x0001000a, 0x0001000a, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, +}; + +const uint32_t c_aauiCQMFHuffEnc36[36][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0002}, {0x000b, 0x0000}, {0x000b, 0x0001}, {0x000b, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, + {0x0008, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x0006, 0x0003}, {0x0007, 0x0003}, {0x000b, 0x0006}, {0x000b, 0x0007}, + {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000b, 0x000e}, {0x000b, 0x000f}, + {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000a, 0x000e}, {0x000a, 0x000f}, + {0x000a, 0x0010}, {0x000a, 0x0011}, {0x000a, 0x0012}, {0x000a, 0x0013}, + +}; + +const uint32_t c_aauiCQMFHuffDec36[7][16] = +{ + {0x0001ffff, 0x00000007, 0x00010006, 0x00010006, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0006ffff, 0x0005ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000008, 0x0001000d, 0x0001000d, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, + {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, + {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, + {0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, }, + {0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +}; + +const uint32_t c_aauiCQMFHuffEnc37[36][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0000}, {0x000c, 0x0001}, {0x000c, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, + {0x0006, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x000a, 0x0007}, {0x000c, 0x0006}, + {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000c, 0x000d}, {0x000c, 0x000e}, + {0x000c, 0x000f}, {0x000c, 0x0010}, {0x000c, 0x0011}, {0x000c, 0x0012}, {0x000c, 0x0013}, {0x000c, 0x0014}, {0x000c, 0x0015}, {0x000c, 0x0016}, + {0x000c, 0x0017}, {0x000c, 0x0018}, {0x000c, 0x0019}, {0x000b, 0x000d}, + +}; + +const uint32_t c_aauiCQMFHuffDec37[4][16] = +{ + {0x0001ffff, 0x00000007, 0x00010006, 0x00010006, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0002ffff, 0x0001000d, 0x0001000d, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, + {0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00010023, 0x00010023, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, + {0x00000003, 0x00000004, 0x00000005, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, }, +}; + +const uint32_t c_aauiCQMFHuffEnc38[49][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0012}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x000d, 0x0002}, {0x0002, 0x0001}, + {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x000a}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x0006, 0x0002}, {0x0006, 0x0003}, + {0x0009, 0x0003}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000c, 0x0013}, {0x000b, 0x000b}, {0x000d, 0x000a}, + {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000d, 0x0010}, {0x000d, 0x0011}, {0x000d, 0x0012}, + {0x000d, 0x0013}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000d, 0x0018}, {0x000d, 0x0019}, {0x000d, 0x001a}, + {0x000d, 0x001b}, {0x000d, 0x001c}, {0x000d, 0x001d}, {0x000d, 0x001e}, {0x000d, 0x001f}, {0x000d, 0x0020}, {0x000d, 0x0021}, {0x000d, 0x0022}, + {0x000d, 0x0023}, + +}; + +const uint32_t c_aauiCQMFHuffDec38[22][16] = +{ + {0x0001ffff, 0x00000008, 0x00010001, 0x00010001, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x0014ffff, 0x0015ffff, 0x00000003, 0x00000015, 0x0001000a, 0x0001000a, 0x00010016, 0x00010016, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x0005ffff, 0x0006ffff, 0x0004ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, + {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, + {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, + {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, +}; + +const uint32_t c_aauiCQMFHuffEnc39[64][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0002}, {0x000f, 0x0000}, {0x000f, 0x0001}, {0x000f, 0x0002}, {0x000f, 0x0003}, + {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, {0x000f, 0x0007}, + {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0009, 0x0003}, {0x000d, 0x000e}, {0x000f, 0x0008}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, + {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000d, 0x000f}, {0x000f, 0x000c}, {0x000f, 0x000d}, {0x000f, 0x000e}, {0x000f, 0x000f}, {0x000f, 0x0010}, + {0x000f, 0x0011}, {0x000f, 0x0012}, {0x000f, 0x0013}, {0x000f, 0x0014}, {0x000f, 0x0015}, {0x000f, 0x0016}, {0x000f, 0x0017}, {0x000f, 0x0018}, + {0x000f, 0x0019}, {0x000f, 0x001a}, {0x000f, 0x001b}, {0x000f, 0x001c}, {0x000f, 0x001d}, {0x000f, 0x001e}, {0x000f, 0x001f}, {0x000f, 0x0020}, + {0x000f, 0x0021}, {0x000f, 0x0022}, {0x000f, 0x0023}, {0x000f, 0x0024}, {0x000f, 0x0025}, {0x000f, 0x0026}, {0x000f, 0x0027}, {0x000f, 0x0028}, + {0x000f, 0x0029}, {0x000e, 0x0015}, {0x000e, 0x0016}, {0x000e, 0x0017}, {0x000e, 0x0018}, {0x000e, 0x0019}, {0x000e, 0x001a}, {0x000e, 0x001b}, +}; + +const uint32_t c_aauiCQMFHuffDec39[12][16] = +{ + {0x0001ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0002ffff, 0x0001000a, 0x0001000a, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, + {0x0008ffff, 0x0007ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0005ffff, 0x0006ffff, 0x0004ffff, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, + {0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, }, + {0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, }, + {0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, }, + {0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, + {0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, }, + {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, + {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, }, +}; + +const uint32_t c_aauiCQMFHuffEnc40[81][2] = +{ + {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000f, 0x0011}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, + {0x0011, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x000e, 0x0009}, {0x0011, 0x0004}, {0x0011, 0x0005}, + {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0005}, {0x0011, 0x0008}, {0x0011, 0x0009}, + {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x000b, 0x0003}, {0x000a, 0x0003}, {0x000c, 0x0003}, {0x0011, 0x000d}, {0x0011, 0x000e}, + {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, + {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, + {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, {0x0011, 0x0024}, {0x0011, 0x0025}, {0x0011, 0x0026}, + {0x0011, 0x0027}, {0x0011, 0x0028}, {0x0011, 0x0029}, {0x0011, 0x002a}, {0x0011, 0x002b}, {0x0011, 0x002c}, {0x0011, 0x002d}, {0x0011, 0x002e}, + {0x0011, 0x002f}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0011, 0x0032}, {0x0011, 0x0033}, {0x0011, 0x0034}, {0x0011, 0x0035}, {0x0011, 0x0036}, + {0x0011, 0x0037}, {0x0011, 0x0038}, {0x0011, 0x0039}, {0x0011, 0x003a}, {0x0011, 0x003b}, {0x0010, 0x001e}, {0x0010, 0x001f}, {0x0010, 0x0020}, + {0x0010, 0x0021}, + +}; + +const uint32_t c_aauiCQMFHuffDec40[36][16] = +{ + {0x0001ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000014, 0x0001000b, 0x0001000b, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x0005ffff, 0x0004ffff, 0x0003ffff, 0x0000001d, 0x00010003, 0x00010003, 0x0001001b, 0x0001001b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, + {0x0000004f, 0x00000050, 0x00010004, 0x00010004, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0000004d, 0x0000004e, }, + {0x0023ffff, 0x000affff, 0x0006ffff, 0x000bffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, }, + {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, + {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, + {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, + {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, + {0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, + {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, + {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, + {0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, + {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, + {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, + {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, }, + {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, + {0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, }, + {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, +}; + +const uint32_t c_aauiCQMFHuffEnc41[100][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0014}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, + {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x000b}, {0x0013, 0x0005}, + {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0002}, + {0x0011, 0x0015}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x000a, 0x0002}, {0x000a, 0x0003}, + {0x000d, 0x0003}, {0x0010, 0x000c}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, + {0x0010, 0x000d}, {0x000f, 0x0007}, {0x0012, 0x0027}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, + {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, + {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, + {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, + {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, + {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, + {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, + {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, + +}; + +const uint32_t c_aauiCQMFHuffDec41[16][16] = +{ + {0x0001ffff, 0x0000000b, 0x00010001, 0x00010001, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0002ffff, 0x00000016, 0x0001000c, 0x0001000c, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, + {0x0004ffff, 0x0003ffff, 0x00010003, 0x00010003, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0006ffff, 0x0005ffff, 0x0000000e, 0x00000021, 0x00000028, 0x00010029, 0x00010029, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, + {0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, }, + {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x00010022, 0x00010022, }, + {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, }, + {0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, }, + {0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, + {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, + {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, }, + {0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, }, + {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, }, +}; + +const uint32_t c_aauiCQMFHuffEnc42[169][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000e, 0x0006}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, + {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, + {0x0009, 0x0002}, {0x000d, 0x0004}, {0x0010, 0x0013}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, + {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000f, 0x000b}, {0x0011, 0x0025}, + {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0009, 0x0003}, + {0x0008, 0x0003}, {0x000b, 0x0003}, {0x000d, 0x0005}, {0x0010, 0x0014}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, + {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x0010, 0x0015}, + {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, + {0x0013, 0x0026}, {0x0012, 0x0045}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, + {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, + {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, + {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, + {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, + {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, + {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, + {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, + {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, + {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, + {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, + {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, + {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0012, 0x0046}, {0x0012, 0x0047}, {0x0012, 0x0048}, + {0x0012, 0x0049}, + +}; + +const uint32_t c_aauiCQMFHuffDec42[28][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0003ffff, 0x0004ffff, 0x0000001c, 0x00000028, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x000affff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001001d, 0x0001001d, 0x00010029, 0x00010029, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, + {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, + {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x001bffff, 0x0009ffff, 0x0008ffff, 0x00000012, 0x0000002b, 0x00000037, 0x0001001e, 0x0001001e, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020036, 0x00020036, 0x00020036, 0x00020036, }, + {0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, + {0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, }, + {0x000dffff, 0x000bffff, 0x000cffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, }, + {0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00010020, 0x00010020, }, + {0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, }, + {0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, }, + {0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, + {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010042, 0x00010042, }, + {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, }, + {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, + {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, + {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, + {0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, }, + {0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, }, + {0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, }, + {0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, }, + {0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, + {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, }, + {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, }, + {0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, }, +}; + +const uint32_t c_aauiCQMFHuffEnc43[196][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000c, 0x0003}, {0x0010, 0x0017}, {0x0013, 0x0000}, {0x0013, 0x0001}, + {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0003, 0x0002}, {0x0003, 0x0003}, + {0x0005, 0x0001}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x0010, 0x0018}, {0x0012, 0x0050}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, + {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0008, 0x0003}, {0x000a, 0x0002}, + {0x000d, 0x0004}, {0x0011, 0x002a}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, + {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000c, 0x0005}, {0x000f, 0x000d}, {0x0012, 0x0051}, + {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, + {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0005}, {0x000f, 0x000e}, {0x0011, 0x002b}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, + {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0011, 0x002c}, {0x000f, 0x000f}, + {0x0010, 0x0019}, {0x0012, 0x0052}, {0x0012, 0x0053}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, + {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0011, 0x002d}, {0x0013, 0x0032}, {0x0013, 0x0033}, + {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, + {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, + {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, + {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, + {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, + {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, + {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, + {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, + {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, + {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, + {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, + {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, + {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, + {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, + +}; + +const uint32_t c_aauiCQMFHuffDec43[32][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x0005ffff, 0x0003ffff, 0x0004ffff, 0x0000001e, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, + {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x000bffff, 0x0007ffff, 0x0006ffff, 0x00000004, 0x00000012, 0x0000002d, 0x00000038, 0x00000039, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, + {0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, + {0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x00000013, 0x00000048, 0x0001002e, 0x0001002e, 0x0001003b, 0x0001003b, 0x00010047, 0x00010047, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, + {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, + {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, + {0x000dffff, 0x000effff, 0x000cffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, }, + {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x00010030, 0x00010030, }, + {0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, }, + {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00010022, 0x00010022, }, + {0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x0001003d, 0x0001003d, }, + {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, + {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, + {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, }, + {0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, }, + {0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, }, + {0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, }, + {0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, }, + {0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, }, + {0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, }, + {0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, }, + {0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, }, + {0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, }, + {0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, }, + {0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, }, + {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, + {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, +}; + +const uint32_t c_aauiCQMFHuffEnc44[289][2] = +{ + {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0002}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000f, 0x000a}, {0x0011, 0x0022}, {0x0014, 0x0000}, + {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, + {0x0014, 0x0009}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0002}, {0x0008, 0x0003}, {0x000b, 0x0003}, {0x000e, 0x0007}, {0x0012, 0x003f}, + {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, + {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0006, 0x0003}, {0x0005, 0x0003}, {0x0007, 0x0003}, {0x0009, 0x0002}, {0x000c, 0x0003}, {0x000f, 0x000b}, + {0x0012, 0x0040}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, + {0x0014, 0x001b}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x000b, 0x0004}, {0x000d, 0x0005}, + {0x0010, 0x0013}, {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, + {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000e, 0x0008}, + {0x0011, 0x0023}, {0x0012, 0x0041}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0013, 0x007b}, {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, + {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, {0x000f, 0x000c}, {0x000e, 0x0009}, {0x000f, 0x000d}, + {0x0011, 0x0024}, {0x0012, 0x0042}, {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, + {0x0014, 0x0039}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0013, 0x007c}, {0x0011, 0x0025}, + {0x0012, 0x0043}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, + {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, + {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, + {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, + {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, {0x0014, 0x0063}, {0x0014, 0x0064}, {0x0014, 0x0065}, + {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, + {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, + {0x0014, 0x0076}, {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, + {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, + {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, + {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, + {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, + {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, + {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0014, 0x00ad}, + {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, + {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, + {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, + {0x0014, 0x00c6}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, + {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, + {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, + {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, + {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, + {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, + {0x0013, 0x007d}, + +}; + +const uint32_t c_aauiCQMFHuffDec44[27][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00010001, 0x00010001, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, + {0x0004ffff, 0x0003ffff, 0x00000003, 0x00000014, 0x00000033, 0x00000034, 0x00010024, 0x00010024, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, + {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x000affff, 0x0006ffff, 0x0005ffff, 0x00000026, 0x00010004, 0x00010004, 0x00010015, 0x00010015, 0x00010036, 0x00010036, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, }, + {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000038, 0x00010005, 0x00010005, 0x00010027, 0x00010027, 0x00010055, 0x00010055, 0x00010057, 0x00010057, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, + {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, + {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, + {0x000dffff, 0x000cffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x000bffff, }, + {0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x0001004c, 0x0001004c, 0x00010066, 0x00010066, 0x00010120, 0x00010120, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, + {0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, 0x00000032, 0x00000039, 0x0000003a, }, + {0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0000000f, 0x00000010, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, }, + {0x0000003b, 0x0000003c, 0x0000003d, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x0000004a, 0x0000004b, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x00000051, }, + {0x00000052, 0x00000053, 0x00000054, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000069, }, + {0x0000006a, 0x0000006b, 0x0000006c, 0x0000006d, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, }, + {0x0000007a, 0x0000007b, 0x0000007c, 0x0000007d, 0x0000007e, 0x0000007f, 0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, }, + {0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, }, + {0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, 0x000000a1, 0x000000a2, 0x000000a3, 0x000000a4, 0x000000a5, 0x000000a6, 0x000000a7, 0x000000a8, 0x000000a9, }, + {0x000000aa, 0x000000ab, 0x000000ac, 0x000000ad, 0x000000ae, 0x000000af, 0x000000b0, 0x000000b1, 0x000000b2, 0x000000b3, 0x000000b4, 0x000000b5, 0x000000b6, 0x000000b7, 0x000000b8, 0x000000b9, }, + {0x000000ba, 0x000000bb, 0x000000bc, 0x000000bd, 0x000000be, 0x000000bf, 0x000000c0, 0x000000c1, 0x000000c2, 0x000000c3, 0x000000c4, 0x000000c5, 0x000000c6, 0x000000c7, 0x000000c8, 0x000000c9, }, + {0x000000ca, 0x000000cb, 0x000000cc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000d8, 0x000000d9, }, + {0x000000da, 0x000000db, 0x000000dc, 0x000000dd, 0x000000de, 0x000000df, 0x000000e0, 0x000000e1, 0x000000e2, 0x000000e3, 0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, }, + {0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000f3, 0x000000f4, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, 0x000000f9, }, + {0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, }, + {0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, }, +}; + +const uint32_t c_aauiCQMFHuffEnc45[324][2] = +{ + {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0005}, {0x0010, 0x0025}, {0x0012, 0x0088}, + {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, + {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0004}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000b, 0x0004}, + {0x000f, 0x0014}, {0x0011, 0x0048}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, + {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0005, 0x0005}, {0x0004, 0x0003}, {0x0006, 0x0004}, {0x0007, 0x0003}, + {0x000a, 0x0004}, {0x000d, 0x0007}, {0x000f, 0x0015}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, + {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0007, 0x0004}, {0x0006, 0x0005}, + {0x0007, 0x0005}, {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000d, 0x0008}, {0x0010, 0x0026}, {0x0012, 0x0089}, {0x0012, 0x008a}, {0x0013, 0x001f}, + {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, + {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x0009}, {0x000f, 0x0016}, {0x0011, 0x0049}, {0x0013, 0x0028}, + {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, + {0x0013, 0x0031}, {0x0013, 0x0032}, {0x000c, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0007}, {0x000e, 0x000d}, {0x0010, 0x0027}, {0x0012, 0x008b}, + {0x0012, 0x008c}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, + {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x000f, 0x0017}, {0x000f, 0x0018}, {0x000f, 0x0019}, {0x0012, 0x008d}, + {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, + {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0012, 0x008e}, + {0x0012, 0x008f}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, + {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, + {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, + {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, + {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, + {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, + {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, + {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, + {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, + {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, + {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, + {0x0013, 0x00a4}, {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, + {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, + {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, + {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, + {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, + {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, + {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, + {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, + {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, + {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, + {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, + {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, + {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, + {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, + +}; + +const uint32_t c_aauiCQMFHuffDec45[50][16] = +{ + {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000025, 0x00010001, 0x00010001, 0x00010013, 0x00010013, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x0007ffff, 0x0005ffff, 0x0004ffff, 0x0006ffff, 0x00010003, 0x00010003, 0x00010027, 0x00010027, 0x00010036, 0x00010036, 0x00010038, 0x00010038, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, + {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, + {0x000effff, 0x001fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x0000005a, 0x0000005c, 0x00010017, 0x00010017, 0x0001003a, 0x0001003a, 0x0001004b, 0x0001004b, 0x0001005b, 0x0001005b, }, + {0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, + {0x0030ffff, 0x0031ffff, 0x000cffff, 0x000dffff, 0x000bffff, 0x00000006, 0x0000003c, 0x0000005e, 0x00010018, 0x00010018, 0x0001002a, 0x0001002a, 0x0001004d, 0x0001004d, 0x0001006c, 0x0001006c, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, + {0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, }, + {0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, + {0x0010ffff, 0x0011ffff, 0x0012ffff, 0x000fffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, }, + {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x0001003f, 0x0001003f, }, + {0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, + {0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, }, + {0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, + {0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, }, + {0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, }, + {0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, }, + {0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x00010070, 0x00010070, 0x00010071, 0x00010071, }, + {0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, }, + {0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, }, + {0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, }, + {0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, }, + {0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, }, + {0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, }, + {0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, }, + {0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, }, + {0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, }, + {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, + {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, + {0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, }, + {0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, }, + {0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, }, + {0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100e1, 0x000100e1, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, }, + {0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, }, + {0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, }, + {0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x000100fa, 0x000100fa, 0x000100fb, 0x000100fb, }, + {0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, }, + {0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, }, + {0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, 0x00010112, 0x00010112, 0x00010113, 0x00010113, }, + {0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, 0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, }, + {0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, 0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, }, + {0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, 0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, }, + {0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010132, 0x00010132, 0x00010133, 0x00010133, }, + {0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, }, + {0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, }, +}; + +const uint32_t c_aauiCQMFHuffEnc46[400][2] = +{ + {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0004}, {0x0009, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x000a}, {0x000f, 0x0018}, + {0x0012, 0x00a6}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, + {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0004}, {0x0006, 0x0004}, + {0x0008, 0x0004}, {0x000a, 0x0006}, {0x000c, 0x0008}, {0x000e, 0x0011}, {0x0012, 0x00a7}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, + {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0007, 0x0005}, {0x0009, 0x0006}, {0x000b, 0x0007}, {0x000d, 0x000b}, {0x000f, 0x0019}, + {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, + {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0007, 0x0006}, {0x0006, 0x0005}, {0x0007, 0x0007}, {0x0008, 0x0005}, + {0x000a, 0x0007}, {0x000c, 0x0009}, {0x000e, 0x0012}, {0x000f, 0x001a}, {0x0012, 0x00a8}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, + {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, + {0x0009, 0x0007}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x000a, 0x0008}, {0x000b, 0x0008}, {0x000d, 0x000c}, {0x000e, 0x0013}, {0x0010, 0x002c}, + {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, + {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x000b, 0x0009}, {0x000a, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, + {0x000d, 0x000d}, {0x000f, 0x001b}, {0x0010, 0x002d}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, + {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, + {0x000d, 0x000e}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000d, 0x000f}, {0x000f, 0x001c}, {0x000f, 0x001d}, {0x0013, 0x0046}, {0x0013, 0x0047}, + {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, + {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x000f, 0x001e}, {0x000f, 0x001f}, {0x000f, 0x0020}, {0x000f, 0x0021}, + {0x0010, 0x002e}, {0x0012, 0x00a9}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0012, 0x00aa}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, + {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, + {0x0013, 0x0061}, {0x0010, 0x002f}, {0x0013, 0x0062}, {0x0011, 0x0057}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, + {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, + {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, + {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, + {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, + {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, + {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, + {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, + {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, {0x0013, 0x00a6}, + {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, + {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, + {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, + {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, + {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, + {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, + {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, + {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, + {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, + {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, + {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, + {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, + {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, + {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, + {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, + {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, + {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, + {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, + {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, + {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, + {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0012, 0x00ab}, {0x0012, 0x00ac}, {0x0012, 0x00ad}, +}; + +const uint32_t c_aauiCQMFHuffDec46[61][16] = +{ + {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00010001, 0x00010001, 0x00010015, 0x00010015, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, + {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, + {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x00000018, 0x0000003f, 0x00000051, 0x00000052, 0x00010003, 0x00010003, 0x0001002b, 0x0001002b, 0x0001003c, 0x0001003c, 0x0001003e, 0x0001003e, }, + {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, + {0x00010054, 0x00010054, 0x00010064, 0x00010064, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, + {0x0012ffff, 0x0023ffff, 0x000effff, 0x000dffff, 0x000cffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0000001a, 0x00000041, 0x00000079, 0x0000007a, 0x00010005, 0x00010005, 0x0001002d, 0x0001002d, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, + {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, + {0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, + {0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, + {0x00010007, 0x00010007, 0x0001002f, 0x0001002f, 0x00010043, 0x00010043, 0x00010069, 0x00010069, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, }, + {0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x0010ffff, 0x0011ffff, 0x000fffff, 0x00000057, 0x0000006a, 0x00000090, 0x000000a1, }, + {0x0002018e, 0x0002018e, 0x0002018e, 0x0002018e, 0x0002018f, 0x0002018f, 0x0002018f, 0x0002018f, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, + {0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, + {0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020091, 0x00020091, 0x00020091, 0x00020091, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x0002018d, 0x0002018d, 0x0002018d, 0x0002018d, }, + {0x0013ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0014ffff, 0x0015ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, }, + {0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, }, + {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, }, + {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, + {0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, + {0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, + {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, + {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, + {0x00010063, 0x00010063, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, }, + {0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, }, + {0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, }, + {0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010095, 0x00010095, 0x00010096, 0x00010096, }, + {0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, }, + {0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a2, 0x000100a2, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, }, + {0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, }, + {0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, }, + {0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, }, + {0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, }, + {0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, }, + {0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, }, + {0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, }, + {0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, }, + {0x000100e1, 0x000100e1, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, }, + {0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, }, + {0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, }, + {0x000100f9, 0x000100f9, 0x000100fa, 0x000100fa, 0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, }, + {0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, }, + {0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, }, + {0x00010111, 0x00010111, 0x00010112, 0x00010112, 0x00010113, 0x00010113, 0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, }, + {0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, + {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, + {0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, }, + {0x00010131, 0x00010131, 0x00010132, 0x00010132, 0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, }, + {0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, }, + {0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010148, 0x00010148, }, + {0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, }, + {0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, }, + {0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, }, + {0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, }, + {0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, }, + {0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, }, + {0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, }, + {0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, }, +}; + +const uint32_t c_aauiCQMFHuffEnc47[576][2] = +{ + {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0005}, {0x0006, 0x0004}, {0x0008, 0x0006}, {0x000a, 0x0007}, {0x000c, 0x000b}, {0x000d, 0x000d}, + {0x0010, 0x0041}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, + {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, + {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0009, 0x0006}, {0x000b, 0x0007}, {0x000d, 0x000e}, + {0x000f, 0x0025}, {0x000f, 0x0026}, {0x0012, 0x00f6}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, + {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, + {0x0005, 0x0006}, {0x0004, 0x0005}, {0x0005, 0x0007}, {0x0006, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0007}, {0x000b, 0x0008}, {0x000d, 0x000f}, + {0x000f, 0x0027}, {0x0012, 0x00f7}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, + {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, + {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0007, 0x0006}, {0x0009, 0x0008}, {0x000a, 0x0008}, {0x000c, 0x000c}, {0x000e, 0x0017}, + {0x0010, 0x0042}, {0x0012, 0x00f8}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, + {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, + {0x0008, 0x0008}, {0x0007, 0x0007}, {0x0008, 0x0009}, {0x0009, 0x0009}, {0x000a, 0x0009}, {0x000b, 0x0009}, {0x000d, 0x0010}, {0x000f, 0x0028}, + {0x000f, 0x0029}, {0x0011, 0x007f}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, + {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, + {0x000a, 0x000a}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x000a, 0x000b}, {0x000b, 0x000a}, {0x000d, 0x0011}, {0x000f, 0x002a}, {0x0010, 0x0043}, + {0x0012, 0x00f9}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, + {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, + {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000c, 0x000d}, {0x000d, 0x0012}, {0x000e, 0x0018}, {0x0010, 0x0044}, {0x0013, 0x0055}, + {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, + {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, + {0x000e, 0x0019}, {0x000d, 0x0013}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x000f, 0x002b}, {0x0010, 0x0045}, {0x0013, 0x0066}, {0x0012, 0x00fa}, + {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, + {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, + {0x0010, 0x0046}, {0x000f, 0x002c}, {0x000f, 0x002d}, {0x0010, 0x0047}, {0x0011, 0x0080}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, + {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, + {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, + {0x0013, 0x008a}, {0x0010, 0x0048}, {0x0010, 0x0049}, {0x0011, 0x0081}, {0x0013, 0x008b}, {0x0012, 0x00fb}, {0x0013, 0x008c}, {0x0013, 0x008d}, + {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, + {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, + {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0012, 0x00fc}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, + {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, + {0x0013, 0x00ad}, {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, + {0x0013, 0x00b5}, {0x0013, 0x00b6}, {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, + {0x0013, 0x00bd}, {0x0013, 0x00be}, {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, + {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, + {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, + {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, + {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, + {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, + {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, + {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, + {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, + {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, + {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, + {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, + {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, + {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, + {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, + {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, + {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, + {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0013, 0x014c}, + {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, {0x0013, 0x0153}, {0x0013, 0x0154}, + {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, {0x0013, 0x015b}, {0x0013, 0x015c}, + {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, {0x0013, 0x0163}, {0x0013, 0x0164}, + {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, {0x0013, 0x016b}, {0x0013, 0x016c}, + {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, {0x0013, 0x0173}, {0x0013, 0x0174}, + {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, {0x0013, 0x017b}, {0x0013, 0x017c}, + {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, {0x0013, 0x0183}, {0x0013, 0x0184}, + {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, {0x0013, 0x018b}, {0x0013, 0x018c}, + {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, {0x0013, 0x0193}, {0x0013, 0x0194}, + {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, {0x0013, 0x019b}, {0x0013, 0x019c}, + {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, {0x0013, 0x01a3}, {0x0013, 0x01a4}, + {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, {0x0013, 0x01ab}, {0x0013, 0x01ac}, + {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, {0x0013, 0x01b3}, {0x0013, 0x01b4}, + {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, {0x0013, 0x01bb}, {0x0013, 0x01bc}, + {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, {0x0013, 0x01c3}, {0x0013, 0x01c4}, + {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, {0x0013, 0x01cb}, {0x0013, 0x01cc}, + {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, {0x0013, 0x01d3}, {0x0013, 0x01d4}, + {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, {0x0013, 0x01db}, {0x0013, 0x01dc}, + {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, {0x0013, 0x01e3}, {0x0013, 0x01e4}, + {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, {0x0012, 0x00fd}, +}; + +const uint32_t c_aauiCQMFHuffDec47[87][16] = +{ + {0x0004ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x0000001a, 0x00000031, 0x00010001, 0x00010001, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, + {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, + {0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020048, 0x00020048, 0x00020048, 0x00020048, }, + {0x000affff, 0x0008ffff, 0x0009ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000004, 0x00000034, 0x00000060, 0x00000062, 0x0001001c, 0x0001001c, 0x0001004b, 0x0001004b, 0x00010061, 0x00010061, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, }, + {0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, }, + {0x00010036, 0x00010036, 0x00010065, 0x00010065, 0x0001007c, 0x0001007c, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00020005, 0x00020005, 0x00020005, 0x00020005, }, + {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, }, + {0x0017ffff, 0x0028ffff, 0x0039ffff, 0x0012ffff, 0x0011ffff, 0x0010ffff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000006, 0x0000004e, 0x00000093, 0x0001001e, 0x0001001e, }, + {0x00020095, 0x00020095, 0x00020095, 0x00020095, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, + {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, }, + {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, + {0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, }, + {0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x0001007e, 0x0001007e, 0x000100ac, 0x000100ac, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, + {0x0014ffff, 0x00000008, 0x00000050, 0x0000007f, 0x00000096, 0x000000ad, 0x000000c0, 0x000000c3, 0x000000d9, 0x000000da, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010038, 0x00010038, }, + {0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0016ffff, 0x0015ffff, 0x0013ffff, }, + {0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x0002023f, 0x0002023f, 0x0002023f, 0x0002023f, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, + {0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, }, + {0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, }, + {0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x001bffff, 0x001affff, 0x001dffff, 0x001cffff, 0x0020ffff, 0x0018ffff, 0x0019ffff, 0x001effff, 0x001fffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, }, + {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, }, + {0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, }, + {0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010023, 0x00010023, }, + {0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, }, + {0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, + {0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, }, + {0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, }, + {0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010081, 0x00010081, 0x00010082, 0x00010082, }, + {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, + {0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, + {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, }, + {0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, }, + {0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100ae, 0x000100ae, 0x000100b0, 0x000100b0, }, + {0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, }, + {0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c5, 0x000100c5, }, + {0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, }, + {0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, }, + {0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, }, + {0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100dc, 0x000100dc, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100e1, 0x000100e1, }, + {0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, }, + {0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, }, + {0x000100f2, 0x000100f2, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x000100fa, 0x000100fa, }, + {0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, }, + {0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, }, + {0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, 0x00010112, 0x00010112, }, + {0x00010113, 0x00010113, 0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, 0x00010119, 0x00010119, 0x0001011a, 0x0001011a, }, + {0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, 0x00010121, 0x00010121, 0x00010122, 0x00010122, }, + {0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, 0x00010129, 0x00010129, 0x0001012a, 0x0001012a, }, + {0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010132, 0x00010132, }, + {0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, }, + {0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, }, + {0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010148, 0x00010148, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, }, + {0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, }, + {0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, }, + {0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, }, + {0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, }, + {0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, }, + {0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, }, + {0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, }, + {0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, }, + {0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, }, + {0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, }, + {0x00010193, 0x00010193, 0x00010194, 0x00010194, 0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, }, + {0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, }, + {0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, }, + {0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, }, + {0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, }, + {0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, }, + {0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, }, + {0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, }, + {0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, }, + {0x000101db, 0x000101db, 0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, }, + {0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, }, + {0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, }, + {0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, }, + {0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, }, + {0x00010203, 0x00010203, 0x00010204, 0x00010204, 0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, }, + {0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, }, + {0x00010213, 0x00010213, 0x00010214, 0x00010214, 0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, }, + {0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, }, + {0x00010223, 0x00010223, 0x00010224, 0x00010224, 0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, }, + {0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, }, + {0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, }, +}; + +const uint32_t c_aauiCQMFHuffEnc48[729][2] = +{ + {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0006}, {0x0006, 0x0006}, {0x0008, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x000b}, {0x000c, 0x000d}, + {0x000f, 0x0030}, {0x0010, 0x0055}, {0x0012, 0x0136}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, + {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, + {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0005, 0x0007}, {0x0006, 0x0007}, {0x0007, 0x0007}, + {0x0008, 0x0007}, {0x000a, 0x0008}, {0x000c, 0x000e}, {0x000d, 0x0012}, {0x000f, 0x0031}, {0x0011, 0x00a0}, {0x0013, 0x0010}, {0x0013, 0x0011}, + {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, + {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0005, 0x0008}, {0x0004, 0x0005}, + {0x0005, 0x0009}, {0x0006, 0x0008}, {0x0007, 0x0008}, {0x0008, 0x0008}, {0x000a, 0x0009}, {0x000c, 0x000f}, {0x000d, 0x0013}, {0x000f, 0x0032}, + {0x0011, 0x00a1}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, + {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, + {0x0013, 0x002f}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0009}, {0x0008, 0x0009}, {0x0009, 0x0008}, {0x000b, 0x000c}, + {0x000d, 0x0014}, {0x000e, 0x001d}, {0x000f, 0x0033}, {0x0012, 0x0137}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, + {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, + {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0008, 0x000a}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x000b}, + {0x0009, 0x0009}, {0x000a, 0x000a}, {0x000c, 0x0010}, {0x000d, 0x0015}, {0x000f, 0x0034}, {0x0010, 0x0056}, {0x0012, 0x0138}, {0x0013, 0x0040}, + {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, + {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0009, 0x000a}, + {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0009, 0x000b}, {0x000a, 0x000b}, {0x000c, 0x0011}, {0x000d, 0x0016}, {0x000e, 0x001e}, {0x0010, 0x0057}, + {0x0011, 0x00a2}, {0x0011, 0x00a3}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, + {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, + {0x0013, 0x005e}, {0x0013, 0x005f}, {0x000b, 0x000d}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000b, 0x000e}, {0x000c, 0x0012}, {0x000d, 0x0017}, + {0x000e, 0x001f}, {0x0010, 0x0058}, {0x0012, 0x0139}, {0x0011, 0x00a4}, {0x0012, 0x013a}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, + {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, + {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x000c, 0x0013}, {0x000b, 0x000f}, {0x000c, 0x0014}, + {0x000c, 0x0015}, {0x000d, 0x0018}, {0x000e, 0x0020}, {0x000f, 0x0035}, {0x0012, 0x013b}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, + {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, + {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, + {0x000e, 0x0021}, {0x000d, 0x0019}, {0x000e, 0x0022}, {0x000e, 0x0023}, {0x000f, 0x0036}, {0x0010, 0x0059}, {0x0011, 0x00a5}, {0x0013, 0x0083}, + {0x0011, 0x00a6}, {0x0012, 0x013c}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, + {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, + {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0010, 0x005a}, {0x000f, 0x0037}, {0x000f, 0x0038}, {0x000f, 0x0039}, {0x0010, 0x005b}, + {0x0010, 0x005c}, {0x0013, 0x0095}, {0x0011, 0x00a7}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, + {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, + {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0010, 0x005d}, {0x0010, 0x005e}, + {0x0013, 0x00a9}, {0x0010, 0x005f}, {0x0013, 0x00aa}, {0x0012, 0x013d}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, + {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, + {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, + {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0011, 0x00a8}, {0x0013, 0x00c1}, {0x0011, 0x00a9}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, + {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, + {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, + {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0012, 0x013e}, {0x0013, 0x00db}, + {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, + {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, + {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, + {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, + {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, + {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, + {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, + {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, + {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, + {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, + {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, + {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, + {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, + {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, + {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, {0x0013, 0x0153}, + {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, {0x0013, 0x015b}, + {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, {0x0013, 0x0163}, + {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, {0x0013, 0x016b}, + {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, {0x0013, 0x0173}, + {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, {0x0013, 0x017b}, + {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, {0x0013, 0x0183}, + {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, {0x0013, 0x018b}, + {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, {0x0013, 0x0193}, + {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, {0x0013, 0x019b}, + {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, {0x0013, 0x01a3}, + {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, {0x0013, 0x01ab}, + {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, {0x0013, 0x01b3}, + {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, {0x0013, 0x01bb}, + {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, {0x0013, 0x01c3}, + {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, {0x0013, 0x01cb}, + {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, {0x0013, 0x01d3}, + {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, {0x0013, 0x01db}, + {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, {0x0013, 0x01e3}, + {0x0013, 0x01e4}, {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, + {0x0013, 0x01ec}, {0x0013, 0x01ed}, {0x0013, 0x01ee}, {0x0013, 0x01ef}, {0x0013, 0x01f0}, {0x0013, 0x01f1}, {0x0013, 0x01f2}, {0x0013, 0x01f3}, + {0x0013, 0x01f4}, {0x0013, 0x01f5}, {0x0013, 0x01f6}, {0x0013, 0x01f7}, {0x0013, 0x01f8}, {0x0013, 0x01f9}, {0x0013, 0x01fa}, {0x0013, 0x01fb}, + {0x0013, 0x01fc}, {0x0013, 0x01fd}, {0x0013, 0x01fe}, {0x0013, 0x01ff}, {0x0013, 0x0200}, {0x0013, 0x0201}, {0x0013, 0x0202}, {0x0013, 0x0203}, + {0x0013, 0x0204}, {0x0013, 0x0205}, {0x0013, 0x0206}, {0x0013, 0x0207}, {0x0013, 0x0208}, {0x0013, 0x0209}, {0x0013, 0x020a}, {0x0013, 0x020b}, + {0x0013, 0x020c}, {0x0013, 0x020d}, {0x0013, 0x020e}, {0x0013, 0x020f}, {0x0013, 0x0210}, {0x0013, 0x0211}, {0x0013, 0x0212}, {0x0013, 0x0213}, + {0x0013, 0x0214}, {0x0013, 0x0215}, {0x0013, 0x0216}, {0x0013, 0x0217}, {0x0013, 0x0218}, {0x0013, 0x0219}, {0x0013, 0x021a}, {0x0013, 0x021b}, + {0x0013, 0x021c}, {0x0013, 0x021d}, {0x0013, 0x021e}, {0x0013, 0x021f}, {0x0013, 0x0220}, {0x0013, 0x0221}, {0x0013, 0x0222}, {0x0013, 0x0223}, + {0x0013, 0x0224}, {0x0013, 0x0225}, {0x0013, 0x0226}, {0x0013, 0x0227}, {0x0013, 0x0228}, {0x0013, 0x0229}, {0x0013, 0x022a}, {0x0013, 0x022b}, + {0x0013, 0x022c}, {0x0013, 0x022d}, {0x0013, 0x022e}, {0x0013, 0x022f}, {0x0013, 0x0230}, {0x0013, 0x0231}, {0x0013, 0x0232}, {0x0013, 0x0233}, + {0x0013, 0x0234}, {0x0013, 0x0235}, {0x0013, 0x0236}, {0x0013, 0x0237}, {0x0013, 0x0238}, {0x0013, 0x0239}, {0x0013, 0x023a}, {0x0013, 0x023b}, + {0x0013, 0x023c}, {0x0013, 0x023d}, {0x0013, 0x023e}, {0x0013, 0x023f}, {0x0013, 0x0240}, {0x0013, 0x0241}, {0x0013, 0x0242}, {0x0013, 0x0243}, + {0x0013, 0x0244}, {0x0013, 0x0245}, {0x0013, 0x0246}, {0x0013, 0x0247}, {0x0013, 0x0248}, {0x0013, 0x0249}, {0x0013, 0x024a}, {0x0013, 0x024b}, + {0x0013, 0x024c}, {0x0013, 0x024d}, {0x0013, 0x024e}, {0x0013, 0x024f}, {0x0013, 0x0250}, {0x0013, 0x0251}, {0x0013, 0x0252}, {0x0013, 0x0253}, + {0x0013, 0x0254}, {0x0013, 0x0255}, {0x0013, 0x0256}, {0x0013, 0x0257}, {0x0013, 0x0258}, {0x0013, 0x0259}, {0x0013, 0x025a}, {0x0013, 0x025b}, + {0x0013, 0x025c}, {0x0013, 0x025d}, {0x0013, 0x025e}, {0x0013, 0x025f}, {0x0013, 0x0260}, {0x0013, 0x0261}, {0x0013, 0x0262}, {0x0013, 0x0263}, + {0x0013, 0x0264}, {0x0013, 0x0265}, {0x0013, 0x0266}, {0x0013, 0x0267}, {0x0013, 0x0268}, {0x0013, 0x0269}, {0x0013, 0x026a}, {0x0013, 0x026b}, + {0x0012, 0x013f}, + +}; + +const uint32_t c_aauiCQMFHuffDec48[110][16] = +{ + {0x0005ffff, 0x0003ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x00000037, 0x00010001, 0x00010001, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, + {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, + {0x0001003a, 0x0001003a, 0x00010054, 0x00010054, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, + {0x000bffff, 0x000affff, 0x0009ffff, 0x0008ffff, 0x0006ffff, 0x0007ffff, 0x00000004, 0x00000020, 0x0000003b, 0x00000055, 0x0000006c, 0x0000006f, 0x00000088, 0x00000089, 0x0001001f, 0x0001001f, }, + {0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, }, + {0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, }, + {0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, }, + {0x00000072, 0x0000008c, 0x000000a6, 0x000000bd, 0x000000bf, 0x000000c0, 0x00010006, 0x00010006, 0x00010057, 0x00010057, 0x000100a2, 0x000100a2, 0x000100a5, 0x000100a5, 0x000100be, 0x000100be, }, + {0x001dffff, 0x002effff, 0x003fffff, 0x0050ffff, 0x0019ffff, 0x0013ffff, 0x0012ffff, 0x0010ffff, 0x0011ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000007, 0x00000022, 0x0000003d, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, + {0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, }, + {0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, }, + {0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, }, + {0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200da, 0x000200da, 0x000200da, 0x000200da, 0x000200db, 0x000200db, 0x000200db, 0x000200db, }, + {0x00010008, 0x00010008, 0x00010024, 0x00010024, 0x0001003f, 0x0001003f, 0x0001005a, 0x0001005a, 0x00010074, 0x00010074, 0x000100c3, 0x000100c3, 0x000100dc, 0x000100dc, 0x000100f4, 0x000100f4, }, + {0x0015ffff, 0x0014ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x00000009, 0x00000075, 0x0000008f, 0x000000a9, 0x000000dd, 0x000000f3, 0x000000f7, 0x000000f8, 0x0000010e, 0x0000010f, 0x00000111, }, + {0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, }, + {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, }, + {0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, }, + {0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, }, + {0x0061ffff, 0x0062ffff, 0x0063ffff, 0x0064ffff, 0x0065ffff, 0x0066ffff, 0x0067ffff, 0x0068ffff, 0x0069ffff, 0x006affff, 0x006bffff, 0x006cffff, 0x006dffff, 0x001bffff, 0x001affff, 0x001cffff, }, + {0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c4, }, + {0x000102d4, 0x000102d4, 0x000102d5, 0x000102d5, 0x000102d6, 0x000102d6, 0x000102d7, 0x000102d7, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, }, + {0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x00020113, 0x00020113, 0x00020113, 0x00020113, 0x00020146, 0x00020146, 0x00020146, 0x00020146, 0x000202d8, 0x000202d8, 0x000202d8, 0x000202d8, }, + {0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0027ffff, 0x0025ffff, 0x0026ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, }, + {0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, }, + {0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, }, + {0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, }, + {0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, }, + {0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, }, + {0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, }, + {0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, }, + {0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, }, + {0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, }, + {0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, }, + {0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, }, + {0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, }, + {0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, }, + {0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, }, + {0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, }, + {0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, }, + {0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, }, + {0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100df, 0x000100df, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, }, + {0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, }, + {0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f9, 0x000100f9, 0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, }, + {0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, }, + {0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, }, + {0x0001010d, 0x0001010d, 0x00010110, 0x00010110, 0x00010112, 0x00010112, 0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, }, + {0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, + {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, + {0x00010129, 0x00010129, 0x0001012b, 0x0001012b, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010132, 0x00010132, }, + {0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, }, + {0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, }, + {0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010147, 0x00010147, 0x00010148, 0x00010148, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, }, + {0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, }, + {0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, }, + {0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, }, + {0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, }, + {0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, }, + {0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, }, + {0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, }, + {0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, }, + {0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, }, + {0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, }, + {0x00010194, 0x00010194, 0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, }, + {0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, }, + {0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, }, + {0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, }, + {0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, }, + {0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, }, + {0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, }, + {0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, }, + {0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, }, + {0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, }, + {0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, }, + {0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, }, + {0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, }, + {0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, }, + {0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, }, + {0x00010204, 0x00010204, 0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, }, + {0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, }, + {0x00010214, 0x00010214, 0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, }, + {0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, }, + {0x00010224, 0x00010224, 0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, }, + {0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, }, + {0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, }, + {0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, 0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, }, + {0x00010244, 0x00010244, 0x00010245, 0x00010245, 0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, 0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, }, + {0x0001024c, 0x0001024c, 0x0001024d, 0x0001024d, 0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, 0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, }, + {0x00010254, 0x00010254, 0x00010255, 0x00010255, 0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, 0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, }, + {0x0001025c, 0x0001025c, 0x0001025d, 0x0001025d, 0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, 0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, }, + {0x00010264, 0x00010264, 0x00010265, 0x00010265, 0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, 0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, }, + {0x0001026c, 0x0001026c, 0x0001026d, 0x0001026d, 0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00010270, 0x00010270, 0x00010271, 0x00010271, 0x00010272, 0x00010272, 0x00010273, 0x00010273, }, + {0x00010274, 0x00010274, 0x00010275, 0x00010275, 0x00010276, 0x00010276, 0x00010277, 0x00010277, 0x00010278, 0x00010278, 0x00010279, 0x00010279, 0x0001027a, 0x0001027a, 0x0001027b, 0x0001027b, }, + {0x0001027c, 0x0001027c, 0x0001027d, 0x0001027d, 0x0001027e, 0x0001027e, 0x0001027f, 0x0001027f, 0x00010280, 0x00010280, 0x00010281, 0x00010281, 0x00010282, 0x00010282, 0x00010283, 0x00010283, }, + {0x00010284, 0x00010284, 0x00010285, 0x00010285, 0x00010286, 0x00010286, 0x00010287, 0x00010287, 0x00010288, 0x00010288, 0x00010289, 0x00010289, 0x0001028a, 0x0001028a, 0x0001028b, 0x0001028b, }, + {0x0001028c, 0x0001028c, 0x0001028d, 0x0001028d, 0x0001028e, 0x0001028e, 0x0001028f, 0x0001028f, 0x00010290, 0x00010290, 0x00010291, 0x00010291, 0x00010292, 0x00010292, 0x00010293, 0x00010293, }, + {0x00010294, 0x00010294, 0x00010295, 0x00010295, 0x00010296, 0x00010296, 0x00010297, 0x00010297, 0x00010298, 0x00010298, 0x00010299, 0x00010299, 0x0001029a, 0x0001029a, 0x0001029b, 0x0001029b, }, + {0x0001029c, 0x0001029c, 0x0001029d, 0x0001029d, 0x0001029e, 0x0001029e, 0x0001029f, 0x0001029f, 0x000102a0, 0x000102a0, 0x000102a1, 0x000102a1, 0x000102a2, 0x000102a2, 0x000102a3, 0x000102a3, }, + {0x000102a4, 0x000102a4, 0x000102a5, 0x000102a5, 0x000102a6, 0x000102a6, 0x000102a7, 0x000102a7, 0x000102a8, 0x000102a8, 0x000102a9, 0x000102a9, 0x000102aa, 0x000102aa, 0x000102ab, 0x000102ab, }, + {0x000102ac, 0x000102ac, 0x000102ad, 0x000102ad, 0x000102ae, 0x000102ae, 0x000102af, 0x000102af, 0x000102b0, 0x000102b0, 0x000102b1, 0x000102b1, 0x000102b2, 0x000102b2, 0x000102b3, 0x000102b3, }, + {0x000102b4, 0x000102b4, 0x000102b5, 0x000102b5, 0x000102b6, 0x000102b6, 0x000102b7, 0x000102b7, 0x000102b8, 0x000102b8, 0x000102b9, 0x000102b9, 0x000102ba, 0x000102ba, 0x000102bb, 0x000102bb, }, + {0x000102bc, 0x000102bc, 0x000102bd, 0x000102bd, 0x000102be, 0x000102be, 0x000102bf, 0x000102bf, 0x000102c0, 0x000102c0, 0x000102c1, 0x000102c1, 0x000102c2, 0x000102c2, 0x000102c3, 0x000102c3, }, + {0x000102c4, 0x000102c4, 0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, }, + {0x000102cc, 0x000102cc, 0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, }, +}; + +const uint32_t c_aauiCQMFHuffEnc49[729][2] = +{ + {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0007}, {0x0007, 0x000a}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0009, 0x0009}, {0x000b, 0x000d}, + {0x000d, 0x0014}, {0x000d, 0x0015}, {0x0010, 0x0052}, {0x0011, 0x0098}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, + {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, + {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0005, 0x0008}, {0x0006, 0x000a}, {0x0007, 0x000b}, + {0x0008, 0x000b}, {0x0008, 0x000c}, {0x000a, 0x000a}, {0x000b, 0x000e}, {0x000d, 0x0016}, {0x000f, 0x0031}, {0x0010, 0x0053}, {0x0012, 0x012a}, + {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, + {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0005, 0x0009}, {0x0005, 0x000a}, + {0x0005, 0x000b}, {0x0006, 0x000b}, {0x0007, 0x000c}, {0x0008, 0x000d}, {0x0009, 0x000a}, {0x000a, 0x000b}, {0x000c, 0x000f}, {0x000d, 0x0017}, + {0x000f, 0x0032}, {0x0010, 0x0054}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, + {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, + {0x0013, 0x002b}, {0x0007, 0x000d}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x000e}, {0x0009, 0x000b}, + {0x000b, 0x000f}, {0x000c, 0x0010}, {0x000e, 0x001d}, {0x000f, 0x0033}, {0x0011, 0x0099}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, + {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, + {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0008, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, + {0x0008, 0x0010}, {0x0009, 0x000c}, {0x000a, 0x000c}, {0x000c, 0x0011}, {0x000d, 0x0018}, {0x000e, 0x001e}, {0x0011, 0x009a}, {0x0011, 0x009b}, + {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, + {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0008, 0x0011}, + {0x0007, 0x0013}, {0x0008, 0x0012}, {0x0008, 0x0013}, {0x0009, 0x000d}, {0x000a, 0x000d}, {0x000b, 0x0010}, {0x000c, 0x0012}, {0x000e, 0x001f}, + {0x000e, 0x0020}, {0x0010, 0x0055}, {0x0011, 0x009c}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, + {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, + {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x000a, 0x000e}, {0x000b, 0x0011}, + {0x000c, 0x0013}, {0x000d, 0x0019}, {0x000e, 0x0021}, {0x0010, 0x0056}, {0x0010, 0x0057}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, + {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, + {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x000b, 0x0012}, {0x000a, 0x000f}, {0x000a, 0x0010}, + {0x000a, 0x0011}, {0x000c, 0x0014}, {0x000c, 0x0015}, {0x000d, 0x001a}, {0x000e, 0x0022}, {0x0010, 0x0058}, {0x0010, 0x0059}, {0x0013, 0x0069}, + {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, + {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, + {0x000c, 0x0016}, {0x000b, 0x0013}, {0x000c, 0x0017}, {0x000c, 0x0018}, {0x000c, 0x0019}, {0x000e, 0x0023}, {0x000e, 0x0024}, {0x000f, 0x0034}, + {0x0010, 0x005a}, {0x0011, 0x009d}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, + {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, + {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x000e, 0x0025}, {0x000d, 0x001b}, {0x000d, 0x001c}, {0x000d, 0x001d}, {0x000e, 0x0026}, + {0x000f, 0x0035}, {0x0010, 0x005b}, {0x0011, 0x009e}, {0x0011, 0x009f}, {0x0012, 0x012b}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, + {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, + {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0010, 0x005c}, {0x000f, 0x0036}, + {0x000e, 0x0027}, {0x000f, 0x0037}, {0x000f, 0x0038}, {0x0010, 0x005d}, {0x0011, 0x00a0}, {0x0013, 0x009c}, {0x0012, 0x012c}, {0x0013, 0x009d}, + {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, + {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, + {0x0013, 0x00ae}, {0x0010, 0x005e}, {0x000f, 0x0039}, {0x0010, 0x005f}, {0x0010, 0x0060}, {0x0011, 0x00a1}, {0x0010, 0x0061}, {0x0013, 0x00af}, + {0x0013, 0x00b0}, {0x0012, 0x012d}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, + {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, + {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0012, 0x012e}, {0x0011, 0x00a2}, {0x0011, 0x00a3}, {0x0013, 0x00c3}, + {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, + {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, + {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, + {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0012, 0x012f}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, + {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, + {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, + {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, + {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, + {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, + {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, + {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, + {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, + {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, + {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, + {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, + {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, + {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, + {0x0013, 0x014b}, {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, + {0x0013, 0x0153}, {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, + {0x0013, 0x015b}, {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, + {0x0013, 0x0163}, {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, + {0x0013, 0x016b}, {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, + {0x0013, 0x0173}, {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, + {0x0013, 0x017b}, {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, + {0x0013, 0x0183}, {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, + {0x0013, 0x018b}, {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, + {0x0013, 0x0193}, {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, + {0x0013, 0x019b}, {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, + {0x0013, 0x01a3}, {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, + {0x0013, 0x01ab}, {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, + {0x0013, 0x01b3}, {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, + {0x0013, 0x01bb}, {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, + {0x0013, 0x01c3}, {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, + {0x0013, 0x01cb}, {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, + {0x0013, 0x01d3}, {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, + {0x0013, 0x01db}, {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, + {0x0013, 0x01e3}, {0x0013, 0x01e4}, {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, + {0x0013, 0x01eb}, {0x0013, 0x01ec}, {0x0013, 0x01ed}, {0x0013, 0x01ee}, {0x0013, 0x01ef}, {0x0013, 0x01f0}, {0x0013, 0x01f1}, {0x0013, 0x01f2}, + {0x0013, 0x01f3}, {0x0013, 0x01f4}, {0x0013, 0x01f5}, {0x0013, 0x01f6}, {0x0013, 0x01f7}, {0x0013, 0x01f8}, {0x0013, 0x01f9}, {0x0013, 0x01fa}, + {0x0013, 0x01fb}, {0x0013, 0x01fc}, {0x0013, 0x01fd}, {0x0013, 0x01fe}, {0x0013, 0x01ff}, {0x0013, 0x0200}, {0x0013, 0x0201}, {0x0013, 0x0202}, + {0x0013, 0x0203}, {0x0013, 0x0204}, {0x0013, 0x0205}, {0x0013, 0x0206}, {0x0013, 0x0207}, {0x0013, 0x0208}, {0x0013, 0x0209}, {0x0013, 0x020a}, + {0x0013, 0x020b}, {0x0013, 0x020c}, {0x0013, 0x020d}, {0x0013, 0x020e}, {0x0013, 0x020f}, {0x0013, 0x0210}, {0x0013, 0x0211}, {0x0013, 0x0212}, + {0x0013, 0x0213}, {0x0013, 0x0214}, {0x0013, 0x0215}, {0x0013, 0x0216}, {0x0013, 0x0217}, {0x0013, 0x0218}, {0x0013, 0x0219}, {0x0013, 0x021a}, + {0x0013, 0x021b}, {0x0013, 0x021c}, {0x0013, 0x021d}, {0x0013, 0x021e}, {0x0013, 0x021f}, {0x0013, 0x0220}, {0x0013, 0x0221}, {0x0013, 0x0222}, + {0x0013, 0x0223}, {0x0013, 0x0224}, {0x0013, 0x0225}, {0x0013, 0x0226}, {0x0013, 0x0227}, {0x0013, 0x0228}, {0x0013, 0x0229}, {0x0013, 0x022a}, + {0x0013, 0x022b}, {0x0013, 0x022c}, {0x0013, 0x022d}, {0x0013, 0x022e}, {0x0013, 0x022f}, {0x0013, 0x0230}, {0x0013, 0x0231}, {0x0013, 0x0232}, + {0x0013, 0x0233}, {0x0013, 0x0234}, {0x0013, 0x0235}, {0x0013, 0x0236}, {0x0013, 0x0237}, {0x0013, 0x0238}, {0x0013, 0x0239}, {0x0013, 0x023a}, + {0x0013, 0x023b}, {0x0013, 0x023c}, {0x0013, 0x023d}, {0x0013, 0x023e}, {0x0013, 0x023f}, {0x0013, 0x0240}, {0x0013, 0x0241}, {0x0013, 0x0242}, + {0x0013, 0x0243}, {0x0013, 0x0244}, {0x0013, 0x0245}, {0x0013, 0x0246}, {0x0013, 0x0247}, {0x0013, 0x0248}, {0x0013, 0x0249}, {0x0013, 0x024a}, + {0x0013, 0x024b}, {0x0013, 0x024c}, {0x0013, 0x024d}, {0x0013, 0x024e}, {0x0013, 0x024f}, {0x0013, 0x0250}, {0x0013, 0x0251}, {0x0013, 0x0252}, + {0x0013, 0x0253}, + +}; + +const uint32_t c_aauiCQMFHuffDec49[113][16] = +{ + {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00010001, 0x00010001, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, + {0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, + {0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010088, 0x00010088, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x00000070, 0x00000087, 0x00000089, 0x0000008a, 0x00010003, 0x00010003, 0x0001001f, 0x0001001f, 0x0001003a, 0x0001003a, 0x00010051, 0x00010051, 0x00010054, 0x00010054, 0x00010055, 0x00010055, }, + {0x000fffff, 0x000effff, 0x000cffff, 0x000dffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x00000004, 0x00000005, 0x00000020, 0x00000021, 0x0000003b, 0x00000056, 0x0000006c, }, + {0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, }, + {0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, }, + {0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, + {0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, }, + {0x0001008d, 0x0001008d, 0x000100a7, 0x000100a7, 0x000100bd, 0x000100bd, 0x000100d9, 0x000100d9, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, }, + {0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200be, 0x000200be, 0x000200be, 0x000200be, }, + {0x00000059, 0x00000073, 0x0000008e, 0x000000a8, 0x000000c1, 0x000000c2, 0x000000d8, 0x000000da, 0x000000db, 0x000000dc, 0x00010007, 0x00010007, 0x00010023, 0x00010023, 0x00010058, 0x00010058, }, + {0x0023ffff, 0x0034ffff, 0x0045ffff, 0x0056ffff, 0x001affff, 0x0019ffff, 0x0018ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0011ffff, 0x0010ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0000003e, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, + {0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, }, + {0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, }, + {0x00010112, 0x00010112, 0x0001012a, 0x0001012a, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, }, + {0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, }, + {0x000200de, 0x000200de, 0x000200de, 0x000200de, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f7, 0x000200f7, 0x000200f7, 0x000200f7, 0x00020110, 0x00020110, 0x00020110, 0x00020110, }, + {0x0000012c, 0x0000012e, 0x00010025, 0x00010025, 0x00010040, 0x00010040, 0x0001005b, 0x0001005b, 0x000100df, 0x000100df, 0x000100f8, 0x000100f8, 0x0001010f, 0x0001010f, 0x00010111, 0x00010111, }, + {0x001fffff, 0x0020ffff, 0x0000000a, 0x00000026, 0x00000041, 0x00000091, 0x000000ab, 0x000000ac, 0x000000c5, 0x000000c6, 0x000000e0, 0x000000f9, 0x0000010e, 0x00000113, 0x00000129, 0x0000012b, }, + {0x0067ffff, 0x0068ffff, 0x0069ffff, 0x006affff, 0x006bffff, 0x006cffff, 0x006dffff, 0x006effff, 0x006fffff, 0x0070ffff, 0x0021ffff, 0x0022ffff, 0x001cffff, 0x001bffff, 0x001dffff, 0x001effff, }, + {0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, }, + {0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, }, + {0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, }, + {0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, }, + {0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, }, + {0x000102d5, 0x000102d5, 0x000102d6, 0x000102d6, 0x000102d7, 0x000102d7, 0x000102d8, 0x000102d8, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fc, }, + {0x00020116, 0x00020116, 0x00020116, 0x00020116, 0x00020131, 0x00020131, 0x00020131, 0x00020131, 0x00020144, 0x00020144, 0x00020144, 0x00020144, 0x00020164, 0x00020164, 0x00020164, 0x00020164, }, + {0x0025ffff, 0x0026ffff, 0x0028ffff, 0x002affff, 0x002effff, 0x0029ffff, 0x0027ffff, 0x0033ffff, 0x002dffff, 0x0024ffff, 0x002bffff, 0x002cffff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, }, + {0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, }, + {0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, + {0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x00010028, 0x00010028, }, + {0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, }, + {0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, }, + {0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, }, + {0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, }, + {0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, }, + {0x000100a1, 0x000100a1, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, }, + {0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, }, + {0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, }, + {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, + {0x000100bc, 0x000100bc, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, }, + {0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, }, + {0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, }, + {0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, }, + {0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, }, + {0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, }, + {0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, }, + {0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, }, + {0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x00010115, 0x00010115, 0x00010117, 0x00010117, 0x00010118, 0x00010118, 0x00010119, 0x00010119, }, + {0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, 0x00010121, 0x00010121, }, + {0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, 0x0001012f, 0x0001012f, }, + {0x00010130, 0x00010130, 0x00010132, 0x00010132, 0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, }, + {0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, }, + {0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, 0x00010147, 0x00010147, 0x00010148, 0x00010148, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, }, + {0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, }, + {0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, }, + {0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, }, + {0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, }, + {0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, }, + {0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, }, + {0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, }, + {0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, }, + {0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, }, + {0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, 0x00010194, 0x00010194, }, + {0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, }, + {0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, }, + {0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, }, + {0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, }, + {0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, }, + {0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, }, + {0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, }, + {0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, }, + {0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, 0x000101dc, 0x000101dc, }, + {0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, }, + {0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, }, + {0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, }, + {0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, }, + {0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, 0x00010204, 0x00010204, }, + {0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, 0x0061ffff, 0x0062ffff, 0x0063ffff, 0x0064ffff, 0x0065ffff, 0x0066ffff, }, + {0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, }, + {0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, 0x00010214, 0x00010214, }, + {0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, }, + {0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, 0x00010224, 0x00010224, }, + {0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, }, + {0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, 0x00010234, 0x00010234, }, + {0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, }, + {0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, 0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, 0x00010244, 0x00010244, }, + {0x00010245, 0x00010245, 0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, 0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, 0x0001024c, 0x0001024c, }, + {0x0001024d, 0x0001024d, 0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, 0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, 0x00010254, 0x00010254, }, + {0x00010255, 0x00010255, 0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, 0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, 0x0001025c, 0x0001025c, }, + {0x0001025d, 0x0001025d, 0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, 0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, 0x00010264, 0x00010264, }, + {0x00010265, 0x00010265, 0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, 0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, 0x0001026c, 0x0001026c, }, + {0x0001026d, 0x0001026d, 0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00010270, 0x00010270, 0x00010271, 0x00010271, 0x00010272, 0x00010272, 0x00010273, 0x00010273, 0x00010274, 0x00010274, }, + {0x00010275, 0x00010275, 0x00010276, 0x00010276, 0x00010277, 0x00010277, 0x00010278, 0x00010278, 0x00010279, 0x00010279, 0x0001027a, 0x0001027a, 0x0001027b, 0x0001027b, 0x0001027c, 0x0001027c, }, + {0x0001027d, 0x0001027d, 0x0001027e, 0x0001027e, 0x0001027f, 0x0001027f, 0x00010280, 0x00010280, 0x00010281, 0x00010281, 0x00010282, 0x00010282, 0x00010283, 0x00010283, 0x00010284, 0x00010284, }, + {0x00010285, 0x00010285, 0x00010286, 0x00010286, 0x00010287, 0x00010287, 0x00010288, 0x00010288, 0x00010289, 0x00010289, 0x0001028a, 0x0001028a, 0x0001028b, 0x0001028b, 0x0001028c, 0x0001028c, }, + {0x0001028d, 0x0001028d, 0x0001028e, 0x0001028e, 0x0001028f, 0x0001028f, 0x00010290, 0x00010290, 0x00010291, 0x00010291, 0x00010292, 0x00010292, 0x00010293, 0x00010293, 0x00010294, 0x00010294, }, + {0x00010295, 0x00010295, 0x00010296, 0x00010296, 0x00010297, 0x00010297, 0x00010298, 0x00010298, 0x00010299, 0x00010299, 0x0001029a, 0x0001029a, 0x0001029b, 0x0001029b, 0x0001029c, 0x0001029c, }, + {0x0001029d, 0x0001029d, 0x0001029e, 0x0001029e, 0x0001029f, 0x0001029f, 0x000102a0, 0x000102a0, 0x000102a1, 0x000102a1, 0x000102a2, 0x000102a2, 0x000102a3, 0x000102a3, 0x000102a4, 0x000102a4, }, + {0x000102a5, 0x000102a5, 0x000102a6, 0x000102a6, 0x000102a7, 0x000102a7, 0x000102a8, 0x000102a8, 0x000102a9, 0x000102a9, 0x000102aa, 0x000102aa, 0x000102ab, 0x000102ab, 0x000102ac, 0x000102ac, }, + {0x000102ad, 0x000102ad, 0x000102ae, 0x000102ae, 0x000102af, 0x000102af, 0x000102b0, 0x000102b0, 0x000102b1, 0x000102b1, 0x000102b2, 0x000102b2, 0x000102b3, 0x000102b3, 0x000102b4, 0x000102b4, }, + {0x000102b5, 0x000102b5, 0x000102b6, 0x000102b6, 0x000102b7, 0x000102b7, 0x000102b8, 0x000102b8, 0x000102b9, 0x000102b9, 0x000102ba, 0x000102ba, 0x000102bb, 0x000102bb, 0x000102bc, 0x000102bc, }, + {0x000102bd, 0x000102bd, 0x000102be, 0x000102be, 0x000102bf, 0x000102bf, 0x000102c0, 0x000102c0, 0x000102c1, 0x000102c1, 0x000102c2, 0x000102c2, 0x000102c3, 0x000102c3, 0x000102c4, 0x000102c4, }, + {0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, 0x000102cc, 0x000102cc, }, + {0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, 0x000102d4, 0x000102d4, }, +}; + +const uint32_t c_aauiCQMFHuffEnc50[28][2] = +{ + {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, + {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, + {0x0011, 0x0003}, {0x0012, 0x0005}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, + {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, + +}; + +const uint32_t c_aauiCQMFHuffDec50[6][16] = +{ + {0x0001ffff, 0x00000004, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, + {0x0002ffff, 0x00000008, 0x00010007, 0x00010007, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x0003ffff, 0x0000000c, 0x0001000b, 0x0001000b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0005ffff, 0x0004ffff, 0x0001000f, 0x0001000f, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, + {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, }, +}; + +const uint32_t c_aauiCQMFHuffEnc51[29][2] = +{ + {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0001}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, + {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, + {0x000e, 0x0001}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, + {0x0013, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, + +}; + +const uint32_t c_aauiCQMFHuffDec51[6][16] = +{ + {0x0001ffff, 0x00000004, 0x00000005, 0x00000006, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x0002ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0004ffff, 0x0005ffff, 0x00000011, 0x00000012, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, + {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, +}; + +const uint32_t c_aauiCQMFHuffEnc52[32][2] = +{ + {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0005, 0x0002}, + {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, + {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0014, 0x0000}, + {0x0013, 0x0003}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0004}, {0x0013, 0x0005}, +}; + +const uint32_t c_aauiCQMFHuffDec52[7][16] = +{ + {0x0001ffff, 0x0002ffff, 0x00000004, 0x00000005, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x0003ffff, 0x0000000b, 0x0001000a, 0x0001000a, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x0004ffff, 0x0000000f, 0x0001000e, 0x0001000e, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0006ffff, 0x0005ffff, 0x00010013, 0x00010013, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00000017, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x00010018, 0x00010018, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, +}; + +const uint32_t c_aauiCQMFHuffEnc53[37][2] = +{ + {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0002}, {0x0005, 0x0003}, + {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000b, 0x0002}, + {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0002}, + {0x000f, 0x0003}, {0x0011, 0x0004}, {0x0010, 0x0003}, {0x0011, 0x0005}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0001}, {0x0012, 0x0002}, + {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, + +}; + +const uint32_t c_aauiCQMFHuffDec53[9][16] = +{ + {0x0002ffff, 0x0001ffff, 0x00000004, 0x00000005, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x0003ffff, 0x0000000d, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, + {0x0005ffff, 0x0004ffff, 0x00000011, 0x00000012, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x0007ffff, 0x0008ffff, 0x0006ffff, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, + {0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, +}; + +const uint32_t c_aauiCQMFHuffEnc54[39][2] = +{ + {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, + {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0008, 0x0002}, + {0x0008, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, + {0x000d, 0x0003}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0002}, {0x000f, 0x0003}, {0x0011, 0x0002}, {0x0010, 0x0002}, {0x0010, 0x0003}, + {0x0011, 0x0003}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, + +}; + +const uint32_t c_aauiCQMFHuffDec54[9][16] = +{ + {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000004, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x0004ffff, 0x0000000e, 0x0000000f, 0x00000010, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, + {0x0006ffff, 0x0005ffff, 0x00000015, 0x00000016, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, + {0x0008ffff, 0x0007ffff, 0x0000001e, 0x0000001f, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, + {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, +}; + +const uint32_t c_aauiCQMFHuffEnc55[46][2] = +{ + {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, + {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0007, 0x0004}, + {0x0007, 0x0005}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, + {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0003}, + {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, + {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, + +}; + +const uint32_t c_aauiCQMFHuffDec55[10][16] = +{ + {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0005ffff, 0x0004ffff, 0x00000011, 0x00000012, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, + {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, + {0x0007ffff, 0x0006ffff, 0x00000019, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0009ffff, 0x0008ffff, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x0001001f, 0x0001001f, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, + {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, +}; + +const uint32_t c_aauiCQMFHuffEnc56[55][2] = +{ + {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0005, 0x0004}, + {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0003}, {0x0007, 0x0004}, + {0x0007, 0x0005}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, + {0x000a, 0x0003}, {0x000b, 0x0003}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, + {0x000e, 0x0003}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, + {0x0010, 0x0005}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0013, 0x0000}, {0x0011, 0x0003}, {0x0012, 0x0005}, {0x0013, 0x0001}, {0x0013, 0x0002}, + {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, + +}; + +const uint32_t c_aauiCQMFHuffDec56[12][16] = +{ + {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000004, 0x00000005, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0006ffff, 0x0005ffff, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, + {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x0000001a, 0x0000001b, 0x0000001c, 0x00010019, 0x00010019, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, }, + {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, + {0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, + {0x000bffff, 0x000affff, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, + {0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, }, +}; + +const uint32_t c_aauiCQMFHuffEnc57[65][2] = +{ + {0x0003, 0x0004}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0004}, + {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, + {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, + {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, + {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000d, 0x0003}, {0x000c, 0x0005}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000e, 0x0003}, {0x000e, 0x0004}, + {0x000e, 0x0005}, {0x000f, 0x0003}, {0x0010, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0013, 0x0000}, + {0x0011, 0x0005}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0012, 0x0007}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0012, 0x0008}, {0x0012, 0x0009}, + {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, + {0x0013, 0x000d}, + +}; + +const uint32_t c_aauiCQMFHuffDec57[14][16] = +{ + {0x0004ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, + {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x00000014, 0x00000015, 0x00000016, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, + {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, + {0x000affff, 0x0008ffff, 0x0009ffff, 0x00000020, 0x00000021, 0x00000023, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, + {0x000dffff, 0x000cffff, 0x000bffff, 0x0000002a, 0x0000002d, 0x0000002e, 0x00010029, 0x00010029, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, + {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, + {0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, + {0x0001002f, 0x0001002f, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, +}; + +const uint32_t c_aauiCQMFHuffEnc58[77][2] = +{ + {0x0004, 0x0005}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, + {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, + {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0003}, + {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, + {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, + {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, + {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, {0x0010, 0x0004}, {0x000f, 0x0007}, {0x0010, 0x0005}, {0x0010, 0x0006}, {0x0010, 0x0007}, + {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0006}, {0x0011, 0x0007}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, + {0x0012, 0x0007}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0012, 0x0008}, + {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, + +}; + +const uint32_t c_aauiCQMFHuffDec58[17][16] = +{ + {0x0005ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, }, + {0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, + {0x0008ffff, 0x0006ffff, 0x0007ffff, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, }, + {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, + {0x000cffff, 0x000bffff, 0x0009ffff, 0x000affff, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, + {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, }, + {0x0010ffff, 0x000effff, 0x000fffff, 0x000dffff, 0x00000033, 0x00000035, 0x00000036, 0x00000037, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010034, 0x00010034, }, + {0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, + {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, + {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, +}; + +const uint32_t c_aauiCQMFHuffEnc59[91][2] = +{ + {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0006}, + {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, + {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, + {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, + {0x0008, 0x0009}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0004}, + {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0003}, + {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0003}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000f, 0x0003}, + {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0013, 0x0000}, {0x0011, 0x000a}, {0x0013, 0x0001}, {0x0013, 0x0002}, + {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0011, 0x000b}, {0x0013, 0x0006}, {0x0013, 0x0007}, + {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, + {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, + {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0012, 0x000f}, + +}; + +const uint32_t c_aauiCQMFHuffDec59[20][16] = +{ + {0x0006ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, + {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x0009ffff, 0x0008ffff, 0x0007ffff, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, + {0x000dffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, }, + {0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0010ffff, 0x000effff, 0x000fffff, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x00020034, 0x00020034, 0x00020034, 0x00020034, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, + {0x0001003c, 0x0001003c, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010046, 0x00010046, 0x00010047, 0x00010047, }, + {0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, }, + {0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, }, +}; + +const uint32_t c_aauiCQMFHuffEnc60[109][2] = +{ + {0x0004, 0x0007}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, + {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, + {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, + {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, + {0x0008, 0x000b}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, + {0x0009, 0x000b}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, + {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000c, 0x0007}, + {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000f, 0x0005}, {0x000e, 0x0009}, {0x000f, 0x0006}, {0x0010, 0x0006}, + {0x000f, 0x0007}, {0x000f, 0x0008}, {0x000f, 0x0009}, {0x0010, 0x0007}, {0x0010, 0x0008}, {0x0010, 0x0009}, {0x0011, 0x000a}, {0x0013, 0x0000}, + {0x0011, 0x000b}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, + {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, + {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, + {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0012, 0x0013}, + +}; + +const uint32_t c_aauiCQMFHuffDec60[24][16] = +{ + {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00010002, 0x00010002, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, + {0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, + {0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, + {0x000dffff, 0x000cffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00010013, 0x00010013, 0x00010014, 0x00010014, }, + {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, + {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, + {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, + {0x0011ffff, 0x0010ffff, 0x000fffff, 0x000effff, 0x00000031, 0x00000032, 0x00000033, 0x00000037, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, }, + {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, + {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, + {0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, }, + {0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0013ffff, 0x0012ffff, 0x0000003f, 0x00000043, 0x00000044, 0x00000045, 0x0001003c, 0x0001003c, 0x0001003e, 0x0001003e, 0x00010040, 0x00010040, }, + {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, + {0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, + {0x00010047, 0x00010047, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, }, + {0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, }, + {0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, }, + {0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, }, +}; + +const uint32_t c_aauiCQMFHuffEnc61[129][2] = +{ + {0x0004, 0x0008}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0008}, {0x0005, 0x0009}, + {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0006, 0x0008}, {0x0006, 0x0009}, + {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0007, 0x0008}, {0x0007, 0x0009}, + {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x0006}, {0x0008, 0x0007}, + {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, {0x0008, 0x000f}, + {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x000a, 0x0005}, {0x000a, 0x0006}, + {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, + {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0005}, {0x000d, 0x0006}, + {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000e, 0x0008}, {0x000d, 0x000b}, {0x000e, 0x0009}, {0x000f, 0x0009}, + {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000f, 0x000c}, {0x000f, 0x000d}, {0x000f, 0x000e}, {0x0010, 0x000c}, {0x0011, 0x0015}, {0x0010, 0x000d}, + {0x000f, 0x000f}, {0x0010, 0x000e}, {0x0010, 0x000f}, {0x0012, 0x0000}, {0x0011, 0x0016}, {0x0010, 0x0010}, {0x0010, 0x0011}, {0x0011, 0x0017}, + {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, + {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, + {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0012, 0x0017}, {0x0012, 0x0018}, + {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, {0x0012, 0x0020}, + {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, {0x0012, 0x0028}, + {0x0012, 0x0029}, + +}; + +const uint32_t c_aauiCQMFHuffDec61[33][16] = +{ + {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, + {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, + {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, + {0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, }, + {0x000effff, 0x000cffff, 0x000dffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, }, + {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, + {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, + {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, }, + {0x0014ffff, 0x0013ffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0000003a, 0x0000003b, 0x0000003c, 0x0000003d, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, }, + {0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, + {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, + {0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, + {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, + {0x00000055, 0x00000056, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x00010050, 0x00010050, }, + {0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0016ffff, 0x0015ffff, 0x0000004d, 0x0000004f, 0x00000051, 0x00000052, }, + {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, }, + {0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, + {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, + {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, + {0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, }, + {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, + {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, }, + {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, }, + {0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020072, 0x00020072, 0x00020072, 0x00020072, }, + {0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, }, + {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, + {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, }, +}; + +const uint32_t c_aauiCQMFHuffEnc62[153][2] = +{ + {0x0004, 0x0009}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, + {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, + {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0007, 0x0009}, + {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, + {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, + {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, + {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x000a, 0x0004}, {0x000a, 0x0005}, + {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, + {0x000b, 0x0007}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000d, 0x0007}, + {0x000c, 0x000d}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000e, 0x0008}, {0x000d, 0x000c}, {0x000d, 0x000d}, + {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000e, 0x000b}, {0x000e, 0x000c}, {0x000f, 0x000c}, {0x000e, 0x000d}, {0x000f, 0x000d}, {0x000f, 0x000e}, + {0x000f, 0x000f}, {0x0010, 0x000f}, {0x0010, 0x0010}, {0x0011, 0x0019}, {0x0010, 0x0011}, {0x0010, 0x0012}, {0x0010, 0x0013}, {0x0010, 0x0014}, + {0x0010, 0x0015}, {0x0012, 0x0000}, {0x0010, 0x0016}, {0x0011, 0x001a}, {0x0010, 0x0017}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, + {0x0011, 0x001b}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, + {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0012, 0x0011}, {0x0012, 0x0012}, + {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0012, 0x0017}, {0x0012, 0x0018}, {0x0011, 0x001c}, {0x0012, 0x0019}, + {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, {0x0012, 0x0020}, {0x0012, 0x0021}, + {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, {0x0012, 0x0028}, {0x0012, 0x0029}, + {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0012, 0x002c}, {0x0012, 0x002d}, {0x0012, 0x002e}, {0x0012, 0x002f}, {0x0012, 0x0030}, {0x0012, 0x0031}, + {0x0011, 0x001d}, + +}; + +const uint32_t c_aauiCQMFHuffDec62[41][16] = +{ + {0x0009ffff, 0x0008ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, + {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, + {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, + {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, + {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, + {0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, + {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, + {0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, + {0x00000029, 0x0000002a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, }, + {0x0012ffff, 0x0010ffff, 0x0011ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, }, + {0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, + {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, + {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, + {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, + {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, + {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, + {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, }, + {0x0019ffff, 0x0018ffff, 0x0017ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000048, 0x00010040, 0x00010040, }, + {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, + {0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, }, + {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, + {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, + {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, + {0x0000005a, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000062, 0x00000064, 0x00010054, 0x00010054, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, }, + {0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x00000059, }, + {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, }, + {0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, + {0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, }, + {0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, }, + {0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, + {0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, }, + {0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, }, + {0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, + {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, }, + {0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, + {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, 0x00020085, 0x00020085, 0x00020085, 0x00020085, }, + {0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, }, + {0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, }, + {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, + {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, +}; + +const uint32_t c_aauiCQMFHuffEnc63[181][2] = +{ + {0x0004, 0x0008}, {0x0003, 0x0005}, {0x0002, 0x0003}, {0x0004, 0x0009}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, + {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, + {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, + {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0007, 0x0015}, {0x0007, 0x0016}, + {0x0007, 0x0017}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0008, 0x0012}, + {0x0008, 0x0013}, {0x0008, 0x0014}, {0x0008, 0x0015}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, + {0x0009, 0x000d}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x0009, 0x0012}, {0x0009, 0x0013}, {0x0009, 0x0014}, + {0x0009, 0x0015}, {0x000a, 0x0007}, {0x0009, 0x0016}, {0x0009, 0x0017}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, + {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000a, 0x000e}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000a, 0x000f}, {0x000b, 0x000b}, + {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000c, 0x000d}, {0x000c, 0x000e}, + {0x000c, 0x000f}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, + {0x000d, 0x000f}, {0x000d, 0x0010}, {0x000d, 0x0011}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000e, 0x000b}, + {0x000e, 0x000c}, {0x000e, 0x000d}, {0x000e, 0x000e}, {0x000e, 0x000f}, {0x000f, 0x0008}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, + {0x000f, 0x000c}, {0x0010, 0x0009}, {0x0010, 0x000a}, {0x000f, 0x000d}, {0x0010, 0x000b}, {0x0010, 0x000c}, {0x0010, 0x000d}, {0x0011, 0x000e}, + {0x0011, 0x000f}, {0x0010, 0x000e}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0012, 0x0014}, {0x0014, 0x0000}, {0x0010, 0x000f}, {0x0012, 0x0015}, + {0x0012, 0x0016}, {0x0014, 0x0001}, {0x0012, 0x0017}, {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0013, 0x0010}, {0x0012, 0x001a}, {0x0014, 0x0002}, + {0x0012, 0x001b}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0011}, {0x0014, 0x0006}, {0x0013, 0x0012}, {0x0014, 0x0007}, + {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0013, 0x0013}, + {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, + {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0014, 0x001e}, + {0x0014, 0x001f}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, + {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, + {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, + +}; + +const uint32_t c_aauiCQMFHuffDec63[39][16] = +{ + {0x0008ffff, 0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x00000000, 0x00000003, 0x00010001, 0x00010001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, + {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, + {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, + {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, + {0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, + {0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, }, + {0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, }, + {0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x00000021, 0x00000022, 0x00000023, 0x00000024, }, + {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, + {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, + {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, + {0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, + {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, + {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, + {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, + {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, + {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, + {0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, }, + {0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020046, 0x00020046, 0x00020046, 0x00020046, }, + {0x001dffff, 0x001affff, 0x001bffff, 0x001cffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, }, + {0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, + {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, + {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, + {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, + {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, + {0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x0001006b, 0x0001006b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, }, + {0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, }, + {0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, }, + {0x0026ffff, 0x0025ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0020ffff, 0x0021ffff, 0x001effff, 0x001fffff, 0x00000069, 0x0000006a, 0x0000006c, 0x0000006d, 0x0000006e, 0x00000071, 0x00000076, }, + {0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, }, + {0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, + {0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, + {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, + {0x0001007d, 0x0001007d, 0x00010084, 0x00010084, 0x00010086, 0x00010086, 0x0001008f, 0x0001008f, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, }, + {0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, }, + {0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, }, + {0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, }, + {0x00000075, 0x00000079, 0x0000007f, 0x00000081, 0x00000082, 0x00000083, 0x00000085, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x00000090, }, +}; + +const uint32_t (*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = { + NULL, + c_aauiCQMFHuffEnc1, + c_aauiCQMFHuffEnc2, + c_aauiCQMFHuffEnc3, + c_aauiCQMFHuffEnc4, + c_aauiCQMFHuffEnc5, + c_aauiCQMFHuffEnc6, + c_aauiCQMFHuffEnc7, + c_aauiCQMFHuffEnc8, + c_aauiCQMFHuffEnc9, + c_aauiCQMFHuffEnc10, + c_aauiCQMFHuffEnc11, + c_aauiCQMFHuffEnc12, + c_aauiCQMFHuffEnc13, + c_aauiCQMFHuffEnc14, + c_aauiCQMFHuffEnc15, + c_aauiCQMFHuffEnc16, + c_aauiCQMFHuffEnc17, + c_aauiCQMFHuffEnc18, + c_aauiCQMFHuffEnc19, + c_aauiCQMFHuffEnc20, + c_aauiCQMFHuffEnc21, + c_aauiCQMFHuffEnc22, + c_aauiCQMFHuffEnc23, + c_aauiCQMFHuffEnc24, + c_aauiCQMFHuffEnc25, + c_aauiCQMFHuffEnc26, + c_aauiCQMFHuffEnc27, + c_aauiCQMFHuffEnc28, + c_aauiCQMFHuffEnc29, + c_aauiCQMFHuffEnc30, + c_aauiCQMFHuffEnc31, + NULL, + c_aauiCQMFHuffEnc33, + c_aauiCQMFHuffEnc34, + c_aauiCQMFHuffEnc35, + c_aauiCQMFHuffEnc36, + c_aauiCQMFHuffEnc37, + c_aauiCQMFHuffEnc38, + c_aauiCQMFHuffEnc39, + c_aauiCQMFHuffEnc40, + c_aauiCQMFHuffEnc41, + c_aauiCQMFHuffEnc42, + c_aauiCQMFHuffEnc43, + c_aauiCQMFHuffEnc44, + c_aauiCQMFHuffEnc45, + c_aauiCQMFHuffEnc46, + c_aauiCQMFHuffEnc47, + c_aauiCQMFHuffEnc48, + c_aauiCQMFHuffEnc49, + c_aauiCQMFHuffEnc50, + c_aauiCQMFHuffEnc51, + c_aauiCQMFHuffEnc52, + c_aauiCQMFHuffEnc53, + c_aauiCQMFHuffEnc54, + c_aauiCQMFHuffEnc55, + c_aauiCQMFHuffEnc56, + c_aauiCQMFHuffEnc57, + c_aauiCQMFHuffEnc58, + c_aauiCQMFHuffEnc59, + c_aauiCQMFHuffEnc60, + c_aauiCQMFHuffEnc61, + c_aauiCQMFHuffEnc62, + c_aauiCQMFHuffEnc63, +}; + +const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE] = { + NULL, + c_aauiCQMFHuffDec1, + c_aauiCQMFHuffDec2, + c_aauiCQMFHuffDec3, + c_aauiCQMFHuffDec4, + c_aauiCQMFHuffDec5, + c_aauiCQMFHuffDec6, + c_aauiCQMFHuffDec7, + c_aauiCQMFHuffDec8, + c_aauiCQMFHuffDec9, + c_aauiCQMFHuffDec10, + c_aauiCQMFHuffDec11, + c_aauiCQMFHuffDec12, + c_aauiCQMFHuffDec13, + c_aauiCQMFHuffDec14, + c_aauiCQMFHuffDec15, + c_aauiCQMFHuffDec16, + c_aauiCQMFHuffDec17, + c_aauiCQMFHuffDec18, + c_aauiCQMFHuffDec19, + c_aauiCQMFHuffDec20, + c_aauiCQMFHuffDec21, + c_aauiCQMFHuffDec22, + c_aauiCQMFHuffDec23, + c_aauiCQMFHuffDec24, + c_aauiCQMFHuffDec25, + c_aauiCQMFHuffDec26, + c_aauiCQMFHuffDec27, + c_aauiCQMFHuffDec28, + c_aauiCQMFHuffDec29, + c_aauiCQMFHuffDec30, + c_aauiCQMFHuffDec31, + NULL, + c_aauiCQMFHuffDec33, + c_aauiCQMFHuffDec34, + c_aauiCQMFHuffDec35, + c_aauiCQMFHuffDec36, + c_aauiCQMFHuffDec37, + c_aauiCQMFHuffDec38, + c_aauiCQMFHuffDec39, + c_aauiCQMFHuffDec40, + c_aauiCQMFHuffDec41, + c_aauiCQMFHuffDec42, + c_aauiCQMFHuffDec43, + c_aauiCQMFHuffDec44, + c_aauiCQMFHuffDec45, + c_aauiCQMFHuffDec46, + c_aauiCQMFHuffDec47, + c_aauiCQMFHuffDec48, + c_aauiCQMFHuffDec49, + c_aauiCQMFHuffDec50, + c_aauiCQMFHuffDec51, + c_aauiCQMFHuffDec52, + c_aauiCQMFHuffDec53, + c_aauiCQMFHuffDec54, + c_aauiCQMFHuffDec55, + c_aauiCQMFHuffDec56, + c_aauiCQMFHuffDec57, + c_aauiCQMFHuffDec58, + c_aauiCQMFHuffDec59, + c_aauiCQMFHuffDec60, + c_aauiCQMFHuffDec61, + c_aauiCQMFHuffDec62, + c_aauiCQMFHuffDec63, +}; + +#ifdef USE_DEMOD_TABLES +const int32_t c_aaiHuffDemod1[16][2] = { + 0,0,0,1,0,2,0,3,1,0,1,1,1,2,1,3,2,0,2,1,2,2,2,3,3,0,3,1,3,2,3,3, +}; + +const int32_t c_aaiHuffDemod2[16][2] = { + 0,0,0,1,0,2,0,3,1,0,1,1,1,2,1,3,2,0,2,1,2,2,2,3,3,0,3,1,3,2,3,3, +}; + +const int32_t c_aaiHuffDemod3[25][2] = { + 0,0,0,1,0,2,0,3,0,4,1,0,1,1,1,2,1,3,1,4,2,0,2,1,2,2,2,3,2,4,3,0, + 3,1,3,2,3,3,3,4,4,0,4,1,4,2,4,3,4,4, +}; + +const int32_t c_aaiHuffDemod4[36][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,1,0,1,1,1,2,1,3,1,4,1,5,2,0,2,1,2,2,2,3, + 2,4,2,5,3,0,3,1,3,2,3,3,3,4,3,5,4,0,4,1,4,2,4,3,4,4,4,5,5,0,5,1, + 5,2,5,3,5,4,5,5, +}; + +const int32_t c_aaiHuffDemod5[36][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,1,0,1,1,1,2,1,3,1,4,1,5,2,0,2,1,2,2,2,3, + 2,4,2,5,3,0,3,1,3,2,3,3,3,4,3,5,4,0,4,1,4,2,4,3,4,4,4,5,5,0,5,1, + 5,2,5,3,5,4,5,5, +}; + +const int32_t c_aaiHuffDemod6[49][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,1,0,1,1,1,2,1,3,1,4,1,5,1,6,2,0,2,1, + 2,2,2,3,2,4,2,5,2,6,3,0,3,1,3,2,3,3,3,4,3,5,3,6,4,0,4,1,4,2,4,3, + 4,4,4,5,4,6,5,0,5,1,5,2,5,3,5,4,5,5,5,6,6,0,6,1,6,2,6,3,6,4,6,5, + 6,6, +}; + +const int32_t c_aaiHuffDemod7[64][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7, + 2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7, + 4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7, + 6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7, +}; + +const int32_t c_aaiHuffDemod8[81][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,1,0,1,1,1,2,1,3,1,4,1,5,1,6, + 1,7,1,8,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,3,0,3,1,3,2,3,3,3,4, + 3,5,3,6,3,7,3,8,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,5,0,5,1,5,2, + 5,3,5,4,5,5,5,6,5,7,5,8,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,7,0, + 7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, + 8,8, +}; + +const int32_t c_aaiHuffDemod9[100][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,1,0,1,1,1,2,1,3,1,4,1,5, + 1,6,1,7,1,8,1,9,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,3,0,3,1, + 3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7, + 4,8,4,9,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,6,0,6,1,6,2,6,3, + 6,4,6,5,6,6,6,7,6,8,6,9,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8,7,9, + 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,9,0,9,1,9,2,9,3,9,4,9,5, + 9,6,9,7,9,8,9,9, +}; + +const int32_t c_aaiHuffDemod10[169][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,1,0,1,1,1,2, + 1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,2,0,2,1,2,2,2,3,2,4,2,5, + 2,6,2,7,2,8,2,9,2,10,2,11,2,12,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8, + 3,9,3,10,3,11,3,12,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11, + 4,12,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10,5,11,5,12,6,0,6,1, + 6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,7,0,7,1,7,2,7,3,7,4, + 7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, + 8,8,8,9,8,10,8,11,8,12,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10, + 9,11,9,12,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,11,0, + 11,1,11,2,11,3,11,4,11,5,11,6,11,7,11,8,11,9,11,10,11,11,11,12,12,0,12,1,12,2,12,3, + 12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12, +}; + +const int32_t c_aaiHuffDemod11[196][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,1,0,1,1, + 1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,2,0,2,1,2,2,2,3, + 2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13,3,0,3,1,3,2,3,3,3,4,3,5, + 3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7, + 4,8,4,9,4,10,4,11,4,12,4,13,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9, + 5,10,5,11,5,12,5,13,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11, + 6,12,6,13,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13, + 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,9,0,9,1, + 9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12,9,13,10,0,10,1,10,2,10,3, + 10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,11,0,11,1,11,2,11,3,11,4,11,5, + 11,6,11,7,11,8,11,9,11,10,11,11,11,12,11,13,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7, + 12,8,12,9,12,10,12,11,12,12,12,13,13,0,13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9, + 13,10,13,11,13,12,13,13, +}; + +const int32_t c_aaiHuffDemod12[289][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, + 0,16,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14, + 1,15,1,16,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13, + 2,14,2,15,2,16,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12, + 3,13,3,14,3,15,3,16,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11, + 4,12,4,13,4,14,4,15,4,16,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10, + 5,11,5,12,5,13,5,14,5,15,5,16,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9, + 6,10,6,11,6,12,6,13,6,14,6,15,6,16,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8, + 7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, + 8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15,8,16,9,0,9,1,9,2,9,3,9,4,9,5,9,6, + 9,7,9,8,9,9,9,10,9,11,9,12,9,13,9,14,9,15,9,16,10,0,10,1,10,2,10,3,10,4,10,5, + 10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,11,0,11,1,11,2,11,3,11,4, + 11,5,11,6,11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,12,0,12,1,12,2,12,3, + 12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12,16,13,0,13,1,13,2, + 13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16,14,0,14,1, + 14,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,15,0, + 15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,16, +}; + +const int32_t c_aaiHuffDemod13[324][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, + 0,16,0,17,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13, + 1,14,1,15,1,16,1,17,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11, + 2,12,2,13,2,14,2,15,2,16,2,17,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9, + 3,10,3,11,3,12,3,13,3,14,3,15,3,16,3,17,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7, + 4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15,4,16,4,17,5,0,5,1,5,2,5,3,5,4,5,5, + 5,6,5,7,5,8,5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,6,0,6,1,6,2,6,3, + 6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13,6,14,6,15,6,16,6,17,7,0,7,1, + 7,2,7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17, + 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15, + 8,16,8,17,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12,9,13, + 9,14,9,15,9,16,9,17,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11, + 10,12,10,13,10,14,10,15,10,16,10,17,11,0,11,1,11,2,11,3,11,4,11,5,11,6,11,7,11,8,11,9, + 11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7, + 12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12,16,12,17,13,0,13,1,13,2,13,3,13,4,13,5, + 13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16,13,17,14,0,14,1,14,2,14,3, + 14,4,14,5,14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,15,0,15,1, + 15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16,15,17, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,16,16,17,17,0,17,1,17,2,17,3,17,4,17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13, + 17,14,17,15,17,16,17,17, +}; + +const int32_t c_aaiHuffDemod14[400][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, + 0,16,0,17,0,18,0,19,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11, + 1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7, + 2,8,2,9,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2,19,3,0,3,1,3,2,3,3, + 3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,3,14,3,15,3,16,3,17,3,18,3,19, + 4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15, + 4,16,4,17,4,18,4,19,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10,5,11, + 5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7, + 6,8,6,9,6,10,6,11,6,12,6,13,6,14,6,15,6,16,6,17,6,18,6,19,7,0,7,1,7,2,7,3, + 7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18,7,19, + 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15, + 8,16,8,17,8,18,8,19,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11, + 9,12,9,13,9,14,9,15,9,16,9,17,9,18,9,19,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7, + 10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17,10,18,10,19,11,0,11,1,11,2,11,3, + 11,4,11,5,11,6,11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19, + 12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15, + 12,16,12,17,12,18,12,19,13,0,13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11, + 13,12,13,13,13,14,13,15,13,16,13,17,13,18,13,19,14,0,14,1,14,2,14,3,14,4,14,5,14,6,14,7, + 14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,15,0,15,1,15,2,15,3, + 15,4,15,5,15,6,15,7,15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,16,16,17,16,18,16,19,17,0,17,1,17,2,17,3,17,4,17,5,17,6,17,7,17,8,17,9,17,10,17,11, + 17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7, + 18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,18,18,18,19,19,0,19,1,19,2,19,3, + 19,4,19,5,19,6,19,7,19,8,19,9,19,10,19,11,19,12,19,13,19,14,19,15,19,16,19,17,19,18,19,19, +}; + +const int32_t c_aaiHuffDemod15[576][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, + 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7, + 1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23, + 2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13,2,14,2,15, + 2,16,2,17,2,18,2,19,2,20,2,21,2,22,2,23,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7, + 3,8,3,9,3,10,3,11,3,12,3,13,3,14,3,15,3,16,3,17,3,18,3,19,3,20,3,21,3,22,3,23, + 4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15, + 4,16,4,17,4,18,4,19,4,20,4,21,4,22,4,23,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7, + 5,8,5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,5,20,5,21,5,22,5,23, + 6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13,6,14,6,15, + 6,16,6,17,6,18,6,19,6,20,6,21,6,22,6,23,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7, + 7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18,7,19,7,20,7,21,7,22,7,23, + 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15, + 8,16,8,17,8,18,8,19,8,20,8,21,8,22,8,23,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7, + 9,8,9,9,9,10,9,11,9,12,9,13,9,14,9,15,9,16,9,17,9,18,9,19,9,20,9,21,9,22,9,23, + 10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15, + 10,16,10,17,10,18,10,19,10,20,10,21,10,22,10,23,11,0,11,1,11,2,11,3,11,4,11,5,11,6,11,7, + 11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19,11,20,11,21,11,22,11,23, + 12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15, + 12,16,12,17,12,18,12,19,12,20,12,21,12,22,12,23,13,0,13,1,13,2,13,3,13,4,13,5,13,6,13,7, + 13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16,13,17,13,18,13,19,13,20,13,21,13,22,13,23, + 14,0,14,1,14,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15, + 14,16,14,17,14,18,14,19,14,20,14,21,14,22,14,23,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7, + 15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,17,0,17,1,17,2,17,3,17,4,17,5,17,6,17,7, + 17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20,17,21,17,22,17,23, + 18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15, + 18,16,18,17,18,18,18,19,18,20,18,21,18,22,18,23,19,0,19,1,19,2,19,3,19,4,19,5,19,6,19,7, + 19,8,19,9,19,10,19,11,19,12,19,13,19,14,19,15,19,16,19,17,19,18,19,19,19,20,19,21,19,22,19,23, + 20,0,20,1,20,2,20,3,20,4,20,5,20,6,20,7,20,8,20,9,20,10,20,11,20,12,20,13,20,14,20,15, + 20,16,20,17,20,18,20,19,20,20,20,21,20,22,20,23,21,0,21,1,21,2,21,3,21,4,21,5,21,6,21,7, + 21,8,21,9,21,10,21,11,21,12,21,13,21,14,21,15,21,16,21,17,21,18,21,19,21,20,21,21,21,22,21,23, + 22,0,22,1,22,2,22,3,22,4,22,5,22,6,22,7,22,8,22,9,22,10,22,11,22,12,22,13,22,14,22,15, + 22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,23,0,23,1,23,2,23,3,23,4,23,5,23,6,23,7, + 23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,23,17,23,18,23,19,23,20,23,21,23,22,23,23, +}; + +const int32_t c_aaiHuffDemod16[729][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, + 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,1,0,1,1,1,2,1,3,1,4, + 1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20, + 1,21,1,22,1,23,1,24,1,25,1,26,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9, + 2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2,19,2,20,2,21,2,22,2,23,2,24,2,25, + 2,26,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,3,14, + 3,15,3,16,3,17,3,18,3,19,3,20,3,21,3,22,3,23,3,24,3,25,3,26,4,0,4,1,4,2,4,3, + 4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15,4,16,4,17,4,18,4,19, + 4,20,4,21,4,22,4,23,4,24,4,25,4,26,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8, + 5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,5,20,5,21,5,22,5,23,5,24, + 5,25,5,26,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13, + 6,14,6,15,6,16,6,17,6,18,6,19,6,20,6,21,6,22,6,23,6,24,6,25,6,26,7,0,7,1,7,2, + 7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18, + 7,19,7,20,7,21,7,22,7,23,7,24,7,25,7,26,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, + 8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15,8,16,8,17,8,18,8,19,8,20,8,21,8,22,8,23, + 8,24,8,25,8,26,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12, + 9,13,9,14,9,15,9,16,9,17,9,18,9,19,9,20,9,21,9,22,9,23,9,24,9,25,9,26,10,0,10,1, + 10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17, + 10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,26,11,0,11,1,11,2,11,3,11,4,11,5,11,6, + 11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19,11,20,11,21,11,22, + 11,23,11,24,11,25,11,26,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11, + 12,12,12,13,12,14,12,15,12,16,12,17,12,18,12,19,12,20,12,21,12,22,12,23,12,24,12,25,12,26,13,0, + 13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16, + 13,17,13,18,13,19,13,20,13,21,13,22,13,23,13,24,13,25,13,26,14,0,14,1,14,2,14,3,14,4,14,5, + 14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,14,20,14,21, + 14,22,14,23,14,24,14,25,14,26,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10, + 15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23,15,24,15,25,15,26, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,16,24,16,25,16,26,17,0,17,1,17,2,17,3,17,4, + 17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20, + 17,21,17,22,17,23,17,24,17,25,17,26,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9, + 18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,18,18,18,19,18,20,18,21,18,22,18,23,18,24,18,25, + 18,26,19,0,19,1,19,2,19,3,19,4,19,5,19,6,19,7,19,8,19,9,19,10,19,11,19,12,19,13,19,14, + 19,15,19,16,19,17,19,18,19,19,19,20,19,21,19,22,19,23,19,24,19,25,19,26,20,0,20,1,20,2,20,3, + 20,4,20,5,20,6,20,7,20,8,20,9,20,10,20,11,20,12,20,13,20,14,20,15,20,16,20,17,20,18,20,19, + 20,20,20,21,20,22,20,23,20,24,20,25,20,26,21,0,21,1,21,2,21,3,21,4,21,5,21,6,21,7,21,8, + 21,9,21,10,21,11,21,12,21,13,21,14,21,15,21,16,21,17,21,18,21,19,21,20,21,21,21,22,21,23,21,24, + 21,25,21,26,22,0,22,1,22,2,22,3,22,4,22,5,22,6,22,7,22,8,22,9,22,10,22,11,22,12,22,13, + 22,14,22,15,22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,22,24,22,25,22,26,23,0,23,1,23,2, + 23,3,23,4,23,5,23,6,23,7,23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,23,17,23,18, + 23,19,23,20,23,21,23,22,23,23,23,24,23,25,23,26,24,0,24,1,24,2,24,3,24,4,24,5,24,6,24,7, + 24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,24,22,24,23, + 24,24,24,25,24,26,25,0,25,1,25,2,25,3,25,4,25,5,25,6,25,7,25,8,25,9,25,10,25,11,25,12, + 25,13,25,14,25,15,25,16,25,17,25,18,25,19,25,20,25,21,25,22,25,23,25,24,25,25,25,26,26,0,26,1, + 26,2,26,3,26,4,26,5,26,6,26,7,26,8,26,9,26,10,26,11,26,12,26,13,26,14,26,15,26,16,26,17, + 26,18,26,19,26,20,26,21,26,22,26,23,26,24,26,25,26,26, +}; + +const int32_t c_aaiHuffDemod17[729][2] = { + 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, + 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,1,0,1,1,1,2,1,3,1,4, + 1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20, + 1,21,1,22,1,23,1,24,1,25,1,26,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9, + 2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2,19,2,20,2,21,2,22,2,23,2,24,2,25, + 2,26,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,3,14, + 3,15,3,16,3,17,3,18,3,19,3,20,3,21,3,22,3,23,3,24,3,25,3,26,4,0,4,1,4,2,4,3, + 4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15,4,16,4,17,4,18,4,19, + 4,20,4,21,4,22,4,23,4,24,4,25,4,26,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8, + 5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,5,20,5,21,5,22,5,23,5,24, + 5,25,5,26,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13, + 6,14,6,15,6,16,6,17,6,18,6,19,6,20,6,21,6,22,6,23,6,24,6,25,6,26,7,0,7,1,7,2, + 7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18, + 7,19,7,20,7,21,7,22,7,23,7,24,7,25,7,26,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, + 8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15,8,16,8,17,8,18,8,19,8,20,8,21,8,22,8,23, + 8,24,8,25,8,26,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12, + 9,13,9,14,9,15,9,16,9,17,9,18,9,19,9,20,9,21,9,22,9,23,9,24,9,25,9,26,10,0,10,1, + 10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17, + 10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,26,11,0,11,1,11,2,11,3,11,4,11,5,11,6, + 11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19,11,20,11,21,11,22, + 11,23,11,24,11,25,11,26,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11, + 12,12,12,13,12,14,12,15,12,16,12,17,12,18,12,19,12,20,12,21,12,22,12,23,12,24,12,25,12,26,13,0, + 13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16, + 13,17,13,18,13,19,13,20,13,21,13,22,13,23,13,24,13,25,13,26,14,0,14,1,14,2,14,3,14,4,14,5, + 14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,14,20,14,21, + 14,22,14,23,14,24,14,25,14,26,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10, + 15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23,15,24,15,25,15,26, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,16,24,16,25,16,26,17,0,17,1,17,2,17,3,17,4, + 17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20, + 17,21,17,22,17,23,17,24,17,25,17,26,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9, + 18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,18,18,18,19,18,20,18,21,18,22,18,23,18,24,18,25, + 18,26,19,0,19,1,19,2,19,3,19,4,19,5,19,6,19,7,19,8,19,9,19,10,19,11,19,12,19,13,19,14, + 19,15,19,16,19,17,19,18,19,19,19,20,19,21,19,22,19,23,19,24,19,25,19,26,20,0,20,1,20,2,20,3, + 20,4,20,5,20,6,20,7,20,8,20,9,20,10,20,11,20,12,20,13,20,14,20,15,20,16,20,17,20,18,20,19, + 20,20,20,21,20,22,20,23,20,24,20,25,20,26,21,0,21,1,21,2,21,3,21,4,21,5,21,6,21,7,21,8, + 21,9,21,10,21,11,21,12,21,13,21,14,21,15,21,16,21,17,21,18,21,19,21,20,21,21,21,22,21,23,21,24, + 21,25,21,26,22,0,22,1,22,2,22,3,22,4,22,5,22,6,22,7,22,8,22,9,22,10,22,11,22,12,22,13, + 22,14,22,15,22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,22,24,22,25,22,26,23,0,23,1,23,2, + 23,3,23,4,23,5,23,6,23,7,23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,23,17,23,18, + 23,19,23,20,23,21,23,22,23,23,23,24,23,25,23,26,24,0,24,1,24,2,24,3,24,4,24,5,24,6,24,7, + 24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,24,22,24,23, + 24,24,24,25,24,26,25,0,25,1,25,2,25,3,25,4,25,5,25,6,25,7,25,8,25,9,25,10,25,11,25,12, + 25,13,25,14,25,15,25,16,25,17,25,18,25,19,25,20,25,21,25,22,25,23,25,24,25,25,25,26,26,0,26,1, + 26,2,26,3,26,4,26,5,26,6,26,7,26,8,26,9,26,10,26,11,26,12,26,13,26,14,26,15,26,16,26,17, + 26,18,26,19,26,20,26,21,26,22,26,23,26,24,26,25,26,26, +}; +}; + +const int32_t (*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { + NULL, + c_aaiHuffDemod1, + c_aaiHuffDemod2, + c_aaiHuffDemod3, + c_aaiHuffDemod4, + c_aaiHuffDemod5, + c_aaiHuffDemod6, + c_aaiHuffDemod7, + c_aaiHuffDemod8, + c_aaiHuffDemod9, + c_aaiHuffDemod10, + c_aaiHuffDemod11, + c_aaiHuffDemod12, + c_aaiHuffDemod13, + c_aaiHuffDemod14, + c_aaiHuffDemod15, + c_aaiHuffDemod16, + c_aaiHuffDemod17, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +#endif + + +/* clang-format on */ diff --git a/lib_rend/ivas_CQMFHuff.h b/lib_rend/ivas_CQMFHuff.h new file mode 100644 index 0000000000..3e6eebaba4 --- /dev/null +++ b/lib_rend/ivas_CQMFHuff.h @@ -0,0 +1,350 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_CQMF_HUFF_H_ +#define _IVAS_CQMF_HUFF_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ivas_Tables.h" + +//#define USE_DEMOD_TABLES + +#ifndef HUFF_READ_SIZE +#define HUFF_READ_SIZE (4) +#endif + +#ifndef HUFF_DEC_TABLE_SIZE +#define HUFF_DEC_TABLE_SIZE (16) +#endif + +#include // For NULL +#include +extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; + +extern const uint32_t c_aauiCQMFHuffDec1[3][16]; + +extern const uint32_t c_aauiCQMFHuffEnc2[16][2]; + +extern const uint32_t c_aauiCQMFHuffDec2[3][16]; + +extern const uint32_t c_aauiCQMFHuffEnc3[25][2]; + +extern const uint32_t c_aauiCQMFHuffDec3[10][16]; + +extern const uint32_t c_aauiCQMFHuffEnc4[36][2]; + +extern const uint32_t c_aauiCQMFHuffDec4[5][16]; + +extern const uint32_t c_aauiCQMFHuffEnc5[36][2]; + +extern const uint32_t c_aauiCQMFHuffDec5[10][16]; + +extern const uint32_t c_aauiCQMFHuffEnc6[49][2]; + +extern const uint32_t c_aauiCQMFHuffDec6[7][16]; + +extern const uint32_t c_aauiCQMFHuffEnc7[64][2]; + +extern const uint32_t c_aauiCQMFHuffDec7[25][16]; + +extern const uint32_t c_aauiCQMFHuffEnc8[81][2]; + +extern const uint32_t c_aauiCQMFHuffDec8[16][16]; + +extern const uint32_t c_aauiCQMFHuffEnc9[100][2]; + +extern const uint32_t c_aauiCQMFHuffDec9[22][16]; + +extern const uint32_t c_aauiCQMFHuffEnc10[169][2]; + +extern const uint32_t c_aauiCQMFHuffDec10[45][16]; + +extern const uint32_t c_aauiCQMFHuffEnc11[196][2]; + +extern const uint32_t c_aauiCQMFHuffDec11[50][16]; + +extern const uint32_t c_aauiCQMFHuffEnc12[289][2]; + +extern const uint32_t c_aauiCQMFHuffDec12[76][16]; + +extern const uint32_t c_aauiCQMFHuffEnc13[324][2]; + +extern const uint32_t c_aauiCQMFHuffDec13[89][16]; + +extern const uint32_t c_aauiCQMFHuffEnc14[400][2]; + +extern const uint32_t c_aauiCQMFHuffDec14[53][16]; + +extern const uint32_t c_aauiCQMFHuffEnc15[576][2]; + +extern const uint32_t c_aauiCQMFHuffDec15[73][16]; + +extern const uint32_t c_aauiCQMFHuffEnc16[729][2]; + +extern const uint32_t c_aauiCQMFHuffDec16[85][16]; + +extern const uint32_t c_aauiCQMFHuffEnc17[729][2]; + +extern const uint32_t c_aauiCQMFHuffDec17[93][16]; + +extern const uint32_t c_aauiCQMFHuffEnc18[28][2]; + +extern const uint32_t c_aauiCQMFHuffDec18[6][16]; + +extern const uint32_t c_aauiCQMFHuffEnc19[29][2]; + +extern const uint32_t c_aauiCQMFHuffDec19[6][16]; + +extern const uint32_t c_aauiCQMFHuffEnc20[32][2]; + +extern const uint32_t c_aauiCQMFHuffDec20[6][16]; + +extern const uint32_t c_aauiCQMFHuffEnc21[37][2]; + +extern const uint32_t c_aauiCQMFHuffDec21[7][16]; + +extern const uint32_t c_aauiCQMFHuffEnc22[39][2]; + +extern const uint32_t c_aauiCQMFHuffDec22[9][16]; + +extern const uint32_t c_aauiCQMFHuffEnc23[46][2]; + +extern const uint32_t c_aauiCQMFHuffDec23[12][16]; + +extern const uint32_t c_aauiCQMFHuffEnc24[55][2]; + +extern const uint32_t c_aauiCQMFHuffDec24[17][16]; + +extern const uint32_t c_aauiCQMFHuffEnc25[65][2]; + +extern const uint32_t c_aauiCQMFHuffDec25[19][16]; + +extern const uint32_t c_aauiCQMFHuffEnc26[77][2]; + +extern const uint32_t c_aauiCQMFHuffDec26[26][16]; + +extern const uint32_t c_aauiCQMFHuffEnc27[91][2]; + +extern const uint32_t c_aauiCQMFHuffDec27[28][16]; + +extern const uint32_t c_aauiCQMFHuffEnc28[109][2]; + +extern const uint32_t c_aauiCQMFHuffDec28[30][16]; + +extern const uint32_t c_aauiCQMFHuffEnc29[129][2]; + +extern const uint32_t c_aauiCQMFHuffDec29[34][16]; + +extern const uint32_t c_aauiCQMFHuffEnc30[153][2]; + +extern const uint32_t c_aauiCQMFHuffDec30[39][16]; + +extern const uint32_t c_aauiCQMFHuffEnc31[181][2]; + +extern const uint32_t c_aauiCQMFHuffDec31[43][16]; + +extern const uint32_t c_aauiCQMFHuffEnc33[16][2]; + +extern const uint32_t c_aauiCQMFHuffDec33[2][16]; + +extern const uint32_t c_aauiCQMFHuffEnc34[16][2]; + +extern const uint32_t c_aauiCQMFHuffDec34[2][16]; + +extern const uint32_t c_aauiCQMFHuffEnc35[25][2]; + +extern const uint32_t c_aauiCQMFHuffDec35[9][16]; + +extern const uint32_t c_aauiCQMFHuffEnc36[36][2]; + +extern const uint32_t c_aauiCQMFHuffDec36[7][16]; + +extern const uint32_t c_aauiCQMFHuffEnc37[36][2]; + +extern const uint32_t c_aauiCQMFHuffDec37[4][16]; + +extern const uint32_t c_aauiCQMFHuffEnc38[49][2]; + +extern const uint32_t c_aauiCQMFHuffDec38[22][16]; + +extern const uint32_t c_aauiCQMFHuffEnc39[64][2]; + +extern const uint32_t c_aauiCQMFHuffDec39[12][16]; + +extern const uint32_t c_aauiCQMFHuffEnc40[81][2]; + +extern const uint32_t c_aauiCQMFHuffDec40[36][16]; + +extern const uint32_t c_aauiCQMFHuffEnc41[100][2]; + +extern const uint32_t c_aauiCQMFHuffDec41[16][16]; + +extern const uint32_t c_aauiCQMFHuffEnc42[169][2]; + +extern const uint32_t c_aauiCQMFHuffDec42[28][16]; + +extern const uint32_t c_aauiCQMFHuffEnc43[196][2]; + +extern const uint32_t c_aauiCQMFHuffDec43[32][16]; + +extern const uint32_t c_aauiCQMFHuffEnc44[289][2]; + +extern const uint32_t c_aauiCQMFHuffDec44[27][16]; + +extern const uint32_t c_aauiCQMFHuffEnc45[324][2]; + +extern const uint32_t c_aauiCQMFHuffDec45[50][16]; + +extern const uint32_t c_aauiCQMFHuffEnc46[400][2]; + +extern const uint32_t c_aauiCQMFHuffDec46[61][16]; + +extern const uint32_t c_aauiCQMFHuffEnc47[576][2]; + +extern const uint32_t c_aauiCQMFHuffDec47[87][16]; + +extern const uint32_t c_aauiCQMFHuffEnc48[729][2]; + +extern const uint32_t c_aauiCQMFHuffDec48[110][16]; + +extern const uint32_t c_aauiCQMFHuffEnc49[729][2]; + +extern const uint32_t c_aauiCQMFHuffDec49[113][16]; + +extern const uint32_t c_aauiCQMFHuffEnc50[28][2]; + +extern const uint32_t c_aauiCQMFHuffDec50[6][16]; + +extern const uint32_t c_aauiCQMFHuffEnc51[29][2]; + +extern const uint32_t c_aauiCQMFHuffDec51[6][16]; + +extern const uint32_t c_aauiCQMFHuffEnc52[32][2]; + +extern const uint32_t c_aauiCQMFHuffDec52[7][16]; + +extern const uint32_t c_aauiCQMFHuffEnc53[37][2]; + +extern const uint32_t c_aauiCQMFHuffDec53[9][16]; + +extern const uint32_t c_aauiCQMFHuffEnc54[39][2]; + +extern const uint32_t c_aauiCQMFHuffDec54[9][16]; + +extern const uint32_t c_aauiCQMFHuffEnc55[46][2]; + +extern const uint32_t c_aauiCQMFHuffDec55[10][16]; + +extern const uint32_t c_aauiCQMFHuffEnc56[55][2]; + +extern const uint32_t c_aauiCQMFHuffDec56[12][16]; + +extern const uint32_t c_aauiCQMFHuffEnc57[65][2]; + +extern const uint32_t c_aauiCQMFHuffDec57[14][16]; + +extern const uint32_t c_aauiCQMFHuffEnc58[77][2]; + +extern const uint32_t c_aauiCQMFHuffDec58[17][16]; + +extern const uint32_t c_aauiCQMFHuffEnc59[91][2]; + +extern const uint32_t c_aauiCQMFHuffDec59[20][16]; + +extern const uint32_t c_aauiCQMFHuffEnc60[109][2]; + +extern const uint32_t c_aauiCQMFHuffDec60[24][16]; + +extern const uint32_t c_aauiCQMFHuffEnc61[129][2]; + +extern const uint32_t c_aauiCQMFHuffDec61[33][16]; + +extern const uint32_t c_aauiCQMFHuffEnc62[153][2]; + +extern const uint32_t c_aauiCQMFHuffDec62[41][16]; + +extern const uint32_t c_aauiCQMFHuffEnc63[181][2]; + +extern const uint32_t c_aauiCQMFHuffDec63[39][16]; + + +extern const uint32_t (*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2]; + +extern const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE]; + +#ifdef USE_DEMOD_TABLES +extern const int32_t c_aaiHuffDemod1[16][2]; + +extern const int32_t c_aaiHuffDemod2[16][2]; + +extern const int32_t c_aaiHuffDemod3[25][2]; + +extern const int32_t c_aaiHuffDemod4[36][2]; + +extern const int32_t c_aaiHuffDemod5[36][2]; + +extern const int32_t c_aaiHuffDemod6[49][2]; + +extern const int32_t c_aaiHuffDemod7[64][2]; + +extern const int32_t c_aaiHuffDemod8[81][2]; + +extern const int32_t c_aaiHuffDemod9[100][2]; + +extern const int32_t c_aaiHuffDemod10[169][2]; + +extern const int32_t c_aaiHuffDemod11[196][2]; + +extern const int32_t c_aaiHuffDemod12[289][2]; + +extern const int32_t c_aaiHuffDemod13[324][2]; + +extern const int32_t c_aaiHuffDemod14[400][2]; + +extern const int32_t c_aaiHuffDemod15[576][2]; + +extern const int32_t c_aaiHuffDemod16[729][2]; + +extern const int32_t c_aaiHuffDemod17[729][2]; + +extern const int32_t (*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2]; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _CQMF_HUFF_H_ */ diff --git a/lib_rend/ivas_MSPred.c b/lib_rend/ivas_MSPred.c new file mode 100644 index 0000000000..97157de348 --- /dev/null +++ b/lib_rend/ivas_MSPred.c @@ -0,0 +1,357 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_MSPred.h" +#include "ivas_Tables.h" +#include "ivas_RMSEnvDeltaHuff.h" +#include +#include +#include "options.h" +#include "prot.h" +#include "wmops.h" + +int32_t _round( float val ) +{ + return ( val > 0.0f ? (int32_t) ( val + 0.5f ) : (int32_t) ( val - 0.5f ) ); +} + +int32_t quantPhase( float phase ) +{ +#ifdef SIMPLE_PHASE + int32_t phaseQ; + if ( phase < 0.0f ) + { + phase += 2.0f * _PI_; + } + phaseQ = _round( phase * SIMPLE_PHASE_QUANT_FACTOR ); + phaseQ = ( phaseQ > SIMPLE_PHASE_MAX_VAL ? SIMPLE_PHASE_MIN_VAL : phaseQ ); +#else + int32_t phaseQ; + + phaseQ = _round( phase * PHASE_QUANT_FACTOR ); + if ( phaseQ == PHASE_MAX_VAL ) + { + phaseQ = PHASE_MIN_VAL; + } +#endif + return phaseQ; +} + +void rot_pm_pi( float *pr, float *pi ) +{ + /* (-1 + j0) */ + *pr = -( *pr ); + *pi = -( *pi ); +} + +void rot_p_pi_2( float *pr, float *pi ) +{ + /* (0 + j) */ + float r = *pr; + *pr = -( *pi ); + *pi = r; +} + +void rot_m_pi_2( float *pr, float *pi ) +{ + /* (0 - j) */ + float r = *pr; + *pr = *pi; + *pi = -r; +} + +void cplxmult( float *pr1, float *pi1, float r2, float i2 ) +{ + float r1 = *pr1, i1 = *pi1; + *pr1 = r1 * r2 - i1 * i2; + *pi1 = r1 * i2 + i1 * r2; +} + +int32_t requantPhase( int32_t phaseQ ) +{ + + if ( phaseQ >= PHASE_MAX_VAL ) + { + phaseQ += PHASE_MAX_VAL; + phaseQ %= ( 2 * PHASE_MAX_VAL ); + phaseQ -= PHASE_MAX_VAL; + } + else if ( phaseQ < PHASE_MIN_VAL ) + { + phaseQ -= PHASE_MAX_VAL; + phaseQ %= ( 2 * PHASE_MAX_VAL ); + phaseQ += PHASE_MAX_VAL; + if ( phaseQ == PHASE_MAX_VAL ) + { + phaseQ = PHASE_MIN_VAL; + } + } + + return phaseQ; +} + +int32_t quantPred( float pred ) +{ + int32_t predQ = _round( pred * PRED_QUANT_FACTOR ); + predQ = predQ > PRED_MAX_VAL ? PRED_MAX_VAL : predQ; + predQ = predQ < PRED_MIN_VAL ? PRED_MIN_VAL : predQ; + + return predQ; +} + +float dequantPhase( int32_t phaseQ ) +{ +#ifdef SIMPLE_PHASE + return (float) phaseQ / SIMPLE_PHASE_QUANT_FACTOR; +#else + return (float) phaseQ / PHASE_QUANT_FACTOR; +#endif +} + +float dequantPred( int32_t predQ ) +{ + return (float) predQ / PRED_QUANT_FACTOR; +} + +int32_t PrepEncode( int32_t *piQuant, const int32_t *piMSFlags, const int32_t numBands ) +{ + int32_t b, numMSBands = 0; + for ( b = 0; b < numBands; b++ ) + { + if ( piMSFlags[b] ) + { + piQuant[numMSBands++] = piQuant[b]; + } + } + for ( b = numMSBands; b < numBands; b++ ) + { + piQuant[b] = 0; + } + return numMSBands; +} + +void EncodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim ) +{ + int32_t b; + if ( diffDim > 0 ) + { + int32_t tmp1, tmp2; + tmp1 = phaseQuant[0]; + for ( b = 1; b < numMSBands; b++ ) + { + tmp2 = phaseQuant[b]; + phaseQuant[b] -= tmp1; + tmp1 = tmp2; + } + } + if ( diffDim > 1 ) + { + int32_t tmp1, tmp2; + tmp1 = phaseQuant[1]; + for ( b = 2; b < numMSBands; b++ ) + { + tmp2 = phaseQuant[b]; + phaseQuant[b] -= tmp1; + tmp1 = tmp2; + } + } + for ( b = 1; b < numMSBands; b++ ) + { + phaseQuant[b] = requantPhase( phaseQuant[b] ); + } +} + +void DecodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim ) +{ + int32_t b; + if ( diffDim > 1 ) + { + for ( b = 2; b < numMSBands; b++ ) + { + phaseQuant[b] += phaseQuant[b - 1]; + } + } + if ( diffDim > 0 ) + { + for ( b = 1; b < numMSBands; b++ ) + { + phaseQuant[b] += phaseQuant[b - 1]; + } + } + for ( b = 1; b < numMSBands; b++ ) + { + phaseQuant[b] = requantPhase( phaseQuant[b] ); + } +} + +int32_t EncodePredCoef( int32_t *predQuant, int32_t numMSBands ) +{ + int32_t b, tmp1, tmp2; + tmp1 = predQuant[0]; + for ( b = 1; b < numMSBands; b++ ) + { + tmp2 = predQuant[b]; + predQuant[b] -= tmp1; + tmp1 = tmp2; + } + return numMSBands; +} + +void DecodePredCoef( int32_t *phaseQuant, int32_t numMSBands ) +{ + int32_t b; + for ( b = 1; b < numMSBands; b++ ) + { + phaseQuant[b] += phaseQuant[b - 1]; + } +} + +int32_t CountMSBits( int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiff, const int32_t *piMSPredCoef ) +{ + int32_t iBitsWritten = 0; + int32_t b; + int32_t anyNonZero; + int32_t iNumMSBands = 0; + int32_t piPhaseCopy[MAX_BANDS_48] = { 0 }; + int32_t piPredCopy[MAX_BANDS_48] = { 0 }; + + iBitsWritten += 2; /* iMSMode */ + for ( b = 0; b < iNumBands; b++ ) + { + iNumMSBands += ( piMSFlags[b] != 0 ); + } + + if ( iNumMSBands == 0 ) + { + return iBitsWritten; + } + + if ( iNumMSBands < iNumBands ) + { + iBitsWritten += iNumBands; /* piMSFlags */ + } + + if ( iMSMode < 3 ) + { + return iBitsWritten; + } + + /* prepare arrays for coding evaluation */ + for ( b = 0; b < iNumBands; b++ ) + { + piPhaseCopy[b] = piLRPhaseDiff[b]; + piPredCopy[b] = piMSPredCoef[b]; + } + + /* Differential Coding of Phase Data*/ + PrepEncode( piPhaseCopy, piMSFlags, iNumBands ); + PrepEncode( piPredCopy, piMSFlags, iNumBands ); +#ifndef SIMPLE_PHASE + EncodePhase( piPhaseCopy, iNumMSBands, PHASE_DIFF_DIM ); +#endif + EncodePredCoef( piPredCopy, iNumMSBands ); + + iBitsWritten += 1; /* iMSPredAll */ + anyNonZero = 0; /* phase */ + for ( b = 0; b < iNumMSBands; b++ ) + { + if ( piPhaseCopy[b] != 0 ) + { + anyNonZero = 1; + break; + } + } + iBitsWritten++; /*anyNonZero Phase*/ + if ( anyNonZero ) + { +#ifdef SIMPLE_PHASE + iBitsWritten += iNumMSBands * SIMPLE_PHASE_BITS; +#else + iBitsWritten += PHASE_BAND0_BITS; + for ( b = 1; b < iNumMSBands; b++ ) + { + int32_t tabIdx = piPhaseCopy[b] - ENV_DELTA_MIN; + iBitsWritten += c_aaiRMSEnvHuffEnc[tabIdx][0]; + } +#endif + } + anyNonZero = 0; /* prediction */ + for ( b = 0; b < iNumMSBands; b++ ) + { + if ( piPredCopy[b] != 0 ) + { + anyNonZero = 1; + break; + } + } + + iBitsWritten++; /* any nonZero Pred */ + if ( anyNonZero ) + { + iBitsWritten += PRED_BAND0_BITS; + for ( b = 1; b < iNumMSBands; b++ ) + { + int32_t tabIdx = piPredCopy[b] - ENV_DELTA_MIN; + iBitsWritten += c_aaiRMSEnvHuffEnc[tabIdx][0]; + } + } + + return iBitsWritten; +} + +void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32_t numMSBands, int32_t numBands, void *fid, int32_t *piMsFlags ) +{ + int32_t b; + fid = (FILE *) fid; + fprintf( fid, "%d %d", MSMode, numMSBands ); + for ( b = 0; b < numMSBands; b++ ) + { + fprintf( fid, " %d", phaseQuant[b] ); + } + for ( b = numMSBands; b < numBands; b++ ) + { + fprintf( fid, " %d", 0 ); + } + for ( b = 0; b < numMSBands; b++ ) + { + fprintf( fid, " %d", predQuant[b] ); + } + for ( b = numMSBands; b < numBands; b++ ) + { + fprintf( fid, " %d", 0 ); + } + for ( b = 0; b < numBands; b++ ) + { + fprintf( fid, " %d", piMsFlags[b] ); + } + fprintf( fid, "\n" ); +} diff --git a/lib_rend/ivas_MSPred.h b/lib_rend/ivas_MSPred.h new file mode 100644 index 0000000000..a2e94b7ba7 --- /dev/null +++ b/lib_rend/ivas_MSPred.h @@ -0,0 +1,62 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_MS_PRED_H_ +#define _IVAS_MS_PRED_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include + int32_t _round( float val ); + int32_t quantPhase( float phase ); + void cplxmult( float *pr1, float *pi1, float r2, float i2 ); + void rot_pm_pi( float *pr, float *pi ); + void rot_p_pi_2( float *pr, float *pi ); + void rot_m_pi_2( float *pr, float *pi ); + int32_t requantPhase( int32_t phaseQ ); + int32_t quantPred( float pred ); + float dequantPhase( int32_t phaseQ ); + float dequantPred( int32_t predQ ); + int32_t PrepEncode( int32_t *piQuant, const int32_t *piMSFlags, const int32_t numBands ); + void EncodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim ); + void DecodePhase( int32_t *phaseQuant, int32_t numMSBands, int32_t diffDim ); + int32_t EncodePredCoef( int32_t *predQuant, int32_t numMSBands ); + void DecodePredCoef( int32_t *phaseQuant, int32_t numMSBands ); + void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32_t numMSBands, int32_t numBands, void *fid, int32_t *piMsFlags ); + int32_t CountMSBits( int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiff, const int32_t *piMSPredCoef ); +#ifdef __cplusplus +} +#endif + +#endif /* _MS_PRED_H_ */ diff --git a/lib_rend/ivas_NoiseGen.c b/lib_rend/ivas_NoiseGen.c new file mode 100644 index 0000000000..c0d6bbd5d3 --- /dev/null +++ b/lib_rend/ivas_NoiseGen.c @@ -0,0 +1,82 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_NoiseGen.h" +#include +#include +#include +#include "options.h" +#include "prot.h" +#include "wmops.h" + +NoiseGen *CreateNoiseGen( void ) +{ + int32_t n; + + NoiseGen *psNoiseGen = NULL; + + psNoiseGen = (NoiseGen *) count_malloc( sizeof( NoiseGen ) ); + psNoiseGen->iNoiseBufferLength = 2048; + psNoiseGen->iNoiseBufferMask = 2047; + psNoiseGen->iNoiseBufferIndex = 0; + + psNoiseGen->pfNoiseBuffer = (float *) count_malloc( psNoiseGen->iNoiseBufferLength * sizeof( float ) ); + + /* Generate Laplacian distributed noise */ + for ( n = 0; n < psNoiseGen->iNoiseBufferLength; n++ ) + { + float fNoise = 0.0f; + float fScale = 0.707f; + fNoise = (float) ( ( rand() & ( RAND_MAX - 1 ) ) - ( RAND_MAX >> 1 ) ) / (float) RAND_MAX; + + if ( fNoise < 0.0 ) + { + fNoise = fScale * (float) logf( 1.0f + 1.9999999f * fNoise ); + } + else + { + fNoise = -fScale * (float) logf( 1.0f - 1.9999999f * fNoise ); + } + + psNoiseGen->pfNoiseBuffer[n] = fNoise; + } + + return psNoiseGen; +} + +void DeleteNoiseGen( NoiseGen *psNoiseGen ) +{ + count_free( psNoiseGen->pfNoiseBuffer ); + count_free( psNoiseGen ); +} + +extern float GetNoise( NoiseGen *psNoiseGen ); diff --git a/lib_rend/ivas_NoiseGen.h b/lib_rend/ivas_NoiseGen.h new file mode 100644 index 0000000000..b56b1f9f84 --- /dev/null +++ b/lib_rend/ivas_NoiseGen.h @@ -0,0 +1,68 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_NOISE_GEN_H_ +#define _IVAS_NOISE_GEN_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include + typedef struct NOISE_GEN + { + int32_t iNoiseBufferLength; + int32_t iNoiseBufferMask; + int32_t iNoiseBufferIndex; + float *pfNoiseBuffer; + } NoiseGen; + + NoiseGen *CreateNoiseGen( void ); + + void DeleteNoiseGen( NoiseGen *psNoiseGen ); + + inline float GetNoise( NoiseGen *psNoiseGen ) + { + float fNoiseSample; + + fNoiseSample = psNoiseGen->pfNoiseBuffer[psNoiseGen->iNoiseBufferIndex]; + psNoiseGen->iNoiseBufferIndex++; + psNoiseGen->iNoiseBufferIndex &= psNoiseGen->iNoiseBufferMask; + + return fNoiseSample; + } + +#ifdef __cplusplus +} +#endif + +#endif /* _NOISE_GEN_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c b/lib_rend/ivas_PerceptualModel.c similarity index 51% rename from lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c rename to lib_rend/ivas_PerceptualModel.c index 2e7e8568e7..ab136f5e08 100644 --- a/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.c +++ b/lib_rend/ivas_PerceptualModel.c @@ -1,10 +1,48 @@ -#include "PerceptualModel.h" -#include "Tables.h" +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_PerceptualModel.h" +#include "ivas_Tables.h" +#include "options.h" +#include "prot.h" #include "wmops.h" +#include + +/* clang-format off */ #define LOG_ADD_TABLE_LENGTH (512) -const int c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { +/*TODO : rtyag : move this to tables.c*/ +const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { 0x40, 0x40, 0x3F, 0x3F, 0x3E, 0x3E, 0x3D, 0x3D, 0x3C, 0x3C, 0x3B, 0x3B, 0x3A, 0x3A, 0x39, 0x39, 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, 0x31, 0x31, 0x31, 0x30, 0x30, 0x2F, 0x2F, 0x2F, 0x2E, 0x2E, 0x2D, 0x2D, 0x2D, 0x2C, 0x2C, 0x2B, @@ -39,10 +77,9 @@ const int c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -static inline int LogAdd(int iVal1,int iVal2) +static inline int32_t LogAdd(int32_t iVal1,int32_t iVal2) { - int iRetVal; + int32_t iRetVal; if(iVal1 > iVal2){ iRetVal = iVal1 - iVal2; @@ -58,20 +95,40 @@ static inline int LogAdd(int iVal1,int iVal2) return iRetVal; } -const int c_aiBandwidthAdjust48[MAX_BANDS_48] = { +#define PERCEPTUAL_MODEL_SCALE (64) + +#define PERCEPTUAL_MODEL_SCALE_SHIFT (6) + +#define PERCEPTUAL_MODEL_ALPHA_SCALE (614) + +#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE (6827) + +#define PERCEPTUAL_MODEL_ALPHA_SHIFT (11) + +#define PERCEPTUAL_MODEL_SLGAIN_SHIFT (8)//(4) + +const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48] = { 0,0,0,0,0,0,0,0,0,0,0,64,64,64,64,64, 101,101,128,165,165,180,213,}; -const int c_aiAbsoluteThresh48[MAX_BANDS_48] = { +const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48] = { -1787,-1787,-1787,-1787,-1787,-1787,-1787,-1787,-1782,-1761,-1737,-1679,-1638,-1613,-1590,-1568, -1516,-1459,-1395,-1289,-671,-409,-401,}; -const int c_aiDefaultTheta48[MAX_BANDS_48] = { + +#if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4 +const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { 7,7,6,5,5,4,4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4, }; - -const int c_aaiSpreadFunction48[MAX_BANDS_48][MAX_BANDS_48] = { +#elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8 +const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { + 112,112,96,80,80,64,64,64,64,64,64,64,64,64,64,64, + 64,64,64,64,64,64,64, +}; +#endif + +const int32_t c_aaiSpreadFunction48[MAX_BANDS_48*MAX_BANDS_48] = { 0,-1561,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, -2552,-2552,-2552,-2552,-2552,-2552,-2552,-289,-4,-1234,-2295,-2552,-2552,-2552,-2552,-2552, -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-569,-229, @@ -107,54 +164,152 @@ const int c_aaiSpreadFunction48[MAX_BANDS_48][MAX_BANDS_48] = { -1003,-921,-852,-792,-737,-665,-580,-505,-441,-385,-326,-271,-222,-224,-176,-121,-114, }; -#define PERCEPTUAL_MODEL_SCALE (64) - -#define PERCEPTUAL_MODEL_SCALE_SHIFT (6) -#define PERCEPTUAL_MODEL_ALPHA_SCALE (614) +/* clang-format on */ -#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE (6827) -#define PERCEPTUAL_MODEL_ALPHA_SHIFT (11) +void PerceptualModel( const int32_t iMaxQuantBands, + const int32_t *piRMSEnvelope, + int32_t *piExcitation, + int32_t *piSMR ) +{ + int32_t n; -#define PERCEPTUAL_MODEL_SLGAIN_SHIFT (4) + for ( n = 0; n < iMaxQuantBands; n++ ) + { + int32_t iSLOffset; -void PerceptualModel(const int iMaxQuantBands, - const int *piRMSEnvelope, - int *piExcitation, - int *piSMR) -{ - int n; - - for(n = 0; n < iMaxQuantBands; n ++){ - int iSLOffset; - piExcitation[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n]; // Calculate sensation level offset - iSLOffset = c_aiDefaultTheta48[n] * (piExcitation[n] - c_aiAbsoluteThresh48[n]) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT; - //iSLOffset = (iSLOffset > 0) ? iSLOffset : 0; - // Offset envelope by sensation level offset + iSLOffset = c_aiDefaultTheta48[n] * ( piExcitation[n] - c_aiAbsoluteThresh48[n] ) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT; + // iSLOffset = (iSLOffset > 0) ? iSLOffset : 0; + // Offset envelope by sensation level offset piExcitation[n] -= iSLOffset; // Convert to loudness domain (x^0.3) piExcitation[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; } - + // Spread excitation function - for(n = 0; n < iMaxQuantBands; n ++){ - int k; - const int *piSpread; - - piSpread = c_aaiSpreadFunction48[n]; + for ( n = 0; n < iMaxQuantBands; n++ ) + { + int32_t k; + const int32_t *piSpread; + + piSpread = &c_aaiSpreadFunction48[n * MAX_BANDS_48]; piSMR[n] = piExcitation[n] + piSpread[n]; - for(k = 0; k < iMaxQuantBands; k ++){ - if(k != n){ - piSMR[n] = LogAdd(piSMR[n],piExcitation[k] + piSpread[k]); + for ( k = 0; k < iMaxQuantBands; k++ ) + { + if ( k != n ) + { + piSMR[n] = LogAdd( piSMR[n], piExcitation[k] + piSpread[k] ); } } } - - for(n = 0; n < iMaxQuantBands; n ++){ + + for ( n = 0; n < iMaxQuantBands; n++ ) + { piSMR[n] = PERCEPTUAL_MODEL_ALPHA_INV_SCALE * piSMR[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; piSMR[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope[n] + c_aiBandwidthAdjust48[n] - piSMR[n]; } } + +void PerceptualModelStereo( const int32_t iMaxQuantBands, + const int32_t *piMSFlags, + const int32_t *piRMSEnvelope0, + const int32_t *piRMSEnvelope1, + int32_t *piExcitation0, + int32_t *piExcitation1, + int32_t *piSMR0, + int32_t *piSMR1 ) +{ + int32_t n; + + for ( n = 0; n < iMaxQuantBands; n++ ) + { + int32_t iMaxRMSEnv; + int32_t iSLOffset; + + iMaxRMSEnv = piRMSEnvelope0[n]; + + piExcitation0[n] = PERCEPTUAL_MODEL_SCALE * iMaxRMSEnv + c_aiBandwidthAdjust48[n]; // piRMSEnvelope0[n] + // Calculate sensation level offset + iSLOffset = c_aiDefaultTheta48[n] * ( piExcitation0[n] - c_aiAbsoluteThresh48[n] ) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT; + // iSLOffset = (iSLOffset > 0) ? iSLOffset : 0; + // Offset envelope by sensation level offset + piExcitation0[n] -= iSLOffset; + // Convert to loudness domain (x^0.3) + piExcitation0[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation0[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; + } + + // Spread excitation function + for ( n = 0; n < iMaxQuantBands; n++ ) + { + int32_t k; + const int32_t *piSpread; + + piSpread = &c_aaiSpreadFunction48[n * MAX_BANDS_48]; + piSMR0[n] = piExcitation0[n] + piSpread[n]; + for ( k = 0; k < iMaxQuantBands; k++ ) + { + if ( k != n ) + { + piSMR0[n] = LogAdd( piSMR0[n], piExcitation0[k] + piSpread[k] ); + } + } + } + + for ( n = 0; n < iMaxQuantBands; n++ ) + { + int32_t iMaxRMSEnv; + int32_t iSLOffset; + + iMaxRMSEnv = piRMSEnvelope1[n]; + + piExcitation1[n] = PERCEPTUAL_MODEL_SCALE * iMaxRMSEnv + c_aiBandwidthAdjust48[n]; // piRMSEnvelope1[n] + // Calculate sensation level offset + iSLOffset = c_aiDefaultTheta48[n] * ( piExcitation1[n] - c_aiAbsoluteThresh48[n] ) >> PERCEPTUAL_MODEL_SLGAIN_SHIFT; + // iSLOffset = (iSLOffset > 0) ? iSLOffset : 0; + // Offset envelope by sensation level offset + piExcitation1[n] -= iSLOffset; + // Convert to loudness domain (x^0.3) + piExcitation1[n] = PERCEPTUAL_MODEL_ALPHA_SCALE * piExcitation1[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; + } + + // Spread excitation function + for ( n = 0; n < iMaxQuantBands; n++ ) + { + int32_t k; + const int32_t *piSpread; + + piSpread = &c_aaiSpreadFunction48[n * MAX_BANDS_48]; + piSMR1[n] = piExcitation1[n] + piSpread[n]; + for ( k = 0; k < iMaxQuantBands; k++ ) + { + if ( k != n ) + { + piSMR1[n] = LogAdd( piSMR1[n], piExcitation1[k] + piSpread[k] ); + } + } + } + + for ( n = 0; n < iMaxQuantBands; n++ ) + { + if ( piMSFlags[n] == 1 ) + { + piSMR0[n] = ( piSMR0[n] > piSMR1[n] ) ? piSMR0[n] : piSMR1[n]; + piSMR1[n] = piSMR0[n]; + } + } + + for ( n = 0; n < iMaxQuantBands; n++ ) + { + piSMR0[n] = PERCEPTUAL_MODEL_ALPHA_INV_SCALE * piSMR0[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; + piSMR0[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope0[n] + c_aiBandwidthAdjust48[n] - piSMR0[n]; + } + + for ( n = 0; n < iMaxQuantBands; n++ ) + { + piSMR1[n] = PERCEPTUAL_MODEL_ALPHA_INV_SCALE * piSMR1[n] >> PERCEPTUAL_MODEL_ALPHA_SHIFT; + piSMR1[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope1[n] + c_aiBandwidthAdjust48[n] - piSMR1[n]; + } +} diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h new file mode 100644 index 0000000000..2d3346183f --- /dev/null +++ b/lib_rend/ivas_PerceptualModel.h @@ -0,0 +1,59 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_PERCEPTUAL_MODEL_H_ +#define _IVAS_PERCEPTUAL_MODEL_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +void PerceptualModel(const int32_t iMaxQuantBands, + const int32_t *piRMSEnvelope, + int32_t *piExcitation, + int32_t *piSMR); + +void PerceptualModelStereo(const int32_t iMaxQuantBands, + const int32_t *piMSFlags, + const int32_t *piRMSEnvelope0, + const int32_t *piRMSEnvelope1, + int32_t *piExcitation0, + int32_t *piExcitation1, + int32_t *piSMR0, + int32_t *piSMR1); + +#ifdef __cplusplus +} +#endif + +#endif /* _PERCEPTUAL_MODEL_H_ */ diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c new file mode 100644 index 0000000000..4cfb776154 --- /dev/null +++ b/lib_rend/ivas_PredDecoder.c @@ -0,0 +1,259 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_PredDecoder.h" +#include +#include +#include +#include "options.h" +#include "prot.h" +#include "wmops.h" +#include "ivas_Tables.h" +#include "ivas_PredTables.h" +#include "ivas_cldfb_codec_bitstream.h" + + +PredictionDecoder *CreatePredictionDecoder( const int32_t iChannels, + const int32_t iNumBlocks ) +{ + int32_t n; + + PredictionDecoder *psPredictionDecoder = NULL; + + psPredictionDecoder = (PredictionDecoder *) count_malloc( sizeof( PredictionDecoder ) ); + + psPredictionDecoder->iChannels = iChannels; + psPredictionDecoder->iNumBlocks = iNumBlocks; + + psPredictionDecoder->piPredChanEnable = (int32_t *) count_malloc( sizeof( int32_t ) * iChannels ); + psPredictionDecoder->piNumPredBands = (int32_t *) count_malloc( sizeof( int32_t ) * iChannels ); + + psPredictionDecoder->ppfEstPredGain = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionDecoder->ppiPredBandEnable = (int32_t **) count_malloc( sizeof( int32_t * ) * iChannels ); + psPredictionDecoder->ppfA1Real = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionDecoder->ppfA1Imag = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionDecoder->ppiA1Mag = (int32_t **) count_malloc( sizeof( int32_t * ) * iChannels ); + psPredictionDecoder->ppiA1Phase = (int32_t **) count_malloc( sizeof( int32_t * ) * iChannels ); + for ( n = 0; n < psPredictionDecoder->iChannels; n++ ) + { + psPredictionDecoder->ppfEstPredGain[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionDecoder->ppiPredBandEnable[n] = (int32_t *) count_malloc( sizeof( int32_t ) * CQMF_BANDS ); + psPredictionDecoder->ppfA1Real[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionDecoder->ppfA1Imag[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionDecoder->ppiA1Mag[n] = (int32_t *) count_malloc( sizeof( int32_t ) * CQMF_BANDS ); + psPredictionDecoder->ppiA1Phase[n] = (int32_t *) count_malloc( sizeof( int32_t ) * CQMF_BANDS ); + } + + /* pre-define these tables? */ + psPredictionDecoder->pfMagLUT = (float *) count_malloc( sizeof( float ) * ( 1 << PRED_QUNAT_FILTER_MAG_BITS ) ); + psPredictionDecoder->pfP2RRealLUT = (float *) count_malloc( sizeof( float ) * ( 1 << PRED_QUANT_FILTER_PHASE_BITS ) ); + psPredictionDecoder->pfP2RImagLUT = (float *) count_malloc( sizeof( float ) * ( 1 << PRED_QUANT_FILTER_PHASE_BITS ) ); + + for ( n = 0; n < ( 1 << PRED_QUNAT_FILTER_MAG_BITS ); n++ ) + { + const float fInvMagScale = M_PI / ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f ); + psPredictionDecoder->pfMagLUT[n] = sinf( fInvMagScale * (float) n ); + } + + for ( n = 0; n < ( 1 << PRED_QUANT_FILTER_PHASE_BITS ); n++ ) + { + const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ); + int32_t iVal; + + iVal = n + PRED_QUANT_FILTER_PHASE_MIN; + psPredictionDecoder->pfP2RRealLUT[n] = cosf( fInvPhaseScale * (float) iVal ); + psPredictionDecoder->pfP2RImagLUT[n] = sinf( fInvPhaseScale * (float) iVal ); + } + + + return psPredictionDecoder; +} + +void DeletePredictionDecoder( PredictionDecoder *psPredictionDecoder ) +{ + int32_t n; + + for ( n = 0; n < psPredictionDecoder->iChannels; n++ ) + { + count_free( psPredictionDecoder->ppfEstPredGain[n] ); + count_free( psPredictionDecoder->ppiPredBandEnable[n] ); + count_free( psPredictionDecoder->ppfA1Real[n] ); + count_free( psPredictionDecoder->ppfA1Imag[n] ); + count_free( psPredictionDecoder->ppiA1Mag[n] ); + count_free( psPredictionDecoder->ppiA1Phase[n] ); + } + count_free( psPredictionDecoder->piPredChanEnable ); + count_free( psPredictionDecoder->piNumPredBands ); + count_free( psPredictionDecoder->ppfEstPredGain ); + count_free( psPredictionDecoder->ppiPredBandEnable ); + count_free( psPredictionDecoder->ppfA1Real ); + count_free( psPredictionDecoder->ppfA1Imag ); + count_free( psPredictionDecoder->ppiA1Mag ); + count_free( psPredictionDecoder->ppiA1Phase ); + + count_free( psPredictionDecoder->pfMagLUT ); + count_free( psPredictionDecoder->pfP2RRealLUT ); + count_free( psPredictionDecoder->pfP2RImagLUT ); + + count_free( psPredictionDecoder ); +} +#define USE_TABLE_LOOKUP +int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsRead = 0; + int32_t c; + + for ( c = 0; c < psPredictionDecoder->iChannels; c++ ) + { + psPredictionDecoder->piPredChanEnable[c] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + + if ( psPredictionDecoder->piPredChanEnable[c] ) + { + int32_t b; + + for ( b = 0; b < CQMF_BANDS; b++ ) + { + psPredictionDecoder->ppiPredBandEnable[c][b] = 0; + } + psPredictionDecoder->piNumPredBands[c] = ivas_split_rend_bitstream_read_int32( pBits, 6 ); + iBitsRead += 6; + + for ( b = 0; b < psPredictionDecoder->piNumPredBands[c]; b++ ) + { + psPredictionDecoder->ppiPredBandEnable[c][b] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + iBitsRead += 1; + + if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 ) + { +#ifdef USE_TABLE_LOOKUP + int32_t iA1Mag; + int32_t iA1Phase; + float fA1Real; + float fA1Imag; + iA1Mag = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUNAT_FILTER_MAG_BITS ); + iBitsRead += PRED_QUNAT_FILTER_MAG_BITS; + iA1Phase = ivas_split_rend_bitstream_read_int32( pBits, PRED_QUANT_FILTER_PHASE_BITS ); + iBitsRead += PRED_QUANT_FILTER_PHASE_BITS; + + psPredictionDecoder->ppiA1Mag[c][b] = iA1Mag; + psPredictionDecoder->ppiA1Phase[c][b] = iA1Phase + PRED_QUANT_FILTER_PHASE_MIN; + + fA1Real = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RRealLUT[iA1Phase]; + fA1Imag = psPredictionDecoder->pfMagLUT[iA1Mag] * psPredictionDecoder->pfP2RImagLUT[iA1Phase]; + + psPredictionDecoder->ppfA1Real[c][b] = fA1Real; + psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag; +#else + const float fInvMagScale = M_PI / ( 2.0 * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0 ); + const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ); + int32_t iA1Mag; + int32_t iA1Phase; + float fA1Mag; + float fA1Phase; + float fA1Real; + float fA1Imag; + + iA1Mag = BSGetBits( psBSRead, PRED_QUNAT_FILTER_MAG_BITS ); + iBitsRead += PRED_QUNAT_FILTER_MAG_BITS; + + iA1Phase = BSGetBits( psBSRead, PRED_QUANT_FILTER_PHASE_BITS ); + iBitsRead += PRED_QUANT_FILTER_PHASE_BITS; + iA1Phase += PRED_QUANT_FILTER_PHASE_MIN; + + psPredictionDecoder->ppiA1Mag[c][b] = iA1Mag; + psPredictionDecoder->ppiA1Phase[c][b] = iA1Phase; + + fA1Mag = sinf( fInvMagScale * (float) iA1Mag ); + fA1Phase = fInvPhaseScale * (float) iA1Phase; + + fA1Real = fA1Mag * cosf( fA1Phase ); + fA1Imag = fA1Mag * sinf( fA1Phase ); + + psPredictionDecoder->ppfA1Real[c][b] = fA1Real; + psPredictionDecoder->ppfA1Imag[c][b] = fA1Imag; + + // printf("Dec %f\t%f\t%f\n",fA1Real,fA1Imag,fA1Real * fA1Real + fA1Imag * fA1Imag); +#endif + } + } + } + else + { + int32_t b; + for ( b = 0; b < CQMF_BANDS; b++ ) + { + psPredictionDecoder->ppiPredBandEnable[c][b] = 0; + } + } + } + + return iBitsRead; +} + +void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder, + float ***pppfReal, + float ***pppfImag ) +{ + int32_t c; + for ( c = 0; c < psPredictionDecoder->iChannels; c++ ) + { + if ( psPredictionDecoder->piPredChanEnable[c] == 1 ) + { + int32_t b; + for ( b = 0; b < psPredictionDecoder->piNumPredBands[c]; b++ ) + { + if ( psPredictionDecoder->ppiPredBandEnable[c][b] == 1 ) + { + int32_t n; + float fA1Real; + float fA1Imag; + + fA1Real = psPredictionDecoder->ppfA1Real[c][b]; + fA1Imag = psPredictionDecoder->ppfA1Imag[c][b]; + for ( n = 1; n < psPredictionDecoder->iNumBlocks; n++ ) + { + float fReal; + float fImag; + + fReal = pppfReal[c][n][b] - fA1Real * pppfReal[c][n - 1][b] + fA1Imag * pppfImag[c][n - 1][b]; + fImag = pppfImag[c][n][b] - fA1Real * pppfImag[c][n - 1][b] - fA1Imag * pppfReal[c][n - 1][b]; + + pppfReal[c][n][b] = fReal; + pppfImag[c][n][b] = fImag; + } + } + } + } + } +} diff --git a/lib_rend/ivas_PredDecoder.h b/lib_rend/ivas_PredDecoder.h new file mode 100644 index 0000000000..435c4f2238 --- /dev/null +++ b/lib_rend/ivas_PredDecoder.h @@ -0,0 +1,84 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_PRED_DECODER_H_ +#define _IVAS_PRED_DECODER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ivas_cldfb_codec_bitstream.h" + + // typedef struct PREDICTION_DECODER PredictionDecoder; + + typedef struct PREDICTION_DECODER + { + int32_t iChannels; + int32_t iNumBlocks; + + int32_t *piPredChanEnable; + int32_t *piNumPredBands; + + float **ppfEstPredGain; + int32_t **ppiPredBandEnable; + + float **ppfA1Real; + float **ppfA1Imag; + + int32_t **ppiA1Mag; + int32_t **ppiA1Phase; + + float *pfMagLUT; + float *pfP2RRealLUT; + float *pfP2RImagLUT; + } PredictionDecoder; + + PredictionDecoder *CreatePredictionDecoder( const int32_t iChannels, + const int32_t iNumBlocks ); + + void DeletePredictionDecoder( PredictionDecoder *psPredictionDecoder ); + + int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder, + ivas_split_rend_bits_t *pBits ); + + void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder, + float ***pppfReal, + float ***pppfImag ); + + +#ifdef __cplusplus +} +#endif + +#endif /* _PRED_DECODER_H_ */ diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c new file mode 100644 index 0000000000..fc8bd14502 --- /dev/null +++ b/lib_rend/ivas_PredEncoder.c @@ -0,0 +1,476 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_PredEncoder.h" +#include +#include +#include +#include "ivas_Tables.h" +#include "ivas_PredTables.h" +#include "options.h" +#include "prot.h" +#include "wmops.h" +#include "ivas_cldfb_codec_bitstream.h" + + +PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels, + const int32_t iNumBlocks ) +{ + int32_t n; + + PredictionEncoder *psPredictionEncoder = NULL; + + psPredictionEncoder = (PredictionEncoder *) count_malloc( sizeof( PredictionEncoder ) ); + + psPredictionEncoder->iChannels = iChannels; + psPredictionEncoder->iNumBlocks = iNumBlocks; + + psPredictionEncoder->pfWindow = (float *) count_malloc( sizeof( float ) * iNumBlocks ); + for ( n = 0; n < iNumBlocks; n++ ) + { + psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) iNumBlocks ); + } + + + psPredictionEncoder->pfRxxReal = (float *) count_malloc( sizeof( float ) * 2 ); + psPredictionEncoder->pfRxxImag = (float *) count_malloc( sizeof( float ) * 2 ); + + psPredictionEncoder->piPredChanEnable = (int32_t *) count_malloc( sizeof( int32_t ) * iChannels ); + psPredictionEncoder->piNumPredBands = (int32_t *) count_malloc( sizeof( int32_t ) * iChannels ); + for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) + { + psPredictionEncoder->piPredChanEnable[n] = 0; + psPredictionEncoder->piNumPredBands[n] = 40; // Will need to be set correctly + } + + psPredictionEncoder->ppfEstPredGain = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionEncoder->ppfEstPredBitGain = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionEncoder->ppiPredBandEnable = (int32_t **) count_malloc( sizeof( int32_t * ) * iChannels ); + psPredictionEncoder->ppfA1Real = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionEncoder->ppfA1Imag = (float **) count_malloc( sizeof( float * ) * iChannels ); + psPredictionEncoder->ppiA1Mag = (int32_t **) count_malloc( sizeof( int32_t * ) * iChannels ); + psPredictionEncoder->ppiA1Phase = (int32_t **) count_malloc( sizeof( int32_t * ) * iChannels ); + for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) + { + int32_t k; + + psPredictionEncoder->ppfEstPredGain[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionEncoder->ppfEstPredBitGain[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionEncoder->ppiPredBandEnable[n] = (int32_t *) count_malloc( sizeof( int32_t ) * CQMF_BANDS ); + psPredictionEncoder->ppfA1Real[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionEncoder->ppfA1Imag[n] = (float *) count_malloc( sizeof( float ) * CQMF_BANDS ); + psPredictionEncoder->ppiA1Mag[n] = (int32_t *) count_malloc( sizeof( int32_t ) * CQMF_BANDS ); + psPredictionEncoder->ppiA1Phase[n] = (int32_t *) count_malloc( sizeof( int32_t ) * CQMF_BANDS ); + for ( k = 0; k < CQMF_BANDS; k++ ) + { + psPredictionEncoder->ppiPredBandEnable[n][k] = 0; + psPredictionEncoder->ppfA1Real[n][k] = 0.0; + psPredictionEncoder->ppfA1Imag[n][k] = 0.0; + } + } + + return psPredictionEncoder; +} + +void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) +{ + int32_t n; + + count_free( psPredictionEncoder->pfWindow ); + count_free( psPredictionEncoder->pfRxxReal ); + count_free( psPredictionEncoder->pfRxxImag ); + + for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) + { + count_free( psPredictionEncoder->ppfEstPredGain[n] ); + count_free( psPredictionEncoder->ppfEstPredBitGain[n] ); + count_free( psPredictionEncoder->ppiPredBandEnable[n] ); + count_free( psPredictionEncoder->ppfA1Real[n] ); + count_free( psPredictionEncoder->ppfA1Imag[n] ); + count_free( psPredictionEncoder->ppiA1Mag[n] ); + count_free( psPredictionEncoder->ppiA1Phase[n] ); + } + count_free( psPredictionEncoder->piPredChanEnable ); + count_free( psPredictionEncoder->piNumPredBands ); + count_free( psPredictionEncoder->ppfEstPredGain ); + count_free( psPredictionEncoder->ppfEstPredBitGain ); + count_free( psPredictionEncoder->ppiPredBandEnable ); + count_free( psPredictionEncoder->ppfA1Real ); + count_free( psPredictionEncoder->ppfA1Imag ); + count_free( psPredictionEncoder->ppiA1Mag ); + count_free( psPredictionEncoder->ppiA1Phase ); + + count_free( psPredictionEncoder ); +} +//#define USE_RXX_WINDOW +int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, + float ***pppfReal, + float ***pppfImag ) +{ + int32_t c; + int32_t iPredictionBits = 0; + + for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) + { + int32_t b; + float fChanPredictionGainBits; + psPredictionEncoder->piNumPredBands[c] = 50; + fChanPredictionGainBits = 0.0; + for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) + { + int32_t n; + int32_t iNumBlocks; + float fGain = 0.0; + float fBitGain = 0.0; + float *pfRxxReal; + float *pfRxxImag; + float fA1Real; + float fA1Imag; + // int32_t iA1Real; + // int32_t iA1Imag; + int32_t iA1Mag; + int32_t iA1Phase; + + iNumBlocks = psPredictionEncoder->iNumBlocks; + + pfRxxReal = psPredictionEncoder->pfRxxReal; + pfRxxImag = psPredictionEncoder->pfRxxImag; + + pfRxxReal[0] = 0.0; + pfRxxImag[0] = 0.0; + for ( n = 0; n < iNumBlocks; n++ ) + { +#ifdef USE_RXX_WINDOW + float fReal; + float fImag; + fReal = psPredictionEncoder->pfWindow[n] * pppfReal[c][n][b]; + fImag = psPredictionEncoder->pfWindow[n] * pppfImag[c][n][b]; + pfRxxReal[0] += ( fReal * fReal + fImag * fImag ); +#else + pfRxxReal[0] += ( pppfReal[c][n][b] * pppfReal[c][n][b] + pppfImag[c][n][b] * pppfImag[c][n][b] ); +#endif + } + + pfRxxReal[1] = 0.0; + pfRxxImag[1] = 0.0; + for ( n = 1; n < iNumBlocks; n++ ) + { +#ifdef USE_RXX_WINDOW + float fReal1; + float fImag1; + float fReal2; + float fImag2; + fReal1 = psPredictionEncoder->pfWindow[n] * pppfReal[c][n][b]; + fImag1 = psPredictionEncoder->pfWindow[n] * pppfImag[c][n][b]; + fReal2 = psPredictionEncoder->pfWindow[n - 1] * pppfReal[c][n - 1][b]; + fImag2 = psPredictionEncoder->pfWindow[n - 1] * pppfImag[c][n - 1][b]; + pfRxxReal[1] += ( fReal1 * fReal2 + fImag1 * fImag2 ); + pfRxxImag[1] += ( fImag1 * fReal2 - fReal1 * fImag2 ); +#else + pfRxxReal[1] += ( pppfReal[c][n][b] * pppfReal[c][n - 1][b] + pppfImag[c][n][b] * pppfImag[c][n - 1][b] ); + pfRxxImag[1] += ( pppfImag[c][n][b] * pppfReal[c][n - 1][b] - pppfReal[c][n][b] * pppfImag[c][n - 1][b] ); +#endif + } + + if ( pfRxxReal[0] > 1e-12f ) + { + float fA1Mag; + float fA1Phase; + float fGain2; + float fBitGain2; + + const float fMagScale = ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f ) / M_PI; + const float fInvMagScale = M_PI / ( 2.0f * (float) ( 1 << ( PRED_QUNAT_FILTER_MAG_BITS ) ) + 1.0f ); + const float fPhaseScale = (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ) / M_PI; + const float fInvPhaseScale = M_PI / (float) ( 1 << ( PRED_QUANT_FILTER_PHASE_BITS - 1 ) ); + + // Compute filter coefficeints + fA1Real = -pfRxxReal[1] / pfRxxReal[0]; + fA1Imag = -pfRxxImag[1] / pfRxxReal[0]; + + // compute these before quant + // Compute est coding gain based on quantized filter coefficients + fGain = 1.0f / ( 1.0f - fA1Real * fA1Real - fA1Imag * fA1Imag ); + fBitGain = 0.6f * log2f( fGain ) * (float) ( iNumBlocks ) - (float) ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); // Wrong fix (iNumBlocks-1) + + fA1Mag = sqrtf( fA1Real * fA1Real + fA1Imag * fA1Imag ); + fA1Mag = fMagScale * asinf( fA1Mag ); + iA1Mag = (int32_t) ( fA1Mag + 0.5f ); + iA1Mag = ( iA1Mag > PRED_QUANT_FILTER_MAG_MIN ) ? iA1Mag : PRED_QUANT_FILTER_MAG_MIN; + iA1Mag = ( iA1Mag < PRED_QUANT_FILTER_MAG_MAX ) ? iA1Mag : PRED_QUANT_FILTER_MAG_MAX; + fA1Mag = sinf( fInvMagScale * (float) iA1Mag ); + + fA1Phase = atan2f( fA1Imag, fA1Real ); + fA1Phase = fPhaseScale * fA1Phase; + iA1Phase = ( fA1Phase > 0.0f ) ? (int32_t) ( fA1Phase + 0.5f ) : (int32_t) ( fA1Phase - 0.5f ); + iA1Phase = ( iA1Phase > PRED_QUANT_FILTER_PHASE_MIN ) ? iA1Phase : PRED_QUANT_FILTER_PHASE_MIN; + iA1Phase = ( iA1Phase < PRED_QUANT_FILTER_PHASE_MAX ) ? iA1Phase : PRED_QUANT_FILTER_PHASE_MAX; // Is this the correct way to deal with this? should wrap? + fA1Phase = fInvPhaseScale * (float) iA1Phase; + + fA1Real = fA1Mag * cosf( fA1Phase ); + fA1Imag = fA1Mag * sinf( fA1Phase ); + + fGain2 = 1.0f / ( 1.0f - fA1Real * fA1Real - fA1Imag * fA1Imag ); + fBitGain2 = 0.6f * log2f( fGain ) * (float) ( iNumBlocks ) - (float) ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); // Wrong fix (iNumBlocks-1) + + fGain = ( fGain < fGain2 ) ? fGain : fGain2; + fBitGain = ( fBitGain < fBitGain2 ) ? fBitGain : fBitGain2; + } + else + { + psPredictionEncoder->ppfEstPredGain[c][b] = 0.0f; + fA1Real = 0.0f; + fA1Imag = 0.0f; + // iA1Real = 0; + // iA1Imag = 0; + iA1Mag = 0; + iA1Phase = 0; + fGain = -10.0f; // Fix this + } + + psPredictionEncoder->ppfEstPredGain[c][b] = fGain; + psPredictionEncoder->ppfEstPredBitGain[c][b] = fBitGain; + psPredictionEncoder->ppiPredBandEnable[c][b] = ( fBitGain > 0 ) ? 1 : 0; // Initial prediction enable + psPredictionEncoder->ppfA1Real[c][b] = fA1Real; + psPredictionEncoder->ppfA1Imag[c][b] = fA1Imag; + psPredictionEncoder->ppiA1Mag[c][b] = iA1Mag; + psPredictionEncoder->ppiA1Phase[c][b] = iA1Phase; + + if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) + { + fChanPredictionGainBits += fBitGain; // change this calculation + } + } +#if 0 + // Estimate if the savings outway the signaling cost + if(fChanPredictionGainBits > 1e20){//}(float)(psPredictionEncoder->piNumPredBands[c] + 6)){ + psPredictionEncoder->piPredChanEnable[c] = 1; + //printf("Prediction Enabled\n"); + iPredictionBits += 1; + iPredictionBits += 6; + for(b = 0; b < psPredictionEncoder->piNumPredBands[c]; b ++){ + iPredictionBits += 1; + if(psPredictionEncoder->ppiPredBandEnable[c][b] == 1){ + iPredictionBits += (PRED_QUANT_FILTER_BITS * 2); + printf("%f, ",(psPredictionEncoder->ppfEstPredGain[c][b])); + } + } + printf("\n"); + } + else{ + psPredictionEncoder->piPredChanEnable[c] = 0; + for(b = 0; b < psPredictionEncoder->piNumPredBands[c]; b ++){ + psPredictionEncoder->ppiPredBandEnable[c][b] = 0; + } + //printf("Prediction Disabled\n"); + iPredictionBits += 1; + } +#else + { + /*int32_t iDone; + int32_t iPredBands; + + iDone = 0; + iPredBands = 30; + while(iPredBands > 0 && iDone == 0){ + int32_t b; + float fBitGain; + + fBitGain = -7.0; + for(b = 0; b < iPredBands; b ++){ + fBitGain -= 1.0; + if(psPredictionEncoder->ppiPredBandEnable[c][b] == 1){ + fBitGain += psPredictionEncoder->ppfEstPredBitGain[c][b]; + } + } + if(fBitGain > 0.0){ //thresh + iDone ++; + } + else{ + iPredBands --; + } + }*/ + // int32_t b; + float fBestCost; + int32_t iPredBands; + float fBitGain; + + fBestCost = 0.0; + iPredBands = 0; + fBitGain = -7.0; + for ( b = 0; b < 30; b++ ) + { // still getting this decision wrong! + fBitGain -= 1.0; + if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) + { + fBitGain += psPredictionEncoder->ppfEstPredBitGain[c][b]; + } + if ( fBitGain > fBestCost ) + { + fBestCost = fBitGain; + iPredBands = b; + } + } + + // printf("%d\t%f\n",iPredBands,fBestCost); + /*if(fBestCost < 300.0){ + iPredBands = 0; + }*/ + + if ( iPredBands > 0 ) + { + // int32_t b; + iPredictionBits += 1; + iPredictionBits += 6; + for ( b = 0; b < iPredBands; b++ ) + { + iPredictionBits += 1; + if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) + { + iPredictionBits += ( PRED_QUNAT_FILTER_MAG_BITS + PRED_QUANT_FILTER_PHASE_BITS ); + } + } + for ( b = iPredBands; b < CQMF_BANDS; b++ ) + { + psPredictionEncoder->ppiPredBandEnable[c][b] = 0; + } + psPredictionEncoder->piPredChanEnable[c] = 1; + psPredictionEncoder->piNumPredBands[c] = iPredBands; + } + else + { + // int32_t b; + iPredictionBits += 1; + for ( b = 0; b < CQMF_BANDS; b++ ) + { + psPredictionEncoder->ppiPredBandEnable[c][b] = 0; + } + psPredictionEncoder->piPredChanEnable[c] = 0; + psPredictionEncoder->piNumPredBands[c] = 0; + } + } +#endif + } + + return iPredictionBits; +} + +void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, + float ***pppfReal, + float ***pppfImag ) +{ + int32_t c; + for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) + { + int32_t b; + if ( psPredictionEncoder->piPredChanEnable[c] == 1 ) + { + for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) + { + if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) + { + int32_t n; + float fOldReal; + float fOldImag; + float fA1Real; + float fA1Imag; + + fOldReal = pppfReal[c][0][b]; + fOldImag = pppfImag[c][0][b]; + fA1Real = psPredictionEncoder->ppfA1Real[c][b]; + fA1Imag = psPredictionEncoder->ppfA1Imag[c][b]; + for ( n = 1; n < psPredictionEncoder->iNumBlocks; n++ ) + { + float fReal; + float fImag; + + fReal = pppfReal[c][n][b] + fA1Real * fOldReal - fA1Imag * fOldImag; + fImag = pppfImag[c][n][b] + fA1Real * fOldImag + fA1Imag * fOldReal; + + fOldReal = pppfReal[c][n][b]; + fOldImag = pppfImag[c][n][b]; + + pppfReal[c][n][b] = fReal; + pppfImag[c][n][b] = fImag; + } + } + } + } + } +} + +int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, + ivas_split_rend_bits_t *pBits ) +{ + int32_t iBitsWritten = 0; + int32_t c; + + for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) + { + int32_t b; + ivas_split_rend_bitstream_write_int32( + pBits, psPredictionEncoder->piPredChanEnable[c], + 1 ); + iBitsWritten += 1; + + if ( psPredictionEncoder->piPredChanEnable[c] == 1 ) + { + ivas_split_rend_bitstream_write_int32( + pBits, psPredictionEncoder->piNumPredBands[c], 6 ); + iBitsWritten += 6; + + for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) + { + ivas_split_rend_bitstream_write_int32( + pBits, psPredictionEncoder->ppiPredBandEnable[c][b], 1 ); + iBitsWritten += 1; + + if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) + { + int32_t iA1Mag; + int32_t iA1Phase; + + iA1Mag = psPredictionEncoder->ppiA1Mag[c][b]; + iA1Phase = psPredictionEncoder->ppiA1Phase[c][b] - PRED_QUANT_FILTER_PHASE_MIN; + ivas_split_rend_bitstream_write_int32( + pBits, iA1Mag, PRED_QUNAT_FILTER_MAG_BITS ); + iBitsWritten += PRED_QUNAT_FILTER_MAG_BITS; + ivas_split_rend_bitstream_write_int32( + pBits, iA1Phase, PRED_QUANT_FILTER_PHASE_BITS ); + iBitsWritten += PRED_QUANT_FILTER_PHASE_BITS; + } + } + } + } + + return iBitsWritten; +} diff --git a/lib_rend/ivas_PredEncoder.h b/lib_rend/ivas_PredEncoder.h new file mode 100644 index 0000000000..5ebbe7b48d --- /dev/null +++ b/lib_rend/ivas_PredEncoder.h @@ -0,0 +1,88 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_PRED_ENCODER_H_ +#define _IVAS_PRED_ENCODER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "ivas_cldfb_codec_bitstream.h" + + typedef struct PREDICTION_ENCODER + { + int32_t iChannels; + int32_t iNumBlocks; + + float *pfWindow; + float *pfRxxReal; + float *pfRxxImag; + + int32_t *piPredChanEnable; + int32_t *piNumPredBands; + + float **ppfEstPredGain; + float **ppfEstPredBitGain; + int32_t **ppiPredBandEnable; + + float **ppfA1Real; + float **ppfA1Imag; + + int32_t **ppiA1Mag; + int32_t **ppiA1Phase; + } PredictionEncoder; + + PredictionEncoder *CreatePredictionEncoder( const int32_t iChannels, + const int32_t iNumBlocks ); + + void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ); + + int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, + float ***pppfReal, + float ***pppfImag ); + + void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, + float ***pppfReal, + float ***pppfImag ); + + + int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, + ivas_split_rend_bits_t *pBits ); + + +#ifdef __cplusplus +} +#endif + +#endif /* _PRED_ENCODER_H_ */ diff --git a/lib_rend/ivas_PredTables.h b/lib_rend/ivas_PredTables.h new file mode 100644 index 0000000000..ee9caf425a --- /dev/null +++ b/lib_rend/ivas_PredTables.h @@ -0,0 +1,53 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_PRED_TABLE_H_ +#define _IVAS_PRED_TABLE_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#define PRED_QUNAT_FILTER_MAG_BITS (3) +#define PRED_QUANT_FILTER_PHASE_BITS (5) +#define PRED_QUANT_FILTER_MAG_MIN (0) +#define PRED_QUANT_FILTER_MAG_MAX (7) +#define PRED_QUANT_FILTER_PHASE_MIN (-16) +#define PRED_QUANT_FILTER_PHASE_MAX (15) + +#ifdef __cplusplus +} +#endif + +#endif /* _PRED_TABLE_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c b/lib_rend/ivas_RMSEnvDeltaHuff.c similarity index 61% rename from lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c rename to lib_rend/ivas_RMSEnvDeltaHuff.c index 9e314fcd08..16e2ee0f49 100644 --- a/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.c +++ b/lib_rend/ivas_RMSEnvDeltaHuff.c @@ -1,7 +1,40 @@ -#include "RMSEnvDeltaHuff.h" +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_RMSEnvDeltaHuff.h" #include "wmops.h" -const unsigned int c_aaiRMSEnvHuffEnc[64][2] = +/* clang-format off */ +const uint32_t c_aaiRMSEnvHuffEnc[64][2] = { {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0012, 0x000b}, {0x000d, 0x0002}, {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000d, 0x0003}, @@ -13,7 +46,7 @@ const unsigned int c_aaiRMSEnvHuffEnc[64][2] = {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, }; -const unsigned int c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = +const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = { {0x0002ffff, 0x0001ffff, 0x0000001d, 0x00000022, 0x0001001e, 0x0001001e, 0x00010021, 0x00010021, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, @@ -29,3 +62,4 @@ const unsigned int c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = {0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, }, {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, }; +/* clang-format on */ \ No newline at end of file diff --git a/lib_rend/ivas_RMSEnvDeltaHuff.h b/lib_rend/ivas_RMSEnvDeltaHuff.h new file mode 100644 index 0000000000..13120d100e --- /dev/null +++ b/lib_rend/ivas_RMSEnvDeltaHuff.h @@ -0,0 +1,57 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_RMS_ENV_DELTA_HUFF_H_ +#define _IVAS_RMS_ENV_DELTA_HUFF_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef HUFF_READ_SIZE +#define HUFF_READ_SIZE (4) +#endif + +#ifndef HUFF_DEC_TABLE_SIZE +#define HUFF_DEC_TABLE_SIZE (16) +#endif +#include +extern const uint32_t c_aaiRMSEnvHuffEnc[64][2]; + +extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; + +#ifdef __cplusplus +} +#endif + +#endif /* _RMS_ENV_DELTA_HUFF_H_ */ diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c new file mode 100644 index 0000000000..061678770b --- /dev/null +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -0,0 +1,922 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_RMSEnvGrouping.h" + +/* Double check cost function calculation */ + +#include +#include +#include +#include +#include "options.h" +#include "prot.h" +#include "wmops.h" +#include "ivas_Tables.h" +#include "ivas_RMSEnvDeltaHuff.h" // To compute RMS transmission cost + + +typedef struct GMNODE +{ + int32_t iGroupStart; + int32_t iGroupLength; + float *pfMergedEnergydB; + int32_t *piQRMSEnvelope; + + int32_t iGroupRMSEnvelopeCost; + float fGroupSNRPenalty; + + struct GMNODE *psNext; +} GMNode; + +struct RMS_ENVELOPE_GROUPING +{ + int32_t iNumBlocks; + int32_t iMaxGroups; + float **ppfBandEnergy; + float **ppfBandEnergydB; + float **ppfWeight; + GMNode *psGMNodes; +}; + +RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks ) +{ + int32_t n; + // assert( ( iNumBlocks & 0x1 ) == 0 ); // remove this + + RMSEnvelopeGrouping *psRMSEnvelopeGrouping; + + psRMSEnvelopeGrouping = (RMSEnvelopeGrouping *) count_malloc( sizeof( RMSEnvelopeGrouping ) ); + psRMSEnvelopeGrouping->iNumBlocks = iNumBlocks; +#ifdef FORCE_GROUPS_OF_2 + psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks >> 1; +#else + psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks; +#endif + + psRMSEnvelopeGrouping->ppfBandEnergy = (float **) count_malloc( psRMSEnvelopeGrouping->iNumBlocks * sizeof( float * ) ); + psRMSEnvelopeGrouping->ppfBandEnergydB = (float **) count_malloc( psRMSEnvelopeGrouping->iNumBlocks * sizeof( float * ) ); + psRMSEnvelopeGrouping->ppfWeight = (float **) count_malloc( psRMSEnvelopeGrouping->iNumBlocks * sizeof( float * ) ); + for ( n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n++ ) + { + psRMSEnvelopeGrouping->ppfBandEnergy[n] = (float *) count_malloc( MAX_BANDS * 2 * sizeof( float ) ); /* 2 for stereo joint group calc */ + psRMSEnvelopeGrouping->ppfBandEnergydB[n] = (float *) count_malloc( MAX_BANDS * 2 * sizeof( float ) ); + psRMSEnvelopeGrouping->ppfWeight[n] = (float *) count_malloc( MAX_BANDS * 2 * sizeof( float ) ); + } + + psRMSEnvelopeGrouping->psGMNodes = (GMNode *) count_malloc( psRMSEnvelopeGrouping->iNumBlocks * sizeof( GMNode ) ); + for ( n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n++ ) + { + psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB = (float *) count_malloc( MAX_BANDS * 2 * sizeof( float ) ); + psRMSEnvelopeGrouping->psGMNodes[n].piQRMSEnvelope = (int32_t *) count_malloc( MAX_BANDS * 2 * sizeof( int32_t ) ); + psRMSEnvelopeGrouping->psGMNodes[n].iGroupRMSEnvelopeCost = -1; + psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty = -1.0; + } + + return psRMSEnvelopeGrouping; +} + +void DeleteRMSEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping ) +{ + int32_t n; + + for ( n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n++ ) + { + count_free( psRMSEnvelopeGrouping->ppfBandEnergy[n] ); + count_free( psRMSEnvelopeGrouping->ppfBandEnergydB[n] ); + count_free( psRMSEnvelopeGrouping->ppfWeight[n] ); + } + count_free( psRMSEnvelopeGrouping->ppfBandEnergy ); + count_free( psRMSEnvelopeGrouping->ppfBandEnergydB ); + count_free( psRMSEnvelopeGrouping->ppfWeight ); + + for ( n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n++ ) + { + count_free( psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB ); + count_free( psRMSEnvelopeGrouping->psGMNodes[n].piQRMSEnvelope ); + } + count_free( psRMSEnvelopeGrouping->psGMNodes ); + + count_free( psRMSEnvelopeGrouping ); +} + +const float c_afThreshQuiet48[23] = { + -8.40653699e+01f, + -8.40653699e+01f, + -8.40653699e+01f, + -8.40653699e+01f, + -8.40653699e+01f, + -8.40653699e+01f, + -8.40653699e+01f, + -8.40653699e+01f, + -8.38067304e+01f, + -8.28409495e+01f, + -8.17031225e+01f, + -7.89799501e+01f, + -7.70607916e+01f, + -7.58484320e+01f, + -7.47976303e+01f, + -7.37491303e+01f, + -7.13163746e+01f, + -6.86144293e+01f, + -6.56295695e+01f, + -6.06521800e+01f, + -3.15408065e+01f, + -1.92542188e+01f, + -1.88401753e+01f, +}; + +static void ComputeBandEnergy( const int32_t iChannels, + const int32_t iNumBlocks, + const int32_t iNumBands, + const int32_t *piBandwidths, + float ***pppfReal, + float ***pppfImag, + float **ppfBandEnergy, + float **ppfBandEnergydB, + float **ppfWeight ) +{ + int32_t n; + + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; + int32_t iChanOffset; + + iChanOffset = n * iNumBands; + for ( k = 0; k < iNumBlocks; k++ ) + { + int32_t b; + int32_t iFBOffset; + float fMaxWeight; + + + iFBOffset = 0; + fMaxWeight = 0.0f; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t m; + float fEnergy = 1e-12f; + float fWeight; + + for ( m = 0; m < piBandwidths[b]; m++ ) + { + fEnergy += ( pppfReal[n][k][iFBOffset] * pppfReal[n][k][iFBOffset] + pppfImag[n][k][iFBOffset] * pppfImag[n][k][iFBOffset] ); + iFBOffset++; + } + fEnergy /= (float) ( piBandwidths[b] ); // Correction removed normalization by 2 + ppfBandEnergy[k][iChanOffset + b] = fEnergy; + + fWeight = 0.33f * powf( 10.0f, 0.0068f * ( 10.0f * log10f( fEnergy ) - c_afThreshQuiet48[b] ) ); + fWeight = ( fWeight > 0.33f ) ? fWeight : 0.33f; + fWeight = ( fWeight < 1.0f ) ? fWeight : 1.0f; + fMaxWeight = ( fMaxWeight > fWeight ) ? fMaxWeight : fWeight; + ppfWeight[k][iChanOffset + b] = fWeight; + +#ifdef APPLY_TEMPORAL_SMOOTHING + if ( k > 0 ) + { + float fSmoothEnergy; + fSmoothEnergy = 0.7f * ppfBandEnergy[k - 1][iChanOffset + b] + 0.3f * fEnergy; + + fEnergy = ( fEnergy > fSmoothEnergy ) ? fEnergy : fSmoothEnergy; + } +#endif + fEnergy = 10.0f * log10f( fEnergy ); + ppfBandEnergydB[k][iChanOffset + b] = fEnergy; + } + for ( b = 0; b < iNumBands; b++ ) + { + ppfWeight[k][iChanOffset + b] /= fMaxWeight; + } + } + } +} + +/* THis is temporary cost function */ +static float TryMerge( const int32_t iNumBands, + const int32_t iStartBlock, + const int32_t iGroupLength, + const float fMaxAllowedDiffdB, + float **ppfBandEnergy, + float **ppfBandEnergydB, +#ifdef APPLY_WEIGHT + float **ppfWeight, +#endif + float *pfMegredEnergydB ) +{ + int32_t b; + int32_t n; + float fMeanCost; + float fMaxCost; + float fMinDiffCost; + float fMaxDiffCost; + float fInvGroupSize = 1.0f / (float) iGroupLength; + float fInvNumBands = 1.0f / (float) iNumBands; + + for ( b = 0; b < iNumBands; b++ ) + { + float fGroupEnergy; + + + fGroupEnergy = 0.0; + for ( n = iStartBlock; n < ( iStartBlock + iGroupLength ); n++ ) + { + fGroupEnergy += ppfBandEnergy[n][b]; + } + fGroupEnergy *= fInvGroupSize; + fGroupEnergy = 10.0f * log10f( fGroupEnergy ); // Note epsolon was added when computing BandEnergy; + + pfMegredEnergydB[b] = fGroupEnergy; + } + + fMeanCost = 0.0; + fMaxCost = 0.0; + fMinDiffCost = 0.0; + fMaxDiffCost = 0.0; + for ( n = iStartBlock; n < ( iStartBlock + iGroupLength ); n++ ) + { + float fMeanAbsDiff; + float fMaxAbsDiff; + float fMaxDiff; + float fMinDiff; + + fMeanAbsDiff = 0.0; + fMaxAbsDiff = 0.0; + fMaxDiff = 0.0; + fMinDiff = 0.0; + for ( b = 0; b < iNumBands; b++ ) + { + float fDiff; + float fAbsDiff; + + fDiff = pfMegredEnergydB[b] - ppfBandEnergydB[n][b]; // Changed the order of this + fAbsDiff = fabsf( fDiff ); +#ifdef APPLY_WEIGHT + fAbsDiff *= ppfWeight[n][b]; +#endif + + fMeanAbsDiff += fAbsDiff; + fMaxAbsDiff = ( fMaxAbsDiff > fAbsDiff ) ? fMaxAbsDiff : fAbsDiff; + + + fMaxDiff = ( fMaxDiff > fDiff ) ? fMaxDiff : fDiff; + fMinDiff = ( fMinDiff < fDiff ) ? fMinDiff : fDiff; + } + fMeanAbsDiff *= fInvNumBands; + + fMeanCost = ( fMeanCost > fMeanAbsDiff ) ? fMeanCost : fMeanAbsDiff; + fMaxCost = ( fMaxCost > fMaxAbsDiff ) ? fMaxCost : fMaxAbsDiff; + + fMaxDiffCost = ( fMaxDiffCost > fMaxDiff ) ? fMaxDiffCost : fMaxDiff; + fMinDiffCost = ( fMinDiffCost < fMinDiff ) ? fMinDiffCost : fMinDiff; + } + + // printf("%f\t%f\t%f\t%f\n",fMeanCost,fMaxCost,fMaxDiffCost,fMinDiffCost); + + /*if(fMinDiffCost < -9.0){ // This prevents cliping + fMeanCost = 1e12; //Some large value + }*/ + + if ( fMaxCost > fMaxAllowedDiffdB ) + { + fMeanCost = 1e12f; // Some large value + } + + return fMeanCost; +} + +static void ComputeMergeRMS( const int32_t iNumBands, + const int32_t iStartBlock, + const int32_t iGroupLength, + float **ppfBandEnergy, + float *pfMergedEnergydB, + int32_t *piQRMSEnvelope ) +{ + int32_t b; + float fInvGroupSize = 1.0f / (float) iGroupLength; + + for ( b = 0; b < iNumBands; b++ ) + { + int32_t n; + float fGroupEnergy; + float fRMSEnvelope; + int32_t iQRMSEnvelope; + + fGroupEnergy = 0.0; + for ( n = iStartBlock; n < ( iStartBlock + iGroupLength ); n++ ) + { + fGroupEnergy += ppfBandEnergy[n][b]; + } + fGroupEnergy *= fInvGroupSize; + + fRMSEnvelope = log2f( fGroupEnergy ); + iQRMSEnvelope = ( fRMSEnvelope > 0.0 ) ? (int32_t) ( fRMSEnvelope + 0.5 ) : (int32_t) ( fRMSEnvelope - 0.5 ); + + fGroupEnergy = 10.0f * log10f( fGroupEnergy ); // Note epsolon was added when computing BandEnergy; + + pfMergedEnergydB[b] = fGroupEnergy; + piQRMSEnvelope[b] = iQRMSEnvelope; + } +} + + +static int32_t ComputeRMSEnvelopeBits( const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piQRMSEnevelope ) +{ + int32_t n; + int32_t iRMSEnvelopeBits = 0; + int32_t iChanOffset = 0; + + for ( n = 0; n < iChannels; n++ ) + { + int32_t b; + int32_t iLastRMSVal; + + iRMSEnvelopeBits += ENV0_BITS; + iLastRMSVal = piQRMSEnevelope[iChanOffset]; + for ( b = 1; b < iNumBands; b++ ) + { + int32_t iDelta; + + iDelta = piQRMSEnevelope[iChanOffset + b] - iLastRMSVal; + iDelta = ( iDelta > ENV_DELTA_MIN ) ? iDelta : ENV_DELTA_MIN; + iDelta = ( iDelta < ENV_DELTA_MAX ) ? iDelta : ENV_DELTA_MAX; + iDelta -= ENV_DELTA_MIN; + iRMSEnvelopeBits += c_aaiRMSEnvHuffEnc[iDelta][0]; + + iLastRMSVal = piQRMSEnevelope[iChanOffset + b]; + } + iChanOffset += iNumBands; + } + + return iRMSEnvelopeBits; +} + +static const float c_fiDefaultTheta48[MAX_BANDS_48] = { + 0.4375, + 0.4375, + 0.375, + 0.3125, + 0.3125, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, + 0.25, +}; + +static float ComputeSNRPenalty( const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t iStartBlock, + const int32_t iGroupLength, + float **ppfBandEnergydB, + const int32_t *piRMSEnvelope ) +{ + int32_t n; + int32_t iChanOffset; + float fSNRPenalty = 0.0; + + iChanOffset = 0; + for ( n = 0; n < iChannels; n++ ) + { + int32_t b; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t k; + float fRMSVal; + + fRMSVal = 3.0103f * (float) piRMSEnvelope[iChanOffset + b]; + + for ( k = iStartBlock; k < ( iStartBlock + iGroupLength ); k++ ) + { + float fDeltadB; + + fDeltadB = fRMSVal - ppfBandEnergydB[k][iChanOffset + b]; + if ( fDeltadB < -9.0309f ) + { + fSNRPenalty += 1e10f; // Some large number to prevent clipping + } + else /*if(fDeltadB < 0.0)*/ + { + fSNRPenalty += fabsf( c_fiDefaultTheta48[b] * fDeltadB - fDeltadB ) * 2.0f * (float) piBandwidths[b] / 6.0f; + } + } + } + iChanOffset += iNumBands; + } + + + return fSNRPenalty; +} + +static float TryMegre2( const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piBandwidths, + float **ppfBandEnergy, + float **ppfBandEnergydB, + GMNode *psGMNode1, + GMNode *psGMNode2 ) +{ + int32_t iRMSEnvBits1; + int32_t iRMSEnvBits2; + int32_t iRMSEnvBitsMerged; + float fSNRPenalty1; + float fSNRPenalty2; + float fSNRPenaltyMerged; + float fMergedCost = 0.0; + + /* First compute current RMS Envelope for each group */ + if ( psGMNode1->iGroupRMSEnvelopeCost == -1 || psGMNode1->fGroupSNRPenalty == -1.0 ) + { + ComputeMergeRMS( iNumBands * iChannels, + psGMNode1->iGroupStart, + psGMNode1->iGroupLength, + ppfBandEnergy, + psGMNode1->pfMergedEnergydB, + psGMNode1->piQRMSEnvelope ); + + iRMSEnvBits1 = ComputeRMSEnvelopeBits( iChannels, + iNumBands, + psGMNode1->piQRMSEnvelope ); + + fSNRPenalty1 = ComputeSNRPenalty( iChannels, + iNumBands, + piBandwidths, + psGMNode1->iGroupStart, + psGMNode1->iGroupLength, + ppfBandEnergydB, + psGMNode1->piQRMSEnvelope ); + + psGMNode1->iGroupRMSEnvelopeCost = iRMSEnvBits1; + psGMNode1->fGroupSNRPenalty = fSNRPenalty1; + } + else + { + iRMSEnvBits1 = psGMNode1->iGroupRMSEnvelopeCost; + fSNRPenalty1 = psGMNode1->fGroupSNRPenalty; + } + + if ( psGMNode2->iGroupRMSEnvelopeCost == -1 || psGMNode2->fGroupSNRPenalty == -1.0 ) + { + ComputeMergeRMS( iNumBands * iChannels, + psGMNode2->iGroupStart, + psGMNode2->iGroupLength, + ppfBandEnergy, + psGMNode2->pfMergedEnergydB, + psGMNode2->piQRMSEnvelope ); + + iRMSEnvBits2 = ComputeRMSEnvelopeBits( iChannels, + iNumBands, + psGMNode2->piQRMSEnvelope ); + + fSNRPenalty2 = ComputeSNRPenalty( iChannels, + iNumBands, + piBandwidths, + psGMNode2->iGroupStart, + psGMNode2->iGroupLength, + ppfBandEnergydB, + psGMNode2->piQRMSEnvelope ); + + psGMNode2->iGroupRMSEnvelopeCost = iRMSEnvBits2; + psGMNode2->fGroupSNRPenalty = fSNRPenalty2; + } + else + { + iRMSEnvBits2 = psGMNode2->iGroupRMSEnvelopeCost; + fSNRPenalty2 = psGMNode2->fGroupSNRPenalty; + } + + /* Compute the merged group */ + ComputeMergeRMS( iNumBands * iChannels, + psGMNode1->iGroupStart, + psGMNode1->iGroupLength + psGMNode2->iGroupLength, + ppfBandEnergy, + psGMNode1->pfMergedEnergydB, + psGMNode1->piQRMSEnvelope ); + + /* Compute the RMS Envelope cost for merged group */ + iRMSEnvBitsMerged = ComputeRMSEnvelopeBits( iChannels, + iNumBands, + psGMNode1->piQRMSEnvelope ); + + /* Compute an approximation of the bit cost based on SNR increase/decrease due to merging */ + fSNRPenaltyMerged = ComputeSNRPenalty( iChannels, + iNumBands, + piBandwidths, + psGMNode1->iGroupStart, + psGMNode1->iGroupLength + psGMNode2->iGroupLength, + ppfBandEnergydB, + psGMNode1->piQRMSEnvelope ); + + + fMergedCost = fSNRPenaltyMerged - fSNRPenalty1 - fSNRPenalty2 + (float) iRMSEnvBitsMerged - (float) iRMSEnvBits1 - (float) iRMSEnvBits2; + + return fMergedCost; +} + +static void ComputeGreedyGroups( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int32_t iChannels, + const int32_t iNumBands, + const float fMeanAllowedDiffdB, + const float fMaxAllowedDiffdB ) +{ + float fBestMeanCost; + + fBestMeanCost = 0.0; + while ( fBestMeanCost < fMeanAllowedDiffdB ) + { + GMNode *psGMNode; + GMNode *psBestGMNode; + + fBestMeanCost = fMeanAllowedDiffdB; + psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; + psBestGMNode = NULL; + while ( psGMNode->psNext != NULL ) + { + float fMeanCost; + int32_t iGroupLength; + + iGroupLength = psGMNode->iGroupLength + psGMNode->psNext->iGroupLength; + + fMeanCost = TryMerge( iNumBands * iChannels, + psGMNode->iGroupStart, + iGroupLength, // psGMNode->iGroupLength, //Fix this bug + fMaxAllowedDiffdB, + psRMSEnvelopeGrouping->ppfBandEnergy, + psRMSEnvelopeGrouping->ppfBandEnergydB, +#ifdef APPLY_WEIGHT + psRMSEnvelopeGrouping->ppfWeight, +#endif + psGMNode->pfMergedEnergydB ); + + + if ( fMeanCost < fBestMeanCost ) + { + fBestMeanCost = fMeanCost; + psBestGMNode = psGMNode; + } + + psGMNode = psGMNode->psNext; + } + + if ( fBestMeanCost < fMeanAllowedDiffdB && psBestGMNode != NULL && psBestGMNode->psNext != NULL ) + { + psBestGMNode->iGroupLength += psBestGMNode->psNext->iGroupLength; + psBestGMNode->psNext = psBestGMNode->psNext->psNext; + } + } +} + +static void ComputeGreedyGroups2( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piBandwidths ) +{ + float fBestMergeCost; + // int32_t iDone = 0; + fBestMergeCost = -1.0; + + while ( fBestMergeCost < 0.0 ) + { + GMNode *psGMNode; + GMNode *psBestGMNode; + + fBestMergeCost = 0.0; + psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; + psBestGMNode = NULL; + while ( psGMNode->psNext != NULL ) + { + float fMergeCost; + + fMergeCost = TryMegre2( iChannels, + iNumBands, + piBandwidths, + psRMSEnvelopeGrouping->ppfBandEnergy, + psRMSEnvelopeGrouping->ppfBandEnergydB, + psGMNode, + psGMNode->psNext ); + + if ( fMergeCost < fBestMergeCost ) + { + fBestMergeCost = fMergeCost; + psBestGMNode = psGMNode; + } + + psGMNode = psGMNode->psNext; + } + if ( fBestMergeCost < 0.0 && psBestGMNode != NULL && psBestGMNode->psNext != NULL ) + { + psBestGMNode->iGroupLength += psBestGMNode->psNext->iGroupLength; + psBestGMNode->iGroupRMSEnvelopeCost = -1; + psBestGMNode->fGroupSNRPenalty = -1.0; + psBestGMNode->psNext = psBestGMNode->psNext->psNext; + } + } +} + +static void ComputeGreedyGroups3( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piBandwidths, + const int32_t iMaxGroups ) +{ + + int32_t iDone = 0; + int32_t iNumGroups = psRMSEnvelopeGrouping->iMaxGroups; + while ( iDone == 0 ) + { + GMNode *psGMNode; + GMNode *psBestGMNode; + float fBestMergeCost; + + fBestMergeCost = 1e20f; + psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; + psBestGMNode = NULL; + while ( psGMNode->psNext != NULL ) + { + float fMergeCost; + + fMergeCost = TryMegre2( iChannels, + iNumBands, + piBandwidths, + psRMSEnvelopeGrouping->ppfBandEnergy, + psRMSEnvelopeGrouping->ppfBandEnergydB, + psGMNode, + psGMNode->psNext ); + + if ( fMergeCost < fBestMergeCost ) + { + fBestMergeCost = fMergeCost; + psBestGMNode = psGMNode; + } + + psGMNode = psGMNode->psNext; + } + if ( fBestMergeCost > 0.0 && iNumGroups <= iMaxGroups ) + { + iDone++; + } + else if ( psBestGMNode != NULL && psBestGMNode->psNext != NULL ) + { + psBestGMNode->iGroupLength += psBestGMNode->psNext->iGroupLength; + psBestGMNode->iGroupRMSEnvelopeCost = -1; + psBestGMNode->fGroupSNRPenalty = -1.0; + psBestGMNode->psNext = psBestGMNode->psNext->psNext; + iNumGroups--; + } + else + { + iDone++; // This only catches a problem + } + } +} + +static void ComputeRMSEnvelope( const int32_t iChannels, + const int32_t iNumBands, + const int32_t iNumGroups, + const int32_t *piGroupLengths, + float **ppfBandEnergy, + int32_t ***pppiRMSEnvelope ) +{ + int32_t n; + + for ( n = 0; n < iChannels; n++ ) + { + int32_t b; + int32_t iChanOffset; + + iChanOffset = n * iNumBands; + for ( b = 0; b < iNumBands; b++ ) + { + int32_t k; + int32_t iBlockOffset; + + iBlockOffset = 0; + for ( k = 0; k < iNumGroups; k++ ) + { + int32_t m; + float fGroupEnergy; + fGroupEnergy = 0.0; + for ( m = 0; m < piGroupLengths[k]; m++ ) + { + fGroupEnergy += ppfBandEnergy[iBlockOffset][b + iChanOffset]; + iBlockOffset++; + } + fGroupEnergy /= (float) piGroupLengths[k]; + + fGroupEnergy = log2f( fGroupEnergy ); + pppiRMSEnvelope[n][k][b] = ( fGroupEnergy > 0.0 ) ? (int32_t) ( fGroupEnergy + 0.5 ) : (int32_t) ( fGroupEnergy - 0.5 ); // Bug fix + pppiRMSEnvelope[n][k][b] = ( pppiRMSEnvelope[n][k][b] > ENV_MIN ) ? pppiRMSEnvelope[n][k][b] : ENV_MIN; + pppiRMSEnvelope[n][k][b] = ( pppiRMSEnvelope[n][k][b] < ENV_MAX ) ? pppiRMSEnvelope[n][k][b] : ENV_MAX; + } + } + } +} + +static void LimitRMSEnvelope( const int32_t iBandCount, + const int32_t iRMSDeltaMax, + const int32_t iRMSDeltaMin, + int32_t *piRMSEnvelope ) +{ + int32_t iBand; + int32_t iLastSCF; + + /* Increase low envelope values to ensure that the scale factors traces the large values correctly (checking for max deltas) */ + iLastSCF = piRMSEnvelope[iBandCount - 1]; + for ( iBand = iBandCount - 2; iBand > -1; iBand-- ) + { + int32_t iDelta; + + iDelta = iLastSCF - piRMSEnvelope[iBand]; + + if ( iDelta > iRMSDeltaMax ) + { +#ifdef DEBUG_VERBOSE + printf( "WARNING RMS envelope delta limited\n" ); +#endif + piRMSEnvelope[iBand] += ( iDelta - iRMSDeltaMax ); + } + + iLastSCF = piRMSEnvelope[iBand]; + } + + /* Increase low envelope values to ensure that the envelope traces the large values correctly (checking for min deltas)*/ + iLastSCF = piRMSEnvelope[0]; + for ( iBand = 1; iBand < iBandCount; iBand++ ) + { + int32_t iDelta; + + iDelta = piRMSEnvelope[iBand] - iLastSCF; + + if ( iDelta < iRMSDeltaMin ) + { +#ifdef DEBUG_VERBOSE + printf( "WARNING RMS envelope delta limited\n" ); +#endif + piRMSEnvelope[iBand] += ( iRMSDeltaMin - iDelta ); + } + + iLastSCF = piRMSEnvelope[iBand]; + } +} + +void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piBandwidths, // pass in absolute thresh + float ***pppfReal, + float ***pppfImag, +#ifndef USE_BIT_COUNT_MERGE_COST + const float fMeanAllowedDiffdB, + const float fMaxAllowedDiffdB, +#endif + int32_t *piNumGroups, + int32_t *piGroupLengths, + int32_t ***pppiRMSEnvelope ) +{ + int32_t n; + GMNode *psGMNode; + + /* Compute Band Energies */ + ComputeBandEnergy( iChannels, + psRMSEnvelopeGrouping->iNumBlocks, + iNumBands, + piBandwidths, + pppfReal, + pppfImag, + psRMSEnvelopeGrouping->ppfBandEnergy, + psRMSEnvelopeGrouping->ppfBandEnergydB, + psRMSEnvelopeGrouping->ppfWeight ); + + /* Init GMNodes */ +#ifdef FORCE_GROUPS_OF_2 + psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0; + psRMSEnvelopeGrouping->psGMNodes[0].iGroupLength = 2; + psRMSEnvelopeGrouping->psGMNodes[0].psNext = NULL; +#ifdef BUG_FIX_03_15_23_INIT_GROUPING + psRMSEnvelopeGrouping->psGMNodes[0].iGroupRMSEnvelopeCost = -1; + psRMSEnvelopeGrouping->psGMNodes[0].fGroupSNRPenalty = -1.0f; +#endif + for ( n = 1; n < psRMSEnvelopeGrouping->iMaxGroups; n++ ) + { + psRMSEnvelopeGrouping->psGMNodes[n - 1].psNext = &psRMSEnvelopeGrouping->psGMNodes[n]; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupStart = n * 2; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupLength = 2; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupRMSEnvelopeCost = -1; + psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty = -1.0; + psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; + } +#else + psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0; + psRMSEnvelopeGrouping->psGMNodes[0].iGroupLength = 1; + psRMSEnvelopeGrouping->psGMNodes[0].psNext = NULL; +#ifdef BUG_FIX_03_15_23_INIT_GROUPING + psRMSEnvelopeGrouping->psGMNodes[0].iGroupRMSEnvelopeCost = -1; + psRMSEnvelopeGrouping->psGMNodes[0].fGroupSNRPenalty = -1.0f; +#endif + for ( n = 1; n < psRMSEnvelopeGrouping->iMaxGroups; n++ ) + { + psRMSEnvelopeGrouping->psGMNodes[n - 1].psNext = &psRMSEnvelopeGrouping->psGMNodes[n]; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupStart = n; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupLength = 1; + psRMSEnvelopeGrouping->psGMNodes[n].iGroupRMSEnvelopeCost = -1; + psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty = -1.0; + psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; + } +#endif + /* Perform grouping via Greedy Merge */ +#ifndef USE_BIT_COUNT_MERGE_COST + ComputeGreedyGroups( psRMSEnvelopeGrouping, + iChannels, + iNumBands, + fMeanAllowedDiffdB, + fMaxAllowedDiffdB ); +#else + /*ComputeGreedyGroups2(psRMSEnvelopeGrouping, + iChannels, + iNumBands, + piBandwidths);*/ + // Allows control over max groups can call using 16 if want same as previous call + ComputeGreedyGroups3( psRMSEnvelopeGrouping, + iChannels, + iNumBands, + piBandwidths, + CQMF_BLOCKS_PER_FRAME ); +#endif + + /* Calc Groups from Merge Results */ + *piNumGroups = 0; + psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; + while ( psGMNode != NULL ) + { + piGroupLengths[*piNumGroups] = psGMNode->iGroupLength; + *piNumGroups += 1; + psGMNode = psGMNode->psNext; + } + + /* Compute RMS Envelope given group lengths */ + ComputeRMSEnvelope( iChannels, + iNumBands, + *piNumGroups, + piGroupLengths, + psRMSEnvelopeGrouping->ppfBandEnergy, + pppiRMSEnvelope ); + + /* Envelope Tenting */ + for ( n = 0; n < iChannels; n++ ) + { + int32_t k; + for ( k = 0; k < *piNumGroups; k++ ) + { + LimitRMSEnvelope( iNumBands, + ENV_DELTA_MAX, + ENV_DELTA_MIN, + pppiRMSEnvelope[n][k] ); + } + } +} diff --git a/lib_rend/ivas_RMSEnvGrouping.h b/lib_rend/ivas_RMSEnvGrouping.h new file mode 100644 index 0000000000..fff7e99965 --- /dev/null +++ b/lib_rend/ivas_RMSEnvGrouping.h @@ -0,0 +1,66 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_RMS_ENV_GROUPING_H_ +#define _IVAS_RMS_ENV_GROUPING_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +#include "options.h" + typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping; + + RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks ); + + void DeleteRMSEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping ); + + void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, + const int32_t iChannels, + const int32_t iNumBands, + const int32_t *piBandwidths, + float ***pppfReal, + float ***pppfImag, +#ifndef USE_BIT_COUNT_MERGE_COST + const float fMeanAllowedDiffdB, + const float fMaxAllowedDiffdB, +#endif + int32_t *piNumGroups, + int32_t *piGroupLengths, + int32_t ***pppiRMSEnvelope ); + +#ifdef __cplusplus +} +#endif + +#endif /* _RMS_ENV_GROUPING_H_ */ diff --git a/lib_rend/ivas_Tables.c b/lib_rend/ivas_Tables.c new file mode 100644 index 0000000000..c28ff6d26f --- /dev/null +++ b/lib_rend/ivas_Tables.c @@ -0,0 +1,196 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_Tables.h" +#include "wmops.h" + +/* clang-format off */ +const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL+1][2] = { + {1.0f, 0.0f}, /* zero */ + {0.0f, 1.0f}, /* pi/2 */ + {-1.0f, 0.0f}, /* pi */ + {0.0f, -1.0f}, /* 3*pi/2 */ +}; + +/* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */ +const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = { + {-1.00000000f, -0.00000000f}, + {-0.96592583f, -0.25881905f}, + {-0.86602540f, -0.50000000f}, + {-0.70710678f, -0.70710678f}, + {-0.50000000f, -0.86602540f}, + {-0.25881905f, -0.96592583f}, + {0.00000000f, -1.00000000f}, + {0.25881905f, -0.96592583f}, + {0.50000000f, -0.86602540f}, + {0.70710678f, -0.70710678f}, + {0.86602540f, -0.50000000f}, + {0.96592583f, -0.25881905f}, + {1.00000000f, 0.00000000f}, + {0.96592583f, 0.25881905f}, + {0.86602540f, 0.50000000f}, + {0.70710678f, 0.70710678f}, + {0.50000000f, 0.86602540f}, + {0.25881905f, 0.96592583f}, + {0.00000000f, 1.00000000f}, + {-0.25881905f, 0.96592583f}, + {-0.50000000f, 0.86602540f}, + {-0.70710678f, 0.70710678f}, + {-0.86602540f, 0.50000000f}, + {-0.96592583f, 0.25881905f}, + {-1.00000000f, 0.00000000f} +}; + +/* Move this to perceptual model ? */ +const int32_t c_aiBandwidths48[MAX_BANDS_48] = { + 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,4,6,6,7,10, +}; + + +const float c_afScaleFactor[ALLOC_TABLE_SIZE] = { + 0.0f, + 0.353553390593f, + 0.420448207627f, + 0.500000000000f, + 0.594603557501f, + 0.707106781187f, + 0.840896415254f, + 1.000000000000f, + 1.189207115003f, + 1.414213562373f, + 1.681792830507f, + 2.000000000000f, + 2.378414230005f, + 2.828427124746f, + 3.363585661015f, + 4.0f, + 4.756828460011f, + 5.656854249492f, + 6.727171322030f, + 8.0f, + 9.513656920022f, + 11.31370849898f, + 13.45434264406f, + 16.00000000000f, + 19.02731384004f, + 22.62741699797f, + 26.90868528812f, + 32.000000000000000f, + 38.054627680087073f, + 45.254833995939038f, + 53.817370576237735f, + 64.000000000000000f, +}; + +const float c_afInvScaleFactor[ALLOC_TABLE_SIZE] = { + 0.0f, + 2.367513562373095f, + 2.046407115002721f, + 1.775900000000000f, + 1.536446415253715f, + 1.323056781186548f, + 1.132903557501360f, + 0.965800000000000f, + 0.821348207626857f, + 0.695103390593274f, + 0.587801778750680f, + 0.495800000000000f, + 0.418124103813429f, + 0.352176695296637f, + 0.296200889375340f, + 0.249400000000000f, + 0.209812051906714f, + 0.176538347648318f, + 0.148525444687670f, + 0.124900000000000f, + 0.105056025953357f, + 0.088388347648318f, + 0.074325444687670f, + 0.062500000000000f, + 0.052556025953357f, + 0.044194173824159f, + 0.037162722343835f, + 0.031250000000000f, + 0.026278012976679f, + 0.022097086912080f, + 0.018581361171918f, + 0.015625000000000f, +}; + +const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE] = { + 2.32830644e-10f, 3.29272254e-10f, 4.65661287e-10f, 6.58544508e-10f, 9.31322575e-10f, 1.31708902e-09f, 1.86264515e-09f, 2.63417803e-09f, + 3.72529030e-09f, 5.26835606e-09f, 7.45058060e-09f, 1.05367121e-08f, 1.49011612e-08f, 2.10734243e-08f, 2.98023224e-08f, 4.21468485e-08f, + 5.96046448e-08f, 8.42936970e-08f, 1.19209290e-07f, 1.68587394e-07f, 2.38418579e-07f, 3.37174788e-07f, 4.76837158e-07f, 6.74349576e-07f, + 9.53674316e-07f, 1.34869915e-06f, 1.90734863e-06f, 2.69739830e-06f, 3.81469727e-06f, 5.39479661e-06f, 7.62939453e-06f, 1.07895932e-05f, + 1.52587891e-05f, 2.15791864e-05f, 3.05175781e-05f, 4.31583729e-05f, 6.10351562e-05f, 8.63167458e-05f, 1.22070312e-04f, 1.72633492e-04f, + 2.44140625e-04f, 3.45266983e-04f, 4.88281250e-04f, 6.90533966e-04f, 9.76562500e-04f, 1.38106793e-03f, 1.95312500e-03f, 2.76213586e-03f, + 3.90625000e-03f, 5.52427173e-03f, 7.81250000e-03f, 1.10485435e-02f, 1.56250000e-02f, 2.20970869e-02f, 3.12500000e-02f, 4.41941738e-02f, + 6.25000000e-02f, 8.83883476e-02f, 1.25000000e-01f, 1.76776695e-01f, 2.50000000e-01f, 3.53553391e-01f, 5.00000000e-01f, 7.07106781e-01f, + 1.00000000e+00f, 1.41421356e+00f, 2.00000000e+00f, 2.82842712e+00f, 4.00000000e+00f, 5.65685425e+00f, 8.00000000e+00f, 1.13137085e+01f, + 1.60000000e+01f, 2.26274170e+01f, 3.20000000e+01f, 4.52548340e+01f, 6.40000000e+01f, 9.05096680e+01f, 1.28000000e+02f, 1.81019336e+02f, + 2.56000000e+02f, 3.62038672e+02f, 5.12000000e+02f, 7.24077344e+02f, 1.02400000e+03f, 1.44815469e+03f, 2.04800000e+03f, 2.89630938e+03f, + 4.09600000e+03f, 5.79261875e+03f, 8.19200000e+03f, 1.15852375e+04f, 1.63840000e+04f, 2.31704750e+04f, 3.27680000e+04f, 4.63409500e+04f, + 6.55360000e+04f, 9.26819000e+04f, 1.31072000e+05f, 1.85363800e+05f, 2.62144000e+05f, 3.70727600e+05f, 5.24288000e+05f, 7.41455200e+05f, + 1.04857600e+06f, 1.48291040e+06f, 2.09715200e+06f, 2.96582080e+06f, 4.19430400e+06f, 5.93164160e+06f, 8.38860800e+06f, 1.18632832e+07f, + 1.67772160e+07f, 2.37265664e+07f, 3.35544320e+07f, 4.74531328e+07f, 6.71088640e+07f, 9.49062656e+07f, 1.34217728e+08f, 1.89812531e+08f, + 2.68435456e+08f, 3.79625062e+08f, 5.36870912e+08f, 7.59250125e+08f, 1.07374182e+09f, 1.51850025e+09f, 2.14748365e+09f, 3.03700050e+09f, + 4.29496730e+09f, +}; + +const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { + 0, 3, 3, 4, 5, 5, 6, 7, + 8, 9, 12, 13, 16, 17, 19, 23, + 26, 26, 27, 28, 31, 36, 38, 45, + 54, 64, 76, 90, 108, 128, 152, 180, +}; + +const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE] = { + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, +}; + +const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { + 0, 4, 4, 5, 6, 6, 7, 8, + 9, 10, 13, 14, 17, 18, 20, 24, + 27, 27, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, +}; + +const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { + 1, 16, 16, 25, 36, 36, 49, 64, + 81, 100, 169, 196, 289, 324, 400, 576, + 729, 729, 28, 29, 32, 37, 39, 46, + 55, 65, 77, 91, 109, 129, 153, 181, +}; +/* clang-format on */ diff --git a/lib_rend/ivas_Tables.h b/lib_rend/ivas_Tables.h new file mode 100644 index 0000000000..676ecd43d0 --- /dev/null +++ b/lib_rend/ivas_Tables.h @@ -0,0 +1,126 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_TABLES_H_ +#define _IVAS_TABLES_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include +#ifndef M_PI + +#define M_PI 3.14159265358979323846264338327950288f + +#endif + +#define CQMF_BLOCKS_PER_FRAME ( 16 ) +#define CQMF_MAX_BLOCKS_PER_FRAME ( 16 ) +#define CQMF_BANDS ( 60 ) + +#define MAX_BANDS ( 23 ) +#define MAX_BANDS_48 ( 23 ) + + extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this + + +#define ENV_MIN ( -64 ) +#define ENV_MAX ( 64 ) + +#define ENV0_BITS ( 7 ) + +#define ENV_DELTA_MIN ( -32 ) +#define ENV_DELTA_MAX ( 31 ) + +#define ENV_RECONSTRUCT_TABLE_SIZE ( 129 ) + +#define ENV_RECONSTRUCT_TABLE_CENTER ( 64 ) + +#define MIN_ALLOC ( 0 ) +#define MAX_ALLOC ( 31 ) + +#define ALLOC_OFFSET_SCALE ( 8 ) + +#define ALLOC_OFFSET_BITS ( 8 ) + +#define MIN_ALLOC_OFFSET ( -128 ) +#define MAX_ALLOC_OFFSET ( 127 ) + + +#define ALLOC_TABLE_SIZE ( 32 ) + +#ifndef _PI_ +#define _PI_ ( 3.14159265358979f ) +#endif +#define PRED_MAX_VAL ( 12 ) +#define PRED_MIN_VAL ( -PRED_MAX_VAL ) +#define PRED_QUANT_FACTOR ( (float) PRED_MAX_VAL ) +#define PRED_BAND0_BITS ( 5 ) + +#define PHASE_MAX_VAL ( 12 ) +#define PHASE_MIN_VAL ( -PHASE_MAX_VAL ) +#define PHASE_QUANT_FACTOR ( (float) PHASE_MAX_VAL / _PI_ ) +#define PHASE_DIFF_DIM ( 2 ) +#define PHASE_BAND0_BITS ( 5 ) + +#define SIMPLE_PHASE_MAX_VAL ( 3 ) +#define SIMPLE_PHASE_MIN_VAL ( 0 ) +#define SIMPLE_PHASE_BITS ( 2 ) +#define SIMPLE_PHASE_QUANT_FACTOR ( 2.0f / _PI_ ) + +#define TON_QUOTA_ABS_THRESHOLD ( 8.0f ) +#define TON_QUOTA_INC_THRESHOLD ( 4.0f ) + + extern const float c_afRotRealImag[PRED_MAX_VAL - PRED_MIN_VAL + 1][2]; + extern const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2]; + extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; + + extern const float c_afScaleFactor[ALLOC_TABLE_SIZE]; + + extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE]; + + extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE]; + + extern const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE]; + +#ifdef __cplusplus +} +#endif + +#endif /* _TABLES_H_ */ diff --git a/lib_rend/ivas_binauralRenderer.c b/lib_rend/ivas_binauralRenderer.c index ff85e0c73b..ba7b293153 100644 --- a/lib_rend/ivas_binauralRenderer.c +++ b/lib_rend/ivas_binauralRenderer.c @@ -137,7 +137,12 @@ static ivas_error ivas_binRenderer_convModuleOpen( const int16_t renderer_type, const int16_t isLoudspeaker, const AUDIO_CONFIG input_config, - const RENDER_CONFIG_DATA *hRenderConfig ) + const RENDER_CONFIG_DATA *hRenderConfig +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t num_poses +#endif +) { int16_t bandIdx, chIdx; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; @@ -145,6 +150,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( int16_t pos_idx; #endif + /*-----------------------------------------------------------------* * prepare library opening *-----------------------------------------------------------------*/ @@ -246,30 +252,17 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hBinRenderer->splitRendMode == SPLIT_REND_PRE || hBinRenderer->splitRendMode == SPLIT_REND_COMB ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - hBinRenConvModule->numPoses = MAX_HEAD_ROT_POSES + 1; -#else - hBinRenConvModule->numPoses = MAX_HEAD_ROT_POSES; -#endif - } - else - { - hBinRenConvModule->numPoses = 1; - } - - if ( ( hBinRenConvModule->filterStatesLeftReal = (float ****) count_malloc( hBinRenConvModule->numPoses * sizeof( float *** ) ) ) == NULL ) + if ( ( hBinRenConvModule->filterStatesLeftReal = (float ****) count_malloc( num_poses * sizeof( float *** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - if ( ( hBinRenConvModule->filterStatesLeftImag = (float ****) count_malloc( hBinRenConvModule->numPoses * sizeof( float *** ) ) ) == NULL ) + if ( ( hBinRenConvModule->filterStatesLeftImag = (float ****) count_malloc( num_poses * sizeof( float *** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - for ( pos_idx = 0; pos_idx < hBinRenConvModule->numPoses; pos_idx++ ) + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal[pos_idx] = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) { @@ -422,7 +415,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #ifdef SPLIT_REND_WITH_HEAD_ROT - for ( pos_idx = 0; pos_idx < hBinRenConvModule->numPoses; pos_idx++ ) + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -581,14 +574,15 @@ static void ivas_binaural_obtain_DMX( ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, - const IVAS_SPLIT_REND_MODE splitRendMode, + const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { BINAURAL_RENDERER_HANDLE hBinRenderer; int16_t convBand; ivas_error error; - AUDIO_CONFIG in_config; + AUDIO_CONFIG in_config, out_config; error = IVAS_ERR_OK; @@ -607,8 +601,6 @@ ivas_error ivas_rend_openCldfbRend( } hBinRenderer->rotInCldfb = 1; - hBinRenderer->splitRendMode = splitRendMode; - hBinRenderer->ivas_format = SBA_FORMAT; hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); @@ -616,6 +608,7 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ in_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + out_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); if ( convBand > BINAURAL_CONVBANDS ) { @@ -628,8 +621,22 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->hInputSetup->is_loudspeaker_setup = 0; getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE ); + if ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + hBinRenderer->numPoses = pMultiBinPoseData->num_poses + 1; +#else + hBinRenderer->numPoses = pMultiBinPoseData->num_poses; +#endif + } + else + { + hBinRenderer->numPoses = 1; + } + /* Allocate memories and buffers needed for convolutional module */ - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, in_config, hRendCfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, in_config, hRendCfg, + hBinRenderer->numPoses ) ) != IVAS_ERR_OK ) { return error; } @@ -678,7 +685,18 @@ ivas_error ivas_binRenderer_open( } #ifdef SPLIT_REND_WITH_HEAD_ROT - hBinRenderer->splitRendMode = st_ivas->hDecoderConfig->Opt_splitRendMode; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + hBinRenderer->numPoses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses + 1; +#else + hBinRenderer->numPoses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; +#endif + } + else + { + hBinRenderer->numPoses = 1; + } #endif /* Declare some common variables needed for renderer */ @@ -718,7 +736,12 @@ ivas_error ivas_binRenderer_open( IVAS_OUTPUT_SETUP out_setup; /* Allocate memories and buffers needed for convolutional module in CICP19 */ - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hRenderConfig +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + hBinRenderer->numPoses +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -741,7 +764,12 @@ ivas_error ivas_binRenderer_open( else { /* Allocate memories and buffers needed for convolutional module */ - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hRenderConfig +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + hBinRenderer->numPoses +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -816,6 +844,10 @@ 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 + , + int16_t num_poses +#endif ) { int16_t bandIdx, chIdx; @@ -859,7 +891,7 @@ static void ivas_binRenderer_convModuleClose( hBinRenConvModule->filterTapsRightImag = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT - for ( posIdx = 0; posIdx < hBinRenConvModule->numPoses; posIdx++ ) + for ( posIdx = 0; posIdx < num_poses; posIdx++ ) { for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) { @@ -957,7 +989,12 @@ void ivas_binRenderer_close( if ( ( *hBinRenderer )->hBinRenConvModule != NULL ) { - ivas_binRenderer_convModuleClose( hBinRenderer ); + ivas_binRenderer_convModuleClose( hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + ( *hBinRenderer )->numPoses +#endif + ); } if ( ( *hBinRenderer )->hReverb != NULL ) @@ -1069,6 +1106,9 @@ void ivas_binaural_cldfb( /* Implement binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, +#ifdef SPLIT_REND_WITH_HEAD_ROT + &st_ivas->splitBinRend.splitrend.multiBinPoseData, +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG NULL, #endif @@ -1111,6 +1151,9 @@ void ivas_binaural_cldfb( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, #endif @@ -1133,18 +1176,7 @@ void ivas_binRenderer( wmops_sub_start( "fastconv_binaural_rendering" ); #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hBinRenderer->splitRendMode == SPLIT_REND_PRE || hBinRenderer->splitRendMode == SPLIT_REND_COMB ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - num_poses = MAX_HEAD_ROT_POSES + 1; -#else - num_poses = MAX_HEAD_ROT_POSES; -#endif - } - else - { - num_poses = 1; - } + num_poses = hBinRenderer->numPoses; #endif /* Compute Convolution */ @@ -1215,50 +1247,36 @@ void ivas_binRenderer( #ifdef SPLIT_REND_WITH_HEAD_ROT /*TODO : move this to a separate function*/ - if ( hBinRenderer->splitRendMode == SPLIT_REND_PRE || hBinRenderer->splitRendMode == SPLIT_REND_COMB ) + if ( pMultiBinPoseData->num_poses > 1 ) { - int16_t yaw_idx, pitch_idx, roll_idx; IVAS_QUATERNION Quaternions_rel, Quaternions_abs, *Quaternions_ref; float Rmat_local[3][3]; + if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) { Quaternions_ref = &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions - 1]; - Quaternions_rel.w = -3.0f; /*euler*/ - Quaternions_abs.w = -3.0f; /*euler*/ - Quat2Euler( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ - // Quaternions_abs.x = Quaternions_ref->x; - // Quaternions_abs.y = Quaternions_ref->y; - // Quaternions_abs.z = Quaternions_ref->z; - for ( yaw_idx = 0; yaw_idx < MAX_YAW_ANGLES; yaw_idx++ ) + Quaternions_rel.w = -3.0f; /*euler*/ + Quaternions_abs.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + + for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { - for ( pitch_idx = 0; pitch_idx < MAX_PITCH_ANGLES; pitch_idx++ ) - { - for ( roll_idx = 0; roll_idx < MAX_ROLL_ANGLES; roll_idx++ ) - { - pos_idx = yaw_idx * MAX_PITCH_ANGLES * MAX_ROLL_ANGLES + pitch_idx * MAX_ROLL_ANGLES + roll_idx; - if ( pos_idx == 0 ) - { - continue; - } - - Quaternions_rel.x = split_rend_relative_yaw_angles[yaw_idx]; - Quaternions_rel.y = split_rend_relative_pitch_angles[pitch_idx]; - Quaternions_rel.z = split_rend_relative_roll_angles[roll_idx]; - Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; - Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; - Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; - - - QuatToRotMat( Quaternions_rel, Rmat_local ); - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, hBinRenderer + Quaternions_rel.x = pMultiBinPoseData->relative_head_poses[pos_idx][0] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; + Quaternions_rel.y = pMultiBinPoseData->relative_head_poses[pos_idx][1] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; + Quaternions_rel.z = pMultiBinPoseData->relative_head_poses[pos_idx][2] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; + Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; + Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; + + + QuatToRotMat( Quaternions_rel, Rmat_local ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, hBinRenderer #ifdef SPLIT_REND_WITH_HEAD_ROT - , - pos_idx + , + pos_idx #endif - ); - } - } + ); } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1267,8 +1285,8 @@ void ivas_binRenderer( IVAS_QUATERNION *Quaternions_new1; IVAS_QUATERNION Quaternions_new; Quaternions_new1 = &hPostRendHeadTrackData->Quaternions[hPostRendHeadTrackData->num_quaternions++]; - Quaternions_new.w = -3.0f; /*euler*/ - Quat2Euler( *Quaternions_new1, &Quaternions_new.z, &Quaternions_new.y, &Quaternions_new.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quaternions_new.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_new1, &Quaternions_new.z, &Quaternions_new.y, &Quaternions_new.x ); /*order in Quat2Euler seems to be reversed ?*/ Quaternions_rel.x = Quaternions_new.x - Quaternions_abs.x; Quaternions_rel.y = Quaternions_new.y - Quaternions_abs.y; Quaternions_rel.z = Quaternions_new.z - Quaternions_abs.z; @@ -1278,10 +1296,10 @@ void ivas_binRenderer( QuatToRotMat( Quaternions_rel, Rmat_local ); rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES], Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES], RealBuffer, ImagBuffer, hBinRenderer + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[num_poses], Cldfb_ImagBuffer_Binaural[num_poses], RealBuffer, ImagBuffer, hBinRenderer #ifdef SPLIT_REND_WITH_HEAD_ROT , - MAX_HEAD_ROT_POSES + num_poses #endif ); } @@ -1342,10 +1360,12 @@ void ivas_binRenderer( void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, const IVAS_REND_HeadRotData *pHeadRotData, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) + float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t low_res_pre_rend_rot ) { int16_t sf_idx, slot_idx, ch_idx, idx, pose_idx; HEAD_TRACK_DATA head_track; @@ -1374,7 +1394,14 @@ void ivas_rend_CldfbMultiBinRendProcess( } head_track.num_quaternions = 0; head_track.shd_rot_max_order = -1; - head_track.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); + if ( low_res_pre_rend_rot ) + { + head_track.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, 0 ); + } + else + { + head_track.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); + } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG head_track_post.num_quaternions = 0; head_track_post.shd_rot_max_order = -1; @@ -1382,16 +1409,15 @@ void ivas_rend_CldfbMultiBinRendProcess( #endif ivas_binRenderer( hCldfbRend, &head_track, + pMultiBinPoseData, #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG &head_track_post, #endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn ); -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pose_idx = 0; pose_idx < MAX_HEAD_ROT_POSES + 1; pose_idx++ ) -#else - for ( pose_idx = 0; pose_idx < MAX_HEAD_ROT_POSES; pose_idx++ ) -#endif + + for ( pose_idx = 0; pose_idx < hCldfbRend->numPoses; pose_idx++ ) + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; diff --git a/lib_rend/ivas_cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_codec_bitstream.c new file mode 100644 index 0000000000..fae5403b9b --- /dev/null +++ b/lib_rend/ivas_cldfb_codec_bitstream.c @@ -0,0 +1,307 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_cldfb_codec_bitstream.h" + +#include +#include +#include "options.h" +#include "prot.h" +#include "wmops.h" + +#define MAX_BUFFER 1024 + +static const uint32_t MASKS[] = { + 0x00000000, + 0x00000001, + 0x00000003, + 0x00000007, + 0x0000000f, + 0x0000001f, + 0x0000003f, + 0x0000007f, + 0x000000ff, + 0x000001ff, + 0x000003ff, + 0x000007ff, + 0x00000fff, + 0x00001fff, + 0x00003fff, + 0x00007fff, + 0x0000ffff, + 0x0001ffff, + 0x0003ffff, + 0x0007ffff, + 0x000fffff, + 0x001fffff, + 0x003fffff, + 0x007fffff, + 0x00ffffff, + 0x01ffffff, + 0x03ffffff, + 0x07ffffff, + 0x0fffffff, + 0x1fffffff, + 0x3fffffff, + 0x7fffffff, +}; + +Bitstream *CreateBitstream( const int32_t iDirection, + const int32_t iMaxBuffer ) + +{ + + int32_t n; + Bitstream *psBitstream; + + psBitstream = (Bitstream *) count_malloc( sizeof( Bitstream ) ); + + psBitstream->iDirection = iDirection; + psBitstream->iMaxBuffer = iMaxBuffer; + psBitstream->iIndex = 0; + psBitstream->iBufferEnd = 0; + psBitstream->iBufferStart = 0; + psBitstream->iError = BS_ERROR_NONE; + + if ( psBitstream->iMaxBuffer == -1 ) + { + psBitstream->iMaxBuffer = 4096; + } + + psBitstream->puchBuffer = (uint8_t *) count_malloc( sizeof( uint8_t ) * psBitstream->iMaxBuffer ); + + for ( n = 0; n < psBitstream->iMaxBuffer; n++ ) + { + psBitstream->puchBuffer[n] = 0; + } + + return psBitstream; +} + +void DeleteBitstream( Bitstream *psBitstream ) +{ + count_free( psBitstream->puchBuffer ); + count_free( psBitstream ); +} + +void BSFlushBuffer( Bitstream *psBitstream ) +{ + memset( psBitstream->puchBuffer, 0, psBitstream->iMaxBuffer ); + psBitstream->iIndex = 0; + psBitstream->iBufferEnd = 0; + psBitstream->iBufferStart = 0; + psBitstream->iError = BS_ERROR_NONE; +} + +int32_t BSPutBytes( Bitstream *psBitstream, + const uint8_t *puchBytes, + const int32_t iByteCount ) +{ + int32_t n; + for ( n = 0; n < iByteCount; n++ ) + { + psBitstream->puchBuffer[psBitstream->iBufferEnd] = puchBytes[n]; + psBitstream->iBufferEnd++; + } + if ( psBitstream->iDirection != BS_READ ) + { + psBitstream->iError = BS_ERROR_FAIL; + } + + return psBitstream->iError; +} + +int32_t BSGetBytes( Bitstream *psBitstream, + uint8_t *puchBytes, + int32_t iByteCount ) +{ + int32_t n; + for ( n = 0; n < iByteCount; n++ ) + { + puchBytes[n] = psBitstream->puchBuffer[psBitstream->iBufferStart]; + psBitstream->puchBuffer[psBitstream->iBufferStart] = 0; + psBitstream->iBufferStart++; + } + if ( psBitstream->iDirection != BS_WRITE ) + { + psBitstream->iError = BS_ERROR_FAIL; + } + + return psBitstream->iError; +} + +int32_t BSByteAlign( Bitstream *psBitstream ) +{ + if ( psBitstream->iDirection == BS_WRITE ) + { + if ( psBitstream->iIndex & 0x7 ) + { + int32_t iByte; + int32_t iRem; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); + psBitstream->puchBuffer[iByte] &= ( 0xff ^ MASKS[iRem] ); + psBitstream->iIndex += iRem; + } + } + else + { + if ( psBitstream->iIndex & 0x7 ) + { + int32_t iByte; + int32_t iRem; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); + psBitstream->iIndex += iRem; + } + } + + return psBitstream->iError; +} + +int32_t BSPutBits( Bitstream *psBitstream, + int32_t iValue, + int32_t iBitCount ) +{ + iValue &= MASKS[iBitCount]; + while ( iBitCount ) + { + int32_t iByte; + int32_t iRem; + int32_t iShift; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); // 8 - psBitstream->iIndex & 0x7; + + iShift = iBitCount - iRem; + if ( iShift <= 0 ) + { + iShift *= -1; + psBitstream->puchBuffer[iByte] += (uint8_t) ( iValue << iShift ); + psBitstream->iIndex += iBitCount; + iBitCount = 0; + } + else + { + psBitstream->puchBuffer[iByte] += (uint8_t) ( iValue >> iShift ); + iValue &= MASKS[iShift]; + psBitstream->iIndex += iRem; + iBitCount -= iRem; + } + } + + if ( psBitstream->iDirection != BS_WRITE ) + { + psBitstream->iError = BS_ERROR_FAIL; + } + + return psBitstream->iError; +} + +int32_t BSGetBits( Bitstream *psBitstream, + int32_t iBitCount ) +{ + int32_t iValue = 0; + + while ( iBitCount ) + { + uint8_t uchByte; + int32_t iByte; + int32_t iRem; + int32_t iShift; + + iByte = psBitstream->iIndex >> 3; + iRem = 8 - ( psBitstream->iIndex - ( iByte << 3 ) ); // 8 - psBitstream->iIndex & 0x7; + uchByte = psBitstream->puchBuffer[iByte]; + iShift = iBitCount - iRem; + + if ( iShift <= 0 ) + { + iShift *= -1; + iValue += (int32_t) ( ( uchByte >> iShift ) & MASKS[iBitCount] ); + psBitstream->iIndex += iBitCount; + iBitCount = 0; + } + else + { + uchByte &= MASKS[iRem]; + iValue += ( ( (int32_t) uchByte ) << iShift ); + psBitstream->iIndex += iRem; + iBitCount -= iRem; + } + } + + if ( psBitstream->iDirection != BS_READ ) + { + psBitstream->iError = BS_ERROR_FAIL; + } + + return iValue; +} + +int32_t BSForceBack( + ivas_split_rend_bits_t *pBits, + int32_t iValue, + int32_t iBitCount ) +{ + pBits->bits_read -= iBitCount; + return ( iValue >> iBitCount ); +} + +int32_t BSGetByteCount( Bitstream *psBitstream ) +{ + int32_t iBytes; + iBytes = psBitstream->iIndex >> 3; + if ( ( iBytes << 3 ) != psBitstream->iIndex ) + { + iBytes++; + } + + return iBytes; +} + +uint8_t *BSGetBuffer( Bitstream *psBitstream ) +{ + return psBitstream->puchBuffer; +} + +int32_t BSGetAvailableBytes( Bitstream *psBitstream ) +{ + return psBitstream->iBufferEnd; +} + +int32_t BSGetError( Bitstream *psBitstream ) +{ + return psBitstream->iError; +} diff --git a/lib_rend/ivas_cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_codec_bitstream.h new file mode 100644 index 0000000000..44e351cec5 --- /dev/null +++ b/lib_rend/ivas_cldfb_codec_bitstream.h @@ -0,0 +1,101 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby +International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der +angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips +N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge +Corporation, and other contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, +Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung +e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph +and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings +Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their +respective contributions in the software. This notice grants no license of any +kind, including but not limited to patent license, nor is any license granted by +implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration +agreement before making contributions. + + This software is provided "AS IS", without any express or implied warranties. +The software is in the development stage. It is intended exclusively for experts +who have experience with such software and solely for the purpose of inspection. +All implied warranties of non-infringement, merchantability and fitness for a +particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing +this software shall be submitted to and settled by the final, binding +jurisdiction of the courts of Munich, Germany in accordance with the laws of the +Federal Republic of Germany excluding its conflict of law rules and the United +Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_CLDFB_CODEC_BITSTREAM_H_ +#define _IVAS_CLDFB_CODEC_BITSTREAM_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" + enum + { + BS_READ, + BS_WRITE + }; + enum + { + BS_ERROR_NONE, + BS_ERROR_FAIL + }; + + typedef struct BITSTREAM + { + int32_t iMaxBuffer; + int32_t iDirection; + int32_t iBufferEnd; + int32_t iBufferStart; + int32_t iIndex; + int32_t iError; + uint8_t *puchBuffer; + } Bitstream; + + Bitstream *CreateBitstream( const int32_t iDirection, const int32_t iMaxBuffer ); + + void DeleteBitstream( Bitstream *psBitstream ); + + void BSFlushBuffer( Bitstream *psBitstream ); + + int32_t BSPutBytes( Bitstream *psBitstream, const uint8_t *puchBytes, const int32_t iByteCount ); + + int32_t BSGetBytes( Bitstream *psBitstream, uint8_t *puchBytes, int32_t iByteCount ); + + int32_t BSByteAlign( Bitstream *psBitstream ); + + int32_t BSPutBits( Bitstream *psBitstream, int32_t iValue, int32_t iBitCount ); + + int32_t BSGetBits( Bitstream *psBitstream, int32_t iBitCount ); + + int32_t BSForceBack( + ivas_split_rend_bits_t *pBits, + int32_t iValue, + int32_t iBitCount ); + + uint8_t *BSGetBuffer( Bitstream *psBitstream ); + + int32_t BSGetByteCount( Bitstream *psBitstream ); + + int32_t BSGetAvailableBytes( Bitstream *psBitstream ); + int32_t BSGetError( Bitstream *psBitstream ); + +#ifdef __cplusplus +} +#endif + +#endif /* _BITSTREAM_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c deleted file mode 100644 index 370aa0dbd1..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.c +++ /dev/null @@ -1,912 +0,0 @@ -#include "CQMFDecoder.h" - -#include -#include -#include -#include -#include "Tables.h" -#include "wmops.h" -#include "PerceptualModel.h" -#include "RMSEnvDeltaHuff.h" -#include "CQMFHuff.h" -#include "NoiseGen.h" -#include "cldfb_codec_bitstream.h" - -typedef struct CQMF_DECODER{ - int iSampleRate; - int iChannels; - int iNumBlocks; - - int iNumBands; - const int *piBandwidths; - - int iMSMode; - int *piMSFlags; - - int iCommonGrouping; - int *piNumGroups; - int **ppiGroupLengths; - - int ***pppiRMSEnvelope; - int ***pppiSMR; - int ***pppiExcitation; - int ***pppiAlloc; - - int iAllocOffset; - - int ***pppiCQMFSignReal; - int ***pppiCQMFSignImag; - int ***pppiQCQMFReal; - int ***pppiQCQMFImag; - - Bitstream *psBSRead; - - NoiseGen *psNoiseGen; - - int iLastError; -}CQMFDecoder; - -CQMFDecoder* CreateCQMFDecoder(const int iSampleRate, - const int iChannels) -{ - int n; - CQMFDecoder *psCQMFDecoder = NULL; - - assert(iSampleRate == 48000); //Fix - - psCQMFDecoder = (CQMFDecoder*)malloc(sizeof(CQMFDecoder)); - psCQMFDecoder->iSampleRate = iSampleRate; - psCQMFDecoder->iChannels = iChannels; - psCQMFDecoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; - psCQMFDecoder->iAllocOffset = 0; - - psCQMFDecoder->iNumBands = MAX_BANDS_48; //Fix - psCQMFDecoder->piBandwidths = c_aiBandwidths48; //Fix - - psCQMFDecoder->iMSMode = 0; - psCQMFDecoder->piMSFlags = (int*)malloc(MAX_BANDS * sizeof(int)); - - psCQMFDecoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo - psCQMFDecoder->piNumGroups = (int*)malloc(psCQMFDecoder->iChannels * sizeof(int)); - psCQMFDecoder->ppiGroupLengths = (int**)malloc(psCQMFDecoder->iChannels * sizeof(int*)); - psCQMFDecoder->pppiRMSEnvelope = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiSMR = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiExcitation = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiAlloc = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - - psCQMFDecoder->pppiCQMFSignReal = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiCQMFSignImag = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiQCQMFReal = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - psCQMFDecoder->pppiQCQMFImag = (int***)malloc(psCQMFDecoder->iChannels * sizeof(int**)); - for(n = 0; n < iChannels ; n ++){ - int k; - psCQMFDecoder->ppiGroupLengths[n] = (int*)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); - psCQMFDecoder->pppiRMSEnvelope[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiSMR[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiExcitation[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiAlloc[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - - psCQMFDecoder->pppiCQMFSignReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiCQMFSignImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiQCQMFReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFDecoder->pppiQCQMFImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - psCQMFDecoder->pppiRMSEnvelope[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiSMR[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiExcitation[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFDecoder->pppiAlloc[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - - psCQMFDecoder->pppiCQMFSignReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFDecoder->pppiCQMFSignImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFDecoder->pppiQCQMFReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFDecoder->pppiQCQMFImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - } - } - - psCQMFDecoder->psBSRead = CreateBitstream(BS_READ,4096); - - psCQMFDecoder->psNoiseGen = NULL;//CreateNoiseGen(); // No noise fill for now - - psCQMFDecoder->iLastError = DECODER_ERROR_NONE; - - return psCQMFDecoder; -} - -void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder) -{ - if(psCQMFDecoder != NULL){ - - if(psCQMFDecoder->piMSFlags != NULL){ - free(psCQMFDecoder->piMSFlags); - } - - if(psCQMFDecoder->piNumGroups != NULL){ - free(psCQMFDecoder->piNumGroups); - } - - if(psCQMFDecoder->ppiGroupLengths != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - free(psCQMFDecoder->ppiGroupLengths[n]); - } - free(psCQMFDecoder->ppiGroupLengths); - } - - if(psCQMFDecoder->pppiRMSEnvelope != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiRMSEnvelope[n][k]); - } - free(psCQMFDecoder->pppiRMSEnvelope[n]); - } - free(psCQMFDecoder->pppiRMSEnvelope); - } - - if(psCQMFDecoder->pppiSMR != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiSMR[n][k]); - } - free(psCQMFDecoder->pppiSMR[n]); - } - free(psCQMFDecoder->pppiSMR); - } - - if(psCQMFDecoder->pppiExcitation != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiExcitation[n][k]); - } - free(psCQMFDecoder->pppiExcitation[n]); - } - free(psCQMFDecoder->pppiExcitation); - } - - if(psCQMFDecoder->pppiAlloc != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiAlloc[n][k]); - } - free(psCQMFDecoder->pppiAlloc[n]); - } - free(psCQMFDecoder->pppiAlloc); - } - - if(psCQMFDecoder->pppiCQMFSignReal != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiCQMFSignReal[n][k]); - } - free(psCQMFDecoder->pppiCQMFSignReal[n]); - } - free(psCQMFDecoder->pppiCQMFSignReal); - } - - if(psCQMFDecoder->pppiCQMFSignImag != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiCQMFSignImag[n][k]); - } - free(psCQMFDecoder->pppiCQMFSignImag[n]); - } - free(psCQMFDecoder->pppiCQMFSignImag); - } - - if(psCQMFDecoder->pppiQCQMFReal != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiQCQMFReal[n][k]); - } - free(psCQMFDecoder->pppiQCQMFReal[n]); - } - free(psCQMFDecoder->pppiQCQMFReal); - } - - if(psCQMFDecoder->pppiQCQMFImag != NULL){ - int n; - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFDecoder->pppiQCQMFImag[n][k]); - } - free(psCQMFDecoder->pppiQCQMFImag[n]); - } - free(psCQMFDecoder->pppiQCQMFImag); - } - - if(psCQMFDecoder->psBSRead != NULL){ - DeleteBitstream(psCQMFDecoder->psBSRead); - } - - if(psCQMFDecoder->psNoiseGen != NULL){ - DeleteNoiseGen(psCQMFDecoder->psNoiseGen); - } - - free(psCQMFDecoder); - } -} - -int CQMFDecoderGetError(CQMFDecoder *psCQMFDecoder) -{ - return psCQMFDecoder->iLastError; -} - -static void ApplyRMSEnvelope(const int iNumBands, - const int *piBandwidths, - const int iNumGroups, - const int *piGroupLengths, - const int **ppiRMSEnvelope, - float **ppfReal, - float **ppfImag); - -static void ReplaceSign(const int iNumBlocks, - const int iNumCQMFBands, - const int **ppiSignReal, - const int **ppiSignImag, - float **ppfReal, - float **ppfImag); - -static void InvQuantizeSpectrum(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiQReal, - const int **ppiQImag, - float **ppfReal, - float **ppfImag, - NoiseGen *psNoiseGen); //Nullable - -static void InvMSCoding(const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - const int iMSMode, - const int *piMSFlags, - float ***pppfReal, - float ***pppfImag); - -/* Currently only the number of bands in frame */ -static int ReadHeaderInformation(int *piNumBands, - Bitstream *psBSRead); - -static int ReadMSInformation(const int iNumBands, - int *piMSMode, - int *piMSFlags, - Bitstream *psBSRead); - -static int ReadGroupInformation(const int iChannels, - int *piCommonGrouping, - int *piNumGroups, - int **ppiGroupLengths, - Bitstream *psBSRead); - -static int ReadHuff(const unsigned int (*pauiHuffDecTable)[HUFF_DEC_TABLE_SIZE], - int *piSymbol, - Bitstream *psBSRead); - -static int ReadRMSEnvelope(const int iChannels, - const int *piNumGroups, - const int iNumBands, - int ***pppiRMSEnvelope, - Bitstream *psBSRead); - -static int ReadAllocInformation(int *piAllocOffset, - Bitstream *psBSRead); - -static int ReadCQMFData( const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - int **ppiSignReal, - int **ppiSignImag, - int **ppiQReal, - int **ppiQImag, - Bitstream *psBSRead); - -static void ComputeAllocation(const int iChannels, - const int *piNumGroups, - const int iNumBands, - const int ***pppiSMR, - const int iAllocOffset, - int ***pppiAlloc); - -int DecodeFrame(CQMFDecoder *psCQMFDecoder, - const int iNumBytes, - const unsigned char *puchData, - float ***pppfCQMFReal, - float ***pppfCQMFImag) -{ - int n; - int iBitsRead; - - iBitsRead = 0; - - BSFlushBuffer(psCQMFDecoder->psBSRead); - BSPutBytes(psCQMFDecoder->psBSRead,puchData,iNumBytes); - - iBitsRead += ReadHeaderInformation(&psCQMFDecoder->iNumBands, - psCQMFDecoder->psBSRead); - - if(psCQMFDecoder->iChannels == 2){ - iBitsRead += ReadMSInformation(psCQMFDecoder->iNumBands, - &psCQMFDecoder->iMSMode, - psCQMFDecoder->piMSFlags, - psCQMFDecoder->psBSRead); - } - - iBitsRead += ReadGroupInformation(psCQMFDecoder->iChannels, - &psCQMFDecoder->iCommonGrouping, - psCQMFDecoder->piNumGroups, - psCQMFDecoder->ppiGroupLengths, - psCQMFDecoder->psBSRead); - - iBitsRead += ReadRMSEnvelope(psCQMFDecoder->iChannels, - (const int*)psCQMFDecoder->piNumGroups, - psCQMFDecoder->iNumBands, - psCQMFDecoder->pppiRMSEnvelope, - psCQMFDecoder->psBSRead); - - iBitsRead += ReadAllocInformation(&psCQMFDecoder->iAllocOffset, - psCQMFDecoder->psBSRead); - - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ // This will be updated to support multiple sample rates - int k; - for(k = 0; k < psCQMFDecoder->piNumGroups[n]; k ++){ - PerceptualModel(psCQMFDecoder->iNumBands, - psCQMFDecoder->pppiRMSEnvelope[n][k], - psCQMFDecoder->pppiExcitation[n][k], - psCQMFDecoder->pppiSMR[n][k]); - - } - } - - ComputeAllocation(psCQMFDecoder->iChannels, - (const int*)psCQMFDecoder->piNumGroups, - psCQMFDecoder->iNumBands, - (const int***)psCQMFDecoder->pppiSMR, - psCQMFDecoder->iAllocOffset, - psCQMFDecoder->pppiAlloc); - - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - iBitsRead += ReadCQMFData(psCQMFDecoder->piNumGroups[n], - (const int*)psCQMFDecoder->ppiGroupLengths[n], - psCQMFDecoder->iNumBands, - psCQMFDecoder->piBandwidths, - (const int**)psCQMFDecoder->pppiAlloc[n], - psCQMFDecoder->pppiCQMFSignReal[n], - psCQMFDecoder->pppiCQMFSignImag[n], - psCQMFDecoder->pppiQCQMFReal[n], - psCQMFDecoder->pppiQCQMFImag[n], - psCQMFDecoder->psBSRead); - } - - for(n = 0; n < psCQMFDecoder->iChannels; n ++){ - InvQuantizeSpectrum(psCQMFDecoder->piNumGroups[n], - (const int*)psCQMFDecoder->ppiGroupLengths[n], - psCQMFDecoder->iNumBands, - psCQMFDecoder->piBandwidths, - (const int**)psCQMFDecoder->pppiAlloc[n], - (const int**)psCQMFDecoder->pppiQCQMFReal[n], - (const int**)psCQMFDecoder->pppiQCQMFImag[n], - pppfCQMFReal[n], - pppfCQMFImag[n], - psCQMFDecoder->psNoiseGen); - - ReplaceSign(psCQMFDecoder->iNumBlocks, - CQMF_BANDS, - (const int**)psCQMFDecoder->pppiCQMFSignReal[n], - (const int**)psCQMFDecoder->pppiCQMFSignImag[n], - pppfCQMFReal[n], - pppfCQMFImag[n]); - - - ApplyRMSEnvelope(psCQMFDecoder->iNumBands, - psCQMFDecoder->piBandwidths, - psCQMFDecoder->piNumGroups[n], - (const int*)psCQMFDecoder->ppiGroupLengths[n], - (const int **)psCQMFDecoder->pppiRMSEnvelope[n], - pppfCQMFReal[n], - pppfCQMFImag[n]); - } - - if(psCQMFDecoder->iChannels == 2 && psCQMFDecoder->iMSMode > 0){ - InvMSCoding(psCQMFDecoder->iNumBlocks, - psCQMFDecoder->iNumBands, - psCQMFDecoder->piBandwidths, - psCQMFDecoder->iMSMode, - (const int*)psCQMFDecoder->piMSFlags, - pppfCQMFReal, - pppfCQMFImag); - } - - //printf("Bits Read %d\n",iBitsRead); - - return psCQMFDecoder->iLastError; -} - -static void ApplyRMSEnvelope(const int iNumBands, - const int *piBandwidths, - const int iNumGroups, - const int *piGroupLengths, - const int **ppiRMSEnvelope, - float **ppfReal, - float **ppfImag) -{ - int n; - int iBlockOffset; - - iBlockOffset = 0; - for(n = 0; n < iNumGroups; n ++){ - int k; - - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iRMSEnv; - float fGain; - - iRMSEnv = ppiRMSEnvelope[n][b]; - fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER + iRMSEnv]; - for(m = 0; m < piBandwidths[b]; m ++){ - ppfReal[iBlockOffset][iFBOffset] *= fGain; - ppfImag[iBlockOffset][iFBOffset] *= fGain; - iFBOffset ++; - } - } - iBlockOffset ++; - } - } -} - -static void ReplaceSign(const int iNumBlocks, - const int iNumCQMFBands, - const int **ppiSignReal, - const int **ppiSignImag, - float **ppfReal, - float **ppfImag) -{ - int n; - for(n = 0; n < iNumBlocks; n ++){ - int b; - for(b = 0; b < iNumCQMFBands; b ++){ - if(ppiSignReal[n][b] == 1){ - ppfReal[n][b] = -ppfReal[n][b]; - } - if(ppiSignImag[n][b] == 1){ - ppfImag[n][b] = -ppfImag[n][b]; - } - } - } -} - -static void InvQuantizeSpectrum(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiQReal, - const int **ppiQImag, - float **ppfReal, - float **ppfImag, - NoiseGen *psNoiseGen) // Pass in NULL to swicth off noise gen -{ - int n; - int iBlockOffest; - - iBlockOffest = 0; - for(n = 0; n < iNumGroups; n ++){ - int k; - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - float fInvSCFGain; - - iAlloc = ppiAlloc[n][b]; - fInvSCFGain = c_afInvScaleFactor[iAlloc]; - - if(iAlloc > 0){ - for(m = 0; m < piBandwidths[b]; m ++){ - int iQuantValue; - - iQuantValue = ppiQReal[iBlockOffest][iFBOffset]; - ppfReal[iBlockOffest][iFBOffset] = (float)iQuantValue * fInvSCFGain; - - iQuantValue = ppiQImag[iBlockOffest][iFBOffset]; - ppfImag[iBlockOffest][iFBOffset] = (float)iQuantValue * fInvSCFGain; - - iFBOffset ++; - } - } - else if(psNoiseGen != NULL){ - for(m = 0; m < piBandwidths[b]; m ++){ - ppfReal[iBlockOffest][iFBOffset] = 0.7f * GetNoise(psNoiseGen); - ppfImag[iBlockOffest][iFBOffset] = 0.7f * GetNoise(psNoiseGen); - - iFBOffset ++; - } - } - else{ - iFBOffset += piBandwidths[b]; - } - - } - - iBlockOffest ++; - } - } -} - -static void InvMSCoding(const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - const int iMSMode, - const int *piMSFlags, - float ***pppfReal, - float ***pppfImag) -{ - if(iMSMode > 0){ - int b; - int iFBOffset; - - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - if(piMSFlags[b] == 1){ - int n; - for(n = 0; n < piBandwidths[b]; n ++){ - int k; - for(k = 0; k < iNumBlocks; k ++){ - float fLeftReal; - float fLeftImag; - float fRightReal; - float fRightImag; - - fLeftReal = (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); - fLeftImag = (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); - fRightReal = (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); - fRightImag = (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); - - pppfReal[0][k][iFBOffset] = fLeftReal; - pppfReal[1][k][iFBOffset] = fRightReal; - pppfImag[0][k][iFBOffset] = fLeftImag; - pppfImag[1][k][iFBOffset] = fRightImag; - } - iFBOffset ++; - } - } - else{ - iFBOffset += piBandwidths[b]; - } - } - } -} - -/* Currently only the number of bands in frame */ -static int ReadHeaderInformation(int *piNumBands, - Bitstream *psBSRead) -{ - int iBitsRead; - - iBitsRead = 0; - *piNumBands = BSGetBits(psBSRead, 5); - iBitsRead += 5; - - return iBitsRead; -} - -static int ReadMSInformation(const int iNumBands, - int *piMSMode, - int *piMSFlags, - Bitstream *psBSRead) -{ - int iBitsRead; - - iBitsRead = 0; - *piMSMode = BSGetBits(psBSRead,2); - iBitsRead += 2; - - if(*piMSMode == 0){ - int n; - for(n = 0; n > 16); - } - - if(iVal){ - BSForceBack(psBSRead,iIndex,iVal); - iBitsRead -= iVal; - } - - *piSymbol = iSymbol; - - return iBitsRead; -} - -static int ReadRMSEnvelope(const int iChannels, - const int *piNumGroups, - const int iNumBands, - int ***pppiRMSEnvelope, - Bitstream *psBSRead) -{ - int n; - int iBitsRead; - - iBitsRead = 0; - for(n = 0; n < iChannels; n ++){ - int k; - for(k = 0; k < piNumGroups[n]; k ++){ - int b; - int iLastRMSVal; - - iLastRMSVal = BSGetBits(psBSRead,ENV0_BITS); - iBitsRead += ENV0_BITS; - - iLastRMSVal += ENV_MIN; - pppiRMSEnvelope[n][k][0] = iLastRMSVal; - for(b = 1; b < iNumBands; b ++){ - int iDelta; - - iBitsRead += ReadHuff(c_aaiRMSEnvHuffDec,&iDelta,psBSRead); - - iDelta += ENV_DELTA_MIN; - iLastRMSVal += iDelta; - pppiRMSEnvelope[n][k][b] = iLastRMSVal; - } - } - } - - return iBitsRead; -} - -static int ReadAllocInformation(int *piAllocOffset, - Bitstream *psBSRead) -{ - int iBitsRead; - - iBitsRead = 0; - - *piAllocOffset = BSGetBits(psBSRead,ALLOC_OFFSET_BITS); - *piAllocOffset += MIN_ALLOC_OFFSET; - iBitsRead += ALLOC_OFFSET_BITS; - - return iBitsRead; -} - -static int ReadCQMFData(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - int **ppiSignReal, - int **ppiSignImag, - int **ppiQReal, - int **ppiQImag, - Bitstream *psBSRead) -{ - int n; - int iBitsRead; - int iBlockOffest; - - iBitsRead = 0; - iBlockOffest = 0; - for(n = 0; n < iNumGroups; n ++){ - int k; - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iHuffDim; - int iHuffMod; - - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - - if(iAlloc > 0){ - const unsigned int (*pauiHuffmanTable)[HUFF_DEC_TABLE_SIZE] = NULL; //const? - - pauiHuffmanTable = GetHuffDecTable(iAlloc); - for(m = 0; m < piBandwidths[b]; m ++){ - int iQuantValue1 = 0; - int iQuantValue2 = 0; - - if(iHuffDim == 2){ - int iSymbol; - - iBitsRead += ReadHuff(pauiHuffmanTable,&iSymbol,psBSRead); - iQuantValue1 = iSymbol / iHuffMod; - iQuantValue2 = iSymbol % iHuffMod; - } - else{ - iBitsRead += ReadHuff(pauiHuffmanTable,&iQuantValue1,psBSRead); - iBitsRead += ReadHuff(pauiHuffmanTable,&iQuantValue2,psBSRead); - } - - ppiQReal[iBlockOffest][iFBOffset] = iQuantValue1; - ppiQImag[iBlockOffest][iFBOffset] = iQuantValue2; - - if(iQuantValue1 > 0){ - ppiSignReal[iBlockOffest][iFBOffset] = BSGetBits(psBSRead,1); - iBitsRead += 1; - } - if(iQuantValue2 > 0){ - ppiSignImag[iBlockOffest][iFBOffset] = BSGetBits(psBSRead,1); - iBitsRead += 1; - } - - iFBOffset ++; - } - } - else{ - iFBOffset += piBandwidths[b]; - } - - } - - iBlockOffest ++; - } - } - - return iBitsRead; -} - -static void ComputeAllocation(const int iChannels, - const int *piNumGroups, - const int iNumBands, - const int ***pppiSMR, - const int iAllocOffset, - int ***pppiAlloc) -{ - int n; - - for(n = 0; n < iChannels; n ++){ - int k; - for(k = 0; k < piNumGroups[n]; k ++){ - int b; - for(b = 0; b < iNumBands; b ++){ - int iAlloc; - iAlloc = ((pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE) >> 5); - iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; - iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; - pppiAlloc[n][k][b] = iAlloc; - } - } - } -} diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h b/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h deleted file mode 100644 index e865343cd9..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFDecoder.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _CQMF_DECODER_H_ -#define _CQMF_DECODER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define DECODER_ERROR_NONE (0) -#define DECODER_ERROR_FS_NOT_SUPPORTED (-1) -#define DECODER_ERROR_CHAN_NOT_SUPPORTED (-2) -#define DECODER_ERROR_UNKNOWN (-100) - -typedef struct CQMF_DECODER CQMFDecoder; - -CQMFDecoder* CreateCQMFDecoder(const int iSampleRate, - const int iChannels); - -void DeleteCQMFDecoder(CQMFDecoder *psCQMFDecoder); - -int CQMFDecoderGetError(CQMFDecoder *psCQMFDecoder); - -int DecodeFrame(CQMFDecoder *psCQMFDecoder, - const int iNumBytes, - const unsigned char *puchData, - float ***pppfCQMFReal, - float ***pppfCQMFImag); - -#ifdef __cplusplus -} -#endif - -#endif /* _CQMF_DECODER_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c deleted file mode 100644 index 6795f9327c..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.c +++ /dev/null @@ -1,1226 +0,0 @@ -#include "CQMFEncoder.h" - -#include -#include -#include -#include -#include "Tables.h" -#include "wmops.h" -#include "RMSEnvGrouping.h" -#include "PerceptualModel.h" -#include "RMSEnvDeltaHuff.h" -#include "CQMFHuff.h" -#include "cldfb_codec_bitstream.h" - -typedef struct CQMF_ENCODER{ - int iSampleRate; - int iChannels; - int iNumBlocks; - - int iTargetBitRate; - int iTargetBitsPerFrame; - - int iNumBands; - const int *piBandwidths; - - int iMSMode; - int *piMSFlags; - - RMSEnvelopeGrouping *psRMSEnvelopeGrouping; - - int iCommonGrouping; - int *piNumGroups; - int **ppiGroupLengths; - - int ***pppiRMSEnvelope; - int ***pppiSMR; - int ***pppiExcitation; - int ***pppiAlloc; - - int iAllocOffset; - - int ***pppiCQMFSignReal; - int ***pppiCQMFSignImag; - int ***pppiQCQMFReal; - int ***pppiQCQMFImag; - - Bitstream *psBSWrite; - - int iLastError; -}CQMFEncoder; - -CQMFEncoder* CreateCQMFEncoder(const int iSampleRate, - const int iChannels, - const int iTargetBitRate) -{ - int n; - CQMFEncoder *psCQMFEncoder = NULL; - - assert(iSampleRate == 48000); //Fix - - psCQMFEncoder = (CQMFEncoder*)malloc(sizeof(CQMFEncoder)); - psCQMFEncoder->iSampleRate = iSampleRate; - psCQMFEncoder->iChannels = iChannels; - psCQMFEncoder->iNumBlocks = CQMF_BLOCKS_PER_FRAME; - psCQMFEncoder->iAllocOffset = 0; - - psCQMFEncoder->iTargetBitRate = iTargetBitRate; - psCQMFEncoder->iTargetBitsPerFrame = iTargetBitRate * CQMF_BLOCKS_PER_FRAME * CQMF_BANDS / iSampleRate; - - psCQMFEncoder->iNumBands = MAX_BANDS_48 - 1; //Fix - psCQMFEncoder->piBandwidths = c_aiBandwidths48; //Fix - - psCQMFEncoder->iMSMode = 0; - psCQMFEncoder->piMSFlags = (int*)malloc(MAX_BANDS * sizeof(int)); - - psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping(psCQMFEncoder->iNumBlocks); - - psCQMFEncoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo - psCQMFEncoder->piNumGroups = (int*)malloc(psCQMFEncoder->iChannels * sizeof(int)); - psCQMFEncoder->ppiGroupLengths = (int**)malloc(psCQMFEncoder->iChannels * sizeof(int*)); - psCQMFEncoder->pppiRMSEnvelope = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiSMR = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiExcitation = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiAlloc = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - - psCQMFEncoder->pppiCQMFSignReal = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiCQMFSignImag = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiQCQMFReal = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - psCQMFEncoder->pppiQCQMFImag = (int***)malloc(psCQMFEncoder->iChannels * sizeof(int**)); - for(n = 0; n < iChannels ; n ++){ - int k; - psCQMFEncoder->ppiGroupLengths[n] = (int*)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int)); - psCQMFEncoder->pppiRMSEnvelope[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiSMR[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiExcitation[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiAlloc[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - - psCQMFEncoder->pppiCQMFSignReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiCQMFSignImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiQCQMFReal[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - psCQMFEncoder->pppiQCQMFImag[n] = (int**)malloc(CQMF_BLOCKS_PER_FRAME * sizeof(int*)); - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - psCQMFEncoder->pppiRMSEnvelope[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFEncoder->pppiSMR[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFEncoder->pppiExcitation[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - psCQMFEncoder->pppiAlloc[n][k] = (int*)malloc(MAX_BANDS * sizeof(int)); - - psCQMFEncoder->pppiCQMFSignReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFEncoder->pppiCQMFSignImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFEncoder->pppiQCQMFReal[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - psCQMFEncoder->pppiQCQMFImag[n][k] = (int*)malloc(CQMF_BANDS * sizeof(int)); - } - } - - psCQMFEncoder->psBSWrite = CreateBitstream(BS_WRITE,4096); - - psCQMFEncoder->iLastError = ENCODER_ERROR_NONE; - - return psCQMFEncoder; -} - -void DeleteCQMFEncoder(CQMFEncoder *psCQMFEncoder) -{ - if(psCQMFEncoder != NULL){ - - if(psCQMFEncoder->piMSFlags != NULL){ - free(psCQMFEncoder->piMSFlags); - } - - if(psCQMFEncoder->piNumGroups != NULL){ - free(psCQMFEncoder->piNumGroups); - } - - if(psCQMFEncoder->psRMSEnvelopeGrouping != NULL){ - DeleteRMSEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping); - } - - if(psCQMFEncoder->ppiGroupLengths != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - free(psCQMFEncoder->ppiGroupLengths[n]); - } - free(psCQMFEncoder->ppiGroupLengths); - } - - if(psCQMFEncoder->pppiRMSEnvelope != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiRMSEnvelope[n][k]); - } - free(psCQMFEncoder->pppiRMSEnvelope[n]); - } - free(psCQMFEncoder->pppiRMSEnvelope); - } - - if(psCQMFEncoder->pppiSMR != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiSMR[n][k]); - } - free(psCQMFEncoder->pppiSMR[n]); - } - free(psCQMFEncoder->pppiSMR); - } - - if(psCQMFEncoder->pppiExcitation != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiExcitation[n][k]); - } - free(psCQMFEncoder->pppiExcitation[n]); - } - free(psCQMFEncoder->pppiExcitation); - } - - if(psCQMFEncoder->pppiAlloc != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiAlloc[n][k]); - } - free(psCQMFEncoder->pppiAlloc[n]); - } - free(psCQMFEncoder->pppiAlloc); - } - - if(psCQMFEncoder->pppiCQMFSignReal != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiCQMFSignReal[n][k]); - } - free(psCQMFEncoder->pppiCQMFSignReal[n]); - } - free(psCQMFEncoder->pppiCQMFSignReal); - } - - if(psCQMFEncoder->pppiCQMFSignImag != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiCQMFSignImag[n][k]); - } - free(psCQMFEncoder->pppiCQMFSignImag[n]); - } - free(psCQMFEncoder->pppiCQMFSignImag); - } - - if(psCQMFEncoder->pppiQCQMFReal != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiQCQMFReal[n][k]); - } - free(psCQMFEncoder->pppiQCQMFReal[n]); - } - free(psCQMFEncoder->pppiQCQMFReal); - } - - if(psCQMFEncoder->pppiQCQMFImag != NULL){ - int n; - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - int k; - for(k = 0; k < CQMF_BLOCKS_PER_FRAME; k ++){ - free(psCQMFEncoder->pppiQCQMFImag[n][k]); - } - free(psCQMFEncoder->pppiQCQMFImag[n]); - } - free(psCQMFEncoder->pppiQCQMFImag); - } - - DeleteBitstream(psCQMFEncoder->psBSWrite); - - free(psCQMFEncoder); - } -} - -int CQMFEncoderGetError(CQMFEncoder *psCQMFEncoder) -{ - return psCQMFEncoder->iLastError; -} - -static void MSModeCalculation(const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - float ***pppfReal, - float ***pppfImag, - int *piMSMode, - int *piMSFlags); - -static void RemoveRMSEnvelope(const int iNumBands, - const int *piBandwidths, - const int iNumGroups, - const int *piGroupLengths, - const int **ppiRMSEnvelope, - float **ppfReal, - float **ppfImag); - -static void RemoveSign(const int iNumBlocks, - const int iNumCQMFBands, - float **ppfReal, - float **ppfImag, - int **ppiSignReal, - int **ppiSignImag); - -static int CountCQMFBits(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiQReal, - const int **ppiQImag); - -/* Currently only the number of bands in frame */ -static int WriteHeaderInformation(const int iNumBands, - Bitstream *psBSWrite); - -static int WriteMSInformation(const int iNumBands, - const int iMSMode, - const int *piMSFlags, - Bitstream *psBSWrite); - -static int WriteGroupInformation(const int iChannels, - const int iCommonGrouping, - const int *piNumGroups, - const int **ppiGroupLengths, - Bitstream *psBSWrite); - -static int WriteRMSEnvelope(const int iChannels, - const int *piNumGroups, - const int iNumBands, - const int ***pppiRMSEnvelope, - Bitstream *psBSWrite); - -static int WriteAllocInformation(const int iAllocOffset, - Bitstream *psBSWrite); - -static int WriteCQMFData(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiSignReal, - const int **ppiSignImag, - const int **ppiQReal, - const int **ppiQImag, - Bitstream *psBSWrite); - -static int ComputeAllocation(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAvailableBits, - int *piAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag); - -static int ComputeAllocationByPass(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag); - - - -int EncodeFrame(CQMFEncoder *psCQMFEncoder, - float ***pppfCQMFReal, - float ***pppfCQMFImag, - int *piNumiBytes, - unsigned char *puchData) -{ - int n; - int iAvailableBits; - int iBitsWritten; - int iCQMFBits; - - iAvailableBits = psCQMFEncoder->iTargetBitsPerFrame; // HCBR for now - iBitsWritten = 0; - - - /* Do MS calc here */ - if(psCQMFEncoder->iChannels == 2){ - MSModeCalculation(psCQMFEncoder->iNumBlocks, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - pppfCQMFReal, - pppfCQMFImag, - &psCQMFEncoder->iMSMode, - psCQMFEncoder->piMSFlags); - - if(psCQMFEncoder->iMSMode > 0){ - psCQMFEncoder->iCommonGrouping = 1; // Make sure common grouping is enabled when MS is in use - } - } - - - /* Compute Grouping and RMS Envelopes */ - if(psCQMFEncoder->iChannels == 2 && psCQMFEncoder->iCommonGrouping == 1){ - ComputeEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping, - psCQMFEncoder->iChannels, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const float***)pppfCQMFReal, - (const float***)pppfCQMFImag, - 8.0, - 20.0, // Use these to trade off RMS Env bits and quantizer loading - &psCQMFEncoder->piNumGroups[0], - psCQMFEncoder->ppiGroupLengths[0], - psCQMFEncoder->pppiRMSEnvelope); - - psCQMFEncoder->piNumGroups[1] = psCQMFEncoder->piNumGroups[0]; - for(n = 0; n < psCQMFEncoder->piNumGroups[0]; n ++){ - psCQMFEncoder->ppiGroupLengths[1][n] = psCQMFEncoder->ppiGroupLengths[0][n]; - } - } - else{ - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - ComputeEnvelopeGrouping(psCQMFEncoder->psRMSEnvelopeGrouping, - psCQMFEncoder->iChannels, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const float***)&pppfCQMFReal[n], - (const float***)&pppfCQMFImag[n], - 8.0, - 20.0, // Use these to trade off RMS Env bits and quantizer loading - &psCQMFEncoder->piNumGroups[n], - psCQMFEncoder->ppiGroupLengths[n], - &psCQMFEncoder->pppiRMSEnvelope[n]); - } - } - - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - RemoveSign(psCQMFEncoder->iNumBlocks, - CQMF_BANDS, - pppfCQMFReal[n], - pppfCQMFImag[n], - psCQMFEncoder->pppiCQMFSignReal[n], - psCQMFEncoder->pppiCQMFSignImag[n]); - - RemoveRMSEnvelope(psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - psCQMFEncoder->piNumGroups[n], - (const int*)psCQMFEncoder->ppiGroupLengths[n], - (const int **)psCQMFEncoder->pppiRMSEnvelope[n], - pppfCQMFReal[n], - pppfCQMFImag[n]); - } - - BSFlushBuffer(psCQMFEncoder->psBSWrite); - iBitsWritten += WriteHeaderInformation(psCQMFEncoder->iNumBands, - psCQMFEncoder->psBSWrite); - - if(psCQMFEncoder->iChannels == 2){ - iBitsWritten += WriteMSInformation(psCQMFEncoder->iNumBands, - psCQMFEncoder->iMSMode, - (const int*)psCQMFEncoder->piMSFlags, - psCQMFEncoder->psBSWrite); - } - - iBitsWritten += WriteGroupInformation(psCQMFEncoder->iChannels, - psCQMFEncoder->iCommonGrouping, - (const int*)psCQMFEncoder->piNumGroups, - (const int**)psCQMFEncoder->ppiGroupLengths, - psCQMFEncoder->psBSWrite); - - iBitsWritten += WriteRMSEnvelope(psCQMFEncoder->iChannels, - (const int*)psCQMFEncoder->piNumGroups, - psCQMFEncoder->iNumBands, - (const int***)psCQMFEncoder->pppiRMSEnvelope, - psCQMFEncoder->psBSWrite); - - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ // This will be updated to support multiple sample rates - int k; - for(k = 0; k < psCQMFEncoder->piNumGroups[n]; k ++){ - PerceptualModel(psCQMFEncoder->iNumBands, - psCQMFEncoder->pppiRMSEnvelope[n][k], - psCQMFEncoder->pppiExcitation[n][k], - psCQMFEncoder->pppiSMR[n][k]); - - } - } - - iAvailableBits -= iBitsWritten; - iCQMFBits = ComputeAllocation(psCQMFEncoder->iChannels, - (const int*)psCQMFEncoder->piNumGroups, - (const int**)psCQMFEncoder->ppiGroupLengths, - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const float***)pppfCQMFReal, - (const float***)pppfCQMFImag, - (const int***)psCQMFEncoder->pppiSMR, - iAvailableBits, - &psCQMFEncoder->iAllocOffset, - psCQMFEncoder->pppiAlloc, - psCQMFEncoder->pppiQCQMFReal, - psCQMFEncoder->pppiQCQMFImag); - - iBitsWritten += WriteAllocInformation(psCQMFEncoder->iAllocOffset,psCQMFEncoder->psBSWrite); - - for(n = 0; n < psCQMFEncoder->iChannels; n ++){ - iBitsWritten += WriteCQMFData(psCQMFEncoder->piNumGroups[n], - (const int*)psCQMFEncoder->ppiGroupLengths[n], - psCQMFEncoder->iNumBands, - psCQMFEncoder->piBandwidths, - (const int**)psCQMFEncoder->pppiAlloc[n], - (const int**)psCQMFEncoder->pppiCQMFSignReal[n], - (const int**)psCQMFEncoder->pppiCQMFSignImag[n], - (const int**)psCQMFEncoder->pppiQCQMFReal[n], - (const int**)psCQMFEncoder->pppiQCQMFImag[n], - psCQMFEncoder->psBSWrite); - } - - BSByteAlign(psCQMFEncoder->psBSWrite); - *piNumiBytes = BSGetByteCount(psCQMFEncoder->psBSWrite); - BSGetBytes(psCQMFEncoder->psBSWrite,puchData,*piNumiBytes); - - //printf("Bits Written %d\n",iBitsWritten); - - return psCQMFEncoder->iLastError; -} - -static void MSModeCalculation(const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - float ***pppfReal, - float ***pppfImag, - int *piMSMode, - int *piMSFlags) -{ - int b; - int iFBOffset; - int iNumMSBands; - - *piMSMode = 0; - iFBOffset = 0; - iNumMSBands = 0; - for(b = 0; b < iNumBands; b ++){ - int n; - float fLeftEnergy; - float fRightEnergy; - float fMidEnergy; - float fSideEnergy; - float fLRRatio; - float fMSRatio; - - fLeftEnergy = 0.0; - fRightEnergy = 0.0; - fMidEnergy = 0.0; - fSideEnergy = 0.0; - - for(n = 0; n < piBandwidths[b]; n ++){ - int k; - for(k = 0; k < iNumBlocks; k ++){ - float fMidReal; - float fMidImag; - float fSideReal; - float fSideImag; - - fMidReal = 0.5f * (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); - fMidImag = 0.5f * (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); - fSideReal = 0.5f * (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); - fSideImag = 0.5f * (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); - - fLeftEnergy += (pppfReal[0][k][iFBOffset] * pppfReal[0][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[0][k][iFBOffset]); - fRightEnergy += (pppfReal[1][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[1][k][iFBOffset] * pppfImag[1][k][iFBOffset]); - fMidEnergy += (fMidReal * fMidReal + fMidImag * fMidImag); - fSideEnergy += (fSideReal * fSideReal + fSideImag * fSideImag); - } - - iFBOffset ++; - } - - fLeftEnergy = log10f(fLeftEnergy + 1e-12f); - fRightEnergy = log10f(fRightEnergy + 1e-12f); - fMidEnergy = log10f(fMidEnergy + 1e-12f); - fSideEnergy = log10f(fSideEnergy + 1e-12f); - - if(fLeftEnergy > fRightEnergy){ - fLRRatio = fLeftEnergy - fRightEnergy; - } - else{ - fLRRatio = fRightEnergy - fLeftEnergy; - } - - if(fMidEnergy > fSideEnergy){ - fMSRatio = fMidEnergy - fSideEnergy; - } - else{ - fMSRatio = fSideEnergy - fMidEnergy; - } - - if(fMSRatio > fLRRatio){ - iNumMSBands ++; - piMSFlags[b] = 1; - } - else{ - piMSFlags[b] = 0; - } - } - - if(iNumMSBands == iNumBands){ - *piMSMode = 1; - } - else if(iNumMSBands > 0){ - *piMSMode = 2; - } - else{ - *piMSMode = 0; - } - - if(*piMSMode > 0){ - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - if(piMSFlags[b] == 1){ - int n; - for(n = 0; n < piBandwidths[b]; n ++){ - int k; - for(k = 0; k < iNumBlocks; k ++){ - float fMidReal; - float fMidImag; - float fSideReal; - float fSideImag; - - fMidReal = 0.5f * (pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset]); - fMidImag = 0.5f * (pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset]); - fSideReal = 0.5f * (pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset]); - fSideImag = 0.5f * (pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset]); - - pppfReal[0][k][iFBOffset] = fMidReal; - pppfReal[1][k][iFBOffset] = fSideReal; - pppfImag[0][k][iFBOffset] = fMidImag; - pppfImag[1][k][iFBOffset] = fSideImag; - } - iFBOffset ++; - } - } - else{ - iFBOffset += piBandwidths[b]; - } - } - } -} - -static void RemoveRMSEnvelope(const int iNumBands, - const int *piBandwidths, - const int iNumGroups, - const int *piGroupLengths, - const int **ppiRMSEnvelope, - float **ppfReal, - float **ppfImag) -{ - int n; - int iBlockOffset; - - iBlockOffset = 0; - for(n = 0; n < iNumGroups; n ++){ - int k; - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iRMSEnv; - float fGain; - - iRMSEnv = ppiRMSEnvelope[n][b]; - fGain = c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_CENTER - iRMSEnv]; - for(m = 0; m < piBandwidths[b]; m ++){ - ppfReal[iBlockOffset][iFBOffset] *= fGain; - ppfImag[iBlockOffset][iFBOffset] *= fGain; - iFBOffset ++; - } - } - iBlockOffset ++; - } - } -} - -static void RemoveSign(const int iNumBlocks, - const int iNumCQMFBands, - float **ppfReal, - float **ppfImag, - int **ppiSignReal, - int **ppiSignImag) -{ - int n; - for(n = 0; n < iNumBlocks; n ++){ - int b; - for(b = 0; b < iNumCQMFBands; b ++){ - if(ppfReal[n][b] > 0.0){ - ppiSignReal[n][b] = 0; - } - else{ - ppfReal[n][b] = -ppfReal[n][b]; - ppiSignReal[n][b] = 1; - } - if(ppfImag[n][b] > 0.0){ - ppiSignImag[n][b] = 0; - } - else{ - ppfImag[n][b] = -ppfImag[n][b]; - ppiSignImag[n][b] = 1; - } - } - } -} - -/* Rename */ -static void QuantizeSpectrum(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const float **ppfReal, - const float **ppfImag, - int **ppiQReal, - int **ppiQImag) -{ - int n; - int iBlockOffest; - - iBlockOffest = 0; - for(n = 0; n < iNumGroups; n ++){ - int k; - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iMaxQuantVal; - float fSCFGain; - - iAlloc = ppiAlloc[n][b]; - fSCFGain = c_afScaleFactor[iAlloc]; - iMaxQuantVal = c_aiQuantMaxValues[iAlloc]; - for(m = 0; m < piBandwidths[b]; m ++){ - int iQuantValue; - - iQuantValue = (int)(fSCFGain * ppfReal[iBlockOffest][iFBOffset] + 0.5); -#ifdef _DEBUG_VERBOSE - if(iQuantValue > iMaxQuantVal){ - printf("Value out of range %d\t%d\t%d\n",iAlloc,iQuantValue,iMaxQuantVal); - iQuantValue = iMaxQuantVal; - } -#else - iQuantValue = (iQuantValue < iMaxQuantVal) ? iQuantValue : iMaxQuantVal; -#endif - ppiQReal[iBlockOffest][iFBOffset] = iQuantValue; - - iQuantValue = (int)(fSCFGain * ppfImag[iBlockOffest][iFBOffset] + 0.5); -#ifdef _DEBUG_VERBOSE - if(iQuantValue > iMaxQuantVal){ - printf("Value out of range %d\t%d\t%d\n",iAlloc,iQuantValue,iMaxQuantVal); - iQuantValue = iMaxQuantVal; - } -#else - iQuantValue = (iQuantValue < iMaxQuantVal) ? iQuantValue : iMaxQuantVal; -#endif - ppiQImag[iBlockOffest][iFBOffset] = iQuantValue; - - iFBOffset ++; - } - - } - - iBlockOffest ++; - } - } -} - -static int CountCQMFBits(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiQReal, - const int **ppiQImag) -{ - int n; - int iBits; - int iBlockOffest; - - iBits = 0; - iBlockOffest = 0; - for(n = 0; n < iNumGroups; n ++){ - int k; - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iHuffDim; - int iHuffMod; - - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - - if(iAlloc > 0){ - const unsigned int (*pauiHuffmanTable)[2] = NULL; //const? - - pauiHuffmanTable = GetHuffEncTable(iAlloc); - for(m = 0; m < piBandwidths[b]; m ++){ - int iQuantValue1; - int iQuantValue2; - - iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; - iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; - - iBits += (iQuantValue1 > 0) ? 1 : 0; //Sign bit for vals > 0 - iBits += (iQuantValue2 > 0) ? 1 : 0; //Sign bit for vals > 0 - if(iHuffDim == 2){ - iQuantValue1 *= iHuffMod; - iQuantValue1 += iQuantValue2; - iBits += pauiHuffmanTable[iQuantValue1][0]; - } - else{ - iBits += pauiHuffmanTable[iQuantValue1][0]; - iBits += pauiHuffmanTable[iQuantValue2][0]; - } - - iFBOffset ++; - } - } - else{ - iFBOffset += piBandwidths[b]; - } - - } - - iBlockOffest ++; - } - } - - return iBits; -} - -/* Currently only the number of bands in frame */ -static int WriteHeaderInformation(const int iNumBands, - Bitstream *psBSWrite) -{ - int iBitsWritten; - - iBitsWritten = 0; - BSPutBits(psBSWrite,iNumBands,5); - iBitsWritten += 5; - - return iBitsWritten; -} - -static int WriteMSInformation(const int iNumBands, - const int iMSMode, - const int *piMSFlags, - Bitstream *psBSWrite) -{ - int iBitsWritten; - - iBitsWritten = 0; - - BSPutBits(psBSWrite,iMSMode,2); - iBitsWritten += 2; - if(iMSMode == 2){ - int n; - for(n = 0; n < iNumBands; n ++){ - BSPutBits(psBSWrite,piMSFlags[n],1); - iBitsWritten += 1; - } - } - - return iBitsWritten; -} - -static int WriteGroupInformation(const int iChannels, - const int iCommonGrouping, - const int *piNumGroups, - const int **ppiGroupLengths, - Bitstream *psBSWrite) -{ - int iBitsWritten; - - iBitsWritten = 0; - if(iChannels == 2 && iCommonGrouping == 1){ - int k; - - BSPutBits(psBSWrite,iCommonGrouping,1); - iBitsWritten += 1; - - BSPutBits(psBSWrite,(piNumGroups[0] - 1),4); - iBitsWritten += 4; - - for(k = 0; k < piNumGroups[0]; k ++){ - BSPutBits(psBSWrite,(ppiGroupLengths[0][k] - 1),4); - iBitsWritten += 4; - } - } - else if(iChannels == 2){ - int n; - - BSPutBits(psBSWrite,iCommonGrouping,1); - iBitsWritten += 1; - - for(n = 0; n < iChannels; n ++){ - int k; - - BSPutBits(psBSWrite,(piNumGroups[n] - 1),4); - iBitsWritten += 4; - - for(k = 0; k < piNumGroups[n]; k ++){ - BSPutBits(psBSWrite,(ppiGroupLengths[n][k] - 1),4); - iBitsWritten += 4; - } - } - } - else{ - int n; - - for(n = 0; n < iChannels; n ++){ - int k; - - BSPutBits(psBSWrite,(piNumGroups[n] - 1),4); - iBitsWritten += 4; - - for(k = 0; k < piNumGroups[n]; k ++){ - BSPutBits(psBSWrite,(ppiGroupLengths[n][k] - 1),4); - iBitsWritten += 4; - } - } - } - - return iBitsWritten; -} - -static int WriteRMSEnvelope(const int iChannels, - const int *piNumGroups, - const int iNumBands, - const int ***pppiRMSEnvelope, - Bitstream *psBSWrite) -{ - int n; - int iBitsWritten; - - iBitsWritten = 0; - for(n = 0; n < iChannels; n ++){ - int k; - for(k = 0; k < piNumGroups[n]; k ++){ - int b; - int iLastRMSVal; - - iLastRMSVal = pppiRMSEnvelope[n][k][0]; - iLastRMSVal = (iLastRMSVal > ENV_MIN) ? iLastRMSVal : ENV_MIN; - iLastRMSVal = (iLastRMSVal < ENV_MAX) ? iLastRMSVal : ENV_MAX; - BSPutBits(psBSWrite,(iLastRMSVal - ENV_MIN),ENV0_BITS); - iBitsWritten += ENV0_BITS; - - for(b = 1; b < iNumBands; b ++){ - int iDelta; - - iDelta = pppiRMSEnvelope[n][k][b] - iLastRMSVal; - iDelta = (iDelta > ENV_DELTA_MIN) ? iDelta : ENV_DELTA_MIN; - iDelta = (iDelta < ENV_DELTA_MAX) ? iDelta : ENV_DELTA_MAX; - iDelta -= ENV_DELTA_MIN; - - BSPutBits(psBSWrite,c_aaiRMSEnvHuffEnc[iDelta][1],c_aaiRMSEnvHuffEnc[iDelta][0]); - iBitsWritten += c_aaiRMSEnvHuffEnc[iDelta][0]; - - iLastRMSVal = pppiRMSEnvelope[n][k][b]; - } - } - } - - return iBitsWritten; -} - -static int WriteAllocInformation(const int iAllocOffset, - Bitstream *psBSWrite) -{ - int iBitsWritten; - - iBitsWritten = 0; - - if(iAllocOffset < MIN_ALLOC_OFFSET || iAllocOffset > MAX_ALLOC_OFFSET){ - printf("Serious error\n"); - } - - BSPutBits(psBSWrite,(iAllocOffset - MIN_ALLOC_OFFSET),ALLOC_OFFSET_BITS); - iBitsWritten += ALLOC_OFFSET_BITS; - - return iBitsWritten; -} - -static int WriteCQMFData(const int iNumGroups, - const int *piGroupLengths, - const int iNumBands, - const int *piBandwidths, - const int **ppiAlloc, - const int **ppiSignReal, - const int **ppiSignImag, - const int **ppiQReal, - const int **ppiQImag, - Bitstream *psBSWrite) -{ - int n; - int iBitsWritten; - int iBlockOffest; - - iBitsWritten = 0; - iBlockOffest = 0; - - - for(n = 0; n < iNumGroups; n ++){ - int k; - for(k = 0; k < piGroupLengths[n]; k ++){ - int b; - int iFBOffset; - - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - int iAlloc; - int iHuffDim; - int iHuffMod; - - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - - if(iAlloc > 0){ - const unsigned int (*pauiHuffmanTable)[2] = NULL; //const? - - pauiHuffmanTable = GetHuffEncTable(iAlloc); - for(m = 0; m < piBandwidths[b]; m ++){ - int iQuantValue1; - int iQuantValue2; - - iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; - iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; - - - if(iHuffDim == 2){ - int iSymbol; - iSymbol = iQuantValue1; - iSymbol *= iHuffMod; - iSymbol += iQuantValue2; - BSPutBits(psBSWrite, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0]); - iBitsWritten += pauiHuffmanTable[iSymbol][0]; - } - else{ - BSPutBits(psBSWrite, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0]); - iBitsWritten += pauiHuffmanTable[iQuantValue1][0]; - BSPutBits(psBSWrite, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0]); - iBitsWritten += pauiHuffmanTable[iQuantValue2][0]; - } - - if(iQuantValue1 > 0){ - BSPutBits(psBSWrite,ppiSignReal[iBlockOffest][iFBOffset],1); - iBitsWritten += 1; - } - if(iQuantValue2 > 0){ - BSPutBits(psBSWrite,ppiSignImag[iBlockOffest][iFBOffset],1); - iBitsWritten += 1; - } - - iFBOffset ++; - } - } - else{ - iFBOffset += piBandwidths[b]; - } - - } - - iBlockOffest ++; - } - } - - return iBitsWritten; -} - -static int ComputeAllocation(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAvailableBits, - int *piAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag) -{ - int iBitsUsed; - int iDone; - int iDelta; - - iBitsUsed = ALLOC_OFFSET_BITS; // Bits used for Alloc Offset - - iDone = 0; - iDelta = -MIN_ALLOC_OFFSET; - *piAllocOffset = 0; - while(iDone == 0){ - int n; - int iLimitAllocOffset; - iBitsUsed = ALLOC_OFFSET_BITS; - - iLimitAllocOffset = *piAllocOffset; - iLimitAllocOffset = (iLimitAllocOffset > MIN_ALLOC_OFFSET) ? iLimitAllocOffset : MIN_ALLOC_OFFSET; - iLimitAllocOffset = (iLimitAllocOffset < MAX_ALLOC_OFFSET) ? iLimitAllocOffset : MAX_ALLOC_OFFSET; - - for(n = 0; n < iChannels; n ++){ - int k; - for(k = 0; k < piNumGroups[n]; k ++){ - int b; - for(b = 0; b < iNumBands; b ++){ - int iAlloc; - iAlloc = ((pppiSMR[n][k][b] + iLimitAllocOffset * ALLOC_OFFSET_SCALE) >> 5); - iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; - iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; - pppiAlloc[n][k][b] = iAlloc; - } - } - - QuantizeSpectrum(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const float**)pppfReal[n], - (const float**)pppfImag[n], - pppiQReal[n], - pppiQImag[n]); - - iBitsUsed += CountCQMFBits(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const int**)pppiQReal[n], - (const int**)pppiQImag[n]); - } - - if(*piAllocOffset <= MIN_ALLOC_OFFSET && iBitsUsed > iAvailableBits){ -#ifdef DEBUG_VERBOSE - printf("Frame can not be coded with the number of bits available\n"); -#endif - //iLastError = ENC_ERROR_STREAM_FAILURE; - return -1; - } - else if(*piAllocOffset >= MAX_ALLOC_OFFSET && iBitsUsed < iAvailableBits){ - *piAllocOffset = MAX_ALLOC_OFFSET; - iDone ++; - } - else{ - if(iDelta == 0 && iBitsUsed > iAvailableBits){ - iDelta = 1; - } - else if(iDelta == 0 && iBitsUsed < iAvailableBits){ - iDone ++; - } - else if(iBitsUsed == iAvailableBits){ - iDone ++; - } - - if(iBitsUsed > iAvailableBits){ - *piAllocOffset -= iDelta; - iDelta >>= 1; - } - else if(iBitsUsed < iAvailableBits){ - *piAllocOffset += iDelta; - iDelta >>= 1; - } - } - - } - - //printf("%d\t%d\t%d\t%d\n",*piAllocOffset,iAvailableBits,iBitsUsed,iAvailableBits - iBitsUsed); - - return iBitsUsed; -} - -static int ComputeAllocationByPass(const int iChannels, - const int *piNumGroups, - const int **ppiGroupLengths, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const int ***pppiSMR, - const int iAllocOffset, - int ***pppiAlloc, - int ***pppiQReal, - int ***pppiQImag) -{ - int n; - int iBitsUsed; - - iBitsUsed = ALLOC_OFFSET_BITS; - - for(n = 0; n < iChannels; n ++){ - int k; - for(k = 0; k < piNumGroups[n]; k ++){ - int b; - for(b = 0; b < iNumBands; b ++){ - int iAlloc; - iAlloc = ((pppiSMR[n][k][b] + iAllocOffset * ALLOC_OFFSET_SCALE) >> 5); - iAlloc = (iAlloc > MIN_ALLOC) ? iAlloc : MIN_ALLOC; - iAlloc = (iAlloc < MAX_ALLOC) ? iAlloc : MAX_ALLOC; - pppiAlloc[n][k][b] = iAlloc; - } - } - - QuantizeSpectrum(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const float**)pppfReal[n], - (const float**)pppfImag[n], - pppiQReal[n], - pppiQImag[n]); - - iBitsUsed += CountCQMFBits(piNumGroups[n], - (const int*)ppiGroupLengths[n], - iNumBands, - piBandwidths, - (const int**)pppiAlloc[n], - (const int**)pppiQReal[n], - (const int**)pppiQImag[n]); - } - - return iBitsUsed; -} diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h b/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h deleted file mode 100644 index d509827beb..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFEncoder.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _CQMF_ENCODER_H_ -#define _CQMF_ENCODER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define ENCODER_ERROR_NONE (0) -#define ENCODER_ERROR_FS_NOT_SUPPORTED (-1) -#define ENCODER_ERROR_CHAN_NOT_SUPPORTED (-2) -#define ENCODER_ERROR_UNKNOWN (-100) - -typedef struct CQMF_ENCODER CQMFEncoder; - -CQMFEncoder* CreateCQMFEncoder(const int iSampleRate, - const int iChannels, - const int iTargetBitRate); - -void DeleteCQMFEncoder(CQMFEncoder *psCQMFEncoder); - -int CQMFEncoderGetError(CQMFEncoder *psCQMFEncoder); - -int EncodeFrame(CQMFEncoder *psCQMFEncoder, - float ***pppfCQMFReal, - float ***pppfCQMFImag, - int *piNumiBytes, - unsigned char *puchData); - -#ifdef __cplusplus -} -#endif - -#endif /* _CQMF_ENCODER_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c b/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c deleted file mode 100644 index ad7e387c72..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.c +++ /dev/null @@ -1,1457 +0,0 @@ -#include "CQMFHuff.h" -#include "wmops.h" - -const unsigned int c_aaiCQMFHuffEnc1[16][2] = -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, {0x000b, 0x0001}, - {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0009, 0x0003}, {0x000a, 0x0001}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, -}; - -const unsigned int c_aaiCQMFHuffDec1[4][16] = -{ - {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x00010003, 0x00010003, 0x00010007, 0x00010007, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, -}; - -const unsigned int c_aaiCQMFHuffEnc2[25][2] = -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0000}, {0x000c, 0x0001}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, - {0x000c, 0x0002}, {0x000c, 0x0003}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, - {0x000b, 0x0004}, {0x000c, 0x0007}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, - {0x000b, 0x000b}, - -}; - -const unsigned int c_aaiCQMFHuffDec2[4][16] = -{ - {0x0001ffff, 0x00000006, 0x00010005, 0x00010005, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0002ffff, 0x0001000b, 0x0001000b, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, - {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x00000003, 0x00000004, 0x00000008, 0x00000009, 0x0000000d, 0x0000000e, 0x0000000f, 0x00000011, 0x00010010, 0x00010010, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, }, -}; - -const unsigned int c_aaiCQMFHuffEnc3[36][2] = -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0006}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, - {0x0007, 0x0001}, {0x000b, 0x0007}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0009, 0x0003}, {0x000b, 0x0008}, - {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000a, 0x0005}, {0x000c, 0x000a}, {0x000b, 0x0009}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, - {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000d, 0x0010}, - {0x000d, 0x0011}, {0x000d, 0x0012}, {0x000d, 0x0013}, {0x000c, 0x000b}, - -}; - -const unsigned int c_aaiCQMFHuffDec3[14][16] = -{ - {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0002ffff, 0x00010008, 0x00010008, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x0001000f, 0x0001000f, 0x00010014, 0x00010014, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0005ffff, 0x0006ffff, 0x0004ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x00000013, 0x00000023, 0x00010003, 0x00010003, 0x00010009, 0x00010009, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, -}; - -const unsigned int c_aaiCQMFHuffEnc4[49][2] = -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0004}, {0x000f, 0x0000}, {0x000f, 0x0001}, {0x000f, 0x0002}, {0x0003, 0x0001}, - {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x0005}, {0x000f, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0006, 0x0002}, {0x0006, 0x0003}, - {0x0008, 0x0001}, {0x000d, 0x000a}, {0x000f, 0x0006}, {0x000f, 0x0007}, {0x000f, 0x0008}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0006}, - {0x000c, 0x0007}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000e, 0x000c}, {0x000d, 0x000b}, {0x000f, 0x000c}, {0x000f, 0x000d}, - {0x000f, 0x000e}, {0x000f, 0x000f}, {0x000f, 0x0010}, {0x000f, 0x0011}, {0x000f, 0x0012}, {0x000f, 0x0013}, {0x000f, 0x0014}, {0x000f, 0x0015}, - {0x000f, 0x0016}, {0x000f, 0x0017}, {0x000e, 0x000d}, {0x000e, 0x000e}, {0x000e, 0x000f}, {0x000e, 0x0010}, {0x000e, 0x0011}, {0x000e, 0x0012}, - {0x000e, 0x0013}, - -}; - -const unsigned int c_aaiCQMFHuffDec4[9][16] = -{ - {0x0001ffff, 0x00000008, 0x00010007, 0x00010007, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000010, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x0007ffff, 0x0006ffff, 0x0008ffff, 0x0004ffff, 0x0005ffff, 0x0003ffff, 0x00000017, 0x00000018, 0x00010003, 0x00010003, 0x0001000a, 0x0001000a, 0x00010015, 0x00010015, 0x00010016, 0x00010016, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, - {0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, - {0x00010014, 0x00010014, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, - {0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, - {0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, -}; - -const unsigned int c_aaiCQMFHuffEnc5[64][2] = -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000f, 0x000c}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, - {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, {0x000a, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, - {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x000c, 0x0003}, {0x000f, 0x000d}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, - {0x000b, 0x0003}, {0x000a, 0x0003}, {0x000d, 0x0004}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, - {0x000e, 0x0007}, {0x000d, 0x0005}, {0x0010, 0x0015}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, - {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, - {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, - {0x0011, 0x0024}, {0x0011, 0x0025}, {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0011, 0x0028}, {0x0011, 0x0029}, {0x0010, 0x0016}, {0x0010, 0x0017}, -}; - -const unsigned int c_aaiCQMFHuffDec5[27][16] = -{ - {0x0001ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000012, 0x00010011, 0x00010011, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, - {0x0005ffff, 0x0004ffff, 0x0003ffff, 0x00000013, 0x00010003, 0x00010003, 0x00010018, 0x00010018, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, - {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, - {0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x00000022, 0x0000003e, 0x0000003f, 0x00010004, 0x00010004, 0x00010014, 0x00010014, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x0008ffff, 0x0007ffff, 0x0009ffff, 0x000dffff, 0x0006ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, - {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, - {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, -}; - -const unsigned int c_aaiCQMFHuffEnc6[81][2] = -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000e, 0x0005}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, - {0x0012, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x000e, 0x0006}, {0x0012, 0x0004}, {0x0012, 0x0005}, - {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000c, 0x0003}, {0x000f, 0x0008}, {0x0012, 0x0008}, - {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x000b, 0x0003}, {0x000a, 0x0003}, {0x000d, 0x0005}, {0x000e, 0x0007}, {0x0011, 0x001c}, - {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0009}, {0x0010, 0x000f}, - {0x0012, 0x0010}, {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0011, 0x001d}, {0x0012, 0x0016}, - {0x0012, 0x0017}, {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, - {0x0012, 0x001f}, {0x0012, 0x0020}, {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, - {0x0012, 0x0027}, {0x0012, 0x0028}, {0x0012, 0x0029}, {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0012, 0x002c}, {0x0012, 0x002d}, {0x0012, 0x002e}, - {0x0012, 0x002f}, {0x0012, 0x0030}, {0x0012, 0x0031}, {0x0012, 0x0032}, {0x0012, 0x0033}, {0x0012, 0x0034}, {0x0012, 0x0035}, {0x0012, 0x0036}, - {0x0012, 0x0037}, - -}; - -const unsigned int c_aaiCQMFHuffDec6[21][16] = -{ - {0x0001ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000014, 0x0001000b, 0x0001000b, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x0005ffff, 0x0004ffff, 0x0003ffff, 0x00000015, 0x00010003, 0x00010003, 0x0001001b, 0x0001001b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, - {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x00010016, 0x00010016, 0x00010026, 0x00010026, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x0008ffff, 0x0009ffff, 0x0007ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0006ffff, 0x00000027, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, - {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, }, - {0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, }, - {0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, }, - {0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, - {0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x00020044, 0x00020044, 0x00020044, 0x00020044, }, - {0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, }, - {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, }, - {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020050, 0x00020050, 0x00020050, 0x00020050, }, -}; - -const unsigned int c_aaiCQMFHuffEnc7[81][2] = -{ - {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0005, 0x0001}, {0x000a, 0x0002}, {0x000d, 0x0005}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, - {0x0012, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0006}, {0x000f, 0x0009}, {0x0012, 0x0004}, - {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0001}, {0x000b, 0x0002}, {0x000e, 0x0006}, {0x0011, 0x0018}, - {0x0011, 0x0019}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x000a, 0x0003}, {0x0009, 0x0003}, {0x000b, 0x0003}, {0x000e, 0x0007}, {0x000f, 0x000a}, - {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x000d, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x000b}, - {0x0011, 0x001a}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0010, 0x000e}, {0x0012, 0x0011}, {0x0010, 0x000f}, - {0x0010, 0x0010}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0010, 0x0011}, {0x0012, 0x0017}, - {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, - {0x0012, 0x0020}, {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, - {0x0012, 0x0028}, {0x0012, 0x0029}, {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0012, 0x002c}, {0x0012, 0x002d}, {0x0012, 0x002e}, {0x0012, 0x002f}, - {0x0011, 0x001b}, - -}; - -const unsigned int c_aaiCQMFHuffDec7[23][16] = -{ - {0x0001ffff, 0x0002ffff, 0x0001000a, 0x0001000a, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, - {0x0004ffff, 0x0003ffff, 0x00010014, 0x00010014, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0008ffff, 0x0007ffff, 0x0006ffff, 0x0005ffff, 0x00010015, 0x00010015, 0x0001001d, 0x0001001d, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00000030, 0x00000036, 0x0001000e, 0x0001000e, 0x0001001f, 0x0001001f, 0x00010027, 0x00010027, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x000effff, 0x000dffff, 0x000bffff, 0x000cffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0009ffff, 0x000affff, 0x0000002d, 0x0000002f, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, - {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, - {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, }, - {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, - {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, - {0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020037, 0x00020037, 0x00020037, 0x00020037, }, - {0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, }, - {0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, }, - {0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020043, 0x00020043, 0x00020043, 0x00020043, }, - {0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020047, 0x00020047, 0x00020047, 0x00020047, }, - {0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, }, - {0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, -}; - -const unsigned int c_aaiCQMFHuffEnc8[121][2] = -{ - {0x0002, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0002}, {0x000d, 0x0003}, {0x0010, 0x0008}, {0x0014, 0x0000}, {0x0014, 0x0001}, - {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0004}, - {0x0010, 0x0009}, {0x0012, 0x0016}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0005, 0x0002}, {0x0005, 0x0003}, - {0x0007, 0x0001}, {0x000b, 0x0002}, {0x000e, 0x0004}, {0x0010, 0x000a}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, - {0x0014, 0x000d}, {0x000a, 0x0003}, {0x0009, 0x0003}, {0x000b, 0x0003}, {0x000d, 0x0005}, {0x0010, 0x000b}, {0x0012, 0x0017}, {0x0014, 0x000e}, - {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0005}, {0x000f, 0x0006}, - {0x0011, 0x000d}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0011, 0x000e}, - {0x000f, 0x0007}, {0x0011, 0x000f}, {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, - {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0013, 0x002a}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0013, 0x002b}, {0x0014, 0x0021}, {0x0014, 0x0022}, - {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, - {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, - {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, - {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, - {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, - {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, - {0x0014, 0x0053}, - -}; - -const unsigned int c_aaiCQMFHuffDec8[17][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, - {0x0004ffff, 0x0003ffff, 0x00010018, 0x00010018, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x0008ffff, 0x0006ffff, 0x0005ffff, 0x0007ffff, 0x00010019, 0x00010019, 0x00010023, 0x00010023, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x000bffff, 0x0009ffff, 0x000affff, 0x00000005, 0x00000010, 0x0000001b, 0x00000025, 0x0001002f, 0x0001002f, 0x00010038, 0x00010038, }, - {0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00010042, 0x00010042, 0x00010045, 0x00010045, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, - {0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000027, 0x00000028, }, - {0x00000029, 0x0000002a, 0x0000002b, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x0000003c, 0x0000003d, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000043, }, - {0x00000044, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, }, - {0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, }, - {0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006a, 0x0000006b, 0x0000006c, 0x0000006d, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, }, -}; - -const unsigned int c_aaiCQMFHuffEnc9[196][2] = -{ - {0x0003, 0x0002}, {0x0002, 0x0002}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x000b, 0x0003}, {0x000f, 0x000e}, {0x0010, 0x0016}, {0x0013, 0x0000}, - {0x0012, 0x004a}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0003, 0x0003}, {0x0002, 0x0003}, - {0x0004, 0x0002}, {0x0008, 0x0003}, {0x000b, 0x0004}, {0x000e, 0x0009}, {0x0011, 0x0028}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, - {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0005, 0x0001}, {0x0004, 0x0003}, {0x0007, 0x0003}, {0x0009, 0x0002}, - {0x000c, 0x0004}, {0x000e, 0x000a}, {0x0010, 0x0017}, {0x0012, 0x004b}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, - {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x000b, 0x0005}, {0x000e, 0x000b}, {0x000f, 0x000f}, - {0x0011, 0x0029}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, - {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0005}, {0x000e, 0x000c}, {0x000f, 0x0010}, {0x0011, 0x002a}, {0x0012, 0x004c}, {0x0013, 0x001a}, - {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x000e, 0x000d}, {0x000d, 0x0007}, - {0x000f, 0x0011}, {0x0010, 0x0018}, {0x0012, 0x004d}, {0x0013, 0x0021}, {0x0012, 0x004e}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, - {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0010, 0x0019}, {0x0010, 0x001a}, {0x0010, 0x001b}, {0x0012, 0x004f}, - {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, - {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0011, 0x002b}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, - {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, - {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, - {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, - {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, - {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, - {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, - {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, - {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, - {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, - {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, - {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, - {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, - -}; - -const unsigned int c_aaiCQMFHuffDec9[30][16] = -{ - {0x0001ffff, 0x00000002, 0x00000010, 0x0000001d, 0x00010000, 0x00010000, 0x0001000e, 0x0001000e, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x0003ffff, 0x0002ffff, 0x00000003, 0x00000011, 0x0000002a, 0x0000002b, 0x0001001e, 0x0001001e, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, - {0x000bffff, 0x0006ffff, 0x0005ffff, 0x0004ffff, 0x00000020, 0x0000003a, 0x00010004, 0x00010004, 0x00010012, 0x00010012, 0x0001002d, 0x0001002d, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, - {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x0001003c, 0x0001003c, 0x00010048, 0x00010048, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, - {0x001cffff, 0x001dffff, 0x0009ffff, 0x000affff, 0x0007ffff, 0x0008ffff, 0x00000006, 0x00000022, 0x00000049, 0x00000054, 0x00000055, 0x00000056, 0x00010005, 0x00010005, 0x0001002f, 0x0001002f, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, }, - {0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x00020057, 0x00020057, 0x00020057, 0x00020057, }, - {0x000fffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, }, - {0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, }, - {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, }, - {0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, }, - {0x00010007, 0x00010007, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00010015, 0x00010015, 0x00010016, 0x00010016, }, - {0x00010045, 0x00010045, 0x0001004b, 0x0001004b, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, - {0x00010053, 0x00010053, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, }, - {0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, }, - {0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, }, - {0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, }, - {0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, }, - {0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, }, - {0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, }, - {0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, }, - {0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, }, - {0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, }, - {0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, }, - {0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, }, - {0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, }, -}; - -const unsigned int c_aaiCQMFHuffEnc10[196][2] = -{ - {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0004, 0x0002}, {0x0006, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0005}, {0x000f, 0x000e}, {0x000f, 0x000f}, - {0x0012, 0x003f}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0003, 0x0005}, {0x0002, 0x0003}, - {0x0004, 0x0003}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000c, 0x0006}, {0x000e, 0x000b}, {0x000f, 0x0010}, {0x0013, 0x0005}, {0x0013, 0x0006}, - {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0007, 0x0002}, - {0x000a, 0x0004}, {0x000c, 0x0007}, {0x000e, 0x000c}, {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0003}, {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000d, 0x0008}, - {0x000f, 0x0011}, {0x0011, 0x0028}, {0x0013, 0x0010}, {0x0012, 0x0040}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, - {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x0009}, {0x000f, 0x0012}, {0x0010, 0x0016}, {0x0013, 0x0015}, - {0x0011, 0x0029}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x000c, 0x0008}, {0x000b, 0x0007}, - {0x000c, 0x0009}, {0x000e, 0x000d}, {0x000f, 0x0013}, {0x0010, 0x0017}, {0x0011, 0x002a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0012, 0x0041}, - {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x000f, 0x0014}, {0x000e, 0x000e}, {0x000e, 0x000f}, {0x000f, 0x0015}, - {0x0012, 0x0042}, {0x0010, 0x0018}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, - {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0010, 0x0019}, {0x0010, 0x001a}, {0x0011, 0x002b}, {0x0010, 0x001b}, {0x0012, 0x0043}, - {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, - {0x0012, 0x0044}, {0x0012, 0x0045}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0012, 0x0046}, {0x0013, 0x0035}, {0x0013, 0x0036}, - {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, - {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, - {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, - {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, - {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, - {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, - {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, - {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, - {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0012, 0x0047}, - {0x0012, 0x0048}, {0x0012, 0x0049}, {0x0012, 0x004a}, {0x0012, 0x004b}, - -}; - -const unsigned int c_aaiCQMFHuffDec10[34][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00000002, 0x00000010, 0x0000001c, 0x0000001d, 0x00010000, 0x00010000, 0x00010001, 0x00010001, 0x0001000e, 0x0001000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0006ffff, 0x0004ffff, 0x0003ffff, 0x0005ffff, 0x0001001f, 0x0001001f, 0x0001002c, 0x0001002c, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x000fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x0007ffff, 0x00000005, 0x00000013, 0x00000021, 0x00000046, 0x00000048, 0x0001002e, 0x0001002e, 0x0001003b, 0x0001003b, 0x00010047, 0x00010047, }, - {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x00010015, 0x00010015, 0x00010030, 0x00010030, 0x0001003d, 0x0001003d, 0x0001004a, 0x0001004a, 0x00010054, 0x00010054, 0x00010057, 0x00010057, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, - {0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, - {0x000effff, 0x0011ffff, 0x0012ffff, 0x000dffff, 0x000bffff, 0x000cffff, 0x0000003e, 0x0000004b, 0x00000059, 0x00000063, 0x00000064, 0x00000066, 0x00010006, 0x00010006, 0x00010007, 0x00010007, }, - {0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020067, 0x00020067, 0x00020067, 0x00020067, }, - {0x0014ffff, 0x0013ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0010ffff, }, - {0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, }, - {0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, }, - {0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, - {0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, }, - {0x00010032, 0x00010032, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, - {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, - {0x00010053, 0x00010053, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, }, - {0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, }, - {0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, }, - {0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, }, - {0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, }, - {0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, }, - {0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, }, - {0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, }, - {0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, }, - {0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, }, - {0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, }, -}; - -const unsigned int c_aaiCQMFHuffEnc11[256][2] = -{ - {0x0004, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0004}, {0x0006, 0x0002}, {0x0008, 0x0003}, {0x000b, 0x0004}, {0x000e, 0x000c}, {0x0010, 0x001e}, - {0x0013, 0x0000}, {0x0012, 0x005b}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, - {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0005, 0x0003}, {0x0008, 0x0004}, {0x000a, 0x0004}, {0x000d, 0x0009}, {0x000f, 0x0011}, - {0x0013, 0x0007}, {0x0012, 0x005c}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0004, 0x0005}, {0x0003, 0x0007}, {0x0005, 0x0004}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000b, 0x0005}, {0x000e, 0x000d}, {0x000f, 0x0012}, - {0x0012, 0x005d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, - {0x0006, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0005}, {0x0008, 0x0005}, {0x000a, 0x0005}, {0x000d, 0x000a}, {0x000f, 0x0013}, {0x0011, 0x0035}, - {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, - {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0005}, {0x000a, 0x0006}, {0x000c, 0x0006}, {0x000e, 0x000e}, {0x000f, 0x0014}, {0x0011, 0x0036}, - {0x0012, 0x005e}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, - {0x000b, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0007}, {0x000c, 0x0007}, {0x000e, 0x000f}, {0x000f, 0x0015}, {0x0011, 0x0037}, {0x0012, 0x005f}, - {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, - {0x000e, 0x0010}, {0x000d, 0x000b}, {0x000e, 0x0011}, {0x000f, 0x0016}, {0x0010, 0x001f}, {0x0012, 0x0060}, {0x0011, 0x0038}, {0x0012, 0x0061}, - {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, - {0x0010, 0x0020}, {0x000f, 0x0017}, {0x0010, 0x0021}, {0x0011, 0x0039}, {0x0011, 0x003a}, {0x0012, 0x0062}, {0x0013, 0x0034}, {0x0013, 0x0035}, - {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, - {0x0012, 0x0063}, {0x0011, 0x003b}, {0x0012, 0x0064}, {0x0012, 0x0065}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, - {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, - {0x0013, 0x004a}, {0x0012, 0x0066}, {0x0013, 0x004b}, {0x0012, 0x0067}, {0x0012, 0x0068}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, - {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, - {0x0013, 0x0057}, {0x0012, 0x0069}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, - {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, - {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, - {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, - {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, - {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, - {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, - {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, - {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, - {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, - {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, - {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, -}; - -const unsigned int c_aaiCQMFHuffDec11[43][16] = -{ - {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000000, 0x00000002, 0x00000020, 0x00010001, 0x00010001, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010021, 0x00010021, }, - {0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x00000004, 0x00000014, 0x00000033, 0x00000040, 0x00000041, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, - {0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x00020051, 0x00020051, 0x00020051, 0x00020051, }, - {0x0014ffff, 0x000bffff, 0x000affff, 0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000044, 0x00000053, 0x00010005, 0x00010005, 0x00010025, 0x00010025, 0x00010050, 0x00010050, 0x00010052, 0x00010052, }, - {0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, }, - {0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020054, 0x00020054, 0x00020054, 0x00020054, }, - {0x00000070, 0x00000072, 0x00010017, 0x00010017, 0x00010027, 0x00010027, 0x00010036, 0x00010036, 0x00010046, 0x00010046, 0x00010055, 0x00010055, 0x00010063, 0x00010063, 0x00010071, 0x00010071, }, - {0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x0011ffff, 0x0010ffff, 0x0012ffff, 0x0013ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000007, 0x00000064, }, - {0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, - {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, - {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, - {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020057, 0x00020057, 0x00020057, 0x00020057, }, - {0x000100fa, 0x000100fa, 0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, - {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, - {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020091, 0x00020091, 0x00020091, 0x00020091, 0x00020093, 0x00020093, 0x00020093, 0x00020093, }, - {0x0018ffff, 0x0017ffff, 0x0019ffff, 0x0015ffff, 0x0016ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, }, - {0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, }, - {0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, }, - {0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, }, - {0x00010008, 0x00010008, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010018, 0x00010018, }, - {0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, - {0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, }, - {0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, }, - {0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010084, 0x00010084, 0x00010085, 0x00010085, }, - {0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, }, - {0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010092, 0x00010092, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, }, - {0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, }, - {0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, }, - {0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, }, - {0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, }, - {0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, }, - {0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, }, - {0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, }, - {0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100d9, 0x000100d9, }, - {0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100e1, 0x000100e1, }, - {0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, }, - {0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, }, - {0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, }, -}; - -const unsigned int c_aaiCQMFHuffEnc12[400][2] = -{ - {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0005, 0x0002}, {0x0007, 0x0003}, {0x000a, 0x0004}, {0x000d, 0x0009}, {0x000f, 0x0011}, - {0x0012, 0x0053}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, - {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0004, 0x0007}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0005, 0x0003}, - {0x0007, 0x0004}, {0x0009, 0x0004}, {0x000c, 0x0008}, {0x000e, 0x000c}, {0x0010, 0x001b}, {0x0011, 0x002e}, {0x0013, 0x009d}, {0x0014, 0x0009}, - {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, - {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x0004}, {0x0008, 0x0004}, {0x000a, 0x0005}, {0x000d, 0x000a}, {0x000f, 0x0012}, - {0x0011, 0x002f}, {0x0013, 0x009e}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, - {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0007, 0x0005}, - {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000e, 0x000d}, {0x000f, 0x0013}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0014, 0x001c}, {0x0014, 0x001d}, - {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, - {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0005}, {0x0009, 0x0006}, {0x000b, 0x0006}, {0x000d, 0x000b}, {0x000e, 0x000e}, {0x0010, 0x001c}, - {0x0012, 0x0054}, {0x0013, 0x009f}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0014, 0x002b}, - {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x000a, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0007}, {0x000b, 0x0007}, - {0x000d, 0x000c}, {0x000e, 0x000f}, {0x000f, 0x0014}, {0x0011, 0x0032}, {0x0013, 0x00a0}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, - {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, - {0x000d, 0x000d}, {0x000c, 0x0009}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000e, 0x0010}, {0x0010, 0x001d}, {0x0010, 0x001e}, {0x0013, 0x00a1}, - {0x0013, 0x00a2}, {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, - {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x000f, 0x0015}, {0x000e, 0x0011}, {0x000f, 0x0016}, {0x000f, 0x0017}, - {0x0010, 0x001f}, {0x0011, 0x0033}, {0x0012, 0x0055}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, - {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, - {0x0011, 0x0034}, {0x0010, 0x0020}, {0x0010, 0x0021}, {0x0011, 0x0035}, {0x0012, 0x0056}, {0x0013, 0x00a3}, {0x0014, 0x0053}, {0x0014, 0x0054}, - {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, - {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0012, 0x0057}, {0x0012, 0x0058}, {0x0014, 0x0061}, {0x0014, 0x0062}, - {0x0012, 0x0059}, {0x0014, 0x0063}, {0x0012, 0x005a}, {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, - {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, - {0x0014, 0x0071}, {0x0012, 0x005b}, {0x0014, 0x0072}, {0x0013, 0x00a4}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, - {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, {0x0014, 0x007e}, - {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, - {0x0014, 0x0087}, {0x0013, 0x00a5}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, - {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, - {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, - {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, - {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0014, 0x00ad}, - {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, - {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, - {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, - {0x0014, 0x00c6}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, - {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, - {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, - {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, - {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, - {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, - {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, - {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, - {0x0014, 0x0106}, {0x0014, 0x0107}, {0x0014, 0x0108}, {0x0014, 0x0109}, {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, - {0x0014, 0x010e}, {0x0014, 0x010f}, {0x0014, 0x0110}, {0x0014, 0x0111}, {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, - {0x0014, 0x0116}, {0x0014, 0x0117}, {0x0014, 0x0118}, {0x0014, 0x0119}, {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, - {0x0014, 0x011e}, {0x0014, 0x011f}, {0x0014, 0x0120}, {0x0014, 0x0121}, {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, - {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, {0x0014, 0x0129}, {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, - {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, {0x0014, 0x0131}, {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, -}; - -const unsigned int c_aaiCQMFHuffDec12[44][16] = -{ - {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000001, 0x00000002, 0x00000014, 0x00000028, 0x0000002a, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010029, 0x00010029, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0000002c, 0x00000052, 0x00010004, 0x00010004, 0x00010018, 0x00010018, 0x0001003f, 0x0001003f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, - {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, - {0x0018ffff, 0x000fffff, 0x000effff, 0x000dffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0000001a, 0x00000079, 0x00010041, 0x00010041, 0x00010054, 0x00010054, 0x00010067, 0x00010067, }, - {0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, - {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, - {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020069, 0x00020069, 0x00020069, 0x00020069, }, - {0x000000a1, 0x000000a2, 0x00010007, 0x00010007, 0x0001002f, 0x0001002f, 0x00010043, 0x00010043, 0x0001006a, 0x0001006a, 0x0001008c, 0x0001008c, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, }, - {0x0029ffff, 0x002affff, 0x002bffff, 0x0017ffff, 0x0015ffff, 0x0014ffff, 0x0016ffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000001c, 0x00000057, 0x0000007d, 0x0000007e, 0x00000090, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, - {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, }, - {0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, - {0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, }, - {0x0001006c, 0x0001006c, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x000100a5, 0x000100a5, 0x000100cb, 0x000100cb, 0x000100e1, 0x000100e1, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, }, - {0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001001e, 0x0001001e, 0x00010031, 0x00010031, 0x00010059, 0x00010059, }, - {0x001affff, 0x001bffff, 0x0019ffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, }, - {0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, }, - {0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, }, - {0x00000026, 0x00000027, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003a, 0x0000003b, 0x00000046, 0x00000047, 0x00000048, 0x00000049, }, - {0x0000006d, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, }, - {0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, }, - {0x0000009d, 0x0000009e, 0x0000009f, 0x000000a6, 0x000000a7, 0x000000a8, 0x000000a9, 0x000000aa, 0x000000ab, 0x000000ac, 0x000000ad, 0x000000ae, 0x000000af, 0x000000b0, 0x000000b1, 0x000000b2, }, - {0x000000b3, 0x000000b6, 0x000000b7, 0x000000b9, 0x000000bb, 0x000000bc, 0x000000bd, 0x000000be, 0x000000bf, 0x000000c0, 0x000000c1, 0x000000c2, 0x000000c3, 0x000000c4, 0x000000c5, 0x000000c6, }, - {0x000000c7, 0x000000c8, 0x000000ca, 0x000000cc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000d8, }, - {0x000000d9, 0x000000da, 0x000000db, 0x000000dc, 0x000000dd, 0x000000de, 0x000000df, 0x000000e0, 0x000000e2, 0x000000e3, 0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, }, - {0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000f3, 0x000000f4, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, 0x000000f9, }, - {0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, }, - {0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, }, - {0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000129, }, - {0x0000012a, 0x0000012b, 0x0000012c, 0x0000012d, 0x0000012e, 0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x00000138, 0x00000139, }, - {0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, 0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00000144, 0x00000145, 0x00000146, 0x00000147, 0x00000148, 0x00000149, }, - {0x0000014a, 0x0000014b, 0x0000014c, 0x0000014d, 0x0000014e, 0x0000014f, 0x00000150, 0x00000151, 0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, }, - {0x0000015a, 0x0000015b, 0x0000015c, 0x0000015d, 0x0000015e, 0x0000015f, 0x00000160, 0x00000161, 0x00000162, 0x00000163, 0x00000164, 0x00000165, 0x00000166, 0x00000167, 0x00000168, 0x00000169, }, - {0x0000016a, 0x0000016b, 0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, }, - {0x0000017a, 0x0000017b, 0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, }, -}; - -const unsigned int c_aaiCQMFHuffEnc13[625][2] = -{ - {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0005}, {0x0008, 0x0006}, {0x000a, 0x0008}, {0x000c, 0x000c}, - {0x000e, 0x0019}, {0x0010, 0x0049}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, - {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0006, 0x0006}, {0x0007, 0x0006}, {0x0009, 0x0007}, - {0x000b, 0x0009}, {0x000d, 0x0011}, {0x000f, 0x002a}, {0x0010, 0x004a}, {0x0011, 0x0084}, {0x0012, 0x0100}, {0x0013, 0x000f}, {0x0013, 0x0010}, - {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, - {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0005, 0x0008}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x0009}, {0x0006, 0x0007}, {0x0008, 0x0007}, - {0x0009, 0x0008}, {0x000b, 0x000a}, {0x000d, 0x0012}, {0x000f, 0x002b}, {0x0012, 0x0101}, {0x0012, 0x0102}, {0x0013, 0x001b}, {0x0013, 0x001c}, - {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, - {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0005, 0x000a}, {0x0004, 0x000d}, {0x0005, 0x000b}, {0x0006, 0x0008}, {0x0007, 0x0007}, - {0x0009, 0x0009}, {0x000a, 0x0009}, {0x000c, 0x000d}, {0x000d, 0x0013}, {0x0010, 0x004b}, {0x0010, 0x004c}, {0x0013, 0x0028}, {0x0013, 0x0029}, - {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, - {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0008}, - {0x0008, 0x0008}, {0x000a, 0x000a}, {0x000b, 0x000b}, {0x000d, 0x0014}, {0x000e, 0x001a}, {0x0011, 0x0085}, {0x0010, 0x004d}, {0x0013, 0x0036}, - {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, - {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0008, 0x0009}, {0x0007, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, {0x000a, 0x000b}, {0x000b, 0x000c}, {0x000c, 0x000e}, {0x000e, 0x001b}, {0x000f, 0x002c}, {0x0011, 0x0086}, {0x0013, 0x0044}, - {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, - {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x000a, 0x000c}, {0x0009, 0x000a}, - {0x0009, 0x000b}, {0x000a, 0x000d}, {0x000b, 0x000d}, {0x000c, 0x000f}, {0x000e, 0x001c}, {0x000e, 0x001d}, {0x0011, 0x0087}, {0x0011, 0x0088}, - {0x0012, 0x0103}, {0x0012, 0x0104}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, - {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x000c, 0x0010}, - {0x000b, 0x000e}, {0x000b, 0x000f}, {0x000c, 0x0011}, {0x000d, 0x0015}, {0x000e, 0x001e}, {0x000f, 0x002d}, {0x0011, 0x0089}, {0x0011, 0x008a}, - {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, - {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, - {0x000e, 0x001f}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000e, 0x0020}, {0x000e, 0x0021}, {0x000f, 0x002e}, {0x0010, 0x004e}, {0x0013, 0x0070}, - {0x0012, 0x0105}, {0x0012, 0x0106}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, - {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, - {0x0013, 0x007f}, {0x0010, 0x004f}, {0x000f, 0x002f}, {0x000f, 0x0030}, {0x000f, 0x0031}, {0x0010, 0x0050}, {0x0011, 0x008b}, {0x0011, 0x008c}, - {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, - {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, - {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0012, 0x0107}, {0x0010, 0x0051}, {0x0010, 0x0052}, {0x0010, 0x0053}, {0x0011, 0x008d}, {0x0011, 0x008e}, - {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, - {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, - {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0011, 0x008f}, {0x0011, 0x0090}, {0x0013, 0x00a5}, {0x0011, 0x0091}, {0x0013, 0x00a6}, - {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, - {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, - {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, - {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, - {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, - {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, - {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, - {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, - {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, - {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, - {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, - {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, - {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, - {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, - {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, - {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, - {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, - {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, - {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, - {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, - {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, - {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, {0x0013, 0x0153}, {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, - {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, {0x0013, 0x015b}, {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, - {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, {0x0013, 0x0163}, {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, - {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, {0x0013, 0x016b}, {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, - {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, {0x0013, 0x0173}, {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, - {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, {0x0013, 0x017b}, {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, - {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, {0x0013, 0x0183}, {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, - {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, {0x0013, 0x018b}, {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, - {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, {0x0013, 0x0193}, {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, - {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, {0x0013, 0x019b}, {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, - {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, {0x0013, 0x01a3}, {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, - {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, {0x0013, 0x01ab}, {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, - {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, {0x0013, 0x01b3}, {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, - {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, {0x0013, 0x01bb}, {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, - {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, {0x0013, 0x01c3}, {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, - {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, {0x0013, 0x01cb}, {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, - {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, {0x0013, 0x01d3}, {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, - {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, {0x0013, 0x01db}, {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, - {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, {0x0013, 0x01e3}, {0x0013, 0x01e4}, {0x0013, 0x01e5}, {0x0013, 0x01e6}, - {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, {0x0013, 0x01ec}, {0x0013, 0x01ed}, {0x0013, 0x01ee}, - {0x0013, 0x01ef}, {0x0013, 0x01f0}, {0x0013, 0x01f1}, {0x0013, 0x01f2}, {0x0013, 0x01f3}, {0x0013, 0x01f4}, {0x0013, 0x01f5}, {0x0013, 0x01f6}, - {0x0013, 0x01f7}, {0x0013, 0x01f8}, {0x0013, 0x01f9}, {0x0013, 0x01fa}, {0x0013, 0x01fb}, {0x0013, 0x01fc}, {0x0013, 0x01fd}, {0x0013, 0x01fe}, - {0x0013, 0x01ff}, - -}; - -const unsigned int c_aaiCQMFHuffDec13[98][16] = -{ - {0x0006ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000001, 0x00000019, 0x0000001b, 0x0000001c, 0x00000033, 0x00000034, 0x0000004c, 0x0001001a, 0x0001001a, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, }, - {0x00010067, 0x00010067, 0x0001007e, 0x0001007e, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x00020036, 0x00020036, 0x00020036, 0x00020036, }, - {0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, - {0x000cffff, 0x000bffff, 0x000affff, 0x0008ffff, 0x0007ffff, 0x0009ffff, 0x00000005, 0x00000037, 0x00000068, 0x0000007d, 0x0000007f, 0x00000080, 0x0001001e, 0x0001001e, 0x0001004f, 0x0001004f, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, - {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020099, 0x00020099, 0x00020099, 0x00020099, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, - {0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, }, - {0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, - {0x000000af, 0x000000b2, 0x00010020, 0x00010020, 0x00010039, 0x00010039, 0x0001006a, 0x0001006a, 0x00010082, 0x00010082, 0x0001009a, 0x0001009a, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, }, - {0x001effff, 0x002fffff, 0x0040ffff, 0x0051ffff, 0x0014ffff, 0x0013ffff, 0x0011ffff, 0x0012ffff, 0x000effff, 0x000dffff, 0x000fffff, 0x0010ffff, 0x00000007, 0x00000052, 0x00000083, 0x0000009b, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, - {0x000200cb, 0x000200cb, 0x000200cb, 0x000200cb, 0x000200cc, 0x000200cc, 0x000200cc, 0x000200cc, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, - {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, }, - {0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300c9, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, }, - {0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x00020084, 0x00020084, 0x00020084, 0x00020084, }, - {0x0002009c, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, }, - {0x000000e5, 0x000000fb, 0x000000fc, 0x000000fd, 0x00010022, 0x00010022, 0x0001003b, 0x0001003b, 0x00010085, 0x00010085, 0x000100b5, 0x000100b5, 0x000100cd, 0x000100cd, 0x000100e2, 0x000100e2, }, - {0x001cffff, 0x001dffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x00000009, 0x00000023, 0x00000054, 0x00000055, 0x0000006e, 0x000000ce, 0x000000e1, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, }, - {0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, }, - {0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, 0x000300b6, }, - {0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300b7, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, 0x000300e6, }, - {0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300e7, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, 0x000300fe, }, - {0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x000300ff, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, }, - {0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, }, - {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, }, - {0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200fa, 0x000200fa, 0x000200fa, 0x000200fa, }, - {0x0021ffff, 0x0023ffff, 0x0022ffff, 0x0025ffff, 0x0024ffff, 0x0026ffff, 0x0029ffff, 0x001fffff, 0x0020ffff, 0x0027ffff, 0x0028ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, }, - {0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, }, - {0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, - {0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, }, - {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, - {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010026, 0x00010026, }, - {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, }, - {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, - {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, }, - {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, }, - {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, }, - {0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, }, - {0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, }, - {0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, }, - {0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, }, - {0x000100cf, 0x000100cf, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, }, - {0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, }, - {0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, }, - {0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, }, - {0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, }, - {0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, }, - {0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, }, - {0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, 0x00010112, 0x00010112, 0x00010115, 0x00010115, 0x00010117, 0x00010117, 0x00010118, 0x00010118, }, - {0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, - {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, - {0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, }, - {0x00010131, 0x00010131, 0x00010132, 0x00010132, 0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, }, - {0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, }, - {0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010148, 0x00010148, }, - {0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, }, - {0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, }, - {0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, }, - {0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, }, - {0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, }, - {0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, }, - {0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, }, - {0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, }, - {0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, }, - {0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, }, - {0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, 0x00010194, 0x00010194, 0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, }, - {0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, }, - {0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, }, - {0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, }, - {0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, }, - {0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, }, - {0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, }, - {0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, }, - {0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, }, - {0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, 0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, }, - {0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, }, - {0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, }, - {0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, 0x0061ffff, }, - {0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, }, - {0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, }, - {0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, 0x00010204, 0x00010204, 0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, }, - {0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, }, - {0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, 0x00010214, 0x00010214, 0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, }, - {0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, }, - {0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, 0x00010224, 0x00010224, 0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, }, - {0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, }, - {0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, }, - {0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, }, - {0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, 0x00010244, 0x00010244, 0x00010245, 0x00010245, 0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, }, - {0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, 0x0001024c, 0x0001024c, 0x0001024d, 0x0001024d, 0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, }, - {0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, 0x00010254, 0x00010254, 0x00010255, 0x00010255, 0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, }, - {0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, 0x0001025c, 0x0001025c, 0x0001025d, 0x0001025d, 0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, }, - {0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, 0x00010264, 0x00010264, 0x00010265, 0x00010265, 0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, }, - {0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, 0x0001026c, 0x0001026c, 0x0001026d, 0x0001026d, 0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00010270, 0x00010270, }, -}; - -const unsigned int c_aaiCQMFHuffEnc14[625][2] = -{ - {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0006, 0x0007}, {0x0007, 0x0007}, {0x0009, 0x0009}, {0x000a, 0x000a}, - {0x000c, 0x000e}, {0x000e, 0x0019}, {0x000f, 0x0029}, {0x0010, 0x0046}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, - {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, - {0x0013, 0x000c}, {0x0005, 0x000b}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x000c}, {0x0006, 0x0008}, {0x0008, 0x0008}, - {0x0009, 0x000a}, {0x000b, 0x000c}, {0x000c, 0x000f}, {0x000e, 0x001a}, {0x0010, 0x0047}, {0x0010, 0x0048}, {0x0012, 0x00f1}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, - {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0005, 0x000d}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x000e}, {0x0006, 0x0009}, {0x0007, 0x0008}, - {0x0008, 0x0009}, {0x000a, 0x000b}, {0x000b, 0x000d}, {0x000d, 0x0013}, {0x000e, 0x001b}, {0x0010, 0x0049}, {0x0013, 0x0018}, {0x0013, 0x0019}, - {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, - {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0005, 0x000f}, {0x0004, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x000a}, - {0x0007, 0x0009}, {0x0009, 0x000b}, {0x000a, 0x000c}, {0x000c, 0x0010}, {0x000d, 0x0014}, {0x000f, 0x002a}, {0x0012, 0x00f2}, {0x0013, 0x0025}, - {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, - {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0006, 0x000b}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0006, 0x000c}, - {0x0007, 0x000a}, {0x0008, 0x000a}, {0x000a, 0x000d}, {0x000b, 0x000e}, {0x000c, 0x0011}, {0x000e, 0x001c}, {0x000f, 0x002b}, {0x0011, 0x0081}, - {0x0013, 0x0032}, {0x0012, 0x00f3}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, - {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0007, 0x000b}, {0x0006, 0x000d}, {0x0007, 0x000c}, - {0x0007, 0x000d}, {0x0008, 0x000b}, {0x0009, 0x000c}, {0x000b, 0x000f}, {0x000c, 0x0012}, {0x000d, 0x0015}, {0x000e, 0x001d}, {0x0010, 0x004a}, - {0x0011, 0x0082}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, - {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0009, 0x000d}, {0x0008, 0x000c}, - {0x0008, 0x000d}, {0x0009, 0x000e}, {0x000a, 0x000e}, {0x000b, 0x0010}, {0x000c, 0x0013}, {0x000d, 0x0016}, {0x000e, 0x001e}, {0x000f, 0x002c}, - {0x0010, 0x004b}, {0x0012, 0x00f4}, {0x0012, 0x00f5}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, - {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x000a, 0x000f}, - {0x0009, 0x000f}, {0x000a, 0x0010}, {0x000a, 0x0011}, {0x000b, 0x0011}, {0x000c, 0x0014}, {0x000d, 0x0017}, {0x000e, 0x001f}, {0x000f, 0x002d}, - {0x0010, 0x004c}, {0x0011, 0x0083}, {0x0011, 0x0084}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, - {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, - {0x000c, 0x0015}, {0x000b, 0x0012}, {0x000b, 0x0013}, {0x000c, 0x0016}, {0x000c, 0x0017}, {0x000d, 0x0018}, {0x000e, 0x0020}, {0x000f, 0x002e}, - {0x0011, 0x0085}, {0x0010, 0x004d}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, - {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, - {0x0013, 0x0072}, {0x000e, 0x0021}, {0x000d, 0x0019}, {0x000d, 0x001a}, {0x000d, 0x001b}, {0x000e, 0x0022}, {0x000f, 0x002f}, {0x0010, 0x004e}, - {0x0011, 0x0086}, {0x0011, 0x0087}, {0x0013, 0x0073}, {0x0012, 0x00f6}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, - {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, - {0x0013, 0x0080}, {0x0013, 0x0081}, {0x000f, 0x0030}, {0x000e, 0x0023}, {0x000e, 0x0024}, {0x000e, 0x0025}, {0x0010, 0x004f}, {0x0012, 0x00f7}, - {0x0011, 0x0088}, {0x0012, 0x00f8}, {0x0012, 0x00f9}, {0x0012, 0x00fa}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, - {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, - {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0012, 0x00fb}, {0x0010, 0x0050}, {0x0010, 0x0051}, {0x000f, 0x0031}, {0x0012, 0x00fc}, - {0x0012, 0x00fd}, {0x0012, 0x00fe}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, - {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, - {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0011, 0x0089}, {0x0011, 0x008a}, - {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0011, 0x008b}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, - {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, - {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0012, 0x00ff}, {0x0013, 0x00ba}, - {0x0012, 0x0100}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, - {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, - {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, - {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, - {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, - {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, - {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, - {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, - {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, - {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, - {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, - {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, - {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, - {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, - {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, - {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, - {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, - {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, - {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, - {0x0013, 0x0152}, {0x0013, 0x0153}, {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, - {0x0013, 0x015a}, {0x0013, 0x015b}, {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, - {0x0013, 0x0162}, {0x0013, 0x0163}, {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, - {0x0013, 0x016a}, {0x0013, 0x016b}, {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, - {0x0013, 0x0172}, {0x0013, 0x0173}, {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, - {0x0013, 0x017a}, {0x0013, 0x017b}, {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, - {0x0013, 0x0182}, {0x0013, 0x0183}, {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, - {0x0013, 0x018a}, {0x0013, 0x018b}, {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, - {0x0013, 0x0192}, {0x0013, 0x0193}, {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, - {0x0013, 0x019a}, {0x0013, 0x019b}, {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, - {0x0013, 0x01a2}, {0x0013, 0x01a3}, {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, - {0x0013, 0x01aa}, {0x0013, 0x01ab}, {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, - {0x0013, 0x01b2}, {0x0013, 0x01b3}, {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, - {0x0013, 0x01ba}, {0x0013, 0x01bb}, {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, - {0x0013, 0x01c2}, {0x0013, 0x01c3}, {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, - {0x0013, 0x01ca}, {0x0013, 0x01cb}, {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, - {0x0013, 0x01d2}, {0x0013, 0x01d3}, {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, - {0x0013, 0x01da}, {0x0013, 0x01db}, {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, - {0x0012, 0x0101}, - -}; - -const unsigned int c_aaiCQMFHuffDec14[103][16] = -{ - {0x000affff, 0x0009ffff, 0x0008ffff, 0x0002ffff, 0x0003ffff, 0x0001ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0000001a, 0x0000001b, 0x0000001c, 0x00000033, 0x00000034, 0x0000004c, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, - {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, - {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, - {0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, }, - {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020064, 0x00020064, 0x00020064, 0x00020064, }, - {0x00010037, 0x00010037, 0x00010050, 0x00010050, 0x00010068, 0x00010068, 0x0001007d, 0x0001007d, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00020004, 0x00020004, 0x00020004, 0x00020004, }, - {0x0012ffff, 0x0011ffff, 0x000fffff, 0x0010ffff, 0x000cffff, 0x000bffff, 0x000dffff, 0x000effff, 0x0000001f, 0x00000038, 0x00000069, 0x00000081, 0x00000097, 0x00000098, 0x00010005, 0x00010005, }, - {0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, - {0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, }, - {0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, }, - {0x0001009b, 0x0001009b, 0x000100b3, 0x000100b3, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002009a, 0x0002009a, 0x0002009a, 0x0002009a, 0x000200af, 0x000200af, 0x000200af, 0x000200af, }, - {0x00000053, 0x0000006c, 0x00000084, 0x0000009c, 0x000000b4, 0x000000c8, 0x000000cb, 0x000000cc, 0x00010021, 0x00010021, 0x0001003a, 0x0001003a, 0x0001006b, 0x0001006b, 0x00010083, 0x00010083, }, - {0x0028ffff, 0x0039ffff, 0x004affff, 0x0023ffff, 0x001cffff, 0x001bffff, 0x0019ffff, 0x0018ffff, 0x001affff, 0x0015ffff, 0x0013ffff, 0x0014ffff, 0x0016ffff, 0x0017ffff, 0x00000008, 0x00000022, }, - {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, }, - {0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, }, - {0x000200fc, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, }, - {0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e3, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, 0x000300e4, }, - {0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, }, - {0x000100fa, 0x000100fa, 0x00010116, 0x00010116, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, }, - {0x000200ce, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200fb, 0x000200fb, 0x000200fb, 0x000200fb, }, - {0x00000114, 0x00000115, 0x0001000a, 0x0001000a, 0x00010055, 0x00010055, 0x0001006e, 0x0001006e, 0x0001009f, 0x0001009f, 0x000100b7, 0x000100b7, 0x000100cf, 0x000100cf, 0x000100e6, 0x000100e6, }, - {0x001fffff, 0x001dffff, 0x001effff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0000000b, 0x00000024, 0x00000025, 0x0000003d, 0x00000087, 0x000000a0, 0x000000b8, 0x000000d1, 0x000000e7, 0x000000fe, }, - {0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, }, - {0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, }, - {0x00020148, 0x00020148, 0x00020148, 0x00020148, 0x00020270, 0x00020270, 0x00020270, 0x00020270, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, }, - {0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e8, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, 0x000300e9, }, - {0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x00030100, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, 0x0003012e, }, - {0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, 0x00030132, }, - {0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, 0x0061ffff, 0x0062ffff, 0x0063ffff, 0x0064ffff, 0x0065ffff, 0x0066ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, }, - {0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020071, 0x00020071, 0x00020071, 0x00020071, }, - {0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200eb, 0x000200eb, 0x000200eb, 0x000200eb, 0x000200ff, 0x000200ff, 0x000200ff, 0x000200ff, }, - {0x00020101, 0x00020101, 0x00020101, 0x00020101, 0x00020102, 0x00020102, 0x00020102, 0x00020102, 0x00020103, 0x00020103, 0x00020103, 0x00020103, 0x00020113, 0x00020113, 0x00020113, 0x00020113, }, - {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020118, 0x00020118, 0x00020118, 0x00020118, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x00020146, 0x00020146, 0x00020146, 0x00020146, }, - {0x0031ffff, 0x002dffff, 0x002bffff, 0x002cffff, 0x002effff, 0x002fffff, 0x0032ffff, 0x0037ffff, 0x0029ffff, 0x002affff, 0x0030ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0038ffff, }, - {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, }, - {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, }, - {0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, - {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, - {0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, - {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, }, - {0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, }, - {0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100bb, 0x000100bb, }, - {0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, - {0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010070, 0x00010070, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, }, - {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, - {0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, }, - {0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, }, - {0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100ea, 0x000100ea, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, }, - {0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, - {0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, }, - {0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, }, - {0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, }, - {0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, }, - {0x00010112, 0x00010112, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, - {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, - {0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010133, 0x00010133, }, - {0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, }, - {0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, }, - {0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010147, 0x00010147, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, }, - {0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, }, - {0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, }, - {0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, }, - {0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, }, - {0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, }, - {0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, }, - {0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, }, - {0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, }, - {0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, }, - {0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, 0x00010194, 0x00010194, 0x00010195, 0x00010195, }, - {0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, }, - {0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, }, - {0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, }, - {0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, }, - {0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, }, - {0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, }, - {0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, }, - {0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, }, - {0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, 0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, }, - {0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, }, - {0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, }, - {0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, }, - {0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, }, - {0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, 0x00010204, 0x00010204, 0x00010205, 0x00010205, }, - {0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, }, - {0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, 0x00010214, 0x00010214, 0x00010215, 0x00010215, }, - {0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, }, - {0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, 0x00010224, 0x00010224, 0x00010225, 0x00010225, }, - {0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, }, - {0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, }, - {0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, }, - {0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, 0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, 0x00010244, 0x00010244, 0x00010245, 0x00010245, }, - {0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, 0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, 0x0001024c, 0x0001024c, 0x0001024d, 0x0001024d, }, - {0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, 0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, 0x00010254, 0x00010254, 0x00010255, 0x00010255, }, - {0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, 0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, 0x0001025c, 0x0001025c, 0x0001025d, 0x0001025d, }, - {0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, 0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, 0x00010264, 0x00010264, 0x00010265, 0x00010265, }, - {0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, 0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, 0x0001026c, 0x0001026c, 0x0001026d, 0x0001026d, }, -}; - -const unsigned int c_aaiCQMFHuffEnc15[28][2] = -{ - {0x0003, 0x0001}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0001}, {0x0005, 0x0001}, {0x0006, 0x0001}, - {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000f, 0x0003}, - {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, {0x0011, 0x0007}, - {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, - -}; - -const unsigned int c_aaiCQMFHuffDec15[10][16] = -{ - {0x0001ffff, 0x00000005, 0x00010000, 0x00010000, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, - {0x0002ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x0003ffff, 0x0000000d, 0x0001000c, 0x0001000c, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x0001000f, 0x0001000f, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, -}; - -const unsigned int c_aaiCQMFHuffEnc16[32][2] = -{ - {0x0003, 0x0001}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0001}, {0x0005, 0x0001}, - {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, - {0x0010, 0x0007}, {0x0011, 0x0001}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, - {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, -}; - -const unsigned int c_aaiCQMFHuffDec16[11][16] = -{ - {0x0001ffff, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x0002ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, -}; - -const unsigned int c_aaiCQMFHuffEnc17[41][2] = -{ - {0x0004, 0x0001}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0002}, - {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, - {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x0010, 0x0003}, {0x0011, 0x0005}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, - {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, - {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, - {0x0013, 0x0013}, - -}; - -const unsigned int c_aaiCQMFHuffDec17[7][16] = -{ - {0x0001ffff, 0x00000000, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, }, - {0x0002ffff, 0x0000000c, 0x0001000b, 0x0001000b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003ffff, 0x00000010, 0x0001000f, 0x0001000f, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0005ffff, 0x0006ffff, 0x0004ffff, 0x00000013, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, }, - {0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, }, -}; - -const unsigned int c_aaiCQMFHuffEnc18[40][2] = -{ - {0x0004, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, - {0x0004, 0x0005}, {0x0005, 0x0001}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, - {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0011, 0x0003}, {0x0012, 0x0004}, - {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0012, 0x0005}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, - {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0013, 0x0007}, -}; - -const unsigned int c_aaiCQMFHuffDec18[7][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, }, - {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0004ffff, 0x00000012, 0x00010011, 0x00010011, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x0006ffff, 0x0005ffff, 0x00010015, 0x00010015, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x00000018, 0x00000019, 0x0000001a, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00010027, 0x00010027, }, -}; - -const unsigned int c_aaiCQMFHuffEnc19[47][2] = -{ - {0x0004, 0x0002}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, - {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0007, 0x0002}, - {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000e, 0x0002}, {0x000e, 0x0003}, - {0x0010, 0x0005}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0011, 0x0009}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0001}, {0x0012, 0x0002}, - {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, - {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0012, 0x0011}, - -}; - -const unsigned int c_aaiCQMFHuffDec19[10][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003ffff, 0x00000011, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x0004ffff, 0x00000015, 0x00010014, 0x00010014, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x0005ffff, 0x00000018, 0x00000019, 0x0000001a, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, - {0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, - {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, - {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, -}; - -const unsigned int c_aaiCQMFHuffEnc20[58][2] = -{ - {0x0004, 0x0002}, {0x0003, 0x0005}, {0x0004, 0x0003}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, - {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0002}, - {0x0007, 0x0003}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, - {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0003}, {0x000f, 0x0005}, {0x0011, 0x0007}, - {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0011, 0x0008}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, - {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0011, 0x0009}, - {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, - {0x0011, 0x0012}, {0x0011, 0x0013}, - -}; - -const unsigned int c_aaiCQMFHuffDec20[17][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000002, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00010001, 0x00010001, 0x00010003, 0x00010003, 0x00010004, 0x00010004, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0004ffff, 0x0003ffff, 0x00000011, 0x00000012, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x0006ffff, 0x0005ffff, 0x00000019, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x000fffff, 0x0010ffff, 0x000effff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x0001001e, 0x0001001e, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, - {0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, -}; - -const unsigned int c_aaiCQMFHuffEnc21[70][2] = -{ - {0x0005, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, - {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, - {0x0005, 0x0007}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, - {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, {0x000b, 0x0003}, - {0x000c, 0x0003}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000e, 0x0004}, {0x000f, 0x0007}, {0x000e, 0x0005}, {0x0011, 0x0004}, - {0x0010, 0x000d}, {0x0011, 0x0005}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, - {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, - {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, - {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, - -}; - -const unsigned int c_aaiCQMFHuffDec21[23][16] = -{ - {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, }, - {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x0006ffff, 0x0005ffff, 0x00000018, 0x00000019, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000020, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, - {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, - {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, - {0x0016ffff, 0x0015ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x00000028, 0x00010025, 0x00010025, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, - {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, - {0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, }, - {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, - {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, }, - {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, }, -}; - -const unsigned int c_aaiCQMFHuffEnc22[81][2] = -{ - {0x0005, 0x0004}, {0x0004, 0x0006}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0004, 0x0007}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0005, 0x0007}, - {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0003}, - {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0003}, - {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, - {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000d, 0x0005}, {0x000e, 0x0005}, - {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x0010, 0x0011}, {0x0010, 0x0012}, {0x0011, 0x0000}, {0x0011, 0x0001}, - {0x0011, 0x0002}, {0x0010, 0x0013}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, - {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, - {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, - {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, - {0x0011, 0x0021}, - -}; - -const unsigned int c_aaiCQMFHuffDec22[30][16] = -{ - {0x0005ffff, 0x0006ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x0004ffff, 0x00000001, 0x00000004, 0x0000000a, 0x0000000c, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x0001000b, 0x0001000b, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000017, 0x00000018, 0x00000019, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x000cffff, 0x000bffff, 0x000affff, 0x00000023, 0x00000024, 0x00000025, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, - {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, - {0x001dffff, 0x0000002c, 0x0000002d, 0x00000031, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, }, - {0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, }, - {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, - {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, - {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, - {0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, - {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, - {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, - {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, }, - {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, - {0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, }, - {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, - {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, - {0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, -}; - -const unsigned int c_aaiCQMFHuffEnc23[93][2] = -{ - {0x0005, 0x0004}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, - {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, - {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, - {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x0009, 0x0004}, - {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000b, 0x0003}, {0x000a, 0x0005}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0004}, - {0x000c, 0x0005}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x0010, 0x0014}, {0x000f, 0x000b}, - {0x000f, 0x000c}, {0x000f, 0x000d}, {0x000f, 0x000e}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x000f, 0x000f}, {0x0011, 0x0002}, {0x0011, 0x0003}, - {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, - {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, - {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, - {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, - {0x0011, 0x0024}, {0x0011, 0x0025}, {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0010, 0x0015}, - -}; - -const unsigned int c_aaiCQMFHuffDec23[35][16] = -{ - {0x0006ffff, 0x0007ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, }, - {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x000affff, 0x0008ffff, 0x0009ffff, 0x0000001b, 0x0000001c, 0x0000001d, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, - {0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x000effff, 0x000dffff, 0x000bffff, 0x000cffff, 0x00000027, 0x00000028, 0x00010023, 0x00010023, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0000002e, 0x0000005c, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010035, 0x00010035, }, - {0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, }, - {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, - {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, - {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, - {0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, }, - {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, - {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, - {0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, - {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, }, - {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, - {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, - {0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, - {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, - {0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, }, - {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, }, - {0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, }, -}; - -const unsigned int c_aaiCQMFHuffEnc24[121][2] = -{ - {0x0006, 0x0005}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, - {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, - {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, - {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0004}, {0x0007, 0x0005}, - {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, - {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, - {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000d, 0x0004}, - {0x000c, 0x0007}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, - {0x0010, 0x000f}, {0x000f, 0x000c}, {0x0011, 0x0016}, {0x0010, 0x0010}, {0x000f, 0x000d}, {0x0010, 0x0011}, {0x0012, 0x0000}, {0x0011, 0x0017}, - {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, - {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, - {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0012, 0x0017}, {0x0012, 0x0018}, - {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, {0x0012, 0x0020}, - {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, {0x0012, 0x0028}, - {0x0012, 0x0029}, {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, - {0x0011, 0x001d}, - -}; - -const unsigned int c_aaiCQMFHuffDec24[37][16] = -{ - {0x000dffff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000001, 0x00000002, 0x00000003, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, - {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, - {0x0011ffff, 0x0010ffff, 0x000effff, 0x000fffff, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, - {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, }, - {0x0015ffff, 0x0014ffff, 0x0012ffff, 0x0013ffff, 0x00000034, 0x00000035, 0x00000036, 0x00000038, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x00000043, 0x00000045, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010044, 0x00010044, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, }, - {0x0024ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x00000040, }, - {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, }, - {0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, }, - {0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, - {0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, }, - {0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, - {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, - {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, - {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, - {0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, }, - {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, - {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, }, - {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, }, - {0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020072, 0x00020072, 0x00020072, 0x00020072, }, - {0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, -}; - -const unsigned int c_aaiCQMFHuffEnc25[136][2] = -{ - {0x0006, 0x0006}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, - {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, - {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x0007}, {0x0006, 0x0008}, - {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, - {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, - {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, - {0x0008, 0x0009}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x000a, 0x0004}, {0x000a, 0x0005}, - {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0005}, - {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, - {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000f, 0x0010}, {0x000e, 0x000b}, {0x000f, 0x0011}, {0x0010, 0x001b}, {0x0010, 0x001c}, {0x0010, 0x001d}, - {0x0010, 0x001e}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0011, 0x0006}, - {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0010, 0x001f}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0011, 0x000d}, - {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, {0x0011, 0x0014}, {0x0011, 0x0015}, - {0x0011, 0x0016}, {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, {0x0011, 0x001d}, - {0x0011, 0x001e}, {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, {0x0011, 0x0024}, {0x0011, 0x0025}, - {0x0011, 0x0026}, {0x0011, 0x0027}, {0x0011, 0x0028}, {0x0011, 0x0029}, {0x0011, 0x002a}, {0x0011, 0x002b}, {0x0011, 0x002c}, {0x0011, 0x002d}, - {0x0011, 0x002e}, {0x0011, 0x002f}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0011, 0x0032}, {0x0011, 0x0033}, {0x0011, 0x0034}, {0x0011, 0x0035}, -}; - -const unsigned int c_aaiCQMFHuffDec25[54][16] = -{ - {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, - {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, - {0x0015ffff, 0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, }, - {0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x001affff, 0x0019ffff, 0x0018ffff, 0x0016ffff, 0x0017ffff, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, }, - {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x0001004a, 0x0001004a, 0x0001004c, 0x0001004c, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, }, - {0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x0000005a, }, - {0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, }, - {0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, - {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, - {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, - {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, - {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, }, - {0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, }, - {0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, }, - {0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, }, - {0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, }, - {0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030064, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, - {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, - {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, - {0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, }, - {0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, }, - {0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, }, - {0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, }, - {0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, - {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, }, - {0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, }, - {0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, }, - {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, - {0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, }, - {0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, }, - {0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, - {0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, }, - {0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030084, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, }, - {0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030086, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, }, -}; - -const unsigned int c_aaiCQMFHuffEnc26[164][2] = -{ - {0x0006, 0x0008}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, - {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, - {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0005, 0x001f}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, - {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, - {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, - {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, - {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x000a, 0x0005}, {0x000a, 0x0006}, - {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, - {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, - {0x000d, 0x0008}, {0x000e, 0x0006}, {0x000d, 0x0009}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0008}, {0x000f, 0x0009}, - {0x000f, 0x000a}, {0x0011, 0x0014}, {0x0010, 0x000b}, {0x000f, 0x000b}, {0x0010, 0x000c}, {0x0012, 0x001b}, {0x0010, 0x000d}, {0x0010, 0x000e}, - {0x0011, 0x0015}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0010, 0x000f}, {0x0012, 0x001e}, {0x0013, 0x0000}, {0x0012, 0x001f}, {0x0013, 0x0001}, - {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0012, 0x0020}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, - {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, - {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, - {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, - {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, - {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, - {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, - {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, - -}; - -const unsigned int c_aaiCQMFHuffDec26[38][16] = -{ - {0x000fffff, 0x0010ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, }, - {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, - {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, - {0x0015ffff, 0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, - {0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, - {0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, - {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, - {0x001affff, 0x0019ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, - {0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, }, - {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, - {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, - {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x0001005b, 0x0001005b, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, - {0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x001dffff, 0x001cffff, 0x001effff, 0x001fffff, 0x001bffff, 0x0000005a, 0x0000005c, 0x0000005e, 0x0000005f, 0x00000063, }, - {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, - {0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, - {0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, }, - {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, }, - {0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, }, - {0x00010065, 0x00010065, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, }, - {0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, }, - {0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, }, - {0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, }, - {0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, }, - {0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, }, -}; - -extern const unsigned int (*GetHuffEncTable(const int iAlloc))[2]; - -extern const unsigned int (*GetHuffDecTable(const int iAlloc))[16]; - diff --git a/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h b/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h deleted file mode 100644 index b8103689fe..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/CQMFHuff.h +++ /dev/null @@ -1,305 +0,0 @@ -#ifndef _CQMF_HUFF_H_ -#define _CQMF_HUFF_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef HUFF_READ_SIZE -#define HUFF_READ_SIZE (4) -#endif - -#ifndef HUFF_DEC_TABLE_SIZE -#define HUFF_DEC_TABLE_SIZE (16) -#endif - -#include // For NULL - -extern const unsigned int c_aaiCQMFHuffEnc1[16][2]; - -extern const unsigned int c_aaiCQMFHuffDec1[4][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc2[25][2]; - -extern const unsigned int c_aaiCQMFHuffDec2[4][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc3[36][2]; - -extern const unsigned int c_aaiCQMFHuffDec3[14][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc4[49][2]; - -extern const unsigned int c_aaiCQMFHuffDec4[9][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc5[64][2]; - -extern const unsigned int c_aaiCQMFHuffDec5[27][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc6[81][2]; - -extern const unsigned int c_aaiCQMFHuffDec6[21][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc7[81][2]; - -extern const unsigned int c_aaiCQMFHuffDec7[23][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc8[121][2]; - -extern const unsigned int c_aaiCQMFHuffDec8[17][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc9[196][2]; - -extern const unsigned int c_aaiCQMFHuffDec9[30][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc10[196][2]; - -extern const unsigned int c_aaiCQMFHuffDec10[34][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc11[256][2]; - -extern const unsigned int c_aaiCQMFHuffDec11[43][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc12[400][2]; - -extern const unsigned int c_aaiCQMFHuffDec12[44][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc13[625][2]; - -extern const unsigned int c_aaiCQMFHuffDec13[98][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc14[625][2]; - -extern const unsigned int c_aaiCQMFHuffDec14[103][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc15[28][2]; - -extern const unsigned int c_aaiCQMFHuffDec15[10][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc16[32][2]; - -extern const unsigned int c_aaiCQMFHuffDec16[11][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc17[41][2]; - -extern const unsigned int c_aaiCQMFHuffDec17[7][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc18[40][2]; - -extern const unsigned int c_aaiCQMFHuffDec18[7][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc19[47][2]; - -extern const unsigned int c_aaiCQMFHuffDec19[10][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc20[58][2]; - -extern const unsigned int c_aaiCQMFHuffDec20[17][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc21[70][2]; - -extern const unsigned int c_aaiCQMFHuffDec21[23][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc22[81][2]; - -extern const unsigned int c_aaiCQMFHuffDec22[30][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc23[93][2]; - -extern const unsigned int c_aaiCQMFHuffDec23[35][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc24[121][2]; - -extern const unsigned int c_aaiCQMFHuffDec24[37][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc25[136][2]; - -extern const unsigned int c_aaiCQMFHuffDec25[54][HUFF_DEC_TABLE_SIZE]; - -extern const unsigned int c_aaiCQMFHuffEnc26[164][2]; - -extern const unsigned int c_aaiCQMFHuffDec26[38][HUFF_DEC_TABLE_SIZE]; - -inline const unsigned int (*GetHuffEncTable(const int iAlloc))[2] -{ - const unsigned int (*pauiHuffmanTable)[2] = NULL; - - switch(iAlloc){ - case 1: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc1; - break; - case 2: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc2; - break; - case 3: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc3; - break; - case 4: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc4; - break; - case 5: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc5; - break; - case 6: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc6; - break; - case 7: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc7; - break; - case 8: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc8; - break; - case 9: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc9; - break; - case 10: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc10; - break; - case 11: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc11; - break; - case 12: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc12; - break; - case 13: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc13; - break; - case 14: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc14; - break; - case 15: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc15; - break; - case 16: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc16; - break; - case 17: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc17; - break; - case 18: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc18; - break; - case 19: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc19; - break; - case 20: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc20; - break; - case 21: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc21; - break; - case 22: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc22; - break; - case 23: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc23; - break; - case 24: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc24; - break; - case 25: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc25; - break; - case 26: - pauiHuffmanTable = (unsigned int (*)[2])c_aaiCQMFHuffEnc26; - break; - - } - - return pauiHuffmanTable; -} - -inline const unsigned int (*GetHuffDecTable(const int iAlloc))[16] -{ - const unsigned int (*pauiHuffmanTable)[16] = NULL; - - switch(iAlloc){ - case 1: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec1; - break; - case 2: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec2; - break; - case 3: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec3; - break; - case 4: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec4; - break; - case 5: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec5; - break; - case 6: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec6; - break; - case 7: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec7; - break; - case 8: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec8; - break; - case 9: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec9; - break; - case 10: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec10; - break; - case 11: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec11; - break; - case 12: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec12; - break; - case 13: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec13; - break; - case 14: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec14; - break; - case 15: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec15; - break; - case 16: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec16; - break; - case 17: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec17; - break; - case 18: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec18; - break; - case 19: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec19; - break; - case 20: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec20; - break; - case 21: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec21; - break; - case 22: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec22; - break; - case 23: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec23; - break; - case 24: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec24; - break; - case 25: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec25; - break; - case 26: - pauiHuffmanTable = (unsigned int (*)[16])c_aaiCQMFHuffDec26; - break; - - } - - return pauiHuffmanTable; -} - -#ifdef __cplusplus -} -#endif - -#endif /* _CQMF_HUFF_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c deleted file mode 100644 index e2f7ea62b1..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "NoiseGen.h" -#include -#include -#include -#include "wmops.h" - -NoiseGen* CreateNoiseGen() -{ - int n; - - NoiseGen *psNoiseGen = NULL; - - psNoiseGen = (NoiseGen*)malloc(sizeof(NoiseGen)); - psNoiseGen->iNoiseBufferLength = 2048; - psNoiseGen->iNoiseBufferMask = 2047; - psNoiseGen->iNoiseBufferIndex = 0; - - psNoiseGen->pfNoiseBuffer = (float*)malloc(psNoiseGen->iNoiseBufferLength * sizeof(float)); - - /* Generate Laplacian distributed noise */ - for(n = 0; n < psNoiseGen->iNoiseBufferLength; n ++){ - float fNoise = 0.0; - float fScale = 0.707f; - fNoise = (float)((rand() & (RAND_MAX - 1)) - (RAND_MAX >> 1)) / (float)RAND_MAX; - - if(fNoise < 0.0){ - fNoise = fScale * logf(1.0f + 1.9999999f * fNoise); - } - else{ - fNoise = -fScale * logf(1.0f - 1.9999999f * fNoise); - } - - psNoiseGen->pfNoiseBuffer[n] = fNoise; - } - - return psNoiseGen; -} - -void DeleteNoiseGen(NoiseGen *psNoiseGen) -{ - free(psNoiseGen->pfNoiseBuffer); - free(psNoiseGen); -} - -extern float GetNoise(NoiseGen *psNoiseGen); - - diff --git a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.h b/lib_rend/ivas_cldfb_trans_codec/NoiseGen.h deleted file mode 100644 index 1a4ccb924c..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/NoiseGen.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _NOISE_GEN_H_ -#define _NOISE_GEN_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct NOISE_GEN{ - int iNoiseBufferLength; - int iNoiseBufferMask; - int iNoiseBufferIndex; - float *pfNoiseBuffer; -}NoiseGen; - -NoiseGen* CreateNoiseGen(); - -void DeleteNoiseGen(NoiseGen *psNoiseGen); - -inline float GetNoise(NoiseGen *psNoiseGen) -{ - float fNoiseSample; - - fNoiseSample = psNoiseGen->pfNoiseBuffer[psNoiseGen->iNoiseBufferIndex]; - psNoiseGen->iNoiseBufferIndex ++; - psNoiseGen->iNoiseBufferIndex &= psNoiseGen->iNoiseBufferMask; - - return fNoiseSample; -} - -#ifdef __cplusplus -} -#endif - -#endif /* _NOISE_GEN_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h b/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h deleted file mode 100644 index e9d62c8106..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/PerceptualModel.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _PERCEPTUAL_MODEL_H_ -#define _PERCEPTUAL_MODEL_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -void PerceptualModel(const int iMaxQuantBands, - const int *piRMSEnvelope, - int *piExcitation, - int *piSMR); - -#ifdef __cplusplus -} -#endif - -#endif /* _PERCEPTUAL_MODEL_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h b/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h deleted file mode 100644 index e7e1059384..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/RMSEnvDeltaHuff.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _RMS_ENV_DELTA_HUFF_H_ -#define _RMS_ENV_DELTA_HUFF_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef HUFF_READ_SIZE -#define HUFF_READ_SIZE (4) -#endif - -#ifndef HUFF_DEC_TABLE_SIZE -#define HUFF_DEC_TABLE_SIZE (16) -#endif - -extern const unsigned int c_aaiRMSEnvHuffEnc[64][2]; - -extern const unsigned int c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; - -#ifdef __cplusplus -} -#endif - -#endif /* _RMS_ENV_DELTA_HUFF_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c deleted file mode 100644 index f51051d52d..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.c +++ /dev/null @@ -1,378 +0,0 @@ -#include "RMSEnvGrouping.h" - -/* Double check cost function calculation */ - -#include -#include -#include -#include -#include "wmops.h" -#include "Tables.h" - -typedef struct GMNODE{ - int iGroupStart; - int iGroupLength; - float *pfMergedEnergydB; - struct GMNODE *psNext; -}GMNode; - -typedef struct RMS_ENVELOPE_GROUPING -{ - int iNumBlocks; - int iMaxGroups; - float **ppfBandEnergy; - float **ppfBandEnergydB; - float **ppfWeight; - GMNode *psGMNodes; -}RMSEnvelopeGrouping; - -RMSEnvelopeGrouping* CreateRMSEnvelopeGrouping(int iNumBlocks) -{ - int n; - assert((iNumBlocks & 0x1) == 0); // remove this - - RMSEnvelopeGrouping *psRMSEnvelopeGrouping; - - psRMSEnvelopeGrouping = (RMSEnvelopeGrouping*)malloc(sizeof(RMSEnvelopeGrouping)); - psRMSEnvelopeGrouping->iNumBlocks = iNumBlocks; - psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks >> 1; // Change this - - psRMSEnvelopeGrouping->ppfBandEnergy = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); - psRMSEnvelopeGrouping->ppfBandEnergydB = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); - psRMSEnvelopeGrouping->ppfWeight = (float**)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(float*)); - for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - psRMSEnvelopeGrouping->ppfBandEnergy[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); /* 2 for stereo joint group calc */ - psRMSEnvelopeGrouping->ppfBandEnergydB[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); - psRMSEnvelopeGrouping->ppfWeight[n] = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); - } - - psRMSEnvelopeGrouping->psGMNodes = (GMNode*)malloc(psRMSEnvelopeGrouping->iNumBlocks * sizeof(GMNode)); - for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB = (float*)malloc(MAX_BANDS * 2 * sizeof(float)); - } - - return psRMSEnvelopeGrouping; -} - -void DeleteRMSEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping) -{ - int n; - - for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - free(psRMSEnvelopeGrouping->ppfBandEnergy[n]); - free(psRMSEnvelopeGrouping->ppfBandEnergydB[n]); - free(psRMSEnvelopeGrouping->ppfWeight[n]); - } - free(psRMSEnvelopeGrouping->ppfBandEnergy); - free(psRMSEnvelopeGrouping->ppfBandEnergydB); - free(psRMSEnvelopeGrouping->ppfWeight); - - for(n = 0; n < psRMSEnvelopeGrouping->iNumBlocks; n ++){ - free(psRMSEnvelopeGrouping->psGMNodes[n].pfMergedEnergydB); - } - free(psRMSEnvelopeGrouping->psGMNodes); - - free(psRMSEnvelopeGrouping); -} - - -void ComputeBandEnergy(const int iChannels, - const int iNumBlocks, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - float **ppfBandEnergy, - float **ppfBandEnergydB, - float **ppfWeight) -{ - int n; - - for(n = 0; n < iChannels; n ++){ - int k; - int iChanOffset; - - iChanOffset = n * iNumBands; - for(k = 0; k < iNumBlocks; k ++){ - int b; - int iFBOffset; - iFBOffset = 0; - for(b = 0; b < iNumBands; b ++){ - int m; - float fEnergy = 1e-12f; - //float fWeight; - - for(m = 0; m < piBandwidths[b]; m ++){ - fEnergy += (pppfReal[n][k][iFBOffset] * pppfReal[n][k][iFBOffset] + pppfImag[n][k][iFBOffset] * pppfImag[n][k][iFBOffset]); - iFBOffset ++; - } - fEnergy /= (float)(2 * piBandwidths[b]); - ppfBandEnergy[k][iChanOffset + b] = fEnergy; - ppfBandEnergydB[k][iChanOffset + b] = 10.0f * log10f(fEnergy); - - ppfWeight[k][iChanOffset + b] = 1.0; - } - } - } -} - -/* THis is temporary cost function */ -float TryMerge(const int iNumBands, - const int iStartBlock, - const int iGroupLength, - const float fMaxAllowedDiffdB, - const float **ppfBandEnergy, - const float **ppfBandEnergydB, - float *pfMegredEnergydB) -{ - int b; - int n; - float fMeanCost; - float fMaxCost; - float fInvGroupSize = 1.0f / (float)iGroupLength; - float fInvNumBands = 1.0f / (float)iNumBands; - - for(b = 0; b < iNumBands; b ++){ - float fGroupEnergy; - - - fGroupEnergy = 0.0; - for(n = iStartBlock; n < (iStartBlock + iGroupLength); n ++){ - fGroupEnergy += ppfBandEnergy[n][b]; - } - fGroupEnergy *= fInvGroupSize; - fGroupEnergy = 10.0f * log10f(fGroupEnergy); //Note epsolon was added when computing BandEnergy; - - pfMegredEnergydB[b] = fGroupEnergy; - } - - fMeanCost = 0.0; - fMaxCost = 0.0; - for(n = iStartBlock; n < (iStartBlock + iGroupLength); n ++){ - float fMeanAbsDiff; - float fMaxAbsDiff; - - fMeanAbsDiff = 0.0; - fMaxAbsDiff = 0.0; - for(b = 0; b < iNumBands; b ++){ - float fAbsDiff; - - fAbsDiff = fabsf(ppfBandEnergydB[n][b] - pfMegredEnergydB[b]); - fMeanAbsDiff += fAbsDiff; - fMaxAbsDiff = (fMaxAbsDiff > fAbsDiff) ? fMaxAbsDiff : fAbsDiff; - } - fMeanAbsDiff *= fInvNumBands; - - fMeanCost = (fMeanCost > fMeanAbsDiff) ? fMeanCost : fMeanAbsDiff; - fMaxCost = (fMaxCost > fMaxAbsDiff) ? fMaxCost : fMaxAbsDiff; - } - - //printf("%f\t%f\n",fMeanCost,fMaxCost); - - if(fMaxCost > fMaxAllowedDiffdB){ - fMeanCost = 1e12f; //Some large value - } - - return fMeanCost; -} - -void ComputeGreedyGroups(RMSEnvelopeGrouping *psRMSEnvelopeGrouping, - const int iChannels, - const int iNumBands, - const float fMeanAllowedDiffdB, - const float fMaxAllowedDiffdB) -{ - float fBestMeanCost; - - fBestMeanCost = 0.0; - while(fBestMeanCost < fMeanAllowedDiffdB){ - GMNode *psGMNode; - GMNode *psBestGMNode; - - fBestMeanCost = fMeanAllowedDiffdB; - psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; - psBestGMNode = NULL; - while(psGMNode->psNext != NULL){ - float fMeanCost; - int iGroupLength; - - iGroupLength = psGMNode->iGroupLength + psGMNode->psNext->iGroupLength; - - fMeanCost = TryMerge(iNumBands * iChannels, - psGMNode->iGroupStart, - psGMNode->iGroupLength, - fMaxAllowedDiffdB, - (const float**)psRMSEnvelopeGrouping->ppfBandEnergy, - (const float**)psRMSEnvelopeGrouping->ppfBandEnergydB, - psGMNode->pfMergedEnergydB); - - - if(fMeanCost < fBestMeanCost){ - fBestMeanCost = fMeanCost; - psBestGMNode = psGMNode; - } - - psGMNode = psGMNode->psNext; - } - - if(fBestMeanCost < fMeanAllowedDiffdB && psBestGMNode != NULL && psBestGMNode->psNext != NULL){ - psBestGMNode->iGroupLength += psBestGMNode->psNext->iGroupLength; - psBestGMNode->psNext = psBestGMNode->psNext->psNext; - } - } -} - - -void ComputeRMSEnvelope(const int iChannels, - const int iNumBands, - const int iNumGroups, - const int *piGroupLengths, - const float **ppfBandEnergy, - int ***pppiRMSEnvelope) -{ - int n; - - for(n = 0; n < iChannels; n ++){ - int b; - int iChanOffset; - - iChanOffset = n * iNumBands; - for(b = 0; b < iNumBands; b ++){ - int k; - int iBlockOffset; - - iBlockOffset = 0; - for(k = 0; k < iNumGroups; k ++){ - int m; - float fGroupEnergy; - fGroupEnergy = 0.0; - for(m = 0; m < piGroupLengths[k]; m ++){ - fGroupEnergy += ppfBandEnergy[iBlockOffset][b + iChanOffset]; - iBlockOffset ++; - } - fGroupEnergy /= (float)piGroupLengths[k]; - - pppiRMSEnvelope[n][k][b] = (int)(log2f(fGroupEnergy) + 0.5); - pppiRMSEnvelope[n][k][b] = (pppiRMSEnvelope[n][k][b] > ENV_MIN) ? pppiRMSEnvelope[n][k][b] : ENV_MIN; - pppiRMSEnvelope[n][k][b] = (pppiRMSEnvelope[n][k][b] < ENV_MAX) ? pppiRMSEnvelope[n][k][b] : ENV_MAX; - } - } - } -} - -void LimitRMSEnvelope(const int iBandCount, - const int iRMSDeltaMax, - const int iRMSDeltaMin, - int *piRMSEnvelope) -{ - int iBand; - int iLastSCF; - - /* Increase low envelope values to ensure that the scale factors traces the large values correctly (checking for max deltas) */ - iLastSCF = piRMSEnvelope[iBandCount - 1]; - for(iBand = iBandCount - 2; iBand > -1; iBand --) - { - int iDelta; - - iDelta = iLastSCF - piRMSEnvelope[iBand]; - - if(iDelta > iRMSDeltaMax){ -#ifdef DEBUG_VERBOSE - printf("WARNING ScaleFactor Delta limited\n"); -#endif - piRMSEnvelope[iBand] += (iDelta - iRMSDeltaMax); - } - - iLastSCF = piRMSEnvelope[iBand]; - } - - /* Increase low envelope values to ensure that the envelope traces the large values correctly (checking for min deltas)*/ - iLastSCF = piRMSEnvelope[0]; - for(iBand = 1; iBand < iBandCount; iBand ++){ - int iDelta; - - iDelta = piRMSEnvelope[iBand] - iLastSCF; - - if(iDelta < iRMSDeltaMin){ -#ifdef DEBUG_VERBOSE - printf("WARNING ScaleFactor Delta limited\n"); -#endif - piRMSEnvelope[iBand] += (iRMSDeltaMin - iDelta); - } - - iLastSCF = piRMSEnvelope[iBand]; - } -} - -void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, - const int iChannels, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const float fMeanAllowedDiffdB, - const float fMaxAllowedDiffdB, - int *piNumGroups, - int *piGroupLengths, - int ***pppiRMSEnvelope) -{ - int n; - GMNode *psGMNode; - - /* Compute Band Energies */ - ComputeBandEnergy(iChannels, - psRMSEnvelopeGrouping->iNumBlocks, - iNumBands, - piBandwidths, - pppfReal, - pppfImag, - psRMSEnvelopeGrouping->ppfBandEnergy, - psRMSEnvelopeGrouping->ppfBandEnergydB, - psRMSEnvelopeGrouping->ppfWeight); - - /* Init GMNodes */ - psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0; - psRMSEnvelopeGrouping->psGMNodes[0].iGroupLength = 2; - psRMSEnvelopeGrouping->psGMNodes[0].psNext = NULL; - for(n = 1; n < psRMSEnvelopeGrouping->iMaxGroups; n ++){ - psRMSEnvelopeGrouping->psGMNodes[n - 1].psNext = &psRMSEnvelopeGrouping->psGMNodes[n]; - psRMSEnvelopeGrouping->psGMNodes[n].iGroupStart = n * 2; // change this - psRMSEnvelopeGrouping->psGMNodes[n].iGroupLength = 2; // change this - psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; - } - - /* Perform grouping via Greedy Merge */ - ComputeGreedyGroups(psRMSEnvelopeGrouping, - iChannels, - iNumBands, - fMeanAllowedDiffdB, - fMaxAllowedDiffdB); - - /* Calc Groups from Merge Results */ - *piNumGroups = 0; - psGMNode = &psRMSEnvelopeGrouping->psGMNodes[0]; - while(psGMNode != NULL){ - piGroupLengths[*piNumGroups] = psGMNode->iGroupLength; - *piNumGroups += 1; - psGMNode = psGMNode->psNext; - } - - /* Compute RMS Envelope given group lengths */ - ComputeRMSEnvelope(iChannels, - iNumBands, - *piNumGroups, - piGroupLengths, - (const float**)psRMSEnvelopeGrouping->ppfBandEnergy, - pppiRMSEnvelope); - - /* Envelope Tenting */ - for(n = 0; n < iChannels; n ++){ - int k; - for(k = 0; k < *piNumGroups; k ++){ - LimitRMSEnvelope(iNumBands, - ENV_DELTA_MAX, - ENV_DELTA_MIN, - pppiRMSEnvelope[n][k]); - } - } -} diff --git a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h b/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h deleted file mode 100644 index fa7506935f..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/RMSEnvGrouping.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _RMS_ENV_GROUPING_H_ -#define _RMS_ENV_GROUPING_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping; - -RMSEnvelopeGrouping* CreateRMSEnvelopeGrouping(int iNumBlocks); - -void DeleteRMSEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping); - -void ComputeEnvelopeGrouping(RMSEnvelopeGrouping *psRMSEnvelopeGrouping, - const int iChannels, - const int iNumBands, - const int *piBandwidths, - const float ***pppfReal, - const float ***pppfImag, - const float fMeanAllowedDiffdB, - const float fMaxAllowedDiffdB, - int *piNumGroups, - int *piGroupLengths, - int ***pppiRMSEnvelope); - -#ifdef __cplusplus -} -#endif - -#endif /* _RMS_ENV_GROUPING_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/Tables.c b/lib_rend/ivas_cldfb_trans_codec/Tables.c deleted file mode 100644 index 735c8d21f2..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/Tables.c +++ /dev/null @@ -1,116 +0,0 @@ -#include "Tables.h" -#include "wmops.h" - -/* Move this to perceptual model ? */ -const int c_aiBandwidths48[MAX_BANDS_48] = { - 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,4,6,6,7,10, -}; - - -const float c_afScaleFactor[ALLOC_TABLE_SIZE] = { - 0.0f, - 0.353553390593f, - 0.420448207627f, - 0.500000000000f, - 0.594603557501f, - 0.707106781187f, - 0.840896415254f, - 1.000000000000f, - 1.189207115003f, - 1.414213562373f, - 1.681792830507f, - 2.000000000000f, - 2.378414230005f, - 2.828427124746f, - 3.363585661015f, - 4.0f, - 4.756828460011f, - 5.656854249492f, - 6.727171322030f, - 8.0f, - 9.513656920022f, - 11.31370849898f, - 13.45434264406f, - 16.00000000000f, - 19.02731384004f, - 22.62741699797f, - 26.90868528812f, //~40dB SNR -}; - -const float c_afInvScaleFactor[ALLOC_TABLE_SIZE] = { - 0.0f, - 2.367513562373095f, - 2.046407115002721f, - 1.775900000000000f, - 1.536446415253715f, - 1.323056781186548f, - 1.132903557501360f, - 0.965800000000000f, - 0.821348207626857f, - 0.695103390593274f, - 0.587801778750680f, - 0.495800000000000f, - 0.418124103813429f, - 0.352176695296637f, - 0.296200889375340f, - 0.249400000000000f, - 0.209812051906714f, - 0.176538347648318f, - 0.148525444687670f, - 0.124900000000000f, - 0.105056025953357f, - 0.088388347648318f, - 0.074325444687670f, - 0.062500000000000f, - 0.052556025953357f, - 0.044194173824159f, - 0.037162722343835f, -}; - -const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE] = { - 2.32830644e-10f, 3.29272254e-10f, 4.65661287e-10f, 6.58544508e-10f, 9.31322575e-10f, 1.31708902e-09f, 1.86264515e-09f, 2.63417803e-09f, - 3.72529030e-09f, 5.26835606e-09f, 7.45058060e-09f, 1.05367121e-08f, 1.49011612e-08f, 2.10734243e-08f, 2.98023224e-08f, 4.21468485e-08f, - 5.96046448e-08f, 8.42936970e-08f, 1.19209290e-07f, 1.68587394e-07f, 2.38418579e-07f, 3.37174788e-07f, 4.76837158e-07f, 6.74349576e-07f, - 9.53674316e-07f, 1.34869915e-06f, 1.90734863e-06f, 2.69739830e-06f, 3.81469727e-06f, 5.39479661e-06f, 7.62939453e-06f, 1.07895932e-05f, - 1.52587891e-05f, 2.15791864e-05f, 3.05175781e-05f, 4.31583729e-05f, 6.10351562e-05f, 8.63167458e-05f, 1.22070312e-04f, 1.72633492e-04f, - 2.44140625e-04f, 3.45266983e-04f, 4.88281250e-04f, 6.90533966e-04f, 9.76562500e-04f, 1.38106793e-03f, 1.95312500e-03f, 2.76213586e-03f, - 3.90625000e-03f, 5.52427173e-03f, 7.81250000e-03f, 1.10485435e-02f, 1.56250000e-02f, 2.20970869e-02f, 3.12500000e-02f, 4.41941738e-02f, - 6.25000000e-02f, 8.83883476e-02f, 1.25000000e-01f, 1.76776695e-01f, 2.50000000e-01f, 3.53553391e-01f, 5.00000000e-01f, 7.07106781e-01f, - 1.00000000e+00f, 1.41421356e+00f, 2.00000000e+00f, 2.82842712e+00f, 4.00000000e+00f, 5.65685425e+00f, 8.00000000e+00f, 1.13137085e+01f, - 1.60000000e+01f, 2.26274170e+01f, 3.20000000e+01f, 4.52548340e+01f, 6.40000000e+01f, 9.05096680e+01f, 1.28000000e+02f, 1.81019336e+02f, - 2.56000000e+02f, 3.62038672e+02f, 5.12000000e+02f, 7.24077344e+02f, 1.02400000e+03f, 1.44815469e+03f, 2.04800000e+03f, 2.89630938e+03f, - 4.09600000e+03f, 5.79261875e+03f, 8.19200000e+03f, 1.15852375e+04f, 1.63840000e+04f, 2.31704750e+04f, 3.27680000e+04f, 4.63409500e+04f, - 6.55360000e+04f, 9.26819000e+04f, 1.31072000e+05f, 1.85363800e+05f, 2.62144000e+05f, 3.70727600e+05f, 5.24288000e+05f, 7.41455200e+05f, - 1.04857600e+06f, 1.48291040e+06f, 2.09715200e+06f, 2.96582080e+06f, 4.19430400e+06f, 5.93164160e+06f, 8.38860800e+06f, 1.18632832e+07f, - 1.67772160e+07f, 2.37265664e+07f, 3.35544320e+07f, 4.74531328e+07f, 6.71088640e+07f, 9.49062656e+07f, 1.34217728e+08f, 1.89812531e+08f, - 2.68435456e+08f, 3.79625062e+08f, 5.36870912e+08f, 7.59250125e+08f, 1.07374182e+09f, 1.51850025e+09f, 2.14748365e+09f, 3.03700050e+09f, - 4.29496730e+09f, -}; - -const int c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { - 0, 3, 4, 5, 6, 7, 8, 8, - 10, 13, 13, 15, 19, 24, 24, 27, - 31, 40, 39, 46, 57, 69, 80, 92, - 120, 135, 163, -}; - -const int c_aiHuffmanDim[ALLOC_TABLE_SIZE] = { - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, -}; - -const int c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { - 0, 4, 5, 6, 7, 8, 9, 9, - 11, 14, 14, 16, 20, 25, 25, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, -}; - -const int c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { - 1, 16, 25, 36, 49, 64, 81, 81, - 121, 196, 196, 256, 400, 625, 625, 28, - 32, 41, 40, 47, 58, 70, 81, 93, - 121, 136, 164, -}; diff --git a/lib_rend/ivas_cldfb_trans_codec/Tables.h b/lib_rend/ivas_cldfb_trans_codec/Tables.h deleted file mode 100644 index 960ee0d231..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/Tables.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _TABLES_H_ -#define _TABLES_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#define DEBUG_VERBOSE - -#define CQMF_BLOCKS_PER_FRAME (16) -#define CQMF_MAX_BLOCKS_PER_FRAME (16) -#define CQMF_BANDS (60) - -#define MAX_BANDS (23) -#define MAX_BANDS_48 (23) - -extern const int c_aiBandwidths48[MAX_BANDS_48]; // move this - - -#define ENV_MIN (-64) -#define ENV_MAX (64) - -#define ENV0_BITS (7) - -#define ENV_DELTA_MIN (-32) -#define ENV_DELTA_MAX (31) - -#define ENV_RECONSTRUCT_TABLE_SIZE (129) - -#define ENV_RECONSTRUCT_TABLE_CENTER (64) - -#define MIN_ALLOC (0) -#define MAX_ALLOC (26) - -#define ALLOC_OFFSET_SCALE (8) - -#define ALLOC_OFFSET_BITS (8) - -#define MIN_ALLOC_OFFSET (-128) -#define MAX_ALLOC_OFFSET (127) - - - -#define ALLOC_TABLE_SIZE (27) - -extern const float c_afScaleFactor[ALLOC_TABLE_SIZE]; - -extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE]; - -extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE]; - -extern const int c_aiQuantMaxValues[ALLOC_TABLE_SIZE]; - -extern const int c_aiHuffmanDim[ALLOC_TABLE_SIZE]; - -extern const int c_aiHuffmanMod[ALLOC_TABLE_SIZE]; - -extern const int c_aiHuffmanSize[ALLOC_TABLE_SIZE]; - -#ifdef __cplusplus -} -#endif - -#endif /* _TABLES_H_ */ diff --git a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c deleted file mode 100644 index 4317e0ec12..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.c +++ /dev/null @@ -1,226 +0,0 @@ -#include "cldfb_codec_bitstream.h" - -#include -#include -#include "wmops.h" - -#define MAX_BUFFER 1024 - -static const unsigned int MASKS[] = -{ - 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, - 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, - 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, - 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -}; - -Bitstream* CreateBitstream(const int iDirection, - const int iMaxBuffer) - -{ - - int n; - Bitstream *psBitstream; - - psBitstream = (Bitstream*)malloc(sizeof(Bitstream)); - - psBitstream->iDirection =iDirection; - psBitstream->iMaxBuffer = iMaxBuffer; - psBitstream->iIndex = 0; - psBitstream->iBufferEnd = 0; - psBitstream->iBufferStart = 0; - psBitstream->iError = BS_ERROR_NONE; - - if(psBitstream->iMaxBuffer == -1){ - psBitstream->iMaxBuffer = MAX_BUFFER; - } - - psBitstream->puchBuffer = (unsigned char*)malloc(sizeof(unsigned char) * psBitstream->iMaxBuffer); - - for(n = 0; n < psBitstream->iMaxBuffer; n ++){ - psBitstream->puchBuffer[n] = 0; - } - - return psBitstream; -} - -void DeleteBitstream(Bitstream *psBitstream) -{ - free(psBitstream->puchBuffer); - free(psBitstream); -} - -void BSFlushBuffer(Bitstream *psBitstream) -{ - memset(psBitstream->puchBuffer,0,psBitstream->iMaxBuffer); - psBitstream->iIndex = 0; - psBitstream->iBufferEnd = 0; - psBitstream->iBufferStart = 0; - psBitstream->iError = BS_ERROR_NONE; -} - -int BSPutBytes(Bitstream *psBitstream, - const unsigned char *puchBytes, - const int iByteCount) -{ - int n; - for(n = 0; n < iByteCount; n ++){ - psBitstream->puchBuffer[psBitstream->iBufferEnd] = puchBytes[n]; - psBitstream->iBufferEnd ++; - } - if(psBitstream->iDirection != BS_READ){ - psBitstream->iError = BS_ERROR_FAIL; - } - - return psBitstream->iError; -} - -int BSGetBytes(Bitstream *psBitstream, - unsigned char *puchBytes, - int iByteCount) -{ - int n; - for(n = 0; n < iByteCount; n++){ - puchBytes[n] = psBitstream->puchBuffer[psBitstream->iBufferStart]; - psBitstream->puchBuffer[psBitstream->iBufferStart] = 0; - psBitstream->iBufferStart ++; - } - if(psBitstream->iDirection != BS_WRITE){ - psBitstream->iError = BS_ERROR_FAIL; - } - - return psBitstream->iError; -} - -int BSByteAlign(Bitstream *psBitstream) -{ - if(psBitstream->iDirection == BS_WRITE){ - if(psBitstream->iIndex & 0x7){ - int iByte; - int iRem; - - iByte = psBitstream->iIndex >> 3; - iRem = 8 - (psBitstream->iIndex - (iByte<<3)); - psBitstream->puchBuffer[iByte] &= (0xff ^ MASKS[iRem]); - psBitstream->iIndex += iRem; - } - } - else{ - if(psBitstream->iIndex & 0x7){ - int iByte; - int iRem; - - iByte = psBitstream->iIndex >> 3; - iRem = 8 - (psBitstream->iIndex - (iByte<<3)); - psBitstream->iIndex += iRem; - } - } - - return psBitstream->iError; -} - -int BSPutBits(Bitstream *psBitstream, - int iValue, - int iBitCount) -{ - iValue &= MASKS[iBitCount]; - while(iBitCount){ - int iByte; - int iRem; - int iShift; - - iByte = psBitstream->iIndex >> 3; - iRem = 8 - (psBitstream->iIndex - (iByte<<3)); //8 - psBitstream->iIndex & 0x7; - - iShift = iBitCount-iRem; - if(iShift <= 0){ - iShift *= -1; - psBitstream->puchBuffer[iByte] += (unsigned char) (iValue<iIndex += iBitCount; - iBitCount = 0; - } - else{ - psBitstream->puchBuffer[iByte] += (unsigned char) (iValue>>iShift); - iValue &= MASKS[iShift]; - psBitstream->iIndex += iRem; - iBitCount -= iRem; - } - } - - if(psBitstream->iDirection != BS_WRITE){ - psBitstream->iError = BS_ERROR_FAIL; - } - - return psBitstream->iError; -} - -int BSGetBits(Bitstream *psBitstream, - int iBitCount) -{ - int iValue = 0; - - while(iBitCount){ - unsigned char uchByte; - int iByte; - int iRem; - int iShift; - - iByte = psBitstream->iIndex >> 3; - iRem = 8 - (psBitstream->iIndex - (iByte << 3)); //8 - psBitstream->iIndex & 0x7; - uchByte = psBitstream->puchBuffer[iByte]; - iShift = iBitCount - iRem; - - if(iShift <= 0){ - iShift *= -1; - iValue += (int)((uchByte >> iShift) & MASKS[iBitCount]); - psBitstream->iIndex += iBitCount; - iBitCount = 0; - } - else{ - uchByte &= MASKS[iRem]; - iValue += (((int)uchByte)<iIndex += iRem; - iBitCount -= iRem; - } - } - - if(psBitstream->iDirection != BS_READ){ - psBitstream->iError = BS_ERROR_FAIL; - } - - return iValue; -} - -int BSForceBack(Bitstream *psBitstream, - int iValue, - int iBitCount) -{ - psBitstream->iIndex -= iBitCount; - return (iValue>>iBitCount); -} - -int BSGetByteCount(Bitstream *psBitstream) -{ - int iBytes; - iBytes = psBitstream->iIndex>>3; - if((iBytes << 3) != psBitstream->iIndex){ - iBytes ++; - } - - return iBytes; -} - -unsigned char* BSGetBuffer(Bitstream *psBitstream) -{ - return psBitstream->puchBuffer; -} - -int BSGetAvailableBytes(Bitstream *psBitstream) -{ - return psBitstream->iBufferEnd; -} - -int BSGetError(Bitstream *psBitstream) -{ - return psBitstream->iError; -} diff --git a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.h deleted file mode 100644 index a3e936e59b..0000000000 --- a/lib_rend/ivas_cldfb_trans_codec/cldfb_codec_bitstream.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _BITSTREAM_H_ -#define _BITSTREAM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -enum{BS_READ,BS_WRITE}; -enum{BS_ERROR_NONE,BS_ERROR_FAIL}; - -typedef struct BITSTREAM{ - int iMaxBuffer; - int iDirection; - int iBufferEnd; - int iBufferStart; - int iIndex; - int iError; - unsigned char *puchBuffer; -}Bitstream; - - -Bitstream* CreateBitstream(const int iDirection, - const int iMaxBuffer); - -void DeleteBitstream(Bitstream *psBitstream); - -void BSFlushBuffer(Bitstream *psBitstream); - -int BSPutBytes(Bitstream *psBitstream, - const unsigned char *puchBytes, - const int iByteCount); - -int BSGetBytes(Bitstream *psBitstream, - unsigned char *puchBytes, - int iByteCount); - -int BSByteAlign(Bitstream *psBitstream); - -int BSPutBits(Bitstream *psBitstream, - int iValue, - int iBitCount); - -int BSGetBits(Bitstream *psBitstream, - int iBitCount); - -int BSForceBack(Bitstream *psBitstream, - int iValue, - int iBitCount); - -unsigned char* BSGetBuffer(Bitstream *psBitstream); - -int BSGetByteCount(Bitstream *psBitstream); - -int BSGetAvailableBytes(Bitstream *psBitstream); - -int BSGetError(Bitstream *psBitstream); - -#ifdef __cplusplus -} -#endif - -#endif /* _BITSTREAM_H_ */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index f63d729dc7..0351af3320 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -168,7 +168,11 @@ ivas_error ivas_crend_init_from_rom( intern_config = st_ivas->intern_config; - if ( intern_config == AUDIO_CONFIG_BINAURAL || intern_config == AUDIO_CONFIG_BINAURAL_ROOM ) + if ( intern_config == AUDIO_CONFIG_BINAURAL || intern_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || intern_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { return IVAS_ERR_INTERNAL_FATAL; } @@ -1121,8 +1125,35 @@ ivas_error ivas_crend_process( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*------------------------------------------------------------------------- + * ivas_rend_openMultiBinCrend() + * + * Allocate and initialize crend renderer handle + *------------------------------------------------------------------------*/ +ivas_error ivas_rend_openMultiBinCrend( + CREND_WRAPPER *pCrend, + const IVAS_REND_AudioConfig inConfig, + const IVAS_REND_AudioConfig outConfig, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int32_t output_Fs ) +{ + int16_t pos_idx; + ivas_error error; + error = IVAS_ERR_OK; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, output_Fs, pos_idx ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } + return error; +} +#endif /*------------------------------------------------------------------------- * ivas_rend_openCrend() * @@ -1134,7 +1165,12 @@ ivas_error ivas_rend_openCrend( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, - const int32_t output_Fs ) + const int32_t output_Fs +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t pos_idx +#endif +) { /* TODO tmu : Based on ivas_crend_open() - could be harmonized / refactored */ int16_t i, subframe_length; @@ -1142,6 +1178,11 @@ ivas_error ivas_rend_openCrend( HRTFS_HANDLE hHrtf; CREND_HANDLE hCrend; ivas_error error; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hCrend = pCrend->hCrend[pos_idx]; +#else + hCrend = pCrend->hCrend; +#endif error = IVAS_ERR_OK; subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -1160,7 +1201,6 @@ ivas_error ivas_rend_openCrend( } hCrend->lfe_delay_line = NULL; - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { hCrend->freq_buffer_re[i] = NULL; @@ -1174,6 +1214,7 @@ ivas_error ivas_rend_openCrend( hCrend->freq_buffer_re_diffuse = NULL; hCrend->freq_buffer_im_diffuse = NULL; + hCrend->hReverb = NULL; hCrend->delay_line_rw_index = 0; hCrend->diffuse_delay_line_rw_index = 0; @@ -1262,7 +1303,11 @@ ivas_error ivas_rend_openCrend( hCrend->hTrack = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( hRendCfg != NULL ) && ( hRendCfg->roomAcoustics.late_reverb_on ) && ( pos_idx == 0 ) ) +#else if ( ( hRendCfg != NULL ) && ( hRendCfg->roomAcoustics.late_reverb_on ) ) +#endif { if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), getIvasAudioConfigFromRendAudioConfig( inConfig ), @@ -1281,7 +1326,12 @@ ivas_error ivas_rend_openCrend( pCrend->binaural_latency_ns = (int32_t) ( pCrend->hHrtfCrend->latency_s * 1000000000.f ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + pCrend->hCrend[pos_idx] = hCrend; +#else pCrend->hCrend = hCrend; +#endif + return IVAS_ERR_OK; } @@ -1313,7 +1363,11 @@ ivas_error ivas_rend_initCrend( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } - if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) + if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); } @@ -1679,71 +1733,87 @@ ivas_error ivas_rend_initCrend( *------------------------------------------------------------------------*/ ivas_error ivas_rend_closeCrend( - CREND_WRAPPER *pCrend ) + CREND_WRAPPER *pCrend +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + int16_t pos_idx +#endif +) { int16_t i; + CREND_HANDLE hCrend; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hCrend = pCrend->hCrend[pos_idx]; +#else + hCrend = pCrend->hCrend; +#endif if ( pCrend->hHrtfCrend != NULL ) { ivas_hrtf_close( &pCrend->hHrtfCrend ); } - if ( pCrend->hCrend != NULL ) + if ( hCrend != NULL ) { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { - if ( pCrend->hCrend->freq_buffer_re[i] != NULL ) + if ( hCrend->freq_buffer_re[i] != NULL ) { - count_free( pCrend->hCrend->freq_buffer_re[i] ); - pCrend->hCrend->freq_buffer_re[i] = NULL; + count_free( hCrend->freq_buffer_re[i] ); + hCrend->freq_buffer_re[i] = NULL; } - if ( pCrend->hCrend->freq_buffer_im[i] != NULL ) + if ( hCrend->freq_buffer_im[i] != NULL ) { - count_free( pCrend->hCrend->freq_buffer_im[i] ); - pCrend->hCrend->freq_buffer_im[i] = NULL; + count_free( hCrend->freq_buffer_im[i] ); + hCrend->freq_buffer_im[i] = NULL; } } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { - if ( pCrend->hCrend->prev_out_buffer[i] != NULL ) + if ( hCrend->prev_out_buffer[i] != NULL ) { - count_free( pCrend->hCrend->prev_out_buffer[i] ); - pCrend->hCrend->prev_out_buffer[i] = NULL; + count_free( hCrend->prev_out_buffer[i] ); + hCrend->prev_out_buffer[i] = NULL; } } - if ( pCrend->hCrend->lfe_delay_line != NULL ) + if ( hCrend->lfe_delay_line != NULL ) { - count_free( pCrend->hCrend->lfe_delay_line ); - pCrend->hCrend->lfe_delay_line = NULL; + count_free( hCrend->lfe_delay_line ); + hCrend->lfe_delay_line = NULL; } - if ( pCrend->hCrend->freq_buffer_re_diffuse != NULL ) + if ( hCrend->freq_buffer_re_diffuse != NULL ) { - count_free( pCrend->hCrend->freq_buffer_re_diffuse ); - pCrend->hCrend->freq_buffer_re_diffuse = NULL; + count_free( hCrend->freq_buffer_re_diffuse ); + hCrend->freq_buffer_re_diffuse = NULL; } - if ( pCrend->hCrend->freq_buffer_im_diffuse != NULL ) + if ( hCrend->freq_buffer_im_diffuse != NULL ) { - count_free( pCrend->hCrend->freq_buffer_im_diffuse ); - pCrend->hCrend->freq_buffer_im_diffuse = NULL; + count_free( hCrend->freq_buffer_im_diffuse ); + hCrend->freq_buffer_im_diffuse = NULL; } - if ( pCrend->hCrend->hTrack != NULL ) + if ( hCrend->hTrack != NULL ) { - count_free( pCrend->hCrend->hTrack ); - pCrend->hCrend->hTrack = NULL; + count_free( hCrend->hTrack ); + hCrend->hTrack = NULL; } - ivas_reverb_close( &pCrend->hCrend->hReverb ); + ivas_reverb_close( &hCrend->hReverb ); - count_free( pCrend->hCrend ); - pCrend->hCrend = NULL; + count_free( hCrend ); + hCrend = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + pCrend->hCrend[pos_idx] = hCrend; +#else + pCrend->hCrend = hCrend; +#endif + return IVAS_ERR_OK; } @@ -1758,7 +1828,12 @@ ivas_error ivas_rend_crendProcess( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int32_t output_Fs ) + const int32_t output_Fs +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t pos_idx +#endif +) { int16_t i, subframe_idx, output_frame; int16_t nchan_out; @@ -1766,6 +1841,12 @@ ivas_error ivas_rend_crendProcess( AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; + CREND_HANDLE hCrend; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hCrend = pCrend->hCrend[pos_idx]; +#else + hCrend = pCrend->hCrend; +#endif wmops_sub_start( "ivas_rend_crendProcess" ); @@ -1778,14 +1859,19 @@ ivas_error ivas_rend_crendProcess( { if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, pcm_tmp, output_Fs, subframe_idx +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + pos_idx +#endif + ) ) != IVAS_ERR_OK ) { return error; } - if ( pCrend->hCrend->hReverb != NULL ) + if ( hCrend->hReverb != NULL ) { - if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_process( hCrend->hReverb, in_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -1821,7 +1907,12 @@ ivas_error ivas_rend_crendConvolver( float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], const int32_t output_Fs, - const int16_t i_ts ) + const int16_t i_ts +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t pos_idx +#endif +) { int16_t i, j, k, m; int16_t subframe_length, idx_in; @@ -1833,6 +1924,12 @@ ivas_error ivas_rend_crendConvolver( float *pFreq_filt_re, *pFreq_filt_im; float pOut[L_FRAME48k * 2]; float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; + CREND_HANDLE hCrend; +#ifdef SPLIT_REND_WITH_HEAD_ROT + hCrend = pCrend->hCrend[pos_idx]; +#else + hCrend = pCrend->hCrend; +#endif getAudioConfigNumChannels( inConfig, &nchan_in ); getAudioConfigNumChannels( outConfig, &nchan_out ); @@ -1852,13 +1949,13 @@ ivas_error ivas_rend_crendConvolver( } } - offset = pCrend->hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ - offset_diffuse = pCrend->hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ + offset = hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ + offset_diffuse = hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { - set_zero( &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); - set_zero( &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); + set_zero( &hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); + set_zero( &hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); } i = 0; @@ -1869,10 +1966,10 @@ ivas_error ivas_rend_crendConvolver( { if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &pCrend->hCrend->freq_buffer_re[i][offset]; - pFreq_filt_im = &pCrend->hCrend->freq_buffer_im[i][offset]; + pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[offset_diffuse]; + pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[offset_diffuse]; + pFreq_filt_re = &hCrend->freq_buffer_re[i][offset]; + pFreq_filt_im = &hCrend->freq_buffer_im[i][offset]; for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ ) { @@ -1881,8 +1978,8 @@ ivas_error ivas_rend_crendConvolver( } } - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset]; + pFreq_buf_re = &hCrend->freq_buffer_re[i][offset]; + pFreq_buf_im = &hCrend->freq_buffer_im[i][offset]; ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); i++; @@ -1902,11 +1999,11 @@ ivas_error ivas_rend_crendConvolver( offset = 0; for ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ ) { - offset_in = ( pCrend->hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 ); + offset_in = ( hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 ); offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations ); offset_in = offset_in * subframe_length; - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset_in]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset_in]; + pFreq_buf_re = &hCrend->freq_buffer_re[i][offset_in]; + pFreq_buf_im = &hCrend->freq_buffer_im[i][offset_in]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_re[i][j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_im[i][j][offset]; @@ -1924,11 +2021,11 @@ ivas_error ivas_rend_crendConvolver( offset = 0; for ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ ) { - offset_diffuse = ( pCrend->hCrend->diffuse_delay_line_rw_index + m + 1 ); + offset_diffuse = ( hCrend->diffuse_delay_line_rw_index + m + 1 ); offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0]; offset_diffuse = offset_diffuse * subframe_length; - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; + pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[offset_diffuse]; + pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[offset_diffuse]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re[j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im[j][offset]; @@ -1945,17 +2042,17 @@ ivas_error ivas_rend_crendConvolver( pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; for ( k = 0; k < subframe_length; k++ ) { - pFreq_buf_re[k] = pOut[k] + pCrend->hCrend->prev_out_buffer[j][k]; - pCrend->hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; + pFreq_buf_re[k] = pOut[k] + hCrend->prev_out_buffer[j][k]; + hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; } } - pCrend->hCrend->delay_line_rw_index++; - pCrend->hCrend->delay_line_rw_index = pCrend->hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); + hCrend->delay_line_rw_index++; + hCrend->delay_line_rw_index = hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { - pCrend->hCrend->diffuse_delay_line_rw_index++; - pCrend->hCrend->diffuse_delay_line_rw_index = pCrend->hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); + hCrend->diffuse_delay_line_rw_index++; + hCrend->diffuse_delay_line_rw_index = hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); } return IVAS_ERR_OK; diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index f985b662a0..d155b849b9 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -41,10 +41,10 @@ typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; + float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_QUATERNION headPositionsPostRend[RENDERER_HEAD_POSITIONS_PER_FRAME]; + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; #endif - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; typedef struct @@ -57,7 +57,11 @@ typedef struct typedef struct { int32_t binaural_latency_ns; +#ifdef SPLIT_REND_WITH_HEAD_ROT + CREND_HANDLE hCrend[MAX_HEAD_ROT_POSES]; +#else CREND_HANDLE hCrend; +#endif HRTFS_HANDLE hHrtfCrend; } CREND_WRAPPER; @@ -79,21 +83,37 @@ ivas_error getAudioConfigNumChannels( AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +ivas_error ivas_rend_openMultiBinCrend( + CREND_WRAPPER *pCrend, + const IVAS_REND_AudioConfig inConfig, + const IVAS_REND_AudioConfig outConfig, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int32_t output_Fs ); +#endif + ivas_error ivas_rend_openCrend( CREND_WRAPPER *pCrend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, - const int32_t output_Fs ); + const int32_t output_Fs +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t pos_idx +#endif +); #ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, const IVAS_REND_HeadRotData *pHeadRotData, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ); + float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t low_res_pre_rend_rot ); ivas_error ivas_rend_openCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], @@ -102,14 +122,25 @@ ivas_error ivas_rend_openCldfb( ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, - const IVAS_SPLIT_REND_MODE splitRendMode, + const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg, +#ifdef SPLIT_REND_WITH_HEAD_ROT + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, +#endif const int32_t output_Fs ); +void ivas_mat_mult_2by2_complex( float in_re1[2][2], + float in_im1[2][2], + float in_re2[2][2], + float in_im2[2][2], + float out_re2[2][2], + float out_im2[2][2] ); void ivas_split_rend_bitstream_init( ivas_split_rend_bits_t *pBits, const int32_t buf_len_bytes, uint8_t *pbuf ); void ivas_split_rend_huffman_dec_init_min_max_len( ivas_split_rend_huffman_cfg_t *p_huff_cfg ); void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg ); -void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); +void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS], + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); +void set_pose_types( IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); int16_t wrap_a( int16_t val, int16_t min_val, int16_t max_val ); void ivas_SplitRenderer_getdiagdiff( int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], @@ -123,8 +154,19 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], int16_t subframe_idx ); -void ivas_rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS] ); void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); +int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate ); +int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out ); +void ivas_split_rend_get_quant_params( + const int16_t num_md_bands, + int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t *num_quant_strats, + int16_t *num_complex_bands ); #endif ivas_error ivas_rend_initCrend( @@ -135,14 +177,24 @@ ivas_error ivas_rend_initCrend( const int32_t output_Fs ); ivas_error ivas_rend_closeCrend( - CREND_WRAPPER *pCrend ); + CREND_WRAPPER *pCrend +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + int16_t pos_idx +#endif +); ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int32_t output_Fs ); + const int32_t output_Fs +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t pos_idx +#endif +); ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, @@ -151,7 +203,12 @@ ivas_error ivas_rend_crendConvolver( float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], const int32_t output_Fs, - const int16_t i_ts ); + const int16_t i_ts +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t pos_idx +#endif +); ivas_error ivas_rend_TDObjRenderFrame( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index fae2144afe..7d1f95e4cb 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -95,6 +95,9 @@ int16_t audioCfg2channels( break; case AUDIO_CONFIG_BINAURAL: case AUDIO_CONFIG_BINAURAL_ROOM: +#ifdef SPLIT_REND_WITH_HEAD_ROT + case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: +#endif nchan_out = 2; break; case AUDIO_CONFIG_ISM1: @@ -221,6 +224,9 @@ void ivas_output_init( break; case AUDIO_CONFIG_BINAURAL: case AUDIO_CONFIG_BINAURAL_ROOM: +#ifdef SPLIT_REND_WITH_HEAD_ROT + case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: +#endif case AUDIO_CONFIG_ISM1: case AUDIO_CONFIG_ISM2: case AUDIO_CONFIG_ISM3: @@ -282,7 +288,11 @@ void ivas_renderer_select( st_ivas->hHeadTrackData->shd_rot_max_order = -1; } - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { if ( st_ivas->ivas_format == ISM_FORMAT ) { @@ -333,7 +343,11 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) { *internal_config = output_config; - if ( output_config == AUDIO_CONFIG_BINAURAL ) + if ( output_config == AUDIO_CONFIG_BINAURAL +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -346,7 +360,11 @@ void ivas_renderer_select( { *internal_config = AUDIO_CONFIG_HOA3; - if ( output_config == AUDIO_CONFIG_BINAURAL ) + if ( output_config == AUDIO_CONFIG_BINAURAL +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { *renderer_type = RENDERER_BINAURAL_FASTCONV; } @@ -629,13 +647,19 @@ void ivas_renderer_select( } #ifdef SPLIT_REND_WITH_HEAD_ROT -void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ) +void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ) { hSplitRendBits->bits_written = 0; hSplitRendBits->bits_read = 0; hSplitBinRend->hSplitRendBits = hSplitRendBits; hSplitBinRend->hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) dynamic_malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ); + + ivas_renderSplitGetMultiBinPoseData( + hSplitBinConfig, + &hSplitBinRend->splitrend.multiBinPoseData, + hHeadTrackData->sr_pose_pred_axis ); + return; } #endif \ No newline at end of file diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 7e8caec092..f71c5207b6 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -101,7 +101,7 @@ ivas_error ivas_render_config_init_from_rom( return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; #endif ( *hRenderConfig )->roomAcoustics.override = false; @@ -118,5 +118,12 @@ ivas_error ivas_render_config_init_from_rom( mvr2r( ivas_reverb_default_RT60, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_N_BANDS ); mvr2r( ivas_reverb_default_DSR, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_N_BANDS ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + ( *hRenderConfig )->split_rend_config.splitRendBitRate = SPLIT_REND_768k; + ( *hRenderConfig )->split_rend_config.dof = 3; + ( *hRenderConfig )->split_rend_config.hq_mode = 0; + ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; +#endif + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_rom_binaural_crend_head.c b/lib_rend/ivas_rom_binaural_crend_head.c index ac4216ef77..ae08a9b4bd 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.c +++ b/lib_rend/ivas_rom_binaural_crend_head.c @@ -649,6 +649,397 @@ const uint16_t CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNE const uint16_t CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz = 0; const float CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[16]={0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f}; const uint16_t *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; + +#ifdef USE_DOLBY_HRTFS_WITH_LIB_REND_HOA3 +const float CRendBin_HOA3_HRIR_coeff_re_48kHz[16][BINAURAL_CHANNELS][480]={ + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.913511f, 0.297764f, -0.448662f, -0.794739f, -0.584308f, -0.066286f, 0.383335f, 0.523490f, 0.329142f, -0.049270f, -0.372446f, -0.439760f, -0.218387f, 0.131463f, 0.375250f, 0.366057f, 0.122749f, -0.199654f, -0.398818f, -0.338040f, -0.044156f, 0.289955f, 0.435397f, 0.292959f, -0.046275f, -0.370822f, -0.470921f, -0.255332f, 0.168596f, 0.524347f, 0.546137f, 0.190399f, -0.315265f, -0.631577f, -0.536748f, -0.071010f, 0.473325f, 0.724680f, 0.491926f, -0.077029f, -0.592750f, -0.709061f, -0.358645f, 0.221486f, 0.653227f, 0.654448f, 0.221714f, -0.358070f, + -0.697005f, -0.571979f, -0.072724f, 0.465706f, 0.688399f, 0.454808f, -0.069878f, -0.531901f, -0.632201f, -0.318528f, 0.196256f, 0.577642f, 0.578020f, 0.195732f, -0.315931f, -0.614947f, -0.504762f, -0.064240f, 0.413279f, 0.615223f, 0.410469f, -0.063698f, -0.489012f, -0.582556f, -0.291711f, 0.177074f, 0.509396f, 0.495935f, 0.163135f, -0.255558f, -0.483220f, -0.385116f, -0.047484f, 0.297139f, 0.430397f, 0.281064f, -0.042923f, -0.329134f, -0.394422f, -0.200007f, 0.123610f, 0.361593f, 0.357624f, 0.119310f, -0.188992f, -0.361951f, -0.292521f, -0.036559f, 0.232740f, 0.340851f, 0.223547f, -0.033904f, -0.257091f, -0.302468f, -0.150325f, 0.091447f, 0.263901f, 0.258505f, 0.085476f, -0.133310f, -0.250324f, -0.197278f, -0.023974f, 0.151501f, 0.223518f, 0.151424f, -0.024096f, -0.195202f, -0.243701f, -0.126585f, 0.078808f, 0.227034f, 0.218009f, 0.070086f, -0.106416f, -0.197846f, -0.157896f, -0.019854f, 0.132839f, 0.208150f, 0.149364f, -0.025039f, -0.212775f, -0.279217f, -0.153368f, 0.101549f, 0.313749f, 0.323895f, 0.111574f, -0.180715f, -0.351256f, -0.286277f, -0.035901f, 0.228684f, 0.334751f, 0.219900f, + -0.033586f, -0.258858f, -0.313198f, -0.162184f, 0.103962f, 0.319367f, 0.335040f, 0.119049f, -0.200630f, -0.406665f, -0.345432f, -0.045133f, 0.297852f, 0.452257f, 0.307675f, -0.048678f, -0.383458f, -0.469653f, -0.242363f, 0.151899f, 0.450820f, 0.452553f, 0.153364f, -0.247292f, -0.481211f, -0.394484f, -0.049986f, 0.320428f, 0.473864f, 0.314398f, -0.048591f, -0.374856f, -0.451318f, -0.230086f, 0.143343f, 0.425377f, 0.429356f, 0.146896f, -0.239536f, -0.471241f, -0.389483f, -0.049519f, 0.316500f, 0.463005f, 0.301169f, -0.045151f, -0.334495f, -0.382053f, -0.182555f, 0.105589f, 0.287834f, 0.265314f, 0.082622f, -0.121622f, -0.215847f, -0.160070f, -0.018038f, 0.105124f, 0.140415f, 0.085958f, -0.012310f, -0.094173f, -0.112729f, -0.057423f, 0.036152f, 0.106033f, 0.105674f, 0.035805f, -0.057042f, -0.111752f, -0.092326f, -0.011591f, 0.076887f, 0.114459f, 0.076487f, -0.011585f, -0.091335f, -0.110111f, -0.055908f, 0.035073f, 0.102854f, 0.102954f, 0.035102f, -0.056172f, -0.110235f, -0.090967f, -0.011393f, 0.075561f, 0.112715f, 0.075676f, -0.011529f, -0.091380f, -0.110514f, -0.056150f, 0.035172f, 0.102964f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.913511f, 0.297764f, -0.448662f, -0.794739f, -0.584308f, -0.066286f, 0.383335f, 0.523490f, 0.329142f, -0.049270f, -0.372446f, -0.439760f, -0.218387f, 0.131463f, 0.375250f, 0.366057f, 0.122749f, -0.199654f, -0.398818f, -0.338040f, -0.044156f, 0.289955f, 0.435397f, 0.292959f, -0.046275f, -0.370822f, -0.470921f, -0.255332f, 0.168596f, 0.524347f, 0.546137f, 0.190399f, -0.315265f, -0.631577f, -0.536748f, -0.071010f, 0.473325f, 0.724680f, 0.491926f, -0.077029f, -0.592750f, -0.709061f, -0.358645f, 0.221486f, 0.653227f, 0.654448f, 0.221714f, -0.358070f, + -0.697005f, -0.571979f, -0.072724f, 0.465706f, 0.688399f, 0.454808f, -0.069878f, -0.531901f, -0.632201f, -0.318528f, 0.196256f, 0.577642f, 0.578020f, 0.195732f, -0.315931f, -0.614947f, -0.504762f, -0.064240f, 0.413279f, 0.615223f, 0.410469f, -0.063698f, -0.489012f, -0.582556f, -0.291711f, 0.177074f, 0.509396f, 0.495935f, 0.163135f, -0.255558f, -0.483220f, -0.385116f, -0.047484f, 0.297139f, 0.430397f, 0.281064f, -0.042923f, -0.329134f, -0.394422f, -0.200007f, 0.123610f, 0.361593f, 0.357624f, 0.119310f, -0.188992f, -0.361951f, -0.292521f, -0.036559f, 0.232740f, 0.340851f, 0.223547f, -0.033904f, -0.257091f, -0.302468f, -0.150325f, 0.091447f, 0.263901f, 0.258505f, 0.085476f, -0.133310f, -0.250324f, -0.197278f, -0.023974f, 0.151501f, 0.223518f, 0.151424f, -0.024096f, -0.195202f, -0.243701f, -0.126585f, 0.078808f, 0.227034f, 0.218009f, 0.070086f, -0.106416f, -0.197846f, -0.157896f, -0.019854f, 0.132839f, 0.208150f, 0.149364f, -0.025039f, -0.212775f, -0.279217f, -0.153368f, 0.101549f, 0.313749f, 0.323895f, 0.111574f, -0.180715f, -0.351256f, -0.286277f, -0.035901f, 0.228684f, 0.334751f, 0.219900f, + -0.033586f, -0.258858f, -0.313198f, -0.162184f, 0.103962f, 0.319367f, 0.335040f, 0.119049f, -0.200630f, -0.406665f, -0.345432f, -0.045133f, 0.297852f, 0.452257f, 0.307675f, -0.048678f, -0.383458f, -0.469653f, -0.242363f, 0.151899f, 0.450820f, 0.452553f, 0.153364f, -0.247292f, -0.481211f, -0.394484f, -0.049986f, 0.320428f, 0.473864f, 0.314398f, -0.048591f, -0.374856f, -0.451318f, -0.230086f, 0.143343f, 0.425377f, 0.429356f, 0.146896f, -0.239536f, -0.471241f, -0.389483f, -0.049519f, 0.316500f, 0.463005f, 0.301169f, -0.045151f, -0.334495f, -0.382053f, -0.182555f, 0.105589f, 0.287834f, 0.265314f, 0.082622f, -0.121622f, -0.215847f, -0.160070f, -0.018038f, 0.105124f, 0.140415f, 0.085958f, -0.012310f, -0.094173f, -0.112729f, -0.057423f, 0.036152f, 0.106033f, 0.105674f, 0.035805f, -0.057042f, -0.111752f, -0.092326f, -0.011591f, 0.076887f, 0.114459f, 0.076487f, -0.011585f, -0.091335f, -0.110111f, -0.055908f, 0.035073f, 0.102854f, 0.102954f, 0.035102f, -0.056172f, -0.110235f, -0.090967f, -0.011393f, 0.075561f, 0.112715f, 0.075676f, -0.011529f, -0.091380f, -0.110514f, -0.056150f, 0.035172f, 0.102964f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.078507f, 0.345720f, 0.419014f, -0.090001f, -0.886763f, -1.112419f, -0.325594f, 0.822011f, 1.242202f, 0.620411f, -0.375701f, -0.958800f, -0.880887f, -0.320707f, 0.396742f, 0.867127f, 0.763383f, 0.133532f, -0.583480f, -0.912185f, -0.661302f, 0.016105f, 0.714207f, 0.974336f, 0.593807f, -0.186547f, -0.845249f, -0.953982f, -0.445024f, 0.358573f, 0.927923f, 0.870609f, 0.232731f, -0.519358f, -0.861148f, -0.599683f, 0.021863f, 0.538672f, 0.607073f, 0.229387f, -0.287399f, -0.575341f, -0.447050f, 0.001938f, 0.449531f, 0.554146f, 0.224325f, -0.281168f, + -0.564275f, -0.418027f, 0.036622f, 0.472044f, 0.578372f, 0.262453f, -0.267590f, -0.630790f, -0.563116f, -0.115202f, 0.410465f, 0.678620f, 0.516618f, 0.015341f, -0.505177f, -0.696887f, -0.433783f, 0.103311f, 0.565666f, 0.662825f, 0.335157f, -0.202959f, -0.596654f, -0.599760f, -0.238688f, 0.240150f, 0.550467f, 0.523064f, 0.188581f, -0.236223f, -0.487678f, -0.435603f, -0.143322f, 0.213448f, 0.444709f, 0.412420f, 0.110317f, -0.287293f, -0.516175f, -0.413270f, -0.035404f, 0.381937f, 0.570908f, 0.396330f, -0.044649f, -0.471027f, -0.602814f, -0.345663f, 0.148526f, 0.563279f, 0.606029f, 0.221870f, -0.332846f, -0.668739f, -0.558611f, -0.082992f, 0.459154f, 0.737843f, 0.559205f, -0.007264f, -0.608363f, -0.804526f, -0.415856f, 0.282748f, 0.750248f, 0.624001f, 0.022441f, -0.567542f, -0.700840f, -0.312376f, 0.272850f, 0.612965f, 0.475340f, -0.005432f, -0.442372f, -0.507417f, -0.189350f, 0.228122f, 0.429891f, 0.310743f, 0.000527f, -0.281747f, -0.381629f, -0.270808f, -0.023022f, 0.239144f, 0.388562f, 0.339103f, 0.101304f, -0.200864f, -0.398655f, -0.382230f, -0.151725f, 0.186980f, 0.446425f, 0.436823f, + 0.117420f, -0.315067f, -0.547592f, -0.399950f, 0.034065f, 0.459939f, 0.581115f, 0.293973f, -0.221988f, -0.603141f, -0.563489f, -0.119548f, 0.419367f, 0.678692f, 0.476034f, -0.059565f, -0.568595f, -0.700166f, -0.359537f, 0.221331f, 0.649202f, 0.641339f, 0.209017f, -0.357720f, -0.684164f, -0.558187f, -0.067778f, 0.461505f, 0.680823f, 0.443499f, -0.096523f, -0.579844f, -0.679605f, -0.322890f, 0.260250f, 0.687010f, 0.667356f, 0.197681f, -0.419959f, -0.769604f, -0.610433f, -0.049359f, 0.534803f, 0.753130f, 0.469899f, -0.105833f, -0.570847f, -0.623745f, -0.274389f, 0.200009f, 0.483611f, 0.428788f, 0.116727f, -0.221116f, -0.363828f, -0.251467f, -0.007878f, 0.183976f, 0.222880f, 0.122812f, -0.036656f, -0.160383f, -0.175959f, -0.075276f, 0.073669f, 0.172365f, 0.158052f, 0.040219f, -0.105590f, -0.182109f, -0.136463f, -0.000640f, 0.132975f, 0.177770f, 0.106182f, -0.035698f, -0.154112f, -0.168449f, -0.070286f, 0.071884f, 0.164807f, 0.149949f, 0.035346f, -0.105920f, -0.177740f, -0.130173f, 0.002044f, 0.129739f, 0.172320f, 0.102166f, -0.039082f, -0.157302f, -0.168874f, -0.069152f, 0.068659f, 0.160064f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.078507f, -0.345720f, -0.419014f, 0.090001f, 0.886763f, 1.112419f, 0.325594f, -0.822011f, -1.242202f, -0.620411f, 0.375701f, 0.958800f, 0.880887f, 0.320707f, -0.396742f, -0.867127f, -0.763383f, -0.133532f, 0.583480f, 0.912185f, 0.661302f, -0.016105f, -0.714207f, -0.974336f, -0.593807f, 0.186547f, 0.845249f, 0.953982f, 0.445024f, -0.358573f, -0.927923f, -0.870609f, -0.232731f, 0.519358f, 0.861148f, 0.599683f, -0.021863f, -0.538672f, -0.607073f, -0.229387f, 0.287399f, 0.575341f, 0.447050f, -0.001938f, -0.449531f, -0.554146f, -0.224325f, 0.281168f, + 0.564275f, 0.418027f, -0.036622f, -0.472044f, -0.578372f, -0.262453f, 0.267590f, 0.630790f, 0.563116f, 0.115202f, -0.410465f, -0.678620f, -0.516618f, -0.015341f, 0.505177f, 0.696887f, 0.433783f, -0.103311f, -0.565666f, -0.662825f, -0.335157f, 0.202959f, 0.596654f, 0.599760f, 0.238688f, -0.240150f, -0.550467f, -0.523064f, -0.188581f, 0.236223f, 0.487678f, 0.435603f, 0.143322f, -0.213448f, -0.444709f, -0.412420f, -0.110317f, 0.287293f, 0.516175f, 0.413270f, 0.035404f, -0.381937f, -0.570908f, -0.396330f, 0.044649f, 0.471027f, 0.602814f, 0.345663f, -0.148526f, -0.563279f, -0.606029f, -0.221870f, 0.332846f, 0.668739f, 0.558611f, 0.082992f, -0.459154f, -0.737843f, -0.559205f, 0.007264f, 0.608363f, 0.804526f, 0.415856f, -0.282748f, -0.750248f, -0.624001f, -0.022441f, 0.567542f, 0.700840f, 0.312376f, -0.272850f, -0.612965f, -0.475340f, 0.005432f, 0.442372f, 0.507417f, 0.189350f, -0.228122f, -0.429891f, -0.310743f, -0.000527f, 0.281747f, 0.381629f, 0.270808f, 0.023022f, -0.239144f, -0.388562f, -0.339103f, -0.101304f, 0.200864f, 0.398655f, 0.382230f, 0.151725f, -0.186980f, -0.446425f, -0.436823f, + -0.117420f, 0.315067f, 0.547592f, 0.399950f, -0.034065f, -0.459939f, -0.581115f, -0.293973f, 0.221988f, 0.603141f, 0.563489f, 0.119548f, -0.419367f, -0.678692f, -0.476034f, 0.059565f, 0.568595f, 0.700166f, 0.359537f, -0.221331f, -0.649202f, -0.641339f, -0.209017f, 0.357720f, 0.684164f, 0.558187f, 0.067778f, -0.461505f, -0.680823f, -0.443499f, 0.096523f, 0.579844f, 0.679605f, 0.322890f, -0.260250f, -0.687010f, -0.667356f, -0.197681f, 0.419959f, 0.769604f, 0.610433f, 0.049359f, -0.534803f, -0.753130f, -0.469899f, 0.105833f, 0.570847f, 0.623745f, 0.274389f, -0.200009f, -0.483611f, -0.428788f, -0.116727f, 0.221116f, 0.363828f, 0.251467f, 0.007878f, -0.183976f, -0.222880f, -0.122812f, 0.036656f, 0.160383f, 0.175959f, 0.075276f, -0.073669f, -0.172365f, -0.158052f, -0.040219f, 0.105590f, 0.182109f, 0.136463f, 0.000640f, -0.132975f, -0.177770f, -0.106182f, 0.035698f, 0.154112f, 0.168449f, 0.070286f, -0.071884f, -0.164807f, -0.149949f, -0.035346f, 0.105920f, 0.177740f, 0.130173f, -0.002044f, -0.129739f, -0.172320f, -0.102166f, 0.039082f, 0.157302f, 0.168874f, 0.069152f, -0.068659f, -0.160064f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.056307f, 0.017289f, -0.053811f, -0.084185f, -0.008613f, 0.092002f, 0.062033f, -0.099580f, -0.214305f, -0.155629f, 0.021739f, 0.206138f, 0.334890f, 0.334066f, 0.118602f, -0.245240f, -0.496706f, -0.418817f, -0.067469f, 0.298129f, 0.449549f, 0.319613f, 0.004971f, -0.284816f, -0.356471f, -0.193076f, 0.042675f, 0.186601f, 0.200892f, 0.126378f, 0.007231f, -0.102915f, -0.147677f, -0.125239f, -0.078000f, -0.010747f, 0.101856f, 0.212645f, 0.203751f, 0.034280f, -0.182624f, -0.287202f, -0.209052f, 0.010500f, 0.257761f, 0.384764f, 0.283593f, -0.015468f, + -0.333452f, -0.458472f, -0.289704f, 0.090437f, 0.447438f, 0.530318f, 0.254630f, -0.210776f, -0.551038f, -0.526344f, -0.136623f, 0.367043f, 0.628934f, 0.435243f, -0.094771f, -0.563169f, -0.599356f, -0.164855f, 0.412008f, 0.690156f, 0.447470f, -0.147777f, -0.645398f, -0.645396f, -0.123062f, 0.523026f, 0.772804f, 0.407638f, -0.297887f, -0.786113f, -0.664916f, -0.025973f, 0.633136f, 0.813435f, 0.401399f, -0.271290f, -0.709653f, -0.625527f, -0.117336f, 0.436247f, 0.656506f, 0.414931f, -0.100258f, -0.524759f, -0.565763f, -0.199279f, 0.311551f, 0.600325f, 0.464962f, 0.018217f, -0.405694f, -0.513509f, -0.262505f, 0.142648f, 0.424981f, 0.419716f, 0.154101f, -0.188441f, -0.385157f, -0.316166f, -0.043001f, 0.242142f, 0.354602f, 0.229791f, -0.052508f, -0.316498f, -0.386687f, -0.204250f, 0.115510f, 0.358371f, 0.369270f, 0.152433f, -0.152826f, -0.363564f, -0.346718f, -0.099628f, 0.218683f, 0.373221f, 0.234852f, -0.096557f, -0.362611f, -0.358813f, -0.094719f, 0.232165f, 0.400346f, 0.313370f, 0.037006f, -0.259275f, -0.398381f, -0.291816f, 0.000873f, 0.298687f, 0.414037f, 0.276027f, -0.028056f, -0.310213f, + -0.393575f, -0.221574f, 0.096431f, 0.349475f, 0.369718f, 0.147825f, -0.168488f, -0.376867f, -0.344875f, -0.090806f, 0.219243f, 0.372901f, 0.262680f, -0.027768f, -0.285267f, -0.331017f, -0.147856f, 0.125124f, 0.303138f, 0.274325f, 0.058929f, -0.203615f, -0.333339f, -0.228658f, 0.049331f, 0.309499f, 0.369146f, 0.183971f, -0.129645f, -0.376515f, -0.401416f, -0.181189f, 0.156776f, 0.408835f, 0.420846f, 0.182202f, -0.167209f, -0.415554f, -0.405188f, -0.139177f, 0.211525f, 0.420888f, 0.359762f, 0.076181f, -0.241102f, -0.385764f, -0.271635f, 0.007857f, 0.253310f, 0.309091f, 0.162282f, -0.071694f, -0.235856f, -0.228506f, -0.067485f, 0.122230f, 0.205738f, 0.140781f, -0.007607f, -0.133583f, -0.161259f, -0.080043f, 0.052690f, 0.146336f, 0.139675f, 0.041588f, -0.082472f, -0.154196f, -0.125716f, -0.012280f, 0.109378f, 0.155270f, 0.098016f, -0.021211f, -0.127542f, -0.152845f, -0.074559f, 0.056635f, 0.145534f, 0.132074f, 0.034821f, -0.081026f, -0.148681f, -0.122026f, -0.007801f, 0.114342f, 0.151241f, 0.085606f, -0.025537f, -0.120195f, -0.151097f, -0.079986f, 0.063410f, 0.152713f, 0.099450f, -0.007121f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.056307f, 0.017289f, -0.053811f, -0.084185f, -0.008613f, 0.092002f, 0.062033f, -0.099580f, -0.214305f, -0.155629f, 0.021739f, 0.206138f, 0.334890f, 0.334066f, 0.118602f, -0.245240f, -0.496706f, -0.418817f, -0.067469f, 0.298129f, 0.449549f, 0.319613f, 0.004971f, -0.284816f, -0.356471f, -0.193076f, 0.042675f, 0.186601f, 0.200892f, 0.126378f, 0.007231f, -0.102915f, -0.147677f, -0.125239f, -0.078000f, -0.010747f, 0.101856f, 0.212645f, 0.203751f, 0.034280f, -0.182624f, -0.287202f, -0.209052f, 0.010500f, 0.257761f, 0.384764f, 0.283593f, -0.015468f, + -0.333452f, -0.458472f, -0.289704f, 0.090437f, 0.447438f, 0.530318f, 0.254630f, -0.210776f, -0.551038f, -0.526344f, -0.136623f, 0.367043f, 0.628934f, 0.435243f, -0.094771f, -0.563169f, -0.599356f, -0.164855f, 0.412008f, 0.690156f, 0.447470f, -0.147777f, -0.645398f, -0.645396f, -0.123062f, 0.523026f, 0.772804f, 0.407638f, -0.297887f, -0.786113f, -0.664916f, -0.025973f, 0.633136f, 0.813435f, 0.401399f, -0.271290f, -0.709653f, -0.625527f, -0.117336f, 0.436247f, 0.656506f, 0.414931f, -0.100258f, -0.524759f, -0.565763f, -0.199279f, 0.311551f, 0.600325f, 0.464962f, 0.018217f, -0.405694f, -0.513509f, -0.262505f, 0.142648f, 0.424981f, 0.419716f, 0.154101f, -0.188441f, -0.385157f, -0.316166f, -0.043001f, 0.242142f, 0.354602f, 0.229791f, -0.052508f, -0.316498f, -0.386687f, -0.204250f, 0.115510f, 0.358371f, 0.369270f, 0.152433f, -0.152826f, -0.363564f, -0.346718f, -0.099628f, 0.218683f, 0.373221f, 0.234852f, -0.096557f, -0.362611f, -0.358813f, -0.094719f, 0.232165f, 0.400346f, 0.313370f, 0.037006f, -0.259275f, -0.398381f, -0.291816f, 0.000873f, 0.298687f, 0.414037f, 0.276027f, -0.028056f, -0.310213f, + -0.393575f, -0.221574f, 0.096431f, 0.349475f, 0.369718f, 0.147825f, -0.168488f, -0.376867f, -0.344875f, -0.090806f, 0.219243f, 0.372901f, 0.262680f, -0.027768f, -0.285267f, -0.331017f, -0.147856f, 0.125124f, 0.303138f, 0.274325f, 0.058929f, -0.203615f, -0.333339f, -0.228658f, 0.049331f, 0.309499f, 0.369146f, 0.183971f, -0.129645f, -0.376515f, -0.401416f, -0.181189f, 0.156776f, 0.408835f, 0.420846f, 0.182202f, -0.167209f, -0.415554f, -0.405188f, -0.139177f, 0.211525f, 0.420888f, 0.359762f, 0.076181f, -0.241102f, -0.385764f, -0.271635f, 0.007857f, 0.253310f, 0.309091f, 0.162282f, -0.071694f, -0.235856f, -0.228506f, -0.067485f, 0.122230f, 0.205738f, 0.140781f, -0.007607f, -0.133583f, -0.161259f, -0.080043f, 0.052690f, 0.146336f, 0.139675f, 0.041588f, -0.082472f, -0.154196f, -0.125716f, -0.012280f, 0.109378f, 0.155270f, 0.098016f, -0.021211f, -0.127542f, -0.152845f, -0.074559f, 0.056635f, 0.145534f, 0.132074f, 0.034821f, -0.081026f, -0.148681f, -0.122026f, -0.007801f, 0.114342f, 0.151241f, 0.085606f, -0.025537f, -0.120195f, -0.151097f, -0.079986f, 0.063410f, 0.152713f, 0.099450f, -0.007121f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.001257f, -0.010350f, -0.038127f, -0.020262f, 0.101537f, 0.231728f, 0.187449f, -0.048267f, -0.267921f, -0.280658f, -0.105940f, 0.108246f, 0.245205f, 0.245493f, 0.087874f, -0.160317f, -0.331689f, -0.287068f, -0.053261f, 0.198700f, 0.300661f, 0.205837f, -0.000868f, -0.179542f, -0.234477f, -0.160497f, -0.010459f, 0.152475f, 0.257183f, 0.223892f, 0.023982f, -0.249718f, -0.410542f, -0.309998f, 0.034923f, 0.422275f, 0.578727f, 0.351839f, -0.148528f, -0.596291f, -0.679309f, -0.330698f, 0.227772f, 0.644195f, 0.662235f, 0.273844f, -0.276815f, -0.644565f, + -0.605496f, -0.198898f, 0.310888f, 0.610724f, 0.526039f, 0.118137f, -0.351556f, -0.582341f, -0.435475f, -0.029220f, 0.356876f, 0.488443f, 0.322304f, -0.001429f, -0.276700f, -0.358345f, -0.230588f, 0.002926f, 0.192389f, 0.234171f, 0.127758f, -0.035102f, -0.139776f, -0.129340f, -0.037364f, 0.051713f, 0.076924f, 0.043600f, 0.004193f, 0.002369f, 0.029736f, 0.034107f, -0.019871f, -0.095210f, -0.107265f, -0.020138f, 0.097616f, 0.137086f, 0.060832f, -0.068516f, -0.157212f, -0.149396f, -0.042409f, 0.115326f, 0.226538f, 0.191254f, -0.001461f, -0.229766f, -0.318442f, -0.183876f, 0.089573f, 0.308853f, 0.315079f, 0.100840f, -0.183333f, -0.341558f, -0.277353f, -0.047925f, 0.206128f, 0.359174f, 0.332410f, 0.099042f, -0.256903f, -0.500277f, -0.384293f, 0.079566f, 0.535639f, 0.570851f, 0.116601f, -0.470852f, -0.731014f, -0.471950f, 0.128375f, 0.677066f, 0.800113f, 0.366226f, -0.367983f, -0.859137f, -0.685369f, 0.043750f, 0.726042f, 0.794194f, 0.225646f, -0.469894f, -0.732371f, -0.408721f, 0.188301f, 0.578924f, 0.487928f, 0.028220f, -0.414147f, -0.499999f, -0.198138f, 0.228352f, 0.460795f, 0.353587f, + 0.000305f, -0.347575f, -0.443945f, -0.220174f, 0.155163f, 0.406336f, 0.365800f, 0.080413f, -0.250538f, -0.411045f, -0.292465f, 0.030280f, 0.329826f, 0.389364f, 0.175045f, -0.149197f, -0.363855f, -0.341250f, -0.100000f, 0.215339f, 0.405586f, 0.336160f, 0.040934f, -0.289118f, -0.438244f, -0.310112f, 0.017972f, 0.345676f, 0.466021f, 0.292635f, -0.073629f, -0.397911f, -0.465924f, -0.232882f, 0.146076f, 0.424699f, 0.428977f, 0.162813f, -0.200832f, -0.428287f, -0.372716f, -0.075313f, 0.257473f, 0.400316f, 0.270810f, -0.022305f, -0.272450f, -0.323881f, -0.167166f, 0.071622f, 0.229241f, 0.218174f, 0.073328f, -0.091825f, -0.171761f, -0.132295f, -0.019156f, 0.083345f, 0.113355f, 0.067401f, -0.012515f, -0.076177f, -0.089938f, -0.046570f, 0.028220f, 0.084743f, 0.083601f, 0.026813f, -0.046361f, -0.089183f, -0.074551f, -0.010206f, 0.061913f, 0.091969f, 0.060416f, -0.009085f, -0.071965f, -0.091638f, -0.055653f, 0.016526f, 0.079074f, 0.089150f, 0.040235f, -0.034127f, -0.086136f, -0.082884f, -0.025007f, 0.050277f, 0.091643f, 0.071803f, 0.006030f, -0.063257f, -0.092957f, -0.060736f, 0.016159f, 0.081453f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.001257f, -0.010350f, -0.038127f, -0.020262f, 0.101537f, 0.231728f, 0.187449f, -0.048267f, -0.267921f, -0.280658f, -0.105940f, 0.108246f, 0.245205f, 0.245493f, 0.087874f, -0.160317f, -0.331689f, -0.287068f, -0.053261f, 0.198700f, 0.300661f, 0.205837f, -0.000868f, -0.179542f, -0.234477f, -0.160497f, -0.010459f, 0.152475f, 0.257183f, 0.223892f, 0.023982f, -0.249718f, -0.410542f, -0.309998f, 0.034923f, 0.422275f, 0.578727f, 0.351839f, -0.148528f, -0.596291f, -0.679309f, -0.330698f, 0.227772f, 0.644195f, 0.662235f, 0.273844f, -0.276815f, -0.644565f, + -0.605496f, -0.198898f, 0.310888f, 0.610724f, 0.526039f, 0.118137f, -0.351556f, -0.582341f, -0.435475f, -0.029220f, 0.356876f, 0.488443f, 0.322304f, -0.001429f, -0.276700f, -0.358345f, -0.230588f, 0.002926f, 0.192389f, 0.234171f, 0.127758f, -0.035102f, -0.139776f, -0.129340f, -0.037364f, 0.051713f, 0.076924f, 0.043600f, 0.004193f, 0.002369f, 0.029736f, 0.034107f, -0.019871f, -0.095210f, -0.107265f, -0.020138f, 0.097616f, 0.137086f, 0.060832f, -0.068516f, -0.157212f, -0.149396f, -0.042409f, 0.115326f, 0.226538f, 0.191254f, -0.001461f, -0.229766f, -0.318442f, -0.183876f, 0.089573f, 0.308853f, 0.315079f, 0.100840f, -0.183333f, -0.341558f, -0.277353f, -0.047925f, 0.206128f, 0.359174f, 0.332410f, 0.099042f, -0.256903f, -0.500277f, -0.384293f, 0.079566f, 0.535639f, 0.570851f, 0.116601f, -0.470852f, -0.731014f, -0.471950f, 0.128375f, 0.677066f, 0.800113f, 0.366226f, -0.367983f, -0.859137f, -0.685369f, 0.043750f, 0.726042f, 0.794194f, 0.225646f, -0.469894f, -0.732371f, -0.408721f, 0.188301f, 0.578924f, 0.487928f, 0.028220f, -0.414147f, -0.499999f, -0.198138f, 0.228352f, 0.460795f, 0.353587f, + 0.000305f, -0.347575f, -0.443945f, -0.220174f, 0.155163f, 0.406336f, 0.365800f, 0.080413f, -0.250538f, -0.411045f, -0.292465f, 0.030280f, 0.329826f, 0.389364f, 0.175045f, -0.149197f, -0.363855f, -0.341250f, -0.100000f, 0.215339f, 0.405586f, 0.336160f, 0.040934f, -0.289118f, -0.438244f, -0.310112f, 0.017972f, 0.345676f, 0.466021f, 0.292635f, -0.073629f, -0.397911f, -0.465924f, -0.232882f, 0.146076f, 0.424699f, 0.428977f, 0.162813f, -0.200832f, -0.428287f, -0.372716f, -0.075313f, 0.257473f, 0.400316f, 0.270810f, -0.022305f, -0.272450f, -0.323881f, -0.167166f, 0.071622f, 0.229241f, 0.218174f, 0.073328f, -0.091825f, -0.171761f, -0.132295f, -0.019156f, 0.083345f, 0.113355f, 0.067401f, -0.012515f, -0.076177f, -0.089938f, -0.046570f, 0.028220f, 0.084743f, 0.083601f, 0.026813f, -0.046361f, -0.089183f, -0.074551f, -0.010206f, 0.061913f, 0.091969f, 0.060416f, -0.009085f, -0.071965f, -0.091638f, -0.055653f, 0.016526f, 0.079074f, 0.089150f, 0.040235f, -0.034127f, -0.086136f, -0.082884f, -0.025007f, 0.050277f, 0.091643f, 0.071803f, 0.006030f, -0.063257f, -0.092957f, -0.060736f, 0.016159f, 0.081453f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.001001f, 0.008051f, -0.008894f, -0.059845f, -0.064833f, 0.067480f, 0.260624f, 0.282055f, 0.030622f, -0.289773f, -0.393012f, -0.215424f, 0.091978f, 0.349428f, 0.414274f, 0.202742f, -0.190698f, -0.479609f, -0.435928f, -0.116713f, 0.227845f, 0.395888f, 0.329501f, 0.083535f, -0.202329f, -0.362505f, -0.313180f, -0.091955f, 0.192348f, 0.392777f, 0.357073f, 0.051868f, -0.337931f, -0.528754f, -0.382114f, 0.000154f, 0.378441f, 0.521532f, 0.327372f, -0.090990f, -0.452110f, -0.512906f, -0.247750f, 0.164487f, 0.475569f, 0.497658f, 0.207830f, -0.209952f, + -0.475852f, -0.423848f, -0.110318f, 0.256492f, 0.457322f, 0.377940f, 0.076008f, -0.250647f, -0.405985f, -0.323890f, -0.071141f, 0.219063f, 0.396551f, 0.353665f, 0.108123f, -0.188027f, -0.356965f, -0.313876f, -0.100766f, 0.147658f, 0.279680f, 0.230608f, 0.070327f, -0.076613f, -0.145200f, -0.141438f, -0.084294f, 0.006600f, 0.089606f, 0.121031f, 0.089203f, 0.008555f, -0.088739f, -0.139597f, -0.082851f, 0.058698f, 0.171068f, 0.158046f, 0.030501f, -0.121105f, -0.201430f, -0.156471f, -0.006449f, 0.146377f, 0.189759f, 0.104012f, -0.031827f, -0.130292f, -0.154818f, -0.103683f, 0.005623f, 0.123392f, 0.180189f, 0.133102f, -0.006621f, -0.176150f, -0.272956f, -0.199324f, 0.045705f, 0.313150f, 0.391470f, 0.187409f, -0.172914f, -0.428776f, -0.385552f, -0.065542f, 0.306202f, 0.466166f, 0.303144f, -0.063414f, -0.370900f, -0.400805f, -0.133949f, 0.232104f, 0.419294f, 0.275344f, -0.094929f, -0.393982f, -0.372024f, -0.046540f, 0.313599f, 0.429476f, 0.235888f, -0.107437f, -0.364874f, -0.373121f, -0.124677f, 0.215898f, 0.403336f, 0.295474f, -0.026340f, -0.326097f, -0.392969f, -0.173120f, 0.197682f, 0.454837f, + 0.377995f, -0.003641f, -0.393177f, -0.476595f, -0.201074f, 0.203259f, 0.437709f, 0.352071f, 0.023386f, -0.303300f, -0.384148f, -0.170314f, 0.146929f, 0.311591f, 0.224057f, -0.014367f, -0.228551f, -0.295861f, -0.185965f, 0.039972f, 0.246601f, 0.294511f, 0.144588f, -0.102280f, -0.281071f, -0.281572f, -0.107973f, 0.139059f, 0.314581f, 0.297943f, 0.076018f, -0.215622f, -0.369508f, -0.267601f, 0.020713f, 0.297068f, 0.381580f, 0.223305f, -0.078408f, -0.331365f, -0.367357f, -0.162443f, 0.138004f, 0.327883f, 0.292464f, 0.077163f, -0.163428f, -0.277651f, -0.210571f, -0.026571f, 0.146260f, 0.204799f, 0.129837f, -0.013835f, -0.125722f, -0.137928f, -0.060312f, 0.036888f, 0.087544f, 0.074450f, 0.020217f, -0.040746f, -0.074894f, -0.060138f, -0.004458f, 0.053807f, 0.075366f, 0.047980f, -0.010478f, -0.063748f, -0.075518f, -0.035369f, 0.028186f, 0.070246f, 0.066049f, 0.022093f, -0.036398f, -0.076800f, -0.071445f, -0.019410f, 0.045541f, 0.079838f, 0.062510f, 0.004823f, -0.058154f, -0.084338f, -0.053017f, 0.013779f, 0.068493f, 0.078241f, 0.040740f, -0.024762f, -0.080037f, -0.078694f, -0.012665f, 0.057449f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.001001f, -0.008051f, 0.008894f, 0.059845f, 0.064833f, -0.067480f, -0.260624f, -0.282055f, -0.030622f, 0.289773f, 0.393012f, 0.215424f, -0.091978f, -0.349428f, -0.414274f, -0.202742f, 0.190698f, 0.479609f, 0.435928f, 0.116713f, -0.227845f, -0.395888f, -0.329501f, -0.083535f, 0.202329f, 0.362505f, 0.313180f, 0.091955f, -0.192348f, -0.392777f, -0.357073f, -0.051868f, 0.337931f, 0.528754f, 0.382114f, -0.000154f, -0.378441f, -0.521532f, -0.327372f, 0.090990f, 0.452110f, 0.512906f, 0.247750f, -0.164487f, -0.475569f, -0.497658f, -0.207830f, 0.209952f, + 0.475852f, 0.423848f, 0.110318f, -0.256492f, -0.457322f, -0.377940f, -0.076008f, 0.250647f, 0.405985f, 0.323890f, 0.071141f, -0.219063f, -0.396551f, -0.353665f, -0.108123f, 0.188027f, 0.356965f, 0.313876f, 0.100766f, -0.147658f, -0.279680f, -0.230608f, -0.070327f, 0.076613f, 0.145200f, 0.141438f, 0.084294f, -0.006600f, -0.089606f, -0.121031f, -0.089203f, -0.008555f, 0.088739f, 0.139597f, 0.082851f, -0.058698f, -0.171068f, -0.158046f, -0.030501f, 0.121105f, 0.201430f, 0.156471f, 0.006449f, -0.146377f, -0.189759f, -0.104012f, 0.031827f, 0.130292f, 0.154818f, 0.103683f, -0.005623f, -0.123392f, -0.180189f, -0.133102f, 0.006621f, 0.176150f, 0.272956f, 0.199324f, -0.045705f, -0.313150f, -0.391470f, -0.187409f, 0.172914f, 0.428776f, 0.385552f, 0.065542f, -0.306202f, -0.466166f, -0.303144f, 0.063414f, 0.370900f, 0.400805f, 0.133949f, -0.232104f, -0.419294f, -0.275344f, 0.094929f, 0.393982f, 0.372024f, 0.046540f, -0.313599f, -0.429476f, -0.235888f, 0.107437f, 0.364874f, 0.373121f, 0.124677f, -0.215898f, -0.403336f, -0.295474f, 0.026340f, 0.326097f, 0.392969f, 0.173120f, -0.197682f, -0.454837f, + -0.377995f, 0.003641f, 0.393177f, 0.476595f, 0.201074f, -0.203259f, -0.437709f, -0.352071f, -0.023386f, 0.303300f, 0.384148f, 0.170314f, -0.146929f, -0.311591f, -0.224057f, 0.014367f, 0.228551f, 0.295861f, 0.185965f, -0.039972f, -0.246601f, -0.294511f, -0.144588f, 0.102280f, 0.281071f, 0.281572f, 0.107973f, -0.139059f, -0.314581f, -0.297943f, -0.076018f, 0.215622f, 0.369508f, 0.267601f, -0.020713f, -0.297068f, -0.381580f, -0.223305f, 0.078408f, 0.331365f, 0.367357f, 0.162443f, -0.138004f, -0.327883f, -0.292464f, -0.077163f, 0.163428f, 0.277651f, 0.210571f, 0.026571f, -0.146260f, -0.204799f, -0.129837f, 0.013835f, 0.125722f, 0.137928f, 0.060312f, -0.036888f, -0.087544f, -0.074450f, -0.020217f, 0.040746f, 0.074894f, 0.060138f, 0.004458f, -0.053807f, -0.075366f, -0.047980f, 0.010478f, 0.063748f, 0.075518f, 0.035369f, -0.028186f, -0.070246f, -0.066049f, -0.022093f, 0.036398f, 0.076800f, 0.071445f, 0.019410f, -0.045541f, -0.079838f, -0.062510f, -0.004823f, 0.058154f, 0.084338f, 0.053017f, -0.013779f, -0.068493f, -0.078241f, -0.040740f, 0.024762f, 0.080037f, 0.078694f, 0.012665f, -0.057449f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.022291f, -0.014662f, -0.012124f, -0.015360f, -0.005069f, 0.023626f, 0.033685f, -0.013080f, -0.095957f, -0.151902f, -0.133705f, -0.011171f, 0.231125f, 0.502826f, 0.564668f, 0.233582f, -0.343747f, -0.749143f, -0.676401f, -0.192825f, 0.365754f, 0.659239f, 0.531925f, 0.095807f, -0.330097f, -0.466435f, -0.302669f, -0.039758f, 0.153288f, 0.238308f, 0.221616f, 0.110339f, -0.044708f, -0.168432f, -0.228245f, -0.214866f, -0.096627f, 0.114945f, 0.289399f, 0.273163f, 0.061065f, -0.191693f, -0.312882f, -0.225856f, 0.027185f, 0.297079f, 0.394209f, 0.228330f, + -0.098776f, -0.363857f, -0.387898f, -0.150826f, 0.198491f, 0.425258f, 0.361797f, 0.041663f, -0.310638f, -0.442134f, -0.252932f, 0.129701f, 0.424975f, 0.395130f, 0.049698f, -0.331639f, -0.425838f, -0.150534f, 0.263011f, 0.463918f, 0.267118f, -0.185714f, -0.513928f, -0.404449f, 0.090847f, 0.559528f, 0.578392f, 0.095438f, -0.513054f, -0.749042f, -0.392834f, 0.309074f, 0.808347f, 0.678262f, -0.014865f, -0.729952f, -0.890830f, -0.369988f, 0.420038f, 0.882423f, 0.696241f, 0.018201f, -0.663044f, -0.869517f, -0.453777f, 0.292949f, 0.832756f, 0.769409f, 0.151109f, -0.562146f, -0.850605f, -0.524463f, 0.151903f, 0.680056f, 0.706150f, 0.265856f, -0.282664f, -0.564178f, -0.460617f, -0.130960f, 0.184829f, 0.343935f, 0.318571f, 0.139239f, -0.111205f, -0.290795f, -0.278292f, -0.085937f, 0.143946f, 0.263584f, 0.216822f, 0.036327f, -0.184660f, -0.306622f, -0.212043f, 0.070925f, 0.336622f, 0.357187f, 0.094159f, -0.253239f, -0.413839f, -0.264576f, 0.083872f, 0.385098f, 0.438501f, 0.215236f, -0.139292f, -0.403663f, -0.415487f, -0.171458f, 0.171937f, 0.404501f, 0.395496f, 0.160742f, -0.154930f, -0.353111f, + -0.300285f, -0.038023f, 0.228710f, 0.298488f, 0.142858f, -0.094819f, -0.243022f, -0.222931f, -0.068139f, 0.114546f, 0.206705f, 0.152791f, 0.000743f, -0.137680f, -0.172234f, -0.089080f, 0.052423f, 0.161104f, 0.168631f, 0.068489f, -0.084943f, -0.206674f, -0.216894f, -0.083951f, 0.133818f, 0.300346f, 0.291634f, 0.091635f, -0.191559f, -0.389955f, -0.370116f, -0.119249f, 0.224709f, 0.448158f, 0.406834f, 0.123402f, -0.232091f, -0.445109f, -0.380664f, -0.074600f, 0.275172f, 0.440619f, 0.323673f, 0.013555f, -0.284836f, -0.382612f, -0.225333f, 0.067476f, 0.288395f, 0.299500f, 0.121110f, -0.111417f, -0.249793f, -0.214134f, -0.037569f, 0.148586f, 0.211717f, 0.124528f, -0.029762f, -0.143411f, -0.154809f, -0.064326f, 0.069792f, 0.156587f, 0.135111f, 0.023866f, -0.099482f, -0.157585f, -0.114707f, 0.005319f, 0.124141f, 0.158408f, 0.086146f, -0.040055f, -0.138817f, -0.148378f, -0.057697f, 0.075496f, 0.154132f, 0.122573f, 0.012219f, -0.099851f, -0.149713f, -0.105780f, 0.014483f, 0.129920f, 0.150647f, 0.067713f, -0.048867f, -0.131137f, -0.141624f, -0.057766f, 0.083886f, 0.160201f, 0.089919f, -0.028866f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.022291f, 0.014662f, 0.012124f, 0.015360f, 0.005069f, -0.023626f, -0.033685f, 0.013080f, 0.095957f, 0.151902f, 0.133705f, 0.011171f, -0.231125f, -0.502826f, -0.564668f, -0.233582f, 0.343747f, 0.749143f, 0.676401f, 0.192825f, -0.365754f, -0.659239f, -0.531925f, -0.095807f, 0.330097f, 0.466435f, 0.302669f, 0.039758f, -0.153288f, -0.238308f, -0.221616f, -0.110339f, 0.044708f, 0.168432f, 0.228245f, 0.214866f, 0.096627f, -0.114945f, -0.289399f, -0.273163f, -0.061065f, 0.191693f, 0.312882f, 0.225856f, -0.027185f, -0.297079f, -0.394209f, -0.228330f, + 0.098776f, 0.363857f, 0.387898f, 0.150826f, -0.198491f, -0.425258f, -0.361797f, -0.041663f, 0.310638f, 0.442134f, 0.252932f, -0.129701f, -0.424975f, -0.395130f, -0.049698f, 0.331639f, 0.425838f, 0.150534f, -0.263011f, -0.463918f, -0.267118f, 0.185714f, 0.513928f, 0.404449f, -0.090847f, -0.559528f, -0.578392f, -0.095438f, 0.513054f, 0.749042f, 0.392834f, -0.309074f, -0.808347f, -0.678262f, 0.014865f, 0.729952f, 0.890830f, 0.369988f, -0.420038f, -0.882423f, -0.696241f, -0.018201f, 0.663044f, 0.869517f, 0.453777f, -0.292949f, -0.832756f, -0.769409f, -0.151109f, 0.562146f, 0.850605f, 0.524463f, -0.151903f, -0.680056f, -0.706150f, -0.265856f, 0.282664f, 0.564178f, 0.460617f, 0.130960f, -0.184829f, -0.343935f, -0.318571f, -0.139239f, 0.111205f, 0.290795f, 0.278292f, 0.085937f, -0.143946f, -0.263584f, -0.216822f, -0.036327f, 0.184660f, 0.306622f, 0.212043f, -0.070925f, -0.336622f, -0.357187f, -0.094159f, 0.253239f, 0.413839f, 0.264576f, -0.083872f, -0.385098f, -0.438501f, -0.215236f, 0.139292f, 0.403663f, 0.415487f, 0.171458f, -0.171937f, -0.404501f, -0.395496f, -0.160742f, 0.154930f, 0.353111f, + 0.300285f, 0.038023f, -0.228710f, -0.298488f, -0.142858f, 0.094819f, 0.243022f, 0.222931f, 0.068139f, -0.114546f, -0.206705f, -0.152791f, -0.000743f, 0.137680f, 0.172234f, 0.089080f, -0.052423f, -0.161104f, -0.168631f, -0.068489f, 0.084943f, 0.206674f, 0.216894f, 0.083951f, -0.133818f, -0.300346f, -0.291634f, -0.091635f, 0.191559f, 0.389955f, 0.370116f, 0.119249f, -0.224709f, -0.448158f, -0.406834f, -0.123402f, 0.232091f, 0.445109f, 0.380664f, 0.074600f, -0.275172f, -0.440619f, -0.323673f, -0.013555f, 0.284836f, 0.382612f, 0.225333f, -0.067476f, -0.288395f, -0.299500f, -0.121110f, 0.111417f, 0.249793f, 0.214134f, 0.037569f, -0.148586f, -0.211717f, -0.124528f, 0.029762f, 0.143411f, 0.154809f, 0.064326f, -0.069792f, -0.156587f, -0.135111f, -0.023866f, 0.099482f, 0.157585f, 0.114707f, -0.005319f, -0.124141f, -0.158408f, -0.086146f, 0.040055f, 0.138817f, 0.148378f, 0.057697f, -0.075496f, -0.154132f, -0.122573f, -0.012219f, 0.099851f, 0.149713f, 0.105780f, -0.014483f, -0.129920f, -0.150647f, -0.067713f, 0.048867f, 0.131137f, 0.141624f, 0.057766f, -0.083886f, -0.160201f, -0.089919f, 0.028866f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.003189f, 0.015780f, 0.012464f, -0.038201f, -0.075010f, -0.002926f, 0.129707f, 0.108899f, -0.164363f, -0.452126f, -0.410504f, -0.020615f, 0.370118f, 0.443553f, 0.212402f, -0.081670f, -0.232452f, -0.189932f, -0.029436f, 0.123835f, 0.177304f, 0.120463f, -0.001459f, -0.134803f, -0.216302f, -0.176732f, -0.010552f, 0.178278f, 0.256196f, 0.182059f, 0.024206f, -0.114848f, -0.158810f, -0.086016f, 0.044617f, 0.117327f, 0.065336f, -0.051259f, -0.111817f, -0.069611f, 0.015086f, 0.060298f, 0.037804f, -0.024585f, -0.067462f, -0.030851f, 0.086290f, 0.188844f, + 0.157463f, -0.018729f, -0.210321f, -0.263084f, -0.127756f, 0.111674f, 0.293457f, 0.271555f, 0.029254f, -0.266813f, -0.378473f, -0.210471f, 0.098370f, 0.309045f, 0.283898f, 0.063567f, -0.192165f, -0.309300f, -0.202449f, 0.057091f, 0.273940f, 0.275297f, 0.061398f, -0.182852f, -0.243317f, -0.072401f, 0.159342f, 0.223913f, 0.060123f, -0.171415f, -0.254703f, -0.118681f, 0.121199f, 0.276710f, 0.226181f, -0.010740f, -0.281226f, -0.385722f, -0.214159f, 0.147315f, 0.439995f, 0.417371f, 0.068911f, -0.334814f, -0.461447f, -0.208150f, 0.216193f, 0.473006f, 0.354739f, -0.063006f, -0.458119f, -0.493553f, -0.111396f, 0.386841f, 0.597174f, 0.355887f, -0.161558f, -0.596105f, -0.627040f, -0.182517f, 0.431560f, 0.699339f, 0.365851f, -0.267592f, -0.635509f, -0.474320f, -0.001010f, 0.401498f, 0.513114f, 0.323527f, -0.042288f, -0.368471f, -0.445665f, -0.229898f, 0.116970f, 0.367255f, 0.381124f, 0.152681f, -0.197679f, -0.450463f, -0.399927f, -0.031331f, 0.414227f, 0.600534f, 0.362021f, -0.156018f, -0.595235f, -0.639849f, -0.244309f, 0.327624f, 0.684841f, 0.585134f, 0.102556f, -0.434906f, -0.677892f, -0.481934f, + 0.014129f, 0.483575f, 0.618251f, 0.332509f, -0.171597f, -0.545927f, -0.547069f, -0.196533f, 0.258392f, 0.520496f, 0.426566f, 0.045920f, -0.360202f, -0.512877f, -0.312111f, 0.096838f, 0.433615f, 0.474500f, 0.194973f, -0.217117f, -0.487000f, -0.439250f, -0.109879f, 0.291113f, 0.515963f, 0.418802f, 0.043930f, -0.378561f, -0.565107f, -0.379160f, 0.061224f, 0.467198f, 0.578218f, 0.323802f, -0.139196f, -0.519383f, -0.569388f, -0.250943f, 0.231338f, 0.562130f, 0.524023f, 0.142931f, -0.325086f, -0.565414f, -0.425176f, -0.018815f, 0.365354f, 0.478495f, 0.275858f, -0.076817f, -0.336773f, -0.351325f, -0.145266f, 0.119622f, 0.268574f, 0.226547f, 0.049526f, -0.131174f, -0.202972f, -0.137985f, 0.006528f, 0.136051f, 0.173006f, 0.095314f, -0.048136f, -0.161874f, -0.168192f, -0.064261f, 0.078743f, 0.167861f, 0.146301f, 0.026552f, -0.113644f, -0.179167f, -0.125580f, 0.008523f, 0.132950f, 0.168499f, 0.093707f, -0.043550f, -0.153280f, -0.161822f, -0.064163f, 0.073638f, 0.161611f, 0.143109f, 0.029082f, -0.106025f, -0.171234f, -0.123276f, 0.003867f, 0.126660f, 0.166547f, 0.095192f, -0.043964f, -0.154618f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.003189f, 0.015780f, 0.012464f, -0.038201f, -0.075010f, -0.002926f, 0.129707f, 0.108899f, -0.164363f, -0.452126f, -0.410504f, -0.020615f, 0.370118f, 0.443553f, 0.212402f, -0.081670f, -0.232452f, -0.189932f, -0.029436f, 0.123835f, 0.177304f, 0.120463f, -0.001459f, -0.134803f, -0.216302f, -0.176732f, -0.010552f, 0.178278f, 0.256196f, 0.182059f, 0.024206f, -0.114848f, -0.158810f, -0.086016f, 0.044617f, 0.117327f, 0.065336f, -0.051259f, -0.111817f, -0.069611f, 0.015086f, 0.060298f, 0.037804f, -0.024585f, -0.067462f, -0.030851f, 0.086290f, 0.188844f, + 0.157463f, -0.018729f, -0.210321f, -0.263084f, -0.127756f, 0.111674f, 0.293457f, 0.271555f, 0.029254f, -0.266813f, -0.378473f, -0.210471f, 0.098370f, 0.309045f, 0.283898f, 0.063567f, -0.192165f, -0.309300f, -0.202449f, 0.057091f, 0.273940f, 0.275297f, 0.061398f, -0.182852f, -0.243317f, -0.072401f, 0.159342f, 0.223913f, 0.060123f, -0.171415f, -0.254703f, -0.118681f, 0.121199f, 0.276710f, 0.226181f, -0.010740f, -0.281226f, -0.385722f, -0.214159f, 0.147315f, 0.439995f, 0.417371f, 0.068911f, -0.334814f, -0.461447f, -0.208150f, 0.216193f, 0.473006f, 0.354739f, -0.063006f, -0.458119f, -0.493553f, -0.111396f, 0.386841f, 0.597174f, 0.355887f, -0.161558f, -0.596105f, -0.627040f, -0.182517f, 0.431560f, 0.699339f, 0.365851f, -0.267592f, -0.635509f, -0.474320f, -0.001010f, 0.401498f, 0.513114f, 0.323527f, -0.042288f, -0.368471f, -0.445665f, -0.229898f, 0.116970f, 0.367255f, 0.381124f, 0.152681f, -0.197679f, -0.450463f, -0.399927f, -0.031331f, 0.414227f, 0.600534f, 0.362021f, -0.156018f, -0.595235f, -0.639849f, -0.244309f, 0.327624f, 0.684841f, 0.585134f, 0.102556f, -0.434906f, -0.677892f, -0.481934f, + 0.014129f, 0.483575f, 0.618251f, 0.332509f, -0.171597f, -0.545927f, -0.547069f, -0.196533f, 0.258392f, 0.520496f, 0.426566f, 0.045920f, -0.360202f, -0.512877f, -0.312111f, 0.096838f, 0.433615f, 0.474500f, 0.194973f, -0.217117f, -0.487000f, -0.439250f, -0.109879f, 0.291113f, 0.515963f, 0.418802f, 0.043930f, -0.378561f, -0.565107f, -0.379160f, 0.061224f, 0.467198f, 0.578218f, 0.323802f, -0.139196f, -0.519383f, -0.569388f, -0.250943f, 0.231338f, 0.562130f, 0.524023f, 0.142931f, -0.325086f, -0.565414f, -0.425176f, -0.018815f, 0.365354f, 0.478495f, 0.275858f, -0.076817f, -0.336773f, -0.351325f, -0.145266f, 0.119622f, 0.268574f, 0.226547f, 0.049526f, -0.131174f, -0.202972f, -0.137985f, 0.006528f, 0.136051f, 0.173006f, 0.095314f, -0.048136f, -0.161874f, -0.168192f, -0.064261f, 0.078743f, 0.167861f, 0.146301f, 0.026552f, -0.113644f, -0.179167f, -0.125580f, 0.008523f, 0.132950f, 0.168499f, 0.093707f, -0.043550f, -0.153280f, -0.161822f, -0.064163f, 0.073638f, 0.161611f, 0.143109f, 0.029082f, -0.106025f, -0.171234f, -0.123276f, 0.003867f, 0.126660f, 0.166547f, 0.095192f, -0.043964f, -0.154618f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.009671f, -0.002398f, -0.005043f, -0.003774f, 0.012776f, 0.002295f, -0.052423f, -0.065725f, 0.028299f, 0.132646f, 0.109211f, -0.009662f, -0.086761f, -0.103559f, -0.139737f, -0.167821f, -0.071437f, 0.123885f, 0.228103f, 0.139344f, -0.029194f, -0.120403f, -0.107875f, -0.056103f, -0.011937f, 0.013977f, 0.027233f, 0.044472f, 0.065560f, 0.053630f, -0.010283f, -0.075516f, -0.084061f, -0.056008f, -0.043553f, -0.030501f, 0.035733f, 0.126023f, 0.136807f, 0.030712f, -0.101832f, -0.145269f, -0.073203f, 0.054061f, 0.154550f, 0.164992f, 0.065424f, -0.091776f, + -0.194612f, -0.153573f, 0.015104f, 0.192166f, 0.243030f, 0.115748f, -0.116416f, -0.291664f, -0.265199f, -0.027362f, 0.261857f, 0.377611f, 0.207991f, -0.142729f, -0.417288f, -0.391740f, -0.050925f, 0.375568f, 0.561838f, 0.333534f, -0.171270f, -0.579031f, -0.562315f, -0.109099f, 0.447616f, 0.681253f, 0.408710f, -0.166382f, -0.621353f, -0.639872f, -0.226609f, 0.325619f, 0.650493f, 0.547609f, 0.104153f, -0.377131f, -0.593510f, -0.434729f, -0.021908f, 0.386996f, 0.541133f, 0.344148f, -0.064620f, -0.403377f, -0.477284f, -0.308512f, -0.037754f, 0.223879f, 0.394623f, 0.371307f, 0.109676f, -0.255920f, -0.473827f, -0.383905f, -0.038949f, 0.347410f, 0.527531f, 0.359616f, -0.067687f, -0.451672f, -0.505895f, -0.208652f, 0.198366f, 0.436236f, 0.382164f, 0.100069f, -0.222133f, -0.374287f, -0.260464f, 0.021819f, 0.267359f, 0.335470f, 0.221492f, 0.001008f, -0.221321f, -0.320202f, -0.208740f, 0.056437f, 0.278109f, 0.284988f, 0.090755f, -0.132344f, -0.220290f, -0.141429f, 0.013876f, 0.124627f, 0.123990f, 0.030580f, -0.081502f, -0.143001f, -0.124777f, -0.030058f, 0.113354f, 0.235666f, 0.234131f, 0.055028f, + -0.217240f, -0.385574f, -0.293713f, 0.027439f, 0.362499f, 0.466663f, 0.246857f, -0.165989f, -0.498472f, -0.513915f, -0.178914f, 0.292521f, 0.569395f, 0.443178f, -0.002730f, -0.448465f, -0.582368f, -0.325902f, 0.133510f, 0.490160f, 0.519593f, 0.213836f, -0.215575f, -0.478827f, -0.408408f, -0.069122f, 0.301102f, 0.458148f, 0.306616f, -0.043388f, -0.352280f, -0.420947f, -0.226899f, 0.086213f, 0.330969f, 0.381882f, 0.213300f, -0.090525f, -0.353437f, -0.400344f, -0.188824f, 0.144741f, 0.380148f, 0.367610f, 0.123881f, -0.184101f, -0.352883f, -0.282348f, -0.040707f, 0.196311f, 0.276897f, 0.170490f, -0.028061f, -0.175950f, -0.184290f, -0.071754f, 0.067066f, 0.140138f, 0.112762f, 0.013476f, -0.089673f, -0.128730f, -0.079902f, 0.020090f, 0.103658f, 0.118975f, 0.057220f, -0.043976f, -0.118359f, -0.113520f, -0.032739f, 0.067326f, 0.121423f, 0.097100f, 0.008767f, -0.088602f, -0.128638f, -0.081807f, 0.019023f, 0.105985f, 0.125014f, 0.063692f, -0.042402f, -0.122759f, -0.118566f, -0.034177f, 0.068234f, 0.124292f, 0.104012f, 0.014836f, -0.092555f, -0.137765f, -0.081403f, 0.022488f, 0.089067f, 0.102950f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.009671f, -0.002398f, -0.005043f, -0.003774f, 0.012776f, 0.002295f, -0.052423f, -0.065725f, 0.028299f, 0.132646f, 0.109211f, -0.009662f, -0.086761f, -0.103559f, -0.139737f, -0.167821f, -0.071437f, 0.123885f, 0.228103f, 0.139344f, -0.029194f, -0.120403f, -0.107875f, -0.056103f, -0.011937f, 0.013977f, 0.027233f, 0.044472f, 0.065560f, 0.053630f, -0.010283f, -0.075516f, -0.084061f, -0.056008f, -0.043553f, -0.030501f, 0.035733f, 0.126023f, 0.136807f, 0.030712f, -0.101832f, -0.145269f, -0.073203f, 0.054061f, 0.154550f, 0.164992f, 0.065424f, -0.091776f, + -0.194612f, -0.153573f, 0.015104f, 0.192166f, 0.243030f, 0.115748f, -0.116416f, -0.291664f, -0.265199f, -0.027362f, 0.261857f, 0.377611f, 0.207991f, -0.142729f, -0.417288f, -0.391740f, -0.050925f, 0.375568f, 0.561838f, 0.333534f, -0.171270f, -0.579031f, -0.562315f, -0.109099f, 0.447616f, 0.681253f, 0.408710f, -0.166382f, -0.621353f, -0.639872f, -0.226609f, 0.325619f, 0.650493f, 0.547609f, 0.104153f, -0.377131f, -0.593510f, -0.434729f, -0.021908f, 0.386996f, 0.541133f, 0.344148f, -0.064620f, -0.403377f, -0.477284f, -0.308512f, -0.037754f, 0.223879f, 0.394623f, 0.371307f, 0.109676f, -0.255920f, -0.473827f, -0.383905f, -0.038949f, 0.347410f, 0.527531f, 0.359616f, -0.067687f, -0.451672f, -0.505895f, -0.208652f, 0.198366f, 0.436236f, 0.382164f, 0.100069f, -0.222133f, -0.374287f, -0.260464f, 0.021819f, 0.267359f, 0.335470f, 0.221492f, 0.001008f, -0.221321f, -0.320202f, -0.208740f, 0.056437f, 0.278109f, 0.284988f, 0.090755f, -0.132344f, -0.220290f, -0.141429f, 0.013876f, 0.124627f, 0.123990f, 0.030580f, -0.081502f, -0.143001f, -0.124777f, -0.030058f, 0.113354f, 0.235666f, 0.234131f, 0.055028f, + -0.217240f, -0.385574f, -0.293713f, 0.027439f, 0.362499f, 0.466663f, 0.246857f, -0.165989f, -0.498472f, -0.513915f, -0.178914f, 0.292521f, 0.569395f, 0.443178f, -0.002730f, -0.448465f, -0.582368f, -0.325902f, 0.133510f, 0.490160f, 0.519593f, 0.213836f, -0.215575f, -0.478827f, -0.408408f, -0.069122f, 0.301102f, 0.458148f, 0.306616f, -0.043388f, -0.352280f, -0.420947f, -0.226899f, 0.086213f, 0.330969f, 0.381882f, 0.213300f, -0.090525f, -0.353437f, -0.400344f, -0.188824f, 0.144741f, 0.380148f, 0.367610f, 0.123881f, -0.184101f, -0.352883f, -0.282348f, -0.040707f, 0.196311f, 0.276897f, 0.170490f, -0.028061f, -0.175950f, -0.184290f, -0.071754f, 0.067066f, 0.140138f, 0.112762f, 0.013476f, -0.089673f, -0.128730f, -0.079902f, 0.020090f, 0.103658f, 0.118975f, 0.057220f, -0.043976f, -0.118359f, -0.113520f, -0.032739f, 0.067326f, 0.121423f, 0.097100f, 0.008767f, -0.088602f, -0.128638f, -0.081807f, 0.019023f, 0.105985f, 0.125014f, 0.063692f, -0.042402f, -0.122759f, -0.118566f, -0.034177f, 0.068234f, 0.124292f, 0.104012f, 0.014836f, -0.092555f, -0.137765f, -0.081403f, 0.022488f, 0.089067f, 0.102950f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.028389f, -0.005278f, -0.054637f, -0.169399f, -0.157904f, 0.125765f, 0.492043f, 0.508943f, -0.008427f, -0.675150f, -0.853474f, -0.316569f, 0.501173f, 0.941674f, 0.720447f, 0.073423f, -0.540885f, -0.770187f, -0.507163f, 0.092717f, 0.667105f, 0.830015f, 0.433738f, -0.290332f, -0.862726f, -0.892713f, -0.368575f, 0.342113f, 0.784566f, 0.735024f, 0.291077f, -0.253708f, -0.587951f, -0.538791f, -0.179797f, 0.213728f, 0.389433f, 0.311209f, 0.114487f, -0.072046f, -0.197297f, -0.236324f, -0.170713f, -0.024583f, 0.137226f, 0.247963f, 0.252819f, 0.123370f, + -0.094107f, -0.273335f, -0.299087f, -0.156398f, 0.078198f, 0.291799f, 0.368753f, 0.238778f, -0.048808f, -0.322948f, -0.407630f, -0.249085f, 0.058800f, 0.337573f, 0.418201f, 0.239838f, -0.094125f, -0.370050f, -0.409480f, -0.191186f, 0.139321f, 0.367386f, 0.349877f, 0.112808f, -0.169146f, -0.304971f, -0.224896f, -0.014286f, 0.167661f, 0.208427f, 0.111270f, -0.030879f, -0.121587f, -0.124061f, -0.059062f, 0.029164f, 0.097757f, 0.119895f, 0.091860f, 0.023127f, -0.073705f, -0.168657f, -0.204509f, -0.134685f, 0.023137f, 0.186667f, 0.259881f, 0.183611f, -0.026361f, -0.256797f, -0.342188f, -0.190867f, 0.118668f, 0.382882f, 0.417720f, 0.175644f, -0.221842f, -0.531322f, -0.520084f, -0.146695f, 0.352573f, 0.600974f, 0.382227f, -0.142702f, -0.532281f, -0.443798f, 0.039325f, 0.476537f, 0.488134f, 0.091741f, -0.361404f, -0.514066f, -0.257965f, 0.219758f, 0.552995f, 0.444987f, -0.054093f, -0.518598f, -0.512679f, -0.029513f, 0.485749f, 0.571942f, 0.177831f, -0.332935f, -0.535851f, -0.297529f, 0.148195f, 0.419516f, 0.311322f, -0.041599f, -0.304305f, -0.252564f, 0.039945f, 0.297644f, 0.300605f, 0.059205f, + -0.220168f, -0.316611f, -0.168704f, 0.088496f, 0.247525f, 0.206120f, 0.037520f, -0.103974f, -0.130526f, -0.070457f, -0.000977f, 0.031312f, 0.025791f, 0.002623f, -0.015916f, -0.015573f, -0.001424f, 0.006688f, 0.001678f, 0.003529f, 0.030354f, 0.060939f, 0.049027f, -0.016883f, -0.085346f, -0.090220f, -0.021341f, 0.065913f, 0.107379f, 0.084075f, 0.024352f, -0.030536f, -0.058835f, -0.065944f, -0.064713f, -0.050445f, -0.006497f, 0.060373f, 0.106995f, 0.091751f, 0.017698f, -0.070548f, -0.120302f, -0.097098f, -0.004966f, 0.099881f, 0.137823f, 0.076031f, -0.035606f, -0.111130f, -0.102507f, -0.026230f, 0.059299f, 0.093310f, 0.055057f, -0.016119f, -0.056914f, -0.043417f, -0.004882f, 0.021932f, 0.026956f, 0.015759f, -0.005454f, -0.024768f, -0.026780f, -0.009809f, 0.011675f, 0.023789f, 0.021849f, 0.006652f, -0.014452f, -0.026465f, -0.018854f, 0.002603f, 0.021685f, 0.025328f, 0.010368f, -0.014367f, -0.031027f, -0.026433f, -0.004358f, 0.019936f, 0.032748f, 0.026369f, 0.001950f, -0.024923f, -0.033169f, -0.017718f, 0.007495f, 0.027748f, 0.034364f, 0.019431f, -0.012784f, -0.034390f, -0.022781f, 0.002350f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.028389f, -0.005278f, -0.054637f, -0.169399f, -0.157904f, 0.125765f, 0.492043f, 0.508943f, -0.008427f, -0.675150f, -0.853474f, -0.316569f, 0.501173f, 0.941674f, 0.720447f, 0.073423f, -0.540885f, -0.770187f, -0.507163f, 0.092717f, 0.667105f, 0.830015f, 0.433738f, -0.290332f, -0.862726f, -0.892713f, -0.368575f, 0.342113f, 0.784566f, 0.735024f, 0.291077f, -0.253708f, -0.587951f, -0.538791f, -0.179797f, 0.213728f, 0.389433f, 0.311209f, 0.114487f, -0.072046f, -0.197297f, -0.236324f, -0.170713f, -0.024583f, 0.137226f, 0.247963f, 0.252819f, 0.123370f, + -0.094107f, -0.273335f, -0.299087f, -0.156398f, 0.078198f, 0.291799f, 0.368753f, 0.238778f, -0.048808f, -0.322948f, -0.407630f, -0.249085f, 0.058800f, 0.337573f, 0.418201f, 0.239838f, -0.094125f, -0.370050f, -0.409480f, -0.191186f, 0.139321f, 0.367386f, 0.349877f, 0.112808f, -0.169146f, -0.304971f, -0.224896f, -0.014286f, 0.167661f, 0.208427f, 0.111270f, -0.030879f, -0.121587f, -0.124061f, -0.059062f, 0.029164f, 0.097757f, 0.119895f, 0.091860f, 0.023127f, -0.073705f, -0.168657f, -0.204509f, -0.134685f, 0.023137f, 0.186667f, 0.259881f, 0.183611f, -0.026361f, -0.256797f, -0.342188f, -0.190867f, 0.118668f, 0.382882f, 0.417720f, 0.175644f, -0.221842f, -0.531322f, -0.520084f, -0.146695f, 0.352573f, 0.600974f, 0.382227f, -0.142702f, -0.532281f, -0.443798f, 0.039325f, 0.476537f, 0.488134f, 0.091741f, -0.361404f, -0.514066f, -0.257965f, 0.219758f, 0.552995f, 0.444987f, -0.054093f, -0.518598f, -0.512679f, -0.029513f, 0.485749f, 0.571942f, 0.177831f, -0.332935f, -0.535851f, -0.297529f, 0.148195f, 0.419516f, 0.311322f, -0.041599f, -0.304305f, -0.252564f, 0.039945f, 0.297644f, 0.300605f, 0.059205f, + -0.220168f, -0.316611f, -0.168704f, 0.088496f, 0.247525f, 0.206120f, 0.037520f, -0.103974f, -0.130526f, -0.070457f, -0.000977f, 0.031312f, 0.025791f, 0.002623f, -0.015916f, -0.015573f, -0.001424f, 0.006688f, 0.001678f, 0.003529f, 0.030354f, 0.060939f, 0.049027f, -0.016883f, -0.085346f, -0.090220f, -0.021341f, 0.065913f, 0.107379f, 0.084075f, 0.024352f, -0.030536f, -0.058835f, -0.065944f, -0.064713f, -0.050445f, -0.006497f, 0.060373f, 0.106995f, 0.091751f, 0.017698f, -0.070548f, -0.120302f, -0.097098f, -0.004966f, 0.099881f, 0.137823f, 0.076031f, -0.035606f, -0.111130f, -0.102507f, -0.026230f, 0.059299f, 0.093310f, 0.055057f, -0.016119f, -0.056914f, -0.043417f, -0.004882f, 0.021932f, 0.026956f, 0.015759f, -0.005454f, -0.024768f, -0.026780f, -0.009809f, 0.011675f, 0.023789f, 0.021849f, 0.006652f, -0.014452f, -0.026465f, -0.018854f, 0.002603f, 0.021685f, 0.025328f, 0.010368f, -0.014367f, -0.031027f, -0.026433f, -0.004358f, 0.019936f, 0.032748f, 0.026369f, 0.001950f, -0.024923f, -0.033169f, -0.017718f, 0.007495f, 0.027748f, 0.034364f, 0.019431f, -0.012784f, -0.034390f, -0.022781f, 0.002350f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.014512f, -0.016429f, -0.034557f, -0.041369f, -0.011506f, 0.011233f, -0.001682f, 0.020521f, 0.114955f, 0.151730f, -0.000411f, -0.239545f, -0.329315f, -0.188255f, 0.057294f, 0.247912f, 0.285779f, 0.131972f, -0.134882f, -0.300966f, -0.198131f, 0.102896f, 0.353787f, 0.357409f, 0.104705f, -0.241536f, -0.450142f, -0.382109f, -0.107998f, 0.164637f, 0.284453f, 0.237340f, 0.082952f, -0.088468f, -0.161984f, -0.079488f, 0.074373f, 0.151869f, 0.106220f, 0.008959f, -0.068660f, -0.107952f, -0.098278f, -0.030286f, 0.062196f, 0.115330f, 0.096918f, 0.024364f, + -0.062598f, -0.118401f, -0.105635f, -0.027284f, 0.065178f, 0.113179f, 0.092096f, 0.015221f, -0.076199f, -0.125822f, -0.095722f, -0.001227f, 0.096789f, 0.136832f, 0.096202f, 0.003389f, -0.080494f, -0.107751f, -0.079055f, -0.026005f, 0.027831f, 0.067568f, 0.069670f, 0.024810f, -0.030010f, -0.043251f, -0.011822f, 0.021250f, 0.026793f, 0.012819f, -0.005506f, -0.021626f, -0.024631f, -0.005569f, 0.019541f, 0.021544f, -0.002011f, -0.021801f, -0.017050f, -0.002437f, -0.006760f, -0.035220f, -0.059542f, -0.043288f, 0.021198f, 0.096044f, 0.121579f, 0.067529f, -0.034057f, -0.110908f, -0.111511f, -0.046586f, 0.027860f, 0.062770f, 0.048662f, 0.006705f, -0.036054f, -0.059507f, -0.052318f, -0.014186f, 0.040268f, 0.080701f, 0.071134f, -0.000909f, -0.093787f, -0.127975f, -0.062266f, 0.045961f, 0.085172f, 0.009536f, -0.100685f, -0.115131f, 0.012257f, 0.188930f, 0.258913f, 0.137516f, -0.104488f, -0.278572f, -0.226963f, 0.027318f, 0.275194f, 0.296640f, 0.062780f, -0.235745f, -0.357727f, -0.207734f, 0.101382f, 0.337736f, 0.318714f, 0.057884f, -0.230749f, -0.314764f, -0.153394f, 0.090726f, 0.233204f, 0.210926f, + 0.065868f, -0.115416f, -0.220274f, -0.163482f, 0.013109f, 0.150715f, 0.138342f, 0.025835f, -0.063481f, -0.077109f, -0.044946f, -0.003320f, 0.029509f, 0.035000f, 0.008694f, -0.021467f, -0.027438f, -0.015248f, -0.002032f, 0.015826f, 0.042475f, 0.053086f, 0.019082f, -0.044226f, -0.080752f, -0.048149f, 0.037747f, 0.110629f, 0.106264f, 0.018906f, -0.087976f, -0.132783f, -0.084551f, 0.014592f, 0.089376f, 0.092076f, 0.032992f, -0.036804f, -0.068869f, -0.049589f, -0.001053f, 0.040434f, 0.048997f, 0.024613f, -0.009241f, -0.026758f, -0.021550f, -0.006760f, 0.002714f, 0.003226f, 0.001042f, 0.003587f, 0.010448f, 0.012400f, 0.004412f, -0.003334f, 0.000949f, 0.008792f, 0.000811f, -0.021391f, -0.032702f, -0.018298f, 0.008520f, 0.026675f, 0.027695f, 0.012546f, -0.012599f, -0.032061f, -0.029080f, -0.005011f, 0.020727f, 0.031063f, 0.022444f, 0.000380f, -0.023163f, -0.031978f, -0.018604f, 0.006009f, 0.023546f, 0.024911f, 0.011571f, -0.009700f, -0.026389f, -0.024980f, -0.005203f, 0.016979f, 0.025820f, 0.018578f, 0.000957f, -0.018776f, -0.028298f, -0.017328f, 0.007337f, 0.023219f, 0.017507f, 0.003770f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.014512f, 0.016429f, 0.034557f, 0.041369f, 0.011506f, -0.011233f, 0.001682f, -0.020521f, -0.114955f, -0.151730f, 0.000411f, 0.239545f, 0.329315f, 0.188255f, -0.057294f, -0.247912f, -0.285779f, -0.131972f, 0.134882f, 0.300966f, 0.198131f, -0.102896f, -0.353787f, -0.357409f, -0.104705f, 0.241536f, 0.450142f, 0.382109f, 0.107998f, -0.164637f, -0.284453f, -0.237340f, -0.082952f, 0.088468f, 0.161984f, 0.079488f, -0.074373f, -0.151869f, -0.106220f, -0.008959f, 0.068660f, 0.107952f, 0.098278f, 0.030286f, -0.062196f, -0.115330f, -0.096918f, -0.024364f, + 0.062598f, 0.118401f, 0.105635f, 0.027284f, -0.065178f, -0.113179f, -0.092096f, -0.015221f, 0.076199f, 0.125822f, 0.095722f, 0.001227f, -0.096789f, -0.136832f, -0.096202f, -0.003389f, 0.080494f, 0.107751f, 0.079055f, 0.026005f, -0.027831f, -0.067568f, -0.069670f, -0.024810f, 0.030010f, 0.043251f, 0.011822f, -0.021250f, -0.026793f, -0.012819f, 0.005506f, 0.021626f, 0.024631f, 0.005569f, -0.019541f, -0.021544f, 0.002011f, 0.021801f, 0.017050f, 0.002437f, 0.006760f, 0.035220f, 0.059542f, 0.043288f, -0.021198f, -0.096044f, -0.121579f, -0.067529f, 0.034057f, 0.110908f, 0.111511f, 0.046586f, -0.027860f, -0.062770f, -0.048662f, -0.006705f, 0.036054f, 0.059507f, 0.052318f, 0.014186f, -0.040268f, -0.080701f, -0.071134f, 0.000909f, 0.093787f, 0.127975f, 0.062266f, -0.045961f, -0.085172f, -0.009536f, 0.100685f, 0.115131f, -0.012257f, -0.188930f, -0.258913f, -0.137516f, 0.104488f, 0.278572f, 0.226963f, -0.027318f, -0.275194f, -0.296640f, -0.062780f, 0.235745f, 0.357727f, 0.207734f, -0.101382f, -0.337736f, -0.318714f, -0.057884f, 0.230749f, 0.314764f, 0.153394f, -0.090726f, -0.233204f, -0.210926f, + -0.065868f, 0.115416f, 0.220274f, 0.163482f, -0.013109f, -0.150715f, -0.138342f, -0.025835f, 0.063481f, 0.077109f, 0.044946f, 0.003320f, -0.029509f, -0.035000f, -0.008694f, 0.021467f, 0.027438f, 0.015248f, 0.002032f, -0.015826f, -0.042475f, -0.053086f, -0.019082f, 0.044226f, 0.080752f, 0.048149f, -0.037747f, -0.110629f, -0.106264f, -0.018906f, 0.087976f, 0.132783f, 0.084551f, -0.014592f, -0.089376f, -0.092076f, -0.032992f, 0.036804f, 0.068869f, 0.049589f, 0.001053f, -0.040434f, -0.048997f, -0.024613f, 0.009241f, 0.026758f, 0.021550f, 0.006760f, -0.002714f, -0.003226f, -0.001042f, -0.003587f, -0.010448f, -0.012400f, -0.004412f, 0.003334f, -0.000949f, -0.008792f, -0.000811f, 0.021391f, 0.032702f, 0.018298f, -0.008520f, -0.026675f, -0.027695f, -0.012546f, 0.012599f, 0.032061f, 0.029080f, 0.005011f, -0.020727f, -0.031063f, -0.022444f, -0.000380f, 0.023163f, 0.031978f, 0.018604f, -0.006009f, -0.023546f, -0.024911f, -0.011571f, 0.009700f, 0.026389f, 0.024980f, 0.005203f, -0.016979f, -0.025820f, -0.018578f, -0.000957f, 0.018776f, 0.028298f, 0.017328f, -0.007337f, -0.023219f, -0.017507f, -0.003770f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.039501f, -0.014112f, 0.001447f, -0.004068f, -0.002193f, 0.017003f, 0.016961f, -0.019323f, -0.036823f, 0.021491f, 0.117651f, 0.152439f, 0.080915f, -0.057964f, -0.197903f, -0.267563f, -0.196424f, 0.006805f, 0.198191f, 0.218189f, 0.071960f, -0.084962f, -0.134768f, -0.095081f, -0.038550f, -0.000622f, 0.019901f, 0.031601f, 0.039778f, 0.036120f, 0.005867f, -0.036701f, -0.050091f, -0.024227f, 0.002850f, 0.007342f, 0.008506f, 0.013304f, -0.007849f, -0.058824f, -0.088248f, -0.057546f, 0.008154f, 0.063020f, 0.087248f, 0.071046f, 0.006013f, -0.078526f, + -0.115136f, -0.066163f, 0.033001f, 0.112445f, 0.123994f, 0.056966f, -0.062296f, -0.168672f, -0.186057f, -0.087154f, 0.072786f, 0.188814f, 0.179448f, 0.045191f, -0.125509f, -0.210510f, -0.140347f, 0.041516f, 0.198222f, 0.201089f, 0.041516f, -0.151201f, -0.219459f, -0.115877f, 0.065868f, 0.185618f, 0.167548f, 0.036145f, -0.115485f, -0.184435f, -0.123726f, 0.019027f, 0.136484f, 0.150895f, 0.067063f, -0.056561f, -0.158565f, -0.186490f, -0.104501f, 0.059578f, 0.192628f, 0.183234f, 0.041682f, -0.112351f, -0.186900f, -0.184294f, -0.122920f, 0.015298f, 0.199251f, 0.287141f, 0.153272f, -0.137288f, -0.353586f, -0.306684f, -0.011627f, 0.324107f, 0.445307f, 0.241526f, -0.139115f, -0.396338f, -0.349188f, -0.086461f, 0.163750f, 0.253809f, 0.180660f, 0.020406f, -0.123393f, -0.158575f, -0.073683f, 0.044711f, 0.106214f, 0.102983f, 0.072845f, 0.022835f, -0.057935f, -0.136913f, -0.146360f, -0.057455f, 0.079377f, 0.171897f, 0.157908f, 0.050169f, -0.077326f, -0.147247f, -0.129855f, -0.050052f, 0.038481f, 0.084909f, 0.066918f, 0.001823f, -0.064539f, -0.081818f, -0.022719f, 0.085073f, 0.151892f, 0.091934f, + -0.075335f, -0.215637f, -0.203705f, -0.046330f, 0.131739f, 0.203050f, 0.127188f, -0.038046f, -0.180410f, -0.204110f, -0.093600f, 0.076439f, 0.192839f, 0.175971f, 0.031978f, -0.141483f, -0.217916f, -0.142897f, 0.020988f, 0.153950f, 0.174858f, 0.084624f, -0.048874f, -0.132889f, -0.108840f, 0.000034f, 0.105166f, 0.127191f, 0.053918f, -0.061650f, -0.141006f, -0.129950f, -0.037851f, 0.070020f, 0.129452f, 0.119294f, 0.049896f, -0.054182f, -0.143336f, -0.153402f, -0.063283f, 0.071070f, 0.159936f, 0.148673f, 0.046307f, -0.084099f, -0.157546f, -0.123720f, -0.012279f, 0.090418f, 0.116318f, 0.062861f, -0.020579f, -0.074279f, -0.067225f, -0.017196f, 0.028481f, 0.039062f, 0.020496f, -0.006691f, -0.027778f, -0.031293f, -0.012037f, 0.016213f, 0.029948f, 0.021218f, 0.000256f, -0.021030f, -0.032573f, -0.023971f, 0.002489f, 0.025708f, 0.027527f, 0.011059f, -0.010583f, -0.027981f, -0.031554f, -0.013988f, 0.015027f, 0.032866f, 0.027570f, 0.005362f, -0.020976f, -0.036955f, -0.029120f, -0.000144f, 0.027148f, 0.033176f, 0.018428f, -0.007250f, -0.032389f, -0.038803f, -0.015968f, 0.016179f, 0.027465f, 0.020341f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.039501f, 0.014112f, -0.001447f, 0.004068f, 0.002193f, -0.017003f, -0.016961f, 0.019323f, 0.036823f, -0.021491f, -0.117651f, -0.152439f, -0.080915f, 0.057964f, 0.197903f, 0.267563f, 0.196424f, -0.006805f, -0.198191f, -0.218189f, -0.071960f, 0.084962f, 0.134768f, 0.095081f, 0.038550f, 0.000622f, -0.019901f, -0.031601f, -0.039778f, -0.036120f, -0.005867f, 0.036701f, 0.050091f, 0.024227f, -0.002850f, -0.007342f, -0.008506f, -0.013304f, 0.007849f, 0.058824f, 0.088248f, 0.057546f, -0.008154f, -0.063020f, -0.087248f, -0.071046f, -0.006013f, 0.078526f, + 0.115136f, 0.066163f, -0.033001f, -0.112445f, -0.123994f, -0.056966f, 0.062296f, 0.168672f, 0.186057f, 0.087154f, -0.072786f, -0.188814f, -0.179448f, -0.045191f, 0.125509f, 0.210510f, 0.140347f, -0.041516f, -0.198222f, -0.201089f, -0.041516f, 0.151201f, 0.219459f, 0.115877f, -0.065868f, -0.185618f, -0.167548f, -0.036145f, 0.115485f, 0.184435f, 0.123726f, -0.019027f, -0.136484f, -0.150895f, -0.067063f, 0.056561f, 0.158565f, 0.186490f, 0.104501f, -0.059578f, -0.192628f, -0.183234f, -0.041682f, 0.112351f, 0.186900f, 0.184294f, 0.122920f, -0.015298f, -0.199251f, -0.287141f, -0.153272f, 0.137288f, 0.353586f, 0.306684f, 0.011627f, -0.324107f, -0.445307f, -0.241526f, 0.139115f, 0.396338f, 0.349188f, 0.086461f, -0.163750f, -0.253809f, -0.180660f, -0.020406f, 0.123393f, 0.158575f, 0.073683f, -0.044711f, -0.106214f, -0.102983f, -0.072845f, -0.022835f, 0.057935f, 0.136913f, 0.146360f, 0.057455f, -0.079377f, -0.171897f, -0.157908f, -0.050169f, 0.077326f, 0.147247f, 0.129855f, 0.050052f, -0.038481f, -0.084909f, -0.066918f, -0.001823f, 0.064539f, 0.081818f, 0.022719f, -0.085073f, -0.151892f, -0.091934f, + 0.075335f, 0.215637f, 0.203705f, 0.046330f, -0.131739f, -0.203050f, -0.127188f, 0.038046f, 0.180410f, 0.204110f, 0.093600f, -0.076439f, -0.192839f, -0.175971f, -0.031978f, 0.141483f, 0.217916f, 0.142897f, -0.020988f, -0.153950f, -0.174858f, -0.084624f, 0.048874f, 0.132889f, 0.108840f, -0.000034f, -0.105166f, -0.127191f, -0.053918f, 0.061650f, 0.141006f, 0.129950f, 0.037851f, -0.070020f, -0.129452f, -0.119294f, -0.049896f, 0.054182f, 0.143336f, 0.153402f, 0.063283f, -0.071070f, -0.159936f, -0.148673f, -0.046307f, 0.084099f, 0.157546f, 0.123720f, 0.012279f, -0.090418f, -0.116318f, -0.062861f, 0.020579f, 0.074279f, 0.067225f, 0.017196f, -0.028481f, -0.039062f, -0.020496f, 0.006691f, 0.027778f, 0.031293f, 0.012037f, -0.016213f, -0.029948f, -0.021218f, -0.000256f, 0.021030f, 0.032573f, 0.023971f, -0.002489f, -0.025708f, -0.027527f, -0.011059f, 0.010583f, 0.027981f, 0.031554f, 0.013988f, -0.015027f, -0.032866f, -0.027570f, -0.005362f, 0.020976f, 0.036955f, 0.029120f, 0.000144f, -0.027148f, -0.033176f, -0.018428f, 0.007250f, 0.032389f, 0.038803f, 0.015968f, -0.016179f, -0.027465f, -0.020341f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.008028f, -0.030862f, 0.009676f, 0.085727f, 0.067804f, -0.036549f, -0.065052f, 0.024173f, 0.057366f, -0.086619f, -0.276767f, -0.304011f, -0.135711f, 0.094524f, 0.250640f, 0.264991f, 0.134484f, -0.063179f, -0.197592f, -0.192615f, -0.080410f, 0.061129f, 0.166518f, 0.174103f, 0.050098f, -0.135892f, -0.228483f, -0.136281f, 0.066498f, 0.216945f, 0.213088f, 0.075011f, -0.096953f, -0.193579f, -0.157912f, -0.018712f, 0.129326f, 0.191689f, 0.135575f, 0.004377f, -0.117880f, -0.165161f, -0.126401f, -0.031928f, 0.082130f, 0.179910f, 0.210960f, 0.130206f, + -0.046955f, -0.225684f, -0.288155f, -0.178546f, 0.052377f, 0.269483f, 0.330193f, 0.178996f, -0.101201f, -0.330484f, -0.351136f, -0.142531f, 0.156960f, 0.344793f, 0.297740f, 0.054499f, -0.218874f, -0.343145f, -0.239732f, 0.018281f, 0.250677f, 0.296501f, 0.135737f, -0.099830f, -0.237905f, -0.197605f, -0.036459f, 0.109878f, 0.141045f, 0.066798f, -0.024553f, -0.065247f, -0.054502f, -0.015417f, 0.037788f, 0.068681f, 0.021734f, -0.087606f, -0.138661f, -0.039928f, 0.127028f, 0.179171f, 0.050024f, -0.128351f, -0.174820f, -0.045040f, 0.140211f, 0.210276f, 0.081798f, -0.167710f, -0.335089f, -0.243401f, 0.083371f, 0.396693f, 0.422168f, 0.114520f, -0.291912f, -0.493282f, -0.364994f, -0.020577f, 0.307036f, 0.412269f, 0.227227f, -0.114617f, -0.344070f, -0.278235f, 0.002836f, 0.246027f, 0.281126f, 0.139970f, -0.041808f, -0.151538f, -0.137708f, -0.020886f, 0.103939f, 0.138466f, 0.078132f, -0.000601f, -0.044502f, -0.061313f, -0.059599f, -0.019148f, 0.059109f, 0.121678f, 0.108125f, 0.011409f, -0.111949f, -0.178258f, -0.131807f, 0.011996f, 0.169925f, 0.240250f, 0.160701f, -0.045311f, -0.250229f, -0.286542f, + -0.097101f, 0.176472f, 0.308886f, 0.205740f, -0.027821f, -0.215339f, -0.251699f, -0.134775f, 0.059793f, 0.206504f, 0.196671f, 0.032547f, -0.157208f, -0.222642f, -0.116422f, 0.077432f, 0.215840f, 0.201364f, 0.048775f, -0.130251f, -0.213974f, -0.156757f, -0.006668f, 0.140419f, 0.199403f, 0.137146f, -0.009715f, -0.151536f, -0.199631f, -0.124755f, 0.024925f, 0.157980f, 0.197323f, 0.123194f, -0.019172f, -0.146052f, -0.181487f, -0.102240f, 0.043681f, 0.162951f, 0.177073f, 0.076212f, -0.072710f, -0.169936f, -0.150541f, -0.031056f, 0.101747f, 0.156659f, 0.105170f, -0.006275f, -0.099771f, -0.119755f, -0.061949f, 0.028726f, 0.088684f, 0.081352f, 0.022618f, -0.038960f, -0.064358f, -0.046128f, -0.001808f, 0.040523f, 0.055097f, 0.032754f, -0.011323f, -0.047621f, -0.052791f, -0.023796f, 0.020890f, 0.051770f, 0.047433f, 0.010778f, -0.032767f, -0.054259f, -0.040478f, -0.000817f, 0.038929f, 0.052589f, 0.031619f, -0.008902f, -0.042108f, -0.047606f, -0.022448f, 0.017823f, 0.047050f, 0.044986f, 0.012971f, -0.026626f, -0.047751f, -0.037995f, -0.003843f, 0.033852f, 0.050276f, 0.032277f, -0.009018f, -0.042975f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.008028f, 0.030862f, -0.009676f, -0.085727f, -0.067804f, 0.036549f, 0.065052f, -0.024173f, -0.057366f, 0.086619f, 0.276767f, 0.304011f, 0.135711f, -0.094524f, -0.250640f, -0.264991f, -0.134484f, 0.063179f, 0.197592f, 0.192615f, 0.080410f, -0.061129f, -0.166518f, -0.174103f, -0.050098f, 0.135892f, 0.228483f, 0.136281f, -0.066498f, -0.216945f, -0.213088f, -0.075011f, 0.096953f, 0.193579f, 0.157912f, 0.018712f, -0.129326f, -0.191689f, -0.135575f, -0.004377f, 0.117880f, 0.165161f, 0.126401f, 0.031928f, -0.082130f, -0.179910f, -0.210960f, -0.130206f, + 0.046955f, 0.225684f, 0.288155f, 0.178546f, -0.052377f, -0.269483f, -0.330193f, -0.178996f, 0.101201f, 0.330484f, 0.351136f, 0.142531f, -0.156960f, -0.344793f, -0.297740f, -0.054499f, 0.218874f, 0.343145f, 0.239732f, -0.018281f, -0.250677f, -0.296501f, -0.135737f, 0.099830f, 0.237905f, 0.197605f, 0.036459f, -0.109878f, -0.141045f, -0.066798f, 0.024553f, 0.065247f, 0.054502f, 0.015417f, -0.037788f, -0.068681f, -0.021734f, 0.087606f, 0.138661f, 0.039928f, -0.127028f, -0.179171f, -0.050024f, 0.128351f, 0.174820f, 0.045040f, -0.140211f, -0.210276f, -0.081798f, 0.167710f, 0.335089f, 0.243401f, -0.083371f, -0.396693f, -0.422168f, -0.114520f, 0.291912f, 0.493282f, 0.364994f, 0.020577f, -0.307036f, -0.412269f, -0.227227f, 0.114617f, 0.344070f, 0.278235f, -0.002836f, -0.246027f, -0.281126f, -0.139970f, 0.041808f, 0.151538f, 0.137708f, 0.020886f, -0.103939f, -0.138466f, -0.078132f, 0.000601f, 0.044502f, 0.061313f, 0.059599f, 0.019148f, -0.059109f, -0.121678f, -0.108125f, -0.011409f, 0.111949f, 0.178258f, 0.131807f, -0.011996f, -0.169925f, -0.240250f, -0.160701f, 0.045311f, 0.250229f, 0.286542f, + 0.097101f, -0.176472f, -0.308886f, -0.205740f, 0.027821f, 0.215339f, 0.251699f, 0.134775f, -0.059793f, -0.206504f, -0.196671f, -0.032547f, 0.157208f, 0.222642f, 0.116422f, -0.077432f, -0.215840f, -0.201364f, -0.048775f, 0.130251f, 0.213974f, 0.156757f, 0.006668f, -0.140419f, -0.199403f, -0.137146f, 0.009715f, 0.151536f, 0.199631f, 0.124755f, -0.024925f, -0.157980f, -0.197323f, -0.123194f, 0.019172f, 0.146052f, 0.181487f, 0.102240f, -0.043681f, -0.162951f, -0.177073f, -0.076212f, 0.072710f, 0.169936f, 0.150541f, 0.031056f, -0.101747f, -0.156659f, -0.105170f, 0.006275f, 0.099771f, 0.119755f, 0.061949f, -0.028726f, -0.088684f, -0.081352f, -0.022618f, 0.038960f, 0.064358f, 0.046128f, 0.001808f, -0.040523f, -0.055097f, -0.032754f, 0.011323f, 0.047621f, 0.052791f, 0.023796f, -0.020890f, -0.051770f, -0.047433f, -0.010778f, 0.032767f, 0.054259f, 0.040478f, 0.000817f, -0.038929f, -0.052589f, -0.031619f, 0.008902f, 0.042108f, 0.047606f, 0.022448f, -0.017823f, -0.047050f, -0.044986f, -0.012971f, 0.026626f, 0.047751f, 0.037995f, 0.003843f, -0.033852f, -0.050276f, -0.032277f, 0.009018f, 0.042975f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.021683f, 0.054940f, 0.082635f, 0.058825f, -0.010914f, -0.057174f, -0.032626f, 0.010089f, -0.014535f, -0.091370f, -0.113146f, -0.033086f, 0.065717f, 0.084827f, 0.031624f, -0.016134f, -0.016922f, 0.012844f, 0.049403f, 0.080502f, 0.085212f, 0.038538f, -0.055079f, -0.149205f, -0.182095f, -0.120155f, 0.011525f, 0.139266f, 0.192799f, 0.151271f, 0.041674f, -0.085172f, -0.165918f, -0.148310f, -0.042381f, 0.069406f, 0.108606f, 0.074496f, 0.016402f, -0.036597f, -0.076304f, -0.077498f, -0.022023f, 0.049474f, 0.069347f, 0.028950f, -0.015032f, -0.020709f, + -0.001272f, 0.015228f, 0.018319f, 0.001956f, -0.034453f, -0.061733f, -0.041166f, 0.016566f, 0.051205f, 0.027793f, -0.022026f, -0.047771f, -0.035099f, 0.000993f, 0.038979f, 0.045437f, -0.011300f, -0.104559f, -0.137665f, -0.039097f, 0.136194f, 0.238802f, 0.165681f, -0.043820f, -0.240751f, -0.278703f, -0.119215f, 0.130516f, 0.284675f, 0.223457f, -0.002635f, -0.213283f, -0.248434f, -0.091713f, 0.125377f, 0.227818f, 0.134514f, -0.071631f, -0.210450f, -0.162154f, 0.030756f, 0.209743f, 0.234553f, 0.083994f, -0.134806f, -0.259955f, -0.192614f, 0.018153f, 0.206423f, 0.225228f, 0.067808f, -0.131372f, -0.209868f, -0.111043f, 0.068780f, 0.167506f, 0.107736f, -0.036527f, -0.121143f, -0.067943f, 0.070883f, 0.154040f, 0.066224f, -0.155722f, -0.307983f, -0.198877f, 0.125923f, 0.390847f, 0.358489f, 0.053036f, -0.292363f, -0.444287f, -0.309274f, 0.032588f, 0.358022f, 0.429018f, 0.188971f, -0.167310f, -0.360823f, -0.264807f, 0.020949f, 0.275594f, 0.312499f, 0.096657f, -0.222027f, -0.405371f, -0.308466f, 0.007916f, 0.328137f, 0.432777f, 0.239282f, -0.133912f, -0.427765f, -0.426709f, -0.134561f, 0.228496f, + 0.408846f, 0.306423f, 0.020734f, -0.241910f, -0.315888f, -0.182754f, 0.037638f, 0.196803f, 0.216999f, 0.105679f, -0.071229f, -0.207442f, -0.201636f, -0.043702f, 0.152359f, 0.236945f, 0.149666f, -0.044532f, -0.214527f, -0.246695f, -0.112995f, 0.101451f, 0.249590f, 0.231984f, 0.065546f, -0.144776f, -0.278601f, -0.254879f, -0.070771f, 0.177518f, 0.336176f, 0.296735f, 0.075890f, -0.196068f, -0.356830f, -0.305258f, -0.065265f, 0.216496f, 0.358725f, 0.269230f, 0.008260f, -0.254334f, -0.350027f, -0.219676f, 0.044907f, 0.262219f, 0.292149f, 0.133224f, -0.092006f, -0.234847f, -0.215241f, -0.061114f, 0.115598f, 0.195040f, 0.133980f, -0.008953f, -0.128279f, -0.150709f, -0.074105f, 0.043715f, 0.124656f, 0.118470f, 0.034003f, -0.070298f, -0.127627f, -0.102482f, -0.009763f, 0.090830f, 0.130463f, 0.081835f, -0.019824f, -0.106564f, -0.124745f, -0.062615f, 0.042922f, 0.121320f, 0.115451f, 0.030731f, -0.070082f, -0.121739f, -0.097242f, -0.011124f, 0.086490f, 0.127804f, 0.078358f, -0.023953f, -0.103506f, -0.114839f, -0.059055f, 0.036969f, 0.119235f, 0.118976f, 0.025621f, -0.074930f, -0.096547f, -0.065130f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.021683f, 0.054940f, 0.082635f, 0.058825f, -0.010914f, -0.057174f, -0.032626f, 0.010089f, -0.014535f, -0.091370f, -0.113146f, -0.033086f, 0.065717f, 0.084827f, 0.031624f, -0.016134f, -0.016922f, 0.012844f, 0.049403f, 0.080502f, 0.085212f, 0.038538f, -0.055079f, -0.149205f, -0.182095f, -0.120155f, 0.011525f, 0.139266f, 0.192799f, 0.151271f, 0.041674f, -0.085172f, -0.165918f, -0.148310f, -0.042381f, 0.069406f, 0.108606f, 0.074496f, 0.016402f, -0.036597f, -0.076304f, -0.077498f, -0.022023f, 0.049474f, 0.069347f, 0.028950f, -0.015032f, -0.020709f, + -0.001272f, 0.015228f, 0.018319f, 0.001956f, -0.034453f, -0.061733f, -0.041166f, 0.016566f, 0.051205f, 0.027793f, -0.022026f, -0.047771f, -0.035099f, 0.000993f, 0.038979f, 0.045437f, -0.011300f, -0.104559f, -0.137665f, -0.039097f, 0.136194f, 0.238802f, 0.165681f, -0.043820f, -0.240751f, -0.278703f, -0.119215f, 0.130516f, 0.284675f, 0.223457f, -0.002635f, -0.213283f, -0.248434f, -0.091713f, 0.125377f, 0.227818f, 0.134514f, -0.071631f, -0.210450f, -0.162154f, 0.030756f, 0.209743f, 0.234553f, 0.083994f, -0.134806f, -0.259955f, -0.192614f, 0.018153f, 0.206423f, 0.225228f, 0.067808f, -0.131372f, -0.209868f, -0.111043f, 0.068780f, 0.167506f, 0.107736f, -0.036527f, -0.121143f, -0.067943f, 0.070883f, 0.154040f, 0.066224f, -0.155722f, -0.307983f, -0.198877f, 0.125923f, 0.390847f, 0.358489f, 0.053036f, -0.292363f, -0.444287f, -0.309274f, 0.032588f, 0.358022f, 0.429018f, 0.188971f, -0.167310f, -0.360823f, -0.264807f, 0.020949f, 0.275594f, 0.312499f, 0.096657f, -0.222027f, -0.405371f, -0.308466f, 0.007916f, 0.328137f, 0.432777f, 0.239282f, -0.133912f, -0.427765f, -0.426709f, -0.134561f, 0.228496f, + 0.408846f, 0.306423f, 0.020734f, -0.241910f, -0.315888f, -0.182754f, 0.037638f, 0.196803f, 0.216999f, 0.105679f, -0.071229f, -0.207442f, -0.201636f, -0.043702f, 0.152359f, 0.236945f, 0.149666f, -0.044532f, -0.214527f, -0.246695f, -0.112995f, 0.101451f, 0.249590f, 0.231984f, 0.065546f, -0.144776f, -0.278601f, -0.254879f, -0.070771f, 0.177518f, 0.336176f, 0.296735f, 0.075890f, -0.196068f, -0.356830f, -0.305258f, -0.065265f, 0.216496f, 0.358725f, 0.269230f, 0.008260f, -0.254334f, -0.350027f, -0.219676f, 0.044907f, 0.262219f, 0.292149f, 0.133224f, -0.092006f, -0.234847f, -0.215241f, -0.061114f, 0.115598f, 0.195040f, 0.133980f, -0.008953f, -0.128279f, -0.150709f, -0.074105f, 0.043715f, 0.124656f, 0.118470f, 0.034003f, -0.070298f, -0.127627f, -0.102482f, -0.009763f, 0.090830f, 0.130463f, 0.081835f, -0.019824f, -0.106564f, -0.124745f, -0.062615f, 0.042922f, 0.121320f, 0.115451f, 0.030731f, -0.070082f, -0.121739f, -0.097242f, -0.011124f, 0.086490f, 0.127804f, 0.078358f, -0.023953f, -0.103506f, -0.114839f, -0.059055f, 0.036969f, 0.119235f, 0.118976f, 0.025621f, -0.074930f, -0.096547f, -0.065130f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.007730f, 0.080171f, 0.096212f, 0.007453f, -0.088714f, -0.103934f, -0.054681f, 0.002742f, 0.030848f, 0.014234f, -0.015074f, 0.008277f, 0.076124f, 0.084684f, -0.006643f, -0.087253f, -0.055716f, 0.028293f, 0.051440f, 0.015024f, -0.006997f, 0.000005f, 0.001138f, -0.005280f, 0.001081f, 0.011824f, 0.010214f, 0.004305f, 0.001002f, -0.013290f, -0.037908f, -0.040559f, 0.001925f, 0.068256f, 0.107980f, 0.080616f, -0.011535f, -0.115216f, -0.161664f, -0.120497f, -0.015099f, 0.100268f, 0.160754f, 0.118872f, -0.004851f, -0.116017f, -0.131302f, -0.058630f, + 0.030118f, 0.078435f, 0.072718f, 0.028224f, -0.018292f, -0.029877f, -0.009849f, 0.001907f, -0.014831f, -0.036002f, -0.031315f, 0.001084f, 0.039750f, 0.056956f, 0.037594f, -0.000311f, -0.019439f, -0.010404f, 0.000519f, -0.001390f, -0.002178f, 0.003140f, 0.001182f, -0.003468f, 0.008642f, 0.024970f, 0.008761f, -0.035265f, -0.049325f, 0.007759f, 0.105746f, 0.161266f, 0.101696f, -0.065274f, -0.229396f, -0.257187f, -0.116632f, 0.094802f, 0.240451f, 0.230976f, 0.055049f, -0.196422f, -0.345277f, -0.256628f, 0.016416f, 0.266014f, 0.317287f, 0.159061f, -0.078991f, -0.230896f, -0.207273f, -0.058329f, 0.084873f, 0.143963f, 0.134948f, 0.090702f, 0.018696f, -0.063674f, -0.131507f, -0.180017f, -0.169874f, -0.003485f, 0.301468f, 0.472723f, 0.233945f, -0.287593f, -0.609607f, -0.417999f, 0.108829f, 0.537724f, 0.584882f, 0.248123f, -0.267570f, -0.641654f, -0.595451f, -0.122917f, 0.443556f, 0.677568f, 0.404806f, -0.160655f, -0.583438f, -0.539967f, -0.074916f, 0.431112f, 0.577305f, 0.268166f, -0.234307f, -0.542556f, -0.439331f, -0.021035f, 0.391348f, 0.500851f, 0.252348f, -0.150940f, -0.422825f, -0.397069f, + -0.116897f, 0.215040f, 0.378326f, 0.281929f, 0.016840f, -0.223517f, -0.285299f, -0.150921f, 0.064824f, 0.205529f, 0.186203f, 0.043905f, -0.108352f, -0.170014f, -0.110406f, 0.022238f, 0.130189f, 0.132527f, 0.032663f, -0.083919f, -0.128764f, -0.080520f, 0.017578f, 0.102451f, 0.126707f, 0.076735f, -0.023238f, -0.125560f, -0.179340f, -0.143762f, -0.011073f, 0.161503f, 0.263606f, 0.211305f, 0.023466f, -0.185632f, -0.284776f, -0.207866f, 0.002690f, 0.212376f, 0.279937f, 0.162514f, -0.052390f, -0.218160f, -0.233791f, -0.101898f, 0.082246f, 0.195628f, 0.171554f, 0.043387f, -0.090829f, -0.147029f, -0.105515f, -0.006855f, 0.082753f, 0.110922f, 0.067512f, -0.013413f, -0.078810f, -0.088794f, -0.038068f, 0.039653f, 0.090800f, 0.079988f, 0.016480f, -0.055921f, -0.091303f, -0.067670f, 0.001573f, 0.071708f, 0.093890f, 0.052725f, -0.021866f, -0.080145f, -0.086437f, -0.036745f, 0.038979f, 0.090792f, 0.082215f, 0.019655f, -0.053772f, -0.091807f, -0.071804f, -0.004177f, 0.069176f, 0.096481f, 0.056860f, -0.019434f, -0.079180f, -0.088307f, -0.043982f, 0.031667f, 0.092295f, 0.086506f, 0.010669f, -0.066537f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.007730f, 0.080171f, 0.096212f, 0.007453f, -0.088714f, -0.103934f, -0.054681f, 0.002742f, 0.030848f, 0.014234f, -0.015074f, 0.008277f, 0.076124f, 0.084684f, -0.006643f, -0.087253f, -0.055716f, 0.028293f, 0.051440f, 0.015024f, -0.006997f, 0.000005f, 0.001138f, -0.005280f, 0.001081f, 0.011824f, 0.010214f, 0.004305f, 0.001002f, -0.013290f, -0.037908f, -0.040559f, 0.001925f, 0.068256f, 0.107980f, 0.080616f, -0.011535f, -0.115216f, -0.161664f, -0.120497f, -0.015099f, 0.100268f, 0.160754f, 0.118872f, -0.004851f, -0.116017f, -0.131302f, -0.058630f, + 0.030118f, 0.078435f, 0.072718f, 0.028224f, -0.018292f, -0.029877f, -0.009849f, 0.001907f, -0.014831f, -0.036002f, -0.031315f, 0.001084f, 0.039750f, 0.056956f, 0.037594f, -0.000311f, -0.019439f, -0.010404f, 0.000519f, -0.001390f, -0.002178f, 0.003140f, 0.001182f, -0.003468f, 0.008642f, 0.024970f, 0.008761f, -0.035265f, -0.049325f, 0.007759f, 0.105746f, 0.161266f, 0.101696f, -0.065274f, -0.229396f, -0.257187f, -0.116632f, 0.094802f, 0.240451f, 0.230976f, 0.055049f, -0.196422f, -0.345277f, -0.256628f, 0.016416f, 0.266014f, 0.317287f, 0.159061f, -0.078991f, -0.230896f, -0.207273f, -0.058329f, 0.084873f, 0.143963f, 0.134948f, 0.090702f, 0.018696f, -0.063674f, -0.131507f, -0.180017f, -0.169874f, -0.003485f, 0.301468f, 0.472723f, 0.233945f, -0.287593f, -0.609607f, -0.417999f, 0.108829f, 0.537724f, 0.584882f, 0.248123f, -0.267570f, -0.641654f, -0.595451f, -0.122917f, 0.443556f, 0.677568f, 0.404806f, -0.160655f, -0.583438f, -0.539967f, -0.074916f, 0.431112f, 0.577305f, 0.268166f, -0.234307f, -0.542556f, -0.439331f, -0.021035f, 0.391348f, 0.500851f, 0.252348f, -0.150940f, -0.422825f, -0.397069f, + -0.116897f, 0.215040f, 0.378326f, 0.281929f, 0.016840f, -0.223517f, -0.285299f, -0.150921f, 0.064824f, 0.205529f, 0.186203f, 0.043905f, -0.108352f, -0.170014f, -0.110406f, 0.022238f, 0.130189f, 0.132527f, 0.032663f, -0.083919f, -0.128764f, -0.080520f, 0.017578f, 0.102451f, 0.126707f, 0.076735f, -0.023238f, -0.125560f, -0.179340f, -0.143762f, -0.011073f, 0.161503f, 0.263606f, 0.211305f, 0.023466f, -0.185632f, -0.284776f, -0.207866f, 0.002690f, 0.212376f, 0.279937f, 0.162514f, -0.052390f, -0.218160f, -0.233791f, -0.101898f, 0.082246f, 0.195628f, 0.171554f, 0.043387f, -0.090829f, -0.147029f, -0.105515f, -0.006855f, 0.082753f, 0.110922f, 0.067512f, -0.013413f, -0.078810f, -0.088794f, -0.038068f, 0.039653f, 0.090800f, 0.079988f, 0.016480f, -0.055921f, -0.091303f, -0.067670f, 0.001573f, 0.071708f, 0.093890f, 0.052725f, -0.021866f, -0.080145f, -0.086437f, -0.036745f, 0.038979f, 0.090792f, 0.082215f, 0.019655f, -0.053772f, -0.091807f, -0.071804f, -0.004177f, 0.069176f, 0.096481f, 0.056860f, -0.019434f, -0.079180f, -0.088307f, -0.043982f, 0.031667f, 0.092295f, 0.086506f, 0.010669f, -0.066537f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000327f, 0.001149f, -0.001510f, -0.008875f, -0.013050f, -0.005400f, 0.006851f, 0.005697f, -0.004945f, 0.013396f, 0.085505f, 0.158040f, 0.116276f, -0.095826f, -0.368269f, -0.475353f, -0.275082f, 0.133924f, 0.471111f, 0.499817f, 0.208594f, -0.193243f, -0.433758f, -0.369791f, -0.086437f, 0.181035f, 0.254309f, 0.148962f, 0.004731f, -0.076945f, -0.088131f, -0.056202f, -0.006669f, 0.027204f, 0.022895f, 0.000684f, -0.004473f, 0.005340f, 0.005248f, -0.004123f, -0.004397f, 0.001279f, -0.002808f, -0.011437f, -0.009031f, 0.000818f, 0.005239f, 0.005567f, + 0.007356f, 0.003631f, -0.012304f, -0.031082f, -0.036115f, -0.017571f, 0.021401f, 0.057430f, 0.054753f, 0.001687f, -0.067438f, -0.102302f, -0.078150f, -0.003504f, 0.083909f, 0.119950f, 0.056626f, -0.069752f, -0.145224f, -0.085262f, 0.075195f, 0.205974f, 0.184298f, -0.005876f, -0.234742f, -0.301243f, -0.108422f, 0.217492f, 0.414957f, 0.308768f, -0.049415f, -0.417879f, -0.518794f, -0.228948f, 0.288208f, 0.651212f, 0.551072f, 0.028210f, -0.539480f, -0.733233f, -0.410640f, 0.197876f, 0.660132f, 0.652053f, 0.188796f, -0.392887f, -0.683422f, -0.489760f, 0.034198f, 0.499410f, 0.570852f, 0.227312f, -0.236280f, -0.475140f, -0.367411f, -0.047930f, 0.256088f, 0.380255f, 0.276559f, 0.013879f, -0.247742f, -0.337521f, -0.190860f, 0.087123f, 0.285518f, 0.252854f, 0.030399f, -0.182966f, -0.214837f, -0.064549f, 0.131073f, 0.236061f, 0.195218f, 0.026904f, -0.190215f, -0.324567f, -0.259257f, -0.006849f, 0.256257f, 0.316266f, 0.112512f, -0.196917f, -0.367722f, -0.271179f, 0.020084f, 0.306344f, 0.398206f, 0.228598f, -0.096095f, -0.350105f, -0.354227f, -0.122532f, 0.165257f, 0.324178f, 0.274840f, 0.046578f, + -0.239456f, -0.396293f, -0.283542f, 0.049290f, 0.369058f, 0.444192f, 0.222903f, -0.144721f, -0.413398f, -0.395543f, -0.096478f, 0.265150f, 0.416012f, 0.252095f, -0.084706f, -0.339563f, -0.343637f, -0.116710f, 0.170605f, 0.325909f, 0.265454f, 0.055553f, -0.156549f, -0.250492f, -0.195198f, -0.044902f, 0.107435f, 0.187442f, 0.171465f, 0.077636f, -0.054117f, -0.164682f, -0.186936f, -0.092831f, 0.066541f, 0.187819f, 0.191041f, 0.073321f, -0.092553f, -0.200977f, -0.178052f, -0.036462f, 0.126972f, 0.200887f, 0.139288f, -0.011540f, -0.149039f, -0.183038f, -0.096673f, 0.042475f, 0.136055f, 0.129793f, 0.044094f, -0.054773f, -0.104572f, -0.082108f, -0.011804f, 0.054461f, 0.075419f, 0.046094f, -0.008119f, -0.053533f, -0.064440f, -0.033454f, 0.021056f, 0.062458f, 0.061831f, 0.020243f, -0.033654f, -0.064888f, -0.053746f, -0.007058f, 0.045056f, 0.067772f, 0.045297f, -0.007897f, -0.056502f, -0.067208f, -0.031054f, 0.028539f, 0.070332f, 0.064933f, 0.016397f, -0.041962f, -0.071918f, -0.054754f, -0.001494f, 0.053749f, 0.074108f, 0.044716f, -0.014964f, -0.063856f, -0.069271f, -0.029502f, 0.028269f, 0.068611f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000327f, 0.001149f, -0.001510f, -0.008875f, -0.013050f, -0.005400f, 0.006851f, 0.005697f, -0.004945f, 0.013396f, 0.085505f, 0.158040f, 0.116276f, -0.095826f, -0.368269f, -0.475353f, -0.275082f, 0.133924f, 0.471111f, 0.499817f, 0.208594f, -0.193243f, -0.433758f, -0.369791f, -0.086437f, 0.181035f, 0.254309f, 0.148962f, 0.004731f, -0.076945f, -0.088131f, -0.056202f, -0.006669f, 0.027204f, 0.022895f, 0.000684f, -0.004473f, 0.005340f, 0.005248f, -0.004123f, -0.004397f, 0.001279f, -0.002808f, -0.011437f, -0.009031f, 0.000818f, 0.005239f, 0.005567f, + 0.007356f, 0.003631f, -0.012304f, -0.031082f, -0.036115f, -0.017571f, 0.021401f, 0.057430f, 0.054753f, 0.001687f, -0.067438f, -0.102302f, -0.078150f, -0.003504f, 0.083909f, 0.119950f, 0.056626f, -0.069752f, -0.145224f, -0.085262f, 0.075195f, 0.205974f, 0.184298f, -0.005876f, -0.234742f, -0.301243f, -0.108422f, 0.217492f, 0.414957f, 0.308768f, -0.049415f, -0.417879f, -0.518794f, -0.228948f, 0.288208f, 0.651212f, 0.551072f, 0.028210f, -0.539480f, -0.733233f, -0.410640f, 0.197876f, 0.660132f, 0.652053f, 0.188796f, -0.392887f, -0.683422f, -0.489760f, 0.034198f, 0.499410f, 0.570852f, 0.227312f, -0.236280f, -0.475140f, -0.367411f, -0.047930f, 0.256088f, 0.380255f, 0.276559f, 0.013879f, -0.247742f, -0.337521f, -0.190860f, 0.087123f, 0.285518f, 0.252854f, 0.030399f, -0.182966f, -0.214837f, -0.064549f, 0.131073f, 0.236061f, 0.195218f, 0.026904f, -0.190215f, -0.324567f, -0.259257f, -0.006849f, 0.256257f, 0.316266f, 0.112512f, -0.196917f, -0.367722f, -0.271179f, 0.020084f, 0.306344f, 0.398206f, 0.228598f, -0.096095f, -0.350105f, -0.354227f, -0.122532f, 0.165257f, 0.324178f, 0.274840f, 0.046578f, + -0.239456f, -0.396293f, -0.283542f, 0.049290f, 0.369058f, 0.444192f, 0.222903f, -0.144721f, -0.413398f, -0.395543f, -0.096478f, 0.265150f, 0.416012f, 0.252095f, -0.084706f, -0.339563f, -0.343637f, -0.116710f, 0.170605f, 0.325909f, 0.265454f, 0.055553f, -0.156549f, -0.250492f, -0.195198f, -0.044902f, 0.107435f, 0.187442f, 0.171465f, 0.077636f, -0.054117f, -0.164682f, -0.186936f, -0.092831f, 0.066541f, 0.187819f, 0.191041f, 0.073321f, -0.092553f, -0.200977f, -0.178052f, -0.036462f, 0.126972f, 0.200887f, 0.139288f, -0.011540f, -0.149039f, -0.183038f, -0.096673f, 0.042475f, 0.136055f, 0.129793f, 0.044094f, -0.054773f, -0.104572f, -0.082108f, -0.011804f, 0.054461f, 0.075419f, 0.046094f, -0.008119f, -0.053533f, -0.064440f, -0.033454f, 0.021056f, 0.062458f, 0.061831f, 0.020243f, -0.033654f, -0.064888f, -0.053746f, -0.007058f, 0.045056f, 0.067772f, 0.045297f, -0.007897f, -0.056502f, -0.067208f, -0.031054f, 0.028539f, 0.070332f, 0.064933f, 0.016397f, -0.041962f, -0.071918f, -0.054754f, -0.001494f, 0.053749f, 0.074108f, 0.044716f, -0.014964f, -0.063856f, -0.069271f, -0.029502f, 0.028269f, 0.068611f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.001650f, 0.002131f, 0.003699f, 0.018015f, 0.064242f, 0.107522f, 0.065963f, -0.078236f, -0.203752f, -0.155026f, 0.064936f, 0.260026f, 0.234380f, -0.002967f, -0.250633f, -0.311979f, -0.157413f, 0.085478f, 0.257232f, 0.272223f, 0.140708f, -0.061315f, -0.228038f, -0.264726f, -0.143246f, 0.065095f, 0.229598f, 0.252235f, 0.130190f, -0.055249f, -0.194660f, -0.209130f, -0.092916f, 0.077767f, 0.187969f, 0.161978f, 0.020904f, -0.129191f, -0.178216f, -0.099759f, 0.035834f, 0.134150f, 0.150589f, 0.093392f, -0.009029f, -0.111727f, -0.149504f, -0.079671f, + 0.062943f, 0.179178f, 0.183759f, 0.068962f, -0.093868f, -0.202376f, -0.189013f, -0.064375f, 0.095511f, 0.201131f, 0.192756f, 0.064788f, -0.117571f, -0.238342f, -0.209660f, -0.045638f, 0.148811f, 0.255428f, 0.212214f, 0.045870f, -0.139218f, -0.230328f, -0.190110f, -0.063400f, 0.086403f, 0.206773f, 0.236874f, 0.134580f, -0.053003f, -0.199533f, -0.207991f, -0.085018f, 0.084093f, 0.192625f, 0.163707f, 0.009347f, -0.156124f, -0.205377f, -0.106388f, 0.069188f, 0.211250f, 0.227524f, 0.096858f, -0.087808f, -0.179832f, -0.126268f, -0.013394f, 0.056779f, 0.072166f, 0.067684f, 0.052010f, 0.019026f, -0.023587f, -0.065843f, -0.090313f, -0.057207f, 0.042492f, 0.130492f, 0.116776f, 0.023056f, -0.049507f, -0.059530f, -0.042430f, -0.008607f, 0.064413f, 0.134721f, 0.101441f, -0.056342f, -0.220031f, -0.248484f, -0.115583f, 0.082044f, 0.217681f, 0.223750f, 0.119052f, -0.027425f, -0.148334f, -0.193692f, -0.131635f, 0.014790f, 0.139169f, 0.124891f, -0.023249f, -0.157548f, -0.132532f, 0.037638f, 0.186596f, 0.162099f, -0.020981f, -0.195876f, -0.206986f, -0.048555f, 0.149751f, 0.241249f, 0.160341f, -0.043053f, + -0.224330f, -0.237908f, -0.068032f, 0.142219f, 0.225595f, 0.141873f, -0.018455f, -0.139490f, -0.157916f, -0.079896f, 0.030819f, 0.099141f, 0.101601f, 0.069416f, 0.028122f, -0.024162f, -0.071551f, -0.069560f, -0.006459f, 0.066288f, 0.090654f, 0.058422f, -0.002056f, -0.058552f, -0.079821f, -0.046489f, 0.018498f, 0.056128f, 0.032249f, -0.020748f, -0.040541f, -0.006552f, 0.038588f, 0.039423f, -0.010205f, -0.062478f, -0.068389f, -0.023557f, 0.037460f, 0.074933f, 0.066418f, 0.015831f, -0.044252f, -0.070924f, -0.046419f, 0.007027f, 0.049879f, 0.056053f, 0.025677f, -0.016867f, -0.037888f, -0.022544f, 0.010005f, 0.028291f, 0.021051f, 0.000168f, -0.018491f, -0.024947f, -0.015302f, 0.004559f, 0.020326f, 0.021985f, 0.010917f, -0.005964f, -0.020179f, -0.021675f, -0.007047f, 0.012849f, 0.022995f, 0.018847f, 0.004745f, -0.012889f, -0.023429f, -0.016008f, 0.004955f, 0.020243f, 0.018933f, 0.008218f, -0.002898f, -0.012806f, -0.017203f, -0.008785f, 0.008116f, 0.018601f, 0.015784f, 0.005245f, -0.006941f, -0.016572f, -0.016100f, -0.002218f, 0.014465f, 0.019642f, 0.011677f, -0.000603f, -0.010363f, -0.015605f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.001650f, 0.002131f, 0.003699f, 0.018015f, 0.064242f, 0.107522f, 0.065963f, -0.078236f, -0.203752f, -0.155026f, 0.064936f, 0.260026f, 0.234380f, -0.002967f, -0.250633f, -0.311979f, -0.157413f, 0.085478f, 0.257232f, 0.272223f, 0.140708f, -0.061315f, -0.228038f, -0.264726f, -0.143246f, 0.065095f, 0.229598f, 0.252235f, 0.130190f, -0.055249f, -0.194660f, -0.209130f, -0.092916f, 0.077767f, 0.187969f, 0.161978f, 0.020904f, -0.129191f, -0.178216f, -0.099759f, 0.035834f, 0.134150f, 0.150589f, 0.093392f, -0.009029f, -0.111727f, -0.149504f, -0.079671f, + 0.062943f, 0.179178f, 0.183759f, 0.068962f, -0.093868f, -0.202376f, -0.189013f, -0.064375f, 0.095511f, 0.201131f, 0.192756f, 0.064788f, -0.117571f, -0.238342f, -0.209660f, -0.045638f, 0.148811f, 0.255428f, 0.212214f, 0.045870f, -0.139218f, -0.230328f, -0.190110f, -0.063400f, 0.086403f, 0.206773f, 0.236874f, 0.134580f, -0.053003f, -0.199533f, -0.207991f, -0.085018f, 0.084093f, 0.192625f, 0.163707f, 0.009347f, -0.156124f, -0.205377f, -0.106388f, 0.069188f, 0.211250f, 0.227524f, 0.096858f, -0.087808f, -0.179832f, -0.126268f, -0.013394f, 0.056779f, 0.072166f, 0.067684f, 0.052010f, 0.019026f, -0.023587f, -0.065843f, -0.090313f, -0.057207f, 0.042492f, 0.130492f, 0.116776f, 0.023056f, -0.049507f, -0.059530f, -0.042430f, -0.008607f, 0.064413f, 0.134721f, 0.101441f, -0.056342f, -0.220031f, -0.248484f, -0.115583f, 0.082044f, 0.217681f, 0.223750f, 0.119052f, -0.027425f, -0.148334f, -0.193692f, -0.131635f, 0.014790f, 0.139169f, 0.124891f, -0.023249f, -0.157548f, -0.132532f, 0.037638f, 0.186596f, 0.162099f, -0.020981f, -0.195876f, -0.206986f, -0.048555f, 0.149751f, 0.241249f, 0.160341f, -0.043053f, + -0.224330f, -0.237908f, -0.068032f, 0.142219f, 0.225595f, 0.141873f, -0.018455f, -0.139490f, -0.157916f, -0.079896f, 0.030819f, 0.099141f, 0.101601f, 0.069416f, 0.028122f, -0.024162f, -0.071551f, -0.069560f, -0.006459f, 0.066288f, 0.090654f, 0.058422f, -0.002056f, -0.058552f, -0.079821f, -0.046489f, 0.018498f, 0.056128f, 0.032249f, -0.020748f, -0.040541f, -0.006552f, 0.038588f, 0.039423f, -0.010205f, -0.062478f, -0.068389f, -0.023557f, 0.037460f, 0.074933f, 0.066418f, 0.015831f, -0.044252f, -0.070924f, -0.046419f, 0.007027f, 0.049879f, 0.056053f, 0.025677f, -0.016867f, -0.037888f, -0.022544f, 0.010005f, 0.028291f, 0.021051f, 0.000168f, -0.018491f, -0.024947f, -0.015302f, 0.004559f, 0.020326f, 0.021985f, 0.010917f, -0.005964f, -0.020179f, -0.021675f, -0.007047f, 0.012849f, 0.022995f, 0.018847f, 0.004745f, -0.012889f, -0.023429f, -0.016008f, 0.004955f, 0.020243f, 0.018933f, 0.008218f, -0.002898f, -0.012806f, -0.017203f, -0.008785f, 0.008116f, 0.018601f, 0.015784f, 0.005245f, -0.006941f, -0.016572f, -0.016100f, -0.002218f, 0.014465f, 0.019642f, 0.011677f, -0.000603f, -0.010363f, -0.015605f}, + }, +}; +const float CRendBin_HOA3_HRIR_coeff_im_48kHz[16][BINAURAL_CHANNELS][480]={ + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.406686f, -0.916311f, -0.776905f, -0.168581f, 0.425205f, 0.636435f, 0.425070f, -0.000162f, -0.365426f, -0.470135f, -0.270582f, 0.093760f, 0.379216f, 0.403051f, 0.166769f, -0.162981f, -0.377242f, -0.346050f, -0.084656f, 0.246068f, 0.424945f, 0.321416f, -0.000157f, -0.325238f, -0.441746f, -0.269420f, 0.100379f, 0.443247f, 0.517168f, 0.233068f, -0.243256f, -0.585745f, -0.546118f, -0.134042f, 0.390550f, 0.681408f, 0.524900f, -0.000279f, -0.546398f, -0.733229f, -0.430530f, 0.151091f, 0.622351f, 0.679724f, 0.290383f, -0.291535f, -0.682257f, -0.620194f, + -0.147926f, 0.416165f, 0.697774f, 0.516441f, -0.000268f, -0.505144f, -0.665457f, -0.386360f, 0.134719f, 0.552799f, 0.602178f, 0.256765f, -0.257473f, -0.602188f, -0.547277f, -0.130520f, 0.367287f, 0.616744f, 0.458260f, -0.000240f, -0.455862f, -0.606886f, -0.355227f, 0.124145f, 0.506306f, 0.543219f, 0.226411f, -0.220888f, -0.501728f, -0.442805f, -0.102577f, 0.280284f, 0.456710f, 0.329376f, -0.000167f, -0.312029f, -0.409981f, -0.239168f, 0.084076f, 0.347324f, 0.378898f, 0.160675f, -0.159243f, -0.366667f, -0.327615f, -0.076851f, 0.212953f, 0.352359f, 0.257910f, -0.000132f, -0.248100f, -0.324493f, -0.186869f, 0.064492f, 0.261192f, 0.280044f, 0.117225f, -0.115066f, -0.262397f, -0.231261f, -0.053171f, 0.143696f, 0.232159f, 0.167757f, -0.000086f, -0.167936f, -0.231537f, -0.141943f, 0.051975f, 0.220035f, 0.241196f, 0.100828f, -0.097017f, -0.214966f, -0.184722f, -0.042039f, 0.115059f, 0.192813f, 0.147047f, -0.000081f, -0.165647f, -0.240473f, -0.154700f, 0.059539f, 0.266465f, 0.311091f, 0.139394f, -0.144211f, -0.342827f, -0.313294f, -0.074584f, 0.208411f, 0.346070f, 0.253408f, -0.000131f, -0.244047f, + -0.321480f, -0.188153f, 0.066776f, 0.281749f, 0.318506f, 0.141893f, -0.149179f, -0.365865f, -0.347757f, -0.086339f, 0.251426f, 0.434248f, 0.330165f, -0.000178f, -0.341610f, -0.464530f, -0.278605f, 0.100096f, 0.420751f, 0.465842f, 0.200356f, -0.201556f, -0.471621f, -0.428504f, -0.102153f, 0.287094f, 0.480599f, 0.355219f, -0.000187f, -0.349083f, -0.463702f, -0.272361f, 0.096191f, 0.399467f, 0.439546f, 0.189040f, -0.191217f, -0.451686f, -0.415081f, -0.100038f, 0.283457f, 0.476139f, 0.350859f, -0.000183f, -0.334379f, -0.431096f, -0.243062f, 0.081439f, 0.317065f, 0.323507f, 0.127868f, -0.118102f, -0.253601f, -0.211037f, -0.045859f, 0.116639f, 0.175463f, 0.116291f, -0.000054f, -0.095171f, -0.119829f, -0.068604f, 0.024081f, 0.100131f, 0.110093f, 0.047012f, -0.046950f, -0.109319f, -0.099283f, -0.023776f, 0.067379f, 0.113890f, 0.084956f, -0.000044f, -0.084644f, -0.112954f, -0.066543f, 0.023524f, 0.097504f, 0.106778f, 0.045599f, -0.045737f, -0.107150f, -0.097777f, -0.023452f, 0.066392f, 0.111994f, 0.083487f, -0.000040f, -0.083740f, -0.112411f, -0.066569f, 0.023616f, 0.097929f, 0.107112f, 0.045681f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.406686f, -0.916311f, -0.776905f, -0.168581f, 0.425205f, 0.636435f, 0.425070f, -0.000162f, -0.365426f, -0.470135f, -0.270582f, 0.093760f, 0.379216f, 0.403051f, 0.166769f, -0.162981f, -0.377242f, -0.346050f, -0.084656f, 0.246068f, 0.424945f, 0.321416f, -0.000157f, -0.325238f, -0.441746f, -0.269420f, 0.100379f, 0.443247f, 0.517168f, 0.233068f, -0.243256f, -0.585745f, -0.546118f, -0.134042f, 0.390550f, 0.681408f, 0.524900f, -0.000279f, -0.546398f, -0.733229f, -0.430530f, 0.151091f, 0.622351f, 0.679724f, 0.290383f, -0.291535f, -0.682257f, -0.620194f, + -0.147926f, 0.416165f, 0.697774f, 0.516441f, -0.000268f, -0.505144f, -0.665457f, -0.386360f, 0.134719f, 0.552799f, 0.602178f, 0.256765f, -0.257473f, -0.602188f, -0.547277f, -0.130520f, 0.367287f, 0.616744f, 0.458260f, -0.000240f, -0.455862f, -0.606886f, -0.355227f, 0.124145f, 0.506306f, 0.543219f, 0.226411f, -0.220888f, -0.501728f, -0.442805f, -0.102577f, 0.280284f, 0.456710f, 0.329376f, -0.000167f, -0.312029f, -0.409981f, -0.239168f, 0.084076f, 0.347324f, 0.378898f, 0.160675f, -0.159243f, -0.366667f, -0.327615f, -0.076851f, 0.212953f, 0.352359f, 0.257910f, -0.000132f, -0.248100f, -0.324493f, -0.186869f, 0.064492f, 0.261192f, 0.280044f, 0.117225f, -0.115066f, -0.262397f, -0.231261f, -0.053171f, 0.143696f, 0.232159f, 0.167757f, -0.000086f, -0.167936f, -0.231537f, -0.141943f, 0.051975f, 0.220035f, 0.241196f, 0.100828f, -0.097017f, -0.214966f, -0.184722f, -0.042039f, 0.115059f, 0.192813f, 0.147047f, -0.000081f, -0.165647f, -0.240473f, -0.154700f, 0.059539f, 0.266465f, 0.311091f, 0.139394f, -0.144211f, -0.342827f, -0.313294f, -0.074584f, 0.208411f, 0.346070f, 0.253408f, -0.000131f, -0.244047f, + -0.321480f, -0.188153f, 0.066776f, 0.281749f, 0.318506f, 0.141893f, -0.149179f, -0.365865f, -0.347757f, -0.086339f, 0.251426f, 0.434248f, 0.330165f, -0.000178f, -0.341610f, -0.464530f, -0.278605f, 0.100096f, 0.420751f, 0.465842f, 0.200356f, -0.201556f, -0.471621f, -0.428504f, -0.102153f, 0.287094f, 0.480599f, 0.355219f, -0.000187f, -0.349083f, -0.463702f, -0.272361f, 0.096191f, 0.399467f, 0.439546f, 0.189040f, -0.191217f, -0.451686f, -0.415081f, -0.100038f, 0.283457f, 0.476139f, 0.350859f, -0.000183f, -0.334379f, -0.431096f, -0.243062f, 0.081439f, 0.317065f, 0.323507f, 0.127868f, -0.118102f, -0.253601f, -0.211037f, -0.045859f, 0.116639f, 0.175463f, 0.116291f, -0.000054f, -0.095171f, -0.119829f, -0.068604f, 0.024081f, 0.100131f, 0.110093f, 0.047012f, -0.046950f, -0.109319f, -0.099283f, -0.023776f, 0.067379f, 0.113890f, 0.084956f, -0.000044f, -0.084644f, -0.112954f, -0.066543f, 0.023524f, 0.097504f, 0.106778f, 0.045599f, -0.045737f, -0.107150f, -0.097777f, -0.023452f, 0.066392f, 0.111994f, 0.083487f, -0.000040f, -0.083740f, -0.112411f, -0.066569f, 0.023616f, 0.097929f, 0.107112f, 0.045681f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.087780f, 0.034783f, -0.413938f, -0.823797f, -0.543983f, 0.436677f, 1.233757f, 0.989475f, -0.095621f, -1.001639f, -1.035433f, -0.372840f, 0.409507f, 0.878895f, 0.826752f, 0.264744f, -0.476218f, -0.887350f, -0.687253f, -0.031724f, 0.653354f, 0.948834f, 0.650812f, -0.085492f, -0.784919f, -0.969321f, -0.514591f, 0.275871f, 0.892013f, 0.931647f, 0.355812f, -0.450648f, -0.926747f, -0.756894f, -0.104999f, 0.539320f, 0.740062f, 0.411148f, -0.160397f, -0.551542f, -0.509523f, -0.098904f, 0.377794f, 0.583713f, 0.362555f, -0.131700f, -0.518203f, -0.490341f, + -0.077566f, 0.394207f, 0.578087f, 0.346371f, -0.145178f, -0.554205f, -0.575106f, -0.175832f, 0.363020f, 0.668174f, 0.543344f, 0.072578f, -0.450557f, -0.690324f, -0.478483f, 0.051578f, 0.546468f, 0.685102f, 0.388291f, -0.149357f, -0.584151f, -0.635485f, -0.278158f, 0.238710f, 0.581877f, 0.561078f, 0.216561f, -0.234327f, -0.521286f, -0.478965f, -0.156980f, 0.226995f, 0.452148f, 0.413337f, 0.136988f, -0.233100f, -0.475182f, -0.414639f, -0.069623f, 0.340507f, 0.547074f, 0.409271f, 0.000863f, -0.425779f, -0.590205f, -0.373678f, 0.092797f, 0.512876f, 0.609849f, 0.299398f, -0.232658f, -0.622576f, -0.584180f, -0.137468f, 0.409303f, 0.698841f, 0.553336f, 0.050380f, -0.520212f, -0.787395f, -0.527778f, 0.121555f, 0.696400f, 0.748332f, 0.229190f, -0.448491f, -0.752721f, -0.469500f, 0.148243f, 0.616505f, 0.603205f, 0.153653f, -0.371906f, -0.577748f, -0.331909f, 0.140844f, 0.459451f, 0.405660f, 0.071022f, -0.270205f, -0.395488f, -0.264035f, 0.011192f, 0.267940f, 0.382377f, 0.305412f, 0.069121f, -0.215691f, -0.395409f, -0.361042f, -0.125550f, 0.185657f, 0.409144f, 0.412590f, 0.157751f, -0.233794f, + -0.502975f, -0.432108f, -0.044154f, 0.392922f, 0.569333f, 0.354416f, -0.119076f, -0.532390f, -0.583459f, -0.212406f, 0.328244f, 0.651192f, 0.523222f, 0.028391f, -0.498465f, -0.697298f, -0.423657f, 0.144019f, 0.619250f, 0.678265f, 0.285071f, -0.292456f, -0.670202f, -0.601845f, -0.137501f, 0.412573f, 0.685667f, 0.504744f, -0.009511f, -0.517472f, -0.679384f, -0.381427f, 0.182167f, 0.636590f, 0.676125f, 0.264131f, -0.339109f, -0.735155f, -0.648158f, -0.124121f, 0.487742f, 0.775706f, 0.550902f, -0.027674f, -0.565173f, -0.703385f, -0.372587f, 0.167766f, 0.539407f, 0.525244f, 0.189417f, -0.213885f, -0.425831f, -0.339339f, -0.053499f, 0.211988f, 0.289647f, 0.174299f, -0.017813f, -0.161265f, -0.187359f, -0.094331f, 0.056744f, 0.168407f, 0.167975f, 0.058205f, -0.088054f, -0.176546f, -0.148412f, -0.020000f, 0.122365f, 0.182101f, 0.121609f, -0.016618f, -0.142616f, -0.174255f, -0.089096f, 0.055731f, 0.161268f, 0.158577f, 0.052789f, -0.087269f, -0.171671f, -0.142248f, -0.015778f, 0.121150f, 0.175885f, 0.115837f, -0.018037f, -0.141389f, -0.172452f, -0.085388f, 0.060831f, 0.163879f, 0.160983f, 0.065107f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.087780f, -0.034783f, 0.413938f, 0.823797f, 0.543983f, -0.436677f, -1.233757f, -0.989475f, 0.095621f, 1.001639f, 1.035433f, 0.372840f, -0.409507f, -0.878895f, -0.826752f, -0.264744f, 0.476218f, 0.887350f, 0.687253f, 0.031724f, -0.653354f, -0.948834f, -0.650812f, 0.085492f, 0.784919f, 0.969321f, 0.514591f, -0.275871f, -0.892013f, -0.931647f, -0.355812f, 0.450648f, 0.926747f, 0.756894f, 0.104999f, -0.539320f, -0.740062f, -0.411148f, 0.160397f, 0.551542f, 0.509523f, 0.098904f, -0.377794f, -0.583713f, -0.362555f, 0.131700f, 0.518203f, 0.490341f, + 0.077566f, -0.394207f, -0.578087f, -0.346371f, 0.145178f, 0.554205f, 0.575106f, 0.175832f, -0.363020f, -0.668174f, -0.543344f, -0.072578f, 0.450557f, 0.690324f, 0.478483f, -0.051578f, -0.546468f, -0.685102f, -0.388291f, 0.149357f, 0.584151f, 0.635485f, 0.278158f, -0.238710f, -0.581877f, -0.561078f, -0.216561f, 0.234327f, 0.521286f, 0.478965f, 0.156980f, -0.226995f, -0.452148f, -0.413337f, -0.136988f, 0.233100f, 0.475182f, 0.414639f, 0.069623f, -0.340507f, -0.547074f, -0.409271f, -0.000863f, 0.425779f, 0.590205f, 0.373678f, -0.092797f, -0.512876f, -0.609849f, -0.299398f, 0.232658f, 0.622576f, 0.584180f, 0.137468f, -0.409303f, -0.698841f, -0.553336f, -0.050380f, 0.520212f, 0.787395f, 0.527778f, -0.121555f, -0.696400f, -0.748332f, -0.229190f, 0.448491f, 0.752721f, 0.469500f, -0.148243f, -0.616505f, -0.603205f, -0.153653f, 0.371906f, 0.577748f, 0.331909f, -0.140844f, -0.459451f, -0.405660f, -0.071022f, 0.270205f, 0.395488f, 0.264035f, -0.011192f, -0.267940f, -0.382377f, -0.305412f, -0.069121f, 0.215691f, 0.395409f, 0.361042f, 0.125550f, -0.185657f, -0.409144f, -0.412590f, -0.157751f, 0.233794f, + 0.502975f, 0.432108f, 0.044154f, -0.392922f, -0.569333f, -0.354416f, 0.119076f, 0.532390f, 0.583459f, 0.212406f, -0.328244f, -0.651192f, -0.523222f, -0.028391f, 0.498465f, 0.697298f, 0.423657f, -0.144019f, -0.619250f, -0.678265f, -0.285071f, 0.292456f, 0.670202f, 0.601845f, 0.137501f, -0.412573f, -0.685667f, -0.504744f, 0.009511f, 0.517472f, 0.679384f, 0.381427f, -0.182167f, -0.636590f, -0.676125f, -0.264131f, 0.339109f, 0.735155f, 0.648158f, 0.124121f, -0.487742f, -0.775706f, -0.550902f, 0.027674f, 0.565173f, 0.703385f, 0.372587f, -0.167766f, -0.539407f, -0.525244f, -0.189417f, 0.213885f, 0.425831f, 0.339339f, 0.053499f, -0.211988f, -0.289647f, -0.174299f, 0.017813f, 0.161265f, 0.187359f, 0.094331f, -0.056744f, -0.168407f, -0.167975f, -0.058205f, 0.088054f, 0.176546f, 0.148412f, 0.020000f, -0.122365f, -0.182101f, -0.121609f, 0.016618f, 0.142616f, 0.174255f, 0.089096f, -0.055731f, -0.161268f, -0.158577f, -0.052789f, 0.087269f, 0.171671f, 0.142248f, 0.015778f, -0.121150f, -0.175885f, -0.115837f, 0.018037f, 0.141389f, 0.172452f, 0.085388f, -0.060831f, -0.163879f, -0.160983f, -0.065107f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.025517f, -0.067699f, -0.059711f, 0.021262f, 0.087860f, 0.027591f, -0.108326f, -0.137330f, 0.007956f, 0.194048f, 0.272375f, 0.216915f, 0.050596f, -0.203942f, -0.429350f, -0.421127f, -0.112012f, 0.291505f, 0.491149f, 0.368016f, 0.035459f, -0.288843f, -0.411418f, -0.264177f, 0.032590f, 0.254119f, 0.272205f, 0.141151f, -0.016718f, -0.129969f, -0.169624f, -0.123453f, -0.025280f, 0.060613f, 0.114644f, 0.156595f, 0.158123f, 0.053616f, -0.132617f, -0.257157f, -0.202331f, 0.002510f, 0.223918f, 0.330390f, 0.248375f, -0.004124f, -0.293050f, -0.426163f, + -0.291690f, 0.047258f, 0.385296f, 0.497701f, 0.283097f, -0.145134f, -0.504786f, -0.537128f, -0.202683f, 0.283697f, 0.594348f, 0.501410f, 0.043377f, -0.463815f, -0.632693f, -0.313684f, 0.259594f, 0.644500f, 0.539145f, 0.014675f, -0.537431f, -0.691059f, -0.307837f, 0.334438f, 0.732386f, 0.551981f, -0.085284f, -0.679373f, -0.747874f, -0.221375f, 0.492107f, 0.834003f, 0.544109f, -0.142170f, -0.700227f, -0.732942f, -0.252410f, 0.368068f, 0.691006f, 0.519214f, 0.004620f, -0.482067f, -0.610463f, -0.305588f, 0.210626f, 0.572832f, 0.525182f, 0.105943f, -0.376945f, -0.576442f, -0.368132f, 0.070519f, 0.418647f, 0.455651f, 0.191607f, -0.177875f, -0.414579f, -0.379206f, -0.109506f, 0.206170f, 0.357593f, 0.256331f, -0.017179f, -0.282726f, -0.372674f, -0.223340f, 0.080586f, 0.342315f, 0.381996f, 0.172626f, -0.142659f, -0.363251f, -0.361012f, -0.140006f, 0.169257f, 0.367374f, 0.305339f, 0.012512f, -0.294289f, -0.372321f, -0.156651f, 0.185362f, 0.397383f, 0.335855f, 0.057718f, -0.247914f, -0.394386f, -0.299028f, -0.018637f, 0.279543f, 0.409662f, 0.285932f, -0.015472f, -0.305948f, -0.406582f, -0.255890f, + 0.053658f, 0.325683f, 0.380723f, 0.180789f, -0.139538f, -0.368206f, -0.359929f, -0.123417f, 0.190257f, 0.378439f, 0.313592f, 0.037523f, -0.255435f, -0.356977f, -0.202607f, 0.085024f, 0.299090f, 0.301084f, 0.102785f, -0.159110f, -0.312767f, -0.251894f, -0.007044f, 0.258857f, 0.354691f, 0.203351f, -0.097225f, -0.347096f, -0.382971f, -0.177645f, 0.148663f, 0.398915f, 0.416738f, 0.185500f, -0.158876f, -0.410573f, -0.415867f, -0.166067f, 0.188105f, 0.422600f, 0.387102f, 0.108936f, -0.227910f, -0.407819f, -0.321736f, -0.035784f, 0.252429f, 0.352172f, 0.215080f, -0.043477f, -0.244196f, -0.267093f, -0.114638f, 0.099755f, 0.226546f, 0.185711f, 0.024464f, -0.130888f, -0.179162f, -0.105058f, 0.031653f, 0.140214f, 0.150736f, 0.059181f, -0.069202f, -0.148885f, -0.131041f, -0.027488f, 0.097056f, 0.159295f, 0.114640f, -0.004873f, -0.116593f, -0.149973f, -0.085672f, 0.038646f, 0.142412f, 0.149980f, 0.055433f, -0.069223f, -0.140044f, -0.119708f, -0.021353f, 0.100455f, 0.162696f, 0.112885f, -0.010139f, -0.111545f, -0.132803f, -0.073548f, 0.042236f, 0.155380f, 0.169574f, 0.057460f, -0.059909f, -0.047863f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.025517f, -0.067699f, -0.059711f, 0.021262f, 0.087860f, 0.027591f, -0.108326f, -0.137330f, 0.007956f, 0.194048f, 0.272375f, 0.216915f, 0.050596f, -0.203942f, -0.429350f, -0.421127f, -0.112012f, 0.291505f, 0.491149f, 0.368016f, 0.035459f, -0.288843f, -0.411418f, -0.264177f, 0.032590f, 0.254119f, 0.272205f, 0.141151f, -0.016718f, -0.129969f, -0.169624f, -0.123453f, -0.025280f, 0.060613f, 0.114644f, 0.156595f, 0.158123f, 0.053616f, -0.132617f, -0.257157f, -0.202331f, 0.002510f, 0.223918f, 0.330390f, 0.248375f, -0.004124f, -0.293050f, -0.426163f, + -0.291690f, 0.047258f, 0.385296f, 0.497701f, 0.283097f, -0.145134f, -0.504786f, -0.537128f, -0.202683f, 0.283697f, 0.594348f, 0.501410f, 0.043377f, -0.463815f, -0.632693f, -0.313684f, 0.259594f, 0.644500f, 0.539145f, 0.014675f, -0.537431f, -0.691059f, -0.307837f, 0.334438f, 0.732386f, 0.551981f, -0.085284f, -0.679373f, -0.747874f, -0.221375f, 0.492107f, 0.834003f, 0.544109f, -0.142170f, -0.700227f, -0.732942f, -0.252410f, 0.368068f, 0.691006f, 0.519214f, 0.004620f, -0.482067f, -0.610463f, -0.305588f, 0.210626f, 0.572832f, 0.525182f, 0.105943f, -0.376945f, -0.576442f, -0.368132f, 0.070519f, 0.418647f, 0.455651f, 0.191607f, -0.177875f, -0.414579f, -0.379206f, -0.109506f, 0.206170f, 0.357593f, 0.256331f, -0.017179f, -0.282726f, -0.372674f, -0.223340f, 0.080586f, 0.342315f, 0.381996f, 0.172626f, -0.142659f, -0.363251f, -0.361012f, -0.140006f, 0.169257f, 0.367374f, 0.305339f, 0.012512f, -0.294289f, -0.372321f, -0.156651f, 0.185362f, 0.397383f, 0.335855f, 0.057718f, -0.247914f, -0.394386f, -0.299028f, -0.018637f, 0.279543f, 0.409662f, 0.285932f, -0.015472f, -0.305948f, -0.406582f, -0.255890f, + 0.053658f, 0.325683f, 0.380723f, 0.180789f, -0.139538f, -0.368206f, -0.359929f, -0.123417f, 0.190257f, 0.378439f, 0.313592f, 0.037523f, -0.255435f, -0.356977f, -0.202607f, 0.085024f, 0.299090f, 0.301084f, 0.102785f, -0.159110f, -0.312767f, -0.251894f, -0.007044f, 0.258857f, 0.354691f, 0.203351f, -0.097225f, -0.347096f, -0.382971f, -0.177645f, 0.148663f, 0.398915f, 0.416738f, 0.185500f, -0.158876f, -0.410573f, -0.415867f, -0.166067f, 0.188105f, 0.422600f, 0.387102f, 0.108936f, -0.227910f, -0.407819f, -0.321736f, -0.035784f, 0.252429f, 0.352172f, 0.215080f, -0.043477f, -0.244196f, -0.267093f, -0.114638f, 0.099755f, 0.226546f, 0.185711f, 0.024464f, -0.130888f, -0.179162f, -0.105058f, 0.031653f, 0.140214f, 0.150736f, 0.059181f, -0.069202f, -0.148885f, -0.131041f, -0.027488f, 0.097056f, 0.159295f, 0.114640f, -0.004873f, -0.116593f, -0.149973f, -0.085672f, 0.038646f, 0.142412f, 0.149980f, 0.055433f, -0.069223f, -0.140044f, -0.119708f, -0.021353f, 0.100455f, 0.162696f, 0.112885f, -0.010139f, -0.111545f, -0.132803f, -0.073548f, 0.042236f, 0.155380f, 0.169574f, 0.057460f, -0.059909f, -0.047863f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.002042f, -0.006491f, 0.018221f, 0.092898f, 0.127745f, 0.004944f, -0.214720f, -0.308788f, -0.162474f, 0.092986f, 0.251560f, 0.234412f, 0.083566f, -0.125155f, -0.287854f, -0.283387f, -0.080378f, 0.190266f, 0.331773f, 0.251119f, 0.021695f, -0.193673f, -0.264877f, -0.171801f, 0.004549f, 0.158511f, 0.224994f, 0.180326f, 0.026145f, -0.184598f, -0.327040f, -0.271230f, -0.002284f, 0.330335f, 0.495187f, 0.338006f, -0.087956f, -0.519361f, -0.646496f, -0.348137f, 0.197506f, 0.634013f, 0.678719f, 0.305470f, -0.251442f, -0.647353f, -0.638588f, -0.236921f, + 0.297457f, 0.629639f, 0.565555f, 0.160782f, -0.327654f, -0.598011f, -0.485372f, -0.070825f, 0.366988f, 0.546173f, 0.377458f, 0.004954f, -0.322284f, -0.422858f, -0.275356f, 0.000175f, 0.231296f, 0.295098f, 0.181142f, -0.015521f, -0.163076f, -0.178732f, -0.077093f, 0.050988f, 0.113344f, 0.084894f, 0.013667f, -0.033031f, -0.028412f, -0.002410f, -0.005173f, -0.048725f, -0.083229f, -0.046604f, 0.053409f, 0.126674f, 0.092061f, -0.029391f, -0.134050f, -0.138879f, -0.044209f, 0.088821f, 0.183007f, 0.170971f, 0.031138f, -0.166987f, -0.279645f, -0.197623f, 0.044871f, 0.278749f, 0.328486f, 0.149138f, -0.137275f, -0.329254f, -0.292843f, -0.058911f, 0.208882f, 0.345092f, 0.287084f, 0.073299f, -0.205124f, -0.412796f, -0.386387f, -0.060468f, 0.380508f, 0.568573f, 0.282760f, -0.284209f, -0.660275f, -0.521323f, 0.032309f, 0.592909f, 0.771411f, 0.437093f, -0.219405f, -0.769081f, -0.788554f, -0.202492f, 0.564137f, 0.882809f, 0.479902f, -0.293536f, -0.782195f, -0.616147f, 0.007175f, 0.556066f, 0.622891f, 0.209705f, -0.323401f, -0.558312f, -0.339903f, 0.123130f, 0.455170f, 0.423068f, 0.085888f, -0.295424f, + -0.456307f, -0.291706f, 0.079549f, 0.388307f, 0.411052f, 0.143068f, -0.211238f, -0.408239f, -0.328078f, -0.029436f, 0.290498f, 0.409966f, 0.239139f, -0.097049f, -0.353140f, -0.358326f, -0.127053f, 0.182945f, 0.380494f, 0.340097f, 0.074494f, -0.253578f, -0.425937f, -0.322690f, -0.008094f, 0.318068f, 0.451161f, 0.303215f, -0.042894f, -0.373736f, -0.473120f, -0.268560f, 0.110137f, 0.414847f, 0.448693f, 0.196000f, -0.175555f, -0.429028f, -0.406398f, -0.125281f, 0.228779f, 0.419947f, 0.324761f, 0.020887f, -0.274691f, -0.368011f, -0.218720f, 0.050806f, 0.254606f, 0.271265f, 0.116064f, -0.086465f, -0.201197f, -0.172146f, -0.042872f, 0.089079f, 0.141235f, 0.095566f, -0.000442f, -0.078029f, -0.095621f, -0.053399f, 0.019395f, 0.079568f, 0.088155f, 0.037208f, -0.038715f, -0.087559f, -0.078549f, -0.019164f, 0.053077f, 0.091282f, 0.068080f, -0.001467f, -0.069128f, -0.091243f, -0.057087f, 0.011523f, 0.074465f, 0.091834f, 0.049379f, -0.025895f, -0.083191f, -0.085646f, -0.033098f, 0.041158f, 0.089334f, 0.078023f, 0.014096f, -0.058479f, -0.092419f, -0.067902f, 0.000366f, 0.070053f, 0.090574f, 0.041310f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.002042f, -0.006491f, 0.018221f, 0.092898f, 0.127745f, 0.004944f, -0.214720f, -0.308788f, -0.162474f, 0.092986f, 0.251560f, 0.234412f, 0.083566f, -0.125155f, -0.287854f, -0.283387f, -0.080378f, 0.190266f, 0.331773f, 0.251119f, 0.021695f, -0.193673f, -0.264877f, -0.171801f, 0.004549f, 0.158511f, 0.224994f, 0.180326f, 0.026145f, -0.184598f, -0.327040f, -0.271230f, -0.002284f, 0.330335f, 0.495187f, 0.338006f, -0.087956f, -0.519361f, -0.646496f, -0.348137f, 0.197506f, 0.634013f, 0.678719f, 0.305470f, -0.251442f, -0.647353f, -0.638588f, -0.236921f, + 0.297457f, 0.629639f, 0.565555f, 0.160782f, -0.327654f, -0.598011f, -0.485372f, -0.070825f, 0.366988f, 0.546173f, 0.377458f, 0.004954f, -0.322284f, -0.422858f, -0.275356f, 0.000175f, 0.231296f, 0.295098f, 0.181142f, -0.015521f, -0.163076f, -0.178732f, -0.077093f, 0.050988f, 0.113344f, 0.084894f, 0.013667f, -0.033031f, -0.028412f, -0.002410f, -0.005173f, -0.048725f, -0.083229f, -0.046604f, 0.053409f, 0.126674f, 0.092061f, -0.029391f, -0.134050f, -0.138879f, -0.044209f, 0.088821f, 0.183007f, 0.170971f, 0.031138f, -0.166987f, -0.279645f, -0.197623f, 0.044871f, 0.278749f, 0.328486f, 0.149138f, -0.137275f, -0.329254f, -0.292843f, -0.058911f, 0.208882f, 0.345092f, 0.287084f, 0.073299f, -0.205124f, -0.412796f, -0.386387f, -0.060468f, 0.380508f, 0.568573f, 0.282760f, -0.284209f, -0.660275f, -0.521323f, 0.032309f, 0.592909f, 0.771411f, 0.437093f, -0.219405f, -0.769081f, -0.788554f, -0.202492f, 0.564137f, 0.882809f, 0.479902f, -0.293536f, -0.782195f, -0.616147f, 0.007175f, 0.556066f, 0.622891f, 0.209705f, -0.323401f, -0.558312f, -0.339903f, 0.123130f, 0.455170f, 0.423068f, 0.085888f, -0.295424f, + -0.456307f, -0.291706f, 0.079549f, 0.388307f, 0.411052f, 0.143068f, -0.211238f, -0.408239f, -0.328078f, -0.029436f, 0.290498f, 0.409966f, 0.239139f, -0.097049f, -0.353140f, -0.358326f, -0.127053f, 0.182945f, 0.380494f, 0.340097f, 0.074494f, -0.253578f, -0.425937f, -0.322690f, -0.008094f, 0.318068f, 0.451161f, 0.303215f, -0.042894f, -0.373736f, -0.473120f, -0.268560f, 0.110137f, 0.414847f, 0.448693f, 0.196000f, -0.175555f, -0.429028f, -0.406398f, -0.125281f, 0.228779f, 0.419947f, 0.324761f, 0.020887f, -0.274691f, -0.368011f, -0.218720f, 0.050806f, 0.254606f, 0.271265f, 0.116064f, -0.086465f, -0.201197f, -0.172146f, -0.042872f, 0.089079f, 0.141235f, 0.095566f, -0.000442f, -0.078029f, -0.095621f, -0.053399f, 0.019395f, 0.079568f, 0.088155f, 0.037208f, -0.038715f, -0.087559f, -0.078549f, -0.019164f, 0.053077f, 0.091282f, 0.068080f, -0.001467f, -0.069128f, -0.091243f, -0.057087f, 0.011523f, 0.074465f, 0.091834f, 0.049379f, -0.025895f, -0.083191f, -0.085646f, -0.033098f, 0.041158f, 0.089334f, 0.078023f, 0.014096f, -0.058479f, -0.092419f, -0.067902f, 0.000366f, 0.070053f, 0.090574f, 0.041310f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.003854f, -0.002454f, -0.022086f, -0.000377f, 0.099186f, 0.181826f, 0.082117f, -0.191030f, -0.382764f, -0.275736f, 0.046776f, 0.319743f, 0.373084f, 0.196545f, -0.129348f, -0.426531f, -0.463165f, -0.170663f, 0.234211f, 0.450413f, 0.367178f, 0.088909f, -0.209233f, -0.373904f, -0.319643f, -0.083985f, 0.189536f, 0.354198f, 0.324794f, 0.088057f, -0.253456f, -0.473396f, -0.380271f, -0.013515f, 0.375516f, 0.533160f, 0.366842f, -0.026016f, -0.405414f, -0.516172f, -0.275535f, 0.149100f, 0.475596f, 0.509776f, 0.240014f, -0.174033f, -0.475619f, -0.463786f, + -0.150085f, 0.245628f, 0.469369f, 0.399923f, 0.094880f, -0.255347f, -0.435018f, -0.343453f, -0.059914f, 0.236384f, 0.392555f, 0.338117f, 0.096408f, -0.205750f, -0.388085f, -0.341328f, -0.107118f, 0.165637f, 0.321632f, 0.280715f, 0.085199f, -0.122724f, -0.214422f, -0.174680f, -0.073073f, 0.029600f, 0.105485f, 0.129493f, 0.087307f, 0.002712f, -0.079435f, -0.121863f, -0.094123f, 0.009993f, 0.128396f, 0.155813f, 0.052664f, -0.102755f, -0.192455f, -0.158217f, -0.023036f, 0.132331f, 0.204180f, 0.135704f, -0.021108f, -0.146438f, -0.165069f, -0.091885f, 0.018978f, 0.119173f, 0.163471f, 0.118366f, -0.003758f, -0.140068f, -0.212421f, -0.162368f, 0.016139f, 0.238529f, 0.344363f, 0.213777f, -0.100655f, -0.379000f, -0.401132f, -0.130592f, 0.246999f, 0.460475f, 0.354353f, 0.002978f, -0.344171f, -0.442839f, -0.227748f, 0.142544f, 0.397859f, 0.348292f, 0.026927f, -0.320921f, -0.414965f, -0.169154f, 0.220157f, 0.432886f, 0.302939f, -0.050896f, -0.353421f, -0.401488f, -0.182011f, 0.153726f, 0.383482f, 0.342808f, 0.051482f, -0.278221f, -0.402450f, -0.235217f, 0.103739f, 0.381982f, 0.393633f, 0.098035f, + -0.306973f, -0.499282f, -0.308403f, 0.114133f, 0.430858f, 0.413902f, 0.102947f, -0.264072f, -0.428247f, -0.279189f, 0.060416f, 0.318844f, 0.301773f, 0.054540f, -0.206693f, -0.298903f, -0.190084f, 0.031604f, 0.234225f, 0.298053f, 0.173879f, -0.067638f, -0.265789f, -0.285611f, -0.118197f, 0.124190f, 0.293458f, 0.288596f, 0.101340f, -0.167947f, -0.345069f, -0.292162f, -0.028544f, 0.263952f, 0.378992f, 0.241019f, -0.054335f, -0.317360f, -0.381380f, -0.201627f, 0.106898f, 0.336272f, 0.333980f, 0.115250f, -0.158787f, -0.307674f, -0.252085f, -0.050007f, 0.156659f, 0.240812f, 0.168034f, 0.004842f, -0.136796f, -0.172650f, -0.094885f, 0.028554f, 0.107929f, 0.100761f, 0.033262f, -0.038872f, -0.075897f, -0.064669f, -0.013631f, 0.046785f, 0.075843f, 0.053090f, -0.004645f, -0.058977f, -0.076249f, -0.044427f, 0.017911f, 0.067960f, 0.069799f, 0.024580f, -0.034779f, -0.072813f, -0.069371f, -0.023984f, 0.039281f, 0.079038f, 0.066652f, 0.010641f, -0.052110f, -0.082806f, -0.060994f, 0.002104f, 0.063874f, 0.079954f, 0.041730f, -0.022081f, -0.073967f, -0.084637f, -0.040362f, 0.034910f, 0.076712f, 0.039734f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.003854f, 0.002454f, 0.022086f, 0.000377f, -0.099186f, -0.181826f, -0.082117f, 0.191030f, 0.382764f, 0.275736f, -0.046776f, -0.319743f, -0.373084f, -0.196545f, 0.129348f, 0.426531f, 0.463165f, 0.170663f, -0.234211f, -0.450413f, -0.367178f, -0.088909f, 0.209233f, 0.373904f, 0.319643f, 0.083985f, -0.189536f, -0.354198f, -0.324794f, -0.088057f, 0.253456f, 0.473396f, 0.380271f, 0.013515f, -0.375516f, -0.533160f, -0.366842f, 0.026016f, 0.405414f, 0.516172f, 0.275535f, -0.149100f, -0.475596f, -0.509776f, -0.240014f, 0.174033f, 0.475619f, 0.463786f, + 0.150085f, -0.245628f, -0.469369f, -0.399923f, -0.094880f, 0.255347f, 0.435018f, 0.343453f, 0.059914f, -0.236384f, -0.392555f, -0.338117f, -0.096408f, 0.205750f, 0.388085f, 0.341328f, 0.107118f, -0.165637f, -0.321632f, -0.280715f, -0.085199f, 0.122724f, 0.214422f, 0.174680f, 0.073073f, -0.029600f, -0.105485f, -0.129493f, -0.087307f, -0.002712f, 0.079435f, 0.121863f, 0.094123f, -0.009993f, -0.128396f, -0.155813f, -0.052664f, 0.102755f, 0.192455f, 0.158217f, 0.023036f, -0.132331f, -0.204180f, -0.135704f, 0.021108f, 0.146438f, 0.165069f, 0.091885f, -0.018978f, -0.119173f, -0.163471f, -0.118366f, 0.003758f, 0.140068f, 0.212421f, 0.162368f, -0.016139f, -0.238529f, -0.344363f, -0.213777f, 0.100655f, 0.379000f, 0.401132f, 0.130592f, -0.246999f, -0.460475f, -0.354353f, -0.002978f, 0.344171f, 0.442839f, 0.227748f, -0.142544f, -0.397859f, -0.348292f, -0.026927f, 0.320921f, 0.414965f, 0.169154f, -0.220157f, -0.432886f, -0.302939f, 0.050896f, 0.353421f, 0.401488f, 0.182011f, -0.153726f, -0.383482f, -0.342808f, -0.051482f, 0.278221f, 0.402450f, 0.235217f, -0.103739f, -0.381982f, -0.393633f, -0.098035f, + 0.306973f, 0.499282f, 0.308403f, -0.114133f, -0.430858f, -0.413902f, -0.102947f, 0.264072f, 0.428247f, 0.279189f, -0.060416f, -0.318844f, -0.301773f, -0.054540f, 0.206693f, 0.298903f, 0.190084f, -0.031604f, -0.234225f, -0.298053f, -0.173879f, 0.067638f, 0.265789f, 0.285611f, 0.118197f, -0.124190f, -0.293458f, -0.288596f, -0.101340f, 0.167947f, 0.345069f, 0.292162f, 0.028544f, -0.263952f, -0.378992f, -0.241019f, 0.054335f, 0.317360f, 0.381380f, 0.201627f, -0.106898f, -0.336272f, -0.333980f, -0.115250f, 0.158787f, 0.307674f, 0.252085f, 0.050007f, -0.156659f, -0.240812f, -0.168034f, -0.004842f, 0.136796f, 0.172650f, 0.094885f, -0.028554f, -0.107929f, -0.100761f, -0.033262f, 0.038872f, 0.075897f, 0.064669f, 0.013631f, -0.046785f, -0.075843f, -0.053090f, 0.004645f, 0.058977f, 0.076249f, 0.044427f, -0.017911f, -0.067960f, -0.069799f, -0.024580f, 0.034779f, 0.072813f, 0.069371f, 0.023984f, -0.039281f, -0.079038f, -0.066652f, -0.010641f, 0.052110f, 0.082806f, 0.060994f, -0.002104f, -0.063874f, -0.079954f, -0.041730f, 0.022081f, 0.073967f, 0.084637f, 0.040362f, -0.034910f, -0.076712f, -0.039734f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.005709f, 0.010879f, 0.009029f, 0.014497f, 0.028118f, 0.021796f, -0.021635f, -0.064568f, -0.047591f, 0.042919f, 0.174684f, 0.301101f, 0.332552f, 0.139058f, -0.285986f, -0.680942f, -0.690074f, -0.235770f, 0.371505f, 0.717305f, 0.607821f, 0.149400f, -0.355819f, -0.587628f, -0.424676f, -0.044500f, 0.253404f, 0.325305f, 0.232083f, 0.075946f, -0.087783f, -0.205289f, -0.223487f, -0.148160f, -0.024157f, 0.123773f, 0.256550f, 0.273946f, 0.108835f, -0.147011f, -0.299983f, -0.237365f, -0.007863f, 0.241826f, 0.354261f, 0.236794f, -0.059506f, -0.339076f, + -0.399689f, -0.193065f, 0.144588f, 0.392061f, 0.380405f, 0.103797f, -0.255794f, -0.442426f, -0.316587f, 0.036976f, 0.368425f, 0.433591f, 0.169769f, -0.232483f, -0.450807f, -0.296888f, 0.104189f, 0.411974f, 0.362406f, -0.011734f, -0.403521f, -0.469538f, -0.117832f, 0.377352f, 0.577477f, 0.269446f, -0.316408f, -0.688907f, -0.515612f, 0.096039f, 0.674967f, 0.745717f, 0.210455f, -0.535597f, -0.890832f, -0.545716f, 0.238937f, 0.845389f, 0.812579f, 0.187246f, -0.553728f, -0.880919f, -0.576103f, 0.139507f, 0.760209f, 0.839593f, 0.313174f, -0.438439f, -0.863970f, -0.657743f, 0.012880f, 0.647436f, 0.797104f, 0.389259f, -0.246367f, -0.651229f, -0.585642f, -0.173294f, 0.255041f, 0.445532f, 0.365919f, 0.132196f, -0.123863f, -0.296386f, -0.300366f, -0.121130f, 0.131319f, 0.283905f, 0.243382f, 0.058090f, -0.149195f, -0.264318f, -0.213203f, 0.002935f, 0.259571f, 0.354185f, 0.176462f, -0.158878f, -0.385738f, -0.314241f, 0.006883f, 0.335851f, 0.433027f, 0.234293f, -0.120865f, -0.399749f, -0.428525f, -0.192458f, 0.159989f, 0.409771f, 0.407355f, 0.165311f, -0.162093f, -0.380703f, -0.363178f, -0.121368f, + 0.182185f, 0.329147f, 0.217130f, -0.048149f, -0.252168f, -0.259387f, -0.096887f, 0.107149f, 0.223963f, 0.189895f, 0.036484f, -0.126658f, -0.188116f, -0.115829f, 0.029570f, 0.148143f, 0.165768f, 0.073698f, -0.070049f, -0.178073f, -0.184208f, -0.074274f, 0.104605f, 0.251155f, 0.256659f, 0.088232f, -0.165369f, -0.345102f, -0.327842f, -0.103404f, 0.212314f, 0.430302f, 0.401416f, 0.127795f, -0.226722f, -0.445483f, -0.395788f, -0.104505f, 0.252892f, 0.449886f, 0.358255f, 0.043671f, -0.282581f, -0.414055f, -0.278763f, 0.024871f, 0.291543f, 0.345936f, 0.169233f, -0.096153f, -0.268652f, -0.253507f, -0.080338f, 0.130126f, 0.236498f, 0.171425f, -0.002885f, -0.150201f, -0.177162f, -0.087915f, 0.048552f, 0.147533f, 0.146069f, 0.043356f, -0.088375f, -0.157521f, -0.122364f, -0.009444f, 0.111084f, 0.161539f, 0.104040f, -0.023391f, -0.131482f, -0.150006f, -0.070957f, 0.056616f, 0.151137f, 0.143361f, 0.035919f, -0.089690f, -0.145884f, -0.105556f, 0.001895f, 0.116345f, 0.162221f, 0.096910f, -0.032915f, -0.126565f, -0.128302f, -0.052313f, 0.064005f, 0.162674f, 0.158987f, 0.035724f, -0.081075f, -0.056659f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.005709f, -0.010879f, -0.009029f, -0.014497f, -0.028118f, -0.021796f, 0.021635f, 0.064568f, 0.047591f, -0.042919f, -0.174684f, -0.301101f, -0.332552f, -0.139058f, 0.285986f, 0.680942f, 0.690074f, 0.235770f, -0.371505f, -0.717305f, -0.607821f, -0.149400f, 0.355819f, 0.587628f, 0.424676f, 0.044500f, -0.253404f, -0.325305f, -0.232083f, -0.075946f, 0.087783f, 0.205289f, 0.223487f, 0.148160f, 0.024157f, -0.123773f, -0.256550f, -0.273946f, -0.108835f, 0.147011f, 0.299983f, 0.237365f, 0.007863f, -0.241826f, -0.354261f, -0.236794f, 0.059506f, 0.339076f, + 0.399689f, 0.193065f, -0.144588f, -0.392061f, -0.380405f, -0.103797f, 0.255794f, 0.442426f, 0.316587f, -0.036976f, -0.368425f, -0.433591f, -0.169769f, 0.232483f, 0.450807f, 0.296888f, -0.104189f, -0.411974f, -0.362406f, 0.011734f, 0.403521f, 0.469538f, 0.117832f, -0.377352f, -0.577477f, -0.269446f, 0.316408f, 0.688907f, 0.515612f, -0.096039f, -0.674967f, -0.745717f, -0.210455f, 0.535597f, 0.890832f, 0.545716f, -0.238937f, -0.845389f, -0.812579f, -0.187246f, 0.553728f, 0.880919f, 0.576103f, -0.139507f, -0.760209f, -0.839593f, -0.313174f, 0.438439f, 0.863970f, 0.657743f, -0.012880f, -0.647436f, -0.797104f, -0.389259f, 0.246367f, 0.651229f, 0.585642f, 0.173294f, -0.255041f, -0.445532f, -0.365919f, -0.132196f, 0.123863f, 0.296386f, 0.300366f, 0.121130f, -0.131319f, -0.283905f, -0.243382f, -0.058090f, 0.149195f, 0.264318f, 0.213203f, -0.002935f, -0.259571f, -0.354185f, -0.176462f, 0.158878f, 0.385738f, 0.314241f, -0.006883f, -0.335851f, -0.433027f, -0.234293f, 0.120865f, 0.399749f, 0.428525f, 0.192458f, -0.159989f, -0.409771f, -0.407355f, -0.165311f, 0.162093f, 0.380703f, 0.363178f, 0.121368f, + -0.182185f, -0.329147f, -0.217130f, 0.048149f, 0.252168f, 0.259387f, 0.096887f, -0.107149f, -0.223963f, -0.189895f, -0.036484f, 0.126658f, 0.188116f, 0.115829f, -0.029570f, -0.148143f, -0.165768f, -0.073698f, 0.070049f, 0.178073f, 0.184208f, 0.074274f, -0.104605f, -0.251155f, -0.256659f, -0.088232f, 0.165369f, 0.345102f, 0.327842f, 0.103404f, -0.212314f, -0.430302f, -0.401416f, -0.127795f, 0.226722f, 0.445483f, 0.395788f, 0.104505f, -0.252892f, -0.449886f, -0.358255f, -0.043671f, 0.282581f, 0.414055f, 0.278763f, -0.024871f, -0.291543f, -0.345936f, -0.169233f, 0.096153f, 0.268652f, 0.253507f, 0.080338f, -0.130126f, -0.236498f, -0.171425f, 0.002885f, 0.150201f, 0.177162f, 0.087915f, -0.048552f, -0.147533f, -0.146069f, -0.043356f, 0.088375f, 0.157521f, 0.122364f, 0.009444f, -0.111084f, -0.161539f, -0.104040f, 0.023391f, 0.131482f, 0.150006f, 0.070957f, -0.056616f, -0.151137f, -0.143361f, -0.035919f, 0.089690f, 0.145884f, 0.105556f, -0.001895f, -0.116345f, -0.162221f, -0.096910f, 0.032915f, 0.126565f, 0.128302f, 0.052313f, -0.064005f, -0.162674f, -0.158987f, -0.035724f, 0.081075f, 0.056659f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.005845f, -0.001257f, -0.036555f, -0.049375f, 0.012643f, 0.084800f, 0.014576f, -0.201375f, -0.309168f, -0.082748f, 0.334661f, 0.545796f, 0.354345f, -0.038791f, -0.300028f, -0.287849f, -0.093049f, 0.112040f, 0.200093f, 0.142178f, 0.003299f, -0.122003f, -0.175417f, -0.135820f, -0.003944f, 0.166483f, 0.261557f, 0.198589f, 0.018859f, -0.149552f, -0.207760f, -0.142108f, -0.005759f, 0.109328f, 0.116794f, 0.013500f, -0.096914f, -0.104851f, -0.013951f, 0.074895f, 0.084523f, 0.027800f, -0.032006f, -0.040871f, 0.017488f, 0.101840f, 0.120955f, 0.014148f, + -0.158385f, -0.246682f, -0.155788f, 0.059675f, 0.245553f, 0.265402f, 0.086381f, -0.186771f, -0.352934f, -0.260570f, 0.038516f, 0.309970f, 0.344531f, 0.135379f, -0.145372f, -0.301340f, -0.237657f, -0.002527f, 0.240431f, 0.310849f, 0.148668f, -0.120962f, -0.277864f, -0.193202f, 0.050179f, 0.224037f, 0.165720f, -0.062061f, -0.232704f, -0.181790f, 0.040655f, 0.236048f, 0.242342f, 0.053073f, -0.196484f, -0.325298f, -0.221162f, 0.074902f, 0.368753f, 0.429341f, 0.171261f, -0.237137f, -0.474123f, -0.334471f, 0.074117f, 0.416297f, 0.416646f, 0.075954f, -0.342246f, -0.505075f, -0.257877f, 0.225430f, 0.548927f, 0.430570f, -0.043506f, -0.507387f, -0.621160f, -0.293115f, 0.274454f, 0.674222f, 0.555679f, -0.029666f, -0.584642f, -0.618175f, -0.138687f, 0.397899f, 0.581786f, 0.367892f, -0.031230f, -0.372027f, -0.477009f, -0.286288f, 0.078980f, 0.371019f, 0.404261f, 0.182245f, -0.145350f, -0.387651f, -0.388422f, -0.109154f, 0.295097f, 0.532622f, 0.391740f, -0.064104f, -0.519012f, -0.636727f, -0.312736f, 0.243096f, 0.648954f, 0.618999f, 0.168320f, -0.396378f, -0.695769f, -0.540792f, -0.048107f, 0.454729f, + 0.646139f, 0.409300f, -0.094082f, -0.523602f, -0.590342f, -0.261818f, 0.223079f, 0.537186f, 0.488163f, 0.125785f, -0.304240f, -0.515916f, -0.368819f, 0.031193f, 0.404420f, 0.497162f, 0.253520f, -0.157908f, -0.461345f, -0.454869f, -0.144638f, 0.261989f, 0.502270f, 0.427614f, 0.082603f, -0.326118f, -0.539975f, -0.404333f, 0.009538f, 0.431059f, 0.576897f, 0.350480f, -0.101522f, -0.493350f, -0.576793f, -0.292774f, 0.182960f, 0.543464f, 0.551483f, 0.200051f, -0.280472f, -0.572702f, -0.483936f, -0.080849f, 0.355408f, 0.532037f, 0.351623f, -0.035457f, -0.357765f, -0.416472f, -0.206505f, 0.104013f, 0.305039f, 0.286136f, 0.092471f, -0.128024f, -0.233683f, -0.176617f, -0.017342f, 0.131343f, 0.181010f, 0.111839f, -0.027622f, -0.149189f, -0.173037f, -0.080999f, 0.064994f, 0.165938f, 0.156643f, 0.045654f, -0.095241f, -0.174626f, -0.137927f, -0.008169f, 0.126073f, 0.174867f, 0.109309f, -0.025298f, -0.142291f, -0.165887f, -0.079334f, 0.060101f, 0.158946f, 0.152835f, 0.047409f, -0.088822f, -0.167055f, -0.134115f, -0.011199f, 0.118513f, 0.169509f, 0.110655f, -0.020076f, -0.138964f, -0.163920f, -0.072282f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.005845f, -0.001257f, -0.036555f, -0.049375f, 0.012643f, 0.084800f, 0.014576f, -0.201375f, -0.309168f, -0.082748f, 0.334661f, 0.545796f, 0.354345f, -0.038791f, -0.300028f, -0.287849f, -0.093049f, 0.112040f, 0.200093f, 0.142178f, 0.003299f, -0.122003f, -0.175417f, -0.135820f, -0.003944f, 0.166483f, 0.261557f, 0.198589f, 0.018859f, -0.149552f, -0.207760f, -0.142108f, -0.005759f, 0.109328f, 0.116794f, 0.013500f, -0.096914f, -0.104851f, -0.013951f, 0.074895f, 0.084523f, 0.027800f, -0.032006f, -0.040871f, 0.017488f, 0.101840f, 0.120955f, 0.014148f, + -0.158385f, -0.246682f, -0.155788f, 0.059675f, 0.245553f, 0.265402f, 0.086381f, -0.186771f, -0.352934f, -0.260570f, 0.038516f, 0.309970f, 0.344531f, 0.135379f, -0.145372f, -0.301340f, -0.237657f, -0.002527f, 0.240431f, 0.310849f, 0.148668f, -0.120962f, -0.277864f, -0.193202f, 0.050179f, 0.224037f, 0.165720f, -0.062061f, -0.232704f, -0.181790f, 0.040655f, 0.236048f, 0.242342f, 0.053073f, -0.196484f, -0.325298f, -0.221162f, 0.074902f, 0.368753f, 0.429341f, 0.171261f, -0.237137f, -0.474123f, -0.334471f, 0.074117f, 0.416297f, 0.416646f, 0.075954f, -0.342246f, -0.505075f, -0.257877f, 0.225430f, 0.548927f, 0.430570f, -0.043506f, -0.507387f, -0.621160f, -0.293115f, 0.274454f, 0.674222f, 0.555679f, -0.029666f, -0.584642f, -0.618175f, -0.138687f, 0.397899f, 0.581786f, 0.367892f, -0.031230f, -0.372027f, -0.477009f, -0.286288f, 0.078980f, 0.371019f, 0.404261f, 0.182245f, -0.145350f, -0.387651f, -0.388422f, -0.109154f, 0.295097f, 0.532622f, 0.391740f, -0.064104f, -0.519012f, -0.636727f, -0.312736f, 0.243096f, 0.648954f, 0.618999f, 0.168320f, -0.396378f, -0.695769f, -0.540792f, -0.048107f, 0.454729f, + 0.646139f, 0.409300f, -0.094082f, -0.523602f, -0.590342f, -0.261818f, 0.223079f, 0.537186f, 0.488163f, 0.125785f, -0.304240f, -0.515916f, -0.368819f, 0.031193f, 0.404420f, 0.497162f, 0.253520f, -0.157908f, -0.461345f, -0.454869f, -0.144638f, 0.261989f, 0.502270f, 0.427614f, 0.082603f, -0.326118f, -0.539975f, -0.404333f, 0.009538f, 0.431059f, 0.576897f, 0.350480f, -0.101522f, -0.493350f, -0.576793f, -0.292774f, 0.182960f, 0.543464f, 0.551483f, 0.200051f, -0.280472f, -0.572702f, -0.483936f, -0.080849f, 0.355408f, 0.532037f, 0.351623f, -0.035457f, -0.357765f, -0.416472f, -0.206505f, 0.104013f, 0.305039f, 0.286136f, 0.092471f, -0.128024f, -0.233683f, -0.176617f, -0.017342f, 0.131343f, 0.181010f, 0.111839f, -0.027622f, -0.149189f, -0.173037f, -0.080999f, 0.064994f, 0.165938f, 0.156643f, 0.045654f, -0.095241f, -0.174626f, -0.137927f, -0.008169f, 0.126073f, 0.174867f, 0.109309f, -0.025298f, -0.142291f, -0.165887f, -0.079334f, 0.060101f, 0.158946f, 0.152835f, 0.047409f, -0.088822f, -0.167055f, -0.134115f, -0.011199f, 0.118513f, 0.169509f, 0.110655f, -0.020076f, -0.138964f, -0.163920f, -0.072282f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.004280f, 0.003712f, -0.000039f, 0.007448f, 0.000653f, -0.031279f, -0.024642f, 0.055582f, 0.109437f, 0.032321f, -0.103567f, -0.146975f, -0.093445f, -0.048562f, -0.015448f, 0.087763f, 0.216210f, 0.206603f, 0.027490f, -0.148188f, -0.169053f, -0.071020f, 0.025224f, 0.066179f, 0.067437f, 0.053319f, 0.040568f, 0.029866f, -0.001616f, -0.057601f, -0.088400f, -0.052951f, 0.011022f, 0.042657f, 0.052949f, 0.086948f, 0.116828f, 0.066078f, -0.058373f, -0.143466f, -0.102838f, 0.025959f, 0.135820f, 0.153005f, 0.071056f, -0.064506f, -0.171225f, -0.165734f, + -0.032676f, 0.140434f, 0.220862f, 0.136917f, -0.062895f, -0.240358f, -0.258909f, -0.081365f, 0.184629f, 0.342546f, 0.251300f, -0.047466f, -0.338949f, -0.391328f, -0.138151f, 0.255548f, 0.497284f, 0.378423f, -0.050929f, -0.487087f, -0.586548f, -0.241610f, 0.309050f, 0.646425f, 0.497923f, -0.037272f, -0.557984f, -0.675954f, -0.312598f, 0.261439f, 0.646352f, 0.594422f, 0.157761f, -0.364834f, -0.633467f, -0.493221f, -0.062175f, 0.374220f, 0.555326f, 0.384568f, -0.027118f, -0.415207f, -0.526856f, -0.313353f, 0.043874f, 0.318965f, 0.414278f, 0.337070f, 0.108750f, -0.204161f, -0.428274f, -0.383596f, -0.068893f, 0.310896f, 0.505334f, 0.384226f, 0.006028f, -0.395733f, -0.534072f, -0.290586f, 0.155093f, 0.468776f, 0.447520f, 0.150126f, -0.203402f, -0.395532f, -0.319112f, -0.033725f, 0.258685f, 0.358371f, 0.223848f, -0.025754f, -0.238817f, -0.319681f, -0.229141f, 0.003595f, 0.245464f, 0.317421f, 0.154378f, -0.112324f, -0.270668f, -0.219759f, -0.035182f, 0.127147f, 0.162269f, 0.073355f, -0.055743f, -0.130966f, -0.110699f, -0.018101f, 0.093874f, 0.173322f, 0.170298f, 0.049660f, -0.155769f, -0.316476f, + -0.283316f, -0.029708f, 0.287462f, 0.431514f, 0.273175f, -0.099654f, -0.436829f, -0.498588f, -0.222307f, 0.224426f, 0.541249f, 0.494937f, 0.098214f, -0.375575f, -0.584817f, -0.380483f, 0.084802f, 0.484989f, 0.559578f, 0.275608f, -0.170620f, -0.485390f, -0.466713f, -0.139996f, 0.262266f, 0.468942f, 0.354388f, 0.008534f, -0.333036f, -0.444719f, -0.261879f, 0.078293f, 0.347718f, 0.393204f, 0.212816f, -0.081399f, -0.330971f, -0.391065f, -0.208294f, 0.117230f, 0.375204f, 0.392412f, 0.159715f, -0.165843f, -0.371777f, -0.330474f, -0.082200f, 0.196114f, 0.320243f, 0.227104f, 0.004077f, -0.188284f, -0.230333f, -0.116915f, 0.052873f, 0.158213f, 0.142989f, 0.038424f, -0.077048f, -0.130993f, -0.093653f, 0.006515f, 0.099905f, 0.124565f, 0.068241f, -0.030164f, -0.108737f, -0.116444f, -0.044911f, 0.058931f, 0.123251f, 0.106074f, 0.022102f, -0.074385f, -0.122885f, -0.089317f, 0.007617f, 0.102044f, 0.129390f, 0.074122f, -0.026652f, -0.110563f, -0.122003f, -0.047945f, 0.061875f, 0.128966f, 0.111521f, 0.027995f, -0.070661f, -0.126499f, -0.094637f, 0.013317f, 0.114585f, 0.132227f, 0.079481f, 0.022065f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.004280f, 0.003712f, -0.000039f, 0.007448f, 0.000653f, -0.031279f, -0.024642f, 0.055582f, 0.109437f, 0.032321f, -0.103567f, -0.146975f, -0.093445f, -0.048562f, -0.015448f, 0.087763f, 0.216210f, 0.206603f, 0.027490f, -0.148188f, -0.169053f, -0.071020f, 0.025224f, 0.066179f, 0.067437f, 0.053319f, 0.040568f, 0.029866f, -0.001616f, -0.057601f, -0.088400f, -0.052951f, 0.011022f, 0.042657f, 0.052949f, 0.086948f, 0.116828f, 0.066078f, -0.058373f, -0.143466f, -0.102838f, 0.025959f, 0.135820f, 0.153005f, 0.071056f, -0.064506f, -0.171225f, -0.165734f, + -0.032676f, 0.140434f, 0.220862f, 0.136917f, -0.062895f, -0.240358f, -0.258909f, -0.081365f, 0.184629f, 0.342546f, 0.251300f, -0.047466f, -0.338949f, -0.391328f, -0.138151f, 0.255548f, 0.497284f, 0.378423f, -0.050929f, -0.487087f, -0.586548f, -0.241610f, 0.309050f, 0.646425f, 0.497923f, -0.037272f, -0.557984f, -0.675954f, -0.312598f, 0.261439f, 0.646352f, 0.594422f, 0.157761f, -0.364834f, -0.633467f, -0.493221f, -0.062175f, 0.374220f, 0.555326f, 0.384568f, -0.027118f, -0.415207f, -0.526856f, -0.313353f, 0.043874f, 0.318965f, 0.414278f, 0.337070f, 0.108750f, -0.204161f, -0.428274f, -0.383596f, -0.068893f, 0.310896f, 0.505334f, 0.384226f, 0.006028f, -0.395733f, -0.534072f, -0.290586f, 0.155093f, 0.468776f, 0.447520f, 0.150126f, -0.203402f, -0.395532f, -0.319112f, -0.033725f, 0.258685f, 0.358371f, 0.223848f, -0.025754f, -0.238817f, -0.319681f, -0.229141f, 0.003595f, 0.245464f, 0.317421f, 0.154378f, -0.112324f, -0.270668f, -0.219759f, -0.035182f, 0.127147f, 0.162269f, 0.073355f, -0.055743f, -0.130966f, -0.110699f, -0.018101f, 0.093874f, 0.173322f, 0.170298f, 0.049660f, -0.155769f, -0.316476f, + -0.283316f, -0.029708f, 0.287462f, 0.431514f, 0.273175f, -0.099654f, -0.436829f, -0.498588f, -0.222307f, 0.224426f, 0.541249f, 0.494937f, 0.098214f, -0.375575f, -0.584817f, -0.380483f, 0.084802f, 0.484989f, 0.559578f, 0.275608f, -0.170620f, -0.485390f, -0.466713f, -0.139996f, 0.262266f, 0.468942f, 0.354388f, 0.008534f, -0.333036f, -0.444719f, -0.261879f, 0.078293f, 0.347718f, 0.393204f, 0.212816f, -0.081399f, -0.330971f, -0.391065f, -0.208294f, 0.117230f, 0.375204f, 0.392412f, 0.159715f, -0.165843f, -0.371777f, -0.330474f, -0.082200f, 0.196114f, 0.320243f, 0.227104f, 0.004077f, -0.188284f, -0.230333f, -0.116915f, 0.052873f, 0.158213f, 0.142989f, 0.038424f, -0.077048f, -0.130993f, -0.093653f, 0.006515f, 0.099905f, 0.124565f, 0.068241f, -0.030164f, -0.108737f, -0.116444f, -0.044911f, 0.058931f, 0.123251f, 0.106074f, 0.022102f, -0.074385f, -0.122885f, -0.089317f, 0.007617f, 0.102044f, 0.129390f, 0.074122f, -0.026652f, -0.110563f, -0.122003f, -0.047945f, 0.061875f, 0.128966f, 0.111521f, 0.027995f, -0.070661f, -0.126499f, -0.094637f, 0.013317f, 0.114585f, 0.132227f, 0.079481f, 0.022065f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.011054f, -0.007070f, -0.051753f, 0.014589f, 0.233520f, 0.380519f, 0.162453f, -0.369840f, -0.731647f, -0.472019f, 0.285481f, 0.897293f, 0.831291f, 0.163924f, -0.562235f, -0.855441f, -0.597748f, -0.003812f, 0.564531f, 0.767912f, 0.457001f, -0.202713f, -0.788397f, -0.889359f, -0.409800f, 0.339658f, 0.859637f, 0.830526f, 0.324490f, -0.300816f, -0.679798f, -0.639208f, -0.247785f, 0.233655f, 0.500997f, 0.420723f, 0.122352f, -0.153025f, -0.272366f, -0.250329f, -0.141199f, 0.015379f, 0.164609f, 0.239381f, 0.206161f, 0.076145f, -0.107656f, -0.262495f, + -0.286346f, -0.142136f, 0.091062f, 0.278557f, 0.322804f, 0.195488f, -0.058660f, -0.312279f, -0.402994f, -0.254102f, 0.050633f, 0.325479f, 0.407512f, 0.245268f, -0.073559f, -0.357746f, -0.422720f, -0.221149f, 0.116620f, 0.372269f, 0.385425f, 0.155511f, -0.158653f, -0.346339f, -0.294224f, -0.062915f, 0.171720f, 0.255869f, 0.160346f, -0.019314f, -0.150339f, -0.162008f, -0.077793f, 0.030104f, 0.100992f, 0.109248f, 0.060535f, -0.017894f, -0.093919f, -0.144493f, -0.149009f, -0.084490f, 0.045428f, 0.181380f, 0.236772f, 0.163461f, -0.013805f, -0.207243f, -0.297200f, -0.195954f, 0.065527f, 0.320373f, 0.378654f, 0.177633f, -0.170608f, -0.452556f, -0.473952f, -0.178205f, 0.280137f, 0.590859f, 0.500293f, 0.040555f, -0.444062f, -0.552824f, -0.183483f, 0.343567f, 0.558098f, 0.278567f, -0.226937f, -0.515700f, -0.368201f, 0.074361f, 0.466951f, 0.507020f, 0.136923f, -0.371910f, -0.581171f, -0.272678f, 0.295031f, 0.599293f, 0.361782f, -0.188773f, -0.560123f, -0.455399f, -0.000212f, 0.409015f, 0.450195f, 0.128342f, -0.250838f, -0.358929f, -0.131950f, 0.194025f, 0.318906f, 0.146404f, -0.157945f, -0.334355f, + -0.247434f, 0.019837f, 0.249120f, 0.269314f, 0.090931f, -0.120606f, -0.203825f, -0.134661f, -0.011592f, 0.062951f, 0.064076f, 0.027257f, -0.007058f, -0.019104f, -0.008269f, 0.010538f, 0.017648f, 0.010506f, 0.008106f, 0.021396f, 0.028143f, -0.002454f, -0.059516f, -0.086719f, -0.042890f, 0.044637f, 0.102853f, 0.085631f, 0.012221f, -0.061110f, -0.092578f, -0.079083f, -0.044526f, -0.011128f, 0.019864f, 0.056626f, 0.087271f, 0.078526f, 0.015838f, -0.067588f, -0.115635f, -0.095662f, -0.016369f, 0.079679f, 0.130979f, 0.092596f, -0.016440f, -0.114220f, -0.126340f, -0.051412f, 0.047829f, 0.101843f, 0.079272f, 0.002521f, -0.066235f, -0.074167f, -0.026831f, 0.023270f, 0.037402f, 0.020887f, -0.003360f, -0.022079f, -0.027762f, -0.014908f, 0.008863f, 0.024752f, 0.022300f, 0.006488f, -0.012643f, -0.025499f, -0.022858f, -0.003943f, 0.017599f, 0.024935f, 0.013225f, -0.009036f, -0.027074f, -0.027334f, -0.007581f, 0.018233f, 0.031604f, 0.025079f, 0.003459f, -0.021928f, -0.035180f, -0.024458f, 0.003203f, 0.025918f, 0.029636f, 0.015872f, -0.009234f, -0.034584f, -0.039129f, -0.014118f, 0.013692f, 0.011282f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.011054f, -0.007070f, -0.051753f, 0.014589f, 0.233520f, 0.380519f, 0.162453f, -0.369840f, -0.731647f, -0.472019f, 0.285481f, 0.897293f, 0.831291f, 0.163924f, -0.562235f, -0.855441f, -0.597748f, -0.003812f, 0.564531f, 0.767912f, 0.457001f, -0.202713f, -0.788397f, -0.889359f, -0.409800f, 0.339658f, 0.859637f, 0.830526f, 0.324490f, -0.300816f, -0.679798f, -0.639208f, -0.247785f, 0.233655f, 0.500997f, 0.420723f, 0.122352f, -0.153025f, -0.272366f, -0.250329f, -0.141199f, 0.015379f, 0.164609f, 0.239381f, 0.206161f, 0.076145f, -0.107656f, -0.262495f, + -0.286346f, -0.142136f, 0.091062f, 0.278557f, 0.322804f, 0.195488f, -0.058660f, -0.312279f, -0.402994f, -0.254102f, 0.050633f, 0.325479f, 0.407512f, 0.245268f, -0.073559f, -0.357746f, -0.422720f, -0.221149f, 0.116620f, 0.372269f, 0.385425f, 0.155511f, -0.158653f, -0.346339f, -0.294224f, -0.062915f, 0.171720f, 0.255869f, 0.160346f, -0.019314f, -0.150339f, -0.162008f, -0.077793f, 0.030104f, 0.100992f, 0.109248f, 0.060535f, -0.017894f, -0.093919f, -0.144493f, -0.149009f, -0.084490f, 0.045428f, 0.181380f, 0.236772f, 0.163461f, -0.013805f, -0.207243f, -0.297200f, -0.195954f, 0.065527f, 0.320373f, 0.378654f, 0.177633f, -0.170608f, -0.452556f, -0.473952f, -0.178205f, 0.280137f, 0.590859f, 0.500293f, 0.040555f, -0.444062f, -0.552824f, -0.183483f, 0.343567f, 0.558098f, 0.278567f, -0.226937f, -0.515700f, -0.368201f, 0.074361f, 0.466951f, 0.507020f, 0.136923f, -0.371910f, -0.581171f, -0.272678f, 0.295031f, 0.599293f, 0.361782f, -0.188773f, -0.560123f, -0.455399f, -0.000212f, 0.409015f, 0.450195f, 0.128342f, -0.250838f, -0.358929f, -0.131950f, 0.194025f, 0.318906f, 0.146404f, -0.157945f, -0.334355f, + -0.247434f, 0.019837f, 0.249120f, 0.269314f, 0.090931f, -0.120606f, -0.203825f, -0.134661f, -0.011592f, 0.062951f, 0.064076f, 0.027257f, -0.007058f, -0.019104f, -0.008269f, 0.010538f, 0.017648f, 0.010506f, 0.008106f, 0.021396f, 0.028143f, -0.002454f, -0.059516f, -0.086719f, -0.042890f, 0.044637f, 0.102853f, 0.085631f, 0.012221f, -0.061110f, -0.092578f, -0.079083f, -0.044526f, -0.011128f, 0.019864f, 0.056626f, 0.087271f, 0.078526f, 0.015838f, -0.067588f, -0.115635f, -0.095662f, -0.016369f, 0.079679f, 0.130979f, 0.092596f, -0.016440f, -0.114220f, -0.126340f, -0.051412f, 0.047829f, 0.101843f, 0.079272f, 0.002521f, -0.066235f, -0.074167f, -0.026831f, 0.023270f, 0.037402f, 0.020887f, -0.003360f, -0.022079f, -0.027762f, -0.014908f, 0.008863f, 0.024752f, 0.022300f, 0.006488f, -0.012643f, -0.025499f, -0.022858f, -0.003943f, 0.017599f, 0.024935f, 0.013225f, -0.009036f, -0.027074f, -0.027334f, -0.007581f, 0.018233f, 0.031604f, 0.025079f, 0.003459f, -0.021928f, -0.035180f, -0.024458f, 0.003203f, 0.025918f, 0.029636f, 0.015872f, -0.009234f, -0.034584f, -0.039129f, -0.014118f, 0.013692f, 0.011282f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.000066f, -0.006446f, -0.004400f, 0.025295f, 0.045628f, 0.027396f, 0.023307f, 0.060622f, 0.039319f, -0.111806f, -0.254961f, -0.192022f, 0.057167f, 0.278509f, 0.317016f, 0.176999f, -0.056693f, -0.252718f, -0.254557f, -0.023929f, 0.256919f, 0.335698f, 0.135558f, -0.194256f, -0.420609f, -0.384673f, -0.101767f, 0.234569f, 0.398843f, 0.322361f, 0.111765f, -0.090608f, -0.194757f, -0.156835f, -0.004372f, 0.135922f, 0.139189f, 0.021353f, -0.093162f, -0.125628f, -0.091576f, -0.024886f, 0.055679f, 0.112411f, 0.100460f, 0.023672f, -0.064900f, -0.114261f, + -0.101236f, -0.029409f, 0.064122f, 0.119308f, 0.099450f, 0.021164f, -0.066218f, -0.114090f, -0.092493f, -0.007394f, 0.090545f, 0.135655f, 0.097412f, 0.000910f, -0.093425f, -0.128529f, -0.088704f, -0.010281f, 0.054542f, 0.082224f, 0.075537f, 0.037293f, -0.021080f, -0.060221f, -0.045531f, 0.003377f, 0.032644f, 0.021011f, -0.006179f, -0.022795f, -0.025339f, -0.014951f, 0.006887f, 0.023010f, 0.012867f, -0.015081f, -0.028698f, -0.014963f, 0.003423f, 0.000888f, -0.016649f, -0.018468f, 0.015625f, 0.069377f, 0.097152f, 0.061345f, -0.028382f, -0.112663f, -0.128016f, -0.062631f, 0.032351f, 0.088685f, 0.077692f, 0.023486f, -0.029762f, -0.053372f, -0.042327f, -0.006150f, 0.037911f, 0.067859f, 0.062751f, 0.013915f, -0.059782f, -0.107345f, -0.077487f, 0.022672f, 0.110306f, 0.099575f, 0.000702f, -0.076162f, -0.033883f, 0.102383f, 0.200474f, 0.145186f, -0.050151f, -0.241788f, -0.265120f, -0.076360f, 0.187150f, 0.301979f, 0.154267f, -0.141852f, -0.335214f, -0.260093f, 0.025295f, 0.298897f, 0.352753f, 0.143439f, -0.172578f, -0.347706f, -0.245457f, 0.033580f, 0.250090f, 0.254389f, 0.089711f, -0.105239f, + -0.219033f, -0.194857f, -0.040020f, 0.141073f, 0.199748f, 0.093566f, -0.059561f, -0.120585f, -0.074908f, -0.001730f, 0.041947f, 0.050779f, 0.031022f, -0.005519f, -0.028797f, -0.018690f, 0.007358f, 0.023235f, 0.029285f, 0.032943f, 0.020207f, -0.020590f, -0.062100f, -0.057199f, 0.004912f, 0.078006f, 0.096812f, 0.034806f, -0.067797f, -0.131307f, -0.102333f, -0.001387f, 0.094374f, 0.116817f, 0.059003f, -0.027568f, -0.079302f, -0.067802f, -0.012913f, 0.041007f, 0.059382f, 0.036624f, -0.005633f, -0.035765f, -0.035699f, -0.013491f, 0.008176f, 0.014984f, 0.010012f, 0.004243f, 0.004227f, 0.007169f, 0.004931f, -0.004483f, -0.010982f, -0.006140f, 0.000460f, -0.006494f, -0.020769f, -0.018990f, 0.004816f, 0.028633f, 0.031314f, 0.014318f, -0.008942f, -0.026857f, -0.028843f, -0.009686f, 0.018714f, 0.033849f, 0.025355f, 0.002213f, -0.020413f, -0.030633f, -0.021410f, 0.003204f, 0.025602f, 0.029328f, 0.014478f, -0.006722f, -0.022440f, -0.024250f, -0.008745f, 0.015146f, 0.028928f, 0.022382f, 0.002881f, -0.015620f, -0.024037f, -0.017533f, 0.003324f, 0.025495f, 0.029810f, 0.013010f, -0.005080f, -0.005426f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000066f, 0.006446f, 0.004400f, -0.025295f, -0.045628f, -0.027396f, -0.023307f, -0.060622f, -0.039319f, 0.111806f, 0.254961f, 0.192022f, -0.057167f, -0.278509f, -0.317016f, -0.176999f, 0.056693f, 0.252718f, 0.254557f, 0.023929f, -0.256919f, -0.335698f, -0.135558f, 0.194256f, 0.420609f, 0.384673f, 0.101767f, -0.234569f, -0.398843f, -0.322361f, -0.111765f, 0.090608f, 0.194757f, 0.156835f, 0.004372f, -0.135922f, -0.139189f, -0.021353f, 0.093162f, 0.125628f, 0.091576f, 0.024886f, -0.055679f, -0.112411f, -0.100460f, -0.023672f, 0.064900f, 0.114261f, + 0.101236f, 0.029409f, -0.064122f, -0.119308f, -0.099450f, -0.021164f, 0.066218f, 0.114090f, 0.092493f, 0.007394f, -0.090545f, -0.135655f, -0.097412f, -0.000910f, 0.093425f, 0.128529f, 0.088704f, 0.010281f, -0.054542f, -0.082224f, -0.075537f, -0.037293f, 0.021080f, 0.060221f, 0.045531f, -0.003377f, -0.032644f, -0.021011f, 0.006179f, 0.022795f, 0.025339f, 0.014951f, -0.006887f, -0.023010f, -0.012867f, 0.015081f, 0.028698f, 0.014963f, -0.003423f, -0.000888f, 0.016649f, 0.018468f, -0.015625f, -0.069377f, -0.097152f, -0.061345f, 0.028382f, 0.112663f, 0.128016f, 0.062631f, -0.032351f, -0.088685f, -0.077692f, -0.023486f, 0.029762f, 0.053372f, 0.042327f, 0.006150f, -0.037911f, -0.067859f, -0.062751f, -0.013915f, 0.059782f, 0.107345f, 0.077487f, -0.022672f, -0.110306f, -0.099575f, -0.000702f, 0.076162f, 0.033883f, -0.102383f, -0.200474f, -0.145186f, 0.050151f, 0.241788f, 0.265120f, 0.076360f, -0.187150f, -0.301979f, -0.154267f, 0.141852f, 0.335214f, 0.260093f, -0.025295f, -0.298897f, -0.352753f, -0.143439f, 0.172578f, 0.347706f, 0.245457f, -0.033580f, -0.250090f, -0.254389f, -0.089711f, 0.105239f, + 0.219033f, 0.194857f, 0.040020f, -0.141073f, -0.199748f, -0.093566f, 0.059561f, 0.120585f, 0.074908f, 0.001730f, -0.041947f, -0.050779f, -0.031022f, 0.005519f, 0.028797f, 0.018690f, -0.007358f, -0.023235f, -0.029285f, -0.032943f, -0.020207f, 0.020590f, 0.062100f, 0.057199f, -0.004912f, -0.078006f, -0.096812f, -0.034806f, 0.067797f, 0.131307f, 0.102333f, 0.001387f, -0.094374f, -0.116817f, -0.059003f, 0.027568f, 0.079302f, 0.067802f, 0.012913f, -0.041007f, -0.059382f, -0.036624f, 0.005633f, 0.035765f, 0.035699f, 0.013491f, -0.008176f, -0.014984f, -0.010012f, -0.004243f, -0.004227f, -0.007169f, -0.004931f, 0.004483f, 0.010982f, 0.006140f, -0.000460f, 0.006494f, 0.020769f, 0.018990f, -0.004816f, -0.028633f, -0.031314f, -0.014318f, 0.008942f, 0.026857f, 0.028843f, 0.009686f, -0.018714f, -0.033849f, -0.025355f, -0.002213f, 0.020413f, 0.030633f, 0.021410f, -0.003204f, -0.025602f, -0.029328f, -0.014478f, 0.006722f, 0.022440f, 0.024250f, 0.008745f, -0.015146f, -0.028928f, -0.022382f, -0.002881f, 0.015620f, 0.024037f, 0.017533f, -0.003324f, -0.025495f, -0.029810f, -0.013010f, 0.005080f, 0.005426f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.015929f, 0.029234f, 0.016763f, 0.009672f, 0.019371f, 0.015823f, -0.011489f, -0.016215f, 0.034107f, 0.084410f, 0.050543f, -0.066458f, -0.180755f, -0.216641f, -0.149273f, 0.011211f, 0.196415f, 0.272361f, 0.156942f, -0.057285f, -0.183501f, -0.145504f, -0.030607f, 0.050032f, 0.070702f, 0.060642f, 0.043305f, 0.025909f, 0.005034f, -0.025033f, -0.049462f, -0.038843f, 0.002459f, 0.029906f, 0.022211f, 0.006533f, 0.000245f, -0.016499f, -0.043976f, -0.038985f, 0.017319f, 0.079179f, 0.095554f, 0.064698f, 0.008506f, -0.056291f, -0.098164f, -0.074085f, + 0.014099f, 0.100620f, 0.117763f, 0.055103f, -0.047962f, -0.135439f, -0.153178f, -0.073713f, 0.069561f, 0.187037f, 0.194092f, 0.077510f, -0.089924f, -0.195295f, -0.161175f, -0.004442f, 0.165011f, 0.216741f, 0.101364f, -0.097592f, -0.220143f, -0.164550f, 0.020137f, 0.180059f, 0.195075f, 0.069319f, -0.095513f, -0.186739f, -0.148793f, -0.011058f, 0.128043f, 0.168222f, 0.086730f, -0.048460f, -0.146158f, -0.158456f, -0.084490f, 0.048132f, 0.174315f, 0.200098f, 0.082528f, -0.098374f, -0.200692f, -0.165052f, -0.051900f, 0.066260f, 0.172868f, 0.238355f, 0.176796f, -0.040045f, -0.271349f, -0.306316f, -0.081786f, 0.242261f, 0.415943f, 0.292026f, -0.060213f, -0.383798f, -0.424293f, -0.158167f, 0.182304f, 0.340012f, 0.255424f, 0.050051f, -0.128676f, -0.193086f, -0.123330f, 0.021458f, 0.127605f, 0.125671f, 0.051253f, -0.022281f, -0.072538f, -0.110355f, -0.115876f, -0.052418f, 0.065262f, 0.159814f, 0.157155f, 0.052063f, -0.086913f, -0.169788f, -0.150465f, -0.053534f, 0.054041f, 0.112166f, 0.097926f, 0.030226f, -0.043825f, -0.076322f, -0.045673f, 0.031129f, 0.099703f, 0.090733f, -0.020480f, -0.160249f, + -0.198293f, -0.077586f, 0.113320f, 0.221111f, 0.168033f, 0.003310f, -0.153638f, -0.199156f, -0.105615f, 0.062865f, 0.192074f, 0.195452f, 0.070221f, -0.102177f, -0.204113f, -0.159134f, 0.003555f, 0.163527f, 0.207756f, 0.118671f, -0.029514f, -0.137242f, -0.140175f, -0.043126f, 0.078844f, 0.131507f, 0.077593f, -0.036429f, -0.125364f, -0.128127f, -0.042646f, 0.073719f, 0.142170f, 0.122797f, 0.039033f, -0.057859f, -0.126496f, -0.134374f, -0.061883f, 0.062732f, 0.158887f, 0.156294f, 0.056158f, -0.075754f, -0.158459f, -0.140410f, -0.031730f, 0.092197f, 0.143301f, 0.094062f, -0.006247f, -0.082657f, -0.090834f, -0.037952f, 0.028813f, 0.059100f, 0.040472f, 0.001575f, -0.025219f, -0.029603f, -0.014679f, 0.011686f, 0.031974f, 0.028588f, 0.004869f, -0.018732f, -0.028072f, -0.021183f, -0.000227f, 0.024684f, 0.033917f, 0.018296f, -0.007839f, -0.024662f, -0.025630f, -0.012063f, 0.012191f, 0.033131f, 0.032631f, 0.009753f, -0.017507f, -0.032117f, -0.027244f, -0.003607f, 0.026002f, 0.038769f, 0.024221f, -0.003907f, -0.026080f, -0.032505f, -0.018105f, 0.013733f, 0.039397f, 0.035358f, 0.012457f, 0.000254f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.015929f, -0.029234f, -0.016763f, -0.009672f, -0.019371f, -0.015823f, 0.011489f, 0.016215f, -0.034107f, -0.084410f, -0.050543f, 0.066458f, 0.180755f, 0.216641f, 0.149273f, -0.011211f, -0.196415f, -0.272361f, -0.156942f, 0.057285f, 0.183501f, 0.145504f, 0.030607f, -0.050032f, -0.070702f, -0.060642f, -0.043305f, -0.025909f, -0.005034f, 0.025033f, 0.049462f, 0.038843f, -0.002459f, -0.029906f, -0.022211f, -0.006533f, -0.000245f, 0.016499f, 0.043976f, 0.038985f, -0.017319f, -0.079179f, -0.095554f, -0.064698f, -0.008506f, 0.056291f, 0.098164f, 0.074085f, + -0.014099f, -0.100620f, -0.117763f, -0.055103f, 0.047962f, 0.135439f, 0.153178f, 0.073713f, -0.069561f, -0.187037f, -0.194092f, -0.077510f, 0.089924f, 0.195295f, 0.161175f, 0.004442f, -0.165011f, -0.216741f, -0.101364f, 0.097592f, 0.220143f, 0.164550f, -0.020137f, -0.180059f, -0.195075f, -0.069319f, 0.095513f, 0.186739f, 0.148793f, 0.011058f, -0.128043f, -0.168222f, -0.086730f, 0.048460f, 0.146158f, 0.158456f, 0.084490f, -0.048132f, -0.174315f, -0.200098f, -0.082528f, 0.098374f, 0.200692f, 0.165052f, 0.051900f, -0.066260f, -0.172868f, -0.238355f, -0.176796f, 0.040045f, 0.271349f, 0.306316f, 0.081786f, -0.242261f, -0.415943f, -0.292026f, 0.060213f, 0.383798f, 0.424293f, 0.158167f, -0.182304f, -0.340012f, -0.255424f, -0.050051f, 0.128676f, 0.193086f, 0.123330f, -0.021458f, -0.127605f, -0.125671f, -0.051253f, 0.022281f, 0.072538f, 0.110355f, 0.115876f, 0.052418f, -0.065262f, -0.159814f, -0.157155f, -0.052063f, 0.086913f, 0.169788f, 0.150465f, 0.053534f, -0.054041f, -0.112166f, -0.097926f, -0.030226f, 0.043825f, 0.076322f, 0.045673f, -0.031129f, -0.099703f, -0.090733f, 0.020480f, 0.160249f, + 0.198293f, 0.077586f, -0.113320f, -0.221111f, -0.168033f, -0.003310f, 0.153638f, 0.199156f, 0.105615f, -0.062865f, -0.192074f, -0.195452f, -0.070221f, 0.102177f, 0.204113f, 0.159134f, -0.003555f, -0.163527f, -0.207756f, -0.118671f, 0.029514f, 0.137242f, 0.140175f, 0.043126f, -0.078844f, -0.131507f, -0.077593f, 0.036429f, 0.125364f, 0.128127f, 0.042646f, -0.073719f, -0.142170f, -0.122797f, -0.039033f, 0.057859f, 0.126496f, 0.134374f, 0.061883f, -0.062732f, -0.158887f, -0.156294f, -0.056158f, 0.075754f, 0.158459f, 0.140410f, 0.031730f, -0.092197f, -0.143301f, -0.094062f, 0.006247f, 0.082657f, 0.090834f, 0.037952f, -0.028813f, -0.059100f, -0.040472f, -0.001575f, 0.025219f, 0.029603f, 0.014679f, -0.011686f, -0.031974f, -0.028588f, -0.004869f, 0.018732f, 0.028072f, 0.021183f, 0.000227f, -0.024684f, -0.033917f, -0.018296f, 0.007839f, 0.024662f, 0.025630f, 0.012063f, -0.012191f, -0.033131f, -0.032631f, -0.009753f, 0.017507f, 0.032117f, 0.027244f, 0.003607f, -0.026002f, -0.038769f, -0.024221f, 0.003907f, 0.026080f, 0.032505f, 0.018105f, -0.013733f, -0.039397f, -0.035358f, -0.012457f, -0.000254f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.008155f, 0.014846f, 0.058753f, 0.017794f, -0.084333f, -0.098226f, -0.008610f, 0.014440f, -0.104677f, -0.200204f, -0.099132f, 0.138016f, 0.310898f, 0.307805f, 0.157331f, -0.050636f, -0.207633f, -0.221553f, -0.092256f, 0.077414f, 0.180593f, 0.179997f, 0.084137f, -0.070051f, -0.188530f, -0.160319f, 0.017504f, 0.202446f, 0.239595f, 0.107707f, -0.083073f, -0.200471f, -0.178500f, -0.041448f, 0.118139f, 0.196726f, 0.147611f, 0.009422f, -0.126068f, -0.177307f, -0.122857f, -0.006478f, 0.104342f, 0.164920f, 0.159215f, 0.080624f, -0.059865f, -0.203826f, + -0.257724f, -0.162978f, 0.044134f, 0.244520f, 0.309322f, 0.182542f, -0.073427f, -0.302159f, -0.348234f, -0.167873f, 0.128452f, 0.343665f, 0.331028f, 0.100414f, -0.189147f, -0.344243f, -0.268073f, -0.017261f, 0.239438f, 0.329783f, 0.195439f, -0.061232f, -0.252306f, -0.250446f, -0.080402f, 0.116388f, 0.199780f, 0.133405f, -0.001476f, -0.089278f, -0.083984f, -0.026769f, 0.026675f, 0.055474f, 0.047047f, -0.013213f, -0.086560f, -0.077400f, 0.045480f, 0.163909f, 0.129214f, -0.043758f, -0.175933f, -0.127868f, 0.049601f, 0.180439f, 0.137651f, -0.052675f, -0.234778f, -0.236480f, -0.010892f, 0.289848f, 0.406696f, 0.199317f, -0.197493f, -0.469040f, -0.397807f, -0.046354f, 0.322545f, 0.468248f, 0.318816f, -0.016454f, -0.310017f, -0.346651f, -0.098294f, 0.221806f, 0.346664f, 0.208015f, -0.035716f, -0.193229f, -0.193558f, -0.075689f, 0.072428f, 0.150923f, 0.107610f, -0.006695f, -0.087971f, -0.092255f, -0.056253f, -0.015739f, 0.032245f, 0.079781f, 0.083034f, 0.014615f, -0.089696f, -0.154426f, -0.123634f, -0.002731f, 0.138293f, 0.205577f, 0.144256f, -0.023592f, -0.204895f, -0.274530f, -0.152777f, 0.101900f, + 0.295208f, 0.258308f, 0.020261f, -0.218863f, -0.284976f, -0.163152f, 0.041509f, 0.202170f, 0.226051f, 0.094405f, -0.104341f, -0.218536f, -0.156668f, 0.030494f, 0.195911f, 0.216775f, 0.081593f, -0.109457f, -0.220309f, -0.178121f, -0.021465f, 0.139141f, 0.204869f, 0.144590f, -0.000310f, -0.143372f, -0.198182f, -0.129450f, 0.020845f, 0.158913f, 0.200904f, 0.124769f, -0.021000f, -0.150172f, -0.188658f, -0.114798f, 0.027787f, 0.152279f, 0.179398f, 0.089884f, -0.058928f, -0.169173f, -0.167794f, -0.056364f, 0.088343f, 0.166696f, 0.128392f, 0.008387f, -0.104990f, -0.139226f, -0.083218f, 0.017082f, 0.094263f, 0.101195f, 0.040770f, -0.037436f, -0.077783f, -0.061206f, -0.010263f, 0.037948f, 0.056549f, 0.037758f, -0.005507f, -0.045018f, -0.054580f, -0.028455f, 0.015674f, 0.049328f, 0.050522f, 0.017695f, -0.027351f, -0.053643f, -0.043687f, -0.005142f, 0.036341f, 0.054174f, 0.036930f, -0.003847f, -0.040664f, -0.049542f, -0.026191f, 0.013462f, 0.044536f, 0.047143f, 0.018626f, -0.022384f, -0.047736f, -0.040751f, -0.007424f, 0.030301f, 0.049175f, 0.036865f, -0.000315f, -0.037910f, -0.048008f, -0.021595f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.008155f, -0.014846f, -0.058753f, -0.017794f, 0.084333f, 0.098226f, 0.008610f, -0.014440f, 0.104677f, 0.200204f, 0.099132f, -0.138016f, -0.310898f, -0.307805f, -0.157331f, 0.050636f, 0.207633f, 0.221553f, 0.092256f, -0.077414f, -0.180593f, -0.179997f, -0.084137f, 0.070051f, 0.188530f, 0.160319f, -0.017504f, -0.202446f, -0.239595f, -0.107707f, 0.083073f, 0.200471f, 0.178500f, 0.041448f, -0.118139f, -0.196726f, -0.147611f, -0.009422f, 0.126068f, 0.177307f, 0.122857f, 0.006478f, -0.104342f, -0.164920f, -0.159215f, -0.080624f, 0.059865f, 0.203826f, + 0.257724f, 0.162978f, -0.044134f, -0.244520f, -0.309322f, -0.182542f, 0.073427f, 0.302159f, 0.348234f, 0.167873f, -0.128452f, -0.343665f, -0.331028f, -0.100414f, 0.189147f, 0.344243f, 0.268073f, 0.017261f, -0.239438f, -0.329783f, -0.195439f, 0.061232f, 0.252306f, 0.250446f, 0.080402f, -0.116388f, -0.199780f, -0.133405f, 0.001476f, 0.089278f, 0.083984f, 0.026769f, -0.026675f, -0.055474f, -0.047047f, 0.013213f, 0.086560f, 0.077400f, -0.045480f, -0.163909f, -0.129214f, 0.043758f, 0.175933f, 0.127868f, -0.049601f, -0.180439f, -0.137651f, 0.052675f, 0.234778f, 0.236480f, 0.010892f, -0.289848f, -0.406696f, -0.199317f, 0.197493f, 0.469040f, 0.397807f, 0.046354f, -0.322545f, -0.468248f, -0.318816f, 0.016454f, 0.310017f, 0.346651f, 0.098294f, -0.221806f, -0.346664f, -0.208015f, 0.035716f, 0.193229f, 0.193558f, 0.075689f, -0.072428f, -0.150923f, -0.107610f, 0.006695f, 0.087971f, 0.092255f, 0.056253f, 0.015739f, -0.032245f, -0.079781f, -0.083034f, -0.014615f, 0.089696f, 0.154426f, 0.123634f, 0.002731f, -0.138293f, -0.205577f, -0.144256f, 0.023592f, 0.204895f, 0.274530f, 0.152777f, -0.101900f, + -0.295208f, -0.258308f, -0.020261f, 0.218863f, 0.284976f, 0.163152f, -0.041509f, -0.202170f, -0.226051f, -0.094405f, 0.104341f, 0.218536f, 0.156668f, -0.030494f, -0.195911f, -0.216775f, -0.081593f, 0.109457f, 0.220309f, 0.178121f, 0.021465f, -0.139141f, -0.204869f, -0.144590f, 0.000310f, 0.143372f, 0.198182f, 0.129450f, -0.020845f, -0.158913f, -0.200904f, -0.124769f, 0.021000f, 0.150172f, 0.188658f, 0.114798f, -0.027787f, -0.152279f, -0.179398f, -0.089884f, 0.058928f, 0.169173f, 0.167794f, 0.056364f, -0.088343f, -0.166696f, -0.128392f, -0.008387f, 0.104990f, 0.139226f, 0.083218f, -0.017082f, -0.094263f, -0.101195f, -0.040770f, 0.037436f, 0.077783f, 0.061206f, 0.010263f, -0.037948f, -0.056549f, -0.037758f, 0.005507f, 0.045018f, 0.054580f, 0.028455f, -0.015674f, -0.049328f, -0.050522f, -0.017695f, 0.027351f, 0.053643f, 0.043687f, 0.005142f, -0.036341f, -0.054174f, -0.036930f, 0.003847f, 0.040664f, 0.049542f, 0.026191f, -0.013462f, -0.044536f, -0.047143f, -0.018626f, 0.022384f, 0.047736f, 0.040751f, 0.007424f, -0.030301f, -0.049175f, -0.036865f, 0.000315f, 0.037910f, 0.048008f, 0.021595f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.012810f, 0.017121f, -0.023611f, -0.082779f, -0.097690f, -0.047262f, 0.003538f, -0.014083f, -0.064057f, -0.047354f, 0.048792f, 0.120644f, 0.089100f, 0.001721f, -0.043962f, -0.022900f, 0.017583f, 0.037386f, 0.030687f, -0.002922f, -0.063400f, -0.126153f, -0.144334f, -0.086185f, 0.032835f, 0.150889f, 0.195961f, 0.137894f, 0.011539f, -0.113968f, -0.181198f, -0.161076f, -0.058453f, 0.071727f, 0.142268f, 0.108887f, 0.016631f, -0.056570f, -0.081227f, -0.070812f, -0.030359f, 0.034923f, 0.081499f, 0.061830f, -0.004604f, -0.047571f, -0.035610f, -0.003534f, + 0.009115f, -0.000319f, -0.020183f, -0.041016f, -0.041611f, -0.003773f, 0.046603f, 0.054526f, 0.007769f, -0.042029f, -0.045486f, -0.009557f, 0.027952f, 0.041716f, 0.020226f, -0.034935f, -0.082451f, -0.052855f, 0.067431f, 0.182815f, 0.167146f, 0.000542f, -0.196812f, -0.268389f, -0.149445f, 0.085226f, 0.270625f, 0.265537f, 0.065877f, -0.177799f, -0.277049f, -0.161586f, 0.068272f, 0.229927f, 0.201780f, 0.013838f, -0.174864f, -0.203990f, -0.050350f, 0.150974f, 0.228536f, 0.119486f, -0.091186f, -0.245501f, -0.226405f, -0.041472f, 0.173638f, 0.252608f, 0.134739f, -0.081479f, -0.221452f, -0.178708f, 0.001454f, 0.162331f, 0.170094f, 0.032187f, -0.113890f, -0.136053f, -0.028907f, 0.093083f, 0.102565f, -0.030299f, -0.193574f, -0.205108f, 0.008998f, 0.290020f, 0.365118f, 0.129023f, -0.234351f, -0.434369f, -0.331419f, -0.008847f, 0.322445f, 0.447517f, 0.268626f, -0.099026f, -0.380143f, -0.363636f, -0.086151f, 0.218452f, 0.324767f, 0.169512f, -0.128360f, -0.348997f, -0.317778f, -0.041811f, 0.284101f, 0.425294f, 0.278163f, -0.066005f, -0.380018f, -0.441335f, -0.192691f, 0.193578f, 0.437660f, 0.374721f, + 0.073156f, -0.242365f, -0.365871f, -0.241897f, 0.016610f, 0.223753f, 0.259028f, 0.134684f, -0.050067f, -0.188486f, -0.205413f, -0.082246f, 0.109284f, 0.229395f, 0.179624f, -0.005002f, -0.187280f, -0.240503f, -0.130300f, 0.073329f, 0.236329f, 0.243713f, 0.086673f, -0.127247f, -0.259240f, -0.233003f, -0.063739f, 0.159671f, 0.308964f, 0.280537f, 0.073767f, -0.191300f, -0.350944f, -0.305382f, -0.077143f, 0.201310f, 0.358878f, 0.291196f, 0.037878f, -0.237347f, -0.357198f, -0.247564f, 0.017429f, 0.263077f, 0.328331f, 0.178240f, -0.072736f, -0.251639f, -0.252638f, -0.095911f, 0.103704f, 0.215867f, 0.175373f, 0.023225f, -0.125971f, -0.172388f, -0.099721f, 0.028833f, 0.125421f, 0.132450f, 0.051941f, -0.058847f, -0.126257f, -0.109294f, -0.022168f, 0.079059f, 0.129283f, 0.093201f, -0.006765f, -0.101922f, -0.128550f, -0.072571f, 0.028351f, 0.111315f, 0.121172f, 0.046684f, -0.061735f, -0.126442f, -0.106310f, -0.021901f, 0.072214f, 0.120632f, 0.088840f, -0.009190f, -0.104607f, -0.127005f, -0.067985f, 0.024784f, 0.097959f, 0.111625f, 0.044173f, -0.070680f, -0.140051f, -0.106843f, -0.028244f, 0.003835f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.012810f, 0.017121f, -0.023611f, -0.082779f, -0.097690f, -0.047262f, 0.003538f, -0.014083f, -0.064057f, -0.047354f, 0.048792f, 0.120644f, 0.089100f, 0.001721f, -0.043962f, -0.022900f, 0.017583f, 0.037386f, 0.030687f, -0.002922f, -0.063400f, -0.126153f, -0.144334f, -0.086185f, 0.032835f, 0.150889f, 0.195961f, 0.137894f, 0.011539f, -0.113968f, -0.181198f, -0.161076f, -0.058453f, 0.071727f, 0.142268f, 0.108887f, 0.016631f, -0.056570f, -0.081227f, -0.070812f, -0.030359f, 0.034923f, 0.081499f, 0.061830f, -0.004604f, -0.047571f, -0.035610f, -0.003534f, + 0.009115f, -0.000319f, -0.020183f, -0.041016f, -0.041611f, -0.003773f, 0.046603f, 0.054526f, 0.007769f, -0.042029f, -0.045486f, -0.009557f, 0.027952f, 0.041716f, 0.020226f, -0.034935f, -0.082451f, -0.052855f, 0.067431f, 0.182815f, 0.167146f, 0.000542f, -0.196812f, -0.268389f, -0.149445f, 0.085226f, 0.270625f, 0.265537f, 0.065877f, -0.177799f, -0.277049f, -0.161586f, 0.068272f, 0.229927f, 0.201780f, 0.013838f, -0.174864f, -0.203990f, -0.050350f, 0.150974f, 0.228536f, 0.119486f, -0.091186f, -0.245501f, -0.226405f, -0.041472f, 0.173638f, 0.252608f, 0.134739f, -0.081479f, -0.221452f, -0.178708f, 0.001454f, 0.162331f, 0.170094f, 0.032187f, -0.113890f, -0.136053f, -0.028907f, 0.093083f, 0.102565f, -0.030299f, -0.193574f, -0.205108f, 0.008998f, 0.290020f, 0.365118f, 0.129023f, -0.234351f, -0.434369f, -0.331419f, -0.008847f, 0.322445f, 0.447517f, 0.268626f, -0.099026f, -0.380143f, -0.363636f, -0.086151f, 0.218452f, 0.324767f, 0.169512f, -0.128360f, -0.348997f, -0.317778f, -0.041811f, 0.284101f, 0.425294f, 0.278163f, -0.066005f, -0.380018f, -0.441335f, -0.192691f, 0.193578f, 0.437660f, 0.374721f, + 0.073156f, -0.242365f, -0.365871f, -0.241897f, 0.016610f, 0.223753f, 0.259028f, 0.134684f, -0.050067f, -0.188486f, -0.205413f, -0.082246f, 0.109284f, 0.229395f, 0.179624f, -0.005002f, -0.187280f, -0.240503f, -0.130300f, 0.073329f, 0.236329f, 0.243713f, 0.086673f, -0.127247f, -0.259240f, -0.233003f, -0.063739f, 0.159671f, 0.308964f, 0.280537f, 0.073767f, -0.191300f, -0.350944f, -0.305382f, -0.077143f, 0.201310f, 0.358878f, 0.291196f, 0.037878f, -0.237347f, -0.357198f, -0.247564f, 0.017429f, 0.263077f, 0.328331f, 0.178240f, -0.072736f, -0.251639f, -0.252638f, -0.095911f, 0.103704f, 0.215867f, 0.175373f, 0.023225f, -0.125971f, -0.172388f, -0.099721f, 0.028833f, 0.125421f, 0.132450f, 0.051941f, -0.058847f, -0.126257f, -0.109294f, -0.022168f, 0.079059f, 0.129283f, 0.093201f, -0.006765f, -0.101922f, -0.128550f, -0.072571f, 0.028351f, 0.111315f, 0.121172f, 0.046684f, -0.061735f, -0.126442f, -0.106310f, -0.021901f, 0.072214f, 0.120632f, 0.088840f, -0.009190f, -0.104607f, -0.127005f, -0.067985f, 0.024784f, 0.097959f, 0.111625f, 0.044173f, -0.070680f, -0.140051f, -0.106843f, -0.028244f, 0.003835f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.029791f, 0.024110f, -0.069304f, -0.130401f, -0.085262f, 0.006216f, 0.061602f, 0.061826f, 0.026628f, -0.004606f, 0.011353f, 0.052948f, 0.034573f, -0.055731f, -0.103650f, -0.035730f, 0.057306f, 0.059600f, -0.001972f, -0.030433f, -0.013414f, -0.002591f, -0.007411f, -0.002977f, 0.005818f, 0.000442f, -0.010228f, -0.013244f, -0.017363f, -0.023452f, -0.008716f, 0.033524f, 0.069024f, 0.055839f, -0.013104f, -0.100332f, -0.144914f, -0.105970f, -0.000370f, 0.108920f, 0.160986f, 0.126541f, 0.016373f, -0.107671f, -0.155852f, -0.090466f, 0.027694f, 0.103208f, + 0.098438f, 0.041483f, -0.022387f, -0.056657f, -0.044930f, -0.009068f, 0.007643f, -0.005925f, -0.017102f, 0.000388f, 0.033678f, 0.052923f, 0.040762f, 0.002035f, -0.035302f, -0.040325f, -0.016264f, 0.002588f, 0.000851f, -0.002960f, 0.001441f, 0.001402f, -0.003146f, 0.003277f, 0.011551f, -0.004707f, -0.033186f, -0.024937f, 0.033432f, 0.087446f, 0.067114f, -0.043920f, -0.181385f, -0.232496f, -0.127400f, 0.078283f, 0.237096f, 0.238411f, 0.085260f, -0.132160f, -0.284340f, -0.251887f, -0.021421f, 0.253375f, 0.359173f, 0.218792f, -0.048761f, -0.249223f, -0.260654f, -0.099663f, 0.101050f, 0.198522f, 0.159174f, 0.058430f, -0.031748f, -0.097275f, -0.132936f, -0.122891f, -0.072162f, 0.016981f, 0.166135f, 0.314974f, 0.263987f, -0.091368f, -0.493974f, -0.515637f, -0.067111f, 0.458150f, 0.608909f, 0.301278f, -0.206671f, -0.583004f, -0.596864f, -0.210518f, 0.349032f, 0.683896f, 0.527981f, -0.010869f, -0.525143f, -0.628249f, -0.250030f, 0.308015f, 0.604156f, 0.412175f, -0.096447f, -0.509530f, -0.516905f, -0.136172f, 0.330713f, 0.537549f, 0.347513f, -0.078045f, -0.419811f, -0.448500f, -0.174447f, 0.193565f, + 0.408604f, 0.344319f, 0.066223f, -0.223687f, -0.334280f, -0.214764f, 0.027577f, 0.217668f, 0.235731f, 0.092407f, -0.092216f, -0.187384f, -0.143646f, -0.008730f, 0.119555f, 0.154758f, 0.074853f, -0.056258f, -0.134173f, -0.103117f, 0.001304f, 0.096629f, 0.123197f, 0.072209f, -0.023827f, -0.111784f, -0.143975f, -0.099795f, 0.009761f, 0.142703f, 0.226341f, 0.188521f, 0.023708f, -0.176065f, -0.279523f, -0.213944f, -0.014716f, 0.197635f, 0.287516f, 0.191524f, -0.027916f, -0.220273f, -0.259018f, -0.130380f, 0.070024f, 0.210319f, 0.206432f, 0.073049f, -0.089660f, -0.172086f, -0.134166f, -0.020411f, 0.087567f, 0.127411f, 0.085585f, -0.002683f, -0.078455f, -0.096583f, -0.050914f, 0.026485f, 0.085166f, 0.085645f, 0.027073f, -0.049349f, -0.091109f, -0.072469f, -0.007296f, 0.063448f, 0.094260f, 0.062457f, -0.011791f, -0.076761f, -0.088888f, -0.042905f, 0.030553f, 0.085880f, 0.086676f, 0.029792f, -0.046997f, -0.091054f, -0.074773f, -0.010929f, 0.060994f, 0.096279f, 0.068699f, -0.006224f, -0.075203f, -0.089687f, -0.044579f, 0.027610f, 0.085692f, 0.095106f, 0.041487f, -0.043449f, -0.087234f, -0.044234f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.029791f, 0.024110f, -0.069304f, -0.130401f, -0.085262f, 0.006216f, 0.061602f, 0.061826f, 0.026628f, -0.004606f, 0.011353f, 0.052948f, 0.034573f, -0.055731f, -0.103650f, -0.035730f, 0.057306f, 0.059600f, -0.001972f, -0.030433f, -0.013414f, -0.002591f, -0.007411f, -0.002977f, 0.005818f, 0.000442f, -0.010228f, -0.013244f, -0.017363f, -0.023452f, -0.008716f, 0.033524f, 0.069024f, 0.055839f, -0.013104f, -0.100332f, -0.144914f, -0.105970f, -0.000370f, 0.108920f, 0.160986f, 0.126541f, 0.016373f, -0.107671f, -0.155852f, -0.090466f, 0.027694f, 0.103208f, + 0.098438f, 0.041483f, -0.022387f, -0.056657f, -0.044930f, -0.009068f, 0.007643f, -0.005925f, -0.017102f, 0.000388f, 0.033678f, 0.052923f, 0.040762f, 0.002035f, -0.035302f, -0.040325f, -0.016264f, 0.002588f, 0.000851f, -0.002960f, 0.001441f, 0.001402f, -0.003146f, 0.003277f, 0.011551f, -0.004707f, -0.033186f, -0.024937f, 0.033432f, 0.087446f, 0.067114f, -0.043920f, -0.181385f, -0.232496f, -0.127400f, 0.078283f, 0.237096f, 0.238411f, 0.085260f, -0.132160f, -0.284340f, -0.251887f, -0.021421f, 0.253375f, 0.359173f, 0.218792f, -0.048761f, -0.249223f, -0.260654f, -0.099663f, 0.101050f, 0.198522f, 0.159174f, 0.058430f, -0.031748f, -0.097275f, -0.132936f, -0.122891f, -0.072162f, 0.016981f, 0.166135f, 0.314974f, 0.263987f, -0.091368f, -0.493974f, -0.515637f, -0.067111f, 0.458150f, 0.608909f, 0.301278f, -0.206671f, -0.583004f, -0.596864f, -0.210518f, 0.349032f, 0.683896f, 0.527981f, -0.010869f, -0.525143f, -0.628249f, -0.250030f, 0.308015f, 0.604156f, 0.412175f, -0.096447f, -0.509530f, -0.516905f, -0.136172f, 0.330713f, 0.537549f, 0.347513f, -0.078045f, -0.419811f, -0.448500f, -0.174447f, 0.193565f, + 0.408604f, 0.344319f, 0.066223f, -0.223687f, -0.334280f, -0.214764f, 0.027577f, 0.217668f, 0.235731f, 0.092407f, -0.092216f, -0.187384f, -0.143646f, -0.008730f, 0.119555f, 0.154758f, 0.074853f, -0.056258f, -0.134173f, -0.103117f, 0.001304f, 0.096629f, 0.123197f, 0.072209f, -0.023827f, -0.111784f, -0.143975f, -0.099795f, 0.009761f, 0.142703f, 0.226341f, 0.188521f, 0.023708f, -0.176065f, -0.279523f, -0.213944f, -0.014716f, 0.197635f, 0.287516f, 0.191524f, -0.027916f, -0.220273f, -0.259018f, -0.130380f, 0.070024f, 0.210319f, 0.206432f, 0.073049f, -0.089660f, -0.172086f, -0.134166f, -0.020411f, 0.087567f, 0.127411f, 0.085585f, -0.002683f, -0.078455f, -0.096583f, -0.050914f, 0.026485f, 0.085166f, 0.085645f, 0.027073f, -0.049349f, -0.091109f, -0.072469f, -0.007296f, 0.063448f, 0.094260f, 0.062457f, -0.011791f, -0.076761f, -0.088888f, -0.042905f, 0.030553f, 0.085880f, 0.086676f, 0.029792f, -0.046997f, -0.091054f, -0.074773f, -0.010929f, 0.060994f, 0.096279f, 0.068699f, -0.006224f, -0.075203f, -0.089687f, -0.044579f, 0.027610f, 0.085692f, 0.095106f, 0.041487f, -0.043449f, -0.087234f, -0.044234f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.000227f, -0.002434f, -0.006371f, -0.005852f, 0.003422f, 0.013194f, 0.010306f, 0.000609f, 0.009746f, 0.041053f, 0.041909f, -0.053172f, -0.224031f, -0.328861f, -0.212799f, 0.119077f, 0.453213f, 0.528605f, 0.265581f, -0.160498f, -0.459728f, -0.442806f, -0.145618f, 0.205982f, 0.366896f, 0.263152f, 0.033124f, -0.128153f, -0.146884f, -0.080417f, -0.004630f, 0.046244f, 0.058165f, 0.031565f, -0.001707f, -0.007509f, 0.005418f, 0.006823f, -0.003169f, -0.003630f, 0.003603f, 0.001845f, -0.004494f, 0.000070f, 0.010543f, 0.011916f, 0.006050f, 0.002164f, + -0.002925f, -0.013410f, -0.019079f, -0.007795f, 0.018241f, 0.044303f, 0.049434f, 0.017318f, -0.040180f, -0.078747f, -0.061217f, 0.005109f, 0.079596f, 0.117901f, 0.086965f, -0.010244f, -0.106381f, -0.107315f, 0.007940f, 0.145315f, 0.176265f, 0.053685f, -0.143549f, -0.256951f, -0.162535f, 0.104473f, 0.336910f, 0.320135f, 0.033931f, -0.317857f, -0.468252f, -0.279924f, 0.153382f, 0.536750f, 0.556697f, 0.141477f, -0.428879f, -0.720055f, -0.496892f, 0.087157f, 0.612777f, 0.706055f, 0.304070f, -0.303380f, -0.685050f, -0.579946f, -0.077082f, 0.458582f, 0.648014f, 0.369868f, -0.147642f, -0.506783f, -0.464135f, -0.107346f, 0.268733f, 0.423470f, 0.309063f, 0.031997f, -0.240519f, -0.354770f, -0.241661f, 0.028462f, 0.271225f, 0.310837f, 0.120162f, -0.143877f, -0.265328f, -0.158945f, 0.061584f, 0.206310f, 0.178584f, 0.018483f, -0.169786f, -0.282924f, -0.243263f, -0.041576f, 0.213320f, 0.334703f, 0.207300f, -0.087317f, -0.316168f, -0.290611f, -0.028146f, 0.271263f, 0.392790f, 0.255340f, -0.052602f, -0.331312f, -0.388780f, -0.180198f, 0.140850f, 0.342677f, 0.304005f, 0.078584f, -0.186507f, -0.340994f, + -0.278789f, -0.004723f, 0.314381f, 0.440181f, 0.262605f, -0.098861f, -0.394319f, -0.426068f, -0.170914f, 0.201793f, 0.427423f, 0.336748f, 0.002592f, -0.313868f, -0.381218f, -0.172282f, 0.143607f, 0.344160f, 0.307339f, 0.080090f, -0.171614f, -0.289435f, -0.224392f, -0.043742f, 0.134709f, 0.217269f, 0.178119f, 0.057729f, -0.076133f, -0.166550f, -0.176536f, -0.092477f, 0.053325f, 0.176577f, 0.192057f, 0.083697f, -0.079927f, -0.194856f, -0.187501f, -0.059074f, 0.109164f, 0.203789f, 0.160020f, 0.010581f, -0.140886f, -0.194673f, -0.119629f, 0.029076f, 0.148102f, 0.160130f, 0.069250f, -0.050698f, -0.119204f, -0.102947f, -0.025635f, 0.056163f, 0.090550f, 0.062735f, 0.000519f, -0.051928f, -0.065469f, -0.037089f, 0.014860f, 0.058879f, 0.065414f, 0.028340f, -0.027221f, -0.063228f, -0.056563f, -0.012689f, 0.039984f, 0.067450f, 0.051074f, 0.000941f, -0.049696f, -0.066689f, -0.037833f, 0.018657f, 0.064810f, 0.067842f, 0.024304f, -0.035973f, -0.071598f, -0.059345f, -0.008405f, 0.047905f, 0.073449f, 0.051018f, -0.005755f, -0.059063f, -0.072066f, -0.035915f, 0.023891f, 0.067410f, 0.068347f, 0.028263f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -0.000227f, -0.002434f, -0.006371f, -0.005852f, 0.003422f, 0.013194f, 0.010306f, 0.000609f, 0.009746f, 0.041053f, 0.041909f, -0.053172f, -0.224031f, -0.328861f, -0.212799f, 0.119077f, 0.453213f, 0.528605f, 0.265581f, -0.160498f, -0.459728f, -0.442806f, -0.145618f, 0.205982f, 0.366896f, 0.263152f, 0.033124f, -0.128153f, -0.146884f, -0.080417f, -0.004630f, 0.046244f, 0.058165f, 0.031565f, -0.001707f, -0.007509f, 0.005418f, 0.006823f, -0.003169f, -0.003630f, 0.003603f, 0.001845f, -0.004494f, 0.000070f, 0.010543f, 0.011916f, 0.006050f, 0.002164f, + -0.002925f, -0.013410f, -0.019079f, -0.007795f, 0.018241f, 0.044303f, 0.049434f, 0.017318f, -0.040180f, -0.078747f, -0.061217f, 0.005109f, 0.079596f, 0.117901f, 0.086965f, -0.010244f, -0.106381f, -0.107315f, 0.007940f, 0.145315f, 0.176265f, 0.053685f, -0.143549f, -0.256951f, -0.162535f, 0.104473f, 0.336910f, 0.320135f, 0.033931f, -0.317857f, -0.468252f, -0.279924f, 0.153382f, 0.536750f, 0.556697f, 0.141477f, -0.428879f, -0.720055f, -0.496892f, 0.087157f, 0.612777f, 0.706055f, 0.304070f, -0.303380f, -0.685050f, -0.579946f, -0.077082f, 0.458582f, 0.648014f, 0.369868f, -0.147642f, -0.506783f, -0.464135f, -0.107346f, 0.268733f, 0.423470f, 0.309063f, 0.031997f, -0.240519f, -0.354770f, -0.241661f, 0.028462f, 0.271225f, 0.310837f, 0.120162f, -0.143877f, -0.265328f, -0.158945f, 0.061584f, 0.206310f, 0.178584f, 0.018483f, -0.169786f, -0.282924f, -0.243263f, -0.041576f, 0.213320f, 0.334703f, 0.207300f, -0.087317f, -0.316168f, -0.290611f, -0.028146f, 0.271263f, 0.392790f, 0.255340f, -0.052602f, -0.331312f, -0.388780f, -0.180198f, 0.140850f, 0.342677f, 0.304005f, 0.078584f, -0.186507f, -0.340994f, + -0.278789f, -0.004723f, 0.314381f, 0.440181f, 0.262605f, -0.098861f, -0.394319f, -0.426068f, -0.170914f, 0.201793f, 0.427423f, 0.336748f, 0.002592f, -0.313868f, -0.381218f, -0.172282f, 0.143607f, 0.344160f, 0.307339f, 0.080090f, -0.171614f, -0.289435f, -0.224392f, -0.043742f, 0.134709f, 0.217269f, 0.178119f, 0.057729f, -0.076133f, -0.166550f, -0.176536f, -0.092477f, 0.053325f, 0.176577f, 0.192057f, 0.083697f, -0.079927f, -0.194856f, -0.187501f, -0.059074f, 0.109164f, 0.203789f, 0.160020f, 0.010581f, -0.140886f, -0.194673f, -0.119629f, 0.029076f, 0.148102f, 0.160130f, 0.069250f, -0.050698f, -0.119204f, -0.102947f, -0.025635f, 0.056163f, 0.090550f, 0.062735f, 0.000519f, -0.051928f, -0.065469f, -0.037089f, 0.014860f, 0.058879f, 0.065414f, 0.028340f, -0.027221f, -0.063228f, -0.056563f, -0.012689f, 0.039984f, 0.067450f, 0.051074f, 0.000941f, -0.049696f, -0.066689f, -0.037833f, 0.018657f, 0.064810f, 0.067842f, 0.024304f, -0.035973f, -0.071598f, -0.059345f, -0.008405f, 0.047905f, 0.073449f, 0.051018f, -0.005755f, -0.059063f, -0.072066f, -0.035915f, 0.023891f, 0.067410f, 0.068347f, 0.028263f}, + }, + { + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.004115f, 0.009125f, 0.016225f, 0.033251f, 0.032426f, -0.031315f, -0.135128f, -0.164430f, -0.035388f, 0.167415f, 0.241609f, 0.084256f, -0.178409f, -0.310135f, -0.195933f, 0.064715f, 0.270673f, 0.291458f, 0.139852f, -0.075828f, -0.236252f, -0.263883f, -0.144853f, 0.059920f, 0.232089f, 0.264093f, 0.137743f, -0.062168f, -0.212453f, -0.231117f, -0.116280f, 0.059578f, 0.188187f, 0.188054f, 0.060964f, -0.102867f, -0.185488f, -0.128906f, 0.018750f, 0.144211f, 0.165501f, 0.089016f, -0.022643f, -0.112075f, -0.143092f, -0.092715f, 0.026352f, 0.142528f, + 0.166254f, 0.069143f, -0.087278f, -0.199059f, -0.192088f, -0.068502f, 0.095159f, 0.199275f, 0.185727f, 0.064675f, -0.099912f, -0.216128f, -0.203868f, -0.055079f, 0.140102f, 0.253126f, 0.212770f, 0.046625f, -0.145216f, -0.247596f, -0.200099f, -0.042475f, 0.121540f, 0.212253f, 0.207307f, 0.109139f, -0.056930f, -0.207888f, -0.237119f, -0.117290f, 0.065210f, 0.189049f, 0.183194f, 0.053937f, -0.115760f, -0.201508f, -0.131778f, 0.041281f, 0.189758f, 0.216623f, 0.106307f, -0.077753f, -0.213419f, -0.197205f, -0.051520f, 0.087320f, 0.120292f, 0.074726f, 0.023119f, -0.013465f, -0.045734f, -0.067816f, -0.068360f, -0.043142f, 0.016108f, 0.093680f, 0.120623f, 0.046712f, -0.067964f, -0.113625f, -0.071811f, -0.013098f, 0.025193f, 0.058275f, 0.062933f, -0.017179f, -0.153835f, -0.217254f, -0.119105f, 0.080427f, 0.233969f, 0.240559f, 0.110649f, -0.064180f, -0.186196f, -0.208446f, -0.136353f, -0.003219f, 0.128801f, 0.170680f, 0.074816f, -0.084557f, -0.152582f, -0.052058f, 0.120682f, 0.186491f, 0.068121f, -0.127402f, -0.213231f, -0.105805f, 0.099899f, 0.229804f, 0.185222f, 0.003810f, -0.185939f, -0.247274f, + -0.123553f, 0.100102f, 0.244984f, 0.197279f, 0.013797f, -0.149376f, -0.186311f, -0.101192f, 0.032385f, 0.128180f, 0.134745f, 0.069418f, -0.005307f, -0.051196f, -0.073898f, -0.074111f, -0.032267f, 0.040004f, 0.083997f, 0.059136f, -0.009774f, -0.069214f, -0.088217f, -0.061459f, -0.000879f, 0.055853f, 0.061914f, 0.012299f, -0.040249f, -0.041040f, 0.004255f, 0.038152f, 0.018698f, -0.033734f, -0.060953f, -0.031187f, 0.030588f, 0.073644f, 0.068387f, 0.020885f, -0.039193f, -0.074147f, -0.058976f, -0.003866f, 0.049731f, 0.064487f, 0.035818f, -0.011839f, -0.045313f, -0.042448f, -0.008624f, 0.024491f, 0.028481f, 0.005966f, -0.018425f, -0.026810f, -0.017873f, 0.001234f, 0.019172f, 0.023707f, 0.011971f, -0.006311f, -0.019466f, -0.021463f, -0.010479f, 0.008834f, 0.022854f, 0.020190f, 0.004268f, -0.012667f, -0.021982f, -0.018893f, -0.002121f, 0.017933f, 0.023398f, 0.010147f, -0.007076f, -0.015539f, -0.015889f, -0.010177f, 0.002857f, 0.016435f, 0.017618f, 0.005044f, -0.009322f, -0.016548f, -0.015687f, -0.006253f, 0.009272f, 0.019301f, 0.013731f, -0.002209f, -0.014788f, -0.017617f, -0.013120f, -0.004808f}, + {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.004115f, 0.009125f, 0.016225f, 0.033251f, 0.032426f, -0.031315f, -0.135128f, -0.164430f, -0.035388f, 0.167415f, 0.241609f, 0.084256f, -0.178409f, -0.310135f, -0.195933f, 0.064715f, 0.270673f, 0.291458f, 0.139852f, -0.075828f, -0.236252f, -0.263883f, -0.144853f, 0.059920f, 0.232089f, 0.264093f, 0.137743f, -0.062168f, -0.212453f, -0.231117f, -0.116280f, 0.059578f, 0.188187f, 0.188054f, 0.060964f, -0.102867f, -0.185488f, -0.128906f, 0.018750f, 0.144211f, 0.165501f, 0.089016f, -0.022643f, -0.112075f, -0.143092f, -0.092715f, 0.026352f, 0.142528f, + 0.166254f, 0.069143f, -0.087278f, -0.199059f, -0.192088f, -0.068502f, 0.095159f, 0.199275f, 0.185727f, 0.064675f, -0.099912f, -0.216128f, -0.203868f, -0.055079f, 0.140102f, 0.253126f, 0.212770f, 0.046625f, -0.145216f, -0.247596f, -0.200099f, -0.042475f, 0.121540f, 0.212253f, 0.207307f, 0.109139f, -0.056930f, -0.207888f, -0.237119f, -0.117290f, 0.065210f, 0.189049f, 0.183194f, 0.053937f, -0.115760f, -0.201508f, -0.131778f, 0.041281f, 0.189758f, 0.216623f, 0.106307f, -0.077753f, -0.213419f, -0.197205f, -0.051520f, 0.087320f, 0.120292f, 0.074726f, 0.023119f, -0.013465f, -0.045734f, -0.067816f, -0.068360f, -0.043142f, 0.016108f, 0.093680f, 0.120623f, 0.046712f, -0.067964f, -0.113625f, -0.071811f, -0.013098f, 0.025193f, 0.058275f, 0.062933f, -0.017179f, -0.153835f, -0.217254f, -0.119105f, 0.080427f, 0.233969f, 0.240559f, 0.110649f, -0.064180f, -0.186196f, -0.208446f, -0.136353f, -0.003219f, 0.128801f, 0.170680f, 0.074816f, -0.084557f, -0.152582f, -0.052058f, 0.120682f, 0.186491f, 0.068121f, -0.127402f, -0.213231f, -0.105805f, 0.099899f, 0.229804f, 0.185222f, 0.003810f, -0.185939f, -0.247274f, + -0.123553f, 0.100102f, 0.244984f, 0.197279f, 0.013797f, -0.149376f, -0.186311f, -0.101192f, 0.032385f, 0.128180f, 0.134745f, 0.069418f, -0.005307f, -0.051196f, -0.073898f, -0.074111f, -0.032267f, 0.040004f, 0.083997f, 0.059136f, -0.009774f, -0.069214f, -0.088217f, -0.061459f, -0.000879f, 0.055853f, 0.061914f, 0.012299f, -0.040249f, -0.041040f, 0.004255f, 0.038152f, 0.018698f, -0.033734f, -0.060953f, -0.031187f, 0.030588f, 0.073644f, 0.068387f, 0.020885f, -0.039193f, -0.074147f, -0.058976f, -0.003866f, 0.049731f, 0.064487f, 0.035818f, -0.011839f, -0.045313f, -0.042448f, -0.008624f, 0.024491f, 0.028481f, 0.005966f, -0.018425f, -0.026810f, -0.017873f, 0.001234f, 0.019172f, 0.023707f, 0.011971f, -0.006311f, -0.019466f, -0.021463f, -0.010479f, 0.008834f, 0.022854f, 0.020190f, 0.004268f, -0.012667f, -0.021982f, -0.018893f, -0.002121f, 0.017933f, 0.023398f, 0.010147f, -0.007076f, -0.015539f, -0.015889f, -0.010177f, 0.002857f, 0.016435f, 0.017618f, 0.005044f, -0.009322f, -0.016548f, -0.015687f, -0.006253f, 0.009272f, 0.019301f, 0.013731f, -0.002209f, -0.014788f, -0.017617f, -0.013120f, -0.004808f}, + }, +}; +#else const float CRendBin_HOA3_HRIR_coeff_re_48kHz[16][BINAURAL_CHANNELS][480]={ { {-0.007743f, -0.007558f, -0.007195f, -0.006666f, -0.005988f, -0.005184f, -0.004281f, -0.003308f, -0.002297f, -0.001282f, -0.000295f, 0.000632f, 0.001470f, 0.002193f, 0.002779f, 0.003212f, 0.003480f, 0.003577f, 0.003506f, 0.003272f, 0.002887f, 0.002371f, 0.001744f, 0.001033f, 0.000266f, -0.000524f, -0.001308f, -0.002054f, -0.002731f, -0.003314f, -0.003778f, -0.004105f, -0.004278f, -0.004290f, -0.004136f, -0.003818f, -0.003346f, -0.002730f, -0.001990f, -0.001147f, -0.000226f, 0.000744f, 0.001734f, 0.002716f, 0.003658f, 0.004535f, 0.005321f, 0.005993f, 0.006535f, 0.006932f, 0.007177f, 0.007266f, 0.007200f, 0.006986f, 0.006636f, 0.006164f, 0.005590f, 0.004934f, 0.004220f, 0.003472f, 0.002715f, 0.001972f, 0.001265f, 0.000614f, 0.000036f, -0.000456f, -0.000852f, -0.001146f, -0.001339f, -0.001431f, -0.001430f, -0.001345f, -0.001189f, -0.000977f, -0.000725f, -0.000450f, -0.000171f, 0.000097f, 0.000338f, 0.000538f, 0.000686f, 0.000774f, 0.000798f, 0.000755f, 0.000647f, 0.000478f, 0.000258f, -0.000005f, -0.000297f, -0.000604f, -0.000913f, -0.001206f, -0.001471f, -0.001692f, -0.001859f, -0.001960f, @@ -1037,6 +1428,7 @@ const float CRendBin_HOA3_HRIR_coeff_im_48kHz[16][BINAURAL_CHANNELS][480]={ -0.025960f, 0.182839f, 0.278925f, 0.086432f, -0.206817f, -0.257206f, -0.181695f, 0.010354f, 0.202964f, 0.229244f, 0.098833f, -0.087026f, -0.181307f, -0.141921f, -0.048110f, 0.075799f, 0.114635f, 0.060613f, -0.007091f, -0.085373f, -0.082937f, -0.027346f, 0.088356f, 0.139427f, 0.092503f, -0.030368f, -0.103502f, -0.107065f, -0.020528f, 0.052644f, 0.128449f, 0.060539f, -0.024419f, -0.053943f, -0.053067f, 0.104894f, 0.110330f, -0.030292f, -0.137751f, -0.137278f, 0.001888f, 0.123472f, 0.133148f, -0.007019f, -0.129875f, -0.123791f, 0.026745f, 0.121553f, 0.087812f, -0.059539f, -0.115914f, -0.041189f, 0.084327f, 0.080379f, -0.023472f, -0.085842f, -0.004187f, 0.058332f, 0.012800f, -0.041715f, -0.000345f, 0.009540f, 0.000671f, -0.007229f, 0.003356f, -0.001562f, 0.003583f, -0.001390f, 0.004748f, -0.004077f, 0.001544f, -0.004733f, -0.001209f, -0.004578f, 0.003593f, -0.002046f, 0.008076f, -0.006694f, 0.003824f, -0.000642f, 0.003010f, -0.005633f, 0.003952f, -0.007572f, 0.002614f, -0.004205f, 0.006070f, -0.002496f, 0.004053f, -0.001677f, 0.001551f, -0.006302f, 0.004819f, -0.002902f, 0.002256f, -0.003500f} } }; +#endif const float *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const float *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index aaf7fa7113..2ff892071b 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -138,4 +138,8 @@ extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp19[]; /* Mapping table of input config : output config with corresponding matrix */ extern const LS_CONVERSION_MAPPING ls_conversion_mapping[]; +#ifdef SPLIT_REND_WITH_HEAD_ROT +extern const int32_t split_rend_brate_tbl[]; +#endif + #endif /* IVAS_ROM_REND_H */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 1a7cd8b830..970146de56 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -76,6 +76,9 @@ ivas_error ivas_headTrack_open( set_zero( ( *hHeadTrackData )->Rmat_prev[i], 3 ); ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + ( *hHeadTrackData )->sr_pose_pred_axis = DEFAULT_AXIS; +#endif return IVAS_ERR_OK; } @@ -150,6 +153,46 @@ void QuatToRotMat( return; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*------------------------------------------------------------------------- + * Quat2EulerDegree() + * + * Quaternion handling: calculate corresponding Euler angles in degrees + *------------------------------------------------------------------------*/ +void Quat2EulerDegree( + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw */ + float *pitch, /* o : pitch */ + float *roll /* o : roll */ +) +{ + if ( quat.w != -3.0 ) + { + *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); + *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); + *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); + *yaw *= _180_OVER_PI; + *pitch *= _180_OVER_PI; + *roll *= _180_OVER_PI; + } + else + { + /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention + * + * yaw: rotate scene counter-clockwise in the horizontal plane + * pitch: rotate scene in the median plane, increase elevation with positive values + * roll: rotate scene from the right ear to the top + */ + *yaw = quat.z; + *pitch = quat.y; + *roll = quat.x; + } + + return; +} +#endif + /*------------------------------------------------------------------------- * Quat2Euler() * diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index f89564fffc..f8e62daaa2 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -1,65 +1,72 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby +International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der +angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips +N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge +Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. + The IVAS codec Public Collaboration consisting of Dolby International AB, +Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung +e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph +and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings +Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their +respective contributions in the software. This notice grants no license of any +kind, including but not limited to patent license, nor is any license granted by +implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration +agreement before making contributions. + + This software is provided "AS IS", without any express or implied warranties. +The software is in the development stage. It is intended exclusively for experts +who have experience with such software and solely for the purpose of inspection. +All implied warranties of non-infringement, merchantability and fitness for a +particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing +this software shall be submitted to and settled by the final, binding +jurisdiction of the courts of Munich, Germany in accordance with the laws of the +Federal Republic of Germany excluding its conflict of law rules and the United +Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -#include -#include "options.h" -#include -#include "ivas_prot.h" -#include "prot.h" #include "cnst.h" #include "ivas_cnst.h" -#include "ivas_rom_rend.h" +#include "ivas_lib_rend_internal.h" +#include "ivas_prot.h" +#include "ivas_rom_binauralRenderer.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" -#include "ivas_rom_binauralRenderer.h" +#include "ivas_rom_rend.h" #include "lib_rend.h" -#include "ivas_lib_rend_internal.h" +#include "options.h" +#include "prot.h" +#include +#include +#include #ifdef DEBUGGING #include "debug.h" #endif #include "wmops.h" - #ifdef SPLIT_REND_WITH_HEAD_ROT -ivas_error ivas_splitBinLCLDDecOpen( - BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, - int32_t iSampleRate, - int32_t iChannels ) +ivas_error +ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, + int32_t iSampleRate, + int32_t iChannels ) { ivas_error error; BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec; error = IVAS_ERR_OK; - if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) count_malloc( sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL ) + if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) count_malloc( + sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD decoder Module \n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, + "Can not allocate memory for LCLD decoder Module \n" ) ); } splitBinLCLDDec->pLcld_dec = NULL; // place holder for CLDFB decoder handle @@ -67,12 +74,16 @@ ivas_error ivas_splitBinLCLDDecOpen( splitBinLCLDDec->iChannels = iChannels; splitBinLCLDDec->psCQMFDecoder = CreateCQMFDecoder( iSampleRate, iChannels ); - splitBinLCLDDec->pppfDecCQMFReal = (float ***) malloc( iChannels * sizeof( float ** ) ); - splitBinLCLDDec->pppfDecCQMFImag = (float ***) malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDDec->pppfDecCQMFReal = + (float ***) count_malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDDec->pppfDecCQMFImag = + (float ***) count_malloc( iChannels * sizeof( float ** ) ); for ( int32_t n = 0; n < splitBinLCLDDec->iChannels; n++ ) { - splitBinLCLDDec->pppfDecCQMFReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); - splitBinLCLDDec->pppfDecCQMFImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDDec->pppfDecCQMFReal[n] = + (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDDec->pppfDecCQMFImag[n] = + (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); } #ifdef CLDFB_DEBUG @@ -80,7 +91,8 @@ ivas_error ivas_splitBinLCLDDecOpen( char cldfbFilename[50] = "cldfb_out.bin"; if ( ( splitBinLCLDDec->cldfbOut = fopen( cldfbFilename, "wb" ) ) == NULL ) { - fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); + fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", + cldfbFilename ); exit( -1 ); } int num_bands = CLDFB_NO_CHANNELS_MAX; @@ -92,8 +104,7 @@ ivas_error ivas_splitBinLCLDDecOpen( return error; } -void ivas_splitBinLCLDDecClose( - BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ) +void ivas_splitBinLCLDDecClose( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ) { if ( ( *hSplitBinLCLDDec ) != NULL ) { @@ -104,11 +115,11 @@ void ivas_splitBinLCLDDecClose( for ( int32_t n = 0; n < ( *hSplitBinLCLDDec )->iChannels; n++ ) { - free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal[n] ); - free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag[n] ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal[n] ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag[n] ); } - free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal ); - free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFReal ); + count_free( ( *hSplitBinLCLDDec )->pppfDecCQMFImag ); #ifdef CLDFB_DEBUG if ( ( *hSplitBinLCLDDec )->cldfbOut != NULL ) @@ -134,45 +145,26 @@ void ivas_splitBinLCLDDecProcess( assert( Cldfb_Out_Imag != NULL ); assert( pBits != NULL ); - int32_t iBytesWritten; - unsigned char auchData[4096]; - unsigned char *bval; - - iBytesWritten = ivas_split_rend_bitstream_read_int32( pBits, 8 * sizeof( uint16_t ) ); #ifdef CLDFB_DEBUG printf( "Bytes read = %d\n", iBytesWritten ); #endif - bval = auchData; - for ( int32_t bytesCount = 0; bytesCount < iBytesWritten; bytesCount++ ) - { - *bval = (uint8_t) ivas_split_rend_bitstream_read_int32( pBits, 8 ); - bval++; - } - // A conversion is needed for the 3d pointer interface here ........ :( + // Initialized with zeros....... :( for ( int32_t n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) { for ( int32_t k = 0; k < CLDFB_NO_COL_MAX; k++ ) { hSplitBinLCLDDec->pppfDecCQMFReal[n][k] = Cldfb_Out_Real[n][k]; hSplitBinLCLDDec->pppfDecCQMFImag[n][k] = Cldfb_Out_Imag[n][k]; + set_f( hSplitBinLCLDDec->pppfDecCQMFReal[n][k], 0, CLDFB_NO_CHANNELS_MAX ); + set_f( hSplitBinLCLDDec->pppfDecCQMFImag[n][k], 0, CLDFB_NO_CHANNELS_MAX ); } } - // Initialized with zeros....... :( - for ( int k = 0; k < CLDFB_NO_COL_MAX; k++ ) - { - for ( int b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) - { - for ( int n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) - { - hSplitBinLCLDDec->pppfDecCQMFReal[n][k][b] = 0.0; - hSplitBinLCLDDec->pppfDecCQMFImag[n][k][b] = 0.0; - } - } - } - - DecodeFrame( hSplitBinLCLDDec->psCQMFDecoder, iBytesWritten, auchData, hSplitBinLCLDDec->pppfDecCQMFReal, hSplitBinLCLDDec->pppfDecCQMFImag ); + DecodeFrame( hSplitBinLCLDDec->psCQMFDecoder, + pBits, + hSplitBinLCLDDec->pppfDecCQMFReal, + hSplitBinLCLDDec->pppfDecCQMFImag ); #ifdef CLDFB_DEBUG printf( "Frame Decoded = %d\n", ++hSplitBinLCLDDec->numFrame ); @@ -183,10 +175,12 @@ void ivas_splitBinLCLDDecProcess( { for ( int n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) { - writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFReal[n][k][b], sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut ); + writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFReal[n][k][b], + sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut ); if ( writeByte != 1 ) exit( -1 ); - writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFImag[n][k][b], sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut ); + writeByte = fwrite( &hSplitBinLCLDDec->pppfDecCQMFImag[n][k][b], + sizeof( float ), 1, hSplitBinLCLDDec->cldfbOut ); if ( writeByte != 1 ) exit( -1 ); } diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index 97da222528..09df0d11ea 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -1,79 +1,92 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby +International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der +angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips +N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge +Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. + The IVAS codec Public Collaboration consisting of Dolby International AB, +Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung +e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph +and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings +Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their +respective contributions in the software. This notice grants no license of any +kind, including but not limited to patent license, nor is any license granted by +implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration +agreement before making contributions. + + This software is provided "AS IS", without any express or implied warranties. +The software is in the development stage. It is intended exclusively for experts +who have experience with such software and solely for the purpose of inspection. +All implied warranties of non-infringement, merchantability and fitness for a +particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing +this software shall be submitted to and settled by the final, binding +jurisdiction of the courts of Munich, Germany in accordance with the laws of the +Federal Republic of Germany excluding its conflict of law rules and the United +Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -#include -#include "options.h" -#include -#include "ivas_prot.h" -#include "prot.h" #include "cnst.h" #include "ivas_cnst.h" -#include "ivas_rom_rend.h" +#include "ivas_lib_rend_internal.h" +#include "ivas_prot.h" +#include "ivas_rom_binauralRenderer.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" -#include "ivas_rom_binauralRenderer.h" +#include "ivas_rom_rend.h" #include "lib_rend.h" -#include "ivas_lib_rend_internal.h" +#include "options.h" +#include "prot.h" +#include +#include +#include #ifdef DEBUGGING #include "debug.h" #endif #include "wmops.h" #ifdef SPLIT_REND_WITH_HEAD_ROT -ivas_error ivas_splitBinLCLDEncOpen( - BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, - int32_t iSampleRate, - int32_t iChannels, - int32_t iDataRate ) +ivas_error +ivas_splitBinLCLDEncOpen( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, + int32_t iSampleRate, + int32_t iChannels, + int32_t iDataRate ) { ivas_error error; BIN_HR_SPLIT_LCLD_ENC_HANDLE splitBinLCLDEnc; error = IVAS_ERR_OK; - if ( ( splitBinLCLDEnc = (BIN_HR_SPLIT_LCLD_ENC_HANDLE) count_malloc( sizeof( BIN_HR_SPLIT_LCLD_ENC ) ) ) == NULL ) + if ( ( splitBinLCLDEnc = (BIN_HR_SPLIT_LCLD_ENC_HANDLE) count_malloc( + sizeof( BIN_HR_SPLIT_LCLD_ENC ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD encoder Module \n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, + "Can not allocate memory for LCLD encoder Module \n" ) ); } splitBinLCLDEnc->pLcld_enc = NULL; // place holder for CLDFB encoder handle splitBinLCLDEnc->iChannels = iChannels; - splitBinLCLDEnc->psCQMFEncoder = CreateCQMFEncoder( iSampleRate, iChannels, iDataRate ); + splitBinLCLDEnc->psCQMFEncoder = + CreateCQMFEncoder( iSampleRate, iChannels, iDataRate, 1 ); - splitBinLCLDEnc->pppfCQMFReal = (float ***) malloc( iChannels * sizeof( float ** ) ); - splitBinLCLDEnc->pppfCQMFImag = (float ***) malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDEnc->pppfCQMFReal = + (float ***) count_malloc( iChannels * sizeof( float ** ) ); + splitBinLCLDEnc->pppfCQMFImag = + (float ***) count_malloc( iChannels * sizeof( float ** ) ); for ( int32_t n = 0; n < splitBinLCLDEnc->iChannels; n++ ) { - splitBinLCLDEnc->pppfCQMFReal[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); - splitBinLCLDEnc->pppfCQMFImag[n] = (float **) malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDEnc->pppfCQMFReal[n] = + (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); + splitBinLCLDEnc->pppfCQMFImag[n] = + (float **) count_malloc( CLDFB_NO_COL_MAX * sizeof( float * ) ); } #ifdef CLDFB_DEBUG @@ -81,7 +94,8 @@ ivas_error ivas_splitBinLCLDEncOpen( char cldfbFilename[50] = "cldfb_in_ref.qmf"; if ( ( splitBinLCLDEnc->cldfbIn = fopen( cldfbFilename, "rb" ) ) == NULL ) { - fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); + fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", + cldfbFilename ); exit( -1 ); } int chan, band; @@ -93,8 +107,7 @@ ivas_error ivas_splitBinLCLDEncOpen( return error; } -void ivas_splitBinLCLDEncClose( - BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ) +void ivas_splitBinLCLDEncClose( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc ) { if ( ( *hSplitBinLCLDEnc ) != NULL ) { @@ -102,11 +115,11 @@ void ivas_splitBinLCLDEncClose( for ( int32_t n = 0; n < ( *hSplitBinLCLDEnc )->iChannels; n++ ) { - free( ( *hSplitBinLCLDEnc )->pppfCQMFReal[n] ); - free( ( *hSplitBinLCLDEnc )->pppfCQMFImag[n] ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFReal[n] ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFImag[n] ); } - free( ( *hSplitBinLCLDEnc )->pppfCQMFReal ); - free( ( *hSplitBinLCLDEnc )->pppfCQMFImag ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFReal ); + count_free( ( *hSplitBinLCLDEnc )->pppfCQMFImag ); #ifdef CLDFB_DEBUG if ( ( *hSplitBinLCLDEnc )->cldfbIn != NULL ) @@ -125,6 +138,7 @@ void ivas_splitBinLCLDEncProcess( BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int32_t available_bits, ivas_split_rend_bits_t *pBits ) { assert( hSplitBinLCLDEnc != NULL ); @@ -132,13 +146,7 @@ void ivas_splitBinLCLDEncProcess( assert( Cldfb_In_Imag != NULL ); assert( pBits != NULL ); - int32_t iBytesWritten; - uint16_t ushBytes; - unsigned char auchData[4096]; - unsigned char *bval; - int32_t code; - - iBytesWritten = 4096; + int32_t iBitsWritten; // A conversion is needed for the 3d pointer interface here ........ :( for ( int32_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) @@ -164,10 +172,12 @@ void ivas_splitBinLCLDEncProcess( break; readByte = fread(&hSplitBinLCLDEnc->pppfCQMFImag[n][k][b], sizeof(float), 1, hSplitBinLCLDEnc->cldfbIn); #else - readByte = fread( &Cldfb_In_Real[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); + readByte = fread( &Cldfb_In_Real[n][k][b], sizeof( float ), 1, + hSplitBinLCLDEnc->cldfbIn ); if ( readByte != 1 ) break; - readByte = fread( &Cldfb_In_Imag[n][k][b], sizeof( float ), 1, hSplitBinLCLDEnc->cldfbIn ); + readByte = fread( &Cldfb_In_Imag[n][k][b], sizeof( float ), 1, + hSplitBinLCLDEnc->cldfbIn ); #endif } } @@ -194,20 +204,13 @@ void ivas_splitBinLCLDEncProcess( } #endif - EncodeFrame( hSplitBinLCLDEnc->psCQMFEncoder, hSplitBinLCLDEnc->pppfCQMFReal, hSplitBinLCLDEnc->pppfCQMFImag, &iBytesWritten, auchData ); - - bval = auchData; - ushBytes = (uint16_t) iBytesWritten; - ivas_split_rend_bitstream_write_int32( pBits, (int32_t) ushBytes, 8 * sizeof( uint16_t ) ); - for ( int32_t bytesCount = 0; bytesCount < iBytesWritten; bytesCount++ ) - { - code = (int32_t) *bval; - ivas_split_rend_bitstream_write_int32( pBits, code, 8 ); - bval++; - } + EncodeFrame( hSplitBinLCLDEnc->psCQMFEncoder, hSplitBinLCLDEnc->pppfCQMFReal, + hSplitBinLCLDEnc->pppfCQMFImag, &iBitsWritten, available_bits, + pBits ); + assert( iBitsWritten <= available_bits ); #ifdef CLDFB_DEBUG - printf( "Bytes written = %d\n", iBytesWritten ); + printf( "Bits written = %d\n", iBitsWritten ); #endif return; diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 56782f4989..46d15b4030 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -54,7 +54,9 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, - const int32_t output_Fs ) + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int32_t output_Fs, + const int16_t is_cldfb_in ) { BIN_HR_SPLIT_POST_REND_HANDLE hBinRend; ivas_error error; @@ -69,6 +71,7 @@ ivas_error ivas_splitBinPostRendOpen( for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hBinRend->cldfbSyn[ch] = NULL; + hBinRend->cldfbAna[ch] = NULL; } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ ) @@ -87,6 +90,13 @@ ivas_error ivas_splitBinPostRendOpen( { return error; } + if ( is_cldfb_in == 0 ) + { + if ( ( error = openCldfb( &( hBinRend->cldfbAna[ch] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -102,7 +112,8 @@ ivas_error ivas_splitBinPostRendOpen( } #endif hBinRend->cf_flag = 0; - set_fix_rotation_mat( hBinRend->fix_pos_rot_mat ); + set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData ); + set_pose_types( hBinRend->pose_type, pMultiBinPoseData ); ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); *hBinHrSplitPostRend = hBinRend; @@ -121,6 +132,11 @@ void ivas_splitBinPostRendClose( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostR deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbSyn[ch] ) ); ( *hBinHrSplitPostRend )->cldfbSyn[ch] = NULL; } + if ( ( *hBinHrSplitPostRend )->cldfbAna[ch] != NULL ) + { + deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbAna[ch] ) ); + ( *hBinHrSplitPostRend )->cldfbAna[ch] = NULL; + } } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ ) @@ -240,61 +256,82 @@ static int16_t ivas_split_rend_huffman_decode( static void ivas_split_rend_unquant_md( BIN_HR_SPLIT_REND_MD_HANDLE hMd, + IVAS_SPLIT_REND_POSE_TYPE pose_type, int16_t real_only, float fix_pos_rot_mat[][BINAURAL_CHANNELS] ) { int16_t ch1, ch2; + int16_t gd_idx_min; - ivas_deindex_real_index( - &hMd->pred_mat_re_idx[0][0], - IVAS_SPLIT_REND_PRED_QUANT_PNTS, - IVAS_SPLIT_REND_PRED_MIN_VAL, - IVAS_SPLIT_REND_PRED_MAX_VAL, - &hMd->pred_mat_re[0][0], - BINAURAL_CHANNELS * BINAURAL_CHANNELS ); - ivas_deindex_real_index( - &hMd->pred_mat_im_idx[0][0], - IVAS_SPLIT_REND_PRED_QUANT_PNTS, - IVAS_SPLIT_REND_PRED_MIN_VAL, - IVAS_SPLIT_REND_PRED_MAX_VAL, - &hMd->pred_mat_im[0][0], - BINAURAL_CHANNELS * BINAURAL_CHANNELS ); - ivas_deindex_real_index( - &hMd->gd_idx, - IVAS_SPLIT_REND_D_QUANT_PNTS, - IVAS_SPLIT_REND_D_MIN_VAL, - IVAS_SPLIT_REND_D_MAX_VAL, - &hMd->gd, - 1 ); - - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2]; - // hMd->pred_mat_re[ch1][ch2] = hQMd->pred_mat_re[ch1][ch2]; - } - } - if ( real_only ) + if ( pose_type == PRED_ONLY ) { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - hMd->pred_mat_im[ch1][ch2] = 0.0f; + hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; + hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2]; + } + } + if ( real_only ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd->pred_mat_im[ch1][ch2] = 0.0f; + } + } + } + else + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd->pred_mat_im[ch1][ch2] = hMd->pred_mat_im_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; + } } } } + else if ( pose_type == COM_GAIN_ONLY ) + { + gd_idx_min = (int16_t) roundf( IVAS_SPLIT_REND_D_1BYQ_STEP * IVAS_SPLIT_REND_D_MIN_VAL ); + hMd->gd_idx += gd_idx_min; + hMd->gd = hMd->gd_idx * IVAS_SPLIT_REND_D_Q_STEP; + } + else if ( pose_type == LR_GAIN_ONLY ) + { + gd_idx_min = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * IVAS_SPLIT_REND_PITCH_G_MIN_VAL ); + hMd->gd_idx += gd_idx_min; + hMd->gd = hMd->gd_idx * IVAS_SPLIT_REND_PITCH_G_Q_STEP; + + hMd->gd2_idx += gd_idx_min; + hMd->gd2 = hMd->gd2_idx * IVAS_SPLIT_REND_PITCH_G_Q_STEP; + } + else + { + hMd->gd = 0.0f; + } + return; } static void ivas_splitBinPostRendMdBase2Dec( ivas_split_rend_bits_t *pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, - const int16_t num_md_bands ) + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int16_t num_subframes, + const int16_t pred_real_bands_yaw, + const int16_t pred_imag_bands_yaw, + const int16_t d_bands_yaw, + const int16_t bands_pitch, + const int16_t pred_real_bands_roll, + const int16_t pred_imag_bands_roll ) { - int16_t sf_idx, real_only, pos_idx, b, ch1, ch2; - int16_t min_pred_idx, min_gd_idx, pred_code_len, gd_code_len; + int16_t sf_idx, pos_idx, b, ch1, ch2; + int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len; int16_t code; BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; @@ -302,38 +339,76 @@ static void ivas_splitBinPostRendMdBase2Dec( pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; + min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0]; pred_code_len = pHuff_cfg->pred_base2_code_len; gd_code_len = pHuff_cfg->gd_base2_code_len; + p_gd_code_len = pHuff_cfg->p_gd_base2_code_len; - - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - for ( b = 0; b < num_md_bands; b++ ) + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { - if ( b < COMPLEX_MD_BAND_THRESH ) + if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) { - real_only = 0; + for ( b = 0; b < pred_real_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); + hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx; + } + } + } + for ( b = 0; b < pred_imag_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); + hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_idx; + } + } + } + for ( b = 0; b < d_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, gd_code_len ); + hMd->gd_idx = code + min_gd_idx; + } } - else + else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY ) { - real_only = 1; + for ( b = 0; b < bands_pitch; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, p_gd_code_len ); + hMd->gd_idx = code + min_p_gd_idx; + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, p_gd_code_len ); + hMd->gd2_idx = code + min_p_gd_idx; + } } - - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + else { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_real_bands_roll; b++ ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { - code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); - hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx; + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); + hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx; + } } } - - if ( real_only == 0 ) + for ( b = 0; b < pred_imag_bands_roll; b++ ) { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) @@ -343,8 +418,6 @@ static void ivas_splitBinPostRendMdBase2Dec( } } } - code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, gd_code_len ); - hMd->gd_idx = code + min_gd_idx; } } } @@ -355,10 +428,17 @@ static void ivas_splitBinPostRendMdBase2Dec( static void ivas_splitBinPostRendMdHuffDec( ivas_split_rend_bits_t *pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, - const int16_t num_md_bands ) + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int16_t num_subframes, + const int16_t pred_real_bands_yaw, + const int16_t pred_imag_bands_yaw, + const int16_t d_bands_yaw, + const int16_t bands_pitch, + const int16_t pred_real_bands_roll, + const int16_t pred_imag_bands_roll ) { int16_t pos_idx, b, sf_idx; - int16_t real_only, ch1, ch2; + int16_t ch1, ch2; int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t min_pred_idx, max_pred_idx; BIN_HR_SPLIT_REND_MD_HANDLE hMd; @@ -367,38 +447,76 @@ static void ivas_splitBinPostRendMdHuffDec( pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; - real_only = 0; - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - for ( b = 0; b < num_md_bands; b++ ) + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { - if ( b < COMPLEX_MD_BAND_THRESH ) + if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) { - real_only = 0; + for ( b = 0; b < pred_real_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); + } + } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx ); + } + for ( b = 0; b < pred_imag_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); + } + } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx ); + } + for ( b = 0; b < d_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + hMd->gd_idx = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->gd, pBits, pHuff_cfg->gd_idx_trav ); + // hMd->gd_idx = ivas_split_rend_huffman_decode( &pHuff_cfg->gd, pBits ); + } } - else + else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY ) { - real_only = 1; - } + for ( b = 0; b < bands_pitch; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + hMd->gd_idx = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->p_gd, pBits, pHuff_cfg->p_gd_idx_trav ); + // hMd->gd_idx = ivas_split_rend_huffman_decode( &pHuff_cfg->gd, pBits ); - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + hMd->gd2_idx = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->p_gd, pBits, pHuff_cfg->p_gd_idx_trav ); + } + } + else { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_real_bands_roll; b++ ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { - sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); - // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); + } } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx ); } - ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx ); - - if ( real_only == 0 ) + for ( b = 0; b < pred_imag_bands_roll; b++ ) { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) @@ -409,8 +527,6 @@ static void ivas_splitBinPostRendMdHuffDec( } ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx ); } - hMd->gd_idx = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->gd, pBits, pHuff_cfg->gd_idx_trav ); - // hMd->gd_idx = ivas_split_rend_huffman_decode( &pHuff_cfg->gd, pBits ); } } } @@ -421,214 +537,717 @@ static void ivas_splitBinPostRendMdHuffDec( void ivas_splitBinPostRendMdDec( ivas_split_rend_bits_t *pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, -#endif + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int16_t num_md_bands ) { - int16_t pos_idx, b, sf_idx; + int16_t pos_idx, b, sf_idx, num_subframes, ch1; + int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + int16_t num_complex_bands, num_quant_strats; + int32_t quant_strat_bits, is_huff_coding, quant_strat; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG int16_t ch1, ch2; #endif - int16_t real_only, yaw_idx; BIN_HR_SPLIT_REND_MD_HANDLE hMd; - real_only = 0; + IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; + IVAS_SPLIT_REND_ROT_AXIS rot_axis; -#ifdef SPLIT_REND_BASE2_CODING - ivas_splitBinPostRendMdBase2Dec( pBits, hBinHrSplitPostRend, num_md_bands ); -#else - ivas_splitBinPostRendMdHuffDec( pBits, hBinHrSplitPostRend, num_md_bands ); -#endif + hBinHrSplitPostRend->low_Res = 1; + //( int16_t ) ivas_split_rend_bitstream_read_int32( pBits, 1 ); + + split_rend_config.dof = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_DOF_BITS ); + split_rend_config.hq_mode = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_HQ_MODE_BITS ); + rot_axis = (IVAS_SPLIT_REND_ROT_AXIS) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_ROT_AXIS_BITS ); + + ivas_renderSplitGetMultiBinPoseData( + &split_rend_config, + pMultiBinPoseData, rot_axis ); - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + set_fix_rotation_mat( hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData ); + set_pose_types( hBinHrSplitPostRend->pose_type, pMultiBinPoseData ); + + num_subframes = ( hBinHrSplitPostRend->low_Res == 0 ) ? MAX_PARAM_SPATIAL_SUBFRAMES : 1; + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + int16_t angle; + + hBinHrSplitPostRend->QuaternionsPre[sf_idx].w = -3.0f; + + angle = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_HEAD_POSE_BITS ); + angle -= 180; + hBinHrSplitPostRend->QuaternionsPre[sf_idx].x = (float) angle; + + angle = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_HEAD_POSE_BITS ); + angle -= 180; + hBinHrSplitPostRend->QuaternionsPre[sf_idx].y = (float) angle; + + angle = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, IVAS_SPLIT_REND_HEAD_POSE_BITS ); + angle -= 180; + hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = (float) angle; + } + + ivas_split_rend_get_quant_params( + MAX_SPLIT_REND_MD_BANDS, + pred_real_bands_yaw, + pred_imag_bands_yaw, + d_bands_yaw, + bands_pitch, + pred_real_bands_roll, + pred_imag_bands_roll, + &num_quant_strats, + &num_complex_bands ); + + quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) ); + is_huff_coding = ivas_split_rend_bitstream_read_int32( pBits, 1 ); + quant_strat = ivas_split_rend_bitstream_read_int32( pBits, quant_strat_bits ); + + if ( is_huff_coding == 0 ) + { + ivas_splitBinPostRendMdBase2Dec( + pBits, hBinHrSplitPostRend, + pMultiBinPoseData, + num_subframes, + pred_real_bands_yaw[quant_strat], + pred_imag_bands_yaw[quant_strat], + d_bands_yaw[quant_strat], + bands_pitch[quant_strat], + pred_real_bands_roll[quant_strat], + pred_imag_bands_roll[quant_strat] ); + } + else + { + ivas_splitBinPostRendMdHuffDec( + pBits, hBinHrSplitPostRend, + pMultiBinPoseData, + num_subframes, + pred_real_bands_yaw[quant_strat], + pred_imag_bands_yaw[quant_strat], + d_bands_yaw[quant_strat], + bands_pitch[quant_strat], + pred_real_bands_roll[quant_strat], + pred_imag_bands_roll[quant_strat] ); + } +#ifdef SPLIT_MD_CODING_DEBUG + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) + { + int16_t val, ch2, val_ref; + char filename[200] = "split_md_debug_indices.bin"; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { - yaw_idx = ( pos_idx / ( MAX_PITCH_ANGLES * MAX_ROLL_ANGLES ) ); - for ( b = 0; b < num_md_bands; b++ ) + if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) { - if ( b < COMPLEX_MD_BAND_THRESH ) - { - real_only = 0; - } - else - { - real_only = 1; - } - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - /*verify that MD is decodd correctly*/ - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_real_bands_yaw[quant_strat]; b++ ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { - int16_t val; - val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; - if ( abs( hMd->pred_mat_re_idx[ch1][ch2] - val ) > 0 ) - { - assert( 0 ); - } - - if ( real_only == 0 ) + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; - if ( abs( hMd->pred_mat_im_idx[ch1][ch2] - val ) > 0 ) + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) { assert( 0 ); } } - - val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx; - if ( abs( hMd->gd_idx - val ) > 0 ) - { - assert( 0 ); - } } } -#endif - - ivas_split_rend_unquant_md( hMd, - real_only, hBinHrSplitPostRend->fix_pos_rot_mat[yaw_idx] ); - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - /*verify that MD is decodd correctly*/ - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { - float val; - val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch1][ch2] + - hBinHrSplitPostRend->fix_pos_rot_mat[yaw_idx][ch1][ch2]; - if ( fabs( hMd->pred_mat_re[ch1][ch2] - val ) > 1e-20 ) + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - assert( 0 ); + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) + { + assert( 0 ); + } } - - val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch1][ch2]; - if ( fabs( hMd->pred_mat_im[ch1][ch2] - val ) > 1e-20 ) + } + } + for ( b = 0; b < d_bands_yaw[quant_strat]; b++ ) + { + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].gd_idx; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) + { + assert( 0 ); + } + } + } + else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY ) + { + for ( b = 0; b < bands_pitch[quant_strat]; b++ ) + { + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].gd_idx; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) + { + assert( 0 ); + } + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].gd2_idx; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) + { + assert( 0 ); + } + } + } + else + { + for ( b = 0; b < pred_real_bands_roll[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - assert( 0 ); + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) + { + assert( 0 ); + } } - - val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd; - if ( fabs( hMd->gd - val ) > 1e-20 ) + } + } + for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - assert( 0 ); + val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + dbgread( &val_ref, sizeof( int16_t ), 1, filename ); + if ( abs( val_ref - val ) > 0 ) + { + assert( 0 ); + } } } } -#endif } } } - return; -} - -#define REAL_IMAG_INTERPOLATION -static void wrap_around_angle( float *a ) -{ - if ( ( *a ) > 180.0f ) - { - ( *a ) = ( *a ) - 360; - } - else if ( ( *a ) < -180.0f ) - { - ( *a ) = ( *a ) + 360; - } - return; -} -static void wrap_around_ypr( IVAS_QUATERNION *Quaternions ) -{ - /*only if quat is actually yaw, pitch , roll angles*/ - if ( Quaternions->w == -3.0f ) - { - wrap_around_angle( &Quaternions->x ); - wrap_around_angle( &Quaternions->y ); - wrap_around_angle( &Quaternions->z ); - } - return; -} -static void get_interpolation_vars( - const IVAS_QUATERNION *Quaternions_ref, - const IVAS_QUATERNION *Quaternions_act, - int16_t interp_pose_idx[2], - float *interp_fact ) -{ - IVAS_QUATERNION quaternions_diff, quaternions_diffx[MAX_HEAD_ROT_POSES], quaternions_ref_euler, quaternions_act_euler; - int16_t yaw_idx, pitch_idx, roll_idx, pos_idx; - float min_diff, d1, n1; - int16_t idx1, idx2; - - idx1 = 0; - idx2 = 0; - quaternions_diff.x = 0.0f; - quaternions_diff.y = 0.0f; - quaternions_diff.z = 0.0f; - - for ( yaw_idx = 0; yaw_idx < MAX_YAW_ANGLES; yaw_idx++ ) +#endif + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - for ( pitch_idx = 0; pitch_idx < MAX_PITCH_ANGLES; pitch_idx++ ) + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { - for ( roll_idx = 0; roll_idx < MAX_ROLL_ANGLES; roll_idx++ ) + if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) { - pos_idx = yaw_idx * MAX_PITCH_ANGLES * MAX_ROLL_ANGLES + pitch_idx * MAX_ROLL_ANGLES + roll_idx; - - quaternions_diff.x += split_rend_relative_yaw_angles[yaw_idx]; - quaternions_diff.y += split_rend_relative_pitch_angles[pitch_idx]; - quaternions_diff.z += split_rend_relative_roll_angles[roll_idx]; - quaternions_diffx[pos_idx].x = quaternions_diff.x; - quaternions_diffx[pos_idx].y = quaternions_diff.y; - quaternions_diffx[pos_idx].z = quaternions_diff.z; + for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_unquant_md( hMd, + PRED_ONLY, + 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < pred_real_bands_yaw[quant_strat]; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_unquant_md( hMd, + PRED_ONLY, + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + set_zero( hMd->pred_mat_re[ch1], BINAURAL_CHANNELS ); + set_zero( hMd->pred_mat_im[ch1], BINAURAL_CHANNELS ); + hMd->pred_mat_re[ch1][ch1] = 1.0f; + } + } + for ( b = 0; b < d_bands_yaw[quant_strat]; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_unquant_md( hMd, + COM_GAIN_ONLY, + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + hMd->gd = 0.0f; + } + } + else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY ) + { + for ( b = 0; b < bands_pitch[quant_strat]; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_unquant_md( hMd, + LR_GAIN_ONLY, + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + hMd->gd = 1.0f; + hMd->gd2 = 1.0f; + } + } + else + { + for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_unquant_md( hMd, + PRED_ONLY, + 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < pred_real_bands_roll[quant_strat]; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_unquant_md( hMd, + PRED_ONLY, + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + set_zero( hMd->pred_mat_re[ch1], BINAURAL_CHANNELS ); + set_zero( hMd->pred_mat_im[ch1], BINAURAL_CHANNELS ); + hMd->pred_mat_re[ch1][ch1] = 1.0f; + } + } } } } - /*interpolation if actual pose is not same as one of assumed poses*/ +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) + { + float val; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) + { + if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) + { + for ( b = 0; b < pred_real_bands_yaw[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + if ( fabsf( hMd->pred_mat_re_idx[ch1][ch2] - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } + } + for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + if ( fabsf( hMd->pred_mat_im_idx[ch1][ch2] - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } + } + for ( b = 0; b < d_bands_yaw[quant_strat]; b++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx; + if ( fabsf( hMd->gd_idx - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } + else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY ) + { + for ( b = 0; b < bands_pitch[quant_strat]; b++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx; + if ( fabsf( hMd->gd_idx - val ) > 1e-20 ) + { + assert( 0 ); + } + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd2_idx; + if ( fabsf( hMd->gd2_idx - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } + else + { + for ( b = 0; b < pred_real_bands_roll[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + if ( fabsf( hMd->pred_mat_re_idx[ch1][ch2] - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } + } + for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + if ( fabsf( hMd->pred_mat_im_idx[ch1][ch2] - val ) > 1e-20 ) + { + assert( 0 ); + } + } + } + } + } + } + } +#endif + + if ( hBinHrSplitPostRend->low_Res ) + { + int16_t sf_idx2, res_ratio, ch2; + BIN_HR_SPLIT_REND_MD_HANDLE hMd2; + res_ratio = MAX_PARAM_SPATIAL_SUBFRAMES / num_subframes; + + for ( sf_idx = num_subframes - 1; sf_idx >= 0; sf_idx-- ) + { + for ( sf_idx2 = res_ratio - 1; sf_idx2 >= 0; sf_idx2-- ) + { + hBinHrSplitPostRend->QuaternionsPre[( sf_idx * res_ratio ) + sf_idx2] = hBinHrSplitPostRend->QuaternionsPre[sf_idx]; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) + { + for ( b = 0; b < num_md_bands; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + hMd2 = &hBinHrSplitPostRend->rot_md[pos_idx][( sf_idx * res_ratio ) + sf_idx2][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + hMd2->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2]; + hMd2->pred_mat_im[ch1][ch2] = hMd->pred_mat_im[ch1][ch2]; + } + } + hMd2->gd = hMd->gd; + hMd2->gd2 = hMd->gd2; + } + } + } + } + } + + return; +} + +#define REAL_IMAG_INTERPOLATION +static void wrap_around_angle( float *a ) +{ + if ( ( *a ) > 180.0f ) + { + ( *a ) = ( *a ) - 360; + } + else if ( ( *a ) < -180.0f ) + { + ( *a ) = ( *a ) + 360; + } + return; +} +static void wrap_around_ypr( IVAS_QUATERNION *Quaternions ) +{ + /*only if quat is actually yaw, pitch , roll angles*/ + if ( Quaternions->w == -3.0f ) + { + wrap_around_angle( &Quaternions->x ); + wrap_around_angle( &Quaternions->y ); + wrap_around_angle( &Quaternions->z ); + } + return; +} + +static float get_interp_fact( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t ind[2] ) +{ + float n, d, interp_fact; + if ( ind[0] != ind[1] ) + { + n = p[ind[0]] - p[ind[1]]; + d = p[ind[0]] - p_t; + interp_fact = d / n; +#ifdef SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT + if ( interp_fact < 0.0f ) + { + d = max( -1.0f * MAX_EXTRAPOLATION_ANGLE, ( min( MAX_EXTRAPOLATION_ANGLE, d ) ) ); + n = sinf( n * ( EVS_PI / 180.0f ) ); + d = sinf( d * ( EVS_PI / 180.0f ) ); + interp_fact = d / n; + } +#endif + } + else + { + interp_fact = 0.0f; + } + + return interp_fact; +} + +static void get_nearest_pose_ind( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t ind[2], int16_t num_poses ) +{ + float min_diff, diff; + int16_t pos_idx; + + ind[0] = 0; + ind[1] = 0; + min_diff = 360.0f; + /*find the closest pose from assumed poses*/ + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + diff = fabsf( p_t - p[pos_idx] ); + if ( diff < min_diff ) + { + ind[0] = pos_idx; + min_diff = (float) diff; + } + } + + min_diff = 360.0; + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + diff = fabsf( p_t - p[pos_idx] ); + if ( ( diff < min_diff ) && + ( fabs( p[pos_idx] - p[ind[0]] ) > EPSILON ) ) + { + ind[1] = pos_idx; + min_diff = (float) diff; + } + } + + return; +} + +static void get_interpolation_vars( + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const IVAS_QUATERNION *Quaternions_ref, + const IVAS_QUATERNION *Quaternions_act, + int16_t interp_yaw_pose_idx[2], + int16_t interp_pitch_pose_idx[2], + int16_t interp_roll_pose_idx[2], + float *interp_yaw_fact, + float *interp_pitch_fact, + float *interp_roll_fact ) +{ + IVAS_QUATERNION quaternions_diff, quaternions_ref_euler, quaternions_act_euler; + float y[MAX_HEAD_ROT_POSES], p[MAX_HEAD_ROT_POSES], r[MAX_HEAD_ROT_POSES]; + int16_t pos_idx, num_poses; + + quaternions_diff.x = 0.0f; + quaternions_diff.y = 0.0f; + quaternions_diff.z = 0.0f; + + num_poses = pMultiBinPoseData->num_poses; + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + quaternions_diff.x = pMultiBinPoseData->relative_head_poses[pos_idx][0]; + quaternions_diff.y = pMultiBinPoseData->relative_head_poses[pos_idx][1]; + quaternions_diff.z = pMultiBinPoseData->relative_head_poses[pos_idx][2]; + y[pos_idx] = quaternions_diff.x; + p[pos_idx] = quaternions_diff.y; + r[pos_idx] = quaternions_diff.z; + } + + /*interpolation if actual pose is not same as one of assumed poses*/ /*get the deviation*/ - Quat2Euler( *Quaternions_ref, &quaternions_ref_euler.z, &quaternions_ref_euler.y, &quaternions_ref_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ - Quat2Euler( *Quaternions_act, &quaternions_act_euler.z, &quaternions_act_euler.y, &quaternions_act_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ - quaternions_diff.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_ref, &quaternions_ref_euler.z, &quaternions_ref_euler.y, &quaternions_ref_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quat2EulerDegree( *Quaternions_act, &quaternions_act_euler.z, &quaternions_act_euler.y, &quaternions_act_euler.x ); /*order in Quat2Euler seems to be reversed ?*/ + quaternions_diff.w = -3.0f; /*euler*/ quaternions_diff.x = quaternions_act_euler.x - quaternions_ref_euler.x; quaternions_diff.y = quaternions_act_euler.y - quaternions_ref_euler.y; quaternions_diff.z = quaternions_act_euler.z - quaternions_ref_euler.z; wrap_around_ypr( &quaternions_diff ); + + interp_yaw_pose_idx[0] = 0; + interp_yaw_pose_idx[1] = 0; if ( fabs( quaternions_diff.x ) > EPSILON ) { - min_diff = 360.0f; - /*find the closest pose from assumed poses*/ - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + get_nearest_pose_ind( y, quaternions_diff.x, interp_yaw_pose_idx, num_poses ); + } + *interp_yaw_fact = get_interp_fact( y, quaternions_diff.x, interp_yaw_pose_idx ); + + interp_pitch_pose_idx[0] = 0; + interp_pitch_pose_idx[1] = 0; + if ( fabs( quaternions_diff.y ) > EPSILON ) + { + get_nearest_pose_ind( p, quaternions_diff.y, interp_pitch_pose_idx, num_poses ); + } + *interp_pitch_fact = get_interp_fact( p, quaternions_diff.y, interp_pitch_pose_idx ); + + interp_roll_pose_idx[0] = 0; + interp_roll_pose_idx[1] = 0; + if ( fabs( quaternions_diff.z ) > EPSILON ) + { + get_nearest_pose_ind( r, quaternions_diff.z, interp_roll_pose_idx, num_poses ); + } + *interp_roll_fact = get_interp_fact( r, quaternions_diff.z, interp_roll_pose_idx ); + + return; +} + +static void interpolate_gain_matrix( + BIN_HR_SPLIT_REND_MD rot_md[][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], + int16_t sf_idx, + int16_t band_idx, + int16_t ind[2], + float interp_fact, + float gain[BINAURAL_CHANNELS] ) +{ + float gd1, gd2, gd3, gd4, diff; + + gd1 = 1.0f; + gd2 = 1.0f; + gd3 = 1.0f; + gd4 = 1.0f; + if ( ind[0] != 0 ) + { + gd1 = rot_md[ind[0] - 1][sf_idx][band_idx].gd; + gd3 = rot_md[ind[0] - 1][sf_idx][band_idx].gd2; + } + if ( ind[1] != 0 ) + { + gd2 = rot_md[ind[1] - 1][sf_idx][band_idx].gd; + gd4 = rot_md[ind[1] - 1][sf_idx][band_idx].gd2; + } +#if 0 + diff = gd1 / gd2; + pitch_gain_l = gd2 * powf( diff, 1.0f - interp_pitch_fact ); + pitch_gain_l = max( 0.0f, pitch_gain_l ); + + diff = gd3 / gd4; + pitch_gain_r = gd4 * powf( diff, 1.0f - interp_pitch_fact ); + pitch_gain_r = max( 0.0f, pitch_gain_r ); +#else + diff = gd1 - gd2; + gain[0] = gd1 - ( diff * interp_fact ); + gain[0] = max( 0.0f, gain[0] ); + + diff = gd3 - gd4; + gain[1] = gd3 - ( diff * interp_fact ); + gain[1] = max( 0.0f, gain[1] ); +#endif +} + +static void interpolate_pred_matrix( + BIN_HR_SPLIT_REND_MD rot_md[][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], + int16_t sf_idx, + int16_t band_idx, + int16_t ind[2], + float interp_fact, + float mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t ch_idx1, ch_idx2; + float diff; + BIN_HR_SPLIT_REND_MD *pRot_md; + float mix_mat_re1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_im1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_re2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_im2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; +#ifdef SPIT_ABS_SCALING_INTERP + float abs1, abs2; + float mix_mat_abs[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; +#endif + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + set_zero( mix_mat_re1[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_im1[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_re1[ch_idx1][ch_idx1] = 1.0f; + + set_zero( mix_mat_re2[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_im2[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_re2[ch_idx1][ch_idx1] = 1.0f; + } + + if ( ind[0] != 0 ) + { + pRot_md = &rot_md[ind[0] - 1][sf_idx][band_idx]; + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - if ( fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ) < min_diff ) + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) { - idx1 = pos_idx; - min_diff = (float) fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ); + mix_mat_re1[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2]; + mix_mat_im1[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2]; } } + } - min_diff = 360.0; - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + if ( ind[1] != 0 ) + { + pRot_md = &rot_md[ind[1] - 1][sf_idx][band_idx]; + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - if ( ( fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ) < min_diff ) && - ( pos_idx != idx1 ) ) + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) { - idx2 = pos_idx; - min_diff = (float) fabs( quaternions_diff.x - quaternions_diffx[pos_idx].x ); + mix_mat_re2[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2]; + mix_mat_im2[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2]; } } } - interp_pose_idx[0] = idx1; - interp_pose_idx[1] = idx2; - if ( idx1 != idx2 ) +#ifdef SPIT_ABS_SCALING_INTERP + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - n1 = quaternions_diffx[idx1].x - quaternions_diffx[idx2].x; - d1 = quaternions_diffx[idx1].x - quaternions_diff.x; - *interp_fact = d1 / n1; + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + IVAS_CALCULATE_ABS( mix_mat_re1[ch_idx1][ch_idx2], mix_mat_im1[ch_idx1][ch_idx2], abs1 ); + IVAS_CALCULATE_ABS( mix_mat_re2[ch_idx1][ch_idx2], mix_mat_im2[ch_idx1][ch_idx2], abs2 ); + diff = abs1 - abs2; + mix_mat_abs[ch_idx1][ch_idx2] = abs1 - ( diff * interp_fact ); + mix_mat_abs[ch_idx1][ch_idx2] = fabsf( mix_mat_abs[ch_idx1][ch_idx2] ); + } } - else +#endif + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + diff = mix_mat_re1[ch_idx1][ch_idx2] - mix_mat_re2[ch_idx1][ch_idx2]; + mat_re[ch_idx1][ch_idx2] = mix_mat_re1[ch_idx1][ch_idx2] - ( diff * interp_fact ); + + diff = mix_mat_im1[ch_idx1][ch_idx2] - mix_mat_im2[ch_idx1][ch_idx2]; + mat_im[ch_idx1][ch_idx2] = mix_mat_im1[ch_idx1][ch_idx2] - ( diff * interp_fact ); + } + } + +#ifdef SPIT_ABS_SCALING_INTERP + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - *interp_fact = 0.0f; + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + IVAS_CALCULATE_ABS( mat_re[ch_idx1][ch_idx2], mat_im[ch_idx1][ch_idx2], abs1 ); + if ( abs1 > 1e-10 ) + { + abs1 = mix_mat_abs[ch_idx1][ch_idx2] / abs1; + mat_re[ch_idx1][ch_idx2] = mat_re[ch_idx1][ch_idx2] * abs1; + mat_im[ch_idx1][ch_idx2] = mat_im[ch_idx1][ch_idx2] * abs1; + } + } } +#endif return; } @@ -640,82 +1259,44 @@ static void interpolate_rend_md( float *gd_int, int16_t sf_idx, int16_t band_idx, - int16_t interp_pose_idx[2], - float interp_fact ) + int16_t interp_yaw_pose_idx[2], + int16_t interp_pitch_pose_idx[2], + int16_t interp_roll_pose_idx[2], + float interp_yaw_fact, + float interp_pitch_fact, + float interp_roll_fact ) { - int16_t ch_idx1, ch_idx2, idx1, idx2; - float mix_mat_abs1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float mix_mat_ph1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float mix_mat_abs2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float mix_mat_ph2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float mix_mat_abs[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float mix_mat_ph[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float gd1, gd2, diff; - BIN_HR_SPLIT_REND_MD *pRot_md; - - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - set_zero( mix_mat_abs1[ch_idx1], BINAURAL_CHANNELS ); - set_zero( mix_mat_ph1[ch_idx1], BINAURAL_CHANNELS ); - mix_mat_abs1[ch_idx1][ch_idx1] = 1.0f; + int16_t ch_idx1, idx1, idx2; +#ifndef SPLIT_REND_REAL_ONLY_ROLL + float mix_mat_re1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_im1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_re3[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float mix_mat_im3[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + int16_t ch_idx2; +#endif + float gd1, gd2, gd3, gd4, diff, pitch_gain_r, pitch_gain_l; - set_zero( mix_mat_abs2[ch_idx1], BINAURAL_CHANNELS ); - set_zero( mix_mat_ph2[ch_idx1], BINAURAL_CHANNELS ); - mix_mat_abs2[ch_idx1][ch_idx1] = 1.0f; - } gd1 = 0.0f; gd2 = 0.0f; - idx1 = interp_pose_idx[0]; - idx2 = interp_pose_idx[1]; + idx1 = interp_yaw_pose_idx[0]; + idx2 = interp_yaw_pose_idx[1]; if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) { + interpolate_pred_matrix( rot_md, sf_idx, band_idx, interp_yaw_pose_idx, interp_yaw_fact, mix_mat_re, mix_mat_im ); + if ( idx1 != 0 ) { - pRot_md = &rot_md[idx1 - 1][sf_idx][band_idx]; - - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) - { - mix_mat_abs1[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2]; - mix_mat_ph1[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2]; - } - } gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd; } if ( idx2 != 0 ) { - pRot_md = &rot_md[idx2 - 1][sf_idx][band_idx]; - - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) - { - mix_mat_abs2[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2]; - mix_mat_ph2[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2]; - } - } gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd; } - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) - { - diff = mix_mat_abs1[ch_idx1][ch_idx2] - mix_mat_abs2[ch_idx1][ch_idx2]; - mix_mat_abs[ch_idx1][ch_idx2] = mix_mat_abs1[ch_idx1][ch_idx2] - ( diff * interp_fact ); - - diff = mix_mat_ph1[ch_idx1][ch_idx2] - mix_mat_ph2[ch_idx1][ch_idx2]; - mix_mat_ph[ch_idx1][ch_idx2] = mix_mat_ph1[ch_idx1][ch_idx2] - ( diff * interp_fact ); - - mix_mat_re[ch_idx1][ch_idx2] = mix_mat_abs[ch_idx1][ch_idx2]; - mix_mat_im[ch_idx1][ch_idx2] = mix_mat_ph[ch_idx1][ch_idx2]; - } - } diff = gd1 - gd2; - *gd_int = gd1 - ( diff * interp_fact ); + *gd_int = gd1 - ( diff * interp_yaw_fact ); } else { @@ -729,27 +1310,148 @@ static void interpolate_rend_md( *gd_int = 0.0f; } + idx1 = interp_pitch_pose_idx[0]; + idx2 = interp_pitch_pose_idx[1]; + if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) + { + gd1 = 1.0f; + gd2 = 1.0f; + + gd3 = 1.0f; + gd4 = 1.0f; + + if ( idx1 != 0 ) + { + gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd; + gd3 = rot_md[idx1 - 1][sf_idx][band_idx].gd2; + } + if ( idx2 != 0 ) + { + gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd; + gd4 = rot_md[idx2 - 1][sf_idx][band_idx].gd2; + } +#if 0 + diff = gd1 / gd2; + pitch_gain_l = gd2 * powf( diff, 1.0f - interp_pitch_fact ); + pitch_gain_l = max( 0.0f, pitch_gain_l ); + + diff = gd3 / gd4; + pitch_gain_r = gd4 * powf( diff, 1.0f - interp_pitch_fact ); + pitch_gain_r = max( 0.0f, pitch_gain_r ); +#else + diff = gd1 - gd2; + pitch_gain_l = gd1 - ( diff * interp_pitch_fact ); + pitch_gain_l = max( 0.0f, pitch_gain_l ); + + diff = gd3 - gd4; + pitch_gain_r = gd3 - ( diff * interp_pitch_fact ); + pitch_gain_r = max( 0.0f, pitch_gain_r ); +#endif + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + mix_mat_re[ch_idx1][0] *= pitch_gain_l; + mix_mat_re[ch_idx1][1] *= pitch_gain_r; + mix_mat_im[ch_idx1][0] *= pitch_gain_l; + mix_mat_im[ch_idx1][1] *= pitch_gain_r; + } + } + else + { + pitch_gain_l = 1.0f; + pitch_gain_r = 1.0f; + } + + idx1 = interp_roll_pose_idx[0]; + idx2 = interp_roll_pose_idx[1]; +#ifdef SPLIT_REND_REAL_ONLY_ROLL + if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) + { + gd1 = 1.0f; + gd2 = 1.0f; + + gd3 = 1.0f; + gd4 = 1.0f; + + if ( idx1 != 0 ) + { + gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd; + gd3 = rot_md[idx1 - 1][sf_idx][band_idx].gd2; + } + if ( idx2 != 0 ) + { + gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd; + gd4 = rot_md[idx2 - 1][sf_idx][band_idx].gd2; + } +#if 0 + diff = gd1 / gd2; + pitch_gain_l = gd2 * powf( diff, 1.0f - interp_roll_fact ); + pitch_gain_l = max( 0.0f, pitch_gain_l ); + + diff = gd3 / gd4; + pitch_gain_r = gd4 * powf( diff, 1.0f - interp_roll_fact ); + pitch_gain_r = max( 0.0f, pitch_gain_r ); +#else + diff = gd1 - gd2; + pitch_gain_l = gd1 - ( diff * interp_roll_fact ); + pitch_gain_l = max( 0.0f, pitch_gain_l ); + + diff = gd3 - gd4; + pitch_gain_r = gd3 - ( diff * interp_roll_fact ); + pitch_gain_r = max( 0.0f, pitch_gain_r ); +#endif + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + mix_mat_re[ch_idx1][0] *= pitch_gain_l; + mix_mat_re[ch_idx1][1] *= pitch_gain_r; + mix_mat_im[ch_idx1][0] *= pitch_gain_l; + mix_mat_im[ch_idx1][1] *= pitch_gain_r; + } + } +#else + if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) + { + + + interpolate_pred_matrix( rot_md, sf_idx, band_idx, interp_roll_pose_idx, interp_roll_fact, mix_mat_re3, mix_mat_im3 ); + + ivas_mat_mult_2by2_complex( mix_mat_re, mix_mat_im, mix_mat_re3, mix_mat_im3, + mix_mat_re1, mix_mat_im1 ); + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) + { + mix_mat_re[ch_idx1][ch_idx2] = mix_mat_re1[ch_idx1][ch_idx2]; + mix_mat_im[ch_idx1][ch_idx2] = mix_mat_im1[ch_idx1][ch_idx2]; + } + } + } +#endif + return; } void ivas_SplitRenderer_PostRenderer( - BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ - float Cldfb_RealBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - int16_t sf_idx, - const IVAS_QUATERNION *Quaternions_ref, - const IVAS_QUATERNION *Quaternions_act ) + BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ + const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES] ) { int16_t pos_idx, b, brange[2], ch_idx1; - int16_t num_md_bands, slot_idx, b2; - float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int, gd_cf, gd_cf_abs; - int16_t interp_pose_idx[2]; - float interp_fact; + int16_t num_md_bands, slot_idx, b2, sf_idx, index_slot, num_subframes, num_slots, sf_idx_md; + float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int; +#ifndef SPLIT_REND_ZERO_OUT_YAW_D + float gd_cf, gd_cf_abs; +#endif + int16_t interp_yaw_pose_idx[2], interp_pitch_pose_idx[2], interp_roll_pose_idx[2]; + float interp_yaw_fact, interp_pitch_fact, interp_roll_fact; float mix_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float mix_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - float Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; #endif float fade; float *pMix_mat_re_prev[BINAURAL_CHANNELS]; @@ -759,246 +1461,339 @@ void ivas_SplitRenderer_PostRenderer( wmops_sub_start( "ivas_SplitRenderer_PostRenderer" ); + + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + num_slots = MAX_PARAM_SPATIAL_SUBFRAMES; + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) + { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - pos_idx = MAX_HEAD_ROT_POSES - 1; + pos_idx = MAX_HEAD_ROT_POSES - 1; #else - pos_idx = 0; + pos_idx = 0; #endif - get_interpolation_vars( Quaternions_ref, Quaternions_act, interp_pose_idx, &interp_fact ); - for ( b = 0; b < num_md_bands; b++ ) - { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + sf_idx_md = ( hBinPostRenderer->low_Res == 0 ) ? sf_idx : 0; + get_interpolation_vars( pMultiBinPoseData, + &hBinPostRenderer->QuaternionsPre[sf_idx_md], + &Quaternions_act[sf_idx], + interp_yaw_pose_idx, + interp_pitch_pose_idx, + interp_roll_pose_idx, + &interp_yaw_fact, + &interp_pitch_fact, + &interp_roll_fact ); + for ( b = 0; b < num_md_bands; b++ ) { - set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS ); - set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS ); - mix_mat_re[ch_idx1][ch_idx1] = 1.0f; - } - gd_int = 0.0f; + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_re[ch_idx1][ch_idx1] = 1.0f; + } + gd_int = 0.0f; + interpolate_rend_md( hBinPostRenderer->rot_md, mix_mat_re, mix_mat_im, &gd_int, sf_idx, b, interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, interp_yaw_fact, interp_pitch_fact, interp_roll_fact ); - interpolate_rend_md( hBinPostRenderer->rot_md, mix_mat_re, mix_mat_im, &gd_int, sf_idx, b, interp_pose_idx, interp_fact ); - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - /*update the prediction matrix with interpolated matrix*/ - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = gd_int; + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + /*update the prediction matrix with interpolated matrix*/ + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = gd_int; + } } - } + #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) -#else - pos_idx = 0; -#endif - { - for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) { - fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES; for ( b = 0; b < num_md_bands; b++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + if ( hBinPostRenderer->pose_type[pos_idx] == PITCH_ONLY ) { - if ( hBinPostRenderer->cf_flag ) - { - pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; - pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1]; - mix_mat_re[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] ) + - ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0]; - mix_mat_re[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] ) + - ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1]; - - mix_mat_im[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] ) + - ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0]; - mix_mat_im[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] ) + - ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1]; - } - else + + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - mix_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; - mix_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; - mix_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; - mix_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1], BINAURAL_CHANNELS ); + set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1], BINAURAL_CHANNELS ); + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][ch_idx1] = 1.0f; } + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[0][0] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[1][1] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd2; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; } - - if ( hBinPostRenderer->cf_flag ) - { - gd_cf = fade * hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd + - ( 1 - fade ) * hBinPostRenderer->gd_mem[pos_idx][b]; - } - else + else if ( hBinPostRenderer->pose_type[pos_idx] == ANY_ROLL ) { - gd_cf = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; } - gd_cf_abs = (float) fabs( gd_cf ); + } + } +#endif - brange[0] = pBand_grouping[b]; - brange[1] = pBand_grouping[b + 1]; - for ( b2 = brange[0]; b2 < brange[1]; b2++ ) +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) +#else + pos_idx = 0; +#endif + { + for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) + { + index_slot = sf_idx * num_slots + slot_idx; + fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES; + fade = min( fade, 1.0f ); + for ( b = 0; b < num_md_bands; b++ ) { for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - // Apply prediction matrix - IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][slot_idx][b2], - Cldfb_ImagBuffer_Ref_Binaural[0][slot_idx][b2], - mix_mat_re[0][ch_idx1], - mix_mat_im[0][ch_idx1], - tmp_re, - tmp_im ); - pred_out_re[ch_idx1] = tmp_re; - pred_out_im[ch_idx1] = tmp_im; - - IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][slot_idx][b2], - Cldfb_ImagBuffer_Ref_Binaural[1][slot_idx][b2], - mix_mat_re[1][ch_idx1], - mix_mat_im[1][ch_idx1], - tmp_re, - tmp_im ); - pred_out_re[ch_idx1] += tmp_re; - pred_out_im[ch_idx1] += tmp_im; + if ( hBinPostRenderer->cf_flag ) + { + pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; + pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1]; + mix_mat_re[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] ) + + ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0]; + mix_mat_re[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] ) + + ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1]; + + mix_mat_im[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] ) + + ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0]; + mix_mat_im[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] ) + + ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1]; + } + else + { + mix_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; + mix_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; + mix_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; + mix_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + } } - // Apply decorrelation - if ( 1 ) +#ifndef SPLIT_REND_ZERO_OUT_YAW_D + if ( hBinPostRenderer->cf_flag ) { - tmp_re = Cldfb_RealBuffer_Ref_Binaural[0][slot_idx][b2] + Cldfb_RealBuffer_Ref_Binaural[1][slot_idx][b2]; - tmp_im = Cldfb_ImagBuffer_Ref_Binaural[0][slot_idx][b2] + Cldfb_ImagBuffer_Ref_Binaural[1][slot_idx][b2]; - - pred_out_re[0] += ( gd_cf_abs * tmp_re ); - pred_out_im[0] += ( gd_cf_abs * tmp_im ); - pred_out_re[1] += ( gd_cf * tmp_re ); - pred_out_im[1] += ( gd_cf * tmp_im ); + gd_cf = fade * hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd + + ( 1 - fade ) * hBinPostRenderer->gd_mem[pos_idx][b]; + } + else + { + gd_cf = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; } - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + gd_cf_abs = (float) fabs( gd_cf ); +#endif + + brange[0] = pBand_grouping[b]; + brange[1] = pBand_grouping[b + 1]; + for ( b2 = brange[0]; b2 < brange[1]; b2++ ) { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + // Apply prediction matrix + IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2], + Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2], + mix_mat_re[0][ch_idx1], + mix_mat_im[0][ch_idx1], + tmp_re, + tmp_im ); + pred_out_re[ch_idx1] = tmp_re; + pred_out_im[ch_idx1] = tmp_im; + + IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][index_slot][b2], + Cldfb_ImagBuffer_Ref_Binaural[1][index_slot][b2], + mix_mat_re[1][ch_idx1], + mix_mat_im[1][ch_idx1], + tmp_re, + tmp_im ); + pred_out_re[ch_idx1] += tmp_re; + pred_out_im[ch_idx1] += tmp_im; + } + +#ifndef SPLIT_REND_ZERO_OUT_YAW_D + // Apply decorrelation + if ( 1 ) + { + tmp_re = Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2] + Cldfb_RealBuffer_Ref_Binaural[1][index_slot][b2]; + tmp_im = Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2] + Cldfb_ImagBuffer_Ref_Binaural[1][index_slot][b2]; + + pred_out_re[0] += ( gd_cf_abs * tmp_re ); + pred_out_im[0] += ( gd_cf_abs * tmp_im ); + pred_out_re[1] += ( gd_cf * tmp_re ); + pred_out_im[1] += ( gd_cf * tmp_im ); + } +#endif + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1]; - Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1]; + Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_re[ch_idx1]; + Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_im[ch_idx1]; #else - Cldfb_RealBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1]; - Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1]; + Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot][b2] = pred_out_re[ch_idx1]; + Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot][b2] = pred_out_im[ch_idx1]; #endif + } } } } } - } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) #else - pos_idx = 0; + pos_idx = 0; #endif - { - for ( b = 0; b < num_md_bands; b++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + for ( b = 0; b < num_md_bands; b++ ) { - hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; - hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; - hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; - hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; + hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; + hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; + hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + } + hBinPostRenderer->gd_mem[pos_idx][b] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; } - hBinPostRenderer->gd_mem[pos_idx][b] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; } - } - hBinPostRenderer->cf_flag = 1; + hBinPostRenderer->cf_flag = 1; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - { - int16_t num_cldfb_bands; - num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; - for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + int16_t num_cldfb_bands; + num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; + for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) { - mvr2r( Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][slot_idx], Cldfb_RealBuffer_Ref_Binaural[ch_idx1][slot_idx], num_cldfb_bands ); - mvr2r( Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][slot_idx], Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][slot_idx], num_cldfb_bands ); + index_slot = sf_idx * num_slots + slot_idx; + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + mvr2r( Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands ); + mvr2r( Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands ); + } } - } - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) - { - char fname[200] = "recons_out_pos"; - char tag[2]; - tag[0] = (char) ( '0' + pos_idx ); - tag[1] = '\0'; - strcat( fname, tag ); - strcat( fname, ".wav" ); - ivas_log_cldfb2wav_data( - Cldfb_RealBuffer_Recons_Binaural[pos_idx], - Cldfb_ImagBuffer_Recons_Binaural[pos_idx], - hBinPostRenderer->cldfbSynReconsBinDec[pos_idx], - BINAURAL_CHANNELS, - num_cldfb_bands, - 48000, - fname ); + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + char fname[200] = "recons_out_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + ivas_log_cldfb2wav_data( + Cldfb_RealBuffer_Recons_Binaural[pos_idx], + Cldfb_ImagBuffer_Recons_Binaural[pos_idx], + hBinPostRenderer->cldfbSynReconsBinDec[pos_idx], + BINAURAL_CHANNELS, + num_cldfb_bands, + 48000, + num_slots, + sf_idx * num_slots, + fname ); + } } - } #endif + } wmops_sub_end(); return; } -void ivas_rend_CldfbSplitPostRendProcess( +static void ivas_rend_CldfbSplitPostRendProcessTdIn( BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, - const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], - float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float output[][L_FRAME48k] ) { - int16_t sf_idx, ch_idx, index_slot, slot_idx, num_cldfb_bands; - float Cldfb_RealBuffer_sfIn[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_sfIn[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - + int16_t ch_idx, slot_idx, num_cldfb_bands; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels; - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + /* Implement CLDFB analysis */ + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { - for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - index_slot = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; - for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) - { - mvr2r( &Cldfb_RealBuffer_Binaural[ch_idx][index_slot][0], &Cldfb_RealBuffer_sfIn[ch_idx][slot_idx][0], num_cldfb_bands ); - mvr2r( &Cldfb_ImagBuffer_Binaural[ch_idx][index_slot][0], &Cldfb_ImagBuffer_sfIn[ch_idx][slot_idx][0], num_cldfb_bands ); - } + cldfbAnalysis_ts( &( output[ch_idx][num_cldfb_bands * slot_idx] ), + Cldfb_RealBuffer_Binaural[ch_idx][slot_idx], + Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx], + num_cldfb_bands, + hBinHrSplitPostRend->cldfbAna[ch_idx] ); } + } -#ifndef SPLIT_REND_SKIP_POST_REND - ivas_SplitRenderer_PostRenderer( - hBinHrSplitPostRend, - Cldfb_RealBuffer_sfIn, - Cldfb_ImagBuffer_sfIn, - sf_idx, - &QuaternionsPre[sf_idx], - &QuaternionsPost[sf_idx] ); -#endif + ivas_SplitRenderer_PostRenderer( + hBinHrSplitPostRend, + pMultiBinPoseData, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + QuaternionsPost ); - /* Implement CLDFB synthesis */ - for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + /* Implement CLDFB synthesis */ + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + float *RealBuffer[CLDFB_NO_COL_MAX]; + float *ImagBuffer[CLDFB_NO_COL_MAX]; + + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; + } - index_slot = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES; + cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); + } + return; +} - for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) - { - RealBuffer[slot_idx] = Cldfb_RealBuffer_sfIn[ch_idx][slot_idx]; - ImagBuffer[slot_idx] = Cldfb_ImagBuffer_sfIn[ch_idx][slot_idx]; - } +void ivas_rend_CldfbSplitPostRendProcess( + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], + float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float output[][L_FRAME48k], + const int16_t is_cldfb_in ) +{ + int16_t ch_idx, slot_idx, num_cldfb_bands; + num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels; + + if ( is_cldfb_in == 0 ) + { + ivas_rend_CldfbSplitPostRendProcessTdIn( hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost, output ); + return; + } + + ivas_SplitRenderer_PostRenderer( + hBinHrSplitPostRend, + pMultiBinPoseData, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + QuaternionsPost ); + + /* Implement CLDFB synthesis */ + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + float *RealBuffer[CLDFB_NO_COL_MAX]; + float *ImagBuffer[CLDFB_NO_COL_MAX]; - cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][index_slot * num_cldfb_bands] ), num_cldfb_bands * MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; } + + cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } return; } + +void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapper ) +{ + hSplitRendWrapper->hBinHrSplitPostRend = NULL; + hSplitRendWrapper->hSplitBinLCLDDec = NULL; + ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); + return; +} #endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index f5f34302f9..456779f505 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -56,33 +56,6 @@ #define MAX_BAND_SMOOTH ( 1 ) #define SMOOTH_NORM_FACTOR ( 5.0f ) -static void ivas_mat_mult_2by2_complex( float in_re1[2][2], - float in_im1[2][2], - float in_re2[2][2], - float in_im2[2][2], - float out_re2[2][2], - float out_im2[2][2] ) -{ - int16_t i, j; - float tmp_re, tmp_im; - - for ( i = 0; i < 2; i++ ) - { - for ( j = 0; j < 2; j++ ) - { - - IVAS_CMULT_FLOAT( in_re1[i][0], in_im1[i][0], - in_re2[0][j], in_im2[0][j], tmp_re, tmp_im ); - out_re2[i][j] = tmp_re; - out_im2[i][j] = tmp_im; - IVAS_CMULT_FLOAT( in_re1[i][1], in_im1[i][1], - in_re2[1][j], in_im2[1][j], tmp_re, tmp_im ); - out_re2[i][j] += tmp_re; - out_im2[i][j] += tmp_im; - } - } - return; -} static void ivas_calc_mat_det_2by2_complex( float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float *det_re, @@ -286,17 +259,18 @@ static void ComputePostPredCov( } static void ComputeBandedCrossCov( - float Cldfb_RealBuffer1[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer1[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_RealBuffer2[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer2[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_RealBuffer1[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer1[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_RealBuffer2[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer2[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float out_cov_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float out_cov_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - int16_t num_chs, + const int16_t num_chs, const int16_t *pBand_grouping, - int16_t num_subframes, - int16_t md_band_idx, - int16_t real_only ) + const int16_t num_slots, + const int16_t start_slot_idx, + const int16_t md_band_idx, + const int16_t real_only ) { int16_t sf, cldfb_band_idx, ch_idx1, ch_idx2; int16_t brange[2]; @@ -314,7 +288,7 @@ static void ComputeBandedCrossCov( { if ( real_only == 0 ) { - for ( sf = 0; sf < num_subframes; sf++ ) + for ( sf = start_slot_idx; sf < start_slot_idx + num_slots; sf++ ) { for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { @@ -330,7 +304,7 @@ static void ComputeBandedCrossCov( } else { - for ( sf = 0; sf < num_subframes; sf++ ) + for ( sf = start_slot_idx; sf < start_slot_idx + num_slots; sf++ ) { for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { @@ -350,15 +324,16 @@ static void ComputeBandedCrossCov( } static void ComputeBandedCov( - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_RealBuffer[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float out_cov_re[][BINAURAL_CHANNELS], float out_cov_im[][BINAURAL_CHANNELS], - int16_t num_chs, + const int16_t num_chs, const int16_t *pBand_grouping, - int16_t num_subframes, - int16_t md_band_idx, - int16_t real_only ) + const int16_t num_slots, + const int16_t start_slot_idx, + const int16_t md_band_idx, + const int16_t real_only ) { int16_t sf, cldfb_band_idx, ch_idx1, ch_idx2; int16_t brange[2]; @@ -376,7 +351,7 @@ static void ComputeBandedCov( { if ( ( ch_idx2 != ch_idx1 ) && ( real_only == 0 ) ) { - for ( sf = 0; sf < num_subframes; sf++ ) + for ( sf = start_slot_idx; sf < start_slot_idx + num_slots; sf++ ) { for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { @@ -392,7 +367,7 @@ static void ComputeBandedCov( } else { - for ( sf = 0; sf < num_subframes; sf++ ) + for ( sf = start_slot_idx; sf < start_slot_idx + num_slots; sf++ ) { for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { @@ -473,53 +448,73 @@ static void ivas_split_rend_huffman_encode( static void ivas_split_rend_quant_md( BIN_HR_SPLIT_REND_MD_HANDLE hMd, + IVAS_SPLIT_REND_POSE_TYPE pose_type, int16_t real_only, float fix_pos_rot_mat[][BINAURAL_CHANNELS] ) { int16_t ch1, ch2; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + int16_t gd_idx_min; + float sign, quant_val; + + if ( pose_type == PRED_ONLY ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + if ( real_only == 1 ) { - hMd->pred_mat_re[ch1][ch2] -= fix_pos_rot_mat[ch1][ch2]; - hMd->pred_mat_re[ch1][ch2] = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( hMd->pred_mat_re[ch1][ch2], IVAS_SPLIT_REND_PRED_MIN_VAL ) ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sign = ( hMd->pred_mat_re[ch1][ch2] >= 0.0f ) ? 1.0f : -1.0f; + IVAS_CALCULATE_ABS( hMd->pred_mat_re[ch1][ch2], hMd->pred_mat_im[ch1][ch2], hMd->pred_mat_re[ch1][ch2] ); + hMd->pred_mat_re[ch1][ch2] *= sign; + hMd->pred_mat_im[ch1][ch2] = 0.0f; + } + } } - } - if ( real_only == 0 ) - { for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - hMd->pred_mat_im[ch1][ch2] = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( hMd->pred_mat_im[ch1][ch2], IVAS_SPLIT_REND_PRED_MIN_VAL ) ); + quant_val = hMd->pred_mat_re[ch1][ch2] - fix_pos_rot_mat[ch1][ch2]; + quant_val = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( quant_val, IVAS_SPLIT_REND_PRED_MIN_VAL ) ); + hMd->pred_mat_re_idx[ch1][ch2] = (int16_t) roundf( IVAS_SPLIT_REND_PRED_1BYQ_STEP * quant_val ); + // hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; } } + if ( real_only == 0 ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + quant_val = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( hMd->pred_mat_im[ch1][ch2], IVAS_SPLIT_REND_PRED_MIN_VAL ) ); + hMd->pred_mat_im_idx[ch1][ch2] = (int16_t) roundf( IVAS_SPLIT_REND_PRED_1BYQ_STEP * quant_val ); + // hMd->pred_mat_im[ch1][ch2] = hMd->pred_mat_im_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; + } + } + } + } + else if ( pose_type == COM_GAIN_ONLY ) + { + quant_val = min( IVAS_SPLIT_REND_D_MAX_VAL, max( hMd->gd, IVAS_SPLIT_REND_D_MIN_VAL ) ); + gd_idx_min = (int16_t) roundf( IVAS_SPLIT_REND_D_1BYQ_STEP * IVAS_SPLIT_REND_D_MIN_VAL ); + hMd->gd_idx = (int16_t) roundf( IVAS_SPLIT_REND_D_1BYQ_STEP * quant_val ); + hMd->gd = hMd->gd_idx * IVAS_SPLIT_REND_D_Q_STEP; + hMd->gd_idx = hMd->gd_idx - gd_idx_min; + } + else if ( pose_type == LR_GAIN_ONLY ) + { + quant_val = min( IVAS_SPLIT_REND_PITCH_G_MAX_VAL, max( hMd->gd, IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) ); + gd_idx_min = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * IVAS_SPLIT_REND_PITCH_G_MIN_VAL ); + hMd->gd_idx = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * quant_val ); + // hMd->gd = hMd->gd_idx * IVAS_SPLIT_REND_PITCH_G_Q_STEP; + hMd->gd_idx = hMd->gd_idx - gd_idx_min; + + quant_val = min( IVAS_SPLIT_REND_PITCH_G_MAX_VAL, max( hMd->gd2, IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) ); + hMd->gd2_idx = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * quant_val ); + // hMd->gd2 = hMd->gd2_idx * IVAS_SPLIT_REND_PITCH_G_Q_STEP; + hMd->gd2_idx = hMd->gd2_idx - gd_idx_min; } - hMd->gd = min( IVAS_SPLIT_REND_D_MAX_VAL, max( hMd->gd, IVAS_SPLIT_REND_D_MIN_VAL ) ); - - ivas_quantise_real_values( &hMd->pred_mat_re[0][0], - IVAS_SPLIT_REND_PRED_QUANT_PNTS, - IVAS_SPLIT_REND_PRED_MIN_VAL, - IVAS_SPLIT_REND_PRED_MAX_VAL, - &hMd->pred_mat_re_idx[0][0], - &hMd->pred_mat_re[0][0], - BINAURAL_CHANNELS * BINAURAL_CHANNELS ); - - ivas_quantise_real_values( &hMd->pred_mat_im[0][0], - IVAS_SPLIT_REND_PRED_QUANT_PNTS, - IVAS_SPLIT_REND_PRED_MIN_VAL, - IVAS_SPLIT_REND_PRED_MAX_VAL, - &hMd->pred_mat_im_idx[0][0], - &hMd->pred_mat_im[0][0], - BINAURAL_CHANNELS * BINAURAL_CHANNELS ); - - ivas_quantise_real_values( &hMd->gd, - IVAS_SPLIT_REND_D_QUANT_PNTS, - IVAS_SPLIT_REND_D_MIN_VAL, - IVAS_SPLIT_REND_D_MAX_VAL, - &hMd->gd_idx, - &hMd->gd, - 1 ); return; } @@ -532,7 +527,7 @@ static void ComputeCoeffs( float cov_io_im[][BINAURAL_CHANNELS], float cov_oo_re[][BINAURAL_CHANNELS], BIN_HR_SPLIT_REND_MD_HANDLE hMd, - float fix_pos_rot_mat[][BINAURAL_CHANNELS], + IVAS_SPLIT_REND_POSE_TYPE pose_type, int16_t real_only ) { float postpred_cov_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -546,328 +541,794 @@ static void ComputeCoeffs( float aa, bb, cc, dd, sign; int16_t i, j; - -#if 1 - - cov_norm_fact = GetNormFact( - cov_ii_re, - cov_ii_im, - cov_io_re, - cov_io_im, - cov_oo_re ); - - // normalize the covariance - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + if ( pose_type == PITCH_ONLY ) { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) +#if 0 + float gd_tmp; + + gd_tmp = cov_ii_re[0][0] + cov_ii_re[1][1]; + if ( gd_tmp < EPSILON ) { - cov_ii_norm_re[i][j] = cov_ii_re[i][j] * cov_norm_fact; - cov_ii_norm_im[i][j] = cov_ii_im[i][j] * cov_norm_fact; - cov_io_norm_re[i][j] = cov_io_re[i][j] * cov_norm_fact; - cov_io_norm_im[i][j] = cov_io_im[i][j] * cov_norm_fact; - cov_oo_norm_re[i][j] = cov_oo_re[i][j] * cov_norm_fact; + hMd->gd = 1.0f; + } + else + { + gd_tmp = ( cov_oo_re[0][0] + cov_oo_re[1][1] ) / gd_tmp; + hMd->gd = sqrtf( gd_tmp ); } - } - - ComputePredMat( cov_ii_norm_re, - cov_ii_norm_im, - cov_io_norm_re, - cov_io_norm_im, - hMd->pred_mat_re, - hMd->pred_mat_im, - BINAURAL_CHANNELS, - real_only ); #else + float gd_tmp[BINAURAL_CHANNELS]; + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + gd_tmp[i] = cov_ii_re[i][i]; + if ( gd_tmp[i] < EPSILON ) + { + gd_tmp[i] = 1.0f; + } + else + { + gd_tmp[i] = ( cov_oo_re[i][i] ) / gd_tmp[i]; + gd_tmp[i] = sqrtf( gd_tmp[i] ); + } + } + hMd->gd = gd_tmp[0]; + hMd->gd2 = gd_tmp[1]; #endif + } + else + { + cov_norm_fact = GetNormFact( + cov_ii_re, + cov_ii_im, + cov_io_re, + cov_io_im, + cov_oo_re ); + + // normalize the covariance + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + cov_ii_norm_re[i][j] = cov_ii_re[i][j] * cov_norm_fact; + cov_ii_norm_im[i][j] = cov_ii_im[i][j] * cov_norm_fact; + cov_io_norm_re[i][j] = cov_io_re[i][j] * cov_norm_fact; + cov_io_norm_im[i][j] = cov_io_im[i][j] * cov_norm_fact; + cov_oo_norm_re[i][j] = cov_oo_re[i][j] * cov_norm_fact; + } + } - /*TODO : change this function to real only as thats what is needed*/ - ComputePostPredCov( cov_ii_norm_re, + ComputePredMat( cov_ii_norm_re, cov_ii_norm_im, + cov_io_norm_re, + cov_io_norm_im, hMd->pred_mat_re, hMd->pred_mat_im, - postpred_cov_re, - postpred_cov_im, - BINAURAL_CHANNELS ); + BINAURAL_CHANNELS, + real_only ); - // normalize everything to +-1 range - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + + /*TODO : change this function to real only as thats what is needed*/ + ComputePostPredCov( cov_ii_norm_re, + cov_ii_norm_im, + hMd->pred_mat_re, + hMd->pred_mat_im, + postpred_cov_re, + postpred_cov_im, + BINAURAL_CHANNELS ); + + // normalize everything to +-1 range + gd = 1.0f / ( PCM16_TO_FLT_FAC ); + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { - postpred_cov_re[i][j] *= 1.0f / ( PCM16_TO_FLT_FAC ); - cov_ii_norm_re[i][j] = cov_ii_norm_re[i][j] * 1.0f / ( PCM16_TO_FLT_FAC ); - cov_oo_norm_re[i][j] = cov_oo_norm_re[i][j] * 1.0f / ( PCM16_TO_FLT_FAC ); + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + postpred_cov_re[i][j] *= gd; + cov_ii_norm_re[i][j] = cov_ii_norm_re[i][j] * gd; + cov_oo_norm_re[i][j] = cov_oo_norm_re[i][j] * gd; + } } - } - sigma_d = cov_ii_norm_re[0][0] + cov_ii_norm_re[1][1] + cov_ii_norm_re[0][1] + cov_ii_norm_re[1][0] + EPSILON; +#ifdef SPLIT_REND_ZERO_OUT_YAW_D + if ( 1 ) +#else + if ( pose_type != ANY_YAW ) +#endif + { + gd2 = 0.0f; + sigma_d = 0.0f; + hMd->gd = 0.0f; + } + else + { + + sigma_d = cov_ii_norm_re[0][0] + cov_ii_norm_re[1][1] + cov_ii_norm_re[0][1] + cov_ii_norm_re[1][0] + EPSILON; - rho_hat = max( EPSILON, sqrtf( postpred_cov_re[0][0] * postpred_cov_re[1][1] ) ); - rho_hat = postpred_cov_re[0][1] / rho_hat; - rho = max( EPSILON, sqrtf( cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1] ) ); - rho = cov_oo_norm_re[0][1] / rho; - rho_hat = min( max( rho_hat, -0.9999f ), 0.9999f ); - rho = min( max( rho, -0.9999f ), 0.9999f ); + rho_hat = max( EPSILON, sqrtf( postpred_cov_re[0][0] * postpred_cov_re[1][1] ) ); + rho_hat = postpred_cov_re[0][1] / rho_hat; + rho = max( EPSILON, sqrtf( cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1] ) ); + rho = cov_oo_norm_re[0][1] / rho; + rho_hat = min( max( rho_hat, -0.9999f ), 0.9999f ); + rho = min( max( rho, -0.9999f ), 0.9999f ); - // Compute decorrelator gain : gd2 = 0; - gd = 0; - gd2 = 0; + // Compute decorrelator gain : gd2 = 0; + gd = 0; + gd2 = 0; - aa = ( sigma_d * sigma_d ) * ( ( rho_hat * rho_hat ) - 1 ) + EPSILON; - bb = -( rho_hat * rho_hat ) * sigma_d * ( cov_oo_norm_re[0][0] + cov_oo_norm_re[1][1] ); - cc = ( rho_hat * rho_hat ) * cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1]; - cc -= cov_oo_norm_re[0][1] * cov_oo_norm_re[0][1]; + aa = ( sigma_d * sigma_d ) * ( ( rho_hat * rho_hat ) - 1 ) + EPSILON; + bb = -( rho_hat * rho_hat ) * sigma_d * ( cov_oo_norm_re[0][0] + cov_oo_norm_re[1][1] ); + cc = ( rho_hat * rho_hat ) * cov_oo_norm_re[0][0] * cov_oo_norm_re[1][1]; + cc -= cov_oo_norm_re[0][1] * cov_oo_norm_re[0][1]; - sign = +1.0f; - if ( rho < ( rho_hat - 0.0001 ) ) - { - bb -= 2 * sigma_d * cov_oo_norm_re[0][1]; - sign = -1.0f; - } - else if ( rho > ( rho_hat + 0.0001 ) ) - { - bb += 2 * sigma_d * cov_oo_norm_re[0][1]; - } - dd = bb * bb - ( 4 * aa * cc ); - if ( dd >= 0 ) - { - float gd2_1, gd2_2; - gd2_1 = ( -bb + sqrtf( dd ) ) / ( 2 * aa ); - gd2_2 = ( -bb - sqrtf( dd ) ) / ( 2 * aa ); - if ( ( gd2_1 >= 0 ) && ( gd2_2 >= 0 ) ) + sign = +1.0f; + if ( rho < ( rho_hat - 0.0001 ) ) + { + bb -= 2 * sigma_d * cov_oo_norm_re[0][1]; + sign = -1.0f; + } + else if ( rho > ( rho_hat + 0.0001 ) ) + { + bb += 2 * sigma_d * cov_oo_norm_re[0][1]; + } + dd = bb * bb - ( 4 * aa * cc ); + if ( dd >= 0 ) + { + float gd2_1, gd2_2; + gd2_1 = ( -bb + sqrtf( dd ) ) / ( 2 * aa ); + gd2_2 = ( -bb - sqrtf( dd ) ) / ( 2 * aa ); + if ( ( gd2_1 >= 0 ) && ( gd2_2 >= 0 ) ) + { + gd2 = min( gd2_1, gd2_2 ); + } + else + { + gd2 = max( 0, max( gd2_1, gd2_2 ) ); + } + gd = sign * sqrtf( gd2 ); + } + + gd = min( IVAS_SPLIT_REND_D_MAX_VAL, max( gd, IVAS_SPLIT_REND_D_MIN_VAL ) ); + hMd->gd = SPLIT_REND_DECOR_ALPHA * gd + ( 1 - SPLIT_REND_DECOR_ALPHA ) * hMd->gd; + gd2 = min( gd2, cov_oo_norm_re[0][0] / sigma_d ); + gd2 = min( gd2, cov_oo_norm_re[1][1] / sigma_d ); + } + + if ( postpred_cov_re[0][0] > EPSILON ) + { + gl2 = ( cov_oo_norm_re[0][0] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[0][0] ); + gl2 = max( gl2, 1.0f ); + gl2 = sqrtf( gl2 ); + } + else + { + gl2 = 1.0f; + } + if ( postpred_cov_re[1][1] > EPSILON ) { - gd2 = min( gd2_1, gd2_2 ); + gr2 = ( cov_oo_norm_re[1][1] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[1][1] ); + gr2 = max( gr2, 1.0f ); + gr2 = sqrtf( gr2 ); } else { - gd2 = max( 0, max( gd2_1, gd2_2 ) ); + gr2 = 1.0f; + } + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + hMd->pred_mat_re[i][0] *= gl2; + hMd->pred_mat_re[i][1] *= gr2; + } + if ( real_only == 0 ) + { + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + hMd->pred_mat_im[i][0] *= gl2; + hMd->pred_mat_im[i][1] *= gr2; + } } - gd = sign * sqrtf( gd2 ); } + return; +} - gd = min( 1.0f, max( gd, 0.0f ) ); - hMd->gd = SPLIT_REND_DECOR_ALPHA * gd + ( 1 - SPLIT_REND_DECOR_ALPHA ) * hMd->gd; - gd2 = min( gd2, cov_oo_norm_re[0][0] / sigma_d ); - gd2 = min( gd2, cov_oo_norm_re[1][1] / sigma_d ); +static void get_base2_bits( + const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int16_t num_subframes, + const int16_t num_quant_strats, + const int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + const int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + const int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + const int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + const int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + const int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int32_t base2bits[IVAS_SPLIT_REND_NUM_QUANT_STRATS] ) +{ + int16_t pred_bits, d_gain_bits, pitch_gain_bits, pose_idx, q; + IVAS_SPLIT_REND_POSE_TYPE pose_type; + pred_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_PRED_QUANT_PNTS ) ); + d_gain_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_D_QUANT_PNTS ) ); + pitch_gain_bits = d_gain_bits; - if ( postpred_cov_re[0][0] > EPSILON ) - { - gl2 = ( cov_oo_norm_re[0][0] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[0][0] ); - gl2 = max( gl2, 1.0f ); - gl2 = sqrtf( gl2 ); - } - else + for ( q = 0; q < num_quant_strats; q++ ) { - gl2 = 1.0f; - } - if ( postpred_cov_re[1][1] > EPSILON ) - { - gr2 = ( cov_oo_norm_re[1][1] - ( gd2 * sigma_d ) ) / max( EPSILON, postpred_cov_re[1][1] ); - gr2 = max( gr2, 1.0f ); - gr2 = sqrtf( gr2 ); - } - else - { - gr2 = 1.0f; + base2bits[q] = 0; } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + for ( q = 0; q < num_quant_strats; q++ ) { - hMd->pred_mat_re[i][0] *= gl2; - hMd->pred_mat_re[i][0] = min( 2.0f, max( hMd->pred_mat_re[i][0], -2.0f ) ); - - hMd->pred_mat_re[i][1] *= gr2; - hMd->pred_mat_re[i][1] = min( 2.0f, max( hMd->pred_mat_re[i][1], -2.0f ) ); - } - if ( real_only == 0 ) - { - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + for ( pose_idx = 0; pose_idx < pMultiBinPoseData->num_poses - 1; pose_idx++ ) { - hMd->pred_mat_im[i][0] *= gl2; - hMd->pred_mat_im[i][0] = min( 2.0f, max( hMd->pred_mat_im[i][0], -2.0f ) ); - - hMd->pred_mat_im[i][1] *= gr2; - hMd->pred_mat_im[i][1] = min( 2.0f, max( hMd->pred_mat_im[i][1], -2.0f ) ); + pose_type = hBinHrSplitPreRend->pose_type[pose_idx]; + if ( pose_type == ANY_YAW ) + { + base2bits[q] += pred_bits * pred_real_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; + base2bits[q] += pred_bits * pred_imag_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; + base2bits[q] += d_gain_bits * d_bands_yaw[q] * num_subframes; + } + else if ( pose_type == PITCH_ONLY ) + { + base2bits[q] += pitch_gain_bits * bands_pitch[q] * num_subframes; + base2bits[q] += pitch_gain_bits * bands_pitch[q] * num_subframes; + } + else + { + base2bits[q] += pred_bits * pred_real_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; + base2bits[q] += pred_bits * pred_imag_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; + } } } - ivas_split_rend_quant_md( hMd, real_only, fix_pos_rot_mat ); return; } static void ivas_SplitRenderer_code_md_base2( - BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], - BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg, - ivas_split_rend_bits_t *pBits, - int16_t sf_idx, - int16_t num_md_bands ) + const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int16_t num_subframes, + const int16_t pred_real_bands_yaw, + const int16_t pred_imag_bands_yaw, + const int16_t d_bands_yaw, + const int16_t bands_pitch, + const int16_t pred_real_bands_roll, + const int16_t pred_imag_bands_roll, + ivas_split_rend_bits_t *pBits ) { - int16_t real_only, pos_idx, b, ch1, ch2; - int16_t min_pred_idx, min_gd_idx, pred_code_len, gd_code_len; + int16_t pos_idx, b, ch1, ch2, sf_idx; + int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len, num_poses; int32_t code; BIN_HR_SPLIT_REND_MD_HANDLE hMd; + BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; + pHuff_cfg = &hBinHrSplitPreRend->huff_cfg; min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; + min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0]; pred_code_len = pHuff_cfg->pred_base2_code_len; gd_code_len = pHuff_cfg->gd_base2_code_len; + p_gd_code_len = pHuff_cfg->p_gd_base2_code_len; + + num_poses = pMultiBinPoseData->num_poses; - for ( b = 0; b < num_md_bands; b++ ) + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - if ( b < COMPLEX_MD_BAND_THRESH ) - { - real_only = 0; - } - else + for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ ) { - real_only = 1; - } + if ( hBinHrSplitPreRend->pose_type[pos_idx] == ANY_YAW ) + { + for ( b = 0; b < pred_real_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + } + } + } - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) - { - hMd = &rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_imag_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + } + } + } + for ( b = 0; b < d_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + code = hMd->gd_idx - min_gd_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, gd_code_len ); + } + } + else if ( hBinHrSplitPreRend->pose_type[pos_idx] == PITCH_ONLY ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + for ( b = 0; b < bands_pitch; b++ ) { - code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_idx; - ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + code = hMd->gd_idx - min_p_gd_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, p_gd_code_len ); + + code = hMd->gd2_idx - min_p_gd_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, p_gd_code_len ); } } - if ( real_only == 0 ) + else { - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_real_bands_roll; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + } + } + } + + for ( b = 0; b < pred_imag_bands_roll; b++ ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { - code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_idx; - ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + } } } } - code = hMd->gd_idx - min_gd_idx; - ivas_split_rend_bitstream_write_int32( pBits, code, gd_code_len ); } } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG { static int num_bits = 0; - static int cntr = 0, sh_cnt = 0; + static int cntr = 0; float fnum_bits; cntr++; - sh_cnt++; - if ( sh_cnt == MAX_PARAM_SPATIAL_SUBFRAMES ) + num_bits += pBits->bits_written; + // collect bits for every second + if ( cntr == 50 ) { - num_bits += pBits->bits_written; - // collect bits for every second - if ( cntr == 200 ) - { - cntr = 0; - fnum_bits = (float) num_bits / 1000.0f; - dbgwrite_txt( &fnum_bits, 1, "split_rend_MD_bitrate.txt", "MD bitrate (kbps)" ); - num_bits = 0; - } - sh_cnt = 0; + cntr = 0; + fnum_bits = (float) num_bits / 1000.0f; + dbgwrite_txt( &fnum_bits, 1, "split_rend_MD_bitrate.txt", "MD bitrate (kbps)" ); + num_bits = 0; } } #endif return; } -static void ivas_SplitRenderer_code_md( - BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_PARAM_SPATIAL_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS], - BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg, - ivas_split_rend_bits_t *pBits, - int16_t sf_idx, - int16_t num_md_bands ) +static void ivas_SplitRenderer_code_md_huff( + const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const int16_t num_subframes, + const int16_t pred_real_bands_yaw, + const int16_t pred_imag_bands_yaw, + const int16_t d_bands_yaw, + const int16_t bands_pitch, + const int16_t pred_real_bands_roll, + const int16_t pred_imag_bands_roll, + ivas_split_rend_bits_t *pBits ) { - int16_t real_only, pos_idx, b, ch1, ch2; + int16_t pos_idx, b, ch1, ch2, sf_idx, num_poses; int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t min_pred_idx, max_pred_idx; int32_t code, len; BIN_HR_SPLIT_REND_MD_HANDLE hMd; - + BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; + pHuff_cfg = &hBinHrSplitPreRend->huff_cfg; min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; - real_only = 0; - for ( b = 0; b < num_md_bands; b++ ) - { - if ( b < COMPLEX_MD_BAND_THRESH ) - { - real_only = 0; - } - else - { - real_only = 1; - } - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) - { - hMd = &rot_md[pos_idx][sf_idx][b]; + num_poses = pMultiBinPoseData->num_poses; - ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_idx, max_pred_idx ); - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) + { + for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ ) + { + if ( hBinHrSplitPreRend->pose_type[pos_idx] == ANY_YAW ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + for ( b = 0; b < pred_real_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_idx, max_pred_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + } + for ( b = 0; b < pred_imag_bands_yaw; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_idx, max_pred_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + } + for ( b = 0; b < d_bands_yaw; b++ ) { - ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_huffman_encode( &pHuff_cfg->gd, hMd->gd_idx, &code, &len ); ivas_split_rend_bitstream_write_int32( pBits, code, len ); } } - if ( real_only == 0 ) + else if ( hBinHrSplitPreRend->pose_type[pos_idx] == PITCH_ONLY ) + { + for ( b = 0; b < bands_pitch; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_huffman_encode( &pHuff_cfg->p_gd, hMd->gd_idx, &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + + ivas_split_rend_huffman_encode( &pHuff_cfg->p_gd, hMd->gd2_idx, &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + else { - ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_idx, max_pred_idx ); - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + for ( b = 0; b < pred_real_bands_roll; b++ ) { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_idx, max_pred_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { - ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); - ivas_split_rend_bitstream_write_int32( pBits, code, len ); + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + } + for ( b = 0; b < pred_imag_bands_roll; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_idx, max_pred_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } } } } - ivas_split_rend_huffman_encode( &pHuff_cfg->gd, hMd->gd_idx, &code, &len ); - ivas_split_rend_bitstream_write_int32( pBits, code, len ); } } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG { static int num_bits = 0; - static int cntr = 0, sh_cnt = 0; + static int cntr = 0; float fnum_bits; cntr++; - sh_cnt++; + num_bits += pBits->bits_written; + // collect bits for every second + if ( cntr == 50 ) + { + cntr = 0; + fnum_bits = (float) num_bits / 1000.0f; + dbgwrite_txt( &fnum_bits, 1, "split_rend_MD_bitrate.txt", "MD bitrate (kbps)" ); + num_bits = 0; + } + } +#endif + return; +} + +static void ivas_SplitRenderer_quant_code( + const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + ivas_split_rend_bits_t *pBits, + const int16_t low_res_pre_rend_rot, + const int32_t target_md_bits ) +{ + int16_t num_complex_bands, q, num_subframes, sf_idx, pos_idx, b, num_quant_strats; + int32_t overhead_bits, quant_strat_bits, huff_bits, start_bit; + int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + int32_t base2bits[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + + if ( low_res_pre_rend_rot ) + { + num_subframes = 1; + } + else + { + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + } + + overhead_bits = pBits->bits_written; + + // ivas_split_rend_bitstream_write_int32( pBits, low_res_pre_rend_rot, 1 ); + ivas_split_rend_bitstream_write_int32( pBits, pMultiBinPoseData->dof, IVAS_SPLIT_REND_DOF_BITS ); + ivas_split_rend_bitstream_write_int32( pBits, pMultiBinPoseData->hq_mode, IVAS_SPLIT_REND_HQ_MODE_BITS ); + ivas_split_rend_bitstream_write_int32( pBits, (int32_t) pMultiBinPoseData->rot_axis, IVAS_SPLIT_REND_ROT_AXIS_BITS ); + + /* code ref pose*/ + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) + { + int16_t angle; + IVAS_QUATERNION head_pos_euler; + Quat2EulerDegree( headPositions[sf_idx], &head_pos_euler.z, &head_pos_euler.y, &head_pos_euler.x ); + angle = (int16_t) roundf( head_pos_euler.x ); + angle += 180; + ivas_split_rend_bitstream_write_int32( pBits, angle, IVAS_SPLIT_REND_HEAD_POSE_BITS ); + + angle = (int16_t) roundf( head_pos_euler.y ); + angle += 180; + ivas_split_rend_bitstream_write_int32( pBits, angle, IVAS_SPLIT_REND_HEAD_POSE_BITS ); + + angle = (int16_t) roundf( head_pos_euler.z ); + angle += 180; + ivas_split_rend_bitstream_write_int32( pBits, angle, IVAS_SPLIT_REND_HEAD_POSE_BITS ); + } - if ( sh_cnt == MAX_PARAM_SPATIAL_SUBFRAMES ) + ivas_split_rend_get_quant_params( + MAX_SPLIT_REND_MD_BANDS, + pred_real_bands_yaw, + pred_imag_bands_yaw, + d_bands_yaw, + bands_pitch, + pred_real_bands_roll, + pred_imag_bands_roll, + &num_quant_strats, + &num_complex_bands ); + quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) ); + + overhead_bits = pBits->bits_written - overhead_bits + quant_strat_bits + 1; // 1 for base2 vs huff + get_base2_bits( + hBinHrSplitPreRend, + pMultiBinPoseData, + num_subframes, + num_quant_strats, + pred_real_bands_yaw, + pred_imag_bands_yaw, + d_bands_yaw, + bands_pitch, + pred_real_bands_roll, + pred_imag_bands_roll, + base2bits ); + + for ( q = 0; q < num_quant_strats; q++ ) + { + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - num_bits += pBits->bits_written; - // collect bits for every second - if ( cntr == 200 ) + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { - cntr = 0; - fnum_bits = (float) num_bits / 1000.0f; - dbgwrite_txt( &fnum_bits, 1, "split_rend_MD_bitrate.txt", "MD bitrate (kbps)" ); - num_bits = 0; + if ( hBinHrSplitPreRend->pose_type[pos_idx] == ANY_YAW ) + { + for ( b = 0; b < pred_imag_bands_yaw[q]; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_quant_md( hMd, + PRED_ONLY, + 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < pred_real_bands_yaw[q]; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_quant_md( hMd, + PRED_ONLY, + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + } + for ( b = 0; b < d_bands_yaw[q]; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_quant_md( hMd, + COM_GAIN_ONLY, + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + } + } + else if ( hBinHrSplitPreRend->pose_type[pos_idx] == PITCH_ONLY ) + { + for ( b = 0; b < bands_pitch[q]; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_quant_md( hMd, + LR_GAIN_ONLY, + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + } + } + else + { + for ( b = 0; b < pred_imag_bands_roll[q]; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_quant_md( hMd, + PRED_ONLY, + 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + } + for ( ; b < pred_real_bands_roll[q]; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_split_rend_quant_md( hMd, + PRED_ONLY, + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + } + } + } + } + + /*get base2 bits and check if its within target. if yes then code with base2 to save complexity on post renderer*/ +#if 0 + if ( target_md_bits >= ( base2bits[q] + overhead_bits ) ) + { + ivas_split_rend_bitstream_write_int32( pBits, 0, 1 ); + ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits ); + ivas_SplitRenderer_code_md_base2( + hBinHrSplitPreRend, + pMultiBinPoseData, + num_subframes, + pred_real_bands_yaw[q], + pred_imag_bands_yaw[q], + d_bands_yaw[q], + bands_pitch[q], + pred_real_bands_roll[q], + pred_imag_bands_roll[q], + pBits ); + break; + } + else +#endif + { + start_bit = pBits->bits_written; + ivas_split_rend_bitstream_write_int32( pBits, 1, 1 ); + ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits ); + huff_bits = pBits->bits_written; + ivas_SplitRenderer_code_md_huff( + hBinHrSplitPreRend, + pMultiBinPoseData, + num_subframes, + pred_real_bands_yaw[q], + pred_imag_bands_yaw[q], + d_bands_yaw[q], + bands_pitch[q], + pred_real_bands_roll[q], + pred_imag_bands_roll[q], + pBits ); + huff_bits = pBits->bits_written - huff_bits; + if ( ( target_md_bits >= ( base2bits[q] + overhead_bits ) ) || ( target_md_bits >= ( huff_bits + overhead_bits ) ) || ( q == ( num_quant_strats - 1 ) ) ) + { + if ( huff_bits > base2bits[q] ) + { + pBits->bits_written = start_bit; + ivas_split_rend_bitstream_write_int32( pBits, 0, 1 ); + ivas_split_rend_bitstream_write_int32( pBits, q, quant_strat_bits ); + ivas_SplitRenderer_code_md_base2( + hBinHrSplitPreRend, + pMultiBinPoseData, + num_subframes, + pred_real_bands_yaw[q], + pred_imag_bands_yaw[q], + d_bands_yaw[q], + bands_pitch[q], + pred_real_bands_roll[q], + pred_imag_bands_roll[q], + pBits ); + } + break; + } + pBits->bits_written = start_bit; + } + } + +#ifdef SPLIT_MD_CODING_DEBUG + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) + { + int16_t val, quant_strat, ch1, ch2; + char filename[200] = "split_md_debug_indices.bin"; + quant_strat = q; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) + { + if ( hBinHrSplitPreRend->pose_type[pos_idx] == ANY_YAW ) + { + for ( b = 0; b < pred_real_bands_yaw[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + } + } + } + for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + } + } + } + for ( b = 0; b < d_bands_yaw[quant_strat]; b++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + } + } + else if ( hBinHrSplitPreRend->pose_type[pos_idx] == PITCH_ONLY ) + { + for ( b = 0; b < bands_pitch[quant_strat]; b++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd2_idx; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + } + } + else + { + for ( b = 0; b < pred_real_bands_roll[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2]; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + } + } + } + for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ ) + { + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2]; + dbgwrite( &val, sizeof( int16_t ), 1, 1, filename ); + } + } + } } - sh_cnt = 0; } } #endif + return; } + void ivas_SplitRenderer_GetRotMd( - BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ - float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ - ivas_split_rend_bits_t *pBits, - int16_t sf_idx ) + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + int16_t low_res ) { float cov_ii_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float cov_oo_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -877,110 +1338,112 @@ void ivas_SplitRenderer_GetRotMd( float cov_io_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t real_only = 0; - int16_t pos_idx, b; - int16_t yaw_idx; - int16_t num_md_bands; + int16_t pos_idx, b, sf_idx, start_slot_idx, num_slots, num_subframes; + int16_t num_md_bands, num_poses; const int16_t *pBand_grouping = SplitRend_band_grouping; num_md_bands = MAX_SPLIT_REND_MD_BANDS; wmops_sub_start( "ivas_SplitRenderer_GetRotMd" ); + num_poses = pMultiBinPoseData->num_poses; + + if ( low_res ) + { + num_slots = CLDFB_NO_COL_MAX; + num_subframes = 1; + } + else + { + num_slots = MAX_PARAM_SPATIAL_SUBFRAMES; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + } /*compute reference signal covariance*/ - for ( b = 0; b < num_md_bands; b++ ) + for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - if ( b < COMPLEX_MD_BAND_THRESH ) - { - real_only = 0; - } - else + start_slot_idx = sf_idx * num_slots; + for ( b = 0; b < num_md_bands; b++ ) { - real_only = 1; - } - ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[0], - Cldfb_ImagBuffer_Ref_Binaural[0], - cov_ii_re, cov_ii_im, - BINAURAL_CHANNELS, - pBand_grouping, - MAX_PARAM_SPATIAL_SUBFRAMES, b, real_only ); - - /*compute rotated signal covariance*/ - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) - { - ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural[0], - Cldfb_ImagBuffer_Ref_Binaural[0], - Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], - Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], - cov_io_re, cov_io_im, - BINAURAL_CHANNELS, - pBand_grouping, - MAX_PARAM_SPATIAL_SUBFRAMES, b, real_only ); - - ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], - Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], - cov_oo_re, cov_oo_im, + if ( b < COMPLEX_MD_BAND_THRESH ) + { + real_only = 0; + } + else + { + real_only = 1; + } + ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[0], + Cldfb_ImagBuffer_Ref_Binaural[0], + cov_ii_re, cov_ii_im, BINAURAL_CHANNELS, pBand_grouping, - MAX_PARAM_SPATIAL_SUBFRAMES, b, real_only ); - - yaw_idx = ( pos_idx / ( MAX_PITCH_ANGLES * MAX_ROLL_ANGLES ) ); - ComputeCoeffs( cov_ii_re, - cov_ii_im, - cov_io_re, - cov_io_im, - cov_oo_re, - &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b], - hBinHrSplitPreRend->fix_pos_rot_mat[yaw_idx], - real_only ); - } - } + num_slots, start_slot_idx, b, real_only ); -#ifdef SPLIT_REND_BASE2_CODING - ivas_SplitRenderer_code_md_base2( - hBinHrSplitPreRend->rot_md, - &hBinHrSplitPreRend->huff_cfg, - pBits, - sf_idx, - num_md_bands ); -#else - ivas_SplitRenderer_code_md( - hBinHrSplitPreRend->rot_md, - &hBinHrSplitPreRend->huff_cfg, - pBits, - sf_idx, - num_md_bands ); -#endif + /*compute rotated signal covariance*/ + for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ ) + { + ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural[0], + Cldfb_ImagBuffer_Ref_Binaural[0], + Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], + Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + cov_io_re, cov_io_im, + BINAURAL_CHANNELS, + pBand_grouping, + num_slots, start_slot_idx, b, real_only ); + + ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], + Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + cov_oo_re, cov_oo_im, + BINAURAL_CHANNELS, + pBand_grouping, + num_slots, start_slot_idx, b, real_only ); + + ComputeCoeffs( cov_ii_re, + cov_ii_im, + cov_io_re, + cov_io_im, + cov_oo_re, + &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b], + hBinHrSplitPreRend->pose_type[pos_idx], + real_only ); + } + } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - { - int16_t num_cldfb_bands; - num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { - char fname[200] = "rotated_ref_pos"; - char tag[2]; - tag[0] = (char) ( '0' + pos_idx ); - tag[1] = '\0'; - strcat( fname, tag ); - strcat( fname, ".wav" ); + int16_t num_cldfb_bands; + num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; + for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ ) + { + char fname[200] = "rotated_cldfbref_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + ivas_log_cldfb2wav_data( + Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], + Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + hBinHrSplitPreRend->cldfbSynRotBinDec[pos_idx], + BINAURAL_CHANNELS, + num_cldfb_bands, + 48000, + num_slots, + start_slot_idx, + fname ); + } ivas_log_cldfb2wav_data( - Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], - Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], - hBinHrSplitPreRend->cldfbSynRotBinDec[pos_idx], + Cldfb_RealBuffer_Ref_Binaural[0], + Cldfb_ImagBuffer_Ref_Binaural[0], + hBinHrSplitPreRend->cldfbSynRotBinDec[MAX_HEAD_ROT_POSES], BINAURAL_CHANNELS, num_cldfb_bands, 48000, - fname ); + num_slots, + start_slot_idx, + "rotated_cldfbref_RefPos.wav" ); } - ivas_log_cldfb2wav_data( - Cldfb_RealBuffer_Ref_Binaural[0], - Cldfb_ImagBuffer_Ref_Binaural[0], - hBinHrSplitPreRend->cldfbSynRotBinDec[MAX_HEAD_ROT_POSES], - BINAURAL_CHANNELS, - num_cldfb_bands, - 48000, - "rotated_ref_RefPos.wav" ); - } #endif + } wmops_sub_end(); @@ -989,54 +1452,36 @@ void ivas_SplitRenderer_GetRotMd( void ivas_rend_CldfbSplitPreRendProcess( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, + const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_bands, - ivas_split_rend_bits_t *pBits ) + ivas_split_rend_bits_t *pBits, + const int32_t target_md_bits, + const int16_t low_res_pre_rend_rot ) { - int16_t sf_idx, slot_idx, ch_idx, idx, pos_idx, num_poses; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - num_poses = MAX_HEAD_ROT_POSES + 1; -#else - num_poses = MAX_HEAD_ROT_POSES; -#endif - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) - { - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) - { - for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) - { - idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; - for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) - { - mvr2r( &Cldfb_In_BinReal[pos_idx][ch_idx][idx][0], &Cldfb_RealBuffer_Binaural[pos_idx][ch_idx][slot_idx][0], max_bands ); - mvr2r( &Cldfb_In_BinImag[pos_idx][ch_idx][idx][0], &Cldfb_ImagBuffer_Binaural[pos_idx][ch_idx][slot_idx][0], max_bands ); - } - } - } + ivas_SplitRenderer_GetRotMd( + hBinHrSplitPreRend, + pMultiBinPoseData, + Cldfb_In_BinReal, + Cldfb_In_BinImag, + low_res_pre_rend_rot ); - ivas_SplitRenderer_GetRotMd( - hBinHrSplitPreRend, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - pBits, - sf_idx ); - } + ivas_SplitRenderer_quant_code( + hBinHrSplitPreRend, + headPositions, + pMultiBinPoseData, + pBits, + low_res_pre_rend_rot, + target_md_bits ); return; } ivas_error ivas_splitBinPreRendOpen( - BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend + 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 @@ -1077,7 +1522,7 @@ ivas_error ivas_splitBinPreRendOpen( } #endif - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { @@ -1087,7 +1532,8 @@ ivas_error ivas_splitBinPreRendOpen( } } } - set_fix_rotation_mat( hBinRend->fix_pos_rot_mat ); + set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData ); + set_pose_types( hBinRend->pose_type, pMultiBinPoseData ); ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); *hBinHrSplitPreRend = hBinRend; return error; @@ -1121,31 +1567,44 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ) { - hSplitRendWrapper->hBinHrSplitPostRend = NULL; hSplitRendWrapper->hBinHrSplitPreRend = NULL; hSplitRendWrapper->hCldfbHandles = NULL; - hSplitRendWrapper->hSplitBinLCLDDec = NULL; hSplitRendWrapper->hSplitBinLCLDEnc = NULL; + + ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); return; } -ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const int32_t OutSampleRate, const IVAS_SPLIT_REND_MODE splitRendMode, const int16_t is_cldfb_in ) +ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, + const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + const int32_t OutSampleRate, + const int16_t is_cldfb_in, + const int16_t is_pcm_out ) { ivas_error error, ch, num_ch; error = IVAS_ERR_OK; + hSplitRendWrapper->hCldfbHandles = NULL; if ( is_cldfb_in == 0 ) { if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) count_malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + num_ch = ( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS; +#else num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; +#endif for ( ch = 0; ch < num_ch; ch++ ) { hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; } - +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + num_ch = ( 1 + hSplitRendWrapper->multiBinPoseData.num_poses ) * BINAURAL_CHANNELS; +#else + num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; +#endif for ( ch = 0; ch < num_ch; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) @@ -1155,61 +1614,25 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, cons } } - switch ( splitRendMode ) - { - case SPLIT_REND_PRE: - - error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - , - OutSampleRate -#endif - ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, 2, 384000 ); - break; - case SPLIT_REND_POST: - error = ivas_splitBinPostRendOpen( &hSplitRendWrapper->hBinHrSplitPostRend, OutSampleRate ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec, OutSampleRate, 2 ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - break; - case SPLIT_REND_COMB: - error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend + error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend, + &hSplitRendWrapper->multiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - , - OutSampleRate + , + OutSampleRate #endif - ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, 2, 384000 ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - error = ivas_splitBinPostRendOpen( &hSplitRendWrapper->hBinHrSplitPostRend, OutSampleRate ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - error = ivas_splitBinLCLDDecOpen( &hSplitRendWrapper->hSplitBinLCLDDec, OutSampleRate, 2 ); - break; - default: - return IVAS_ERR_INVALID_OUTPUT_FORMAT; + ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + if ( is_pcm_out == 0 ) + { + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, 2, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate ) ); + if ( error != IVAS_ERR_OK ) + { + return error; + } } - return error; } @@ -1223,102 +1646,192 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) { ivas_splitBinLCLDEncClose( &hSplitBinRend->hSplitBinLCLDEnc ); } - if ( hSplitBinRend->hBinHrSplitPostRend != NULL ) - { - ivas_splitBinPostRendClose( &hSplitBinRend->hBinHrSplitPostRend ); - } - if ( hSplitBinRend->hSplitBinLCLDDec != NULL ) - { - ivas_splitBinLCLDDecClose( &hSplitBinRend->hSplitBinLCLDDec ); - } if ( hSplitBinRend->hCldfbHandles != NULL ) { + int16_t num_ch, ch; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + num_ch = ( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS; +#else + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; +#endif + for ( ch = 0; ch < num_ch; ch++ ) + { + if ( hSplitBinRend->hCldfbHandles->cldfbAna[ch] != NULL ) + { + deleteCldfb( &hSplitBinRend->hCldfbHandles->cldfbAna[ch] ); + hSplitBinRend->hCldfbHandles->cldfbAna[ch] = NULL; + } + } + count_free( hSplitBinRend->hCldfbHandles ); hSplitBinRend->hCldfbHandles = NULL; } return; } -ivas_error ivas_renderMultiBinToSplitBinaural( +static ivas_error ivas_renderMultiTDBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, + const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], + const int32_t SplitRendBitRate, ivas_split_rend_bits_t *pBits, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES], - const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], const int16_t max_bands, - float out[][L_FRAME48k] ) + float in[][L_FRAME48k], + const int16_t low_res_pre_rend_rot, + const int16_t pcm_out ) { ivas_error error; + int32_t bit_len, available_bits, target_md_bits, actual_md_bits; + int16_t num_cldfb_bands, ch, slot_idx, pos_idx, num_poses; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#endif + error = IVAS_ERR_OK; - if ( hSplitBin->hCldfbHandles != NULL ) + assert( hSplitBin->hCldfbHandles != NULL ); + num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; + num_poses = hSplitBin->multiBinPoseData.num_poses; + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { - /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ - int16_t num_cldfb_bands, ch, slot_idx, pos_idx; + float *pPcm[BINAURAL_CHANNELS]; + + char fname[200] = "rotated_ref_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + for ( int i = 0; i < BINAURAL_CHANNELS; i++ ) + { + pPcm[i] = in[pos_idx * BINAURAL_CHANNELS + i]; + } + dbgwrite_wav( pPcm, 960, + fname, 48000, BINAURAL_CHANNELS ); + } +#endif - assert( hSplitBin->hCldfbHandles != NULL ); - num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; - /* CLDFB Analysis*/ + + /* CLDFB Analysis*/ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES + 1; pos_idx++ ) + for ( pos_idx = 0; pos_idx < num_poses + 1; pos_idx++ ) #else - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) #endif + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) - { - cldfbAnalysis_ts( &( out[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), - Cldfb_In_BinReal[pos_idx][ch][slot_idx], - Cldfb_In_BinImag[pos_idx][ch][slot_idx], - max_bands, - hSplitBin->hCldfbHandles->cldfbAna[ch] ); - } + cldfbAnalysis_ts( &( in[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), + Cldfb_In_BinReal[pos_idx][ch][slot_idx], + Cldfb_In_BinImag[pos_idx][ch][slot_idx], + max_bands, + hSplitBin->hCldfbHandles->cldfbAna[pos_idx * BINAURAL_CHANNELS + ch] ); } } } + target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written; ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, + headPositions, + &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, - max_bands, - pBits ); - - ivas_splitBinLCLDEncProcess( - hSplitBin->hSplitBinLCLDEnc, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0], - pBits ); + pBits, + target_md_bits, + low_res_pre_rend_rot ); + if ( pcm_out == 0 ) + { + // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; + available_bits = SplitRendBitRate * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written - actual_md_bits; + available_bits -= actual_md_bits; + ivas_splitBinLCLDEncProcess( + hSplitBin->hSplitBinLCLDEnc, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0], + available_bits, + pBits ); + } - /*CLFDB decoding and SPLIT post rendering MD based adjustments*/ + /*zero pad*/ + bit_len = SplitRendBitRate / FRAMES_PER_SEC; + while ( pBits->bits_written < bit_len ) { + ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 ); + } + return error; +} - ivas_splitBinPostRendMdDec( - pBits, - hSplitBin->hBinHrSplitPostRend, -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - hSplitBin->hBinHrSplitPreRend, -#endif - MAX_SPLIT_REND_MD_BANDS ); +ivas_error ivas_renderMultiBinToSplitBinaural( + SPLIT_REND_WRAPPER *hSplitBin, + const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], + const int32_t SplitRendBitRate, + ivas_split_rend_bits_t *pBits, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t max_bands, + float out[][L_FRAME48k], + const int16_t low_res_pre_rend_rot, + const int16_t pcm_out ) +{ + ivas_error error; + int32_t bit_len, target_md_bits, actual_md_bits, available_bits; + error = IVAS_ERR_OK; - ivas_splitBinLCLDDecProcess( - hSplitBin->hSplitBinLCLDDec, - pBits, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0] ); + set_fix_rotation_mat( hSplitBin->hBinHrSplitPreRend->fix_pos_rot_mat, &hSplitBin->multiBinPoseData ); + set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); - ivas_rend_CldfbSplitPostRendProcess( - hSplitBin->hBinHrSplitPostRend, - QuaternionsPre, - QuaternionsPost, + if ( hSplitBin->hCldfbHandles != NULL ) + { + /*TD input*/ + /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ + error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPositions, SplitRendBitRate, pBits, max_bands, out, + low_res_pre_rend_rot, pcm_out ); + return error; + } + target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written; + ivas_rend_CldfbSplitPreRendProcess( + hSplitBin->hBinHrSplitPreRend, + headPositions, + &hSplitBin->multiBinPoseData, + Cldfb_In_BinReal, + Cldfb_In_BinImag, + pBits, + target_md_bits, + low_res_pre_rend_rot ); + + if ( pcm_out == 0 ) + { + // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; + available_bits = SplitRendBitRate * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written - actual_md_bits; + available_bits -= actual_md_bits; + ivas_splitBinLCLDEncProcess( + hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0], - out ); + available_bits, + pBits ); } + /*zero pad*/ + /*TODO: do this inside the LCLD ENC codec */ + bit_len = SplitRendBitRate / FRAMES_PER_SEC; + + while ( pBits->bits_written < bit_len ) + { + ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 ); + } return error; } #endif \ No newline at end of file diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 9d68e424fd..ca97872929 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -49,6 +49,34 @@ #include "wmops.h" #ifdef SPLIT_REND_WITH_HEAD_ROT + +void ivas_mat_mult_2by2_complex( float in_re1[2][2], + float in_im1[2][2], + float in_re2[2][2], + float in_im2[2][2], + float out_re2[2][2], + float out_im2[2][2] ) +{ + int16_t i, j; + float tmp_re, tmp_im; + + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 2; j++ ) + { + + IVAS_CMULT_FLOAT( in_re1[i][0], in_im1[i][0], + in_re2[0][j], in_im2[0][j], tmp_re, tmp_im ); + out_re2[i][j] = tmp_re; + out_im2[i][j] = tmp_im; + IVAS_CMULT_FLOAT( in_re1[i][1], in_im1[i][1], + in_re2[1][j], in_im2[1][j], tmp_re, tmp_im ); + out_re2[i][j] += tmp_re; + out_im2[i][j] += tmp_im; + } + } + return; +} void ivas_split_rend_bitstream_init( ivas_split_rend_bits_t *pBits, const int32_t buf_len_bytes, uint8_t *pbuf ) { pBits->bits_buf = pbuf; @@ -143,17 +171,30 @@ void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg ) ivas_split_huff_get_idx_trav_list( pHuff_cfg->gd_idx_trav, &pHuff_cfg->gd ); pHuff_cfg->gd_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->gd.sym_len ) ); + pHuff_cfg->p_gd.codebook = &ivas_split_rend_huff_p_d_consts[0][0]; + pHuff_cfg->p_gd.sym_len = IVAS_SPLIT_REND_D_QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->p_gd ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->p_gd_idx_trav, &pHuff_cfg->p_gd ); + pHuff_cfg->p_gd_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->p_gd.sym_len ) ); + + pHuff_cfg->p_gd_diff.codebook = &ivas_split_rend_huff_p_d_diff_consts[0][0]; + pHuff_cfg->p_gd_diff.sym_len = IVAS_SPLIT_REND_D_QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->p_gd_diff ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->p_gd_diff_idx_trav, &pHuff_cfg->p_gd_diff ); + pHuff_cfg->p_gd_diff_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->p_gd_diff.sym_len ) ); + return; } -void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) { float yaw_a, cos_yaw, sin_yaw; int16_t pos_idx; yaw_a = 0.0f; - for ( pos_idx = 0; pos_idx < MAX_YAW_ANGLES - 1; pos_idx++ ) + + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) { - yaw_a += split_rend_relative_yaw_angles[pos_idx + 1]; + yaw_a = pMultiBinPoseData->relative_head_poses[pos_idx + 1][0]; cos_yaw = cosf( EVS_PI * yaw_a / 180.0f ); sin_yaw = sinf( EVS_PI * yaw_a / 180.0f ); sin_yaw = 0.0f; @@ -165,6 +206,31 @@ void set_fix_rotation_mat( float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_C return; } +void set_pose_types( IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) +{ + int16_t pos_idx; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) + { + if ( fabs( pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] ) > EPSILON ) + { + pose_type[pos_idx] = ANY_YAW; + } + else if ( fabs( pMultiBinPoseData->relative_head_poses[pos_idx + 1][2] ) > EPSILON ) + { +#ifdef SPLIT_REND_REAL_ONLY_ROLL + pose_type[pos_idx] = PITCH_ONLY; +#else + pose_type[pos_idx] = ANY_ROLL; +#endif + } + else + { + pose_type[pos_idx] = PITCH_ONLY; + } + } + return; +} + int16_t wrap_a( int16_t val, int16_t min_val, int16_t max_val ) { if ( val < min_val ) @@ -195,10 +261,10 @@ void ivas_SplitRenderer_getdiagdiff( return; } - int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int32_t bits ) { - int32_t val, k; + int32_t val, k, bit_val; + #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG assert( ( pBits->bits_written - pBits->bits_read ) >= bits ); assert( bits <= 32 ); @@ -208,10 +274,15 @@ int32_t ivas_split_rend_bitstream_read_int32( ivas_split_rend_bits_t *pBits, int val = 0; for ( k = bits - 1; k >= 0; k-- ) { +#if 0 if ( pBits->bits_buf[pBits->bits_read >> 3] & ( 1 << ( pBits->bits_read & 7 ) ) ) { val |= 1 << k; } +#else + bit_val = ( pBits->bits_buf[pBits->bits_read >> 3] & ( 1 << ( pBits->bits_read & 7 ) ) ) != 0; + val |= bit_val << k; +#endif pBits->bits_read++; } return val; @@ -246,7 +317,6 @@ void ivas_split_rend_bitstream_write_int32( ivas_split_rend_bits_t *pBits, int32 return; } - IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], int16_t subframe_idx ) @@ -260,41 +330,293 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG void ivas_log_cldfb2wav_data( - float Cldfb_In_Real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_Imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], HANDLE_CLDFB_FILTER_BANK *cldfbSyn, const int16_t num_chs, const int16_t num_freq_bands, const int32_t output_Fs, + const int16_t num_slots, + const int16_t start_slot_idx, const char *filename ) { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *RealBuffer[CLDFB_NO_COL_MAX]; + float *ImagBuffer[CLDFB_NO_COL_MAX]; float pcm_out[BINAURAL_CHANNELS][L_FRAME48k]; float *pPcm[BINAURAL_CHANNELS]; - float Cldfb_local_Real[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_local_Imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_local_Real[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_local_Imag[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; int16_t sf, ch; assert( num_chs <= BINAURAL_CHANNELS ); for ( ch = 0; ch < num_chs; ch++ ) { - for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + for ( sf = start_slot_idx; sf < start_slot_idx + num_slots; sf++ ) { mvr2r( Cldfb_In_Real[ch][sf], Cldfb_local_Real[ch][sf], num_freq_bands ); mvr2r( Cldfb_In_Imag[ch][sf], Cldfb_local_Imag[ch][sf], num_freq_bands ); - RealBuffer[sf] = Cldfb_local_Real[ch][sf]; - ImagBuffer[sf] = Cldfb_local_Imag[ch][sf]; + RealBuffer[sf - start_slot_idx] = Cldfb_local_Real[ch][sf]; + ImagBuffer[sf - start_slot_idx] = Cldfb_local_Imag[ch][sf]; } cldfbSynthesis( RealBuffer, ImagBuffer, &( pcm_out[ch][0] ), - num_freq_bands * MAX_PARAM_SPATIAL_SUBFRAMES, + num_freq_bands * num_slots, cldfbSyn[ch] ); pPcm[ch] = pcm_out[ch]; } - dbgwrite_wav( pPcm, num_freq_bands * MAX_PARAM_SPATIAL_SUBFRAMES, + dbgwrite_wav( pPcm, num_freq_bands * num_slots, filename, output_Fs, num_chs ); } #endif + +int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out ) +{ + int32_t md_bitrate; + if ( pcm_out == 1 ) + { + md_bitrate = SplitRendBitRate; + } + else + { + switch ( SplitRendBitRate ) + { + case SPLIT_REND_768k: + { + md_bitrate = 256000; + break; + } + case SPLIT_REND_512k: + { + md_bitrate = 128000; + break; + } + case SPLIT_REND_384k: + { + md_bitrate = 128000; + break; + } + default: + { + return -1; + } + } + } + return md_bitrate; +} + +int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate ) +{ + switch ( SplitRendBitRate ) + { + case SPLIT_REND_768k: + { + return IVAS_384k; + } + case SPLIT_REND_512k: + { + return IVAS_384k; + } + case SPLIT_REND_384k: + { + return IVAS_256k; + } + default: + { + return -1; + } + } +} + +void ivas_split_rend_get_quant_params( + const int16_t num_md_bands, + int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + int16_t *num_quant_strats, + int16_t *num_complex_bands ) +{ + int16_t q; + + *num_quant_strats = IVAS_SPLIT_REND_NUM_QUANT_STRATS; + *num_complex_bands = COMPLEX_MD_BAND_THRESH_LOW; + assert( *num_complex_bands <= num_md_bands ); + + + for ( q = 0; q < *num_quant_strats; q++ ) + { + pred_real_bands_yaw[q] = num_md_bands; + pred_real_bands_roll[q] = num_md_bands; + } + pred_imag_bands_yaw[0] = num_md_bands; + pred_imag_bands_roll[0] = num_md_bands; + for ( q = 1; q < *num_quant_strats; q++ ) + { + pred_imag_bands_yaw[q] = ( q == 1 ) ? num_md_bands : *num_complex_bands; + pred_imag_bands_roll[q] = *num_complex_bands; + } + +#ifdef SPLIT_REND_ZERO_OUT_YAW_D + d_bands_yaw[0] = 0; +#else + d_bands_yaw[0] = num_md_bands; +#endif + bands_pitch[0] = num_md_bands; + for ( q = 1; q < *num_quant_strats; q++ ) + { + d_bands_yaw[q] = 0; + bands_pitch[q] = num_md_bands; + } + + return; +} + +void ivas_renderSplitGetMultiBinPoseData( + const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const IVAS_SPLIT_REND_ROT_AXIS rot_axis ) +{ + int16_t pos_idx, num_yaw_poses, num_pitch_poses, num_roll_poses; + const float *relative_yaw_angles; + const float *relative_pitch_angles; + const float *relative_roll_angles; + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + pMultiBinPoseData->relative_head_poses[pos_idx][0] = 0.0f; + pMultiBinPoseData->relative_head_poses[pos_idx][1] = 0.0f; + pMultiBinPoseData->relative_head_poses[pos_idx][2] = 0.0f; + } + + num_yaw_poses = 0; + num_pitch_poses = 0; + num_roll_poses = 0; + + if ( pSplit_rend_config->dof == 1 ) + { + relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq; + relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq; + relative_roll_angles = split_rend_relative_roll_pos_angles_hq; + switch ( rot_axis ) + { + case DEFAULT_AXIS: + case YAW: + { + num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + break; + } + case PITCH: + { + num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + break; + } + case ROLL: + { + num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + break; + } + default: + { + assert( 0 && "unsupported rotation axis value" ); + } + } + } + else if ( pSplit_rend_config->dof == 2 ) + { + relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq; + relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq; + relative_roll_angles = split_rend_relative_roll_pos_angles_hq; + switch ( rot_axis ) + { + case DEFAULT_AXIS: + case YAW: + case PITCH: + case YAW_PITCH: + { + num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + break; + } + case ROLL: + case YAW_ROLL: + { + num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + break; + } + case PITCH_ROLL: + { + num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + break; + } + default: + { + assert( 0 && "unsupported rotation axis value" ); + } + } + } + else + { + if ( pSplit_rend_config->hq_mode == 1 ) + { + relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq; + relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq; + relative_roll_angles = split_rend_relative_roll_pos_angles_hq; + num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; + num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES; + } + else + { + relative_yaw_angles = split_rend_relative_yaw_pos_angles; + relative_pitch_angles = split_rend_relative_pitch_pos_angles; + relative_roll_angles = split_rend_relative_roll_pos_angles; + num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; + num_pitch_poses = 1; + num_roll_poses = 1; + } + } + pMultiBinPoseData->num_poses = num_yaw_poses + num_pitch_poses + num_roll_poses + 1; + assert( pMultiBinPoseData->num_poses <= MAX_HEAD_ROT_POSES ); + + + for ( pos_idx = 0; pos_idx < num_yaw_poses; pos_idx++ ) + { + pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] = relative_yaw_angles[pos_idx]; + } + for ( pos_idx = 0; pos_idx < num_pitch_poses; pos_idx++ ) + { + pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + 1][1] = relative_pitch_angles[pos_idx]; + } + for ( pos_idx = 0; pos_idx < num_roll_poses; pos_idx++ ) + { + pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + num_pitch_poses + 1][2] = relative_roll_angles[pos_idx]; + } + pMultiBinPoseData->dof = pSplit_rend_config->dof; + pMultiBinPoseData->hq_mode = pSplit_rend_config->hq_mode; + pMultiBinPoseData->rot_axis = rot_axis; + + return; +} + +void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) +{ + int16_t pos_idx; + + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + pMultiBinPoseData->relative_head_poses[pos_idx][0] = 0.0f; + pMultiBinPoseData->relative_head_poses[pos_idx][1] = 0.0f; + pMultiBinPoseData->relative_head_poses[pos_idx][2] = 0.0f; + } + pMultiBinPoseData->num_poses = 1; + pMultiBinPoseData->dof = 3; + pMultiBinPoseData->hq_mode = 0; + pMultiBinPoseData->rot_axis = DEFAULT_AXIS; + return; +} #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 098ecf562b..0e163ea100 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -48,6 +48,8 @@ #include #include +//#define ROTATE_CREND_IN_CLDFB_DOMAIN + /* Maximum buffer length (per channel) in samples. * Keep this separate from L_FRAME48k in case we want to support different size later */ #define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) @@ -92,7 +94,7 @@ typedef struct const EFAP_WRAPPER *pEfapOutWrapper; const IVAS_REND_HeadRotData *pHeadRotData; #ifdef SPLIT_REND_WITH_HEAD_ROT - const IVAS_SPLIT_REND_MODE *pSplitRendMode; + const RENDER_CONFIG_HANDLE *hhRendererConfig; #endif /* TODO @Philips : would this be a better place to store the render config data? * bearing in mind we could have multiple inputs to the renderer, we might neeed to accomodate @@ -148,9 +150,21 @@ typedef struct CLDFB_REND_WRAPPER cldfbRendWrapper; SPLIT_REND_WRAPPER splitRendWrapper; #endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + rotation_gains rot_gains_prev[MAX_HEAD_ROT_POSES]; +#else rotation_gains rot_gains_prev; +#endif } input_sba; +#ifdef SPLIT_REND_WITH_HEAD_ROT +typedef struct +{ + input_base base; + SPLIT_POST_REND_WRAPPER splitPostRendWrapper; +} input_split_post_rend; +#endif + /* Due to API of some rendering methods, the renderer has to use the decoder struct. Only struct members relevant for rendering will be initialized, therefore typedef as "dummy" decoder struct */ typedef Decoder_Struct DecoderDummy; @@ -176,6 +190,9 @@ struct IVAS_REND input_mc inputsMc[RENDERER_MAX_MC_INPUTS]; input_sba inputsSba[RENDERER_MAX_SBA_INPUTS]; input_masa inputsMasa[RENDERER_MAX_MASA_INPUTS]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + input_split_post_rend inputsSplitPost[RENDERER_MAX_BIN_INPUTS]; +#endif /* TODO @Philips - inputConfig should not be stored here, but read from e.g. input_mc->input_base.inConfig, please remove this */ IVAS_REND_AudioConfig inputConfig; @@ -184,10 +201,6 @@ struct IVAS_REND IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; IVAS_REND_HeadRotData headRotData; -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_MODE splitRendMode; -#endif - int8_t rendererConfigEnabled; RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ }; @@ -209,6 +222,32 @@ static float *getSmplPtr( return buffer.data + chnlIdx * buffer.config.numSamplesPerChannel + smplIdx; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static void convertBitsBufferToInternalBitsBuff( + const IVAS_REND_BitstreamBuffer outBits, + ivas_split_rend_bits_t *hBits ) +{ + hBits->bits_buf = outBits.bits; + hBits->bits_read = outBits.config.bitsRead; + hBits->bits_written = outBits.config.bitsWritten; + hBits->buf_len = outBits.config.bufLenInBytes; + + return; +} + +static void convertInternalBitsBuffToBitsBuffer( + IVAS_REND_BitstreamBuffer *hOutBits, + const ivas_split_rend_bits_t bits ) +{ + hOutBits->bits = bits.bits_buf; + hOutBits->config.bitsRead = bits.bits_read; + hOutBits->config.bitsWritten = bits.bits_written; + hOutBits->config.bufLenInBytes = bits.buf_len; + + return; +} +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT static void copyBufferToCLDFBarray( const IVAS_REND_AudioBuffer buffer, @@ -241,6 +280,38 @@ static void copyBufferToCLDFBarray( return; } + +static void accumulateCLDFBArrayToBuffer( + float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + IVAS_REND_AudioBuffer *buffer ) +{ + uint32_t smplIdx, slotIdx; + uint32_t numCldfbSamples, num_bands; + uint32_t chnlIdx; + float *writePtr; + + assert( ( buffer->config.is_cldfb == 1 ) && "for time domain input call copyBufferTo2dArray()" ); + writePtr = buffer->data; + numCldfbSamples = ( (uint32_t) buffer->config.numSamplesPerChannel ) >> 1; + num_bands = numCldfbSamples / CLDFB_NO_COL_MAX; + for ( chnlIdx = 0; chnlIdx < (uint32_t) buffer->config.numChannels; ++chnlIdx ) + { + for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; ++slotIdx ) + { + for ( smplIdx = 0; smplIdx < num_bands; ++smplIdx ) + { + *writePtr++ += re[chnlIdx][slotIdx][smplIdx]; + } + for ( smplIdx = 0; smplIdx < num_bands; ++smplIdx ) + { + *writePtr++ += im[chnlIdx][slotIdx][smplIdx]; + } + } + } + + return; +} #endif static void copyBufferTo2dArray( @@ -372,6 +443,10 @@ static AUDIO_CONFIG rendAudioConfigToIvasAudioConfig( // VE2AT: similar is defin return AUDIO_CONFIG_BINAURAL; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: return AUDIO_CONFIG_BINAURAL_ROOM; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + return AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; +#endif case IVAS_REND_AUDIO_CONFIG_MASA1: return AUDIO_CONFIG_MASA1; case IVAS_REND_AUDIO_CONFIG_MASA2: @@ -401,6 +476,10 @@ static ivas_error validateOutputAudioConfig( case IVAS_REND_AUDIO_CONFIG_HOA3: case IVAS_REND_AUDIO_CONFIG_BINAURAL: case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: +#endif return IVAS_ERR_OK; default: break; @@ -453,6 +532,10 @@ ivas_error getAudioConfigNumChannels( case IVAS_REND_AUDIO_CONFIG_STEREO: case IVAS_REND_AUDIO_CONFIG_BINAURAL: case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: +#endif case IVAS_REND_AUDIO_CONFIG_MASA2: *numChannels = 2; break; @@ -498,6 +581,10 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( return AUDIO_CONFIG_BINAURAL; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: return AUDIO_CONFIG_BINAURAL_ROOM; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + return AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; +#endif case IVAS_REND_AUDIO_CONFIG_5_1: return AUDIO_CONFIG_5_1; case IVAS_REND_AUDIO_CONFIG_7_1: @@ -889,10 +976,7 @@ static void initHeadRotation( hIvasRend->headRotData.headPositions[i] = quaternionInit(); } #ifdef SPLIT_REND_WITH_HEAD_ROT - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) - { - hIvasRend->headRotData.headPositionsPostRend[i] = quaternionInit(); - } + hIvasRend->headRotData.sr_pose_pred_axis = DEFAULT_AXIS; #endif return; @@ -974,7 +1058,7 @@ static rendering_context getRendCtx( ctx.pEfapOutWrapper = &hIvasRend->efapOutWrapper; ctx.pHeadRotData = &hIvasRend->headRotData; #ifdef SPLIT_REND_WITH_HEAD_ROT - ctx.pSplitRendMode = &hIvasRend->splitRendMode; + ctx.hhRendererConfig = &hIvasRend->hRendererConfig; #endif return ctx; @@ -997,7 +1081,15 @@ static CREND_WRAPPER defaultCrendWrapper( { CREND_WRAPPER w; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t i; + for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + { + w.hCrend[i] = NULL; + } +#else w.hCrend = NULL; +#endif w.hHrtfCrend = NULL; w.binaural_latency_ns = 0; @@ -1038,7 +1130,12 @@ static ivas_error setRendInputActiveIsm( IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, - *rendCtx.pOutSampleRate ); + *rendCtx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); } if ( error != IVAS_ERR_OK ) { @@ -1058,10 +1155,17 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( inputIsm->crendWrapper.hCrend[0] != NULL ) + { + ivas_rend_closeCrend( &inputIsm->crendWrapper, 0 ); + } +#else if ( inputIsm->crendWrapper.hCrend != NULL ) { ivas_rend_closeCrend( &inputIsm->crendWrapper ); } +#endif if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); @@ -1571,10 +1675,17 @@ static ivas_error initMcBinauralRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( inputMc->crendWrapper.hCrend[0] != NULL ) + { + ivas_rend_closeCrend( &inputMc->crendWrapper, 0 ); + } +#else if ( inputMc->crendWrapper.hCrend != NULL ) { ivas_rend_closeCrend( &inputMc->crendWrapper ); } +#endif outSampleRate = *inputMc->base.ctx.pOutSampleRate; @@ -1612,7 +1723,12 @@ static ivas_error initMcBinauralRendering( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_REND_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, - outSampleRate ) ) != IVAS_ERR_OK ) + outSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -1729,10 +1845,17 @@ static void clearInputMc( { efap_free_data( &inputMc->efapInWrapper.hEfap ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( inputMc->crendWrapper.hCrend[0] != NULL ) + { + ivas_rend_closeCrend( &inputMc->crendWrapper, 0 ); + } +#else if ( inputMc->crendWrapper.hCrend != NULL ) { ivas_rend_closeCrend( &inputMc->crendWrapper ); } +#endif if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); @@ -1830,6 +1953,43 @@ static ivas_error initSbaPanGainsForSbaOut( return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error +updateSplitPostRendPanGains( + input_split_post_rend *inputSplitPostRend, + const IVAS_REND_AudioConfig outConfig, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + rendering_context rendCtx; + int16_t numOutChannels; + getAudioConfigNumChannels( outConfig, &numOutChannels ); + + rendCtx = inputSplitPostRend->base.ctx; + ivas_renderSplitGetMultiBinPoseData( + &hRendCfg->split_rend_config, + &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, + rendCtx.pHeadRotData->sr_pose_pred_axis ); + + error = ivas_splitBinPostRendOpen( &inputSplitPostRend->splitPostRendWrapper.hBinHrSplitPostRend, + &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, + *rendCtx.pOutSampleRate, ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + if ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + error = ivas_splitBinLCLDDecOpen( &inputSplitPostRend->splitPostRendWrapper.hSplitBinLCLDDec, *rendCtx.pOutSampleRate, numOutChannels ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } + + return IVAS_ERR_OK; +} +#endif static ivas_error updateSbaPanGains( input_sba *inputSba, @@ -1857,24 +2017,70 @@ updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( *rendCtx.pSplitRendMode ) != SPLIT_REND_DISABLED ) + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + { + int16_t is_cldfb_in; + assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural mode is currently supported with HOA3 input and 48k sampling rate only" ); + is_cldfb_in = 1; + ivas_renderSplitGetMultiBinPoseData( + &rendCtx.hhRendererConfig[0]->split_rend_config, + &inputSba->splitRendWrapper.multiBinPoseData, + rendCtx.pHeadRotData->sr_pose_pred_axis ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hRendCfg->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV ) + + { + error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, + &inputSba->splitRendWrapper.multiBinPoseData, + *rendCtx.pOutSampleRate ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + is_cldfb_in = 0; + } + else +#endif + { + error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, hRendCfg, + &inputSba->splitRendWrapper.multiBinPoseData, + *rendCtx.pOutSampleRate ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + is_cldfb_in = 1; + } + error = ivas_split_renderer_open( &inputSba->splitRendWrapper, + &inputSba->base.ctx.hhRendererConfig[0]->split_rend_config, + *rendCtx.pOutSampleRate, is_cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + break; + } +#endif + case IVAS_REND_AUDIO_CONFIG_BINAURAL: +#ifdef DEBUGGING + if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + { - if ( ( *rendCtx.pSplitRendMode ) != SPLIT_REND_POST ) + error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, hRendCfg, + &inputSba->splitRendWrapper.multiBinPoseData, + *rendCtx.pOutSampleRate ); + if ( error != IVAS_ERR_OK ) { - error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, SPLIT_REND_PRE, hRendCfg, *rendCtx.pOutSampleRate ); - if ( error != IVAS_ERR_OK ) - { - return error; - } + return error; } - error = ivas_split_renderer_open( &inputSba->splitRendWrapper, *rendCtx.pOutSampleRate, *rendCtx.pSplitRendMode, 1 ); } else #endif { - error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, *rendCtx.pOutSampleRate ); + error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, *rendCtx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); } break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: @@ -1882,7 +2088,12 @@ updateSbaPanGains( { return error; } - error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, *rendCtx.pOutSampleRate ); + error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, *rendCtx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -1900,6 +2111,33 @@ updateSbaPanGains( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error setRendInputActiveSplitPostRend( + void *input, + const IVAS_REND_AudioConfig inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + rendering_context rendCtx; + IVAS_REND_AudioConfig outConfig; + input_split_post_rend *inputSplitPostRend; + + inputSplitPostRend = (input_split_post_rend *) input; + rendCtx = inputSplitPostRend->base.ctx; + outConfig = *rendCtx.pOutConfig; + + initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx ); + + if ( ( error = updateSplitPostRendPanGains( inputSplitPostRend, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + { + return error; + } + + return error; +} +#endif + static ivas_error setRendInputActiveSba( void *input, const IVAS_REND_AudioConfig inConfig, @@ -1910,6 +2148,9 @@ static ivas_error setRendInputActiveSba( rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; input_sba *inputSba; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx; +#endif inputSba = (input_sba *) input; rendCtx = inputSba->base.ctx; @@ -1918,7 +2159,14 @@ static ivas_error setRendInputActiveSba( initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputSba->hoaDecMtx ); inputSba->crendWrapper = defaultCrendWrapper(); +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + initRotGains( inputSba->rot_gains_prev[pos_idx] ); + } +#else initRotGains( inputSba->rot_gains_prev ); +#endif if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { @@ -1928,20 +2176,54 @@ static ivas_error setRendInputActiveSba( return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static void clearInputSplitRend( + input_split_post_rend *inputSplitRend ) +{ + // rendering_context rendCtx; + + // rendCtx = inputSplitRend->base.ctx; + + if ( inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend != NULL ) + { + ivas_splitBinPostRendClose( &inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend ); + } + if ( inputSplitRend->splitPostRendWrapper.hSplitBinLCLDDec != NULL ) + { + ivas_splitBinLCLDDecClose( &inputSplitRend->splitPostRendWrapper.hSplitBinLCLDDec ); + } + + return; +} + +#endif static void clearInputSba( input_sba *inputSba ) { rendering_context rendCtx; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx; +#endif rendCtx = inputSba->base.ctx; initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + if ( inputSba->crendWrapper.hCrend[pos_idx] != NULL ) + { + ivas_rend_closeCrend( &inputSba->crendWrapper, pos_idx ); + } + } +#else if ( inputSba->crendWrapper.hCrend != NULL ) { ivas_rend_closeCrend( &inputSba->crendWrapper ); } +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { @@ -2119,7 +2401,11 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE 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 ), output_config ); - if ( output_config == AUDIO_CONFIG_BINAURAL ) + if ( output_config == AUDIO_CONFIG_BINAURAL +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#endif + ) { decDummy->renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -2378,17 +2664,15 @@ static void clearInputMasa( input_masa *inputMasa ) ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, - const IVAS_REND_AudioConfig outConfig -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - IVAS_SPLIT_REND_MODE splitRendMode -#endif -) + const IVAS_REND_AudioConfig outConfig ) { int16_t i; IVAS_REND_HANDLE hIvasRend; ivas_error error; int16_t numOutChannels; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx; +#endif /*-----------------------------------------------------------------* * Validate function arguments @@ -2423,9 +2707,6 @@ ivas_error IVAS_REND_Open( #ifdef DEBUGGING hIvasRend->numClipping = 0; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT - hIvasRend->splitRendMode = splitRendMode; -#endif /* Initialize limiter */ if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) @@ -2444,20 +2725,42 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + /* why not use defaultCrendWrapper() ??*/ + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + hIvasRend->inputsIsm[i].crendWrapper.hCrend[pos_idx] = NULL; + } +#else hIvasRend->inputsIsm[i].crendWrapper.hCrend = NULL; +#endif hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; } for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + hIvasRend->inputsMc[i].crendWrapper.hCrend[pos_idx] = NULL; + } +#else hIvasRend->inputsMc[i].crendWrapper.hCrend = NULL; +#endif hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + hIvasRend->inputsSba[i].crendWrapper.hCrend[pos_idx] = NULL; + } +#else hIvasRend->inputsSba[i].crendWrapper.hCrend = NULL; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; ivas_init_split_rend_handles( &hIvasRend->inputsSba[i].splitRendWrapper ); @@ -2472,6 +2775,16 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMasa[i].decDummy = NULL; hIvasRend->inputsMasa[i].metadataHasBeenFed = false; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsSplitPost[i].base, + IVAS_REND_AUDIO_CONFIG_UNKNOWN, + 0, + getRendCtx( hIvasRend ) ); + ivas_init_split_post_rend_handles( &hIvasRend->inputsSplitPost[i].splitPostRendWrapper ); + } +#endif return IVAS_ERR_OK; } @@ -2699,6 +3012,15 @@ static ivas_error getInputById( } pInputBase = &hIvasRend->inputsMasa[inputIndex].base; break; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + if ( inputIndex > RENDERER_MAX_BIN_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSplitPost[inputIndex].base; + break; +#endif default: return IVAS_ERR_INVALID_INPUT_ID; } @@ -2764,6 +3086,15 @@ static ivas_error getConstInputById( } pInputBase = &hIvasRend->inputsMasa[inputIndex].base; break; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + if ( inputIndex > RENDERER_MAX_BIN_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSplitPost[inputIndex].base; + break; +#endif default: return IVAS_ERR_INVALID_INPUT_ID; } @@ -2868,6 +3199,14 @@ ivas_error IVAS_REND_AddInput( inputStructSize = sizeof( *hIvasRend->inputsMasa ); activateInput = setRendInputActiveMasa; break; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + maxNumInputsOfType = RENDERER_MAX_BIN_INPUTS; + inputsArray = hIvasRend->inputsSplitPost; + inputStructSize = sizeof( *hIvasRend->inputsSplitPost ); + activateInput = setRendInputActiveSplitPostRend; + break; +#endif default: return IVAS_ERR_INVALID_INPUT_FORMAT; } @@ -3065,6 +3404,11 @@ ivas_error IVAS_REND_RemoveInput( case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: clearInputMasa( (input_masa *) inputBase ); break; +#ifdef SPLIT_REND_WITH_HEAD_ROT + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + clearInputSplitRend( (input_split_post_rend *) inputBase ); + break; +#endif default: return IVAS_ERR_INVALID_INPUT_FORMAT; } @@ -3151,26 +3495,49 @@ ivas_error IVAS_REND_GetDelay( if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hIvasRend->inputsSba[i].splitRendWrapper.hBinHrSplitPostRend != NULL ) + if ( hIvasRend->inputsSba[i].splitRendWrapper.hBinHrSplitPreRend != NULL ) { - latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; - latency_ns += IVAS_FB_DEC_DELAY_NS; +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hIvasRend->hRendererConfig->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV ) + { + latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; + } + else +#endif + { + latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; + } *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } else if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) { - latency_ns = 0; + latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; + latency_ns += IVAS_FB_DEC_DELAY_NS; *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } + else #endif { latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; +#ifdef ROTATE_CREND_IN_CLDFB_DOMAIN + latency_ns += IVAS_FB_DEC_DELAY_NS; +#endif *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); } } } - - for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; i++ ) + { + if ( hIvasRend->inputsSplitPost[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + { + latency_ns = IVAS_FB_DEC_DELAY_NS; + *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + } + } +#endif + + for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { @@ -3347,6 +3714,24 @@ ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st, return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) +{ + int16_t j; + + j = 0; + while ( j < SIZE_SPLIT_REND_BRATE_TBL && splitRendBitRate != split_rend_brate_tbl[j] ) + { + j++; + } + if ( j >= SIZE_SPLIT_REND_BRATE_TBL ) + { + return 0; + } + return 1; +} +#endif + int16_t IVAS_REND_GetRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ @@ -3360,7 +3745,7 @@ int16_t IVAS_REND_GetRenderConfig( } hRCin = hIvasRend->hRendererConfig; -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) switch ( hRCin->renderer_type_override ) { case RENDER_TYPE_OVERRIDE_CREND: @@ -3385,6 +3770,13 @@ int16_t IVAS_REND_GetRenderConfig( mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; + hRCout->split_rend_config.dof = 3; + hRCout->split_rend_config.hq_mode = 0; + hRCout->split_rend_config.codec_delay_ms = 0; +#endif + return IVAS_ERR_OK; } @@ -3402,7 +3794,7 @@ int16_t IVAS_REND_FeedRenderConfig( } hRenderConfig = hIvasRend->hRendererConfig; -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -3423,16 +3815,22 @@ int16_t IVAS_REND_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + hRenderConfig->split_rend_config.splitRendBitRate = renderConfig.split_rend_config.splitRendBitRate; + hRenderConfig->split_rend_config.dof = renderConfig.split_rend_config.dof; + hRenderConfig->split_rend_config.hq_mode = renderConfig.split_rend_config.hq_mode; + hRenderConfig->split_rend_config.codec_delay_ms = renderConfig.split_rend_config.codec_delay_ms; +#endif + return IVAS_ERR_OK; } - ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] #ifdef SPLIT_REND_WITH_HEAD_ROT , - const IVAS_SPLIT_REND_MODE splitRendMode + IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif ) { @@ -3454,29 +3852,40 @@ ivas_error IVAS_REND_SetHeadRotation( if ( headRot == NULL ) { - hIvasRend->headRotData.headRotEnabled = 0; - } - else - { - hIvasRend->headRotData.headRotEnabled = 1; #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( splitRendMode == SPLIT_REND_POST ) + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { + hIvasRend->headRotData.headRotEnabled = 1; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { - hIvasRend->headRotData.headPositionsPostRend[i] = headRot[i]; + hIvasRend->headRotData.headPositions[i].w = -3.0f; + hIvasRend->headRotData.headPositions[i].x = 0.0f; + hIvasRend->headRotData.headPositions[i].y = 0.0f; + hIvasRend->headRotData.headPositions[i].z = 0.0f; } } else + { + hIvasRend->headRotData.headRotEnabled = 0; + } +#else + hIvasRend->headRotData.headRotEnabled = 0; #endif + } + else + { + hIvasRend->headRotData.headRotEnabled = 1; + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) - { - hIvasRend->headRotData.headPositions[i] = headRot[i]; - } + hIvasRend->headRotData.headPositions[i] = headRot[i]; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + hIvasRend->headRotData.sr_pose_pred_axis = rot_axis; +#endif + return IVAS_ERR_OK; } @@ -3678,6 +4087,92 @@ static ivas_error rotateFrameMc( return IVAS_ERR_OK; } +#ifdef ROTATE_CREND_IN_CLDFB_DOMAIN +static HANDLE_CLDFB_FILTER_BANK rotateFrameSbacldfb_cldfbAna[16]; +static HANDLE_CLDFB_FILTER_BANK rotateFrameSbacldfb_cldfbSyn[16]; +static ivas_error rotateFrameSbacldfb( + IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ + IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ + const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ + rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ + IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ +) +{ + float tmpCrendBuffer[16][960]; + int16_t ch_idx, slot_idx, num_cldfb_bands, num_chs; + float Cldfb_RealBuffer_Binaural[16][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[16][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Rmat_local[3][3]; + + num_chs = outAudio.config.numChannels; + if ( frame == 0 ) + { + for ( int16_t ch = 0; ch < num_chs; ch++ ) + { + openCldfb( &( rotateFrameSbacldfb_cldfbAna[ch] ), CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_5_00MS ); + openCldfb( &( rotateFrameSbacldfb_cldfbSyn[ch] ), CLDFB_SYNTHESIS, 48000, CLDFB_PROTOTYPE_5_00MS ); + } + } + + num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; + + copyBufferTo2dArray( inAudio, tmpCrendBuffer ); + + for ( int16_t sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + /* Implement CLDFB analysis */ + for ( ch_idx = 0; ch_idx < num_chs; ch_idx++ ) + { + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + int16_t idx = sf * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; + cldfbAnalysis_ts( &( tmpCrendBuffer[ch_idx][num_cldfb_bands * idx] ), + Cldfb_RealBuffer_Binaural[ch_idx][slot_idx], + Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx], + num_cldfb_bands, + rotateFrameSbacldfb_cldfbAna[ch_idx] ); + } + } + + QuatToRotMat( headRotData->headPositions[sf], Rmat_local ); + rotateFrame_shd_cldfb( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Rmat_local, num_chs, 3 ); + + /* Implement CLDFB synthesis */ + for ( ch_idx = 0; ch_idx < num_chs; ch_idx++ ) + { + float *RealBuffer[CLDFB_NO_COL_MAX]; + float *ImagBuffer[CLDFB_NO_COL_MAX]; + int16_t idx = sf * num_cldfb_bands * MAX_PARAM_SPATIAL_SUBFRAMES; + + for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; + } + + cldfbSynthesis( RealBuffer, ImagBuffer, &( tmpCrendBuffer[ch_idx][idx] ), num_cldfb_bands * MAX_PARAM_SPATIAL_SUBFRAMES, rotateFrameSbacldfb_cldfbSyn[ch_idx] ); + } + } + + + { + int16_t smplIdx, chnlIdx; + float *writePtr; + + writePtr = outAudio.data; + for ( chnlIdx = 0; chnlIdx < outAudio.config.numChannels; ++chnlIdx ) + { + for ( smplIdx = 0; smplIdx < outAudio.config.numSamplesPerChannel; ++smplIdx ) + { + *writePtr++ = tmpCrendBuffer[chnlIdx][smplIdx]; + } + } + } + + return IVAS_ERR_OK; +} +#endif + static ivas_error rotateFrameSba( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ @@ -3738,7 +4233,18 @@ static ivas_error rotateFrameSba( ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); } } +#ifdef FIX_376_SBA_ROTATE + /* write back the result */ + for ( n = m1; n < m2; n++ ) + { + writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); + ( *writePtr ) = tmpRot[n - m1]; + } + m1 = m2; + m2 += 2 * ( l + 1 ) + 1; +#endif } +#ifndef FIX_376_SBA_ROTATE /* write back the result */ for ( n = m1; n < m2; n++ ) { @@ -3747,6 +4253,7 @@ static ivas_error rotateFrameSba( } m1 = m2; m2 += 2 * ( l + 1 ) + 1; +#endif } /*unoptimized code for reference (full matrix multiplication)*/ @@ -3897,7 +4404,12 @@ static ivas_error renderIsmToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); - ivas_rend_crendProcess( &ismInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate ); + ivas_rend_crendProcess( &ismInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); @@ -4170,7 +4682,12 @@ static ivas_error renderMcToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4222,7 +4739,12 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4289,7 +4811,12 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4481,37 +5008,164 @@ static ivas_error renderSbaToSba( return IVAS_ERR_OK; } + #ifdef SPLIT_REND_WITH_HEAD_ROT -static ivas_error renderMultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, - ivas_split_rend_bits_t *pBits, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const IVAS_REND_HeadRotData *pHeadRotData, - const int16_t max_bands, - float out[][L_FRAME48k] ) +static ivas_error renderSplitBinauralWithPostRot( + input_split_post_rend *splitBinInput, + IVAS_REND_AudioBuffer outAudio, + IVAS_REND_BitstreamBuffer *hBits ) { + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; ivas_error error; - IVAS_QUATERNION QuaternionsPre[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t sf_idx; + ivas_split_rend_bits_t bits; + float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + const IVAS_REND_HeadRotData *pHeadRotData; + SPLIT_POST_REND_WRAPPER *hSplitBin; error = IVAS_ERR_OK; + pHeadRotData = splitBinInput->base.ctx.pHeadRotData; + hSplitBin = &splitBinInput->splitPostRendWrapper; + convertBitsBufferToInternalBitsBuff( *hBits, &bits ); + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { - QuaternionsPre[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); - QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositionsPostRend, sf_idx ); + QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); } - ivas_renderMultiBinToSplitBinaural( hSplitBin, pBits, Cldfb_In_BinReal, Cldfb_In_BinImag, QuaternionsPre, QuaternionsPost, max_bands, out ); + ivas_splitBinPostRendMdDec( + &bits, + hSplitBin->hBinHrSplitPostRend, + &hSplitBin->multiBinPoseData, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + hSplitBin->hBinHrSplitPreRend, +#endif + MAX_SPLIT_REND_MD_BANDS ); + + if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_splitBinLCLDDecProcess( + hSplitBin->hSplitBinLCLDDec, + &bits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural ); + } + else + { + copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); + } + + ivas_rend_CldfbSplitPostRendProcess( + hSplitBin->hBinHrSplitPostRend, + &hSplitBin->multiBinPoseData, + QuaternionsPost, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + tmpCrendBuffer, + ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 ); + + convertInternalBitsBuffToBitsBuffer( hBits, bits ); + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); return error; } +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error renderSbaToMultiBinaural( + input_sba *sbaInput, + const IVAS_REND_AudioConfig outConfig, + float out[][L_FRAME48k] ) +{ + float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + int16_t i, pos_idx; + IVAS_REND_HeadRotData HeadRotDataLocal; + + ivas_error error; + IVAS_REND_AudioBuffer tmpRotBuffer; + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + + wmops_sub_start( "renderSbaToMultiBinaural" ); + + HeadRotDataLocal = *sbaInput->base.ctx.pHeadRotData; + for ( i = 1; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + HeadRotDataLocal.headPositions[i] = HeadRotDataLocal.headPositions[0]; + } + + tmpRotBuffer = sbaInput->base.inputBuffer; + tmpRotBuffer.data = count_malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + + pMultiBinPoseData = &sbaInput->splitRendWrapper.multiBinPoseData; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + Quaternions_orig[i] = HeadRotDataLocal.headPositions[i]; + Quaternions_abs.w = -3.0f; + Quat2EulerDegree( HeadRotDataLocal.headPositions[i], &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + + Quaternions_abs.x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + Quaternions_abs.y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + Quaternions_abs.z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; + HeadRotDataLocal.headPositions[i] = Quaternions_abs; + } + + + /* copy input for in-place rotation */ + mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, + tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + + rotateFrameSba( sbaInput->base.inputBuffer, + sbaInput->base.inConfig, + &HeadRotDataLocal, + sbaInput->rot_gains_prev[pos_idx], + tmpRotBuffer ); + + copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); + + assert( sbaInput->crendWrapper.hCrend[0]->hReverb == NULL ); + /* call CREND */ + if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + pos_idx +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + HeadRotDataLocal.headPositions[i] = Quaternions_orig[i]; + } + + /* move to output */ + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + mvr2r( tmpCrendBuffer[i], out[pos_idx * BINAURAL_CHANNELS + i], tmpRotBuffer.config.numSamplesPerChannel ); + } + } + count_free( tmpRotBuffer.data ); + + wmops_sub_end(); + + return IVAS_ERR_OK; +} +#endif static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, - IVAS_REND_AudioBuffer outAudio ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + const IVAS_REND_AudioConfig outConfig, +#endif + IVAS_REND_AudioBuffer outAudio, + IVAS_REND_BitstreamBuffer *hBits ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; @@ -4525,37 +5179,65 @@ static ivas_error renderSbaToSplitBinaural( float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; #endif ivas_split_rend_bits_t bits; + int16_t low_res_pre_rend_rot, max_band; + + + low_res_pre_rend_rot = 1; //( *sbaInput->base.ctx.pSplitRendBitRate == SPLIT_REND_768k ) ? 0 : 1; wmops_sub_start( "renderSbaToSplitBinaural" ); error = IVAS_ERR_OK; - copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - ivas_rend_CldfbMultiBinRendProcess( - sbaInput->cldfbRendWrapper.hCldfbRend, - sbaInput->base.ctx.pHeadRotData, - Cldfb_RealBuffer, - Cldfb_ImagBuffer, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural ); + ivas_renderSplitGetMultiBinPoseData( + &sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config, + &sbaInput->splitRendWrapper.multiBinPoseData, + sbaInput->base.ctx.pHeadRotData->sr_pose_pred_axis ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV ) + { + renderSbaToMultiBinaural( + sbaInput, + outConfig, + tmpCrendBuffer ); + max_band = (int16_t) ( ( BINAURAL_MAXBANDS * ( *sbaInput->base.ctx.pOutSampleRate ) ) / 48000 ); + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + } + } + else +#endif + { + copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + + ivas_rend_CldfbMultiBinRendProcess( + sbaInput->cldfbRendWrapper.hCldfbRend, + sbaInput->base.ctx.pHeadRotData, + &sbaInput->splitRendWrapper.multiBinPoseData, + Cldfb_RealBuffer, + Cldfb_ImagBuffer, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + low_res_pre_rend_rot ); + max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; + } /*SPLIT pre rendering MD and CLDFB coding*/ - ivas_split_rend_bitstream_init( &bits, - outAudio.config.numChannels * outAudio.config.numSamplesPerChannel * sizeof( float ), - (uint8_t *) outAudio.data ); - - renderMultiBinToSplitBinaural( &sbaInput->splitRendWrapper, - &bits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - sbaInput->base.ctx.pHeadRotData, - sbaInput->cldfbRendWrapper.hCldfbRend->max_band, - tmpCrendBuffer ); - - // TEMP zero out - set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + convertBitsBufferToInternalBitsBuff( *hBits, &bits ); + + ivas_renderMultiBinToSplitBinaural( &sbaInput->splitRendWrapper, + sbaInput->base.ctx.pHeadRotData->headPositions, + sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.splitRendBitRate, + &bits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + max_band, + tmpCrendBuffer, + low_res_pre_rend_rot, + ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + + convertInternalBitsBuffToBitsBuffer( hBits, bits ); wmops_sub_end(); @@ -4575,36 +5257,81 @@ static ivas_error renderSbaToBinaural( wmops_sub_start( "renderSbaToBinaural" ); - /* apply rotation */ - if ( sbaInput->base.ctx.pHeadRotData->headRotEnabled ) +#ifdef DEBUGGING + if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { - tmpRotBuffer = sbaInput->base.inputBuffer; - tmpRotBuffer.data = count_malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); - /* copy input for in-place rotation */ - mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, - tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - rotateFrameSba( sbaInput->base.inputBuffer, - sbaInput->base.inConfig, - sbaInput->base.ctx.pHeadRotData, - sbaInput->rot_gains_prev, - tmpRotBuffer ); + copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); - count_free( tmpRotBuffer.data ); + ivas_rend_CldfbMultiBinRendProcess( + sbaInput->cldfbRendWrapper.hCldfbRend, + sbaInput->base.ctx.pHeadRotData, + &sbaInput->splitRendWrapper.multiBinPoseData, + Cldfb_RealBuffer, + Cldfb_ImagBuffer, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + 0 ); + + accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], &outAudio ); } else - { - copyBufferTo2dArray( sbaInput->base.inputBuffer, tmpCrendBuffer ); - } - /* call CREND */ - if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#endif { - return error; - } + /* apply rotation */ + if ( sbaInput->base.ctx.pHeadRotData->headRotEnabled ) + { + tmpRotBuffer = sbaInput->base.inputBuffer; + tmpRotBuffer.data = count_malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + /* copy input for in-place rotation */ + mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, + tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + +#ifdef ROTATE_CREND_IN_CLDFB_DOMAIN + rotateFrameSbacldfb( sbaInput->base.inputBuffer, + sbaInput->base.inConfig, + sbaInput->base.ctx.pHeadRotData, + sbaInput->rot_gains_prev[0], + tmpRotBuffer ); +#else + rotateFrameSba( sbaInput->base.inputBuffer, + sbaInput->base.inConfig, + sbaInput->base.ctx.pHeadRotData, +#ifdef SPLIT_REND_WITH_HEAD_ROT + sbaInput->rot_gains_prev[0], +#else + sbaInput->rot_gains_prev, +#endif + tmpRotBuffer ); +#endif - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + + copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); + count_free( tmpRotBuffer.data ); + } + else + { + copyBufferTo2dArray( sbaInput->base.inputBuffer, tmpCrendBuffer ); + } + + /* call CREND */ + if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } + + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + } wmops_sub_end(); @@ -4640,7 +5367,13 @@ static ivas_error renderSbaToBinauralRoom( /* copy input for in-place rotation */ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ); + rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, +#ifdef SPLIT_REND_WITH_HEAD_ROT + sbaInput->rot_gains_prev[0], +#else + sbaInput->rot_gains_prev, +#endif + tmpRotBuffer ); } /* intermediate rendering to 7_1_4 */ @@ -4659,7 +5392,12 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4676,26 +5414,59 @@ static ivas_error renderSbaToBinauralRoom( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error renderInputSplitBin( + input_split_post_rend *splitBinInput, + const IVAS_REND_AudioConfig outConfig, + IVAS_REND_AudioBuffer outAudio, + IVAS_REND_BitstreamBuffer *hBits ) +{ + ivas_error error; + IVAS_REND_AudioBuffer inAudio; + + inAudio = splitBinInput->base.inputBuffer; + if ( splitBinInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + { + /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ + return IVAS_ERR_INVALID_BUFFER_SIZE; + } + + splitBinInput->base.numNewSamplesPerChannel = 0; + + /* Apply input gain to new audio */ + v_multc( inAudio.data, + splitBinInput->base.gain, + inAudio.data, + inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + switch ( outConfig ) + { + case IVAS_REND_AUDIO_CONFIG_BINAURAL: + error = renderSplitBinauralWithPostRot( splitBinInput, outAudio, + hBits ); + break; + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + return error; +} +#endif static ivas_error renderInputSba( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_AudioBuffer outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_REND_BitstreamBuffer *hBits +#endif +) { ivas_error error; IVAS_REND_AudioBuffer inAudio; -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t cldfb2tdSampleFact; -#endif inAudio = sbaInput->base.inputBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT - cldfb2tdSampleFact = ( inAudio.config.is_cldfb ) ? 2 : 1; - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel * cldfb2tdSampleFact ) -#else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) -#endif { /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -4719,18 +5490,19 @@ static ivas_error renderInputSba( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( *sbaInput->base.ctx.pSplitRendMode ) != SPLIT_REND_DISABLED ) - { - /*TODO : combine this with renderSbaToBinaural*/ - error = renderSbaToSplitBinaural( sbaInput, outAudio ); - } - else + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + error = renderSbaToSplitBinaural( sbaInput, +#ifdef SPLIT_REND_WITH_HEAD_ROT + outConfig, #endif - { - error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); - } + outAudio, + hBits ); + break; +#endif + case IVAS_REND_AUDIO_CONFIG_BINAURAL: + error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: error = renderSbaToBinauralRoom( sbaInput, outConfig, outAudio ); @@ -4751,9 +5523,41 @@ static ivas_error renderInputSba( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error renderActiveInputsSplitBin( + IVAS_REND_HANDLE hIvasRend, + IVAS_REND_AudioBuffer outAudio, + IVAS_REND_BitstreamBuffer *hBits ) +{ + int16_t i; + input_split_post_rend *pCurrentInput; + ivas_error error; + + for ( i = 0, pCurrentInput = hIvasRend->inputsSplitPost; i < RENDERER_MAX_BIN_INPUTS; ++i, ++pCurrentInput ) + { + if ( pCurrentInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + { + /* Skip inactive inputs */ + continue; + } + + if ( ( error = renderInputSplitBin( pCurrentInput, hIvasRend->outputConfig, outAudio, hBits ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + return IVAS_ERR_OK; +} +#endif static ivas_error renderActiveInputsSba( IVAS_REND_HANDLE hIvasRend, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_AudioBuffer outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_REND_BitstreamBuffer *hBits +#endif +) { int16_t i; input_sba *pCurrentInput; @@ -4767,7 +5571,12 @@ static ivas_error renderActiveInputsSba( continue; } - if ( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + hBits +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4900,7 +5709,8 @@ static ivas_error renderInputMasa( case IVAS_REND_AUDIO_CONFIG_BINAURAL: error = renderMasaToBinaural( masaInput, outAudio ); break; - /* ToDo */ + /* ToDo */ + // case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: // error = renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); // break; @@ -4947,11 +5757,19 @@ static ivas_error renderActiveInputsMasa( } ivas_error IVAS_REND_GetSamples( - IVAS_REND_HANDLE hIvasRend, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ +#endif +) { ivas_error error; int16_t numOutChannels; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t cldfb2tdSampleFact; +#endif /*-----------------------------------------------------------------* * Validate function arguments @@ -4961,7 +5779,15 @@ ivas_error IVAS_REND_GetSamples( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#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 if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) +#endif { return IVAS_ERR_INVALID_BUFFER_SIZE; } @@ -4969,8 +5795,14 @@ ivas_error IVAS_REND_GetSamples( { return IVAS_ERR_WRONG_NUM_CHANNELS; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) +#else if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) +#endif { /* Binaural rendering requires specific frame size */ return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -4995,7 +5827,12 @@ ivas_error IVAS_REND_GetSamples( { return error; } - if ( ( error = renderActiveInputsSba( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderActiveInputsSba( hIvasRend, outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + hBits +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -5003,11 +5840,30 @@ ivas_error IVAS_REND_GetSamples( { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( error = renderActiveInputsSplitBin( hIvasRend, outAudio, hBits ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( outAudio.config.is_cldfb == 0 ) + { +#ifdef DEBUGGING + hIvasRend->numClipping += +#endif + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + } +#else #ifdef DEBUGGING hIvasRend->numClipping += #endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); +#endif + return IVAS_ERR_OK; } @@ -5050,6 +5906,12 @@ void IVAS_REND_Close( { clearInputMasa( &hIvasRend->inputsMasa[i] ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) + { + clearInputSplitRend( &hIvasRend->inputsSplitPost[i] ); + } +#endif /* clear Config. Renderer */ ivas_render_config_close( &( hIvasRend->hRendererConfig ) ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 498545a9c2..065c3c0584 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -46,6 +46,9 @@ #define RENDERER_MAX_MC_INPUTS 1 #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define RENDERER_MAX_BIN_INPUTS 1 +#endif #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 @@ -64,7 +67,6 @@ typedef struct float *data; } IVAS_REND_AudioBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct { int32_t bufLenInBytes; @@ -76,7 +78,6 @@ typedef struct IVAS_REND_BitstreamBufferConfig config; uint8_t *bits; } IVAS_REND_BitstreamBuffer; -#endif typedef struct { @@ -141,6 +142,10 @@ typedef enum IVAS_REND_AUDIO_CONFIG_BINAURAL = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 0, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 2, + IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 3, +#endif IVAS_REND_AUDIO_CONFIG_MASA1 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 0, IVAS_REND_AUDIO_CONFIG_MASA2 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 1, @@ -167,10 +172,6 @@ ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const int32_t outputSampleRate, /* i : output sampling rate */ const IVAS_REND_AudioConfig outConfig /* i : output audio config */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - IVAS_SPLIT_REND_MODE splitRendMode /* i : split rendering mode */ -#endif ); /* Note: this will reset custom LFE routings set for any MC input */ @@ -275,13 +276,17 @@ ivas_error IVAS_REND_SetHeadRotation( const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ #ifdef SPLIT_REND_WITH_HEAD_ROT , - const IVAS_SPLIT_REND_MODE splitRendMode + IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif ); ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ +#endif ); /* Functions to be called after rendering */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 27eed3bf14..14a24c5fd1 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -175,7 +175,7 @@ static void strip_spaces_upper( while ( pStr[read_idx] ) { - if ( !isspace( pStr[read_idx] ) && !iscntrl( pStr[read_idx] ) ) + if ( !isspace( (int32_t) pStr[read_idx] ) && !iscntrl( (int32_t) pStr[read_idx] ) ) { pStr[write_idx++] = pStr[read_idx]; } @@ -290,7 +290,7 @@ static ivas_error RenderConfigReader_checkValues( return IVAS_ERR_WRONG_PARAMS; } -#ifdef DEBUGGING +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) /* Specific limits for Jot reverb */ if ( hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) { @@ -499,7 +499,55 @@ ivas_error RenderConfigReader_read( fprintf( stderr, "Reverb config: number of bands changed but configuration vectors missing\n" ); } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( strcmp( chapter, "SPLITREND" ) == 0 && strlen( pParams ) != 0 ) + { + params_idx = 0; + pValue = (char *) calloc( strlen( pParams ), sizeof( char ) ); + while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) + { + params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); + fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); + if ( strcmp( item, "CODECDELAY" ) == 0 ) + { + if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.codec_delay_ms ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + } + else if ( strcmp( item, "HQMODE" ) == 0 ) + { + if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.hq_mode ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + } + else if ( strcmp( item, "BITRATE" ) == 0 ) + { + if ( !sscanf( pValue, "%d", &hRenderConfig->split_rend_config.splitRendBitRate ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + } + else if ( strcmp( item, "DOF" ) == 0 ) + { + if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.dof ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + } + #ifdef DEBUGGING + else + { + fprintf( stderr, "Unsupported configuration property %s\n", item ); + } +#endif + } + free( pValue ); + } +#endif +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) else if ( strcmp( chapter, "GENERAL" ) == 0 && strlen( pParams ) != 0 ) { params_idx = 0; diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c new file mode 100644 index 0000000000..78ef342bbf --- /dev/null +++ b/lib_util/split_render_file_read_write.c @@ -0,0 +1,254 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "split_render_file_read_write.h" +#include +#include +#include +#include +#include +#include "cmdl_tools.h" +#include "prot.h" +#include "ivas_cnst.h" + +/*------------------------------------------------------------------------------------------* + * PreProc Macros + *------------------------------------------------------------------------------------------*/ +#define SPLIT_RENDERER_FRAME_HEADER_LEN ( 12 ) + +/*------------------------------------------------------------------------------------------* + * Type definitions + *------------------------------------------------------------------------------------------*/ + +#ifdef SPLIT_REND_WITH_HEAD_ROT +struct SplitFileReadWrite +{ + FILE *file; + uint32_t delay_ns; +}; + + +/*-----------------------------------------------------------------------------------------* + * Function split_rend_reader_open() + * open in read mode + *-----------------------------------------------------------------------------------------*/ +ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename ) +{ + SplitFileReadWrite *hSplitRendFileReadWrite; + size_t header_len, h; + char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; + char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; + + hSplitRendFileReadWrite = (SplitFileReadWrite *) count_malloc( sizeof( SplitFileReadWrite ) ); + hSplitRendFileReadWrite->file = fopen( filename, "rb" ); + if ( hSplitRendFileReadWrite->file == NULL ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", filename ); + exit( -1 ); + } + + header_len = strlen( header ); + + /*read frame header*/ + for ( h = 0; h < header_len; h++ ) + { + if ( fread( &header_read[h], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + } + if ( strncmp( header_read, header, header_len ) ) + { + fprintf( stderr, "Error split rend bitstream main header mismatch\n" ); + return IVAS_ERR_FAILED_FILE_READ; + } + + fread( &hSplitRendFileReadWrite->delay_ns, sizeof( uint32_t ), 1, hSplitRendFileReadWrite->file ); + + *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; + return IVAS_ERR_OK; +} + +/*-----------------------------------------------------------------------------------------* + * Function split_rend_writer_open() + * open in write mode + *-----------------------------------------------------------------------------------------*/ +ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename, int16_t delayNumSamples, int32_t delayTimeScale ) +{ + SplitFileReadWrite *hSplitRendFileReadWrite; + size_t header_len, h; + char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; + + hSplitRendFileReadWrite = (SplitFileReadWrite *) count_malloc( sizeof( SplitFileReadWrite ) ); + hSplitRendFileReadWrite->file = fopen( filename, "wb" ); + if ( hSplitRendFileReadWrite->file == NULL ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", filename ); + exit( -1 ); + } + + header_len = strlen( header ); + + /*read frame header*/ + for ( h = 0; h < header_len; h++ ) + { + if ( fwrite( &header[h], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_END_OF_FILE; + } + } + hSplitRendFileReadWrite->delay_ns = (int32_t) ( (float) delayNumSamples * 1000000000.0f / (float) delayTimeScale ); + fwrite( &hSplitRendFileReadWrite->delay_ns, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ); + + *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; + return IVAS_ERR_OK; +} + +ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite ) +{ + if ( ( *hhSplitRendFileReadWrite ) != NULL ) + { + if ( ( *hhSplitRendFileReadWrite )->file != NULL ) + { + fclose( ( *hhSplitRendFileReadWrite )->file ); + ( *hhSplitRendFileReadWrite )->file = NULL; + } + count_free( *hhSplitRendFileReadWrite ); + *hhSplitRendFileReadWrite = NULL; + } + return IVAS_ERR_OK; +} + +ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ) +{ + char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; + size_t header_len, i, num_bytes; + + if ( hSplitRendFileReadWrite == NULL ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + + if ( hSplitRendFileReadWrite->file == NULL ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + + header_len = strlen( header ); + + /*write frame header*/ + for ( i = 0; i < header_len; i++ ) + { + if ( fwrite( &header[i], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + } + + /*write num bytes*/ + if ( fwrite( bits_written, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + + num_bytes = ( *bits_written + 7 ) >> 3; + if ( fwrite( bits, sizeof( uint8_t ), num_bytes, hSplitRendFileReadWrite->file ) != num_bytes ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + + *bits_read = 0; + *bits_written = 0; + + return IVAS_ERR_OK; +} + +ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ) +{ + char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; + char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; + size_t header_len, i, num_bytes, bit_len; + + if ( hSplitRendFileReadWrite == NULL ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + + if ( hSplitRendFileReadWrite->file == NULL ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + + header_len = strlen( header ); + + /*write frame header*/ + for ( i = 0; i < header_len; i++ ) + { + if ( fread( &header_read[i], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_END_OF_FILE; + } + } + if ( strncmp( header_read, header, header_len ) ) + { + fprintf( stderr, "Error bitstream frame header mismatch\n" ); + return IVAS_ERR_FAILED_FILE_READ; + } + + /*write num bytes*/ + if ( fread( &bit_len, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + num_bytes = ( bit_len + 7 ) >> 3; + + if ( fread( bits, sizeof( uint8_t ), num_bytes, hSplitRendFileReadWrite->file ) != num_bytes ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + + *bits_read = 0; + *bits_written = bit_len; + + return IVAS_ERR_OK; +} + +ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ) +{ + if ( hSplitRendFileReadWrite == NULL ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + *delay_ns = hSplitRendFileReadWrite->delay_ns; + return IVAS_ERR_OK; +} +#endif diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h new file mode 100644 index 0000000000..d98bc4b936 --- /dev/null +++ b/lib_util/split_render_file_read_write.h @@ -0,0 +1,61 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef SPLIT_RENDER_FILE_READ_WRITE_H +#define SPLIT_RENDER_FILE_READ_WRITE_H + +#include "common_api_types.h" +#include "ivas_error.h" + + +typedef struct SplitFileReadWrite SplitFileReadWrite; + +/* Allocates and initializes a a split renderer reader instance */ +ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename ); + + +/* Allocates and initializes a a split renderer writer instance */ +ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename, int16_t delayNumSamples, int32_t delayTimeScale ); + +/* Closes the split renderer reader/writer and deallocates memory */ +ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite ); + +/*write split rend coded bitstream to file*/ +ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ); + +/*read split rend coded bits from file*/ +ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ); + +/*read split pre rend delay*/ +ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ); + +#endif -- GitLab From 1612045f4232d92e95eac99e8ca909c3623800a8 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 24 Mar 2023 14:42:01 +1100 Subject: [PATCH 061/591] disable reverb in renderer config file as it is enabled by default if config file present --- .../renderer_configs/split_renderer_config_384_3dof.txt | 3 +++ .../renderer_configs/split_renderer_config_384_3dof_hq.txt | 3 +++ .../renderer_configs/split_renderer_config_512_2dof.txt | 3 +++ .../renderer_configs/split_renderer_config_768_1dof.txt | 3 +++ .../renderer_configs/split_renderer_config_fc_384_3dof.txt | 3 +++ .../renderer_configs/split_renderer_config_fc_384_3dof_hq.txt | 3 +++ .../renderer_configs/split_renderer_config_fc_512_2dof.txt | 3 +++ .../renderer_configs/split_renderer_config_fc_768_1dof.txt | 3 +++ 8 files changed, 24 insertions(+) diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt index a3f6373d69..84f70f6d8a 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt @@ -5,3 +5,6 @@ HQMODE = 0; [GENERAL] RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt index 3103a24b50..520ba5b8ae 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt @@ -5,3 +5,6 @@ HQMODE = 1; [GENERAL] RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt index ef74dca52d..1a718cab03 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt @@ -5,3 +5,6 @@ HQMODE = 0; [GENERAL] RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt index f1d2ed8168..31d94203cc 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt @@ -5,3 +5,6 @@ HQMODE = 0; [GENERAL] RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt index ef12d462c9..5fbf7f7276 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt @@ -5,3 +5,6 @@ HQMODE = 0; [GENERAL] RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt index 56b6e2494f..881f462661 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt @@ -5,3 +5,6 @@ HQMODE = 1; [GENERAL] RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; \ No newline at end of file diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt index 6dfcbbf0f8..3178a67e32 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt @@ -5,3 +5,6 @@ HQMODE = 0; [GENERAL] RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt index 2c7a780f5c..bd448d16b3 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt @@ -5,3 +5,6 @@ HQMODE = 0; [GENERAL] RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; -- GitLab From 76a671d8df432d6f0b8ed707e6109c412746f337 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 19:58:20 +0200 Subject: [PATCH 062/591] simplify ivas_ism_metadata_enc() --- lib_com/ivas_prot.h | 4 -- lib_enc/ivas_ism_enc.c | 53 ++++++++++++--------- lib_enc/ivas_ism_metadata_enc.c | 84 ++++++++++----------------------- 3 files changed, 55 insertions(+), 86 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6eb61455e3..020f685d86 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -839,13 +839,9 @@ ivas_error ivas_ism_metadata_enc( #else const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ #endif -#ifdef MASA_AND_OBJECTS - , - const int16_t n_ism /* i : number of objects */ #ifdef OMASA_BRATE ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ #endif -#endif ); ivas_error ivas_ism_metadata_dec( diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index f7e5c8e04b..4d0943b76f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -89,7 +89,7 @@ ivas_error ivas_ism_enc( int16_t dtx_flag, sid_flag; ivas_error error; #ifdef MASA_AND_OBJECTS - int16_t n; + int16_t nchan_transport; #endif push_wmops( "ivas_ism_enc" ); @@ -102,13 +102,21 @@ ivas_error ivas_ism_enc( dtx_flag = 0; sid_flag = 0; +#ifdef MASA_AND_OBJECTS + nchan_transport = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + nchan_transport = st_ivas->hEncoderConfig->nchan_ism; + } +#endif + /*------------------------------------------------------------------* * Preprocesing *-----------------------------------------------------------------*/ /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -223,16 +231,16 @@ ivas_error ivas_ism_enc( #else st_ivas->hEncoderConfig->ivas_total_brate, #endif - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag #ifdef MASA_AND_OBJECTS - , - st_ivas->nSCE + nchan_transport, +#else + st_ivas->nchan_transport, +#endif + st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag #ifdef OMASA_BRATE , -1 #endif -#endif - ) ) != IVAS_ERR_OK ) { return error; @@ -244,7 +252,13 @@ ivas_error ivas_ism_enc( #else st_ivas->hEncoderConfig->ivas_total_brate, #endif - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm +#ifdef MASA_AND_OBJECTS + nchan_transport, +#else + st_ivas->nchan_transport, +#endif + + st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm #ifdef MASA_AND_OBJECTS , st_ivas->nSCE @@ -284,11 +298,11 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; // VE: change the interface of the following function and call it with 'st_ivas' only - if ( ( error = ivas_ism_metadata_enc( &ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, + if ( ( error = ivas_ism_metadata_enc( &ism_total_brate, nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, #ifdef TD5 st_ivas->hEncoderConfig->ism_extended_metadata_flag, #endif - st_ivas->nSCE, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ) ) != IVAS_ERR_OK ) + st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -298,7 +312,7 @@ ivas_error ivas_ism_enc( st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - ism_total_brate; } #else - if ( ( error = ivas_ism_metadata_enc( ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE, + if ( ( error = ivas_ism_metadata_enc( ism_total_brate, nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, #ifdef TD5 , st_ivas->hEncoderConfig->ism_extended_metadata_flag #endif @@ -313,7 +327,6 @@ ivas_error ivas_ism_enc( , st_ivas->hEncoderConfig->ism_extended_metadata_flag #endif - ) ) != IVAS_ERR_OK ) { return error; @@ -347,17 +360,9 @@ ivas_error ivas_ism_enc( /*------------------------------------------------------------------* * CoreCoders encoding *-----------------------------------------------------------------*/ -#ifdef MASA_AND_OBJECTS - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - n = st_ivas->nSCE; - } - else - { - n = st_ivas->nchan_transport; - } - for ( sce_id = 0; sce_id < n; sce_id++ ) +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -416,7 +421,11 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) +#else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) +#endif { if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index f4138e1b56..72c933c595 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -194,14 +194,10 @@ ivas_error ivas_ism_metadata_enc( #else const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ #endif -#ifdef MASA_AND_OBJECTS - , - const int16_t n_ism /* i : number of objects */ #ifdef OMASA_BRATE , const float lp_noise_CPE #endif -#endif ) { #ifdef TD5 @@ -226,9 +222,7 @@ ivas_error ivas_ism_metadata_enc( int16_t ism_imp[MAX_NUM_OBJECTS]; int16_t num_obj, nbands, nblocks; ivas_error error; -#ifdef MASA_AND_OBJECTS - int16_t n_ch; -#endif + error = IVAS_ERR_OK; push_wmops( "ism_meta_enc" ); @@ -244,7 +238,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS else if ( ism_mode == ISM_MASA_MODE_DISC ) { - num_obj = n_ism; + num_obj = nchan_transport; } #endif else @@ -275,22 +269,13 @@ ivas_error ivas_ism_metadata_enc( #endif #ifdef OMASA_BRATE - if ( ism_mode == ISM_MASA_MODE_DISC ) - { - n_ch = num_obj; - } - else - { - n_ch = nchan_transport; - } - if ( ism_mode == ISM_MASA_MODE_DISC ) { /*----------------------------------------------------------------* * Rate importance of particular ISM streams in combined format coding *----------------------------------------------------------------*/ - set_ism_importance_interformat( *ism_total_brate, n_ch, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); + set_ism_importance_interformat( *ism_total_brate, nchan_transport, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); } else #endif @@ -366,53 +351,40 @@ ivas_error ivas_ism_metadata_enc( #endif } } - } - /*----------------------------------------------------------------* - * Rate importance of particular ISM streams - *----------------------------------------------------------------*/ -#ifdef MASA_AND_OBJECTS - if ( ism_mode == ISM_MASA_MODE_DISC ) - { - n_ch = num_obj; - } - else - { - n_ch = nchan_transport; - } - - rate_ism_importance( n_ch, hIsmMeta, hSCE, ism_imp ); + /*----------------------------------------------------------------* + * Rate importance of particular ISM streams + *----------------------------------------------------------------*/ -#else - rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); -#endif + rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); #ifndef TUNE_360_OBJECT_WITH_NOISE - /* relax the importance decision in "stereo" coding for noisy audio */ + /* relax the importance decision in "stereo" coding for noisy audio */ #ifdef MASA_AND_OBJECTS - if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) + if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && num_obj == 2 ) #else - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) #endif - { - float diff_F; - - if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) { - for ( ch = 0; ch < num_obj; ch++ ) - { - diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; + float diff_F; - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) + if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) + { + for ( ch = 0; ch < num_obj; ch++ ) { - hIsmMeta[ch]->ism_metadata_flag = 1; - ism_imp[ch] = ISM_LOW_IMP; + diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; + + if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + ism_imp[ch] = ISM_LOW_IMP; + } } } } - } #endif + } /*----------------------------------------------------------------* * Write ISM common signaling @@ -433,7 +405,7 @@ ivas_error ivas_ism_metadata_enc( #endif #ifdef TD5 -/* write extended metadata presence flag */ + /* write extended metadata presence flag */ #ifdef OMASA_BRATE #ifdef FIX_TD5_IN_OMASA if ( ism_mode == ISM_MODE_DISC && *ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) @@ -449,11 +421,7 @@ ivas_error ivas_ism_metadata_enc( #endif /* write ISM metadata flag (one per object) */ -#ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < n_ch; ch++ ) -#else for ( ch = 0; ch < nchan_transport; ch++ ) -#endif { #ifdef OMASA_BRATE if ( ism_mode == ISM_MASA_MODE_DISC ) @@ -481,11 +449,7 @@ ivas_error ivas_ism_metadata_enc( #endif { /* write VAD flag */ -#ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < n_ch; ch++ ) -#else for ( ch = 0; ch < nchan_transport; ch++ ) -#endif { #ifdef OMASA_BRATE if ( ism_mode == ISM_MASA_MODE_DISC ) @@ -1039,7 +1003,7 @@ ivas_error ivas_ism_metadata_enc( } #ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < n_ch; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { #ifdef OMASA_BRATE hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; -- GitLab From 57f8d915239a52280a6b2ce400e19bb0667bfa79 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 20:25:34 +0200 Subject: [PATCH 063/591] addition of OMASA_BRATE_SW - solves MSAN error in OMASA bitrate switching --- lib_enc/ivas_init_enc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 89820ff179..bd333e20ea 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -610,6 +610,13 @@ ivas_error ivas_init_encoder( return error; } +#ifdef OMASA_BRATE_SW + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + set_f( st_ivas->hQMetaData->masa_to_total_energy_ratio[i], 0, MASA_FREQUENCY_BANDS ); + } +#endif + if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; -- GitLab From cd76cbd5285f891b99bed2274453b287a25135aa Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 28 Mar 2023 10:11:43 +0300 Subject: [PATCH 064/591] Updates to OMASA coding and processing addressing quality issues at 48k and 128k 3-4 objects --- lib_com/bitstream.c | 4 + lib_com/ivas_cnst.h | 13 +- lib_com/ivas_ism_config.c | 22 +- lib_com/ivas_masa_com.c | 15 +- lib_com/ivas_omasa_com.c | 107 +++- lib_com/ivas_prot.h | 34 +- lib_com/ivas_rom_com.c | 40 +- lib_com/ivas_rom_com.h | 1 + lib_com/ivas_stat_com.h | 8 +- lib_com/options.h | 12 +- lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_cpe_dec.c | 39 +- lib_dec/ivas_dec.c | 88 ++- lib_dec/ivas_dirac_dec.c | 4 + lib_dec/ivas_init_dec.c | 50 +- lib_dec/ivas_ism_metadata_dec.c | 64 +- lib_dec/ivas_ism_renderer.c | 8 + lib_dec/ivas_masa_dec.c | 406 +++++-------- lib_dec/ivas_mono_dmx_renderer.c | 4 + lib_dec/ivas_omasa_dec.c | 26 +- lib_dec/ivas_qmetadata_dec.c | 5 + lib_dec/ivas_sce_dec.c | 24 +- lib_dec/ivas_stat_dec.h | 6 +- lib_dec/ivas_stereo_switching_dec.c | 2 +- lib_dec/ivas_stereo_td_dec.c | 20 +- lib_enc/ivas_core_enc.c | 6 +- lib_enc/ivas_cpe_enc.c | 48 +- lib_enc/ivas_decision_matrix_enc.c | 5 +- lib_enc/ivas_enc.c | 90 +-- lib_enc/ivas_init_enc.c | 7 +- lib_enc/ivas_ism_enc.c | 19 +- lib_enc/ivas_ism_metadata_enc.c | 133 ++++- lib_enc/ivas_masa_enc.c | 598 ++++--------------- lib_enc/ivas_omasa_enc.c | 137 ++++- lib_enc/ivas_qmetadata_enc.c | 10 + lib_enc/ivas_sce_enc.c | 25 +- lib_enc/ivas_stat_enc.h | 4 +- lib_enc/ivas_stereo_classifier.c | 5 +- lib_enc/ivas_stereo_mdct_core_enc.c | 2 +- lib_enc/ivas_stereo_td_enc.c | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 34 ++ lib_rend/ivas_objectRenderer.c | 12 + 42 files changed, 1056 insertions(+), 1087 deletions(-) mode change 100755 => 100644 lib_com/options.h diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 71d7016f12..6cd20c8831 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1984,7 +1984,11 @@ ivas_error preview_indices( { st_ivas->ism_mode = ivas_omasa_ism_mode_select( total_brate, st_ivas->nchan_ism ); +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { st_ivas->nchan_transport = 0; } diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 33de8aa6f4..2474eee778 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -307,7 +307,7 @@ typedef enum #define ISM_METADATA_VAD_FLAG_BITS 1 #define ISM_METADATA_FLAG_BITS 2 -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS #define ISM_INACTIVE_IMP 0 /* == ISM_NO_META */ #endif #define ISM_NO_META 0 @@ -315,7 +315,7 @@ typedef enum #define ISM_MEDIUM_IMP 2 #define ISM_HIGH_IMP 3 -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS #define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM no meta / inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC ) #endif @@ -361,7 +361,12 @@ typedef enum #ifdef MASA_AND_OBJECTS , ISM_MASA_MODE_PARAM, /* parametric ISM mode for combined MASA ISM format */ +#ifdef OMASA_UPDATES + ISM_MASA_MODE_MASA_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using MASA parameters */ + ISM_MASA_MODE_PARAM_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using parametric object model */ +#else ISM_MASA_MODE_ONE_OBJ, /* MASA ISM mode when one object is encoded separarately */ +#endif ISM_MASA_MODE_DISC /* MASA ISM mode when all objects are encoded separarately */ #endif } ISM_MODE; @@ -624,7 +629,11 @@ enum IND_STEREO_DFT_SIDEGAIN_FLAG, IND_STEREO_DFT_SIDEGAINS, + #ifdef OMASA_UPDATES + IND_STEREO_DFT_ITD_MODE = IND_STEREO_DFT_SIDEGAINS + 4 * STEREO_DFT_BAND_MAX + 120, + #else IND_STEREO_DFT_ITD_MODE = IND_STEREO_DFT_SIDEGAINS + 4 * STEREO_DFT_BAND_MAX + 72, + #endif IND_STEREO_DFT_ITD_HUFF, IND_STEREO_DFT_ITD_NEG, diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 06ccd94a31..8a0621509c 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -50,7 +50,7 @@ #define FRMS_PER_SECOND ( 1000000000 / FRAME_SIZE_NS ) -#ifndef OMASA_BRATE +#ifndef MASA_AND_OBJECTS #define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISm inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRMS_PER_SECOND ) #endif @@ -65,7 +65,7 @@ * Convert bit-budget to bitrate *-------------------------------------------------------------------*/ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS void bitbudget_to_brate( #else static void bitbudget_to_brate( @@ -142,7 +142,7 @@ ivas_error ivas_ism_config( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* decision about bitrates per channel */ if ( combined_format_flag ) { @@ -185,17 +185,7 @@ ivas_error ivas_ism_config( /* count ISm common signaling bits */ if ( hIsmMeta != NULL ) { -#ifdef MASA_AND_OBJECTS - nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS; - if ( combined_format_flag == 0 ) - { - /* the bits for writing the number of objects are counted here for pure ISM modes */ - nb_bits_metadata[0] += num_obj; - } -#else nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; -#endif - for ( ch = 0; ch < n_ISms; ch++ ) { if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) @@ -362,7 +352,7 @@ ivas_error ivas_ism_config( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS if ( combined_format_flag == 1 ) { if ( diff > 0 ) @@ -390,12 +380,13 @@ ivas_error ivas_ism_config( bitbudget_to_brate( bits_CoreCoder, total_brate, n_ISms ); } + #ifdef DEBUGGING if ( nb_bits_metadata != NULL ) { int32_t tmpL; tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS if ( ism_total_brate != tmpL ) #else if ( sum_l( element_brate, n_ISms ) != tmpL ) @@ -403,6 +394,7 @@ ivas_error ivas_ism_config( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISm bit-budget distribution. Exiting!\n" ); } + } #endif diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index c3082f53e1..d5aa835e8d 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -96,7 +96,11 @@ void ivas_masa_set_elements( if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) { *element_mode = IVAS_CPE_MDCT; +#ifdef OMASA_UPDATES + if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) +#else if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) +#endif { *element_mode = IVAS_CPE_DFT; } @@ -115,7 +119,11 @@ void ivas_masa_set_elements( } hQMetaData->bits_frame_nominal = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ); #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); } @@ -494,12 +502,11 @@ void reconstruct_ism_ratios( } q_energy_ratio_ism[nchan_ism - 1] = 1.0f - sum; -#ifdef REDUCE_OMASA_META_BITS + if ( q_energy_ratio_ism[nchan_ism - 1] < 0 ) { q_energy_ratio_ism[nchan_ism - 1] = 0.0f; } -#endif return; } @@ -605,7 +612,11 @@ int32_t calculate_cpe_brate_MASA_ISM( k++; } +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { cpe_brate = ivas_total_brate - sep_object_brate[k - 2][0]; /* take data from the first column */ } diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index e248cc5a9d..175bf22195 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -35,16 +35,13 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" -#ifdef REDUCE_OMASA_META_BITS #include "ivas_rom_com.h" #include -#endif #ifdef DEBUGGING #include "debug.h" #endif #ifdef MASA_AND_OBJECTS -#ifdef OMASA_BRATE /*--------------------------------------------------------------- * Local constants *---------------------------------------------------------------*/ @@ -61,8 +58,7 @@ #define GAMMA_ISM_MEDIUM_IMP3 1.15f #define GAMMA_ISM_HIGH_IMP3 1.3f -#ifdef TUNING_DISC_3_4obj -#ifdef FIX_4OBJ_128 +#ifdef OMASA_UPDATES #define GAMMA_ISM_LOW_IMP4 0.8f #define GAMMA_ISM_MEDIUM_IMP4 1.0f #define GAMMA_ISM_HIGH_IMP4 1.2f @@ -71,8 +67,8 @@ #define GAMMA_ISM_MEDIUM_IMP4 0.8f #define GAMMA_ISM_HIGH_IMP4 1.0f #endif -#endif -#endif + + /*--------------------------------------------------------------- * ivas_omasa_ism_mode_select() @@ -108,7 +104,11 @@ ISM_MODE ivas_omasa_ism_mode_select( } else if ( ivas_total_brate >= IVAS_32k ) { +#ifdef OMASA_UPDATES + ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; +#else ism_mode = ISM_MASA_MODE_ONE_OBJ; +#endif } else { @@ -116,36 +116,49 @@ ISM_MODE ivas_omasa_ism_mode_select( } break; case 3: -#ifdef TUNING_DISC_3_4obj if ( ivas_total_brate >= IVAS_96k ) -#else - if ( ivas_total_brate >= IVAS_128k ) -#endif { ism_mode = ISM_MASA_MODE_DISC; } else if ( ivas_total_brate >= IVAS_64k ) { +#ifdef OMASA_UPDATES + ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; +#else ism_mode = ISM_MASA_MODE_ONE_OBJ; +#endif + } +#ifdef OMASA_UPDATES + else if ( ivas_total_brate >= IVAS_32k ) + { + ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ; } +#else else if ( ivas_total_brate >= IVAS_48k ) { ism_mode = ISM_MASA_MODE_PARAM; } +#endif else { ism_mode = ISM_MODE_NONE; } break; case 4: -#ifdef TUNING_DISC_3_4obj if ( ivas_total_brate >= IVAS_128k ) -#else - if ( ivas_total_brate >= IVAS_160k ) -#endif { ism_mode = ISM_MASA_MODE_DISC; } +#ifdef OMASA_UPDATES + else if ( ivas_total_brate >= IVAS_64k ) + { + ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; + } + else if ( ivas_total_brate >= IVAS_32k ) + { + ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ; + } +#else else if ( ivas_total_brate >= IVAS_64k ) { ism_mode = ISM_MASA_MODE_ONE_OBJ; @@ -154,6 +167,7 @@ ISM_MODE ivas_omasa_ism_mode_select( { ism_mode = ISM_MASA_MODE_PARAM; } +#endif else { ism_mode = ISM_MODE_NONE; @@ -165,7 +179,7 @@ ISM_MODE ivas_omasa_ism_mode_select( } -#ifdef OMASA_BRATE + /*--------------------------------------------------------------- * ivas_interformat_brate() * @@ -178,7 +192,7 @@ int32_t ivas_interformat_brate( const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ -#ifdef FIX_4OBJ_128 +#ifdef OMASA_UPDATES , const int16_t limit_flag /* i : flag to limit the bitrate increase */ #endif @@ -195,17 +209,16 @@ int32_t ivas_interformat_brate( } else { -#ifdef TUNING_DISC_3_4obj - if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) ) ) /* this condition corresponds to the ivas_total_brate = 96000 and 3 objects */ + if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate <= 24000 ) + || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) /* for border case in DISC mode */ { -#ifdef FIX_4OBJ_128 - if ( limit_flag && ( nchan_ism == 4 && element_brate == 24000 ) ) +#ifdef OMASA_UPDATES + if ( (limit_flag == 1) && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) { return element_brate; } #endif - if ( ism_imp == ISM_LOW_IMP ) { nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP4 ); @@ -213,15 +226,26 @@ int32_t ivas_interformat_brate( else if ( ism_imp == ISM_MEDIUM_IMP ) { nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP4 ); + if ( limit_flag == -1 ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 ); + } } else /* ISM_HIGH_IMP */ { nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 ); + if ( limit_flag == -1 ) + { + nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 ); + } } } else -#endif +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || +#else if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || +#endif ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 24400 and 1 object */ ) { @@ -319,9 +343,8 @@ void ivas_combined_format_brate_sanity( return; } -#endif -#ifdef REDUCE_OMASA_META_BITS + /*--------------------------------------------------------------- * bits_index_ism_ratio() * @@ -414,7 +437,7 @@ void calculate_nbits_meta( priority[obj] = max_p; } } - bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - ( (int16_t) ( priority[obj] * 1000.0f ) ) * 0.001f ) * 7 ); + bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - ( (int16_t) ( priority[obj] * 1000.0f ) ) * 0.001f ) * 6 ); } return; @@ -463,5 +486,35 @@ void ivas_get_stereo_panning_gains( return; } + +int16_t calculate_brate_limit_flag(int16_t * ism_imp, int16_t num_obj) +{ + int16_t n; + int16_t brate_limit_flag; + int16_t nzeros; + + brate_limit_flag = 0; + nzeros = 0; + for ( n = 0; n < num_obj; n++ ) + { + brate_limit_flag += ism_imp[n]; + if ( ism_imp[n] == 0 ) + { + nzeros++; + } + } + if ( brate_limit_flag >= (int16_t) ( num_obj * 2.5f ) ) + { + brate_limit_flag = 1; + } + else + { + if ( nzeros / (float) num_obj >= 0.5f ) + { + brate_limit_flag = -1; /* there is no limitation, on the contrary */ + } + } + return brate_limit_flag; +} #endif -#endif + diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b20eb35e3b..750e5fc85c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -765,7 +765,7 @@ ivas_error ivas_ism_config( #endif ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS void bitbudget_to_brate( const int16_t x[], /* i : bitbudgets */ int32_t y[], /* o : bitrates */ @@ -822,7 +822,7 @@ ivas_error ivas_ism_enc( ); ivas_error ivas_ism_metadata_enc( -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int32_t *ism_total_brate, /* i/o: ISms total bitrate */ #else const int32_t ism_total_brate, /* i : ISms total bitrate */ @@ -838,7 +838,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS , const int16_t n_ism /* i : number of objects */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ #endif #endif @@ -4471,12 +4471,9 @@ void ivas_masa_encode( const int16_t nchan_ism, /* i : number of ISM channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ - OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ -#ifdef REDUCE_OMASA_META_BITS - , + OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ int16_t ism_imp /* i: importance of separated object */ #endif -#endif ); void ivas_masa_estimate_energy( @@ -4552,7 +4549,7 @@ int32_t calculate_cpe_brate_MASA_ISM( const int16_t nchan_ism /* i : number of objects */ ); -#ifdef OMASA_DIFFUSE_ISM_MERGE + void ivas_merge_masa_metadata( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */ OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */ @@ -4561,9 +4558,7 @@ void ivas_merge_masa_metadata( void ivas_masa_combine_directions( MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ ); -#endif /* OMASA_DIFFUSE_ISM_MERGE */ -#ifdef REDUCE_OMASA_META_BITS /*!r : number of bits for ISM ratio index */ int16_t bits_index_ism_ratio( const int16_t nchan_ism /* i : number of objects */ @@ -4579,7 +4574,11 @@ void calculate_nbits_meta( const int16_t idx_sep_obj, const int16_t ism_imp ); -#endif + +int16_t calculate_brate_limit_flag( + int16_t * ism_imp, + int16_t num_obj +); void ivas_get_stereo_panning_gains( const float aziDeg, @@ -5027,18 +5026,12 @@ void ivas_omasa_enc_close( void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ - const int32_t input_Fs /* i : Input sample rate */ -#ifdef OMASA_DIFFUSE_ISM_MERGE - , + const int32_t input_Fs, /* i : Input sample rate */ ISM_MODE ismMode /* i : ISM mode */ -#endif ); void ivas_omasa_enc( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ -#ifndef OMASA_DIFFUSE_ISM_MERGE - IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ -#endif MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -5050,7 +5043,6 @@ void ivas_omasa_enc( int16_t* idx_separated_object /* o : Index of the separated object */ ); -#ifdef OMASA_BRATE void ivas_set_surplus_brate_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ #ifdef DEBUG_MODE_INFO @@ -5079,7 +5071,7 @@ int32_t ivas_interformat_brate( const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ const int16_t ism_imp /* i : ISM importance flag */ -#ifdef FIX_4OBJ_128 +#ifdef OMASA_UPDATES , const int16_t limit_flag /* i : flag to limit the bitrate increase */ #endif ); @@ -5090,7 +5082,7 @@ void ivas_combined_format_brate_sanity( int32_t *core_brate, /* i/o: core bitrate */ int16_t *diff_nBits /* o : number of differential bits */ ); -#endif + ISM_MODE ivas_omasa_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 66db7666f2..2f4d9367f3 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2789,29 +2789,13 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = {0, 0, 0, 0}, /* 13k2 */ {0, 0, 0, 0}, /* 16k4 */ {9600, 0, 0, 0}, /* 24k4 */ -#ifdef OMASA_BRATE - {11000, 0, 0, 0}, /* 32k */ -#else - {9600, 0, 0, 0}, /* 32k */ -#endif - {IVAS_13k2, 9600, 0, 0}, /* 48k */ -#ifdef OMASA_BRATE + {IVAS_13k2, 0, 0, 0}, /* 32k */ + {16000, 11000, 0, 0}, /* 48k */ {16000, 11700, 0, 0}, /* 64k */ -#else - {16000, IVAS_13k2, 0, 0}, /* 64k */ -#endif {20000, 16000, 0, 0}, /* 80k */ -#ifdef TUNING_DISC_3_4obj {IVAS_32k, 20000, 20000, 0}, /* 96k */ -#else - {IVAS_32k, 20000, 0, 0}, /* 96k */ -#endif -#ifdef TUNING_DISC_3_4obj - {IVAS_32k, IVAS_24k4, 20000, 24000}, /* 128k */ -#else - {IVAS_32k, IVAS_24k4, 20000, 16000}, /* 128k */ -#endif - {IVAS_48k, IVAS_32k, IVAS_24k4, 20000}, /* 160k */ + {IVAS_32k, IVAS_24k4, 24000, 24000}, /* 128k */ + {IVAS_48k, IVAS_32k, IVAS_24k4, 24000}, /* 160k */ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */ {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */ @@ -2847,6 +2831,22 @@ const float dct8[8*8] = 0.3536f, -0.4157f, 0.1913f, 0.0975f, -0.3536f, 0.4904f, -0.4619f, 0.2778f, 0.3536f, -0.4904f, 0.4619f, -0.4157f, 0.3536f, -0.2778f, 0.1913f, -0.0975f }; + +const float dct12[12*12]= +{ + 0.2887f, 0.4048f, 0.3943f, 0.3772f, 0.3536f, 0.3239f, 0.2887f, 0.2485f, 0.2041f, 0.1562f, 0.1057f, 0.0533f, + 0.2887f, 0.3772f, 0.2887f, 0.1562f, 0.0000f, -0.1562f, -0.2887f, -0.3772f, -0.4082f, -0.3772f, -0.2887f, -0.1562f, + 0.2887f, 0.3239f, 0.1057f, -0.1562f, -0.3536f, -0.4048f, -0.2887f, -0.0533f, 0.2041f, 0.3772f, 0.3943f, 0.2485f, + 0.2887f, 0.2485f, -0.1057f, -0.3772f, -0.3536f, -0.0533f, 0.2887f, 0.4048f, 0.2041f, -0.1562f, -0.3943f, -0.3239f, + 0.2887f, 0.1562f, -0.2887f, -0.3772f, -0.0000f, 0.3772f, 0.2887f, -0.1562f, -0.4082f, -0.1562f, 0.2887f, 0.3772f, + 0.2887f, 0.0533f, -0.3943f, -0.1562f, 0.3536f, 0.2485f, -0.2887f, -0.3239f, 0.2041f, 0.3772f, -0.1057f, -0.4048f, + 0.2887f, -0.0533f, -0.3943f, 0.1562f, 0.3536f, -0.2485f, -0.2887f, 0.3239f, 0.2041f, -0.3772f, -0.1057f, 0.4048f, + 0.2887f, -0.1562f, -0.2887f, 0.3772f, 0.0000f, -0.3772f, 0.2887f, 0.1562f, -0.4082f, 0.1562f, 0.2887f, -0.3772f, + 0.2887f, -0.2485f, -0.1057f, 0.3772f, -0.3536f, 0.0533f, 0.2887f, -0.4048f, 0.2041f, 0.1562f, -0.3943f, 0.3239f, + 0.2887f, -0.3239f, 0.1057f, 0.1562f, -0.3536f, 0.4048f, -0.2887f, 0.0533f, 0.2041f, -0.3772f, 0.3943f, -0.2485f, + 0.2887f, -0.3772f, 0.2887f, -0.1562f, -0.0000f, 0.1562f, -0.2887f, 0.3772f, -0.4082f, 0.3772f, -0.2887f, 0.1562f, + 0.2887f, -0.4048f, 0.3943f, -0.3772f, 0.3536f, -0.3239f, 0.2887f, -0.2485f, 0.2041f, -0.1562f, 0.1057f, -0.0533f +}; #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index ce66e4e2a4..41101bd9b1 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -319,6 +319,7 @@ extern const int32_t sep_object_brate[][MAX_NUM_OBJECTS]; extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; +extern const float dct12[]; #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index c2cda437a2..c7664a9a41 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -58,9 +58,13 @@ typedef struct int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int16_t ism_imp; /* ISM importance flag */ int16_t ism_vad_flag; +#ifdef OMASA_UPDATES + float q_azimuth_old; + float q_elevation_old; +#endif #endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; @@ -420,7 +424,6 @@ typedef struct ivas_masa_common_spatial_meta_struct } MASA_COMMON_SPATIAL_META; #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE typedef struct ivas_omasa_meta_struct { uint8_t num_dirs; @@ -428,7 +431,6 @@ typedef struct ivas_omasa_meta_struct MASA_COMMON_SPATIAL_META common_meta; } OMASA_SPATIAL_META, *OMASA_SPATIAL_META_HANDLE; #endif -#endif typedef struct ivas_masa_metadata_frame_struct { diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index 4a4fefae31..62011c419e --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,18 +169,8 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS -#define OMASA_BRATE /* VA: combined format bit-budget distribution */ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ - - - -#define TUNING_DISC_3_4obj /* Nokia: increase bitrate for objects in DISC mode at 128k 4obj and 96k 3 obj */ -#define REDUCE_OMASA_META_BITS /* Nokia: reduce metadata number of bits and fix directional metadata bit allocation */ -#define OMASA_DIFFUSE_ISM_MERGE /* Nokia: Diffuse-energy retaining merging of ISM and MASA */ - -#define FIX_4OBJ_128 /* VA: fix to 4 ISMs 24 kbps case: when all objects are HIGH_IMP, keep 24 kbps bitrate, otherwise increase the 24 kbps bitrate */ - - +#define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index e494cf4881..37034da4f8 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -269,7 +269,7 @@ ivas_error ivas_core_dec( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /*------------------------------------------------------------------* * Sanity check in combined format coding *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index eab7b7c340..b093d58805 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -233,20 +233,11 @@ ivas_error ivas_cpe_dec( /* read DFT Stereo side info */ nb_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_BRATE cpe_brate = st_ivas->hCPE[0]->element_brate; -#else - cpe_brate = ivas_total_brate; -#endif if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifndef OMASA_BRATE - cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); -#endif sts[1]->bit_stream = sts[0]->bit_stream + cpe_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; -#ifdef OMASA_BRATE sts[1]->bit_stream += hCPE->brate_surplus / FRAMES_PER_SEC; -#endif } else #endif @@ -278,9 +269,13 @@ ivas_error ivas_cpe_dec( /* subtract metadata bitbudget */ sts[0]->total_brate -= ( nb_bits_metadata * FRAMES_PER_SEC ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { sts[0]->total_brate += hCPE->brate_surplus; } @@ -296,7 +291,7 @@ ivas_error ivas_cpe_dec( /* signal bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); #endif if ( st_ivas->hQMetaData != NULL ) @@ -306,10 +301,14 @@ ivas_error ivas_cpe_dec( } else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* compute bit-rate surplus per channel in combined format coding */ int32_t brate_surplus[CPE_CHANNELS]; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { brate_surplus[0] = ( ( hCPE->brate_surplus / FRAMES_PER_SEC ) >> 1 ) * FRAMES_PER_SEC; brate_surplus[1] = hCPE->brate_surplus - brate_surplus[0]; @@ -341,9 +340,13 @@ ivas_error ivas_cpe_dec( sts[n]->bits_frame_nominal = (int16_t) ( sts[n]->total_brate / FRAMES_PER_SEC ); sts[n]->bits_frame_channel = (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) / n_channels ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { sts[n]->bits_frame_channel += (int16_t) ( brate_surplus[n] / FRAMES_PER_SEC ); sts[n]->total_brate += brate_surplus[n]; @@ -674,7 +677,11 @@ ivas_error create_cpe_dec( } #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { cpe_brate = element_brate; } @@ -699,7 +706,7 @@ ivas_error create_cpe_dec( set_f( hCPE->prev_synth[n], 0, NS2SA( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ) ); } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hCPE->brate_surplus = 0; #endif @@ -1108,7 +1115,11 @@ static void read_stereo_mode_and_bwidth( else { /* read stereo technology info */ +#ifdef OMASA_UPDATES + if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k) ) +#else if ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) +#endif { hCPE->element_mode = get_next_indice( sts[0], NBITS_ELEMENT_MODE ) + IVAS_CPE_DFT; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 1389193a55..80b5d6edd2 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -399,33 +399,18 @@ ivas_error ivas_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifndef OMASA_BRATE - ism_total_brate = 0; -#endif st = st_ivas->hCPE[0]->hCoreCoder[0]; - -#ifndef OMASA_BRATE - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - ism_total_brate += st_ivas->hSCE[n]->element_brate; - } - st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); - } -#endif - nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ if ( st_ivas->hDirAC != NULL ) { +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) +#endif { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } @@ -441,15 +426,17 @@ ivas_error ivas_dec( return error; } -#ifdef OMASA_BRATE /* 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 )] ); -#endif /* Audio signal decoding */ +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) +#endif { if ( st_ivas->nSCE == 1 ) { @@ -479,11 +466,27 @@ ivas_error ivas_dec( return error; } +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); + st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + } + } + else + { + st_ivas->hMasaIsmData->azimuth_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); + st_ivas->hMasaIsmData->elevation_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); + } +#else for ( n = 0; n < st_ivas->nchan_ism; n++ ) { st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } +#endif } if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) @@ -508,7 +511,42 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + { + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; + float gain = 0.7943f; /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + v_multc( data_separated_objects[n], gain, data_separated_objects[n], output_frame ); + } + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); + } + + ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); + ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame,st_ivas->hCrendWrapper, + st_ivas->transport_config,st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, + st_ivas->nchan_ism, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, data_separated_objects, output_frame ); + + for ( n = 0; n < BINAURAL_CHANNELS; n++ ) + { + v_add( output[n], data_separated_objects[n], output[n], output_frame ); + } + } + else + { + ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); + } +#else ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); +#endif } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { @@ -516,10 +554,18 @@ ivas_error ivas_dec( } else if ( st_ivas->hDirAC ) { +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { mvr2r( output[2], data_separated_objects[0], output_frame ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 1cb8e9c1c1..f8e0f98d1b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2021,7 +2021,11 @@ void ivas_dirac_dec( } } +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) +#endif { preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f530e8ecce..15519bdee4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1040,7 +1040,11 @@ ivas_error ivas_init_decoder( { k++; } +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { /* one separated object */ st_ivas->nSCE = 1; @@ -1050,7 +1054,24 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); -#ifdef OMASA_BRATE +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + int32_t temp_brate[MAX_SCE]; + + if ( ( error = create_ism_metadata_dec( st_ivas, 1, temp_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); + } + } +#else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); @@ -1106,7 +1127,11 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hCPE[0]->hCoreCoder[n] ); } +#ifdef OMASA_UPDATES + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1407,6 +1432,25 @@ ivas_error ivas_init_decoder( #endif } +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) + { + /* Use td renderer for the objects in DISC mode */ + error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, + st_ivas->transport_config, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); + if ( ( error ) != IVAS_ERR_OK ) + { + return error; + } + + /* Reserve memory for delay buffer */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC && ( st_ivas->renderer_type == RENDERER_TD_PANNING || @@ -2013,7 +2057,11 @@ void ivas_init_dec_get_num_cldfb_instances( { *numCldfbAnalyses += st_ivas->nchan_ism; } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e72d691768..4066304dab 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -127,7 +127,11 @@ ivas_error ivas_ism_metadata_dec( /* read number of objects */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode != ISM_MASA_MODE_DISC ) +#endif { #endif num_obj = 1; @@ -164,8 +168,12 @@ ivas_error ivas_ism_metadata_dec( /* Read ISm present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { /* ISM importance flag is already read in ivas_masa_decode() */ ism_imp[ch] = hIsmMeta[ch]->ism_imp; @@ -199,8 +207,12 @@ ivas_error ivas_ism_metadata_dec( { if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { /* VAD flag is already read in ivas_masa_decode() */ localVAD[ch] = hIsmMeta[ch]->ism_vad_flag; @@ -235,7 +247,11 @@ ivas_error ivas_ism_metadata_dec( { hIsmMetaData = hIsmMeta[ch]; #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -399,7 +415,11 @@ ivas_error ivas_ism_metadata_dec( /* save number of metadata bits read */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -489,8 +509,12 @@ ivas_error ivas_ism_metadata_dec( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { ism_metadata_flag_global = 1; } @@ -504,34 +528,33 @@ ivas_error ivas_ism_metadata_dec( { #ifdef MASA_AND_OBJECTS int16_t masa_ism_flag = 0; +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { masa_ism_flag = 1; - } -#endif -#ifdef OMASA_BRATE - if ( ism_mode == ISM_MASA_MODE_DISC ) - { for ( ch = 0; ch < *nchan_transport; ch++ ) { element_brate[ch] = hSCE[ch]->element_brate; } } + ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, masa_ism_flag ); +#else + ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); #endif - ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata -#ifdef MASA_AND_OBJECTS - , - masa_ism_flag -#endif - ); - for ( ch = 0; ch < *nchan_transport; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -543,8 +566,12 @@ ivas_error ivas_ism_metadata_dec( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode != ISM_MASA_MODE_DISC ) +#endif #endif { hSCE[ch]->element_brate = element_brate[ch]; @@ -616,7 +643,7 @@ ivas_error create_ism_metadata_dec( st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS st_ivas->hIsmMetaData[ch]->ism_imp = -1; st_ivas->hIsmMetaData[ch]->ism_vad_flag = 1; #endif @@ -624,7 +651,8 @@ ivas_error create_ism_metadata_dec( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL + + ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS , 0 diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index ef890a7482..043b6f8600 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -283,7 +283,11 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( st_ivas->hMasaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES ); +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { st_ivas->hMasaIsmData->delayBuffer_nchan = 1; } @@ -341,7 +345,11 @@ void ivas_masa_ism_separate_object_render( hRendererData = st_ivas->hIsmRendererData; lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { single_separated = 1; num_objects = 1; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index f45b1527ff..a0fa5cf0b4 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -74,24 +74,12 @@ static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hM static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); #ifdef MASA_AND_OBJECTS -static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos -#ifdef REDUCE_OMASA_META_BITS - , - const int16_t idx_separated_object, - const int16_t ism_imp -#endif -); +static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp); static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, const int16_t nchan_ism, const int16_t K ); -static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t nbands, const int16_t nblocks -#ifdef REDUCE_OMASA_META_BITS - , - const int16_t idx_separated_object -#endif -); -#endif -#ifdef REDUCE_OMASA_META_BITS +static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t nbands, const int16_t nblocks, const int16_t idx_separated_object); + static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], uint16_t *bit_stream, int16_t *next_bit_pos, float *masa_to_total_energy_ratio, const int16_t idx_sep_obj, int16_t *num_zeros ); #endif @@ -118,12 +106,8 @@ ivas_error ivas_masa_decode( ivas_error error; #ifdef MASA_AND_OBJECTS int16_t obj; -#ifdef OMASA_BRATE int16_t i, ch, ism_imp; -#ifdef REDUCE_OMASA_META_BITS ism_imp = 0; -#endif -#endif #endif error = IVAS_ERR_OK; @@ -132,7 +116,11 @@ ivas_error ivas_masa_decode( low_bitrate_mode = -1; /* This means that LBR mode is not used. */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->hOutSetup.separateChannelEnabled || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->hOutSetup.separateChannelEnabled || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( st_ivas->hOutSetup.separateChannelEnabled ) #endif @@ -184,7 +172,11 @@ ivas_error ivas_masa_decode( st->next_bit_pos -= NO_BITS_MASA_ISM_NO_OBJ; *nb_bits_read += NO_BITS_MASA_ISM_NO_OBJ; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { /* read index of separated object */ /* nchan_ism should be > 1*/ @@ -193,16 +185,28 @@ ivas_error ivas_masa_decode( st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read )++; } -#ifdef REDUCE_OMASA_META_BITS else { st_ivas->hMasaIsmData->idx_separated_ism = -1; } -#endif -#ifdef OMASA_BRATE /* read ISM importance flag (one per object) */ +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + ism_imp = 0; + for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) + { + byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read )++; + ism_imp = ( ism_imp << 1 ) + byteBuffer; + } + st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; + } + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { ism_imp = 0; for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) @@ -212,6 +216,17 @@ ivas_error ivas_masa_decode( ism_imp = ( ism_imp << 1 ) + byteBuffer; } st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; + +#ifdef OMASA_UPDATES + /* reset */ + st_ivas->hIsmMetaData[0]->ism_vad_flag = 1; + if ( st_ivas->hIsmMetaData[0]->ism_imp == ISM_NO_META ) + { + /* read VAD flag */ + st_ivas->hIsmMetaData[0]->ism_vad_flag = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read ) += ISM_METADATA_VAD_FLAG_BITS; + } +#endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -236,7 +251,6 @@ ivas_error ivas_masa_decode( } } } -#endif } #endif /* Placeholder for descriptive metadata content */ @@ -302,17 +316,21 @@ ivas_error ivas_masa_decode( #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos -#ifdef REDUCE_OMASA_META_BITS - , - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp #endif - ); + { + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp ); } +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) { @@ -328,7 +346,11 @@ ivas_error ivas_masa_decode( *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos ); #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) +#endif { /* Modify spatial metadata based on the MASA-to-total energy ratios */ modify_masa_energy_ratios( hQMetaData ); @@ -435,9 +457,6 @@ ivas_error ivas_masa_decode( } if ( st_ivas->hDirAC != NULL ) { -#ifndef OMASA_BRATE - int16_t i; -#endif int16_t b; int16_t block; @@ -536,7 +555,11 @@ ivas_error ivas_masa_dec_open( #ifdef MASA_AND_OBJECTS ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -615,6 +638,13 @@ ivas_error ivas_masa_ism_data_open( hMasaIsmData->objectsMoved = 0; hMasaIsmData->delayBuffer = NULL; st_ivas->hMasaIsmData = hMasaIsmData; +#ifdef OMASA_UPDATES + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) + { + hMasaIsmData->q_elevation_old[ch] = 0.0f; + hMasaIsmData->q_azimuth_old[ch] = 0.0f; + } + #endif return IVAS_ERR_OK; } @@ -695,7 +725,11 @@ static ivas_error ivas_masa_dec_config( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -707,7 +741,18 @@ static ivas_error ivas_masa_dec_config( if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); +#ifdef OMASA_UPDATES + if ( st_ivas->hCPE[0]->element_brate == IVAS_48k && st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) + { + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, IVAS_32k, st_ivas->nchan_transport, MC_MODE_NONE ); + } + else + { +#endif + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); +#ifdef OMASA_UPDATES + } +#endif } else { @@ -1376,7 +1421,11 @@ ivas_error ivas_masa_dec_reconfigure( } #ifdef MASA_AND_OBJECTS ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { for ( n = 0; n < st_ivas->nSCE; n++ ) { @@ -1713,7 +1762,6 @@ static void decode_index_slice( } -#ifdef REDUCE_OMASA_META_BITS static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o: ISM read ratio indexes */ const int16_t nchan_ism, /* i: number of objects */ @@ -1747,7 +1795,7 @@ static void read_ism_ratio_index( b_signif = 0; no_levels_ratio_ism = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); - while ( b_signif < numCodingBands && masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR ) + while ( (b_signif < numCodingBands) && (masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR) ) { /* distribute evenly the objects */ distribute_evenly_ism( ratio_ism_idx[b_signif], no_levels_ratio_ism, nchan_ism ); @@ -1985,170 +2033,7 @@ static void read_ism_ratio_index( } -#else -static void read_ism_ratio_index( - int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], - int16_t no_ism, - int16_t numCodingBands, - int16_t sf, - int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], - uint16_t *bit_stream, - int16_t *next_bit_pos, - float *masa_to_total_energy_ratio ) -{ - int16_t b, i; - int16_t index; - int16_t GR_order, differential_subframe; - int16_t buf; - int16_t no_levels_ratio_ism; - no_levels_ratio_ism = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); - if ( sf == 0 ) - { - switch ( no_ism ) - { - case 2: - for ( b = 0; b < numCodingBands; b++ ) - { - if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) - { - index = 0; - for ( i = 0; i < 3; i++ ) - { - index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; - } - - decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); - } - else - { - /* distribute evenly the objects */ - distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); - } - } - break; - case 3: - for ( b = 0; b < numCodingBands; b++ ) - { - if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) - { - /* read first 5 bits */ - index = 0; - for ( i = 0; i < 5; i++ ) - { - index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; - } - if ( index == 31 ) - { - index = 0; - for ( i = 0; i < 3; i++ ) - { - index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; - } - index += 31; - } - - decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); - } - else - { - /* distribute evenly the objects */ - distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); - } - } - break; - case 4: - for ( b = 0; b < numCodingBands; b++ ) - { - if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) - { - /* read 7 bits */ - index = 0; - for ( i = 0; i < 7; i++ ) - { - index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; - } - - decode_index_slice( index, ratio_ism_idx[b], no_ism, no_levels_ratio_ism ); - } - else - { - /* distribute evenly the objects */ - distribute_evenly_ism( ratio_ism_idx[b], no_levels_ratio_ism, no_ism ); - } - } - break; - default: - assert( ( no_ism >= 2 && no_ism <= 4 ) && "Wrong number of objects for MASA_ISM." ); - break; - } - } - else - { - if ( numCodingBands > 1 ) - { - /* read prediction type */ - differential_subframe = bit_stream[( *next_bit_pos )--]; - } - else - { - differential_subframe = 1; - } - /* read GR order */ - GR_order = bit_stream[( *next_bit_pos )--]; - for ( b = 0; b < numCodingBands; b++ ) - { - for ( i = 0; i < no_ism - 1; i++ ) - { - buf = ivas_qmetadata_DecodeExtendedGR( bit_stream, next_bit_pos, 100, GR_order ); - if ( ( buf % 2 ) == 0 ) - { - ratio_ism_idx[b][i] = -( buf >> 1 ); - } - else - { - ratio_ism_idx[b][i] = ( ( buf + 1 ) >> 1 ); - } - } - } - if ( differential_subframe ) - { - /* differential to previous subframe */ - for ( b = 0; b < numCodingBands; b++ ) - { - ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; - for ( i = 0; i < no_ism - 1; i++ ) - { - ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx_prev_sf[b][i]; - ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; - } - } - } - else - { - /* difference to previous subband */ - ratio_ism_idx[0][no_ism - 1] = no_levels_ratio_ism; - /* first subband - differential to previous subframe */ - for ( i = 0; i < no_ism - 1; i++ ) - { - ratio_ism_idx[0][i] = ratio_ism_idx[0][i] + ratio_ism_idx_prev_sf[0][i]; - ratio_ism_idx[0][no_ism - 1] -= ratio_ism_idx[0][i]; - } - /* rest of subbands differential to previous subband */ - for ( b = 1; b < numCodingBands; b++ ) - { - ratio_ism_idx[b][no_ism - 1] = no_levels_ratio_ism; - for ( i = 0; i < no_ism - 1; i++ ) - { - ratio_ism_idx[b][i] = ratio_ism_idx[b][i] + ratio_ism_idx[b - 1][i]; - ratio_ism_idx[b][no_ism - 1] -= ratio_ism_idx[b][i]; - } - } - } - } - return; -} -#endif static void decode_ism_ratios( @@ -2158,32 +2043,22 @@ static void decode_ism_ratios( float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ const int16_t n_ism, /* i : number of objects */ const int16_t nbands, /* i : number of subbands */ - const int16_t numSf /* i : number of subframes */ -#ifdef REDUCE_OMASA_META_BITS - , + const int16_t numSf, /* i : number of subframes */ const int16_t idx_separated_object /* i: index of separated object */ -#endif ) { int16_t sf, band; int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; -#ifdef REDUCE_OMASA_META_BITS float tmp; int16_t num_zeros; num_zeros = 0; -#endif + /* hQMetaData->q_direction->cfg.nblocks; */ for ( sf = 0; sf < numSf; sf++ ) { /* read ism ratio indexes */ - read_ism_ratio_index( ratio_ism_idx, n_ism, nbands, sf, ratio_ism_idx_prev_sf, bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio[sf] -#ifdef REDUCE_OMASA_META_BITS - , - idx_separated_object, - &num_zeros -#endif - ); + read_ism_ratio_index( ratio_ism_idx, n_ism, nbands, sf, ratio_ism_idx_prev_sf, bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio[sf], idx_separated_object, &num_zeros ); /* save previous subframe index values */ if ( sf < numSf - 1 ) @@ -2200,7 +2075,7 @@ static void decode_ism_ratios( { reconstruct_ism_ratios( ratio_ism_idx[band], n_ism, 1.0f / (float) ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ), ratio_ism[sf][band] ); } -#ifdef REDUCE_OMASA_META_BITS + if ( ( n_ism > 2 ) && ( idx_separated_object == n_ism - 1 ) ) { /* rotate */ @@ -2214,7 +2089,7 @@ static void decode_ism_ratios( } } } -#endif + if ( nbands == 1 ) { for ( band = 1; band < 5; band++ ) @@ -2245,26 +2120,22 @@ static int16_t ivas_decode_masaism_metadata( MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, - int16_t *next_bit_pos -#ifdef REDUCE_OMASA_META_BITS - , + int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp -#endif ) { int16_t sf, band, dir, nbands, nblocks, obj, i; float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t *band_mapping; int16_t b; -#ifndef REDUCE_OMASA_META_BITS - float priority[MAX_NUM_OBJECTS]; -#endif int16_t bits_ism[MAX_NUM_OBJECTS], index; uint16_t idx_el, idx_az; float azimuth, elevation; int16_t nb_bits_read; - +#ifdef OMASA_UPDATES + float delta_phi; +#endif nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; nblocks = hQMetaData->q_direction->cfg.nblocks; /* To do: what if other value than 4? */ @@ -2274,26 +2145,7 @@ static int16_t ivas_decode_masaism_metadata( if ( nchan_ism > 1 ) { /* read ISM ratios */ - decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism, nbands, nblocks -#ifdef REDUCE_OMASA_META_BITS - , - idx_separated_object -#endif - ); -#ifndef REDUCE_OMASA_META_BITS - /* calculate priority */ - set_f( priority, 0.0f, nchan_ism ); - for ( sf = 0; sf < nblocks; sf++ ) - { - for ( band = 0; band < nbands; band++ ) - { - for ( obj = 0; obj < nchan_ism; obj++ ) - { - priority[obj] = max( priority[obj], ( energy_ratio_ism[sf][band][obj] * hQMetaData->masa_to_total_energy_ratio[sf][band] ) ); - } - } - } -#endif + decode_ism_ratios( bit_stream, next_bit_pos, hQMetaData, energy_ratio_ism, nchan_ism, nbands, nblocks, idx_separated_object ); } else { @@ -2304,31 +2156,73 @@ static int16_t ivas_decode_masaism_metadata( energy_ratio_ism[sf][band][0] = 1.0f; } } -#ifndef REDUCE_OMASA_META_BITS - priority[0] = 1; -#endif } /* read ISM metadata */ -#ifdef REDUCE_OMASA_META_BITS calculate_nbits_meta( nchan_ism, energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, nblocks, nbands, bits_ism, idx_separated_object, ism_imp ); -#else - for ( obj = 0; obj < nchan_ism; obj++ ) - { - bits_ism[obj] = 11 - (int16_t) ( ( 1 - priority[obj] ) * 7 ); - } -#endif for ( obj = 0; obj < nchan_ism; obj++ ) { index = 0; +#ifdef OMASA_UPDATES + if ( bits_ism[obj] < 8 ) /* if low resolution, can look to the past */ + { + /* read if same as previous */ + if ( bit_stream[( *next_bit_pos )--] ) + { + azimuth = hMasaIsmData->q_azimuth_old[obj]; + elevation = hMasaIsmData->q_elevation_old[obj]; + } + else + { + for ( i = 0; i < bits_ism[obj]; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); + + if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) + { + delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ + if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) + { + azimuth -= delta_phi; + } + else + { + if ( hMasaIsmData->q_azimuth_old[obj] - azimuth > delta_phi ) + { + azimuth += delta_phi; + } + } + } + + hMasaIsmData->q_azimuth_old[obj] = azimuth; + hMasaIsmData->q_elevation_old[obj] = elevation; + } + } + else + { + for ( i = 0; i < bits_ism[obj]; i++ ) + { + index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; + } + deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); + hMasaIsmData->q_azimuth_old[obj] = azimuth; + hMasaIsmData->q_elevation_old[obj] = elevation; + } +#else for ( i = 0; i < bits_ism[obj]; i++ ) { index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; } deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); + + +#endif hMasaIsmData->azimuth_ism[obj] = (int16_t) rint( azimuth ); hMasaIsmData->elevation_ism[obj] = (int16_t) rint( elevation ); + } /* Modify ISM metadata based on the MASA-to-total energy ratios */ @@ -2396,6 +2290,12 @@ void ivas_masa_ism_set_edited_objects( hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism] = st_ivas->elevation_edited; } } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + /* Directions cannot be edited in this mode */ + } +#endif else { for ( dir = 0; dir < MAX_NUM_OBJECTS; dir++ ) @@ -2412,7 +2312,11 @@ void ivas_masa_ism_set_edited_objects( } } +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->editing_ism_enabled ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ && st_ivas->editing_ism_enabled ) +#endif { if ( st_ivas->hMasaIsmData->idx_separated_ism == st_ivas->index_of_edited_ism ) { diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index cea03fa185..a0ba899f0d 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -101,7 +101,11 @@ void ivas_mono_downmix_render_passive( { numInputChannels = st_ivas->nchan_transport; } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { numInputChannels = st_ivas->nchan_transport + 1; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 5ca00ff79e..35441360fe 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -40,7 +40,7 @@ #endif -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /*--------------------------------------------------------------------------* * ivas_set_surplus_brate_dec() * @@ -57,6 +57,11 @@ void ivas_set_surplus_brate_dec( *ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + *ism_total_brate = ivas_interformat_brate( st_ivas->ism_mode, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ); +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { *ism_total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp @@ -65,10 +70,15 @@ void ivas_set_surplus_brate_dec( 0 #endif ); +#endif st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - *ism_total_brate; +#ifdef OMASA_UPDATES + /* set 'st->total_brate'; there are no meta-data in ISM_MASA_MODE_PARAM_ONE_OBJ mode */ +#else /* set 'st->total_brate'; there are no meta-data in ISM_MASA_MODE_ONE_OBJ mode */ +#endif st_ivas->hSCE[0]->hCoreCoder[0]->total_brate = *ism_total_brate; st_ivas->hSCE[0]->hCoreCoder[0]->low_rate_mode = 0; @@ -79,14 +89,16 @@ void ivas_set_surplus_brate_dec( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifdef FIX_4OBJ_128 - int16_t brate_limit_flag = 0; - +#ifdef OMASA_UPDATES + int16_t brate_limit_flag, ism_imp[MAX_NUM_OBJECTS]; + for ( n = 0; n < st_ivas->nchan_ism; n++ ) { - brate_limit_flag += st_ivas->hIsmMetaData[n]->ism_imp; + ism_imp[n] = st_ivas->hIsmMetaData[n]->ism_imp; } - brate_limit_flag = brate_limit_flag >= 10 ? 1 : 0; + + brate_limit_flag = calculate_brate_limit_flag( ism_imp, st_ivas->nchan_ism ); + #endif ism_total_brate_ref = 0; @@ -106,7 +118,7 @@ void ivas_set_surplus_brate_dec( st_ivas->hSCE[n]->element_brate = element_brate[n]; *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp -#ifdef FIX_4OBJ_128 +#ifdef OMASA_UPDATES , brate_limit_flag #endif diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 944f185dd1..ab3131d3b3 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -3450,6 +3450,10 @@ void decode_masa_to_total( matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); mvr2r( dct_data_tmp, q_dct_data, nbands ); break; + case 12: + matrix_product( dct12, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nbands ); + break; case 20: matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ @@ -3459,6 +3463,7 @@ void decode_masa_to_total( matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); break; default: + printf( "Incorrect number of coefficients for OMASA.\n" ); break; } diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 810c7cca66..2072f25460 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -158,11 +158,19 @@ ivas_error ivas_sce_dec( ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) { #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { st->bits_frame_nominal = (int16_t) ( ( hSCE->element_brate / FRAMES_PER_SEC ) - ISM_NB_BITS_METADATA_NOMINAL ); } +#ifdef OMASA_UPDATES + else if ( ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#else else if ( ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) || ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif #else if ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) #endif @@ -193,19 +201,9 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->ivas_format != MASA_ISM_FORMAT ) /* note: total_brate[] is set in ivas_ism_config() or ivas_set_surplus_brate_dec() */ #else -#ifdef MASA_AND_OBJECTS - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) - { - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - /* one separated object */ - st->total_brate = hSCE->element_brate; - } - } -#endif else if ( st_ivas->ivas_format != ISM_FORMAT ) /* note: in ISMs, total_brate[] is set in ivas_ism_config() */ #endif { @@ -218,11 +216,15 @@ ivas_error ivas_sce_dec( /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) && +#else if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC #ifdef OMASA_BRATE || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ #endif ) && +#endif st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) #else if ( st_ivas->ivas_format == ISM_FORMAT && st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3f48468c42..4316c90677 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -933,7 +933,7 @@ typedef struct cpe_dec_data_structure float old_out_mdct[STEREO_MDCT2DFT_FADE_LEN_48k]; float old_outLB_mdct[2 * STEREO_MDCT2DFT_FADE_LEN_48k]; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int32_t brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ #endif @@ -1138,6 +1138,10 @@ typedef struct ivas_masa_ism_data_structure int16_t idx_separated_ism; int16_t azimuth_separated_ism; int16_t elevation_separated_ism; +#ifdef OMASA_UPDATES + float q_azimuth_old[MAX_NUM_OBJECTS]; + float q_elevation_old[MAX_NUM_OBJECTS]; +#endif float ismPreprocMatrix[2][2][CLDFB_NO_CHANNELS_MAX]; uint8_t objectsMoved; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 20d03915c2..20a7d58bc2 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -768,7 +768,7 @@ ivas_error stereo_memory_dec( if ( hCPE->hCoreCoder[0]->bfi == 0 ) { st = hCPE->hCoreCoder[1]; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate + hCPE->brate_surplus, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + ( hCPE->brate_surplus / FRAMES_PER_SEC ) - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS ); #else hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS ); diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 9809b759f8..31b66044c6 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -94,7 +94,7 @@ void tdm_configure_dec( int16_t tdm_tmp_SM_LRTD_flag; int16_t mod_ct, core, bits_offset; int16_t idx_LRTD_pri_side, tdm_inst_ratio_idx; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int32_t element_brate_adapt; int16_t bstr_last_pos; #endif @@ -102,7 +102,7 @@ void tdm_configure_dec( hStereoTD = hCPE->hStereoTD; sts = hCPE->hCoreCoder; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS element_brate_adapt = hCPE->element_brate + hCPE->brate_surplus; bstr_last_pos = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); #endif @@ -132,7 +132,7 @@ void tdm_configure_dec( /* Get few parameters needed to decode the bitrate allocated to each channel */ /* Get the coder_type of the secondary channel (last parameter on 2 bits) */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING ); #else sts[1]->coder_type = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING ), TDM_SECONDARY_SIGNALLING ); @@ -164,7 +164,7 @@ void tdm_configure_dec( *----------------------------------------------------------------*/ /* Get the correlation ratio */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS *tdm_ratio_idx = get_indice_st( sts[0], element_brate_adapt, (int16_t) ( bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS ); #else *tdm_ratio_idx = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS ); @@ -174,7 +174,7 @@ void tdm_configure_dec( if ( sts[1]->coder_type == INACTIVE ) { /* Get the flag on the LPC reusage type (primary channel of ave LPC */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS ); #else hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS ); @@ -184,7 +184,7 @@ void tdm_configure_dec( else { /* Get the flag on the LPC reusage */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS ); #else hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS ); @@ -244,7 +244,7 @@ void tdm_configure_dec( int16_t tmpS = 20; if ( hStereoTD->tdm_LRTD_flag == 0 ) { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS tmpS = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD ); #else tmpS = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD ); @@ -257,7 +257,7 @@ void tdm_configure_dec( { if ( hStereoTD->tdm_LRTD_flag == 0 ) { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hCPE->hStereoTCA->refChanIndx = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS, STEREO_BITS_TCA_CHAN ); hCPE->hStereoTCA->indx_ica_NCShift = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN, STEREO_BITS_TCA_CORRSTATS ); hCPE->hStereoTCA->indx_ica_gD = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD ); @@ -285,7 +285,7 @@ void tdm_configure_dec( #endif /* set the BW of the secondary channel */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel > IVAS_16k4 / FRAMES_PER_SEC ) #else if ( hStereoTD->tdm_LRTD_flag && hCPE->element_brate > IVAS_13k2 ) @@ -304,7 +304,7 @@ void tdm_configure_dec( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 0f6d709fc2..579f74c6d6 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -102,7 +102,7 @@ ivas_error ivas_core_enc( float tdm_lspQ_PCh[M], tdm_lsfQ_PCh[M]; int16_t last_element_mode, tdm_Pitch_reuse_flag; int32_t element_brate, last_element_brate, input_Fs; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int16_t diff_nBits; #endif ivas_error error; @@ -190,7 +190,7 @@ ivas_error ivas_core_enc( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /*------------------------------------------------------------------* * Sanity check in combined format coding *-----------------------------------------------------------------*/ @@ -420,7 +420,7 @@ ivas_error ivas_core_enc( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /*------------------------------------------------------------------* * Write potentially unused bits in combined format coding *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index cf69b1e333..e3b8342896 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -166,7 +166,18 @@ ivas_error ivas_cpe_enc( if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL ) { - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) + { + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); + } + else + { +#endif + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); +#ifdef OMASA_UPDATES + } +#endif } if ( ( error = front_vad( hCPE, NULL, hEncoderConfig, &hCPE->hFrontVad[0], st_ivas->hMCT != NULL, input_frame, vad_flag_dtx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies_LR, NULL, NULL ) ) != IVAS_ERR_OK ) @@ -274,7 +285,7 @@ ivas_error ivas_cpe_enc( { #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) - { + { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } else @@ -308,10 +319,14 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode == IVAS_CPE_MDCT ) { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* compute bit-rate surplus per channel in combined format coding */ int32_t brate_surplus[CPE_CHANNELS]; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { brate_surplus[0] = ( ( hCPE->brate_surplus / FRAMES_PER_SEC ) >> 1 ) * FRAMES_PER_SEC; brate_surplus[1] = hCPE->brate_surplus - brate_surplus[0]; @@ -336,9 +351,13 @@ ivas_error ivas_cpe_enc( sts[n]->bits_frame_channel = (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) / n_CoreChannels ); sts[n]->total_brate = hCPE->element_brate / n_CoreChannels; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { sts[n]->bits_frame_channel += (int16_t) ( brate_surplus[n] / FRAMES_PER_SEC ); sts[n]->total_brate += brate_surplus[n]; @@ -398,7 +417,7 @@ ivas_error ivas_cpe_enc( /* signal the bitrate for BW selection in the SCh */ sts[0]->bits_frame_channel = 0; sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); #endif if ( st_ivas->hQMetaData != NULL ) @@ -630,16 +649,7 @@ ivas_error ivas_cpe_enc( /* Write stereo bitstream */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_BRATE cpe_brate = st_ivas->hCPE[0]->element_brate; -#else - cpe_brate = ivas_total_brate; - - if ( ivas_format == MASA_ISM_FORMAT ) - { - cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, hEncoderConfig->nchan_ism ); - } -#endif /* DFT stereo side bits */ if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && cpe_brate < MASA_STEREO_MIN_BITRATE && sts[0]->core_brate != SID_2k40 && sts[0]->core_brate != FRAME_NO_DATA ) @@ -662,9 +672,7 @@ ivas_error ivas_cpe_enc( if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) { max_bits -= nb_bits_metadata; -#ifdef OMASA_BRATE max_bits += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC ); -#endif } stereo_dft_enc_res( hCPE->hStereoDft, old_inp_12k8[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, max_bits ); @@ -704,9 +712,13 @@ ivas_error ivas_cpe_enc( /* subtract metadata bitbudget */ sts[0]->total_brate -= ( nb_bits_metadata * FRAMES_PER_SEC ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { sts[0]->total_brate += hCPE->brate_surplus; } @@ -866,7 +878,7 @@ ivas_error create_cpe_enc( hCPE->hFrontVad[0] = NULL; hCPE->hFrontVad[1] = NULL; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hCPE->brate_surplus = 0; #endif diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 7b4685251f..afb4fc8ac7 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -404,8 +404,11 @@ void ivas_signaling_enc( /*-------------------------------------------------------------------------- * Write element mode info *--------------------------------------------------------------------------*/ - +#ifdef OMASA_UPDATES + if ( (st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ +#else if ( st->element_mode >= IVAS_CPE_DFT && element_brate < MIN_BRATE_MDCT_STEREO && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ +#endif { ind = st->element_mode - IVAS_CPE_DFT; push_indice( hBstr, IND_SMODE, ind, NBITS_ELEMENT_MODE ); diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index a3adbda9b6..de247c0a56 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -249,11 +249,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL -#ifdef REDUCE_OMASA_META_BITS - , - 0 -#endif + ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif ); } @@ -314,7 +310,6 @@ ivas_error ivas_enc( /* nb_bits_metadata[0] = 0; */ set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); -#ifdef OMASA_BRATE /* Configure MASA encoder based on frame parameters */ if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -325,12 +320,7 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Configure oMASA analysis based on MASA config */ - ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs -#ifdef OMASA_DIFFUSE_ISM_MERGE - , - st_ivas->ism_mode -#endif - ); + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); } /* Estimate TF-tile energy for the input MASA stream */ @@ -340,22 +330,31 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Estimate MASA parameters for the objects */ -#ifdef OMASA_DIFFUSE_ISM_MERGE ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); -#else - ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, data_separated_object, &idx_separated_object ); -#endif } /* Encode ISMs transport channels */ n = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { if ( ( error = ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) /* there are no metadata bits in SCE in this mode */ { return error; } } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Analysis, decision about bitrates per channel & core coding */ @@ -369,7 +368,7 @@ ivas_error ivas_enc( /* Encode MASA parameters and write MASA metadata bitstream */ ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa -#ifdef REDUCE_OMASA_META_BITS +#ifdef MASA_AND_OBJECTS , st_ivas->hIsmMetaData[0]->ism_imp #endif @@ -381,58 +380,7 @@ ivas_error ivas_enc( #else ivas_set_surplus_brate_enc( st_ivas ); #endif -#else - if ( st_ivas->hQMetaData != NULL ) - { - /* Configure MASA encoder based on frame parameters */ - ivas_masa_enc_config( st_ivas ); - idx_separated_object = 0; - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - /* Configure oMASA analysis based on MASA config */ - ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, -#ifdef OMASA_DIFFUSE_ISM_MERGE - , - st_ivas->ism_mode -#endif - ); - } - else - { - st_ivas->nSCE = hEncoderConfig->nchan_ism; - } - /* Estimate TF-tile energy for the input MASA stream */ - ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); - - /* put audio object data in SCE's */ - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - /* Estimate MASA parameters for the objects */ - ivas_omasa_enc( st_ivas->hOMasa, st_ivas->hQMetaData, st_ivas->hMasa, st_ivas->hIsmMetaData, data_f, input_frame, st_ivas->nchan_transport, hEncoderConfig->nchan_ism, st_ivas->ism_mode, - data_separated_object, &idx_separated_object ); - } - /* Encode MASA parameters and write MASA metadata bitstream */ - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa ); - } - - /* Encode transport signals */ - n = 0; - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ); /* there are no metadata bits in SCE in this mode */ - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - /* Analysis, decision about bitrates per channel & core coding */ - if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) - { - return error; - } - n = hEncoderConfig->nchan_ism; - } -#endif /* OMASA_BRATE */ /* Encode MASA transport channels */ if ( ( ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) @@ -497,11 +445,7 @@ ivas_error ivas_enc( ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL -#ifdef REDUCE_OMASA_META_BITS - , - 0 -#endif + ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif ); diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 7987431f48..1b6e2bd596 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -630,8 +630,11 @@ ivas_error ivas_init_encoder( return error; } } - - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) +#ifdef OMASA_UPDATES + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM) ) +#else + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) +#endif { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 5505976d05..13f804aba2 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -265,7 +265,7 @@ ivas_error ivas_ism_enc( } #endif ivas_ism_metadata_enc( -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS &st_ivas->hEncoderConfig->ivas_total_brate, #else st_ivas->hEncoderConfig->ivas_total_brate, @@ -274,7 +274,7 @@ ivas_error ivas_ism_enc( #ifdef MASA_AND_OBJECTS , st_ivas->nSCE -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS , -1 #endif @@ -284,11 +284,13 @@ ivas_error ivas_ism_enc( else /* ISM_MODE_DISC */ { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_BRATE int32_t ism_total_brate_ref; -#endif int32_t ism_total_brate; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { ism_total_brate = 0; for ( i = 0; i < st_ivas->nSCE; i++ ) @@ -301,7 +303,6 @@ ivas_error ivas_ism_enc( ism_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; } -#ifdef OMASA_BRATE ism_total_brate_ref = ism_total_brate; // VE: change the interface of the following function and call it with 'st_ivas' only @@ -311,9 +312,7 @@ ivas_error ivas_ism_enc( { st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - ism_total_brate; } -#else - ivas_ism_metadata_enc( ism_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->nSCE ); -#endif + #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); #endif @@ -348,7 +347,11 @@ ivas_error ivas_ism_enc( * CoreCoders encoding *-----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { n = st_ivas->nSCE; } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 43c498bcd0..97b689b5dd 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -146,7 +146,7 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int32_t *ism_total_brate, /* i/o: ISms total bitrate */ #else const int32_t ism_total_brate, /* i : ISms total bitrate */ @@ -161,12 +161,9 @@ ivas_error ivas_ism_metadata_enc( const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ #ifdef MASA_AND_OBJECTS , - const int16_t n_ism /* i : number of objects */ -#ifdef OMASA_BRATE - , + const int16_t n_ism, /* i : number of objects */ const float lp_noise_CPE #endif -#endif ) { int16_t i, ch, nb_bits_start = 0, diff; @@ -195,7 +192,11 @@ ivas_error ivas_ism_metadata_enc( num_obj = nchan_transport; } #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + else if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { num_obj = n_ism; } @@ -205,7 +206,11 @@ ivas_error ivas_ism_metadata_enc( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) ) +#endif #else if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) #endif @@ -222,8 +227,12 @@ ivas_error ivas_ism_metadata_enc( set_s( flag_abs_azimuth, 0, num_obj ); set_s( flag_abs_elevation, 0, num_obj ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { n_ch = num_obj; } @@ -232,7 +241,11 @@ ivas_error ivas_ism_metadata_enc( n_ch = nchan_transport; } +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { /*----------------------------------------------------------------* * Rate importance of particular ISm streams in combined format coding @@ -331,7 +344,11 @@ ivas_error ivas_ism_metadata_enc( /*Todo: Nokia check where we transmit the number of objects */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode != ISM_MASA_MODE_DISC ) +#endif { #endif /* write number of objects - unary coding */ @@ -351,8 +368,12 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_transport; ch++ ) #endif { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { /* ISM importance flag will be written in ivas_masa_encode() */ hIsmMeta[ch]->ism_imp = ism_imp[ch]; @@ -370,7 +391,11 @@ ivas_error ivas_ism_metadata_enc( ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -382,8 +407,12 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_transport; ch++ ) #endif { -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { /* reset */ hIsmMeta[ch]->ism_vad_flag = 1; @@ -393,8 +422,12 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* this flag distinguishes between coding of inactive frame and active frame w/o. metadata */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { /* VAD flag will be written in ivas_masa_encode() */ hIsmMeta[ch]->ism_vad_flag = localVAD[ch]; @@ -426,7 +459,11 @@ ivas_error ivas_ism_metadata_enc( { hIsmMetaData = hIsmMeta[ch]; #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -442,7 +479,11 @@ ivas_error ivas_ism_metadata_enc( /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -552,7 +593,11 @@ ivas_error ivas_ism_metadata_enc( /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -685,7 +730,11 @@ ivas_error ivas_ism_metadata_enc( /* save number of metadata bits written */ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) +#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -816,22 +865,22 @@ ivas_error ivas_ism_metadata_enc( } } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /*----------------------------------------------------------------* * Take into account the combined format bit-budget distribution *----------------------------------------------------------------*/ +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + +#else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; -#ifdef FIX_4OBJ_128 - int16_t brate_limit_flag = 0; - - for ( ch = 0; ch < num_obj; ch++ ) - { - brate_limit_flag += ism_imp[ch]; - } - brate_limit_flag = brate_limit_flag >= 10 ? 1 : 0; +#ifdef OMASA_UPDATES + int16_t brate_limit_flag; + brate_limit_flag = calculate_brate_limit_flag( ism_imp, num_obj ); #endif bits_ism = (int16_t) ( *ism_total_brate / FRAMES_PER_SECOND ); @@ -842,10 +891,14 @@ ivas_error ivas_ism_metadata_enc( *ism_total_brate = 0; for ( ch = 0; ch < num_obj; ch++ ) { +#ifdef OMASA_UPDATES + *ism_total_brate += ivas_interformat_brate( ism_mode, num_obj, hSCE[ch]->element_brate, ism_imp[ch],brate_limit_flag +#else *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, num_obj, hSCE[ch]->element_brate, ism_imp[ch] #ifdef FIX_4OBJ_128 , brate_limit_flag +#endif #endif ); } @@ -858,12 +911,23 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + ivas_ism_config( *ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, 1 ); // VE: this funtion should return an error + } + else + { + ivas_ism_config( *ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, 0 ); // VE: this funtion should return an error + } +#else #ifdef OMASA_BRATE ivas_ism_config( *ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, ism_mode == ISM_MASA_MODE_DISC ); // VE: this funtion should return an error #else ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, ( ism_mode == ISM_MASA_MODE_DISC ) ); #endif +#endif #else ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); #endif @@ -876,7 +940,6 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS for ( ch = 0; ch < n_ch; ch++ ) { -#ifdef OMASA_BRATE hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( ism_mode == ISM_MODE_DISC ) { @@ -887,7 +950,11 @@ ivas_error ivas_ism_metadata_enc( hSCE[ch]->element_brate = element_brate[ch]; } +#ifdef OMASA_UPDATES + else if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else else if ( ism_mode == ISM_MASA_MODE_DISC ) +#endif { if ( ism_imp[ch] == ISM_INACTIVE_IMP ) { @@ -896,19 +963,6 @@ ivas_error ivas_ism_metadata_enc( } hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) - { - hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) - { - hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; - } - } - - hSCE[ch]->element_brate = element_brate[ch]; - hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; -#endif /* write metadata only in active frames */ if ( hSCE[0]->hCoreCoder[0]->core_brate > SID_2k40 ) @@ -969,7 +1023,12 @@ ivas_error create_ism_metadata_enc( st_ivas->nCPE = 1; st_ivas->nSCE = 0; break; +#ifdef OMASA_UPDATES + case ISM_MASA_MODE_MASA_ONE_OBJ: + case ISM_MASA_MODE_PARAM_ONE_OBJ: +#else case ISM_MASA_MODE_ONE_OBJ: +#endif st_ivas->nCPE = 1; st_ivas->nSCE = 1; break; @@ -1034,9 +1093,13 @@ ivas_error create_ism_metadata_enc( st_ivas->hIsmMetaData[ch]->elevation_diff_cnt = ISM_FEC_MAX - 1; st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS st_ivas->hIsmMetaData[ch]->ism_imp = -1; st_ivas->hIsmMetaData[ch]->ism_vad_flag = 1; +#ifdef OMASA_UPDATES + st_ivas->hIsmMetaData[ch]->q_azimuth_old = 0.0f; + st_ivas->hIsmMetaData[ch]->q_elevation_old = 0.0f; +#endif #endif ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); @@ -1044,7 +1107,11 @@ ivas_error create_ism_metadata_enc( #ifdef MASA_AND_OBJECTS if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ); } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index f31badf9b3..07c313f002 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -45,11 +45,6 @@ *-----------------------------------------------------------------------*/ static void combine_freqbands_and_subframes( MASA_ENCODER_HANDLE hMasa ); -#ifdef MASA_AND_OBJECTS -#ifndef OMASA_DIFFUSE_ISM_MERGE -static void combine_directions( MASA_ENCODER_HANDLE hMasa ); -#endif -#endif static void find_n_largest( const float *input, int16_t *largestIndices, const int16_t numElements, const int16_t numLargest ); @@ -62,45 +57,25 @@ static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate ); #ifdef MASA_AND_OBJECTS -#ifndef OMASA_DIFFUSE_ISM_MERGE -static void ivas_merge_masa_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); -#endif - -static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks -#ifdef REDUCE_OMASA_META_BITS - , - const int16_t idx_separated_object, - const int16_t ism_imp -#endif -); +static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks, + const int16_t idx_separated_object, const int16_t ism_imp ); static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format, const ISM_MODE ism_mode ); -static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, const int16_t nchan_ism, const float masa_to_total_energy_ratio -#ifdef REDUCE_OMASA_META_BITS - , - const int16_t idx_sep_object -#endif -); +static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, const int16_t nchan_ism, const float masa_to_total_energy_ratio, const int16_t idx_sep_object ); static int16_t index_slice_enum( const int16_t *ratio_ism_idx, int16_t no_ism ); -static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio -#ifdef REDUCE_OMASA_META_BITS - , - const int16_t shift_one, - const int16_t idx_sep_obj -#endif -); +static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, const int16_t idx_sep_obj ); static void transform_index_and_GR_encode( int16_t *diff_idx, int16_t len, int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); static void transform_difference_index( int16_t *diff_idx, int16_t *idx, int16_t len ); -#ifdef REDUCE_OMASA_META_BITS + static void independent_coding_ratio_ism_idx( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const float *masa_to_total_energy_ratio, int16_t nchan_ism, int16_t numCodingBands, int16_t bits_index, BSTR_ENC_HANDLE hMetaData ); static void remove_sep_obj( int16_t *diff_idx, int16_t no_ism, int16_t idx_sep_obj ); -#endif + #else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif @@ -167,7 +142,11 @@ ivas_error ivas_masa_enc_open( } #ifdef MASA_AND_OBJECTS ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -205,7 +184,7 @@ ivas_error ivas_masa_enc_open( set_zero( hMasa->data.lfeToTotalEnergyRatio, MAX_PARAM_SPATIAL_SUBFRAMES ); hMasa->data.prevq_lfeToTotalEnergyRatio = 0.0f; hMasa->data.prevq_lfeIndex = 0; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS hMasa->data.lp_noise_CPE = -1; #endif @@ -274,11 +253,8 @@ void ivas_masa_encode( const int16_t nchan_ism, /* i : number of ISM channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ - OMASA_ENC_HANDLE hOMasa /* i : OMASA encoder handle */ -#ifdef REDUCE_OMASA_META_BITS - , - int16_t ism_imp /* i: importance of separated object */ -#endif + OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ + int16_t ism_imp /* i: importance of separated object */ #endif ) { @@ -339,16 +315,15 @@ void ivas_masa_encode( #endif { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE +#ifdef OMASA_UPDATES + if ( ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) || ( ivas_format != MASA_ISM_FORMAT ) ) +#else if ( ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) || ( ivas_format != MASA_ISM_FORMAT ) ) +#endif { /* Combine directions */ ivas_masa_combine_directions( hMasa ); } -#else - /* Combine directions */ - combine_directions( hMasa ); -#endif #else /* Combine directions */ combine_directions( hMasa ); @@ -384,19 +359,40 @@ void ivas_masa_encode( hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; /* write index of separated object if needed */ +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && hMasa->data.nchan_ism > 1 ) +#else if ( ism_mode == ISM_MASA_MODE_ONE_OBJ && hMasa->data.nchan_ism > 1 ) +#endif { push_next_indice( hMetaData, idx_separated_object, NO_BITS_MASA_ISM_NO_OBJ ); hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; } -#ifdef OMASA_BRATE /* write ISM importance flag (one per object) */ +#ifdef OMASA_UPDATES + if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif + { + push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; + } +#ifdef OMASA_UPDATES + else if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; + + if ( hIsmMetaData[0]->ism_metadata_flag == 0 ) + { + /* write VAD flag */ + push_next_indice( hMetaData, hIsmMetaData[0]->ism_vad_flag, ISM_METADATA_VAD_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_VAD_FLAG_BITS; + } } +#endif else if ( ism_mode == ISM_MASA_MODE_DISC ) { for ( i = 0; i < nchan_ism; i++ ) @@ -412,7 +408,6 @@ void ivas_masa_encode( } } } -#endif } else { @@ -444,25 +439,13 @@ void ivas_masa_encode( /* Move data from encoder to qmetadata */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) -#else - if ( ivas_format == MASA_FORMAT || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) ) -#endif #else if ( ivas_format == MASA_FORMAT ) #endif { move_metadata_to_qmetadata( hMasa, hQMetaData ); } -#ifdef MASA_AND_OBJECTS -#ifndef OMASA_DIFFUSE_ISM_MERGE - else if ( ivas_format == MASA_ISM_FORMAT ) - { - ivas_merge_masa_metadata( hMasa, hQMetaData ); - } -#endif -#endif if ( hMasa->config.max_metadata_bits < MINIMUM_BIT_BUDGET_NORMAL_META && !hMasa->config.joinedSubframes ) { @@ -479,19 +462,15 @@ void ivas_masa_encode( #ifdef MASA_AND_OBJECTS /* Encode MASA+ISM metadata */ +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#else if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { /* encode MASA/ISM energy ratios */ - ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes -#ifdef REDUCE_OMASA_META_BITS - , - idx_separated_object -#endif -#ifdef REDUCE_OMASA_META_BITS - , - ism_imp -#endif - ); + ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes, + idx_separated_object, ism_imp ); } else { @@ -502,7 +481,11 @@ void ivas_masa_encode( ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#else if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { /* Modify spatial metadata based on the MASA-to-total energy ratios */ modify_masa_energy_ratios( hQMetaData ); @@ -543,11 +526,7 @@ void ivas_masa_encode( { /* Combine directions */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE ivas_masa_combine_directions( hMasa ); -#else - combine_directions( hMasa ); -#endif #else combine_directions( hMasa ); #endif @@ -699,7 +678,11 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -738,7 +721,18 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); +#ifdef OMASA_UPDATES + if ( st_ivas->hCPE[0]->element_brate == IVAS_48k && st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) + { + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, IVAS_32k, st_ivas->nchan_transport, MC_MODE_NONE ); + } + else + { +#endif + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); +#ifdef OMASA_UPDATES + } +#endif } else { @@ -837,8 +831,12 @@ ivas_error ivas_masa_enc_config( #endif } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT ) { @@ -1086,13 +1084,9 @@ static void combine_freqbands_and_subframes( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE void ivas_masa_combine_directions( #else static void combine_directions( -#endif -#else -static void combine_directions( #endif MASA_ENCODER_HANDLE hMasa ) { @@ -1210,9 +1204,7 @@ static void combine_directions( ambience2dir = 1.0f - ratioSum; hMeta->directional_meta[0].energy_ratio[j][i] = sumVecLen[j][i] / ( hMeta->directional_meta[0].energy_ratio[j][i] + hMeta->directional_meta[1].energy_ratio[j][i] + ambience2dir / 2.0f ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE hMeta->directional_meta[1].energy_ratio[j][i] = 0.0f; -#endif /* OMASA_DIFFUSE_ISM_MERGE */ #endif /* MASA_AND_OBJECTS */ if ( computeCoherence ) { @@ -1590,7 +1582,11 @@ static void reduce_metadata_further( /* Get energy for the input data in 4-subframe, 5-band format */ totalEnergySum = 0.0f; #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) /* Energy data is in 4-subframe, 24-band format */ +#else if ( ivas_format == MASA_FORMAT || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) ) /* Energy data is in 4-subframe, 24-band format */ +#endif #else if ( ivas_format == MASA_FORMAT ) /* Energy data is in 4-subframe, 24-band format */ #endif @@ -1979,7 +1975,11 @@ void ivas_masa_enc_reconfigure( ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; #ifdef MASA_AND_OBJECTS ism_total_brate = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) +#endif { for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { @@ -2044,7 +2044,6 @@ void ivas_masa_enc_reconfigure( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_DIFFUSE_ISM_MERGE /*-------------------------------------------------------------------* * ivas_merge_masa_metadata() * @@ -2055,25 +2054,16 @@ void ivas_merge_masa_metadata( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */ OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */ ) -#else -static void ivas_merge_masa_metadata( - MASA_ENCODER_HANDLE hMasa, - IVAS_QMETADATA_HANDLE hQMeta ) -#endif /* OMASA_DIFFUSE_ISM_MERGE */ - { int16_t sf, band; uint8_t numCodingBands; uint8_t numDirections; uint8_t numSf; MASA_METADATA_HANDLE hMeta; -#ifdef OMASA_DIFFUSE_ISM_MERGE float energyTimesRatioISM; float energyTimesRatioMASA[2]; float total_diff_nrg; -#else - float energyTimesRatio1, energyTimesRatio2; -#endif /* OMASA_DIFFUSE_ISM_MERGE */ + int16_t brange[2]; float eneBand; @@ -2085,15 +2075,11 @@ static void ivas_merge_masa_metadata( numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4; hMeta = &( hMasa->masaMetadata ); -#ifndef OMASA_DIFFUSE_ISM_MERGE - assert( numDirections == 1 && "MASA metadata merging currently implemented only for 1-direction metadata" ); /* Currently only 1-direction metadata is fed to merging */ -#endif for ( sf = 0; sf < numSf; sf++ ) { for ( band = 0; band < numCodingBands; band++ ) { -#ifdef OMASA_DIFFUSE_ISM_MERGE int16_t merge_dest; float dir_sum; uint8_t band_n_dirs; @@ -2108,10 +2094,6 @@ static void ivas_merge_masa_metadata( { band_n_dirs = 2; } -#else - brange[0] = hMasa->data.band_mapping[band]; - brange[1] = hMasa->data.band_mapping[band + 1]; -#endif /* OMASA_DIFFUSE_ISM_MERGE */ /* Compute energies */ /* MASA energy is in the full 24 band resolution, whereas the ISM energy is already in the coding band resolution */ @@ -2123,7 +2105,6 @@ static void ivas_merge_masa_metadata( energyMerged[sf][band] = eneBand + hMasa->data.energy_ism[sf][band]; /* Compute weights */ -#ifdef OMASA_DIFFUSE_ISM_MERGE energyTimesRatioMASA[0] = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band]; if ( band_n_dirs == 2 ) { @@ -2182,26 +2163,6 @@ static void ivas_merge_masa_metadata( hMeta->directional_meta[1].energy_ratio[sf][band] *= direct_scaler; } } -#else /* OMASA_DIFFUSE_ISM_MERGE */ - energyTimesRatio1 = hMasa->data.energy_ism[sf][band] * hQMeta->q_direction[0].band_data[band].energy_ratio[sf]; - energyTimesRatio2 = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band]; - - /* Determine combined metadata based on the weights */ - if ( energyTimesRatio2 > energyTimesRatio1 ) - { - hQMeta->q_direction[0].band_data[band].azimuth[sf] = hMeta->directional_meta[0].azimuth[sf][band]; - hQMeta->q_direction[0].band_data[band].elevation[sf] = hMeta->directional_meta[0].elevation[sf][band]; - hQMeta->q_direction[0].band_data[band].energy_ratio[sf] = hMeta->directional_meta[0].energy_ratio[sf][band]; - if ( hQMeta->q_direction[0].coherence_band_data != NULL ) - { - hQMeta->q_direction[0].coherence_band_data[band].spread_coherence[sf] = (uint8_t) roundf( hMeta->directional_meta[0].spread_coherence[sf][band] * UINT8_MAX ); - } - if ( hQMeta->surcoh_band_data != NULL ) - { - hQMeta->surcoh_band_data[band].surround_coherence[sf] = (uint8_t) roundf( hMeta->common_meta.surround_coherence[sf][band] * UINT8_MAX ); - } - } -#endif /* OMASA_DIFFUSE_ISM_MERGE */ } } @@ -2221,17 +2182,13 @@ static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, const int16_t nchan_ism, - const float masa_to_total_energy_ratio -#ifdef REDUCE_OMASA_META_BITS - , + const float masa_to_total_energy_ratio, const int16_t idx_sep_object -#endif ) { int16_t i, j, best_i, best_i2; float dist, div, tmp, dist2, best_dist; int16_t part_idx_sum, max_sum_idx; -#ifdef REDUCE_OMASA_META_BITS float ratio_ism_loc[MAX_NUM_OBJECTS]; int16_t no_ism_loc; @@ -2350,85 +2307,7 @@ static void quantize_ratio_ism_vector( { idx[0] = (int16_t) ( ( ratio_ism[0] ) * ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) + 0.5f ); } -#else - max_sum_idx = ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1; - if ( no_ism > 1 ) - { - - if ( masa_to_total_energy_ratio >= MASA2TOTAL_THR ) - { - distribute_evenly_ism( idx, max_sum_idx, no_ism ); - } - else - { - dist = 0.0f; - div = 1.0f / (float) ( max_sum_idx ); - - part_idx_sum = 0; - for ( i = 0; i < no_ism; i++ ) - { - idx[i] = (int16_t) ( ( ratio_ism[i] ) * ( max_sum_idx ) ); - part_idx_sum += idx[i]; - - tmp = ( ratio_ism[i] - ( idx[i] * div ) ); - dist += ( tmp * tmp ); - } - best_dist = dist; - best_i2 = -1; - while ( part_idx_sum < max_sum_idx ) - { - best_i = -1; - /* check which index to increase by 1 for a possible improvement */ - - for ( i = 0; i < no_ism; i++ ) - { - idx[i]++; - dist2 = 0.0f; - - - for ( j = 0; j < no_ism; j++ ) - { - tmp = ( ratio_ism[i] - ( idx[i] * div ) ); - dist2 += ( tmp * tmp ); - } - - if ( dist2 < best_dist ) - { - best_i2 = best_i; - best_i = i; - best_dist = dist2; - } - idx[i]--; - } - if ( best_i > -1 ) - { - idx[best_i]++; - part_idx_sum++; - } - else - { - if ( best_i2 > -1 ) - { - idx[best_i2]++; - part_idx_sum++; - } - else - { - idx[no_ism - 1] += max_sum_idx - part_idx_sum; - part_idx_sum = max_sum_idx; - } - } - } - assert( sum_s( idx, no_ism ) == max_sum_idx ); - } - } - else - { - idx[0] = (int16_t) ( ( ratio_ism[0] ) * ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ) + 0.5f ); - } - -#endif return; } @@ -2528,7 +2407,7 @@ static int16_t try_differential( b_signif = 0; - while ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR && b_signif < numCodingBands ) + while ( (b_signif < numCodingBands) && (masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR) ) { b_signif++; } @@ -2590,7 +2469,7 @@ static void differential_coding_first_subframe( } } } -#ifdef REDUCE_OMASA_META_BITS + static void independent_coding_ratio_ism_idx( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i: ISM ratios */ const float *masa_to_total_energy_ratio, /* i: MASA to total ratios */ @@ -2777,7 +2656,7 @@ static int16_t encode_ratio_ism_subframe( nbits0 = 0; nbits1 = 0; b_signif = 0; - while ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR && b_signif < numCodingBands ) + while ( (b_signif < numCodingBands) && (masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR) ) { b_signif++; } @@ -2899,7 +2778,7 @@ static int16_t encode_ratio_ism_subframe( remove_sep_obj( diff_idx, nchan_ism, idx_sep_obj_local ); } - transform_index_and_GR_encode( diff_idx, nchan_ism - 1, GR_order, hMetaData ); + transform_index_and_GR_encode( diff_idx, nchan_ism - 1 - shift_one, GR_order, hMetaData ); } } } @@ -2914,221 +2793,7 @@ static int16_t encode_ratio_ism_subframe( } -#else -static int16_t encode_ratio_ism_subframe( - int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], - int16_t no_ism, - int16_t numCodingBands, - int16_t sf, - int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], - BSTR_ENC_HANDLE hMetaData, - const float *masa_to_total_energy_ratio ) -{ - int16_t b, i, b_signif; - int16_t diff_idx[MAX_NUM_OBJECTS], index; - int16_t nbits, nbits0, nbits1, GR_order, GR_order_sb, bits_pos0; - int16_t differential_subframe; - - nbits = 0; - nbits0 = 0; - nbits1 = 0; - - bits_pos0 = hMetaData->nb_bits_tot; - differential_subframe = 1; /* the differences are taken with respect to previous subframe */ - if ( sf == 0 ) /* first subframe */ - { - if ( no_ism == 2 ) - { - - for ( b = 0; b < numCodingBands; b++ ) - { - if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) - { - index = index_slice_enum( ratio_ism_idx[b], no_ism ); - - push_next_indice( hMetaData, index, 3 ); - nbits += 3; - } - } - } - else if ( no_ism == 3 ) - { - for ( b = 0; b < numCodingBands; b++ ) - { - if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) - { - index = index_slice_enum( ratio_ism_idx[b], no_ism ); - /* there are 36 indices and part of them use 5 bits; 31 is special code to - signal that there are indices larger than 31, represented on extra 3 bits */ - if ( index < 31 ) - { - push_next_indice( hMetaData, index, 5 ); - nbits += 5; - } - else - { - push_next_indice( hMetaData, 31, 5 ); - nbits += 5; - - push_next_indice( hMetaData, index - 31, 3 ); - nbits += 3; - } - } - } - } - else - { - if ( no_ism == 4 ) - { - for ( b = 0; b < numCodingBands; b++ ) - { - if ( masa_to_total_energy_ratio[b] < MASA2TOTAL_THR ) - { - index = index_slice_enum( ratio_ism_idx[b], no_ism ); - push_next_indice( hMetaData, index, 7 ); - nbits += 7; - } - } - } - } -#ifdef DEBUGGING - assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); -#endif - } - else - { - nbits0 = 0; - nbits1 = 0; - for ( b = 0; b < numCodingBands; b++ ) - { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); - transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); - /* GR encoding estimate length */ - for ( i = 0; i < no_ism - 1; i++ ) - { - nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); - nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); - } - } - if ( nbits0 < nbits1 ) - { - GR_order = 0; - nbits = nbits0; - } - else - { - GR_order = 1; - nbits = nbits1; - } - if ( numCodingBands > 1 ) - { - /* try the difference from subband to subband; first subband is compared to previous subframe first subband*/ - /* take difference with respect to previous subframe only for first subband */ - nbits0 = 0; - nbits1 = 0; - - v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); - /* transform difference index into positive */ - transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); - /* GR encoding */ - for ( i = 0; i < no_ism - 1; i++ ) - { - nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); - nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); - } - - - for ( b = 1; b < numCodingBands; b++ ) - { - - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); - /* transform difference index into positive */ - transform_difference_index( diff_idx, diff_idx, no_ism - 1 ); - /* GR encoding */ - - for ( i = 0; i < no_ism - 1; i++ ) - { - nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); - nbits1 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 1 ); - } - } - - if ( nbits0 < nbits1 ) - { - GR_order_sb = 0; - } - else - { - GR_order_sb = 1; - nbits0 = nbits1; - } - - if ( nbits0 < nbits ) - { - differential_subframe = 0; - nbits = nbits0; - GR_order = GR_order_sb; - } - - nbits++; /* for GR_order */ - nbits++; /* for the prediction type */ - - /* write prediction type */ - push_next_indice( hMetaData, differential_subframe, 1 ); - /* write GR order */ - push_next_indice( hMetaData, GR_order, 1 ); - /* write data */ - if ( differential_subframe ) - { - for ( b = 0; b < numCodingBands; b++ ) - { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); - transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - } - } - else - { - v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, no_ism ); - transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - - for ( b = 1; b < numCodingBands; b++ ) - { - /* take difference with respect to previous subband */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx[b - 1], diff_idx, no_ism ); - transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - } - } - } - else - { - /* only differential wrt previous subframe is possible */ - /* write the differential to subframe case and no bit to signal the difference type */ - - /* write GR order */ - push_next_indice( hMetaData, GR_order, 1 ); - nbits++; /* for GR_order */ - /* write data */ - - for ( b = 0; b < numCodingBands; b++ ) - { - /* take difference with respect to previous subframe */ - v_sub_s( ratio_ism_idx[b], ratio_ism_idx_prev_sf[b], diff_idx, no_ism ); - transform_index_and_GR_encode( diff_idx, no_ism - 1, GR_order, hMetaData ); - } - } - -#ifdef DEBUGGING - assert( nbits == ( hMetaData->nb_bits_tot - bits_pos0 ) ); -#endif - } - - return nbits; -} -#endif static void ivas_encode_masaism_metadata( @@ -3138,12 +2803,9 @@ static void ivas_encode_masaism_metadata( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t low_bitrate_mode, /* i : is low bitrate more? 1/0 */ const int16_t omasa_nbands, - const int16_t omasa_nblocks -#ifdef REDUCE_OMASA_META_BITS - , + const int16_t omasa_nblocks, const int16_t idx_separated_object, const int16_t ism_imp -#endif ) { int16_t sf, band; @@ -3153,9 +2815,6 @@ static void ivas_encode_masaism_metadata( float eneBand; int16_t bin; int16_t obj; -#ifndef REDUCE_OMASA_META_BITS - float priority[MAX_NUM_OBJECTS]; -#endif int16_t bits_ism[MAX_NUM_OBJECTS]; uint16_t idx_sph; float theta_q, phi_q; @@ -3165,10 +2824,9 @@ static void ivas_encode_masaism_metadata( float step; int16_t inv_step; float energy_ism, energy_ism_ind[MAX_NUM_OBJECTS]; -#ifdef REDUCE_OMASA_META_BITS int16_t tmp, rotate; int16_t n_ism_tmp, i; -#endif + /* use the values from hQMetaData */ numCodingBands = (uint8_t) hQMetaData->q_direction->cfg.nbands; @@ -3295,10 +2953,10 @@ static void ivas_encode_masaism_metadata( { inv_step = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); step = 1.0f / inv_step; -#ifdef REDUCE_OMASA_META_BITS + rotate = 0; n_ism_tmp = 0; -#endif + for ( sf = 0; sf < numSf; sf++ ) { for ( band = 0; band < numCodingBands; band++ ) @@ -3308,8 +2966,7 @@ static void ivas_encode_masaism_metadata( assert( ( hMasa->data.energy_ratio_ism[sf][band][obj] >= 0 ) && ( hMasa->data.energy_ratio_ism[sf][band][obj] <= 1 ) ); ratio_ism[band][obj] = hMasa->data.energy_ratio_ism[sf][band][obj]; } - /* Quantize power ratios */ -#ifdef REDUCE_OMASA_META_BITS + /* Quantize ISM ratios */ quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band], idx_separated_object ); if ( n_ism_tmp == numCodingBands && ratio_ism_idx[band][idx_separated_object] != 0 && hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) { @@ -3328,15 +2985,12 @@ static void ivas_encode_masaism_metadata( } } } -#else - quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band] ); -#endif + /* reconstructed values */ reconstruct_ism_ratios( ratio_ism_idx[band], hMasa->data.nchan_ism, step, hMasa->data.q_energy_ratio_ism[sf][band] ); /* encode vector */ } -#ifdef REDUCE_OMASA_META_BITS if ( ( hMasa->data.nchan_ism > 2 ) && ( idx_separated_object == hMasa->data.nchan_ism - 1 ) ) { /* rotate components */ @@ -3376,10 +3030,8 @@ static void ivas_encode_masaism_metadata( } } } -#endif - /* encode data for current subframe */ -#ifdef REDUCE_OMASA_META_BITS + /* encode data for current subframe */ if ( sf > 0 && n_ism_tmp == numCodingBands ) { encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 1, idx_separated_object ); @@ -3388,9 +3040,7 @@ static void ivas_encode_masaism_metadata( { encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 0, idx_separated_object ); } -#else - encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf] ); -#endif + /* calculate quantized ISM ratios */ /* save previous subframe indexes */ @@ -3398,7 +3048,7 @@ static void ivas_encode_masaism_metadata( { mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], hMasa->data.nchan_ism ); } -#ifdef REDUCE_OMASA_META_BITS + if ( rotate ) { for ( band = 0; band < numCodingBands; band++ ) @@ -3411,44 +3061,48 @@ static void ivas_encode_masaism_metadata( } } } -#endif - } -#ifndef REDUCE_OMASA_META_BITS - set_f( priority, 0.0f, hMasa->data.nchan_ism ); - for ( sf = 0; sf < numSf; sf++ ) - { - for ( band = 0; band < numCodingBands; band++ ) - { - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) - { - priority[obj] = max( priority[obj], ( hMasa->data.q_energy_ratio_ism[sf][band][obj] * hQMetaData->masa_to_total_energy_ratio[sf][band] ) ); - } - } + } -#endif } -#ifndef REDUCE_OMASA_META_BITS - else - { - priority[0] = 1; - } -#endif -#ifdef REDUCE_OMASA_META_BITS + + calculate_nbits_meta( hMasa->data.nchan_ism, hMasa->data.q_energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); -#else - /* decide parameters for ISM metadata quantization */ - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) - { - bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - priority[obj] ) * 7 ); - } -#endif + /* quantize directions */ for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) - { + { +#ifdef OMASA_UPDATES + if ( bits_ism[obj] < 8 ) + { + /* check is same as previous */ + if ( ( fabs( hIsmMeta[obj]->elevation - hIsmMeta[obj]->q_elevation_old ) < 0.01f ) && ( fabs( hIsmMeta[obj]->azimuth - hIsmMeta[obj]->q_azimuth_old ) < 0.01f ) ) + { + push_next_indice( hMetaData, 1, 1 ); + /* the old stays the same */ + } + else + { + push_next_indice( hMetaData, 0, 1 ); + idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); + push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); + hIsmMeta[obj]->q_elevation_old = hIsmMeta[obj]->elevation; + hIsmMeta[obj]->q_azimuth_old = hIsmMeta[obj]->azimuth; + } + } + else + { + idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); + push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); + hIsmMeta[obj]->q_elevation_old = hIsmMeta[obj]->elevation; + hIsmMeta[obj]->q_azimuth_old = hIsmMeta[obj]->azimuth; + } + +#else idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); +#endif } return; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index e9ccefe357..935ea5e342 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -51,11 +51,7 @@ *------------------------------------------------------------------------*/ static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], -#ifdef OMASA_DIFFUSE_ISM_MERGE - float diffuseness_m[MASA_FREQUENCY_BANDS], -#endif - const int16_t input_frame, - const int16_t nchan_inp ); + float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); @@ -131,13 +127,8 @@ ivas_error ivas_omasa_enc_open( for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { -#ifdef OMASA_DIFFUSE_ISM_MERGE hOMasa->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); set_zero( hOMasa->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); -#else - hOMasa->direction_vector_m[i][j] = (float *) malloc( MAXIMUM_OMASA_FREQ_BANDS * sizeof( float ) ); - set_zero( hOMasa->direction_vector_m[i][j], MAXIMUM_OMASA_FREQ_BANDS ); -#endif } } @@ -145,13 +136,8 @@ ivas_error ivas_omasa_enc_open( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { -#ifdef OMASA_DIFFUSE_ISM_MERGE hOMasa->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); set_zero( hOMasa->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); -#else - hOMasa->buffer_intensity_real[i][j] = (float *) malloc( MAXIMUM_OMASA_FREQ_BANDS * sizeof( float ) ); - set_zero( hOMasa->buffer_intensity_real[i][j], MAXIMUM_OMASA_FREQ_BANDS ); -#endif } } @@ -240,17 +226,18 @@ void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs /* i : Input sample rate */ -#ifdef OMASA_DIFFUSE_ISM_MERGE , ISM_MODE ismMode /* i : ISM mode */ -#endif ) { uint8_t i, maxBin; /* Determine the number of bands */ -#ifdef OMASA_DIFFUSE_ISM_MERGE +#ifdef OMASA_UPDATES + if ( ismMode == ISM_MODE_NONE || ismMode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( ismMode == ISM_MODE_NONE ) +#endif { /* use full resolution for the ISM+MASA merge and reduce later */ hOMasa->nbands = 24; @@ -259,9 +246,7 @@ void ivas_omasa_set_config( { hOMasa->nbands = hMasa->config.numCodingBands; } -#else - hOMasa->nbands = hMasa->config.numCodingBands; -#endif + hOMasa->nCodingBands = hMasa->config.numCodingBands; /* Determine the number of subframes */ @@ -310,9 +295,6 @@ void ivas_omasa_set_config( void ivas_omasa_enc( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ -#ifndef OMASA_DIFFUSE_ISM_MERGE - IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ -#endif MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -327,6 +309,11 @@ void ivas_omasa_enc( int16_t i, j; float data_out_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; + +#ifdef OMASA_UPDATES + /* Determine separated object (when applicable) */ + if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else /* Analysis */ if ( ism_mode == ISM_MODE_NONE ) { @@ -455,6 +442,7 @@ void ivas_omasa_enc( ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); } else +#endif { float broadband_energy[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; int16_t loudest_object; @@ -569,11 +557,90 @@ void ivas_omasa_enc( { set_zero( data_in_f[selected_object], input_frame ); } +#ifdef OMASA_UPDATES + } + + /* Analysis */ + if ( ism_mode == ISM_MODE_NONE || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + OMASA_SPATIAL_META OMasaMeta; /* working memory for the ISM-object MASA-parameters */ + OMASA_SPATIAL_META_HANDLE hOMasaMeta; + uint8_t n_bands_orig, n_subframes_orig; + uint8_t numCodingBands_orig, joinedSubframes_orig; + + hOMasaMeta = &OMasaMeta; + hOMasaMeta->num_dirs = 1; /* TODO: hard-coding for now */ + + /* merge MASA directions before adding ISM to the mixture */ + if ( hMasa->config.numberOfDirections == 2 ) + { + n_bands_orig = hMasa->config.numCodingBands; + hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; + + ivas_masa_combine_directions( hMasa ); + + hMasa->config.numCodingBands = (int8_t)n_bands_orig; + } + + /* force computation into high resolution */ + n_bands_orig = hOMasa->nbands; + n_subframes_orig = hOMasa->nSubframes; + + hOMasa->nbands = MASA_FREQUENCY_BANDS; + hOMasa->nSubframes = MAX_PARAM_SPATIAL_SUBFRAMES; + + /* Estimate MASA parameters from the objects */ + /* NB: only first direction is populated */ + /* NB2: in energy_ratios and surround_coherence only first sub-frame contains valid data */ + ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, hOMasaMeta->directional_meta[0].elevation, hOMasaMeta->directional_meta[0].azimuth, hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].spread_coherence, hOMasaMeta->common_meta.surround_coherence[0], + hOMasaMeta->common_meta.diffuse_to_total_ratio[0], input_frame, nchan_ism ); + + /* copy energy_ratios and surrCoh from first sub-frame to the remaining ones */ + for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + mvr2r( hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].energy_ratio[i], MASA_FREQUENCY_BANDS ); + mvr2r( hOMasaMeta->common_meta.surround_coherence[0], hOMasaMeta->common_meta.surround_coherence[i], MASA_FREQUENCY_BANDS ); + mvr2r( hOMasaMeta->common_meta.diffuse_to_total_ratio[0], hOMasaMeta->common_meta.diffuse_to_total_ratio[i], MASA_FREQUENCY_BANDS ); + } + + /* restore resolution parameters */ + hOMasa->nbands = n_bands_orig; + hOMasa->nSubframes = n_subframes_orig; + + /* perform MASA+ISM merge in full resolution */ + numCodingBands_orig = hMasa->config.numCodingBands; + joinedSubframes_orig = hMasa->config.joinedSubframes; + + hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; + hMasa->config.joinedSubframes = 0; + + ivas_merge_masa_metadata( hMasa, hOMasaMeta ); /* => merge result in hMasa->masaMetadata */ + + hMasa->config.numCodingBands = numCodingBands_orig; + hMasa->config.joinedSubframes = joinedSubframes_orig; + + } + else if ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + if ( ism_mode == ISM_MASA_MODE_PARAM ) + { + *idx_separated_object = -1; + } +#endif /* Estimate energies and ratios */ ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); } +#ifdef OMASA_UPDATES + /* Move the ISM metadata to the first entry for encoding in the MASA_ONE_OBJ mode */ + if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + hIsmMeta[0]->azimuth = hIsmMeta[*idx_separated_object]->azimuth; + hIsmMeta[0]->elevation = hIsmMeta[*idx_separated_object]->elevation; + } +#endif + /* Downmix */ ivas_omasa_dmx( data_in_f, data_out_f, input_frame, nchan_transport, nchan_ism, hIsmMeta, hOMasa->prev_object_dm_gains, hOMasa->interpolator ); @@ -584,7 +651,6 @@ void ivas_omasa_enc( } -#ifdef OMASA_BRATE /*-------------------------------------------------------------------------* * set_ism_importance_interformat() * @@ -665,6 +731,11 @@ void ivas_set_surplus_brate_enc( #endif ) { +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_PARAM_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ); +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp @@ -673,9 +744,14 @@ void ivas_set_surplus_brate_enc( 0 #endif ); +#endif /* note: ISM st->total_brate is iset in ivas_sce_enc() */ } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) +#else else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) +#endif { /* it is already set in ivas_ism_enc() */ } @@ -689,7 +765,12 @@ void ivas_set_surplus_brate_enc( { int16_t input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); float tmpF = 0; +#ifdef OMAOMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) +#endif { tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); } @@ -711,7 +792,6 @@ void ivas_set_surplus_brate_enc( return; } -#endif /*--------------------------------------------------------------------------* @@ -729,9 +809,7 @@ static void ivas_omasa_param_est_enc( float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], -#ifdef OMASA_DIFFUSE_ISM_MERGE float diffuseness_m[MASA_FREQUENCY_BANDS], -#endif const int16_t input_frame, const int16_t nchan_ism ) { @@ -747,9 +825,6 @@ static void ivas_omasa_param_est_enc( float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float diffuseness_vector[MASA_FREQUENCY_BANDS]; -#ifndef OMASA_DIFFUSE_ISM_MERGE - float diffuseness_m[MASA_FREQUENCY_BANDS]; -#endif int16_t band_m_idx, block_m_idx; float renormalization_factor_diff[MASA_FREQUENCY_BANDS]; diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index b64eb4adbf..b6d2b86382 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -5263,6 +5263,10 @@ void encode_masa_to_total( n_streams = 1; len_stream = nbands; break; + case 12: + matrix_product( dct12, nbands, nbands, 0, data, 1, nbands, 1, dct_data ); + n_streams = 1; + len_stream = nbands; break; case 20: matrix_product( dct5, nbands, nbands, 0, data, nblocks, nbands, 1, dct_data_tmp ); @@ -5277,6 +5281,7 @@ void encode_masa_to_total( len_stream = nbands; break; default: + printf( "Incorrect number of coefficients for OMASA.\n" ); break; } @@ -5352,6 +5357,10 @@ void encode_masa_to_total( matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); mvr2r( dct_data_tmp, q_dct_data, nbands ); break; + case 12: + matrix_product( dct12, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); + mvr2r( dct_data_tmp, q_dct_data, nbands ); + break; case 20: matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ @@ -5361,6 +5370,7 @@ void encode_masa_to_total( matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); break; default: + printf( "Incorrect number of coefficients for OMASA.\n" ); break; } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index dde49fb9cd..769e5fe970 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -144,7 +144,11 @@ ivas_error ivas_sce_enc( if ( st_ivas->hQMetaData != NULL && st_ivas->hSpar == NULL ) { #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( ( ( st_ivas->mc_mode == MC_MODE_MCMASA ) && ( st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) ) || ( st_ivas->ism_mode >= ISM_MASA_MODE_MASA_ONE_OBJ ) ) +#else if ( ( ( st_ivas->mc_mode == MC_MODE_MCMASA ) && ( st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) ) || ( st_ivas->ism_mode >= ISM_MASA_MODE_ONE_OBJ ) ) +#endif #else if ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) #endif @@ -220,11 +224,19 @@ ivas_error ivas_sce_enc( reset_metadata_spatial( ivas_format, hSCE->hMetaData, hSCE->element_brate, &st->total_brate, st->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS /*----------------------------------------------------------------* * Combined format coding: get the ISM importance and the bit-rate *----------------------------------------------------------------*/ +#ifdef OMASA_UPDATES + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); + + st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_PARAM_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ) - nb_bits_metadata * FRAMES_PER_SEC; + } +#else if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); @@ -237,6 +249,7 @@ ivas_error ivas_sce_enc( ) - nb_bits_metadata * FRAMES_PER_SEC; } +#endif #endif /*----------------------------------------------------------------* @@ -257,8 +270,12 @@ ivas_error ivas_sce_enc( { st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st->low_rate_mode ) +#else else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ && st->low_rate_mode ) +#endif { st->flag_ACELP16k = 0; } @@ -370,7 +387,11 @@ ivas_error create_sce_enc( copy_encoder_config( st_ivas, st, 1 ); #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { st->element_mode = IVAS_SCE; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index c1df19f243..ad7cee3ce1 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -746,9 +746,7 @@ typedef struct ivas_masa_encoder_data_struct float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t nchan_ism; -#ifdef OMASA_BRATE float lp_noise_CPE; /* LP filterend total noise estimation */ -#endif #endif int16_t num_Cldfb_instances; @@ -948,7 +946,7 @@ typedef struct cpe_enc_data_structure float *input_mem[CPE_CHANNELS]; /* input channels buffers memory; needed to be up-to-date for TD->DFT stereo switching */ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS int32_t brate_surplus; /* bitrate surplus for bitrate adaptation in combined format coding */ #endif #ifdef DEBUGGING diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index d4d0b310b6..b2e3373404 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -118,8 +118,11 @@ int16_t select_stereo_mode( { stereo_switching_flag = 0; } - +#ifdef OMASA_UPDATES + if ( hCPE->element_brate >= MIN_BRATE_MDCT_STEREO && !( hCPE->element_brate == IVAS_48k && ivas_total_brate == IVAS_32k ) ) /* the second condition for PARAM mode OMASA */ +#else if ( hCPE->element_brate >= MIN_BRATE_MDCT_STEREO ) +#endif { hStereoClassif->prev_lrtd_mode = 0; hStereoClassif->lrtd_mode = 0; diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 5ccacf4807..e0d5db28a6 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -445,7 +445,7 @@ void stereo_mdct_core_enc( sts[ch]->total_brate = ( sts[ch]->bits_frame_channel + sts[ch]->side_bits_frame_channel ) * FRAMES_PER_SEC; } stereo_bits += SMDCT_NBBITS_SPLIT_RATIO; -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS assert( ( sts[0]->total_brate + sts[1]->total_brate + ( stereo_bits + signal_bits + meta_bits ) * FRAMES_PER_SEC ) == hCPE->element_brate + hCPE->brate_surplus ); #else assert( ( sts[0]->total_brate + sts[1]->total_brate + ( stereo_bits + signal_bits + meta_bits ) * FRAMES_PER_SEC ) == hCPE->element_brate ); diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index c819c887c5..2105b351b3 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -419,7 +419,7 @@ void tdm_configure_enc( sts[1]->coder_type = GENERIC; } -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) { sts[1]->coder_type = INACTIVE; @@ -469,7 +469,7 @@ void tdm_configure_enc( * bitbudget distribution between channels (taking into account also metadata bitbudget) *----------------------------------------------------------------*/ -#ifdef OMASA_BRATE +#ifdef MASA_AND_OBJECTS tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 72ac9311c5..db6bf0293e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -448,6 +448,12 @@ static void ivas_dirac_dec_binaural_internal( /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + { + numInChannels++; + } +#else if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) { if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -459,6 +465,7 @@ static void ivas_dirac_dec_binaural_internal( numInChannels++; } } +#endif #else if ( st_ivas->hOutSetup.separateChannelEnabled ) { @@ -583,7 +590,11 @@ static void ivas_dirac_dec_binaural_internal( } #ifdef MASA_AND_OBJECTS +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) +#endif { preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_in, @@ -1174,14 +1185,20 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( #ifdef MASA_AND_OBJECTS separateCenterChannelRendering = 0; nchanSeparateChannels = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) +#else if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) +#endif { separateCenterChannelRendering = 1; nchanSeparateChannels = 1; +#ifndef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; } +#endif } #else separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; @@ -1325,11 +1342,27 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( #ifdef MASA_AND_OBJECTS uint8_t instantChange = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + gainFactor = 0.7943f * sqrtf( h->earlyPartEneCorrection[bin] ); /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ + } + else + { + gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); + } +#else gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); +#endif for ( chB = 0; chB < nchanSeparateChannels; chB++ ) { if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifdef OMASA_UPDATES + aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism; + eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; + instantChange = 1; +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB]; @@ -1341,6 +1374,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; instantChange = 1; } +#endif } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index b60967e7f7..5a2b0e3454 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -182,7 +182,15 @@ ivas_error ivas_td_binaural_open_unwrap( } *hBinRendererTd = pBinRendTd; + +#ifdef OMASA_UPDATES + if ( ivas_format != MASA_ISM_FORMAT ) + { + *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); + } +#else *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); +#endif return error; } @@ -440,7 +448,11 @@ void TDREND_Update_object_positions( c_indx++; } +#ifdef OMASA_UPDATES + if ( in_format == ISM_FORMAT || in_format == MASA_ISM_FORMAT ) +#else if ( in_format == ISM_FORMAT ) +#endif { /* Update the source positions */ -- GitLab From 69090cd6c7d06e7e6ed200797e1477fb2e653eda Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 28 Mar 2023 16:31:49 +0200 Subject: [PATCH 065/591] - simplifications in ivas_dec() - add error returns --- lib_dec/ivas_dec.c | 91 ++++++++++++++++++++++++++--------------- lib_dec/ivas_init_dec.c | 15 +++++-- lib_enc/ivas_ism_enc.c | 24 ++++++----- 3 files changed, 84 insertions(+), 46 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 871e454605..c53b8b68a9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -451,7 +451,7 @@ ivas_error ivas_dec( } } - /* MASA decoding */ + /* MASA metadata decoding */ if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; @@ -462,7 +462,25 @@ ivas_error ivas_dec( st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); - /* Audio signal decoding */ +#ifdef OMASA_UPDATES + /* set ISM parameters */ + int16_t nchan_ism, nchan_transport_ism; + nchan_ism = st_ivas->nchan_ism; + nchan_transport_ism = st_ivas->nchan_ism; + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + nchan_ism = 1; + nchan_transport_ism = 1; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + nchan_ism = 0; + nchan_transport_ism = 1; + } +#endif + + /* decode ISM metadata */ +#ifndef OMASA_UPDATES #ifdef OMASA_UPDATES if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) #else @@ -471,10 +489,7 @@ ivas_error ivas_dec( { if ( st_ivas->nSCE == 1 ) { - if ( ( error = ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); } else { @@ -484,24 +499,19 @@ ivas_error ivas_dec( } } else - { -#ifdef OMASA_UPDATES - int16_t nchan_ism = st_ivas->nchan_ism; - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - { - nchan_ism = 1; - } +#else + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) #endif - - /* decode ISM format */ + { + /* decode ISM metadata */ #ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_metadata_dec( ism_total_brate, #ifdef OMASA_UPDATES - nchan_ism, + nchan_ism, &nchan_transport_ism, #else - st_ivas->nchan_ism, + st_ivas->nchan_ism, &( st_ivas->nSCE ), #endif - &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) + st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_metadata_dec( ism_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL, NULL ) ) != IVAS_ERR_OK ) #endif @@ -509,19 +519,7 @@ ivas_error ivas_dec( return error; } - for ( n = 0; n < st_ivas->nSCE - 1; n++ ) - { - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) - { - return error; - } - + // VE: move the following updates into ivas_ism_metadata_dec() #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -531,7 +529,7 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } - else + else /* ISM_MASA_MODE_MASA_ONE_OBJ */ { st_ivas->hMasaIsmData->azimuth_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); @@ -543,8 +541,35 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } #endif + +#ifndef OMASA_UPDATES + for ( n = 0; n < st_ivas->nSCE - 1; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif } +#ifdef OMASA_UPDATES + /* decode ISM channels */ + for ( n = 0; n < nchan_transport_ism; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[st_ivas->nchan_transport + n], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + + /* decode MASA channels */ if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; @@ -575,7 +600,7 @@ ivas_error ivas_dec( for ( n = 0; n < st_ivas->nchan_ism; n++ ) { - mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + mvr2r( output[2 + n], data_separated_objects[n], output_frame ); v_multc( data_separated_objects[n], gain, data_separated_objects[n], output_frame ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 329e62f932..e9300d6cf6 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1132,7 +1132,10 @@ ivas_error ivas_init_decoder( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } k = 0; ism_total_brate = 0; @@ -1150,7 +1153,10 @@ ivas_error ivas_init_decoder( st_ivas->nSCE = 1; ism_total_brate = sep_object_brate[k - 2][0]; - create_sce_dec( st_ivas, 0, ism_total_brate ); + if ( ( error = create_sce_dec( st_ivas, 0, ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); @@ -1221,7 +1227,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) { - ivas_dirac_dec_open( st_ivas ); + if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3abaa72637..acdf2b4a5b 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -98,7 +98,7 @@ ivas_error ivas_ism_enc( #endif ivas_error error; #ifdef MASA_AND_OBJECTS - int16_t i, nchan_transport; + int16_t i, nchan_transport_ism; #endif push_wmops( "ivas_ism_enc" ); @@ -132,18 +132,18 @@ ivas_error ivas_ism_enc( set_s( md_diff_flag, 1, nchan_ism ); #ifdef MASA_AND_OBJECTS - nchan_transport = st_ivas->nchan_transport; + nchan_transport_ism = st_ivas->nchan_transport; #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { - nchan_transport = 1; + nchan_transport_ism = 1; nchan_ism = 1; } else #endif if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - nchan_transport = st_ivas->hEncoderConfig->nchan_ism; + nchan_transport_ism = st_ivas->hEncoderConfig->nchan_ism; } #endif @@ -151,10 +151,10 @@ ivas_error ivas_ism_enc( * Preprocesing *-----------------------------------------------------------------*/ - /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) #else + /* in ISM format: st_ivas->nchan_transport = st_ivas->nSCE */ for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif { @@ -303,7 +303,7 @@ ivas_error ivas_ism_enc( nchan_ism, #endif #ifdef MASA_AND_OBJECTS - nchan_transport, + nchan_transport_ism, #else st_ivas->nchan_transport, #endif @@ -352,7 +352,7 @@ ivas_error ivas_ism_enc( nchan_ism, #endif #ifdef MASA_AND_OBJECTS - nchan_transport, + nchan_transport_ism, #else st_ivas->nchan_transport, #endif @@ -411,7 +411,7 @@ ivas_error ivas_ism_enc( *-----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -471,7 +471,7 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { #ifdef MASA_AND_OBJECTS - for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) #else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) #endif @@ -493,7 +493,11 @@ ivas_error ivas_ism_enc( int16_t id, n; n = 0; +#ifdef MASA_AND_OBJECTS + for ( sce_id = 0; sce_id < nchan_transport_ism; sce_id++ ) +#else for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) +#endif { if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) { -- GitLab From 60715ab59244564e9b8dbf28f4feaf645b170c19 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 28 Mar 2023 18:20:08 +0200 Subject: [PATCH 066/591] decoder BR switching updates --- lib_dec/ivas_init_dec.c | 15 +++++----- lib_dec/ivas_ism_dec.c | 14 +++++----- lib_dec/ivas_omasa_dec.c | 60 ++++++++++++++++++++++++++++++++++++++-- lib_enc/ivas_init_enc.c | 5 ++-- lib_enc/ivas_omasa_enc.c | 8 ++++-- 5 files changed, 80 insertions(+), 22 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e9300d6cf6..6b55ee6a0b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1160,6 +1160,12 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); +#ifdef OMASA_BRATE_SW + if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } +#else #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { @@ -1172,23 +1178,17 @@ ivas_error ivas_init_decoder( } else { -#ifdef OMASA_BRATE_SW - if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } -#endif } #else if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); } +#endif #endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -1535,6 +1535,7 @@ ivas_error ivas_init_decoder( } #ifdef OMASA_UPDATES + // VE: introduce a new renderer_type for this case if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { /* Use td renderer for the objects in DISC mode */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index b6f33df845..1c908998a4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -52,7 +52,7 @@ static ivas_error ivas_ism_bitrate_switching( const ISM_MODE last_ism_mode /* i : last ISM mode */ #ifndef NCHAN_ISM_PARAMETER , - const int16_t num_obj /* i : number of objects in the bitstream */ + const int16_t num_obj /* i : number of objects in the bitstream */ #endif ) { @@ -71,14 +71,14 @@ static ivas_error ivas_ism_bitrate_switching( , 0 #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS , 0 #endif -) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #endif { return error; @@ -209,7 +209,7 @@ static ivas_error ivas_ism_bitrate_switching( ivas_td_binaural_close( &st_ivas->hBinRendererTd ); } - if ( st_ivas->hHrtfTD != NULL ) + if ( st_ivas->hHrtfTD != NULL ) // VE: this looks suspicious { st_ivas->hHrtfTD = NULL; } @@ -261,7 +261,7 @@ ivas_error ivas_ism_dec_config( #endif #ifndef NCHAN_ISM_PARAMETER , - const int16_t num_obj /* i : number of objects in the bitstream */ + const int16_t num_obj /* i : number of objects in the bitstream */ #endif ) { @@ -334,11 +334,11 @@ ivas_error ivas_ism_dec_config( #endif { return error; + } } } } } - } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { #ifdef DISCRETE_ISM_DTX_CNG diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index c3f1d35fdc..8ef1dbf26e 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -35,6 +35,9 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" +#ifdef OMASA_UPDATES +#include "ivas_prot_rend.h" +#endif #ifdef OMASA_BRATE_SW #include "ivas_rom_com.h" #endif @@ -147,7 +150,6 @@ ivas_error ivas_omasa_dec_config( ivas_error error; /* initializations */ - error = IVAS_ERR_OK; ism_total_brate = 0; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -229,13 +231,16 @@ ivas_error ivas_omasa_dec_config( } } - if ( ism_mode_old != st_ivas->ism_mode ) { /* ISM MD reconfig. */ n_MD = 0; +#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#endif { n_MD = 1; @@ -270,7 +275,11 @@ ivas_error ivas_omasa_dec_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; /* objects renderer reconfig. */ +#ifdef OMASA_UPDATES + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#else if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) +#endif { if ( st_ivas->hIsmRendererData == NULL ) { @@ -279,7 +288,11 @@ ivas_error ivas_omasa_dec_config( return error; } } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#else else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) +#endif { for ( n = 1; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) { @@ -313,8 +326,13 @@ ivas_error ivas_omasa_dec_config( mvr2r( tmp, st_ivas->hMasaIsmData->delayBuffer[0], st_ivas->hMasaIsmData->delayBuffer_size ); } } +#ifdef OMASA_UPDATES + else if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) +#else else if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) +#endif { + // VE: use ivas_masa_ism_data_close() instead? for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) { free( st_ivas->hMasaIsmData->delayBuffer[n] ); @@ -325,9 +343,45 @@ ivas_error ivas_omasa_dec_config( free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } + +#ifdef OMASA_UPDATES + // VE: introduce a new renderer_type for this case + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + { + /* Use td renderer for the objects in DISC mode */ + error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, + st_ivas->transport_config, +#ifdef TD5 + st_ivas->hRenderConfig->directivity, +#endif + st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); + if ( ( error ) != IVAS_ERR_OK ) + { + return error; + } + + /* Reserve memory for delay buffer */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + 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; + } + } +#endif } - return error; + return IVAS_ERR_OK; } #endif diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8b8c4bfd4f..1fd102c07c 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -633,10 +633,11 @@ ivas_error ivas_init_encoder( return error; } } + #ifdef OMASA_UPDATES - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM) ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) #else - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) #endif { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 4f9148e228..2ec461d5f9 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -232,11 +232,9 @@ ivas_error ivas_omasa_enc_config( ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; - error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; - //ivas_masa_enc_reconfigure( st_ivas ); // VE: might not be needed @@ -311,7 +309,11 @@ ivas_error ivas_omasa_enc_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; +#ifdef OMASA_UPDATES + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) +#else if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) +#endif { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } @@ -333,7 +335,7 @@ ivas_error ivas_omasa_enc_config( ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); } - return error; + return IVAS_ERR_OK; } #endif -- GitLab From fd62e881c4956ea826ae27751040ac8e6f6a597d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 28 Mar 2023 19:55:46 +0200 Subject: [PATCH 067/591] fix decoder BR switching --- lib_dec/ivas_cpe_dec.c | 9 ++++----- lib_dec/ivas_omasa_dec.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 92b0668072..b52c2ea054 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -249,11 +249,9 @@ ivas_error ivas_cpe_dec( nb_bits -= SID_FORMAT_NBITS; sts[1]->bit_stream -= SID_FORMAT_NBITS; } -#ifdef MASA_AND_OBJECTS - if ( ( ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || - ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) ) ) && - ivas_total_brate > IVAS_SID_5k2 ) +#ifdef MASA_AND_OBJECTS + if ( ( ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) || ( st_ivas->ivas_format == MASA_ISM_FORMAT && cpe_brate < MASA_STEREO_MIN_BITRATE ) ) && ivas_total_brate > IVAS_SID_5k2 ) #else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_5k2 ) #endif @@ -373,6 +371,7 @@ ivas_error ivas_cpe_dec( /*----------------------------------------------------------------* * Core codec configuration *----------------------------------------------------------------*/ + for ( n = 0; n < n_channels; n++ ) { /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ @@ -1116,7 +1115,7 @@ static void read_stereo_mode_and_bwidth( { /* read stereo technology info */ #ifdef OMASA_UPDATES - if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k) ) + if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k ) ) #else if ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 8ef1dbf26e..52812b6fb3 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -187,6 +187,16 @@ ivas_error ivas_omasa_dec_config( return error; } + // VE!!!!!: verification needed, see comment "/* Todo: Nokia make for MASA_ISM*/" in ivas_masa_dec_reconfigure() + if ( cpe_brate < MASA_STEREO_MIN_BITRATE ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else + { + st_ivas->hCPE[0]->nchan_out = 2; + } + /* OMASA reconfig. */ if ( st_ivas->hMasaIsmData == NULL && st_ivas->ivas_format == MASA_ISM_FORMAT ) { -- GitLab From ef8970d96e6ef7cc6974b530e37d2811e8e825a5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 09:12:08 +0200 Subject: [PATCH 068/591] white spaces --- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 128c63b114..0b0d03cd09 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -289,7 +289,7 @@ ivas_error ivas_cpe_enc( { #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) - { + { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } else diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 2ec461d5f9..ef87fd21e4 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -948,7 +948,6 @@ static void ivas_omasa_param_est_enc( float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float diffuseness_vector[MASA_FREQUENCY_BANDS]; - int16_t band_m_idx, block_m_idx; float renormalization_factor_diff[MASA_FREQUENCY_BANDS]; float norm_tmp; @@ -958,7 +957,6 @@ static void ivas_omasa_param_est_enc( num_freq_bands = hOMasa->nbands; l_ts = input_frame / CLDFB_NO_COL_MAX; - /* Need to initialize renormalization_factors, and variables to be normalized */ set_zero( renormalization_factor_diff, hOMasa->nbands ); set_zero( diffuseness_m, hOMasa->nbands ); @@ -1282,7 +1280,6 @@ static void ivas_omasa_dmx( } } - return; } -- GitLab From a6786399666a636b12605fed878db379a9e7ee49 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 10:47:56 +0200 Subject: [PATCH 069/591] fix memory deallocation in bitrate switching --- lib_dec/ivas_omasa_dec.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 6d9e3df5f4..2389512da3 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -158,7 +158,11 @@ ivas_error ivas_omasa_dec_config( st_ivas->ism_mode = ism_mode_old; ivas_format_old = st_ivas->ivas_format; +#ifdef OMASA_UPDATES + if ( ism_mode_old == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) +#else if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) +#endif { st_ivas->ivas_format = MASA_ISM_FORMAT; } @@ -342,16 +346,7 @@ ivas_error ivas_omasa_dec_config( else if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) #endif { - // VE: use ivas_masa_ism_data_close() instead? - for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) - { - free( st_ivas->hMasaIsmData->delayBuffer[n] ); - } - free( st_ivas->hMasaIsmData->delayBuffer ); - st_ivas->hMasaIsmData->delayBuffer = NULL; - - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; + ivas_masa_ism_data_close( &( st_ivas->hMasaIsmData ) ); } #ifdef OMASA_UPDATES -- GitLab From e05ea4c7a9380d06ddd3d7dde4476368cb1f37fc Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 11:28:37 +0200 Subject: [PATCH 070/591] remove obsolete callings of ivas_masa_ism_separate_object_renderer_open() --- lib_dec/ivas_init_dec.c | 12 --------- lib_dec/ivas_omasa_dec.c | 57 +++------------------------------------- 2 files changed, 3 insertions(+), 66 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 035cc5f430..88200f017d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1238,18 +1238,6 @@ ivas_error ivas_init_decoder( { reset_indices_dec( st_ivas->hCPE[0]->hCoreCoder[n] ); } - -#ifdef OMASA_UPDATES - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif - { - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 2389512da3..52e1dc0ea1 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -143,7 +143,7 @@ ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t k, n, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; + int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; int32_t ivas_total_brate, ism_total_brate, cpe_brate; IVAS_FORMAT ivas_format_old; ISM_MODE ism_mode_old; @@ -290,60 +290,9 @@ ivas_error ivas_omasa_dec_config( /* objects renderer reconfig. */ #ifdef OMASA_UPDATES - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) #else - if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif - { - if ( st_ivas->hIsmRendererData == NULL ) - { - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#ifdef OMASA_UPDATES - else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#endif - { - for ( n = 1; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) - { - free( st_ivas->hMasaIsmData->delayBuffer[n] ); - } - - st_ivas->hMasaIsmData->delayBuffer_nchan = 1; - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - float tmp[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - - st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; - - mvr2r( st_ivas->hMasaIsmData->delayBuffer[0], tmp, st_ivas->hMasaIsmData->delayBuffer_size ); - free( st_ivas->hMasaIsmData->delayBuffer[0] ); - free( st_ivas->hMasaIsmData->delayBuffer ); - if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - - for ( n = 0; n < st_ivas->hMasaIsmData->delayBuffer_nchan; n++ ) - { - if ( ( st_ivas->hMasaIsmData->delayBuffer[n] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - set_zero( st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); - } - mvr2r( tmp, st_ivas->hMasaIsmData->delayBuffer[0], st_ivas->hMasaIsmData->delayBuffer_size ); - } - } -#ifdef OMASA_UPDATES - else if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) -#else - else if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) + if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) #endif { ivas_masa_ism_data_close( &( st_ivas->hMasaIsmData ) ); -- GitLab From f9afcb5446fdb626ded2b6234aeb73293c0a2110 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 11:48:15 +0200 Subject: [PATCH 071/591] fix memory deallocation in bitrate switching --- lib_dec/ivas_init_dec.c | 4 ++-- lib_dec/ivas_omasa_dec.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 88200f017d..60e024383f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1517,7 +1517,7 @@ ivas_error ivas_init_decoder( // VE: introduce a new renderer_type for this case if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { - /* Use td renderer for the objects in DISC mode */ + /* Allocate TD renderer for the objects in DISC mode */ error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); if ( ( error ) != IVAS_ERR_OK ) @@ -1525,7 +1525,7 @@ ivas_error ivas_init_decoder( return error; } - /* Reserve memory for delay buffer */ + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 52e1dc0ea1..b32a76b431 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -302,7 +302,7 @@ ivas_error ivas_omasa_dec_config( // VE: introduce a new renderer_type for this case if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { - /* Use td renderer for the objects in DISC mode */ + /* Allocate TD renderer for the objects in DISC mode */ if ( ( error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK ) @@ -310,7 +310,7 @@ ivas_error ivas_omasa_dec_config( return error; } - /* Reserve memory for delay buffer */ + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -318,6 +318,7 @@ ivas_error ivas_omasa_dec_config( } else { + /* TD renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); @@ -327,6 +328,13 @@ ivas_error ivas_omasa_dec_config( { st_ivas->hHrtfTD = NULL; } + + /* ISM renderer handle */ + if ( st_ivas->hIsmRendererData != NULL ) + { + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } } #endif } -- GitLab From 26a34518f96c44647368b9abb3e13b050823a6c0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 3 Apr 2023 12:51:11 +0200 Subject: [PATCH 072/591] - use native instead of wrapper functions for TD renderer - re-activate FIX_350_MASA_DELAY_COMP and FIX_382_MASA_META_FRAMING_ASYNC - compilation fixes when MASA_AND_OBJECTS is disabled --- lib_com/options.h | 4 +-- lib_dec/ivas_dec.c | 4 +-- lib_dec/ivas_init_dec.c | 8 +----- lib_dec/ivas_ism_metadata_dec.c | 2 ++ lib_dec/ivas_objectRenderer_internal.c | 37 +++++++++++++++++++++----- lib_dec/ivas_omasa_dec.c | 4 +-- lib_enc/ivas_ism_enc.c | 6 ++++- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_masa_enc.c | 14 +++++----- 9 files changed, 52 insertions(+), 29 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7eb9eb4f35..6d0f913e0e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,12 +144,12 @@ #define FIX_103_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ /*#define SBA_HPF_TUNING_DEC*/ -//#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ +#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ -//#define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ +#define FIX_382_MASA_META_FRAMING_ASYNC /* Nokia: Issue 382: detect potential MASA metadata framing offset */ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4ceb3d5019..10147488c0 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -607,9 +607,7 @@ ivas_error ivas_dec( ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); - if ( ( error = ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, st_ivas->nchan_ism, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, data_separated_objects, output_frame ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer( st_ivas, data_separated_objects, output_frame ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 60e024383f..e8fccfb9cf 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1518,9 +1518,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { /* Allocate TD renderer for the objects in DISC mode */ - error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, - st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); - if ( ( error ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1865,11 +1863,7 @@ void ivas_destroy_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { -#ifdef OMASA_BRATE_SW int16_t i; -#else - int16_t i, n; -#endif /* CLDFB handles */ for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 4a0c8eb4f7..c28478b0ab 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -180,7 +180,9 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; #endif +#ifdef MASA_AND_OBJECTS ivas_error error; +#endif push_wmops( "ism_meta_dec" ); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index f1c1fc04f2..2b24b08398 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -53,8 +53,22 @@ ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { +#ifdef MASA_AND_OBJECTS + int16_t num_src; + + num_src = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + num_src = st_ivas->nchan_ism; + } + + return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format, + st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); +#else + return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); +#endif } @@ -71,10 +85,21 @@ ivas_error ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { - return ivas_td_binaural_renderer_unwrap( - st_ivas->hReverb, - st_ivas->transport_config, - st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +#ifdef MASA_AND_OBJECTS + int16_t num_src; + + num_src = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + num_src = st_ivas->nchan_ism; + } + + return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, num_src, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +#else + return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +#endif } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b32a76b431..1afaa4696b 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -303,9 +303,7 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, - st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, - &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 093b653a93..60dfcf7acc 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -355,7 +355,11 @@ ivas_error ivas_ism_enc( } #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 1c84021747..3bf642b85b 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -312,7 +312,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS if ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) && nchan_ism == 2 ) #else - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && nchan_ism == 2 ) #endif { float diff_F; diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 7c85b6188f..28989065a2 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -85,16 +85,16 @@ static void remove_sep_obj( int16_t *diff_idx, const int16_t nchan_ism, const in static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif -#ifdef FIX_382_MASA_META_FRAMING_ASYNC -static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); +#ifndef MASA_AND_OBJECTS +static void combine_directions( MASA_ENCODER_HANDLE hMasa ); +#endif -static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); +#ifdef FIX_382_MASA_META_FRAMING_ASYNC +static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); -static void copy_masa_metadata( const MASA_METADATA_HANDLE hMetaFrom, MASA_METADATA_HANDLE hMetaTo ); +static void average_masa_metadata( MASA_METADATA_FRAME *hMeta, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, const MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); - -static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); #endif /*-----------------------------------------------------------------------* @@ -1644,10 +1644,12 @@ static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format +#ifdef MASA_AND_OBJECTS #ifndef OMASA_UPDATES , const ISM_MODE ism_mode #endif +#endif ) { int16_t sf; -- GitLab From a71af78ca3325f42b2da355adecc936e3044cae2 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 4 Apr 2023 20:09:58 +1000 Subject: [PATCH 073/591] fix for 64 bit compiler in bitstream read from file function --- lib_util/split_render_file_read_write.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 78ef342bbf..23e60d58c9 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -198,6 +198,7 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; size_t header_len, i, num_bytes, bit_len; + bit_len = 0; if ( hSplitRendFileReadWrite == NULL ) { return IVAS_ERR_FAILED_FILE_READ; -- GitLab From 59cf37d1b8f4c462069bee5e876a48246c552904 Mon Sep 17 00:00:00 2001 From: Auto Commit Date: Tue, 4 Apr 2023 11:17:26 -0400 Subject: [PATCH 074/591] first tuning version, vaclav find it takes off too much ambiance --- Workspace_msvc/decoder.vcxproj | 6 ++--- Workspace_msvc/encoder.vcxproj | 8 +++---- Workspace_msvc/lib_com.vcxproj | 8 +++---- Workspace_msvc/lib_debug.vcxproj | 8 +++---- Workspace_msvc/lib_dec.vcxproj | 8 +++---- Workspace_msvc/lib_enc.vcxproj | 8 +++---- Workspace_msvc/lib_rend.vcxproj | 8 +++---- Workspace_msvc/lib_util.vcxproj | 8 +++---- Workspace_msvc/renderer.vcxproj | 8 +++---- lib_com/ivas_prot.h | 13 +++++++++++ lib_com/ivas_stereo_td_bit_alloc.c | 24 +++++++++++++++----- lib_com/options.h | 7 +++--- lib_dec/ivas_cpe_dec.c | 6 ++++- lib_dec/ivas_stereo_td_dec.c | 10 ++++++++- lib_enc/ivas_cpe_enc.c | 22 ++++++++++++++----- lib_enc/ivas_omasa_enc.c | 2 +- lib_enc/ivas_stereo_classifier.c | 13 +++++++++++ lib_enc/ivas_stereo_td_analysis.c | 12 +++++++++- lib_enc/ivas_stereo_td_enc.c | 35 ++++++++++++++++++++++-------- 19 files changed, 152 insertions(+), 62 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index e59992847c..f0016965e0 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -14,18 +14,18 @@ decoder {E3DCBC31-7FC9-D127-E000-529F8460D5FD} decoder - 10.0.17763.0 + 10.0 Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index bcfe92a4db..fc7e189560 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -18,24 +18,24 @@ encoder {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} encoder - 10.0.17763.0 + 10.0 Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 78ed7bb39d..ed8012c4d3 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -17,24 +17,24 @@ {39EC200D-7795-4FF8-B214-B24EDA5526AE} common - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 3b648fae04..6a5e102b0c 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -17,22 +17,22 @@ {54509728-928B-44D9-A118-A6F92F08B34F} debug - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index dd2ed44443..facb2d3bc3 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -18,24 +18,24 @@ lib_dec {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} evs_dec - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index af7ca35b12..eede51cfde 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -18,24 +18,24 @@ lib_enc {824DA4CF-06F0-45C9-929A-8792F0E19C3E} evs_enc - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 865652649a..1cb397d10f 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -18,24 +18,24 @@ lib_rend {718DE063-A18B-BB72-9150-62B892E6FFA6} evs_dec - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte StaticLibrary - v141 + v142 false MultiByte diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 5b5e5f30cc..d1a1a8d818 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -17,22 +17,22 @@ {2FA8F384-0775-F3B7-F8C3-85209222FC70} utility - 10.0.17763.0 + 10.0 StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte StaticLibrary - v141 + v142 MultiByte true diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 94ad9f774e..d90b4a6251 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -18,24 +18,24 @@ renderer {12B4C8A5-1E06-4E30-B443-D1F916F52B47} renderer - 10.0.17763.0 + 10.0 Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte Application - v141 + v142 false MultiByte diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index bfae9aa4a6..56ec490530 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1766,6 +1766,9 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ); void stereo_classifier_init( @@ -1851,6 +1854,10 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif + ); void tdm_upmix_plain( @@ -1904,6 +1911,9 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif ); ivas_error signaling_enc_secondary( @@ -1927,6 +1937,9 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#endif ); void td_stereo_param_updt( diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 8b93558b21..b6d3f214b3 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -88,6 +88,9 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx_ref /* i : instantaneous correlation ratio idx */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#endif ) { int16_t idx, four_subfr_fcb, two_subfr_fcb; @@ -136,7 +139,12 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ +#ifdef OMASA_TUNING + if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || + ( IsOmasa == 1 && coder_type > UNVOICED ) ) +#else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) +#endif { bit_rate_diff = (float) ( element_brate_wo_meta - 2 * *total_brate_sec ); @@ -404,11 +412,11 @@ void tdm_bit_alloc( } *total_brate_sec += ( fast_FCB_rates_2sfr[idx] - tmp_rate ); } - /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ - if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) - { - *total_brate_sec += 100; - } + ///* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ + //if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) + //{ + // *total_brate_sec += 100; + //} /* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */ if ( element_brate_wo_meta - *total_brate_sec == ACELP_13k20 ) @@ -416,7 +424,11 @@ void tdm_bit_alloc( *total_brate_sec += 100; } } - + /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ + if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) + { + *total_brate_sec += 100; + } *total_brate_pri = element_brate_wo_meta - *total_brate_sec; return; diff --git a/lib_com/options.h b/lib_com/options.h index d0718997f5..b4d5642711 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,12 +58,12 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO -/*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ +#define DEBUG_MODE_ACELP /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT */ /* output most important DFT stereo parameters to the subdirectory "res/" */ -/*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ +#define DEBUG_MODE_TD /* output most important TD stereo parameters to the subdirectory "res/ */ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ @@ -172,6 +172,7 @@ #define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ #define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA +#define OMASA_TUNING #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index b52c2ea054..d699511690 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -413,7 +413,11 @@ ivas_error ivas_cpe_dec( { if ( !st_ivas->bfi ) { - tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata ); + tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata +#ifdef OMASA_TUNING + , (st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4)) +#endif + ); sts[1]->bit_stream = sts[0]->bit_stream + ( sts[0]->total_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 31b66044c6..7cfa3d92fd 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -87,6 +87,10 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif + ) { STEREO_TD_DEC_DATA_HANDLE hStereoTD; @@ -308,7 +312,11 @@ void tdm_configure_dec( tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx +#ifdef OMASA_TUNING + ,IsOmasa +#endif + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 128c63b114..53a30ce4d5 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -169,12 +169,20 @@ ivas_error ivas_cpe_enc( #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) { - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k +#ifdef OMASA_TUNING + ,st_ivas->hOMasa!=NULL +#endif + ); } else { #endif - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate +#ifdef OMASA_TUNING + ,st_ivas->hOMasa!=NULL +#endif + ); #ifdef OMASA_UPDATES } #endif @@ -579,7 +587,11 @@ ivas_error ivas_cpe_enc( { tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr ); - tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata ); + tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata +#ifdef OMASA_TUNING + ,st_ivas->hOMasa != NULL +#endif + ); if ( hEncoderConfig->Opt_DTX_ON ) { @@ -784,7 +796,7 @@ ivas_error ivas_cpe_enc( dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_NCShift" ); dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_ica_gD" ); n = -1; - dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } else if ( hCPE->element_mode == IVAS_CPE_TD ) { @@ -801,7 +813,7 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { n = -2; - dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 2ec461d5f9..b853638840 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -892,7 +892,7 @@ void ivas_set_surplus_brate_enc( if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) #else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) + if (1)// st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) #endif { tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index b2e3373404..36f06ccadc 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -90,6 +90,9 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ) { int16_t element_mode; @@ -209,6 +212,16 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } +#ifdef OMASA_TUNING + else if ( element_mode == IVAS_CPE_TD && isOmasa ) + { + if ( ( hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) + { + hStereoClassif->lrtd_mode = 0; + hStereoClassif->prev_lrtd_mode = 0; + } + } +#endif #ifdef DEBUG_MODE_TD diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index d2d72c1534..70aaf2ebed 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -229,7 +229,17 @@ int16_t stereo_tdm_ener_analysis( hStereoTD->prev_fr_LRTD_TD_dec = 0; } } - + //if ( hCPE->hStereoTD != NULL ) + //{ + + // if ( /*hStereoClassif->lrtd_mode == 1*/ hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 && hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) + // { + // //hStereoClassif->xtalk_decision = 0; + // //hStereoClassif->lrtd_mode = 0; + // hCPE->hStereoTD->prev_fr_LRTD_TD_dec = 0; + // //hCPE->hStereoClassif->lrtd_mode = 0; + // } + //} side_can_change = 0; /* update LRTD->DFT stereo hangover counters */ diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 2105b351b3..2f34424f70 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -283,8 +283,8 @@ ivas_error stereo_set_tdm( dbgwrite( &tmp, 2, 1, 320, "res/inst_ratio_L" ); dbgwrite( &ftmp, 4, 1, 320, "res/ratio_L" ); dbgwrite( &tmp, 2, 1, 320, "res/tdm_low_rate_mode" ); - dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); - dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); + //dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); + //dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); } #endif hCPE->hCoreCoder[0]->tdm_LRTD_flag = 0; @@ -309,6 +309,9 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_TUNING + ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#endif ) { int16_t tdm_ratio_bit_alloc_idx, mod_ct; @@ -420,11 +423,21 @@ void tdm_configure_enc( } #ifdef MASA_AND_OBJECTS - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) { - sts[1]->coder_type = INACTIVE; - hStereoTD->tdm_Pitch_reuse_flag = 0; + if ( sts[1]->coder_type == UNVOICED) + { + sts[1]->coder_type = GENERIC; + } hStereoTD->tdm_lp_reuse_flag = 1; +#ifdef OMASA_TUNING + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 6000 && hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0 ) +#else + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 /*&& hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0*/ ) +#endif + { + sts[1]->coder_type = INACTIVE; + } } if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 14700 ) @@ -473,7 +486,11 @@ void tdm_configure_enc( tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx +#ifdef OMASA_TUNING + ,IsOmasa +#endif + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #endif @@ -539,9 +556,9 @@ void tdm_configure_enc( } #ifdef DEBUG_MODE_TD - dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode" ); - dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag" ); - dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.enx" ); + dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode_c" ); + dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag_c" ); + dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.enc" ); #endif /*----------------------------------------------------------------* * Updates -- GitLab From 7bba4f3ae73dd2f72eaf8f917d7182d4c5bfd6f4 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 5 Apr 2023 08:46:10 +0300 Subject: [PATCH 075/591] Makes ISM rendering to LS in OMASA closer to separate ISM rendering to LS. Also applies clang format. --- lib_com/ivas_ism_config.c | 3 +- lib_com/ivas_omasa_com.c | 14 ++- lib_com/ivas_prot.h | 8 ++ lib_com/ivas_stat_com.h | 2 +- lib_com/options.h | 2 +- lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_cpe_dec.c | 3 +- lib_dec/ivas_dec.c | 4 +- lib_dec/ivas_dirac_dec.c | 9 +- lib_dec/ivas_dirac_output_synthesis_dec.c | 17 ++++ lib_dec/ivas_init_dec.c | 6 +- lib_dec/ivas_ism_metadata_dec.c | 4 +- lib_dec/ivas_ism_renderer.c | 28 +++--- lib_dec/ivas_masa_dec.c | 27 +++--- lib_dec/ivas_omasa_dec.c | 6 +- lib_dec/ivas_stat_dec.h | 5 ++ lib_dec/ivas_vbap.c | 92 ++++++++++++++++++++ lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_decision_matrix_enc.c | 2 +- lib_enc/ivas_enc.c | 2 +- lib_enc/ivas_init_enc.c | 6 +- lib_enc/ivas_ism_metadata_enc.c | 14 +-- lib_enc/ivas_masa_enc.c | 26 ++---- lib_enc/ivas_omasa_enc.c | 8 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- 25 files changed, 205 insertions(+), 89 deletions(-) mode change 100755 => 100644 lib_dec/ivas_core_dec.c diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 8a0621509c..4f2ace5b2a 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -386,7 +386,7 @@ ivas_error ivas_ism_config( { int32_t tmpL; tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND; -#ifdef MASA_AND_OBJECTS +#ifdef MASA_AND_OBJECTS if ( ism_total_brate != tmpL ) #else if ( sum_l( element_brate, n_ISms ) != tmpL ) @@ -394,7 +394,6 @@ ivas_error ivas_ism_config( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISm bit-budget distribution. Exiting!\n" ); } - } #endif diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 175bf22195..101afcbc87 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -69,11 +69,10 @@ #endif - /*--------------------------------------------------------------- * ivas_omasa_ism_mode_select() * - * selects the ISM mode base on IVAS total bit-rate and + * selects the ISM mode base on IVAS total bit-rate and * the number of objects in the combined ISM MASA format mode * ---------------------------------------------------------------*/ @@ -179,7 +178,6 @@ ISM_MODE ivas_omasa_ism_mode_select( } - /*--------------------------------------------------------------- * ivas_interformat_brate() * @@ -209,12 +207,11 @@ int32_t ivas_interformat_brate( } else { - if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate <= 24000 ) - || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) /* for border case in DISC mode */ + if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate <= 24000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) /* for border case in DISC mode */ { #ifdef OMASA_UPDATES - if ( (limit_flag == 1) && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) + if ( ( limit_flag == 1 ) && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) { return element_brate; } @@ -383,7 +380,7 @@ int16_t bits_index_ism_ratio( /*--------------------------------------------------------------- * calculate_nbits_meta() * - * + * * ---------------------------------------------------------------*/ void calculate_nbits_meta( @@ -487,7 +484,7 @@ void ivas_get_stereo_panning_gains( return; } -int16_t calculate_brate_limit_flag(int16_t * ism_imp, int16_t num_obj) +int16_t calculate_brate_limit_flag( int16_t *ism_imp, int16_t num_obj ) { int16_t n; int16_t brate_limit_flag; @@ -517,4 +514,3 @@ int16_t calculate_brate_limit_flag(int16_t * ism_imp, int16_t num_obj) return brate_limit_flag; } #endif - diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 750e5fc85c..7ad36a7cc2 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4744,6 +4744,10 @@ ivas_error vbap_init_data( const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ const int16_t num_speaker_nodes /* i : number of speaker nodes in the set */ +#ifdef OMASA_UPDATES + , + const int16_t support_object_mode /* i : init VBAP also for object panning mode */ +#endif ); void vbap_free_data( @@ -4755,6 +4759,10 @@ void vbap_determine_gains( float *gains, /* o : gain vector for speaker nodes for given direction */ const int16_t azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const int16_t ele_deg /* i : elevation in degrees for panning direction (positive up) */ +#ifdef OMASA_UPDATES + , + const int16_t use_object_mode /* i : select between object mode panning and spatial mode panning */ +#endif ); void v_sort_ind( diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index c7664a9a41..224d26bbea 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -58,7 +58,7 @@ typedef struct int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ -#ifdef MASA_AND_OBJECTS +#ifdef MASA_AND_OBJECTS int16_t ism_imp; /* ISM importance flag */ int16_t ism_vad_flag; #ifdef OMASA_UPDATES diff --git a/lib_com/options.h b/lib_com/options.h index 62011c419e..442a0004d7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define LOW_RATE_TRANS_CORE_CODER /* Eri: Activate low-rate-encoding-of-transients contribution for core coder, affects MC, MASA and SBA */ -#define FIX_197_CREND_INTERFACE +#define FIX_197_CREND_INTERFACE #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ #define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c old mode 100755 new mode 100644 index 37034da4f8..171ecbfafe --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -269,7 +269,7 @@ ivas_error ivas_core_dec( } } -#ifdef MASA_AND_OBJECTS +#ifdef MASA_AND_OBJECTS /*------------------------------------------------------------------* * Sanity check in combined format coding *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index b093d58805..1ba5c68f5a 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -176,7 +176,6 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS } #endif - } else { @@ -1116,7 +1115,7 @@ static void read_stereo_mode_and_bwidth( { /* read stereo technology info */ #ifdef OMASA_UPDATES - if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k) ) + if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k ) ) #else if ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 80b5d6edd2..8c5a9b4716 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -529,8 +529,8 @@ ivas_error ivas_dec( } ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); - ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame,st_ivas->hCrendWrapper, - st_ivas->transport_config,st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, + ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, st_ivas->hCrendWrapper, + st_ivas->transport_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, st_ivas->nchan_ism, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, data_separated_objects, output_frame ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index f8e0f98d1b..b3c097c3a4 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -579,10 +579,17 @@ ivas_error ivas_dirac_dec_config( { vbap_free_data( &( st_ivas->hVBAPdata ) ); } +#ifdef OMASA_UPDATES + if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE, st_ivas->ivas_format == MASA_ISM_FORMAT ? 1 : 0 ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE ) ) != IVAS_ERR_OK ) { return error; } +#endif } else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { @@ -2030,7 +2037,7 @@ void ivas_dirac_dec( preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, - (uint8_t)(hDirAC->num_freq_bands), + (uint8_t) ( hDirAC->num_freq_bands ), (uint8_t) subframe_idx, 1 ); } diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 4fcb4c089e..2ef79bfc45 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -1681,11 +1681,19 @@ void ivas_dirac_dec_compute_directional_responses( { if ( hMasaIsm->ism_is_edited[dir] ) { +#ifdef OMASA_UPDATES + vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir], 1 ); +#else vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir] ); +#endif } else { +#ifdef OMASA_UPDATES + vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir], 1 ); +#else vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir] ); +#endif } for ( l = 0; l < num_channels_dir; l++ ) @@ -2202,12 +2210,21 @@ static void spreadCoherencePanningVbap( return; } +#ifdef OMASA_UPDATES + vbap_determine_gains( hVBAPdata, direct_response, azimuth, elevation, 0 ); +#else vbap_determine_gains( hVBAPdata, direct_response, azimuth, elevation ); +#endif if ( spreadCoh > 0.f ) { +#ifdef OMASA_UPDATES + vbap_determine_gains( hVBAPdata, direct_response_left, azimuth + 30, elevation, 0 ); + vbap_determine_gains( hVBAPdata, direct_response_right, azimuth - 30, elevation, 0 ); +#else vbap_determine_gains( hVBAPdata, direct_response_left, azimuth + 30, elevation ); vbap_determine_gains( hVBAPdata, direct_response_right, azimuth - 30, elevation ); +#endif if ( spreadCoh < 0.5f ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 15519bdee4..16ed84c257 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1250,7 +1250,11 @@ ivas_error ivas_init_decoder( } else { +#ifdef OMASA_UPDATES + vbap_determine_gains( st_ivas->hVBAPdata, st_ivas->hLsSetupCustom->separate_ch_gains, 0, 0, 0 ); +#else vbap_determine_gains( st_ivas->hVBAPdata, st_ivas->hLsSetupCustom->separate_ch_gains, 0, 0 ); +#endif } } @@ -1437,7 +1441,7 @@ ivas_error ivas_init_decoder( { /* Use td renderer for the objects in DISC mode */ error = ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_ism, st_ivas->ivas_format, - st_ivas->transport_config, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); + st_ivas->transport_config, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); if ( ( error ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 4066304dab..4bb56b0b82 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -651,8 +651,8 @@ ivas_error create_ism_metadata_dec( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL + + ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS , 0 diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 043b6f8600..feca51b696 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -252,10 +252,10 @@ void ivas_ism_get_stereo_gains( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------------* - * ivas_masa_ism_separate_object_renderer_open() - * - * Open structures, reserve memory, and init values. - *-------------------------------------------------------------------------*/ + * ivas_masa_ism_separate_object_renderer_open() + * + * Open structures, reserve memory, and init values. + *-------------------------------------------------------------------------*/ ivas_error ivas_masa_ism_separate_object_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -314,10 +314,10 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( /*-------------------------------------------------------------------------* -* ivas_masa_ism_separate_object_render() -* -* Rendering separated objects and mixing them to the parametrically rendered signals -*-------------------------------------------------------------------------*/ + * ivas_masa_ism_separate_object_render() + * + * Rendering separated objects and mixing them to the parametrically rendered signals + *-------------------------------------------------------------------------*/ void ivas_masa_ism_separate_object_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -327,7 +327,6 @@ void ivas_masa_ism_separate_object_render( ) { VBAP_HANDLE hVBAPdata; - AUDIO_CONFIG output_config; int16_t nchan_out_woLFE; ISM_RENDERER_HANDLE hRendererData; int16_t j, k, j2; @@ -340,13 +339,12 @@ void ivas_masa_ism_separate_object_render( uint8_t single_separated; hVBAPdata = st_ivas->hVBAPdata; - output_config = st_ivas->hDecoderConfig->output_config; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; hRendererData = st_ivas->hIsmRendererData; lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; #ifdef OMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) #else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) #endif @@ -375,20 +373,26 @@ void ivas_masa_ism_separate_object_render( elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; } - if ( output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_5_1_4 ) + if ( st_ivas->hOutSetup.is_planar_setup ) { /* If no elevation support in output format, then rendering should be done with zero elevation */ elevation = 0; } +#ifndef OMASA_UPDATES else if ( output_config == AUDIO_CONFIG_7_1_4 || output_config == AUDIO_CONFIG_5_1_4 ) { /* For no negative elevations, it's better to map them to zero */ elevation = elevation < 0 ? 0 : elevation; } +#endif if ( hVBAPdata != NULL ) { +#ifdef OMASA_UPDATES + vbap_determine_gains( hVBAPdata, gains, azimuth, elevation, 1 ); +#else vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); +#endif } else { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a0fa5cf0b4..e7ae030555 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -74,11 +74,11 @@ static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hM static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); #ifdef MASA_AND_OBJECTS -static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp); +static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp ); static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, const int16_t nchan_ism, const int16_t K ); -static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t nbands, const int16_t nblocks, const int16_t idx_separated_object); +static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, IVAS_QMETADATA_HANDLE hQMetaData, float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t nbands, const int16_t nblocks, const int16_t idx_separated_object ); static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], uint16_t *bit_stream, int16_t *next_bit_pos, float *masa_to_total_energy_ratio, const int16_t idx_sep_obj, int16_t *num_zeros ); #endif @@ -644,7 +644,7 @@ ivas_error ivas_masa_ism_data_open( hMasaIsmData->q_elevation_old[ch] = 0.0f; hMasaIsmData->q_azimuth_old[ch] = 0.0f; } - #endif +#endif return IVAS_ERR_OK; } @@ -1795,7 +1795,7 @@ static void read_ism_ratio_index( b_signif = 0; no_levels_ratio_ism = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); - while ( (b_signif < numCodingBands) && (masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR) ) + while ( ( b_signif < numCodingBands ) && ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR ) ) { /* distribute evenly the objects */ distribute_evenly_ism( ratio_ism_idx[b_signif], no_levels_ratio_ism, nchan_ism ); @@ -2033,9 +2033,6 @@ static void read_ism_ratio_index( } - - - static void decode_ism_ratios( uint16_t *bit_stream, /* i : bitstream */ int16_t *next_bit_pos, /* i/o: position in bitstream */ @@ -2044,7 +2041,7 @@ static void decode_ism_ratios( const int16_t n_ism, /* i : number of objects */ const int16_t nbands, /* i : number of subbands */ const int16_t numSf, /* i : number of subframes */ - const int16_t idx_separated_object /* i: index of separated object */ + const int16_t idx_separated_object /* i: index of separated object */ ) { int16_t sf, band; @@ -2122,8 +2119,7 @@ static int16_t ivas_decode_masaism_metadata( uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, - const int16_t ism_imp -) + const int16_t ism_imp ) { int16_t sf, band, dir, nbands, nblocks, obj, i; float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; @@ -2180,11 +2176,11 @@ static int16_t ivas_decode_masaism_metadata( index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; } deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); - + if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) { delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ - if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) + if ( azimuth - hMasaIsmData->q_azimuth_old[obj] > delta_phi ) { azimuth -= delta_phi; } @@ -2192,11 +2188,11 @@ static int16_t ivas_decode_masaism_metadata( { if ( hMasaIsmData->q_azimuth_old[obj] - azimuth > delta_phi ) { - azimuth += delta_phi; + azimuth += delta_phi; } } } - + hMasaIsmData->q_azimuth_old[obj] = azimuth; hMasaIsmData->q_elevation_old[obj] = elevation; } @@ -2222,7 +2218,6 @@ static int16_t ivas_decode_masaism_metadata( #endif hMasaIsmData->azimuth_ism[obj] = (int16_t) rint( azimuth ); hMasaIsmData->elevation_ism[obj] = (int16_t) rint( elevation ); - } /* Modify ISM metadata based on the MASA-to-total energy ratios */ @@ -2269,7 +2264,7 @@ static int16_t ivas_decode_masaism_metadata( /*-------------------------------------------------------------------* * ivas_masa_ism_set_edited_objects() * - * + * *-------------------------------------------------------------------*/ void ivas_masa_ism_set_edited_objects( diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 35441360fe..9233e4be99 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -91,14 +91,14 @@ void ivas_set_surplus_brate_dec( { #ifdef OMASA_UPDATES int16_t brate_limit_flag, ism_imp[MAX_NUM_OBJECTS]; - + for ( n = 0; n < st_ivas->nchan_ism; n++ ) { ism_imp[n] = st_ivas->hIsmMetaData[n]->ism_imp; } - + brate_limit_flag = calculate_brate_limit_flag( ism_imp, st_ivas->nchan_ism ); - + #endif ism_total_brate_ref = 0; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4316c90677..ff1f264e46 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1028,6 +1028,11 @@ typedef struct vbap_data_structure float *bottom_virtual_speaker_node_division_gains; float *top_virtual_speaker_node_division_gains; float *back_virtual_speaker_node_division_gains; +#ifdef OMASA_UPDATES + float *object_mode_bottom_virtual_speaker_node_division_gains; + float *object_mode_top_virtual_speaker_node_division_gains; + float *object_mode_back_virtual_speaker_node_division_gains; +#endif } VBAP_DATA, *VBAP_HANDLE; diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index 9c595ea1fe..d3ecedecfd 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -141,7 +141,11 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node( VBAP_HAND static int16_t determine_best_triplet_and_gains( VBAP_SEARCH_STRUCT *search_struct, const float panning_unit_vec[3], const int16_t azi_deg, float gains[3] ); +#ifdef OMASA_UPDATES +static void determine_virtual_speaker_node_division_gains( const int16_t virtual_speaker_node_index, float *virtual_node_division_gains, int16_t connections[][2], const enum VirtualSpeakerNodeType type, const int16_t max_num_connections, const int16_t num_speaker_nodes, const int16_t use_object_mode ); +#else static void determine_virtual_speaker_node_division_gains( const int16_t virtual_speaker_node_index, float *virtual_node_division_gains, int16_t connections[][2], const enum VirtualSpeakerNodeType type, const int16_t max_num_connections, const int16_t num_speaker_nodes ); +#endif static void reorder_triplets( VBAP_VS_TRIPLET *triplets, const int16_t *target_order, const int16_t num_triplets ); @@ -157,6 +161,10 @@ ivas_error vbap_init_data( const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ const int16_t num_speaker_nodes /* i : number of speaker nodes in the set */ +#ifdef OMASA_UPDATES + , + const int16_t support_object_mode /* i : init VBAP also for object panning mode */ +#endif ) { /* Variables */ @@ -203,6 +211,11 @@ ivas_error vbap_init_data( vbap->bottom_virtual_speaker_node_division_gains = NULL; vbap->top_virtual_speaker_node_division_gains = NULL; vbap->back_virtual_speaker_node_division_gains = NULL; +#ifdef OMASA_UPDATES + vbap->object_mode_bottom_virtual_speaker_node_division_gains = NULL; + vbap->object_mode_top_virtual_speaker_node_division_gains = NULL; + vbap->object_mode_back_virtual_speaker_node_division_gains = NULL; +#endif vbap->num_speaker_nodes = num_speaker_nodes; vbap->num_speaker_nodes_internal = num_speaker_nodes; @@ -223,6 +236,14 @@ ivas_error vbap_init_data( vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; +#ifdef OMASA_UPDATES + if ( support_object_mode ) + { + vbap->object_mode_bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + set_zero( vbap->object_mode_bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); + is_success &= vbap->object_mode_bottom_virtual_speaker_node_division_gains != NULL; + } +#endif speaker_node_azi_deg_internal[vbap->bottom_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->bottom_virtual_speaker_node_index] = -90.0f; } @@ -232,6 +253,14 @@ ivas_error vbap_init_data( vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; +#ifdef OMASA_UPDATES + if ( support_object_mode ) + { + vbap->object_mode_top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + set_zero( vbap->object_mode_top_virtual_speaker_node_division_gains, num_speaker_nodes ); + is_success &= vbap->object_mode_top_virtual_speaker_node_division_gains != NULL; + } +#endif speaker_node_azi_deg_internal[vbap->top_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->top_virtual_speaker_node_index] = 90.0f; } @@ -241,6 +270,14 @@ ivas_error vbap_init_data( vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; +#ifdef OMASA_UPDATES + if ( support_object_mode ) + { + vbap->object_mode_back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + set_zero( vbap->object_mode_back_virtual_speaker_node_division_gains, num_speaker_nodes ); + is_success &= vbap->object_mode_back_virtual_speaker_node_division_gains != NULL; + } +#endif speaker_node_azi_deg_internal[vbap->back_virtual_speaker_node_index] = 180.0f; speaker_node_ele_deg_internal[vbap->back_virtual_speaker_node_index] = 0.0f; } @@ -319,11 +356,23 @@ ivas_error vbap_init_data( /* Determine how the virtual node gains should be distributed to real nodes, if necessary (checked within function). */ if ( is_success ) { +#ifdef OMASA_UPDATES + determine_virtual_speaker_node_division_gains( vbap->top_virtual_speaker_node_index, vbap->top_virtual_speaker_node_division_gains, connections, virtual_top_type, max_num_connections, num_speaker_nodes, 0 ); + determine_virtual_speaker_node_division_gains( vbap->bottom_virtual_speaker_node_index, vbap->bottom_virtual_speaker_node_division_gains, connections, virtual_bottom_type, max_num_connections, num_speaker_nodes, 0 ); + determine_virtual_speaker_node_division_gains( vbap->back_virtual_speaker_node_index, vbap->back_virtual_speaker_node_division_gains, connections, virtual_back_type, max_num_connections, num_speaker_nodes, 0 ); + if ( support_object_mode ) + { + determine_virtual_speaker_node_division_gains( vbap->top_virtual_speaker_node_index, vbap->object_mode_top_virtual_speaker_node_division_gains, connections, virtual_top_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); + determine_virtual_speaker_node_division_gains( vbap->bottom_virtual_speaker_node_index, vbap->object_mode_bottom_virtual_speaker_node_division_gains, connections, virtual_bottom_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); + determine_virtual_speaker_node_division_gains( vbap->back_virtual_speaker_node_index, vbap->object_mode_back_virtual_speaker_node_division_gains, connections, virtual_back_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); + } +#else determine_virtual_speaker_node_division_gains( vbap->top_virtual_speaker_node_index, vbap->top_virtual_speaker_node_division_gains, connections, virtual_top_type, max_num_connections, num_speaker_nodes ); determine_virtual_speaker_node_division_gains( vbap->bottom_virtual_speaker_node_index, vbap->bottom_virtual_speaker_node_division_gains, connections, virtual_bottom_type, max_num_connections, num_speaker_nodes ); determine_virtual_speaker_node_division_gains( vbap->back_virtual_speaker_node_index, vbap->back_virtual_speaker_node_division_gains, connections, virtual_back_type, max_num_connections, num_speaker_nodes ); +#endif } pop_wmops(); @@ -368,6 +417,20 @@ void vbap_free_data( { free( ( *hVBAPdata )->back_virtual_speaker_node_division_gains ); } +#ifdef OMASA_UPDATES + if ( ( *hVBAPdata )->object_mode_bottom_virtual_speaker_node_division_gains != NULL ) + { + free( ( *hVBAPdata )->object_mode_bottom_virtual_speaker_node_division_gains ); + } + if ( ( *hVBAPdata )->object_mode_top_virtual_speaker_node_division_gains != NULL ) + { + free( ( *hVBAPdata )->object_mode_top_virtual_speaker_node_division_gains ); + } + if ( ( *hVBAPdata )->object_mode_back_virtual_speaker_node_division_gains != NULL ) + { + free( ( *hVBAPdata )->object_mode_back_virtual_speaker_node_division_gains ); + } +#endif if ( ( *hVBAPdata )->search_struct[0].triplets != NULL ) { free( ( *hVBAPdata )->search_struct[0].triplets ); @@ -395,6 +458,10 @@ void vbap_determine_gains( float *gains, /* o : gain vector for loudspeakers for given direction */ const int16_t azi_deg, /* i : azimuth in degrees for panning direction (positive left)*/ const int16_t ele_deg /* i : elevation in degrees for panning direction (positive up)*/ +#ifdef OMASA_UPDATES + , + const int16_t use_object_mode /* i : select between object mode panning and spatial mode panning */ +#endif ) { /* This function formulates gains for the given angle. The triplet-selection has been pre-formulated. */ @@ -428,9 +495,24 @@ void vbap_determine_gains( bottom_virtual_speaker_node_index = hVBAPdata->bottom_virtual_speaker_node_index; top_virtual_speaker_node_index = hVBAPdata->top_virtual_speaker_node_index; back_virtual_speaker_node_index = hVBAPdata->back_virtual_speaker_node_index; +#ifdef OMASA_UPDATES + if ( use_object_mode ) + { + bottom_virtual_speaker_node_division_gains = hVBAPdata->object_mode_bottom_virtual_speaker_node_division_gains; + top_virtual_speaker_node_division_gains = hVBAPdata->object_mode_top_virtual_speaker_node_division_gains; + back_virtual_speaker_node_division_gains = hVBAPdata->object_mode_back_virtual_speaker_node_division_gains; + } + else + { + bottom_virtual_speaker_node_division_gains = hVBAPdata->bottom_virtual_speaker_node_division_gains; + top_virtual_speaker_node_division_gains = hVBAPdata->top_virtual_speaker_node_division_gains; + back_virtual_speaker_node_division_gains = hVBAPdata->back_virtual_speaker_node_division_gains; + } +#else bottom_virtual_speaker_node_division_gains = hVBAPdata->bottom_virtual_speaker_node_division_gains; top_virtual_speaker_node_division_gains = hVBAPdata->top_virtual_speaker_node_division_gains; back_virtual_speaker_node_division_gains = hVBAPdata->back_virtual_speaker_node_division_gains; +#endif panning_wrap_angles( (float) azi_deg, (float) ele_deg, &azi_temp, &ele_temp ); azi_rad = azi_temp * PI_OVER_180; @@ -679,6 +761,10 @@ static void determine_virtual_speaker_node_division_gains( const enum VirtualSpeakerNodeType type, /* i : virtual speaker node typel */ const int16_t max_num_connections, /* i : max number of connections */ const int16_t num_speaker_nodes /* i : max number of speaker nodes */ +#ifdef OMASA_UPDATES + , + const int16_t use_object_mode /* i : use VBAP in object panning mode vs. spatial panning mode */ +#endif ) { /* When node type is VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, the gains of the virtual node @@ -721,6 +807,12 @@ static void determine_virtual_speaker_node_division_gains( for ( ch = 0; ch < num_speaker_nodes; ch++ ) { virtual_node_division_gains[ch] /= sum_val; +#ifdef OMASA_UPDATES + if ( use_object_mode ) + { + virtual_node_division_gains[ch] = powf( virtual_node_division_gains[ch], 0.8f ); + } +#endif } } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index e3b8342896..861e1015c4 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -285,7 +285,7 @@ ivas_error ivas_cpe_enc( { #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) - { + { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } else diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index afb4fc8ac7..fcc77edd52 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -405,7 +405,7 @@ void ivas_signaling_enc( * Write element mode info *--------------------------------------------------------------------------*/ #ifdef OMASA_UPDATES - if ( (st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ + if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ #else if ( st->element_mode >= IVAS_CPE_DFT && element_brate < MIN_BRATE_MDCT_STEREO && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ #endif diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index de247c0a56..e4448b0f56 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -320,7 +320,7 @@ ivas_error ivas_enc( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { /* Configure oMASA analysis based on MASA config */ - ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); + ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); } /* Estimate TF-tile energy for the input MASA stream */ diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 1b6e2bd596..ff43a42536 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -481,7 +481,7 @@ ivas_error ivas_init_encoder( if ( ( error = ivas_ism_dtx_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; - } + } } #endif } @@ -631,9 +631,9 @@ ivas_error ivas_init_encoder( } } #ifdef OMASA_UPDATES - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM) ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) #else - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) #endif { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 97b689b5dd..b03b25f6c9 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -257,8 +257,8 @@ ivas_error ivas_ism_metadata_enc( #endif { /*----------------------------------------------------------------* - * Set Metadata presence / importance flag - *----------------------------------------------------------------*/ + * Set Metadata presence / importance flag + *----------------------------------------------------------------*/ for ( ch = 0; ch < num_obj; ch++ ) { @@ -295,8 +295,8 @@ ivas_error ivas_ism_metadata_enc( } /*----------------------------------------------------------------* - * Rate importance of particular ISm streams - *----------------------------------------------------------------*/ + * Rate importance of particular ISm streams + *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS if ( ism_mode == ISM_MASA_MODE_DISC ) { @@ -880,7 +880,7 @@ ivas_error ivas_ism_metadata_enc( int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; #ifdef OMASA_UPDATES int16_t brate_limit_flag; - brate_limit_flag = calculate_brate_limit_flag( ism_imp, num_obj ); + brate_limit_flag = calculate_brate_limit_flag( ism_imp, num_obj ); #endif bits_ism = (int16_t) ( *ism_total_brate / FRAMES_PER_SECOND ); @@ -892,7 +892,7 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < num_obj; ch++ ) { #ifdef OMASA_UPDATES - *ism_total_brate += ivas_interformat_brate( ism_mode, num_obj, hSCE[ch]->element_brate, ism_imp[ch],brate_limit_flag + *ism_total_brate += ivas_interformat_brate( ism_mode, num_obj, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag #else *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, num_obj, hSCE[ch]->element_brate, ism_imp[ch] #ifdef FIX_4OBJ_128 @@ -912,7 +912,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS #ifdef OMASA_UPDATES - if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { ivas_ism_config( *ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, 1 ); // VE: this funtion should return an error } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 07c313f002..dec4b97b3c 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -57,8 +57,7 @@ static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate ); #ifdef MASA_AND_OBJECTS -static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks, - const int16_t idx_separated_object, const int16_t ism_imp ); +static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks, const int16_t idx_separated_object, const int16_t ism_imp ); static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format, const ISM_MODE ism_mode ); @@ -66,7 +65,7 @@ static void quantize_ratio_ism_vector( float *ratio_ism, int16_t *idx, const int static int16_t index_slice_enum( const int16_t *ratio_ism_idx, int16_t no_ism ); -static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, const int16_t idx_sep_obj ); +static int16_t encode_ratio_ism_subframe( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, const int16_t idx_sep_obj ); static void transform_index_and_GR_encode( int16_t *diff_idx, int16_t len, int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); @@ -2183,8 +2182,7 @@ static void quantize_ratio_ism_vector( int16_t *idx, const int16_t nchan_ism, const float masa_to_total_energy_ratio, - const int16_t idx_sep_object -) + const int16_t idx_sep_object ) { int16_t i, j, best_i, best_i2; float dist, div, tmp, dist2, best_dist; @@ -2407,7 +2405,7 @@ static int16_t try_differential( b_signif = 0; - while ( (b_signif < numCodingBands) && (masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR) ) + while ( ( b_signif < numCodingBands ) && ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR ) ) { b_signif++; } @@ -2656,7 +2654,7 @@ static int16_t encode_ratio_ism_subframe( nbits0 = 0; nbits1 = 0; b_signif = 0; - while ( (b_signif < numCodingBands) && (masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR) ) + while ( ( b_signif < numCodingBands ) && ( masa_to_total_energy_ratio[b_signif] >= MASA2TOTAL_THR ) ) { b_signif++; } @@ -2793,9 +2791,6 @@ static int16_t encode_ratio_ism_subframe( } - - - static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -2805,8 +2800,7 @@ static void ivas_encode_masaism_metadata( const int16_t omasa_nbands, const int16_t omasa_nblocks, const int16_t idx_separated_object, - const int16_t ism_imp -) + const int16_t ism_imp ) { int16_t sf, band; uint8_t numCodingBands; @@ -3061,18 +3055,16 @@ static void ivas_encode_masaism_metadata( } } } - } } - calculate_nbits_meta( hMasa->data.nchan_ism, hMasa->data.q_energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); /* quantize directions */ for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) - { + { #ifdef OMASA_UPDATES if ( bits_ism[obj] < 8 ) { @@ -3089,7 +3081,7 @@ static void ivas_encode_masaism_metadata( push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); hIsmMeta[obj]->q_elevation_old = hIsmMeta[obj]->elevation; hIsmMeta[obj]->q_azimuth_old = hIsmMeta[obj]->azimuth; - } + } } else { @@ -3098,7 +3090,7 @@ static void ivas_encode_masaism_metadata( hIsmMeta[obj]->q_elevation_old = hIsmMeta[obj]->elevation; hIsmMeta[obj]->q_azimuth_old = hIsmMeta[obj]->azimuth; } - + #else idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 935ea5e342..ee0eadc3e6 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -50,8 +50,7 @@ * Local function prototypes *------------------------------------------------------------------------*/ -static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], - float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); +static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); @@ -347,7 +346,7 @@ void ivas_omasa_enc( ivas_masa_combine_directions( hMasa ); - hMasa->config.numCodingBands = (int8_t)n_bands_orig; + hMasa->config.numCodingBands = (int8_t) n_bands_orig; } /* force computation into high resolution */ @@ -579,7 +578,7 @@ void ivas_omasa_enc( ivas_masa_combine_directions( hMasa ); - hMasa->config.numCodingBands = (int8_t)n_bands_orig; + hMasa->config.numCodingBands = (int8_t) n_bands_orig; } /* force computation into high resolution */ @@ -618,7 +617,6 @@ void ivas_omasa_enc( hMasa->config.numCodingBands = numCodingBands_orig; hMasa->config.joinedSubframes = joinedSubframes_orig; - } else if ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index db6bf0293e..6de5688492 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -2074,7 +2074,7 @@ static void hrtfShGetHrtf( /*-------------------------------------------------------------------* * preProcessStereoTransportsForMovedObjects() * - * + * *-------------------------------------------------------------------*/ void preProcessStereoTransportsForMovedObjects( -- GitLab From 902c4f33417abce037f57b9c5c6b791735ee8d8a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 5 Apr 2023 16:56:42 +0200 Subject: [PATCH 076/591] fix crashes in native MASA decoder; changes are within OMASA_BRATE_SW --- lib_dec/ivas_dec.c | 4 ++++ lib_dec/ivas_init_dec.c | 23 ++++++++++++------- lib_dec/ivas_masa_dec.c | 8 +++++++ lib_dec/ivas_omasa_dec.c | 48 +++++++++------------------------------- lib_dec/ivas_stat_dec.h | 3 +++ 5 files changed, 40 insertions(+), 46 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 10147488c0..0b590f3ef9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -900,6 +900,10 @@ ivas_error ivas_dec( st_ivas->ini_active_frame++; } +#ifdef OMASA_BRATE_SW + st_ivas->last_ivas_format = st_ivas->ivas_format; +#endif + #ifdef DEBUG_MODE_INFO dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e8fccfb9cf..a97da59693 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -181,18 +181,25 @@ ivas_error ivas_dec_setup( if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { #ifdef OMASA_BRATE_SW - if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#else - if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) + if ( st_ivas->last_ivas_format == MASA_FORMAT ) { - st_ivas->hCPE[0]->nchan_out = 1; +#endif + if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) + { + st_ivas->hCPE[0]->nchan_out = 1; + } + else + { + if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#ifdef OMASA_BRATE_SW } else { - if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 9d6e1d9612..31acee4924 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1478,6 +1478,14 @@ ivas_error ivas_masa_dec_reconfigure( #endif ); +#ifdef OMASA_BRATE_SW + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + st_ivas->nchan_ism = 0; + st_ivas->ism_mode = ISM_MODE_NONE; + } +#endif + return error; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 1afaa4696b..036b72a939 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -145,7 +145,6 @@ ivas_error ivas_omasa_dec_config( { int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; int32_t ivas_total_brate, ism_total_brate, cpe_brate; - IVAS_FORMAT ivas_format_old; ISM_MODE ism_mode_old; ivas_error error; @@ -157,26 +156,10 @@ ivas_error ivas_omasa_dec_config( ism_mode_old = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism ); st_ivas->ism_mode = ism_mode_old; - ivas_format_old = st_ivas->ivas_format; -#ifdef OMASA_UPDATES - if ( ism_mode_old == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) -#else - if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC ) -#endif - { - st_ivas->ivas_format = MASA_ISM_FORMAT; - } ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nSCE_old = st_ivas->nSCE; nchan_hp20_old = getNumChanSynthesis( st_ivas ); - /* reconstruct parameters */ - st_ivas->ivas_format = ivas_format_old; - if ( st_ivas->ivas_format == MASA_FORMAT ) - { - st_ivas->nchan_ism = 0; - } - /* set ism_mode of current frame */ st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); @@ -191,7 +174,6 @@ ivas_error ivas_omasa_dec_config( return error; } - // VE!!!!!: verification needed, see comment "/* Todo: Nokia make for MASA_ISM*/" in ivas_masa_dec_reconfigure() if ( cpe_brate < MASA_STEREO_MIN_BITRATE ) { st_ivas->hCPE[0]->nchan_out = 1; @@ -219,30 +201,20 @@ ivas_error ivas_omasa_dec_config( } /* reconfigure core-coders for ISMs */ - if ( st_ivas->ivas_format == MASA_FORMAT ) + k = 0; + while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, -1, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } + k++; } - else - { - k = 0; - while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) - { - k++; - } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; - } + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; + } - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; } if ( ism_mode_old != st_ivas->ism_mode ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index dd9aa2c94f..e1297e9381 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1218,6 +1218,9 @@ typedef struct Decoder_Struct DECODER_CONFIG_HANDLE hDecoderConfig; /* Decoder configuration structure */ IVAS_FORMAT ivas_format; /* IVAS format */ +#ifdef OMASA_BRATE_SW + IVAS_FORMAT last_ivas_format; /* last frame IVAS format */ +#endif int16_t sid_format; /* IVAS format indicator from SID frame */ int16_t nchan_transport; /* number of transport channels */ IVAS_OUTPUT_SETUP hOutSetup; /* output setup structure */ -- GitLab From 02723cade9388c4f42476be12fa63646749095c1 Mon Sep 17 00:00:00 2001 From: Auto Commit Date: Wed, 5 Apr 2023 14:32:35 -0400 Subject: [PATCH 077/591] as tested in the short AB test --- lib_com/ivas_prot.h | 6 +++--- lib_com/ivas_stereo_td_bit_alloc.c | 18 +++++++----------- lib_enc/ivas_cpe_enc.c | 18 +++++++----------- lib_enc/ivas_stereo_classifier.c | 14 -------------- lib_enc/ivas_stereo_td_analysis.c | 24 +++++++++++++----------- lib_enc/ivas_stereo_td_enc.c | 4 ++-- 6 files changed, 32 insertions(+), 52 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 56ec490530..ae82f8b2b6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1766,9 +1766,6 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ -#endif ); void stereo_classifier_init( @@ -1833,6 +1830,9 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ); void stereo_tdm_downmix( diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index b6d3f214b3..b0ae12ecd8 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -140,7 +140,8 @@ void tdm_bit_alloc( /* secondary channel bitrate allocation based on the energy scaling ratio */ #ifdef OMASA_TUNING - if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || + if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) + || ( IsOmasa == 1 && coder_type > UNVOICED ) ) #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) @@ -412,11 +413,11 @@ void tdm_bit_alloc( } *total_brate_sec += ( fast_FCB_rates_2sfr[idx] - tmp_rate ); } - ///* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ - //if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) - //{ - // *total_brate_sec += 100; - //} + /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ + if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) + { + *total_brate_sec += 100; + } /* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */ if ( element_brate_wo_meta - *total_brate_sec == ACELP_13k20 ) @@ -424,11 +425,6 @@ void tdm_bit_alloc( *total_brate_sec += 100; } } - /* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */ - if ( *total_brate_sec == PPP_NELP_2k80 || *total_brate_sec == SID_2k40 ) - { - *total_brate_sec += 100; - } *total_brate_pri = element_brate_wo_meta - *total_brate_sec; return; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 53a30ce4d5..6800966f99 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -169,20 +169,12 @@ ivas_error ivas_cpe_enc( #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) { - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k -#ifdef OMASA_TUNING - ,st_ivas->hOMasa!=NULL -#endif - ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); } else { #endif - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate -#ifdef OMASA_TUNING - ,st_ivas->hOMasa!=NULL -#endif - ); + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); #ifdef OMASA_UPDATES } #endif @@ -421,7 +413,11 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_TD ) { /* Determine the energy ratio between the 2 channels */ - tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); + tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM +#ifdef OMASA_TUNING + , st_ivas->hOMasa != NULL +#endif + ); /* Compute the downmix signal based on the ratio index */ stereo_tdm_downmix( hCPE->hStereoTD, sts[0]->input, sts[1]->input, input_frame, tdm_ratio_idx, ( ( hCPE->hStereoTD->tdm_LRTD_flag == 0 ) ? tdm_SM_or_LRTD_Pri : 0 ), tdm_ratio_idx_SM ); diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 36f06ccadc..8e20c13c8a 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -90,9 +90,6 @@ int16_t select_stereo_mode( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total brate */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ -#endif ) { int16_t element_mode; @@ -212,17 +209,6 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } -#ifdef OMASA_TUNING - else if ( element_mode == IVAS_CPE_TD && isOmasa ) - { - if ( ( hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) - { - hStereoClassif->lrtd_mode = 0; - hStereoClassif->prev_lrtd_mode = 0; - } - } -#endif - #ifdef DEBUG_MODE_TD dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/unclr_decision.enc" ); diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 70aaf2ebed..97522ef861 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -115,6 +115,9 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ +#ifdef OMASA_TUNING + ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#endif ) { float rms_R, rms_L; @@ -194,7 +197,16 @@ int16_t stereo_tdm_ener_analysis( * When the energies of channels are low enough, compute the ratio * of L and R needed to create new mono/side signals *----------------------------------------------------------------*/ +#ifdef OMASA_TUNING + if ( isOmasa ) + { + if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) + { + hStereoTD->prev_fr_LRTD_TD_dec = 0; + } + } +#endif rms_thd = RMS_MIN; if ( hCPE->hStereoClassif->lrtd_mode == 1 ) { @@ -229,17 +241,7 @@ int16_t stereo_tdm_ener_analysis( hStereoTD->prev_fr_LRTD_TD_dec = 0; } } - //if ( hCPE->hStereoTD != NULL ) - //{ - - // if ( /*hStereoClassif->lrtd_mode == 1*/ hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 && hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus < 12600 ) - // { - // //hStereoClassif->xtalk_decision = 0; - // //hStereoClassif->lrtd_mode = 0; - // hCPE->hStereoTD->prev_fr_LRTD_TD_dec = 0; - // //hCPE->hStereoClassif->lrtd_mode = 0; - // } - //} + side_can_change = 0; /* update LRTD->DFT stereo hangover counters */ diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 2f34424f70..6e13ec2075 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -431,9 +431,9 @@ void tdm_configure_enc( } hStereoTD->tdm_lp_reuse_flag = 1; #ifdef OMASA_TUNING - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 6000 && hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0 ) + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) #else - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 /*&& hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0*/ ) + if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) #endif { sts[1]->coder_type = INACTIVE; -- GitLab From ff5314ab3351a768ecb5d1ebfa5b4535e6542b0b Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 6 Apr 2023 08:49:50 +0200 Subject: [PATCH 078/591] fixes for bitrate switching and MC output config. --- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_init_dec.c | 23 +++++++++----- lib_dec/ivas_omasa_dec.c | 68 ++++++++++++++++++++++++++++------------ 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ecfa303713..c0deb07a1a 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -603,7 +603,7 @@ ivas_error ivas_dec( ivas_masa_ism_set_edited_objects( st_ivas ); /* Rendering */ - 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 ) { #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 792521c573..c26a94f2dc 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1541,19 +1541,26 @@ ivas_error ivas_init_decoder( } #ifdef OMASA_UPDATES - // VE: introduce a new renderer_type for this case - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + // VE: introduce a new renderer_type for this case + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL ) { - return error; + /* Allocate TD renderer for the objects in DISC mode */ + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + // VE: introduce a new renderer_type for this case + if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { - return error; + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 036b72a939..a688e0062f 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -271,39 +271,67 @@ ivas_error ivas_omasa_dec_config( } #ifdef OMASA_UPDATES - // VE: introduce a new renderer_type for this case - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { - /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - return error; - } + /* Allocate TD renderer for the objects in DISC mode */ + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else { - return error; + /* 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; + } + + /* ISM renderer handle */ + if ( st_ivas->hIsmRendererData != NULL ) + { + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } } } - else + + if ( st_ivas->renderer_type == RENDERER_DIRAC ) { - /* TD renderer handle */ - if ( st_ivas->hBinRendererTd != NULL ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + return error; } - if ( st_ivas->hHrtfTD != NULL ) // VE: this is copied from ivas_ism_bitrate_switching() but a review is needed + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - st_ivas->hHrtfTD = NULL; + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } - - /* ISM renderer handle */ - if ( st_ivas->hIsmRendererData != NULL ) + else { - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; + /* ISM renderer handle */ + if ( st_ivas->hIsmRendererData != NULL ) + { + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } } } #endif -- GitLab From 1b9e750b9f24208e15e8d8cd64547d222226a14c Mon Sep 17 00:00:00 2001 From: Auto Commit Date: Tue, 11 Apr 2023 06:49:44 -0400 Subject: [PATCH 079/591] just remove option2 as it didn't show significative improvement --- lib_com/ivas_stereo_td_bit_alloc.c | 2 +- lib_enc/ivas_stereo_classifier.c | 1 - lib_enc/ivas_stereo_td_enc.c | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index b0ae12ecd8..5daaf61e12 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -139,7 +139,7 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ -#ifdef OMASA_TUNING +#if defined OMASA_TUNING if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( IsOmasa == 1 && coder_type > UNVOICED ) ) diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 8e20c13c8a..534dc2189c 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -209,7 +209,6 @@ int16_t select_stereo_mode( set_f( hStereoClassif->xtalk_fv, -1.0f, SSC_MAX_NFEA ); } } - #ifdef DEBUG_MODE_TD dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/unclr_decision.enc" ); dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, L_FRAME16k, "res/xtalk_decision.enc" ); diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 6e13ec2075..11da8f6404 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -430,6 +430,7 @@ void tdm_configure_enc( sts[1]->coder_type = GENERIC; } hStereoTD->tdm_lp_reuse_flag = 1; + #ifdef OMASA_TUNING if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) #else -- GitLab From 4f30e166afc2d359b756ece40a960aa29014dae2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 11 Apr 2023 16:19:47 +0200 Subject: [PATCH 080/591] - rename compilation switch OMASA_TUNING to OMASA_TUNING_TD_STEREO - revert changes in MSVC project files --- Workspace_msvc/decoder.vcxproj | 6 +++--- Workspace_msvc/encoder.vcxproj | 8 ++++---- Workspace_msvc/lib_com.vcxproj | 8 ++++---- Workspace_msvc/lib_debug.vcxproj | 8 ++++---- Workspace_msvc/lib_dec.vcxproj | 8 ++++---- Workspace_msvc/lib_enc.vcxproj | 8 ++++---- Workspace_msvc/lib_rend.vcxproj | 8 ++++---- Workspace_msvc/lib_util.vcxproj | 8 ++++---- Workspace_msvc/renderer.vcxproj | 8 ++++---- lib_com/ivas_prot.h | 16 ++++++++-------- lib_com/ivas_stereo_td_bit_alloc.c | 11 +++++------ lib_com/options.h | 2 +- lib_dec/ivas_cpe_dec.c | 9 +++++---- lib_dec/ivas_stereo_td_dec.c | 12 +++++++----- lib_enc/ivas_cpe_enc.c | 10 ++++++---- lib_enc/ivas_stereo_td_analysis.c | 10 ++++++---- lib_enc/ivas_stereo_td_enc.c | 16 +++++++++------- 17 files changed, 82 insertions(+), 74 deletions(-) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index f0016965e0..e59992847c 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -14,18 +14,18 @@ decoder {E3DCBC31-7FC9-D127-E000-529F8460D5FD} decoder - 10.0 + 10.0.17763.0 Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index fc7e189560..bcfe92a4db 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -18,24 +18,24 @@ encoder {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} encoder - 10.0 + 10.0.17763.0 Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index ed8012c4d3..78ed7bb39d 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -17,24 +17,24 @@ {39EC200D-7795-4FF8-B214-B24EDA5526AE} common - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 6a5e102b0c..3b648fae04 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -17,22 +17,22 @@ {54509728-928B-44D9-A118-A6F92F08B34F} debug - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index facb2d3bc3..dd2ed44443 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -18,24 +18,24 @@ lib_dec {E822DDAF-0F5F-4CD0-A694-38AE69DE74D3} evs_dec - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index eede51cfde..af7ca35b12 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -18,24 +18,24 @@ lib_enc {824DA4CF-06F0-45C9-929A-8792F0E19C3E} evs_enc - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 1cb397d10f..865652649a 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -18,24 +18,24 @@ lib_rend {718DE063-A18B-BB72-9150-62B892E6FFA6} evs_dec - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte StaticLibrary - v142 + v141 false MultiByte diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index d1a1a8d818..5b5e5f30cc 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -17,22 +17,22 @@ {2FA8F384-0775-F3B7-F8C3-85209222FC70} utility - 10.0 + 10.0.17763.0 StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte StaticLibrary - v142 + v141 MultiByte true diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index d90b4a6251..94ad9f774e 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -18,24 +18,24 @@ renderer {12B4C8A5-1E06-4E30-B443-D1F916F52B47} renderer - 10.0 + 10.0.17763.0 Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte Application - v142 + v141 false MultiByte diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 61a40222ed..0964ffe870 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1825,8 +1825,8 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t isOmasa /* i : flag that indicates OMASA format */ #endif ); @@ -1849,8 +1849,8 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ); @@ -1906,8 +1906,8 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ); @@ -1932,8 +1932,8 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#ifdef OMASA_TUNING_TD_STEREO + ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ); diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 5daaf61e12..ac56cd6537 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -88,8 +88,9 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx_ref /* i : instantaneous correlation ratio idx */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : Flag that indicates presence of OMASA */ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ) { @@ -139,10 +140,8 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ -#if defined OMASA_TUNING - if ( (IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) - || - ( IsOmasa == 1 && coder_type > UNVOICED ) ) +#ifdef OMASA_TUNING_TD_STEREO + if ( ( IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( IsOmasa == 1 && coder_type > UNVOICED ) ) #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) #endif diff --git a/lib_com/options.h b/lib_com/options.h index ce6430957f..024ea86156 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,7 @@ #define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ #define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ #define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA -#define OMASA_TUNING +#define OMASA_TUNING_TD_STEREO /* VA: tuning of TD stereo in OMASA format */ #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index f42dfe42e7..d1495e7f91 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -413,11 +413,12 @@ ivas_error ivas_cpe_dec( { if ( !st_ivas->bfi ) { - tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata -#ifdef OMASA_TUNING - , (st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4)) + tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata +#ifdef OMASA_TUNING_TD_STEREO + , + ( st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4 ) ) #endif - ); + ); sts[1]->bit_stream = sts[0]->bit_stream + ( sts[0]->total_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 7cfa3d92fd..e613e8ea2e 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -87,8 +87,9 @@ void tdm_configure_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t IsOmasa /* i : flag that indicates OMASA format*/ #endif ) @@ -313,10 +314,11 @@ void tdm_configure_dec( hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx -#ifdef OMASA_TUNING - ,IsOmasa +#ifdef OMASA_TUNING_TD_STEREO + , + IsOmasa #endif - ); + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 0865e2b281..422d7f9156 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -414,8 +414,9 @@ ivas_error ivas_cpe_enc( { /* Determine the energy ratio between the 2 channels */ tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM -#ifdef OMASA_TUNING - , st_ivas->hOMasa != NULL +#ifdef OMASA_TUNING_TD_STEREO + , + st_ivas->hOMasa != NULL #endif ); @@ -584,8 +585,9 @@ ivas_error ivas_cpe_enc( tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr ); tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata -#ifdef OMASA_TUNING - ,st_ivas->hOMasa != NULL +#ifdef OMASA_TUNING_TD_STEREO + , + st_ivas->hOMasa != NULL #endif ); diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 97522ef861..5ef8001b7a 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -115,8 +115,9 @@ int16_t stereo_tdm_ener_analysis( const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ -#ifdef OMASA_TUNING - ,const int16_t isOmasa /* i : Flag to indicate that Omasa is present */ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t isOmasa /* i : flag that indicates OMASA format */ #endif ) { @@ -197,8 +198,9 @@ int16_t stereo_tdm_ener_analysis( * When the energies of channels are low enough, compute the ratio * of L and R needed to create new mono/side signals *----------------------------------------------------------------*/ -#ifdef OMASA_TUNING - if ( isOmasa ) + +#ifdef OMASA_TUNING_TD_STEREO + if ( isOmasa ) { if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 11da8f6404..82e3f4bdfd 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -309,8 +309,9 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING - ,const int16_t IsOmasa /* i : flag that indicate the presence of Omasa*/ +#ifdef OMASA_TUNING_TD_STEREO + , + const int16_t IsOmasa /* i : flag that indicates OMASA format */ #endif ) { @@ -425,13 +426,13 @@ void tdm_configure_enc( #ifdef MASA_AND_OBJECTS if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) { - if ( sts[1]->coder_type == UNVOICED) + if ( sts[1]->coder_type == UNVOICED ) { sts[1]->coder_type = GENERIC; } hStereoTD->tdm_lp_reuse_flag = 1; -#ifdef OMASA_TUNING +#ifdef OMASA_TUNING_TD_STEREO if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) #else if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) @@ -488,10 +489,11 @@ void tdm_configure_enc( hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx -#ifdef OMASA_TUNING - ,IsOmasa +#ifdef OMASA_TUNING_TD_STEREO + , + IsOmasa #endif - ); + ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #endif -- GitLab From 6e84dd1c22ac89b7b8adbcb4504a8a1e46b1a199 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Apr 2023 15:49:04 +0200 Subject: [PATCH 081/591] comment --- lib_enc/ivas_masa_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index dd025797d2..5e81132ced 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2315,11 +2315,12 @@ static void copy_masa_metadata( * Compare the similarity of MASA metadata in two sub-frames *-------------------------------------------------------------------*/ +/* r: similarity decision */ static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ const MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ - const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ + const uint8_t sf2_idx /* i : index of the subframe of frame2 to inspect */ ) { uint8_t num_dir; -- GitLab From e71215d99e750557a18aa57573de637d6f19ec6c Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 19 Apr 2023 15:27:03 +0300 Subject: [PATCH 082/591] Disable switch for issue 350 to restore BE within OMASA until branch is fully adapted to it. --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 29d3c3340e..8bd854e1b4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,7 @@ #define FIX_103_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ /*#define SBA_HPF_TUNING_DEC*/ -#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ +/*#define FIX_350_MASA_DELAY_COMP*/ /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ -- GitLab From d34332b6fe1b4b0fff45c990d7f76f2e32e53352 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Thu, 20 Apr 2023 10:13:54 +0300 Subject: [PATCH 083/591] Fixes to stereo, binaural_room, and edited rendering, and fixes to msan errors. --- lib_com/bitstream.c | 14 ++++++++++---- lib_dec/ivas_masa_dec.c | 4 ++++ lib_dec/lib_dec.c | 4 ++++ lib_rend/ivas_dirac_dec_binaural_functions.c | 17 +++++++++++------ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 3b11ab8c3d..ac201dffbc 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1979,17 +1979,22 @@ ivas_error preview_indices( else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { /* read number of objects from the bitstream */ +#ifdef OMASA_UPDATES + st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ + st_ivas->nchan_ism = 0; +#else st_ivas->nchan_transport = 0; +#endif if ( total_brate != SID_2k40 && total_brate != FRAME_NO_DATA ) { +#ifdef OMASA_UPDATES + st_ivas->nchan_ism = 2 * bit_stream[total_brate / FRAMES_PER_SEC - 1] + bit_stream[total_brate / FRAMES_PER_SEC - 2] + 1; +#endif st_ivas->ism_mode = ivas_omasa_ism_mode_select( total_brate, st_ivas->nchan_ism ); -#ifdef OMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else +#ifndef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { st_ivas->nchan_transport = 0; } @@ -2004,6 +2009,7 @@ ivas_error preview_indices( st_ivas->nchan_transport++; k--; } +#endif } } #endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 38ef2a4c06..959300ca74 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2462,6 +2462,10 @@ void ivas_masa_ism_set_edited_objects( { hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism] = st_ivas->azimuth_edited; hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism] = st_ivas->elevation_edited; +#ifdef OMASA_UPDATES + st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->azimuth = st_ivas->azimuth_edited; + st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->elevation = st_ivas->elevation_edited; +#endif } } #ifdef OMASA_UPDATES diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index bcd93ece03..1826052808 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2026,7 +2026,11 @@ static ivas_error printConfigInfo_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifdef OMASA_UPDATES + fprintf( stdout, "Input configuration: combined ISM and MASA (%i ISM stream(s)) \n", st_ivas->nchan_ism ); +#else fprintf( stdout, "Input configuration: combined ISM and MASA (%i separated ISM stream(s)) \n", st_ivas->nchan_transport ); +#endif } #endif } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index e219e5bd54..1e1e591508 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -467,6 +467,10 @@ static void ivas_dirac_dec_binaural_internal( { numInChannels++; } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + numInChannels += (uint8_t) st_ivas->nchan_ism; + } #else if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) { @@ -1220,6 +1224,13 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( } #endif } +#ifdef OMASA_UPDATES + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + separateCenterChannelRendering = 1; + nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; + } +#endif #else separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; #endif @@ -1386,11 +1397,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifdef OMASA_UPDATES - aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism; - eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; - instantChange = 1; -#else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB]; @@ -1402,7 +1408,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; instantChange = 1; } -#endif } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) -- GitLab From 9649dad5232f5eabca597721934243e9890435ca Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 12:29:34 +0200 Subject: [PATCH 084/591] fix build when MASA_AND_OBJECTS is disabled --- lib_com/options.h | 10 +++++----- lib_dec/ivas_cpe_dec.c | 2 ++ lib_dec/ivas_sce_dec.c | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8bd854e1b4..f5f9f9d214 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,13 +58,13 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO -#define DEBUG_MODE_ACELP /* output most important ACELP core parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ -/*#define DEBUG_MODE_DFT */ /* output most important DFT stereo parameters to the subdirectory "res/" */ -#define DEBUG_MODE_TD /* output most important TD stereo parameters to the subdirectory "res/ */ -//#define DEBUG_MODE_DIRAC /* output most important DIRAC parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_DFT */ /* output most important DFT stereo parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ +/*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index f78f5f08c8..12bcab4584 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -597,12 +597,14 @@ ivas_error ivas_cpe_dec( dbgwrite( output[j], sizeof( float ), output_frame, 1, fname( debug_dir, "output.cpe", j, cpe_id, DEC ) ); } +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) { tmpF = 0; dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.sce", 0, cpe_id, DEC ) ); dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, cpe_id, DEC ) ); } +#endif } } #endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index ccb5fcca89..dc44097d9d 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -326,12 +326,14 @@ ivas_error ivas_sce_dec( dbgwrite( output, sizeof( float ), output_frame, 1, fname( debug_dir, "output.sce", 0, sce_id, DEC ) ); +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) { tmpF = 0; dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.cpe", 0, sce_id, DEC ) ); dbgwrite( &tmpF, sizeof( float ), 1, output_frame, fname( debug_dir, "output.mct", 0, sce_id, DEC ) ); } +#endif } } #endif -- GitLab From 8d38e91d2277806687070c44d9c38cfbdb70307e Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 12:32:04 +0200 Subject: [PATCH 085/591] fix in tdm_configure_dec() within MASA_AND_OBJECTS --- lib_dec/ivas_stereo_td_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index e613e8ea2e..fbfa270727 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -291,7 +291,7 @@ void tdm_configure_dec( /* set the BW of the secondary channel */ #ifdef MASA_AND_OBJECTS - if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel > IVAS_16k4 / FRAMES_PER_SEC ) + if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel >= IVAS_16k4 / FRAMES_PER_SEC ) #else if ( hStereoTD->tdm_LRTD_flag && hCPE->element_brate > IVAS_13k2 ) #endif -- GitLab From d5025ce2109d4e1934b148b311443a2b3690c4e2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 12:34:40 +0200 Subject: [PATCH 086/591] clang-format --- lib_dec/ivas_dirac_dec.c | 82 ++++++++++++++++----------------- lib_dec/ivas_ism_metadata_dec.c | 12 ++--- lib_dec/ivas_ism_renderer.c | 6 +-- lib_enc/ivas_cpe_enc.c | 4 +- lib_enc/ivas_enc.c | 4 +- lib_enc/ivas_stereo_td_enc.c | 4 +- 6 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index e471738ca3..e2bf03e4fb 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -321,7 +321,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } ivas_masa_init_stereotype_detection( hDirAC->masa_stereo_type_detect ); } @@ -401,7 +401,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } if ( hDirAC->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) @@ -410,7 +410,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_s( hDirAC->proto_index_dir, 0, hDirAC->num_outputs_dir ); @@ -420,7 +420,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); @@ -543,7 +543,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } /* reallocate static memory */ else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->num_outputs_dir != num_outputs_dir_old ) @@ -553,7 +553,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } if ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) @@ -574,7 +574,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder && ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) { @@ -583,7 +583,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_f( hDirAC->hoa_encoder, 0.0f, nchan_out_woLFE * hDirAC->num_outputs_diff ); compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirAC->hoa_encoder, hDirAC->num_outputs_diff, hDirAC->hOutSetup.ambisonics_order ); @@ -673,17 +673,17 @@ ivas_error ivas_dirac_dec_config( if ( ( flag_config == DIRAC_OPEN && hDirAC->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; - } + } } else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { @@ -697,19 +697,19 @@ ivas_error ivas_dirac_dec_config( ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; + } } } - } /* output synthesis */ if ( flag_config == DIRAC_OPEN ) @@ -755,7 +755,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } else if ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->num_protos_diff != num_protos_diff_old ) ) { @@ -764,9 +764,9 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } } - } if ( flag_config == DIRAC_OPEN ) @@ -793,7 +793,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } @@ -1329,9 +1329,9 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } - } hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; hDirAC->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; hDirAC->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; @@ -1388,17 +1388,17 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + } } else { if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } - } hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; @@ -1410,7 +1410,7 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + } if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) { @@ -1435,10 +1435,10 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } - } else { if ( num_protos_dir > 2 ) @@ -1446,7 +1446,7 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + } } if ( hDirAC->proto_signal_decorr_on ) @@ -1454,9 +1454,9 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } - } return IVAS_ERR_OK; } @@ -1755,10 +1755,10 @@ void ivas_qmetadata_to_dirac( { meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { hDirAC->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; hDirAC->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; hDirAC->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; @@ -1827,10 +1827,10 @@ void ivas_qmetadata_to_dirac( { meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { hDirAC->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; hDirAC->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; hDirAC->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; @@ -1883,7 +1883,7 @@ void ivas_qmetadata_to_dirac( set_s( hDirAC->elevation2[meta_write_index], 0, hDirAC->num_freq_bands ); set_zero( hDirAC->energy_ratio2[meta_write_index], hDirAC->num_freq_bands ); set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); - } + } } #endif } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 1cc7028c55..0565447847 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -396,8 +396,8 @@ ivas_error ivas_ism_metadata_dec( if ( ism_metadata_flag_global ) { /*----------------------------------------------------------------* - * Metadata decoding and dequantization, loop over all objects - *----------------------------------------------------------------*/ + * Metadata decoding and dequantization, loop over all objects + *----------------------------------------------------------------*/ int16_t total_bits_metadata = 0, bits_metadata_ism = 0; int16_t nb_bits_objcod_read; @@ -732,8 +732,8 @@ ivas_error ivas_ism_metadata_dec( } /*----------------------------------------------------------------* - * Set bitsream pointers - *----------------------------------------------------------------*/ + * Set bitsream pointers + *----------------------------------------------------------------*/ /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; @@ -747,8 +747,8 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG /*----------------------------------------------------------------* - * Updates - *----------------------------------------------------------------*/ + * Updates + *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, nchan_ism ); diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 00d93d15b6..119845d462 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -256,8 +256,8 @@ void ivas_ism_get_stereo_gains( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------------* -* ivas_masa_ism_separate_object_renderer_open() -* + * ivas_masa_ism_separate_object_renderer_open() + * * Open structures, reserve memory, and init values. *-------------------------------------------------------------------------*/ @@ -348,7 +348,7 @@ void ivas_masa_ism_separate_object_render( lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; #ifdef OMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) #else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 490cd41d1e..bfa7d86756 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -820,7 +820,7 @@ ivas_error ivas_cpe_enc( dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_NCShift" ); dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_ica_gD" ); n = -1; - //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + // dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } else if ( hCPE->element_mode == IVAS_CPE_TD ) { @@ -837,7 +837,7 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { n = -2; - //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + // dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 5d329701cb..920193c999 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -249,7 +249,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif ) ) != IVAS_ERR_OK ) { @@ -459,7 +459,7 @@ ivas_error ivas_enc( if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 82e3f4bdfd..7c0649c5ab 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -283,8 +283,8 @@ ivas_error stereo_set_tdm( dbgwrite( &tmp, 2, 1, 320, "res/inst_ratio_L" ); dbgwrite( &ftmp, 4, 1, 320, "res/ratio_L" ); dbgwrite( &tmp, 2, 1, 320, "res/tdm_low_rate_mode" ); - //dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); - //dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); + // dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); + // dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); } #endif hCPE->hCoreCoder[0]->tdm_LRTD_flag = 0; -- GitLab From b12b6b9a5cd566d1778323c0c7f1d148f8f2f4cc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 12:37:50 +0200 Subject: [PATCH 087/591] build warnings --- lib_enc/ivas_masa_enc.c | 4 ++-- lib_enc/ivas_omasa_enc.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 5e81132ced..c62fc4b3bf 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -71,7 +71,7 @@ static void quantize_ratio_ism_vector( const float *ratio_ism, int16_t *idx, con static int16_t index_slice_enum( const int16_t *ratio_ism_idx, const int16_t nchan_ism ); -static int16_t encode_ratio_ism_subframe( const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, const int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, const int16_t idx_sep_obj ); +static int16_t encode_ratio_ism_subframe( const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const uint8_t numCodingBands, const int16_t sf, const int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, const int16_t idx_sep_obj ); static void transform_index_and_GR_encode( int16_t *diff_idx, const int16_t len, const int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); @@ -3064,7 +3064,7 @@ static void estimate_bits_subband_ism_ratio( static int16_t encode_ratio_ism_subframe( const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, - const int16_t numCodingBands, + const uint8_t numCodingBands, const int16_t sf, const int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 86b5cbe90f..ac89c528a6 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -228,13 +228,11 @@ ivas_error ivas_omasa_enc_config( { int16_t k, sce_id, nSCE_old; int32_t ivas_total_brate, ism_total_brate; - ISM_MODE ism_mode_old; ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; - ism_mode_old = st_ivas->ism_mode; nSCE_old = st_ivas->nSCE; st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, hEncoderConfig->nchan_ism ); -- GitLab From a0fdc85f356f42c6c7383d8cdddc33912839b683 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 13:12:25 +0200 Subject: [PATCH 088/591] build warnings --- lib_enc/ivas_masa_enc.c | 45 +++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index c62fc4b3bf..67c935d187 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -67,20 +67,6 @@ static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_H #endif ); -static void quantize_ratio_ism_vector( const float *ratio_ism, int16_t *idx, const int16_t nchan_ism, const float masa_to_total_energy_ratio, const int16_t idx_sep_object ); - -static int16_t index_slice_enum( const int16_t *ratio_ism_idx, const int16_t nchan_ism ); - -static int16_t encode_ratio_ism_subframe( const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const uint8_t numCodingBands, const int16_t sf, const int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, const int16_t idx_sep_obj ); - -static void transform_index_and_GR_encode( int16_t *diff_idx, const int16_t len, const int16_t GR_order, BSTR_ENC_HANDLE hMetaData ); - -static void transform_difference_index( const int16_t *diff_idx, int16_t *idx, const int16_t len ); - -static void independent_coding_ratio_ism_idx( const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const float *masa_to_total_energy_ratio, const int16_t nchan_ism, const int16_t numCodingBands, const int16_t bits_index, BSTR_ENC_HANDLE hMetaData ); - -static void remove_sep_obj( int16_t *diff_idx, const int16_t nchan_ism, const int16_t idx_sep_obj ); - #else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif @@ -764,6 +750,7 @@ ivas_error ivas_masa_enc_config( { #ifdef FIX_382_MASA_META_FRAMING_ASYNC detect_framing_async( hMasa ); /* detect the offset, set 1sf/4sf mode based on this. potentially also shift the metadata using a history buffer */ + if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { /* average over sub-frames */ @@ -2871,7 +2858,7 @@ static void transform_index_and_GR_encode( int16_t *diff_idx, /* i : differenc eindex to encode */ const int16_t len, /* i : input length */ const int16_t GR_order, /* i : GR order */ - BSTR_ENC_HANDLE hMetaData /* i/o: bitstream */ + BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */ ) { int16_t i; @@ -2893,7 +2880,7 @@ static void transform_index_and_GR_encode( static int16_t try_differential( const int16_t numCodingBands, const float *masa_to_total_energy_ratio, - const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t bits_index, int16_t *p_b_signif ) @@ -2945,7 +2932,7 @@ static void differential_coding_first_subframe( BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t b_signif, - const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t bits_index ) @@ -2982,12 +2969,12 @@ static void differential_coding_first_subframe( static void independent_coding_ratio_ism_idx( - const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i : ISM ratios */ - const float *masa_to_total_energy_ratio, /* i : MASA to total ratios */ - const int16_t nchan_ism, /* i : number of objects */ - const int16_t numCodingBands, /* i : number of subbands */ - const int16_t bits_index, /* i : number of bits per index */ - BSTR_ENC_HANDLE hMetaData /* i/o: bitstream */ + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i : ISM ratios */ + const float *masa_to_total_energy_ratio, /* i : MASA to total ratios */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t numCodingBands, /* i : number of subbands */ + const int16_t bits_index, /* i : number of bits per index */ + BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */ ) { int16_t b, index; @@ -3040,14 +3027,16 @@ static void estimate_bits_subband_ism_ratio( /* take difference with respect to previous subframe */ v_sub_s( ratio_ism_idx, ratio_ism_idx_ref, diff_idx, nchan_ism ); + if ( shift_one ) { remove_sep_obj( diff_idx, nchan_ism, idx_sep_obj ); } + /* transform difference index into positive */ transform_difference_index( diff_idx, diff_idx, nchan_ism - 1 - shift_one ); - /* GR encoding */ + /* GR encoding */ for ( i = 0; i < nchan_ism - 1 - shift_one; i++ ) { nbits0 += ivas_qmetadata_encode_extended_gr_length( diff_idx[i], 100, 0 ); @@ -3062,11 +3051,11 @@ static void estimate_bits_subband_ism_ratio( static int16_t encode_ratio_ism_subframe( - const int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const uint8_t numCodingBands, const int16_t sf, - const int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], + int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], BSTR_ENC_HANDLE hMetaData, const float *masa_to_total_energy_ratio, const int16_t shift_one, @@ -3289,6 +3278,7 @@ static int16_t encode_ratio_ism_subframe( { /* take difference with respect to previous subframe */ v_sub_s( ratio_ism_idx[0], ratio_ism_idx_prev_sf[0], diff_idx, nchan_ism ); + if ( shift_one ) { remove_sep_obj( diff_idx, nchan_ism, idx_sep_obj_local ); @@ -3478,8 +3468,10 @@ static void ivas_encode_masaism_metadata( assert( ( hMasa->data.energy_ratio_ism[sf][band][obj] >= 0 ) && ( hMasa->data.energy_ratio_ism[sf][band][obj] <= 1 ) ); ratio_ism[band][obj] = hMasa->data.energy_ratio_ism[sf][band][obj]; } + /* Quantize ISM ratios */ quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band], idx_separated_object ); + if ( n_ism_tmp == numCodingBands && ratio_ism_idx[band][idx_separated_object] != 0 && hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) { i = 0; @@ -3553,7 +3545,6 @@ static void ivas_encode_masaism_metadata( encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 0, idx_separated_object ); } - /* calculate quantized ISM ratios */ /* save previous subframe indexes */ for ( band = 0; band < numCodingBands; band++ ) -- GitLab From ea30c7e221bfe2cbb1395943c3730e0aa591e7c4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 13:21:46 +0200 Subject: [PATCH 089/591] attempt to fix error: "MemorySanitizer: use-of-uninitialized-value" --- lib_dec/ivas_dirac_output_synthesis_dec.c | 1 + lib_dec/ivas_masa_dec.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 40883784bd..461ce67274 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -1526,6 +1526,7 @@ void ivas_dirac_dec_compute_directional_responses( num_channels_dir = hDirAC->num_outputs_dir; azimuth = hDirAC->azimuth[hDirAC->dirac_read_idx]; elevation = hDirAC->elevation[hDirAC->dirac_read_idx]; + #ifdef MASA_AND_OBJECTS if ( hDirAC->numParametricDirections == 2 ) #else diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 959300ca74..99c9cdaf60 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1523,6 +1523,9 @@ void ivas_spar_param_to_masa_param_mapping( /* Set values */ hDirAC = st_ivas->hDirAC; +#ifdef MASA_AND_OBJECTS + hDirAC->numParametricDirections = 1; +#endif hDirAC->numSimultaneousDirections = 1; hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; -- GitLab From fce075b35370a055aba597f2f02241c34672b1e9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 13:38:19 +0200 Subject: [PATCH 090/591] attempt to fix error: "MemorySanitizer: use-of-uninitialized-value" --- lib_rend/lib_rend.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3d2420632d..4249b4790e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5312,6 +5312,9 @@ static void copyMasaMetadataToDiracRenderer( int16_t meta_write_index; #endif +#ifdef MASA_AND_OBJECTS + hDirAC->numParametricDirections = meta->descriptive_meta.numberOfDirections; +#endif hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) -- GitLab From d9037ac9e13d6d893f7afbbe1bd00859bb6aaa98 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Apr 2023 14:21:34 +0200 Subject: [PATCH 091/591] updates within OMASA_TUNING_TD_STEREO --- lib_com/ivas_prot.h | 26 +++++++++++++------------- lib_com/ivas_stereo_td_bit_alloc.c | 9 ++++----- lib_dec/ivas_cpe_dec.c | 7 +++---- lib_dec/ivas_stereo_td_dec.c | 22 ++++++++++------------ lib_enc/ivas_cpe_enc.c | 14 ++++++-------- lib_enc/ivas_stereo_td_analysis.c | 10 +++++----- lib_enc/ivas_stereo_td_enc.c | 20 +++++++++----------- 7 files changed, 50 insertions(+), 58 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 1bc5b19ea4..3ca21a13d1 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1826,14 +1826,15 @@ void stereo_tdm_prep_dwnmx ( const float *input1, /* i : right channel input */ const int16_t input_frame /* i : frame lenght */ ); + int16_t stereo_tdm_ener_analysis( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif CPE_ENC_HANDLE hCPE, /* i : CPE structure */ const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ -#ifdef OMASA_TUNING_TD_STEREO - ,const int16_t isOmasa /* i : flag that indicates OMASA format */ -#endif ); void stereo_tdm_downmix( @@ -1852,13 +1853,12 @@ void stereo_td_init_dec( ); void tdm_configure_dec( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING_TD_STEREO - ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ -#endif - ); void tdm_upmix_plain( @@ -1905,6 +1905,9 @@ void tdm_ol_pitch_comparison( ); void tdm_configure_enc( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ @@ -1912,9 +1915,6 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING_TD_STEREO - ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ -#endif ); ivas_error signaling_enc_secondary( @@ -1924,6 +1924,9 @@ ivas_error signaling_enc_secondary( ); void tdm_bit_alloc( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ int32_t *total_brate_pri, /* o : Allocated primary channel bitrate */ @@ -1938,9 +1941,6 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */ -#ifdef OMASA_TUNING_TD_STEREO - ,const int16_t IsOmasa /* i : flag that indicates OMASA format */ -#endif ); void td_stereo_param_updt( diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index ac56cd6537..48c5eaf8ae 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -74,6 +74,9 @@ *-------------------------------------------------------------------*/ void tdm_bit_alloc( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ int32_t *total_brate_pri, /* o : Allocated primary channel bitrate */ @@ -88,10 +91,6 @@ void tdm_bit_alloc( const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t coder_type0, /* i : coder type (temporary in the encoder, from bitstream in decoder) */ const int16_t tdm_inst_ratio_idx_ref /* i : instantaneous correlation ratio idx */ -#ifdef OMASA_TUNING_TD_STEREO - , - const int16_t IsOmasa /* i : flag that indicates OMASA format */ -#endif ) { int16_t idx, four_subfr_fcb, two_subfr_fcb; @@ -141,7 +140,7 @@ void tdm_bit_alloc( /* secondary channel bitrate allocation based on the energy scaling ratio */ #ifdef OMASA_TUNING_TD_STEREO - if ( ( IsOmasa == 0 && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( IsOmasa == 1 && coder_type > UNVOICED ) ) + if ( ( ivas_format != MASA_ISM_FORMAT && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && coder_type > UNVOICED ) ) #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 12bcab4584..74f22590ad 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -413,12 +413,11 @@ ivas_error ivas_cpe_dec( { if ( !st_ivas->bfi ) { - tdm_configure_dec( hCPE, &tdm_ratio_idx, nb_bits_metadata + tdm_configure_dec( #ifdef OMASA_TUNING_TD_STEREO - , - ( st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_24k4 ) ) + st_ivas->ivas_format, #endif - ); + hCPE, &tdm_ratio_idx, nb_bits_metadata ); sts[1]->bit_stream = sts[0]->bit_stream + ( sts[0]->total_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index fbfa270727..d8e817638a 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -84,14 +84,12 @@ void stereo_td_init_dec( *-------------------------------------------------------------------*/ void tdm_configure_dec( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING_TD_STEREO - , - const int16_t IsOmasa /* i : flag that indicates OMASA format*/ -#endif - ) { STEREO_TD_DEC_DATA_HANDLE hStereoTD; @@ -310,15 +308,15 @@ void tdm_configure_dec( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, - hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), - &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx + tdm_bit_alloc( #ifdef OMASA_TUNING_TD_STEREO - , - IsOmasa + ivas_format, #endif - ); + + hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), + &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index bfa7d86756..48a343bec1 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -435,12 +435,11 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_TD ) { /* Determine the energy ratio between the 2 channels */ - tdm_ratio_idx = stereo_tdm_ener_analysis( hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM + tdm_ratio_idx = stereo_tdm_ener_analysis( #ifdef OMASA_TUNING_TD_STEREO - , - st_ivas->hOMasa != NULL + ivas_format, #endif - ); + hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); /* Compute the downmix signal based on the ratio index */ stereo_tdm_downmix( hCPE->hStereoTD, sts[0]->input, sts[1]->input, input_frame, tdm_ratio_idx, ( ( hCPE->hStereoTD->tdm_LRTD_flag == 0 ) ? tdm_SM_or_LRTD_Pri : 0 ), tdm_ratio_idx_SM ); @@ -606,12 +605,11 @@ ivas_error ivas_cpe_enc( { tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr ); - tdm_configure_enc( hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata + tdm_configure_enc( #ifdef OMASA_TUNING_TD_STEREO - , - st_ivas->hOMasa != NULL + ivas_format, #endif - ); + hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata ); if ( hEncoderConfig->Opt_DTX_ON ) { diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 5ef8001b7a..ee07ae2f52 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -111,14 +111,13 @@ static float Comp_diff_lt_corr( CPE_ENC_HANDLE hCPE, const int16_t IsSideMono, c *-------------------------------------------------------------------*/ int16_t stereo_tdm_ener_analysis( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif CPE_ENC_HANDLE hCPE, /* i : CPE structure */ const int16_t input_frame, /* i : Number of samples */ int16_t *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ int16_t *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ -#ifdef OMASA_TUNING_TD_STEREO - , - const int16_t isOmasa /* i : flag that indicates OMASA format */ -#endif ) { float rms_R, rms_L; @@ -200,7 +199,7 @@ int16_t stereo_tdm_ener_analysis( *----------------------------------------------------------------*/ #ifdef OMASA_TUNING_TD_STEREO - if ( isOmasa ) + if ( ivas_format == MASA_ISM_FORMAT ) { if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) @@ -209,6 +208,7 @@ int16_t stereo_tdm_ener_analysis( } } #endif + rms_thd = RMS_MIN; if ( hCPE->hStereoClassif->lrtd_mode == 1 ) { diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 7c0649c5ab..d8c8086562 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -302,6 +302,9 @@ ivas_error stereo_set_tdm( *-------------------------------------------------------------------*/ void tdm_configure_enc( +#ifdef OMASA_TUNING_TD_STEREO + const int16_t ivas_format, /* i : IVAS format */ +#endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ @@ -309,10 +312,6 @@ void tdm_configure_enc( const int16_t tdm_ratio_idx_SM, /* i : ratio index in SM mode */ const int16_t attack_flag, /* i : Primary channel attack flag */ const int16_t nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_TUNING_TD_STEREO - , - const int16_t IsOmasa /* i : flag that indicates OMASA format */ -#endif ) { int16_t tdm_ratio_bit_alloc_idx, mod_ct; @@ -485,15 +484,14 @@ void tdm_configure_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, - hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), - &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx + tdm_bit_alloc( #ifdef OMASA_TUNING_TD_STEREO - , - IsOmasa + ivas_format, #endif - ); + hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), + &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #endif -- GitLab From b852f843b388327e38f5f06a06618fe8f29adc35 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 25 Apr 2023 21:07:31 +0300 Subject: [PATCH 092/591] Changes sync between audio and metadata in OMASA to follow the paradigm in MASA. --- lib_com/delay_comp.c | 8 ++ lib_com/ivas_prot.h | 4 + lib_com/options.h | 3 +- lib_dec/ivas_dec.c | 49 +++++++ lib_dec/ivas_dirac_dec.c | 4 + lib_dec/ivas_dirac_output_synthesis_dec.c | 32 +++++ lib_dec/ivas_ism_renderer.c | 127 +++++++++++++------ lib_dec/ivas_masa_dec.c | 86 +++++++++++++ lib_dec/ivas_stat_dec.h | 11 ++ lib_enc/ivas_init_enc.c | 4 + lib_enc/ivas_omasa_enc.c | 28 ++++ lib_enc/ivas_stat_enc.h | 2 + lib_rend/ivas_dirac_dec_binaural_functions.c | 46 +++++++ 13 files changed, 362 insertions(+), 42 deletions(-) diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index b96798815e..909a335516 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -70,7 +70,11 @@ int32_t get_delay( delay = IVAS_ENC_DELAY_NS; #ifdef FIX_350_MASA_DELAY_COMP +#ifdef FIX_OMASA_DELAY_COMP + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { delay = 0; /* All delay is compensated in the decoder with MASA */ } @@ -108,7 +112,11 @@ int32_t get_delay( #ifdef FIX_350_MASA_DELAY_COMP +#ifdef FIX_OMASA_DELAY_COMP + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else if ( ivas_format == MASA_FORMAT ) +#endif { delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */ } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 1bc5b19ea4..f20fd0ab88 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5191,8 +5191,12 @@ ivas_error ivas_omasa_enc_open( ); void ivas_omasa_enc_close( +#ifdef FIX_OMASA_DELAY_COMP + OMASA_ENC_HANDLE hOMasa /* i/o: encoder OMASA handle */ +#else OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ const int16_t nchan_ism /* i : number of objects */ +#endif ); #ifdef OMASA_BRATE_SW diff --git a/lib_com/options.h b/lib_com/options.h index 8bd854e1b4..de3c8de9a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,7 @@ #define FIX_103_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ /*#define SBA_HPF_TUNING_DEC*/ -/*#define FIX_350_MASA_DELAY_COMP*/ /* Nokia: Issue 350: MASA audio/meta delay compensation */ +#define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ @@ -177,6 +177,7 @@ #define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ #define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA #define OMASA_TUNING_TD_STEREO /* VA: tuning of TD stereo in OMASA format */ +#define FIX_OMASA_DELAY_COMP /* Nokia: OMASA audio/meta delay compensation */ #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4b885ea217..c069a5847e 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -479,6 +479,10 @@ ivas_error ivas_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifdef FIX_OMASA_DELAY_COMP + int16_t dirac_bs_md_write_idx = 0; +#endif + st = st_ivas->hCPE[0]->hCoreCoder[0]; nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); @@ -498,6 +502,10 @@ ivas_error ivas_dec( { st_ivas->hDirAC->numIsmDirections = 0; } + +#ifdef FIX_OMASA_DELAY_COMP + dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ +#endif } /* MASA metadata decoding */ @@ -548,6 +556,13 @@ ivas_error ivas_dec( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) #endif { +#ifdef FIX_OMASA_DELAY_COMP + int16_t azimuth_ism; + int16_t elevation_ism; + int16_t block; + int16_t meta_write_index; +#endif + /* decode ISM metadata */ #ifdef NCHAN_ISM_PARAMETER if ( ( error = ivas_ism_metadata_dec( ism_total_brate, @@ -570,14 +585,38 @@ ivas_error ivas_dec( { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { +#ifdef FIX_OMASA_DELAY_COMP + azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); + elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; + st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; + } +#else st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); +#endif } } else /* ISM_MASA_MODE_MASA_ONE_OBJ */ { +#ifdef FIX_OMASA_DELAY_COMP + azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); + elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; + st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; + } +#else st_ivas->hMasaIsmData->azimuth_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); +#endif } #else for ( n = 0; n < st_ivas->nchan_ism; n++ ) @@ -687,6 +726,10 @@ ivas_error ivas_dec( #endif { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; +#ifdef FIX_OMASA_DELAY_COMP + int16_t dirac_read_idx; +#endif + #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) #else @@ -703,8 +746,14 @@ ivas_error ivas_dec( } } +#ifdef FIX_OMASA_DELAY_COMP + dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; +#endif ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); +#ifdef FIX_OMASA_DELAY_COMP + st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ +#endif ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index e471738ca3..4f19654485 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -845,7 +845,11 @@ ivas_error ivas_dirac_dec_config( { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; } +#ifdef FIX_OMASA_DELAY_COMP + else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) +#else else if ( st_ivas->ivas_format == MASA_FORMAT ) +#endif { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 40883784bd..e137962811 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -1626,12 +1626,20 @@ void ivas_dirac_dec_compute_directional_responses( } else { +#ifdef FIX_OMASA_DELAY_COMP + ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); +#else ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); +#endif } for ( l = 0; l < num_channels_dir; l++ ) { +#ifdef FIX_OMASA_DELAY_COMP + direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; +#else direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; +#endif } } @@ -1640,10 +1648,18 @@ void ivas_dirac_dec_compute_directional_responses( { masaDirect += hDirAC->energy_ratio2[subframe_idx][k]; } +#ifdef FIX_OMASA_DELAY_COMP + ismDirect = hMasaIsm->energy_ratio_ism[0][hDirAC->dirac_read_idx][k]; +#else ismDirect = hMasaIsm->energy_ratio_ism[0][subframe_idx][k]; +#endif for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) { +#ifdef FIX_OMASA_DELAY_COMP + ismDirect += hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; +#else ismDirect += hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; +#endif } totalDirect = masaDirect + ismDirect; @@ -1747,7 +1763,11 @@ void ivas_dirac_dec_compute_directional_responses( else { #ifdef OMASA_UPDATES +#ifdef FIX_OMASA_DELAY_COMP + vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], 1 ); +#else vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir], 1 ); +#endif #else vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir] ); #endif @@ -1755,7 +1775,11 @@ void ivas_dirac_dec_compute_directional_responses( for ( l = 0; l < num_channels_dir; l++ ) { +#ifdef FIX_OMASA_DELAY_COMP + direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; +#else direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; +#endif } } normalizePanningGains( direct_response_ism, num_channels_dir ); @@ -1765,10 +1789,18 @@ void ivas_dirac_dec_compute_directional_responses( { masaDirect += hDirAC->energy_ratio2[subframe_idx][k]; } +#ifdef FIX_OMASA_DELAY_COMP + ismDirect = hMasaIsm->energy_ratio_ism[0][hDirAC->dirac_read_idx][k]; +#else ismDirect = hMasaIsm->energy_ratio_ism[0][subframe_idx][k]; +#endif for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) { +#ifdef FIX_OMASA_DELAY_COMP + ismDirect += hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; +#else ismDirect += hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; +#endif } totalDirect = masaDirect + ismDirect; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 00d93d15b6..54856c700d 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -278,7 +278,11 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); } +#ifdef FIX_OMASA_DELAY_COMP + interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); +#else interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / 50 ); +#endif for ( i = 0; i < interpolator_length; i++ ) { st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length ); @@ -341,11 +345,20 @@ void ivas_masa_ism_separate_object_render( int16_t azimuth, elevation; int16_t num_objects; uint8_t single_separated; +#ifdef FIX_OMASA_DELAY_COMP + int16_t block; + int16_t subframe_len; + int16_t idx_offset; + int16_t dirac_read_idx; +#endif hVBAPdata = st_ivas->hVBAPdata; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; hRendererData = st_ivas->hIsmRendererData; lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; +#ifdef FIX_OMASA_DELAY_COMP + subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; +#endif #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) @@ -366,67 +379,99 @@ void ivas_masa_ism_separate_object_render( { delay_signal( input_f[obj], output_frame, st_ivas->hMasaIsmData->delayBuffer[obj], st_ivas->hMasaIsmData->delayBuffer_size ); /* Delay the signal to match CLDFB delay */ - if ( single_separated ) - { - azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism; - elevation = st_ivas->hMasaIsmData->elevation_separated_ism; - } - else +#ifdef FIX_OMASA_DELAY_COMP + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj]; - elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; - } + idx_offset = block * subframe_len; + dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; +#endif - if ( st_ivas->hOutSetup.is_planar_setup ) - { - /* If no elevation support in output format, then rendering should be done with zero elevation */ - elevation = 0; - } + if ( single_separated ) + { +#ifdef FIX_OMASA_DELAY_COMP + azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; + elevation = st_ivas->hMasaIsmData->elevation_separated_ism[dirac_read_idx]; +#else + azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism; + elevation = st_ivas->hMasaIsmData->elevation_separated_ism; +#endif + } + else + { +#ifdef FIX_OMASA_DELAY_COMP + azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj][dirac_read_idx]; + elevation = st_ivas->hMasaIsmData->elevation_ism[obj][dirac_read_idx]; +#else + azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj]; + elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; +#endif + } + + if ( st_ivas->hOutSetup.is_planar_setup ) + { + /* If no elevation support in output format, then rendering should be done with zero elevation */ + elevation = 0; + } #ifndef OMASA_UPDATES - else if ( output_config == AUDIO_CONFIG_7_1_4 || output_config == AUDIO_CONFIG_5_1_4 ) - { - /* For no negative elevations, it's better to map them to zero */ - elevation = elevation < 0 ? 0 : elevation; - } + else if ( output_config == AUDIO_CONFIG_7_1_4 || output_config == AUDIO_CONFIG_5_1_4 ) + { + /* For no negative elevations, it's better to map them to zero */ + elevation = elevation < 0 ? 0 : elevation; + } #endif - if ( hVBAPdata != NULL ) - { + if ( hVBAPdata != NULL ) + { #ifdef OMASA_UPDATES - vbap_determine_gains( hVBAPdata, gains, azimuth, elevation, 1 ); + vbap_determine_gains( hVBAPdata, gains, azimuth, elevation, 1 ); #else - vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); + vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); #endif - } - else - { - ivas_dirac_dec_get_response( azimuth, elevation, gains, st_ivas->hDirAC->hOutSetup.ambisonics_order ); - } - - for ( j = 0; j < nchan_out_woLFE; j++ ) - { - if ( st_ivas->hDirAC->hOutSetup.num_lfe > 0 ) - { - j2 = j + ( j >= lfe_index ); } else { - j2 = j; + ivas_dirac_dec_get_response( azimuth, elevation, gains, st_ivas->hDirAC->hOutSetup.ambisonics_order ); } - if ( fabsf( gains[j] ) > 0.0f || fabsf( hRendererData->prev_gains[obj][j] ) > 0.0f ) + for ( j = 0; j < nchan_out_woLFE; j++ ) { - for ( k = 0; k < output_frame; k++ ) + if ( st_ivas->hDirAC->hOutSetup.num_lfe > 0 ) { - g1 = hRendererData->interpolator[k]; - g2 = 1.0f - g1; - output_f[j2][k] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k]; + j2 = j + ( j >= lfe_index ); } + else + { + j2 = j; + } + + if ( fabsf( gains[j] ) > 0.0f || fabsf( hRendererData->prev_gains[obj][j] ) > 0.0f ) + { +#ifdef FIX_OMASA_DELAY_COMP + for ( k = 0; k < subframe_len; k++ ) +#else + for ( k = 0; k < output_frame; k++ ) +#endif + { + g1 = hRendererData->interpolator[k]; + g2 = 1.0f - g1; +#ifdef FIX_OMASA_DELAY_COMP + output_f[j2][k + idx_offset] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k + idx_offset]; +#else + output_f[j2][k] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k]; +#endif + } + } + hRendererData->prev_gains[obj][j] = gains[j]; } - hRendererData->prev_gains[obj][j] = gains[j]; +#ifdef FIX_OMASA_DELAY_COMP } +#endif } +#ifdef FIX_OMASA_DELAY_COMP + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % st_ivas->hDirAC->dirac_md_buffer_length; +#endif + return; } #endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 959300ca74..c91b31b288 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -80,7 +80,11 @@ static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hM static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); #ifdef MASA_AND_OBJECTS +#ifdef FIX_OMASA_DELAY_COMP +static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp, const int16_t dirac_bs_md_write_idx, const int16_t dirac_md_buffer_length ); +#else static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp ); +#endif static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, const int16_t nchan_ism, const int16_t K ); @@ -113,6 +117,9 @@ ivas_error ivas_masa_decode( #ifdef MASA_AND_OBJECTS int16_t obj; int16_t i, ch, ism_imp; +#ifdef FIX_OMASA_DELAY_COMP + int16_t dirac_bs_md_write_idx; +#endif ism_imp = 0; #endif @@ -329,7 +336,11 @@ ivas_error ivas_masa_decode( #endif { *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, +#ifdef FIX_OMASA_DELAY_COMP + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); +#else st_ivas->hMasaIsmData->idx_separated_ism, ism_imp ); +#endif } #ifdef OMASA_UPDATES @@ -342,8 +353,20 @@ ivas_error ivas_masa_decode( { if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) { +#ifdef FIX_OMASA_DELAY_COMP + int16_t sf; + int16_t meta_write_index; + + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + meta_write_index = ( st_ivas->hDirAC->dirac_bs_md_write_idx + sf ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->azimuth_ism[obj][meta_write_index]; + st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->elevation_ism[obj][meta_write_index]; + } +#else st_ivas->hMasaIsmData->azimuth_separated_ism = st_ivas->hMasaIsmData->azimuth_ism[obj]; st_ivas->hMasaIsmData->elevation_separated_ism = st_ivas->hMasaIsmData->elevation_ism[obj]; +#endif } } } @@ -450,6 +473,9 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { +#ifdef FIX_OMASA_DELAY_COMP + dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ +#endif ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, SBA_MODE_NONE, 0 ); } @@ -468,22 +494,39 @@ ivas_error ivas_masa_decode( { int16_t b; int16_t block; +#ifdef FIX_OMASA_DELAY_COMP + int16_t meta_write_index; +#endif for ( i = 0; i < st_ivas->hDirAC->numIsmDirections; i++ ) /* Todo Nokia: Probably there is a better place for this eventually */ { for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { +#ifdef FIX_OMASA_DELAY_COMP + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; +#endif for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { +#ifdef FIX_OMASA_DELAY_COMP + st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][meta_write_index][b]; +#else st_ivas->hDirAC->diffuseness_vector[block][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b]; +#endif } } } for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { +#ifdef FIX_OMASA_DELAY_COMP + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; +#endif for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { +#ifdef FIX_OMASA_DELAY_COMP + st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] = max( 0.0f, st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] ); +#else st_ivas->hDirAC->diffuseness_vector[block][b] = max( 0.0f, st_ivas->hDirAC->diffuseness_vector[block][b] ); +#endif } } } @@ -2298,7 +2341,13 @@ static int16_t ivas_decode_masaism_metadata( uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, +#ifdef FIX_OMASA_DELAY_COMP + const int16_t ism_imp, + const int16_t dirac_bs_md_write_idx, + const int16_t dirac_md_buffer_length ) +#else const int16_t ism_imp ) +#endif { int16_t sf, band, dir, nbands, nblocks, obj, i; float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; @@ -2310,6 +2359,9 @@ static int16_t ivas_decode_masaism_metadata( int16_t nb_bits_read; #ifdef OMASA_UPDATES float delta_phi; +#ifdef FIX_OMASA_DELAY_COMP + int16_t meta_write_index; +#endif #endif nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; @@ -2395,8 +2447,17 @@ static int16_t ivas_decode_masaism_metadata( #endif +#ifdef FIX_OMASA_DELAY_COMP + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + meta_write_index = ( dirac_bs_md_write_idx + sf ) % dirac_md_buffer_length; + hMasaIsmData->azimuth_ism[obj][meta_write_index] = (int16_t) rint( azimuth ); + hMasaIsmData->elevation_ism[obj][meta_write_index] = (int16_t) rint( elevation ); + } +#else hMasaIsmData->azimuth_ism[obj] = (int16_t) rint( azimuth ); hMasaIsmData->elevation_ism[obj] = (int16_t) rint( elevation ); +#endif } /* Modify ISM metadata based on the MASA-to-total energy ratios */ @@ -2427,10 +2488,17 @@ static int16_t ivas_decode_masaism_metadata( { i = sf; } +#ifdef FIX_OMASA_DELAY_COMP + meta_write_index = ( dirac_bs_md_write_idx + sf ) % dirac_md_buffer_length; +#endif for ( dir = 0; dir < nchan_ism; dir++ ) { +#ifdef FIX_OMASA_DELAY_COMP + hMasaIsmData->energy_ratio_ism[dir][meta_write_index][b] = energy_ratio_ism[i][band][dir]; +#else hMasaIsmData->energy_ratio_ism[dir][sf][b] = energy_ratio_ism[i][band][dir]; +#endif } } } @@ -2460,8 +2528,17 @@ void ivas_masa_ism_set_edited_objects( { if ( st_ivas->editing_ism_enabled ) { +#ifdef FIX_OMASA_DELAY_COMP + int16_t sf; + for ( sf = 0; sf < ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); sf++ ) + { + hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism][sf] = st_ivas->azimuth_edited; + hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism][sf] = st_ivas->elevation_edited; + } +#else hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism] = st_ivas->azimuth_edited; hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism] = st_ivas->elevation_edited; +#endif #ifdef OMASA_UPDATES st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->azimuth = st_ivas->azimuth_edited; st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->elevation = st_ivas->elevation_edited; @@ -2498,8 +2575,17 @@ void ivas_masa_ism_set_edited_objects( { if ( st_ivas->hMasaIsmData->idx_separated_ism == st_ivas->index_of_edited_ism ) { +#ifdef FIX_OMASA_DELAY_COMP + int16_t sf; + for ( sf = 0; sf < ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); sf++ ) + { + st_ivas->hMasaIsmData->azimuth_separated_ism[sf] = st_ivas->azimuth_edited; + st_ivas->hMasaIsmData->elevation_separated_ism[sf] = st_ivas->elevation_edited; + } +#else st_ivas->hMasaIsmData->azimuth_separated_ism = st_ivas->azimuth_edited; st_ivas->hMasaIsmData->elevation_separated_ism = st_ivas->elevation_edited; +#endif } } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ccaed09898..a412616749 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1162,17 +1162,28 @@ typedef struct ivas_masa_decoder_struct /* Data structure for MASA_ISM rendering */ typedef struct ivas_masa_ism_data_structure { +#ifdef FIX_OMASA_DELAY_COMP + int16_t azimuth_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + int16_t elevation_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; +#else int16_t azimuth_ism[MAX_NUM_OBJECTS]; int16_t elevation_ism[MAX_NUM_OBJECTS]; float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif int16_t azimuth_ism_edited[MAX_NUM_OBJECTS]; int16_t elevation_ism_edited[MAX_NUM_OBJECTS]; uint8_t ism_is_edited[MAX_NUM_OBJECTS]; int16_t idx_separated_ism; +#ifdef FIX_OMASA_DELAY_COMP + int16_t azimuth_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; + int16_t elevation_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; +#else int16_t azimuth_separated_ism; int16_t elevation_separated_ism; +#endif #ifdef OMASA_UPDATES float q_azimuth_old[MAX_NUM_OBJECTS]; float q_elevation_old[MAX_NUM_OBJECTS]; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 1fd102c07c..c6d1066e66 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -1101,7 +1101,11 @@ void ivas_destroy_enc( #ifdef MASA_AND_OBJECTS if ( st_ivas->hOMasa != NULL ) { +#ifdef FIX_OMASA_DELAY_COMP + ivas_omasa_enc_close( st_ivas->hOMasa ); +#else ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); +#endif st_ivas->hOMasa = NULL; } #endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 86b5cbe90f..002a4d52c7 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -89,6 +89,7 @@ ivas_error ivas_omasa_enc_open( numAnalysisChannels = st_ivas->hEncoderConfig->nchan_ism; +#ifndef FIX_OMASA_DELAY_COMP /* initialize delay compensation */ hOMasa->num_samples_delay_comp = NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS ); tmp_f = ( (float) hOMasa->num_samples_delay_comp ) / (float) ( NS2SA( st_ivas->hEncoderConfig->input_Fs, DIRAC_SLOT_NS ) ); @@ -111,6 +112,7 @@ ivas_error ivas_omasa_enc_open( hOMasa->delay_buffer[i] = (float *) malloc( NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_NS ) * sizeof( float ) ); /* Todo Nokia: Return errors if alloc fails */ set_zero( hOMasa->delay_buffer[i], NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_NS ) ); } +#endif /* open/initialize CLDFB */ hOMasa->num_Cldfb_instances = numAnalysisChannels; @@ -174,17 +176,23 @@ ivas_error ivas_omasa_enc_open( *--------------------------------------------------------------------------*/ void ivas_omasa_enc_close( +#ifdef FIX_OMASA_DELAY_COMP + OMASA_ENC_HANDLE hOMasa /* i/o: encoder OMASA handle */ +#else OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ const int16_t nchan_ism /* i : number of objects */ +#endif ) { int16_t i, j; +#ifndef FIX_OMASA_DELAY_COMP for ( i = 0; i < nchan_ism; i++ ) { free( hOMasa->delay_buffer[i] ); hOMasa->delay_buffer[i] = NULL; } +#endif for ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { @@ -299,7 +307,11 @@ ivas_error ivas_omasa_enc_config( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hOMasa != NULL ) { +#ifdef FIX_OMASA_DELAY_COMP + ivas_omasa_enc_close( st_ivas->hOMasa ); +#else ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); +#endif st_ivas->hOMasa = NULL; } @@ -957,11 +969,13 @@ static void ivas_omasa_param_est_enc( set_zero( renormalization_factor_diff, hOMasa->nbands ); set_zero( diffuseness_m, hOMasa->nbands ); +#ifndef FIX_OMASA_DELAY_COMP /* Copy current frame to memory for delay compensation */ for ( i = 0; i < nchan_ism; i++ ) { mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); } +#endif /* Compute ISM to FOA matrices */ for ( i = 0; i < nchan_ism; i++ ) @@ -991,6 +1005,9 @@ static void ivas_omasa_param_est_enc( { for ( i = 0; i < nchan_ism; i++ ) { +#ifdef FIX_OMASA_DELAY_COMP + cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); +#else if ( ts < hOMasa->num_slots_delay_comp ) { cldfbAnalysis_ts( &( hOMasa->delay_buffer[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); @@ -999,6 +1016,7 @@ static void ivas_omasa_param_est_enc( { cldfbAnalysis_ts( &( data_f[i][hOMasa->offset_comp + l_ts * ( ts - hOMasa->num_slots_delay_comp )] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); } +#endif } /* Compute energy */ @@ -1116,11 +1134,13 @@ static void ivas_omasa_param_est_enc( energyRatio[band_m_idx] = 1.0f - diffuseness_m[band_m_idx]; } +#ifndef FIX_OMASA_DELAY_COMP /* Update memory */ for ( i = 0; i < nchan_ism; i++ ) { mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); } +#endif return; } @@ -1148,11 +1168,13 @@ static void ivas_omasa_energy_and_ratio_est( l_ts = input_frame / CLDFB_NO_COL_MAX; +#ifndef FIX_OMASA_DELAY_COMP /* Copy current frame to memory for delay compensation */ for ( i = 0; i < nchan_inp; i++ ) { mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); } +#endif /* do processing over all CLDFB time slots */ for ( block_m_idx = 0; block_m_idx < hOMasa->nSubframes; block_m_idx++ ) @@ -1172,6 +1194,9 @@ static void ivas_omasa_energy_and_ratio_est( { for ( i = 0; i < nchan_inp; i++ ) { +#ifdef FIX_OMASA_DELAY_COMP + cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); +#else if ( ts < hOMasa->num_slots_delay_comp ) { cldfbAnalysis_ts( &( hOMasa->delay_buffer[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); @@ -1180,6 +1205,7 @@ static void ivas_omasa_energy_and_ratio_est( { cldfbAnalysis_ts( &( data_f[i][hOMasa->offset_comp + l_ts * ( ts - hOMasa->num_slots_delay_comp )] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); } +#endif } /* Compute energy */ @@ -1221,11 +1247,13 @@ static void ivas_omasa_energy_and_ratio_est( hMasa->data.nchan_ism = nchan_inp; } +#ifndef FIX_OMASA_DELAY_COMP /* Update memory */ for ( i = 0; i < nchan_inp; i++ ) { mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); } +#endif return; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 643bd32164..e5ccdc7b19 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -861,11 +861,13 @@ typedef struct ivas_omasa_enc_data_structure uint8_t nCodingBands; uint8_t nSubframes; +#ifndef FIX_OMASA_DELAY_COMP /* delay compensation */ float *delay_buffer[MAX_NUM_OBJECTS]; /* Delay buffer for parameter estimation */ int16_t num_samples_delay_comp; int16_t num_slots_delay_comp; int16_t offset_comp; +#endif /* CLDFB analysis */ int16_t num_Cldfb_instances; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 1e1e591508..38f2d8eed5 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -657,6 +657,9 @@ static void ivas_dirac_dec_binaural_internal( ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, firstSlot, slotEnd ); st_ivas->hDirAC->hDiffuseDist = NULL; +#ifdef FIX_OMASA_DELAY_COMP + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + nSubframes ) % st_ivas->hDirAC->dirac_md_buffer_length; +#endif return; } @@ -898,10 +901,19 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } else { +#ifdef FIX_OMASA_DELAY_COMP + aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; +#else aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex]; eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex]; +#endif } +#ifdef FIX_OMASA_DELAY_COMP + ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; +#else ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][subframe][bin]; +#endif spreadCoh = 0.0f; } #endif @@ -1118,7 +1130,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; } +#ifndef FIX_OMASA_DELAY_COMP hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; +#endif } /* Formulate average diffuseness over frame */ @@ -1204,6 +1218,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( uint8_t nchanSeparateChannels; #endif int16_t nBins; +#ifdef FIX_OMASA_DELAY_COMP + int16_t dirac_read_idx; +#endif DIRAC_DEC_BIN_HANDLE h; h = st_ivas->hDiracDecBin; #ifdef MASA_AND_OBJECTS @@ -1235,6 +1252,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; #endif nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ +#ifdef FIX_OMASA_DELAY_COMP + dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; +#endif for ( bin = 0; bin < nBins; bin++ ) { @@ -1399,13 +1419,23 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { +#ifdef FIX_OMASA_DELAY_COMP + aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB][dirac_read_idx]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism[chB][dirac_read_idx]; +#else aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB]; eleDeg = st_ivas->hMasaIsmData->elevation_ism[chB]; +#endif } else { +#ifdef FIX_OMASA_DELAY_COMP + aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; + eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism[dirac_read_idx]; +#else aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism; eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; +#endif instantChange = 1; } } @@ -2393,6 +2423,9 @@ void preProcessStereoTransportsForMovedObjects( DIRAC_DEC_HANDLE hDirAC; MASA_ISM_DATA_HANDLE hMasaIsmData; uint8_t enableCentering; +#ifdef FIX_OMASA_DELAY_COMP + int16_t dirac_read_idx; +#endif hDirAC = st_ivas->hDirAC; hMasaIsmData = st_ivas->hMasaIsmData; @@ -2426,6 +2459,10 @@ void preProcessStereoTransportsForMovedObjects( /* Perform object-movement based processing */ for ( subframe = firstSubframe; subframe < ( firstSubframe + nSubframes ); subframe++ ) { +#ifdef FIX_OMASA_DELAY_COMP + dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; +#endif + for ( bin = 0; bin < nBins; bin++ ) { float ismPreprocMtxNew[2][2]; @@ -2471,12 +2508,21 @@ void preProcessStereoTransportsForMovedObjects( float panEnesIn[2]; float centeringFactor; +#ifdef FIX_OMASA_DELAY_COMP + ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; +#else ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][subframe][bin]; +#endif ismRatioAcc += ratio; /* Get input and output panning gains */ +#ifdef FIX_OMASA_DELAY_COMP + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], + hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], +#else ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex], hMasaIsmData->elevation_ism[ismDirIndex], +#endif panGainsIn ); if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) -- GitLab From b9622617087d96e8f23cee040cb03889979e1db7 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 25 Apr 2023 21:09:01 +0300 Subject: [PATCH 093/591] Apply clang format --- lib_dec/ivas_dirac_dec.c | 82 ++++++++++++++++----------------- lib_dec/ivas_ism_metadata_dec.c | 12 ++--- lib_dec/ivas_ism_renderer.c | 20 ++++---- lib_enc/ivas_cpe_enc.c | 4 +- lib_enc/ivas_enc.c | 4 +- lib_enc/ivas_stereo_td_enc.c | 4 +- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 4f19654485..878657ec8a 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -321,7 +321,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } ivas_masa_init_stereotype_detection( hDirAC->masa_stereo_type_detect ); } @@ -401,7 +401,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } if ( hDirAC->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) @@ -410,7 +410,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_s( hDirAC->proto_index_dir, 0, hDirAC->num_outputs_dir ); @@ -420,7 +420,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); @@ -543,7 +543,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } /* reallocate static memory */ else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->num_outputs_dir != num_outputs_dir_old ) @@ -553,7 +553,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } if ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) @@ -574,7 +574,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder && ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) { @@ -583,7 +583,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_f( hDirAC->hoa_encoder, 0.0f, nchan_out_woLFE * hDirAC->num_outputs_diff ); compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirAC->hoa_encoder, hDirAC->num_outputs_diff, hDirAC->hOutSetup.ambisonics_order ); @@ -673,17 +673,17 @@ ivas_error ivas_dirac_dec_config( if ( ( flag_config == DIRAC_OPEN && hDirAC->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; - } + } } else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { @@ -697,19 +697,19 @@ ivas_error ivas_dirac_dec_config( ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; + } } } - } /* output synthesis */ if ( flag_config == DIRAC_OPEN ) @@ -755,7 +755,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } else if ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->num_protos_diff != num_protos_diff_old ) ) { @@ -764,9 +764,9 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } } - } if ( flag_config == DIRAC_OPEN ) @@ -793,7 +793,7 @@ ivas_error ivas_dirac_dec_config( if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + } } set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } @@ -1333,9 +1333,9 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } - } hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; hDirAC->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; hDirAC->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; @@ -1392,17 +1392,17 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + } } else { if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } - } hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; @@ -1414,7 +1414,7 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + } if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) { @@ -1439,10 +1439,10 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } - } else { if ( num_protos_dir > 2 ) @@ -1450,7 +1450,7 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + } } if ( hDirAC->proto_signal_decorr_on ) @@ -1458,9 +1458,9 @@ static ivas_error ivas_dirac_alloc_mem( if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } - } return IVAS_ERR_OK; } @@ -1759,10 +1759,10 @@ void ivas_qmetadata_to_dirac( { meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { hDirAC->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; hDirAC->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; hDirAC->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; @@ -1831,10 +1831,10 @@ void ivas_qmetadata_to_dirac( { meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { hDirAC->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; hDirAC->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; hDirAC->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; @@ -1887,7 +1887,7 @@ void ivas_qmetadata_to_dirac( set_s( hDirAC->elevation2[meta_write_index], 0, hDirAC->num_freq_bands ); set_zero( hDirAC->energy_ratio2[meta_write_index], hDirAC->num_freq_bands ); set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); - } + } } #endif } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 1cc7028c55..0565447847 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -396,8 +396,8 @@ ivas_error ivas_ism_metadata_dec( if ( ism_metadata_flag_global ) { /*----------------------------------------------------------------* - * Metadata decoding and dequantization, loop over all objects - *----------------------------------------------------------------*/ + * Metadata decoding and dequantization, loop over all objects + *----------------------------------------------------------------*/ int16_t total_bits_metadata = 0, bits_metadata_ism = 0; int16_t nb_bits_objcod_read; @@ -732,8 +732,8 @@ ivas_error ivas_ism_metadata_dec( } /*----------------------------------------------------------------* - * Set bitsream pointers - *----------------------------------------------------------------*/ + * Set bitsream pointers + *----------------------------------------------------------------*/ /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; @@ -747,8 +747,8 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG /*----------------------------------------------------------------* - * Updates - *----------------------------------------------------------------*/ + * Updates + *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, nchan_ism ); diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 54856c700d..0b99968a5a 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -256,8 +256,8 @@ void ivas_ism_get_stereo_gains( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------------* -* ivas_masa_ism_separate_object_renderer_open() -* + * ivas_masa_ism_separate_object_renderer_open() + * * Open structures, reserve memory, and init values. *-------------------------------------------------------------------------*/ @@ -361,7 +361,7 @@ void ivas_masa_ism_separate_object_render( #endif #ifdef OMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) #else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) #endif @@ -392,8 +392,8 @@ void ivas_masa_ism_separate_object_render( azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; elevation = st_ivas->hMasaIsmData->elevation_separated_ism[dirac_read_idx]; #else - azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism; - elevation = st_ivas->hMasaIsmData->elevation_separated_ism; + azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism; + elevation = st_ivas->hMasaIsmData->elevation_separated_ism; #endif } else @@ -402,8 +402,8 @@ void ivas_masa_ism_separate_object_render( azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj][dirac_read_idx]; elevation = st_ivas->hMasaIsmData->elevation_ism[obj][dirac_read_idx]; #else - azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj]; - elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; + azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj]; + elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; #endif } @@ -425,7 +425,7 @@ void ivas_masa_ism_separate_object_render( #ifdef OMASA_UPDATES vbap_determine_gains( hVBAPdata, gains, azimuth, elevation, 1 ); #else - vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); + vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); #endif } else @@ -449,7 +449,7 @@ void ivas_masa_ism_separate_object_render( #ifdef FIX_OMASA_DELAY_COMP for ( k = 0; k < subframe_len; k++ ) #else - for ( k = 0; k < output_frame; k++ ) + for ( k = 0; k < output_frame; k++ ) #endif { g1 = hRendererData->interpolator[k]; @@ -457,7 +457,7 @@ void ivas_masa_ism_separate_object_render( #ifdef FIX_OMASA_DELAY_COMP output_f[j2][k + idx_offset] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k + idx_offset]; #else - output_f[j2][k] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k]; + output_f[j2][k] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k]; #endif } } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 490cd41d1e..bfa7d86756 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -820,7 +820,7 @@ ivas_error ivas_cpe_enc( dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_NCShift" ); dbgwrite( &n, 2, 1, input_frame, "res/TCA_idx_ica_gD" ); n = -1; - //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + // dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } else if ( hCPE->element_mode == IVAS_CPE_TD ) { @@ -837,7 +837,7 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_MDCT ) { n = -2; - //dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); + // dbgwrite( &n, 2, 1, input_frame, "res/tdm_ratio_idx.enc" ); } { diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 5d329701cb..920193c999 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -249,7 +249,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif ) ) != IVAS_ERR_OK ) { @@ -459,7 +459,7 @@ ivas_error ivas_enc( if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 82e3f4bdfd..7c0649c5ab 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -283,8 +283,8 @@ ivas_error stereo_set_tdm( dbgwrite( &tmp, 2, 1, 320, "res/inst_ratio_L" ); dbgwrite( &ftmp, 4, 1, 320, "res/ratio_L" ); dbgwrite( &tmp, 2, 1, 320, "res/tdm_low_rate_mode" ); - //dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); - //dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); + // dbgwrite( &tmp, 2, 1, 320, "res/tdm_lp_reuse_flag" ); + // dbgwrite( &tmp, 2, 1, 320, "res/mod_ct.enx" ); } #endif hCPE->hCoreCoder[0]->tdm_LRTD_flag = 0; -- GitLab From f15d1763c619cf1d4cb875708d581749564477c1 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 25 Apr 2023 21:12:13 +0300 Subject: [PATCH 094/591] Disable DEBUG_MODE_INFO --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index de3c8de9a7..8d94dd3c1e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO #define DEBUG_MODE_ACELP /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ -- GitLab From b2357112fb13c7c59f7068381e480a47529a5cd3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 08:50:46 +0200 Subject: [PATCH 095/591] MSVC compilation warnings --- lib_dec/ivas_masa_dec.c | 2 ++ lib_enc/ivas_omasa_enc.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 75dfcbe9b0..20bd5c18f9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -119,6 +119,8 @@ ivas_error ivas_masa_decode( int16_t i, ch, ism_imp; #ifdef FIX_OMASA_DELAY_COMP int16_t dirac_bs_md_write_idx; + + dirac_bs_md_write_idx = 0; #endif ism_imp = 0; #endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index bcd73cc42a..677558db09 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -72,7 +72,9 @@ ivas_error ivas_omasa_enc_open( ) { int16_t i, j; +#ifndef FIX_OMASA_DELAY_COMP float tmp_f; +#endif OMASA_ENC_HANDLE hOMasa; int16_t numAnalysisChannels; int16_t input_frame; -- GitLab From a3e043792609f56b22d94f91d82a388113dac41d Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 16:24:27 +0200 Subject: [PATCH 096/591] merge OMASA_BRATE_SW into MASA_AND_OBJECTS --- lib_com/ivas_ism_com.c | 4 +- lib_com/ivas_omasa_com.c | 2 - lib_com/ivas_prot.h | 10 +-- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_init_dec.c | 67 ++------------------ lib_dec/ivas_ism_metadata_dec.c | 6 +- lib_dec/ivas_masa_dec.c | 2 +- lib_dec/ivas_omasa_dec.c | 8 +-- lib_dec/ivas_stat_dec.h | 2 +- lib_dec/ivas_stereo_switching_dec.c | 2 +- lib_enc/ivas_corecoder_enc_reconfig.c | 6 +- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_enc.c | 21 ------ lib_enc/ivas_init_enc.c | 8 +-- lib_enc/ivas_ism_metadata_enc.c | 30 --------- lib_enc/ivas_omasa_enc.c | 11 ++-- lib_rend/ivas_dirac_dec_binaural_functions.c | 7 +- 18 files changed, 32 insertions(+), 159 deletions(-) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index adde308208..3db790e924 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -606,7 +606,7 @@ ISM_MODE ivas_ism_mode_select( void ivas_ism_metadata_close( ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS , const int16_t first_idx /* i : index of first handle to deallocate */ #endif @@ -619,7 +619,7 @@ void ivas_ism_metadata_close( return; } -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS for ( n = first_idx; n < MAX_NUM_OBJECTS; n++ ) #else for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 57618c9540..4bf5c3ed83 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -178,7 +178,6 @@ ISM_MODE ivas_omasa_ism_mode_select( } -#ifdef OMASA_BRATE_SW /*--------------------------------------------------------------- * ivas_set_omasa_TC() * @@ -221,7 +220,6 @@ void ivas_set_omasa_TC( return; } -#endif /*--------------------------------------------------------------- diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 5a5d7023d8..bcf208f550 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -883,7 +883,7 @@ void ivas_param_ism_enc_close( void ivas_ism_metadata_close( ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS , const int16_t first_idx /* i : index of first handle to deallocate */ #endif @@ -5135,7 +5135,7 @@ void ivas_omasa_enc_close( #endif ); -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS ivas_error ivas_omasa_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -5149,7 +5149,7 @@ void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs, /* i : Input sample rate */ - const ISM_MODE ismMode /* i : ISM mode */ + const ISM_MODE ism_mode /* i : ISM mode */ ); void ivas_omasa_enc( @@ -5211,7 +5211,7 @@ ISM_MODE ivas_omasa_ism_mode_select( const int16_t nchan_ism /* i : number of input ISM's */ ); -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS void ivas_set_omasa_TC( const ISM_MODE ism_mode, /* i : ISM mode */ const int16_t nchan_ism, /* i : number of input ISMs */ @@ -5232,7 +5232,7 @@ ivas_error ivas_masa_ism_data_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS void ivas_masa_ism_data_close( MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 32b61cf5ba..f0218d53e0 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,7 +169,6 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ -#define OMASA_BRATE_SW /* VA: support of bitrate switching in OMASA format */ #define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA #define OMASA_TUNING_TD_STEREO /* VA: tuning of TD stereo in OMASA format */ #define FIX_OMASA_DELAY_COMP /* Nokia: OMASA audio/meta delay compensation */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 6a6b190dfc..6b368ab391 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -915,7 +915,7 @@ ivas_error ivas_dec( st_ivas->ini_active_frame++; } -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS st_ivas->last_ivas_format = st_ivas->ivas_format; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3170f3629f..99e2fb0a15 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -70,11 +70,7 @@ ivas_error ivas_dec_setup( Decoder_State *st; int32_t ivas_total_brate; ivas_error error; -#ifdef MASA_AND_OBJECTS -#ifndef OMASA_BRATE_SW - int32_t cpe_brate; -#endif -#endif + error = IVAS_ERR_OK; num_bits_read = 0; @@ -166,7 +162,7 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( st_ivas->last_ivas_format == MASA_FORMAT ) { #endif @@ -181,7 +177,7 @@ ivas_error ivas_dec_setup( return error; } } -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS } else { @@ -208,22 +204,10 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { -#ifdef OMASA_BRATE_SW if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#else - cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); - if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) - { - st_ivas->hCPE[0]->nchan_out = 1; - } - else if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } } @@ -1095,36 +1079,10 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); -#ifdef OMASA_BRATE_SW if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) { return error; } -#else -#ifdef OMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - { - int32_t temp_brate[MAX_SCE]; - - if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, temp_brate ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); - } - } -#else - if ( ( st_ivas->hIsmMetaData[0] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); - } -#endif -#endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -1870,7 +1828,7 @@ void ivas_destroy_dec( } /* ISM metadata handles */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); #else ivas_ism_metadata_close( st_ivas->hIsmMetaData ); @@ -1955,24 +1913,7 @@ void ivas_destroy_dec( #ifdef MASA_AND_OBJECTS /* MASA ISM structure */ -#ifdef OMASA_BRATE_SW ivas_masa_ism_data_close( &st_ivas->hMasaIsmData ); -#else - if ( st_ivas->hMasaIsmData != NULL ) - { - if ( st_ivas->hMasaIsmData->delayBuffer != NULL ) - { - for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) - { - free( st_ivas->hMasaIsmData->delayBuffer[i] ); - } - free( st_ivas->hMasaIsmData->delayBuffer ); - st_ivas->hMasaIsmData->delayBuffer = NULL; - } - free( st_ivas->hMasaIsmData ); - st_ivas->hMasaIsmData = NULL; - } -#endif #endif /* Head track data handle */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 0f14195073..610ed868e5 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -669,7 +669,7 @@ ivas_error ivas_ism_metadata_dec_create( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( element_brate_tmp != NULL ) { #endif @@ -682,7 +682,7 @@ ivas_error ivas_ism_metadata_dec_create( { return error; } -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS } #endif @@ -701,7 +701,7 @@ ivas_error ivas_ism_metadata_dec_create( static void decode_angle_indices( DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ - int16_t *flag_abs_angle1 /* o : Azimuth/yaw encoding mode */ + int16_t *flag_abs_angle1 /* o : Azimuth/yaw encoding mode */ ) { int16_t idx_angle1, nbits_diff_angle1, diff, sgn; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 325f02ad3b..4ad5e8f437 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1507,7 +1507,7 @@ ivas_error ivas_masa_dec_reconfigure( #endif ); -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_FORMAT ) { st_ivas->nchan_ism = 0; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index a688e0062f..a02a2bf051 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -38,7 +38,7 @@ #ifdef OMASA_UPDATES #include "ivas_prot_rend.h" #endif -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS #include "ivas_rom_com.h" #endif #ifdef DEBUGGING @@ -95,7 +95,6 @@ ivas_error ivas_masa_ism_data_open( } -#ifdef OMASA_BRATE_SW /*-------------------------------------------------------------------* * ivas_masa_ism_data_close() * @@ -128,11 +127,8 @@ void ivas_masa_ism_data_close( return; } -#endif -#endif -#ifdef OMASA_BRATE_SW /*--------------------------------------------------------------------------* * ivas_omasa_dec_config() * @@ -339,10 +335,8 @@ ivas_error ivas_omasa_dec_config( return IVAS_ERR_OK; } -#endif -#ifdef MASA_AND_OBJECTS /*--------------------------------------------------------------------------* * ivas_set_surplus_brate_dec() * diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index cd14053522..793b438aaf 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1225,7 +1225,7 @@ typedef struct Decoder_Struct DECODER_CONFIG_HANDLE hDecoderConfig; /* Decoder configuration structure */ IVAS_FORMAT ivas_format; /* IVAS format */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS IVAS_FORMAT last_ivas_format; /* last frame IVAS format */ #endif int16_t sid_format; /* IVAS format indicator from SID frame */ diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index ff37582cc4..584b48f906 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -880,7 +880,7 @@ ivas_error stereo_memory_dec( * Bitrate switching in MASA format *---------------------------------------------------------------*/ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && nchan_transport == 2 ) #else if ( ivas_format == MASA_FORMAT && nchan_transport == 2 ) diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index a7cd931a1a..31dce8ad0a 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -251,7 +251,7 @@ ivas_error ivas_corecoder_enc_reconfig( } /* propagate input audio buffers */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( n_CoreCoder_existing > sce_id && hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) #else if ( n_CoreCoder_existing > sce_id ) @@ -264,7 +264,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( sce_id > 0 || hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) #else if ( sce_id > 0 ) @@ -299,7 +299,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n + st_ivas->nSCE ) * MAX_NUM_INDICES; -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS if ( ( cpe_id * CPE_CHANNELS + n > 0 ) || ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->nSCE > 0 ) || ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 ) ) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 3042bab0c4..c34216b079 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -283,7 +283,7 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode != IVAS_CPE_MDCT && ( hCPE->element_brate != hCPE->last_element_brate || hCPE->last_element_mode != hCPE->element_mode || sts[0]->ini_frame == 0 || -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) || #endif sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 514e90fb51..1708e4d701 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -294,14 +294,10 @@ ivas_error ivas_enc( float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; -#ifdef OMASA_BRATE_SW if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#else - ivas_masa_enc_reconfigure( st_ivas ); -#endif hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; @@ -312,25 +308,8 @@ ivas_error ivas_enc( mvr2r( data_f[hEncoderConfig->nchan_ism], data_f[hEncoderConfig->nchan_ism + 1], input_frame ); } - /* nb_bits_metadata[0] = 0; */ set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); - -#ifdef OMASA_BRATE_SW idx_separated_object = 0; -#else - /* Configure MASA encoder based on frame parameters */ - if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - idx_separated_object = 0; - - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - /* Configure oMASA analysis based on MASA config */ - ivas_omasa_set_config( st_ivas->hOMasa, st_ivas->hMasa, st_ivas->hEncoderConfig->input_Fs, st_ivas->ism_mode ); - } -#endif /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 404a0d577c..7e9bdcd0e0 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -610,12 +610,10 @@ ivas_error ivas_init_encoder( return error; } -#ifdef OMASA_BRATE_SW for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { set_f( st_ivas->hQMetaData->masa_to_total_energy_ratio[i], 0, MASA_FREQUENCY_BANDS ); } -#endif if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -630,11 +628,7 @@ ivas_error ivas_init_encoder( } } -#ifdef OMASA_UPDATES if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) -#else - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) -#endif { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } @@ -1046,7 +1040,7 @@ void ivas_destroy_enc( } /* ISM metadata handles */ -#ifdef OMASA_BRATE_SW +#ifdef MASA_AND_OBJECTS ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); #else ivas_ism_metadata_close( st_ivas->hIsmMetaData ); diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 5bac1b332e..13d7d64e4f 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -730,37 +730,7 @@ ivas_error ivas_ism_metadata_enc_create( if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { nchan_transport = MAX_PARAM_ISM_WAVE; -#ifdef OMASA_BRATE_SW ivas_set_omasa_TC( st_ivas->ism_mode, n_ISms, &st_ivas->nSCE, &st_ivas->nCPE ); -#else - switch ( st_ivas->ism_mode ) - { - case ISM_MASA_MODE_PARAM: - st_ivas->nCPE = 1; - st_ivas->nSCE = 0; - break; -#ifdef OMASA_UPDATES - case ISM_MASA_MODE_MASA_ONE_OBJ: - case ISM_MASA_MODE_PARAM_ONE_OBJ: -#else - case ISM_MASA_MODE_ONE_OBJ: -#endif - st_ivas->nCPE = 1; - st_ivas->nSCE = 1; - break; - case ISM_MASA_MODE_DISC: - st_ivas->nCPE = 1; - st_ivas->nSCE = n_ISms; - break; - case ISM_MODE_NONE: - st_ivas->nSCE = 0; - st_ivas->nCPE = 1; - - break; - default: - break; - } -#endif } else { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 677558db09..fdbe8d063d 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -225,7 +225,6 @@ void ivas_omasa_enc_close( } -#ifdef OMASA_BRATE_SW /*--------------------------------------------------------------------------* * ivas_omasa_enc_config() * @@ -345,7 +344,6 @@ ivas_error ivas_omasa_enc_config( return IVAS_ERR_OK; } -#endif /*--------------------------------------------------------------------------* @@ -357,18 +355,17 @@ ivas_error ivas_omasa_enc_config( void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ - const int32_t input_Fs /* i : Input sample rate */ - , - const ISM_MODE ismMode /* i : ISM mode */ + const int32_t input_Fs, /* i : Input sample rate */ + const ISM_MODE ism_mode /* i : ISM mode */ ) { uint8_t i, maxBin; /* Determine the number of bands */ #ifdef OMASA_UPDATES - if ( ismMode == ISM_MODE_NONE || ismMode == ISM_MASA_MODE_MASA_ONE_OBJ ) + if ( ism_mode == ISM_MODE_NONE || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) #else - if ( ismMode == ISM_MODE_NONE ) + if ( ism_mode == ISM_MODE_NONE ) #endif { /* use full resolution for the ISM+MASA merge and reduce later */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 1525c4a508..7ee3add834 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -2246,10 +2246,11 @@ static void hrtfShGetHrtf( /*! r: Configured reqularization factor value to be set. */ static float configure_reqularization_factor( - const IVAS_FORMAT ivas_format, /* i: IVAS codec format in use */ - const int32_t ivas_brate ) /* i: Current IVAS bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS codec format in use */ + const int32_t ivas_brate ) /* i : Current IVAS bitrate */ { float reqularizationFactor; + reqularizationFactor = 1.0f; /* Default value */ if ( ivas_format == MASA_FORMAT ) @@ -2308,7 +2309,7 @@ static float configure_reqularization_factor( } } - /* For SBA and parametric ISM, currently in default value of 1.0f. */ + /* For SBA and parametric ISM, default value of 1.0f. */ return reqularizationFactor; } -- GitLab From f69a7dcb58cdb54876e468de9e16d202563714e7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 16:28:39 +0200 Subject: [PATCH 097/591] merge OMASA_TUNING_TD_STEREO and FIX_TD5_IN_OMASA into MASA_AND_OBJECTS --- lib_com/ivas_prot.h | 8 ++++---- lib_com/ivas_stereo_td_bit_alloc.c | 4 ++-- lib_com/options.h | 2 -- lib_dec/ivas_cpe_dec.c | 2 +- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_stereo_td_dec.c | 15 +++++---------- lib_enc/ivas_cpe_enc.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_stereo_td_analysis.c | 4 ++-- lib_enc/ivas_stereo_td_enc.c | 18 +++++------------- 10 files changed, 23 insertions(+), 38 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index bcf208f550..79a8a6db6d 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1778,7 +1778,7 @@ void stereo_tdm_prep_dwnmx ( ); int16_t stereo_tdm_ener_analysis( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif CPE_ENC_HANDLE hCPE, /* i : CPE structure */ @@ -1803,7 +1803,7 @@ void stereo_td_init_dec( ); void tdm_configure_dec( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -1855,7 +1855,7 @@ void tdm_ol_pitch_comparison( ); void tdm_configure_enc( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ @@ -1874,7 +1874,7 @@ ivas_error signaling_enc_secondary( ); void tdm_bit_alloc( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index f593d41a18..97ddb731fe 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -74,7 +74,7 @@ *-------------------------------------------------------------------*/ void tdm_bit_alloc( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ @@ -139,7 +139,7 @@ void tdm_bit_alloc( *total_brate_sec = tdm_bit_allc_tbl[idx][coder_type]; /* secondary channel bitrate allocation based on the energy scaling ratio */ -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS if ( ( ivas_format != MASA_ISM_FORMAT && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && coder_type > UNVOICED ) ) #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) diff --git a/lib_com/options.h b/lib_com/options.h index f0218d53e0..d251f3b838 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,8 +169,6 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ -#define FIX_TD5_IN_OMASA // do not transmit extended MD in OMASA -#define OMASA_TUNING_TD_STEREO /* VA: tuning of TD stereo in OMASA format */ #define FIX_OMASA_DELAY_COMP /* Nokia: OMASA audio/meta delay compensation */ #endif /* MASA_AND_OBJECTS */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 43b02b0120..e6cbf2bc74 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -414,7 +414,7 @@ ivas_error ivas_cpe_dec( if ( !st_ivas->bfi ) { tdm_configure_dec( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS st_ivas->ivas_format, #endif hCPE, &tdm_ratio_idx, nb_bits_metadata ); diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 610ed868e5..9b12be21ed 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -233,7 +233,7 @@ ivas_error ivas_ism_metadata_dec( } /* read extended metadata presence flag */ -#ifdef FIX_TD5_IN_OMASA +#ifdef MASA_AND_OBJECTS if ( ism_mode == ISM_MODE_DISC && ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) #else if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index d8e817638a..1b90885b0f 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -84,7 +84,7 @@ void stereo_td_init_dec( *-------------------------------------------------------------------*/ void tdm_configure_dec( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -308,15 +308,10 @@ void tdm_configure_dec( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( -#ifdef OMASA_TUNING_TD_STEREO - ivas_format, -#endif - - hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, - hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), - &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); + tdm_bit_alloc( ivas_format, hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), + &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index c34216b079..bce8d37984 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -419,7 +419,7 @@ ivas_error ivas_cpe_enc( { /* Determine the energy ratio between the 2 channels */ tdm_ratio_idx = stereo_tdm_ener_analysis( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS ivas_format, #endif hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); @@ -589,7 +589,7 @@ ivas_error ivas_cpe_enc( tdm_ol_pitch_comparison( hCPE, pitch_fr, voicing_fr ); tdm_configure_enc( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS ivas_format, #endif hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata ); diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 13d7d64e4f..e0451811ac 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -279,7 +279,7 @@ ivas_error ivas_ism_metadata_enc( #endif /* write extended metadata presence flag */ -#ifdef FIX_TD5_IN_OMASA +#ifdef MASA_AND_OBJECTS if ( ism_mode == ISM_MODE_DISC && *ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) #else if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index ee07ae2f52..8f86f25986 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -111,7 +111,7 @@ static float Comp_diff_lt_corr( CPE_ENC_HANDLE hCPE, const int16_t IsSideMono, c *-------------------------------------------------------------------*/ int16_t stereo_tdm_ener_analysis( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif CPE_ENC_HANDLE hCPE, /* i : CPE structure */ @@ -198,7 +198,7 @@ int16_t stereo_tdm_ener_analysis( * of L and R needed to create new mono/side signals *----------------------------------------------------------------*/ -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index d8c8086562..0626f3d859 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -302,7 +302,7 @@ ivas_error stereo_set_tdm( *-------------------------------------------------------------------*/ void tdm_configure_enc( -#ifdef OMASA_TUNING_TD_STEREO +#ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ @@ -431,11 +431,7 @@ void tdm_configure_enc( } hStereoTD->tdm_lp_reuse_flag = 1; -#ifdef OMASA_TUNING_TD_STEREO if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 11000 ) -#else - if ( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus < 12000 ) -#endif { sts[1]->coder_type = INACTIVE; } @@ -484,14 +480,10 @@ void tdm_configure_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( -#ifdef OMASA_TUNING_TD_STEREO - ivas_format, -#endif - hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, - hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), - &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, - sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); + tdm_bit_alloc( ivas_format, hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), + &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, + sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #else tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); #endif -- GitLab From 3b9c6d094869565165ea61841cae3b5a0967f07a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 16:38:44 +0200 Subject: [PATCH 098/591] merge FIX_OMASA_DELAY_COMP into MASA_AND_OBJECTS --- lib_com/delay_comp.c | 4 +- lib_com/ivas_prot.h | 7 -- lib_com/options.h | 4 +- lib_dec/ivas_dec.c | 24 +---- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_dirac_output_synthesis_dec.c | 50 +--------- lib_dec/ivas_ism_renderer.c | 48 +-------- lib_dec/ivas_masa_dec.c | 63 +----------- lib_dec/ivas_stat_dec.h | 12 +-- lib_enc/ivas_init_enc.c | 6 +- lib_enc/ivas_omasa_enc.c | 100 ------------------- lib_enc/ivas_stat_enc.h | 8 -- lib_rend/ivas_dirac_dec_binaural_functions.c | 46 ++------- 13 files changed, 23 insertions(+), 351 deletions(-) diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 8e811e6938..2566ad5fad 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -69,7 +69,7 @@ int32_t get_delay( { delay = IVAS_ENC_DELAY_NS; -#ifdef FIX_OMASA_DELAY_COMP +#ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) #else if ( ivas_format == MASA_FORMAT ) @@ -109,7 +109,7 @@ int32_t get_delay( } -#ifdef FIX_OMASA_DELAY_COMP +#ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) #else if ( ivas_format == MASA_FORMAT ) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 79a8a6db6d..338e1b4d24 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5127,15 +5127,9 @@ ivas_error ivas_omasa_enc_open( ); void ivas_omasa_enc_close( -#ifdef FIX_OMASA_DELAY_COMP OMASA_ENC_HANDLE hOMasa /* i/o: encoder OMASA handle */ -#else - OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ - const int16_t nchan_ism /* i : number of objects */ -#endif ); -#ifdef MASA_AND_OBJECTS ivas_error ivas_omasa_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -5143,7 +5137,6 @@ ivas_error ivas_omasa_enc_config( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ diff --git a/lib_com/options.h b/lib_com/options.h index d251f3b838..d86a5355fa 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,9 +169,7 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ -#define FIX_OMASA_DELAY_COMP /* Nokia: OMASA audio/meta delay compensation */ - -#endif /* MASA_AND_OBJECTS */ +#endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 6b368ab391..8e5ab73f21 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -404,9 +404,7 @@ ivas_error ivas_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifdef FIX_OMASA_DELAY_COMP int16_t dirac_bs_md_write_idx = 0; -#endif st = st_ivas->hCPE[0]->hCoreCoder[0]; nb_bits_metadata[0] = 0; @@ -428,9 +426,7 @@ ivas_error ivas_dec( st_ivas->hDirAC->numIsmDirections = 0; } -#ifdef FIX_OMASA_DELAY_COMP dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ -#endif } /* MASA metadata decoding */ @@ -481,12 +477,10 @@ ivas_error ivas_dec( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) #endif { -#ifdef FIX_OMASA_DELAY_COMP int16_t azimuth_ism; int16_t elevation_ism; int16_t block; int16_t meta_write_index; -#endif /* decode ISM metadata */ if ( ( error = ivas_ism_metadata_dec( ism_total_brate, @@ -506,7 +500,6 @@ ivas_error ivas_dec( { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { -#ifdef FIX_OMASA_DELAY_COMP azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); @@ -516,15 +509,10 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; } -#else - st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); - st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); -#endif } } else /* ISM_MASA_MODE_MASA_ONE_OBJ */ { -#ifdef FIX_OMASA_DELAY_COMP azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); @@ -534,10 +522,6 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; } -#else - st_ivas->hMasaIsmData->azimuth_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); - st_ivas->hMasaIsmData->elevation_separated_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); -#endif } #else for ( n = 0; n < st_ivas->nchan_ism; n++ ) @@ -647,9 +631,7 @@ ivas_error ivas_dec( #endif { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; -#ifdef FIX_OMASA_DELAY_COMP int16_t dirac_read_idx; -#endif #ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) @@ -667,14 +649,12 @@ ivas_error ivas_dec( } } -#ifdef FIX_OMASA_DELAY_COMP dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; -#endif + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); -#ifdef FIX_OMASA_DELAY_COMP st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ -#endif + ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index db8caed4bb..7fb40f6a4f 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -843,7 +843,7 @@ ivas_error ivas_dirac_dec_config( { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; } -#ifdef FIX_OMASA_DELAY_COMP +#ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) #else else if ( st_ivas->ivas_format == MASA_FORMAT ) diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index a7fd962ff9..d5e5710fa2 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -1625,48 +1625,25 @@ void ivas_dirac_dec_compute_directional_responses( } else { -#ifdef FIX_OMASA_DELAY_COMP ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); -#else - ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); -#endif } for ( l = 0; l < num_channels_dir; l++ ) { -#ifdef FIX_OMASA_DELAY_COMP direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; -#else - direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; -#endif } } -#ifdef FIX_OMASA_DELAY_COMP masaDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + EPSILON; -#else - masaDirect = hDirAC->energy_ratio1[subframe_idx][k] + EPSILON; -#endif if ( hDirAC->numParametricDirections == 2 ) { -#ifdef FIX_OMASA_DELAY_COMP masaDirect += hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k]; -#else - masaDirect += hDirAC->energy_ratio2[subframe_idx][k]; -#endif } -#ifdef FIX_OMASA_DELAY_COMP + ismDirect = hMasaIsm->energy_ratio_ism[0][hDirAC->dirac_read_idx][k]; -#else - ismDirect = hMasaIsm->energy_ratio_ism[0][subframe_idx][k]; -#endif for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) { -#ifdef FIX_OMASA_DELAY_COMP ismDirect += hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; -#else - ismDirect += hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; -#endif } totalDirect = masaDirect + ismDirect; @@ -1770,11 +1747,7 @@ void ivas_dirac_dec_compute_directional_responses( else { #ifdef OMASA_UPDATES -#ifdef FIX_OMASA_DELAY_COMP vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], 1 ); -#else - vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir], 1 ); -#endif #else vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir] ); #endif @@ -1782,40 +1755,21 @@ void ivas_dirac_dec_compute_directional_responses( for ( l = 0; l < num_channels_dir; l++ ) { -#ifdef FIX_OMASA_DELAY_COMP direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; -#else - direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; -#endif } } normalizePanningGains( direct_response_ism, num_channels_dir ); -#ifdef FIX_OMASA_DELAY_COMP masaDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + EPSILON; -#else - masaDirect = hDirAC->energy_ratio1[subframe_idx][k] + EPSILON; -#endif if ( hDirAC->numParametricDirections == 2 ) { -#ifdef FIX_OMASA_DELAY_COMP masaDirect += hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k]; -#else - masaDirect += hDirAC->energy_ratio2[subframe_idx][k]; -#endif } -#ifdef FIX_OMASA_DELAY_COMP + ismDirect = hMasaIsm->energy_ratio_ism[0][hDirAC->dirac_read_idx][k]; -#else - ismDirect = hMasaIsm->energy_ratio_ism[0][subframe_idx][k]; -#endif for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) { -#ifdef FIX_OMASA_DELAY_COMP ismDirect += hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; -#else - ismDirect += hMasaIsm->energy_ratio_ism[dir][subframe_idx][k]; -#endif } totalDirect = masaDirect + ismDirect; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 9ffc1b479c..a44a8c4588 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -274,11 +274,8 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); } -#ifdef FIX_OMASA_DELAY_COMP interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); -#else - interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / 50 ); -#endif + for ( i = 0; i < interpolator_length; i++ ) { st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length ); @@ -341,26 +338,18 @@ void ivas_masa_ism_separate_object_render( int16_t azimuth, elevation; int16_t num_objects; uint8_t single_separated; -#ifdef FIX_OMASA_DELAY_COMP int16_t block; int16_t subframe_len; int16_t idx_offset; int16_t dirac_read_idx; -#endif hVBAPdata = st_ivas->hVBAPdata; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; hRendererData = st_ivas->hIsmRendererData; lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; -#ifdef FIX_OMASA_DELAY_COMP subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#endif -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { single_separated = 1; num_objects = 1; @@ -375,32 +364,20 @@ void ivas_masa_ism_separate_object_render( { delay_signal( input_f[obj], output_frame, st_ivas->hMasaIsmData->delayBuffer[obj], st_ivas->hMasaIsmData->delayBuffer_size ); /* Delay the signal to match CLDFB delay */ -#ifdef FIX_OMASA_DELAY_COMP for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { idx_offset = block * subframe_len; dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; -#endif if ( single_separated ) { -#ifdef FIX_OMASA_DELAY_COMP azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; elevation = st_ivas->hMasaIsmData->elevation_separated_ism[dirac_read_idx]; -#else - azimuth = st_ivas->hMasaIsmData->azimuth_separated_ism; - elevation = st_ivas->hMasaIsmData->elevation_separated_ism; -#endif } else { -#ifdef FIX_OMASA_DELAY_COMP azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj][dirac_read_idx]; elevation = st_ivas->hMasaIsmData->elevation_ism[obj][dirac_read_idx]; -#else - azimuth = st_ivas->hMasaIsmData->azimuth_ism[obj]; - elevation = st_ivas->hMasaIsmData->elevation_ism[obj]; -#endif } if ( st_ivas->hOutSetup.is_planar_setup ) @@ -408,21 +385,10 @@ void ivas_masa_ism_separate_object_render( /* If no elevation support in output format, then rendering should be done with zero elevation */ elevation = 0; } -#ifndef OMASA_UPDATES - else if ( output_config == AUDIO_CONFIG_7_1_4 || output_config == AUDIO_CONFIG_5_1_4 ) - { - /* For no negative elevations, it's better to map them to zero */ - elevation = elevation < 0 ? 0 : elevation; - } -#endif if ( hVBAPdata != NULL ) { -#ifdef OMASA_UPDATES vbap_determine_gains( hVBAPdata, gains, azimuth, elevation, 1 ); -#else - vbap_determine_gains( hVBAPdata, gains, azimuth, elevation ); -#endif } else { @@ -442,31 +408,19 @@ void ivas_masa_ism_separate_object_render( if ( fabsf( gains[j] ) > 0.0f || fabsf( hRendererData->prev_gains[obj][j] ) > 0.0f ) { -#ifdef FIX_OMASA_DELAY_COMP for ( k = 0; k < subframe_len; k++ ) -#else - for ( k = 0; k < output_frame; k++ ) -#endif { g1 = hRendererData->interpolator[k]; g2 = 1.0f - g1; -#ifdef FIX_OMASA_DELAY_COMP output_f[j2][k + idx_offset] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k + idx_offset]; -#else - output_f[j2][k] += ( g1 * gains[j] + g2 * hRendererData->prev_gains[obj][j] ) * input_f[obj][k]; -#endif } } hRendererData->prev_gains[obj][j] = gains[j]; } -#ifdef FIX_OMASA_DELAY_COMP } -#endif } -#ifdef FIX_OMASA_DELAY_COMP st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % st_ivas->hDirAC->dirac_md_buffer_length; -#endif return; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 4ad5e8f437..37941c7328 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -76,11 +76,7 @@ static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hM static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); #ifdef MASA_AND_OBJECTS -#ifdef FIX_OMASA_DELAY_COMP static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp, const int16_t dirac_bs_md_write_idx, const int16_t dirac_md_buffer_length ); -#else -static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp ); -#endif static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, const int16_t nchan_ism, const int16_t K ); @@ -113,11 +109,9 @@ ivas_error ivas_masa_decode( #ifdef MASA_AND_OBJECTS int16_t obj; int16_t i, ch, ism_imp; -#ifdef FIX_OMASA_DELAY_COMP int16_t dirac_bs_md_write_idx; dirac_bs_md_write_idx = 0; -#endif ism_imp = 0; #endif @@ -334,11 +328,7 @@ ivas_error ivas_masa_decode( #endif { *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, -#ifdef FIX_OMASA_DELAY_COMP st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); -#else - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp ); -#endif } #ifdef OMASA_UPDATES @@ -351,7 +341,6 @@ ivas_error ivas_masa_decode( { if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) { -#ifdef FIX_OMASA_DELAY_COMP int16_t sf; int16_t meta_write_index; @@ -361,10 +350,6 @@ ivas_error ivas_masa_decode( st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->azimuth_ism[obj][meta_write_index]; st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->elevation_ism[obj][meta_write_index]; } -#else - st_ivas->hMasaIsmData->azimuth_separated_ism = st_ivas->hMasaIsmData->azimuth_ism[obj]; - st_ivas->hMasaIsmData->elevation_separated_ism = st_ivas->hMasaIsmData->elevation_ism[obj]; -#endif } } } @@ -471,9 +456,8 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { -#ifdef FIX_OMASA_DELAY_COMP dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ -#endif + ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, SBA_MODE_NONE, 0 ); } @@ -492,39 +476,27 @@ ivas_error ivas_masa_decode( { int16_t b; int16_t block; -#ifdef FIX_OMASA_DELAY_COMP int16_t meta_write_index; -#endif for ( i = 0; i < st_ivas->hDirAC->numIsmDirections; i++ ) /* Todo Nokia: Probably there is a better place for this eventually */ { for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { -#ifdef FIX_OMASA_DELAY_COMP meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; -#endif + for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { -#ifdef FIX_OMASA_DELAY_COMP st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][meta_write_index][b]; -#else - st_ivas->hDirAC->diffuseness_vector[block][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b]; -#endif } } } for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { -#ifdef FIX_OMASA_DELAY_COMP meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; -#endif + for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { -#ifdef FIX_OMASA_DELAY_COMP st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] = max( 0.0f, st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] ); -#else - st_ivas->hDirAC->diffuseness_vector[block][b] = max( 0.0f, st_ivas->hDirAC->diffuseness_vector[block][b] ); -#endif } } } @@ -2328,13 +2300,9 @@ static int16_t ivas_decode_masaism_metadata( uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, -#ifdef FIX_OMASA_DELAY_COMP const int16_t ism_imp, const int16_t dirac_bs_md_write_idx, const int16_t dirac_md_buffer_length ) -#else - const int16_t ism_imp ) -#endif { int16_t sf, band, dir, nbands, nblocks, obj, i; float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; @@ -2346,10 +2314,9 @@ static int16_t ivas_decode_masaism_metadata( int16_t nb_bits_read; #ifdef OMASA_UPDATES float delta_phi; -#ifdef FIX_OMASA_DELAY_COMP int16_t meta_write_index; #endif -#endif + nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; nblocks = hQMetaData->q_direction->cfg.nblocks; /* To do: what if other value than 4? */ @@ -2434,17 +2401,12 @@ static int16_t ivas_decode_masaism_metadata( #endif -#ifdef FIX_OMASA_DELAY_COMP for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { meta_write_index = ( dirac_bs_md_write_idx + sf ) % dirac_md_buffer_length; hMasaIsmData->azimuth_ism[obj][meta_write_index] = (int16_t) rint( azimuth ); hMasaIsmData->elevation_ism[obj][meta_write_index] = (int16_t) rint( elevation ); } -#else - hMasaIsmData->azimuth_ism[obj] = (int16_t) rint( azimuth ); - hMasaIsmData->elevation_ism[obj] = (int16_t) rint( elevation ); -#endif } /* Modify ISM metadata based on the MASA-to-total energy ratios */ @@ -2475,17 +2437,12 @@ static int16_t ivas_decode_masaism_metadata( { i = sf; } -#ifdef FIX_OMASA_DELAY_COMP + meta_write_index = ( dirac_bs_md_write_idx + sf ) % dirac_md_buffer_length; -#endif for ( dir = 0; dir < nchan_ism; dir++ ) { -#ifdef FIX_OMASA_DELAY_COMP hMasaIsmData->energy_ratio_ism[dir][meta_write_index][b] = energy_ratio_ism[i][band][dir]; -#else - hMasaIsmData->energy_ratio_ism[dir][sf][b] = energy_ratio_ism[i][band][dir]; -#endif } } } @@ -2515,17 +2472,12 @@ void ivas_masa_ism_set_edited_objects( { if ( st_ivas->editing_ism_enabled ) { -#ifdef FIX_OMASA_DELAY_COMP int16_t sf; for ( sf = 0; sf < ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); sf++ ) { hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism][sf] = st_ivas->azimuth_edited; hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism][sf] = st_ivas->elevation_edited; } -#else - hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism] = st_ivas->azimuth_edited; - hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism] = st_ivas->elevation_edited; -#endif #ifdef OMASA_UPDATES st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->azimuth = st_ivas->azimuth_edited; st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->elevation = st_ivas->elevation_edited; @@ -2562,17 +2514,12 @@ void ivas_masa_ism_set_edited_objects( { if ( st_ivas->hMasaIsmData->idx_separated_ism == st_ivas->index_of_edited_ism ) { -#ifdef FIX_OMASA_DELAY_COMP int16_t sf; for ( sf = 0; sf < ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); sf++ ) { st_ivas->hMasaIsmData->azimuth_separated_ism[sf] = st_ivas->azimuth_edited; st_ivas->hMasaIsmData->elevation_separated_ism[sf] = st_ivas->elevation_edited; } -#else - st_ivas->hMasaIsmData->azimuth_separated_ism = st_ivas->azimuth_edited; - st_ivas->hMasaIsmData->elevation_separated_ism = st_ivas->elevation_edited; -#endif } } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 793b438aaf..a643fe15a0 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1144,28 +1144,18 @@ typedef struct ivas_masa_decoder_struct /* Data structure for MASA_ISM rendering */ typedef struct ivas_masa_ism_data_structure { -#ifdef FIX_OMASA_DELAY_COMP int16_t azimuth_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; int16_t elevation_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; -#else - int16_t azimuth_ism[MAX_NUM_OBJECTS]; - int16_t elevation_ism[MAX_NUM_OBJECTS]; - float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif int16_t azimuth_ism_edited[MAX_NUM_OBJECTS]; int16_t elevation_ism_edited[MAX_NUM_OBJECTS]; uint8_t ism_is_edited[MAX_NUM_OBJECTS]; int16_t idx_separated_ism; -#ifdef FIX_OMASA_DELAY_COMP int16_t azimuth_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; int16_t elevation_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; -#else - int16_t azimuth_separated_ism; - int16_t elevation_separated_ism; -#endif + #ifdef OMASA_UPDATES float q_azimuth_old[MAX_NUM_OBJECTS]; float q_elevation_old[MAX_NUM_OBJECTS]; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 7e9bdcd0e0..6c8c10226f 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -1087,11 +1087,7 @@ void ivas_destroy_enc( #ifdef MASA_AND_OBJECTS if ( st_ivas->hOMasa != NULL ) { -#ifdef FIX_OMASA_DELAY_COMP - ivas_omasa_enc_close( st_ivas->hOMasa ); -#else - ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); -#endif + ivas_omasa_enc_close( st_ivas->hOMasa ); // VE!!!!! st_ivas->hOMasa = NULL; } #endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index fdbe8d063d..bd38a64945 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -72,9 +72,6 @@ ivas_error ivas_omasa_enc_open( ) { int16_t i, j; -#ifndef FIX_OMASA_DELAY_COMP - float tmp_f; -#endif OMASA_ENC_HANDLE hOMasa; int16_t numAnalysisChannels; int16_t input_frame; @@ -91,31 +88,6 @@ ivas_error ivas_omasa_enc_open( numAnalysisChannels = st_ivas->hEncoderConfig->nchan_ism; -#ifndef FIX_OMASA_DELAY_COMP - /* initialize delay compensation */ - hOMasa->num_samples_delay_comp = NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS ); - tmp_f = ( (float) hOMasa->num_samples_delay_comp ) / (float) ( NS2SA( st_ivas->hEncoderConfig->input_Fs, DIRAC_SLOT_NS ) ); - hOMasa->num_slots_delay_comp = (int16_t) ( tmp_f ); - - if ( tmp_f > hOMasa->num_slots_delay_comp ) - { - hOMasa->num_slots_delay_comp++; - hOMasa->offset_comp = -hOMasa->num_samples_delay_comp; - hOMasa->num_samples_delay_comp = hOMasa->num_slots_delay_comp * NS2SA( st_ivas->hEncoderConfig->input_Fs, DIRAC_SLOT_NS ); - hOMasa->offset_comp += hOMasa->num_samples_delay_comp; - } - else - { - hOMasa->offset_comp = 0; - } - - for ( i = 0; i < numAnalysisChannels; i++ ) - { - hOMasa->delay_buffer[i] = (float *) malloc( NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_NS ) * sizeof( float ) ); /* Todo Nokia: Return errors if alloc fails */ - set_zero( hOMasa->delay_buffer[i], NS2SA( st_ivas->hEncoderConfig->input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_NS ) ); - } -#endif - /* open/initialize CLDFB */ hOMasa->num_Cldfb_instances = numAnalysisChannels; for ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) @@ -178,24 +150,11 @@ ivas_error ivas_omasa_enc_open( *--------------------------------------------------------------------------*/ void ivas_omasa_enc_close( -#ifdef FIX_OMASA_DELAY_COMP OMASA_ENC_HANDLE hOMasa /* i/o: encoder OMASA handle */ -#else - OMASA_ENC_HANDLE hOMasa, /* i/o: encoder OMASA handle */ - const int16_t nchan_ism /* i : number of objects */ -#endif ) { int16_t i, j; -#ifndef FIX_OMASA_DELAY_COMP - for ( i = 0; i < nchan_ism; i++ ) - { - free( hOMasa->delay_buffer[i] ); - hOMasa->delay_buffer[i] = NULL; - } -#endif - for ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { deleteCldfb( &( hOMasa->cldfbAnaEnc[i] ) ); @@ -306,11 +265,7 @@ ivas_error ivas_omasa_enc_config( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hOMasa != NULL ) { -#ifdef FIX_OMASA_DELAY_COMP ivas_omasa_enc_close( st_ivas->hOMasa ); -#else - ivas_omasa_enc_close( st_ivas->hOMasa, st_ivas->hEncoderConfig->nchan_ism ); -#endif st_ivas->hOMasa = NULL; } @@ -966,14 +921,6 @@ static void ivas_omasa_param_est_enc( set_zero( renormalization_factor_diff, hOMasa->nbands ); set_zero( diffuseness_m, hOMasa->nbands ); -#ifndef FIX_OMASA_DELAY_COMP - /* Copy current frame to memory for delay compensation */ - for ( i = 0; i < nchan_ism; i++ ) - { - mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); - } -#endif - /* Compute ISM to FOA matrices */ for ( i = 0; i < nchan_ism; i++ ) { @@ -1002,18 +949,7 @@ static void ivas_omasa_param_est_enc( { for ( i = 0; i < nchan_ism; i++ ) { -#ifdef FIX_OMASA_DELAY_COMP cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); -#else - if ( ts < hOMasa->num_slots_delay_comp ) - { - cldfbAnalysis_ts( &( hOMasa->delay_buffer[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); - } - else - { - cldfbAnalysis_ts( &( data_f[i][hOMasa->offset_comp + l_ts * ( ts - hOMasa->num_slots_delay_comp )] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); - } -#endif } /* Compute energy */ @@ -1131,14 +1067,6 @@ static void ivas_omasa_param_est_enc( energyRatio[band_m_idx] = 1.0f - diffuseness_m[band_m_idx]; } -#ifndef FIX_OMASA_DELAY_COMP - /* Update memory */ - for ( i = 0; i < nchan_ism; i++ ) - { - mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); - } -#endif - return; } @@ -1164,15 +1092,6 @@ static void ivas_omasa_energy_and_ratio_est( num_freq_bands = hOMasa->nbands; l_ts = input_frame / CLDFB_NO_COL_MAX; - -#ifndef FIX_OMASA_DELAY_COMP - /* Copy current frame to memory for delay compensation */ - for ( i = 0; i < nchan_inp; i++ ) - { - mvr2r( &data_f[i][0], &( hOMasa->delay_buffer[i][hOMasa->num_samples_delay_comp - hOMasa->offset_comp] ), hOMasa->offset_comp ); - } -#endif - /* do processing over all CLDFB time slots */ for ( block_m_idx = 0; block_m_idx < hOMasa->nSubframes; block_m_idx++ ) { @@ -1191,18 +1110,7 @@ static void ivas_omasa_energy_and_ratio_est( { for ( i = 0; i < nchan_inp; i++ ) { -#ifdef FIX_OMASA_DELAY_COMP cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); -#else - if ( ts < hOMasa->num_slots_delay_comp ) - { - cldfbAnalysis_ts( &( hOMasa->delay_buffer[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); - } - else - { - cldfbAnalysis_ts( &( data_f[i][hOMasa->offset_comp + l_ts * ( ts - hOMasa->num_slots_delay_comp )] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); - } -#endif } /* Compute energy */ @@ -1244,14 +1152,6 @@ static void ivas_omasa_energy_and_ratio_est( hMasa->data.nchan_ism = nchan_inp; } -#ifndef FIX_OMASA_DELAY_COMP - /* Update memory */ - for ( i = 0; i < nchan_inp; i++ ) - { - mvr2r( &data_f[i][input_frame - hOMasa->num_samples_delay_comp + hOMasa->offset_comp], &( hOMasa->delay_buffer[i][0] ), ( hOMasa->num_samples_delay_comp - hOMasa->offset_comp ) ); - } -#endif - return; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 0c7a3bc375..80dddaf9dd 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -852,14 +852,6 @@ typedef struct ivas_omasa_enc_data_structure uint8_t nCodingBands; uint8_t nSubframes; -#ifndef FIX_OMASA_DELAY_COMP - /* delay compensation */ - float *delay_buffer[MAX_NUM_OBJECTS]; /* Delay buffer for parameter estimation */ - int16_t num_samples_delay_comp; - int16_t num_slots_delay_comp; - int16_t offset_comp; -#endif - /* CLDFB analysis */ int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_OBJECTS]; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 7ee3add834..0135239e2e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -641,7 +641,7 @@ static void ivas_dirac_dec_binaural_internal( ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, firstSlot, slotEnd ); st_ivas->hDirAC->hDiffuseDist = NULL; -#ifdef FIX_OMASA_DELAY_COMP +#ifdef MASA_AND_OBJECTS st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + nSubframes ) % st_ivas->hDirAC->dirac_md_buffer_length; #endif @@ -885,19 +885,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } else { -#ifdef FIX_OMASA_DELAY_COMP aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; -#else - aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex]; - eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex]; -#endif } -#ifdef FIX_OMASA_DELAY_COMP ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; -#else - ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][subframe][bin]; -#endif spreadCoh = 0.0f; } #endif @@ -1113,10 +1104,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #endif frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; } - -#ifndef FIX_OMASA_DELAY_COMP - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; -#endif } /* Formulate average diffuseness over frame */ @@ -1202,14 +1189,16 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( uint8_t nchanSeparateChannels; #endif int16_t nBins; -#ifdef FIX_OMASA_DELAY_COMP +#ifdef MASA_AND_OBJECTS int16_t dirac_read_idx; #endif DIRAC_DEC_BIN_HANDLE h; + h = st_ivas->hDiracDecBin; #ifdef MASA_AND_OBJECTS separateCenterChannelRendering = 0; nchanSeparateChannels = 0; + #ifdef OMASA_UPDATES if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) #else @@ -1235,8 +1224,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( #else separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; #endif + nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ -#ifdef FIX_OMASA_DELAY_COMP +#ifdef MASA_AND_OBJECTS dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; #endif @@ -1395,23 +1385,13 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifdef FIX_OMASA_DELAY_COMP aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB][dirac_read_idx]; eleDeg = st_ivas->hMasaIsmData->elevation_ism[chB][dirac_read_idx]; -#else - aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB]; - eleDeg = st_ivas->hMasaIsmData->elevation_ism[chB]; -#endif } else { -#ifdef FIX_OMASA_DELAY_COMP aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism[dirac_read_idx]; -#else - aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism; - eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism; -#endif instantChange = 1; } } @@ -2334,9 +2314,7 @@ void preProcessStereoTransportsForMovedObjects( DIRAC_DEC_HANDLE hDirAC; MASA_ISM_DATA_HANDLE hMasaIsmData; uint8_t enableCentering; -#ifdef FIX_OMASA_DELAY_COMP int16_t dirac_read_idx; -#endif hDirAC = st_ivas->hDirAC; hMasaIsmData = st_ivas->hMasaIsmData; @@ -2370,9 +2348,7 @@ void preProcessStereoTransportsForMovedObjects( /* Perform object-movement based processing */ for ( subframe = firstSubframe; subframe < ( firstSubframe + nSubframes ); subframe++ ) { -#ifdef FIX_OMASA_DELAY_COMP dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; -#endif for ( bin = 0; bin < nBins; bin++ ) { @@ -2419,21 +2395,13 @@ void preProcessStereoTransportsForMovedObjects( float panEnesIn[2]; float centeringFactor; -#ifdef FIX_OMASA_DELAY_COMP ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; -#else - ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][subframe][bin]; -#endif + ismRatioAcc += ratio; /* Get input and output panning gains */ -#ifdef FIX_OMASA_DELAY_COMP ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], -#else - ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex], - hMasaIsmData->elevation_ism[ismDirIndex], -#endif panGainsIn ); if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) -- GitLab From 81ef67c806106225a5c531fa9b3b647dfd0e7d8f Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 16:47:38 +0200 Subject: [PATCH 099/591] formal improvement --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_masa_dec.c | 2 ++ lib_enc/ivas_init_enc.c | 7 ++----- lib_enc/ivas_omasa_enc.c | 28 +++++++++++++++++----------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 338e1b4d24..21488cafbf 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5127,7 +5127,7 @@ ivas_error ivas_omasa_enc_open( ); void ivas_omasa_enc_close( - OMASA_ENC_HANDLE hOMasa /* i/o: encoder OMASA handle */ + OMASA_ENC_HANDLE *hOMasa /* i/o: encoder OMASA handle */ ); ivas_error ivas_omasa_enc_config( diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 37941c7328..23865f11ec 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -456,7 +456,9 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { +#ifdef MASA_AND_OBJECTS dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ +#endif ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, SBA_MODE_NONE, 0 ); } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 6c8c10226f..a9d1c83c43 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -1085,11 +1085,8 @@ void ivas_destroy_enc( ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); #ifdef MASA_AND_OBJECTS - if ( st_ivas->hOMasa != NULL ) - { - ivas_omasa_enc_close( st_ivas->hOMasa ); // VE!!!!! - st_ivas->hOMasa = NULL; - } + /* OMASA handle */ + ivas_omasa_enc_close( &( st_ivas->hOMasa ) ); #endif /* Stereo downmix for EVS encoder handle */ diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index bd38a64945..a9f182705a 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -150,35 +150,41 @@ ivas_error ivas_omasa_enc_open( *--------------------------------------------------------------------------*/ void ivas_omasa_enc_close( - OMASA_ENC_HANDLE hOMasa /* i/o: encoder OMASA handle */ + OMASA_ENC_HANDLE *hOMasa /* i/o: encoder OMASA handle */ ) { int16_t i, j; - for ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) + if ( hOMasa == NULL || *hOMasa == NULL ) + { + return; + } + + for ( i = 0; i < ( *hOMasa )->num_Cldfb_instances; i++ ) { - deleteCldfb( &( hOMasa->cldfbAnaEnc[i] ) ); + deleteCldfb( &( ( *hOMasa )->cldfbAnaEnc[i] ) ); } for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - free( hOMasa->direction_vector_m[i][j] ); - hOMasa->direction_vector_m[i][j] = NULL; + free( ( *hOMasa )->direction_vector_m[i][j] ); + ( *hOMasa )->direction_vector_m[i][j] = NULL; } for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - free( hOMasa->buffer_intensity_real[i][j] ); - hOMasa->buffer_intensity_real[i][j] = NULL; + free( ( *hOMasa )->buffer_intensity_real[i][j] ); + ( *hOMasa )->buffer_intensity_real[i][j] = NULL; } - free( hOMasa->direction_vector_m[i] ); - hOMasa->direction_vector_m[i] = NULL; + free( ( *hOMasa )->direction_vector_m[i] ); + ( *hOMasa )->direction_vector_m[i] = NULL; } - free( hOMasa ); + free( *hOMasa ); + ( *hOMasa ) = NULL; return; } @@ -265,7 +271,7 @@ ivas_error ivas_omasa_enc_config( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hOMasa != NULL ) { - ivas_omasa_enc_close( st_ivas->hOMasa ); + ivas_omasa_enc_close( &( st_ivas->hOMasa ) ); st_ivas->hOMasa = NULL; } -- GitLab From b4e8c3286fcdc50e5bfd232d7de1e4cfe42c92f8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 16:58:02 +0200 Subject: [PATCH 100/591] merge OMASA_UPDATES into MASA_AND_OBJECTS; decoder side --- lib_dec/ivas_cpe_dec.c | 18 +----- lib_dec/ivas_dec.c | 69 +---------------------- lib_dec/ivas_dirac_dec.c | 11 +--- lib_dec/ivas_dirac_output_synthesis_dec.c | 12 +--- lib_dec/ivas_init_dec.c | 15 +---- lib_dec/ivas_ism_metadata_dec.c | 36 ------------ lib_dec/ivas_ism_renderer.c | 4 -- lib_dec/ivas_masa_dec.c | 69 +---------------------- lib_dec/ivas_mono_dmx_renderer.c | 5 +- lib_dec/ivas_omasa_dec.c | 41 +------------- lib_dec/ivas_sce_dec.c | 12 ---- lib_dec/ivas_stat_dec.h | 4 +- lib_dec/ivas_vbap.c | 24 ++++---- 13 files changed, 27 insertions(+), 293 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index e6cbf2bc74..97a046fe9d 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -268,11 +268,7 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif { sts[0]->total_brate += hCPE->brate_surplus; } @@ -301,11 +297,7 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS /* compute bit-rate surplus per channel in combined format coding */ int32_t brate_surplus[CPE_CHANNELS]; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { brate_surplus[0] = ( ( hCPE->brate_surplus / FRAMES_PER_SEC ) >> 1 ) * FRAMES_PER_SEC; brate_surplus[1] = hCPE->brate_surplus - brate_surplus[0]; @@ -339,11 +331,7 @@ ivas_error ivas_cpe_dec( #ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { sts[n]->bits_frame_channel += (int16_t) ( brate_surplus[n] / FRAMES_PER_SEC ); sts[n]->total_brate += brate_surplus[n]; @@ -681,11 +669,7 @@ ivas_error create_cpe_dec( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { cpe_brate = element_brate; } @@ -1116,7 +1100,7 @@ static void read_stereo_mode_and_bwidth( else { /* read stereo technology info */ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k ) ) #else if ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 8e5ab73f21..199af09c8d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -413,11 +413,7 @@ ivas_error ivas_dec( /* Set the number of objects for the parametric rendering */ if ( st_ivas->hDirAC != NULL ) { -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) -#endif { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } @@ -440,7 +436,7 @@ ivas_error ivas_dec( st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); -#ifdef OMASA_UPDATES + //VE: !!!!! /* set ISM parameters */ int16_t nchan_ism, nchan_transport_ism; nchan_ism = st_ivas->nchan_ism; @@ -455,27 +451,9 @@ ivas_error ivas_dec( nchan_ism = 0; nchan_transport_ism = 1; } -#endif /* decode ISM metadata */ -#ifndef OMASA_UPDATES - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - if ( st_ivas->nSCE == 1 ) - { - ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); - } - else - { -#ifdef DEBUGGING - assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); -#endif - } - } - else -#else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#endif { int16_t azimuth_ism; int16_t elevation_ism; @@ -483,19 +461,12 @@ ivas_error ivas_dec( int16_t meta_write_index; /* decode ISM metadata */ - if ( ( error = ivas_ism_metadata_dec( ism_total_brate, -#ifdef OMASA_UPDATES - nchan_ism, &nchan_transport_ism, -#else - st_ivas->nchan_ism, &( st_ivas->nSCE ), -#endif - st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_metadata_dec( ism_total_brate, nchan_ism, &nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) { return error; } // VE: move the following updates into ivas_ism_metadata_dec() -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) @@ -523,31 +494,8 @@ ivas_error ivas_dec( st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; } } -#else - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); - st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); - } -#endif - -#ifndef OMASA_UPDATES - for ( n = 0; n < st_ivas->nSCE - 1; n++ ) - { - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } -#ifdef OMASA_UPDATES /* decode ISM channels */ for ( n = 0; n < nchan_transport_ism; n++ ) { @@ -556,7 +504,6 @@ ivas_error ivas_dec( return error; } } -#endif /* decode MASA channels */ if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) @@ -581,7 +528,6 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; @@ -614,9 +560,6 @@ ivas_error ivas_dec( { ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); } -#else - ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); -#endif } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { @@ -624,20 +567,12 @@ ivas_error ivas_dec( } else if ( st_ivas->hDirAC ) { -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; int16_t dirac_read_idx; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { mvr2r( output[2], data_separated_objects[0], output_frame ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 7fb40f6a4f..69e9dcfef4 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2250,18 +2250,9 @@ void ivas_dirac_dec( } } -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) -#endif { - preProcessStereoTransportsForMovedObjects( st_ivas, - Cldfb_RealBuffer_Temp, - Cldfb_ImagBuffer_Temp, - (uint8_t) ( hDirAC->num_freq_bands ), - (uint8_t) subframe_idx, - 1 ); + preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, (uint8_t) ( hDirAC->num_freq_bands ), (uint8_t) subframe_idx, 1 ); } } #endif diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index d5e5710fa2..d245849376 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -1738,19 +1738,11 @@ void ivas_dirac_dec_compute_directional_responses( { if ( hMasaIsm->ism_is_edited[dir] ) { -#ifdef OMASA_UPDATES vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir], 1 ); -#else - vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir] ); -#endif } else { -#ifdef OMASA_UPDATES vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], 1 ); -#else - vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir], hMasaIsm->elevation_ism[dir] ); -#endif } for ( l = 0; l < num_channels_dir; l++ ) @@ -2268,7 +2260,7 @@ static void spreadCoherencePanningVbap( return; } -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS vbap_determine_gains( hVBAPdata, direct_response, azimuth, elevation, 0 ); #else vbap_determine_gains( hVBAPdata, direct_response, azimuth, elevation ); @@ -2276,7 +2268,7 @@ static void spreadCoherencePanningVbap( if ( spreadCoh > 0.f ) { -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS vbap_determine_gains( hVBAPdata, direct_response_left, azimuth + 30, elevation, 0 ); vbap_determine_gains( hVBAPdata, direct_response_right, azimuth - 30, elevation, 0 ); #else diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 99e2fb0a15..560618b552 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1062,11 +1062,8 @@ ivas_error ivas_init_decoder( { k++; } -#ifdef OMASA_UPDATES + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { /* one separated object */ st_ivas->nSCE = 1; @@ -1247,7 +1244,7 @@ ivas_error ivas_init_decoder( } else { -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS vbap_determine_gains( st_ivas->hVBAPdata, st_ivas->hLsSetupCustom->separate_ch_gains, 0, 0, 0 ); #else vbap_determine_gains( st_ivas->hVBAPdata, st_ivas->hLsSetupCustom->separate_ch_gains, 0, 0 ); @@ -1414,10 +1411,9 @@ ivas_error ivas_init_decoder( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; } -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - // VE: introduce a new renderer_type for this case if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ @@ -1433,7 +1429,6 @@ ivas_error ivas_init_decoder( } } - // VE: introduce a new renderer_type for this case if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ @@ -1997,11 +1992,7 @@ void ivas_init_dec_get_num_cldfb_instances( { *numCldfbAnalyses += st_ivas->nchan_ism; } -#ifdef OMASA_UPDATES else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 9b12be21ed..e512061cfb 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -204,11 +204,7 @@ ivas_error ivas_ism_metadata_dec( /* number of objects was read in ivas_dec_setup() */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode != ISM_MASA_MODE_DISC ) -#endif #endif { /* number of objects was read in ivas_dec_setup() */ @@ -261,11 +257,7 @@ ivas_error ivas_ism_metadata_dec( for ( ch = 0; ch < *nchan_transport; ch++ ) { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { /* ISM importance flag is already read in ivas_masa_decode() */ ism_imp[ch] = hIsmMeta[ch]->ism_imp; @@ -300,11 +292,7 @@ ivas_error ivas_ism_metadata_dec( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { /* VAD flag is already read in ivas_masa_decode() */ localVAD[ch] = hIsmMeta[ch]->ism_vad_flag; @@ -339,11 +327,7 @@ ivas_error ivas_ism_metadata_dec( { hIsmMetaData = hIsmMeta[ch]; #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -405,11 +389,7 @@ ivas_error ivas_ism_metadata_dec( /* save number of metadata bits read */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -497,11 +477,7 @@ ivas_error ivas_ism_metadata_dec( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { ism_metadata_flag_global = 1; } @@ -515,11 +491,7 @@ ivas_error ivas_ism_metadata_dec( { #ifdef MASA_AND_OBJECTS int16_t masa_ism_flag = 0; -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { masa_ism_flag = 1; @@ -550,11 +522,7 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; #endif #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -569,11 +537,7 @@ ivas_error ivas_ism_metadata_dec( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode != ISM_MASA_MODE_DISC ) -#endif #endif { hSCE[ch]->element_brate = element_brate[ch]; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index a44a8c4588..9957522feb 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -283,11 +283,7 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( st_ivas->hMasaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { st_ivas->hMasaIsmData->delayBuffer_nchan = 1; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 23865f11ec..b84d8d1cca 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -121,11 +121,7 @@ ivas_error ivas_masa_decode( low_bitrate_mode = -1; /* This means that LBR mode is not used. */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->hOutSetup.separateChannelEnabled || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->hOutSetup.separateChannelEnabled || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( st_ivas->hOutSetup.separateChannelEnabled ) #endif @@ -177,11 +173,7 @@ ivas_error ivas_masa_decode( st->next_bit_pos -= NO_BITS_MASA_ISM_NO_OBJ; *nb_bits_read += NO_BITS_MASA_ISM_NO_OBJ; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { /* read index of separated object */ /* nchan_ism should be > 1*/ @@ -196,7 +188,6 @@ ivas_error ivas_masa_decode( } /* read ISM importance flag (one per object) */ -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { ism_imp = 0; @@ -208,10 +199,8 @@ ivas_error ivas_masa_decode( } st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; } + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { ism_imp = 0; for ( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) @@ -222,7 +211,6 @@ ivas_error ivas_masa_decode( } st_ivas->hIsmMetaData[0]->ism_imp = ism_imp; -#ifdef OMASA_UPDATES /* reset */ st_ivas->hIsmMetaData[0]->ism_vad_flag = 1; if ( st_ivas->hIsmMetaData[0]->ism_imp == ISM_NO_META ) @@ -231,7 +219,6 @@ ivas_error ivas_masa_decode( st_ivas->hIsmMetaData[0]->ism_vad_flag = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read ) += ISM_METADATA_VAD_FLAG_BITS; } -#endif } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -321,21 +308,13 @@ ivas_error ivas_masa_decode( #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) -#endif { *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); } -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) { @@ -358,11 +337,7 @@ ivas_error ivas_masa_decode( *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) -#endif { /* Modify spatial metadata based on the MASA-to-total energy ratios */ modify_masa_energy_ratios( hQMetaData ); @@ -589,11 +564,7 @@ ivas_error ivas_masa_dec_open( #ifdef MASA_AND_OBJECTS ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -738,11 +709,7 @@ static ivas_error ivas_masa_dec_config( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -754,18 +721,14 @@ static ivas_error ivas_masa_dec_config( if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifdef OMASA_UPDATES if ( st_ivas->hCPE[0]->element_brate == IVAS_48k && st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) { ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, IVAS_32k, st_ivas->nchan_transport, MC_MODE_NONE ); } else { -#endif ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); -#ifdef OMASA_UPDATES } -#endif } else { @@ -1461,11 +1424,7 @@ ivas_error ivas_masa_dec_reconfigure( #ifdef MASA_AND_OBJECTS ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { for ( n = 0; n < st_ivas->nSCE; n++ ) { @@ -2314,10 +2273,8 @@ static int16_t ivas_decode_masaism_metadata( uint16_t idx_el, idx_az; float azimuth, elevation; int16_t nb_bits_read; -#ifdef OMASA_UPDATES float delta_phi; int16_t meta_write_index; -#endif nb_bits_read = *next_bit_pos; nbands = hQMetaData->q_direction->cfg.nbands; @@ -2347,7 +2304,6 @@ static int16_t ivas_decode_masaism_metadata( for ( obj = 0; obj < nchan_ism; obj++ ) { index = 0; -#ifdef OMASA_UPDATES if ( bits_ism[obj] < 8 ) /* if low resolution, can look to the past */ { /* read if same as previous */ @@ -2394,15 +2350,7 @@ static int16_t ivas_decode_masaism_metadata( hMasaIsmData->q_azimuth_old[obj] = azimuth; hMasaIsmData->q_elevation_old[obj] = elevation; } -#else - for ( i = 0; i < bits_ism[obj]; i++ ) - { - index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; - } - deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); - -#endif for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { meta_write_index = ( dirac_bs_md_write_idx + sf ) % dirac_md_buffer_length; @@ -2464,7 +2412,7 @@ void ivas_masa_ism_set_edited_objects( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t dir; + int16_t dir, sf; MASA_ISM_DATA_HANDLE hMasaIsmData; hMasaIsmData = st_ivas->hMasaIsmData; @@ -2474,24 +2422,20 @@ void ivas_masa_ism_set_edited_objects( { if ( st_ivas->editing_ism_enabled ) { - int16_t sf; for ( sf = 0; sf < ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); sf++ ) { hMasaIsmData->azimuth_ism[st_ivas->index_of_edited_ism][sf] = st_ivas->azimuth_edited; hMasaIsmData->elevation_ism[st_ivas->index_of_edited_ism][sf] = st_ivas->elevation_edited; } -#ifdef OMASA_UPDATES + st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->azimuth = st_ivas->azimuth_edited; st_ivas->hIsmMetaData[st_ivas->index_of_edited_ism]->elevation = st_ivas->elevation_edited; -#endif } } -#ifdef OMASA_UPDATES else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { /* Directions cannot be edited in this mode */ } -#endif else { for ( dir = 0; dir < MAX_NUM_OBJECTS; dir++ ) @@ -2508,15 +2452,10 @@ void ivas_masa_ism_set_edited_objects( } } -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->editing_ism_enabled ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ && st_ivas->editing_ism_enabled ) -#endif { if ( st_ivas->hMasaIsmData->idx_separated_ism == st_ivas->index_of_edited_ism ) { - int16_t sf; for ( sf = 0; sf < ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); sf++ ) { st_ivas->hMasaIsmData->azimuth_separated_ism[sf] = st_ivas->azimuth_edited; @@ -2528,6 +2467,4 @@ void ivas_masa_ism_set_edited_objects( return; } - - #endif diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index a0ba899f0d..a6f0abfddb 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -101,11 +101,7 @@ void ivas_mono_downmix_render_passive( { numInputChannels = st_ivas->nchan_transport; } -#ifdef OMASA_UPDATES else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { numInputChannels = st_ivas->nchan_transport + 1; } @@ -115,6 +111,7 @@ void ivas_mono_downmix_render_passive( } } #endif + hDownmix = st_ivas->hMonoDmxRenderer; set_zero( proto_signal, output_frame ); diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index a02a2bf051..777d6bfbe5 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -35,12 +35,8 @@ #include "ivas_cnst.h" #include "ivas_prot.h" #include "prot.h" -#ifdef OMASA_UPDATES #include "ivas_prot_rend.h" -#endif -#ifdef MASA_AND_OBJECTS #include "ivas_rom_com.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -81,13 +77,11 @@ ivas_error ivas_masa_ism_data_open( hMasaIsmData->objectsMoved = 0; hMasaIsmData->delayBuffer = NULL; -#ifdef OMASA_UPDATES for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) { hMasaIsmData->q_elevation_old[ch] = 0.0f; hMasaIsmData->q_azimuth_old[ch] = 0.0f; } -#endif st_ivas->hMasaIsmData = hMasaIsmData; @@ -218,11 +212,7 @@ ivas_error ivas_omasa_dec_config( /* ISM MD reconfig. */ n_MD = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#endif { n_MD = 1; @@ -257,16 +247,11 @@ ivas_error ivas_omasa_dec_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; /* objects renderer reconfig. */ -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) -#else - if ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) -#endif { ivas_masa_ism_data_close( &( st_ivas->hMasaIsmData ) ); } -#ifdef OMASA_UPDATES if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -330,7 +315,6 @@ ivas_error ivas_omasa_dec_config( } } } -#endif } return IVAS_ERR_OK; @@ -353,28 +337,13 @@ void ivas_set_surplus_brate_dec( *ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { *ism_total_brate = ivas_interformat_brate( st_ivas->ism_mode, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ); -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - *ism_total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp -#ifdef FIX_4OBJ_128 - , - 0 -#endif - ); -#endif st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - *ism_total_brate; -#ifdef OMASA_UPDATES /* set 'st->total_brate'; there are no meta-data in ISM_MASA_MODE_PARAM_ONE_OBJ mode */ -#else - /* set 'st->total_brate'; there are no meta-data in ISM_MASA_MODE_ONE_OBJ mode */ -#endif st_ivas->hSCE[0]->hCoreCoder[0]->total_brate = *ism_total_brate; st_ivas->hSCE[0]->hCoreCoder[0]->low_rate_mode = 0; @@ -385,7 +354,6 @@ void ivas_set_surplus_brate_dec( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifdef OMASA_UPDATES int16_t brate_limit_flag, ism_imp[MAX_NUM_OBJECTS]; for ( n = 0; n < st_ivas->nchan_ism; n++ ) @@ -395,8 +363,6 @@ void ivas_set_surplus_brate_dec( brate_limit_flag = calculate_brate_limit_flag( ism_imp, st_ivas->nchan_ism ); -#endif - ism_total_brate_ref = 0; for ( n = 0; n < st_ivas->nchan_ism; n++ ) { @@ -413,12 +379,7 @@ void ivas_set_surplus_brate_dec( { st_ivas->hSCE[n]->element_brate = element_brate[n]; - *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp -#ifdef OMASA_UPDATES - , - brate_limit_flag -#endif - ); + *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp, brate_limit_flag ); } st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 9b6ea5ec29..201355fc5b 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -159,19 +159,11 @@ ivas_error ivas_sce_dec( ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { st->bits_frame_nominal = (int16_t) ( ( hSCE->element_brate / FRAMES_PER_SEC ) - ISM_NB_BITS_METADATA_NOMINAL ); } -#ifdef OMASA_UPDATES else if ( ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) -#else - else if ( ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) || ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif #else if ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) #endif @@ -228,11 +220,7 @@ ivas_error ivas_sce_dec( /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) && -#else - if ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) && -#endif st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) #else if ( st_ivas->ivas_format == ISM_FORMAT && st->low_rate_mode && !( st->total_brate == SID_2k40 || st->total_brate == FRAME_NO_DATA ) ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a643fe15a0..e474e0fd1f 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1026,7 +1026,7 @@ typedef struct vbap_data_structure float *bottom_virtual_speaker_node_division_gains; float *top_virtual_speaker_node_division_gains; float *back_virtual_speaker_node_division_gains; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS float *object_mode_bottom_virtual_speaker_node_division_gains; float *object_mode_top_virtual_speaker_node_division_gains; float *object_mode_back_virtual_speaker_node_division_gains; @@ -1156,10 +1156,8 @@ typedef struct ivas_masa_ism_data_structure int16_t azimuth_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; int16_t elevation_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; -#ifdef OMASA_UPDATES float q_azimuth_old[MAX_NUM_OBJECTS]; float q_elevation_old[MAX_NUM_OBJECTS]; -#endif float ismPreprocMatrix[2][2][CLDFB_NO_CHANNELS_MAX]; uint8_t objectsMoved; diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index 37547deaad..ed2ce47942 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -141,7 +141,7 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node( VBAP_HAND static int16_t determine_best_triplet_and_gains( VBAP_SEARCH_STRUCT *search_struct, const float panning_unit_vec[3], const int16_t azi_deg, float gains[3] ); -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS static void determine_virtual_speaker_node_division_gains( const int16_t virtual_speaker_node_index, float *virtual_node_division_gains, int16_t connections[][2], const enum VirtualSpeakerNodeType type, const int16_t max_num_connections, const int16_t num_speaker_nodes, const int16_t use_object_mode ); #else static void determine_virtual_speaker_node_division_gains( const int16_t virtual_speaker_node_index, float *virtual_node_division_gains, int16_t connections[][2], const enum VirtualSpeakerNodeType type, const int16_t max_num_connections, const int16_t num_speaker_nodes ); @@ -161,7 +161,7 @@ ivas_error vbap_init_data( const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ const int16_t num_speaker_nodes /* i : number of speaker nodes in the set */ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS , const int16_t support_object_mode /* i : init VBAP also for object panning mode */ #endif @@ -213,7 +213,7 @@ ivas_error vbap_init_data( vbap->bottom_virtual_speaker_node_division_gains = NULL; vbap->top_virtual_speaker_node_division_gains = NULL; vbap->back_virtual_speaker_node_division_gains = NULL; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS vbap->object_mode_bottom_virtual_speaker_node_division_gains = NULL; vbap->object_mode_top_virtual_speaker_node_division_gains = NULL; vbap->object_mode_back_virtual_speaker_node_division_gains = NULL; @@ -240,7 +240,7 @@ ivas_error vbap_init_data( } set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( support_object_mode ) { vbap->object_mode_bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); @@ -260,7 +260,7 @@ ivas_error vbap_init_data( } set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( support_object_mode ) { vbap->object_mode_top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); @@ -280,7 +280,7 @@ ivas_error vbap_init_data( } set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( support_object_mode ) { vbap->object_mode_back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); @@ -377,7 +377,7 @@ ivas_error vbap_init_data( /* Determine how the virtual node gains should be distributed to real nodes, if necessary (checked within function). */ if ( is_success ) { -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS determine_virtual_speaker_node_division_gains( vbap->top_virtual_speaker_node_index, vbap->top_virtual_speaker_node_division_gains, connections, virtual_top_type, max_num_connections, num_speaker_nodes, 0 ); determine_virtual_speaker_node_division_gains( vbap->bottom_virtual_speaker_node_index, vbap->bottom_virtual_speaker_node_division_gains, connections, virtual_bottom_type, max_num_connections, num_speaker_nodes, 0 ); determine_virtual_speaker_node_division_gains( vbap->back_virtual_speaker_node_index, vbap->back_virtual_speaker_node_division_gains, connections, virtual_back_type, max_num_connections, num_speaker_nodes, 0 ); @@ -438,7 +438,7 @@ void vbap_free_data( { free( ( *hVBAPdata )->back_virtual_speaker_node_division_gains ); } -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( ( *hVBAPdata )->object_mode_bottom_virtual_speaker_node_division_gains != NULL ) { free( ( *hVBAPdata )->object_mode_bottom_virtual_speaker_node_division_gains ); @@ -479,7 +479,7 @@ void vbap_determine_gains( float *gains, /* o : gain vector for loudspeakers for given direction */ const int16_t azi_deg, /* i : azimuth in degrees for panning direction (positive left)*/ const int16_t ele_deg /* i : elevation in degrees for panning direction (positive up)*/ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS , const int16_t use_object_mode /* i : select between object mode panning and spatial mode panning */ #endif @@ -516,7 +516,7 @@ void vbap_determine_gains( bottom_virtual_speaker_node_index = hVBAPdata->bottom_virtual_speaker_node_index; top_virtual_speaker_node_index = hVBAPdata->top_virtual_speaker_node_index; back_virtual_speaker_node_index = hVBAPdata->back_virtual_speaker_node_index; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( use_object_mode ) { bottom_virtual_speaker_node_division_gains = hVBAPdata->object_mode_bottom_virtual_speaker_node_division_gains; @@ -782,7 +782,7 @@ static void determine_virtual_speaker_node_division_gains( const enum VirtualSpeakerNodeType type, /* i : virtual speaker node typel */ const int16_t max_num_connections, /* i : max number of connections */ const int16_t num_speaker_nodes /* i : max number of speaker nodes */ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS , const int16_t use_object_mode /* i : use VBAP in object panning mode vs. spatial panning mode */ #endif @@ -828,7 +828,7 @@ static void determine_virtual_speaker_node_division_gains( for ( ch = 0; ch < num_speaker_nodes; ch++ ) { virtual_node_division_gains[ch] /= sum_val; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( use_object_mode ) { virtual_node_division_gains[ch] = powf( virtual_node_division_gains[ch], 0.8f ); -- GitLab From 687ce1a008e155efd5e6bee33736b10b603c79f1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 18:46:03 +0200 Subject: [PATCH 101/591] merge OMASA_UPDATES into MASA_AND_OBJECTS; encoder side --- lib_com/bitstream.c | 24 --- lib_com/ivas_cnst.h | 10 +- lib_com/ivas_masa_com.c | 12 -- lib_com/ivas_omasa_com.c | 65 ++------ lib_com/ivas_prot.h | 10 +- lib_com/ivas_stat_com.h | 2 - lib_com/options.h | 1 - lib_dec/ivas_dirac_dec.c | 3 +- lib_dec/lib_dec.c | 4 - lib_enc/ivas_cpe_enc.c | 16 +- lib_enc/ivas_decision_matrix_enc.c | 2 +- lib_enc/ivas_enc.c | 14 +- lib_enc/ivas_ism_enc.c | 44 +---- lib_enc/ivas_ism_metadata_enc.c | 64 +------ lib_enc/ivas_masa_enc.c | 76 +-------- lib_enc/ivas_omasa_enc.c | 165 +------------------ lib_enc/ivas_sce_enc.c | 27 --- lib_enc/ivas_stereo_classifier.c | 3 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 42 +---- lib_rend/ivas_objectRenderer.c | 4 +- 20 files changed, 42 insertions(+), 546 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 9b54224860..d7c063bf1a 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1972,37 +1972,13 @@ ivas_error preview_indices( else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { /* read number of objects from the bitstream */ -#ifdef OMASA_UPDATES st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */ st_ivas->nchan_ism = 0; -#else - st_ivas->nchan_transport = 0; -#endif if ( total_brate != SID_2k40 && total_brate != FRAME_NO_DATA ) { -#ifdef OMASA_UPDATES st_ivas->nchan_ism = 2 * bit_stream[total_brate / FRAMES_PER_SEC - 1] + bit_stream[total_brate / FRAMES_PER_SEC - 2] + 1; -#endif st_ivas->ism_mode = ivas_omasa_ism_mode_select( total_brate, st_ivas->nchan_ism ); - -#ifndef OMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - st_ivas->nchan_transport = 0; - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - st_ivas->nchan_transport = 2 * st_ivas->bit_stream[total_brate / FRAMES_PER_SEC - 2] + st_ivas->bit_stream[total_brate / FRAMES_PER_SEC - 3] + 1; - } - - k = (int16_t) ( ( total_brate / FRAMES_PER_SEC ) - 1 ); - - { - st_ivas->nchan_transport++; - k--; - } -#endif } } #endif diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 07d6c66f75..2ebd9e359e 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -374,12 +374,8 @@ typedef enum #ifdef MASA_AND_OBJECTS , ISM_MASA_MODE_PARAM, /* parametric ISM mode for combined MASA ISM format */ -#ifdef OMASA_UPDATES ISM_MASA_MODE_MASA_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using MASA parameters */ ISM_MASA_MODE_PARAM_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using parametric object model */ -#else - ISM_MASA_MODE_ONE_OBJ, /* MASA ISM mode when one object is encoded separarately */ -#endif ISM_MASA_MODE_DISC /* MASA ISM mode when all objects are encoded separarately */ #endif } ISM_MODE; @@ -639,11 +635,7 @@ enum IND_STEREO_DFT_SIDEGAIN_FLAG, IND_STEREO_DFT_SIDEGAINS, - #ifdef OMASA_UPDATES - IND_STEREO_DFT_ITD_MODE = IND_STEREO_DFT_SIDEGAINS + 4 * STEREO_DFT_BAND_MAX + 120, - #else - IND_STEREO_DFT_ITD_MODE = IND_STEREO_DFT_SIDEGAINS + 4 * STEREO_DFT_BAND_MAX + 72, - #endif + IND_STEREO_DFT_ITD_MODE = IND_STEREO_DFT_SIDEGAINS + 4 * STEREO_DFT_BAND_MAX + 120, IND_STEREO_DFT_ITD_HUFF, IND_STEREO_DFT_ITD_NEG, diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index c4ab8be9af..dd088fca52 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -96,11 +96,7 @@ void ivas_masa_set_elements( if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) { *element_mode = IVAS_CPE_MDCT; -#ifdef OMASA_UPDATES if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) -#else - if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) -#endif { *element_mode = IVAS_CPE_DFT; } @@ -119,11 +115,7 @@ void ivas_masa_set_elements( } hQMetaData->bits_frame_nominal = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) -#endif { hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); } @@ -634,11 +626,7 @@ int32_t calculate_cpe_brate_MASA_ISM( k++; } -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { cpe_brate = ivas_total_brate - sep_object_brate[k - 2][0]; /* take data from the first column */ } diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 4bf5c3ed83..5501fa79aa 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -58,15 +58,9 @@ #define GAMMA_ISM_MEDIUM_IMP3 1.15f #define GAMMA_ISM_HIGH_IMP3 1.3f -#ifdef OMASA_UPDATES #define GAMMA_ISM_LOW_IMP4 0.8f #define GAMMA_ISM_MEDIUM_IMP4 1.0f #define GAMMA_ISM_HIGH_IMP4 1.2f -#else -#define GAMMA_ISM_LOW_IMP4 0.6f -#define GAMMA_ISM_MEDIUM_IMP4 0.8f -#define GAMMA_ISM_HIGH_IMP4 1.0f -#endif /*--------------------------------------------------------------- @@ -103,11 +97,7 @@ ISM_MODE ivas_omasa_ism_mode_select( } else if ( ivas_total_brate >= IVAS_32k ) { -#ifdef OMASA_UPDATES ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; -#else - ism_mode = ISM_MASA_MODE_ONE_OBJ; -#endif } else { @@ -121,23 +111,12 @@ ISM_MODE ivas_omasa_ism_mode_select( } else if ( ivas_total_brate >= IVAS_64k ) { -#ifdef OMASA_UPDATES ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; -#else - ism_mode = ISM_MASA_MODE_ONE_OBJ; -#endif } -#ifdef OMASA_UPDATES else if ( ivas_total_brate >= IVAS_32k ) { ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ; } -#else - else if ( ivas_total_brate >= IVAS_48k ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } -#endif else { ism_mode = ISM_MODE_NONE; @@ -148,7 +127,6 @@ ISM_MODE ivas_omasa_ism_mode_select( { ism_mode = ISM_MASA_MODE_DISC; } -#ifdef OMASA_UPDATES else if ( ivas_total_brate >= IVAS_64k ) { ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; @@ -157,16 +135,6 @@ ISM_MODE ivas_omasa_ism_mode_select( { ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ; } -#else - else if ( ivas_total_brate >= IVAS_64k ) - { - ism_mode = ISM_MASA_MODE_ONE_OBJ; - } - else if ( ivas_total_brate >= IVAS_48k ) - { - ism_mode = ISM_MASA_MODE_PARAM; - } -#endif else { ism_mode = ISM_MODE_NONE; @@ -197,12 +165,8 @@ void ivas_set_omasa_TC( *nCPE = 1; *nSCE = 0; break; -#ifdef OMASA_UPDATES case ISM_MASA_MODE_MASA_ONE_OBJ: case ISM_MASA_MODE_PARAM_ONE_OBJ: -#else - case ISM_MASA_MODE_ONE_OBJ: -#endif *nCPE = 1; *nSCE = 1; break; @@ -230,14 +194,11 @@ void ivas_set_omasa_TC( /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( - const ISM_MODE ism_mode, /* i : ISM mode */ - const int16_t nchan_ism, /* i : number of ISM channels */ - const int32_t element_brate, /* i : element bitrate */ - const int16_t ism_imp /* i : ISM importance flag */ -#ifdef OMASA_UPDATES - , - const int16_t limit_flag /* i : flag to limit the bitrate increase */ -#endif + const ISM_MODE ism_mode, /* i : ISM mode */ + const int16_t nchan_ism, /* i : number of ISM channels */ + const int32_t element_brate, /* i : element bitrate */ + const int16_t ism_imp, /* i : ISM importance flag */ + const int16_t limit_flag /* i : flag to limit the bitrate increase */ ) { int32_t element_brate_out; @@ -254,12 +215,11 @@ int32_t ivas_interformat_brate( if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate <= 24000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) /* for border case in DISC mode */ { -#ifdef OMASA_UPDATES - if ( ( limit_flag == 1 ) && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) + if ( limit_flag == 1 && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) { return element_brate; } -#endif + if ( ism_imp == ISM_LOW_IMP ) { nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP4 ); @@ -281,14 +241,9 @@ int32_t ivas_interformat_brate( } } } - else -#ifdef OMASA_UPDATES - if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || -#else - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ || -#endif - ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 24400 and 1 object */ - ) + else if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || + ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 24400 and 1 object */ + ) { if ( ism_imp == ISM_LOW_IMP ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 21488cafbf..a6392e2a09 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4844,7 +4844,7 @@ ivas_error vbap_init_data( const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ const int16_t num_speaker_nodes /* i : number of speaker nodes in the set */ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS , const int16_t support_object_mode /* i : init VBAP also for object panning mode */ #endif @@ -4859,7 +4859,7 @@ void vbap_determine_gains( float *gains, /* o : gain vector for speaker nodes for given direction */ const int16_t azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const int16_t ele_deg /* i : elevation in degrees for panning direction (positive up) */ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS , const int16_t use_object_mode /* i : select between object mode panning and spatial mode panning */ #endif @@ -5185,10 +5185,8 @@ int32_t ivas_interformat_brate( const ISM_MODE ism_mode, /* i : ISM mode */ const int16_t nchan_ism, /* i : number of ISM channels */ const int32_t element_brate, /* i : element bitrate */ - const int16_t ism_imp /* i : ISM importance flag */ -#ifdef OMASA_UPDATES - , const int16_t limit_flag /* i : flag to limit the bitrate increase */ -#endif + const int16_t ism_imp, /* i : ISM importance flag */ + const int16_t limit_flag /* i : flag to limit the bitrate increase */ ); void ivas_combined_format_brate_sanity( diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 80e3712dad..5f09e0d45a 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -74,11 +74,9 @@ typedef struct #ifdef MASA_AND_OBJECTS int16_t ism_imp; /* ISM importance flag */ int16_t ism_vad_flag; -#ifdef OMASA_UPDATES float q_azimuth_old; float q_elevation_old; #endif -#endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index d86a5355fa..64aab79878 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,7 +168,6 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#define OMASA_UPDATES /* Nokia: Updates to the OMASA processing */ #endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 69e9dcfef4..2fb2af0de4 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -609,7 +609,8 @@ ivas_error ivas_dirac_dec_config( { vbap_free_data( &( st_ivas->hVBAPdata ) ); } -#ifdef OMASA_UPDATES + +#ifdef MASA_AND_OBJECTS if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE, st_ivas->ivas_format == MASA_ISM_FORMAT ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 4371a8dc20..8c90a3a82d 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2012,11 +2012,7 @@ static ivas_error printConfigInfo_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { -#ifdef OMASA_UPDATES fprintf( stdout, "Input configuration: combined ISM and MASA (%i ISM stream(s)) \n", st_ivas->nchan_ism ); -#else - fprintf( stdout, "Input configuration: combined ISM and MASA (%i separated ISM stream(s)) \n", st_ivas->nchan_transport ); -#endif } #endif } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index bce8d37984..db0da4666d 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -169,7 +169,7 @@ ivas_error ivas_cpe_enc( if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL ) { -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) { hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); @@ -178,7 +178,7 @@ ivas_error ivas_cpe_enc( { #endif hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS } #endif } @@ -329,11 +329,7 @@ ivas_error ivas_cpe_enc( #ifdef MASA_AND_OBJECTS /* compute bit-rate surplus per channel in combined format coding */ int32_t brate_surplus[CPE_CHANNELS]; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { brate_surplus[0] = ( ( hCPE->brate_surplus / FRAMES_PER_SEC ) >> 1 ) * FRAMES_PER_SEC; brate_surplus[1] = hCPE->brate_surplus - brate_surplus[0]; @@ -362,11 +358,7 @@ ivas_error ivas_cpe_enc( #ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { sts[n]->bits_frame_channel += (int16_t) ( brate_surplus[n] / FRAMES_PER_SEC ); sts[n]->total_brate += brate_surplus[n]; @@ -723,11 +715,7 @@ ivas_error ivas_cpe_enc( #ifdef MASA_AND_OBJECTS /* subtract bit-rate for combined format coding */ -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif { sts[0]->total_brate += hCPE->brate_surplus; } diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index e26d1e7a72..1ef2fc00b0 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -404,7 +404,7 @@ void ivas_signaling_enc( /*-------------------------------------------------------------------------- * Write element mode info *--------------------------------------------------------------------------*/ -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ #else if ( st->element_mode >= IVAS_CPE_DFT && element_brate < MIN_BRATE_MDCT_STEREO && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 1708e4d701..87b6505716 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -323,18 +323,13 @@ ivas_error ivas_enc( /* Encode ISMs transport channels */ n = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { if ( ( error = ivas_sce_enc( st_ivas, 0, data_separated_object, input_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) /* there are no metadata bits in SCE in this mode */ { return error; } } -#ifdef OMASA_UPDATES else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) @@ -342,7 +337,6 @@ ivas_error ivas_enc( return error; } } -#endif else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Analysis, decision about bitrates per channel & core coding */ @@ -355,12 +349,7 @@ ivas_error ivas_enc( /* Encode MASA parameters and write MASA metadata bitstream */ ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa -#ifdef MASA_AND_OBJECTS - , - st_ivas->hIsmMetaData[0]->ism_imp -#endif - ); + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp ); /* Configuration of combined-format bit-budget distribution */ #ifdef DEBUG_MODE_INFO @@ -369,7 +358,6 @@ ivas_error ivas_enc( ivas_set_surplus_brate_enc( st_ivas ); #endif - /* Encode MASA transport channels */ if ( ( ivas_cpe_enc( st_ivas, 0, data_f[n], data_f[n + 1], input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8cf039868c..b560d04f4d 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -87,10 +87,11 @@ ivas_error ivas_ism_enc( int16_t localVAD_HE_SAD[1]; /* local HE VAD */ int16_t nchan_ism, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; - ivas_error error; #ifdef MASA_AND_OBJECTS + int32_t ism_total_brate_ref, ism_total_brate; int16_t i, nchan_transport_ism; #endif + ivas_error error; push_wmops( "ivas_ism_enc" ); @@ -109,15 +110,12 @@ ivas_error ivas_ism_enc( #ifdef MASA_AND_OBJECTS nchan_transport_ism = st_ivas->nchan_transport; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { nchan_transport_ism = 1; nchan_ism = 1; } - else -#endif - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { nchan_transport_ism = st_ivas->hEncoderConfig->nchan_ism; } @@ -245,36 +243,17 @@ ivas_error ivas_ism_enc( } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - // VE: call ivas_ism_metadata_enc() with 'st_ivas' - TBD - ivas_ism_metadata_enc( -#ifdef MASA_AND_OBJECTS - &st_ivas->hEncoderConfig->ivas_total_brate, -#else - st_ivas->hEncoderConfig->ivas_total_brate, -#endif - nchan_ism, #ifdef MASA_AND_OBJECTS - nchan_transport_ism, + ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, + nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1 ); #else - st_ivas->nchan_transport, + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif - st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag -#ifdef MASA_AND_OBJECTS - , - -1 -#endif - ); } else /* ISM_MODE_DISC */ { #ifdef MASA_AND_OBJECTS - int32_t ism_total_brate_ref; - int32_t ism_total_brate; -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { ism_total_brate = 0; for ( i = 0; i < st_ivas->nSCE; i++ ) @@ -289,20 +268,15 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; - // VE: change the interface of the following function and call it with 'st_ivas' only - ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, - nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, - st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ); + ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, + nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ); if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - ism_total_brate; } - #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, - nchan_ism, - st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index e0451811ac..24924a25bb 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -214,11 +214,7 @@ ivas_error ivas_ism_metadata_enc( set_s( flag_abs_radius, 0, nchan_ism ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { /*----------------------------------------------------------------* * Rate importance of particular ISM streams in combined format coding @@ -261,11 +257,7 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode != ISM_MASA_MODE_DISC ) -#endif { #endif /* write number of objects - unary coding */ @@ -296,11 +288,7 @@ ivas_error ivas_ism_metadata_enc( #endif { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { /* ISM importance flag will be written in ivas_masa_encode() */ hIsmMeta[ch]->ism_imp = ism_imp[ch]; @@ -318,11 +306,7 @@ ivas_error ivas_ism_metadata_enc( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -331,11 +315,7 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_transport; ch++ ) { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { /* reset */ hIsmMeta[ch]->ism_vad_flag = 1; @@ -346,11 +326,7 @@ ivas_error ivas_ism_metadata_enc( { /* this flag distinguishes between coding of inactive frame and active frame w/o. metadata */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { /* VAD flag will be written in ivas_masa_encode() */ hIsmMeta[ch]->ism_vad_flag = localVAD[ch]; @@ -382,11 +358,7 @@ ivas_error ivas_ism_metadata_enc( { hIsmMetaData = hIsmMeta[ch]; #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -401,11 +373,7 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -434,11 +402,7 @@ ivas_error ivas_ism_metadata_enc( /* save number of metadata bits written */ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) -#endif #else if ( ism_mode == ISM_MODE_DISC ) #endif @@ -574,18 +538,13 @@ ivas_error ivas_ism_metadata_enc( * Take into account the combined format bit-budget distribution *----------------------------------------------------------------*/ -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; -#ifdef OMASA_UPDATES int16_t brate_limit_flag; + brate_limit_flag = calculate_brate_limit_flag( ism_imp, nchan_ism ); -#endif bits_ism = (int16_t) ( *ism_total_brate / FRAMES_PER_SECOND ); set_s( bits_element, bits_ism / nchan_ism, nchan_ism ); @@ -595,11 +554,7 @@ ivas_error ivas_ism_metadata_enc( *ism_total_brate = 0; for ( ch = 0; ch < nchan_ism; ch++ ) { -#ifdef OMASA_UPDATES *ism_total_brate += ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ); -#else - *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch] ); -#endif } ism_metadata_flag_global = 1; } @@ -610,7 +565,6 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { if ( ( error = ivas_ism_config( *ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, 1 ) ) != IVAS_ERR_OK ) @@ -625,12 +579,6 @@ ivas_error ivas_ism_metadata_enc( return error; } } -#else - if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata, ism_mode == ISM_MASA_MODE_DISC ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif #else if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) { @@ -656,11 +604,7 @@ ivas_error ivas_ism_metadata_enc( hSCE[ch]->element_brate = element_brate[ch]; } -#ifdef OMASA_UPDATES else if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - else if ( ism_mode == ISM_MASA_MODE_DISC ) -#endif { if ( ism_imp[ch] == ISM_INACTIVE_IMP ) { @@ -788,10 +732,8 @@ ivas_error ivas_ism_metadata_enc_create( #ifdef MASA_AND_OBJECTS st_ivas->hIsmMetaData[ch]->ism_imp = -1; st_ivas->hIsmMetaData[ch]->ism_vad_flag = 1; -#ifdef OMASA_UPDATES st_ivas->hIsmMetaData[ch]->q_azimuth_old = 0.0f; st_ivas->hIsmMetaData[ch]->q_elevation_old = 0.0f; -#endif #endif ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); @@ -803,11 +745,7 @@ ivas_error ivas_ism_metadata_enc_create( #ifdef MASA_AND_OBJECTS if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, 1, NULL, NULL, NULL, element_brate_tmp, NULL, NULL, 1 ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index b588302bf9..c1f509d9bb 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -64,12 +64,7 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR #ifdef MASA_AND_OBJECTS static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks, const int16_t idx_separated_object, const int16_t ism_imp ); -static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format -#ifndef OMASA_UPDATES - , - const ISM_MODE ism_mode -#endif -); +static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #else static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); @@ -150,11 +145,7 @@ ivas_error ivas_masa_enc_open( } #ifdef MASA_AND_OBJECTS ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -320,11 +311,7 @@ ivas_error ivas_masa_encode( #endif { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) || ( ivas_format != MASA_ISM_FORMAT ) ) -#else - if ( ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) || ( ivas_format != MASA_ISM_FORMAT ) ) -#endif { /* Combine directions */ ivas_masa_combine_directions( hMasa ); @@ -364,27 +351,18 @@ ivas_error ivas_masa_encode( hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; /* write index of separated object if needed */ -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && hMasa->data.nchan_ism > 1 ) -#else - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ && hMasa->data.nchan_ism > 1 ) -#endif { push_next_indice( hMetaData, idx_separated_object, NO_BITS_MASA_ISM_NO_OBJ ); hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; } /* write ISM importance flag (one per object) */ -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif { push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; } -#ifdef OMASA_UPDATES else if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); @@ -397,7 +375,6 @@ ivas_error ivas_masa_encode( hQMetaData->metadata_max_bits -= ISM_METADATA_VAD_FLAG_BITS; } } -#endif else if ( ism_mode == ISM_MASA_MODE_DISC ) { for ( i = 0; i < nchan_ism; i++ ) @@ -455,12 +432,8 @@ ivas_error ivas_masa_encode( if ( hMasa->config.max_metadata_bits < MINIMUM_BIT_BUDGET_NORMAL_META && !hMasa->config.joinedSubframes ) { #ifdef MASA_AND_OBJECTS - reduce_metadata_further( hMasa, hQMetaData, ivas_format -#ifndef OMASA_UPDATES - , - ism_mode -#endif - ); + reduce_metadata_further( hMasa, hQMetaData, ivas_format ); + low_bitrate_mode = ( ivas_total_brate <= 32000 ); #else reduce_metadata_further( hMasa, hQMetaData, ivas_format ); @@ -472,11 +445,7 @@ ivas_error ivas_masa_encode( #ifdef MASA_AND_OBJECTS /* Encode MASA+ISM metadata */ -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) -#else - if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { /* encode MASA/ISM energy ratios */ ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes, @@ -491,11 +460,7 @@ ivas_error ivas_masa_encode( ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) -#else - if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { /* Modify spatial metadata based on the MASA-to-total energy ratios */ modify_masa_energy_ratios( hQMetaData ); @@ -674,11 +639,7 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { for ( i = 0; i < st_ivas->nSCE; i++ ) { @@ -731,18 +692,14 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { -#ifdef OMASA_UPDATES if ( st_ivas->hCPE[0]->element_brate == IVAS_48k && st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) { ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, IVAS_32k, st_ivas->nchan_transport, MC_MODE_NONE ); } else { -#endif ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); -#ifdef OMASA_UPDATES } -#endif } else { @@ -843,11 +800,7 @@ ivas_error ivas_masa_enc_config( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif { if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT ) { @@ -1528,14 +1481,7 @@ static void compensate_energy_ratios( static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, - const IVAS_FORMAT ivas_format -#ifdef MASA_AND_OBJECTS -#ifndef OMASA_UPDATES - , - const ISM_MODE ism_mode -#endif -#endif -) + const IVAS_FORMAT ivas_format ) { int16_t sf; int16_t band; @@ -1559,11 +1505,7 @@ static void reduce_metadata_further( /* Get energy for the input data in 4-subframe, 5-band format */ totalEnergySum = 0.0f; #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) /* Energy data is in 4-subframe, 24-band format */ -#else - if ( ivas_format == MASA_FORMAT || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE ) ) /* Energy data is in 4-subframe, 24-band format */ -#endif #else if ( ivas_format == MASA_FORMAT ) /* Energy data is in 4-subframe, 24-band format */ #endif @@ -1953,11 +1895,7 @@ void ivas_masa_enc_reconfigure( #ifdef MASA_AND_OBJECTS ism_total_brate = 0; -#ifdef OMASA_UPDATES if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) -#endif { for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { @@ -3633,7 +3571,6 @@ static void ivas_encode_masaism_metadata( /* quantize directions */ for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) { -#ifdef OMASA_UPDATES if ( bits_ism[obj] < 8 ) { /* check is same as previous */ @@ -3658,11 +3595,6 @@ static void ivas_encode_masaism_metadata( hIsmMeta[obj]->q_elevation_old = hIsmMeta[obj]->elevation; hIsmMeta[obj]->q_azimuth_old = hIsmMeta[obj]->azimuth; } - -#else - idx_sph = quantize_direction( hIsmMeta[obj]->elevation, hIsmMeta[obj]->azimuth, bits_ism[obj], &theta_q, &phi_q, &index_theta, &index_phi, MC_LS_SETUP_INVALID ); - push_next_indice( hMetaData, idx_sph, bits_ism[obj] ); -#endif } return; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index a9f182705a..d9acdc7d2f 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -277,11 +277,7 @@ ivas_error ivas_omasa_enc_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; -#ifdef OMASA_UPDATES if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) -#else - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) -#endif { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } @@ -323,11 +319,7 @@ void ivas_omasa_set_config( uint8_t i, maxBin; /* Determine the number of bands */ -#ifdef OMASA_UPDATES if ( ism_mode == ISM_MODE_NONE || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( ism_mode == ISM_MODE_NONE ) -#endif { /* use full resolution for the ISM+MASA merge and reduce later */ hOMasa->nbands = 24; @@ -399,140 +391,8 @@ void ivas_omasa_enc( int16_t i, j; float data_out_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; - -#ifdef OMASA_UPDATES /* Determine separated object (when applicable) */ if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - /* Analysis */ - if ( ism_mode == ISM_MODE_NONE ) - { -#ifdef OMASA_DIFFUSE_ISM_MERGE - OMASA_SPATIAL_META OMasaMeta; /* working memory for the ISM-object MASA-parameters */ - OMASA_SPATIAL_META_HANDLE hOMasaMeta; - uint8_t n_bands_orig, n_subframes_orig; - uint8_t numCodingBands_orig, joinedSubframes_orig; -#else - float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float energyRatio[MASA_FREQUENCY_BANDS]; - float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float surroundingCoherence[MASA_FREQUENCY_BANDS]; - int16_t nBands, nBlocks; - uint8_t fixedDistance = 0; - - nBands = hOMasa->nbands; - nBlocks = hOMasa->nSubframes; -#endif - -#ifdef OMASA_DIFFUSE_ISM_MERGE - hOMasaMeta = &OMasaMeta; - hOMasaMeta->num_dirs = 1; /* TODO: hard-coding for now */ - - /* merge MASA directions before adding ISM to the mixture */ - if ( hMasa->config.numberOfDirections == 2 ) - { - n_bands_orig = hMasa->config.numCodingBands; - hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; - - ivas_masa_combine_directions( hMasa ); - - hMasa->config.numCodingBands = (int8_t) n_bands_orig; - } - - /* force computation into high resolution */ - n_bands_orig = hOMasa->nbands; - n_subframes_orig = hOMasa->nSubframes; - - hOMasa->nbands = MASA_FREQUENCY_BANDS; - hOMasa->nSubframes = MAX_PARAM_SPATIAL_SUBFRAMES; - - /* Estimate MASA parameters from the objects */ - /* NB: only first direction is populated */ - /* NB2: in energy_ratios and surround_coherence only first sub-frame contains valid data */ - ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, hOMasaMeta->directional_meta[0].elevation, hOMasaMeta->directional_meta[0].azimuth, hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].spread_coherence, hOMasaMeta->common_meta.surround_coherence[0], - hOMasaMeta->common_meta.diffuse_to_total_ratio[0], input_frame, nchan_ism ); - - /* copy energy_ratios and surrCoh from first sub-frame to the remaining ones */ - for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - mvr2r( hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].energy_ratio[i], MASA_FREQUENCY_BANDS ); - mvr2r( hOMasaMeta->common_meta.surround_coherence[0], hOMasaMeta->common_meta.surround_coherence[i], MASA_FREQUENCY_BANDS ); - mvr2r( hOMasaMeta->common_meta.diffuse_to_total_ratio[0], hOMasaMeta->common_meta.diffuse_to_total_ratio[i], MASA_FREQUENCY_BANDS ); - } -#else - /* Estimate MASA parameters from the objects */ - ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_ism ); -#endif - -#ifdef OMASA_DIFFUSE_ISM_MERGE - /* restore resolution parameters */ - hOMasa->nbands = n_bands_orig; - hOMasa->nSubframes = n_subframes_orig; - - /* perform MASA+ISM merge in full resolution */ - numCodingBands_orig = hMasa->config.numCodingBands; - joinedSubframes_orig = hMasa->config.joinedSubframes; - - hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; - hMasa->config.joinedSubframes = 0; - - ivas_merge_masa_metadata( hMasa, hOMasaMeta ); /* => merge result in hMasa->masaMetadata */ - - hMasa->config.numCodingBands = numCodingBands_orig; - hMasa->config.joinedSubframes = joinedSubframes_orig; -#else - - /* Set analyzed values to the QMeta struct */ - for ( i = 0; i < nBands; i++ ) - { - for ( j = 0; j < nBlocks; j++ ) - { - hQMeta->q_direction[0].band_data[i].azimuth[j] = azimuth_m_values[j][i]; - hQMeta->q_direction[0].band_data[i].elevation[j] = elevation_m_values[j][i]; - hQMeta->q_direction[0].band_data[i].energy_ratio[j] = energyRatio[i]; /* Only one value is transmitted for all subframes */ - hQMeta->q_direction[0].band_data[i].distance[j] = fixedDistance; - - if ( hQMeta->surcoh_band_data != NULL ) - { - hQMeta->q_direction[0].coherence_band_data[i].spread_coherence[j] = (uint8_t) roundf( spreadCoherence[j][i] * UINT8_MAX ); - hQMeta->surcoh_band_data[i].surround_coherence[j] = (uint8_t) roundf( surroundingCoherence[i] * UINT8_MAX ); - } - } - } - - /* At lower sampling rates, set zeros for higher bands that were not analyzed */ - if ( nBands < hOMasa->nCodingBands ) - { - for ( i = nBands; i < hOMasa->nCodingBands; i++ ) - { - for ( j = 0; j < nBlocks; j++ ) - { - hQMeta->q_direction[0].band_data[i].azimuth[j] = 0.0f; - hQMeta->q_direction[0].band_data[i].elevation[j] = 0.0f; - hQMeta->q_direction[0].band_data[i].energy_ratio[j] = 0.0f; - hQMeta->q_direction[0].band_data[i].distance[j] = 0; - - if ( hQMeta->surcoh_band_data != NULL ) - { - hQMeta->q_direction[0].coherence_band_data[i].spread_coherence[j] = 0; - hQMeta->surcoh_band_data[i].surround_coherence[j] = 0; - } - } - } - } -#endif - } - else if ( ism_mode == ISM_MASA_MODE_PARAM ) - { -#ifdef REDUCE_OMASA_META_BITS - *idx_separated_object = -1; -#endif - /* Estimate energies and ratios */ - ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); - } - else -#endif { float broadband_energy[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; int16_t loudest_object; @@ -647,7 +507,6 @@ void ivas_omasa_enc( { set_zero( data_in_f[selected_object], input_frame ); } -#ifdef OMASA_UPDATES } /* Analysis */ @@ -715,20 +574,17 @@ void ivas_omasa_enc( { *idx_separated_object = -1; } -#endif /* Estimate energies and ratios */ ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); } -#ifdef OMASA_UPDATES /* Move the ISM metadata to the first entry for encoding in the MASA_ONE_OBJ mode */ if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { hIsmMeta[0]->azimuth = hIsmMeta[*idx_separated_object]->azimuth; hIsmMeta[0]->elevation = hIsmMeta[*idx_separated_object]->elevation; } -#endif /* Downmix */ ivas_omasa_dmx( data_in_f, data_out_f, input_frame, nchan_transport, nchan_ism, hIsmMeta, hOMasa->prev_object_dm_gains, hOMasa->interpolator ); @@ -820,27 +676,12 @@ void ivas_set_surplus_brate_enc( #endif ) { -#ifdef OMASA_UPDATES if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_PARAM_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ); -#else - if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - st_ivas->hCPE[0]->brate_surplus = st_ivas->hSCE[0]->element_brate - ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, st_ivas->hSCE[0]->element_brate, st_ivas->hIsmMetaData[0]->ism_imp -#ifdef FIX_4OBJ_128 - , - 0 -#endif - ); -#endif /* note: ISM st->total_brate is iset in ivas_sce_enc() */ } -#ifdef OMASA_UPDATES else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { /* it is already set in ivas_ism_enc() */ } @@ -854,12 +695,8 @@ void ivas_set_surplus_brate_enc( { int16_t input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC ); float tmpF = 0; -#ifdef OMAOMASA_UPDATES - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - if ( 1 ) // st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) -#endif + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { tmpF += st_ivas->hSCE[0]->hCoreCoder[0]->total_brate + (float) ( nb_bits_metadata[1] * 50 ); } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 1a42cf635f..e236ecf5ba 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -144,11 +144,7 @@ ivas_error ivas_sce_enc( if ( st_ivas->hQMetaData != NULL && st_ivas->hSpar == NULL ) { #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( ( ( st_ivas->mc_mode == MC_MODE_MCMASA ) && ( st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) ) || ( st_ivas->ism_mode >= ISM_MASA_MODE_MASA_ONE_OBJ ) ) -#else - if ( ( ( st_ivas->mc_mode == MC_MODE_MCMASA ) && ( st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) ) || ( st_ivas->ism_mode >= ISM_MASA_MODE_ONE_OBJ ) ) -#endif #else if ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->hEncoderConfig->ivas_total_brate >= MCMASA_SEPARATE_BRATE ) #endif @@ -220,27 +216,12 @@ ivas_error ivas_sce_enc( * Combined format coding: get the ISM importance and the bit-rate *----------------------------------------------------------------*/ -#ifdef OMASA_UPDATES if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_PARAM_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ) - nb_bits_metadata * FRAMES_PER_SEC; } -#else - if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) - { - set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); - - st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp -#ifdef FIX_4OBJ_128 - , - 0 -#endif - ) - - nb_bits_metadata * FRAMES_PER_SEC; - } -#endif #endif /*----------------------------------------------------------------* @@ -262,11 +243,7 @@ ivas_error ivas_sce_enc( st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st->low_rate_mode ) -#else - else if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ && st->low_rate_mode ) -#endif { st->flag_ACELP16k = 0; } @@ -376,11 +353,7 @@ ivas_error create_sce_enc( copy_encoder_config( st_ivas, st, 1 ); #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif { st->element_mode = IVAS_SCE; } diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 534dc2189c..59b7c0a399 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -118,7 +118,8 @@ int16_t select_stereo_mode( { stereo_switching_flag = 0; } -#ifdef OMASA_UPDATES + +#ifdef MASA_AND_OBJECTS if ( hCPE->element_brate >= MIN_BRATE_MDCT_STEREO && !( hCPE->element_brate == IVAS_48k && ivas_total_brate == IVAS_32k ) ) /* the second condition for PARAM mode OMASA */ #else if ( hCPE->element_brate >= MIN_BRATE_MDCT_STEREO ) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 0135239e2e..e6f645197a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -448,7 +448,6 @@ static void ivas_dirac_dec_binaural_internal( /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) { numInChannels++; @@ -457,19 +456,6 @@ static void ivas_dirac_dec_binaural_internal( { numInChannels += (uint8_t) st_ivas->nchan_ism; } -#else - if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) - { - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - numInChannels += (uint8_t) st_ivas->nchan_ism; - } - else - { - numInChannels++; - } - } -#endif #else if ( st_ivas->hOutSetup.separateChannelEnabled ) { @@ -594,18 +580,9 @@ static void ivas_dirac_dec_binaural_internal( } #ifdef MASA_AND_OBJECTS -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) -#else - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) -#endif { - preProcessStereoTransportsForMovedObjects( st_ivas, - Cldfb_RealBuffer_in, - Cldfb_ImagBuffer_in, - nBins, - firstSubframe, - nSubframes ); + preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, firstSubframe, nSubframes ); } #endif @@ -1199,28 +1176,16 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( separateCenterChannelRendering = 0; nchanSeparateChannels = 0; -#ifdef OMASA_UPDATES if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) -#else - if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) -#endif { separateCenterChannelRendering = 1; nchanSeparateChannels = 1; -#ifndef OMASA_UPDATES - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; - } -#endif } -#ifdef OMASA_UPDATES else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { separateCenterChannelRendering = 1; nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; } -#endif #else separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; #endif @@ -1367,7 +1332,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( #ifdef MASA_AND_OBJECTS uint8_t instantChange = 0; -#ifdef OMASA_UPDATES if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { gainFactor = 0.7943f * sqrtf( h->earlyPartEneCorrection[bin] ); /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ @@ -1376,9 +1340,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); } -#else - gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); -#endif + for ( chB = 0; chB < nchanSeparateChannels; chB++ ) { if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 732b7f84da..ce68f4f313 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -211,7 +211,7 @@ ivas_error ivas_td_binaural_open_unwrap( *hBinRendererTd = pBinRendTd; -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( ivas_format != MASA_ISM_FORMAT ) { *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); @@ -436,7 +436,7 @@ void TDREND_Update_object_positions( c_indx++; } -#ifdef OMASA_UPDATES +#ifdef MASA_AND_OBJECTS if ( in_format == ISM_FORMAT || in_format == MASA_ISM_FORMAT ) #else if ( in_format == ISM_FORMAT ) -- GitLab From 1d5d629e4473b1e03b82c1e358ffe59c3877a07a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 20:02:33 +0200 Subject: [PATCH 102/591] introduce function ivas_omasa_ism_metadata_dec(0 in order to simplify ivas_dec.c() --- lib_com/ivas_prot.h | 14 +++++--- lib_dec/ivas_dec.c | 78 +++++++--------------------------------- lib_dec/ivas_omasa_dec.c | 76 +++++++++++++++++++++++++++++++++++++++ lib_enc/ivas_enc.c | 9 +++-- 4 files changed, 103 insertions(+), 74 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a6392e2a09..eeb267aec7 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5196,20 +5196,17 @@ void ivas_combined_format_brate_sanity( int16_t *diff_nBits /* o : number of differential bits */ ); - ISM_MODE ivas_omasa_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism /* i : number of input ISM's */ ); -#ifdef MASA_AND_OBJECTS void ivas_set_omasa_TC( const ISM_MODE ism_mode, /* i : ISM mode */ const int16_t nchan_ism, /* i : number of input ISMs */ int16_t *nSCE, /* o : number of SCEs */ int16_t *nCPE /* o : number of CPEs */ ); -#endif void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ @@ -5219,15 +5216,22 @@ void ivas_merge_masa_transports( const int16_t num_transport_channels /* i : Number of transport audio signals */ ); +ivas_error ivas_omasa_ism_metadata_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + int16_t *nchan_ism, /* o : number of ISM separated channels */ + int16_t *nchan_transport_ism, /* o : number of ISM TCs */ + const int16_t dirac_bs_md_write_idx, /* i : DirAC bitstream write index */ + int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ +); + ivas_error ivas_masa_ism_data_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ ); -#ifdef MASA_AND_OBJECTS void ivas_masa_ism_data_close( MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ); -#endif void preProcessStereoTransportsForMovedObjects( Decoder_Struct* st_ivas, diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 199af09c8d..a01cee2056 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -404,23 +404,21 @@ ivas_error ivas_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - int16_t dirac_bs_md_write_idx = 0; + int16_t nchan_ism, nchan_transport_ism; + int16_t dirac_bs_md_write_idx, dirac_read_idx; st = st_ivas->hCPE[0]->hCoreCoder[0]; - nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ + dirac_bs_md_write_idx = 0; if ( st_ivas->hDirAC != NULL ) { + st_ivas->hDirAC->numIsmDirections = 0; if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } - else - { - st_ivas->hDirAC->numIsmDirections = 0; - } dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ } @@ -436,64 +434,10 @@ ivas_error ivas_dec( st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); - //VE: !!!!! - /* set ISM parameters */ - int16_t nchan_ism, nchan_transport_ism; - nchan_ism = st_ivas->nchan_ism; - nchan_transport_ism = st_ivas->nchan_ism; - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - { - nchan_ism = 1; - nchan_transport_ism = 1; - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) - { - nchan_ism = 0; - nchan_transport_ism = 1; - } - - /* decode ISM metadata */ - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + /* 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 ) { - int16_t azimuth_ism; - int16_t elevation_ism; - int16_t block; - int16_t meta_write_index; - - /* decode ISM metadata */ - if ( ( error = ivas_ism_metadata_dec( ism_total_brate, nchan_ism, &nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) - { - return error; - } - - // VE: move the following updates into ivas_ism_metadata_dec() - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); - elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; - st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; - st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; - } - } - } - else /* ISM_MASA_MODE_MASA_ONE_OBJ */ - { - azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); - elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; - st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; - st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; - } - } + return error; } /* decode ISM channels */ @@ -569,18 +513,20 @@ ivas_error ivas_dec( { if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { + //ivas_omasa_rend( st_ivas, output ); + + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; - int16_t dirac_read_idx; if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - mvr2r( output[2], data_separated_objects[0], output_frame ); + // mvr2r( output[2], data_separated_objects[0], output_frame ); } else { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { - mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + // mvr2r( output[n + 2], data_separated_objects[n], output_frame ); } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 777d6bfbe5..d538462db6 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -392,4 +392,80 @@ void ivas_set_surplus_brate_dec( return; } + + +/*--------------------------------------------------------------------------* + * ivas_omasa_ism_metadata_dec() + * + * decode ISM metadata in OMASA format + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_ism_metadata_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + int16_t *nchan_ism, /* o : number of ISM separated channels */ + int16_t *nchan_transport_ism, /* o : number of ISM TCs */ + const int16_t dirac_bs_md_write_idx, /* i : DirAC bitstream write index */ + int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ +) +{ + int16_t n, block; + int16_t azimuth_ism, elevation_ism, meta_write_index; + ivas_error error; + + /* set ISM parameters */ + *nchan_ism = st_ivas->nchan_ism; + *nchan_transport_ism = st_ivas->nchan_ism; + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + *nchan_ism = 1; + *nchan_transport_ism = 1; + } + else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + *nchan_ism = 0; + *nchan_transport_ism = 1; + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + { + /* decode ISM metadata */ + if ( ( error = ivas_ism_metadata_dec( ism_total_brate, *nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, + nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); + elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; + st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; + } + } + } + else /* ISM_MASA_MODE_MASA_ONE_OBJ */ + { + azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); + elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; + st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; + } + } + } + + return IVAS_ERR_OK; +} + #endif diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 87b6505716..457d56a5e9 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -348,8 +348,11 @@ ivas_error ivas_enc( } /* Encode MASA parameters and write MASA metadata bitstream */ - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp ); + if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp ) ) != IVAS_ERR_OK ) + { + return error; + } /* Configuration of combined-format bit-budget distribution */ #ifdef DEBUG_MODE_INFO @@ -368,7 +371,7 @@ ivas_error ivas_enc( else if ( ivas_format == MC_FORMAT ) { /* select MC format mode; write MC LS setup; reconfigure the MC format encoder */ - if ( ( ivas_mc_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_mc_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 214ddc703fc11dd81d2ff34999b267fc1ad86c62 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 20:19:17 +0200 Subject: [PATCH 103/591] introduce function ivas_omasa_rend() in order to safe stack memory --- lib_com/ivas_prot.h | 18 ++++++++++++------ lib_dec/ivas_dec.c | 28 +++------------------------- lib_dec/ivas_omasa_dec.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index eeb267aec7..238492a510 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5216,6 +5216,14 @@ void ivas_merge_masa_transports( const int16_t num_transport_channels /* i : Number of transport audio signals */ ); +ivas_error ivas_masa_ism_data_open( + Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ +); + +void ivas_masa_ism_data_close( + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +); + ivas_error ivas_omasa_ism_metadata_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int32_t ism_total_brate, /* i : ISM total bitrate */ @@ -5225,12 +5233,10 @@ ivas_error ivas_omasa_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); -ivas_error ivas_masa_ism_data_open( - Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ -); - -void ivas_masa_ism_data_close( - MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +void ivas_omasa_rend( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* o : output synthesis signal */ + const int16_t output_frame /* i : output frame length per channel */ ); void preProcessStereoTransportsForMovedObjects( diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index a01cee2056..3e43b6aec5 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -509,37 +509,15 @@ ivas_error ivas_dec( { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } - else if ( st_ivas->hDirAC ) + else if ( st_ivas->renderer_type == RENDERER_DIRAC ) // VE2TP: please verify, it was "else if (st_ivas->hDirAC)" { if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - //ivas_omasa_rend( st_ivas, output ); - - - float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; - - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) - { - // mvr2r( output[2], data_separated_objects[0], output_frame ); - } - else - { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - // mvr2r( output[n + 2], data_separated_objects[n], output_frame ); - } - } - - dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; - - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); - - st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ - - ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); + ivas_omasa_rend( st_ivas, output, output_frame ); } else { + // VE2TP: this should never happen (ISM_MODE_NONE is renderered via ivas_format==MASA_FORMAT if branch) ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index d538462db6..bd4af659d0 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -468,4 +468,42 @@ ivas_error ivas_omasa_ism_metadata_dec( return IVAS_ERR_OK; } + +/*--------------------------------------------------------------------------* + * ivas_omasa_rend() + * + * Rendering in OMASA format + *--------------------------------------------------------------------------*/ + +void ivas_omasa_rend( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* o : output synthesis signal */ + const int16_t output_frame /* i : output frame length per channel */ +) +{ + int16_t n, dirac_read_idx; + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + mvr2r( output[2], data_separated_objects[0], output_frame ); + } + else + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( output[n + 2], data_separated_objects[n], output_frame ); + } + } + + dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; + + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); + + st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ + + ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); + + return; +} #endif -- GitLab From b029297cfedf12982fc5aaf44cc5de8be6bfd677 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 20:29:10 +0200 Subject: [PATCH 104/591] introduce function ivas_omasa_dirac_td_binaural() in order to safe stack memory --- lib_com/ivas_prot.h | 8 ++++++- lib_dec/ivas_dec.c | 29 ++++-------------------- lib_dec/ivas_omasa_dec.c | 48 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 28 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 238492a510..dd3c658455 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5233,7 +5233,13 @@ ivas_error ivas_omasa_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); -void ivas_omasa_rend( +ivas_error ivas_omasa_dirac_td_binaural( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* o : output synthesis signal */ + const int16_t output_frame /* i : output frame length per channel */ +); + +void ivas_omasa_dirac_rend( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[][L_FRAME48k], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 3e43b6aec5..6d8ab4db78 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -405,7 +405,7 @@ ivas_error ivas_dec( else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { int16_t nchan_ism, nchan_transport_ism; - int16_t dirac_bs_md_write_idx, dirac_read_idx; + int16_t dirac_bs_md_write_idx; st = st_ivas->hCPE[0]->hCoreCoder[0]; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); @@ -474,31 +474,10 @@ ivas_error ivas_dec( { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { - float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; - float gain = 0.7943f; /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ - - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - mvr2r( output[2 + n], data_separated_objects[n], output_frame ); - v_multc( data_separated_objects[n], gain, data_separated_objects[n], output_frame ); - } - - for ( n = 0; n < st_ivas->nchan_ism; n++ ) - { - delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); - } - - ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); - - if ( ( error = ivas_td_binaural_renderer( st_ivas, data_separated_objects, output_frame ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_dirac_td_binaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) { return error; } - - for ( n = 0; n < BINAURAL_CHANNELS; n++ ) - { - v_add( output[n], data_separated_objects[n], output[n], output_frame ); - } } else { @@ -513,11 +492,11 @@ ivas_error ivas_dec( { if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - ivas_omasa_rend( st_ivas, output, output_frame ); + ivas_omasa_dirac_rend( st_ivas, output, output_frame ); } else { - // VE2TP: this should never happen (ISM_MODE_NONE is renderered via ivas_format==MASA_FORMAT if branch) + // VE2TP: please verify - this should probably never happen (ISM_MODE_NONE is renderered via "ivas_format == MASA_FORMAT" if branch) ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index bd4af659d0..870ba29169 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -470,12 +470,12 @@ ivas_error ivas_omasa_ism_metadata_dec( /*--------------------------------------------------------------------------* - * ivas_omasa_rend() + * ivas_omasa_dirac_rend() * * Rendering in OMASA format *--------------------------------------------------------------------------*/ -void ivas_omasa_rend( +void ivas_omasa_dirac_rend( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[][L_FRAME48k], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ @@ -506,4 +506,48 @@ void ivas_omasa_rend( return; } + + +/*--------------------------------------------------------------------------* + * ivas_omasa_dirac_td_binaural() + * + * Binaural rendering in OMASA format + *--------------------------------------------------------------------------*/ + +ivas_error ivas_omasa_dirac_td_binaural( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* o : output synthesis signal */ + const int16_t output_frame /* i : output frame length per channel */ +) +{ + int16_t n; + float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; + float gain = 0.7943f; /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ + ivas_error error; + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( output[2 + n], data_separated_objects[n], output_frame ); + v_multc( data_separated_objects[n], gain, data_separated_objects[n], output_frame ); + } + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); + } + + ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); + + if ( ( error = ivas_td_binaural_renderer( st_ivas, data_separated_objects, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < BINAURAL_CHANNELS; n++ ) + { + v_add( output[n], data_separated_objects[n], output[n], output_frame ); + } + + return IVAS_ERR_OK; +} #endif -- GitLab From 5aadd51042e74d56f6e83a39d1fe4937f0b144de Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Apr 2023 20:37:10 +0200 Subject: [PATCH 105/591] remove obsolete ISM_MASA_MODE_PARAM mode --- lib_com/ivas_cnst.h | 2 +- lib_com/ivas_omasa_com.c | 5 ----- lib_dec/ivas_cpe_dec.c | 4 ---- lib_dec/ivas_masa_dec.c | 9 +-------- lib_dec/ivas_mono_dmx_renderer.c | 6 +----- lib_enc/ivas_cpe_enc.c | 13 +------------ lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_masa_enc.c | 13 +++---------- lib_enc/ivas_omasa_enc.c | 9 ++------- 9 files changed, 10 insertions(+), 53 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2ebd9e359e..2f8d004a9e 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -373,11 +373,11 @@ typedef enum ISM_MODE_PARAM /* parametric ISM */ #ifdef MASA_AND_OBJECTS , - ISM_MASA_MODE_PARAM, /* parametric ISM mode for combined MASA ISM format */ ISM_MASA_MODE_MASA_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using MASA parameters */ ISM_MASA_MODE_PARAM_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using parametric object model */ ISM_MASA_MODE_DISC /* MASA ISM mode when all objects are encoded separarately */ #endif + } ISM_MODE; diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 5501fa79aa..8e385537c3 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -161,10 +161,6 @@ void ivas_set_omasa_TC( { switch ( ism_mode ) { - case ISM_MASA_MODE_PARAM: - *nCPE = 1; - *nSCE = 0; - break; case ISM_MASA_MODE_MASA_ONE_OBJ: case ISM_MASA_MODE_PARAM_ONE_OBJ: *nCPE = 1; @@ -214,7 +210,6 @@ int32_t ivas_interformat_brate( { if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate <= 24000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) /* for border case in DISC mode */ { - if ( limit_flag == 1 && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) { return element_brate; diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 97a046fe9d..9667995683 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -1100,11 +1100,7 @@ static void read_stereo_mode_and_bwidth( else { /* read stereo technology info */ -#ifdef MASA_AND_OBJECTS - if ( ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) || ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && hCPE->element_brate == IVAS_48k ) ) -#else if ( hCPE->element_brate < MIN_BRATE_MDCT_STEREO && st_ivas->hMCT == NULL ) -#endif { hCPE->element_mode = get_next_indice( sts[0], NBITS_ELEMENT_MODE ) + IVAS_CPE_DFT; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b84d8d1cca..d559c05261 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -721,14 +721,7 @@ static ivas_error ivas_masa_dec_config( if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - if ( st_ivas->hCPE[0]->element_brate == IVAS_48k && st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) - { - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, IVAS_32k, st_ivas->nchan_transport, MC_MODE_NONE ); - } - else - { - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); - } + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); } else { diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index a6f0abfddb..4e16edca30 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -97,11 +97,7 @@ void ivas_mono_downmix_render_passive( #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) - { - numInputChannels = st_ivas->nchan_transport; - } - else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { numInputChannels = st_ivas->nchan_transport + 1; } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index db0da4666d..5c13e032e8 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -169,18 +169,7 @@ ivas_error ivas_cpe_enc( if ( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL ) { -#ifdef MASA_AND_OBJECTS - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM && ivas_total_brate == IVAS_48k ) - { - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, IVAS_32k ); - } - else - { -#endif - hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); -#ifdef MASA_AND_OBJECTS - } -#endif + hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } if ( ( error = front_vad( hCPE, NULL, hEncoderConfig, &hCPE->hFrontVad[0], st_ivas->hMCT != NULL, input_frame, vad_flag_dtx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies_LR, NULL, NULL ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index a9d1c83c43..f2b30df804 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -628,7 +628,7 @@ ivas_error ivas_init_encoder( } } - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) { st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index c1f509d9bb..e12251abf7 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -445,7 +445,7 @@ ivas_error ivas_masa_encode( #ifdef MASA_AND_OBJECTS /* Encode MASA+ISM metadata */ - if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { /* encode MASA/ISM energy ratios */ ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes, @@ -460,7 +460,7 @@ ivas_error ivas_masa_encode( ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); #ifdef MASA_AND_OBJECTS - if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { /* Modify spatial metadata based on the MASA-to-total energy ratios */ modify_masa_energy_ratios( hQMetaData ); @@ -692,14 +692,7 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { - if ( st_ivas->hCPE[0]->element_brate == IVAS_48k && st_ivas->ism_mode == ISM_MASA_MODE_PARAM ) - { - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, IVAS_32k, st_ivas->nchan_transport, MC_MODE_NONE ); - } - else - { - ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); - } + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); } else { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index d9acdc7d2f..8c6cd7038c 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -277,7 +277,7 @@ ivas_error ivas_omasa_enc_config( st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; - if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO && ( st_ivas->ism_mode != ISM_MASA_MODE_PARAM ) ) + if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO ) { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } @@ -568,13 +568,8 @@ void ivas_omasa_enc( hMasa->config.numCodingBands = numCodingBands_orig; hMasa->config.joinedSubframes = joinedSubframes_orig; } - else if ( ism_mode == ISM_MASA_MODE_PARAM || ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + else if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - if ( ism_mode == ISM_MASA_MODE_PARAM ) - { - *idx_separated_object = -1; - } - /* Estimate energies and ratios */ ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); } -- GitLab From 3e53ed8d1b53f3170b2487fcf9eeea63c87d824b Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 27 Apr 2023 11:03:19 +0300 Subject: [PATCH 106/591] Fixes to OMASA mono output path and addressing VE2TP comments. --- lib_dec/ivas_dec.c | 12 ++---------- lib_dec/ivas_masa_dec.c | 35 ++++++++++++++++++++--------------- lib_dec/ivas_omasa_dec.c | 39 +++++++++++++++++++++------------------ 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 6d8ab4db78..a45fe2bb7d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -488,17 +488,9 @@ ivas_error ivas_dec( { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } - else if ( st_ivas->renderer_type == RENDERER_DIRAC ) // VE2TP: please verify, it was "else if (st_ivas->hDirAC)" + else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - ivas_omasa_dirac_rend( st_ivas, output, output_frame ); - } - else - { - // VE2TP: please verify - this should probably never happen (ISM_MODE_NONE is renderered via "ivas_format == MASA_FORMAT" if branch) - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); - } + ivas_omasa_dirac_rend( st_ivas, output, output_frame ); } } #endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index d559c05261..9f1c5750c3 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -308,29 +308,34 @@ ivas_error ivas_masa_decode( #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) - { - *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); - } - if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) + if ( st_ivas->hDirAC != NULL ) { - if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) - { - int16_t sf; - int16_t meta_write_index; + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); - for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) + { + if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) { - meta_write_index = ( st_ivas->hDirAC->dirac_bs_md_write_idx + sf ) % st_ivas->hDirAC->dirac_md_buffer_length; - st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->azimuth_ism[obj][meta_write_index]; - st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->elevation_ism[obj][meta_write_index]; + int16_t sf; + int16_t meta_write_index; + + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + meta_write_index = ( st_ivas->hDirAC->dirac_bs_md_write_idx + sf ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->azimuth_ism[obj][meta_write_index]; + st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->elevation_ism[obj][meta_write_index]; + } } } } + else + { + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); + } } } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 870ba29169..c568f646c5 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -436,33 +436,36 @@ ivas_error ivas_omasa_ism_metadata_dec( return error; } - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + if (st_ivas->hDirAC != NULL ) { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); + elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; + st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; + } + } + } + else /* ISM_MASA_MODE_MASA_ONE_OBJ */ { - azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); - elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); + azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); + elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; - st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; - st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; + st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; + st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; } } } - else /* ISM_MASA_MODE_MASA_ONE_OBJ */ - { - azimuth_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->azimuth + 0.5f ); - elevation_ism = (int16_t) ( st_ivas->hIsmMetaData[0]->elevation + 0.5f ); - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; - st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; - st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; - } - } } return IVAS_ERR_OK; -- GitLab From bd4d275e8facc9c2e98c2d0436160a1207913276 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 27 Apr 2023 11:10:01 +0300 Subject: [PATCH 107/591] Apply clang format --- lib_dec/ivas_omasa_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index c568f646c5..4fe74fd841 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -436,7 +436,7 @@ ivas_error ivas_omasa_ism_metadata_dec( return error; } - if (st_ivas->hDirAC != NULL ) + if ( st_ivas->hDirAC != NULL ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -- GitLab From 9aa8bea31b0fd3fcbcb4dc18e51e35945921ee04 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 28 Apr 2023 14:54:12 +0200 Subject: [PATCH 108/591] introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps; under FIX_OMASA_STEREO_SWITCHING --- lib_com/cnst.h | 3 ++ lib_com/ivas_cnst.h | 9 +++++- lib_com/ivas_prot.h | 3 ++ lib_com/options.h | 3 +- lib_dec/ivas_cpe_dec.c | 40 ++++++++++++++++++++++++ lib_enc/ivas_cpe_enc.c | 54 +++++++++++++++++++++++++++++++++ lib_enc/ivas_ism_enc.c | 14 +++++++-- lib_enc/ivas_ism_metadata_enc.c | 21 ++++++++++++- lib_enc/ivas_masa_enc.c | 9 ++++++ lib_enc/ivas_stat_enc.h | 6 +++- 10 files changed, 156 insertions(+), 6 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 7b359e2f40..fd241c8acd 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -263,6 +263,9 @@ enum{ enum { IND_IVAS_FORMAT, +#ifdef FIX_OMASA_STEREO_SWITCHING + IND_SMODE_OMASA, +#endif IND_SMODE, IND_SID_TYPE, IND_BWIDTH, diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2f8d004a9e..fe849fca55 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1214,10 +1214,17 @@ enum #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #ifdef MASA_AND_OBJECTS #define MAXIMUM_OMASA_FREQ_BANDS 8 /* Corresponds to maximum number of coding bands at 32 kbps */ + +#ifdef FIX_OMASA_STEREO_SWITCHING +#define OMASA_STEREO_SW_CNT_MAX 100 +#define OMASA_STEREO_SW_CNT_MAX2 5 +#endif + #endif #define MASA_BIT_REDUCT_PARAM 10 -#define MASA_MAXIMUM_TWO_DIR_BANDS 18 +#define MASA_MAXIMUM_TWO_DIR_BANDS 18 + typedef enum { MASA_STEREO_NOT_DEFINED, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index dd3c658455..6ca23dd915 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -837,6 +837,9 @@ ivas_error ivas_ism_metadata_enc( const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ #ifdef MASA_AND_OBJECTS ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ +#ifdef FIX_OMASA_STEREO_SWITCHING + ,int16_t *omasa_stereo_sw_cnt +#endif #endif ); diff --git a/lib_com/options.h b/lib_com/options.h index 64aab79878..1f33b8c36f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -168,6 +168,7 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ +#define FIX_OMASA_STEREO_SWITCHING // VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 9667995683..714149b9aa 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -79,6 +79,9 @@ ivas_error ivas_cpe_dec( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t cpe_brate; +#ifdef FIX_OMASA_STEREO_SWITCHING + int32_t element_brate_ref; +#endif #endif error = IVAS_ERR_OK; @@ -95,10 +98,40 @@ ivas_error ivas_cpe_dec( sts[0]->BER_detect |= st_ivas->BER_detect; sts[1]->BER_detect |= st_ivas->BER_detect; +#ifdef FIX_OMASA_STEREO_SWITCHING + element_brate_ref = hCPE->element_brate; +#endif + /*------------------------------------------------------------------* * Read stereo technology info & audio bandwidth *-----------------------------------------------------------------*/ +#ifdef FIX_OMASA_STEREO_SWITCHING + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && + ( ( st_ivas->nchan_ism == 3 && ivas_total_brate == IVAS_96k ) || + ( st_ivas->nchan_ism == 4 && ivas_total_brate == IVAS_128k ) ) ) + { + /* read OMASA stereo mode signalling */ + if ( get_next_indice( sts[0], NBITS_ELEMENT_MODE ) ) + { + hCPE->element_mode = IVAS_CPE_MDCT; + } + else + { + hCPE->element_mode = IVAS_CPE_DFT; + } + + if ( hCPE->element_mode == IVAS_CPE_MDCT ) + { + hCPE->element_brate = IVAS_64k; + hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref ); + } + } + } +#endif + read_stereo_mode_and_bwidth( hCPE, st_ivas ); /*----------------------------------------------------------------* @@ -551,6 +584,13 @@ ivas_error ivas_cpe_dec( hCPE->last_element_brate = hCPE->element_brate; hCPE->last_element_mode = hCPE->element_mode; +#ifdef FIX_OMASA_STEREO_SWITCHING + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + hCPE->element_brate = element_brate_ref; + } +#endif + if ( hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_TD ) { stereo_cng_dec_update( hCPE, ivas_total_brate ); diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 5c13e032e8..c6b33d7539 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -103,6 +103,10 @@ ivas_error ivas_cpe_enc( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t cpe_brate; +#ifdef FIX_OMASA_STEREO_SWITCHING + int32_t element_brate_ref; + int16_t element_mode_ref; +#endif #endif error = IVAS_ERR_OK; @@ -117,6 +121,10 @@ ivas_error ivas_cpe_enc( ivas_format = hEncoderConfig->ivas_format; input_Fs = hEncoderConfig->input_Fs; ivas_total_brate = hEncoderConfig->ivas_total_brate; +#ifdef FIX_OMASA_STEREO_SWITCHING + element_brate_ref = hCPE->element_brate; + element_mode_ref = hCPE->element_mode; +#endif /*------------------------------------------------------------------* * Initialization - general @@ -172,6 +180,43 @@ ivas_error ivas_cpe_enc( hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } +#ifdef FIX_OMASA_STEREO_SWITCHING + if ( ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && + ( ( hEncoderConfig->nchan_ism == 3 && ivas_total_brate == IVAS_96k ) || + ( hEncoderConfig->nchan_ism == 4 && ivas_total_brate == IVAS_128k ) ) ) + { + if ( hCPE->element_brate + hCPE->brate_surplus > IVAS_64k ) + { + st_ivas->hMasa->data.omasa_stereo_sw_cnt = 0; + } + else + { + st_ivas->hMasa->data.omasa_stereo_sw_cnt++; + st_ivas->hMasa->data.omasa_stereo_sw_cnt = min( st_ivas->hMasa->data.omasa_stereo_sw_cnt, OMASA_STEREO_SW_CNT_MAX ); + } + + if ( st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) + { + hCPE->element_mode = IVAS_CPE_MDCT; + hCPE->element_brate = IVAS_64k; + hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref ); + } + + /* write OMASA stereo mode signalling */ + if ( hCPE->element_mode == IVAS_CPE_MDCT ) + { + push_indice( hCPE->hCoreCoder[0]->hBstr, IND_SMODE_OMASA, 1, NBITS_ELEMENT_MODE ); + } + else + { + push_indice( hCPE->hCoreCoder[0]->hBstr, IND_SMODE_OMASA, 0, NBITS_ELEMENT_MODE ); + } + } + } +#endif + if ( ( error = front_vad( hCPE, NULL, hEncoderConfig, &hCPE->hFrontVad[0], st_ivas->hMCT != NULL, input_frame, vad_flag_dtx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies_LR, NULL, NULL ) ) != IVAS_ERR_OK ) { return error; @@ -197,6 +242,7 @@ ivas_error ivas_cpe_enc( return error; } + /*----------------------------------------------------------------* * Set TD stereo parameters *----------------------------------------------------------------*/ @@ -728,6 +774,14 @@ ivas_error ivas_cpe_enc( hCPE->last_element_brate = hCPE->element_brate; hCPE->last_element_mode = hCPE->element_mode; +#ifdef FIX_OMASA_STEREO_SWITCHING + if ( ivas_format == MASA_ISM_FORMAT ) + { + hCPE->element_brate = element_brate_ref; + } +#endif + + if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->hStereoMdct != NULL && hCPE->hStereoMdct->hItd != NULL ) { /* update input samples buffer */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index b560d04f4d..35de64ab26 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -245,7 +245,12 @@ ivas_error ivas_ism_enc( { #ifdef MASA_AND_OBJECTS ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1 ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1 +#ifdef FIX_OMASA_STEREO_SWITCHING + , + NULL +#endif + ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif @@ -269,7 +274,12 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 +#ifdef FIX_OMASA_STEREO_SWITCHING + , + st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL +#endif + ); if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 24924a25bb..922bfa5123 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -180,6 +180,10 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS , const float lp_noise_CPE +#ifdef FIX_OMASA_STEREO_SWITCHING + , + int16_t *omasa_stereo_sw_cnt +#endif #endif ) { @@ -539,7 +543,6 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - { int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; int16_t brate_limit_flag; @@ -557,6 +560,22 @@ ivas_error ivas_ism_metadata_enc( *ism_total_brate += ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ); } ism_metadata_flag_global = 1; + +#ifdef FIX_OMASA_STEREO_SWITCHING + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + brate_limit_flag = 0; + for ( int16_t n = 0; n < nchan_ism; n++ ) + { + brate_limit_flag += ism_imp[n]; + } + + if ( brate_limit_flag >= nchan_ism * ISM_HIGH_IMP - 2 ) + { + *omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; + } + } +#endif } #endif diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index e12251abf7..048adbe2dc 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -185,6 +185,10 @@ ivas_error ivas_masa_enc_open( #ifdef MASA_AND_OBJECTS hMasa->data.lp_noise_CPE = -1; +#ifdef FIX_OMASA_STEREO_SWITCHING + hMasa->data.omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; + hMasa->data.omasa_stereo_sw_cnt2 = OMASA_STEREO_SW_CNT_MAX2; +#endif #endif st_ivas->hMasa = hMasa; @@ -795,7 +799,12 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { +#ifdef FIX_OMASA_STEREO_SWITCHING + if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT || st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) +#else + if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT ) +#endif { st_ivas->hMasa->data.lp_noise_CPE = st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 80dddaf9dd..45c95b38fa 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -750,7 +750,11 @@ typedef struct ivas_masa_encoder_data_struct float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t nchan_ism; - float lp_noise_CPE; /* LP filterend total noise estimation */ + float lp_noise_CPE; /* LP filtered total noise estimation */ +#ifdef FIX_OMASA_STEREO_SWITCHING + int16_t omasa_stereo_sw_cnt; + int16_t omasa_stereo_sw_cnt2; +#endif #endif int16_t num_Cldfb_instances; -- GitLab From 7443af46d0f1249d8c66b0e4bf6778c8eb7ba36b Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 1 May 2023 22:45:22 +1000 Subject: [PATCH 109/591] fix for compilation errors when SPLIT_REND_WITH_HEAD_ROT is disabled --- apps/renderer.c | 8 +++++--- lib_rend/ivas_CQMFDecoder.c | 4 +++- lib_rend/ivas_CQMFDecoder.h | 7 +++++-- lib_rend/ivas_CQMFEncoder.c | 5 +++-- lib_rend/ivas_CQMFEncoder.h | 5 +++-- lib_rend/ivas_CQMFHuff.c | 4 +++- lib_rend/ivas_MSPred.c | 4 +++- lib_rend/ivas_NoiseGen.c | 4 +++- lib_rend/ivas_PerceptualModel.c | 4 +++- lib_rend/ivas_PredDecoder.c | 4 +++- lib_rend/ivas_PredDecoder.h | 5 ++++- lib_rend/ivas_PredEncoder.c | 4 +++- lib_rend/ivas_PredEncoder.h | 5 ++++- lib_rend/ivas_Tables.c | 3 +++ lib_rend/ivas_cldfb_codec_bitstream.c | 7 ++++--- lib_rend/ivas_cldfb_codec_bitstream.h | 5 +++++ lib_rend/lib_rend.c | 4 ++-- 17 files changed, 59 insertions(+), 23 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index c52579c745..155ac16d9b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -420,8 +420,9 @@ 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], + IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] #ifdef SPLIT_REND_WITH_HEAD_ROT + , IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS] #endif ) @@ -1240,6 +1241,7 @@ int main( outBuffer.config.numSamplesPerChannel = (int16_t) CLDFBframeSize_smpls; } #else + inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); outFloatBuffer = malloc( outBufferSize * sizeof( float ) ); outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; @@ -1402,11 +1404,11 @@ int main( } else { - error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL + error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL #ifdef SPLIT_REND_WITH_HEAD_ROT , DEFAULT_AXIS -#endif +#endif ); if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC { diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 0e3d27f67e..c2980fa6c3 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -36,6 +36,8 @@ Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ #include "ivas_CQMFDecoder.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_CQMFHuff.h" #include "ivas_NoiseGen.h" @@ -43,7 +45,6 @@ Nations Convention on Contracts on the International Sales of Goods. #include "ivas_RMSEnvDeltaHuff.h" #include "ivas_Tables.h" #include "ivas_cldfb_codec_bitstream.h" -#include "options.h" #include "prot.h" #include #include @@ -1372,3 +1373,4 @@ static void ComputeAllocation( const int32_t iChannels, } } } +#endif diff --git a/lib_rend/ivas_CQMFDecoder.h b/lib_rend/ivas_CQMFDecoder.h index a68c2451fb..f331ed20d3 100644 --- a/lib_rend/ivas_CQMFDecoder.h +++ b/lib_rend/ivas_CQMFDecoder.h @@ -37,6 +37,10 @@ extern "C" { #endif + +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT + #include "lib_rend.h" #define DECODER_ERROR_NONE ( 0 ) #define DECODER_ERROR_FS_NOT_SUPPORTED ( -1 ) @@ -56,9 +60,8 @@ extern "C" ivas_split_rend_bits_t *pBits, float ***pppfCQMFReal, float ***pppfCQMFImag ); - +#endif #ifdef __cplusplus } #endif - #endif /* _CQMF_DECODER_H_ */ diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c index 076805eddd..892eb92012 100644 --- a/lib_rend/ivas_CQMFEncoder.c +++ b/lib_rend/ivas_CQMFEncoder.c @@ -31,13 +31,13 @@ *******************************************************************************************************/ #include "ivas_CQMFEncoder.h" - +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include #include #include #include "ivas_Tables.h" -#include "options.h" #include "prot.h" #include "ivas_RMSEnvGrouping.h" #include "ivas_PerceptualModel.h" @@ -2047,3 +2047,4 @@ static int32_t ComputeAllocation( const int32_t iChannels, return iBitsUsed; } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_CQMFEncoder.h b/lib_rend/ivas_CQMFEncoder.h index 3466eae6b4..e78aa4614d 100644 --- a/lib_rend/ivas_CQMFEncoder.h +++ b/lib_rend/ivas_CQMFEncoder.h @@ -37,6 +37,8 @@ extern "C" { #endif +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "lib_rend.h" #define ENCODER_ERROR_NONE ( 0 ) #define ENCODER_ERROR_FS_NOT_SUPPORTED ( -1 ) @@ -61,9 +63,8 @@ extern "C" const int32_t available_bits, ivas_split_rend_bits_t *pBits ); int32_t GetNumGroups( CQMFEncoder *psCQMFEncoder ); - +#endif #ifdef __cplusplus } #endif - #endif /* _CQMF_ENCODER_H_ */ diff --git a/lib_rend/ivas_CQMFHuff.c b/lib_rend/ivas_CQMFHuff.c index 4aca93fc65..af4d4d11ee 100644 --- a/lib_rend/ivas_CQMFHuff.c +++ b/lib_rend/ivas_CQMFHuff.c @@ -31,6 +31,8 @@ *******************************************************************************************************/ #include "ivas_CQMFHuff.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_prot_rend.h" #include "wmc_auto.h" @@ -4121,5 +4123,5 @@ const int32_t (*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { #endif - +#endif /* clang-format on */ diff --git a/lib_rend/ivas_MSPred.c b/lib_rend/ivas_MSPred.c index 0a3e6e8e3c..4cecace732 100644 --- a/lib_rend/ivas_MSPred.c +++ b/lib_rend/ivas_MSPred.c @@ -31,11 +31,12 @@ *******************************************************************************************************/ #include "ivas_MSPred.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_Tables.h" #include "ivas_RMSEnvDeltaHuff.h" #include #include -#include "options.h" #include "prot.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" @@ -356,3 +357,4 @@ void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32 } fprintf( fid, "\n" ); } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_NoiseGen.c b/lib_rend/ivas_NoiseGen.c index 66efe7873d..39d8b9c177 100644 --- a/lib_rend/ivas_NoiseGen.c +++ b/lib_rend/ivas_NoiseGen.c @@ -31,10 +31,11 @@ *******************************************************************************************************/ #include "ivas_NoiseGen.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include #include -#include "options.h" #include "prot.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" @@ -81,3 +82,4 @@ void DeleteNoiseGen( NoiseGen *psNoiseGen ) } extern float GetNoise( NoiseGen *psNoiseGen ); +#endif \ No newline at end of file diff --git a/lib_rend/ivas_PerceptualModel.c b/lib_rend/ivas_PerceptualModel.c index 8ba92a1409..efa63b4247 100644 --- a/lib_rend/ivas_PerceptualModel.c +++ b/lib_rend/ivas_PerceptualModel.c @@ -31,8 +31,9 @@ *******************************************************************************************************/ #include "ivas_PerceptualModel.h" -#include "ivas_Tables.h" #include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "ivas_Tables.h" #include "prot.h" #include "ivas_prot_rend.h" #include @@ -314,3 +315,4 @@ void PerceptualModelStereo( const int32_t iMaxQuantBands, piSMR1[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope1[n] + c_aiBandwidthAdjust48[n] - piSMR1[n]; } } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index 0185ad74a1..aa15db6509 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -31,10 +31,11 @@ *******************************************************************************************************/ #include "ivas_PredDecoder.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include #include -#include "options.h" #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_Tables.h" @@ -258,3 +259,4 @@ void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder, } } } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_PredDecoder.h b/lib_rend/ivas_PredDecoder.h index 435c4f2238..47f986bc7d 100644 --- a/lib_rend/ivas_PredDecoder.h +++ b/lib_rend/ivas_PredDecoder.h @@ -38,6 +38,9 @@ extern "C" { #endif +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT + #include "ivas_cldfb_codec_bitstream.h" // typedef struct PREDICTION_DECODER PredictionDecoder; @@ -76,7 +79,7 @@ extern "C" float ***pppfReal, float ***pppfImag ); - +#endif #ifdef __cplusplus } #endif diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index 7d21f0e257..1dd0725466 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -31,12 +31,13 @@ *******************************************************************************************************/ #include "ivas_PredEncoder.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include #include #include "ivas_Tables.h" #include "ivas_PredTables.h" -#include "options.h" #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_cldfb_codec_bitstream.h" @@ -475,3 +476,4 @@ int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, return iBitsWritten; } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_PredEncoder.h b/lib_rend/ivas_PredEncoder.h index 5ebbe7b48d..e74c61d76b 100644 --- a/lib_rend/ivas_PredEncoder.h +++ b/lib_rend/ivas_PredEncoder.h @@ -38,6 +38,9 @@ extern "C" { #endif +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT + #include "ivas_cldfb_codec_bitstream.h" typedef struct PREDICTION_ENCODER @@ -80,7 +83,7 @@ extern "C" int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, ivas_split_rend_bits_t *pBits ); - +#endif #ifdef __cplusplus } #endif diff --git a/lib_rend/ivas_Tables.c b/lib_rend/ivas_Tables.c index 8d23ee756a..534aff5254 100644 --- a/lib_rend/ivas_Tables.c +++ b/lib_rend/ivas_Tables.c @@ -31,6 +31,8 @@ *******************************************************************************************************/ #include "ivas_Tables.h" +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_prot_rend.h" #include "wmc_auto.h" @@ -194,4 +196,5 @@ const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { 729, 729, 28, 29, 32, 37, 39, 46, 55, 65, 77, 91, 109, 129, 153, 181, }; +#endif /* clang-format on */ diff --git a/lib_rend/ivas_cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_codec_bitstream.c index eb82a4a6f7..d12cb39d61 100644 --- a/lib_rend/ivas_cldfb_codec_bitstream.c +++ b/lib_rend/ivas_cldfb_codec_bitstream.c @@ -29,15 +29,15 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ - #include "ivas_cldfb_codec_bitstream.h" - +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include -#include "options.h" #include "prot.h" #include "wmc_auto.h" + #define MAX_BUFFER 1024 static const uint32_t MASKS[] = { @@ -305,3 +305,4 @@ int32_t BSGetError( Bitstream *psBitstream ) { return psBitstream->iError; } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_codec_bitstream.h index 07ceb79fb8..a058b901ee 100644 --- a/lib_rend/ivas_cldfb_codec_bitstream.h +++ b/lib_rend/ivas_cldfb_codec_bitstream.h @@ -44,6 +44,10 @@ extern "C" #endif #include "lib_rend.h" #include "ivas_prot_rend.h" +#include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT + enum { BS_READ, @@ -93,6 +97,7 @@ extern "C" int32_t BSGetAvailableBytes( Bitstream *psBitstream ); int32_t BSGetError( Bitstream *psBitstream ); +#endif #ifdef __cplusplus } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 91184e353f..5376b18126 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2367,7 +2367,7 @@ updateSbaPanGains( } #endif case IVAS_REND_AUDIO_CONFIG_BINAURAL: -#ifdef DEBUGGING +#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -5948,7 +5948,7 @@ static ivas_error renderSbaToBinaural( push_wmops( "renderSbaToBinaural" ); -#ifdef DEBUGGING +#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -- GitLab From dc15a6cd11338788882f9215bad136d171f7f2a8 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 1 May 2023 23:15:26 +1000 Subject: [PATCH 110/591] fix for JBM tests --- apps/decoder.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 711706c9b3..575a696452 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2241,6 +2241,10 @@ static ivas_error decodeVoIP( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + + SplitFileReadWrite *hSplitRendFileReadWrite = NULL; +#endif error = initOnFirstGoodFrame( hIvasDec, arg, @@ -2257,7 +2261,7 @@ static ivas_error decodeVoIP( &numObj #ifdef SPLIT_REND_WITH_HEAD_ROT , - NULL + &hSplitRendFileReadWrite #endif ); if ( error != IVAS_ERR_OK ) -- GitLab From 26e59ff1b9c690b449d44c8e2e8ede8b52518dc2 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 1 May 2023 23:23:13 +1000 Subject: [PATCH 111/591] fix for uninitialized PLC file path --- apps/renderer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index 155ac16d9b..9f9f6f1ea8 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2193,6 +2193,9 @@ static CmdlnArgs defaultArgs( clearString( args.headRotationFilePath ); #ifdef SPLIT_REND_WITH_HEAD_ROT clearString( args.outMetadataFilePath ); +#endif +#ifdef SPLIT_REND_PLC + clearString( args.splitRendBFIFilePath ); #endif clearString( args.referenceVectorFilePath ); clearString( args.referenceRotationFilePath ); -- GitLab From 27af0e05f07a31dfd87b6adc8423bb98865f979d Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 2 May 2023 10:34:21 +1000 Subject: [PATCH 112/591] clang format fixes --- lib_com/delay_comp.c | 10 +- lib_dec/ivas_binRenderer_internal.c | 2 +- lib_rend/ivas_CQMFEncoder.c | 2 +- lib_rend/ivas_CQMFHuff.h | 299 +++++++++++++------------- lib_rend/ivas_MSPred.c | 2 +- lib_rend/ivas_NoiseGen.c | 2 +- lib_rend/ivas_PerceptualModel.c | 2 +- lib_rend/ivas_PerceptualModel.h | 26 +-- lib_rend/ivas_PredDecoder.c | 2 +- lib_rend/ivas_PredEncoder.c | 2 +- lib_rend/ivas_PredTables.h | 12 +- lib_rend/ivas_RMSEnvDeltaHuff.c | 2 +- lib_rend/ivas_RMSEnvDeltaHuff.h | 8 +- lib_rend/ivas_cldfb_codec_bitstream.c | 3 +- lib_rend/ivas_splitRendererPLC.c | 2 +- lib_rend/ivas_splitRendererPost.c | 2 +- lib_rend/ivas_splitRendererPre.c | 2 +- lib_util/split_rend_bfi_file_reader.c | 9 +- lib_util/split_rend_bfi_file_reader.h | 5 +- 19 files changed, 196 insertions(+), 198 deletions(-) diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 6a70eaa8b2..bc5a1784f1 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -106,11 +106,11 @@ int32_t get_delay( if ( output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) #endif { - if ( hCldfb != NULL ) - { - /* compensate for filterbank delay */ - delay += IVAS_FB_DEC_DELAY_NS; - } + if ( hCldfb != NULL ) + { + /* compensate for filterbank delay */ + delay += IVAS_FB_DEC_DELAY_NS; + } } diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f13cc5bae7..c7cf76137a 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1534,4 +1534,4 @@ void ivas_rend_CldfbMultiBinRendProcess( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c index 892eb92012..a933b2f7cb 100644 --- a/lib_rend/ivas_CQMFEncoder.c +++ b/lib_rend/ivas_CQMFEncoder.c @@ -2047,4 +2047,4 @@ static int32_t ComputeAllocation( const int32_t iChannels, return iBitsUsed; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_CQMFHuff.h b/lib_rend/ivas_CQMFHuff.h index 3e6eebaba4..bf28158bea 100644 --- a/lib_rend/ivas_CQMFHuff.h +++ b/lib_rend/ivas_CQMFHuff.h @@ -39,308 +39,309 @@ extern "C" #endif #include "ivas_Tables.h" +#include // For NULL +#include -//#define USE_DEMOD_TABLES + //#define USE_DEMOD_TABLES #ifndef HUFF_READ_SIZE -#define HUFF_READ_SIZE (4) +#define HUFF_READ_SIZE ( 4 ) #endif #ifndef HUFF_DEC_TABLE_SIZE -#define HUFF_DEC_TABLE_SIZE (16) +#define HUFF_DEC_TABLE_SIZE ( 16 ) #endif -#include // For NULL -#include -extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; -extern const uint32_t c_aauiCQMFHuffDec1[3][16]; + extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; + + extern const uint32_t c_aauiCQMFHuffDec1[3][16]; -extern const uint32_t c_aauiCQMFHuffEnc2[16][2]; + extern const uint32_t c_aauiCQMFHuffEnc2[16][2]; -extern const uint32_t c_aauiCQMFHuffDec2[3][16]; + extern const uint32_t c_aauiCQMFHuffDec2[3][16]; -extern const uint32_t c_aauiCQMFHuffEnc3[25][2]; + extern const uint32_t c_aauiCQMFHuffEnc3[25][2]; -extern const uint32_t c_aauiCQMFHuffDec3[10][16]; + extern const uint32_t c_aauiCQMFHuffDec3[10][16]; -extern const uint32_t c_aauiCQMFHuffEnc4[36][2]; + extern const uint32_t c_aauiCQMFHuffEnc4[36][2]; -extern const uint32_t c_aauiCQMFHuffDec4[5][16]; + extern const uint32_t c_aauiCQMFHuffDec4[5][16]; -extern const uint32_t c_aauiCQMFHuffEnc5[36][2]; + extern const uint32_t c_aauiCQMFHuffEnc5[36][2]; -extern const uint32_t c_aauiCQMFHuffDec5[10][16]; + extern const uint32_t c_aauiCQMFHuffDec5[10][16]; -extern const uint32_t c_aauiCQMFHuffEnc6[49][2]; + extern const uint32_t c_aauiCQMFHuffEnc6[49][2]; -extern const uint32_t c_aauiCQMFHuffDec6[7][16]; + extern const uint32_t c_aauiCQMFHuffDec6[7][16]; -extern const uint32_t c_aauiCQMFHuffEnc7[64][2]; + extern const uint32_t c_aauiCQMFHuffEnc7[64][2]; -extern const uint32_t c_aauiCQMFHuffDec7[25][16]; + extern const uint32_t c_aauiCQMFHuffDec7[25][16]; -extern const uint32_t c_aauiCQMFHuffEnc8[81][2]; + extern const uint32_t c_aauiCQMFHuffEnc8[81][2]; -extern const uint32_t c_aauiCQMFHuffDec8[16][16]; + extern const uint32_t c_aauiCQMFHuffDec8[16][16]; -extern const uint32_t c_aauiCQMFHuffEnc9[100][2]; + extern const uint32_t c_aauiCQMFHuffEnc9[100][2]; -extern const uint32_t c_aauiCQMFHuffDec9[22][16]; + extern const uint32_t c_aauiCQMFHuffDec9[22][16]; -extern const uint32_t c_aauiCQMFHuffEnc10[169][2]; + extern const uint32_t c_aauiCQMFHuffEnc10[169][2]; -extern const uint32_t c_aauiCQMFHuffDec10[45][16]; + extern const uint32_t c_aauiCQMFHuffDec10[45][16]; -extern const uint32_t c_aauiCQMFHuffEnc11[196][2]; + extern const uint32_t c_aauiCQMFHuffEnc11[196][2]; -extern const uint32_t c_aauiCQMFHuffDec11[50][16]; + extern const uint32_t c_aauiCQMFHuffDec11[50][16]; -extern const uint32_t c_aauiCQMFHuffEnc12[289][2]; + extern const uint32_t c_aauiCQMFHuffEnc12[289][2]; -extern const uint32_t c_aauiCQMFHuffDec12[76][16]; + extern const uint32_t c_aauiCQMFHuffDec12[76][16]; -extern const uint32_t c_aauiCQMFHuffEnc13[324][2]; + extern const uint32_t c_aauiCQMFHuffEnc13[324][2]; -extern const uint32_t c_aauiCQMFHuffDec13[89][16]; + extern const uint32_t c_aauiCQMFHuffDec13[89][16]; -extern const uint32_t c_aauiCQMFHuffEnc14[400][2]; + extern const uint32_t c_aauiCQMFHuffEnc14[400][2]; -extern const uint32_t c_aauiCQMFHuffDec14[53][16]; + extern const uint32_t c_aauiCQMFHuffDec14[53][16]; -extern const uint32_t c_aauiCQMFHuffEnc15[576][2]; + extern const uint32_t c_aauiCQMFHuffEnc15[576][2]; -extern const uint32_t c_aauiCQMFHuffDec15[73][16]; + extern const uint32_t c_aauiCQMFHuffDec15[73][16]; -extern const uint32_t c_aauiCQMFHuffEnc16[729][2]; + extern const uint32_t c_aauiCQMFHuffEnc16[729][2]; -extern const uint32_t c_aauiCQMFHuffDec16[85][16]; + extern const uint32_t c_aauiCQMFHuffDec16[85][16]; -extern const uint32_t c_aauiCQMFHuffEnc17[729][2]; + extern const uint32_t c_aauiCQMFHuffEnc17[729][2]; -extern const uint32_t c_aauiCQMFHuffDec17[93][16]; + extern const uint32_t c_aauiCQMFHuffDec17[93][16]; -extern const uint32_t c_aauiCQMFHuffEnc18[28][2]; + extern const uint32_t c_aauiCQMFHuffEnc18[28][2]; -extern const uint32_t c_aauiCQMFHuffDec18[6][16]; + extern const uint32_t c_aauiCQMFHuffDec18[6][16]; -extern const uint32_t c_aauiCQMFHuffEnc19[29][2]; + extern const uint32_t c_aauiCQMFHuffEnc19[29][2]; -extern const uint32_t c_aauiCQMFHuffDec19[6][16]; + extern const uint32_t c_aauiCQMFHuffDec19[6][16]; -extern const uint32_t c_aauiCQMFHuffEnc20[32][2]; + extern const uint32_t c_aauiCQMFHuffEnc20[32][2]; -extern const uint32_t c_aauiCQMFHuffDec20[6][16]; + extern const uint32_t c_aauiCQMFHuffDec20[6][16]; -extern const uint32_t c_aauiCQMFHuffEnc21[37][2]; + extern const uint32_t c_aauiCQMFHuffEnc21[37][2]; -extern const uint32_t c_aauiCQMFHuffDec21[7][16]; + extern const uint32_t c_aauiCQMFHuffDec21[7][16]; -extern const uint32_t c_aauiCQMFHuffEnc22[39][2]; + extern const uint32_t c_aauiCQMFHuffEnc22[39][2]; -extern const uint32_t c_aauiCQMFHuffDec22[9][16]; + extern const uint32_t c_aauiCQMFHuffDec22[9][16]; -extern const uint32_t c_aauiCQMFHuffEnc23[46][2]; + extern const uint32_t c_aauiCQMFHuffEnc23[46][2]; -extern const uint32_t c_aauiCQMFHuffDec23[12][16]; + extern const uint32_t c_aauiCQMFHuffDec23[12][16]; -extern const uint32_t c_aauiCQMFHuffEnc24[55][2]; + extern const uint32_t c_aauiCQMFHuffEnc24[55][2]; -extern const uint32_t c_aauiCQMFHuffDec24[17][16]; + extern const uint32_t c_aauiCQMFHuffDec24[17][16]; -extern const uint32_t c_aauiCQMFHuffEnc25[65][2]; + extern const uint32_t c_aauiCQMFHuffEnc25[65][2]; -extern const uint32_t c_aauiCQMFHuffDec25[19][16]; + extern const uint32_t c_aauiCQMFHuffDec25[19][16]; -extern const uint32_t c_aauiCQMFHuffEnc26[77][2]; + extern const uint32_t c_aauiCQMFHuffEnc26[77][2]; -extern const uint32_t c_aauiCQMFHuffDec26[26][16]; + extern const uint32_t c_aauiCQMFHuffDec26[26][16]; -extern const uint32_t c_aauiCQMFHuffEnc27[91][2]; + extern const uint32_t c_aauiCQMFHuffEnc27[91][2]; -extern const uint32_t c_aauiCQMFHuffDec27[28][16]; + extern const uint32_t c_aauiCQMFHuffDec27[28][16]; -extern const uint32_t c_aauiCQMFHuffEnc28[109][2]; + extern const uint32_t c_aauiCQMFHuffEnc28[109][2]; -extern const uint32_t c_aauiCQMFHuffDec28[30][16]; + extern const uint32_t c_aauiCQMFHuffDec28[30][16]; -extern const uint32_t c_aauiCQMFHuffEnc29[129][2]; + extern const uint32_t c_aauiCQMFHuffEnc29[129][2]; -extern const uint32_t c_aauiCQMFHuffDec29[34][16]; + extern const uint32_t c_aauiCQMFHuffDec29[34][16]; -extern const uint32_t c_aauiCQMFHuffEnc30[153][2]; + extern const uint32_t c_aauiCQMFHuffEnc30[153][2]; -extern const uint32_t c_aauiCQMFHuffDec30[39][16]; + extern const uint32_t c_aauiCQMFHuffDec30[39][16]; -extern const uint32_t c_aauiCQMFHuffEnc31[181][2]; + extern const uint32_t c_aauiCQMFHuffEnc31[181][2]; -extern const uint32_t c_aauiCQMFHuffDec31[43][16]; + extern const uint32_t c_aauiCQMFHuffDec31[43][16]; -extern const uint32_t c_aauiCQMFHuffEnc33[16][2]; + extern const uint32_t c_aauiCQMFHuffEnc33[16][2]; -extern const uint32_t c_aauiCQMFHuffDec33[2][16]; + extern const uint32_t c_aauiCQMFHuffDec33[2][16]; -extern const uint32_t c_aauiCQMFHuffEnc34[16][2]; + extern const uint32_t c_aauiCQMFHuffEnc34[16][2]; -extern const uint32_t c_aauiCQMFHuffDec34[2][16]; + extern const uint32_t c_aauiCQMFHuffDec34[2][16]; -extern const uint32_t c_aauiCQMFHuffEnc35[25][2]; + extern const uint32_t c_aauiCQMFHuffEnc35[25][2]; -extern const uint32_t c_aauiCQMFHuffDec35[9][16]; + extern const uint32_t c_aauiCQMFHuffDec35[9][16]; -extern const uint32_t c_aauiCQMFHuffEnc36[36][2]; + extern const uint32_t c_aauiCQMFHuffEnc36[36][2]; -extern const uint32_t c_aauiCQMFHuffDec36[7][16]; + extern const uint32_t c_aauiCQMFHuffDec36[7][16]; -extern const uint32_t c_aauiCQMFHuffEnc37[36][2]; + extern const uint32_t c_aauiCQMFHuffEnc37[36][2]; -extern const uint32_t c_aauiCQMFHuffDec37[4][16]; + extern const uint32_t c_aauiCQMFHuffDec37[4][16]; -extern const uint32_t c_aauiCQMFHuffEnc38[49][2]; + extern const uint32_t c_aauiCQMFHuffEnc38[49][2]; -extern const uint32_t c_aauiCQMFHuffDec38[22][16]; + extern const uint32_t c_aauiCQMFHuffDec38[22][16]; -extern const uint32_t c_aauiCQMFHuffEnc39[64][2]; + extern const uint32_t c_aauiCQMFHuffEnc39[64][2]; -extern const uint32_t c_aauiCQMFHuffDec39[12][16]; + extern const uint32_t c_aauiCQMFHuffDec39[12][16]; -extern const uint32_t c_aauiCQMFHuffEnc40[81][2]; + extern const uint32_t c_aauiCQMFHuffEnc40[81][2]; -extern const uint32_t c_aauiCQMFHuffDec40[36][16]; + extern const uint32_t c_aauiCQMFHuffDec40[36][16]; -extern const uint32_t c_aauiCQMFHuffEnc41[100][2]; + extern const uint32_t c_aauiCQMFHuffEnc41[100][2]; -extern const uint32_t c_aauiCQMFHuffDec41[16][16]; + extern const uint32_t c_aauiCQMFHuffDec41[16][16]; -extern const uint32_t c_aauiCQMFHuffEnc42[169][2]; + extern const uint32_t c_aauiCQMFHuffEnc42[169][2]; -extern const uint32_t c_aauiCQMFHuffDec42[28][16]; + extern const uint32_t c_aauiCQMFHuffDec42[28][16]; -extern const uint32_t c_aauiCQMFHuffEnc43[196][2]; + extern const uint32_t c_aauiCQMFHuffEnc43[196][2]; -extern const uint32_t c_aauiCQMFHuffDec43[32][16]; + extern const uint32_t c_aauiCQMFHuffDec43[32][16]; -extern const uint32_t c_aauiCQMFHuffEnc44[289][2]; + extern const uint32_t c_aauiCQMFHuffEnc44[289][2]; -extern const uint32_t c_aauiCQMFHuffDec44[27][16]; + extern const uint32_t c_aauiCQMFHuffDec44[27][16]; -extern const uint32_t c_aauiCQMFHuffEnc45[324][2]; + extern const uint32_t c_aauiCQMFHuffEnc45[324][2]; -extern const uint32_t c_aauiCQMFHuffDec45[50][16]; + extern const uint32_t c_aauiCQMFHuffDec45[50][16]; -extern const uint32_t c_aauiCQMFHuffEnc46[400][2]; + extern const uint32_t c_aauiCQMFHuffEnc46[400][2]; -extern const uint32_t c_aauiCQMFHuffDec46[61][16]; + extern const uint32_t c_aauiCQMFHuffDec46[61][16]; -extern const uint32_t c_aauiCQMFHuffEnc47[576][2]; + extern const uint32_t c_aauiCQMFHuffEnc47[576][2]; -extern const uint32_t c_aauiCQMFHuffDec47[87][16]; + extern const uint32_t c_aauiCQMFHuffDec47[87][16]; -extern const uint32_t c_aauiCQMFHuffEnc48[729][2]; + extern const uint32_t c_aauiCQMFHuffEnc48[729][2]; -extern const uint32_t c_aauiCQMFHuffDec48[110][16]; + extern const uint32_t c_aauiCQMFHuffDec48[110][16]; -extern const uint32_t c_aauiCQMFHuffEnc49[729][2]; + extern const uint32_t c_aauiCQMFHuffEnc49[729][2]; -extern const uint32_t c_aauiCQMFHuffDec49[113][16]; + extern const uint32_t c_aauiCQMFHuffDec49[113][16]; -extern const uint32_t c_aauiCQMFHuffEnc50[28][2]; + extern const uint32_t c_aauiCQMFHuffEnc50[28][2]; -extern const uint32_t c_aauiCQMFHuffDec50[6][16]; + extern const uint32_t c_aauiCQMFHuffDec50[6][16]; -extern const uint32_t c_aauiCQMFHuffEnc51[29][2]; + extern const uint32_t c_aauiCQMFHuffEnc51[29][2]; -extern const uint32_t c_aauiCQMFHuffDec51[6][16]; + extern const uint32_t c_aauiCQMFHuffDec51[6][16]; -extern const uint32_t c_aauiCQMFHuffEnc52[32][2]; + extern const uint32_t c_aauiCQMFHuffEnc52[32][2]; -extern const uint32_t c_aauiCQMFHuffDec52[7][16]; + extern const uint32_t c_aauiCQMFHuffDec52[7][16]; -extern const uint32_t c_aauiCQMFHuffEnc53[37][2]; + extern const uint32_t c_aauiCQMFHuffEnc53[37][2]; -extern const uint32_t c_aauiCQMFHuffDec53[9][16]; + extern const uint32_t c_aauiCQMFHuffDec53[9][16]; -extern const uint32_t c_aauiCQMFHuffEnc54[39][2]; + extern const uint32_t c_aauiCQMFHuffEnc54[39][2]; -extern const uint32_t c_aauiCQMFHuffDec54[9][16]; + extern const uint32_t c_aauiCQMFHuffDec54[9][16]; -extern const uint32_t c_aauiCQMFHuffEnc55[46][2]; + extern const uint32_t c_aauiCQMFHuffEnc55[46][2]; -extern const uint32_t c_aauiCQMFHuffDec55[10][16]; + extern const uint32_t c_aauiCQMFHuffDec55[10][16]; -extern const uint32_t c_aauiCQMFHuffEnc56[55][2]; + extern const uint32_t c_aauiCQMFHuffEnc56[55][2]; -extern const uint32_t c_aauiCQMFHuffDec56[12][16]; + extern const uint32_t c_aauiCQMFHuffDec56[12][16]; -extern const uint32_t c_aauiCQMFHuffEnc57[65][2]; + extern const uint32_t c_aauiCQMFHuffEnc57[65][2]; -extern const uint32_t c_aauiCQMFHuffDec57[14][16]; + extern const uint32_t c_aauiCQMFHuffDec57[14][16]; -extern const uint32_t c_aauiCQMFHuffEnc58[77][2]; + extern const uint32_t c_aauiCQMFHuffEnc58[77][2]; -extern const uint32_t c_aauiCQMFHuffDec58[17][16]; + extern const uint32_t c_aauiCQMFHuffDec58[17][16]; -extern const uint32_t c_aauiCQMFHuffEnc59[91][2]; + extern const uint32_t c_aauiCQMFHuffEnc59[91][2]; -extern const uint32_t c_aauiCQMFHuffDec59[20][16]; + extern const uint32_t c_aauiCQMFHuffDec59[20][16]; -extern const uint32_t c_aauiCQMFHuffEnc60[109][2]; + extern const uint32_t c_aauiCQMFHuffEnc60[109][2]; -extern const uint32_t c_aauiCQMFHuffDec60[24][16]; + extern const uint32_t c_aauiCQMFHuffDec60[24][16]; -extern const uint32_t c_aauiCQMFHuffEnc61[129][2]; + extern const uint32_t c_aauiCQMFHuffEnc61[129][2]; -extern const uint32_t c_aauiCQMFHuffDec61[33][16]; + extern const uint32_t c_aauiCQMFHuffDec61[33][16]; -extern const uint32_t c_aauiCQMFHuffEnc62[153][2]; + extern const uint32_t c_aauiCQMFHuffEnc62[153][2]; -extern const uint32_t c_aauiCQMFHuffDec62[41][16]; + extern const uint32_t c_aauiCQMFHuffDec62[41][16]; -extern const uint32_t c_aauiCQMFHuffEnc63[181][2]; + extern const uint32_t c_aauiCQMFHuffEnc63[181][2]; -extern const uint32_t c_aauiCQMFHuffDec63[39][16]; + extern const uint32_t c_aauiCQMFHuffDec63[39][16]; -extern const uint32_t (*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2]; + extern const uint32_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2]; -extern const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE]; + extern const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE]; #ifdef USE_DEMOD_TABLES -extern const int32_t c_aaiHuffDemod1[16][2]; + extern const int32_t c_aaiHuffDemod1[16][2]; -extern const int32_t c_aaiHuffDemod2[16][2]; + extern const int32_t c_aaiHuffDemod2[16][2]; -extern const int32_t c_aaiHuffDemod3[25][2]; + extern const int32_t c_aaiHuffDemod3[25][2]; -extern const int32_t c_aaiHuffDemod4[36][2]; + extern const int32_t c_aaiHuffDemod4[36][2]; -extern const int32_t c_aaiHuffDemod5[36][2]; + extern const int32_t c_aaiHuffDemod5[36][2]; -extern const int32_t c_aaiHuffDemod6[49][2]; + extern const int32_t c_aaiHuffDemod6[49][2]; -extern const int32_t c_aaiHuffDemod7[64][2]; + extern const int32_t c_aaiHuffDemod7[64][2]; -extern const int32_t c_aaiHuffDemod8[81][2]; + extern const int32_t c_aaiHuffDemod8[81][2]; -extern const int32_t c_aaiHuffDemod9[100][2]; + extern const int32_t c_aaiHuffDemod9[100][2]; -extern const int32_t c_aaiHuffDemod10[169][2]; + extern const int32_t c_aaiHuffDemod10[169][2]; -extern const int32_t c_aaiHuffDemod11[196][2]; + extern const int32_t c_aaiHuffDemod11[196][2]; -extern const int32_t c_aaiHuffDemod12[289][2]; + extern const int32_t c_aaiHuffDemod12[289][2]; -extern const int32_t c_aaiHuffDemod13[324][2]; + extern const int32_t c_aaiHuffDemod13[324][2]; -extern const int32_t c_aaiHuffDemod14[400][2]; + extern const int32_t c_aaiHuffDemod14[400][2]; -extern const int32_t c_aaiHuffDemod15[576][2]; + extern const int32_t c_aaiHuffDemod15[576][2]; -extern const int32_t c_aaiHuffDemod16[729][2]; + extern const int32_t c_aaiHuffDemod16[729][2]; -extern const int32_t c_aaiHuffDemod17[729][2]; + extern const int32_t c_aaiHuffDemod17[729][2]; -extern const int32_t (*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2]; + extern const int32_t ( *c_apaiDemodTables[ALLOC_TABLE_SIZE] )[2]; #endif #ifdef __cplusplus diff --git a/lib_rend/ivas_MSPred.c b/lib_rend/ivas_MSPred.c index 4cecace732..3694f07510 100644 --- a/lib_rend/ivas_MSPred.c +++ b/lib_rend/ivas_MSPred.c @@ -357,4 +357,4 @@ void writeMSPred( int32_t *phaseQuant, int32_t *predQuant, int32_t MSMode, int32 } fprintf( fid, "\n" ); } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_NoiseGen.c b/lib_rend/ivas_NoiseGen.c index 39d8b9c177..44a794b69a 100644 --- a/lib_rend/ivas_NoiseGen.c +++ b/lib_rend/ivas_NoiseGen.c @@ -82,4 +82,4 @@ void DeleteNoiseGen( NoiseGen *psNoiseGen ) } extern float GetNoise( NoiseGen *psNoiseGen ); -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_PerceptualModel.c b/lib_rend/ivas_PerceptualModel.c index efa63b4247..67adf974a0 100644 --- a/lib_rend/ivas_PerceptualModel.c +++ b/lib_rend/ivas_PerceptualModel.c @@ -315,4 +315,4 @@ void PerceptualModelStereo( const int32_t iMaxQuantBands, piSMR1[n] = PERCEPTUAL_MODEL_SCALE * piRMSEnvelope1[n] + c_aiBandwidthAdjust48[n] - piSMR1[n]; } } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h index 2d3346183f..da8afca756 100644 --- a/lib_rend/ivas_PerceptualModel.h +++ b/lib_rend/ivas_PerceptualModel.h @@ -38,19 +38,19 @@ extern "C" { #endif #include -void PerceptualModel(const int32_t iMaxQuantBands, - const int32_t *piRMSEnvelope, - int32_t *piExcitation, - int32_t *piSMR); - -void PerceptualModelStereo(const int32_t iMaxQuantBands, - const int32_t *piMSFlags, - const int32_t *piRMSEnvelope0, - const int32_t *piRMSEnvelope1, - int32_t *piExcitation0, - int32_t *piExcitation1, - int32_t *piSMR0, - int32_t *piSMR1); + void PerceptualModel( const int32_t iMaxQuantBands, + const int32_t *piRMSEnvelope, + int32_t *piExcitation, + int32_t *piSMR ); + + void PerceptualModelStereo( const int32_t iMaxQuantBands, + const int32_t *piMSFlags, + const int32_t *piRMSEnvelope0, + const int32_t *piRMSEnvelope1, + int32_t *piExcitation0, + int32_t *piExcitation1, + int32_t *piSMR0, + int32_t *piSMR1 ); #ifdef __cplusplus } diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index aa15db6509..3bab1b9056 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -259,4 +259,4 @@ void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder, } } } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index 1dd0725466..56bbca0f73 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -476,4 +476,4 @@ int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, return iBitsWritten; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_PredTables.h b/lib_rend/ivas_PredTables.h index ee9caf425a..71bdf21437 100644 --- a/lib_rend/ivas_PredTables.h +++ b/lib_rend/ivas_PredTables.h @@ -39,12 +39,12 @@ extern "C" #endif -#define PRED_QUNAT_FILTER_MAG_BITS (3) -#define PRED_QUANT_FILTER_PHASE_BITS (5) -#define PRED_QUANT_FILTER_MAG_MIN (0) -#define PRED_QUANT_FILTER_MAG_MAX (7) -#define PRED_QUANT_FILTER_PHASE_MIN (-16) -#define PRED_QUANT_FILTER_PHASE_MAX (15) +#define PRED_QUNAT_FILTER_MAG_BITS ( 3 ) +#define PRED_QUANT_FILTER_PHASE_BITS ( 5 ) +#define PRED_QUANT_FILTER_MAG_MIN ( 0 ) +#define PRED_QUANT_FILTER_MAG_MAX ( 7 ) +#define PRED_QUANT_FILTER_PHASE_MIN ( -16 ) +#define PRED_QUANT_FILTER_PHASE_MAX ( 15 ) #ifdef __cplusplus } diff --git a/lib_rend/ivas_RMSEnvDeltaHuff.c b/lib_rend/ivas_RMSEnvDeltaHuff.c index ac746d5382..0f613a8f47 100644 --- a/lib_rend/ivas_RMSEnvDeltaHuff.c +++ b/lib_rend/ivas_RMSEnvDeltaHuff.c @@ -63,4 +63,4 @@ const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = {0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, }, {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, }; -/* clang-format on */ \ No newline at end of file +/* clang-format on */ diff --git a/lib_rend/ivas_RMSEnvDeltaHuff.h b/lib_rend/ivas_RMSEnvDeltaHuff.h index 13120d100e..25d2fc625e 100644 --- a/lib_rend/ivas_RMSEnvDeltaHuff.h +++ b/lib_rend/ivas_RMSEnvDeltaHuff.h @@ -39,16 +39,16 @@ extern "C" #endif #ifndef HUFF_READ_SIZE -#define HUFF_READ_SIZE (4) +#define HUFF_READ_SIZE ( 4 ) #endif #ifndef HUFF_DEC_TABLE_SIZE -#define HUFF_DEC_TABLE_SIZE (16) +#define HUFF_DEC_TABLE_SIZE ( 16 ) #endif #include -extern const uint32_t c_aaiRMSEnvHuffEnc[64][2]; + extern const uint32_t c_aaiRMSEnvHuffEnc[64][2]; -extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; + extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; #ifdef __cplusplus } diff --git a/lib_rend/ivas_cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_codec_bitstream.c index d12cb39d61..7e8950ab28 100644 --- a/lib_rend/ivas_cldfb_codec_bitstream.c +++ b/lib_rend/ivas_cldfb_codec_bitstream.c @@ -37,7 +37,6 @@ #include "prot.h" #include "wmc_auto.h" - #define MAX_BUFFER 1024 static const uint32_t MASKS[] = { @@ -305,4 +304,4 @@ int32_t BSGetError( Bitstream *psBitstream ) { return psBitstream->iError; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_splitRendererPLC.c b/lib_rend/ivas_splitRendererPLC.c index 76e14be4f5..eafc5617dd 100644 --- a/lib_rend/ivas_splitRendererPLC.c +++ b/lib_rend/ivas_splitRendererPLC.c @@ -489,4 +489,4 @@ void ivas_splitBinRendPLC( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 88345ad673..3b22d644ce 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1849,4 +1849,4 @@ void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapp #endif return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index b4b303600d..f498128c91 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1814,4 +1814,4 @@ ivas_error ivas_renderMultiBinToSplitBinaural( } return error; } -#endif \ No newline at end of file +#endif diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 3851d83718..2c1fe4e3b8 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -54,7 +54,7 @@ struct SplitRendBFIFileReader *-----------------------------------------------------------------------*/ ivas_error SplitRendBFIFileReader_open( - char *bfiFilePath, /* i : frame loss file name */ + char *bfiFilePath, /* i : frame loss file name */ SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */ ) { @@ -99,16 +99,15 @@ ivas_error SplitRendBFIFileReader_open( ivas_error SplitRendBFIFileReading( SplitRendBFIFileReader *SplitRendBFIReader, /* i/o: SplitRendBFIFileReader handle */ - int16_t *bfi -) + int16_t *bfi ) { - if ( SplitRendBFIReader->txtfile ? 1 != fscanf( SplitRendBFIReader->bfiFile, "%hd", bfi ) : 1 != fread(bfi,sizeof(*bfi),1,SplitRendBFIReader->bfiFile)) + if ( SplitRendBFIReader->txtfile ? 1 != fscanf( SplitRendBFIReader->bfiFile, "%hd", bfi ) : 1 != fread( bfi, sizeof( *bfi ), 1, SplitRendBFIReader->bfiFile ) ) { if ( feof( SplitRendBFIReader->bfiFile ) ) { rewind( SplitRendBFIReader->bfiFile ); SplitRendBFIReader->fileRewind = true; - return SplitRendBFIFileReading( SplitRendBFIReader, bfi); + return SplitRendBFIFileReading( SplitRendBFIReader, bfi ); } return IVAS_ERR_FAILED_FILE_PARSE; } diff --git a/lib_util/split_rend_bfi_file_reader.h b/lib_util/split_rend_bfi_file_reader.h index 655c4fe800..97df1c7fbb 100644 --- a/lib_util/split_rend_bfi_file_reader.h +++ b/lib_util/split_rend_bfi_file_reader.h @@ -40,14 +40,13 @@ typedef struct SplitRendBFIFileReader SplitRendBFIFileReader; ivas_error SplitRendBFIFileReader_open( - char *trajFilePath, /* i : head rotation trajectory file name */ + char *trajFilePath, /* i : head rotation trajectory file name */ SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */ ); ivas_error SplitRendBFIFileReading( SplitRendBFIFileReader *SplitRendBFIReader, /* i/o: SplitRendBFIFileReader handle */ - int16_t *bfi -); + int16_t *bfi ); void SplitRendBFIFileReader_close( SplitRendBFIFileReader **SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */ -- GitLab From 437a016d83351f4fce6d037ad8e7deef00e648bf Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 2 May 2023 08:37:32 +0200 Subject: [PATCH 113/591] bugfix: ISM extended metadata -related variables need to be initialized also in OMASA --- lib_dec/ivas_init_dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 560618b552..a1360fc985 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1051,6 +1051,9 @@ ivas_error ivas_init_decoder( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { return error; -- GitLab From 0badcc3496b8ab6e949efd09885ed69fcba25026 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 2 May 2023 10:23:18 +0200 Subject: [PATCH 114/591] fix global-buffer-overflow --- lib_dec/ivas_omasa_dec.c | 2 +- lib_enc/ivas_omasa_enc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 4fe74fd841..a5ba2d6ddf 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -202,7 +202,7 @@ ivas_error ivas_omasa_dec_config( ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; } - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, st_ivas->nSCE > 0 ? sep_object_brate[k - 2][st_ivas->nSCE - 1] : 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 8c6cd7038c..fc479d3f0b 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -245,7 +245,7 @@ ivas_error ivas_omasa_enc_config( } /* reconfigure core-coders for ISMs */ - if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, 1, 2, sep_object_brate[k - 2][st_ivas->nSCE - 1], ivas_total_brate - ism_total_brate, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, 1, 2, st_ivas->nSCE > 0 ? sep_object_brate[k - 2][st_ivas->nSCE - 1] : 0, ivas_total_brate - ism_total_brate, MC_MODE_NONE ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 2f12af7b0113d53e2116a0f5201372f556db34c3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 2 May 2023 10:56:35 +0200 Subject: [PATCH 115/591] update OMASA for FIX_417_TD_DECORR_BRATE_SW (fixes crash for BR switching) --- lib_dec/ivas_masa_dec.c | 43 ++++++++++++++++++++++++---------------- lib_dec/ivas_omasa_dec.c | 11 ++++++++++ 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a8fa913024..57dfa13fd5 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1427,31 +1427,40 @@ ivas_error ivas_masa_dec_reconfigure( } } +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) + { +#endif + #ifdef FIX_417_TD_DECORR_BRATE_SW - /*-----------------------------------------------------------------* - * TD Decorrelator - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ - if ( st_ivas->hDiracDecBin != NULL ) - { - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + if ( st_ivas->hDiracDecBin != NULL ) + { + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { return error; } - } - /*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * Set-up MASA coding elements and bitrates + *-----------------------------------------------------------------*/ +#endif - if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) - { - return error; +#ifdef MASA_AND_OBJECTS } - - /*-----------------------------------------------------------------* - * Set-up MASA coding elements and bitrates - *-----------------------------------------------------------------*/ #endif #ifdef MASA_AND_OBJECTS diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index a5ba2d6ddf..a6bd23db3f 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -238,6 +238,17 @@ ivas_error ivas_omasa_dec_config( ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); +#ifdef FIX_417_TD_DECORR_BRATE_SW + /* TD Decorrelator */ + if ( st_ivas->hDiracDecBin != NULL ) + { + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + /* CLDFB instances */ if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { -- GitLab From e032fd5c6424b01d67dd4ecbfcb4c20f43b17210 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 2 May 2023 11:41:11 +0200 Subject: [PATCH 116/591] fix memory leaks in bitrate switching --- lib_dec/ivas_masa_dec.c | 2 +- lib_dec/ivas_omasa_dec.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 57dfa13fd5..810bd7bc09 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1428,7 +1428,7 @@ ivas_error ivas_masa_dec_reconfigure( } #ifdef MASA_AND_OBJECTS - if ( st_ivas->ivas_format != MASA_ISM_FORMAT ) + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching within OMASA is handled in ivas_omasa_dec_config() */ { #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index a6bd23db3f..b89ce05019 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -136,6 +136,7 @@ ivas_error ivas_omasa_dec_config( int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; int32_t ivas_total_brate, ism_total_brate, cpe_brate; ISM_MODE ism_mode_old; + IVAS_FORMAT ivas_format_orig; ivas_error error; /* initializations */ @@ -146,7 +147,11 @@ ivas_error ivas_omasa_dec_config( ism_mode_old = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism ); st_ivas->ism_mode = ism_mode_old; + ivas_format_orig = st_ivas->ivas_format; + st_ivas->ivas_format = st_ivas->last_ivas_format; ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + st_ivas->ivas_format = ivas_format_orig; + nSCE_old = st_ivas->nSCE; nchan_hp20_old = getNumChanSynthesis( st_ivas ); -- GitLab From ecd7c7884a3ec8c931ee255644217004a458d472 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 3 May 2023 11:32:03 +1000 Subject: [PATCH 117/591] renderer static memory optimization --- lib_com/options.h | 3 + lib_rend/lib_rend.c | 227 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 212 insertions(+), 18 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a27d4ddace..c93d72823d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -201,6 +201,9 @@ #define OPTIMIZE_DPCM_QUANT #define SPLIT_REND_PLC /*CLDFB CODEC SWITCHES -- END*/ + +#define REND_STATIC_MEM_OPT + #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5376b18126..7ec283f674 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -115,7 +115,9 @@ typedef struct IVAS_REND_AudioConfig inConfig; IVAS_REND_InputId id; IVAS_REND_AudioBuffer inputBuffer; +#ifndef REND_STATIC_MEM_OPT float bufferData[MAX_BUFFER_LENGTH]; +#endif float gain; /* Linear, not in dB */ rendering_context ctx; int32_t numNewSamplesPerChannel; /* Used to keep track how much new audio was fed before rendering current frame */ @@ -130,6 +132,9 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; +#ifdef REND_STATIC_MEM_OPT + float *bufferData; +#endif } input_ism; typedef struct @@ -157,6 +162,9 @@ typedef struct REVERB_HANDLE hReverb; rotation_gains rot_gains_prev; lfe_routing lfeRouting; +#ifdef REND_STATIC_MEM_OPT + float *bufferData; +#endif } input_mc; typedef struct @@ -173,6 +181,10 @@ typedef struct #else rotation_gains rot_gains_prev; #endif + +#ifdef REND_STATIC_MEM_OPT + float *bufferData; +#endif } input_sba; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -180,6 +192,9 @@ typedef struct { input_base base; SPLIT_POST_REND_WRAPPER splitPostRendWrapper; +#ifdef REND_STATIC_MEM_OPT + float *bufferData; +#endif } input_split_post_rend; #endif @@ -193,6 +208,9 @@ typedef struct DecoderDummy *decDummy; MASA_METADATA_FRAME masaMetadata; bool metadataHasBeenFed; +#ifdef REND_STATIC_MEM_OPT + float *bufferData; +#endif } input_masa; struct IVAS_REND @@ -231,6 +249,30 @@ struct IVAS_REND * Local functions *-------------------------------------------------------------------*/ +#ifdef REND_STATIC_MEM_OPT +static ivas_error allocateInputBaseBufferData( float **data, const int16_t data_size ) +{ + *data = (float *) malloc( data_size * sizeof( float ) ); + if ( *data == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for input base buffer data" ); + } + + return IVAS_ERR_OK; +} + +static void freeInputBaseBufferData( float **data ) +{ + if ( *data != NULL ) + { + free( *data ); + *data = NULL; + } + + return; +} +#endif + static IVAS_QUATERNION quaternionInit( void ) { @@ -1134,7 +1176,13 @@ static void initRendInputBase( input_base *inputBase, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_InputId id, - const rendering_context rendCtx ) + const rendering_context rendCtx +#ifdef REND_STATIC_MEM_OPT + , + float *dataBuf, + const int16_t dataBufSize +#endif +) { inputBase->inConfig = inConfig; inputBase->id = id; @@ -1144,10 +1192,17 @@ static void initRendInputBase( inputBase->inputBuffer.config.numSamplesPerChannel = 0; inputBase->inputBuffer.config.numChannels = 0; +#ifndef REND_STATIC_MEM_OPT inputBase->inputBuffer.data = inputBase->bufferData; set_zero( inputBase->bufferData, MAX_BUFFER_LENGTH ); - +#else + inputBase->inputBuffer.data = dataBuf; + if ( inputBase->inputBuffer.data != NULL ) + { + set_zero( inputBase->inputBuffer.data, dataBufSize ); + } +#endif return; } @@ -1255,7 +1310,18 @@ static ivas_error setRendInputActiveIsm( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - initRendInputBase( &inputIsm->base, inConfig, id, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + if ( ( error = allocateInputBaseBufferData( &inputIsm->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + initRendInputBase( &inputIsm->base, inConfig, id, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + inputIsm->bufferData, MAX_BUFFER_LENGTH +#endif + ); inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); @@ -1311,7 +1377,15 @@ static void clearInputIsm( rendCtx = inputIsm->base.ctx; - initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + freeInputBaseBufferData( &inputIsm->base.inputBuffer.data ); +#endif + initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); /* Free input's internal handles */ @@ -2114,7 +2188,18 @@ static ivas_error setRendInputActiveMc( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - initRendInputBase( &inputMc->base, inConfig, id, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + initRendInputBase( &inputMc->base, inConfig, id, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + inputMc->bufferData, MAX_BUFFER_LENGTH +#endif + ); setZeroPanMatrix( inputMc->panGains ); inputMc->customLsInput = defaultCustomLs(); inputMc->tdRendWrapper = defaultTdRendWrapper(); @@ -2146,7 +2231,15 @@ static void clearInputMc( rendCtx = inputMc->base.ctx; - initRendInputBase( &inputMc->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + freeInputBaseBufferData( &inputMc->bufferData ); +#endif + initRendInputBase( &inputMc->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); /* Free input's internal handles */ if ( inputMc->efapInWrapper.hEfap != NULL ) @@ -2445,7 +2538,18 @@ static ivas_error setRendInputActiveSplitPostRend( rendCtx = inputSplitPostRend->base.ctx; outConfig = *rendCtx.pOutConfig; - initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH +#endif + ); if ( ( error = updateSplitPostRendPanGains( inputSplitPostRend, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { @@ -2479,7 +2583,18 @@ static ivas_error setRendInputActiveSba( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + initRendInputBase( &inputSba->base, inConfig, id, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + inputSba->bufferData, MAX_BUFFER_LENGTH +#endif + ); setZeroPanMatrix( inputSba->hoaDecMtx ); #ifdef SPLIT_REND_WITH_HEAD_ROT inputSba->crendWrapper = NULL; @@ -2504,10 +2619,19 @@ static ivas_error setRendInputActiveSba( static void clearInputSplitRend( input_split_post_rend *inputSplitRend ) { - // rendering_context rendCtx; + rendering_context rendCtx; - // rendCtx = inputSplitRend->base.ctx; + rendCtx = inputSplitRend->base.ctx; +#ifdef REND_STATIC_MEM_OPT + freeInputBaseBufferData( &inputSplitRend->bufferData ); +#endif + initRendInputBase( &inputSplitRend->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); if ( inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend != NULL ) { ivas_splitBinPostRendClose( &inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend ); @@ -2528,7 +2652,15 @@ static void clearInputSba( rendCtx = inputSba->base.ctx; - initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + freeInputBaseBufferData( &inputSba->bufferData ); +#endif + initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); /* Free input's internal handles */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2895,7 +3027,18 @@ static ivas_error setRendInputActiveMasa( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - initRendInputBase( &inputMasa->base, inConfig, id, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + if ( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + initRendInputBase( &inputMasa->base, inConfig, id, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + inputMasa->bufferData, MAX_BUFFER_LENGTH +#endif + ); if ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) { @@ -2988,7 +3131,15 @@ static void clearInputMasa( rendCtx = inputMasa->base.ctx; - initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); +#ifdef REND_STATIC_MEM_OPT + freeInputBaseBufferData( &inputMasa->bufferData ); +#endif + initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); freeDecoderDummy( &inputMasa->decDummy ); return; @@ -3063,37 +3214,69 @@ ivas_error IVAS_REND_Open( /* Initialize inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); + initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; +#ifdef REND_STATIC_MEM_OPT + hIvasRend->inputsIsm[i].bufferData = NULL; +#endif } for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); + initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; hIvasRend->inputsMc[i].hReverb = NULL; hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; +#ifdef REND_STATIC_MEM_OPT + hIvasRend->inputsMc[i].bufferData = NULL; +#endif } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); + initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); hIvasRend->inputsSba[i].crendWrapper = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; hIvasRend->inputsSba[i].cldfbRendWrapper.hHrtfFastConv = NULL; ivas_init_split_rend_handles( &hIvasRend->inputsSba[i].splitRendWrapper ); +#endif +#ifdef REND_STATIC_MEM_OPT + hIvasRend->inputsSba[i].bufferData = NULL; #endif } for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); + initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); hIvasRend->inputsMasa[i].decDummy = NULL; hIvasRend->inputsMasa[i].metadataHasBeenFed = false; +#ifdef REND_STATIC_MEM_OPT + hIvasRend->inputsMasa[i].bufferData = NULL; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) @@ -3101,10 +3284,18 @@ ivas_error IVAS_REND_Open( initRendInputBase( &hIvasRend->inputsSplitPost[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, - getRendCtx( hIvasRend ) ); + getRendCtx( hIvasRend ) +#ifdef REND_STATIC_MEM_OPT + , + NULL, 0 +#endif + ); ivas_init_split_post_rend_handles( &hIvasRend->inputsSplitPost[i].splitPostRendWrapper ); #ifdef SPLIT_REND_PLC hIvasRend->splitRendBFI = 0; +#endif +#ifdef REND_STATIC_MEM_OPT + hIvasRend->inputsSplitPost[i].bufferData = NULL; #endif } #endif -- GitLab From 0d0f0325ff4db419d22965596ed57a4d32321368 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 3 May 2023 15:17:44 +1000 Subject: [PATCH 118/591] euler to quat fix --- lib_com/options.h | 1 + lib_rend/ivas_rotation.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c93d72823d..ed3b91621d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -203,6 +203,7 @@ /*CLDFB CODEC SWITCHES -- END*/ #define REND_STATIC_MEM_OPT +#define EUALER2QUAT_FIX #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 2f3c3cee3e..80e7d5c23e 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -192,7 +192,6 @@ void QuatToRotMat( * * Calculate corresponding Quaternion from Euler angles in radians *------------------------------------------------------------------------*/ - void Euler2Quat( const float yaw, /* i : yaw (x) */ const float pitch, /* i : pitch (y) */ @@ -203,14 +202,24 @@ void Euler2Quat( float cr = cosf( roll * 0.5f ); float sr = sinf( roll * 0.5f ); float cp = cosf( pitch * 0.5f ); +#ifdef EUALER2QUAT_FIX + float sp = sinf( pitch * 0.5f ); +#else float sp = sinf( -pitch * 0.5f ); +#endif float cy = cosf( yaw * 0.5f ); float sy = sinf( yaw * 0.5f ); - +#ifdef EUALER2QUAT_FIX + quat->w = cr * cp * cy + sr * sp * sy; + quat->x = sr * cp * cy - cr * sp * sy; + quat->y = sr * cp * sy + cr * sp * cy; + quat->z = cr * cp * sy - sr * sp * cy; +#else quat->w = cr * cp * cy - sr * sp * sy; quat->x = sr * cp * cy + cr * sp * sy; quat->y = cr * sp * cy - sr * cp * sy; quat->z = cr * cp * sy + sr * sp * cy; +#endif return; } @@ -231,8 +240,17 @@ void Quat2EulerDegree( { if ( quat.w != -3.0 ) { +#ifdef EUALER2QUAT_FIX + float p; +#endif *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); +#ifdef EUALER2QUAT_FIX + p = 2 * ( quat.w * quat.y - quat.z * quat.x ); + p = max( -1.0f, min( 1.0f, p ) ); + *pitch = asinf( p ); +#else *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); +#endif *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); *yaw *= _180_OVER_PI; *pitch *= _180_OVER_PI; -- GitLab From 8a3be442bc6489a3c727df3f0e96ecd733035b33 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Wed, 3 May 2023 16:00:49 +0530 Subject: [PATCH 119/591] ROM to RAM conversion --- lib_com/options.h | 2 + lib_rend/ivas_CQMFDecoder.c | 314 +++++++++++++++++++++++++++++++++++- lib_rend/ivas_CQMFHuff.c | 191 +++++++++++++++------- lib_rend/ivas_CQMFHuff.h | 131 ++++++++++++++- lib_rend/ivas_Tables.h | 4 +- 5 files changed, 579 insertions(+), 63 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ed3b91621d..488c81999d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -205,6 +205,8 @@ #define REND_STATIC_MEM_OPT #define EUALER2QUAT_FIX +#define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ + #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index c2980fa6c3..16e6afc614 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -57,6 +57,23 @@ Nations Convention on Contracts on the International Sales of Goods. #include "ivas_prot_rend.h" #include "wmc_auto.h" +#ifdef ROM_TO_RAM +typedef struct TableNode +{ + struct TableNode **ppoNextTable; + struct TableNode *poOrderedNext; + + int32_t *piCodeIndex; + int32_t *piDifference; + int32_t *piLength; +} TableNode; +typedef struct TableList +{ + TableNode *poOrderedTop; + TableNode *poOrderedBottom; + +} TableList; +#endif struct CQMF_DECODER { int32_t iSampleRate; @@ -68,6 +85,11 @@ struct CQMF_DECODER int32_t iMSMode; int32_t *piMSFlags; +#ifdef ROM_TO_RAM + TableList *ptable_list; + uint32_t ( *c_apauiHuffDecTable_RAM[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE]; + uint32_t num_decode_table[2 * ALLOC_TABLE_SIZE]; +#endif #ifdef ENABLE_MS_PRED int32_t piMSPredCoefs[MAX_BANDS]; int32_t piLRPhaseDiffs[MAX_BANDS]; @@ -99,11 +121,250 @@ struct CQMF_DECODER int32_t iLastError; }; +#ifdef ROM_TO_RAM +static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ); +static TableNode *CreateTableList( int32_t iReadLength ); +static void DeleteTableList( TableList *ptable_list, int32_t iReadLength, int32_t iTables ); +static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode *poParent, int32_t iReadLength, uint32_t *iTablesCreated ); +static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t iCode, int32_t iCodeIndex, int32_t iReadLength, uint32_t *iTables ); +static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated ); + +static TableNode *CreateTableList( int32_t iReadLength ) +{ + int32_t n; + int32_t iMaxTables; + TableNode *ptable_top; + iMaxTables = 1 << iReadLength; + ptable_top = (TableNode *) malloc( sizeof( TableNode ) ); + ptable_top->ppoNextTable = + (TableNode **) malloc( iMaxTables * sizeof( TableNode * ) ); + ptable_top->piCodeIndex = (int32_t *) malloc( iMaxTables * sizeof( int32_t ) ); + ptable_top->piDifference = (int32_t *) malloc( iMaxTables * sizeof( int32_t ) ); + ptable_top->piLength = (int32_t *) malloc( iMaxTables * sizeof( int32_t ) ); + for ( n = 0; n < iMaxTables; n++ ) + { + ptable_top->ppoNextTable[n] = NULL; + ptable_top->piCodeIndex[n] = 0xffff; + ptable_top->piDifference[n] = 0; + ptable_top->piLength[n] = 0; + } + + return ptable_top; +} +static void DeleteTableList( TableList *ptable_list, int32_t iReadLength, int32_t iTables ) +{ + + TableNode *node; + int32_t iMaxTables; + node = ptable_list->poOrderedTop; + + + iMaxTables = 1 << iReadLength; + while ( ( iTables ) ) + { + + TableNode *node1 = node; + node = node1->poOrderedNext; + if ( node1->piCodeIndex != NULL ) + { + free( node1->piCodeIndex ); + } + if ( node1->piLength != NULL ) + { + free( node1->piLength ); + } + if ( node1->piDifference != NULL ) + { + free( node1->piDifference ); + } + if ( node1->ppoNextTable != NULL ) + { + free( node1->ppoNextTable ); + } + if ( node1 != NULL ) + { + free( node1 ); + } + iTables--; + } + if ( ptable_list != NULL ) + { + free( ptable_list ); + } +} +static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode *poParent, int32_t iReadLength, uint32_t *iTablesCreated ) +{ + TableNode *poNextNode; + + if ( poParent->ppoNextTable[iIndex] == NULL ) + { + poNextNode = CreateTableList( iReadLength ); + poParent->ppoNextTable[iIndex] = poNextNode; + poParent->piDifference[iIndex] = + *iTablesCreated; // this is a link to the next table rather than the + // difference + table_list->poOrderedBottom->poOrderedNext = poNextNode; + table_list->poOrderedBottom = poNextNode; + + ( *iTablesCreated )++; + } + else + { + poNextNode = poParent->ppoNextTable[iIndex]; + } + + return poNextNode; +} +static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated ) +{ + + int32_t iMaxTables; + int32_t j; + TableNode *poNode; + + iMaxTables = 1 << iReadLength; + psCQMFDecoder->c_apauiHuffDecTable_RAM[n] = + malloc( iTablesCreated * iMaxTables * sizeof( uint32_t * ) ); + + poNode = ptable_list->poOrderedTop; + for ( j = 0; j < iTablesCreated; j++ ) + { + int32_t k; + if ( poNode != NULL ) + { + for ( k = 0; k < iMaxTables; k++ ) + { + uint32_t uiCode; + uiCode = poNode->piDifference[k]; + uiCode <<= 16; + uiCode |= poNode->piCodeIndex[k]; + psCQMFDecoder->c_apauiHuffDecTable_RAM[n][j][k] = uiCode; + } + } + poNode = poNode->poOrderedNext; + } +} +static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t iCode, int32_t iCodeIndex, int32_t iReadLength, uint32_t *iTables ) +{ + int32_t iDifference; + int32_t iMask; + int32_t iCurrentLength; + int32_t iIndex; + int32_t iCodeLow; + int32_t iCodeHigh; + + TableNode *poNode; + poNode = ptable_list->poOrderedTop; + iMask = ( 1 << iReadLength ) - 1; + iCurrentLength = iLength; + while ( iCurrentLength > iReadLength ) + { + iDifference = iCurrentLength - iReadLength; + iIndex = iCode >> iDifference; + iIndex &= iMask; + poNode = GetNextTable( iIndex, ptable_list, poNode, iReadLength, iTables ); + iCurrentLength -= iReadLength; + } + + iMask = ( 1 << iCurrentLength ) - 1; + iDifference = iReadLength - iCurrentLength; + iCodeLow = ( iCode & iMask ) << iDifference; + iMask = ( 1 << iDifference ) - 1; + iCodeHigh = iCodeLow | iMask; + for ( iIndex = iCodeLow; iIndex <= iCodeHigh; iIndex++ ) + { + poNode->piCodeIndex[iIndex] = iCodeIndex; + poNode->piDifference[iIndex] = iDifference; + poNode->piLength[iIndex] = iLength; + } +} + +static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ) +{ + int32_t n; + int32_t iMaxTables; + uint32_t **ppsort_enc_table; + TableList *ptable_list; + ptable_list = (TableList *) malloc( sizeof( TableList ) ); + iMaxTables = 1 << iReadLength; + + ppsort_enc_table = (uint32_t **) malloc( iSize * sizeof( int32_t * ) ); + for ( n = 0; n < iSize; n++ ) + { + ppsort_enc_table[n] = (uint32_t *) malloc( 3 * sizeof( int32_t ) ); + ppsort_enc_table[n][0] = ppuiEncTable[n][0]; + ppsort_enc_table[n][1] = ppuiEncTable[n][1]; + ppsort_enc_table[n][2] = (uint32_t) n; + } + + for ( n = 0; n < iSize; n++ ) + { + uint32_t iMin; + int32_t iMinIndex; + int32_t k; + + iMin = ppsort_enc_table[n][0]; + iMinIndex = n; + for ( k = n; k < iSize; k++ ) + { + if ( ppsort_enc_table[k][0] < iMin ) + { + iMin = ppsort_enc_table[k][0]; + iMinIndex = k; + } + } + + if ( iMinIndex != n ) + { + uint32_t uiLength; + uint32_t uiCode; + uint32_t uiCodeIndex; + + uiLength = ppsort_enc_table[n][0]; + uiCode = ppsort_enc_table[n][1]; + uiCodeIndex = ppsort_enc_table[n][2]; + + ppsort_enc_table[n][0] = ppsort_enc_table[iMinIndex][0]; + ppsort_enc_table[n][1] = ppsort_enc_table[iMinIndex][1]; + ppsort_enc_table[n][2] = ppsort_enc_table[iMinIndex][2]; + + ppsort_enc_table[iMinIndex][0] = uiLength; + ppsort_enc_table[iMinIndex][1] = uiCode; + ppsort_enc_table[iMinIndex][2] = uiCodeIndex; + } + } + ptable_list->poOrderedTop = CreateTableList( iReadLength ); + ptable_list->poOrderedBottom = ptable_list->poOrderedTop; + for ( n = 0; n < iSize; n++ ) + { + int32_t iLength; + int32_t iCode; + int32_t iCodeIndex; + + iLength = ppsort_enc_table[n][0]; + iCode = ppsort_enc_table[n][1]; + iCodeIndex = ppsort_enc_table[n][2]; + AddcodeTableList( ptable_list, iLength, iCode, iCodeIndex, iReadLength, + iTables ); + } + + CompleteTables( psCQMFDecoder, num, ptable_list, iReadLength, *iTables ); + DeleteTableList( ptable_list, iReadLength, *iTables ); + for ( n = 0; n < iSize; n++ ) + { + free( ppsort_enc_table[n] ); + } + free( ppsort_enc_table ); +} +#endif CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate, const int32_t iChannels ) { int32_t n; +#ifdef ROM_TO_RAM + int32_t read_length; +#endif CQMFDecoder *psCQMFDecoder = NULL; assert( iSampleRate == 48000 ); // Fix @@ -203,7 +464,22 @@ CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate, (int32_t *) malloc( CQMF_BANDS * sizeof( int32_t ) ); } } +#ifdef ROM_TO_RAM + read_length = READ_LENGTH; + for ( n = 0; n < ALLOC_TABLE_SIZE * 2; n++ ) + { + psCQMFDecoder->num_decode_table[n] = 1; // initialising the value to 1 + if ( c_apauiHuffEncTabels[n] != NULL ) + { + CreateDecodeTable( psCQMFDecoder, n, c_apauiHuffEncTabels[n], num_row_aauiCQMFHuff[n], read_length, &psCQMFDecoder->num_decode_table[n] ); + } + else + { + psCQMFDecoder->c_apauiHuffDecTable_RAM[n] = NULL; + } + } +#endif psCQMFDecoder->psPredictionDecoder = CreatePredictionDecoder( iChannels, psCQMFDecoder->iNumBlocks ); // psCQMFDecoder->pReadBuff = @@ -377,6 +653,19 @@ void DeleteCQMFDecoder( CQMFDecoder *psCQMFDecoder ) //{ // free( psCQMFDecoder->pReadBuff ); // } +#ifdef ROM_TO_RAM + for ( uint32_t n = 0; n < ALLOC_TABLE_SIZE * 2; n++ ) + { + if ( psCQMFDecoder->num_decode_table[n] > 1 ) + { + + if ( psCQMFDecoder->c_apauiHuffDecTable_RAM[n] != NULL ) + { + free( psCQMFDecoder->c_apauiHuffDecTable_RAM[n] ); + } + } + } +#endif DeletePredictionDecoder( psCQMFDecoder->psPredictionDecoder ); @@ -445,9 +734,13 @@ static int32_t ReadRMSEnvelope( const int32_t iChannels, ivas_split_rend_bits_t *pBits ); static int32_t ReadAllocInformation( int32_t *piAllocOffset, ivas_split_rend_bits_t *pBits ); - +#ifdef ROM_TO_RAM +static int32_t +ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ); +#else static int32_t ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits ); +#endif static void ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, @@ -487,12 +780,14 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, psCQMFDecoder->iChannels, psCQMFDecoder->iNumBlocks, &psCQMFDecoder->iCommonGrouping, psCQMFDecoder->piNumGroups, psCQMFDecoder->ppiGroupLengths, - pBits ); + pBits + ); iBitsRead += ReadRMSEnvelope( psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups, psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope, - pBits ); + pBits + ); #ifdef ENABLE_PMOD_ADJUST iBitsRead += @@ -549,7 +844,12 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, psCQMFDecoder->pppiAlloc[n], psCQMFDecoder->pppiCQMFSignReal[n], psCQMFDecoder->pppiCQMFSignImag[n], psCQMFDecoder->pppiQCQMFReal[n], psCQMFDecoder->pppiQCQMFImag[n], - pBits ); + pBits +#ifdef ROM_TO_RAM + , + psCQMFDecoder->c_apauiHuffDecTable_RAM +#endif + ); } for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) @@ -1216,9 +1516,13 @@ static int32_t ReadAllocInformation( int32_t *piAllocOffset, return iBitsRead; } - +#ifdef ROM_TO_RAM +static int32_t +ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ) +#else static int32_t ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ivas_split_rend_bits_t *pBits ) +#endif { int32_t n; int32_t iBitsRead; diff --git a/lib_rend/ivas_CQMFHuff.c b/lib_rend/ivas_CQMFHuff.c index af4d4d11ee..a5344b9db1 100644 --- a/lib_rend/ivas_CQMFHuff.c +++ b/lib_rend/ivas_CQMFHuff.c @@ -43,12 +43,14 @@ const uint32_t c_aauiCQMFHuffEnc1[16][2] = {0x0006, 0x0001}, {0x0008, 0x0001}, {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec1[3][16] = { {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, {0x00010003, 0x00010003, 0x00010007, 0x00010007, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc2[16][2] = { @@ -56,12 +58,14 @@ const uint32_t c_aauiCQMFHuffEnc2[16][2] = {0x0006, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000b, 0x0003}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec2[3][16] = { {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, {0x00000003, 0x00000007, 0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0001000f, 0x0001000f, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc3[25][2] = { @@ -72,6 +76,7 @@ const uint32_t c_aauiCQMFHuffEnc3[25][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec3[10][16] = { {0x0001ffff, 0x00000006, 0x00010001, 0x00010001, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -85,7 +90,7 @@ const uint32_t c_aauiCQMFHuffDec3[10][16] = {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc4[36][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0010, 0x0000}, {0x0010, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, @@ -96,6 +101,7 @@ const uint32_t c_aauiCQMFHuffEnc4[36][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec4[5][16] = { {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -104,7 +110,7 @@ const uint32_t c_aauiCQMFHuffDec4[5][16] = {0x0000001f, 0x00000020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, {0x00000004, 0x00000005, 0x0000000a, 0x0000000b, 0x00000010, 0x00000011, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc5[36][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, @@ -115,6 +121,7 @@ const uint32_t c_aauiCQMFHuffEnc5[36][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec5[10][16] = { {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -128,7 +135,7 @@ const uint32_t c_aauiCQMFHuffDec5[10][16] = {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc6[49][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0003}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0002, 0x0001}, @@ -141,6 +148,7 @@ const uint32_t c_aauiCQMFHuffEnc6[49][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec6[7][16] = { {0x0001ffff, 0x00000008, 0x00010001, 0x00010001, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -151,7 +159,7 @@ const uint32_t c_aauiCQMFHuffDec6[7][16] = {0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00010024, 0x00010024, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, {0x00000005, 0x00000006, 0x0000000c, 0x0000000d, 0x00000013, 0x00000014, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000025, 0x00000026, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc7[64][2] = { {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0002}, {0x0015, 0x0000}, {0x0015, 0x0001}, {0x0015, 0x0002}, @@ -164,6 +172,7 @@ const uint32_t c_aauiCQMFHuffEnc7[64][2] = {0x0015, 0x001a}, {0x0015, 0x001b}, {0x0015, 0x001c}, {0x0015, 0x001d}, {0x0015, 0x001e}, {0x0015, 0x001f}, {0x0015, 0x0020}, {0x0015, 0x0021}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec7[25][16] = { {0x0001ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, @@ -192,6 +201,7 @@ const uint32_t c_aauiCQMFHuffDec7[25][16] = {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc8[81][2] = { @@ -209,6 +219,7 @@ const uint32_t c_aauiCQMFHuffEnc8[81][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec8[16][16] = { {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -228,6 +239,7 @@ const uint32_t c_aauiCQMFHuffDec8[16][16] = {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc9[100][2] = { @@ -247,6 +259,7 @@ const uint32_t c_aauiCQMFHuffEnc9[100][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec9[22][16] = { {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -272,6 +285,7 @@ const uint32_t c_aauiCQMFHuffDec9[22][16] = {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc10[169][2] = { @@ -300,6 +314,7 @@ const uint32_t c_aauiCQMFHuffEnc10[169][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec10[45][16] = { {0x0002ffff, 0x0001ffff, 0x00000001, 0x0000000d, 0x0000000f, 0x0000001b, 0x0001000e, 0x0001000e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -348,6 +363,7 @@ const uint32_t c_aauiCQMFHuffDec10[45][16] = {0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc11[196][2] = { @@ -379,6 +395,7 @@ const uint32_t c_aauiCQMFHuffEnc11[196][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec11[50][16] = { {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000001, 0x0000000e, 0x0000001d, 0x0001000f, 0x0001000f, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -432,6 +449,7 @@ const uint32_t c_aauiCQMFHuffDec11[50][16] = {0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200bd, }, {0x000200be, 0x000200be, 0x000200be, 0x000200be, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc12[289][2] = { @@ -475,6 +493,7 @@ const uint32_t c_aauiCQMFHuffEnc12[289][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec12[76][16] = { {0x0003ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x00000001, 0x00000011, 0x00000012, 0x00000023, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -554,7 +573,7 @@ const uint32_t c_aauiCQMFHuffDec12[76][16] = {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020118, 0x00020118, 0x00020118, 0x00020118, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x0002011a, 0x0002011a, 0x0002011a, 0x0002011a, }, {0x0002011b, 0x0002011b, 0x0002011b, 0x0002011b, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011e, 0x0002011e, 0x0002011e, 0x0002011e, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc13[324][2] = { {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0006, 0x0004}, {0x0008, 0x0005}, {0x000a, 0x0005}, {0x000c, 0x0007}, @@ -601,6 +620,7 @@ const uint32_t c_aauiCQMFHuffEnc13[324][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec13[89][16] = { {0x0006ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000001, 0x00000012, 0x00000014, 0x00000015, 0x00000025, 0x00000026, 0x00000037, 0x00010013, 0x00010013, }, @@ -693,7 +713,7 @@ const uint32_t c_aauiCQMFHuffDec13[89][16] = {0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, }, {0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc14[400][2] = { {0x0005, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0006}, {0x0007, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x0008}, @@ -748,6 +768,7 @@ const uint32_t c_aauiCQMFHuffEnc14[400][2] = {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec14[53][16] = { {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x00000001, 0x00000014, 0x00000015, 0x00000016, 0x00000029, 0x0000002a, 0x0000003d, }, @@ -804,7 +825,7 @@ const uint32_t c_aauiCQMFHuffDec14[53][16] = {0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, 0x0000017a, 0x0000017b, }, {0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc15[576][2] = { {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0007, 0x0008}, {0x0008, 0x0009}, {0x0009, 0x0008}, @@ -881,6 +902,7 @@ const uint32_t c_aauiCQMFHuffEnc15[576][2] = {0x0014, 0x0191}, {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0013, 0x00db}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec15[73][16] = { {0x000cffff, 0x000bffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x0002ffff, 0x0001ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000019, 0x0000001a, 0x00000031, 0x00000032, }, @@ -957,6 +979,7 @@ const uint32_t c_aauiCQMFHuffDec15[73][16] = {0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, 0x0000021e, 0x0000021f, 0x00000220, 0x00000221, 0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, }, {0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, 0x0000022e, 0x0000022f, 0x00000230, 0x00000231, 0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc16[729][2] = { @@ -1055,6 +1078,7 @@ const uint32_t c_aauiCQMFHuffEnc16[729][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec16[85][16] = { {0x000fffff, 0x000dffff, 0x000effff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0000001c, }, @@ -1143,6 +1167,7 @@ const uint32_t c_aauiCQMFHuffDec16[85][16] = {0x000002b2, 0x000002b3, 0x000002b4, 0x000002b5, 0x000002b6, 0x000002b7, 0x000002b8, 0x000002b9, 0x000002ba, 0x000002bb, 0x000002bc, 0x000002bd, 0x000002be, 0x000002bf, 0x000002c0, 0x000002c1, }, {0x000002c2, 0x000002c3, 0x000002c4, 0x000002c5, 0x000002c6, 0x000002c7, 0x000002c8, 0x000002c9, 0x000002ca, 0x000002cb, 0x000002cc, 0x000002cd, 0x000002ce, 0x000002cf, 0x000002d0, 0x000002d1, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc17[729][2] = { @@ -1241,6 +1266,7 @@ const uint32_t c_aauiCQMFHuffEnc17[729][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec17[93][16] = { {0x0010ffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0006ffff, 0x0005ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, }, @@ -1337,6 +1363,7 @@ const uint32_t c_aauiCQMFHuffDec17[93][16] = {0x0000028e, 0x0000028f, 0x00000290, 0x00000291, 0x00000292, 0x00000293, 0x00000294, 0x00000295, 0x00000296, 0x00000297, 0x00000298, 0x00000299, 0x0000029a, 0x0000029b, 0x0000029c, 0x0000029d, }, {0x0000029e, 0x0000029f, 0x000002a0, 0x000002a1, 0x000002a2, 0x000002a3, 0x000002a4, 0x000002a5, 0x000002a6, 0x000002a7, 0x000002a8, 0x000002a9, 0x000002aa, 0x000002ab, 0x000002ac, 0x000002ad, }, }; +#endif const uint32_t c_aauiCQMFHuffEnc18[28][2] = { @@ -1347,6 +1374,7 @@ const uint32_t c_aauiCQMFHuffEnc18[28][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec18[6][16] = { {0x0001ffff, 0x00000000, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, }, @@ -1356,7 +1384,7 @@ const uint32_t c_aauiCQMFHuffDec18[6][16] = {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc19[29][2] = { {0x0004, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, @@ -1366,6 +1394,7 @@ const uint32_t c_aauiCQMFHuffEnc19[29][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec19[6][16] = { {0x0001ffff, 0x0002ffff, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, }, @@ -1375,7 +1404,7 @@ const uint32_t c_aauiCQMFHuffDec19[6][16] = {0x0005ffff, 0x00000016, 0x00010015, 0x00010015, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc20[32][2] = { {0x0004, 0x0002}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, @@ -1384,6 +1413,7 @@ const uint32_t c_aauiCQMFHuffEnc20[32][2] = {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0011, 0x0001}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec20[6][16] = { {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, }, @@ -1393,7 +1423,7 @@ const uint32_t c_aauiCQMFHuffDec20[6][16] = {0x0005ffff, 0x00000019, 0x00010018, 0x00010018, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, {0x0000001b, 0x0000001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc21[37][2] = { {0x0005, 0x0002}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, @@ -1404,6 +1434,7 @@ const uint32_t c_aauiCQMFHuffEnc21[37][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec21[7][16] = { {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, @@ -1414,7 +1445,7 @@ const uint32_t c_aauiCQMFHuffDec21[7][16] = {0x0006ffff, 0x0000001e, 0x0001001d, 0x0001001d, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, {0x00000020, 0x00000021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc22[39][2] = { {0x0005, 0x0002}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, @@ -1425,6 +1456,7 @@ const uint32_t c_aauiCQMFHuffEnc22[39][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec22[9][16] = { {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, }, @@ -1437,7 +1469,7 @@ const uint32_t c_aauiCQMFHuffDec22[9][16] = {0x0008ffff, 0x00000025, 0x00010022, 0x00010022, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc23[46][2] = { {0x0005, 0x0003}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, @@ -1449,6 +1481,7 @@ const uint32_t c_aauiCQMFHuffEnc23[46][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec23[12][16] = { {0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, }, @@ -1464,7 +1497,7 @@ const uint32_t c_aauiCQMFHuffDec23[12][16] = {0x000bffff, 0x0000002a, 0x00010029, 0x00010029, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, {0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc24[55][2] = { {0x0005, 0x0004}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, @@ -1477,6 +1510,7 @@ const uint32_t c_aauiCQMFHuffEnc24[55][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec24[17][16] = { {0x0008ffff, 0x0009ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, }, @@ -1497,7 +1531,7 @@ const uint32_t c_aauiCQMFHuffDec24[17][16] = {0x0010ffff, 0x00000032, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, {0x00010034, 0x00010034, 0x00010036, 0x00010036, 0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc25[65][2] = { {0x0005, 0x0005}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x0006}, {0x0004, 0x000f}, {0x0005, 0x0007}, {0x0005, 0x0008}, @@ -1512,6 +1546,7 @@ const uint32_t c_aauiCQMFHuffEnc25[65][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec25[19][16] = { {0x000cffff, 0x000bffff, 0x0002ffff, 0x0001ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000001, 0x00000002, 0x00000003, 0x00000005, }, @@ -1534,7 +1569,7 @@ const uint32_t c_aauiCQMFHuffDec25[19][16] = {0x0012ffff, 0x00000038, 0x0000003a, 0x0000003b, 0x0000003c, 0x0000003d, 0x00010035, 0x00010035, 0x00010037, 0x00010037, 0x00010039, 0x00010039, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc26[77][2] = { {0x0006, 0x0004}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, @@ -1550,6 +1585,7 @@ const uint32_t c_aauiCQMFHuffEnc26[77][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec26[26][16] = { {0x0010ffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, }, @@ -1579,7 +1615,7 @@ const uint32_t c_aauiCQMFHuffDec26[26][16] = {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc27[91][2] = { {0x0006, 0x0006}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, @@ -1597,6 +1633,7 @@ const uint32_t c_aauiCQMFHuffEnc27[91][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec27[28][16] = { {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, @@ -1628,7 +1665,7 @@ const uint32_t c_aauiCQMFHuffDec27[28][16] = {0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc28[109][2] = { {0x0006, 0x0008}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, @@ -1648,6 +1685,7 @@ const uint32_t c_aauiCQMFHuffEnc28[109][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec28[30][16] = { {0x000fffff, 0x0010ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, }, @@ -1681,7 +1719,7 @@ const uint32_t c_aauiCQMFHuffDec28[30][16] = {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, {0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc29[129][2] = { {0x0006, 0x0009}, {0x0005, 0x0019}, {0x0006, 0x000a}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0006, 0x000b}, {0x0005, 0x001d}, @@ -1704,6 +1742,7 @@ const uint32_t c_aauiCQMFHuffEnc29[129][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec29[34][16] = { {0x000fffff, 0x0010ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, }, @@ -1741,7 +1780,7 @@ const uint32_t c_aauiCQMFHuffDec29[34][16] = {0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc30[153][2] = { {0x0007, 0x0009}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, @@ -1767,6 +1806,7 @@ const uint32_t c_aauiCQMFHuffEnc30[153][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec30[39][16] = { {0x0010ffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, }, @@ -1809,7 +1849,7 @@ const uint32_t c_aauiCQMFHuffDec30[39][16] = {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, }, {0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc31[181][2] = { {0x0007, 0x000b}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, @@ -1838,6 +1878,7 @@ const uint32_t c_aauiCQMFHuffEnc31[181][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec31[43][16] = { {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, @@ -1884,31 +1925,33 @@ const uint32_t c_aauiCQMFHuffDec31[43][16] = {0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, }, {0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc33[16][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec33[2][16] = { {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc34[16][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec34[2][16] = { {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc35[25][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0007, 0x0006}, {0x0009, 0x0000}, {0x0009, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0009, 0x0002}, @@ -1918,6 +1961,7 @@ const uint32_t c_aauiCQMFHuffEnc35[25][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec35[9][16] = { {0x0001ffff, 0x00000006, 0x00010001, 0x00010001, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -1930,7 +1974,7 @@ const uint32_t c_aauiCQMFHuffDec35[9][16] = {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc36[36][2] = { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0002}, {0x000b, 0x0000}, {0x000b, 0x0001}, {0x000b, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, @@ -1941,6 +1985,7 @@ const uint32_t c_aauiCQMFHuffEnc36[36][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec36[7][16] = { {0x0001ffff, 0x00000007, 0x00010006, 0x00010006, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -1951,7 +1996,7 @@ const uint32_t c_aauiCQMFHuffDec36[7][16] = {0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, }, {0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc37[36][2] = { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0000}, {0x000c, 0x0001}, {0x000c, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, @@ -1962,6 +2007,7 @@ const uint32_t c_aauiCQMFHuffEnc37[36][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec37[4][16] = { {0x0001ffff, 0x00000007, 0x00010006, 0x00010006, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -1969,7 +2015,7 @@ const uint32_t c_aauiCQMFHuffDec37[4][16] = {0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00010023, 0x00010023, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, {0x00000003, 0x00000004, 0x00000005, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc38[49][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0012}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x000d, 0x0002}, {0x0002, 0x0001}, @@ -1982,6 +2028,7 @@ const uint32_t c_aauiCQMFHuffEnc38[49][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec38[22][16] = { {0x0001ffff, 0x00000008, 0x00010001, 0x00010001, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2007,7 +2054,7 @@ const uint32_t c_aauiCQMFHuffDec38[22][16] = {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc39[64][2] = { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0002}, {0x000f, 0x0000}, {0x000f, 0x0001}, {0x000f, 0x0002}, {0x000f, 0x0003}, @@ -2020,6 +2067,7 @@ const uint32_t c_aauiCQMFHuffEnc39[64][2] = {0x000f, 0x0029}, {0x000e, 0x0015}, {0x000e, 0x0016}, {0x000e, 0x0017}, {0x000e, 0x0018}, {0x000e, 0x0019}, {0x000e, 0x001a}, {0x000e, 0x001b}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec39[12][16] = { {0x0001ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2035,7 +2083,7 @@ const uint32_t c_aauiCQMFHuffDec39[12][16] = {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc40[81][2] = { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000f, 0x0011}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, @@ -2051,7 +2099,7 @@ const uint32_t c_aauiCQMFHuffEnc40[81][2] = {0x0010, 0x0021}, }; - +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec40[36][16] = { {0x0001ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2091,7 +2139,7 @@ const uint32_t c_aauiCQMFHuffDec40[36][16] = {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc41[100][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0014}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, @@ -2110,6 +2158,7 @@ const uint32_t c_aauiCQMFHuffEnc41[100][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec41[16][16] = { {0x0001ffff, 0x0000000b, 0x00010001, 0x00010001, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2129,7 +2178,7 @@ const uint32_t c_aauiCQMFHuffDec41[16][16] = {0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, }, {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc42[169][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000e, 0x0006}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, @@ -2157,6 +2206,7 @@ const uint32_t c_aauiCQMFHuffEnc42[169][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec42[28][16] = { {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2188,7 +2238,7 @@ const uint32_t c_aauiCQMFHuffDec42[28][16] = {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, }, {0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc43[196][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000c, 0x0003}, {0x0010, 0x0017}, {0x0013, 0x0000}, {0x0013, 0x0001}, @@ -2219,6 +2269,7 @@ const uint32_t c_aauiCQMFHuffEnc43[196][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec43[32][16] = { {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2254,7 +2305,7 @@ const uint32_t c_aauiCQMFHuffDec43[32][16] = {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc44[289][2] = { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0002}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000f, 0x000a}, {0x0011, 0x0022}, {0x0014, 0x0000}, @@ -2297,6 +2348,7 @@ const uint32_t c_aauiCQMFHuffEnc44[289][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec44[27][16] = { {0x0002ffff, 0x0001ffff, 0x00010001, 0x00010001, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, @@ -2327,7 +2379,7 @@ const uint32_t c_aauiCQMFHuffDec44[27][16] = {0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, }, {0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc45[324][2] = { {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0005}, {0x0010, 0x0025}, {0x0012, 0x0088}, @@ -2374,6 +2426,7 @@ const uint32_t c_aauiCQMFHuffEnc45[324][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec45[50][16] = { {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000025, 0x00010001, 0x00010001, 0x00010013, 0x00010013, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, @@ -2427,7 +2480,7 @@ const uint32_t c_aauiCQMFHuffDec45[50][16] = {0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, }, {0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc46[400][2] = { {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0004}, {0x0009, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x000a}, {0x000f, 0x0018}, @@ -2482,6 +2535,7 @@ const uint32_t c_aauiCQMFHuffEnc46[400][2] = {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0012, 0x00ab}, {0x0012, 0x00ac}, {0x0012, 0x00ad}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec46[61][16] = { {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00010001, 0x00010001, 0x00010015, 0x00010015, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, @@ -2546,7 +2600,7 @@ const uint32_t c_aauiCQMFHuffDec46[61][16] = {0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, }, {0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc47[576][2] = { {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0005}, {0x0006, 0x0004}, {0x0008, 0x0006}, {0x000a, 0x0007}, {0x000c, 0x000b}, {0x000d, 0x000d}, @@ -2623,6 +2677,7 @@ const uint32_t c_aauiCQMFHuffEnc47[576][2] = {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, {0x0012, 0x00fd}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec47[87][16] = { {0x0004ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x0000001a, 0x00000031, 0x00010001, 0x00010001, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, @@ -2713,7 +2768,7 @@ const uint32_t c_aauiCQMFHuffDec47[87][16] = {0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, }, {0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc48[729][2] = { {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0006}, {0x0006, 0x0006}, {0x0008, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x000b}, {0x000c, 0x000d}, @@ -2811,6 +2866,7 @@ const uint32_t c_aauiCQMFHuffEnc48[729][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec48[110][16] = { {0x0005ffff, 0x0003ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x00000037, 0x00010001, 0x00010001, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, @@ -2924,7 +2980,7 @@ const uint32_t c_aauiCQMFHuffDec48[110][16] = {0x000102c4, 0x000102c4, 0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, }, {0x000102cc, 0x000102cc, 0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc49[729][2] = { {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0007}, {0x0007, 0x000a}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0009, 0x0009}, {0x000b, 0x000d}, @@ -3022,6 +3078,7 @@ const uint32_t c_aauiCQMFHuffEnc49[729][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec49[113][16] = { {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00010001, 0x00010001, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, @@ -3138,7 +3195,7 @@ const uint32_t c_aauiCQMFHuffDec49[113][16] = {0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, 0x000102cc, 0x000102cc, }, {0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, 0x000102d4, 0x000102d4, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc50[28][2] = { {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, @@ -3148,6 +3205,7 @@ const uint32_t c_aauiCQMFHuffEnc50[28][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec50[6][16] = { {0x0001ffff, 0x00000004, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, @@ -3157,7 +3215,7 @@ const uint32_t c_aauiCQMFHuffDec50[6][16] = {0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc51[29][2] = { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0001}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, @@ -3167,6 +3225,7 @@ const uint32_t c_aauiCQMFHuffEnc51[29][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec51[6][16] = { {0x0001ffff, 0x00000004, 0x00000005, 0x00000006, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3176,7 +3235,7 @@ const uint32_t c_aauiCQMFHuffDec51[6][16] = {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc52[32][2] = { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0005, 0x0002}, @@ -3185,6 +3244,7 @@ const uint32_t c_aauiCQMFHuffEnc52[32][2] = {0x0013, 0x0003}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0004}, {0x0013, 0x0005}, }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec52[7][16] = { {0x0001ffff, 0x0002ffff, 0x00000004, 0x00000005, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3195,7 +3255,7 @@ const uint32_t c_aauiCQMFHuffDec52[7][16] = {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, {0x00000017, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x00010018, 0x00010018, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc53[37][2] = { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0002}, {0x0005, 0x0003}, @@ -3206,6 +3266,7 @@ const uint32_t c_aauiCQMFHuffEnc53[37][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec53[9][16] = { {0x0002ffff, 0x0001ffff, 0x00000004, 0x00000005, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3218,7 +3279,7 @@ const uint32_t c_aauiCQMFHuffDec53[9][16] = {0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc54[39][2] = { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, @@ -3229,6 +3290,7 @@ const uint32_t c_aauiCQMFHuffEnc54[39][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec54[9][16] = { {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000004, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3241,7 +3303,7 @@ const uint32_t c_aauiCQMFHuffDec54[9][16] = {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc55[46][2] = { {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, @@ -3253,6 +3315,7 @@ const uint32_t c_aauiCQMFHuffEnc55[46][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec55[10][16] = { {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3266,7 +3329,7 @@ const uint32_t c_aauiCQMFHuffDec55[10][16] = {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc56[55][2] = { {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0005, 0x0004}, @@ -3279,6 +3342,7 @@ const uint32_t c_aauiCQMFHuffEnc56[55][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec56[12][16] = { {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000004, 0x00000005, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3294,7 +3358,7 @@ const uint32_t c_aauiCQMFHuffDec56[12][16] = {0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, {0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc57[65][2] = { {0x0003, 0x0004}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0004}, @@ -3309,6 +3373,7 @@ const uint32_t c_aauiCQMFHuffEnc57[65][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec57[14][16] = { {0x0004ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3326,7 +3391,7 @@ const uint32_t c_aauiCQMFHuffDec57[14][16] = {0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, {0x0001002f, 0x0001002f, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc58[77][2] = { {0x0004, 0x0005}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, @@ -3342,6 +3407,7 @@ const uint32_t c_aauiCQMFHuffEnc58[77][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec58[17][16] = { {0x0005ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, }, @@ -3362,7 +3428,7 @@ const uint32_t c_aauiCQMFHuffDec58[17][16] = {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc59[91][2] = { {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0006}, @@ -3380,6 +3446,7 @@ const uint32_t c_aauiCQMFHuffEnc59[91][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec59[20][16] = { {0x0006ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, @@ -3403,7 +3470,7 @@ const uint32_t c_aauiCQMFHuffDec59[20][16] = {0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, }, {0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc60[109][2] = { {0x0004, 0x0007}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, @@ -3423,6 +3490,7 @@ const uint32_t c_aauiCQMFHuffEnc60[109][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec60[24][16] = { {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00010002, 0x00010002, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, @@ -3450,7 +3518,7 @@ const uint32_t c_aauiCQMFHuffDec60[24][16] = {0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, }, {0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc61[129][2] = { {0x0004, 0x0008}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0008}, {0x0005, 0x0009}, @@ -3473,6 +3541,7 @@ const uint32_t c_aauiCQMFHuffEnc61[129][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec61[33][16] = { {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, @@ -3509,7 +3578,7 @@ const uint32_t c_aauiCQMFHuffDec61[33][16] = {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc62[153][2] = { {0x0004, 0x0009}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, @@ -3535,6 +3604,7 @@ const uint32_t c_aauiCQMFHuffEnc62[153][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec62[41][16] = { {0x0009ffff, 0x0008ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, @@ -3579,7 +3649,7 @@ const uint32_t c_aauiCQMFHuffDec62[41][16] = {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, }; - +#endif const uint32_t c_aauiCQMFHuffEnc63[181][2] = { {0x0004, 0x0008}, {0x0003, 0x0005}, {0x0002, 0x0003}, {0x0004, 0x0009}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, @@ -3608,6 +3678,7 @@ const uint32_t c_aauiCQMFHuffEnc63[181][2] = }; +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec63[39][16] = { {0x0008ffff, 0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x00000000, 0x00000003, 0x00010001, 0x00010001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, @@ -3650,7 +3721,7 @@ const uint32_t c_aauiCQMFHuffDec63[39][16] = {0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, }, {0x00000075, 0x00000079, 0x0000007f, 0x00000081, 0x00000082, 0x00000083, 0x00000085, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x00000090, }, }; - +#endif const uint32_t (*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = { NULL, c_aauiCQMFHuffEnc1, @@ -3717,7 +3788,7 @@ const uint32_t (*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = { c_aauiCQMFHuffEnc62, c_aauiCQMFHuffEnc63, }; - +#ifndef ROM_TO_RAM const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE] = { NULL, c_aauiCQMFHuffDec1, @@ -3784,7 +3855,17 @@ const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE c_aauiCQMFHuffDec62, c_aauiCQMFHuffDec63, }; - +#else +const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE] = +{ 0, 16, 16, 25, 36, 36, 49, 64, 81, 100, + 169, 196, 289, 324, 400, 576, 729, 729, 28, 29, + 32, 37, 39, 46, 55, 65, 77, 91, 109, 129, + 153, 181, 0, 16, 16, 25, 36, 36, 49, 64, 81, + 100, 169, 196, 289, 324, 400, 576, 729, 729, 28, + 29, 32, 37, 39, 46, 55, 65, 77, 91, 109, + 129, 153, 181 +}; +#endif #ifdef USE_DEMOD_TABLES const int32_t c_aaiHuffDemod1[16][2] = { 0,0,0,1,0,2,0,3,1,0,1,1,1,2,1,3,2,0,2,1,2,2,2,3,3,0,3,1,3,2,3,3, diff --git a/lib_rend/ivas_CQMFHuff.h b/lib_rend/ivas_CQMFHuff.h index bf28158bea..a4c28a3bac 100644 --- a/lib_rend/ivas_CQMFHuff.h +++ b/lib_rend/ivas_CQMFHuff.h @@ -38,6 +38,7 @@ extern "C" { #endif +#include "options.h" #include "ivas_Tables.h" #include // For NULL #include @@ -55,256 +56,382 @@ extern "C" extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec1[3][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc2[16][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec2[3][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc3[25][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec3[10][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc4[36][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec4[5][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc5[36][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec5[10][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc6[49][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec6[7][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc7[64][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec7[25][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc8[81][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec8[16][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc9[100][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec9[22][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc10[169][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec10[45][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc11[196][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec11[50][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc12[289][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec12[76][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc13[324][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec13[89][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc14[400][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec14[53][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc15[576][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec15[73][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc16[729][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec16[85][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc17[729][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec17[93][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc18[28][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec18[6][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc19[29][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec19[6][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc20[32][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec20[6][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc21[37][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec21[7][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc22[39][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec22[9][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc23[46][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec23[12][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc24[55][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec24[17][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc25[65][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec25[19][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc26[77][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec26[26][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc27[91][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec27[28][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc28[109][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec28[30][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc29[129][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec29[34][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc30[153][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec30[39][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc31[181][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec31[43][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc33[16][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec33[2][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc34[16][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec34[2][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc35[25][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec35[9][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc36[36][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec36[7][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc37[36][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec37[4][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc38[49][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec38[22][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc39[64][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec39[12][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc40[81][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec40[36][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc41[100][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec41[16][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc42[169][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec42[28][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc43[196][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec43[32][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc44[289][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec44[27][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc45[324][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec45[50][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc46[400][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec46[61][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc47[576][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec47[87][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc48[729][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec48[110][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc49[729][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec49[113][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc50[28][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec50[6][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc51[29][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec51[6][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc52[32][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec52[7][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc53[37][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec53[9][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc54[39][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec54[9][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc55[46][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec55[10][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc56[55][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec56[12][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc57[65][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec57[14][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc58[77][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec58[17][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc59[91][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec59[20][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc60[109][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec60[24][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc61[129][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec61[33][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc62[153][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec62[41][16]; +#endif extern const uint32_t c_aauiCQMFHuffEnc63[181][2]; +#ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffDec63[39][16]; - +#endif extern const uint32_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2]; - +#ifndef ROM_TO_RAM extern const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE]; +#else +extern const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE]; +#endif #ifdef USE_DEMOD_TABLES extern const int32_t c_aaiHuffDemod1[16][2]; diff --git a/lib_rend/ivas_Tables.h b/lib_rend/ivas_Tables.h index 676ecd43d0..61abfb30c9 100644 --- a/lib_rend/ivas_Tables.h +++ b/lib_rend/ivas_Tables.h @@ -75,7 +75,9 @@ extern "C" #define MIN_ALLOC_OFFSET ( -128 ) #define MAX_ALLOC_OFFSET ( 127 ) - +#ifdef ROM_TO_RAM +#define READ_LENGTH ( 4 ) +#endif #define ALLOC_TABLE_SIZE ( 32 ) -- GitLab From a444b46f2e83dda49997c405f603904d126aac6f Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 3 May 2023 13:53:27 +0300 Subject: [PATCH 120/591] Fix addressing 128k quality --- lib_com/ivas_cnst.h | 6 +- lib_com/ivas_prot.h | 12 +++ lib_com/options.h | 1 + lib_dec/ivas_cpe_dec.c | 5 +- lib_dec/ivas_masa_dec.c | 8 ++ lib_dec/ivas_omasa_dec.c | 12 +++ lib_dec/ivas_stat_dec.h | 3 + lib_enc/ivas_cpe_enc.c | 5 -- lib_enc/ivas_enc.c | 78 ++++++++++++++++++-- lib_enc/ivas_init_enc.c | 1 + lib_enc/ivas_ism_enc.c | 12 +++ lib_enc/ivas_ism_metadata_enc.c | 68 ++++++++++------- lib_enc/ivas_masa_enc.c | 12 ++- lib_enc/ivas_stat_enc.h | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- 15 files changed, 184 insertions(+), 43 deletions(-) mode change 100755 => 100644 lib_com/ivas_prot.h mode change 100755 => 100644 lib_com/options.h diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index be34fdb477..113d7a67bd 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -318,6 +318,10 @@ typedef enum #ifdef MASA_AND_OBJECTS #define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM no meta / inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC ) +#ifdef OMASA_ENERGIES +#define ADJUST_ISM_BRATE_NEG 6000 +#define ADJUST_ISM_BRATE_POS 8000 +#endif #endif #define ISM_AZIMUTH_NBITS 7 @@ -1221,12 +1225,10 @@ enum #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #ifdef MASA_AND_OBJECTS #define MAXIMUM_OMASA_FREQ_BANDS 8 /* Corresponds to maximum number of coding bands at 32 kbps */ - #ifdef FIX_OMASA_STEREO_SWITCHING #define OMASA_STEREO_SW_CNT_MAX 100 #define OMASA_STEREO_SW_CNT_MAX2 5 #endif - #endif #define MASA_BIT_REDUCT_PARAM 10 diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h old mode 100755 new mode 100644 index 21439160e0..5625fc2fb7 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -817,6 +817,10 @@ ivas_error ivas_ism_enc( float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ const int16_t input_frame, /* i : input frame length per channel */ int16_t *nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_ENERGIES + , + int16_t flag_omasa_brate +#endif ); ivas_error ivas_ism_metadata_enc( @@ -837,6 +841,10 @@ ivas_error ivas_ism_metadata_enc( const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ #ifdef MASA_AND_OBJECTS ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ +#ifdef OMASA_ENERGIES + , + int16_t flag_omasa_brate +#endif #ifdef FIX_OMASA_STEREO_SWITCHING ,int16_t *omasa_stereo_sw_cnt #endif @@ -4625,6 +4633,10 @@ ivas_error ivas_masa_encode( const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ const int16_t ism_imp /* i : importance of separated object */ +#ifdef OMASA_ENERGIES + , + int16_t flag_omasa_brate /* i: flag for using less bitrate for objects in OMASA */ +#endif #endif ); diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index c23efa7568..99627150c5 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,6 +179,7 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ +#define OMASA_ENERGIES #define FIX_OMASA_STEREO_SWITCHING // VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps #endif diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 714149b9aa..c4440417c9 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -97,6 +97,9 @@ ivas_error ivas_cpe_dec( sts[0]->BER_detect |= st_ivas->BER_detect; sts[1]->BER_detect |= st_ivas->BER_detect; +#ifdef FIX_OMASA_STEREO_SWITCHING + element_brate_ref = hCPE->element_brate; +#endif #ifdef FIX_OMASA_STEREO_SWITCHING element_brate_ref = hCPE->element_brate; @@ -105,7 +108,6 @@ ivas_error ivas_cpe_dec( /*------------------------------------------------------------------* * Read stereo technology info & audio bandwidth *-----------------------------------------------------------------*/ - #ifdef FIX_OMASA_STEREO_SWITCHING if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { @@ -131,7 +133,6 @@ ivas_error ivas_cpe_dec( } } #endif - read_stereo_mode_and_bwidth( hCPE, st_ivas ); /*----------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 810bd7bc09..866a20103c 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -242,6 +242,14 @@ ivas_error ivas_masa_decode( ( *nb_bits_read ) += ISM_METADATA_VAD_FLAG_BITS; } } +#ifdef OMASA_ENERGIES + st_ivas->flag_omasa_brate = 0; + if ( st_ivas->nchan_ism >= 3 && ivas_total_brate == IVAS_128k ) + { + st_ivas->flag_omasa_brate = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits_read ) += 1; + } +#endif } } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b89ce05019..92cb4336ec 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -396,6 +396,18 @@ void ivas_set_surplus_brate_dec( st_ivas->hSCE[n]->element_brate = element_brate[n]; *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp, brate_limit_flag ); +#ifdef OMASA_ENERGIES + if ( ism_imp[n] > 1 && st_ivas->flag_omasa_brate == 1 && brate_limit_flag >= 0 ) + { + *ism_total_brate -= ADJUST_ISM_BRATE_NEG; + } + + if ( brate_limit_flag == -1 && ism_imp[n] >= 1 && st_ivas->nchan_ism >= 3 && ( ism_total_brate_ref - *ism_total_brate > IVAS_48k ) ) + { + *ism_total_brate += ADJUST_ISM_BRATE_POS; + } + +#endif } st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index fbaedb0453..10319e4f68 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1299,6 +1299,9 @@ typedef struct Decoder_Struct int16_t index_of_edited_ism; /* Todo Nokia: Temporary, used until proper ISM control available */ int16_t azimuth_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ int16_t elevation_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ + #ifdef OMASA_ENERGIES + int16_t flag_omasa_brate; + #endif #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index c6b33d7539..9a54cdaf5a 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -105,7 +105,6 @@ ivas_error ivas_cpe_enc( int32_t cpe_brate; #ifdef FIX_OMASA_STEREO_SWITCHING int32_t element_brate_ref; - int16_t element_mode_ref; #endif #endif @@ -123,7 +122,6 @@ ivas_error ivas_cpe_enc( ivas_total_brate = hEncoderConfig->ivas_total_brate; #ifdef FIX_OMASA_STEREO_SWITCHING element_brate_ref = hCPE->element_brate; - element_mode_ref = hCPE->element_mode; #endif /*------------------------------------------------------------------* @@ -179,7 +177,6 @@ ivas_error ivas_cpe_enc( { hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } - #ifdef FIX_OMASA_STEREO_SWITCHING if ( ivas_format == MASA_ISM_FORMAT ) { @@ -216,7 +213,6 @@ ivas_error ivas_cpe_enc( } } #endif - if ( ( error = front_vad( hCPE, NULL, hEncoderConfig, &hCPE->hFrontVad[0], st_ivas->hMCT != NULL, input_frame, vad_flag_dtx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies_LR, NULL, NULL ) ) != IVAS_ERR_OK ) { return error; @@ -781,7 +777,6 @@ ivas_error ivas_cpe_enc( } #endif - if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->hStereoMdct != NULL && hCPE->hStereoMdct->hItd != NULL ) { /* update input samples buffer */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 457d56a5e9..b945ac48c6 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -63,6 +63,9 @@ ivas_error ivas_enc( Encoder_State *st; /* used for bitstream handling */ #ifdef MASA_AND_OBJECTS int16_t nb_bits_metadata[MAX_SCE + 1]; +#ifdef OMASA_ENERGIES + int16_t flag_omasa_brate; +#endif #else int16_t nb_bits_metadata[MAX_SCE]; #endif @@ -89,6 +92,9 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); +#ifdef OMASA_ENERGIES + flag_omasa_brate = 0; +#endif #else set_s( nb_bits_metadata, 0, MAX_SCE ); #endif @@ -185,7 +191,12 @@ ivas_error ivas_enc( ivas_param_ism_stereo_dmx( st_ivas, data_f, input_frame ); /* Core coding of Stereo DMX */ - if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, nb_bits_metadata +#ifdef OMASA_ENERGIES + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -193,7 +204,12 @@ ivas_error ivas_enc( else if ( st_ivas->ism_mode == ISM_MODE_DISC ) { /* Analysis, decision about bitrates per channel & core coding */ - if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, nb_bits_metadata +#ifdef OMASA_ENERGIES + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -245,6 +261,10 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS , ISM_MODE_NONE, -1, NULL, -1, NULL, 0 +#endif +#ifdef OMASA_ENERGIES + , + 0 #endif ) ) != IVAS_ERR_OK ) { @@ -332,15 +352,53 @@ ivas_error ivas_enc( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { - if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1] +#ifdef OMASA_ENERGIES + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { +#ifdef OMASA_ENERGIES + float energy_ism, energy_masa; + + energy_ism = 0.0f; + + if ( st_ivas->nSCE >= 3 && st_ivas->hEncoderConfig->ivas_total_brate == IVAS_128k ) + { + for ( i = 0; i < st_ivas->nSCE; i++ ) + { + energy_ism += sum2_f( data_f[i], input_frame ); + } + + energy_masa = 0.0f; + + for ( i = st_ivas->nSCE; i < st_ivas->nSCE + 2; i++ ) + { + energy_masa += sum2_f( data_f[i], input_frame ); + } + + energy_ism = energy_ism / ( energy_masa + 1.0f ) * 2.0f / (float) ( st_ivas->nSCE ); + flag_omasa_brate = 0; + if ( energy_ism < 1.0f ) + { + flag_omasa_brate = 1; + } + dbgwrite( &energy_ism, sizeof( float ), 1, 1, "en_ratio.bin" ); + } +#endif /* Analysis, decision about bitrates per channel & core coding */ - if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] +#ifdef OMASA_ENERGIES + , + flag_omasa_brate +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -349,7 +407,12 @@ ivas_error ivas_enc( /* Encode MASA parameters and write MASA metadata bitstream */ if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp ) ) != IVAS_ERR_OK ) + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp +#ifdef OMASA_ENERGIES + , + flag_omasa_brate +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -426,6 +489,11 @@ ivas_error ivas_enc( , ISM_MODE_NONE, -1, NULL, -1, NULL, 0 #endif +#ifdef OMASA_ENERGIES + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index c2c348f19c..d17a70ea44 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -647,6 +647,7 @@ ivas_error ivas_init_encoder( return error; } + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 35de64ab26..a8ca36ccfb 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -53,6 +53,10 @@ ivas_error ivas_ism_enc( float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ const int16_t input_frame, /* i : input frame length per channel */ int16_t *nb_bits_metadata /* i : number of metadata bits */ +#ifdef OMASA_ENERGIES + , + int16_t flag_omasa_brate +#endif ) { SCE_ENC_HANDLE hSCE; @@ -246,6 +250,10 @@ ivas_error ivas_ism_enc( #ifdef MASA_AND_OBJECTS ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1 +#ifdef OMASA_ENERGIES + , + 0 +#endif #ifdef FIX_OMASA_STEREO_SWITCHING , NULL @@ -275,6 +283,10 @@ ivas_error ivas_ism_enc( ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 +#ifdef OMASA_ENERGIES + , + flag_omasa_brate +#endif #ifdef FIX_OMASA_STEREO_SWITCHING , st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 2fcffbb358..a28cc7c79b 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -185,6 +185,10 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS , const float lp_noise_CPE +#ifdef OMASA_ENERGIES + , + int16_t flag_omasa_brate +#endif #ifdef FIX_OMASA_STEREO_SWITCHING , int16_t *omasa_stereo_sw_cnt @@ -252,37 +256,37 @@ ivas_error ivas_ism_metadata_enc( hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; #ifdef FIX_387_ISM_MD_FEC - /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */ - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) - { - if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) || - ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) ) + /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */ + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - hIsmMeta[ch]->ism_metadata_flag = 1; - hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; - } - else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ) - { - hIsmMeta[ch]->ism_metadata_flag = 1; - - if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 ) + if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) || + ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) ) { - hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; + hIsmMeta[ch]->ism_metadata_flag = 1; + hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; } - else + else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ) { - hIsmMeta[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX; + hIsmMeta[ch]->ism_metadata_flag = 1; + + if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 ) + { + hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; + } + else + { + hIsmMeta[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX; + } + } + else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } } - else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) - { - hIsmMeta[ch]->ism_metadata_flag = 1; - hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; - } - } #endif + } } - } /*----------------------------------------------------------------* * Rate importance of particular ISM streams @@ -590,7 +594,8 @@ ivas_error ivas_ism_metadata_enc( { int16_t bits_ism, bits_element[MAX_NUM_OBJECTS]; int16_t brate_limit_flag; - + int32_t ism_total_brate_ref; + ism_total_brate_ref = *ism_total_brate; brate_limit_flag = calculate_brate_limit_flag( ism_imp, nchan_ism ); bits_ism = (int16_t) ( *ism_total_brate / FRAMES_PER_SECOND ); @@ -602,9 +607,20 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_ism; ch++ ) { *ism_total_brate += ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ); +#ifdef OMASA_ENERGIES + if ( ism_imp[ch] > 1 && flag_omasa_brate == 1 && brate_limit_flag >= 0 ) + { + *ism_total_brate -= flag_omasa_brate * ADJUST_ISM_BRATE_NEG; + } + + if ( brate_limit_flag == -1 && ism_imp[ch] >= 1 && nchan_ism >= 3 && ( ism_total_brate_ref - *ism_total_brate > IVAS_48k ) ) + { + *ism_total_brate += ADJUST_ISM_BRATE_POS; + } + +#endif } ism_metadata_flag_global = 1; - #ifdef FIX_OMASA_STEREO_SWITCHING if ( ism_mode == ISM_MASA_MODE_DISC ) { @@ -657,7 +673,7 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; - } + } else { hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 048adbe2dc..bfa5e60735 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -251,6 +251,10 @@ ivas_error ivas_masa_encode( const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ const int16_t ism_imp /* i : importance of separated object */ +#ifdef OMASA_ENERGIES + , + int16_t flag_omasa_brate /* i: flag for using less bitrate for objects in OMASA */ +#endif #endif ) { @@ -393,6 +397,13 @@ ivas_error ivas_masa_encode( hQMetaData->metadata_max_bits -= ISM_METADATA_VAD_FLAG_BITS; } } +#ifdef OMASA_ENERGIES + if ( ivas_total_brate == IVAS_128k && nchan_ism >= 3 ) + { + push_next_indice( hMetaData, flag_omasa_brate, 1 ); + hQMetaData->metadata_max_bits -= 1; + } +#endif } } else @@ -802,7 +813,6 @@ ivas_error ivas_masa_enc_config( #ifdef FIX_OMASA_STEREO_SWITCHING if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT || st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) #else - if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT ) #endif { diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 67345ab8c9..cf470e9248 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -750,7 +750,7 @@ typedef struct ivas_masa_encoder_data_struct float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t nchan_ism; - float lp_noise_CPE; /* LP filtered total noise estimation */ + float lp_noise_CPE; /* LP filterend total noise estimation */ #ifdef FIX_OMASA_STEREO_SWITCHING int16_t omasa_stereo_sw_cnt; int16_t omasa_stereo_sw_cnt2; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a2c7b242e1..23b8f36e6b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -52,7 +52,7 @@ * Local constants *------------------------------------------------------------------------*/ -#define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f +#define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f #ifdef FIX_417_TD_DECORR_BRATE_SW #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) -- GitLab From a035b93b9e2f9d1999385d4c6f7d0198e7a4475e Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Wed, 3 May 2023 17:38:34 +0530 Subject: [PATCH 121/591] pipeline_fixes_set-1 --- lib_rend/ivas_CQMFDecoder.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 16e6afc614..44f1cbeb9d 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -124,7 +124,7 @@ struct CQMF_DECODER #ifdef ROM_TO_RAM static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ); static TableNode *CreateTableList( int32_t iReadLength ); -static void DeleteTableList( TableList *ptable_list, int32_t iReadLength, int32_t iTables ); +static void DeleteTableList( TableList *ptable_list, int32_t iTables ); static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode *poParent, int32_t iReadLength, uint32_t *iTablesCreated ); static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t iCode, int32_t iCodeIndex, int32_t iReadLength, uint32_t *iTables ); static void CompleteTables( CQMFDecoder *psCQMFDecoder, int32_t n, TableList *ptable_list, int32_t iReadLength, int32_t iTablesCreated ); @@ -151,15 +151,15 @@ static TableNode *CreateTableList( int32_t iReadLength ) return ptable_top; } -static void DeleteTableList( TableList *ptable_list, int32_t iReadLength, int32_t iTables ) +static void DeleteTableList( TableList *ptable_list, int32_t iTables ) { TableNode *node; - int32_t iMaxTables; + //int32_t iMaxTables; node = ptable_list->poOrderedTop; - iMaxTables = 1 << iReadLength; + //iMaxTables = 1 << iReadLength; while ( ( iTables ) ) { @@ -282,11 +282,11 @@ static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t i static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ) { int32_t n; - int32_t iMaxTables; + //int32_t iMaxTables; uint32_t **ppsort_enc_table; TableList *ptable_list; ptable_list = (TableList *) malloc( sizeof( TableList ) ); - iMaxTables = 1 << iReadLength; + //iMaxTables = 1 << iReadLength; ppsort_enc_table = (uint32_t **) malloc( iSize * sizeof( int32_t * ) ); for ( n = 0; n < iSize; n++ ) @@ -350,7 +350,7 @@ static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const ui } CompleteTables( psCQMFDecoder, num, ptable_list, iReadLength, *iTables ); - DeleteTableList( ptable_list, iReadLength, *iTables ); + DeleteTableList( ptable_list, *iTables ); for ( n = 0; n < iSize; n++ ) { free( ppsort_enc_table[n] ); @@ -780,14 +780,12 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, psCQMFDecoder->iChannels, psCQMFDecoder->iNumBlocks, &psCQMFDecoder->iCommonGrouping, psCQMFDecoder->piNumGroups, psCQMFDecoder->ppiGroupLengths, - pBits - ); + pBits ); iBitsRead += ReadRMSEnvelope( psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups, psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope, - pBits - ); + pBits ); #ifdef ENABLE_PMOD_ADJUST iBitsRead += @@ -1558,10 +1556,14 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int #ifdef USE_DEMOD_TABLES const int32_t( *paiDemodTable )[2] = NULL; #endif - +#ifdef ROM_TO_RAM + pauiHuffmanTable = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[iAlloc]; + pauiHuffmanTableDPCM = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; +#else pauiHuffmanTable = c_apauiHuffDecTables[iAlloc]; pauiHuffmanTableDPCM = c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; +#endif #ifdef USE_DEMOD_TABLES paiDemodTable = c_apaiDemodTables[iAlloc]; #endif -- GitLab From a2b85f9b716b447eee56754f29a783a67bdbb9d8 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Wed, 3 May 2023 18:08:57 +0530 Subject: [PATCH 122/591] clean up & clang format fixes --- lib_rend/ivas_CQMFDecoder.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 44f1cbeb9d..9981f84932 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -155,11 +155,8 @@ static void DeleteTableList( TableList *ptable_list, int32_t iTables ) { TableNode *node; - //int32_t iMaxTables; node = ptable_list->poOrderedTop; - - //iMaxTables = 1 << iReadLength; while ( ( iTables ) ) { @@ -282,11 +279,9 @@ static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t i static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ) { int32_t n; - //int32_t iMaxTables; uint32_t **ppsort_enc_table; TableList *ptable_list; ptable_list = (TableList *) malloc( sizeof( TableList ) ); - //iMaxTables = 1 << iReadLength; ppsort_enc_table = (uint32_t **) malloc( iSize * sizeof( int32_t * ) ); for ( n = 0; n < iSize; n++ ) -- GitLab From fbbb2c2470f669ba6f46156260030ece45e9d2c4 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 4 May 2023 10:25:24 +1000 Subject: [PATCH 123/591] SBA rotation BE optimization, FOA, HOA2 fix with crend --- lib_com/options.h | 3 ++- lib_dec/lib_dec.c | 2 ++ lib_rend/lib_rend.c | 53 ++++++++++++++++++++++++++++++++++----------- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 488c81999d..1c5d43770d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -203,7 +203,8 @@ /*CLDFB CODEC SWITCHES -- END*/ #define REND_STATIC_MEM_OPT -#define EUALER2QUAT_FIX +//#define EUALER2QUAT_FIX +#define SBA_CREND_ROT_OPT #define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 3b30033565..5b58da5874 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -948,9 +948,11 @@ ivas_error IVAS_DEC_FeedHeadTrackData( { /* check for Euler angle signaling */ #ifdef SPLIT_REND_WITH_HEAD_ROT +#ifndef EUALER2QUAT_FIX /* TODO: temp change until Euler2Quat() is fixed*/ if ( ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) && ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#endif #endif { if ( orientation[i].w == -3.0f ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7ec283f674..1f1be0b7b0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2422,37 +2422,41 @@ updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { int16_t is_cldfb_in; - assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural mode is currently supported with HOA3 input and 48k sampling rate only" ); + is_cldfb_in = 1; ivas_renderSplitGetMultiBinPoseData( &rendCtx.hhRendererConfig[0]->split_rend_config, &inputSba->splitRendWrapper.multiBinPoseData, rendCtx.pHeadRotData->sr_pose_pred_axis ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hRendCfg->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV ) +#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT + if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { - error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, - &inputSba->splitRendWrapper.multiBinPoseData, - *rendCtx.pOutSampleRate ); + assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); + error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, hRendCfg, + &inputSba->splitRendWrapper.multiBinPoseData, + *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; } - is_cldfb_in = 0; + is_cldfb_in = 1; } + else #endif { - error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, hRendCfg, - &inputSba->splitRendWrapper.multiBinPoseData, - *rendCtx.pOutSampleRate ); + assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" ); + error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, + &inputSba->splitRendWrapper.multiBinPoseData, + *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; } - is_cldfb_in = 1; + is_cldfb_in = 0; } + error = ivas_split_renderer_open( &inputSba->splitRendWrapper, &inputSba->base.ctx.hhRendererConfig[0]->split_rend_config, *rendCtx.pOutSampleRate, is_cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); @@ -2539,7 +2543,7 @@ static ivas_error setRendInputActiveSplitPostRend( outConfig = *rendCtx.pOutConfig; #ifdef REND_STATIC_MEM_OPT - if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } @@ -2547,7 +2551,7 @@ static ivas_error setRendInputActiveSplitPostRend( initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx #ifdef REND_STATIC_MEM_OPT , - inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH + inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS #endif ); @@ -4539,7 +4543,11 @@ ivas_error IVAS_REND_SetHeadRotation( ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { +#ifndef EUALER2QUAT_FIX rotQuat = headRot[i]; /* TODO: temp change until Euler2Quat() is fixed*/ +#else + Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); +#endif } else #endif @@ -4949,11 +4957,19 @@ static ivas_error rotateFrameSba( int16_t m1, m2; int16_t shd_rot_max_order; int16_t subframe_idx, subframe_len; +#ifdef SBA_CREND_ROT_OPT + float *writePtr; +#else float *readPtr, *writePtr; +#endif rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; rotation_gains gains; ivas_error error; +#ifdef SBA_CREND_ROT_OPT + int16_t idx; + float val, cf, oneminuscf; +#endif push_wmops( "rotateFrameSba" ); @@ -4980,6 +4996,11 @@ static ivas_error rotateFrameSba( for ( i = 0; i < subframe_len; i++ ) { +#ifdef SBA_CREND_ROT_OPT + idx = subframe_idx * subframe_len + i; + cf = headRotData->crossfade[i]; + oneminuscf = 1 - cf; +#endif /* As the rotation matrix becomes block diagonal in a SH basis, we can*/ /* apply each angular-momentum block individually to save complexity. */ @@ -4995,10 +5016,16 @@ static ivas_error rotateFrameSba( for ( m = m1; m < m2; m++ ) { +#ifdef SBA_CREND_ROT_OPT + val = inAudio.data[m * inAudio.config.numSamplesPerChannel + idx]; + /* crossfade with previous rotation gains */ + tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val ); +#else readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); /* crossfade with previous rotation gains */ tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); +#endif } } /* write back the result */ -- GitLab From 29e1af81f39cb993ce083a95f2b213e7e1fca976 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 4 May 2023 10:28:24 +1000 Subject: [PATCH 124/591] enable EUALER2QUAT_FIX --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1c5d43770d..dec3063de3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -203,7 +203,7 @@ /*CLDFB CODEC SWITCHES -- END*/ #define REND_STATIC_MEM_OPT -//#define EUALER2QUAT_FIX +#define EUALER2QUAT_FIX #define SBA_CREND_ROT_OPT #define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ -- GitLab From ef8dc8e6aa277e07a79d92736b42ef7812465ef0 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Thu, 4 May 2023 14:54:08 +0530 Subject: [PATCH 125/591] moved the tables to ivas_lcld_tables.c --- Workspace_msvc/lib_rend.vcxproj | 5 +- lib_rend/ivas_CQMFDecoder.c | 16 +- lib_rend/ivas_CQMFEncoder.c | 45 +- lib_rend/ivas_MSPred.c | 3 +- lib_rend/ivas_PerceptualModel.c | 114 +-- lib_rend/ivas_PerceptualModel.h | 59 -- lib_rend/ivas_PredDecoder.c | 2 +- lib_rend/ivas_PredEncoder.c | 2 +- lib_rend/ivas_RMSEnvDeltaHuff.c | 66 -- lib_rend/ivas_RMSEnvDeltaHuff.h | 57 -- lib_rend/ivas_RMSEnvGrouping.c | 3 +- lib_rend/ivas_Tables.c | 200 ----- lib_rend/ivas_Tables.h | 128 --- .../{ivas_CQMFHuff.c => ivas_lcld_tables.c} | 750 +++++++++++++++--- .../{ivas_CQMFHuff.h => ivas_lcld_tables.h} | 389 +++++---- 15 files changed, 947 insertions(+), 892 deletions(-) delete mode 100644 lib_rend/ivas_PerceptualModel.h delete mode 100644 lib_rend/ivas_RMSEnvDeltaHuff.c delete mode 100644 lib_rend/ivas_RMSEnvDeltaHuff.h delete mode 100644 lib_rend/ivas_Tables.c delete mode 100644 lib_rend/ivas_Tables.h rename lib_rend/{ivas_CQMFHuff.c => ivas_lcld_tables.c} (96%) rename lib_rend/{ivas_CQMFHuff.h => ivas_lcld_tables.h} (60%) diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 0488574583..423c250c03 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -199,20 +199,18 @@ + - - - @@ -245,6 +243,7 @@ + diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 9981f84932..5a5888fa09 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -39,11 +39,8 @@ Nations Convention on Contracts on the International Sales of Goods. #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT -#include "ivas_CQMFHuff.h" #include "ivas_NoiseGen.h" -#include "ivas_PerceptualModel.h" -#include "ivas_RMSEnvDeltaHuff.h" -#include "ivas_Tables.h" +#include "ivas_lcld_tables.h" #include "ivas_cldfb_codec_bitstream.h" #include "prot.h" #include @@ -122,7 +119,7 @@ struct CQMF_DECODER int32_t iLastError; }; #ifdef ROM_TO_RAM -static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ); +static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ); static TableNode *CreateTableList( int32_t iReadLength ); static void DeleteTableList( TableList *ptable_list, int32_t iTables ); static TableNode *GetNextTable( int32_t iIndex, TableList *table_list, TableNode *poParent, int32_t iReadLength, uint32_t *iTablesCreated ); @@ -276,7 +273,7 @@ static void AddcodeTableList( TableList *ptable_list, int32_t iLength, int32_t i } } -static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint32_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ) +static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const uint16_t ( *ppuiEncTable )[2], int32_t iSize, int32_t iReadLength, uint32_t *iTables ) { int32_t n; uint32_t **ppsort_enc_table; @@ -288,8 +285,8 @@ static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const ui { ppsort_enc_table[n] = (uint32_t *) malloc( 3 * sizeof( int32_t ) ); - ppsort_enc_table[n][0] = ppuiEncTable[n][0]; - ppsort_enc_table[n][1] = ppuiEncTable[n][1]; + ppsort_enc_table[n][0] = (uint32_t)ppuiEncTable[n][0]; + ppsort_enc_table[n][1] = (uint32_t)ppuiEncTable[n][1]; ppsort_enc_table[n][2] = (uint32_t) n; } @@ -1556,8 +1553,7 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int pauiHuffmanTableDPCM = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; #else pauiHuffmanTable = c_apauiHuffDecTables[iAlloc]; - pauiHuffmanTableDPCM = - c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; + pauiHuffmanTableDPCM = c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; #endif #ifdef USE_DEMOD_TABLES paiDemodTable = c_apaiDemodTables[iAlloc]; diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c index a933b2f7cb..05c992516e 100644 --- a/lib_rend/ivas_CQMFEncoder.c +++ b/lib_rend/ivas_CQMFEncoder.c @@ -37,12 +37,9 @@ #include #include #include -#include "ivas_Tables.h" +#include "ivas_lcld_tables.h" #include "prot.h" #include "ivas_RMSEnvGrouping.h" -#include "ivas_PerceptualModel.h" -#include "ivas_RMSEnvDeltaHuff.h" -#include "ivas_CQMFHuff.h" #include "ivas_cldfb_codec_bitstream.h" #include "ivas_prot_rend.h" #ifdef ENABLE_MS_PRED @@ -1081,12 +1078,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; if ( fVal > 0.0 ) { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 1; } iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; @@ -1096,12 +1093,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; if ( fVal > 0.0 ) { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 1; } @@ -1139,12 +1136,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfReal[iBlockOffset][iFBOffset]; if ( fVal > 0.0 ) { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 1; } iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; @@ -1154,12 +1151,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfImag[iBlockOffset][iFBOffset]; if ( fVal > 0.0 ) { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 1; } iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; @@ -1241,12 +1238,12 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups, fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; if ( fVal > 0.0 ) { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 1; } #ifdef _DEBUG_VERBOSE @@ -1264,12 +1261,12 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups, fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; if ( fVal > 0.0 ) { - iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); + iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 1; } @@ -1357,9 +1354,13 @@ static int32_t CountCQMFBits( const int32_t iNumGroups, if ( iAlloc > 0 ) { +#ifndef ROM_TO_RAM const uint32_t( *pauiHuffmanTable )[2] = NULL; const uint32_t( *pauiHuffmanTableDPCM )[2] = NULL; - +#else + const uint16_t( *pauiHuffmanTable )[2] = NULL; + const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL; +#endif // pauiHuffmanTable = GetHuffEncTable(iAlloc); pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc]; @@ -1805,9 +1806,13 @@ static int32_t WriteCQMFData( const int32_t iNumGroups, if ( iAlloc > 0 ) { - const uint32_t( *pauiHuffmanTable )[2] = NULL; - const uint32_t( *pauiHuffmanTableDPCM )[2] = NULL; - +#ifndef ROM_TO_RAM + const uint32_t(*pauiHuffmanTable)[2] = NULL; + const uint32_t(*pauiHuffmanTableDPCM)[2] = NULL; +#else + const uint16_t(*pauiHuffmanTable)[2] = NULL; + const uint16_t(*pauiHuffmanTableDPCM)[2] = NULL; +#endif // pauiHuffmanTable = GetHuffEncTable(iAlloc); pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc]; diff --git a/lib_rend/ivas_MSPred.c b/lib_rend/ivas_MSPred.c index 3694f07510..cec626c3aa 100644 --- a/lib_rend/ivas_MSPred.c +++ b/lib_rend/ivas_MSPred.c @@ -33,8 +33,7 @@ #include "ivas_MSPred.h" #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT -#include "ivas_Tables.h" -#include "ivas_RMSEnvDeltaHuff.h" +#include "ivas_lcld_tables.h" #include #include #include "prot.h" diff --git a/lib_rend/ivas_PerceptualModel.c b/lib_rend/ivas_PerceptualModel.c index 67adf974a0..2f0072ee97 100644 --- a/lib_rend/ivas_PerceptualModel.c +++ b/lib_rend/ivas_PerceptualModel.c @@ -29,11 +29,9 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ - -#include "ivas_PerceptualModel.h" #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT -#include "ivas_Tables.h" +#include "ivas_lcld_tables.h" #include "prot.h" #include "ivas_prot_rend.h" #include @@ -41,43 +39,6 @@ /* clang-format off */ -#define LOG_ADD_TABLE_LENGTH (512) - -/*TODO : rtyag : move this to tables.c*/ -const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { - 0x40, 0x40, 0x3F, 0x3F, 0x3E, 0x3E, 0x3D, 0x3D, 0x3C, 0x3C, 0x3B, 0x3B, 0x3A, 0x3A, 0x39, 0x39, - 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, - 0x31, 0x31, 0x31, 0x30, 0x30, 0x2F, 0x2F, 0x2F, 0x2E, 0x2E, 0x2D, 0x2D, 0x2D, 0x2C, 0x2C, 0x2B, - 0x2B, 0x2B, 0x2A, 0x2A, 0x2A, 0x29, 0x29, 0x29, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26, - 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21, - 0x20, 0x20, 0x20, 0x20, 0x1F, 0x1F, 0x1F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1D, 0x1D, 0x1D, 0x1C, 0x1C, - 0x1C, 0x1C, 0x1B, 0x1B, 0x1B, 0x1B, 0x1A, 0x1A, 0x1A, 0x1A, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, - 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0F, 0x0F, 0x0F, - 0x0F, 0x0F, 0x0F, 0x0F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0D, 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, - 0x0B, 0x0B, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; static inline int32_t LogAdd(int32_t iVal1,int32_t iVal2) { @@ -97,79 +58,6 @@ static inline int32_t LogAdd(int32_t iVal1,int32_t iVal2) return iRetVal; } -#define PERCEPTUAL_MODEL_SCALE (64) - -#define PERCEPTUAL_MODEL_SCALE_SHIFT (6) - -#define PERCEPTUAL_MODEL_ALPHA_SCALE (614) - -#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE (6827) - -#define PERCEPTUAL_MODEL_ALPHA_SHIFT (11) - -#define PERCEPTUAL_MODEL_SLGAIN_SHIFT (8)//(4) - -const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48] = { - 0,0,0,0,0,0,0,0,0,0,0,64,64,64,64,64, - 101,101,128,165,165,180,213,}; - -const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48] = { - -1787,-1787,-1787,-1787,-1787,-1787,-1787,-1787,-1782,-1761,-1737,-1679,-1638,-1613,-1590,-1568, - -1516,-1459,-1395,-1289,-671,-409,-401,}; - - -#if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4 -const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { - 7,7,6,5,5,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4, -}; -#elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8 -const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { - 112,112,96,80,80,64,64,64,64,64,64,64,64,64,64,64, - 64,64,64,64,64,64,64, -}; -#endif - -const int32_t c_aaiSpreadFunction48[MAX_BANDS_48*MAX_BANDS_48] = { - 0,-1561,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-289,-4,-1234,-2295,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-569,-229, - -8,-905,-1705,-2324,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-789,-445,-173,-16,-656,-1271,-1765,-2172,-2520,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-961,-616,-340,-136, - -28,-488,-976,-1382,-1729,-2032,-2305,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-1088,-743,-465,-257,-148,-31,-371,-769,-1114,-1417,-1689,-2054,-2483, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1198,-852,-574,-364,-209,-148, - -42,-300,-635,-936,-1207,-1572,-2000,-2376,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-1293,-948,-669,-458,-301,-183,-145,-56,-258,-547,-816,-1179,-1606,-1982,-2311, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1375,-1029,-750,-539,-381,-260,-180,-142, - -68,-231,-487,-846,-1272,-1647,-1976,-2261,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1444, - -1099,-820,-608,-449,-328,-233,-194,-138,-77,-213,-555,-978,-1352,-1681,-1966,-2268, - -2552,-2552,-2552,-2552,-2552,-2552,-1501,-1155,-876,-665,-505,-383,-287,-210,-193,-130, - -79,-298,-711,-1083,-1411,-1696,-1997,-2288,-2550,-2552,-2552,-2552,-2552,-1567,-1221,-942, - -730,-570,-448,-351,-272,-206,-189,-151,-72,-349,-713,-1039,-1324,-1625,-1915,-2177, - -2448,-2552,-2552,-2552,-1650,-1304,-1025,-813,-653,-530,-432,-352,-285,-227,-177,-163, - -69,-297,-613,-895,-1195,-1485,-1746,-2017,-2238,-2401,-2545,-1727,-1381,-1102,-890,-730, - -607,-509,-428,-360,-301,-249,-180,-153,-72,-257,-527,-824,-1112,-1373,-1643,-1865, - -2028,-2171,-1798,-1452,-1173,-960,-800,-677,-579,-498,-430,-370,-317,-246,-192,-145, - -76,-224,-505,-790,-1050,-1320,-1540,-1703,-1847,-1860,-1514,-1234,-1022,-862,-738,-640, - -559,-490,-430,-377,-306,-224,-197,-136,-81,-242,-515,-771,-1040,-1260,-1422,-1566, - -1923,-1577,-1297,-1085,-925,-801,-703,-621,-553,-492,-439,-367,-284,-213,-198,-144, - -83,-235,-479,-744,-963,-1125,-1268,-1986,-1640,-1360,-1148,-988,-864,-766,-684,-615, - -555,-501,-429,-345,-273,-211,-204,-146,-89,-216,-465,-680,-841,-984,-2043,-1697, - -1417,-1205,-1044,-921,-822,-741,-672,-611,-557,-485,-401,-328,-264,-211,-205,-140, - -93,-227,-430,-588,-729,-2104,-1758,-1479,-1266,-1106,-982,-884,-802,-733,-673,-619, - -546,-461,-388,-324,-269,-212,-211,-151,-100,-195,-336,-472,-2163,-1817,-1537,-1324, - -1164,-1040,-942,-860,-791,-731,-676,-604,-519,-445,-380,-325,-268,-226,-219,-147, - -114,-167,-280,-2203,-1857,-1577,-1365,-1205,-1081,-982,-901,-831,-771,-717,-644,-559, - -485,-420,-364,-306,-252,-239,-206,-132,-122,-163,-2224,-1878,-1598,-1386,-1225,-1102, - -1003,-921,-852,-792,-737,-665,-580,-505,-441,-385,-326,-271,-222,-224,-176,-121,-114, -}; - - -/* clang-format on */ - - void PerceptualModel( const int32_t iMaxQuantBands, const int32_t *piRMSEnvelope, int32_t *piExcitation, diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h deleted file mode 100644 index da8afca756..0000000000 --- a/lib_rend/ivas_PerceptualModel.h +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************************************** - - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#ifndef _IVAS_PERCEPTUAL_MODEL_H_ -#define _IVAS_PERCEPTUAL_MODEL_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif -#include - void PerceptualModel( const int32_t iMaxQuantBands, - const int32_t *piRMSEnvelope, - int32_t *piExcitation, - int32_t *piSMR ); - - void PerceptualModelStereo( const int32_t iMaxQuantBands, - const int32_t *piMSFlags, - const int32_t *piRMSEnvelope0, - const int32_t *piRMSEnvelope1, - int32_t *piExcitation0, - int32_t *piExcitation1, - int32_t *piSMR0, - int32_t *piSMR1 ); - -#ifdef __cplusplus -} -#endif - -#endif /* _PERCEPTUAL_MODEL_H_ */ diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index 3bab1b9056..0105abedb5 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -38,7 +38,7 @@ #include #include "prot.h" #include "ivas_prot_rend.h" -#include "ivas_Tables.h" +#include "ivas_lcld_tables.h" #include "ivas_PredTables.h" #include "ivas_cldfb_codec_bitstream.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index 56bbca0f73..e982cf7eed 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -36,7 +36,7 @@ #include #include #include -#include "ivas_Tables.h" +#include "ivas_lcld_tables.h" #include "ivas_PredTables.h" #include "prot.h" #include "ivas_prot_rend.h" diff --git a/lib_rend/ivas_RMSEnvDeltaHuff.c b/lib_rend/ivas_RMSEnvDeltaHuff.c deleted file mode 100644 index 0f613a8f47..0000000000 --- a/lib_rend/ivas_RMSEnvDeltaHuff.c +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************************************** - - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#include "ivas_RMSEnvDeltaHuff.h" -#include "ivas_prot_rend.h" -#include "wmc_auto.h" - -/* clang-format off */ -const uint32_t c_aaiRMSEnvHuffEnc[64][2] = -{ - {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0003}, {0x0013, 0x0004}, - {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0012, 0x000b}, {0x000d, 0x0002}, {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000d, 0x0003}, - {0x000b, 0x0002}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0008, 0x0005}, - {0x0008, 0x0006}, {0x0007, 0x0004}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0005, 0x0003}, {0x0004, 0x0002}, {0x0003, 0x0002}, {0x0002, 0x0002}, - {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0008, 0x0007}, {0x0009, 0x0007}, {0x0009, 0x0008}, - {0x0009, 0x0009}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, - {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, -}; - -const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = -{ - {0x0002ffff, 0x0001ffff, 0x0000001d, 0x00000022, 0x0001001e, 0x0001001e, 0x00010021, 0x00010021, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000017, 0x00000018, 0x00000025, 0x00010019, 0x00010019, 0x00010024, 0x00010024, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x0009ffff, 0x0008ffff, 0x0000002c, 0x0000002d, 0x00010010, 0x00010010, 0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x000bffff, 0x000cffff, 0x000affff, 0x00000031, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, - {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, }, - {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, -}; -/* clang-format on */ diff --git a/lib_rend/ivas_RMSEnvDeltaHuff.h b/lib_rend/ivas_RMSEnvDeltaHuff.h deleted file mode 100644 index 25d2fc625e..0000000000 --- a/lib_rend/ivas_RMSEnvDeltaHuff.h +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************************************************** - - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#ifndef _IVAS_RMS_ENV_DELTA_HUFF_H_ -#define _IVAS_RMS_ENV_DELTA_HUFF_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef HUFF_READ_SIZE -#define HUFF_READ_SIZE ( 4 ) -#endif - -#ifndef HUFF_DEC_TABLE_SIZE -#define HUFF_DEC_TABLE_SIZE ( 16 ) -#endif -#include - extern const uint32_t c_aaiRMSEnvHuffEnc[64][2]; - - extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; - -#ifdef __cplusplus -} -#endif - -#endif /* _RMS_ENV_DELTA_HUFF_H_ */ diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c index 64dfe46c84..f5e18c3c1c 100644 --- a/lib_rend/ivas_RMSEnvGrouping.c +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -41,8 +41,7 @@ #include "options.h" #include "prot.h" #include "ivas_prot_rend.h" -#include "ivas_Tables.h" -#include "ivas_RMSEnvDeltaHuff.h" // To compute RMS transmission cost +#include "ivas_lcld_tables.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_Tables.c b/lib_rend/ivas_Tables.c deleted file mode 100644 index 534aff5254..0000000000 --- a/lib_rend/ivas_Tables.c +++ /dev/null @@ -1,200 +0,0 @@ -/****************************************************************************************************** - - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#include "ivas_Tables.h" -#include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT -#include "ivas_prot_rend.h" -#include "wmc_auto.h" - -/* clang-format off */ -const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL+1][2] = { - {1.0f, 0.0f}, /* zero */ - {0.0f, 1.0f}, /* pi/2 */ - {-1.0f, 0.0f}, /* pi */ - {0.0f, -1.0f}, /* 3*pi/2 */ -}; - -/* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */ -const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = { - {-1.00000000f, -0.00000000f}, - {-0.96592583f, -0.25881905f}, - {-0.86602540f, -0.50000000f}, - {-0.70710678f, -0.70710678f}, - {-0.50000000f, -0.86602540f}, - {-0.25881905f, -0.96592583f}, - {0.00000000f, -1.00000000f}, - {0.25881905f, -0.96592583f}, - {0.50000000f, -0.86602540f}, - {0.70710678f, -0.70710678f}, - {0.86602540f, -0.50000000f}, - {0.96592583f, -0.25881905f}, - {1.00000000f, 0.00000000f}, - {0.96592583f, 0.25881905f}, - {0.86602540f, 0.50000000f}, - {0.70710678f, 0.70710678f}, - {0.50000000f, 0.86602540f}, - {0.25881905f, 0.96592583f}, - {0.00000000f, 1.00000000f}, - {-0.25881905f, 0.96592583f}, - {-0.50000000f, 0.86602540f}, - {-0.70710678f, 0.70710678f}, - {-0.86602540f, 0.50000000f}, - {-0.96592583f, 0.25881905f}, - {-1.00000000f, 0.00000000f} -}; - -/* Move this to perceptual model ? */ -const int32_t c_aiBandwidths48[MAX_BANDS_48] = { - 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,4,6,6,7,10, -}; - - -const float c_afScaleFactor[ALLOC_TABLE_SIZE] = { - 0.0f, - 0.353553390593f, - 0.420448207627f, - 0.500000000000f, - 0.594603557501f, - 0.707106781187f, - 0.840896415254f, - 1.000000000000f, - 1.189207115003f, - 1.414213562373f, - 1.681792830507f, - 2.000000000000f, - 2.378414230005f, - 2.828427124746f, - 3.363585661015f, - 4.0f, - 4.756828460011f, - 5.656854249492f, - 6.727171322030f, - 8.0f, - 9.513656920022f, - 11.31370849898f, - 13.45434264406f, - 16.00000000000f, - 19.02731384004f, - 22.62741699797f, - 26.90868528812f, - 32.000000000000000f, - 38.054627680087073f, - 45.254833995939038f, - 53.817370576237735f, - 64.000000000000000f, -}; - -const float c_afInvScaleFactor[ALLOC_TABLE_SIZE] = { - 0.0f, - 2.367513562373095f, - 2.046407115002721f, - 1.775900000000000f, - 1.536446415253715f, - 1.323056781186548f, - 1.132903557501360f, - 0.965800000000000f, - 0.821348207626857f, - 0.695103390593274f, - 0.587801778750680f, - 0.495800000000000f, - 0.418124103813429f, - 0.352176695296637f, - 0.296200889375340f, - 0.249400000000000f, - 0.209812051906714f, - 0.176538347648318f, - 0.148525444687670f, - 0.124900000000000f, - 0.105056025953357f, - 0.088388347648318f, - 0.074325444687670f, - 0.062500000000000f, - 0.052556025953357f, - 0.044194173824159f, - 0.037162722343835f, - 0.031250000000000f, - 0.026278012976679f, - 0.022097086912080f, - 0.018581361171918f, - 0.015625000000000f, -}; - -const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE] = { - 2.32830644e-10f, 3.29272254e-10f, 4.65661287e-10f, 6.58544508e-10f, 9.31322575e-10f, 1.31708902e-09f, 1.86264515e-09f, 2.63417803e-09f, - 3.72529030e-09f, 5.26835606e-09f, 7.45058060e-09f, 1.05367121e-08f, 1.49011612e-08f, 2.10734243e-08f, 2.98023224e-08f, 4.21468485e-08f, - 5.96046448e-08f, 8.42936970e-08f, 1.19209290e-07f, 1.68587394e-07f, 2.38418579e-07f, 3.37174788e-07f, 4.76837158e-07f, 6.74349576e-07f, - 9.53674316e-07f, 1.34869915e-06f, 1.90734863e-06f, 2.69739830e-06f, 3.81469727e-06f, 5.39479661e-06f, 7.62939453e-06f, 1.07895932e-05f, - 1.52587891e-05f, 2.15791864e-05f, 3.05175781e-05f, 4.31583729e-05f, 6.10351562e-05f, 8.63167458e-05f, 1.22070312e-04f, 1.72633492e-04f, - 2.44140625e-04f, 3.45266983e-04f, 4.88281250e-04f, 6.90533966e-04f, 9.76562500e-04f, 1.38106793e-03f, 1.95312500e-03f, 2.76213586e-03f, - 3.90625000e-03f, 5.52427173e-03f, 7.81250000e-03f, 1.10485435e-02f, 1.56250000e-02f, 2.20970869e-02f, 3.12500000e-02f, 4.41941738e-02f, - 6.25000000e-02f, 8.83883476e-02f, 1.25000000e-01f, 1.76776695e-01f, 2.50000000e-01f, 3.53553391e-01f, 5.00000000e-01f, 7.07106781e-01f, - 1.00000000e+00f, 1.41421356e+00f, 2.00000000e+00f, 2.82842712e+00f, 4.00000000e+00f, 5.65685425e+00f, 8.00000000e+00f, 1.13137085e+01f, - 1.60000000e+01f, 2.26274170e+01f, 3.20000000e+01f, 4.52548340e+01f, 6.40000000e+01f, 9.05096680e+01f, 1.28000000e+02f, 1.81019336e+02f, - 2.56000000e+02f, 3.62038672e+02f, 5.12000000e+02f, 7.24077344e+02f, 1.02400000e+03f, 1.44815469e+03f, 2.04800000e+03f, 2.89630938e+03f, - 4.09600000e+03f, 5.79261875e+03f, 8.19200000e+03f, 1.15852375e+04f, 1.63840000e+04f, 2.31704750e+04f, 3.27680000e+04f, 4.63409500e+04f, - 6.55360000e+04f, 9.26819000e+04f, 1.31072000e+05f, 1.85363800e+05f, 2.62144000e+05f, 3.70727600e+05f, 5.24288000e+05f, 7.41455200e+05f, - 1.04857600e+06f, 1.48291040e+06f, 2.09715200e+06f, 2.96582080e+06f, 4.19430400e+06f, 5.93164160e+06f, 8.38860800e+06f, 1.18632832e+07f, - 1.67772160e+07f, 2.37265664e+07f, 3.35544320e+07f, 4.74531328e+07f, 6.71088640e+07f, 9.49062656e+07f, 1.34217728e+08f, 1.89812531e+08f, - 2.68435456e+08f, 3.79625062e+08f, 5.36870912e+08f, 7.59250125e+08f, 1.07374182e+09f, 1.51850025e+09f, 2.14748365e+09f, 3.03700050e+09f, - 4.29496730e+09f, -}; - -const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { - 0, 3, 3, 4, 5, 5, 6, 7, - 8, 9, 12, 13, 16, 17, 19, 23, - 26, 26, 27, 28, 31, 36, 38, 45, - 54, 64, 76, 90, 108, 128, 152, 180, -}; - -const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE] = { - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, -}; - -const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { - 0, 4, 4, 5, 6, 6, 7, 8, - 9, 10, 13, 14, 17, 18, 20, 24, - 27, 27, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, -}; - -const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { - 1, 16, 16, 25, 36, 36, 49, 64, - 81, 100, 169, 196, 289, 324, 400, 576, - 729, 729, 28, 29, 32, 37, 39, 46, - 55, 65, 77, 91, 109, 129, 153, 181, -}; -#endif -/* clang-format on */ diff --git a/lib_rend/ivas_Tables.h b/lib_rend/ivas_Tables.h deleted file mode 100644 index 61abfb30c9..0000000000 --- a/lib_rend/ivas_Tables.h +++ /dev/null @@ -1,128 +0,0 @@ -/****************************************************************************************************** - - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#ifndef _IVAS_TABLES_H_ -#define _IVAS_TABLES_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif -#include -#ifndef M_PI - -#define M_PI 3.14159265358979323846264338327950288f - -#endif - -#define CQMF_BLOCKS_PER_FRAME ( 16 ) -#define CQMF_MAX_BLOCKS_PER_FRAME ( 16 ) -#define CQMF_BANDS ( 60 ) - -#define MAX_BANDS ( 23 ) -#define MAX_BANDS_48 ( 23 ) - - extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this - - -#define ENV_MIN ( -64 ) -#define ENV_MAX ( 64 ) - -#define ENV0_BITS ( 7 ) - -#define ENV_DELTA_MIN ( -32 ) -#define ENV_DELTA_MAX ( 31 ) - -#define ENV_RECONSTRUCT_TABLE_SIZE ( 129 ) - -#define ENV_RECONSTRUCT_TABLE_CENTER ( 64 ) - -#define MIN_ALLOC ( 0 ) -#define MAX_ALLOC ( 31 ) - -#define ALLOC_OFFSET_SCALE ( 8 ) - -#define ALLOC_OFFSET_BITS ( 8 ) - -#define MIN_ALLOC_OFFSET ( -128 ) -#define MAX_ALLOC_OFFSET ( 127 ) -#ifdef ROM_TO_RAM -#define READ_LENGTH ( 4 ) -#endif - -#define ALLOC_TABLE_SIZE ( 32 ) - -#ifndef _PI_ -#define _PI_ ( 3.14159265358979f ) -#endif -#define PRED_MAX_VAL ( 12 ) -#define PRED_MIN_VAL ( -PRED_MAX_VAL ) -#define PRED_QUANT_FACTOR ( (float) PRED_MAX_VAL ) -#define PRED_BAND0_BITS ( 5 ) - -#define PHASE_MAX_VAL ( 12 ) -#define PHASE_MIN_VAL ( -PHASE_MAX_VAL ) -#define PHASE_QUANT_FACTOR ( (float) PHASE_MAX_VAL / _PI_ ) -#define PHASE_DIFF_DIM ( 2 ) -#define PHASE_BAND0_BITS ( 5 ) - -#define SIMPLE_PHASE_MAX_VAL ( 3 ) -#define SIMPLE_PHASE_MIN_VAL ( 0 ) -#define SIMPLE_PHASE_BITS ( 2 ) -#define SIMPLE_PHASE_QUANT_FACTOR ( 2.0f / _PI_ ) - -#define TON_QUOTA_ABS_THRESHOLD ( 8.0f ) -#define TON_QUOTA_INC_THRESHOLD ( 4.0f ) - - extern const float c_afRotRealImag[PRED_MAX_VAL - PRED_MIN_VAL + 1][2]; - extern const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2]; - extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; - - extern const float c_afScaleFactor[ALLOC_TABLE_SIZE]; - - extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE]; - - extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE]; - - extern const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE]; - - extern const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE]; - - extern const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE]; - - extern const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE]; - -#ifdef __cplusplus -} -#endif - -#endif /* _TABLES_H_ */ diff --git a/lib_rend/ivas_CQMFHuff.c b/lib_rend/ivas_lcld_tables.c similarity index 96% rename from lib_rend/ivas_CQMFHuff.c rename to lib_rend/ivas_lcld_tables.c index a5344b9db1..7afb33a184 100644 --- a/lib_rend/ivas_CQMFHuff.c +++ b/lib_rend/ivas_lcld_tables.c @@ -30,14 +30,209 @@ *******************************************************************************************************/ -#include "ivas_CQMFHuff.h" +#include "ivas_lcld_tables.h" #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_prot_rend.h" #include "wmc_auto.h" +#include +#include "prot.h" /* clang-format off */ +const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2] = { + {1.0f, 0.0f}, /* zero */ + {0.0f, 1.0f}, /* pi/2 */ + {-1.0f, 0.0f}, /* pi */ + {0.0f, -1.0f}, /* 3*pi/2 */ +}; + +/* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */ +const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = { + {-1.00000000f, -0.00000000f}, + {-0.96592583f, -0.25881905f}, + {-0.86602540f, -0.50000000f}, + {-0.70710678f, -0.70710678f}, + {-0.50000000f, -0.86602540f}, + {-0.25881905f, -0.96592583f}, + {0.00000000f, -1.00000000f}, + {0.25881905f, -0.96592583f}, + {0.50000000f, -0.86602540f}, + {0.70710678f, -0.70710678f}, + {0.86602540f, -0.50000000f}, + {0.96592583f, -0.25881905f}, + {1.00000000f, 0.00000000f}, + {0.96592583f, 0.25881905f}, + {0.86602540f, 0.50000000f}, + {0.70710678f, 0.70710678f}, + {0.50000000f, 0.86602540f}, + {0.25881905f, 0.96592583f}, + {0.00000000f, 1.00000000f}, + {-0.25881905f, 0.96592583f}, + {-0.50000000f, 0.86602540f}, + {-0.70710678f, 0.70710678f}, + {-0.86602540f, 0.50000000f}, + {-0.96592583f, 0.25881905f}, + {-1.00000000f, 0.00000000f} +}; + +/* Move this to perceptual model ? */ +const int32_t c_aiBandwidths48[MAX_BANDS_48] = { + 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,4,6,6,7,10, +}; + + +const float c_afScaleFactor[ALLOC_TABLE_SIZE] = { + 0.0f, + 0.353553390593f, + 0.420448207627f, + 0.500000000000f, + 0.594603557501f, + 0.707106781187f, + 0.840896415254f, + 1.000000000000f, + 1.189207115003f, + 1.414213562373f, + 1.681792830507f, + 2.000000000000f, + 2.378414230005f, + 2.828427124746f, + 3.363585661015f, + 4.0f, + 4.756828460011f, + 5.656854249492f, + 6.727171322030f, + 8.0f, + 9.513656920022f, + 11.31370849898f, + 13.45434264406f, + 16.00000000000f, + 19.02731384004f, + 22.62741699797f, + 26.90868528812f, + 32.000000000000000f, + 38.054627680087073f, + 45.254833995939038f, + 53.817370576237735f, + 64.000000000000000f, +}; + +const float c_afInvScaleFactor[ALLOC_TABLE_SIZE] = { + 0.0f, + 2.367513562373095f, + 2.046407115002721f, + 1.775900000000000f, + 1.536446415253715f, + 1.323056781186548f, + 1.132903557501360f, + 0.965800000000000f, + 0.821348207626857f, + 0.695103390593274f, + 0.587801778750680f, + 0.495800000000000f, + 0.418124103813429f, + 0.352176695296637f, + 0.296200889375340f, + 0.249400000000000f, + 0.209812051906714f, + 0.176538347648318f, + 0.148525444687670f, + 0.124900000000000f, + 0.105056025953357f, + 0.088388347648318f, + 0.074325444687670f, + 0.062500000000000f, + 0.052556025953357f, + 0.044194173824159f, + 0.037162722343835f, + 0.031250000000000f, + 0.026278012976679f, + 0.022097086912080f, + 0.018581361171918f, + 0.015625000000000f, +}; + +const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE] = { + 2.32830644e-10f, 3.29272254e-10f, 4.65661287e-10f, 6.58544508e-10f, 9.31322575e-10f, 1.31708902e-09f, 1.86264515e-09f, 2.63417803e-09f, + 3.72529030e-09f, 5.26835606e-09f, 7.45058060e-09f, 1.05367121e-08f, 1.49011612e-08f, 2.10734243e-08f, 2.98023224e-08f, 4.21468485e-08f, + 5.96046448e-08f, 8.42936970e-08f, 1.19209290e-07f, 1.68587394e-07f, 2.38418579e-07f, 3.37174788e-07f, 4.76837158e-07f, 6.74349576e-07f, + 9.53674316e-07f, 1.34869915e-06f, 1.90734863e-06f, 2.69739830e-06f, 3.81469727e-06f, 5.39479661e-06f, 7.62939453e-06f, 1.07895932e-05f, + 1.52587891e-05f, 2.15791864e-05f, 3.05175781e-05f, 4.31583729e-05f, 6.10351562e-05f, 8.63167458e-05f, 1.22070312e-04f, 1.72633492e-04f, + 2.44140625e-04f, 3.45266983e-04f, 4.88281250e-04f, 6.90533966e-04f, 9.76562500e-04f, 1.38106793e-03f, 1.95312500e-03f, 2.76213586e-03f, + 3.90625000e-03f, 5.52427173e-03f, 7.81250000e-03f, 1.10485435e-02f, 1.56250000e-02f, 2.20970869e-02f, 3.12500000e-02f, 4.41941738e-02f, + 6.25000000e-02f, 8.83883476e-02f, 1.25000000e-01f, 1.76776695e-01f, 2.50000000e-01f, 3.53553391e-01f, 5.00000000e-01f, 7.07106781e-01f, + 1.00000000e+00f, 1.41421356e+00f, 2.00000000e+00f, 2.82842712e+00f, 4.00000000e+00f, 5.65685425e+00f, 8.00000000e+00f, 1.13137085e+01f, + 1.60000000e+01f, 2.26274170e+01f, 3.20000000e+01f, 4.52548340e+01f, 6.40000000e+01f, 9.05096680e+01f, 1.28000000e+02f, 1.81019336e+02f, + 2.56000000e+02f, 3.62038672e+02f, 5.12000000e+02f, 7.24077344e+02f, 1.02400000e+03f, 1.44815469e+03f, 2.04800000e+03f, 2.89630938e+03f, + 4.09600000e+03f, 5.79261875e+03f, 8.19200000e+03f, 1.15852375e+04f, 1.63840000e+04f, 2.31704750e+04f, 3.27680000e+04f, 4.63409500e+04f, + 6.55360000e+04f, 9.26819000e+04f, 1.31072000e+05f, 1.85363800e+05f, 2.62144000e+05f, 3.70727600e+05f, 5.24288000e+05f, 7.41455200e+05f, + 1.04857600e+06f, 1.48291040e+06f, 2.09715200e+06f, 2.96582080e+06f, 4.19430400e+06f, 5.93164160e+06f, 8.38860800e+06f, 1.18632832e+07f, + 1.67772160e+07f, 2.37265664e+07f, 3.35544320e+07f, 4.74531328e+07f, 6.71088640e+07f, 9.49062656e+07f, 1.34217728e+08f, 1.89812531e+08f, + 2.68435456e+08f, 3.79625062e+08f, 5.36870912e+08f, 7.59250125e+08f, 1.07374182e+09f, 1.51850025e+09f, 2.14748365e+09f, 3.03700050e+09f, + 4.29496730e+09f, +}; + +const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { + 0, 3, 3, 4, 5, 5, 6, 7, + 8, 9, 12, 13, 16, 17, 19, 23, + 26, 26, 27, 28, 31, 36, 38, 45, + 54, 64, 76, 90, 108, 128, 152, 180, +}; + +const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE] = { + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, +}; + +const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { + 0, 4, 4, 5, 6, 6, 7, 8, + 9, 10, 13, 14, 17, 18, 20, 24, + 27, 27, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, +}; + +const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { + 1, 16, 16, 25, 36, 36, 49, 64, + 81, 100, 169, 196, 289, 324, 400, 576, + 729, 729, 28, 29, 32, 37, 39, 46, + 55, 65, 77, 91, 109, 129, 153, 181, +}; + +const uint32_t c_aaiRMSEnvHuffEnc[64][2] = +{ + {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0003}, {0x0013, 0x0004}, + {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0012, 0x000b}, {0x000d, 0x0002}, {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000d, 0x0003}, + {0x000b, 0x0002}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0008, 0x0005}, + {0x0008, 0x0006}, {0x0007, 0x0004}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0005, 0x0003}, {0x0004, 0x0002}, {0x0003, 0x0002}, {0x0002, 0x0002}, + {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0008, 0x0007}, {0x0009, 0x0007}, {0x0009, 0x0008}, + {0x0009, 0x0009}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, + {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, + {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, +}; + +const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = +{ + {0x0002ffff, 0x0001ffff, 0x0000001d, 0x00000022, 0x0001001e, 0x0001001e, 0x00010021, 0x00010021, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, + {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, + {0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000017, 0x00000018, 0x00000025, 0x00010019, 0x00010019, 0x00010024, 0x00010024, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, + {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, + {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, + {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, + {0x0009ffff, 0x0008ffff, 0x0000002c, 0x0000002d, 0x00010010, 0x00010010, 0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, + {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, + {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, + {0x000bffff, 0x000cffff, 0x000affff, 0x00000031, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, + {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, + {0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, }, + {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, +}; + +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc1[16][2] = +#else +const uint16_t c_aauiCQMFHuffEnc1[16][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0005, 0x0001}, {0x000b, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x0001}, {0x0006, 0x0001}, {0x0008, 0x0001}, {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, @@ -50,9 +245,13 @@ const uint32_t c_aauiCQMFHuffDec1[3][16] = {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, {0x00010003, 0x00010003, 0x00010007, 0x00010007, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc2[16][2] = +#else +const uint16_t c_aauiCQMFHuffEnc2[16][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0005, 0x0001}, {0x000c, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000c, 0x0001}, {0x0006, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000b, 0x0003}, @@ -66,8 +265,11 @@ const uint32_t c_aauiCQMFHuffDec2[3][16] = {0x00000003, 0x00000007, 0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0001000f, 0x0001000f, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, }; #endif - +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc3[25][2] = +#else +const uint16_t c_aauiCQMFHuffEnc3[25][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x0009, 0x0001}, @@ -91,7 +293,12 @@ const uint32_t c_aauiCQMFHuffDec3[10][16] = {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, }; #endif + +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc4[36][2] = +#else +const uint16_t c_aauiCQMFHuffEnc4[36][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0010, 0x0000}, {0x0010, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000e, 0x0006}, @@ -110,8 +317,13 @@ const uint32_t c_aauiCQMFHuffDec4[5][16] = {0x0000001f, 0x00000020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, {0x00000004, 0x00000005, 0x0000000a, 0x0000000b, 0x00000010, 0x00000011, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc5[36][2] = +#else +const uint16_t c_aauiCQMFHuffEnc5[36][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0008}, {0x0012, 0x0001}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000c, 0x0001}, @@ -135,8 +347,13 @@ const uint32_t c_aauiCQMFHuffDec5[10][16] = {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc6[49][2] = +#else +const uint16_t c_aauiCQMFHuffEnc6[49][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0003}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x0010, 0x0004}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, @@ -159,8 +376,13 @@ const uint32_t c_aauiCQMFHuffDec6[7][16] = {0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00010024, 0x00010024, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, {0x00000005, 0x00000006, 0x0000000c, 0x0000000d, 0x00000013, 0x00000014, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000025, 0x00000026, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc7[64][2] = +#else +const uint16_t c_aauiCQMFHuffEnc7[64][2] = +#endif { {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0002}, {0x0015, 0x0000}, {0x0015, 0x0001}, {0x0015, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000f, 0x0003}, {0x0014, 0x0011}, {0x0015, 0x0003}, {0x0015, 0x0004}, @@ -201,9 +423,13 @@ const uint32_t c_aauiCQMFHuffDec7[25][16] = {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc8[81][2] = +#else +const uint16_t c_aauiCQMFHuffEnc8[81][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0002}, {0x0014, 0x0008}, {0x0017, 0x0000}, {0x0017, 0x0001}, {0x0017, 0x0002}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0004}, {0x0015, 0x000d}, @@ -239,9 +465,13 @@ const uint32_t c_aauiCQMFHuffDec8[16][16] = {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc9[100][2] = +#else +const uint16_t c_aauiCQMFHuffEnc9[100][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000d, 0x0002}, {0x0011, 0x0004}, {0x0014, 0x000a}, {0x0017, 0x0000}, {0x0017, 0x0001}, {0x0017, 0x0002}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0003}, {0x0010, 0x0004}, @@ -285,9 +515,13 @@ const uint32_t c_aauiCQMFHuffDec9[22][16] = {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc10[169][2] = +#else +const uint16_t c_aauiCQMFHuffEnc10[169][2] = +#endif { {0x0001, 0x0001}, {0x0004, 0x0002}, {0x0005, 0x0002}, {0x0007, 0x0002}, {0x000a, 0x0002}, {0x000e, 0x0004}, {0x0011, 0x0007}, {0x0013, 0x0012}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0004, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0004}, @@ -363,9 +597,13 @@ const uint32_t c_aauiCQMFHuffDec10[45][16] = {0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc11[196][2] = +#else +const uint16_t c_aauiCQMFHuffEnc11[196][2] = +#endif { {0x0001, 0x0001}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x000f, 0x0005}, {0x0012, 0x000d}, {0x0014, 0x001f}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0004, 0x0004}, {0x0003, 0x0003}, @@ -449,9 +687,13 @@ const uint32_t c_aauiCQMFHuffDec11[50][16] = {0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200bd, }, {0x000200be, 0x000200be, 0x000200be, 0x000200be, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc12[289][2] = +#else +const uint16_t c_aauiCQMFHuffEnc12[289][2] = +#endif { {0x0001, 0x0001}, {0x0004, 0x0004}, {0x0005, 0x0004}, {0x0007, 0x0004}, {0x0008, 0x0002}, {0x000b, 0x0004}, {0x000e, 0x0006}, {0x0010, 0x0009}, {0x0012, 0x0014}, {0x0013, 0x001f}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0016, 0x0005}, @@ -573,8 +815,13 @@ const uint32_t c_aauiCQMFHuffDec12[76][16] = {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020118, 0x00020118, 0x00020118, 0x00020118, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x0002011a, 0x0002011a, 0x0002011a, 0x0002011a, }, {0x0002011b, 0x0002011b, 0x0002011b, 0x0002011b, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011e, 0x0002011e, 0x0002011e, 0x0002011e, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc13[324][2] = +#else +const uint16_t c_aauiCQMFHuffEnc13[324][2] = +#endif { {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0006, 0x0004}, {0x0008, 0x0005}, {0x000a, 0x0005}, {0x000c, 0x0007}, {0x000e, 0x000b}, {0x0010, 0x0011}, {0x0012, 0x002d}, {0x0015, 0x0000}, {0x0014, 0x0035}, {0x0015, 0x0001}, {0x0015, 0x0002}, {0x0015, 0x0003}, @@ -713,8 +960,13 @@ const uint32_t c_aauiCQMFHuffDec13[89][16] = {0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, }, {0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc14[400][2] = +#else +const uint16_t c_aauiCQMFHuffEnc14[400][2] = +#endif { {0x0005, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0006}, {0x0007, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x0008}, {0x000d, 0x000c}, {0x000f, 0x0013}, {0x0010, 0x001b}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, @@ -825,8 +1077,13 @@ const uint32_t c_aauiCQMFHuffDec14[53][16] = {0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, 0x0000017a, 0x0000017b, }, {0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc15[576][2] = +#else +const uint16_t c_aauiCQMFHuffEnc15[576][2] = +#endif { {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0007, 0x0008}, {0x0008, 0x0009}, {0x0009, 0x0008}, {0x000b, 0x000b}, {0x000d, 0x000e}, {0x000e, 0x0011}, {0x000f, 0x001a}, {0x0012, 0x006e}, {0x0014, 0x0000}, {0x0013, 0x00cc}, {0x0014, 0x0001}, @@ -979,9 +1236,13 @@ const uint32_t c_aauiCQMFHuffDec15[73][16] = {0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, 0x0000021e, 0x0000021f, 0x00000220, 0x00000221, 0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, }, {0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, 0x0000022e, 0x0000022f, 0x00000230, 0x00000231, 0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc16[729][2] = +#else +const uint16_t c_aauiCQMFHuffEnc16[729][2] = +#endif { {0x0006, 0x000d}, {0x0005, 0x0010}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x000a}, {0x0009, 0x000b}, {0x000b, 0x000d}, {0x000c, 0x000e}, {0x000e, 0x0016}, {0x0010, 0x002d}, {0x0011, 0x0051}, {0x0012, 0x008c}, {0x0014, 0x0000}, @@ -1167,9 +1428,13 @@ const uint32_t c_aauiCQMFHuffDec16[85][16] = {0x000002b2, 0x000002b3, 0x000002b4, 0x000002b5, 0x000002b6, 0x000002b7, 0x000002b8, 0x000002b9, 0x000002ba, 0x000002bb, 0x000002bc, 0x000002bd, 0x000002be, 0x000002bf, 0x000002c0, 0x000002c1, }, {0x000002c2, 0x000002c3, 0x000002c4, 0x000002c5, 0x000002c6, 0x000002c7, 0x000002c8, 0x000002c9, 0x000002ca, 0x000002cb, 0x000002cc, 0x000002cd, 0x000002ce, 0x000002cf, 0x000002d0, 0x000002d1, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc17[729][2] = +#else +const uint16_t c_aauiCQMFHuffEnc17[729][2] = +#endif { {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000e}, {0x0008, 0x000f}, {0x0009, 0x000f}, {0x000a, 0x000f}, {0x000c, 0x0011}, {0x000d, 0x0014}, {0x000e, 0x0017}, {0x0010, 0x002d}, {0x0011, 0x004c}, @@ -1363,9 +1628,13 @@ const uint32_t c_aauiCQMFHuffDec17[93][16] = {0x0000028e, 0x0000028f, 0x00000290, 0x00000291, 0x00000292, 0x00000293, 0x00000294, 0x00000295, 0x00000296, 0x00000297, 0x00000298, 0x00000299, 0x0000029a, 0x0000029b, 0x0000029c, 0x0000029d, }, {0x0000029e, 0x0000029f, 0x000002a0, 0x000002a1, 0x000002a2, 0x000002a3, 0x000002a4, 0x000002a5, 0x000002a6, 0x000002a7, 0x000002a8, 0x000002a9, 0x000002aa, 0x000002ab, 0x000002ac, 0x000002ad, }, }; -#endif +#endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc18[28][2] = +#else +const uint16_t c_aauiCQMFHuffEnc18[28][2] = +#endif { {0x0004, 0x0001}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, @@ -1384,8 +1653,13 @@ const uint32_t c_aauiCQMFHuffDec18[6][16] = {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc19[29][2] = +#else +const uint16_t c_aauiCQMFHuffEnc19[29][2] = +#endif { {0x0004, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0001}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, @@ -1404,8 +1678,13 @@ const uint32_t c_aauiCQMFHuffDec19[6][16] = {0x0005ffff, 0x00000016, 0x00010015, 0x00010015, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc20[32][2] = +#else +const uint16_t c_aauiCQMFHuffEnc20[32][2] = +#endif { {0x0004, 0x0002}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0006, 0x0002}, {0x0006, 0x0003}, @@ -1423,8 +1702,13 @@ const uint32_t c_aauiCQMFHuffDec20[6][16] = {0x0005ffff, 0x00000019, 0x00010018, 0x00010018, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, {0x0000001b, 0x0000001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc21[37][2] = +#else +const uint16_t c_aauiCQMFHuffEnc21[37][2] = +#endif { {0x0005, 0x0002}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0002}, @@ -1445,8 +1729,13 @@ const uint32_t c_aauiCQMFHuffDec21[7][16] = {0x0006ffff, 0x0000001e, 0x0001001d, 0x0001001d, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, {0x00000020, 0x00000021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc22[39][2] = +#else +const uint16_t c_aauiCQMFHuffEnc22[39][2] = +#endif { {0x0005, 0x0002}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, @@ -1469,8 +1758,13 @@ const uint32_t c_aauiCQMFHuffDec22[9][16] = {0x0008ffff, 0x00000025, 0x00010022, 0x00010022, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc23[46][2] = +#else +const uint16_t c_aauiCQMFHuffEnc23[46][2] = +#endif { {0x0005, 0x0003}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, @@ -1497,8 +1791,13 @@ const uint32_t c_aauiCQMFHuffDec23[12][16] = {0x000bffff, 0x0000002a, 0x00010029, 0x00010029, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, {0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc24[55][2] = +#else +const uint16_t c_aauiCQMFHuffEnc24[55][2] = +#endif { {0x0005, 0x0004}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, @@ -1531,8 +1830,13 @@ const uint32_t c_aauiCQMFHuffDec24[17][16] = {0x0010ffff, 0x00000032, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, {0x00010034, 0x00010034, 0x00010036, 0x00010036, 0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc25[65][2] = +#else +const uint16_t c_aauiCQMFHuffEnc25[65][2] = +#endif { {0x0005, 0x0005}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x0006}, {0x0004, 0x000f}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, @@ -1569,8 +1873,13 @@ const uint32_t c_aauiCQMFHuffDec25[19][16] = {0x0012ffff, 0x00000038, 0x0000003a, 0x0000003b, 0x0000003c, 0x0000003d, 0x00010035, 0x00010035, 0x00010037, 0x00010037, 0x00010039, 0x00010039, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc26[77][2] = +#else +const uint16_t c_aauiCQMFHuffEnc26[77][2] = +#endif { {0x0006, 0x0004}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, @@ -1615,8 +1924,13 @@ const uint32_t c_aauiCQMFHuffDec26[26][16] = {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc27[91][2] = +#else +const uint16_t c_aauiCQMFHuffEnc27[91][2] = +#endif { {0x0006, 0x0006}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, @@ -1665,8 +1979,13 @@ const uint32_t c_aauiCQMFHuffDec27[28][16] = {0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc28[109][2] = +#else +const uint16_t c_aauiCQMFHuffEnc28[109][2] = +#endif { {0x0006, 0x0008}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, @@ -1719,8 +2038,13 @@ const uint32_t c_aauiCQMFHuffDec28[30][16] = {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, {0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc29[129][2] = +#else +const uint16_t c_aauiCQMFHuffEnc29[129][2] = +#endif { {0x0006, 0x0009}, {0x0005, 0x0019}, {0x0006, 0x000a}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0006, 0x000b}, {0x0005, 0x001d}, {0x0005, 0x001e}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0005, 0x001f}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, @@ -1780,8 +2104,13 @@ const uint32_t c_aauiCQMFHuffDec29[34][16] = {0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc30[153][2] = +#else +const uint16_t c_aauiCQMFHuffEnc30[153][2] = +#endif { {0x0007, 0x0009}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, @@ -1849,8 +2178,13 @@ const uint32_t c_aauiCQMFHuffDec30[39][16] = {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, }, {0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc31[181][2] = +#else +const uint16_t c_aauiCQMFHuffEnc31[181][2] = +#endif { {0x0007, 0x000b}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, {0x0006, 0x0023}, @@ -1925,8 +2259,13 @@ const uint32_t c_aauiCQMFHuffDec31[43][16] = {0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, }, {0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc33[16][2] = +#else +const uint16_t c_aauiCQMFHuffEnc33[16][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, @@ -1938,8 +2277,13 @@ const uint32_t c_aauiCQMFHuffDec33[2][16] = {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc34[16][2] = +#else +const uint16_t c_aauiCQMFHuffEnc34[16][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, @@ -1951,8 +2295,13 @@ const uint32_t c_aauiCQMFHuffDec34[2][16] = {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc35[25][2] = +#else +const uint16_t c_aauiCQMFHuffEnc35[25][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0007, 0x0006}, {0x0009, 0x0000}, {0x0009, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0007, 0x0007}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, @@ -1974,8 +2323,13 @@ const uint32_t c_aauiCQMFHuffDec35[9][16] = {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc36[36][2] = +#else +const uint16_t c_aauiCQMFHuffEnc36[36][2] = +#endif { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0002}, {0x000b, 0x0000}, {0x000b, 0x0001}, {0x000b, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x0006, 0x0003}, {0x0007, 0x0003}, {0x000b, 0x0006}, {0x000b, 0x0007}, @@ -1996,8 +2350,13 @@ const uint32_t c_aauiCQMFHuffDec36[7][16] = {0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, }, {0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc37[36][2] = +#else +const uint16_t c_aauiCQMFHuffEnc37[36][2] = +#endif { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0000}, {0x000c, 0x0001}, {0x000c, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0006, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x000a, 0x0007}, {0x000c, 0x0006}, @@ -2015,8 +2374,13 @@ const uint32_t c_aauiCQMFHuffDec37[4][16] = {0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00010023, 0x00010023, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, {0x00000003, 0x00000004, 0x00000005, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc38[49][2] = +#else +const uint16_t c_aauiCQMFHuffEnc38[49][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0012}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x000d, 0x0002}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x000a}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x0006, 0x0002}, {0x0006, 0x0003}, @@ -2054,8 +2418,13 @@ const uint32_t c_aauiCQMFHuffDec38[22][16] = {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc39[64][2] = +#else +const uint16_t c_aauiCQMFHuffEnc39[64][2] = +#endif { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0002}, {0x000f, 0x0000}, {0x000f, 0x0001}, {0x000f, 0x0002}, {0x000f, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, {0x000f, 0x0007}, @@ -2083,8 +2452,13 @@ const uint32_t c_aauiCQMFHuffDec39[12][16] = {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc40[81][2] = +#else +const uint16_t c_aauiCQMFHuffEnc40[81][2] = +#endif { {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000f, 0x0011}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x000e, 0x0009}, {0x0011, 0x0004}, {0x0011, 0x0005}, @@ -2099,6 +2473,7 @@ const uint32_t c_aauiCQMFHuffEnc40[81][2] = {0x0010, 0x0021}, }; + #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec40[36][16] = { @@ -2139,8 +2514,13 @@ const uint32_t c_aauiCQMFHuffDec40[36][16] = {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc41[100][2] = +#else +const uint16_t c_aauiCQMFHuffEnc41[100][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0014}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x000b}, {0x0013, 0x0005}, @@ -2178,8 +2558,13 @@ const uint32_t c_aauiCQMFHuffDec41[16][16] = {0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, }, {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc42[169][2] = +#else +const uint16_t c_aauiCQMFHuffEnc42[169][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000e, 0x0006}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, @@ -2238,8 +2623,13 @@ const uint32_t c_aauiCQMFHuffDec42[28][16] = {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, }, {0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc43[196][2] = +#else +const uint16_t c_aauiCQMFHuffEnc43[196][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000c, 0x0003}, {0x0010, 0x0017}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0003, 0x0002}, {0x0003, 0x0003}, @@ -2305,8 +2695,13 @@ const uint32_t c_aauiCQMFHuffDec43[32][16] = {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc44[289][2] = +#else +const uint16_t c_aauiCQMFHuffEnc44[289][2] = +#endif { {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0002}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000f, 0x000a}, {0x0011, 0x0022}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, @@ -2379,8 +2774,13 @@ const uint32_t c_aauiCQMFHuffDec44[27][16] = {0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, }, {0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc45[324][2] = +#else +const uint16_t c_aauiCQMFHuffEnc45[324][2] = +#endif { {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0005}, {0x0010, 0x0025}, {0x0012, 0x0088}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, @@ -2480,8 +2880,13 @@ const uint32_t c_aauiCQMFHuffDec45[50][16] = {0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, }, {0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc46[400][2] = +#else +const uint16_t c_aauiCQMFHuffEnc46[400][2] = +#endif { {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0004}, {0x0009, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x000a}, {0x000f, 0x0018}, {0x0012, 0x00a6}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, @@ -2600,8 +3005,13 @@ const uint32_t c_aauiCQMFHuffDec46[61][16] = {0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, }, {0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc47[576][2] = +#else +const uint16_t c_aauiCQMFHuffEnc47[576][2] = +#endif { {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0005}, {0x0006, 0x0004}, {0x0008, 0x0006}, {0x000a, 0x0007}, {0x000c, 0x000b}, {0x000d, 0x000d}, {0x0010, 0x0041}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, @@ -2768,8 +3178,13 @@ const uint32_t c_aauiCQMFHuffDec47[87][16] = {0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, }, {0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc48[729][2] = +#else +const uint16_t c_aauiCQMFHuffEnc48[729][2] = +#endif { {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0006}, {0x0006, 0x0006}, {0x0008, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x000b}, {0x000c, 0x000d}, {0x000f, 0x0030}, {0x0010, 0x0055}, {0x0012, 0x0136}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, @@ -2980,8 +3395,13 @@ const uint32_t c_aauiCQMFHuffDec48[110][16] = {0x000102c4, 0x000102c4, 0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, }, {0x000102cc, 0x000102cc, 0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, }, }; + #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc49[729][2] = +#else +const uint16_t c_aauiCQMFHuffEnc49[729][2] = +#endif { {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0007}, {0x0007, 0x000a}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0009, 0x0009}, {0x000b, 0x000d}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x0010, 0x0052}, {0x0011, 0x0098}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, @@ -3077,7 +3497,6 @@ const uint32_t c_aauiCQMFHuffEnc49[729][2] = {0x0013, 0x0253}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec49[113][16] = { @@ -3196,7 +3615,11 @@ const uint32_t c_aauiCQMFHuffDec49[113][16] = {0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, 0x000102d4, 0x000102d4, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc50[28][2] = +#else +const uint16_t c_aauiCQMFHuffEnc50[28][2] = +#endif { {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, @@ -3204,7 +3627,6 @@ const uint32_t c_aauiCQMFHuffEnc50[28][2] = {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec50[6][16] = { @@ -3216,7 +3638,11 @@ const uint32_t c_aauiCQMFHuffDec50[6][16] = {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc51[29][2] = +#else +const uint16_t c_aauiCQMFHuffEnc51[29][2] = +#endif { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0001}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, @@ -3224,7 +3650,6 @@ const uint32_t c_aauiCQMFHuffEnc51[29][2] = {0x0013, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec51[6][16] = { @@ -3236,14 +3661,17 @@ const uint32_t c_aauiCQMFHuffDec51[6][16] = {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc52[32][2] = +#else +const uint16_t c_aauiCQMFHuffEnc52[32][2] = +#endif { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0014, 0x0000}, {0x0013, 0x0003}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0004}, {0x0013, 0x0005}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec52[7][16] = { @@ -3256,7 +3684,11 @@ const uint32_t c_aauiCQMFHuffDec52[7][16] = {0x00000017, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x00010018, 0x00010018, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc53[37][2] = +#else +const uint16_t c_aauiCQMFHuffEnc53[37][2] = +#endif { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000b, 0x0002}, @@ -3265,7 +3697,6 @@ const uint32_t c_aauiCQMFHuffEnc53[37][2] = {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec53[9][16] = { @@ -3280,7 +3711,11 @@ const uint32_t c_aauiCQMFHuffDec53[9][16] = {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc54[39][2] = +#else +const uint16_t c_aauiCQMFHuffEnc54[39][2] = +#endif { {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0008, 0x0002}, @@ -3289,7 +3724,6 @@ const uint32_t c_aauiCQMFHuffEnc54[39][2] = {0x0011, 0x0003}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec54[9][16] = { @@ -3304,7 +3738,11 @@ const uint32_t c_aauiCQMFHuffDec54[9][16] = {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc55[46][2] = +#else +const uint16_t c_aauiCQMFHuffEnc55[46][2] = +#endif { {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0007, 0x0004}, @@ -3314,7 +3752,6 @@ const uint32_t c_aauiCQMFHuffEnc55[46][2] = {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec55[10][16] = { @@ -3330,7 +3767,11 @@ const uint32_t c_aauiCQMFHuffDec55[10][16] = {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc56[55][2] = +#else +const uint16_t c_aauiCQMFHuffEnc56[55][2] = +#endif { {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0003}, {0x0007, 0x0004}, @@ -3341,7 +3782,6 @@ const uint32_t c_aauiCQMFHuffEnc56[55][2] = {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec56[12][16] = { @@ -3359,7 +3799,11 @@ const uint32_t c_aauiCQMFHuffDec56[12][16] = {0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc57[65][2] = +#else +const uint16_t c_aauiCQMFHuffEnc57[65][2] = +#endif { {0x0003, 0x0004}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, @@ -3372,7 +3816,6 @@ const uint32_t c_aauiCQMFHuffEnc57[65][2] = {0x0013, 0x000d}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec57[14][16] = { @@ -3392,7 +3835,11 @@ const uint32_t c_aauiCQMFHuffDec57[14][16] = {0x0001002f, 0x0001002f, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc58[77][2] = +#else +const uint16_t c_aauiCQMFHuffEnc58[77][2] = +#endif { {0x0004, 0x0005}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, @@ -3406,7 +3853,6 @@ const uint32_t c_aauiCQMFHuffEnc58[77][2] = {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec58[17][16] = { @@ -3429,7 +3875,11 @@ const uint32_t c_aauiCQMFHuffDec58[17][16] = {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc59[91][2] = +#else +const uint16_t c_aauiCQMFHuffEnc59[91][2] = +#endif { {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, @@ -3445,7 +3895,6 @@ const uint32_t c_aauiCQMFHuffEnc59[91][2] = {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0012, 0x000f}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec59[20][16] = { @@ -3471,7 +3920,11 @@ const uint32_t c_aauiCQMFHuffDec59[20][16] = {0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc60[109][2] = +#else +const uint16_t c_aauiCQMFHuffEnc60[109][2] = +#endif { {0x0004, 0x0007}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, @@ -3489,7 +3942,6 @@ const uint32_t c_aauiCQMFHuffEnc60[109][2] = {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0012, 0x0013}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec60[24][16] = { @@ -3519,7 +3971,11 @@ const uint32_t c_aauiCQMFHuffDec60[24][16] = {0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc61[129][2] = +#else +const uint16_t c_aauiCQMFHuffEnc61[129][2] = +#endif { {0x0004, 0x0008}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0006, 0x0008}, {0x0006, 0x0009}, @@ -3540,7 +3996,6 @@ const uint32_t c_aauiCQMFHuffEnc61[129][2] = {0x0012, 0x0029}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec61[33][16] = { @@ -3579,7 +4034,11 @@ const uint32_t c_aauiCQMFHuffDec61[33][16] = {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc62[153][2] = +#else +const uint16_t c_aauiCQMFHuffEnc62[153][2] = +#endif { {0x0004, 0x0009}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, @@ -3603,7 +4062,6 @@ const uint32_t c_aauiCQMFHuffEnc62[153][2] = {0x0011, 0x001d}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec62[41][16] = { @@ -3650,7 +4108,11 @@ const uint32_t c_aauiCQMFHuffDec62[41][16] = {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, }; #endif +#ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffEnc63[181][2] = +#else +const uint16_t c_aauiCQMFHuffEnc63[181][2] = +#endif { {0x0004, 0x0008}, {0x0003, 0x0005}, {0x0002, 0x0003}, {0x0004, 0x0009}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, @@ -3677,7 +4139,6 @@ const uint32_t c_aauiCQMFHuffEnc63[181][2] = {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, }; - #ifndef ROM_TO_RAM const uint32_t c_aauiCQMFHuffDec63[39][16] = { @@ -3722,74 +4183,80 @@ const uint32_t c_aauiCQMFHuffDec63[39][16] = {0x00000075, 0x00000079, 0x0000007f, 0x00000081, 0x00000082, 0x00000083, 0x00000085, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x00000090, }, }; #endif -const uint32_t (*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = { - NULL, - c_aauiCQMFHuffEnc1, - c_aauiCQMFHuffEnc2, - c_aauiCQMFHuffEnc3, - c_aauiCQMFHuffEnc4, - c_aauiCQMFHuffEnc5, - c_aauiCQMFHuffEnc6, - c_aauiCQMFHuffEnc7, - c_aauiCQMFHuffEnc8, - c_aauiCQMFHuffEnc9, - c_aauiCQMFHuffEnc10, - c_aauiCQMFHuffEnc11, - c_aauiCQMFHuffEnc12, - c_aauiCQMFHuffEnc13, - c_aauiCQMFHuffEnc14, - c_aauiCQMFHuffEnc15, - c_aauiCQMFHuffEnc16, - c_aauiCQMFHuffEnc17, - c_aauiCQMFHuffEnc18, - c_aauiCQMFHuffEnc19, - c_aauiCQMFHuffEnc20, - c_aauiCQMFHuffEnc21, - c_aauiCQMFHuffEnc22, - c_aauiCQMFHuffEnc23, - c_aauiCQMFHuffEnc24, - c_aauiCQMFHuffEnc25, - c_aauiCQMFHuffEnc26, - c_aauiCQMFHuffEnc27, - c_aauiCQMFHuffEnc28, - c_aauiCQMFHuffEnc29, - c_aauiCQMFHuffEnc30, - c_aauiCQMFHuffEnc31, - NULL, - c_aauiCQMFHuffEnc33, - c_aauiCQMFHuffEnc34, - c_aauiCQMFHuffEnc35, - c_aauiCQMFHuffEnc36, - c_aauiCQMFHuffEnc37, - c_aauiCQMFHuffEnc38, - c_aauiCQMFHuffEnc39, - c_aauiCQMFHuffEnc40, - c_aauiCQMFHuffEnc41, - c_aauiCQMFHuffEnc42, - c_aauiCQMFHuffEnc43, - c_aauiCQMFHuffEnc44, - c_aauiCQMFHuffEnc45, - c_aauiCQMFHuffEnc46, - c_aauiCQMFHuffEnc47, - c_aauiCQMFHuffEnc48, - c_aauiCQMFHuffEnc49, - c_aauiCQMFHuffEnc50, - c_aauiCQMFHuffEnc51, - c_aauiCQMFHuffEnc52, - c_aauiCQMFHuffEnc53, - c_aauiCQMFHuffEnc54, - c_aauiCQMFHuffEnc55, - c_aauiCQMFHuffEnc56, - c_aauiCQMFHuffEnc57, - c_aauiCQMFHuffEnc58, - c_aauiCQMFHuffEnc59, - c_aauiCQMFHuffEnc60, - c_aauiCQMFHuffEnc61, - c_aauiCQMFHuffEnc62, - c_aauiCQMFHuffEnc63, + +#ifndef ROM_TO_RAM +const uint32_t(*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = +#else +const uint16_t(*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = +#endif +{ + NULL, + c_aauiCQMFHuffEnc1, + c_aauiCQMFHuffEnc2, + c_aauiCQMFHuffEnc3, + c_aauiCQMFHuffEnc4, + c_aauiCQMFHuffEnc5, + c_aauiCQMFHuffEnc6, + c_aauiCQMFHuffEnc7, + c_aauiCQMFHuffEnc8, + c_aauiCQMFHuffEnc9, + c_aauiCQMFHuffEnc10, + c_aauiCQMFHuffEnc11, + c_aauiCQMFHuffEnc12, + c_aauiCQMFHuffEnc13, + c_aauiCQMFHuffEnc14, + c_aauiCQMFHuffEnc15, + c_aauiCQMFHuffEnc16, + c_aauiCQMFHuffEnc17, + c_aauiCQMFHuffEnc18, + c_aauiCQMFHuffEnc19, + c_aauiCQMFHuffEnc20, + c_aauiCQMFHuffEnc21, + c_aauiCQMFHuffEnc22, + c_aauiCQMFHuffEnc23, + c_aauiCQMFHuffEnc24, + c_aauiCQMFHuffEnc25, + c_aauiCQMFHuffEnc26, + c_aauiCQMFHuffEnc27, + c_aauiCQMFHuffEnc28, + c_aauiCQMFHuffEnc29, + c_aauiCQMFHuffEnc30, + c_aauiCQMFHuffEnc31, + NULL, + c_aauiCQMFHuffEnc33, + c_aauiCQMFHuffEnc34, + c_aauiCQMFHuffEnc35, + c_aauiCQMFHuffEnc36, + c_aauiCQMFHuffEnc37, + c_aauiCQMFHuffEnc38, + c_aauiCQMFHuffEnc39, + c_aauiCQMFHuffEnc40, + c_aauiCQMFHuffEnc41, + c_aauiCQMFHuffEnc42, + c_aauiCQMFHuffEnc43, + c_aauiCQMFHuffEnc44, + c_aauiCQMFHuffEnc45, + c_aauiCQMFHuffEnc46, + c_aauiCQMFHuffEnc47, + c_aauiCQMFHuffEnc48, + c_aauiCQMFHuffEnc49, + c_aauiCQMFHuffEnc50, + c_aauiCQMFHuffEnc51, + c_aauiCQMFHuffEnc52, + c_aauiCQMFHuffEnc53, + c_aauiCQMFHuffEnc54, + c_aauiCQMFHuffEnc55, + c_aauiCQMFHuffEnc56, + c_aauiCQMFHuffEnc57, + c_aauiCQMFHuffEnc58, + c_aauiCQMFHuffEnc59, + c_aauiCQMFHuffEnc60, + c_aauiCQMFHuffEnc61, + c_aauiCQMFHuffEnc62, + c_aauiCQMFHuffEnc63, }; #ifndef ROM_TO_RAM -const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE] = { +const uint32_t(*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE] = { NULL, c_aauiCQMFHuffDec1, c_aauiCQMFHuffDec2, @@ -3857,7 +4324,7 @@ const uint32_t (*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE }; #else const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE] = -{ 0, 16, 16, 25, 36, 36, 49, 64, 81, 100, +{ 0, 16, 16, 25, 36, 36, 49, 64, 81, 100, 169, 196, 289, 324, 400, 576, 729, 729, 28, 29, 32, 37, 39, 46, 55, 65, 77, 91, 109, 129, 153, 181, 0, 16, 16, 25, 36, 36, 49, 64, 81, @@ -4145,7 +4612,7 @@ const int32_t c_aaiHuffDemod17[729][2] = { 14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,14,20,14,21, 14,22,14,23,14,24,14,25,14,26,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10, 15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23,15,24,15,25,15,26, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, + 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,16,24,16,25,16,26,17,0,17,1,17,2,17,3,17,4, 17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20, 17,21,17,22,17,23,17,24,17,25,17,26,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9, @@ -4165,9 +4632,8 @@ const int32_t c_aaiHuffDemod17[729][2] = { 26,2,26,3,26,4,26,5,26,6,26,7,26,8,26,9,26,10,26,11,26,12,26,13,26,14,26,15,26,16,26,17, 26,18,26,19,26,20,26,21,26,22,26,23,26,24,26,25,26,26, }; -}; -const int32_t (*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { +const int32_t(*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { NULL, c_aaiHuffDemod1, c_aaiHuffDemod2, @@ -4201,8 +4667,98 @@ const int32_t (*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { NULL, NULL, }; +#endif +const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { + 0x40, 0x40, 0x3F, 0x3F, 0x3E, 0x3E, 0x3D, 0x3D, 0x3C, 0x3C, 0x3B, 0x3B, 0x3A, 0x3A, 0x39, 0x39, + 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, + 0x31, 0x31, 0x31, 0x30, 0x30, 0x2F, 0x2F, 0x2F, 0x2E, 0x2E, 0x2D, 0x2D, 0x2D, 0x2C, 0x2C, 0x2B, + 0x2B, 0x2B, 0x2A, 0x2A, 0x2A, 0x29, 0x29, 0x29, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26, + 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21, + 0x20, 0x20, 0x20, 0x20, 0x1F, 0x1F, 0x1F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1D, 0x1D, 0x1D, 0x1C, 0x1C, + 0x1C, 0x1C, 0x1B, 0x1B, 0x1B, 0x1B, 0x1A, 0x1A, 0x1A, 0x1A, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15, + 0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, + 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0F, 0x0F, 0x0F, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, + 0x0B, 0x0B, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48] = { + 0,0,0,0,0,0,0,0,0,0,0,64,64,64,64,64, + 101,101,128,165,165,180,213, }; + +const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48] = { + -1787,-1787,-1787,-1787,-1787,-1787,-1787,-1787,-1782,-1761,-1737,-1679,-1638,-1613,-1590,-1568, + -1516,-1459,-1395,-1289,-671,-409,-401, }; + + +#if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4 +const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { + 7,7,6,5,5,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4, +}; +#elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8 +const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { + 112,112,96,80,80,64,64,64,64,64,64,64,64,64,64,64, + 64,64,64,64,64,64,64, +}; #endif +const int32_t c_aaiSpreadFunction48[MAX_BANDS_48*MAX_BANDS_48] = { + 0,-1561,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-289,-4,-1234,-2295,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-569,-229, + -8,-905,-1705,-2324,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-789,-445,-173,-16,-656,-1271,-1765,-2172,-2520,-2552,-2552, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-961,-616,-340,-136, + -28,-488,-976,-1382,-1729,-2032,-2305,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-2552,-2552,-1088,-743,-465,-257,-148,-31,-371,-769,-1114,-1417,-1689,-2054,-2483, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1198,-852,-574,-364,-209,-148, + -42,-300,-635,-936,-1207,-1572,-2000,-2376,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, + -2552,-1293,-948,-669,-458,-301,-183,-145,-56,-258,-547,-816,-1179,-1606,-1982,-2311, + -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1375,-1029,-750,-539,-381,-260,-180,-142, + -68,-231,-487,-846,-1272,-1647,-1976,-2261,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1444, + -1099,-820,-608,-449,-328,-233,-194,-138,-77,-213,-555,-978,-1352,-1681,-1966,-2268, + -2552,-2552,-2552,-2552,-2552,-2552,-1501,-1155,-876,-665,-505,-383,-287,-210,-193,-130, + -79,-298,-711,-1083,-1411,-1696,-1997,-2288,-2550,-2552,-2552,-2552,-2552,-1567,-1221,-942, + -730,-570,-448,-351,-272,-206,-189,-151,-72,-349,-713,-1039,-1324,-1625,-1915,-2177, + -2448,-2552,-2552,-2552,-1650,-1304,-1025,-813,-653,-530,-432,-352,-285,-227,-177,-163, + -69,-297,-613,-895,-1195,-1485,-1746,-2017,-2238,-2401,-2545,-1727,-1381,-1102,-890,-730, + -607,-509,-428,-360,-301,-249,-180,-153,-72,-257,-527,-824,-1112,-1373,-1643,-1865, + -2028,-2171,-1798,-1452,-1173,-960,-800,-677,-579,-498,-430,-370,-317,-246,-192,-145, + -76,-224,-505,-790,-1050,-1320,-1540,-1703,-1847,-1860,-1514,-1234,-1022,-862,-738,-640, + -559,-490,-430,-377,-306,-224,-197,-136,-81,-242,-515,-771,-1040,-1260,-1422,-1566, + -1923,-1577,-1297,-1085,-925,-801,-703,-621,-553,-492,-439,-367,-284,-213,-198,-144, + -83,-235,-479,-744,-963,-1125,-1268,-1986,-1640,-1360,-1148,-988,-864,-766,-684,-615, + -555,-501,-429,-345,-273,-211,-204,-146,-89,-216,-465,-680,-841,-984,-2043,-1697, + -1417,-1205,-1044,-921,-822,-741,-672,-611,-557,-485,-401,-328,-264,-211,-205,-140, + -93,-227,-430,-588,-729,-2104,-1758,-1479,-1266,-1106,-982,-884,-802,-733,-673,-619, + -546,-461,-388,-324,-269,-212,-211,-151,-100,-195,-336,-472,-2163,-1817,-1537,-1324, + -1164,-1040,-942,-860,-791,-731,-676,-604,-519,-445,-380,-325,-268,-226,-219,-147, + -114,-167,-280,-2203,-1857,-1577,-1365,-1205,-1081,-982,-901,-831,-771,-717,-644,-559, + -485,-420,-364,-306,-252,-239,-206,-132,-122,-163,-2224,-1878,-1598,-1386,-1225,-1102, + -1003,-921,-852,-792,-737,-665,-580,-505,-441,-385,-326,-271,-222,-224,-176,-121,-114, +}; #endif -/* clang-format on */ + diff --git a/lib_rend/ivas_CQMFHuff.h b/lib_rend/ivas_lcld_tables.h similarity index 60% rename from lib_rend/ivas_CQMFHuff.h rename to lib_rend/ivas_lcld_tables.h index a4c28a3bac..ad2a836f49 100644 --- a/lib_rend/ivas_CQMFHuff.h +++ b/lib_rend/ivas_lcld_tables.h @@ -29,19 +29,97 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ - -#ifndef _IVAS_CQMF_HUFF_H_ -#define _IVAS_CQMF_HUFF_H_ +#ifndef _IVAS_TABLES_H_ +#define _IVAS_TABLES_H_ #ifdef __cplusplus extern "C" { #endif - -#include "options.h" -#include "ivas_Tables.h" -#include // For NULL #include +#include // For NULL +#include "options.h" + +#ifndef M_PI + +#define M_PI 3.14159265358979323846264338327950288f + +#endif + +#define CQMF_BLOCKS_PER_FRAME ( 16 ) +#define CQMF_MAX_BLOCKS_PER_FRAME ( 16 ) +#define CQMF_BANDS ( 60 ) + +#define MAX_BANDS ( 23 ) +#define MAX_BANDS_48 ( 23 ) + + extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this + + +#define ENV_MIN ( -64 ) +#define ENV_MAX ( 64 ) + +#define ENV0_BITS ( 7 ) + +#define ENV_DELTA_MIN ( -32 ) +#define ENV_DELTA_MAX ( 31 ) + +#define ENV_RECONSTRUCT_TABLE_SIZE ( 129 ) + +#define ENV_RECONSTRUCT_TABLE_CENTER ( 64 ) + +#define MIN_ALLOC ( 0 ) +#define MAX_ALLOC ( 31 ) + +#define ALLOC_OFFSET_SCALE ( 8 ) + +#define ALLOC_OFFSET_BITS ( 8 ) + +#define MIN_ALLOC_OFFSET ( -128 ) +#define MAX_ALLOC_OFFSET ( 127 ) +#ifdef ROM_TO_RAM +#define READ_LENGTH ( 4 ) +#endif + +#define ALLOC_TABLE_SIZE ( 32 ) + +#ifndef _PI_ +#define _PI_ ( 3.14159265358979f ) +#endif +#define PRED_MAX_VAL ( 12 ) +#define PRED_MIN_VAL ( -PRED_MAX_VAL ) +#define PRED_QUANT_FACTOR ( (float) PRED_MAX_VAL ) +#define PRED_BAND0_BITS ( 5 ) + +#define PHASE_MAX_VAL ( 12 ) +#define PHASE_MIN_VAL ( -PHASE_MAX_VAL ) +#define PHASE_QUANT_FACTOR ( (float) PHASE_MAX_VAL / _PI_ ) +#define PHASE_DIFF_DIM ( 2 ) +#define PHASE_BAND0_BITS ( 5 ) + +#define SIMPLE_PHASE_MAX_VAL ( 3 ) +#define SIMPLE_PHASE_MIN_VAL ( 0 ) +#define SIMPLE_PHASE_BITS ( 2 ) +#define SIMPLE_PHASE_QUANT_FACTOR ( 2.0f / _PI_ ) + +#define TON_QUOTA_ABS_THRESHOLD ( 8.0f ) +#define TON_QUOTA_INC_THRESHOLD ( 4.0f ) + +#define LOG_ADD_TABLE_LENGTH ( 512 ) + +#define PERCEPTUAL_MODEL_SCALE ( 64 ) + +#define PERCEPTUAL_MODEL_SCALE_SHIFT ( 6 ) + +#define PERCEPTUAL_MODEL_ALPHA_SCALE ( 614 ) + +#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE ( 6827 ) + +#define PERCEPTUAL_MODEL_ALPHA_SHIFT ( 11 ) + +#define PERCEPTUAL_MODEL_SLGAIN_SHIFT ( 8 ) //(4) + +#define MAX_BANDS_48 ( 23 ) //#define USE_DEMOD_TABLES @@ -53,383 +131,410 @@ extern "C" #define HUFF_DEC_TABLE_SIZE ( 16 ) #endif + extern const float c_afRotRealImag[PRED_MAX_VAL - PRED_MIN_VAL + 1][2]; + extern const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2]; + extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; - extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; + extern const float c_afScaleFactor[ALLOC_TABLE_SIZE]; + + extern const float c_afInvScaleFactor[ALLOC_TABLE_SIZE]; + + extern const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE]; + + extern const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE]; + + extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH]; + extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48]; + extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48]; + extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; + extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48]; #ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; + + extern const uint32_t c_aauiCQMFHuffDec1[3][16]; -#endif + extern const uint32_t c_aauiCQMFHuffEnc2[16][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec2[3][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc3[25][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec3[10][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc4[36][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec4[5][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc5[36][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec5[10][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc6[49][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec6[7][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc7[64][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec7[25][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc8[81][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec8[16][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc9[100][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec9[22][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc10[169][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec10[45][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc11[196][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec11[50][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc12[289][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec12[76][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc13[324][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec13[89][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc14[400][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec14[53][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc15[576][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec15[73][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc16[729][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec16[85][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc17[729][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec17[93][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc18[28][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec18[6][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc19[29][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec19[6][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc20[32][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec20[6][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc21[37][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec21[7][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc22[39][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec22[9][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc23[46][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec23[12][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc24[55][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec24[17][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc25[65][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec25[19][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc26[77][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec26[26][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc27[91][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec27[28][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc28[109][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec28[30][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc29[129][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec29[34][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc30[153][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec30[39][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc31[181][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec31[43][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc33[16][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec33[2][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc34[16][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec34[2][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc35[25][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec35[9][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc36[36][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec36[7][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc37[36][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec37[4][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc38[49][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec38[22][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc39[64][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec39[12][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc40[81][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec40[36][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc41[100][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec41[16][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc42[169][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec42[28][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc43[196][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec43[32][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc44[289][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec44[27][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc45[324][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec45[50][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc46[400][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec46[61][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc47[576][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec47[87][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc48[729][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec48[110][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc49[729][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec49[113][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc50[28][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec50[6][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc51[29][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec51[6][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc52[32][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec52[7][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc53[37][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec53[9][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc54[39][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec54[9][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc55[46][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec55[10][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc56[55][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec56[12][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc57[65][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec57[14][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc58[77][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec58[17][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc59[91][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec59[20][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc60[109][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec60[24][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc61[129][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec61[33][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc62[153][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec62[41][16]; -#endif extern const uint32_t c_aauiCQMFHuffEnc63[181][2]; -#ifndef ROM_TO_RAM + extern const uint32_t c_aauiCQMFHuffDec63[39][16]; -#endif + extern const uint32_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2]; -#ifndef ROM_TO_RAM + extern const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE]; #else +extern const uint16_t c_aauiCQMFHuffEnc1[16][2]; +extern const uint16_t c_aauiCQMFHuffEnc2[16][2]; +extern const uint16_t c_aauiCQMFHuffEnc3[25][2]; +extern const uint16_t c_aauiCQMFHuffEnc4[36][2]; +extern const uint16_t c_aauiCQMFHuffEnc5[36][2]; +extern const uint16_t c_aauiCQMFHuffEnc6[49][2]; +extern const uint16_t c_aauiCQMFHuffEnc7[64][2]; +extern const uint16_t c_aauiCQMFHuffEnc8[81][2]; +extern const uint16_t c_aauiCQMFHuffEnc9[100][2]; +extern const uint16_t c_aauiCQMFHuffEnc10[169][2]; +extern const uint16_t c_aauiCQMFHuffEnc11[196][2]; +extern const uint16_t c_aauiCQMFHuffEnc12[289][2]; +extern const uint16_t c_aauiCQMFHuffEnc13[324][2]; +extern const uint16_t c_aauiCQMFHuffEnc14[400][2]; +extern const uint16_t c_aauiCQMFHuffEnc15[576][2]; +extern const uint16_t c_aauiCQMFHuffEnc16[729][2]; +extern const uint16_t c_aauiCQMFHuffEnc17[729][2]; +extern const uint16_t c_aauiCQMFHuffEnc18[28][2]; +extern const uint16_t c_aauiCQMFHuffEnc19[29][2]; +extern const uint16_t c_aauiCQMFHuffEnc20[32][2]; +extern const uint16_t c_aauiCQMFHuffEnc21[37][2]; +extern const uint16_t c_aauiCQMFHuffEnc22[39][2]; +extern const uint16_t c_aauiCQMFHuffEnc23[46][2]; +extern const uint16_t c_aauiCQMFHuffEnc24[55][2]; +extern const uint16_t c_aauiCQMFHuffEnc25[65][2]; +extern const uint16_t c_aauiCQMFHuffEnc26[77][2]; +extern const uint16_t c_aauiCQMFHuffEnc27[91][2]; +extern const uint16_t c_aauiCQMFHuffEnc28[109][2]; +extern const uint16_t c_aauiCQMFHuffEnc29[129][2]; +extern const uint16_t c_aauiCQMFHuffEnc30[153][2]; +extern const uint16_t c_aauiCQMFHuffEnc31[181][2]; +extern const uint16_t c_aauiCQMFHuffEnc33[16][2]; +extern const uint16_t c_aauiCQMFHuffEnc34[16][2]; +extern const uint16_t c_aauiCQMFHuffEnc35[25][2]; +extern const uint16_t c_aauiCQMFHuffEnc36[36][2]; +extern const uint16_t c_aauiCQMFHuffEnc37[36][2]; +extern const uint16_t c_aauiCQMFHuffEnc38[49][2]; +extern const uint16_t c_aauiCQMFHuffEnc39[64][2]; +extern const uint16_t c_aauiCQMFHuffEnc40[81][2]; +extern const uint16_t c_aauiCQMFHuffEnc41[100][2]; +extern const uint16_t c_aauiCQMFHuffEnc42[169][2]; +extern const uint16_t c_aauiCQMFHuffEnc43[196][2]; +extern const uint16_t c_aauiCQMFHuffEnc44[289][2]; +extern const uint16_t c_aauiCQMFHuffEnc45[324][2]; +extern const uint16_t c_aauiCQMFHuffEnc46[400][2]; +extern const uint16_t c_aauiCQMFHuffEnc47[576][2]; +extern const uint16_t c_aauiCQMFHuffEnc48[729][2]; +extern const uint16_t c_aauiCQMFHuffEnc49[729][2]; +extern const uint16_t c_aauiCQMFHuffEnc50[28][2]; +extern const uint16_t c_aauiCQMFHuffEnc51[29][2]; +extern const uint16_t c_aauiCQMFHuffEnc52[32][2]; +extern const uint16_t c_aauiCQMFHuffEnc53[37][2]; +extern const uint16_t c_aauiCQMFHuffEnc54[39][2]; +extern const uint16_t c_aauiCQMFHuffEnc55[46][2]; +extern const uint16_t c_aauiCQMFHuffEnc56[55][2]; +extern const uint16_t c_aauiCQMFHuffEnc57[65][2]; +extern const uint16_t c_aauiCQMFHuffEnc58[77][2]; +extern const uint16_t c_aauiCQMFHuffEnc59[91][2]; +extern const uint16_t c_aauiCQMFHuffEnc60[109][2]; +extern const uint16_t c_aauiCQMFHuffEnc61[129][2]; +extern const uint16_t c_aauiCQMFHuffEnc62[153][2]; +extern const uint16_t c_aauiCQMFHuffEnc63[181][2]; +extern const uint16_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2]; extern const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE]; #endif @@ -471,8 +576,26 @@ extern const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE]; extern const int32_t ( *c_apaiDemodTables[ALLOC_TABLE_SIZE] )[2]; #endif + extern const uint32_t c_aaiRMSEnvHuffEnc[64][2]; + + extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; + + void PerceptualModel( const int32_t iMaxQuantBands, + const int32_t *piRMSEnvelope, + int32_t *piExcitation, + int32_t *piSMR ); + + void PerceptualModelStereo( const int32_t iMaxQuantBands, + const int32_t *piMSFlags, + const int32_t *piRMSEnvelope0, + const int32_t *piRMSEnvelope1, + int32_t *piExcitation0, + int32_t *piExcitation1, + int32_t *piSMR0, + int32_t *piSMR1 ); + #ifdef __cplusplus } #endif -#endif /* _CQMF_HUFF_H_ */ +#endif /* _TABLES_H_ */ -- GitLab From 8e906a8572a83d4187b90a31a963d7e7afbf23d1 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Thu, 4 May 2023 17:29:22 +0530 Subject: [PATCH 126/591] Clang format fix & readdition of ivas_PerceptualModel.h --- Workspace_msvc/lib_rend.vcxproj | 1 + lib_rend/ivas_CQMFDecoder.c | 5 +- lib_rend/ivas_CQMFEncoder.c | 9 +- lib_rend/ivas_PerceptualModel.c | 2 +- lib_rend/ivas_PerceptualModel.h | 75 + lib_rend/ivas_lcld_tables.c | 55914 ++++++++++++++++++++++++++++-- lib_rend/ivas_lcld_tables.h | 36 +- 7 files changed, 52194 insertions(+), 3848 deletions(-) create mode 100644 lib_rend/ivas_PerceptualModel.h diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 423c250c03..cf98947589 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -244,6 +244,7 @@ + diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 5a5888fa09..0c152e95e3 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -40,6 +40,7 @@ Nations Convention on Contracts on the International Sales of Goods. #ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_NoiseGen.h" +#include "ivas_PerceptualModel.h" #include "ivas_lcld_tables.h" #include "ivas_cldfb_codec_bitstream.h" #include "prot.h" @@ -285,8 +286,8 @@ static void CreateDecodeTable( CQMFDecoder *psCQMFDecoder, int32_t num, const ui { ppsort_enc_table[n] = (uint32_t *) malloc( 3 * sizeof( int32_t ) ); - ppsort_enc_table[n][0] = (uint32_t)ppuiEncTable[n][0]; - ppsort_enc_table[n][1] = (uint32_t)ppuiEncTable[n][1]; + ppsort_enc_table[n][0] = (uint32_t) ppuiEncTable[n][0]; + ppsort_enc_table[n][1] = (uint32_t) ppuiEncTable[n][1]; ppsort_enc_table[n][2] = (uint32_t) n; } diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c index 05c992516e..82bcf6879a 100644 --- a/lib_rend/ivas_CQMFEncoder.c +++ b/lib_rend/ivas_CQMFEncoder.c @@ -40,6 +40,7 @@ #include "ivas_lcld_tables.h" #include "prot.h" #include "ivas_RMSEnvGrouping.h" +#include "ivas_PerceptualModel.h" #include "ivas_cldfb_codec_bitstream.h" #include "ivas_prot_rend.h" #ifdef ENABLE_MS_PRED @@ -1807,11 +1808,11 @@ static int32_t WriteCQMFData( const int32_t iNumGroups, if ( iAlloc > 0 ) { #ifndef ROM_TO_RAM - const uint32_t(*pauiHuffmanTable)[2] = NULL; - const uint32_t(*pauiHuffmanTableDPCM)[2] = NULL; + const uint32_t( *pauiHuffmanTable )[2] = NULL; + const uint32_t( *pauiHuffmanTableDPCM )[2] = NULL; #else - const uint16_t(*pauiHuffmanTable)[2] = NULL; - const uint16_t(*pauiHuffmanTableDPCM)[2] = NULL; + const uint16_t( *pauiHuffmanTable )[2] = NULL; + const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL; #endif // pauiHuffmanTable = GetHuffEncTable(iAlloc); pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; diff --git a/lib_rend/ivas_PerceptualModel.c b/lib_rend/ivas_PerceptualModel.c index 2f0072ee97..131ca8af0d 100644 --- a/lib_rend/ivas_PerceptualModel.c +++ b/lib_rend/ivas_PerceptualModel.c @@ -31,7 +31,7 @@ *******************************************************************************************************/ #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT -#include "ivas_lcld_tables.h" +#include "ivas_PerceptualModel.h" #include "prot.h" #include "ivas_prot_rend.h" #include diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h new file mode 100644 index 0000000000..fdd1027623 --- /dev/null +++ b/lib_rend/ivas_PerceptualModel.h @@ -0,0 +1,75 @@ +/****************************************************************************************************** + + (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef _IVAS_PERCEPTUAL_MODEL_H_ +#define _IVAS_PERCEPTUAL_MODEL_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif +#include + +#define LOG_ADD_TABLE_LENGTH (512) +#define PERCEPTUAL_MODEL_SCALE (64) +#define PERCEPTUAL_MODEL_SCALE_SHIFT (6) +#define PERCEPTUAL_MODEL_ALPHA_SCALE (614) +#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE (6827) +#define PERCEPTUAL_MODEL_ALPHA_SHIFT (11) +#define PERCEPTUAL_MODEL_SLGAIN_SHIFT (8)//(4) +#define MAX_BANDS_48 ( 23 ) + + extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH]; + extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48]; + extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48]; + extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; + extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48]; + + extern void PerceptualModel(const int32_t iMaxQuantBands, + const int32_t *piRMSEnvelope, + int32_t *piExcitation, + int32_t *piSMR); + + extern void PerceptualModelStereo(const int32_t iMaxQuantBands, + const int32_t *piMSFlags, + const int32_t *piRMSEnvelope0, + const int32_t *piRMSEnvelope1, + int32_t *piExcitation0, + int32_t *piExcitation1, + int32_t *piSMR0, + int32_t *piSMR1); + +#ifdef __cplusplus +} +#endif + +#endif /* _PERCEPTUAL_MODEL_H_ */ diff --git a/lib_rend/ivas_lcld_tables.c b/lib_rend/ivas_lcld_tables.c index 7afb33a184..834e0536af 100644 --- a/lib_rend/ivas_lcld_tables.c +++ b/lib_rend/ivas_lcld_tables.c @@ -37,47 +37,71 @@ #include "wmc_auto.h" #include #include "prot.h" +#include "ivas_PerceptualModel.h" /* clang-format off */ + const float c_afRotRealImagSimple[SIMPLE_PHASE_MAX_VAL + 1][2] = { - {1.0f, 0.0f}, /* zero */ - {0.0f, 1.0f}, /* pi/2 */ - {-1.0f, 0.0f}, /* pi */ - {0.0f, -1.0f}, /* 3*pi/2 */ + { 1.0f, 0.0f }, /* zero */ + { 0.0f, 1.0f }, /* pi/2 */ + { -1.0f, 0.0f }, /* pi */ + { 0.0f, -1.0f }, /* 3*pi/2 */ }; /* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */ const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = { - {-1.00000000f, -0.00000000f}, - {-0.96592583f, -0.25881905f}, - {-0.86602540f, -0.50000000f}, - {-0.70710678f, -0.70710678f}, - {-0.50000000f, -0.86602540f}, - {-0.25881905f, -0.96592583f}, - {0.00000000f, -1.00000000f}, - {0.25881905f, -0.96592583f}, - {0.50000000f, -0.86602540f}, - {0.70710678f, -0.70710678f}, - {0.86602540f, -0.50000000f}, - {0.96592583f, -0.25881905f}, - {1.00000000f, 0.00000000f}, - {0.96592583f, 0.25881905f}, - {0.86602540f, 0.50000000f}, - {0.70710678f, 0.70710678f}, - {0.50000000f, 0.86602540f}, - {0.25881905f, 0.96592583f}, - {0.00000000f, 1.00000000f}, - {-0.25881905f, 0.96592583f}, - {-0.50000000f, 0.86602540f}, - {-0.70710678f, 0.70710678f}, - {-0.86602540f, 0.50000000f}, - {-0.96592583f, 0.25881905f}, - {-1.00000000f, 0.00000000f} + { -1.00000000f, -0.00000000f }, + { -0.96592583f, -0.25881905f }, + { -0.86602540f, -0.50000000f }, + { -0.70710678f, -0.70710678f }, + { -0.50000000f, -0.86602540f }, + { -0.25881905f, -0.96592583f }, + { 0.00000000f, -1.00000000f }, + { 0.25881905f, -0.96592583f }, + { 0.50000000f, -0.86602540f }, + { 0.70710678f, -0.70710678f }, + { 0.86602540f, -0.50000000f }, + { 0.96592583f, -0.25881905f }, + { 1.00000000f, 0.00000000f }, + { 0.96592583f, 0.25881905f }, + { 0.86602540f, 0.50000000f }, + { 0.70710678f, 0.70710678f }, + { 0.50000000f, 0.86602540f }, + { 0.25881905f, 0.96592583f }, + { 0.00000000f, 1.00000000f }, + { -0.25881905f, 0.96592583f }, + { -0.50000000f, 0.86602540f }, + { -0.70710678f, 0.70710678f }, + { -0.86602540f, 0.50000000f }, + { -0.96592583f, 0.25881905f }, + { -1.00000000f, 0.00000000f } }; /* Move this to perceptual model ? */ const int32_t c_aiBandwidths48[MAX_BANDS_48] = { - 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,4,6,6,7,10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 4, + 6, + 6, + 7, + 10, }; @@ -152,80 +176,579 @@ const float c_afInvScaleFactor[ALLOC_TABLE_SIZE] = { }; const float c_afRMSEnvReconstructTable[ENV_RECONSTRUCT_TABLE_SIZE] = { - 2.32830644e-10f, 3.29272254e-10f, 4.65661287e-10f, 6.58544508e-10f, 9.31322575e-10f, 1.31708902e-09f, 1.86264515e-09f, 2.63417803e-09f, - 3.72529030e-09f, 5.26835606e-09f, 7.45058060e-09f, 1.05367121e-08f, 1.49011612e-08f, 2.10734243e-08f, 2.98023224e-08f, 4.21468485e-08f, - 5.96046448e-08f, 8.42936970e-08f, 1.19209290e-07f, 1.68587394e-07f, 2.38418579e-07f, 3.37174788e-07f, 4.76837158e-07f, 6.74349576e-07f, - 9.53674316e-07f, 1.34869915e-06f, 1.90734863e-06f, 2.69739830e-06f, 3.81469727e-06f, 5.39479661e-06f, 7.62939453e-06f, 1.07895932e-05f, - 1.52587891e-05f, 2.15791864e-05f, 3.05175781e-05f, 4.31583729e-05f, 6.10351562e-05f, 8.63167458e-05f, 1.22070312e-04f, 1.72633492e-04f, - 2.44140625e-04f, 3.45266983e-04f, 4.88281250e-04f, 6.90533966e-04f, 9.76562500e-04f, 1.38106793e-03f, 1.95312500e-03f, 2.76213586e-03f, - 3.90625000e-03f, 5.52427173e-03f, 7.81250000e-03f, 1.10485435e-02f, 1.56250000e-02f, 2.20970869e-02f, 3.12500000e-02f, 4.41941738e-02f, - 6.25000000e-02f, 8.83883476e-02f, 1.25000000e-01f, 1.76776695e-01f, 2.50000000e-01f, 3.53553391e-01f, 5.00000000e-01f, 7.07106781e-01f, - 1.00000000e+00f, 1.41421356e+00f, 2.00000000e+00f, 2.82842712e+00f, 4.00000000e+00f, 5.65685425e+00f, 8.00000000e+00f, 1.13137085e+01f, - 1.60000000e+01f, 2.26274170e+01f, 3.20000000e+01f, 4.52548340e+01f, 6.40000000e+01f, 9.05096680e+01f, 1.28000000e+02f, 1.81019336e+02f, - 2.56000000e+02f, 3.62038672e+02f, 5.12000000e+02f, 7.24077344e+02f, 1.02400000e+03f, 1.44815469e+03f, 2.04800000e+03f, 2.89630938e+03f, - 4.09600000e+03f, 5.79261875e+03f, 8.19200000e+03f, 1.15852375e+04f, 1.63840000e+04f, 2.31704750e+04f, 3.27680000e+04f, 4.63409500e+04f, - 6.55360000e+04f, 9.26819000e+04f, 1.31072000e+05f, 1.85363800e+05f, 2.62144000e+05f, 3.70727600e+05f, 5.24288000e+05f, 7.41455200e+05f, - 1.04857600e+06f, 1.48291040e+06f, 2.09715200e+06f, 2.96582080e+06f, 4.19430400e+06f, 5.93164160e+06f, 8.38860800e+06f, 1.18632832e+07f, - 1.67772160e+07f, 2.37265664e+07f, 3.35544320e+07f, 4.74531328e+07f, 6.71088640e+07f, 9.49062656e+07f, 1.34217728e+08f, 1.89812531e+08f, - 2.68435456e+08f, 3.79625062e+08f, 5.36870912e+08f, 7.59250125e+08f, 1.07374182e+09f, 1.51850025e+09f, 2.14748365e+09f, 3.03700050e+09f, + 2.32830644e-10f, + 3.29272254e-10f, + 4.65661287e-10f, + 6.58544508e-10f, + 9.31322575e-10f, + 1.31708902e-09f, + 1.86264515e-09f, + 2.63417803e-09f, + 3.72529030e-09f, + 5.26835606e-09f, + 7.45058060e-09f, + 1.05367121e-08f, + 1.49011612e-08f, + 2.10734243e-08f, + 2.98023224e-08f, + 4.21468485e-08f, + 5.96046448e-08f, + 8.42936970e-08f, + 1.19209290e-07f, + 1.68587394e-07f, + 2.38418579e-07f, + 3.37174788e-07f, + 4.76837158e-07f, + 6.74349576e-07f, + 9.53674316e-07f, + 1.34869915e-06f, + 1.90734863e-06f, + 2.69739830e-06f, + 3.81469727e-06f, + 5.39479661e-06f, + 7.62939453e-06f, + 1.07895932e-05f, + 1.52587891e-05f, + 2.15791864e-05f, + 3.05175781e-05f, + 4.31583729e-05f, + 6.10351562e-05f, + 8.63167458e-05f, + 1.22070312e-04f, + 1.72633492e-04f, + 2.44140625e-04f, + 3.45266983e-04f, + 4.88281250e-04f, + 6.90533966e-04f, + 9.76562500e-04f, + 1.38106793e-03f, + 1.95312500e-03f, + 2.76213586e-03f, + 3.90625000e-03f, + 5.52427173e-03f, + 7.81250000e-03f, + 1.10485435e-02f, + 1.56250000e-02f, + 2.20970869e-02f, + 3.12500000e-02f, + 4.41941738e-02f, + 6.25000000e-02f, + 8.83883476e-02f, + 1.25000000e-01f, + 1.76776695e-01f, + 2.50000000e-01f, + 3.53553391e-01f, + 5.00000000e-01f, + 7.07106781e-01f, + 1.00000000e+00f, + 1.41421356e+00f, + 2.00000000e+00f, + 2.82842712e+00f, + 4.00000000e+00f, + 5.65685425e+00f, + 8.00000000e+00f, + 1.13137085e+01f, + 1.60000000e+01f, + 2.26274170e+01f, + 3.20000000e+01f, + 4.52548340e+01f, + 6.40000000e+01f, + 9.05096680e+01f, + 1.28000000e+02f, + 1.81019336e+02f, + 2.56000000e+02f, + 3.62038672e+02f, + 5.12000000e+02f, + 7.24077344e+02f, + 1.02400000e+03f, + 1.44815469e+03f, + 2.04800000e+03f, + 2.89630938e+03f, + 4.09600000e+03f, + 5.79261875e+03f, + 8.19200000e+03f, + 1.15852375e+04f, + 1.63840000e+04f, + 2.31704750e+04f, + 3.27680000e+04f, + 4.63409500e+04f, + 6.55360000e+04f, + 9.26819000e+04f, + 1.31072000e+05f, + 1.85363800e+05f, + 2.62144000e+05f, + 3.70727600e+05f, + 5.24288000e+05f, + 7.41455200e+05f, + 1.04857600e+06f, + 1.48291040e+06f, + 2.09715200e+06f, + 2.96582080e+06f, + 4.19430400e+06f, + 5.93164160e+06f, + 8.38860800e+06f, + 1.18632832e+07f, + 1.67772160e+07f, + 2.37265664e+07f, + 3.35544320e+07f, + 4.74531328e+07f, + 6.71088640e+07f, + 9.49062656e+07f, + 1.34217728e+08f, + 1.89812531e+08f, + 2.68435456e+08f, + 3.79625062e+08f, + 5.36870912e+08f, + 7.59250125e+08f, + 1.07374182e+09f, + 1.51850025e+09f, + 2.14748365e+09f, + 3.03700050e+09f, 4.29496730e+09f, }; const int32_t c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { - 0, 3, 3, 4, 5, 5, 6, 7, - 8, 9, 12, 13, 16, 17, 19, 23, - 26, 26, 27, 28, 31, 36, 38, 45, - 54, 64, 76, 90, 108, 128, 152, 180, + 0, + 3, + 3, + 4, + 5, + 5, + 6, + 7, + 8, + 9, + 12, + 13, + 16, + 17, + 19, + 23, + 26, + 26, + 27, + 28, + 31, + 36, + 38, + 45, + 54, + 64, + 76, + 90, + 108, + 128, + 152, + 180, }; const int32_t c_aiHuffmanDim[ALLOC_TABLE_SIZE] = { - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, }; const int32_t c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { - 0, 4, 4, 5, 6, 6, 7, 8, - 9, 10, 13, 14, 17, 18, 20, 24, - 27, 27, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, + 0, + 4, + 4, + 5, + 6, + 6, + 7, + 8, + 9, + 10, + 13, + 14, + 17, + 18, + 20, + 24, + 27, + 27, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, }; const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { - 1, 16, 16, 25, 36, 36, 49, 64, - 81, 100, 169, 196, 289, 324, 400, 576, - 729, 729, 28, 29, 32, 37, 39, 46, - 55, 65, 77, 91, 109, 129, 153, 181, + 1, + 16, + 16, + 25, + 36, + 36, + 49, + 64, + 81, + 100, + 169, + 196, + 289, + 324, + 400, + 576, + 729, + 729, + 28, + 29, + 32, + 37, + 39, + 46, + 55, + 65, + 77, + 91, + 109, + 129, + 153, + 181, }; -const uint32_t c_aaiRMSEnvHuffEnc[64][2] = -{ - {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0003}, {0x0013, 0x0004}, - {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0012, 0x000b}, {0x000d, 0x0002}, {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000d, 0x0003}, - {0x000b, 0x0002}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0008, 0x0005}, - {0x0008, 0x0006}, {0x0007, 0x0004}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0005, 0x0003}, {0x0004, 0x0002}, {0x0003, 0x0002}, {0x0002, 0x0002}, - {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0008, 0x0007}, {0x0009, 0x0007}, {0x0009, 0x0008}, - {0x0009, 0x0009}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, - {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, +const uint32_t c_aaiRMSEnvHuffEnc[64][2] = { + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0012, 0x000b }, + { 0x000d, 0x0002 }, + { 0x000e, 0x0001 }, + { 0x000e, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x000b, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0007, 0x0004 }, + { 0x0006, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0005, 0x0003 }, + { 0x0004, 0x0002 }, + { 0x0003, 0x0002 }, + { 0x0002, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0004, 0x0003 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0007 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000e, 0x0003 }, + { 0x0010, 0x0003 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, }; -const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = -{ - {0x0002ffff, 0x0001ffff, 0x0000001d, 0x00000022, 0x0001001e, 0x0001001e, 0x00010021, 0x00010021, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000017, 0x00000018, 0x00000025, 0x00010019, 0x00010019, 0x00010024, 0x00010024, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x0009ffff, 0x0008ffff, 0x0000002c, 0x0000002d, 0x00010010, 0x00010010, 0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x000bffff, 0x000cffff, 0x000affff, 0x00000031, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, - {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, }, - {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, +const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE] = { + { + 0x0002ffff, + 0x0001ffff, + 0x0000001d, + 0x00000022, + 0x0001001e, + 0x0001001e, + 0x00010021, + 0x00010021, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0006ffff, + 0x0007ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x00000017, + 0x00000018, + 0x00000025, + 0x00010019, + 0x00010019, + 0x00010024, + 0x00010024, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + }, + { + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x0009ffff, + 0x0008ffff, + 0x0000002c, + 0x0000002d, + 0x00010010, + 0x00010010, + 0x0001002b, + 0x0001002b, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x000bffff, + 0x000cffff, + 0x000affff, + 0x00000031, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020030, + }, + { + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x00000000, + 0x00000001, + 0x00000002, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00010006, + 0x00010006, + 0x00010007, + 0x00010007, + 0x00010008, + 0x00010008, + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + }, + { + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + }, }; #ifndef ROM_TO_RAM @@ -233,17 +756,81 @@ const uint32_t c_aauiCQMFHuffEnc1[16][2] = #else const uint16_t c_aauiCQMFHuffEnc1[16][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0005, 0x0001}, {0x000b, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x0001}, - {0x0006, 0x0001}, {0x0008, 0x0001}, {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, -}; + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0005, 0x0001 }, + { 0x000b, 0x0000 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec1[3][16] = -{ - {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00010003, 0x00010003, 0x00010007, 0x00010007, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +const uint32_t c_aauiCQMFHuffDec1[3][16] = { + { + 0x0001ffff, + 0x00000005, + 0x00010001, + 0x00010001, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x00000009, + 0x00010006, + 0x00010006, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00010003, + 0x00010003, + 0x00010007, + 0x00010007, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + }, }; #endif @@ -252,17 +839,81 @@ const uint32_t c_aauiCQMFHuffEnc2[16][2] = #else const uint16_t c_aauiCQMFHuffEnc2[16][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0005, 0x0001}, {0x000c, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000c, 0x0001}, - {0x0006, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000b, 0x0003}, -}; + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0005, 0x0001 }, + { 0x000c, 0x0000 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000b, 0x0003 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec2[3][16] = -{ - {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000009, 0x00010006, 0x00010006, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00000003, 0x00000007, 0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0001000f, 0x0001000f, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, +const uint32_t c_aauiCQMFHuffDec2[3][16] = { + { + 0x0001ffff, + 0x00000005, + 0x00010001, + 0x00010001, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x00000009, + 0x00010006, + 0x00010006, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00000003, + 0x00000007, + 0x0000000b, + 0x0000000c, + 0x0000000d, + 0x0000000e, + 0x0001000f, + 0x0001000f, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, }; #endif #ifndef ROM_TO_RAM @@ -270,27 +921,217 @@ const uint32_t c_aauiCQMFHuffEnc3[25][2] = #else const uint16_t c_aauiCQMFHuffEnc3[25][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, - {0x000d, 0x0002}, {0x000d, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x0009, 0x0001}, - {0x000c, 0x0007}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000d, 0x000c}, - {0x000d, 0x000d}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000d, 0x0000 }, + { 0x000d, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000d, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x0009, 0x0001 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000d, 0x000a }, + { 0x000d, 0x000b }, + { 0x000d, 0x000c }, + { 0x000d, 0x000d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec3[10][16] = -{ - {0x0001ffff, 0x00000006, 0x00010001, 0x00010001, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x0000000c, 0x00010007, 0x00010007, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x00000010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, +const uint32_t c_aauiCQMFHuffDec3[10][16] = { + { + 0x0001ffff, + 0x00000006, + 0x00010001, + 0x00010001, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x0000000c, + 0x00010007, + 0x00010007, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x00000010, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + }, + { + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, }; #endif @@ -299,23 +1140,138 @@ const uint32_t c_aauiCQMFHuffEnc4[36][2] = #else const uint16_t c_aauiCQMFHuffEnc4[36][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0010, 0x0000}, {0x0010, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, - {0x0007, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000e, 0x0006}, - {0x0010, 0x0004}, {0x0010, 0x0005}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000e, 0x0007}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0010, 0x0008}, - {0x0010, 0x0009}, {0x0010, 0x000a}, {0x0010, 0x000b}, {0x0010, 0x000c}, {0x0010, 0x000d}, {0x0010, 0x000e}, {0x0010, 0x000f}, {0x0010, 0x0010}, - {0x0010, 0x0011}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x0010, 0x0000 }, + { 0x0010, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x000e, 0x0006 }, + { 0x0010, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000e, 0x0007 }, + { 0x0010, 0x0006 }, + { 0x0010, 0x0007 }, + { 0x0010, 0x0008 }, + { 0x0010, 0x0009 }, + { 0x0010, 0x000a }, + { 0x0010, 0x000b }, + { 0x0010, 0x000c }, + { 0x0010, 0x000d }, + { 0x0010, 0x000e }, + { 0x0010, 0x000f }, + { 0x0010, 0x0010 }, + { 0x0010, 0x0011 }, + { 0x000f, 0x0009 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec4[5][16] = -{ - {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x0000000e, 0x00010008, 0x00010008, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x0004ffff, 0x0003ffff, 0x00010003, 0x00010003, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x0000001f, 0x00000020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, - {0x00000004, 0x00000005, 0x0000000a, 0x0000000b, 0x00000010, 0x00000011, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, }, +const uint32_t c_aauiCQMFHuffDec4[5][16] = { + { + 0x0001ffff, + 0x00000007, + 0x00010001, + 0x00010001, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x0000000e, + 0x00010008, + 0x00010008, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + }, + { + 0x0004ffff, + 0x0003ffff, + 0x00010003, + 0x00010003, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x0000001f, + 0x00000020, + 0x00010021, + 0x00010021, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + }, + { + 0x00000004, + 0x00000005, + 0x0000000a, + 0x0000000b, + 0x00000010, + 0x00000011, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000018, + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x0000001c, + 0x0000001d, + 0x0000001e, + }, }; #endif @@ -324,28 +1280,228 @@ const uint32_t c_aauiCQMFHuffEnc5[36][2] = #else const uint16_t c_aauiCQMFHuffEnc5[36][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0000}, {0x0002, 0x0001}, {0x0004, 0x0001}, - {0x0007, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0008}, {0x0012, 0x0001}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000c, 0x0001}, - {0x0012, 0x0002}, {0x0012, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000d, 0x0001}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, - {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, - {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0011, 0x000b}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000f, 0x0003 }, + { 0x0012, 0x0000 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x0011, 0x0008 }, + { 0x0012, 0x0001 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000d, 0x0001 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0011, 0x0009 }, + { 0x0011, 0x000a }, + { 0x0012, 0x0007 }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, + { 0x0012, 0x000c }, + { 0x0012, 0x000d }, + { 0x0012, 0x000e }, + { 0x0012, 0x000f }, + { 0x0011, 0x000b }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec5[10][16] = -{ - {0x0001ffff, 0x00000007, 0x00010001, 0x00010001, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x0000000e, 0x00010008, 0x00010008, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x0003ffff, 0x0000000f, 0x00010009, 0x00010009, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x0004ffff, 0x0005ffff, 0x00010004, 0x00010004, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, - {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, +const uint32_t c_aauiCQMFHuffDec5[10][16] = { + { + 0x0001ffff, + 0x00000007, + 0x00010001, + 0x00010001, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x0000000e, + 0x00010008, + 0x00010008, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + }, + { + 0x0003ffff, + 0x0000000f, + 0x00010009, + 0x00010009, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x0004ffff, + 0x0005ffff, + 0x00010004, + 0x00010004, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, + { + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + }, + { + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + }, + { + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + }, }; #endif @@ -354,27 +1510,187 @@ const uint32_t c_aauiCQMFHuffEnc6[49][2] = #else const uint16_t c_aauiCQMFHuffEnc6[49][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x0003}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0002, 0x0001}, - {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x0010, 0x0004}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0006, 0x0002}, {0x0006, 0x0003}, - {0x0008, 0x0001}, {0x000d, 0x0001}, {0x0012, 0x0007}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x000a, 0x0003}, {0x000b, 0x0001}, {0x000c, 0x0001}, - {0x0011, 0x0004}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0010, 0x0005}, {0x000f, 0x0003}, {0x0011, 0x0005}, {0x0014, 0x0009}, - {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0013, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, - {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, - {0x0014, 0x0019}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x0010, 0x0003 }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000a, 0x0002 }, + { 0x0010, 0x0004 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x0012, 0x0007 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x000a, 0x0003 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x0011, 0x0004 }, + { 0x0014, 0x0006 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0010, 0x0005 }, + { 0x000f, 0x0003 }, + { 0x0011, 0x0005 }, + { 0x0014, 0x0009 }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0014, 0x000c }, + { 0x0014, 0x000d }, + { 0x0013, 0x000d }, + { 0x0014, 0x000e }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0014, 0x0013 }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec6[7][16] = -{ - {0x0001ffff, 0x00000008, 0x00010001, 0x00010001, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000010, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x0003ffff, 0x00000017, 0x00010016, 0x00010016, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, - {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x00000004, 0x0000000b, 0x0000001c, 0x0001001d, 0x0001001d, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00010024, 0x00010024, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x00000005, 0x00000006, 0x0000000c, 0x0000000d, 0x00000013, 0x00000014, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000025, 0x00000026, }, +const uint32_t c_aauiCQMFHuffDec6[7][16] = { + { + 0x0001ffff, + 0x00000008, + 0x00010001, + 0x00010001, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x00000010, + 0x00010009, + 0x00010009, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + }, + { + 0x0003ffff, + 0x00000017, + 0x00010016, + 0x00010016, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x0004ffff, + 0x00000004, + 0x0000000b, + 0x0000001c, + 0x0001001d, + 0x0001001d, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x00000027, + 0x00000028, + 0x00000029, + 0x0000002a, + 0x0000002b, + 0x0000002c, + 0x0000002d, + 0x0000002e, + 0x0000002f, + 0x00000030, + 0x00010024, + 0x00010024, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x00000005, + 0x00000006, + 0x0000000c, + 0x0000000d, + 0x00000013, + 0x00000014, + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x0000001f, + 0x00000020, + 0x00000021, + 0x00000022, + 0x00000023, + 0x00000025, + 0x00000026, + }, }; #endif @@ -383,45 +1699,525 @@ const uint32_t c_aauiCQMFHuffEnc7[64][2] = #else const uint16_t c_aauiCQMFHuffEnc7[64][2] = #endif -{ - {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0002}, {0x0015, 0x0000}, {0x0015, 0x0001}, {0x0015, 0x0002}, - {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000f, 0x0003}, {0x0014, 0x0011}, {0x0015, 0x0003}, {0x0015, 0x0004}, - {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0001}, {0x000b, 0x0001}, {0x0010, 0x0002}, {0x0015, 0x0005}, {0x0015, 0x0006}, {0x0015, 0x0007}, - {0x000a, 0x0001}, {0x0009, 0x0003}, {0x000c, 0x0001}, {0x000f, 0x0004}, {0x0012, 0x0006}, {0x0015, 0x0008}, {0x0015, 0x0009}, {0x0015, 0x000a}, - {0x000f, 0x0005}, {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0012, 0x0007}, {0x0014, 0x0012}, {0x0015, 0x000b}, {0x0015, 0x000c}, {0x0015, 0x000d}, - {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0013, 0x000b}, {0x0014, 0x0015}, {0x0015, 0x000e}, {0x0015, 0x000f}, {0x0015, 0x0010}, {0x0015, 0x0011}, - {0x0015, 0x0012}, {0x0015, 0x0013}, {0x0015, 0x0014}, {0x0015, 0x0015}, {0x0015, 0x0016}, {0x0015, 0x0017}, {0x0015, 0x0018}, {0x0015, 0x0019}, - {0x0015, 0x001a}, {0x0015, 0x001b}, {0x0015, 0x001c}, {0x0015, 0x001d}, {0x0015, 0x001e}, {0x0015, 0x001f}, {0x0015, 0x0020}, {0x0015, 0x0021}, -}; + { + { 0x0002, 0x0001 }, + { 0x0002, 0x0002 }, + { 0x0005, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000f, 0x0002 }, + { 0x0015, 0x0000 }, + { 0x0015, 0x0001 }, + { 0x0015, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0009, 0x0002 }, + { 0x000f, 0x0003 }, + { 0x0014, 0x0011 }, + { 0x0015, 0x0003 }, + { 0x0015, 0x0004 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0007, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x0010, 0x0002 }, + { 0x0015, 0x0005 }, + { 0x0015, 0x0006 }, + { 0x0015, 0x0007 }, + { 0x000a, 0x0001 }, + { 0x0009, 0x0003 }, + { 0x000c, 0x0001 }, + { 0x000f, 0x0004 }, + { 0x0012, 0x0006 }, + { 0x0015, 0x0008 }, + { 0x0015, 0x0009 }, + { 0x0015, 0x000a }, + { 0x000f, 0x0005 }, + { 0x000e, 0x0003 }, + { 0x0010, 0x0003 }, + { 0x0012, 0x0007 }, + { 0x0014, 0x0012 }, + { 0x0015, 0x000b }, + { 0x0015, 0x000c }, + { 0x0015, 0x000d }, + { 0x0014, 0x0013 }, + { 0x0014, 0x0014 }, + { 0x0013, 0x000b }, + { 0x0014, 0x0015 }, + { 0x0015, 0x000e }, + { 0x0015, 0x000f }, + { 0x0015, 0x0010 }, + { 0x0015, 0x0011 }, + { 0x0015, 0x0012 }, + { 0x0015, 0x0013 }, + { 0x0015, 0x0014 }, + { 0x0015, 0x0015 }, + { 0x0015, 0x0016 }, + { 0x0015, 0x0017 }, + { 0x0015, 0x0018 }, + { 0x0015, 0x0019 }, + { 0x0015, 0x001a }, + { 0x0015, 0x001b }, + { 0x0015, 0x001c }, + { 0x0015, 0x001d }, + { 0x0015, 0x001e }, + { 0x0015, 0x001f }, + { 0x0015, 0x0020 }, + { 0x0015, 0x0021 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec7[25][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x0003ffff, 0x0004ffff, 0x00010012, 0x00010012, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x0005ffff, 0x0000001a, 0x00010013, 0x00010013, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x0007ffff, 0x0006ffff, 0x00000014, 0x00000022, 0x00010004, 0x00010004, 0x0001000c, 0x0001000c, 0x0001001b, 0x0001001b, 0x00010020, 0x00010020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, - {0x0018ffff, 0x0000000d, 0x00000024, 0x00000028, 0x00000029, 0x0000002b, 0x0001002a, 0x0001002a, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x000effff, 0x000affff, 0x000bffff, 0x000cffff, 0x0008ffff, 0x0009ffff, 0x000dffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, - {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, +const uint32_t c_aauiCQMFHuffDec7[25][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00010009, + 0x00010009, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + }, + { + 0x0003ffff, + 0x0004ffff, + 0x00010012, + 0x00010012, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x0005ffff, + 0x0000001a, + 0x00010013, + 0x00010013, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + }, + { + 0x0007ffff, + 0x0006ffff, + 0x00000014, + 0x00000022, + 0x00010004, + 0x00010004, + 0x0001000c, + 0x0001000c, + 0x0001001b, + 0x0001001b, + 0x00010020, + 0x00010020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + }, + { + 0x0018ffff, + 0x0000000d, + 0x00000024, + 0x00000028, + 0x00000029, + 0x0000002b, + 0x0001002a, + 0x0001002a, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + }, + { + 0x000effff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x0008ffff, + 0x0009ffff, + 0x000dffff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + }, + { + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + }, + { + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + }, + { + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + }, + { + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, + { + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + }, + { + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + }, + { + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + }, + { + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + }, + { + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + }, }; #endif @@ -430,40 +2226,381 @@ const uint32_t c_aauiCQMFHuffEnc8[81][2] = #else const uint16_t c_aauiCQMFHuffEnc8[81][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0001}, {0x000f, 0x0002}, {0x0014, 0x0008}, {0x0017, 0x0000}, {0x0017, 0x0001}, - {0x0017, 0x0002}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0001}, {0x000f, 0x0003}, {0x0012, 0x0004}, {0x0015, 0x000d}, - {0x0017, 0x0003}, {0x0017, 0x0004}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0001}, {0x000c, 0x0001}, {0x0010, 0x0002}, {0x0013, 0x0005}, - {0x0017, 0x0005}, {0x0017, 0x0006}, {0x0017, 0x0007}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000b, 0x0001}, {0x000f, 0x0004}, {0x0012, 0x0005}, - {0x0016, 0x0015}, {0x0017, 0x0008}, {0x0017, 0x0009}, {0x0017, 0x000a}, {0x000f, 0x0005}, {0x000e, 0x0003}, {0x0010, 0x0003}, {0x0012, 0x0006}, - {0x0014, 0x0009}, {0x0017, 0x000b}, {0x0017, 0x000c}, {0x0017, 0x000d}, {0x0017, 0x000e}, {0x0013, 0x0006}, {0x0012, 0x0007}, {0x0013, 0x0007}, - {0x0015, 0x000e}, {0x0017, 0x000f}, {0x0017, 0x0010}, {0x0017, 0x0011}, {0x0017, 0x0012}, {0x0017, 0x0013}, {0x0016, 0x0016}, {0x0016, 0x0017}, - {0x0015, 0x000f}, {0x0016, 0x0018}, {0x0017, 0x0014}, {0x0017, 0x0015}, {0x0017, 0x0016}, {0x0017, 0x0017}, {0x0017, 0x0018}, {0x0017, 0x0019}, - {0x0017, 0x001a}, {0x0017, 0x001b}, {0x0017, 0x001c}, {0x0017, 0x001d}, {0x0017, 0x001e}, {0x0017, 0x001f}, {0x0017, 0x0020}, {0x0017, 0x0021}, - {0x0017, 0x0022}, {0x0017, 0x0023}, {0x0017, 0x0024}, {0x0017, 0x0025}, {0x0017, 0x0026}, {0x0017, 0x0027}, {0x0017, 0x0028}, {0x0017, 0x0029}, - {0x0016, 0x0019}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000f, 0x0002 }, + { 0x0014, 0x0008 }, + { 0x0017, 0x0000 }, + { 0x0017, 0x0001 }, + { 0x0017, 0x0002 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000f, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0015, 0x000d }, + { 0x0017, 0x0003 }, + { 0x0017, 0x0004 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0007, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x0010, 0x0002 }, + { 0x0013, 0x0005 }, + { 0x0017, 0x0005 }, + { 0x0017, 0x0006 }, + { 0x0017, 0x0007 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000b, 0x0001 }, + { 0x000f, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0016, 0x0015 }, + { 0x0017, 0x0008 }, + { 0x0017, 0x0009 }, + { 0x0017, 0x000a }, + { 0x000f, 0x0005 }, + { 0x000e, 0x0003 }, + { 0x0010, 0x0003 }, + { 0x0012, 0x0006 }, + { 0x0014, 0x0009 }, + { 0x0017, 0x000b }, + { 0x0017, 0x000c }, + { 0x0017, 0x000d }, + { 0x0017, 0x000e }, + { 0x0013, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0013, 0x0007 }, + { 0x0015, 0x000e }, + { 0x0017, 0x000f }, + { 0x0017, 0x0010 }, + { 0x0017, 0x0011 }, + { 0x0017, 0x0012 }, + { 0x0017, 0x0013 }, + { 0x0016, 0x0016 }, + { 0x0016, 0x0017 }, + { 0x0015, 0x000f }, + { 0x0016, 0x0018 }, + { 0x0017, 0x0014 }, + { 0x0017, 0x0015 }, + { 0x0017, 0x0016 }, + { 0x0017, 0x0017 }, + { 0x0017, 0x0018 }, + { 0x0017, 0x0019 }, + { 0x0017, 0x001a }, + { 0x0017, 0x001b }, + { 0x0017, 0x001c }, + { 0x0017, 0x001d }, + { 0x0017, 0x001e }, + { 0x0017, 0x001f }, + { 0x0017, 0x0020 }, + { 0x0017, 0x0021 }, + { 0x0017, 0x0022 }, + { 0x0017, 0x0023 }, + { 0x0017, 0x0024 }, + { 0x0017, 0x0025 }, + { 0x0017, 0x0026 }, + { 0x0017, 0x0027 }, + { 0x0017, 0x0028 }, + { 0x0017, 0x0029 }, + { 0x0016, 0x0019 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec8[16][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0004ffff, 0x00010014, 0x00010014, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x0005ffff, 0x00000015, 0x0001001d, 0x0001001d, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0007ffff, 0x0006ffff, 0x00000016, 0x00000026, 0x00010004, 0x00010004, 0x0001000d, 0x0001000d, 0x0001001e, 0x0001001e, 0x00010024, 0x00010024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, - {0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x00000028, 0x00010017, 0x00010017, 0x0001002d, 0x0001002d, 0x0001002f, 0x0001002f, }, - {0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, - {0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, }, - {0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, }, - {0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x00010031, 0x00010031, }, - {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, - {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, - {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, }, +const uint32_t c_aauiCQMFHuffDec8[16][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00010001, + 0x00010001, + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003ffff, + 0x0004ffff, + 0x00010014, + 0x00010014, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + }, + { + 0x0005ffff, + 0x00000015, + 0x0001001d, + 0x0001001d, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0007ffff, + 0x0006ffff, + 0x00000016, + 0x00000026, + 0x00010004, + 0x00010004, + 0x0001000d, + 0x0001000d, + 0x0001001e, + 0x0001001e, + 0x00010024, + 0x00010024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + }, + { + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + }, + { + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x00000005, + 0x00000028, + 0x00010017, + 0x00010017, + 0x0001002d, + 0x0001002d, + 0x0001002f, + 0x0001002f, + }, + { + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020050, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + }, + { + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + }, + { + 0x00010006, + 0x00010006, + 0x00010007, + 0x00010007, + 0x00010008, + 0x00010008, + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + }, + { + 0x00010021, + 0x00010021, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x00010031, + 0x00010031, + }, + { + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + }, + { + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + }, + { + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + }, }; #endif @@ -472,48 +2609,508 @@ const uint32_t c_aauiCQMFHuffEnc9[100][2] = #else const uint16_t c_aauiCQMFHuffEnc9[100][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000d, 0x0002}, {0x0011, 0x0004}, {0x0014, 0x000a}, {0x0017, 0x0000}, - {0x0017, 0x0001}, {0x0017, 0x0002}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, {0x0009, 0x0002}, {0x000d, 0x0003}, {0x0010, 0x0004}, - {0x0013, 0x0007}, {0x0016, 0x0018}, {0x0017, 0x0003}, {0x0017, 0x0004}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0008, 0x0002}, {0x000b, 0x0002}, - {0x000e, 0x0002}, {0x0011, 0x0005}, {0x0014, 0x000b}, {0x0016, 0x0019}, {0x0017, 0x0005}, {0x0017, 0x0006}, {0x0009, 0x0003}, {0x0008, 0x0003}, - {0x000b, 0x0003}, {0x000d, 0x0004}, {0x0010, 0x0005}, {0x0012, 0x0006}, {0x0015, 0x000f}, {0x0017, 0x0007}, {0x0017, 0x0008}, {0x0017, 0x0009}, - {0x000d, 0x0005}, {0x000c, 0x0003}, {0x000e, 0x0003}, {0x0010, 0x0006}, {0x0012, 0x0007}, {0x0014, 0x000c}, {0x0017, 0x000a}, {0x0016, 0x001a}, - {0x0017, 0x000b}, {0x0017, 0x000c}, {0x0011, 0x0006}, {0x0010, 0x0007}, {0x0011, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0015, 0x0010}, - {0x0017, 0x000d}, {0x0017, 0x000e}, {0x0017, 0x000f}, {0x0017, 0x0010}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0014, 0x000d}, {0x0015, 0x0011}, - {0x0017, 0x0011}, {0x0016, 0x001b}, {0x0017, 0x0012}, {0x0017, 0x0013}, {0x0017, 0x0014}, {0x0017, 0x0015}, {0x0017, 0x0016}, {0x0015, 0x0012}, - {0x0015, 0x0013}, {0x0017, 0x0017}, {0x0016, 0x001c}, {0x0017, 0x0018}, {0x0017, 0x0019}, {0x0017, 0x001a}, {0x0017, 0x001b}, {0x0017, 0x001c}, - {0x0017, 0x001d}, {0x0017, 0x001e}, {0x0017, 0x001f}, {0x0017, 0x0020}, {0x0017, 0x0021}, {0x0017, 0x0022}, {0x0017, 0x0023}, {0x0017, 0x0024}, - {0x0017, 0x0025}, {0x0017, 0x0026}, {0x0017, 0x0027}, {0x0017, 0x0028}, {0x0017, 0x0029}, {0x0017, 0x002a}, {0x0017, 0x002b}, {0x0017, 0x002c}, - {0x0017, 0x002d}, {0x0017, 0x002e}, {0x0017, 0x002f}, {0x0016, 0x001d}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000d, 0x0002 }, + { 0x0011, 0x0004 }, + { 0x0014, 0x000a }, + { 0x0017, 0x0000 }, + { 0x0017, 0x0001 }, + { 0x0017, 0x0002 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0009, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x0010, 0x0004 }, + { 0x0013, 0x0007 }, + { 0x0016, 0x0018 }, + { 0x0017, 0x0003 }, + { 0x0017, 0x0004 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0008, 0x0002 }, + { 0x000b, 0x0002 }, + { 0x000e, 0x0002 }, + { 0x0011, 0x0005 }, + { 0x0014, 0x000b }, + { 0x0016, 0x0019 }, + { 0x0017, 0x0005 }, + { 0x0017, 0x0006 }, + { 0x0009, 0x0003 }, + { 0x0008, 0x0003 }, + { 0x000b, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0015, 0x000f }, + { 0x0017, 0x0007 }, + { 0x0017, 0x0008 }, + { 0x0017, 0x0009 }, + { 0x000d, 0x0005 }, + { 0x000c, 0x0003 }, + { 0x000e, 0x0003 }, + { 0x0010, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0014, 0x000c }, + { 0x0017, 0x000a }, + { 0x0016, 0x001a }, + { 0x0017, 0x000b }, + { 0x0017, 0x000c }, + { 0x0011, 0x0006 }, + { 0x0010, 0x0007 }, + { 0x0011, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0015, 0x0010 }, + { 0x0017, 0x000d }, + { 0x0017, 0x000e }, + { 0x0017, 0x000f }, + { 0x0017, 0x0010 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0014, 0x000d }, + { 0x0015, 0x0011 }, + { 0x0017, 0x0011 }, + { 0x0016, 0x001b }, + { 0x0017, 0x0012 }, + { 0x0017, 0x0013 }, + { 0x0017, 0x0014 }, + { 0x0017, 0x0015 }, + { 0x0017, 0x0016 }, + { 0x0015, 0x0012 }, + { 0x0015, 0x0013 }, + { 0x0017, 0x0017 }, + { 0x0016, 0x001c }, + { 0x0017, 0x0018 }, + { 0x0017, 0x0019 }, + { 0x0017, 0x001a }, + { 0x0017, 0x001b }, + { 0x0017, 0x001c }, + { 0x0017, 0x001d }, + { 0x0017, 0x001e }, + { 0x0017, 0x001f }, + { 0x0017, 0x0020 }, + { 0x0017, 0x0021 }, + { 0x0017, 0x0022 }, + { 0x0017, 0x0023 }, + { 0x0017, 0x0024 }, + { 0x0017, 0x0025 }, + { 0x0017, 0x0026 }, + { 0x0017, 0x0027 }, + { 0x0017, 0x0028 }, + { 0x0017, 0x0029 }, + { 0x0017, 0x002a }, + { 0x0017, 0x002b }, + { 0x0017, 0x002c }, + { 0x0017, 0x002d }, + { 0x0017, 0x002e }, + { 0x0017, 0x002f }, + { 0x0016, 0x001d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec9[22][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0004ffff, 0x00000016, 0x0000001f, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x00000029, 0x00010017, 0x00010017, 0x00010020, 0x00010020, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x000bffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x0000000f, 0x00000022, 0x0000002b, 0x00000033, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, - {0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, - {0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x000fffff, 0x000dffff, 0x000cffff, 0x000effff, 0x00000006, 0x0000001a, 0x0000002d, 0x0000003e, 0x00010010, 0x00010010, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, - {0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, - {0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020041, 0x00020041, 0x00020041, 0x00020041, }, - {0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x00010025, 0x00010025, }, - {0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x0001002e, 0x0001002e, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, - {0x0001003b, 0x0001003b, 0x00010040, 0x00010040, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010049, 0x00010049, }, - {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, - {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, - {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, +const uint32_t c_aauiCQMFHuffDec9[22][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00010001, + 0x00010001, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003ffff, + 0x0004ffff, + 0x00000016, + 0x0000001f, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x00000029, + 0x00010017, + 0x00010017, + 0x00010020, + 0x00010020, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x000bffff, + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x0000000f, + 0x00000022, + 0x0000002b, + 0x00000033, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + }, + { + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + }, + { + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + }, + { + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + }, + { + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x000fffff, + 0x000dffff, + 0x000cffff, + 0x000effff, + 0x00000006, + 0x0000001a, + 0x0000002d, + 0x0000003e, + 0x00010010, + 0x00010010, + }, + { + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + }, + { + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + }, + { + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + }, + { + 0x00010007, + 0x00010007, + 0x00010008, + 0x00010008, + 0x00010009, + 0x00010009, + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + 0x00010025, + 0x00010025, + }, + { + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x0001002e, + 0x0001002e, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x0001003a, + 0x0001003a, + }, + { + 0x0001003b, + 0x0001003b, + 0x00010040, + 0x00010040, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010049, + 0x00010049, + }, + { + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + 0x00010052, + 0x00010052, + }, + { + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x0001005a, + 0x0001005a, + }, + { + 0x0001005b, + 0x0001005b, + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + }, }; #endif @@ -522,80 +3119,991 @@ const uint32_t c_aauiCQMFHuffEnc10[169][2] = #else const uint16_t c_aauiCQMFHuffEnc10[169][2] = #endif -{ - {0x0001, 0x0001}, {0x0004, 0x0002}, {0x0005, 0x0002}, {0x0007, 0x0002}, {0x000a, 0x0002}, {0x000e, 0x0004}, {0x0011, 0x0007}, {0x0013, 0x0012}, - {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0004, 0x0003}, {0x0003, 0x0003}, {0x0004, 0x0004}, - {0x0007, 0x0003}, {0x000a, 0x0003}, {0x000d, 0x0004}, {0x0010, 0x0007}, {0x0013, 0x0013}, {0x0015, 0x0035}, {0x0016, 0x0005}, {0x0016, 0x0006}, - {0x0016, 0x0007}, {0x0016, 0x0008}, {0x0005, 0x0003}, {0x0004, 0x0005}, {0x0006, 0x0003}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000e, 0x0005}, - {0x0010, 0x0008}, {0x0013, 0x0014}, {0x0014, 0x001d}, {0x0016, 0x0009}, {0x0016, 0x000a}, {0x0016, 0x000b}, {0x0016, 0x000c}, {0x0007, 0x0004}, - {0x0007, 0x0005}, {0x0008, 0x0003}, {0x000a, 0x0004}, {0x000d, 0x0005}, {0x000f, 0x0005}, {0x0011, 0x0008}, {0x0014, 0x001e}, {0x0014, 0x001f}, - {0x0016, 0x000d}, {0x0016, 0x000e}, {0x0016, 0x000f}, {0x0016, 0x0010}, {0x000a, 0x0005}, {0x0009, 0x0003}, {0x000b, 0x0003}, {0x000d, 0x0006}, - {0x000f, 0x0006}, {0x0011, 0x0009}, {0x0013, 0x0015}, {0x0014, 0x0020}, {0x0016, 0x0011}, {0x0016, 0x0012}, {0x0016, 0x0013}, {0x0016, 0x0014}, - {0x0016, 0x0015}, {0x000e, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x000f, 0x0007}, {0x0011, 0x000a}, {0x0012, 0x000c}, {0x0016, 0x0016}, - {0x0016, 0x0017}, {0x0016, 0x0018}, {0x0016, 0x0019}, {0x0016, 0x001a}, {0x0016, 0x001b}, {0x0016, 0x001c}, {0x0011, 0x000b}, {0x0010, 0x0009}, - {0x0011, 0x000c}, {0x0011, 0x000d}, {0x0013, 0x0016}, {0x0016, 0x001d}, {0x0016, 0x001e}, {0x0016, 0x001f}, {0x0016, 0x0020}, {0x0016, 0x0021}, - {0x0016, 0x0022}, {0x0016, 0x0023}, {0x0016, 0x0024}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0012, 0x000d}, {0x0013, 0x0017}, {0x0016, 0x0025}, - {0x0016, 0x0026}, {0x0016, 0x0027}, {0x0016, 0x0028}, {0x0016, 0x0029}, {0x0016, 0x002a}, {0x0016, 0x002b}, {0x0016, 0x002c}, {0x0016, 0x002d}, - {0x0015, 0x0036}, {0x0015, 0x0037}, {0x0014, 0x0023}, {0x0015, 0x0038}, {0x0016, 0x002e}, {0x0016, 0x002f}, {0x0016, 0x0030}, {0x0016, 0x0031}, - {0x0016, 0x0032}, {0x0016, 0x0033}, {0x0016, 0x0034}, {0x0016, 0x0035}, {0x0016, 0x0036}, {0x0016, 0x0037}, {0x0016, 0x0038}, {0x0016, 0x0039}, - {0x0016, 0x003a}, {0x0016, 0x003b}, {0x0016, 0x003c}, {0x0016, 0x003d}, {0x0016, 0x003e}, {0x0016, 0x003f}, {0x0016, 0x0040}, {0x0016, 0x0041}, - {0x0016, 0x0042}, {0x0016, 0x0043}, {0x0016, 0x0044}, {0x0016, 0x0045}, {0x0016, 0x0046}, {0x0016, 0x0047}, {0x0016, 0x0048}, {0x0016, 0x0049}, - {0x0016, 0x004a}, {0x0016, 0x004b}, {0x0016, 0x004c}, {0x0016, 0x004d}, {0x0016, 0x004e}, {0x0016, 0x004f}, {0x0016, 0x0050}, {0x0016, 0x0051}, - {0x0016, 0x0052}, {0x0016, 0x0053}, {0x0016, 0x0054}, {0x0016, 0x0055}, {0x0016, 0x0056}, {0x0016, 0x0057}, {0x0016, 0x0058}, {0x0016, 0x0059}, - {0x0016, 0x005a}, {0x0016, 0x005b}, {0x0016, 0x005c}, {0x0016, 0x005d}, {0x0016, 0x005e}, {0x0016, 0x005f}, {0x0016, 0x0060}, {0x0016, 0x0061}, - {0x0016, 0x0062}, {0x0016, 0x0063}, {0x0016, 0x0064}, {0x0016, 0x0065}, {0x0016, 0x0066}, {0x0016, 0x0067}, {0x0016, 0x0068}, {0x0016, 0x0069}, - {0x0015, 0x0039}, + { + { 0x0001, 0x0001 }, + { 0x0004, 0x0002 }, + { 0x0005, 0x0002 }, + { 0x0007, 0x0002 }, + { 0x000a, 0x0002 }, + { 0x000e, 0x0004 }, + { 0x0011, 0x0007 }, + { 0x0013, 0x0012 }, + { 0x0016, 0x0000 }, + { 0x0016, 0x0001 }, + { 0x0016, 0x0002 }, + { 0x0016, 0x0003 }, + { 0x0016, 0x0004 }, + { 0x0004, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0004, 0x0004 }, + { 0x0007, 0x0003 }, + { 0x000a, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x0010, 0x0007 }, + { 0x0013, 0x0013 }, + { 0x0015, 0x0035 }, + { 0x0016, 0x0005 }, + { 0x0016, 0x0006 }, + { 0x0016, 0x0007 }, + { 0x0016, 0x0008 }, + { 0x0005, 0x0003 }, + { 0x0004, 0x0005 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0002 }, + { 0x000b, 0x0002 }, + { 0x000e, 0x0005 }, + { 0x0010, 0x0008 }, + { 0x0013, 0x0014 }, + { 0x0014, 0x001d }, + { 0x0016, 0x0009 }, + { 0x0016, 0x000a }, + { 0x0016, 0x000b }, + { 0x0016, 0x000c }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000f, 0x0005 }, + { 0x0011, 0x0008 }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0016, 0x000d }, + { 0x0016, 0x000e }, + { 0x0016, 0x000f }, + { 0x0016, 0x0010 }, + { 0x000a, 0x0005 }, + { 0x0009, 0x0003 }, + { 0x000b, 0x0003 }, + { 0x000d, 0x0006 }, + { 0x000f, 0x0006 }, + { 0x0011, 0x0009 }, + { 0x0013, 0x0015 }, + { 0x0014, 0x0020 }, + { 0x0016, 0x0011 }, + { 0x0016, 0x0012 }, + { 0x0016, 0x0013 }, + { 0x0016, 0x0014 }, + { 0x0016, 0x0015 }, + { 0x000e, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0007 }, + { 0x000f, 0x0007 }, + { 0x0011, 0x000a }, + { 0x0012, 0x000c }, + { 0x0016, 0x0016 }, + { 0x0016, 0x0017 }, + { 0x0016, 0x0018 }, + { 0x0016, 0x0019 }, + { 0x0016, 0x001a }, + { 0x0016, 0x001b }, + { 0x0016, 0x001c }, + { 0x0011, 0x000b }, + { 0x0010, 0x0009 }, + { 0x0011, 0x000c }, + { 0x0011, 0x000d }, + { 0x0013, 0x0016 }, + { 0x0016, 0x001d }, + { 0x0016, 0x001e }, + { 0x0016, 0x001f }, + { 0x0016, 0x0020 }, + { 0x0016, 0x0021 }, + { 0x0016, 0x0022 }, + { 0x0016, 0x0023 }, + { 0x0016, 0x0024 }, + { 0x0014, 0x0021 }, + { 0x0014, 0x0022 }, + { 0x0012, 0x000d }, + { 0x0013, 0x0017 }, + { 0x0016, 0x0025 }, + { 0x0016, 0x0026 }, + { 0x0016, 0x0027 }, + { 0x0016, 0x0028 }, + { 0x0016, 0x0029 }, + { 0x0016, 0x002a }, + { 0x0016, 0x002b }, + { 0x0016, 0x002c }, + { 0x0016, 0x002d }, + { 0x0015, 0x0036 }, + { 0x0015, 0x0037 }, + { 0x0014, 0x0023 }, + { 0x0015, 0x0038 }, + { 0x0016, 0x002e }, + { 0x0016, 0x002f }, + { 0x0016, 0x0030 }, + { 0x0016, 0x0031 }, + { 0x0016, 0x0032 }, + { 0x0016, 0x0033 }, + { 0x0016, 0x0034 }, + { 0x0016, 0x0035 }, + { 0x0016, 0x0036 }, + { 0x0016, 0x0037 }, + { 0x0016, 0x0038 }, + { 0x0016, 0x0039 }, + { 0x0016, 0x003a }, + { 0x0016, 0x003b }, + { 0x0016, 0x003c }, + { 0x0016, 0x003d }, + { 0x0016, 0x003e }, + { 0x0016, 0x003f }, + { 0x0016, 0x0040 }, + { 0x0016, 0x0041 }, + { 0x0016, 0x0042 }, + { 0x0016, 0x0043 }, + { 0x0016, 0x0044 }, + { 0x0016, 0x0045 }, + { 0x0016, 0x0046 }, + { 0x0016, 0x0047 }, + { 0x0016, 0x0048 }, + { 0x0016, 0x0049 }, + { 0x0016, 0x004a }, + { 0x0016, 0x004b }, + { 0x0016, 0x004c }, + { 0x0016, 0x004d }, + { 0x0016, 0x004e }, + { 0x0016, 0x004f }, + { 0x0016, 0x0050 }, + { 0x0016, 0x0051 }, + { 0x0016, 0x0052 }, + { 0x0016, 0x0053 }, + { 0x0016, 0x0054 }, + { 0x0016, 0x0055 }, + { 0x0016, 0x0056 }, + { 0x0016, 0x0057 }, + { 0x0016, 0x0058 }, + { 0x0016, 0x0059 }, + { 0x0016, 0x005a }, + { 0x0016, 0x005b }, + { 0x0016, 0x005c }, + { 0x0016, 0x005d }, + { 0x0016, 0x005e }, + { 0x0016, 0x005f }, + { 0x0016, 0x0060 }, + { 0x0016, 0x0061 }, + { 0x0016, 0x0062 }, + { 0x0016, 0x0063 }, + { 0x0016, 0x0064 }, + { 0x0016, 0x0065 }, + { 0x0016, 0x0066 }, + { 0x0016, 0x0067 }, + { 0x0016, 0x0068 }, + { 0x0016, 0x0069 }, + { 0x0015, 0x0039 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec10[45][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00000001, 0x0000000d, 0x0000000f, 0x0000001b, 0x0001000e, 0x0001000e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, - {0x0004ffff, 0x0003ffff, 0x0000001d, 0x00000029, 0x00010003, 0x00010003, 0x00010010, 0x00010010, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, - {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001001e, 0x0001001e, 0x00010036, 0x00010036, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, - {0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020043, 0x00020043, 0x00020043, 0x00020043, }, - {0x0012ffff, 0x000effff, 0x000dffff, 0x000affff, 0x0009ffff, 0x000bffff, 0x000cffff, 0x00000013, 0x00000020, 0x0000004f, 0x0001002c, 0x0001002c, 0x00010038, 0x00010038, 0x00010044, 0x00010044, }, - {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, - {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, - {0x0000003b, 0x0000005b, 0x0000005c, 0x0000006a, 0x00010007, 0x00010007, 0x00010014, 0x00010014, 0x00010021, 0x00010021, 0x0001003a, 0x0001003a, 0x00010052, 0x00010052, 0x0001005e, 0x0001005e, }, - {0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x00000022, 0x0000002e, 0x0000002f, }, - {0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, - {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, }, - {0x0014ffff, 0x0017ffff, 0x0015ffff, 0x0016ffff, 0x001cffff, 0x0013ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, }, - {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, }, - {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, - {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, - {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, }, - {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, }, - {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x00020055, 0x00020055, 0x00020055, 0x00020055, }, - {0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, }, - {0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, }, - {0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, }, - {0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, }, - {0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, }, - {0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, }, - {0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020075, 0x00020075, 0x00020075, 0x00020075, }, - {0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, }, - {0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, }, - {0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, - {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, 0x00020085, 0x00020085, 0x00020085, 0x00020085, }, - {0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, }, - {0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, }, - {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, - {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, - {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, 0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x00020099, 0x00020099, 0x00020099, 0x00020099, }, - {0x0002009a, 0x0002009a, 0x0002009a, 0x0002009a, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, }, - {0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, - {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, +const uint32_t c_aauiCQMFHuffDec10[45][16] = { + { + 0x0002ffff, + 0x0001ffff, + 0x00000001, + 0x0000000d, + 0x0000000f, + 0x0000001b, + 0x0001000e, + 0x0001000e, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + }, + { + 0x0004ffff, + 0x0003ffff, + 0x0000001d, + 0x00000029, + 0x00010003, + 0x00010003, + 0x00010010, + 0x00010010, + 0x00010027, + 0x00010027, + 0x00010028, + 0x00010028, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, + { + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x0008ffff, + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x0001001e, + 0x0001001e, + 0x00010036, + 0x00010036, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + }, + { + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020043, + 0x00020043, + 0x00020043, + 0x00020043, + }, + { + 0x0012ffff, + 0x000effff, + 0x000dffff, + 0x000affff, + 0x0009ffff, + 0x000bffff, + 0x000cffff, + 0x00000013, + 0x00000020, + 0x0000004f, + 0x0001002c, + 0x0001002c, + 0x00010038, + 0x00010038, + 0x00010044, + 0x00010044, + }, + { + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + }, + { + 0x00020046, + 0x00020046, + 0x00020046, + 0x00020046, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + }, + { + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + }, + { + 0x0000003b, + 0x0000005b, + 0x0000005c, + 0x0000006a, + 0x00010007, + 0x00010007, + 0x00010014, + 0x00010014, + 0x00010021, + 0x00010021, + 0x0001003a, + 0x0001003a, + 0x00010052, + 0x00010052, + 0x0001005e, + 0x0001005e, + }, + { + 0x0023ffff, + 0x0024ffff, + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x00000022, + 0x0000002e, + 0x0000002f, + }, + { + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + }, + { + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + }, + { + 0x0014ffff, + 0x0017ffff, + 0x0015ffff, + 0x0016ffff, + 0x001cffff, + 0x0013ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + }, + { + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + }, + { + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + }, + { + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020032, + 0x00020032, + 0x00020032, + 0x00020032, + }, + { + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + }, + { + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004c, + }, + { + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020054, + 0x00020054, + 0x00020054, + 0x00020054, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020055, + }, + { + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + }, + { + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + }, + { + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + }, + { + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + }, + { + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020067, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006d, + }, + { + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020071, + }, + { + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + }, + { + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + }, + { + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007d, + }, + { + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020081, + }, + { + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020085, + }, + { + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020089, + 0x00020089, + 0x00020089, + 0x00020089, + }, + { + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008d, + 0x0002008d, + 0x0002008d, + 0x0002008d, + }, + { + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020091, + }, + { + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020095, + 0x00020095, + 0x00020095, + 0x00020095, + }, + { + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020097, + 0x00020097, + 0x00020097, + 0x00020097, + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020099, + 0x00020099, + 0x00020099, + 0x00020099, + }, + { + 0x0002009a, + 0x0002009a, + 0x0002009a, + 0x0002009a, + 0x0002009b, + 0x0002009b, + 0x0002009b, + 0x0002009b, + 0x0002009c, + 0x0002009c, + 0x0002009c, + 0x0002009c, + 0x0002009d, + 0x0002009d, + 0x0002009d, + 0x0002009d, + }, + { + 0x0002009e, + 0x0002009e, + 0x0002009e, + 0x0002009e, + 0x0002009f, + 0x0002009f, + 0x0002009f, + 0x0002009f, + 0x000200a0, + 0x000200a0, + 0x000200a0, + 0x000200a0, + 0x000200a1, + 0x000200a1, + 0x000200a1, + 0x000200a1, + }, + { + 0x000200a2, + 0x000200a2, + 0x000200a2, + 0x000200a2, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + }, }; #endif @@ -604,88 +4112,1108 @@ const uint32_t c_aauiCQMFHuffEnc11[196][2] = #else const uint16_t c_aauiCQMFHuffEnc11[196][2] = #endif -{ - {0x0001, 0x0001}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x000f, 0x0005}, {0x0012, 0x000d}, - {0x0014, 0x001f}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0004, 0x0004}, {0x0003, 0x0003}, - {0x0005, 0x0004}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000b, 0x0004}, {0x000e, 0x0005}, {0x0010, 0x0007}, {0x0012, 0x000e}, {0x0014, 0x0020}, - {0x0016, 0x0005}, {0x0016, 0x0006}, {0x0016, 0x0007}, {0x0016, 0x0008}, {0x0005, 0x0005}, {0x0004, 0x0005}, {0x0006, 0x0004}, {0x0007, 0x0003}, - {0x000a, 0x0004}, {0x000c, 0x0005}, {0x000e, 0x0006}, {0x0011, 0x000a}, {0x0012, 0x000f}, {0x0015, 0x003b}, {0x0016, 0x0009}, {0x0016, 0x000a}, - {0x0016, 0x000b}, {0x0016, 0x000c}, {0x0007, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000d, 0x0005}, - {0x000f, 0x0006}, {0x0012, 0x0010}, {0x0014, 0x0021}, {0x0016, 0x000d}, {0x0016, 0x000e}, {0x0016, 0x000f}, {0x0016, 0x0010}, {0x0016, 0x0011}, - {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x0006}, {0x000f, 0x0007}, {0x0011, 0x000b}, {0x0013, 0x0017}, - {0x0014, 0x0022}, {0x0016, 0x0012}, {0x0016, 0x0013}, {0x0016, 0x0014}, {0x0016, 0x0015}, {0x0016, 0x0016}, {0x000c, 0x0006}, {0x000b, 0x0007}, - {0x000c, 0x0007}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x0010, 0x0008}, {0x0012, 0x0011}, {0x0014, 0x0023}, {0x0015, 0x003c}, {0x0016, 0x0017}, - {0x0016, 0x0018}, {0x0016, 0x0019}, {0x0016, 0x001a}, {0x0016, 0x001b}, {0x000f, 0x0008}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0009}, - {0x0011, 0x000c}, {0x0013, 0x0018}, {0x0014, 0x0024}, {0x0016, 0x001c}, {0x0016, 0x001d}, {0x0016, 0x001e}, {0x0016, 0x001f}, {0x0016, 0x0020}, - {0x0016, 0x0021}, {0x0016, 0x0022}, {0x0011, 0x000d}, {0x0010, 0x0009}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0014, 0x0025}, {0x0015, 0x003d}, - {0x0014, 0x0026}, {0x0016, 0x0023}, {0x0016, 0x0024}, {0x0016, 0x0025}, {0x0016, 0x0026}, {0x0016, 0x0027}, {0x0016, 0x0028}, {0x0016, 0x0029}, - {0x0014, 0x0027}, {0x0013, 0x0019}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0016, 0x002a}, {0x0016, 0x002b}, {0x0016, 0x002c}, - {0x0016, 0x002d}, {0x0016, 0x002e}, {0x0016, 0x002f}, {0x0016, 0x0030}, {0x0016, 0x0031}, {0x0016, 0x0032}, {0x0014, 0x002b}, {0x0014, 0x002c}, - {0x0014, 0x002d}, {0x0016, 0x0033}, {0x0016, 0x0034}, {0x0016, 0x0035}, {0x0016, 0x0036}, {0x0016, 0x0037}, {0x0016, 0x0038}, {0x0016, 0x0039}, - {0x0016, 0x003a}, {0x0016, 0x003b}, {0x0016, 0x003c}, {0x0016, 0x003d}, {0x0016, 0x003e}, {0x0016, 0x003f}, {0x0016, 0x0040}, {0x0016, 0x0041}, - {0x0016, 0x0042}, {0x0016, 0x0043}, {0x0016, 0x0044}, {0x0016, 0x0045}, {0x0016, 0x0046}, {0x0016, 0x0047}, {0x0016, 0x0048}, {0x0016, 0x0049}, - {0x0016, 0x004a}, {0x0016, 0x004b}, {0x0016, 0x004c}, {0x0016, 0x004d}, {0x0016, 0x004e}, {0x0016, 0x004f}, {0x0016, 0x0050}, {0x0016, 0x0051}, - {0x0016, 0x0052}, {0x0016, 0x0053}, {0x0016, 0x0054}, {0x0016, 0x0055}, {0x0016, 0x0056}, {0x0016, 0x0057}, {0x0016, 0x0058}, {0x0016, 0x0059}, - {0x0016, 0x005a}, {0x0016, 0x005b}, {0x0016, 0x005c}, {0x0016, 0x005d}, {0x0016, 0x005e}, {0x0016, 0x005f}, {0x0016, 0x0060}, {0x0016, 0x0061}, - {0x0016, 0x0062}, {0x0016, 0x0063}, {0x0016, 0x0064}, {0x0016, 0x0065}, {0x0016, 0x0066}, {0x0016, 0x0067}, {0x0016, 0x0068}, {0x0016, 0x0069}, - {0x0016, 0x006a}, {0x0016, 0x006b}, {0x0016, 0x006c}, {0x0016, 0x006d}, {0x0016, 0x006e}, {0x0016, 0x006f}, {0x0016, 0x0070}, {0x0016, 0x0071}, - {0x0016, 0x0072}, {0x0016, 0x0073}, {0x0016, 0x0074}, {0x0016, 0x0075}, + { + { 0x0001, 0x0001 }, + { 0x0004, 0x0003 }, + { 0x0005, 0x0003 }, + { 0x0007, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x0012, 0x000d }, + { 0x0014, 0x001f }, + { 0x0016, 0x0000 }, + { 0x0016, 0x0001 }, + { 0x0016, 0x0002 }, + { 0x0016, 0x0003 }, + { 0x0016, 0x0004 }, + { 0x0004, 0x0004 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0006, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x000b, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x0010, 0x0007 }, + { 0x0012, 0x000e }, + { 0x0014, 0x0020 }, + { 0x0016, 0x0005 }, + { 0x0016, 0x0006 }, + { 0x0016, 0x0007 }, + { 0x0016, 0x0008 }, + { 0x0005, 0x0005 }, + { 0x0004, 0x0005 }, + { 0x0006, 0x0004 }, + { 0x0007, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000e, 0x0006 }, + { 0x0011, 0x000a }, + { 0x0012, 0x000f }, + { 0x0015, 0x003b }, + { 0x0016, 0x0009 }, + { 0x0016, 0x000a }, + { 0x0016, 0x000b }, + { 0x0016, 0x000c }, + { 0x0007, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0005 }, + { 0x0009, 0x0005 }, + { 0x000b, 0x0005 }, + { 0x000d, 0x0005 }, + { 0x000f, 0x0006 }, + { 0x0012, 0x0010 }, + { 0x0014, 0x0021 }, + { 0x0016, 0x000d }, + { 0x0016, 0x000e }, + { 0x0016, 0x000f }, + { 0x0016, 0x0010 }, + { 0x0016, 0x0011 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x000a, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000d, 0x0006 }, + { 0x000f, 0x0007 }, + { 0x0011, 0x000b }, + { 0x0013, 0x0017 }, + { 0x0014, 0x0022 }, + { 0x0016, 0x0012 }, + { 0x0016, 0x0013 }, + { 0x0016, 0x0014 }, + { 0x0016, 0x0015 }, + { 0x0016, 0x0016 }, + { 0x000c, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0007 }, + { 0x0010, 0x0008 }, + { 0x0012, 0x0011 }, + { 0x0014, 0x0023 }, + { 0x0015, 0x003c }, + { 0x0016, 0x0017 }, + { 0x0016, 0x0018 }, + { 0x0016, 0x0019 }, + { 0x0016, 0x001a }, + { 0x0016, 0x001b }, + { 0x000f, 0x0008 }, + { 0x000e, 0x0008 }, + { 0x000e, 0x0009 }, + { 0x000f, 0x0009 }, + { 0x0011, 0x000c }, + { 0x0013, 0x0018 }, + { 0x0014, 0x0024 }, + { 0x0016, 0x001c }, + { 0x0016, 0x001d }, + { 0x0016, 0x001e }, + { 0x0016, 0x001f }, + { 0x0016, 0x0020 }, + { 0x0016, 0x0021 }, + { 0x0016, 0x0022 }, + { 0x0011, 0x000d }, + { 0x0010, 0x0009 }, + { 0x0012, 0x0012 }, + { 0x0012, 0x0013 }, + { 0x0014, 0x0025 }, + { 0x0015, 0x003d }, + { 0x0014, 0x0026 }, + { 0x0016, 0x0023 }, + { 0x0016, 0x0024 }, + { 0x0016, 0x0025 }, + { 0x0016, 0x0026 }, + { 0x0016, 0x0027 }, + { 0x0016, 0x0028 }, + { 0x0016, 0x0029 }, + { 0x0014, 0x0027 }, + { 0x0013, 0x0019 }, + { 0x0014, 0x0028 }, + { 0x0014, 0x0029 }, + { 0x0014, 0x002a }, + { 0x0016, 0x002a }, + { 0x0016, 0x002b }, + { 0x0016, 0x002c }, + { 0x0016, 0x002d }, + { 0x0016, 0x002e }, + { 0x0016, 0x002f }, + { 0x0016, 0x0030 }, + { 0x0016, 0x0031 }, + { 0x0016, 0x0032 }, + { 0x0014, 0x002b }, + { 0x0014, 0x002c }, + { 0x0014, 0x002d }, + { 0x0016, 0x0033 }, + { 0x0016, 0x0034 }, + { 0x0016, 0x0035 }, + { 0x0016, 0x0036 }, + { 0x0016, 0x0037 }, + { 0x0016, 0x0038 }, + { 0x0016, 0x0039 }, + { 0x0016, 0x003a }, + { 0x0016, 0x003b }, + { 0x0016, 0x003c }, + { 0x0016, 0x003d }, + { 0x0016, 0x003e }, + { 0x0016, 0x003f }, + { 0x0016, 0x0040 }, + { 0x0016, 0x0041 }, + { 0x0016, 0x0042 }, + { 0x0016, 0x0043 }, + { 0x0016, 0x0044 }, + { 0x0016, 0x0045 }, + { 0x0016, 0x0046 }, + { 0x0016, 0x0047 }, + { 0x0016, 0x0048 }, + { 0x0016, 0x0049 }, + { 0x0016, 0x004a }, + { 0x0016, 0x004b }, + { 0x0016, 0x004c }, + { 0x0016, 0x004d }, + { 0x0016, 0x004e }, + { 0x0016, 0x004f }, + { 0x0016, 0x0050 }, + { 0x0016, 0x0051 }, + { 0x0016, 0x0052 }, + { 0x0016, 0x0053 }, + { 0x0016, 0x0054 }, + { 0x0016, 0x0055 }, + { 0x0016, 0x0056 }, + { 0x0016, 0x0057 }, + { 0x0016, 0x0058 }, + { 0x0016, 0x0059 }, + { 0x0016, 0x005a }, + { 0x0016, 0x005b }, + { 0x0016, 0x005c }, + { 0x0016, 0x005d }, + { 0x0016, 0x005e }, + { 0x0016, 0x005f }, + { 0x0016, 0x0060 }, + { 0x0016, 0x0061 }, + { 0x0016, 0x0062 }, + { 0x0016, 0x0063 }, + { 0x0016, 0x0064 }, + { 0x0016, 0x0065 }, + { 0x0016, 0x0066 }, + { 0x0016, 0x0067 }, + { 0x0016, 0x0068 }, + { 0x0016, 0x0069 }, + { 0x0016, 0x006a }, + { 0x0016, 0x006b }, + { 0x0016, 0x006c }, + { 0x0016, 0x006d }, + { 0x0016, 0x006e }, + { 0x0016, 0x006f }, + { 0x0016, 0x0070 }, + { 0x0016, 0x0071 }, + { 0x0016, 0x0072 }, + { 0x0016, 0x0073 }, + { 0x0016, 0x0074 }, + { 0x0016, 0x0075 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec11[50][16] = -{ - {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000001, 0x0000000e, 0x0000001d, 0x0001000f, 0x0001000f, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0007ffff, 0x0005ffff, 0x0004ffff, 0x0006ffff, 0x00010003, 0x00010003, 0x0001001f, 0x0001001f, 0x0001002a, 0x0001002a, 0x0001002c, 0x0001002c, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x000bffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x00000021, 0x00000046, 0x00000048, 0x00010013, 0x00010013, 0x0001002e, 0x0001002e, 0x0001003b, 0x0001003b, 0x00010047, 0x00010047, }, - {0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, - {0x00010054, 0x00010054, 0x00010057, 0x00010057, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, - {0x0014ffff, 0x0011ffff, 0x0010ffff, 0x000effff, 0x000fffff, 0x000cffff, 0x000dffff, 0x00000015, 0x0000004b, 0x00000063, 0x00010006, 0x00010006, 0x00010030, 0x00010030, 0x0001003d, 0x0001003d, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, }, - {0x00010059, 0x00010059, 0x00010071, 0x00010071, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, - {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, }, - {0x00000017, 0x00000032, 0x00000040, 0x0000004d, 0x0000005a, 0x00000066, 0x00000068, 0x00000070, 0x00000072, 0x00000073, 0x00000074, 0x0000007e, 0x0000007f, 0x00000080, 0x0001003f, 0x0001003f, }, - {0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0013ffff, 0x0012ffff, 0x00000008, }, - {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, - {0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, - {0x001affff, 0x0019ffff, 0x0015ffff, 0x0018ffff, 0x001dffff, 0x0016ffff, 0x0017ffff, 0x001bffff, 0x001cffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, - {0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, - {0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, - {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020035, 0x00020035, 0x00020035, 0x00020035, }, - {0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, - {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, - {0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020069, 0x00020069, 0x00020069, 0x00020069, }, - {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, }, - {0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, }, - {0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, }, - {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, - {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, - {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, 0x00020085, 0x00020085, 0x00020085, 0x00020085, }, - {0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, }, - {0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, }, - {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, - {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, - {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, 0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x00020099, 0x00020099, 0x00020099, 0x00020099, }, - {0x0002009a, 0x0002009a, 0x0002009a, 0x0002009a, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009b, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009c, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, }, - {0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, - {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, - {0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, }, - {0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, }, - {0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, }, - {0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, }, - {0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b9, 0x000200b9, 0x000200b9, 0x000200b9, }, - {0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200bd, }, - {0x000200be, 0x000200be, 0x000200be, 0x000200be, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, }, +const uint32_t c_aauiCQMFHuffDec11[50][16] = { + { + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000001, + 0x0000000e, + 0x0000001d, + 0x0001000f, + 0x0001000f, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0007ffff, + 0x0005ffff, + 0x0004ffff, + 0x0006ffff, + 0x00010003, + 0x00010003, + 0x0001001f, + 0x0001001f, + 0x0001002a, + 0x0001002a, + 0x0001002c, + 0x0001002c, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + }, + { + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + }, + { + 0x000bffff, + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x00000005, + 0x00000021, + 0x00000046, + 0x00000048, + 0x00010013, + 0x00010013, + 0x0001002e, + 0x0001002e, + 0x0001003b, + 0x0001003b, + 0x00010047, + 0x00010047, + }, + { + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + }, + { + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + }, + { + 0x00010054, + 0x00010054, + 0x00010057, + 0x00010057, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + }, + { + 0x0014ffff, + 0x0011ffff, + 0x0010ffff, + 0x000effff, + 0x000fffff, + 0x000cffff, + 0x000dffff, + 0x00000015, + 0x0000004b, + 0x00000063, + 0x00010006, + 0x00010006, + 0x00010030, + 0x00010030, + 0x0001003d, + 0x0001003d, + }, + { + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, + { + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + }, + { + 0x00010059, + 0x00010059, + 0x00010071, + 0x00010071, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + }, + { + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + }, + { + 0x00000017, + 0x00000032, + 0x00000040, + 0x0000004d, + 0x0000005a, + 0x00000066, + 0x00000068, + 0x00000070, + 0x00000072, + 0x00000073, + 0x00000074, + 0x0000007e, + 0x0000007f, + 0x00000080, + 0x0001003f, + 0x0001003f, + }, + { + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0013ffff, + 0x0012ffff, + 0x00000008, + }, + { + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + }, + { + 0x000200c2, + 0x000200c2, + 0x000200c2, + 0x000200c2, + 0x000200c3, + 0x000200c3, + 0x000200c3, + 0x000200c3, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + }, + { + 0x001affff, + 0x0019ffff, + 0x0015ffff, + 0x0018ffff, + 0x001dffff, + 0x0016ffff, + 0x0017ffff, + 0x001bffff, + 0x001cffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + }, + { + 0x00020043, + 0x00020043, + 0x00020043, + 0x00020043, + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020045, + 0x00020045, + 0x00020045, + 0x00020045, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x0002004f, + }, + { + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + }, + { + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020035, + }, + { + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + }, + { + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005e, + }, + { + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020069, + 0x00020069, + 0x00020069, + 0x00020069, + }, + { + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020042, + }, + { + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006d, + }, + { + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + }, + { + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007a, + }, + { + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020081, + }, + { + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020085, + }, + { + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020089, + 0x00020089, + 0x00020089, + 0x00020089, + }, + { + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008d, + 0x0002008d, + 0x0002008d, + 0x0002008d, + }, + { + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020091, + }, + { + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020095, + 0x00020095, + 0x00020095, + 0x00020095, + }, + { + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020097, + 0x00020097, + 0x00020097, + 0x00020097, + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020099, + 0x00020099, + 0x00020099, + 0x00020099, + }, + { + 0x0002009a, + 0x0002009a, + 0x0002009a, + 0x0002009a, + 0x0002009b, + 0x0002009b, + 0x0002009b, + 0x0002009b, + 0x0002009c, + 0x0002009c, + 0x0002009c, + 0x0002009c, + 0x0002009d, + 0x0002009d, + 0x0002009d, + 0x0002009d, + }, + { + 0x0002009e, + 0x0002009e, + 0x0002009e, + 0x0002009e, + 0x0002009f, + 0x0002009f, + 0x0002009f, + 0x0002009f, + 0x000200a0, + 0x000200a0, + 0x000200a0, + 0x000200a0, + 0x000200a1, + 0x000200a1, + 0x000200a1, + 0x000200a1, + }, + { + 0x000200a2, + 0x000200a2, + 0x000200a2, + 0x000200a2, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + }, + { + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a9, + 0x000200a9, + 0x000200a9, + 0x000200a9, + }, + { + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200ad, + 0x000200ad, + 0x000200ad, + 0x000200ad, + }, + { + 0x000200ae, + 0x000200ae, + 0x000200ae, + 0x000200ae, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200b1, + 0x000200b1, + 0x000200b1, + 0x000200b1, + }, + { + 0x000200b2, + 0x000200b2, + 0x000200b2, + 0x000200b2, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b5, + 0x000200b5, + 0x000200b5, + 0x000200b5, + }, + { + 0x000200b6, + 0x000200b6, + 0x000200b6, + 0x000200b6, + 0x000200b7, + 0x000200b7, + 0x000200b7, + 0x000200b7, + 0x000200b8, + 0x000200b8, + 0x000200b8, + 0x000200b8, + 0x000200b9, + 0x000200b9, + 0x000200b9, + 0x000200b9, + }, + { + 0x000200ba, + 0x000200ba, + 0x000200ba, + 0x000200ba, + 0x000200bb, + 0x000200bb, + 0x000200bb, + 0x000200bb, + 0x000200bc, + 0x000200bc, + 0x000200bc, + 0x000200bc, + 0x000200bd, + 0x000200bd, + 0x000200bd, + 0x000200bd, + }, + { + 0x000200be, + 0x000200be, + 0x000200be, + 0x000200be, + 0x000200bf, + 0x000200bf, + 0x000200bf, + 0x000200bf, + 0x000200c0, + 0x000200c0, + 0x000200c0, + 0x000200c0, + 0x000200c1, + 0x000200c1, + 0x000200c1, + 0x000200c1, + }, }; #endif @@ -694,126 +5222,1669 @@ const uint32_t c_aauiCQMFHuffEnc12[289][2] = #else const uint16_t c_aauiCQMFHuffEnc12[289][2] = #endif -{ - {0x0001, 0x0001}, {0x0004, 0x0004}, {0x0005, 0x0004}, {0x0007, 0x0004}, {0x0008, 0x0002}, {0x000b, 0x0004}, {0x000e, 0x0006}, {0x0010, 0x0009}, - {0x0012, 0x0014}, {0x0013, 0x001f}, {0x0016, 0x0000}, {0x0016, 0x0001}, {0x0016, 0x0002}, {0x0016, 0x0003}, {0x0016, 0x0004}, {0x0016, 0x0005}, - {0x0016, 0x0006}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0005, 0x0005}, {0x0006, 0x0003}, {0x0008, 0x0003}, {0x000a, 0x0004}, {0x000d, 0x0006}, - {0x000f, 0x0008}, {0x0011, 0x000c}, {0x0013, 0x0020}, {0x0016, 0x0007}, {0x0015, 0x0063}, {0x0016, 0x0008}, {0x0016, 0x0009}, {0x0016, 0x000a}, - {0x0016, 0x000b}, {0x0016, 0x000c}, {0x0005, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0007}, {0x0006, 0x0004}, {0x0008, 0x0004}, {0x000b, 0x0005}, - {0x000d, 0x0007}, {0x0010, 0x000a}, {0x0012, 0x0015}, {0x0015, 0x0064}, {0x0016, 0x000d}, {0x0016, 0x000e}, {0x0016, 0x000f}, {0x0016, 0x0010}, - {0x0016, 0x0011}, {0x0016, 0x0012}, {0x0016, 0x0013}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0008, 0x0005}, {0x000a, 0x0005}, - {0x000c, 0x0005}, {0x000e, 0x0007}, {0x0010, 0x000b}, {0x0012, 0x0016}, {0x0014, 0x0037}, {0x0015, 0x0065}, {0x0016, 0x0014}, {0x0016, 0x0015}, - {0x0016, 0x0016}, {0x0016, 0x0017}, {0x0016, 0x0018}, {0x0016, 0x0019}, {0x0008, 0x0006}, {0x0007, 0x0005}, {0x0008, 0x0007}, {0x000a, 0x0006}, - {0x000c, 0x0006}, {0x000e, 0x0008}, {0x0010, 0x000c}, {0x0011, 0x000d}, {0x0013, 0x0021}, {0x0015, 0x0066}, {0x0016, 0x001a}, {0x0016, 0x001b}, - {0x0016, 0x001c}, {0x0016, 0x001d}, {0x0016, 0x001e}, {0x0016, 0x001f}, {0x0016, 0x0020}, {0x000b, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0007}, - {0x000c, 0x0007}, {0x000e, 0x0009}, {0x000f, 0x0009}, {0x0011, 0x000e}, {0x0013, 0x0022}, {0x0015, 0x0067}, {0x0015, 0x0068}, {0x0016, 0x0021}, - {0x0016, 0x0022}, {0x0016, 0x0023}, {0x0016, 0x0024}, {0x0016, 0x0025}, {0x0016, 0x0026}, {0x0016, 0x0027}, {0x000e, 0x000a}, {0x000d, 0x0008}, - {0x000d, 0x0009}, {0x000e, 0x000b}, {0x000f, 0x000a}, {0x0011, 0x000f}, {0x0013, 0x0023}, {0x0014, 0x0038}, {0x0016, 0x0028}, {0x0016, 0x0029}, - {0x0016, 0x002a}, {0x0016, 0x002b}, {0x0016, 0x002c}, {0x0016, 0x002d}, {0x0016, 0x002e}, {0x0016, 0x002f}, {0x0016, 0x0030}, {0x0010, 0x000d}, - {0x000f, 0x000b}, {0x0010, 0x000e}, {0x0010, 0x000f}, {0x0012, 0x0017}, {0x0013, 0x0024}, {0x0014, 0x0039}, {0x0016, 0x0031}, {0x0016, 0x0032}, - {0x0016, 0x0033}, {0x0016, 0x0034}, {0x0016, 0x0035}, {0x0016, 0x0036}, {0x0016, 0x0037}, {0x0016, 0x0038}, {0x0016, 0x0039}, {0x0016, 0x003a}, - {0x0013, 0x0025}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0016, 0x003b}, - {0x0016, 0x003c}, {0x0016, 0x003d}, {0x0016, 0x003e}, {0x0016, 0x003f}, {0x0016, 0x0040}, {0x0016, 0x0041}, {0x0016, 0x0042}, {0x0016, 0x0043}, - {0x0016, 0x0044}, {0x0015, 0x0069}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0015, 0x006a}, {0x0015, 0x006b}, {0x0015, 0x006c}, {0x0016, 0x0045}, - {0x0016, 0x0046}, {0x0016, 0x0047}, {0x0016, 0x0048}, {0x0016, 0x0049}, {0x0016, 0x004a}, {0x0016, 0x004b}, {0x0016, 0x004c}, {0x0016, 0x004d}, - {0x0016, 0x004e}, {0x0016, 0x004f}, {0x0016, 0x0050}, {0x0016, 0x0051}, {0x0015, 0x006d}, {0x0016, 0x0052}, {0x0016, 0x0053}, {0x0016, 0x0054}, - {0x0016, 0x0055}, {0x0016, 0x0056}, {0x0016, 0x0057}, {0x0016, 0x0058}, {0x0016, 0x0059}, {0x0016, 0x005a}, {0x0016, 0x005b}, {0x0016, 0x005c}, - {0x0016, 0x005d}, {0x0016, 0x005e}, {0x0016, 0x005f}, {0x0016, 0x0060}, {0x0016, 0x0061}, {0x0016, 0x0062}, {0x0016, 0x0063}, {0x0016, 0x0064}, - {0x0016, 0x0065}, {0x0016, 0x0066}, {0x0016, 0x0067}, {0x0016, 0x0068}, {0x0016, 0x0069}, {0x0016, 0x006a}, {0x0016, 0x006b}, {0x0016, 0x006c}, - {0x0016, 0x006d}, {0x0016, 0x006e}, {0x0016, 0x006f}, {0x0016, 0x0070}, {0x0016, 0x0071}, {0x0016, 0x0072}, {0x0016, 0x0073}, {0x0016, 0x0074}, - {0x0016, 0x0075}, {0x0016, 0x0076}, {0x0016, 0x0077}, {0x0016, 0x0078}, {0x0016, 0x0079}, {0x0016, 0x007a}, {0x0016, 0x007b}, {0x0016, 0x007c}, - {0x0016, 0x007d}, {0x0016, 0x007e}, {0x0016, 0x007f}, {0x0016, 0x0080}, {0x0016, 0x0081}, {0x0016, 0x0082}, {0x0016, 0x0083}, {0x0016, 0x0084}, - {0x0016, 0x0085}, {0x0016, 0x0086}, {0x0016, 0x0087}, {0x0016, 0x0088}, {0x0016, 0x0089}, {0x0016, 0x008a}, {0x0016, 0x008b}, {0x0016, 0x008c}, - {0x0016, 0x008d}, {0x0016, 0x008e}, {0x0016, 0x008f}, {0x0016, 0x0090}, {0x0016, 0x0091}, {0x0016, 0x0092}, {0x0016, 0x0093}, {0x0016, 0x0094}, - {0x0016, 0x0095}, {0x0016, 0x0096}, {0x0016, 0x0097}, {0x0016, 0x0098}, {0x0016, 0x0099}, {0x0016, 0x009a}, {0x0016, 0x009b}, {0x0016, 0x009c}, - {0x0016, 0x009d}, {0x0016, 0x009e}, {0x0016, 0x009f}, {0x0016, 0x00a0}, {0x0016, 0x00a1}, {0x0016, 0x00a2}, {0x0016, 0x00a3}, {0x0016, 0x00a4}, - {0x0016, 0x00a5}, {0x0016, 0x00a6}, {0x0016, 0x00a7}, {0x0016, 0x00a8}, {0x0016, 0x00a9}, {0x0016, 0x00aa}, {0x0016, 0x00ab}, {0x0016, 0x00ac}, - {0x0016, 0x00ad}, {0x0016, 0x00ae}, {0x0016, 0x00af}, {0x0016, 0x00b0}, {0x0016, 0x00b1}, {0x0016, 0x00b2}, {0x0016, 0x00b3}, {0x0016, 0x00b4}, - {0x0016, 0x00b5}, {0x0016, 0x00b6}, {0x0016, 0x00b7}, {0x0016, 0x00b8}, {0x0016, 0x00b9}, {0x0016, 0x00ba}, {0x0016, 0x00bb}, {0x0016, 0x00bc}, - {0x0016, 0x00bd}, {0x0016, 0x00be}, {0x0016, 0x00bf}, {0x0016, 0x00c0}, {0x0016, 0x00c1}, {0x0016, 0x00c2}, {0x0016, 0x00c3}, {0x0016, 0x00c4}, - {0x0016, 0x00c5}, + { + { 0x0001, 0x0001 }, + { 0x0004, 0x0004 }, + { 0x0005, 0x0004 }, + { 0x0007, 0x0004 }, + { 0x0008, 0x0002 }, + { 0x000b, 0x0004 }, + { 0x000e, 0x0006 }, + { 0x0010, 0x0009 }, + { 0x0012, 0x0014 }, + { 0x0013, 0x001f }, + { 0x0016, 0x0000 }, + { 0x0016, 0x0001 }, + { 0x0016, 0x0002 }, + { 0x0016, 0x0003 }, + { 0x0016, 0x0004 }, + { 0x0016, 0x0005 }, + { 0x0016, 0x0006 }, + { 0x0004, 0x0005 }, + { 0x0004, 0x0006 }, + { 0x0005, 0x0005 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000d, 0x0006 }, + { 0x000f, 0x0008 }, + { 0x0011, 0x000c }, + { 0x0013, 0x0020 }, + { 0x0016, 0x0007 }, + { 0x0015, 0x0063 }, + { 0x0016, 0x0008 }, + { 0x0016, 0x0009 }, + { 0x0016, 0x000a }, + { 0x0016, 0x000b }, + { 0x0016, 0x000c }, + { 0x0005, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0005, 0x0007 }, + { 0x0006, 0x0004 }, + { 0x0008, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000d, 0x0007 }, + { 0x0010, 0x000a }, + { 0x0012, 0x0015 }, + { 0x0015, 0x0064 }, + { 0x0016, 0x000d }, + { 0x0016, 0x000e }, + { 0x0016, 0x000f }, + { 0x0016, 0x0010 }, + { 0x0016, 0x0011 }, + { 0x0016, 0x0012 }, + { 0x0016, 0x0013 }, + { 0x0006, 0x0005 }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0008, 0x0005 }, + { 0x000a, 0x0005 }, + { 0x000c, 0x0005 }, + { 0x000e, 0x0007 }, + { 0x0010, 0x000b }, + { 0x0012, 0x0016 }, + { 0x0014, 0x0037 }, + { 0x0015, 0x0065 }, + { 0x0016, 0x0014 }, + { 0x0016, 0x0015 }, + { 0x0016, 0x0016 }, + { 0x0016, 0x0017 }, + { 0x0016, 0x0018 }, + { 0x0016, 0x0019 }, + { 0x0008, 0x0006 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0007 }, + { 0x000a, 0x0006 }, + { 0x000c, 0x0006 }, + { 0x000e, 0x0008 }, + { 0x0010, 0x000c }, + { 0x0011, 0x000d }, + { 0x0013, 0x0021 }, + { 0x0015, 0x0066 }, + { 0x0016, 0x001a }, + { 0x0016, 0x001b }, + { 0x0016, 0x001c }, + { 0x0016, 0x001d }, + { 0x0016, 0x001e }, + { 0x0016, 0x001f }, + { 0x0016, 0x0020 }, + { 0x000b, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0007 }, + { 0x000e, 0x0009 }, + { 0x000f, 0x0009 }, + { 0x0011, 0x000e }, + { 0x0013, 0x0022 }, + { 0x0015, 0x0067 }, + { 0x0015, 0x0068 }, + { 0x0016, 0x0021 }, + { 0x0016, 0x0022 }, + { 0x0016, 0x0023 }, + { 0x0016, 0x0024 }, + { 0x0016, 0x0025 }, + { 0x0016, 0x0026 }, + { 0x0016, 0x0027 }, + { 0x000e, 0x000a }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000e, 0x000b }, + { 0x000f, 0x000a }, + { 0x0011, 0x000f }, + { 0x0013, 0x0023 }, + { 0x0014, 0x0038 }, + { 0x0016, 0x0028 }, + { 0x0016, 0x0029 }, + { 0x0016, 0x002a }, + { 0x0016, 0x002b }, + { 0x0016, 0x002c }, + { 0x0016, 0x002d }, + { 0x0016, 0x002e }, + { 0x0016, 0x002f }, + { 0x0016, 0x0030 }, + { 0x0010, 0x000d }, + { 0x000f, 0x000b }, + { 0x0010, 0x000e }, + { 0x0010, 0x000f }, + { 0x0012, 0x0017 }, + { 0x0013, 0x0024 }, + { 0x0014, 0x0039 }, + { 0x0016, 0x0031 }, + { 0x0016, 0x0032 }, + { 0x0016, 0x0033 }, + { 0x0016, 0x0034 }, + { 0x0016, 0x0035 }, + { 0x0016, 0x0036 }, + { 0x0016, 0x0037 }, + { 0x0016, 0x0038 }, + { 0x0016, 0x0039 }, + { 0x0016, 0x003a }, + { 0x0013, 0x0025 }, + { 0x0011, 0x0010 }, + { 0x0011, 0x0011 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0014, 0x003a }, + { 0x0014, 0x003b }, + { 0x0016, 0x003b }, + { 0x0016, 0x003c }, + { 0x0016, 0x003d }, + { 0x0016, 0x003e }, + { 0x0016, 0x003f }, + { 0x0016, 0x0040 }, + { 0x0016, 0x0041 }, + { 0x0016, 0x0042 }, + { 0x0016, 0x0043 }, + { 0x0016, 0x0044 }, + { 0x0015, 0x0069 }, + { 0x0014, 0x003c }, + { 0x0014, 0x003d }, + { 0x0015, 0x006a }, + { 0x0015, 0x006b }, + { 0x0015, 0x006c }, + { 0x0016, 0x0045 }, + { 0x0016, 0x0046 }, + { 0x0016, 0x0047 }, + { 0x0016, 0x0048 }, + { 0x0016, 0x0049 }, + { 0x0016, 0x004a }, + { 0x0016, 0x004b }, + { 0x0016, 0x004c }, + { 0x0016, 0x004d }, + { 0x0016, 0x004e }, + { 0x0016, 0x004f }, + { 0x0016, 0x0050 }, + { 0x0016, 0x0051 }, + { 0x0015, 0x006d }, + { 0x0016, 0x0052 }, + { 0x0016, 0x0053 }, + { 0x0016, 0x0054 }, + { 0x0016, 0x0055 }, + { 0x0016, 0x0056 }, + { 0x0016, 0x0057 }, + { 0x0016, 0x0058 }, + { 0x0016, 0x0059 }, + { 0x0016, 0x005a }, + { 0x0016, 0x005b }, + { 0x0016, 0x005c }, + { 0x0016, 0x005d }, + { 0x0016, 0x005e }, + { 0x0016, 0x005f }, + { 0x0016, 0x0060 }, + { 0x0016, 0x0061 }, + { 0x0016, 0x0062 }, + { 0x0016, 0x0063 }, + { 0x0016, 0x0064 }, + { 0x0016, 0x0065 }, + { 0x0016, 0x0066 }, + { 0x0016, 0x0067 }, + { 0x0016, 0x0068 }, + { 0x0016, 0x0069 }, + { 0x0016, 0x006a }, + { 0x0016, 0x006b }, + { 0x0016, 0x006c }, + { 0x0016, 0x006d }, + { 0x0016, 0x006e }, + { 0x0016, 0x006f }, + { 0x0016, 0x0070 }, + { 0x0016, 0x0071 }, + { 0x0016, 0x0072 }, + { 0x0016, 0x0073 }, + { 0x0016, 0x0074 }, + { 0x0016, 0x0075 }, + { 0x0016, 0x0076 }, + { 0x0016, 0x0077 }, + { 0x0016, 0x0078 }, + { 0x0016, 0x0079 }, + { 0x0016, 0x007a }, + { 0x0016, 0x007b }, + { 0x0016, 0x007c }, + { 0x0016, 0x007d }, + { 0x0016, 0x007e }, + { 0x0016, 0x007f }, + { 0x0016, 0x0080 }, + { 0x0016, 0x0081 }, + { 0x0016, 0x0082 }, + { 0x0016, 0x0083 }, + { 0x0016, 0x0084 }, + { 0x0016, 0x0085 }, + { 0x0016, 0x0086 }, + { 0x0016, 0x0087 }, + { 0x0016, 0x0088 }, + { 0x0016, 0x0089 }, + { 0x0016, 0x008a }, + { 0x0016, 0x008b }, + { 0x0016, 0x008c }, + { 0x0016, 0x008d }, + { 0x0016, 0x008e }, + { 0x0016, 0x008f }, + { 0x0016, 0x0090 }, + { 0x0016, 0x0091 }, + { 0x0016, 0x0092 }, + { 0x0016, 0x0093 }, + { 0x0016, 0x0094 }, + { 0x0016, 0x0095 }, + { 0x0016, 0x0096 }, + { 0x0016, 0x0097 }, + { 0x0016, 0x0098 }, + { 0x0016, 0x0099 }, + { 0x0016, 0x009a }, + { 0x0016, 0x009b }, + { 0x0016, 0x009c }, + { 0x0016, 0x009d }, + { 0x0016, 0x009e }, + { 0x0016, 0x009f }, + { 0x0016, 0x00a0 }, + { 0x0016, 0x00a1 }, + { 0x0016, 0x00a2 }, + { 0x0016, 0x00a3 }, + { 0x0016, 0x00a4 }, + { 0x0016, 0x00a5 }, + { 0x0016, 0x00a6 }, + { 0x0016, 0x00a7 }, + { 0x0016, 0x00a8 }, + { 0x0016, 0x00a9 }, + { 0x0016, 0x00aa }, + { 0x0016, 0x00ab }, + { 0x0016, 0x00ac }, + { 0x0016, 0x00ad }, + { 0x0016, 0x00ae }, + { 0x0016, 0x00af }, + { 0x0016, 0x00b0 }, + { 0x0016, 0x00b1 }, + { 0x0016, 0x00b2 }, + { 0x0016, 0x00b3 }, + { 0x0016, 0x00b4 }, + { 0x0016, 0x00b5 }, + { 0x0016, 0x00b6 }, + { 0x0016, 0x00b7 }, + { 0x0016, 0x00b8 }, + { 0x0016, 0x00b9 }, + { 0x0016, 0x00ba }, + { 0x0016, 0x00bb }, + { 0x0016, 0x00bc }, + { 0x0016, 0x00bd }, + { 0x0016, 0x00be }, + { 0x0016, 0x00bf }, + { 0x0016, 0x00c0 }, + { 0x0016, 0x00c1 }, + { 0x0016, 0x00c2 }, + { 0x0016, 0x00c3 }, + { 0x0016, 0x00c4 }, + { 0x0016, 0x00c5 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec12[76][16] = -{ - {0x0003ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x00000001, 0x00000011, 0x00000012, 0x00000023, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x0006ffff, 0x0005ffff, 0x00000004, 0x00000015, 0x00000026, 0x00000036, 0x00000044, 0x00000046, 0x00010003, 0x00010003, 0x00010045, 0x00010045, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, - {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020035, 0x00020035, 0x00020035, 0x00020035, }, - {0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, - {0x000bffff, 0x0009ffff, 0x000affff, 0x0007ffff, 0x0008ffff, 0x00000038, 0x00000048, 0x00000058, 0x00010005, 0x00010005, 0x00010027, 0x00010027, 0x00010055, 0x00010055, 0x00010057, 0x00010057, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, - {0x00010018, 0x00010018, 0x0001005a, 0x0001005a, 0x0001006a, 0x0001006a, 0x00010078, 0x00010078, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020069, 0x00020069, 0x00020069, 0x00020069, }, - {0x0018ffff, 0x0029ffff, 0x003affff, 0x0010ffff, 0x0011ffff, 0x000fffff, 0x000cffff, 0x000dffff, 0x000effff, 0x00000007, 0x00000029, 0x0000003a, 0x0000004a, 0x00000077, 0x00000079, 0x0000007a, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, - {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, }, - {0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, }, - {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, }, - {0x004bffff, 0x0012ffff, 0x0015ffff, 0x0013ffff, 0x0014ffff, 0x0016ffff, 0x0017ffff, 0x0000003c, 0x0000006d, 0x0000007d, 0x0000008d, 0x0000008e, 0x0000009a, 0x0000009b, 0x00010009, 0x00010009, }, - {0x0001001a, 0x0001001a, 0x0001004c, 0x0001004c, 0x0001005c, 0x0001005c, 0x0001006c, 0x0001006c, 0x0001007c, 0x0001007c, 0x00010088, 0x00010088, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, }, - {0x0002011f, 0x0002011f, 0x0002011f, 0x0002011f, 0x00020120, 0x00020120, 0x00020120, 0x00020120, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, }, - {0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, 0x00030099, }, - {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, - {0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, }, - {0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, }, - {0x0025ffff, 0x001fffff, 0x0019ffff, 0x0020ffff, 0x001effff, 0x0021ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, }, - {0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, - {0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, - {0x00020054, 0x00020054, 0x00020054, 0x00020054, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, }, - {0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, }, - {0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, - {0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, }, - {0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, }, - {0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020075, 0x00020075, 0x00020075, 0x00020075, }, - {0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, - {0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x00020081, 0x00020081, 0x00020081, 0x00020081, 0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, }, - {0x00020085, 0x00020085, 0x00020085, 0x00020085, 0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, }, - {0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, 0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, }, - {0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, }, - {0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, 0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, }, - {0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x0002009f, 0x0002009f, 0x0002009f, 0x0002009f, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a0, 0x000200a1, 0x000200a1, 0x000200a1, 0x000200a1, }, - {0x000200a2, 0x000200a2, 0x000200a2, 0x000200a2, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, - {0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, }, - {0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, }, - {0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, }, - {0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, }, - {0x000200b7, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b9, 0x000200b9, 0x000200b9, 0x000200b9, 0x000200ba, 0x000200ba, 0x000200ba, 0x000200ba, }, - {0x000200bb, 0x000200bb, 0x000200bb, 0x000200bb, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bc, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200bd, 0x000200be, 0x000200be, 0x000200be, 0x000200be, }, - {0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, }, - {0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c5, 0x000200c5, 0x000200c5, 0x000200c5, 0x000200c6, 0x000200c6, 0x000200c6, 0x000200c6, }, - {0x000200c7, 0x000200c7, 0x000200c7, 0x000200c7, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200ca, 0x000200ca, 0x000200ca, 0x000200ca, }, - {0x000200cb, 0x000200cb, 0x000200cb, 0x000200cb, 0x000200cc, 0x000200cc, 0x000200cc, 0x000200cc, 0x000200cd, 0x000200cd, 0x000200cd, 0x000200cd, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200ce, }, - {0x000200cf, 0x000200cf, 0x000200cf, 0x000200cf, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d0, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200d1, 0x000200d2, 0x000200d2, 0x000200d2, 0x000200d2, }, - {0x000200d3, 0x000200d3, 0x000200d3, 0x000200d3, 0x000200d4, 0x000200d4, 0x000200d4, 0x000200d4, 0x000200d5, 0x000200d5, 0x000200d5, 0x000200d5, 0x000200d6, 0x000200d6, 0x000200d6, 0x000200d6, }, - {0x000200d7, 0x000200d7, 0x000200d7, 0x000200d7, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200d9, 0x000200d9, 0x000200d9, 0x000200d9, 0x000200da, 0x000200da, 0x000200da, 0x000200da, }, - {0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, }, - {0x000200db, 0x000200db, 0x000200db, 0x000200db, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200de, 0x000200de, 0x000200de, 0x000200de, }, - {0x000200df, 0x000200df, 0x000200df, 0x000200df, 0x000200e0, 0x000200e0, 0x000200e0, 0x000200e0, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x000200e2, 0x000200e2, 0x000200e2, 0x000200e2, }, - {0x000200e3, 0x000200e3, 0x000200e3, 0x000200e3, 0x000200e4, 0x000200e4, 0x000200e4, 0x000200e4, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200e6, 0x000200e6, 0x000200e6, 0x000200e6, }, - {0x000200e7, 0x000200e7, 0x000200e7, 0x000200e7, 0x000200e8, 0x000200e8, 0x000200e8, 0x000200e8, 0x000200e9, 0x000200e9, 0x000200e9, 0x000200e9, 0x000200ea, 0x000200ea, 0x000200ea, 0x000200ea, }, - {0x000200eb, 0x000200eb, 0x000200eb, 0x000200eb, 0x000200ec, 0x000200ec, 0x000200ec, 0x000200ec, 0x000200ed, 0x000200ed, 0x000200ed, 0x000200ed, 0x000200ee, 0x000200ee, 0x000200ee, 0x000200ee, }, - {0x000200ef, 0x000200ef, 0x000200ef, 0x000200ef, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f1, 0x000200f1, 0x000200f1, 0x000200f1, 0x000200f2, 0x000200f2, 0x000200f2, 0x000200f2, }, - {0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f5, 0x000200f5, 0x000200f5, 0x000200f5, 0x000200f6, 0x000200f6, 0x000200f6, 0x000200f6, }, - {0x000200f7, 0x000200f7, 0x000200f7, 0x000200f7, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f9, 0x000200f9, 0x000200f9, 0x000200f9, 0x000200fa, 0x000200fa, 0x000200fa, 0x000200fa, }, - {0x000200fb, 0x000200fb, 0x000200fb, 0x000200fb, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fe, 0x000200fe, 0x000200fe, 0x000200fe, }, - {0x000200ff, 0x000200ff, 0x000200ff, 0x000200ff, 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020101, 0x00020101, 0x00020101, 0x00020101, 0x00020102, 0x00020102, 0x00020102, 0x00020102, }, - {0x00020103, 0x00020103, 0x00020103, 0x00020103, 0x00020104, 0x00020104, 0x00020104, 0x00020104, 0x00020105, 0x00020105, 0x00020105, 0x00020105, 0x00020106, 0x00020106, 0x00020106, 0x00020106, }, - {0x00020107, 0x00020107, 0x00020107, 0x00020107, 0x00020108, 0x00020108, 0x00020108, 0x00020108, 0x00020109, 0x00020109, 0x00020109, 0x00020109, 0x0002010a, 0x0002010a, 0x0002010a, 0x0002010a, }, - {0x0002010b, 0x0002010b, 0x0002010b, 0x0002010b, 0x0002010c, 0x0002010c, 0x0002010c, 0x0002010c, 0x0002010d, 0x0002010d, 0x0002010d, 0x0002010d, 0x0002010e, 0x0002010e, 0x0002010e, 0x0002010e, }, - {0x0002010f, 0x0002010f, 0x0002010f, 0x0002010f, 0x00020110, 0x00020110, 0x00020110, 0x00020110, 0x00020111, 0x00020111, 0x00020111, 0x00020111, 0x00020112, 0x00020112, 0x00020112, 0x00020112, }, - {0x00020113, 0x00020113, 0x00020113, 0x00020113, 0x00020114, 0x00020114, 0x00020114, 0x00020114, 0x00020115, 0x00020115, 0x00020115, 0x00020115, 0x00020116, 0x00020116, 0x00020116, 0x00020116, }, - {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020118, 0x00020118, 0x00020118, 0x00020118, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x0002011a, 0x0002011a, 0x0002011a, 0x0002011a, }, - {0x0002011b, 0x0002011b, 0x0002011b, 0x0002011b, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011c, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011d, 0x0002011e, 0x0002011e, 0x0002011e, 0x0002011e, }, +const uint32_t c_aauiCQMFHuffDec12[76][16] = { + { + 0x0003ffff, + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000001, + 0x00000011, + 0x00000012, + 0x00000023, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + }, + { + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x00000004, + 0x00000015, + 0x00000026, + 0x00000036, + 0x00000044, + 0x00000046, + 0x00010003, + 0x00010003, + 0x00010045, + 0x00010045, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + }, + { + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020035, + }, + { + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + }, + { + 0x000bffff, + 0x0009ffff, + 0x000affff, + 0x0007ffff, + 0x0008ffff, + 0x00000038, + 0x00000048, + 0x00000058, + 0x00010005, + 0x00010005, + 0x00010027, + 0x00010027, + 0x00010055, + 0x00010055, + 0x00010057, + 0x00010057, + }, + { + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + }, + { + 0x00010018, + 0x00010018, + 0x0001005a, + 0x0001005a, + 0x0001006a, + 0x0001006a, + 0x00010078, + 0x00010078, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020069, + 0x00020069, + 0x00020069, + 0x00020069, + }, + { + 0x0018ffff, + 0x0029ffff, + 0x003affff, + 0x0010ffff, + 0x0011ffff, + 0x000fffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x00000007, + 0x00000029, + 0x0000003a, + 0x0000004a, + 0x00000077, + 0x00000079, + 0x0000007a, + }, + { + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + }, + { + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + }, + { + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + }, + { + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + }, + { + 0x004bffff, + 0x0012ffff, + 0x0015ffff, + 0x0013ffff, + 0x0014ffff, + 0x0016ffff, + 0x0017ffff, + 0x0000003c, + 0x0000006d, + 0x0000007d, + 0x0000008d, + 0x0000008e, + 0x0000009a, + 0x0000009b, + 0x00010009, + 0x00010009, + }, + { + 0x0001001a, + 0x0001001a, + 0x0001004c, + 0x0001004c, + 0x0001005c, + 0x0001005c, + 0x0001006c, + 0x0001006c, + 0x0001007c, + 0x0001007c, + 0x00010088, + 0x00010088, + 0x0001008b, + 0x0001008b, + 0x0001008c, + 0x0001008c, + }, + { + 0x0002011f, + 0x0002011f, + 0x0002011f, + 0x0002011f, + 0x00020120, + 0x00020120, + 0x00020120, + 0x00020120, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + }, + { + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x00030099, + 0x00030099, + 0x00030099, + 0x00030099, + 0x00030099, + 0x00030099, + 0x00030099, + 0x00030099, + }, + { + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + }, + { + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + }, + { + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + }, + { + 0x0025ffff, + 0x001fffff, + 0x0019ffff, + 0x0020ffff, + 0x001effff, + 0x0021ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + }, + { + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + }, + { + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020043, + 0x00020043, + 0x00020043, + 0x00020043, + 0x0002004e, + 0x0002004e, + 0x0002004e, + 0x0002004e, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x0002004f, + }, + { + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + }, + { + 0x00020054, + 0x00020054, + 0x00020054, + 0x00020054, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + }, + { + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + }, + { + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020032, + 0x00020032, + 0x00020032, + 0x00020032, + }, + { + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + }, + { + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + }, + { + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + }, + { + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020071, + }, + { + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + }, + { + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + }, + { + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + }, + { + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020084, + }, + { + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020087, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x0002008f, + }, + { + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020093, + }, + { + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + 0x0034ffff, + 0x0035ffff, + 0x0036ffff, + 0x0037ffff, + 0x0038ffff, + 0x0039ffff, + }, + { + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020095, + 0x00020095, + 0x00020095, + 0x00020095, + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020097, + 0x00020097, + 0x00020097, + 0x00020097, + }, + { + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020098, + 0x0002009f, + 0x0002009f, + 0x0002009f, + 0x0002009f, + 0x000200a0, + 0x000200a0, + 0x000200a0, + 0x000200a0, + 0x000200a1, + 0x000200a1, + 0x000200a1, + 0x000200a1, + }, + { + 0x000200a2, + 0x000200a2, + 0x000200a2, + 0x000200a2, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + }, + { + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a9, + 0x000200a9, + 0x000200a9, + 0x000200a9, + }, + { + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ad, + 0x000200ad, + 0x000200ad, + 0x000200ad, + 0x000200ae, + 0x000200ae, + 0x000200ae, + 0x000200ae, + }, + { + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200b1, + 0x000200b1, + 0x000200b1, + 0x000200b1, + 0x000200b2, + 0x000200b2, + 0x000200b2, + 0x000200b2, + }, + { + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b5, + 0x000200b5, + 0x000200b5, + 0x000200b5, + 0x000200b6, + 0x000200b6, + 0x000200b6, + 0x000200b6, + }, + { + 0x000200b7, + 0x000200b7, + 0x000200b7, + 0x000200b7, + 0x000200b8, + 0x000200b8, + 0x000200b8, + 0x000200b8, + 0x000200b9, + 0x000200b9, + 0x000200b9, + 0x000200b9, + 0x000200ba, + 0x000200ba, + 0x000200ba, + 0x000200ba, + }, + { + 0x000200bb, + 0x000200bb, + 0x000200bb, + 0x000200bb, + 0x000200bc, + 0x000200bc, + 0x000200bc, + 0x000200bc, + 0x000200bd, + 0x000200bd, + 0x000200bd, + 0x000200bd, + 0x000200be, + 0x000200be, + 0x000200be, + 0x000200be, + }, + { + 0x000200bf, + 0x000200bf, + 0x000200bf, + 0x000200bf, + 0x000200c0, + 0x000200c0, + 0x000200c0, + 0x000200c0, + 0x000200c1, + 0x000200c1, + 0x000200c1, + 0x000200c1, + 0x000200c2, + 0x000200c2, + 0x000200c2, + 0x000200c2, + }, + { + 0x000200c3, + 0x000200c3, + 0x000200c3, + 0x000200c3, + 0x000200c4, + 0x000200c4, + 0x000200c4, + 0x000200c4, + 0x000200c5, + 0x000200c5, + 0x000200c5, + 0x000200c5, + 0x000200c6, + 0x000200c6, + 0x000200c6, + 0x000200c6, + }, + { + 0x000200c7, + 0x000200c7, + 0x000200c7, + 0x000200c7, + 0x000200c8, + 0x000200c8, + 0x000200c8, + 0x000200c8, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200ca, + 0x000200ca, + 0x000200ca, + 0x000200ca, + }, + { + 0x000200cb, + 0x000200cb, + 0x000200cb, + 0x000200cb, + 0x000200cc, + 0x000200cc, + 0x000200cc, + 0x000200cc, + 0x000200cd, + 0x000200cd, + 0x000200cd, + 0x000200cd, + 0x000200ce, + 0x000200ce, + 0x000200ce, + 0x000200ce, + }, + { + 0x000200cf, + 0x000200cf, + 0x000200cf, + 0x000200cf, + 0x000200d0, + 0x000200d0, + 0x000200d0, + 0x000200d0, + 0x000200d1, + 0x000200d1, + 0x000200d1, + 0x000200d1, + 0x000200d2, + 0x000200d2, + 0x000200d2, + 0x000200d2, + }, + { + 0x000200d3, + 0x000200d3, + 0x000200d3, + 0x000200d3, + 0x000200d4, + 0x000200d4, + 0x000200d4, + 0x000200d4, + 0x000200d5, + 0x000200d5, + 0x000200d5, + 0x000200d5, + 0x000200d6, + 0x000200d6, + 0x000200d6, + 0x000200d6, + }, + { + 0x000200d7, + 0x000200d7, + 0x000200d7, + 0x000200d7, + 0x000200d8, + 0x000200d8, + 0x000200d8, + 0x000200d8, + 0x000200d9, + 0x000200d9, + 0x000200d9, + 0x000200d9, + 0x000200da, + 0x000200da, + 0x000200da, + 0x000200da, + }, + { + 0x003bffff, + 0x003cffff, + 0x003dffff, + 0x003effff, + 0x003fffff, + 0x0040ffff, + 0x0041ffff, + 0x0042ffff, + 0x0043ffff, + 0x0044ffff, + 0x0045ffff, + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x0049ffff, + 0x004affff, + }, + { + 0x000200db, + 0x000200db, + 0x000200db, + 0x000200db, + 0x000200dc, + 0x000200dc, + 0x000200dc, + 0x000200dc, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200de, + 0x000200de, + 0x000200de, + 0x000200de, + }, + { + 0x000200df, + 0x000200df, + 0x000200df, + 0x000200df, + 0x000200e0, + 0x000200e0, + 0x000200e0, + 0x000200e0, + 0x000200e1, + 0x000200e1, + 0x000200e1, + 0x000200e1, + 0x000200e2, + 0x000200e2, + 0x000200e2, + 0x000200e2, + }, + { + 0x000200e3, + 0x000200e3, + 0x000200e3, + 0x000200e3, + 0x000200e4, + 0x000200e4, + 0x000200e4, + 0x000200e4, + 0x000200e5, + 0x000200e5, + 0x000200e5, + 0x000200e5, + 0x000200e6, + 0x000200e6, + 0x000200e6, + 0x000200e6, + }, + { + 0x000200e7, + 0x000200e7, + 0x000200e7, + 0x000200e7, + 0x000200e8, + 0x000200e8, + 0x000200e8, + 0x000200e8, + 0x000200e9, + 0x000200e9, + 0x000200e9, + 0x000200e9, + 0x000200ea, + 0x000200ea, + 0x000200ea, + 0x000200ea, + }, + { + 0x000200eb, + 0x000200eb, + 0x000200eb, + 0x000200eb, + 0x000200ec, + 0x000200ec, + 0x000200ec, + 0x000200ec, + 0x000200ed, + 0x000200ed, + 0x000200ed, + 0x000200ed, + 0x000200ee, + 0x000200ee, + 0x000200ee, + 0x000200ee, + }, + { + 0x000200ef, + 0x000200ef, + 0x000200ef, + 0x000200ef, + 0x000200f0, + 0x000200f0, + 0x000200f0, + 0x000200f0, + 0x000200f1, + 0x000200f1, + 0x000200f1, + 0x000200f1, + 0x000200f2, + 0x000200f2, + 0x000200f2, + 0x000200f2, + }, + { + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f4, + 0x000200f4, + 0x000200f4, + 0x000200f4, + 0x000200f5, + 0x000200f5, + 0x000200f5, + 0x000200f5, + 0x000200f6, + 0x000200f6, + 0x000200f6, + 0x000200f6, + }, + { + 0x000200f7, + 0x000200f7, + 0x000200f7, + 0x000200f7, + 0x000200f8, + 0x000200f8, + 0x000200f8, + 0x000200f8, + 0x000200f9, + 0x000200f9, + 0x000200f9, + 0x000200f9, + 0x000200fa, + 0x000200fa, + 0x000200fa, + 0x000200fa, + }, + { + 0x000200fb, + 0x000200fb, + 0x000200fb, + 0x000200fb, + 0x000200fc, + 0x000200fc, + 0x000200fc, + 0x000200fc, + 0x000200fd, + 0x000200fd, + 0x000200fd, + 0x000200fd, + 0x000200fe, + 0x000200fe, + 0x000200fe, + 0x000200fe, + }, + { + 0x000200ff, + 0x000200ff, + 0x000200ff, + 0x000200ff, + 0x00020100, + 0x00020100, + 0x00020100, + 0x00020100, + 0x00020101, + 0x00020101, + 0x00020101, + 0x00020101, + 0x00020102, + 0x00020102, + 0x00020102, + 0x00020102, + }, + { + 0x00020103, + 0x00020103, + 0x00020103, + 0x00020103, + 0x00020104, + 0x00020104, + 0x00020104, + 0x00020104, + 0x00020105, + 0x00020105, + 0x00020105, + 0x00020105, + 0x00020106, + 0x00020106, + 0x00020106, + 0x00020106, + }, + { + 0x00020107, + 0x00020107, + 0x00020107, + 0x00020107, + 0x00020108, + 0x00020108, + 0x00020108, + 0x00020108, + 0x00020109, + 0x00020109, + 0x00020109, + 0x00020109, + 0x0002010a, + 0x0002010a, + 0x0002010a, + 0x0002010a, + }, + { + 0x0002010b, + 0x0002010b, + 0x0002010b, + 0x0002010b, + 0x0002010c, + 0x0002010c, + 0x0002010c, + 0x0002010c, + 0x0002010d, + 0x0002010d, + 0x0002010d, + 0x0002010d, + 0x0002010e, + 0x0002010e, + 0x0002010e, + 0x0002010e, + }, + { + 0x0002010f, + 0x0002010f, + 0x0002010f, + 0x0002010f, + 0x00020110, + 0x00020110, + 0x00020110, + 0x00020110, + 0x00020111, + 0x00020111, + 0x00020111, + 0x00020111, + 0x00020112, + 0x00020112, + 0x00020112, + 0x00020112, + }, + { + 0x00020113, + 0x00020113, + 0x00020113, + 0x00020113, + 0x00020114, + 0x00020114, + 0x00020114, + 0x00020114, + 0x00020115, + 0x00020115, + 0x00020115, + 0x00020115, + 0x00020116, + 0x00020116, + 0x00020116, + 0x00020116, + }, + { + 0x00020117, + 0x00020117, + 0x00020117, + 0x00020117, + 0x00020118, + 0x00020118, + 0x00020118, + 0x00020118, + 0x00020119, + 0x00020119, + 0x00020119, + 0x00020119, + 0x0002011a, + 0x0002011a, + 0x0002011a, + 0x0002011a, + }, + { + 0x0002011b, + 0x0002011b, + 0x0002011b, + 0x0002011b, + 0x0002011c, + 0x0002011c, + 0x0002011c, + 0x0002011c, + 0x0002011d, + 0x0002011d, + 0x0002011d, + 0x0002011d, + 0x0002011e, + 0x0002011e, + 0x0002011e, + 0x0002011e, + }, }; #endif @@ -822,143 +6893,1938 @@ const uint32_t c_aauiCQMFHuffEnc13[324][2] = #else const uint16_t c_aauiCQMFHuffEnc13[324][2] = #endif -{ - {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0006, 0x0004}, {0x0008, 0x0005}, {0x000a, 0x0005}, {0x000c, 0x0007}, - {0x000e, 0x000b}, {0x0010, 0x0011}, {0x0012, 0x002d}, {0x0015, 0x0000}, {0x0014, 0x0035}, {0x0015, 0x0001}, {0x0015, 0x0002}, {0x0015, 0x0003}, - {0x0015, 0x0004}, {0x0015, 0x0005}, {0x0004, 0x0008}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0006, 0x0005}, {0x0008, 0x0006}, - {0x0009, 0x0006}, {0x000c, 0x0008}, {0x000d, 0x0009}, {0x0010, 0x0012}, {0x0011, 0x001a}, {0x0015, 0x0006}, {0x0015, 0x0007}, {0x0015, 0x0008}, - {0x0015, 0x0009}, {0x0015, 0x000a}, {0x0015, 0x000b}, {0x0015, 0x000c}, {0x0005, 0x0007}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x0008}, - {0x0006, 0x0006}, {0x0008, 0x0007}, {0x000a, 0x0006}, {0x000c, 0x0009}, {0x000e, 0x000c}, {0x0010, 0x0013}, {0x0012, 0x002e}, {0x0015, 0x000d}, - {0x0015, 0x000e}, {0x0015, 0x000f}, {0x0015, 0x0010}, {0x0015, 0x0011}, {0x0015, 0x0012}, {0x0015, 0x0013}, {0x0005, 0x0009}, {0x0004, 0x000d}, - {0x0005, 0x000a}, {0x0006, 0x0007}, {0x0007, 0x0005}, {0x0009, 0x0007}, {0x000b, 0x0008}, {0x000d, 0x000a}, {0x000f, 0x000e}, {0x0010, 0x0014}, - {0x0011, 0x001b}, {0x0014, 0x0036}, {0x0015, 0x0014}, {0x0015, 0x0015}, {0x0015, 0x0016}, {0x0015, 0x0017}, {0x0015, 0x0018}, {0x0015, 0x0019}, - {0x0006, 0x0008}, {0x0005, 0x000b}, {0x0006, 0x0009}, {0x0007, 0x0006}, {0x0009, 0x0008}, {0x000a, 0x0007}, {0x000c, 0x000a}, {0x000e, 0x000d}, - {0x0010, 0x0015}, {0x0011, 0x001c}, {0x0013, 0x0053}, {0x0015, 0x001a}, {0x0015, 0x001b}, {0x0015, 0x001c}, {0x0015, 0x001d}, {0x0015, 0x001e}, - {0x0015, 0x001f}, {0x0015, 0x0020}, {0x0008, 0x0008}, {0x0007, 0x0007}, {0x0008, 0x0009}, {0x0009, 0x0009}, {0x000a, 0x0008}, {0x000c, 0x000b}, - {0x000d, 0x000b}, {0x000f, 0x000f}, {0x0010, 0x0016}, {0x0011, 0x001d}, {0x0014, 0x0037}, {0x0015, 0x0021}, {0x0015, 0x0022}, {0x0015, 0x0023}, - {0x0015, 0x0024}, {0x0015, 0x0025}, {0x0015, 0x0026}, {0x0015, 0x0027}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000b, 0x0009}, - {0x000c, 0x000c}, {0x000d, 0x000c}, {0x000f, 0x0010}, {0x0010, 0x0017}, {0x0012, 0x002f}, {0x0015, 0x0028}, {0x0015, 0x0029}, {0x0015, 0x002a}, - {0x0015, 0x002b}, {0x0015, 0x002c}, {0x0015, 0x002d}, {0x0015, 0x002e}, {0x0015, 0x002f}, {0x0015, 0x0030}, {0x000c, 0x000d}, {0x000c, 0x000e}, - {0x000c, 0x000f}, {0x000d, 0x000d}, {0x000e, 0x000e}, {0x000f, 0x0011}, {0x0010, 0x0018}, {0x0011, 0x001e}, {0x0014, 0x0038}, {0x0015, 0x0031}, - {0x0015, 0x0032}, {0x0015, 0x0033}, {0x0015, 0x0034}, {0x0015, 0x0035}, {0x0015, 0x0036}, {0x0015, 0x0037}, {0x0015, 0x0038}, {0x0015, 0x0039}, - {0x000f, 0x0012}, {0x000e, 0x000f}, {0x000e, 0x0010}, {0x000e, 0x0011}, {0x000f, 0x0013}, {0x0010, 0x0019}, {0x0011, 0x001f}, {0x0013, 0x0054}, - {0x0015, 0x003a}, {0x0014, 0x0039}, {0x0015, 0x003b}, {0x0015, 0x003c}, {0x0015, 0x003d}, {0x0015, 0x003e}, {0x0015, 0x003f}, {0x0015, 0x0040}, - {0x0015, 0x0041}, {0x0015, 0x0042}, {0x0010, 0x001a}, {0x000f, 0x0014}, {0x000f, 0x0015}, {0x0010, 0x001b}, {0x0011, 0x0020}, {0x0012, 0x0030}, - {0x0013, 0x0055}, {0x0015, 0x0043}, {0x0015, 0x0044}, {0x0014, 0x003a}, {0x0015, 0x0045}, {0x0015, 0x0046}, {0x0015, 0x0047}, {0x0015, 0x0048}, - {0x0015, 0x0049}, {0x0015, 0x004a}, {0x0015, 0x004b}, {0x0015, 0x004c}, {0x0012, 0x0031}, {0x0011, 0x0021}, {0x0013, 0x0056}, {0x0013, 0x0057}, - {0x0012, 0x0032}, {0x0015, 0x004d}, {0x0015, 0x004e}, {0x0015, 0x004f}, {0x0015, 0x0050}, {0x0015, 0x0051}, {0x0015, 0x0052}, {0x0015, 0x0053}, - {0x0015, 0x0054}, {0x0015, 0x0055}, {0x0015, 0x0056}, {0x0015, 0x0057}, {0x0015, 0x0058}, {0x0015, 0x0059}, {0x0015, 0x005a}, {0x0014, 0x003b}, - {0x0012, 0x0033}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0015, 0x005b}, {0x0015, 0x005c}, {0x0015, 0x005d}, {0x0015, 0x005e}, {0x0015, 0x005f}, - {0x0015, 0x0060}, {0x0015, 0x0061}, {0x0015, 0x0062}, {0x0015, 0x0063}, {0x0015, 0x0064}, {0x0015, 0x0065}, {0x0015, 0x0066}, {0x0015, 0x0067}, - {0x0015, 0x0068}, {0x0015, 0x0069}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, - {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, - {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, - {0x0014, 0x0052}, {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, - {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, - {0x0014, 0x0062}, {0x0014, 0x0063}, {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, - {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, - {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, - {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, - {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, - {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, - {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, - {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, - {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, + { + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0006, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x000a, 0x0005 }, + { 0x000c, 0x0007 }, + { 0x000e, 0x000b }, + { 0x0010, 0x0011 }, + { 0x0012, 0x002d }, + { 0x0015, 0x0000 }, + { 0x0014, 0x0035 }, + { 0x0015, 0x0001 }, + { 0x0015, 0x0002 }, + { 0x0015, 0x0003 }, + { 0x0015, 0x0004 }, + { 0x0015, 0x0005 }, + { 0x0004, 0x0008 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0009 }, + { 0x0004, 0x000a }, + { 0x0006, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0009, 0x0006 }, + { 0x000c, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x0010, 0x0012 }, + { 0x0011, 0x001a }, + { 0x0015, 0x0006 }, + { 0x0015, 0x0007 }, + { 0x0015, 0x0008 }, + { 0x0015, 0x0009 }, + { 0x0015, 0x000a }, + { 0x0015, 0x000b }, + { 0x0015, 0x000c }, + { 0x0005, 0x0007 }, + { 0x0004, 0x000b }, + { 0x0004, 0x000c }, + { 0x0005, 0x0008 }, + { 0x0006, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x000a, 0x0006 }, + { 0x000c, 0x0009 }, + { 0x000e, 0x000c }, + { 0x0010, 0x0013 }, + { 0x0012, 0x002e }, + { 0x0015, 0x000d }, + { 0x0015, 0x000e }, + { 0x0015, 0x000f }, + { 0x0015, 0x0010 }, + { 0x0015, 0x0011 }, + { 0x0015, 0x0012 }, + { 0x0015, 0x0013 }, + { 0x0005, 0x0009 }, + { 0x0004, 0x000d }, + { 0x0005, 0x000a }, + { 0x0006, 0x0007 }, + { 0x0007, 0x0005 }, + { 0x0009, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000d, 0x000a }, + { 0x000f, 0x000e }, + { 0x0010, 0x0014 }, + { 0x0011, 0x001b }, + { 0x0014, 0x0036 }, + { 0x0015, 0x0014 }, + { 0x0015, 0x0015 }, + { 0x0015, 0x0016 }, + { 0x0015, 0x0017 }, + { 0x0015, 0x0018 }, + { 0x0015, 0x0019 }, + { 0x0006, 0x0008 }, + { 0x0005, 0x000b }, + { 0x0006, 0x0009 }, + { 0x0007, 0x0006 }, + { 0x0009, 0x0008 }, + { 0x000a, 0x0007 }, + { 0x000c, 0x000a }, + { 0x000e, 0x000d }, + { 0x0010, 0x0015 }, + { 0x0011, 0x001c }, + { 0x0013, 0x0053 }, + { 0x0015, 0x001a }, + { 0x0015, 0x001b }, + { 0x0015, 0x001c }, + { 0x0015, 0x001d }, + { 0x0015, 0x001e }, + { 0x0015, 0x001f }, + { 0x0015, 0x0020 }, + { 0x0008, 0x0008 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0009 }, + { 0x0009, 0x0009 }, + { 0x000a, 0x0008 }, + { 0x000c, 0x000b }, + { 0x000d, 0x000b }, + { 0x000f, 0x000f }, + { 0x0010, 0x0016 }, + { 0x0011, 0x001d }, + { 0x0014, 0x0037 }, + { 0x0015, 0x0021 }, + { 0x0015, 0x0022 }, + { 0x0015, 0x0023 }, + { 0x0015, 0x0024 }, + { 0x0015, 0x0025 }, + { 0x0015, 0x0026 }, + { 0x0015, 0x0027 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000b, 0x0009 }, + { 0x000c, 0x000c }, + { 0x000d, 0x000c }, + { 0x000f, 0x0010 }, + { 0x0010, 0x0017 }, + { 0x0012, 0x002f }, + { 0x0015, 0x0028 }, + { 0x0015, 0x0029 }, + { 0x0015, 0x002a }, + { 0x0015, 0x002b }, + { 0x0015, 0x002c }, + { 0x0015, 0x002d }, + { 0x0015, 0x002e }, + { 0x0015, 0x002f }, + { 0x0015, 0x0030 }, + { 0x000c, 0x000d }, + { 0x000c, 0x000e }, + { 0x000c, 0x000f }, + { 0x000d, 0x000d }, + { 0x000e, 0x000e }, + { 0x000f, 0x0011 }, + { 0x0010, 0x0018 }, + { 0x0011, 0x001e }, + { 0x0014, 0x0038 }, + { 0x0015, 0x0031 }, + { 0x0015, 0x0032 }, + { 0x0015, 0x0033 }, + { 0x0015, 0x0034 }, + { 0x0015, 0x0035 }, + { 0x0015, 0x0036 }, + { 0x0015, 0x0037 }, + { 0x0015, 0x0038 }, + { 0x0015, 0x0039 }, + { 0x000f, 0x0012 }, + { 0x000e, 0x000f }, + { 0x000e, 0x0010 }, + { 0x000e, 0x0011 }, + { 0x000f, 0x0013 }, + { 0x0010, 0x0019 }, + { 0x0011, 0x001f }, + { 0x0013, 0x0054 }, + { 0x0015, 0x003a }, + { 0x0014, 0x0039 }, + { 0x0015, 0x003b }, + { 0x0015, 0x003c }, + { 0x0015, 0x003d }, + { 0x0015, 0x003e }, + { 0x0015, 0x003f }, + { 0x0015, 0x0040 }, + { 0x0015, 0x0041 }, + { 0x0015, 0x0042 }, + { 0x0010, 0x001a }, + { 0x000f, 0x0014 }, + { 0x000f, 0x0015 }, + { 0x0010, 0x001b }, + { 0x0011, 0x0020 }, + { 0x0012, 0x0030 }, + { 0x0013, 0x0055 }, + { 0x0015, 0x0043 }, + { 0x0015, 0x0044 }, + { 0x0014, 0x003a }, + { 0x0015, 0x0045 }, + { 0x0015, 0x0046 }, + { 0x0015, 0x0047 }, + { 0x0015, 0x0048 }, + { 0x0015, 0x0049 }, + { 0x0015, 0x004a }, + { 0x0015, 0x004b }, + { 0x0015, 0x004c }, + { 0x0012, 0x0031 }, + { 0x0011, 0x0021 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0012, 0x0032 }, + { 0x0015, 0x004d }, + { 0x0015, 0x004e }, + { 0x0015, 0x004f }, + { 0x0015, 0x0050 }, + { 0x0015, 0x0051 }, + { 0x0015, 0x0052 }, + { 0x0015, 0x0053 }, + { 0x0015, 0x0054 }, + { 0x0015, 0x0055 }, + { 0x0015, 0x0056 }, + { 0x0015, 0x0057 }, + { 0x0015, 0x0058 }, + { 0x0015, 0x0059 }, + { 0x0015, 0x005a }, + { 0x0014, 0x003b }, + { 0x0012, 0x0033 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0015, 0x005b }, + { 0x0015, 0x005c }, + { 0x0015, 0x005d }, + { 0x0015, 0x005e }, + { 0x0015, 0x005f }, + { 0x0015, 0x0060 }, + { 0x0015, 0x0061 }, + { 0x0015, 0x0062 }, + { 0x0015, 0x0063 }, + { 0x0015, 0x0064 }, + { 0x0015, 0x0065 }, + { 0x0015, 0x0066 }, + { 0x0015, 0x0067 }, + { 0x0015, 0x0068 }, + { 0x0015, 0x0069 }, + { 0x0014, 0x003c }, + { 0x0014, 0x003d }, + { 0x0014, 0x003e }, + { 0x0014, 0x003f }, + { 0x0014, 0x0040 }, + { 0x0014, 0x0041 }, + { 0x0014, 0x0042 }, + { 0x0014, 0x0043 }, + { 0x0014, 0x0044 }, + { 0x0014, 0x0045 }, + { 0x0014, 0x0046 }, + { 0x0014, 0x0047 }, + { 0x0014, 0x0048 }, + { 0x0014, 0x0049 }, + { 0x0014, 0x004a }, + { 0x0014, 0x004b }, + { 0x0014, 0x004c }, + { 0x0014, 0x004d }, + { 0x0014, 0x004e }, + { 0x0014, 0x004f }, + { 0x0014, 0x0050 }, + { 0x0014, 0x0051 }, + { 0x0014, 0x0052 }, + { 0x0014, 0x0053 }, + { 0x0014, 0x0054 }, + { 0x0014, 0x0055 }, + { 0x0014, 0x0056 }, + { 0x0014, 0x0057 }, + { 0x0014, 0x0058 }, + { 0x0014, 0x0059 }, + { 0x0014, 0x005a }, + { 0x0014, 0x005b }, + { 0x0014, 0x005c }, + { 0x0014, 0x005d }, + { 0x0014, 0x005e }, + { 0x0014, 0x005f }, + { 0x0014, 0x0060 }, + { 0x0014, 0x0061 }, + { 0x0014, 0x0062 }, + { 0x0014, 0x0063 }, + { 0x0014, 0x0064 }, + { 0x0014, 0x0065 }, + { 0x0014, 0x0066 }, + { 0x0014, 0x0067 }, + { 0x0014, 0x0068 }, + { 0x0014, 0x0069 }, + { 0x0014, 0x006a }, + { 0x0014, 0x006b }, + { 0x0014, 0x006c }, + { 0x0014, 0x006d }, + { 0x0014, 0x006e }, + { 0x0014, 0x006f }, + { 0x0014, 0x0070 }, + { 0x0014, 0x0071 }, + { 0x0014, 0x0072 }, + { 0x0014, 0x0073 }, + { 0x0014, 0x0074 }, + { 0x0014, 0x0075 }, + { 0x0014, 0x0076 }, + { 0x0014, 0x0077 }, + { 0x0014, 0x0078 }, + { 0x0014, 0x0079 }, + { 0x0014, 0x007a }, + { 0x0014, 0x007b }, + { 0x0014, 0x007c }, + { 0x0014, 0x007d }, + { 0x0014, 0x007e }, + { 0x0014, 0x007f }, + { 0x0014, 0x0080 }, + { 0x0014, 0x0081 }, + { 0x0014, 0x0082 }, + { 0x0014, 0x0083 }, + { 0x0014, 0x0084 }, + { 0x0014, 0x0085 }, + { 0x0014, 0x0086 }, + { 0x0014, 0x0087 }, + { 0x0014, 0x0088 }, + { 0x0014, 0x0089 }, + { 0x0014, 0x008a }, + { 0x0014, 0x008b }, + { 0x0014, 0x008c }, + { 0x0014, 0x008d }, + { 0x0014, 0x008e }, + { 0x0014, 0x008f }, + { 0x0014, 0x0090 }, + { 0x0014, 0x0091 }, + { 0x0014, 0x0092 }, + { 0x0014, 0x0093 }, + { 0x0014, 0x0094 }, + { 0x0014, 0x0095 }, + { 0x0014, 0x0096 }, + { 0x0014, 0x0097 }, + { 0x0014, 0x0098 }, + { 0x0014, 0x0099 }, + { 0x0014, 0x009a }, + { 0x0014, 0x009b }, + { 0x0014, 0x009c }, + { 0x0014, 0x009d }, + { 0x0014, 0x009e }, + { 0x0014, 0x009f }, + { 0x0014, 0x00a0 }, + { 0x0014, 0x00a1 }, + { 0x0014, 0x00a2 }, + { 0x0014, 0x00a3 }, + { 0x0014, 0x00a4 }, + { 0x0014, 0x00a5 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec13[89][16] = -{ - {0x0006ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000001, 0x00000012, 0x00000014, 0x00000015, 0x00000025, 0x00000026, 0x00000037, 0x00010013, 0x00010013, }, - {0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, - {0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x000bffff, 0x0009ffff, 0x000affff, 0x0007ffff, 0x0008ffff, 0x00000005, 0x00000017, 0x00000029, 0x0000005a, 0x0000005c, 0x0001003a, 0x0001003a, 0x0001004b, 0x0001004b, 0x0001005b, 0x0001005b, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, }, - {0x0001003c, 0x0001003c, 0x0001006f, 0x0001006f, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, }, - {0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, }, - {0x0012ffff, 0x0011ffff, 0x0010ffff, 0x000fffff, 0x000dffff, 0x000cffff, 0x000effff, 0x00000007, 0x00000019, 0x0000002b, 0x0000004e, 0x0000005f, 0x00000070, 0x0000007e, 0x0000007f, 0x00000080, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, - {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, - {0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, - {0x00010072, 0x00010072, 0x00010083, 0x00010083, 0x00010090, 0x00010090, 0x00010094, 0x00010094, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x00020008, 0x00020008, 0x00020008, 0x00020008, }, - {0x0016ffff, 0x00000009, 0x0000001b, 0x0000002d, 0x0000003f, 0x00000050, 0x00000062, 0x00000073, 0x00000084, 0x00000095, 0x000000a2, 0x000000a5, 0x0001003e, 0x0001003e, 0x00010061, 0x00010061, }, - {0x0021ffff, 0x0024ffff, 0x003dffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0019ffff, 0x0017ffff, 0x0018ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, }, - {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, }, - {0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030085, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, }, - {0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300a6, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, 0x000300b5, }, - {0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x00020074, 0x00020074, 0x00020074, 0x00020074, }, - {0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200b8, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, }, - {0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00010052, 0x00010052, 0x00010097, 0x00010097, 0x000100a8, 0x000100a8, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, }, - {0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0000000c, 0x00000041, 0x00000064, 0x00000086, 0x00000099, 0x000000ab, 0x000000c7, 0x000000da, 0x000000db, 0x000000dc, 0x000000dd, }, - {0x000000de, 0x000000df, 0x000000e0, 0x000000e1, 0x000000e2, 0x000000e3, 0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, }, - {0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000f3, 0x000000f4, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, 0x000000f9, 0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, }, - {0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, 0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, }, - {0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, 0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, }, - {0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000129, 0x0000012a, 0x0000012b, 0x0000012c, 0x0000012d, }, - {0x0000012e, 0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, }, - {0x0026ffff, 0x002dffff, 0x0037ffff, 0x0023ffff, 0x0044ffff, 0x002effff, 0x003affff, 0x0022ffff, 0x002cffff, 0x0035ffff, 0x002fffff, 0x0036ffff, 0x0040ffff, 0x0049ffff, 0x0030ffff, 0x0038ffff, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0041ffff, 0x004affff, 0x0042ffff, 0x0025ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0039ffff, 0x003bffff, 0x003cffff, }, - {0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, }, - {0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, - {0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, }, - {0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, }, - {0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, - {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, - {0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030088, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, }, - {0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, }, - {0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008c, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, }, - {0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, - {0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, 0x0003009c, }, - {0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009d, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, 0x0003009e, }, - {0x003effff, 0x003fffff, 0x0043ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, }, - {0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, }, - {0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, - {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, 0x00030065, }, - {0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, - {0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, 0x000300ac, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, 0x000300ae, }, - {0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, }, - {0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, }, - {0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b3, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, }, - {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, - {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, - {0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, 0x000300bb, }, - {0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bc, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, 0x000300bd, }, - {0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300be, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, 0x000300bf, }, - {0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c0, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, }, - {0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, }, - {0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, 0x000300c5, }, - {0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, 0x000300cb, }, - {0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, }, - {0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300ce, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, 0x000300cf, }, - {0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d0, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, 0x000300d1, }, - {0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d2, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, 0x000300d3, }, - {0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d4, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, 0x000300d5, }, - {0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d6, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, 0x000300d7, }, - {0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, }, +const uint32_t c_aauiCQMFHuffDec13[89][16] = { + { + 0x0006ffff, + 0x0005ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x00000000, + 0x00000001, + 0x00000012, + 0x00000014, + 0x00000015, + 0x00000025, + 0x00000026, + 0x00000037, + 0x00010013, + 0x00010013, + }, + { + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + }, + { + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + }, + { + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x000bffff, + 0x0009ffff, + 0x000affff, + 0x0007ffff, + 0x0008ffff, + 0x00000005, + 0x00000017, + 0x00000029, + 0x0000005a, + 0x0000005c, + 0x0001003a, + 0x0001003a, + 0x0001004b, + 0x0001004b, + 0x0001005b, + 0x0001005b, + }, + { + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + }, + { + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + }, + { + 0x0001003c, + 0x0001003c, + 0x0001006f, + 0x0001006f, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x0002004d, + }, + { + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + }, + { + 0x0012ffff, + 0x0011ffff, + 0x0010ffff, + 0x000fffff, + 0x000dffff, + 0x000cffff, + 0x000effff, + 0x00000007, + 0x00000019, + 0x0000002b, + 0x0000004e, + 0x0000005f, + 0x00000070, + 0x0000007e, + 0x0000007f, + 0x00000080, + }, + { + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + }, + { + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020093, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + }, + { + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + }, + { + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020091, + }, + { + 0x00010072, + 0x00010072, + 0x00010083, + 0x00010083, + 0x00010090, + 0x00010090, + 0x00010094, + 0x00010094, + 0x000100a3, + 0x000100a3, + 0x000100a4, + 0x000100a4, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + }, + { + 0x0016ffff, + 0x00000009, + 0x0000001b, + 0x0000002d, + 0x0000003f, + 0x00000050, + 0x00000062, + 0x00000073, + 0x00000084, + 0x00000095, + 0x000000a2, + 0x000000a5, + 0x0001003e, + 0x0001003e, + 0x00010061, + 0x00010061, + }, + { + 0x0021ffff, + 0x0024ffff, + 0x003dffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0019ffff, + 0x0017ffff, + 0x0018ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + }, + { + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + }, + { + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + }, + { + 0x00030085, + 0x00030085, + 0x00030085, + 0x00030085, + 0x00030085, + 0x00030085, + 0x00030085, + 0x00030085, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + }, + { + 0x000300a6, + 0x000300a6, + 0x000300a6, + 0x000300a6, + 0x000300a6, + 0x000300a6, + 0x000300a6, + 0x000300a6, + 0x000300b5, + 0x000300b5, + 0x000300b5, + 0x000300b5, + 0x000300b5, + 0x000300b5, + 0x000300b5, + 0x000300b5, + }, + { + 0x000100c9, + 0x000100c9, + 0x000100ca, + 0x000100ca, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + }, + { + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b8, + 0x000200b8, + 0x000200b8, + 0x000200b8, + 0x000200c8, + 0x000200c8, + 0x000200c8, + 0x000200c8, + }, + { + 0x0000013e, + 0x0000013f, + 0x00000140, + 0x00000141, + 0x00000142, + 0x00000143, + 0x00010052, + 0x00010052, + 0x00010097, + 0x00010097, + 0x000100a8, + 0x000100a8, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + }, + { + 0x0054ffff, + 0x0055ffff, + 0x0056ffff, + 0x0057ffff, + 0x0058ffff, + 0x0000000c, + 0x00000041, + 0x00000064, + 0x00000086, + 0x00000099, + 0x000000ab, + 0x000000c7, + 0x000000da, + 0x000000db, + 0x000000dc, + 0x000000dd, + }, + { + 0x000000de, + 0x000000df, + 0x000000e0, + 0x000000e1, + 0x000000e2, + 0x000000e3, + 0x000000e4, + 0x000000e5, + 0x000000e6, + 0x000000e7, + 0x000000e8, + 0x000000e9, + 0x000000ea, + 0x000000eb, + 0x000000ec, + 0x000000ed, + }, + { + 0x000000ee, + 0x000000ef, + 0x000000f0, + 0x000000f1, + 0x000000f2, + 0x000000f3, + 0x000000f4, + 0x000000f5, + 0x000000f6, + 0x000000f7, + 0x000000f8, + 0x000000f9, + 0x000000fa, + 0x000000fb, + 0x000000fc, + 0x000000fd, + }, + { + 0x000000fe, + 0x000000ff, + 0x00000100, + 0x00000101, + 0x00000102, + 0x00000103, + 0x00000104, + 0x00000105, + 0x00000106, + 0x00000107, + 0x00000108, + 0x00000109, + 0x0000010a, + 0x0000010b, + 0x0000010c, + 0x0000010d, + }, + { + 0x0000010e, + 0x0000010f, + 0x00000110, + 0x00000111, + 0x00000112, + 0x00000113, + 0x00000114, + 0x00000115, + 0x00000116, + 0x00000117, + 0x00000118, + 0x00000119, + 0x0000011a, + 0x0000011b, + 0x0000011c, + 0x0000011d, + }, + { + 0x0000011e, + 0x0000011f, + 0x00000120, + 0x00000121, + 0x00000122, + 0x00000123, + 0x00000124, + 0x00000125, + 0x00000126, + 0x00000127, + 0x00000128, + 0x00000129, + 0x0000012a, + 0x0000012b, + 0x0000012c, + 0x0000012d, + }, + { + 0x0000012e, + 0x0000012f, + 0x00000130, + 0x00000131, + 0x00000132, + 0x00000133, + 0x00000134, + 0x00000135, + 0x00000136, + 0x00000137, + 0x00000138, + 0x00000139, + 0x0000013a, + 0x0000013b, + 0x0000013c, + 0x0000013d, + }, + { + 0x0026ffff, + 0x002dffff, + 0x0037ffff, + 0x0023ffff, + 0x0044ffff, + 0x002effff, + 0x003affff, + 0x0022ffff, + 0x002cffff, + 0x0035ffff, + 0x002fffff, + 0x0036ffff, + 0x0040ffff, + 0x0049ffff, + 0x0030ffff, + 0x0038ffff, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x0041ffff, + 0x004affff, + 0x0042ffff, + 0x0025ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + 0x0034ffff, + 0x0039ffff, + 0x003bffff, + 0x003cffff, + }, + { + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + }, + { + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + }, + { + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + }, + { + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + }, + { + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + }, + { + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, + { + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + }, + { + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + }, + { + 0x00030088, + 0x00030088, + 0x00030088, + 0x00030088, + 0x00030088, + 0x00030088, + 0x00030088, + 0x00030088, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + }, + { + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + }, + { + 0x0003008c, + 0x0003008c, + 0x0003008c, + 0x0003008c, + 0x0003008c, + 0x0003008c, + 0x0003008c, + 0x0003008c, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + }, + { + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + }, + { + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + }, + { + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + }, + { + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + }, + { + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + 0x0003009c, + }, + { + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009d, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + 0x0003009e, + }, + { + 0x003effff, + 0x003fffff, + 0x0043ffff, + 0x0045ffff, + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x004bffff, + 0x004cffff, + 0x004dffff, + 0x004effff, + 0x004fffff, + 0x0050ffff, + 0x0051ffff, + 0x0052ffff, + 0x0053ffff, + }, + { + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + }, + { + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + }, + { + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + }, + { + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030065, + 0x00030065, + 0x00030065, + 0x00030065, + 0x00030065, + 0x00030065, + 0x00030065, + 0x00030065, + }, + { + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + }, + { + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + 0x000300ac, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + }, + { + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ae, + 0x000300ae, + 0x000300ae, + 0x000300ae, + 0x000300ae, + 0x000300ae, + 0x000300ae, + 0x000300ae, + }, + { + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + }, + { + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + }, + { + 0x000300b3, + 0x000300b3, + 0x000300b3, + 0x000300b3, + 0x000300b3, + 0x000300b3, + 0x000300b3, + 0x000300b3, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + }, + { + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + }, + { + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + }, + { + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300bb, + 0x000300bb, + 0x000300bb, + 0x000300bb, + 0x000300bb, + 0x000300bb, + 0x000300bb, + 0x000300bb, + }, + { + 0x000300bc, + 0x000300bc, + 0x000300bc, + 0x000300bc, + 0x000300bc, + 0x000300bc, + 0x000300bc, + 0x000300bc, + 0x000300bd, + 0x000300bd, + 0x000300bd, + 0x000300bd, + 0x000300bd, + 0x000300bd, + 0x000300bd, + 0x000300bd, + }, + { + 0x000300be, + 0x000300be, + 0x000300be, + 0x000300be, + 0x000300be, + 0x000300be, + 0x000300be, + 0x000300be, + 0x000300bf, + 0x000300bf, + 0x000300bf, + 0x000300bf, + 0x000300bf, + 0x000300bf, + 0x000300bf, + 0x000300bf, + }, + { + 0x000300c0, + 0x000300c0, + 0x000300c0, + 0x000300c0, + 0x000300c0, + 0x000300c0, + 0x000300c0, + 0x000300c0, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + }, + { + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + }, + { + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c5, + 0x000300c5, + 0x000300c5, + 0x000300c5, + 0x000300c5, + 0x000300c5, + 0x000300c5, + 0x000300c5, + }, + { + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300cb, + 0x000300cb, + 0x000300cb, + 0x000300cb, + 0x000300cb, + 0x000300cb, + 0x000300cb, + 0x000300cb, + }, + { + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + }, + { + 0x000300ce, + 0x000300ce, + 0x000300ce, + 0x000300ce, + 0x000300ce, + 0x000300ce, + 0x000300ce, + 0x000300ce, + 0x000300cf, + 0x000300cf, + 0x000300cf, + 0x000300cf, + 0x000300cf, + 0x000300cf, + 0x000300cf, + 0x000300cf, + }, + { + 0x000300d0, + 0x000300d0, + 0x000300d0, + 0x000300d0, + 0x000300d0, + 0x000300d0, + 0x000300d0, + 0x000300d0, + 0x000300d1, + 0x000300d1, + 0x000300d1, + 0x000300d1, + 0x000300d1, + 0x000300d1, + 0x000300d1, + 0x000300d1, + }, + { + 0x000300d2, + 0x000300d2, + 0x000300d2, + 0x000300d2, + 0x000300d2, + 0x000300d2, + 0x000300d2, + 0x000300d2, + 0x000300d3, + 0x000300d3, + 0x000300d3, + 0x000300d3, + 0x000300d3, + 0x000300d3, + 0x000300d3, + 0x000300d3, + }, + { + 0x000300d4, + 0x000300d4, + 0x000300d4, + 0x000300d4, + 0x000300d4, + 0x000300d4, + 0x000300d4, + 0x000300d4, + 0x000300d5, + 0x000300d5, + 0x000300d5, + 0x000300d5, + 0x000300d5, + 0x000300d5, + 0x000300d5, + 0x000300d5, + }, + { + 0x000300d6, + 0x000300d6, + 0x000300d6, + 0x000300d6, + 0x000300d6, + 0x000300d6, + 0x000300d6, + 0x000300d6, + 0x000300d7, + 0x000300d7, + 0x000300d7, + 0x000300d7, + 0x000300d7, + 0x000300d7, + 0x000300d7, + 0x000300d7, + }, + { + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + }, }; #endif @@ -967,115 +8833,1365 @@ const uint32_t c_aauiCQMFHuffEnc14[400][2] = #else const uint16_t c_aauiCQMFHuffEnc14[400][2] = #endif -{ - {0x0005, 0x0007}, {0x0004, 0x0009}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0006}, {0x0007, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x0008}, - {0x000d, 0x000c}, {0x000f, 0x0013}, {0x0010, 0x001b}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, - {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0005, 0x000a}, - {0x0005, 0x000b}, {0x0006, 0x0007}, {0x0008, 0x0006}, {0x000a, 0x0007}, {0x000c, 0x000a}, {0x000e, 0x000e}, {0x000f, 0x0014}, {0x0011, 0x002a}, - {0x0012, 0x004a}, {0x0013, 0x0084}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, - {0x0005, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x000d}, {0x0006, 0x0008}, {0x0007, 0x0007}, {0x0008, 0x0007}, {0x000a, 0x0008}, - {0x000c, 0x000b}, {0x000e, 0x000f}, {0x000f, 0x0015}, {0x0012, 0x004b}, {0x0013, 0x0085}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, - {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0005, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x000f}, {0x0005, 0x0010}, - {0x0006, 0x0009}, {0x0008, 0x0008}, {0x0009, 0x0008}, {0x000b, 0x0009}, {0x000d, 0x000d}, {0x000e, 0x0010}, {0x0010, 0x001c}, {0x0011, 0x002b}, - {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, - {0x0006, 0x000a}, {0x0005, 0x0011}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0007, 0x0008}, {0x0008, 0x0009}, {0x000a, 0x0009}, {0x000c, 0x000c}, - {0x000e, 0x0011}, {0x000f, 0x0016}, {0x0010, 0x001d}, {0x0012, 0x004c}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0014, 0x001f}, - {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0007, 0x0009}, {0x0006, 0x000d}, {0x0007, 0x000a}, {0x0007, 0x000b}, - {0x0009, 0x0009}, {0x000a, 0x000a}, {0x000b, 0x000a}, {0x000d, 0x000e}, {0x000f, 0x0017}, {0x0011, 0x002c}, {0x0010, 0x001e}, {0x0014, 0x0024}, - {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0014, 0x002b}, {0x0014, 0x002c}, - {0x0009, 0x000a}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0009, 0x000b}, {0x000a, 0x000b}, {0x000b, 0x000b}, {0x000d, 0x000f}, {0x000e, 0x0012}, - {0x000f, 0x0018}, {0x0011, 0x002d}, {0x0011, 0x002e}, {0x0013, 0x0086}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, - {0x0014, 0x0031}, {0x0014, 0x0032}, {0x0014, 0x0033}, {0x0014, 0x0034}, {0x000b, 0x000c}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000b, 0x000d}, - {0x000c, 0x000d}, {0x000d, 0x0010}, {0x000e, 0x0013}, {0x000f, 0x0019}, {0x0010, 0x001f}, {0x0013, 0x0087}, {0x0014, 0x0035}, {0x0014, 0x0036}, - {0x0013, 0x0088}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, - {0x000d, 0x0011}, {0x000c, 0x000e}, {0x000c, 0x000f}, {0x000d, 0x0012}, {0x000d, 0x0013}, {0x000e, 0x0014}, {0x0010, 0x0020}, {0x0010, 0x0021}, - {0x0012, 0x004d}, {0x0011, 0x002f}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, - {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, {0x000f, 0x001a}, {0x000e, 0x0015}, {0x000e, 0x0016}, {0x000e, 0x0017}, - {0x000f, 0x001b}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0014, 0x0048}, {0x0014, 0x0049}, - {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, - {0x0010, 0x0022}, {0x0010, 0x0023}, {0x0010, 0x0024}, {0x0010, 0x0025}, {0x0011, 0x0032}, {0x0011, 0x0033}, {0x0012, 0x004e}, {0x0012, 0x004f}, - {0x0014, 0x0052}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, - {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0011, 0x0034}, {0x0011, 0x0035}, {0x0012, 0x0050}, {0x0012, 0x0051}, - {0x0013, 0x008e}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, - {0x0014, 0x0063}, {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, - {0x0012, 0x0052}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0014, 0x006b}, {0x0013, 0x0091}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, - {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, - {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0013, 0x0092}, {0x0012, 0x0053}, - {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, - {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, - {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0013, 0x0093}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, - {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, - {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, - {0x0014, 0x00a4}, {0x0014, 0x00a5}, {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, - {0x0014, 0x00ac}, {0x0014, 0x00ad}, {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, - {0x0014, 0x00b4}, {0x0014, 0x00b5}, {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, - {0x0014, 0x00bc}, {0x0014, 0x00bd}, {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, - {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, - {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, - {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, - {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, - {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, - {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, - {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, - {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, -}; + { + { 0x0005, 0x0007 }, + { 0x0004, 0x0009 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0006, 0x0006 }, + { 0x0007, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000d, 0x000c }, + { 0x000f, 0x0013 }, + { 0x0010, 0x001b }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0014, 0x0006 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0004, 0x000c }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0006, 0x0007 }, + { 0x0008, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000c, 0x000a }, + { 0x000e, 0x000e }, + { 0x000f, 0x0014 }, + { 0x0011, 0x002a }, + { 0x0012, 0x004a }, + { 0x0013, 0x0084 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0014, 0x0009 }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0014, 0x000c }, + { 0x0005, 0x000c }, + { 0x0004, 0x000d }, + { 0x0004, 0x000e }, + { 0x0005, 0x000d }, + { 0x0006, 0x0008 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0007 }, + { 0x000a, 0x0008 }, + { 0x000c, 0x000b }, + { 0x000e, 0x000f }, + { 0x000f, 0x0015 }, + { 0x0012, 0x004b }, + { 0x0013, 0x0085 }, + { 0x0014, 0x000d }, + { 0x0014, 0x000e }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0014, 0x0013 }, + { 0x0005, 0x000e }, + { 0x0004, 0x000f }, + { 0x0005, 0x000f }, + { 0x0005, 0x0010 }, + { 0x0006, 0x0009 }, + { 0x0008, 0x0008 }, + { 0x0009, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000d, 0x000d }, + { 0x000e, 0x0010 }, + { 0x0010, 0x001c }, + { 0x0011, 0x002b }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, + { 0x0014, 0x001a }, + { 0x0014, 0x001b }, + { 0x0006, 0x000a }, + { 0x0005, 0x0011 }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0007, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x000a, 0x0009 }, + { 0x000c, 0x000c }, + { 0x000e, 0x0011 }, + { 0x000f, 0x0016 }, + { 0x0010, 0x001d }, + { 0x0012, 0x004c }, + { 0x0014, 0x001c }, + { 0x0014, 0x001d }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0014, 0x0020 }, + { 0x0014, 0x0021 }, + { 0x0014, 0x0022 }, + { 0x0014, 0x0023 }, + { 0x0007, 0x0009 }, + { 0x0006, 0x000d }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0009, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000b, 0x000a }, + { 0x000d, 0x000e }, + { 0x000f, 0x0017 }, + { 0x0011, 0x002c }, + { 0x0010, 0x001e }, + { 0x0014, 0x0024 }, + { 0x0014, 0x0025 }, + { 0x0014, 0x0026 }, + { 0x0014, 0x0027 }, + { 0x0014, 0x0028 }, + { 0x0014, 0x0029 }, + { 0x0014, 0x002a }, + { 0x0014, 0x002b }, + { 0x0014, 0x002c }, + { 0x0009, 0x000a }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0009, 0x000b }, + { 0x000a, 0x000b }, + { 0x000b, 0x000b }, + { 0x000d, 0x000f }, + { 0x000e, 0x0012 }, + { 0x000f, 0x0018 }, + { 0x0011, 0x002d }, + { 0x0011, 0x002e }, + { 0x0013, 0x0086 }, + { 0x0014, 0x002d }, + { 0x0014, 0x002e }, + { 0x0014, 0x002f }, + { 0x0014, 0x0030 }, + { 0x0014, 0x0031 }, + { 0x0014, 0x0032 }, + { 0x0014, 0x0033 }, + { 0x0014, 0x0034 }, + { 0x000b, 0x000c }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000b, 0x000d }, + { 0x000c, 0x000d }, + { 0x000d, 0x0010 }, + { 0x000e, 0x0013 }, + { 0x000f, 0x0019 }, + { 0x0010, 0x001f }, + { 0x0013, 0x0087 }, + { 0x0014, 0x0035 }, + { 0x0014, 0x0036 }, + { 0x0013, 0x0088 }, + { 0x0014, 0x0037 }, + { 0x0014, 0x0038 }, + { 0x0014, 0x0039 }, + { 0x0014, 0x003a }, + { 0x0014, 0x003b }, + { 0x0014, 0x003c }, + { 0x0014, 0x003d }, + { 0x000d, 0x0011 }, + { 0x000c, 0x000e }, + { 0x000c, 0x000f }, + { 0x000d, 0x0012 }, + { 0x000d, 0x0013 }, + { 0x000e, 0x0014 }, + { 0x0010, 0x0020 }, + { 0x0010, 0x0021 }, + { 0x0012, 0x004d }, + { 0x0011, 0x002f }, + { 0x0014, 0x003e }, + { 0x0014, 0x003f }, + { 0x0014, 0x0040 }, + { 0x0014, 0x0041 }, + { 0x0014, 0x0042 }, + { 0x0014, 0x0043 }, + { 0x0014, 0x0044 }, + { 0x0014, 0x0045 }, + { 0x0014, 0x0046 }, + { 0x0014, 0x0047 }, + { 0x000f, 0x001a }, + { 0x000e, 0x0015 }, + { 0x000e, 0x0016 }, + { 0x000e, 0x0017 }, + { 0x000f, 0x001b }, + { 0x0011, 0x0030 }, + { 0x0011, 0x0031 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x0013, 0x008b }, + { 0x0014, 0x0048 }, + { 0x0014, 0x0049 }, + { 0x0014, 0x004a }, + { 0x0014, 0x004b }, + { 0x0014, 0x004c }, + { 0x0014, 0x004d }, + { 0x0014, 0x004e }, + { 0x0014, 0x004f }, + { 0x0014, 0x0050 }, + { 0x0014, 0x0051 }, + { 0x0010, 0x0022 }, + { 0x0010, 0x0023 }, + { 0x0010, 0x0024 }, + { 0x0010, 0x0025 }, + { 0x0011, 0x0032 }, + { 0x0011, 0x0033 }, + { 0x0012, 0x004e }, + { 0x0012, 0x004f }, + { 0x0014, 0x0052 }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0014, 0x0053 }, + { 0x0014, 0x0054 }, + { 0x0014, 0x0055 }, + { 0x0014, 0x0056 }, + { 0x0014, 0x0057 }, + { 0x0014, 0x0058 }, + { 0x0014, 0x0059 }, + { 0x0014, 0x005a }, + { 0x0014, 0x005b }, + { 0x0011, 0x0034 }, + { 0x0011, 0x0035 }, + { 0x0012, 0x0050 }, + { 0x0012, 0x0051 }, + { 0x0013, 0x008e }, + { 0x0014, 0x005c }, + { 0x0014, 0x005d }, + { 0x0014, 0x005e }, + { 0x0014, 0x005f }, + { 0x0014, 0x0060 }, + { 0x0014, 0x0061 }, + { 0x0014, 0x0062 }, + { 0x0014, 0x0063 }, + { 0x0014, 0x0064 }, + { 0x0014, 0x0065 }, + { 0x0014, 0x0066 }, + { 0x0014, 0x0067 }, + { 0x0014, 0x0068 }, + { 0x0014, 0x0069 }, + { 0x0014, 0x006a }, + { 0x0012, 0x0052 }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0014, 0x006b }, + { 0x0013, 0x0091 }, + { 0x0014, 0x006c }, + { 0x0014, 0x006d }, + { 0x0014, 0x006e }, + { 0x0014, 0x006f }, + { 0x0014, 0x0070 }, + { 0x0014, 0x0071 }, + { 0x0014, 0x0072 }, + { 0x0014, 0x0073 }, + { 0x0014, 0x0074 }, + { 0x0014, 0x0075 }, + { 0x0014, 0x0076 }, + { 0x0014, 0x0077 }, + { 0x0014, 0x0078 }, + { 0x0014, 0x0079 }, + { 0x0014, 0x007a }, + { 0x0014, 0x007b }, + { 0x0014, 0x007c }, + { 0x0013, 0x0092 }, + { 0x0012, 0x0053 }, + { 0x0014, 0x007d }, + { 0x0014, 0x007e }, + { 0x0014, 0x007f }, + { 0x0014, 0x0080 }, + { 0x0014, 0x0081 }, + { 0x0014, 0x0082 }, + { 0x0014, 0x0083 }, + { 0x0014, 0x0084 }, + { 0x0014, 0x0085 }, + { 0x0014, 0x0086 }, + { 0x0014, 0x0087 }, + { 0x0014, 0x0088 }, + { 0x0014, 0x0089 }, + { 0x0014, 0x008a }, + { 0x0014, 0x008b }, + { 0x0014, 0x008c }, + { 0x0014, 0x008d }, + { 0x0014, 0x008e }, + { 0x0013, 0x0093 }, + { 0x0014, 0x008f }, + { 0x0014, 0x0090 }, + { 0x0014, 0x0091 }, + { 0x0014, 0x0092 }, + { 0x0014, 0x0093 }, + { 0x0014, 0x0094 }, + { 0x0014, 0x0095 }, + { 0x0014, 0x0096 }, + { 0x0014, 0x0097 }, + { 0x0014, 0x0098 }, + { 0x0014, 0x0099 }, + { 0x0014, 0x009a }, + { 0x0014, 0x009b }, + { 0x0014, 0x009c }, + { 0x0014, 0x009d }, + { 0x0014, 0x009e }, + { 0x0014, 0x009f }, + { 0x0014, 0x00a0 }, + { 0x0014, 0x00a1 }, + { 0x0014, 0x00a2 }, + { 0x0014, 0x00a3 }, + { 0x0014, 0x00a4 }, + { 0x0014, 0x00a5 }, + { 0x0014, 0x00a6 }, + { 0x0014, 0x00a7 }, + { 0x0014, 0x00a8 }, + { 0x0014, 0x00a9 }, + { 0x0014, 0x00aa }, + { 0x0014, 0x00ab }, + { 0x0014, 0x00ac }, + { 0x0014, 0x00ad }, + { 0x0014, 0x00ae }, + { 0x0014, 0x00af }, + { 0x0014, 0x00b0 }, + { 0x0014, 0x00b1 }, + { 0x0014, 0x00b2 }, + { 0x0014, 0x00b3 }, + { 0x0014, 0x00b4 }, + { 0x0014, 0x00b5 }, + { 0x0014, 0x00b6 }, + { 0x0014, 0x00b7 }, + { 0x0014, 0x00b8 }, + { 0x0014, 0x00b9 }, + { 0x0014, 0x00ba }, + { 0x0014, 0x00bb }, + { 0x0014, 0x00bc }, + { 0x0014, 0x00bd }, + { 0x0014, 0x00be }, + { 0x0014, 0x00bf }, + { 0x0014, 0x00c0 }, + { 0x0014, 0x00c1 }, + { 0x0014, 0x00c2 }, + { 0x0014, 0x00c3 }, + { 0x0014, 0x00c4 }, + { 0x0014, 0x00c5 }, + { 0x0014, 0x00c6 }, + { 0x0014, 0x00c7 }, + { 0x0014, 0x00c8 }, + { 0x0014, 0x00c9 }, + { 0x0014, 0x00ca }, + { 0x0014, 0x00cb }, + { 0x0014, 0x00cc }, + { 0x0014, 0x00cd }, + { 0x0014, 0x00ce }, + { 0x0014, 0x00cf }, + { 0x0014, 0x00d0 }, + { 0x0014, 0x00d1 }, + { 0x0014, 0x00d2 }, + { 0x0014, 0x00d3 }, + { 0x0014, 0x00d4 }, + { 0x0014, 0x00d5 }, + { 0x0014, 0x00d6 }, + { 0x0014, 0x00d7 }, + { 0x0014, 0x00d8 }, + { 0x0014, 0x00d9 }, + { 0x0014, 0x00da }, + { 0x0014, 0x00db }, + { 0x0014, 0x00dc }, + { 0x0014, 0x00dd }, + { 0x0014, 0x00de }, + { 0x0014, 0x00df }, + { 0x0014, 0x00e0 }, + { 0x0014, 0x00e1 }, + { 0x0014, 0x00e2 }, + { 0x0014, 0x00e3 }, + { 0x0014, 0x00e4 }, + { 0x0014, 0x00e5 }, + { 0x0014, 0x00e6 }, + { 0x0014, 0x00e7 }, + { 0x0014, 0x00e8 }, + { 0x0014, 0x00e9 }, + { 0x0014, 0x00ea }, + { 0x0014, 0x00eb }, + { 0x0014, 0x00ec }, + { 0x0014, 0x00ed }, + { 0x0014, 0x00ee }, + { 0x0014, 0x00ef }, + { 0x0014, 0x00f0 }, + { 0x0014, 0x00f1 }, + { 0x0014, 0x00f2 }, + { 0x0014, 0x00f3 }, + { 0x0014, 0x00f4 }, + { 0x0014, 0x00f5 }, + { 0x0014, 0x00f6 }, + { 0x0014, 0x00f7 }, + { 0x0014, 0x00f8 }, + { 0x0014, 0x00f9 }, + { 0x0014, 0x00fa }, + { 0x0014, 0x00fb }, + { 0x0014, 0x00fc }, + { 0x0014, 0x00fd }, + { 0x0014, 0x00fe }, + { 0x0014, 0x00ff }, + { 0x0014, 0x0100 }, + { 0x0014, 0x0101 }, + { 0x0014, 0x0102 }, + { 0x0014, 0x0103 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec14[53][16] = -{ - {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x00000001, 0x00000014, 0x00000015, 0x00000016, 0x00000029, 0x0000002a, 0x0000003d, }, - {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, - {0x00010054, 0x00010054, 0x00010064, 0x00010064, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, - {0x000fffff, 0x000dffff, 0x000effff, 0x000affff, 0x000bffff, 0x000cffff, 0x0000001a, 0x0000002e, 0x00000041, 0x00000055, 0x00000079, 0x0000007a, 0x00010005, 0x00010005, 0x0001002d, 0x0001002d, }, - {0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, - {0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, - {0x00010007, 0x00010007, 0x00010043, 0x00010043, 0x0001006a, 0x0001006a, 0x0001007d, 0x0001007d, 0x0001008c, 0x0001008c, 0x0001008f, 0x0001008f, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, }, - {0x0024ffff, 0x0018ffff, 0x0017ffff, 0x0015ffff, 0x0014ffff, 0x0016ffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000001c, 0x00000030, 0x00000057, 0x00000090, 0x000000a1, 0x000000a2, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, - {0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003006b, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, }, - {0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, }, - {0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, }, - {0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020092, 0x00020092, 0x00020092, 0x00020092, }, - {0x00010080, 0x00010080, 0x00010093, 0x00010093, 0x000100b4, 0x000100b4, 0x000100b8, 0x000100b8, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x00020031, 0x00020031, 0x00020031, 0x00020031, }, - {0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b5, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b6, 0x000200b7, 0x000200b7, 0x000200b7, 0x000200b7, }, - {0x000000a6, 0x000000a7, 0x000000c8, 0x000000c9, 0x000000ca, 0x000000cb, 0x00010009, 0x00010009, 0x0001001e, 0x0001001e, 0x00010032, 0x00010032, 0x00010059, 0x00010059, 0x0001006c, 0x0001006c, }, - {0x0022ffff, 0x0023ffff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x0000000a, 0x00000046, 0x0000005a, 0x0000006e, 0x00000094, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, 0x00030081, }, - {0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x00030082, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, - {0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300b9, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, 0x000300ba, }, - {0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cc, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, 0x000300cd, }, - {0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, }, - {0x000100f2, 0x000100f2, 0x000100f4, 0x000100f4, 0x00010106, 0x00010106, 0x0001011a, 0x0001011a, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, - {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200ce, 0x000200cf, 0x000200cf, 0x000200cf, 0x000200cf, }, - {0x000200de, 0x000200de, 0x000200de, 0x000200de, 0x000200df, 0x000200df, 0x000200df, 0x000200df, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f0, 0x00020107, 0x00020107, 0x00020107, 0x00020107, }, - {0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x00010021, 0x00010021, 0x00010034, 0x00010034, 0x00010083, 0x00010083, 0x00010095, 0x00010095, }, - {0x00010098, 0x00010098, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100e0, 0x000100e0, 0x000100f1, 0x000100f1, }, - {0x0025ffff, 0x0026ffff, 0x0028ffff, 0x0027ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, }, - {0x0000000d, 0x0000000e, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000035, 0x00000036, 0x00000037, }, - {0x00000038, 0x00000039, 0x0000003a, 0x0000003b, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, }, - {0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x00000096, 0x00000097, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000aa, 0x000000ab, }, - {0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000084, 0x00000085, 0x00000086, }, - {0x000000ac, 0x000000ad, 0x000000ae, 0x000000af, 0x000000b0, 0x000000b1, 0x000000b2, 0x000000b3, 0x000000be, 0x000000bf, 0x000000c0, 0x000000c1, 0x000000c2, 0x000000c3, 0x000000c4, 0x000000c5, }, - {0x000000c6, 0x000000c7, 0x000000d0, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000d8, 0x000000d9, 0x000000da, 0x000000db, 0x000000e1, 0x000000e2, 0x000000e3, 0x000000e4, }, - {0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f3, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, }, - {0x000000f9, 0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000108, 0x00000109, 0x0000010a, }, - {0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, 0x0000011b, }, - {0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000129, 0x0000012a, 0x0000012b, }, - {0x0000012c, 0x0000012d, 0x0000012e, 0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, }, - {0x0000013c, 0x0000013d, 0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00000144, 0x00000145, 0x00000146, 0x00000147, 0x00000148, 0x00000149, 0x0000014a, 0x0000014b, }, - {0x0000014c, 0x0000014d, 0x0000014e, 0x0000014f, 0x00000150, 0x00000151, 0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, }, - {0x0000015c, 0x0000015d, 0x0000015e, 0x0000015f, 0x00000160, 0x00000161, 0x00000162, 0x00000163, 0x00000164, 0x00000165, 0x00000166, 0x00000167, 0x00000168, 0x00000169, 0x0000016a, 0x0000016b, }, - {0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, 0x0000017a, 0x0000017b, }, - {0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, }, +const uint32_t c_aauiCQMFHuffDec14[53][16] = { + { + 0x0009ffff, + 0x0007ffff, + 0x0008ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x00000001, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000029, + 0x0000002a, + 0x0000003d, + }, + { + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + }, + { + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, + { + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, + { + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + }, + { + 0x00010054, + 0x00010054, + 0x00010064, + 0x00010064, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + }, + { + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + }, + { + 0x000fffff, + 0x000dffff, + 0x000effff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x0000001a, + 0x0000002e, + 0x00000041, + 0x00000055, + 0x00000079, + 0x0000007a, + 0x00010005, + 0x00010005, + 0x0001002d, + 0x0001002d, + }, + { + 0x0002008d, + 0x0002008d, + 0x0002008d, + 0x0002008d, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + }, + { + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + }, + { + 0x00010007, + 0x00010007, + 0x00010043, + 0x00010043, + 0x0001006a, + 0x0001006a, + 0x0001007d, + 0x0001007d, + 0x0001008c, + 0x0001008c, + 0x0001008f, + 0x0001008f, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + }, + { + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020069, + 0x00020069, + 0x00020069, + 0x00020069, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + }, + { + 0x0024ffff, + 0x0018ffff, + 0x0017ffff, + 0x0015ffff, + 0x0014ffff, + 0x0016ffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0000001c, + 0x00000030, + 0x00000057, + 0x00000090, + 0x000000a1, + 0x000000a2, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + }, + { + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003006b, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + }, + { + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + }, + { + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + }, + { + 0x00020045, + 0x00020045, + 0x00020045, + 0x00020045, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020058, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + }, + { + 0x00010080, + 0x00010080, + 0x00010093, + 0x00010093, + 0x000100b4, + 0x000100b4, + 0x000100b8, + 0x000100b8, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + }, + { + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200b5, + 0x000200b5, + 0x000200b5, + 0x000200b5, + 0x000200b6, + 0x000200b6, + 0x000200b6, + 0x000200b6, + 0x000200b7, + 0x000200b7, + 0x000200b7, + 0x000200b7, + }, + { + 0x000000a6, + 0x000000a7, + 0x000000c8, + 0x000000c9, + 0x000000ca, + 0x000000cb, + 0x00010009, + 0x00010009, + 0x0001001e, + 0x0001001e, + 0x00010032, + 0x00010032, + 0x00010059, + 0x00010059, + 0x0001006c, + 0x0001006c, + }, + { + 0x0022ffff, + 0x0023ffff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001effff, + 0x0000000a, + 0x00000046, + 0x0000005a, + 0x0000006e, + 0x00000094, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + }, + { + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + 0x00030081, + }, + { + 0x00030082, + 0x00030082, + 0x00030082, + 0x00030082, + 0x00030082, + 0x00030082, + 0x00030082, + 0x00030082, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + }, + { + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300b9, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + 0x000300ba, + }, + { + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cc, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + 0x000300cd, + }, + { + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + }, + { + 0x000100f2, + 0x000100f2, + 0x000100f4, + 0x000100f4, + 0x00010106, + 0x00010106, + 0x0001011a, + 0x0001011a, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + }, + { + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200ce, + 0x000200ce, + 0x000200ce, + 0x000200ce, + 0x000200cf, + 0x000200cf, + 0x000200cf, + 0x000200cf, + }, + { + 0x000200de, + 0x000200de, + 0x000200de, + 0x000200de, + 0x000200df, + 0x000200df, + 0x000200df, + 0x000200df, + 0x000200f0, + 0x000200f0, + 0x000200f0, + 0x000200f0, + 0x00020107, + 0x00020107, + 0x00020107, + 0x00020107, + }, + { + 0x0000018c, + 0x0000018d, + 0x0000018e, + 0x0000018f, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x00010021, + 0x00010021, + 0x00010034, + 0x00010034, + 0x00010083, + 0x00010083, + 0x00010095, + 0x00010095, + }, + { + 0x00010098, + 0x00010098, + 0x000100bb, + 0x000100bb, + 0x000100bc, + 0x000100bc, + 0x000100bd, + 0x000100bd, + 0x000100d1, + 0x000100d1, + 0x000100d2, + 0x000100d2, + 0x000100e0, + 0x000100e0, + 0x000100f1, + 0x000100f1, + }, + { + 0x0025ffff, + 0x0026ffff, + 0x0028ffff, + 0x0027ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + 0x0034ffff, + }, + { + 0x0000000d, + 0x0000000e, + 0x0000000f, + 0x00000010, + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000022, + 0x00000023, + 0x00000024, + 0x00000025, + 0x00000026, + 0x00000027, + 0x00000035, + 0x00000036, + 0x00000037, + }, + { + 0x00000038, + 0x00000039, + 0x0000003a, + 0x0000003b, + 0x00000048, + 0x00000049, + 0x0000004a, + 0x0000004b, + 0x0000004c, + 0x0000004d, + 0x0000004e, + 0x0000004f, + 0x0000005c, + 0x0000005d, + 0x0000005e, + 0x0000005f, + }, + { + 0x00000087, + 0x00000088, + 0x00000089, + 0x0000008a, + 0x0000008b, + 0x00000096, + 0x00000097, + 0x00000099, + 0x0000009a, + 0x0000009b, + 0x0000009c, + 0x0000009d, + 0x0000009e, + 0x0000009f, + 0x000000aa, + 0x000000ab, + }, + { + 0x00000060, + 0x00000061, + 0x00000062, + 0x00000063, + 0x0000006f, + 0x00000070, + 0x00000071, + 0x00000072, + 0x00000073, + 0x00000074, + 0x00000075, + 0x00000076, + 0x00000077, + 0x00000084, + 0x00000085, + 0x00000086, + }, + { + 0x000000ac, + 0x000000ad, + 0x000000ae, + 0x000000af, + 0x000000b0, + 0x000000b1, + 0x000000b2, + 0x000000b3, + 0x000000be, + 0x000000bf, + 0x000000c0, + 0x000000c1, + 0x000000c2, + 0x000000c3, + 0x000000c4, + 0x000000c5, + }, + { + 0x000000c6, + 0x000000c7, + 0x000000d0, + 0x000000d3, + 0x000000d4, + 0x000000d5, + 0x000000d6, + 0x000000d7, + 0x000000d8, + 0x000000d9, + 0x000000da, + 0x000000db, + 0x000000e1, + 0x000000e2, + 0x000000e3, + 0x000000e4, + }, + { + 0x000000e5, + 0x000000e6, + 0x000000e7, + 0x000000e8, + 0x000000e9, + 0x000000ea, + 0x000000eb, + 0x000000ec, + 0x000000ed, + 0x000000ee, + 0x000000ef, + 0x000000f3, + 0x000000f5, + 0x000000f6, + 0x000000f7, + 0x000000f8, + }, + { + 0x000000f9, + 0x000000fa, + 0x000000fb, + 0x000000fc, + 0x000000fd, + 0x000000fe, + 0x000000ff, + 0x00000100, + 0x00000101, + 0x00000102, + 0x00000103, + 0x00000104, + 0x00000105, + 0x00000108, + 0x00000109, + 0x0000010a, + }, + { + 0x0000010b, + 0x0000010c, + 0x0000010d, + 0x0000010e, + 0x0000010f, + 0x00000110, + 0x00000111, + 0x00000112, + 0x00000113, + 0x00000114, + 0x00000115, + 0x00000116, + 0x00000117, + 0x00000118, + 0x00000119, + 0x0000011b, + }, + { + 0x0000011c, + 0x0000011d, + 0x0000011e, + 0x0000011f, + 0x00000120, + 0x00000121, + 0x00000122, + 0x00000123, + 0x00000124, + 0x00000125, + 0x00000126, + 0x00000127, + 0x00000128, + 0x00000129, + 0x0000012a, + 0x0000012b, + }, + { + 0x0000012c, + 0x0000012d, + 0x0000012e, + 0x0000012f, + 0x00000130, + 0x00000131, + 0x00000132, + 0x00000133, + 0x00000134, + 0x00000135, + 0x00000136, + 0x00000137, + 0x00000138, + 0x00000139, + 0x0000013a, + 0x0000013b, + }, + { + 0x0000013c, + 0x0000013d, + 0x0000013e, + 0x0000013f, + 0x00000140, + 0x00000141, + 0x00000142, + 0x00000143, + 0x00000144, + 0x00000145, + 0x00000146, + 0x00000147, + 0x00000148, + 0x00000149, + 0x0000014a, + 0x0000014b, + }, + { + 0x0000014c, + 0x0000014d, + 0x0000014e, + 0x0000014f, + 0x00000150, + 0x00000151, + 0x00000152, + 0x00000153, + 0x00000154, + 0x00000155, + 0x00000156, + 0x00000157, + 0x00000158, + 0x00000159, + 0x0000015a, + 0x0000015b, + }, + { + 0x0000015c, + 0x0000015d, + 0x0000015e, + 0x0000015f, + 0x00000160, + 0x00000161, + 0x00000162, + 0x00000163, + 0x00000164, + 0x00000165, + 0x00000166, + 0x00000167, + 0x00000168, + 0x00000169, + 0x0000016a, + 0x0000016b, + }, + { + 0x0000016c, + 0x0000016d, + 0x0000016e, + 0x0000016f, + 0x00000170, + 0x00000171, + 0x00000172, + 0x00000173, + 0x00000174, + 0x00000175, + 0x00000176, + 0x00000177, + 0x00000178, + 0x00000179, + 0x0000017a, + 0x0000017b, + }, + { + 0x0000017c, + 0x0000017d, + 0x0000017e, + 0x0000017f, + 0x00000180, + 0x00000181, + 0x00000182, + 0x00000183, + 0x00000184, + 0x00000185, + 0x00000186, + 0x00000187, + 0x00000188, + 0x00000189, + 0x0000018a, + 0x0000018b, + }, }; #endif @@ -1084,157 +10200,1901 @@ const uint32_t c_aauiCQMFHuffEnc15[576][2] = #else const uint16_t c_aauiCQMFHuffEnc15[576][2] = #endif -{ - {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0007, 0x0008}, {0x0008, 0x0009}, {0x0009, 0x0008}, - {0x000b, 0x000b}, {0x000d, 0x000e}, {0x000e, 0x0011}, {0x000f, 0x001a}, {0x0012, 0x006e}, {0x0014, 0x0000}, {0x0013, 0x00cc}, {0x0014, 0x0001}, - {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, - {0x0005, 0x000d}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0006, 0x000b}, {0x0007, 0x0009}, {0x0008, 0x000a}, - {0x000a, 0x000a}, {0x000c, 0x000c}, {0x000d, 0x000f}, {0x000f, 0x001b}, {0x0011, 0x003d}, {0x0011, 0x003e}, {0x0013, 0x00cd}, {0x0014, 0x000a}, - {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, - {0x0005, 0x0010}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0006, 0x000c}, {0x0007, 0x000a}, {0x0009, 0x0009}, - {0x000a, 0x000b}, {0x000c, 0x000d}, {0x000e, 0x0012}, {0x0010, 0x0027}, {0x0011, 0x003f}, {0x0012, 0x006f}, {0x0014, 0x0013}, {0x0014, 0x0014}, - {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, - {0x0006, 0x000d}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0006, 0x000e}, {0x0007, 0x000b}, {0x0008, 0x000b}, {0x0009, 0x000a}, - {0x000b, 0x000c}, {0x000c, 0x000e}, {0x000e, 0x0013}, {0x000f, 0x001c}, {0x0011, 0x0040}, {0x0012, 0x0070}, {0x0014, 0x001d}, {0x0014, 0x001e}, - {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0014, 0x0026}, - {0x0006, 0x000f}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0007, 0x000c}, {0x0009, 0x000b}, {0x000a, 0x000c}, - {0x000b, 0x000d}, {0x000d, 0x0010}, {0x000e, 0x0014}, {0x0010, 0x0028}, {0x0011, 0x0041}, {0x0013, 0x00ce}, {0x0014, 0x0027}, {0x0014, 0x0028}, - {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, - {0x0007, 0x000d}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x000c}, {0x0009, 0x000c}, {0x000b, 0x000e}, - {0x000c, 0x000f}, {0x000e, 0x0015}, {0x0010, 0x0029}, {0x0011, 0x0042}, {0x0014, 0x0031}, {0x0014, 0x0032}, {0x0014, 0x0033}, {0x0014, 0x0034}, - {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, - {0x0008, 0x000d}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000e}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x000b, 0x000f}, {0x000c, 0x0010}, - {0x000d, 0x0011}, {0x000f, 0x001d}, {0x0010, 0x002a}, {0x0011, 0x0043}, {0x0014, 0x003d}, {0x0013, 0x00cf}, {0x0014, 0x003e}, {0x0014, 0x003f}, - {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0014, 0x0047}, - {0x0009, 0x000f}, {0x0008, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x000a, 0x000d}, {0x000b, 0x0010}, {0x000c, 0x0011}, {0x000d, 0x0012}, - {0x000e, 0x0016}, {0x0010, 0x002b}, {0x0011, 0x0044}, {0x0012, 0x0071}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, {0x0014, 0x004b}, - {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, {0x0014, 0x0053}, - {0x000b, 0x0011}, {0x000a, 0x000e}, {0x000a, 0x000f}, {0x000b, 0x0012}, {0x000b, 0x0013}, {0x000c, 0x0012}, {0x000d, 0x0013}, {0x000e, 0x0017}, - {0x0010, 0x002c}, {0x0012, 0x0072}, {0x0011, 0x0045}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, - {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, - {0x000c, 0x0013}, {0x000c, 0x0014}, {0x000c, 0x0015}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x000e, 0x0018}, {0x000f, 0x001e}, {0x0010, 0x002d}, - {0x0011, 0x0046}, {0x0011, 0x0047}, {0x0011, 0x0048}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, {0x0014, 0x0063}, - {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, - {0x000e, 0x0019}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000e, 0x001a}, {0x000e, 0x001b}, {0x000f, 0x001f}, {0x0010, 0x002e}, {0x0011, 0x0049}, - {0x0012, 0x0073}, {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, - {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, - {0x0010, 0x002f}, {0x000f, 0x0020}, {0x0010, 0x0030}, {0x000f, 0x0021}, {0x0010, 0x0031}, {0x0011, 0x004a}, {0x0011, 0x004b}, {0x0012, 0x0074}, - {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0013, 0x00d2}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, - {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, - {0x0012, 0x0075}, {0x0010, 0x0032}, {0x0010, 0x0033}, {0x0011, 0x004c}, {0x0011, 0x004d}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0012, 0x0076}, - {0x0013, 0x00d5}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, - {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, - {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0012, 0x0077}, {0x0012, 0x0078}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0013, 0x00d8}, {0x0014, 0x009b}, - {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, - {0x0014, 0x00a4}, {0x0014, 0x00a5}, {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, - {0x0014, 0x00ac}, {0x0014, 0x00ad}, {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0012, 0x0079}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, - {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, - {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, - {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, - {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, - {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, - {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, - {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, - {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, - {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, - {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, - {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, {0x0014, 0x0106}, {0x0014, 0x0107}, {0x0014, 0x0108}, - {0x0014, 0x0109}, {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, {0x0014, 0x010e}, {0x0014, 0x010f}, {0x0014, 0x0110}, - {0x0014, 0x0111}, {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, {0x0014, 0x0116}, {0x0014, 0x0117}, {0x0014, 0x0118}, - {0x0014, 0x0119}, {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, {0x0014, 0x011e}, {0x0014, 0x011f}, {0x0014, 0x0120}, - {0x0014, 0x0121}, {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, - {0x0014, 0x0129}, {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, - {0x0014, 0x0131}, {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, {0x0014, 0x0136}, {0x0014, 0x0137}, {0x0014, 0x0138}, - {0x0014, 0x0139}, {0x0014, 0x013a}, {0x0014, 0x013b}, {0x0014, 0x013c}, {0x0014, 0x013d}, {0x0014, 0x013e}, {0x0014, 0x013f}, {0x0014, 0x0140}, - {0x0014, 0x0141}, {0x0014, 0x0142}, {0x0014, 0x0143}, {0x0014, 0x0144}, {0x0014, 0x0145}, {0x0014, 0x0146}, {0x0014, 0x0147}, {0x0014, 0x0148}, - {0x0014, 0x0149}, {0x0014, 0x014a}, {0x0014, 0x014b}, {0x0014, 0x014c}, {0x0014, 0x014d}, {0x0014, 0x014e}, {0x0014, 0x014f}, {0x0014, 0x0150}, - {0x0014, 0x0151}, {0x0014, 0x0152}, {0x0014, 0x0153}, {0x0014, 0x0154}, {0x0014, 0x0155}, {0x0014, 0x0156}, {0x0014, 0x0157}, {0x0014, 0x0158}, - {0x0014, 0x0159}, {0x0014, 0x015a}, {0x0014, 0x015b}, {0x0014, 0x015c}, {0x0014, 0x015d}, {0x0014, 0x015e}, {0x0014, 0x015f}, {0x0014, 0x0160}, - {0x0014, 0x0161}, {0x0014, 0x0162}, {0x0014, 0x0163}, {0x0014, 0x0164}, {0x0014, 0x0165}, {0x0014, 0x0166}, {0x0014, 0x0167}, {0x0014, 0x0168}, - {0x0014, 0x0169}, {0x0014, 0x016a}, {0x0014, 0x016b}, {0x0014, 0x016c}, {0x0014, 0x016d}, {0x0014, 0x016e}, {0x0014, 0x016f}, {0x0014, 0x0170}, - {0x0014, 0x0171}, {0x0014, 0x0172}, {0x0014, 0x0173}, {0x0014, 0x0174}, {0x0014, 0x0175}, {0x0014, 0x0176}, {0x0014, 0x0177}, {0x0014, 0x0178}, - {0x0014, 0x0179}, {0x0014, 0x017a}, {0x0014, 0x017b}, {0x0014, 0x017c}, {0x0014, 0x017d}, {0x0014, 0x017e}, {0x0014, 0x017f}, {0x0014, 0x0180}, - {0x0014, 0x0181}, {0x0014, 0x0182}, {0x0014, 0x0183}, {0x0014, 0x0184}, {0x0014, 0x0185}, {0x0014, 0x0186}, {0x0014, 0x0187}, {0x0014, 0x0188}, - {0x0014, 0x0189}, {0x0014, 0x018a}, {0x0014, 0x018b}, {0x0014, 0x018c}, {0x0014, 0x018d}, {0x0014, 0x018e}, {0x0014, 0x018f}, {0x0014, 0x0190}, - {0x0014, 0x0191}, {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0013, 0x00db}, -}; + { + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0007, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0009, 0x0008 }, + { 0x000b, 0x000b }, + { 0x000d, 0x000e }, + { 0x000e, 0x0011 }, + { 0x000f, 0x001a }, + { 0x0012, 0x006e }, + { 0x0014, 0x0000 }, + { 0x0013, 0x00cc }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0014, 0x0006 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0014, 0x0009 }, + { 0x0005, 0x000d }, + { 0x0004, 0x000c }, + { 0x0004, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0006, 0x000b }, + { 0x0007, 0x0009 }, + { 0x0008, 0x000a }, + { 0x000a, 0x000a }, + { 0x000c, 0x000c }, + { 0x000d, 0x000f }, + { 0x000f, 0x001b }, + { 0x0011, 0x003d }, + { 0x0011, 0x003e }, + { 0x0013, 0x00cd }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0014, 0x000c }, + { 0x0014, 0x000d }, + { 0x0014, 0x000e }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0005, 0x0010 }, + { 0x0004, 0x000e }, + { 0x0004, 0x000f }, + { 0x0005, 0x0011 }, + { 0x0005, 0x0012 }, + { 0x0006, 0x000c }, + { 0x0007, 0x000a }, + { 0x0009, 0x0009 }, + { 0x000a, 0x000b }, + { 0x000c, 0x000d }, + { 0x000e, 0x0012 }, + { 0x0010, 0x0027 }, + { 0x0011, 0x003f }, + { 0x0012, 0x006f }, + { 0x0014, 0x0013 }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, + { 0x0014, 0x001a }, + { 0x0014, 0x001b }, + { 0x0014, 0x001c }, + { 0x0006, 0x000d }, + { 0x0005, 0x0013 }, + { 0x0005, 0x0014 }, + { 0x0005, 0x0015 }, + { 0x0006, 0x000e }, + { 0x0007, 0x000b }, + { 0x0008, 0x000b }, + { 0x0009, 0x000a }, + { 0x000b, 0x000c }, + { 0x000c, 0x000e }, + { 0x000e, 0x0013 }, + { 0x000f, 0x001c }, + { 0x0011, 0x0040 }, + { 0x0012, 0x0070 }, + { 0x0014, 0x001d }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0014, 0x0020 }, + { 0x0014, 0x0021 }, + { 0x0014, 0x0022 }, + { 0x0014, 0x0023 }, + { 0x0014, 0x0024 }, + { 0x0014, 0x0025 }, + { 0x0014, 0x0026 }, + { 0x0006, 0x000f }, + { 0x0005, 0x0016 }, + { 0x0005, 0x0017 }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0007, 0x000c }, + { 0x0009, 0x000b }, + { 0x000a, 0x000c }, + { 0x000b, 0x000d }, + { 0x000d, 0x0010 }, + { 0x000e, 0x0014 }, + { 0x0010, 0x0028 }, + { 0x0011, 0x0041 }, + { 0x0013, 0x00ce }, + { 0x0014, 0x0027 }, + { 0x0014, 0x0028 }, + { 0x0014, 0x0029 }, + { 0x0014, 0x002a }, + { 0x0014, 0x002b }, + { 0x0014, 0x002c }, + { 0x0014, 0x002d }, + { 0x0014, 0x002e }, + { 0x0014, 0x002f }, + { 0x0014, 0x0030 }, + { 0x0007, 0x000d }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0008, 0x000c }, + { 0x0009, 0x000c }, + { 0x000b, 0x000e }, + { 0x000c, 0x000f }, + { 0x000e, 0x0015 }, + { 0x0010, 0x0029 }, + { 0x0011, 0x0042 }, + { 0x0014, 0x0031 }, + { 0x0014, 0x0032 }, + { 0x0014, 0x0033 }, + { 0x0014, 0x0034 }, + { 0x0014, 0x0035 }, + { 0x0014, 0x0036 }, + { 0x0014, 0x0037 }, + { 0x0014, 0x0038 }, + { 0x0014, 0x0039 }, + { 0x0014, 0x003a }, + { 0x0014, 0x003b }, + { 0x0014, 0x003c }, + { 0x0008, 0x000d }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0008, 0x000e }, + { 0x0009, 0x000d }, + { 0x0009, 0x000e }, + { 0x000b, 0x000f }, + { 0x000c, 0x0010 }, + { 0x000d, 0x0011 }, + { 0x000f, 0x001d }, + { 0x0010, 0x002a }, + { 0x0011, 0x0043 }, + { 0x0014, 0x003d }, + { 0x0013, 0x00cf }, + { 0x0014, 0x003e }, + { 0x0014, 0x003f }, + { 0x0014, 0x0040 }, + { 0x0014, 0x0041 }, + { 0x0014, 0x0042 }, + { 0x0014, 0x0043 }, + { 0x0014, 0x0044 }, + { 0x0014, 0x0045 }, + { 0x0014, 0x0046 }, + { 0x0014, 0x0047 }, + { 0x0009, 0x000f }, + { 0x0008, 0x000f }, + { 0x0009, 0x0010 }, + { 0x0009, 0x0011 }, + { 0x000a, 0x000d }, + { 0x000b, 0x0010 }, + { 0x000c, 0x0011 }, + { 0x000d, 0x0012 }, + { 0x000e, 0x0016 }, + { 0x0010, 0x002b }, + { 0x0011, 0x0044 }, + { 0x0012, 0x0071 }, + { 0x0014, 0x0048 }, + { 0x0014, 0x0049 }, + { 0x0014, 0x004a }, + { 0x0014, 0x004b }, + { 0x0014, 0x004c }, + { 0x0014, 0x004d }, + { 0x0014, 0x004e }, + { 0x0014, 0x004f }, + { 0x0014, 0x0050 }, + { 0x0014, 0x0051 }, + { 0x0014, 0x0052 }, + { 0x0014, 0x0053 }, + { 0x000b, 0x0011 }, + { 0x000a, 0x000e }, + { 0x000a, 0x000f }, + { 0x000b, 0x0012 }, + { 0x000b, 0x0013 }, + { 0x000c, 0x0012 }, + { 0x000d, 0x0013 }, + { 0x000e, 0x0017 }, + { 0x0010, 0x002c }, + { 0x0012, 0x0072 }, + { 0x0011, 0x0045 }, + { 0x0013, 0x00d0 }, + { 0x0013, 0x00d1 }, + { 0x0014, 0x0054 }, + { 0x0014, 0x0055 }, + { 0x0014, 0x0056 }, + { 0x0014, 0x0057 }, + { 0x0014, 0x0058 }, + { 0x0014, 0x0059 }, + { 0x0014, 0x005a }, + { 0x0014, 0x005b }, + { 0x0014, 0x005c }, + { 0x0014, 0x005d }, + { 0x0014, 0x005e }, + { 0x000c, 0x0013 }, + { 0x000c, 0x0014 }, + { 0x000c, 0x0015 }, + { 0x000d, 0x0014 }, + { 0x000d, 0x0015 }, + { 0x000e, 0x0018 }, + { 0x000f, 0x001e }, + { 0x0010, 0x002d }, + { 0x0011, 0x0046 }, + { 0x0011, 0x0047 }, + { 0x0011, 0x0048 }, + { 0x0014, 0x005f }, + { 0x0014, 0x0060 }, + { 0x0014, 0x0061 }, + { 0x0014, 0x0062 }, + { 0x0014, 0x0063 }, + { 0x0014, 0x0064 }, + { 0x0014, 0x0065 }, + { 0x0014, 0x0066 }, + { 0x0014, 0x0067 }, + { 0x0014, 0x0068 }, + { 0x0014, 0x0069 }, + { 0x0014, 0x006a }, + { 0x0014, 0x006b }, + { 0x000e, 0x0019 }, + { 0x000d, 0x0016 }, + { 0x000d, 0x0017 }, + { 0x000e, 0x001a }, + { 0x000e, 0x001b }, + { 0x000f, 0x001f }, + { 0x0010, 0x002e }, + { 0x0011, 0x0049 }, + { 0x0012, 0x0073 }, + { 0x0014, 0x006c }, + { 0x0014, 0x006d }, + { 0x0014, 0x006e }, + { 0x0014, 0x006f }, + { 0x0014, 0x0070 }, + { 0x0014, 0x0071 }, + { 0x0014, 0x0072 }, + { 0x0014, 0x0073 }, + { 0x0014, 0x0074 }, + { 0x0014, 0x0075 }, + { 0x0014, 0x0076 }, + { 0x0014, 0x0077 }, + { 0x0014, 0x0078 }, + { 0x0014, 0x0079 }, + { 0x0014, 0x007a }, + { 0x0010, 0x002f }, + { 0x000f, 0x0020 }, + { 0x0010, 0x0030 }, + { 0x000f, 0x0021 }, + { 0x0010, 0x0031 }, + { 0x0011, 0x004a }, + { 0x0011, 0x004b }, + { 0x0012, 0x0074 }, + { 0x0014, 0x007b }, + { 0x0014, 0x007c }, + { 0x0013, 0x00d2 }, + { 0x0014, 0x007d }, + { 0x0014, 0x007e }, + { 0x0014, 0x007f }, + { 0x0014, 0x0080 }, + { 0x0014, 0x0081 }, + { 0x0014, 0x0082 }, + { 0x0014, 0x0083 }, + { 0x0014, 0x0084 }, + { 0x0014, 0x0085 }, + { 0x0014, 0x0086 }, + { 0x0014, 0x0087 }, + { 0x0014, 0x0088 }, + { 0x0014, 0x0089 }, + { 0x0012, 0x0075 }, + { 0x0010, 0x0032 }, + { 0x0010, 0x0033 }, + { 0x0011, 0x004c }, + { 0x0011, 0x004d }, + { 0x0013, 0x00d3 }, + { 0x0013, 0x00d4 }, + { 0x0012, 0x0076 }, + { 0x0013, 0x00d5 }, + { 0x0014, 0x008a }, + { 0x0014, 0x008b }, + { 0x0014, 0x008c }, + { 0x0014, 0x008d }, + { 0x0014, 0x008e }, + { 0x0014, 0x008f }, + { 0x0014, 0x0090 }, + { 0x0014, 0x0091 }, + { 0x0014, 0x0092 }, + { 0x0014, 0x0093 }, + { 0x0014, 0x0094 }, + { 0x0014, 0x0095 }, + { 0x0014, 0x0096 }, + { 0x0014, 0x0097 }, + { 0x0014, 0x0098 }, + { 0x0013, 0x00d6 }, + { 0x0013, 0x00d7 }, + { 0x0012, 0x0077 }, + { 0x0012, 0x0078 }, + { 0x0014, 0x0099 }, + { 0x0014, 0x009a }, + { 0x0013, 0x00d8 }, + { 0x0014, 0x009b }, + { 0x0014, 0x009c }, + { 0x0014, 0x009d }, + { 0x0014, 0x009e }, + { 0x0014, 0x009f }, + { 0x0014, 0x00a0 }, + { 0x0014, 0x00a1 }, + { 0x0014, 0x00a2 }, + { 0x0014, 0x00a3 }, + { 0x0014, 0x00a4 }, + { 0x0014, 0x00a5 }, + { 0x0014, 0x00a6 }, + { 0x0014, 0x00a7 }, + { 0x0014, 0x00a8 }, + { 0x0014, 0x00a9 }, + { 0x0014, 0x00aa }, + { 0x0014, 0x00ab }, + { 0x0014, 0x00ac }, + { 0x0014, 0x00ad }, + { 0x0014, 0x00ae }, + { 0x0014, 0x00af }, + { 0x0012, 0x0079 }, + { 0x0014, 0x00b0 }, + { 0x0014, 0x00b1 }, + { 0x0014, 0x00b2 }, + { 0x0014, 0x00b3 }, + { 0x0014, 0x00b4 }, + { 0x0014, 0x00b5 }, + { 0x0014, 0x00b6 }, + { 0x0014, 0x00b7 }, + { 0x0014, 0x00b8 }, + { 0x0014, 0x00b9 }, + { 0x0014, 0x00ba }, + { 0x0014, 0x00bb }, + { 0x0014, 0x00bc }, + { 0x0014, 0x00bd }, + { 0x0014, 0x00be }, + { 0x0014, 0x00bf }, + { 0x0014, 0x00c0 }, + { 0x0014, 0x00c1 }, + { 0x0014, 0x00c2 }, + { 0x0014, 0x00c3 }, + { 0x0014, 0x00c4 }, + { 0x0014, 0x00c5 }, + { 0x0014, 0x00c6 }, + { 0x0013, 0x00d9 }, + { 0x0013, 0x00da }, + { 0x0014, 0x00c7 }, + { 0x0014, 0x00c8 }, + { 0x0014, 0x00c9 }, + { 0x0014, 0x00ca }, + { 0x0014, 0x00cb }, + { 0x0014, 0x00cc }, + { 0x0014, 0x00cd }, + { 0x0014, 0x00ce }, + { 0x0014, 0x00cf }, + { 0x0014, 0x00d0 }, + { 0x0014, 0x00d1 }, + { 0x0014, 0x00d2 }, + { 0x0014, 0x00d3 }, + { 0x0014, 0x00d4 }, + { 0x0014, 0x00d5 }, + { 0x0014, 0x00d6 }, + { 0x0014, 0x00d7 }, + { 0x0014, 0x00d8 }, + { 0x0014, 0x00d9 }, + { 0x0014, 0x00da }, + { 0x0014, 0x00db }, + { 0x0014, 0x00dc }, + { 0x0014, 0x00dd }, + { 0x0014, 0x00de }, + { 0x0014, 0x00df }, + { 0x0014, 0x00e0 }, + { 0x0014, 0x00e1 }, + { 0x0014, 0x00e2 }, + { 0x0014, 0x00e3 }, + { 0x0014, 0x00e4 }, + { 0x0014, 0x00e5 }, + { 0x0014, 0x00e6 }, + { 0x0014, 0x00e7 }, + { 0x0014, 0x00e8 }, + { 0x0014, 0x00e9 }, + { 0x0014, 0x00ea }, + { 0x0014, 0x00eb }, + { 0x0014, 0x00ec }, + { 0x0014, 0x00ed }, + { 0x0014, 0x00ee }, + { 0x0014, 0x00ef }, + { 0x0014, 0x00f0 }, + { 0x0014, 0x00f1 }, + { 0x0014, 0x00f2 }, + { 0x0014, 0x00f3 }, + { 0x0014, 0x00f4 }, + { 0x0014, 0x00f5 }, + { 0x0014, 0x00f6 }, + { 0x0014, 0x00f7 }, + { 0x0014, 0x00f8 }, + { 0x0014, 0x00f9 }, + { 0x0014, 0x00fa }, + { 0x0014, 0x00fb }, + { 0x0014, 0x00fc }, + { 0x0014, 0x00fd }, + { 0x0014, 0x00fe }, + { 0x0014, 0x00ff }, + { 0x0014, 0x0100 }, + { 0x0014, 0x0101 }, + { 0x0014, 0x0102 }, + { 0x0014, 0x0103 }, + { 0x0014, 0x0104 }, + { 0x0014, 0x0105 }, + { 0x0014, 0x0106 }, + { 0x0014, 0x0107 }, + { 0x0014, 0x0108 }, + { 0x0014, 0x0109 }, + { 0x0014, 0x010a }, + { 0x0014, 0x010b }, + { 0x0014, 0x010c }, + { 0x0014, 0x010d }, + { 0x0014, 0x010e }, + { 0x0014, 0x010f }, + { 0x0014, 0x0110 }, + { 0x0014, 0x0111 }, + { 0x0014, 0x0112 }, + { 0x0014, 0x0113 }, + { 0x0014, 0x0114 }, + { 0x0014, 0x0115 }, + { 0x0014, 0x0116 }, + { 0x0014, 0x0117 }, + { 0x0014, 0x0118 }, + { 0x0014, 0x0119 }, + { 0x0014, 0x011a }, + { 0x0014, 0x011b }, + { 0x0014, 0x011c }, + { 0x0014, 0x011d }, + { 0x0014, 0x011e }, + { 0x0014, 0x011f }, + { 0x0014, 0x0120 }, + { 0x0014, 0x0121 }, + { 0x0014, 0x0122 }, + { 0x0014, 0x0123 }, + { 0x0014, 0x0124 }, + { 0x0014, 0x0125 }, + { 0x0014, 0x0126 }, + { 0x0014, 0x0127 }, + { 0x0014, 0x0128 }, + { 0x0014, 0x0129 }, + { 0x0014, 0x012a }, + { 0x0014, 0x012b }, + { 0x0014, 0x012c }, + { 0x0014, 0x012d }, + { 0x0014, 0x012e }, + { 0x0014, 0x012f }, + { 0x0014, 0x0130 }, + { 0x0014, 0x0131 }, + { 0x0014, 0x0132 }, + { 0x0014, 0x0133 }, + { 0x0014, 0x0134 }, + { 0x0014, 0x0135 }, + { 0x0014, 0x0136 }, + { 0x0014, 0x0137 }, + { 0x0014, 0x0138 }, + { 0x0014, 0x0139 }, + { 0x0014, 0x013a }, + { 0x0014, 0x013b }, + { 0x0014, 0x013c }, + { 0x0014, 0x013d }, + { 0x0014, 0x013e }, + { 0x0014, 0x013f }, + { 0x0014, 0x0140 }, + { 0x0014, 0x0141 }, + { 0x0014, 0x0142 }, + { 0x0014, 0x0143 }, + { 0x0014, 0x0144 }, + { 0x0014, 0x0145 }, + { 0x0014, 0x0146 }, + { 0x0014, 0x0147 }, + { 0x0014, 0x0148 }, + { 0x0014, 0x0149 }, + { 0x0014, 0x014a }, + { 0x0014, 0x014b }, + { 0x0014, 0x014c }, + { 0x0014, 0x014d }, + { 0x0014, 0x014e }, + { 0x0014, 0x014f }, + { 0x0014, 0x0150 }, + { 0x0014, 0x0151 }, + { 0x0014, 0x0152 }, + { 0x0014, 0x0153 }, + { 0x0014, 0x0154 }, + { 0x0014, 0x0155 }, + { 0x0014, 0x0156 }, + { 0x0014, 0x0157 }, + { 0x0014, 0x0158 }, + { 0x0014, 0x0159 }, + { 0x0014, 0x015a }, + { 0x0014, 0x015b }, + { 0x0014, 0x015c }, + { 0x0014, 0x015d }, + { 0x0014, 0x015e }, + { 0x0014, 0x015f }, + { 0x0014, 0x0160 }, + { 0x0014, 0x0161 }, + { 0x0014, 0x0162 }, + { 0x0014, 0x0163 }, + { 0x0014, 0x0164 }, + { 0x0014, 0x0165 }, + { 0x0014, 0x0166 }, + { 0x0014, 0x0167 }, + { 0x0014, 0x0168 }, + { 0x0014, 0x0169 }, + { 0x0014, 0x016a }, + { 0x0014, 0x016b }, + { 0x0014, 0x016c }, + { 0x0014, 0x016d }, + { 0x0014, 0x016e }, + { 0x0014, 0x016f }, + { 0x0014, 0x0170 }, + { 0x0014, 0x0171 }, + { 0x0014, 0x0172 }, + { 0x0014, 0x0173 }, + { 0x0014, 0x0174 }, + { 0x0014, 0x0175 }, + { 0x0014, 0x0176 }, + { 0x0014, 0x0177 }, + { 0x0014, 0x0178 }, + { 0x0014, 0x0179 }, + { 0x0014, 0x017a }, + { 0x0014, 0x017b }, + { 0x0014, 0x017c }, + { 0x0014, 0x017d }, + { 0x0014, 0x017e }, + { 0x0014, 0x017f }, + { 0x0014, 0x0180 }, + { 0x0014, 0x0181 }, + { 0x0014, 0x0182 }, + { 0x0014, 0x0183 }, + { 0x0014, 0x0184 }, + { 0x0014, 0x0185 }, + { 0x0014, 0x0186 }, + { 0x0014, 0x0187 }, + { 0x0014, 0x0188 }, + { 0x0014, 0x0189 }, + { 0x0014, 0x018a }, + { 0x0014, 0x018b }, + { 0x0014, 0x018c }, + { 0x0014, 0x018d }, + { 0x0014, 0x018e }, + { 0x0014, 0x018f }, + { 0x0014, 0x0190 }, + { 0x0014, 0x0191 }, + { 0x0014, 0x0192 }, + { 0x0014, 0x0193 }, + { 0x0014, 0x0194 }, + { 0x0014, 0x0195 }, + { 0x0014, 0x0196 }, + { 0x0014, 0x0197 }, + { 0x0013, 0x00db }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec15[73][16] = -{ - {0x000cffff, 0x000bffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x0002ffff, 0x0001ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000019, 0x0000001a, 0x00000031, 0x00000032, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, - {0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, }, - {0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, 0x00030062, }, - {0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, - {0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x00020060, 0x00020060, 0x00020060, 0x00020060, }, - {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, - {0x00010005, 0x00010005, 0x0001001e, 0x0001001e, 0x00010036, 0x00010036, 0x0001004d, 0x0001004d, 0x00010065, 0x00010065, 0x00010078, 0x00010078, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, }, - {0x0015ffff, 0x0014ffff, 0x0012ffff, 0x0013ffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x00000006, 0x0000001f, 0x0000004e, 0x0000007d, 0x00000090, 0x00000093, 0x000000a9, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, }, - {0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, }, - {0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, }, - {0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, }, - {0x000100ad, 0x000100ad, 0x000100c0, 0x000100c0, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020038, 0x00020038, 0x00020038, 0x00020038, }, - {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c1, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, }, - {0x00000097, 0x000000ae, 0x000000c5, 0x000000d8, 0x000000d9, 0x000000da, 0x00010008, 0x00010008, 0x00010050, 0x00010050, 0x00010068, 0x00010068, 0x0001007f, 0x0001007f, 0x00010096, 0x00010096, }, - {0x002fffff, 0x0020ffff, 0x001fffff, 0x001effff, 0x001bffff, 0x001cffff, 0x001dffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x00000021, 0x00000039, 0x00000051, 0x00000080, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, }, - {0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, 0x000300c6, }, - {0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, 0x000300dc, }, - {0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f1, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, 0x000300f2, }, - {0x00010109, 0x00010109, 0x0001010b, 0x0001010b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, - {0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x00020081, 0x00020081, 0x00020081, 0x00020081, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200c7, 0x000200c7, 0x000200c7, 0x000200c7, }, - {0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f0, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f4, }, - {0x0000010a, 0x0000010c, 0x00000121, 0x00000122, 0x0001000b, 0x0001000b, 0x00010023, 0x00010023, 0x00010053, 0x00010053, 0x00010099, 0x00010099, 0x000100de, 0x000100de, 0x000100f5, 0x000100f5, }, - {0x0024ffff, 0x0022ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x0000003b, 0x0000006b, 0x00000082, 0x0000009a, 0x000000b1, 0x000000c8, 0x000000df, 0x000000f6, 0x00000108, }, - {0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x002dffff, 0x002effff, 0x002affff, 0x002bffff, 0x002cffff, 0x0021ffff, 0x0023ffff, }, - {0x0002013b, 0x0002013b, 0x0002013b, 0x0002013b, 0x00020154, 0x00020154, 0x00020154, 0x00020154, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x00030083, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, }, - {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, 0x0003006c, }, - {0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300b2, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, 0x000300ca, }, - {0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, }, - {0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, }, - {0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010d, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, 0x0003010e, }, - {0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030123, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, 0x00030124, }, - {0x0001013e, 0x0001013e, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001023f, 0x0001023f, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, }, - {0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f8, }, - {0x0002010f, 0x0002010f, 0x0002010f, 0x0002010f, 0x00020120, 0x00020120, 0x00020120, 0x00020120, 0x00020127, 0x00020127, 0x00020127, 0x00020127, 0x0002013a, 0x0002013a, 0x0002013a, 0x0002013a, }, - {0x00000237, 0x00000238, 0x00000239, 0x0000023a, 0x0000023b, 0x0000023c, 0x0000023d, 0x0000023e, 0x0001000e, 0x0001000e, 0x00010026, 0x00010026, 0x0001006d, 0x0001006d, 0x0001009d, 0x0001009d, }, - {0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x00010112, 0x00010112, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010128, 0x00010128, 0x00010138, 0x00010138, 0x00010139, 0x00010139, }, - {0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, }, - {0x0000000d, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, }, - {0x0000002d, 0x0000002e, 0x0000002f, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000056, 0x00000057, 0x00000058, }, - {0x00000059, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, }, - {0x00000077, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x0000008f, 0x0000009c, 0x0000009e, 0x0000009f, }, - {0x000000a0, 0x000000a1, 0x000000a2, 0x000000a3, 0x000000a4, 0x000000a5, 0x000000a6, 0x000000a7, 0x000000b4, 0x000000b5, 0x000000b6, 0x000000b7, 0x000000b8, 0x000000b9, 0x000000ba, 0x000000bb, }, - {0x000000bc, 0x000000bd, 0x000000be, 0x000000bf, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000e3, }, - {0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f9, 0x000000fa, 0x000000fb, 0x000000fc, }, - {0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000110, 0x00000111, 0x00000113, 0x00000114, 0x00000115, }, - {0x00000116, 0x00000117, 0x00000118, 0x00000119, 0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000129, 0x0000012a, 0x0000012b, 0x0000012c, 0x0000012d, 0x0000012e, }, - {0x0000012f, 0x00000130, 0x00000131, 0x00000132, 0x00000133, 0x00000134, 0x00000135, 0x00000136, 0x00000137, 0x0000013c, 0x0000013d, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, }, - {0x00000144, 0x00000145, 0x00000146, 0x00000147, 0x00000148, 0x00000149, 0x0000014a, 0x0000014b, 0x0000014c, 0x0000014d, 0x0000014e, 0x0000014f, 0x00000150, 0x00000151, 0x00000152, 0x00000153, }, - {0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, 0x0000015c, 0x0000015d, 0x0000015e, 0x0000015f, 0x00000160, 0x00000161, 0x00000162, 0x00000163, 0x00000164, }, - {0x00000165, 0x00000166, 0x00000167, 0x00000168, 0x00000169, 0x0000016a, 0x0000016b, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, }, - {0x00000177, 0x00000178, 0x00000179, 0x0000017a, 0x0000017b, 0x0000017c, 0x0000017d, 0x0000017e, 0x0000017f, 0x00000180, 0x00000181, 0x00000182, 0x00000183, 0x00000184, 0x00000185, 0x00000186, }, - {0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x00000190, 0x00000191, 0x00000192, 0x00000193, 0x00000194, 0x00000195, 0x00000196, }, - {0x00000197, 0x00000198, 0x00000199, 0x0000019a, 0x0000019b, 0x0000019c, 0x0000019d, 0x0000019e, 0x0000019f, 0x000001a0, 0x000001a1, 0x000001a2, 0x000001a3, 0x000001a4, 0x000001a5, 0x000001a6, }, - {0x000001a7, 0x000001a8, 0x000001a9, 0x000001aa, 0x000001ab, 0x000001ac, 0x000001ad, 0x000001ae, 0x000001af, 0x000001b0, 0x000001b1, 0x000001b2, 0x000001b3, 0x000001b4, 0x000001b5, 0x000001b6, }, - {0x000001b7, 0x000001b8, 0x000001b9, 0x000001ba, 0x000001bb, 0x000001bc, 0x000001bd, 0x000001be, 0x000001bf, 0x000001c0, 0x000001c1, 0x000001c2, 0x000001c3, 0x000001c4, 0x000001c5, 0x000001c6, }, - {0x000001c7, 0x000001c8, 0x000001c9, 0x000001ca, 0x000001cb, 0x000001cc, 0x000001cd, 0x000001ce, 0x000001cf, 0x000001d0, 0x000001d1, 0x000001d2, 0x000001d3, 0x000001d4, 0x000001d5, 0x000001d6, }, - {0x000001d7, 0x000001d8, 0x000001d9, 0x000001da, 0x000001db, 0x000001dc, 0x000001dd, 0x000001de, 0x000001df, 0x000001e0, 0x000001e1, 0x000001e2, 0x000001e3, 0x000001e4, 0x000001e5, 0x000001e6, }, - {0x000001e7, 0x000001e8, 0x000001e9, 0x000001ea, 0x000001eb, 0x000001ec, 0x000001ed, 0x000001ee, 0x000001ef, 0x000001f0, 0x000001f1, 0x000001f2, 0x000001f3, 0x000001f4, 0x000001f5, 0x000001f6, }, - {0x000001f7, 0x000001f8, 0x000001f9, 0x000001fa, 0x000001fb, 0x000001fc, 0x000001fd, 0x000001fe, 0x000001ff, 0x00000200, 0x00000201, 0x00000202, 0x00000203, 0x00000204, 0x00000205, 0x00000206, }, - {0x00000207, 0x00000208, 0x00000209, 0x0000020a, 0x0000020b, 0x0000020c, 0x0000020d, 0x0000020e, 0x0000020f, 0x00000210, 0x00000211, 0x00000212, 0x00000213, 0x00000214, 0x00000215, 0x00000216, }, - {0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, 0x0000021e, 0x0000021f, 0x00000220, 0x00000221, 0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, }, - {0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, 0x0000022e, 0x0000022f, 0x00000230, 0x00000231, 0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, }, +const uint32_t c_aauiCQMFHuffDec15[73][16] = { + { + 0x000cffff, + 0x000bffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x0002ffff, + 0x0001ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x00000019, + 0x0000001a, + 0x00000031, + 0x00000032, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, + { + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + }, + { + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, + { + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + }, + { + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + }, + { + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + 0x00030062, + }, + { + 0x00010091, + 0x00010091, + 0x00010092, + 0x00010092, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + }, + { + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + }, + { + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007a, + }, + { + 0x00010005, + 0x00010005, + 0x0001001e, + 0x0001001e, + 0x00010036, + 0x00010036, + 0x0001004d, + 0x0001004d, + 0x00010065, + 0x00010065, + 0x00010078, + 0x00010078, + 0x0001007b, + 0x0001007b, + 0x0001007c, + 0x0001007c, + }, + { + 0x0015ffff, + 0x0014ffff, + 0x0012ffff, + 0x0013ffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x00000006, + 0x0000001f, + 0x0000004e, + 0x0000007d, + 0x00000090, + 0x00000093, + 0x000000a9, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + }, + { + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + }, + { + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + }, + { + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + }, + { + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + }, + { + 0x000100ad, + 0x000100ad, + 0x000100c0, + 0x000100c0, + 0x000100c3, + 0x000100c3, + 0x000100c4, + 0x000100c4, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020038, + }, + { + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020067, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200c1, + 0x000200c1, + 0x000200c1, + 0x000200c1, + 0x000200c2, + 0x000200c2, + 0x000200c2, + 0x000200c2, + }, + { + 0x00000097, + 0x000000ae, + 0x000000c5, + 0x000000d8, + 0x000000d9, + 0x000000da, + 0x00010008, + 0x00010008, + 0x00010050, + 0x00010050, + 0x00010068, + 0x00010068, + 0x0001007f, + 0x0001007f, + 0x00010096, + 0x00010096, + }, + { + 0x002fffff, + 0x0020ffff, + 0x001fffff, + 0x001effff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x00000021, + 0x00000039, + 0x00000051, + 0x00000080, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + }, + { + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + 0x000300c6, + }, + { + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + 0x000300dc, + }, + { + 0x000300f1, + 0x000300f1, + 0x000300f1, + 0x000300f1, + 0x000300f1, + 0x000300f1, + 0x000300f1, + 0x000300f1, + 0x000300f2, + 0x000300f2, + 0x000300f2, + 0x000300f2, + 0x000300f2, + 0x000300f2, + 0x000300f2, + 0x000300f2, + }, + { + 0x00010109, + 0x00010109, + 0x0001010b, + 0x0001010b, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + }, + { + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020081, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200c7, + 0x000200c7, + 0x000200c7, + 0x000200c7, + }, + { + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200f0, + 0x000200f0, + 0x000200f0, + 0x000200f0, + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f4, + 0x000200f4, + 0x000200f4, + 0x000200f4, + }, + { + 0x0000010a, + 0x0000010c, + 0x00000121, + 0x00000122, + 0x0001000b, + 0x0001000b, + 0x00010023, + 0x00010023, + 0x00010053, + 0x00010053, + 0x00010099, + 0x00010099, + 0x000100de, + 0x000100de, + 0x000100f5, + 0x000100f5, + }, + { + 0x0024ffff, + 0x0022ffff, + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x0000003b, + 0x0000006b, + 0x00000082, + 0x0000009a, + 0x000000b1, + 0x000000c8, + 0x000000df, + 0x000000f6, + 0x00000108, + }, + { + 0x0040ffff, + 0x0041ffff, + 0x0042ffff, + 0x0043ffff, + 0x0044ffff, + 0x0045ffff, + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x002dffff, + 0x002effff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x0021ffff, + 0x0023ffff, + }, + { + 0x0002013b, + 0x0002013b, + 0x0002013b, + 0x0002013b, + 0x00020154, + 0x00020154, + 0x00020154, + 0x00020154, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00030083, + 0x00030083, + 0x00030083, + 0x00030083, + 0x00030083, + 0x00030083, + 0x00030083, + 0x00030083, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + }, + { + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + }, + { + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x0003006c, + 0x0003006c, + 0x0003006c, + 0x0003006c, + 0x0003006c, + 0x0003006c, + 0x0003006c, + 0x0003006c, + }, + { + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300b2, + 0x000300ca, + 0x000300ca, + 0x000300ca, + 0x000300ca, + 0x000300ca, + 0x000300ca, + 0x000300ca, + 0x000300ca, + }, + { + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + }, + { + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + }, + { + 0x0003010d, + 0x0003010d, + 0x0003010d, + 0x0003010d, + 0x0003010d, + 0x0003010d, + 0x0003010d, + 0x0003010d, + 0x0003010e, + 0x0003010e, + 0x0003010e, + 0x0003010e, + 0x0003010e, + 0x0003010e, + 0x0003010e, + 0x0003010e, + }, + { + 0x00030123, + 0x00030123, + 0x00030123, + 0x00030123, + 0x00030123, + 0x00030123, + 0x00030123, + 0x00030123, + 0x00030124, + 0x00030124, + 0x00030124, + 0x00030124, + 0x00030124, + 0x00030124, + 0x00030124, + 0x00030124, + }, + { + 0x0001013e, + 0x0001013e, + 0x0001016c, + 0x0001016c, + 0x0001016d, + 0x0001016d, + 0x0001023f, + 0x0001023f, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + }, + { + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020055, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200f8, + 0x000200f8, + 0x000200f8, + 0x000200f8, + }, + { + 0x0002010f, + 0x0002010f, + 0x0002010f, + 0x0002010f, + 0x00020120, + 0x00020120, + 0x00020120, + 0x00020120, + 0x00020127, + 0x00020127, + 0x00020127, + 0x00020127, + 0x0002013a, + 0x0002013a, + 0x0002013a, + 0x0002013a, + }, + { + 0x00000237, + 0x00000238, + 0x00000239, + 0x0000023a, + 0x0000023b, + 0x0000023c, + 0x0000023d, + 0x0000023e, + 0x0001000e, + 0x0001000e, + 0x00010026, + 0x00010026, + 0x0001006d, + 0x0001006d, + 0x0001009d, + 0x0001009d, + }, + { + 0x000100cb, + 0x000100cb, + 0x000100cc, + 0x000100cc, + 0x00010112, + 0x00010112, + 0x00010125, + 0x00010125, + 0x00010126, + 0x00010126, + 0x00010128, + 0x00010128, + 0x00010138, + 0x00010138, + 0x00010139, + 0x00010139, + }, + { + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + 0x0034ffff, + 0x0035ffff, + 0x0036ffff, + 0x0037ffff, + 0x0038ffff, + 0x0039ffff, + 0x003affff, + 0x003bffff, + 0x003cffff, + 0x003dffff, + 0x003effff, + 0x003fffff, + }, + { + 0x0000000d, + 0x0000000f, + 0x00000010, + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000027, + 0x00000028, + 0x00000029, + 0x0000002a, + 0x0000002b, + 0x0000002c, + }, + { + 0x0000002d, + 0x0000002e, + 0x0000002f, + 0x0000003e, + 0x0000003f, + 0x00000040, + 0x00000041, + 0x00000042, + 0x00000043, + 0x00000044, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000056, + 0x00000057, + 0x00000058, + }, + { + 0x00000059, + 0x0000005a, + 0x0000005b, + 0x0000005c, + 0x0000005d, + 0x0000005e, + 0x0000005f, + 0x0000006e, + 0x0000006f, + 0x00000070, + 0x00000071, + 0x00000072, + 0x00000073, + 0x00000074, + 0x00000075, + 0x00000076, + }, + { + 0x00000077, + 0x00000084, + 0x00000085, + 0x00000086, + 0x00000087, + 0x00000088, + 0x00000089, + 0x0000008a, + 0x0000008b, + 0x0000008c, + 0x0000008d, + 0x0000008e, + 0x0000008f, + 0x0000009c, + 0x0000009e, + 0x0000009f, + }, + { + 0x000000a0, + 0x000000a1, + 0x000000a2, + 0x000000a3, + 0x000000a4, + 0x000000a5, + 0x000000a6, + 0x000000a7, + 0x000000b4, + 0x000000b5, + 0x000000b6, + 0x000000b7, + 0x000000b8, + 0x000000b9, + 0x000000ba, + 0x000000bb, + }, + { + 0x000000bc, + 0x000000bd, + 0x000000be, + 0x000000bf, + 0x000000cd, + 0x000000ce, + 0x000000cf, + 0x000000d0, + 0x000000d1, + 0x000000d2, + 0x000000d3, + 0x000000d4, + 0x000000d5, + 0x000000d6, + 0x000000d7, + 0x000000e3, + }, + { + 0x000000e4, + 0x000000e5, + 0x000000e6, + 0x000000e7, + 0x000000e8, + 0x000000e9, + 0x000000ea, + 0x000000eb, + 0x000000ec, + 0x000000ed, + 0x000000ee, + 0x000000ef, + 0x000000f9, + 0x000000fa, + 0x000000fb, + 0x000000fc, + }, + { + 0x000000fd, + 0x000000fe, + 0x000000ff, + 0x00000100, + 0x00000101, + 0x00000102, + 0x00000103, + 0x00000104, + 0x00000105, + 0x00000106, + 0x00000107, + 0x00000110, + 0x00000111, + 0x00000113, + 0x00000114, + 0x00000115, + }, + { + 0x00000116, + 0x00000117, + 0x00000118, + 0x00000119, + 0x0000011a, + 0x0000011b, + 0x0000011c, + 0x0000011d, + 0x0000011e, + 0x0000011f, + 0x00000129, + 0x0000012a, + 0x0000012b, + 0x0000012c, + 0x0000012d, + 0x0000012e, + }, + { + 0x0000012f, + 0x00000130, + 0x00000131, + 0x00000132, + 0x00000133, + 0x00000134, + 0x00000135, + 0x00000136, + 0x00000137, + 0x0000013c, + 0x0000013d, + 0x0000013f, + 0x00000140, + 0x00000141, + 0x00000142, + 0x00000143, + }, + { + 0x00000144, + 0x00000145, + 0x00000146, + 0x00000147, + 0x00000148, + 0x00000149, + 0x0000014a, + 0x0000014b, + 0x0000014c, + 0x0000014d, + 0x0000014e, + 0x0000014f, + 0x00000150, + 0x00000151, + 0x00000152, + 0x00000153, + }, + { + 0x00000155, + 0x00000156, + 0x00000157, + 0x00000158, + 0x00000159, + 0x0000015a, + 0x0000015b, + 0x0000015c, + 0x0000015d, + 0x0000015e, + 0x0000015f, + 0x00000160, + 0x00000161, + 0x00000162, + 0x00000163, + 0x00000164, + }, + { + 0x00000165, + 0x00000166, + 0x00000167, + 0x00000168, + 0x00000169, + 0x0000016a, + 0x0000016b, + 0x0000016e, + 0x0000016f, + 0x00000170, + 0x00000171, + 0x00000172, + 0x00000173, + 0x00000174, + 0x00000175, + 0x00000176, + }, + { + 0x00000177, + 0x00000178, + 0x00000179, + 0x0000017a, + 0x0000017b, + 0x0000017c, + 0x0000017d, + 0x0000017e, + 0x0000017f, + 0x00000180, + 0x00000181, + 0x00000182, + 0x00000183, + 0x00000184, + 0x00000185, + 0x00000186, + }, + { + 0x00000187, + 0x00000188, + 0x00000189, + 0x0000018a, + 0x0000018b, + 0x0000018c, + 0x0000018d, + 0x0000018e, + 0x0000018f, + 0x00000190, + 0x00000191, + 0x00000192, + 0x00000193, + 0x00000194, + 0x00000195, + 0x00000196, + }, + { + 0x00000197, + 0x00000198, + 0x00000199, + 0x0000019a, + 0x0000019b, + 0x0000019c, + 0x0000019d, + 0x0000019e, + 0x0000019f, + 0x000001a0, + 0x000001a1, + 0x000001a2, + 0x000001a3, + 0x000001a4, + 0x000001a5, + 0x000001a6, + }, + { + 0x000001a7, + 0x000001a8, + 0x000001a9, + 0x000001aa, + 0x000001ab, + 0x000001ac, + 0x000001ad, + 0x000001ae, + 0x000001af, + 0x000001b0, + 0x000001b1, + 0x000001b2, + 0x000001b3, + 0x000001b4, + 0x000001b5, + 0x000001b6, + }, + { + 0x000001b7, + 0x000001b8, + 0x000001b9, + 0x000001ba, + 0x000001bb, + 0x000001bc, + 0x000001bd, + 0x000001be, + 0x000001bf, + 0x000001c0, + 0x000001c1, + 0x000001c2, + 0x000001c3, + 0x000001c4, + 0x000001c5, + 0x000001c6, + }, + { + 0x000001c7, + 0x000001c8, + 0x000001c9, + 0x000001ca, + 0x000001cb, + 0x000001cc, + 0x000001cd, + 0x000001ce, + 0x000001cf, + 0x000001d0, + 0x000001d1, + 0x000001d2, + 0x000001d3, + 0x000001d4, + 0x000001d5, + 0x000001d6, + }, + { + 0x000001d7, + 0x000001d8, + 0x000001d9, + 0x000001da, + 0x000001db, + 0x000001dc, + 0x000001dd, + 0x000001de, + 0x000001df, + 0x000001e0, + 0x000001e1, + 0x000001e2, + 0x000001e3, + 0x000001e4, + 0x000001e5, + 0x000001e6, + }, + { + 0x000001e7, + 0x000001e8, + 0x000001e9, + 0x000001ea, + 0x000001eb, + 0x000001ec, + 0x000001ed, + 0x000001ee, + 0x000001ef, + 0x000001f0, + 0x000001f1, + 0x000001f2, + 0x000001f3, + 0x000001f4, + 0x000001f5, + 0x000001f6, + }, + { + 0x000001f7, + 0x000001f8, + 0x000001f9, + 0x000001fa, + 0x000001fb, + 0x000001fc, + 0x000001fd, + 0x000001fe, + 0x000001ff, + 0x00000200, + 0x00000201, + 0x00000202, + 0x00000203, + 0x00000204, + 0x00000205, + 0x00000206, + }, + { + 0x00000207, + 0x00000208, + 0x00000209, + 0x0000020a, + 0x0000020b, + 0x0000020c, + 0x0000020d, + 0x0000020e, + 0x0000020f, + 0x00000210, + 0x00000211, + 0x00000212, + 0x00000213, + 0x00000214, + 0x00000215, + 0x00000216, + }, + { + 0x00000217, + 0x00000218, + 0x00000219, + 0x0000021a, + 0x0000021b, + 0x0000021c, + 0x0000021d, + 0x0000021e, + 0x0000021f, + 0x00000220, + 0x00000221, + 0x00000222, + 0x00000223, + 0x00000224, + 0x00000225, + 0x00000226, + }, + { + 0x00000227, + 0x00000228, + 0x00000229, + 0x0000022a, + 0x0000022b, + 0x0000022c, + 0x0000022d, + 0x0000022e, + 0x0000022f, + 0x00000230, + 0x00000231, + 0x00000232, + 0x00000233, + 0x00000234, + 0x00000235, + 0x00000236, + }, }; #endif @@ -1243,190 +12103,2271 @@ const uint32_t c_aauiCQMFHuffEnc16[729][2] = #else const uint16_t c_aauiCQMFHuffEnc16[729][2] = #endif -{ - {0x0006, 0x000d}, {0x0005, 0x0010}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x000a}, - {0x0009, 0x000b}, {0x000b, 0x000d}, {0x000c, 0x000e}, {0x000e, 0x0016}, {0x0010, 0x002d}, {0x0011, 0x0051}, {0x0012, 0x008c}, {0x0014, 0x0000}, - {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, - {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0005, 0x0011}, {0x0004, 0x000f}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, - {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0007, 0x000c}, {0x0008, 0x000b}, {0x000a, 0x000c}, {0x000b, 0x000e}, {0x000d, 0x0010}, {0x000e, 0x0017}, - {0x000f, 0x001c}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, - {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0006, 0x0013}, {0x0005, 0x0015}, - {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0006, 0x0014}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0009, 0x000c}, {0x000a, 0x000d}, - {0x000c, 0x000f}, {0x000d, 0x0011}, {0x000f, 0x001d}, {0x0011, 0x0052}, {0x0012, 0x008d}, {0x0012, 0x008e}, {0x0014, 0x0017}, {0x0014, 0x0018}, - {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, - {0x0014, 0x0021}, {0x0006, 0x0015}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0007, 0x000f}, - {0x0008, 0x000c}, {0x0009, 0x000d}, {0x000b, 0x000f}, {0x000c, 0x0010}, {0x000d, 0x0012}, {0x000f, 0x001e}, {0x0012, 0x008f}, {0x0014, 0x0022}, - {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, {0x0014, 0x002a}, - {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0006, 0x0018}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0006, 0x0019}, - {0x0006, 0x001a}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000d}, {0x000a, 0x000e}, {0x000b, 0x0010}, {0x000c, 0x0011}, {0x000e, 0x0018}, - {0x0010, 0x002e}, {0x0012, 0x0090}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, - {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, {0x0007, 0x0012}, - {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0008, 0x000e}, {0x0009, 0x000e}, {0x000b, 0x0011}, - {0x000c, 0x0012}, {0x000d, 0x0013}, {0x000e, 0x0019}, {0x0010, 0x002f}, {0x0012, 0x0091}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, - {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, - {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0007, 0x0015}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0007, 0x0016}, {0x0007, 0x0017}, {0x0008, 0x000f}, - {0x0009, 0x000f}, {0x000a, 0x000f}, {0x000b, 0x0012}, {0x000d, 0x0014}, {0x000e, 0x001a}, {0x000f, 0x001f}, {0x0013, 0x010f}, {0x0011, 0x0053}, - {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, - {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, {0x0014, 0x0053}, {0x0008, 0x0010}, {0x0007, 0x0018}, {0x0007, 0x0019}, - {0x0008, 0x0011}, {0x0008, 0x0012}, {0x0009, 0x0010}, {0x000a, 0x0010}, {0x000b, 0x0013}, {0x000c, 0x0013}, {0x000e, 0x001b}, {0x000f, 0x0020}, - {0x0010, 0x0030}, {0x0012, 0x0092}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, - {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, - {0x0009, 0x0011}, {0x0008, 0x0013}, {0x0009, 0x0012}, {0x0009, 0x0013}, {0x000a, 0x0011}, {0x000a, 0x0012}, {0x000b, 0x0014}, {0x000c, 0x0014}, - {0x000d, 0x0015}, {0x000e, 0x001c}, {0x000f, 0x0021}, {0x0013, 0x0110}, {0x0012, 0x0093}, {0x0012, 0x0094}, {0x0014, 0x0062}, {0x0014, 0x0063}, - {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, - {0x0014, 0x006c}, {0x0014, 0x006d}, {0x0014, 0x006e}, {0x000b, 0x0015}, {0x000a, 0x0013}, {0x000a, 0x0014}, {0x000a, 0x0015}, {0x000b, 0x0016}, - {0x000c, 0x0015}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000f, 0x0022}, {0x0010, 0x0031}, {0x0012, 0x0095}, {0x0012, 0x0096}, {0x0014, 0x006f}, - {0x0013, 0x0111}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, {0x0014, 0x0076}, - {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x000c, 0x0016}, {0x000b, 0x0017}, - {0x000c, 0x0017}, {0x000c, 0x0018}, {0x000c, 0x0019}, {0x000d, 0x0018}, {0x000e, 0x001d}, {0x000f, 0x0023}, {0x000f, 0x0024}, {0x0011, 0x0054}, - {0x0012, 0x0097}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, - {0x0014, 0x0084}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, - {0x0014, 0x008c}, {0x000e, 0x001e}, {0x000d, 0x0019}, {0x000d, 0x001a}, {0x000d, 0x001b}, {0x000e, 0x001f}, {0x000f, 0x0025}, {0x000f, 0x0026}, - {0x0010, 0x0032}, {0x0010, 0x0033}, {0x0012, 0x0098}, {0x0013, 0x0112}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, - {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, - {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x000f, 0x0027}, {0x000f, 0x0028}, {0x000f, 0x0029}, {0x000f, 0x002a}, - {0x0010, 0x0034}, {0x000f, 0x002b}, {0x0011, 0x0055}, {0x0012, 0x0099}, {0x0012, 0x009a}, {0x0012, 0x009b}, {0x0014, 0x009d}, {0x0013, 0x0113}, - {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, - {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0011, 0x0056}, - {0x0010, 0x0035}, {0x0010, 0x0036}, {0x0010, 0x0037}, {0x0011, 0x0057}, {0x0012, 0x009c}, {0x0012, 0x009d}, {0x0012, 0x009e}, {0x0014, 0x00ad}, - {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, - {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, - {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0012, 0x009f}, {0x0011, 0x0058}, {0x0012, 0x00a0}, {0x0014, 0x00c0}, {0x0011, 0x0059}, {0x0013, 0x0114}, - {0x0012, 0x00a1}, {0x0014, 0x00c1}, {0x0013, 0x0115}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, - {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, - {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, - {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, - {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, - {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, - {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, - {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, - {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, {0x0014, 0x0106}, - {0x0014, 0x0107}, {0x0014, 0x0108}, {0x0014, 0x0109}, {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, {0x0014, 0x010e}, - {0x0014, 0x010f}, {0x0014, 0x0110}, {0x0014, 0x0111}, {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, {0x0014, 0x0116}, - {0x0014, 0x0117}, {0x0014, 0x0118}, {0x0014, 0x0119}, {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, {0x0014, 0x011e}, - {0x0014, 0x011f}, {0x0014, 0x0120}, {0x0014, 0x0121}, {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, {0x0013, 0x0116}, - {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, {0x0014, 0x0129}, {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, - {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, {0x0014, 0x0131}, {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, - {0x0014, 0x0136}, {0x0014, 0x0137}, {0x0014, 0x0138}, {0x0014, 0x0139}, {0x0014, 0x013a}, {0x0014, 0x013b}, {0x0014, 0x013c}, {0x0014, 0x013d}, - {0x0014, 0x013e}, {0x0014, 0x013f}, {0x0014, 0x0140}, {0x0014, 0x0141}, {0x0014, 0x0142}, {0x0014, 0x0143}, {0x0014, 0x0144}, {0x0014, 0x0145}, - {0x0014, 0x0146}, {0x0014, 0x0147}, {0x0014, 0x0148}, {0x0014, 0x0149}, {0x0014, 0x014a}, {0x0014, 0x014b}, {0x0014, 0x014c}, {0x0014, 0x014d}, - {0x0014, 0x014e}, {0x0014, 0x014f}, {0x0014, 0x0150}, {0x0014, 0x0151}, {0x0014, 0x0152}, {0x0014, 0x0153}, {0x0014, 0x0154}, {0x0014, 0x0155}, - {0x0014, 0x0156}, {0x0014, 0x0157}, {0x0014, 0x0158}, {0x0014, 0x0159}, {0x0014, 0x015a}, {0x0014, 0x015b}, {0x0014, 0x015c}, {0x0014, 0x015d}, - {0x0014, 0x015e}, {0x0014, 0x015f}, {0x0014, 0x0160}, {0x0014, 0x0161}, {0x0014, 0x0162}, {0x0014, 0x0163}, {0x0014, 0x0164}, {0x0014, 0x0165}, - {0x0014, 0x0166}, {0x0014, 0x0167}, {0x0014, 0x0168}, {0x0014, 0x0169}, {0x0014, 0x016a}, {0x0014, 0x016b}, {0x0014, 0x016c}, {0x0014, 0x016d}, - {0x0014, 0x016e}, {0x0014, 0x016f}, {0x0014, 0x0170}, {0x0014, 0x0171}, {0x0014, 0x0172}, {0x0014, 0x0173}, {0x0014, 0x0174}, {0x0014, 0x0175}, - {0x0014, 0x0176}, {0x0014, 0x0177}, {0x0014, 0x0178}, {0x0014, 0x0179}, {0x0014, 0x017a}, {0x0014, 0x017b}, {0x0014, 0x017c}, {0x0014, 0x017d}, - {0x0014, 0x017e}, {0x0014, 0x017f}, {0x0014, 0x0180}, {0x0014, 0x0181}, {0x0014, 0x0182}, {0x0014, 0x0183}, {0x0014, 0x0184}, {0x0014, 0x0185}, - {0x0014, 0x0186}, {0x0014, 0x0187}, {0x0014, 0x0188}, {0x0014, 0x0189}, {0x0014, 0x018a}, {0x0014, 0x018b}, {0x0014, 0x018c}, {0x0014, 0x018d}, - {0x0014, 0x018e}, {0x0014, 0x018f}, {0x0014, 0x0190}, {0x0014, 0x0191}, {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, - {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0014, 0x0198}, {0x0014, 0x0199}, {0x0014, 0x019a}, {0x0014, 0x019b}, {0x0014, 0x019c}, {0x0014, 0x019d}, - {0x0014, 0x019e}, {0x0014, 0x019f}, {0x0014, 0x01a0}, {0x0014, 0x01a1}, {0x0014, 0x01a2}, {0x0014, 0x01a3}, {0x0014, 0x01a4}, {0x0014, 0x01a5}, - {0x0014, 0x01a6}, {0x0014, 0x01a7}, {0x0014, 0x01a8}, {0x0014, 0x01a9}, {0x0014, 0x01aa}, {0x0014, 0x01ab}, {0x0014, 0x01ac}, {0x0014, 0x01ad}, - {0x0014, 0x01ae}, {0x0014, 0x01af}, {0x0014, 0x01b0}, {0x0014, 0x01b1}, {0x0014, 0x01b2}, {0x0014, 0x01b3}, {0x0014, 0x01b4}, {0x0014, 0x01b5}, - {0x0014, 0x01b6}, {0x0014, 0x01b7}, {0x0014, 0x01b8}, {0x0014, 0x01b9}, {0x0014, 0x01ba}, {0x0014, 0x01bb}, {0x0014, 0x01bc}, {0x0014, 0x01bd}, - {0x0014, 0x01be}, {0x0014, 0x01bf}, {0x0014, 0x01c0}, {0x0014, 0x01c1}, {0x0014, 0x01c2}, {0x0014, 0x01c3}, {0x0014, 0x01c4}, {0x0014, 0x01c5}, - {0x0014, 0x01c6}, {0x0014, 0x01c7}, {0x0014, 0x01c8}, {0x0014, 0x01c9}, {0x0014, 0x01ca}, {0x0014, 0x01cb}, {0x0014, 0x01cc}, {0x0014, 0x01cd}, - {0x0014, 0x01ce}, {0x0014, 0x01cf}, {0x0014, 0x01d0}, {0x0014, 0x01d1}, {0x0014, 0x01d2}, {0x0014, 0x01d3}, {0x0014, 0x01d4}, {0x0014, 0x01d5}, - {0x0014, 0x01d6}, {0x0014, 0x01d7}, {0x0014, 0x01d8}, {0x0014, 0x01d9}, {0x0014, 0x01da}, {0x0014, 0x01db}, {0x0014, 0x01dc}, {0x0014, 0x01dd}, - {0x0014, 0x01de}, {0x0014, 0x01df}, {0x0014, 0x01e0}, {0x0014, 0x01e1}, {0x0014, 0x01e2}, {0x0014, 0x01e3}, {0x0014, 0x01e4}, {0x0014, 0x01e5}, - {0x0014, 0x01e6}, {0x0014, 0x01e7}, {0x0014, 0x01e8}, {0x0014, 0x01e9}, {0x0014, 0x01ea}, {0x0014, 0x01eb}, {0x0014, 0x01ec}, {0x0014, 0x01ed}, - {0x0014, 0x01ee}, {0x0014, 0x01ef}, {0x0014, 0x01f0}, {0x0014, 0x01f1}, {0x0014, 0x01f2}, {0x0014, 0x01f3}, {0x0014, 0x01f4}, {0x0014, 0x01f5}, - {0x0014, 0x01f6}, {0x0014, 0x01f7}, {0x0014, 0x01f8}, {0x0014, 0x01f9}, {0x0014, 0x01fa}, {0x0014, 0x01fb}, {0x0014, 0x01fc}, {0x0014, 0x01fd}, - {0x0014, 0x01fe}, {0x0014, 0x01ff}, {0x0014, 0x0200}, {0x0014, 0x0201}, {0x0014, 0x0202}, {0x0014, 0x0203}, {0x0014, 0x0204}, {0x0014, 0x0205}, - {0x0014, 0x0206}, {0x0014, 0x0207}, {0x0014, 0x0208}, {0x0014, 0x0209}, {0x0014, 0x020a}, {0x0014, 0x020b}, {0x0014, 0x020c}, {0x0014, 0x020d}, - {0x0014, 0x020e}, {0x0014, 0x020f}, {0x0014, 0x0210}, {0x0014, 0x0211}, {0x0014, 0x0212}, {0x0014, 0x0213}, {0x0014, 0x0214}, {0x0014, 0x0215}, - {0x0013, 0x0117}, + { + { 0x0006, 0x000d }, + { 0x0005, 0x0010 }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0008, 0x000a }, + { 0x0009, 0x000b }, + { 0x000b, 0x000d }, + { 0x000c, 0x000e }, + { 0x000e, 0x0016 }, + { 0x0010, 0x002d }, + { 0x0011, 0x0051 }, + { 0x0012, 0x008c }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0014, 0x0006 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0014, 0x0009 }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0005, 0x0011 }, + { 0x0004, 0x000f }, + { 0x0005, 0x0012 }, + { 0x0005, 0x0013 }, + { 0x0005, 0x0014 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0007, 0x000c }, + { 0x0008, 0x000b }, + { 0x000a, 0x000c }, + { 0x000b, 0x000e }, + { 0x000d, 0x0010 }, + { 0x000e, 0x0017 }, + { 0x000f, 0x001c }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0014, 0x000c }, + { 0x0014, 0x000d }, + { 0x0014, 0x000e }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0014, 0x0013 }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0006, 0x0013 }, + { 0x0005, 0x0015 }, + { 0x0005, 0x0016 }, + { 0x0005, 0x0017 }, + { 0x0005, 0x0018 }, + { 0x0006, 0x0014 }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0009, 0x000c }, + { 0x000a, 0x000d }, + { 0x000c, 0x000f }, + { 0x000d, 0x0011 }, + { 0x000f, 0x001d }, + { 0x0011, 0x0052 }, + { 0x0012, 0x008d }, + { 0x0012, 0x008e }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, + { 0x0014, 0x001a }, + { 0x0014, 0x001b }, + { 0x0014, 0x001c }, + { 0x0014, 0x001d }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0014, 0x0020 }, + { 0x0014, 0x0021 }, + { 0x0006, 0x0015 }, + { 0x0005, 0x0019 }, + { 0x0005, 0x001a }, + { 0x0005, 0x001b }, + { 0x0006, 0x0016 }, + { 0x0006, 0x0017 }, + { 0x0007, 0x000f }, + { 0x0008, 0x000c }, + { 0x0009, 0x000d }, + { 0x000b, 0x000f }, + { 0x000c, 0x0010 }, + { 0x000d, 0x0012 }, + { 0x000f, 0x001e }, + { 0x0012, 0x008f }, + { 0x0014, 0x0022 }, + { 0x0014, 0x0023 }, + { 0x0014, 0x0024 }, + { 0x0014, 0x0025 }, + { 0x0014, 0x0026 }, + { 0x0014, 0x0027 }, + { 0x0014, 0x0028 }, + { 0x0014, 0x0029 }, + { 0x0014, 0x002a }, + { 0x0014, 0x002b }, + { 0x0014, 0x002c }, + { 0x0014, 0x002d }, + { 0x0014, 0x002e }, + { 0x0006, 0x0018 }, + { 0x0005, 0x001c }, + { 0x0005, 0x001d }, + { 0x0006, 0x0019 }, + { 0x0006, 0x001a }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0008, 0x000d }, + { 0x000a, 0x000e }, + { 0x000b, 0x0010 }, + { 0x000c, 0x0011 }, + { 0x000e, 0x0018 }, + { 0x0010, 0x002e }, + { 0x0012, 0x0090 }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0014, 0x002f }, + { 0x0014, 0x0030 }, + { 0x0014, 0x0031 }, + { 0x0014, 0x0032 }, + { 0x0014, 0x0033 }, + { 0x0014, 0x0034 }, + { 0x0014, 0x0035 }, + { 0x0014, 0x0036 }, + { 0x0014, 0x0037 }, + { 0x0014, 0x0038 }, + { 0x0014, 0x0039 }, + { 0x0007, 0x0012 }, + { 0x0006, 0x001b }, + { 0x0006, 0x001c }, + { 0x0006, 0x001d }, + { 0x0007, 0x0013 }, + { 0x0007, 0x0014 }, + { 0x0008, 0x000e }, + { 0x0009, 0x000e }, + { 0x000b, 0x0011 }, + { 0x000c, 0x0012 }, + { 0x000d, 0x0013 }, + { 0x000e, 0x0019 }, + { 0x0010, 0x002f }, + { 0x0012, 0x0091 }, + { 0x0014, 0x003a }, + { 0x0014, 0x003b }, + { 0x0014, 0x003c }, + { 0x0014, 0x003d }, + { 0x0014, 0x003e }, + { 0x0014, 0x003f }, + { 0x0014, 0x0040 }, + { 0x0014, 0x0041 }, + { 0x0014, 0x0042 }, + { 0x0014, 0x0043 }, + { 0x0014, 0x0044 }, + { 0x0014, 0x0045 }, + { 0x0014, 0x0046 }, + { 0x0007, 0x0015 }, + { 0x0006, 0x001e }, + { 0x0006, 0x001f }, + { 0x0007, 0x0016 }, + { 0x0007, 0x0017 }, + { 0x0008, 0x000f }, + { 0x0009, 0x000f }, + { 0x000a, 0x000f }, + { 0x000b, 0x0012 }, + { 0x000d, 0x0014 }, + { 0x000e, 0x001a }, + { 0x000f, 0x001f }, + { 0x0013, 0x010f }, + { 0x0011, 0x0053 }, + { 0x0014, 0x0047 }, + { 0x0014, 0x0048 }, + { 0x0014, 0x0049 }, + { 0x0014, 0x004a }, + { 0x0014, 0x004b }, + { 0x0014, 0x004c }, + { 0x0014, 0x004d }, + { 0x0014, 0x004e }, + { 0x0014, 0x004f }, + { 0x0014, 0x0050 }, + { 0x0014, 0x0051 }, + { 0x0014, 0x0052 }, + { 0x0014, 0x0053 }, + { 0x0008, 0x0010 }, + { 0x0007, 0x0018 }, + { 0x0007, 0x0019 }, + { 0x0008, 0x0011 }, + { 0x0008, 0x0012 }, + { 0x0009, 0x0010 }, + { 0x000a, 0x0010 }, + { 0x000b, 0x0013 }, + { 0x000c, 0x0013 }, + { 0x000e, 0x001b }, + { 0x000f, 0x0020 }, + { 0x0010, 0x0030 }, + { 0x0012, 0x0092 }, + { 0x0014, 0x0054 }, + { 0x0014, 0x0055 }, + { 0x0014, 0x0056 }, + { 0x0014, 0x0057 }, + { 0x0014, 0x0058 }, + { 0x0014, 0x0059 }, + { 0x0014, 0x005a }, + { 0x0014, 0x005b }, + { 0x0014, 0x005c }, + { 0x0014, 0x005d }, + { 0x0014, 0x005e }, + { 0x0014, 0x005f }, + { 0x0014, 0x0060 }, + { 0x0014, 0x0061 }, + { 0x0009, 0x0011 }, + { 0x0008, 0x0013 }, + { 0x0009, 0x0012 }, + { 0x0009, 0x0013 }, + { 0x000a, 0x0011 }, + { 0x000a, 0x0012 }, + { 0x000b, 0x0014 }, + { 0x000c, 0x0014 }, + { 0x000d, 0x0015 }, + { 0x000e, 0x001c }, + { 0x000f, 0x0021 }, + { 0x0013, 0x0110 }, + { 0x0012, 0x0093 }, + { 0x0012, 0x0094 }, + { 0x0014, 0x0062 }, + { 0x0014, 0x0063 }, + { 0x0014, 0x0064 }, + { 0x0014, 0x0065 }, + { 0x0014, 0x0066 }, + { 0x0014, 0x0067 }, + { 0x0014, 0x0068 }, + { 0x0014, 0x0069 }, + { 0x0014, 0x006a }, + { 0x0014, 0x006b }, + { 0x0014, 0x006c }, + { 0x0014, 0x006d }, + { 0x0014, 0x006e }, + { 0x000b, 0x0015 }, + { 0x000a, 0x0013 }, + { 0x000a, 0x0014 }, + { 0x000a, 0x0015 }, + { 0x000b, 0x0016 }, + { 0x000c, 0x0015 }, + { 0x000d, 0x0016 }, + { 0x000d, 0x0017 }, + { 0x000f, 0x0022 }, + { 0x0010, 0x0031 }, + { 0x0012, 0x0095 }, + { 0x0012, 0x0096 }, + { 0x0014, 0x006f }, + { 0x0013, 0x0111 }, + { 0x0014, 0x0070 }, + { 0x0014, 0x0071 }, + { 0x0014, 0x0072 }, + { 0x0014, 0x0073 }, + { 0x0014, 0x0074 }, + { 0x0014, 0x0075 }, + { 0x0014, 0x0076 }, + { 0x0014, 0x0077 }, + { 0x0014, 0x0078 }, + { 0x0014, 0x0079 }, + { 0x0014, 0x007a }, + { 0x0014, 0x007b }, + { 0x0014, 0x007c }, + { 0x000c, 0x0016 }, + { 0x000b, 0x0017 }, + { 0x000c, 0x0017 }, + { 0x000c, 0x0018 }, + { 0x000c, 0x0019 }, + { 0x000d, 0x0018 }, + { 0x000e, 0x001d }, + { 0x000f, 0x0023 }, + { 0x000f, 0x0024 }, + { 0x0011, 0x0054 }, + { 0x0012, 0x0097 }, + { 0x0014, 0x007d }, + { 0x0014, 0x007e }, + { 0x0014, 0x007f }, + { 0x0014, 0x0080 }, + { 0x0014, 0x0081 }, + { 0x0014, 0x0082 }, + { 0x0014, 0x0083 }, + { 0x0014, 0x0084 }, + { 0x0014, 0x0085 }, + { 0x0014, 0x0086 }, + { 0x0014, 0x0087 }, + { 0x0014, 0x0088 }, + { 0x0014, 0x0089 }, + { 0x0014, 0x008a }, + { 0x0014, 0x008b }, + { 0x0014, 0x008c }, + { 0x000e, 0x001e }, + { 0x000d, 0x0019 }, + { 0x000d, 0x001a }, + { 0x000d, 0x001b }, + { 0x000e, 0x001f }, + { 0x000f, 0x0025 }, + { 0x000f, 0x0026 }, + { 0x0010, 0x0032 }, + { 0x0010, 0x0033 }, + { 0x0012, 0x0098 }, + { 0x0013, 0x0112 }, + { 0x0014, 0x008d }, + { 0x0014, 0x008e }, + { 0x0014, 0x008f }, + { 0x0014, 0x0090 }, + { 0x0014, 0x0091 }, + { 0x0014, 0x0092 }, + { 0x0014, 0x0093 }, + { 0x0014, 0x0094 }, + { 0x0014, 0x0095 }, + { 0x0014, 0x0096 }, + { 0x0014, 0x0097 }, + { 0x0014, 0x0098 }, + { 0x0014, 0x0099 }, + { 0x0014, 0x009a }, + { 0x0014, 0x009b }, + { 0x0014, 0x009c }, + { 0x000f, 0x0027 }, + { 0x000f, 0x0028 }, + { 0x000f, 0x0029 }, + { 0x000f, 0x002a }, + { 0x0010, 0x0034 }, + { 0x000f, 0x002b }, + { 0x0011, 0x0055 }, + { 0x0012, 0x0099 }, + { 0x0012, 0x009a }, + { 0x0012, 0x009b }, + { 0x0014, 0x009d }, + { 0x0013, 0x0113 }, + { 0x0014, 0x009e }, + { 0x0014, 0x009f }, + { 0x0014, 0x00a0 }, + { 0x0014, 0x00a1 }, + { 0x0014, 0x00a2 }, + { 0x0014, 0x00a3 }, + { 0x0014, 0x00a4 }, + { 0x0014, 0x00a5 }, + { 0x0014, 0x00a6 }, + { 0x0014, 0x00a7 }, + { 0x0014, 0x00a8 }, + { 0x0014, 0x00a9 }, + { 0x0014, 0x00aa }, + { 0x0014, 0x00ab }, + { 0x0014, 0x00ac }, + { 0x0011, 0x0056 }, + { 0x0010, 0x0035 }, + { 0x0010, 0x0036 }, + { 0x0010, 0x0037 }, + { 0x0011, 0x0057 }, + { 0x0012, 0x009c }, + { 0x0012, 0x009d }, + { 0x0012, 0x009e }, + { 0x0014, 0x00ad }, + { 0x0014, 0x00ae }, + { 0x0014, 0x00af }, + { 0x0014, 0x00b0 }, + { 0x0014, 0x00b1 }, + { 0x0014, 0x00b2 }, + { 0x0014, 0x00b3 }, + { 0x0014, 0x00b4 }, + { 0x0014, 0x00b5 }, + { 0x0014, 0x00b6 }, + { 0x0014, 0x00b7 }, + { 0x0014, 0x00b8 }, + { 0x0014, 0x00b9 }, + { 0x0014, 0x00ba }, + { 0x0014, 0x00bb }, + { 0x0014, 0x00bc }, + { 0x0014, 0x00bd }, + { 0x0014, 0x00be }, + { 0x0014, 0x00bf }, + { 0x0012, 0x009f }, + { 0x0011, 0x0058 }, + { 0x0012, 0x00a0 }, + { 0x0014, 0x00c0 }, + { 0x0011, 0x0059 }, + { 0x0013, 0x0114 }, + { 0x0012, 0x00a1 }, + { 0x0014, 0x00c1 }, + { 0x0013, 0x0115 }, + { 0x0014, 0x00c2 }, + { 0x0014, 0x00c3 }, + { 0x0014, 0x00c4 }, + { 0x0014, 0x00c5 }, + { 0x0014, 0x00c6 }, + { 0x0014, 0x00c7 }, + { 0x0014, 0x00c8 }, + { 0x0014, 0x00c9 }, + { 0x0014, 0x00ca }, + { 0x0014, 0x00cb }, + { 0x0014, 0x00cc }, + { 0x0014, 0x00cd }, + { 0x0014, 0x00ce }, + { 0x0014, 0x00cf }, + { 0x0014, 0x00d0 }, + { 0x0014, 0x00d1 }, + { 0x0014, 0x00d2 }, + { 0x0014, 0x00d3 }, + { 0x0014, 0x00d4 }, + { 0x0014, 0x00d5 }, + { 0x0014, 0x00d6 }, + { 0x0014, 0x00d7 }, + { 0x0014, 0x00d8 }, + { 0x0014, 0x00d9 }, + { 0x0014, 0x00da }, + { 0x0014, 0x00db }, + { 0x0014, 0x00dc }, + { 0x0014, 0x00dd }, + { 0x0014, 0x00de }, + { 0x0014, 0x00df }, + { 0x0014, 0x00e0 }, + { 0x0014, 0x00e1 }, + { 0x0014, 0x00e2 }, + { 0x0014, 0x00e3 }, + { 0x0014, 0x00e4 }, + { 0x0014, 0x00e5 }, + { 0x0014, 0x00e6 }, + { 0x0014, 0x00e7 }, + { 0x0014, 0x00e8 }, + { 0x0014, 0x00e9 }, + { 0x0014, 0x00ea }, + { 0x0014, 0x00eb }, + { 0x0014, 0x00ec }, + { 0x0014, 0x00ed }, + { 0x0014, 0x00ee }, + { 0x0014, 0x00ef }, + { 0x0014, 0x00f0 }, + { 0x0014, 0x00f1 }, + { 0x0014, 0x00f2 }, + { 0x0014, 0x00f3 }, + { 0x0014, 0x00f4 }, + { 0x0014, 0x00f5 }, + { 0x0014, 0x00f6 }, + { 0x0014, 0x00f7 }, + { 0x0014, 0x00f8 }, + { 0x0014, 0x00f9 }, + { 0x0014, 0x00fa }, + { 0x0014, 0x00fb }, + { 0x0014, 0x00fc }, + { 0x0014, 0x00fd }, + { 0x0014, 0x00fe }, + { 0x0014, 0x00ff }, + { 0x0014, 0x0100 }, + { 0x0014, 0x0101 }, + { 0x0014, 0x0102 }, + { 0x0014, 0x0103 }, + { 0x0014, 0x0104 }, + { 0x0014, 0x0105 }, + { 0x0014, 0x0106 }, + { 0x0014, 0x0107 }, + { 0x0014, 0x0108 }, + { 0x0014, 0x0109 }, + { 0x0014, 0x010a }, + { 0x0014, 0x010b }, + { 0x0014, 0x010c }, + { 0x0014, 0x010d }, + { 0x0014, 0x010e }, + { 0x0014, 0x010f }, + { 0x0014, 0x0110 }, + { 0x0014, 0x0111 }, + { 0x0014, 0x0112 }, + { 0x0014, 0x0113 }, + { 0x0014, 0x0114 }, + { 0x0014, 0x0115 }, + { 0x0014, 0x0116 }, + { 0x0014, 0x0117 }, + { 0x0014, 0x0118 }, + { 0x0014, 0x0119 }, + { 0x0014, 0x011a }, + { 0x0014, 0x011b }, + { 0x0014, 0x011c }, + { 0x0014, 0x011d }, + { 0x0014, 0x011e }, + { 0x0014, 0x011f }, + { 0x0014, 0x0120 }, + { 0x0014, 0x0121 }, + { 0x0014, 0x0122 }, + { 0x0014, 0x0123 }, + { 0x0014, 0x0124 }, + { 0x0014, 0x0125 }, + { 0x0013, 0x0116 }, + { 0x0014, 0x0126 }, + { 0x0014, 0x0127 }, + { 0x0014, 0x0128 }, + { 0x0014, 0x0129 }, + { 0x0014, 0x012a }, + { 0x0014, 0x012b }, + { 0x0014, 0x012c }, + { 0x0014, 0x012d }, + { 0x0014, 0x012e }, + { 0x0014, 0x012f }, + { 0x0014, 0x0130 }, + { 0x0014, 0x0131 }, + { 0x0014, 0x0132 }, + { 0x0014, 0x0133 }, + { 0x0014, 0x0134 }, + { 0x0014, 0x0135 }, + { 0x0014, 0x0136 }, + { 0x0014, 0x0137 }, + { 0x0014, 0x0138 }, + { 0x0014, 0x0139 }, + { 0x0014, 0x013a }, + { 0x0014, 0x013b }, + { 0x0014, 0x013c }, + { 0x0014, 0x013d }, + { 0x0014, 0x013e }, + { 0x0014, 0x013f }, + { 0x0014, 0x0140 }, + { 0x0014, 0x0141 }, + { 0x0014, 0x0142 }, + { 0x0014, 0x0143 }, + { 0x0014, 0x0144 }, + { 0x0014, 0x0145 }, + { 0x0014, 0x0146 }, + { 0x0014, 0x0147 }, + { 0x0014, 0x0148 }, + { 0x0014, 0x0149 }, + { 0x0014, 0x014a }, + { 0x0014, 0x014b }, + { 0x0014, 0x014c }, + { 0x0014, 0x014d }, + { 0x0014, 0x014e }, + { 0x0014, 0x014f }, + { 0x0014, 0x0150 }, + { 0x0014, 0x0151 }, + { 0x0014, 0x0152 }, + { 0x0014, 0x0153 }, + { 0x0014, 0x0154 }, + { 0x0014, 0x0155 }, + { 0x0014, 0x0156 }, + { 0x0014, 0x0157 }, + { 0x0014, 0x0158 }, + { 0x0014, 0x0159 }, + { 0x0014, 0x015a }, + { 0x0014, 0x015b }, + { 0x0014, 0x015c }, + { 0x0014, 0x015d }, + { 0x0014, 0x015e }, + { 0x0014, 0x015f }, + { 0x0014, 0x0160 }, + { 0x0014, 0x0161 }, + { 0x0014, 0x0162 }, + { 0x0014, 0x0163 }, + { 0x0014, 0x0164 }, + { 0x0014, 0x0165 }, + { 0x0014, 0x0166 }, + { 0x0014, 0x0167 }, + { 0x0014, 0x0168 }, + { 0x0014, 0x0169 }, + { 0x0014, 0x016a }, + { 0x0014, 0x016b }, + { 0x0014, 0x016c }, + { 0x0014, 0x016d }, + { 0x0014, 0x016e }, + { 0x0014, 0x016f }, + { 0x0014, 0x0170 }, + { 0x0014, 0x0171 }, + { 0x0014, 0x0172 }, + { 0x0014, 0x0173 }, + { 0x0014, 0x0174 }, + { 0x0014, 0x0175 }, + { 0x0014, 0x0176 }, + { 0x0014, 0x0177 }, + { 0x0014, 0x0178 }, + { 0x0014, 0x0179 }, + { 0x0014, 0x017a }, + { 0x0014, 0x017b }, + { 0x0014, 0x017c }, + { 0x0014, 0x017d }, + { 0x0014, 0x017e }, + { 0x0014, 0x017f }, + { 0x0014, 0x0180 }, + { 0x0014, 0x0181 }, + { 0x0014, 0x0182 }, + { 0x0014, 0x0183 }, + { 0x0014, 0x0184 }, + { 0x0014, 0x0185 }, + { 0x0014, 0x0186 }, + { 0x0014, 0x0187 }, + { 0x0014, 0x0188 }, + { 0x0014, 0x0189 }, + { 0x0014, 0x018a }, + { 0x0014, 0x018b }, + { 0x0014, 0x018c }, + { 0x0014, 0x018d }, + { 0x0014, 0x018e }, + { 0x0014, 0x018f }, + { 0x0014, 0x0190 }, + { 0x0014, 0x0191 }, + { 0x0014, 0x0192 }, + { 0x0014, 0x0193 }, + { 0x0014, 0x0194 }, + { 0x0014, 0x0195 }, + { 0x0014, 0x0196 }, + { 0x0014, 0x0197 }, + { 0x0014, 0x0198 }, + { 0x0014, 0x0199 }, + { 0x0014, 0x019a }, + { 0x0014, 0x019b }, + { 0x0014, 0x019c }, + { 0x0014, 0x019d }, + { 0x0014, 0x019e }, + { 0x0014, 0x019f }, + { 0x0014, 0x01a0 }, + { 0x0014, 0x01a1 }, + { 0x0014, 0x01a2 }, + { 0x0014, 0x01a3 }, + { 0x0014, 0x01a4 }, + { 0x0014, 0x01a5 }, + { 0x0014, 0x01a6 }, + { 0x0014, 0x01a7 }, + { 0x0014, 0x01a8 }, + { 0x0014, 0x01a9 }, + { 0x0014, 0x01aa }, + { 0x0014, 0x01ab }, + { 0x0014, 0x01ac }, + { 0x0014, 0x01ad }, + { 0x0014, 0x01ae }, + { 0x0014, 0x01af }, + { 0x0014, 0x01b0 }, + { 0x0014, 0x01b1 }, + { 0x0014, 0x01b2 }, + { 0x0014, 0x01b3 }, + { 0x0014, 0x01b4 }, + { 0x0014, 0x01b5 }, + { 0x0014, 0x01b6 }, + { 0x0014, 0x01b7 }, + { 0x0014, 0x01b8 }, + { 0x0014, 0x01b9 }, + { 0x0014, 0x01ba }, + { 0x0014, 0x01bb }, + { 0x0014, 0x01bc }, + { 0x0014, 0x01bd }, + { 0x0014, 0x01be }, + { 0x0014, 0x01bf }, + { 0x0014, 0x01c0 }, + { 0x0014, 0x01c1 }, + { 0x0014, 0x01c2 }, + { 0x0014, 0x01c3 }, + { 0x0014, 0x01c4 }, + { 0x0014, 0x01c5 }, + { 0x0014, 0x01c6 }, + { 0x0014, 0x01c7 }, + { 0x0014, 0x01c8 }, + { 0x0014, 0x01c9 }, + { 0x0014, 0x01ca }, + { 0x0014, 0x01cb }, + { 0x0014, 0x01cc }, + { 0x0014, 0x01cd }, + { 0x0014, 0x01ce }, + { 0x0014, 0x01cf }, + { 0x0014, 0x01d0 }, + { 0x0014, 0x01d1 }, + { 0x0014, 0x01d2 }, + { 0x0014, 0x01d3 }, + { 0x0014, 0x01d4 }, + { 0x0014, 0x01d5 }, + { 0x0014, 0x01d6 }, + { 0x0014, 0x01d7 }, + { 0x0014, 0x01d8 }, + { 0x0014, 0x01d9 }, + { 0x0014, 0x01da }, + { 0x0014, 0x01db }, + { 0x0014, 0x01dc }, + { 0x0014, 0x01dd }, + { 0x0014, 0x01de }, + { 0x0014, 0x01df }, + { 0x0014, 0x01e0 }, + { 0x0014, 0x01e1 }, + { 0x0014, 0x01e2 }, + { 0x0014, 0x01e3 }, + { 0x0014, 0x01e4 }, + { 0x0014, 0x01e5 }, + { 0x0014, 0x01e6 }, + { 0x0014, 0x01e7 }, + { 0x0014, 0x01e8 }, + { 0x0014, 0x01e9 }, + { 0x0014, 0x01ea }, + { 0x0014, 0x01eb }, + { 0x0014, 0x01ec }, + { 0x0014, 0x01ed }, + { 0x0014, 0x01ee }, + { 0x0014, 0x01ef }, + { 0x0014, 0x01f0 }, + { 0x0014, 0x01f1 }, + { 0x0014, 0x01f2 }, + { 0x0014, 0x01f3 }, + { 0x0014, 0x01f4 }, + { 0x0014, 0x01f5 }, + { 0x0014, 0x01f6 }, + { 0x0014, 0x01f7 }, + { 0x0014, 0x01f8 }, + { 0x0014, 0x01f9 }, + { 0x0014, 0x01fa }, + { 0x0014, 0x01fb }, + { 0x0014, 0x01fc }, + { 0x0014, 0x01fd }, + { 0x0014, 0x01fe }, + { 0x0014, 0x01ff }, + { 0x0014, 0x0200 }, + { 0x0014, 0x0201 }, + { 0x0014, 0x0202 }, + { 0x0014, 0x0203 }, + { 0x0014, 0x0204 }, + { 0x0014, 0x0205 }, + { 0x0014, 0x0206 }, + { 0x0014, 0x0207 }, + { 0x0014, 0x0208 }, + { 0x0014, 0x0209 }, + { 0x0014, 0x020a }, + { 0x0014, 0x020b }, + { 0x0014, 0x020c }, + { 0x0014, 0x020d }, + { 0x0014, 0x020e }, + { 0x0014, 0x020f }, + { 0x0014, 0x0210 }, + { 0x0014, 0x0211 }, + { 0x0014, 0x0212 }, + { 0x0014, 0x0213 }, + { 0x0014, 0x0214 }, + { 0x0014, 0x0215 }, + { 0x0013, 0x0117 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec16[85][16] = -{ - {0x000fffff, 0x000dffff, 0x000effff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0000001c, }, - {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, - {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, - {0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, 0x0003006e, }, - {0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020003, 0x00020003, 0x00020003, 0x00020003, }, - {0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020036, 0x00020036, 0x00020036, 0x00020036, }, - {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, - {0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020088, 0x00020088, 0x00020088, 0x00020088, }, - {0x00020089, 0x00020089, 0x00020089, 0x00020089, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, }, - {0x000000bd, 0x000000c0, 0x000000c1, 0x000000d9, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010022, 0x00010022, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x00010057, 0x00010057, }, - {0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010087, 0x00010087, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x000100a2, 0x000100a2, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, }, - {0x0019ffff, 0x0017ffff, 0x0018ffff, 0x0015ffff, 0x0016ffff, 0x0012ffff, 0x0010ffff, 0x0011ffff, 0x0013ffff, 0x0014ffff, 0x00000007, 0x00000023, 0x00000058, 0x00000073, 0x0000008d, 0x000000a7, }, - {0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, }, - {0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, 0x000300a8, }, - {0x000200f5, 0x000200f5, 0x000200f5, 0x000200f5, 0x000200f6, 0x000200f6, 0x000200f6, 0x000200f6, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300c2, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, 0x000300d8, }, - {0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300da, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, }, - {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, }, - {0x000200c3, 0x000200c3, 0x000200c3, 0x000200c3, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dc, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200f4, 0x000200f4, 0x000200f4, 0x000200f4, }, - {0x0000005b, 0x00000076, 0x00000090, 0x000000c5, 0x000000df, 0x000000f8, 0x0000010e, 0x00000110, 0x00000111, 0x00000112, 0x00010009, 0x00010009, 0x00010025, 0x00010025, 0x0001005a, 0x0001005a, }, - {0x00010075, 0x00010075, 0x0001008f, 0x0001008f, 0x000100aa, 0x000100aa, 0x000100c4, 0x000100c4, 0x000100de, 0x000100de, 0x000100f3, 0x000100f3, 0x000100f7, 0x000100f7, 0x0001010f, 0x0001010f, }, - {0x0032ffff, 0x0043ffff, 0x0025ffff, 0x0023ffff, 0x0024ffff, 0x0021ffff, 0x0020ffff, 0x0022ffff, 0x001cffff, 0x001affff, 0x001bffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0000000a, 0x00000040, }, - {0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, }, - {0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, }, - {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, }, - {0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300f9, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, }, - {0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x00030113, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, }, - {0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012b, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, }, - {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200c6, 0x000200c6, 0x000200c6, 0x000200c6, }, - {0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010149, 0x00010149, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, - {0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x00020114, 0x00020114, 0x00020114, 0x00020114, 0x00020129, 0x00020129, 0x00020129, 0x00020129, 0x0002012d, 0x0002012d, 0x0002012d, 0x0002012d, }, - {0x000000c8, 0x000000fc, 0x00000130, 0x00000131, 0x00000148, 0x00000160, 0x00000161, 0x00000162, 0x00010028, 0x00010028, 0x00010042, 0x00010042, 0x0001005d, 0x0001005d, 0x000100ad, 0x000100ad, }, - {0x000100c7, 0x000100c7, 0x000100e2, 0x000100e2, 0x000100fb, 0x000100fb, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010144, 0x00010144, }, - {0x0054ffff, 0x0031ffff, 0x0030ffff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0027ffff, 0x0026ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x0000000c, 0x00000078, 0x00000093, }, - {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, 0x000300af, }, - {0x0002017c, 0x0002017c, 0x0002017c, 0x0002017c, 0x00020180, 0x00020180, 0x00020180, 0x00020180, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x00030117, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, 0x0003014a, }, - {0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x0003015f, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, 0x00030163, }, - {0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017b, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, 0x0003017e, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020045, 0x00020045, 0x00020045, 0x00020045, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, - {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200e4, 0x000200e4, 0x000200e4, 0x000200e4, }, - {0x000200e5, 0x000200e5, 0x000200e5, 0x000200e5, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fe, 0x000200fe, 0x000200fe, 0x000200fe, 0x00020118, 0x00020118, 0x00020118, 0x00020118, }, - {0x00020132, 0x00020132, 0x00020132, 0x00020132, 0x0002014b, 0x0002014b, 0x0002014b, 0x0002014b, 0x0002014c, 0x0002014c, 0x0002014c, 0x0002014c, 0x0002014d, 0x0002014d, 0x0002014d, 0x0002014d, }, - {0x00020164, 0x00020164, 0x00020164, 0x00020164, 0x00020165, 0x00020165, 0x00020165, 0x00020165, 0x00020166, 0x00020166, 0x00020166, 0x00020166, 0x0002017a, 0x0002017a, 0x0002017a, 0x0002017a, }, - {0x000100e3, 0x000100e3, 0x00010100, 0x00010100, 0x00010133, 0x00010133, 0x0001014f, 0x0001014f, 0x0001017f, 0x0001017f, 0x00010182, 0x00010182, 0x000101e7, 0x000101e7, 0x000102d8, 0x000102d8, }, - {0x000002d2, 0x000002d3, 0x000002d4, 0x000002d5, 0x000002d6, 0x000002d7, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x000100ae, 0x000100ae, }, - {0x0034ffff, 0x0033ffff, 0x0035ffff, 0x0036ffff, 0x0039ffff, 0x0037ffff, 0x0038ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, }, - {0x0000002f, 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, }, - {0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, }, - {0x0000004f, 0x00000050, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006a, 0x0000006b, 0x0000007c, }, - {0x0000007d, 0x0000007e, 0x0000007f, 0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, }, - {0x000000b9, 0x000000ba, 0x000000bb, 0x000000bc, 0x000000ca, 0x000000cb, 0x000000cc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, }, - {0x000000d6, 0x000000d7, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000ff, }, - {0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, 0x000000a1, 0x000000b0, 0x000000b1, 0x000000b2, 0x000000b3, 0x000000b4, 0x000000b5, 0x000000b6, 0x000000b7, 0x000000b8, }, - {0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, 0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x00000119, 0x0000011a, 0x0000011b, }, - {0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, 0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000134, 0x00000135, 0x00000136, }, - {0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, 0x0000013e, 0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x0000014e, 0x00000150, 0x00000151, }, - {0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, 0x0000015c, 0x0000015d, 0x0000015e, 0x00000167, 0x00000168, 0x00000169, }, - {0x0000016a, 0x0000016b, 0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, 0x00000176, 0x00000177, 0x00000178, 0x00000179, }, - {0x0000017d, 0x00000181, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, 0x0000018f, 0x00000190, }, - {0x00000191, 0x00000192, 0x00000193, 0x00000194, 0x00000195, 0x00000196, 0x00000197, 0x00000198, 0x00000199, 0x0000019a, 0x0000019b, 0x0000019c, 0x0000019d, 0x0000019e, 0x0000019f, 0x000001a0, }, - {0x000001a1, 0x000001a2, 0x000001a3, 0x000001a4, 0x000001a5, 0x000001a6, 0x000001a7, 0x000001a8, 0x000001a9, 0x000001aa, 0x000001ab, 0x000001ac, 0x000001ad, 0x000001ae, 0x000001af, 0x000001b0, }, - {0x000001b1, 0x000001b2, 0x000001b3, 0x000001b4, 0x000001b5, 0x000001b6, 0x000001b7, 0x000001b8, 0x000001b9, 0x000001ba, 0x000001bb, 0x000001bc, 0x000001bd, 0x000001be, 0x000001bf, 0x000001c0, }, - {0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, }, - {0x000001c1, 0x000001c2, 0x000001c3, 0x000001c4, 0x000001c5, 0x000001c6, 0x000001c7, 0x000001c8, 0x000001c9, 0x000001ca, 0x000001cb, 0x000001cc, 0x000001cd, 0x000001ce, 0x000001cf, 0x000001d0, }, - {0x000001d1, 0x000001d2, 0x000001d3, 0x000001d4, 0x000001d5, 0x000001d6, 0x000001d7, 0x000001d8, 0x000001d9, 0x000001da, 0x000001db, 0x000001dc, 0x000001dd, 0x000001de, 0x000001df, 0x000001e0, }, - {0x000001e1, 0x000001e2, 0x000001e3, 0x000001e4, 0x000001e5, 0x000001e6, 0x000001e8, 0x000001e9, 0x000001ea, 0x000001eb, 0x000001ec, 0x000001ed, 0x000001ee, 0x000001ef, 0x000001f0, 0x000001f1, }, - {0x000001f2, 0x000001f3, 0x000001f4, 0x000001f5, 0x000001f6, 0x000001f7, 0x000001f8, 0x000001f9, 0x000001fa, 0x000001fb, 0x000001fc, 0x000001fd, 0x000001fe, 0x000001ff, 0x00000200, 0x00000201, }, - {0x00000202, 0x00000203, 0x00000204, 0x00000205, 0x00000206, 0x00000207, 0x00000208, 0x00000209, 0x0000020a, 0x0000020b, 0x0000020c, 0x0000020d, 0x0000020e, 0x0000020f, 0x00000210, 0x00000211, }, - {0x00000212, 0x00000213, 0x00000214, 0x00000215, 0x00000216, 0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, 0x0000021e, 0x0000021f, 0x00000220, 0x00000221, }, - {0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, 0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, 0x0000022e, 0x0000022f, 0x00000230, 0x00000231, }, - {0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, 0x00000237, 0x00000238, 0x00000239, 0x0000023a, 0x0000023b, 0x0000023c, 0x0000023d, 0x0000023e, 0x0000023f, 0x00000240, 0x00000241, }, - {0x00000242, 0x00000243, 0x00000244, 0x00000245, 0x00000246, 0x00000247, 0x00000248, 0x00000249, 0x0000024a, 0x0000024b, 0x0000024c, 0x0000024d, 0x0000024e, 0x0000024f, 0x00000250, 0x00000251, }, - {0x00000252, 0x00000253, 0x00000254, 0x00000255, 0x00000256, 0x00000257, 0x00000258, 0x00000259, 0x0000025a, 0x0000025b, 0x0000025c, 0x0000025d, 0x0000025e, 0x0000025f, 0x00000260, 0x00000261, }, - {0x00000262, 0x00000263, 0x00000264, 0x00000265, 0x00000266, 0x00000267, 0x00000268, 0x00000269, 0x0000026a, 0x0000026b, 0x0000026c, 0x0000026d, 0x0000026e, 0x0000026f, 0x00000270, 0x00000271, }, - {0x00000272, 0x00000273, 0x00000274, 0x00000275, 0x00000276, 0x00000277, 0x00000278, 0x00000279, 0x0000027a, 0x0000027b, 0x0000027c, 0x0000027d, 0x0000027e, 0x0000027f, 0x00000280, 0x00000281, }, - {0x00000282, 0x00000283, 0x00000284, 0x00000285, 0x00000286, 0x00000287, 0x00000288, 0x00000289, 0x0000028a, 0x0000028b, 0x0000028c, 0x0000028d, 0x0000028e, 0x0000028f, 0x00000290, 0x00000291, }, - {0x00000292, 0x00000293, 0x00000294, 0x00000295, 0x00000296, 0x00000297, 0x00000298, 0x00000299, 0x0000029a, 0x0000029b, 0x0000029c, 0x0000029d, 0x0000029e, 0x0000029f, 0x000002a0, 0x000002a1, }, - {0x000002a2, 0x000002a3, 0x000002a4, 0x000002a5, 0x000002a6, 0x000002a7, 0x000002a8, 0x000002a9, 0x000002aa, 0x000002ab, 0x000002ac, 0x000002ad, 0x000002ae, 0x000002af, 0x000002b0, 0x000002b1, }, - {0x000002b2, 0x000002b3, 0x000002b4, 0x000002b5, 0x000002b6, 0x000002b7, 0x000002b8, 0x000002b9, 0x000002ba, 0x000002bb, 0x000002bc, 0x000002bd, 0x000002be, 0x000002bf, 0x000002c0, 0x000002c1, }, - {0x000002c2, 0x000002c3, 0x000002c4, 0x000002c5, 0x000002c6, 0x000002c7, 0x000002c8, 0x000002c9, 0x000002ca, 0x000002cb, 0x000002cc, 0x000002cd, 0x000002ce, 0x000002cf, 0x000002d0, 0x000002d1, }, +const uint32_t c_aauiCQMFHuffDec16[85][16] = { + { + 0x000fffff, + 0x000dffff, + 0x000effff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0000001c, + }, + { + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + }, + { + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + }, + { + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + }, + { + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + }, + { + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006e, + 0x0003006e, + 0x0003006e, + 0x0003006e, + 0x0003006e, + 0x0003006e, + 0x0003006e, + 0x0003006e, + }, + { + 0x000100be, + 0x000100be, + 0x000100bf, + 0x000100bf, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + }, + { + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + }, + { + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + }, + { + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020088, + }, + { + 0x00020089, + 0x00020089, + 0x00020089, + 0x00020089, + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a4, + }, + { + 0x000000bd, + 0x000000c0, + 0x000000c1, + 0x000000d9, + 0x00010005, + 0x00010005, + 0x00010006, + 0x00010006, + 0x00010022, + 0x00010022, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x00010057, + 0x00010057, + }, + { + 0x00010071, + 0x00010071, + 0x00010072, + 0x00010072, + 0x00010087, + 0x00010087, + 0x0001008b, + 0x0001008b, + 0x0001008c, + 0x0001008c, + 0x000100a2, + 0x000100a2, + 0x000100a5, + 0x000100a5, + 0x000100a6, + 0x000100a6, + }, + { + 0x0019ffff, + 0x0017ffff, + 0x0018ffff, + 0x0015ffff, + 0x0016ffff, + 0x0012ffff, + 0x0010ffff, + 0x0011ffff, + 0x0013ffff, + 0x0014ffff, + 0x00000007, + 0x00000023, + 0x00000058, + 0x00000073, + 0x0000008d, + 0x000000a7, + }, + { + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + }, + { + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + 0x000300a8, + }, + { + 0x000200f5, + 0x000200f5, + 0x000200f5, + 0x000200f5, + 0x000200f6, + 0x000200f6, + 0x000200f6, + 0x000200f6, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300c2, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + 0x000300d8, + }, + { + 0x000300da, + 0x000300da, + 0x000300da, + 0x000300da, + 0x000300da, + 0x000300da, + 0x000300da, + 0x000300da, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + }, + { + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + 0x000200a9, + 0x000200a9, + 0x000200a9, + 0x000200a9, + }, + { + 0x000200c3, + 0x000200c3, + 0x000200c3, + 0x000200c3, + 0x000200dc, + 0x000200dc, + 0x000200dc, + 0x000200dc, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200f4, + 0x000200f4, + 0x000200f4, + 0x000200f4, + }, + { + 0x0000005b, + 0x00000076, + 0x00000090, + 0x000000c5, + 0x000000df, + 0x000000f8, + 0x0000010e, + 0x00000110, + 0x00000111, + 0x00000112, + 0x00010009, + 0x00010009, + 0x00010025, + 0x00010025, + 0x0001005a, + 0x0001005a, + }, + { + 0x00010075, + 0x00010075, + 0x0001008f, + 0x0001008f, + 0x000100aa, + 0x000100aa, + 0x000100c4, + 0x000100c4, + 0x000100de, + 0x000100de, + 0x000100f3, + 0x000100f3, + 0x000100f7, + 0x000100f7, + 0x0001010f, + 0x0001010f, + }, + { + 0x0032ffff, + 0x0043ffff, + 0x0025ffff, + 0x0023ffff, + 0x0024ffff, + 0x0021ffff, + 0x0020ffff, + 0x0022ffff, + 0x001cffff, + 0x001affff, + 0x001bffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0000000a, + 0x00000040, + }, + { + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + }, + { + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + }, + { + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + }, + { + 0x000300f9, + 0x000300f9, + 0x000300f9, + 0x000300f9, + 0x000300f9, + 0x000300f9, + 0x000300f9, + 0x000300f9, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + }, + { + 0x00030113, + 0x00030113, + 0x00030113, + 0x00030113, + 0x00030113, + 0x00030113, + 0x00030113, + 0x00030113, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + }, + { + 0x0003012b, + 0x0003012b, + 0x0003012b, + 0x0003012b, + 0x0003012b, + 0x0003012b, + 0x0003012b, + 0x0003012b, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + }, + { + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200c6, + 0x000200c6, + 0x000200c6, + 0x000200c6, + }, + { + 0x00010145, + 0x00010145, + 0x00010146, + 0x00010146, + 0x00010147, + 0x00010147, + 0x00010149, + 0x00010149, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + }, + { + 0x000200e1, + 0x000200e1, + 0x000200e1, + 0x000200e1, + 0x00020114, + 0x00020114, + 0x00020114, + 0x00020114, + 0x00020129, + 0x00020129, + 0x00020129, + 0x00020129, + 0x0002012d, + 0x0002012d, + 0x0002012d, + 0x0002012d, + }, + { + 0x000000c8, + 0x000000fc, + 0x00000130, + 0x00000131, + 0x00000148, + 0x00000160, + 0x00000161, + 0x00000162, + 0x00010028, + 0x00010028, + 0x00010042, + 0x00010042, + 0x0001005d, + 0x0001005d, + 0x000100ad, + 0x000100ad, + }, + { + 0x000100c7, + 0x000100c7, + 0x000100e2, + 0x000100e2, + 0x000100fb, + 0x000100fb, + 0x00010115, + 0x00010115, + 0x00010116, + 0x00010116, + 0x0001012e, + 0x0001012e, + 0x0001012f, + 0x0001012f, + 0x00010144, + 0x00010144, + }, + { + 0x0054ffff, + 0x0031ffff, + 0x0030ffff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + 0x0027ffff, + 0x0026ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x0000000c, + 0x00000078, + 0x00000093, + }, + { + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + 0x000300af, + }, + { + 0x0002017c, + 0x0002017c, + 0x0002017c, + 0x0002017c, + 0x00020180, + 0x00020180, + 0x00020180, + 0x00020180, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x00030117, + 0x00030117, + 0x00030117, + 0x00030117, + 0x00030117, + 0x00030117, + 0x00030117, + 0x00030117, + 0x0003014a, + 0x0003014a, + 0x0003014a, + 0x0003014a, + 0x0003014a, + 0x0003014a, + 0x0003014a, + 0x0003014a, + }, + { + 0x0003015f, + 0x0003015f, + 0x0003015f, + 0x0003015f, + 0x0003015f, + 0x0003015f, + 0x0003015f, + 0x0003015f, + 0x00030163, + 0x00030163, + 0x00030163, + 0x00030163, + 0x00030163, + 0x00030163, + 0x00030163, + 0x00030163, + }, + { + 0x0003017b, + 0x0003017b, + 0x0003017b, + 0x0003017b, + 0x0003017b, + 0x0003017b, + 0x0003017b, + 0x0003017b, + 0x0003017e, + 0x0003017e, + 0x0003017e, + 0x0003017e, + 0x0003017e, + 0x0003017e, + 0x0003017e, + 0x0003017e, + }, + { + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020045, + 0x00020045, + 0x00020045, + 0x00020045, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005e, + }, + { + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020094, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200e4, + 0x000200e4, + 0x000200e4, + 0x000200e4, + }, + { + 0x000200e5, + 0x000200e5, + 0x000200e5, + 0x000200e5, + 0x000200fd, + 0x000200fd, + 0x000200fd, + 0x000200fd, + 0x000200fe, + 0x000200fe, + 0x000200fe, + 0x000200fe, + 0x00020118, + 0x00020118, + 0x00020118, + 0x00020118, + }, + { + 0x00020132, + 0x00020132, + 0x00020132, + 0x00020132, + 0x0002014b, + 0x0002014b, + 0x0002014b, + 0x0002014b, + 0x0002014c, + 0x0002014c, + 0x0002014c, + 0x0002014c, + 0x0002014d, + 0x0002014d, + 0x0002014d, + 0x0002014d, + }, + { + 0x00020164, + 0x00020164, + 0x00020164, + 0x00020164, + 0x00020165, + 0x00020165, + 0x00020165, + 0x00020165, + 0x00020166, + 0x00020166, + 0x00020166, + 0x00020166, + 0x0002017a, + 0x0002017a, + 0x0002017a, + 0x0002017a, + }, + { + 0x000100e3, + 0x000100e3, + 0x00010100, + 0x00010100, + 0x00010133, + 0x00010133, + 0x0001014f, + 0x0001014f, + 0x0001017f, + 0x0001017f, + 0x00010182, + 0x00010182, + 0x000101e7, + 0x000101e7, + 0x000102d8, + 0x000102d8, + }, + { + 0x000002d2, + 0x000002d3, + 0x000002d4, + 0x000002d5, + 0x000002d6, + 0x000002d7, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001007a, + 0x0001007a, + 0x0001007b, + 0x0001007b, + 0x000100ae, + 0x000100ae, + }, + { + 0x0034ffff, + 0x0033ffff, + 0x0035ffff, + 0x0036ffff, + 0x0039ffff, + 0x0037ffff, + 0x0038ffff, + 0x003affff, + 0x003bffff, + 0x003cffff, + 0x003dffff, + 0x003effff, + 0x003fffff, + 0x0040ffff, + 0x0041ffff, + 0x0042ffff, + }, + { + 0x0000002f, + 0x00000030, + 0x00000031, + 0x00000032, + 0x00000033, + 0x00000034, + 0x00000035, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000049, + 0x0000004a, + 0x0000004b, + 0x0000004c, + 0x0000004d, + 0x0000004e, + }, + { + 0x0000000f, + 0x00000010, + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000018, + 0x00000019, + 0x0000001a, + 0x0000002b, + 0x0000002c, + 0x0000002d, + 0x0000002e, + }, + { + 0x0000004f, + 0x00000050, + 0x0000005f, + 0x00000060, + 0x00000061, + 0x00000062, + 0x00000063, + 0x00000064, + 0x00000065, + 0x00000066, + 0x00000067, + 0x00000068, + 0x00000069, + 0x0000006a, + 0x0000006b, + 0x0000007c, + }, + { + 0x0000007d, + 0x0000007e, + 0x0000007f, + 0x00000080, + 0x00000081, + 0x00000082, + 0x00000083, + 0x00000084, + 0x00000085, + 0x00000086, + 0x00000095, + 0x00000096, + 0x00000097, + 0x00000098, + 0x00000099, + 0x0000009a, + }, + { + 0x000000b9, + 0x000000ba, + 0x000000bb, + 0x000000bc, + 0x000000ca, + 0x000000cb, + 0x000000cc, + 0x000000cd, + 0x000000ce, + 0x000000cf, + 0x000000d0, + 0x000000d1, + 0x000000d2, + 0x000000d3, + 0x000000d4, + 0x000000d5, + }, + { + 0x000000d6, + 0x000000d7, + 0x000000e6, + 0x000000e7, + 0x000000e8, + 0x000000e9, + 0x000000ea, + 0x000000eb, + 0x000000ec, + 0x000000ed, + 0x000000ee, + 0x000000ef, + 0x000000f0, + 0x000000f1, + 0x000000f2, + 0x000000ff, + }, + { + 0x0000009b, + 0x0000009c, + 0x0000009d, + 0x0000009e, + 0x0000009f, + 0x000000a0, + 0x000000a1, + 0x000000b0, + 0x000000b1, + 0x000000b2, + 0x000000b3, + 0x000000b4, + 0x000000b5, + 0x000000b6, + 0x000000b7, + 0x000000b8, + }, + { + 0x00000101, + 0x00000102, + 0x00000103, + 0x00000104, + 0x00000105, + 0x00000106, + 0x00000107, + 0x00000108, + 0x00000109, + 0x0000010a, + 0x0000010b, + 0x0000010c, + 0x0000010d, + 0x00000119, + 0x0000011a, + 0x0000011b, + }, + { + 0x0000011c, + 0x0000011d, + 0x0000011e, + 0x0000011f, + 0x00000120, + 0x00000121, + 0x00000122, + 0x00000123, + 0x00000124, + 0x00000125, + 0x00000126, + 0x00000127, + 0x00000128, + 0x00000134, + 0x00000135, + 0x00000136, + }, + { + 0x00000137, + 0x00000138, + 0x00000139, + 0x0000013a, + 0x0000013b, + 0x0000013c, + 0x0000013d, + 0x0000013e, + 0x0000013f, + 0x00000140, + 0x00000141, + 0x00000142, + 0x00000143, + 0x0000014e, + 0x00000150, + 0x00000151, + }, + { + 0x00000152, + 0x00000153, + 0x00000154, + 0x00000155, + 0x00000156, + 0x00000157, + 0x00000158, + 0x00000159, + 0x0000015a, + 0x0000015b, + 0x0000015c, + 0x0000015d, + 0x0000015e, + 0x00000167, + 0x00000168, + 0x00000169, + }, + { + 0x0000016a, + 0x0000016b, + 0x0000016c, + 0x0000016d, + 0x0000016e, + 0x0000016f, + 0x00000170, + 0x00000171, + 0x00000172, + 0x00000173, + 0x00000174, + 0x00000175, + 0x00000176, + 0x00000177, + 0x00000178, + 0x00000179, + }, + { + 0x0000017d, + 0x00000181, + 0x00000183, + 0x00000184, + 0x00000185, + 0x00000186, + 0x00000187, + 0x00000188, + 0x00000189, + 0x0000018a, + 0x0000018b, + 0x0000018c, + 0x0000018d, + 0x0000018e, + 0x0000018f, + 0x00000190, + }, + { + 0x00000191, + 0x00000192, + 0x00000193, + 0x00000194, + 0x00000195, + 0x00000196, + 0x00000197, + 0x00000198, + 0x00000199, + 0x0000019a, + 0x0000019b, + 0x0000019c, + 0x0000019d, + 0x0000019e, + 0x0000019f, + 0x000001a0, + }, + { + 0x000001a1, + 0x000001a2, + 0x000001a3, + 0x000001a4, + 0x000001a5, + 0x000001a6, + 0x000001a7, + 0x000001a8, + 0x000001a9, + 0x000001aa, + 0x000001ab, + 0x000001ac, + 0x000001ad, + 0x000001ae, + 0x000001af, + 0x000001b0, + }, + { + 0x000001b1, + 0x000001b2, + 0x000001b3, + 0x000001b4, + 0x000001b5, + 0x000001b6, + 0x000001b7, + 0x000001b8, + 0x000001b9, + 0x000001ba, + 0x000001bb, + 0x000001bc, + 0x000001bd, + 0x000001be, + 0x000001bf, + 0x000001c0, + }, + { + 0x0044ffff, + 0x0045ffff, + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x0049ffff, + 0x004affff, + 0x004bffff, + 0x004cffff, + 0x004dffff, + 0x004effff, + 0x004fffff, + 0x0050ffff, + 0x0051ffff, + 0x0052ffff, + 0x0053ffff, + }, + { + 0x000001c1, + 0x000001c2, + 0x000001c3, + 0x000001c4, + 0x000001c5, + 0x000001c6, + 0x000001c7, + 0x000001c8, + 0x000001c9, + 0x000001ca, + 0x000001cb, + 0x000001cc, + 0x000001cd, + 0x000001ce, + 0x000001cf, + 0x000001d0, + }, + { + 0x000001d1, + 0x000001d2, + 0x000001d3, + 0x000001d4, + 0x000001d5, + 0x000001d6, + 0x000001d7, + 0x000001d8, + 0x000001d9, + 0x000001da, + 0x000001db, + 0x000001dc, + 0x000001dd, + 0x000001de, + 0x000001df, + 0x000001e0, + }, + { + 0x000001e1, + 0x000001e2, + 0x000001e3, + 0x000001e4, + 0x000001e5, + 0x000001e6, + 0x000001e8, + 0x000001e9, + 0x000001ea, + 0x000001eb, + 0x000001ec, + 0x000001ed, + 0x000001ee, + 0x000001ef, + 0x000001f0, + 0x000001f1, + }, + { + 0x000001f2, + 0x000001f3, + 0x000001f4, + 0x000001f5, + 0x000001f6, + 0x000001f7, + 0x000001f8, + 0x000001f9, + 0x000001fa, + 0x000001fb, + 0x000001fc, + 0x000001fd, + 0x000001fe, + 0x000001ff, + 0x00000200, + 0x00000201, + }, + { + 0x00000202, + 0x00000203, + 0x00000204, + 0x00000205, + 0x00000206, + 0x00000207, + 0x00000208, + 0x00000209, + 0x0000020a, + 0x0000020b, + 0x0000020c, + 0x0000020d, + 0x0000020e, + 0x0000020f, + 0x00000210, + 0x00000211, + }, + { + 0x00000212, + 0x00000213, + 0x00000214, + 0x00000215, + 0x00000216, + 0x00000217, + 0x00000218, + 0x00000219, + 0x0000021a, + 0x0000021b, + 0x0000021c, + 0x0000021d, + 0x0000021e, + 0x0000021f, + 0x00000220, + 0x00000221, + }, + { + 0x00000222, + 0x00000223, + 0x00000224, + 0x00000225, + 0x00000226, + 0x00000227, + 0x00000228, + 0x00000229, + 0x0000022a, + 0x0000022b, + 0x0000022c, + 0x0000022d, + 0x0000022e, + 0x0000022f, + 0x00000230, + 0x00000231, + }, + { + 0x00000232, + 0x00000233, + 0x00000234, + 0x00000235, + 0x00000236, + 0x00000237, + 0x00000238, + 0x00000239, + 0x0000023a, + 0x0000023b, + 0x0000023c, + 0x0000023d, + 0x0000023e, + 0x0000023f, + 0x00000240, + 0x00000241, + }, + { + 0x00000242, + 0x00000243, + 0x00000244, + 0x00000245, + 0x00000246, + 0x00000247, + 0x00000248, + 0x00000249, + 0x0000024a, + 0x0000024b, + 0x0000024c, + 0x0000024d, + 0x0000024e, + 0x0000024f, + 0x00000250, + 0x00000251, + }, + { + 0x00000252, + 0x00000253, + 0x00000254, + 0x00000255, + 0x00000256, + 0x00000257, + 0x00000258, + 0x00000259, + 0x0000025a, + 0x0000025b, + 0x0000025c, + 0x0000025d, + 0x0000025e, + 0x0000025f, + 0x00000260, + 0x00000261, + }, + { + 0x00000262, + 0x00000263, + 0x00000264, + 0x00000265, + 0x00000266, + 0x00000267, + 0x00000268, + 0x00000269, + 0x0000026a, + 0x0000026b, + 0x0000026c, + 0x0000026d, + 0x0000026e, + 0x0000026f, + 0x00000270, + 0x00000271, + }, + { + 0x00000272, + 0x00000273, + 0x00000274, + 0x00000275, + 0x00000276, + 0x00000277, + 0x00000278, + 0x00000279, + 0x0000027a, + 0x0000027b, + 0x0000027c, + 0x0000027d, + 0x0000027e, + 0x0000027f, + 0x00000280, + 0x00000281, + }, + { + 0x00000282, + 0x00000283, + 0x00000284, + 0x00000285, + 0x00000286, + 0x00000287, + 0x00000288, + 0x00000289, + 0x0000028a, + 0x0000028b, + 0x0000028c, + 0x0000028d, + 0x0000028e, + 0x0000028f, + 0x00000290, + 0x00000291, + }, + { + 0x00000292, + 0x00000293, + 0x00000294, + 0x00000295, + 0x00000296, + 0x00000297, + 0x00000298, + 0x00000299, + 0x0000029a, + 0x0000029b, + 0x0000029c, + 0x0000029d, + 0x0000029e, + 0x0000029f, + 0x000002a0, + 0x000002a1, + }, + { + 0x000002a2, + 0x000002a3, + 0x000002a4, + 0x000002a5, + 0x000002a6, + 0x000002a7, + 0x000002a8, + 0x000002a9, + 0x000002aa, + 0x000002ab, + 0x000002ac, + 0x000002ad, + 0x000002ae, + 0x000002af, + 0x000002b0, + 0x000002b1, + }, + { + 0x000002b2, + 0x000002b3, + 0x000002b4, + 0x000002b5, + 0x000002b6, + 0x000002b7, + 0x000002b8, + 0x000002b9, + 0x000002ba, + 0x000002bb, + 0x000002bc, + 0x000002bd, + 0x000002be, + 0x000002bf, + 0x000002c0, + 0x000002c1, + }, + { + 0x000002c2, + 0x000002c3, + 0x000002c4, + 0x000002c5, + 0x000002c6, + 0x000002c7, + 0x000002c8, + 0x000002c9, + 0x000002ca, + 0x000002cb, + 0x000002cc, + 0x000002cd, + 0x000002ce, + 0x000002cf, + 0x000002d0, + 0x000002d1, + }, }; #endif @@ -1435,198 +14376,2415 @@ const uint32_t c_aauiCQMFHuffEnc17[729][2] = #else const uint16_t c_aauiCQMFHuffEnc17[729][2] = #endif -{ - {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x000e}, - {0x0008, 0x000f}, {0x0009, 0x000f}, {0x000a, 0x000f}, {0x000c, 0x0011}, {0x000d, 0x0014}, {0x000e, 0x0017}, {0x0010, 0x002d}, {0x0011, 0x004c}, - {0x0012, 0x008a}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, - {0x0014, 0x0007}, {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0006, 0x0016}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0006, 0x0017}, - {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0008, 0x0010}, {0x000a, 0x0010}, {0x000b, 0x0011}, {0x000c, 0x0012}, - {0x000e, 0x0018}, {0x000f, 0x0020}, {0x0011, 0x004d}, {0x0013, 0x00e4}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, - {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0006, 0x001a}, {0x0005, 0x001b}, - {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0007, 0x0014}, {0x0008, 0x0011}, {0x0009, 0x0010}, - {0x000a, 0x0011}, {0x000b, 0x0012}, {0x000c, 0x0013}, {0x000e, 0x0019}, {0x000f, 0x0021}, {0x0010, 0x002e}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, - {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, - {0x0014, 0x001c}, {0x0006, 0x001e}, {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, - {0x0007, 0x0015}, {0x0008, 0x0012}, {0x0009, 0x0011}, {0x000a, 0x0012}, {0x000b, 0x0013}, {0x000c, 0x0014}, {0x000e, 0x001a}, {0x000f, 0x0022}, - {0x0010, 0x002f}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0014, 0x001d}, {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, - {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, {0x0014, 0x0025}, {0x0006, 0x0023}, {0x0006, 0x0024}, {0x0006, 0x0025}, {0x0006, 0x0026}, - {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0007, 0x0016}, {0x0007, 0x0017}, {0x0008, 0x0013}, {0x0009, 0x0012}, {0x000a, 0x0013}, {0x000c, 0x0015}, - {0x000d, 0x0015}, {0x000f, 0x0023}, {0x0010, 0x0030}, {0x0011, 0x004e}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x0014, 0x0029}, - {0x0014, 0x002a}, {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0007, 0x0018}, - {0x0006, 0x0029}, {0x0006, 0x002a}, {0x0006, 0x002b}, {0x0006, 0x002c}, {0x0007, 0x0019}, {0x0007, 0x001a}, {0x0008, 0x0014}, {0x0009, 0x0013}, - {0x000a, 0x0014}, {0x000b, 0x0014}, {0x000c, 0x0016}, {0x000d, 0x0016}, {0x000f, 0x0024}, {0x0010, 0x0031}, {0x0011, 0x004f}, {0x0014, 0x0031}, - {0x0014, 0x0032}, {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, {0x0014, 0x0039}, - {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0007, 0x001b}, {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0007, 0x001c}, {0x0007, 0x001d}, - {0x0008, 0x0015}, {0x0009, 0x0014}, {0x000a, 0x0015}, {0x000a, 0x0016}, {0x000c, 0x0017}, {0x000d, 0x0017}, {0x000e, 0x001b}, {0x000f, 0x0025}, - {0x0011, 0x0050}, {0x0011, 0x0051}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, - {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, {0x0014, 0x0046}, {0x0008, 0x0016}, {0x0007, 0x001e}, {0x0007, 0x001f}, - {0x0007, 0x0020}, {0x0007, 0x0021}, {0x0008, 0x0017}, {0x0008, 0x0018}, {0x0009, 0x0015}, {0x000a, 0x0017}, {0x000b, 0x0015}, {0x000c, 0x0018}, - {0x000e, 0x001c}, {0x000e, 0x001d}, {0x0010, 0x0032}, {0x0012, 0x008b}, {0x0012, 0x008c}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, - {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, - {0x0008, 0x0019}, {0x0007, 0x0022}, {0x0007, 0x0023}, {0x0008, 0x001a}, {0x0008, 0x001b}, {0x0009, 0x0016}, {0x0009, 0x0017}, {0x000a, 0x0018}, - {0x000b, 0x0016}, {0x000c, 0x0019}, {0x000d, 0x0018}, {0x000e, 0x001e}, {0x0010, 0x0033}, {0x0011, 0x0052}, {0x0014, 0x0052}, {0x0013, 0x00e9}, - {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, - {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, {0x0009, 0x0018}, {0x0008, 0x001c}, {0x0008, 0x001d}, {0x0009, 0x0019}, {0x0009, 0x001a}, - {0x000a, 0x0019}, {0x000a, 0x001a}, {0x000b, 0x0017}, {0x000c, 0x001a}, {0x000d, 0x0019}, {0x000e, 0x001f}, {0x000f, 0x0026}, {0x0010, 0x0034}, - {0x0012, 0x008d}, {0x0013, 0x00ea}, {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, {0x0014, 0x0063}, - {0x0014, 0x0064}, {0x0014, 0x0065}, {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x000b, 0x0018}, {0x0009, 0x001b}, - {0x000a, 0x001b}, {0x000a, 0x001c}, {0x000a, 0x001d}, {0x000b, 0x0019}, {0x000b, 0x001a}, {0x000c, 0x001b}, {0x000d, 0x001a}, {0x000e, 0x0020}, - {0x000f, 0x0027}, {0x0012, 0x008e}, {0x0011, 0x0053}, {0x0013, 0x00eb}, {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, - {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, - {0x0014, 0x0076}, {0x000c, 0x001c}, {0x000b, 0x001b}, {0x000b, 0x001c}, {0x000b, 0x001d}, {0x000c, 0x001d}, {0x000c, 0x001e}, {0x000d, 0x001b}, - {0x000d, 0x001c}, {0x000e, 0x0021}, {0x0010, 0x0035}, {0x0010, 0x0036}, {0x0011, 0x0054}, {0x0013, 0x00ec}, {0x0014, 0x0077}, {0x0014, 0x0078}, - {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, - {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x000d, 0x001d}, {0x000c, 0x001f}, {0x000c, 0x0020}, {0x000c, 0x0021}, - {0x000d, 0x001e}, {0x000d, 0x001f}, {0x000e, 0x0022}, {0x000f, 0x0028}, {0x0010, 0x0037}, {0x0010, 0x0038}, {0x0010, 0x0039}, {0x0012, 0x008f}, - {0x0013, 0x00ed}, {0x0014, 0x0085}, {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, - {0x0014, 0x008c}, {0x0014, 0x008d}, {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x000e, 0x0023}, - {0x000d, 0x0020}, {0x000d, 0x0021}, {0x000e, 0x0024}, {0x000e, 0x0025}, {0x000e, 0x0026}, {0x000f, 0x0029}, {0x0010, 0x003a}, {0x0010, 0x003b}, - {0x0012, 0x0090}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, - {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, - {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x000f, 0x002a}, {0x000e, 0x0027}, {0x000f, 0x002b}, {0x000f, 0x002c}, {0x000f, 0x002d}, {0x0010, 0x003c}, - {0x0010, 0x003d}, {0x0011, 0x0055}, {0x0011, 0x0056}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, - {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0014, 0x00ad}, {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, - {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, {0x0012, 0x0091}, {0x0010, 0x003e}, {0x0010, 0x003f}, - {0x0011, 0x0057}, {0x0011, 0x0058}, {0x0011, 0x0059}, {0x0012, 0x0092}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0012, 0x0093}, {0x0014, 0x00b6}, - {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, {0x0014, 0x00be}, - {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, {0x0014, 0x00c6}, - {0x0013, 0x00f0}, {0x0012, 0x0094}, {0x0012, 0x0095}, {0x0012, 0x0096}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, - {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, - {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, - {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, {0x0014, 0x00de}, {0x0012, 0x0097}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, - {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, - {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, - {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, {0x0014, 0x00f6}, {0x0014, 0x00f7}, {0x0014, 0x00f8}, {0x0014, 0x00f9}, - {0x0014, 0x00fa}, {0x0014, 0x00fb}, {0x0014, 0x00fc}, {0x0014, 0x00fd}, {0x0014, 0x00fe}, {0x0014, 0x00ff}, {0x0014, 0x0100}, {0x0014, 0x0101}, - {0x0014, 0x0102}, {0x0014, 0x0103}, {0x0014, 0x0104}, {0x0014, 0x0105}, {0x0014, 0x0106}, {0x0014, 0x0107}, {0x0014, 0x0108}, {0x0014, 0x0109}, - {0x0014, 0x010a}, {0x0014, 0x010b}, {0x0014, 0x010c}, {0x0014, 0x010d}, {0x0014, 0x010e}, {0x0014, 0x010f}, {0x0014, 0x0110}, {0x0014, 0x0111}, - {0x0014, 0x0112}, {0x0014, 0x0113}, {0x0014, 0x0114}, {0x0014, 0x0115}, {0x0014, 0x0116}, {0x0014, 0x0117}, {0x0014, 0x0118}, {0x0014, 0x0119}, - {0x0014, 0x011a}, {0x0014, 0x011b}, {0x0014, 0x011c}, {0x0014, 0x011d}, {0x0014, 0x011e}, {0x0014, 0x011f}, {0x0014, 0x0120}, {0x0014, 0x0121}, - {0x0014, 0x0122}, {0x0014, 0x0123}, {0x0014, 0x0124}, {0x0014, 0x0125}, {0x0014, 0x0126}, {0x0014, 0x0127}, {0x0014, 0x0128}, {0x0014, 0x0129}, - {0x0014, 0x012a}, {0x0014, 0x012b}, {0x0014, 0x012c}, {0x0014, 0x012d}, {0x0014, 0x012e}, {0x0014, 0x012f}, {0x0014, 0x0130}, {0x0014, 0x0131}, - {0x0014, 0x0132}, {0x0014, 0x0133}, {0x0014, 0x0134}, {0x0014, 0x0135}, {0x0014, 0x0136}, {0x0014, 0x0137}, {0x0014, 0x0138}, {0x0014, 0x0139}, - {0x0014, 0x013a}, {0x0014, 0x013b}, {0x0014, 0x013c}, {0x0014, 0x013d}, {0x0014, 0x013e}, {0x0014, 0x013f}, {0x0014, 0x0140}, {0x0014, 0x0141}, - {0x0014, 0x0142}, {0x0014, 0x0143}, {0x0014, 0x0144}, {0x0014, 0x0145}, {0x0014, 0x0146}, {0x0014, 0x0147}, {0x0014, 0x0148}, {0x0014, 0x0149}, - {0x0014, 0x014a}, {0x0014, 0x014b}, {0x0014, 0x014c}, {0x0014, 0x014d}, {0x0014, 0x014e}, {0x0014, 0x014f}, {0x0014, 0x0150}, {0x0014, 0x0151}, - {0x0014, 0x0152}, {0x0014, 0x0153}, {0x0014, 0x0154}, {0x0014, 0x0155}, {0x0014, 0x0156}, {0x0014, 0x0157}, {0x0014, 0x0158}, {0x0014, 0x0159}, - {0x0014, 0x015a}, {0x0014, 0x015b}, {0x0014, 0x015c}, {0x0014, 0x015d}, {0x0014, 0x015e}, {0x0014, 0x015f}, {0x0014, 0x0160}, {0x0014, 0x0161}, - {0x0014, 0x0162}, {0x0014, 0x0163}, {0x0014, 0x0164}, {0x0014, 0x0165}, {0x0014, 0x0166}, {0x0014, 0x0167}, {0x0014, 0x0168}, {0x0014, 0x0169}, - {0x0014, 0x016a}, {0x0014, 0x016b}, {0x0014, 0x016c}, {0x0014, 0x016d}, {0x0014, 0x016e}, {0x0014, 0x016f}, {0x0014, 0x0170}, {0x0014, 0x0171}, - {0x0014, 0x0172}, {0x0014, 0x0173}, {0x0014, 0x0174}, {0x0014, 0x0175}, {0x0014, 0x0176}, {0x0014, 0x0177}, {0x0014, 0x0178}, {0x0014, 0x0179}, - {0x0014, 0x017a}, {0x0014, 0x017b}, {0x0014, 0x017c}, {0x0014, 0x017d}, {0x0014, 0x017e}, {0x0014, 0x017f}, {0x0014, 0x0180}, {0x0014, 0x0181}, - {0x0014, 0x0182}, {0x0014, 0x0183}, {0x0014, 0x0184}, {0x0014, 0x0185}, {0x0014, 0x0186}, {0x0014, 0x0187}, {0x0014, 0x0188}, {0x0014, 0x0189}, - {0x0014, 0x018a}, {0x0014, 0x018b}, {0x0014, 0x018c}, {0x0014, 0x018d}, {0x0014, 0x018e}, {0x0014, 0x018f}, {0x0014, 0x0190}, {0x0014, 0x0191}, - {0x0014, 0x0192}, {0x0014, 0x0193}, {0x0014, 0x0194}, {0x0014, 0x0195}, {0x0014, 0x0196}, {0x0014, 0x0197}, {0x0014, 0x0198}, {0x0014, 0x0199}, - {0x0014, 0x019a}, {0x0014, 0x019b}, {0x0014, 0x019c}, {0x0014, 0x019d}, {0x0014, 0x019e}, {0x0014, 0x019f}, {0x0014, 0x01a0}, {0x0014, 0x01a1}, - {0x0014, 0x01a2}, {0x0014, 0x01a3}, {0x0014, 0x01a4}, {0x0014, 0x01a5}, {0x0014, 0x01a6}, {0x0014, 0x01a7}, {0x0014, 0x01a8}, {0x0014, 0x01a9}, - {0x0014, 0x01aa}, {0x0014, 0x01ab}, {0x0014, 0x01ac}, {0x0014, 0x01ad}, {0x0014, 0x01ae}, {0x0014, 0x01af}, {0x0014, 0x01b0}, {0x0014, 0x01b1}, - {0x0014, 0x01b2}, {0x0014, 0x01b3}, {0x0014, 0x01b4}, {0x0014, 0x01b5}, {0x0014, 0x01b6}, {0x0014, 0x01b7}, {0x0014, 0x01b8}, {0x0014, 0x01b9}, - {0x0014, 0x01ba}, {0x0014, 0x01bb}, {0x0014, 0x01bc}, {0x0014, 0x01bd}, {0x0014, 0x01be}, {0x0014, 0x01bf}, {0x0014, 0x01c0}, {0x0014, 0x01c1}, - {0x0014, 0x01c2}, {0x0014, 0x01c3}, {0x0014, 0x01c4}, {0x0014, 0x01c5}, {0x0014, 0x01c6}, {0x0014, 0x01c7}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, - {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, - {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, - {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, - {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, - {0x0013, 0x0113}, + { + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0006, 0x0014 }, + { 0x0006, 0x0015 }, + { 0x0007, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0008, 0x000e }, + { 0x0008, 0x000f }, + { 0x0009, 0x000f }, + { 0x000a, 0x000f }, + { 0x000c, 0x0011 }, + { 0x000d, 0x0014 }, + { 0x000e, 0x0017 }, + { 0x0010, 0x002d }, + { 0x0011, 0x004c }, + { 0x0012, 0x008a }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0014, 0x0006 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0014, 0x0009 }, + { 0x0006, 0x0016 }, + { 0x0005, 0x0018 }, + { 0x0005, 0x0019 }, + { 0x0005, 0x001a }, + { 0x0006, 0x0017 }, + { 0x0006, 0x0018 }, + { 0x0006, 0x0019 }, + { 0x0007, 0x0012 }, + { 0x0007, 0x0013 }, + { 0x0008, 0x0010 }, + { 0x000a, 0x0010 }, + { 0x000b, 0x0011 }, + { 0x000c, 0x0012 }, + { 0x000e, 0x0018 }, + { 0x000f, 0x0020 }, + { 0x0011, 0x004d }, + { 0x0013, 0x00e4 }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0014, 0x000c }, + { 0x0014, 0x000d }, + { 0x0014, 0x000e }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0014, 0x0013 }, + { 0x0006, 0x001a }, + { 0x0005, 0x001b }, + { 0x0005, 0x001c }, + { 0x0005, 0x001d }, + { 0x0006, 0x001b }, + { 0x0006, 0x001c }, + { 0x0006, 0x001d }, + { 0x0007, 0x0014 }, + { 0x0008, 0x0011 }, + { 0x0009, 0x0010 }, + { 0x000a, 0x0011 }, + { 0x000b, 0x0012 }, + { 0x000c, 0x0013 }, + { 0x000e, 0x0019 }, + { 0x000f, 0x0021 }, + { 0x0010, 0x002e }, + { 0x0013, 0x00e5 }, + { 0x0013, 0x00e6 }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, + { 0x0014, 0x001a }, + { 0x0014, 0x001b }, + { 0x0014, 0x001c }, + { 0x0006, 0x001e }, + { 0x0005, 0x001e }, + { 0x0005, 0x001f }, + { 0x0006, 0x001f }, + { 0x0006, 0x0020 }, + { 0x0006, 0x0021 }, + { 0x0006, 0x0022 }, + { 0x0007, 0x0015 }, + { 0x0008, 0x0012 }, + { 0x0009, 0x0011 }, + { 0x000a, 0x0012 }, + { 0x000b, 0x0013 }, + { 0x000c, 0x0014 }, + { 0x000e, 0x001a }, + { 0x000f, 0x0022 }, + { 0x0010, 0x002f }, + { 0x0013, 0x00e7 }, + { 0x0013, 0x00e8 }, + { 0x0014, 0x001d }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0014, 0x0020 }, + { 0x0014, 0x0021 }, + { 0x0014, 0x0022 }, + { 0x0014, 0x0023 }, + { 0x0014, 0x0024 }, + { 0x0014, 0x0025 }, + { 0x0006, 0x0023 }, + { 0x0006, 0x0024 }, + { 0x0006, 0x0025 }, + { 0x0006, 0x0026 }, + { 0x0006, 0x0027 }, + { 0x0006, 0x0028 }, + { 0x0007, 0x0016 }, + { 0x0007, 0x0017 }, + { 0x0008, 0x0013 }, + { 0x0009, 0x0012 }, + { 0x000a, 0x0013 }, + { 0x000c, 0x0015 }, + { 0x000d, 0x0015 }, + { 0x000f, 0x0023 }, + { 0x0010, 0x0030 }, + { 0x0011, 0x004e }, + { 0x0014, 0x0026 }, + { 0x0014, 0x0027 }, + { 0x0014, 0x0028 }, + { 0x0014, 0x0029 }, + { 0x0014, 0x002a }, + { 0x0014, 0x002b }, + { 0x0014, 0x002c }, + { 0x0014, 0x002d }, + { 0x0014, 0x002e }, + { 0x0014, 0x002f }, + { 0x0014, 0x0030 }, + { 0x0007, 0x0018 }, + { 0x0006, 0x0029 }, + { 0x0006, 0x002a }, + { 0x0006, 0x002b }, + { 0x0006, 0x002c }, + { 0x0007, 0x0019 }, + { 0x0007, 0x001a }, + { 0x0008, 0x0014 }, + { 0x0009, 0x0013 }, + { 0x000a, 0x0014 }, + { 0x000b, 0x0014 }, + { 0x000c, 0x0016 }, + { 0x000d, 0x0016 }, + { 0x000f, 0x0024 }, + { 0x0010, 0x0031 }, + { 0x0011, 0x004f }, + { 0x0014, 0x0031 }, + { 0x0014, 0x0032 }, + { 0x0014, 0x0033 }, + { 0x0014, 0x0034 }, + { 0x0014, 0x0035 }, + { 0x0014, 0x0036 }, + { 0x0014, 0x0037 }, + { 0x0014, 0x0038 }, + { 0x0014, 0x0039 }, + { 0x0014, 0x003a }, + { 0x0014, 0x003b }, + { 0x0007, 0x001b }, + { 0x0006, 0x002d }, + { 0x0006, 0x002e }, + { 0x0006, 0x002f }, + { 0x0007, 0x001c }, + { 0x0007, 0x001d }, + { 0x0008, 0x0015 }, + { 0x0009, 0x0014 }, + { 0x000a, 0x0015 }, + { 0x000a, 0x0016 }, + { 0x000c, 0x0017 }, + { 0x000d, 0x0017 }, + { 0x000e, 0x001b }, + { 0x000f, 0x0025 }, + { 0x0011, 0x0050 }, + { 0x0011, 0x0051 }, + { 0x0014, 0x003c }, + { 0x0014, 0x003d }, + { 0x0014, 0x003e }, + { 0x0014, 0x003f }, + { 0x0014, 0x0040 }, + { 0x0014, 0x0041 }, + { 0x0014, 0x0042 }, + { 0x0014, 0x0043 }, + { 0x0014, 0x0044 }, + { 0x0014, 0x0045 }, + { 0x0014, 0x0046 }, + { 0x0008, 0x0016 }, + { 0x0007, 0x001e }, + { 0x0007, 0x001f }, + { 0x0007, 0x0020 }, + { 0x0007, 0x0021 }, + { 0x0008, 0x0017 }, + { 0x0008, 0x0018 }, + { 0x0009, 0x0015 }, + { 0x000a, 0x0017 }, + { 0x000b, 0x0015 }, + { 0x000c, 0x0018 }, + { 0x000e, 0x001c }, + { 0x000e, 0x001d }, + { 0x0010, 0x0032 }, + { 0x0012, 0x008b }, + { 0x0012, 0x008c }, + { 0x0014, 0x0047 }, + { 0x0014, 0x0048 }, + { 0x0014, 0x0049 }, + { 0x0014, 0x004a }, + { 0x0014, 0x004b }, + { 0x0014, 0x004c }, + { 0x0014, 0x004d }, + { 0x0014, 0x004e }, + { 0x0014, 0x004f }, + { 0x0014, 0x0050 }, + { 0x0014, 0x0051 }, + { 0x0008, 0x0019 }, + { 0x0007, 0x0022 }, + { 0x0007, 0x0023 }, + { 0x0008, 0x001a }, + { 0x0008, 0x001b }, + { 0x0009, 0x0016 }, + { 0x0009, 0x0017 }, + { 0x000a, 0x0018 }, + { 0x000b, 0x0016 }, + { 0x000c, 0x0019 }, + { 0x000d, 0x0018 }, + { 0x000e, 0x001e }, + { 0x0010, 0x0033 }, + { 0x0011, 0x0052 }, + { 0x0014, 0x0052 }, + { 0x0013, 0x00e9 }, + { 0x0014, 0x0053 }, + { 0x0014, 0x0054 }, + { 0x0014, 0x0055 }, + { 0x0014, 0x0056 }, + { 0x0014, 0x0057 }, + { 0x0014, 0x0058 }, + { 0x0014, 0x0059 }, + { 0x0014, 0x005a }, + { 0x0014, 0x005b }, + { 0x0014, 0x005c }, + { 0x0014, 0x005d }, + { 0x0009, 0x0018 }, + { 0x0008, 0x001c }, + { 0x0008, 0x001d }, + { 0x0009, 0x0019 }, + { 0x0009, 0x001a }, + { 0x000a, 0x0019 }, + { 0x000a, 0x001a }, + { 0x000b, 0x0017 }, + { 0x000c, 0x001a }, + { 0x000d, 0x0019 }, + { 0x000e, 0x001f }, + { 0x000f, 0x0026 }, + { 0x0010, 0x0034 }, + { 0x0012, 0x008d }, + { 0x0013, 0x00ea }, + { 0x0014, 0x005e }, + { 0x0014, 0x005f }, + { 0x0014, 0x0060 }, + { 0x0014, 0x0061 }, + { 0x0014, 0x0062 }, + { 0x0014, 0x0063 }, + { 0x0014, 0x0064 }, + { 0x0014, 0x0065 }, + { 0x0014, 0x0066 }, + { 0x0014, 0x0067 }, + { 0x0014, 0x0068 }, + { 0x0014, 0x0069 }, + { 0x000b, 0x0018 }, + { 0x0009, 0x001b }, + { 0x000a, 0x001b }, + { 0x000a, 0x001c }, + { 0x000a, 0x001d }, + { 0x000b, 0x0019 }, + { 0x000b, 0x001a }, + { 0x000c, 0x001b }, + { 0x000d, 0x001a }, + { 0x000e, 0x0020 }, + { 0x000f, 0x0027 }, + { 0x0012, 0x008e }, + { 0x0011, 0x0053 }, + { 0x0013, 0x00eb }, + { 0x0014, 0x006a }, + { 0x0014, 0x006b }, + { 0x0014, 0x006c }, + { 0x0014, 0x006d }, + { 0x0014, 0x006e }, + { 0x0014, 0x006f }, + { 0x0014, 0x0070 }, + { 0x0014, 0x0071 }, + { 0x0014, 0x0072 }, + { 0x0014, 0x0073 }, + { 0x0014, 0x0074 }, + { 0x0014, 0x0075 }, + { 0x0014, 0x0076 }, + { 0x000c, 0x001c }, + { 0x000b, 0x001b }, + { 0x000b, 0x001c }, + { 0x000b, 0x001d }, + { 0x000c, 0x001d }, + { 0x000c, 0x001e }, + { 0x000d, 0x001b }, + { 0x000d, 0x001c }, + { 0x000e, 0x0021 }, + { 0x0010, 0x0035 }, + { 0x0010, 0x0036 }, + { 0x0011, 0x0054 }, + { 0x0013, 0x00ec }, + { 0x0014, 0x0077 }, + { 0x0014, 0x0078 }, + { 0x0014, 0x0079 }, + { 0x0014, 0x007a }, + { 0x0014, 0x007b }, + { 0x0014, 0x007c }, + { 0x0014, 0x007d }, + { 0x0014, 0x007e }, + { 0x0014, 0x007f }, + { 0x0014, 0x0080 }, + { 0x0014, 0x0081 }, + { 0x0014, 0x0082 }, + { 0x0014, 0x0083 }, + { 0x0014, 0x0084 }, + { 0x000d, 0x001d }, + { 0x000c, 0x001f }, + { 0x000c, 0x0020 }, + { 0x000c, 0x0021 }, + { 0x000d, 0x001e }, + { 0x000d, 0x001f }, + { 0x000e, 0x0022 }, + { 0x000f, 0x0028 }, + { 0x0010, 0x0037 }, + { 0x0010, 0x0038 }, + { 0x0010, 0x0039 }, + { 0x0012, 0x008f }, + { 0x0013, 0x00ed }, + { 0x0014, 0x0085 }, + { 0x0014, 0x0086 }, + { 0x0014, 0x0087 }, + { 0x0014, 0x0088 }, + { 0x0014, 0x0089 }, + { 0x0014, 0x008a }, + { 0x0014, 0x008b }, + { 0x0014, 0x008c }, + { 0x0014, 0x008d }, + { 0x0014, 0x008e }, + { 0x0014, 0x008f }, + { 0x0014, 0x0090 }, + { 0x0014, 0x0091 }, + { 0x0014, 0x0092 }, + { 0x000e, 0x0023 }, + { 0x000d, 0x0020 }, + { 0x000d, 0x0021 }, + { 0x000e, 0x0024 }, + { 0x000e, 0x0025 }, + { 0x000e, 0x0026 }, + { 0x000f, 0x0029 }, + { 0x0010, 0x003a }, + { 0x0010, 0x003b }, + { 0x0012, 0x0090 }, + { 0x0014, 0x0093 }, + { 0x0014, 0x0094 }, + { 0x0014, 0x0095 }, + { 0x0014, 0x0096 }, + { 0x0014, 0x0097 }, + { 0x0014, 0x0098 }, + { 0x0014, 0x0099 }, + { 0x0014, 0x009a }, + { 0x0014, 0x009b }, + { 0x0014, 0x009c }, + { 0x0014, 0x009d }, + { 0x0014, 0x009e }, + { 0x0014, 0x009f }, + { 0x0014, 0x00a0 }, + { 0x0014, 0x00a1 }, + { 0x0014, 0x00a2 }, + { 0x0014, 0x00a3 }, + { 0x000f, 0x002a }, + { 0x000e, 0x0027 }, + { 0x000f, 0x002b }, + { 0x000f, 0x002c }, + { 0x000f, 0x002d }, + { 0x0010, 0x003c }, + { 0x0010, 0x003d }, + { 0x0011, 0x0055 }, + { 0x0011, 0x0056 }, + { 0x0014, 0x00a4 }, + { 0x0014, 0x00a5 }, + { 0x0014, 0x00a6 }, + { 0x0014, 0x00a7 }, + { 0x0014, 0x00a8 }, + { 0x0014, 0x00a9 }, + { 0x0014, 0x00aa }, + { 0x0014, 0x00ab }, + { 0x0014, 0x00ac }, + { 0x0014, 0x00ad }, + { 0x0014, 0x00ae }, + { 0x0014, 0x00af }, + { 0x0014, 0x00b0 }, + { 0x0014, 0x00b1 }, + { 0x0014, 0x00b2 }, + { 0x0014, 0x00b3 }, + { 0x0014, 0x00b4 }, + { 0x0014, 0x00b5 }, + { 0x0012, 0x0091 }, + { 0x0010, 0x003e }, + { 0x0010, 0x003f }, + { 0x0011, 0x0057 }, + { 0x0011, 0x0058 }, + { 0x0011, 0x0059 }, + { 0x0012, 0x0092 }, + { 0x0013, 0x00ee }, + { 0x0013, 0x00ef }, + { 0x0012, 0x0093 }, + { 0x0014, 0x00b6 }, + { 0x0014, 0x00b7 }, + { 0x0014, 0x00b8 }, + { 0x0014, 0x00b9 }, + { 0x0014, 0x00ba }, + { 0x0014, 0x00bb }, + { 0x0014, 0x00bc }, + { 0x0014, 0x00bd }, + { 0x0014, 0x00be }, + { 0x0014, 0x00bf }, + { 0x0014, 0x00c0 }, + { 0x0014, 0x00c1 }, + { 0x0014, 0x00c2 }, + { 0x0014, 0x00c3 }, + { 0x0014, 0x00c4 }, + { 0x0014, 0x00c5 }, + { 0x0014, 0x00c6 }, + { 0x0013, 0x00f0 }, + { 0x0012, 0x0094 }, + { 0x0012, 0x0095 }, + { 0x0012, 0x0096 }, + { 0x0014, 0x00c7 }, + { 0x0014, 0x00c8 }, + { 0x0014, 0x00c9 }, + { 0x0014, 0x00ca }, + { 0x0014, 0x00cb }, + { 0x0014, 0x00cc }, + { 0x0014, 0x00cd }, + { 0x0014, 0x00ce }, + { 0x0014, 0x00cf }, + { 0x0014, 0x00d0 }, + { 0x0014, 0x00d1 }, + { 0x0014, 0x00d2 }, + { 0x0014, 0x00d3 }, + { 0x0014, 0x00d4 }, + { 0x0014, 0x00d5 }, + { 0x0014, 0x00d6 }, + { 0x0014, 0x00d7 }, + { 0x0014, 0x00d8 }, + { 0x0014, 0x00d9 }, + { 0x0014, 0x00da }, + { 0x0014, 0x00db }, + { 0x0014, 0x00dc }, + { 0x0014, 0x00dd }, + { 0x0014, 0x00de }, + { 0x0012, 0x0097 }, + { 0x0014, 0x00df }, + { 0x0014, 0x00e0 }, + { 0x0014, 0x00e1 }, + { 0x0014, 0x00e2 }, + { 0x0014, 0x00e3 }, + { 0x0014, 0x00e4 }, + { 0x0014, 0x00e5 }, + { 0x0014, 0x00e6 }, + { 0x0014, 0x00e7 }, + { 0x0014, 0x00e8 }, + { 0x0014, 0x00e9 }, + { 0x0014, 0x00ea }, + { 0x0014, 0x00eb }, + { 0x0014, 0x00ec }, + { 0x0014, 0x00ed }, + { 0x0014, 0x00ee }, + { 0x0014, 0x00ef }, + { 0x0014, 0x00f0 }, + { 0x0014, 0x00f1 }, + { 0x0014, 0x00f2 }, + { 0x0014, 0x00f3 }, + { 0x0014, 0x00f4 }, + { 0x0014, 0x00f5 }, + { 0x0014, 0x00f6 }, + { 0x0014, 0x00f7 }, + { 0x0014, 0x00f8 }, + { 0x0014, 0x00f9 }, + { 0x0014, 0x00fa }, + { 0x0014, 0x00fb }, + { 0x0014, 0x00fc }, + { 0x0014, 0x00fd }, + { 0x0014, 0x00fe }, + { 0x0014, 0x00ff }, + { 0x0014, 0x0100 }, + { 0x0014, 0x0101 }, + { 0x0014, 0x0102 }, + { 0x0014, 0x0103 }, + { 0x0014, 0x0104 }, + { 0x0014, 0x0105 }, + { 0x0014, 0x0106 }, + { 0x0014, 0x0107 }, + { 0x0014, 0x0108 }, + { 0x0014, 0x0109 }, + { 0x0014, 0x010a }, + { 0x0014, 0x010b }, + { 0x0014, 0x010c }, + { 0x0014, 0x010d }, + { 0x0014, 0x010e }, + { 0x0014, 0x010f }, + { 0x0014, 0x0110 }, + { 0x0014, 0x0111 }, + { 0x0014, 0x0112 }, + { 0x0014, 0x0113 }, + { 0x0014, 0x0114 }, + { 0x0014, 0x0115 }, + { 0x0014, 0x0116 }, + { 0x0014, 0x0117 }, + { 0x0014, 0x0118 }, + { 0x0014, 0x0119 }, + { 0x0014, 0x011a }, + { 0x0014, 0x011b }, + { 0x0014, 0x011c }, + { 0x0014, 0x011d }, + { 0x0014, 0x011e }, + { 0x0014, 0x011f }, + { 0x0014, 0x0120 }, + { 0x0014, 0x0121 }, + { 0x0014, 0x0122 }, + { 0x0014, 0x0123 }, + { 0x0014, 0x0124 }, + { 0x0014, 0x0125 }, + { 0x0014, 0x0126 }, + { 0x0014, 0x0127 }, + { 0x0014, 0x0128 }, + { 0x0014, 0x0129 }, + { 0x0014, 0x012a }, + { 0x0014, 0x012b }, + { 0x0014, 0x012c }, + { 0x0014, 0x012d }, + { 0x0014, 0x012e }, + { 0x0014, 0x012f }, + { 0x0014, 0x0130 }, + { 0x0014, 0x0131 }, + { 0x0014, 0x0132 }, + { 0x0014, 0x0133 }, + { 0x0014, 0x0134 }, + { 0x0014, 0x0135 }, + { 0x0014, 0x0136 }, + { 0x0014, 0x0137 }, + { 0x0014, 0x0138 }, + { 0x0014, 0x0139 }, + { 0x0014, 0x013a }, + { 0x0014, 0x013b }, + { 0x0014, 0x013c }, + { 0x0014, 0x013d }, + { 0x0014, 0x013e }, + { 0x0014, 0x013f }, + { 0x0014, 0x0140 }, + { 0x0014, 0x0141 }, + { 0x0014, 0x0142 }, + { 0x0014, 0x0143 }, + { 0x0014, 0x0144 }, + { 0x0014, 0x0145 }, + { 0x0014, 0x0146 }, + { 0x0014, 0x0147 }, + { 0x0014, 0x0148 }, + { 0x0014, 0x0149 }, + { 0x0014, 0x014a }, + { 0x0014, 0x014b }, + { 0x0014, 0x014c }, + { 0x0014, 0x014d }, + { 0x0014, 0x014e }, + { 0x0014, 0x014f }, + { 0x0014, 0x0150 }, + { 0x0014, 0x0151 }, + { 0x0014, 0x0152 }, + { 0x0014, 0x0153 }, + { 0x0014, 0x0154 }, + { 0x0014, 0x0155 }, + { 0x0014, 0x0156 }, + { 0x0014, 0x0157 }, + { 0x0014, 0x0158 }, + { 0x0014, 0x0159 }, + { 0x0014, 0x015a }, + { 0x0014, 0x015b }, + { 0x0014, 0x015c }, + { 0x0014, 0x015d }, + { 0x0014, 0x015e }, + { 0x0014, 0x015f }, + { 0x0014, 0x0160 }, + { 0x0014, 0x0161 }, + { 0x0014, 0x0162 }, + { 0x0014, 0x0163 }, + { 0x0014, 0x0164 }, + { 0x0014, 0x0165 }, + { 0x0014, 0x0166 }, + { 0x0014, 0x0167 }, + { 0x0014, 0x0168 }, + { 0x0014, 0x0169 }, + { 0x0014, 0x016a }, + { 0x0014, 0x016b }, + { 0x0014, 0x016c }, + { 0x0014, 0x016d }, + { 0x0014, 0x016e }, + { 0x0014, 0x016f }, + { 0x0014, 0x0170 }, + { 0x0014, 0x0171 }, + { 0x0014, 0x0172 }, + { 0x0014, 0x0173 }, + { 0x0014, 0x0174 }, + { 0x0014, 0x0175 }, + { 0x0014, 0x0176 }, + { 0x0014, 0x0177 }, + { 0x0014, 0x0178 }, + { 0x0014, 0x0179 }, + { 0x0014, 0x017a }, + { 0x0014, 0x017b }, + { 0x0014, 0x017c }, + { 0x0014, 0x017d }, + { 0x0014, 0x017e }, + { 0x0014, 0x017f }, + { 0x0014, 0x0180 }, + { 0x0014, 0x0181 }, + { 0x0014, 0x0182 }, + { 0x0014, 0x0183 }, + { 0x0014, 0x0184 }, + { 0x0014, 0x0185 }, + { 0x0014, 0x0186 }, + { 0x0014, 0x0187 }, + { 0x0014, 0x0188 }, + { 0x0014, 0x0189 }, + { 0x0014, 0x018a }, + { 0x0014, 0x018b }, + { 0x0014, 0x018c }, + { 0x0014, 0x018d }, + { 0x0014, 0x018e }, + { 0x0014, 0x018f }, + { 0x0014, 0x0190 }, + { 0x0014, 0x0191 }, + { 0x0014, 0x0192 }, + { 0x0014, 0x0193 }, + { 0x0014, 0x0194 }, + { 0x0014, 0x0195 }, + { 0x0014, 0x0196 }, + { 0x0014, 0x0197 }, + { 0x0014, 0x0198 }, + { 0x0014, 0x0199 }, + { 0x0014, 0x019a }, + { 0x0014, 0x019b }, + { 0x0014, 0x019c }, + { 0x0014, 0x019d }, + { 0x0014, 0x019e }, + { 0x0014, 0x019f }, + { 0x0014, 0x01a0 }, + { 0x0014, 0x01a1 }, + { 0x0014, 0x01a2 }, + { 0x0014, 0x01a3 }, + { 0x0014, 0x01a4 }, + { 0x0014, 0x01a5 }, + { 0x0014, 0x01a6 }, + { 0x0014, 0x01a7 }, + { 0x0014, 0x01a8 }, + { 0x0014, 0x01a9 }, + { 0x0014, 0x01aa }, + { 0x0014, 0x01ab }, + { 0x0014, 0x01ac }, + { 0x0014, 0x01ad }, + { 0x0014, 0x01ae }, + { 0x0014, 0x01af }, + { 0x0014, 0x01b0 }, + { 0x0014, 0x01b1 }, + { 0x0014, 0x01b2 }, + { 0x0014, 0x01b3 }, + { 0x0014, 0x01b4 }, + { 0x0014, 0x01b5 }, + { 0x0014, 0x01b6 }, + { 0x0014, 0x01b7 }, + { 0x0014, 0x01b8 }, + { 0x0014, 0x01b9 }, + { 0x0014, 0x01ba }, + { 0x0014, 0x01bb }, + { 0x0014, 0x01bc }, + { 0x0014, 0x01bd }, + { 0x0014, 0x01be }, + { 0x0014, 0x01bf }, + { 0x0014, 0x01c0 }, + { 0x0014, 0x01c1 }, + { 0x0014, 0x01c2 }, + { 0x0014, 0x01c3 }, + { 0x0014, 0x01c4 }, + { 0x0014, 0x01c5 }, + { 0x0014, 0x01c6 }, + { 0x0014, 0x01c7 }, + { 0x0013, 0x00f1 }, + { 0x0013, 0x00f2 }, + { 0x0013, 0x00f3 }, + { 0x0013, 0x00f4 }, + { 0x0013, 0x00f5 }, + { 0x0013, 0x00f6 }, + { 0x0013, 0x00f7 }, + { 0x0013, 0x00f8 }, + { 0x0013, 0x00f9 }, + { 0x0013, 0x00fa }, + { 0x0013, 0x00fb }, + { 0x0013, 0x00fc }, + { 0x0013, 0x00fd }, + { 0x0013, 0x00fe }, + { 0x0013, 0x00ff }, + { 0x0013, 0x0100 }, + { 0x0013, 0x0101 }, + { 0x0013, 0x0102 }, + { 0x0013, 0x0103 }, + { 0x0013, 0x0104 }, + { 0x0013, 0x0105 }, + { 0x0013, 0x0106 }, + { 0x0013, 0x0107 }, + { 0x0013, 0x0108 }, + { 0x0013, 0x0109 }, + { 0x0013, 0x010a }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0013, 0x010f }, + { 0x0013, 0x0110 }, + { 0x0013, 0x0111 }, + { 0x0013, 0x0112 }, + { 0x0013, 0x0113 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec17[93][16] = -{ - {0x0010ffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0006ffff, 0x0005ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, }, - {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, - {0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, }, - {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020054, 0x00020054, 0x00020054, 0x00020054, }, - {0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, - {0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, }, - {0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, }, - {0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, }, - {0x00000024, 0x0000003e, 0x00000059, 0x00000074, 0x0000008e, 0x000000a8, 0x000000bd, 0x000000c2, 0x000000c3, 0x000000d8, 0x000000db, 0x000000dc, 0x000000f4, 0x000000f5, 0x00010004, 0x00010004, }, - {0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0001003d, 0x0001003d, 0x00010058, 0x00010058, 0x00010072, 0x00010072, 0x00010073, 0x00010073, }, - {0x00010087, 0x00010087, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x000100a2, 0x000100a2, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, }, - {0x001effff, 0x001dffff, 0x001cffff, 0x0019ffff, 0x0018ffff, 0x001affff, 0x001bffff, 0x0012ffff, 0x0011ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x00000007, 0x00000008, }, - {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, - {0x00020111, 0x00020111, 0x00020111, 0x00020111, 0x00020112, 0x00020112, 0x00020112, 0x00020112, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, }, - {0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, }, - {0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300dd, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, }, - {0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f3, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, }, - {0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x000300f7, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, 0x0003010f, }, - {0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x00020076, 0x00020076, 0x00020076, 0x00020076, }, - {0x0001010e, 0x0001010e, 0x00010113, 0x00010113, 0x00010114, 0x00010114, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, - {0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200c5, 0x000200c5, 0x000200c5, 0x000200c5, }, - {0x000200df, 0x000200df, 0x000200df, 0x000200df, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f8, 0x000200f9, 0x000200f9, 0x000200f9, 0x000200f9, 0x00020110, 0x00020110, 0x00020110, 0x00020110, }, - {0x00000146, 0x00000147, 0x00010026, 0x00010026, 0x00010041, 0x00010041, 0x0001005c, 0x0001005c, 0x00010091, 0x00010091, 0x000100c6, 0x000100c6, 0x000100e0, 0x000100e0, 0x000100fa, 0x000100fa, }, - {0x0025ffff, 0x0000000b, 0x00000027, 0x00000042, 0x0000005d, 0x00000077, 0x00000092, 0x000000ac, 0x000000c7, 0x000000e1, 0x000000fb, 0x00000115, 0x00000129, 0x0000012d, 0x0000012e, 0x00000145, }, - {0x0040ffff, 0x0039ffff, 0x002dffff, 0x002cffff, 0x002bffff, 0x0028ffff, 0x0026ffff, 0x0027ffff, 0x0029ffff, 0x002affff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, }, - {0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, 0x000300ad, }, - {0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300e2, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, 0x000300fc, }, - {0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x00030116, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, 0x0003012f, }, - {0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030130, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, 0x00030144, }, - {0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030148, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, 0x00030149, }, - {0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030160, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, 0x00030161, }, - {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020043, 0x00020043, 0x00020043, 0x00020043, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, }, - {0x000200c8, 0x000200c8, 0x000200c8, 0x000200c8, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200c9, 0x000200e3, 0x000200e3, 0x000200e3, 0x000200e3, 0x000200fd, 0x000200fd, 0x000200fd, 0x000200fd, }, - {0x0001014b, 0x0001014b, 0x00010165, 0x00010165, 0x0001017a, 0x0001017a, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x00020117, 0x00020117, 0x00020117, 0x00020117, 0x00020131, 0x00020131, 0x00020131, 0x00020131, 0x0002014a, 0x0002014a, 0x0002014a, 0x0002014a, 0x0002015f, 0x0002015f, 0x0002015f, 0x0002015f, }, - {0x00020162, 0x00020162, 0x00020162, 0x00020162, 0x00020163, 0x00020163, 0x00020163, 0x00020163, 0x00020164, 0x00020164, 0x00020164, 0x00020164, 0x0002017b, 0x0002017b, 0x0002017b, 0x0002017b, }, - {0x00010029, 0x00010029, 0x00010044, 0x00010044, 0x0001005f, 0x0001005f, 0x00010079, 0x00010079, 0x00010094, 0x00010094, 0x000100af, 0x000100af, 0x000100fe, 0x000100fe, 0x00010118, 0x00010118, }, - {0x0000007a, 0x00000095, 0x000000ca, 0x000000e4, 0x000000ff, 0x00000132, 0x00000133, 0x0000014c, 0x0000014d, 0x0000014e, 0x00000166, 0x00000167, 0x0000017f, 0x00000180, 0x00000196, 0x00000197, }, - {0x003effff, 0x003fffff, 0x0036ffff, 0x0035ffff, 0x0037ffff, 0x0038ffff, 0x0031ffff, 0x002effff, 0x0032ffff, 0x002fffff, 0x0030ffff, 0x0033ffff, 0x0034ffff, 0x0000000e, 0x00000045, 0x00000060, }, - {0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, }, - {0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x000300e5, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, 0x0003011a, }, - {0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030134, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, 0x00030181, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, - {0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b0, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, 0x000300b1, }, - {0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030182, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, 0x00030198, }, - {0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x00030199, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, 0x0003019a, }, - {0x000200cc, 0x000200cc, 0x000200cc, 0x000200cc, 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020119, 0x00020119, 0x00020119, 0x00020119, 0x0002014f, 0x0002014f, 0x0002014f, 0x0002014f, }, - {0x000102d5, 0x000102d5, 0x000102d6, 0x000102d6, 0x000102d7, 0x000102d7, 0x000102d8, 0x000102d8, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x000200cb, 0x000200cb, 0x000200cb, 0x000200cb, }, - {0x00020168, 0x00020168, 0x00020168, 0x00020168, 0x00020195, 0x00020195, 0x00020195, 0x00020195, 0x0002019b, 0x0002019b, 0x0002019b, 0x0002019b, 0x0002019e, 0x0002019e, 0x0002019e, 0x0002019e, }, - {0x000201b1, 0x000201b1, 0x000201b1, 0x000201b1, 0x000201b2, 0x000201b2, 0x000201b2, 0x000201b2, 0x000201b3, 0x000201b3, 0x000201b3, 0x000201b3, 0x000201cc, 0x000201cc, 0x000201cc, 0x000201cc, }, - {0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x003bffff, 0x003affff, 0x003cffff, 0x003dffff, }, - {0x00010062, 0x00010062, 0x000100e7, 0x000100e7, 0x00010101, 0x00010101, 0x0001011b, 0x0001011b, 0x00010135, 0x00010135, 0x00010150, 0x00010150, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, }, - {0x000002ae, 0x000002af, 0x000002b0, 0x000002b1, 0x000002b2, 0x000002b3, 0x000002b4, 0x000002b5, 0x0001002b, 0x0001002b, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010061, 0x00010061, }, - {0x000101b0, 0x000101b0, 0x000102b6, 0x000102b6, 0x000102b7, 0x000102b7, 0x000102b8, 0x000102b8, 0x000102b9, 0x000102b9, 0x000102ba, 0x000102ba, 0x000102bb, 0x000102bb, 0x000102bc, 0x000102bc, }, - {0x000102bd, 0x000102bd, 0x000102be, 0x000102be, 0x000102bf, 0x000102bf, 0x000102c0, 0x000102c0, 0x000102c1, 0x000102c1, 0x000102c2, 0x000102c2, 0x000102c3, 0x000102c3, 0x000102c4, 0x000102c4, }, - {0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, 0x000102cc, 0x000102cc, }, - {0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, 0x000102d4, 0x000102d4, }, - {0x0044ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0045ffff, 0x0048ffff, 0x0046ffff, 0x0047ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, }, - {0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x00000063, 0x00000064, 0x00000065, }, - {0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006a, 0x0000006b, 0x0000007c, 0x0000007d, 0x0000007e, 0x0000007f, 0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, }, - {0x00000086, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, 0x000000a1, 0x000000b2, 0x000000b3, 0x000000b4, 0x000000b5, }, - {0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, }, - {0x000000b6, 0x000000b7, 0x000000b8, 0x000000b9, 0x000000ba, 0x000000bb, 0x000000bc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, }, - {0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, 0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x00000120, 0x00000121, }, - {0x00000122, 0x00000123, 0x00000124, 0x00000125, 0x00000126, 0x00000127, 0x00000128, 0x00000136, 0x00000137, 0x00000138, 0x00000139, 0x0000013a, 0x0000013b, 0x0000013c, 0x0000013d, 0x0000013e, }, - {0x000000d6, 0x000000d7, 0x000000e6, 0x000000e8, 0x000000e9, 0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x00000102, 0x00000103, }, - {0x0000013f, 0x00000140, 0x00000141, 0x00000142, 0x00000143, 0x00000151, 0x00000152, 0x00000153, 0x00000154, 0x00000155, 0x00000156, 0x00000157, 0x00000158, 0x00000159, 0x0000015a, 0x0000015b, }, - {0x0000015c, 0x0000015d, 0x0000015e, 0x00000169, 0x0000016a, 0x0000016b, 0x0000016c, 0x0000016d, 0x0000016e, 0x0000016f, 0x00000170, 0x00000171, 0x00000172, 0x00000173, 0x00000174, 0x00000175, }, - {0x00000176, 0x00000177, 0x00000178, 0x00000179, 0x00000183, 0x00000184, 0x00000185, 0x00000186, 0x00000187, 0x00000188, 0x00000189, 0x0000018a, 0x0000018b, 0x0000018c, 0x0000018d, 0x0000018e, }, - {0x0000018f, 0x00000190, 0x00000191, 0x00000192, 0x00000193, 0x00000194, 0x0000019f, 0x000001a0, 0x000001a1, 0x000001a2, 0x000001a3, 0x000001a4, 0x000001a5, 0x000001a6, 0x000001a7, 0x000001a8, }, - {0x000001a9, 0x000001aa, 0x000001ab, 0x000001ac, 0x000001ad, 0x000001ae, 0x000001af, 0x000001b4, 0x000001b5, 0x000001b6, 0x000001b7, 0x000001b8, 0x000001b9, 0x000001ba, 0x000001bb, 0x000001bc, }, - {0x000001bd, 0x000001be, 0x000001bf, 0x000001c0, 0x000001c1, 0x000001c2, 0x000001c3, 0x000001c4, 0x000001c5, 0x000001c6, 0x000001c7, 0x000001c8, 0x000001c9, 0x000001ca, 0x000001cb, 0x000001cd, }, - {0x000001ce, 0x000001cf, 0x000001d0, 0x000001d1, 0x000001d2, 0x000001d3, 0x000001d4, 0x000001d5, 0x000001d6, 0x000001d7, 0x000001d8, 0x000001d9, 0x000001da, 0x000001db, 0x000001dc, 0x000001dd, }, - {0x000001de, 0x000001df, 0x000001e0, 0x000001e1, 0x000001e2, 0x000001e3, 0x000001e4, 0x000001e5, 0x000001e6, 0x000001e7, 0x000001e8, 0x000001e9, 0x000001ea, 0x000001eb, 0x000001ec, 0x000001ed, }, - {0x000001ee, 0x000001ef, 0x000001f0, 0x000001f1, 0x000001f2, 0x000001f3, 0x000001f4, 0x000001f5, 0x000001f6, 0x000001f7, 0x000001f8, 0x000001f9, 0x000001fa, 0x000001fb, 0x000001fc, 0x000001fd, }, - {0x000001fe, 0x000001ff, 0x00000200, 0x00000201, 0x00000202, 0x00000203, 0x00000204, 0x00000205, 0x00000206, 0x00000207, 0x00000208, 0x00000209, 0x0000020a, 0x0000020b, 0x0000020c, 0x0000020d, }, - {0x0000020e, 0x0000020f, 0x00000210, 0x00000211, 0x00000212, 0x00000213, 0x00000214, 0x00000215, 0x00000216, 0x00000217, 0x00000218, 0x00000219, 0x0000021a, 0x0000021b, 0x0000021c, 0x0000021d, }, - {0x0000021e, 0x0000021f, 0x00000220, 0x00000221, 0x00000222, 0x00000223, 0x00000224, 0x00000225, 0x00000226, 0x00000227, 0x00000228, 0x00000229, 0x0000022a, 0x0000022b, 0x0000022c, 0x0000022d, }, - {0x0000022e, 0x0000022f, 0x00000230, 0x00000231, 0x00000232, 0x00000233, 0x00000234, 0x00000235, 0x00000236, 0x00000237, 0x00000238, 0x00000239, 0x0000023a, 0x0000023b, 0x0000023c, 0x0000023d, }, - {0x0000023e, 0x0000023f, 0x00000240, 0x00000241, 0x00000242, 0x00000243, 0x00000244, 0x00000245, 0x00000246, 0x00000247, 0x00000248, 0x00000249, 0x0000024a, 0x0000024b, 0x0000024c, 0x0000024d, }, - {0x0000024e, 0x0000024f, 0x00000250, 0x00000251, 0x00000252, 0x00000253, 0x00000254, 0x00000255, 0x00000256, 0x00000257, 0x00000258, 0x00000259, 0x0000025a, 0x0000025b, 0x0000025c, 0x0000025d, }, - {0x0000025e, 0x0000025f, 0x00000260, 0x00000261, 0x00000262, 0x00000263, 0x00000264, 0x00000265, 0x00000266, 0x00000267, 0x00000268, 0x00000269, 0x0000026a, 0x0000026b, 0x0000026c, 0x0000026d, }, - {0x0000026e, 0x0000026f, 0x00000270, 0x00000271, 0x00000272, 0x00000273, 0x00000274, 0x00000275, 0x00000276, 0x00000277, 0x00000278, 0x00000279, 0x0000027a, 0x0000027b, 0x0000027c, 0x0000027d, }, - {0x0000027e, 0x0000027f, 0x00000280, 0x00000281, 0x00000282, 0x00000283, 0x00000284, 0x00000285, 0x00000286, 0x00000287, 0x00000288, 0x00000289, 0x0000028a, 0x0000028b, 0x0000028c, 0x0000028d, }, - {0x0000028e, 0x0000028f, 0x00000290, 0x00000291, 0x00000292, 0x00000293, 0x00000294, 0x00000295, 0x00000296, 0x00000297, 0x00000298, 0x00000299, 0x0000029a, 0x0000029b, 0x0000029c, 0x0000029d, }, - {0x0000029e, 0x0000029f, 0x000002a0, 0x000002a1, 0x000002a2, 0x000002a3, 0x000002a4, 0x000002a5, 0x000002a6, 0x000002a7, 0x000002a8, 0x000002a9, 0x000002aa, 0x000002ab, 0x000002ac, 0x000002ad, }, +const uint32_t c_aauiCQMFHuffDec17[93][16] = { + { + 0x0010ffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0006ffff, + 0x0005ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + }, + { + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + }, + { + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + }, + { + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + }, + { + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + }, + { + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x000100c0, + 0x000100c0, + 0x000100c1, + 0x000100c1, + 0x000100d9, + 0x000100d9, + 0x000100da, + 0x000100da, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + }, + { + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020054, + 0x00020054, + 0x00020054, + 0x00020054, + }, + { + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020057, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + }, + { + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + }, + { + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020089, + 0x00020089, + 0x00020089, + 0x00020089, + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008a, + }, + { + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + }, + { + 0x00000024, + 0x0000003e, + 0x00000059, + 0x00000074, + 0x0000008e, + 0x000000a8, + 0x000000bd, + 0x000000c2, + 0x000000c3, + 0x000000d8, + 0x000000db, + 0x000000dc, + 0x000000f4, + 0x000000f5, + 0x00010004, + 0x00010004, + }, + { + 0x00010005, + 0x00010005, + 0x00010006, + 0x00010006, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x0001003d, + 0x0001003d, + 0x00010058, + 0x00010058, + 0x00010072, + 0x00010072, + 0x00010073, + 0x00010073, + }, + { + 0x00010087, + 0x00010087, + 0x0001008c, + 0x0001008c, + 0x0001008d, + 0x0001008d, + 0x000100a2, + 0x000100a2, + 0x000100a6, + 0x000100a6, + 0x000100a7, + 0x000100a7, + 0x000100be, + 0x000100be, + 0x000100bf, + 0x000100bf, + }, + { + 0x001effff, + 0x001dffff, + 0x001cffff, + 0x0019ffff, + 0x0018ffff, + 0x001affff, + 0x001bffff, + 0x0012ffff, + 0x0011ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x00000007, + 0x00000008, + }, + { + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + }, + { + 0x00020111, + 0x00020111, + 0x00020111, + 0x00020111, + 0x00020112, + 0x00020112, + 0x00020112, + 0x00020112, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + }, + { + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + }, + { + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300dd, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + }, + { + 0x000300f3, + 0x000300f3, + 0x000300f3, + 0x000300f3, + 0x000300f3, + 0x000300f3, + 0x000300f3, + 0x000300f3, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + }, + { + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x000300f7, + 0x0003010f, + 0x0003010f, + 0x0003010f, + 0x0003010f, + 0x0003010f, + 0x0003010f, + 0x0003010f, + 0x0003010f, + }, + { + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + }, + { + 0x0001010e, + 0x0001010e, + 0x00010113, + 0x00010113, + 0x00010114, + 0x00010114, + 0x0001012a, + 0x0001012a, + 0x0001012b, + 0x0001012b, + 0x0001012c, + 0x0001012c, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + }, + { + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020090, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200c5, + 0x000200c5, + 0x000200c5, + 0x000200c5, + }, + { + 0x000200df, + 0x000200df, + 0x000200df, + 0x000200df, + 0x000200f8, + 0x000200f8, + 0x000200f8, + 0x000200f8, + 0x000200f9, + 0x000200f9, + 0x000200f9, + 0x000200f9, + 0x00020110, + 0x00020110, + 0x00020110, + 0x00020110, + }, + { + 0x00000146, + 0x00000147, + 0x00010026, + 0x00010026, + 0x00010041, + 0x00010041, + 0x0001005c, + 0x0001005c, + 0x00010091, + 0x00010091, + 0x000100c6, + 0x000100c6, + 0x000100e0, + 0x000100e0, + 0x000100fa, + 0x000100fa, + }, + { + 0x0025ffff, + 0x0000000b, + 0x00000027, + 0x00000042, + 0x0000005d, + 0x00000077, + 0x00000092, + 0x000000ac, + 0x000000c7, + 0x000000e1, + 0x000000fb, + 0x00000115, + 0x00000129, + 0x0000012d, + 0x0000012e, + 0x00000145, + }, + { + 0x0040ffff, + 0x0039ffff, + 0x002dffff, + 0x002cffff, + 0x002bffff, + 0x0028ffff, + 0x0026ffff, + 0x0027ffff, + 0x0029ffff, + 0x002affff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + }, + { + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + 0x000300ad, + }, + { + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300e2, + 0x000300fc, + 0x000300fc, + 0x000300fc, + 0x000300fc, + 0x000300fc, + 0x000300fc, + 0x000300fc, + 0x000300fc, + }, + { + 0x00030116, + 0x00030116, + 0x00030116, + 0x00030116, + 0x00030116, + 0x00030116, + 0x00030116, + 0x00030116, + 0x0003012f, + 0x0003012f, + 0x0003012f, + 0x0003012f, + 0x0003012f, + 0x0003012f, + 0x0003012f, + 0x0003012f, + }, + { + 0x00030130, + 0x00030130, + 0x00030130, + 0x00030130, + 0x00030130, + 0x00030130, + 0x00030130, + 0x00030130, + 0x00030144, + 0x00030144, + 0x00030144, + 0x00030144, + 0x00030144, + 0x00030144, + 0x00030144, + 0x00030144, + }, + { + 0x00030148, + 0x00030148, + 0x00030148, + 0x00030148, + 0x00030148, + 0x00030148, + 0x00030148, + 0x00030148, + 0x00030149, + 0x00030149, + 0x00030149, + 0x00030149, + 0x00030149, + 0x00030149, + 0x00030149, + 0x00030149, + }, + { + 0x00030160, + 0x00030160, + 0x00030160, + 0x00030160, + 0x00030160, + 0x00030160, + 0x00030160, + 0x00030160, + 0x00030161, + 0x00030161, + 0x00030161, + 0x00030161, + 0x00030161, + 0x00030161, + 0x00030161, + 0x00030161, + }, + { + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020043, + 0x00020043, + 0x00020043, + 0x00020043, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x000200ae, + 0x000200ae, + 0x000200ae, + 0x000200ae, + }, + { + 0x000200c8, + 0x000200c8, + 0x000200c8, + 0x000200c8, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200c9, + 0x000200e3, + 0x000200e3, + 0x000200e3, + 0x000200e3, + 0x000200fd, + 0x000200fd, + 0x000200fd, + 0x000200fd, + }, + { + 0x0001014b, + 0x0001014b, + 0x00010165, + 0x00010165, + 0x0001017a, + 0x0001017a, + 0x0001017c, + 0x0001017c, + 0x0001017d, + 0x0001017d, + 0x0001017e, + 0x0001017e, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + }, + { + 0x00020117, + 0x00020117, + 0x00020117, + 0x00020117, + 0x00020131, + 0x00020131, + 0x00020131, + 0x00020131, + 0x0002014a, + 0x0002014a, + 0x0002014a, + 0x0002014a, + 0x0002015f, + 0x0002015f, + 0x0002015f, + 0x0002015f, + }, + { + 0x00020162, + 0x00020162, + 0x00020162, + 0x00020162, + 0x00020163, + 0x00020163, + 0x00020163, + 0x00020163, + 0x00020164, + 0x00020164, + 0x00020164, + 0x00020164, + 0x0002017b, + 0x0002017b, + 0x0002017b, + 0x0002017b, + }, + { + 0x00010029, + 0x00010029, + 0x00010044, + 0x00010044, + 0x0001005f, + 0x0001005f, + 0x00010079, + 0x00010079, + 0x00010094, + 0x00010094, + 0x000100af, + 0x000100af, + 0x000100fe, + 0x000100fe, + 0x00010118, + 0x00010118, + }, + { + 0x0000007a, + 0x00000095, + 0x000000ca, + 0x000000e4, + 0x000000ff, + 0x00000132, + 0x00000133, + 0x0000014c, + 0x0000014d, + 0x0000014e, + 0x00000166, + 0x00000167, + 0x0000017f, + 0x00000180, + 0x00000196, + 0x00000197, + }, + { + 0x003effff, + 0x003fffff, + 0x0036ffff, + 0x0035ffff, + 0x0037ffff, + 0x0038ffff, + 0x0031ffff, + 0x002effff, + 0x0032ffff, + 0x002fffff, + 0x0030ffff, + 0x0033ffff, + 0x0034ffff, + 0x0000000e, + 0x00000045, + 0x00000060, + }, + { + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + }, + { + 0x000300e5, + 0x000300e5, + 0x000300e5, + 0x000300e5, + 0x000300e5, + 0x000300e5, + 0x000300e5, + 0x000300e5, + 0x0003011a, + 0x0003011a, + 0x0003011a, + 0x0003011a, + 0x0003011a, + 0x0003011a, + 0x0003011a, + 0x0003011a, + }, + { + 0x00030134, + 0x00030134, + 0x00030134, + 0x00030134, + 0x00030134, + 0x00030134, + 0x00030134, + 0x00030134, + 0x00030181, + 0x00030181, + 0x00030181, + 0x00030181, + 0x00030181, + 0x00030181, + 0x00030181, + 0x00030181, + }, + { + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + }, + { + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b0, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + 0x000300b1, + }, + { + 0x00030182, + 0x00030182, + 0x00030182, + 0x00030182, + 0x00030182, + 0x00030182, + 0x00030182, + 0x00030182, + 0x00030198, + 0x00030198, + 0x00030198, + 0x00030198, + 0x00030198, + 0x00030198, + 0x00030198, + 0x00030198, + }, + { + 0x00030199, + 0x00030199, + 0x00030199, + 0x00030199, + 0x00030199, + 0x00030199, + 0x00030199, + 0x00030199, + 0x0003019a, + 0x0003019a, + 0x0003019a, + 0x0003019a, + 0x0003019a, + 0x0003019a, + 0x0003019a, + 0x0003019a, + }, + { + 0x000200cc, + 0x000200cc, + 0x000200cc, + 0x000200cc, + 0x00020100, + 0x00020100, + 0x00020100, + 0x00020100, + 0x00020119, + 0x00020119, + 0x00020119, + 0x00020119, + 0x0002014f, + 0x0002014f, + 0x0002014f, + 0x0002014f, + }, + { + 0x000102d5, + 0x000102d5, + 0x000102d6, + 0x000102d6, + 0x000102d7, + 0x000102d7, + 0x000102d8, + 0x000102d8, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x000200cb, + 0x000200cb, + 0x000200cb, + 0x000200cb, + }, + { + 0x00020168, + 0x00020168, + 0x00020168, + 0x00020168, + 0x00020195, + 0x00020195, + 0x00020195, + 0x00020195, + 0x0002019b, + 0x0002019b, + 0x0002019b, + 0x0002019b, + 0x0002019e, + 0x0002019e, + 0x0002019e, + 0x0002019e, + }, + { + 0x000201b1, + 0x000201b1, + 0x000201b1, + 0x000201b1, + 0x000201b2, + 0x000201b2, + 0x000201b2, + 0x000201b2, + 0x000201b3, + 0x000201b3, + 0x000201b3, + 0x000201b3, + 0x000201cc, + 0x000201cc, + 0x000201cc, + 0x000201cc, + }, + { + 0x0051ffff, + 0x0052ffff, + 0x0053ffff, + 0x0054ffff, + 0x0055ffff, + 0x0056ffff, + 0x0057ffff, + 0x0058ffff, + 0x0059ffff, + 0x005affff, + 0x005bffff, + 0x005cffff, + 0x003bffff, + 0x003affff, + 0x003cffff, + 0x003dffff, + }, + { + 0x00010062, + 0x00010062, + 0x000100e7, + 0x000100e7, + 0x00010101, + 0x00010101, + 0x0001011b, + 0x0001011b, + 0x00010135, + 0x00010135, + 0x00010150, + 0x00010150, + 0x0001019c, + 0x0001019c, + 0x0001019d, + 0x0001019d, + }, + { + 0x000002ae, + 0x000002af, + 0x000002b0, + 0x000002b1, + 0x000002b2, + 0x000002b3, + 0x000002b4, + 0x000002b5, + 0x0001002b, + 0x0001002b, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010061, + 0x00010061, + }, + { + 0x000101b0, + 0x000101b0, + 0x000102b6, + 0x000102b6, + 0x000102b7, + 0x000102b7, + 0x000102b8, + 0x000102b8, + 0x000102b9, + 0x000102b9, + 0x000102ba, + 0x000102ba, + 0x000102bb, + 0x000102bb, + 0x000102bc, + 0x000102bc, + }, + { + 0x000102bd, + 0x000102bd, + 0x000102be, + 0x000102be, + 0x000102bf, + 0x000102bf, + 0x000102c0, + 0x000102c0, + 0x000102c1, + 0x000102c1, + 0x000102c2, + 0x000102c2, + 0x000102c3, + 0x000102c3, + 0x000102c4, + 0x000102c4, + }, + { + 0x000102c5, + 0x000102c5, + 0x000102c6, + 0x000102c6, + 0x000102c7, + 0x000102c7, + 0x000102c8, + 0x000102c8, + 0x000102c9, + 0x000102c9, + 0x000102ca, + 0x000102ca, + 0x000102cb, + 0x000102cb, + 0x000102cc, + 0x000102cc, + }, + { + 0x000102cd, + 0x000102cd, + 0x000102ce, + 0x000102ce, + 0x000102cf, + 0x000102cf, + 0x000102d0, + 0x000102d0, + 0x000102d1, + 0x000102d1, + 0x000102d2, + 0x000102d2, + 0x000102d3, + 0x000102d3, + 0x000102d4, + 0x000102d4, + }, + { + 0x0044ffff, + 0x0041ffff, + 0x0042ffff, + 0x0043ffff, + 0x0045ffff, + 0x0048ffff, + 0x0046ffff, + 0x0047ffff, + 0x0049ffff, + 0x004affff, + 0x004bffff, + 0x004cffff, + 0x004dffff, + 0x004effff, + 0x004fffff, + 0x0050ffff, + }, + { + 0x00000032, + 0x00000033, + 0x00000034, + 0x00000035, + 0x00000048, + 0x00000049, + 0x0000004a, + 0x0000004b, + 0x0000004c, + 0x0000004d, + 0x0000004e, + 0x0000004f, + 0x00000050, + 0x00000063, + 0x00000064, + 0x00000065, + }, + { + 0x00000066, + 0x00000067, + 0x00000068, + 0x00000069, + 0x0000006a, + 0x0000006b, + 0x0000007c, + 0x0000007d, + 0x0000007e, + 0x0000007f, + 0x00000080, + 0x00000081, + 0x00000082, + 0x00000083, + 0x00000084, + 0x00000085, + }, + { + 0x00000086, + 0x00000097, + 0x00000098, + 0x00000099, + 0x0000009a, + 0x0000009b, + 0x0000009c, + 0x0000009d, + 0x0000009e, + 0x0000009f, + 0x000000a0, + 0x000000a1, + 0x000000b2, + 0x000000b3, + 0x000000b4, + 0x000000b5, + }, + { + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000018, + 0x00000019, + 0x0000001a, + 0x0000002c, + 0x0000002d, + 0x0000002e, + 0x0000002f, + 0x00000030, + 0x00000031, + }, + { + 0x000000b6, + 0x000000b7, + 0x000000b8, + 0x000000b9, + 0x000000ba, + 0x000000bb, + 0x000000bc, + 0x000000cd, + 0x000000ce, + 0x000000cf, + 0x000000d0, + 0x000000d1, + 0x000000d2, + 0x000000d3, + 0x000000d4, + 0x000000d5, + }, + { + 0x00000104, + 0x00000105, + 0x00000106, + 0x00000107, + 0x00000108, + 0x00000109, + 0x0000010a, + 0x0000010b, + 0x0000010c, + 0x0000010d, + 0x0000011c, + 0x0000011d, + 0x0000011e, + 0x0000011f, + 0x00000120, + 0x00000121, + }, + { + 0x00000122, + 0x00000123, + 0x00000124, + 0x00000125, + 0x00000126, + 0x00000127, + 0x00000128, + 0x00000136, + 0x00000137, + 0x00000138, + 0x00000139, + 0x0000013a, + 0x0000013b, + 0x0000013c, + 0x0000013d, + 0x0000013e, + }, + { + 0x000000d6, + 0x000000d7, + 0x000000e6, + 0x000000e8, + 0x000000e9, + 0x000000ea, + 0x000000eb, + 0x000000ec, + 0x000000ed, + 0x000000ee, + 0x000000ef, + 0x000000f0, + 0x000000f1, + 0x000000f2, + 0x00000102, + 0x00000103, + }, + { + 0x0000013f, + 0x00000140, + 0x00000141, + 0x00000142, + 0x00000143, + 0x00000151, + 0x00000152, + 0x00000153, + 0x00000154, + 0x00000155, + 0x00000156, + 0x00000157, + 0x00000158, + 0x00000159, + 0x0000015a, + 0x0000015b, + }, + { + 0x0000015c, + 0x0000015d, + 0x0000015e, + 0x00000169, + 0x0000016a, + 0x0000016b, + 0x0000016c, + 0x0000016d, + 0x0000016e, + 0x0000016f, + 0x00000170, + 0x00000171, + 0x00000172, + 0x00000173, + 0x00000174, + 0x00000175, + }, + { + 0x00000176, + 0x00000177, + 0x00000178, + 0x00000179, + 0x00000183, + 0x00000184, + 0x00000185, + 0x00000186, + 0x00000187, + 0x00000188, + 0x00000189, + 0x0000018a, + 0x0000018b, + 0x0000018c, + 0x0000018d, + 0x0000018e, + }, + { + 0x0000018f, + 0x00000190, + 0x00000191, + 0x00000192, + 0x00000193, + 0x00000194, + 0x0000019f, + 0x000001a0, + 0x000001a1, + 0x000001a2, + 0x000001a3, + 0x000001a4, + 0x000001a5, + 0x000001a6, + 0x000001a7, + 0x000001a8, + }, + { + 0x000001a9, + 0x000001aa, + 0x000001ab, + 0x000001ac, + 0x000001ad, + 0x000001ae, + 0x000001af, + 0x000001b4, + 0x000001b5, + 0x000001b6, + 0x000001b7, + 0x000001b8, + 0x000001b9, + 0x000001ba, + 0x000001bb, + 0x000001bc, + }, + { + 0x000001bd, + 0x000001be, + 0x000001bf, + 0x000001c0, + 0x000001c1, + 0x000001c2, + 0x000001c3, + 0x000001c4, + 0x000001c5, + 0x000001c6, + 0x000001c7, + 0x000001c8, + 0x000001c9, + 0x000001ca, + 0x000001cb, + 0x000001cd, + }, + { + 0x000001ce, + 0x000001cf, + 0x000001d0, + 0x000001d1, + 0x000001d2, + 0x000001d3, + 0x000001d4, + 0x000001d5, + 0x000001d6, + 0x000001d7, + 0x000001d8, + 0x000001d9, + 0x000001da, + 0x000001db, + 0x000001dc, + 0x000001dd, + }, + { + 0x000001de, + 0x000001df, + 0x000001e0, + 0x000001e1, + 0x000001e2, + 0x000001e3, + 0x000001e4, + 0x000001e5, + 0x000001e6, + 0x000001e7, + 0x000001e8, + 0x000001e9, + 0x000001ea, + 0x000001eb, + 0x000001ec, + 0x000001ed, + }, + { + 0x000001ee, + 0x000001ef, + 0x000001f0, + 0x000001f1, + 0x000001f2, + 0x000001f3, + 0x000001f4, + 0x000001f5, + 0x000001f6, + 0x000001f7, + 0x000001f8, + 0x000001f9, + 0x000001fa, + 0x000001fb, + 0x000001fc, + 0x000001fd, + }, + { + 0x000001fe, + 0x000001ff, + 0x00000200, + 0x00000201, + 0x00000202, + 0x00000203, + 0x00000204, + 0x00000205, + 0x00000206, + 0x00000207, + 0x00000208, + 0x00000209, + 0x0000020a, + 0x0000020b, + 0x0000020c, + 0x0000020d, + }, + { + 0x0000020e, + 0x0000020f, + 0x00000210, + 0x00000211, + 0x00000212, + 0x00000213, + 0x00000214, + 0x00000215, + 0x00000216, + 0x00000217, + 0x00000218, + 0x00000219, + 0x0000021a, + 0x0000021b, + 0x0000021c, + 0x0000021d, + }, + { + 0x0000021e, + 0x0000021f, + 0x00000220, + 0x00000221, + 0x00000222, + 0x00000223, + 0x00000224, + 0x00000225, + 0x00000226, + 0x00000227, + 0x00000228, + 0x00000229, + 0x0000022a, + 0x0000022b, + 0x0000022c, + 0x0000022d, + }, + { + 0x0000022e, + 0x0000022f, + 0x00000230, + 0x00000231, + 0x00000232, + 0x00000233, + 0x00000234, + 0x00000235, + 0x00000236, + 0x00000237, + 0x00000238, + 0x00000239, + 0x0000023a, + 0x0000023b, + 0x0000023c, + 0x0000023d, + }, + { + 0x0000023e, + 0x0000023f, + 0x00000240, + 0x00000241, + 0x00000242, + 0x00000243, + 0x00000244, + 0x00000245, + 0x00000246, + 0x00000247, + 0x00000248, + 0x00000249, + 0x0000024a, + 0x0000024b, + 0x0000024c, + 0x0000024d, + }, + { + 0x0000024e, + 0x0000024f, + 0x00000250, + 0x00000251, + 0x00000252, + 0x00000253, + 0x00000254, + 0x00000255, + 0x00000256, + 0x00000257, + 0x00000258, + 0x00000259, + 0x0000025a, + 0x0000025b, + 0x0000025c, + 0x0000025d, + }, + { + 0x0000025e, + 0x0000025f, + 0x00000260, + 0x00000261, + 0x00000262, + 0x00000263, + 0x00000264, + 0x00000265, + 0x00000266, + 0x00000267, + 0x00000268, + 0x00000269, + 0x0000026a, + 0x0000026b, + 0x0000026c, + 0x0000026d, + }, + { + 0x0000026e, + 0x0000026f, + 0x00000270, + 0x00000271, + 0x00000272, + 0x00000273, + 0x00000274, + 0x00000275, + 0x00000276, + 0x00000277, + 0x00000278, + 0x00000279, + 0x0000027a, + 0x0000027b, + 0x0000027c, + 0x0000027d, + }, + { + 0x0000027e, + 0x0000027f, + 0x00000280, + 0x00000281, + 0x00000282, + 0x00000283, + 0x00000284, + 0x00000285, + 0x00000286, + 0x00000287, + 0x00000288, + 0x00000289, + 0x0000028a, + 0x0000028b, + 0x0000028c, + 0x0000028d, + }, + { + 0x0000028e, + 0x0000028f, + 0x00000290, + 0x00000291, + 0x00000292, + 0x00000293, + 0x00000294, + 0x00000295, + 0x00000296, + 0x00000297, + 0x00000298, + 0x00000299, + 0x0000029a, + 0x0000029b, + 0x0000029c, + 0x0000029d, + }, + { + 0x0000029e, + 0x0000029f, + 0x000002a0, + 0x000002a1, + 0x000002a2, + 0x000002a3, + 0x000002a4, + 0x000002a5, + 0x000002a6, + 0x000002a7, + 0x000002a8, + 0x000002a9, + 0x000002aa, + 0x000002ab, + 0x000002ac, + 0x000002ad, + }, }; #endif @@ -1635,23 +16793,148 @@ const uint32_t c_aauiCQMFHuffEnc18[28][2] = #else const uint16_t c_aauiCQMFHuffEnc18[28][2] = #endif -{ - {0x0004, 0x0001}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0002}, - {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, - {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0011, 0x0003}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, - {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0004}, {0x0012, 0x0005}, + { + { 0x0004, 0x0001 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0002 }, + { 0x0004, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x000f, 0x0001 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec18[6][16] = -{ - {0x0001ffff, 0x00000000, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, }, - {0x0002ffff, 0x0000000c, 0x0001000b, 0x0001000b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003ffff, 0x00000010, 0x0001000f, 0x0001000f, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0005ffff, 0x0004ffff, 0x00010013, 0x00010013, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, +const uint32_t c_aauiCQMFHuffDec18[6][16] = { + { + 0x0001ffff, + 0x00000000, + 0x00000007, + 0x00000008, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00010004, + 0x00010004, + 0x00010005, + 0x00010005, + 0x00010006, + 0x00010006, + }, + { + 0x0002ffff, + 0x0000000c, + 0x0001000b, + 0x0001000b, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003ffff, + 0x00000010, + 0x0001000f, + 0x0001000f, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0005ffff, + 0x0004ffff, + 0x00010013, + 0x00010013, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + }, }; #endif @@ -1660,23 +16943,149 @@ const uint32_t c_aauiCQMFHuffEnc19[29][2] = #else const uint16_t c_aauiCQMFHuffEnc19[29][2] = #endif -{ - {0x0004, 0x0002}, {0x0003, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, - {0x0004, 0x0005}, {0x0005, 0x0001}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, - {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0012, 0x0002}, - {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0012, 0x0003}, + { + { 0x0004, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0003 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0005, 0x0001 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0006, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x000f, 0x0001 }, + { 0x0010, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0012, 0x0003 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec19[6][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00000000, 0x00000006, 0x00000007, 0x00000008, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, }, - {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0004ffff, 0x00000012, 0x00010011, 0x00010011, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x0005ffff, 0x00000016, 0x00010015, 0x00010015, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, +const uint32_t c_aauiCQMFHuffDec19[6][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00000000, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00010004, + 0x00010004, + 0x00010005, + 0x00010005, + }, + { + 0x0003ffff, + 0x0000000e, + 0x0001000d, + 0x0001000d, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x0004ffff, + 0x00000012, + 0x00010011, + 0x00010011, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x0005ffff, + 0x00000016, + 0x00010015, + 0x00010015, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + }, + { + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, }; #endif @@ -1685,22 +17094,151 @@ const uint32_t c_aauiCQMFHuffEnc20[32][2] = #else const uint16_t c_aauiCQMFHuffEnc20[32][2] = #endif -{ - {0x0004, 0x0002}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, - {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0006, 0x0002}, {0x0006, 0x0003}, - {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, - {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0011, 0x0001}, {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, -}; + { + { 0x0004, 0x0002 }, + { 0x0003, 0x0005 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0003 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0006, 0x0001 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0007, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x000f, 0x0001 }, + { 0x0010, 0x0001 }, + { 0x0011, 0x0001 }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec20[6][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00000000, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003ffff, 0x00000011, 0x00010010, 0x00010010, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x0004ffff, 0x00000015, 0x00010014, 0x00010014, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x0005ffff, 0x00000019, 0x00010018, 0x00010018, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x0000001b, 0x0000001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, +const uint32_t c_aauiCQMFHuffDec20[6][16] = { + { + 0x0002ffff, + 0x0001ffff, + 0x00000000, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003ffff, + 0x00000011, + 0x00010010, + 0x00010010, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + }, + { + 0x0004ffff, + 0x00000015, + 0x00010014, + 0x00010014, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x0005ffff, + 0x00000019, + 0x00010018, + 0x00010018, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + }, + { + 0x0000001b, + 0x0000001c, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + }, }; #endif @@ -1709,25 +17247,175 @@ const uint32_t c_aauiCQMFHuffEnc21[37][2] = #else const uint16_t c_aauiCQMFHuffEnc21[37][2] = #endif -{ - {0x0005, 0x0002}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, - {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0002}, - {0x0006, 0x0003}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0001}, {0x000b, 0x0001}, - {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0011, 0x0001}, - {0x0014, 0x0000}, {0x0014, 0x0001}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, + { + { 0x0005, 0x0002 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0003 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0005, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0007, 0x0002 }, + { 0x0007, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0009, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x000f, 0x0001 }, + { 0x0010, 0x0001 }, + { 0x0011, 0x0001 }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec21[7][16] = -{ - {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, - {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0004ffff, 0x00000013, 0x00000014, 0x00000015, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, - {0x0005ffff, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x0006ffff, 0x0000001e, 0x0001001d, 0x0001001d, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x00000020, 0x00000021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, +const uint32_t c_aauiCQMFHuffDec21[7][16] = { + { + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + }, + { + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x0004ffff, + 0x00000013, + 0x00000014, + 0x00000015, + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + }, + { + 0x0005ffff, + 0x0000001a, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + }, + { + 0x0006ffff, + 0x0000001e, + 0x0001001d, + 0x0001001d, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + }, + { + 0x00000020, + 0x00000021, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + }, }; #endif @@ -1736,27 +17424,213 @@ const uint32_t c_aauiCQMFHuffEnc22[39][2] = #else const uint16_t c_aauiCQMFHuffEnc22[39][2] = #endif -{ - {0x0005, 0x0002}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, - {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, - {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0002}, {0x0008, 0x0003}, - {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0001}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000c, 0x0001}, {0x000c, 0x0002}, {0x000c, 0x0003}, - {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000f, 0x0001}, {0x000e, 0x0003}, {0x0011, 0x0000}, {0x0010, 0x0001}, {0x0011, 0x0001}, + { + { 0x0005, 0x0002 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0004, 0x000c }, + { 0x0004, 0x000d }, + { 0x0004, 0x000e }, + { 0x0004, 0x000f }, + { 0x0005, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0007, 0x0002 }, + { 0x0007, 0x0003 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000a, 0x0001 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000c, 0x0001 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000e, 0x0001 }, + { 0x000e, 0x0002 }, + { 0x000f, 0x0001 }, + { 0x000e, 0x0003 }, + { 0x0011, 0x0000 }, + { 0x0010, 0x0001 }, + { 0x0011, 0x0001 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec22[9][16] = -{ - {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, }, - {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x0006ffff, 0x0005ffff, 0x00000016, 0x00000017, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x0007ffff, 0x0000001d, 0x0000001e, 0x0000001f, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, - {0x0008ffff, 0x00000025, 0x00010022, 0x00010022, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, +const uint32_t c_aauiCQMFHuffDec22[9][16] = { + { + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x00000001, + 0x00000002, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x0000000c, + }, + { + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x00000016, + 0x00000017, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + }, + { + 0x0007ffff, + 0x0000001d, + 0x0000001e, + 0x0000001f, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, + { + 0x0008ffff, + 0x00000025, + 0x00010022, + 0x00010022, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + }, + { + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + }, }; #endif @@ -1765,31 +17639,274 @@ const uint32_t c_aauiCQMFHuffEnc23[46][2] = #else const uint16_t c_aauiCQMFHuffEnc23[46][2] = #endif -{ - {0x0005, 0x0003}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, - {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, - {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, - {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, - {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0001}, {0x000e, 0x0002}, - {0x000e, 0x0003}, {0x000f, 0x0001}, {0x0010, 0x0001}, {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0011, 0x0001}, + { + { 0x0005, 0x0003 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0004, 0x000c }, + { 0x0004, 0x000d }, + { 0x0004, 0x000e }, + { 0x0004, 0x000f }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0006, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0002 }, + { 0x0007, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000d, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x000e, 0x0001 }, + { 0x000e, 0x0002 }, + { 0x000e, 0x0003 }, + { 0x000f, 0x0001 }, + { 0x0010, 0x0001 }, + { 0x0012, 0x0000 }, + { 0x0012, 0x0001 }, + { 0x0011, 0x0001 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec23[12][16] = -{ - {0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, }, - {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x0008ffff, 0x0007ffff, 0x0000001a, 0x0000001b, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x000affff, 0x0009ffff, 0x00000022, 0x00000023, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, - {0x000bffff, 0x0000002a, 0x00010029, 0x00010029, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, - {0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, +const uint32_t c_aauiCQMFHuffDec23[12][16] = { + { + 0x0006ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x00000001, + 0x00000002, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + }, + { + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + }, + { + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x0008ffff, + 0x0007ffff, + 0x0000001a, + 0x0000001b, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + }, + { + 0x000affff, + 0x0009ffff, + 0x00000022, + 0x00000023, + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + }, + { + 0x000bffff, + 0x0000002a, + 0x00010029, + 0x00010029, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + }, + { + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + }, }; #endif @@ -1798,37 +17915,373 @@ const uint32_t c_aauiCQMFHuffEnc24[55][2] = #else const uint16_t c_aauiCQMFHuffEnc24[55][2] = #endif -{ - {0x0005, 0x0004}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0004, 0x000f}, - {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, - {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, - {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, - {0x0009, 0x0002}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, {0x000b, 0x0003}, - {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0001}, - {0x000f, 0x0002}, {0x000f, 0x0003}, {0x0010, 0x0001}, {0x0011, 0x0001}, {0x0013, 0x0000}, {0x0012, 0x0001}, {0x0013, 0x0001}, + { + { 0x0005, 0x0004 }, + { 0x0004, 0x0009 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0004, 0x000c }, + { 0x0004, 0x000d }, + { 0x0004, 0x000e }, + { 0x0004, 0x000f }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0005, 0x0010 }, + { 0x0005, 0x0011 }, + { 0x0006, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0007, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0003 }, + { 0x000d, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000e, 0x0002 }, + { 0x000e, 0x0003 }, + { 0x000f, 0x0001 }, + { 0x000f, 0x0002 }, + { 0x000f, 0x0003 }, + { 0x0010, 0x0001 }, + { 0x0011, 0x0001 }, + { 0x0013, 0x0000 }, + { 0x0012, 0x0001 }, + { 0x0013, 0x0001 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec24[17][16] = -{ - {0x0008ffff, 0x0009ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, }, - {0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x000cffff, 0x000affff, 0x000bffff, 0x0000001d, 0x0000001e, 0x0000001f, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, - {0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, - {0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, }, - {0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, - {0x000fffff, 0x000dffff, 0x000effff, 0x00000028, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, - {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, - {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, - {0x0010ffff, 0x00000032, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, - {0x00010034, 0x00010034, 0x00010036, 0x00010036, 0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, +const uint32_t c_aauiCQMFHuffDec24[17][16] = { + { + 0x0008ffff, + 0x0009ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x00000001, + 0x00000002, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + }, + { + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + }, + { + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x000cffff, + 0x000affff, + 0x000bffff, + 0x0000001d, + 0x0000001e, + 0x0000001f, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + }, + { + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + }, + { + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + }, + { + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + }, + { + 0x000fffff, + 0x000dffff, + 0x000effff, + 0x00000028, + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + }, + { + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + }, + { + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + }, + { + 0x0010ffff, + 0x00000032, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + }, + { + 0x00010034, + 0x00010034, + 0x00010036, + 0x00010036, + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020035, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, }; #endif @@ -1837,41 +18290,419 @@ const uint32_t c_aauiCQMFHuffEnc25[65][2] = #else const uint16_t c_aauiCQMFHuffEnc25[65][2] = #endif -{ - {0x0005, 0x0005}, {0x0004, 0x000c}, {0x0004, 0x000d}, {0x0004, 0x000e}, {0x0005, 0x0006}, {0x0004, 0x000f}, {0x0005, 0x0007}, {0x0005, 0x0008}, - {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, - {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0006, 0x0004}, - {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0007, 0x0003}, {0x0007, 0x0004}, {0x0007, 0x0005}, - {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, - {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0002}, {0x000c, 0x0003}, - {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000d, 0x0003}, {0x000e, 0x0003}, {0x000e, 0x0004}, {0x000f, 0x0003}, {0x000e, 0x0005}, {0x000f, 0x0004}, - {0x0010, 0x0001}, {0x000f, 0x0005}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0011, 0x0001}, {0x0012, 0x0000}, - {0x0012, 0x0001}, + { + { 0x0005, 0x0005 }, + { 0x0004, 0x000c }, + { 0x0004, 0x000d }, + { 0x0004, 0x000e }, + { 0x0005, 0x0006 }, + { 0x0004, 0x000f }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0005, 0x0010 }, + { 0x0005, 0x0011 }, + { 0x0005, 0x0012 }, + { 0x0005, 0x0013 }, + { 0x0005, 0x0014 }, + { 0x0005, 0x0015 }, + { 0x0005, 0x0016 }, + { 0x0005, 0x0017 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0007, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0009, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000a, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000b, 0x0003 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000d, 0x0003 }, + { 0x000e, 0x0003 }, + { 0x000e, 0x0004 }, + { 0x000f, 0x0003 }, + { 0x000e, 0x0005 }, + { 0x000f, 0x0004 }, + { 0x0010, 0x0001 }, + { 0x000f, 0x0005 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0010, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x0011, 0x0001 }, + { 0x0012, 0x0000 }, + { 0x0012, 0x0001 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec25[19][16] = -{ - {0x000cffff, 0x000bffff, 0x0002ffff, 0x0001ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x00000001, 0x00000002, 0x00000003, 0x00000005, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x000fffff, 0x000dffff, 0x000effff, 0x00000022, 0x00000023, 0x00000024, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, - {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, - {0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, - {0x0011ffff, 0x0010ffff, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, - {0x00020034, 0x00020034, 0x00020034, 0x00020034, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, - {0x0012ffff, 0x00000038, 0x0000003a, 0x0000003b, 0x0000003c, 0x0000003d, 0x00010035, 0x00010035, 0x00010037, 0x00010037, 0x00010039, 0x00010039, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, - {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, +const uint32_t c_aauiCQMFHuffDec25[19][16] = { + { + 0x000cffff, + 0x000bffff, + 0x0002ffff, + 0x0001ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x00000001, + 0x00000002, + 0x00000003, + 0x00000005, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + }, + { + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + }, + { + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x000fffff, + 0x000dffff, + 0x000effff, + 0x00000022, + 0x00000023, + 0x00000024, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + }, + { + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + }, + { + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + }, + { + 0x0011ffff, + 0x0010ffff, + 0x0000002e, + 0x0000002f, + 0x00000030, + 0x00000031, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + }, + { + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + }, + { + 0x0012ffff, + 0x00000038, + 0x0000003a, + 0x0000003b, + 0x0000003c, + 0x0000003d, + 0x00010035, + 0x00010035, + 0x00010037, + 0x00010037, + 0x00010039, + 0x00010039, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + }, + { + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, }; #endif @@ -1880,49 +18711,557 @@ const uint32_t c_aauiCQMFHuffEnc26[77][2] = #else const uint16_t c_aauiCQMFHuffEnc26[77][2] = #endif -{ - {0x0006, 0x0004}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, - {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, - {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, - {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, - {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0004}, - {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, - {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, - {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000e, 0x0002}, {0x000d, 0x0005}, {0x000e, 0x0003}, {0x000e, 0x0004}, - {0x000f, 0x0003}, {0x000e, 0x0005}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, {0x0011, 0x0002}, {0x0012, 0x0001}, {0x0010, 0x0005}, - {0x0012, 0x0002}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, + { + { 0x0006, 0x0004 }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0005, 0x0010 }, + { 0x0005, 0x0011 }, + { 0x0005, 0x0012 }, + { 0x0005, 0x0013 }, + { 0x0005, 0x0014 }, + { 0x0005, 0x0015 }, + { 0x0005, 0x0016 }, + { 0x0005, 0x0017 }, + { 0x0005, 0x0018 }, + { 0x0005, 0x0019 }, + { 0x0005, 0x001a }, + { 0x0005, 0x001b }, + { 0x0005, 0x001c }, + { 0x0005, 0x001d }, + { 0x0005, 0x001e }, + { 0x0005, 0x001f }, + { 0x0006, 0x0005 }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0009, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x000a, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000c, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x000e, 0x0002 }, + { 0x000d, 0x0005 }, + { 0x000e, 0x0003 }, + { 0x000e, 0x0004 }, + { 0x000f, 0x0003 }, + { 0x000e, 0x0005 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0010, 0x0004 }, + { 0x0011, 0x0002 }, + { 0x0012, 0x0001 }, + { 0x0010, 0x0005 }, + { 0x0012, 0x0002 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0003 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec26[26][16] = -{ - {0x0010ffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, }, - {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, - {0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, }, - {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x0017ffff, 0x0015ffff, 0x0016ffff, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, - {0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, - {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, }, - {0x0019ffff, 0x0018ffff, 0x00000042, 0x00000043, 0x00000044, 0x00000047, 0x00010040, 0x00010040, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, }, - {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, - {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, +const uint32_t c_aauiCQMFHuffDec26[26][16] = { + { + 0x0010ffff, + 0x000effff, + 0x000fffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + }, + { + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + }, + { + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + }, + { + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + }, + { + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, + { + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + }, + { + 0x0014ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x00000027, + 0x00000028, + 0x00000029, + 0x0000002a, + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + }, + { + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020032, + 0x00020032, + 0x00020032, + 0x00020032, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + }, + { + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + }, + { + 0x0017ffff, + 0x0015ffff, + 0x0016ffff, + 0x00000035, + 0x00000036, + 0x00000037, + 0x00000038, + 0x00000039, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020030, + }, + { + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + }, + { + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + }, + { + 0x0019ffff, + 0x0018ffff, + 0x00000042, + 0x00000043, + 0x00000044, + 0x00000047, + 0x00010040, + 0x00010040, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + }, + { + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + }, + { + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x00020046, + 0x00020046, + 0x00020046, + 0x00020046, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + }, }; #endif @@ -1931,53 +19270,607 @@ const uint32_t c_aauiCQMFHuffEnc27[91][2] = #else const uint16_t c_aauiCQMFHuffEnc27[91][2] = #endif -{ - {0x0006, 0x0006}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, - {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, - {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, {0x0005, 0x001f}, {0x0006, 0x0007}, {0x0006, 0x0008}, - {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, - {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, - {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, - {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0004}, {0x000a, 0x0005}, - {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, - {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0003}, {0x000e, 0x0004}, - {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000f, 0x0003}, {0x000f, 0x0004}, {0x0010, 0x0003}, {0x000f, 0x0005}, {0x0012, 0x0000}, - {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0011, 0x0004}, {0x0011, 0x0005}, {0x0012, 0x0003}, {0x0012, 0x0004}, - {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, + { + { 0x0006, 0x0006 }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0005, 0x0010 }, + { 0x0005, 0x0011 }, + { 0x0005, 0x0012 }, + { 0x0005, 0x0013 }, + { 0x0005, 0x0014 }, + { 0x0005, 0x0015 }, + { 0x0005, 0x0016 }, + { 0x0005, 0x0017 }, + { 0x0005, 0x0018 }, + { 0x0005, 0x0019 }, + { 0x0005, 0x001a }, + { 0x0005, 0x001b }, + { 0x0005, 0x001c }, + { 0x0005, 0x001d }, + { 0x0005, 0x001e }, + { 0x0005, 0x001f }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0006, 0x0014 }, + { 0x0006, 0x0015 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0007, 0x0008 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0003 }, + { 0x000e, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x000e, 0x0006 }, + { 0x000e, 0x0007 }, + { 0x000f, 0x0003 }, + { 0x000f, 0x0004 }, + { 0x0010, 0x0003 }, + { 0x000f, 0x0005 }, + { 0x0012, 0x0000 }, + { 0x0010, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x0012, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0011, 0x0004 }, + { 0x0011, 0x0005 }, + { 0x0012, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec27[28][16] = -{ - {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, - {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, - {0x0014ffff, 0x0013ffff, 0x0011ffff, 0x0012ffff, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x0017ffff, 0x0018ffff, 0x0015ffff, 0x0016ffff, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, - {0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, }, - {0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x001affff, 0x001bffff, 0x0019ffff, 0x0000004d, 0x00000050, 0x00000051, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004e, 0x0001004e, 0x00020046, 0x00020046, 0x00020046, 0x00020046, }, - {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, - {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, - {0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, - {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, +const uint32_t c_aauiCQMFHuffDec27[28][16] = { + { + 0x0010ffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + }, + { + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + }, + { + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, + { + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + }, + { + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + }, + { + 0x0014ffff, + 0x0013ffff, + 0x0011ffff, + 0x0012ffff, + 0x0000002c, + 0x0000002d, + 0x0000002e, + 0x0000002f, + 0x00000030, + 0x00000031, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + }, + { + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, + { + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x0017ffff, + 0x0018ffff, + 0x0015ffff, + 0x0016ffff, + 0x0000003e, + 0x0000003f, + 0x00000040, + 0x00000041, + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + }, + { + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + }, + { + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + }, + { + 0x001affff, + 0x001bffff, + 0x0019ffff, + 0x0000004d, + 0x00000050, + 0x00000051, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004e, + 0x0001004e, + 0x00020046, + 0x00020046, + 0x00020046, + 0x00020046, + }, + { + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + }, + { + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + }, + { + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + }, + { + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + }, }; #endif @@ -1986,57 +19879,661 @@ const uint32_t c_aauiCQMFHuffEnc28[109][2] = #else const uint16_t c_aauiCQMFHuffEnc28[109][2] = #endif -{ - {0x0006, 0x0008}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0005, 0x0012}, {0x0005, 0x0013}, {0x0005, 0x0014}, {0x0005, 0x0015}, {0x0005, 0x0016}, - {0x0005, 0x0017}, {0x0005, 0x0018}, {0x0005, 0x0019}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0005, 0x001d}, {0x0005, 0x001e}, - {0x0006, 0x0009}, {0x0005, 0x001f}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, - {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, - {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, - {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, - {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x000a, 0x0005}, - {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000c, 0x0004}, - {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, - {0x000d, 0x0007}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x0010, 0x0004}, {0x000f, 0x0005}, {0x0010, 0x0005}, - {0x000f, 0x0006}, {0x000f, 0x0007}, {0x0010, 0x0006}, {0x0011, 0x0006}, {0x0010, 0x0007}, {0x0013, 0x0000}, {0x0010, 0x0008}, {0x0010, 0x0009}, - {0x0013, 0x0001}, {0x0011, 0x0007}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, - {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, + { + { 0x0006, 0x0008 }, + { 0x0005, 0x0010 }, + { 0x0005, 0x0011 }, + { 0x0005, 0x0012 }, + { 0x0005, 0x0013 }, + { 0x0005, 0x0014 }, + { 0x0005, 0x0015 }, + { 0x0005, 0x0016 }, + { 0x0005, 0x0017 }, + { 0x0005, 0x0018 }, + { 0x0005, 0x0019 }, + { 0x0005, 0x001a }, + { 0x0005, 0x001b }, + { 0x0005, 0x001c }, + { 0x0005, 0x001d }, + { 0x0005, 0x001e }, + { 0x0006, 0x0009 }, + { 0x0005, 0x001f }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0006, 0x0014 }, + { 0x0006, 0x0015 }, + { 0x0006, 0x0016 }, + { 0x0006, 0x0017 }, + { 0x0006, 0x0018 }, + { 0x0006, 0x0019 }, + { 0x0006, 0x001a }, + { 0x0006, 0x001b }, + { 0x0006, 0x001c }, + { 0x0006, 0x001d }, + { 0x0006, 0x001e }, + { 0x0006, 0x001f }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0007, 0x0008 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000c, 0x0008 }, + { 0x000c, 0x0009 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x000e, 0x0006 }, + { 0x000e, 0x0007 }, + { 0x0010, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x0010, 0x0005 }, + { 0x000f, 0x0006 }, + { 0x000f, 0x0007 }, + { 0x0010, 0x0006 }, + { 0x0011, 0x0006 }, + { 0x0010, 0x0007 }, + { 0x0013, 0x0000 }, + { 0x0010, 0x0008 }, + { 0x0010, 0x0009 }, + { 0x0013, 0x0001 }, + { 0x0011, 0x0007 }, + { 0x0012, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec28[30][16] = -{ - {0x000fffff, 0x0010ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, }, - {0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, - {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, - {0x0015ffff, 0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00010028, 0x00010028, 0x00010029, 0x00010029, }, - {0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, - {0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, - {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, }, - {0x0019ffff, 0x0018ffff, 0x0016ffff, 0x0017ffff, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, }, - {0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004d, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, - {0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, - {0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020054, 0x00020054, 0x00020054, 0x00020054, }, - {0x001bffff, 0x001cffff, 0x001dffff, 0x001affff, 0x00000055, 0x00000057, 0x0000005a, 0x0000005c, 0x0000005e, 0x0000005f, 0x00010056, 0x00010056, 0x00010058, 0x00010058, 0x00010059, 0x00010059, }, - {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, 0x00030061, }, - {0x0001005d, 0x0001005d, 0x00010060, 0x00010060, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, }, - {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, - {0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, +const uint32_t c_aauiCQMFHuffDec28[30][16] = { + { + 0x000fffff, + 0x0010ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + }, + { + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + }, + { + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + }, + { + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + }, + { + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + }, + { + 0x0015ffff, + 0x0014ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x00000032, + 0x00000033, + 0x00000034, + 0x00000035, + 0x00000036, + 0x00000037, + 0x00000038, + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + }, + { + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + }, + { + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + }, + { + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + }, + { + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, + { + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + }, + { + 0x0019ffff, + 0x0018ffff, + 0x0016ffff, + 0x0017ffff, + 0x00000047, + 0x00000048, + 0x00000049, + 0x0000004a, + 0x0000004b, + 0x0000004c, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + }, + { + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004d, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + }, + { + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + }, + { + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020054, + 0x00020054, + 0x00020054, + 0x00020054, + }, + { + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001affff, + 0x00000055, + 0x00000057, + 0x0000005a, + 0x0000005c, + 0x0000005e, + 0x0000005f, + 0x00010056, + 0x00010056, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + }, + { + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + 0x00030061, + }, + { + 0x0001005d, + 0x0001005d, + 0x00010060, + 0x00010060, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + }, + { + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020068, + 0x00020068, + 0x00020068, + 0x00020068, + }, + { + 0x00020069, + 0x00020069, + 0x00020069, + 0x00020069, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + }, }; #endif @@ -2045,64 +20542,753 @@ const uint32_t c_aauiCQMFHuffEnc29[129][2] = #else const uint16_t c_aauiCQMFHuffEnc29[129][2] = #endif -{ - {0x0006, 0x0009}, {0x0005, 0x0019}, {0x0006, 0x000a}, {0x0005, 0x001a}, {0x0005, 0x001b}, {0x0005, 0x001c}, {0x0006, 0x000b}, {0x0005, 0x001d}, - {0x0005, 0x001e}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0005, 0x001f}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, - {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, - {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, - {0x0006, 0x0022}, {0x0006, 0x0023}, {0x0006, 0x0024}, {0x0006, 0x0025}, {0x0006, 0x0026}, {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0006, 0x0029}, - {0x0006, 0x002a}, {0x0006, 0x002b}, {0x0006, 0x002c}, {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0006, 0x0030}, {0x0006, 0x0031}, - {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, - {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, - {0x0009, 0x000b}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, - {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, - {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, - {0x000d, 0x000b}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, - {0x000f, 0x0007}, {0x0011, 0x0007}, {0x000f, 0x0008}, {0x0012, 0x0000}, {0x000f, 0x0009}, {0x0010, 0x0005}, {0x000f, 0x000a}, {0x000f, 0x000b}, - {0x0012, 0x0001}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, - {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0011, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, - {0x0011, 0x0009}, + { + { 0x0006, 0x0009 }, + { 0x0005, 0x0019 }, + { 0x0006, 0x000a }, + { 0x0005, 0x001a }, + { 0x0005, 0x001b }, + { 0x0005, 0x001c }, + { 0x0006, 0x000b }, + { 0x0005, 0x001d }, + { 0x0005, 0x001e }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0005, 0x001f }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0006, 0x0014 }, + { 0x0006, 0x0015 }, + { 0x0006, 0x0016 }, + { 0x0006, 0x0017 }, + { 0x0006, 0x0018 }, + { 0x0006, 0x0019 }, + { 0x0006, 0x001a }, + { 0x0006, 0x001b }, + { 0x0006, 0x001c }, + { 0x0006, 0x001d }, + { 0x0006, 0x001e }, + { 0x0006, 0x001f }, + { 0x0006, 0x0020 }, + { 0x0006, 0x0021 }, + { 0x0006, 0x0022 }, + { 0x0006, 0x0023 }, + { 0x0006, 0x0024 }, + { 0x0006, 0x0025 }, + { 0x0006, 0x0026 }, + { 0x0006, 0x0027 }, + { 0x0006, 0x0028 }, + { 0x0006, 0x0029 }, + { 0x0006, 0x002a }, + { 0x0006, 0x002b }, + { 0x0006, 0x002c }, + { 0x0006, 0x002d }, + { 0x0006, 0x002e }, + { 0x0006, 0x002f }, + { 0x0006, 0x0030 }, + { 0x0006, 0x0031 }, + { 0x0007, 0x0007 }, + { 0x0007, 0x0008 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000a, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000c, 0x0008 }, + { 0x000c, 0x0009 }, + { 0x000c, 0x000a }, + { 0x000c, 0x000b }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000d, 0x000a }, + { 0x000d, 0x000b }, + { 0x000e, 0x0006 }, + { 0x000e, 0x0007 }, + { 0x000e, 0x0008 }, + { 0x000e, 0x0009 }, + { 0x000f, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x000f, 0x0006 }, + { 0x000f, 0x0007 }, + { 0x0011, 0x0007 }, + { 0x000f, 0x0008 }, + { 0x0012, 0x0000 }, + { 0x000f, 0x0009 }, + { 0x0010, 0x0005 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, + { 0x0012, 0x0001 }, + { 0x0010, 0x0006 }, + { 0x0010, 0x0007 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0012, 0x0008 }, + { 0x0011, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, + { 0x0012, 0x000c }, + { 0x0012, 0x000d }, + { 0x0011, 0x0009 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec29[34][16] = -{ - {0x000fffff, 0x0010ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, }, - {0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, 0x00030001, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020006, 0x00020006, 0x00020006, 0x00020006, }, - {0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, - {0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, }, - {0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, }, - {0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, }, - {0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, - {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, }, - {0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, }, - {0x0016ffff, 0x0014ffff, 0x0015ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0000003b, 0x0000003c, 0x0000003d, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00010030, 0x00010030, }, - {0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, }, - {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, - {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, }, - {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, - {0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, }, - {0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004e, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, - {0x001cffff, 0x001bffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x00010050, 0x00010050, 0x00010051, 0x00010051, }, - {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, - {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, }, - {0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, }, - {0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, - {0x0001006a, 0x0001006a, 0x0001006c, 0x0001006c, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, }, - {0x001fffff, 0x0020ffff, 0x0021ffff, 0x001dffff, 0x001effff, 0x0000006d, 0x00000071, 0x00000072, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, }, - {0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, - {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, }, - {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, }, - {0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, - {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, }, +const uint32_t c_aauiCQMFHuffDec29[34][16] = { + { + 0x000fffff, + 0x0010ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + }, + { + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + 0x00030001, + }, + { + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x00010039, + 0x00010039, + 0x0001003a, + 0x0001003a, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + }, + { + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + }, + { + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + }, + { + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + }, + { + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + }, + { + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + }, + { + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + }, + { + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + }, + { + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002d, + }, + { + 0x0016ffff, + 0x0014ffff, + 0x0015ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0000003b, + 0x0000003c, + 0x0000003d, + 0x0000003e, + 0x0000003f, + 0x00000040, + 0x00000041, + 0x00000042, + 0x00010030, + 0x00010030, + }, + { + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + }, + { + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + }, + { + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + }, + { + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + }, + { + 0x00010052, + 0x00010052, + 0x00010053, + 0x00010053, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004b, + }, + { + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x0002004e, + 0x0002004e, + 0x0002004e, + 0x0002004e, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x0002004f, + }, + { + 0x001cffff, + 0x001bffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x00000054, + 0x00000055, + 0x00000056, + 0x00000057, + 0x00000058, + 0x00000059, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + }, + { + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + }, + { + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + }, + { + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + }, + { + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + }, + { + 0x0001006a, + 0x0001006a, + 0x0001006c, + 0x0001006c, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + }, + { + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x001dffff, + 0x001effff, + 0x0000006d, + 0x00000071, + 0x00000072, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + }, + { + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + }, + { + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + }, + { + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + }, + { + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + }, + { + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007d, + }, }; #endif @@ -2111,72 +21297,867 @@ const uint32_t c_aauiCQMFHuffEnc30[153][2] = #else const uint16_t c_aauiCQMFHuffEnc30[153][2] = #endif -{ - {0x0007, 0x0009}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0006, 0x0014}, - {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, {0x0006, 0x001c}, - {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, {0x0006, 0x0023}, {0x0006, 0x0024}, - {0x0006, 0x0025}, {0x0006, 0x0026}, {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0006, 0x0029}, {0x0006, 0x002a}, {0x0006, 0x002b}, {0x0006, 0x002c}, - {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0006, 0x0030}, {0x0006, 0x0031}, {0x0006, 0x0032}, {0x0006, 0x0033}, {0x0006, 0x0034}, - {0x0006, 0x0035}, {0x0006, 0x0036}, {0x0006, 0x0037}, {0x0006, 0x0038}, {0x0006, 0x0039}, {0x0006, 0x003a}, {0x0006, 0x003b}, {0x0006, 0x003c}, - {0x0006, 0x003d}, {0x0006, 0x003e}, {0x0006, 0x003f}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, - {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0007, 0x0015}, {0x0007, 0x0016}, - {0x0007, 0x0017}, {0x0007, 0x0018}, {0x0007, 0x0019}, {0x0007, 0x001a}, {0x0007, 0x001b}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0009, 0x0007}, - {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x000a, 0x0008}, - {0x0009, 0x000f}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000b, 0x0007}, {0x000b, 0x0008}, - {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000c, 0x0008}, {0x000b, 0x000e}, {0x000b, 0x000f}, - {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000d, 0x0008}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000d, 0x0009}, {0x000c, 0x000d}, {0x000d, 0x000a}, - {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000e, 0x0008}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000e, 0x0009}, {0x000e, 0x000a}, - {0x000e, 0x000b}, {0x000e, 0x000c}, {0x000f, 0x0006}, {0x000f, 0x0007}, {0x000f, 0x0008}, {0x0010, 0x0006}, {0x000e, 0x000d}, {0x000e, 0x000e}, - {0x000e, 0x000f}, {0x0010, 0x0007}, {0x000f, 0x0009}, {0x0010, 0x0008}, {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000f, 0x000c}, {0x000f, 0x000d}, - {0x0010, 0x0009}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, {0x000f, 0x000e}, {0x0010, 0x000a}, {0x0011, 0x0003}, {0x0011, 0x0004}, - {0x0011, 0x0005}, {0x000f, 0x000f}, {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0011, 0x000a}, {0x0011, 0x000b}, - {0x0010, 0x000b}, + { + { 0x0007, 0x0009 }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0006, 0x0014 }, + { 0x0006, 0x0015 }, + { 0x0006, 0x0016 }, + { 0x0006, 0x0017 }, + { 0x0006, 0x0018 }, + { 0x0006, 0x0019 }, + { 0x0006, 0x001a }, + { 0x0006, 0x001b }, + { 0x0006, 0x001c }, + { 0x0006, 0x001d }, + { 0x0006, 0x001e }, + { 0x0006, 0x001f }, + { 0x0006, 0x0020 }, + { 0x0006, 0x0021 }, + { 0x0006, 0x0022 }, + { 0x0006, 0x0023 }, + { 0x0006, 0x0024 }, + { 0x0006, 0x0025 }, + { 0x0006, 0x0026 }, + { 0x0006, 0x0027 }, + { 0x0006, 0x0028 }, + { 0x0006, 0x0029 }, + { 0x0006, 0x002a }, + { 0x0006, 0x002b }, + { 0x0006, 0x002c }, + { 0x0006, 0x002d }, + { 0x0006, 0x002e }, + { 0x0006, 0x002f }, + { 0x0006, 0x0030 }, + { 0x0006, 0x0031 }, + { 0x0006, 0x0032 }, + { 0x0006, 0x0033 }, + { 0x0006, 0x0034 }, + { 0x0006, 0x0035 }, + { 0x0006, 0x0036 }, + { 0x0006, 0x0037 }, + { 0x0006, 0x0038 }, + { 0x0006, 0x0039 }, + { 0x0006, 0x003a }, + { 0x0006, 0x003b }, + { 0x0006, 0x003c }, + { 0x0006, 0x003d }, + { 0x0006, 0x003e }, + { 0x0006, 0x003f }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0007, 0x0012 }, + { 0x0007, 0x0013 }, + { 0x0007, 0x0014 }, + { 0x0007, 0x0015 }, + { 0x0007, 0x0016 }, + { 0x0007, 0x0017 }, + { 0x0007, 0x0018 }, + { 0x0007, 0x0019 }, + { 0x0007, 0x001a }, + { 0x0007, 0x001b }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0008, 0x000e }, + { 0x0008, 0x000f }, + { 0x0008, 0x0010 }, + { 0x0008, 0x0011 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x0009, 0x000c }, + { 0x0009, 0x000d }, + { 0x0009, 0x000e }, + { 0x000a, 0x0008 }, + { 0x0009, 0x000f }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000b, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000b, 0x000a }, + { 0x000b, 0x000b }, + { 0x000b, 0x000c }, + { 0x000b, 0x000d }, + { 0x000c, 0x0008 }, + { 0x000b, 0x000e }, + { 0x000b, 0x000f }, + { 0x000c, 0x0009 }, + { 0x000c, 0x000a }, + { 0x000d, 0x0008 }, + { 0x000c, 0x000b }, + { 0x000c, 0x000c }, + { 0x000d, 0x0009 }, + { 0x000c, 0x000d }, + { 0x000d, 0x000a }, + { 0x000d, 0x000b }, + { 0x000d, 0x000c }, + { 0x000d, 0x000d }, + { 0x000e, 0x0008 }, + { 0x000d, 0x000e }, + { 0x000d, 0x000f }, + { 0x000e, 0x0009 }, + { 0x000e, 0x000a }, + { 0x000e, 0x000b }, + { 0x000e, 0x000c }, + { 0x000f, 0x0006 }, + { 0x000f, 0x0007 }, + { 0x000f, 0x0008 }, + { 0x0010, 0x0006 }, + { 0x000e, 0x000d }, + { 0x000e, 0x000e }, + { 0x000e, 0x000f }, + { 0x0010, 0x0007 }, + { 0x000f, 0x0009 }, + { 0x0010, 0x0008 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, + { 0x000f, 0x000c }, + { 0x000f, 0x000d }, + { 0x0010, 0x0009 }, + { 0x0011, 0x0000 }, + { 0x0011, 0x0001 }, + { 0x0011, 0x0002 }, + { 0x000f, 0x000e }, + { 0x0010, 0x000a }, + { 0x0011, 0x0003 }, + { 0x0011, 0x0004 }, + { 0x0011, 0x0005 }, + { 0x000f, 0x000f }, + { 0x0011, 0x0006 }, + { 0x0011, 0x0007 }, + { 0x0011, 0x0008 }, + { 0x0011, 0x0009 }, + { 0x0011, 0x000a }, + { 0x0011, 0x000b }, + { 0x0010, 0x000b }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec30[39][16] = -{ - {0x0010ffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, }, - {0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, - {0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, }, - {0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, - {0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, - {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, - {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, - {0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, - {0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, }, - {0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, 0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, }, - {0x0000004d, 0x0000004e, 0x00010000, 0x00010000, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, }, - {0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, }, - {0x0017ffff, 0x0018ffff, 0x0016ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004a, 0x0000004b, 0x0000004c, }, - {0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, - {0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, }, - {0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, }, - {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, - {0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, - {0x00020057, 0x00020057, 0x00020057, 0x00020057, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, }, - {0x001fffff, 0x0020ffff, 0x001dffff, 0x001effff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x00000065, 0x00000068, 0x00000069, 0x0000006b, 0x0000006c, 0x0000006e, 0x0001005e, 0x0001005e, }, - {0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010066, 0x00010066, 0x00010067, 0x00010067, }, - {0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006a, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, 0x0003006d, }, - {0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, }, - {0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, }, - {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, 0x00030075, }, - {0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, - {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, - {0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0000007d, 0x00000081, 0x00000083, 0x00000088, 0x0000008d, 0x00000098, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, }, - {0x0001007c, 0x0001007c, 0x00010082, 0x00010082, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x0001008c, 0x0001008c, 0x00010091, 0x00010091, }, - {0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x00030089, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, }, - {0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, 0x0003008e, }, - {0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x0003008f, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, }, - {0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, 0x00030093, }, - {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, 0x00030095, }, - {0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030096, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, 0x00030097, }, +const uint32_t c_aauiCQMFHuffDec30[39][16] = { + { + 0x0010ffff, + 0x000effff, + 0x000fffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + }, + { + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + }, + { + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + }, + { + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + }, + { + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + }, + { + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, + { + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + }, + { + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + }, + { + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + }, + { + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + }, + { + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + }, + { + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020032, + 0x00020032, + 0x00020032, + 0x00020032, + }, + { + 0x0000004d, + 0x0000004e, + 0x00010000, + 0x00010000, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + }, + { + 0x00010039, + 0x00010039, + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + }, + { + 0x0017ffff, + 0x0018ffff, + 0x0016ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x00000045, + 0x00000046, + 0x00000047, + 0x00000048, + 0x00000049, + 0x0000004a, + 0x0000004b, + 0x0000004c, + }, + { + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + }, + { + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + }, + { + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + }, + { + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + }, + { + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + }, + { + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020057, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + }, + { + 0x001fffff, + 0x0020ffff, + 0x001dffff, + 0x001effff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x00000065, + 0x00000068, + 0x00000069, + 0x0000006b, + 0x0000006c, + 0x0000006e, + 0x0001005e, + 0x0001005e, + }, + { + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + 0x00010064, + 0x00010064, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + }, + { + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006a, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + 0x0003006d, + }, + { + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + }, + { + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + }, + { + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + 0x00030075, + }, + { + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + }, + { + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + }, + { + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0025ffff, + 0x0026ffff, + 0x0000007d, + 0x00000081, + 0x00000083, + 0x00000088, + 0x0000008d, + 0x00000098, + 0x0001007a, + 0x0001007a, + 0x0001007b, + 0x0001007b, + }, + { + 0x0001007c, + 0x0001007c, + 0x00010082, + 0x00010082, + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010087, + 0x00010087, + 0x0001008c, + 0x0001008c, + 0x00010091, + 0x00010091, + }, + { + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x00030089, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + }, + { + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + 0x0003008e, + }, + { + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x0003008f, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + }, + { + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + 0x00030093, + }, + { + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + 0x00030095, + }, + { + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030096, + 0x00030097, + 0x00030097, + 0x00030097, + 0x00030097, + 0x00030097, + 0x00030097, + 0x00030097, + 0x00030097, + }, }; #endif @@ -2185,79 +22166,967 @@ const uint32_t c_aauiCQMFHuffEnc31[181][2] = #else const uint16_t c_aauiCQMFHuffEnc31[181][2] = #endif -{ - {0x0007, 0x000b}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0006, 0x0018}, {0x0006, 0x0019}, {0x0006, 0x001a}, {0x0006, 0x001b}, - {0x0006, 0x001c}, {0x0006, 0x001d}, {0x0006, 0x001e}, {0x0006, 0x001f}, {0x0006, 0x0020}, {0x0006, 0x0021}, {0x0006, 0x0022}, {0x0006, 0x0023}, - {0x0006, 0x0024}, {0x0006, 0x0025}, {0x0006, 0x0026}, {0x0006, 0x0027}, {0x0006, 0x0028}, {0x0006, 0x0029}, {0x0006, 0x002a}, {0x0006, 0x002b}, - {0x0006, 0x002c}, {0x0006, 0x002d}, {0x0006, 0x002e}, {0x0006, 0x002f}, {0x0006, 0x0030}, {0x0006, 0x0031}, {0x0006, 0x0032}, {0x0006, 0x0033}, - {0x0006, 0x0034}, {0x0006, 0x0035}, {0x0006, 0x0036}, {0x0006, 0x0037}, {0x0006, 0x0038}, {0x0006, 0x0039}, {0x0006, 0x003a}, {0x0006, 0x003b}, - {0x0006, 0x003c}, {0x0006, 0x003d}, {0x0006, 0x003e}, {0x0007, 0x000c}, {0x0006, 0x003f}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, - {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0007, 0x0015}, {0x0007, 0x0016}, {0x0007, 0x0017}, - {0x0007, 0x0018}, {0x0007, 0x0019}, {0x0007, 0x001a}, {0x0007, 0x001b}, {0x0007, 0x001c}, {0x0007, 0x001d}, {0x0007, 0x001e}, {0x0007, 0x001f}, - {0x0007, 0x0020}, {0x0007, 0x0021}, {0x0007, 0x0022}, {0x0007, 0x0023}, {0x0007, 0x0024}, {0x0007, 0x0025}, {0x0007, 0x0026}, {0x0007, 0x0027}, - {0x0007, 0x0028}, {0x0007, 0x0029}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, - {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0008, 0x0012}, {0x0008, 0x0013}, {0x0008, 0x0014}, {0x0008, 0x0015}, {0x0009, 0x0008}, - {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, - {0x0009, 0x0011}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000a, 0x000e}, - {0x000a, 0x000f}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000b, 0x000e}, - {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000b, 0x000f}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000c, 0x000d}, {0x000d, 0x0008}, - {0x000c, 0x000e}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000c, 0x000f}, {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, - {0x000d, 0x000f}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000e, 0x000b}, {0x000e, 0x000c}, {0x000e, 0x000d}, {0x000e, 0x000e}, - {0x000e, 0x000f}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000f, 0x000c}, {0x0010, 0x0009}, {0x000f, 0x000d}, {0x000f, 0x000e}, - {0x0010, 0x000a}, {0x0010, 0x000b}, {0x0010, 0x000c}, {0x0010, 0x000d}, {0x0011, 0x000a}, {0x0010, 0x000e}, {0x000f, 0x000f}, {0x0010, 0x000f}, - {0x0012, 0x0000}, {0x0012, 0x0001}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x0010, 0x0010}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0011, 0x000d}, - {0x0011, 0x000e}, {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0010, 0x0011}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, - {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, - {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, + { + { 0x0007, 0x000b }, + { 0x0006, 0x0015 }, + { 0x0006, 0x0016 }, + { 0x0006, 0x0017 }, + { 0x0006, 0x0018 }, + { 0x0006, 0x0019 }, + { 0x0006, 0x001a }, + { 0x0006, 0x001b }, + { 0x0006, 0x001c }, + { 0x0006, 0x001d }, + { 0x0006, 0x001e }, + { 0x0006, 0x001f }, + { 0x0006, 0x0020 }, + { 0x0006, 0x0021 }, + { 0x0006, 0x0022 }, + { 0x0006, 0x0023 }, + { 0x0006, 0x0024 }, + { 0x0006, 0x0025 }, + { 0x0006, 0x0026 }, + { 0x0006, 0x0027 }, + { 0x0006, 0x0028 }, + { 0x0006, 0x0029 }, + { 0x0006, 0x002a }, + { 0x0006, 0x002b }, + { 0x0006, 0x002c }, + { 0x0006, 0x002d }, + { 0x0006, 0x002e }, + { 0x0006, 0x002f }, + { 0x0006, 0x0030 }, + { 0x0006, 0x0031 }, + { 0x0006, 0x0032 }, + { 0x0006, 0x0033 }, + { 0x0006, 0x0034 }, + { 0x0006, 0x0035 }, + { 0x0006, 0x0036 }, + { 0x0006, 0x0037 }, + { 0x0006, 0x0038 }, + { 0x0006, 0x0039 }, + { 0x0006, 0x003a }, + { 0x0006, 0x003b }, + { 0x0006, 0x003c }, + { 0x0006, 0x003d }, + { 0x0006, 0x003e }, + { 0x0007, 0x000c }, + { 0x0006, 0x003f }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0007, 0x0012 }, + { 0x0007, 0x0013 }, + { 0x0007, 0x0014 }, + { 0x0007, 0x0015 }, + { 0x0007, 0x0016 }, + { 0x0007, 0x0017 }, + { 0x0007, 0x0018 }, + { 0x0007, 0x0019 }, + { 0x0007, 0x001a }, + { 0x0007, 0x001b }, + { 0x0007, 0x001c }, + { 0x0007, 0x001d }, + { 0x0007, 0x001e }, + { 0x0007, 0x001f }, + { 0x0007, 0x0020 }, + { 0x0007, 0x0021 }, + { 0x0007, 0x0022 }, + { 0x0007, 0x0023 }, + { 0x0007, 0x0024 }, + { 0x0007, 0x0025 }, + { 0x0007, 0x0026 }, + { 0x0007, 0x0027 }, + { 0x0007, 0x0028 }, + { 0x0007, 0x0029 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0008, 0x000e }, + { 0x0008, 0x000f }, + { 0x0008, 0x0010 }, + { 0x0008, 0x0011 }, + { 0x0008, 0x0012 }, + { 0x0008, 0x0013 }, + { 0x0008, 0x0014 }, + { 0x0008, 0x0015 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x0009, 0x000c }, + { 0x0009, 0x000d }, + { 0x0009, 0x000e }, + { 0x0009, 0x000f }, + { 0x0009, 0x0010 }, + { 0x0009, 0x0011 }, + { 0x000a, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000a, 0x000e }, + { 0x000a, 0x000f }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000b, 0x000a }, + { 0x000b, 0x000b }, + { 0x000b, 0x000c }, + { 0x000b, 0x000d }, + { 0x000b, 0x000e }, + { 0x000c, 0x0008 }, + { 0x000c, 0x0009 }, + { 0x000b, 0x000f }, + { 0x000c, 0x000a }, + { 0x000c, 0x000b }, + { 0x000c, 0x000c }, + { 0x000c, 0x000d }, + { 0x000d, 0x0008 }, + { 0x000c, 0x000e }, + { 0x000d, 0x0009 }, + { 0x000d, 0x000a }, + { 0x000c, 0x000f }, + { 0x000d, 0x000b }, + { 0x000d, 0x000c }, + { 0x000d, 0x000d }, + { 0x000d, 0x000e }, + { 0x000d, 0x000f }, + { 0x000e, 0x0008 }, + { 0x000e, 0x0009 }, + { 0x000e, 0x000a }, + { 0x000e, 0x000b }, + { 0x000e, 0x000c }, + { 0x000e, 0x000d }, + { 0x000e, 0x000e }, + { 0x000e, 0x000f }, + { 0x000f, 0x0009 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, + { 0x000f, 0x000c }, + { 0x0010, 0x0009 }, + { 0x000f, 0x000d }, + { 0x000f, 0x000e }, + { 0x0010, 0x000a }, + { 0x0010, 0x000b }, + { 0x0010, 0x000c }, + { 0x0010, 0x000d }, + { 0x0011, 0x000a }, + { 0x0010, 0x000e }, + { 0x000f, 0x000f }, + { 0x0010, 0x000f }, + { 0x0012, 0x0000 }, + { 0x0012, 0x0001 }, + { 0x0011, 0x000b }, + { 0x0011, 0x000c }, + { 0x0010, 0x0010 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0011, 0x000d }, + { 0x0011, 0x000e }, + { 0x0011, 0x000f }, + { 0x0011, 0x0010 }, + { 0x0011, 0x0011 }, + { 0x0010, 0x0011 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, + { 0x0012, 0x000c }, + { 0x0012, 0x000d }, + { 0x0012, 0x000e }, + { 0x0012, 0x000f }, + { 0x0012, 0x0010 }, + { 0x0012, 0x0011 }, + { 0x0012, 0x0012 }, + { 0x0012, 0x0013 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec31[43][16] = -{ - {0x0010ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, }, - {0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020003, 0x00020003, 0x00020003, 0x00020003, }, - {0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00020007, 0x00020007, 0x00020007, 0x00020007, }, - {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, - {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, }, - {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, - {0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00010000, 0x00010000, 0x0001002b, 0x0001002b, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, }, - {0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, }, - {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, }, - {0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, }, - {0x0019ffff, 0x0018ffff, 0x0016ffff, 0x0017ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, }, - {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, - {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, - {0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, }, - {0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005d, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, 0x0003005e, }, - {0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x0003005f, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, 0x00030060, }, - {0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, }, - {0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, - {0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010072, 0x00010072, }, - {0x0021ffff, 0x0020ffff, 0x001effff, 0x001fffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x00000070, 0x00000071, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000078, 0x0000007b, }, - {0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, }, - {0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, 0x0003007c, }, - {0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, }, - {0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x0003007f, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, 0x00030080, }, - {0x00020081, 0x00020081, 0x00020081, 0x00020081, 0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, }, - {0x00020085, 0x00020085, 0x00020085, 0x00020085, 0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, }, - {0x0000009c, 0x000000a4, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010096, 0x00010096, }, - {0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0000008d, 0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000095, 0x00000097, }, - {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, 0x0003009a, }, - {0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009b, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, 0x0003009f, }, - {0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a0, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, 0x000300a1, }, - {0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, - {0x00020098, 0x00020098, 0x00020098, 0x00020098, 0x00020099, 0x00020099, 0x00020099, 0x00020099, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009d, 0x0002009e, 0x0002009e, 0x0002009e, 0x0002009e, }, - {0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, }, - {0x000200a9, 0x000200a9, 0x000200a9, 0x000200a9, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ab, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, }, - {0x000200ad, 0x000200ad, 0x000200ad, 0x000200ad, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200ae, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200b0, 0x000200b0, 0x000200b0, 0x000200b0, }, - {0x000200b1, 0x000200b1, 0x000200b1, 0x000200b1, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b2, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b3, 0x000200b4, 0x000200b4, 0x000200b4, 0x000200b4, }, +const uint32_t c_aauiCQMFHuffDec31[43][16] = { + { + 0x0010ffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + }, + { + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + }, + { + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020007, + }, + { + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + }, + { + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + }, + { + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + }, + { + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + }, + { + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + }, + { + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + }, + { + 0x00000051, + 0x00000052, + 0x00000053, + 0x00000054, + 0x00000055, + 0x00000056, + 0x00010000, + 0x00010000, + 0x0001002b, + 0x0001002b, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + }, + { + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + }, + { + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + }, + { + 0x00010040, + 0x00010040, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + }, + { + 0x0019ffff, + 0x0018ffff, + 0x0016ffff, + 0x0017ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0000004a, + 0x0000004b, + 0x0000004c, + 0x0000004d, + 0x0000004e, + 0x0000004f, + 0x00000050, + }, + { + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + }, + { + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + }, + { + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + }, + { + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005d, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + 0x0003005e, + }, + { + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x0003005f, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + 0x00030060, + }, + { + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + }, + { + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020068, + 0x00020068, + 0x00020068, + 0x00020068, + }, + { + 0x00010069, + 0x00010069, + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + 0x0001006c, + 0x0001006c, + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00010072, + 0x00010072, + }, + { + 0x0021ffff, + 0x0020ffff, + 0x001effff, + 0x001fffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x00000070, + 0x00000071, + 0x00000073, + 0x00000074, + 0x00000075, + 0x00000076, + 0x00000078, + 0x0000007b, + }, + { + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + }, + { + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + 0x0003007c, + }, + { + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + }, + { + 0x0003007f, + 0x0003007f, + 0x0003007f, + 0x0003007f, + 0x0003007f, + 0x0003007f, + 0x0003007f, + 0x0003007f, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + 0x00030080, + }, + { + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020084, + }, + { + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020088, + }, + { + 0x0000009c, + 0x000000a4, + 0x00010089, + 0x00010089, + 0x0001008a, + 0x0001008a, + 0x0001008b, + 0x0001008b, + 0x0001008c, + 0x0001008c, + 0x0001008e, + 0x0001008e, + 0x0001008f, + 0x0001008f, + 0x00010096, + 0x00010096, + }, + { + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0025ffff, + 0x0000008d, + 0x00000090, + 0x00000091, + 0x00000092, + 0x00000093, + 0x00000095, + 0x00000097, + }, + { + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + 0x0003009a, + }, + { + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009b, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + 0x0003009f, + }, + { + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a0, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + 0x000300a1, + }, + { + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + }, + { + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020098, + 0x00020099, + 0x00020099, + 0x00020099, + 0x00020099, + 0x0002009d, + 0x0002009d, + 0x0002009d, + 0x0002009d, + 0x0002009e, + 0x0002009e, + 0x0002009e, + 0x0002009e, + }, + { + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + }, + { + 0x000200a9, + 0x000200a9, + 0x000200a9, + 0x000200a9, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ab, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200ac, + }, + { + 0x000200ad, + 0x000200ad, + 0x000200ad, + 0x000200ad, + 0x000200ae, + 0x000200ae, + 0x000200ae, + 0x000200ae, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200b0, + 0x000200b0, + 0x000200b0, + 0x000200b0, + }, + { + 0x000200b1, + 0x000200b1, + 0x000200b1, + 0x000200b1, + 0x000200b2, + 0x000200b2, + 0x000200b2, + 0x000200b2, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b3, + 0x000200b4, + 0x000200b4, + 0x000200b4, + 0x000200b4, + }, }; #endif @@ -2266,16 +23135,63 @@ const uint32_t c_aauiCQMFHuffEnc33[16][2] = #else const uint16_t c_aauiCQMFHuffEnc33[16][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, - {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, -}; + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0008, 0x0000 }, + { 0x0008, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec33[2][16] = -{ - {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +const uint32_t c_aauiCQMFHuffDec33[2][16] = { + { + 0x0001ffff, + 0x00000005, + 0x00010001, + 0x00010001, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00000002, + 0x00000003, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + }, }; #endif @@ -2284,16 +23200,63 @@ const uint32_t c_aauiCQMFHuffEnc34[16][2] = #else const uint16_t c_aauiCQMFHuffEnc34[16][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0008, 0x0000}, {0x0008, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0008, 0x0002}, {0x0008, 0x0003}, - {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, -}; + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0008, 0x0000 }, + { 0x0008, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec34[2][16] = -{ - {0x0001ffff, 0x00000005, 0x00010001, 0x00010001, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00000002, 0x00000003, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +const uint32_t c_aauiCQMFHuffDec34[2][16] = { + { + 0x0001ffff, + 0x00000005, + 0x00010001, + 0x00010001, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00000002, + 0x00000003, + 0x00000006, + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + }, }; #endif @@ -2302,26 +23265,199 @@ const uint32_t c_aauiCQMFHuffEnc35[25][2] = #else const uint16_t c_aauiCQMFHuffEnc35[25][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0007, 0x0006}, {0x0009, 0x0000}, {0x0009, 0x0001}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0009, 0x0002}, - {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0007, 0x0007}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, - {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0007, 0x0006 }, + { 0x0009, 0x0000 }, + { 0x0009, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x0007, 0x0007 }, + { 0x0009, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x0009, 0x000c }, + { 0x0009, 0x000d }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec35[9][16] = -{ - {0x0001ffff, 0x00000006, 0x00010001, 0x00010001, 0x00020005, 0x00020005, 0x00020005, 0x00020005, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0007ffff, 0x0008ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0006ffff, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00010002, 0x00010002, 0x0001000a, 0x0001000a, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, +const uint32_t c_aauiCQMFHuffDec35[9][16] = { + { + 0x0001ffff, + 0x00000006, + 0x00010001, + 0x00010001, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0007ffff, + 0x0008ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0006ffff, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000018, + 0x00010002, + 0x00010002, + 0x0001000a, + 0x0001000a, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + }, + { + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, }; #endif @@ -2330,25 +23466,174 @@ const uint32_t c_aauiCQMFHuffEnc36[36][2] = #else const uint16_t c_aauiCQMFHuffEnc36[36][2] = #endif -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0002}, {0x000b, 0x0000}, {0x000b, 0x0001}, {0x000b, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, - {0x0008, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x0006, 0x0003}, {0x0007, 0x0003}, {0x000b, 0x0006}, {0x000b, 0x0007}, - {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000b, 0x000e}, {0x000b, 0x000f}, - {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000a, 0x000e}, {0x000a, 0x000f}, - {0x000a, 0x0010}, {0x000a, 0x0011}, {0x000a, 0x0012}, {0x000a, 0x0013}, + { + { 0x0001, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0006, 0x0002 }, + { 0x000b, 0x0000 }, + { 0x000b, 0x0001 }, + { 0x000b, 0x0002 }, + { 0x0003, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0008, 0x0005 }, + { 0x000b, 0x0003 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x0006, 0x0003 }, + { 0x0007, 0x0003 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000b, 0x000a }, + { 0x000b, 0x000b }, + { 0x000b, 0x000c }, + { 0x000b, 0x000d }, + { 0x000b, 0x000e }, + { 0x000b, 0x000f }, + { 0x000a, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000a, 0x000e }, + { 0x000a, 0x000f }, + { 0x000a, 0x0010 }, + { 0x000a, 0x0011 }, + { 0x000a, 0x0012 }, + { 0x000a, 0x0013 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec36[7][16] = -{ - {0x0001ffff, 0x00000007, 0x00010006, 0x00010006, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0006ffff, 0x0005ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000008, 0x0001000d, 0x0001000d, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, - {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, }, - {0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, }, - {0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, }, - {0x00010003, 0x00010003, 0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, +const uint32_t c_aauiCQMFHuffDec36[7][16] = { + { + 0x0001ffff, + 0x00000007, + 0x00010006, + 0x00010006, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x00000008, + 0x0001000d, + 0x0001000d, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + }, + { + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + }, + { + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + }, + { + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + }, + { + 0x00010003, + 0x00010003, + 0x00010004, + 0x00010004, + 0x00010005, + 0x00010005, + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + }, }; #endif @@ -2357,22 +23642,120 @@ const uint32_t c_aauiCQMFHuffEnc37[36][2] = #else const uint16_t c_aauiCQMFHuffEnc37[36][2] = #endif -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0000}, {0x000c, 0x0001}, {0x000c, 0x0002}, {0x0003, 0x0001}, {0x0004, 0x0001}, - {0x0006, 0x0002}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x000a, 0x0007}, {0x000c, 0x0006}, - {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000c, 0x000d}, {0x000c, 0x000e}, - {0x000c, 0x000f}, {0x000c, 0x0010}, {0x000c, 0x0011}, {0x000c, 0x0012}, {0x000c, 0x0013}, {0x000c, 0x0014}, {0x000c, 0x0015}, {0x000c, 0x0016}, - {0x000c, 0x0017}, {0x000c, 0x0018}, {0x000c, 0x0019}, {0x000b, 0x000d}, + { + { 0x0001, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000c, 0x0000 }, + { 0x000c, 0x0001 }, + { 0x000c, 0x0002 }, + { 0x0003, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0006, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x0006, 0x0003 }, + { 0x0007, 0x0001 }, + { 0x000a, 0x0007 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000c, 0x0008 }, + { 0x000c, 0x0009 }, + { 0x000c, 0x000a }, + { 0x000c, 0x000b }, + { 0x000c, 0x000c }, + { 0x000c, 0x000d }, + { 0x000c, 0x000e }, + { 0x000c, 0x000f }, + { 0x000c, 0x0010 }, + { 0x000c, 0x0011 }, + { 0x000c, 0x0012 }, + { 0x000c, 0x0013 }, + { 0x000c, 0x0014 }, + { 0x000c, 0x0015 }, + { 0x000c, 0x0016 }, + { 0x000c, 0x0017 }, + { 0x000c, 0x0018 }, + { 0x000c, 0x0019 }, + { 0x000b, 0x000d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec37[4][16] = -{ - {0x0001ffff, 0x00000007, 0x00010006, 0x00010006, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0002ffff, 0x0001000d, 0x0001000d, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, - {0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00010023, 0x00010023, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, - {0x00000003, 0x00000004, 0x00000005, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000f, 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, }, +const uint32_t c_aauiCQMFHuffDec37[4][16] = { + { + 0x0001ffff, + 0x00000007, + 0x00010006, + 0x00010006, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003ffff, + 0x0002ffff, + 0x0001000d, + 0x0001000d, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + }, + { + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x0000001c, + 0x0000001d, + 0x0000001e, + 0x0000001f, + 0x00000020, + 0x00000021, + 0x00000022, + 0x00010023, + 0x00010023, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + }, + { + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x0000000f, + 0x00000010, + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000014, + 0x00000015, + 0x00000016, + 0x00000017, + 0x00000018, + }, }; #endif @@ -2381,42 +23764,457 @@ const uint32_t c_aauiCQMFHuffEnc38[49][2] = #else const uint16_t c_aauiCQMFHuffEnc38[49][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000c, 0x0012}, {0x000d, 0x0000}, {0x000d, 0x0001}, {0x000d, 0x0002}, {0x0002, 0x0001}, - {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000b, 0x000a}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x0006, 0x0002}, {0x0006, 0x0003}, - {0x0009, 0x0003}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000c, 0x0013}, {0x000b, 0x000b}, {0x000d, 0x000a}, - {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, {0x000d, 0x000f}, {0x000d, 0x0010}, {0x000d, 0x0011}, {0x000d, 0x0012}, - {0x000d, 0x0013}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x000d, 0x0016}, {0x000d, 0x0017}, {0x000d, 0x0018}, {0x000d, 0x0019}, {0x000d, 0x001a}, - {0x000d, 0x001b}, {0x000d, 0x001c}, {0x000d, 0x001d}, {0x000d, 0x001e}, {0x000d, 0x001f}, {0x000d, 0x0020}, {0x000d, 0x0021}, {0x000d, 0x0022}, - {0x000d, 0x0023}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000c, 0x0012 }, + { 0x000d, 0x0000 }, + { 0x000d, 0x0001 }, + { 0x000d, 0x0002 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000b, 0x000a }, + { 0x000d, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0009, 0x0003 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000c, 0x0013 }, + { 0x000b, 0x000b }, + { 0x000d, 0x000a }, + { 0x000d, 0x000b }, + { 0x000d, 0x000c }, + { 0x000d, 0x000d }, + { 0x000d, 0x000e }, + { 0x000d, 0x000f }, + { 0x000d, 0x0010 }, + { 0x000d, 0x0011 }, + { 0x000d, 0x0012 }, + { 0x000d, 0x0013 }, + { 0x000d, 0x0014 }, + { 0x000d, 0x0015 }, + { 0x000d, 0x0016 }, + { 0x000d, 0x0017 }, + { 0x000d, 0x0018 }, + { 0x000d, 0x0019 }, + { 0x000d, 0x001a }, + { 0x000d, 0x001b }, + { 0x000d, 0x001c }, + { 0x000d, 0x001d }, + { 0x000d, 0x001e }, + { 0x000d, 0x001f }, + { 0x000d, 0x0020 }, + { 0x000d, 0x0021 }, + { 0x000d, 0x0022 }, + { 0x000d, 0x0023 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec38[22][16] = -{ - {0x0001ffff, 0x00000008, 0x00010001, 0x00010001, 0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0002ffff, 0x00010009, 0x00010009, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x0014ffff, 0x0015ffff, 0x00000003, 0x00000015, 0x0001000a, 0x0001000a, 0x00010016, 0x00010016, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x0005ffff, 0x0006ffff, 0x0004ffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, - {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, - {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, - {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, +const uint32_t c_aauiCQMFHuffDec38[22][16] = { + { + 0x0001ffff, + 0x00000008, + 0x00010001, + 0x00010001, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020007, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003ffff, + 0x0002ffff, + 0x00010009, + 0x00010009, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + }, + { + 0x0014ffff, + 0x0015ffff, + 0x00000003, + 0x00000015, + 0x0001000a, + 0x0001000a, + 0x00010016, + 0x00010016, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + }, + { + 0x0005ffff, + 0x0006ffff, + 0x0004ffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, + { + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + }, + { + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + }, + { + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + }, + { + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + }, + { + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + }, + { + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + }, }; #endif @@ -2425,32 +24223,291 @@ const uint32_t c_aauiCQMFHuffEnc39[64][2] = #else const uint16_t c_aauiCQMFHuffEnc39[64][2] = #endif -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000a, 0x0002}, {0x000f, 0x0000}, {0x000f, 0x0001}, {0x000f, 0x0002}, {0x000f, 0x0003}, - {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, {0x000f, 0x0007}, - {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0009, 0x0003}, {0x000d, 0x000e}, {0x000f, 0x0008}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, - {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000d, 0x000f}, {0x000f, 0x000c}, {0x000f, 0x000d}, {0x000f, 0x000e}, {0x000f, 0x000f}, {0x000f, 0x0010}, - {0x000f, 0x0011}, {0x000f, 0x0012}, {0x000f, 0x0013}, {0x000f, 0x0014}, {0x000f, 0x0015}, {0x000f, 0x0016}, {0x000f, 0x0017}, {0x000f, 0x0018}, - {0x000f, 0x0019}, {0x000f, 0x001a}, {0x000f, 0x001b}, {0x000f, 0x001c}, {0x000f, 0x001d}, {0x000f, 0x001e}, {0x000f, 0x001f}, {0x000f, 0x0020}, - {0x000f, 0x0021}, {0x000f, 0x0022}, {0x000f, 0x0023}, {0x000f, 0x0024}, {0x000f, 0x0025}, {0x000f, 0x0026}, {0x000f, 0x0027}, {0x000f, 0x0028}, - {0x000f, 0x0029}, {0x000e, 0x0015}, {0x000e, 0x0016}, {0x000e, 0x0017}, {0x000e, 0x0018}, {0x000e, 0x0019}, {0x000e, 0x001a}, {0x000e, 0x001b}, -}; + { + { 0x0001, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000a, 0x0002 }, + { 0x000f, 0x0000 }, + { 0x000f, 0x0001 }, + { 0x000f, 0x0002 }, + { 0x000f, 0x0003 }, + { 0x0003, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000a, 0x0003 }, + { 0x000f, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x000f, 0x0006 }, + { 0x000f, 0x0007 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0009, 0x0003 }, + { 0x000d, 0x000e }, + { 0x000f, 0x0008 }, + { 0x000f, 0x0009 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000d, 0x000f }, + { 0x000f, 0x000c }, + { 0x000f, 0x000d }, + { 0x000f, 0x000e }, + { 0x000f, 0x000f }, + { 0x000f, 0x0010 }, + { 0x000f, 0x0011 }, + { 0x000f, 0x0012 }, + { 0x000f, 0x0013 }, + { 0x000f, 0x0014 }, + { 0x000f, 0x0015 }, + { 0x000f, 0x0016 }, + { 0x000f, 0x0017 }, + { 0x000f, 0x0018 }, + { 0x000f, 0x0019 }, + { 0x000f, 0x001a }, + { 0x000f, 0x001b }, + { 0x000f, 0x001c }, + { 0x000f, 0x001d }, + { 0x000f, 0x001e }, + { 0x000f, 0x001f }, + { 0x000f, 0x0020 }, + { 0x000f, 0x0021 }, + { 0x000f, 0x0022 }, + { 0x000f, 0x0023 }, + { 0x000f, 0x0024 }, + { 0x000f, 0x0025 }, + { 0x000f, 0x0026 }, + { 0x000f, 0x0027 }, + { 0x000f, 0x0028 }, + { 0x000f, 0x0029 }, + { 0x000e, 0x0015 }, + { 0x000e, 0x0016 }, + { 0x000e, 0x0017 }, + { 0x000e, 0x0018 }, + { 0x000e, 0x0019 }, + { 0x000e, 0x001a }, + { 0x000e, 0x001b }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec39[12][16] = -{ - {0x0001ffff, 0x00000009, 0x00010008, 0x00010008, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0002ffff, 0x0001000a, 0x0001000a, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020018, 0x00020018, 0x00020018, 0x00020018, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, 0x00030012, }, - {0x0008ffff, 0x0007ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0005ffff, 0x0006ffff, 0x0004ffff, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, }, - {0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, }, - {0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, }, - {0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, }, - {0x00010004, 0x00010004, 0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, - {0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, }, - {0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, - {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, }, +const uint32_t c_aauiCQMFHuffDec39[12][16] = { + { + 0x0001ffff, + 0x00000009, + 0x00010008, + 0x00010008, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003ffff, + 0x0002ffff, + 0x0001000a, + 0x0001000a, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + 0x00030012, + }, + { + 0x0008ffff, + 0x0007ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x0005ffff, + 0x0006ffff, + 0x0004ffff, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + }, + { + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003b, + }, + { + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + }, + { + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + }, + { + 0x00010004, + 0x00010004, + 0x00010005, + 0x00010005, + 0x00010006, + 0x00010006, + 0x00010007, + 0x00010007, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + }, + { + 0x0001001f, + 0x0001001f, + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + }, + { + 0x00010027, + 0x00010027, + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + }, + { + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + }, }; #endif @@ -2459,60 +24516,741 @@ const uint32_t c_aauiCQMFHuffEnc40[81][2] = #else const uint16_t c_aauiCQMFHuffEnc40[81][2] = #endif -{ - {0x0001, 0x0001}, {0x0002, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0002}, {0x000f, 0x0011}, {0x0011, 0x0000}, {0x0011, 0x0001}, {0x0011, 0x0002}, - {0x0011, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0002}, {0x000e, 0x0009}, {0x0011, 0x0004}, {0x0011, 0x0005}, - {0x0011, 0x0006}, {0x0011, 0x0007}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0005}, {0x0011, 0x0008}, {0x0011, 0x0009}, - {0x0011, 0x000a}, {0x0011, 0x000b}, {0x0011, 0x000c}, {0x000b, 0x0003}, {0x000a, 0x0003}, {0x000c, 0x0003}, {0x0011, 0x000d}, {0x0011, 0x000e}, - {0x0011, 0x000f}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0011, 0x0012}, {0x0011, 0x0013}, {0x0011, 0x0014}, {0x0011, 0x0015}, {0x0011, 0x0016}, - {0x0011, 0x0017}, {0x0011, 0x0018}, {0x0011, 0x0019}, {0x0011, 0x001a}, {0x0011, 0x001b}, {0x0011, 0x001c}, {0x0011, 0x001d}, {0x0011, 0x001e}, - {0x0011, 0x001f}, {0x0011, 0x0020}, {0x0011, 0x0021}, {0x0011, 0x0022}, {0x0011, 0x0023}, {0x0011, 0x0024}, {0x0011, 0x0025}, {0x0011, 0x0026}, - {0x0011, 0x0027}, {0x0011, 0x0028}, {0x0011, 0x0029}, {0x0011, 0x002a}, {0x0011, 0x002b}, {0x0011, 0x002c}, {0x0011, 0x002d}, {0x0011, 0x002e}, - {0x0011, 0x002f}, {0x0011, 0x0030}, {0x0011, 0x0031}, {0x0011, 0x0032}, {0x0011, 0x0033}, {0x0011, 0x0034}, {0x0011, 0x0035}, {0x0011, 0x0036}, - {0x0011, 0x0037}, {0x0011, 0x0038}, {0x0011, 0x0039}, {0x0011, 0x003a}, {0x0011, 0x003b}, {0x0010, 0x001e}, {0x0010, 0x001f}, {0x0010, 0x0020}, - {0x0010, 0x0021}, + { + { 0x0001, 0x0001 }, + { 0x0002, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000b, 0x0002 }, + { 0x000f, 0x0011 }, + { 0x0011, 0x0000 }, + { 0x0011, 0x0001 }, + { 0x0011, 0x0002 }, + { 0x0011, 0x0003 }, + { 0x0003, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000a, 0x0002 }, + { 0x000e, 0x0009 }, + { 0x0011, 0x0004 }, + { 0x0011, 0x0005 }, + { 0x0011, 0x0006 }, + { 0x0011, 0x0007 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x000d, 0x0005 }, + { 0x0011, 0x0008 }, + { 0x0011, 0x0009 }, + { 0x0011, 0x000a }, + { 0x0011, 0x000b }, + { 0x0011, 0x000c }, + { 0x000b, 0x0003 }, + { 0x000a, 0x0003 }, + { 0x000c, 0x0003 }, + { 0x0011, 0x000d }, + { 0x0011, 0x000e }, + { 0x0011, 0x000f }, + { 0x0011, 0x0010 }, + { 0x0011, 0x0011 }, + { 0x0011, 0x0012 }, + { 0x0011, 0x0013 }, + { 0x0011, 0x0014 }, + { 0x0011, 0x0015 }, + { 0x0011, 0x0016 }, + { 0x0011, 0x0017 }, + { 0x0011, 0x0018 }, + { 0x0011, 0x0019 }, + { 0x0011, 0x001a }, + { 0x0011, 0x001b }, + { 0x0011, 0x001c }, + { 0x0011, 0x001d }, + { 0x0011, 0x001e }, + { 0x0011, 0x001f }, + { 0x0011, 0x0020 }, + { 0x0011, 0x0021 }, + { 0x0011, 0x0022 }, + { 0x0011, 0x0023 }, + { 0x0011, 0x0024 }, + { 0x0011, 0x0025 }, + { 0x0011, 0x0026 }, + { 0x0011, 0x0027 }, + { 0x0011, 0x0028 }, + { 0x0011, 0x0029 }, + { 0x0011, 0x002a }, + { 0x0011, 0x002b }, + { 0x0011, 0x002c }, + { 0x0011, 0x002d }, + { 0x0011, 0x002e }, + { 0x0011, 0x002f }, + { 0x0011, 0x0030 }, + { 0x0011, 0x0031 }, + { 0x0011, 0x0032 }, + { 0x0011, 0x0033 }, + { 0x0011, 0x0034 }, + { 0x0011, 0x0035 }, + { 0x0011, 0x0036 }, + { 0x0011, 0x0037 }, + { 0x0011, 0x0038 }, + { 0x0011, 0x0039 }, + { 0x0011, 0x003a }, + { 0x0011, 0x003b }, + { 0x0010, 0x001e }, + { 0x0010, 0x001f }, + { 0x0010, 0x0020 }, + { 0x0010, 0x0021 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec40[36][16] = -{ - {0x0001ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000014, 0x0001000b, 0x0001000b, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x0005ffff, 0x0004ffff, 0x0003ffff, 0x0000001d, 0x00010003, 0x00010003, 0x0001001b, 0x0001001b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, - {0x0000004f, 0x00000050, 0x00010004, 0x00010004, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0000004d, 0x0000004e, }, - {0x0023ffff, 0x000affff, 0x0006ffff, 0x000bffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, }, - {0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, - {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, - {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, - {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, - {0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, - {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, - {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, - {0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, - {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, - {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, 0x00030044, }, - {0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, }, - {0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, - {0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, }, - {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, +const uint32_t c_aauiCQMFHuffDec40[36][16] = { + { + 0x0001ffff, + 0x0000000a, + 0x00010009, + 0x00010009, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x00000014, + 0x0001000b, + 0x0001000b, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x0005ffff, + 0x0004ffff, + 0x0003ffff, + 0x0000001d, + 0x00010003, + 0x00010003, + 0x0001001b, + 0x0001001b, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, + { + 0x0000004f, + 0x00000050, + 0x00010004, + 0x00010004, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + 0x0000004d, + 0x0000004e, + }, + { + 0x0023ffff, + 0x000affff, + 0x0006ffff, + 0x000bffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + }, + { + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + }, + { + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + }, + { + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + }, + { + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + }, + { + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + }, + { + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + }, + { + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + }, + { + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + }, + { + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + }, + { + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + }, + { + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + }, + { + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + }, + { + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + }, + { + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, + { + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + }, + { + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + }, + { + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + 0x00030044, + }, + { + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + }, + { + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + }, + { + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + }, + { + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + }, + { + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, }; #endif @@ -2521,42 +25259,400 @@ const uint32_t c_aauiCQMFHuffEnc41[100][2] = #else const uint16_t c_aauiCQMFHuffEnc41[100][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x000b, 0x0001}, {0x0011, 0x0014}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, - {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0002, 0x0001}, {0x0004, 0x0001}, {0x0007, 0x0001}, {0x000a, 0x0001}, {0x0010, 0x000b}, {0x0013, 0x0005}, - {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0008, 0x0001}, {0x000d, 0x0002}, - {0x0011, 0x0015}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x000a, 0x0002}, {0x000a, 0x0003}, - {0x000d, 0x0003}, {0x0010, 0x000c}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, - {0x0010, 0x000d}, {0x000f, 0x0007}, {0x0012, 0x0027}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, - {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, - {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, - {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, - {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, - {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, - {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, - {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x0011, 0x0014 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0002, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x0010, 0x000b }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x000d, 0x0002 }, + { 0x0011, 0x0015 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000d, 0x0003 }, + { 0x0010, 0x000c }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0010, 0x000d }, + { 0x000f, 0x0007 }, + { 0x0012, 0x0027 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec41[16][16] = -{ - {0x0001ffff, 0x0000000b, 0x00010001, 0x00010001, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0002ffff, 0x00000016, 0x0001000c, 0x0001000c, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, - {0x0004ffff, 0x0003ffff, 0x00010003, 0x00010003, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0006ffff, 0x0005ffff, 0x0000000e, 0x00000021, 0x00000028, 0x00010029, 0x00010029, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, }, - {0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, }, - {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x00010022, 0x00010022, }, - {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, }, - {0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, }, - {0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, - {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, - {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, }, - {0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, }, - {0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, }, +const uint32_t c_aauiCQMFHuffDec41[16][16] = { + { + 0x0001ffff, + 0x0000000b, + 0x00010001, + 0x00010001, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0002ffff, + 0x00000016, + 0x0001000c, + 0x0001000c, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + }, + { + 0x0004ffff, + 0x0003ffff, + 0x00010003, + 0x00010003, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + }, + { + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0006ffff, + 0x0005ffff, + 0x0000000e, + 0x00000021, + 0x00000028, + 0x00010029, + 0x00010029, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, + { + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + }, + { + 0x00010005, + 0x00010005, + 0x00010006, + 0x00010006, + 0x00010007, + 0x00010007, + 0x00010008, + 0x00010008, + 0x00010009, + 0x00010009, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + }, + { + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + 0x00010022, + 0x00010022, + }, + { + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + }, + { + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + }, + { + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + }, + { + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + }, + { + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + }, + { + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + 0x00010052, + 0x00010052, + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + }, + { + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x0001005a, + 0x0001005a, + 0x0001005b, + 0x0001005b, + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + }, }; #endif @@ -2565,63 +25661,685 @@ const uint32_t c_aauiCQMFHuffEnc42[169][2] = #else const uint16_t c_aauiCQMFHuffEnc42[169][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0001}, {0x000e, 0x0006}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, - {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0001}, - {0x0009, 0x0002}, {0x000d, 0x0004}, {0x0010, 0x0013}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, - {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000f, 0x000b}, {0x0011, 0x0025}, - {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0009, 0x0003}, - {0x0008, 0x0003}, {0x000b, 0x0003}, {0x000d, 0x0005}, {0x0010, 0x0014}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, - {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0007}, {0x0010, 0x0015}, - {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, - {0x0013, 0x0026}, {0x0012, 0x0045}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, - {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, - {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, - {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, - {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, - {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, - {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, - {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, - {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, - {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, - {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, - {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, - {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0012, 0x0046}, {0x0012, 0x0047}, {0x0012, 0x0048}, - {0x0012, 0x0049}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000e, 0x0006 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0009, 0x0002 }, + { 0x000d, 0x0004 }, + { 0x0010, 0x0013 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0008, 0x0002 }, + { 0x000b, 0x0002 }, + { 0x000f, 0x000b }, + { 0x0011, 0x0025 }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0009, 0x0003 }, + { 0x0008, 0x0003 }, + { 0x000b, 0x0003 }, + { 0x000d, 0x0005 }, + { 0x0010, 0x0014 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0007 }, + { 0x0010, 0x0015 }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0012, 0x0045 }, + { 0x0013, 0x0027 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x0013, 0x0054 }, + { 0x0013, 0x0055 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0013, 0x0062 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x0013, 0x0066 }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0012, 0x0046 }, + { 0x0012, 0x0047 }, + { 0x0012, 0x0048 }, + { 0x0012, 0x0049 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec42[28][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0003ffff, 0x0004ffff, 0x0000001c, 0x00000028, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001a, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x000affff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001001d, 0x0001001d, 0x00010029, 0x00010029, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, }, - {0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, }, - {0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x001bffff, 0x0009ffff, 0x0008ffff, 0x00000012, 0x0000002b, 0x00000037, 0x0001001e, 0x0001001e, 0x00020004, 0x00020004, 0x00020004, 0x00020004, 0x00020036, 0x00020036, 0x00020036, 0x00020036, }, - {0x000200a7, 0x000200a7, 0x000200a7, 0x000200a7, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, - {0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a5, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, }, - {0x000dffff, 0x000bffff, 0x000cffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, }, - {0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00010020, 0x00010020, }, - {0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, }, - {0x00010005, 0x00010005, 0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, }, - {0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, - {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010042, 0x00010042, }, - {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, }, - {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, - {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, - {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, - {0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, }, - {0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, }, - {0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, }, - {0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, }, - {0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, - {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, }, - {0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, }, - {0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, }, +const uint32_t c_aauiCQMFHuffDec42[28][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00010001, + 0x00010001, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0003ffff, + 0x0004ffff, + 0x0000001c, + 0x00000028, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001a, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + }, + { + 0x000affff, + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x0001001d, + 0x0001001d, + 0x00010029, + 0x00010029, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + }, + { + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + }, + { + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + }, + { + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x001bffff, + 0x0009ffff, + 0x0008ffff, + 0x00000012, + 0x0000002b, + 0x00000037, + 0x0001001e, + 0x0001001e, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020004, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + }, + { + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a7, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + }, + { + 0x000100a3, + 0x000100a3, + 0x000100a4, + 0x000100a4, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a5, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a6, + }, + { + 0x000dffff, + 0x000bffff, + 0x000cffff, + 0x000effff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + }, + { + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x00010020, + 0x00010020, + }, + { + 0x00010021, + 0x00010021, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + }, + { + 0x00010005, + 0x00010005, + 0x00010006, + 0x00010006, + 0x00010007, + 0x00010007, + 0x00010008, + 0x00010008, + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + }, + { + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + }, + { + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + 0x00010042, + 0x00010042, + }, + { + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + }, + { + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + 0x00010052, + 0x00010052, + }, + { + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x0001005a, + 0x0001005a, + }, + { + 0x0001005b, + 0x0001005b, + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + }, + { + 0x00010063, + 0x00010063, + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x00010069, + 0x00010069, + 0x0001006a, + 0x0001006a, + }, + { + 0x0001006b, + 0x0001006b, + 0x0001006c, + 0x0001006c, + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00010070, + 0x00010070, + 0x00010071, + 0x00010071, + 0x00010072, + 0x00010072, + }, + { + 0x00010073, + 0x00010073, + 0x00010074, + 0x00010074, + 0x00010075, + 0x00010075, + 0x00010076, + 0x00010076, + 0x00010077, + 0x00010077, + 0x00010078, + 0x00010078, + 0x00010079, + 0x00010079, + 0x0001007a, + 0x0001007a, + }, + { + 0x0001007b, + 0x0001007b, + 0x0001007c, + 0x0001007c, + 0x0001007d, + 0x0001007d, + 0x0001007e, + 0x0001007e, + 0x0001007f, + 0x0001007f, + 0x00010080, + 0x00010080, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + }, + { + 0x00010083, + 0x00010083, + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010087, + 0x00010087, + 0x00010088, + 0x00010088, + 0x00010089, + 0x00010089, + 0x0001008a, + 0x0001008a, + }, + { + 0x0001008b, + 0x0001008b, + 0x0001008c, + 0x0001008c, + 0x0001008d, + 0x0001008d, + 0x0001008e, + 0x0001008e, + 0x0001008f, + 0x0001008f, + 0x00010090, + 0x00010090, + 0x00010091, + 0x00010091, + 0x00010092, + 0x00010092, + }, + { + 0x00010093, + 0x00010093, + 0x00010094, + 0x00010094, + 0x00010095, + 0x00010095, + 0x00010096, + 0x00010096, + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + 0x00010099, + 0x00010099, + 0x0001009a, + 0x0001009a, + }, + { + 0x0001009b, + 0x0001009b, + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + 0x000100a1, + 0x000100a1, + 0x000100a2, + 0x000100a2, + }, }; #endif @@ -2630,70 +26348,784 @@ const uint32_t c_aauiCQMFHuffEnc43[196][2] = #else const uint16_t c_aauiCQMFHuffEnc43[196][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0001}, {0x0009, 0x0002}, {0x000c, 0x0003}, {0x0010, 0x0017}, {0x0013, 0x0000}, {0x0013, 0x0001}, - {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0003, 0x0002}, {0x0003, 0x0003}, - {0x0005, 0x0001}, {0x0009, 0x0003}, {0x000c, 0x0004}, {0x0010, 0x0018}, {0x0012, 0x0050}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, - {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0005, 0x0002}, {0x0005, 0x0003}, {0x0008, 0x0003}, {0x000a, 0x0002}, - {0x000d, 0x0004}, {0x0011, 0x002a}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, - {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000c, 0x0005}, {0x000f, 0x000d}, {0x0012, 0x0051}, - {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, - {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0005}, {0x000f, 0x000e}, {0x0011, 0x002b}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, - {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0011, 0x002c}, {0x000f, 0x000f}, - {0x0010, 0x0019}, {0x0012, 0x0052}, {0x0012, 0x0053}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, - {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0011, 0x002d}, {0x0013, 0x0032}, {0x0013, 0x0033}, - {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, - {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, - {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, - {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, - {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, - {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, - {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, - {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, - {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, - {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, - {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, - {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, - {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, - {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0009, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x0010, 0x0017 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0009, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x0010, 0x0018 }, + { 0x0012, 0x0050 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0008, 0x0003 }, + { 0x000a, 0x0002 }, + { 0x000d, 0x0004 }, + { 0x0011, 0x002a }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000a, 0x0003 }, + { 0x000c, 0x0005 }, + { 0x000f, 0x000d }, + { 0x0012, 0x0051 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0005 }, + { 0x000f, 0x000e }, + { 0x0011, 0x002b }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0011, 0x002c }, + { 0x000f, 0x000f }, + { 0x0010, 0x0019 }, + { 0x0012, 0x0052 }, + { 0x0012, 0x0053 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0011, 0x002d }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x0013, 0x0054 }, + { 0x0013, 0x0055 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0013, 0x0062 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x0013, 0x0066 }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x0013, 0x008b }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0013, 0x008e }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0013, 0x0091 }, + { 0x0013, 0x0092 }, + { 0x0013, 0x0093 }, + { 0x0013, 0x0094 }, + { 0x0013, 0x0095 }, + { 0x0013, 0x0096 }, + { 0x0013, 0x0097 }, + { 0x0013, 0x0098 }, + { 0x0013, 0x0099 }, + { 0x0013, 0x009a }, + { 0x0013, 0x009b }, + { 0x0013, 0x009c }, + { 0x0013, 0x009d }, + { 0x0013, 0x009e }, + { 0x0013, 0x009f }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec43[32][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00010001, 0x00010001, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x0005ffff, 0x0003ffff, 0x0004ffff, 0x0000001e, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030003, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, 0x00030011, }, - {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x000bffff, 0x0007ffff, 0x0006ffff, 0x00000004, 0x00000012, 0x0000002d, 0x00000038, 0x00000039, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, - {0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, }, - {0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x00000013, 0x00000048, 0x0001002e, 0x0001002e, 0x0001003b, 0x0001003b, 0x00010047, 0x00010047, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, }, - {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, }, - {0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, - {0x000dffff, 0x000effff, 0x000cffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, }, - {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x00010030, 0x00010030, }, - {0x00010006, 0x00010006, 0x00010007, 0x00010007, 0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, }, - {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00010022, 0x00010022, }, - {0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x0001003d, 0x0001003d, }, - {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, - {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, }, - {0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, }, - {0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, }, - {0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, }, - {0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, 0x00010072, 0x00010072, 0x00010073, 0x00010073, }, - {0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, }, - {0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, }, - {0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, }, - {0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, }, - {0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, }, - {0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, }, - {0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, }, - {0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, }, - {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, - {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, +const uint32_t c_aauiCQMFHuffDec43[32][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00010001, + 0x00010001, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x0005ffff, + 0x0003ffff, + 0x0004ffff, + 0x0000001e, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + }, + { + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + }, + { + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030003, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + 0x00030011, + }, + { + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x000bffff, + 0x0007ffff, + 0x0006ffff, + 0x00000004, + 0x00000012, + 0x0000002d, + 0x00000038, + 0x00000039, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + }, + { + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + }, + { + 0x001cffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x00000005, + 0x00000013, + 0x00000048, + 0x0001002e, + 0x0001002e, + 0x0001003b, + 0x0001003b, + 0x00010047, + 0x00010047, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + }, + { + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + }, + { + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + }, + { + 0x000dffff, + 0x000effff, + 0x000cffff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + }, + { + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x00010030, + 0x00010030, + }, + { + 0x00010006, + 0x00010006, + 0x00010007, + 0x00010007, + 0x00010008, + 0x00010008, + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + }, + { + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x00010022, + 0x00010022, + }, + { + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + 0x0001003d, + 0x0001003d, + }, + { + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + }, + { + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + 0x00010052, + 0x00010052, + }, + { + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x0001005a, + 0x0001005a, + 0x0001005b, + 0x0001005b, + }, + { + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + }, + { + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x00010069, + 0x00010069, + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + }, + { + 0x0001006c, + 0x0001006c, + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00010070, + 0x00010070, + 0x00010071, + 0x00010071, + 0x00010072, + 0x00010072, + 0x00010073, + 0x00010073, + }, + { + 0x00010074, + 0x00010074, + 0x00010075, + 0x00010075, + 0x00010076, + 0x00010076, + 0x00010077, + 0x00010077, + 0x00010078, + 0x00010078, + 0x00010079, + 0x00010079, + 0x0001007a, + 0x0001007a, + 0x0001007b, + 0x0001007b, + }, + { + 0x0001007c, + 0x0001007c, + 0x0001007d, + 0x0001007d, + 0x0001007e, + 0x0001007e, + 0x0001007f, + 0x0001007f, + 0x00010080, + 0x00010080, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + 0x00010083, + 0x00010083, + }, + { + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010087, + 0x00010087, + 0x00010088, + 0x00010088, + 0x00010089, + 0x00010089, + 0x0001008a, + 0x0001008a, + 0x0001008b, + 0x0001008b, + }, + { + 0x0001008c, + 0x0001008c, + 0x0001008d, + 0x0001008d, + 0x0001008e, + 0x0001008e, + 0x0001008f, + 0x0001008f, + 0x00010090, + 0x00010090, + 0x00010091, + 0x00010091, + 0x00010092, + 0x00010092, + 0x00010093, + 0x00010093, + }, + { + 0x00010094, + 0x00010094, + 0x00010095, + 0x00010095, + 0x00010096, + 0x00010096, + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + 0x00010099, + 0x00010099, + 0x0001009a, + 0x0001009a, + 0x0001009b, + 0x0001009b, + }, + { + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + 0x000100a1, + 0x000100a1, + 0x000100a2, + 0x000100a2, + 0x000100a3, + 0x000100a3, + }, + { + 0x000100a4, + 0x000100a4, + 0x000100a5, + 0x000100a5, + 0x000100a6, + 0x000100a6, + 0x000100a7, + 0x000100a7, + 0x000100a8, + 0x000100a8, + 0x000100a9, + 0x000100a9, + 0x000100aa, + 0x000100aa, + 0x000100ab, + 0x000100ab, + }, + { + 0x000100ac, + 0x000100ac, + 0x000100ad, + 0x000100ad, + 0x000100ae, + 0x000100ae, + 0x000100af, + 0x000100af, + 0x000100b0, + 0x000100b0, + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + }, + { + 0x000100b4, + 0x000100b4, + 0x000100b5, + 0x000100b5, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + 0x000100b8, + 0x000100b8, + 0x000100b9, + 0x000100b9, + 0x000100ba, + 0x000100ba, + 0x000100bb, + 0x000100bb, + }, + { + 0x000100bc, + 0x000100bc, + 0x000100bd, + 0x000100bd, + 0x000100be, + 0x000100be, + 0x000100bf, + 0x000100bf, + 0x000100c0, + 0x000100c0, + 0x000100c1, + 0x000100c1, + 0x000100c2, + 0x000100c2, + 0x000100c3, + 0x000100c3, + }, }; #endif @@ -2702,77 +27134,787 @@ const uint32_t c_aauiCQMFHuffEnc44[289][2] = #else const uint16_t c_aauiCQMFHuffEnc44[289][2] = #endif -{ - {0x0001, 0x0001}, {0x0003, 0x0001}, {0x0006, 0x0002}, {0x0008, 0x0002}, {0x000b, 0x0002}, {0x000f, 0x000a}, {0x0011, 0x0022}, {0x0014, 0x0000}, - {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0014, 0x0006}, {0x0014, 0x0007}, {0x0014, 0x0008}, - {0x0014, 0x0009}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0005, 0x0002}, {0x0008, 0x0003}, {0x000b, 0x0003}, {0x000e, 0x0007}, {0x0012, 0x003f}, - {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, - {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0006, 0x0003}, {0x0005, 0x0003}, {0x0007, 0x0003}, {0x0009, 0x0002}, {0x000c, 0x0003}, {0x000f, 0x000b}, - {0x0012, 0x0040}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, - {0x0014, 0x001b}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, {0x000b, 0x0004}, {0x000d, 0x0005}, - {0x0010, 0x0013}, {0x0014, 0x001e}, {0x0014, 0x001f}, {0x0014, 0x0020}, {0x0014, 0x0021}, {0x0014, 0x0022}, {0x0014, 0x0023}, {0x0014, 0x0024}, - {0x0014, 0x0025}, {0x0014, 0x0026}, {0x0014, 0x0027}, {0x0014, 0x0028}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000e, 0x0008}, - {0x0011, 0x0023}, {0x0012, 0x0041}, {0x0014, 0x0029}, {0x0014, 0x002a}, {0x0013, 0x007b}, {0x0014, 0x002b}, {0x0014, 0x002c}, {0x0014, 0x002d}, - {0x0014, 0x002e}, {0x0014, 0x002f}, {0x0014, 0x0030}, {0x0014, 0x0031}, {0x0014, 0x0032}, {0x000f, 0x000c}, {0x000e, 0x0009}, {0x000f, 0x000d}, - {0x0011, 0x0024}, {0x0012, 0x0042}, {0x0014, 0x0033}, {0x0014, 0x0034}, {0x0014, 0x0035}, {0x0014, 0x0036}, {0x0014, 0x0037}, {0x0014, 0x0038}, - {0x0014, 0x0039}, {0x0014, 0x003a}, {0x0014, 0x003b}, {0x0014, 0x003c}, {0x0014, 0x003d}, {0x0014, 0x003e}, {0x0013, 0x007c}, {0x0011, 0x0025}, - {0x0012, 0x0043}, {0x0014, 0x003f}, {0x0014, 0x0040}, {0x0014, 0x0041}, {0x0014, 0x0042}, {0x0014, 0x0043}, {0x0014, 0x0044}, {0x0014, 0x0045}, - {0x0014, 0x0046}, {0x0014, 0x0047}, {0x0014, 0x0048}, {0x0014, 0x0049}, {0x0014, 0x004a}, {0x0014, 0x004b}, {0x0014, 0x004c}, {0x0014, 0x004d}, - {0x0014, 0x004e}, {0x0014, 0x004f}, {0x0014, 0x0050}, {0x0014, 0x0051}, {0x0014, 0x0052}, {0x0014, 0x0053}, {0x0014, 0x0054}, {0x0014, 0x0055}, - {0x0014, 0x0056}, {0x0014, 0x0057}, {0x0014, 0x0058}, {0x0014, 0x0059}, {0x0014, 0x005a}, {0x0014, 0x005b}, {0x0014, 0x005c}, {0x0014, 0x005d}, - {0x0014, 0x005e}, {0x0014, 0x005f}, {0x0014, 0x0060}, {0x0014, 0x0061}, {0x0014, 0x0062}, {0x0014, 0x0063}, {0x0014, 0x0064}, {0x0014, 0x0065}, - {0x0014, 0x0066}, {0x0014, 0x0067}, {0x0014, 0x0068}, {0x0014, 0x0069}, {0x0014, 0x006a}, {0x0014, 0x006b}, {0x0014, 0x006c}, {0x0014, 0x006d}, - {0x0014, 0x006e}, {0x0014, 0x006f}, {0x0014, 0x0070}, {0x0014, 0x0071}, {0x0014, 0x0072}, {0x0014, 0x0073}, {0x0014, 0x0074}, {0x0014, 0x0075}, - {0x0014, 0x0076}, {0x0014, 0x0077}, {0x0014, 0x0078}, {0x0014, 0x0079}, {0x0014, 0x007a}, {0x0014, 0x007b}, {0x0014, 0x007c}, {0x0014, 0x007d}, - {0x0014, 0x007e}, {0x0014, 0x007f}, {0x0014, 0x0080}, {0x0014, 0x0081}, {0x0014, 0x0082}, {0x0014, 0x0083}, {0x0014, 0x0084}, {0x0014, 0x0085}, - {0x0014, 0x0086}, {0x0014, 0x0087}, {0x0014, 0x0088}, {0x0014, 0x0089}, {0x0014, 0x008a}, {0x0014, 0x008b}, {0x0014, 0x008c}, {0x0014, 0x008d}, - {0x0014, 0x008e}, {0x0014, 0x008f}, {0x0014, 0x0090}, {0x0014, 0x0091}, {0x0014, 0x0092}, {0x0014, 0x0093}, {0x0014, 0x0094}, {0x0014, 0x0095}, - {0x0014, 0x0096}, {0x0014, 0x0097}, {0x0014, 0x0098}, {0x0014, 0x0099}, {0x0014, 0x009a}, {0x0014, 0x009b}, {0x0014, 0x009c}, {0x0014, 0x009d}, - {0x0014, 0x009e}, {0x0014, 0x009f}, {0x0014, 0x00a0}, {0x0014, 0x00a1}, {0x0014, 0x00a2}, {0x0014, 0x00a3}, {0x0014, 0x00a4}, {0x0014, 0x00a5}, - {0x0014, 0x00a6}, {0x0014, 0x00a7}, {0x0014, 0x00a8}, {0x0014, 0x00a9}, {0x0014, 0x00aa}, {0x0014, 0x00ab}, {0x0014, 0x00ac}, {0x0014, 0x00ad}, - {0x0014, 0x00ae}, {0x0014, 0x00af}, {0x0014, 0x00b0}, {0x0014, 0x00b1}, {0x0014, 0x00b2}, {0x0014, 0x00b3}, {0x0014, 0x00b4}, {0x0014, 0x00b5}, - {0x0014, 0x00b6}, {0x0014, 0x00b7}, {0x0014, 0x00b8}, {0x0014, 0x00b9}, {0x0014, 0x00ba}, {0x0014, 0x00bb}, {0x0014, 0x00bc}, {0x0014, 0x00bd}, - {0x0014, 0x00be}, {0x0014, 0x00bf}, {0x0014, 0x00c0}, {0x0014, 0x00c1}, {0x0014, 0x00c2}, {0x0014, 0x00c3}, {0x0014, 0x00c4}, {0x0014, 0x00c5}, - {0x0014, 0x00c6}, {0x0014, 0x00c7}, {0x0014, 0x00c8}, {0x0014, 0x00c9}, {0x0014, 0x00ca}, {0x0014, 0x00cb}, {0x0014, 0x00cc}, {0x0014, 0x00cd}, - {0x0014, 0x00ce}, {0x0014, 0x00cf}, {0x0014, 0x00d0}, {0x0014, 0x00d1}, {0x0014, 0x00d2}, {0x0014, 0x00d3}, {0x0014, 0x00d4}, {0x0014, 0x00d5}, - {0x0014, 0x00d6}, {0x0014, 0x00d7}, {0x0014, 0x00d8}, {0x0014, 0x00d9}, {0x0014, 0x00da}, {0x0014, 0x00db}, {0x0014, 0x00dc}, {0x0014, 0x00dd}, - {0x0014, 0x00de}, {0x0014, 0x00df}, {0x0014, 0x00e0}, {0x0014, 0x00e1}, {0x0014, 0x00e2}, {0x0014, 0x00e3}, {0x0014, 0x00e4}, {0x0014, 0x00e5}, - {0x0014, 0x00e6}, {0x0014, 0x00e7}, {0x0014, 0x00e8}, {0x0014, 0x00e9}, {0x0014, 0x00ea}, {0x0014, 0x00eb}, {0x0014, 0x00ec}, {0x0014, 0x00ed}, - {0x0014, 0x00ee}, {0x0014, 0x00ef}, {0x0014, 0x00f0}, {0x0014, 0x00f1}, {0x0014, 0x00f2}, {0x0014, 0x00f3}, {0x0014, 0x00f4}, {0x0014, 0x00f5}, - {0x0013, 0x007d}, + { + { 0x0001, 0x0001 }, + { 0x0003, 0x0001 }, + { 0x0006, 0x0002 }, + { 0x0008, 0x0002 }, + { 0x000b, 0x0002 }, + { 0x000f, 0x000a }, + { 0x0011, 0x0022 }, + { 0x0014, 0x0000 }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0014, 0x0006 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0014, 0x0009 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x000b, 0x0003 }, + { 0x000e, 0x0007 }, + { 0x0012, 0x003f }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0014, 0x000c }, + { 0x0014, 0x000d }, + { 0x0014, 0x000e }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0014, 0x0013 }, + { 0x0006, 0x0003 }, + { 0x0005, 0x0003 }, + { 0x0007, 0x0003 }, + { 0x0009, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000f, 0x000b }, + { 0x0012, 0x0040 }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, + { 0x0014, 0x001a }, + { 0x0014, 0x001b }, + { 0x0014, 0x001c }, + { 0x0014, 0x001d }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0009, 0x0003 }, + { 0x000b, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x0010, 0x0013 }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0014, 0x0020 }, + { 0x0014, 0x0021 }, + { 0x0014, 0x0022 }, + { 0x0014, 0x0023 }, + { 0x0014, 0x0024 }, + { 0x0014, 0x0025 }, + { 0x0014, 0x0026 }, + { 0x0014, 0x0027 }, + { 0x0014, 0x0028 }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000e, 0x0008 }, + { 0x0011, 0x0023 }, + { 0x0012, 0x0041 }, + { 0x0014, 0x0029 }, + { 0x0014, 0x002a }, + { 0x0013, 0x007b }, + { 0x0014, 0x002b }, + { 0x0014, 0x002c }, + { 0x0014, 0x002d }, + { 0x0014, 0x002e }, + { 0x0014, 0x002f }, + { 0x0014, 0x0030 }, + { 0x0014, 0x0031 }, + { 0x0014, 0x0032 }, + { 0x000f, 0x000c }, + { 0x000e, 0x0009 }, + { 0x000f, 0x000d }, + { 0x0011, 0x0024 }, + { 0x0012, 0x0042 }, + { 0x0014, 0x0033 }, + { 0x0014, 0x0034 }, + { 0x0014, 0x0035 }, + { 0x0014, 0x0036 }, + { 0x0014, 0x0037 }, + { 0x0014, 0x0038 }, + { 0x0014, 0x0039 }, + { 0x0014, 0x003a }, + { 0x0014, 0x003b }, + { 0x0014, 0x003c }, + { 0x0014, 0x003d }, + { 0x0014, 0x003e }, + { 0x0013, 0x007c }, + { 0x0011, 0x0025 }, + { 0x0012, 0x0043 }, + { 0x0014, 0x003f }, + { 0x0014, 0x0040 }, + { 0x0014, 0x0041 }, + { 0x0014, 0x0042 }, + { 0x0014, 0x0043 }, + { 0x0014, 0x0044 }, + { 0x0014, 0x0045 }, + { 0x0014, 0x0046 }, + { 0x0014, 0x0047 }, + { 0x0014, 0x0048 }, + { 0x0014, 0x0049 }, + { 0x0014, 0x004a }, + { 0x0014, 0x004b }, + { 0x0014, 0x004c }, + { 0x0014, 0x004d }, + { 0x0014, 0x004e }, + { 0x0014, 0x004f }, + { 0x0014, 0x0050 }, + { 0x0014, 0x0051 }, + { 0x0014, 0x0052 }, + { 0x0014, 0x0053 }, + { 0x0014, 0x0054 }, + { 0x0014, 0x0055 }, + { 0x0014, 0x0056 }, + { 0x0014, 0x0057 }, + { 0x0014, 0x0058 }, + { 0x0014, 0x0059 }, + { 0x0014, 0x005a }, + { 0x0014, 0x005b }, + { 0x0014, 0x005c }, + { 0x0014, 0x005d }, + { 0x0014, 0x005e }, + { 0x0014, 0x005f }, + { 0x0014, 0x0060 }, + { 0x0014, 0x0061 }, + { 0x0014, 0x0062 }, + { 0x0014, 0x0063 }, + { 0x0014, 0x0064 }, + { 0x0014, 0x0065 }, + { 0x0014, 0x0066 }, + { 0x0014, 0x0067 }, + { 0x0014, 0x0068 }, + { 0x0014, 0x0069 }, + { 0x0014, 0x006a }, + { 0x0014, 0x006b }, + { 0x0014, 0x006c }, + { 0x0014, 0x006d }, + { 0x0014, 0x006e }, + { 0x0014, 0x006f }, + { 0x0014, 0x0070 }, + { 0x0014, 0x0071 }, + { 0x0014, 0x0072 }, + { 0x0014, 0x0073 }, + { 0x0014, 0x0074 }, + { 0x0014, 0x0075 }, + { 0x0014, 0x0076 }, + { 0x0014, 0x0077 }, + { 0x0014, 0x0078 }, + { 0x0014, 0x0079 }, + { 0x0014, 0x007a }, + { 0x0014, 0x007b }, + { 0x0014, 0x007c }, + { 0x0014, 0x007d }, + { 0x0014, 0x007e }, + { 0x0014, 0x007f }, + { 0x0014, 0x0080 }, + { 0x0014, 0x0081 }, + { 0x0014, 0x0082 }, + { 0x0014, 0x0083 }, + { 0x0014, 0x0084 }, + { 0x0014, 0x0085 }, + { 0x0014, 0x0086 }, + { 0x0014, 0x0087 }, + { 0x0014, 0x0088 }, + { 0x0014, 0x0089 }, + { 0x0014, 0x008a }, + { 0x0014, 0x008b }, + { 0x0014, 0x008c }, + { 0x0014, 0x008d }, + { 0x0014, 0x008e }, + { 0x0014, 0x008f }, + { 0x0014, 0x0090 }, + { 0x0014, 0x0091 }, + { 0x0014, 0x0092 }, + { 0x0014, 0x0093 }, + { 0x0014, 0x0094 }, + { 0x0014, 0x0095 }, + { 0x0014, 0x0096 }, + { 0x0014, 0x0097 }, + { 0x0014, 0x0098 }, + { 0x0014, 0x0099 }, + { 0x0014, 0x009a }, + { 0x0014, 0x009b }, + { 0x0014, 0x009c }, + { 0x0014, 0x009d }, + { 0x0014, 0x009e }, + { 0x0014, 0x009f }, + { 0x0014, 0x00a0 }, + { 0x0014, 0x00a1 }, + { 0x0014, 0x00a2 }, + { 0x0014, 0x00a3 }, + { 0x0014, 0x00a4 }, + { 0x0014, 0x00a5 }, + { 0x0014, 0x00a6 }, + { 0x0014, 0x00a7 }, + { 0x0014, 0x00a8 }, + { 0x0014, 0x00a9 }, + { 0x0014, 0x00aa }, + { 0x0014, 0x00ab }, + { 0x0014, 0x00ac }, + { 0x0014, 0x00ad }, + { 0x0014, 0x00ae }, + { 0x0014, 0x00af }, + { 0x0014, 0x00b0 }, + { 0x0014, 0x00b1 }, + { 0x0014, 0x00b2 }, + { 0x0014, 0x00b3 }, + { 0x0014, 0x00b4 }, + { 0x0014, 0x00b5 }, + { 0x0014, 0x00b6 }, + { 0x0014, 0x00b7 }, + { 0x0014, 0x00b8 }, + { 0x0014, 0x00b9 }, + { 0x0014, 0x00ba }, + { 0x0014, 0x00bb }, + { 0x0014, 0x00bc }, + { 0x0014, 0x00bd }, + { 0x0014, 0x00be }, + { 0x0014, 0x00bf }, + { 0x0014, 0x00c0 }, + { 0x0014, 0x00c1 }, + { 0x0014, 0x00c2 }, + { 0x0014, 0x00c3 }, + { 0x0014, 0x00c4 }, + { 0x0014, 0x00c5 }, + { 0x0014, 0x00c6 }, + { 0x0014, 0x00c7 }, + { 0x0014, 0x00c8 }, + { 0x0014, 0x00c9 }, + { 0x0014, 0x00ca }, + { 0x0014, 0x00cb }, + { 0x0014, 0x00cc }, + { 0x0014, 0x00cd }, + { 0x0014, 0x00ce }, + { 0x0014, 0x00cf }, + { 0x0014, 0x00d0 }, + { 0x0014, 0x00d1 }, + { 0x0014, 0x00d2 }, + { 0x0014, 0x00d3 }, + { 0x0014, 0x00d4 }, + { 0x0014, 0x00d5 }, + { 0x0014, 0x00d6 }, + { 0x0014, 0x00d7 }, + { 0x0014, 0x00d8 }, + { 0x0014, 0x00d9 }, + { 0x0014, 0x00da }, + { 0x0014, 0x00db }, + { 0x0014, 0x00dc }, + { 0x0014, 0x00dd }, + { 0x0014, 0x00de }, + { 0x0014, 0x00df }, + { 0x0014, 0x00e0 }, + { 0x0014, 0x00e1 }, + { 0x0014, 0x00e2 }, + { 0x0014, 0x00e3 }, + { 0x0014, 0x00e4 }, + { 0x0014, 0x00e5 }, + { 0x0014, 0x00e6 }, + { 0x0014, 0x00e7 }, + { 0x0014, 0x00e8 }, + { 0x0014, 0x00e9 }, + { 0x0014, 0x00ea }, + { 0x0014, 0x00eb }, + { 0x0014, 0x00ec }, + { 0x0014, 0x00ed }, + { 0x0014, 0x00ee }, + { 0x0014, 0x00ef }, + { 0x0014, 0x00f0 }, + { 0x0014, 0x00f1 }, + { 0x0014, 0x00f2 }, + { 0x0014, 0x00f3 }, + { 0x0014, 0x00f4 }, + { 0x0014, 0x00f5 }, + { 0x0013, 0x007d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec44[27][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00010001, 0x00010001, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, }, - {0x0004ffff, 0x0003ffff, 0x00000003, 0x00000014, 0x00000033, 0x00000034, 0x00010024, 0x00010024, 0x00020002, 0x00020002, 0x00020002, 0x00020002, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, - {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x000affff, 0x0006ffff, 0x0005ffff, 0x00000026, 0x00010004, 0x00010004, 0x00010015, 0x00010015, 0x00010036, 0x00010036, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, }, - {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020056, 0x00020056, 0x00020056, 0x00020056, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x00000038, 0x00010005, 0x00010005, 0x00010027, 0x00010027, 0x00010055, 0x00010055, 0x00010057, 0x00010057, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, - {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, 0x00030067, }, - {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x00020068, 0x00020068, 0x00020068, 0x00020068, }, - {0x000dffff, 0x000cffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x000bffff, }, - {0x0000011a, 0x0000011b, 0x0000011c, 0x0000011d, 0x0000011e, 0x0000011f, 0x0001004c, 0x0001004c, 0x00010066, 0x00010066, 0x00010120, 0x00010120, 0x00020017, 0x00020017, 0x00020017, 0x00020017, }, - {0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000029, 0x0000002a, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x0000002f, 0x00000030, 0x00000031, 0x00000032, 0x00000039, 0x0000003a, }, - {0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d, 0x0000000e, 0x0000000f, 0x00000010, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, }, - {0x0000003b, 0x0000003c, 0x0000003d, 0x0000003e, 0x0000003f, 0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x0000004a, 0x0000004b, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, 0x00000051, }, - {0x00000052, 0x00000053, 0x00000054, 0x0000005a, 0x0000005b, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000069, }, - {0x0000006a, 0x0000006b, 0x0000006c, 0x0000006d, 0x0000006e, 0x0000006f, 0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, }, - {0x0000007a, 0x0000007b, 0x0000007c, 0x0000007d, 0x0000007e, 0x0000007f, 0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, }, - {0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, }, - {0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, 0x000000a1, 0x000000a2, 0x000000a3, 0x000000a4, 0x000000a5, 0x000000a6, 0x000000a7, 0x000000a8, 0x000000a9, }, - {0x000000aa, 0x000000ab, 0x000000ac, 0x000000ad, 0x000000ae, 0x000000af, 0x000000b0, 0x000000b1, 0x000000b2, 0x000000b3, 0x000000b4, 0x000000b5, 0x000000b6, 0x000000b7, 0x000000b8, 0x000000b9, }, - {0x000000ba, 0x000000bb, 0x000000bc, 0x000000bd, 0x000000be, 0x000000bf, 0x000000c0, 0x000000c1, 0x000000c2, 0x000000c3, 0x000000c4, 0x000000c5, 0x000000c6, 0x000000c7, 0x000000c8, 0x000000c9, }, - {0x000000ca, 0x000000cb, 0x000000cc, 0x000000cd, 0x000000ce, 0x000000cf, 0x000000d0, 0x000000d1, 0x000000d2, 0x000000d3, 0x000000d4, 0x000000d5, 0x000000d6, 0x000000d7, 0x000000d8, 0x000000d9, }, - {0x000000da, 0x000000db, 0x000000dc, 0x000000dd, 0x000000de, 0x000000df, 0x000000e0, 0x000000e1, 0x000000e2, 0x000000e3, 0x000000e4, 0x000000e5, 0x000000e6, 0x000000e7, 0x000000e8, 0x000000e9, }, - {0x000000ea, 0x000000eb, 0x000000ec, 0x000000ed, 0x000000ee, 0x000000ef, 0x000000f0, 0x000000f1, 0x000000f2, 0x000000f3, 0x000000f4, 0x000000f5, 0x000000f6, 0x000000f7, 0x000000f8, 0x000000f9, }, - {0x000000fa, 0x000000fb, 0x000000fc, 0x000000fd, 0x000000fe, 0x000000ff, 0x00000100, 0x00000101, 0x00000102, 0x00000103, 0x00000104, 0x00000105, 0x00000106, 0x00000107, 0x00000108, 0x00000109, }, - {0x0000010a, 0x0000010b, 0x0000010c, 0x0000010d, 0x0000010e, 0x0000010f, 0x00000110, 0x00000111, 0x00000112, 0x00000113, 0x00000114, 0x00000115, 0x00000116, 0x00000117, 0x00000118, 0x00000119, }, +const uint32_t c_aauiCQMFHuffDec44[27][16] = { + { + 0x0002ffff, + 0x0001ffff, + 0x00010001, + 0x00010001, + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + 0x00030000, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + }, + { + 0x0004ffff, + 0x0003ffff, + 0x00000003, + 0x00000014, + 0x00000033, + 0x00000034, + 0x00010024, + 0x00010024, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + }, + { + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x000affff, + 0x0006ffff, + 0x0005ffff, + 0x00000026, + 0x00010004, + 0x00010004, + 0x00010015, + 0x00010015, + 0x00010036, + 0x00010036, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + }, + { + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + }, + { + 0x0009ffff, + 0x0007ffff, + 0x0008ffff, + 0x00000038, + 0x00010005, + 0x00010005, + 0x00010027, + 0x00010027, + 0x00010055, + 0x00010055, + 0x00010057, + 0x00010057, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + }, + { + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + 0x00030067, + }, + { + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020068, + 0x00020068, + 0x00020068, + 0x00020068, + }, + { + 0x000dffff, + 0x000cffff, + 0x000effff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x000bffff, + }, + { + 0x0000011a, + 0x0000011b, + 0x0000011c, + 0x0000011d, + 0x0000011e, + 0x0000011f, + 0x0001004c, + 0x0001004c, + 0x00010066, + 0x00010066, + 0x00010120, + 0x00010120, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + }, + { + 0x0000001e, + 0x0000001f, + 0x00000020, + 0x00000021, + 0x00000029, + 0x0000002a, + 0x0000002b, + 0x0000002c, + 0x0000002d, + 0x0000002e, + 0x0000002f, + 0x00000030, + 0x00000031, + 0x00000032, + 0x00000039, + 0x0000003a, + }, + { + 0x00000007, + 0x00000008, + 0x00000009, + 0x0000000a, + 0x0000000b, + 0x0000000c, + 0x0000000d, + 0x0000000e, + 0x0000000f, + 0x00000010, + 0x00000018, + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x0000001c, + 0x0000001d, + }, + { + 0x0000003b, + 0x0000003c, + 0x0000003d, + 0x0000003e, + 0x0000003f, + 0x00000040, + 0x00000041, + 0x00000042, + 0x00000043, + 0x0000004a, + 0x0000004b, + 0x0000004d, + 0x0000004e, + 0x0000004f, + 0x00000050, + 0x00000051, + }, + { + 0x00000052, + 0x00000053, + 0x00000054, + 0x0000005a, + 0x0000005b, + 0x0000005c, + 0x0000005d, + 0x0000005e, + 0x0000005f, + 0x00000060, + 0x00000061, + 0x00000062, + 0x00000063, + 0x00000064, + 0x00000065, + 0x00000069, + }, + { + 0x0000006a, + 0x0000006b, + 0x0000006c, + 0x0000006d, + 0x0000006e, + 0x0000006f, + 0x00000070, + 0x00000071, + 0x00000072, + 0x00000073, + 0x00000074, + 0x00000075, + 0x00000076, + 0x00000077, + 0x00000078, + 0x00000079, + }, + { + 0x0000007a, + 0x0000007b, + 0x0000007c, + 0x0000007d, + 0x0000007e, + 0x0000007f, + 0x00000080, + 0x00000081, + 0x00000082, + 0x00000083, + 0x00000084, + 0x00000085, + 0x00000086, + 0x00000087, + 0x00000088, + 0x00000089, + }, + { + 0x0000008a, + 0x0000008b, + 0x0000008c, + 0x0000008d, + 0x0000008e, + 0x0000008f, + 0x00000090, + 0x00000091, + 0x00000092, + 0x00000093, + 0x00000094, + 0x00000095, + 0x00000096, + 0x00000097, + 0x00000098, + 0x00000099, + }, + { + 0x0000009a, + 0x0000009b, + 0x0000009c, + 0x0000009d, + 0x0000009e, + 0x0000009f, + 0x000000a0, + 0x000000a1, + 0x000000a2, + 0x000000a3, + 0x000000a4, + 0x000000a5, + 0x000000a6, + 0x000000a7, + 0x000000a8, + 0x000000a9, + }, + { + 0x000000aa, + 0x000000ab, + 0x000000ac, + 0x000000ad, + 0x000000ae, + 0x000000af, + 0x000000b0, + 0x000000b1, + 0x000000b2, + 0x000000b3, + 0x000000b4, + 0x000000b5, + 0x000000b6, + 0x000000b7, + 0x000000b8, + 0x000000b9, + }, + { + 0x000000ba, + 0x000000bb, + 0x000000bc, + 0x000000bd, + 0x000000be, + 0x000000bf, + 0x000000c0, + 0x000000c1, + 0x000000c2, + 0x000000c3, + 0x000000c4, + 0x000000c5, + 0x000000c6, + 0x000000c7, + 0x000000c8, + 0x000000c9, + }, + { + 0x000000ca, + 0x000000cb, + 0x000000cc, + 0x000000cd, + 0x000000ce, + 0x000000cf, + 0x000000d0, + 0x000000d1, + 0x000000d2, + 0x000000d3, + 0x000000d4, + 0x000000d5, + 0x000000d6, + 0x000000d7, + 0x000000d8, + 0x000000d9, + }, + { + 0x000000da, + 0x000000db, + 0x000000dc, + 0x000000dd, + 0x000000de, + 0x000000df, + 0x000000e0, + 0x000000e1, + 0x000000e2, + 0x000000e3, + 0x000000e4, + 0x000000e5, + 0x000000e6, + 0x000000e7, + 0x000000e8, + 0x000000e9, + }, + { + 0x000000ea, + 0x000000eb, + 0x000000ec, + 0x000000ed, + 0x000000ee, + 0x000000ef, + 0x000000f0, + 0x000000f1, + 0x000000f2, + 0x000000f3, + 0x000000f4, + 0x000000f5, + 0x000000f6, + 0x000000f7, + 0x000000f8, + 0x000000f9, + }, + { + 0x000000fa, + 0x000000fb, + 0x000000fc, + 0x000000fd, + 0x000000fe, + 0x000000ff, + 0x00000100, + 0x00000101, + 0x00000102, + 0x00000103, + 0x00000104, + 0x00000105, + 0x00000106, + 0x00000107, + 0x00000108, + 0x00000109, + }, + { + 0x0000010a, + 0x0000010b, + 0x0000010c, + 0x0000010d, + 0x0000010e, + 0x0000010f, + 0x00000110, + 0x00000111, + 0x00000112, + 0x00000113, + 0x00000114, + 0x00000115, + 0x00000116, + 0x00000117, + 0x00000118, + 0x00000119, + }, }; #endif @@ -2781,104 +27923,1236 @@ const uint32_t c_aauiCQMFHuffEnc45[324][2] = #else const uint16_t c_aauiCQMFHuffEnc45[324][2] = #endif -{ - {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0002}, {0x0009, 0x0003}, {0x000c, 0x0005}, {0x0010, 0x0025}, {0x0012, 0x0088}, - {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, - {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0004}, {0x0006, 0x0003}, {0x0009, 0x0004}, {0x000b, 0x0004}, - {0x000f, 0x0014}, {0x0011, 0x0048}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, - {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0005, 0x0005}, {0x0004, 0x0003}, {0x0006, 0x0004}, {0x0007, 0x0003}, - {0x000a, 0x0004}, {0x000d, 0x0007}, {0x000f, 0x0015}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, - {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0007, 0x0004}, {0x0006, 0x0005}, - {0x0007, 0x0005}, {0x0009, 0x0005}, {0x000b, 0x0005}, {0x000d, 0x0008}, {0x0010, 0x0026}, {0x0012, 0x0089}, {0x0012, 0x008a}, {0x0013, 0x001f}, - {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, - {0x0009, 0x0006}, {0x0009, 0x0007}, {0x000a, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x0009}, {0x000f, 0x0016}, {0x0011, 0x0049}, {0x0013, 0x0028}, - {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, - {0x0013, 0x0031}, {0x0013, 0x0032}, {0x000c, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0007}, {0x000e, 0x000d}, {0x0010, 0x0027}, {0x0012, 0x008b}, - {0x0012, 0x008c}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, - {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x000f, 0x0017}, {0x000f, 0x0018}, {0x000f, 0x0019}, {0x0012, 0x008d}, - {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, - {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0012, 0x008e}, - {0x0012, 0x008f}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, - {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, - {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, - {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, - {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, - {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, - {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, - {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, - {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, - {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, - {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, - {0x0013, 0x00a4}, {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, - {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, - {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, - {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, - {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, - {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, - {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, - {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, - {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, - {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, - {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, - {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, - {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, - {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, + { + { 0x0002, 0x0002 }, + { 0x0003, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0007, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000c, 0x0005 }, + { 0x0010, 0x0025 }, + { 0x0012, 0x0088 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0006, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x000b, 0x0004 }, + { 0x000f, 0x0014 }, + { 0x0011, 0x0048 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0005, 0x0005 }, + { 0x0004, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0007, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000d, 0x0007 }, + { 0x000f, 0x0015 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0007, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0005 }, + { 0x0009, 0x0005 }, + { 0x000b, 0x0005 }, + { 0x000d, 0x0008 }, + { 0x0010, 0x0026 }, + { 0x0012, 0x0089 }, + { 0x0012, 0x008a }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x000a, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000d, 0x0009 }, + { 0x000f, 0x0016 }, + { 0x0011, 0x0049 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x000c, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0007 }, + { 0x000e, 0x000d }, + { 0x0010, 0x0027 }, + { 0x0012, 0x008b }, + { 0x0012, 0x008c }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x000f, 0x0017 }, + { 0x000f, 0x0018 }, + { 0x000f, 0x0019 }, + { 0x0012, 0x008d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0012, 0x008e }, + { 0x0012, 0x008f }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x0013, 0x0054 }, + { 0x0013, 0x0055 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0013, 0x0062 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x0013, 0x0066 }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x0013, 0x008b }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0013, 0x008e }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0013, 0x0091 }, + { 0x0013, 0x0092 }, + { 0x0013, 0x0093 }, + { 0x0013, 0x0094 }, + { 0x0013, 0x0095 }, + { 0x0013, 0x0096 }, + { 0x0013, 0x0097 }, + { 0x0013, 0x0098 }, + { 0x0013, 0x0099 }, + { 0x0013, 0x009a }, + { 0x0013, 0x009b }, + { 0x0013, 0x009c }, + { 0x0013, 0x009d }, + { 0x0013, 0x009e }, + { 0x0013, 0x009f }, + { 0x0013, 0x00a0 }, + { 0x0013, 0x00a1 }, + { 0x0013, 0x00a2 }, + { 0x0013, 0x00a3 }, + { 0x0013, 0x00a4 }, + { 0x0013, 0x00a5 }, + { 0x0013, 0x00a6 }, + { 0x0013, 0x00a7 }, + { 0x0013, 0x00a8 }, + { 0x0013, 0x00a9 }, + { 0x0013, 0x00aa }, + { 0x0013, 0x00ab }, + { 0x0013, 0x00ac }, + { 0x0013, 0x00ad }, + { 0x0013, 0x00ae }, + { 0x0013, 0x00af }, + { 0x0013, 0x00b0 }, + { 0x0013, 0x00b1 }, + { 0x0013, 0x00b2 }, + { 0x0013, 0x00b3 }, + { 0x0013, 0x00b4 }, + { 0x0013, 0x00b5 }, + { 0x0013, 0x00b6 }, + { 0x0013, 0x00b7 }, + { 0x0013, 0x00b8 }, + { 0x0013, 0x00b9 }, + { 0x0013, 0x00ba }, + { 0x0013, 0x00bb }, + { 0x0013, 0x00bc }, + { 0x0013, 0x00bd }, + { 0x0013, 0x00be }, + { 0x0013, 0x00bf }, + { 0x0013, 0x00c0 }, + { 0x0013, 0x00c1 }, + { 0x0013, 0x00c2 }, + { 0x0013, 0x00c3 }, + { 0x0013, 0x00c4 }, + { 0x0013, 0x00c5 }, + { 0x0013, 0x00c6 }, + { 0x0013, 0x00c7 }, + { 0x0013, 0x00c8 }, + { 0x0013, 0x00c9 }, + { 0x0013, 0x00ca }, + { 0x0013, 0x00cb }, + { 0x0013, 0x00cc }, + { 0x0013, 0x00cd }, + { 0x0013, 0x00ce }, + { 0x0013, 0x00cf }, + { 0x0013, 0x00d0 }, + { 0x0013, 0x00d1 }, + { 0x0013, 0x00d2 }, + { 0x0013, 0x00d3 }, + { 0x0013, 0x00d4 }, + { 0x0013, 0x00d5 }, + { 0x0013, 0x00d6 }, + { 0x0013, 0x00d7 }, + { 0x0013, 0x00d8 }, + { 0x0013, 0x00d9 }, + { 0x0013, 0x00da }, + { 0x0013, 0x00db }, + { 0x0013, 0x00dc }, + { 0x0013, 0x00dd }, + { 0x0013, 0x00de }, + { 0x0013, 0x00df }, + { 0x0013, 0x00e0 }, + { 0x0013, 0x00e1 }, + { 0x0013, 0x00e2 }, + { 0x0013, 0x00e3 }, + { 0x0013, 0x00e4 }, + { 0x0013, 0x00e5 }, + { 0x0013, 0x00e6 }, + { 0x0013, 0x00e7 }, + { 0x0013, 0x00e8 }, + { 0x0013, 0x00e9 }, + { 0x0013, 0x00ea }, + { 0x0013, 0x00eb }, + { 0x0013, 0x00ec }, + { 0x0013, 0x00ed }, + { 0x0013, 0x00ee }, + { 0x0013, 0x00ef }, + { 0x0013, 0x00f0 }, + { 0x0013, 0x00f1 }, + { 0x0013, 0x00f2 }, + { 0x0013, 0x00f3 }, + { 0x0013, 0x00f4 }, + { 0x0013, 0x00f5 }, + { 0x0013, 0x00f6 }, + { 0x0013, 0x00f7 }, + { 0x0013, 0x00f8 }, + { 0x0013, 0x00f9 }, + { 0x0013, 0x00fa }, + { 0x0013, 0x00fb }, + { 0x0013, 0x00fc }, + { 0x0013, 0x00fd }, + { 0x0013, 0x00fe }, + { 0x0013, 0x00ff }, + { 0x0013, 0x0100 }, + { 0x0013, 0x0101 }, + { 0x0013, 0x0102 }, + { 0x0013, 0x0103 }, + { 0x0013, 0x0104 }, + { 0x0013, 0x0105 }, + { 0x0013, 0x0106 }, + { 0x0013, 0x0107 }, + { 0x0013, 0x0108 }, + { 0x0013, 0x0109 }, + { 0x0013, 0x010a }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0013, 0x010f }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec45[50][16] = -{ - {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000025, 0x00010001, 0x00010001, 0x00010013, 0x00010013, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x0007ffff, 0x0005ffff, 0x0004ffff, 0x0006ffff, 0x00010003, 0x00010003, 0x00010027, 0x00010027, 0x00010036, 0x00010036, 0x00010038, 0x00010038, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, 0x00030039, }, - {0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, }, - {0x000effff, 0x001fffff, 0x000affff, 0x0008ffff, 0x0009ffff, 0x00000005, 0x0000005a, 0x0000005c, 0x00010017, 0x00010017, 0x0001003a, 0x0001003a, 0x0001004b, 0x0001004b, 0x0001005b, 0x0001005b, }, - {0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, - {0x0030ffff, 0x0031ffff, 0x000cffff, 0x000dffff, 0x000bffff, 0x00000006, 0x0000003c, 0x0000005e, 0x00010018, 0x00010018, 0x0001002a, 0x0001002a, 0x0001004d, 0x0001004d, 0x0001006c, 0x0001006c, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, - {0x00020007, 0x00020007, 0x00020007, 0x00020007, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, }, - {0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, - {0x0010ffff, 0x0011ffff, 0x0012ffff, 0x000fffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, }, - {0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x0001003f, 0x0001003f, }, - {0x00010008, 0x00010008, 0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, }, - {0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, }, - {0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, }, - {0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, }, - {0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, }, - {0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, }, - {0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x00010070, 0x00010070, 0x00010071, 0x00010071, }, - {0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, }, - {0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, }, - {0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, }, - {0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00010093, 0x00010093, }, - {0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, }, - {0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, }, - {0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, }, - {0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, }, - {0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, }, - {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, - {0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, }, - {0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, }, - {0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, }, - {0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, }, - {0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100e1, 0x000100e1, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, }, - {0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, }, - {0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, }, - {0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x000100fa, 0x000100fa, 0x000100fb, 0x000100fb, }, - {0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, }, - {0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, }, - {0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, 0x00010112, 0x00010112, 0x00010113, 0x00010113, }, - {0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, 0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, }, - {0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, 0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, }, - {0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, 0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, }, - {0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010132, 0x00010132, 0x00010133, 0x00010133, }, - {0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, }, - {0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, }, +const uint32_t c_aauiCQMFHuffDec45[50][16] = { + { + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000025, + 0x00010001, + 0x00010001, + 0x00010013, + 0x00010013, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x0007ffff, + 0x0005ffff, + 0x0004ffff, + 0x0006ffff, + 0x00010003, + 0x00010003, + 0x00010027, + 0x00010027, + 0x00010036, + 0x00010036, + 0x00010038, + 0x00010038, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + }, + { + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + 0x00030039, + }, + { + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + }, + { + 0x000effff, + 0x001fffff, + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x00000005, + 0x0000005a, + 0x0000005c, + 0x00010017, + 0x00010017, + 0x0001003a, + 0x0001003a, + 0x0001004b, + 0x0001004b, + 0x0001005b, + 0x0001005b, + }, + { + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + }, + { + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + }, + { + 0x0030ffff, + 0x0031ffff, + 0x000cffff, + 0x000dffff, + 0x000bffff, + 0x00000006, + 0x0000003c, + 0x0000005e, + 0x00010018, + 0x00010018, + 0x0001002a, + 0x0001002a, + 0x0001004d, + 0x0001004d, + 0x0001006c, + 0x0001006c, + }, + { + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + }, + { + 0x00020007, + 0x00020007, + 0x00020007, + 0x00020007, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x0002005f, + }, + { + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + }, + { + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x000fffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001effff, + }, + { + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x0001003f, + 0x0001003f, + }, + { + 0x00010008, + 0x00010008, + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + }, + { + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + }, + { + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + }, + { + 0x00010040, + 0x00010040, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + }, + { + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + 0x00010052, + 0x00010052, + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + 0x00010056, + 0x00010056, + }, + { + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + }, + { + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x00010069, + 0x00010069, + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + 0x00010070, + 0x00010070, + 0x00010071, + 0x00010071, + }, + { + 0x00010072, + 0x00010072, + 0x00010073, + 0x00010073, + 0x00010074, + 0x00010074, + 0x00010075, + 0x00010075, + 0x00010076, + 0x00010076, + 0x00010077, + 0x00010077, + 0x00010078, + 0x00010078, + 0x00010079, + 0x00010079, + }, + { + 0x0001007a, + 0x0001007a, + 0x0001007b, + 0x0001007b, + 0x0001007c, + 0x0001007c, + 0x0001007d, + 0x0001007d, + 0x0001007e, + 0x0001007e, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + 0x00010083, + 0x00010083, + }, + { + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010087, + 0x00010087, + 0x00010088, + 0x00010088, + 0x00010089, + 0x00010089, + 0x0001008a, + 0x0001008a, + 0x0001008b, + 0x0001008b, + }, + { + 0x0001008c, + 0x0001008c, + 0x0001008d, + 0x0001008d, + 0x0001008e, + 0x0001008e, + 0x0001008f, + 0x0001008f, + 0x00010090, + 0x00010090, + 0x00010091, + 0x00010091, + 0x00010092, + 0x00010092, + 0x00010093, + 0x00010093, + }, + { + 0x00010094, + 0x00010094, + 0x00010095, + 0x00010095, + 0x00010096, + 0x00010096, + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + 0x00010099, + 0x00010099, + 0x0001009a, + 0x0001009a, + 0x0001009b, + 0x0001009b, + }, + { + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + 0x000100a1, + 0x000100a1, + 0x000100a2, + 0x000100a2, + 0x000100a3, + 0x000100a3, + }, + { + 0x000100a4, + 0x000100a4, + 0x000100a5, + 0x000100a5, + 0x000100a6, + 0x000100a6, + 0x000100a7, + 0x000100a7, + 0x000100a8, + 0x000100a8, + 0x000100a9, + 0x000100a9, + 0x000100aa, + 0x000100aa, + 0x000100ab, + 0x000100ab, + }, + { + 0x000100ac, + 0x000100ac, + 0x000100ad, + 0x000100ad, + 0x000100ae, + 0x000100ae, + 0x000100af, + 0x000100af, + 0x000100b0, + 0x000100b0, + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + }, + { + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + }, + { + 0x000100b4, + 0x000100b4, + 0x000100b5, + 0x000100b5, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + 0x000100b8, + 0x000100b8, + 0x000100b9, + 0x000100b9, + 0x000100ba, + 0x000100ba, + 0x000100bb, + 0x000100bb, + }, + { + 0x000100bc, + 0x000100bc, + 0x000100bd, + 0x000100bd, + 0x000100be, + 0x000100be, + 0x000100bf, + 0x000100bf, + 0x000100c0, + 0x000100c0, + 0x000100c1, + 0x000100c1, + 0x000100c2, + 0x000100c2, + 0x000100c3, + 0x000100c3, + }, + { + 0x000100c4, + 0x000100c4, + 0x000100c5, + 0x000100c5, + 0x000100c6, + 0x000100c6, + 0x000100c7, + 0x000100c7, + 0x000100c8, + 0x000100c8, + 0x000100c9, + 0x000100c9, + 0x000100ca, + 0x000100ca, + 0x000100cb, + 0x000100cb, + }, + { + 0x000100cc, + 0x000100cc, + 0x000100cd, + 0x000100cd, + 0x000100ce, + 0x000100ce, + 0x000100cf, + 0x000100cf, + 0x000100d0, + 0x000100d0, + 0x000100d1, + 0x000100d1, + 0x000100d2, + 0x000100d2, + 0x000100d3, + 0x000100d3, + }, + { + 0x000100d4, + 0x000100d4, + 0x000100d5, + 0x000100d5, + 0x000100d6, + 0x000100d6, + 0x000100d7, + 0x000100d7, + 0x000100d8, + 0x000100d8, + 0x000100d9, + 0x000100d9, + 0x000100da, + 0x000100da, + 0x000100db, + 0x000100db, + }, + { + 0x000100dc, + 0x000100dc, + 0x000100dd, + 0x000100dd, + 0x000100de, + 0x000100de, + 0x000100df, + 0x000100df, + 0x000100e0, + 0x000100e0, + 0x000100e1, + 0x000100e1, + 0x000100e2, + 0x000100e2, + 0x000100e3, + 0x000100e3, + }, + { + 0x000100e4, + 0x000100e4, + 0x000100e5, + 0x000100e5, + 0x000100e6, + 0x000100e6, + 0x000100e7, + 0x000100e7, + 0x000100e8, + 0x000100e8, + 0x000100e9, + 0x000100e9, + 0x000100ea, + 0x000100ea, + 0x000100eb, + 0x000100eb, + }, + { + 0x000100ec, + 0x000100ec, + 0x000100ed, + 0x000100ed, + 0x000100ee, + 0x000100ee, + 0x000100ef, + 0x000100ef, + 0x000100f0, + 0x000100f0, + 0x000100f1, + 0x000100f1, + 0x000100f2, + 0x000100f2, + 0x000100f3, + 0x000100f3, + }, + { + 0x000100f4, + 0x000100f4, + 0x000100f5, + 0x000100f5, + 0x000100f6, + 0x000100f6, + 0x000100f7, + 0x000100f7, + 0x000100f8, + 0x000100f8, + 0x000100f9, + 0x000100f9, + 0x000100fa, + 0x000100fa, + 0x000100fb, + 0x000100fb, + }, + { + 0x000100fc, + 0x000100fc, + 0x000100fd, + 0x000100fd, + 0x000100fe, + 0x000100fe, + 0x000100ff, + 0x000100ff, + 0x00010100, + 0x00010100, + 0x00010101, + 0x00010101, + 0x00010102, + 0x00010102, + 0x00010103, + 0x00010103, + }, + { + 0x00010104, + 0x00010104, + 0x00010105, + 0x00010105, + 0x00010106, + 0x00010106, + 0x00010107, + 0x00010107, + 0x00010108, + 0x00010108, + 0x00010109, + 0x00010109, + 0x0001010a, + 0x0001010a, + 0x0001010b, + 0x0001010b, + }, + { + 0x0001010c, + 0x0001010c, + 0x0001010d, + 0x0001010d, + 0x0001010e, + 0x0001010e, + 0x0001010f, + 0x0001010f, + 0x00010110, + 0x00010110, + 0x00010111, + 0x00010111, + 0x00010112, + 0x00010112, + 0x00010113, + 0x00010113, + }, + { + 0x00010114, + 0x00010114, + 0x00010115, + 0x00010115, + 0x00010116, + 0x00010116, + 0x00010117, + 0x00010117, + 0x00010118, + 0x00010118, + 0x00010119, + 0x00010119, + 0x0001011a, + 0x0001011a, + 0x0001011b, + 0x0001011b, + }, + { + 0x0001011c, + 0x0001011c, + 0x0001011d, + 0x0001011d, + 0x0001011e, + 0x0001011e, + 0x0001011f, + 0x0001011f, + 0x00010120, + 0x00010120, + 0x00010121, + 0x00010121, + 0x00010122, + 0x00010122, + 0x00010123, + 0x00010123, + }, + { + 0x00010124, + 0x00010124, + 0x00010125, + 0x00010125, + 0x00010126, + 0x00010126, + 0x00010127, + 0x00010127, + 0x00010128, + 0x00010128, + 0x00010129, + 0x00010129, + 0x0001012a, + 0x0001012a, + 0x0001012b, + 0x0001012b, + }, + { + 0x0001012c, + 0x0001012c, + 0x0001012d, + 0x0001012d, + 0x0001012e, + 0x0001012e, + 0x0001012f, + 0x0001012f, + 0x00010130, + 0x00010130, + 0x00010131, + 0x00010131, + 0x00010132, + 0x00010132, + 0x00010133, + 0x00010133, + }, + { + 0x00010134, + 0x00010134, + 0x00010135, + 0x00010135, + 0x00010136, + 0x00010136, + 0x00010137, + 0x00010137, + 0x00010138, + 0x00010138, + 0x00010139, + 0x00010139, + 0x0001013a, + 0x0001013a, + 0x0001013b, + 0x0001013b, + }, + { + 0x0001013c, + 0x0001013c, + 0x0001013d, + 0x0001013d, + 0x0001013e, + 0x0001013e, + 0x0001013f, + 0x0001013f, + 0x00010140, + 0x00010140, + 0x00010141, + 0x00010141, + 0x00010142, + 0x00010142, + 0x00010143, + 0x00010143, + }, }; #endif @@ -2887,123 +29161,1509 @@ const uint32_t c_aauiCQMFHuffEnc46[400][2] = #else const uint16_t c_aauiCQMFHuffEnc46[400][2] = #endif -{ - {0x0002, 0x0002}, {0x0003, 0x0002}, {0x0005, 0x0003}, {0x0007, 0x0004}, {0x0009, 0x0005}, {0x000b, 0x0006}, {0x000d, 0x000a}, {0x000f, 0x0018}, - {0x0012, 0x00a6}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, - {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0004}, {0x0006, 0x0004}, - {0x0008, 0x0004}, {0x000a, 0x0006}, {0x000c, 0x0008}, {0x000e, 0x0011}, {0x0012, 0x00a7}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, - {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0007, 0x0005}, {0x0009, 0x0006}, {0x000b, 0x0007}, {0x000d, 0x000b}, {0x000f, 0x0019}, - {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, - {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0007, 0x0006}, {0x0006, 0x0005}, {0x0007, 0x0007}, {0x0008, 0x0005}, - {0x000a, 0x0007}, {0x000c, 0x0009}, {0x000e, 0x0012}, {0x000f, 0x001a}, {0x0012, 0x00a8}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, - {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, - {0x0009, 0x0007}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x000a, 0x0008}, {0x000b, 0x0008}, {0x000d, 0x000c}, {0x000e, 0x0013}, {0x0010, 0x002c}, - {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, - {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x000b, 0x0009}, {0x000a, 0x0009}, {0x000b, 0x000a}, {0x000b, 0x000b}, - {0x000d, 0x000d}, {0x000f, 0x001b}, {0x0010, 0x002d}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, - {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, - {0x000d, 0x000e}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000d, 0x000f}, {0x000f, 0x001c}, {0x000f, 0x001d}, {0x0013, 0x0046}, {0x0013, 0x0047}, - {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, - {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x000f, 0x001e}, {0x000f, 0x001f}, {0x000f, 0x0020}, {0x000f, 0x0021}, - {0x0010, 0x002e}, {0x0012, 0x00a9}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0012, 0x00aa}, {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, - {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, - {0x0013, 0x0061}, {0x0010, 0x002f}, {0x0013, 0x0062}, {0x0011, 0x0057}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, - {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, - {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, - {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, - {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, - {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, - {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, {0x0013, 0x0096}, - {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, - {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, {0x0013, 0x00a6}, - {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, - {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, - {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, - {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, - {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, - {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, - {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, - {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, - {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, - {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, - {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, - {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, - {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, - {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, - {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, - {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, - {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, - {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, - {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, - {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, - {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0012, 0x00ab}, {0x0012, 0x00ac}, {0x0012, 0x00ad}, -}; + { + { 0x0002, 0x0002 }, + { 0x0003, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000d, 0x000a }, + { 0x000f, 0x0018 }, + { 0x0012, 0x00a6 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0006, 0x0004 }, + { 0x0008, 0x0004 }, + { 0x000a, 0x0006 }, + { 0x000c, 0x0008 }, + { 0x000e, 0x0011 }, + { 0x0012, 0x00a7 }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0007, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000d, 0x000b }, + { 0x000f, 0x0019 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0007, 0x0006 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0005 }, + { 0x000a, 0x0007 }, + { 0x000c, 0x0009 }, + { 0x000e, 0x0012 }, + { 0x000f, 0x001a }, + { 0x0012, 0x00a8 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0009, 0x0007 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x000a, 0x0008 }, + { 0x000b, 0x0008 }, + { 0x000d, 0x000c }, + { 0x000e, 0x0013 }, + { 0x0010, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x000b, 0x0009 }, + { 0x000a, 0x0009 }, + { 0x000b, 0x000a }, + { 0x000b, 0x000b }, + { 0x000d, 0x000d }, + { 0x000f, 0x001b }, + { 0x0010, 0x002d }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x000d, 0x000e }, + { 0x000c, 0x000a }, + { 0x000c, 0x000b }, + { 0x000d, 0x000f }, + { 0x000f, 0x001c }, + { 0x000f, 0x001d }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x000f, 0x001e }, + { 0x000f, 0x001f }, + { 0x000f, 0x0020 }, + { 0x000f, 0x0021 }, + { 0x0010, 0x002e }, + { 0x0012, 0x00a9 }, + { 0x0013, 0x0054 }, + { 0x0013, 0x0055 }, + { 0x0012, 0x00aa }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0010, 0x002f }, + { 0x0013, 0x0062 }, + { 0x0011, 0x0057 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x0013, 0x0066 }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x0013, 0x008b }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0013, 0x008e }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0013, 0x0091 }, + { 0x0013, 0x0092 }, + { 0x0013, 0x0093 }, + { 0x0013, 0x0094 }, + { 0x0013, 0x0095 }, + { 0x0013, 0x0096 }, + { 0x0013, 0x0097 }, + { 0x0013, 0x0098 }, + { 0x0013, 0x0099 }, + { 0x0013, 0x009a }, + { 0x0013, 0x009b }, + { 0x0013, 0x009c }, + { 0x0013, 0x009d }, + { 0x0013, 0x009e }, + { 0x0013, 0x009f }, + { 0x0013, 0x00a0 }, + { 0x0013, 0x00a1 }, + { 0x0013, 0x00a2 }, + { 0x0013, 0x00a3 }, + { 0x0013, 0x00a4 }, + { 0x0013, 0x00a5 }, + { 0x0013, 0x00a6 }, + { 0x0013, 0x00a7 }, + { 0x0013, 0x00a8 }, + { 0x0013, 0x00a9 }, + { 0x0013, 0x00aa }, + { 0x0013, 0x00ab }, + { 0x0013, 0x00ac }, + { 0x0013, 0x00ad }, + { 0x0013, 0x00ae }, + { 0x0013, 0x00af }, + { 0x0013, 0x00b0 }, + { 0x0013, 0x00b1 }, + { 0x0013, 0x00b2 }, + { 0x0013, 0x00b3 }, + { 0x0013, 0x00b4 }, + { 0x0013, 0x00b5 }, + { 0x0013, 0x00b6 }, + { 0x0013, 0x00b7 }, + { 0x0013, 0x00b8 }, + { 0x0013, 0x00b9 }, + { 0x0013, 0x00ba }, + { 0x0013, 0x00bb }, + { 0x0013, 0x00bc }, + { 0x0013, 0x00bd }, + { 0x0013, 0x00be }, + { 0x0013, 0x00bf }, + { 0x0013, 0x00c0 }, + { 0x0013, 0x00c1 }, + { 0x0013, 0x00c2 }, + { 0x0013, 0x00c3 }, + { 0x0013, 0x00c4 }, + { 0x0013, 0x00c5 }, + { 0x0013, 0x00c6 }, + { 0x0013, 0x00c7 }, + { 0x0013, 0x00c8 }, + { 0x0013, 0x00c9 }, + { 0x0013, 0x00ca }, + { 0x0013, 0x00cb }, + { 0x0013, 0x00cc }, + { 0x0013, 0x00cd }, + { 0x0013, 0x00ce }, + { 0x0013, 0x00cf }, + { 0x0013, 0x00d0 }, + { 0x0013, 0x00d1 }, + { 0x0013, 0x00d2 }, + { 0x0013, 0x00d3 }, + { 0x0013, 0x00d4 }, + { 0x0013, 0x00d5 }, + { 0x0013, 0x00d6 }, + { 0x0013, 0x00d7 }, + { 0x0013, 0x00d8 }, + { 0x0013, 0x00d9 }, + { 0x0013, 0x00da }, + { 0x0013, 0x00db }, + { 0x0013, 0x00dc }, + { 0x0013, 0x00dd }, + { 0x0013, 0x00de }, + { 0x0013, 0x00df }, + { 0x0013, 0x00e0 }, + { 0x0013, 0x00e1 }, + { 0x0013, 0x00e2 }, + { 0x0013, 0x00e3 }, + { 0x0013, 0x00e4 }, + { 0x0013, 0x00e5 }, + { 0x0013, 0x00e6 }, + { 0x0013, 0x00e7 }, + { 0x0013, 0x00e8 }, + { 0x0013, 0x00e9 }, + { 0x0013, 0x00ea }, + { 0x0013, 0x00eb }, + { 0x0013, 0x00ec }, + { 0x0013, 0x00ed }, + { 0x0013, 0x00ee }, + { 0x0013, 0x00ef }, + { 0x0013, 0x00f0 }, + { 0x0013, 0x00f1 }, + { 0x0013, 0x00f2 }, + { 0x0013, 0x00f3 }, + { 0x0013, 0x00f4 }, + { 0x0013, 0x00f5 }, + { 0x0013, 0x00f6 }, + { 0x0013, 0x00f7 }, + { 0x0013, 0x00f8 }, + { 0x0013, 0x00f9 }, + { 0x0013, 0x00fa }, + { 0x0013, 0x00fb }, + { 0x0013, 0x00fc }, + { 0x0013, 0x00fd }, + { 0x0013, 0x00fe }, + { 0x0013, 0x00ff }, + { 0x0013, 0x0100 }, + { 0x0013, 0x0101 }, + { 0x0013, 0x0102 }, + { 0x0013, 0x0103 }, + { 0x0013, 0x0104 }, + { 0x0013, 0x0105 }, + { 0x0013, 0x0106 }, + { 0x0013, 0x0107 }, + { 0x0013, 0x0108 }, + { 0x0013, 0x0109 }, + { 0x0013, 0x010a }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0013, 0x010f }, + { 0x0013, 0x0110 }, + { 0x0013, 0x0111 }, + { 0x0013, 0x0112 }, + { 0x0013, 0x0113 }, + { 0x0013, 0x0114 }, + { 0x0013, 0x0115 }, + { 0x0013, 0x0116 }, + { 0x0013, 0x0117 }, + { 0x0013, 0x0118 }, + { 0x0013, 0x0119 }, + { 0x0013, 0x011a }, + { 0x0013, 0x011b }, + { 0x0013, 0x011c }, + { 0x0013, 0x011d }, + { 0x0013, 0x011e }, + { 0x0013, 0x011f }, + { 0x0013, 0x0120 }, + { 0x0013, 0x0121 }, + { 0x0013, 0x0122 }, + { 0x0013, 0x0123 }, + { 0x0013, 0x0124 }, + { 0x0013, 0x0125 }, + { 0x0013, 0x0126 }, + { 0x0013, 0x0127 }, + { 0x0013, 0x0128 }, + { 0x0013, 0x0129 }, + { 0x0013, 0x012a }, + { 0x0013, 0x012b }, + { 0x0013, 0x012c }, + { 0x0013, 0x012d }, + { 0x0013, 0x012e }, + { 0x0013, 0x012f }, + { 0x0013, 0x0130 }, + { 0x0013, 0x0131 }, + { 0x0013, 0x0132 }, + { 0x0013, 0x0133 }, + { 0x0013, 0x0134 }, + { 0x0013, 0x0135 }, + { 0x0013, 0x0136 }, + { 0x0013, 0x0137 }, + { 0x0013, 0x0138 }, + { 0x0013, 0x0139 }, + { 0x0013, 0x013a }, + { 0x0013, 0x013b }, + { 0x0013, 0x013c }, + { 0x0013, 0x013d }, + { 0x0013, 0x013e }, + { 0x0013, 0x013f }, + { 0x0013, 0x0140 }, + { 0x0013, 0x0141 }, + { 0x0013, 0x0142 }, + { 0x0013, 0x0143 }, + { 0x0013, 0x0144 }, + { 0x0013, 0x0145 }, + { 0x0013, 0x0146 }, + { 0x0013, 0x0147 }, + { 0x0013, 0x0148 }, + { 0x0013, 0x0149 }, + { 0x0013, 0x014a }, + { 0x0013, 0x014b }, + { 0x0012, 0x00ab }, + { 0x0012, 0x00ac }, + { 0x0012, 0x00ad }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec46[61][16] = -{ - {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00010001, 0x00010001, 0x00010015, 0x00010015, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, - {0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, }, - {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x00000018, 0x0000003f, 0x00000051, 0x00000052, 0x00010003, 0x00010003, 0x0001002b, 0x0001002b, 0x0001003c, 0x0001003c, 0x0001003e, 0x0001003e, }, - {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, 0x00030050, }, - {0x00010054, 0x00010054, 0x00010064, 0x00010064, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, - {0x0012ffff, 0x0023ffff, 0x000effff, 0x000dffff, 0x000cffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0000001a, 0x00000041, 0x00000079, 0x0000007a, 0x00010005, 0x00010005, 0x0001002d, 0x0001002d, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, - {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, - {0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x00030078, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, 0x0003007b, }, - {0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020056, 0x00020056, 0x00020056, 0x00020056, }, - {0x00010007, 0x00010007, 0x0001002f, 0x0001002f, 0x00010043, 0x00010043, 0x00010069, 0x00010069, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, }, - {0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x0010ffff, 0x0011ffff, 0x000fffff, 0x00000057, 0x0000006a, 0x00000090, 0x000000a1, }, - {0x0002018e, 0x0002018e, 0x0002018e, 0x0002018e, 0x0002018f, 0x0002018f, 0x0002018f, 0x0002018f, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, - {0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, - {0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020091, 0x00020091, 0x00020091, 0x00020091, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x0002018d, 0x0002018d, 0x0002018d, 0x0002018d, }, - {0x0013ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0014ffff, 0x0015ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, }, - {0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, }, - {0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, }, - {0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, }, - {0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, }, - {0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010030, 0x00010030, 0x00010031, 0x00010031, }, - {0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, }, - {0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, }, - {0x00010063, 0x00010063, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, }, - {0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, }, - {0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, }, - {0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, 0x0001008b, 0x0001008b, 0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010095, 0x00010095, 0x00010096, 0x00010096, }, - {0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, }, - {0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a2, 0x000100a2, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, }, - {0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, }, - {0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, }, - {0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c0, 0x000100c0, }, - {0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, }, - {0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x000100c3, 0x000100c3, 0x000100c4, 0x000100c4, 0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, }, - {0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, }, - {0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, }, - {0x000100d9, 0x000100d9, 0x000100da, 0x000100da, 0x000100db, 0x000100db, 0x000100dc, 0x000100dc, 0x000100dd, 0x000100dd, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, }, - {0x000100e1, 0x000100e1, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, }, - {0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, }, - {0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f3, 0x000100f3, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, }, - {0x000100f9, 0x000100f9, 0x000100fa, 0x000100fa, 0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, }, - {0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, }, - {0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, }, - {0x00010111, 0x00010111, 0x00010112, 0x00010112, 0x00010113, 0x00010113, 0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, }, - {0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, - {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, - {0x00010129, 0x00010129, 0x0001012a, 0x0001012a, 0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, }, - {0x00010131, 0x00010131, 0x00010132, 0x00010132, 0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, }, - {0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, }, - {0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010148, 0x00010148, }, - {0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, }, - {0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, }, - {0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, }, - {0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, }, - {0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, }, - {0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, }, - {0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, }, - {0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, }, +const uint32_t c_aauiCQMFHuffDec46[61][16] = { + { + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x00010001, + 0x00010001, + 0x00010015, + 0x00010015, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + }, + { + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + }, + { + 0x0008ffff, + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x00000018, + 0x0000003f, + 0x00000051, + 0x00000052, + 0x00010003, + 0x00010003, + 0x0001002b, + 0x0001002b, + 0x0001003c, + 0x0001003c, + 0x0001003e, + 0x0001003e, + }, + { + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + }, + { + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + 0x00030050, + }, + { + 0x00010054, + 0x00010054, + 0x00010064, + 0x00010064, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + }, + { + 0x0012ffff, + 0x0023ffff, + 0x000effff, + 0x000dffff, + 0x000cffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x0000001a, + 0x00000041, + 0x00000079, + 0x0000007a, + 0x00010005, + 0x00010005, + 0x0001002d, + 0x0001002d, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + }, + { + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + }, + { + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x00030078, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + 0x0003007b, + }, + { + 0x0001008e, + 0x0001008e, + 0x0001008f, + 0x0001008f, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020056, + 0x00020056, + 0x00020056, + 0x00020056, + }, + { + 0x00010007, + 0x00010007, + 0x0001002f, + 0x0001002f, + 0x00010043, + 0x00010043, + 0x00010069, + 0x00010069, + 0x0001007c, + 0x0001007c, + 0x0001007d, + 0x0001007d, + 0x0001008c, + 0x0001008c, + 0x0001008d, + 0x0001008d, + }, + { + 0x0034ffff, + 0x0035ffff, + 0x0036ffff, + 0x0037ffff, + 0x0038ffff, + 0x0039ffff, + 0x003affff, + 0x003bffff, + 0x003cffff, + 0x0010ffff, + 0x0011ffff, + 0x000fffff, + 0x00000057, + 0x0000006a, + 0x00000090, + 0x000000a1, + }, + { + 0x0002018e, + 0x0002018e, + 0x0002018e, + 0x0002018e, + 0x0002018f, + 0x0002018f, + 0x0002018f, + 0x0002018f, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + }, + { + 0x00010189, + 0x00010189, + 0x0001018a, + 0x0001018a, + 0x0001018b, + 0x0001018b, + 0x0001018c, + 0x0001018c, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, + { + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020094, + 0x0002018d, + 0x0002018d, + 0x0002018d, + 0x0002018d, + }, + { + 0x0013ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0014ffff, + 0x0015ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + }, + { + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + }, + { + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + }, + { + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x0001005a, + 0x0001005a, + }, + { + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + }, + { + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + }, + { + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + }, + { + 0x0001005b, + 0x0001005b, + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + }, + { + 0x00010063, + 0x00010063, + 0x0001006b, + 0x0001006b, + 0x0001006c, + 0x0001006c, + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00010070, + 0x00010070, + 0x00010071, + 0x00010071, + }, + { + 0x00010072, + 0x00010072, + 0x00010073, + 0x00010073, + 0x00010074, + 0x00010074, + 0x00010075, + 0x00010075, + 0x00010076, + 0x00010076, + 0x00010077, + 0x00010077, + 0x0001007e, + 0x0001007e, + 0x0001007f, + 0x0001007f, + }, + { + 0x00010080, + 0x00010080, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + 0x00010083, + 0x00010083, + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010087, + 0x00010087, + }, + { + 0x00010088, + 0x00010088, + 0x00010089, + 0x00010089, + 0x0001008a, + 0x0001008a, + 0x0001008b, + 0x0001008b, + 0x00010092, + 0x00010092, + 0x00010093, + 0x00010093, + 0x00010095, + 0x00010095, + 0x00010096, + 0x00010096, + }, + { + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + 0x00010099, + 0x00010099, + 0x0001009a, + 0x0001009a, + 0x0001009b, + 0x0001009b, + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + }, + { + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + 0x000100a2, + 0x000100a2, + 0x000100a4, + 0x000100a4, + 0x000100a5, + 0x000100a5, + 0x000100a6, + 0x000100a6, + 0x000100a7, + 0x000100a7, + 0x000100a8, + 0x000100a8, + }, + { + 0x000100a9, + 0x000100a9, + 0x000100aa, + 0x000100aa, + 0x000100ab, + 0x000100ab, + 0x000100ac, + 0x000100ac, + 0x000100ad, + 0x000100ad, + 0x000100ae, + 0x000100ae, + 0x000100af, + 0x000100af, + 0x000100b0, + 0x000100b0, + }, + { + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + 0x000100b4, + 0x000100b4, + 0x000100b5, + 0x000100b5, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + 0x000100b8, + 0x000100b8, + }, + { + 0x000100b9, + 0x000100b9, + 0x000100ba, + 0x000100ba, + 0x000100bb, + 0x000100bb, + 0x000100bc, + 0x000100bc, + 0x000100bd, + 0x000100bd, + 0x000100be, + 0x000100be, + 0x000100bf, + 0x000100bf, + 0x000100c0, + 0x000100c0, + }, + { + 0x0024ffff, + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + }, + { + 0x000100c1, + 0x000100c1, + 0x000100c2, + 0x000100c2, + 0x000100c3, + 0x000100c3, + 0x000100c4, + 0x000100c4, + 0x000100c5, + 0x000100c5, + 0x000100c6, + 0x000100c6, + 0x000100c7, + 0x000100c7, + 0x000100c8, + 0x000100c8, + }, + { + 0x000100c9, + 0x000100c9, + 0x000100ca, + 0x000100ca, + 0x000100cb, + 0x000100cb, + 0x000100cc, + 0x000100cc, + 0x000100cd, + 0x000100cd, + 0x000100ce, + 0x000100ce, + 0x000100cf, + 0x000100cf, + 0x000100d0, + 0x000100d0, + }, + { + 0x000100d1, + 0x000100d1, + 0x000100d2, + 0x000100d2, + 0x000100d3, + 0x000100d3, + 0x000100d4, + 0x000100d4, + 0x000100d5, + 0x000100d5, + 0x000100d6, + 0x000100d6, + 0x000100d7, + 0x000100d7, + 0x000100d8, + 0x000100d8, + }, + { + 0x000100d9, + 0x000100d9, + 0x000100da, + 0x000100da, + 0x000100db, + 0x000100db, + 0x000100dc, + 0x000100dc, + 0x000100dd, + 0x000100dd, + 0x000100de, + 0x000100de, + 0x000100df, + 0x000100df, + 0x000100e0, + 0x000100e0, + }, + { + 0x000100e1, + 0x000100e1, + 0x000100e2, + 0x000100e2, + 0x000100e3, + 0x000100e3, + 0x000100e4, + 0x000100e4, + 0x000100e5, + 0x000100e5, + 0x000100e6, + 0x000100e6, + 0x000100e7, + 0x000100e7, + 0x000100e8, + 0x000100e8, + }, + { + 0x000100e9, + 0x000100e9, + 0x000100ea, + 0x000100ea, + 0x000100eb, + 0x000100eb, + 0x000100ec, + 0x000100ec, + 0x000100ed, + 0x000100ed, + 0x000100ee, + 0x000100ee, + 0x000100ef, + 0x000100ef, + 0x000100f0, + 0x000100f0, + }, + { + 0x000100f1, + 0x000100f1, + 0x000100f2, + 0x000100f2, + 0x000100f3, + 0x000100f3, + 0x000100f4, + 0x000100f4, + 0x000100f5, + 0x000100f5, + 0x000100f6, + 0x000100f6, + 0x000100f7, + 0x000100f7, + 0x000100f8, + 0x000100f8, + }, + { + 0x000100f9, + 0x000100f9, + 0x000100fa, + 0x000100fa, + 0x000100fb, + 0x000100fb, + 0x000100fc, + 0x000100fc, + 0x000100fd, + 0x000100fd, + 0x000100fe, + 0x000100fe, + 0x000100ff, + 0x000100ff, + 0x00010100, + 0x00010100, + }, + { + 0x00010101, + 0x00010101, + 0x00010102, + 0x00010102, + 0x00010103, + 0x00010103, + 0x00010104, + 0x00010104, + 0x00010105, + 0x00010105, + 0x00010106, + 0x00010106, + 0x00010107, + 0x00010107, + 0x00010108, + 0x00010108, + }, + { + 0x00010109, + 0x00010109, + 0x0001010a, + 0x0001010a, + 0x0001010b, + 0x0001010b, + 0x0001010c, + 0x0001010c, + 0x0001010d, + 0x0001010d, + 0x0001010e, + 0x0001010e, + 0x0001010f, + 0x0001010f, + 0x00010110, + 0x00010110, + }, + { + 0x00010111, + 0x00010111, + 0x00010112, + 0x00010112, + 0x00010113, + 0x00010113, + 0x00010114, + 0x00010114, + 0x00010115, + 0x00010115, + 0x00010116, + 0x00010116, + 0x00010117, + 0x00010117, + 0x00010118, + 0x00010118, + }, + { + 0x00010119, + 0x00010119, + 0x0001011a, + 0x0001011a, + 0x0001011b, + 0x0001011b, + 0x0001011c, + 0x0001011c, + 0x0001011d, + 0x0001011d, + 0x0001011e, + 0x0001011e, + 0x0001011f, + 0x0001011f, + 0x00010120, + 0x00010120, + }, + { + 0x00010121, + 0x00010121, + 0x00010122, + 0x00010122, + 0x00010123, + 0x00010123, + 0x00010124, + 0x00010124, + 0x00010125, + 0x00010125, + 0x00010126, + 0x00010126, + 0x00010127, + 0x00010127, + 0x00010128, + 0x00010128, + }, + { + 0x00010129, + 0x00010129, + 0x0001012a, + 0x0001012a, + 0x0001012b, + 0x0001012b, + 0x0001012c, + 0x0001012c, + 0x0001012d, + 0x0001012d, + 0x0001012e, + 0x0001012e, + 0x0001012f, + 0x0001012f, + 0x00010130, + 0x00010130, + }, + { + 0x00010131, + 0x00010131, + 0x00010132, + 0x00010132, + 0x00010133, + 0x00010133, + 0x00010134, + 0x00010134, + 0x00010135, + 0x00010135, + 0x00010136, + 0x00010136, + 0x00010137, + 0x00010137, + 0x00010138, + 0x00010138, + }, + { + 0x00010139, + 0x00010139, + 0x0001013a, + 0x0001013a, + 0x0001013b, + 0x0001013b, + 0x0001013c, + 0x0001013c, + 0x0001013d, + 0x0001013d, + 0x0001013e, + 0x0001013e, + 0x0001013f, + 0x0001013f, + 0x00010140, + 0x00010140, + }, + { + 0x00010141, + 0x00010141, + 0x00010142, + 0x00010142, + 0x00010143, + 0x00010143, + 0x00010144, + 0x00010144, + 0x00010145, + 0x00010145, + 0x00010146, + 0x00010146, + 0x00010147, + 0x00010147, + 0x00010148, + 0x00010148, + }, + { + 0x00010149, + 0x00010149, + 0x0001014a, + 0x0001014a, + 0x0001014b, + 0x0001014b, + 0x0001014c, + 0x0001014c, + 0x0001014d, + 0x0001014d, + 0x0001014e, + 0x0001014e, + 0x0001014f, + 0x0001014f, + 0x00010150, + 0x00010150, + }, + { + 0x00010151, + 0x00010151, + 0x00010152, + 0x00010152, + 0x00010153, + 0x00010153, + 0x00010154, + 0x00010154, + 0x00010155, + 0x00010155, + 0x00010156, + 0x00010156, + 0x00010157, + 0x00010157, + 0x00010158, + 0x00010158, + }, + { + 0x00010159, + 0x00010159, + 0x0001015a, + 0x0001015a, + 0x0001015b, + 0x0001015b, + 0x0001015c, + 0x0001015c, + 0x0001015d, + 0x0001015d, + 0x0001015e, + 0x0001015e, + 0x0001015f, + 0x0001015f, + 0x00010160, + 0x00010160, + }, + { + 0x00010161, + 0x00010161, + 0x00010162, + 0x00010162, + 0x00010163, + 0x00010163, + 0x00010164, + 0x00010164, + 0x00010165, + 0x00010165, + 0x00010166, + 0x00010166, + 0x00010167, + 0x00010167, + 0x00010168, + 0x00010168, + }, + { + 0x00010169, + 0x00010169, + 0x0001016a, + 0x0001016a, + 0x0001016b, + 0x0001016b, + 0x0001016c, + 0x0001016c, + 0x0001016d, + 0x0001016d, + 0x0001016e, + 0x0001016e, + 0x0001016f, + 0x0001016f, + 0x00010170, + 0x00010170, + }, + { + 0x00010171, + 0x00010171, + 0x00010172, + 0x00010172, + 0x00010173, + 0x00010173, + 0x00010174, + 0x00010174, + 0x00010175, + 0x00010175, + 0x00010176, + 0x00010176, + 0x00010177, + 0x00010177, + 0x00010178, + 0x00010178, + }, + { + 0x00010179, + 0x00010179, + 0x0001017a, + 0x0001017a, + 0x0001017b, + 0x0001017b, + 0x0001017c, + 0x0001017c, + 0x0001017d, + 0x0001017d, + 0x0001017e, + 0x0001017e, + 0x0001017f, + 0x0001017f, + 0x00010180, + 0x00010180, + }, + { + 0x00010181, + 0x00010181, + 0x00010182, + 0x00010182, + 0x00010183, + 0x00010183, + 0x00010184, + 0x00010184, + 0x00010185, + 0x00010185, + 0x00010186, + 0x00010186, + 0x00010187, + 0x00010187, + 0x00010188, + 0x00010188, + }, }; #endif @@ -3012,171 +30672,2153 @@ const uint32_t c_aauiCQMFHuffEnc47[576][2] = #else const uint16_t c_aauiCQMFHuffEnc47[576][2] = #endif -{ - {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0005}, {0x0006, 0x0004}, {0x0008, 0x0006}, {0x000a, 0x0007}, {0x000c, 0x000b}, {0x000d, 0x000d}, - {0x0010, 0x0041}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, - {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, - {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0005}, {0x0009, 0x0006}, {0x000b, 0x0007}, {0x000d, 0x000e}, - {0x000f, 0x0025}, {0x000f, 0x0026}, {0x0012, 0x00f6}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, - {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, - {0x0005, 0x0006}, {0x0004, 0x0005}, {0x0005, 0x0007}, {0x0006, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0007}, {0x000b, 0x0008}, {0x000d, 0x000f}, - {0x000f, 0x0027}, {0x0012, 0x00f7}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, - {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, - {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0007, 0x0006}, {0x0009, 0x0008}, {0x000a, 0x0008}, {0x000c, 0x000c}, {0x000e, 0x0017}, - {0x0010, 0x0042}, {0x0012, 0x00f8}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, {0x0013, 0x002f}, - {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, - {0x0008, 0x0008}, {0x0007, 0x0007}, {0x0008, 0x0009}, {0x0009, 0x0009}, {0x000a, 0x0009}, {0x000b, 0x0009}, {0x000d, 0x0010}, {0x000f, 0x0028}, - {0x000f, 0x0029}, {0x0011, 0x007f}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, - {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, - {0x000a, 0x000a}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x000a, 0x000b}, {0x000b, 0x000a}, {0x000d, 0x0011}, {0x000f, 0x002a}, {0x0010, 0x0043}, - {0x0012, 0x00f9}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, - {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, - {0x000b, 0x000b}, {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000c, 0x000d}, {0x000d, 0x0012}, {0x000e, 0x0018}, {0x0010, 0x0044}, {0x0013, 0x0055}, - {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, - {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, - {0x000e, 0x0019}, {0x000d, 0x0013}, {0x000d, 0x0014}, {0x000d, 0x0015}, {0x000f, 0x002b}, {0x0010, 0x0045}, {0x0013, 0x0066}, {0x0012, 0x00fa}, - {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, - {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, - {0x0010, 0x0046}, {0x000f, 0x002c}, {0x000f, 0x002d}, {0x0010, 0x0047}, {0x0011, 0x0080}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, - {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, - {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, - {0x0013, 0x008a}, {0x0010, 0x0048}, {0x0010, 0x0049}, {0x0011, 0x0081}, {0x0013, 0x008b}, {0x0012, 0x00fb}, {0x0013, 0x008c}, {0x0013, 0x008d}, - {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, - {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, - {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0012, 0x00fc}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, - {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, - {0x0013, 0x00ad}, {0x0013, 0x00ae}, {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, - {0x0013, 0x00b5}, {0x0013, 0x00b6}, {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, - {0x0013, 0x00bd}, {0x0013, 0x00be}, {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, - {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, - {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, - {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, {0x0013, 0x00dc}, - {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, {0x0013, 0x00e4}, - {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, {0x0013, 0x00ec}, - {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, {0x0013, 0x00f4}, - {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, {0x0013, 0x00fc}, - {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, {0x0013, 0x0104}, - {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, {0x0013, 0x010c}, - {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, {0x0013, 0x0114}, - {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, {0x0013, 0x011c}, - {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, {0x0013, 0x0124}, - {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, {0x0013, 0x012c}, - {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, {0x0013, 0x0134}, - {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, {0x0013, 0x013c}, - {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, {0x0013, 0x0144}, - {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, {0x0013, 0x014c}, - {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, {0x0013, 0x0153}, {0x0013, 0x0154}, - {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, {0x0013, 0x015b}, {0x0013, 0x015c}, - {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, {0x0013, 0x0163}, {0x0013, 0x0164}, - {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, {0x0013, 0x016b}, {0x0013, 0x016c}, - {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, {0x0013, 0x0173}, {0x0013, 0x0174}, - {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, {0x0013, 0x017b}, {0x0013, 0x017c}, - {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, {0x0013, 0x0183}, {0x0013, 0x0184}, - {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, {0x0013, 0x018b}, {0x0013, 0x018c}, - {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, {0x0013, 0x0193}, {0x0013, 0x0194}, - {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, {0x0013, 0x019b}, {0x0013, 0x019c}, - {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, {0x0013, 0x01a3}, {0x0013, 0x01a4}, - {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, {0x0013, 0x01ab}, {0x0013, 0x01ac}, - {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, {0x0013, 0x01b3}, {0x0013, 0x01b4}, - {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, {0x0013, 0x01bb}, {0x0013, 0x01bc}, - {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, {0x0013, 0x01c3}, {0x0013, 0x01c4}, - {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, {0x0013, 0x01cb}, {0x0013, 0x01cc}, - {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, {0x0013, 0x01d3}, {0x0013, 0x01d4}, - {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, {0x0013, 0x01db}, {0x0013, 0x01dc}, - {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, {0x0013, 0x01e3}, {0x0013, 0x01e4}, - {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, {0x0012, 0x00fd}, -}; + { + { 0x0002, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0005 }, + { 0x0006, 0x0004 }, + { 0x0008, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000c, 0x000b }, + { 0x000d, 0x000d }, + { 0x0010, 0x0041 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0004, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000d, 0x000e }, + { 0x000f, 0x0025 }, + { 0x000f, 0x0026 }, + { 0x0012, 0x00f6 }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0005, 0x0006 }, + { 0x0004, 0x0005 }, + { 0x0005, 0x0007 }, + { 0x0006, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0009, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000d, 0x000f }, + { 0x000f, 0x0027 }, + { 0x0012, 0x00f7 }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0007, 0x0006 }, + { 0x0009, 0x0008 }, + { 0x000a, 0x0008 }, + { 0x000c, 0x000c }, + { 0x000e, 0x0017 }, + { 0x0010, 0x0042 }, + { 0x0012, 0x00f8 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0008, 0x0008 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0009 }, + { 0x0009, 0x0009 }, + { 0x000a, 0x0009 }, + { 0x000b, 0x0009 }, + { 0x000d, 0x0010 }, + { 0x000f, 0x0028 }, + { 0x000f, 0x0029 }, + { 0x0011, 0x007f }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x000a, 0x000a }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x000a, 0x000b }, + { 0x000b, 0x000a }, + { 0x000d, 0x0011 }, + { 0x000f, 0x002a }, + { 0x0010, 0x0043 }, + { 0x0012, 0x00f9 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x0013, 0x0054 }, + { 0x000b, 0x000b }, + { 0x000b, 0x000c }, + { 0x000b, 0x000d }, + { 0x000c, 0x000d }, + { 0x000d, 0x0012 }, + { 0x000e, 0x0018 }, + { 0x0010, 0x0044 }, + { 0x0013, 0x0055 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0013, 0x0062 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x000e, 0x0019 }, + { 0x000d, 0x0013 }, + { 0x000d, 0x0014 }, + { 0x000d, 0x0015 }, + { 0x000f, 0x002b }, + { 0x0010, 0x0045 }, + { 0x0013, 0x0066 }, + { 0x0012, 0x00fa }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0010, 0x0046 }, + { 0x000f, 0x002c }, + { 0x000f, 0x002d }, + { 0x0010, 0x0047 }, + { 0x0011, 0x0080 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x0010, 0x0048 }, + { 0x0010, 0x0049 }, + { 0x0011, 0x0081 }, + { 0x0013, 0x008b }, + { 0x0012, 0x00fb }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0013, 0x008e }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0013, 0x0091 }, + { 0x0013, 0x0092 }, + { 0x0013, 0x0093 }, + { 0x0013, 0x0094 }, + { 0x0013, 0x0095 }, + { 0x0013, 0x0096 }, + { 0x0013, 0x0097 }, + { 0x0013, 0x0098 }, + { 0x0013, 0x0099 }, + { 0x0013, 0x009a }, + { 0x0013, 0x009b }, + { 0x0013, 0x009c }, + { 0x0013, 0x009d }, + { 0x0013, 0x009e }, + { 0x0013, 0x009f }, + { 0x0013, 0x00a0 }, + { 0x0012, 0x00fc }, + { 0x0013, 0x00a1 }, + { 0x0013, 0x00a2 }, + { 0x0013, 0x00a3 }, + { 0x0013, 0x00a4 }, + { 0x0013, 0x00a5 }, + { 0x0013, 0x00a6 }, + { 0x0013, 0x00a7 }, + { 0x0013, 0x00a8 }, + { 0x0013, 0x00a9 }, + { 0x0013, 0x00aa }, + { 0x0013, 0x00ab }, + { 0x0013, 0x00ac }, + { 0x0013, 0x00ad }, + { 0x0013, 0x00ae }, + { 0x0013, 0x00af }, + { 0x0013, 0x00b0 }, + { 0x0013, 0x00b1 }, + { 0x0013, 0x00b2 }, + { 0x0013, 0x00b3 }, + { 0x0013, 0x00b4 }, + { 0x0013, 0x00b5 }, + { 0x0013, 0x00b6 }, + { 0x0013, 0x00b7 }, + { 0x0013, 0x00b8 }, + { 0x0013, 0x00b9 }, + { 0x0013, 0x00ba }, + { 0x0013, 0x00bb }, + { 0x0013, 0x00bc }, + { 0x0013, 0x00bd }, + { 0x0013, 0x00be }, + { 0x0013, 0x00bf }, + { 0x0013, 0x00c0 }, + { 0x0013, 0x00c1 }, + { 0x0013, 0x00c2 }, + { 0x0013, 0x00c3 }, + { 0x0013, 0x00c4 }, + { 0x0013, 0x00c5 }, + { 0x0013, 0x00c6 }, + { 0x0013, 0x00c7 }, + { 0x0013, 0x00c8 }, + { 0x0013, 0x00c9 }, + { 0x0013, 0x00ca }, + { 0x0013, 0x00cb }, + { 0x0013, 0x00cc }, + { 0x0013, 0x00cd }, + { 0x0013, 0x00ce }, + { 0x0013, 0x00cf }, + { 0x0013, 0x00d0 }, + { 0x0013, 0x00d1 }, + { 0x0013, 0x00d2 }, + { 0x0013, 0x00d3 }, + { 0x0013, 0x00d4 }, + { 0x0013, 0x00d5 }, + { 0x0013, 0x00d6 }, + { 0x0013, 0x00d7 }, + { 0x0013, 0x00d8 }, + { 0x0013, 0x00d9 }, + { 0x0013, 0x00da }, + { 0x0013, 0x00db }, + { 0x0013, 0x00dc }, + { 0x0013, 0x00dd }, + { 0x0013, 0x00de }, + { 0x0013, 0x00df }, + { 0x0013, 0x00e0 }, + { 0x0013, 0x00e1 }, + { 0x0013, 0x00e2 }, + { 0x0013, 0x00e3 }, + { 0x0013, 0x00e4 }, + { 0x0013, 0x00e5 }, + { 0x0013, 0x00e6 }, + { 0x0013, 0x00e7 }, + { 0x0013, 0x00e8 }, + { 0x0013, 0x00e9 }, + { 0x0013, 0x00ea }, + { 0x0013, 0x00eb }, + { 0x0013, 0x00ec }, + { 0x0013, 0x00ed }, + { 0x0013, 0x00ee }, + { 0x0013, 0x00ef }, + { 0x0013, 0x00f0 }, + { 0x0013, 0x00f1 }, + { 0x0013, 0x00f2 }, + { 0x0013, 0x00f3 }, + { 0x0013, 0x00f4 }, + { 0x0013, 0x00f5 }, + { 0x0013, 0x00f6 }, + { 0x0013, 0x00f7 }, + { 0x0013, 0x00f8 }, + { 0x0013, 0x00f9 }, + { 0x0013, 0x00fa }, + { 0x0013, 0x00fb }, + { 0x0013, 0x00fc }, + { 0x0013, 0x00fd }, + { 0x0013, 0x00fe }, + { 0x0013, 0x00ff }, + { 0x0013, 0x0100 }, + { 0x0013, 0x0101 }, + { 0x0013, 0x0102 }, + { 0x0013, 0x0103 }, + { 0x0013, 0x0104 }, + { 0x0013, 0x0105 }, + { 0x0013, 0x0106 }, + { 0x0013, 0x0107 }, + { 0x0013, 0x0108 }, + { 0x0013, 0x0109 }, + { 0x0013, 0x010a }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0013, 0x010f }, + { 0x0013, 0x0110 }, + { 0x0013, 0x0111 }, + { 0x0013, 0x0112 }, + { 0x0013, 0x0113 }, + { 0x0013, 0x0114 }, + { 0x0013, 0x0115 }, + { 0x0013, 0x0116 }, + { 0x0013, 0x0117 }, + { 0x0013, 0x0118 }, + { 0x0013, 0x0119 }, + { 0x0013, 0x011a }, + { 0x0013, 0x011b }, + { 0x0013, 0x011c }, + { 0x0013, 0x011d }, + { 0x0013, 0x011e }, + { 0x0013, 0x011f }, + { 0x0013, 0x0120 }, + { 0x0013, 0x0121 }, + { 0x0013, 0x0122 }, + { 0x0013, 0x0123 }, + { 0x0013, 0x0124 }, + { 0x0013, 0x0125 }, + { 0x0013, 0x0126 }, + { 0x0013, 0x0127 }, + { 0x0013, 0x0128 }, + { 0x0013, 0x0129 }, + { 0x0013, 0x012a }, + { 0x0013, 0x012b }, + { 0x0013, 0x012c }, + { 0x0013, 0x012d }, + { 0x0013, 0x012e }, + { 0x0013, 0x012f }, + { 0x0013, 0x0130 }, + { 0x0013, 0x0131 }, + { 0x0013, 0x0132 }, + { 0x0013, 0x0133 }, + { 0x0013, 0x0134 }, + { 0x0013, 0x0135 }, + { 0x0013, 0x0136 }, + { 0x0013, 0x0137 }, + { 0x0013, 0x0138 }, + { 0x0013, 0x0139 }, + { 0x0013, 0x013a }, + { 0x0013, 0x013b }, + { 0x0013, 0x013c }, + { 0x0013, 0x013d }, + { 0x0013, 0x013e }, + { 0x0013, 0x013f }, + { 0x0013, 0x0140 }, + { 0x0013, 0x0141 }, + { 0x0013, 0x0142 }, + { 0x0013, 0x0143 }, + { 0x0013, 0x0144 }, + { 0x0013, 0x0145 }, + { 0x0013, 0x0146 }, + { 0x0013, 0x0147 }, + { 0x0013, 0x0148 }, + { 0x0013, 0x0149 }, + { 0x0013, 0x014a }, + { 0x0013, 0x014b }, + { 0x0013, 0x014c }, + { 0x0013, 0x014d }, + { 0x0013, 0x014e }, + { 0x0013, 0x014f }, + { 0x0013, 0x0150 }, + { 0x0013, 0x0151 }, + { 0x0013, 0x0152 }, + { 0x0013, 0x0153 }, + { 0x0013, 0x0154 }, + { 0x0013, 0x0155 }, + { 0x0013, 0x0156 }, + { 0x0013, 0x0157 }, + { 0x0013, 0x0158 }, + { 0x0013, 0x0159 }, + { 0x0013, 0x015a }, + { 0x0013, 0x015b }, + { 0x0013, 0x015c }, + { 0x0013, 0x015d }, + { 0x0013, 0x015e }, + { 0x0013, 0x015f }, + { 0x0013, 0x0160 }, + { 0x0013, 0x0161 }, + { 0x0013, 0x0162 }, + { 0x0013, 0x0163 }, + { 0x0013, 0x0164 }, + { 0x0013, 0x0165 }, + { 0x0013, 0x0166 }, + { 0x0013, 0x0167 }, + { 0x0013, 0x0168 }, + { 0x0013, 0x0169 }, + { 0x0013, 0x016a }, + { 0x0013, 0x016b }, + { 0x0013, 0x016c }, + { 0x0013, 0x016d }, + { 0x0013, 0x016e }, + { 0x0013, 0x016f }, + { 0x0013, 0x0170 }, + { 0x0013, 0x0171 }, + { 0x0013, 0x0172 }, + { 0x0013, 0x0173 }, + { 0x0013, 0x0174 }, + { 0x0013, 0x0175 }, + { 0x0013, 0x0176 }, + { 0x0013, 0x0177 }, + { 0x0013, 0x0178 }, + { 0x0013, 0x0179 }, + { 0x0013, 0x017a }, + { 0x0013, 0x017b }, + { 0x0013, 0x017c }, + { 0x0013, 0x017d }, + { 0x0013, 0x017e }, + { 0x0013, 0x017f }, + { 0x0013, 0x0180 }, + { 0x0013, 0x0181 }, + { 0x0013, 0x0182 }, + { 0x0013, 0x0183 }, + { 0x0013, 0x0184 }, + { 0x0013, 0x0185 }, + { 0x0013, 0x0186 }, + { 0x0013, 0x0187 }, + { 0x0013, 0x0188 }, + { 0x0013, 0x0189 }, + { 0x0013, 0x018a }, + { 0x0013, 0x018b }, + { 0x0013, 0x018c }, + { 0x0013, 0x018d }, + { 0x0013, 0x018e }, + { 0x0013, 0x018f }, + { 0x0013, 0x0190 }, + { 0x0013, 0x0191 }, + { 0x0013, 0x0192 }, + { 0x0013, 0x0193 }, + { 0x0013, 0x0194 }, + { 0x0013, 0x0195 }, + { 0x0013, 0x0196 }, + { 0x0013, 0x0197 }, + { 0x0013, 0x0198 }, + { 0x0013, 0x0199 }, + { 0x0013, 0x019a }, + { 0x0013, 0x019b }, + { 0x0013, 0x019c }, + { 0x0013, 0x019d }, + { 0x0013, 0x019e }, + { 0x0013, 0x019f }, + { 0x0013, 0x01a0 }, + { 0x0013, 0x01a1 }, + { 0x0013, 0x01a2 }, + { 0x0013, 0x01a3 }, + { 0x0013, 0x01a4 }, + { 0x0013, 0x01a5 }, + { 0x0013, 0x01a6 }, + { 0x0013, 0x01a7 }, + { 0x0013, 0x01a8 }, + { 0x0013, 0x01a9 }, + { 0x0013, 0x01aa }, + { 0x0013, 0x01ab }, + { 0x0013, 0x01ac }, + { 0x0013, 0x01ad }, + { 0x0013, 0x01ae }, + { 0x0013, 0x01af }, + { 0x0013, 0x01b0 }, + { 0x0013, 0x01b1 }, + { 0x0013, 0x01b2 }, + { 0x0013, 0x01b3 }, + { 0x0013, 0x01b4 }, + { 0x0013, 0x01b5 }, + { 0x0013, 0x01b6 }, + { 0x0013, 0x01b7 }, + { 0x0013, 0x01b8 }, + { 0x0013, 0x01b9 }, + { 0x0013, 0x01ba }, + { 0x0013, 0x01bb }, + { 0x0013, 0x01bc }, + { 0x0013, 0x01bd }, + { 0x0013, 0x01be }, + { 0x0013, 0x01bf }, + { 0x0013, 0x01c0 }, + { 0x0013, 0x01c1 }, + { 0x0013, 0x01c2 }, + { 0x0013, 0x01c3 }, + { 0x0013, 0x01c4 }, + { 0x0013, 0x01c5 }, + { 0x0013, 0x01c6 }, + { 0x0013, 0x01c7 }, + { 0x0013, 0x01c8 }, + { 0x0013, 0x01c9 }, + { 0x0013, 0x01ca }, + { 0x0013, 0x01cb }, + { 0x0013, 0x01cc }, + { 0x0013, 0x01cd }, + { 0x0013, 0x01ce }, + { 0x0013, 0x01cf }, + { 0x0013, 0x01d0 }, + { 0x0013, 0x01d1 }, + { 0x0013, 0x01d2 }, + { 0x0013, 0x01d3 }, + { 0x0013, 0x01d4 }, + { 0x0013, 0x01d5 }, + { 0x0013, 0x01d6 }, + { 0x0013, 0x01d7 }, + { 0x0013, 0x01d8 }, + { 0x0013, 0x01d9 }, + { 0x0013, 0x01da }, + { 0x0013, 0x01db }, + { 0x0013, 0x01dc }, + { 0x0013, 0x01dd }, + { 0x0013, 0x01de }, + { 0x0013, 0x01df }, + { 0x0013, 0x01e0 }, + { 0x0013, 0x01e1 }, + { 0x0013, 0x01e2 }, + { 0x0013, 0x01e3 }, + { 0x0013, 0x01e4 }, + { 0x0013, 0x01e5 }, + { 0x0013, 0x01e6 }, + { 0x0013, 0x01e7 }, + { 0x0013, 0x01e8 }, + { 0x0013, 0x01e9 }, + { 0x0013, 0x01ea }, + { 0x0013, 0x01eb }, + { 0x0012, 0x00fd }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec47[87][16] = -{ - {0x0004ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x0000001a, 0x00000031, 0x00010001, 0x00010001, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, - {0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, - {0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020048, 0x00020048, 0x00020048, 0x00020048, }, - {0x000affff, 0x0008ffff, 0x0009ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x00000004, 0x00000034, 0x00000060, 0x00000062, 0x0001001c, 0x0001001c, 0x0001004b, 0x0001004b, 0x00010061, 0x00010061, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, }, - {0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x00030079, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, 0x0003007a, }, - {0x00010036, 0x00010036, 0x00010065, 0x00010065, 0x0001007c, 0x0001007c, 0x00010090, 0x00010090, 0x00010091, 0x00010091, 0x00010092, 0x00010092, 0x00020005, 0x00020005, 0x00020005, 0x00020005, }, - {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, }, - {0x0017ffff, 0x0028ffff, 0x0039ffff, 0x0012ffff, 0x0011ffff, 0x0010ffff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000006, 0x0000004e, 0x00000093, 0x0001001e, 0x0001001e, }, - {0x00020095, 0x00020095, 0x00020095, 0x00020095, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, }, - {0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x00030066, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, 0x0003007d, }, - {0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x00030094, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, - {0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300aa, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, }, - {0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x0001007e, 0x0001007e, 0x000100ac, 0x000100ac, 0x000100c1, 0x000100c1, 0x000100c2, 0x000100c2, 0x0002004f, 0x0002004f, 0x0002004f, 0x0002004f, }, - {0x0014ffff, 0x00000008, 0x00000050, 0x0000007f, 0x00000096, 0x000000ad, 0x000000c0, 0x000000c3, 0x000000d9, 0x000000da, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x00010038, 0x00010038, }, - {0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0016ffff, 0x0015ffff, 0x0013ffff, }, - {0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x0002023f, 0x0002023f, 0x0002023f, 0x0002023f, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, 0x00030069, }, - {0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300c4, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, 0x000300db, }, - {0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x000200af, 0x000200af, 0x000200af, 0x000200af, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, }, - {0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x001bffff, 0x001affff, 0x001dffff, 0x001cffff, 0x0020ffff, 0x0018ffff, 0x0019ffff, 0x001effff, 0x001fffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, }, - {0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, }, - {0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, }, - {0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010023, 0x00010023, }, - {0x00010009, 0x00010009, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, }, - {0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x0001003a, 0x0001003a, 0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, }, - {0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, }, - {0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0001006c, 0x0001006c, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010070, 0x00010070, 0x00010071, 0x00010071, }, - {0x00010072, 0x00010072, 0x00010073, 0x00010073, 0x00010074, 0x00010074, 0x00010075, 0x00010075, 0x00010076, 0x00010076, 0x00010077, 0x00010077, 0x00010081, 0x00010081, 0x00010082, 0x00010082, }, - {0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, }, - {0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010087, 0x00010087, 0x00010088, 0x00010088, 0x00010089, 0x00010089, 0x0001008a, 0x0001008a, }, - {0x0001008b, 0x0001008b, 0x0001008c, 0x0001008c, 0x0001008d, 0x0001008d, 0x0001008e, 0x0001008e, 0x0001008f, 0x0001008f, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, }, - {0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, }, - {0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, 0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100ae, 0x000100ae, 0x000100b0, 0x000100b0, }, - {0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, }, - {0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, 0x000100bd, 0x000100bd, 0x000100be, 0x000100be, 0x000100bf, 0x000100bf, 0x000100c5, 0x000100c5, }, - {0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, }, - {0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, 0x002effff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, }, - {0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, }, - {0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100d8, 0x000100d8, 0x000100dc, 0x000100dc, 0x000100de, 0x000100de, 0x000100df, 0x000100df, 0x000100e0, 0x000100e0, 0x000100e1, 0x000100e1, }, - {0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, }, - {0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, }, - {0x000100f2, 0x000100f2, 0x000100f4, 0x000100f4, 0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x000100f7, 0x000100f7, 0x000100f8, 0x000100f8, 0x000100f9, 0x000100f9, 0x000100fa, 0x000100fa, }, - {0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, }, - {0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, }, - {0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x0001010e, 0x0001010e, 0x0001010f, 0x0001010f, 0x00010110, 0x00010110, 0x00010111, 0x00010111, 0x00010112, 0x00010112, }, - {0x00010113, 0x00010113, 0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, 0x00010119, 0x00010119, 0x0001011a, 0x0001011a, }, - {0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, 0x00010121, 0x00010121, 0x00010122, 0x00010122, }, - {0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, 0x00010129, 0x00010129, 0x0001012a, 0x0001012a, }, - {0x0001012b, 0x0001012b, 0x0001012c, 0x0001012c, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010132, 0x00010132, }, - {0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, }, - {0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, }, - {0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010146, 0x00010146, 0x00010147, 0x00010147, 0x00010148, 0x00010148, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, }, - {0x0001014b, 0x0001014b, 0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, }, - {0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, }, - {0x00010153, 0x00010153, 0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, }, - {0x0001015b, 0x0001015b, 0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, }, - {0x00010163, 0x00010163, 0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, }, - {0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, }, - {0x00010173, 0x00010173, 0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, }, - {0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, }, - {0x00010183, 0x00010183, 0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, }, - {0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, }, - {0x00010193, 0x00010193, 0x00010194, 0x00010194, 0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, }, - {0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, }, - {0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, }, - {0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, }, - {0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, }, - {0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, }, - {0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, }, - {0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, }, - {0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, }, - {0x000101db, 0x000101db, 0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, }, - {0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, }, - {0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, }, - {0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, }, - {0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, }, - {0x00010203, 0x00010203, 0x00010204, 0x00010204, 0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, }, - {0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, }, - {0x00010213, 0x00010213, 0x00010214, 0x00010214, 0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, }, - {0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, }, - {0x00010223, 0x00010223, 0x00010224, 0x00010224, 0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, }, - {0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, }, - {0x00010233, 0x00010233, 0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, }, +const uint32_t c_aauiCQMFHuffDec47[87][16] = { + { + 0x0004ffff, + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x0000001a, + 0x00000031, + 0x00010001, + 0x00010001, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + }, + { + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + }, + { + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + }, + { + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x00000004, + 0x00000034, + 0x00000060, + 0x00000062, + 0x0001001c, + 0x0001001c, + 0x0001004b, + 0x0001004b, + 0x00010061, + 0x00010061, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + }, + { + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x00030079, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + 0x0003007a, + }, + { + 0x00010036, + 0x00010036, + 0x00010065, + 0x00010065, + 0x0001007c, + 0x0001007c, + 0x00010090, + 0x00010090, + 0x00010091, + 0x00010091, + 0x00010092, + 0x00010092, + 0x00020005, + 0x00020005, + 0x00020005, + 0x00020005, + }, + { + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + }, + { + 0x0017ffff, + 0x0028ffff, + 0x0039ffff, + 0x0012ffff, + 0x0011ffff, + 0x0010ffff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x00000006, + 0x0000004e, + 0x00000093, + 0x0001001e, + 0x0001001e, + }, + { + 0x00020095, + 0x00020095, + 0x00020095, + 0x00020095, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + }, + { + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x00030066, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + 0x0003007d, + }, + { + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x00030094, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + }, + { + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300aa, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + }, + { + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x0001007e, + 0x0001007e, + 0x000100ac, + 0x000100ac, + 0x000100c1, + 0x000100c1, + 0x000100c2, + 0x000100c2, + 0x0002004f, + 0x0002004f, + 0x0002004f, + 0x0002004f, + }, + { + 0x0014ffff, + 0x00000008, + 0x00000050, + 0x0000007f, + 0x00000096, + 0x000000ad, + 0x000000c0, + 0x000000c3, + 0x000000d9, + 0x000000da, + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + 0x00010038, + 0x00010038, + }, + { + 0x004affff, + 0x004bffff, + 0x004cffff, + 0x004dffff, + 0x004effff, + 0x004fffff, + 0x0050ffff, + 0x0051ffff, + 0x0052ffff, + 0x0053ffff, + 0x0054ffff, + 0x0055ffff, + 0x0056ffff, + 0x0016ffff, + 0x0015ffff, + 0x0013ffff, + }, + { + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x0002023f, + 0x0002023f, + 0x0002023f, + 0x0002023f, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + 0x00030069, + }, + { + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300c4, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + 0x000300db, + }, + { + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200af, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200dd, + }, + { + 0x0001023b, + 0x0001023b, + 0x0001023c, + 0x0001023c, + 0x0001023d, + 0x0001023d, + 0x0001023e, + 0x0001023e, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x001bffff, + 0x001affff, + 0x001dffff, + 0x001cffff, + 0x0020ffff, + 0x0018ffff, + 0x0019ffff, + 0x001effff, + 0x001fffff, + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + }, + { + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010052, + 0x00010052, + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + }, + { + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x0001005a, + 0x0001005a, + 0x0001005b, + 0x0001005b, + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + }, + { + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010023, + 0x00010023, + }, + { + 0x00010009, + 0x00010009, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + }, + { + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x0001003a, + 0x0001003a, + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + }, + { + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + }, + { + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + 0x0001006c, + 0x0001006c, + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00010070, + 0x00010070, + 0x00010071, + 0x00010071, + }, + { + 0x00010072, + 0x00010072, + 0x00010073, + 0x00010073, + 0x00010074, + 0x00010074, + 0x00010075, + 0x00010075, + 0x00010076, + 0x00010076, + 0x00010077, + 0x00010077, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + }, + { + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + }, + { + 0x00010083, + 0x00010083, + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010087, + 0x00010087, + 0x00010088, + 0x00010088, + 0x00010089, + 0x00010089, + 0x0001008a, + 0x0001008a, + }, + { + 0x0001008b, + 0x0001008b, + 0x0001008c, + 0x0001008c, + 0x0001008d, + 0x0001008d, + 0x0001008e, + 0x0001008e, + 0x0001008f, + 0x0001008f, + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + 0x00010099, + 0x00010099, + }, + { + 0x0001009a, + 0x0001009a, + 0x0001009b, + 0x0001009b, + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + 0x000100a1, + 0x000100a1, + }, + { + 0x000100a2, + 0x000100a2, + 0x000100a3, + 0x000100a3, + 0x000100a4, + 0x000100a4, + 0x000100a5, + 0x000100a5, + 0x000100a6, + 0x000100a6, + 0x000100a7, + 0x000100a7, + 0x000100ae, + 0x000100ae, + 0x000100b0, + 0x000100b0, + }, + { + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + 0x000100b4, + 0x000100b4, + 0x000100b5, + 0x000100b5, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + 0x000100b8, + 0x000100b8, + }, + { + 0x000100b9, + 0x000100b9, + 0x000100ba, + 0x000100ba, + 0x000100bb, + 0x000100bb, + 0x000100bc, + 0x000100bc, + 0x000100bd, + 0x000100bd, + 0x000100be, + 0x000100be, + 0x000100bf, + 0x000100bf, + 0x000100c5, + 0x000100c5, + }, + { + 0x000100c6, + 0x000100c6, + 0x000100c7, + 0x000100c7, + 0x000100c8, + 0x000100c8, + 0x000100c9, + 0x000100c9, + 0x000100ca, + 0x000100ca, + 0x000100cb, + 0x000100cb, + 0x000100cc, + 0x000100cc, + 0x000100cd, + 0x000100cd, + }, + { + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + 0x002effff, + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + 0x0034ffff, + 0x0035ffff, + 0x0036ffff, + 0x0037ffff, + 0x0038ffff, + }, + { + 0x000100ce, + 0x000100ce, + 0x000100cf, + 0x000100cf, + 0x000100d0, + 0x000100d0, + 0x000100d1, + 0x000100d1, + 0x000100d2, + 0x000100d2, + 0x000100d3, + 0x000100d3, + 0x000100d4, + 0x000100d4, + 0x000100d5, + 0x000100d5, + }, + { + 0x000100d6, + 0x000100d6, + 0x000100d7, + 0x000100d7, + 0x000100d8, + 0x000100d8, + 0x000100dc, + 0x000100dc, + 0x000100de, + 0x000100de, + 0x000100df, + 0x000100df, + 0x000100e0, + 0x000100e0, + 0x000100e1, + 0x000100e1, + }, + { + 0x000100e2, + 0x000100e2, + 0x000100e3, + 0x000100e3, + 0x000100e4, + 0x000100e4, + 0x000100e5, + 0x000100e5, + 0x000100e6, + 0x000100e6, + 0x000100e7, + 0x000100e7, + 0x000100e8, + 0x000100e8, + 0x000100e9, + 0x000100e9, + }, + { + 0x000100ea, + 0x000100ea, + 0x000100eb, + 0x000100eb, + 0x000100ec, + 0x000100ec, + 0x000100ed, + 0x000100ed, + 0x000100ee, + 0x000100ee, + 0x000100ef, + 0x000100ef, + 0x000100f0, + 0x000100f0, + 0x000100f1, + 0x000100f1, + }, + { + 0x000100f2, + 0x000100f2, + 0x000100f4, + 0x000100f4, + 0x000100f5, + 0x000100f5, + 0x000100f6, + 0x000100f6, + 0x000100f7, + 0x000100f7, + 0x000100f8, + 0x000100f8, + 0x000100f9, + 0x000100f9, + 0x000100fa, + 0x000100fa, + }, + { + 0x000100fb, + 0x000100fb, + 0x000100fc, + 0x000100fc, + 0x000100fd, + 0x000100fd, + 0x000100fe, + 0x000100fe, + 0x000100ff, + 0x000100ff, + 0x00010100, + 0x00010100, + 0x00010101, + 0x00010101, + 0x00010102, + 0x00010102, + }, + { + 0x00010103, + 0x00010103, + 0x00010104, + 0x00010104, + 0x00010105, + 0x00010105, + 0x00010106, + 0x00010106, + 0x00010107, + 0x00010107, + 0x00010108, + 0x00010108, + 0x00010109, + 0x00010109, + 0x0001010a, + 0x0001010a, + }, + { + 0x0001010b, + 0x0001010b, + 0x0001010c, + 0x0001010c, + 0x0001010d, + 0x0001010d, + 0x0001010e, + 0x0001010e, + 0x0001010f, + 0x0001010f, + 0x00010110, + 0x00010110, + 0x00010111, + 0x00010111, + 0x00010112, + 0x00010112, + }, + { + 0x00010113, + 0x00010113, + 0x00010114, + 0x00010114, + 0x00010115, + 0x00010115, + 0x00010116, + 0x00010116, + 0x00010117, + 0x00010117, + 0x00010118, + 0x00010118, + 0x00010119, + 0x00010119, + 0x0001011a, + 0x0001011a, + }, + { + 0x0001011b, + 0x0001011b, + 0x0001011c, + 0x0001011c, + 0x0001011d, + 0x0001011d, + 0x0001011e, + 0x0001011e, + 0x0001011f, + 0x0001011f, + 0x00010120, + 0x00010120, + 0x00010121, + 0x00010121, + 0x00010122, + 0x00010122, + }, + { + 0x00010123, + 0x00010123, + 0x00010124, + 0x00010124, + 0x00010125, + 0x00010125, + 0x00010126, + 0x00010126, + 0x00010127, + 0x00010127, + 0x00010128, + 0x00010128, + 0x00010129, + 0x00010129, + 0x0001012a, + 0x0001012a, + }, + { + 0x0001012b, + 0x0001012b, + 0x0001012c, + 0x0001012c, + 0x0001012d, + 0x0001012d, + 0x0001012e, + 0x0001012e, + 0x0001012f, + 0x0001012f, + 0x00010130, + 0x00010130, + 0x00010131, + 0x00010131, + 0x00010132, + 0x00010132, + }, + { + 0x00010133, + 0x00010133, + 0x00010134, + 0x00010134, + 0x00010135, + 0x00010135, + 0x00010136, + 0x00010136, + 0x00010137, + 0x00010137, + 0x00010138, + 0x00010138, + 0x00010139, + 0x00010139, + 0x0001013a, + 0x0001013a, + }, + { + 0x0001013b, + 0x0001013b, + 0x0001013c, + 0x0001013c, + 0x0001013d, + 0x0001013d, + 0x0001013e, + 0x0001013e, + 0x0001013f, + 0x0001013f, + 0x00010140, + 0x00010140, + 0x00010141, + 0x00010141, + 0x00010142, + 0x00010142, + }, + { + 0x00010143, + 0x00010143, + 0x00010144, + 0x00010144, + 0x00010145, + 0x00010145, + 0x00010146, + 0x00010146, + 0x00010147, + 0x00010147, + 0x00010148, + 0x00010148, + 0x00010149, + 0x00010149, + 0x0001014a, + 0x0001014a, + }, + { + 0x0001014b, + 0x0001014b, + 0x0001014c, + 0x0001014c, + 0x0001014d, + 0x0001014d, + 0x0001014e, + 0x0001014e, + 0x0001014f, + 0x0001014f, + 0x00010150, + 0x00010150, + 0x00010151, + 0x00010151, + 0x00010152, + 0x00010152, + }, + { + 0x003affff, + 0x003bffff, + 0x003cffff, + 0x003dffff, + 0x003effff, + 0x003fffff, + 0x0040ffff, + 0x0041ffff, + 0x0042ffff, + 0x0043ffff, + 0x0044ffff, + 0x0045ffff, + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x0049ffff, + }, + { + 0x00010153, + 0x00010153, + 0x00010154, + 0x00010154, + 0x00010155, + 0x00010155, + 0x00010156, + 0x00010156, + 0x00010157, + 0x00010157, + 0x00010158, + 0x00010158, + 0x00010159, + 0x00010159, + 0x0001015a, + 0x0001015a, + }, + { + 0x0001015b, + 0x0001015b, + 0x0001015c, + 0x0001015c, + 0x0001015d, + 0x0001015d, + 0x0001015e, + 0x0001015e, + 0x0001015f, + 0x0001015f, + 0x00010160, + 0x00010160, + 0x00010161, + 0x00010161, + 0x00010162, + 0x00010162, + }, + { + 0x00010163, + 0x00010163, + 0x00010164, + 0x00010164, + 0x00010165, + 0x00010165, + 0x00010166, + 0x00010166, + 0x00010167, + 0x00010167, + 0x00010168, + 0x00010168, + 0x00010169, + 0x00010169, + 0x0001016a, + 0x0001016a, + }, + { + 0x0001016b, + 0x0001016b, + 0x0001016c, + 0x0001016c, + 0x0001016d, + 0x0001016d, + 0x0001016e, + 0x0001016e, + 0x0001016f, + 0x0001016f, + 0x00010170, + 0x00010170, + 0x00010171, + 0x00010171, + 0x00010172, + 0x00010172, + }, + { + 0x00010173, + 0x00010173, + 0x00010174, + 0x00010174, + 0x00010175, + 0x00010175, + 0x00010176, + 0x00010176, + 0x00010177, + 0x00010177, + 0x00010178, + 0x00010178, + 0x00010179, + 0x00010179, + 0x0001017a, + 0x0001017a, + }, + { + 0x0001017b, + 0x0001017b, + 0x0001017c, + 0x0001017c, + 0x0001017d, + 0x0001017d, + 0x0001017e, + 0x0001017e, + 0x0001017f, + 0x0001017f, + 0x00010180, + 0x00010180, + 0x00010181, + 0x00010181, + 0x00010182, + 0x00010182, + }, + { + 0x00010183, + 0x00010183, + 0x00010184, + 0x00010184, + 0x00010185, + 0x00010185, + 0x00010186, + 0x00010186, + 0x00010187, + 0x00010187, + 0x00010188, + 0x00010188, + 0x00010189, + 0x00010189, + 0x0001018a, + 0x0001018a, + }, + { + 0x0001018b, + 0x0001018b, + 0x0001018c, + 0x0001018c, + 0x0001018d, + 0x0001018d, + 0x0001018e, + 0x0001018e, + 0x0001018f, + 0x0001018f, + 0x00010190, + 0x00010190, + 0x00010191, + 0x00010191, + 0x00010192, + 0x00010192, + }, + { + 0x00010193, + 0x00010193, + 0x00010194, + 0x00010194, + 0x00010195, + 0x00010195, + 0x00010196, + 0x00010196, + 0x00010197, + 0x00010197, + 0x00010198, + 0x00010198, + 0x00010199, + 0x00010199, + 0x0001019a, + 0x0001019a, + }, + { + 0x0001019b, + 0x0001019b, + 0x0001019c, + 0x0001019c, + 0x0001019d, + 0x0001019d, + 0x0001019e, + 0x0001019e, + 0x0001019f, + 0x0001019f, + 0x000101a0, + 0x000101a0, + 0x000101a1, + 0x000101a1, + 0x000101a2, + 0x000101a2, + }, + { + 0x000101a3, + 0x000101a3, + 0x000101a4, + 0x000101a4, + 0x000101a5, + 0x000101a5, + 0x000101a6, + 0x000101a6, + 0x000101a7, + 0x000101a7, + 0x000101a8, + 0x000101a8, + 0x000101a9, + 0x000101a9, + 0x000101aa, + 0x000101aa, + }, + { + 0x000101ab, + 0x000101ab, + 0x000101ac, + 0x000101ac, + 0x000101ad, + 0x000101ad, + 0x000101ae, + 0x000101ae, + 0x000101af, + 0x000101af, + 0x000101b0, + 0x000101b0, + 0x000101b1, + 0x000101b1, + 0x000101b2, + 0x000101b2, + }, + { + 0x000101b3, + 0x000101b3, + 0x000101b4, + 0x000101b4, + 0x000101b5, + 0x000101b5, + 0x000101b6, + 0x000101b6, + 0x000101b7, + 0x000101b7, + 0x000101b8, + 0x000101b8, + 0x000101b9, + 0x000101b9, + 0x000101ba, + 0x000101ba, + }, + { + 0x000101bb, + 0x000101bb, + 0x000101bc, + 0x000101bc, + 0x000101bd, + 0x000101bd, + 0x000101be, + 0x000101be, + 0x000101bf, + 0x000101bf, + 0x000101c0, + 0x000101c0, + 0x000101c1, + 0x000101c1, + 0x000101c2, + 0x000101c2, + }, + { + 0x000101c3, + 0x000101c3, + 0x000101c4, + 0x000101c4, + 0x000101c5, + 0x000101c5, + 0x000101c6, + 0x000101c6, + 0x000101c7, + 0x000101c7, + 0x000101c8, + 0x000101c8, + 0x000101c9, + 0x000101c9, + 0x000101ca, + 0x000101ca, + }, + { + 0x000101cb, + 0x000101cb, + 0x000101cc, + 0x000101cc, + 0x000101cd, + 0x000101cd, + 0x000101ce, + 0x000101ce, + 0x000101cf, + 0x000101cf, + 0x000101d0, + 0x000101d0, + 0x000101d1, + 0x000101d1, + 0x000101d2, + 0x000101d2, + }, + { + 0x000101d3, + 0x000101d3, + 0x000101d4, + 0x000101d4, + 0x000101d5, + 0x000101d5, + 0x000101d6, + 0x000101d6, + 0x000101d7, + 0x000101d7, + 0x000101d8, + 0x000101d8, + 0x000101d9, + 0x000101d9, + 0x000101da, + 0x000101da, + }, + { + 0x000101db, + 0x000101db, + 0x000101dc, + 0x000101dc, + 0x000101dd, + 0x000101dd, + 0x000101de, + 0x000101de, + 0x000101df, + 0x000101df, + 0x000101e0, + 0x000101e0, + 0x000101e1, + 0x000101e1, + 0x000101e2, + 0x000101e2, + }, + { + 0x000101e3, + 0x000101e3, + 0x000101e4, + 0x000101e4, + 0x000101e5, + 0x000101e5, + 0x000101e6, + 0x000101e6, + 0x000101e7, + 0x000101e7, + 0x000101e8, + 0x000101e8, + 0x000101e9, + 0x000101e9, + 0x000101ea, + 0x000101ea, + }, + { + 0x000101eb, + 0x000101eb, + 0x000101ec, + 0x000101ec, + 0x000101ed, + 0x000101ed, + 0x000101ee, + 0x000101ee, + 0x000101ef, + 0x000101ef, + 0x000101f0, + 0x000101f0, + 0x000101f1, + 0x000101f1, + 0x000101f2, + 0x000101f2, + }, + { + 0x000101f3, + 0x000101f3, + 0x000101f4, + 0x000101f4, + 0x000101f5, + 0x000101f5, + 0x000101f6, + 0x000101f6, + 0x000101f7, + 0x000101f7, + 0x000101f8, + 0x000101f8, + 0x000101f9, + 0x000101f9, + 0x000101fa, + 0x000101fa, + }, + { + 0x000101fb, + 0x000101fb, + 0x000101fc, + 0x000101fc, + 0x000101fd, + 0x000101fd, + 0x000101fe, + 0x000101fe, + 0x000101ff, + 0x000101ff, + 0x00010200, + 0x00010200, + 0x00010201, + 0x00010201, + 0x00010202, + 0x00010202, + }, + { + 0x00010203, + 0x00010203, + 0x00010204, + 0x00010204, + 0x00010205, + 0x00010205, + 0x00010206, + 0x00010206, + 0x00010207, + 0x00010207, + 0x00010208, + 0x00010208, + 0x00010209, + 0x00010209, + 0x0001020a, + 0x0001020a, + }, + { + 0x0001020b, + 0x0001020b, + 0x0001020c, + 0x0001020c, + 0x0001020d, + 0x0001020d, + 0x0001020e, + 0x0001020e, + 0x0001020f, + 0x0001020f, + 0x00010210, + 0x00010210, + 0x00010211, + 0x00010211, + 0x00010212, + 0x00010212, + }, + { + 0x00010213, + 0x00010213, + 0x00010214, + 0x00010214, + 0x00010215, + 0x00010215, + 0x00010216, + 0x00010216, + 0x00010217, + 0x00010217, + 0x00010218, + 0x00010218, + 0x00010219, + 0x00010219, + 0x0001021a, + 0x0001021a, + }, + { + 0x0001021b, + 0x0001021b, + 0x0001021c, + 0x0001021c, + 0x0001021d, + 0x0001021d, + 0x0001021e, + 0x0001021e, + 0x0001021f, + 0x0001021f, + 0x00010220, + 0x00010220, + 0x00010221, + 0x00010221, + 0x00010222, + 0x00010222, + }, + { + 0x00010223, + 0x00010223, + 0x00010224, + 0x00010224, + 0x00010225, + 0x00010225, + 0x00010226, + 0x00010226, + 0x00010227, + 0x00010227, + 0x00010228, + 0x00010228, + 0x00010229, + 0x00010229, + 0x0001022a, + 0x0001022a, + }, + { + 0x0001022b, + 0x0001022b, + 0x0001022c, + 0x0001022c, + 0x0001022d, + 0x0001022d, + 0x0001022e, + 0x0001022e, + 0x0001022f, + 0x0001022f, + 0x00010230, + 0x00010230, + 0x00010231, + 0x00010231, + 0x00010232, + 0x00010232, + }, + { + 0x00010233, + 0x00010233, + 0x00010234, + 0x00010234, + 0x00010235, + 0x00010235, + 0x00010236, + 0x00010236, + 0x00010237, + 0x00010237, + 0x00010238, + 0x00010238, + 0x00010239, + 0x00010239, + 0x0001023a, + 0x0001023a, + }, }; #endif @@ -3185,215 +32827,2721 @@ const uint32_t c_aauiCQMFHuffEnc48[729][2] = #else const uint16_t c_aauiCQMFHuffEnc48[729][2] = #endif -{ - {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0006}, {0x0006, 0x0006}, {0x0008, 0x0006}, {0x0009, 0x0007}, {0x000b, 0x000b}, {0x000c, 0x000d}, - {0x000f, 0x0030}, {0x0010, 0x0055}, {0x0012, 0x0136}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, - {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, - {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0005, 0x0007}, {0x0006, 0x0007}, {0x0007, 0x0007}, - {0x0008, 0x0007}, {0x000a, 0x0008}, {0x000c, 0x000e}, {0x000d, 0x0012}, {0x000f, 0x0031}, {0x0011, 0x00a0}, {0x0013, 0x0010}, {0x0013, 0x0011}, - {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, - {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0005, 0x0008}, {0x0004, 0x0005}, - {0x0005, 0x0009}, {0x0006, 0x0008}, {0x0007, 0x0008}, {0x0008, 0x0008}, {0x000a, 0x0009}, {0x000c, 0x000f}, {0x000d, 0x0013}, {0x000f, 0x0032}, - {0x0011, 0x00a1}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, - {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, {0x0013, 0x002b}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, - {0x0013, 0x002f}, {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0009}, {0x0008, 0x0009}, {0x0009, 0x0008}, {0x000b, 0x000c}, - {0x000d, 0x0014}, {0x000e, 0x001d}, {0x000f, 0x0033}, {0x0012, 0x0137}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, - {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0013, 0x003b}, - {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0008, 0x000a}, {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x000b}, - {0x0009, 0x0009}, {0x000a, 0x000a}, {0x000c, 0x0010}, {0x000d, 0x0015}, {0x000f, 0x0034}, {0x0010, 0x0056}, {0x0012, 0x0138}, {0x0013, 0x0040}, - {0x0013, 0x0041}, {0x0013, 0x0042}, {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, - {0x0013, 0x0049}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, {0x0013, 0x004f}, {0x0009, 0x000a}, - {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0009, 0x000b}, {0x000a, 0x000b}, {0x000c, 0x0011}, {0x000d, 0x0016}, {0x000e, 0x001e}, {0x0010, 0x0057}, - {0x0011, 0x00a2}, {0x0011, 0x00a3}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, - {0x0013, 0x0056}, {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, {0x0013, 0x005c}, {0x0013, 0x005d}, - {0x0013, 0x005e}, {0x0013, 0x005f}, {0x000b, 0x000d}, {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000b, 0x000e}, {0x000c, 0x0012}, {0x000d, 0x0017}, - {0x000e, 0x001f}, {0x0010, 0x0058}, {0x0012, 0x0139}, {0x0011, 0x00a4}, {0x0012, 0x013a}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, - {0x0013, 0x0063}, {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x0013, 0x0069}, {0x0013, 0x006a}, - {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x000c, 0x0013}, {0x000b, 0x000f}, {0x000c, 0x0014}, - {0x000c, 0x0015}, {0x000d, 0x0018}, {0x000e, 0x0020}, {0x000f, 0x0035}, {0x0012, 0x013b}, {0x0013, 0x0070}, {0x0013, 0x0071}, {0x0013, 0x0072}, - {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, {0x0013, 0x007a}, - {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, - {0x000e, 0x0021}, {0x000d, 0x0019}, {0x000e, 0x0022}, {0x000e, 0x0023}, {0x000f, 0x0036}, {0x0010, 0x0059}, {0x0011, 0x00a5}, {0x0013, 0x0083}, - {0x0011, 0x00a6}, {0x0012, 0x013c}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, {0x0013, 0x0088}, {0x0013, 0x0089}, - {0x0013, 0x008a}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, - {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0010, 0x005a}, {0x000f, 0x0037}, {0x000f, 0x0038}, {0x000f, 0x0039}, {0x0010, 0x005b}, - {0x0010, 0x005c}, {0x0013, 0x0095}, {0x0011, 0x00a7}, {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, - {0x0013, 0x009b}, {0x0013, 0x009c}, {0x0013, 0x009d}, {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, - {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0010, 0x005d}, {0x0010, 0x005e}, - {0x0013, 0x00a9}, {0x0010, 0x005f}, {0x0013, 0x00aa}, {0x0012, 0x013d}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, {0x0013, 0x00ae}, - {0x0013, 0x00af}, {0x0013, 0x00b0}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, - {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, - {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0011, 0x00a8}, {0x0013, 0x00c1}, {0x0011, 0x00a9}, {0x0013, 0x00c2}, {0x0013, 0x00c3}, {0x0013, 0x00c4}, - {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, {0x0013, 0x00cc}, - {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, {0x0013, 0x00d4}, - {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0012, 0x013e}, {0x0013, 0x00db}, - {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, {0x0013, 0x00e3}, - {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, {0x0013, 0x00eb}, - {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, {0x0013, 0x00f3}, - {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, {0x0013, 0x00fb}, - {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, {0x0013, 0x0103}, - {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, {0x0013, 0x010b}, - {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, {0x0013, 0x0113}, - {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, {0x0013, 0x011b}, - {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, {0x0013, 0x0123}, - {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, {0x0013, 0x012b}, - {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, {0x0013, 0x0133}, - {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, {0x0013, 0x013b}, - {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, {0x0013, 0x0143}, - {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, {0x0013, 0x014b}, - {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, {0x0013, 0x0153}, - {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, {0x0013, 0x015b}, - {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, {0x0013, 0x0163}, - {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, {0x0013, 0x016b}, - {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, {0x0013, 0x0173}, - {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, {0x0013, 0x017b}, - {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, {0x0013, 0x0183}, - {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, {0x0013, 0x018b}, - {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, {0x0013, 0x0193}, - {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, {0x0013, 0x019b}, - {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, {0x0013, 0x01a3}, - {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, {0x0013, 0x01ab}, - {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, {0x0013, 0x01b3}, - {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, {0x0013, 0x01bb}, - {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, {0x0013, 0x01c3}, - {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, {0x0013, 0x01cb}, - {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, {0x0013, 0x01d3}, - {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, {0x0013, 0x01db}, - {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, {0x0013, 0x01e3}, - {0x0013, 0x01e4}, {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, {0x0013, 0x01eb}, - {0x0013, 0x01ec}, {0x0013, 0x01ed}, {0x0013, 0x01ee}, {0x0013, 0x01ef}, {0x0013, 0x01f0}, {0x0013, 0x01f1}, {0x0013, 0x01f2}, {0x0013, 0x01f3}, - {0x0013, 0x01f4}, {0x0013, 0x01f5}, {0x0013, 0x01f6}, {0x0013, 0x01f7}, {0x0013, 0x01f8}, {0x0013, 0x01f9}, {0x0013, 0x01fa}, {0x0013, 0x01fb}, - {0x0013, 0x01fc}, {0x0013, 0x01fd}, {0x0013, 0x01fe}, {0x0013, 0x01ff}, {0x0013, 0x0200}, {0x0013, 0x0201}, {0x0013, 0x0202}, {0x0013, 0x0203}, - {0x0013, 0x0204}, {0x0013, 0x0205}, {0x0013, 0x0206}, {0x0013, 0x0207}, {0x0013, 0x0208}, {0x0013, 0x0209}, {0x0013, 0x020a}, {0x0013, 0x020b}, - {0x0013, 0x020c}, {0x0013, 0x020d}, {0x0013, 0x020e}, {0x0013, 0x020f}, {0x0013, 0x0210}, {0x0013, 0x0211}, {0x0013, 0x0212}, {0x0013, 0x0213}, - {0x0013, 0x0214}, {0x0013, 0x0215}, {0x0013, 0x0216}, {0x0013, 0x0217}, {0x0013, 0x0218}, {0x0013, 0x0219}, {0x0013, 0x021a}, {0x0013, 0x021b}, - {0x0013, 0x021c}, {0x0013, 0x021d}, {0x0013, 0x021e}, {0x0013, 0x021f}, {0x0013, 0x0220}, {0x0013, 0x0221}, {0x0013, 0x0222}, {0x0013, 0x0223}, - {0x0013, 0x0224}, {0x0013, 0x0225}, {0x0013, 0x0226}, {0x0013, 0x0227}, {0x0013, 0x0228}, {0x0013, 0x0229}, {0x0013, 0x022a}, {0x0013, 0x022b}, - {0x0013, 0x022c}, {0x0013, 0x022d}, {0x0013, 0x022e}, {0x0013, 0x022f}, {0x0013, 0x0230}, {0x0013, 0x0231}, {0x0013, 0x0232}, {0x0013, 0x0233}, - {0x0013, 0x0234}, {0x0013, 0x0235}, {0x0013, 0x0236}, {0x0013, 0x0237}, {0x0013, 0x0238}, {0x0013, 0x0239}, {0x0013, 0x023a}, {0x0013, 0x023b}, - {0x0013, 0x023c}, {0x0013, 0x023d}, {0x0013, 0x023e}, {0x0013, 0x023f}, {0x0013, 0x0240}, {0x0013, 0x0241}, {0x0013, 0x0242}, {0x0013, 0x0243}, - {0x0013, 0x0244}, {0x0013, 0x0245}, {0x0013, 0x0246}, {0x0013, 0x0247}, {0x0013, 0x0248}, {0x0013, 0x0249}, {0x0013, 0x024a}, {0x0013, 0x024b}, - {0x0013, 0x024c}, {0x0013, 0x024d}, {0x0013, 0x024e}, {0x0013, 0x024f}, {0x0013, 0x0250}, {0x0013, 0x0251}, {0x0013, 0x0252}, {0x0013, 0x0253}, - {0x0013, 0x0254}, {0x0013, 0x0255}, {0x0013, 0x0256}, {0x0013, 0x0257}, {0x0013, 0x0258}, {0x0013, 0x0259}, {0x0013, 0x025a}, {0x0013, 0x025b}, - {0x0013, 0x025c}, {0x0013, 0x025d}, {0x0013, 0x025e}, {0x0013, 0x025f}, {0x0013, 0x0260}, {0x0013, 0x0261}, {0x0013, 0x0262}, {0x0013, 0x0263}, - {0x0013, 0x0264}, {0x0013, 0x0265}, {0x0013, 0x0266}, {0x0013, 0x0267}, {0x0013, 0x0268}, {0x0013, 0x0269}, {0x0013, 0x026a}, {0x0013, 0x026b}, - {0x0012, 0x013f}, + { + { 0x0002, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0006 }, + { 0x0006, 0x0006 }, + { 0x0008, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x000b, 0x000b }, + { 0x000c, 0x000d }, + { 0x000f, 0x0030 }, + { 0x0010, 0x0055 }, + { 0x0012, 0x0136 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0013, 0x000f }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0005, 0x0007 }, + { 0x0006, 0x0007 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0007 }, + { 0x000a, 0x0008 }, + { 0x000c, 0x000e }, + { 0x000d, 0x0012 }, + { 0x000f, 0x0031 }, + { 0x0011, 0x00a0 }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0005, 0x0008 }, + { 0x0004, 0x0005 }, + { 0x0005, 0x0009 }, + { 0x0006, 0x0008 }, + { 0x0007, 0x0008 }, + { 0x0008, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000c, 0x000f }, + { 0x000d, 0x0013 }, + { 0x000f, 0x0032 }, + { 0x0011, 0x00a1 }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0007, 0x0009 }, + { 0x0008, 0x0009 }, + { 0x0009, 0x0008 }, + { 0x000b, 0x000c }, + { 0x000d, 0x0014 }, + { 0x000e, 0x001d }, + { 0x000f, 0x0033 }, + { 0x0012, 0x0137 }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0008, 0x000a }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0008, 0x000b }, + { 0x0009, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000c, 0x0010 }, + { 0x000d, 0x0015 }, + { 0x000f, 0x0034 }, + { 0x0010, 0x0056 }, + { 0x0012, 0x0138 }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0009, 0x000a }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0009, 0x000b }, + { 0x000a, 0x000b }, + { 0x000c, 0x0011 }, + { 0x000d, 0x0016 }, + { 0x000e, 0x001e }, + { 0x0010, 0x0057 }, + { 0x0011, 0x00a2 }, + { 0x0011, 0x00a3 }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x0013, 0x0054 }, + { 0x0013, 0x0055 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x000b, 0x000d }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000b, 0x000e }, + { 0x000c, 0x0012 }, + { 0x000d, 0x0017 }, + { 0x000e, 0x001f }, + { 0x0010, 0x0058 }, + { 0x0012, 0x0139 }, + { 0x0011, 0x00a4 }, + { 0x0012, 0x013a }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0013, 0x0062 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x0013, 0x0066 }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x000c, 0x0013 }, + { 0x000b, 0x000f }, + { 0x000c, 0x0014 }, + { 0x000c, 0x0015 }, + { 0x000d, 0x0018 }, + { 0x000e, 0x0020 }, + { 0x000f, 0x0035 }, + { 0x0012, 0x013b }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x000e, 0x0021 }, + { 0x000d, 0x0019 }, + { 0x000e, 0x0022 }, + { 0x000e, 0x0023 }, + { 0x000f, 0x0036 }, + { 0x0010, 0x0059 }, + { 0x0011, 0x00a5 }, + { 0x0013, 0x0083 }, + { 0x0011, 0x00a6 }, + { 0x0012, 0x013c }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x0013, 0x008b }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0013, 0x008e }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0013, 0x0091 }, + { 0x0013, 0x0092 }, + { 0x0013, 0x0093 }, + { 0x0013, 0x0094 }, + { 0x0010, 0x005a }, + { 0x000f, 0x0037 }, + { 0x000f, 0x0038 }, + { 0x000f, 0x0039 }, + { 0x0010, 0x005b }, + { 0x0010, 0x005c }, + { 0x0013, 0x0095 }, + { 0x0011, 0x00a7 }, + { 0x0013, 0x0096 }, + { 0x0013, 0x0097 }, + { 0x0013, 0x0098 }, + { 0x0013, 0x0099 }, + { 0x0013, 0x009a }, + { 0x0013, 0x009b }, + { 0x0013, 0x009c }, + { 0x0013, 0x009d }, + { 0x0013, 0x009e }, + { 0x0013, 0x009f }, + { 0x0013, 0x00a0 }, + { 0x0013, 0x00a1 }, + { 0x0013, 0x00a2 }, + { 0x0013, 0x00a3 }, + { 0x0013, 0x00a4 }, + { 0x0013, 0x00a5 }, + { 0x0013, 0x00a6 }, + { 0x0013, 0x00a7 }, + { 0x0013, 0x00a8 }, + { 0x0010, 0x005d }, + { 0x0010, 0x005e }, + { 0x0013, 0x00a9 }, + { 0x0010, 0x005f }, + { 0x0013, 0x00aa }, + { 0x0012, 0x013d }, + { 0x0013, 0x00ab }, + { 0x0013, 0x00ac }, + { 0x0013, 0x00ad }, + { 0x0013, 0x00ae }, + { 0x0013, 0x00af }, + { 0x0013, 0x00b0 }, + { 0x0013, 0x00b1 }, + { 0x0013, 0x00b2 }, + { 0x0013, 0x00b3 }, + { 0x0013, 0x00b4 }, + { 0x0013, 0x00b5 }, + { 0x0013, 0x00b6 }, + { 0x0013, 0x00b7 }, + { 0x0013, 0x00b8 }, + { 0x0013, 0x00b9 }, + { 0x0013, 0x00ba }, + { 0x0013, 0x00bb }, + { 0x0013, 0x00bc }, + { 0x0013, 0x00bd }, + { 0x0013, 0x00be }, + { 0x0013, 0x00bf }, + { 0x0013, 0x00c0 }, + { 0x0011, 0x00a8 }, + { 0x0013, 0x00c1 }, + { 0x0011, 0x00a9 }, + { 0x0013, 0x00c2 }, + { 0x0013, 0x00c3 }, + { 0x0013, 0x00c4 }, + { 0x0013, 0x00c5 }, + { 0x0013, 0x00c6 }, + { 0x0013, 0x00c7 }, + { 0x0013, 0x00c8 }, + { 0x0013, 0x00c9 }, + { 0x0013, 0x00ca }, + { 0x0013, 0x00cb }, + { 0x0013, 0x00cc }, + { 0x0013, 0x00cd }, + { 0x0013, 0x00ce }, + { 0x0013, 0x00cf }, + { 0x0013, 0x00d0 }, + { 0x0013, 0x00d1 }, + { 0x0013, 0x00d2 }, + { 0x0013, 0x00d3 }, + { 0x0013, 0x00d4 }, + { 0x0013, 0x00d5 }, + { 0x0013, 0x00d6 }, + { 0x0013, 0x00d7 }, + { 0x0013, 0x00d8 }, + { 0x0013, 0x00d9 }, + { 0x0013, 0x00da }, + { 0x0012, 0x013e }, + { 0x0013, 0x00db }, + { 0x0013, 0x00dc }, + { 0x0013, 0x00dd }, + { 0x0013, 0x00de }, + { 0x0013, 0x00df }, + { 0x0013, 0x00e0 }, + { 0x0013, 0x00e1 }, + { 0x0013, 0x00e2 }, + { 0x0013, 0x00e3 }, + { 0x0013, 0x00e4 }, + { 0x0013, 0x00e5 }, + { 0x0013, 0x00e6 }, + { 0x0013, 0x00e7 }, + { 0x0013, 0x00e8 }, + { 0x0013, 0x00e9 }, + { 0x0013, 0x00ea }, + { 0x0013, 0x00eb }, + { 0x0013, 0x00ec }, + { 0x0013, 0x00ed }, + { 0x0013, 0x00ee }, + { 0x0013, 0x00ef }, + { 0x0013, 0x00f0 }, + { 0x0013, 0x00f1 }, + { 0x0013, 0x00f2 }, + { 0x0013, 0x00f3 }, + { 0x0013, 0x00f4 }, + { 0x0013, 0x00f5 }, + { 0x0013, 0x00f6 }, + { 0x0013, 0x00f7 }, + { 0x0013, 0x00f8 }, + { 0x0013, 0x00f9 }, + { 0x0013, 0x00fa }, + { 0x0013, 0x00fb }, + { 0x0013, 0x00fc }, + { 0x0013, 0x00fd }, + { 0x0013, 0x00fe }, + { 0x0013, 0x00ff }, + { 0x0013, 0x0100 }, + { 0x0013, 0x0101 }, + { 0x0013, 0x0102 }, + { 0x0013, 0x0103 }, + { 0x0013, 0x0104 }, + { 0x0013, 0x0105 }, + { 0x0013, 0x0106 }, + { 0x0013, 0x0107 }, + { 0x0013, 0x0108 }, + { 0x0013, 0x0109 }, + { 0x0013, 0x010a }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0013, 0x010f }, + { 0x0013, 0x0110 }, + { 0x0013, 0x0111 }, + { 0x0013, 0x0112 }, + { 0x0013, 0x0113 }, + { 0x0013, 0x0114 }, + { 0x0013, 0x0115 }, + { 0x0013, 0x0116 }, + { 0x0013, 0x0117 }, + { 0x0013, 0x0118 }, + { 0x0013, 0x0119 }, + { 0x0013, 0x011a }, + { 0x0013, 0x011b }, + { 0x0013, 0x011c }, + { 0x0013, 0x011d }, + { 0x0013, 0x011e }, + { 0x0013, 0x011f }, + { 0x0013, 0x0120 }, + { 0x0013, 0x0121 }, + { 0x0013, 0x0122 }, + { 0x0013, 0x0123 }, + { 0x0013, 0x0124 }, + { 0x0013, 0x0125 }, + { 0x0013, 0x0126 }, + { 0x0013, 0x0127 }, + { 0x0013, 0x0128 }, + { 0x0013, 0x0129 }, + { 0x0013, 0x012a }, + { 0x0013, 0x012b }, + { 0x0013, 0x012c }, + { 0x0013, 0x012d }, + { 0x0013, 0x012e }, + { 0x0013, 0x012f }, + { 0x0013, 0x0130 }, + { 0x0013, 0x0131 }, + { 0x0013, 0x0132 }, + { 0x0013, 0x0133 }, + { 0x0013, 0x0134 }, + { 0x0013, 0x0135 }, + { 0x0013, 0x0136 }, + { 0x0013, 0x0137 }, + { 0x0013, 0x0138 }, + { 0x0013, 0x0139 }, + { 0x0013, 0x013a }, + { 0x0013, 0x013b }, + { 0x0013, 0x013c }, + { 0x0013, 0x013d }, + { 0x0013, 0x013e }, + { 0x0013, 0x013f }, + { 0x0013, 0x0140 }, + { 0x0013, 0x0141 }, + { 0x0013, 0x0142 }, + { 0x0013, 0x0143 }, + { 0x0013, 0x0144 }, + { 0x0013, 0x0145 }, + { 0x0013, 0x0146 }, + { 0x0013, 0x0147 }, + { 0x0013, 0x0148 }, + { 0x0013, 0x0149 }, + { 0x0013, 0x014a }, + { 0x0013, 0x014b }, + { 0x0013, 0x014c }, + { 0x0013, 0x014d }, + { 0x0013, 0x014e }, + { 0x0013, 0x014f }, + { 0x0013, 0x0150 }, + { 0x0013, 0x0151 }, + { 0x0013, 0x0152 }, + { 0x0013, 0x0153 }, + { 0x0013, 0x0154 }, + { 0x0013, 0x0155 }, + { 0x0013, 0x0156 }, + { 0x0013, 0x0157 }, + { 0x0013, 0x0158 }, + { 0x0013, 0x0159 }, + { 0x0013, 0x015a }, + { 0x0013, 0x015b }, + { 0x0013, 0x015c }, + { 0x0013, 0x015d }, + { 0x0013, 0x015e }, + { 0x0013, 0x015f }, + { 0x0013, 0x0160 }, + { 0x0013, 0x0161 }, + { 0x0013, 0x0162 }, + { 0x0013, 0x0163 }, + { 0x0013, 0x0164 }, + { 0x0013, 0x0165 }, + { 0x0013, 0x0166 }, + { 0x0013, 0x0167 }, + { 0x0013, 0x0168 }, + { 0x0013, 0x0169 }, + { 0x0013, 0x016a }, + { 0x0013, 0x016b }, + { 0x0013, 0x016c }, + { 0x0013, 0x016d }, + { 0x0013, 0x016e }, + { 0x0013, 0x016f }, + { 0x0013, 0x0170 }, + { 0x0013, 0x0171 }, + { 0x0013, 0x0172 }, + { 0x0013, 0x0173 }, + { 0x0013, 0x0174 }, + { 0x0013, 0x0175 }, + { 0x0013, 0x0176 }, + { 0x0013, 0x0177 }, + { 0x0013, 0x0178 }, + { 0x0013, 0x0179 }, + { 0x0013, 0x017a }, + { 0x0013, 0x017b }, + { 0x0013, 0x017c }, + { 0x0013, 0x017d }, + { 0x0013, 0x017e }, + { 0x0013, 0x017f }, + { 0x0013, 0x0180 }, + { 0x0013, 0x0181 }, + { 0x0013, 0x0182 }, + { 0x0013, 0x0183 }, + { 0x0013, 0x0184 }, + { 0x0013, 0x0185 }, + { 0x0013, 0x0186 }, + { 0x0013, 0x0187 }, + { 0x0013, 0x0188 }, + { 0x0013, 0x0189 }, + { 0x0013, 0x018a }, + { 0x0013, 0x018b }, + { 0x0013, 0x018c }, + { 0x0013, 0x018d }, + { 0x0013, 0x018e }, + { 0x0013, 0x018f }, + { 0x0013, 0x0190 }, + { 0x0013, 0x0191 }, + { 0x0013, 0x0192 }, + { 0x0013, 0x0193 }, + { 0x0013, 0x0194 }, + { 0x0013, 0x0195 }, + { 0x0013, 0x0196 }, + { 0x0013, 0x0197 }, + { 0x0013, 0x0198 }, + { 0x0013, 0x0199 }, + { 0x0013, 0x019a }, + { 0x0013, 0x019b }, + { 0x0013, 0x019c }, + { 0x0013, 0x019d }, + { 0x0013, 0x019e }, + { 0x0013, 0x019f }, + { 0x0013, 0x01a0 }, + { 0x0013, 0x01a1 }, + { 0x0013, 0x01a2 }, + { 0x0013, 0x01a3 }, + { 0x0013, 0x01a4 }, + { 0x0013, 0x01a5 }, + { 0x0013, 0x01a6 }, + { 0x0013, 0x01a7 }, + { 0x0013, 0x01a8 }, + { 0x0013, 0x01a9 }, + { 0x0013, 0x01aa }, + { 0x0013, 0x01ab }, + { 0x0013, 0x01ac }, + { 0x0013, 0x01ad }, + { 0x0013, 0x01ae }, + { 0x0013, 0x01af }, + { 0x0013, 0x01b0 }, + { 0x0013, 0x01b1 }, + { 0x0013, 0x01b2 }, + { 0x0013, 0x01b3 }, + { 0x0013, 0x01b4 }, + { 0x0013, 0x01b5 }, + { 0x0013, 0x01b6 }, + { 0x0013, 0x01b7 }, + { 0x0013, 0x01b8 }, + { 0x0013, 0x01b9 }, + { 0x0013, 0x01ba }, + { 0x0013, 0x01bb }, + { 0x0013, 0x01bc }, + { 0x0013, 0x01bd }, + { 0x0013, 0x01be }, + { 0x0013, 0x01bf }, + { 0x0013, 0x01c0 }, + { 0x0013, 0x01c1 }, + { 0x0013, 0x01c2 }, + { 0x0013, 0x01c3 }, + { 0x0013, 0x01c4 }, + { 0x0013, 0x01c5 }, + { 0x0013, 0x01c6 }, + { 0x0013, 0x01c7 }, + { 0x0013, 0x01c8 }, + { 0x0013, 0x01c9 }, + { 0x0013, 0x01ca }, + { 0x0013, 0x01cb }, + { 0x0013, 0x01cc }, + { 0x0013, 0x01cd }, + { 0x0013, 0x01ce }, + { 0x0013, 0x01cf }, + { 0x0013, 0x01d0 }, + { 0x0013, 0x01d1 }, + { 0x0013, 0x01d2 }, + { 0x0013, 0x01d3 }, + { 0x0013, 0x01d4 }, + { 0x0013, 0x01d5 }, + { 0x0013, 0x01d6 }, + { 0x0013, 0x01d7 }, + { 0x0013, 0x01d8 }, + { 0x0013, 0x01d9 }, + { 0x0013, 0x01da }, + { 0x0013, 0x01db }, + { 0x0013, 0x01dc }, + { 0x0013, 0x01dd }, + { 0x0013, 0x01de }, + { 0x0013, 0x01df }, + { 0x0013, 0x01e0 }, + { 0x0013, 0x01e1 }, + { 0x0013, 0x01e2 }, + { 0x0013, 0x01e3 }, + { 0x0013, 0x01e4 }, + { 0x0013, 0x01e5 }, + { 0x0013, 0x01e6 }, + { 0x0013, 0x01e7 }, + { 0x0013, 0x01e8 }, + { 0x0013, 0x01e9 }, + { 0x0013, 0x01ea }, + { 0x0013, 0x01eb }, + { 0x0013, 0x01ec }, + { 0x0013, 0x01ed }, + { 0x0013, 0x01ee }, + { 0x0013, 0x01ef }, + { 0x0013, 0x01f0 }, + { 0x0013, 0x01f1 }, + { 0x0013, 0x01f2 }, + { 0x0013, 0x01f3 }, + { 0x0013, 0x01f4 }, + { 0x0013, 0x01f5 }, + { 0x0013, 0x01f6 }, + { 0x0013, 0x01f7 }, + { 0x0013, 0x01f8 }, + { 0x0013, 0x01f9 }, + { 0x0013, 0x01fa }, + { 0x0013, 0x01fb }, + { 0x0013, 0x01fc }, + { 0x0013, 0x01fd }, + { 0x0013, 0x01fe }, + { 0x0013, 0x01ff }, + { 0x0013, 0x0200 }, + { 0x0013, 0x0201 }, + { 0x0013, 0x0202 }, + { 0x0013, 0x0203 }, + { 0x0013, 0x0204 }, + { 0x0013, 0x0205 }, + { 0x0013, 0x0206 }, + { 0x0013, 0x0207 }, + { 0x0013, 0x0208 }, + { 0x0013, 0x0209 }, + { 0x0013, 0x020a }, + { 0x0013, 0x020b }, + { 0x0013, 0x020c }, + { 0x0013, 0x020d }, + { 0x0013, 0x020e }, + { 0x0013, 0x020f }, + { 0x0013, 0x0210 }, + { 0x0013, 0x0211 }, + { 0x0013, 0x0212 }, + { 0x0013, 0x0213 }, + { 0x0013, 0x0214 }, + { 0x0013, 0x0215 }, + { 0x0013, 0x0216 }, + { 0x0013, 0x0217 }, + { 0x0013, 0x0218 }, + { 0x0013, 0x0219 }, + { 0x0013, 0x021a }, + { 0x0013, 0x021b }, + { 0x0013, 0x021c }, + { 0x0013, 0x021d }, + { 0x0013, 0x021e }, + { 0x0013, 0x021f }, + { 0x0013, 0x0220 }, + { 0x0013, 0x0221 }, + { 0x0013, 0x0222 }, + { 0x0013, 0x0223 }, + { 0x0013, 0x0224 }, + { 0x0013, 0x0225 }, + { 0x0013, 0x0226 }, + { 0x0013, 0x0227 }, + { 0x0013, 0x0228 }, + { 0x0013, 0x0229 }, + { 0x0013, 0x022a }, + { 0x0013, 0x022b }, + { 0x0013, 0x022c }, + { 0x0013, 0x022d }, + { 0x0013, 0x022e }, + { 0x0013, 0x022f }, + { 0x0013, 0x0230 }, + { 0x0013, 0x0231 }, + { 0x0013, 0x0232 }, + { 0x0013, 0x0233 }, + { 0x0013, 0x0234 }, + { 0x0013, 0x0235 }, + { 0x0013, 0x0236 }, + { 0x0013, 0x0237 }, + { 0x0013, 0x0238 }, + { 0x0013, 0x0239 }, + { 0x0013, 0x023a }, + { 0x0013, 0x023b }, + { 0x0013, 0x023c }, + { 0x0013, 0x023d }, + { 0x0013, 0x023e }, + { 0x0013, 0x023f }, + { 0x0013, 0x0240 }, + { 0x0013, 0x0241 }, + { 0x0013, 0x0242 }, + { 0x0013, 0x0243 }, + { 0x0013, 0x0244 }, + { 0x0013, 0x0245 }, + { 0x0013, 0x0246 }, + { 0x0013, 0x0247 }, + { 0x0013, 0x0248 }, + { 0x0013, 0x0249 }, + { 0x0013, 0x024a }, + { 0x0013, 0x024b }, + { 0x0013, 0x024c }, + { 0x0013, 0x024d }, + { 0x0013, 0x024e }, + { 0x0013, 0x024f }, + { 0x0013, 0x0250 }, + { 0x0013, 0x0251 }, + { 0x0013, 0x0252 }, + { 0x0013, 0x0253 }, + { 0x0013, 0x0254 }, + { 0x0013, 0x0255 }, + { 0x0013, 0x0256 }, + { 0x0013, 0x0257 }, + { 0x0013, 0x0258 }, + { 0x0013, 0x0259 }, + { 0x0013, 0x025a }, + { 0x0013, 0x025b }, + { 0x0013, 0x025c }, + { 0x0013, 0x025d }, + { 0x0013, 0x025e }, + { 0x0013, 0x025f }, + { 0x0013, 0x0260 }, + { 0x0013, 0x0261 }, + { 0x0013, 0x0262 }, + { 0x0013, 0x0263 }, + { 0x0013, 0x0264 }, + { 0x0013, 0x0265 }, + { 0x0013, 0x0266 }, + { 0x0013, 0x0267 }, + { 0x0013, 0x0268 }, + { 0x0013, 0x0269 }, + { 0x0013, 0x026a }, + { 0x0013, 0x026b }, + { 0x0012, 0x013f }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec48[110][16] = -{ - {0x0005ffff, 0x0003ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x00000037, 0x00010001, 0x00010001, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, - {0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, - {0x0001003a, 0x0001003a, 0x00010054, 0x00010054, 0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x00020003, 0x00020003, 0x00020003, 0x00020003, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, }, - {0x000bffff, 0x000affff, 0x0009ffff, 0x0008ffff, 0x0006ffff, 0x0007ffff, 0x00000004, 0x00000020, 0x0000003b, 0x00000055, 0x0000006c, 0x0000006f, 0x00000088, 0x00000089, 0x0001001f, 0x0001001f, }, - {0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, }, - {0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x00030087, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, 0x0003008a, }, - {0x000200a3, 0x000200a3, 0x000200a3, 0x000200a3, 0x000200a4, 0x000200a4, 0x000200a4, 0x000200a4, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, }, - {0x00000072, 0x0000008c, 0x000000a6, 0x000000bd, 0x000000bf, 0x000000c0, 0x00010006, 0x00010006, 0x00010057, 0x00010057, 0x000100a2, 0x000100a2, 0x000100a5, 0x000100a5, 0x000100be, 0x000100be, }, - {0x001dffff, 0x002effff, 0x003fffff, 0x0050ffff, 0x0019ffff, 0x0013ffff, 0x0012ffff, 0x0010ffff, 0x0011ffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000007, 0x00000022, 0x0000003d, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, - {0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x0003008d, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, 0x000300a7, }, - {0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300c1, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, 0x000300d9, }, - {0x000100f5, 0x000100f5, 0x000100f6, 0x000100f6, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x000200a8, 0x000200a8, 0x000200a8, 0x000200a8, }, - {0x000200c2, 0x000200c2, 0x000200c2, 0x000200c2, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200d8, 0x000200da, 0x000200da, 0x000200da, 0x000200da, 0x000200db, 0x000200db, 0x000200db, 0x000200db, }, - {0x00010008, 0x00010008, 0x00010024, 0x00010024, 0x0001003f, 0x0001003f, 0x0001005a, 0x0001005a, 0x00010074, 0x00010074, 0x000100c3, 0x000100c3, 0x000100dc, 0x000100dc, 0x000100f4, 0x000100f4, }, - {0x0015ffff, 0x0014ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x00000009, 0x00000075, 0x0000008f, 0x000000a9, 0x000000dd, 0x000000f3, 0x000000f7, 0x000000f8, 0x0000010e, 0x0000010f, 0x00000111, }, - {0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030090, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, 0x00030091, }, - {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300ab, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, 0x000300de, }, - {0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300e0, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, }, - {0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012a, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, 0x0003012c, }, - {0x0061ffff, 0x0062ffff, 0x0063ffff, 0x0064ffff, 0x0065ffff, 0x0066ffff, 0x0067ffff, 0x0068ffff, 0x0069ffff, 0x006affff, 0x006bffff, 0x006cffff, 0x006dffff, 0x001bffff, 0x001affff, 0x001cffff, }, - {0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200ac, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c4, }, - {0x000102d4, 0x000102d4, 0x000102d5, 0x000102d5, 0x000102d6, 0x000102d6, 0x000102d7, 0x000102d7, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, }, - {0x000200e1, 0x000200e1, 0x000200e1, 0x000200e1, 0x00020113, 0x00020113, 0x00020113, 0x00020113, 0x00020146, 0x00020146, 0x00020146, 0x00020146, 0x000202d8, 0x000202d8, 0x000202d8, 0x000202d8, }, - {0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0027ffff, 0x0025ffff, 0x0026ffff, 0x0028ffff, 0x0029ffff, 0x002affff, 0x002bffff, 0x002cffff, 0x002dffff, }, - {0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, }, - {0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, }, - {0x00010026, 0x00010026, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, }, - {0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, }, - {0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, }, - {0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, }, - {0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, }, - {0x00010077, 0x00010077, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, 0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, }, - {0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, 0x00010085, 0x00010085, 0x00010086, 0x00010086, }, - {0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, }, - {0x00010092, 0x00010092, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, 0x00010099, 0x00010099, }, - {0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, 0x000100a1, 0x000100a1, }, - {0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, }, - {0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, 0x000100bc, 0x000100bc, }, - {0x000100c5, 0x000100c5, 0x000100c6, 0x000100c6, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, }, - {0x000100cd, 0x000100cd, 0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, }, - {0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, 0x0033ffff, 0x0034ffff, 0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, }, - {0x000100d5, 0x000100d5, 0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100df, 0x000100df, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, }, - {0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, 0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, }, - {0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, 0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100f9, 0x000100f9, 0x000100fb, 0x000100fb, 0x000100fc, 0x000100fc, }, - {0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, 0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, }, - {0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, 0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, }, - {0x0001010d, 0x0001010d, 0x00010110, 0x00010110, 0x00010112, 0x00010112, 0x00010114, 0x00010114, 0x00010115, 0x00010115, 0x00010116, 0x00010116, 0x00010117, 0x00010117, 0x00010118, 0x00010118, }, - {0x00010119, 0x00010119, 0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, }, - {0x00010121, 0x00010121, 0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, }, - {0x00010129, 0x00010129, 0x0001012b, 0x0001012b, 0x0001012d, 0x0001012d, 0x0001012e, 0x0001012e, 0x0001012f, 0x0001012f, 0x00010130, 0x00010130, 0x00010131, 0x00010131, 0x00010132, 0x00010132, }, - {0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, 0x00010139, 0x00010139, 0x0001013a, 0x0001013a, }, - {0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, 0x00010141, 0x00010141, 0x00010142, 0x00010142, }, - {0x00010143, 0x00010143, 0x00010144, 0x00010144, 0x00010145, 0x00010145, 0x00010147, 0x00010147, 0x00010148, 0x00010148, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, }, - {0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, }, - {0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, }, - {0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, }, - {0x00010164, 0x00010164, 0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, }, - {0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, 0x0045ffff, 0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, }, - {0x0001016c, 0x0001016c, 0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, }, - {0x00010174, 0x00010174, 0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, }, - {0x0001017c, 0x0001017c, 0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, }, - {0x00010184, 0x00010184, 0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, }, - {0x0001018c, 0x0001018c, 0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, }, - {0x00010194, 0x00010194, 0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, }, - {0x0001019c, 0x0001019c, 0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, }, - {0x000101a4, 0x000101a4, 0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, }, - {0x000101ac, 0x000101ac, 0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, }, - {0x000101b4, 0x000101b4, 0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, }, - {0x000101bc, 0x000101bc, 0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, }, - {0x000101c4, 0x000101c4, 0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, }, - {0x000101cc, 0x000101cc, 0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, }, - {0x000101d4, 0x000101d4, 0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, }, - {0x000101dc, 0x000101dc, 0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, }, - {0x000101e4, 0x000101e4, 0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, }, - {0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, 0x0056ffff, 0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, }, - {0x000101ec, 0x000101ec, 0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, }, - {0x000101f4, 0x000101f4, 0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, }, - {0x000101fc, 0x000101fc, 0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, }, - {0x00010204, 0x00010204, 0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, }, - {0x0001020c, 0x0001020c, 0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, }, - {0x00010214, 0x00010214, 0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, }, - {0x0001021c, 0x0001021c, 0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, }, - {0x00010224, 0x00010224, 0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, }, - {0x0001022c, 0x0001022c, 0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, }, - {0x00010234, 0x00010234, 0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, }, - {0x0001023c, 0x0001023c, 0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, 0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, }, - {0x00010244, 0x00010244, 0x00010245, 0x00010245, 0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, 0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, }, - {0x0001024c, 0x0001024c, 0x0001024d, 0x0001024d, 0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, 0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, }, - {0x00010254, 0x00010254, 0x00010255, 0x00010255, 0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, 0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, }, - {0x0001025c, 0x0001025c, 0x0001025d, 0x0001025d, 0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, 0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, }, - {0x00010264, 0x00010264, 0x00010265, 0x00010265, 0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, 0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, }, - {0x0001026c, 0x0001026c, 0x0001026d, 0x0001026d, 0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00010270, 0x00010270, 0x00010271, 0x00010271, 0x00010272, 0x00010272, 0x00010273, 0x00010273, }, - {0x00010274, 0x00010274, 0x00010275, 0x00010275, 0x00010276, 0x00010276, 0x00010277, 0x00010277, 0x00010278, 0x00010278, 0x00010279, 0x00010279, 0x0001027a, 0x0001027a, 0x0001027b, 0x0001027b, }, - {0x0001027c, 0x0001027c, 0x0001027d, 0x0001027d, 0x0001027e, 0x0001027e, 0x0001027f, 0x0001027f, 0x00010280, 0x00010280, 0x00010281, 0x00010281, 0x00010282, 0x00010282, 0x00010283, 0x00010283, }, - {0x00010284, 0x00010284, 0x00010285, 0x00010285, 0x00010286, 0x00010286, 0x00010287, 0x00010287, 0x00010288, 0x00010288, 0x00010289, 0x00010289, 0x0001028a, 0x0001028a, 0x0001028b, 0x0001028b, }, - {0x0001028c, 0x0001028c, 0x0001028d, 0x0001028d, 0x0001028e, 0x0001028e, 0x0001028f, 0x0001028f, 0x00010290, 0x00010290, 0x00010291, 0x00010291, 0x00010292, 0x00010292, 0x00010293, 0x00010293, }, - {0x00010294, 0x00010294, 0x00010295, 0x00010295, 0x00010296, 0x00010296, 0x00010297, 0x00010297, 0x00010298, 0x00010298, 0x00010299, 0x00010299, 0x0001029a, 0x0001029a, 0x0001029b, 0x0001029b, }, - {0x0001029c, 0x0001029c, 0x0001029d, 0x0001029d, 0x0001029e, 0x0001029e, 0x0001029f, 0x0001029f, 0x000102a0, 0x000102a0, 0x000102a1, 0x000102a1, 0x000102a2, 0x000102a2, 0x000102a3, 0x000102a3, }, - {0x000102a4, 0x000102a4, 0x000102a5, 0x000102a5, 0x000102a6, 0x000102a6, 0x000102a7, 0x000102a7, 0x000102a8, 0x000102a8, 0x000102a9, 0x000102a9, 0x000102aa, 0x000102aa, 0x000102ab, 0x000102ab, }, - {0x000102ac, 0x000102ac, 0x000102ad, 0x000102ad, 0x000102ae, 0x000102ae, 0x000102af, 0x000102af, 0x000102b0, 0x000102b0, 0x000102b1, 0x000102b1, 0x000102b2, 0x000102b2, 0x000102b3, 0x000102b3, }, - {0x000102b4, 0x000102b4, 0x000102b5, 0x000102b5, 0x000102b6, 0x000102b6, 0x000102b7, 0x000102b7, 0x000102b8, 0x000102b8, 0x000102b9, 0x000102b9, 0x000102ba, 0x000102ba, 0x000102bb, 0x000102bb, }, - {0x000102bc, 0x000102bc, 0x000102bd, 0x000102bd, 0x000102be, 0x000102be, 0x000102bf, 0x000102bf, 0x000102c0, 0x000102c0, 0x000102c1, 0x000102c1, 0x000102c2, 0x000102c2, 0x000102c3, 0x000102c3, }, - {0x000102c4, 0x000102c4, 0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, }, - {0x000102cc, 0x000102cc, 0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, }, +const uint32_t c_aauiCQMFHuffDec48[110][16] = { + { + 0x0005ffff, + 0x0003ffff, + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000037, + 0x00010001, + 0x00010001, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + }, + { + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + }, + { + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + }, + { + 0x0001003a, + 0x0001003a, + 0x00010054, + 0x00010054, + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x00020003, + 0x00020003, + 0x00020003, + 0x00020003, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + }, + { + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + }, + { + 0x000bffff, + 0x000affff, + 0x0009ffff, + 0x0008ffff, + 0x0006ffff, + 0x0007ffff, + 0x00000004, + 0x00000020, + 0x0000003b, + 0x00000055, + 0x0000006c, + 0x0000006f, + 0x00000088, + 0x00000089, + 0x0001001f, + 0x0001001f, + }, + { + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + }, + { + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x00030087, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + 0x0003008a, + }, + { + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a3, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x000200a4, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020071, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008b, + }, + { + 0x00000072, + 0x0000008c, + 0x000000a6, + 0x000000bd, + 0x000000bf, + 0x000000c0, + 0x00010006, + 0x00010006, + 0x00010057, + 0x00010057, + 0x000100a2, + 0x000100a2, + 0x000100a5, + 0x000100a5, + 0x000100be, + 0x000100be, + }, + { + 0x001dffff, + 0x002effff, + 0x003fffff, + 0x0050ffff, + 0x0019ffff, + 0x0013ffff, + 0x0012ffff, + 0x0010ffff, + 0x0011ffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x00000007, + 0x00000022, + 0x0000003d, + }, + { + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, + { + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + }, + { + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x0003008d, + 0x000300a7, + 0x000300a7, + 0x000300a7, + 0x000300a7, + 0x000300a7, + 0x000300a7, + 0x000300a7, + 0x000300a7, + }, + { + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300c1, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + 0x000300d9, + }, + { + 0x000100f5, + 0x000100f5, + 0x000100f6, + 0x000100f6, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x000200a8, + 0x000200a8, + 0x000200a8, + 0x000200a8, + }, + { + 0x000200c2, + 0x000200c2, + 0x000200c2, + 0x000200c2, + 0x000200d8, + 0x000200d8, + 0x000200d8, + 0x000200d8, + 0x000200da, + 0x000200da, + 0x000200da, + 0x000200da, + 0x000200db, + 0x000200db, + 0x000200db, + 0x000200db, + }, + { + 0x00010008, + 0x00010008, + 0x00010024, + 0x00010024, + 0x0001003f, + 0x0001003f, + 0x0001005a, + 0x0001005a, + 0x00010074, + 0x00010074, + 0x000100c3, + 0x000100c3, + 0x000100dc, + 0x000100dc, + 0x000100f4, + 0x000100f4, + }, + { + 0x0015ffff, + 0x0014ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x00000009, + 0x00000075, + 0x0000008f, + 0x000000a9, + 0x000000dd, + 0x000000f3, + 0x000000f7, + 0x000000f8, + 0x0000010e, + 0x0000010f, + 0x00000111, + }, + { + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030090, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + 0x00030091, + }, + { + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + }, + { + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300ab, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + 0x000300de, + }, + { + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300e0, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + }, + { + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012a, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + 0x0003012c, + }, + { + 0x0061ffff, + 0x0062ffff, + 0x0063ffff, + 0x0064ffff, + 0x0065ffff, + 0x0066ffff, + 0x0067ffff, + 0x0068ffff, + 0x0069ffff, + 0x006affff, + 0x006bffff, + 0x006cffff, + 0x006dffff, + 0x001bffff, + 0x001affff, + 0x001cffff, + }, + { + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200ac, + 0x000200c4, + 0x000200c4, + 0x000200c4, + 0x000200c4, + }, + { + 0x000102d4, + 0x000102d4, + 0x000102d5, + 0x000102d5, + 0x000102d6, + 0x000102d6, + 0x000102d7, + 0x000102d7, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + }, + { + 0x000200e1, + 0x000200e1, + 0x000200e1, + 0x000200e1, + 0x00020113, + 0x00020113, + 0x00020113, + 0x00020113, + 0x00020146, + 0x00020146, + 0x00020146, + 0x00020146, + 0x000202d8, + 0x000202d8, + 0x000202d8, + 0x000202d8, + }, + { + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0027ffff, + 0x0025ffff, + 0x0026ffff, + 0x0028ffff, + 0x0029ffff, + 0x002affff, + 0x002bffff, + 0x002cffff, + 0x002dffff, + }, + { + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + }, + { + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + }, + { + 0x00010026, + 0x00010026, + 0x00010027, + 0x00010027, + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + }, + { + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + }, + { + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + }, + { + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + }, + { + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + }, + { + 0x00010077, + 0x00010077, + 0x00010078, + 0x00010078, + 0x00010079, + 0x00010079, + 0x0001007a, + 0x0001007a, + 0x0001007b, + 0x0001007b, + 0x0001007c, + 0x0001007c, + 0x0001007d, + 0x0001007d, + 0x0001007e, + 0x0001007e, + }, + { + 0x0001007f, + 0x0001007f, + 0x00010080, + 0x00010080, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + 0x00010083, + 0x00010083, + 0x00010084, + 0x00010084, + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + }, + { + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x00010069, + 0x00010069, + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + }, + { + 0x00010092, + 0x00010092, + 0x00010093, + 0x00010093, + 0x00010094, + 0x00010094, + 0x00010095, + 0x00010095, + 0x00010096, + 0x00010096, + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + 0x00010099, + 0x00010099, + }, + { + 0x0001009a, + 0x0001009a, + 0x0001009b, + 0x0001009b, + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + 0x000100a1, + 0x000100a1, + }, + { + 0x000100ad, + 0x000100ad, + 0x000100ae, + 0x000100ae, + 0x000100af, + 0x000100af, + 0x000100b0, + 0x000100b0, + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + 0x000100b4, + 0x000100b4, + }, + { + 0x000100b5, + 0x000100b5, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + 0x000100b8, + 0x000100b8, + 0x000100b9, + 0x000100b9, + 0x000100ba, + 0x000100ba, + 0x000100bb, + 0x000100bb, + 0x000100bc, + 0x000100bc, + }, + { + 0x000100c5, + 0x000100c5, + 0x000100c6, + 0x000100c6, + 0x000100c7, + 0x000100c7, + 0x000100c8, + 0x000100c8, + 0x000100c9, + 0x000100c9, + 0x000100ca, + 0x000100ca, + 0x000100cb, + 0x000100cb, + 0x000100cc, + 0x000100cc, + }, + { + 0x000100cd, + 0x000100cd, + 0x000100ce, + 0x000100ce, + 0x000100cf, + 0x000100cf, + 0x000100d0, + 0x000100d0, + 0x000100d1, + 0x000100d1, + 0x000100d2, + 0x000100d2, + 0x000100d3, + 0x000100d3, + 0x000100d4, + 0x000100d4, + }, + { + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + 0x0033ffff, + 0x0034ffff, + 0x0035ffff, + 0x0036ffff, + 0x0037ffff, + 0x0038ffff, + 0x0039ffff, + 0x003affff, + 0x003bffff, + 0x003cffff, + 0x003dffff, + 0x003effff, + }, + { + 0x000100d5, + 0x000100d5, + 0x000100d6, + 0x000100d6, + 0x000100d7, + 0x000100d7, + 0x000100df, + 0x000100df, + 0x000100e2, + 0x000100e2, + 0x000100e3, + 0x000100e3, + 0x000100e4, + 0x000100e4, + 0x000100e5, + 0x000100e5, + }, + { + 0x000100e6, + 0x000100e6, + 0x000100e7, + 0x000100e7, + 0x000100e8, + 0x000100e8, + 0x000100e9, + 0x000100e9, + 0x000100ea, + 0x000100ea, + 0x000100eb, + 0x000100eb, + 0x000100ec, + 0x000100ec, + 0x000100ed, + 0x000100ed, + }, + { + 0x000100ee, + 0x000100ee, + 0x000100ef, + 0x000100ef, + 0x000100f0, + 0x000100f0, + 0x000100f1, + 0x000100f1, + 0x000100f2, + 0x000100f2, + 0x000100f9, + 0x000100f9, + 0x000100fb, + 0x000100fb, + 0x000100fc, + 0x000100fc, + }, + { + 0x000100fd, + 0x000100fd, + 0x000100fe, + 0x000100fe, + 0x000100ff, + 0x000100ff, + 0x00010100, + 0x00010100, + 0x00010101, + 0x00010101, + 0x00010102, + 0x00010102, + 0x00010103, + 0x00010103, + 0x00010104, + 0x00010104, + }, + { + 0x00010105, + 0x00010105, + 0x00010106, + 0x00010106, + 0x00010107, + 0x00010107, + 0x00010108, + 0x00010108, + 0x00010109, + 0x00010109, + 0x0001010a, + 0x0001010a, + 0x0001010b, + 0x0001010b, + 0x0001010c, + 0x0001010c, + }, + { + 0x0001010d, + 0x0001010d, + 0x00010110, + 0x00010110, + 0x00010112, + 0x00010112, + 0x00010114, + 0x00010114, + 0x00010115, + 0x00010115, + 0x00010116, + 0x00010116, + 0x00010117, + 0x00010117, + 0x00010118, + 0x00010118, + }, + { + 0x00010119, + 0x00010119, + 0x0001011a, + 0x0001011a, + 0x0001011b, + 0x0001011b, + 0x0001011c, + 0x0001011c, + 0x0001011d, + 0x0001011d, + 0x0001011e, + 0x0001011e, + 0x0001011f, + 0x0001011f, + 0x00010120, + 0x00010120, + }, + { + 0x00010121, + 0x00010121, + 0x00010122, + 0x00010122, + 0x00010123, + 0x00010123, + 0x00010124, + 0x00010124, + 0x00010125, + 0x00010125, + 0x00010126, + 0x00010126, + 0x00010127, + 0x00010127, + 0x00010128, + 0x00010128, + }, + { + 0x00010129, + 0x00010129, + 0x0001012b, + 0x0001012b, + 0x0001012d, + 0x0001012d, + 0x0001012e, + 0x0001012e, + 0x0001012f, + 0x0001012f, + 0x00010130, + 0x00010130, + 0x00010131, + 0x00010131, + 0x00010132, + 0x00010132, + }, + { + 0x00010133, + 0x00010133, + 0x00010134, + 0x00010134, + 0x00010135, + 0x00010135, + 0x00010136, + 0x00010136, + 0x00010137, + 0x00010137, + 0x00010138, + 0x00010138, + 0x00010139, + 0x00010139, + 0x0001013a, + 0x0001013a, + }, + { + 0x0001013b, + 0x0001013b, + 0x0001013c, + 0x0001013c, + 0x0001013d, + 0x0001013d, + 0x0001013e, + 0x0001013e, + 0x0001013f, + 0x0001013f, + 0x00010140, + 0x00010140, + 0x00010141, + 0x00010141, + 0x00010142, + 0x00010142, + }, + { + 0x00010143, + 0x00010143, + 0x00010144, + 0x00010144, + 0x00010145, + 0x00010145, + 0x00010147, + 0x00010147, + 0x00010148, + 0x00010148, + 0x00010149, + 0x00010149, + 0x0001014a, + 0x0001014a, + 0x0001014b, + 0x0001014b, + }, + { + 0x0001014c, + 0x0001014c, + 0x0001014d, + 0x0001014d, + 0x0001014e, + 0x0001014e, + 0x0001014f, + 0x0001014f, + 0x00010150, + 0x00010150, + 0x00010151, + 0x00010151, + 0x00010152, + 0x00010152, + 0x00010153, + 0x00010153, + }, + { + 0x00010154, + 0x00010154, + 0x00010155, + 0x00010155, + 0x00010156, + 0x00010156, + 0x00010157, + 0x00010157, + 0x00010158, + 0x00010158, + 0x00010159, + 0x00010159, + 0x0001015a, + 0x0001015a, + 0x0001015b, + 0x0001015b, + }, + { + 0x0001015c, + 0x0001015c, + 0x0001015d, + 0x0001015d, + 0x0001015e, + 0x0001015e, + 0x0001015f, + 0x0001015f, + 0x00010160, + 0x00010160, + 0x00010161, + 0x00010161, + 0x00010162, + 0x00010162, + 0x00010163, + 0x00010163, + }, + { + 0x00010164, + 0x00010164, + 0x00010165, + 0x00010165, + 0x00010166, + 0x00010166, + 0x00010167, + 0x00010167, + 0x00010168, + 0x00010168, + 0x00010169, + 0x00010169, + 0x0001016a, + 0x0001016a, + 0x0001016b, + 0x0001016b, + }, + { + 0x0040ffff, + 0x0041ffff, + 0x0042ffff, + 0x0043ffff, + 0x0044ffff, + 0x0045ffff, + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x0049ffff, + 0x004affff, + 0x004bffff, + 0x004cffff, + 0x004dffff, + 0x004effff, + 0x004fffff, + }, + { + 0x0001016c, + 0x0001016c, + 0x0001016d, + 0x0001016d, + 0x0001016e, + 0x0001016e, + 0x0001016f, + 0x0001016f, + 0x00010170, + 0x00010170, + 0x00010171, + 0x00010171, + 0x00010172, + 0x00010172, + 0x00010173, + 0x00010173, + }, + { + 0x00010174, + 0x00010174, + 0x00010175, + 0x00010175, + 0x00010176, + 0x00010176, + 0x00010177, + 0x00010177, + 0x00010178, + 0x00010178, + 0x00010179, + 0x00010179, + 0x0001017a, + 0x0001017a, + 0x0001017b, + 0x0001017b, + }, + { + 0x0001017c, + 0x0001017c, + 0x0001017d, + 0x0001017d, + 0x0001017e, + 0x0001017e, + 0x0001017f, + 0x0001017f, + 0x00010180, + 0x00010180, + 0x00010181, + 0x00010181, + 0x00010182, + 0x00010182, + 0x00010183, + 0x00010183, + }, + { + 0x00010184, + 0x00010184, + 0x00010185, + 0x00010185, + 0x00010186, + 0x00010186, + 0x00010187, + 0x00010187, + 0x00010188, + 0x00010188, + 0x00010189, + 0x00010189, + 0x0001018a, + 0x0001018a, + 0x0001018b, + 0x0001018b, + }, + { + 0x0001018c, + 0x0001018c, + 0x0001018d, + 0x0001018d, + 0x0001018e, + 0x0001018e, + 0x0001018f, + 0x0001018f, + 0x00010190, + 0x00010190, + 0x00010191, + 0x00010191, + 0x00010192, + 0x00010192, + 0x00010193, + 0x00010193, + }, + { + 0x00010194, + 0x00010194, + 0x00010195, + 0x00010195, + 0x00010196, + 0x00010196, + 0x00010197, + 0x00010197, + 0x00010198, + 0x00010198, + 0x00010199, + 0x00010199, + 0x0001019a, + 0x0001019a, + 0x0001019b, + 0x0001019b, + }, + { + 0x0001019c, + 0x0001019c, + 0x0001019d, + 0x0001019d, + 0x0001019e, + 0x0001019e, + 0x0001019f, + 0x0001019f, + 0x000101a0, + 0x000101a0, + 0x000101a1, + 0x000101a1, + 0x000101a2, + 0x000101a2, + 0x000101a3, + 0x000101a3, + }, + { + 0x000101a4, + 0x000101a4, + 0x000101a5, + 0x000101a5, + 0x000101a6, + 0x000101a6, + 0x000101a7, + 0x000101a7, + 0x000101a8, + 0x000101a8, + 0x000101a9, + 0x000101a9, + 0x000101aa, + 0x000101aa, + 0x000101ab, + 0x000101ab, + }, + { + 0x000101ac, + 0x000101ac, + 0x000101ad, + 0x000101ad, + 0x000101ae, + 0x000101ae, + 0x000101af, + 0x000101af, + 0x000101b0, + 0x000101b0, + 0x000101b1, + 0x000101b1, + 0x000101b2, + 0x000101b2, + 0x000101b3, + 0x000101b3, + }, + { + 0x000101b4, + 0x000101b4, + 0x000101b5, + 0x000101b5, + 0x000101b6, + 0x000101b6, + 0x000101b7, + 0x000101b7, + 0x000101b8, + 0x000101b8, + 0x000101b9, + 0x000101b9, + 0x000101ba, + 0x000101ba, + 0x000101bb, + 0x000101bb, + }, + { + 0x000101bc, + 0x000101bc, + 0x000101bd, + 0x000101bd, + 0x000101be, + 0x000101be, + 0x000101bf, + 0x000101bf, + 0x000101c0, + 0x000101c0, + 0x000101c1, + 0x000101c1, + 0x000101c2, + 0x000101c2, + 0x000101c3, + 0x000101c3, + }, + { + 0x000101c4, + 0x000101c4, + 0x000101c5, + 0x000101c5, + 0x000101c6, + 0x000101c6, + 0x000101c7, + 0x000101c7, + 0x000101c8, + 0x000101c8, + 0x000101c9, + 0x000101c9, + 0x000101ca, + 0x000101ca, + 0x000101cb, + 0x000101cb, + }, + { + 0x000101cc, + 0x000101cc, + 0x000101cd, + 0x000101cd, + 0x000101ce, + 0x000101ce, + 0x000101cf, + 0x000101cf, + 0x000101d0, + 0x000101d0, + 0x000101d1, + 0x000101d1, + 0x000101d2, + 0x000101d2, + 0x000101d3, + 0x000101d3, + }, + { + 0x000101d4, + 0x000101d4, + 0x000101d5, + 0x000101d5, + 0x000101d6, + 0x000101d6, + 0x000101d7, + 0x000101d7, + 0x000101d8, + 0x000101d8, + 0x000101d9, + 0x000101d9, + 0x000101da, + 0x000101da, + 0x000101db, + 0x000101db, + }, + { + 0x000101dc, + 0x000101dc, + 0x000101dd, + 0x000101dd, + 0x000101de, + 0x000101de, + 0x000101df, + 0x000101df, + 0x000101e0, + 0x000101e0, + 0x000101e1, + 0x000101e1, + 0x000101e2, + 0x000101e2, + 0x000101e3, + 0x000101e3, + }, + { + 0x000101e4, + 0x000101e4, + 0x000101e5, + 0x000101e5, + 0x000101e6, + 0x000101e6, + 0x000101e7, + 0x000101e7, + 0x000101e8, + 0x000101e8, + 0x000101e9, + 0x000101e9, + 0x000101ea, + 0x000101ea, + 0x000101eb, + 0x000101eb, + }, + { + 0x0051ffff, + 0x0052ffff, + 0x0053ffff, + 0x0054ffff, + 0x0055ffff, + 0x0056ffff, + 0x0057ffff, + 0x0058ffff, + 0x0059ffff, + 0x005affff, + 0x005bffff, + 0x005cffff, + 0x005dffff, + 0x005effff, + 0x005fffff, + 0x0060ffff, + }, + { + 0x000101ec, + 0x000101ec, + 0x000101ed, + 0x000101ed, + 0x000101ee, + 0x000101ee, + 0x000101ef, + 0x000101ef, + 0x000101f0, + 0x000101f0, + 0x000101f1, + 0x000101f1, + 0x000101f2, + 0x000101f2, + 0x000101f3, + 0x000101f3, + }, + { + 0x000101f4, + 0x000101f4, + 0x000101f5, + 0x000101f5, + 0x000101f6, + 0x000101f6, + 0x000101f7, + 0x000101f7, + 0x000101f8, + 0x000101f8, + 0x000101f9, + 0x000101f9, + 0x000101fa, + 0x000101fa, + 0x000101fb, + 0x000101fb, + }, + { + 0x000101fc, + 0x000101fc, + 0x000101fd, + 0x000101fd, + 0x000101fe, + 0x000101fe, + 0x000101ff, + 0x000101ff, + 0x00010200, + 0x00010200, + 0x00010201, + 0x00010201, + 0x00010202, + 0x00010202, + 0x00010203, + 0x00010203, + }, + { + 0x00010204, + 0x00010204, + 0x00010205, + 0x00010205, + 0x00010206, + 0x00010206, + 0x00010207, + 0x00010207, + 0x00010208, + 0x00010208, + 0x00010209, + 0x00010209, + 0x0001020a, + 0x0001020a, + 0x0001020b, + 0x0001020b, + }, + { + 0x0001020c, + 0x0001020c, + 0x0001020d, + 0x0001020d, + 0x0001020e, + 0x0001020e, + 0x0001020f, + 0x0001020f, + 0x00010210, + 0x00010210, + 0x00010211, + 0x00010211, + 0x00010212, + 0x00010212, + 0x00010213, + 0x00010213, + }, + { + 0x00010214, + 0x00010214, + 0x00010215, + 0x00010215, + 0x00010216, + 0x00010216, + 0x00010217, + 0x00010217, + 0x00010218, + 0x00010218, + 0x00010219, + 0x00010219, + 0x0001021a, + 0x0001021a, + 0x0001021b, + 0x0001021b, + }, + { + 0x0001021c, + 0x0001021c, + 0x0001021d, + 0x0001021d, + 0x0001021e, + 0x0001021e, + 0x0001021f, + 0x0001021f, + 0x00010220, + 0x00010220, + 0x00010221, + 0x00010221, + 0x00010222, + 0x00010222, + 0x00010223, + 0x00010223, + }, + { + 0x00010224, + 0x00010224, + 0x00010225, + 0x00010225, + 0x00010226, + 0x00010226, + 0x00010227, + 0x00010227, + 0x00010228, + 0x00010228, + 0x00010229, + 0x00010229, + 0x0001022a, + 0x0001022a, + 0x0001022b, + 0x0001022b, + }, + { + 0x0001022c, + 0x0001022c, + 0x0001022d, + 0x0001022d, + 0x0001022e, + 0x0001022e, + 0x0001022f, + 0x0001022f, + 0x00010230, + 0x00010230, + 0x00010231, + 0x00010231, + 0x00010232, + 0x00010232, + 0x00010233, + 0x00010233, + }, + { + 0x00010234, + 0x00010234, + 0x00010235, + 0x00010235, + 0x00010236, + 0x00010236, + 0x00010237, + 0x00010237, + 0x00010238, + 0x00010238, + 0x00010239, + 0x00010239, + 0x0001023a, + 0x0001023a, + 0x0001023b, + 0x0001023b, + }, + { + 0x0001023c, + 0x0001023c, + 0x0001023d, + 0x0001023d, + 0x0001023e, + 0x0001023e, + 0x0001023f, + 0x0001023f, + 0x00010240, + 0x00010240, + 0x00010241, + 0x00010241, + 0x00010242, + 0x00010242, + 0x00010243, + 0x00010243, + }, + { + 0x00010244, + 0x00010244, + 0x00010245, + 0x00010245, + 0x00010246, + 0x00010246, + 0x00010247, + 0x00010247, + 0x00010248, + 0x00010248, + 0x00010249, + 0x00010249, + 0x0001024a, + 0x0001024a, + 0x0001024b, + 0x0001024b, + }, + { + 0x0001024c, + 0x0001024c, + 0x0001024d, + 0x0001024d, + 0x0001024e, + 0x0001024e, + 0x0001024f, + 0x0001024f, + 0x00010250, + 0x00010250, + 0x00010251, + 0x00010251, + 0x00010252, + 0x00010252, + 0x00010253, + 0x00010253, + }, + { + 0x00010254, + 0x00010254, + 0x00010255, + 0x00010255, + 0x00010256, + 0x00010256, + 0x00010257, + 0x00010257, + 0x00010258, + 0x00010258, + 0x00010259, + 0x00010259, + 0x0001025a, + 0x0001025a, + 0x0001025b, + 0x0001025b, + }, + { + 0x0001025c, + 0x0001025c, + 0x0001025d, + 0x0001025d, + 0x0001025e, + 0x0001025e, + 0x0001025f, + 0x0001025f, + 0x00010260, + 0x00010260, + 0x00010261, + 0x00010261, + 0x00010262, + 0x00010262, + 0x00010263, + 0x00010263, + }, + { + 0x00010264, + 0x00010264, + 0x00010265, + 0x00010265, + 0x00010266, + 0x00010266, + 0x00010267, + 0x00010267, + 0x00010268, + 0x00010268, + 0x00010269, + 0x00010269, + 0x0001026a, + 0x0001026a, + 0x0001026b, + 0x0001026b, + }, + { + 0x0001026c, + 0x0001026c, + 0x0001026d, + 0x0001026d, + 0x0001026e, + 0x0001026e, + 0x0001026f, + 0x0001026f, + 0x00010270, + 0x00010270, + 0x00010271, + 0x00010271, + 0x00010272, + 0x00010272, + 0x00010273, + 0x00010273, + }, + { + 0x00010274, + 0x00010274, + 0x00010275, + 0x00010275, + 0x00010276, + 0x00010276, + 0x00010277, + 0x00010277, + 0x00010278, + 0x00010278, + 0x00010279, + 0x00010279, + 0x0001027a, + 0x0001027a, + 0x0001027b, + 0x0001027b, + }, + { + 0x0001027c, + 0x0001027c, + 0x0001027d, + 0x0001027d, + 0x0001027e, + 0x0001027e, + 0x0001027f, + 0x0001027f, + 0x00010280, + 0x00010280, + 0x00010281, + 0x00010281, + 0x00010282, + 0x00010282, + 0x00010283, + 0x00010283, + }, + { + 0x00010284, + 0x00010284, + 0x00010285, + 0x00010285, + 0x00010286, + 0x00010286, + 0x00010287, + 0x00010287, + 0x00010288, + 0x00010288, + 0x00010289, + 0x00010289, + 0x0001028a, + 0x0001028a, + 0x0001028b, + 0x0001028b, + }, + { + 0x0001028c, + 0x0001028c, + 0x0001028d, + 0x0001028d, + 0x0001028e, + 0x0001028e, + 0x0001028f, + 0x0001028f, + 0x00010290, + 0x00010290, + 0x00010291, + 0x00010291, + 0x00010292, + 0x00010292, + 0x00010293, + 0x00010293, + }, + { + 0x00010294, + 0x00010294, + 0x00010295, + 0x00010295, + 0x00010296, + 0x00010296, + 0x00010297, + 0x00010297, + 0x00010298, + 0x00010298, + 0x00010299, + 0x00010299, + 0x0001029a, + 0x0001029a, + 0x0001029b, + 0x0001029b, + }, + { + 0x0001029c, + 0x0001029c, + 0x0001029d, + 0x0001029d, + 0x0001029e, + 0x0001029e, + 0x0001029f, + 0x0001029f, + 0x000102a0, + 0x000102a0, + 0x000102a1, + 0x000102a1, + 0x000102a2, + 0x000102a2, + 0x000102a3, + 0x000102a3, + }, + { + 0x000102a4, + 0x000102a4, + 0x000102a5, + 0x000102a5, + 0x000102a6, + 0x000102a6, + 0x000102a7, + 0x000102a7, + 0x000102a8, + 0x000102a8, + 0x000102a9, + 0x000102a9, + 0x000102aa, + 0x000102aa, + 0x000102ab, + 0x000102ab, + }, + { + 0x000102ac, + 0x000102ac, + 0x000102ad, + 0x000102ad, + 0x000102ae, + 0x000102ae, + 0x000102af, + 0x000102af, + 0x000102b0, + 0x000102b0, + 0x000102b1, + 0x000102b1, + 0x000102b2, + 0x000102b2, + 0x000102b3, + 0x000102b3, + }, + { + 0x000102b4, + 0x000102b4, + 0x000102b5, + 0x000102b5, + 0x000102b6, + 0x000102b6, + 0x000102b7, + 0x000102b7, + 0x000102b8, + 0x000102b8, + 0x000102b9, + 0x000102b9, + 0x000102ba, + 0x000102ba, + 0x000102bb, + 0x000102bb, + }, + { + 0x000102bc, + 0x000102bc, + 0x000102bd, + 0x000102bd, + 0x000102be, + 0x000102be, + 0x000102bf, + 0x000102bf, + 0x000102c0, + 0x000102c0, + 0x000102c1, + 0x000102c1, + 0x000102c2, + 0x000102c2, + 0x000102c3, + 0x000102c3, + }, + { + 0x000102c4, + 0x000102c4, + 0x000102c5, + 0x000102c5, + 0x000102c6, + 0x000102c6, + 0x000102c7, + 0x000102c7, + 0x000102c8, + 0x000102c8, + 0x000102c9, + 0x000102c9, + 0x000102ca, + 0x000102ca, + 0x000102cb, + 0x000102cb, + }, + { + 0x000102cc, + 0x000102cc, + 0x000102cd, + 0x000102cd, + 0x000102ce, + 0x000102ce, + 0x000102cf, + 0x000102cf, + 0x000102d0, + 0x000102d0, + 0x000102d1, + 0x000102d1, + 0x000102d2, + 0x000102d2, + 0x000102d3, + 0x000102d3, + }, }; #endif @@ -3402,217 +35550,2774 @@ const uint32_t c_aauiCQMFHuffEnc49[729][2] = #else const uint16_t c_aauiCQMFHuffEnc49[729][2] = #endif -{ - {0x0002, 0x0003}, {0x0003, 0x0003}, {0x0005, 0x0007}, {0x0007, 0x000a}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0009, 0x0009}, {0x000b, 0x000d}, - {0x000d, 0x0014}, {0x000d, 0x0015}, {0x0010, 0x0052}, {0x0011, 0x0098}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, - {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, - {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0005, 0x0008}, {0x0006, 0x000a}, {0x0007, 0x000b}, - {0x0008, 0x000b}, {0x0008, 0x000c}, {0x000a, 0x000a}, {0x000b, 0x000e}, {0x000d, 0x0016}, {0x000f, 0x0031}, {0x0010, 0x0053}, {0x0012, 0x012a}, - {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, - {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0005, 0x0009}, {0x0005, 0x000a}, - {0x0005, 0x000b}, {0x0006, 0x000b}, {0x0007, 0x000c}, {0x0008, 0x000d}, {0x0009, 0x000a}, {0x000a, 0x000b}, {0x000c, 0x000f}, {0x000d, 0x0017}, - {0x000f, 0x0032}, {0x0010, 0x0054}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, - {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, {0x0013, 0x0028}, {0x0013, 0x0029}, {0x0013, 0x002a}, - {0x0013, 0x002b}, {0x0007, 0x000d}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x000e}, {0x0009, 0x000b}, - {0x000b, 0x000f}, {0x000c, 0x0010}, {0x000e, 0x001d}, {0x000f, 0x0033}, {0x0011, 0x0099}, {0x0013, 0x002c}, {0x0013, 0x002d}, {0x0013, 0x002e}, - {0x0013, 0x002f}, {0x0013, 0x0030}, {0x0013, 0x0031}, {0x0013, 0x0032}, {0x0013, 0x0033}, {0x0013, 0x0034}, {0x0013, 0x0035}, {0x0013, 0x0036}, - {0x0013, 0x0037}, {0x0013, 0x0038}, {0x0013, 0x0039}, {0x0013, 0x003a}, {0x0008, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, - {0x0008, 0x0010}, {0x0009, 0x000c}, {0x000a, 0x000c}, {0x000c, 0x0011}, {0x000d, 0x0018}, {0x000e, 0x001e}, {0x0011, 0x009a}, {0x0011, 0x009b}, - {0x0013, 0x003b}, {0x0013, 0x003c}, {0x0013, 0x003d}, {0x0013, 0x003e}, {0x0013, 0x003f}, {0x0013, 0x0040}, {0x0013, 0x0041}, {0x0013, 0x0042}, - {0x0013, 0x0043}, {0x0013, 0x0044}, {0x0013, 0x0045}, {0x0013, 0x0046}, {0x0013, 0x0047}, {0x0013, 0x0048}, {0x0013, 0x0049}, {0x0008, 0x0011}, - {0x0007, 0x0013}, {0x0008, 0x0012}, {0x0008, 0x0013}, {0x0009, 0x000d}, {0x000a, 0x000d}, {0x000b, 0x0010}, {0x000c, 0x0012}, {0x000e, 0x001f}, - {0x000e, 0x0020}, {0x0010, 0x0055}, {0x0011, 0x009c}, {0x0013, 0x004a}, {0x0013, 0x004b}, {0x0013, 0x004c}, {0x0013, 0x004d}, {0x0013, 0x004e}, - {0x0013, 0x004f}, {0x0013, 0x0050}, {0x0013, 0x0051}, {0x0013, 0x0052}, {0x0013, 0x0053}, {0x0013, 0x0054}, {0x0013, 0x0055}, {0x0013, 0x0056}, - {0x0013, 0x0057}, {0x0013, 0x0058}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x000a, 0x000e}, {0x000b, 0x0011}, - {0x000c, 0x0013}, {0x000d, 0x0019}, {0x000e, 0x0021}, {0x0010, 0x0056}, {0x0010, 0x0057}, {0x0013, 0x0059}, {0x0013, 0x005a}, {0x0013, 0x005b}, - {0x0013, 0x005c}, {0x0013, 0x005d}, {0x0013, 0x005e}, {0x0013, 0x005f}, {0x0013, 0x0060}, {0x0013, 0x0061}, {0x0013, 0x0062}, {0x0013, 0x0063}, - {0x0013, 0x0064}, {0x0013, 0x0065}, {0x0013, 0x0066}, {0x0013, 0x0067}, {0x0013, 0x0068}, {0x000b, 0x0012}, {0x000a, 0x000f}, {0x000a, 0x0010}, - {0x000a, 0x0011}, {0x000c, 0x0014}, {0x000c, 0x0015}, {0x000d, 0x001a}, {0x000e, 0x0022}, {0x0010, 0x0058}, {0x0010, 0x0059}, {0x0013, 0x0069}, - {0x0013, 0x006a}, {0x0013, 0x006b}, {0x0013, 0x006c}, {0x0013, 0x006d}, {0x0013, 0x006e}, {0x0013, 0x006f}, {0x0013, 0x0070}, {0x0013, 0x0071}, - {0x0013, 0x0072}, {0x0013, 0x0073}, {0x0013, 0x0074}, {0x0013, 0x0075}, {0x0013, 0x0076}, {0x0013, 0x0077}, {0x0013, 0x0078}, {0x0013, 0x0079}, - {0x000c, 0x0016}, {0x000b, 0x0013}, {0x000c, 0x0017}, {0x000c, 0x0018}, {0x000c, 0x0019}, {0x000e, 0x0023}, {0x000e, 0x0024}, {0x000f, 0x0034}, - {0x0010, 0x005a}, {0x0011, 0x009d}, {0x0013, 0x007a}, {0x0013, 0x007b}, {0x0013, 0x007c}, {0x0013, 0x007d}, {0x0013, 0x007e}, {0x0013, 0x007f}, - {0x0013, 0x0080}, {0x0013, 0x0081}, {0x0013, 0x0082}, {0x0013, 0x0083}, {0x0013, 0x0084}, {0x0013, 0x0085}, {0x0013, 0x0086}, {0x0013, 0x0087}, - {0x0013, 0x0088}, {0x0013, 0x0089}, {0x0013, 0x008a}, {0x000e, 0x0025}, {0x000d, 0x001b}, {0x000d, 0x001c}, {0x000d, 0x001d}, {0x000e, 0x0026}, - {0x000f, 0x0035}, {0x0010, 0x005b}, {0x0011, 0x009e}, {0x0011, 0x009f}, {0x0012, 0x012b}, {0x0013, 0x008b}, {0x0013, 0x008c}, {0x0013, 0x008d}, - {0x0013, 0x008e}, {0x0013, 0x008f}, {0x0013, 0x0090}, {0x0013, 0x0091}, {0x0013, 0x0092}, {0x0013, 0x0093}, {0x0013, 0x0094}, {0x0013, 0x0095}, - {0x0013, 0x0096}, {0x0013, 0x0097}, {0x0013, 0x0098}, {0x0013, 0x0099}, {0x0013, 0x009a}, {0x0013, 0x009b}, {0x0010, 0x005c}, {0x000f, 0x0036}, - {0x000e, 0x0027}, {0x000f, 0x0037}, {0x000f, 0x0038}, {0x0010, 0x005d}, {0x0011, 0x00a0}, {0x0013, 0x009c}, {0x0012, 0x012c}, {0x0013, 0x009d}, - {0x0013, 0x009e}, {0x0013, 0x009f}, {0x0013, 0x00a0}, {0x0013, 0x00a1}, {0x0013, 0x00a2}, {0x0013, 0x00a3}, {0x0013, 0x00a4}, {0x0013, 0x00a5}, - {0x0013, 0x00a6}, {0x0013, 0x00a7}, {0x0013, 0x00a8}, {0x0013, 0x00a9}, {0x0013, 0x00aa}, {0x0013, 0x00ab}, {0x0013, 0x00ac}, {0x0013, 0x00ad}, - {0x0013, 0x00ae}, {0x0010, 0x005e}, {0x000f, 0x0039}, {0x0010, 0x005f}, {0x0010, 0x0060}, {0x0011, 0x00a1}, {0x0010, 0x0061}, {0x0013, 0x00af}, - {0x0013, 0x00b0}, {0x0012, 0x012d}, {0x0013, 0x00b1}, {0x0013, 0x00b2}, {0x0013, 0x00b3}, {0x0013, 0x00b4}, {0x0013, 0x00b5}, {0x0013, 0x00b6}, - {0x0013, 0x00b7}, {0x0013, 0x00b8}, {0x0013, 0x00b9}, {0x0013, 0x00ba}, {0x0013, 0x00bb}, {0x0013, 0x00bc}, {0x0013, 0x00bd}, {0x0013, 0x00be}, - {0x0013, 0x00bf}, {0x0013, 0x00c0}, {0x0013, 0x00c1}, {0x0013, 0x00c2}, {0x0012, 0x012e}, {0x0011, 0x00a2}, {0x0011, 0x00a3}, {0x0013, 0x00c3}, - {0x0013, 0x00c4}, {0x0013, 0x00c5}, {0x0013, 0x00c6}, {0x0013, 0x00c7}, {0x0013, 0x00c8}, {0x0013, 0x00c9}, {0x0013, 0x00ca}, {0x0013, 0x00cb}, - {0x0013, 0x00cc}, {0x0013, 0x00cd}, {0x0013, 0x00ce}, {0x0013, 0x00cf}, {0x0013, 0x00d0}, {0x0013, 0x00d1}, {0x0013, 0x00d2}, {0x0013, 0x00d3}, - {0x0013, 0x00d4}, {0x0013, 0x00d5}, {0x0013, 0x00d6}, {0x0013, 0x00d7}, {0x0013, 0x00d8}, {0x0013, 0x00d9}, {0x0013, 0x00da}, {0x0013, 0x00db}, - {0x0013, 0x00dc}, {0x0013, 0x00dd}, {0x0013, 0x00de}, {0x0013, 0x00df}, {0x0012, 0x012f}, {0x0013, 0x00e0}, {0x0013, 0x00e1}, {0x0013, 0x00e2}, - {0x0013, 0x00e3}, {0x0013, 0x00e4}, {0x0013, 0x00e5}, {0x0013, 0x00e6}, {0x0013, 0x00e7}, {0x0013, 0x00e8}, {0x0013, 0x00e9}, {0x0013, 0x00ea}, - {0x0013, 0x00eb}, {0x0013, 0x00ec}, {0x0013, 0x00ed}, {0x0013, 0x00ee}, {0x0013, 0x00ef}, {0x0013, 0x00f0}, {0x0013, 0x00f1}, {0x0013, 0x00f2}, - {0x0013, 0x00f3}, {0x0013, 0x00f4}, {0x0013, 0x00f5}, {0x0013, 0x00f6}, {0x0013, 0x00f7}, {0x0013, 0x00f8}, {0x0013, 0x00f9}, {0x0013, 0x00fa}, - {0x0013, 0x00fb}, {0x0013, 0x00fc}, {0x0013, 0x00fd}, {0x0013, 0x00fe}, {0x0013, 0x00ff}, {0x0013, 0x0100}, {0x0013, 0x0101}, {0x0013, 0x0102}, - {0x0013, 0x0103}, {0x0013, 0x0104}, {0x0013, 0x0105}, {0x0013, 0x0106}, {0x0013, 0x0107}, {0x0013, 0x0108}, {0x0013, 0x0109}, {0x0013, 0x010a}, - {0x0013, 0x010b}, {0x0013, 0x010c}, {0x0013, 0x010d}, {0x0013, 0x010e}, {0x0013, 0x010f}, {0x0013, 0x0110}, {0x0013, 0x0111}, {0x0013, 0x0112}, - {0x0013, 0x0113}, {0x0013, 0x0114}, {0x0013, 0x0115}, {0x0013, 0x0116}, {0x0013, 0x0117}, {0x0013, 0x0118}, {0x0013, 0x0119}, {0x0013, 0x011a}, - {0x0013, 0x011b}, {0x0013, 0x011c}, {0x0013, 0x011d}, {0x0013, 0x011e}, {0x0013, 0x011f}, {0x0013, 0x0120}, {0x0013, 0x0121}, {0x0013, 0x0122}, - {0x0013, 0x0123}, {0x0013, 0x0124}, {0x0013, 0x0125}, {0x0013, 0x0126}, {0x0013, 0x0127}, {0x0013, 0x0128}, {0x0013, 0x0129}, {0x0013, 0x012a}, - {0x0013, 0x012b}, {0x0013, 0x012c}, {0x0013, 0x012d}, {0x0013, 0x012e}, {0x0013, 0x012f}, {0x0013, 0x0130}, {0x0013, 0x0131}, {0x0013, 0x0132}, - {0x0013, 0x0133}, {0x0013, 0x0134}, {0x0013, 0x0135}, {0x0013, 0x0136}, {0x0013, 0x0137}, {0x0013, 0x0138}, {0x0013, 0x0139}, {0x0013, 0x013a}, - {0x0013, 0x013b}, {0x0013, 0x013c}, {0x0013, 0x013d}, {0x0013, 0x013e}, {0x0013, 0x013f}, {0x0013, 0x0140}, {0x0013, 0x0141}, {0x0013, 0x0142}, - {0x0013, 0x0143}, {0x0013, 0x0144}, {0x0013, 0x0145}, {0x0013, 0x0146}, {0x0013, 0x0147}, {0x0013, 0x0148}, {0x0013, 0x0149}, {0x0013, 0x014a}, - {0x0013, 0x014b}, {0x0013, 0x014c}, {0x0013, 0x014d}, {0x0013, 0x014e}, {0x0013, 0x014f}, {0x0013, 0x0150}, {0x0013, 0x0151}, {0x0013, 0x0152}, - {0x0013, 0x0153}, {0x0013, 0x0154}, {0x0013, 0x0155}, {0x0013, 0x0156}, {0x0013, 0x0157}, {0x0013, 0x0158}, {0x0013, 0x0159}, {0x0013, 0x015a}, - {0x0013, 0x015b}, {0x0013, 0x015c}, {0x0013, 0x015d}, {0x0013, 0x015e}, {0x0013, 0x015f}, {0x0013, 0x0160}, {0x0013, 0x0161}, {0x0013, 0x0162}, - {0x0013, 0x0163}, {0x0013, 0x0164}, {0x0013, 0x0165}, {0x0013, 0x0166}, {0x0013, 0x0167}, {0x0013, 0x0168}, {0x0013, 0x0169}, {0x0013, 0x016a}, - {0x0013, 0x016b}, {0x0013, 0x016c}, {0x0013, 0x016d}, {0x0013, 0x016e}, {0x0013, 0x016f}, {0x0013, 0x0170}, {0x0013, 0x0171}, {0x0013, 0x0172}, - {0x0013, 0x0173}, {0x0013, 0x0174}, {0x0013, 0x0175}, {0x0013, 0x0176}, {0x0013, 0x0177}, {0x0013, 0x0178}, {0x0013, 0x0179}, {0x0013, 0x017a}, - {0x0013, 0x017b}, {0x0013, 0x017c}, {0x0013, 0x017d}, {0x0013, 0x017e}, {0x0013, 0x017f}, {0x0013, 0x0180}, {0x0013, 0x0181}, {0x0013, 0x0182}, - {0x0013, 0x0183}, {0x0013, 0x0184}, {0x0013, 0x0185}, {0x0013, 0x0186}, {0x0013, 0x0187}, {0x0013, 0x0188}, {0x0013, 0x0189}, {0x0013, 0x018a}, - {0x0013, 0x018b}, {0x0013, 0x018c}, {0x0013, 0x018d}, {0x0013, 0x018e}, {0x0013, 0x018f}, {0x0013, 0x0190}, {0x0013, 0x0191}, {0x0013, 0x0192}, - {0x0013, 0x0193}, {0x0013, 0x0194}, {0x0013, 0x0195}, {0x0013, 0x0196}, {0x0013, 0x0197}, {0x0013, 0x0198}, {0x0013, 0x0199}, {0x0013, 0x019a}, - {0x0013, 0x019b}, {0x0013, 0x019c}, {0x0013, 0x019d}, {0x0013, 0x019e}, {0x0013, 0x019f}, {0x0013, 0x01a0}, {0x0013, 0x01a1}, {0x0013, 0x01a2}, - {0x0013, 0x01a3}, {0x0013, 0x01a4}, {0x0013, 0x01a5}, {0x0013, 0x01a6}, {0x0013, 0x01a7}, {0x0013, 0x01a8}, {0x0013, 0x01a9}, {0x0013, 0x01aa}, - {0x0013, 0x01ab}, {0x0013, 0x01ac}, {0x0013, 0x01ad}, {0x0013, 0x01ae}, {0x0013, 0x01af}, {0x0013, 0x01b0}, {0x0013, 0x01b1}, {0x0013, 0x01b2}, - {0x0013, 0x01b3}, {0x0013, 0x01b4}, {0x0013, 0x01b5}, {0x0013, 0x01b6}, {0x0013, 0x01b7}, {0x0013, 0x01b8}, {0x0013, 0x01b9}, {0x0013, 0x01ba}, - {0x0013, 0x01bb}, {0x0013, 0x01bc}, {0x0013, 0x01bd}, {0x0013, 0x01be}, {0x0013, 0x01bf}, {0x0013, 0x01c0}, {0x0013, 0x01c1}, {0x0013, 0x01c2}, - {0x0013, 0x01c3}, {0x0013, 0x01c4}, {0x0013, 0x01c5}, {0x0013, 0x01c6}, {0x0013, 0x01c7}, {0x0013, 0x01c8}, {0x0013, 0x01c9}, {0x0013, 0x01ca}, - {0x0013, 0x01cb}, {0x0013, 0x01cc}, {0x0013, 0x01cd}, {0x0013, 0x01ce}, {0x0013, 0x01cf}, {0x0013, 0x01d0}, {0x0013, 0x01d1}, {0x0013, 0x01d2}, - {0x0013, 0x01d3}, {0x0013, 0x01d4}, {0x0013, 0x01d5}, {0x0013, 0x01d6}, {0x0013, 0x01d7}, {0x0013, 0x01d8}, {0x0013, 0x01d9}, {0x0013, 0x01da}, - {0x0013, 0x01db}, {0x0013, 0x01dc}, {0x0013, 0x01dd}, {0x0013, 0x01de}, {0x0013, 0x01df}, {0x0013, 0x01e0}, {0x0013, 0x01e1}, {0x0013, 0x01e2}, - {0x0013, 0x01e3}, {0x0013, 0x01e4}, {0x0013, 0x01e5}, {0x0013, 0x01e6}, {0x0013, 0x01e7}, {0x0013, 0x01e8}, {0x0013, 0x01e9}, {0x0013, 0x01ea}, - {0x0013, 0x01eb}, {0x0013, 0x01ec}, {0x0013, 0x01ed}, {0x0013, 0x01ee}, {0x0013, 0x01ef}, {0x0013, 0x01f0}, {0x0013, 0x01f1}, {0x0013, 0x01f2}, - {0x0013, 0x01f3}, {0x0013, 0x01f4}, {0x0013, 0x01f5}, {0x0013, 0x01f6}, {0x0013, 0x01f7}, {0x0013, 0x01f8}, {0x0013, 0x01f9}, {0x0013, 0x01fa}, - {0x0013, 0x01fb}, {0x0013, 0x01fc}, {0x0013, 0x01fd}, {0x0013, 0x01fe}, {0x0013, 0x01ff}, {0x0013, 0x0200}, {0x0013, 0x0201}, {0x0013, 0x0202}, - {0x0013, 0x0203}, {0x0013, 0x0204}, {0x0013, 0x0205}, {0x0013, 0x0206}, {0x0013, 0x0207}, {0x0013, 0x0208}, {0x0013, 0x0209}, {0x0013, 0x020a}, - {0x0013, 0x020b}, {0x0013, 0x020c}, {0x0013, 0x020d}, {0x0013, 0x020e}, {0x0013, 0x020f}, {0x0013, 0x0210}, {0x0013, 0x0211}, {0x0013, 0x0212}, - {0x0013, 0x0213}, {0x0013, 0x0214}, {0x0013, 0x0215}, {0x0013, 0x0216}, {0x0013, 0x0217}, {0x0013, 0x0218}, {0x0013, 0x0219}, {0x0013, 0x021a}, - {0x0013, 0x021b}, {0x0013, 0x021c}, {0x0013, 0x021d}, {0x0013, 0x021e}, {0x0013, 0x021f}, {0x0013, 0x0220}, {0x0013, 0x0221}, {0x0013, 0x0222}, - {0x0013, 0x0223}, {0x0013, 0x0224}, {0x0013, 0x0225}, {0x0013, 0x0226}, {0x0013, 0x0227}, {0x0013, 0x0228}, {0x0013, 0x0229}, {0x0013, 0x022a}, - {0x0013, 0x022b}, {0x0013, 0x022c}, {0x0013, 0x022d}, {0x0013, 0x022e}, {0x0013, 0x022f}, {0x0013, 0x0230}, {0x0013, 0x0231}, {0x0013, 0x0232}, - {0x0013, 0x0233}, {0x0013, 0x0234}, {0x0013, 0x0235}, {0x0013, 0x0236}, {0x0013, 0x0237}, {0x0013, 0x0238}, {0x0013, 0x0239}, {0x0013, 0x023a}, - {0x0013, 0x023b}, {0x0013, 0x023c}, {0x0013, 0x023d}, {0x0013, 0x023e}, {0x0013, 0x023f}, {0x0013, 0x0240}, {0x0013, 0x0241}, {0x0013, 0x0242}, - {0x0013, 0x0243}, {0x0013, 0x0244}, {0x0013, 0x0245}, {0x0013, 0x0246}, {0x0013, 0x0247}, {0x0013, 0x0248}, {0x0013, 0x0249}, {0x0013, 0x024a}, - {0x0013, 0x024b}, {0x0013, 0x024c}, {0x0013, 0x024d}, {0x0013, 0x024e}, {0x0013, 0x024f}, {0x0013, 0x0250}, {0x0013, 0x0251}, {0x0013, 0x0252}, - {0x0013, 0x0253}, + { + { 0x0002, 0x0003 }, + { 0x0003, 0x0003 }, + { 0x0005, 0x0007 }, + { 0x0007, 0x000a }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0009, 0x0009 }, + { 0x000b, 0x000d }, + { 0x000d, 0x0014 }, + { 0x000d, 0x0015 }, + { 0x0010, 0x0052 }, + { 0x0011, 0x0098 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0005, 0x0008 }, + { 0x0006, 0x000a }, + { 0x0007, 0x000b }, + { 0x0008, 0x000b }, + { 0x0008, 0x000c }, + { 0x000a, 0x000a }, + { 0x000b, 0x000e }, + { 0x000d, 0x0016 }, + { 0x000f, 0x0031 }, + { 0x0010, 0x0053 }, + { 0x0012, 0x012a }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0006, 0x000b }, + { 0x0007, 0x000c }, + { 0x0008, 0x000d }, + { 0x0009, 0x000a }, + { 0x000a, 0x000b }, + { 0x000c, 0x000f }, + { 0x000d, 0x0017 }, + { 0x000f, 0x0032 }, + { 0x0010, 0x0054 }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, + { 0x0013, 0x0028 }, + { 0x0013, 0x0029 }, + { 0x0013, 0x002a }, + { 0x0013, 0x002b }, + { 0x0007, 0x000d }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0008, 0x000e }, + { 0x0009, 0x000b }, + { 0x000b, 0x000f }, + { 0x000c, 0x0010 }, + { 0x000e, 0x001d }, + { 0x000f, 0x0033 }, + { 0x0011, 0x0099 }, + { 0x0013, 0x002c }, + { 0x0013, 0x002d }, + { 0x0013, 0x002e }, + { 0x0013, 0x002f }, + { 0x0013, 0x0030 }, + { 0x0013, 0x0031 }, + { 0x0013, 0x0032 }, + { 0x0013, 0x0033 }, + { 0x0013, 0x0034 }, + { 0x0013, 0x0035 }, + { 0x0013, 0x0036 }, + { 0x0013, 0x0037 }, + { 0x0013, 0x0038 }, + { 0x0013, 0x0039 }, + { 0x0013, 0x003a }, + { 0x0008, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0007, 0x0012 }, + { 0x0008, 0x0010 }, + { 0x0009, 0x000c }, + { 0x000a, 0x000c }, + { 0x000c, 0x0011 }, + { 0x000d, 0x0018 }, + { 0x000e, 0x001e }, + { 0x0011, 0x009a }, + { 0x0011, 0x009b }, + { 0x0013, 0x003b }, + { 0x0013, 0x003c }, + { 0x0013, 0x003d }, + { 0x0013, 0x003e }, + { 0x0013, 0x003f }, + { 0x0013, 0x0040 }, + { 0x0013, 0x0041 }, + { 0x0013, 0x0042 }, + { 0x0013, 0x0043 }, + { 0x0013, 0x0044 }, + { 0x0013, 0x0045 }, + { 0x0013, 0x0046 }, + { 0x0013, 0x0047 }, + { 0x0013, 0x0048 }, + { 0x0013, 0x0049 }, + { 0x0008, 0x0011 }, + { 0x0007, 0x0013 }, + { 0x0008, 0x0012 }, + { 0x0008, 0x0013 }, + { 0x0009, 0x000d }, + { 0x000a, 0x000d }, + { 0x000b, 0x0010 }, + { 0x000c, 0x0012 }, + { 0x000e, 0x001f }, + { 0x000e, 0x0020 }, + { 0x0010, 0x0055 }, + { 0x0011, 0x009c }, + { 0x0013, 0x004a }, + { 0x0013, 0x004b }, + { 0x0013, 0x004c }, + { 0x0013, 0x004d }, + { 0x0013, 0x004e }, + { 0x0013, 0x004f }, + { 0x0013, 0x0050 }, + { 0x0013, 0x0051 }, + { 0x0013, 0x0052 }, + { 0x0013, 0x0053 }, + { 0x0013, 0x0054 }, + { 0x0013, 0x0055 }, + { 0x0013, 0x0056 }, + { 0x0013, 0x0057 }, + { 0x0013, 0x0058 }, + { 0x0009, 0x000e }, + { 0x0009, 0x000f }, + { 0x0009, 0x0010 }, + { 0x0009, 0x0011 }, + { 0x000a, 0x000e }, + { 0x000b, 0x0011 }, + { 0x000c, 0x0013 }, + { 0x000d, 0x0019 }, + { 0x000e, 0x0021 }, + { 0x0010, 0x0056 }, + { 0x0010, 0x0057 }, + { 0x0013, 0x0059 }, + { 0x0013, 0x005a }, + { 0x0013, 0x005b }, + { 0x0013, 0x005c }, + { 0x0013, 0x005d }, + { 0x0013, 0x005e }, + { 0x0013, 0x005f }, + { 0x0013, 0x0060 }, + { 0x0013, 0x0061 }, + { 0x0013, 0x0062 }, + { 0x0013, 0x0063 }, + { 0x0013, 0x0064 }, + { 0x0013, 0x0065 }, + { 0x0013, 0x0066 }, + { 0x0013, 0x0067 }, + { 0x0013, 0x0068 }, + { 0x000b, 0x0012 }, + { 0x000a, 0x000f }, + { 0x000a, 0x0010 }, + { 0x000a, 0x0011 }, + { 0x000c, 0x0014 }, + { 0x000c, 0x0015 }, + { 0x000d, 0x001a }, + { 0x000e, 0x0022 }, + { 0x0010, 0x0058 }, + { 0x0010, 0x0059 }, + { 0x0013, 0x0069 }, + { 0x0013, 0x006a }, + { 0x0013, 0x006b }, + { 0x0013, 0x006c }, + { 0x0013, 0x006d }, + { 0x0013, 0x006e }, + { 0x0013, 0x006f }, + { 0x0013, 0x0070 }, + { 0x0013, 0x0071 }, + { 0x0013, 0x0072 }, + { 0x0013, 0x0073 }, + { 0x0013, 0x0074 }, + { 0x0013, 0x0075 }, + { 0x0013, 0x0076 }, + { 0x0013, 0x0077 }, + { 0x0013, 0x0078 }, + { 0x0013, 0x0079 }, + { 0x000c, 0x0016 }, + { 0x000b, 0x0013 }, + { 0x000c, 0x0017 }, + { 0x000c, 0x0018 }, + { 0x000c, 0x0019 }, + { 0x000e, 0x0023 }, + { 0x000e, 0x0024 }, + { 0x000f, 0x0034 }, + { 0x0010, 0x005a }, + { 0x0011, 0x009d }, + { 0x0013, 0x007a }, + { 0x0013, 0x007b }, + { 0x0013, 0x007c }, + { 0x0013, 0x007d }, + { 0x0013, 0x007e }, + { 0x0013, 0x007f }, + { 0x0013, 0x0080 }, + { 0x0013, 0x0081 }, + { 0x0013, 0x0082 }, + { 0x0013, 0x0083 }, + { 0x0013, 0x0084 }, + { 0x0013, 0x0085 }, + { 0x0013, 0x0086 }, + { 0x0013, 0x0087 }, + { 0x0013, 0x0088 }, + { 0x0013, 0x0089 }, + { 0x0013, 0x008a }, + { 0x000e, 0x0025 }, + { 0x000d, 0x001b }, + { 0x000d, 0x001c }, + { 0x000d, 0x001d }, + { 0x000e, 0x0026 }, + { 0x000f, 0x0035 }, + { 0x0010, 0x005b }, + { 0x0011, 0x009e }, + { 0x0011, 0x009f }, + { 0x0012, 0x012b }, + { 0x0013, 0x008b }, + { 0x0013, 0x008c }, + { 0x0013, 0x008d }, + { 0x0013, 0x008e }, + { 0x0013, 0x008f }, + { 0x0013, 0x0090 }, + { 0x0013, 0x0091 }, + { 0x0013, 0x0092 }, + { 0x0013, 0x0093 }, + { 0x0013, 0x0094 }, + { 0x0013, 0x0095 }, + { 0x0013, 0x0096 }, + { 0x0013, 0x0097 }, + { 0x0013, 0x0098 }, + { 0x0013, 0x0099 }, + { 0x0013, 0x009a }, + { 0x0013, 0x009b }, + { 0x0010, 0x005c }, + { 0x000f, 0x0036 }, + { 0x000e, 0x0027 }, + { 0x000f, 0x0037 }, + { 0x000f, 0x0038 }, + { 0x0010, 0x005d }, + { 0x0011, 0x00a0 }, + { 0x0013, 0x009c }, + { 0x0012, 0x012c }, + { 0x0013, 0x009d }, + { 0x0013, 0x009e }, + { 0x0013, 0x009f }, + { 0x0013, 0x00a0 }, + { 0x0013, 0x00a1 }, + { 0x0013, 0x00a2 }, + { 0x0013, 0x00a3 }, + { 0x0013, 0x00a4 }, + { 0x0013, 0x00a5 }, + { 0x0013, 0x00a6 }, + { 0x0013, 0x00a7 }, + { 0x0013, 0x00a8 }, + { 0x0013, 0x00a9 }, + { 0x0013, 0x00aa }, + { 0x0013, 0x00ab }, + { 0x0013, 0x00ac }, + { 0x0013, 0x00ad }, + { 0x0013, 0x00ae }, + { 0x0010, 0x005e }, + { 0x000f, 0x0039 }, + { 0x0010, 0x005f }, + { 0x0010, 0x0060 }, + { 0x0011, 0x00a1 }, + { 0x0010, 0x0061 }, + { 0x0013, 0x00af }, + { 0x0013, 0x00b0 }, + { 0x0012, 0x012d }, + { 0x0013, 0x00b1 }, + { 0x0013, 0x00b2 }, + { 0x0013, 0x00b3 }, + { 0x0013, 0x00b4 }, + { 0x0013, 0x00b5 }, + { 0x0013, 0x00b6 }, + { 0x0013, 0x00b7 }, + { 0x0013, 0x00b8 }, + { 0x0013, 0x00b9 }, + { 0x0013, 0x00ba }, + { 0x0013, 0x00bb }, + { 0x0013, 0x00bc }, + { 0x0013, 0x00bd }, + { 0x0013, 0x00be }, + { 0x0013, 0x00bf }, + { 0x0013, 0x00c0 }, + { 0x0013, 0x00c1 }, + { 0x0013, 0x00c2 }, + { 0x0012, 0x012e }, + { 0x0011, 0x00a2 }, + { 0x0011, 0x00a3 }, + { 0x0013, 0x00c3 }, + { 0x0013, 0x00c4 }, + { 0x0013, 0x00c5 }, + { 0x0013, 0x00c6 }, + { 0x0013, 0x00c7 }, + { 0x0013, 0x00c8 }, + { 0x0013, 0x00c9 }, + { 0x0013, 0x00ca }, + { 0x0013, 0x00cb }, + { 0x0013, 0x00cc }, + { 0x0013, 0x00cd }, + { 0x0013, 0x00ce }, + { 0x0013, 0x00cf }, + { 0x0013, 0x00d0 }, + { 0x0013, 0x00d1 }, + { 0x0013, 0x00d2 }, + { 0x0013, 0x00d3 }, + { 0x0013, 0x00d4 }, + { 0x0013, 0x00d5 }, + { 0x0013, 0x00d6 }, + { 0x0013, 0x00d7 }, + { 0x0013, 0x00d8 }, + { 0x0013, 0x00d9 }, + { 0x0013, 0x00da }, + { 0x0013, 0x00db }, + { 0x0013, 0x00dc }, + { 0x0013, 0x00dd }, + { 0x0013, 0x00de }, + { 0x0013, 0x00df }, + { 0x0012, 0x012f }, + { 0x0013, 0x00e0 }, + { 0x0013, 0x00e1 }, + { 0x0013, 0x00e2 }, + { 0x0013, 0x00e3 }, + { 0x0013, 0x00e4 }, + { 0x0013, 0x00e5 }, + { 0x0013, 0x00e6 }, + { 0x0013, 0x00e7 }, + { 0x0013, 0x00e8 }, + { 0x0013, 0x00e9 }, + { 0x0013, 0x00ea }, + { 0x0013, 0x00eb }, + { 0x0013, 0x00ec }, + { 0x0013, 0x00ed }, + { 0x0013, 0x00ee }, + { 0x0013, 0x00ef }, + { 0x0013, 0x00f0 }, + { 0x0013, 0x00f1 }, + { 0x0013, 0x00f2 }, + { 0x0013, 0x00f3 }, + { 0x0013, 0x00f4 }, + { 0x0013, 0x00f5 }, + { 0x0013, 0x00f6 }, + { 0x0013, 0x00f7 }, + { 0x0013, 0x00f8 }, + { 0x0013, 0x00f9 }, + { 0x0013, 0x00fa }, + { 0x0013, 0x00fb }, + { 0x0013, 0x00fc }, + { 0x0013, 0x00fd }, + { 0x0013, 0x00fe }, + { 0x0013, 0x00ff }, + { 0x0013, 0x0100 }, + { 0x0013, 0x0101 }, + { 0x0013, 0x0102 }, + { 0x0013, 0x0103 }, + { 0x0013, 0x0104 }, + { 0x0013, 0x0105 }, + { 0x0013, 0x0106 }, + { 0x0013, 0x0107 }, + { 0x0013, 0x0108 }, + { 0x0013, 0x0109 }, + { 0x0013, 0x010a }, + { 0x0013, 0x010b }, + { 0x0013, 0x010c }, + { 0x0013, 0x010d }, + { 0x0013, 0x010e }, + { 0x0013, 0x010f }, + { 0x0013, 0x0110 }, + { 0x0013, 0x0111 }, + { 0x0013, 0x0112 }, + { 0x0013, 0x0113 }, + { 0x0013, 0x0114 }, + { 0x0013, 0x0115 }, + { 0x0013, 0x0116 }, + { 0x0013, 0x0117 }, + { 0x0013, 0x0118 }, + { 0x0013, 0x0119 }, + { 0x0013, 0x011a }, + { 0x0013, 0x011b }, + { 0x0013, 0x011c }, + { 0x0013, 0x011d }, + { 0x0013, 0x011e }, + { 0x0013, 0x011f }, + { 0x0013, 0x0120 }, + { 0x0013, 0x0121 }, + { 0x0013, 0x0122 }, + { 0x0013, 0x0123 }, + { 0x0013, 0x0124 }, + { 0x0013, 0x0125 }, + { 0x0013, 0x0126 }, + { 0x0013, 0x0127 }, + { 0x0013, 0x0128 }, + { 0x0013, 0x0129 }, + { 0x0013, 0x012a }, + { 0x0013, 0x012b }, + { 0x0013, 0x012c }, + { 0x0013, 0x012d }, + { 0x0013, 0x012e }, + { 0x0013, 0x012f }, + { 0x0013, 0x0130 }, + { 0x0013, 0x0131 }, + { 0x0013, 0x0132 }, + { 0x0013, 0x0133 }, + { 0x0013, 0x0134 }, + { 0x0013, 0x0135 }, + { 0x0013, 0x0136 }, + { 0x0013, 0x0137 }, + { 0x0013, 0x0138 }, + { 0x0013, 0x0139 }, + { 0x0013, 0x013a }, + { 0x0013, 0x013b }, + { 0x0013, 0x013c }, + { 0x0013, 0x013d }, + { 0x0013, 0x013e }, + { 0x0013, 0x013f }, + { 0x0013, 0x0140 }, + { 0x0013, 0x0141 }, + { 0x0013, 0x0142 }, + { 0x0013, 0x0143 }, + { 0x0013, 0x0144 }, + { 0x0013, 0x0145 }, + { 0x0013, 0x0146 }, + { 0x0013, 0x0147 }, + { 0x0013, 0x0148 }, + { 0x0013, 0x0149 }, + { 0x0013, 0x014a }, + { 0x0013, 0x014b }, + { 0x0013, 0x014c }, + { 0x0013, 0x014d }, + { 0x0013, 0x014e }, + { 0x0013, 0x014f }, + { 0x0013, 0x0150 }, + { 0x0013, 0x0151 }, + { 0x0013, 0x0152 }, + { 0x0013, 0x0153 }, + { 0x0013, 0x0154 }, + { 0x0013, 0x0155 }, + { 0x0013, 0x0156 }, + { 0x0013, 0x0157 }, + { 0x0013, 0x0158 }, + { 0x0013, 0x0159 }, + { 0x0013, 0x015a }, + { 0x0013, 0x015b }, + { 0x0013, 0x015c }, + { 0x0013, 0x015d }, + { 0x0013, 0x015e }, + { 0x0013, 0x015f }, + { 0x0013, 0x0160 }, + { 0x0013, 0x0161 }, + { 0x0013, 0x0162 }, + { 0x0013, 0x0163 }, + { 0x0013, 0x0164 }, + { 0x0013, 0x0165 }, + { 0x0013, 0x0166 }, + { 0x0013, 0x0167 }, + { 0x0013, 0x0168 }, + { 0x0013, 0x0169 }, + { 0x0013, 0x016a }, + { 0x0013, 0x016b }, + { 0x0013, 0x016c }, + { 0x0013, 0x016d }, + { 0x0013, 0x016e }, + { 0x0013, 0x016f }, + { 0x0013, 0x0170 }, + { 0x0013, 0x0171 }, + { 0x0013, 0x0172 }, + { 0x0013, 0x0173 }, + { 0x0013, 0x0174 }, + { 0x0013, 0x0175 }, + { 0x0013, 0x0176 }, + { 0x0013, 0x0177 }, + { 0x0013, 0x0178 }, + { 0x0013, 0x0179 }, + { 0x0013, 0x017a }, + { 0x0013, 0x017b }, + { 0x0013, 0x017c }, + { 0x0013, 0x017d }, + { 0x0013, 0x017e }, + { 0x0013, 0x017f }, + { 0x0013, 0x0180 }, + { 0x0013, 0x0181 }, + { 0x0013, 0x0182 }, + { 0x0013, 0x0183 }, + { 0x0013, 0x0184 }, + { 0x0013, 0x0185 }, + { 0x0013, 0x0186 }, + { 0x0013, 0x0187 }, + { 0x0013, 0x0188 }, + { 0x0013, 0x0189 }, + { 0x0013, 0x018a }, + { 0x0013, 0x018b }, + { 0x0013, 0x018c }, + { 0x0013, 0x018d }, + { 0x0013, 0x018e }, + { 0x0013, 0x018f }, + { 0x0013, 0x0190 }, + { 0x0013, 0x0191 }, + { 0x0013, 0x0192 }, + { 0x0013, 0x0193 }, + { 0x0013, 0x0194 }, + { 0x0013, 0x0195 }, + { 0x0013, 0x0196 }, + { 0x0013, 0x0197 }, + { 0x0013, 0x0198 }, + { 0x0013, 0x0199 }, + { 0x0013, 0x019a }, + { 0x0013, 0x019b }, + { 0x0013, 0x019c }, + { 0x0013, 0x019d }, + { 0x0013, 0x019e }, + { 0x0013, 0x019f }, + { 0x0013, 0x01a0 }, + { 0x0013, 0x01a1 }, + { 0x0013, 0x01a2 }, + { 0x0013, 0x01a3 }, + { 0x0013, 0x01a4 }, + { 0x0013, 0x01a5 }, + { 0x0013, 0x01a6 }, + { 0x0013, 0x01a7 }, + { 0x0013, 0x01a8 }, + { 0x0013, 0x01a9 }, + { 0x0013, 0x01aa }, + { 0x0013, 0x01ab }, + { 0x0013, 0x01ac }, + { 0x0013, 0x01ad }, + { 0x0013, 0x01ae }, + { 0x0013, 0x01af }, + { 0x0013, 0x01b0 }, + { 0x0013, 0x01b1 }, + { 0x0013, 0x01b2 }, + { 0x0013, 0x01b3 }, + { 0x0013, 0x01b4 }, + { 0x0013, 0x01b5 }, + { 0x0013, 0x01b6 }, + { 0x0013, 0x01b7 }, + { 0x0013, 0x01b8 }, + { 0x0013, 0x01b9 }, + { 0x0013, 0x01ba }, + { 0x0013, 0x01bb }, + { 0x0013, 0x01bc }, + { 0x0013, 0x01bd }, + { 0x0013, 0x01be }, + { 0x0013, 0x01bf }, + { 0x0013, 0x01c0 }, + { 0x0013, 0x01c1 }, + { 0x0013, 0x01c2 }, + { 0x0013, 0x01c3 }, + { 0x0013, 0x01c4 }, + { 0x0013, 0x01c5 }, + { 0x0013, 0x01c6 }, + { 0x0013, 0x01c7 }, + { 0x0013, 0x01c8 }, + { 0x0013, 0x01c9 }, + { 0x0013, 0x01ca }, + { 0x0013, 0x01cb }, + { 0x0013, 0x01cc }, + { 0x0013, 0x01cd }, + { 0x0013, 0x01ce }, + { 0x0013, 0x01cf }, + { 0x0013, 0x01d0 }, + { 0x0013, 0x01d1 }, + { 0x0013, 0x01d2 }, + { 0x0013, 0x01d3 }, + { 0x0013, 0x01d4 }, + { 0x0013, 0x01d5 }, + { 0x0013, 0x01d6 }, + { 0x0013, 0x01d7 }, + { 0x0013, 0x01d8 }, + { 0x0013, 0x01d9 }, + { 0x0013, 0x01da }, + { 0x0013, 0x01db }, + { 0x0013, 0x01dc }, + { 0x0013, 0x01dd }, + { 0x0013, 0x01de }, + { 0x0013, 0x01df }, + { 0x0013, 0x01e0 }, + { 0x0013, 0x01e1 }, + { 0x0013, 0x01e2 }, + { 0x0013, 0x01e3 }, + { 0x0013, 0x01e4 }, + { 0x0013, 0x01e5 }, + { 0x0013, 0x01e6 }, + { 0x0013, 0x01e7 }, + { 0x0013, 0x01e8 }, + { 0x0013, 0x01e9 }, + { 0x0013, 0x01ea }, + { 0x0013, 0x01eb }, + { 0x0013, 0x01ec }, + { 0x0013, 0x01ed }, + { 0x0013, 0x01ee }, + { 0x0013, 0x01ef }, + { 0x0013, 0x01f0 }, + { 0x0013, 0x01f1 }, + { 0x0013, 0x01f2 }, + { 0x0013, 0x01f3 }, + { 0x0013, 0x01f4 }, + { 0x0013, 0x01f5 }, + { 0x0013, 0x01f6 }, + { 0x0013, 0x01f7 }, + { 0x0013, 0x01f8 }, + { 0x0013, 0x01f9 }, + { 0x0013, 0x01fa }, + { 0x0013, 0x01fb }, + { 0x0013, 0x01fc }, + { 0x0013, 0x01fd }, + { 0x0013, 0x01fe }, + { 0x0013, 0x01ff }, + { 0x0013, 0x0200 }, + { 0x0013, 0x0201 }, + { 0x0013, 0x0202 }, + { 0x0013, 0x0203 }, + { 0x0013, 0x0204 }, + { 0x0013, 0x0205 }, + { 0x0013, 0x0206 }, + { 0x0013, 0x0207 }, + { 0x0013, 0x0208 }, + { 0x0013, 0x0209 }, + { 0x0013, 0x020a }, + { 0x0013, 0x020b }, + { 0x0013, 0x020c }, + { 0x0013, 0x020d }, + { 0x0013, 0x020e }, + { 0x0013, 0x020f }, + { 0x0013, 0x0210 }, + { 0x0013, 0x0211 }, + { 0x0013, 0x0212 }, + { 0x0013, 0x0213 }, + { 0x0013, 0x0214 }, + { 0x0013, 0x0215 }, + { 0x0013, 0x0216 }, + { 0x0013, 0x0217 }, + { 0x0013, 0x0218 }, + { 0x0013, 0x0219 }, + { 0x0013, 0x021a }, + { 0x0013, 0x021b }, + { 0x0013, 0x021c }, + { 0x0013, 0x021d }, + { 0x0013, 0x021e }, + { 0x0013, 0x021f }, + { 0x0013, 0x0220 }, + { 0x0013, 0x0221 }, + { 0x0013, 0x0222 }, + { 0x0013, 0x0223 }, + { 0x0013, 0x0224 }, + { 0x0013, 0x0225 }, + { 0x0013, 0x0226 }, + { 0x0013, 0x0227 }, + { 0x0013, 0x0228 }, + { 0x0013, 0x0229 }, + { 0x0013, 0x022a }, + { 0x0013, 0x022b }, + { 0x0013, 0x022c }, + { 0x0013, 0x022d }, + { 0x0013, 0x022e }, + { 0x0013, 0x022f }, + { 0x0013, 0x0230 }, + { 0x0013, 0x0231 }, + { 0x0013, 0x0232 }, + { 0x0013, 0x0233 }, + { 0x0013, 0x0234 }, + { 0x0013, 0x0235 }, + { 0x0013, 0x0236 }, + { 0x0013, 0x0237 }, + { 0x0013, 0x0238 }, + { 0x0013, 0x0239 }, + { 0x0013, 0x023a }, + { 0x0013, 0x023b }, + { 0x0013, 0x023c }, + { 0x0013, 0x023d }, + { 0x0013, 0x023e }, + { 0x0013, 0x023f }, + { 0x0013, 0x0240 }, + { 0x0013, 0x0241 }, + { 0x0013, 0x0242 }, + { 0x0013, 0x0243 }, + { 0x0013, 0x0244 }, + { 0x0013, 0x0245 }, + { 0x0013, 0x0246 }, + { 0x0013, 0x0247 }, + { 0x0013, 0x0248 }, + { 0x0013, 0x0249 }, + { 0x0013, 0x024a }, + { 0x0013, 0x024b }, + { 0x0013, 0x024c }, + { 0x0013, 0x024d }, + { 0x0013, 0x024e }, + { 0x0013, 0x024f }, + { 0x0013, 0x0250 }, + { 0x0013, 0x0251 }, + { 0x0013, 0x0252 }, + { 0x0013, 0x0253 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec49[113][16] = -{ - {0x0006ffff, 0x0005ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00010001, 0x00010001, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020000, 0x00020000, 0x00020000, 0x00020000, }, - {0x00020052, 0x00020052, 0x00020052, 0x00020052, 0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, 0x00030002, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, - {0x0001006d, 0x0001006d, 0x0001006e, 0x0001006e, 0x0001006f, 0x0001006f, 0x00010088, 0x00010088, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x00000070, 0x00000087, 0x00000089, 0x0000008a, 0x00010003, 0x00010003, 0x0001001f, 0x0001001f, 0x0001003a, 0x0001003a, 0x00010051, 0x00010051, 0x00010054, 0x00010054, 0x00010055, 0x00010055, }, - {0x000fffff, 0x000effff, 0x000cffff, 0x000dffff, 0x0007ffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x00000004, 0x00000005, 0x00000020, 0x00000021, 0x0000003b, 0x00000056, 0x0000006c, }, - {0x000200bf, 0x000200bf, 0x000200bf, 0x000200bf, 0x000200c0, 0x000200c0, 0x000200c0, 0x000200c0, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x0003003c, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, }, - {0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x00030071, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, 0x0003008b, }, - {0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a2, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, 0x000300a3, }, - {0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a4, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, 0x000300a5, }, - {0x0001008d, 0x0001008d, 0x000100a7, 0x000100a7, 0x000100bd, 0x000100bd, 0x000100d9, 0x000100d9, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, }, - {0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200a6, 0x000200be, 0x000200be, 0x000200be, 0x000200be, }, - {0x00000059, 0x00000073, 0x0000008e, 0x000000a8, 0x000000c1, 0x000000c2, 0x000000d8, 0x000000da, 0x000000db, 0x000000dc, 0x00010007, 0x00010007, 0x00010023, 0x00010023, 0x00010058, 0x00010058, }, - {0x0023ffff, 0x0034ffff, 0x0045ffff, 0x0056ffff, 0x001affff, 0x0019ffff, 0x0018ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0011ffff, 0x0010ffff, 0x0012ffff, 0x0013ffff, 0x0014ffff, 0x0000003e, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x00030074, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, 0x000300a9, }, - {0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300c3, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, 0x000300f4, }, - {0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f5, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, 0x000300f6, }, - {0x00010112, 0x00010112, 0x0001012a, 0x0001012a, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, }, - {0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200aa, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200c4, 0x000200dd, 0x000200dd, 0x000200dd, 0x000200dd, }, - {0x000200de, 0x000200de, 0x000200de, 0x000200de, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f3, 0x000200f7, 0x000200f7, 0x000200f7, 0x000200f7, 0x00020110, 0x00020110, 0x00020110, 0x00020110, }, - {0x0000012c, 0x0000012e, 0x00010025, 0x00010025, 0x00010040, 0x00010040, 0x0001005b, 0x0001005b, 0x000100df, 0x000100df, 0x000100f8, 0x000100f8, 0x0001010f, 0x0001010f, 0x00010111, 0x00010111, }, - {0x001fffff, 0x0020ffff, 0x0000000a, 0x00000026, 0x00000041, 0x00000091, 0x000000ab, 0x000000ac, 0x000000c5, 0x000000c6, 0x000000e0, 0x000000f9, 0x0000010e, 0x00000113, 0x00000129, 0x0000012b, }, - {0x0067ffff, 0x0068ffff, 0x0069ffff, 0x006affff, 0x006bffff, 0x006cffff, 0x006dffff, 0x006effff, 0x006fffff, 0x0070ffff, 0x0021ffff, 0x0022ffff, 0x001cffff, 0x001bffff, 0x001dffff, 0x001effff, }, - {0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030076, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, 0x00030077, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, 0x0003005c, }, - {0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x00030092, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, 0x000300e1, }, - {0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fa, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, 0x000300fb, }, - {0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x00030114, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, 0x0003012d, }, - {0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030145, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, 0x00030146, }, - {0x000102d5, 0x000102d5, 0x000102d6, 0x000102d6, 0x000102d7, 0x000102d7, 0x000102d8, 0x000102d8, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x000200fc, 0x000200fc, 0x000200fc, 0x000200fc, }, - {0x00020116, 0x00020116, 0x00020116, 0x00020116, 0x00020131, 0x00020131, 0x00020131, 0x00020131, 0x00020144, 0x00020144, 0x00020144, 0x00020144, 0x00020164, 0x00020164, 0x00020164, 0x00020164, }, - {0x0025ffff, 0x0026ffff, 0x0028ffff, 0x002affff, 0x002effff, 0x0029ffff, 0x0027ffff, 0x0033ffff, 0x002dffff, 0x0024ffff, 0x002bffff, 0x002cffff, 0x002fffff, 0x0030ffff, 0x0031ffff, 0x0032ffff, }, - {0x00010085, 0x00010085, 0x00010086, 0x00010086, 0x00010093, 0x00010093, 0x00010094, 0x00010094, 0x00010095, 0x00010095, 0x00010096, 0x00010096, 0x00010097, 0x00010097, 0x00010098, 0x00010098, }, - {0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, - {0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x00010028, 0x00010028, }, - {0x00010061, 0x00010061, 0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, }, - {0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, }, - {0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, }, - {0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, }, - {0x00010099, 0x00010099, 0x0001009a, 0x0001009a, 0x0001009b, 0x0001009b, 0x0001009c, 0x0001009c, 0x0001009d, 0x0001009d, 0x0001009e, 0x0001009e, 0x0001009f, 0x0001009f, 0x000100a0, 0x000100a0, }, - {0x000100a1, 0x000100a1, 0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, }, - {0x0001007d, 0x0001007d, 0x0001007e, 0x0001007e, 0x0001007f, 0x0001007f, 0x00010080, 0x00010080, 0x00010081, 0x00010081, 0x00010082, 0x00010082, 0x00010083, 0x00010083, 0x00010084, 0x00010084, }, - {0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, }, - {0x000100b4, 0x000100b4, 0x000100b5, 0x000100b5, 0x000100b6, 0x000100b6, 0x000100b7, 0x000100b7, 0x000100b8, 0x000100b8, 0x000100b9, 0x000100b9, 0x000100ba, 0x000100ba, 0x000100bb, 0x000100bb, }, - {0x000100bc, 0x000100bc, 0x000100c7, 0x000100c7, 0x000100c8, 0x000100c8, 0x000100c9, 0x000100c9, 0x000100ca, 0x000100ca, 0x000100cb, 0x000100cb, 0x000100cc, 0x000100cc, 0x000100cd, 0x000100cd, }, - {0x000100ce, 0x000100ce, 0x000100cf, 0x000100cf, 0x000100d0, 0x000100d0, 0x000100d1, 0x000100d1, 0x000100d2, 0x000100d2, 0x000100d3, 0x000100d3, 0x000100d4, 0x000100d4, 0x000100d5, 0x000100d5, }, - {0x000100d6, 0x000100d6, 0x000100d7, 0x000100d7, 0x000100e2, 0x000100e2, 0x000100e3, 0x000100e3, 0x000100e4, 0x000100e4, 0x000100e5, 0x000100e5, 0x000100e6, 0x000100e6, 0x000100e7, 0x000100e7, }, - {0x00010069, 0x00010069, 0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x00010078, 0x00010078, 0x00010079, 0x00010079, 0x0001007a, 0x0001007a, 0x0001007b, 0x0001007b, 0x0001007c, 0x0001007c, }, - {0x0035ffff, 0x0036ffff, 0x0037ffff, 0x0038ffff, 0x0039ffff, 0x003affff, 0x003bffff, 0x003cffff, 0x003dffff, 0x003effff, 0x003fffff, 0x0040ffff, 0x0041ffff, 0x0042ffff, 0x0043ffff, 0x0044ffff, }, - {0x000100e8, 0x000100e8, 0x000100e9, 0x000100e9, 0x000100ea, 0x000100ea, 0x000100eb, 0x000100eb, 0x000100ec, 0x000100ec, 0x000100ed, 0x000100ed, 0x000100ee, 0x000100ee, 0x000100ef, 0x000100ef, }, - {0x000100f0, 0x000100f0, 0x000100f1, 0x000100f1, 0x000100f2, 0x000100f2, 0x000100fd, 0x000100fd, 0x000100fe, 0x000100fe, 0x000100ff, 0x000100ff, 0x00010100, 0x00010100, 0x00010101, 0x00010101, }, - {0x00010102, 0x00010102, 0x00010103, 0x00010103, 0x00010104, 0x00010104, 0x00010105, 0x00010105, 0x00010106, 0x00010106, 0x00010107, 0x00010107, 0x00010108, 0x00010108, 0x00010109, 0x00010109, }, - {0x0001010a, 0x0001010a, 0x0001010b, 0x0001010b, 0x0001010c, 0x0001010c, 0x0001010d, 0x0001010d, 0x00010115, 0x00010115, 0x00010117, 0x00010117, 0x00010118, 0x00010118, 0x00010119, 0x00010119, }, - {0x0001011a, 0x0001011a, 0x0001011b, 0x0001011b, 0x0001011c, 0x0001011c, 0x0001011d, 0x0001011d, 0x0001011e, 0x0001011e, 0x0001011f, 0x0001011f, 0x00010120, 0x00010120, 0x00010121, 0x00010121, }, - {0x00010122, 0x00010122, 0x00010123, 0x00010123, 0x00010124, 0x00010124, 0x00010125, 0x00010125, 0x00010126, 0x00010126, 0x00010127, 0x00010127, 0x00010128, 0x00010128, 0x0001012f, 0x0001012f, }, - {0x00010130, 0x00010130, 0x00010132, 0x00010132, 0x00010133, 0x00010133, 0x00010134, 0x00010134, 0x00010135, 0x00010135, 0x00010136, 0x00010136, 0x00010137, 0x00010137, 0x00010138, 0x00010138, }, - {0x00010139, 0x00010139, 0x0001013a, 0x0001013a, 0x0001013b, 0x0001013b, 0x0001013c, 0x0001013c, 0x0001013d, 0x0001013d, 0x0001013e, 0x0001013e, 0x0001013f, 0x0001013f, 0x00010140, 0x00010140, }, - {0x00010141, 0x00010141, 0x00010142, 0x00010142, 0x00010143, 0x00010143, 0x00010147, 0x00010147, 0x00010148, 0x00010148, 0x00010149, 0x00010149, 0x0001014a, 0x0001014a, 0x0001014b, 0x0001014b, }, - {0x0001014c, 0x0001014c, 0x0001014d, 0x0001014d, 0x0001014e, 0x0001014e, 0x0001014f, 0x0001014f, 0x00010150, 0x00010150, 0x00010151, 0x00010151, 0x00010152, 0x00010152, 0x00010153, 0x00010153, }, - {0x00010154, 0x00010154, 0x00010155, 0x00010155, 0x00010156, 0x00010156, 0x00010157, 0x00010157, 0x00010158, 0x00010158, 0x00010159, 0x00010159, 0x0001015a, 0x0001015a, 0x0001015b, 0x0001015b, }, - {0x0001015c, 0x0001015c, 0x0001015d, 0x0001015d, 0x0001015e, 0x0001015e, 0x0001015f, 0x0001015f, 0x00010160, 0x00010160, 0x00010161, 0x00010161, 0x00010162, 0x00010162, 0x00010163, 0x00010163, }, - {0x00010165, 0x00010165, 0x00010166, 0x00010166, 0x00010167, 0x00010167, 0x00010168, 0x00010168, 0x00010169, 0x00010169, 0x0001016a, 0x0001016a, 0x0001016b, 0x0001016b, 0x0001016c, 0x0001016c, }, - {0x0001016d, 0x0001016d, 0x0001016e, 0x0001016e, 0x0001016f, 0x0001016f, 0x00010170, 0x00010170, 0x00010171, 0x00010171, 0x00010172, 0x00010172, 0x00010173, 0x00010173, 0x00010174, 0x00010174, }, - {0x00010175, 0x00010175, 0x00010176, 0x00010176, 0x00010177, 0x00010177, 0x00010178, 0x00010178, 0x00010179, 0x00010179, 0x0001017a, 0x0001017a, 0x0001017b, 0x0001017b, 0x0001017c, 0x0001017c, }, - {0x0001017d, 0x0001017d, 0x0001017e, 0x0001017e, 0x0001017f, 0x0001017f, 0x00010180, 0x00010180, 0x00010181, 0x00010181, 0x00010182, 0x00010182, 0x00010183, 0x00010183, 0x00010184, 0x00010184, }, - {0x0046ffff, 0x0047ffff, 0x0048ffff, 0x0049ffff, 0x004affff, 0x004bffff, 0x004cffff, 0x004dffff, 0x004effff, 0x004fffff, 0x0050ffff, 0x0051ffff, 0x0052ffff, 0x0053ffff, 0x0054ffff, 0x0055ffff, }, - {0x00010185, 0x00010185, 0x00010186, 0x00010186, 0x00010187, 0x00010187, 0x00010188, 0x00010188, 0x00010189, 0x00010189, 0x0001018a, 0x0001018a, 0x0001018b, 0x0001018b, 0x0001018c, 0x0001018c, }, - {0x0001018d, 0x0001018d, 0x0001018e, 0x0001018e, 0x0001018f, 0x0001018f, 0x00010190, 0x00010190, 0x00010191, 0x00010191, 0x00010192, 0x00010192, 0x00010193, 0x00010193, 0x00010194, 0x00010194, }, - {0x00010195, 0x00010195, 0x00010196, 0x00010196, 0x00010197, 0x00010197, 0x00010198, 0x00010198, 0x00010199, 0x00010199, 0x0001019a, 0x0001019a, 0x0001019b, 0x0001019b, 0x0001019c, 0x0001019c, }, - {0x0001019d, 0x0001019d, 0x0001019e, 0x0001019e, 0x0001019f, 0x0001019f, 0x000101a0, 0x000101a0, 0x000101a1, 0x000101a1, 0x000101a2, 0x000101a2, 0x000101a3, 0x000101a3, 0x000101a4, 0x000101a4, }, - {0x000101a5, 0x000101a5, 0x000101a6, 0x000101a6, 0x000101a7, 0x000101a7, 0x000101a8, 0x000101a8, 0x000101a9, 0x000101a9, 0x000101aa, 0x000101aa, 0x000101ab, 0x000101ab, 0x000101ac, 0x000101ac, }, - {0x000101ad, 0x000101ad, 0x000101ae, 0x000101ae, 0x000101af, 0x000101af, 0x000101b0, 0x000101b0, 0x000101b1, 0x000101b1, 0x000101b2, 0x000101b2, 0x000101b3, 0x000101b3, 0x000101b4, 0x000101b4, }, - {0x000101b5, 0x000101b5, 0x000101b6, 0x000101b6, 0x000101b7, 0x000101b7, 0x000101b8, 0x000101b8, 0x000101b9, 0x000101b9, 0x000101ba, 0x000101ba, 0x000101bb, 0x000101bb, 0x000101bc, 0x000101bc, }, - {0x000101bd, 0x000101bd, 0x000101be, 0x000101be, 0x000101bf, 0x000101bf, 0x000101c0, 0x000101c0, 0x000101c1, 0x000101c1, 0x000101c2, 0x000101c2, 0x000101c3, 0x000101c3, 0x000101c4, 0x000101c4, }, - {0x000101c5, 0x000101c5, 0x000101c6, 0x000101c6, 0x000101c7, 0x000101c7, 0x000101c8, 0x000101c8, 0x000101c9, 0x000101c9, 0x000101ca, 0x000101ca, 0x000101cb, 0x000101cb, 0x000101cc, 0x000101cc, }, - {0x000101cd, 0x000101cd, 0x000101ce, 0x000101ce, 0x000101cf, 0x000101cf, 0x000101d0, 0x000101d0, 0x000101d1, 0x000101d1, 0x000101d2, 0x000101d2, 0x000101d3, 0x000101d3, 0x000101d4, 0x000101d4, }, - {0x000101d5, 0x000101d5, 0x000101d6, 0x000101d6, 0x000101d7, 0x000101d7, 0x000101d8, 0x000101d8, 0x000101d9, 0x000101d9, 0x000101da, 0x000101da, 0x000101db, 0x000101db, 0x000101dc, 0x000101dc, }, - {0x000101dd, 0x000101dd, 0x000101de, 0x000101de, 0x000101df, 0x000101df, 0x000101e0, 0x000101e0, 0x000101e1, 0x000101e1, 0x000101e2, 0x000101e2, 0x000101e3, 0x000101e3, 0x000101e4, 0x000101e4, }, - {0x000101e5, 0x000101e5, 0x000101e6, 0x000101e6, 0x000101e7, 0x000101e7, 0x000101e8, 0x000101e8, 0x000101e9, 0x000101e9, 0x000101ea, 0x000101ea, 0x000101eb, 0x000101eb, 0x000101ec, 0x000101ec, }, - {0x000101ed, 0x000101ed, 0x000101ee, 0x000101ee, 0x000101ef, 0x000101ef, 0x000101f0, 0x000101f0, 0x000101f1, 0x000101f1, 0x000101f2, 0x000101f2, 0x000101f3, 0x000101f3, 0x000101f4, 0x000101f4, }, - {0x000101f5, 0x000101f5, 0x000101f6, 0x000101f6, 0x000101f7, 0x000101f7, 0x000101f8, 0x000101f8, 0x000101f9, 0x000101f9, 0x000101fa, 0x000101fa, 0x000101fb, 0x000101fb, 0x000101fc, 0x000101fc, }, - {0x000101fd, 0x000101fd, 0x000101fe, 0x000101fe, 0x000101ff, 0x000101ff, 0x00010200, 0x00010200, 0x00010201, 0x00010201, 0x00010202, 0x00010202, 0x00010203, 0x00010203, 0x00010204, 0x00010204, }, - {0x0057ffff, 0x0058ffff, 0x0059ffff, 0x005affff, 0x005bffff, 0x005cffff, 0x005dffff, 0x005effff, 0x005fffff, 0x0060ffff, 0x0061ffff, 0x0062ffff, 0x0063ffff, 0x0064ffff, 0x0065ffff, 0x0066ffff, }, - {0x00010205, 0x00010205, 0x00010206, 0x00010206, 0x00010207, 0x00010207, 0x00010208, 0x00010208, 0x00010209, 0x00010209, 0x0001020a, 0x0001020a, 0x0001020b, 0x0001020b, 0x0001020c, 0x0001020c, }, - {0x0001020d, 0x0001020d, 0x0001020e, 0x0001020e, 0x0001020f, 0x0001020f, 0x00010210, 0x00010210, 0x00010211, 0x00010211, 0x00010212, 0x00010212, 0x00010213, 0x00010213, 0x00010214, 0x00010214, }, - {0x00010215, 0x00010215, 0x00010216, 0x00010216, 0x00010217, 0x00010217, 0x00010218, 0x00010218, 0x00010219, 0x00010219, 0x0001021a, 0x0001021a, 0x0001021b, 0x0001021b, 0x0001021c, 0x0001021c, }, - {0x0001021d, 0x0001021d, 0x0001021e, 0x0001021e, 0x0001021f, 0x0001021f, 0x00010220, 0x00010220, 0x00010221, 0x00010221, 0x00010222, 0x00010222, 0x00010223, 0x00010223, 0x00010224, 0x00010224, }, - {0x00010225, 0x00010225, 0x00010226, 0x00010226, 0x00010227, 0x00010227, 0x00010228, 0x00010228, 0x00010229, 0x00010229, 0x0001022a, 0x0001022a, 0x0001022b, 0x0001022b, 0x0001022c, 0x0001022c, }, - {0x0001022d, 0x0001022d, 0x0001022e, 0x0001022e, 0x0001022f, 0x0001022f, 0x00010230, 0x00010230, 0x00010231, 0x00010231, 0x00010232, 0x00010232, 0x00010233, 0x00010233, 0x00010234, 0x00010234, }, - {0x00010235, 0x00010235, 0x00010236, 0x00010236, 0x00010237, 0x00010237, 0x00010238, 0x00010238, 0x00010239, 0x00010239, 0x0001023a, 0x0001023a, 0x0001023b, 0x0001023b, 0x0001023c, 0x0001023c, }, - {0x0001023d, 0x0001023d, 0x0001023e, 0x0001023e, 0x0001023f, 0x0001023f, 0x00010240, 0x00010240, 0x00010241, 0x00010241, 0x00010242, 0x00010242, 0x00010243, 0x00010243, 0x00010244, 0x00010244, }, - {0x00010245, 0x00010245, 0x00010246, 0x00010246, 0x00010247, 0x00010247, 0x00010248, 0x00010248, 0x00010249, 0x00010249, 0x0001024a, 0x0001024a, 0x0001024b, 0x0001024b, 0x0001024c, 0x0001024c, }, - {0x0001024d, 0x0001024d, 0x0001024e, 0x0001024e, 0x0001024f, 0x0001024f, 0x00010250, 0x00010250, 0x00010251, 0x00010251, 0x00010252, 0x00010252, 0x00010253, 0x00010253, 0x00010254, 0x00010254, }, - {0x00010255, 0x00010255, 0x00010256, 0x00010256, 0x00010257, 0x00010257, 0x00010258, 0x00010258, 0x00010259, 0x00010259, 0x0001025a, 0x0001025a, 0x0001025b, 0x0001025b, 0x0001025c, 0x0001025c, }, - {0x0001025d, 0x0001025d, 0x0001025e, 0x0001025e, 0x0001025f, 0x0001025f, 0x00010260, 0x00010260, 0x00010261, 0x00010261, 0x00010262, 0x00010262, 0x00010263, 0x00010263, 0x00010264, 0x00010264, }, - {0x00010265, 0x00010265, 0x00010266, 0x00010266, 0x00010267, 0x00010267, 0x00010268, 0x00010268, 0x00010269, 0x00010269, 0x0001026a, 0x0001026a, 0x0001026b, 0x0001026b, 0x0001026c, 0x0001026c, }, - {0x0001026d, 0x0001026d, 0x0001026e, 0x0001026e, 0x0001026f, 0x0001026f, 0x00010270, 0x00010270, 0x00010271, 0x00010271, 0x00010272, 0x00010272, 0x00010273, 0x00010273, 0x00010274, 0x00010274, }, - {0x00010275, 0x00010275, 0x00010276, 0x00010276, 0x00010277, 0x00010277, 0x00010278, 0x00010278, 0x00010279, 0x00010279, 0x0001027a, 0x0001027a, 0x0001027b, 0x0001027b, 0x0001027c, 0x0001027c, }, - {0x0001027d, 0x0001027d, 0x0001027e, 0x0001027e, 0x0001027f, 0x0001027f, 0x00010280, 0x00010280, 0x00010281, 0x00010281, 0x00010282, 0x00010282, 0x00010283, 0x00010283, 0x00010284, 0x00010284, }, - {0x00010285, 0x00010285, 0x00010286, 0x00010286, 0x00010287, 0x00010287, 0x00010288, 0x00010288, 0x00010289, 0x00010289, 0x0001028a, 0x0001028a, 0x0001028b, 0x0001028b, 0x0001028c, 0x0001028c, }, - {0x0001028d, 0x0001028d, 0x0001028e, 0x0001028e, 0x0001028f, 0x0001028f, 0x00010290, 0x00010290, 0x00010291, 0x00010291, 0x00010292, 0x00010292, 0x00010293, 0x00010293, 0x00010294, 0x00010294, }, - {0x00010295, 0x00010295, 0x00010296, 0x00010296, 0x00010297, 0x00010297, 0x00010298, 0x00010298, 0x00010299, 0x00010299, 0x0001029a, 0x0001029a, 0x0001029b, 0x0001029b, 0x0001029c, 0x0001029c, }, - {0x0001029d, 0x0001029d, 0x0001029e, 0x0001029e, 0x0001029f, 0x0001029f, 0x000102a0, 0x000102a0, 0x000102a1, 0x000102a1, 0x000102a2, 0x000102a2, 0x000102a3, 0x000102a3, 0x000102a4, 0x000102a4, }, - {0x000102a5, 0x000102a5, 0x000102a6, 0x000102a6, 0x000102a7, 0x000102a7, 0x000102a8, 0x000102a8, 0x000102a9, 0x000102a9, 0x000102aa, 0x000102aa, 0x000102ab, 0x000102ab, 0x000102ac, 0x000102ac, }, - {0x000102ad, 0x000102ad, 0x000102ae, 0x000102ae, 0x000102af, 0x000102af, 0x000102b0, 0x000102b0, 0x000102b1, 0x000102b1, 0x000102b2, 0x000102b2, 0x000102b3, 0x000102b3, 0x000102b4, 0x000102b4, }, - {0x000102b5, 0x000102b5, 0x000102b6, 0x000102b6, 0x000102b7, 0x000102b7, 0x000102b8, 0x000102b8, 0x000102b9, 0x000102b9, 0x000102ba, 0x000102ba, 0x000102bb, 0x000102bb, 0x000102bc, 0x000102bc, }, - {0x000102bd, 0x000102bd, 0x000102be, 0x000102be, 0x000102bf, 0x000102bf, 0x000102c0, 0x000102c0, 0x000102c1, 0x000102c1, 0x000102c2, 0x000102c2, 0x000102c3, 0x000102c3, 0x000102c4, 0x000102c4, }, - {0x000102c5, 0x000102c5, 0x000102c6, 0x000102c6, 0x000102c7, 0x000102c7, 0x000102c8, 0x000102c8, 0x000102c9, 0x000102c9, 0x000102ca, 0x000102ca, 0x000102cb, 0x000102cb, 0x000102cc, 0x000102cc, }, - {0x000102cd, 0x000102cd, 0x000102ce, 0x000102ce, 0x000102cf, 0x000102cf, 0x000102d0, 0x000102d0, 0x000102d1, 0x000102d1, 0x000102d2, 0x000102d2, 0x000102d3, 0x000102d3, 0x000102d4, 0x000102d4, }, +const uint32_t c_aauiCQMFHuffDec49[113][16] = { + { + 0x0006ffff, + 0x0005ffff, + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x00010001, + 0x00010001, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + }, + { + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + 0x00030002, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + }, + { + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + }, + { + 0x0001006d, + 0x0001006d, + 0x0001006e, + 0x0001006e, + 0x0001006f, + 0x0001006f, + 0x00010088, + 0x00010088, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x00000070, + 0x00000087, + 0x00000089, + 0x0000008a, + 0x00010003, + 0x00010003, + 0x0001001f, + 0x0001001f, + 0x0001003a, + 0x0001003a, + 0x00010051, + 0x00010051, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + }, + { + 0x000fffff, + 0x000effff, + 0x000cffff, + 0x000dffff, + 0x0007ffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x00000004, + 0x00000005, + 0x00000020, + 0x00000021, + 0x0000003b, + 0x00000056, + 0x0000006c, + }, + { + 0x000200bf, + 0x000200bf, + 0x000200bf, + 0x000200bf, + 0x000200c0, + 0x000200c0, + 0x000200c0, + 0x000200c0, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x0003003c, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + }, + { + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x00030071, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + 0x0003008b, + }, + { + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a2, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + 0x000300a3, + }, + { + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a4, + 0x000300a5, + 0x000300a5, + 0x000300a5, + 0x000300a5, + 0x000300a5, + 0x000300a5, + 0x000300a5, + 0x000300a5, + }, + { + 0x0001008d, + 0x0001008d, + 0x000100a7, + 0x000100a7, + 0x000100bd, + 0x000100bd, + 0x000100d9, + 0x000100d9, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + }, + { + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020072, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200a6, + 0x000200be, + 0x000200be, + 0x000200be, + 0x000200be, + }, + { + 0x00000059, + 0x00000073, + 0x0000008e, + 0x000000a8, + 0x000000c1, + 0x000000c2, + 0x000000d8, + 0x000000da, + 0x000000db, + 0x000000dc, + 0x00010007, + 0x00010007, + 0x00010023, + 0x00010023, + 0x00010058, + 0x00010058, + }, + { + 0x0023ffff, + 0x0034ffff, + 0x0045ffff, + 0x0056ffff, + 0x001affff, + 0x0019ffff, + 0x0018ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0011ffff, + 0x0010ffff, + 0x0012ffff, + 0x0013ffff, + 0x0014ffff, + 0x0000003e, + }, + { + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x00030074, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + 0x000300a9, + }, + { + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300c3, + 0x000300f4, + 0x000300f4, + 0x000300f4, + 0x000300f4, + 0x000300f4, + 0x000300f4, + 0x000300f4, + 0x000300f4, + }, + { + 0x000300f5, + 0x000300f5, + 0x000300f5, + 0x000300f5, + 0x000300f5, + 0x000300f5, + 0x000300f5, + 0x000300f5, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + 0x000300f6, + }, + { + 0x00010112, + 0x00010112, + 0x0001012a, + 0x0001012a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x0002008f, + }, + { + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020090, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200aa, + 0x000200c4, + 0x000200c4, + 0x000200c4, + 0x000200c4, + 0x000200dd, + 0x000200dd, + 0x000200dd, + 0x000200dd, + }, + { + 0x000200de, + 0x000200de, + 0x000200de, + 0x000200de, + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f3, + 0x000200f7, + 0x000200f7, + 0x000200f7, + 0x000200f7, + 0x00020110, + 0x00020110, + 0x00020110, + 0x00020110, + }, + { + 0x0000012c, + 0x0000012e, + 0x00010025, + 0x00010025, + 0x00010040, + 0x00010040, + 0x0001005b, + 0x0001005b, + 0x000100df, + 0x000100df, + 0x000100f8, + 0x000100f8, + 0x0001010f, + 0x0001010f, + 0x00010111, + 0x00010111, + }, + { + 0x001fffff, + 0x0020ffff, + 0x0000000a, + 0x00000026, + 0x00000041, + 0x00000091, + 0x000000ab, + 0x000000ac, + 0x000000c5, + 0x000000c6, + 0x000000e0, + 0x000000f9, + 0x0000010e, + 0x00000113, + 0x00000129, + 0x0000012b, + }, + { + 0x0067ffff, + 0x0068ffff, + 0x0069ffff, + 0x006affff, + 0x006bffff, + 0x006cffff, + 0x006dffff, + 0x006effff, + 0x006fffff, + 0x0070ffff, + 0x0021ffff, + 0x0022ffff, + 0x001cffff, + 0x001bffff, + 0x001dffff, + 0x001effff, + }, + { + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030076, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + 0x00030077, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + 0x0003005c, + }, + { + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x00030092, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + 0x000300e1, + }, + { + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fa, + 0x000300fb, + 0x000300fb, + 0x000300fb, + 0x000300fb, + 0x000300fb, + 0x000300fb, + 0x000300fb, + 0x000300fb, + }, + { + 0x00030114, + 0x00030114, + 0x00030114, + 0x00030114, + 0x00030114, + 0x00030114, + 0x00030114, + 0x00030114, + 0x0003012d, + 0x0003012d, + 0x0003012d, + 0x0003012d, + 0x0003012d, + 0x0003012d, + 0x0003012d, + 0x0003012d, + }, + { + 0x00030145, + 0x00030145, + 0x00030145, + 0x00030145, + 0x00030145, + 0x00030145, + 0x00030145, + 0x00030145, + 0x00030146, + 0x00030146, + 0x00030146, + 0x00030146, + 0x00030146, + 0x00030146, + 0x00030146, + 0x00030146, + }, + { + 0x000102d5, + 0x000102d5, + 0x000102d6, + 0x000102d6, + 0x000102d7, + 0x000102d7, + 0x000102d8, + 0x000102d8, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x000200fc, + 0x000200fc, + 0x000200fc, + 0x000200fc, + }, + { + 0x00020116, + 0x00020116, + 0x00020116, + 0x00020116, + 0x00020131, + 0x00020131, + 0x00020131, + 0x00020131, + 0x00020144, + 0x00020144, + 0x00020144, + 0x00020144, + 0x00020164, + 0x00020164, + 0x00020164, + 0x00020164, + }, + { + 0x0025ffff, + 0x0026ffff, + 0x0028ffff, + 0x002affff, + 0x002effff, + 0x0029ffff, + 0x0027ffff, + 0x0033ffff, + 0x002dffff, + 0x0024ffff, + 0x002bffff, + 0x002cffff, + 0x002fffff, + 0x0030ffff, + 0x0031ffff, + 0x0032ffff, + }, + { + 0x00010085, + 0x00010085, + 0x00010086, + 0x00010086, + 0x00010093, + 0x00010093, + 0x00010094, + 0x00010094, + 0x00010095, + 0x00010095, + 0x00010096, + 0x00010096, + 0x00010097, + 0x00010097, + 0x00010098, + 0x00010098, + }, + { + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + }, + { + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x00010028, + 0x00010028, + }, + { + 0x00010061, + 0x00010061, + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + }, + { + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + }, + { + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + }, + { + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + }, + { + 0x00010099, + 0x00010099, + 0x0001009a, + 0x0001009a, + 0x0001009b, + 0x0001009b, + 0x0001009c, + 0x0001009c, + 0x0001009d, + 0x0001009d, + 0x0001009e, + 0x0001009e, + 0x0001009f, + 0x0001009f, + 0x000100a0, + 0x000100a0, + }, + { + 0x000100a1, + 0x000100a1, + 0x000100ad, + 0x000100ad, + 0x000100ae, + 0x000100ae, + 0x000100af, + 0x000100af, + 0x000100b0, + 0x000100b0, + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + }, + { + 0x0001007d, + 0x0001007d, + 0x0001007e, + 0x0001007e, + 0x0001007f, + 0x0001007f, + 0x00010080, + 0x00010080, + 0x00010081, + 0x00010081, + 0x00010082, + 0x00010082, + 0x00010083, + 0x00010083, + 0x00010084, + 0x00010084, + }, + { + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + }, + { + 0x000100b4, + 0x000100b4, + 0x000100b5, + 0x000100b5, + 0x000100b6, + 0x000100b6, + 0x000100b7, + 0x000100b7, + 0x000100b8, + 0x000100b8, + 0x000100b9, + 0x000100b9, + 0x000100ba, + 0x000100ba, + 0x000100bb, + 0x000100bb, + }, + { + 0x000100bc, + 0x000100bc, + 0x000100c7, + 0x000100c7, + 0x000100c8, + 0x000100c8, + 0x000100c9, + 0x000100c9, + 0x000100ca, + 0x000100ca, + 0x000100cb, + 0x000100cb, + 0x000100cc, + 0x000100cc, + 0x000100cd, + 0x000100cd, + }, + { + 0x000100ce, + 0x000100ce, + 0x000100cf, + 0x000100cf, + 0x000100d0, + 0x000100d0, + 0x000100d1, + 0x000100d1, + 0x000100d2, + 0x000100d2, + 0x000100d3, + 0x000100d3, + 0x000100d4, + 0x000100d4, + 0x000100d5, + 0x000100d5, + }, + { + 0x000100d6, + 0x000100d6, + 0x000100d7, + 0x000100d7, + 0x000100e2, + 0x000100e2, + 0x000100e3, + 0x000100e3, + 0x000100e4, + 0x000100e4, + 0x000100e5, + 0x000100e5, + 0x000100e6, + 0x000100e6, + 0x000100e7, + 0x000100e7, + }, + { + 0x00010069, + 0x00010069, + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + 0x00010078, + 0x00010078, + 0x00010079, + 0x00010079, + 0x0001007a, + 0x0001007a, + 0x0001007b, + 0x0001007b, + 0x0001007c, + 0x0001007c, + }, + { + 0x0035ffff, + 0x0036ffff, + 0x0037ffff, + 0x0038ffff, + 0x0039ffff, + 0x003affff, + 0x003bffff, + 0x003cffff, + 0x003dffff, + 0x003effff, + 0x003fffff, + 0x0040ffff, + 0x0041ffff, + 0x0042ffff, + 0x0043ffff, + 0x0044ffff, + }, + { + 0x000100e8, + 0x000100e8, + 0x000100e9, + 0x000100e9, + 0x000100ea, + 0x000100ea, + 0x000100eb, + 0x000100eb, + 0x000100ec, + 0x000100ec, + 0x000100ed, + 0x000100ed, + 0x000100ee, + 0x000100ee, + 0x000100ef, + 0x000100ef, + }, + { + 0x000100f0, + 0x000100f0, + 0x000100f1, + 0x000100f1, + 0x000100f2, + 0x000100f2, + 0x000100fd, + 0x000100fd, + 0x000100fe, + 0x000100fe, + 0x000100ff, + 0x000100ff, + 0x00010100, + 0x00010100, + 0x00010101, + 0x00010101, + }, + { + 0x00010102, + 0x00010102, + 0x00010103, + 0x00010103, + 0x00010104, + 0x00010104, + 0x00010105, + 0x00010105, + 0x00010106, + 0x00010106, + 0x00010107, + 0x00010107, + 0x00010108, + 0x00010108, + 0x00010109, + 0x00010109, + }, + { + 0x0001010a, + 0x0001010a, + 0x0001010b, + 0x0001010b, + 0x0001010c, + 0x0001010c, + 0x0001010d, + 0x0001010d, + 0x00010115, + 0x00010115, + 0x00010117, + 0x00010117, + 0x00010118, + 0x00010118, + 0x00010119, + 0x00010119, + }, + { + 0x0001011a, + 0x0001011a, + 0x0001011b, + 0x0001011b, + 0x0001011c, + 0x0001011c, + 0x0001011d, + 0x0001011d, + 0x0001011e, + 0x0001011e, + 0x0001011f, + 0x0001011f, + 0x00010120, + 0x00010120, + 0x00010121, + 0x00010121, + }, + { + 0x00010122, + 0x00010122, + 0x00010123, + 0x00010123, + 0x00010124, + 0x00010124, + 0x00010125, + 0x00010125, + 0x00010126, + 0x00010126, + 0x00010127, + 0x00010127, + 0x00010128, + 0x00010128, + 0x0001012f, + 0x0001012f, + }, + { + 0x00010130, + 0x00010130, + 0x00010132, + 0x00010132, + 0x00010133, + 0x00010133, + 0x00010134, + 0x00010134, + 0x00010135, + 0x00010135, + 0x00010136, + 0x00010136, + 0x00010137, + 0x00010137, + 0x00010138, + 0x00010138, + }, + { + 0x00010139, + 0x00010139, + 0x0001013a, + 0x0001013a, + 0x0001013b, + 0x0001013b, + 0x0001013c, + 0x0001013c, + 0x0001013d, + 0x0001013d, + 0x0001013e, + 0x0001013e, + 0x0001013f, + 0x0001013f, + 0x00010140, + 0x00010140, + }, + { + 0x00010141, + 0x00010141, + 0x00010142, + 0x00010142, + 0x00010143, + 0x00010143, + 0x00010147, + 0x00010147, + 0x00010148, + 0x00010148, + 0x00010149, + 0x00010149, + 0x0001014a, + 0x0001014a, + 0x0001014b, + 0x0001014b, + }, + { + 0x0001014c, + 0x0001014c, + 0x0001014d, + 0x0001014d, + 0x0001014e, + 0x0001014e, + 0x0001014f, + 0x0001014f, + 0x00010150, + 0x00010150, + 0x00010151, + 0x00010151, + 0x00010152, + 0x00010152, + 0x00010153, + 0x00010153, + }, + { + 0x00010154, + 0x00010154, + 0x00010155, + 0x00010155, + 0x00010156, + 0x00010156, + 0x00010157, + 0x00010157, + 0x00010158, + 0x00010158, + 0x00010159, + 0x00010159, + 0x0001015a, + 0x0001015a, + 0x0001015b, + 0x0001015b, + }, + { + 0x0001015c, + 0x0001015c, + 0x0001015d, + 0x0001015d, + 0x0001015e, + 0x0001015e, + 0x0001015f, + 0x0001015f, + 0x00010160, + 0x00010160, + 0x00010161, + 0x00010161, + 0x00010162, + 0x00010162, + 0x00010163, + 0x00010163, + }, + { + 0x00010165, + 0x00010165, + 0x00010166, + 0x00010166, + 0x00010167, + 0x00010167, + 0x00010168, + 0x00010168, + 0x00010169, + 0x00010169, + 0x0001016a, + 0x0001016a, + 0x0001016b, + 0x0001016b, + 0x0001016c, + 0x0001016c, + }, + { + 0x0001016d, + 0x0001016d, + 0x0001016e, + 0x0001016e, + 0x0001016f, + 0x0001016f, + 0x00010170, + 0x00010170, + 0x00010171, + 0x00010171, + 0x00010172, + 0x00010172, + 0x00010173, + 0x00010173, + 0x00010174, + 0x00010174, + }, + { + 0x00010175, + 0x00010175, + 0x00010176, + 0x00010176, + 0x00010177, + 0x00010177, + 0x00010178, + 0x00010178, + 0x00010179, + 0x00010179, + 0x0001017a, + 0x0001017a, + 0x0001017b, + 0x0001017b, + 0x0001017c, + 0x0001017c, + }, + { + 0x0001017d, + 0x0001017d, + 0x0001017e, + 0x0001017e, + 0x0001017f, + 0x0001017f, + 0x00010180, + 0x00010180, + 0x00010181, + 0x00010181, + 0x00010182, + 0x00010182, + 0x00010183, + 0x00010183, + 0x00010184, + 0x00010184, + }, + { + 0x0046ffff, + 0x0047ffff, + 0x0048ffff, + 0x0049ffff, + 0x004affff, + 0x004bffff, + 0x004cffff, + 0x004dffff, + 0x004effff, + 0x004fffff, + 0x0050ffff, + 0x0051ffff, + 0x0052ffff, + 0x0053ffff, + 0x0054ffff, + 0x0055ffff, + }, + { + 0x00010185, + 0x00010185, + 0x00010186, + 0x00010186, + 0x00010187, + 0x00010187, + 0x00010188, + 0x00010188, + 0x00010189, + 0x00010189, + 0x0001018a, + 0x0001018a, + 0x0001018b, + 0x0001018b, + 0x0001018c, + 0x0001018c, + }, + { + 0x0001018d, + 0x0001018d, + 0x0001018e, + 0x0001018e, + 0x0001018f, + 0x0001018f, + 0x00010190, + 0x00010190, + 0x00010191, + 0x00010191, + 0x00010192, + 0x00010192, + 0x00010193, + 0x00010193, + 0x00010194, + 0x00010194, + }, + { + 0x00010195, + 0x00010195, + 0x00010196, + 0x00010196, + 0x00010197, + 0x00010197, + 0x00010198, + 0x00010198, + 0x00010199, + 0x00010199, + 0x0001019a, + 0x0001019a, + 0x0001019b, + 0x0001019b, + 0x0001019c, + 0x0001019c, + }, + { + 0x0001019d, + 0x0001019d, + 0x0001019e, + 0x0001019e, + 0x0001019f, + 0x0001019f, + 0x000101a0, + 0x000101a0, + 0x000101a1, + 0x000101a1, + 0x000101a2, + 0x000101a2, + 0x000101a3, + 0x000101a3, + 0x000101a4, + 0x000101a4, + }, + { + 0x000101a5, + 0x000101a5, + 0x000101a6, + 0x000101a6, + 0x000101a7, + 0x000101a7, + 0x000101a8, + 0x000101a8, + 0x000101a9, + 0x000101a9, + 0x000101aa, + 0x000101aa, + 0x000101ab, + 0x000101ab, + 0x000101ac, + 0x000101ac, + }, + { + 0x000101ad, + 0x000101ad, + 0x000101ae, + 0x000101ae, + 0x000101af, + 0x000101af, + 0x000101b0, + 0x000101b0, + 0x000101b1, + 0x000101b1, + 0x000101b2, + 0x000101b2, + 0x000101b3, + 0x000101b3, + 0x000101b4, + 0x000101b4, + }, + { + 0x000101b5, + 0x000101b5, + 0x000101b6, + 0x000101b6, + 0x000101b7, + 0x000101b7, + 0x000101b8, + 0x000101b8, + 0x000101b9, + 0x000101b9, + 0x000101ba, + 0x000101ba, + 0x000101bb, + 0x000101bb, + 0x000101bc, + 0x000101bc, + }, + { + 0x000101bd, + 0x000101bd, + 0x000101be, + 0x000101be, + 0x000101bf, + 0x000101bf, + 0x000101c0, + 0x000101c0, + 0x000101c1, + 0x000101c1, + 0x000101c2, + 0x000101c2, + 0x000101c3, + 0x000101c3, + 0x000101c4, + 0x000101c4, + }, + { + 0x000101c5, + 0x000101c5, + 0x000101c6, + 0x000101c6, + 0x000101c7, + 0x000101c7, + 0x000101c8, + 0x000101c8, + 0x000101c9, + 0x000101c9, + 0x000101ca, + 0x000101ca, + 0x000101cb, + 0x000101cb, + 0x000101cc, + 0x000101cc, + }, + { + 0x000101cd, + 0x000101cd, + 0x000101ce, + 0x000101ce, + 0x000101cf, + 0x000101cf, + 0x000101d0, + 0x000101d0, + 0x000101d1, + 0x000101d1, + 0x000101d2, + 0x000101d2, + 0x000101d3, + 0x000101d3, + 0x000101d4, + 0x000101d4, + }, + { + 0x000101d5, + 0x000101d5, + 0x000101d6, + 0x000101d6, + 0x000101d7, + 0x000101d7, + 0x000101d8, + 0x000101d8, + 0x000101d9, + 0x000101d9, + 0x000101da, + 0x000101da, + 0x000101db, + 0x000101db, + 0x000101dc, + 0x000101dc, + }, + { + 0x000101dd, + 0x000101dd, + 0x000101de, + 0x000101de, + 0x000101df, + 0x000101df, + 0x000101e0, + 0x000101e0, + 0x000101e1, + 0x000101e1, + 0x000101e2, + 0x000101e2, + 0x000101e3, + 0x000101e3, + 0x000101e4, + 0x000101e4, + }, + { + 0x000101e5, + 0x000101e5, + 0x000101e6, + 0x000101e6, + 0x000101e7, + 0x000101e7, + 0x000101e8, + 0x000101e8, + 0x000101e9, + 0x000101e9, + 0x000101ea, + 0x000101ea, + 0x000101eb, + 0x000101eb, + 0x000101ec, + 0x000101ec, + }, + { + 0x000101ed, + 0x000101ed, + 0x000101ee, + 0x000101ee, + 0x000101ef, + 0x000101ef, + 0x000101f0, + 0x000101f0, + 0x000101f1, + 0x000101f1, + 0x000101f2, + 0x000101f2, + 0x000101f3, + 0x000101f3, + 0x000101f4, + 0x000101f4, + }, + { + 0x000101f5, + 0x000101f5, + 0x000101f6, + 0x000101f6, + 0x000101f7, + 0x000101f7, + 0x000101f8, + 0x000101f8, + 0x000101f9, + 0x000101f9, + 0x000101fa, + 0x000101fa, + 0x000101fb, + 0x000101fb, + 0x000101fc, + 0x000101fc, + }, + { + 0x000101fd, + 0x000101fd, + 0x000101fe, + 0x000101fe, + 0x000101ff, + 0x000101ff, + 0x00010200, + 0x00010200, + 0x00010201, + 0x00010201, + 0x00010202, + 0x00010202, + 0x00010203, + 0x00010203, + 0x00010204, + 0x00010204, + }, + { + 0x0057ffff, + 0x0058ffff, + 0x0059ffff, + 0x005affff, + 0x005bffff, + 0x005cffff, + 0x005dffff, + 0x005effff, + 0x005fffff, + 0x0060ffff, + 0x0061ffff, + 0x0062ffff, + 0x0063ffff, + 0x0064ffff, + 0x0065ffff, + 0x0066ffff, + }, + { + 0x00010205, + 0x00010205, + 0x00010206, + 0x00010206, + 0x00010207, + 0x00010207, + 0x00010208, + 0x00010208, + 0x00010209, + 0x00010209, + 0x0001020a, + 0x0001020a, + 0x0001020b, + 0x0001020b, + 0x0001020c, + 0x0001020c, + }, + { + 0x0001020d, + 0x0001020d, + 0x0001020e, + 0x0001020e, + 0x0001020f, + 0x0001020f, + 0x00010210, + 0x00010210, + 0x00010211, + 0x00010211, + 0x00010212, + 0x00010212, + 0x00010213, + 0x00010213, + 0x00010214, + 0x00010214, + }, + { + 0x00010215, + 0x00010215, + 0x00010216, + 0x00010216, + 0x00010217, + 0x00010217, + 0x00010218, + 0x00010218, + 0x00010219, + 0x00010219, + 0x0001021a, + 0x0001021a, + 0x0001021b, + 0x0001021b, + 0x0001021c, + 0x0001021c, + }, + { + 0x0001021d, + 0x0001021d, + 0x0001021e, + 0x0001021e, + 0x0001021f, + 0x0001021f, + 0x00010220, + 0x00010220, + 0x00010221, + 0x00010221, + 0x00010222, + 0x00010222, + 0x00010223, + 0x00010223, + 0x00010224, + 0x00010224, + }, + { + 0x00010225, + 0x00010225, + 0x00010226, + 0x00010226, + 0x00010227, + 0x00010227, + 0x00010228, + 0x00010228, + 0x00010229, + 0x00010229, + 0x0001022a, + 0x0001022a, + 0x0001022b, + 0x0001022b, + 0x0001022c, + 0x0001022c, + }, + { + 0x0001022d, + 0x0001022d, + 0x0001022e, + 0x0001022e, + 0x0001022f, + 0x0001022f, + 0x00010230, + 0x00010230, + 0x00010231, + 0x00010231, + 0x00010232, + 0x00010232, + 0x00010233, + 0x00010233, + 0x00010234, + 0x00010234, + }, + { + 0x00010235, + 0x00010235, + 0x00010236, + 0x00010236, + 0x00010237, + 0x00010237, + 0x00010238, + 0x00010238, + 0x00010239, + 0x00010239, + 0x0001023a, + 0x0001023a, + 0x0001023b, + 0x0001023b, + 0x0001023c, + 0x0001023c, + }, + { + 0x0001023d, + 0x0001023d, + 0x0001023e, + 0x0001023e, + 0x0001023f, + 0x0001023f, + 0x00010240, + 0x00010240, + 0x00010241, + 0x00010241, + 0x00010242, + 0x00010242, + 0x00010243, + 0x00010243, + 0x00010244, + 0x00010244, + }, + { + 0x00010245, + 0x00010245, + 0x00010246, + 0x00010246, + 0x00010247, + 0x00010247, + 0x00010248, + 0x00010248, + 0x00010249, + 0x00010249, + 0x0001024a, + 0x0001024a, + 0x0001024b, + 0x0001024b, + 0x0001024c, + 0x0001024c, + }, + { + 0x0001024d, + 0x0001024d, + 0x0001024e, + 0x0001024e, + 0x0001024f, + 0x0001024f, + 0x00010250, + 0x00010250, + 0x00010251, + 0x00010251, + 0x00010252, + 0x00010252, + 0x00010253, + 0x00010253, + 0x00010254, + 0x00010254, + }, + { + 0x00010255, + 0x00010255, + 0x00010256, + 0x00010256, + 0x00010257, + 0x00010257, + 0x00010258, + 0x00010258, + 0x00010259, + 0x00010259, + 0x0001025a, + 0x0001025a, + 0x0001025b, + 0x0001025b, + 0x0001025c, + 0x0001025c, + }, + { + 0x0001025d, + 0x0001025d, + 0x0001025e, + 0x0001025e, + 0x0001025f, + 0x0001025f, + 0x00010260, + 0x00010260, + 0x00010261, + 0x00010261, + 0x00010262, + 0x00010262, + 0x00010263, + 0x00010263, + 0x00010264, + 0x00010264, + }, + { + 0x00010265, + 0x00010265, + 0x00010266, + 0x00010266, + 0x00010267, + 0x00010267, + 0x00010268, + 0x00010268, + 0x00010269, + 0x00010269, + 0x0001026a, + 0x0001026a, + 0x0001026b, + 0x0001026b, + 0x0001026c, + 0x0001026c, + }, + { + 0x0001026d, + 0x0001026d, + 0x0001026e, + 0x0001026e, + 0x0001026f, + 0x0001026f, + 0x00010270, + 0x00010270, + 0x00010271, + 0x00010271, + 0x00010272, + 0x00010272, + 0x00010273, + 0x00010273, + 0x00010274, + 0x00010274, + }, + { + 0x00010275, + 0x00010275, + 0x00010276, + 0x00010276, + 0x00010277, + 0x00010277, + 0x00010278, + 0x00010278, + 0x00010279, + 0x00010279, + 0x0001027a, + 0x0001027a, + 0x0001027b, + 0x0001027b, + 0x0001027c, + 0x0001027c, + }, + { + 0x0001027d, + 0x0001027d, + 0x0001027e, + 0x0001027e, + 0x0001027f, + 0x0001027f, + 0x00010280, + 0x00010280, + 0x00010281, + 0x00010281, + 0x00010282, + 0x00010282, + 0x00010283, + 0x00010283, + 0x00010284, + 0x00010284, + }, + { + 0x00010285, + 0x00010285, + 0x00010286, + 0x00010286, + 0x00010287, + 0x00010287, + 0x00010288, + 0x00010288, + 0x00010289, + 0x00010289, + 0x0001028a, + 0x0001028a, + 0x0001028b, + 0x0001028b, + 0x0001028c, + 0x0001028c, + }, + { + 0x0001028d, + 0x0001028d, + 0x0001028e, + 0x0001028e, + 0x0001028f, + 0x0001028f, + 0x00010290, + 0x00010290, + 0x00010291, + 0x00010291, + 0x00010292, + 0x00010292, + 0x00010293, + 0x00010293, + 0x00010294, + 0x00010294, + }, + { + 0x00010295, + 0x00010295, + 0x00010296, + 0x00010296, + 0x00010297, + 0x00010297, + 0x00010298, + 0x00010298, + 0x00010299, + 0x00010299, + 0x0001029a, + 0x0001029a, + 0x0001029b, + 0x0001029b, + 0x0001029c, + 0x0001029c, + }, + { + 0x0001029d, + 0x0001029d, + 0x0001029e, + 0x0001029e, + 0x0001029f, + 0x0001029f, + 0x000102a0, + 0x000102a0, + 0x000102a1, + 0x000102a1, + 0x000102a2, + 0x000102a2, + 0x000102a3, + 0x000102a3, + 0x000102a4, + 0x000102a4, + }, + { + 0x000102a5, + 0x000102a5, + 0x000102a6, + 0x000102a6, + 0x000102a7, + 0x000102a7, + 0x000102a8, + 0x000102a8, + 0x000102a9, + 0x000102a9, + 0x000102aa, + 0x000102aa, + 0x000102ab, + 0x000102ab, + 0x000102ac, + 0x000102ac, + }, + { + 0x000102ad, + 0x000102ad, + 0x000102ae, + 0x000102ae, + 0x000102af, + 0x000102af, + 0x000102b0, + 0x000102b0, + 0x000102b1, + 0x000102b1, + 0x000102b2, + 0x000102b2, + 0x000102b3, + 0x000102b3, + 0x000102b4, + 0x000102b4, + }, + { + 0x000102b5, + 0x000102b5, + 0x000102b6, + 0x000102b6, + 0x000102b7, + 0x000102b7, + 0x000102b8, + 0x000102b8, + 0x000102b9, + 0x000102b9, + 0x000102ba, + 0x000102ba, + 0x000102bb, + 0x000102bb, + 0x000102bc, + 0x000102bc, + }, + { + 0x000102bd, + 0x000102bd, + 0x000102be, + 0x000102be, + 0x000102bf, + 0x000102bf, + 0x000102c0, + 0x000102c0, + 0x000102c1, + 0x000102c1, + 0x000102c2, + 0x000102c2, + 0x000102c3, + 0x000102c3, + 0x000102c4, + 0x000102c4, + }, + { + 0x000102c5, + 0x000102c5, + 0x000102c6, + 0x000102c6, + 0x000102c7, + 0x000102c7, + 0x000102c8, + 0x000102c8, + 0x000102c9, + 0x000102c9, + 0x000102ca, + 0x000102ca, + 0x000102cb, + 0x000102cb, + 0x000102cc, + 0x000102cc, + }, + { + 0x000102cd, + 0x000102cd, + 0x000102ce, + 0x000102ce, + 0x000102cf, + 0x000102cf, + 0x000102d0, + 0x000102d0, + 0x000102d1, + 0x000102d1, + 0x000102d2, + 0x000102d2, + 0x000102d3, + 0x000102d3, + 0x000102d4, + 0x000102d4, + }, }; #endif #ifndef ROM_TO_RAM @@ -3620,22 +38325,147 @@ const uint32_t c_aauiCQMFHuffEnc50[28][2] = #else const uint16_t c_aauiCQMFHuffEnc50[28][2] = #endif -{ - {0x0002, 0x0001}, {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0001}, {0x0004, 0x0001}, {0x0005, 0x0001}, {0x0006, 0x0001}, {0x0007, 0x0001}, - {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, {0x000e, 0x0001}, {0x000f, 0x0001}, - {0x0011, 0x0003}, {0x0012, 0x0005}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, - {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, + { + { 0x0002, 0x0001 }, + { 0x0002, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0001 }, + { 0x0004, 0x0001 }, + { 0x0005, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x000f, 0x0001 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0005 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec50[6][16] = -{ - {0x0001ffff, 0x00000004, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, - {0x0002ffff, 0x00000008, 0x00010007, 0x00010007, 0x00020006, 0x00020006, 0x00020006, 0x00020006, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x0003ffff, 0x0000000c, 0x0001000b, 0x0001000b, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0005ffff, 0x0004ffff, 0x0001000f, 0x0001000f, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, 0x00030010, }, - {0x00010012, 0x00010012, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, }, +const uint32_t c_aauiCQMFHuffDec50[6][16] = { + { + 0x0001ffff, + 0x00000004, + 0x00010003, + 0x00010003, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + }, + { + 0x0002ffff, + 0x00000008, + 0x00010007, + 0x00010007, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00020006, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x0003ffff, + 0x0000000c, + 0x0001000b, + 0x0001000b, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0005ffff, + 0x0004ffff, + 0x0001000f, + 0x0001000f, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + 0x00030010, + }, + { + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + }, }; #endif #ifndef ROM_TO_RAM @@ -3643,22 +38473,148 @@ const uint32_t c_aauiCQMFHuffEnc51[29][2] = #else const uint16_t c_aauiCQMFHuffEnc51[29][2] = #endif -{ - {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0001}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, - {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, {0x000d, 0x0001}, - {0x000e, 0x0001}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, - {0x0013, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, + { + { 0x0002, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0004, 0x0001 }, + { 0x0004, 0x0002 }, + { 0x0004, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0006, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x000d, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec51[6][16] = -{ - {0x0001ffff, 0x00000004, 0x00000005, 0x00000006, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x0002ffff, 0x0000000a, 0x00010009, 0x00010009, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x0003ffff, 0x0000000e, 0x0001000d, 0x0001000d, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0004ffff, 0x0005ffff, 0x00000011, 0x00000012, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, 0x0003000f, }, - {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, }, - {0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, }, +const uint32_t c_aauiCQMFHuffDec51[6][16] = { + { + 0x0001ffff, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x0002ffff, + 0x0000000a, + 0x00010009, + 0x00010009, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x0003ffff, + 0x0000000e, + 0x0001000d, + 0x0001000d, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x0004ffff, + 0x0005ffff, + 0x00000011, + 0x00000012, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + 0x0003000f, + }, + { + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + }, + { + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + }, }; #endif #ifndef ROM_TO_RAM @@ -3666,22 +38622,168 @@ const uint32_t c_aauiCQMFHuffEnc52[32][2] = #else const uint16_t c_aauiCQMFHuffEnc52[32][2] = #endif -{ - {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0001}, {0x0005, 0x0002}, - {0x0005, 0x0003}, {0x0006, 0x0001}, {0x0007, 0x0001}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000a, 0x0001}, {0x000b, 0x0001}, {0x000c, 0x0001}, - {0x000e, 0x0001}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0001}, {0x0011, 0x0002}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0014, 0x0000}, - {0x0013, 0x0003}, {0x0014, 0x0001}, {0x0014, 0x0002}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0004}, {0x0013, 0x0005}, -}; + { + { 0x0002, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0004, 0x0002 }, + { 0x0004, 0x0003 }, + { 0x0005, 0x0001 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0006, 0x0001 }, + { 0x0007, 0x0001 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000a, 0x0001 }, + { 0x000b, 0x0001 }, + { 0x000c, 0x0001 }, + { 0x000e, 0x0001 }, + { 0x000e, 0x0002 }, + { 0x000e, 0x0003 }, + { 0x000f, 0x0001 }, + { 0x0011, 0x0002 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0003 }, + { 0x0014, 0x0000 }, + { 0x0013, 0x0003 }, + { 0x0014, 0x0001 }, + { 0x0014, 0x0002 }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec52[7][16] = -{ - {0x0001ffff, 0x0002ffff, 0x00000004, 0x00000005, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x0003ffff, 0x0000000b, 0x0001000a, 0x0001000a, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x0004ffff, 0x0000000f, 0x0001000e, 0x0001000e, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0006ffff, 0x0005ffff, 0x00010013, 0x00010013, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, }, - {0x00000017, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x00010018, 0x00010018, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, +const uint32_t c_aauiCQMFHuffDec52[7][16] = { + { + 0x0001ffff, + 0x0002ffff, + 0x00000004, + 0x00000005, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x0003ffff, + 0x0000000b, + 0x0001000a, + 0x0001000a, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x0004ffff, + 0x0000000f, + 0x0001000e, + 0x0001000e, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x00010013, + 0x00010013, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + }, + { + 0x00000017, + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x0000001c, + 0x0000001d, + 0x00010018, + 0x00010018, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, }; #endif #ifndef ROM_TO_RAM @@ -3689,26 +38791,210 @@ const uint32_t c_aauiCQMFHuffEnc53[37][2] = #else const uint16_t c_aauiCQMFHuffEnc53[37][2] = #endif -{ - {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0002}, {0x0004, 0x0003}, {0x0005, 0x0002}, {0x0005, 0x0003}, - {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0007, 0x0001}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0009, 0x0001}, {0x000b, 0x0002}, - {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0002}, - {0x000f, 0x0003}, {0x0011, 0x0004}, {0x0010, 0x0003}, {0x0011, 0x0005}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0001}, {0x0012, 0x0002}, - {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, + { + { 0x0002, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0004, 0x0002 }, + { 0x0004, 0x0003 }, + { 0x0005, 0x0002 }, + { 0x0005, 0x0003 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0007, 0x0001 }, + { 0x0007, 0x0002 }, + { 0x0007, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x0009, 0x0001 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000d, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x000e, 0x0002 }, + { 0x000e, 0x0003 }, + { 0x000f, 0x0002 }, + { 0x000f, 0x0003 }, + { 0x0011, 0x0004 }, + { 0x0010, 0x0003 }, + { 0x0011, 0x0005 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0012, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec53[9][16] = -{ - {0x0002ffff, 0x0001ffff, 0x00000004, 0x00000005, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x0003ffff, 0x0000000d, 0x0001000a, 0x0001000a, 0x0001000b, 0x0001000b, 0x0001000c, 0x0001000c, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, - {0x0005ffff, 0x0004ffff, 0x00000011, 0x00000012, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, 0x0003000e, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x0007ffff, 0x0008ffff, 0x0006ffff, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, }, - {0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, }, +const uint32_t c_aauiCQMFHuffDec53[9][16] = { + { + 0x0002ffff, + 0x0001ffff, + 0x00000004, + 0x00000005, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x0003ffff, + 0x0000000d, + 0x0001000a, + 0x0001000a, + 0x0001000b, + 0x0001000b, + 0x0001000c, + 0x0001000c, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + }, + { + 0x0005ffff, + 0x0004ffff, + 0x00000011, + 0x00000012, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + 0x0003000e, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x0007ffff, + 0x0008ffff, + 0x0006ffff, + 0x0000001a, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, + { + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + }, + { + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + }, + { + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + }, }; #endif #ifndef ROM_TO_RAM @@ -3716,26 +39002,212 @@ const uint32_t c_aauiCQMFHuffEnc54[39][2] = #else const uint16_t c_aauiCQMFHuffEnc54[39][2] = #endif -{ - {0x0002, 0x0002}, {0x0002, 0x0003}, {0x0003, 0x0002}, {0x0003, 0x0003}, {0x0004, 0x0003}, {0x0005, 0x0003}, {0x0005, 0x0004}, {0x0005, 0x0005}, - {0x0006, 0x0002}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0008, 0x0001}, {0x0008, 0x0002}, - {0x0008, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, - {0x000d, 0x0003}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0002}, {0x000f, 0x0003}, {0x0011, 0x0002}, {0x0010, 0x0002}, {0x0010, 0x0003}, - {0x0011, 0x0003}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, + { + { 0x0002, 0x0002 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0002 }, + { 0x0003, 0x0003 }, + { 0x0004, 0x0003 }, + { 0x0005, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0006, 0x0002 }, + { 0x0006, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0002 }, + { 0x0007, 0x0003 }, + { 0x0008, 0x0001 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000d, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x000e, 0x0002 }, + { 0x000e, 0x0003 }, + { 0x000f, 0x0002 }, + { 0x000f, 0x0003 }, + { 0x0011, 0x0002 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec54[9][16] = -{ - {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000004, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x0004ffff, 0x0000000e, 0x0000000f, 0x00000010, 0x0001000c, 0x0001000c, 0x0001000d, 0x0001000d, 0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, }, - {0x0006ffff, 0x0005ffff, 0x00000015, 0x00000016, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, }, - {0x0008ffff, 0x0007ffff, 0x0000001e, 0x0000001f, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x00020019, 0x00020019, 0x00020019, 0x00020019, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, 0x00030020, }, - {0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00010025, 0x00010025, 0x00010026, 0x00010026, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, }, +const uint32_t c_aauiCQMFHuffDec54[9][16] = { + { + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000004, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x0004ffff, + 0x0000000e, + 0x0000000f, + 0x00000010, + 0x0001000c, + 0x0001000c, + 0x0001000d, + 0x0001000d, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x00000015, + 0x00000016, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + }, + { + 0x0008ffff, + 0x0007ffff, + 0x0000001e, + 0x0000001f, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x00020019, + 0x00020019, + 0x00020019, + 0x00020019, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + 0x00030020, + }, + { + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00010025, + 0x00010025, + 0x00010026, + 0x00010026, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + }, }; #endif #ifndef ROM_TO_RAM @@ -3743,28 +39215,237 @@ const uint32_t c_aauiCQMFHuffEnc55[46][2] = #else const uint16_t c_aauiCQMFHuffEnc55[46][2] = #endif -{ - {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0003}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, - {0x0005, 0x0004}, {0x0005, 0x0005}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0002}, {0x0007, 0x0003}, {0x0007, 0x0004}, - {0x0007, 0x0005}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, {0x000a, 0x0003}, {0x000b, 0x0002}, - {0x000b, 0x0003}, {0x000c, 0x0002}, {0x000c, 0x0003}, {0x000d, 0x0002}, {0x000d, 0x0003}, {0x000e, 0x0002}, {0x000e, 0x0003}, {0x000f, 0x0003}, - {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0011, 0x0003}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, - {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, + { + { 0x0003, 0x0003 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0004, 0x0003 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0005, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0006, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0002 }, + { 0x0007, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000b, 0x0002 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0002 }, + { 0x000c, 0x0003 }, + { 0x000d, 0x0002 }, + { 0x000d, 0x0003 }, + { 0x000e, 0x0002 }, + { 0x000e, 0x0003 }, + { 0x000f, 0x0003 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0010, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec55[10][16] = -{ - {0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0005ffff, 0x0004ffff, 0x00000011, 0x00000012, 0x0001000d, 0x0001000d, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, }, - {0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030013, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, 0x00030014, }, - {0x0007ffff, 0x0006ffff, 0x00000019, 0x0000001a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001b, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0009ffff, 0x0008ffff, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x0001001f, 0x0001001f, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001d, 0x0002001e, 0x0002001e, 0x0002001e, 0x0002001e, }, - {0x00020026, 0x00020026, 0x00020026, 0x00020026, 0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x0001002d, 0x0001002d, 0x00020025, 0x00020025, 0x00020025, 0x00020025, }, +const uint32_t c_aauiCQMFHuffDec55[10][16] = { + { + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00010000, + 0x00010000, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0005ffff, + 0x0004ffff, + 0x00000011, + 0x00000012, + 0x0001000d, + 0x0001000d, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + }, + { + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030013, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + 0x00030014, + }, + { + 0x0007ffff, + 0x0006ffff, + 0x00000019, + 0x0000001a, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, + { + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001b, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0009ffff, + 0x0008ffff, + 0x00000020, + 0x00000021, + 0x00000022, + 0x00000023, + 0x0001001f, + 0x0001001f, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001d, + 0x0002001e, + 0x0002001e, + 0x0002001e, + 0x0002001e, + }, + { + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x0001002d, + 0x0001002d, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + }, }; #endif #ifndef ROM_TO_RAM @@ -3772,31 +39453,282 @@ const uint32_t c_aauiCQMFHuffEnc56[55][2] = #else const uint16_t c_aauiCQMFHuffEnc56[55][2] = #endif -{ - {0x0003, 0x0003}, {0x0002, 0x0003}, {0x0003, 0x0004}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0005, 0x0003}, {0x0005, 0x0004}, - {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0003}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0007, 0x0003}, {0x0007, 0x0004}, - {0x0007, 0x0005}, {0x0008, 0x0002}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0002}, {0x0009, 0x0003}, {0x000a, 0x0002}, - {0x000a, 0x0003}, {0x000b, 0x0003}, {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000d, 0x0003}, {0x000d, 0x0004}, {0x000d, 0x0005}, - {0x000e, 0x0003}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0010, 0x0002}, {0x0010, 0x0003}, {0x0010, 0x0004}, - {0x0010, 0x0005}, {0x0010, 0x0006}, {0x0010, 0x0007}, {0x0013, 0x0000}, {0x0011, 0x0003}, {0x0012, 0x0005}, {0x0013, 0x0001}, {0x0013, 0x0002}, - {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, + { + { 0x0003, 0x0003 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0004 }, + { 0x0003, 0x0005 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0005, 0x0003 }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0006, 0x0003 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0007, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0008, 0x0002 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0009, 0x0002 }, + { 0x0009, 0x0003 }, + { 0x000a, 0x0002 }, + { 0x000a, 0x0003 }, + { 0x000b, 0x0003 }, + { 0x000c, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000d, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000e, 0x0003 }, + { 0x000e, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x000f, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x0010, 0x0002 }, + { 0x0010, 0x0003 }, + { 0x0010, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x0010, 0x0006 }, + { 0x0010, 0x0007 }, + { 0x0013, 0x0000 }, + { 0x0011, 0x0003 }, + { 0x0012, 0x0005 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec56[12][16] = -{ - {0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000004, 0x00000005, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00010003, 0x00010003, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0006ffff, 0x0005ffff, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x0001000e, 0x0001000e, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030015, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, 0x00030016, }, - {0x0009ffff, 0x0007ffff, 0x0008ffff, 0x0000001a, 0x0000001b, 0x0000001c, 0x00010019, 0x00010019, 0x00020017, 0x00020017, 0x00020017, 0x00020017, 0x00020018, 0x00020018, 0x00020018, 0x00020018, }, - {0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x00020022, 0x00020022, 0x00020022, 0x00020022, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, }, - {0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, 0x0003001f, }, - {0x000bffff, 0x000affff, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x00010023, 0x00010023, 0x00010024, 0x00010024, 0x00020020, 0x00020020, 0x00020020, 0x00020020, }, - {0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, - {0x0001002b, 0x0001002b, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010033, 0x00010033, 0x00010034, 0x00010034, }, +const uint32_t c_aauiCQMFHuffDec56[12][16] = { + { + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x00000004, + 0x00000005, + 0x00010000, + 0x00010000, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0006ffff, + 0x0005ffff, + 0x00000011, + 0x00000012, + 0x00000013, + 0x00000014, + 0x0001000e, + 0x0001000e, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030015, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + 0x00030016, + }, + { + 0x0009ffff, + 0x0007ffff, + 0x0008ffff, + 0x0000001a, + 0x0000001b, + 0x0000001c, + 0x00010019, + 0x00010019, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020017, + 0x00020018, + 0x00020018, + 0x00020018, + 0x00020018, + }, + { + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020022, + 0x00020022, + 0x00020022, + 0x00020022, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + }, + { + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + 0x0003001f, + }, + { + 0x000bffff, + 0x000affff, + 0x00000025, + 0x00000026, + 0x00000027, + 0x00000028, + 0x00000029, + 0x0000002a, + 0x00010023, + 0x00010023, + 0x00010024, + 0x00010024, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + }, + { + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + }, + { + 0x0001002b, + 0x0001002b, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010033, + 0x00010033, + 0x00010034, + 0x00010034, + }, }; #endif #ifndef ROM_TO_RAM @@ -3804,35 +39736,328 @@ const uint32_t c_aauiCQMFHuffEnc57[65][2] = #else const uint16_t c_aauiCQMFHuffEnc57[65][2] = #endif -{ - {0x0003, 0x0004}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0004}, {0x0004, 0x0005}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0005, 0x0004}, - {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0007, 0x0003}, - {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0009, 0x0003}, - {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0003}, {0x000b, 0x0004}, {0x000b, 0x0005}, - {0x000c, 0x0003}, {0x000c, 0x0004}, {0x000d, 0x0003}, {0x000c, 0x0005}, {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000e, 0x0003}, {0x000e, 0x0004}, - {0x000e, 0x0005}, {0x000f, 0x0003}, {0x0010, 0x0003}, {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0010, 0x0004}, {0x0010, 0x0005}, {0x0013, 0x0000}, - {0x0011, 0x0005}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0012, 0x0007}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0012, 0x0008}, {0x0012, 0x0009}, - {0x0013, 0x0005}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, - {0x0013, 0x000d}, + { + { 0x0003, 0x0004 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0005 }, + { 0x0004, 0x0004 }, + { 0x0004, 0x0005 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0005, 0x0004 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0007, 0x0003 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0009, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000a, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000b, 0x0003 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000c, 0x0003 }, + { 0x000c, 0x0004 }, + { 0x000d, 0x0003 }, + { 0x000c, 0x0005 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000e, 0x0003 }, + { 0x000e, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x000f, 0x0003 }, + { 0x0010, 0x0003 }, + { 0x000f, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x0010, 0x0004 }, + { 0x0010, 0x0005 }, + { 0x0013, 0x0000 }, + { 0x0011, 0x0005 }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0012, 0x0007 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec57[14][16] = -{ - {0x0004ffff, 0x0003ffff, 0x0001ffff, 0x0002ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010002, 0x00010002, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, - {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x00000014, 0x00000015, 0x00000016, 0x0001000f, 0x0001000f, 0x00010010, 0x00010010, 0x00010011, 0x00010011, 0x00010012, 0x00010012, 0x00010013, 0x00010013, }, - {0x0002001b, 0x0002001b, 0x0002001b, 0x0002001b, 0x0002001c, 0x0002001c, 0x0002001c, 0x0002001c, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, 0x00030017, }, - {0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030018, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, 0x00030019, }, - {0x000affff, 0x0008ffff, 0x0009ffff, 0x00000020, 0x00000021, 0x00000023, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x0002001a, 0x0002001a, 0x0002001a, 0x0002001a, }, - {0x00020027, 0x00020027, 0x00020027, 0x00020027, 0x00020028, 0x00020028, 0x00020028, 0x00020028, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, }, - {0x000dffff, 0x000cffff, 0x000bffff, 0x0000002a, 0x0000002d, 0x0000002e, 0x00010029, 0x00010029, 0x0001002b, 0x0001002b, 0x0001002c, 0x0001002c, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, - {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, - {0x0001003b, 0x0001003b, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010040, 0x00010040, 0x00020033, 0x00020033, 0x00020033, 0x00020033, }, - {0x0001002f, 0x0001002f, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010034, 0x00010034, 0x00010035, 0x00010035, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003a, 0x0001003a, }, +const uint32_t c_aauiCQMFHuffDec57[14][16] = { + { + 0x0004ffff, + 0x0003ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00010000, + 0x00010000, + 0x00010002, + 0x00010002, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + }, + { + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x00000014, + 0x00000015, + 0x00000016, + 0x0001000f, + 0x0001000f, + 0x00010010, + 0x00010010, + 0x00010011, + 0x00010011, + 0x00010012, + 0x00010012, + 0x00010013, + 0x00010013, + }, + { + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001b, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x0002001c, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + 0x00030017, + }, + { + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030018, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + 0x00030019, + }, + { + 0x000affff, + 0x0008ffff, + 0x0009ffff, + 0x00000020, + 0x00000021, + 0x00000023, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x0002001a, + 0x0002001a, + 0x0002001a, + 0x0002001a, + }, + { + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020027, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00020028, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + }, + { + 0x000dffff, + 0x000cffff, + 0x000bffff, + 0x0000002a, + 0x0000002d, + 0x0000002e, + 0x00010029, + 0x00010029, + 0x0001002b, + 0x0001002b, + 0x0001002c, + 0x0001002c, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + }, + { + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + }, + { + 0x0001003b, + 0x0001003b, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010040, + 0x00010040, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + }, + { + 0x0001002f, + 0x0001002f, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010034, + 0x00010034, + 0x00010035, + 0x00010035, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x0001003a, + 0x0001003a, + }, }; #endif #ifndef ROM_TO_RAM @@ -3840,39 +40065,394 @@ const uint32_t c_aauiCQMFHuffEnc58[77][2] = #else const uint16_t c_aauiCQMFHuffEnc58[77][2] = #endif -{ - {0x0004, 0x0005}, {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, - {0x0005, 0x0005}, {0x0005, 0x0006}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0006, 0x0004}, {0x0006, 0x0005}, {0x0006, 0x0006}, - {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0007, 0x0004}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0008, 0x0003}, - {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0009, 0x0003}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0003}, - {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, - {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, - {0x000f, 0x0004}, {0x000f, 0x0005}, {0x000f, 0x0006}, {0x0010, 0x0004}, {0x000f, 0x0007}, {0x0010, 0x0005}, {0x0010, 0x0006}, {0x0010, 0x0007}, - {0x0013, 0x0000}, {0x0013, 0x0001}, {0x0012, 0x0006}, {0x0011, 0x0007}, {0x0013, 0x0002}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, - {0x0012, 0x0007}, {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0012, 0x0008}, - {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, + { + { 0x0004, 0x0005 }, + { 0x0003, 0x0005 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0005, 0x0005 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0006, 0x0004 }, + { 0x0006, 0x0005 }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0007, 0x0004 }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0009, 0x0003 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000a, 0x0003 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x000e, 0x0006 }, + { 0x000e, 0x0007 }, + { 0x000f, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x000f, 0x0006 }, + { 0x0010, 0x0004 }, + { 0x000f, 0x0007 }, + { 0x0010, 0x0005 }, + { 0x0010, 0x0006 }, + { 0x0010, 0x0007 }, + { 0x0013, 0x0000 }, + { 0x0013, 0x0001 }, + { 0x0012, 0x0006 }, + { 0x0011, 0x0007 }, + { 0x0013, 0x0002 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0012, 0x0007 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, + { 0x0012, 0x000c }, + { 0x0012, 0x000d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec58[17][16] = -{ - {0x0005ffff, 0x0004ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000000, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00010001, 0x00010001, 0x00010002, 0x00010002, 0x00010003, 0x00010003, }, - {0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, - {0x0008ffff, 0x0006ffff, 0x0007ffff, 0x00000017, 0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, }, - {0x00020020, 0x00020020, 0x00020020, 0x00020020, 0x00020021, 0x00020021, 0x00020021, 0x00020021, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, 0x0003001c, }, - {0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001d, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, 0x0003001e, }, - {0x000cffff, 0x000bffff, 0x0009ffff, 0x000affff, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00010022, 0x00010022, 0x00010023, 0x00010023, 0x0002001f, 0x0002001f, 0x0002001f, 0x0002001f, }, - {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002d, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, }, - {0x0010ffff, 0x000effff, 0x000fffff, 0x000dffff, 0x00000033, 0x00000035, 0x00000036, 0x00000037, 0x00010030, 0x00010030, 0x00010031, 0x00010031, 0x00010032, 0x00010032, 0x00010034, 0x00010034, }, - {0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010046, 0x00010046, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x00020040, 0x00020040, 0x00020040, 0x00020040, }, - {0x00020047, 0x00020047, 0x00020047, 0x00020047, 0x00020048, 0x00020048, 0x00020048, 0x00020048, 0x00020049, 0x00020049, 0x00020049, 0x00020049, 0x0002004a, 0x0002004a, 0x0002004a, 0x0002004a, }, - {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0001003c, 0x0001003c, 0x0001003d, 0x0001003d, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010041, 0x00010041, 0x00010042, 0x00010042, }, +const uint32_t c_aauiCQMFHuffDec58[17][16] = { + { + 0x0005ffff, + 0x0004ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x00000000, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00000007, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + 0x00010003, + 0x00010003, + }, + { + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + }, + { + 0x0008ffff, + 0x0006ffff, + 0x0007ffff, + 0x00000017, + 0x00000018, + 0x00000019, + 0x0000001a, + 0x0000001b, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + }, + { + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020020, + 0x00020021, + 0x00020021, + 0x00020021, + 0x00020021, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + 0x0003001c, + }, + { + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001d, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + 0x0003001e, + }, + { + 0x000cffff, + 0x000bffff, + 0x0009ffff, + 0x000affff, + 0x00000024, + 0x00000025, + 0x00000026, + 0x00000027, + 0x00010022, + 0x00010022, + 0x00010023, + 0x00010023, + 0x0002001f, + 0x0002001f, + 0x0002001f, + 0x0002001f, + }, + { + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + }, + { + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002d, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + }, + { + 0x0010ffff, + 0x000effff, + 0x000fffff, + 0x000dffff, + 0x00000033, + 0x00000035, + 0x00000036, + 0x00000037, + 0x00010030, + 0x00010030, + 0x00010031, + 0x00010031, + 0x00010032, + 0x00010032, + 0x00010034, + 0x00010034, + }, + { + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + }, + { + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010046, + 0x00010046, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + }, + { + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020047, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020048, + 0x00020049, + 0x00020049, + 0x00020049, + 0x00020049, + 0x0002004a, + 0x0002004a, + 0x0002004a, + 0x0002004a, + }, + { + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x0001003c, + 0x0001003c, + 0x0001003d, + 0x0001003d, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + }, }; #endif #ifndef ROM_TO_RAM @@ -3880,44 +40460,462 @@ const uint32_t c_aauiCQMFHuffEnc59[91][2] = #else const uint16_t c_aauiCQMFHuffEnc59[91][2] = #endif -{ - {0x0003, 0x0005}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0006}, {0x0004, 0x0007}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0006}, - {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0006, 0x0006}, {0x0006, 0x0007}, {0x0006, 0x0008}, - {0x0006, 0x0009}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0007, 0x0005}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, - {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0008, 0x0003}, {0x0008, 0x0004}, {0x0008, 0x0005}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, - {0x0008, 0x0009}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0004}, - {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000d, 0x0003}, - {0x000d, 0x0004}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000e, 0x0003}, {0x000e, 0x0004}, {0x000e, 0x0005}, {0x000f, 0x0003}, - {0x000f, 0x0004}, {0x000f, 0x0005}, {0x0011, 0x0008}, {0x0011, 0x0009}, {0x0013, 0x0000}, {0x0011, 0x000a}, {0x0013, 0x0001}, {0x0013, 0x0002}, - {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, {0x0011, 0x000b}, {0x0013, 0x0006}, {0x0013, 0x0007}, - {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, {0x0013, 0x000e}, {0x0013, 0x000f}, - {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, - {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0012, 0x000f}, + { + { 0x0003, 0x0005 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0006 }, + { 0x0004, 0x0007 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0005, 0x0006 }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0006, 0x0006 }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0007, 0x0005 }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0007, 0x0008 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0008, 0x0003 }, + { 0x0008, 0x0004 }, + { 0x0008, 0x0005 }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000d, 0x0003 }, + { 0x000d, 0x0004 }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000e, 0x0003 }, + { 0x000e, 0x0004 }, + { 0x000e, 0x0005 }, + { 0x000f, 0x0003 }, + { 0x000f, 0x0004 }, + { 0x000f, 0x0005 }, + { 0x0011, 0x0008 }, + { 0x0011, 0x0009 }, + { 0x0013, 0x0000 }, + { 0x0011, 0x000a }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0012, 0x000d }, + { 0x0012, 0x000e }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0011, 0x000b }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0012, 0x000f }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec59[20][16] = -{ - {0x0006ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00010000, 0x00010000, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, - {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x0009ffff, 0x0008ffff, 0x0007ffff, 0x0000001a, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00010013, 0x00010013, 0x00010014, 0x00010014, 0x00010015, 0x00010015, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00020023, 0x00020023, 0x00020023, 0x00020023, 0x00020024, 0x00020024, 0x00020024, 0x00020024, 0x00020025, 0x00020025, 0x00020025, 0x00020025, 0x00020026, 0x00020026, 0x00020026, 0x00020026, }, - {0x000dffff, 0x000affff, 0x000bffff, 0x000cffff, 0x0000002b, 0x0000002c, 0x0000002d, 0x0000002e, 0x00010027, 0x00010027, 0x00010028, 0x00010028, 0x00010029, 0x00010029, 0x0001002a, 0x0001002a, }, - {0x00020035, 0x00020035, 0x00020035, 0x00020035, 0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0010ffff, 0x000effff, 0x000fffff, 0x00010037, 0x00010037, 0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x00020034, 0x00020034, 0x00020034, 0x00020034, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x0003003d, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x00010058, 0x00010058, 0x00010059, 0x00010059, 0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, - {0x0001003c, 0x0001003c, 0x0001003e, 0x0001003e, 0x0001003f, 0x0001003f, 0x00010042, 0x00010042, 0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010046, 0x00010046, 0x00010047, 0x00010047, }, - {0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, }, - {0x00010050, 0x00010050, 0x00010051, 0x00010051, 0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, }, +const uint32_t c_aauiCQMFHuffDec59[20][16] = { + { + 0x0006ffff, + 0x0004ffff, + 0x0005ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00000006, + 0x00010000, + 0x00010000, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + }, + { + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x0009ffff, + 0x0008ffff, + 0x0007ffff, + 0x0000001a, + 0x0000001b, + 0x0000001c, + 0x0000001d, + 0x0000001e, + 0x0000001f, + 0x00000020, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020023, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020024, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020025, + 0x00020026, + 0x00020026, + 0x00020026, + 0x00020026, + }, + { + 0x000dffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x0000002b, + 0x0000002c, + 0x0000002d, + 0x0000002e, + 0x00010027, + 0x00010027, + 0x00010028, + 0x00010028, + 0x00010029, + 0x00010029, + 0x0001002a, + 0x0001002a, + }, + { + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020035, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + }, + { + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, + { + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0010ffff, + 0x000effff, + 0x000fffff, + 0x00010037, + 0x00010037, + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020034, + }, + { + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + }, + { + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x0003003d, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + }, + { + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + }, + { + 0x0001003c, + 0x0001003c, + 0x0001003e, + 0x0001003e, + 0x0001003f, + 0x0001003f, + 0x00010042, + 0x00010042, + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010046, + 0x00010046, + 0x00010047, + 0x00010047, + }, + { + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + }, + { + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + 0x00010052, + 0x00010052, + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + }, }; #endif #ifndef ROM_TO_RAM @@ -3925,50 +40923,552 @@ const uint32_t c_aauiCQMFHuffEnc60[109][2] = #else const uint16_t c_aauiCQMFHuffEnc60[109][2] = #endif -{ - {0x0004, 0x0007}, {0x0002, 0x0003}, {0x0003, 0x0005}, {0x0004, 0x0008}, {0x0004, 0x0009}, {0x0005, 0x0007}, {0x0005, 0x0008}, {0x0005, 0x0009}, - {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0006, 0x0007}, {0x0006, 0x0008}, {0x0006, 0x0009}, {0x0006, 0x000a}, - {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0007, 0x0006}, {0x0007, 0x0007}, {0x0007, 0x0008}, {0x0007, 0x0009}, {0x0007, 0x000a}, - {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0008, 0x0006}, {0x0008, 0x0007}, {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, - {0x0008, 0x000b}, {0x0009, 0x0004}, {0x0009, 0x0005}, {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, - {0x0009, 0x000b}, {0x000a, 0x0004}, {0x000a, 0x0005}, {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000b, 0x0004}, {0x000b, 0x0005}, {0x000b, 0x0006}, - {0x000b, 0x0007}, {0x000c, 0x0004}, {0x000c, 0x0005}, {0x000c, 0x0006}, {0x000d, 0x0005}, {0x000d, 0x0006}, {0x000d, 0x0007}, {0x000c, 0x0007}, - {0x000e, 0x0005}, {0x000e, 0x0006}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000f, 0x0005}, {0x000e, 0x0009}, {0x000f, 0x0006}, {0x0010, 0x0006}, - {0x000f, 0x0007}, {0x000f, 0x0008}, {0x000f, 0x0009}, {0x0010, 0x0007}, {0x0010, 0x0008}, {0x0010, 0x0009}, {0x0011, 0x000a}, {0x0013, 0x0000}, - {0x0011, 0x000b}, {0x0013, 0x0001}, {0x0013, 0x0002}, {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0013, 0x0003}, {0x0013, 0x0004}, {0x0013, 0x0005}, - {0x0013, 0x0006}, {0x0013, 0x0007}, {0x0013, 0x0008}, {0x0013, 0x0009}, {0x0013, 0x000a}, {0x0013, 0x000b}, {0x0013, 0x000c}, {0x0013, 0x000d}, - {0x0013, 0x000e}, {0x0013, 0x000f}, {0x0013, 0x0010}, {0x0013, 0x0011}, {0x0013, 0x0012}, {0x0013, 0x0013}, {0x0013, 0x0014}, {0x0013, 0x0015}, - {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, - {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0012, 0x0013}, + { + { 0x0004, 0x0007 }, + { 0x0002, 0x0003 }, + { 0x0003, 0x0005 }, + { 0x0004, 0x0008 }, + { 0x0004, 0x0009 }, + { 0x0005, 0x0007 }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0006, 0x0007 }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0007, 0x0006 }, + { 0x0007, 0x0007 }, + { 0x0007, 0x0008 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0009, 0x0004 }, + { 0x0009, 0x0005 }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000b, 0x0004 }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0004 }, + { 0x000c, 0x0005 }, + { 0x000c, 0x0006 }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000c, 0x0007 }, + { 0x000e, 0x0005 }, + { 0x000e, 0x0006 }, + { 0x000e, 0x0007 }, + { 0x000e, 0x0008 }, + { 0x000f, 0x0005 }, + { 0x000e, 0x0009 }, + { 0x000f, 0x0006 }, + { 0x0010, 0x0006 }, + { 0x000f, 0x0007 }, + { 0x000f, 0x0008 }, + { 0x000f, 0x0009 }, + { 0x0010, 0x0007 }, + { 0x0010, 0x0008 }, + { 0x0010, 0x0009 }, + { 0x0011, 0x000a }, + { 0x0013, 0x0000 }, + { 0x0011, 0x000b }, + { 0x0013, 0x0001 }, + { 0x0013, 0x0002 }, + { 0x0012, 0x0011 }, + { 0x0012, 0x0012 }, + { 0x0013, 0x0003 }, + { 0x0013, 0x0004 }, + { 0x0013, 0x0005 }, + { 0x0013, 0x0006 }, + { 0x0013, 0x0007 }, + { 0x0013, 0x0008 }, + { 0x0013, 0x0009 }, + { 0x0013, 0x000a }, + { 0x0013, 0x000b }, + { 0x0013, 0x000c }, + { 0x0013, 0x000d }, + { 0x0013, 0x000e }, + { 0x0013, 0x000f }, + { 0x0013, 0x0010 }, + { 0x0013, 0x0011 }, + { 0x0013, 0x0012 }, + { 0x0013, 0x0013 }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0012, 0x0013 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec60[24][16] = -{ - {0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00010002, 0x00010002, 0x00020001, 0x00020001, 0x00020001, 0x00020001, }, - {0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, }, - {0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, }, - {0x000dffff, 0x000cffff, 0x0008ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0000001b, 0x0000001c, 0x0000001d, 0x0000001e, 0x0000001f, 0x00000020, 0x00010013, 0x00010013, 0x00010014, 0x00010014, }, - {0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030021, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, 0x00030022, }, - {0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030023, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, 0x00030024, }, - {0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030025, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, 0x00030026, }, - {0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030027, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, }, - {0x00020029, 0x00020029, 0x00020029, 0x00020029, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002a, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002b, 0x0002002c, 0x0002002c, 0x0002002c, 0x0002002c, }, - {0x0011ffff, 0x0010ffff, 0x000fffff, 0x000effff, 0x00000031, 0x00000032, 0x00000033, 0x00000037, 0x0001002d, 0x0001002d, 0x0001002e, 0x0001002e, 0x0001002f, 0x0001002f, 0x00010030, 0x00010030, }, - {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, - {0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, - {0x00010041, 0x00010041, 0x00010042, 0x00010042, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, }, - {0x0014ffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0013ffff, 0x0012ffff, 0x0000003f, 0x00000043, 0x00000044, 0x00000045, 0x0001003c, 0x0001003c, 0x0001003e, 0x0001003e, 0x00010040, 0x00010040, }, - {0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030046, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, 0x00030048, }, - {0x0001006a, 0x0001006a, 0x0001006b, 0x0001006b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004b, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002004c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, - {0x00010047, 0x00010047, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004d, 0x0001004d, 0x0001004e, 0x0001004e, 0x0001004f, 0x0001004f, 0x00010050, 0x00010050, 0x00010051, 0x00010051, }, - {0x00010052, 0x00010052, 0x00010053, 0x00010053, 0x00010054, 0x00010054, 0x00010055, 0x00010055, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, 0x00010059, 0x00010059, }, - {0x0001005a, 0x0001005a, 0x0001005b, 0x0001005b, 0x0001005c, 0x0001005c, 0x0001005d, 0x0001005d, 0x0001005e, 0x0001005e, 0x0001005f, 0x0001005f, 0x00010060, 0x00010060, 0x00010061, 0x00010061, }, - {0x00010062, 0x00010062, 0x00010063, 0x00010063, 0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x00010069, 0x00010069, }, +const uint32_t c_aauiCQMFHuffDec60[24][16] = { + { + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x00000000, + 0x00000003, + 0x00000004, + 0x00010002, + 0x00010002, + 0x00020001, + 0x00020001, + 0x00020001, + 0x00020001, + }, + { + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + }, + { + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + }, + { + 0x000dffff, + 0x000cffff, + 0x0008ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x0000001b, + 0x0000001c, + 0x0000001d, + 0x0000001e, + 0x0000001f, + 0x00000020, + 0x00010013, + 0x00010013, + 0x00010014, + 0x00010014, + }, + { + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030021, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + 0x00030022, + }, + { + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030023, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + 0x00030024, + }, + { + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030025, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + 0x00030026, + }, + { + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030027, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + }, + { + 0x00020029, + 0x00020029, + 0x00020029, + 0x00020029, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002a, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002b, + 0x0002002c, + 0x0002002c, + 0x0002002c, + 0x0002002c, + }, + { + 0x0011ffff, + 0x0010ffff, + 0x000fffff, + 0x000effff, + 0x00000031, + 0x00000032, + 0x00000033, + 0x00000037, + 0x0001002d, + 0x0001002d, + 0x0001002e, + 0x0001002e, + 0x0001002f, + 0x0001002f, + 0x00010030, + 0x00010030, + }, + { + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + }, + { + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + }, + { + 0x00010041, + 0x00010041, + 0x00010042, + 0x00010042, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + }, + { + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0013ffff, + 0x0012ffff, + 0x0000003f, + 0x00000043, + 0x00000044, + 0x00000045, + 0x0001003c, + 0x0001003c, + 0x0001003e, + 0x0001003e, + 0x00010040, + 0x00010040, + }, + { + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030046, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + 0x00030048, + }, + { + 0x0001006a, + 0x0001006a, + 0x0001006b, + 0x0001006b, + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004b, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002004c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + }, + { + 0x00010047, + 0x00010047, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004d, + 0x0001004d, + 0x0001004e, + 0x0001004e, + 0x0001004f, + 0x0001004f, + 0x00010050, + 0x00010050, + 0x00010051, + 0x00010051, + }, + { + 0x00010052, + 0x00010052, + 0x00010053, + 0x00010053, + 0x00010054, + 0x00010054, + 0x00010055, + 0x00010055, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + 0x00010059, + 0x00010059, + }, + { + 0x0001005a, + 0x0001005a, + 0x0001005b, + 0x0001005b, + 0x0001005c, + 0x0001005c, + 0x0001005d, + 0x0001005d, + 0x0001005e, + 0x0001005e, + 0x0001005f, + 0x0001005f, + 0x00010060, + 0x00010060, + 0x00010061, + 0x00010061, + }, + { + 0x00010062, + 0x00010062, + 0x00010063, + 0x00010063, + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x00010069, + 0x00010069, + }, }; #endif #ifndef ROM_TO_RAM @@ -3976,62 +41476,734 @@ const uint32_t c_aauiCQMFHuffEnc61[129][2] = #else const uint16_t c_aauiCQMFHuffEnc61[129][2] = #endif -{ - {0x0004, 0x0008}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x0009}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x0008}, {0x0005, 0x0009}, - {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0006, 0x0008}, {0x0006, 0x0009}, - {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0007, 0x0008}, {0x0007, 0x0009}, - {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0008, 0x0006}, {0x0008, 0x0007}, - {0x0008, 0x0008}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, {0x0008, 0x000f}, - {0x0009, 0x0006}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x000a, 0x0005}, {0x000a, 0x0006}, - {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000b, 0x0005}, {0x000b, 0x0006}, {0x000b, 0x0007}, - {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000c, 0x0006}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000d, 0x0005}, {0x000d, 0x0006}, - {0x000d, 0x0007}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000e, 0x0008}, {0x000d, 0x000b}, {0x000e, 0x0009}, {0x000f, 0x0009}, - {0x000f, 0x000a}, {0x000f, 0x000b}, {0x000f, 0x000c}, {0x000f, 0x000d}, {0x000f, 0x000e}, {0x0010, 0x000c}, {0x0011, 0x0015}, {0x0010, 0x000d}, - {0x000f, 0x000f}, {0x0010, 0x000e}, {0x0010, 0x000f}, {0x0012, 0x0000}, {0x0011, 0x0016}, {0x0010, 0x0010}, {0x0010, 0x0011}, {0x0011, 0x0017}, - {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, - {0x0012, 0x0009}, {0x0012, 0x000a}, {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, - {0x0012, 0x0011}, {0x0012, 0x0012}, {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0012, 0x0017}, {0x0012, 0x0018}, - {0x0012, 0x0019}, {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, {0x0012, 0x0020}, - {0x0012, 0x0021}, {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, {0x0012, 0x0028}, - {0x0012, 0x0029}, + { + { 0x0004, 0x0008 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x0009 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0005, 0x0008 }, + { 0x0005, 0x0009 }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0006, 0x0008 }, + { 0x0006, 0x0009 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0007, 0x0008 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0008, 0x0006 }, + { 0x0008, 0x0007 }, + { 0x0008, 0x0008 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0008, 0x000e }, + { 0x0008, 0x000f }, + { 0x0009, 0x0006 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000a, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000b, 0x0005 }, + { 0x000b, 0x0006 }, + { 0x000b, 0x0007 }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000c, 0x0006 }, + { 0x000c, 0x0007 }, + { 0x000c, 0x0008 }, + { 0x000c, 0x0009 }, + { 0x000d, 0x0005 }, + { 0x000d, 0x0006 }, + { 0x000d, 0x0007 }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000d, 0x000a }, + { 0x000e, 0x0008 }, + { 0x000d, 0x000b }, + { 0x000e, 0x0009 }, + { 0x000f, 0x0009 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, + { 0x000f, 0x000c }, + { 0x000f, 0x000d }, + { 0x000f, 0x000e }, + { 0x0010, 0x000c }, + { 0x0011, 0x0015 }, + { 0x0010, 0x000d }, + { 0x000f, 0x000f }, + { 0x0010, 0x000e }, + { 0x0010, 0x000f }, + { 0x0012, 0x0000 }, + { 0x0011, 0x0016 }, + { 0x0010, 0x0010 }, + { 0x0010, 0x0011 }, + { 0x0011, 0x0017 }, + { 0x0012, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, + { 0x0012, 0x000c }, + { 0x0012, 0x000d }, + { 0x0012, 0x000e }, + { 0x0012, 0x000f }, + { 0x0012, 0x0010 }, + { 0x0012, 0x0011 }, + { 0x0012, 0x0012 }, + { 0x0012, 0x0013 }, + { 0x0012, 0x0014 }, + { 0x0012, 0x0015 }, + { 0x0012, 0x0016 }, + { 0x0012, 0x0017 }, + { 0x0012, 0x0018 }, + { 0x0012, 0x0019 }, + { 0x0012, 0x001a }, + { 0x0012, 0x001b }, + { 0x0012, 0x001c }, + { 0x0012, 0x001d }, + { 0x0012, 0x001e }, + { 0x0012, 0x001f }, + { 0x0012, 0x0020 }, + { 0x0012, 0x0021 }, + { 0x0012, 0x0022 }, + { 0x0012, 0x0023 }, + { 0x0012, 0x0024 }, + { 0x0012, 0x0025 }, + { 0x0012, 0x0026 }, + { 0x0012, 0x0027 }, + { 0x0012, 0x0028 }, + { 0x0012, 0x0029 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec61[33][16] = -{ - {0x0008ffff, 0x0007ffff, 0x0005ffff, 0x0006ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00000005, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, }, - {0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, }, - {0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, 0x0003000d, }, - {0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, }, - {0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, }, - {0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, }, - {0x000effff, 0x000cffff, 0x000dffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x0000001e, 0x0000001f, 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, }, - {0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030028, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, 0x00030029, }, - {0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002a, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x00010038, 0x00010038, 0x00010039, 0x00010039, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002e, 0x0002002f, 0x0002002f, 0x0002002f, 0x0002002f, 0x00020030, 0x00020030, 0x00020030, 0x00020030, }, - {0x00020031, 0x00020031, 0x00020031, 0x00020031, 0x00020032, 0x00020032, 0x00020032, 0x00020032, 0x00020033, 0x00020033, 0x00020033, 0x00020033, 0x00020034, 0x00020034, 0x00020034, 0x00020034, }, - {0x0014ffff, 0x0013ffff, 0x000fffff, 0x0010ffff, 0x0011ffff, 0x0012ffff, 0x0000003a, 0x0000003b, 0x0000003c, 0x0000003d, 0x00010035, 0x00010035, 0x00010036, 0x00010036, 0x00010037, 0x00010037, }, - {0x00020044, 0x00020044, 0x00020044, 0x00020044, 0x00020046, 0x00020046, 0x00020046, 0x00020046, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, 0x0003003e, }, - {0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x0003003f, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, 0x00030040, }, - {0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030041, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, 0x00030042, }, - {0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030043, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, 0x00030045, }, - {0x00000055, 0x00000056, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x0001004a, 0x0001004a, 0x0001004b, 0x0001004b, 0x0001004c, 0x0001004c, 0x00010050, 0x00010050, }, - {0x0017ffff, 0x0018ffff, 0x0019ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0016ffff, 0x0015ffff, 0x0000004d, 0x0000004f, 0x00000051, 0x00000052, }, - {0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, }, - {0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, }, - {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020058, 0x00020058, 0x00020058, 0x00020058, 0x00020059, 0x00020059, 0x00020059, 0x00020059, 0x0002005a, 0x0002005a, 0x0002005a, 0x0002005a, }, - {0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, }, - {0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, 0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, }, - {0x00020063, 0x00020063, 0x00020063, 0x00020063, 0x00020064, 0x00020064, 0x00020064, 0x00020064, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, }, - {0x00020067, 0x00020067, 0x00020067, 0x00020067, 0x00020068, 0x00020068, 0x00020068, 0x00020068, 0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, }, - {0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, }, - {0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, 0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020072, 0x00020072, 0x00020072, 0x00020072, }, - {0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, }, - {0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, - {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, }, +const uint32_t c_aauiCQMFHuffDec61[33][16] = { + { + 0x0008ffff, + 0x0007ffff, + 0x0005ffff, + 0x0006ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x00000000, + 0x00000003, + 0x00000004, + 0x00000005, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + }, + { + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + }, + { + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + 0x0003000d, + }, + { + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + }, + { + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + }, + { + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + }, + { + 0x000effff, + 0x000cffff, + 0x000dffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x0000001e, + 0x0000001f, + 0x00000020, + 0x00000021, + 0x00000022, + 0x00000023, + 0x00000024, + 0x00000025, + 0x00000026, + 0x00000027, + }, + { + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030028, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + 0x00030029, + }, + { + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002a, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + }, + { + 0x00010038, + 0x00010038, + 0x00010039, + 0x00010039, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002e, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x0002002f, + 0x00020030, + 0x00020030, + 0x00020030, + 0x00020030, + }, + { + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020031, + 0x00020032, + 0x00020032, + 0x00020032, + 0x00020032, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020033, + 0x00020034, + 0x00020034, + 0x00020034, + 0x00020034, + }, + { + 0x0014ffff, + 0x0013ffff, + 0x000fffff, + 0x0010ffff, + 0x0011ffff, + 0x0012ffff, + 0x0000003a, + 0x0000003b, + 0x0000003c, + 0x0000003d, + 0x00010035, + 0x00010035, + 0x00010036, + 0x00010036, + 0x00010037, + 0x00010037, + }, + { + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020044, + 0x00020046, + 0x00020046, + 0x00020046, + 0x00020046, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + 0x0003003e, + }, + { + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x0003003f, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + 0x00030040, + }, + { + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030041, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + 0x00030042, + }, + { + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030043, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + 0x00030045, + }, + { + 0x00000055, + 0x00000056, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x0001004a, + 0x0001004a, + 0x0001004b, + 0x0001004b, + 0x0001004c, + 0x0001004c, + 0x00010050, + 0x00010050, + }, + { + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0016ffff, + 0x0015ffff, + 0x0000004d, + 0x0000004f, + 0x00000051, + 0x00000052, + }, + { + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + }, + { + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + }, + { + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020058, + 0x00020059, + 0x00020059, + 0x00020059, + 0x00020059, + 0x0002005a, + 0x0002005a, + 0x0002005a, + 0x0002005a, + }, + { + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005e, + }, + { + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + }, + { + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020064, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020066, + }, + { + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020068, + 0x00020068, + 0x00020068, + 0x00020068, + 0x00020069, + 0x00020069, + 0x00020069, + 0x00020069, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006a, + }, + { + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + }, + { + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020072, + }, + { + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + }, + { + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007a, + }, + { + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007e, + }, }; #endif #ifndef ROM_TO_RAM @@ -4039,73 +42211,902 @@ const uint32_t c_aauiCQMFHuffEnc62[153][2] = #else const uint16_t c_aauiCQMFHuffEnc62[153][2] = #endif -{ - {0x0004, 0x0009}, {0x0003, 0x0006}, {0x0003, 0x0007}, {0x0004, 0x000a}, {0x0004, 0x000b}, {0x0005, 0x000a}, {0x0005, 0x000b}, {0x0005, 0x000c}, - {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, {0x0005, 0x0010}, {0x0005, 0x0011}, {0x0006, 0x000a}, {0x0006, 0x000b}, {0x0006, 0x000c}, - {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, {0x0007, 0x0009}, - {0x0007, 0x000a}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, - {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0008, 0x0009}, {0x0008, 0x000a}, {0x0008, 0x000b}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, - {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0009, 0x0007}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, - {0x0009, 0x000c}, {0x0009, 0x000d}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x000a, 0x0004}, {0x000a, 0x0005}, - {0x000a, 0x0006}, {0x000a, 0x0007}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, {0x000a, 0x000c}, {0x000a, 0x000d}, - {0x000b, 0x0007}, {0x000c, 0x0007}, {0x000c, 0x0008}, {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000d, 0x0007}, - {0x000c, 0x000d}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000e, 0x0008}, {0x000d, 0x000c}, {0x000d, 0x000d}, - {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000e, 0x000b}, {0x000e, 0x000c}, {0x000f, 0x000c}, {0x000e, 0x000d}, {0x000f, 0x000d}, {0x000f, 0x000e}, - {0x000f, 0x000f}, {0x0010, 0x000f}, {0x0010, 0x0010}, {0x0011, 0x0019}, {0x0010, 0x0011}, {0x0010, 0x0012}, {0x0010, 0x0013}, {0x0010, 0x0014}, - {0x0010, 0x0015}, {0x0012, 0x0000}, {0x0010, 0x0016}, {0x0011, 0x001a}, {0x0010, 0x0017}, {0x0012, 0x0001}, {0x0012, 0x0002}, {0x0012, 0x0003}, - {0x0011, 0x001b}, {0x0012, 0x0004}, {0x0012, 0x0005}, {0x0012, 0x0006}, {0x0012, 0x0007}, {0x0012, 0x0008}, {0x0012, 0x0009}, {0x0012, 0x000a}, - {0x0012, 0x000b}, {0x0012, 0x000c}, {0x0012, 0x000d}, {0x0012, 0x000e}, {0x0012, 0x000f}, {0x0012, 0x0010}, {0x0012, 0x0011}, {0x0012, 0x0012}, - {0x0012, 0x0013}, {0x0012, 0x0014}, {0x0012, 0x0015}, {0x0012, 0x0016}, {0x0012, 0x0017}, {0x0012, 0x0018}, {0x0011, 0x001c}, {0x0012, 0x0019}, - {0x0012, 0x001a}, {0x0012, 0x001b}, {0x0012, 0x001c}, {0x0012, 0x001d}, {0x0012, 0x001e}, {0x0012, 0x001f}, {0x0012, 0x0020}, {0x0012, 0x0021}, - {0x0012, 0x0022}, {0x0012, 0x0023}, {0x0012, 0x0024}, {0x0012, 0x0025}, {0x0012, 0x0026}, {0x0012, 0x0027}, {0x0012, 0x0028}, {0x0012, 0x0029}, - {0x0012, 0x002a}, {0x0012, 0x002b}, {0x0012, 0x002c}, {0x0012, 0x002d}, {0x0012, 0x002e}, {0x0012, 0x002f}, {0x0012, 0x0030}, {0x0012, 0x0031}, - {0x0011, 0x001d}, + { + { 0x0004, 0x0009 }, + { 0x0003, 0x0006 }, + { 0x0003, 0x0007 }, + { 0x0004, 0x000a }, + { 0x0004, 0x000b }, + { 0x0005, 0x000a }, + { 0x0005, 0x000b }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0005, 0x0010 }, + { 0x0005, 0x0011 }, + { 0x0006, 0x000a }, + { 0x0006, 0x000b }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0007, 0x0009 }, + { 0x0007, 0x000a }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0007, 0x0012 }, + { 0x0007, 0x0013 }, + { 0x0008, 0x0009 }, + { 0x0008, 0x000a }, + { 0x0008, 0x000b }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0008, 0x000e }, + { 0x0008, 0x000f }, + { 0x0008, 0x0010 }, + { 0x0008, 0x0011 }, + { 0x0009, 0x0007 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x0009, 0x000c }, + { 0x0009, 0x000d }, + { 0x0009, 0x000e }, + { 0x0009, 0x000f }, + { 0x0009, 0x0010 }, + { 0x0009, 0x0011 }, + { 0x000a, 0x0004 }, + { 0x000a, 0x0005 }, + { 0x000a, 0x0006 }, + { 0x000a, 0x0007 }, + { 0x000a, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000b, 0x0007 }, + { 0x000c, 0x0007 }, + { 0x000c, 0x0008 }, + { 0x000c, 0x0009 }, + { 0x000c, 0x000a }, + { 0x000c, 0x000b }, + { 0x000c, 0x000c }, + { 0x000d, 0x0007 }, + { 0x000c, 0x000d }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000d, 0x000a }, + { 0x000d, 0x000b }, + { 0x000e, 0x0008 }, + { 0x000d, 0x000c }, + { 0x000d, 0x000d }, + { 0x000e, 0x0009 }, + { 0x000e, 0x000a }, + { 0x000e, 0x000b }, + { 0x000e, 0x000c }, + { 0x000f, 0x000c }, + { 0x000e, 0x000d }, + { 0x000f, 0x000d }, + { 0x000f, 0x000e }, + { 0x000f, 0x000f }, + { 0x0010, 0x000f }, + { 0x0010, 0x0010 }, + { 0x0011, 0x0019 }, + { 0x0010, 0x0011 }, + { 0x0010, 0x0012 }, + { 0x0010, 0x0013 }, + { 0x0010, 0x0014 }, + { 0x0010, 0x0015 }, + { 0x0012, 0x0000 }, + { 0x0010, 0x0016 }, + { 0x0011, 0x001a }, + { 0x0010, 0x0017 }, + { 0x0012, 0x0001 }, + { 0x0012, 0x0002 }, + { 0x0012, 0x0003 }, + { 0x0011, 0x001b }, + { 0x0012, 0x0004 }, + { 0x0012, 0x0005 }, + { 0x0012, 0x0006 }, + { 0x0012, 0x0007 }, + { 0x0012, 0x0008 }, + { 0x0012, 0x0009 }, + { 0x0012, 0x000a }, + { 0x0012, 0x000b }, + { 0x0012, 0x000c }, + { 0x0012, 0x000d }, + { 0x0012, 0x000e }, + { 0x0012, 0x000f }, + { 0x0012, 0x0010 }, + { 0x0012, 0x0011 }, + { 0x0012, 0x0012 }, + { 0x0012, 0x0013 }, + { 0x0012, 0x0014 }, + { 0x0012, 0x0015 }, + { 0x0012, 0x0016 }, + { 0x0012, 0x0017 }, + { 0x0012, 0x0018 }, + { 0x0011, 0x001c }, + { 0x0012, 0x0019 }, + { 0x0012, 0x001a }, + { 0x0012, 0x001b }, + { 0x0012, 0x001c }, + { 0x0012, 0x001d }, + { 0x0012, 0x001e }, + { 0x0012, 0x001f }, + { 0x0012, 0x0020 }, + { 0x0012, 0x0021 }, + { 0x0012, 0x0022 }, + { 0x0012, 0x0023 }, + { 0x0012, 0x0024 }, + { 0x0012, 0x0025 }, + { 0x0012, 0x0026 }, + { 0x0012, 0x0027 }, + { 0x0012, 0x0028 }, + { 0x0012, 0x0029 }, + { 0x0012, 0x002a }, + { 0x0012, 0x002b }, + { 0x0012, 0x002c }, + { 0x0012, 0x002d }, + { 0x0012, 0x002e }, + { 0x0012, 0x002f }, + { 0x0012, 0x0030 }, + { 0x0012, 0x0031 }, + { 0x0011, 0x001d }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec62[41][16] = -{ - {0x0009ffff, 0x0008ffff, 0x0005ffff, 0x0006ffff, 0x0007ffff, 0x0001ffff, 0x0002ffff, 0x0003ffff, 0x0004ffff, 0x00000000, 0x00000003, 0x00000004, 0x00010001, 0x00010001, 0x00010002, 0x00010002, }, - {0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, }, - {0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, 0x00030008, }, - {0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x00030009, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, 0x0003000a, }, - {0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000b, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, 0x0003000c, }, - {0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, 0x00010021, 0x00010021, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, }, - {0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, 0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, }, - {0x00020013, 0x00020013, 0x00020013, 0x00020013, 0x00020014, 0x00020014, 0x00020014, 0x00020014, 0x00020015, 0x00020015, 0x00020015, 0x00020015, 0x00020016, 0x00020016, 0x00020016, 0x00020016, }, - {0x00000029, 0x0000002a, 0x00010017, 0x00010017, 0x00010018, 0x00010018, 0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, }, - {0x0012ffff, 0x0010ffff, 0x0011ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, }, - {0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, }, - {0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, }, - {0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, }, - {0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, }, - {0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, }, - {0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, }, - {0x00020036, 0x00020036, 0x00020036, 0x00020036, 0x00020037, 0x00020037, 0x00020037, 0x00020037, 0x00020038, 0x00020038, 0x00020038, 0x00020038, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x0002003a, 0x0002003a, 0x0002003a, 0x0002003a, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003b, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, }, - {0x0019ffff, 0x0018ffff, 0x0017ffff, 0x0013ffff, 0x0014ffff, 0x0015ffff, 0x0016ffff, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000048, 0x00010040, 0x00010040, }, - {0x00020053, 0x00020053, 0x00020053, 0x00020053, 0x00020055, 0x00020055, 0x00020055, 0x00020055, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, 0x00030047, }, - {0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x00030049, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, 0x0003004a, }, - {0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004b, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, 0x0003004c, }, - {0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004e, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, 0x0003004f, }, - {0x0002004d, 0x0002004d, 0x0002004d, 0x0002004d, 0x00020050, 0x00020050, 0x00020050, 0x00020050, 0x00020051, 0x00020051, 0x00020051, 0x00020051, 0x00020052, 0x00020052, 0x00020052, 0x00020052, }, - {0x0000005a, 0x0000005c, 0x0000005d, 0x0000005e, 0x0000005f, 0x00000060, 0x00000062, 0x00000064, 0x00010054, 0x00010054, 0x00010056, 0x00010056, 0x00010057, 0x00010057, 0x00010058, 0x00010058, }, - {0x001dffff, 0x001effff, 0x001fffff, 0x0020ffff, 0x0021ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0025ffff, 0x0026ffff, 0x0027ffff, 0x0028ffff, 0x001affff, 0x001bffff, 0x001cffff, 0x00000059, }, - {0x00020096, 0x00020096, 0x00020096, 0x00020096, 0x00020097, 0x00020097, 0x00020097, 0x00020097, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, 0x0003005b, }, - {0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030063, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, 0x00030068, }, - {0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x0003007e, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, 0x00030098, }, - {0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020065, 0x00020065, 0x00020065, 0x00020065, 0x00020066, 0x00020066, 0x00020066, 0x00020066, 0x00020067, 0x00020067, 0x00020067, 0x00020067, }, - {0x00020069, 0x00020069, 0x00020069, 0x00020069, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006a, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006b, 0x0002006c, 0x0002006c, 0x0002006c, 0x0002006c, }, - {0x0002006d, 0x0002006d, 0x0002006d, 0x0002006d, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006e, 0x0002006f, 0x0002006f, 0x0002006f, 0x0002006f, 0x00020070, 0x00020070, 0x00020070, 0x00020070, }, - {0x00020071, 0x00020071, 0x00020071, 0x00020071, 0x00020072, 0x00020072, 0x00020072, 0x00020072, 0x00020073, 0x00020073, 0x00020073, 0x00020073, 0x00020074, 0x00020074, 0x00020074, 0x00020074, }, - {0x00020075, 0x00020075, 0x00020075, 0x00020075, 0x00020076, 0x00020076, 0x00020076, 0x00020076, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, }, - {0x00020079, 0x00020079, 0x00020079, 0x00020079, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, }, - {0x0002007d, 0x0002007d, 0x0002007d, 0x0002007d, 0x0002007f, 0x0002007f, 0x0002007f, 0x0002007f, 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020081, 0x00020081, 0x00020081, 0x00020081, }, - {0x00020082, 0x00020082, 0x00020082, 0x00020082, 0x00020083, 0x00020083, 0x00020083, 0x00020083, 0x00020084, 0x00020084, 0x00020084, 0x00020084, 0x00020085, 0x00020085, 0x00020085, 0x00020085, }, - {0x00020086, 0x00020086, 0x00020086, 0x00020086, 0x00020087, 0x00020087, 0x00020087, 0x00020087, 0x00020088, 0x00020088, 0x00020088, 0x00020088, 0x00020089, 0x00020089, 0x00020089, 0x00020089, }, - {0x0002008a, 0x0002008a, 0x0002008a, 0x0002008a, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008b, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008c, 0x0002008d, 0x0002008d, 0x0002008d, 0x0002008d, }, - {0x0002008e, 0x0002008e, 0x0002008e, 0x0002008e, 0x0002008f, 0x0002008f, 0x0002008f, 0x0002008f, 0x00020090, 0x00020090, 0x00020090, 0x00020090, 0x00020091, 0x00020091, 0x00020091, 0x00020091, }, - {0x00020092, 0x00020092, 0x00020092, 0x00020092, 0x00020093, 0x00020093, 0x00020093, 0x00020093, 0x00020094, 0x00020094, 0x00020094, 0x00020094, 0x00020095, 0x00020095, 0x00020095, 0x00020095, }, +const uint32_t c_aauiCQMFHuffDec62[41][16] = { + { + 0x0009ffff, + 0x0008ffff, + 0x0005ffff, + 0x0006ffff, + 0x0007ffff, + 0x0001ffff, + 0x0002ffff, + 0x0003ffff, + 0x0004ffff, + 0x00000000, + 0x00000003, + 0x00000004, + 0x00010001, + 0x00010001, + 0x00010002, + 0x00010002, + }, + { + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + }, + { + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + 0x00030008, + }, + { + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x00030009, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + 0x0003000a, + }, + { + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000b, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + 0x0003000c, + }, + { + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x00010020, + 0x00010020, + 0x00010021, + 0x00010021, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + }, + { + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + }, + { + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020014, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020015, + 0x00020016, + 0x00020016, + 0x00020016, + 0x00020016, + }, + { + 0x00000029, + 0x0000002a, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + }, + { + 0x0012ffff, + 0x0010ffff, + 0x0011ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x00000022, + 0x00000023, + 0x00000024, + 0x00000025, + 0x00000026, + 0x00000027, + 0x00000028, + }, + { + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + }, + { + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + }, + { + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + }, + { + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + }, + { + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + }, + { + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + }, + { + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020036, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020037, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020038, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003a, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003b, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + }, + { + 0x0019ffff, + 0x0018ffff, + 0x0017ffff, + 0x0013ffff, + 0x0014ffff, + 0x0015ffff, + 0x0016ffff, + 0x00000041, + 0x00000042, + 0x00000043, + 0x00000044, + 0x00000045, + 0x00000046, + 0x00000048, + 0x00010040, + 0x00010040, + }, + { + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020053, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00020055, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + 0x00030047, + }, + { + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x00030049, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + 0x0003004a, + }, + { + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004b, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + 0x0003004c, + }, + { + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004e, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + 0x0003004f, + }, + { + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x0002004d, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020050, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020051, + 0x00020052, + 0x00020052, + 0x00020052, + 0x00020052, + }, + { + 0x0000005a, + 0x0000005c, + 0x0000005d, + 0x0000005e, + 0x0000005f, + 0x00000060, + 0x00000062, + 0x00000064, + 0x00010054, + 0x00010054, + 0x00010056, + 0x00010056, + 0x00010057, + 0x00010057, + 0x00010058, + 0x00010058, + }, + { + 0x001dffff, + 0x001effff, + 0x001fffff, + 0x0020ffff, + 0x0021ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0025ffff, + 0x0026ffff, + 0x0027ffff, + 0x0028ffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x00000059, + }, + { + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020096, + 0x00020097, + 0x00020097, + 0x00020097, + 0x00020097, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + 0x0003005b, + }, + { + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030063, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + 0x00030068, + }, + { + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x0003007e, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + 0x00030098, + }, + { + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020065, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020066, + 0x00020067, + 0x00020067, + 0x00020067, + 0x00020067, + }, + { + 0x00020069, + 0x00020069, + 0x00020069, + 0x00020069, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006a, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006b, + 0x0002006c, + 0x0002006c, + 0x0002006c, + 0x0002006c, + }, + { + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006d, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006e, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x0002006f, + 0x00020070, + 0x00020070, + 0x00020070, + 0x00020070, + }, + { + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020071, + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020072, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020073, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + }, + { + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020075, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020076, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + }, + { + 0x00020079, + 0x00020079, + 0x00020079, + 0x00020079, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + }, + { + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007d, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x0002007f, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020081, + 0x00020081, + 0x00020081, + 0x00020081, + }, + { + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020082, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020083, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020084, + 0x00020085, + 0x00020085, + 0x00020085, + 0x00020085, + }, + { + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020086, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020087, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020088, + 0x00020089, + 0x00020089, + 0x00020089, + 0x00020089, + }, + { + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008a, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008b, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008c, + 0x0002008d, + 0x0002008d, + 0x0002008d, + 0x0002008d, + }, + { + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008e, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x0002008f, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020090, + 0x00020091, + 0x00020091, + 0x00020091, + 0x00020091, + }, + { + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020092, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020093, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020094, + 0x00020095, + 0x00020095, + 0x00020095, + 0x00020095, + }, }; #endif #ifndef ROM_TO_RAM @@ -4113,150 +43114,970 @@ const uint32_t c_aauiCQMFHuffEnc63[181][2] = #else const uint16_t c_aauiCQMFHuffEnc63[181][2] = #endif -{ - {0x0004, 0x0008}, {0x0003, 0x0005}, {0x0002, 0x0003}, {0x0004, 0x0009}, {0x0005, 0x000c}, {0x0005, 0x000d}, {0x0005, 0x000e}, {0x0005, 0x000f}, - {0x0006, 0x000c}, {0x0006, 0x000d}, {0x0006, 0x000e}, {0x0006, 0x000f}, {0x0006, 0x0010}, {0x0006, 0x0011}, {0x0006, 0x0012}, {0x0006, 0x0013}, - {0x0006, 0x0014}, {0x0006, 0x0015}, {0x0006, 0x0016}, {0x0006, 0x0017}, {0x0007, 0x000b}, {0x0007, 0x000c}, {0x0007, 0x000d}, {0x0007, 0x000e}, - {0x0007, 0x000f}, {0x0007, 0x0010}, {0x0007, 0x0011}, {0x0007, 0x0012}, {0x0007, 0x0013}, {0x0007, 0x0014}, {0x0007, 0x0015}, {0x0007, 0x0016}, - {0x0007, 0x0017}, {0x0008, 0x000c}, {0x0008, 0x000d}, {0x0008, 0x000e}, {0x0008, 0x000f}, {0x0008, 0x0010}, {0x0008, 0x0011}, {0x0008, 0x0012}, - {0x0008, 0x0013}, {0x0008, 0x0014}, {0x0008, 0x0015}, {0x0009, 0x0008}, {0x0009, 0x0009}, {0x0009, 0x000a}, {0x0009, 0x000b}, {0x0009, 0x000c}, - {0x0009, 0x000d}, {0x0009, 0x000e}, {0x0009, 0x000f}, {0x0009, 0x0010}, {0x0009, 0x0011}, {0x0009, 0x0012}, {0x0009, 0x0013}, {0x0009, 0x0014}, - {0x0009, 0x0015}, {0x000a, 0x0007}, {0x0009, 0x0016}, {0x0009, 0x0017}, {0x000a, 0x0008}, {0x000a, 0x0009}, {0x000a, 0x000a}, {0x000a, 0x000b}, - {0x000a, 0x000c}, {0x000a, 0x000d}, {0x000a, 0x000e}, {0x000b, 0x0008}, {0x000b, 0x0009}, {0x000b, 0x000a}, {0x000a, 0x000f}, {0x000b, 0x000b}, - {0x000b, 0x000c}, {0x000b, 0x000d}, {0x000c, 0x0009}, {0x000c, 0x000a}, {0x000c, 0x000b}, {0x000c, 0x000c}, {0x000c, 0x000d}, {0x000c, 0x000e}, - {0x000c, 0x000f}, {0x000d, 0x0008}, {0x000d, 0x0009}, {0x000d, 0x000a}, {0x000d, 0x000b}, {0x000d, 0x000c}, {0x000d, 0x000d}, {0x000d, 0x000e}, - {0x000d, 0x000f}, {0x000d, 0x0010}, {0x000d, 0x0011}, {0x000e, 0x0007}, {0x000e, 0x0008}, {0x000e, 0x0009}, {0x000e, 0x000a}, {0x000e, 0x000b}, - {0x000e, 0x000c}, {0x000e, 0x000d}, {0x000e, 0x000e}, {0x000e, 0x000f}, {0x000f, 0x0008}, {0x000f, 0x0009}, {0x000f, 0x000a}, {0x000f, 0x000b}, - {0x000f, 0x000c}, {0x0010, 0x0009}, {0x0010, 0x000a}, {0x000f, 0x000d}, {0x0010, 0x000b}, {0x0010, 0x000c}, {0x0010, 0x000d}, {0x0011, 0x000e}, - {0x0011, 0x000f}, {0x0010, 0x000e}, {0x0011, 0x0010}, {0x0011, 0x0011}, {0x0012, 0x0014}, {0x0014, 0x0000}, {0x0010, 0x000f}, {0x0012, 0x0015}, - {0x0012, 0x0016}, {0x0014, 0x0001}, {0x0012, 0x0017}, {0x0012, 0x0018}, {0x0012, 0x0019}, {0x0013, 0x0010}, {0x0012, 0x001a}, {0x0014, 0x0002}, - {0x0012, 0x001b}, {0x0014, 0x0003}, {0x0014, 0x0004}, {0x0014, 0x0005}, {0x0013, 0x0011}, {0x0014, 0x0006}, {0x0013, 0x0012}, {0x0014, 0x0007}, - {0x0014, 0x0008}, {0x0014, 0x0009}, {0x0014, 0x000a}, {0x0014, 0x000b}, {0x0014, 0x000c}, {0x0014, 0x000d}, {0x0014, 0x000e}, {0x0013, 0x0013}, - {0x0014, 0x000f}, {0x0014, 0x0010}, {0x0014, 0x0011}, {0x0014, 0x0012}, {0x0014, 0x0013}, {0x0014, 0x0014}, {0x0014, 0x0015}, {0x0014, 0x0016}, - {0x0014, 0x0017}, {0x0014, 0x0018}, {0x0014, 0x0019}, {0x0014, 0x001a}, {0x0014, 0x001b}, {0x0014, 0x001c}, {0x0014, 0x001d}, {0x0014, 0x001e}, - {0x0014, 0x001f}, {0x0013, 0x0014}, {0x0013, 0x0015}, {0x0013, 0x0016}, {0x0013, 0x0017}, {0x0013, 0x0018}, {0x0013, 0x0019}, {0x0013, 0x001a}, - {0x0013, 0x001b}, {0x0013, 0x001c}, {0x0013, 0x001d}, {0x0013, 0x001e}, {0x0013, 0x001f}, {0x0013, 0x0020}, {0x0013, 0x0021}, {0x0013, 0x0022}, - {0x0013, 0x0023}, {0x0013, 0x0024}, {0x0013, 0x0025}, {0x0013, 0x0026}, {0x0013, 0x0027}, + { + { 0x0004, 0x0008 }, + { 0x0003, 0x0005 }, + { 0x0002, 0x0003 }, + { 0x0004, 0x0009 }, + { 0x0005, 0x000c }, + { 0x0005, 0x000d }, + { 0x0005, 0x000e }, + { 0x0005, 0x000f }, + { 0x0006, 0x000c }, + { 0x0006, 0x000d }, + { 0x0006, 0x000e }, + { 0x0006, 0x000f }, + { 0x0006, 0x0010 }, + { 0x0006, 0x0011 }, + { 0x0006, 0x0012 }, + { 0x0006, 0x0013 }, + { 0x0006, 0x0014 }, + { 0x0006, 0x0015 }, + { 0x0006, 0x0016 }, + { 0x0006, 0x0017 }, + { 0x0007, 0x000b }, + { 0x0007, 0x000c }, + { 0x0007, 0x000d }, + { 0x0007, 0x000e }, + { 0x0007, 0x000f }, + { 0x0007, 0x0010 }, + { 0x0007, 0x0011 }, + { 0x0007, 0x0012 }, + { 0x0007, 0x0013 }, + { 0x0007, 0x0014 }, + { 0x0007, 0x0015 }, + { 0x0007, 0x0016 }, + { 0x0007, 0x0017 }, + { 0x0008, 0x000c }, + { 0x0008, 0x000d }, + { 0x0008, 0x000e }, + { 0x0008, 0x000f }, + { 0x0008, 0x0010 }, + { 0x0008, 0x0011 }, + { 0x0008, 0x0012 }, + { 0x0008, 0x0013 }, + { 0x0008, 0x0014 }, + { 0x0008, 0x0015 }, + { 0x0009, 0x0008 }, + { 0x0009, 0x0009 }, + { 0x0009, 0x000a }, + { 0x0009, 0x000b }, + { 0x0009, 0x000c }, + { 0x0009, 0x000d }, + { 0x0009, 0x000e }, + { 0x0009, 0x000f }, + { 0x0009, 0x0010 }, + { 0x0009, 0x0011 }, + { 0x0009, 0x0012 }, + { 0x0009, 0x0013 }, + { 0x0009, 0x0014 }, + { 0x0009, 0x0015 }, + { 0x000a, 0x0007 }, + { 0x0009, 0x0016 }, + { 0x0009, 0x0017 }, + { 0x000a, 0x0008 }, + { 0x000a, 0x0009 }, + { 0x000a, 0x000a }, + { 0x000a, 0x000b }, + { 0x000a, 0x000c }, + { 0x000a, 0x000d }, + { 0x000a, 0x000e }, + { 0x000b, 0x0008 }, + { 0x000b, 0x0009 }, + { 0x000b, 0x000a }, + { 0x000a, 0x000f }, + { 0x000b, 0x000b }, + { 0x000b, 0x000c }, + { 0x000b, 0x000d }, + { 0x000c, 0x0009 }, + { 0x000c, 0x000a }, + { 0x000c, 0x000b }, + { 0x000c, 0x000c }, + { 0x000c, 0x000d }, + { 0x000c, 0x000e }, + { 0x000c, 0x000f }, + { 0x000d, 0x0008 }, + { 0x000d, 0x0009 }, + { 0x000d, 0x000a }, + { 0x000d, 0x000b }, + { 0x000d, 0x000c }, + { 0x000d, 0x000d }, + { 0x000d, 0x000e }, + { 0x000d, 0x000f }, + { 0x000d, 0x0010 }, + { 0x000d, 0x0011 }, + { 0x000e, 0x0007 }, + { 0x000e, 0x0008 }, + { 0x000e, 0x0009 }, + { 0x000e, 0x000a }, + { 0x000e, 0x000b }, + { 0x000e, 0x000c }, + { 0x000e, 0x000d }, + { 0x000e, 0x000e }, + { 0x000e, 0x000f }, + { 0x000f, 0x0008 }, + { 0x000f, 0x0009 }, + { 0x000f, 0x000a }, + { 0x000f, 0x000b }, + { 0x000f, 0x000c }, + { 0x0010, 0x0009 }, + { 0x0010, 0x000a }, + { 0x000f, 0x000d }, + { 0x0010, 0x000b }, + { 0x0010, 0x000c }, + { 0x0010, 0x000d }, + { 0x0011, 0x000e }, + { 0x0011, 0x000f }, + { 0x0010, 0x000e }, + { 0x0011, 0x0010 }, + { 0x0011, 0x0011 }, + { 0x0012, 0x0014 }, + { 0x0014, 0x0000 }, + { 0x0010, 0x000f }, + { 0x0012, 0x0015 }, + { 0x0012, 0x0016 }, + { 0x0014, 0x0001 }, + { 0x0012, 0x0017 }, + { 0x0012, 0x0018 }, + { 0x0012, 0x0019 }, + { 0x0013, 0x0010 }, + { 0x0012, 0x001a }, + { 0x0014, 0x0002 }, + { 0x0012, 0x001b }, + { 0x0014, 0x0003 }, + { 0x0014, 0x0004 }, + { 0x0014, 0x0005 }, + { 0x0013, 0x0011 }, + { 0x0014, 0x0006 }, + { 0x0013, 0x0012 }, + { 0x0014, 0x0007 }, + { 0x0014, 0x0008 }, + { 0x0014, 0x0009 }, + { 0x0014, 0x000a }, + { 0x0014, 0x000b }, + { 0x0014, 0x000c }, + { 0x0014, 0x000d }, + { 0x0014, 0x000e }, + { 0x0013, 0x0013 }, + { 0x0014, 0x000f }, + { 0x0014, 0x0010 }, + { 0x0014, 0x0011 }, + { 0x0014, 0x0012 }, + { 0x0014, 0x0013 }, + { 0x0014, 0x0014 }, + { 0x0014, 0x0015 }, + { 0x0014, 0x0016 }, + { 0x0014, 0x0017 }, + { 0x0014, 0x0018 }, + { 0x0014, 0x0019 }, + { 0x0014, 0x001a }, + { 0x0014, 0x001b }, + { 0x0014, 0x001c }, + { 0x0014, 0x001d }, + { 0x0014, 0x001e }, + { 0x0014, 0x001f }, + { 0x0013, 0x0014 }, + { 0x0013, 0x0015 }, + { 0x0013, 0x0016 }, + { 0x0013, 0x0017 }, + { 0x0013, 0x0018 }, + { 0x0013, 0x0019 }, + { 0x0013, 0x001a }, + { 0x0013, 0x001b }, + { 0x0013, 0x001c }, + { 0x0013, 0x001d }, + { 0x0013, 0x001e }, + { 0x0013, 0x001f }, + { 0x0013, 0x0020 }, + { 0x0013, 0x0021 }, + { 0x0013, 0x0022 }, + { 0x0013, 0x0023 }, + { 0x0013, 0x0024 }, + { 0x0013, 0x0025 }, + { 0x0013, 0x0026 }, + { 0x0013, 0x0027 }, -}; + }; #ifndef ROM_TO_RAM -const uint32_t c_aauiCQMFHuffDec63[39][16] = -{ - {0x0008ffff, 0x0006ffff, 0x0007ffff, 0x0003ffff, 0x0004ffff, 0x0005ffff, 0x0001ffff, 0x0002ffff, 0x00000000, 0x00000003, 0x00010001, 0x00010001, 0x00020002, 0x00020002, 0x00020002, 0x00020002, }, - {0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030004, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, 0x00030005, }, - {0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030006, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, 0x00030007, }, - {0x00020008, 0x00020008, 0x00020008, 0x00020008, 0x00020009, 0x00020009, 0x00020009, 0x00020009, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000a, 0x0002000b, 0x0002000b, 0x0002000b, 0x0002000b, }, - {0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000d, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000e, 0x0002000f, 0x0002000f, 0x0002000f, 0x0002000f, }, - {0x00020010, 0x00020010, 0x00020010, 0x00020010, 0x00020011, 0x00020011, 0x00020011, 0x00020011, 0x00020012, 0x00020012, 0x00020012, 0x00020012, 0x00020013, 0x00020013, 0x00020013, 0x00020013, }, - {0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002a, 0x00010014, 0x00010014, 0x00010015, 0x00010015, 0x00010016, 0x00010016, 0x00010017, 0x00010017, 0x00010018, 0x00010018, }, - {0x00010019, 0x00010019, 0x0001001a, 0x0001001a, 0x0001001b, 0x0001001b, 0x0001001c, 0x0001001c, 0x0001001d, 0x0001001d, 0x0001001e, 0x0001001e, 0x0001001f, 0x0001001f, 0x00010020, 0x00010020, }, - {0x0014ffff, 0x0011ffff, 0x0012ffff, 0x0013ffff, 0x0009ffff, 0x000affff, 0x000bffff, 0x000cffff, 0x000dffff, 0x000effff, 0x000fffff, 0x0010ffff, 0x00000021, 0x00000022, 0x00000023, 0x00000024, }, - {0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002b, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, 0x0003002c, }, - {0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002d, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, 0x0003002e, }, - {0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x0003002f, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, 0x00030030, }, - {0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030031, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, 0x00030032, }, - {0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030033, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, 0x00030034, }, - {0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030035, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, 0x00030036, }, - {0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030037, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, 0x00030038, }, - {0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003a, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, 0x0003003b, }, - {0x00010043, 0x00010043, 0x00010044, 0x00010044, 0x00010045, 0x00010045, 0x00010047, 0x00010047, 0x00010048, 0x00010048, 0x00010049, 0x00010049, 0x00020039, 0x00020039, 0x00020039, 0x00020039, }, - {0x0002003c, 0x0002003c, 0x0002003c, 0x0002003c, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003d, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003e, 0x0002003f, 0x0002003f, 0x0002003f, 0x0002003f, }, - {0x00020040, 0x00020040, 0x00020040, 0x00020040, 0x00020041, 0x00020041, 0x00020041, 0x00020041, 0x00020042, 0x00020042, 0x00020042, 0x00020042, 0x00020046, 0x00020046, 0x00020046, 0x00020046, }, - {0x001dffff, 0x001affff, 0x001bffff, 0x001cffff, 0x0015ffff, 0x0016ffff, 0x0017ffff, 0x0018ffff, 0x0019ffff, 0x0000004a, 0x0000004b, 0x0000004c, 0x0000004d, 0x0000004e, 0x0000004f, 0x00000050, }, - {0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030051, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, 0x00030052, }, - {0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030053, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, 0x00030054, }, - {0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030055, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, 0x00030056, }, - {0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030057, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, 0x00030058, }, - {0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x00030059, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, 0x0003005a, }, - {0x00010064, 0x00010064, 0x00010065, 0x00010065, 0x00010066, 0x00010066, 0x00010067, 0x00010067, 0x00010068, 0x00010068, 0x0001006b, 0x0001006b, 0x0002005b, 0x0002005b, 0x0002005b, 0x0002005b, }, - {0x0002005c, 0x0002005c, 0x0002005c, 0x0002005c, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005d, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005e, 0x0002005f, 0x0002005f, 0x0002005f, 0x0002005f, }, - {0x00020060, 0x00020060, 0x00020060, 0x00020060, 0x00020061, 0x00020061, 0x00020061, 0x00020061, 0x00020062, 0x00020062, 0x00020062, 0x00020062, 0x00020063, 0x00020063, 0x00020063, 0x00020063, }, - {0x0026ffff, 0x0025ffff, 0x0022ffff, 0x0023ffff, 0x0024ffff, 0x0020ffff, 0x0021ffff, 0x001effff, 0x001fffff, 0x00000069, 0x0000006a, 0x0000006c, 0x0000006d, 0x0000006e, 0x00000071, 0x00000076, }, - {0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x0003006f, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, 0x00030070, }, - {0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030072, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, 0x00030073, }, - {0x00020074, 0x00020074, 0x00020074, 0x00020074, 0x00020077, 0x00020077, 0x00020077, 0x00020077, 0x00020078, 0x00020078, 0x00020078, 0x00020078, 0x0002007a, 0x0002007a, 0x0002007a, 0x0002007a, }, - {0x0002007b, 0x0002007b, 0x0002007b, 0x0002007b, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007c, 0x0002007e, 0x0002007e, 0x0002007e, 0x0002007e, 0x00020080, 0x00020080, 0x00020080, 0x00020080, }, - {0x0001007d, 0x0001007d, 0x00010084, 0x00010084, 0x00010086, 0x00010086, 0x0001008f, 0x0001008f, 0x000100a1, 0x000100a1, 0x000100a2, 0x000100a2, 0x000100a3, 0x000100a3, 0x000100a4, 0x000100a4, }, - {0x000100a5, 0x000100a5, 0x000100a6, 0x000100a6, 0x000100a7, 0x000100a7, 0x000100a8, 0x000100a8, 0x000100a9, 0x000100a9, 0x000100aa, 0x000100aa, 0x000100ab, 0x000100ab, 0x000100ac, 0x000100ac, }, - {0x000100ad, 0x000100ad, 0x000100ae, 0x000100ae, 0x000100af, 0x000100af, 0x000100b0, 0x000100b0, 0x000100b1, 0x000100b1, 0x000100b2, 0x000100b2, 0x000100b3, 0x000100b3, 0x000100b4, 0x000100b4, }, - {0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009a, 0x0000009b, 0x0000009c, 0x0000009d, 0x0000009e, 0x0000009f, 0x000000a0, }, - {0x00000075, 0x00000079, 0x0000007f, 0x00000081, 0x00000082, 0x00000083, 0x00000085, 0x00000087, 0x00000088, 0x00000089, 0x0000008a, 0x0000008b, 0x0000008c, 0x0000008d, 0x0000008e, 0x00000090, }, +const uint32_t c_aauiCQMFHuffDec63[39][16] = { + { + 0x0008ffff, + 0x0006ffff, + 0x0007ffff, + 0x0003ffff, + 0x0004ffff, + 0x0005ffff, + 0x0001ffff, + 0x0002ffff, + 0x00000000, + 0x00000003, + 0x00010001, + 0x00010001, + 0x00020002, + 0x00020002, + 0x00020002, + 0x00020002, + }, + { + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030004, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + 0x00030005, + }, + { + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030006, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + 0x00030007, + }, + { + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020008, + 0x00020009, + 0x00020009, + 0x00020009, + 0x00020009, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000a, + 0x0002000b, + 0x0002000b, + 0x0002000b, + 0x0002000b, + }, + { + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000c, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000d, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000e, + 0x0002000f, + 0x0002000f, + 0x0002000f, + 0x0002000f, + }, + { + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020010, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020011, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020012, + 0x00020013, + 0x00020013, + 0x00020013, + 0x00020013, + }, + { + 0x00000025, + 0x00000026, + 0x00000027, + 0x00000028, + 0x00000029, + 0x0000002a, + 0x00010014, + 0x00010014, + 0x00010015, + 0x00010015, + 0x00010016, + 0x00010016, + 0x00010017, + 0x00010017, + 0x00010018, + 0x00010018, + }, + { + 0x00010019, + 0x00010019, + 0x0001001a, + 0x0001001a, + 0x0001001b, + 0x0001001b, + 0x0001001c, + 0x0001001c, + 0x0001001d, + 0x0001001d, + 0x0001001e, + 0x0001001e, + 0x0001001f, + 0x0001001f, + 0x00010020, + 0x00010020, + }, + { + 0x0014ffff, + 0x0011ffff, + 0x0012ffff, + 0x0013ffff, + 0x0009ffff, + 0x000affff, + 0x000bffff, + 0x000cffff, + 0x000dffff, + 0x000effff, + 0x000fffff, + 0x0010ffff, + 0x00000021, + 0x00000022, + 0x00000023, + 0x00000024, + }, + { + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002b, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + 0x0003002c, + }, + { + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002d, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + 0x0003002e, + }, + { + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x0003002f, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + 0x00030030, + }, + { + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030031, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + 0x00030032, + }, + { + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030033, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + 0x00030034, + }, + { + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030035, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + 0x00030036, + }, + { + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030037, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + 0x00030038, + }, + { + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003a, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + 0x0003003b, + }, + { + 0x00010043, + 0x00010043, + 0x00010044, + 0x00010044, + 0x00010045, + 0x00010045, + 0x00010047, + 0x00010047, + 0x00010048, + 0x00010048, + 0x00010049, + 0x00010049, + 0x00020039, + 0x00020039, + 0x00020039, + 0x00020039, + }, + { + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003c, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003d, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003e, + 0x0002003f, + 0x0002003f, + 0x0002003f, + 0x0002003f, + }, + { + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020040, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020041, + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020042, + 0x00020046, + 0x00020046, + 0x00020046, + 0x00020046, + }, + { + 0x001dffff, + 0x001affff, + 0x001bffff, + 0x001cffff, + 0x0015ffff, + 0x0016ffff, + 0x0017ffff, + 0x0018ffff, + 0x0019ffff, + 0x0000004a, + 0x0000004b, + 0x0000004c, + 0x0000004d, + 0x0000004e, + 0x0000004f, + 0x00000050, + }, + { + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030051, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + 0x00030052, + }, + { + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030053, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + 0x00030054, + }, + { + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030055, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + 0x00030056, + }, + { + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030057, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + 0x00030058, + }, + { + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x00030059, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + 0x0003005a, + }, + { + 0x00010064, + 0x00010064, + 0x00010065, + 0x00010065, + 0x00010066, + 0x00010066, + 0x00010067, + 0x00010067, + 0x00010068, + 0x00010068, + 0x0001006b, + 0x0001006b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + 0x0002005b, + }, + { + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005c, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005d, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005e, + 0x0002005f, + 0x0002005f, + 0x0002005f, + 0x0002005f, + }, + { + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020060, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020061, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020062, + 0x00020063, + 0x00020063, + 0x00020063, + 0x00020063, + }, + { + 0x0026ffff, + 0x0025ffff, + 0x0022ffff, + 0x0023ffff, + 0x0024ffff, + 0x0020ffff, + 0x0021ffff, + 0x001effff, + 0x001fffff, + 0x00000069, + 0x0000006a, + 0x0000006c, + 0x0000006d, + 0x0000006e, + 0x00000071, + 0x00000076, + }, + { + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x0003006f, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + 0x00030070, + }, + { + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030072, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + 0x00030073, + }, + { + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020074, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020077, + 0x00020078, + 0x00020078, + 0x00020078, + 0x00020078, + 0x0002007a, + 0x0002007a, + 0x0002007a, + 0x0002007a, + }, + { + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007b, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007c, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x0002007e, + 0x00020080, + 0x00020080, + 0x00020080, + 0x00020080, + }, + { + 0x0001007d, + 0x0001007d, + 0x00010084, + 0x00010084, + 0x00010086, + 0x00010086, + 0x0001008f, + 0x0001008f, + 0x000100a1, + 0x000100a1, + 0x000100a2, + 0x000100a2, + 0x000100a3, + 0x000100a3, + 0x000100a4, + 0x000100a4, + }, + { + 0x000100a5, + 0x000100a5, + 0x000100a6, + 0x000100a6, + 0x000100a7, + 0x000100a7, + 0x000100a8, + 0x000100a8, + 0x000100a9, + 0x000100a9, + 0x000100aa, + 0x000100aa, + 0x000100ab, + 0x000100ab, + 0x000100ac, + 0x000100ac, + }, + { + 0x000100ad, + 0x000100ad, + 0x000100ae, + 0x000100ae, + 0x000100af, + 0x000100af, + 0x000100b0, + 0x000100b0, + 0x000100b1, + 0x000100b1, + 0x000100b2, + 0x000100b2, + 0x000100b3, + 0x000100b3, + 0x000100b4, + 0x000100b4, + }, + { + 0x00000091, + 0x00000092, + 0x00000093, + 0x00000094, + 0x00000095, + 0x00000096, + 0x00000097, + 0x00000098, + 0x00000099, + 0x0000009a, + 0x0000009b, + 0x0000009c, + 0x0000009d, + 0x0000009e, + 0x0000009f, + 0x000000a0, + }, + { + 0x00000075, + 0x00000079, + 0x0000007f, + 0x00000081, + 0x00000082, + 0x00000083, + 0x00000085, + 0x00000087, + 0x00000088, + 0x00000089, + 0x0000008a, + 0x0000008b, + 0x0000008c, + 0x0000008d, + 0x0000008e, + 0x00000090, + }, }; #endif #ifndef ROM_TO_RAM -const uint32_t(*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = +const uint32_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2] = #else -const uint16_t(*c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE])[2] = -#endif -{ - NULL, - c_aauiCQMFHuffEnc1, - c_aauiCQMFHuffEnc2, - c_aauiCQMFHuffEnc3, - c_aauiCQMFHuffEnc4, - c_aauiCQMFHuffEnc5, - c_aauiCQMFHuffEnc6, - c_aauiCQMFHuffEnc7, - c_aauiCQMFHuffEnc8, - c_aauiCQMFHuffEnc9, - c_aauiCQMFHuffEnc10, - c_aauiCQMFHuffEnc11, - c_aauiCQMFHuffEnc12, - c_aauiCQMFHuffEnc13, - c_aauiCQMFHuffEnc14, - c_aauiCQMFHuffEnc15, - c_aauiCQMFHuffEnc16, - c_aauiCQMFHuffEnc17, - c_aauiCQMFHuffEnc18, - c_aauiCQMFHuffEnc19, - c_aauiCQMFHuffEnc20, - c_aauiCQMFHuffEnc21, - c_aauiCQMFHuffEnc22, - c_aauiCQMFHuffEnc23, - c_aauiCQMFHuffEnc24, - c_aauiCQMFHuffEnc25, - c_aauiCQMFHuffEnc26, - c_aauiCQMFHuffEnc27, - c_aauiCQMFHuffEnc28, - c_aauiCQMFHuffEnc29, - c_aauiCQMFHuffEnc30, - c_aauiCQMFHuffEnc31, - NULL, - c_aauiCQMFHuffEnc33, - c_aauiCQMFHuffEnc34, - c_aauiCQMFHuffEnc35, - c_aauiCQMFHuffEnc36, - c_aauiCQMFHuffEnc37, - c_aauiCQMFHuffEnc38, - c_aauiCQMFHuffEnc39, - c_aauiCQMFHuffEnc40, - c_aauiCQMFHuffEnc41, - c_aauiCQMFHuffEnc42, - c_aauiCQMFHuffEnc43, - c_aauiCQMFHuffEnc44, - c_aauiCQMFHuffEnc45, - c_aauiCQMFHuffEnc46, - c_aauiCQMFHuffEnc47, - c_aauiCQMFHuffEnc48, - c_aauiCQMFHuffEnc49, - c_aauiCQMFHuffEnc50, - c_aauiCQMFHuffEnc51, - c_aauiCQMFHuffEnc52, - c_aauiCQMFHuffEnc53, - c_aauiCQMFHuffEnc54, - c_aauiCQMFHuffEnc55, - c_aauiCQMFHuffEnc56, - c_aauiCQMFHuffEnc57, - c_aauiCQMFHuffEnc58, - c_aauiCQMFHuffEnc59, - c_aauiCQMFHuffEnc60, - c_aauiCQMFHuffEnc61, - c_aauiCQMFHuffEnc62, - c_aauiCQMFHuffEnc63, -}; +const uint16_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2] = +#endif + { + NULL, + c_aauiCQMFHuffEnc1, + c_aauiCQMFHuffEnc2, + c_aauiCQMFHuffEnc3, + c_aauiCQMFHuffEnc4, + c_aauiCQMFHuffEnc5, + c_aauiCQMFHuffEnc6, + c_aauiCQMFHuffEnc7, + c_aauiCQMFHuffEnc8, + c_aauiCQMFHuffEnc9, + c_aauiCQMFHuffEnc10, + c_aauiCQMFHuffEnc11, + c_aauiCQMFHuffEnc12, + c_aauiCQMFHuffEnc13, + c_aauiCQMFHuffEnc14, + c_aauiCQMFHuffEnc15, + c_aauiCQMFHuffEnc16, + c_aauiCQMFHuffEnc17, + c_aauiCQMFHuffEnc18, + c_aauiCQMFHuffEnc19, + c_aauiCQMFHuffEnc20, + c_aauiCQMFHuffEnc21, + c_aauiCQMFHuffEnc22, + c_aauiCQMFHuffEnc23, + c_aauiCQMFHuffEnc24, + c_aauiCQMFHuffEnc25, + c_aauiCQMFHuffEnc26, + c_aauiCQMFHuffEnc27, + c_aauiCQMFHuffEnc28, + c_aauiCQMFHuffEnc29, + c_aauiCQMFHuffEnc30, + c_aauiCQMFHuffEnc31, + NULL, + c_aauiCQMFHuffEnc33, + c_aauiCQMFHuffEnc34, + c_aauiCQMFHuffEnc35, + c_aauiCQMFHuffEnc36, + c_aauiCQMFHuffEnc37, + c_aauiCQMFHuffEnc38, + c_aauiCQMFHuffEnc39, + c_aauiCQMFHuffEnc40, + c_aauiCQMFHuffEnc41, + c_aauiCQMFHuffEnc42, + c_aauiCQMFHuffEnc43, + c_aauiCQMFHuffEnc44, + c_aauiCQMFHuffEnc45, + c_aauiCQMFHuffEnc46, + c_aauiCQMFHuffEnc47, + c_aauiCQMFHuffEnc48, + c_aauiCQMFHuffEnc49, + c_aauiCQMFHuffEnc50, + c_aauiCQMFHuffEnc51, + c_aauiCQMFHuffEnc52, + c_aauiCQMFHuffEnc53, + c_aauiCQMFHuffEnc54, + c_aauiCQMFHuffEnc55, + c_aauiCQMFHuffEnc56, + c_aauiCQMFHuffEnc57, + c_aauiCQMFHuffEnc58, + c_aauiCQMFHuffEnc59, + c_aauiCQMFHuffEnc60, + c_aauiCQMFHuffEnc61, + c_aauiCQMFHuffEnc62, + c_aauiCQMFHuffEnc63, + }; #ifndef ROM_TO_RAM -const uint32_t(*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE] = { +const uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] = { NULL, c_aauiCQMFHuffDec1, c_aauiCQMFHuffDec2, @@ -4323,317 +44144,7737 @@ const uint32_t(*c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE])[HUFF_DEC_TABLE_SIZE] c_aauiCQMFHuffDec63, }; #else -const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE] = -{ 0, 16, 16, 25, 36, 36, 49, 64, 81, 100, - 169, 196, 289, 324, 400, 576, 729, 729, 28, 29, - 32, 37, 39, 46, 55, 65, 77, 91, 109, 129, - 153, 181, 0, 16, 16, 25, 36, 36, 49, 64, 81, - 100, 169, 196, 289, 324, 400, 576, 729, 729, 28, - 29, 32, 37, 39, 46, 55, 65, 77, 91, 109, - 129, 153, 181 -}; +const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE] = { 0, 16, 16, 25, 36, 36, 49, 64, 81, 100, + 169, 196, 289, 324, 400, 576, 729, 729, 28, 29, + 32, 37, 39, 46, 55, 65, 77, 91, 109, 129, + 153, 181, 0, 16, 16, 25, 36, 36, 49, 64, 81, + 100, 169, 196, 289, 324, 400, 576, 729, 729, 28, + 29, 32, 37, 39, 46, 55, 65, 77, 91, 109, + 129, 153, 181 }; #endif #ifdef USE_DEMOD_TABLES const int32_t c_aaiHuffDemod1[16][2] = { - 0,0,0,1,0,2,0,3,1,0,1,1,1,2,1,3,2,0,2,1,2,2,2,3,3,0,3,1,3,2,3,3, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, }; const int32_t c_aaiHuffDemod2[16][2] = { - 0,0,0,1,0,2,0,3,1,0,1,1,1,2,1,3,2,0,2,1,2,2,2,3,3,0,3,1,3,2,3,3, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, }; const int32_t c_aaiHuffDemod3[25][2] = { - 0,0,0,1,0,2,0,3,0,4,1,0,1,1,1,2,1,3,1,4,2,0,2,1,2,2,2,3,2,4,3,0, - 3,1,3,2,3,3,3,4,4,0,4,1,4,2,4,3,4,4, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, }; const int32_t c_aaiHuffDemod4[36][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,1,0,1,1,1,2,1,3,1,4,1,5,2,0,2,1,2,2,2,3, - 2,4,2,5,3,0,3,1,3,2,3,3,3,4,3,5,4,0,4,1,4,2,4,3,4,4,4,5,5,0,5,1, - 5,2,5,3,5,4,5,5, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, }; const int32_t c_aaiHuffDemod5[36][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,1,0,1,1,1,2,1,3,1,4,1,5,2,0,2,1,2,2,2,3, - 2,4,2,5,3,0,3,1,3,2,3,3,3,4,3,5,4,0,4,1,4,2,4,3,4,4,4,5,5,0,5,1, - 5,2,5,3,5,4,5,5, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, }; const int32_t c_aaiHuffDemod6[49][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,1,0,1,1,1,2,1,3,1,4,1,5,1,6,2,0,2,1, - 2,2,2,3,2,4,2,5,2,6,3,0,3,1,3,2,3,3,3,4,3,5,3,6,4,0,4,1,4,2,4,3, - 4,4,4,5,4,6,5,0,5,1,5,2,5,3,5,4,5,5,5,6,6,0,6,1,6,2,6,3,6,4,6,5, - 6,6, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, }; const int32_t c_aaiHuffDemod7[64][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7, - 2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7, - 4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7, - 6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, }; const int32_t c_aaiHuffDemod8[81][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,1,0,1,1,1,2,1,3,1,4,1,5,1,6, - 1,7,1,8,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,3,0,3,1,3,2,3,3,3,4, - 3,5,3,6,3,7,3,8,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,5,0,5,1,5,2, - 5,3,5,4,5,5,5,6,5,7,5,8,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,7,0, - 7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, - 8,8, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, }; const int32_t c_aaiHuffDemod9[100][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,1,0,1,1,1,2,1,3,1,4,1,5, - 1,6,1,7,1,8,1,9,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,3,0,3,1, - 3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7, - 4,8,4,9,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,6,0,6,1,6,2,6,3, - 6,4,6,5,6,6,6,7,6,8,6,9,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8,7,9, - 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,9,0,9,1,9,2,9,3,9,4,9,5, - 9,6,9,7,9,8,9,9, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, }; const int32_t c_aaiHuffDemod10[169][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,1,0,1,1,1,2, - 1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,2,0,2,1,2,2,2,3,2,4,2,5, - 2,6,2,7,2,8,2,9,2,10,2,11,2,12,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8, - 3,9,3,10,3,11,3,12,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11, - 4,12,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10,5,11,5,12,6,0,6,1, - 6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,7,0,7,1,7,2,7,3,7,4, - 7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, - 8,8,8,9,8,10,8,11,8,12,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10, - 9,11,9,12,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,11,0, - 11,1,11,2,11,3,11,4,11,5,11,6,11,7,11,8,11,9,11,10,11,11,11,12,12,0,12,1,12,2,12,3, - 12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, }; const int32_t c_aaiHuffDemod11[196][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,1,0,1,1, - 1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,2,0,2,1,2,2,2,3, - 2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13,3,0,3,1,3,2,3,3,3,4,3,5, - 3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7, - 4,8,4,9,4,10,4,11,4,12,4,13,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9, - 5,10,5,11,5,12,5,13,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11, - 6,12,6,13,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13, - 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,9,0,9,1, - 9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12,9,13,10,0,10,1,10,2,10,3, - 10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,11,0,11,1,11,2,11,3,11,4,11,5, - 11,6,11,7,11,8,11,9,11,10,11,11,11,12,11,13,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7, - 12,8,12,9,12,10,12,11,12,12,12,13,13,0,13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9, - 13,10,13,11,13,12,13,13, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, }; const int32_t c_aaiHuffDemod12[289][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, - 0,16,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14, - 1,15,1,16,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13, - 2,14,2,15,2,16,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12, - 3,13,3,14,3,15,3,16,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11, - 4,12,4,13,4,14,4,15,4,16,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10, - 5,11,5,12,5,13,5,14,5,15,5,16,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9, - 6,10,6,11,6,12,6,13,6,14,6,15,6,16,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7,8, - 7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, - 8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15,8,16,9,0,9,1,9,2,9,3,9,4,9,5,9,6, - 9,7,9,8,9,9,9,10,9,11,9,12,9,13,9,14,9,15,9,16,10,0,10,1,10,2,10,3,10,4,10,5, - 10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,11,0,11,1,11,2,11,3,11,4, - 11,5,11,6,11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,12,0,12,1,12,2,12,3, - 12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12,16,13,0,13,1,13,2, - 13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16,14,0,14,1, - 14,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,15,0, - 15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, - 16,16, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 0, + 14, + 0, + 15, + 0, + 16, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 1, + 14, + 1, + 15, + 1, + 16, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 2, + 14, + 2, + 15, + 2, + 16, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 3, + 14, + 3, + 15, + 3, + 16, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 4, + 14, + 4, + 15, + 4, + 16, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 5, + 14, + 5, + 15, + 5, + 16, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 6, + 14, + 6, + 15, + 6, + 16, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 7, + 14, + 7, + 15, + 7, + 16, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 8, + 14, + 8, + 15, + 8, + 16, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 9, + 14, + 9, + 15, + 9, + 16, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 10, + 14, + 10, + 15, + 10, + 16, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 11, + 14, + 11, + 15, + 11, + 16, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 12, + 14, + 12, + 15, + 12, + 16, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, + 13, + 14, + 13, + 15, + 13, + 16, + 14, + 0, + 14, + 1, + 14, + 2, + 14, + 3, + 14, + 4, + 14, + 5, + 14, + 6, + 14, + 7, + 14, + 8, + 14, + 9, + 14, + 10, + 14, + 11, + 14, + 12, + 14, + 13, + 14, + 14, + 14, + 15, + 14, + 16, + 15, + 0, + 15, + 1, + 15, + 2, + 15, + 3, + 15, + 4, + 15, + 5, + 15, + 6, + 15, + 7, + 15, + 8, + 15, + 9, + 15, + 10, + 15, + 11, + 15, + 12, + 15, + 13, + 15, + 14, + 15, + 15, + 15, + 16, + 16, + 0, + 16, + 1, + 16, + 2, + 16, + 3, + 16, + 4, + 16, + 5, + 16, + 6, + 16, + 7, + 16, + 8, + 16, + 9, + 16, + 10, + 16, + 11, + 16, + 12, + 16, + 13, + 16, + 14, + 16, + 15, + 16, + 16, }; const int32_t c_aaiHuffDemod13[324][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, - 0,16,0,17,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13, - 1,14,1,15,1,16,1,17,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11, - 2,12,2,13,2,14,2,15,2,16,2,17,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9, - 3,10,3,11,3,12,3,13,3,14,3,15,3,16,3,17,4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7, - 4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15,4,16,4,17,5,0,5,1,5,2,5,3,5,4,5,5, - 5,6,5,7,5,8,5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,6,0,6,1,6,2,6,3, - 6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13,6,14,6,15,6,16,6,17,7,0,7,1, - 7,2,7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17, - 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15, - 8,16,8,17,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12,9,13, - 9,14,9,15,9,16,9,17,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11, - 10,12,10,13,10,14,10,15,10,16,10,17,11,0,11,1,11,2,11,3,11,4,11,5,11,6,11,7,11,8,11,9, - 11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7, - 12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12,16,12,17,13,0,13,1,13,2,13,3,13,4,13,5, - 13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16,13,17,14,0,14,1,14,2,14,3, - 14,4,14,5,14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,15,0,15,1, - 15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16,15,17, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, - 16,16,16,17,17,0,17,1,17,2,17,3,17,4,17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13, - 17,14,17,15,17,16,17,17, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 0, + 14, + 0, + 15, + 0, + 16, + 0, + 17, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 1, + 14, + 1, + 15, + 1, + 16, + 1, + 17, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 2, + 14, + 2, + 15, + 2, + 16, + 2, + 17, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 3, + 14, + 3, + 15, + 3, + 16, + 3, + 17, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 4, + 14, + 4, + 15, + 4, + 16, + 4, + 17, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 5, + 14, + 5, + 15, + 5, + 16, + 5, + 17, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 6, + 14, + 6, + 15, + 6, + 16, + 6, + 17, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 7, + 14, + 7, + 15, + 7, + 16, + 7, + 17, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 8, + 14, + 8, + 15, + 8, + 16, + 8, + 17, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 9, + 14, + 9, + 15, + 9, + 16, + 9, + 17, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 10, + 14, + 10, + 15, + 10, + 16, + 10, + 17, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 11, + 14, + 11, + 15, + 11, + 16, + 11, + 17, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 12, + 14, + 12, + 15, + 12, + 16, + 12, + 17, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, + 13, + 14, + 13, + 15, + 13, + 16, + 13, + 17, + 14, + 0, + 14, + 1, + 14, + 2, + 14, + 3, + 14, + 4, + 14, + 5, + 14, + 6, + 14, + 7, + 14, + 8, + 14, + 9, + 14, + 10, + 14, + 11, + 14, + 12, + 14, + 13, + 14, + 14, + 14, + 15, + 14, + 16, + 14, + 17, + 15, + 0, + 15, + 1, + 15, + 2, + 15, + 3, + 15, + 4, + 15, + 5, + 15, + 6, + 15, + 7, + 15, + 8, + 15, + 9, + 15, + 10, + 15, + 11, + 15, + 12, + 15, + 13, + 15, + 14, + 15, + 15, + 15, + 16, + 15, + 17, + 16, + 0, + 16, + 1, + 16, + 2, + 16, + 3, + 16, + 4, + 16, + 5, + 16, + 6, + 16, + 7, + 16, + 8, + 16, + 9, + 16, + 10, + 16, + 11, + 16, + 12, + 16, + 13, + 16, + 14, + 16, + 15, + 16, + 16, + 16, + 17, + 17, + 0, + 17, + 1, + 17, + 2, + 17, + 3, + 17, + 4, + 17, + 5, + 17, + 6, + 17, + 7, + 17, + 8, + 17, + 9, + 17, + 10, + 17, + 11, + 17, + 12, + 17, + 13, + 17, + 14, + 17, + 15, + 17, + 16, + 17, + 17, }; const int32_t c_aaiHuffDemod14[400][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, - 0,16,0,17,0,18,0,19,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11, - 1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7, - 2,8,2,9,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2,19,3,0,3,1,3,2,3,3, - 3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,3,14,3,15,3,16,3,17,3,18,3,19, - 4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15, - 4,16,4,17,4,18,4,19,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8,5,9,5,10,5,11, - 5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7, - 6,8,6,9,6,10,6,11,6,12,6,13,6,14,6,15,6,16,6,17,6,18,6,19,7,0,7,1,7,2,7,3, - 7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18,7,19, - 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15, - 8,16,8,17,8,18,8,19,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11, - 9,12,9,13,9,14,9,15,9,16,9,17,9,18,9,19,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7, - 10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17,10,18,10,19,11,0,11,1,11,2,11,3, - 11,4,11,5,11,6,11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19, - 12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15, - 12,16,12,17,12,18,12,19,13,0,13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11, - 13,12,13,13,13,14,13,15,13,16,13,17,13,18,13,19,14,0,14,1,14,2,14,3,14,4,14,5,14,6,14,7, - 14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,15,0,15,1,15,2,15,3, - 15,4,15,5,15,6,15,7,15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, - 16,16,16,17,16,18,16,19,17,0,17,1,17,2,17,3,17,4,17,5,17,6,17,7,17,8,17,9,17,10,17,11, - 17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7, - 18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,18,18,18,19,19,0,19,1,19,2,19,3, - 19,4,19,5,19,6,19,7,19,8,19,9,19,10,19,11,19,12,19,13,19,14,19,15,19,16,19,17,19,18,19,19, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 0, + 14, + 0, + 15, + 0, + 16, + 0, + 17, + 0, + 18, + 0, + 19, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 1, + 14, + 1, + 15, + 1, + 16, + 1, + 17, + 1, + 18, + 1, + 19, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 2, + 14, + 2, + 15, + 2, + 16, + 2, + 17, + 2, + 18, + 2, + 19, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 3, + 14, + 3, + 15, + 3, + 16, + 3, + 17, + 3, + 18, + 3, + 19, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 4, + 14, + 4, + 15, + 4, + 16, + 4, + 17, + 4, + 18, + 4, + 19, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 5, + 14, + 5, + 15, + 5, + 16, + 5, + 17, + 5, + 18, + 5, + 19, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 6, + 14, + 6, + 15, + 6, + 16, + 6, + 17, + 6, + 18, + 6, + 19, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 7, + 14, + 7, + 15, + 7, + 16, + 7, + 17, + 7, + 18, + 7, + 19, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 8, + 14, + 8, + 15, + 8, + 16, + 8, + 17, + 8, + 18, + 8, + 19, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 9, + 14, + 9, + 15, + 9, + 16, + 9, + 17, + 9, + 18, + 9, + 19, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 10, + 14, + 10, + 15, + 10, + 16, + 10, + 17, + 10, + 18, + 10, + 19, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 11, + 14, + 11, + 15, + 11, + 16, + 11, + 17, + 11, + 18, + 11, + 19, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 12, + 14, + 12, + 15, + 12, + 16, + 12, + 17, + 12, + 18, + 12, + 19, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, + 13, + 14, + 13, + 15, + 13, + 16, + 13, + 17, + 13, + 18, + 13, + 19, + 14, + 0, + 14, + 1, + 14, + 2, + 14, + 3, + 14, + 4, + 14, + 5, + 14, + 6, + 14, + 7, + 14, + 8, + 14, + 9, + 14, + 10, + 14, + 11, + 14, + 12, + 14, + 13, + 14, + 14, + 14, + 15, + 14, + 16, + 14, + 17, + 14, + 18, + 14, + 19, + 15, + 0, + 15, + 1, + 15, + 2, + 15, + 3, + 15, + 4, + 15, + 5, + 15, + 6, + 15, + 7, + 15, + 8, + 15, + 9, + 15, + 10, + 15, + 11, + 15, + 12, + 15, + 13, + 15, + 14, + 15, + 15, + 15, + 16, + 15, + 17, + 15, + 18, + 15, + 19, + 16, + 0, + 16, + 1, + 16, + 2, + 16, + 3, + 16, + 4, + 16, + 5, + 16, + 6, + 16, + 7, + 16, + 8, + 16, + 9, + 16, + 10, + 16, + 11, + 16, + 12, + 16, + 13, + 16, + 14, + 16, + 15, + 16, + 16, + 16, + 17, + 16, + 18, + 16, + 19, + 17, + 0, + 17, + 1, + 17, + 2, + 17, + 3, + 17, + 4, + 17, + 5, + 17, + 6, + 17, + 7, + 17, + 8, + 17, + 9, + 17, + 10, + 17, + 11, + 17, + 12, + 17, + 13, + 17, + 14, + 17, + 15, + 17, + 16, + 17, + 17, + 17, + 18, + 17, + 19, + 18, + 0, + 18, + 1, + 18, + 2, + 18, + 3, + 18, + 4, + 18, + 5, + 18, + 6, + 18, + 7, + 18, + 8, + 18, + 9, + 18, + 10, + 18, + 11, + 18, + 12, + 18, + 13, + 18, + 14, + 18, + 15, + 18, + 16, + 18, + 17, + 18, + 18, + 18, + 19, + 19, + 0, + 19, + 1, + 19, + 2, + 19, + 3, + 19, + 4, + 19, + 5, + 19, + 6, + 19, + 7, + 19, + 8, + 19, + 9, + 19, + 10, + 19, + 11, + 19, + 12, + 19, + 13, + 19, + 14, + 19, + 15, + 19, + 16, + 19, + 17, + 19, + 18, + 19, + 19, }; const int32_t c_aaiHuffDemod15[576][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, - 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7, - 1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23, - 2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13,2,14,2,15, - 2,16,2,17,2,18,2,19,2,20,2,21,2,22,2,23,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7, - 3,8,3,9,3,10,3,11,3,12,3,13,3,14,3,15,3,16,3,17,3,18,3,19,3,20,3,21,3,22,3,23, - 4,0,4,1,4,2,4,3,4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15, - 4,16,4,17,4,18,4,19,4,20,4,21,4,22,4,23,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7, - 5,8,5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,5,20,5,21,5,22,5,23, - 6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13,6,14,6,15, - 6,16,6,17,6,18,6,19,6,20,6,21,6,22,6,23,7,0,7,1,7,2,7,3,7,4,7,5,7,6,7,7, - 7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18,7,19,7,20,7,21,7,22,7,23, - 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15, - 8,16,8,17,8,18,8,19,8,20,8,21,8,22,8,23,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7, - 9,8,9,9,9,10,9,11,9,12,9,13,9,14,9,15,9,16,9,17,9,18,9,19,9,20,9,21,9,22,9,23, - 10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15, - 10,16,10,17,10,18,10,19,10,20,10,21,10,22,10,23,11,0,11,1,11,2,11,3,11,4,11,5,11,6,11,7, - 11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19,11,20,11,21,11,22,11,23, - 12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15, - 12,16,12,17,12,18,12,19,12,20,12,21,12,22,12,23,13,0,13,1,13,2,13,3,13,4,13,5,13,6,13,7, - 13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16,13,17,13,18,13,19,13,20,13,21,13,22,13,23, - 14,0,14,1,14,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15, - 14,16,14,17,14,18,14,19,14,20,14,21,14,22,14,23,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7, - 15,8,15,9,15,10,15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, - 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,17,0,17,1,17,2,17,3,17,4,17,5,17,6,17,7, - 17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20,17,21,17,22,17,23, - 18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15, - 18,16,18,17,18,18,18,19,18,20,18,21,18,22,18,23,19,0,19,1,19,2,19,3,19,4,19,5,19,6,19,7, - 19,8,19,9,19,10,19,11,19,12,19,13,19,14,19,15,19,16,19,17,19,18,19,19,19,20,19,21,19,22,19,23, - 20,0,20,1,20,2,20,3,20,4,20,5,20,6,20,7,20,8,20,9,20,10,20,11,20,12,20,13,20,14,20,15, - 20,16,20,17,20,18,20,19,20,20,20,21,20,22,20,23,21,0,21,1,21,2,21,3,21,4,21,5,21,6,21,7, - 21,8,21,9,21,10,21,11,21,12,21,13,21,14,21,15,21,16,21,17,21,18,21,19,21,20,21,21,21,22,21,23, - 22,0,22,1,22,2,22,3,22,4,22,5,22,6,22,7,22,8,22,9,22,10,22,11,22,12,22,13,22,14,22,15, - 22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,23,0,23,1,23,2,23,3,23,4,23,5,23,6,23,7, - 23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,23,17,23,18,23,19,23,20,23,21,23,22,23,23, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 0, + 14, + 0, + 15, + 0, + 16, + 0, + 17, + 0, + 18, + 0, + 19, + 0, + 20, + 0, + 21, + 0, + 22, + 0, + 23, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 1, + 14, + 1, + 15, + 1, + 16, + 1, + 17, + 1, + 18, + 1, + 19, + 1, + 20, + 1, + 21, + 1, + 22, + 1, + 23, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 2, + 14, + 2, + 15, + 2, + 16, + 2, + 17, + 2, + 18, + 2, + 19, + 2, + 20, + 2, + 21, + 2, + 22, + 2, + 23, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 3, + 14, + 3, + 15, + 3, + 16, + 3, + 17, + 3, + 18, + 3, + 19, + 3, + 20, + 3, + 21, + 3, + 22, + 3, + 23, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 4, + 14, + 4, + 15, + 4, + 16, + 4, + 17, + 4, + 18, + 4, + 19, + 4, + 20, + 4, + 21, + 4, + 22, + 4, + 23, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 5, + 14, + 5, + 15, + 5, + 16, + 5, + 17, + 5, + 18, + 5, + 19, + 5, + 20, + 5, + 21, + 5, + 22, + 5, + 23, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 6, + 14, + 6, + 15, + 6, + 16, + 6, + 17, + 6, + 18, + 6, + 19, + 6, + 20, + 6, + 21, + 6, + 22, + 6, + 23, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 7, + 14, + 7, + 15, + 7, + 16, + 7, + 17, + 7, + 18, + 7, + 19, + 7, + 20, + 7, + 21, + 7, + 22, + 7, + 23, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 8, + 14, + 8, + 15, + 8, + 16, + 8, + 17, + 8, + 18, + 8, + 19, + 8, + 20, + 8, + 21, + 8, + 22, + 8, + 23, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 9, + 14, + 9, + 15, + 9, + 16, + 9, + 17, + 9, + 18, + 9, + 19, + 9, + 20, + 9, + 21, + 9, + 22, + 9, + 23, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 10, + 14, + 10, + 15, + 10, + 16, + 10, + 17, + 10, + 18, + 10, + 19, + 10, + 20, + 10, + 21, + 10, + 22, + 10, + 23, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 11, + 14, + 11, + 15, + 11, + 16, + 11, + 17, + 11, + 18, + 11, + 19, + 11, + 20, + 11, + 21, + 11, + 22, + 11, + 23, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 12, + 14, + 12, + 15, + 12, + 16, + 12, + 17, + 12, + 18, + 12, + 19, + 12, + 20, + 12, + 21, + 12, + 22, + 12, + 23, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, + 13, + 14, + 13, + 15, + 13, + 16, + 13, + 17, + 13, + 18, + 13, + 19, + 13, + 20, + 13, + 21, + 13, + 22, + 13, + 23, + 14, + 0, + 14, + 1, + 14, + 2, + 14, + 3, + 14, + 4, + 14, + 5, + 14, + 6, + 14, + 7, + 14, + 8, + 14, + 9, + 14, + 10, + 14, + 11, + 14, + 12, + 14, + 13, + 14, + 14, + 14, + 15, + 14, + 16, + 14, + 17, + 14, + 18, + 14, + 19, + 14, + 20, + 14, + 21, + 14, + 22, + 14, + 23, + 15, + 0, + 15, + 1, + 15, + 2, + 15, + 3, + 15, + 4, + 15, + 5, + 15, + 6, + 15, + 7, + 15, + 8, + 15, + 9, + 15, + 10, + 15, + 11, + 15, + 12, + 15, + 13, + 15, + 14, + 15, + 15, + 15, + 16, + 15, + 17, + 15, + 18, + 15, + 19, + 15, + 20, + 15, + 21, + 15, + 22, + 15, + 23, + 16, + 0, + 16, + 1, + 16, + 2, + 16, + 3, + 16, + 4, + 16, + 5, + 16, + 6, + 16, + 7, + 16, + 8, + 16, + 9, + 16, + 10, + 16, + 11, + 16, + 12, + 16, + 13, + 16, + 14, + 16, + 15, + 16, + 16, + 16, + 17, + 16, + 18, + 16, + 19, + 16, + 20, + 16, + 21, + 16, + 22, + 16, + 23, + 17, + 0, + 17, + 1, + 17, + 2, + 17, + 3, + 17, + 4, + 17, + 5, + 17, + 6, + 17, + 7, + 17, + 8, + 17, + 9, + 17, + 10, + 17, + 11, + 17, + 12, + 17, + 13, + 17, + 14, + 17, + 15, + 17, + 16, + 17, + 17, + 17, + 18, + 17, + 19, + 17, + 20, + 17, + 21, + 17, + 22, + 17, + 23, + 18, + 0, + 18, + 1, + 18, + 2, + 18, + 3, + 18, + 4, + 18, + 5, + 18, + 6, + 18, + 7, + 18, + 8, + 18, + 9, + 18, + 10, + 18, + 11, + 18, + 12, + 18, + 13, + 18, + 14, + 18, + 15, + 18, + 16, + 18, + 17, + 18, + 18, + 18, + 19, + 18, + 20, + 18, + 21, + 18, + 22, + 18, + 23, + 19, + 0, + 19, + 1, + 19, + 2, + 19, + 3, + 19, + 4, + 19, + 5, + 19, + 6, + 19, + 7, + 19, + 8, + 19, + 9, + 19, + 10, + 19, + 11, + 19, + 12, + 19, + 13, + 19, + 14, + 19, + 15, + 19, + 16, + 19, + 17, + 19, + 18, + 19, + 19, + 19, + 20, + 19, + 21, + 19, + 22, + 19, + 23, + 20, + 0, + 20, + 1, + 20, + 2, + 20, + 3, + 20, + 4, + 20, + 5, + 20, + 6, + 20, + 7, + 20, + 8, + 20, + 9, + 20, + 10, + 20, + 11, + 20, + 12, + 20, + 13, + 20, + 14, + 20, + 15, + 20, + 16, + 20, + 17, + 20, + 18, + 20, + 19, + 20, + 20, + 20, + 21, + 20, + 22, + 20, + 23, + 21, + 0, + 21, + 1, + 21, + 2, + 21, + 3, + 21, + 4, + 21, + 5, + 21, + 6, + 21, + 7, + 21, + 8, + 21, + 9, + 21, + 10, + 21, + 11, + 21, + 12, + 21, + 13, + 21, + 14, + 21, + 15, + 21, + 16, + 21, + 17, + 21, + 18, + 21, + 19, + 21, + 20, + 21, + 21, + 21, + 22, + 21, + 23, + 22, + 0, + 22, + 1, + 22, + 2, + 22, + 3, + 22, + 4, + 22, + 5, + 22, + 6, + 22, + 7, + 22, + 8, + 22, + 9, + 22, + 10, + 22, + 11, + 22, + 12, + 22, + 13, + 22, + 14, + 22, + 15, + 22, + 16, + 22, + 17, + 22, + 18, + 22, + 19, + 22, + 20, + 22, + 21, + 22, + 22, + 22, + 23, + 23, + 0, + 23, + 1, + 23, + 2, + 23, + 3, + 23, + 4, + 23, + 5, + 23, + 6, + 23, + 7, + 23, + 8, + 23, + 9, + 23, + 10, + 23, + 11, + 23, + 12, + 23, + 13, + 23, + 14, + 23, + 15, + 23, + 16, + 23, + 17, + 23, + 18, + 23, + 19, + 23, + 20, + 23, + 21, + 23, + 22, + 23, + 23, }; const int32_t c_aaiHuffDemod16[729][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, - 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,1,0,1,1,1,2,1,3,1,4, - 1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20, - 1,21,1,22,1,23,1,24,1,25,1,26,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9, - 2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2,19,2,20,2,21,2,22,2,23,2,24,2,25, - 2,26,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,3,14, - 3,15,3,16,3,17,3,18,3,19,3,20,3,21,3,22,3,23,3,24,3,25,3,26,4,0,4,1,4,2,4,3, - 4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15,4,16,4,17,4,18,4,19, - 4,20,4,21,4,22,4,23,4,24,4,25,4,26,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8, - 5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,5,20,5,21,5,22,5,23,5,24, - 5,25,5,26,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13, - 6,14,6,15,6,16,6,17,6,18,6,19,6,20,6,21,6,22,6,23,6,24,6,25,6,26,7,0,7,1,7,2, - 7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18, - 7,19,7,20,7,21,7,22,7,23,7,24,7,25,7,26,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, - 8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15,8,16,8,17,8,18,8,19,8,20,8,21,8,22,8,23, - 8,24,8,25,8,26,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12, - 9,13,9,14,9,15,9,16,9,17,9,18,9,19,9,20,9,21,9,22,9,23,9,24,9,25,9,26,10,0,10,1, - 10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17, - 10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,26,11,0,11,1,11,2,11,3,11,4,11,5,11,6, - 11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19,11,20,11,21,11,22, - 11,23,11,24,11,25,11,26,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11, - 12,12,12,13,12,14,12,15,12,16,12,17,12,18,12,19,12,20,12,21,12,22,12,23,12,24,12,25,12,26,13,0, - 13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16, - 13,17,13,18,13,19,13,20,13,21,13,22,13,23,13,24,13,25,13,26,14,0,14,1,14,2,14,3,14,4,14,5, - 14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,14,20,14,21, - 14,22,14,23,14,24,14,25,14,26,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10, - 15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23,15,24,15,25,15,26, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, - 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,16,24,16,25,16,26,17,0,17,1,17,2,17,3,17,4, - 17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20, - 17,21,17,22,17,23,17,24,17,25,17,26,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9, - 18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,18,18,18,19,18,20,18,21,18,22,18,23,18,24,18,25, - 18,26,19,0,19,1,19,2,19,3,19,4,19,5,19,6,19,7,19,8,19,9,19,10,19,11,19,12,19,13,19,14, - 19,15,19,16,19,17,19,18,19,19,19,20,19,21,19,22,19,23,19,24,19,25,19,26,20,0,20,1,20,2,20,3, - 20,4,20,5,20,6,20,7,20,8,20,9,20,10,20,11,20,12,20,13,20,14,20,15,20,16,20,17,20,18,20,19, - 20,20,20,21,20,22,20,23,20,24,20,25,20,26,21,0,21,1,21,2,21,3,21,4,21,5,21,6,21,7,21,8, - 21,9,21,10,21,11,21,12,21,13,21,14,21,15,21,16,21,17,21,18,21,19,21,20,21,21,21,22,21,23,21,24, - 21,25,21,26,22,0,22,1,22,2,22,3,22,4,22,5,22,6,22,7,22,8,22,9,22,10,22,11,22,12,22,13, - 22,14,22,15,22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,22,24,22,25,22,26,23,0,23,1,23,2, - 23,3,23,4,23,5,23,6,23,7,23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,23,17,23,18, - 23,19,23,20,23,21,23,22,23,23,23,24,23,25,23,26,24,0,24,1,24,2,24,3,24,4,24,5,24,6,24,7, - 24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,24,22,24,23, - 24,24,24,25,24,26,25,0,25,1,25,2,25,3,25,4,25,5,25,6,25,7,25,8,25,9,25,10,25,11,25,12, - 25,13,25,14,25,15,25,16,25,17,25,18,25,19,25,20,25,21,25,22,25,23,25,24,25,25,25,26,26,0,26,1, - 26,2,26,3,26,4,26,5,26,6,26,7,26,8,26,9,26,10,26,11,26,12,26,13,26,14,26,15,26,16,26,17, - 26,18,26,19,26,20,26,21,26,22,26,23,26,24,26,25,26,26, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 0, + 14, + 0, + 15, + 0, + 16, + 0, + 17, + 0, + 18, + 0, + 19, + 0, + 20, + 0, + 21, + 0, + 22, + 0, + 23, + 0, + 24, + 0, + 25, + 0, + 26, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 1, + 14, + 1, + 15, + 1, + 16, + 1, + 17, + 1, + 18, + 1, + 19, + 1, + 20, + 1, + 21, + 1, + 22, + 1, + 23, + 1, + 24, + 1, + 25, + 1, + 26, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 2, + 14, + 2, + 15, + 2, + 16, + 2, + 17, + 2, + 18, + 2, + 19, + 2, + 20, + 2, + 21, + 2, + 22, + 2, + 23, + 2, + 24, + 2, + 25, + 2, + 26, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 3, + 14, + 3, + 15, + 3, + 16, + 3, + 17, + 3, + 18, + 3, + 19, + 3, + 20, + 3, + 21, + 3, + 22, + 3, + 23, + 3, + 24, + 3, + 25, + 3, + 26, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 4, + 14, + 4, + 15, + 4, + 16, + 4, + 17, + 4, + 18, + 4, + 19, + 4, + 20, + 4, + 21, + 4, + 22, + 4, + 23, + 4, + 24, + 4, + 25, + 4, + 26, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 5, + 14, + 5, + 15, + 5, + 16, + 5, + 17, + 5, + 18, + 5, + 19, + 5, + 20, + 5, + 21, + 5, + 22, + 5, + 23, + 5, + 24, + 5, + 25, + 5, + 26, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 6, + 14, + 6, + 15, + 6, + 16, + 6, + 17, + 6, + 18, + 6, + 19, + 6, + 20, + 6, + 21, + 6, + 22, + 6, + 23, + 6, + 24, + 6, + 25, + 6, + 26, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 7, + 14, + 7, + 15, + 7, + 16, + 7, + 17, + 7, + 18, + 7, + 19, + 7, + 20, + 7, + 21, + 7, + 22, + 7, + 23, + 7, + 24, + 7, + 25, + 7, + 26, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 8, + 14, + 8, + 15, + 8, + 16, + 8, + 17, + 8, + 18, + 8, + 19, + 8, + 20, + 8, + 21, + 8, + 22, + 8, + 23, + 8, + 24, + 8, + 25, + 8, + 26, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 9, + 14, + 9, + 15, + 9, + 16, + 9, + 17, + 9, + 18, + 9, + 19, + 9, + 20, + 9, + 21, + 9, + 22, + 9, + 23, + 9, + 24, + 9, + 25, + 9, + 26, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 10, + 14, + 10, + 15, + 10, + 16, + 10, + 17, + 10, + 18, + 10, + 19, + 10, + 20, + 10, + 21, + 10, + 22, + 10, + 23, + 10, + 24, + 10, + 25, + 10, + 26, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 11, + 14, + 11, + 15, + 11, + 16, + 11, + 17, + 11, + 18, + 11, + 19, + 11, + 20, + 11, + 21, + 11, + 22, + 11, + 23, + 11, + 24, + 11, + 25, + 11, + 26, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 12, + 14, + 12, + 15, + 12, + 16, + 12, + 17, + 12, + 18, + 12, + 19, + 12, + 20, + 12, + 21, + 12, + 22, + 12, + 23, + 12, + 24, + 12, + 25, + 12, + 26, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, + 13, + 14, + 13, + 15, + 13, + 16, + 13, + 17, + 13, + 18, + 13, + 19, + 13, + 20, + 13, + 21, + 13, + 22, + 13, + 23, + 13, + 24, + 13, + 25, + 13, + 26, + 14, + 0, + 14, + 1, + 14, + 2, + 14, + 3, + 14, + 4, + 14, + 5, + 14, + 6, + 14, + 7, + 14, + 8, + 14, + 9, + 14, + 10, + 14, + 11, + 14, + 12, + 14, + 13, + 14, + 14, + 14, + 15, + 14, + 16, + 14, + 17, + 14, + 18, + 14, + 19, + 14, + 20, + 14, + 21, + 14, + 22, + 14, + 23, + 14, + 24, + 14, + 25, + 14, + 26, + 15, + 0, + 15, + 1, + 15, + 2, + 15, + 3, + 15, + 4, + 15, + 5, + 15, + 6, + 15, + 7, + 15, + 8, + 15, + 9, + 15, + 10, + 15, + 11, + 15, + 12, + 15, + 13, + 15, + 14, + 15, + 15, + 15, + 16, + 15, + 17, + 15, + 18, + 15, + 19, + 15, + 20, + 15, + 21, + 15, + 22, + 15, + 23, + 15, + 24, + 15, + 25, + 15, + 26, + 16, + 0, + 16, + 1, + 16, + 2, + 16, + 3, + 16, + 4, + 16, + 5, + 16, + 6, + 16, + 7, + 16, + 8, + 16, + 9, + 16, + 10, + 16, + 11, + 16, + 12, + 16, + 13, + 16, + 14, + 16, + 15, + 16, + 16, + 16, + 17, + 16, + 18, + 16, + 19, + 16, + 20, + 16, + 21, + 16, + 22, + 16, + 23, + 16, + 24, + 16, + 25, + 16, + 26, + 17, + 0, + 17, + 1, + 17, + 2, + 17, + 3, + 17, + 4, + 17, + 5, + 17, + 6, + 17, + 7, + 17, + 8, + 17, + 9, + 17, + 10, + 17, + 11, + 17, + 12, + 17, + 13, + 17, + 14, + 17, + 15, + 17, + 16, + 17, + 17, + 17, + 18, + 17, + 19, + 17, + 20, + 17, + 21, + 17, + 22, + 17, + 23, + 17, + 24, + 17, + 25, + 17, + 26, + 18, + 0, + 18, + 1, + 18, + 2, + 18, + 3, + 18, + 4, + 18, + 5, + 18, + 6, + 18, + 7, + 18, + 8, + 18, + 9, + 18, + 10, + 18, + 11, + 18, + 12, + 18, + 13, + 18, + 14, + 18, + 15, + 18, + 16, + 18, + 17, + 18, + 18, + 18, + 19, + 18, + 20, + 18, + 21, + 18, + 22, + 18, + 23, + 18, + 24, + 18, + 25, + 18, + 26, + 19, + 0, + 19, + 1, + 19, + 2, + 19, + 3, + 19, + 4, + 19, + 5, + 19, + 6, + 19, + 7, + 19, + 8, + 19, + 9, + 19, + 10, + 19, + 11, + 19, + 12, + 19, + 13, + 19, + 14, + 19, + 15, + 19, + 16, + 19, + 17, + 19, + 18, + 19, + 19, + 19, + 20, + 19, + 21, + 19, + 22, + 19, + 23, + 19, + 24, + 19, + 25, + 19, + 26, + 20, + 0, + 20, + 1, + 20, + 2, + 20, + 3, + 20, + 4, + 20, + 5, + 20, + 6, + 20, + 7, + 20, + 8, + 20, + 9, + 20, + 10, + 20, + 11, + 20, + 12, + 20, + 13, + 20, + 14, + 20, + 15, + 20, + 16, + 20, + 17, + 20, + 18, + 20, + 19, + 20, + 20, + 20, + 21, + 20, + 22, + 20, + 23, + 20, + 24, + 20, + 25, + 20, + 26, + 21, + 0, + 21, + 1, + 21, + 2, + 21, + 3, + 21, + 4, + 21, + 5, + 21, + 6, + 21, + 7, + 21, + 8, + 21, + 9, + 21, + 10, + 21, + 11, + 21, + 12, + 21, + 13, + 21, + 14, + 21, + 15, + 21, + 16, + 21, + 17, + 21, + 18, + 21, + 19, + 21, + 20, + 21, + 21, + 21, + 22, + 21, + 23, + 21, + 24, + 21, + 25, + 21, + 26, + 22, + 0, + 22, + 1, + 22, + 2, + 22, + 3, + 22, + 4, + 22, + 5, + 22, + 6, + 22, + 7, + 22, + 8, + 22, + 9, + 22, + 10, + 22, + 11, + 22, + 12, + 22, + 13, + 22, + 14, + 22, + 15, + 22, + 16, + 22, + 17, + 22, + 18, + 22, + 19, + 22, + 20, + 22, + 21, + 22, + 22, + 22, + 23, + 22, + 24, + 22, + 25, + 22, + 26, + 23, + 0, + 23, + 1, + 23, + 2, + 23, + 3, + 23, + 4, + 23, + 5, + 23, + 6, + 23, + 7, + 23, + 8, + 23, + 9, + 23, + 10, + 23, + 11, + 23, + 12, + 23, + 13, + 23, + 14, + 23, + 15, + 23, + 16, + 23, + 17, + 23, + 18, + 23, + 19, + 23, + 20, + 23, + 21, + 23, + 22, + 23, + 23, + 23, + 24, + 23, + 25, + 23, + 26, + 24, + 0, + 24, + 1, + 24, + 2, + 24, + 3, + 24, + 4, + 24, + 5, + 24, + 6, + 24, + 7, + 24, + 8, + 24, + 9, + 24, + 10, + 24, + 11, + 24, + 12, + 24, + 13, + 24, + 14, + 24, + 15, + 24, + 16, + 24, + 17, + 24, + 18, + 24, + 19, + 24, + 20, + 24, + 21, + 24, + 22, + 24, + 23, + 24, + 24, + 24, + 25, + 24, + 26, + 25, + 0, + 25, + 1, + 25, + 2, + 25, + 3, + 25, + 4, + 25, + 5, + 25, + 6, + 25, + 7, + 25, + 8, + 25, + 9, + 25, + 10, + 25, + 11, + 25, + 12, + 25, + 13, + 25, + 14, + 25, + 15, + 25, + 16, + 25, + 17, + 25, + 18, + 25, + 19, + 25, + 20, + 25, + 21, + 25, + 22, + 25, + 23, + 25, + 24, + 25, + 25, + 25, + 26, + 26, + 0, + 26, + 1, + 26, + 2, + 26, + 3, + 26, + 4, + 26, + 5, + 26, + 6, + 26, + 7, + 26, + 8, + 26, + 9, + 26, + 10, + 26, + 11, + 26, + 12, + 26, + 13, + 26, + 14, + 26, + 15, + 26, + 16, + 26, + 17, + 26, + 18, + 26, + 19, + 26, + 20, + 26, + 21, + 26, + 22, + 26, + 23, + 26, + 24, + 26, + 25, + 26, + 26, }; const int32_t c_aaiHuffDemod17[729][2] = { - 0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,14,0,15, - 0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,1,0,1,1,1,2,1,3,1,4, - 1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20, - 1,21,1,22,1,23,1,24,1,25,1,26,2,0,2,1,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9, - 2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2,19,2,20,2,21,2,22,2,23,2,24,2,25, - 2,26,3,0,3,1,3,2,3,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,3,11,3,12,3,13,3,14, - 3,15,3,16,3,17,3,18,3,19,3,20,3,21,3,22,3,23,3,24,3,25,3,26,4,0,4,1,4,2,4,3, - 4,4,4,5,4,6,4,7,4,8,4,9,4,10,4,11,4,12,4,13,4,14,4,15,4,16,4,17,4,18,4,19, - 4,20,4,21,4,22,4,23,4,24,4,25,4,26,5,0,5,1,5,2,5,3,5,4,5,5,5,6,5,7,5,8, - 5,9,5,10,5,11,5,12,5,13,5,14,5,15,5,16,5,17,5,18,5,19,5,20,5,21,5,22,5,23,5,24, - 5,25,5,26,6,0,6,1,6,2,6,3,6,4,6,5,6,6,6,7,6,8,6,9,6,10,6,11,6,12,6,13, - 6,14,6,15,6,16,6,17,6,18,6,19,6,20,6,21,6,22,6,23,6,24,6,25,6,26,7,0,7,1,7,2, - 7,3,7,4,7,5,7,6,7,7,7,8,7,9,7,10,7,11,7,12,7,13,7,14,7,15,7,16,7,17,7,18, - 7,19,7,20,7,21,7,22,7,23,7,24,7,25,7,26,8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7, - 8,8,8,9,8,10,8,11,8,12,8,13,8,14,8,15,8,16,8,17,8,18,8,19,8,20,8,21,8,22,8,23, - 8,24,8,25,8,26,9,0,9,1,9,2,9,3,9,4,9,5,9,6,9,7,9,8,9,9,9,10,9,11,9,12, - 9,13,9,14,9,15,9,16,9,17,9,18,9,19,9,20,9,21,9,22,9,23,9,24,9,25,9,26,10,0,10,1, - 10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17, - 10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,26,11,0,11,1,11,2,11,3,11,4,11,5,11,6, - 11,7,11,8,11,9,11,10,11,11,11,12,11,13,11,14,11,15,11,16,11,17,11,18,11,19,11,20,11,21,11,22, - 11,23,11,24,11,25,11,26,12,0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11, - 12,12,12,13,12,14,12,15,12,16,12,17,12,18,12,19,12,20,12,21,12,22,12,23,12,24,12,25,12,26,13,0, - 13,1,13,2,13,3,13,4,13,5,13,6,13,7,13,8,13,9,13,10,13,11,13,12,13,13,13,14,13,15,13,16, - 13,17,13,18,13,19,13,20,13,21,13,22,13,23,13,24,13,25,13,26,14,0,14,1,14,2,14,3,14,4,14,5, - 14,6,14,7,14,8,14,9,14,10,14,11,14,12,14,13,14,14,14,15,14,16,14,17,14,18,14,19,14,20,14,21, - 14,22,14,23,14,24,14,25,14,26,15,0,15,1,15,2,15,3,15,4,15,5,15,6,15,7,15,8,15,9,15,10, - 15,11,15,12,15,13,15,14,15,15,15,16,15,17,15,18,15,19,15,20,15,21,15,22,15,23,15,24,15,25,15,26, - 16,0,16,1,16,2,16,3,16,4,16,5,16,6,16,7,16,8,16,9,16,10,16,11,16,12,16,13,16,14,16,15, - 16,16,16,17,16,18,16,19,16,20,16,21,16,22,16,23,16,24,16,25,16,26,17,0,17,1,17,2,17,3,17,4, - 17,5,17,6,17,7,17,8,17,9,17,10,17,11,17,12,17,13,17,14,17,15,17,16,17,17,17,18,17,19,17,20, - 17,21,17,22,17,23,17,24,17,25,17,26,18,0,18,1,18,2,18,3,18,4,18,5,18,6,18,7,18,8,18,9, - 18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,18,18,18,19,18,20,18,21,18,22,18,23,18,24,18,25, - 18,26,19,0,19,1,19,2,19,3,19,4,19,5,19,6,19,7,19,8,19,9,19,10,19,11,19,12,19,13,19,14, - 19,15,19,16,19,17,19,18,19,19,19,20,19,21,19,22,19,23,19,24,19,25,19,26,20,0,20,1,20,2,20,3, - 20,4,20,5,20,6,20,7,20,8,20,9,20,10,20,11,20,12,20,13,20,14,20,15,20,16,20,17,20,18,20,19, - 20,20,20,21,20,22,20,23,20,24,20,25,20,26,21,0,21,1,21,2,21,3,21,4,21,5,21,6,21,7,21,8, - 21,9,21,10,21,11,21,12,21,13,21,14,21,15,21,16,21,17,21,18,21,19,21,20,21,21,21,22,21,23,21,24, - 21,25,21,26,22,0,22,1,22,2,22,3,22,4,22,5,22,6,22,7,22,8,22,9,22,10,22,11,22,12,22,13, - 22,14,22,15,22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,22,24,22,25,22,26,23,0,23,1,23,2, - 23,3,23,4,23,5,23,6,23,7,23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,23,17,23,18, - 23,19,23,20,23,21,23,22,23,23,23,24,23,25,23,26,24,0,24,1,24,2,24,3,24,4,24,5,24,6,24,7, - 24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,24,22,24,23, - 24,24,24,25,24,26,25,0,25,1,25,2,25,3,25,4,25,5,25,6,25,7,25,8,25,9,25,10,25,11,25,12, - 25,13,25,14,25,15,25,16,25,17,25,18,25,19,25,20,25,21,25,22,25,23,25,24,25,25,25,26,26,0,26,1, - 26,2,26,3,26,4,26,5,26,6,26,7,26,8,26,9,26,10,26,11,26,12,26,13,26,14,26,15,26,16,26,17, - 26,18,26,19,26,20,26,21,26,22,26,23,26,24,26,25,26,26, + 0, + 0, + 0, + 1, + 0, + 2, + 0, + 3, + 0, + 4, + 0, + 5, + 0, + 6, + 0, + 7, + 0, + 8, + 0, + 9, + 0, + 10, + 0, + 11, + 0, + 12, + 0, + 13, + 0, + 14, + 0, + 15, + 0, + 16, + 0, + 17, + 0, + 18, + 0, + 19, + 0, + 20, + 0, + 21, + 0, + 22, + 0, + 23, + 0, + 24, + 0, + 25, + 0, + 26, + 1, + 0, + 1, + 1, + 1, + 2, + 1, + 3, + 1, + 4, + 1, + 5, + 1, + 6, + 1, + 7, + 1, + 8, + 1, + 9, + 1, + 10, + 1, + 11, + 1, + 12, + 1, + 13, + 1, + 14, + 1, + 15, + 1, + 16, + 1, + 17, + 1, + 18, + 1, + 19, + 1, + 20, + 1, + 21, + 1, + 22, + 1, + 23, + 1, + 24, + 1, + 25, + 1, + 26, + 2, + 0, + 2, + 1, + 2, + 2, + 2, + 3, + 2, + 4, + 2, + 5, + 2, + 6, + 2, + 7, + 2, + 8, + 2, + 9, + 2, + 10, + 2, + 11, + 2, + 12, + 2, + 13, + 2, + 14, + 2, + 15, + 2, + 16, + 2, + 17, + 2, + 18, + 2, + 19, + 2, + 20, + 2, + 21, + 2, + 22, + 2, + 23, + 2, + 24, + 2, + 25, + 2, + 26, + 3, + 0, + 3, + 1, + 3, + 2, + 3, + 3, + 3, + 4, + 3, + 5, + 3, + 6, + 3, + 7, + 3, + 8, + 3, + 9, + 3, + 10, + 3, + 11, + 3, + 12, + 3, + 13, + 3, + 14, + 3, + 15, + 3, + 16, + 3, + 17, + 3, + 18, + 3, + 19, + 3, + 20, + 3, + 21, + 3, + 22, + 3, + 23, + 3, + 24, + 3, + 25, + 3, + 26, + 4, + 0, + 4, + 1, + 4, + 2, + 4, + 3, + 4, + 4, + 4, + 5, + 4, + 6, + 4, + 7, + 4, + 8, + 4, + 9, + 4, + 10, + 4, + 11, + 4, + 12, + 4, + 13, + 4, + 14, + 4, + 15, + 4, + 16, + 4, + 17, + 4, + 18, + 4, + 19, + 4, + 20, + 4, + 21, + 4, + 22, + 4, + 23, + 4, + 24, + 4, + 25, + 4, + 26, + 5, + 0, + 5, + 1, + 5, + 2, + 5, + 3, + 5, + 4, + 5, + 5, + 5, + 6, + 5, + 7, + 5, + 8, + 5, + 9, + 5, + 10, + 5, + 11, + 5, + 12, + 5, + 13, + 5, + 14, + 5, + 15, + 5, + 16, + 5, + 17, + 5, + 18, + 5, + 19, + 5, + 20, + 5, + 21, + 5, + 22, + 5, + 23, + 5, + 24, + 5, + 25, + 5, + 26, + 6, + 0, + 6, + 1, + 6, + 2, + 6, + 3, + 6, + 4, + 6, + 5, + 6, + 6, + 6, + 7, + 6, + 8, + 6, + 9, + 6, + 10, + 6, + 11, + 6, + 12, + 6, + 13, + 6, + 14, + 6, + 15, + 6, + 16, + 6, + 17, + 6, + 18, + 6, + 19, + 6, + 20, + 6, + 21, + 6, + 22, + 6, + 23, + 6, + 24, + 6, + 25, + 6, + 26, + 7, + 0, + 7, + 1, + 7, + 2, + 7, + 3, + 7, + 4, + 7, + 5, + 7, + 6, + 7, + 7, + 7, + 8, + 7, + 9, + 7, + 10, + 7, + 11, + 7, + 12, + 7, + 13, + 7, + 14, + 7, + 15, + 7, + 16, + 7, + 17, + 7, + 18, + 7, + 19, + 7, + 20, + 7, + 21, + 7, + 22, + 7, + 23, + 7, + 24, + 7, + 25, + 7, + 26, + 8, + 0, + 8, + 1, + 8, + 2, + 8, + 3, + 8, + 4, + 8, + 5, + 8, + 6, + 8, + 7, + 8, + 8, + 8, + 9, + 8, + 10, + 8, + 11, + 8, + 12, + 8, + 13, + 8, + 14, + 8, + 15, + 8, + 16, + 8, + 17, + 8, + 18, + 8, + 19, + 8, + 20, + 8, + 21, + 8, + 22, + 8, + 23, + 8, + 24, + 8, + 25, + 8, + 26, + 9, + 0, + 9, + 1, + 9, + 2, + 9, + 3, + 9, + 4, + 9, + 5, + 9, + 6, + 9, + 7, + 9, + 8, + 9, + 9, + 9, + 10, + 9, + 11, + 9, + 12, + 9, + 13, + 9, + 14, + 9, + 15, + 9, + 16, + 9, + 17, + 9, + 18, + 9, + 19, + 9, + 20, + 9, + 21, + 9, + 22, + 9, + 23, + 9, + 24, + 9, + 25, + 9, + 26, + 10, + 0, + 10, + 1, + 10, + 2, + 10, + 3, + 10, + 4, + 10, + 5, + 10, + 6, + 10, + 7, + 10, + 8, + 10, + 9, + 10, + 10, + 10, + 11, + 10, + 12, + 10, + 13, + 10, + 14, + 10, + 15, + 10, + 16, + 10, + 17, + 10, + 18, + 10, + 19, + 10, + 20, + 10, + 21, + 10, + 22, + 10, + 23, + 10, + 24, + 10, + 25, + 10, + 26, + 11, + 0, + 11, + 1, + 11, + 2, + 11, + 3, + 11, + 4, + 11, + 5, + 11, + 6, + 11, + 7, + 11, + 8, + 11, + 9, + 11, + 10, + 11, + 11, + 11, + 12, + 11, + 13, + 11, + 14, + 11, + 15, + 11, + 16, + 11, + 17, + 11, + 18, + 11, + 19, + 11, + 20, + 11, + 21, + 11, + 22, + 11, + 23, + 11, + 24, + 11, + 25, + 11, + 26, + 12, + 0, + 12, + 1, + 12, + 2, + 12, + 3, + 12, + 4, + 12, + 5, + 12, + 6, + 12, + 7, + 12, + 8, + 12, + 9, + 12, + 10, + 12, + 11, + 12, + 12, + 12, + 13, + 12, + 14, + 12, + 15, + 12, + 16, + 12, + 17, + 12, + 18, + 12, + 19, + 12, + 20, + 12, + 21, + 12, + 22, + 12, + 23, + 12, + 24, + 12, + 25, + 12, + 26, + 13, + 0, + 13, + 1, + 13, + 2, + 13, + 3, + 13, + 4, + 13, + 5, + 13, + 6, + 13, + 7, + 13, + 8, + 13, + 9, + 13, + 10, + 13, + 11, + 13, + 12, + 13, + 13, + 13, + 14, + 13, + 15, + 13, + 16, + 13, + 17, + 13, + 18, + 13, + 19, + 13, + 20, + 13, + 21, + 13, + 22, + 13, + 23, + 13, + 24, + 13, + 25, + 13, + 26, + 14, + 0, + 14, + 1, + 14, + 2, + 14, + 3, + 14, + 4, + 14, + 5, + 14, + 6, + 14, + 7, + 14, + 8, + 14, + 9, + 14, + 10, + 14, + 11, + 14, + 12, + 14, + 13, + 14, + 14, + 14, + 15, + 14, + 16, + 14, + 17, + 14, + 18, + 14, + 19, + 14, + 20, + 14, + 21, + 14, + 22, + 14, + 23, + 14, + 24, + 14, + 25, + 14, + 26, + 15, + 0, + 15, + 1, + 15, + 2, + 15, + 3, + 15, + 4, + 15, + 5, + 15, + 6, + 15, + 7, + 15, + 8, + 15, + 9, + 15, + 10, + 15, + 11, + 15, + 12, + 15, + 13, + 15, + 14, + 15, + 15, + 15, + 16, + 15, + 17, + 15, + 18, + 15, + 19, + 15, + 20, + 15, + 21, + 15, + 22, + 15, + 23, + 15, + 24, + 15, + 25, + 15, + 26, + 16, + 0, + 16, + 1, + 16, + 2, + 16, + 3, + 16, + 4, + 16, + 5, + 16, + 6, + 16, + 7, + 16, + 8, + 16, + 9, + 16, + 10, + 16, + 11, + 16, + 12, + 16, + 13, + 16, + 14, + 16, + 15, + 16, + 16, + 16, + 17, + 16, + 18, + 16, + 19, + 16, + 20, + 16, + 21, + 16, + 22, + 16, + 23, + 16, + 24, + 16, + 25, + 16, + 26, + 17, + 0, + 17, + 1, + 17, + 2, + 17, + 3, + 17, + 4, + 17, + 5, + 17, + 6, + 17, + 7, + 17, + 8, + 17, + 9, + 17, + 10, + 17, + 11, + 17, + 12, + 17, + 13, + 17, + 14, + 17, + 15, + 17, + 16, + 17, + 17, + 17, + 18, + 17, + 19, + 17, + 20, + 17, + 21, + 17, + 22, + 17, + 23, + 17, + 24, + 17, + 25, + 17, + 26, + 18, + 0, + 18, + 1, + 18, + 2, + 18, + 3, + 18, + 4, + 18, + 5, + 18, + 6, + 18, + 7, + 18, + 8, + 18, + 9, + 18, + 10, + 18, + 11, + 18, + 12, + 18, + 13, + 18, + 14, + 18, + 15, + 18, + 16, + 18, + 17, + 18, + 18, + 18, + 19, + 18, + 20, + 18, + 21, + 18, + 22, + 18, + 23, + 18, + 24, + 18, + 25, + 18, + 26, + 19, + 0, + 19, + 1, + 19, + 2, + 19, + 3, + 19, + 4, + 19, + 5, + 19, + 6, + 19, + 7, + 19, + 8, + 19, + 9, + 19, + 10, + 19, + 11, + 19, + 12, + 19, + 13, + 19, + 14, + 19, + 15, + 19, + 16, + 19, + 17, + 19, + 18, + 19, + 19, + 19, + 20, + 19, + 21, + 19, + 22, + 19, + 23, + 19, + 24, + 19, + 25, + 19, + 26, + 20, + 0, + 20, + 1, + 20, + 2, + 20, + 3, + 20, + 4, + 20, + 5, + 20, + 6, + 20, + 7, + 20, + 8, + 20, + 9, + 20, + 10, + 20, + 11, + 20, + 12, + 20, + 13, + 20, + 14, + 20, + 15, + 20, + 16, + 20, + 17, + 20, + 18, + 20, + 19, + 20, + 20, + 20, + 21, + 20, + 22, + 20, + 23, + 20, + 24, + 20, + 25, + 20, + 26, + 21, + 0, + 21, + 1, + 21, + 2, + 21, + 3, + 21, + 4, + 21, + 5, + 21, + 6, + 21, + 7, + 21, + 8, + 21, + 9, + 21, + 10, + 21, + 11, + 21, + 12, + 21, + 13, + 21, + 14, + 21, + 15, + 21, + 16, + 21, + 17, + 21, + 18, + 21, + 19, + 21, + 20, + 21, + 21, + 21, + 22, + 21, + 23, + 21, + 24, + 21, + 25, + 21, + 26, + 22, + 0, + 22, + 1, + 22, + 2, + 22, + 3, + 22, + 4, + 22, + 5, + 22, + 6, + 22, + 7, + 22, + 8, + 22, + 9, + 22, + 10, + 22, + 11, + 22, + 12, + 22, + 13, + 22, + 14, + 22, + 15, + 22, + 16, + 22, + 17, + 22, + 18, + 22, + 19, + 22, + 20, + 22, + 21, + 22, + 22, + 22, + 23, + 22, + 24, + 22, + 25, + 22, + 26, + 23, + 0, + 23, + 1, + 23, + 2, + 23, + 3, + 23, + 4, + 23, + 5, + 23, + 6, + 23, + 7, + 23, + 8, + 23, + 9, + 23, + 10, + 23, + 11, + 23, + 12, + 23, + 13, + 23, + 14, + 23, + 15, + 23, + 16, + 23, + 17, + 23, + 18, + 23, + 19, + 23, + 20, + 23, + 21, + 23, + 22, + 23, + 23, + 23, + 24, + 23, + 25, + 23, + 26, + 24, + 0, + 24, + 1, + 24, + 2, + 24, + 3, + 24, + 4, + 24, + 5, + 24, + 6, + 24, + 7, + 24, + 8, + 24, + 9, + 24, + 10, + 24, + 11, + 24, + 12, + 24, + 13, + 24, + 14, + 24, + 15, + 24, + 16, + 24, + 17, + 24, + 18, + 24, + 19, + 24, + 20, + 24, + 21, + 24, + 22, + 24, + 23, + 24, + 24, + 24, + 25, + 24, + 26, + 25, + 0, + 25, + 1, + 25, + 2, + 25, + 3, + 25, + 4, + 25, + 5, + 25, + 6, + 25, + 7, + 25, + 8, + 25, + 9, + 25, + 10, + 25, + 11, + 25, + 12, + 25, + 13, + 25, + 14, + 25, + 15, + 25, + 16, + 25, + 17, + 25, + 18, + 25, + 19, + 25, + 20, + 25, + 21, + 25, + 22, + 25, + 23, + 25, + 24, + 25, + 25, + 25, + 26, + 26, + 0, + 26, + 1, + 26, + 2, + 26, + 3, + 26, + 4, + 26, + 5, + 26, + 6, + 26, + 7, + 26, + 8, + 26, + 9, + 26, + 10, + 26, + 11, + 26, + 12, + 26, + 13, + 26, + 14, + 26, + 15, + 26, + 16, + 26, + 17, + 26, + 18, + 26, + 19, + 26, + 20, + 26, + 21, + 26, + 22, + 26, + 23, + 26, + 24, + 26, + 25, + 26, + 26, }; -const int32_t(*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { +const int32_t ( *c_apaiDemodTables[ALLOC_TABLE_SIZE] )[2] = { NULL, c_aaiHuffDemod1, c_aaiHuffDemod2, @@ -4670,95 +51911,1156 @@ const int32_t(*c_apaiDemodTables[ALLOC_TABLE_SIZE])[2] = { #endif const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { - 0x40, 0x40, 0x3F, 0x3F, 0x3E, 0x3E, 0x3D, 0x3D, 0x3C, 0x3C, 0x3B, 0x3B, 0x3A, 0x3A, 0x39, 0x39, - 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, - 0x31, 0x31, 0x31, 0x30, 0x30, 0x2F, 0x2F, 0x2F, 0x2E, 0x2E, 0x2D, 0x2D, 0x2D, 0x2C, 0x2C, 0x2B, - 0x2B, 0x2B, 0x2A, 0x2A, 0x2A, 0x29, 0x29, 0x29, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26, - 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21, - 0x20, 0x20, 0x20, 0x20, 0x1F, 0x1F, 0x1F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1D, 0x1D, 0x1D, 0x1C, 0x1C, - 0x1C, 0x1C, 0x1B, 0x1B, 0x1B, 0x1B, 0x1A, 0x1A, 0x1A, 0x1A, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, - 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0F, 0x0F, 0x0F, - 0x0F, 0x0F, 0x0F, 0x0F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0D, 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, - 0x0B, 0x0B, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, + 0x40, + 0x3F, + 0x3F, + 0x3E, + 0x3E, + 0x3D, + 0x3D, + 0x3C, + 0x3C, + 0x3B, + 0x3B, + 0x3A, + 0x3A, + 0x39, + 0x39, + 0x38, + 0x38, + 0x37, + 0x37, + 0x37, + 0x36, + 0x36, + 0x35, + 0x35, + 0x34, + 0x34, + 0x33, + 0x33, + 0x33, + 0x32, + 0x32, + 0x31, + 0x31, + 0x31, + 0x30, + 0x30, + 0x2F, + 0x2F, + 0x2F, + 0x2E, + 0x2E, + 0x2D, + 0x2D, + 0x2D, + 0x2C, + 0x2C, + 0x2B, + 0x2B, + 0x2B, + 0x2A, + 0x2A, + 0x2A, + 0x29, + 0x29, + 0x29, + 0x28, + 0x28, + 0x27, + 0x27, + 0x27, + 0x26, + 0x26, + 0x26, + 0x25, + 0x25, + 0x25, + 0x24, + 0x24, + 0x24, + 0x23, + 0x23, + 0x23, + 0x23, + 0x22, + 0x22, + 0x22, + 0x21, + 0x21, + 0x21, + 0x20, + 0x20, + 0x20, + 0x20, + 0x1F, + 0x1F, + 0x1F, + 0x1E, + 0x1E, + 0x1E, + 0x1E, + 0x1D, + 0x1D, + 0x1D, + 0x1C, + 0x1C, + 0x1C, + 0x1C, + 0x1B, + 0x1B, + 0x1B, + 0x1B, + 0x1A, + 0x1A, + 0x1A, + 0x1A, + 0x19, + 0x19, + 0x19, + 0x19, + 0x18, + 0x18, + 0x18, + 0x18, + 0x18, + 0x17, + 0x17, + 0x17, + 0x17, + 0x16, + 0x16, + 0x16, + 0x16, + 0x16, + 0x15, + 0x15, + 0x15, + 0x15, + 0x15, + 0x14, + 0x14, + 0x14, + 0x14, + 0x14, + 0x13, + 0x13, + 0x13, + 0x13, + 0x13, + 0x13, + 0x12, + 0x12, + 0x12, + 0x12, + 0x12, + 0x11, + 0x11, + 0x11, + 0x11, + 0x11, + 0x11, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x10, + 0x0F, + 0x0F, + 0x0F, + 0x0F, + 0x0F, + 0x0F, + 0x0F, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0D, + 0x0D, + 0x0D, + 0x0D, + 0x0D, + 0x0D, + 0x0D, + 0x0D, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0B, + 0x0B, + 0x0B, + 0x0B, + 0x0B, + 0x0B, + 0x0B, + 0x0B, + 0x0B, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x0A, + 0x09, + 0x09, + 0x09, + 0x09, + 0x09, + 0x09, + 0x09, + 0x09, + 0x09, + 0x09, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x08, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x07, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x06, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x05, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x04, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, }; const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48] = { - 0,0,0,0,0,0,0,0,0,0,0,64,64,64,64,64, - 101,101,128,165,165,180,213, }; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 64, + 64, + 64, + 64, + 64, + 101, + 101, + 128, + 165, + 165, + 180, + 213, +}; const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48] = { - -1787,-1787,-1787,-1787,-1787,-1787,-1787,-1787,-1782,-1761,-1737,-1679,-1638,-1613,-1590,-1568, - -1516,-1459,-1395,-1289,-671,-409,-401, }; + -1787, + -1787, + -1787, + -1787, + -1787, + -1787, + -1787, + -1787, + -1782, + -1761, + -1737, + -1679, + -1638, + -1613, + -1590, + -1568, + -1516, + -1459, + -1395, + -1289, + -671, + -409, + -401, +}; #if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4 const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { - 7,7,6,5,5,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4, + 7, + 7, + 6, + 5, + 5, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, }; #elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8 const int32_t c_aiDefaultTheta48[MAX_BANDS_48] = { - 112,112,96,80,80,64,64,64,64,64,64,64,64,64,64,64, - 64,64,64,64,64,64,64, + 112, + 112, + 96, + 80, + 80, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, }; #endif -const int32_t c_aaiSpreadFunction48[MAX_BANDS_48*MAX_BANDS_48] = { - 0,-1561,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-289,-4,-1234,-2295,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-569,-229, - -8,-905,-1705,-2324,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-789,-445,-173,-16,-656,-1271,-1765,-2172,-2520,-2552,-2552, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-961,-616,-340,-136, - -28,-488,-976,-1382,-1729,-2032,-2305,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-2552,-2552,-1088,-743,-465,-257,-148,-31,-371,-769,-1114,-1417,-1689,-2054,-2483, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1198,-852,-574,-364,-209,-148, - -42,-300,-635,-936,-1207,-1572,-2000,-2376,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552, - -2552,-1293,-948,-669,-458,-301,-183,-145,-56,-258,-547,-816,-1179,-1606,-1982,-2311, - -2552,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1375,-1029,-750,-539,-381,-260,-180,-142, - -68,-231,-487,-846,-1272,-1647,-1976,-2261,-2552,-2552,-2552,-2552,-2552,-2552,-2552,-1444, - -1099,-820,-608,-449,-328,-233,-194,-138,-77,-213,-555,-978,-1352,-1681,-1966,-2268, - -2552,-2552,-2552,-2552,-2552,-2552,-1501,-1155,-876,-665,-505,-383,-287,-210,-193,-130, - -79,-298,-711,-1083,-1411,-1696,-1997,-2288,-2550,-2552,-2552,-2552,-2552,-1567,-1221,-942, - -730,-570,-448,-351,-272,-206,-189,-151,-72,-349,-713,-1039,-1324,-1625,-1915,-2177, - -2448,-2552,-2552,-2552,-1650,-1304,-1025,-813,-653,-530,-432,-352,-285,-227,-177,-163, - -69,-297,-613,-895,-1195,-1485,-1746,-2017,-2238,-2401,-2545,-1727,-1381,-1102,-890,-730, - -607,-509,-428,-360,-301,-249,-180,-153,-72,-257,-527,-824,-1112,-1373,-1643,-1865, - -2028,-2171,-1798,-1452,-1173,-960,-800,-677,-579,-498,-430,-370,-317,-246,-192,-145, - -76,-224,-505,-790,-1050,-1320,-1540,-1703,-1847,-1860,-1514,-1234,-1022,-862,-738,-640, - -559,-490,-430,-377,-306,-224,-197,-136,-81,-242,-515,-771,-1040,-1260,-1422,-1566, - -1923,-1577,-1297,-1085,-925,-801,-703,-621,-553,-492,-439,-367,-284,-213,-198,-144, - -83,-235,-479,-744,-963,-1125,-1268,-1986,-1640,-1360,-1148,-988,-864,-766,-684,-615, - -555,-501,-429,-345,-273,-211,-204,-146,-89,-216,-465,-680,-841,-984,-2043,-1697, - -1417,-1205,-1044,-921,-822,-741,-672,-611,-557,-485,-401,-328,-264,-211,-205,-140, - -93,-227,-430,-588,-729,-2104,-1758,-1479,-1266,-1106,-982,-884,-802,-733,-673,-619, - -546,-461,-388,-324,-269,-212,-211,-151,-100,-195,-336,-472,-2163,-1817,-1537,-1324, - -1164,-1040,-942,-860,-791,-731,-676,-604,-519,-445,-380,-325,-268,-226,-219,-147, - -114,-167,-280,-2203,-1857,-1577,-1365,-1205,-1081,-982,-901,-831,-771,-717,-644,-559, - -485,-420,-364,-306,-252,-239,-206,-132,-122,-163,-2224,-1878,-1598,-1386,-1225,-1102, - -1003,-921,-852,-792,-737,-665,-580,-505,-441,-385,-326,-271,-222,-224,-176,-121,-114, +const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48] = { + 0, + -1561, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -289, + -4, + -1234, + -2295, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -569, + -229, + -8, + -905, + -1705, + -2324, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -789, + -445, + -173, + -16, + -656, + -1271, + -1765, + -2172, + -2520, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -961, + -616, + -340, + -136, + -28, + -488, + -976, + -1382, + -1729, + -2032, + -2305, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -1088, + -743, + -465, + -257, + -148, + -31, + -371, + -769, + -1114, + -1417, + -1689, + -2054, + -2483, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -1198, + -852, + -574, + -364, + -209, + -148, + -42, + -300, + -635, + -936, + -1207, + -1572, + -2000, + -2376, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -1293, + -948, + -669, + -458, + -301, + -183, + -145, + -56, + -258, + -547, + -816, + -1179, + -1606, + -1982, + -2311, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -1375, + -1029, + -750, + -539, + -381, + -260, + -180, + -142, + -68, + -231, + -487, + -846, + -1272, + -1647, + -1976, + -2261, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -1444, + -1099, + -820, + -608, + -449, + -328, + -233, + -194, + -138, + -77, + -213, + -555, + -978, + -1352, + -1681, + -1966, + -2268, + -2552, + -2552, + -2552, + -2552, + -2552, + -2552, + -1501, + -1155, + -876, + -665, + -505, + -383, + -287, + -210, + -193, + -130, + -79, + -298, + -711, + -1083, + -1411, + -1696, + -1997, + -2288, + -2550, + -2552, + -2552, + -2552, + -2552, + -1567, + -1221, + -942, + -730, + -570, + -448, + -351, + -272, + -206, + -189, + -151, + -72, + -349, + -713, + -1039, + -1324, + -1625, + -1915, + -2177, + -2448, + -2552, + -2552, + -2552, + -1650, + -1304, + -1025, + -813, + -653, + -530, + -432, + -352, + -285, + -227, + -177, + -163, + -69, + -297, + -613, + -895, + -1195, + -1485, + -1746, + -2017, + -2238, + -2401, + -2545, + -1727, + -1381, + -1102, + -890, + -730, + -607, + -509, + -428, + -360, + -301, + -249, + -180, + -153, + -72, + -257, + -527, + -824, + -1112, + -1373, + -1643, + -1865, + -2028, + -2171, + -1798, + -1452, + -1173, + -960, + -800, + -677, + -579, + -498, + -430, + -370, + -317, + -246, + -192, + -145, + -76, + -224, + -505, + -790, + -1050, + -1320, + -1540, + -1703, + -1847, + -1860, + -1514, + -1234, + -1022, + -862, + -738, + -640, + -559, + -490, + -430, + -377, + -306, + -224, + -197, + -136, + -81, + -242, + -515, + -771, + -1040, + -1260, + -1422, + -1566, + -1923, + -1577, + -1297, + -1085, + -925, + -801, + -703, + -621, + -553, + -492, + -439, + -367, + -284, + -213, + -198, + -144, + -83, + -235, + -479, + -744, + -963, + -1125, + -1268, + -1986, + -1640, + -1360, + -1148, + -988, + -864, + -766, + -684, + -615, + -555, + -501, + -429, + -345, + -273, + -211, + -204, + -146, + -89, + -216, + -465, + -680, + -841, + -984, + -2043, + -1697, + -1417, + -1205, + -1044, + -921, + -822, + -741, + -672, + -611, + -557, + -485, + -401, + -328, + -264, + -211, + -205, + -140, + -93, + -227, + -430, + -588, + -729, + -2104, + -1758, + -1479, + -1266, + -1106, + -982, + -884, + -802, + -733, + -673, + -619, + -546, + -461, + -388, + -324, + -269, + -212, + -211, + -151, + -100, + -195, + -336, + -472, + -2163, + -1817, + -1537, + -1324, + -1164, + -1040, + -942, + -860, + -791, + -731, + -676, + -604, + -519, + -445, + -380, + -325, + -268, + -226, + -219, + -147, + -114, + -167, + -280, + -2203, + -1857, + -1577, + -1365, + -1205, + -1081, + -982, + -901, + -831, + -771, + -717, + -644, + -559, + -485, + -420, + -364, + -306, + -252, + -239, + -206, + -132, + -122, + -163, + -2224, + -1878, + -1598, + -1386, + -1225, + -1102, + -1003, + -921, + -852, + -792, + -737, + -665, + -580, + -505, + -441, + -385, + -326, + -271, + -222, + -224, + -176, + -121, + -114, }; #endif - diff --git a/lib_rend/ivas_lcld_tables.h b/lib_rend/ivas_lcld_tables.h index ad2a836f49..ee92fa46b9 100644 --- a/lib_rend/ivas_lcld_tables.h +++ b/lib_rend/ivas_lcld_tables.h @@ -53,7 +53,7 @@ extern "C" #define MAX_BANDS ( 23 ) #define MAX_BANDS_48 ( 23 ) - extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this +extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this #define ENV_MIN ( -64 ) @@ -105,20 +105,6 @@ extern "C" #define TON_QUOTA_ABS_THRESHOLD ( 8.0f ) #define TON_QUOTA_INC_THRESHOLD ( 4.0f ) -#define LOG_ADD_TABLE_LENGTH ( 512 ) - -#define PERCEPTUAL_MODEL_SCALE ( 64 ) - -#define PERCEPTUAL_MODEL_SCALE_SHIFT ( 6 ) - -#define PERCEPTUAL_MODEL_ALPHA_SCALE ( 614 ) - -#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE ( 6827 ) - -#define PERCEPTUAL_MODEL_ALPHA_SHIFT ( 11 ) - -#define PERCEPTUAL_MODEL_SLGAIN_SHIFT ( 8 ) //(4) - #define MAX_BANDS_48 ( 23 ) //#define USE_DEMOD_TABLES @@ -149,12 +135,6 @@ extern "C" extern const int32_t c_aiHuffmanSize[ALLOC_TABLE_SIZE]; - extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH]; - extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48]; - extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48]; - extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; - extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48]; - #ifndef ROM_TO_RAM extern const uint32_t c_aauiCQMFHuffEnc1[16][2]; @@ -580,20 +560,6 @@ extern const uint32_t num_row_aauiCQMFHuff[2 * ALLOC_TABLE_SIZE]; extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; - void PerceptualModel( const int32_t iMaxQuantBands, - const int32_t *piRMSEnvelope, - int32_t *piExcitation, - int32_t *piSMR ); - - void PerceptualModelStereo( const int32_t iMaxQuantBands, - const int32_t *piMSFlags, - const int32_t *piRMSEnvelope0, - const int32_t *piRMSEnvelope1, - int32_t *piExcitation0, - int32_t *piExcitation1, - int32_t *piSMR0, - int32_t *piSMR1 ); - #ifdef __cplusplus } #endif -- GitLab From 2e253a1ed0296641a6ab60be5d1106e1aedc2456 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Thu, 4 May 2023 18:40:34 +0530 Subject: [PATCH 127/591] clang format fix --- lib_rend/ivas_CQMFEncoder.c | 24 ++++++++-------- lib_rend/ivas_PerceptualModel.h | 50 ++++++++++++++++----------------- lib_rend/ivas_lcld_tables.h | 2 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c index 82bcf6879a..755fb670f4 100644 --- a/lib_rend/ivas_CQMFEncoder.c +++ b/lib_rend/ivas_CQMFEncoder.c @@ -1079,12 +1079,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; if ( fVal > 0.0 ) { - iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 1; } iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; @@ -1094,12 +1094,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; if ( fVal > 0.0 ) { - iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 1; } @@ -1137,12 +1137,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfReal[iBlockOffset][iFBOffset]; if ( fVal > 0.0 ) { - iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 1; } iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; @@ -1152,12 +1152,12 @@ static void QuantizeSpectrumDPCM_Opt( const int32_t iNumGroups, fVal = ppfImag[iBlockOffset][iFBOffset]; if ( fVal > 0.0 ) { - iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 1; } iQuantValue = ( iQuantValue < iMaxQuantVal ) ? iQuantValue : iMaxQuantVal; @@ -1239,12 +1239,12 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups, fVal = ppfReal[iBlockOffset][iFBOffset] + fPredReal; if ( fVal > 0.0 ) { - iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); ppiSignReal[iBlockOffset][iFBOffset] = 1; } #ifdef _DEBUG_VERBOSE @@ -1262,12 +1262,12 @@ static void QuantizeSpectrumDPCM( const int32_t iNumGroups, fVal = ppfImag[iBlockOffset][iFBOffset] + fPredImag; if ( fVal > 0.0 ) { - iQuantValue = ( int32_t )( fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 0; } else { - iQuantValue = ( int32_t )( -fSCFGain * fVal + 0.5 ); + iQuantValue = (int32_t) ( -fSCFGain * fVal + 0.5 ); ppiSignImag[iBlockOffset][iFBOffset] = 1; } diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h index fdd1027623..269bfa4a3f 100644 --- a/lib_rend/ivas_PerceptualModel.h +++ b/lib_rend/ivas_PerceptualModel.h @@ -39,34 +39,34 @@ extern "C" #endif #include -#define LOG_ADD_TABLE_LENGTH (512) -#define PERCEPTUAL_MODEL_SCALE (64) -#define PERCEPTUAL_MODEL_SCALE_SHIFT (6) -#define PERCEPTUAL_MODEL_ALPHA_SCALE (614) -#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE (6827) -#define PERCEPTUAL_MODEL_ALPHA_SHIFT (11) -#define PERCEPTUAL_MODEL_SLGAIN_SHIFT (8)//(4) -#define MAX_BANDS_48 ( 23 ) +#define LOG_ADD_TABLE_LENGTH ( 512 ) +#define PERCEPTUAL_MODEL_SCALE ( 64 ) +#define PERCEPTUAL_MODEL_SCALE_SHIFT ( 6 ) +#define PERCEPTUAL_MODEL_ALPHA_SCALE ( 614 ) +#define PERCEPTUAL_MODEL_ALPHA_INV_SCALE ( 6827 ) +#define PERCEPTUAL_MODEL_ALPHA_SHIFT ( 11 ) +#define PERCEPTUAL_MODEL_SLGAIN_SHIFT ( 8 ) //(4) +#define MAX_BANDS_48 ( 23 ) - extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH]; - extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48]; - extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48]; - extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; - extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48]; + extern const int32_t c_aiLogAddTable[LOG_ADD_TABLE_LENGTH]; + extern const int32_t c_aiBandwidthAdjust48[MAX_BANDS_48]; + extern const int32_t c_aiAbsoluteThresh48[MAX_BANDS_48]; + extern const int32_t c_aiDefaultTheta48[MAX_BANDS_48]; + extern const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48]; - extern void PerceptualModel(const int32_t iMaxQuantBands, - const int32_t *piRMSEnvelope, - int32_t *piExcitation, - int32_t *piSMR); + extern void PerceptualModel( const int32_t iMaxQuantBands, + const int32_t *piRMSEnvelope, + int32_t *piExcitation, + int32_t *piSMR ); - extern void PerceptualModelStereo(const int32_t iMaxQuantBands, - const int32_t *piMSFlags, - const int32_t *piRMSEnvelope0, - const int32_t *piRMSEnvelope1, - int32_t *piExcitation0, - int32_t *piExcitation1, - int32_t *piSMR0, - int32_t *piSMR1); + extern void PerceptualModelStereo( const int32_t iMaxQuantBands, + const int32_t *piMSFlags, + const int32_t *piRMSEnvelope0, + const int32_t *piRMSEnvelope1, + int32_t *piExcitation0, + int32_t *piExcitation1, + int32_t *piSMR0, + int32_t *piSMR1 ); #ifdef __cplusplus } diff --git a/lib_rend/ivas_lcld_tables.h b/lib_rend/ivas_lcld_tables.h index ee92fa46b9..b50edae637 100644 --- a/lib_rend/ivas_lcld_tables.h +++ b/lib_rend/ivas_lcld_tables.h @@ -53,7 +53,7 @@ extern "C" #define MAX_BANDS ( 23 ) #define MAX_BANDS_48 ( 23 ) -extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this + extern const int32_t c_aiBandwidths48[MAX_BANDS_48]; // move this #define ENV_MIN ( -64 ) -- GitLab From 18f88b6aa439c1d88f06cd5c5b36a80eec10c74c Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 5 May 2023 16:48:15 +1000 Subject: [PATCH 128/591] minor clean up of buffer lenght macros for various formats --- lib_rend/lib_rend.c | 53 ++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1f1be0b7b0..650c10206b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -55,7 +55,14 @@ /* Maximum buffer length (total) in samples. */ #ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef REND_STATIC_MEM_OPT +#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) +#else #define MAX_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#endif + #else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #endif @@ -2543,7 +2550,7 @@ static ivas_error setRendInputActiveSplitPostRend( outConfig = *rendCtx.pOutConfig; #ifdef REND_STATIC_MEM_OPT - if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BIN_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } @@ -2551,7 +2558,7 @@ static ivas_error setRendInputActiveSplitPostRend( initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx #ifdef REND_STATIC_MEM_OPT , - inputSplitPostRend->bufferData, MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS + inputSplitPostRend->bufferData, MAX_BIN_BUFFER_LENGTH #endif ); @@ -2588,7 +2595,7 @@ static ivas_error setRendInputActiveSba( } #ifdef REND_STATIC_MEM_OPT - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } @@ -2596,7 +2603,7 @@ static ivas_error setRendInputActiveSba( initRendInputBase( &inputSba->base, inConfig, id, rendCtx #ifdef REND_STATIC_MEM_OPT , - inputSba->bufferData, MAX_BUFFER_LENGTH + inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH #endif ); setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -4099,13 +4106,15 @@ ivas_error IVAS_REND_GetDelay( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->inputsSba[i].splitRendWrapper.hBinHrSplitPreRend != NULL ) { - if ( hIvasRend->hRendererConfig->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV ) +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) + if ( hIvasRend->hRendererConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { - latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; + latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; } else +#endif { - latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; + latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; } max_latency_ns = max( max_latency_ns, latency_ns ); } @@ -6102,21 +6111,8 @@ static ivas_error renderSbaToSplitBinaural( &sbaInput->splitRendWrapper.multiBinPoseData, sbaInput->base.ctx.pHeadRotData->sr_pose_pred_axis ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override != RENDER_TYPE_OVERRIDE_FASTCONV ) - { - renderSbaToMultiBinaural( - sbaInput, - outConfig, - tmpCrendBuffer ); - max_band = (int16_t) ( ( BINAURAL_MAXBANDS * ( *sbaInput->base.ctx.pOutSampleRate ) ) / 48000 ); - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); - } - } - else -#endif +#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) + if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); @@ -6131,6 +6127,19 @@ static ivas_error renderSbaToSplitBinaural( low_res_pre_rend_rot ); max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; } + else +#endif + { + renderSbaToMultiBinaural( + sbaInput, + outConfig, + tmpCrendBuffer ); + max_band = (int16_t) ( ( BINAURAL_MAXBANDS * ( *sbaInput->base.ctx.pOutSampleRate ) ) / 48000 ); + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + } + } /*SPLIT pre rendering MD and CLDFB coding*/ convertBitsBufferToInternalBitsBuff( *hBits, &bits ); -- GitLab From 0ec0211198b706b3f26e4586974295c5c104afcf Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 8 May 2023 16:58:22 +1000 Subject: [PATCH 129/591] fix for clang memory sanitizer --- lib_com/options.h | 1 + lib_rend/ivas_CQMFDecoder.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index dec3063de3..eadd9a164c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -207,6 +207,7 @@ #define SBA_CREND_ROT_OPT #define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ +#define SPLIT_REND_CLANG_SAN_FIX #endif diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 0c152e95e3..b5fe0b38ea 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -1623,18 +1623,39 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int ppiSignReal[iBlockOffest][iFBOffset] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); iBitsRead += 1; } +#ifdef SPLIT_REND_CLANG_SAN_FIX + else + { + ppiSignReal[iBlockOffest][iFBOffset] = 0; + } +#endif if ( iQuantValue2 > 0 ) { ppiSignImag[iBlockOffest][iFBOffset] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); iBitsRead += 1; } +#ifdef SPLIT_REND_CLANG_SAN_FIX + else + { + ppiSignImag[iBlockOffest][iFBOffset] = 0; + } +#endif iFBOffset++; } } else { +#ifdef SPLIT_REND_CLANG_SAN_FIX + for ( m = 0; m < piBandwidths[b]; m++ ) + { + ppiSignReal[iBlockOffest][iFBOffset] = 0; + ppiSignImag[iBlockOffest][iFBOffset] = 0; + iFBOffset++; + } +#else iFBOffset += piBandwidths[b]; +#endif } } -- GitLab From 775112f019e64dc6414fd6561382f5a9a4d1b5ba Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 9 May 2023 19:59:13 +1000 Subject: [PATCH 130/591] clang address sanitizer fix --- apps/renderer.c | 8 ++++++++ lib_com/ivas_cnst.h | 5 ++++- lib_com/options.h | 2 +- lib_dec/ivas_binRenderer_internal.c | 3 ++- lib_rend/lib_rend.c | 5 +++-- lib_util/split_render_file_read_write.c | 6 ++++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 9f9f6f1ea8..64d87d0092 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -66,6 +66,10 @@ #define RENDERER_MAX_METADATA_LENGTH 8192 #define RENDERER_MAX_METADATA_LINE_LENGTH 1024 +#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX +#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC ) + 7 ) >> 3 ) + SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) +#endif + #if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif @@ -1215,8 +1219,12 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( is_split_pre_rend_mode( &args ) || is_split_post_rend_mode( &args ) ) { +#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX + bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; +#else bitsBufferSize = (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC; bitsBufferSize = ( bitsBufferSize + 7 ) >> 3; +#endif } else { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4256e41afb..2bcf082064 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1728,8 +1728,11 @@ typedef enum #define SPLIT_REND_384k 384000 #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 -#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k +#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k +#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX +#define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) +#endif /*----------------------------------------------------------------------------------* * Limiter constants diff --git a/lib_com/options.h b/lib_com/options.h index eadd9a164c..917becccbd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -208,7 +208,7 @@ #define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ #define SPLIT_REND_CLANG_SAN_FIX - +#define SPLIT_REND_CLDFB_HUFF_SAN_FIX #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index c7cf76137a..d1942d94f5 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1520,7 +1520,7 @@ void ivas_rend_CldfbMultiBinRendProcess( for ( pose_idx = 0; pose_idx < hCldfbRend->numPoses; pose_idx++ ) - + { for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; @@ -1530,6 +1530,7 @@ void ivas_rend_CldfbMultiBinRendProcess( mvr2r( &Cldfb_ImagBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Imag[pose_idx][ch_idx][idx][0], hCldfbRend->max_band ); } } + } } return; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 650c10206b..80d578188f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6087,8 +6087,6 @@ static ivas_error renderSbaToSplitBinaural( { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -6114,6 +6112,9 @@ static ivas_error renderSbaToSplitBinaural( #if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); ivas_rend_CldfbMultiBinRendProcess( diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 8171354fe4..19c0544b16 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -235,6 +235,12 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea { return IVAS_ERR_FAILED_FILE_READ; } +#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX + for ( i = 0; i < SPLIT_REND_ADDITIONAL_BYTES_TO_READ; i++ ) + { + bits[num_bytes + i] = 0; + } +#endif *bits_read = 0; *bits_written = bit_len; -- GitLab From 73f4d59582b584ded0089fd3f21fcf6494d2254e Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 10 May 2023 10:39:53 +0200 Subject: [PATCH 131/591] bugfixes for OMASA: missing inits of ISM extended meta flags and ISM/MASA delay buffers. missing renderer reconfig in brsw. --- lib_com/options.h | 3 +- lib_dec/ivas_init_dec.c | 5 +++ lib_dec/ivas_omasa_dec.c | 85 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 99627150c5..9a1d0ae929 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,8 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define OMASA_ENERGIES -#define FIX_OMASA_STEREO_SWITCHING // VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps +#define FIX_OMASA_STEREO_SWITCHING // VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps +#define FIX_OMASA_BRSW /* Nokia + VA: Fix missing init of OMASA metadata delay buffers, brsw-related init fixes */ #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9469278bb8..70d4b7a1c2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -938,6 +938,11 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == MASA_FORMAT ) { +#ifdef FIX_OMASA_BRSW + /* if we start in ISM_MODE_NONE in MASA_ISM, that appears as normal MASA, but we may change to a mode with ISMs */ + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; +#endif if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 92cb4336ec..bc8bd03c5b 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -55,6 +55,9 @@ ivas_error ivas_masa_ism_data_open( { MASA_ISM_DATA_HANDLE hMasaIsmData; int16_t ch, bin; +#ifdef FIX_OMASA_BRSW + int16_t sf, obj_idx; +#endif if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) { @@ -83,6 +86,20 @@ ivas_error ivas_masa_ism_data_open( hMasaIsmData->q_azimuth_old[ch] = 0.0f; } +#ifdef FIX_OMASA_BRSW + for ( obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ ) + { + set_s( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); + set_s( hMasaIsmData->elevation_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) + { + set_zero( hMasaIsmData->energy_ratio_ism[obj_idx][sf], CLDFB_NO_CHANNELS_MAX ); + } + } + set_s( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); + set_s( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); +#endif + st_ivas->hMasaIsmData = hMasaIsmData; return IVAS_ERR_OK; @@ -139,6 +156,10 @@ ivas_error ivas_omasa_dec_config( IVAS_FORMAT ivas_format_orig; ivas_error error; +#ifdef FIX_OMASA_BRSW + RENDERER_TYPE old_renderer_type; +#endif + /* initializations */ ism_total_brate = 0; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -158,6 +179,13 @@ ivas_error ivas_omasa_dec_config( /* set ism_mode of current frame */ st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); +#ifdef FIX_OMASA_BRSW + /*-----------------------------------------------------------------* + * Renderer selection + *-----------------------------------------------------------------*/ + old_renderer_type = st_ivas->renderer_type; +#endif + /* MASA reconfig. */ cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ( cpe_brate < MASA_STEREO_MIN_BITRATE ) && st_ivas->nCPE == 1 ) @@ -243,6 +271,7 @@ ivas_error ivas_omasa_dec_config( ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); +#ifndef FIX_OMASA_BRSW #ifdef FIX_417_TD_DECORR_BRATE_SW /* TD Decorrelator */ if ( st_ivas->hDiracDecBin != NULL ) @@ -259,9 +288,40 @@ ivas_error ivas_omasa_dec_config( { return error; } +#endif st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; +#ifdef FIX_OMASA_BRSW + /*-----------------------------------------------------------------* + * Renderer selection + *-----------------------------------------------------------------*/ + ivas_renderer_select( st_ivas ); + + /*-------------------------------------------------------------------* + * Reallocate rendering handles + *--------------------------------------------------------------------*/ + + if ( old_renderer_type != st_ivas->renderer_type ) + { + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( st_ivas->hMonoDmxRenderer != NULL ) + { + free( st_ivas->hMonoDmxRenderer ); + st_ivas->hMonoDmxRenderer = NULL; + } + } + } +#endif + /* objects renderer reconfig. */ if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) { @@ -331,6 +391,31 @@ ivas_error ivas_omasa_dec_config( } } } + +#ifdef FIX_OMASA_BRSW +#ifdef FIX_417_TD_DECORR_BRATE_SW + /*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ + + if ( st_ivas->hDiracDecBin != NULL ) + { + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif } return IVAS_ERR_OK; -- GitLab From 25a7e706e98cf94ad1aa81dc7a0fa8a64c82d31d Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 10 May 2023 15:13:56 +0200 Subject: [PATCH 132/591] disable flag DEBUG_MODE_INFO --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7cc706472c..4041f922c2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ -- GitLab From 42de1177a593842e889c6c0f27f361b1bd4d23a2 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 10 May 2023 15:24:24 +0200 Subject: [PATCH 133/591] wrap dbgwrite() within OMASA_ENERGIES under DEBUGGING flag --- lib_enc/ivas_enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index b945ac48c6..c15e4f0bf0 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -389,7 +389,9 @@ ivas_error ivas_enc( { flag_omasa_brate = 1; } +#ifdef DEBUGGING dbgwrite( &energy_ism, sizeof( float ), 1, 1, "en_ratio.bin" ); +#endif } #endif /* Analysis, decision about bitrates per channel & core coding */ -- GitLab From 206e675b7ce2443fd355fc16385295c469fbe073 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 10 May 2023 23:52:27 +1000 Subject: [PATCH 134/591] stack optimization with default rend options --- lib_com/options.h | 1 + lib_rend/lib_rend.c | 51 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 917becccbd..5c06d98c06 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,6 +209,7 @@ #define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ #define SPLIT_REND_CLANG_SAN_FIX #define SPLIT_REND_CLDFB_HUFF_SAN_FIX +#define SPLIT_REND_STACK_OPT #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 80d578188f..250445010c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6077,6 +6077,30 @@ static ivas_error renderSbaToMultiBinaural( } #endif +#ifdef SPLIT_REND_STACK_OPT +static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, + float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t low_res_pre_rend_rot ) +{ + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + + copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + + ivas_rend_CldfbMultiBinRendProcess( + sbaInput->cldfbRendWrapper.hCldfbRend, + sbaInput->base.ctx.pHeadRotData, + &sbaInput->splitRendWrapper.multiBinPoseData, + Cldfb_RealBuffer, + Cldfb_ImagBuffer, + Cldfb_Out_Real, + Cldfb_Out_Imag, + low_res_pre_rend_rot ); + return IVAS_ERR_OK; +} +#endif + static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6112,6 +6136,13 @@ static ivas_error renderSbaToSplitBinaural( #if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { + +#ifdef SPLIT_REND_STACK_OPT + renderSbaToMultiBinauralCldfb( sbaInput, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + low_res_pre_rend_rot ); +#else float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -6126,6 +6157,7 @@ static ivas_error renderSbaToSplitBinaural( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, low_res_pre_rend_rot ); +#endif max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; } else @@ -6164,13 +6196,12 @@ static ivas_error renderSbaToSplitBinaural( } #endif -static ivas_error renderSbaToBinaural( +static ivas_error +renderSbaToBinaural( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { - float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; @@ -6179,10 +6210,16 @@ static ivas_error renderSbaToBinaural( #if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_STACK_OPT + renderSbaToMultiBinauralCldfb( sbaInput, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + 0 ); +#else + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); @@ -6195,12 +6232,14 @@ static ivas_error renderSbaToBinaural( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, 0 ); - +#endif accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], &outAudio ); } else #endif { + float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + tmpRotBuffer = sbaInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); -- GitLab From 03186a11dd471e24ed24382d264b45e2862ea90a Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 19 May 2023 17:45:05 +1000 Subject: [PATCH 135/591] adding PCM output support to ivas SBA decoder in split rend mode --- apps/decoder.c | 71 +++++++++++++++++++++++++---- lib_dec/ivas_binRenderer_internal.c | 5 +- lib_dec/ivas_dec.c | 10 ++-- lib_dec/ivas_dirac_dec.c | 3 +- lib_dec/ivas_init_dec.c | 12 +++-- lib_dec/ivas_output_config.c | 6 +-- lib_dec/ivas_sba_dec.c | 8 ++-- lib_dec/ivas_spar_decoder.c | 2 +- lib_dec/lib_dec.c | 10 +++- lib_dec/lib_dec.h | 1 + lib_rend/ivas_output_init.c | 2 + lib_rend/ivas_splitRendererPre.c | 2 +- lib_rend/lib_rend.c | 2 +- 13 files changed, 105 insertions(+), 29 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 575a696452..0d9ce5fd0b 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -117,7 +117,9 @@ typedef struct float no_diegetic_pan; bool renderConfigEnabled; char *renderConfigFilename; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + char *outputMdFilename; +#endif #ifdef DEBUGGING IVAS_DEC_FORCED_REND_MODE forcedRendMode; #ifdef DEBUG_FOA_AGC @@ -267,7 +269,7 @@ int main( /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB + && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -358,7 +360,7 @@ int main( /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB + && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -377,7 +379,7 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) + if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { arg.enableHeadRotation = true; } @@ -489,7 +491,10 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) && ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL ) && ( arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) + if ( ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) && + ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL ) && + ( arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) && + ( arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) { fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); @@ -757,10 +762,14 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( output_config = IVAS_DEC_OUTPUT_BINAURAL; } #ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( strcmp( argv_to_upper, "SPLIT_BINAURAL" ) == 0 ) + else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CLDFB" ) == 0 ) { output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB; } + else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_PCM" ) == 0 ) + { + output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM; + } #endif else if ( strcmp( argv_to_upper, "BINAURAL_ROOM" ) == 0 ) { @@ -830,6 +839,10 @@ static bool parseCmdlIVAS_dec( arg->renderConfigEnabled = false; arg->renderConfigFilename = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + arg->outputMdFilename = NULL; +#endif + arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->no_diegetic_pan = 0.f; @@ -1057,6 +1070,19 @@ static bool parseCmdlIVAS_dec( } i += 2; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( strcmp( argv_to_upper, "-OM" ) == 0 ) + { + arg->outputMdFilename = argv[i + 1]; + if ( arg->outputMdFilename[0] == '\0' ) + { + fprintf( stderr, "Error: output metadata file path not specified\n\n" ); + usage_dec(); + return false; + } + i += 2; + } +#endif else if ( strcmp( argv_to_upper, "-NO_DIEGETIC_PAN" ) == 0 ) { i++; @@ -1197,7 +1223,7 @@ static void usage_dec( void ) fprintf( stdout, "---------------------\n" ); #ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); - fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM, SPLIT_BINAURAL, EXT\n" ); + fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM, BINAURAL_SPLIT_CLDFB, BINAURAL_SPLIT_PCM, EXT\n" ); #else fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM, EXT\n" ); @@ -1242,6 +1268,9 @@ static void usage_dec( void ) fprintf( stdout, "-render_config File : Renderer configuration File\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono non-diegetic sound to stereo -1<= pan <=1,\n" ); fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + fprintf( stdout, "-om File : MD output file for BINAURAL_SPLIT_PCM output format\n" ); +#endif fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUGGING @@ -1343,6 +1372,22 @@ static ivas_error initOnFirstGoodFrame( else #endif { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + { + int16_t delayNumSamples_temp[3]; + int32_t delayTimeScale_temp; + IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); + assert( arg.outputMdFilename != NULL ); + error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ); + if ( error != IVAS_ERR_OK ) + { + fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); + exit( -1 ); + } + } +#endif + /* Open audio writer and write all previously skipped bad frames now that frame size is known */ if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK ) { @@ -1717,7 +1762,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hSplitRendFileReadWrite != NULL ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written ) != IVAS_ERR_OK ) { @@ -1728,6 +1773,16 @@ static ivas_error decodeG192( else #endif { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) + { + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to write to bitstream file!\n" ); + exit( -1 ); + } + } +#endif if ( delayNumSamples < nOutSamples ) { if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d1942d94f5..7719f500dd 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -685,7 +685,7 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->hInputSetup->is_loudspeaker_setup = 0; getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE ); - if ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG hBinRenderer->numPoses = pMultiBinPoseData->num_poses + 1; @@ -751,7 +751,8 @@ ivas_error ivas_binRenderer_open( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG hBinRenderer->numPoses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses + 1; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index cc589fd7aa..4c9bf28a46 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -102,7 +102,8 @@ ivas_error ivas_dec( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hHeadTrackData, hSplitRendBits ); @@ -627,19 +628,22 @@ ivas_error ivas_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /*split rendering process calls*/ - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; int16_t max_band; + int16_t pcm_out; hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); + pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, hSplitBinRend->hSplitRendBits, hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, - max_band, output, 1, 0 ); + max_band, output, 1, pcm_out ); free( st_ivas->splitBinRend.hMultiBinCldfbData ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 1e452a08f6..a29670397f 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2570,7 +2570,8 @@ void ivas_dirac_dec( Cldfb_RealBuffer, Cldfb_ImagBuffer ); #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t pos_idx; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9f26e4e88f..721f30343b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -630,7 +630,7 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM #ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -1217,7 +1217,8 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, @@ -1230,11 +1231,12 @@ ivas_error ivas_init_decoder( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 1, 0 ); + hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); } #endif } @@ -2067,7 +2069,7 @@ static ivas_error doSanityChecks_IVAS( if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index bd4a3242d1..f4db4828e5 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -81,7 +81,7 @@ void ivas_renderer_select( if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -136,7 +136,7 @@ void ivas_renderer_select( *internal_config = output_config; if ( output_config == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -153,7 +153,7 @@ void ivas_renderer_select( if ( output_config == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 72f71e73d7..e551029c9a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -241,7 +241,8 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, @@ -255,11 +256,12 @@ ivas_error ivas_sba_dec_reconfigure( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 1, 0 ); + hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); } #endif } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index ea2da61151..5780c7da88 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1284,7 +1284,7 @@ void ivas_spar_dec_upmixer( { if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM #ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 5b58da5874..c53df56c92 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -364,6 +364,10 @@ static AUDIO_CONFIG mapOutputFormat( { output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; } + else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + { + output_config = AUDIO_CONFIG_BINAURAL_SPLIT_PCM; + } #endif else { @@ -1942,7 +1946,11 @@ static ivas_error get_channel_config( #ifdef SPLIT_REND_WITH_HEAD_ROT else if ( config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { - strcpy( str, "Split_Binaural" ); + strcpy( str, "Binaural_Split_CLDFB" ); + } + else if ( config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + strcpy( str, "Binaural_Split_PCM" ); } #endif else if ( config == AUDIO_CONFIG_EXTERNAL ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index de65606568..d9608c2b83 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -59,6 +59,7 @@ typedef enum _IVAS_DEC_OUTPUT_CONFIG IVAS_DEC_OUTPUT_BINAURAL_ROOM, #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB, + IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM, #endif IVAS_DEC_OUTPUT_EXT, IVAS_DEC_OUTPUT_UNKNOWN = 0xffff diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 4802fcf388..bc3a637428 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -94,6 +94,7 @@ int16_t audioCfg2channels( case AUDIO_CONFIG_BINAURAL_ROOM: #ifdef SPLIT_REND_WITH_HEAD_ROT case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif nchan_out = 2; break; @@ -223,6 +224,7 @@ void ivas_output_init( case AUDIO_CONFIG_BINAURAL_ROOM: #ifdef SPLIT_REND_WITH_HEAD_ROT case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif case AUDIO_CONFIG_ISM1: case AUDIO_CONFIG_ISM2: diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index f498128c91..e6667c0d51 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1607,7 +1607,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, } if ( is_pcm_out == 0 ) { - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, 2, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate ) ); + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate ) ); if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 250445010c..dfa7a06e07 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2863,7 +2863,7 @@ static ivas_error initMasaDummyDecForBinauralOut( ivas_output_init( &( decDummy->hOutSetup ), output_config ); if ( output_config == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { -- GitLab From 406ebc1503d25c7af0d98e41b32728feaff547ff Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 22 May 2023 16:00:40 +1000 Subject: [PATCH 136/591] warning fix in MCT dec --- lib_dec/ivas_mct_dec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 845a5a6bd8..9c1aca1323 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1014,8 +1014,11 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } - +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend[0] != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) +#else if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) +#endif { ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) #ifdef SPLIT_REND_WITH_HEAD_ROT -- GitLab From 7ad5cdbf88131ca9ac70ea4e719b4193cee9e5d5 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 24 May 2023 11:14:03 +0300 Subject: [PATCH 137/591] Add back support for 1TC MASA + objects. --- lib_enc/lib_enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 1420d8cef3..631b488626 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -389,6 +389,10 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( st_ivas->hEncoderConfig->nchan_inp = CPE_CHANNELS + numObjects; st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ break; + case IVAS_ENC_MASA_1CH: + st_ivas->hEncoderConfig->nchan_inp = 1 + numObjects; + st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; /* initialization only, might be changed later based on element_brate */ + break; default: return IVAS_ERR_INVALID_MASA_CONFIG; break; -- GitLab From 2047a0a4d7902e1b2f9649e995191f06c46c6baf Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 24 May 2023 12:05:06 +0300 Subject: [PATCH 138/591] Wrap debug output into DEBUG_MODE_INFO switch. --- lib_enc/ivas_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index c15e4f0bf0..cd97060613 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -389,7 +389,7 @@ ivas_error ivas_enc( { flag_omasa_brate = 1; } -#ifdef DEBUGGING +#ifdef DEBUG_MODE_INFO dbgwrite( &energy_ism, sizeof( float ), 1, 1, "en_ratio.bin" ); #endif } -- GitLab From 6d61e9152a10d6b3d50df030f9b18c6aec975143 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 26 May 2023 17:49:47 +0300 Subject: [PATCH 139/591] Fixes to merge of main up to 1bfc64ea --- lib_com/ivas_prot.h | 8 +- lib_dec/ivas_dirac_dec.c | 14 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 378 ++++++++++++------- 3 files changed, 243 insertions(+), 157 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 492ebd84ae..e609305047 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5537,11 +5537,9 @@ void ivas_omasa_dirac_rend( void preProcessStereoTransportsForMovedObjects( Decoder_Struct* st_ivas, - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const uint8_t nBins, - const uint8_t firstSubframe, - const uint8_t nSubframes + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t nBins ); ivas_error ivas_masa_ism_separate_object_renderer_open( diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index bcf788f3d2..c407a2b058 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2527,8 +2527,8 @@ void ivas_dirac_dec( float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #ifdef MASA_AND_OBJECTS - float Cldfb_RealBuffer_Temp[2][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ - float Cldfb_ImagBuffer_Temp[2][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ + float Cldfb_RealBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ + float Cldfb_ImagBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ #endif int16_t index, num_freq_bands; @@ -2718,8 +2718,8 @@ void ivas_dirac_dec( for ( ch = 0; ch < nchan_transport; ch++ ) { cldfbAnalysis_ts( &( output_f[sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer_Temp[ch][index_slot], - Cldfb_ImagBuffer_Temp[ch][index_slot], + Cldfb_RealBuffer_Temp[ch][slot_idx], + Cldfb_ImagBuffer_Temp[ch][slot_idx], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); } @@ -2727,7 +2727,7 @@ void ivas_dirac_dec( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { - preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, (uint8_t) ( hDirAC->num_freq_bands ), (uint8_t) subframe_idx, 1 ); + preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, (uint8_t) ( hDirAC->num_freq_bands ) ); } } #endif @@ -2749,8 +2749,8 @@ void ivas_dirac_dec( { for ( ch = 0; ch < nchan_transport; ch++ ) { - mvr2r( Cldfb_RealBuffer_Temp[ch][index_slot], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Temp[ch][index_slot], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); + mvr2r( Cldfb_RealBuffer_Temp[ch][slot_idx], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Temp[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); } } #endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index c58326d884..38a9374f10 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -498,8 +498,13 @@ static void ivas_dirac_dec_binaural_internal( { DIRAC_DEC_HANDLE hDirAC; int16_t slot, ch, numInChannels; +#ifdef MASA_AND_OBJECTS + float Cldfb_RealBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#else float Cldfb_RealBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#endif float Rmat[3][3]; int16_t max_band_decorr; DIFFUSE_DISTRIBUTION_DATA diffuseDistData; @@ -511,10 +516,21 @@ static void ivas_dirac_dec_binaural_internal( /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + { + numInChannels++; + } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + numInChannels += (uint8_t) st_ivas->nchan_ism; + } +#else if ( st_ivas->hOutSetup.separateChannelEnabled ) { numInChannels++; } +#endif Rmat[0][0] = 1.0f; Rmat[0][1] = 0.0f; @@ -634,6 +650,13 @@ static void ivas_dirac_dec_binaural_internal( ivas_sba_prototype_renderer( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); } +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + { + preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins ); + } +#endif + if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[subframe], Rmat ); @@ -1063,6 +1086,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric for ( bin = 0; bin < nBins; bin++ ) { float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ +#ifdef MASA_AND_OBJECTS + float diffusenessValForDecorrelationReduction = 1.0f; + float diffEneValForDecorrelationReduction; +#endif float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ float diffEne, dirEne, meanEnePerCh; int16_t dirIndex; @@ -1081,6 +1108,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric float lRealp, lImagp, rRealp, rImagp; float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; +#ifdef MASA_AND_OBJECTS + uint8_t isIsmDirection = 0; +#endif if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ { @@ -1089,15 +1119,55 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; } +#ifdef MASA_AND_OBJECTS + else if ( st_ivas->ivas_format != MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_ISM_FORMAT && dirIndex < hDirAC->numParametricDirections ) ) /* For second of the two simultaneous directions */ +#else else /* For second of the two simultaneous directions */ +#endif { aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; } +#ifdef MASA_AND_OBJECTS + else /* For object directions of MASA_ISM_FORMAT */ + { + isIsmDirection = 1; + uint16_t ismDirIndex; + ismDirIndex = dirIndex - hDirAC->numParametricDirections; + if ( st_ivas->hMasaIsmData->ism_is_edited[ismDirIndex] ) + { + aziDeg = st_ivas->hMasaIsmData->azimuth_ism_edited[ismDirIndex]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism_edited[ismDirIndex]; + } + else + { + aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; + eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; + } + ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; + spreadCoh = 0.0f; + } +#endif diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ +#ifdef MASA_AND_OBJECTS + if ( diffuseness < 0.0f ) + { + diffuseness = 0.0f; + } + if ( isIsmDirection ) + { + /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ + diffusenessValForDecorrelationReduction -= ratio * 0.5f; + } + else + { + diffusenessValForDecorrelationReduction -= ratio; + } +#endif + if ( separateCenterChannelRendering ) { /* In masa + mono rendering mode, the center directions originate from phantom sources, so the @@ -1233,13 +1303,32 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffuseness = max( 0.0f, diffuseness ); diffEne = diffuseness * meanEnePerCh; surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; + +#ifdef MASA_AND_OBJECTS + diffusenessValForDecorrelationReduction = max( 0.0f, diffusenessValForDecorrelationReduction ); + diffEneValForDecorrelationReduction = diffusenessValForDecorrelationReduction * meanEnePerCh; +#endif + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { if ( !h->renderStereoOutputInsteadOfBinaural ) { +#ifdef MASA_AND_OBJECTS + float spectrumModVal; + + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; + diffEne *= spectrumModVal; +#else idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; +#endif +#ifdef MASA_AND_OBJECTS + /* Modify also the value for decorrelation reduction */ + diffEneValForDecorrelationReduction *= spectrumModVal; +#endif } } h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ @@ -1265,7 +1354,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } /* Store parameters for formulating average diffuseness over frame */ +#ifdef MASA_AND_OBJECTS + h->frameMeanDiffuseness[bin] += diffEneValForDecorrelationReduction; +#else h->frameMeanDiffuseness[bin] += diffEne; +#endif frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; } @@ -2048,7 +2141,6 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( } } #else - gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -3194,13 +3286,12 @@ static void preProcessStereoTransportsForMovedObjects( Decoder_Struct *st_ivas, - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const uint8_t nBins, - const uint8_t firstSubframe, - const uint8_t nSubframes ) + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t nBins +) { - int16_t subframe, bin, ch, inCh, outCh, ismDirIndex, slot; + int16_t bin, ch, inCh, outCh, ismDirIndex, slot; DIRAC_DEC_HANDLE hDirAC; MASA_ISM_DATA_HANDLE hMasaIsmData; uint8_t enableCentering; @@ -3236,176 +3327,173 @@ void preProcessStereoTransportsForMovedObjects( } /* Perform object-movement based processing */ - for ( subframe = firstSubframe; subframe < ( firstSubframe + nSubframes ); subframe++ ) - { - dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; + dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; - for ( bin = 0; bin < nBins; bin++ ) + for ( bin = 0; bin < nBins; bin++ ) + { + float ismPreprocMtxNew[2][2]; + float ismPreprocMtxIncrement[2][2]; + float eneMove[2]; + float enePreserve[2]; + float ismRatioAcc; + float subframeEne; + float normEnes[2]; + float remainderNormEne; + + set_zero( ismPreprocMtxNew[0], 2 ); + set_zero( ismPreprocMtxNew[1], 2 ); + set_zero( ismPreprocMtxIncrement[0], 2 ); + set_zero( ismPreprocMtxIncrement[1], 2 ); + set_zero( eneMove, 2 ); + set_zero( enePreserve, 2 ); + ismRatioAcc = 0.0f; + subframeEne = 0.0f; + set_zero( normEnes, 2 ); + + /* Determine transport normalized energies and subframe energy */ + for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) { - float ismPreprocMtxNew[2][2]; - float ismPreprocMtxIncrement[2][2]; - float eneMove[2]; - float enePreserve[2]; - float ismRatioAcc; - float subframeEne; - float normEnes[2]; - float remainderNormEne; - - set_zero( ismPreprocMtxNew[0], 2 ); - set_zero( ismPreprocMtxNew[1], 2 ); - set_zero( ismPreprocMtxIncrement[0], 2 ); - set_zero( ismPreprocMtxIncrement[1], 2 ); - set_zero( eneMove, 2 ); - set_zero( enePreserve, 2 ); - ismRatioAcc = 0.0f; - subframeEne = 0.0f; - set_zero( normEnes, 2 ); - - /* Determine transport normalized energies and subframe energy */ - for ( slot = subframe * hDirAC->subframe_nbslots; slot < (int16_t) ( ( subframe + 1 ) * hDirAC->subframe_nbslots ); slot++ ) + for ( ch = 0; ch < 2; ch++ ) { - for ( ch = 0; ch < 2; ch++ ) - { - normEnes[ch] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; - normEnes[ch] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; - } + normEnes[ch] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; + normEnes[ch] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; } - subframeEne = normEnes[0] + normEnes[1]; - normEnes[0] /= fmaxf( 1e-12f, subframeEne ); - normEnes[1] /= fmaxf( 1e-12f, subframeEne ); - - /* For each ismDir, formulate a mix-matrix that moves object audio signals between - * left and right channels when needed. Make a combined matrix by a ratio-weighted sum */ - for ( ismDirIndex = 0; ismDirIndex < hDirAC->numIsmDirections; ismDirIndex++ ) - { - float panGainsOut[2]; - float panGainsIn[2]; - float ratio; - float panEnesOut[2]; - float panEnesIn[2]; - float centeringFactor; + } + subframeEne = normEnes[0] + normEnes[1]; + normEnes[0] /= fmaxf( 1e-12f, subframeEne ); + normEnes[1] /= fmaxf( 1e-12f, subframeEne ); - ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; + /* For each ismDir, formulate a mix-matrix that moves object audio signals between + * left and right channels when needed. Make a combined matrix by a ratio-weighted sum */ + for ( ismDirIndex = 0; ismDirIndex < hDirAC->numIsmDirections; ismDirIndex++ ) + { + float panGainsOut[2]; + float panGainsIn[2]; + float ratio; + float panEnesOut[2]; + float panEnesIn[2]; + float centeringFactor; - ismRatioAcc += ratio; + ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; - /* Get input and output panning gains */ - ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], - hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], - panGainsIn ); + ismRatioAcc += ratio; - if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) - { - ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], - hMasaIsmData->elevation_ism_edited[ismDirIndex], - panGainsOut ); - } - else - { - /* When not edited, input and output pan gains are the same */ - for ( ch = 0; ch < 2; ch++ ) - { - panGainsOut[ch] = panGainsIn[ch]; - } - } + /* Get input and output panning gains */ + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], + hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], + panGainsIn ); - /* Determine pan enes */ + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) + { + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], + hMasaIsmData->elevation_ism_edited[ismDirIndex], + panGainsOut ); + } + else + { + /* When not edited, input and output pan gains are the same */ for ( ch = 0; ch < 2; ch++ ) { - panEnesOut[ch] = panGainsOut[ch] * panGainsOut[ch]; - panEnesIn[ch] = panGainsIn[ch] * panGainsIn[ch]; + panGainsOut[ch] = panGainsIn[ch]; } + } - if ( enableCentering ) - { - centeringFactor = fmaxf( 0.0f, 2.0f * fabsf( panEnesIn[0] - panEnesOut[0] ) - 1.0f ); - for ( ch = 0; ch < 2; ch++ ) - { - panEnesOut[ch] *= ( 1.0f - centeringFactor ); - panEnesOut[ch] += 0.5f * centeringFactor; - } - } + /* Determine pan enes */ + for ( ch = 0; ch < 2; ch++ ) + { + panEnesOut[ch] = panGainsOut[ch] * panGainsOut[ch]; + panEnesIn[ch] = panGainsIn[ch] * panGainsIn[ch]; + } + if ( enableCentering ) + { + centeringFactor = fmaxf( 0.0f, 2.0f * fabsf( panEnesIn[0] - panEnesOut[0] ) - 1.0f ); for ( ch = 0; ch < 2; ch++ ) { - float eneMoveThis; - float enePreserveThis; - eneMoveThis = fmaxf( 0.0f, panEnesIn[ch] - panEnesOut[ch] ); - enePreserveThis = panEnesIn[ch] - eneMoveThis; - - eneMove[ch] += ratio * eneMoveThis; - enePreserve[ch] += ratio * enePreserveThis; - - /* Subtract object parts from normEnes */ - normEnes[ch] -= panEnesIn[ch] * ratio; + panEnesOut[ch] *= ( 1.0f - centeringFactor ); + panEnesOut[ch] += 0.5f * centeringFactor; } } - /* Any remaining (non-object) energy is set to be preserved at both channels */ - remainderNormEne = fmaxf( 0.0f, ( 1.0f - ismRatioAcc ) - normEnes[0] - normEnes[1] ); for ( ch = 0; ch < 2; ch++ ) { - enePreserve[ch] += fmaxf( 0.0f, normEnes[ch] + remainderNormEne / 2.0f ); - } + float eneMoveThis; + float enePreserveThis; + eneMoveThis = fmaxf( 0.0f, panEnesIn[ch] - panEnesOut[ch] ); + enePreserveThis = panEnesIn[ch] - eneMoveThis; - /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix */ - for ( ch = 0; ch < 2; ch++ ) - { - float normVal; - hMasaIsmData->eneMoveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; - hMasaIsmData->eneMoveIIR[ch][bin] += eneMove[ch] * subframeEne; - hMasaIsmData->enePreserveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; - hMasaIsmData->enePreserveIIR[ch][bin] += enePreserve[ch] * subframeEne; - normVal = fmaxf( EPSILON, hMasaIsmData->eneMoveIIR[ch][bin] + hMasaIsmData->enePreserveIIR[ch][bin] ); - ismPreprocMtxNew[ch][ch] = sqrtf( hMasaIsmData->enePreserveIIR[ch][bin] / normVal ); - ismPreprocMtxNew[1 - ch][ch] = sqrtf( hMasaIsmData->eneMoveIIR[ch][bin] / normVal ); + eneMove[ch] += ratio * eneMoveThis; + enePreserve[ch] += ratio * enePreserveThis; + + /* Subtract object parts from normEnes */ + normEnes[ch] -= panEnesIn[ch] * ratio; } + } + + /* Any remaining (non-object) energy is set to be preserved at both channels */ + remainderNormEne = fmaxf( 0.0f, ( 1.0f - ismRatioAcc ) - normEnes[0] - normEnes[1] ); + for ( ch = 0; ch < 2; ch++ ) + { + enePreserve[ch] += fmaxf( 0.0f, normEnes[ch] + remainderNormEne / 2.0f ); + } + + /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix */ + for ( ch = 0; ch < 2; ch++ ) + { + float normVal; + hMasaIsmData->eneMoveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->eneMoveIIR[ch][bin] += eneMove[ch] * subframeEne; + hMasaIsmData->enePreserveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->enePreserveIIR[ch][bin] += enePreserve[ch] * subframeEne; + normVal = fmaxf( EPSILON, hMasaIsmData->eneMoveIIR[ch][bin] + hMasaIsmData->enePreserveIIR[ch][bin] ); + ismPreprocMtxNew[ch][ch] = sqrtf( hMasaIsmData->enePreserveIIR[ch][bin] / normVal ); + ismPreprocMtxNew[1 - ch][ch] = sqrtf( hMasaIsmData->eneMoveIIR[ch][bin] / normVal ); + } - /* Get increment value for temporal interpolation */ - for ( inCh = 0; inCh < 2; inCh++ ) + /* Get increment value for temporal interpolation */ + for ( inCh = 0; inCh < 2; inCh++ ) + { + for ( outCh = 0; outCh < 2; outCh++ ) { - for ( outCh = 0; outCh < 2; outCh++ ) - { - ismPreprocMtxIncrement[outCh][inCh] = ( ismPreprocMtxNew[outCh][inCh] - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] ) / (float) hDirAC->subframe_nbslots; - } + ismPreprocMtxIncrement[outCh][inCh] = ( ismPreprocMtxNew[outCh][inCh] - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] ) / (float) hDirAC->subframe_nbslots; } + } - /* Mix signals */ - for ( slot = subframe * hDirAC->subframe_nbslots; slot < (int16_t) ( ( subframe + 1 ) * hDirAC->subframe_nbslots ); slot++ ) - { - float eqVal; - float outSlotRe[2]; - float outSlotIm[2]; + /* Mix signals */ + for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) + { + float eqVal; + float outSlotRe[2]; + float outSlotIm[2]; - set_zero( outSlotRe, 2 ); - set_zero( outSlotIm, 2 ); + set_zero( outSlotRe, 2 ); + set_zero( outSlotIm, 2 ); - for ( outCh = 0; outCh < 2; outCh++ ) + for ( outCh = 0; outCh < 2; outCh++ ) + { + for ( inCh = 0; inCh < 2; inCh++ ) { - for ( inCh = 0; inCh < 2; inCh++ ) - { - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] += ismPreprocMtxIncrement[outCh][inCh]; - outSlotRe[outCh] += inRe[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; - outSlotIm[outCh] += inIm[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; - } + hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] += ismPreprocMtxIncrement[outCh][inCh]; + outSlotRe[outCh] += inRe[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; + outSlotIm[outCh] += inIm[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; } + } - /* IIR average the energy measures and determine and apply energy-preserving equalizer */ - hMasaIsmData->preprocEneTarget[bin] *= STEREO_PREPROCESS_IIR_FACTOR; - hMasaIsmData->preprocEneRealized[bin] *= STEREO_PREPROCESS_IIR_FACTOR; - for ( ch = 0; ch < 2; ch++ ) - { - hMasaIsmData->preprocEneTarget[bin] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; - hMasaIsmData->preprocEneTarget[bin] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; - hMasaIsmData->preprocEneRealized[bin] += outSlotRe[ch] * outSlotRe[ch]; - hMasaIsmData->preprocEneRealized[bin] += outSlotIm[ch] * outSlotIm[ch]; - } - eqVal = fminf( 4.0f, sqrtf( hMasaIsmData->preprocEneTarget[bin] / fmaxf( 1e-12f, hMasaIsmData->preprocEneRealized[bin] ) ) ); - for ( ch = 0; ch < 2; ch++ ) - { - inRe[ch][slot][bin] = outSlotRe[ch] * eqVal; - inIm[ch][slot][bin] = outSlotIm[ch] * eqVal; - } + /* IIR average the energy measures and determine and apply energy-preserving equalizer */ + hMasaIsmData->preprocEneTarget[bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->preprocEneRealized[bin] *= STEREO_PREPROCESS_IIR_FACTOR; + for ( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->preprocEneTarget[bin] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; + hMasaIsmData->preprocEneTarget[bin] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; + hMasaIsmData->preprocEneRealized[bin] += outSlotRe[ch] * outSlotRe[ch]; + hMasaIsmData->preprocEneRealized[bin] += outSlotIm[ch] * outSlotIm[ch]; + } + eqVal = fminf( 4.0f, sqrtf( hMasaIsmData->preprocEneTarget[bin] / fmaxf( 1e-12f, hMasaIsmData->preprocEneRealized[bin] ) ) ); + for ( ch = 0; ch < 2; ch++ ) + { + inRe[ch][slot][bin] = outSlotRe[ch] * eqVal; + inIm[ch][slot][bin] = outSlotIm[ch] * eqVal; } } } -- GitLab From 02ec59ebe8353da6689f2460553dbb60d3dd4d45 Mon Sep 17 00:00:00 2001 From: Rivukanta Bhattacharya <100792@ittiam.com> Date: Thu, 1 Jun 2023 20:20:20 +0530 Subject: [PATCH 140/591] SBA VLBR 20ms Optimization --- lib_com/ivas_prot.h | 4 ++ lib_com/options.h | 4 ++ lib_dec/ivas_dec.c | 8 +++ lib_dec/ivas_jbm_dec.c | 8 +++ lib_dec/ivas_masa_dec.c | 4 ++ lib_dec/ivas_sba_dec.c | 4 ++ lib_dec/ivas_sba_rendering_internal.c | 9 +++ lib_dec/ivas_spar_decoder.c | 7 +++ lib_dec/ivas_spar_md_dec.c | 83 +++++++++++++++++++++++++-- lib_rend/ivas_sba_rendering.c | 37 ++++++++++-- 10 files changed, 160 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f455c552a5..ff4c59af56 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4395,6 +4395,10 @@ void ivas_sba_mix_matrix_determiner( const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ +#ifdef VLBR_20MS_MD + , + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ +#endif ); /* AGC */ diff --git a/lib_com/options.h b/lib_com/options.h index 8a491e2499..ccbaa53ff0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,6 +209,8 @@ #define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ #define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ #define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ +#define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ + #define FIX_485_STATIC_BUFFERS /* FhG: move static buffers in DirAC parameter estimator to the DirAC struct */ #define FIX_I503_ASAN_ERROR_IND_LIST /* VA: fix issue #503: address sanitizer error with IND_LIST_DYN */ #define FIX_473_JITTER_NONDIEGETIC_PANNING /* FhG,Orange: add missing non-diegetic panning to JITTER */ @@ -232,6 +234,8 @@ #define FIX_TODO_NON_DIEGETIC_PAN_NOT_IMPLELENTED_IN_RENDERER /* ..\apps\renderer.c(240): .... (todo: implementation)",*/ #define REMOVE_OBS_CODE /* FhG: Remove unnecessary assignement after LFE cleanup (Issue #451)*/ +#define VLBR_20MS_MD /* Dlb: SBA VLBR 20ms Optimization*/ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 82f03fdb3b..edec0deeb0 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -69,6 +69,9 @@ ivas_error ivas_dec( #ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS]; #endif +#ifdef VLBR_20MS_MD + int16_t num_md_sub_frames; +#endif error = IVAS_ERR_OK; @@ -458,7 +461,12 @@ ivas_error ivas_dec( #endif { +#ifdef VLBR_20MS_MD + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); +#else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); +#endif } #ifdef JBM_TSM_ON_TCS #ifndef SBA_MODE_CLEAN_UP diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 04ae490414..3248c2d60a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -78,6 +78,9 @@ ivas_error ivas_jbm_dec_tc( AUDIO_CONFIG output_config; ivas_error error; float *p_output[MAX_TRANSPORT_CHANNELS]; +#ifdef VLBR_20MS_MD + int16_t num_md_sub_frames; +#endif error = IVAS_ERR_OK; @@ -311,7 +314,12 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) #endif { +#ifdef VLBR_20MS_MD + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); +#else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); +#endif } #ifndef SBA_MODE_CLEAN_UP else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 8d6cebe036..34bf8c576d 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1414,7 +1414,11 @@ void ivas_spar_param_to_masa_param_mapping( else { #ifdef JBM_TSM_ON_TCS +#ifdef VLBR_20MS_MD + mixer_mat_index = ( ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) == 1 ) ? 0 : ( sf - SPAR_META_DELAY_SUBFRAMES ); +#else mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; +#endif #else mixer_mat_index = subframe - SPAR_META_DELAY_SUBFRAMES; #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 478749ddc0..d7ef992b36 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -176,7 +176,11 @@ ivas_error ivas_sba_dec_reconfigure( hSpar->hPCA = NULL; } +#ifdef VLBR_20MS_MD + 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 ) || ( last_ivas_total_brate >= IVAS_24k4 && ivas_total_brate < IVAS_24k4 ) || ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) ) +#else 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 ) ) +#endif { ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index dd4af01ccf..1e4c9eb9e6 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -653,6 +653,10 @@ void ivas_sba_mix_matrix_determiner( const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ +#ifdef VLBR_20MS_MD + , + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ +#endif ) { int16_t i, ch; @@ -696,8 +700,13 @@ void ivas_sba_mix_matrix_determiner( /* Mixing matrix determiner */ num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; +#ifdef VLBR_20MS_MD + ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, + num_md_sub_frames ); +#else ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, MAX_PARAM_SPATIAL_SUBFRAMES ); +#endif return; } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 0d028b2359..06e50255fa 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -123,7 +123,14 @@ ivas_error ivas_spar_dec_open( return error; } hSpar->hMdDec->td_decorr_flag = 1; +#ifdef FIX_501_TABLE_IDX_INIT + if ( hSpar->hTdDecorr && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) + { + hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[hSpar->hMdDec->table_idx].td_ducking; + } +#else hSpar->hMdDec->table_idx = -1; +#endif /* set FB config. */ active_w_mixing = -1; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index cf03e7b9d8..8ceda9fb18 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,9 +83,11 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); - +#ifdef FIX_501_TABLE_IDX_INIT +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); +#else static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode ); - +#endif /*------------------------------------------------------------------------- * ivas_spar_md_dec_matrix_open() @@ -254,6 +256,12 @@ int16_t ivas_get_spar_dec_md_num_subframes( num_subframes = 1; } } +#ifdef VLBR_20MS_MD + if ( ivas_total_brate < IVAS_24k4 ) + { + num_subframes = 1; + } +#endif return ( num_subframes ); } @@ -289,11 +297,29 @@ ivas_error ivas_spar_md_dec_open( return error; } +#ifdef FIX_501_TABLE_IDX_INIT + if ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) + { + if ( sid_format == SID_SBA_2TC ) + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + else + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_24k4, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + } + else + { + hMdDec->table_idx = ivas_get_spar_table_idx( hDecoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } +#else hMdDec->table_idx = 0; /* just to initialize state variables*/ if ( ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) && ( sid_format == SID_SBA_2TC ) ) { hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); } +#endif if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; @@ -671,7 +697,12 @@ void ivas_spar_md_dec_process( ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode ); + ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode +#ifdef FIX_501_TABLE_IDX_INIT + , + st_ivas->last_active_ivas_total_brate +#endif + ); #if 0 { @@ -1707,7 +1738,12 @@ static void ivas_spar_dec_parse_md_bs( int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, - const int16_t sba_inactive_mode ) + const int16_t sba_inactive_mode +#ifdef FIX_501_TABLE_IDX_INIT + , + const int32_t last_active_brate +#endif +) { int16_t i, j, k, num_bands; int16_t ii, jj, ndec, ndm, b, idx; @@ -1718,6 +1754,9 @@ static void ivas_spar_dec_parse_md_bs( int16_t planarCP; float quant[IVAS_SPAR_MAX_C_COEFF]; int16_t do_repeat[IVAS_MAX_NUM_BANDS]; +#ifdef FIX_501_TABLE_IDX_INIT + int16_t bw_final, bw_fact; +#endif *dtx_vad = 1; *bands_bw = 1; @@ -1790,13 +1829,33 @@ static void ivas_spar_dec_parse_md_bs( ivas_parse_parameter_bitstream_dtx( &hMdDec->spar_md, st0, *bands_bw, *nB, hMdDec->spar_md_cfg.num_dmx_chans_per_band, hMdDec->spar_md_cfg.num_decorr_per_band ); + +#ifdef FIX_501_TABLE_IDX_INIT + if ( last_active_brate >= IVAS_24k4 ) + { + bw_final = 1; + } + else + { + bw_final = 2; + } + bw_fact = *bands_bw / bw_final; +#endif for ( i = *nB - 1; i >= 0; i-- ) { +#ifdef FIX_501_TABLE_IDX_INIT + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bw_fact * i]; + + for ( b = bw_fact - 1; b >= 0; b-- ) + { + idx = i * bw_fact + b; +#else ndec = hMdDec->spar_md_cfg.num_decorr_per_band[( *bands_bw ) * i]; for ( b = *bands_bw - 1; b >= 0; b-- ) { idx = i * *bands_bw + b; +#endif for ( j = 0; j < FOA_CHANNELS - 1; j++ ) { hMdDec->spar_md.band_coeffs[idx].pred_re[j] = hMdDec->spar_md.band_coeffs[i].pred_re[j]; @@ -1809,8 +1868,13 @@ static void ivas_spar_dec_parse_md_bs( } } +#ifdef FIX_501_TABLE_IDX_INIT + *bands_bw = bw_final; + *nB = num_bands / bw_final; +#else *nB = num_bands; *bands_bw = 1; +#endif return; } @@ -3081,6 +3145,12 @@ void ivas_spar_to_dirac( } } } +#ifdef VLBR_20MS_MD + int16_t num_md_sub_frames; + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate ); + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, + end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); +#else int16_t num_subframes; num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hQMetaData->useLowerRes ) @@ -3089,12 +3159,17 @@ void ivas_spar_to_dirac( } ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_subframes, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); +#endif if ( st_ivas->hQMetaData->useLowerRes && dtx_vad ) { for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) { +#ifdef VLBR_20MS_MD + for ( block = 1; block < num_md_sub_frames; block++ ) +#else for ( block = 1; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) +#endif { for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ { diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 059cd847e1..3e36f173ef 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -69,6 +69,11 @@ void ivas_sba_prototype_renderer( #ifdef JBM_TSM_ON_TCS int16_t slot_idx_start, md_idx; #endif +#ifdef VLBR_20MS_MD + int16_t sf_idx_flag, num_md_sub_frames; + sf_idx_flag = 0; + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif push_wmops( "ivas_sba_prototype_renderer" ); @@ -168,16 +173,40 @@ void ivas_sba_prototype_renderer( mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) +#ifdef VLBR_20MS_MD + if ( num_md_sub_frames == 1 ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + if ( !sf_idx_flag ) { - for ( b = 0; b < num_spar_bands; b++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( b = 0; b < num_spar_bands; b++ ) + { + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b]; + } + } } } + sf_idx_flag = 1; } + else + { +#endif + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( b = 0; b < num_spar_bands; b++ ) + { + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; + } + } + } +#ifdef VLBR_20MS_MD + } +#endif } #endif } -- GitLab From 3954aac564378774877c3a45cd748bfdcec3299d Mon Sep 17 00:00:00 2001 From: Rivukanta Bhattacharya <100792@ittiam.com> Date: Fri, 2 Jun 2023 19:04:28 +0530 Subject: [PATCH 141/591] Minor modification --- lib_dec/ivas_sba_dec.c | 2 +- lib_dec/ivas_spar_md_dec.c | 4 ++++ lib_rend/ivas_sba_rendering.c | 38 ++++++++--------------------------- 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index d7ef992b36..6bce1610b7 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -177,7 +177,7 @@ ivas_error ivas_sba_dec_reconfigure( } #ifdef VLBR_20MS_MD - 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 ) || ( last_ivas_total_brate >= IVAS_24k4 && ivas_total_brate < IVAS_24k4 ) || ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) ) + 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 ) || ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) ) #else 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 ) ) #endif diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 8ceda9fb18..c01323d126 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -3183,7 +3183,11 @@ void ivas_spar_to_dirac( } } /* expand DirAC TC 20ms MD for residual channels to all subframes*/ +#ifdef VLBR_20MS_MD + for ( block = 0; block < num_md_sub_frames; block++ ) +#else for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) +#endif { for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) { diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 3e36f173ef..c2e33ed74f 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -70,8 +70,7 @@ void ivas_sba_prototype_renderer( int16_t slot_idx_start, md_idx; #endif #ifdef VLBR_20MS_MD - int16_t sf_idx_flag, num_md_sub_frames; - sf_idx_flag = 0; + int16_t num_md_sub_frames; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); #endif @@ -166,6 +165,9 @@ void ivas_sba_prototype_renderer( { /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; +#ifdef VLBR_20MS_MD + md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; +#endif hSpar->i_subframe++; hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); @@ -173,40 +175,16 @@ void ivas_sba_prototype_renderer( mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); -#ifdef VLBR_20MS_MD - if ( num_md_sub_frames == 1 ) - { - if ( !sf_idx_flag ) - { - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b]; - } - } - } - } - sf_idx_flag = 1; - } - else + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { -#endif - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + for ( b = 0; b < num_spar_bands; b++ ) { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; - } + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; } } -#ifdef VLBR_20MS_MD } -#endif } #endif } -- GitLab From ac2fb24d1100ea9a21800cb5c6bedb8b85bb1e8c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 7 Jun 2023 12:18:44 +0200 Subject: [PATCH 142/591] integration of contributions 21 and 35 as per working assumption from 2023.06.01 meeting --- .gitignore | 1 + .gitlab-ci-custom.yml | 2 +- .gitlab-ci.yml | 4 +- CMakeLists.txt | 33 +- Makefile | 2 +- ...t_renderer_config_1536_2dof_tdposecorr.txt | 12 + ...t_renderer_config_1792_3dof_tdposecorr.txt | 12 + ...it_renderer_config_320_0dof_tdposecorr.txt | 12 + ...t_renderer_config_768_1dof_hoa_lc3plus.txt | 11 + ...it_renderer_config_768_1dof_tdposecorr.txt | 12 + .../split_renderer_config_768_2dof.txt | 10 + ...it_renderer_config_HBR_1dof_tdposecorr.txt | 12 + apps/decoder.c | 26 +- apps/renderer.c | 37 +- ci/comment_defines.py | 47 + ci/disable_ram_counting.py | 20 - lib_com/common_api_types.h | 25 + lib_com/ivas_cnst.h | 20 +- lib_com/ivas_error.h | 7 + lib_com/options.h | 7 + lib_dec/FEC_HQ_phase_ecu.c | 12 + lib_dec/ivas_dec.c | 28 +- lib_dec/ivas_init_dec.c | 44 +- lib_dec/ivas_sba_dec.c | 18 +- lib_dec/lib_dec.c | 20 +- lib_dec/lib_dec.h | 2 +- lib_dec/rom_dec.c | 4 + lib_dec/rom_dec.h | 4 + lib_rend/ivas_lc3plus_common.c | 49 + lib_rend/ivas_lc3plus_common.h | 53 + lib_rend/ivas_lc3plus_dec.c | 678 ++++++ lib_rend/ivas_lc3plus_dec.h | 138 ++ lib_rend/ivas_lc3plus_enc.c | 296 +++ lib_rend/ivas_lc3plus_enc.h | 73 + lib_rend/ivas_objectRenderer.c | 137 ++ lib_rend/ivas_objectRenderer_sfx.c | 8 + lib_rend/ivas_prot_rend.h | 34 +- lib_rend/ivas_render_config.c | 5 + lib_rend/ivas_rotation.c | 2 +- lib_rend/ivas_splitRend_lcld_dec.c | 4 + lib_rend/ivas_splitRend_lcld_enc.c | 8 +- lib_rend/ivas_splitRendererPost.c | 21 +- lib_rend/ivas_splitRendererPre.c | 503 ++++- lib_rend/ivas_splitRenderer_utils.c | 129 ++ lib_rend/ivas_stat_rend.h | 25 + lib_rend/lc3plus_codec/.gitignore | 3 + lib_rend/lc3plus_codec/README.md | 6 + lib_rend/lc3plus_codec/get_lc3plus.sh | 7 + lib_rend/lc3plus_codec/lc3plus.patch | 1571 +++++++++++++ lib_rend/lib_rend.c | 582 ++++- lib_rend/lib_rend.h | 4 + lib_util/render_config_reader.c | 11 + lib_util/split_render_file_read_write.c | 44 +- lib_util/split_render_file_read_write.h | 14 +- scripts/cppp/.gitignore | 2 + scripts/prepare_instrumentation.sh | 6 +- scripts/split_rendering/lc3plus/.gitignore | 1 + .../lc3plus/ivas_lc3plus_unit_test.c | 632 ++++++ ...vas_lc3plus_unit_test_selective_decoding.c | 1954 +++++++++++++++++ .../lc3plus/split_rend_lc3plus_cmdlines.py | 173 ++ 60 files changed, 7437 insertions(+), 180 deletions(-) create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt create mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt create mode 100755 ci/comment_defines.py delete mode 100755 ci/disable_ram_counting.py create mode 100644 lib_rend/ivas_lc3plus_common.c create mode 100644 lib_rend/ivas_lc3plus_common.h create mode 100644 lib_rend/ivas_lc3plus_dec.c create mode 100644 lib_rend/ivas_lc3plus_dec.h create mode 100644 lib_rend/ivas_lc3plus_enc.c create mode 100644 lib_rend/ivas_lc3plus_enc.h create mode 100644 lib_rend/lc3plus_codec/.gitignore create mode 100644 lib_rend/lc3plus_codec/README.md create mode 100755 lib_rend/lc3plus_codec/get_lc3plus.sh create mode 100644 lib_rend/lc3plus_codec/lc3plus.patch create mode 100644 scripts/cppp/.gitignore create mode 100644 scripts/split_rendering/lc3plus/.gitignore create mode 100644 scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c create mode 100644 scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test_selective_decoding.c create mode 100755 scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py diff --git a/.gitignore b/.gitignore index c87c691a4a..4beec23e77 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ scripts/td_object_renderer/object_renderer_standalone/renderer_standalone.exe .DS_Store .vscode .cache +.idea *.log *.bak .\#* diff --git a/.gitlab-ci-custom.yml b/.gitlab-ci-custom.yml index 86c1f487e0..3bc0785711 100644 --- a/.gitlab-ci-custom.yml +++ b/.gitlab-ci-custom.yml @@ -1,4 +1,4 @@ include: - project: $CUSTOM_CI_PROJECT - ref: $CUSTOM_CI_REF + ref: lc3plus-integration-with-unit-tests file: $CUSTOM_CI_FILE diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71ff18eb92..a059d9eb2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -406,7 +406,7 @@ renderer-asan: needs: ["build-codec-linux-cmake"] stage: test script: - - python3 ci/disable_ram_counting.py + - python3 ci/comment_defines.py -d RAM_COUNTING_TOOL -f lib_com/options.h - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py @@ -429,7 +429,7 @@ renderer-msan: needs: ["build-codec-linux-cmake"] stage: test script: - - python3 ci/disable_ram_counting.py + - python3 ci/comment_defines.py -d RAM_COUNTING_TOOL -f lib_com/options.h - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 8098dc1c68..8d468dfeac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ file(GLOB libComSrcs "lib_com/*.c") file(GLOB libComHeaders "lib_com/*.h") add_library(lib_com ${libComSrcs} ${libComHeaders}) if(UNIX) - target_link_libraries(lib_com m) + target_link_libraries(lib_com PRIVATE m) endif() target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug) @@ -132,12 +132,30 @@ add_library(lib_enc ${libEncSrcs} ${libEncHeaders}) target_link_libraries(lib_enc lib_com lib_debug) target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend) +set(lc3plus_floating_point_dir ${CMAKE_CURRENT_SOURCE_DIR}/lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point) +if(NOT EXISTS ${lc3plus_floating_point_dir}) + MESSAGE(FATAL_ERROR "${lc3plus_floating_point_dir} does not exist. Please follow instructions in lib_rend/lc3plus_codec/README.md and download the LC3plus codec") +endif() +file(GLOB libLC3plusSrcs "${lc3plus_floating_point_dir}/*.c") +file(GLOB libLC3plusHeaders "${lc3plus_floating_point_dir}/*.h") +file(GLOB libLC3plusFftSrcs "${lc3plus_floating_point_dir}/fft/*.c") +file(GLOB libLC3plusFftHeaders "${lc3plus_floating_point_dir}/fft/*.h") +add_library(lc3plus ${libLC3plusSrcs} ${libLC3plusFftSrcs} ${libLC3plusHeaders} ${libLC3plusFftHeaders}) +target_include_directories(lc3plus PUBLIC ${floating_point_dir} PRIVATE ${floating_point_dir}/fft ) +target_link_libraries(lc3plus lib_com) # For including options.h, which is needed for instrumentation to work correctly +if(WMOPS) + target_link_libraries(lc3plus lib_debug) +endif() + +file(GLOB libCldfbTransCodecSrcs "lib_rend/ivas_cldfb_trans_codec/*.c") +file(GLOB libCldfbTransCodecHeaders "lib_rend/ivas_cldfb_trans_codec/*.h") file(GLOB libRendSrcs "lib_rend/*.c") file(GLOB libRendHeaders "lib_rend/*.h") -add_library(lib_rend ${libRendSrcs} ${libRendHeaders}) -target_link_libraries(lib_rend lib_dec lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed. +add_library(lib_rend ${libRendSrcs} ${libCldfbTransCodecSrcs} ${libRendHeaders} ${libCldfbTransCodecHeaders}) +target_link_libraries(lib_rend lib_dec lib_com lib_debug lc3plus) # Todo refactor: This dependency on lib_dec should be removed. target_include_directories(lib_rend PUBLIC lib_rend PRIVATE lib_enc) + file(GLOB libDecSrcs "lib_dec/*.c") file(GLOB libDecHeaders "lib_dec/*.h") add_library(lib_dec ${libDecSrcs} ${libDecHeaders}) @@ -149,6 +167,12 @@ file(GLOB libUtilHeaders "lib_util/*.h") add_library(lib_util ${libUtilSrcs} ${libUtilHeaders}) target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug) +if(NOT WMOPS) + file(GLOB unitTestIvasLc3plusSrcs "scripts/split_rendering/lc3plus/*.c") + add_executable(ivas_lc3plus_unit_test ${unitTestIvasLc3plusSrcs}) + target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_util lib_com lib_debug) +endif() + add_executable(IVAS_cod apps/encoder.c) target_link_libraries(IVAS_cod lib_enc lib_util) if(WIN32) @@ -170,6 +194,9 @@ if(COPY_EXECUTABLES_FROM_BUILD_DIR) add_custom_command(TARGET IVAS_cod POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$" "${CMAKE_CURRENT_SOURCE_DIR}/") add_custom_command(TARGET IVAS_dec POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$" "${CMAKE_CURRENT_SOURCE_DIR}/") add_custom_command(TARGET IVAS_rend POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$" "${CMAKE_CURRENT_SOURCE_DIR}/") + if (NOT WMOPS) + add_custom_command(TARGET ivas_lc3plus_unit_test POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/split_rendering/lc3plus") + endif() endif() # Allow creating packages for CMake install diff --git a/Makefile b/Makefile index 7f8874d343..baf4a1ead7 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SRC_LIBCOM = lib_com SRC_LIBDEBUG = lib_debug SRC_LIBDEC = lib_dec SRC_LIBENC = lib_enc -SRC_LIBREND = lib_rend +SRC_LIBREND = lib_rend lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft SRC_LIBUTIL = lib_util SRC_APP = apps BUILD = build diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt new file mode 100644 index 0000000000..7ef48fb635 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt @@ -0,0 +1,12 @@ +[SPLITREND] +BITRATE = 1536000; +DOF = 2; +HQMODE = 0; +CODEC = 1; +POSECORRECTIONMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt new file mode 100644 index 0000000000..c77307afd6 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt @@ -0,0 +1,12 @@ +[SPLITREND] +BITRATE = 1792000; +DOF = 3; +HQMODE = 0; +CODEC = 1; +POSECORRECTIONMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt new file mode 100644 index 0000000000..c4457e80d7 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt @@ -0,0 +1,12 @@ +[SPLITREND] +BITRATE = 320000; +DOF = 0; +HQMODE = 0; +CODEC = 1; +POSECORRECTIONMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt new file mode 100644 index 0000000000..9de2dad1a0 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt @@ -0,0 +1,11 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; +CODEC = 1 + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt new file mode 100644 index 0000000000..ec5427bebc --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt @@ -0,0 +1,12 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; +CODEC = 1; +POSECORRECTIONMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt new file mode 100644 index 0000000000..20488df35b --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt new file mode 100644 index 0000000000..559352f637 --- /dev/null +++ b/Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt @@ -0,0 +1,12 @@ +[SPLITREND] +BITRATE = -1; +DOF = 1; +HQMODE = 0; +CODEC = 1; +POSECORRECTIONMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/apps/decoder.c b/apps/decoder.c index 0d9ce5fd0b..75d0fd2ea7 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -75,7 +75,11 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) #ifdef SPLIT_REND_WITH_HEAD_ROT -#define MAX_SPLIT_REND_BITRATE ( 768000 ) +#ifdef SPLIT_REND_LC3PLUS +#define MAX_SPLIT_REND_BITRATE ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/ +#else +#define MAX_SPLIT_REND_BITRATE ( 768000 ) +#endif #define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #endif #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) @@ -1407,7 +1411,11 @@ static ivas_error initOnFirstGoodFrame( IVAS_SPLIT_REND_BITS splitRendBitsZero; splitRendBitsZero.bits_written = 0; splitRendBitsZero.bits_read = 0; - if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written +#ifdef SPLIT_REND_LC3PLUS + , -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE +#endif + ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); @@ -1764,7 +1772,12 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) { - if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written +#ifdef SPLIT_REND_LC3PLUS + , + splitRendBits.codec, splitRendBits.pose_correction +#endif + ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); @@ -1776,7 +1789,12 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) { - if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written +#ifdef SPLIT_REND_LC3PLUS + , + splitRendBits.codec, splitRendBits.pose_correction +#endif + ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); diff --git a/apps/renderer.c b/apps/renderer.c index 64d87d0092..eed31e9cfa 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -668,7 +668,7 @@ static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER #ifdef DEBUGGING cldfb_in = 1; #endif - if ( ( audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) + if ( audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { cldfb_in = 1; } @@ -995,7 +995,7 @@ int main( if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); + fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed\n" ); exit( -1 ); } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1224,6 +1224,9 @@ int main( #else bitsBufferSize = (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC; bitsBufferSize = ( bitsBufferSize + 7 ) >> 3; +#endif +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + bitsBufferSize = ( SPLIT_REND_LC3PLUS_HBR * MAX_HEAD_ROT_POSES /* Max head poses */ * BINAURAL_CHANNELS /* Ech pose is 2 channels */ + 256000 /* Max metadata bitrate */ ) / FRAMES_PER_SEC / 8; #endif } else @@ -1313,7 +1316,12 @@ int main( { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; - error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); + error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten +#ifdef SPLIT_REND_LC3PLUS + , + &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection +#endif + ); if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) @@ -1529,14 +1537,14 @@ int main( } #endif - if ( IVAS_REND_GetSamples( hIvasRend, outBuffer + if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer #ifdef SPLIT_REND_WITH_HEAD_ROT - , - &bitsBuffer + , + &bitsBuffer #endif - ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in getting samples\n" ); + fprintf( stderr, "Error %s\n", ivas_error_to_string( error ) ); exit( -1 ); } @@ -1586,7 +1594,12 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && is_split_pre_rend_mode( &args ) ) { - if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten +#ifdef SPLIT_REND_LC3PLUS + , + bitsBuffer.config.codec, bitsBuffer.config.poseCorrection +#endif + ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); @@ -2395,7 +2408,7 @@ IsmPositionProvider *IsmPositionProvider_open( IsmPositionProvider *ipp; uint16_t i; - ipp = (IsmPositionProvider *) malloc_( sizeof( IsmPositionProvider ) ); + ipp = (IsmPositionProvider *) malloc( sizeof( IsmPositionProvider ) ); ipp->frameCounter = 0; ipp->numObjects = 0; @@ -2790,8 +2803,8 @@ static void parseIsm( if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 ) { positionProvider->numPositions[idx] = numberOfObjectPositionsToRead; - positionProvider->positions[idx] = malloc_( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); - positionProvider->positionDurations[idx] = malloc_( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); + positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); + positionProvider->positionDurations[idx] = malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); for ( i = 0; i < numberOfObjectPositionsToRead; ++i ) { diff --git a/ci/comment_defines.py b/ci/comment_defines.py new file mode 100755 index 0000000000..0b6e345703 --- /dev/null +++ b/ci/comment_defines.py @@ -0,0 +1,47 @@ +import re +import argparse + + +def process_file(file_path: str, defines_re): + with open(file_path, "r", encoding="utf-8") as file: + lines = file.readlines() + + num_subbed = dict() + for name in defines_re.keys(): + num_subbed[name] = 0 + + for i, line in enumerate(lines): + for name, regex in defines_re.items(): + # Spaces are replaced with underscores to avoid matching on multiple runs + lines[i] = regex.sub(lambda x: f"/* {x.group(0).replace(' ', '_')} */", line) + + if lines[i] != line: + num_subbed[name] += 1 + + with open(file_path, "w", encoding="utf-8") as file: + file.writelines(lines) + + print(f"Processed {file_path}") + for name, num in num_subbed.items(): + print(f"{name} - {num} occurences commented") + print("") + + +def compile_define_re(define_name: str): + return re.compile(f"#define\\s+{define_name}") + + +def main(args): + defines_re = dict() + for define_name in args.defines: + defines_re[define_name] = compile_define_re(define_name) + + for file_path in args.files: + process_file(file_path, defines_re) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Comment out preprocessor defines in c/c++ files") + parser.add_argument("-f", "--files", nargs="+", required=True, type=str) + parser.add_argument("-d", "--defines", nargs="+", required=True, type=str) + main(parser.parse_args()) diff --git a/ci/disable_ram_counting.py b/ci/disable_ram_counting.py deleted file mode 100755 index 3c89153508..0000000000 --- a/ci/disable_ram_counting.py +++ /dev/null @@ -1,20 +0,0 @@ -import re -import os - -FILE_PATH = os.path.join(os.path.dirname(__file__), "..", "lib_com", "options.h") -RE_TO_COMMENT_OUT = re.compile(r"#define\s+RAM_COUNTING_TOOL") - - -def main(): - with open(FILE_PATH, "r", encoding="utf-8") as file: - lines = file.readlines() - - for i, line in enumerate(lines): - lines[i] = RE_TO_COMMENT_OUT.sub(lambda x: f"/* {x.group(0)} */", line) - - with open(FILE_PATH, "w", encoding="utf-8") as file: - file.writelines(lines) - - -if __name__ == "__main__": - main() diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index fae93bc2c8..506547144d 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -102,12 +102,32 @@ typedef enum #endif #ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_LC3PLUS +typedef enum +{ + IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB, +} IVAS_SPLIT_REND_POSE_CORRECTION_MODE; +#endif + +#ifdef SPLIT_REND_LC3PLUS +typedef enum +{ + IVAS_SPLIT_REND_CODEC_LCLD, + IVAS_SPLIT_REND_CODEC_LC3PLUS, +} IVAS_SPLIT_REND_CODEC; +#endif + typedef struct ivas_split_rend_bits_t { uint8_t *bits_buf; int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ int32_t bits_written; int32_t bits_read; +#ifdef SPLIT_REND_LC3PLUS + IVAS_SPLIT_REND_CODEC codec; + IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; +#endif } ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS, *IVAS_SPLIT_REND_BITS_HANDLE; #endif typedef struct @@ -155,6 +175,7 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG } IVAS_ROOM_ACOUSTICS_CONFIG_DATA; #ifdef SPLIT_REND_WITH_HEAD_ROT + typedef struct _IVAS_SPLIT_REND_CONFIG { int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ @@ -167,6 +188,10 @@ typedef struct _IVAS_SPLIT_REND_CONFIG 3 - (3dof correction. By default YAW, PITCH and ROLL correction) */ int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ +#ifdef SPLIT_REND_LC3PLUS + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; + IVAS_SPLIT_REND_CODEC codec; +#endif } IVAS_SPLIT_REND_CONFIG_DATA; #endif diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2bcf082064..595e5578e9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1432,8 +1432,20 @@ typedef enum #define SPLIT_REND_MAX_ONE_AXIS_MD_POSES (2) #define MAX_EXTRAPOLATION_ANGLE (15.0f) /* this means additional 15 degrees can be extrapolated on top of MD probing poses*/ +#ifdef SPLIT_REND_LC3PLUS +#define SPLIT_REND_MAX_DOF (3) +#define SPLIT_REND_MSPC_NPOSES_0DOF (1) +#define SPLIT_REND_MSPC_NPOSES_1DOF (3) +#define SPLIT_REND_MSPC_NPOSES_2DOF (7) +#define SPLIT_REND_MSPC_NPOSES_3DOF (8) +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_LC3PLUS +#define MAX_HEAD_ROT_POSES (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) /* TODO tmu : revisit for harmonization */ +#else #define MAX_HEAD_ROT_POSES (1 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) +#endif #else #define MAX_HEAD_ROT_POSES (1 + SPLIT_REND_MAX_YAW_ONLY_POSES) #endif @@ -1725,10 +1737,16 @@ typedef enum #define SIZE_SPLIT_REND_BRATE_TBL (4) #define SPLIT_REND_256k 256000 +#ifdef SPLIT_REND_LC3PLUS +#define SPLIT_REND_320k 320000 /* TODO tmu: LC3plus 0DOF only at the moment - not included in SIZE_SPLIT_REND_BRATE_TBL! */ +#endif #define SPLIT_REND_384k 384000 #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 -#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k +#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k +#ifdef SPLIT_REND_LC3PLUS +#define SPLIT_REND_LC3PLUS_HBR 128000 /* bitrate per LC3plus core */ +#endif #ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 9438ad44a1..f4ea7ecb8c 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -133,6 +133,9 @@ typedef enum IVAS_ERR_INVALID_INPUT_ID, IVAS_ERR_WRONG_NUM_CHANNELS, IVAS_ERR_INVALID_BUFFER_SIZE, +#ifdef SPLIT_REND_LC3PLUS + IVAS_ERR_LC3PLUS_INVALID_BITRATE, +#endif /*----------------------------------------* * unknown error * @@ -179,6 +182,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Parse error"; case IVAS_ERR_END_OF_FILE: return "End of file"; +#ifdef SPLIT_REND_LC3PLUS + case IVAS_ERR_LC3PLUS_INVALID_BITRATE: + return "Specified split rendering bit rate is not supported by LC3plus"; +#endif default: break; } diff --git a/lib_com/options.h b/lib_com/options.h index 5c06d98c06..30e4a8fe4f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -210,7 +210,14 @@ #define SPLIT_REND_CLANG_SAN_FIX #define SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_STACK_OPT + +#define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ +#define FIX_SPLIT_REND_OPEN_ERROR_HANDLING /* adds missing error handling around ivas_split_renderer_open calls */ +// #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ #endif +#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ +#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ +#define RENAME_GWLPR /* FhG: Rename clashing symbol */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 96974b9f8e..e4fddda6d2 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -1079,7 +1079,11 @@ static void subst_spec( } i++; im_ind--; +#ifdef RENAME_GWLPR + if ( i >= ivas_gwlpr[k + 1] ) +#else if ( i >= gwlpr[k + 1] ) +#endif { k++; } @@ -1191,7 +1195,11 @@ static void subst_spec( i++; im_ind--; +#ifdef RENAME_GWLPR + if ( i >= ivas_gwlpr[k + 1] ) +#else if ( i >= gwlpr[k + 1] ) +#endif { k++; } @@ -1246,7 +1254,11 @@ static void subst_spec( } i++; +#ifdef RENAME_GWLPR + if ( i >= ivas_gwlpr[k + 1] ) +#else if ( i >= gwlpr[k + 1] ) +#endif { k++; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4c9bf28a46..ad7284cb4f 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -105,7 +105,11 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { +#ifdef SPLIT_REND_LC3PLUS + assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA or discrete ISM format and 48k sampling rate only" ); +#else assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); +#endif ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hHeadTrackData, hSplitRendBits ); } #endif @@ -240,10 +244,21 @@ ivas_error ivas_dec( /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_LC3PLUS + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { - return error; + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } + else + { +#endif + if ( ( error = ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef SPLIT_REND_LC3PLUS + } +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { @@ -640,10 +655,17 @@ ivas_error ivas_dec( ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, +#ifdef SPLIT_REND_LC3PLUS + st_ivas->hRenderConfig->split_rend_config.codec, +#endif hSplitBinRend->hSplitRendBits, hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, - max_band, output, 1, pcm_out ); + max_band, output, 1, +#ifdef SPLIT_REND_LC3PLUS + st_ivas->ivas_format != SBA_FORMAT, +#endif + pcm_out ); free( st_ivas->splitBinRend.hMultiBinCldfbData ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 721f30343b..0582ed8844 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1234,9 +1234,20 @@ ivas_error ivas_init_decoder( if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + error = +#endif + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, + 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + if ( error != IVAS_ERR_OK ) + { + return error; + } +#endif } #endif } @@ -1269,6 +1280,33 @@ ivas_error ivas_init_decoder( return error; } } + +#ifdef SPLIT_REND_LC3PLUS + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + + /* Split rendering with ISMs only supported with LC3plus */ + assert(st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS); + +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + error = +#endif + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 0, 0 ); + +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + if ( error != IVAS_ERR_OK ) + { + return error; + } +#endif + } +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index e551029c9a..d5733e77b4 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -259,9 +259,21 @@ ivas_error ivas_sba_dec_reconfigure( if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); +#ifdef SPLIT_REND_LC3PLUS + assert(st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LCLD); +#endif +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + error = +#endif + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + if ( error != IVAS_ERR_OK ) + { + return error; + } +#endif } #endif } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c53df56c92..6ca89f3aea 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1222,6 +1222,10 @@ ivas_error IVAS_DEC_GetRenderConfig( hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; #endif +#ifdef SPLIT_REND_LC3PLUS + hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; +#endif return IVAS_ERR_OK; } @@ -1269,10 +1273,14 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); #ifdef SPLIT_REND_WITH_HEAD_ROT - hRenderConfig->split_rend_config.splitRendBitRate = renderConfig.split_rend_config.splitRendBitRate; - hRenderConfig->split_rend_config.dof = renderConfig.split_rend_config.dof; - hRenderConfig->split_rend_config.hq_mode = renderConfig.split_rend_config.hq_mode; - hRenderConfig->split_rend_config.codec_delay_ms = renderConfig.split_rend_config.codec_delay_ms; + hRenderConfig->split_rend_config = renderConfig.split_rend_config; +#endif +#ifdef SPLIT_REND_LC3PLUS + /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ + if (hRenderConfig->split_rend_config.dof == 0) + { + hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; + } #endif return IVAS_ERR_OK; @@ -1871,6 +1879,10 @@ const char *IVAS_DEC_GetErrorMessage( return "could not read from file"; case IVAS_ERR_NOT_IMPLEMENTED: return "not implemented"; +#ifdef SPLIT_REND_LC3PLUS + case IVAS_ERR_LC3PLUS_INVALID_BITRATE: + return ivas_error_to_string( IVAS_ERR_LC3PLUS_INVALID_BITRATE ); +#endif case IVAS_ERR_UNKNOWN: default: break; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index d9608c2b83..2b58d7bf83 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -58,7 +58,7 @@ typedef enum _IVAS_DEC_OUTPUT_CONFIG IVAS_DEC_OUTPUT_BINAURAL, IVAS_DEC_OUTPUT_BINAURAL_ROOM, #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB, + IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB, /* ToDo: Also includes LC3plus, should be renamed during harmonization */ IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM, #endif IVAS_DEC_OUTPUT_EXT, diff --git a/lib_dec/rom_dec.c b/lib_dec/rom_dec.c index beba87c3da..6f0751dc56 100644 --- a/lib_dec/rom_dec.c +++ b/lib_dec/rom_dec.c @@ -92,7 +92,11 @@ const float lsf_tab[LPC_SHB_ORDER] = const int16_t gw[LGW_MAX] = { 1, 3, 6, 10, 16, 32, 64, 128, 192 }; /* 31.25 343.75 718.75 1218.75 1968.75 4000 8000 16000 24000 */ +#ifdef RENAME_GWLPR +const int16_t ivas_gwlpr[LGW_MAX] = { 1, 3*QUOT_LPR_LTR-1, 6*QUOT_LPR_LTR-1, 10*QUOT_LPR_LTR-1, 16*QUOT_LPR_LTR-1, 32*QUOT_LPR_LTR, 64*QUOT_LPR_LTR, 128*QUOT_LPR_LTR, 192*QUOT_LPR_LTR }; +#else const int16_t gwlpr[LGW_MAX] = { 1, 3*QUOT_LPR_LTR-1, 6*QUOT_LPR_LTR-1, 10*QUOT_LPR_LTR-1, 16*QUOT_LPR_LTR-1, 32*QUOT_LPR_LTR, 64*QUOT_LPR_LTR, 128*QUOT_LPR_LTR, 192*QUOT_LPR_LTR }; +#endif const float w_hamm48k_2[L_TRANA48k/2] = { diff --git a/lib_dec/rom_dec.h b/lib_dec/rom_dec.h index 751a2e4da0..604bfc2fe0 100644 --- a/lib_dec/rom_dec.h +++ b/lib_dec/rom_dec.h @@ -56,7 +56,11 @@ extern const int16_t hestable[15]; extern const float lsf_tab[LPC_SHB_ORDER]; extern const int16_t gw[LGW_MAX]; +#ifdef RENAME_GWLPR +extern const int16_t ivas_gwlpr[LGW_MAX]; +#else extern const int16_t gwlpr[LGW_MAX]; +#endif extern const float w_hamm32k_2[L_TRANA32k / 2]; extern const float w_hamm16k_2[L_TRANA16k / 2]; extern const float w_hamm_sana32k_2[L_PROT_HAMM_LEN2_32k]; diff --git a/lib_rend/ivas_lc3plus_common.c b/lib_rend/ivas_lc3plus_common.c new file mode 100644 index 0000000000..3b12f78be5 --- /dev/null +++ b/lib_rend/ivas_lc3plus_common.c @@ -0,0 +1,49 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_lc3plus_common.h" +#include "ivas_error.h" +#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" + +ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ) +{ + switch ( lc3PlusError ) + { + case LC3PLUS_OK: + return IVAS_ERR_OK; + case LC3PLUS_BITRATE_ERROR: + return IVAS_ERR_LC3PLUS_INVALID_BITRATE; + default: + break; + } + return IVAS_ERR_INTERNAL; +} diff --git a/lib_rend/ivas_lc3plus_common.h b/lib_rend/ivas_lc3plus_common.h new file mode 100644 index 0000000000..01971679d2 --- /dev/null +++ b/lib_rend/ivas_lc3plus_common.h @@ -0,0 +1,53 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#pragma once + +#include +#include "ivas_error.h" +#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" + +/*! common configuration parameters between encoder and decoder */ +typedef struct LC3PLUS_CONFIG +{ + /*! frame duration in microseconds [10000, 5000, 2500] */ + uint32_t lc3plus_frame_duration_us; + /*! ivas frame duration in microseconds [20000, 5000] */ + uint32_t ivas_frame_duration_us; + /*! sampling rate*/ + uint32_t samplerate; + /*! number of channels */ + uint16_t channels; +} LC3PLUS_CONFIG; + +/*! utility function to convert LC3PLUS_Errors to the suitable ivas_error */ +ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ); diff --git a/lib_rend/ivas_lc3plus_dec.c b/lib_rend/ivas_lc3plus_dec.c new file mode 100644 index 0000000000..30a7941242 --- /dev/null +++ b/lib_rend/ivas_lc3plus_dec.c @@ -0,0 +1,678 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_lc3plus_dec.h" +#include "ivas_lc3plus_common.h" +#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "ivas_error_utils.h" +#include "wmc_auto.h" + +ivas_error IVAS_LC3PLUS_DEC_Open( + const LC3PLUS_CONFIG config, /* i: decoder configuration */ +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */ +#endif + IVAS_LC3PLUS_DEC_HANDLE *handle /* o: decoder handle */ +) +{ + LC3PLUS_Error err; + int32_t decoder_size; + int16_t lc3plusFrameIdx; + int16_t numLC3plusFramesPerIvasFrame; + int16_t i; + + *handle = malloc( sizeof( struct IVAS_LC3PLUS_DEC_HANDLE ) ); + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); + } + if( 0 == config.lc3plus_frame_duration_us ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid lc3plus_frame_duration_us (0)\n" ); + } +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + (*handle)->cachingEnabled = enableCaching; +#endif + numLC3plusFramesPerIvasFrame = config.ivas_frame_duration_us / config.lc3plus_frame_duration_us; + +#ifdef LC3PLUS_DEC_COLLECT_STATS + ( *handle )->stats.action_histogram[DEC_ACTION_DECODE_AND_DROP] = 0; + ( *handle )->stats.action_histogram[DEC_ACTION_DECODE_AND_USE] = 0; + ( *handle )->stats.action_histogram[DEC_ACTION_SKIP] = 0; + ( *handle )->stats.action_histogram[DEC_ACTION_CACHE] = 0; + ( *handle )->stats.num_cached_frames_decoded_and_dropped = 0; +#endif + + ( *handle )->num_decs = 0; + ( *handle )->pcm_conversion_buffer = NULL; + ( *handle )->handles = NULL; + ( *handle )->selective_decoding_states = NULL; + ( *handle )->bitstream_caches = NULL; + ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_HANDLE ) ); + ( *handle )->selective_decoding_states = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE * ) ); + if ( NULL == ( *handle )->handles || NULL == ( *handle )->selective_decoding_states ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); + } + for ( i = 0; i < config.channels; ++i ) + { + ( *handle )->handles[i] = NULL; + ( *handle )->selective_decoding_states[i] = NULL; + } + +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + if(enableCaching) + { +#endif + ( *handle )->bitstream_caches = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE* ) ); + if ( NULL == ( *handle )->bitstream_caches ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); + } + for ( i = 0; i < config.channels; ++i ) + { + ( *handle )->bitstream_caches[i] = NULL; + } +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + } +#endif + ( *handle )->num_decs = config.channels; + for ( int32_t iCh = 0; iCh < config.channels; iCh++ ) + { + ( *handle )->selective_decoding_states[iCh] = NULL; + if(NULL != ( *handle )->bitstream_caches) + { + ( *handle )->bitstream_caches[iCh] = NULL; + } + /* allocate and configure LC3plus decoder */ + decoder_size = lc3plus_dec_get_size( config.samplerate, 1 ); + if ( 0 == decoder_size ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_dec_get_size failed\n" ); + } + + ( *handle )->handles[iCh] = malloc( decoder_size ); + if ( NULL == ( *handle )->handles[iCh] ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); + } + + err = lc3plus_dec_init( ( *handle )->handles[iCh], config.samplerate, 1, LC3PLUS_PLC_ADVANCED, 0 ); + if ( LC3PLUS_OK != err ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_dec_init failed\n" ); + } + + err = lc3plus_dec_set_frame_dms( ( *handle )->handles[iCh], config.lc3plus_frame_duration_us / 100 ); + if ( LC3PLUS_OK != err ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_dec_set_frame_dms failed\n" ); + } + + /* allocate and configure per LC3plus decoder skip state */ + ( *handle )->selective_decoding_states[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE ) ); + if ( NULL == ( *handle )->selective_decoding_states[iCh] ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); + } + ( *handle )->selective_decoding_states[iCh]->frame_actions = malloc( numLC3plusFramesPerIvasFrame*sizeof(SelectiveDecAction) ); + if ( NULL == ( *handle )->selective_decoding_states[iCh]->frame_actions ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); + } + ( *handle )->selective_decoding_states[iCh]->has_skipped_a_frame = 0; + ( *handle )->selective_decoding_states[iCh]->shall_decode_cached_frame = 0; + for(lc3plusFrameIdx = 0; lc3plusFrameIdx < numLC3plusFramesPerIvasFrame; lc3plusFrameIdx++) + { + ( *handle )->selective_decoding_states[iCh]->frame_actions[lc3plusFrameIdx] = DEC_ACTION_DECODE_AND_USE; + } +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + if(enableCaching) + { +#endif + /* allocate and configure per LC3plus decoder bitstream cache */ + ( *handle )->bitstream_caches[iCh] = malloc( sizeof(IVAS_LC3PLUS_DEC_BITSTREAM_CACHE) ); + if ( NULL == ( *handle )->bitstream_caches[iCh] ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); + } + ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity = 400 /*LC3plus max non-HR octet count*/ * numLC3plusFramesPerIvasFrame; + ( *handle )->bitstream_caches[iCh]->bitstream_cache = malloc(( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity); + if ( NULL == ( *handle )->bitstream_caches[iCh]->bitstream_cache ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); + } + ( *handle )->bitstream_caches[iCh]->bitstream_cache_size = 0; +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + } +#endif + } + ( *handle )->config = config; + if ( config.ivas_frame_duration_us < config.lc3plus_frame_duration_us || config.ivas_frame_duration_us % config.lc3plus_frame_duration_us != 0 ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Current pcm_conversion_buffer sizing requires that lc3plus uses a shorter or equal frame duration than ivas\n" ); + } + ( *handle )->pcm_conversion_buffer = malloc( sizeof( int16_t ) * config.samplerate * config.lc3plus_frame_duration_us / 1000000 ); + if ( NULL == ( *handle )->pcm_conversion_buffer ) + { + IVAS_LC3PLUS_DEC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder wrapper pcm_conversion_buffer\n" ); + } + return IVAS_ERR_OK; +} + +ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(int16_t ***subframeChannelMatrix, const uint32_t num_decs) +{ + *subframeChannelMatrix = malloc(MAX_PARAM_SPATIAL_SUBFRAMES * sizeof(int16_t *)); + if(NULL == *subframeChannelMatrix) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" ); + } + for (int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + (*subframeChannelMatrix)[i] = NULL; + } + for (int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + (*subframeChannelMatrix)[i] = malloc(num_decs * sizeof(int16_t)); + if(NULL == (*subframeChannelMatrix)[i]) + { + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(*subframeChannelMatrix); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" ); + } + } + return IVAS_ERR_OK; +} + +void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(int16_t **subframeChannelMatrix) +{ + for (int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + free(subframeChannelMatrix[i]); + } + free(subframeChannelMatrix); +} + +ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] +) +{ + int16_t numIvasSubFramesPerLC3frame; + uint32_t decIdx; + int16_t ivasSubframeIdx; + int16_t effectiveIvasSubframeDuration; + int16_t actual_num_spatial_subframes; + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "IVAS_LC3PLUS_DEC_HANDLE is NULL\n" ); + } + if ( NULL == subframeChannelMatrix ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "subframeChannelMatrix is NULL\n" ); + } + if(handle->config.lc3plus_frame_duration_us == 0 || handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "invalid ivas_frame_duration_us/lc3plus_frame_duration_us values\n" ); + } + + effectiveIvasSubframeDuration = handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us/MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us; + numIvasSubFramesPerLC3frame = handle->config.lc3plus_frame_duration_us/effectiveIvasSubframeDuration; + actual_num_spatial_subframes = handle->config.ivas_frame_duration_us / effectiveIvasSubframeDuration; + // 0.5(0) = 10ms lc3plus, 5ms subframe + if(numIvasSubFramesPerLC3frame != 1) + { + return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Selective decoding is only implemented for aligned IVAS-Subframes & LC3plus \n" ); + } + + + /* map subframeChannelMatrix to lc3plus skip states */ + /* 1st pass: Flag the required frames */ + for(decIdx = 0; decIdx < handle->num_decs; decIdx++) + { + for( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) + { + if( 1 == subframeChannelMatrix[ivasSubframeIdx][decIdx] ) + { + /* subframe needed by the user, definitely decode */ + handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_USE; + } + else + { + + /* subframe not needed by the user, but might be required to re-initialize a decoder after inactivity */ + if( +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + handle->cachingEnabled && +#endif + (ivasSubframeIdx != actual_num_spatial_subframes - 1) && 1 == subframeChannelMatrix[ivasSubframeIdx + 1][decIdx] ) + { + /* ... but if the following subframe is required, it needs to be decoded and dropped */ + handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_DROP; + } + else + { + handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_SKIP; + } + } + } + } +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + if(handle->cachingEnabled) + { +#endif + /* if a decoder was paused before, it needs to either: + * - Decode the cached frame (if available) and the first required frame OR + * - Decode the previous LC3plus subframe, even if it isn't needed by the user */ + for(decIdx = 0; decIdx < handle->num_decs; decIdx++) + { + if( handle->selective_decoding_states[decIdx]->has_skipped_a_frame ) + { + /* find the first frame required by the user */ + for( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) + { + if( DEC_ACTION_DECODE_AND_USE == handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] ) + { + /* The first required frame is the first subframe. To flush the decoder, the cached frame must be decoded and dropped */ + if(0 == ivasSubframeIdx) + { + handle->selective_decoding_states[decIdx]->shall_decode_cached_frame = 1; + break; + } + /* The first required frame is not the first frame, so the cache is useless. Instead we decode & drop the previous frame*/ + else + { + handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx - 1] = DEC_ACTION_DECODE_AND_DROP; + break; + } + } + } + } + } + + /* if a dec gets paused & caching is activated we need to flag the last useful LC3plus frame for caching */ + for(decIdx = 0; decIdx < handle->num_decs; decIdx++) + { + for( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) + { + if( handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] == DEC_ACTION_SKIP + && handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] != DEC_ACTION_DECODE_AND_USE ) + { + handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] = DEC_ACTION_CACHE; + } + } + } +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + } +#endif + return IVAS_ERR_OK; +} + +ivas_error IVAS_LC3PLUS_DEC_GetDelay( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + int32_t *delayInSamples /* o: decoder delay in number of samples per channel */ +) +{ + int32_t tmpDelayInSamples; + + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "IVAS_LC3PLUS_DEC_HANDLE is NULL\n" ); + } + if ( NULL == delayInSamples ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "delayInSamples is NULL\n" ); + } + + *delayInSamples = 0; + /* sanity check whether all encoders are actually configured identically */ + for ( uint32_t iDec = 0; iDec < handle->num_decs; iDec++ ) + { + if ( NULL == handle->handles[iDec] ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3plus decoder handle is NULL\n" ); + } + + tmpDelayInSamples = lc3plus_dec_get_delay( handle->handles[iDec] ); + if ( 0 != *delayInSamples && tmpDelayInSamples != *delayInSamples ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "Not all mono LC3plus decoders are configured identically\n" ); + } + *delayInSamples = tmpDelayInSamples; + } + return IVAS_ERR_OK; +} + +void IVAS_LC3PLUS_DEC_Close( + IVAS_LC3PLUS_DEC_HANDLE *handle /* i/o: Pointer to decoder handle */ +) +{ + if ( NULL == handle || NULL == *handle ) + { + return; + } +#ifdef LC3PLUS_DEC_COLLECT_STATS + printLC3plusDecStats( &(*handle)->stats ); +#endif + for ( uint32_t iDec = 0; iDec < ( *handle )->num_decs; iDec++ ) + { + if ( NULL != ( *handle )->handles && NULL != ( *handle )->handles[iDec] ) + { + lc3plus_free_decoder_structs( ( *handle )->handles[iDec] ); + free( ( *handle )->handles[iDec] ); + } + + if ( NULL != ( *handle )->selective_decoding_states && NULL != ( *handle )->selective_decoding_states[iDec] ) + { + free( ( *handle )->selective_decoding_states[iDec]->frame_actions ); + free( ( *handle )->selective_decoding_states[iDec] ); + } + + if ( NULL != ( *handle )->bitstream_caches && NULL != ( *handle )->bitstream_caches[iDec] ) + { + free( ( *handle )->bitstream_caches[iDec]->bitstream_cache ); + free( ( *handle )->bitstream_caches[iDec] ); + } + } + if ( NULL != ( *handle )->pcm_conversion_buffer ) + { + free( ( *handle )->pcm_conversion_buffer ); + } + free( ( *handle )->handles ); + if( NULL != ( *handle )->bitstream_caches ) + { + free( ( *handle )->bitstream_caches ); + } + free( ( *handle )->selective_decoding_states ); + free( *handle ); + *handle = NULL; +} + +static ivas_error decode_or_conceal_one_lc3plus_frame( + LC3PLUS_Dec* dec, + uint8_t* bitstream_in, + const int32_t bitstream_in_length, + int16_t **pcm_out_buffer, + const int32_t badFrameIndicator) +{ + LC3PLUS_Error err; + push_wmops( "lc3plus_dec16" ); + err = lc3plus_dec16( dec, bitstream_in, bitstream_in_length, pcm_out_buffer, NULL, badFrameIndicator ); + pop_wmops(); + if ( err == LC3PLUS_DECODE_ERROR && 1 == badFrameIndicator ) + { + /* LC3PLUS_DECODE_ERROR && badFrameIndicator means that the decoder has successfully concealed, which is actually OK. */ + err = LC3PLUS_OK; + } + if ( err != LC3PLUS_OK ) + { + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr(err), "lc3plus_dec16 failed\n" ); + } + return IVAS_ERR_OK; +} + +static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder configuration */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + const int32_t badFrameIndicator, /* i: bad frame indicator. If set to 1, triggers concealment */ + float **pcm_out /* o: decoded samples */ +) +{ + uint32_t iDec; + int32_t iLc3plusFrame; + int32_t lc3framesPerIvasFrame; + int32_t ivasSampleIndex; + int16_t numSamplesPerLC3plusChannel; + int32_t bitstreamOffsetPerCoder; + ivas_error err; + uint8_t *bitstream_in_iter = bitstream_in; + + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Dec_Wrap_Handle is NULL\n" ); + } + if ( NULL == bitstream_in ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "bitstream_in is NULL\n" ); + } + if ( NULL == pcm_out ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pcm_out is NULL\n" ); + } + if ( badFrameIndicator != 0 && badFrameIndicator != 1 ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "badFrameIndicator must be 1 or 0\n" ); + } + if ( badFrameIndicator == 0 && bitstream_in_size <= 0 ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "bitstream_in_size must be positive\n" ); + } + + if ( handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) + { + return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "ivas_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" ); + } + lc3framesPerIvasFrame = handle->config.ivas_frame_duration_us / handle->config.lc3plus_frame_duration_us; + + numSamplesPerLC3plusChannel = handle->config.samplerate / ( 1000000 / handle->config.ivas_frame_duration_us ) / lc3framesPerIvasFrame; + bitstreamOffsetPerCoder = bitstream_in_size / handle->num_decs / lc3framesPerIvasFrame; + for ( iDec = 0; iDec < handle->num_decs; iDec++ ) + { + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if( handle->selective_decoding_states[iDec]->shall_decode_cached_frame) + { + if(0 == handle->bitstream_caches[iDec]->bitstream_cache_size) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "LC3plus cache is empty\n" ); + } + err = decode_or_conceal_one_lc3plus_frame( + handle->handles[iDec], + handle->bitstream_caches[iDec]->bitstream_cache, + handle->bitstream_caches[iDec]->bitstream_cache_size, + &handle->pcm_conversion_buffer, + badFrameIndicator ); + if(err != IVAS_ERR_OK) + { + return IVAS_ERROR( err, "lc3plus decoding failed\n" ); + } + handle->selective_decoding_states[iDec]->shall_decode_cached_frame = 0; + handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0; +#ifdef LC3PLUS_DEC_COLLECT_STATS + handle->stats.num_cached_frames_decoded_and_dropped++; +#endif + } + /* reset cache if caching is enabled - it has either been decoded or is not needed */ + if(NULL != handle->bitstream_caches) + { + handle->bitstream_caches[iDec]->bitstream_cache_size = 0; + } +#ifdef LC3PLUS_DEC_COLLECT_STATS + handle->stats.action_histogram[handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame]]++; +#endif + switch ( handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] ) + { + case DEC_ACTION_DECODE_AND_DROP: + { + err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in_iter, bitstreamOffsetPerCoder, &handle->pcm_conversion_buffer, badFrameIndicator ); + if(err != IVAS_ERR_OK) + { + return IVAS_ERROR( err, "lc3plus decoding failed\n" ); + } + handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0; + break; + } + case DEC_ACTION_DECODE_AND_USE: + { + err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in_iter, bitstreamOffsetPerCoder, &handle->pcm_conversion_buffer, badFrameIndicator ); + if(err != IVAS_ERR_OK) + { + return IVAS_ERROR( err, "lc3plus decoding failed\n" ); + } + + for ( int32_t iSampleInt16 = 0; iSampleInt16 < numSamplesPerLC3plusChannel; iSampleInt16++ ) + { + ivasSampleIndex = iSampleInt16 + iLc3plusFrame * numSamplesPerLC3plusChannel; + pcm_out[iDec][ivasSampleIndex] = (float) handle->pcm_conversion_buffer[iSampleInt16]; + } + handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0; + break; + } + case DEC_ACTION_SKIP: + { + /* log that this instance has skipped a frame and must decode twice once reactivated */ + handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; + break; + } + case DEC_ACTION_CACHE: + { + if( handle->bitstream_caches[iDec]->bitstream_cache_capacity < bitstreamOffsetPerCoder ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "bitstream_cache_capacity is too low for LC3plus frame size\n" ); + } + /* store bit rate of cached frame */ + mvc2c(bitstream_in_iter, handle->bitstream_caches[iDec]->bitstream_cache, bitstreamOffsetPerCoder); + handle->bitstream_caches[iDec]->bitstream_cache_size = bitstreamOffsetPerCoder; + /* log that this instance has skipped a frame and must decode twice once reactivated */ + handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; + break; + } + case DEC_ACTION_NUM_ENUMS: + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "invalid LC3plus decoder state\n" ); + } + bitstream_in_iter += bitstreamOffsetPerCoder; + } + /* reset skipping state, must be set by the user before each decode call*/ + for(iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++) + { + handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] = DEC_ACTION_DECODE_AND_USE; + } + } + return IVAS_ERR_OK; +} + +ivas_error IVAS_LC3PLUS_DEC_Decode( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder configuration */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ +) +{ + int32_t badFrameIndicator; + + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Dec_Wrap_Handle is NULL\n" ); + } + if ( NULL == bitstream_in ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "bitstream_in is NULL\n" ); + } + if ( NULL == pcm_out ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pcm_out is NULL\n" ); + } + badFrameIndicator = 0; + return IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( handle, bitstream_in, bitstream_in_size, badFrameIndicator, pcm_out ); +} + +ivas_error IVAS_LC3PLUS_DEC_Conceal( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + float **pcm_out /* o: concealed samples */ +) +{ + uint8_t bitstream_in[LC3PLUS_MAX_BYTES]; + int32_t badFrameIndicator; + + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Dec_Wrap_Handle is NULL\n" ); + } + if ( NULL == pcm_out ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pcm_out is NULL\n" ); + } + /* LC3plus API requires a non-NULL bitstream pointer, even when triggering concealment */ + badFrameIndicator = 1; + return IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( handle, bitstream_in, 0, badFrameIndicator, pcm_out ); +} + + +#ifdef LC3PLUS_DEC_COLLECT_STATS +void printLC3plusDecStats(const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats) +{ + int32_t sum_pushed_frames = 0; + int32_t sum_decoded_and_dropped_frames, sum_skipped_frames; + + sum_pushed_frames = stats->action_histogram[DEC_ACTION_DECODE_AND_USE] + + stats->action_histogram[DEC_ACTION_SKIP] + + stats->action_histogram[DEC_ACTION_CACHE]; + + sum_decoded_and_dropped_frames = + stats->action_histogram[DEC_ACTION_DECODE_AND_DROP] + + stats->num_cached_frames_decoded_and_dropped; + + sum_skipped_frames = stats->action_histogram[DEC_ACTION_SKIP] + stats->action_histogram[DEC_ACTION_CACHE]; + + if( sum_pushed_frames == 0) + { + printf( "\n Dec didn't run"); + return; + } + + printf( "\nsum_pushed_frames: %i\n" , sum_pushed_frames ); + printf( " DECODE_AND_USE count: %i \n" , stats->action_histogram[DEC_ACTION_DECODE_AND_USE]); + printf( " SKIP count: %i\n" , stats->action_histogram[DEC_ACTION_SKIP]); + printf( " CACHE count: %i\n" , stats->action_histogram[DEC_ACTION_CACHE]); + printf( "Decoded-and-Dropped:\n" ); + printf( " DECODE_AND_DROP count: %i \n" , stats->action_histogram[DEC_ACTION_DECODE_AND_DROP]); + printf( " DEC_CACHE count: %i\n" , stats->num_cached_frames_decoded_and_dropped); + printf( " perc of req : %f\n" , 100.f*(float)sum_decoded_and_dropped_frames/ sum_pushed_frames ); + printf( "Workload saved: \n"); + printf( " Skipped perc. of req %f\n", 100.f*(float)sum_skipped_frames/ sum_pushed_frames ); +} +#endif diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h new file mode 100644 index 0000000000..45bbef86a1 --- /dev/null +++ b/lib_rend/ivas_lc3plus_dec.h @@ -0,0 +1,138 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#pragma once + +#include +#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "ivas_error.h" +#include "ivas_lc3plus_common.h" +#include "ivas_cnst.h" + +#ifdef DEBUGGING +/* if defined, collects runtime stats and prints them in the DTOR */ +// #define LC3PLUS_DEC_COLLECT_STATS +/* if defined, caching can be disabled, otherwise it's always active */ +// #define LC3PLUS_DEC_ALLOW_DISABLE_CACHING +#endif + +typedef enum +{ + DEC_ACTION_DECODE_AND_DROP = 0, + DEC_ACTION_DECODE_AND_USE, + DEC_ACTION_SKIP, + DEC_ACTION_CACHE, + DEC_ACTION_NUM_ENUMS +} SelectiveDecAction; + +#ifdef LC3PLUS_DEC_COLLECT_STATS +typedef struct IVAS_LC3PLUS_DEC_COLLECT_STATS +{ + int32_t action_histogram[DEC_ACTION_NUM_ENUMS]; + int32_t num_cached_frames_decoded_and_dropped; +} IVAS_LC3PLUS_DEC_COLLECT_STATS; + +void printLC3plusDecStats(const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats); +#endif + +typedef struct IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE +{ + /*! indicates that the decoder has skipped one or more frames. This means it must decode two frames to flush algorithmic delay when re-activated */ + int16_t has_skipped_a_frame; + /*! if set to 1, decoder will skip decoding for the next frame */ + SelectiveDecAction *frame_actions; + /*! if set to 1, decoder will decode the cache before decoding any of current frames */ + int16_t shall_decode_cached_frame; +} IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE; + +typedef struct IVAS_LC3PLUS_DEC_BITSTREAM_CACHE +{ + uint8_t* bitstream_cache; + int32_t bitstream_cache_capacity; + int32_t bitstream_cache_size; +} IVAS_LC3PLUS_DEC_BITSTREAM_CACHE; + +/* decoder wrapper */ +typedef struct IVAS_LC3PLUS_DEC_HANDLE +{ + LC3PLUS_Dec **handles; + IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE **selective_decoding_states; + IVAS_LC3PLUS_DEC_BITSTREAM_CACHE **bitstream_caches; + uint32_t num_decs; + int16_t *pcm_conversion_buffer; + LC3PLUS_CONFIG config; +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + int16_t cachingEnabled; +#endif +#ifdef LC3PLUS_DEC_COLLECT_STATS + IVAS_LC3PLUS_DEC_COLLECT_STATS stats; +#endif +} * IVAS_LC3PLUS_DEC_HANDLE; + +ivas_error IVAS_LC3PLUS_DEC_Open( + const LC3PLUS_CONFIG config, /* i: decoder configuration */ +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */ +#endif + IVAS_LC3PLUS_DEC_HANDLE *handle /* o: decoder handle */ +); + +ivas_error IVAS_LC3PLUS_DEC_GetDelay( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + int32_t *delayInSamples /* o: algorithmic delay of encoding and decoding in number of samples per channel */ +); + +void IVAS_LC3PLUS_DEC_Close( + IVAS_LC3PLUS_DEC_HANDLE *handle /* i/o: pointer to decoder handle */ +); + +/*! Sets a matrix[MAX_PARAM_SPATIAL_SUBFRAMES][numLC3plusDecoders] where all require subframes must be flagged with 1, frames that are not required with 0 */ +ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] /* i: */ +); + +ivas_error IVAS_LC3PLUS_DEC_Decode( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ +); + +ivas_error IVAS_LC3PLUS_DEC_Conceal( + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + float **pcm_out /* o: concealed samples */ +); + +ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(int16_t ***subframeChannelMatrix, uint32_t num_decs); + +void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(int16_t **subframeChannelMatrix); diff --git a/lib_rend/ivas_lc3plus_enc.c b/lib_rend/ivas_lc3plus_enc.c new file mode 100644 index 0000000000..758299c067 --- /dev/null +++ b/lib_rend/ivas_lc3plus_enc.c @@ -0,0 +1,296 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "ivas_lc3plus_enc.h" +#include "ivas_lc3plus_common.h" +#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "ivas_error_utils.h" +#include "prot.h" +#include "wmc_auto.h" + +ivas_error IVAS_LC3PLUS_ENC_Open( + const LC3PLUS_CONFIG config, /* i: encoder configuration */ + const uint32_t bitsPerSecond, /* i: bit rate */ + IVAS_LC3PLUS_ENC_HANDLE *handle /* o: encoder handle */ +) +{ + int32_t bitsPerSecondPerChannel; + int32_t encoder_size; + LC3PLUS_Error err; + int32_t lfeChans[1] = { 0 }; + int16_t i; + + if ( 0U == config.channels ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid number of channels\n" ); + } + bitsPerSecondPerChannel = bitsPerSecond / config.channels; +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + if ( bitsPerSecond == (uint32_t) -1 ) + { + bitsPerSecondPerChannel = SPLIT_REND_LC3PLUS_HBR; + } +#endif + + encoder_size = lc3plus_enc_get_size( config.samplerate, 1 ); + if ( 0 == encoder_size ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_enc_get_size failed\n" ); + } + + *handle = malloc( sizeof( struct IVAS_LC3PLUS_ENC_HANDLE ) ); + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); + } + + ( *handle )->pcm_conversion_buffer = NULL; + ( *handle )->num_encs = 0; + ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_ENC_HANDLE ) ); + if ( NULL == ( *handle )->handles ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); + } + for ( i = 0; i < config.channels; ++i ) + { + ( *handle )->handles[i] = NULL; + } + ( *handle )->num_encs = config.channels; + + for ( int32_t iCh = 0; iCh < config.channels; iCh++ ) + { + ( *handle )->handles[iCh] = malloc( encoder_size ); + if ( NULL == ( *handle )->handles[iCh] ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus encoder\n" ); + } + + err = lc3plus_enc_init( ( *handle )->handles[iCh], config.samplerate, 1, 0, lfeChans ); + if ( err != LC3PLUS_OK ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc_init failed\n" ); + } + + err = lc3plus_enc_set_frame_dms( ( *handle )->handles[iCh], config.lc3plus_frame_duration_us / 100 ); + if ( err != LC3PLUS_OK ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc_set_frame_dms failed\n" ); + } + + err = lc3plus_enc_set_bitrate( ( *handle )->handles[iCh], bitsPerSecondPerChannel ); + if ( err != LC3PLUS_OK ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc_set_bitrate failed\n" ); + } + } + + if ( config.ivas_frame_duration_us < config.lc3plus_frame_duration_us || config.ivas_frame_duration_us % config.lc3plus_frame_duration_us != 0 ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Current pcm_conversion_buffer sizing requires that lc3plus uses a shorter or equal frame duration than ivas\n" ); + } + ( *handle )->config = config; + ( *handle )->pcm_conversion_buffer = malloc( sizeof( int16_t ) * config.samplerate * config.lc3plus_frame_duration_us / 1000000 ); + if ( NULL == ( *handle )->pcm_conversion_buffer ) + { + IVAS_LC3PLUS_ENC_Close( handle ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus encoder wrapper pcm_conversion_buffer\n" ); + } + return IVAS_ERR_OK; +} + +ivas_error IVAS_LC3PLUS_ENC_GetDelay( + IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */ + int32_t *delayInSamples /* o: encoder delay in number of samples per channel */ +) +{ + int32_t tmpDelayInSamples; + + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Enc_Wrap_Handle is NULL\n" ); + } + if ( NULL == delayInSamples ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "delayInSamples is NULL\n" ); + } + + *delayInSamples = 0; + /* sanity check whether all encoders are actually configured identically */ + for ( uint32_t iEnc = 0; iEnc < handle->num_encs; iEnc++ ) + { + if ( NULL == handle->handles[iEnc] ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3plus encoder handle is NULL\n" ); + } + + tmpDelayInSamples = lc3plus_enc_get_delay( handle->handles[iEnc] ); + if ( 0 != *delayInSamples && tmpDelayInSamples != *delayInSamples ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "Not all mono LC3plus encoders are configured identically\n" ); + } + *delayInSamples = tmpDelayInSamples; + } + return IVAS_ERR_OK; +} + +ivas_error IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( + IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */ + int32_t *bsSize /* o: size of each bitstream frame in bytes */ +) +{ + int32_t bitstreamSizeMultiplier; + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Enc_Wrap_Handle is NULL\n" ); + } + if ( NULL == bsSize ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "bsSize is NULL\n" ); + } + + *bsSize = 0; + for ( uint32_t iEnc = 0; iEnc < handle->num_encs; iEnc++ ) + { + if ( NULL == handle->handles[iEnc] ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3plus encoder handle is NULL\n" ); + } + *bsSize += lc3plus_enc_get_num_bytes( handle->handles[iEnc] ); + } + + if ( handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) + { + return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "ivas_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" ); + } + bitstreamSizeMultiplier = handle->config.ivas_frame_duration_us / handle->config.lc3plus_frame_duration_us; + + *bsSize *= bitstreamSizeMultiplier; + return IVAS_ERR_OK; +} + +void IVAS_LC3PLUS_ENC_Close( + IVAS_LC3PLUS_ENC_HANDLE *handle /* i/o: pointer to encoder handle */ +) +{ + if ( NULL == handle || NULL == *handle ) + { + return; + } + for ( uint32_t iEnc = 0; iEnc < ( *handle )->num_encs; iEnc++ ) + { + if ( NULL != ( *handle )->handles[iEnc] ) + { + lc3plus_free_encoder_structs( ( *handle )->handles[iEnc] ); + free( ( *handle )->handles[iEnc] ); + } + } + if ( NULL != ( *handle )->pcm_conversion_buffer ) + { + free( ( *handle )->pcm_conversion_buffer ); + } + free( ( *handle )->handles ); + free( *handle ); + *handle = NULL; +} + +ivas_error IVAS_LC3PLUS_ENC_Encode( + IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */ + float **pcm_in, /* i: pointer input samples */ + void *bitstream_out /* o: pointer to bitstream frame */ +) +{ + uint32_t numSamplesPerLC3plusChannel; + uint32_t lc3framesPerIvasFrame; + int32_t ivasSampleIndex; + uint8_t *bitstream_out_iter = bitstream_out; + int32_t num_bytes = 0; + LC3PLUS_Error err; + + push_wmops( "IVAS_LC3PLUS_ENC_Encode" ); + + if ( NULL == handle ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Enc_Wrap_Handle is NULL\n" ); + } + if ( NULL == pcm_in ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pcm_in is NULL\n" ); + } + if ( NULL == bitstream_out ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "bitstream_out is NULL\n" ); + } + + if ( handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) + { + return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "ivas_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" ); + } + lc3framesPerIvasFrame = handle->config.ivas_frame_duration_us / handle->config.lc3plus_frame_duration_us; + + numSamplesPerLC3plusChannel = handle->config.samplerate / ( 1000000 / handle->config.ivas_frame_duration_us ) / lc3framesPerIvasFrame; + for ( uint32_t iEnc = 0; iEnc < handle->num_encs; iEnc++ ) + { + for ( uint32_t iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + for ( uint32_t iSampleInt16 = 0; iSampleInt16 < numSamplesPerLC3plusChannel; iSampleInt16++ ) + { + ivasSampleIndex = iSampleInt16 + iLc3plusFrame * numSamplesPerLC3plusChannel; + handle->pcm_conversion_buffer[iSampleInt16] = max( INT16_MIN, min( pcm_in[iEnc][ivasSampleIndex], INT16_MAX ) ); + } + + num_bytes = 0; + push_wmops( "lc3plus_enc16" ); + err = lc3plus_enc16( handle->handles[iEnc], &handle->pcm_conversion_buffer, bitstream_out_iter, &num_bytes, NULL ); + pop_wmops(); + if ( err != LC3PLUS_OK ) + { + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc16 failed\n" ); + } + if ( 0 == num_bytes ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_enc16 did not produce output\n" ); + } + + bitstream_out_iter += num_bytes; + } + } + + pop_wmops(); + + return IVAS_ERR_OK; +} diff --git a/lib_rend/ivas_lc3plus_enc.h b/lib_rend/ivas_lc3plus_enc.h new file mode 100644 index 0000000000..e1edd9016c --- /dev/null +++ b/lib_rend/ivas_lc3plus_enc.h @@ -0,0 +1,73 @@ +/****************************************************************************************************** + + (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#pragma once + +#include +#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "ivas_error.h" +#include "ivas_lc3plus_common.h" + +/* encoder wrapper */ +typedef struct IVAS_LC3PLUS_ENC_HANDLE +{ + LC3PLUS_CONFIG config; + LC3PLUS_Enc **handles; + uint32_t num_encs; + int16_t *pcm_conversion_buffer; +} * IVAS_LC3PLUS_ENC_HANDLE; + +ivas_error IVAS_LC3PLUS_ENC_Open( + const LC3PLUS_CONFIG config, /* i: encoder configuration */ + const uint32_t bitsPerSecond, /* i: bit rate */ + IVAS_LC3PLUS_ENC_HANDLE *handle /* o: encoder handle */ +); + +ivas_error IVAS_LC3PLUS_ENC_GetDelay( + IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */ + int32_t *delayInSamples /* o: algorithmic delay of encoding and decoding in number of samples per channel */ +); + +ivas_error IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( + IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */ + int32_t *bsSize /* o: size of each bitstream frame in bytes */ +); + +void IVAS_LC3PLUS_ENC_Close( + IVAS_LC3PLUS_ENC_HANDLE *handle /* i/o: pointer to encoder handle */ +); + +ivas_error IVAS_LC3PLUS_ENC_Encode( + IVAS_LC3PLUS_ENC_HANDLE handle, /* i: encoder handle */ + float **pcm_in, /* i: pointer input samples */ + void *bitstream_out /* o: pointer to bitstream frame */ +); diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 0618534448..8fb3497458 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -35,6 +35,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot_rend.h" +#ifdef SPLIT_REND_LC3PLUS +#include "ivas_prot.h" +#endif #include #include "ivas_rom_com.h" #ifdef DEBUGGING @@ -545,8 +548,17 @@ ivas_error ivas_td_binaural_open_ext( transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; +#ifdef TD_TDREND_FIX_NULLPTR_ACCESS + if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + { + hTransSetup.ls_azimuth = customLsInput->ls_azimuth; + hTransSetup.ls_elevation = customLsInput->ls_elevation; + } +#else hTransSetup.ls_azimuth = customLsInput->ls_azimuth; hTransSetup.ls_elevation = customLsInput->ls_elevation; +#endif /* TD_TDREND_FIX_NULLPTR_ACCESS */ + if ( NULL != hRendCfg ) { @@ -632,6 +644,131 @@ ivas_error ivas_td_binaural_renderer_ext( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_LC3PLUS +/*---------------------------------------------------------------------* + * ObjRenderIvasFrame_splitBinaural() + * + * Render to multiple binaural pairs based on relative head positions for split rendering. + *---------------------------------------------------------------------*/ +void ObjRenderIvasFrame_splitBinaural( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ +) +{ + int32_t i; + float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; + float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k]; + int16_t pos_idx; + IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + BINAURAL_TD_OBJECT_RENDERER_HANDLE tmpTdRendHandle; + + push_wmops( "ObjRenderIvasFrame_splitBinaural" ); + + pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; + + /* If not yet allocated, open additional instances of TD renderer */ + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( st_ivas->splitBinRend.splitrend.hTdRendHandles[i] != NULL ) + { + continue; + } + + ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, + st_ivas->hDecoderConfig->output_Fs, + st_ivas->nchan_transport, + st_ivas->ivas_format, + st_ivas->transport_config, + st_ivas->hRenderConfig->directivity, + st_ivas->hTransSetup, + &st_ivas->splitBinRend.splitrend.hTdRendHandles[i], + &st_ivas->binaural_latency_ns ); + } + + /* Save current head positions */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + originalHeadRot[i] = st_ivas->hHeadTrackData->Quaternions[i]; + } + + /* Copy input audio to a processing buffer. Cannot render in-place because binaurally rendered + * audio would overwrite original material, which is still needed for rendering next head pose. */ + for ( i = 0; i < MAX_NUM_OBJECTS; ++i ) + { + mvr2r( output[i], tmpProcessing[i], output_frame ); + } + + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + /* Update head positions */ + if ( pos_idx != 0 ) + { + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + if ( originalHeadRot[i].w == -3.0f ) + { + st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; + st_ivas->hHeadTrackData->Quaternions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; + st_ivas->hHeadTrackData->Quaternions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; + st_ivas->hHeadTrackData->Quaternions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; + } + else + { + st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; + Quat2EulerDegree( originalHeadRot[i], /* TODO tmu : fix bug with ordering*/ + &st_ivas->hHeadTrackData->Quaternions[i].z, + &st_ivas->hHeadTrackData->Quaternions[i].y, + &st_ivas->hHeadTrackData->Quaternions[i].x ); + st_ivas->hHeadTrackData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + st_ivas->hHeadTrackData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + st_ivas->hHeadTrackData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; + } + } + } + + /* Render */ + if ( pos_idx == 0 ) + { + ivas_td_binaural_renderer( st_ivas, tmpProcessing, output_frame ); + } + else + { + /* Tmp swap renderer handles for rendering call */ + tmpTdRendHandle = st_ivas->hBinRendererTd; + st_ivas->hBinRendererTd = st_ivas->splitBinRend.splitrend.hTdRendHandles[pos_idx - 1]; + ivas_td_binaural_renderer( st_ivas, tmpProcessing, output_frame ); + st_ivas->hBinRendererTd = tmpTdRendHandle; + } + + /* Copy rendered audio to tmp storage buffer. Copying directly to output would + * overwrite original audio, which is still needed for rendering next head pose. */ + mvr2r( tmpProcessing[0], tmpBinaural[2 * pos_idx], output_frame ); + mvr2r( tmpProcessing[1], tmpBinaural[2 * pos_idx + 1], output_frame ); + + /* Overwrite first 2 channels with original input audio again */ + mvr2r( output[0], tmpProcessing[0], output_frame ); + mvr2r( output[1], tmpProcessing[1], output_frame ); + } + + /* Copy from storage buffer to output */ + for ( i = 0; i < pMultiBinPoseData->num_poses * BINAURAL_CHANNELS; ++i ) + { + mvr2r( tmpBinaural[i], output[i], output_frame ); + } + + /* Restore original head rotation */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + st_ivas->hHeadTrackData->Quaternions[i] = originalHeadRot[i]; + } + + pop_wmops(); +} +#endif + + /*---------------------------------------------------------------------* * angles_to_vec() * diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index af3231df61..8d102714ae 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -182,6 +182,14 @@ static void sincResample( const float *p_sinc_forward; const float *p_sinc_backward; +#ifdef TD_REND_FIX_DIV_BY_ZERO + /* avoid division by 0 */ + if ( 0 == length_out ) + { + return; + } +#endif /* TD_REND_FIX_DIV_BY_ZERO */ + /* Compute fractional time step */ t_step = (float) ( length_in ) / (float) ( length_out ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 3bf05159d4..1d5aec07fa 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -211,6 +211,15 @@ void ivas_HRTF_CRend_binary_close( * TD object renderer *----------------------------------------------------------------------------------*/ +#ifdef SPLIT_REND_LC3PLUS +/* TODO(sgi): Rework interface */ +void ObjRenderIvasFrame_splitBinaural( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ +); +#endif + ivas_error ivas_td_binaural_renderer_unwrap( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ @@ -566,6 +575,11 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate ); int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out ); +#ifdef SPLIT_REND_LC3PLUS +int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); +int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ); +int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); +#endif void ivas_split_rend_get_quant_params( const int16_t num_md_bands, int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], @@ -1058,8 +1072,12 @@ ivas_error ivas_splitBinPreRendOpen( ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const int32_t output_Fs, - const int16_t is_cldfb_in ); + const int32_t output_Fs +#ifndef SPLIT_REND_LC3PLUS + ,const int16_t is_cldfb_in +#endif +); + void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); @@ -1068,16 +1086,28 @@ void ivas_renderSplitGetMultiBinPoseData( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const IVAS_SPLIT_REND_ROT_AXIS rot_axis); +#ifdef SPLIT_REND_LC3PLUS +void ivas_renderSplitUpdateNoCorrectionPoseData( + const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); +#endif + ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], const int32_t SplitRendBitRate, +#ifdef SPLIT_REND_LC3PLUS + const IVAS_SPLIT_REND_CODEC splitCodec, +#endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, +#ifdef SPLIT_REND_LC3PLUS + const int8_t td_input, +#endif const int16_t pcm_out ); diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index baaec129d6..8829a8b830 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -135,5 +135,10 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->split_rend_config.hq_mode = 0; ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; #endif +#ifdef SPLIT_REND_LC3PLUS + ( *hRenderConfig )->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + ( *hRenderConfig )->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; +#endif + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 80e7d5c23e..596dc8f918 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -887,7 +887,7 @@ static float SHrot_w( if ( m == 0 ) { - printf( "ERROR should not be called\n" ); + assert( 0 && "ERROR should not be called\n" ); return 0.0f; } else diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index eab5b7d1e3..641d642152 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -152,6 +152,8 @@ void ivas_splitBinLCLDDecProcess( #endif ) { + push_wmops( "ivas_splitBinLCLDDecProcess" ); + assert( hSplitBinLCLDDec != NULL ); assert( Cldfb_Out_Real != NULL ); assert( Cldfb_Out_Imag != NULL ); @@ -218,6 +220,8 @@ void ivas_splitBinLCLDDecProcess( ivas_splitBinRendPLCsaveState( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels ); #endif + pop_wmops(); + return; } #endif diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index d2f4ebf638..1904f895b3 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -141,13 +141,15 @@ void ivas_splitBinLCLDEncProcess( const int32_t available_bits, ivas_split_rend_bits_t *pBits ) { + int32_t iBitsWritten; + + push_wmops( "ivas_splitBinLCLDEncProcess" ); + assert( hSplitBinLCLDEnc != NULL ); assert( Cldfb_In_Real != NULL ); assert( Cldfb_In_Imag != NULL ); assert( pBits != NULL ); - int32_t iBitsWritten; - // A conversion is needed for the 3d pointer interface here ........ :( for ( int32_t n = 0; n < hSplitBinLCLDEnc->iChannels; n++ ) { @@ -214,6 +216,8 @@ void ivas_splitBinLCLDEncProcess( printf( "Bits written = %d\n", iBitsWritten ); #endif + pop_wmops(); + return; } #endif diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 3b22d644ce..78ad146699 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -55,8 +55,12 @@ ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const int32_t output_Fs, - const int16_t is_cldfb_in ) + const int32_t output_Fs +#ifndef SPLIT_REND_LC3PLUS + , + const int16_t is_cldfb_in +#endif +) { BIN_HR_SPLIT_POST_REND_HANDLE hBinRend; ivas_error error; @@ -90,13 +94,17 @@ ivas_error ivas_splitBinPostRendOpen( { return error; } +#ifndef SPLIT_REND_LC3PLUS if ( is_cldfb_in == 0 ) { +#endif if ( ( error = openCldfb( &( hBinRend->cldfbAna[ch] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } +#ifndef SPLIT_REND_LC3PLUS } +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1806,11 +1814,15 @@ void ivas_rend_CldfbSplitPostRendProcess( const int16_t is_cldfb_in ) { int16_t ch_idx, slot_idx, num_cldfb_bands; + + push_wmops( "ivas_rend_CldfbSplitPostRendProcess" ); + num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels; if ( is_cldfb_in == 0 ) { ivas_rend_CldfbSplitPostRendProcessTdIn( hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost, output ); + pop_wmops(); return; } @@ -1836,6 +1848,8 @@ void ivas_rend_CldfbSplitPostRendProcess( cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } + pop_wmops(); + return; } @@ -1843,6 +1857,9 @@ void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapp { hSplitRendWrapper->hBinHrSplitPostRend = NULL; hSplitRendWrapper->hSplitBinLCLDDec = NULL; +#ifdef SPLIT_REND_LC3PLUS + hSplitRendWrapper->hLc3plusDec = NULL; +#endif ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); #ifdef SPLIT_REND_PLC hSplitRendWrapper->first_good_frame_received = 0; diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index e6667c0d51..ba1ce4244c 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -46,6 +46,9 @@ #include "ivas_rom_binauralRenderer.h" #include "lib_rend.h" #include "ivas_prot_rend.h" +#ifdef SPLIT_REND_LC3PLUS +#include "ivas_lc3plus_enc.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -1304,7 +1307,7 @@ static void ivas_SplitRenderer_quant_code( void ivas_SplitRenderer_GetRotMd( - BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ @@ -1440,6 +1443,7 @@ void ivas_rend_CldfbSplitPreRendProcess( const int32_t target_md_bits, const int16_t low_res_pre_rend_rot ) { + push_wmops( "ivas_rend_CldfbSplitPreRendProcess" ); ivas_SplitRenderer_GetRotMd( hBinHrSplitPreRend, @@ -1456,6 +1460,8 @@ void ivas_rend_CldfbSplitPreRendProcess( low_res_pre_rend_rot, target_md_bits ); + pop_wmops(); + return; } @@ -1547,14 +1553,86 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ) { +#ifdef SPLIT_REND_LC3PLUS + int32_t i; +#endif + hSplitRendWrapper->hBinHrSplitPreRend = NULL; hSplitRendWrapper->hCldfbHandles = NULL; hSplitRendWrapper->hSplitBinLCLDEnc = NULL; +#ifdef SPLIT_REND_LC3PLUS + hSplitRendWrapper->hLc3plusEnc = NULL; + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + hSplitRendWrapper->hTdRendHandles[i] = NULL; + } + for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i ) + { + hSplitRendWrapper->lc3plusDelayBuffers[i] = NULL; + } + hSplitRendWrapper->lc3plusDelaySamples = 0; +#endif ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); return; } +#ifdef SPLIT_REND_LC3PLUS +static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, + const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + const int32_t OutSampleRate ) +{ + ivas_error error; + int32_t i, delayBufferLength; + LC3PLUS_CONFIG config; + + config.lc3plus_frame_duration_us = 5000; + config.ivas_frame_duration_us = 20000; + config.samplerate = OutSampleRate; + + config.channels = BINAURAL_CHANNELS; + + error = IVAS_LC3PLUS_ENC_Open( config, ivas_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode ), &hSplitRendWrapper->hLc3plusEnc ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + + /* This returns delay of entire LC3plus chain (enc + dec) */ + error = IVAS_LC3PLUS_ENC_GetDelay( hSplitRendWrapper->hLc3plusEnc, &hSplitRendWrapper->lc3plusDelaySamples ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + + /* Alocate buffers for delay compensation */ + if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) + { + delayBufferLength = OutSampleRate / FRAMES_PER_SECOND + hSplitRendWrapper->lc3plusDelaySamples; + for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i ) + { + hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ); + set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], delayBufferLength ); + } + } + else + { + /* Delay is always expected to be exactly 2 CLDFB columns */ + assert( hSplitRendWrapper->lc3plusDelaySamples % ( OutSampleRate / FRAMES_PER_SEC / CLDFB_NO_COL_MAX ) == 0 ); + assert( hSplitRendWrapper->lc3plusDelaySamples / ( OutSampleRate / FRAMES_PER_SEC / CLDFB_NO_COL_MAX ) == 2 ); + + delayBufferLength = 2 /* Columns */ * 2 /* real and imag */ * CLDFB_NO_CHANNELS_MAX; + for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i ) + { + hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ); + set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], delayBufferLength ); + } + } + + return IVAS_ERR_OK; +} +#endif + ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, @@ -1562,10 +1640,35 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const int16_t is_pcm_out ) { ivas_error error, ch, num_ch; +#ifdef SPLIT_REND_LC3PLUS + CLDFB_TYPE cldfbMode; + uint8_t useLc3plus; + uint8_t isCldfbNeeded = 0; + + useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ +#endif error = IVAS_ERR_OK; - hSplitRendWrapper->hCldfbHandles = NULL; +#ifdef SPLIT_REND_LC3PLUS if ( is_cldfb_in == 0 ) + { + isCldfbNeeded = 1; + cldfbMode = CLDFB_ANALYSIS; + } + else if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && is_cldfb_in ) + { + isCldfbNeeded = 1; + cldfbMode = CLDFB_SYNTHESIS; + } +#endif + + hSplitRendWrapper->hCldfbHandles = NULL; + if ( +#ifdef SPLIT_REND_LC3PLUS + isCldfbNeeded ) +#else + is_cldfb_in == 0 ) +#endif { if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) { @@ -1584,10 +1687,22 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, num_ch = ( 1 + hSplitRendWrapper->multiBinPoseData.num_poses ) * BINAURAL_CHANNELS; #else num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; +#endif +#ifdef SPLIT_REND_LC3PLUS + if ( cldfbMode == CLDFB_SYNTHESIS ) + { + num_ch = BINAURAL_CHANNELS; + } #endif for ( ch = 0; ch < num_ch; ch++ ) { - if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), +#ifdef SPLIT_REND_LC3PLUS + cldfbMode, +#else + CLDFB_ANALYSIS, +#endif + OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } @@ -1607,17 +1722,34 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, } if ( is_pcm_out == 0 ) { - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate ) ); - if ( error != IVAS_ERR_OK ) +#ifdef SPLIT_REND_LC3PLUS + if ( !useLc3plus ) + { +#endif + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate ) ); + if ( error != IVAS_ERR_OK ) + { + return error; + } +#ifdef SPLIT_REND_LC3PLUS + } + else { - return error; + error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate ); + if ( error != IVAS_ERR_OK ) + { + return error; + } } +#endif } return error; } void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) { + int32_t i; + if ( hSplitBinRend->hBinHrSplitPreRend != NULL ) { ivas_splitBinPreRendClose( &hSplitBinRend->hBinHrSplitPreRend ); @@ -1646,9 +1778,78 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) free( hSplitBinRend->hCldfbHandles ); hSplitBinRend->hCldfbHandles = NULL; } + +#ifdef SPLIT_REND_LC3PLUS + if ( hSplitBinRend->hLc3plusEnc != NULL ) + { + IVAS_LC3PLUS_ENC_Close( &hSplitBinRend->hLc3plusEnc ); + } + + for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i ) + { + if ( hSplitBinRend->lc3plusDelayBuffers[i] != NULL ) + { + free( hSplitBinRend->lc3plusDelayBuffers[i] ); + hSplitBinRend->lc3plusDelayBuffers[i] = NULL; + } + } + + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( hSplitBinRend->hTdRendHandles[i] != NULL ) + { + hSplitBinRend->hTdRendHandles[i]->HrFiltSet_p = NULL; + ivas_td_binaural_close( &hSplitBinRend->hTdRendHandles[i] ); + } + } +#endif + return; } +#ifdef SPLIT_REND_LC3PLUS +static ivas_error splitRendLc3plusEncodeAndWrite( + SPLIT_REND_WRAPPER *hSplitBin, + ivas_split_rend_bits_t *pBits, + const int32_t SplitRendBitRate, + float in[][L_FRAME48k] ) +{ + ivas_error error; + int16_t i; + + int32_t lc3plusBitstreamSize; + float *channel_ptrs[MAX_HEAD_ROT_POSES * 2]; + assert( hSplitBin->hLc3plusEnc != NULL ); + + /* Find next byte boundary and zero-pad to it */ + while ( pBits->bits_written % 8 != 0 ) + { + ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 ); + } + + for ( i = 0; i < BINAURAL_CHANNELS * hSplitBin->multiBinPoseData.num_poses; ++i ) + { + channel_ptrs[i] = in[i]; + } + if ( ( error = IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( hSplitBin->hLc3plusEnc, &lc3plusBitstreamSize ) ) != IVAS_ERR_OK ) + { + return error; + } + /* Write bitstream size info */ + ivas_split_rend_bitstream_write_int32( pBits, ivas_get_lc3plus_bitrate_id( SplitRendBitRate ), 8 ); + + /* Write bitstream */ + if ( ( error = IVAS_LC3PLUS_ENC_Encode( hSplitBin->hLc3plusEnc, channel_ptrs, &pBits->bits_buf[pBits->bits_written / 8] ) ) != IVAS_ERR_OK ) + { + return error; + } + pBits->bits_written += 8 * lc3plusBitstreamSize; + pBits->codec = IVAS_SPLIT_REND_CODEC_LC3PLUS; + pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; + return IVAS_ERR_OK; +} +#endif + static ivas_error ivas_renderMultiTDBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], @@ -1669,12 +1870,45 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; #endif +#ifdef SPLIT_REND_LC3PLUS + uint8_t useLc3plus; + float *in_delayed[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; + int32_t i; +#endif + + push_wmops( "ivas_renderMultiTDBinToSplitBinaural" ); error = IVAS_ERR_OK; +#ifndef SPLIT_REND_LC3PLUS assert( hSplitBin->hCldfbHandles != NULL ); num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; +#endif num_poses = hSplitBin->multiBinPoseData.num_poses; +#ifdef SPLIT_REND_LC3PLUS + useLc3plus = hSplitBin->hLc3plusEnc != NULL; + + if ( useLc3plus ) + { + int32_t frame_size = hSplitBin->hLc3plusEnc->config.samplerate / FRAMES_PER_SECOND; + + for ( i = 0; i < num_poses * BINAURAL_CHANNELS; ++i ) + { + /* Artificially delay input to head pose correction analysis by LC3plus coding delay, so that audio and metadata are in sync after decoding */ + mvr2r( hSplitBin->lc3plusDelayBuffers[i] + frame_size, hSplitBin->lc3plusDelayBuffers[i], hSplitBin->lc3plusDelaySamples ); + in_delayed[i] = hSplitBin->lc3plusDelayBuffers[i]; + mvr2r( in[i], hSplitBin->lc3plusDelayBuffers[i] + hSplitBin->lc3plusDelaySamples, frame_size ); + } + } + else + { + for ( i = 0; i < num_poses * BINAURAL_CHANNELS; ++i ) + { + in_delayed[i] = in[i]; + } + } +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { @@ -1695,51 +1929,80 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( } #endif +#ifdef SPLIT_REND_LC3PLUS + if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; - /* CLDFB Analysis*/ +#endif + /* CLDFB Analysis*/ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < num_poses + 1; pos_idx++ ) + for ( pos_idx = 0; pos_idx < num_poses + 1; pos_idx++ ) #else for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) #endif - { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { +#ifdef SPLIT_REND_LC3PLUS + cldfbAnalysis_ts( &( in_delayed[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), +#else cldfbAnalysis_ts( &( in[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), - Cldfb_In_BinReal[pos_idx][ch][slot_idx], - Cldfb_In_BinImag[pos_idx][ch][slot_idx], - max_bands, - hSplitBin->hCldfbHandles->cldfbAna[pos_idx * BINAURAL_CHANNELS + ch] ); +#endif + Cldfb_In_BinReal[pos_idx][ch][slot_idx], + Cldfb_In_BinImag[pos_idx][ch][slot_idx], + max_bands, + hSplitBin->hCldfbHandles->cldfbAna[pos_idx * BINAURAL_CHANNELS + ch] ); + } } } - } - target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; - actual_md_bits = pBits->bits_written; - ivas_rend_CldfbSplitPreRendProcess( - hSplitBin->hBinHrSplitPreRend, - headPositions, - &hSplitBin->multiBinPoseData, - Cldfb_In_BinReal, - Cldfb_In_BinImag, - pBits, - target_md_bits, - low_res_pre_rend_rot ); + target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written; + ivas_rend_CldfbSplitPreRendProcess( + hSplitBin->hBinHrSplitPreRend, + headPositions, + &hSplitBin->multiBinPoseData, + Cldfb_In_BinReal, + Cldfb_In_BinImag, + pBits, + target_md_bits, + low_res_pre_rend_rot ); + } if ( pcm_out == 0 ) { - // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; - available_bits = SplitRendBitRate * L_FRAME48k / 48000; - actual_md_bits = pBits->bits_written - actual_md_bits; - available_bits -= actual_md_bits; - ivas_splitBinLCLDEncProcess( - hSplitBin->hSplitBinLCLDEnc, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0], - available_bits, - pBits ); +#ifdef SPLIT_REND_LC3PLUS + pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; + pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; /* TODO(sgi): useLc3plus could be changed to splitCodec */ +#endif + +#ifdef SPLIT_REND_LC3PLUS + if ( !useLc3plus ) + { +#endif + // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; + available_bits = SplitRendBitRate * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written - actual_md_bits; + available_bits -= actual_md_bits; + ivas_splitBinLCLDEncProcess( + hSplitBin->hSplitBinLCLDEnc, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0], + available_bits, + pBits ); +#ifdef SPLIT_REND_LC3PLUS + } + else + { + if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, in ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } /*zero pad*/ @@ -1748,60 +2011,179 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( { ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 ); } + + pop_wmops(); + return error; } +#ifdef SPLIT_REND_LC3PLUS +static void lc3plusTimeAlignCldfbPoseCorr( + SPLIT_REND_WRAPPER *hSplitBin, + float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) +{ + float Cldfb_In_BinReal_tmp[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][2][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_In_BinImag_tmp[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][2][CLDFB_NO_CHANNELS_MAX]; + int16_t pose, ch, slot_idx; + float *bufRead, *bufWrite; + + for ( pose = 0; pose < hSplitBin->multiBinPoseData.num_poses; ++pose ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ++ch ) + { + bufRead = hSplitBin->lc3plusDelayBuffers[pose * BINAURAL_CHANNELS + ch]; + bufWrite = bufRead; + + /* Save last 2 columns for next frame */ + for ( slot_idx = 0; slot_idx < 2; ++slot_idx ) + { + mvr2r( Cldfb_In_BinReal[pose][ch][CLDFB_NO_COL_MAX - 2 + slot_idx], Cldfb_In_BinReal_tmp[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + mvr2r( Cldfb_In_BinImag[pose][ch][CLDFB_NO_COL_MAX - 2 + slot_idx], Cldfb_In_BinImag_tmp[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + } + + /* Delay existing columns by 2 slots */ + for ( slot_idx = CLDFB_NO_COL_MAX - 2 - 1; slot_idx >= 0; --slot_idx ) + { + mvr2r( Cldfb_In_BinReal[pose][ch][slot_idx], Cldfb_In_BinReal[pose][ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); + mvr2r( Cldfb_In_BinImag[pose][ch][slot_idx], Cldfb_In_BinImag[pose][ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); + } + + /* Fill 2 first columns from buffer */ + for ( slot_idx = 0; slot_idx < 2; ++slot_idx ) + { + mvr2r( bufRead, Cldfb_In_BinReal[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + bufRead += CLDFB_NO_CHANNELS_MAX; + mvr2r( bufRead, Cldfb_In_BinImag[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + bufRead += CLDFB_NO_CHANNELS_MAX; + } + + /* Copy last 2 columns to buffer */ + for ( slot_idx = 0; slot_idx < 2; ++slot_idx ) + { + mvr2r( Cldfb_In_BinReal_tmp[pose][ch][slot_idx], bufWrite, CLDFB_NO_CHANNELS_MAX ); + bufWrite += CLDFB_NO_CHANNELS_MAX; + mvr2r( Cldfb_In_BinImag_tmp[pose][ch][slot_idx], bufWrite, CLDFB_NO_CHANNELS_MAX ); + bufWrite += CLDFB_NO_CHANNELS_MAX; + } + } + } +} +#endif + ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], const int32_t SplitRendBitRate, +#ifdef SPLIT_REND_LC3PLUS + const IVAS_SPLIT_REND_CODEC splitCodec, +#endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, +#ifdef SPLIT_REND_LC3PLUS + const int8_t td_input, +#endif const int16_t pcm_out ) { ivas_error error; int32_t bit_len, target_md_bits, actual_md_bits, available_bits; error = IVAS_ERR_OK; + push_wmops( "ivas_renderMultiBinToSplitBinaural" ); + set_fix_rotation_mat( hSplitBin->hBinHrSplitPreRend->fix_pos_rot_mat, &hSplitBin->multiBinPoseData ); set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); - if ( hSplitBin->hCldfbHandles != NULL ) + if ( +#ifdef SPLIT_REND_LC3PLUS + td_input +#else + hSplitBin->hCldfbHandles != NULL +#endif + ) { /*TD input*/ /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPositions, SplitRendBitRate, pBits, max_bands, out, low_res_pre_rend_rot, pcm_out ); + pop_wmops(); return error; } - target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; - actual_md_bits = pBits->bits_written; - ivas_rend_CldfbSplitPreRendProcess( - hSplitBin->hBinHrSplitPreRend, - headPositions, - &hSplitBin->multiBinPoseData, - Cldfb_In_BinReal, - Cldfb_In_BinImag, - pBits, - target_md_bits, - low_res_pre_rend_rot ); + +#ifdef SPLIT_REND_LC3PLUS + if ( splitCodec == IVAS_SPLIT_REND_CODEC_LC3PLUS && hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + /* Time-align pose correction to delay of LC3plus */ + lc3plusTimeAlignCldfbPoseCorr( hSplitBin, Cldfb_In_BinReal, Cldfb_In_BinImag ); + } + + if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { +#endif + target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written; + ivas_rend_CldfbSplitPreRendProcess( + hSplitBin->hBinHrSplitPreRend, + headPositions, + &hSplitBin->multiBinPoseData, + Cldfb_In_BinReal, + Cldfb_In_BinImag, + pBits, + target_md_bits, + low_res_pre_rend_rot ); +#ifdef SPLIT_REND_LC3PLUS + } +#endif if ( pcm_out == 0 ) { - // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; - available_bits = SplitRendBitRate * L_FRAME48k / 48000; - actual_md_bits = pBits->bits_written - actual_md_bits; - available_bits -= actual_md_bits; - ivas_splitBinLCLDEncProcess( - hSplitBin->hSplitBinLCLDEnc, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0], - available_bits, - pBits ); +#ifdef SPLIT_REND_LC3PLUS + pBits->codec = splitCodec; + pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; + + if ( splitCodec == IVAS_SPLIT_REND_CODEC_LCLD ) + { +#endif + // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; + available_bits = SplitRendBitRate * L_FRAME48k / 48000; + actual_md_bits = pBits->bits_written - actual_md_bits; + available_bits -= actual_md_bits; + ivas_splitBinLCLDEncProcess( + hSplitBin->hSplitBinLCLDEnc, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0], + available_bits, + pBits ); + +#ifdef SPLIT_REND_LC3PLUS + } + else + { + int16_t ch, slot_idx; + /* CLDFB synthesis of main pose */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float *Cldfb_In_BinReal_p[CLDFB_NO_COL_MAX]; + float *Cldfb_In_BinImag_p[CLDFB_NO_COL_MAX]; + + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[0][ch][slot_idx]; + Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[0][ch][slot_idx]; + } + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], -1, hSplitBin->hCldfbHandles->cldfbAna[ch] ); + } + + if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, out ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } /*zero pad*/ @@ -1812,6 +2194,9 @@ ivas_error ivas_renderMultiBinToSplitBinaural( { ivas_split_rend_bitstream_write_int32( pBits, (int32_t) 0, 1 ); } + + pop_wmops(); + return error; } #endif diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 8725921b52..b84c37dbb5 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -396,6 +396,13 @@ int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, con md_bitrate = 128000; break; } +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + case -1: + { + md_bitrate = 256000; + break; + } +#endif default: { return -1; @@ -422,11 +429,116 @@ int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate ) return IVAS_256k; } default: + { + break; + } + } + return -1; +} + +#ifdef SPLIT_REND_LC3PLUS +int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ) +{ +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + if ( SplitRendBitRate == -1 ) + { + return -1; + } +#endif + + if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + int32_t inBandMdBps = 8 * FRAMES_PER_SECOND; + return ivas_get_lcld_bitrate( SplitRendBitRate ) - inBandMdBps; + } + if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + return SplitRendBitRate; + } + + /* Should not be reached */ + assert( 0 ); + return -1; +} + +int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ) +{ +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + if ( SplitRendBitRate == -1 ) + { + return 3; + } +#endif + switch ( SplitRendBitRate ) + { + case SPLIT_REND_768k: + { + return 3; + } + case SPLIT_REND_512k: + { + return 2; + } + case SPLIT_REND_384k: + { + return 1; + } + case SPLIT_REND_320k: + { + return 0; + } + default: + { + break; + } + } + return -1; +} +int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ) +{ + int32_t bitrate; + +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + if ( SplitRendBitRateId == 3 ) + { + return -1; + } +#endif + + switch ( SplitRendBitRateId ) + { + case 3: + { + bitrate = SPLIT_REND_768k; + break; + } + case 2: + { + bitrate = SPLIT_REND_512k; + break; + } + case 1: + { + bitrate = SPLIT_REND_384k; + break; + } + case 0: + { + bitrate = SPLIT_REND_320k; + break; + } + default: { return -1; } } + + bitrate = ivas_get_lc3plus_bitrate( bitrate, poseCorrectionMode ); + + /* Return size in bytes */ + return bitrate / FRAMES_PER_SECOND / 8; } +#endif void ivas_split_rend_get_quant_params( const int16_t num_md_bands, @@ -599,10 +711,26 @@ void ivas_renderSplitGetMultiBinPoseData( pMultiBinPoseData->dof = pSplit_rend_config->dof; pMultiBinPoseData->hq_mode = pSplit_rend_config->hq_mode; pMultiBinPoseData->rot_axis = rot_axis; +#ifdef SPLIT_REND_LC3PLUS + pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode; +#endif return; } +#ifdef SPLIT_REND_LC3PLUS +void ivas_renderSplitUpdateNoCorrectionPoseData( + const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) +{ + pMultiBinPoseData->num_poses = 1; + assert( pSplit_rend_config->dof == 0 ); + pMultiBinPoseData->dof = pSplit_rend_config->dof; + assert( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ); + pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode; +} +#endif + void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) { int16_t pos_idx; @@ -617,6 +745,7 @@ void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData pMultiBinPoseData->dof = 3; pMultiBinPoseData->hq_mode = 0; pMultiBinPoseData->rot_axis = DEFAULT_AXIS; + return; } #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 114021cd3c..65f12e16de 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -43,6 +43,10 @@ #include "ivas_CQMFEncoder.h" #include "ivas_CQMFDecoder.h" #endif +#ifdef SPLIT_REND_LC3PLUS +#include "ivas_lc3plus_enc.h" +#include "ivas_lc3plus_dec.h" +#endif /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) @@ -295,6 +299,7 @@ typedef struct #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HANDLE_CLDFB_FILTER_BANK cldfbAna[( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS]; #else + /* TODO(sgi): rename to "cldfb" during harmonization - these handles are sometimes also used for synthesis */ HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; #endif } CLDFB_HANDLES_WRAPPER, *CLDFB_HANDLES_WRAPPER_HANDLE; @@ -307,15 +312,32 @@ typedef struct int16_t dof; int16_t hq_mode; IVAS_SPLIT_REND_ROT_AXIS rot_axis; +#ifdef SPLIT_REND_LC3PLUS + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; +#endif } MULTI_BIN_REND_POSE_DATA; #endif +#ifdef SPLIT_REND_LC3PLUS +/* Forward declaration of TD_OBJECT_RENDERER_HANDLE. + This avoids shifting the entire definition of TD Renderer structs above + this line, which could cause merge conflicts. + Can be cleaned up later. */ +typedef struct ivas_binaural_td_rendering_struct *TD_OBJECT_RENDERER_HANDLE; +#endif + typedef struct { MULTI_BIN_REND_POSE_DATA multiBinPoseData; BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend; BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc; CLDFB_HANDLES_WRAPPER_HANDLE hCldfbHandles; +#ifdef SPLIT_REND_LC3PLUS + IVAS_LC3PLUS_ENC_HANDLE hLc3plusEnc; + TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1]; + float *lc3plusDelayBuffers[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /* Used to time-align head pose correction metadata with LC3plus-coded reference audio */ + int32_t lc3plusDelaySamples; +#endif } SPLIT_REND_WRAPPER; typedef struct @@ -326,6 +348,9 @@ typedef struct #ifdef SPLIT_REND_PLC int16_t first_good_frame_received; #endif +#ifdef SPLIT_REND_LC3PLUS + IVAS_LC3PLUS_DEC_HANDLE hLc3plusDec; +#endif } SPLIT_POST_REND_WRAPPER; #endif diff --git a/lib_rend/lc3plus_codec/.gitignore b/lib_rend/lc3plus_codec/.gitignore new file mode 100644 index 0000000000..5514f3a7bc --- /dev/null +++ b/lib_rend/lc3plus_codec/.gitignore @@ -0,0 +1,3 @@ +ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228 +package.info +lc3plus_sources.zip \ No newline at end of file diff --git a/lib_rend/lc3plus_codec/README.md b/lib_rend/lc3plus_codec/README.md new file mode 100644 index 0000000000..4dc05171ab --- /dev/null +++ b/lib_rend/lc3plus_codec/README.md @@ -0,0 +1,6 @@ +# Download and unzip LC3plus + +1. Download the V1.4.1 version of the LC3plus source code from ETSI: https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip +2. Unzip it into this folder. After unzipping, the path to the `Readme.txt` of the LC3plus sources must be: `lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/Readme.txt` +3. Apply the `lc3plus.patch`, for example by using the command `git apply --ignore-whitespace lc3plus.patch` +4. Remove files `ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c` `ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c` diff --git a/lib_rend/lc3plus_codec/get_lc3plus.sh b/lib_rend/lc3plus_codec/get_lc3plus.sh new file mode 100755 index 0000000000..ab578850cc --- /dev/null +++ b/lib_rend/lc3plus_codec/get_lc3plus.sh @@ -0,0 +1,7 @@ +# This script shall only be used by automated continuous integration systems +# Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md +curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip +unzip lc3plus_sources.zip -d . +rm -f lc3plus_sources.zip +git apply --ignore-whitespace lc3plus.patch +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c diff --git a/lib_rend/lc3plus_codec/lc3plus.patch b/lib_rend/lc3plus_codec/lc3plus.patch new file mode 100644 index 0000000000..8ebffc6289 --- /dev/null +++ b/lib_rend/lc3plus_codec/lc3plus.patch @@ -0,0 +1,1571 @@ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "stdint.h" + #include + #include +@@ -1010,8 +1011,8 @@ + LC3_UINT8 blacklist[FEC_N_MODES]; + LC3_INT32 rop; + +- rop = 0; + void (*syndr_calc[3])(LC3_UINT8 *, LC3_UINT8 *, LC3_INT32); ++ rop = 0; + + /* initialization */ + blacklist[0] = 0; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void ac_shift_fl(Encoder_State_fl* st); +@@ -620,7 +621,7 @@ + + if (st.pc_c_bp_side != 0) + { +- nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOG2(mask_side)); ++ nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side)); + } + } + +@@ -891,7 +892,7 @@ + { + LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0; + +- bits = 24 - floor(LC3_LOG2(st->range)); ++ bits = 24 - floor(LC3_LOGTWO(st->range)); + mask = ((LC3_INT)pow(2, 24) - 1) >> bits; + val = st->low + mask; + over1 = val >> 24; +@@ -1078,8 +1079,8 @@ + } + + /* Residual bits */ +- nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOG2(*(st.mask_side))); +- nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOG2(st.range)); ++ nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOGTWO(*(st.mask_side))); ++ nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOGTWO(st.range)); + + if (st.cache >= 0) { + nbits_ari = nbits_ari + 8; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + /* DCT */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void dct2_init(Dct2* dct, int length) +@@ -27,11 +28,11 @@ + + void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output) + { +- assert(input != output); + Complex tmp1[MAX_LEN]; + Complex tmp2[MAX_LEN]; + int i = 0; + const int len = dct->length; ++ assert(input != output); + + for (i = 0; i < len / 2; i++) { + tmp1[i] = cmplx(input[i * 2], 0); +@@ -49,8 +50,8 @@ + + void dct4_init(Dct4* dct, int length) + { +- assert(length <= MAX_LEN); + int i = 0; ++ assert(length <= MAX_LEN); + dct->length = length; + dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); + dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); +@@ -73,12 +74,12 @@ + + void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output) + { +- assert(input != output); + Complex tmp2[MAX_LEN / 2]; + int i = 0; + Complex* tmp1 = (Complex*)output; + const int len = dct->length; + const LC3_FLOAT norm = (LC3_FLOAT)1.0 / LC3_SQRT((LC3_FLOAT)(len >> 1)); ++ assert(input != output); + + for (i = 0; i < len / 2; i++) { + tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); +@@ -53,7 +54,7 @@ + LC3_INT nbbytes = nbbits >> 3; + LC3_INT lastnz; + LC3_INT bw_cutoff_idx; +- LC3_INT nbits = ceil(LC3_LOG2(L_spec / 2)); ++ LC3_INT nbits = ceil(LC3_LOGTWO(L_spec / 2)); + + if (nbits > nbbits) + { +@@ -173,7 +174,7 @@ + } + + /* Last non-zero tuple */ +- read_uint_fl(ceil(LC3_LOG2(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz); ++ read_uint_fl(ceil(LC3_LOGTWO(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz); + *lastnz = (*lastnz + 1) * 2; + + if (*lastnz > N) { +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +@@ -53,8 +54,8 @@ + + if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1) + { +- bfi = 2; + LC3_INT32 max_bw_stopband = BW_cutoff_bin_all[bw_cutoff_idx]; ++ bfi = 2; + switch (decoder->frame_dms) + { + # ifdef ENABLE_025_DMS_MODE +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-05-26 10:23:38 +@@ -24,13 +24,13 @@ + typedef uint32_t LC3_UINT32; + + /* Release defines */ +-#define ENABLE_2_5MS_MODE ++// #define ENABLE_2_5MS_MODE + #define ENABLE_5MS_MODE + #define ENABLE_10_MS_MODE + #define ENABLE_ADVANCED_PLC_FL + #define ENABLE_ADVANCED_PLC_FL_DEFAULT + #define ENABLE_BW_CONTROLLER +-#define ENABLE_HR_MODE_FL ++//#define ENABLE_HR_MODE_FL + #define ENABLE_PADDING + #define ENABLE_RFRAME_FL + #define ENABLE_PLC +@@ -49,8 +49,8 @@ + /* Precision Defines */ + #define LC3_FABS(x) (fabsf(x)) + #define LC3_POW(x, y) (powf(x, y)) +-#define LC3_LOG10(x) (log10f(x)) +-#define LC3_LOG2(x) (log2f(x)) ++#define LC3_LOGTEN(x) (log10f(x)) ++#define LC3_LOGTWO(x) (log2f(x)) + # define LC3_COS(x) (cos(x)) + # define LC3_SIN(x) (sin(x)) + #define LC3_SQRT(x) (sqrtf(x)) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) +@@ -68,7 +69,7 @@ + dist = bw_dist[counter]; + + for (i = stop; i >= stop - dist; i--) { +- e_diff = 10.0 * LC3_LOG10(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOG10(d2[i + 1] + FLT_EPSILON); ++ e_diff = 10.0 * LC3_LOGTEN(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOGTEN(d2[i + 1] + FLT_EPSILON); + + if (e_diff > thr) { + brickwall = 1; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, +@@ -33,11 +34,11 @@ + + /* Last non zero touple */ + if (bfi_ext == 1) { +- write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOG2(N >> 1))); ++ write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOGTWO(N >> 1))); + } + else + { +- write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOG2(N / 2))); ++ write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOGTWO(N / 2))); + } + + /* LSB mode bit */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +@@ -60,8 +61,8 @@ + } else { + g_min = x_max / (32767 - 0.375); + } +- /* Prevent positive rounding errors from LC3_LOG10 function */ +- ind_min = 28.0 * LC3_LOG10(g_min); ++ /* Prevent positive rounding errors from LC3_LOGTEN function */ ++ ind_min = 28.0 * LC3_LOGTEN(g_min); + + ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS); + +@@ -76,7 +77,7 @@ + tmp += x[i + 1] * x[i + 1]; + tmp += x[i + 2] * x[i + 2]; + tmp += x[i + 3] * x[i + 3]; +- en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOG10(tmp + reg_val)); ++ en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOGTEN(tmp + reg_val)); + j++; + } + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-05-26 10:24:14 +@@ -8,7 +8,7 @@ + ******************************************************************************/ + + +- ++#include "options.h" + #include "cfft.h" + #include "iisfft.h" /* for M_PIl */ + #include /* for abs() */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-05-26 10:24:14 +@@ -8,14 +8,15 @@ + ******************************************************************************/ + + ++#include "options.h" + #include + #include +-#include "iis_fft.h" + #include + #include + #include +-#include "../structs.h" ++#include + ++#include "iis_fft.h" + /**************************************************************************************************/ + + /* AFFT uses two fft implementations +@@ -24,9 +25,6 @@ + fast lengths, check the fft_n function. + */ + +-#include +-#include "cfft.h" +-#include "iisfft.h" + + #define FFT_COMPLEX 1 + #define FFT_REAL 2 +@@ -122,12 +120,13 @@ + + IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output) + { ++ LC3_FLOAT* dummy; + if (!handle) + return IIS_FFT_INTERNAL_ERROR; + + /* check for inplace operation */ + memmove(output, input, sizeof(*input) * handle->len); +- LC3_FLOAT* dummy = (LC3_FLOAT*)output; ++ dummy = (LC3_FLOAT*)output; + if (handle->cfft.len > 0) { + LC3_cfft_apply(&handle->cfft, dummy, dummy + 1, 2); + } else { +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-05-26 10:23:38 +@@ -12,6 +12,7 @@ + #define IIS_FFT_H + + #include "../structs.h" ++#include "../defines.h" + #include "cfft.h" + + #ifdef __cplusplus +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + + #include + #include /* for mmove */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-05-26 10:23:38 +@@ -11,6 +11,7 @@ + #ifndef IISFFT_H + #define IISFFT_H + ++#include "../defines.h" + + #ifndef M_PIl + #define M_PIl 3.1415926535897932384626433832795029L /* pi */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c 1970-01-01 01:00:00 +@@ -1,99 +0,0 @@ +-/****************************************************************************** +-* ETSI TS 103 634 V1.4.1 * +-* Low Complexity Communication Codec Plus (LC3plus) * +-* * +-* Copyright licence is solely granted through ETSI Intellectual Property * +-* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +-* estoppel or otherwise. * +-******************************************************************************/ +- +- +-#include "functions.h" +-#include "fft/iis_fft.c" +-#include "fft/iisfft.c" +-#include "fft/cfft.c" +- +-void fft_init(Fft* fft, int length) +-{ +- assert(length % 2 == 0); +- HANDLE_IIS_FFT handle = NULL; +- IIS_FFT_ERROR error = 0; +- +- fft->length = length; +- +- error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); +- +- assert(error == IIS_FFT_NO_ERROR); +- fft->handle = handle; +-} +- +-void fft_free(Fft* fft) +-{ +- IIS_FFT_ERROR error = 0; +- +- if (fft) { +- error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); +- +- assert(error == IIS_FFT_NO_ERROR); +- memset(fft, 0, sizeof(*fft)); +- } +-} +- +-void real_fft_free(Fft* fft) +-{ +- IIS_FFT_ERROR error = 0; +- +- if (fft) { +- error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); +- +- assert(error == IIS_FFT_NO_ERROR); +- memset(fft, 0, sizeof(*fft)); +- } +-} +- +-void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) +-{ +- assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ +- IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; +- +- fft->length = length; +- +- error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); +- assert(error == IIS_FFT_NO_ERROR); +- fft->handle = *handle; +-} +- +- +-void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) +-{ +- assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ +- IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; +- +- fft->length = length; +- +- error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); +- +- assert(error == IIS_FFT_NO_ERROR); +- fft->handle = *handle; +-} +- +-void fft_apply(Fft* fft, const Complex* input, Complex* output) +-{ +- IIS_FFT_ERROR error = 0; +- error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); +- +- assert(error == IIS_FFT_NO_ERROR); +-} +- +- +-void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) +-{ +- IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; +- +- UNUSED(error); +- +- error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); +- +- assert(error == IIS_FFT_NO_ERROR); +-} +- +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + /* Function expects already flipped window */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "lc3.h" + #include "defines.h" + #include "functions.h" +@@ -48,8 +49,9 @@ + case 44100: return 1; + case 48000: return 1; + case 96000: return 1; +- default: return 0; ++ default: break; + } ++ return 0; + } + + static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) +@@ -58,8 +60,9 @@ + { + case LC3PLUS_PLC_ADVANCED: /* fallthru */ + return 1; +- default: return 0; ++ default: break; + } ++ return 0; + } + + static int lc3plus_frame_size_supported(float frame_ms) +@@ -69,8 +72,9 @@ + case 25: /* fallthru */ + case 50: /* fallthru */ + case 100: return 1; +- default: return 0; ++ default: break; + } ++ return 0; + } + + static int null_in_list(void **list, int n) +@@ -97,13 +101,14 @@ + /* encoder functions *********************************************************/ + LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]) + { ++ int ch = 0; ++ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((uintptr_t)encoder % 4 != 0, LC3PLUS_ALIGN_ERROR); + RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR); + RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); + RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); + +- int ch = 0; + for (ch = 0; ch < channels; ch++) + { + RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); +@@ -142,6 +147,7 @@ + int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder) + { + int ch = 0, totalBytes = 0; ++ int bitrate; + RETURN_IF(encoder == NULL, 0); + RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR); + +@@ -150,7 +156,7 @@ + totalBytes += encoder->channel_setup[ch]->targetBytes; + } + +- int bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms; ++ bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms; + + if (encoder->fs_in == 44100) + { +@@ -191,11 +197,13 @@ + + LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth) + { ++ LC3_INT effective_fs; ++ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + #ifdef ENABLE_HR_MODE_FL_FLAG + RETURN_IF(encoder->hrmode == 1, LC3PLUS_HRMODE_BW_ERROR); + #endif +- LC3_INT effective_fs = encoder->fs_in; ++ effective_fs = encoder->fs_in; + if (encoder->bandwidth != bandwidth) { + if (encoder->fs_in > 40000) { + effective_fs = 40000; +@@ -338,9 +346,9 @@ + + LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder) + { ++ int ch = 0; + RETURN_IF(!encoder, LC3PLUS_NULL_ERROR); + +- int ch = 0; + for (ch = 0; ch < encoder->channels; ch++) { + mdct_free(&encoder->channel_setup[ch]->mdctStruct); + dct2_free(&encoder->channel_setup[ch]->dct2StructSNS); +@@ -351,9 +359,9 @@ + + LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder) + { ++ int ch = 0; + RETURN_IF(!decoder, LC3PLUS_NULL_ERROR); + +- int ch = 0; + for (ch = 0; ch < decoder->channels; ch++) { + dct4_free(&decoder->channel_setup[ch]->dct4structImdct); + real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft); +@@ -378,11 +386,14 @@ + + LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode) + { ++ LC3PLUS_EpMode oldEpmode; ++ LC3PLUS_Error error; ++ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((unsigned)epmode > LC3PLUS_EP_HIGH, LC3PLUS_EPMODE_ERROR); +- LC3PLUS_EpMode oldEpmode = encoder->epmode; ++ oldEpmode = encoder->epmode; + encoder->epmode = epmode; +- LC3PLUS_Error error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK; ++ error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK; + if (error != LC3PLUS_OK) + { + encoder->epmode = oldEpmode; // preserve old epmode in case of failure +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-05-26 10:24:14 +@@ -0,0 +1,99 @@ ++/****************************************************************************** ++* ETSI TS 103 634 V1.4.1 * ++* Low Complexity Communication Codec Plus (LC3plus) * ++* * ++* Copyright licence is solely granted through ETSI Intellectual Property * ++* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * ++* estoppel or otherwise. * ++******************************************************************************/ ++ ++ ++#include "options.h" ++#include "functions.h" ++#include "fft/iis_fft.c" ++#include "fft/iisfft.c" ++#include "fft/cfft.c" ++ ++void fft_init(Fft* fft, int length) ++{ ++ HANDLE_IIS_FFT handle = NULL; ++ IIS_FFT_ERROR error = 0; ++ assert(length % 2 == 0); ++ ++ fft->length = length; ++ ++ error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ fft->handle = handle; ++} ++ ++void fft_free(Fft* fft) ++{ ++ IIS_FFT_ERROR error = 0; ++ ++ if (fft) { ++ error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ memset(fft, 0, sizeof(*fft)); ++ } ++} ++ ++void real_fft_free(Fft* fft) ++{ ++ IIS_FFT_ERROR error = 0; ++ ++ if (fft) { ++ error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ memset(fft, 0, sizeof(*fft)); ++ } ++} ++ ++void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) ++{ ++ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; ++ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ ++ ++ fft->length = length; ++ ++ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); ++ assert(error == IIS_FFT_NO_ERROR); ++ fft->handle = *handle; ++} ++ ++ ++void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) ++{ ++ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; ++ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ ++ ++ fft->length = length; ++ ++ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ fft->handle = *handle; ++} ++ ++void fft_apply(Fft* fft, const Complex* input, Complex* output) ++{ ++ IIS_FFT_ERROR error = 0; ++ error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++} ++ ++ ++void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) ++{ ++ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; ++ ++ UNUSED(error); ++ ++ error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++} +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) +@@ -104,6 +105,7 @@ + { + LC3_FLOAT tmp[MAX_LEN * 2] = {0}; + LC3_INT i = 0; ++ LC3_INT hlen; + + move_float(tmp, mdct->mem, mdct->mem_length); + move_float(tmp + mdct->mem_length, input, mdct->length); +@@ -112,7 +114,7 @@ + + mult_vec(tmp, mdct->window, mdct->length * 2); + +- LC3_INT hlen = mdct->length / 2; ++ hlen = mdct->length / 2; + for (i = 0; i < hlen; i++) { + output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i]; + output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-05-26 10:38:32 +@@ -8,15 +8,16 @@ + ******************************************************************************/ + + #include "functions.h" ++#include "options.h" + + + void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, + const LC3_INT bands_number, const LC3_FLOAT* ener) + { + *near_nyquist_flag = 0; +- ++ + if (fs_idx < 4) +- { ++ { + LC3_INT i = 0; + LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0; + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, +@@ -56,6 +57,8 @@ + { + case 2: + { ++ LC3_FLOAT pitch_fl_c; ++ + assert(decoder->fs_idx == floor(decoder->fs / 10000)); + // phaseECU supports only 10ms framing + assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100); +@@ -69,7 +72,7 @@ + } + + /* call phaseEcu */ +- LC3_FLOAT pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */ ++ pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */ + + + if (prev_bfi_plc2 == 0) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +@@ -135,13 +136,13 @@ + + if (max_xfp_abs >= 0.5) + { +- PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOG2(32768 / 2 / 2 / max_xfp_abs)); ++ PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / max_xfp_abs)); + Q_scale_flt = LC3_POW(2.0, PLC2_Q_flt) / fx_fft_scale / fft_fs_scale; /* basop way using xfp scale */ + + /* C-Float additional safety limit/verification of the integer xfp based scaling using the available C-float Xabs max value inp_high as well */ + { + LC3_FLOAT tmp_scale; +- tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOG2(32768 / 2 / 2 / inp_high))); ++ tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / inp_high))); + if (Q_scale_flt > tmp_scale) { + Q_scale_flt = tmp_scale; + } +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + #include "constants.h" +@@ -30,6 +31,7 @@ + LC3_INT32 segmentLen, e; + LC3_FLOAT Xph; + LC3_FLOAT seed_local; ++ LC3_INT32 binCounter, subInd; + + UNUSED(corr_phase_dbg); + UNUSED(X_i_new_re_dbg); +@@ -49,8 +51,8 @@ + + + // EVOLVE PHASE ----------------- +- LC3_INT32 binCounter = 1; +- LC3_INT32 subInd = 0; ++ binCounter = 1; ++ subInd = 0; + + one_peak_flag_mask = -1; + if (n_plocs < 3 && n_plocs > 0) { +@@ -219,9 +221,10 @@ + } + + static LC3_INT32 own_rand(LC3_INT32 seed) { +- assert(seed <= 32767 && seed >= -32768); +- LC3_INT32 retSeed = (13849 + (seed + 32768) * 31821) & 65535; +- retSeed -= 32768; ++ LC3_INT32 retSeed; ++ assert(seed <= 32767 && seed >= -32768); ++ retSeed = (13849 + (seed + 32768) * 31821) & 65535; ++ retSeed -= 32768; + assert(retSeed <= 32767 && retSeed >= -32768); + return retSeed; + } +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-05-26 10:38:32 +@@ -6,13 +6,14 @@ + * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * + * estoppel or otherwise. * + ******************************************************************************/ +- + ++ ++#include "options.h" + #include "defines.h" + #include "functions.h" + + +-void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) ++void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) + { + LC3_INT32 i; + +@@ -34,10 +35,10 @@ + trans[i] = 1.0; /* 0/0 no transient , no power change */ + } + } +- grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOG10(trans[i]); ++ grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOGTEN(trans[i]); + + } + +- return; ++ return; + } + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-05-26 10:38:32 +@@ -6,16 +6,17 @@ + * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * + * estoppel or otherwise. * + ******************************************************************************/ +- + ++ ++#include "options.h" + #include "defines.h" + #include "functions.h" + + +-void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, +- LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, ++void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, ++ LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, +- LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg) ++ LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg) + { + LC3_FLOAT gr_pow_left[MAX_LGW]; + LC3_FLOAT gr_pow_right[MAX_LGW]; +@@ -27,7 +28,7 @@ + + LC3_INT32 attDegreeFrames; + LC3_FLOAT thresh_dbg; +- ++ + UNUSED(tr_dec_dbg); + UNUSED(gpc_dbg); + +@@ -39,7 +40,7 @@ + + } + +- ++ + plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg); + + return; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + /***************************************************************************\ + * contents/description: Main function for Time domain concealment + \***************************************************************************/ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + #include "functions.h" ++#include "options.h" + + + void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static LC3_INT sign(LC3_FLOAT x); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], +@@ -17,6 +18,8 @@ + + LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0; + LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0}; ++ LC3_INT32 index_int, index_frac, resamp_upfac, resamp_delay, resamp_off_int, resamp_off_frac; ++ LC3_FLOAT u_11, u_21, u_1, u_2; + + const LC3_FLOAT *filter; + const LC3_FLOAT *filt_input, *filt_coeff; +@@ -49,12 +52,12 @@ + + /* Upsampling & Low-pass Filtering & Downsampling */ + +- LC3_INT32 index_int = 1; +- LC3_INT32 index_frac = 0; +- LC3_INT32 resamp_upfac = resamp_params[fs_idx][0]; +- LC3_INT32 resamp_delay = resamp_params[fs_idx][1]; +- LC3_INT32 resamp_off_int = resamp_params[fs_idx][2]; +- LC3_INT32 resamp_off_frac = resamp_params[fs_idx][3]; ++ index_int = 1; ++ index_frac = 0; ++ resamp_upfac = resamp_params[fs_idx][0]; ++ resamp_delay = resamp_params[fs_idx][1]; ++ resamp_off_int = resamp_params[fs_idx][2]; ++ resamp_off_frac = resamp_params[fs_idx][3]; + + k = 0; + for (i = 0; i < N12k8; i++) { +@@ -78,9 +81,8 @@ + + + /* 50Hz High-Pass */ +- LC3_FLOAT u_11 = mem_50[0]; +- LC3_FLOAT u_21 = mem_50[1]; +- LC3_FLOAT u_1, u_2; ++ u_11 = mem_50[0]; ++ u_21 = mem_50[1]; + + for (i = 0; i < len_12k8; i++) { + LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + #include "functions.h" ++#include "options.h" + + LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) + { +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "setup_dec_lc3.h" + #include "functions.h" + #include +@@ -32,6 +33,7 @@ + LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu; + HANDLE_IIS_FFT handle_fft_phaseecu; + HANDLE_IIS_FFT handle_ifft_phaseecu; ++ LC3_FLOAT *q_old_res; + + for (ch = 0; ch < channels; ch++) { + DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); +@@ -56,7 +58,7 @@ + sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); + sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); + +- LC3_FLOAT *q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); ++ q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); + + if (decoder) { + decoder->channel_setup[ch] = setup; +@@ -346,6 +348,7 @@ + LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) + { + int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0; ++ DecSetup* setup; + + if (decoder->hrmode) + { +@@ -375,7 +378,7 @@ + + channel_bytes = nBytes; + +- DecSetup* setup = decoder->channel_setup[ch]; ++ setup = decoder->channel_setup[ch]; + + if (channel_bytes < minBytes || channel_bytes > maxBytes) + { +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "setup_enc_lc3.h" + #include "functions.h" + #include +@@ -33,6 +34,7 @@ + , int32_t lfe_channel_array[] + ) + { ++ int ch = 0; + memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels)); + alloc_encoder(encoder, channels); + +@@ -56,7 +58,6 @@ + encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; + encoder->r12k8_mem_out_len = 24; + +- int ch = 0; + for (ch = 0; ch < encoder->channels; ch++) + { + encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; +@@ -220,6 +221,7 @@ + + if (encoder->hrmode) + { ++#ifdef ENABLE_HR_MODE_FL + switch (encoder->frame_dms) + { + case 25: +@@ -243,6 +245,7 @@ + default: + return LC3PLUS_HRMODE_ERROR; + } ++#endif + } + else + { +@@ -368,7 +371,7 @@ + setup->total_bits = setup->targetBytes << 3; + setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits - + encoder->noise_fac_bits - encoder->BW_cutoff_bits - +- ceil(LC3_LOG2(encoder->frame_length / 2)) - 2 - 1; ++ ceil(LC3_LOGTWO(encoder->frame_length / 2)) - 2 - 1; + + if (setup->total_bits > 1280) { + setup->targetBitsInit = setup->targetBitsInit - 1; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) +@@ -109,7 +110,7 @@ + + /* Log-domain */ + for (i = 0; i < 64; i++) { +- xl[i] = LC3_LOG2(x[i]) / 2.0; ++ xl[i] = LC3_LOGTWO(x[i]) / 2.0; + } + + /* Downsampling */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-05-26 10:23:38 +@@ -17,6 +17,7 @@ + #include + #include + ++ + #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ + defined(__aarch64__) + #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-05-26 10:24:14 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index dfa7a06e07..e81a6a2b7c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -108,6 +108,9 @@ typedef struct #ifdef SPLIT_REND_PLC const int16_t *pSplitRendBFI; #endif +#ifdef SPLIT_REND_LC3PLUS + const SPLIT_REND_WRAPPER *pSplitRendWrapper; +#endif /* TODO @Philips : would this be a better place to store the render config data? * bearing in mind we could have multiple inputs to the renderer, we might neeed to accomodate @@ -139,6 +142,9 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; +#ifdef SPLIT_REND_LC3PLUS + TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ +#endif #ifdef REND_STATIC_MEM_OPT float *bufferData; #endif @@ -242,6 +248,10 @@ struct IVAS_REND IVAS_REND_AudioConfig outputConfig; EFAP_WRAPPER efapOutWrapper; IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; +#ifdef SPLIT_REND_LC3PLUS + SPLIT_REND_WRAPPER splitRendWrapper; + IVAS_REND_AudioBuffer splitRendEncBuffer; +#endif IVAS_REND_HeadRotData headRotData; #ifdef SPLIT_REND_PLC @@ -306,6 +316,10 @@ static void convertBitsBufferToInternalBitsBuff( hBits->bits_read = outBits.config.bitsRead; hBits->bits_written = outBits.config.bitsWritten; hBits->buf_len = outBits.config.bufLenInBytes; +#ifdef SPLIT_REND_LC3PLUS + hBits->codec = outBits.config.codec; + hBits->pose_correction = outBits.config.poseCorrection; +#endif return; } @@ -318,6 +332,10 @@ static void convertInternalBitsBuffToBitsBuffer( hOutBits->config.bitsRead = bits.bits_read; hOutBits->config.bitsWritten = bits.bits_written; hOutBits->config.bufLenInBytes = bits.buf_len; +#ifdef SPLIT_REND_LC3PLUS + hOutBits->config.codec = bits.codec; + hOutBits->config.poseCorrection = bits.pose_correction; +#endif return; } @@ -415,7 +433,7 @@ static void copyBufferTo2dArray( static void accumulate2dArrayToBuffer( float array[MAX_OUTPUT_CHANNELS][L_FRAME48k], - IVAS_REND_AudioBuffer *buffer ) + const IVAS_REND_AudioBuffer *buffer ) { int16_t smplIdx, chnlIdx; float *writePtr; @@ -1246,6 +1264,9 @@ static rendering_context getRendCtx( #ifdef SPLIT_REND_PLC ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; #endif +#ifdef SPLIT_REND_LC3PLUS + ctx.pSplitRendWrapper = &hIvasRend->splitRendWrapper; +#endif return ctx; } @@ -1307,6 +1328,9 @@ static ivas_error setRendInputActiveIsm( rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; input_ism *inputIsm; +#ifdef SPLIT_REND_LC3PLUS + int16_t i; +#endif inputIsm = (input_ism *) input; rendCtx = inputIsm->base.ctx; @@ -1336,9 +1360,19 @@ static ivas_error setRendInputActiveIsm( inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); +#ifdef SPLIT_REND_LC3PLUS + for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) + { + inputIsm->splitTdRendWrappers[i] = defaultTdRendWrapper(); + } +#endif error = IVAS_ERR_OK; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL +#ifdef SPLIT_REND_LC3PLUS + || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { @@ -1381,6 +1415,9 @@ static void clearInputIsm( input_ism *inputIsm ) { rendering_context rendCtx; +#ifdef SPLIT_REND_LC3PLUS + int16_t i; +#endif rendCtx = inputIsm->base.ctx; @@ -1410,6 +1447,13 @@ static void clearInputIsm( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); inputIsm->tdRendWrapper.hHrtfTD = NULL; } +#ifdef SPLIT_REND_LC3PLUS + for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) + { + ivas_td_binaural_close( &inputIsm->splitTdRendWrappers[i].hBinRendererTd ); + inputIsm->splitTdRendWrappers[i].hHrtfTD = NULL; + } +#endif return; } @@ -2380,11 +2424,17 @@ updateSplitPostRendPanGains( error = ivas_splitBinPostRendOpen( &inputSplitPostRend->splitPostRendWrapper.hBinHrSplitPostRend, &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, - *rendCtx.pOutSampleRate, ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 ); + *rendCtx.pOutSampleRate +#ifndef SPLIT_REND_LC3PLUS + , + ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 +#endif + ); if ( error != IVAS_ERR_OK ) { return error; } +#ifndef SPLIT_REND_LC3PLUS if ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { error = ivas_splitBinLCLDDecOpen( &inputSplitPostRend->splitPostRendWrapper.hSplitBinLCLDDec, *rendCtx.pOutSampleRate, numOutChannels ); @@ -2393,6 +2443,7 @@ updateSplitPostRendPanGains( return error; } } +#endif return IVAS_ERR_OK; } @@ -2435,7 +2486,7 @@ updateSbaPanGains( &rendCtx.hhRendererConfig[0]->split_rend_config, &inputSba->splitRendWrapper.multiBinPoseData, rendCtx.pHeadRotData->sr_pose_pred_axis ); -#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT +#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT /* TODO: redundant nested switch SPLIT_REND_WITH_HEAD_ROT */ if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -2466,7 +2517,8 @@ updateSbaPanGains( error = ivas_split_renderer_open( &inputSba->splitRendWrapper, &inputSba->base.ctx.hhRendererConfig[0]->split_rend_config, - *rendCtx.pOutSampleRate, is_cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + *rendCtx.pOutSampleRate, + is_cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); break; } #endif @@ -2651,6 +2703,12 @@ static void clearInputSplitRend( { ivas_splitBinLCLDDecClose( &inputSplitRend->splitPostRendWrapper.hSplitBinLCLDDec ); } +#ifdef SPLIT_REND_LC3PLUS + if ( inputSplitRend->splitPostRendWrapper.hLc3plusDec != NULL ) + { + IVAS_LC3PLUS_DEC_Close( &inputSplitRend->splitPostRendWrapper.hLc3plusDec ); + } +#endif return; } @@ -3156,12 +3214,68 @@ static void clearInputMasa( return; } +#ifdef SPLIT_REND_LC3PLUS +static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_REND_AudioConfig outConfig ) +{ + ivas_error error; + IVAS_REND_AudioBufferConfig bufConfig; + + ivas_init_split_rend_handles( pSplitRendWrapper ); + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + + if ( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + ivas_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); + } + else if ( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + ivas_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); + } + + error = ivas_split_renderer_open( pSplitRendWrapper, + pSplit_rend_config, + outputSampleRate, + 0, 0 ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + + bufConfig.numSamplesPerChannel = MAX_BUFFER_LENGTH_PER_CHANNEL; + bufConfig.numChannels = BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; + bufConfig.is_cldfb = 0; + pSplitRendEncBuffer->config = bufConfig; + pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ); + if ( pSplitRendEncBuffer->data == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + } + else + { + IVAS_REND_AudioBufferConfig bufConfig; + + bufConfig.numSamplesPerChannel = 0; + bufConfig.numChannels = 0; + bufConfig.is_cldfb = 0; + pSplitRendEncBuffer->config = bufConfig; + pSplitRendEncBuffer->data = NULL; + } + + return IVAS_ERR_OK; +} +#endif + ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, const IVAS_REND_AudioConfig outConfig ) { int16_t i; +#ifdef SPLIT_REND_LC3PLUS + int16_t j; +#endif IVAS_REND_HANDLE hIvasRend; ivas_error error; int16_t numOutChannels; @@ -3234,6 +3348,13 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; +#ifdef SPLIT_REND_LC3PLUS + for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsIsm[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsIsm[i].splitTdRendWrappers ) ); ++j ) + { + hIvasRend->inputsIsm[i].splitTdRendWrappers[j].hBinRendererTd = NULL; + hIvasRend->inputsIsm[i].splitTdRendWrappers[j].hHrtfTD = NULL; + } +#endif #ifdef REND_STATIC_MEM_OPT hIvasRend->inputsIsm[i].bufferData = NULL; #endif @@ -3682,6 +3803,18 @@ static ivas_error findFreeInputSlot( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_LC3PLUS +static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer ) +{ + ivas_split_renderer_close( pSplitRendWrapper ); + if ( pSplitRendEncBuffer->data != NULL ) + { + free( pSplitRendEncBuffer->data ); + } + pSplitRendEncBuffer->config.numChannels = 0; + pSplitRendEncBuffer->config.numSamplesPerChannel = 0; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_AddInput() @@ -3715,6 +3848,19 @@ ivas_error IVAS_REND_AddInput( inputsArray = hIvasRend->inputsIsm; inputStructSize = sizeof( *hIvasRend->inputsIsm ); activateInput = setRendInputActiveIsm; +#ifdef SPLIT_REND_LC3PLUS + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + /* Hack to override default split rendering codec from Dolby CLDFB to LC3plus. + This will not be necessary once the split rendering codec becomes selectable by the lib user. */ + closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + hIvasRend->hRendererConfig->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LC3PLUS; + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif break; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; @@ -4137,8 +4283,21 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSplitPost[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = IVAS_FB_DEC_DELAY_NS; - max_latency_ns = max( max_latency_ns, latency_ns ); +#ifdef SPLIT_REND_LC3PLUS + if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec != NULL ) + { + int32_t lc3plusDelaySamples; + IVAS_LC3PLUS_DEC_GetDelay( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec, &lc3plusDelaySamples ); + max_latency_ns = max( max_latency_ns, roundf( lc3plusDelaySamples * 1000000000.f / *timeScale ) ); + } + else + { +#endif + latency_ns = IVAS_FB_DEC_DELAY_NS; + max_latency_ns = max( max_latency_ns, latency_ns ); +#ifdef SPLIT_REND_LC3PLUS + } +#endif } } #endif @@ -4356,6 +4515,15 @@ ivas_error IVAS_REND_InitConfig( hIvasRend->hRendererConfig = NULL; } +#ifdef SPLIT_REND_LC3PLUS + /* ToDo: The entire contents of this function should be part of IVAS_REND_Open - otherwise renderer handle is partly uninitialized after opening */ + /* Initialize split rendering */ + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + return IVAS_ERR_OK; } @@ -4427,6 +4595,10 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; #endif +#ifdef SPLIT_REND_LC3PLUS + hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; +#endif return IVAS_ERR_OK; } @@ -4444,6 +4616,9 @@ int16_t IVAS_REND_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; +#ifdef SPLIT_REND_LC3PLUS + ivas_error error; +#endif if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) { @@ -4474,10 +4649,23 @@ int16_t IVAS_REND_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); #ifdef SPLIT_REND_WITH_HEAD_ROT - hRenderConfig->split_rend_config.splitRendBitRate = renderConfig.split_rend_config.splitRendBitRate; - hRenderConfig->split_rend_config.dof = renderConfig.split_rend_config.dof; - hRenderConfig->split_rend_config.hq_mode = renderConfig.split_rend_config.hq_mode; - hRenderConfig->split_rend_config.codec_delay_ms = renderConfig.split_rend_config.codec_delay_ms; + hRenderConfig->split_rend_config = renderConfig.split_rend_config; +#endif +#ifdef SPLIT_REND_LC3PLUS + /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ + if ( hRenderConfig->split_rend_config.dof == 0 ) + { + hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; + } + + hRenderConfig->split_rend_config.codec = renderConfig.split_rend_config.codec; + + /* Must re-initialize split rendering config which depends on renderer config */ + closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } #endif return IVAS_ERR_OK; @@ -5350,6 +5538,136 @@ static ivas_error renderIsmToSba( return error; } +#ifdef SPLIT_REND_LC3PLUS +static ivas_error renderIsmToSplitBinaural( + input_ism *ismInput, + const IVAS_REND_AudioBuffer outAudio ) +{ + int32_t i; + ivas_error error; + float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; + int16_t pos_idx; + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + const SPLIT_REND_WRAPPER *pSplitRendWrapper; + IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; + float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; + int16_t output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel; + IVAS_REND_HeadRotData modifiedHeadRotData; + + push_wmops( "renderIsmToSplitBinaural" ); + + pSplitRendWrapper = ismInput->base.ctx.pSplitRendWrapper; + pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData; + + /* If not yet allocated, open additional instances of TD renderer */ + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( ismInput->splitTdRendWrappers[i].hBinRendererTd != NULL ) + { + continue; + } + + /* ToDo: Could re-use already existing HRTF (ismInput->tdRendWrapper.hHrtfTD), but this complicates internal memory handling in TD renderer */ + ismInput->splitTdRendWrappers[i].hHrtfTD = NULL; + + /* Open TD renderer wrapper */ + if ( ( error = ivas_td_binaural_open_ext( &ismInput->splitTdRendWrappers[i], ismInput->base.inConfig, *ismInput->base.ctx.hhRendererConfig, NULL, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Assert same delay as main TD renderer */ + assert( ismInput->splitTdRendWrappers[i].binaural_latency_ns == ismInput->tdRendWrapper.binaural_latency_ns ); + } + + /* Save current head positions */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + originalHeadRot[i] = ismInput->base.ctx.pHeadRotData->headPositions[i]; + } + + /* Copy input audio to a processing buffer. */ + copyBufferTo2dArray( ismInput->base.inputBuffer, tmpProcessing ); + + modifiedHeadRotData = *ismInput->base.ctx.pHeadRotData; + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + /* Update head positions */ + if ( pos_idx != 0 ) + { + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + if ( originalHeadRot[i].w == -3.0f ) + { + modifiedHeadRotData.headPositions[i].w = -3.0f; + modifiedHeadRotData.headPositions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; + modifiedHeadRotData.headPositions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; + modifiedHeadRotData.headPositions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + } + else + { + modifiedHeadRotData.headPositions[i].w = -3.0f; + Quat2EulerDegree( originalHeadRot[i], + &modifiedHeadRotData.headPositions[i].z, + &modifiedHeadRotData.headPositions[i].y, + &modifiedHeadRotData.headPositions[i].x ); + modifiedHeadRotData.headPositions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; + modifiedHeadRotData.headPositions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; + modifiedHeadRotData.headPositions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + } + } + } + + /* Render */ + if ( pos_idx == 0 ) + { + error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, + ismInput->base.inConfig, + NULL, + ismInput->base.ctx.pHeadRotData, + &ismInput->currentPos, + NULL, + output_frame, + tmpProcessing ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } + else + { + error = ivas_td_binaural_renderer_ext( &ismInput->splitTdRendWrappers[pos_idx - 1], + ismInput->base.inConfig, + NULL, + &modifiedHeadRotData, + &ismInput->currentPos, + NULL, + output_frame, + tmpProcessing ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } + + /* Copy rendered audio to tmp storage buffer. Copying directly to output would + * overwrite original audio, which is still needed for rendering next head pose. */ + mvr2r( tmpProcessing[0], tmpBinaural[2 * pos_idx], output_frame ); + mvr2r( tmpProcessing[1], tmpBinaural[2 * pos_idx + 1], output_frame ); + + /* Overwrite processing buffer with original input audio again */ + copyBufferTo2dArray( ismInput->base.inputBuffer, tmpProcessing ); + } + + accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); + /* Encoding to split rendering bitstream done at a higher level */ + + pop_wmops(); + + return IVAS_ERR_OK; +} +#endif + static ivas_error renderInputIsm( input_ism *ismInput, const IVAS_REND_AudioConfig outConfig, @@ -5387,6 +5705,12 @@ static ivas_error renderInputIsm( case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: error = renderIsmToBinauralRoom( ismInput, outAudio ); break; +#ifdef SPLIT_REND_LC3PLUS + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + error = renderIsmToSplitBinaural( ismInput, outAudio ); + break; +#endif default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -5879,6 +6203,53 @@ static void renderSbaToSba( return; } +#ifdef SPLIT_REND_LC3PLUS +static ivas_error splitBinLc3plusDecode( + SPLIT_POST_REND_WRAPPER *hSplitBin, + ivas_split_rend_bits_t *bits, + float outputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k], + IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction ) +{ + ivas_error error; + float *channel_ptrs[MAX_HEAD_ROT_POSES * 2]; + int32_t lc3plusBitrateId, lc3plusBitstreamSize; + + push_wmops( "splitBinLc3plusDecode" ); + + assert( hSplitBin->hLc3plusDec != NULL ); + + /* Find next byte boundary */ + while ( bits->bits_read % 8 != 0 ) + { + ++bits->bits_read; + } + /* Read LC3plus bitstream size info */ + lc3plusBitrateId = ivas_split_rend_bitstream_read_int32( bits, 8 ); + lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( lc3plusBitrateId, pose_correction ); +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG + if ( lc3plusBitstreamSize == -1 ) + { + lc3plusBitstreamSize = hSplitBin->hLc3plusDec->num_decs * SPLIT_REND_LC3PLUS_HBR / FRAMES_PER_SECOND / 8; + } +#endif + + for ( int16_t i = 0; i < BINAURAL_CHANNELS * hSplitBin->multiBinPoseData.num_poses; ++i ) + { + channel_ptrs[i] = outputBuffer[i]; + } + if ( ( error = IVAS_LC3PLUS_DEC_Decode( hSplitBin->hLc3plusDec, + &bits->bits_buf[bits->bits_read / 8], + lc3plusBitstreamSize, + channel_ptrs ) ) != IVAS_ERR_OK ) + { + return error; + } + + pop_wmops(); + + return IVAS_ERR_OK; +} +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSplitBinauralWithPostRot( @@ -5888,7 +6259,7 @@ static ivas_error renderSplitBinauralWithPostRot( #ifdef SPLIT_REND_PLC , const int16_t SplitRendBFI -#endif +#endif /* SPLIT_REND_PLC */ ) { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -5900,6 +6271,13 @@ static ivas_error renderSplitBinauralWithPostRot( float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; const IVAS_REND_HeadRotData *pHeadRotData; SPLIT_POST_REND_WRAPPER *hSplitBin; +#ifdef SPLIT_REND_LC3PLUS + int8_t isPostRendInputCldfb; + + isPostRendInputCldfb = 0; +#endif /* SPLIT_REND_LC3PLUS */ + + push_wmops( "renderSplitBinauralWithPostRot" ); error = IVAS_ERR_OK; @@ -5907,64 +6285,118 @@ static ivas_error renderSplitBinauralWithPostRot( hSplitBin = &splitBinInput->splitPostRendWrapper; convertBitsBufferToInternalBitsBuff( *hBits, &bits ); +#ifdef SPLIT_REND_LC3PLUS + if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD && splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec == NULL ) + { + error = ivas_splitBinLCLDDecOpen( &splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec, *splitBinInput->base.ctx.pOutSampleRate, BINAURAL_CHANNELS ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } + else if ( bits.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && splitBinInput->splitPostRendWrapper.hLc3plusDec == NULL ) + { + LC3PLUS_CONFIG config; + config.lc3plus_frame_duration_us = 5000; + config.ivas_frame_duration_us = 20000; + config.channels = BINAURAL_CHANNELS; + config.samplerate = *splitBinInput->base.ctx.pOutSampleRate; + + IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 0 /* caching disabled */, +#endif + &splitBinInput->splitPostRendWrapper.hLc3plusDec ); + } +#endif /* SPLIT_REND_LC3PLUS */ + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); } + #ifdef SPLIT_REND_PLC if ( !SplitRendBFI ) { hSplitBin->first_good_frame_received = 1; } -#endif +#endif /* SPLIT_REND_PLC */ #ifdef SPLIT_REND_PLC if ( hSplitBin->first_good_frame_received == 1 ) { -#endif +#endif /* SPLIT_REND_PLC */ -#ifdef SPLIT_REND_PLC - if ( !SplitRendBFI ) -#endif + if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - ivas_splitBinPostRendMdDec( - &bits, - hSplitBin->hBinHrSplitPostRend, - &hSplitBin->multiBinPoseData +#ifdef SPLIT_REND_PLC + if ( !SplitRendBFI ) /* ToDo: this is always true */ +#endif /* SPLIT_REND_PLC */ + { + ivas_splitBinPostRendMdDec( + &bits, + hSplitBin->hBinHrSplitPostRend, + &hSplitBin->multiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - , - hSplitBin->hBinHrSplitPreRend -#endif - ); + , + hSplitBin->hBinHrSplitPreRend +#endif /* SPLIT_REND_WITH_HEAD_ROT_DEBUG */ + ); + } } - if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { - ivas_splitBinLCLDDecProcess( - hSplitBin->hSplitBinLCLDDec, - &bits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural +#ifdef SPLIT_REND_LC3PLUS + if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) + { +#endif /* SPLIT_REND_LC3PLUS */ + ivas_splitBinLCLDDecProcess( + hSplitBin->hSplitBinLCLDDec, + &bits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural #ifdef SPLIT_REND_PLC - , - SplitRendBFI + , + SplitRendBFI +#endif /* SPLIT_REND_PLC */ + ); +#ifdef SPLIT_REND_LC3PLUS + isPostRendInputCldfb = 1; + } + else + { + error = splitBinLc3plusDecode( hSplitBin, &bits, tmpCrendBuffer, bits.pose_correction ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } #endif - ); } else { copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); } - ivas_rend_CldfbSplitPostRendProcess( - hSplitBin->hBinHrSplitPostRend, - &hSplitBin->multiBinPoseData, - QuaternionsPost, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - tmpCrendBuffer, - ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 ); +#ifdef SPLIT_REND_LC3PLUS + if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { +#endif /* SPLIT_REND_LC3PLUS */ + ivas_rend_CldfbSplitPostRendProcess( + hSplitBin->hBinHrSplitPostRend, + &hSplitBin->multiBinPoseData, + QuaternionsPost, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + tmpCrendBuffer, +#ifdef SPLIT_REND_LC3PLUS + isPostRendInputCldfb ); + } +#else /* SPLIT_REND_LC3PLUS */ + ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 ); +#endif /* SPLIT_REND_LC3PLUS */ + #ifdef SPLIT_REND_PLC } else @@ -5982,13 +6414,16 @@ static ivas_error renderSplitBinauralWithPostRot( copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); } } -#endif +#endif /* SPLIT_REND_PLC */ convertInternalBitsBuffToBitsBuffer( hBits, bits ); accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); + pop_wmops(); + return error; } + #endif #ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6048,12 +6483,8 @@ static ivas_error renderSbaToMultiBinaural( assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL ); /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - pos_idx -#endif - ) ) != IVAS_ERR_OK ) + NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + pos_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -6180,12 +6611,18 @@ static ivas_error renderSbaToSplitBinaural( ivas_renderMultiBinToSplitBinaural( &sbaInput->splitRendWrapper, sbaInput->base.ctx.pHeadRotData->headPositions, sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.splitRendBitRate, +#ifdef SPLIT_REND_LC3PLUS + sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.codec, +#endif &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, max_band, tmpCrendBuffer, low_res_pre_rend_rot, +#ifdef SPLIT_REND_LC3PLUS + 1, +#endif ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); convertInternalBitsBuffToBitsBuffer( hBits, bits ); @@ -6791,6 +7228,14 @@ ivas_error IVAS_REND_GetSamples( return IVAS_ERR_WRONG_NUM_CHANNELS; } +#ifdef SPLIT_REND_LC3PLUS + /* Use internal buffer if outputting split rendering bitstream */ + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + outAudio = hIvasRend->splitRendEncBuffer; + } +#endif + /* Clear output buffer */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); @@ -6842,6 +7287,41 @@ ivas_error IVAS_REND_GetSamples( limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif +#ifdef SPLIT_REND_LC3PLUS + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ + && hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + { + /* TODO: doesn't work for multiple SBA inputs, needs to be updated like the ISM path for TD */ + ivas_split_rend_bits_t bits; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; + + copyBufferTo2dArray( outAudio, tmpBinaural ); + + /* Encode split rendering bitstream */ + convertBitsBufferToInternalBitsBuff( *hBits, &bits ); + error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, + hIvasRend->headRotData.headPositions, + hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, + hIvasRend->hRendererConfig->split_rend_config.codec, + &bits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000, + tmpBinaural, + 1, + 1, + 0 ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + convertInternalBitsBuffToBitsBuffer( hBits, bits ); + } +#endif + return IVAS_ERR_OK; } @@ -6901,6 +7381,10 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); +#ifdef SPLIT_REND_LC3PLUS + closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); +#endif + closeHeadRotation( hIvasRend ); free( hIvasRend ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 05923e3d88..3b4a236133 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -68,6 +68,10 @@ typedef struct int32_t bufLenInBytes; int32_t bitsWritten; int32_t bitsRead; +#ifdef SPLIT_REND_LC3PLUS + IVAS_SPLIT_REND_CODEC codec; + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; +#endif } IVAS_REND_BitstreamBufferConfig; typedef struct { diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 242a3d05d8..5b0a308e06 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -535,6 +535,17 @@ ivas_error RenderConfigReader_read( errorHandler( item, ERROR_VALUE_INVALID ); } } +#ifdef SPLIT_REND_LC3PLUS + else if ( strcmp( item, "CODEC") == 0 ) + { + int16_t tmp; + if ( !sscanf( pValue, "%hd", &tmp ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + hRenderConfig->split_rend_config.codec = tmp == 0 ? IVAS_SPLIT_REND_CODEC_LCLD : IVAS_SPLIT_REND_CODEC_LC3PLUS; + } +#endif #ifdef DEBUGGING else diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 19c0544b16..852d31b2db 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -148,7 +148,12 @@ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileR return IVAS_ERR_OK; } -ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ) +ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written +#ifdef SPLIT_REND_LC3PLUS + , + IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection +#endif +) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; size_t header_len, i, num_bytes; @@ -174,6 +179,19 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil } } +#ifdef SPLIT_REND_LC3PLUS + /* Write codec signalling */ + if ( fwrite( &codec, sizeof( codec ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } + /* Write pose correction signalling */ + if ( fwrite( &poseCorrection, sizeof( poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_WRITE; + } +#endif + /*write num bytes*/ if ( fwrite( bits_written, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -192,11 +210,16 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil return IVAS_ERR_OK; } -ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ) +ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written +#ifdef SPLIT_REND_LC3PLUS + , + IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE* poseCorrection +#endif +) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; - size_t header_len, i, num_bytes, bit_len = 0; + int32_t header_len, i, num_bytes, bit_len = 0; if ( hSplitRendFileReadWrite == NULL ) { @@ -224,6 +247,19 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea return IVAS_ERR_FAILED_FILE_READ; } +#ifdef SPLIT_REND_LC3PLUS + /* read codec signalling */ + if ( fread( codec, sizeof( *codec ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_READ; + } + /* read pose correction signalling */ + if ( fread( poseCorrection, sizeof( *poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 ) + { + return IVAS_ERR_FAILED_FILE_READ; + } +#endif + /*write num bytes*/ if ( fread( &bit_len, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -231,7 +267,7 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea } num_bytes = ( bit_len + 7 ) >> 3; - if ( fread( bits, sizeof( uint8_t ), num_bytes, hSplitRendFileReadWrite->file ) != num_bytes ) + if ( fread( bits, sizeof( uint8_t ), num_bytes, hSplitRendFileReadWrite->file ) != (uint32_t)num_bytes ) { return IVAS_ERR_FAILED_FILE_READ; } diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index d98bc4b936..694774afd9 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -50,10 +50,20 @@ ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite ); /*write split rend coded bitstream to file*/ -ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ); +ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written +#ifdef SPLIT_REND_LC3PLUS + , + IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection +#endif +); /*read split rend coded bits from file*/ -ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ); +ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written +#ifdef SPLIT_REND_LC3PLUS + , + IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection +#endif +); /*read split pre rend delay*/ ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ); diff --git a/scripts/cppp/.gitignore b/scripts/cppp/.gitignore new file mode 100644 index 0000000000..d9e7f83c69 --- /dev/null +++ b/scripts/cppp/.gitignore @@ -0,0 +1,2 @@ +*.pm +*.pl \ No newline at end of file diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index c748f19aca..2a8037fcc7 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -65,6 +65,7 @@ mkdir $targetdir cp -R ../lib_* $targetdir cp -R ../apps $targetdir cp -R ../Makefile $targetdir +cp -R ../CMakeLists.txt $targetdir cp -R ../Workspace_msvc $targetdir # back up #ifdef-list @@ -101,9 +102,12 @@ shopt -u extglob # patch code before wmc_tool: replace hexadecimal unsigned long constants (0x...UL) by regular integer constant + cast to unsigned long find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; +lc3plus_main_dir="lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/*.c" +lc3plus_fft_dir="lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/*.c" + # run wmc_tool "tools/$system/wmc_tool" -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null -"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null +"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" "$targetdir/$lc3plus_main_dir" "$targetdir/$lc3plus_fft_dir" >> /dev/null # automatically enable #define WMOPS in options.h sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h diff --git a/scripts/split_rendering/lc3plus/.gitignore b/scripts/split_rendering/lc3plus/.gitignore new file mode 100644 index 0000000000..9cd2def1f8 --- /dev/null +++ b/scripts/split_rendering/lc3plus/.gitignore @@ -0,0 +1 @@ +ivas_lc3plus_unit_test \ No newline at end of file diff --git a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c new file mode 100644 index 0000000000..c27809c2e7 --- /dev/null +++ b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c @@ -0,0 +1,632 @@ +/****************************************************************************************************** + +(C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +the software. This notice grants no license of any kind, including but not limited to patent +license, nor is any license granted by implication, estoppel or otherwise. + +Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include "ivas_lc3plus_enc.h" +#include "ivas_lc3plus_common.h" +#include "ivas_lc3plus_dec.h" +#include "ivas_error_utils.h" + +#define MAX_SAMPLES_PER_CHANNEL 960 + +static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config ) +{ + ivas_error err; + uint32_t bps = 128000; + int32_t encDelay = -1; + int32_t decDelay = -1; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_ENC_GetDelay( encHandle, &encDelay ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + if ( encDelay == -1 || encDelay == 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "encDelay is zero or uninitialized\n" ); + } + + /* encode one frame */ + int16_t numSamplesPerChannels = config.samplerate / ( 1000000 / config.ivas_frame_duration_us ); + float *pcm_in[2]; + float pcm_in_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_in_ch2[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch2, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_in[0] = pcm_in_ch1; + pcm_in[1] = pcm_in_ch2; + + int32_t bitstreamSizePerIvasFrame = 0; + err = IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( encHandle, &bitstreamSizePerIvasFrame ); + if ( IVAS_ERR_OK != err ) + return err; + + uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); + memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); + + err = IVAS_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out ); + if ( IVAS_ERR_OK != err ) + return err; + IVAS_LC3PLUS_ENC_Close( &encHandle ); + + /* decode one frame */ + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 1 /*caching enabled*/, +#endif + &decHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_GetDelay( decHandle, &decDelay ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + if ( decDelay == -1 || decDelay == 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "decDelay is zero or uninitialized\n" ); + } + + uint8_t *bitstream_in = bitstream_out; + + float *pcm_out[2]; + float pcm_out_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_out_ch2[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch2, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_out[0] = pcm_out_ch1; + pcm_out[1] = pcm_out_ch2; + + err = IVAS_LC3PLUS_DEC_Conceal( decHandle, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstreamSizePerIvasFrame, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_Conceal( decHandle, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + IVAS_LC3PLUS_DEC_Close( &decHandle ); + free( bitstream_out ); + + return 0; +} + + +static int openCloseEncoder( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + uint32_t bps = 128000; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + IVAS_LC3PLUS_ENC_Close( &encHandle ); + return 0; +} + +static int tryOpenEncoderWithInvalidBitrate( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + /* lc3plus max bitrate is 320000 per channel */ + uint32_t invalid_high_bps = 700000; + uint32_t invalid_low_bps = 8; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, invalid_high_bps, &encHandle ); + /* setting an invalid bitrate should trigger an error - which is what we expect */ + if ( IVAS_ERR_LC3PLUS_INVALID_BITRATE != err ) + { + return 1; + } + err = IVAS_LC3PLUS_ENC_Open( config, invalid_low_bps, &encHandle ); + /* setting an invalid bitrate should trigger an error - which is what we expect */ + if ( IVAS_ERR_LC3PLUS_INVALID_BITRATE != err ) + { + return 1; + } + return 0; +} + +static int tryOpenEncoderWithInvalidFrameDuration( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + config.lc3plus_frame_duration_us = 1234; /*unsupported frame duration*/ + uint32_t bps = 320000; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + /* setting an invalid fame duration should trigger an error - which is what we expect */ + if ( IVAS_ERR_OK == err ) + { + return 1; + } + return 0; +} + +static int tryOpenEncoderWithInvalidSampleRate( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + config.samplerate = 1234; /*unsupported sample rate */ + uint32_t bps = 320000; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + /* setting an invalid sample rate should trigger an error - which is what we expect */ + if ( IVAS_ERR_OK == err ) + { + return 1; + } + return 0; +} + +static int tryCallEncoderApiWithInvalidParams( void ) +{ + IVAS_LC3PLUS_ENC_HANDLE invalidEncHandle = NULL; + int32_t *invalidBsSize = NULL; + int32_t bsSize; + int32_t *invalidDelayInSamples = NULL; + int32_t delayInSamples; + float **invalidPcm_in = NULL; + void *invalidBitstream_out = NULL; + + const int16_t numSamplesPerChannels = MAX_SAMPLES_PER_CHANNEL; + float *pcm_in[1]; + float pcm_in_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_in[0] = pcm_in_ch1; + uint8_t bitstream_out[1200]; + + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_GetDelay( invalidEncHandle, invalidDelayInSamples ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_GetDelay( invalidEncHandle, &delayInSamples ) ) + { + return 1; + } + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( invalidEncHandle, invalidBsSize ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( invalidEncHandle, &bsSize ) ) + { + return 1; + } + IVAS_LC3PLUS_ENC_Close( &invalidEncHandle ); + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, invalidBitstream_out ) ) + { + return 1; + } + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, invalidBitstream_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_Encode( invalidEncHandle, invalidPcm_in, bitstream_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_ENC_Encode( invalidEncHandle, pcm_in, bitstream_out ) ) + { + return 1; + } + return 0; +} + + +static int tryCallDecoderApiWithInvalidParams( void ) +{ + IVAS_LC3PLUS_DEC_HANDLE invalidDecHandle = NULL; + + int32_t *invalidDelayInSamples = NULL; + int32_t delayInSamples; + float **invalidPcm_out = NULL; + void *invalidBitstream_in = NULL; + int32_t invalidBitstream_in_size = 0; + int32_t bitstream_in_size = 100; + + const int16_t numSamplesPerChannels = MAX_SAMPLES_PER_CHANNEL; + float *pcm_out[1]; + float pcm_out_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_out[0] = pcm_out_ch1; + uint8_t bitstream_in[1200]; + + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_GetDelay( invalidDecHandle, invalidDelayInSamples ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_GetDelay( invalidDecHandle, &delayInSamples ) ) + { + return 1; + } + IVAS_LC3PLUS_DEC_Close( &invalidDecHandle ); + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, invalidBitstream_in, invalidBitstream_in_size, invalidPcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, invalidBitstream_in, invalidBitstream_in_size, pcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, invalidBitstream_in, bitstream_in_size, invalidPcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, invalidBitstream_in, bitstream_in_size, pcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, bitstream_in, invalidBitstream_in_size, invalidPcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, bitstream_in, invalidBitstream_in_size, pcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Decode( invalidDecHandle, bitstream_in, bitstream_in_size, pcm_out ) ) + { + return 1; + } + + if ( IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Conceal( invalidDecHandle, invalidPcm_out ) || IVAS_ERR_UNEXPECTED_NULL_POINTER != IVAS_LC3PLUS_DEC_Conceal( invalidDecHandle, pcm_out ) ) + { + return 1; + } + return 0; +} + +static int openCloseDecoderWithCaching( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 1 /*caching enabled*/, +#endif + &decHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + IVAS_LC3PLUS_DEC_Close( &decHandle ); + return 0; +} + +static int openCloseDecoderWithoutCaching( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 1 /*caching enabled*/, +#endif + &decHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + IVAS_LC3PLUS_DEC_Close( &decHandle ); + return 0; +} + + + + +static int tryOpenDecoderWithInvalidFrameDuration( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + config.lc3plus_frame_duration_us = 1234; /*unsupported frame duration*/ + + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 1 /*caching enabled*/, +#endif + &decHandle ); + /* setting an invalid fame duration should trigger an error - which is what we expect */ + if ( IVAS_ERR_OK == err ) + { + return 1; + } + return 0; +} + +static int tryOpenDecoderWithInvalidSampleRate( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + config.samplerate = 1234; /*unsupported sample rate*/ + + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 1 /*caching enabled*/, +#endif + &decHandle ); + /* setting an invalid sample rate should trigger an error - which is what we expect */ + if ( IVAS_ERR_OK == err ) + { + return 1; + } + return 0; +} + +static int encodeOneFrame( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + uint32_t bps = 128000; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + if ( IVAS_ERR_OK != err ) + return err; + + int16_t numSamplesPerChannels = config.samplerate / ( 1000000 / config.ivas_frame_duration_us ); + + float *pcm[1]; + float pcm_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + pcm[0] = pcm_ch1; + + int32_t bitstreamSizePerIvasFrame = 0; + err = IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( encHandle, &bitstreamSizePerIvasFrame ); + if ( IVAS_ERR_OK != err ) + return err; + uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); + memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); + + err = IVAS_LC3PLUS_ENC_Encode( encHandle, pcm, bitstream_out ); + if ( IVAS_ERR_OK != err ) + return err; + + IVAS_LC3PLUS_ENC_Close( &encHandle ); + free( bitstream_out ); + return 0; +} + + +static int encodeAndDecodeOneMonoFrame( void ) +{ + ivas_error err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20000, .channels = 1, .samplerate = 48000 }; + uint32_t bps = 128000; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* encode one frame */ + int16_t numSamplesPerChannels = config.samplerate / ( 1000000 / config.ivas_frame_duration_us ); + float *pcm_in[1]; + float pcm_in_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_in[0] = pcm_in_ch1; + + int32_t bitstreamSizePerIvasFrame = 0; + err = IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( encHandle, &bitstreamSizePerIvasFrame ); + if ( IVAS_ERR_OK != err ) + return err; + + uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); + memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); + + err = IVAS_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out ); + if ( IVAS_ERR_OK != err ) + return err; + IVAS_LC3PLUS_ENC_Close( &encHandle ); + + /* decode one frame */ + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + 1 /*caching enabled*/, +#endif + &decHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + uint8_t *bitstream_in = bitstream_out; + + float *pcm_out[1]; + float pcm_out_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_out[0] = pcm_out_ch1; + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstreamSizePerIvasFrame, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_Conceal( decHandle, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + IVAS_LC3PLUS_DEC_Close( &decHandle ); + free( bitstream_out ); + + return 0; +} + +static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_48kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 48000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_32kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 32000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +static int encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_16kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 16000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +static int encodeAndDecodeOneStereoFrameIvas5msLc3plus5ms_48kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 5 * 1000, .channels = 2, .samplerate = 48000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +static int encodeAndDecodeOneMonoFrameIvas20msLc3plus10ms_48kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 10 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 1, .samplerate = 48000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +static int encodeAndDecodeOneMonoFrameIvas5msLc3plus5ms_48kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 5 * 1000, .channels = 1, .samplerate = 48000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +static int encodeAndDecodeOneStereoFrameIvas20msLc3plus2_5ms_48kHz( void ) +{ + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 2.5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 2, .samplerate = 48000 }; + return encodeAndDecodeOneStereoFrame( config ); +} + +#include "ivas_lc3plus_unit_test_selective_decoding.c" + + +int main( + int argc, + char *argv[] ) +{ + int ret = 0; + ret = openCloseEncoder(); + if ( ret != 0 ) + return ret; + ret = tryOpenEncoderWithInvalidBitrate(); + if ( ret != 0 ) + return ret; + ret = tryOpenEncoderWithInvalidFrameDuration(); + if ( ret != 0 ) + return ret; + ret = tryOpenEncoderWithInvalidSampleRate(); + if ( ret != 0 ) + return ret; + ret = tryCallEncoderApiWithInvalidParams(); + if ( ret != 0 ) + return ret; + ret = openCloseDecoderWithCaching(); + if ( ret != 0 ) + return ret; + ret = openCloseDecoderWithoutCaching(); + if ( ret != 0 ) + return ret; + ret = tryOpenDecoderWithInvalidFrameDuration(); + if ( ret != 0 ) + return ret; + ret = tryOpenDecoderWithInvalidSampleRate(); + if ( ret != 0 ) + return ret; + ret = tryCallDecoderApiWithInvalidParams(); + if ( ret != 0 ) + return ret; + ret = encodeOneFrame(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneMonoFrame(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_48kHz(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_32kHz(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneStereoFrameIvas20msLc3plus10ms_16kHz(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneStereoFrameIvas5msLc3plus5ms_48kHz(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneMonoFrameIvas20msLc3plus10ms_48kHz(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneMonoFrameIvas5msLc3plus5ms_48kHz(); + if ( ret != 0 ) + return ret; + ret = encodeAndDecodeOneStereoFrameIvas20msLc3plus2_5ms_48kHz(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_decode_all_subframes(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_dont_decode_last_2_subframes(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_dont_decode_last_3_subframes(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_skip_first_subframe(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_decode_cache(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_skip_first(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_dec_first(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_bundle_switches_dec_first(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_bundle_switches_skip_first(); + if ( ret != 0 ) + return ret; + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_get_active_dont_cache(); + if ( ret != 0 ) + return ret; +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_dec_first_no_caching(); + if ( ret != 0 ) + return ret; +#endif +#if 0 + ret = selectiveDecIvas5msLc3plus5ms_48kHz_scenario_decode_all_subframes(); + if(ret != 0) + return ret; + ret = selectiveDecIvas5msLc3plus5ms_48kHz_scenario_dont_decode_last_subframes(); + if(ret != 0) + return ret; +#endif + return ret; +} diff --git a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test_selective_decoding.c b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test_selective_decoding.c new file mode 100644 index 0000000000..d90e98ed5b --- /dev/null +++ b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test_selective_decoding.c @@ -0,0 +1,1954 @@ +/****************************************************************************************************** + +(C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +the software. This notice grants no license of any kind, including but not limited to patent +license, nor is any license granted by implication, estoppel or otherwise. + +Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include "ivas_lc3plus_enc.h" +#include "ivas_lc3plus_common.h" +#include "ivas_lc3plus_dec.h" +#include "ivas_error_utils.h" + +#define MAX_SAMPLES_PER_CHANNEL 960 + +/* included by ivas_lc3plus_unit_test.c */ + +typedef int ( *ScenarioFnPtr )( const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE dec, + uint8_t *bitstream_in, + int32_t bitstream_in_size, + float **pcm_out ); + +static int encodeAndDecodeOne6chFrameFixture( LC3PLUS_CONFIG config, const int16_t enableCaching, const int32_t bps, ScenarioFnPtr scenarioFn ) +{ + ivas_error err; + int32_t encDelay = -1; + int32_t decDelay = -1; + + IVAS_LC3PLUS_ENC_HANDLE encHandle; + err = IVAS_LC3PLUS_ENC_Open( config, bps, &encHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_ENC_GetDelay( encHandle, &encDelay ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + if ( encDelay == -1 || encDelay == 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "encDelay is zero or uninitialized\n" ); + } + + /* encode one frame */ + int16_t numSamplesPerChannels = config.samplerate / ( 1000000 / config.ivas_frame_duration_us ); + float *pcm_in[6]; + float pcm_in_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_in_ch2[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch2, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_in_ch3[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch3, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_in_ch4[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch4, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_in_ch5[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch5, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_in_ch6[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_in_ch6, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_in[0] = pcm_in_ch1; + pcm_in[1] = pcm_in_ch2; + pcm_in[2] = pcm_in_ch3; + pcm_in[3] = pcm_in_ch4; + pcm_in[4] = pcm_in_ch5; + pcm_in[5] = pcm_in_ch6; + + int32_t bitstreamSizePerIvasFrame = 0; + err = IVAS_LC3PLUS_ENC_GetOutputBitstreamSize( encHandle, &bitstreamSizePerIvasFrame ); + if ( IVAS_ERR_OK != err ) + return err; + + uint8_t *bitstream_out = malloc( bitstreamSizePerIvasFrame ); + memset( bitstream_out, 0, bitstreamSizePerIvasFrame ); + + err = IVAS_LC3PLUS_ENC_Encode( encHandle, pcm_in, bitstream_out ); + if ( IVAS_ERR_OK != err ) + return err; + IVAS_LC3PLUS_ENC_Close( &encHandle ); + + /* decode one frame */ + IVAS_LC3PLUS_DEC_HANDLE decHandle; + err = IVAS_LC3PLUS_DEC_Open( config, +#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING + enableCaching, +#endif + &decHandle ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_GetDelay( decHandle, &decDelay ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + if ( decDelay == -1 || decDelay == 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "decDelay is zero or uninitialized\n" ); + } + + uint8_t *bitstream_in = bitstream_out; + + float *pcm_out[6]; + float pcm_out_ch1[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch1, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_out_ch2[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch2, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_out_ch3[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch3, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_out_ch4[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch4, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_out_ch5[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch5, 0, numSamplesPerChannels * sizeof( float ) ); + float pcm_out_ch6[MAX_SAMPLES_PER_CHANNEL * sizeof( float )]; + memset( pcm_out_ch6, 0, numSamplesPerChannels * sizeof( float ) ); + pcm_out[0] = pcm_out_ch1; + pcm_out[1] = pcm_out_ch2; + pcm_out[2] = pcm_out_ch3; + pcm_out[3] = pcm_out_ch4; + pcm_out[4] = pcm_out_ch5; + pcm_out[5] = pcm_out_ch6; + + err = IVAS_LC3PLUS_DEC_Conceal( decHandle, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstreamSizePerIvasFrame, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + if ( NULL != scenarioFn ) + { + err = ( *scenarioFn )( config, decHandle, bitstream_in, bitstreamSizePerIvasFrame, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstreamSizePerIvasFrame, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + err = IVAS_LC3PLUS_DEC_Conceal( decHandle, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + IVAS_LC3PLUS_DEC_Close( &decHandle ); + free( bitstream_out ); + + return 0; +} + +/* + * in: [dec, dec, dec, dec] + * expected out: [dec_and_use, dec_and_use, dec_and_use, dec_and_use] + */ +static int scenario_decode_all_subframes( const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + // const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + assert( decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame == 0 ); + if(NULL != decHandle->bitstream_caches) + { + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + } + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct post decoding state */ + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + + +/* + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, cache] + */ +static int scenario_dont_decode_last_2_subframes( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + if(NULL != decHandle->bitstream_caches) + { + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + } + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + +/* + * in: [dec, skip, skip, skip] + * expected out: [dec_and_use, skip, skip, cache] + */ +static int scenario_dont_decode_last_3_subframes( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 3 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last three subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframes before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 3 ) + { + /* subframes before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + + +/* + * in: [skip, dec, dec, dec] + * expected out: [dec_and_drop, dec_and_use, dec_and_use, dec_and_use] + */ +static int scenario_skip_first_subframe( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + if ( iSubframeIdx == 0 ) + { + /* skip the first subframe */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the following subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + + if ( iLc3plusFrame == 0 ) + { + /* first subframe is expected to be decoded and dropped */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_DROP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + +/* + * Step1: + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, cache] + * + * Step2: + * in: [dec, dec, dec, dec] + * expected out: [dec_cache & dec_and_use, dec_and_use, dec_and_use, dec_and_use] + */ +static int scenario_decode_cache( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2, ensure that the cache is used */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + /* decode all */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 1 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + +/* + * Step1: + * in: [skip, skip, dec, dec] + * expected out: [skip, dec_and_drop, dec_and_use, dec_and_use] + * + * Step2: + * in: [dec, dec, dec, dec] + * expected out: [no_cache & dec_and_use, dec_and_use, dec_and_use, dec_and_use] + */ +static int scenario_get_active_dont_cache( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions + * * expected out: [skip, dec_and_drop, dec_and_use, dec_and_use] */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 3 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_DROP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2, ensure that there is no cache */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + /* decode all [dec, dec, dec, dec]*/ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct decoder actions + * expected out: [no_cache & dec_and_use, dec_and_use, dec_and_use, dec_and_use]*/ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + + +/* + * Step1: + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, cache] + * + * Step2: + * in: [skip, dec, skip, dec] + * expected out: [drop_cache & dec_and_drop, dec_and_use, dec_and_drop, dec_and_use] + * */ +static int scenario_per_subframe_switches_skip_first( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2 + * in: [skip, dec, skip, dec] + * */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + if(iSubframeIdx == 0 || iSubframeIdx == 2) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else if(iSubframeIdx == 1 || iSubframeIdx == 3) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + else + { + //unsupported iSubframeIdx count; + return 1; + } + + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions + * expected out: [drop_cache & dec_and_drop, dec_and_use, dec_and_drop, dec_and_use] + * */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == 1 || iLc3plusFrame == 3) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 0 || iLc3plusFrame == 2) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_DROP ); + } + else + { + assert(0); + } + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + +/* + * Step1: + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, cache] + * + * Step2: + * in: [dec, skip, dec, skip] + * expected out: [dec_cache & dec_and_use, dec_and_drop, dec_and_use, cache] + * */ +static int scenario_per_subframe_switches_dec_first( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2 + * in: [dec, skip, dec, skip] + * */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + if(iSubframeIdx == 0 || iSubframeIdx == 2) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + else if(iSubframeIdx == 1 || iSubframeIdx == 3) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + // unsupported iSubframeIdx count + return 1; + } + + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions + * expected out: [dec_cache & dec_and_use, dec_and_drop, dec_and_use, cache] + * */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 1 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == 0 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 1 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_DROP ); + } + else if ( iLc3plusFrame == 2 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 3) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else + { + assert(0); + } + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + +/* + * Step1: + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, skip] + * + * Step2: + * in: [dec, skip, dec, skip] + * expected out: [drop_cache & dec_and_use, skip, dec_and_use, skip] + * */ +static int scenario_per_subframe_switches_dec_first_no_caching( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( NULL == decHandle->bitstream_caches ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( NULL == decHandle->bitstream_caches ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2 + * in: [dec, skip, dec, skip] + * */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + if(iSubframeIdx == 0 || iSubframeIdx == 2) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + else if(iSubframeIdx == 1 || iSubframeIdx == 3) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + // unsupported iSubframeIdx count + return 1; + } + + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions + * expected out: [drop_cache & dec_and_use, skip, dec_and_use, skip] + * */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( NULL == decHandle->bitstream_caches ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == 0 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 1 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else if ( iLc3plusFrame == 2 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 3) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert(0); + } + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( NULL == decHandle->bitstream_caches ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + + +/* + * Step1: + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, cache] + * + * Step2: + * in: [dec, skip, skip, dec] + * expected out: [dec_cache & dec_and_use, skip, dec_and_drop, dec_and_use] + * */ +static int scenario_per_subframe_bundle_switches_dec_first( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2 + * in: [dec, skip, skip, dec] + * */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + if(iSubframeIdx == 0 || iSubframeIdx == 3) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + else if(iSubframeIdx == 1 || iSubframeIdx == 2) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + // unsupported iSubframeIdx count + return 1; + } + + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions + * expected out: [dec_cache & dec_and_use, skip, dec_and_drop, dec_and_use] + * */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 1 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == 0 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 1 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else if ( iLc3plusFrame == 2 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_DROP ); + } + else if ( iLc3plusFrame == 3) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else + { + assert(0); + } + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + +/* + * Step1: + * in: [dec, dec, skip, skip] + * expected out: [dec_and_use, dec_and_use, skip, cache] + * + * Step2: + * in: [skip, dec, dec, skip] + * expected out: [drop_cache & dec_and_drop, dec_and_use, dec_and_use, cache] + * */ +static int scenario_per_subframe_bundle_switches_skip_first( + const LC3PLUS_CONFIG config, + IVAS_LC3PLUS_DEC_HANDLE decHandle, /* i: decoder handle */ + uint8_t *bitstream_in, /* i: pointer to input bitstream */ + int32_t bitstream_in_size, /* i: size of bitstream_in */ + float **pcm_out /* o: decoded samples */ ) +{ + ivas_error err; + const int16_t decode = 1; + const int16_t skipDecoding = 0; + uint32_t iDec = 0; + int iLc3plusFrame = 0; + int lc3framesPerIvasFrame; + int16_t **selective_decoding_matrix; + err = IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( &selective_decoding_matrix, config.channels ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* Set selective decoding scenario */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + assert( MAX_PARAM_SPATIAL_SUBFRAMES == 4 ); + if ( iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 1 || iSubframeIdx == MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) /*only valid for MAX_PARAM_SPATIAL_SUBFRAMES == 4 */ + { + /* skip the last two subframes */ + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + /* decode the previous ones */ + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + } + } + + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 0 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 == decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == lc3framesPerIvasFrame - 1 ) + { + /* last subframe is expected to be cached */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else if ( iLc3plusFrame == lc3framesPerIvasFrame - 2 ) + { + /* subframe before the last one is expected to be skipped, since only the last one is required to flush the decoder after a pause */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_SKIP ); + } + else + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + } + + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder caching */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + /* Step 2 + * in: [skip, dec, dec, skip] + * */ + for ( int16_t iSubframeIdx = 0; iSubframeIdx < MAX_PARAM_SPATIAL_SUBFRAMES; iSubframeIdx++ ) + { + for ( int16_t decIdx = 0; decIdx < config.channels; decIdx++ ) + { + if(iSubframeIdx == 1 || iSubframeIdx == 2) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = decode; + } + else if(iSubframeIdx == 0 || iSubframeIdx == 3) + { + selective_decoding_matrix[iSubframeIdx][decIdx] = skipDecoding; + } + else + { + // unsupported iSubframeIdx count + return 1; + } + + } + } + /* Apply selective decoding scenario */ + err = IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( decHandle, selective_decoding_matrix ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + + /* verify correct decoder actions + * expected out: [drop_cache & dec_and_drop, dec_and_use, dec_and_use, cache] + * */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + if ( iLc3plusFrame == 0 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_DROP ); + } + else if ( iLc3plusFrame == 1 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 2 ) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + else if ( iLc3plusFrame == 3) + { + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_CACHE ); + } + else + { + assert(0); + } + } + } + err = IVAS_LC3PLUS_DEC_Decode( decHandle, bitstream_in, bitstream_in_size, pcm_out ); + if ( IVAS_ERR_OK != err ) + { + return err; + } + /* verify correct post-decoding state */ + lc3framesPerIvasFrame = decHandle->config.ivas_frame_duration_us / decHandle->config.lc3plus_frame_duration_us; + for ( iDec = 0; iDec < decHandle->num_decs; iDec++ ) + { + assert( 1 == decHandle->selective_decoding_states[iDec]->has_skipped_a_frame ); + assert( 0 == decHandle->selective_decoding_states[iDec]->shall_decode_cached_frame ); + assert( 0 != decHandle->bitstream_caches[iDec]->bitstream_cache_size ); + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) + { + /* default action after decoding should be DEC_ACTION_DECODE_AND_USE again */ + assert( decHandle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] == DEC_ACTION_DECODE_AND_USE ); + } + } + + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( selective_decoding_matrix ); + return IVAS_ERR_OK; +} + + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_decode_all_subframes( void ) +{ + int err; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_decode_all_subframes ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_dont_decode_last_2_subframes( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_dont_decode_last_2_subframes ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_dont_decode_last_3_subframes( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_dont_decode_last_3_subframes ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_skip_first_subframe( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_skip_first_subframe ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_decode_cache( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_decode_cache ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_skip_first( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_per_subframe_switches_skip_first ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_dec_first( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_per_subframe_switches_dec_first ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_bundle_switches_dec_first( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_per_subframe_bundle_switches_dec_first ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_bundle_switches_skip_first( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_per_subframe_bundle_switches_skip_first ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_dec_first_no_caching( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 0; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_per_subframe_switches_dec_first_no_caching ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + + +static int selectiveDecIvas20msLc3plus5ms_48kHz_scenario_get_active_dont_cache( void ) +{ + int err = 0; + LC3PLUS_CONFIG config = { .lc3plus_frame_duration_us = 5 * 1000, .ivas_frame_duration_us = 20 * 1000, .channels = 6, .samplerate = 48000 }; + const int16_t enableCaching = 1; + err = encodeAndDecodeOne6chFrameFixture( config, enableCaching, 768000, &scenario_get_active_dont_cache ); + if ( 0 != err ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL, "test failed\n" ); + } + return err; +} + + + + + + diff --git a/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py b/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py new file mode 100755 index 0000000000..f72fce6a87 --- /dev/null +++ b/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py @@ -0,0 +1,173 @@ +""" +Generate command lines for split rendering with LC3plus +""" + +import itertools +import os + +# Paths +ENC_PATH = "./IVAS_cod" +DEC_PATH = "./IVAS_dec" +REND_PATH = "./IVAS_rend" +TEMP_DIR = "tmp" + +# Config values to iterate over +ISM_CONFIGS_NUM_OBJECTS = [1, 2, 3, 4] +IVAS_BITRATES = [128000] +PRE_HEAD_ROT_FILES = ["Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv"] +POST_HEAD_ROT_FILES = ["Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv"] +RENDER_CONFIG_FILES = [ + ####################################################### + # Alternative 2 - LC3plus with CLDFB pose correction + "Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt", + "Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt", + None, # Alternative 2 is the default when no rendering config file is given on command line + ####################################################### + # Alternative 3 - LC3plus with multi-stream (TD) pose correction + "Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt", + "Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt", +] + + +def audio_for_ism(num_objects): + return f"scripts/testv/stv{num_objects}ISM48s.wav" + + +def metadata_for_ism(num_objects): + return f"scripts/testv/stvISM{num_objects}.csv" + + +def basename(file_path): + basename_w_ext = os.path.basename(file_path) + return os.path.splitext(basename_w_ext)[0] + + +# Full chain: IVAS_cod -> IVAS_dec -> IVAS_rend(post) +def full_chain(num_objects, ivas_bitrate, pre_head_rot_file, render_config_file, post_head_rot_file): + bs_name = f"{TEMP_DIR}/ism{num_objects}_b{ivas_bitrate}_full_chain.g192" + cod = [ + ENC_PATH, + "-ism", + str(num_objects), + *[metadata_for_ism(i + 1) for i in range(num_objects)], + str(ivas_bitrate), + "48", + audio_for_ism(num_objects), + bs_name, + ] + + render_config_infix = f"##{basename(render_config_file)}" if render_config_file else "" + split_bs_name = bs_name.replace(".g192", f"##{basename(pre_head_rot_file)}{render_config_infix}##split.bs") + render_config_args = ["-render_config", render_config_file] if render_config_file else [] + dec = [ + DEC_PATH, + "-T", + pre_head_rot_file, + *render_config_args, + "SPLIT_BINAURAL", + "48", + bs_name, + split_bs_name, + ] + + binaural_output_name = split_bs_name.replace(".bs", f"##{basename(post_head_rot_file)}##binaural.wav") + rend = [ + REND_PATH, + "-i", + split_bs_name, + "-if", + "BINAURAL_SPLIT_CLDFB", + "-of", + "BINAURAL", + "-fs", + "48", + "-tf", + post_head_rot_file, + "-o", + binaural_output_name, + ] + + return [cod, dec, rend] + + +# Renderer chain: IVAS_rend(pre) -> IVAS_rend(post) +def rend_chain(num_objects, pre_head_rot_file, render_config_file, post_head_rot_file): + render_config_infix = f"##{basename(render_config_file)}" if render_config_file else "" + split_bs_name = ( + f"{TEMP_DIR}/ism{num_objects}_rend_chain##{basename(pre_head_rot_file)}{render_config_infix}##split.bs" + ) + render_config_args = ["-render_config", render_config_file] if render_config_file else [] + pre = [ + REND_PATH, + "-i", + audio_for_ism(num_objects), + "-if", + f"ISM{num_objects}", + "-im", + *[metadata_for_ism(i + 1) for i in range(num_objects)], + "-of", + "BINAURAL_SPLIT_CLDFB", + "-fs", + "48", + *render_config_args, + "-tf", + pre_head_rot_file, + "-o", + split_bs_name, + ] + + binaural_output_name = split_bs_name.replace(".bs", f"##{basename(post_head_rot_file)}##binaural.wav") + post = [ + REND_PATH, + "-i", + split_bs_name, + "-if", + "BINAURAL_SPLIT_CLDFB", + "-of", + "BINAURAL", + "-fs", + "48", + "-tf", + post_head_rot_file, + "-o", + binaural_output_name, + ] + + return [pre, post] + + +def print_command_list(list_of_lists): + for lst in list_of_lists: + print(" ".join(lst)) + print("") # newline + + +def main(): + print("\n##########################################") + print("# Full chain: enc -> dec -> rend(post)") + print("##########################################\n") + for args_full_chain in itertools.product( + # Ordering here must match argument order in function call below! + ISM_CONFIGS_NUM_OBJECTS, + IVAS_BITRATES, + PRE_HEAD_ROT_FILES, + RENDER_CONFIG_FILES, + POST_HEAD_ROT_FILES, + ): + print_command_list(full_chain(*args_full_chain)) + + print("\n##########################################") + print("# Renderer chain: rend(pre) -> rend(post)") + print("##########################################\n") + for args_rend_chain in itertools.product( + # Ordering here must match argument order in function call below! + ISM_CONFIGS_NUM_OBJECTS, + PRE_HEAD_ROT_FILES, + RENDER_CONFIG_FILES, + POST_HEAD_ROT_FILES, + ): + print_command_list(rend_chain(*args_rend_chain)) + + +if __name__ == "__main__": + main() -- GitLab From b174c8e996e728c8e15270700a38ef502aa2ac36 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 7 Jun 2023 12:31:18 +0200 Subject: [PATCH 143/591] [ci] revert accidental change to .gitlab-ci-custom.yml --- .gitlab-ci-custom.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-custom.yml b/.gitlab-ci-custom.yml index 3bc0785711..86c1f487e0 100644 --- a/.gitlab-ci-custom.yml +++ b/.gitlab-ci-custom.yml @@ -1,4 +1,4 @@ include: - project: $CUSTOM_CI_PROJECT - ref: lc3plus-integration-with-unit-tests + ref: $CUSTOM_CI_REF file: $CUSTOM_CI_FILE -- GitLab From 5afac642d22859ed963afad1a48ec93d10b38add Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 12 Jun 2023 11:05:49 +0200 Subject: [PATCH 144/591] fixes for support of IND_LIST_DYN + activate IND_LIST_DYN --- lib_com/bitstream.c | 86 ++++++++++++++++++++++++++++++++++++++++ lib_com/options.h | 4 +- lib_enc/ivas_enc.c | 13 ++++++ lib_enc/ivas_init_enc.c | 5 ++- lib_enc/ivas_omasa_enc.c | 16 +++++++- 5 files changed, 119 insertions(+), 5 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index aa46c531d1..5ac1b602ba 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -462,6 +462,47 @@ int16_t get_ivas_max_num_indices( /* o : maximum return 1650; } } +#ifdef MASA_AND_OBJECTS + else if ( ivas_format == MASA_ISM_FORMAT ) + { + if ( ivas_total_brate <= IVAS_16k4 ) + { + return 300; + } + else if ( ivas_total_brate <= IVAS_32k ) + { + return 400; + } + else if ( ivas_total_brate <= IVAS_48k ) + { + return 650; + } + else if ( ivas_total_brate <= IVAS_80k ) + { + return 750; + } + else if ( ivas_total_brate <= IVAS_160k ) + { + return 850; + } + else if ( ivas_total_brate <= IVAS_192k ) + { + return 950; + } + else if ( ivas_total_brate <= IVAS_256k ) + { + return 1150; + } + else if ( ivas_total_brate <= IVAS_384k ) + { + return 1450; + } + else + { + return 1650; + } + } +#endif else if ( ivas_format == MC_FORMAT ) { if ( ivas_total_brate <= IVAS_16k4 ) @@ -862,6 +903,51 @@ int16_t get_ivas_max_num_indices_metadata( /* o #endif } } +#ifdef MASA_AND_OBJECTS + else if ( ivas_format == MASA_ISM_FORMAT ) + { + if ( ivas_total_brate <= IVAS_16k4 ) + { + return 80; + } + else if ( ivas_total_brate <= IVAS_32k ) + { + return 125 + 100; + } + else if ( ivas_total_brate <= IVAS_48k ) + { + return 205 + 100; + } + else if ( ivas_total_brate <= IVAS_96k ) + { + return 240 + 100; + } + else if ( ivas_total_brate <= IVAS_128k ) + { + return 305 + 30; + } + else if ( ivas_total_brate <= IVAS_160k ) + { + return 425 + 30; + } + else if ( ivas_total_brate <= IVAS_192k ) + { + return 630 + 30; + } + else if ( ivas_total_brate <= IVAS_256k ) + { + return 850 + 30; + } + else if ( ivas_total_brate <= IVAS_384k ) + { + return 1000 + 30; + } + else + { + return 1750 + 30; + } + } +#endif else if ( ivas_format == MC_FORMAT ) { if ( ivas_total_brate <= IVAS_13k2 ) diff --git a/lib_com/options.h b/lib_com/options.h index ab71c50837..7fa5e09a70 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -134,8 +134,8 @@ /* ################# Start DEVELOPMENT switches ######################## */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ -/* Todo OMASA: This needs to be implemented for OMASA */ -/*#define IND_LIST_DYN */ /* VA: Issue 18: Dynamic allocation of ind_list[] and ind_list_metadata[] based on # of transport channels */ + +#define IND_LIST_DYN /* VA: Issue 18: Dynamic allocation of ind_list[] and ind_list_metadata[] based on # of transport channels */ #ifndef IND_LIST_DYN #define BITSTREAM_INDICES_MEMORY /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index ce7d6d764a..4cf4018cb6 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -319,7 +319,9 @@ ivas_error ivas_enc( return error; } +#ifndef IND_LIST_DYN hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; +#endif /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */ if ( ( st_ivas->hEncoderConfig->nchan_inp - hEncoderConfig->nchan_ism ) == 1 ) @@ -407,6 +409,17 @@ ivas_error ivas_enc( n = st_ivas->hEncoderConfig->nchan_ism; } +#ifdef IND_LIST_DYN + hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; + + if ( st_ivas->nSCE > 0 ) + { + /* update pointer to the buffer of indices (ISM indices were alredy written) */ + hMetaData->ind_list = st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData->ind_list + st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData->nb_ind_tot; + st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list = st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]->hBstr->ind_list + st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]->hBstr->nb_ind_tot; + } +#endif + /* Encode MASA parameters and write MASA metadata bitstream */ if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 2900d3e143..7e9f349e1d 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -661,12 +661,14 @@ ivas_error ivas_init_encoder( return error; } +#ifndef IND_LIST_DYN /* prepare bitstream buffers */ st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id]; reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id]; reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); +#endif } if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) @@ -706,7 +708,7 @@ ivas_error ivas_init_encoder( return error; } - +#ifndef IND_LIST_DYN /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -716,6 +718,7 @@ ivas_error ivas_init_encoder( st_ivas->hCPE[0]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; reset_indices_enc( st_ivas->hCPE[0]->hMetaData, MAX_BITS_METADATA ); +#endif } #endif else if ( ivas_format == MC_FORMAT ) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 03055d56cb..46b7c0418b 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -253,11 +253,23 @@ ivas_error ivas_omasa_enc_config( /* re-write IVAS format signalling - actual 'ism_mode' was not known before */ if ( st_ivas->nSCE > 0 ) { - reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->next_ind ); + reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, +#ifdef IND_LIST_DYN + st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot +#else + st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->next_ind +#endif + ); } else { - reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind ); + reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, +#ifdef IND_LIST_DYN + st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot +#else + st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind +#endif + ); } ivas_write_format( st_ivas ); -- GitLab From 65d7ce3950e593b6dc305576f46491827741b839 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 13 Jun 2023 13:21:25 +0530 Subject: [PATCH 145/591] Made correction in SID MD bits calculation --- lib_com/options.h | 2 +- lib_dec/ivas_qmetadata_dec.c | 5 +++++ lib_enc/ivas_qmetadata_enc.c | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index aafa43e9af..2f683d856b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,7 @@ #define MASA_PREREND /* Nokia: Contribution 42: Support for IVAS_rend to merge MASA + other format to MASA */ #define ISM_25k6_HZ_CORE /* VA: issue 540: 1ISM 48 kbps - change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core */ - +#define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_528_ISM_MD_FILE_TOO_SHORT /* VA: issue 528: ISM Metadata file too short */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index a9fc4693f0..ccb0b69844 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1187,8 +1187,13 @@ int16_t ivas_qmetadata_dec_sid_decode( if ( ivas_format == SBA_FORMAT ) { +#ifndef FIX_137_SID_MD_BITS /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ +#else + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ + +#endif } else { diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index ad34d810c1..c21463413d 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -985,8 +985,13 @@ void ivas_qmetadata_enc_sid_encode( if ( ivas_format == SBA_FORMAT ) { +#ifndef FIX_137_SID_MD_BITS /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ +#else + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ + +#endif } else { -- GitLab From 3b64b06c035bc2a0607456ced088a7b5b62e1fee Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 13 Jun 2023 11:23:59 +0300 Subject: [PATCH 146/591] Fix build with switch MASA_AND_OBJECTS inactive --- lib_dec/ivas_ism_metadata_dec.c | 1 + lib_dec/ivas_masa_dec.c | 6 +++++- lib_enc/ivas_masa_enc.c | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 4b154a22cd..8be626576b 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -174,6 +174,7 @@ ivas_error ivas_ism_metadata_dec( int16_t md_diff_flag[MAX_NUM_OBJECTS]; ivas_error error; + push_wmops( "ism_meta_dec" ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 6c0606de0f..310781c0c7 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -814,7 +814,11 @@ static ivas_error ivas_masa_dec_config( ivas_masa_set_coding_config(&(hMasa->config), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, (st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA)); #endif #ifdef HR_METADATA - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) +#ifdef MASA_AND_OBJECTS + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) +#else + if ((st_ivas->ivas_format == MASA_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k) +#endif { hMasa->config.mergeRatiosOverSubframes = 0; /* initialize spherical grid */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 4e2670ff9f..6db0dd1a0c 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -317,7 +317,11 @@ ivas_error ivas_masa_encode( } #ifdef HR_METADATA +#ifdef MASA_AND_OBJECTS if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && ivas_total_brate >= IVAS_384k ) +#else + if ( (ivas_format == MASA_FORMAT) && ivas_total_brate >= IVAS_384k ) +#endif { hMasa->config.mergeRatiosOverSubframes = 0; } -- GitLab From 7f6cdce89e8c43b9927cb3279553c5d726b3c94f Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 13 Jun 2023 11:58:41 +0300 Subject: [PATCH 147/591] Fix DIRAC_MAX_ANA_CHANS to FOA_CHANNELS within OMASA. --- lib_enc/ivas_omasa_enc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 46b7c0418b..00f61fca4a 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -56,9 +56,9 @@ static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCOD static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); -static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ); +static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ); -static void computeReferencePower_omasa( const int16_t *band_grouping, float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float *reference_power, const int16_t enc_param_start_band, const int16_t num_freq_bands ); +static void computeReferencePower_omasa( const int16_t *band_grouping, float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float *reference_power, const int16_t enc_param_start_band, const int16_t num_freq_bands ); /*--------------------------------------------------------------------------* @@ -753,8 +753,8 @@ static void ivas_omasa_param_est_enc( int16_t l_ts; float Chnl_RealBuffer[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; float Chnl_ImagBuffer[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; - float Foa_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; - float Foa_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + float Foa_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float Foa_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float diffuseness_vector[MASA_FREQUENCY_BANDS]; @@ -1057,8 +1057,8 @@ static void ivas_omasa_dmx( static void computeIntensityVector_enc( const int16_t *band_grouping, - float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], + float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ) { @@ -1095,8 +1095,8 @@ static void computeIntensityVector_enc( static void computeReferencePower_omasa( const int16_t *band_grouping, /* i : Band grouping for estimation */ - float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ - float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input signal */ + float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ + float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input signal */ float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands /* i : Number of frequency bands */ @@ -1111,7 +1111,7 @@ static void computeReferencePower_omasa( brange[1] = band_grouping[i + enc_param_start_band + 1]; reference_power[i] = 0; - for ( ch_idx = 0; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) + for ( ch_idx = 0; ch_idx < FOA_CHANNELS; ch_idx++ ) { /* abs()^2 */ for ( j = brange[0]; j < brange[1]; j++ ) -- GitLab From 39836d9722636edf23dbb48647054b5e4ffe6044 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 11:18:52 +0200 Subject: [PATCH 148/591] fix crash in bitrate switching --- lib_enc/ivas_omasa_enc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 00f61fca4a..24d1cfe140 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -265,7 +265,7 @@ ivas_error ivas_omasa_enc_config( { reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, #ifdef IND_LIST_DYN - st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot + st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->nb_bits_tot #else st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind #endif @@ -1094,12 +1094,12 @@ static void computeIntensityVector_enc( static void computeReferencePower_omasa( - const int16_t *band_grouping, /* i : Band grouping for estimation */ + const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Imag part of input signal */ - float *reference_power, /* o : Estimated power */ - const int16_t enc_param_start_band, /* i : first band to process */ - const int16_t num_freq_bands /* i : Number of frequency bands */ + float *reference_power, /* o : Estimated power */ + const int16_t enc_param_start_band, /* i : first band to process */ + const int16_t num_freq_bands /* i : Number of frequency bands */ ) { int16_t brange[2]; -- GitLab From e380832aff0c2fda4b0341138715018a6bfc5baa Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 11:23:26 +0200 Subject: [PATCH 149/591] clang-format --- lib_dec/ivas_dirac_dec.c | 8 ++-- lib_dec/ivas_masa_dec.c | 44 ++++++++++---------- lib_enc/ivas_ism_metadata_enc.c | 4 +- lib_enc/ivas_masa_enc.c | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 3 +- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index fbdd9f76f5..4796b15788 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3784,7 +3784,7 @@ static void initDiffuseResponses( #ifdef MASA_AND_OBJECTS else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) #else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) #endif { mvr2r( diffuse_response_CICP6, diffuse_response_function, num_channels ); @@ -3792,7 +3792,7 @@ static void initDiffuseResponses( #ifdef MASA_AND_OBJECTS else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_2 ) && ( num_channels == 7 ) ) #else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) #endif { mvr2r( diffuse_response_CICP14, diffuse_response_function, num_channels ); @@ -3800,7 +3800,7 @@ static void initDiffuseResponses( #ifdef MASA_AND_OBJECTS else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) #else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) #endif { mvr2r( diffuse_response_CICP16, diffuse_response_function, num_channels ); @@ -3808,7 +3808,7 @@ static void initDiffuseResponses( #ifdef MASA_AND_OBJECTS else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) #else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) #endif { if ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 310781c0c7..633e4edfb2 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -314,25 +314,25 @@ ivas_error ivas_masa_decode( /* Remove already read bits from the bit budget */ hQMetaData->metadata_max_bits -= *nb_bits_read; #ifdef MASA_AND_OBJECTS - if (st_ivas->ivas_format == MASA_ISM_FORMAT) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - if (st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ) + if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - if (st_ivas->hDirAC != NULL) + if ( st_ivas->hDirAC != NULL ) { - *nb_bits_read += ivas_decode_masaism_metadata(hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length); + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); - for (obj = 0; obj <= st_ivas->nchan_ism; obj++) + for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) { - if (st_ivas->hMasaIsmData->idx_separated_ism == obj) + if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) { int16_t sf; int16_t meta_write_index; - for (sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++) + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - meta_write_index = (st_ivas->hDirAC->dirac_bs_md_write_idx + sf) % st_ivas->hDirAC->dirac_md_buffer_length; + meta_write_index = ( st_ivas->hDirAC->dirac_bs_md_write_idx + sf ) % st_ivas->hDirAC->dirac_md_buffer_length; st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->azimuth_ism[obj][meta_write_index]; st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->elevation_ism[obj][meta_write_index]; } @@ -341,8 +341,8 @@ ivas_error ivas_masa_decode( } else { - *nb_bits_read += ivas_decode_masaism_metadata(hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, 0, MAX_PARAM_SPATIAL_SUBFRAMES); + *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } } } @@ -392,10 +392,10 @@ ivas_error ivas_masa_decode( #endif #ifdef MASA_AND_OBJECTS - if (st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { /* Modify spatial metadata based on the MASA-to-total energy ratios */ - modify_masa_energy_ratios(hQMetaData); + modify_masa_energy_ratios( hQMetaData ); } #endif @@ -791,33 +791,33 @@ static ivas_error ivas_masa_dec_config( #ifdef MASA_AND_OBJECTS ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; ism_total_brate = 0; - if (st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && (st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ)) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) { - for (i = 0; i < st_ivas->nSCE; i++) + for ( i = 0; i < st_ivas->nSCE; i++ ) { ism_total_brate += st_ivas->hSCE[i]->element_brate; } } - ivas_masa_set_elements(ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate); + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); - if (st_ivas->ivas_format == MASA_ISM_FORMAT) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - ivas_masa_set_coding_config(&(hMasa->config), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE); + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); } else { - ivas_masa_set_coding_config(&(hMasa->config), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, (st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA)); + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); } #else - ivas_masa_set_elements(st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE); - ivas_masa_set_coding_config(&(hMasa->config), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, (st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA)); + ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); #endif #ifdef HR_METADATA #ifdef MASA_AND_OBJECTS if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) #else - if ((st_ivas->ivas_format == MASA_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k) + if ( ( st_ivas->ivas_format == MASA_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) #endif { hMasa->config.mergeRatiosOverSubframes = 0; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 457ba7bbd4..734a0cbd14 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -252,7 +252,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS else if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC ) #else - else if ( ism_mode == ISM_MODE_DISC ) + else if ( ism_mode == ISM_MODE_DISC ) #endif { if ( hIsmMeta[ch]->ism_metadata_flag == 1 ) @@ -897,7 +897,7 @@ ivas_error ivas_ism_metadata_enc_create( } else { - if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 6db0dd1a0c..5260e097dc 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -69,7 +69,7 @@ static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_H static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #endif -static void average_masa_metadata(MASA_METADATA_FRAME* masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] +static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] #ifdef HR_METADATA , const SPHERICAL_GRID_DATA *sphGrid @@ -320,7 +320,7 @@ ivas_error ivas_masa_encode( #ifdef MASA_AND_OBJECTS if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) && ivas_total_brate >= IVAS_384k ) #else - if ( (ivas_format == MASA_FORMAT) && ivas_total_brate >= IVAS_384k ) + if ( ( ivas_format == MASA_FORMAT ) && ivas_total_brate >= IVAS_384k ) #endif { hMasa->config.mergeRatiosOverSubframes = 0; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 6401243fb4..00f86731e5 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -826,7 +826,6 @@ static void ivas_dirac_dec_decorrelate_slot( } - static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -958,7 +957,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Determine target covariance matrix containing target binaural properties */ for ( bin = 0; bin < nBins; bin++ ) { - float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ #ifdef MASA_AND_OBJECTS float diffusenessValForDecorrelationReduction = 1.0f; float diffEneValForDecorrelationReduction; -- GitLab From 7b4ed8589c95fe2778ddd5234fea5ac79b7818ac Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 12:09:18 +0200 Subject: [PATCH 150/591] activate FIX_356_ISM_METADATA_SYNC; intorduce FIX_356_ISM_METADATA_SYNC_OMASA to temporarily keep BE in OMASA --- lib_com/options.h | 4 ++-- lib_dec/ivas_objectRenderer_internal.c | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7fa5e09a70..1fd31be0c5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,8 +158,7 @@ #define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ #define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ -/* Todo OMASA: This switch causes more difference for OMASA path. Thus, disabled for OMASA currently. Enable to get BE to main. */ -/*#define FIX_356_ISM_METADATA_SYNC*/ /* Eri: issue 356: Metadata out-of-synch for -no_delay_comp */ +#define FIX_356_ISM_METADATA_SYNC /* Eri: issue 356: Metadata out-of-synch for -no_delay_comp */ #define FIX_446_STEREO_DMX_CRASH /* FhG: fix discrepancy with EVS code that could cause crashes in rare cases */ @@ -230,6 +229,7 @@ #define OMASA_ENERGIES #define FIX_OMASA_STEREO_SWITCHING /* VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps */ #define FIX_OMASA_BRSW /* Nokia + VA: Fix missing init of OMASA metadata delay buffers, brsw-related init fixes */ +#define FIX_356_ISM_METADATA_SYNC_OMASA #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 8d5f8e8772..21093ff266 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -114,6 +114,13 @@ ivas_error ivas_td_binaural_renderer( ism_md_subframe_update = 2; } +#ifdef FIX_356_ISM_METADATA_SYNC_OMASA + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + ism_md_subframe_update = 0; + } +#endif + return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, -- GitLab From 1d6ebb472f56cefd6eb65c789a4978c6a29adc0a Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 15:21:09 +0200 Subject: [PATCH 151/591] fix warnings --- lib_dec/ivas_dirac_output_synthesis_dec.c | 188 +++++++++++----------- lib_dec/ivas_init_dec.c | 7 +- lib_rend/ivas_objectRenderer.c | 44 ++--- lib_rend/lib_rend.c | 10 +- 4 files changed, 123 insertions(+), 126 deletions(-) diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 8de9c8539e..1c74fec901 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -625,119 +625,119 @@ void ivas_dirac_dec_output_synthesis_process_slot( } else // ( hDirAC->hConfig->dec_param_estim == TRUE ) if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { + { - /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hDirAC, - hVBAPdata, - NULL, + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, #ifdef MASA_AND_OBJECTS - NULL, + NULL, #endif - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); - - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); + + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) - { - int16_t k; - if ( ch_idx != 0 ) + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) { - float a, b, c; - - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) + int16_t k; + if ( ch_idx != 0 ) { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + float a, b, c; + + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } } - for ( ; k < num_freq_bands; k++ ) + else { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } } - else + + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - } - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); - } + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirAC->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + return; + } + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } - - return; - } - else - { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); } - } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 6e730727cf..5d4b7812c0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -731,7 +731,11 @@ ivas_error ivas_init_decoder( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { +#ifdef MASA_AND_OBJECTS + int16_t i, n, k; +#else int16_t i, n; +#endif int16_t sce_id, cpe_id; int16_t numCldfbAnalyses, numCldfbSyntheses; int16_t granularity, n_channels_transport_jbm; @@ -743,6 +747,7 @@ ivas_error ivas_init_decoder( #ifdef MASA_AND_OBJECTS int32_t ism_total_brate; #endif + error = IVAS_ERR_OK; output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -1061,7 +1066,7 @@ ivas_error ivas_init_decoder( return error; } - int16_t k = 0; + k = 0; ism_total_brate = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 1ffbeecec9..f9831d4ce5 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -275,13 +275,13 @@ ivas_error ivas_td_binaural_renderer_unwrap( #ifdef EXTERNAL_ORIENTATIONS const int16_t *enableCombinedOrientation, /* i : Combined orientation flag */ #else - const int16_t Opt_Headrotation, /* i : Head rotation flag */ + const int16_t Opt_Headrotation, /* i : Head rotation flag */ #endif - const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ - const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ + const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ + const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ ) { int16_t subframe_length; @@ -366,10 +366,10 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ - const int16_t subframe_length, /* i/o: subframe length */ - const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ - const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ + const int16_t subframe_length, /* i/o: subframe length */ + const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ + const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ ) { int16_t i; @@ -470,8 +470,8 @@ static void TDREND_Clear_Update_flags( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ - const IVAS_FORMAT in_format, /* i : Format of input sources */ - const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ + const IVAS_FORMAT in_format, /* i : Format of input sources */ + const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ ) { TDREND_DirAtten_t *DirAtten_p; @@ -552,13 +552,13 @@ void TDREND_Update_listener_orientation( #ifdef EXTERNAL_ORIENTATIONS if ( Pos != NULL ) { - /* Input position */ - Pos_p[0] = ( *Pos ).x; - Pos_p[1] = ( *Pos ).y; - Pos_p[2] = ( *Pos ).z; - } - else - { + /* Input position */ + Pos_p[0] = ( *Pos ).x; + Pos_p[1] = ( *Pos ).y; + Pos_p[2] = ( *Pos ).z; + } + else + { /* Listener at the origin */ Pos_p[0] = 0.0f; Pos_p[1] = 0.0f; @@ -649,13 +649,13 @@ ivas_error ivas_td_binaural_open_ext( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_ext( - const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ - const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ + const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ + const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ + const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ #ifdef EXTERNAL_ORIENTATIONS const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ #else - const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ + const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ #endif const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6b637b7767..3ceb66f2c5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5117,7 +5117,6 @@ static ivas_error renderIsmToBinauralRoom( } #ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG - static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -5452,13 +5451,6 @@ static ivas_error renderMcToBinaural( #else int8_t headRotEnabled; #endif - float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; - int16_t i; - - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - p_tmpRendBuffer[i] = tmpRendBuffer[i]; - } push_wmops( "renderMcToBinaural" ); @@ -5537,7 +5529,7 @@ static ivas_error renderMcToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + NULL, NULL, NULL, NULL, NULL /* ToDo: TBV */, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From f31a511372ff196a26bfd8ab50a3a1012c1e18dc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 16:01:40 +0200 Subject: [PATCH 152/591] formatting --- apps/encoder.c | 6 +- lib_com/ivas_prot.h | 8 +- lib_com/ivas_stat_com.h | 2 + lib_dec/ivas_cpe_dec.c | 1 + lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_dirac_output_synthesis_dec.c | 194 +++++++++---------- lib_dec/ivas_init_dec.c | 11 +- lib_dec/ivas_masa_dec.c | 2 + lib_dec/ivas_mono_dmx_renderer.c | 1 + lib_dec/ivas_omasa_dec.c | 2 + lib_dec/ivas_vbap.c | 14 +- lib_enc/ivas_cpe_enc.c | 1 - lib_enc/ivas_decision_matrix_enc.c | 1 + lib_enc/ivas_ism_metadata_enc.c | 4 - lib_enc/ivas_masa_enc.c | 14 +- lib_enc/ivas_qmetadata_enc.c | 3 + lib_enc/ivas_stat_enc.h | 2 +- lib_enc/lib_enc.c | 6 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 + lib_rend/ivas_objectRenderer.c | 1 + 21 files changed, 151 insertions(+), 128 deletions(-) diff --git a/apps/encoder.c b/apps/encoder.c index 567e32d431..66c64f39f3 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -97,6 +97,7 @@ typedef union _EncInputFormatConfig IVAS_ENC_MASA_VARIANT masaVariant; } masa_ism; #endif + } EncInputFormatConfig; /* Struct for storing cmdln arguments */ @@ -542,7 +543,6 @@ int main( } } - #ifdef MASA_AND_OBJECTS const int16_t numIsmInputs = ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_MASA_ISM ) ? arg.inputFormatConfig.ism.numObjects : 0; #else @@ -1809,8 +1809,8 @@ static void usage_enc( void ) fprintf( stdout, " for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); fprintf( stdout, " 96000, 128000, 160000, 192000, 256000, 384000, 512000) \n" ); #ifdef MASA_AND_OBJECTS - fprintf( stdout, " for IVAS MASA and objects R = (13200, 16400, 24400, 32000, 48000, 64000, 96000, 128000, \n" ); - fprintf( stdout, " 160000, 192000, 256000, 384000, 512000)\n" ); + fprintf( stdout, " for IVAS objects-MASA R =(13200, 16400, 24400, 32000, 48000, 64000, 96000, 128000, \n" ); + fprintf( stdout, " 160000, 192000, 256000, 384000, 512000)\n" ); #endif fprintf( stdout, " Alternatively, R can be a bitrate switching file which consists of R values\n" ); fprintf( stdout, " indicating the bitrate for each frame in bps. These values are stored in\n" ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 0d4c8dc241..09c08ccb29 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1024,7 +1024,7 @@ void ivas_ism_metadata_close( ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ #ifdef MASA_AND_OBJECTS , - const int16_t first_idx /* i : index of first handle to deallocate */ + const int16_t first_idx /* i : index of first handle to deallocate */ #endif ); @@ -5090,7 +5090,7 @@ ivas_error ivas_masa_encode( const int16_t ism_imp /* i : importance of separated object */ #ifdef OMASA_ENERGIES , - int16_t flag_omasa_brate /* i: flag for using less bitrate for objects in OMASA */ + const int16_t flag_omasa_brate /* i : flag for using less bitrate for objects in OMASA*/ #endif #endif ); @@ -5404,7 +5404,7 @@ ivas_error vbap_init_data( const int16_t num_speaker_nodes /* i : number of speaker nodes in the set */ #ifdef MASA_AND_OBJECTS , - const int16_t support_object_mode /* i : init VBAP also for object panning mode */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ #endif ); @@ -5706,7 +5706,7 @@ void ivas_omasa_set_config( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */ const int32_t input_Fs, /* i : Input sample rate */ - const ISM_MODE ism_mode /* i : ISM mode */ + const ISM_MODE ism_mode /* i : ISM mode */ ); void ivas_omasa_enc( diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index f0e5a05a97..9b8cee1df5 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -455,6 +455,7 @@ typedef struct ivas_omasa_meta_struct uint8_t num_dirs; MASA_DIRECTIONAL_SPATIAL_META directional_meta[MASA_MAXIMUM_DIRECTIONS]; MASA_COMMON_SPATIAL_META common_meta; + } OMASA_SPATIAL_META, *OMASA_SPATIAL_META_HANDLE; #endif @@ -570,6 +571,7 @@ typedef struct ivas_masa_qmetadata_frame_struct #ifdef MASA_AND_OBJECTS float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* TODO Nokia: This should be moved to some other place and reserved only when needed. */ #endif + } IVAS_QMETADATA, *IVAS_QMETADATA_HANDLE; diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 8a1d2e93e1..daf7056f7b 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -83,6 +83,7 @@ ivas_error ivas_cpe_dec( int32_t element_brate_ref; #endif #endif + error = IVAS_ERR_OK; push_wmops( "ivas_cpe_dec" ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4cb89aec42..6fb6cbc2cd 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -71,10 +71,10 @@ ivas_error ivas_dec( float pan_left, pan_right; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; - #ifdef MASA_AND_OBJECTS int32_t ism_total_brate; #endif + error = IVAS_ERR_OK; push_wmops( "ivas_dec" ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 1b76add66a..7197186a0b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -784,7 +784,7 @@ ivas_error ivas_dirac_dec_config( } #ifdef MASA_AND_OBJECTS - if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE, st_ivas->ivas_format == MASA_ISM_FORMAT ? 1 : 0 ) ) != IVAS_ERR_OK ) + if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE, st_ivas->ivas_format ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 1c74fec901..97bbbab852 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -623,121 +623,119 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->diffuse_power_factor ); } } - else // ( hDirAC->hConfig->dec_param_estim == TRUE ) - if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - - /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hDirAC, - hVBAPdata, - NULL, + else if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, #ifdef MASA_AND_OBJECTS - NULL, + NULL, #endif - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); - - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); + + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + { + int16_t k; + if ( ch_idx != 0 ) { - int16_t k; - if ( ch_idx != 0 ) - { - float a, b, c; + float a, b, c; - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); - } + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); } - else + for ( ; k < num_freq_bands; k++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); } } - - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); - } - - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } + } - return; + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) + { + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - else + + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirAC->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); } + + return; + } + else + { + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } + } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) @@ -1874,6 +1872,7 @@ void ivas_dirac_dec_compute_directional_responses( { /* Synthesize the first direction */ spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); + /* Synthesize the second direction and combine the gains */ #ifdef MASA_AND_OBJECTS if ( hDirAC->numParametricDirections == 2 ) @@ -2010,6 +2009,7 @@ void ivas_dirac_dec_compute_directional_responses( } normalizePanningGains( direct_response_ls, num_channels_dir ); } + #ifdef MASA_AND_OBJECTS // Todo OMASA JBM: Here we also probably need md_idx if ( hDirAC->numIsmDirections > 0 ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5d4b7812c0..f4f741bb8c 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -436,14 +436,13 @@ static ivas_error ivas_read_format( case 3: if ( st_ivas->bit_stream[*num_bits_read] ) { - ( *num_bits_read )++; st_ivas->ivas_format = MASA_FORMAT; } else { - ( *num_bits_read )++; st_ivas->ivas_format = SBA_FORMAT; } + ( *num_bits_read )++; break; } @@ -1009,7 +1008,7 @@ ivas_error ivas_init_decoder( } } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { @@ -1237,7 +1236,7 @@ ivas_error ivas_init_decoder( return error; } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { @@ -1304,7 +1303,7 @@ ivas_error ivas_init_decoder( ivas_mcmasa_split_brate( st_ivas->hOutSetup.separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { if ( ( error = create_sce_dec( st_ivas, sce_id, brate_sce ) ) != IVAS_ERR_OK ) { @@ -1314,7 +1313,7 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->element_mode_init = IVAS_CPE_MDCT; /* element_mode_init was IVAS_SCE for SCE initialization */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 6b8a947402..1251cecac3 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -309,6 +309,7 @@ ivas_error ivas_masa_decode( /* Remove already read bits from the bit budget */ hQMetaData->metadata_max_bits -= *nb_bits_read; + #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { @@ -351,6 +352,7 @@ ivas_error ivas_masa_decode( { total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); } + if ( total_brate >= IVAS_384k ) { if ( total_brate >= IVAS_512k ) diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 4e16edca30..61d8c68094 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -94,6 +94,7 @@ void ivas_mono_downmix_render_passive( MONO_DOWNMIX_RENDERER_HANDLE hDownmix; numInputChannels = st_ivas->nSCE; + #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index a198c6a774..40d505d5fc 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -183,6 +183,7 @@ ivas_error ivas_omasa_dec_config( /*-----------------------------------------------------------------* * Renderer selection *-----------------------------------------------------------------*/ + old_renderer_type = st_ivas->renderer_type; #endif @@ -296,6 +297,7 @@ ivas_error ivas_omasa_dec_config( /*-----------------------------------------------------------------* * Renderer selection *-----------------------------------------------------------------*/ + ivas_renderer_select( st_ivas ); /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index e45d525fc3..dcc73907e2 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -163,7 +163,7 @@ ivas_error vbap_init_data( const int16_t num_speaker_nodes /* i : number of speaker nodes in the set */ #ifdef MASA_AND_OBJECTS , - const int16_t support_object_mode /* i : init VBAP also for object panning mode */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ #endif ) { @@ -242,14 +242,16 @@ ivas_error vbap_init_data( } set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; + #ifdef MASA_AND_OBJECTS - if ( support_object_mode ) + if ( ivas_format == MASA_ISM_FORMAT ) { vbap->object_mode_bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->object_mode_bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->object_mode_bottom_virtual_speaker_node_division_gains != NULL; } #endif + speaker_node_azi_deg_internal[vbap->bottom_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->bottom_virtual_speaker_node_index] = -90.0f; } @@ -262,14 +264,16 @@ ivas_error vbap_init_data( } set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; + #ifdef MASA_AND_OBJECTS - if ( support_object_mode ) + if ( ivas_format == MASA_ISM_FORMAT ) { vbap->object_mode_top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->object_mode_top_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->object_mode_top_virtual_speaker_node_division_gains != NULL; } #endif + speaker_node_azi_deg_internal[vbap->top_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->top_virtual_speaker_node_index] = 90.0f; } @@ -283,7 +287,7 @@ ivas_error vbap_init_data( set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; #ifdef MASA_AND_OBJECTS - if ( support_object_mode ) + if ( ivas_format == MASA_ISM_FORMAT ) { vbap->object_mode_back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->object_mode_back_virtual_speaker_node_division_gains, num_speaker_nodes ); @@ -383,7 +387,7 @@ ivas_error vbap_init_data( determine_virtual_speaker_node_division_gains( vbap->top_virtual_speaker_node_index, vbap->top_virtual_speaker_node_division_gains, connections, virtual_top_type, max_num_connections, num_speaker_nodes, 0 ); determine_virtual_speaker_node_division_gains( vbap->bottom_virtual_speaker_node_index, vbap->bottom_virtual_speaker_node_division_gains, connections, virtual_bottom_type, max_num_connections, num_speaker_nodes, 0 ); determine_virtual_speaker_node_division_gains( vbap->back_virtual_speaker_node_index, vbap->back_virtual_speaker_node_division_gains, connections, virtual_back_type, max_num_connections, num_speaker_nodes, 0 ); - if ( support_object_mode ) + if ( ivas_format == MASA_ISM_FORMAT ) { determine_virtual_speaker_node_division_gains( vbap->top_virtual_speaker_node_index, vbap->object_mode_top_virtual_speaker_node_division_gains, connections, virtual_top_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); determine_virtual_speaker_node_division_gains( vbap->bottom_virtual_speaker_node_index, vbap->object_mode_bottom_virtual_speaker_node_division_gains, connections, virtual_bottom_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index f573b4ac6e..f099d448f4 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -327,7 +327,6 @@ ivas_error ivas_cpe_enc( } else { - #endif stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); #ifdef MASA_AND_OBJECTS diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 115a7eecde..2db13f8ecf 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -424,6 +424,7 @@ void ivas_signaling_enc( /*-------------------------------------------------------------------------- * Write element mode info *--------------------------------------------------------------------------*/ + #ifdef MASA_AND_OBJECTS if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && !MCT_flag ) /* note: in MCT, the MDCT stereo is used exclusively */ #else diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 734a0cbd14..fcceeca57d 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -341,11 +341,7 @@ ivas_error ivas_ism_metadata_enc( } /* write ISM metadata flag (one per object) */ -#ifdef MASA_AND_OBJECTS - for ( ch = 0; ch < nchan_transport; ch++ ) -#else for ( ch = 0; ch < nchan_transport; ch++ ) -#endif { #ifdef MASA_AND_OBJECTS if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 60e80bbfb3..4c1fd0644a 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -50,7 +50,6 @@ static void combine_freqbands_and_subframes( MASA_ENCODER_HANDLE hMasa ); #ifndef MASA_AND_OBJECTS static void combine_directions( MASA_ENCODER_HANDLE hMasa ); #endif - static void find_n_largest( const float *input, int16_t *largestIndices, const int16_t numElements, const int16_t numLargest ); static void move_metadata_to_qmetadata( const MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); @@ -140,6 +139,7 @@ ivas_error ivas_masa_enc_open( return error; } } + #ifdef MASA_AND_OBJECTS ism_total_brate = 0; if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) ) @@ -150,6 +150,7 @@ ivas_error ivas_masa_enc_open( } } #endif + ivas_masa_set_elements( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS @@ -248,7 +249,7 @@ ivas_error ivas_masa_encode( const int16_t ism_imp /* i : importance of separated object */ #ifdef OMASA_ENERGIES , - int16_t flag_omasa_brate /* i: flag for using less bitrate for objects in OMASA */ + const int16_t flag_omasa_brate /* i : flag for using less bitrate for objects in OMASA */ #endif #endif ) @@ -256,7 +257,6 @@ ivas_error ivas_masa_encode( MASA_DIRECTIONAL_SPATIAL_META *h_orig_metadata; int16_t i, j; int16_t masa_sid_descriptor; - #ifdef MASA_AND_OBJECTS int16_t low_bitrate_mode; #endif @@ -265,6 +265,7 @@ ivas_error ivas_masa_encode( h_orig_metadata = NULL; #ifdef MASA_AND_OBJECTS low_bitrate_mode = 0; + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) #else if ( ivas_format == MASA_FORMAT ) @@ -317,6 +318,7 @@ ivas_error ivas_masa_encode( /* Combine frequency bands and sub-frames */ combine_freqbands_and_subframes( hMasa ); } + #ifdef MASA_AND_OBJECTS if ( hMasa->config.numberOfDirections == 2 && hMasa->config.numTwoDirBands < hMasa->config.numCodingBands && ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) ) #else @@ -333,6 +335,7 @@ ivas_error ivas_masa_encode( /* Combine directions */ combine_directions( hMasa ); #endif + /* If we joined all bands, then metadata is now one directional. */ if ( hMasa->config.numTwoDirBands == 0 ) { @@ -350,7 +353,6 @@ ivas_error ivas_masa_encode( if ( ivas_format == MASA_FORMAT ) #endif { - #ifndef MASA_AND_OBJECTS /* write the number of MASA transport channels */ push_next_indice( hMetaData, nchan_transport - 1, MASA_TRANSP_BITS ); @@ -458,6 +460,7 @@ ivas_error ivas_masa_encode( #else reduce_metadata_further( hMasa, hQMetaData, ivas_format ); #endif + /* Write low bitrate mode. 1 signals that we have merged through time, 0 signals merge through frequency. */ push_next_indice( hMetaData, hQMetaData->q_direction[0].cfg.nblocks == 1 ? 1 : 0, MASA_LOWBITRATE_MODE_BITS ); hQMetaData->metadata_max_bits -= MASA_LOWBITRATE_MODE_BITS; @@ -476,6 +479,7 @@ ivas_error ivas_masa_encode( hQMetaData->masa_to_total_energy_ratio[0][0] = -1; /* signals NOT to adjust the energy ratios */ } #endif + /* Encode metadata */ #ifdef MASA_AND_OBJECTS int32_t total_brate; @@ -484,6 +488,7 @@ ivas_error ivas_masa_encode( { total_brate = calculate_cpe_brate_MASA_ISM( ism_mode, ivas_total_brate, nchan_ism ); } + if ( total_brate >= IVAS_384k ) { if ( total_brate >= IVAS_512k ) @@ -559,6 +564,7 @@ ivas_error ivas_masa_encode( #else combine_directions( hMasa ); #endif + /* If we joined all bands, then metadata is now one directional. */ if ( hMasa->config.numTwoDirBands == 0 ) { diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 6af86d0098..628bbe6cb5 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -144,6 +144,7 @@ static int16_t find_optimal_GR_order( const int16_t *q_idx, const int16_t len, i static int16_t find_optimal_GR_orders( const int16_t *q_idx, const int16_t len, const int16_t len_max_GR1, int16_t *GR1, int16_t *GR2, int16_t *i_min ); #endif + /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_encode() * @@ -3102,6 +3103,7 @@ static int16_t ivas_qmetadata_get_optimal_gr_param( * * *------------------------------------------------------------------------*/ + #ifndef MASA_AND_OBJECTS static #endif @@ -3248,6 +3250,7 @@ static int16_t ivas_qmetadata_reorder_azimuth_index( * * *------------------------------------------------------------------------*/ + #ifndef MASA_AND_OBJECTS static #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 1b2542e757..4f3a1eb162 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1221,7 +1221,7 @@ typedef struct MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; /* MC Param-Upmix handle */ MCMASA_ENC_HANDLE hMcMasa; /* Multi-channel MASA data handle */ #ifdef MASA_AND_OBJECTS - OMASA_ENC_HANDLE hOMasa; /* Object MASA data handle */ + OMASA_ENC_HANDLE hOMasa; /* Object-MASA data handle */ #endif LFE_ENC_HANDLE hLFE; /* LFE data handle */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 39d9f658cc..f47467aba8 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -383,6 +383,7 @@ ivas_error IVAS_ENC_ConfigureForStereo( return error; } + #ifdef MASA_AND_OBJECTS /*---------------------------------------------------------------------* * IVAS_ENC_ConfigureForMASAObjects() @@ -439,6 +440,7 @@ ivas_error IVAS_ENC_ConfigureForMASAObjects( } #endif + /*---------------------------------------------------------------------* * IVAS_ENC_ConfigureForObjects() * @@ -504,6 +506,7 @@ ivas_error IVAS_ENC_FeedObjectMetadata( { return IVAS_ERR_NOT_CONFIGURED; } + #ifdef MASA_AND_OBJECTS if ( hIvasEnc->st_ivas->hEncoderConfig->ivas_format != ISM_FORMAT && hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) #else @@ -664,6 +667,7 @@ ivas_error IVAS_ENC_FeedMasaMetadata( { return IVAS_ERR_NOT_CONFIGURED; } + #ifdef MASA_AND_OBJECTS if ( hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_FORMAT && hIvasEnc->st_ivas->hEncoderConfig->ivas_format != MASA_ISM_FORMAT ) #else @@ -758,6 +762,7 @@ static ivas_error configureEncoder( #ifdef MASA_AND_OBJECTS int32_t cpe_brate; #endif + error = IVAS_ERR_OK; st_ivas = hIvasEnc->st_ivas; @@ -898,7 +903,6 @@ static ivas_error configureEncoder( } } } - #ifdef MASA_AND_OBJECTS else if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index f2fe66d886..2c916691d0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1067,6 +1067,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric spreadCoh = 0.0f; } #endif + diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ #ifdef MASA_AND_OBJECTS @@ -1254,6 +1255,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; #endif + #ifdef MASA_AND_OBJECTS /* Modify also the value for decorrelation reduction */ diffEneValForDecorrelationReduction *= spectrumModVal; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index f9831d4ce5..82a08ef9d5 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -191,6 +191,7 @@ ivas_error ivas_td_binaural_open_unwrap( TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); } } + #ifdef MASA_AND_OBJECTS if ( ivas_format == ISM_FORMAT || ivas_format == MASA_ISM_FORMAT ) #else -- GitLab From 25903e4a4e1252a169c3e10218f9e6fbf4bd78ca Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 16:14:04 +0200 Subject: [PATCH 153/591] fix build warning --- lib_rend/lib_rend.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3ceb66f2c5..f57f06b887 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5125,13 +5125,6 @@ static ivas_error renderIsmToBinauralReverb( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; - float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; - - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - p_tmpRendBuffer[i] = tmpRendBuffer[i]; - } - push_wmops( "renderIsmToBinauralRoom" ); copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); -- GitLab From c2e627b35c7f9f39e3e93a6ea306b194f149aaf9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 Jun 2023 16:34:35 +0200 Subject: [PATCH 154/591] fix ext renderer failures --- lib_rend/lib_rend.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f57f06b887..3d841fef0e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5121,7 +5121,6 @@ static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { - int16_t i; float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; @@ -5444,6 +5443,13 @@ static ivas_error renderMcToBinaural( #else int8_t headRotEnabled; #endif + float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; + int16_t i; + + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpRendBuffer[i] = tmpRendBuffer[i]; + } push_wmops( "renderMcToBinaural" ); @@ -5522,7 +5528,7 @@ static ivas_error renderMcToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, NULL /* ToDo: TBV */, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From c394a0e063bc339e873f9ef7ca59535d056c8798 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 13 Jun 2023 18:22:15 +0200 Subject: [PATCH 155/591] Update contribution 35 - fixed Visual Studio build - fixed memory sanitizer issues for all split rendering modes - improved validation of split rendering configuration struct --- Workspace_msvc/Workspace_msvc.sln | 8 + Workspace_msvc/lib_rend.vcxproj | 10 + ...t_renderer_config_1536_2dof_tdposecorr.txt | 12 - ...t_renderer_config_1792_3dof_tdposecorr.txt | 12 - ...it_renderer_config_320_0dof_tdposecorr.txt | 12 - ...it_renderer_config_768_1dof_tdposecorr.txt | 12 - ...it_renderer_config_HBR_1dof_tdposecorr.txt | 12 - apps/decoder.c | 3 +- apps/renderer.c | 5 +- lib_com/ivas_cnst.h | 6 +- lib_com/ivas_error.h | 71 +++- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_init_dec.c | 11 +- lib_dec/ivas_rom_dec.c | 2 + lib_dec/ivas_sba_dec.c | 2 +- lib_dec/lib_dec.c | 67 +-- lib_enc/lib_enc.c | 66 +-- lib_rend/ivas_lc3plus_dec.c | 157 ++++--- lib_rend/ivas_lc3plus_dec.h | 18 +- lib_rend/ivas_prot_rend.h | 3 +- lib_rend/ivas_splitRendererPre.c | 19 +- lib_rend/ivas_splitRenderer_utils.c | 52 +++ lib_rend/lc3plus_codec/get_lc3plus.ps1 | 9 + lib_rend/lc3plus_codec/get_lc3plus.sh | 1 + lib_rend/lc3plus_codec/lc3plus.patch | 399 ++++++++++-------- lib_rend/lib_rend.c | 9 +- lib_util/render_config_reader.c | 2 +- lib_util/split_render_file_read_write.c | 8 +- lib_util/split_render_file_read_write.h | 6 +- 29 files changed, 515 insertions(+), 481 deletions(-) delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt create mode 100755 lib_rend/lc3plus_codec/get_lc3plus.ps1 diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index fbdb561ee2..5bf4656fd7 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -20,6 +20,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "..\lib_rend\lc3plus_codec\ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\msvc\LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" ProjectSection(SolutionItems) = preProject ..\.clang-format = ..\.clang-format @@ -87,6 +89,12 @@ Global {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.ActiveCfg = Release|Win32 {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|Win32.Build.0 = Release|Win32 {12B4C8A5-1E06-4E30-B443-D1F916F52B47}.Release|x64.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|Win32.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|Win32.Build.0 = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index cf98947589..9de01d06bb 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -199,6 +199,9 @@ + + + @@ -252,6 +255,9 @@ + + + @@ -262,6 +268,10 @@ {54509728-928b-44d9-a118-a6f92f08b34f} false + + {95030B82-70CD-4C6B-84D4-61096035BEA2} + false + diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt deleted file mode 100644 index 7ef48fb635..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt +++ /dev/null @@ -1,12 +0,0 @@ -[SPLITREND] -BITRATE = 1536000; -DOF = 2; -HQMODE = 0; -CODEC = 1; -POSECORRECTIONMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt deleted file mode 100644 index c77307afd6..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_1792_3dof_tdposecorr.txt +++ /dev/null @@ -1,12 +0,0 @@ -[SPLITREND] -BITRATE = 1792000; -DOF = 3; -HQMODE = 0; -CODEC = 1; -POSECORRECTIONMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt deleted file mode 100644 index c4457e80d7..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_320_0dof_tdposecorr.txt +++ /dev/null @@ -1,12 +0,0 @@ -[SPLITREND] -BITRATE = 320000; -DOF = 0; -HQMODE = 0; -CODEC = 1; -POSECORRECTIONMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt deleted file mode 100644 index ec5427bebc..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt +++ /dev/null @@ -1,12 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; -CODEC = 1; -POSECORRECTIONMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt b/Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt deleted file mode 100644 index 559352f637..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_HBR_1dof_tdposecorr.txt +++ /dev/null @@ -1,12 +0,0 @@ -[SPLITREND] -BITRATE = -1; -DOF = 1; -HQMODE = 0; -CODEC = 1; -POSECORRECTIONMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/apps/decoder.c b/apps/decoder.c index 75d0fd2ea7..25b1fdd405 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1413,7 +1413,8 @@ static ivas_error initOnFirstGoodFrame( splitRendBitsZero.bits_read = 0; if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written #ifdef SPLIT_REND_LC3PLUS - , -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE + , + -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE #endif ) != IVAS_ERR_OK ) { diff --git a/apps/renderer.c b/apps/renderer.c index eed31e9cfa..8f9408fee4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -983,7 +983,7 @@ int main( if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); + fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } @@ -995,7 +995,7 @@ int main( if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed\n" ); + fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1270,6 +1270,7 @@ int main( #endif outBuffer.config.numChannels = (int16_t) numOutChannels; outBuffer.data = outFloatBuffer; + memset( outBuffer.data, 0, outBuffer.config.numSamplesPerChannel * outBuffer.config.numChannels * sizeof( float ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 595e5578e9..53e812cde7 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1735,16 +1735,18 @@ typedef enum * Split rendering bitrate constants *----------------------------------------------------------------------------------*/ +#ifndef SPLIT_REND_LC3PLUS #define SIZE_SPLIT_REND_BRATE_TBL (4) +#endif #define SPLIT_REND_256k 256000 #ifdef SPLIT_REND_LC3PLUS -#define SPLIT_REND_320k 320000 /* TODO tmu: LC3plus 0DOF only at the moment - not included in SIZE_SPLIT_REND_BRATE_TBL! */ +#define SPLIT_REND_320k 320000 #endif #define SPLIT_REND_384k 384000 #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 #define SPLIT_REND_MAX_BRATE SPLIT_REND_768k -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_LC3PLUS_HBR_DBG #define SPLIT_REND_LC3PLUS_HBR 128000 /* bitrate per LC3plus core */ #endif diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index f4ea7ecb8c..234deaf241 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -56,7 +56,7 @@ typedef enum IVAS_ERR_INVALID_SAMPLING_RATE, IVAS_ERR_NOT_CONFIGURED, IVAS_ERR_INVALID_STEREO_MODE, - IVAS_ERR_INVALID_CICP_INDEX, + IVAS_ERR_INVALID_CICP_INDEX, /* ToDo: rename, CICP not used in IVAS anymore */ IVAS_ERR_INVALID_BITRATE, IVAS_ERR_INVALID_MASA_CONFIG, IVAS_ERR_TOO_MANY_INPUTS, @@ -72,17 +72,15 @@ typedef enum IVAS_ERR_INVALID_SPAR_CONFIG, IVAS_ERR_WRONG_PARAMS, IVAS_ERR_INIT_ERROR, - IVAS_ERR_DECODER_ERROR, IVAS_ERR_WRONG_MODE, IVAS_ERR_INVALID_OUTPUT_FORMAT, IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_INPUT_FORMAT, - IVAS_ERR_INVALID_INDEX, + IVAS_ERR_INVALID_INDEX, /* ToDo: should be merged with IVAS_ERR_INDEX_OUT_OF_BOUNDS */ IVAS_ERR_NOT_SUPPORTED_OPTION, IVAS_ERR_NOT_IMPLEMENTED, IVAS_ERR_WAITING_FOR_BITSTREAM, - IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH, IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_ISM_INVALID_METADATA_VALUE, IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, @@ -128,13 +126,14 @@ typedef enum * renderer (lib_rend only) * *----------------------------------------*/ - IVAS_ERR_NUM_CHANNELS_UNKNOWN, + IVAS_ERR_NUM_CHANNELS_UNKNOWN = 0x6000, IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT, IVAS_ERR_INVALID_INPUT_ID, IVAS_ERR_WRONG_NUM_CHANNELS, IVAS_ERR_INVALID_BUFFER_SIZE, #ifdef SPLIT_REND_LC3PLUS IVAS_ERR_LC3PLUS_INVALID_BITRATE, + IVAS_ERR_INVALID_SPLIT_REND_CONFIG, #endif /*----------------------------------------* @@ -182,9 +181,69 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Parse error"; case IVAS_ERR_END_OF_FILE: return "End of file"; + case IVAS_ERR_WRONG_PARAMS: + return "Wrong function parameters"; + case IVAS_ERR_INVALID_BANDWIDTH: + return "Invalid bandwidth"; + case IVAS_ERR_INVALID_DTX_UPDATE_RATE: + return "Invalid DTX update rate"; + case IVAS_ERR_NOT_CONFIGURED: + return "Handle has not been configured"; + case IVAS_ERR_INVALID_STEREO_MODE: + return "Invalid stereo mode"; + case IVAS_ERR_INVALID_CICP_INDEX: + return "Invalid speaker layout"; + case IVAS_ERR_INVALID_BITRATE: + return "Invalid bitrate"; + case IVAS_ERR_INVALID_MASA_CONFIG: + return "Invalid MASA config"; + case IVAS_ERR_TOO_MANY_INPUTS: + return "Too many object inputs provided"; + case IVAS_ERR_INDEX_OUT_OF_BOUNDS: + return "Index out of bounds"; + case IVAS_ERR_RECONFIGURE_NOT_SUPPORTED: + return "Reconfigure not supported"; + case IVAS_ERR_INVALID_FEC_OFFSET: + return "Invalid FEC offset"; + case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE: + return "Invalid input buffer size"; + case IVAS_ERR_DTX_NOT_SUPPORTED: + return "DTX is not supported in this IVAS format and element mode"; + case IVAS_ERR_UNEXPECTED_NULL_POINTER: + return "Unexpected NULL pointer"; + case IVAS_ERR_METADATA_NOT_EXPECTED: + return "Metadata input not expected for current configuration"; +#ifdef DEBUGGING + case IVAS_ERR_INVALID_FORCE_MODE: + return "Invalid force mode"; +#endif + case IVAS_ERR_NOT_IMPLEMENTED: + return "Not implemented"; + case IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT: + return "Invalid metadata file format"; + case IVAS_ERR_ISM_INVALID_METADATA_VALUE: + return "Invalid metadata value provided"; + case IVAS_ERR_NOT_SUPPORTED_OPTION: + return "Option not supported in this set-up"; + case IVAS_ERR_INIT_ERROR: + return "Initialization error"; + case IVAS_ERR_INVALID_BITSTREAM: + return "Invalid bitstream"; + case IVAS_ERR_WRONG_MODE: + return "Wrong mode"; + case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED: + return "Head rotation not supported"; + case IVAS_ERR_INVALID_HRTF: + return "Unsupported HRTF filter set"; + case IVAS_ERR_INVALID_INPUT_FORMAT: + return "Invalid format of input bitstream"; + case IVAS_ERR_INVALID_INDEX: + return "Invalid index"; #ifdef SPLIT_REND_LC3PLUS case IVAS_ERR_LC3PLUS_INVALID_BITRATE: - return "Specified split rendering bit rate is not supported by LC3plus"; + return "Specified split rendering bit rate is not supported"; + case IVAS_ERR_INVALID_SPLIT_REND_CONFIG: + return "Specified split rendering configuration is invalid"; #endif default: break; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ad7284cb4f..61435787cf 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -661,7 +661,7 @@ ivas_error ivas_dec( hSplitBinRend->hSplitRendBits, hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, - max_band, output, 1, + max_band, output, 1, #ifdef SPLIT_REND_LC3PLUS st_ivas->ivas_format != SBA_FORMAT, #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0582ed8844..a94dcfafb9 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1284,13 +1284,12 @@ ivas_error ivas_init_decoder( #ifdef SPLIT_REND_LC3PLUS if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); /* Split rendering with ISMs only supported with LC3plus */ - assert(st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS); + assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ); #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING error = diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 3608022efe..9c00833471 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -542,6 +542,7 @@ const float dmxmtx_table[BINAURAL_CHANNELS][11] = * split rendering ROM tables *-----------------------------------------------------------------------*/ +#ifndef SPLIT_REND_LC3PLUS /* Functionality moved to ivas_split_rend_validate_config() */ /*----------------------------------------------------------------------------------* * Table of Split rendering bitrates *----------------------------------------------------------------------------------*/ @@ -549,6 +550,7 @@ const int32_t split_rend_brate_tbl[SIZE_SPLIT_REND_BRATE_TBL] = { SPLIT_REND_256k, SPLIT_REND_384k, SPLIT_REND_512k, SPLIT_REND_768k }; +#endif /*rotations in this array are relative to ref rotation */ const float split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f}; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index d5733e77b4..e0880ab799 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -260,7 +260,7 @@ ivas_error ivas_sba_dec_reconfigure( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS - assert(st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LCLD); + assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LCLD ); #endif #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING error = diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 6ca89f3aea..9e1e5ef8eb 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -207,7 +207,7 @@ ivas_error IVAS_DEC_Open( return IVAS_ERR_WRONG_PARAMS; } - +#ifndef SPLIT_REND_LC3PLUS /* Functionality moved to ivas_split_rend_validate_config() */ #ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* * is_SplitRend_BitRate() @@ -230,6 +230,7 @@ static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) return 1; } #endif +#endif /*---------------------------------------------------------------------* * init_decoder_config() @@ -1243,6 +1244,9 @@ ivas_error IVAS_DEC_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; +#ifdef SPLIT_REND_LC3PLUS + ivas_error error; +#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hRenderConfig == NULL ) { @@ -1277,10 +1281,15 @@ ivas_error IVAS_DEC_FeedRenderConfig( #endif #ifdef SPLIT_REND_LC3PLUS /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ - if (hRenderConfig->split_rend_config.dof == 0) + if ( hRenderConfig->split_rend_config.dof == 0 ) { hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; } + + if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config ) ) != IVAS_ERR_OK ) + { + return error; + } #endif return IVAS_ERR_OK; @@ -1836,59 +1845,7 @@ const char *IVAS_DEC_GetErrorMessage( ivas_error error /* i : decoder error code enum */ ) { - switch ( error ) - { - case IVAS_ERR_OK: - return "no error"; - case IVAS_ERR_FAILED_ALLOC: - return "Failed allocation error"; - case IVAS_ERR_WRONG_PARAMS: - return "wrong parameters"; - case IVAS_ERR_INIT_ERROR: - return "initialization error"; - case IVAS_ERR_INVALID_BITSTREAM: - return "Invalid bitstream"; - case IVAS_ERR_DECODER_ERROR: - return "decoder error"; - case IVAS_ERR_WRONG_MODE: - return "wrong mode"; - case IVAS_ERR_INVALID_OUTPUT_FORMAT: - return "invalid output format"; - case IVAS_ERR_INVALID_SAMPLING_RATE: - return "invalid sampling rate"; - case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED: - return "head rotation not supported"; - case IVAS_ERR_INVALID_HRTF: - return "Not supported HRTF filter set"; - case IVAS_ERR_INVALID_INPUT_FORMAT: - return "invalid format of input bitstream"; - case IVAS_ERR_INVALID_INDEX: - return "invalid index"; - case IVAS_ERR_INTERNAL: - case IVAS_ERR_INTERNAL_FATAL: - return "internal error"; - case IVAS_ERR_RECONFIGURE_NOT_SUPPORTED: - return "reconfigure not supported"; - case IVAS_ERR_UNEXPECTED_NULL_POINTER: - return "unexpected NULL pointer"; -#ifdef DEBUGGING - case IVAS_ERR_INVALID_FORCE_MODE: - return "invalid force mode"; -#endif - case IVAS_ERR_FAILED_FILE_READ: - return "could not read from file"; - case IVAS_ERR_NOT_IMPLEMENTED: - return "not implemented"; -#ifdef SPLIT_REND_LC3PLUS - case IVAS_ERR_LC3PLUS_INVALID_BITRATE: - return ivas_error_to_string( IVAS_ERR_LC3PLUS_INVALID_BITRATE ); -#endif - case IVAS_ERR_UNKNOWN: - default: - break; - } - - return "unknown error"; + return ivas_error_to_string( error ); } diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 5b60da2759..9b31580938 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1376,71 +1376,7 @@ const char *IVAS_ENC_GetErrorMessage( ivas_error error /* i : encoder error code enum */ ) { - switch ( error ) - { - case IVAS_ERR_OK: - return "no error"; - case IVAS_ERR_FAILED_ALLOC: - return "Failed allocation error"; - case IVAS_ERR_WRONG_PARAMS: - return "wrong parameters"; - case IVAS_ERR_INVALID_BANDWIDTH: - return "invalid bandwidth"; - case IVAS_ERR_INVALID_DTX_UPDATE_RATE: - return "invalid DTX update rate"; - case IVAS_ERR_INVALID_SAMPLING_RATE: - return "invalid sampling rate"; - case IVAS_ERR_NOT_CONFIGURED: - return "encoder has not been configured"; - case IVAS_ERR_INVALID_STEREO_MODE: - return "invalid stereo mode"; - case IVAS_ERR_INVALID_CICP_INDEX: - return "invalid CICP index"; - case IVAS_ERR_INVALID_BITRATE: - return "invalid bitrate"; - case IVAS_ERR_INVALID_MASA_CONFIG: - return "invalid MASA config"; - case IVAS_ERR_TOO_MANY_INPUTS: - return "too many object inputs provided"; - case IVAS_ERR_INDEX_OUT_OF_BOUNDS: - return "index out of bounds"; - case IVAS_ERR_INTERNAL: - case IVAS_ERR_INTERNAL_FATAL: - return "internal error"; - case IVAS_ERR_RECONFIGURE_NOT_SUPPORTED: - return "reconfigure not supported"; - case IVAS_ERR_INVALID_FEC_OFFSET: - return "invalid FEC offset"; - case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE: - return "invalid input buffer size"; - case IVAS_ERR_DTX_NOT_SUPPORTED: - return "DTX is not supported in this IVAS format and element mode"; - case IVAS_ERR_UNEXPECTED_NULL_POINTER: - return "unexpected NULL pointer"; - case IVAS_ERR_METADATA_NOT_EXPECTED: - return "metadata input not expected for current configuration"; -#ifdef DEBUGGING - case IVAS_ERR_INVALID_FORCE_MODE: - return "invalid force mode"; -#endif - case IVAS_ERR_NOT_IMPLEMENTED: - return "not implemented"; - case IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH: - return "mismatched timestamp"; - case IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT: - return "invalid metadata format"; - case IVAS_ERR_ISM_INVALID_METADATA_VALUE: - return "invalid metadata value provided"; - case IVAS_ERR_FAILED_FILE_READ: - return "could not read from file"; - case IVAS_ERR_NOT_SUPPORTED_OPTION: - return "option not supported in this set-up"; - case IVAS_ERR_UNKNOWN: - default: - break; - } - - return "unknown error"; + return ivas_error_to_string( error ); } diff --git a/lib_rend/ivas_lc3plus_dec.c b/lib_rend/ivas_lc3plus_dec.c index 30a7941242..f81d7fd176 100644 --- a/lib_rend/ivas_lc3plus_dec.c +++ b/lib_rend/ivas_lc3plus_dec.c @@ -39,9 +39,9 @@ #include "wmc_auto.h" ivas_error IVAS_LC3PLUS_DEC_Open( - const LC3PLUS_CONFIG config, /* i: decoder configuration */ + const LC3PLUS_CONFIG config, /* i: decoder configuration */ #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */ + const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */ #endif IVAS_LC3PLUS_DEC_HANDLE *handle /* o: decoder handle */ ) @@ -57,12 +57,12 @@ ivas_error IVAS_LC3PLUS_DEC_Open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); } - if( 0 == config.lc3plus_frame_duration_us ) + if ( 0 == config.lc3plus_frame_duration_us ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid lc3plus_frame_duration_us (0)\n" ); } #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - (*handle)->cachingEnabled = enableCaching; + ( *handle )->cachingEnabled = enableCaching; #endif numLC3plusFramesPerIvasFrame = config.ivas_frame_duration_us / config.lc3plus_frame_duration_us; @@ -81,7 +81,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open( ( *handle )->bitstream_caches = NULL; ( *handle )->handles = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_HANDLE ) ); ( *handle )->selective_decoding_states = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE * ) ); - if ( NULL == ( *handle )->handles || NULL == ( *handle )->selective_decoding_states ) + if ( NULL == ( *handle )->handles || NULL == ( *handle )->selective_decoding_states ) { IVAS_LC3PLUS_DEC_Close( handle ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); @@ -93,10 +93,10 @@ ivas_error IVAS_LC3PLUS_DEC_Open( } #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - if(enableCaching) + if ( enableCaching ) { #endif - ( *handle )->bitstream_caches = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE* ) ); + ( *handle )->bitstream_caches = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE * ) ); if ( NULL == ( *handle )->bitstream_caches ) { IVAS_LC3PLUS_DEC_Close( handle ); @@ -113,7 +113,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open( for ( int32_t iCh = 0; iCh < config.channels; iCh++ ) { ( *handle )->selective_decoding_states[iCh] = NULL; - if(NULL != ( *handle )->bitstream_caches) + if ( NULL != ( *handle )->bitstream_caches ) { ( *handle )->bitstream_caches[iCh] = NULL; } @@ -153,7 +153,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open( IVAS_LC3PLUS_DEC_Close( handle ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); } - ( *handle )->selective_decoding_states[iCh]->frame_actions = malloc( numLC3plusFramesPerIvasFrame*sizeof(SelectiveDecAction) ); + ( *handle )->selective_decoding_states[iCh]->frame_actions = malloc( numLC3plusFramesPerIvasFrame * sizeof( SelectiveDecAction ) ); if ( NULL == ( *handle )->selective_decoding_states[iCh]->frame_actions ) { IVAS_LC3PLUS_DEC_Close( handle ); @@ -161,23 +161,23 @@ ivas_error IVAS_LC3PLUS_DEC_Open( } ( *handle )->selective_decoding_states[iCh]->has_skipped_a_frame = 0; ( *handle )->selective_decoding_states[iCh]->shall_decode_cached_frame = 0; - for(lc3plusFrameIdx = 0; lc3plusFrameIdx < numLC3plusFramesPerIvasFrame; lc3plusFrameIdx++) + for ( lc3plusFrameIdx = 0; lc3plusFrameIdx < numLC3plusFramesPerIvasFrame; lc3plusFrameIdx++ ) { ( *handle )->selective_decoding_states[iCh]->frame_actions[lc3plusFrameIdx] = DEC_ACTION_DECODE_AND_USE; } #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - if(enableCaching) + if ( enableCaching ) { #endif /* allocate and configure per LC3plus decoder bitstream cache */ - ( *handle )->bitstream_caches[iCh] = malloc( sizeof(IVAS_LC3PLUS_DEC_BITSTREAM_CACHE) ); + ( *handle )->bitstream_caches[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE ) ); if ( NULL == ( *handle )->bitstream_caches[iCh] ) { IVAS_LC3PLUS_DEC_Close( handle ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); } ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity = 400 /*LC3plus max non-HR octet count*/ * numLC3plusFramesPerIvasFrame; - ( *handle )->bitstream_caches[iCh]->bitstream_cache = malloc(( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity); + ( *handle )->bitstream_caches[iCh]->bitstream_cache = malloc( ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity ); if ( NULL == ( *handle )->bitstream_caches[iCh]->bitstream_cache ) { IVAS_LC3PLUS_DEC_Close( handle ); @@ -203,42 +203,41 @@ ivas_error IVAS_LC3PLUS_DEC_Open( return IVAS_ERR_OK; } -ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(int16_t ***subframeChannelMatrix, const uint32_t num_decs) +ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, const uint32_t num_decs ) { - *subframeChannelMatrix = malloc(MAX_PARAM_SPATIAL_SUBFRAMES * sizeof(int16_t *)); - if(NULL == *subframeChannelMatrix) + *subframeChannelMatrix = malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t * ) ); + if ( NULL == *subframeChannelMatrix ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" ); } - for (int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + for ( int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - (*subframeChannelMatrix)[i] = NULL; + ( *subframeChannelMatrix )[i] = NULL; } - for (int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + for ( int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - (*subframeChannelMatrix)[i] = malloc(num_decs * sizeof(int16_t)); - if(NULL == (*subframeChannelMatrix)[i]) + ( *subframeChannelMatrix )[i] = malloc( num_decs * sizeof( int16_t ) ); + if ( NULL == ( *subframeChannelMatrix )[i] ) { - IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(*subframeChannelMatrix); + IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( *subframeChannelMatrix ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" ); } } return IVAS_ERR_OK; } -void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(int16_t **subframeChannelMatrix) +void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix ) { - for (int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + for ( int i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - free(subframeChannelMatrix[i]); + free( subframeChannelMatrix[i] ); } - free(subframeChannelMatrix); + free( subframeChannelMatrix ); } ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ - int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] -) + int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] ) { int16_t numIvasSubFramesPerLC3frame; uint32_t decIdx; @@ -253,16 +252,16 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "subframeChannelMatrix is NULL\n" ); } - if(handle->config.lc3plus_frame_duration_us == 0 || handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) + if ( handle->config.lc3plus_frame_duration_us == 0 || handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "invalid ivas_frame_duration_us/lc3plus_frame_duration_us values\n" ); } - effectiveIvasSubframeDuration = handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us/MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us; - numIvasSubFramesPerLC3frame = handle->config.lc3plus_frame_duration_us/effectiveIvasSubframeDuration; + effectiveIvasSubframeDuration = handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us / MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us; + numIvasSubFramesPerLC3frame = handle->config.lc3plus_frame_duration_us / effectiveIvasSubframeDuration; actual_num_spatial_subframes = handle->config.ivas_frame_duration_us / effectiveIvasSubframeDuration; // 0.5(0) = 10ms lc3plus, 5ms subframe - if(numIvasSubFramesPerLC3frame != 1) + if ( numIvasSubFramesPerLC3frame != 1 ) { return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Selective decoding is only implemented for aligned IVAS-Subframes & LC3plus \n" ); } @@ -270,11 +269,11 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( /* map subframeChannelMatrix to lc3plus skip states */ /* 1st pass: Flag the required frames */ - for(decIdx = 0; decIdx < handle->num_decs; decIdx++) + for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ ) { - for( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) + for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) { - if( 1 == subframeChannelMatrix[ivasSubframeIdx][decIdx] ) + if ( 1 == subframeChannelMatrix[ivasSubframeIdx][decIdx] ) { /* subframe needed by the user, definitely decode */ handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_USE; @@ -283,11 +282,11 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( { /* subframe not needed by the user, but might be required to re-initialize a decoder after inactivity */ - if( + if ( #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING handle->cachingEnabled && #endif - (ivasSubframeIdx != actual_num_spatial_subframes - 1) && 1 == subframeChannelMatrix[ivasSubframeIdx + 1][decIdx] ) + ( ivasSubframeIdx != actual_num_spatial_subframes - 1 ) && 1 == subframeChannelMatrix[ivasSubframeIdx + 1][decIdx] ) { /* ... but if the following subframe is required, it needs to be decoded and dropped */ handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_DROP; @@ -300,23 +299,23 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( } } #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - if(handle->cachingEnabled) + if ( handle->cachingEnabled ) { #endif /* if a decoder was paused before, it needs to either: - * - Decode the cached frame (if available) and the first required frame OR - * - Decode the previous LC3plus subframe, even if it isn't needed by the user */ - for(decIdx = 0; decIdx < handle->num_decs; decIdx++) + * - Decode the cached frame (if available) and the first required frame OR + * - Decode the previous LC3plus subframe, even if it isn't needed by the user */ + for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ ) { - if( handle->selective_decoding_states[decIdx]->has_skipped_a_frame ) + if ( handle->selective_decoding_states[decIdx]->has_skipped_a_frame ) { /* find the first frame required by the user */ - for( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) + for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) { - if( DEC_ACTION_DECODE_AND_USE == handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] ) + if ( DEC_ACTION_DECODE_AND_USE == handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] ) { /* The first required frame is the first subframe. To flush the decoder, the cached frame must be decoded and dropped */ - if(0 == ivasSubframeIdx) + if ( 0 == ivasSubframeIdx ) { handle->selective_decoding_states[decIdx]->shall_decode_cached_frame = 1; break; @@ -333,12 +332,11 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( } /* if a dec gets paused & caching is activated we need to flag the last useful LC3plus frame for caching */ - for(decIdx = 0; decIdx < handle->num_decs; decIdx++) + for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ ) { - for( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) + for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) { - if( handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] == DEC_ACTION_SKIP - && handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] != DEC_ACTION_DECODE_AND_USE ) + if ( handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] == DEC_ACTION_SKIP && handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] != DEC_ACTION_DECODE_AND_USE ) { handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] = DEC_ACTION_CACHE; } @@ -394,7 +392,7 @@ void IVAS_LC3PLUS_DEC_Close( return; } #ifdef LC3PLUS_DEC_COLLECT_STATS - printLC3plusDecStats( &(*handle)->stats ); + printLC3plusDecStats( &( *handle )->stats ); #endif for ( uint32_t iDec = 0; iDec < ( *handle )->num_decs; iDec++ ) { @@ -421,7 +419,7 @@ void IVAS_LC3PLUS_DEC_Close( free( ( *handle )->pcm_conversion_buffer ); } free( ( *handle )->handles ); - if( NULL != ( *handle )->bitstream_caches ) + if ( NULL != ( *handle )->bitstream_caches ) { free( ( *handle )->bitstream_caches ); } @@ -431,11 +429,11 @@ void IVAS_LC3PLUS_DEC_Close( } static ivas_error decode_or_conceal_one_lc3plus_frame( - LC3PLUS_Dec* dec, - uint8_t* bitstream_in, + LC3PLUS_Dec *dec, + uint8_t *bitstream_in, const int32_t bitstream_in_length, int16_t **pcm_out_buffer, - const int32_t badFrameIndicator) + const int32_t badFrameIndicator ) { LC3PLUS_Error err; push_wmops( "lc3plus_dec16" ); @@ -448,7 +446,7 @@ static ivas_error decode_or_conceal_one_lc3plus_frame( } if ( err != LC3PLUS_OK ) { - return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr(err), "lc3plus_dec16 failed\n" ); + return IVAS_ERROR( IVAS_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_dec16 failed\n" ); } return IVAS_ERR_OK; } @@ -503,9 +501,9 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( { for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) { - if( handle->selective_decoding_states[iDec]->shall_decode_cached_frame) + if ( handle->selective_decoding_states[iDec]->shall_decode_cached_frame ) { - if(0 == handle->bitstream_caches[iDec]->bitstream_cache_size) + if ( 0 == handle->bitstream_caches[iDec]->bitstream_cache_size ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "LC3plus cache is empty\n" ); } @@ -515,7 +513,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( handle->bitstream_caches[iDec]->bitstream_cache_size, &handle->pcm_conversion_buffer, badFrameIndicator ); - if(err != IVAS_ERR_OK) + if ( err != IVAS_ERR_OK ) { return IVAS_ERROR( err, "lc3plus decoding failed\n" ); } @@ -526,7 +524,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( #endif } /* reset cache if caching is enabled - it has either been decoded or is not needed */ - if(NULL != handle->bitstream_caches) + if ( NULL != handle->bitstream_caches ) { handle->bitstream_caches[iDec]->bitstream_cache_size = 0; } @@ -538,7 +536,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( case DEC_ACTION_DECODE_AND_DROP: { err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in_iter, bitstreamOffsetPerCoder, &handle->pcm_conversion_buffer, badFrameIndicator ); - if(err != IVAS_ERR_OK) + if ( err != IVAS_ERR_OK ) { return IVAS_ERROR( err, "lc3plus decoding failed\n" ); } @@ -548,7 +546,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( case DEC_ACTION_DECODE_AND_USE: { err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in_iter, bitstreamOffsetPerCoder, &handle->pcm_conversion_buffer, badFrameIndicator ); - if(err != IVAS_ERR_OK) + if ( err != IVAS_ERR_OK ) { return IVAS_ERROR( err, "lc3plus decoding failed\n" ); } @@ -569,12 +567,12 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( } case DEC_ACTION_CACHE: { - if( handle->bitstream_caches[iDec]->bitstream_cache_capacity < bitstreamOffsetPerCoder ) + if ( handle->bitstream_caches[iDec]->bitstream_cache_capacity < bitstreamOffsetPerCoder ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "bitstream_cache_capacity is too low for LC3plus frame size\n" ); } /* store bit rate of cached frame */ - mvc2c(bitstream_in_iter, handle->bitstream_caches[iDec]->bitstream_cache, bitstreamOffsetPerCoder); + mvc2c( bitstream_in_iter, handle->bitstream_caches[iDec]->bitstream_cache, bitstreamOffsetPerCoder ); handle->bitstream_caches[iDec]->bitstream_cache_size = bitstreamOffsetPerCoder; /* log that this instance has skipped a frame and must decode twice once reactivated */ handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; @@ -587,7 +585,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( bitstream_in_iter += bitstreamOffsetPerCoder; } /* reset skipping state, must be set by the user before each decode call*/ - for(iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++) + for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) { handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] = DEC_ACTION_DECODE_AND_USE; } @@ -643,36 +641,33 @@ ivas_error IVAS_LC3PLUS_DEC_Conceal( #ifdef LC3PLUS_DEC_COLLECT_STATS -void printLC3plusDecStats(const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats) +void printLC3plusDecStats( const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats ) { int32_t sum_pushed_frames = 0; int32_t sum_decoded_and_dropped_frames, sum_skipped_frames; - sum_pushed_frames = stats->action_histogram[DEC_ACTION_DECODE_AND_USE] - + stats->action_histogram[DEC_ACTION_SKIP] - + stats->action_histogram[DEC_ACTION_CACHE]; + sum_pushed_frames = stats->action_histogram[DEC_ACTION_DECODE_AND_USE] + stats->action_histogram[DEC_ACTION_SKIP] + stats->action_histogram[DEC_ACTION_CACHE]; sum_decoded_and_dropped_frames = - stats->action_histogram[DEC_ACTION_DECODE_AND_DROP] - + stats->num_cached_frames_decoded_and_dropped; + stats->action_histogram[DEC_ACTION_DECODE_AND_DROP] + stats->num_cached_frames_decoded_and_dropped; sum_skipped_frames = stats->action_histogram[DEC_ACTION_SKIP] + stats->action_histogram[DEC_ACTION_CACHE]; - if( sum_pushed_frames == 0) + if ( sum_pushed_frames == 0 ) { - printf( "\n Dec didn't run"); + printf( "\n Dec didn't run" ); return; } - printf( "\nsum_pushed_frames: %i\n" , sum_pushed_frames ); - printf( " DECODE_AND_USE count: %i \n" , stats->action_histogram[DEC_ACTION_DECODE_AND_USE]); - printf( " SKIP count: %i\n" , stats->action_histogram[DEC_ACTION_SKIP]); - printf( " CACHE count: %i\n" , stats->action_histogram[DEC_ACTION_CACHE]); + printf( "\nsum_pushed_frames: %i\n", sum_pushed_frames ); + printf( " DECODE_AND_USE count: %i \n", stats->action_histogram[DEC_ACTION_DECODE_AND_USE] ); + printf( " SKIP count: %i\n", stats->action_histogram[DEC_ACTION_SKIP] ); + printf( " CACHE count: %i\n", stats->action_histogram[DEC_ACTION_CACHE] ); printf( "Decoded-and-Dropped:\n" ); - printf( " DECODE_AND_DROP count: %i \n" , stats->action_histogram[DEC_ACTION_DECODE_AND_DROP]); - printf( " DEC_CACHE count: %i\n" , stats->num_cached_frames_decoded_and_dropped); - printf( " perc of req : %f\n" , 100.f*(float)sum_decoded_and_dropped_frames/ sum_pushed_frames ); - printf( "Workload saved: \n"); - printf( " Skipped perc. of req %f\n", 100.f*(float)sum_skipped_frames/ sum_pushed_frames ); + printf( " DECODE_AND_DROP count: %i \n", stats->action_histogram[DEC_ACTION_DECODE_AND_DROP] ); + printf( " DEC_CACHE count: %i\n", stats->num_cached_frames_decoded_and_dropped ); + printf( " perc of req : %f\n", 100.f * (float) sum_decoded_and_dropped_frames / sum_pushed_frames ); + printf( "Workload saved: \n" ); + printf( " Skipped perc. of req %f\n", 100.f * (float) sum_skipped_frames / sum_pushed_frames ); } #endif diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h index 45bbef86a1..38abf70bd6 100644 --- a/lib_rend/ivas_lc3plus_dec.h +++ b/lib_rend/ivas_lc3plus_dec.h @@ -61,7 +61,7 @@ typedef struct IVAS_LC3PLUS_DEC_COLLECT_STATS int32_t num_cached_frames_decoded_and_dropped; } IVAS_LC3PLUS_DEC_COLLECT_STATS; -void printLC3plusDecStats(const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats); +void printLC3plusDecStats( const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats ); #endif typedef struct IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE @@ -76,9 +76,9 @@ typedef struct IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE typedef struct IVAS_LC3PLUS_DEC_BITSTREAM_CACHE { - uint8_t* bitstream_cache; - int32_t bitstream_cache_capacity; - int32_t bitstream_cache_size; + uint8_t *bitstream_cache; + int32_t bitstream_cache_capacity; + int32_t bitstream_cache_size; } IVAS_LC3PLUS_DEC_BITSTREAM_CACHE; /* decoder wrapper */ @@ -99,9 +99,9 @@ typedef struct IVAS_LC3PLUS_DEC_HANDLE } * IVAS_LC3PLUS_DEC_HANDLE; ivas_error IVAS_LC3PLUS_DEC_Open( - const LC3PLUS_CONFIG config, /* i: decoder configuration */ + const LC3PLUS_CONFIG config, /* i: decoder configuration */ #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */ + const int16_t enableCaching, /* i: if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */ #endif IVAS_LC3PLUS_DEC_HANDLE *handle /* o: decoder handle */ ); @@ -117,7 +117,7 @@ void IVAS_LC3PLUS_DEC_Close( /*! Sets a matrix[MAX_PARAM_SPATIAL_SUBFRAMES][numLC3plusDecoders] where all require subframes must be flagged with 1, frames that are not required with 0 */ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( - IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ + IVAS_LC3PLUS_DEC_HANDLE handle, /* i: decoder handle */ int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] /* i: */ ); @@ -133,6 +133,6 @@ ivas_error IVAS_LC3PLUS_DEC_Conceal( float **pcm_out /* o: concealed samples */ ); -ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(int16_t ***subframeChannelMatrix, uint32_t num_decs); +ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, uint32_t num_decs ); -void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix(int16_t **subframeChannelMatrix); +void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 1d5aec07fa..6149a97d71 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -579,6 +579,7 @@ int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, con int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ); int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); +ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig ); #endif void ivas_split_rend_get_quant_params( const int16_t num_md_bands, @@ -1106,7 +1107,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, #ifdef SPLIT_REND_LC3PLUS - const int8_t td_input, + int8_t td_input, #endif const int16_t pcm_out ); diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index ba1ce4244c..da1c8b9bca 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1307,7 +1307,7 @@ static void ivas_SplitRenderer_quant_code( void ivas_SplitRenderer_GetRotMd( - BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ + BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ @@ -1645,12 +1645,18 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, uint8_t useLc3plus; uint8_t isCldfbNeeded = 0; + if ( ( error = ivas_split_rend_validate_config( pSplitRendConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ #endif error = IVAS_ERR_OK; #ifdef SPLIT_REND_LC3PLUS - if ( is_cldfb_in == 0 ) + if ( + is_cldfb_in == 0 ) { isCldfbNeeded = 1; cldfbMode = CLDFB_ANALYSIS; @@ -1688,12 +1694,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, #else num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; #endif -#ifdef SPLIT_REND_LC3PLUS - if ( cldfbMode == CLDFB_SYNTHESIS ) - { - num_ch = BINAURAL_CHANNELS; - } -#endif + for ( ch = 0; ch < num_ch; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), @@ -2085,7 +2086,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, #ifdef SPLIT_REND_LC3PLUS - const int8_t td_input, + int8_t td_input, #endif const int16_t pcm_out ) { diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index b84c37dbb5..50d70ceb31 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -538,6 +538,58 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL /* Return size in bytes */ return bitrate / FRAMES_PER_SECOND / 8; } + +ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig ) +{ + /* Valid DOF range is 0-3 */ + if ( pSplitRendConfig->dof < 0 || pSplitRendConfig->dof > 3 ) + { + return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + } + + if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD ) + { + /* LCLD only supports CLDFB head pose correction */ + if ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + } + + /* LCLD doesn't support 0-DOF */ + if ( pSplitRendConfig->dof == 0 ) + { + return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + } + } + + /* Only CLDFB pose correction supports HQ mode */ + if ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB && pSplitRendConfig->hq_mode != 0 ) + { + return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + } + + /* Validate bitrate */ + switch ( pSplitRendConfig->splitRendBitRate ) + { + case SPLIT_REND_256k: + case SPLIT_REND_384k: + case SPLIT_REND_512k: + case SPLIT_REND_768k: + /* Always valid */ + break; + case SPLIT_REND_320k: + /* Only valid with 0 DOF */ + if ( pSplitRendConfig->dof != 0 ) + { + return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + } + break; + default: + return IVAS_ERR_LC3PLUS_INVALID_BITRATE; + } + + return IVAS_ERR_OK; +} #endif void ivas_split_rend_get_quant_params( diff --git a/lib_rend/lc3plus_codec/get_lc3plus.ps1 b/lib_rend/lc3plus_codec/get_lc3plus.ps1 new file mode 100755 index 0000000000..d660f78310 --- /dev/null +++ b/lib_rend/lc3plus_codec/get_lc3plus.ps1 @@ -0,0 +1,9 @@ +# This script shall only be used by automated continuous integration systems +# Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md +Remove-Item -Force -Recurse ETSI_Release -ErrorAction 'silentlycontinue' +(new-object System.Net.WebClient).DownloadFile('https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip',"$(pwd)\lc3plus_sources.zip") +Expand-Archive -Force -Path .\lc3plus_sources.zip -DestinationPath . +Remove-Item -Force lc3plus_sources.zip +git apply --ignore-whitespace lc3plus.patch +Remove-Item -Force ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\fft.c +Remove-Item -Force ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\codec_exe.c diff --git a/lib_rend/lc3plus_codec/get_lc3plus.sh b/lib_rend/lc3plus_codec/get_lc3plus.sh index ab578850cc..f605c98688 100755 --- a/lib_rend/lc3plus_codec/get_lc3plus.sh +++ b/lib_rend/lc3plus_codec/get_lc3plus.sh @@ -1,5 +1,6 @@ # This script shall only be used by automated continuous integration systems # Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md +rm -rf ETSI_Release curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip unzip lc3plus_sources.zip -d . rm -f lc3plus_sources.zip diff --git a/lib_rend/lc3plus_codec/lc3plus.patch b/lib_rend/lc3plus_codec/lc3plus.patch index 8ebffc6289..816f664fef 100644 --- a/lib_rend/lc3plus_codec/lc3plus.patch +++ b/lib_rend/lc3plus_codec/lc3plus.patch @@ -1,6 +1,6 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -11,7 +11,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -32,7 +32,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin blacklist[0] = 0; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -43,7 +43,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -83,7 +83,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin nbits_ari = nbits_ari + 8; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -94,7 +94,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -105,7 +105,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* DCT */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -116,7 +116,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -164,7 +164,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -193,7 +193,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (*lastnz > N) { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -214,7 +214,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin # ifdef ENABLE_025_DMS_MODE diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-05-26 10:23:38 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-05-31 14:59:52 @@ -24,13 +24,13 @@ typedef uint32_t LC3_UINT32; @@ -244,7 +244,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define LC3_SQRT(x) (sqrtf(x)) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -264,7 +264,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin brickwall = 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -289,7 +289,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* LSB mode bit */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -300,7 +300,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -331,7 +331,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-05-31 14:59:52 @@ -8,7 +8,7 @@ ******************************************************************************/ @@ -343,7 +343,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include /* for abs() */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-05-31 14:59:52 @@ -8,14 +8,15 @@ ******************************************************************************/ @@ -389,7 +389,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-05-26 10:23:38 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-05-31 14:59:52 @@ -12,6 +12,7 @@ #define IIS_FFT_H @@ -400,7 +400,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #ifdef __cplusplus diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -411,7 +411,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include /* for mmove */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-05-26 10:23:38 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-05-31 14:59:52 @@ -11,6 +11,7 @@ #ifndef IISFFT_H #define IISFFT_H @@ -420,112 +420,9 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #ifndef M_PIl #define M_PIl 3.1415926535897932384626433832795029L /* pi */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c 1970-01-01 01:00:00 -@@ -1,99 +0,0 @@ --/****************************************************************************** --* ETSI TS 103 634 V1.4.1 * --* Low Complexity Communication Codec Plus (LC3plus) * --* * --* Copyright licence is solely granted through ETSI Intellectual Property * --* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * --* estoppel or otherwise. * --******************************************************************************/ -- -- --#include "functions.h" --#include "fft/iis_fft.c" --#include "fft/iisfft.c" --#include "fft/cfft.c" -- --void fft_init(Fft* fft, int length) --{ -- assert(length % 2 == 0); -- HANDLE_IIS_FFT handle = NULL; -- IIS_FFT_ERROR error = 0; -- -- fft->length = length; -- -- error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); -- -- assert(error == IIS_FFT_NO_ERROR); -- fft->handle = handle; --} -- --void fft_free(Fft* fft) --{ -- IIS_FFT_ERROR error = 0; -- -- if (fft) { -- error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); -- -- assert(error == IIS_FFT_NO_ERROR); -- memset(fft, 0, sizeof(*fft)); -- } --} -- --void real_fft_free(Fft* fft) --{ -- IIS_FFT_ERROR error = 0; -- -- if (fft) { -- error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); -- -- assert(error == IIS_FFT_NO_ERROR); -- memset(fft, 0, sizeof(*fft)); -- } --} -- --void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) --{ -- assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ -- IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -- -- fft->length = length; -- -- error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); -- assert(error == IIS_FFT_NO_ERROR); -- fft->handle = *handle; --} -- -- --void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) --{ -- assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ -- IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -- -- fft->length = length; -- -- error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); -- -- assert(error == IIS_FFT_NO_ERROR); -- fft->handle = *handle; --} -- --void fft_apply(Fft* fft, const Complex* input, Complex* output) --{ -- IIS_FFT_ERROR error = 0; -- error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); -- -- assert(error == IIS_FFT_NO_ERROR); --} -- -- --void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) --{ -- IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -- -- UNUSED(error); -- -- error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); -- -- assert(error == IIS_FFT_NO_ERROR); --} -- diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -536,7 +433,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* Function expects already flipped window */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -667,7 +564,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin encoder->epmode = oldEpmode; // preserve old epmode in case of failure diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-05-31 14:59:52 @@ -0,0 +1,99 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * @@ -770,7 +667,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin +} diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -781,7 +678,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -792,7 +689,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -820,7 +717,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -829,9 +726,161 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include "functions.h" void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-06-12 14:50:03 +@@ -26,31 +26,18 @@ + + + +- Application ++ StaticLibrary + true + v141 + Unicode + + +- Application ++ StaticLibrary + false + v141 + true + Unicode + +- +- Application +- true +- v141 +- Unicode +- +- +- Application +- false +- v141 +- true +- Unicode +- + + + +@@ -62,12 +49,6 @@ + + + +- +- +- +- +- +- + + + true +@@ -75,30 +56,20 @@ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + +- +- true +- LC3plus +- $(Platform)\$(Configuration)\ +- $(Platform)\$(Configuration)\Obj\ +- + + false + LC3plus + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + +- +- false +- LC3plus +- $(Platform)\$(Configuration)\ +- $(Platform)\$(Configuration)\Obj\ +- + + + + + Level3 ++ ..\..\..\..\..\..\..\lib_com;%(AdditionalIncludeDirectories) + Disabled ++ MultiThreadedDebug + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4305;4244;4996 + +@@ -107,25 +78,14 @@ + true + + +- +- +- +- +- Level3 +- Disabled +- _DEBUG;_CONSOLE;%(PreprocessorDefinitions) +- +- +- Console +- true +- +- + + + Level3 + + ++ ..\..\..\..\..\..\..\lib_com;%(AdditionalIncludeDirectories) + MaxSpeed ++ MultiThreaded + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) +@@ -138,31 +98,12 @@ + true + + +- +- +- Level3 +- +- +- MaxSpeed +- true +- true +- NDEBUG;_CONSOLE;%(PreprocessorDefinitions) +- 4244;4305;4267;4996 +- +- +- Console +- true +- true +- true +- +- + + + + + + +- + + + +@@ -173,7 +114,7 @@ + + + +- ++ + + + diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-05-26 10:38:32 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-12 12:10:26 @@ -8,15 +8,16 @@ ******************************************************************************/ @@ -853,7 +902,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -864,7 +913,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -875,7 +924,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -886,7 +935,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -897,7 +946,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -908,7 +957,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -919,7 +968,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -930,7 +979,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -941,7 +990,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -952,7 +1001,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -963,7 +1012,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -974,7 +1023,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1003,7 +1052,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (prev_bfi_plc2 == 0) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1014,7 +1063,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1025,7 +1074,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1036,7 +1085,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1047,7 +1096,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1058,7 +1107,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1069,7 +1118,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1080,7 +1129,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1091,7 +1140,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1118,7 +1167,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1162,7 +1211,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-05-26 10:38:32 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-12 12:10:26 @@ -6,13 +6,14 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * @@ -1195,7 +1244,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1206,7 +1255,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1217,7 +1266,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-05-26 10:38:32 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-12 12:10:26 @@ -6,16 +6,17 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * @@ -1260,7 +1309,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin return; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1271,7 +1320,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin \***************************************************************************/ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1282,7 +1331,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1292,8 +1341,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-05-26 10:24:14 +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-12 12:26:35 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-12 12:28:54 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1304,7 +1353,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static LC3_INT sign(LC3_FLOAT x); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1315,7 +1364,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1366,7 +1415,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1377,7 +1426,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1388,7 +1437,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1399,7 +1448,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1444,7 +1493,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1496,7 +1545,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin setup->targetBitsInit = setup->targetBitsInit - 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1516,7 +1565,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* Downsampling */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1527,7 +1576,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1538,7 +1587,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-05-26 10:23:38 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-05-31 14:59:52 @@ -17,6 +17,7 @@ #include #include @@ -1549,7 +1598,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1560,7 +1609,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-05-26 10:24:14 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-05-31 14:59:52 @@ -8,6 +8,7 @@ ******************************************************************************/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e81a6a2b7c..1647424486 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2486,6 +2486,7 @@ updateSbaPanGains( &rendCtx.hhRendererConfig[0]->split_rend_config, &inputSba->splitRendWrapper.multiBinPoseData, rendCtx.pHeadRotData->sr_pose_pred_axis ); + #if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT /* TODO: redundant nested switch SPLIT_REND_WITH_HEAD_ROT */ if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) @@ -4527,6 +4528,7 @@ ivas_error IVAS_REND_InitConfig( return IVAS_ERR_OK; } +#ifndef SPLIT_REND_LC3PLUS /* Functionality moved to ivas_split_rend_validate_config() */ #ifdef SPLIT_REND_WITH_HEAD_ROT static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) { @@ -4544,6 +4546,7 @@ static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) return 1; } #endif +#endif /*-------------------------------------------------------------------* * IVAS_REND_GetRenderConfig() @@ -4660,6 +4663,11 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->split_rend_config.codec = renderConfig.split_rend_config.codec; + if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config ) ) != IVAS_ERR_OK ) + { + return error; + } + /* Must re-initialize split rendering config which depends on renderer config */ closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) @@ -6558,7 +6566,6 @@ static ivas_error renderSbaToSplitBinaural( push_wmops( "renderSbaToSplitBinaural" ); error = IVAS_ERR_OK; - ivas_renderSplitGetMultiBinPoseData( &sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config, &sbaInput->splitRendWrapper.multiBinPoseData, diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 5b0a308e06..dfc5c36e25 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -536,7 +536,7 @@ ivas_error RenderConfigReader_read( } } #ifdef SPLIT_REND_LC3PLUS - else if ( strcmp( item, "CODEC") == 0 ) + else if ( strcmp( item, "CODEC" ) == 0 ) { int16_t tmp; if ( !sscanf( pValue, "%hd", &tmp ) ) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 852d31b2db..2e9547ce08 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -151,7 +151,8 @@ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileR ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written #ifdef SPLIT_REND_LC3PLUS , - IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection + IVAS_SPLIT_REND_CODEC codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection #endif ) { @@ -213,7 +214,8 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written #ifdef SPLIT_REND_LC3PLUS , - IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE* poseCorrection + IVAS_SPLIT_REND_CODEC *codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection #endif ) { @@ -267,7 +269,7 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea } num_bytes = ( bit_len + 7 ) >> 3; - if ( fread( bits, sizeof( uint8_t ), num_bytes, hSplitRendFileReadWrite->file ) != (uint32_t)num_bytes ) + if ( fread( bits, sizeof( uint8_t ), num_bytes, hSplitRendFileReadWrite->file ) != (uint32_t) num_bytes ) { return IVAS_ERR_FAILED_FILE_READ; } diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 694774afd9..2ec0cdcb54 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -53,7 +53,8 @@ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileR ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written #ifdef SPLIT_REND_LC3PLUS , - IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection + IVAS_SPLIT_REND_CODEC codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection #endif ); @@ -61,7 +62,8 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written #ifdef SPLIT_REND_LC3PLUS , - IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection + IVAS_SPLIT_REND_CODEC *codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection #endif ); -- GitLab From f35a6797d6b1745de518ea83c0bb90f0a1950849 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 14 Jun 2023 11:38:43 +0530 Subject: [PATCH 156/591] Modified SID-MD bits calculation [x] Considered the SID format bits in the calculation --- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_enc/ivas_qmetadata_enc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index ccb0b69844..fc24398e39 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1191,7 +1191,7 @@ int16_t ivas_qmetadata_dec_sid_decode( /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ #else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index c21463413d..0f6ea973da 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -989,7 +989,7 @@ void ivas_qmetadata_enc_sid_encode( /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ #else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } -- GitLab From ad4a1668dae54ca014630c8d45f852f720f86d89 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 14 Jun 2023 13:29:54 +0530 Subject: [PATCH 157/591] Resolving the BR switching test cases failures. --- lib_com/ivas_prot.h | 11 ++++ lib_dec/ivas_sba_dec.c | 124 ++++++++++++++++++++++++++++++++++++- lib_dec/ivas_spar_md_dec.c | 28 ++++++--- 3 files changed, 151 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8d91fda692..bf918404ae 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4530,7 +4530,18 @@ void ivas_get_spar_md_from_dirac( int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate ); +#ifdef VLBR_20MS_MD + +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 */ + 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 */ + const int16_t num_channels ); /* i : number of internal channels */ + +#endif ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 79bde81a90..1a3a7517d6 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -110,7 +110,10 @@ ivas_error ivas_sba_dec_reconfigure( int16_t sba_dirac_stereo_flag_old; int32_t ivas_total_brate; int32_t last_ivas_total_brate; - +#ifdef VLBR_20MS_MD + int16_t num_channels, num_md_sub_frames; + int16_t i,j,k; +#endif RENDERER_TYPE old_renderer_type; DECODER_CONFIG_HANDLE hDecoderConfig; @@ -170,7 +173,7 @@ ivas_error ivas_sba_dec_reconfigure( hSpar->hPCA = NULL; } -#ifdef VLBR_20MS_MD +#ifndef VLBR_20MS_MD 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 ) || ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) ) #else 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 ) ) @@ -184,7 +187,65 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } +#ifdef VLBR_20MS_MD + 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 ); + if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, + num_md_sub_frames ) ) != IVAS_ERR_OK ) + { + return error; + } + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0; + } + } + } + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0; + } + } + } + } +#endif 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 @@ -194,7 +255,66 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } +#ifndef VLBR_20MS_MD + 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 ); + if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, + num_md_sub_frames ) ) != IVAS_ERR_OK ) + { + return error; + } + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0; + } + } + } + + } +#endif hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index ab2fd9a7c4..9e381f6900 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -96,11 +96,15 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder * * Allocate and initialize SPAR MD decoder matrices *------------------------------------------------------------------------*/ - -static 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 */ - const int16_t num_md_sub_frames ) +#ifdef VLBR_20MS_MD +ivas_error ivas_spar_md_dec_matrix_open +#else +static ivas_error ivas_spar_md_dec_matrix_open +#endif + ( + 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 ) { int16_t i, j; @@ -337,11 +341,15 @@ ivas_error ivas_spar_md_dec_open( * * Deallocate SPAR MD decoder matrices *------------------------------------------------------------------------*/ - -static void ivas_spar_md_dec_matrix_close( - ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels /* i : number of internal channels */ -) +#ifdef VLBR_20MS_MD +void ivas_spar_md_dec_matrix_close +#else +static void ivas_spar_md_dec_matrix_close +#endif + ( + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ + ) { int16_t i, j; -- GitLab From 2ffc67a7414f5e9e7c4aae77fe332b7636e4661d Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 14 Jun 2023 14:10:21 +0530 Subject: [PATCH 158/591] Minor clean up changes --- lib_dec/ivas_sba_dec.c | 63 ------------------------------------------ 1 file changed, 63 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3c7323008d..5394b8b9d8 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -173,11 +173,7 @@ ivas_error ivas_sba_dec_reconfigure( hSpar->hPCA = NULL; } -#ifndef VLBR_20MS_MD - 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 ) || ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) ) -#else 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 ) ) -#endif { ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); @@ -255,65 +251,6 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } -#ifndef VLBR_20MS_MD - 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 ); - if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, - num_md_sub_frames ) ) != IVAS_ERR_OK ) - { - return error; - } - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0; - } - } - } - - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0; - } - } - } - - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0; - } - } - } - - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0; - } - } - } - } -#endif hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -- GitLab From 38d9ee96531da70c65c207c36bbc31a04645aed2 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Wed, 14 Jun 2023 11:15:15 +0200 Subject: [PATCH 159/591] Move TDREND_PLAY_STATUS update outside the subframe loop --- lib_com/options.h | 3 ++- lib_rend/ivas_objectRenderer.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index aafa43e9af..2e6cb33e29 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,8 +185,9 @@ #define FIX_528_ISM_MD_FILE_TOO_SHORT /* VA: issue 528: ISM Metadata file too short */ +#define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ -/* ################## End DEVELOPMENT switches ######################### */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index d1858ee97f..44aedc5cfa 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -296,6 +296,16 @@ ivas_error ivas_td_binaural_renderer_unwrap( hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; c_indx++; } +#ifdef FIX_550_FIRST_FRAME_ACCESS + if (hIsmMetaData[nS]->non_diegetic_flag) + { + TDREND_MIX_SRC_SetPlayState(hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC); + } + else + { + TDREND_MIX_SRC_SetPlayState(hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING); + } +#endif } for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) @@ -489,11 +499,15 @@ void TDREND_Update_object_positions( Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; Pos[2] = 0; TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); +#ifndef FIX_550_FIRST_FRAME_ACCESS TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); +#endif } else { +#ifndef FIX_550_FIRST_FRAME_ACCESS TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); +#endif } TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); } -- GitLab From 60aa51b3b647c6992191d1eaf4207d24040814ad Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Wed, 14 Jun 2023 11:18:20 +0200 Subject: [PATCH 160/591] Include the condition for ISM format --- lib_rend/ivas_objectRenderer.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 44aedc5cfa..07c076edec 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -297,13 +297,16 @@ ivas_error ivas_td_binaural_renderer_unwrap( c_indx++; } #ifdef FIX_550_FIRST_FRAME_ACCESS - if (hIsmMetaData[nS]->non_diegetic_flag) + if ( ivas_format == ISM_FORMAT ) { - TDREND_MIX_SRC_SetPlayState(hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC); - } - else - { - TDREND_MIX_SRC_SetPlayState(hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING); + if ( hIsmMetaData[nS]->non_diegetic_flag ) + { + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); + } + else + { + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); + } } #endif } @@ -501,7 +504,7 @@ void TDREND_Update_object_positions( TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); #ifndef FIX_550_FIRST_FRAME_ACCESS TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); -#endif +#endif } else { -- GitLab From b1786afa8993d43fc570a9f1ede8e58f13407036 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 14 Jun 2023 15:01:50 +0530 Subject: [PATCH 161/591] Few more minor clean-up done --- lib_dec/ivas_sba_dec.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5394b8b9d8..d4d55504cc 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -110,6 +110,7 @@ ivas_error ivas_sba_dec_reconfigure( int16_t sba_dirac_stereo_flag_old; int32_t ivas_total_brate; int32_t last_ivas_total_brate; + #ifdef VLBR_20MS_MD int16_t num_channels, num_md_sub_frames; int16_t i, j, k; @@ -204,38 +205,8 @@ ivas_error ivas_sba_dec_reconfigure( for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) { st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0; - } - } - } - - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0; - } - } - } - - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0; - } - } - } - - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0; } } @@ -251,6 +222,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } + hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -- GitLab From 57f30a596e16da1dbf533fd751e4ba244922391d Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 14 Jun 2023 16:01:18 +0200 Subject: [PATCH 162/591] MASA_AND_OBJECTS fix within ISM_25k6_HZ_CORE --- lib_dec/ivas_sce_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 19c655c87a..9024e91e73 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -380,7 +380,11 @@ ivas_error create_sce_dec( st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; #ifdef ISM_25k6_HZ_CORE st->is_ism_format = 0; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) +#else if ( st_ivas->ivas_format == ISM_FORMAT ) +#endif { st->is_ism_format = 1; } -- GitLab From 619e2346bdcac9d7fa57e14d7cd9fb63cd53ac18 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 15 Jun 2023 11:56:01 +0530 Subject: [PATCH 163/591] Removed the code related to planarCP = 1 --- lib_com/ivas_prot.h | 10 ++- lib_com/ivas_spar_com.c | 21 +++-- lib_com/ivas_spar_com_quant_util.c | 14 ++- lib_com/options.h | 1 + lib_dec/ivas_spar_md_dec.c | 138 ++++++++++++++++++++++++----- lib_enc/ivas_spar_md_enc.c | 136 +++++++++++++++++++++++----- 6 files changed, 265 insertions(+), 55 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 646d025ec3..ad7161e1b5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4489,8 +4489,11 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, - const int16_t compute_p_flag, + const int16_t compute_p_flag +#ifndef FIX_280_PLANAR_CP + , const int16_t planarCP +#endif ); void ivas_get_spar_md_from_dirac( @@ -4957,8 +4960,11 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, - const ivas_coeffs_type_t coeff_type, + const ivas_coeffs_type_t coeff_type +#ifndef FIX_280_PLANAR_CP + , const int16_t planarCP +#endif ); void ivas_clear_band_coeffs( diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index c56421103d..59f976f4c9 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1253,10 +1253,16 @@ void ivas_calc_c_p_coeffs( const int16_t num_dmx, const int16_t band_idx, const int16_t dtx_vad, - const int16_t compute_p_flag, - const int16_t planarCP ) + const int16_t compute_p_flag +#ifndef FIX_280_PLANAR_CP + , + const int16_t planarCP +#endif +) { +#ifndef FIX_280_PLANAR_CP int16_t i, j; +#endif float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; if ( num_dmx != num_ch ) @@ -1267,7 +1273,7 @@ void ivas_calc_c_p_coeffs( { ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < num_ch - num_dmx; i++ ) @@ -1281,12 +1287,12 @@ void ivas_calc_c_p_coeffs( } } } - +#endif if ( compute_p_flag == 1 ) { ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = num_dmx; i < num_ch; i++ ) @@ -1297,6 +1303,7 @@ void ivas_calc_c_p_coeffs( } } } +#endif } return; @@ -1611,7 +1618,11 @@ void ivas_compute_spar_params( if ( ndm != num_ch ) { +#ifndef FIX_280_PLANAR_CP ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 ); +#else + ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 ); +#endif #ifdef SPAR_HOA_DBG /* if (b == 0) */ diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 355e02ca76..018bf33818 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -243,11 +243,17 @@ void ivas_copy_band_coeffs_idx_to_arr( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, - const ivas_coeffs_type_t coeff_type, - const int16_t planarCP ) + const ivas_coeffs_type_t coeff_type +#ifndef FIX_280_PLANAR_CP + , + const int16_t planarCP +#endif +) { int16_t i, len; +#ifndef FIX_280_PLANAR_CP int16_t j, k; +#endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) @@ -277,10 +283,13 @@ void ivas_copy_band_coeffs_idx_to_arr( len = pCell_dims[i].dim1 * pCell_dims[i].dim2; if ( ( coeff_type != DECX_COEFF ) ) { +#ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { +#endif mvs2s( pPtr_idx, pSymbol_re, len ); pSymbol_re += len; +#ifndef FIX_280_PLANAR_CP } else { @@ -295,6 +304,7 @@ void ivas_copy_band_coeffs_idx_to_arr( } pSymbol_re += k; } +#endif } } diff --git a/lib_com/options.h b/lib_com/options.h index a0864dee37..c5900869ab 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,7 @@ #define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ // #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ #define FIX_547_NAN_IGF_DEC /* FhG: issue 547: fix possible nan in IGF decoder */ +#define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 92e18c5c2c..2c212352d6 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -63,13 +63,21 @@ static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0 *------------------------------------------------------------------------------------------*/ static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr ); - +#ifndef FIX_280_PLANAR_CP static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, const int16_t planarCP ); static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type, const int16_t planarCP ); +#else +static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t strat, const int32_t ivas_total_brate ); + +static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw ); + +static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type ); + +#endif static void ivas_get_band_idx_from_differential( ivas_spar_md_t *pSpar_md, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const ivas_coeffs_type_t coeff_type ); static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); @@ -84,7 +92,12 @@ static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decode static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); +#ifndef FIX_280_PLANAR_CP static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); +#else +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode, const int32_t last_active_brate ); + +#endif /*------------------------------------------------------------------------- @@ -675,8 +688,10 @@ void ivas_spar_md_dec_process( ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, - st_ivas->last_active_ivas_total_brate ); +#ifndef FIX_280_PLANAR_CP + ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, +#endif + st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #if 0 { @@ -1697,7 +1712,9 @@ static void ivas_spar_dec_parse_md_bs( int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, +#ifndef FIX_280_PLANAR_CP const int16_t use_planar_coeff, +#endif const int16_t sba_inactive_mode, const int32_t last_active_brate ) { @@ -1707,7 +1724,9 @@ static void ivas_spar_dec_parse_md_bs( ivas_quant_strat_t qs; int16_t strat, freq_diff, no_ec; int16_t do_diff[IVAS_MAX_NUM_BANDS]; +#ifndef FIX_280_PLANAR_CP int16_t planarCP; +#endif float quant[IVAS_SPAR_MAX_C_COEFF]; int16_t do_repeat[IVAS_MAX_NUM_BANDS]; int16_t bw_final, bw_fact; @@ -1819,7 +1838,7 @@ static void ivas_spar_dec_parse_md_bs( } qs = hMdDec->spar_md_cfg.quant_strat[qsi]; - +#ifndef FIX_280_PLANAR_CP planarCP = 0; if ( ( qsi == 2 ) && ( use_planar_coeff ) ) { @@ -1828,6 +1847,7 @@ static void ivas_spar_dec_parse_md_bs( fprintf( stdout, "planarCP = 1\n" ); #endif } +#endif strat = get_next_indice( st0, 3 ); #ifdef SPAR_HOA_DBG @@ -1888,12 +1908,20 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { - ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, +#ifndef FIX_280_PLANAR_CP + planarCP, +#endif strat, ivas_total_brate ); } else { - ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw, planarCP ); + ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } for ( i = 0; i < *nB; i++ ) @@ -2036,7 +2064,9 @@ static void ivas_decode_arith_bs( const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, +#ifndef FIX_280_PLANAR_CP const int16_t planarCP, +#endif const int16_t strat, const int32_t ivas_total_brate ) { @@ -2111,13 +2141,23 @@ static void ivas_decode_arith_bs( } } } - ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.pred_arith_re[qsi], &hMdDec->arith_coeffs.pred_arith_re_diff[qsi], st0, pred_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); - ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) { @@ -2140,9 +2180,14 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) @@ -2150,17 +2195,27 @@ static void ivas_decode_arith_bs( drct_cell_dims[i].dim1 = drct_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } - +#endif ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.drct_arith_re[qsi], &hMdDec->arith_coeffs.drct_arith_re_diff[qsi], st0, drct_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); - ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF, planarCP ); + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) @@ -2168,18 +2223,33 @@ static void ivas_decode_arith_bs( decd_cell_dims[i].dim1 = decd_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } - +#endif ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.decd_arith_re[qsi], &hMdDec->arith_coeffs.decd_arith_re_diff[qsi], st0, decd_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); - ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF, planarCP ); + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } - ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF, planarCP ); + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( freq_diff == 1 ) { @@ -2291,10 +2361,18 @@ static void ivas_fill_band_coeffs_idx( const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, - const ivas_coeffs_type_t coeff_type, - const int16_t planarCP ) + const ivas_coeffs_type_t coeff_type +#ifndef FIX_280_PLANAR_CP + , + const int16_t planarCP +#endif +) { +#ifndef FIX_280_PLANAR_CP int16_t i, j, k, len; +#else + int16_t i, len; +#endif int16_t *pPtr_idx = NULL; for ( i = 0; i < nB; i++ ) @@ -2327,11 +2405,14 @@ static void ivas_fill_band_coeffs_idx( if ( coeff_type != DECX_COEFF ) { +#ifndef FIX_280_PLANAR_CP if ( ( coeff_type == PRED_COEFF ) || !planarCP ) { +#endif len = pCell_dims[i].dim1 * pCell_dims[i].dim2; mvs2s( pSymbol_re, pPtr_idx, len ); pSymbol_re += len; +#ifndef FIX_280_PLANAR_CP } else { @@ -2351,6 +2432,7 @@ static void ivas_fill_band_coeffs_idx( } pSymbol_re += k; } +#endif } } @@ -2369,8 +2451,12 @@ static void ivas_decode_huffman_bs( Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ const uint16_t qsi, const int16_t nB, - const int16_t bands_bw, - const int16_t planarCP ) + const int16_t bands_bw +#ifndef FIX_280_PLANAR_CP + , + const int16_t planarCP +#endif +) { int16_t i, j; int16_t ndm, ndec; @@ -2412,26 +2498,34 @@ static void ivas_decode_huffman_bs( for ( j = 0; j < drct_dim; j++ ) { +#ifndef FIX_280_PLANAR_CP if ( planarCP && !keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) { hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] = 0; } else { +#endif ivas_huffman_decode( &hMdDec->huff_coeffs.drct_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] ); +#ifndef FIX_280_PLANAR_CP } +#endif } for ( j = 0; j < decd_dim; j++ ) { +#ifndef FIX_280_PLANAR_CP if ( planarCP && !keep_planar[j] ) { hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] = 0; } else { +#endif ivas_huffman_decode( &hMdDec->huff_coeffs.decd_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] ); +#ifndef FIX_280_PLANAR_CP } +#endif } } diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index dbca3809cc..bd2f817b48 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -72,18 +72,28 @@ static void ivas_band_mixer( float *cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], #ifndef FIX_383_CLEAN_UP static void ivas_get_band_differential_index( ivas_band_coeffs_ind_t *pBand_idx, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const int16_t complex_cov, const int16_t dim, const ivas_coeffs_type_t coeff_type ); #endif - -static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); +static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, +#ifndef FIX_280_PLANAR_CP + const int16_t planarCP, +#endif + const int16_t bands_bw ); +#ifndef FIX_280_PLANAR_CP static int16_t ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); +#else +static int16_t ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t strat, const int32_t ivas_total_brate ); + +#endif static ivas_error ivas_spar_set_enc_config( ivas_spar_md_enc_state_t *hMdEnc, int16_t *max_freq_per_chan, const int16_t nchan_transport, float *pFC, const int16_t nchan_inp ); static void ivas_select_next_strat( ivas_strats_t prior_strat, ivas_strats_t cs[MAX_QUANT_STRATS], const int16_t dmx_switch, const int16_t dtx_vad ); static void ivas_store_prior_coeffs( ivas_spar_md_enc_state_t *hMdEnc, const int16_t num_bands, const int16_t strat, const int16_t dtx_vad, const int16_t qsi ); - +#ifndef FIX_280_PLANAR_CP static void ivas_write_spar_md_bitstream( ivas_spar_md_enc_state_t *hMdEnc, const int16_t nB, const int16_t bands_bw, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, const int16_t qsi, const int16_t planarCP ); - +#else +static void ivas_write_spar_md_bitstream( ivas_spar_md_enc_state_t *hMdEnc, const int16_t nB, const int16_t bands_bw, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, const int16_t qsi ); +#endif static void ivas_spar_quant_pred_coeffs_dtx( ivas_spar_md_t *pSpar_md, const float *pValues, const int16_t ndm, int16_t *pIndex, const int16_t dim1, float *pQuant ); static void ivas_quant_p_per_band_dtx( float *pP_mat, const int16_t num_dec, const int16_t num_dmx, int16_t *ppIdx_pd, float *pP_out, const int16_t num_ch ); @@ -571,7 +581,9 @@ ivas_error ivas_spar_md_enc_process( float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; int16_t i, j, b, qsi, ndm, ndec, num_ch, num_quant_strats; +#ifndef FIX_280_PLANAR_CP int16_t planarCP; +#endif float pred_coeffs_re_local[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; int16_t k, bwidth, num_bands, num_bands_full, num_bands_bw; int16_t active_w, nchan_transport, dmx_switch, strat; @@ -709,7 +721,9 @@ ivas_error ivas_spar_md_enc_process( #ifdef DEBUG_LBR_SBA float dirac_md_kbps = (float) ( hMetaData->nb_bits_tot ) * 50 / 1000; #endif +#ifndef FIX_280_PLANAR_CP planarCP = 0; +#endif code_strat = 0; #ifdef DEBUG_SBA_MD_DUMP ndec = -1; @@ -723,6 +737,7 @@ ivas_error ivas_spar_md_enc_process( #ifdef SPAR_HOA_DBG fprintf( stdout, "qsi = %d\n", qsi ); #endif +#ifndef FIX_280_PLANAR_CP if ( qsi == 2 && ivas_spar_br_table_consts[hMdEnc->table_idx].usePlanarCoeff ) { planarCP = 1; @@ -747,6 +762,7 @@ ivas_error ivas_spar_md_enc_process( } } } +#endif for ( b = 0; b < num_bands; b++ ) { ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[b * bands_bw]; @@ -770,7 +786,7 @@ ivas_error ivas_spar_md_enc_process( fprintf(stderr, "\n\n"); */ #endif - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < ndec; i++ ) @@ -793,6 +809,7 @@ ivas_error ivas_spar_md_enc_process( fprintf(stderr, "\n\n"); */ #endif } +#endif ivas_quant_p_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], num_ch ); } ivas_quant_pred_coeffs_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], num_ch ); @@ -885,7 +902,12 @@ ivas_error ivas_spar_md_enc_process( if ( ( ndm != num_ch ) && ( ndm != 1 ) ) { - ivas_calc_c_p_coeffs( &hMdEnc->spar_md, cov_real, 0, hMdEnc->mixer_mat, num_ch, ndm, b, dtx_vad, 0, planarCP ); + ivas_calc_c_p_coeffs( &hMdEnc->spar_md, cov_real, 0, hMdEnc->mixer_mat, num_ch, ndm, b, dtx_vad, 0 +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); #ifdef SPAR_HOA_DBG /*fprintf(stderr, "\n\n C coefficients: band %d\n", b); @@ -899,6 +921,7 @@ ivas_error ivas_spar_md_enc_process( } fprintf(stderr, "\n\n"); */ #endif +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < num_ch - ndm; i++ ) @@ -925,7 +948,7 @@ ivas_error ivas_spar_md_enc_process( fprintf(stderr, "\n\n"); */ #endif } - +#endif ivas_quant_c_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], ndec, ndm ); #ifdef SPAR_HOA_DBG @@ -964,7 +987,12 @@ ivas_error ivas_spar_md_enc_process( { reset_indices_enc( &hMetaData_tmp, md_indices_allocated ); - ivas_write_spar_md_bitstream( hMdEnc, num_bands, bands_bw, &hMetaData_tmp, hEncoderConfig->ivas_total_brate, strat, qsi, planarCP ); + ivas_write_spar_md_bitstream( hMdEnc, num_bands, bands_bw, &hMetaData_tmp, hEncoderConfig->ivas_total_brate, strat, qsi +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); /*write to main buffer if its a valid bitstream*/ if ( hMetaData_tmp.nb_bits_tot > 0 ) @@ -1320,8 +1348,12 @@ static void ivas_write_spar_md_bitstream( BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, - const int16_t qsi, - const int16_t planarCP ) + const int16_t qsi +#ifndef FIX_280_PLANAR_CP + , + const int16_t planarCP +#endif +) { int16_t no_ec, i; int16_t do_diff[IVAS_MAX_NUM_BANDS]; @@ -1431,12 +1463,20 @@ static void ivas_write_spar_md_bitstream( if ( no_ec == 1 ) { entropy_coding_result = - ivas_get_huffman_coded_bs( hMdEnc, hMetaData, nB, qsi, planarCP, bands_bw ); + ivas_get_huffman_coded_bs( hMdEnc, hMetaData, nB, qsi, +#ifndef FIX_280_PLANAR_CP + planarCP, +#endif + bands_bw ); } else { entropy_coding_result = - ivas_get_arith_coded_bs( hMdEnc, hMetaData, do_diff, bands_bw, nB, qsi, planarCP, strat, ivas_total_brate ); + ivas_get_arith_coded_bs( hMdEnc, hMetaData, do_diff, bands_bw, nB, qsi, +#ifndef FIX_280_PLANAR_CP + planarCP, +#endif + strat, ivas_total_brate ); } if ( entropy_coding_result < 0 ) @@ -1458,7 +1498,9 @@ static int16_t ivas_get_huffman_coded_bs( BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, +#ifndef FIX_280_PLANAR_CP const int16_t planarCP, +#endif const int16_t bands_bw ) { int16_t i, j; @@ -1480,7 +1522,7 @@ static int16_t ivas_get_huffman_coded_bs( pred_offset = DIRAC_TO_SPAR_HBR_PRED_CHS; } } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( j = pred_offset; j < pred_coeff_dim; j++ ) @@ -1521,6 +1563,7 @@ static int16_t ivas_get_huffman_coded_bs( } else { +#endif for ( j = pred_offset; j < pred_coeff_dim; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.pred_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].pred_index_re[j], &code, &len ); @@ -1550,7 +1593,9 @@ static int16_t ivas_get_huffman_coded_bs( } push_next_indice( hMetaData, code, len ); } +#ifndef FIX_280_PLANAR_CP } +#endif } return 0; @@ -1569,7 +1614,9 @@ static int16_t ivas_get_arith_coded_bs( const int16_t bands_bw, const int16_t nB, const int16_t qsi, +#ifndef FIX_280_PLANAR_CP const int16_t planarCP, +#endif const int16_t strat, const int32_t ivas_total_brate ) { @@ -1649,11 +1696,21 @@ static int16_t ivas_get_arith_coded_bs( } } } - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, @@ -1688,13 +1745,23 @@ static int16_t ivas_get_arith_coded_bs( fprintf(stderr, "%d, ", hMdEnc->spar_md.band_coeffs_idx[0].drct_index_re[j]); fprintf(stderr, "\n\n"); */ #endif - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) @@ -1702,7 +1769,7 @@ static int16_t ivas_get_arith_coded_bs( drct_cell_dims[i].dim1 = drct_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } - +#endif arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.drct_arith_re[qsi], &hMdEnc->arith_coeffs.drct_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, drct_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); if ( arith_result < 0 ) @@ -1710,13 +1777,23 @@ static int16_t ivas_get_arith_coded_bs( return -1; } - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } - +#ifndef FIX_280_PLANAR_CP if ( planarCP ) { for ( i = 0; i < nB; i++ ) @@ -1724,6 +1801,7 @@ static int16_t ivas_get_arith_coded_bs( decd_cell_dims[i].dim1 = decd_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } +#endif arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.decd_arith_re[qsi], &hMdEnc->arith_coeffs.decd_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, decd_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); if ( arith_result < 0 ) @@ -1731,11 +1809,21 @@ static int16_t ivas_get_arith_coded_bs( return -1; } - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); if ( any_diff == 1 ) { - ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF, planarCP ); + ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF +#ifndef FIX_280_PLANAR_CP + , + planarCP +#endif + ); } return 0; -- GitLab From e9bfe105548e7f4adceb5bd8c7e63922ee63001d Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 15 Jun 2023 12:10:23 +0530 Subject: [PATCH 164/591] Added line spacing that was removed --- lib_com/ivas_spar_com.c | 3 +++ lib_dec/ivas_spar_md_dec.c | 5 +++++ lib_enc/ivas_spar_md_enc.c | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 59f976f4c9..86c9e76136 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1273,6 +1273,7 @@ void ivas_calc_c_p_coeffs( { ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { @@ -1288,10 +1289,12 @@ void ivas_calc_c_p_coeffs( } } #endif + if ( compute_p_flag == 1 ) { ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 2c212352d6..69988b317b 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -63,6 +63,7 @@ static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0 *------------------------------------------------------------------------------------------*/ static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr ); + #ifndef FIX_280_PLANAR_CP static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); @@ -1838,6 +1839,7 @@ static void ivas_spar_dec_parse_md_bs( } qs = hMdDec->spar_md_cfg.quant_strat[qsi]; + #ifndef FIX_280_PLANAR_CP planarCP = 0; if ( ( qsi == 2 ) && ( use_planar_coeff ) ) @@ -2187,6 +2189,7 @@ static void ivas_decode_arith_bs( #endif ); } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { @@ -2196,6 +2199,7 @@ static void ivas_decode_arith_bs( } } #endif + ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.drct_arith_re[qsi], &hMdDec->arith_coeffs.drct_arith_re_diff[qsi], st0, drct_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); @@ -2215,6 +2219,7 @@ static void ivas_decode_arith_bs( #endif ); } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index bd2f817b48..6ac24e4039 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -72,6 +72,7 @@ static void ivas_band_mixer( float *cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], #ifndef FIX_383_CLEAN_UP static void ivas_get_band_differential_index( ivas_band_coeffs_ind_t *pBand_idx, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const int16_t complex_cov, const int16_t dim, const ivas_coeffs_type_t coeff_type ); #endif + static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, #ifndef FIX_280_PLANAR_CP const int16_t planarCP, @@ -89,11 +90,13 @@ static ivas_error ivas_spar_set_enc_config( ivas_spar_md_enc_state_t *hMdEnc, in static void ivas_select_next_strat( ivas_strats_t prior_strat, ivas_strats_t cs[MAX_QUANT_STRATS], const int16_t dmx_switch, const int16_t dtx_vad ); static void ivas_store_prior_coeffs( ivas_spar_md_enc_state_t *hMdEnc, const int16_t num_bands, const int16_t strat, const int16_t dtx_vad, const int16_t qsi ); + #ifndef FIX_280_PLANAR_CP static void ivas_write_spar_md_bitstream( ivas_spar_md_enc_state_t *hMdEnc, const int16_t nB, const int16_t bands_bw, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, const int16_t qsi, const int16_t planarCP ); #else static void ivas_write_spar_md_bitstream( ivas_spar_md_enc_state_t *hMdEnc, const int16_t nB, const int16_t bands_bw, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, const int16_t qsi ); #endif + static void ivas_spar_quant_pred_coeffs_dtx( ivas_spar_md_t *pSpar_md, const float *pValues, const int16_t ndm, int16_t *pIndex, const int16_t dim1, float *pQuant ); static void ivas_quant_p_per_band_dtx( float *pP_mat, const int16_t num_dec, const int16_t num_dmx, int16_t *ppIdx_pd, float *pP_out, const int16_t num_ch ); @@ -786,6 +789,7 @@ ivas_error ivas_spar_md_enc_process( fprintf(stderr, "\n\n"); */ #endif + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { @@ -949,6 +953,7 @@ ivas_error ivas_spar_md_enc_process( #endif } #endif + ivas_quant_c_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], ndec, ndm ); #ifdef SPAR_HOA_DBG @@ -1522,6 +1527,7 @@ static int16_t ivas_get_huffman_coded_bs( pred_offset = DIRAC_TO_SPAR_HBR_PRED_CHS; } } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { @@ -1761,6 +1767,7 @@ static int16_t ivas_get_arith_coded_bs( #endif ); } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { @@ -1770,6 +1777,7 @@ static int16_t ivas_get_arith_coded_bs( } } #endif + arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.drct_arith_re[qsi], &hMdEnc->arith_coeffs.drct_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, drct_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); if ( arith_result < 0 ) @@ -1793,6 +1801,7 @@ static int16_t ivas_get_arith_coded_bs( #endif ); } + #ifndef FIX_280_PLANAR_CP if ( planarCP ) { -- GitLab From 629ff241502096a6ee8e3c4127fdbac73f4a7f87 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Thu, 15 Jun 2023 12:58:13 +0530 Subject: [PATCH 165/591] code clean up --- lib_com/ivas_cov_smooth.c | 87 ++++++++++++++++++++++++++++++++++++++ lib_com/ivas_spar_com.c | 2 + lib_com/options.h | 2 +- lib_dec/ivas_spar_md_dec.c | 6 +++ 4 files changed, 96 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index e2aa44627b..7211274eea 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -41,6 +41,7 @@ #include "prot.h" #define BAND_SMOOTH_REST_START_IDX ( 2 ) +#ifndef CODE_CLEAN_UP_DIRAC /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * @@ -138,7 +139,93 @@ static void ivas_set_up_cov_smoothing( return; } +#else +/*-----------------------------------------------------------------------------------------* + * Function ivas_calculate_update_factor() + * + * To calculate the update factor + *-----------------------------------------------------------------------------------------*/ + +static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) +{ + float update_factor_temp = 0.0f; + int16_t k; + for ( k = 0; k < active_bins; k++ ) + { + update_factor_temp += p_bin_to_band[k]; + } + return update_factor_temp; +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_calculate_smoothning_factor() + * + * To calculate the Smoothning factor + *-----------------------------------------------------------------------------------------*/ + +static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) +{ + float smooth_fact; + *Smoothing_factor = update_factor / min_pool_size; + if ( smooth_mode != COV_SMOOTH_MC ) + { + if ( ivas_total_brate < IVAS_24k4 ) + { + smooth_fact = 0.5f; + } + else + { + smooth_fact = 0.75f; + } + *Smoothing_factor *= ( j + 1 ) * smooth_fact; + } + if ( *Smoothing_factor > max_update_rate ) + { + *Smoothing_factor = max_update_rate; + } +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_set_up_cov_smoothing() + * + * Setup for covariance smoothing + *-----------------------------------------------------------------------------------------*/ + +static void ivas_set_up_cov_smoothing( + ivas_cov_smooth_state_t *hCovState, + ivas_filterbank_t *pFb, + const float max_update_rate, + const int16_t min_pool_size, + const COV_SMOOTHING_TYPE smooth_mode, /* i : flag multichannel vs SPAR */ + const int32_t ivas_total_brate ) +{ + int16_t j; + float update_factor; + if ( smooth_mode == COV_SMOOTH_MC ) + { + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + { + int16_t active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; + update_factor = ivas_calculate_update_factor( pFb->fb_bin_to_band.pFb_bin_to_band[j], active_bins ); + ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); + } + } + else + { + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + { + float *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j]; + int16_t active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; + update_factor = ivas_calculate_update_factor( p_bin_to_band, active_bins ); + ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j ); + } + } + + hCovState->prior_bank_idx = -1; +} + +#endif /*------------------------------------------------------------------------- * ivas_spar_covar_smooth_enc_open() diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 86c9e76136..46b5351318 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -802,6 +802,7 @@ void ivas_create_fullr_dmx_mat( { ivas_reorder_array( down_mix_mat1_re, in_chans, order, mixer_mat, start_band, end_band ); } +#ifndef CODE_CLEAN_UP_DIRAC else { /* Custom 4x4 mult for WYiX case */ @@ -823,6 +824,7 @@ void ivas_create_fullr_dmx_mat( } } } +#endif return; } diff --git a/lib_com/options.h b/lib_com/options.h index c5900869ab..7b65897041 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,7 @@ // #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ #define FIX_547_NAN_IGF_DEC /* FhG: issue 547: fix possible nan in IGF decoder */ #define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ - +#define CODE_CLEAN_UP_DIRAC /*Dlb : code clean up*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 69988b317b..6547d13a1d 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -625,9 +625,11 @@ static ivas_error ivas_spar_set_dec_config( case 9: /* IVAS_HOA_2_CH */ hMdDec->num_decorr = IVAS_TD_DECORR_OUT_5CH; break; +#ifndef CODE_CLEAN_UP_DIRAC case 16: /* IVAS_HOA_3_CH */ // ToDo: is this relevant? hMdDec->num_decorr = IVAS_TD_DECORR_OUT_12CH; break; +#endif case 6: /* IVAS_HOA_2_CH */ hMdDec->num_decorr = IVAS_TD_DECORR_OUT_2CH; break; @@ -1357,6 +1359,7 @@ static void ivas_get_spar_matrices( { ivas_mat_col_rearrange( tmp_dm_re, order, i_ts, hMdDec->mixer_mat, b, numch_out ); } +#ifndef CODE_CLEAN_UP_DIRAC else { /* Custom 4x4 mult for WYiX case */ @@ -1375,6 +1378,7 @@ static void ivas_get_spar_matrices( hMdDec->mixer_mat[i][3][b + i_ts * IVAS_MAX_NUM_BANDS] = tmp_dm_re[i][2]; } } +#endif } else { @@ -1382,6 +1386,7 @@ static void ivas_get_spar_matrices( { ivas_mat_col_rearrange( tmp_C1_re, order, i_ts, hMdDec->mixer_mat, b, numch_out ); } +#ifndef CODE_CLEAN_UP_DIRAC else { /* Custom 4x4 mult for WYiX case */ @@ -1400,6 +1405,7 @@ static void ivas_get_spar_matrices( hMdDec->mixer_mat[i][3][b + i_ts * IVAS_MAX_NUM_BANDS] = tmp_C1_re[i][2]; } } +#endif } if ( dmx_ch > 0 ) -- GitLab From 1e5e8f48f4d8da3d4955f7af0643808a166ba06d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Jun 2023 09:41:10 +0200 Subject: [PATCH 166/591] fix remaining issues with FIX_532_ISM_MD_INACTIVE in OMASA --- lib_enc/ivas_masa_enc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 349ffa9515..dab2c493e2 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -385,22 +385,28 @@ ivas_error ivas_masa_encode( { /* signal NULL metadata frame */ push_next_indice( hMetaData, 1, ISM_METADATA_MD_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_MD_FLAG_BITS; /* write the ISM class to ISM_NO_META and again the true ISM class */ push_next_indice( hMetaData, ISM_NO_META, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; } else { push_next_indice( hMetaData, hIsmMetaData[0]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; if ( hIsmMetaData[0]->ism_imp == ISM_NO_META ) { /* signal low-rate ISM_NO_META frame */ push_next_indice( hMetaData, 0, ISM_METADATA_MD_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_MD_FLAG_BITS; /* signal presence of MD in low-rate ISM_NO_META frame */ push_next_indice( hMetaData, hIsmMetaData[0]->ism_md_lowrate_flag, ISM_METADATA_INACTIVE_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_INACTIVE_FLAG_BITS; } } #else @@ -424,22 +430,28 @@ ivas_error ivas_masa_encode( { /* signal NULL metadata frame */ push_next_indice( hMetaData, 1, ISM_METADATA_MD_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_MD_FLAG_BITS; /* write the ISM class to ISM_NO_META and again the true ISM class */ push_next_indice( hMetaData, ISM_NO_META, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; push_next_indice( hMetaData, hIsmMetaData[i]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; } else { push_next_indice( hMetaData, hIsmMetaData[i]->ism_imp, ISM_METADATA_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_FLAG_BITS; if ( hIsmMetaData[i]->ism_imp == ISM_NO_META ) { /* signal low-rate ISM_NO_META frame */ push_next_indice( hMetaData, 0, ISM_METADATA_MD_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_MD_FLAG_BITS; /* signal presence of MD in low-rate ISM_NO_META frame */ push_next_indice( hMetaData, hIsmMetaData[i]->ism_md_lowrate_flag, ISM_METADATA_INACTIVE_FLAG_BITS ); + hQMetaData->metadata_max_bits -= ISM_METADATA_INACTIVE_FLAG_BITS; } } #else -- GitLab From b9df4e449978db7c3a07ffad28a8089e60f47295 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 15 Jun 2023 13:27:16 +0530 Subject: [PATCH 167/591] Changes as part of issue#523 --- lib_com/options.h | 1 + lib_dec/ivas_dirac_dec.c | 4 ++++ lib_dec/ivas_init_dec.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c0679a9f4d..993ad9df58 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ #endif +#define SBA_MODE_CLEANUP_2 /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ // #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 521baa405f..43d7307cf5 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1736,7 +1736,11 @@ void ivas_dirac_dec_read_BS( /* subtract mode signaling bits, since bitstream was moved after mode reading */ st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); +#ifndef SBA_MODE_CLEANUP_2 /* 1 bit flag for SPAR/DirAC, already read in read format function */ +#else + /* 1 bit flag for signaling metadata to read */ +#endif b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; hQMetaData->sba_inactive_mode = 1; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b746baf47b..1495ddeed8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -452,9 +452,11 @@ static ivas_error ivas_read_format( if ( st_ivas->ivas_format == SBA_FORMAT ) { +#ifndef SBA_MODE_CLEANUP_2 int16_t tc_mode_offset; tc_mode_offset = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); idx = st_ivas->bit_stream[tc_mode_offset]; +#endif if ( st_ivas->sba_analysis_order == 0 ) { st_ivas->sba_analysis_order = SBA_FOA_ORDER; -- GitLab From f5da52905bf0dae41db283fb5d5a6d1f9efb53d9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Jun 2023 10:16:37 +0200 Subject: [PATCH 168/591] update within FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH for OMASA --- lib_enc/ivas_spar_md_enc.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index dbca3809cc..9ff27f82fc 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -45,7 +45,7 @@ /*------------------------------------------------------------------------------------------* * PreProcessor *------------------------------------------------------------------------------------------*/ -#define IVAS_MAX_MD_BYTES ( 1000 ) +#define IVAS_MAX_MD_BYTES ( 1000 ) // ToDo: not used static const float pr_boost_range[2] = { 0.1f, 0.4f }; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 2c916691d0..4b6e364200 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -53,8 +53,8 @@ *------------------------------------------------------------------------*/ #define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f -#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) -#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) // ToDo: not used +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) // ToDo: not used #ifdef MASA_AND_OBJECTS #define STEREO_PREPROCESS_IIR_FACTOR ( 0.9f ) @@ -69,7 +69,11 @@ #define ADAPT_HTPROTO_ROT_LIM_1 0.8f #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH +#ifdef MASA_AND_OBJECTS +#define MAX_GAIN_CACHE_SIZE ( 5 * 3 ) /* == max number of simultaneous directions * 3 */ +#else #define MAX_GAIN_CACHE_SIZE 6 +#endif typedef struct hrtfGainCache { -- GitLab From 29a8aecfd90a08bac86b35d9c978d87be37f0018 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Jun 2023 11:12:31 +0200 Subject: [PATCH 169/591] fix MAX_GAIN_CACHE_SIZE size --- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 1ca593f68e..fe2dc890b4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -69,7 +69,7 @@ #define ADAPT_HTPROTO_ROT_LIM_1 0.8f #ifdef MASA_AND_OBJECTS -#define MAX_GAIN_CACHE_SIZE ( 5 * 3 ) /* == max number of simultaneous directions * 3 */ +#define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS + MAX_NUM_OBJECTS ) * 3 ) /* == max number of simultaneous directions * 3 */ #else #define MAX_GAIN_CACHE_SIZE 6 #endif -- GitLab From a862ad26249f69d3b05a4a820cf3015d3f966b1f Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 15 Jun 2023 14:55:31 +0530 Subject: [PATCH 170/591] Address review comments --- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_dec/ivas_spar_decoder.c | 4 ++++ lib_enc/ivas_qmetadata_enc.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index fc24398e39..d622f46fad 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1191,7 +1191,7 @@ int16_t ivas_qmetadata_dec_sid_decode( /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ #else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index b80cc08684..b93c28dc34 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -351,11 +351,15 @@ ivas_error ivas_spar_dec( if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { +#ifndef FIX_137_SID_MD_BITS int16_t zero_pad_bits; +#endif *nb_bits_read += SID_FORMAT_NBITS; +#ifndef FIX_137_SID_MD_BITS zero_pad_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - *nb_bits_read; assert( zero_pad_bits <= 1 ); *nb_bits_read += zero_pad_bits; +#endif } pop_wmops(); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 0f6ea973da..a4b02b19d0 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -1224,10 +1224,14 @@ void reset_metadata_spatial( #endif hMetaData->ind_list[0].value = 1; metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; +#ifdef FIX_137_SID_MD_BITS + assert( hMetaData->nb_bits_tot == metadata_sid_bits ); +#else while ( hMetaData->nb_bits_tot < metadata_sid_bits ) { push_next_indice( hMetaData, 0, 1 ); /*fill bit*/ } +#endif } else { -- GitLab From 9ea697c8c11d35546c396818ec1da181ab5628ff Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Jun 2023 11:36:13 +0200 Subject: [PATCH 171/591] maintenance: new function ivas_omasa_ener_brate() + comments --- lib_com/ivas_prot.h | 16 ++++++++--- lib_enc/ivas_enc.c | 45 +++++++------------------------ lib_enc/ivas_ism_enc.c | 4 +-- lib_enc/ivas_ism_metadata_enc.c | 6 ++--- lib_enc/ivas_masa_enc.c | 4 +-- lib_enc/ivas_omasa_enc.c | 47 +++++++++++++++++++++++++++++++++ 6 files changed, 76 insertions(+), 46 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 69745469ac..e1263217f7 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -947,7 +947,7 @@ ivas_error ivas_ism_enc( int16_t *nb_bits_metadata /* i : number of metadata bits */ #ifdef OMASA_ENERGIES , - int16_t flag_omasa_brate + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif ); @@ -971,7 +971,7 @@ ivas_error ivas_ism_metadata_enc( ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ #ifdef OMASA_ENERGIES , - int16_t flag_omasa_brate + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif #ifdef FIX_OMASA_STEREO_SWITCHING ,int16_t *omasa_stereo_sw_cnt @@ -5078,7 +5078,7 @@ ivas_error ivas_masa_encode( const int16_t ism_imp /* i : importance of separated object */ #ifdef OMASA_ENERGIES , - const int16_t flag_omasa_brate /* i : flag for using less bitrate for objects in OMASA*/ + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif #endif ); @@ -5728,6 +5728,16 @@ void set_ism_importance_interformat( int16_t ism_imp[] /* o : ISM importance flags */ ); +#ifdef OMASA_ENERGIES +/*! r: flag for using less bitrate for objects in OMASA */ +int16_t ivas_omasa_ener_brate( + const int16_t nchan_ism, /* i : number of ISMs */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + float data_f[][L_FRAME48k], /* i : Input / transport audio signals */ + const int16_t input_frame /* i : Input frame size */ +); +#endif + /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( const ISM_MODE ism_mode, /* i : ISM mode */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 9a1ed1ae30..3898b44fc5 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -63,9 +63,6 @@ ivas_error ivas_enc( Encoder_State *st; /* used for bitstream handling */ #ifdef MASA_AND_OBJECTS int16_t nb_bits_metadata[MAX_SCE + 1]; -#ifdef OMASA_ENERGIES - int16_t flag_omasa_brate; -#endif #else int16_t nb_bits_metadata[MAX_SCE]; #endif @@ -92,9 +89,6 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); -#ifdef OMASA_ENERGIES - flag_omasa_brate = 0; -#endif #else set_s( nb_bits_metadata, 0, MAX_SCE ); #endif @@ -304,6 +298,11 @@ ivas_error ivas_enc( { float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; +#ifdef OMASA_ENERGIES + int16_t flag_omasa_ener_brate; + + flag_omasa_ener_brate = 0; +#endif if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -358,40 +357,14 @@ ivas_error ivas_enc( else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { #ifdef OMASA_ENERGIES - float energy_ism, energy_masa; - - energy_ism = 0.0f; - - if ( st_ivas->nSCE >= 3 && st_ivas->hEncoderConfig->ivas_total_brate == IVAS_128k ) - { - for ( i = 0; i < st_ivas->nSCE; i++ ) - { - energy_ism += sum2_f( data_f[i], input_frame ); - } - - energy_masa = 0.0f; - - for ( i = st_ivas->nSCE; i < st_ivas->nSCE + 2; i++ ) - { - energy_masa += sum2_f( data_f[i], input_frame ); - } - - energy_ism = energy_ism / ( energy_masa + 1.0f ) * 2.0f / (float) ( st_ivas->nSCE ); - flag_omasa_brate = 0; - if ( energy_ism < 1.0f ) - { - flag_omasa_brate = 1; - } -#ifdef DEBUG_MODE_INFO - dbgwrite( &energy_ism, sizeof( float ), 1, 1, "en_ratio.bin" ); -#endif - } + flag_omasa_ener_brate = ivas_omasa_ener_brate( st_ivas->hEncoderConfig->nchan_ism, ivas_total_brate, data_f, input_frame ); #endif + /* Analysis, decision about bitrates per channel & core coding */ if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] #ifdef OMASA_ENERGIES , - flag_omasa_brate + flag_omasa_ener_brate #endif ) ) != IVAS_ERR_OK ) { @@ -416,7 +389,7 @@ ivas_error ivas_enc( st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp #ifdef OMASA_ENERGIES , - flag_omasa_brate + flag_omasa_ener_brate #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index c9ce0e7721..f68940c9dd 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -55,7 +55,7 @@ ivas_error ivas_ism_enc( int16_t *nb_bits_metadata /* i : number of metadata bits */ #ifdef OMASA_ENERGIES , - int16_t flag_omasa_brate + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif ) { @@ -288,7 +288,7 @@ ivas_error ivas_ism_enc( nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 #ifdef OMASA_ENERGIES , - flag_omasa_brate + flag_omasa_ener_brate #endif #ifdef FIX_OMASA_STEREO_SWITCHING , diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 97e10027a9..d9b3645358 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -194,7 +194,7 @@ ivas_error ivas_ism_metadata_enc( const float lp_noise_CPE #ifdef OMASA_ENERGIES , - int16_t flag_omasa_brate + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif #ifdef FIX_OMASA_STEREO_SWITCHING , @@ -704,9 +704,9 @@ ivas_error ivas_ism_metadata_enc( { *ism_total_brate += ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ); #ifdef OMASA_ENERGIES - if ( ism_imp[ch] > 1 && flag_omasa_brate == 1 && brate_limit_flag >= 0 ) + if ( ism_imp[ch] > 1 && flag_omasa_ener_brate == 1 && brate_limit_flag >= 0 ) { - *ism_total_brate -= flag_omasa_brate * ADJUST_ISM_BRATE_NEG; + *ism_total_brate -= ADJUST_ISM_BRATE_NEG; } if ( brate_limit_flag == -1 && ism_imp[ch] >= 1 && nchan_ism >= 3 && ( ism_total_brate_ref - *ism_total_brate > IVAS_48k ) ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index dab2c493e2..6fa2d7885f 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -249,7 +249,7 @@ ivas_error ivas_masa_encode( const int16_t ism_imp /* i : importance of separated object */ #ifdef OMASA_ENERGIES , - const int16_t flag_omasa_brate /* i : flag for using less bitrate for objects in OMASA */ + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif #endif ) @@ -470,7 +470,7 @@ ivas_error ivas_masa_encode( #ifdef OMASA_ENERGIES if ( ivas_total_brate == IVAS_128k && nchan_ism >= 3 ) { - push_next_indice( hMetaData, flag_omasa_brate, 1 ); + push_next_indice( hMetaData, flag_omasa_ener_brate, 1 ); hQMetaData->metadata_max_bits -= 1; } #endif diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 24d1cfe140..714054d977 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -727,6 +727,53 @@ void ivas_set_surplus_brate_enc( } +#ifdef OMASA_ENERGIES +/*--------------------------------------------------------------------------* + * ivas_omasa_ener_brate() + * + * + *--------------------------------------------------------------------------*/ + +/*! r: OMASA energy bitrate flag */ +int16_t ivas_omasa_ener_brate( + const int16_t nchan_ism, /* i : number of ISMs */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + float data_f[][L_FRAME48k], /* i : Input / transport audio signals */ + const int16_t input_frame /* i : Input frame size */ +) +{ + int16_t i, flag_omasa_ener_brate; + float energy_ism, energy_masa; + + flag_omasa_ener_brate = 0; + + if ( nchan_ism >= 3 && ivas_total_brate == IVAS_128k ) + { + energy_ism = 0.0f; + for ( i = 0; i < nchan_ism; i++ ) + { + energy_ism += sum2_f( data_f[i], input_frame ); + } + + energy_masa = 0.0f; + for ( i = nchan_ism; i < nchan_ism + MASA_MAXIMUM_DIRECTIONS; i++ ) + { + energy_masa += sum2_f( data_f[i], input_frame ); + } + + energy_ism = energy_ism / ( energy_masa + 1.0f ) * 2.0f / (float) ( nchan_ism ); + + if ( energy_ism < 1.0f ) + { + flag_omasa_ener_brate = 1; + } + } + + return flag_omasa_ener_brate; +} +#endif + + /*--------------------------------------------------------------------------* * Local functions *--------------------------------------------------------------------------*/ -- GitLab From 09102fb7438713ae6f0d3e71fa3032b413c73f97 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 15 Jun 2023 14:22:46 +0300 Subject: [PATCH 172/591] Fix binaural gain cache in relation to OMASA --- lib_rend/ivas_dirac_dec_binaural_functions.c | 38 ++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index fe2dc890b4..e418af9d52 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -69,7 +69,7 @@ #define ADAPT_HTPROTO_ROT_LIM_1 0.8f #ifdef MASA_AND_OBJECTS -#define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS + MAX_NUM_OBJECTS ) * 3 ) /* == max number of simultaneous directions * 3 */ +#define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ #else #define MAX_GAIN_CACHE_SIZE 6 #endif @@ -814,6 +814,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric int16_t dirac_read_idx; float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; +#ifdef MASA_AND_OBJECTS + int16_t gainCacheBaseIndex; +#endif hDirAC = st_ivas->hDirAC; h = st_ivas->hDiracDecBin; @@ -952,6 +955,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric eleDeg = hDirAC->elevation[dirac_read_idx][bin]; ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; +#ifdef MASA_AND_OBJECTS + gainCacheBaseIndex = 0; +#endif } #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format != MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_ISM_FORMAT && dirIndex < hDirAC->numParametricDirections ) ) /* For second of the two simultaneous directions */ @@ -970,6 +976,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; +#ifdef MASA_AND_OBJECTS + gainCacheBaseIndex = 3; +#endif } #ifdef MASA_AND_OBJECTS else /* For object directions of MASA_ISM_FORMAT */ @@ -989,6 +998,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; spreadCoh = 0.0f; + gainCacheBaseIndex = 6 + ismDirIndex; } #endif @@ -1024,7 +1034,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric spreadCoh = max( spreadCoh, altSpreadCoh ); } +#ifdef MASA_AND_OBJECTS + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked ); +#else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); +#endif if ( h->renderStereoOutputInsteadOfBinaural ) { @@ -1067,7 +1081,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric rImagp *= centerMul; /* Apply the gain for the left source of the three coherent sources */ +#ifdef MASA_AND_OBJECTS + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); +#else getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); +#endif hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1077,7 +1095,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ +#ifdef MASA_AND_OBJECTS + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); +#else getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); +#endif hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1293,7 +1315,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( int16_t dirac_read_idx; #endif DIRAC_DEC_BIN_HANDLE h; +#ifdef MASA_AND_OBJECTS + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_NUM_OBJECTS]; + int16_t idx; +#else PARAMBIN_HRTF_GAIN_CACHE gainCache; +#endif h = st_ivas->hDiracDecBin; #ifdef MASA_AND_OBJECTS @@ -1320,7 +1347,14 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; #endif +#ifdef MASA_AND_OBJECTS + for ( idx = 0; idx < MAX_NUM_OBJECTS; idx++ ) + { + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + } +#else gainCache.azi = -1000; /* Use -1000 as value for uninitialized cache. */ +#endif for ( bin = 0; bin < nBins; bin++ ) { @@ -1491,7 +1525,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( h->processMtxImPrev[chA][chB + 2][bin] = h->processMtxIm[chA][chB + 2][bin]; } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache, isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); h->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; h->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; -- GitLab From 94397413be32f288f0dc137bfc88c759d18d1014 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 15 Jun 2023 15:21:41 +0300 Subject: [PATCH 173/591] Remove todo-comments as the related values are in use. --- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index e418af9d52..e4b70bf588 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -53,8 +53,8 @@ *------------------------------------------------------------------------*/ #define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f -#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) // ToDo: not used -#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) // ToDo: not used +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) #ifdef MASA_AND_OBJECTS #define STEREO_PREPROCESS_IIR_FACTOR ( 0.9f ) -- GitLab From 743072535e49363b36758ba473fb6ce216e94d5d Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 15 Jun 2023 18:44:24 +0530 Subject: [PATCH 174/591] Address review comments --- lib_dec/ivas_sba_dec.c | 14 -------------- lib_dec/ivas_spar_md_dec.c | 27 ++++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index d4d55504cc..1a0e6b7166 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -113,7 +113,6 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef VLBR_20MS_MD int16_t num_channels, num_md_sub_frames; - int16_t i, j, k; #endif RENDERER_TYPE old_renderer_type; @@ -198,19 +197,6 @@ ivas_error ivas_sba_dec_reconfigure( { return error; } - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - st_ivas->hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0; - st_ivas->hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0; - st_ivas->hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0; - st_ivas->hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0; - } - } - } } #endif 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 ); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 9e381f6900..a3d3f8f66c 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -107,7 +107,9 @@ static ivas_error ivas_spar_md_dec_matrix_open const int16_t num_md_sub_frames ) { int16_t i, j; - +#ifdef VLBR_20MS_MD + int16_t k; +#endif if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * num_md_sub_frames * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); @@ -244,7 +246,22 @@ static ivas_error ivas_spar_md_dec_matrix_open } } } +#ifdef VLBR_20MS_MD + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0.0f; + } + } + } +#endif return IVAS_ERR_OK; } @@ -492,7 +509,11 @@ ivas_error ivas_spar_md_dec_init( const int16_t sba_order /* i : SBA order */ ) { +#ifdef VLBR_20MS_MD + int16_t i, j; +#else int16_t i, j, k; +#endif int16_t nchan_transport; float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; @@ -534,7 +555,7 @@ ivas_error ivas_spar_md_dec_init( set_s( hMdDec->base_band_age, 0, IVAS_MAX_NUM_BANDS ); hMdDec->spar_plc_num_lost_frames = 0; hMdDec->spar_plc_enable_fadeout_flag = 1; - +#ifndef VLBR_20MS_MD for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) @@ -578,7 +599,7 @@ ivas_error ivas_spar_md_dec_init( } } } - +#endif hMdDec->dtx_md_smoothing_cntr = 1; ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); -- GitLab From 8e498c6fa40a3026d045487608c62b1971c4d3f9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Jun 2023 18:50:43 +0200 Subject: [PATCH 175/591] clang-format --- lib_dec/ivas_masa_dec.c | 80 +++++++-------- lib_dec/ivas_stat_dec.h | 2 +- lib_enc/ivas_ism_metadata_enc.c | 22 ++--- lib_enc/ivas_omasa_enc.c | 2 +- lib_rend/lib_rend.c | 166 ++++++++++++++++---------------- 5 files changed, 136 insertions(+), 136 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index bec64941b9..8499f4504a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -605,10 +605,10 @@ ivas_error ivas_masa_decode( /*-------------------------------------------------------------------* - * ivas_masa_dec_open() - * - * - *-------------------------------------------------------------------*/ + * ivas_masa_dec_open() + * + * + *-------------------------------------------------------------------*/ ivas_error ivas_masa_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -706,10 +706,10 @@ ivas_error ivas_masa_dec_open( /*-----------------------------------------------------------------------* - * ivas_masa_dec_close() - * - * close MASA decoder - *-----------------------------------------------------------------------*/ + * ivas_masa_dec_close() + * + * close MASA decoder + *-----------------------------------------------------------------------*/ void ivas_masa_dec_close( MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ @@ -771,10 +771,10 @@ void ivas_masa_dec_close( /*-------------------------------------------------------------------* - * ivas_masa_dec_config() - * - * Frame-by-frame configuration of MASA decoder - *-------------------------------------------------------------------*/ + * ivas_masa_dec_config() + * + * Frame-by-frame configuration of MASA decoder + *-------------------------------------------------------------------*/ static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -884,10 +884,10 @@ static ivas_error ivas_masa_dec_config( /*-------------------------------------------------------------------* - * ivas_masa_prerender() - * - * Apply gaining and copying of transport signals when needed - *-------------------------------------------------------------------*/ + * ivas_masa_prerender() + * + * Apply gaining and copying of transport signals when needed + *-------------------------------------------------------------------*/ void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -915,8 +915,8 @@ void ivas_masa_prerender( /*-------------------------------------------------------------------* - * Local functions - *-------------------------------------------------------------------*/ + * Local functions + *-------------------------------------------------------------------*/ static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, @@ -1074,7 +1074,7 @@ static ivas_error init_lfe_synth_data( int16_t slot_size; /* Ring buffer for the filterbank of the LFE synthesis. - * The filterbank is using moving average lowpass filter with the crossover of 120 Hz. */ + * The filterbank is using moving average lowpass filter with the crossover of 120 Hz. */ bufferSize = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES ); if ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) { @@ -1087,7 +1087,7 @@ static ivas_error init_lfe_synth_data( hMasa->hMasaLfeSynth->ringBufferSize = bufferSize; /* Ring buffer for additional lowpass filter for the LFE signal. - * Moving average lowpass filter with the crossover of 240 Hz. */ + * Moving average lowpass filter with the crossover of 240 Hz. */ bufferSize /= 2; if ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) { @@ -1273,10 +1273,10 @@ static int16_t decode_lfe_to_total_energy_ratio( /*-------------------------------------------------------------------* - * ivas_masa_dec_reconfigure() - * - * Reconfigure IVAS MASA decoder - *-------------------------------------------------------------------*/ + * ivas_masa_dec_reconfigure() + * + * Reconfigure IVAS MASA decoder + *-------------------------------------------------------------------*/ ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -1319,8 +1319,8 @@ ivas_error ivas_masa_dec_reconfigure( /* possible reconfigure is done later */ /*-----------------------------------------------------------------* - * Allocate and initialize SCE/CPE and other handles - *-----------------------------------------------------------------*/ + * Allocate and initialize SCE/CPE and other handles + *-----------------------------------------------------------------*/ bit_stream = st_ivas->hSCE[0] != NULL ? st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream : st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream; @@ -1385,8 +1385,8 @@ ivas_error ivas_masa_dec_reconfigure( { #endif /*-----------------------------------------------------------------* - * TD Decorrelator - *-----------------------------------------------------------------*/ + * TD Decorrelator + *-----------------------------------------------------------------*/ if ( st_ivas->hDiracDecBin != NULL ) { @@ -1397,8 +1397,8 @@ ivas_error ivas_masa_dec_reconfigure( } /*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ + * CLDFB instances + *-----------------------------------------------------------------*/ if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { @@ -1406,8 +1406,8 @@ ivas_error ivas_masa_dec_reconfigure( } /*-----------------------------------------------------------------* - * Set-up MASA coding elements and bitrates - *-----------------------------------------------------------------*/ + * Set-up MASA coding elements and bitrates + *-----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS } #endif @@ -1467,10 +1467,10 @@ ivas_error ivas_masa_dec_reconfigure( /*-------------------------------------------------------------------* - * ivas_spar_param_to_masa_param_mapping() - * - * Determine MASA metadata from the SPAR metadata - *-------------------------------------------------------------------*/ + * ivas_spar_param_to_masa_param_mapping() + * + * Determine MASA metadata from the SPAR metadata + *-------------------------------------------------------------------*/ void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ @@ -2416,10 +2416,10 @@ static int16_t ivas_decode_masaism_metadata( /*-------------------------------------------------------------------* - * ivas_masa_ism_set_edited_objects() - * - * - *-------------------------------------------------------------------*/ + * ivas_masa_ism_set_edited_objects() + * + * + *-------------------------------------------------------------------*/ void ivas_masa_ism_set_edited_objects( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a551ab7f9b..74a757f0b5 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1237,7 +1237,7 @@ typedef struct decoder_config_structure int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ float non_diegetic_pan_gain; /* non diegetic panning gain*/ int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ + int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ /* temp. development parameters */ #ifdef DEBUGGING diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 199fd99098..53f0dd7941 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -452,8 +452,8 @@ ivas_error ivas_ism_metadata_enc( if ( ism_metadata_flag_global ) { /*----------------------------------------------------------------* - * Metadata quantization and coding, loop over all objects - *----------------------------------------------------------------*/ + * Metadata quantization and coding, loop over all objects + *----------------------------------------------------------------*/ int16_t total_bits_metadata = 0; int16_t bits_metadata_ism = 0; @@ -529,8 +529,8 @@ ivas_error ivas_ism_metadata_enc( encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); /*----------------------------------------------------------------* - * Quantize and encode radius, yaw, and pitch - *----------------------------------------------------------------*/ + * Quantize and encode radius, yaw, and pitch + *----------------------------------------------------------------*/ if ( ism_mode == ISM_MODE_DISC && ism_extended_metadata_flag ) { @@ -561,9 +561,9 @@ ivas_error ivas_ism_metadata_enc( } /*----------------------------------------------------------------* - * inter-object logic minimizing the use of several absolutely coded - * indexes in the same frame - *----------------------------------------------------------------*/ + * inter-object logic minimizing the use of several absolutely coded + * indexes in the same frame + *----------------------------------------------------------------*/ i = 0; while ( i == 0 || i < nchan_ism / INTER_OBJECT_PARAM_CHECK ) @@ -683,8 +683,8 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS /*----------------------------------------------------------------* - * Take into account the combined format bit-budget distribution - *----------------------------------------------------------------*/ + * Take into account the combined format bit-budget distribution + *----------------------------------------------------------------*/ if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { @@ -736,8 +736,8 @@ ivas_error ivas_ism_metadata_enc( #endif /*----------------------------------------------------------------* - * Configuration and decision about bitrates per channel - *----------------------------------------------------------------*/ + * Configuration and decision about bitrates per channel + *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS if ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 714054d977..c10ec862c5 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -731,7 +731,7 @@ void ivas_set_surplus_brate_enc( /*--------------------------------------------------------------------------* * ivas_omasa_ener_brate() * - * + * *--------------------------------------------------------------------------*/ /*! r: OMASA energy bitrate flag */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index fff3f11ce4..540072679f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4407,14 +4407,14 @@ static void renderBufferChannel( } static ivas_error rotateFrameMc( - IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ - LSSETUP_CUSTOM_STRUCT inCustomLs, /* i : Input Custom LS setup */ - const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ + IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ + IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ + LSSETUP_CUSTOM_STRUCT inCustomLs, /* i : Input Custom LS setup */ + const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ - rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ + rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ ) { int16_t i; @@ -4544,12 +4544,12 @@ static ivas_error rotateFrameMc( } static ivas_error rotateFrameSba( - IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ - const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ + IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ + IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ + const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ - rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ - IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ + rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ + IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ ) { int16_t i, l, n, m; @@ -4734,97 +4734,97 @@ static ivas_error renderIsmToBinauralRoom( } - if ( combinedOrientationEnabled ) + if ( combinedOrientationEnabled ) + { + subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; + // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) + for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) { - subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) - for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) + for ( i = 0; i < 3; i++ ) { - for ( i = 0; i < 3; i++ ) + if ( hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] ) { - if ( hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] ) - { - for ( j = 0; j < 3; j++ ) - { - Rmat[i][j] = ( *hCombinedOrientationData )->Rmat[subframe_idx][i][j]; - } - } - else + for ( j = 0; j < 3; j++ ) { - /* Set to identity */ - set_zero( Rmat[i], 3 ); - Rmat[i][i] = 1.0f; + Rmat[i][j] = ( *hCombinedOrientationData )->Rmat[subframe_idx][i][j]; } } + else + { + /* Set to identity */ + set_zero( Rmat[i], 3 ); + Rmat[i][i] = 1.0f; + } } - (void) subframe_len; // avoid warning } + (void) subframe_len; // avoid warning + } - /* TODO tmu : see issue #518 */ - /* Possible optimization: less processing needed if position didn't change - * needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ - /* previous position gains */ - if ( combinedOrientationEnabled ) - { - rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; - } + /* TODO tmu : see issue #518 */ + /* Possible optimization: less processing needed if position didn't change + * needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ + /* previous position gains */ + if ( combinedOrientationEnabled ) + { + rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); + rotatedPos.azimuth = (float) azi_rot; + rotatedPos.elevation = (float) ele_rot; + } - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, - ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, - previousPanGains ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, + ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, + previousPanGains ) ) != IVAS_ERR_OK ) + { + return error; + } - /* current position gains */ - if ( combinedOrientationEnabled ) - { - rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; - } + /* current position gains */ + if ( combinedOrientationEnabled ) + { + rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); + rotatedPos.azimuth = (float) azi_rot; + rotatedPos.elevation = (float) ele_rot; + } - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, - ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, - currentPanGains ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, + ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, + currentPanGains ) ) != IVAS_ERR_OK ) + { + return error; + } - for ( i = 0; i < 3; i++ ) - { - mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); - } + for ( i = 0; i < 3; i++ ) + { + mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); + } - /* intermediate rendering to 7_1_4 */ - tmpMcBuffer = ismInput->base.inputBuffer; + /* intermediate rendering to 7_1_4 */ + tmpMcBuffer = ismInput->base.inputBuffer; - if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } - tmpMcBuffer.config.numChannels = tmp; - tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); - set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + tmpMcBuffer.config.numChannels = tmp; + tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); + set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); - renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); + renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); - copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); + copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } - accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); - free( tmpMcBuffer.data ); + free( tmpMcBuffer.data ); pop_wmops(); return IVAS_ERR_OK; @@ -5165,7 +5165,7 @@ static ivas_error renderMcToBinaural( if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled - && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) + && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); -- GitLab From 63061134f0e7a6ee6a42c275aa70f37db2610aae Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Fri, 16 Jun 2023 09:16:27 +0200 Subject: [PATCH 176/591] Unify subframe pointer increment for TD renderer under FIX_550_FIRST_FRAME_ACCESS --- lib_rend/ivas_objectRenderer.c | 18 ++++++++++++++++++ lib_rend/ivas_objectRenderer_hrFilt.c | 2 ++ 2 files changed, 20 insertions(+) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2495bdb4ab..18022124c1 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -330,6 +330,19 @@ ivas_error ivas_td_binaural_renderer_unwrap( { return error; } + +#ifdef FIX_550_FIRST_FRAME_ACCESS + /* Advance subframe pointer */ + c_indx = 0; + for ( nS = 0; nS < num_src; nS++ ) + { + if ( !( ivas_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */ + { + hBinRendererTd->Sources[c_indx]->InputFrame_p += subframe_length; + c_indx++; + } + } +#endif } if ( hReverb != NULL ) @@ -407,8 +420,13 @@ ivas_error TDREND_GetMix( { pan_left = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; pan_right = 1.f - pan_left; +#ifdef FIX_550_FIRST_FRAME_ACCESS + v_multc_acc( Src_p->InputFrame_p, pan_left, output_buf[0], subframe_length ); + v_multc_acc( Src_p->InputFrame_p, pan_right, output_buf[1], subframe_length ); +#else v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_left, output_buf[0], subframe_length ); v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_right, output_buf[1], subframe_length ); +#endif } } diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 6463261ec4..930fb29a5b 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -79,7 +79,9 @@ ivas_error TDREND_REND_RenderSourceHRFilt( v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); v_add( RightOutputFrame, output_buf[1], output_buf[1], subframe_length ); +#ifndef FIX_550_FIRST_FRAME_ACCESS Src_p->InputFrame_p += subframe_length; /* Increment input pointer */ +#endif return IVAS_ERR_OK; -- GitLab From cc07d42d5bc298aaba4e866cea9acfcd65a7fb7e Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 16 Jun 2023 10:53:07 +0300 Subject: [PATCH 177/591] Adjust max indices for OMASA at 96 kbps --- lib_com/bitstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index cfc353c1c1..07060b6dd9 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -888,7 +888,7 @@ int16_t get_ivas_max_num_indices_metadata( } else if ( ivas_total_brate <= IVAS_96k ) { - return 240 + 100; + return 240 + 150; } else if ( ivas_total_brate <= IVAS_128k ) { -- GitLab From 8895083f0953edb5c74481c8bd1f17b0cde75618 Mon Sep 17 00:00:00 2001 From: advasila Date: Fri, 16 Jun 2023 13:12:39 +0300 Subject: [PATCH 178/591] fixes 24.4 TD case --- lib_com/ivas_prot.h | 9 +++++++++ lib_com/ivas_stereo_td_bit_alloc.c | 9 ++++++++- lib_com/options.h | 1 + lib_dec/ivas_cpe_dec.c | 3 +++ lib_dec/ivas_stereo_td_dec.c | 9 ++++++++- lib_enc/ivas_cpe_enc.c | 3 +++ lib_enc/ivas_stereo_td_enc.c | 9 ++++++++- 7 files changed, 40 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 487afa699e..11bbdf2616 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1967,6 +1967,9 @@ void stereo_td_init_dec( void tdm_configure_dec( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ +#ifdef FIX_OMASA_24_4k + const int16_t ism_mode, /* i: ISM mode in combined format */ +#endif #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ @@ -2019,6 +2022,9 @@ void tdm_ol_pitch_comparison( void tdm_configure_enc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ +#ifdef FIX_OMASA_24_4k + const int16_t ism_mode, /* i: ISM mode in combined format */ +#endif #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ @@ -2038,6 +2044,9 @@ ivas_error signaling_enc_secondary( void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ +#ifdef FIX_OMASA_24_4k + const int16_t ism_mode, /* i: ISM mode in combined format */ +#endif #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index a2bbd93997..dfd004ab9b 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -75,7 +75,10 @@ void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS - const int16_t ivas_format, /* i : IVAS format */ + const int16_t ivas_format, /* i : IVAS format */ +#ifdef FIX_OMASA_24_4k + const int16_t ism_mode, /* i: ISM mode in combined format */ +#endif #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ @@ -140,7 +143,11 @@ void tdm_bit_alloc( /* secondary channel bitrate allocation based on the energy scaling ratio */ #ifdef MASA_AND_OBJECTS +#ifdef FIX_OMASA_24_4k + if ( ( ( ivas_format != MASA_ISM_FORMAT || ism_mode == ISM_MODE_NONE ) && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE && coder_type > UNVOICED ) ) +#else if ( ( ivas_format != MASA_ISM_FORMAT && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && coder_type > UNVOICED ) ) +#endif #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) #endif diff --git a/lib_com/options.h b/lib_com/options.h index 5719fe9db0..0bf36cfed3 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define FIX_OMASA_STEREO_SWITCHING /* VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps */ #define FIX_OMASA_BRSW /* Nokia + VA: Fix missing init of OMASA metadata delay buffers, brsw-related init fixes */ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix +#define FIX_OMASA_24_4k /* Nokia: fix OMASA in TD mode at 24.4k */ #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index d15eb5b6a1..c72b8564e1 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -439,6 +439,9 @@ ivas_error ivas_cpe_dec( tdm_configure_dec( #ifdef MASA_AND_OBJECTS st_ivas->ivas_format, +#ifdef FIX_OMASA_24_4k + st_ivas->ism_mode, +#endif #endif hCPE, &tdm_ratio_idx, nb_bits_metadata ); diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 1b90885b0f..424570ec50 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -86,6 +86,9 @@ void stereo_td_init_dec( void tdm_configure_dec( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ +#ifdef FIX_OMASA_24_4k + const int16_t ism_mode, /* i : ISM mode in combined format */ +#endif #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ @@ -308,7 +311,11 @@ void tdm_configure_dec( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( ivas_format, hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + tdm_bit_alloc( ivas_format, +#ifdef FIX_OMASA_24_4k + ism_mode, +#endif + hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 92ef3e3ba7..95cf49d570 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -615,6 +615,9 @@ ivas_error ivas_cpe_enc( tdm_configure_enc( #ifdef MASA_AND_OBJECTS ivas_format, +#ifdef FIX_OMASA_24_4k + st_ivas->ism_mode, +#endif #endif hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata ); diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 7124bb7171..b01be07253 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -312,6 +312,9 @@ ivas_error stereo_set_tdm( void tdm_configure_enc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ +#ifdef FIX_OMASA_24_4k + const int16_t ism_mode, /* i : ISM mode in combined format */ +#endif #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ @@ -492,7 +495,11 @@ void tdm_configure_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( ivas_format, hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + tdm_bit_alloc( ivas_format, +#ifdef FIX_OMASA_24_4k + ism_mode, +#endif + hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); -- GitLab From e1b789c6e73fba9bf90378a5764d03652008cf87 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 16 Jun 2023 13:33:03 +0300 Subject: [PATCH 179/591] Apply clang format --- lib_com/ivas_stereo_td_bit_alloc.c | 4 ++-- lib_dec/ivas_stereo_td_dec.c | 8 ++++---- lib_enc/ivas_stereo_td_enc.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index dfd004ab9b..345fef4b3a 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -75,9 +75,9 @@ void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS - const int16_t ivas_format, /* i : IVAS format */ + const int16_t ivas_format, /* i : IVAS format */ #ifdef FIX_OMASA_24_4k - const int16_t ism_mode, /* i: ISM mode in combined format */ + const int16_t ism_mode, /* i: ISM mode in combined format */ #endif #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 424570ec50..e90baa0dd8 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -87,7 +87,7 @@ void tdm_configure_dec( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #ifdef FIX_OMASA_24_4k - const int16_t ism_mode, /* i : ISM mode in combined format */ + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -313,9 +313,9 @@ void tdm_configure_dec( #ifdef MASA_AND_OBJECTS tdm_bit_alloc( ivas_format, #ifdef FIX_OMASA_24_4k - ism_mode, -#endif - hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, + ism_mode, +#endif + hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, tdm_inst_ratio_idx ); diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index b01be07253..071ef6d361 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -313,7 +313,7 @@ void tdm_configure_enc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ #ifdef FIX_OMASA_24_4k - const int16_t ism_mode, /* i : ISM mode in combined format */ + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ @@ -495,11 +495,11 @@ void tdm_configure_enc( *----------------------------------------------------------------*/ #ifdef MASA_AND_OBJECTS - tdm_bit_alloc( ivas_format, + tdm_bit_alloc( ivas_format, #ifdef FIX_OMASA_24_4k ism_mode, -#endif - hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, +#endif + hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx ); -- GitLab From 7f6ff11363698bb30ed211641bcc4427f8036af3 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Mon, 19 Jun 2023 22:38:25 +0300 Subject: [PATCH 180/591] Disable switch ISM_FB until fixed. --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 17d991b02e..6c21f34ee5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,7 @@ #define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ #define FIX_522_ISM_FIRST_SID /* VA: fix ISM decoder crash if first received frame is an SID */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ -#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ +//#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ -- GitLab From 3ac4d187461327e099adc47006eef7e99472b882 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 20 Jun 2023 13:16:18 +0200 Subject: [PATCH 181/591] - fix setting of "is_ism_flag" in CPE - activate ISM_FB --- lib_com/options.h | 2 +- lib_enc/ivas_cpe_enc.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6c21f34ee5..17d991b02e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,7 @@ #define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ #define FIX_522_ISM_FIRST_SID /* VA: fix ISM decoder crash if first received frame is an SID */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ -//#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ +#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index bb6db6d9a4..86e85b34e7 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -990,7 +990,13 @@ ivas_error create_cpe_enc( #ifdef IND_LIST_DYN st_ivas, #endif - n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, +#ifdef MASA_AND_OBJECTS + ISM_MODE_NONE +#else + st_ivas->ism_mode +#endif + ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 54b8badada65cb8251eb8d1e8c3dc4a051bbf04a Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 20 Jun 2023 13:37:53 +0200 Subject: [PATCH 182/591] intorduce funtions stereo_mode_combined_format_enc()/stereo_mode_combined_format_dec() make the code easier to read --- lib_dec/ivas_cpe_dec.c | 78 ++++++++++++++++++++---------- lib_enc/ivas_cpe_enc.c | 105 ++++++++++++++++++++++++++++------------- 2 files changed, 123 insertions(+), 60 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 989bc40b41..bc0bb3c5b4 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -52,6 +52,10 @@ static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, const Decoder_Struct *st_ivas ); +#ifdef FIX_OMASA_STEREO_SWITCHING +static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); +#endif + /*--------------------------------------------------------------------------* * ivas_cpe_dec() @@ -98,9 +102,6 @@ ivas_error ivas_cpe_dec( sts[0]->BER_detect |= st_ivas->BER_detect; sts[1]->BER_detect |= st_ivas->BER_detect; -#ifdef FIX_OMASA_STEREO_SWITCHING - element_brate_ref = hCPE->element_brate; -#endif #ifdef FIX_OMASA_STEREO_SWITCHING element_brate_ref = hCPE->element_brate; @@ -109,31 +110,11 @@ ivas_error ivas_cpe_dec( /*------------------------------------------------------------------* * Read stereo technology info & audio bandwidth *-----------------------------------------------------------------*/ -#ifdef FIX_OMASA_STEREO_SWITCHING - if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) - { - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && - ( ( st_ivas->nchan_ism == 3 && ivas_total_brate == IVAS_96k ) || - ( st_ivas->nchan_ism == 4 && ivas_total_brate == IVAS_128k ) ) ) - { - /* read OMASA stereo mode signalling */ - if ( get_next_indice( sts[0], NBITS_ELEMENT_MODE ) ) - { - hCPE->element_mode = IVAS_CPE_MDCT; - } - else - { - hCPE->element_mode = IVAS_CPE_DFT; - } - if ( hCPE->element_mode == IVAS_CPE_MDCT ) - { - hCPE->element_brate = IVAS_64k; - hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref ); - } - } - } +#ifdef FIX_OMASA_STEREO_SWITCHING + stereo_mode_combined_format_dec( st_ivas, hCPE ); #endif + read_stereo_mode_and_bwidth( hCPE, st_ivas ); /*----------------------------------------------------------------* @@ -1168,3 +1149,48 @@ static void read_stereo_mode_and_bwidth( return; } + + +#ifdef FIX_OMASA_STEREO_SWITCHING +/*------------------------------------------------------------------------- + * stereo_mode_combined_format_dec() + * + * Set stereo format in a combined format + *-------------------------------------------------------------------------*/ + +static void stereo_mode_combined_format_dec( + const Decoder_Struct *st_ivas, /* i : decoder main structure */ + CPE_DEC_HANDLE hCPE /* i/o: CPE handle */ +) +{ + int32_t element_brate_ref; + + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + element_brate_ref = hCPE->element_brate; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && + ( ( st_ivas->nchan_ism == 3 && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_96k ) || + ( st_ivas->nchan_ism == 4 && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_128k ) ) ) + { + /* read OMASA stereo mode signalling */ + if ( get_next_indice( hCPE->hCoreCoder[0], NBITS_ELEMENT_MODE ) ) + { + hCPE->element_mode = IVAS_CPE_MDCT; + } + else + { + hCPE->element_mode = IVAS_CPE_DFT; + } + + if ( hCPE->element_mode == IVAS_CPE_MDCT ) + { + hCPE->element_brate = IVAS_64k; + hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref ); + } + } + } + + return; +} +#endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 86e85b34e7..84f28f28be 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -45,6 +45,15 @@ #include "wmc_auto.h" +#ifdef FIX_OMASA_STEREO_SWITCHING +/*--------------------------------------------------------------------------* + * Local function prototypes + *--------------------------------------------------------------------------*/ + +static void stereo_mode_combined_format_enc( const Encoder_Struct *st_ivas, CPE_ENC_HANDLE hCPE ); +#endif + + /*-------------------------------------------------------------------* * ivas_cpe_enc() * @@ -176,42 +185,11 @@ ivas_error ivas_cpe_enc( { hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } -#ifdef FIX_OMASA_STEREO_SWITCHING - if ( ivas_format == MASA_ISM_FORMAT ) - { - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && - ( ( hEncoderConfig->nchan_ism == 3 && ivas_total_brate == IVAS_96k ) || - ( hEncoderConfig->nchan_ism == 4 && ivas_total_brate == IVAS_128k ) ) ) - { - if ( hCPE->element_brate + hCPE->brate_surplus > IVAS_64k ) - { - st_ivas->hMasa->data.omasa_stereo_sw_cnt = 0; - } - else - { - st_ivas->hMasa->data.omasa_stereo_sw_cnt++; - st_ivas->hMasa->data.omasa_stereo_sw_cnt = min( st_ivas->hMasa->data.omasa_stereo_sw_cnt, OMASA_STEREO_SW_CNT_MAX ); - } - if ( st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) - { - hCPE->element_mode = IVAS_CPE_MDCT; - hCPE->element_brate = IVAS_64k; - hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref ); - } - - /* write OMASA stereo mode signalling */ - if ( hCPE->element_mode == IVAS_CPE_MDCT ) - { - push_indice( hCPE->hCoreCoder[0]->hBstr, IND_SMODE_OMASA, 1, NBITS_ELEMENT_MODE ); - } - else - { - push_indice( hCPE->hCoreCoder[0]->hBstr, IND_SMODE_OMASA, 0, NBITS_ELEMENT_MODE ); - } - } - } +#ifdef FIX_OMASA_STEREO_SWITCHING + stereo_mode_combined_format_enc( st_ivas, hCPE ); #endif + if ( ( error = front_vad( hCPE, NULL, hEncoderConfig, &hCPE->hFrontVad[0], st_ivas->hMCT != NULL, input_frame, vad_flag_dtx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, vad_hover_flag, band_energies_LR, NULL, NULL ) ) != IVAS_ERR_OK ) { return error; @@ -1232,3 +1210,62 @@ void destroy_cpe_enc( return; } + + +#ifdef FIX_OMASA_STEREO_SWITCHING +/*------------------------------------------------------------------------- + * stereo_mode_combined_format_enc() + * + * Set stereo format in a combined format + *-------------------------------------------------------------------------*/ + +static void stereo_mode_combined_format_enc( + const Encoder_Struct *st_ivas, /* i : encoder main structure */ + CPE_ENC_HANDLE hCPE /* i/o: CPE handle */ +) +{ + ENCODER_CONFIG_HANDLE hEncoderConfig; + int32_t element_brate_ref; + + hEncoderConfig = st_ivas->hEncoderConfig; + + if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + element_brate_ref = hCPE->element_brate; + + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && + ( ( hEncoderConfig->nchan_ism == 3 && hEncoderConfig->ivas_total_brate == IVAS_96k ) || + ( hEncoderConfig->nchan_ism == 4 && hEncoderConfig->ivas_total_brate == IVAS_128k ) ) ) + { + if ( hCPE->element_brate + hCPE->brate_surplus > IVAS_64k ) + { + st_ivas->hMasa->data.omasa_stereo_sw_cnt = 0; + } + else + { + st_ivas->hMasa->data.omasa_stereo_sw_cnt++; + st_ivas->hMasa->data.omasa_stereo_sw_cnt = min( st_ivas->hMasa->data.omasa_stereo_sw_cnt, OMASA_STEREO_SW_CNT_MAX ); + } + + if ( st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) + { + hCPE->element_mode = IVAS_CPE_MDCT; + hCPE->element_brate = IVAS_64k; + hCPE->brate_surplus -= ( hCPE->element_brate - element_brate_ref ); + } + + /* write OMASA stereo mode signalling */ + if ( hCPE->element_mode == IVAS_CPE_MDCT ) + { + push_indice( hCPE->hCoreCoder[0]->hBstr, IND_SMODE_OMASA, 1, NBITS_ELEMENT_MODE ); + } + else + { + push_indice( hCPE->hCoreCoder[0]->hBstr, IND_SMODE_OMASA, 0, NBITS_ELEMENT_MODE ); + } + } + } + + return; +} +#endif -- GitLab From 4a43f57b7bef7696ef73dbeb96174471f252c1bc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 20 Jun 2023 15:15:01 +0200 Subject: [PATCH 183/591] clan-format --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 849cc416b4..e6b4f977f8 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2579,7 +2579,7 @@ static ivas_error printConfigInfo_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MC_FORMAT ) #else - else /* MC_FORMAT */ + else /* MC_FORMAT */ #endif { if ( ( error = get_channel_config( st_ivas->transport_config, &config_str[0] ) ) != IVAS_ERR_OK ) -- GitLab From 76739e9ac24b91f33b83dbee984304a49384d059 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Tue, 20 Jun 2023 16:56:20 +0300 Subject: [PATCH 184/591] Use previous subframe for starting external orientation interpolation. Fix frozen orientations. --- lib_com/options.h | 1 + lib_rend/ivas_rotation.c | 88 +++++++++++++++++++++++++++++++++++++++ lib_rend/ivas_stat_rend.h | 8 ++++ 3 files changed, 97 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 8a4dc67706..a375892ae8 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,6 +166,7 @@ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ +#define FIX_570_SF_EXT_ORIENTATION /* Nokia: Issue 570: Use correct subframe for external orientations interpolation */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 2cd2744b5a..c113f23672 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -789,8 +789,10 @@ ivas_error ivas_combined_orientation_open( { ( *hCombinedOrientationData )->enableCombinedOrientation[i] = 0; ( *hCombinedOrientationData )->Quaternions[i] = identity; +#ifndef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->Quaternions_prev_headRot[i] = identity; ( *hCombinedOrientationData )->Quaternions_prev_extOrientation[i] = identity; +#endif ( *hCombinedOrientationData )->listenerPos[i] = origo; for ( j = 0; j < 3; j++ ) @@ -799,6 +801,11 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f; } } +#ifdef FIX_570_SF_EXT_ORIENTATION + ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity; + ( *hCombinedOrientationData )->Quaternion_frozen_ext = identity; + ( *hCombinedOrientationData )->Quaternion_frozen_head = identity; +#endif for ( j = 0; j < 3; j++ ) { @@ -811,6 +818,11 @@ ivas_error ivas_combined_orientation_open( set_zero( ( *hCombinedOrientationData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hCombinedOrientationData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); +#ifdef FIX_570_SF_EXT_ORIENTATION + ( *hCombinedOrientationData )->isExtOrientationFrozen = 0; + ( *hCombinedOrientationData )->isHeadRotationFrozen = 0; +#endif + return IVAS_ERR_OK; } @@ -981,6 +993,23 @@ static ivas_error combine_external_and_head_orientations( /* External orientations */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { +#ifdef FIX_570_SF_EXT_ORIENTATION + /* Check for frozen external orientation */ + if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) + { + if ( hCombinedOrientationData->isExtOrientationFrozen != 1 ) + { + hCombinedOrientationData->Quaternion_frozen_ext = hExtOrientationData->Quaternions[i]; + hCombinedOrientationData->isExtOrientationFrozen = 1; + } + } + else + { + hCombinedOrientationData->Quaternion_frozen_ext = identity; + hCombinedOrientationData->isExtOrientationFrozen = 0; + } +#endif + if ( hExtOrientationData->enableRotationInterpolation[i] == 1 && hExtOrientationData->enableExternalOrientation[i] > 0 ) { if ( hCombinedOrientationData->isInterpolationOngoing == TRUE && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) @@ -1010,7 +1039,11 @@ static ivas_error combine_external_and_head_orientations( /* Use the freezed external orientation */ else if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { +#ifdef FIX_570_SF_EXT_ORIENTATION + hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_ext; +#else hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternions_prev_extOrientation[i]; +#endif } } } @@ -1021,6 +1054,22 @@ static ivas_error combine_external_and_head_orientations( /* Combine head and external orientations */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { +#ifdef FIX_570_SF_EXT_ORIENTATION + /* Check for frozen head rotation */ + if ( hExtOrientationData->enableHeadRotation[i] == 2 && numHeadRotQuaternions >= 0 ) + { + if ( hCombinedOrientationData->isHeadRotationFrozen != 1 ) + { + hCombinedOrientationData->Quaternion_frozen_head = headRotQuaternions[i]; + hCombinedOrientationData->isHeadRotationFrozen = 1; + } + } + else + { + hCombinedOrientationData->Quaternion_frozen_head = identity; + hCombinedOrientationData->isHeadRotationFrozen = 0; + } +#endif /* Use the most recent head rotation */ if ( hExtOrientationData->enableHeadRotation[i] == 1 && numHeadRotQuaternions >= 0 ) { @@ -1038,11 +1087,19 @@ static ivas_error combine_external_and_head_orientations( { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) { +#ifdef FIX_570_SF_EXT_ORIENTATION + QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternions[i] ); +#else QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternions_prev_headRot[i], &hCombinedOrientationData->Quaternions[i] ); +#endif } else { +#ifdef FIX_570_SF_EXT_ORIENTATION + hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head; +#else hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternions_prev_headRot[i]; +#endif } } @@ -1066,6 +1123,16 @@ static ivas_error combine_external_and_head_orientations( /* Save the current orientations */ if ( hExtOrientationData != NULL ) { +#ifdef FIX_570_SF_EXT_ORIENTATION + if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 ) + { + hCombinedOrientationData->Quaternion_prev_extOrientation = hCombinedOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1]; + } + else + { + hCombinedOrientationData->Quaternion_prev_extOrientation = identity; + } +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) @@ -1077,11 +1144,13 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_extOrientation[i] = identity; } } +#endif } if ( headRotQuaternions != NULL ) { for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { +#ifndef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData != NULL ) { if ( hExtOrientationData->enableHeadRotation[i] > 0 && numHeadRotQuaternions >= 0 ) @@ -1104,6 +1173,7 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_headRot[i] = identity; } } +#endif hCombinedOrientationData->listenerPos[i] = listenerPos[i]; } } @@ -1189,7 +1259,25 @@ static void external_target_interpolation( hCombinedOrientationData->Quaternions_ext_interpolation_target = hExtOrientationData->Quaternions[i]; /* Use the most recent external orientation as the starting orientation */ +#ifdef FIX_570_SF_EXT_ORIENTATION + if ( hExtOrientationData->enableExternalOrientation[i] == 1 ) + { + if ( i > 0 ) + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hExtOrientationData->Quaternions[i - 1]; + } + else + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_prev_extOrientation; + } + } + else if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext; + } +#else hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternions_prev_extOrientation[i]; +#endif /* Calculate the interpolation increment and coefficient */ hCombinedOrientationData->interpolationIncrement = 1.0f / ( (float) hExtOrientationData->numFramesToTargetOrientation[i] * (float) MAX_PARAM_SPATIAL_SUBFRAMES ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c763630325..8ed74b1e2c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -304,8 +304,12 @@ typedef struct ivas_combined_orientation_struct float lrSwitchInterpVal; bool isInterpolationOngoing; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef FIX_570_SF_EXT_ORIENTATION + IVAS_QUATERNION Quaternion_prev_extOrientation; +#else IVAS_QUATERNION Quaternions_prev_headRot[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION Quaternions_prev_extOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; +#endif IVAS_QUATERNION Quaternions_ext_interpolation_start; IVAS_QUATERNION Quaternions_ext_interpolation_target; float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; @@ -314,6 +318,10 @@ typedef struct ivas_combined_orientation_struct float procChEneIIR[2][MASA_FREQUENCY_BANDS]; int16_t shd_rot_max_order; IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES]; + IVAS_QUATERNION Quaternion_frozen_ext; + IVAS_QUATERNION Quaternion_frozen_head; + int8_t isExtOrientationFrozen; + int8_t isHeadRotationFrozen; } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; -- GitLab From 2ea956e53bc3b2f089b88c234fbb3061a4457875 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 21 Jun 2023 15:17:23 +1000 Subject: [PATCH 185/591] fixes for errors in SPLIT CLDFB out format --- .../split_renderer_config_pcm_1dof.txt | 2 +- .../split_renderer_config_pcm_2dof.txt | 2 +- .../split_renderer_config_pcm_3dof.txt | 2 +- .../split_renderer_config_pcm_3dof_hq.txt | 3 +- .../sample_split_rend_script_ivas_enc_dec.py | 4 +-- .../sample_split_rend_script_ivas_rend.py | 2 +- lib_rend/lib_rend.c | 33 +++++++++++++------ 7 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt index f70f7e67ce..d956b90ce6 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt @@ -1,5 +1,5 @@ [SPLITREND] -BITRATE = 50000; +BITRATE = 256000; DOF = 1; HQMODE = 0; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt index 5bf2217ded..d8eb266458 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt @@ -1,5 +1,5 @@ [SPLITREND] -BITRATE = 50000; +BITRATE = 384000; DOF = 2; HQMODE = 0; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt index 193bc890a4..e8c9088862 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt @@ -1,5 +1,5 @@ [SPLITREND] -BITRATE = 70000; +BITRATE = 512000; DOF = 3; HQMODE = 0; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt index e559a44f33..6b33fc28cd 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt @@ -1,7 +1,8 @@ [SPLITREND] -BITRATE = 70000; +BITRATE = 768000; DOF = 3; HQMODE = 1; +CODEC = 1; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py index 4cfd0f32d1..7de05dba01 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py @@ -7,7 +7,7 @@ import os ## dimension of following 2 arrays should be same, that is for each file name there should be a tag file_names = [ -'../scripts/testv/test_HOA3.wav' +'../scripts/testv/stv3OA48c.wav' ]; file_tags = [ 'test_HOA3' @@ -91,7 +91,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): dec_exe, '-RENDER_CONFIG', renderers[rend][1], '-t', hr_pre_file, - 'SPLIT_BINAURAL', + 'BINAURAL_SPLIT_CLDFB', '48', file_pkt, bs_file_out diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend.py b/Workspace_msvc/sample_split_rend_script_ivas_rend.py index c6ccd8e422..12ed4e09b3 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend.py @@ -7,7 +7,7 @@ import os ## dimension of following 2 arrays should be same, that is for each file name there should be a tag file_names = [ -'../scripts/testv/test_HOA3.wav' +'../scripts/testv/stv3OA48c.wav' ]; file_tags = [ 'test_HOA3' diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1647424486..0db8bdc162 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3255,12 +3255,12 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN } else { - IVAS_REND_AudioBufferConfig bufConfig; + IVAS_REND_AudioBufferConfig bufConfig2; - bufConfig.numSamplesPerChannel = 0; - bufConfig.numChannels = 0; - bufConfig.is_cldfb = 0; - pSplitRendEncBuffer->config = bufConfig; + bufConfig2.numSamplesPerChannel = 0; + bufConfig2.numChannels = 0; + bufConfig2.is_cldfb = 0; + pSplitRendEncBuffer->config = bufConfig2; pSplitRendEncBuffer->data = NULL; } @@ -4289,7 +4289,7 @@ ivas_error IVAS_REND_GetDelay( { int32_t lc3plusDelaySamples; IVAS_LC3PLUS_DEC_GetDelay( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec, &lc3plusDelaySamples ); - max_latency_ns = max( max_latency_ns, roundf( lc3plusDelaySamples * 1000000000.f / *timeScale ) ); + max_latency_ns = max( max_latency_ns, (int32_t) roundf( lc3plusDelaySamples * 1000000000.f / *timeScale ) ); } else { @@ -6233,7 +6233,7 @@ static ivas_error splitBinLc3plusDecode( } /* Read LC3plus bitstream size info */ lc3plusBitrateId = ivas_split_rend_bitstream_read_int32( bits, 8 ); - lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( lc3plusBitrateId, pose_correction ); + lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( (int8_t) lc3plusBitrateId, pose_correction ); #ifdef SPLIT_REND_LC3PLUS_HBR_DBG if ( lc3plusBitstreamSize == -1 ) { @@ -6559,7 +6559,9 @@ static ivas_error renderSbaToSplitBinaural( #endif ivas_split_rend_bits_t bits; int16_t low_res_pre_rend_rot, max_band; - +#ifdef SPLIT_REND_LC3PLUS + int16_t td_input; +#endif low_res_pre_rend_rot = 1; //( *sbaInput->base.ctx.pSplitRendBitRate == SPLIT_REND_768k ) ? 0 : 1; @@ -6597,6 +6599,9 @@ static ivas_error renderSbaToSplitBinaural( low_res_pre_rend_rot ); #endif max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; +#ifdef SPLIT_REND_LC3PLUS + td_input = 0; +#endif } else #endif @@ -6610,6 +6615,9 @@ static ivas_error renderSbaToSplitBinaural( { accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); } +#ifdef SPLIT_REND_LC3PLUS + td_input = 1; +#endif } /*SPLIT pre rendering MD and CLDFB coding*/ @@ -6628,7 +6636,7 @@ static ivas_error renderSbaToSplitBinaural( tmpCrendBuffer, low_res_pre_rend_rot, #ifdef SPLIT_REND_LC3PLUS - 1, + td_input, #endif ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); @@ -6871,7 +6879,12 @@ static ivas_error renderInputSba( inAudio = sbaInput->base.inputBuffer; +#ifdef SPLIT_REND_LC3PLUS + if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && + ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) +#else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) +#endif { /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -7316,7 +7329,7 @@ ivas_error IVAS_REND_GetSamples( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000, + ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, 1, -- GitLab From 43747a1f8487b5987f6f9188437d254b35262b34 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 21 Jun 2023 08:12:48 +0200 Subject: [PATCH 186/591] remove obsolete define --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 543bc7e451..b4773b1615 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,7 +150,6 @@ #ifdef IND_LIST_DYN #define FIX_545_ASSERT /* VA: fix issue 545, replace assert() with warning message when hitting memory limit in the buffer of indices */ #endif -#define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ #define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ -- GitLab From 7b5d298261aaa07a3bff07771f0cda7a2956021d Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 21 Jun 2023 09:34:44 +0300 Subject: [PATCH 187/591] Save the previous ext rotation from the ext data and not from the combined orientation data --- lib_rend/ivas_rotation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index c113f23672..205fc271d0 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1126,7 +1126,7 @@ static ivas_error combine_external_and_head_orientations( #ifdef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 ) { - hCombinedOrientationData->Quaternion_prev_extOrientation = hCombinedOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1]; + hCombinedOrientationData->Quaternion_prev_extOrientation = hExtOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1]; } else { -- GitLab From 926dddd71f71da0be0357d789bd2a34cd554ba1a Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 21 Jun 2023 10:37:30 +0300 Subject: [PATCH 188/591] Consolidate switches within OMASA --- lib_com/cnst.h | 2 +- lib_com/ivas_cnst.h | 4 +-- lib_com/ivas_prot.h | 31 +++++++--------------- lib_com/ivas_stereo_td_bit_alloc.c | 6 ----- lib_com/options.h | 4 --- lib_dec/ivas_cpe_dec.c | 14 ++++------ lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_masa_dec.c | 2 -- lib_dec/ivas_omasa_dec.c | 38 +-------------------------- lib_dec/ivas_stat_dec.h | 13 +++++----- lib_dec/ivas_stereo_td_dec.c | 4 --- lib_enc/ivas_cpe_enc.c | 14 ++++------ lib_enc/ivas_enc.c | 41 +++++------------------------- lib_enc/ivas_ism_enc.c | 24 +++-------------- lib_enc/ivas_ism_metadata_enc.c | 17 +++---------- lib_enc/ivas_masa_enc.c | 10 -------- lib_enc/ivas_omasa_enc.c | 2 -- lib_enc/ivas_stat_enc.h | 2 -- lib_enc/ivas_stereo_td_enc.c | 4 --- 19 files changed, 44 insertions(+), 190 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 9881b9d038..0f20b0a647 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -263,7 +263,7 @@ enum{ enum { IND_IVAS_FORMAT, -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS IND_SMODE_OMASA, #endif IND_SMODE, diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3d5ee66a48..a6e80bb1a5 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -363,7 +363,7 @@ typedef enum #ifdef MASA_AND_OBJECTS #define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM no meta / inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC ) -#ifdef OMASA_ENERGIES +#ifdef MASA_AND_OBJECTS #define ADJUST_ISM_BRATE_NEG 6000 #define ADJUST_ISM_BRATE_POS 8000 #endif @@ -1280,7 +1280,7 @@ enum #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #ifdef MASA_AND_OBJECTS #define MAXIMUM_OMASA_FREQ_BANDS 8 /* Corresponds to maximum number of coding bands at 32 kbps */ -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS #define OMASA_STEREO_SW_CNT_MAX 100 #define OMASA_STEREO_SW_CNT_MAX2 5 #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f339361592..52ed50f3b9 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -969,7 +969,7 @@ ivas_error ivas_ism_enc( float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ const int16_t input_frame, /* i : input frame length per channel */ int16_t *nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_ENERGIES +#ifdef MASA_AND_OBJECTS , const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif @@ -992,14 +992,10 @@ ivas_error ivas_ism_metadata_enc( const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ #ifdef MASA_AND_OBJECTS - ,const float lp_noise_CPE /* i : LP filterend total noise estimation */ -#ifdef OMASA_ENERGIES , - const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ -#endif -#ifdef FIX_OMASA_STEREO_SWITCHING - ,int16_t *omasa_stereo_sw_cnt -#endif + const float lp_noise_CPE, /* i : LP filterend total noise estimation */ + const int16_t flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ + int16_t *omasa_stereo_sw_cnt #endif ); @@ -1988,9 +1984,7 @@ void stereo_td_init_dec( void tdm_configure_dec( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ -#ifdef FIX_OMASA_24_4k - const int16_t ism_mode, /* i: ISM mode in combined format */ -#endif + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ @@ -2043,9 +2037,7 @@ void tdm_ol_pitch_comparison( void tdm_configure_enc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ -#ifdef FIX_OMASA_24_4k - const int16_t ism_mode, /* i: ISM mode in combined format */ -#endif + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ @@ -2065,9 +2057,7 @@ ivas_error signaling_enc_secondary( void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ -#ifdef FIX_OMASA_24_4k - const int16_t ism_mode, /* i: ISM mode in combined format */ -#endif + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ @@ -5108,12 +5098,9 @@ ivas_error ivas_masa_encode( ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ - const int16_t ism_imp /* i : importance of separated object */ -#ifdef OMASA_ENERGIES - , + const int16_t ism_imp, /* i : importance of separated object */ const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif -#endif ); void ivas_masa_estimate_energy( @@ -5761,7 +5748,7 @@ void set_ism_importance_interformat( int16_t ism_imp[] /* o : ISM importance flags */ ); -#ifdef OMASA_ENERGIES +#ifdef MASA_AND_OBJECTS /*! r: flag for using less bitrate for objects in OMASA */ int16_t ivas_omasa_ener_brate( const int16_t nchan_ism, /* i : number of ISMs */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 345fef4b3a..b09cfd5384 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -76,9 +76,7 @@ void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ -#ifdef FIX_OMASA_24_4k const int16_t ism_mode, /* i: ISM mode in combined format */ -#endif #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ @@ -143,11 +141,7 @@ void tdm_bit_alloc( /* secondary channel bitrate allocation based on the energy scaling ratio */ #ifdef MASA_AND_OBJECTS -#ifdef FIX_OMASA_24_4k if ( ( ( ivas_format != MASA_ISM_FORMAT || ism_mode == ISM_MODE_NONE ) && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && ism_mode != ISM_MODE_NONE && coder_type > UNVOICED ) ) -#else - if ( ( ivas_format != MASA_ISM_FORMAT && ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) ) || ( ivas_format == MASA_ISM_FORMAT && coder_type > UNVOICED ) ) -#endif #else if ( ( coder_type != UNVOICED ) || tdm_LRTD_flag == 1 ) #endif diff --git a/lib_com/options.h b/lib_com/options.h index 17d991b02e..2ce5ec26a2 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,11 +172,7 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#define OMASA_ENERGIES -#define FIX_OMASA_STEREO_SWITCHING /* VA: introduce Unified/MDCT stereo switching for 3ISM @96 kbps and 4ISM @128 kbps */ -#define FIX_OMASA_BRSW /* Nokia + VA: Fix missing init of OMASA metadata delay buffers, brsw-related init fixes */ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix -#define FIX_OMASA_24_4k /* Nokia: fix OMASA in TD mode at 24.4k */ #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index bc0bb3c5b4..45dfa3a0aa 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -52,7 +52,7 @@ static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, const Decoder_Struct *st_ivas ); -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); #endif @@ -83,9 +83,7 @@ ivas_error ivas_cpe_dec( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t cpe_brate; -#ifdef FIX_OMASA_STEREO_SWITCHING int32_t element_brate_ref; -#endif #endif error = IVAS_ERR_OK; @@ -103,7 +101,7 @@ ivas_error ivas_cpe_dec( sts[0]->BER_detect |= st_ivas->BER_detect; sts[1]->BER_detect |= st_ivas->BER_detect; -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS element_brate_ref = hCPE->element_brate; #endif @@ -111,7 +109,7 @@ ivas_error ivas_cpe_dec( * Read stereo technology info & audio bandwidth *-----------------------------------------------------------------*/ -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS stereo_mode_combined_format_dec( st_ivas, hCPE ); #endif @@ -420,9 +418,7 @@ ivas_error ivas_cpe_dec( tdm_configure_dec( #ifdef MASA_AND_OBJECTS st_ivas->ivas_format, -#ifdef FIX_OMASA_24_4k st_ivas->ism_mode, -#endif #endif hCPE, &tdm_ratio_idx, nb_bits_metadata ); @@ -570,7 +566,7 @@ ivas_error ivas_cpe_dec( hCPE->last_element_brate = hCPE->element_brate; hCPE->last_element_mode = hCPE->element_mode; -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { hCPE->element_brate = element_brate_ref; @@ -1151,7 +1147,7 @@ static void read_stereo_mode_and_bwidth( } -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS /*------------------------------------------------------------------------- * stereo_mode_combined_format_dec() * diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ce637a3c2b..adb7e1006d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -957,7 +957,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == MASA_FORMAT ) { -#ifdef FIX_OMASA_BRSW +#ifdef MASA_AND_OBJECTS /* if we start in ISM_MODE_NONE in MASA_ISM, that appears as normal MASA, but we may change to a mode with ISMs */ st_ivas->ism_extmeta_active = -1; st_ivas->ism_extmeta_cnt = 0; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b82f696e1e..0790b94244 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -266,14 +266,12 @@ ivas_error ivas_masa_decode( #endif } } -#ifdef OMASA_ENERGIES st_ivas->flag_omasa_brate = 0; if ( st_ivas->nchan_ism >= 3 && ivas_total_brate == IVAS_128k ) { st_ivas->flag_omasa_brate = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits_read ) += 1; } -#endif } } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b8aba3bacc..b419da1b59 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -55,9 +55,7 @@ ivas_error ivas_masa_ism_data_open( { MASA_ISM_DATA_HANDLE hMasaIsmData; int16_t ch, bin; -#ifdef FIX_OMASA_BRSW int16_t sf, obj_idx; -#endif if ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) { @@ -86,7 +84,6 @@ ivas_error ivas_masa_ism_data_open( hMasaIsmData->q_azimuth_old[ch] = 0.0f; } -#ifdef FIX_OMASA_BRSW for ( obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ ) { set_s( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); @@ -98,7 +95,6 @@ ivas_error ivas_masa_ism_data_open( } set_s( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); set_s( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); -#endif st_ivas->hMasaIsmData = hMasaIsmData; @@ -155,10 +151,7 @@ ivas_error ivas_omasa_dec_config( ISM_MODE ism_mode_old; IVAS_FORMAT ivas_format_orig; ivas_error error; - -#ifdef FIX_OMASA_BRSW RENDERER_TYPE old_renderer_type; -#endif /* initializations */ ism_total_brate = 0; @@ -179,13 +172,11 @@ ivas_error ivas_omasa_dec_config( /* set ism_mode of current frame */ st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); -#ifdef FIX_OMASA_BRSW /*-----------------------------------------------------------------* * Renderer selection *-----------------------------------------------------------------*/ old_renderer_type = st_ivas->renderer_type; -#endif /* MASA reconfig. */ cpe_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); @@ -272,28 +263,8 @@ ivas_error ivas_omasa_dec_config( ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); -#ifndef FIX_OMASA_BRSW -#ifdef FIX_417_TD_DECORR_BRATE_SW - /* TD Decorrelator */ - if ( st_ivas->hDiracDecBin != NULL ) - { - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif - - /* CLDFB instances */ - if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate; -#ifdef FIX_OMASA_BRSW /*-----------------------------------------------------------------* * Renderer selection *-----------------------------------------------------------------*/ @@ -322,7 +293,6 @@ ivas_error ivas_omasa_dec_config( } } } -#endif /* objects renderer reconfig. */ if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) @@ -394,8 +364,6 @@ ivas_error ivas_omasa_dec_config( } } -#ifdef FIX_OMASA_BRSW -#ifdef FIX_417_TD_DECORR_BRATE_SW /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ @@ -407,7 +375,6 @@ ivas_error ivas_omasa_dec_config( return error; } } -#endif /*-----------------------------------------------------------------* * CLDFB instances @@ -417,7 +384,6 @@ ivas_error ivas_omasa_dec_config( { return error; } -#endif } return IVAS_ERR_OK; @@ -483,7 +449,7 @@ void ivas_set_surplus_brate_dec( st_ivas->hSCE[n]->element_brate = element_brate[n]; *ism_total_brate += ivas_interformat_brate( ISM_MASA_MODE_DISC, st_ivas->nchan_ism, st_ivas->hSCE[n]->element_brate, st_ivas->hIsmMetaData[n]->ism_imp, brate_limit_flag ); -#ifdef OMASA_ENERGIES + if ( ism_imp[n] > 1 && st_ivas->flag_omasa_brate == 1 && brate_limit_flag >= 0 ) { *ism_total_brate -= ADJUST_ISM_BRATE_NEG; @@ -493,8 +459,6 @@ void ivas_set_surplus_brate_dec( { *ism_total_brate += ADJUST_ISM_BRATE_POS; } - -#endif } st_ivas->hCPE[0]->brate_surplus = ism_total_brate_ref - *ism_total_brate; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 6bf14a6a38..d52cf0dc4f 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1381,17 +1381,16 @@ typedef struct Decoder_Struct RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */ int32_t binaural_latency_ns; /* binauralization latency in ns */ #ifdef MASA_AND_OBJECTS - MASA_ISM_DATA_HANDLE hMasaIsmData; /* MASA_ISM rendering structure */ + MASA_ISM_DATA_HANDLE hMasaIsmData; /* MASA_ISM rendering structure */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData; /* External orientation data structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; /* Combined external and head orientation data structure */ - uint8_t editing_ism_enabled; /* Todo Nokia: Temporary, used until proper ISM control available */ - int16_t index_of_edited_ism; /* Todo Nokia: Temporary, used until proper ISM control available */ - int16_t azimuth_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ - int16_t elevation_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ -#ifdef OMASA_ENERGIES + uint8_t editing_ism_enabled; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t index_of_edited_ism; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t azimuth_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t elevation_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ + int16_t flag_omasa_brate; -#endif #endif /* JBM module */ diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index e90baa0dd8..ed25bd1f81 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -86,9 +86,7 @@ void stereo_td_init_dec( void tdm_configure_dec( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ -#ifdef FIX_OMASA_24_4k const int16_t ism_mode, /* i : ISM mode in combined format */ -#endif #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ @@ -312,9 +310,7 @@ void tdm_configure_dec( #ifdef MASA_AND_OBJECTS tdm_bit_alloc( ivas_format, -#ifdef FIX_OMASA_24_4k ism_mode, -#endif hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag, diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 84f28f28be..2631a7ca3e 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -45,7 +45,7 @@ #include "wmc_auto.h" -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS /*--------------------------------------------------------------------------* * Local function prototypes *--------------------------------------------------------------------------*/ @@ -112,9 +112,7 @@ ivas_error ivas_cpe_enc( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t cpe_brate; -#ifdef FIX_OMASA_STEREO_SWITCHING int32_t element_brate_ref; -#endif #endif error = IVAS_ERR_OK; @@ -128,7 +126,7 @@ ivas_error ivas_cpe_enc( ivas_format = hEncoderConfig->ivas_format; input_Fs = hEncoderConfig->input_Fs; ivas_total_brate = hEncoderConfig->ivas_total_brate; -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS element_brate_ref = hCPE->element_brate; #endif @@ -186,7 +184,7 @@ ivas_error ivas_cpe_enc( hCPE->element_mode = select_stereo_mode( hCPE, ivas_format, ivas_total_brate ); } -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS stereo_mode_combined_format_enc( st_ivas, hCPE ); #endif @@ -590,9 +588,7 @@ ivas_error ivas_cpe_enc( tdm_configure_enc( #ifdef MASA_AND_OBJECTS ivas_format, -#ifdef FIX_OMASA_24_4k st_ivas->ism_mode, -#endif #endif hCPE, Etot_last, tdm_SM_or_LRTD_Pri, tdm_ratio_idx, tdm_ratio_idx_SM, attack_flag[0], nb_bits_metadata ); @@ -747,7 +743,7 @@ ivas_error ivas_cpe_enc( hCPE->last_element_brate = hCPE->element_brate; hCPE->last_element_mode = hCPE->element_mode; -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT ) { hCPE->element_brate = element_brate_ref; @@ -1212,7 +1208,7 @@ void destroy_cpe_enc( } -#ifdef FIX_OMASA_STEREO_SWITCHING +#ifdef MASA_AND_OBJECTS /*------------------------------------------------------------------------- * stereo_mode_combined_format_enc() * diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 3898b44fc5..51f7269cc1 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -186,7 +186,7 @@ ivas_error ivas_enc( /* Core coding of Stereo DMX */ if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, nb_bits_metadata -#ifdef OMASA_ENERGIES +#ifdef MASA_AND_OBJECTS , 0 #endif @@ -199,7 +199,7 @@ ivas_error ivas_enc( { /* Analysis, decision about bitrates per channel & core coding */ if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, nb_bits_metadata -#ifdef OMASA_ENERGIES +#ifdef MASA_AND_OBJECTS , 0 #endif @@ -246,11 +246,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0 -#endif -#ifdef OMASA_ENERGIES - , - 0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0,0 #endif ) ) != IVAS_ERR_OK ) { @@ -298,11 +294,9 @@ ivas_error ivas_enc( { float data_separated_object[L_FRAME48k]; int16_t idx_separated_object; -#ifdef OMASA_ENERGIES int16_t flag_omasa_ener_brate; flag_omasa_ener_brate = 0; -#endif if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -344,29 +338,17 @@ ivas_error ivas_enc( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { - if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1] -#ifdef OMASA_ENERGIES - , - 0 -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1],0 ) ) != IVAS_ERR_OK ) { return error; } } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifdef OMASA_ENERGIES flag_omasa_ener_brate = ivas_omasa_ener_brate( st_ivas->hEncoderConfig->nchan_ism, ivas_total_brate, data_f, input_frame ); -#endif /* Analysis, decision about bitrates per channel & core coding */ - if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] -#ifdef OMASA_ENERGIES - , - flag_omasa_ener_brate -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1], flag_omasa_ener_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -386,12 +368,7 @@ ivas_error ivas_enc( /* Encode MASA parameters and write MASA metadata bitstream */ if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, - st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp -#ifdef OMASA_ENERGIES - , - flag_omasa_ener_brate -#endif - ) ) != IVAS_ERR_OK ) + st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp, flag_omasa_ener_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -481,11 +458,7 @@ ivas_error ivas_enc( if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0 -#endif -#ifdef OMASA_ENERGIES - , - 0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 #endif ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index a4943c3a7d..60f3d62da2 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -53,7 +53,7 @@ ivas_error ivas_ism_enc( float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ const int16_t input_frame, /* i : input frame length per channel */ int16_t *nb_bits_metadata /* i : number of metadata bits */ -#ifdef OMASA_ENERGIES +#ifdef MASA_AND_OBJECTS , const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif @@ -256,16 +256,7 @@ ivas_error ivas_ism_enc( { #ifdef MASA_AND_OBJECTS ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1 -#ifdef OMASA_ENERGIES - , - 0 -#endif -#ifdef FIX_OMASA_STEREO_SWITCHING - , - NULL -#endif - ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1,0,NULL ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif @@ -289,16 +280,7 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0 -#ifdef OMASA_ENERGIES - , - flag_omasa_ener_brate -#endif -#ifdef FIX_OMASA_STEREO_SWITCHING - , - st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL -#endif - ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0, flag_omasa_ener_brate ,st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL ); if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 53f0dd7941..07925a603a 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -191,16 +191,10 @@ ivas_error ivas_ism_metadata_enc( const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ #ifdef MASA_AND_OBJECTS , - const float lp_noise_CPE -#ifdef OMASA_ENERGIES - , - const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ -#endif -#ifdef FIX_OMASA_STEREO_SWITCHING - , + const float lp_noise_CPE, + const int16_t flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ int16_t *omasa_stereo_sw_cnt #endif -#endif ) { int16_t i, ch, nb_bits_start = 0; @@ -703,7 +697,7 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_ism; ch++ ) { *ism_total_brate += ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ); -#ifdef OMASA_ENERGIES + if ( ism_imp[ch] > 1 && flag_omasa_ener_brate == 1 && brate_limit_flag >= 0 ) { *ism_total_brate -= ADJUST_ISM_BRATE_NEG; @@ -713,11 +707,9 @@ ivas_error ivas_ism_metadata_enc( { *ism_total_brate += ADJUST_ISM_BRATE_POS; } - -#endif } ism_metadata_flag_global = 1; -#ifdef FIX_OMASA_STEREO_SWITCHING + if ( ism_mode == ISM_MASA_MODE_DISC ) { brate_limit_flag = 0; @@ -731,7 +723,6 @@ ivas_error ivas_ism_metadata_enc( *omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; } } -#endif } #endif diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index ea01bf0dc9..7c3557332d 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -181,10 +181,8 @@ ivas_error ivas_masa_enc_open( #ifdef MASA_AND_OBJECTS hMasa->data.lp_noise_CPE = -1; -#ifdef FIX_OMASA_STEREO_SWITCHING hMasa->data.omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; hMasa->data.omasa_stereo_sw_cnt2 = OMASA_STEREO_SW_CNT_MAX2; -#endif #endif st_ivas->hMasa = hMasa; @@ -246,11 +244,9 @@ ivas_error ivas_masa_encode( const int16_t idx_separated_object, /* i : index of the separated object */ OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ const int16_t ism_imp /* i : importance of separated object */ -#ifdef OMASA_ENERGIES , const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif -#endif ) { MASA_DIRECTIONAL_SPATIAL_META *h_orig_metadata; @@ -466,13 +462,11 @@ ivas_error ivas_masa_encode( #endif } -#ifdef OMASA_ENERGIES if ( ivas_total_brate == IVAS_128k && nchan_ism >= 3 ) { push_next_indice( hMetaData, flag_omasa_ener_brate, 1 ); hQMetaData->metadata_max_bits -= 1; } -#endif } } else @@ -966,11 +960,7 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { -#ifdef FIX_OMASA_STEREO_SWITCHING if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT || st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) -#else - if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT ) -#endif { st_ivas->hMasa->data.lp_noise_CPE = st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise; } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index c10ec862c5..d7bbe7bb6b 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -727,7 +727,6 @@ void ivas_set_surplus_brate_enc( } -#ifdef OMASA_ENERGIES /*--------------------------------------------------------------------------* * ivas_omasa_ener_brate() * @@ -771,7 +770,6 @@ int16_t ivas_omasa_ener_brate( return flag_omasa_ener_brate; } -#endif /*--------------------------------------------------------------------------* diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index c8c78d41b5..bc92b581aa 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -787,10 +787,8 @@ typedef struct ivas_masa_encoder_data_struct float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; int16_t nchan_ism; float lp_noise_CPE; /* LP filterend total noise estimation */ -#ifdef FIX_OMASA_STEREO_SWITCHING int16_t omasa_stereo_sw_cnt; int16_t omasa_stereo_sw_cnt2; -#endif #endif int16_t num_Cldfb_instances; diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 071ef6d361..35b2bd1b49 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -312,9 +312,7 @@ ivas_error stereo_set_tdm( void tdm_configure_enc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ -#ifdef FIX_OMASA_24_4k const int16_t ism_mode, /* i : ISM mode in combined format */ -#endif #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ @@ -496,9 +494,7 @@ void tdm_configure_enc( #ifdef MASA_AND_OBJECTS tdm_bit_alloc( ivas_format, -#ifdef FIX_OMASA_24_4k ism_mode, -#endif hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus, hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ), &( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag, -- GitLab From e14f1c10f3c7011bd4b71a528abbc8e748dc58f7 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 21 Jun 2023 11:37:54 +0300 Subject: [PATCH 189/591] Apply clang format --- lib_com/ivas_stereo_td_bit_alloc.c | 2 +- lib_dec/ivas_stereo_td_dec.c | 2 +- lib_dec/lib_dec.c | 2 +- lib_enc/ivas_enc.c | 4 ++-- lib_enc/ivas_ism_enc.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_stereo_td_enc.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index b09cfd5384..823c1b1944 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -76,7 +76,7 @@ void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ - const int16_t ism_mode, /* i: ISM mode in combined format */ + const int16_t ism_mode, /* i: ISM mode in combined format */ #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index ed25bd1f81..3b654960c1 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -86,7 +86,7 @@ void stereo_td_init_dec( void tdm_configure_dec( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ - const int16_t ism_mode, /* i : ISM mode in combined format */ + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t *tdm_ratio_idx, /* o : ratio index */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 849cc416b4..e6b4f977f8 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2579,7 +2579,7 @@ static ivas_error printConfigInfo_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MC_FORMAT ) #else - else /* MC_FORMAT */ + else /* MC_FORMAT */ #endif { if ( ( error = get_channel_config( st_ivas->transport_config, &config_str[0] ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 51f7269cc1..8c58bdc083 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -246,7 +246,7 @@ ivas_error ivas_enc( ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 #ifdef MASA_AND_OBJECTS , - ISM_MODE_NONE, -1, NULL, -1, NULL, 0,0 + ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 #endif ) ) != IVAS_ERR_OK ) { @@ -338,7 +338,7 @@ ivas_error ivas_enc( } else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) { - if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1],0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_enc( st_ivas, &data_separated_object, input_frame, &nb_bits_metadata[1], 0 ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 60f3d62da2..3e0dd47585 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -256,7 +256,7 @@ ivas_error ivas_ism_enc( { #ifdef MASA_AND_OBJECTS ivas_ism_metadata_enc( &st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1,0,NULL ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag, -1, 0, NULL ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #endif @@ -280,7 +280,7 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0, flag_omasa_ener_brate ,st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0, flag_omasa_ener_brate, st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL ); if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 9c0bb9ddc3..ea865461c4 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -192,7 +192,7 @@ ivas_error ivas_ism_metadata_enc( #ifdef MASA_AND_OBJECTS , const float lp_noise_CPE, - const int16_t flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ + const int16_t flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ int16_t *omasa_stereo_sw_cnt #endif ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 35b2bd1b49..e11c0e7ebd 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -312,7 +312,7 @@ ivas_error stereo_set_tdm( void tdm_configure_enc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ - const int16_t ism_mode, /* i : ISM mode in combined format */ + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float Etot_last[CPE_CHANNELS], /* i/o: Energy of last frame */ -- GitLab From 88da52080109e0f265da649562d96f1450d7b5b4 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 21 Jun 2023 18:18:40 +0200 Subject: [PATCH 190/591] propagate current output config to internal config --- lib_dec/ivas_output_config.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 16787b63cd..1b82adb84d 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -104,11 +104,19 @@ void ivas_renderer_select( else { *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + *internal_config = output_config; +#else *internal_config = AUDIO_CONFIG_BINAURAL; +#endif // FIX_571_REVERB_NOT_ACTIVATED_ISM } #else *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + *internal_config = output_config; +#else *internal_config = AUDIO_CONFIG_BINAURAL; +#endif // FIX_571_REVERB_NOT_ACTIVATED_ISM #endif } else -- GitLab From b93c3030d30f0312d71b84954bf6c696e640b6d8 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 21 Jun 2023 18:19:09 +0200 Subject: [PATCH 191/591] add compiler define for 571 --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index c13f313a91..b17b2a14d6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,6 +152,7 @@ #define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ #define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ +#define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ -- GitLab From 7e473c0eb54db1a0023e060c2ea39441de8484e8 Mon Sep 17 00:00:00 2001 From: Remco Stoutjesdijk Date: Wed, 21 Jun 2023 18:33:30 +0200 Subject: [PATCH 192/591] clangd whispering --- lib_dec/ivas_output_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 1b82adb84d..385a5103df 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -113,7 +113,7 @@ void ivas_renderer_select( #else *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - *internal_config = output_config; + *internal_config = output_config; #else *internal_config = AUDIO_CONFIG_BINAURAL; #endif // FIX_571_REVERB_NOT_ACTIVATED_ISM -- GitLab From a53ad499ccb7ae26c047b2189475d5ac646f9cfb Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 21 Jun 2023 21:24:10 +0300 Subject: [PATCH 193/591] Set correct value in MASA external renderer for numParametricDirections --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 540072679f..6f88d3a37b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5880,7 +5880,7 @@ static void copyMasaMetadataToDiracRenderer( int16_t meta_write_index; #ifdef MASA_AND_OBJECTS - hDirAC->numParametricDirections = meta->descriptive_meta.numberOfDirections; + hDirAC->numParametricDirections = meta->descriptive_meta.numberOfDirections + 1; #endif hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; -- GitLab From a54695e79a99dd2687ca5d0386b7fd51b187e0cf Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 21 Jun 2023 21:34:48 +0300 Subject: [PATCH 194/591] Apply clang format --- lib_enc/ivas_init_enc.c | 1 - lib_enc/ivas_omasa_enc.c | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 2266f40206..32403a9b31 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -597,7 +597,6 @@ ivas_error ivas_init_encoder( { return error; } - } if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 4792f64759..7b8206de4b 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -253,15 +253,11 @@ ivas_error ivas_omasa_enc_config( /* re-write IVAS format signalling - actual 'ism_mode' was not known before */ if ( st_ivas->nSCE > 0 ) { - reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, - st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot - ); + reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot ); } else { - reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, - st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->nb_bits_tot - ); + reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->nb_bits_tot ); } ivas_write_format( st_ivas ); -- GitLab From bb5621654e47bc8454a2752c16e047f4859ebdf5 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 22 Jun 2023 15:42:57 +1000 Subject: [PATCH 195/591] cross connection to CLDFB codec in ISM split rendering mode --- ...t_renderer_config_768_1dof_hoa_lc3plus.txt | 2 +- lib_com/options.h | 2 ++ lib_rend/ivas_objectRenderer.c | 5 ++++ lib_rend/lib_rend.c | 24 ++++++++++++++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt index 9de2dad1a0..498c6add9b 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt @@ -2,7 +2,7 @@ BITRATE = 768000; DOF = 1; HQMODE = 0; -CODEC = 1 +CODEC = 1; [GENERAL] RENDERER = CREND; diff --git a/lib_com/options.h b/lib_com/options.h index 30e4a8fe4f..05896ce86d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -181,6 +181,8 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER +#define SPLIT_REND_CLDFB_ISM + #define SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT #define SPLIT_REND_ZERO_OUT_YAW_D diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 8fb3497458..f7e4201a5f 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -548,6 +548,11 @@ ivas_error ivas_td_binaural_open_ext( transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; + +#ifdef SPLIT_REND_WITH_HEAD_ROT + hTransSetup.ls_azimuth = NULL; + hTransSetup.ls_elevation = NULL; +#endif #ifdef TD_TDREND_FIX_NULLPTR_ACCESS if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0db8bdc162..74bef54eb0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3237,7 +3237,14 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, - 0, 0 ); + + 0, +#ifdef SPLIT_REND_CLDFB_ISM + ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 +#else + 0 +#endif + ); if ( error != IVAS_ERR_OK ) { return error; @@ -3855,7 +3862,9 @@ ivas_error IVAS_REND_AddInput( /* Hack to override default split rendering codec from Dolby CLDFB to LC3plus. This will not be necessary once the split rendering codec becomes selectable by the lib user. */ closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); +#ifndef SPLIT_REND_CLDFB_ISM hIvasRend->hRendererConfig->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LC3PLUS; +#endif if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; @@ -7308,7 +7317,11 @@ ivas_error IVAS_REND_GetSamples( #endif #ifdef SPLIT_REND_LC3PLUS - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB +#ifdef SPLIT_REND_CLDFB_ISM + || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ && hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { @@ -7333,7 +7346,12 @@ ivas_error IVAS_REND_GetSamples( tmpBinaural, 1, 1, - 0 ); +#ifdef SPLIT_REND_CLDFB_ISM + ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 +#else + 0 +#endif + ); if ( error != IVAS_ERR_OK ) { return error; -- GitLab From a970429255bb7fbcfc38960814c3991cc0ff3da0 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Thu, 22 Jun 2023 10:44:42 +0200 Subject: [PATCH 196/591] Activates reverb for parametric ISM --- lib_dec/ivas_output_config.c | 4 ++-- lib_rend/ivas_dirac_dec_binaural_functions.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 385a5103df..e60a48a10c 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -108,7 +108,7 @@ void ivas_renderer_select( *internal_config = output_config; #else *internal_config = AUDIO_CONFIG_BINAURAL; -#endif // FIX_571_REVERB_NOT_ACTIVATED_ISM +#endif } #else *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; @@ -116,7 +116,7 @@ void ivas_renderer_select( *internal_config = output_config; #else *internal_config = AUDIO_CONFIG_BINAURAL; -#endif // FIX_571_REVERB_NOT_ACTIVATED_ISM +#endif #endif } else diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 4616993f79..1f3ac58318 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1378,7 +1378,11 @@ static void ivas_dirac_dec_binaural_process_output( offsetSamples = 0; nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) +#endif { /* Process second / room effect part of binaural output when needed */ ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); @@ -1445,7 +1449,11 @@ static void ivas_dirac_dec_binaural_process_output( } } +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) +#endif { /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); -- GitLab From ca0d689454648d46a0e5296e381ec30f427352cc Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 22 Jun 2023 18:53:45 +1000 Subject: [PATCH 197/591] adding cross connections in ISM mode in IVAS decoder --- lib_com/common_api_types.h | 1 + lib_dec/ivas_init_dec.c | 16 ++++++++++++++-- lib_rend/ivas_splitRendererPre.c | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 506547144d..714b7db0b2 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -115,6 +115,7 @@ typedef enum { IVAS_SPLIT_REND_CODEC_LCLD, IVAS_SPLIT_REND_CODEC_LC3PLUS, + IVAS_SPLIT_REND_CODEC_NONE } IVAS_SPLIT_REND_CODEC; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a94dcfafb9..fb731bdeaf 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1282,21 +1282,33 @@ ivas_error ivas_init_decoder( } #ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_CLDFB_ISM + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) +#endif { ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->splitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis ); /* Split rendering with ISMs only supported with LC3plus */ +#ifndef SPLIT_REND_CLDFB_ISM assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ); - +#endif #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING error = #endif ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 0, 0 ); + hDecoderConfig->output_Fs, 0, +#ifdef SPLIT_REND_CLDFB_ISM + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 +#else + 0 +#endif + ); #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING if ( error != IVAS_ERR_OK ) diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index da1c8b9bca..9fccbb8ec6 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2005,6 +2005,13 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( } #endif } +#ifdef SPLIT_REND_LC3PLUS + else + { + pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; + pBits->codec = IVAS_SPLIT_REND_CODEC_NONE; + } +#endif /*zero pad*/ bit_len = SplitRendBitRate / FRAMES_PER_SEC; -- GitLab From f91e7283c98ebb1896765342243d76b9b44e2932 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Thu, 22 Jun 2023 11:41:02 +0200 Subject: [PATCH 198/591] Checking in a few draft chunks of code --- lib_com/options.h | 2 + lib_dec/ivas_jbm_dec.c | 75 ++++++++++++++++++++++++++++++++ lib_dec/ivas_mc_paramupmix_dec.c | 32 ++++++++++++++ 3 files changed, 109 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index e51736a79f..46bb929d94 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,8 @@ #define FIX_545_ASSERT /* VA: fix issue 545, replace assert() with warning message when hitting memory limit in the buffer of indices */ #endif +#define JBM_PARAMUPMIX + #define FIX_383_CLEAN_UP /* Dlb : Clean up of unused functions */ #define FIX_532_ISM_MD_INACTIVE /* VA: issue 532: improve MD coding in ISM inactive frames */ #define FIX_547_NAN_IGF_DEC /* FhG: issue 547: fix possible nan in IGF decoder */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 6871747db6..a0e3cb243b 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -350,6 +350,81 @@ ivas_error ivas_jbm_dec_tc( } } } +#ifdef JBM_PARAMUPMIX + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); + + ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); + + if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + + mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); + + ivas_mc_paramupmix_dec( st_ivas, output ); + + /* HP filtering */ + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + if ( n != LFE_CHANNEL ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + } + + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) + { + ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); + } + + /* Rendering */ + if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) + { + ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); + } +#if 0 + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, + st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) + { + ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); + } + else + { + ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, p_output, p_output ); + } + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); + } +#endif + } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { /* read Parametric MC parameters from the bitstream */ diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 6447c2f456..709ec3d531 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -307,6 +307,10 @@ ivas_error ivas_mc_paramupmix_dec_open( int16_t nchan_transport; uint16_t i; ivas_error error; +#ifdef JBM_PARAMUPMIX + int16_t num_channels_internal; + num_channels_internal = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; +#endif error = IVAS_ERR_OK; @@ -356,6 +360,34 @@ ivas_error ivas_mc_paramupmix_dec_open( set_zero( hMCParamUpmix->pcm_delay[i], 240 ); } +#ifdef JBM_PARAMUPMIX + /* allocate transport channels*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) + { + int16_t nchan_to_allocate; + int16_t nchan_tc; + TC_BUFFER_MODE buffer_mode; + + buffer_mode = TC_BUFFER_MODE_RENDERER; + nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + nchan_to_allocate = num_channels_internal; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + nchan_tc = st_ivas->hDecoderConfig->nchan_out; + nchan_to_allocate = nchan_tc; + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + 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; + } + } +#endif + st_ivas->hMCParamUpmix = hMCParamUpmix; return error; -- GitLab From 818a23392f07d0ea0413d1c2fbe0ae532d7a1a3d Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Thu, 22 Jun 2023 12:44:53 +0200 Subject: [PATCH 199/591] Reverted change in switching modes in ivas_dirac_dec_binaural_process_output function --- lib_rend/ivas_dirac_dec_binaural_functions.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 1f3ac58318..4616993f79 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1378,11 +1378,7 @@ static void ivas_dirac_dec_binaural_process_output( offsetSamples = 0; nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { /* Process second / room effect part of binaural output when needed */ ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); @@ -1449,11 +1445,7 @@ static void ivas_dirac_dec_binaural_process_output( } } -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); -- GitLab From 9f73d76fec97023ff03c24537504e4b65173ded0 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Thu, 22 Jun 2023 12:47:00 +0200 Subject: [PATCH 200/591] Fix for erroneous renderer modes switching in case of BINAURAL_ROOM_REVERB output configuration --- lib_dec/ivas_output_config.c | 12 ++++++++++++ lib_rend/lib_rend.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index e60a48a10c..f1e7c65a64 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -135,7 +135,11 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) { *internal_config = output_config; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -147,7 +151,11 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == SBA_FORMAT ) { *internal_config = AUDIO_CONFIG_HOA3; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { *renderer_type = RENDERER_BINAURAL_FASTCONV; } @@ -183,7 +191,11 @@ void ivas_renderer_select( if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { *internal_config = output_config; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4e75d5fea8..d9ab18ebc5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2489,7 +2489,11 @@ static ivas_error initMasaDummyDecForBinauralOut( 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 ), output_config ); +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { decDummy->renderer_type = RENDERER_BINAURAL_PARAMETRIC; } -- GitLab From bdf5c51afb02038d1c27a726f106b218543796ab Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 23 Jun 2023 15:31:08 +1000 Subject: [PATCH 201/591] bug fixes in BINAURAL_SPLIT_PCM format --- .../sample_split_rend_script_ivas_rend_ism.py | 151 ++++++++++++++++++ apps/decoder.c | 8 + lib_dec/ivas_dec.c | 7 +- 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py b/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py new file mode 100644 index 0000000000..a6bd2c04a4 --- /dev/null +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py @@ -0,0 +1,151 @@ +from scipy.io.wavfile import read, write +from scipy import signal +import subprocess +import numpy as np +import sys +import os + +## dimension of following 2 arrays should be same, that is for each file name there should be a tag +file_names = [ +'../scripts/testv/stv4ISM48s.wav' +]; +ism_md_file_names = [ +'../scripts/testv/stvISM1.csv', +'../scripts/testv/stvISM2.csv', +'../scripts/testv/stvISM3.csv', +'../scripts/testv/stvISM4.csv' +]; +file_tags = [ +'test_ISM' +]; + +## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag +pre_hr_file_names = [ +'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' +]; +post_hr_file_names = [ +'trajectories/post-renderer_pose_files/post_0static.csv' +]; +hr_file_tags = [ +'yaw20static' +]; + +renderers = [ +('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), +('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), +('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), +('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), +('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), +('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), +('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), +('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), +('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; + +split_md_file_name = 'split_md.bin'; + +split_rend_file_outs = ['recons_out_pos0.wav', + 'recons_out_pos1.wav', + 'recons_out_pos2.wav', + 'rotated_ref_pos0.wav', + 'rotated_ref_pos1.wav', + 'rotated_ref_pos2.wav', + 'rotated_ref_RefPos.wav', + 'split_rend_MD_bitrate.txt'] + + +def check_and_makedir(dir_path): + if not os.path.exists(dir_path): + try: + os.makedirs(dir_path) + except OSError as e: + if e.errno != errno.EEXIST: + raise # raises the error again + + +def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): + check_and_makedir(out_dir); + for idx in range(0, len(file_tags)): + for hr_idx in range(0, len(hr_file_tags)): + for rend in range(0, len(renderers)): + filename = file_names[idx]; + file_in = os.path.join(file_dir, filename); + rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); + if renderers[rend][2] == '0': + bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_CLDFB'; + else: + bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_PCM'; + md_out_arg = ['-om', split_md_file_name]; + md_in_arg = ['-im', split_md_file_name]; + file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); + file_out = os.path.join(out_dir, file_out_name); + + print(file_in) + print(bs_file_out) + print(file_out) + + hr_pre_file_name = pre_hr_file_names[hr_idx]; + hr_pre_file = os.path.join(file_dir, hr_pre_file_name); + hr_post_file_name = post_hr_file_names[hr_idx]; + hr_post_file = os.path.join(file_dir, hr_post_file_name); + + pre_rend_cmd = [ + rend_exe, + '-rc', renderers[rend][1], + md_out_arg[0], md_out_arg[1], + '-i', file_in, + '-if', 'ISM4', + '-im', ism_md_file_names[0], ism_md_file_names[1], ism_md_file_names[2], ism_md_file_names[3], + '-o', bs_file_out, + '-of', out_fmt, + '-fs', '48', + '-tf', hr_pre_file, + ] + + + print(pre_rend_cmd) + test_status = subprocess.call(pre_rend_cmd, shell=False) + + + post_rend_cmd = [ + rend_exe, + md_in_arg[0], md_in_arg[1], + '-i', bs_file_out, + '-if', out_fmt, + '-o', file_out, + '-of', 'BINAURAL', + '-fs', '48', + '-tf', hr_post_file, + ] + + + print(post_rend_cmd) + test_status = subprocess.call(post_rend_cmd, shell=False) + + if os.path.exists(bs_file_out): + os.remove(bs_file_out); + + if os.path.exists(split_md_file_name): + os.remove(split_md_file_name); + + + for fo in split_rend_file_outs: + file_old = os.path.join(os. getcwd(), fo); + file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); + file_new = os.path.join(out_dir, file_out_name); + if os.path.exists(file_old): + os.rename(file_old, file_new); + + +def main(argv): + print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') + if len(argv) < 3: + return print(len(argv)) + return generate_split_rend_lis_items(*argv[1:]) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/apps/decoder.c b/apps/decoder.c index 25b1fdd405..fbf14cd1ce 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1338,6 +1338,13 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } +#ifdef SPLIT_REND_CLDFB_ISM + if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || + ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) + { + pFullDelayNumSamples[0] = 0; + } +#endif if ( !arg.delayCompensationEnabled ) { @@ -1345,6 +1352,7 @@ static ivas_error initOnFirstGoodFrame( } *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; + if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumOutputChannels, code: %d\n", error ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 61435787cf..bb7e2878bd 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -44,7 +44,6 @@ #endif #include "wmc_auto.h" - /*--------------------------------------------------------------------------* * ivas_dec() * @@ -245,7 +244,12 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { #ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_CLDFB_ISM + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) +#endif { ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } @@ -652,6 +656,7 @@ ivas_error ivas_dec( hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; + ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, -- GitLab From cab49d5ed8a6c9a30758310ecbd5a22686e2c64a Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Fri, 23 Jun 2023 09:34:54 +0200 Subject: [PATCH 202/591] Fix for erroneous renderer modes switching in case of BINAURAL_ROOM_REVERB output configuration --- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 1f3ac58318..87bc40298d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1379,7 +1379,7 @@ static void ivas_dirac_dec_binaural_process_output( nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) #endif @@ -1450,7 +1450,7 @@ static void ivas_dirac_dec_binaural_process_output( } #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) #endif -- GitLab From 14f026d0aad392c49504be9a7db21f0ce6be13fd Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Fri, 23 Jun 2023 14:06:38 +0200 Subject: [PATCH 203/591] Fix for erroneous renderer modes switching in case of BINAURAL_ROOM_REVERB output configuration --- lib_dec/ivas_binRenderer_internal.c | 8 ++++++++ lib_dec/ivas_output_config.c | 16 ++++++++-------- lib_rend/ivas_dirac_dec_binaural_functions.c | 8 -------- lib_rend/ivas_reverb.c | 8 ++++++++ lib_rend/lib_rend.c | 4 ---- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5bd09236e0..b3c31a9794 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -723,7 +723,11 @@ ivas_error ivas_binRenderer_open( } /* Allocate memories needed for reverb module */ +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hIntSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->hIntSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, @@ -731,7 +735,11 @@ ivas_error ivas_binRenderer_open( &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + RENDERER_BINAURAL_FASTCONV, +#else RENDERER_BINAURAL_FASTCONV_ROOM, +#endif st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index f1e7c65a64..94e22ea419 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -82,7 +82,11 @@ void ivas_renderer_select( { if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( output_config == AUDIO_CONFIG_BINAURAL ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -135,11 +139,7 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) { *internal_config = output_config; -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else if ( output_config == AUDIO_CONFIG_BINAURAL ) -#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -191,11 +191,7 @@ void ivas_renderer_select( if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { *internal_config = output_config; -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else if ( output_config == AUDIO_CONFIG_BINAURAL ) -#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -207,7 +203,11 @@ void ivas_renderer_select( else { *internal_config = transport_config; +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { #ifdef DEBUGGING if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 87bc40298d..4616993f79 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1378,11 +1378,7 @@ static void ivas_dirac_dec_binaural_process_output( offsetSamples = 0; nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { /* Process second / room effect part of binaural output when needed */ ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); @@ -1449,11 +1445,7 @@ static void ivas_dirac_dec_binaural_process_output( } } -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 6374b6812e..cfea5594a1 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1813,7 +1813,11 @@ ivas_error ivas_binaural_reverb_open( set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); } +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( renderer_type == RENDERER_BINAURAL_FASTCONV ) +#else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) +#endif { if ( !roomAcoustics->override ) { @@ -1900,7 +1904,11 @@ ivas_error ivas_binaural_reverb_open( } else { +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if (renderer_type == RENDERER_BINAURAL_FASTCONV ) +#else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) +#endif { ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections ); ivas_binaural_reverb_setPreDelay( hReverb, 10 ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d9ab18ebc5..4e75d5fea8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2489,11 +2489,7 @@ static ivas_error initMasaDummyDecForBinauralOut( 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 ), output_config ); -#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else if ( output_config == AUDIO_CONFIG_BINAURAL ) -#endif { decDummy->renderer_type = RENDERER_BINAURAL_PARAMETRIC; } -- GitLab From 41bdcfbb47a625c584e1ea062e4a8523b1ae0e97 Mon Sep 17 00:00:00 2001 From: Michael Schug Date: Fri, 23 Jun 2023 14:50:50 +0200 Subject: [PATCH 204/591] small changes to let the decoder run with -vs command line (without meaningful output): increased tc buffer channels to 12, disabled full ivas_mc_paramumix_dec function for jbm --- lib_dec/ivas_jbm_dec.c | 8 +++++++- lib_dec/ivas_mc_paramupmix_dec.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9690f9a61b..b7cbd47e58 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -381,7 +381,7 @@ ivas_error ivas_jbm_dec_tc( mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); - ivas_mc_paramupmix_dec( st_ivas, output ); + //ivas_mc_paramupmix_dec( st_ivas, output ); /* HP filtering */ for ( n = 0; n < st_ivas->nchan_transport; n++ ) @@ -919,6 +919,12 @@ ivas_error ivas_jbm_dec_render( ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); } } +#ifdef JBM_PARAMUPMIX + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { ivas_param_mc_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 709ec3d531..62bf88caf9 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -370,7 +370,7 @@ ivas_error ivas_mc_paramupmix_dec_open( buffer_mode = TC_BUFFER_MODE_RENDERER; nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - nchan_to_allocate = num_channels_internal; + nchan_to_allocate = nchan_tc; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) { buffer_mode = TC_BUFFER_MODE_BUFFER; -- GitLab From 5033c9e2996529bf41659c950a5b7275bff4159d Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 23 Jun 2023 16:22:25 +0200 Subject: [PATCH 205/591] rename parameter --- lib_dec/ivas_masa_dec.c | 10 +++++----- lib_enc/ivas_masa_enc.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a0f44e2345..10d90e9ee7 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -107,6 +107,7 @@ ivas_error ivas_masa_decode( int16_t obj; int16_t i, ch, ism_imp; int16_t dirac_bs_md_write_idx; + int32_t masa_total_brate; dirac_bs_md_write_idx = 0; ism_imp = 0; @@ -350,16 +351,15 @@ ivas_error ivas_masa_decode( #endif #ifdef MASA_AND_OBJECTS - int32_t total_brate; - total_brate = ivas_total_brate; + masa_total_brate = ivas_total_brate; if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + masa_total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); } - if ( total_brate >= IVAS_384k ) + if ( masa_total_brate >= IVAS_384k ) { - if ( total_brate >= IVAS_512k ) + if ( masa_total_brate >= IVAS_512k ) #else if ( ivas_total_brate >= IVAS_384k ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 7c3557332d..443c086a2a 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -254,6 +254,7 @@ ivas_error ivas_masa_encode( int16_t masa_sid_descriptor; #ifdef MASA_AND_OBJECTS int16_t low_bitrate_mode; + int32_t masa_total_brate; #endif masa_sid_descriptor = -1; @@ -538,16 +539,15 @@ ivas_error ivas_masa_encode( /* Encode metadata */ #ifdef MASA_AND_OBJECTS - int32_t total_brate; - total_brate = ivas_total_brate; + masa_total_brate = ivas_total_brate; if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MASA_MODE_DISC ) { - total_brate = calculate_cpe_brate_MASA_ISM( ism_mode, ivas_total_brate, nchan_ism ); + masa_total_brate = calculate_cpe_brate_MASA_ISM( ism_mode, ivas_total_brate, nchan_ism ); } - if ( total_brate >= IVAS_384k ) + if ( masa_total_brate >= IVAS_384k ) { - if ( total_brate >= IVAS_512k ) + if ( masa_total_brate >= IVAS_512k ) { ivas_qmetadata_enc_encode_hr_384_512( hMetaData, hQMetaData, 16, 4 ); } -- GitLab From f19dad68c49bb00819ff14d1c54ee534556f3f53 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Sun, 25 Jun 2023 18:11:42 +0200 Subject: [PATCH 206/591] Correct length of unit impulse filter used for initialization --- lib_rend/ivas_objectRenderer_sources.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 456b406b1d..ac16efab30 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -674,7 +674,11 @@ void TDREND_SRC_Init( /* Reset memory buffers */ Src_p->itd = 0; Src_p->previtd = 0; +#ifdef FIX_550_FIRST_FRAME_ACCESS + Src_p->filterlength = 1; /* Init to unit impulse of length 1 */ +#else Src_p->filterlength = -1; +#endif set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); -- GitLab From 3009ea05bb67367cf225476e6097d79c30d7e418 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Sun, 25 Jun 2023 19:39:04 +0200 Subject: [PATCH 207/591] Add initialization of Gain for gain interpolation --- lib_rend/ivas_objectRenderer_sources.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 3408eb23fb..87cf52ad10 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -689,6 +689,9 @@ void TDREND_SRC_Init( Src_p->hrf_right_prev[0] = 1; Src_p->azim_prev = 0.0f; Src_p->elev_prev = 0.0f; +#ifdef FIX_550_FIRST_FRAME_ACCESS + Src_p->Gain = 1; +#endif Src_p->prevGain = 1.0f; return; -- GitLab From 41ae1af907acf4c7abf9781bda9b99880bd273db Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 26 Jun 2023 12:58:48 +0530 Subject: [PATCH 208/591] Resolved warnings introduced by merge to main --- apps/decoder.c | 11 ++++++--- lib_com/ivas_prot.h | 4 +-- lib_dec/ivas_binRenderer_internal.c | 10 ++++++++ lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_dirac_dec.c | 19 ++++++++++++--- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_objectRenderer.c | 26 +++++++++++++++++--- lib_rend/lib_rend.c | 38 ++++++++++++++++++++++++----- 8 files changed, 92 insertions(+), 20 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a8299f8786..6308e9c245 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2004,13 +2004,16 @@ static ivas_error decodeG192( { for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), + if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), #ifdef EXTERNAL_ORIENTATIONS - RotationFileReader_getFilePath( headRotReader ) ); + RotationFileReader_getFilePath( headRotReader ) ); #else - HeadRotationFileReader_getFilePath( headRotReader ) ); + HeadRotationFileReader_getFilePath( headRotReader ) ); #endif - goto cleanup; + goto cleanup; + } } } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6f23927720..0bc3419b31 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4960,7 +4960,7 @@ void ivas_quantise_real_values( float *quant, const int16_t dim ); - +#ifndef FIX_SPLIT_REND_MERGE ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, @@ -4968,7 +4968,7 @@ ivas_error ivas_deindex_real_index( const float max_value, float *quant, const int16_t num_ch_dim2 ); - +#endif void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, const int16_t table_idx diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 1d83e95709..51b5ad0349 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1368,8 +1368,13 @@ void ivas_binaural_cldfb_sf( { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#ifdef FIX_SPLIT_REND_MERGE + float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; int16_t slot_size, slots_to_render, first_sf, last_sf; int16_t slot_index_start, slot_index_start_cldfb; @@ -1440,8 +1445,13 @@ void ivas_binaural_cldfb_sf( for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) { +#ifdef FIX_SPLIT_REND_MERGE + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[0][ch][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[0][ch][slot_idx]; +#else RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; +#endif } cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_index_start_cldfb * maxBand] ), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch] ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index b4df3610b7..34135ae57c 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -287,7 +287,7 @@ ivas_error ivas_dec( else { #endif - if ( ( error = ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 910d4d27ec..9039d22b0d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3148,7 +3148,10 @@ void ivas_dirac_dec_render_sf( } ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); - +#ifndef FIX_SPLIT_REND_MERGE +#ifdef FIX_SPLIT_REND_MERGE + index_slot = subframe_idx * hDirAC->subframe_nbslots[subframe_idx]; +#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { /* Perform binaural rendering */ @@ -3180,7 +3183,11 @@ void ivas_dirac_dec_render_sf( for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) #endif { +#ifdef FIX_SPLIT_REND_MERGE + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) +#else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) +#endif { for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { @@ -3210,6 +3217,7 @@ void ivas_dirac_dec_render_sf( #endif } } +#endif #ifndef FIX_393_459_460_SBA_MD if ( hDirAC->hConfig->dec_param_estim == FALSE ) { @@ -3336,8 +3344,13 @@ void ivas_dirac_dec_render_sf( for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; +#ifdef FIX_SPLIT_REND_MERGE + RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; +#else + RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; +#endif } cldfbSynthesis( RealBuffer, diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index f5dff1cdbe..621bb1af9e 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1689,7 +1689,7 @@ ivas_error ivas_rend_crendProcess( if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, pcm_tmp, output_Fs, subframe_idx + if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, p_pcm_tmp, output_Fs, subframe_idx #ifdef SPLIT_REND_WITH_HEAD_ROT , pos_idx diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 7863f2fb9f..3b8943f9cd 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -743,6 +743,9 @@ void ObjRenderIvasFrame_splitBinaural( int32_t i; float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k]; +#ifdef FIX_SPLIT_REND_MERGE + float *p_tmpProcessing[MAX_NUM_OBJECTS]; +#endif int16_t pos_idx; IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; @@ -811,18 +814,35 @@ void ObjRenderIvasFrame_splitBinaural( } } } - +#ifdef FIX_SPLIT_REND_MERGE + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + p_tmpProcessing[i] = tmpProcessing[i]; + } +#endif /* Render */ if ( pos_idx == 0 ) { - ivas_td_binaural_renderer( st_ivas, tmpProcessing, output_frame ); + ivas_td_binaural_renderer( st_ivas, +#ifdef FIX_SPLIT_REND_MERGE + p_tmpProcessing, +#else + tmpProcessing +#endif + output_frame ); } else { /* Tmp swap renderer handles for rendering call */ tmpTdRendHandle = st_ivas->hBinRendererTd; st_ivas->hBinRendererTd = st_ivas->splitBinRend.splitrend.hTdRendHandles[pos_idx - 1]; - ivas_td_binaural_renderer( st_ivas, tmpProcessing, output_frame ); + ivas_td_binaural_renderer( st_ivas, +#ifdef FIX_SPLIT_REND_MERGE + p_tmpProcessing, +#else + tmpProcessing +#endif + output_frame ); st_ivas->hBinRendererTd = tmpTdRendHandle; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1798462927..540ab2a915 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7200,13 +7200,21 @@ static ivas_error renderSbaToMultiBinaural( float out[][L_FRAME48k] ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#ifdef FIX_SPLIT_REND_MERGE + float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; +#endif int16_t i, pos_idx; IVAS_REND_HeadRotData HeadRotDataLocal; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; - +#ifdef FIX_SPLIT_REND_MERGE + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; + } +#endif push_wmops( "renderSbaToMultiBinaural" ); HeadRotDataLocal = *sbaInput->base.ctx.pHeadRotData; @@ -7241,10 +7249,10 @@ static ivas_error renderSbaToMultiBinaural( rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, + &HeadRotDataLocal, #ifdef FIX_SPLIT_REND_MERGE sbaInput->base.ctx.pCombinedOrientationData, #endif - &HeadRotDataLocal, sbaInput->rot_gains_prev[pos_idx], tmpRotBuffer ); @@ -7253,7 +7261,13 @@ static ivas_error renderSbaToMultiBinaural( assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL ); /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + NULL, NULL, NULL, NULL, +#ifdef FIX_SPLIT_REND_MERGE + p_tmpCrendBuffer, +#else + tmpCrendBuffer +#endif + *sbaInput->base.ctx.pOutSampleRate, pos_idx ) ) != IVAS_ERR_OK ) { return error; @@ -7453,7 +7467,13 @@ renderSbaToBinaural( #endif { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - +#ifdef FIX_SPLIT_REND_MERGE + float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; + for ( int16_t i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; + } +#endif tmpRotBuffer = sbaInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); @@ -7478,7 +7498,13 @@ renderSbaToBinaural( free( tmpRotBuffer.data ); /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate + NULL, NULL, NULL, NULL, +#ifdef FIX_SPLIT_REND_MERGE + p_tmpCrendBuffer, +#else + tmpCrendBuffer, +#endif + *sbaInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -8488,7 +8514,7 @@ ivas_error IVAS_REND_GetSamples( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, 1, -- GitLab From 8a2aca499c0ac4f0caa6e9b1d61f779712c59e87 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 26 Jun 2023 09:45:12 +0200 Subject: [PATCH 209/591] Add FIX_550_FIRST_FRAME_ACCESS_ALT to integrate non-diegetic panning with TD renderer filter states and ITD to handle transitions properly --- lib_com/ivas_cnst.h | 8 ++++ lib_com/options.h | 1 + lib_rend/ivas_objectRenderer.c | 14 ++++++ lib_rend/ivas_objectRenderer_mix.c | 4 ++ lib_rend/ivas_objectRenderer_sources.c | 63 ++++++++++++++++++-------- 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index c43692ea91..0f13eac005 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1555,14 +1555,22 @@ typedef enum typedef enum { TDREND_POSTYPE_ABSOLUTE, /* The source position is in absolute coordinates */ +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT + TDREND_POSTYPE_NON_DIEGETIC /* The source position is non-diegetic */ +#else TDREND_POSTYPE_RELATIVE_TO_LISTENER /* The source position is relative to the listener */ +#endif } TDREND_PosType_t; typedef enum { TDREND_PLAYSTATUS_INITIAL, +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT TDREND_PLAYSTATUS_PLAYING, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC +#else + TDREND_PLAYSTATUS_PLAYING +#endif } TDREND_PlayStatus_t; typedef enum diff --git a/lib_com/options.h b/lib_com/options.h index 9254ab412a..661c8beab4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,7 @@ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ +#define FIX_550_FIRST_FRAME_ACCESS_ALT /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index d19c605f59..1c035d377d 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -291,6 +291,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; c_indx++; } +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT #ifdef FIX_550_FIRST_FRAME_ACCESS if ( ivas_format == ISM_FORMAT ) { @@ -303,6 +304,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); } } +#endif #endif } @@ -378,7 +380,9 @@ ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT float pan_left, pan_right; +#endif int16_t subframe_update_flag; subframe_update_flag = subframe_idx == ism_md_subframe_update; @@ -415,6 +419,7 @@ ivas_error TDREND_GetMix( error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); } +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ) ) { pan_left = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; @@ -427,6 +432,7 @@ ivas_error TDREND_GetMix( v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_right, output_buf[1], subframe_length ); #endif } +#endif } /* Populate output variable */ @@ -503,14 +509,22 @@ void TDREND_Update_object_positions( Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; Pos[2] = 0; TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT + hBinRendererTd->Sources[nS]->SrcSpatial_p->PosType = TDREND_POSTYPE_NON_DIEGETIC; +#else #ifndef FIX_550_FIRST_FRAME_ACCESS TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); +#endif #endif } else { +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT + hBinRendererTd->Sources[nS]->SrcSpatial_p->PosType = TDREND_POSTYPE_ABSOLUTE; +#else #ifndef FIX_550_FIRST_FRAME_ACCESS TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); +#endif #endif } TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 509d22d320..e218002345 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -309,7 +309,11 @@ ivas_error TDREND_MIX_AddSrc( } else { +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT + if ( ( PosType < TDREND_POSTYPE_ABSOLUTE ) || ( PosType > TDREND_POSTYPE_NON_DIEGETIC ) ) +#else if ( ( PosType < TDREND_POSTYPE_ABSOLUTE ) || ( PosType > TDREND_POSTYPE_RELATIVE_TO_LISTENER ) ) +#endif { return ( IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid position type!\n" ) ); } diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 87cf52ad10..fc955d7fe9 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -218,7 +218,11 @@ static void TDREND_SRC_REND_Init( /* Internal state */ SrcRend_p->InputAvailable = FALSE; +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT + SrcRend_p->PlayStatus = TDREND_PLAYSTATUS_PLAYING; +#else SrcRend_p->PlayStatus = TDREND_PLAYSTATUS_INITIAL; +#endif /* SrcGain */ for ( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { @@ -277,6 +281,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( *filterlength = HrFiltSet_p->FiltLength; +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT /* 1. Map source pos to the coordinate system of the listener */ switch ( SrcSpatial_p->PosType ) { @@ -296,6 +301,13 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); break; } +#else + if ( SrcSpatial_p->PosType == TDREND_POSTYPE_ABSOLUTE ) + { + + /* Absolute position */ + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); +#endif ListRelDist = TDREND_SPATIAL_VecNorm( ListRelPos ); @@ -351,25 +363,40 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT +} +else /* TDREND_POSTYPE_NON_DIEGETIC */ +{ + *itd = 0; + *Gain = 1.0f; + set_f( hrf_left, 0.0f, *filterlength ); + set_f( hrf_right, 0.0f, *filterlength ); + hrf_left[0] = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; + hrf_right[0] = 1.f - hrf_left[0]; + *intp_count = MAX_INTERPOLATION_STEPS; + Src_p->elev_prev = 0; + Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ +} +#endif - if ( ( *intp_count > 0 ) && subframe_update_flag ) - { - /* Set deltas for interpolation */ - v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); - v_multc( hrf_left_delta, 1.0f / *intp_count, hrf_left_delta, *filterlength ); - v_sub( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); - v_multc( hrf_right_delta, 1.0f / *intp_count, hrf_right_delta, *filterlength ); - } - else - { - /* No interpolation, just set the new filters and reset deltas */ - mvr2r( hrf_left, hrf_left_prev, *filterlength ); - mvr2r( hrf_right, hrf_right_prev, *filterlength ); - set_f( hrf_left_delta, 0.0f, *filterlength ); - set_f( hrf_right_delta, 0.0f, *filterlength ); - } +if ( ( *intp_count > 0 ) && subframe_update_flag ) +{ + /* Set deltas for interpolation */ + v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); + v_multc( hrf_left_delta, 1.0f / *intp_count, hrf_left_delta, *filterlength ); + v_sub( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); + v_multc( hrf_right_delta, 1.0f / *intp_count, hrf_right_delta, *filterlength ); +} +else +{ + /* No interpolation, just set the new filters and reset deltas */ + mvr2r( hrf_left, hrf_left_prev, *filterlength ); + mvr2r( hrf_right, hrf_right_prev, *filterlength ); + set_f( hrf_left_delta, 0.0f, *filterlength ); + set_f( hrf_right_delta, 0.0f, *filterlength ); +} - return; +return; } @@ -677,7 +704,7 @@ void TDREND_SRC_Init( #ifdef FIX_550_FIRST_FRAME_ACCESS Src_p->filterlength = 1; /* Init to unit impulse of length 1 */ #else - Src_p->filterlength = -1; + Src_p->filterlength = -1; #endif set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); -- GitLab From 1134a718542767b40d3ac76e6858e17f29d4752a Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 26 Jun 2023 15:44:15 +0530 Subject: [PATCH 210/591] Minor modificationa --- apps/renderer.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 4c024a3f68..3836732124 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1002,37 +1002,6 @@ int main( } else #endif - { - - if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); - } - } - -#ifdef SPLIT_REND_WITH_HEAD_ROT - /*if split renderer is running in post renderer mode*/ - if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) - { - error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath ); - if ( error != IVAS_ERR_OK ) - { - fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath ); - exit( -1 ); - } - audioReader = NULL; - } - else -#endif - { - - if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); - } - } { if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { -- GitLab From 446ffb36f67698191cafedd2662111329b0229d7 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 26 Jun 2023 15:36:51 +0200 Subject: [PATCH 211/591] Check-in beginning of ivas_jbm_dec_feed_tc_to_renderer operation --- lib_dec/ivas_jbm_dec.c | 6 +++ lib_dec/ivas_mc_paramupmix_dec.c | 88 ++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index b7cbd47e58..b5e2cbdbbe 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -670,6 +670,12 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); } +#ifdef JBM_PARAMUPMIX + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + ivas_param_upmix_dec_decorr_subframes( st_ivas ); + } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 62bf88caf9..30ab30653d 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -427,7 +427,95 @@ void ivas_mc_paramupmix_dec_close( return; } +#ifdef JBM_PARAMUPMIX +/*------------------------------------------------------------------------- + * ivas_param_upmix_dec_decorr_subframes() + * + * + *------------------------------------------------------------------------*/ +static void paramupmix_td_decorr_process_jbm( + ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ + float *pcm_in[], /* i : input audio channels */ + float **pp_out_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ +) +{ + int16_t j, k; + int16_t offset; + float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; + + offset = (int16_t) ( output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); + + /* Look-ahead delay */ + for ( k = 0; k < MC_PARAMUPMIX_COMBINATIONS; k++ ) + { + mvr2r( pcm_in[k], pp_out_pcm[k], output_frame ); + delay_signal( pp_out_pcm[k], output_frame, hTdDecorr[k]->look_ahead_buf, offset ); + + /* In ducking gains */ + if ( hTdDecorr[k]->ducking_flag ) + { + ivas_td_decorr_get_ducking_gains( hTdDecorr[k]->pTrans_det, pcm_in[k], in_duck_gain, out_duck_gain, output_frame, 0 ); + + for ( j = 0; j < output_frame; j++ ) + { + pp_out_pcm[k][j] = pp_out_pcm[k][j] * in_duck_gain[j]; + } + } + + /* All pass delay section */ + ivas_td_decorr_APD_iir_filter( &hTdDecorr[k]->APD_filt_state[0], pp_out_pcm[k], hTdDecorr[k]->num_apd_sections, output_frame ); + + /* Out ducking gains */ + if ( hTdDecorr[k]->ducking_flag ) + { + for ( j = 0; j < output_frame; j++ ) + { + pp_out_pcm[k][j] = pp_out_pcm[k][j] * out_duck_gain[j]; + } + } + } + + return; +} + +void ivas_param_upmix_dec_decorr_subframes( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + int16_t i, ch; + int32_t output_Fs; + int16_t output_frame; + float Pcm_decorr[MC_PARAMUPMIX_COMBINATIONS][L_FRAME48k]; /* decorrelated channels */ + float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + float *p_tc[MC_PARAMUPMIX_MAX_INPUT_CHANS]; + + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert( hMCParamUpmix ); + + push_wmops( "ivas_param_upmix_dec_decorr_subframes" ); + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); + for ( ch = 0; ch < MC_PARAMUPMIX_MAX_INPUT_CHANS; ch++ ) + { + p_tc[ch] = st_ivas->hTcBuffer->tc[ch]; + } + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + pPcm_temp[i] = p_tc[8+i]; /* decorrelated */ + } + + paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, &( p_tc[4] ), pPcm_temp, output_frame ); + + pop_wmops(); + + return; +} +#endif /*****************************************************************************************/ /* local functions */ -- GitLab From dcfcedfbff71d625d57d32b30e8f03e2e104241e Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 26 Jun 2023 15:39:21 +0200 Subject: [PATCH 212/591] Add fix FIX_569_TD_FILTER_LENGTH to truncate the filters if a model file produces filters longer than SFX_SPAT_BIN_MAX_FILTER_LENGTH --- lib_com/options.h | 1 + lib_rend/ivas_objectRenderer_hrFilt.c | 14 +++++++++++--- lib_rend/ivas_objectRenderer_sources.c | 8 ++++++++ lib_rend/ivas_prot_rend.h | 3 +++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index dbe71e39f1..c6e8cc0002 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,6 +158,7 @@ #define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ +#define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 6463261ec4..0df5df6fcd 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -97,16 +97,24 @@ void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ float Azim, /* i : Azimuth, degrees */ - float *hrf_left, /* o : Left HR filter */ - float *hrf_right, /* o : Right HR filter */ - int16_t *itd /* o : ITD value */ +#ifdef FIX_569_TD_FILTER_LENGTH + const int16_t filterlength, /* i : Filter length */ +#endif + float *hrf_left, /* o : Left HR filter */ + float *hrf_right, /* o : Right HR filter */ + int16_t *itd /* o : ITD value */ ) { GenerateFilter( Elev, Azim, &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); +#ifdef FIX_569_TD_FILTER_LENGTH + mvr2r( HrFiltSet_p->ModelEval.hrfModL, hrf_left, filterlength ); + mvr2r( HrFiltSet_p->ModelEval.hrfModR, hrf_right, filterlength ); +#else mvr2r( HrFiltSet_p->ModelEval.hrfModL, hrf_left, HrFiltSet_p->ModelParams.K ); mvr2r( HrFiltSet_p->ModelEval.hrfModR, hrf_right, HrFiltSet_p->ModelParams.K ); +#endif /* 4. Evaluate the ITD */ if ( HrFiltSet_p->ModelParams.UseItdModel ) { diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 8debd6619b..8b4b910c5b 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -275,7 +275,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( Listener_p = hBinRendererTd->Listener_p; HrFiltSet_p = hBinRendererTd->HrFiltSet_p; +#ifdef FIX_569_TD_FILTER_LENGTH + *filterlength = min( HrFiltSet_p->FiltLength, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); +#else *filterlength = HrFiltSet_p->FiltLength; +#endif /* 1. Map source pos to the coordinate system of the listener */ switch ( SrcSpatial_p->PosType ) @@ -312,7 +316,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( Azim = -1.0f * _180_OVER_PI * (float) atan2f( ListRelPos[1], ListRelPos[0] ); } +#ifdef FIX_569_TD_FILTER_LENGTH + GetFilterFromAngle( HrFiltSet_p, Elev, Azim, *filterlength, hrf_left, hrf_right, itd ); +#else GetFilterFromAngle( HrFiltSet_p, Elev, Azim, hrf_left, hrf_right, itd ); +#endif /* 6. Evaluate the directional and distance gains */ /* Directional gain */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 803a612502..c031392226 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -314,6 +314,9 @@ void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ float Azim, /* i : Azimuth, degrees */ +#ifdef FIX_569_TD_FILTER_LENGTH + const int16_t filterlength, /* i : Filter length */ +#endif float *LeftFilter, /* o : Left HR filter */ float *RightFilter, /* o : Right HR filter */ int16_t *itd /* o : ITD value */ -- GitLab From b5b72fcfc4cc79c1918b59082fee1451460213cc Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 26 Jun 2023 15:52:07 +0200 Subject: [PATCH 213/591] Add External Renderer CommanLine Option -sync_mc_delay / -smd --- apps/renderer.c | 28 ++++++++++++++++++ lib_com/options.h | 2 +- lib_rend/ivas_objectRenderer.c | 12 ++++++-- lib_rend/ivas_prot_rend.h | 3 ++ lib_rend/ivas_stat_rend.h | 1 - lib_rend/lib_rend.c | 53 ++++++++++++++++++++++++++++++---- lib_rend/lib_rend.h | 3 ++ 7 files changed, 93 insertions(+), 9 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 760065be91..ac643d058f 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -157,6 +157,9 @@ typedef struct float lfeConfigElevation; bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; +#ifdef FIX_488_SYNC_DELAY + int16_t syncMdDelay; +#endif } CmdlnArgs; typedef enum @@ -181,6 +184,9 @@ typedef enum CmdLnOptionId_inputGain, CmdLnOptionId_referenceVectorFile, CmdLnOptionId_exteriorOrientationFile, +#ifdef FIX_488_SYNC_DELAY + CmdLnOptionId_syncMdDelay, +#endif } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -302,6 +308,14 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "exof", .description = "External orientation trajectory file for simulation of external orientations", }, +#ifdef FIX_488_SYNC_DELAY + { + .id = CmdLnOptionId_syncMdDelay, + .match = "sync_md_delay", + .matchShort = "smd", + .description = "Metadata Synchronization Delay in ms", + }, +#endif }; @@ -1236,7 +1250,11 @@ int main( } } +#ifdef FIX_488_SYNC_DELAY + if ( IVAS_REND_GetSamples( hIvasRend, args.syncMdDelay, outBuffer ) != IVAS_ERR_OK ) +#else if ( IVAS_REND_GetSamples( hIvasRend, outBuffer ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error in getting samples\n" ); exit( -1 ); @@ -1900,6 +1918,10 @@ static CmdlnArgs defaultArgs( args.lfeCustomRoutingEnabled = false; clearString( args.inLfePanningMatrixFile ); + +#ifdef FIX_488_SYNC_DELAY + args.syncMdDelay = 0; +#endif return args; } @@ -2029,6 +2051,12 @@ static void parseOption( exit( -1 ); } break; +#ifdef FIX_488_SYNC_DELAY + case CmdLnOptionId_syncMdDelay: + assert( numOptionValues == 1 ); + args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / 5 ); + break; +#endif default: assert( 0 && "This should be unreachable - all command line options should be explicitly handled." ); break; diff --git a/lib_com/options.h b/lib_com/options.h index dbe71e39f1..21b695350c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,7 @@ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ - +#define FIX_488_SYNC_DELAY /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2ba225b2f1..a87d48af60 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -615,8 +615,11 @@ ivas_error ivas_td_binaural_renderer_ext( const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ +#ifdef FIX_488_SYNC_DELAY + const ism_md_subframe_update_ext, +#endif + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { ISM_METADATA_FRAME hIsmMetaDataFrame; @@ -627,7 +630,9 @@ ivas_error ivas_td_binaural_renderer_ext( IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; +#ifndef FIX_488_SYNC_DELAY int16_t ism_md_subframe_update_ext; +#endif float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -641,7 +646,10 @@ ivas_error ivas_td_binaural_renderer_ext( inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; hIsmMetaData[0] = NULL; + +#ifndef FIX_488_SYNC_DELAY ism_md_subframe_update_ext = 0; +#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 803a612502..3355d06429 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -252,6 +252,9 @@ ivas_error ivas_td_binaural_renderer_ext( const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ +#ifdef FIX_488_SYNC_DELAY + const int16_t ism_md_subframe_update_ext, +#endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c763630325..199f5fe435 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -342,7 +342,6 @@ typedef struct ivas_render_config_t #endif ivas_roomAcoustics_t roomAcoustics; float directivity[3]; - } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; typedef struct ivas_rev_delay_line_t diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4e75d5fea8..594df91bf3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4662,6 +4662,9 @@ static ivas_error rotateFrameSba( static ivas_error renderIsmToBinaural( const input_ism *ismInput, +#ifdef FIX_488_SYNC_DELAY + const int16_t ism_md_subframe_update_ext, +#endif IVAS_REND_AudioBuffer outAudio ) { float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -4677,6 +4680,9 @@ static ivas_error renderIsmToBinaural( ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, +#ifdef FIX_488_SYNC_DELAY + ism_md_subframe_update_ext, +#endif outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { @@ -4833,6 +4839,9 @@ static ivas_error renderIsmToBinauralRoom( static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, +#ifdef FIX_488_SYNC_DELAY + const int16_t ism_md_subframe_update_ext, +#endif IVAS_REND_AudioBuffer outAudio ) { #ifdef JBM_TSM_ON_TCS @@ -4859,6 +4868,9 @@ static ivas_error renderIsmToBinauralReverb( ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, +#ifdef FIX_488_SYNC_DELAY + ism_md_subframe_update_ext, +#endif outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -5006,6 +5018,9 @@ static ivas_error renderIsmToMasa( static ivas_error renderInputIsm( input_ism *ismInput, +#ifdef FIX_488_SYNC_DELAY + const int16_t ism_md_subframe_update_ext, +#endif const IVAS_REND_AudioConfig outConfig, const IVAS_REND_AudioBuffer outAudio ) { @@ -5036,13 +5051,21 @@ static ivas_error renderInputIsm( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: +#ifdef FIX_488_SYNC_DELAY + error = renderIsmToBinaural( ismInput, ism_md_subframe_update_ext, outAudio ); +#else error = renderIsmToBinaural( ismInput, outAudio ); +#endif break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: error = renderIsmToBinauralRoom( ismInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: +#ifdef FIX_488_SYNC_DELAY + error = renderIsmToBinauralReverb( ismInput, ism_md_subframe_update_ext, outAudio ); +#else error = renderIsmToBinauralReverb( ismInput, outAudio ); +#endif break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -5065,6 +5088,9 @@ static ivas_error renderInputIsm( static ivas_error renderActiveInputsIsm( IVAS_REND_HANDLE hIvasRend, +#ifdef FIX_488_SYNC_DELAY + const int16_t ism_md_subframe_update_ext, +#endif IVAS_REND_AudioBuffer outAudio ) { int16_t i; @@ -5078,8 +5104,11 @@ static ivas_error renderActiveInputsIsm( /* Skip inactive inputs */ continue; } - +#ifdef FIX_488_SYNC_DELAY + if ( ( error = renderInputIsm( pCurrentInput, ism_md_subframe_update_ext, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) +#else if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -5184,7 +5213,11 @@ static ivas_error renderMcToBinaural( if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, - mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) + mcInput->hReverb, +#ifdef FIX_488_SYNC_DELAY + NULL, +#endif + mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -5277,7 +5310,11 @@ static ivas_error renderMcToBinauralRoom( if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, - NULL, mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) + NULL, mcInput->hReverb, +#ifdef FIX_488_SYNC_DELAY + NULL, +#endif + mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -6359,7 +6396,10 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_GetSamples( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ +#ifdef FIX_488_SYNC_DELAY + const int16_t sync_md_delay, +#endif IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ ) { @@ -6432,8 +6472,11 @@ ivas_error IVAS_REND_GetSamples( /* Clear output buffer */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); - +#ifdef FIX_488_SYNC_DELAY + if ( ( error = renderActiveInputsIsm( hIvasRend, sync_md_delay, outAudio ) ) != IVAS_ERR_OK ) +#else if ( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 88e96d2916..6f9a633329 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -320,6 +320,9 @@ ivas_error IVAS_REND_GetNumAllObjects( ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ +#ifdef FIX_488_SYNC_DELAY + const int16_t sync_md_delay, +#endif IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ ); -- GitLab From 3127c8444d7aaec4c783b7fed4ec5c472ba3cd91 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 26 Jun 2023 16:02:04 +0200 Subject: [PATCH 214/591] Cleanup --- lib_rend/lib_rend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 594df91bf3..e077e3a0e8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5215,7 +5215,7 @@ static ivas_error renderMcToBinaural( NULL, mcInput->hReverb, #ifdef FIX_488_SYNC_DELAY - NULL, + 0, #endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -5312,7 +5312,7 @@ static ivas_error renderMcToBinauralRoom( mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, #ifdef FIX_488_SYNC_DELAY - NULL, + 0, #endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { -- GitLab From 70bd727e460627e0e56e1cdc1e10fa66d77f1e5b Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 26 Jun 2023 16:59:58 +0200 Subject: [PATCH 215/591] Cleanup to move the md_subframe_update variable into ism_input structure --- apps/renderer.c | 3 ++- lib_rend/ivas_objectRenderer.c | 2 +- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/lib_rend.c | 35 +++++++++++----------------------- lib_rend/lib_rend.h | 2 +- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index ac643d058f..a2453fd238 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2054,7 +2054,8 @@ static void parseOption( #ifdef FIX_488_SYNC_DELAY case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); - args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / 5 ); + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1/50/4*1000) subframe index */ + args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / ( 1 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * 1000 ) ); break; #endif default: diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index a87d48af60..1e7fe9b907 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -616,7 +616,7 @@ ivas_error ivas_td_binaural_renderer_ext( const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ #ifdef FIX_488_SYNC_DELAY - const ism_md_subframe_update_ext, + const ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ #endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 3355d06429..ef7350611e 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -253,7 +253,7 @@ ivas_error ivas_td_binaural_renderer_ext( const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ #ifdef FIX_488_SYNC_DELAY - const int16_t ism_md_subframe_update_ext, + const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ #endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e077e3a0e8..edf18082f1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -123,6 +123,9 @@ typedef struct float nonDiegeticPanGain; OMASA_ANA_HANDLE hOMasa; uint16_t total_num_objects; +#ifdef FIX_488_SYNC_DELAY + int16_t ism_md_subframe_update_ext; +#endif } input_ism; typedef struct @@ -4662,9 +4665,6 @@ static ivas_error rotateFrameSba( static ivas_error renderIsmToBinaural( const input_ism *ismInput, -#ifdef FIX_488_SYNC_DELAY - const int16_t ism_md_subframe_update_ext, -#endif IVAS_REND_AudioBuffer outAudio ) { float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -4681,7 +4681,7 @@ static ivas_error renderIsmToBinaural( &ismInput->currentPos, ismInput->hReverb, #ifdef FIX_488_SYNC_DELAY - ism_md_subframe_update_ext, + ismInput->ism_md_subframe_update_ext, #endif outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) @@ -4839,9 +4839,6 @@ static ivas_error renderIsmToBinauralRoom( static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, -#ifdef FIX_488_SYNC_DELAY - const int16_t ism_md_subframe_update_ext, -#endif IVAS_REND_AudioBuffer outAudio ) { #ifdef JBM_TSM_ON_TCS @@ -4869,7 +4866,7 @@ static ivas_error renderIsmToBinauralReverb( &ismInput->currentPos, ismInput->hReverb, #ifdef FIX_488_SYNC_DELAY - ism_md_subframe_update_ext, + ismInput->ism_md_subframe_update_ext, #endif outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) @@ -5018,9 +5015,6 @@ static ivas_error renderIsmToMasa( static ivas_error renderInputIsm( input_ism *ismInput, -#ifdef FIX_488_SYNC_DELAY - const int16_t ism_md_subframe_update_ext, -#endif const IVAS_REND_AudioConfig outConfig, const IVAS_REND_AudioBuffer outAudio ) { @@ -5051,21 +5045,13 @@ static ivas_error renderInputIsm( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: -#ifdef FIX_488_SYNC_DELAY - error = renderIsmToBinaural( ismInput, ism_md_subframe_update_ext, outAudio ); -#else error = renderIsmToBinaural( ismInput, outAudio ); -#endif break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: error = renderIsmToBinauralRoom( ismInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: -#ifdef FIX_488_SYNC_DELAY - error = renderIsmToBinauralReverb( ismInput, ism_md_subframe_update_ext, outAudio ); -#else error = renderIsmToBinauralReverb( ismInput, outAudio ); -#endif break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -5089,7 +5075,7 @@ static ivas_error renderInputIsm( static ivas_error renderActiveInputsIsm( IVAS_REND_HANDLE hIvasRend, #ifdef FIX_488_SYNC_DELAY - const int16_t ism_md_subframe_update_ext, + const int16_t sync_md_delay, /* i: Metadata Delay in subframes to sync with audio delay */ #endif IVAS_REND_AudioBuffer outAudio ) { @@ -5105,10 +5091,11 @@ static ivas_error renderActiveInputsIsm( continue; } #ifdef FIX_488_SYNC_DELAY - if ( ( error = renderInputIsm( pCurrentInput, ism_md_subframe_update_ext, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + /* Metadata Delay in subframes to sync with audio delay */ + pCurrentInput->ism_md_subframe_update_ext = sync_md_delay; #endif + if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + { return error; } @@ -6398,7 +6385,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ #ifdef FIX_488_SYNC_DELAY - const int16_t sync_md_delay, + const int16_t sync_md_delay, /* i: Metadata Delay in subframes to sync with audio delay */ #endif IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 6f9a633329..9f7edd9d7d 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -321,7 +321,7 @@ ivas_error IVAS_REND_GetNumAllObjects( ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ #ifdef FIX_488_SYNC_DELAY - const int16_t sync_md_delay, + const int16_t sync_md_delay, /* i: Metadata Delay in subframes to sync with audio delay */ #endif IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ ); -- GitLab From 464034c3bed991645567d2d51038d7d59d5e8f41 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 26 Jun 2023 17:01:35 +0200 Subject: [PATCH 216/591] Cleanup --- lib_rend/ivas_stat_rend.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 199f5fe435..c763630325 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -342,6 +342,7 @@ typedef struct ivas_render_config_t #endif ivas_roomAcoustics_t roomAcoustics; float directivity[3]; + } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; typedef struct ivas_rev_delay_line_t -- GitLab From df59e93537aca0454eef191af92c5d198559cb9f Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 26 Jun 2023 17:18:42 +0200 Subject: [PATCH 217/591] Adjust the quantization for 5ms subframe --- apps/renderer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index a2453fd238..b063e70ee7 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2054,8 +2054,8 @@ static void parseOption( #ifdef FIX_488_SYNC_DELAY case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); - /* Metadata Delay to sync with audio delay converted from ms to 5ms (1/50/4*1000) subframe index */ - args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / ( 1 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * 1000 ) ); + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ + args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); break; #endif default: -- GitLab From d00ea6ca948bea8fcd28f42ea9f97ce31d06fb6d Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 26 Jun 2023 17:25:02 +0200 Subject: [PATCH 218/591] Information for the default value is added --- apps/renderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/renderer.c b/apps/renderer.c index b063e70ee7..f72234bf2a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -313,7 +313,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_syncMdDelay, .match = "sync_md_delay", .matchShort = "smd", - .description = "Metadata Synchronization Delay in ms", + .description = "Metadata Synchronization Delay in ms, Default is 0", }, #endif }; -- GitLab From 02752ab741cda5213e56c5124b770ba151a163c0 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 27 Jun 2023 10:04:12 +0530 Subject: [PATCH 219/591] Changes to make renderer pytest bit-exact --- lib_com/options.h | 4 +- lib_dec/ivas_binRenderer_internal.c | 378 +++++++++++++++++++++++- lib_rend/ivas_prot_rend.h | 10 + lib_rend/ivas_reverb.c | 4 +- lib_rend/ivas_rom_binaural_crend_head.c | 1 - lib_rend/ivas_rotation.c | 105 +++++++ lib_rend/lib_rend.c | 131 +++++++- 7 files changed, 624 insertions(+), 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0f8fc1df7f..21e60152c8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -141,10 +141,10 @@ #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ +#define FIX_BIT_EXACT /* fix for bit-inexactness in splitrendering renderer pytest*/ #define USE_HRIR_128_METH5_IRC_53_Q10_SYML_ITRP1_48000 /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ #define UPDATE_SBA_FILTER /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ - #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ @@ -180,7 +180,7 @@ #define ISM_FB // 1ISM 24.4 kbps: change SWB to FB coding #define ISM_25k6_HZ_CORE // 1ISM 48 kbps: change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core -#define FIX_SPLIT_REND_MERGE +#define FIX_SPLIT_REND_MERGE /* Resolving the compilation warnings after splitrenderer main updation */ #define SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 51b5ad0349..3bea0235aa 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1464,8 +1464,375 @@ void ivas_binaural_cldfb_sf( return; } +#endif +#ifdef FIX_BIT_EXACT +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_processFrame() + * + * Compute the reverberation - room effect + *------------------------------------------------------------------------*/ + +void ivas_binaural_reverb_processFrame( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ + float inReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ + float inImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ + const uint8_t offsetSamplesIO /* i : number of offset samples */ +) +{ + /* Declare the required variables */ + int16_t idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; + float **tapRealPr, **tapImagPr; + + /* 1) Rotate the data in the loop buffer of the reverberator. + * Notice that the audio at the loop buffers is at time-inverted order + * for convolution purposes later on. */ + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ + mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); + mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); + + /* Add the data from the end of the loop to the beginning, with an attenuation factor + * according to RT60. This procedure generates an IIR decaying response. The response + * is decorrelated later on. */ + v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); + v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); + } + + /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ + idx = hReverb->preDelayBufferIndex; + for ( sample = 0; sample < hReverb->blockSize; sample++ ) + { + uint16_t sampleWithOffset; + sampleWithOffset = sample + offsetSamplesIO; + invertSampleIndex = hReverb->blockSize - sample - 1; + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Add from pre-delay buffer a sample to the loop buffer, in a time-inverted order. + * Also apply the spectral gains determined for the reverberation */ + hReverb->loopBufReal[bin][invertSampleIndex] += hReverb->preDelayBufferReal[idx][bin] * hReverb->reverbEqGains[bin]; + hReverb->loopBufImag[bin][invertSampleIndex] += hReverb->preDelayBufferImag[idx][bin] * hReverb->reverbEqGains[bin]; + hReverb->preDelayBufferReal[idx][bin] = 0.0f; + hReverb->preDelayBufferImag[idx][bin] = 0.0f; + } + + /* Add every second input channel as is to the pre-delay buffer, and every second input channel with + * 90 degrees phase shift to reduce energy imbalances between coherent and incoherent sounds */ + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch % 2 ) + { + v_add( hReverb->preDelayBufferReal[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + else + { + v_sub( hReverb->preDelayBufferReal[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + } + idx = ( idx + 1 ) % hReverb->preDelayBufferLength; + } + hReverb->preDelayBufferIndex = idx; + + /* 3) Perform the filtering/decorrelating, using complex and sparse FIR filtering */ + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + /* These tap pointers have been determined to point to the loop buffer at sparse locations */ + tapRealPr = hReverb->tapPointersReal[bin][ch]; + tapImagPr = hReverb->tapPointersImag[bin][ch]; + phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; + + /* Flush output */ + set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); + set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); + + /* Add from temporally decaying sparse tap locations the audio to the output. */ + for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) + { + switch ( phaseShiftTypePr[tapIdx] ) + { + case 0: /* 0 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + case 1: /* 90 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + case 2: /* 180 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + default: /* 270 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + } + } + } + + /* Generate diffuse field binaural coherence by mixing the incoherent reverberated channels with pre-defined gains */ + if ( bin <= hReverb->highestBinauralCoherenceBin ) + { + if ( hReverb->useBinauralCoherence ) + { + for ( sample = 0; sample < hReverb->blockSize; sample++ ) + { + float leftRe, rightRe, leftIm, rightIm; + + leftRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][1][sample]; + rightRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][0][sample]; + leftIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][1][sample]; + rightIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][0][sample]; + + hReverb->outputBufferReal[bin][0][sample] = leftRe; + hReverb->outputBufferReal[bin][1][sample] = rightRe; + hReverb->outputBufferImag[bin][0][sample] = leftIm; + hReverb->outputBufferImag[bin][1][sample] = rightIm; + } + } + } + } + + /* 4) Write data to output */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + for ( sample = 0; sample < hReverb->blockSize; sample++ ) + { + uint16_t sampleWithOffset; + + sampleWithOffset = sample + offsetSamplesIO; + /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ + invertSampleIndex = hReverb->blockSize - sample - 1; + + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + outReal[ch][sampleWithOffset][bin] = hReverb->outputBufferReal[bin][ch][invertSampleIndex]; + outImag[ch][sampleWithOffset][bin] = hReverb->outputBufferImag[bin][ch][invertSampleIndex]; + } + for ( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + outReal[ch][sampleWithOffset][bin] = 0.0f; + outImag[ch][sampleWithOffset][bin] = 0.0f; + } + } + } + + return; +} +void ivas_binRenderer_2( + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ +#else + float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ +#endif + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ +) +{ + int16_t chIdx, k; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx, num_poses; +#endif + int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; + + push_wmops( "fastconv_binaural_rendering" ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + num_poses = hBinRenderer->numPoses; #endif + /* Compute Convolution */ + /* memory reset for the binaural output */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + set_zero( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], CLDFB_NO_CHANNELS_MAX ); + set_zero( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], CLDFB_NO_CHANNELS_MAX ); + } + } + } +#else + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + set_zero( Cldfb_RealBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); + set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); + } + } +#endif + + /* Head rotation in HOA3 or CICPx */ + if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) + { + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) + { + /* Rotation in SHD (HOA3) */ + if ( hHeadTrackData->shd_rot_max_order == -1 ) + { + QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, MAX_PARAM_SPATIAL_SUBFRAMES, 3 ); + } + else if ( hHeadTrackData->shd_rot_max_order > 0 ) + { + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, MAX_PARAM_SPATIAL_SUBFRAMES, hHeadTrackData->shd_rot_max_order ); + } + } + else + { + /* Rotation in SD (CICPx) */ + rotateFrame_sd_cldfb_2( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, hBinRenderer->conv_band ); + } + } + + /* HOA decoding to CICP19 if needed*/ + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) + { + ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, MAX_PARAM_SPATIAL_SUBFRAMES, hBinRenderer->hoa_dec_mtx ); + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], RealBuffer, ImagBuffer, MAX_PARAM_SPATIAL_SUBFRAMES, hBinRenderer, 0 ); +#else + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); +#endif + +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*TODO : move this to a separate function*/ + if ( pMultiBinPoseData->num_poses > 1 ) + { + IVAS_QUATERNION Quaternions_rel, Quaternions_abs, *Quaternions_ref; + float Rmat_local[3][3]; + + if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) + { + Quaternions_ref = &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions - 1]; + Quaternions_rel.w = -3.0f; /*euler*/ + Quaternions_abs.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + + for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + Quaternions_rel.x = pMultiBinPoseData->relative_head_poses[pos_idx][0] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; + Quaternions_rel.y = pMultiBinPoseData->relative_head_poses[pos_idx][1] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; + Quaternions_rel.z = pMultiBinPoseData->relative_head_poses[pos_idx][2] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; + Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; + Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; + + + QuatToRotMat( Quaternions_rel, Rmat_local ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, MAX_PARAM_SPATIAL_SUBFRAMES, 3 ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, MAX_PARAM_SPATIAL_SUBFRAMES, hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + pos_idx +#endif + ); + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + if ( hPostRendHeadTrackData != NULL ) + { + IVAS_QUATERNION *Quaternions_new1; + IVAS_QUATERNION Quaternions_new; + Quaternions_new1 = &hPostRendHeadTrackData->Quaternions[hPostRendHeadTrackData->num_quaternions++]; + Quaternions_new.w = -3.0f; /*euler*/ + Quat2EulerDegree( *Quaternions_new1, &Quaternions_new.z, &Quaternions_new.y, &Quaternions_new.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quaternions_rel.x = Quaternions_new.x - Quaternions_abs.x; + Quaternions_rel.y = Quaternions_new.y - Quaternions_abs.y; + Quaternions_rel.z = Quaternions_new.z - Quaternions_abs.z; + Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; + Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; + Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; + + QuatToRotMat( Quaternions_rel, Rmat_local ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[num_poses], Cldfb_ImagBuffer_Binaural[num_poses], RealBuffer, ImagBuffer, hBinRenderer +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + num_poses +#endif + ); + } +#endif + } + } +#endif + + + /* Obtain the binaural dmx and compute the reverb */ + if ( hBinRenderer->hReverb != NULL ) + { + float reverbRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float inRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float inIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + + ivas_binaural_obtain_DMX( numTimeSlots, hBinRenderer, RealBuffer, ImagBuffer, inRe, inIm ); + + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + set_zero( reverbRe[chIdx][k], hBinRenderer->max_band ); + set_zero( reverbIm[chIdx][k], hBinRenderer->max_band ); + } + } + + ivas_binaural_reverb_processFrame( hBinRenderer->hReverb, BINAURAL_CHANNELS, inRe, inIm, reverbRe, reverbIm, 0u ); + + /* Add the conv module and reverb module output */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + { + /* Combine first and second parts to generate binaural output signal with room effect */ + v_add( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); + v_add( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); + } +#else + /* Combine first and second parts to generate binaural output signal with room effect */ + v_add( Cldfb_RealBuffer_Binaural[chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); + v_add( Cldfb_ImagBuffer_Binaural[chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); +#endif + } + } + } + + pop_wmops(); + + return; +} +#endif /*------------------------------------------------------------------------- * ivas_binRenderer() * @@ -1757,7 +2124,14 @@ void ivas_rend_CldfbMultiBinRendProcess( head_track_post.shd_rot_max_order = -1; head_track_post.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositionsPostRend, sf_idx ); #endif - +#ifdef FIX_BIT_EXACT + ivas_binRenderer_2( hCldfbRend, &head_track, + pMultiBinPoseData, +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + &head_track_post, +#endif + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn ); +#else ivas_binRenderer( hCldfbRend, &head_track, pMultiBinPoseData, #ifdef FIX_SPLIT_REND_MERGE @@ -1769,7 +2143,7 @@ void ivas_rend_CldfbMultiBinRendProcess( #endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn ); - +#endif for ( pose_idx = 0; pose_idx < hCldfbRend->numPoses; pose_idx++ ) { for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 58ad1875bc..eea0ea6147 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -957,7 +957,17 @@ void rotateFrame_shd_cldfb( const int16_t numTimeSlots, /* i : number of time slots to process */ const int16_t shd_rot_max_order /* i : split-order rotation method */ ); +#ifdef FIX_BIT_EXACT +void rotateFrame_sd_cldfb_2( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ + const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t nb_band /* i : number of CLDFB bands to process */ +); +#endif void rotateFrame_sd_cldfb( #ifdef EXTERNAL_ORIENTATIONS float Rmat[3][3], /* i : real-space rotation matrix */ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index e5f0a0ac96..f92f0b2fa6 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1609,9 +1609,8 @@ ivas_error ivas_reverb_process( return IVAS_ERR_OK; } - /*------------------------------------------------------------------------- - * ivas_binaural_reverb_processFrame() + * ivas_binaural_reverb_processSubFrame() * * Compute the reverberation - room effect *------------------------------------------------------------------------*/ @@ -1770,7 +1769,6 @@ void ivas_binaural_reverb_processSubframe( return; } - /*------------------------------------------------------------------------- * ivas_binaural_reverb_open() * diff --git a/lib_rend/ivas_rom_binaural_crend_head.c b/lib_rend/ivas_rom_binaural_crend_head.c index 36465a65c0..f2dbe4206a 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.c +++ b/lib_rend/ivas_rom_binaural_crend_head.c @@ -57,7 +57,6 @@ #ifdef USE_HRIR_128_METH5_IRC_53_Q10_SYML_ITRP1_48000 - /********************** CRendBin_Combined_HRIR **********************/ #ifdef UPDATE_SBA_FILTER diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index b9da6cba38..f71f82a6d2 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -692,7 +692,112 @@ void rotateFrame_shd_cldfb( return; } +#ifdef FIX_BIT_EXACT +void rotateFrame_sd_cldfb_2( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ + const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t nb_band /* i : number of CLDFB bands to process */ +) +{ + int16_t iBlock, iBand, m, n; + float gains[MAX_CICP_CHANNELS - 1][MAX_CICP_CHANNELS - 1]; + int16_t azimuth, elevation; + float Rmat[3][3]; + float g1; + float realRot[MAX_CICP_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; + float imagRot[MAX_CICP_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; + float *p_realRot, *p_imagRot; + float *p_real, *p_imag; + int16_t nInChannels; + int16_t isPlanar; + + push_wmops( "rotateFrame_sd_cldfb" ); + + nInChannels = hOutputSetup->nchan_out_woLFE; + isPlanar = 1; + for ( n = 0; n < nInChannels; n++ ) + { + if ( hOutputSetup->ls_elevation[n] != 0 ) + { + isPlanar = 0; + break; + } + } + + /* Get next quaternion and calculate rotation matrix */ + QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); + + /* rotation of Euler angles */ + for ( n = 0; n < nInChannels; n++ ) + { + rotateAziEle( hOutputSetup->ls_azimuth[n], hOutputSetup->ls_elevation[n], &azimuth, &elevation, Rmat, isPlanar ); + if ( hEFAPdata != NULL && ( hOutputSetup->ls_azimuth[n] != azimuth || hOutputSetup->ls_elevation[n] != elevation ) ) + { + efap_determine_gains( hEFAPdata, gains[n], azimuth, elevation, EFAP_MODE_EFAP ); + } + else + { + set_zero( gains[n], nInChannels ); + gains[n][n] = 1.0f; + } + } + + /* Apply panning gains by mtx multiplication*/ + for ( n = 0; n < nInChannels; n++ ) + { + set_zero( realRot[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_band ); + set_zero( imagRot[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_band ); + for ( m = 0; m < nInChannels; m++ ) + { + g1 = gains[m][n]; + p_realRot = realRot[n]; + p_imagRot = imagRot[n]; + if ( g1 > 0.f ) + { + for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) + { + p_real = Cldfb_RealBuffer[m][iBlock]; + p_imag = Cldfb_ImagBuffer[m][iBlock]; + for ( iBand = 0; iBand < nb_band; iBand++ ) + { + *( p_realRot ) = *p_realRot + g1 * *( p_real++ ); + *( p_imagRot ) = *p_imagRot + g1 * *( p_imag++ ); + p_realRot++; + p_imagRot++; + } + } + } + } + } + for ( n = 0; n < nInChannels; n++ ) + { + p_realRot = realRot[n]; + p_imagRot = imagRot[n]; + for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) + { + p_real = Cldfb_RealBuffer[n][iBlock]; + p_imag = Cldfb_ImagBuffer[n][iBlock]; + for ( iBand = 0; iBand < nb_band; iBand++ ) + { + *( p_real++ ) = *( p_realRot++ ); + *( p_imag++ ) = *( p_imagRot++ ); + } + for ( ; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) + { + *( p_real++ ) = 0.f; + *( p_imag++ ) = 0.f; + } + } + } + pop_wmops(); + + return; +} +#endif /*------------------------------------------------------------------------- * rotateFrame_sd_cldfb() diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 540ab2a915..c66dad8627 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5753,7 +5753,128 @@ static ivas_error rotateFrameSba( return IVAS_ERR_OK; } +#ifdef FIX_BIT_EXACT +static ivas_error rotateFrameSba_2( + IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ + IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ + const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ + rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ + IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ +) +{ + int16_t i, l, n, m; + int16_t m1, m2; + int16_t shd_rot_max_order; + int16_t subframe_idx, subframe_len; +#ifdef SBA_CREND_ROT_OPT + float *writePtr; +#else + float *readPtr, *writePtr; +#endif + rotation_matrix Rmat; + float tmpRot[2 * HEADROT_ORDER + 1]; + rotation_gains gains; + ivas_error error; +#ifdef SBA_CREND_ROT_OPT + int16_t idx; + float val, cf, oneminuscf; +#endif + + push_wmops( "rotateFrameSba" ); + if ( ( error = getAmbisonicsOrder( inConfig, &shd_rot_max_order ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* subframe loop */ + subframe_len = inAudio.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; + for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) + { + /* initialize rotation matrices with zeros */ + for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) + { + set_zero( gains[i], HEADROT_SHMAT_DIM ); + } + + /* Get next quaternion and calculate rotation matrix */ + QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); + + /* calculate ambisonics rotation matrices for the previous and current frames */ + SHrotmatgen( gains, Rmat, shd_rot_max_order ); + + for ( i = 0; i < subframe_len; i++ ) + { +#ifdef SBA_CREND_ROT_OPT + idx = subframe_idx * subframe_len + i; + cf = headRotData->crossfade[i]; + oneminuscf = 1 - cf; +#endif + /* As the rotation matrix becomes block diagonal in a SH basis, we can*/ + /* apply each angular-momentum block individually to save complexity. */ + + /* loop over l blocks */ + m1 = 1; + m2 = 4; + for ( l = 1; l <= shd_rot_max_order; l++ ) + { + /* compute mtx-vector product for this l */ + for ( n = m1; n < m2; n++ ) + { + tmpRot[n - m1] = 0.f; + + for ( m = m1; m < m2; m++ ) + { +#ifdef SBA_CREND_ROT_OPT + val = inAudio.data[m * inAudio.config.numSamplesPerChannel + idx]; + /* crossfade with previous rotation gains */ + tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val ); +#else + readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); + /* crossfade with previous rotation gains */ + tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + + ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); +#endif + } + } + /* write back the result */ + for ( n = m1; n < m2; n++ ) + { + writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); + ( *writePtr ) = tmpRot[n - m1]; + } + m1 = m2; + m2 += 2 * ( l + 1 ) + 1; + } + } + + /*unoptimized code for reference (full matrix multiplication)*/ + // for ( n = 0; n < nchan; n++ ) + // { + // tmpRot[n] = 0.f; + // + // for ( m = 0; m < nchan; m++ ) + // { + // tmpRot[n] += SHrotmat[n][m] * output[m][i]; + // } + // } + // for ( n = 0; n < nchan; n++ ) + // { + // output[n][i] = tmpRot[n]; + // } + + /* move SHrotmat to SHrotmat_prev */ + for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) + { + mvr2r( gains[i], gains_prev[i], HEADROT_SHMAT_DIM ); + } + } + + pop_wmops(); + + return IVAS_ERR_OK; +} +#endif static ivas_error renderIsmToBinaural( const input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -7247,6 +7368,14 @@ static ivas_error renderSbaToMultiBinaural( mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + +#ifdef FIX_BIT_EXACT + rotateFrameSba_2( sbaInput->base.inputBuffer, + sbaInput->base.inConfig, + &HeadRotDataLocal, + sbaInput->rot_gains_prev[pos_idx], + tmpRotBuffer ); +#else rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, &HeadRotDataLocal, @@ -7255,7 +7384,7 @@ static ivas_error renderSbaToMultiBinaural( #endif sbaInput->rot_gains_prev[pos_idx], tmpRotBuffer ); - +#endif copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL ); -- GitLab From 75ca5d1f55693e9f1690a40d25b80bcbe8648c98 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 27 Jun 2023 09:09:12 +0300 Subject: [PATCH 220/591] Remove duplicate code --- lib_dec/ivas_ism_renderer.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index bc5170b4c6..9c4479374d 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -365,7 +365,6 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); } -#ifdef MASA_AND_OBJECTS // Todo OMASA JBM: This needs touches for VOIP path at least. Current version is mostly an adapted copy from ivas_ism_renderer_open() if ( st_ivas->hDecoderConfig->voip_active ) { @@ -378,13 +377,6 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( interpolator_length = init_interpolator_length; } st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ); - for ( i = 0; i < interpolator_length; i++ ) - { - st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); - } -#else - interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif for ( i = 0; i < interpolator_length; i++ ) { -- GitLab From 6bde25918afe43640ecf55a23b865816f7acdbd8 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Tue, 27 Jun 2023 09:39:57 +0200 Subject: [PATCH 221/591] Small Fix --- lib_rend/ivas_objectRenderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 1e7fe9b907..6ff2c005eb 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -616,7 +616,7 @@ ivas_error ivas_td_binaural_renderer_ext( const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ #ifdef FIX_488_SYNC_DELAY - const ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ + const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ #endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ -- GitLab From 198a7b7f4368bd144d797abc61b1b75c9637e103 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 27 Jun 2023 16:05:56 +0530 Subject: [PATCH 222/591] Minor change that was missed while updating --- lib_rend/ivas_output_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 972670ce27..d6a873d26d 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -95,6 +95,9 @@ int16_t audioCfg2channels( case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + nchan_out = 2; break; case AUDIO_CONFIG_ISM1: -- GitLab From 205565636a0293b176fd0616b74842d4d57fa5d0 Mon Sep 17 00:00:00 2001 From: rhb Date: Tue, 27 Jun 2023 13:41:57 +0200 Subject: [PATCH 223/591] fix clang error about applying offset to NULL pointer --- lib_com/options.h | 2 +- lib_enc/ivas_stereo_mdct_stereo_enc.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) mode change 100644 => 100755 lib_com/options.h diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index e4d3a06b58..04aa796704 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ - +#define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index b8ab5398ec..3d277e241d 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -1133,15 +1133,29 @@ void initMdctStereoEncData( set_s( hStereoMdct->mdct_stereo_mode, -1, 2 ); /*Initialize sfb parameteres for TCX20 */ +#ifdef FIX_581_CLANG_OFFSET_TO_NULL + stereo_mdct_init_bands( tcx_coded_lines, TCX_20_CORE, element_brate, igf, igf ? &hIgfGrid[IGF_GRID_LB_NORM] : NULL, &hStereoMdct->stbParamsTCX20.sfbOffset[0], &hStereoMdct->stbParamsTCX20.sfbCnt ); +#else stereo_mdct_init_bands( tcx_coded_lines, TCX_20_CORE, element_brate, igf, &hIgfGrid[IGF_GRID_LB_NORM], &hStereoMdct->stbParamsTCX20.sfbOffset[0], &hStereoMdct->stbParamsTCX20.sfbCnt ); +#endif /*Initialize sfb parameteres for TCX10 */ +#ifdef FIX_581_CLANG_OFFSET_TO_NULL + stereo_mdct_init_bands( tcx_coded_lines, TCX_10_CORE, element_brate, igf, igf ? &hIgfGrid[IGF_GRID_LB_SHORT] : NULL, + &hStereoMdct->stbParamsTCX10.sfbOffset[0], &hStereoMdct->stbParamsTCX10.sfbCnt ); +#else stereo_mdct_init_bands( tcx_coded_lines, TCX_10_CORE, element_brate, igf, &hIgfGrid[IGF_GRID_LB_SHORT], &hStereoMdct->stbParamsTCX10.sfbOffset[0], &hStereoMdct->stbParamsTCX10.sfbCnt ); +#endif /*Initialize sfb parameteres for transitions */ +#ifdef FIX_581_CLANG_OFFSET_TO_NULL + stereo_mdct_init_bands( tcx_coded_lines, -1, element_brate, igf, igf ? &hIgfGrid[IGF_GRID_LB_TRAN] : NULL, + &hStereoMdct->stbParamsTCX20afterACELP.sfbOffset[0], &hStereoMdct->stbParamsTCX20afterACELP.sfbCnt ); +#else stereo_mdct_init_bands( tcx_coded_lines, -1, element_brate, igf, &hIgfGrid[IGF_GRID_LB_TRAN], &hStereoMdct->stbParamsTCX20afterACELP.sfbOffset[0], &hStereoMdct->stbParamsTCX20afterACELP.sfbCnt ); +#endif set_s( hStereoMdct->IGFStereoMode, -1, 2 ); -- GitLab From b7b6982af85e90f02b720d4874bf50da47106556 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Tue, 27 Jun 2023 14:55:37 +0200 Subject: [PATCH 224/591] Move quantization of delay to lower level --- apps/renderer.c | 13 ++++++++++--- lib_rend/lib_rend.c | 20 ++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index f72234bf2a..557c626871 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -313,7 +313,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_syncMdDelay, .match = "sync_md_delay", .matchShort = "smd", - .description = "Metadata Synchronization Delay in ms, Default is 0", + .description = "Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes)", }, #endif }; @@ -1400,6 +1400,13 @@ int main( fprintf( stdout, "\n\nRendering of %d frames finished\n\n", frame ); +#ifdef FIX_488_SYNC_DELAY + if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) floor( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); + } +#endif + #ifdef DEBUGGING int32_t cnt_frames_limited, noClipping; if ( ( cnt_frames_limited = IVAS_REND_GetCntFramesLimited( hIvasRend ) ) > 0 ) @@ -2054,8 +2061,8 @@ static void parseOption( #ifdef FIX_488_SYNC_DELAY case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); - /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ - args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + /* Metadata Delay to sync with audio delay in ms */ + args->syncMdDelay = (int16_t) strtof( optionValues[0], NULL ); break; #endif default: diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index edf18082f1..a7d091e0b2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4669,9 +4669,14 @@ static ivas_error renderIsmToBinaural( { float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; - +#ifdef FIX_488_SYNC_DELAY + int16_t ism_md_subframe_update_ext; +#endif push_wmops( "renderIsmToBinaural" ); - +#ifdef FIX_488_SYNC_DELAY + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ + ism_md_subframe_update_ext = floor( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); +#endif copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer ); if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, @@ -4681,7 +4686,7 @@ static ivas_error renderIsmToBinaural( &ismInput->currentPos, ismInput->hReverb, #ifdef FIX_488_SYNC_DELAY - ismInput->ism_md_subframe_update_ext, + ism_md_subframe_update_ext, #endif outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) @@ -4846,6 +4851,9 @@ static ivas_error renderIsmToBinauralReverb( #endif float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; +#ifdef FIX_488_SYNC_DELAY + int16_t ism_md_subframe_update_ext; +#endif #ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; @@ -4857,6 +4865,10 @@ static ivas_error renderIsmToBinauralReverb( push_wmops( "renderIsmToBinauralRoom" ); +#ifdef FIX_488_SYNC_DELAY + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ + ism_md_subframe_update_ext = floor( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); +#endif copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, @@ -4866,7 +4878,7 @@ static ivas_error renderIsmToBinauralReverb( &ismInput->currentPos, ismInput->hReverb, #ifdef FIX_488_SYNC_DELAY - ismInput->ism_md_subframe_update_ext, + ism_md_subframe_update_ext, #endif outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) -- GitLab From a7aa869de840c9e4cab0011793d0595a48ab2b03 Mon Sep 17 00:00:00 2001 From: Michael Schug Date: Tue, 27 Jun 2023 16:42:57 +0200 Subject: [PATCH 225/591] upmix working with subframes used in jbm decoder path; fixed number of tc buffer channels to 12 also for other than 7_1_4 configurations --- lib_com/ivas_prot.h | 16 ++ lib_dec/ivas_jbm_dec.c | 116 ++++++------ lib_dec/ivas_mc_paramupmix_dec.c | 297 ++++++++++++++++++++++++++++++- lib_dec/ivas_stat_dec.h | 3 + 4 files changed, 372 insertions(+), 60 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 34226e640c..6014794be5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3877,6 +3877,22 @@ void ivas_mc_paramupmix_dec_read_BS( int16_t *nb_bits /* o : number of bits written */ ); +#ifdef JBM_PARAMUPMIX +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 */ +); + +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 */ + float *input_f[], /* i: core-coder transport channels */ + float *output_f[] /* i/o: synthesized core-coder transport channels */ +); +#endif + void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const int16_t lfe_index, /* i : channel index of LFE */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index b5e2cbdbbe..c86739c323 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -381,65 +381,23 @@ ivas_error ivas_jbm_dec_tc( mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); - //ivas_mc_paramupmix_dec( st_ivas, output ); - - /* HP filtering */ - for ( n = 0; n < st_ivas->nchan_transport; n++ ) - { - if ( n != LFE_CHANNEL ) - { - hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); - } - } - - if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) - { - ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); - } - - /* Rendering */ - if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) - { - ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); - } -#if 0 /* Rendering */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); - } - else if ( st_ivas->renderer_type == RENDERER_MC ) + if ( st_ivas->renderer_type == RENDERER_MC ) { - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) + if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) { + /* HP filtering */ + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + if ( n != LFE_CHANNEL ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + } ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); } - else - { - ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, p_output, p_output ); - } } - else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) - { - ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) - { - if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) - { - return error; - } - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); - } -#endif } #endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -673,7 +631,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( #ifdef JBM_PARAMUPMIX else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - ivas_param_upmix_dec_decorr_subframes( st_ivas ); + ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots ); } #endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -928,7 +886,51 @@ ivas_error ivas_jbm_dec_render( #ifdef JBM_PARAMUPMIX else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc, p_output ); + + /* HP filtering */ + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + if ( n != LFE_CHANNEL ) + { + hp20( p_output[n], *nSamplesRendered, st_ivas->mem_hp20_out[n], output_Fs ); + } + } + + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) + { + ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); + } + + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, + st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_output, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { + ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, *nSamplesRendered, p_output, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + } } #endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -1489,6 +1491,12 @@ int16_t ivas_jbm_dec_get_num_tc_channels( num_tc = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; } } +#ifdef JBM_PARAMUPMIX + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + num_tc = MC_PARAMUPMIX_MAX_INPUT_CHANS; + } +#endif else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { if ( st_ivas->hOutSetup.separateChannelEnabled ) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 30ab30653d..d23be11bf5 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -55,6 +55,14 @@ static void ps_pred_process( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, float qmf_mod_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t ch ); +#ifdef JBM_PARAMUPMIX +static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, const int16_t ch ); + +static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] ); + +static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas ); +#endif + static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float pcm_in[][L_FRAME48k], float **pp_out_pcm, const int16_t output_frame ); static int huff_read( Decoder_State *st, const int16_t ( *ht )[2] ); @@ -292,6 +300,99 @@ void ivas_mc_paramupmix_dec( } +#ifdef JBM_PARAMUPMIX +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 */ +) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert( hMCParamUpmix ); + + push_wmops( "ivas_mc_paramupmix_dec_digest_tc" ); + + ivas_param_upmix_dec_decorr_subframes( st_ivas ); + + /* adapt subframes */ + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); + + pop_wmops(); +} + + +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 */ + float *input_f[], /* i: core-coder transport channels */ + float *output_f[] /* i/o: synthesized core-coder transport channels */ +) +{ + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, ch; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert( hMCParamUpmix ); + + push_wmops( "ivas_mc_paramupmix_dec_render" ); + + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + output_f_local[ch] = output_f[ch]; + } + + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + + for ( ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++ ) + { + mvr2r( input_f[ch], output_f_local[ch], *nSamplesRendered); + } + + while ( slots_to_render > 0 ) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; + + ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + output_f_local[ch] += n_samples_sf; + } + } + + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + mvr2r( hMCParamUpmix->alphas[ch], hMCParamUpmix->alpha_prev[ch], IVAS_MAX_NUM_BANDS ); + mvr2r( hMCParamUpmix->betas[ch], hMCParamUpmix->beta_prev[ch], IVAS_MAX_NUM_BANDS ); + } + + *nSamplesAvailable = ( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered ) * slot_size; + + pop_wmops(); +} +#endif + + + /*------------------------------------------------------------------------- * ivas_mc_paramupmix_dec_open() * @@ -307,10 +408,6 @@ ivas_error ivas_mc_paramupmix_dec_open( int16_t nchan_transport; uint16_t i; ivas_error error; -#ifdef JBM_PARAMUPMIX - int16_t num_channels_internal; - num_channels_internal = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; -#endif error = IVAS_ERR_OK; @@ -385,6 +482,11 @@ ivas_error ivas_mc_paramupmix_dec_open( { return error; } + if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); + } + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } #endif @@ -421,6 +523,12 @@ void ivas_mc_paramupmix_dec_close( free( ( *hMCParamUpmix )->pcm_delay[i] ); } } +#ifdef JBM_PARAMUPMIX + if ( ( *hMCParamUpmix )->param_interpolator != NULL ) + { + free( ( *hMCParamUpmix )->param_interpolator ); + } +#endif free( *hMCParamUpmix ); *hMCParamUpmix = NULL; @@ -479,7 +587,7 @@ static void paramupmix_td_decorr_process_jbm( return; } -void ivas_param_upmix_dec_decorr_subframes( +static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { @@ -487,7 +595,6 @@ void ivas_param_upmix_dec_decorr_subframes( int16_t i, ch; int32_t output_Fs; int16_t output_frame; - float Pcm_decorr[MC_PARAMUPMIX_COMBINATIONS][L_FRAME48k]; /* decorrelated channels */ float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ float *p_tc[MC_PARAMUPMIX_MAX_INPUT_CHANS]; @@ -584,6 +691,184 @@ static void ps_pred_process( return; } +#ifdef JBM_PARAMUPMIX +static void ps_pred_process_sf( + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, + DECODER_TC_BUFFER_HANDLE hTcBuffer, + float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ + float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ + float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float *param_interpol, + const int16_t ch ) +{ + float vmre, vmim, vsre, vsim; + int16_t iqmf, ipar, ismp, iismp; + float alpha_smp, beta_smp; + float *alpha1, *alpha2; + float *beta1, *beta2; + float *alpha_prev = hMCParamUpmix->alpha_prev[ch]; + float *beta_prev = hMCParamUpmix->beta_prev[ch]; + + const int16_t qmf_to_par_band[] = { + 0, 1, 2, 3, 4, 5, 5, 6, 6, 7, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 + }; + + for ( iqmf = 0; iqmf < CLDFB_NO_CHANNELS_MAX; iqmf++ ) + { + /* For changing no of parameter bands (ipar1 != ipar2), TIGGER_FRAMING assumed */ + ipar = qmf_to_par_band[iqmf]; + alpha1 = alpha_prev; + beta1 = beta_prev; + + ismp = 0; + alpha2 = hMCParamUpmix->alphas[ch]; + beta2 = hMCParamUpmix->betas[ch]; + alpha_smp = alpha1[ipar]; + beta_smp = beta1[ipar]; + + for ( iismp = 0; iismp < hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered]; iismp++ ) + { + alpha_smp = alpha1[ipar] + ( alpha2[ipar] - alpha1[ipar] ) * param_interpol[iismp]; + beta_smp = beta1[ipar] + ( beta2[ipar] - beta1[ipar] ) * param_interpol[iismp]; + + vmre = qmf_mod_re[ismp][iqmf]; + vmim = qmf_mod_im[ismp][iqmf]; + vsre = qmf_side_re[ismp][iqmf]; + vsim = qmf_side_im[ismp][iqmf]; + + qmf_side_re[ismp][iqmf] = alpha_smp * vmre + beta_smp * vsre; + qmf_side_im[ismp][iqmf] = alpha_smp * vmim + beta_smp * vsim; + + ismp++; + } + } + + return; +} + + +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 */ +) +{ + int16_t i, ch, slot_idx, k; + float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + /*CLDFB*/ + float Cldfb_RealBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + int16_t noparamupmix_delay, n_samples_rendered; + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert( hMCParamUpmix ); + + push_wmops( "ivas_mc_paramupmix_dec_sf" ); + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ + pPcm_temp[2 * i + 1] = output_f[i + 8]; /* decorrelated */ + } + + /* CLDFB Analysis*/ + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ ) + { + /* slot loop for gathering the input data */ + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) + { + cldfbAnalysis_ts( &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), Cldfb_RealBuffer[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + } + } + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + ps_pred_process_sf( hMCParamUpmix, + st_ivas->hTcBuffer, + Cldfb_RealBuffer[2 * ch], /* in/out */ + Cldfb_ImagBuffer[2 * ch], + Cldfb_RealBuffer[2 * ch + 1], /* in/out decorr */ + Cldfb_ImagBuffer[2 * ch + 1], + &hMCParamUpmix->param_interpolator[st_ivas->hTcBuffer->slots_rendered], + ch ); + + /*-- m, s -> l, r ----------------------------*/ + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) + { + for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + { + float qlre = Cldfb_RealBuffer[2 * ch][slot_idx][k]; + float qlim = Cldfb_ImagBuffer[2 * ch][slot_idx][k]; + float qrre = Cldfb_RealBuffer[2 * ch + 1][slot_idx][k]; + float qrim = Cldfb_ImagBuffer[2 * ch + 1][slot_idx][k]; + + Cldfb_RealBuffer[2 * ch][slot_idx][k] = qlre + qrre; + Cldfb_ImagBuffer[2 * ch][slot_idx][k] = qlim + qrim; + Cldfb_RealBuffer[2 * ch + 1][slot_idx][k] = qlre - qrre; + Cldfb_ImagBuffer[2 * ch + 1][slot_idx][k] = qlim - qrim; + } + } + } + /* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */ + pPcm_temp[0] = output_f[4]; + pPcm_temp[1] = output_f[6]; + pPcm_temp[2] = output_f[5]; + pPcm_temp[3] = output_f[7]; + pPcm_temp[4] = output_f[8]; + pPcm_temp[5] = output_f[10]; + pPcm_temp[6] = output_f[9]; + pPcm_temp[7] = output_f[11]; + + /* CLDFB synthesis */ + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ ) + { + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) + { + float *ptr_im[1], *ptr_re[1]; + ptr_re[0] = Cldfb_RealBuffer[ch][slot_idx]; + ptr_im[0] = Cldfb_ImagBuffer[ch][slot_idx]; + + cldfbSynthesis( ptr_re, ptr_im, &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), + hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] ); + } + } + /* adjust delay of other channels */ + noparamupmix_delay = NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS ); + n_samples_rendered = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] * hMCParamUpmix->num_freq_bands; + if (n_samples_rendered > noparamupmix_delay) + { + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + float tmp_buf[L_SUBFRAME5MS_48k]; + mvr2r( &output_f[ch][n_samples_rendered - noparamupmix_delay], tmp_buf, noparamupmix_delay ); + mvr2r( output_f[ch], &output_f[ch][noparamupmix_delay], n_samples_rendered - noparamupmix_delay ); + mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], noparamupmix_delay ); + mvr2r( tmp_buf, hMCParamUpmix->pcm_delay[ch], noparamupmix_delay ); + } + } + else + { + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + float tmp_buf[L_SUBFRAME5MS_48k]; + mvr2r( &output_f[ch][0], tmp_buf, n_samples_rendered ); + mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], n_samples_rendered ); + mvr2r( &hMCParamUpmix->pcm_delay[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay[ch][0], noparamupmix_delay - n_samples_rendered ); + mvr2r( tmp_buf, &hMCParamUpmix->pcm_delay[ch][noparamupmix_delay-n_samples_rendered], n_samples_rendered ); + } + } + + st_ivas->hTcBuffer->slots_rendered += st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; + st_ivas->hTcBuffer->subframes_rendered++; + + pop_wmops(); +} +#endif + static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 315cfbad66..697a577c87 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -802,6 +802,9 @@ typedef struct ivas_mc_paramupmix_dec_data_structure int32_t beta_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; int16_t first_frame; float *pcm_delay[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS]; +#ifdef JBM_PARAMUPMIX + float *param_interpolator; +#endif } MC_PARAMUPMIX_DEC_DATA, *MC_PARAMUPMIX_DEC_HANDLE; -- GitLab From 7af9067f41063fd71377f0436a04e5c07f23718b Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Wed, 28 Jun 2023 16:48:23 +1000 Subject: [PATCH 226/591] Update SBA CLDFB-domain HRTFs --- lib_com/ivas_cnst.h | 5 + lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 35 + lib_rend/ivas_rom_binauralRenderer.c | 7059 ++++++++++++++++++++++++++ lib_rend/ivas_rom_binauralRenderer.h | 15 + lib_rend/ivas_stat_rend.h | 17 + lib_util/hrtf_file_reader.c | 102 + 7 files changed, 7234 insertions(+) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3f5065e6bf..74522f10ee 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1510,6 +1510,11 @@ typedef enum #define BINAURAL_MAXBANDS 60 /* Max number of bands */ #define BINAURAL_CONVBANDS 50 /* Bands upto which convolution is performed */ #define BINAURAL_NTAPS 5 + +#ifdef UPDATE_FASTCONV_SBA_FILTER +#define BINAURAL_NTAPS_SBA 3 +#endif + #define BINAURAL_NTAPS_MAX 96 #define HRTF_SH_ORDER 3 diff --git a/lib_com/options.h b/lib_com/options.h index 86ff4ca1d2..5de98c1a11 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,6 +173,7 @@ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ +#define UPDATE_FASTCONV_SBA_FILTER /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5bd09236e0..cc855055ec 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -180,7 +180,18 @@ static ivas_error ivas_binRenderer_convModuleOpen( } else { +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( hBinRenderer->ivas_format == SBA_FORMAT ) + { + hBinRenConvModule->numTaps = BINAURAL_NTAPS_SBA; + } + else + { + hBinRenConvModule->numTaps = BINAURAL_NTAPS; + } +#else hBinRenConvModule->numTaps = BINAURAL_NTAPS; +#endif /* Use fixed order filtering */ bandIdx = 0; @@ -429,6 +440,29 @@ static ivas_error ivas_binaural_hrtf_open( mvr2r( rightBRIRImag[i][j], HrtfFastConv->rightBRIRImag[i][j], BINAURAL_NTAPS_MAX ); } +#ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( leftHRIRImag_HOA3[i][j], HrtfFastConv->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRReal_HOA3[i][j], HrtfFastConv->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); + } + for ( j = 0; j < 9; j++ ) + { + mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( leftHRIRImag_HOA2[i][j], HrtfFastConv->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRReal_HOA2[i][j], HrtfFastConv->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); + } + for ( j = 0; j < 4; j++ ) + { + mvr2r( leftHRIRReal_FOA[i][j], HrtfFastConv->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( leftHRIRImag_FOA[i][j], HrtfFastConv->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); + } +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); @@ -450,6 +484,7 @@ static ivas_error ivas_binaural_hrtf_open( mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS ); mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS ); } +#endif } mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 7c7c2c694e..2aea03c406 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -56,6 +56,7 @@ +#ifndef UPDATE_FASTCONV_SBA_FILTER const float FASTCONV_HOA3_latency_s = 0.000666667f; const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS]= { @@ -3673,8 +3674,3628 @@ const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS]= } }; +#else +const float FASTCONV_HOA3_latency_s = 0.000020833f; +const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +{ + { + {+0.353305f, +0.566845f, +0.200116f}, + {+0.451504f, -0.563006f, +0.083565f}, + {+0.022092f, +0.111945f, -0.003135f}, + {+0.047133f, +0.000194f, -0.000386f}, + {+0.039375f, -0.036049f, -0.015307f}, + {+0.013502f, -0.004406f, +0.016833f}, + {-0.050267f, +0.058356f, +0.017434f}, + {-0.013681f, +0.080836f, -0.019699f}, + {-0.037136f, +0.024371f, +0.052200f}, + {+0.050122f, -0.078803f, -0.019790f}, + {-0.004565f, +0.007656f, -0.001338f}, + {+0.009821f, -0.051585f, -0.003219f}, + {-0.003833f, -0.023411f, -0.003160f}, + {+0.007736f, -0.042621f, +0.010291f}, + {+0.014210f, -0.003392f, -0.001270f}, + {-0.005609f, +0.001063f, +0.001854f} + }, + { + {+0.011160f, -0.509237f, -0.132176f}, + {+0.142996f, -0.819544f, +0.093135f}, + {+0.003358f, +0.077333f, -0.008548f}, + {+0.004495f, +0.024167f, +0.025614f}, + {+0.020911f, +0.057490f, +0.024558f}, + {+0.020938f, +0.024631f, +0.022840f}, + {-0.049990f, -0.113634f, -0.053590f}, + {+0.010020f, +0.210234f, +0.026992f}, + {-0.094579f, -0.407023f, -0.103353f}, + {+0.038956f, +0.088489f, +0.058039f}, + {+0.002875f, +0.015645f, -0.000778f}, + {+0.020714f, +0.104784f, +0.070444f}, + {-0.008794f, +0.002924f, +0.009615f}, + {+0.004361f, -0.056762f, +0.007070f}, + {+0.010128f, +0.073116f, +0.035032f}, + {-0.005641f, -0.006012f, -0.000245f} + }, + { + {-0.192410f, -0.206164f, -0.191132f}, + {-0.278956f, +0.236216f, -0.253095f}, + {-0.002616f, +0.068222f, +0.000710f}, + {-0.043976f, +0.107663f, +0.006000f}, + {-0.022830f, +0.121862f, +0.008267f}, + {+0.007646f, +0.104913f, -0.016048f}, + {+0.008805f, -0.278895f, +0.005919f}, + {+0.015200f, +0.180293f, +0.037960f}, + {-0.037987f, -0.531186f, -0.053722f}, + {-0.053411f, +0.405963f, -0.066106f}, + {+0.004225f, +0.049392f, -0.020098f}, + {-0.032849f, +0.404382f, -0.057080f}, + {-0.020343f, +0.025697f, +0.003018f}, + {+0.000399f, -0.049237f, +0.005564f}, + {-0.018895f, +0.170897f, -0.004768f}, + {-0.014229f, +0.049740f, -0.026663f} + }, + { + {-0.062917f, +0.511673f, +0.062418f}, + {-0.164174f, +1.090974f, +0.108397f}, + {+0.009127f, +0.065188f, -0.003083f}, + {-0.018593f, +0.081738f, -0.000771f}, + {-0.020686f, +0.093603f, +0.012011f}, + {+0.000826f, +0.118498f, -0.001498f}, + {+0.025996f, -0.307659f, -0.023797f}, + {-0.008194f, +0.054598f, -0.009722f}, + {+0.040351f, -0.445888f, -0.056326f}, + {-0.030847f, +0.708631f, +0.081623f}, + {+0.002063f, +0.033938f, -0.025075f}, + {-0.027403f, +0.458795f, -0.033429f}, + {-0.021373f, -0.007009f, -0.010388f}, + {-0.002090f, -0.031407f, +0.008158f}, + {-0.028475f, +0.071069f, -0.046847f}, + {-0.007602f, +0.116385f, +0.002531f} + }, + { + {+0.114739f, +0.069536f, +0.170911f}, + {+0.106068f, +0.653946f, +0.186091f}, + {+0.032435f, +0.023922f, +0.003440f}, + {+0.048701f, +0.139999f, -0.053329f}, + {+0.008680f, +0.251941f, -0.071200f}, + {-0.004397f, +0.120323f, +0.000310f}, + {+0.025654f, -0.324361f, -0.006461f}, + {-0.004810f, +0.061858f, -0.007597f}, + {+0.097919f, -0.641143f, +0.015289f}, + {+0.011357f, +0.557580f, +0.143138f}, + {+0.004726f, -0.016709f, +0.000434f}, + {+0.013229f, +0.166606f, +0.093126f}, + {-0.007411f, +0.011792f, -0.021547f}, + {-0.005396f, -0.034575f, +0.011453f}, + {+0.010644f, +0.011719f, -0.021909f}, + {+0.005419f, +0.030988f, +0.043631f} + }, + { + {+0.066623f, -0.089947f, +0.096291f}, + {+0.228582f, +0.462839f, +0.023355f}, + {+0.030597f, +0.055459f, +0.010541f}, + {+0.104887f, +0.337465f, -0.003674f}, + {+0.072691f, +0.405228f, -0.038864f}, + {+0.004864f, +0.081470f, -0.022241f}, + {+0.026067f, -0.215427f, +0.055659f}, + {+0.015556f, +0.034465f, -0.026853f}, + {+0.081559f, -0.329728f, +0.167841f}, + {+0.004434f, +0.224966f, -0.027520f}, + {+0.000854f, -0.017986f, +0.001169f}, + {-0.017103f, +0.022207f, +0.026879f}, + {+0.016949f, +0.070641f, -0.004353f}, + {-0.006585f, -0.086138f, -0.004695f}, + {+0.059412f, +0.107209f, +0.004895f}, + {+0.005676f, -0.059162f, +0.003180f} + }, + { + {-0.248577f, +0.462186f, -0.044825f}, + {+0.092220f, +0.576619f, +0.031483f}, + {-0.018552f, +0.118241f, -0.000190f}, + {+0.024038f, +0.192235f, +0.076006f}, + {+0.073463f, +0.111697f, +0.085309f}, + {+0.045418f, +0.052428f, -0.014128f}, + {+0.004341f, -0.088144f, -0.002830f}, + {+0.058183f, -0.067481f, +0.003537f}, + {-0.112838f, +0.181474f, -0.013812f}, + {+0.051144f, +0.057123f, +0.036471f}, + {-0.002310f, -0.009489f, -0.002928f}, + {-0.036815f, +0.070367f, +0.013190f}, + {+0.025238f, +0.001933f, +0.022381f}, + {+0.011799f, -0.070089f, -0.017261f}, + {+0.079383f, -0.005050f, +0.042259f}, + {+0.027513f, -0.031781f, -0.014727f} + }, + { + {-0.588729f, +0.069942f, -0.118192f}, + {-0.336864f, -0.087523f, -0.133178f}, + {-0.091818f, +0.000222f, -0.031435f}, + {-0.240072f, -0.209090f, -0.026656f}, + {-0.106536f, -0.210008f, -0.006949f}, + {+0.086566f, +0.077574f, -0.013942f}, + {+0.036640f, -0.012230f, +0.021355f}, + {+0.059977f, -0.024737f, +0.017673f}, + {-0.214469f, +0.026100f, -0.046140f}, + {+0.016107f, -0.082852f, -0.011968f}, + {-0.003608f, +0.021470f, +0.008749f}, + {-0.046323f, -0.010871f, -0.015628f}, + {-0.008214f, -0.079699f, -0.002987f}, + {+0.052373f, +0.029312f, +0.014086f}, + {+0.018742f, -0.113603f, +0.010455f}, + {+0.059520f, +0.032936f, +0.004294f} + }, + { + {-0.672439f, -0.199370f, +0.003424f}, + {-0.631922f, -0.138094f, -0.043549f}, + {-0.130748f, -0.058055f, -0.001266f}, + {-0.452933f, -0.003480f, -0.056408f}, + {-0.285057f, +0.030036f, -0.056968f}, + {+0.110275f, -0.011467f, +0.016793f}, + {+0.065972f, +0.005614f, +0.004420f}, + {-0.003151f, +0.047883f, +0.002061f}, + {-0.163084f, -0.130815f, +0.001810f}, + {-0.019555f, -0.025290f, -0.023258f}, + {-0.018781f, +0.034389f, +0.006142f}, + {-0.002509f, -0.046479f, -0.009162f}, + {-0.041047f, -0.024011f, -0.016940f}, + {+0.065623f, +0.027310f, +0.010505f}, + {-0.073560f, +0.039971f, -0.029159f}, + {+0.062876f, +0.006797f, +0.012019f} + }, + { + {-0.543455f, +0.059523f, +0.064094f}, + {-0.700107f, +0.080270f, +0.041520f}, + {-0.154990f, -0.009275f, +0.018360f}, + {-0.474326f, +0.126377f, -0.003035f}, + {-0.327360f, +0.114048f, -0.014833f}, + {+0.071241f, -0.058994f, +0.004572f}, + {+0.087784f, +0.000125f, -0.001107f}, + {-0.094160f, -0.038960f, -0.011917f}, + {-0.019089f, +0.055284f, +0.038765f}, + {-0.023647f, +0.039958f, +0.003588f}, + {-0.043021f, -0.013443f, -0.008032f}, + {+0.077825f, +0.044990f, +0.010103f}, + {-0.040861f, +0.021619f, +0.002193f}, + {+0.044745f, -0.030859f, -0.007951f}, + {-0.123807f, +0.055927f, -0.012492f}, + {+0.025663f, -0.034745f, +0.003611f} + }, + { + {-0.336060f, +0.028886f, +0.031505f}, + {-0.587287f, -0.009083f, +0.042775f}, + {-0.182505f, +0.025753f, +0.007772f}, + {-0.327915f, -0.064183f, +0.035026f}, + {-0.233666f, -0.067260f, +0.031214f}, + {-0.007323f, +0.030500f, -0.014877f}, + {+0.086165f, +0.005866f, -0.002682f}, + {-0.157983f, -0.017671f, -0.007972f}, + {+0.103610f, +0.038997f, +0.019660f}, + {-0.007681f, -0.004657f, +0.015128f}, + {-0.055812f, -0.017923f, -0.003300f}, + {+0.143968f, +0.013845f, +0.008347f}, + {-0.017716f, -0.004963f, +0.006287f}, + {+0.008786f, -0.012160f, -0.007210f}, + {-0.121102f, -0.034578f, +0.019391f}, + {-0.032193f, +0.031317f, -0.010154f} + }, + { + {-0.153248f, -0.008370f, -0.009310f}, + {-0.402033f, +0.000118f, +0.012937f}, + {-0.199763f, -0.006595f, +0.001228f}, + {-0.128842f, +0.004526f, +0.020419f}, + {-0.092842f, -0.010605f, +0.021993f}, + {-0.077909f, +0.025349f, -0.002895f}, + {+0.057392f, -0.008479f, -0.003710f}, + {-0.165419f, +0.022789f, +0.007822f}, + {+0.148908f, -0.037324f, -0.013709f}, + {+0.011296f, -0.018097f, +0.005621f}, + {-0.055136f, +0.008613f, +0.006635f}, + {+0.160576f, -0.015557f, -0.006131f}, + {+0.014844f, -0.003364f, +0.000064f}, + {-0.027453f, -0.001660f, +0.003786f}, + {-0.097934f, -0.032125f, +0.013700f}, + {-0.074549f, +0.020854f, -0.006292f} + }, + { + {-0.021458f, -0.031294f, -0.015786f}, + {-0.225566f, -0.016671f, -0.005476f}, + {-0.179128f, -0.006436f, +0.000989f}, + {+0.030888f, -0.004116f, -0.001010f}, + {+0.023526f, +0.004404f, -0.002301f}, + {-0.113727f, -0.001584f, +0.014207f}, + {+0.006187f, +0.003628f, -0.000322f}, + {-0.130415f, +0.000132f, +0.008388f}, + {+0.133114f, -0.001415f, -0.020106f}, + {+0.026233f, +0.006894f, -0.005590f}, + {-0.046982f, +0.011852f, +0.003518f}, + {+0.124161f, +0.003790f, -0.005992f}, + {+0.039303f, -0.005121f, -0.003574f}, + {-0.061746f, +0.020157f, -0.000385f}, + {-0.073801f, +0.016410f, -0.009153f}, + {-0.089034f, -0.008662f, +0.006612f} + }, + { + {+0.079072f, +0.039673f, -0.003004f}, + {-0.077618f, +0.033045f, -0.007328f}, + {-0.090967f, +0.027848f, +0.000971f}, + {+0.121511f, -0.002007f, -0.010039f}, + {+0.095609f, +0.005944f, -0.008880f}, + {-0.100415f, -0.015820f, +0.006869f}, + {-0.060544f, -0.012856f, +0.004470f}, + {-0.077695f, +0.001667f, -0.001003f}, + {+0.092912f, +0.018201f, -0.005273f}, + {+0.040823f, +0.014455f, -0.004325f}, + {-0.030102f, +0.002197f, -0.002719f}, + {+0.043620f, -0.016980f, -0.000122f}, + {+0.041014f, +0.001499f, -0.001303f}, + {-0.088431f, +0.009078f, -0.001327f}, + {-0.051030f, +0.024992f, -0.008833f}, + {-0.091055f, -0.011437f, +0.003728f} + }, + { + {+0.165755f, -0.020564f, +0.004876f}, + {+0.050384f, -0.037239f, -0.000994f}, + {+0.070084f, -0.036144f, -0.001750f}, + {+0.168503f, -0.016906f, -0.008961f}, + {+0.141507f, -0.014408f, -0.005947f}, + {-0.022796f, -0.010807f, -0.007047f}, + {-0.126569f, +0.016739f, +0.005274f}, + {-0.026827f, -0.017151f, -0.002196f}, + {+0.045512f, +0.004295f, +0.005991f}, + {+0.054896f, -0.008311f, +0.001754f}, + {-0.003645f, -0.010307f, -0.002009f}, + {-0.057176f, +0.014805f, +0.004774f}, + {+0.011072f, +0.010642f, -0.000248f}, + {-0.108885f, -0.004650f, +0.007771f}, + {-0.039664f, -0.018793f, +0.005550f}, + {-0.092338f, -0.000767f, -0.000795f} + }, + { + {+0.239774f, +0.007034f, +0.002631f}, + {+0.158490f, +0.023748f, +0.003698f}, + {+0.270403f, +0.044381f, -0.006888f}, + {+0.208319f, +0.016522f, -0.001863f}, + {+0.188853f, +0.017009f, -0.001321f}, + {+0.109689f, +0.039932f, -0.010880f}, + {-0.162224f, -0.011965f, +0.002284f}, + {+0.008275f, +0.010941f, +0.003208f}, + {-0.008632f, -0.022468f, +0.003767f}, + {+0.062087f, -0.004201f, +0.001503f}, + {+0.024938f, +0.010189f, +0.000489f}, + {-0.144572f, -0.021004f, +0.007356f}, + {-0.046268f, -0.010126f, +0.001327f}, + {-0.126844f, -0.020412f, +0.005586f}, + {-0.049688f, -0.012221f, +0.009513f}, + {-0.100800f, -0.001133f, +0.001097f} + }, + { + {+0.298828f, -0.005793f, -0.001373f}, + {+0.237768f, -0.008765f, +0.003046f}, + {+0.449357f, -0.047352f, -0.004642f}, + {+0.250753f, -0.004865f, -0.001957f}, + {+0.245484f, -0.010819f, -0.000881f}, + {+0.249706f, -0.049408f, -0.003961f}, + {-0.136738f, -0.008753f, -0.001855f}, + {+0.025853f, +0.003385f, +0.004139f}, + {-0.065934f, +0.022501f, -0.003288f}, + {+0.057527f, +0.008394f, -0.002717f}, + {+0.046206f, -0.004855f, +0.002123f}, + {-0.183725f, +0.015903f, +0.001405f}, + {-0.114051f, +0.012348f, +0.005264f}, + {-0.129436f, +0.010088f, -0.004805f}, + {-0.071460f, +0.022939f, +0.001488f}, + {-0.119149f, +0.009223f, +0.000555f} + }, + { + {+0.346011f, +0.008343f, -0.002521f}, + {+0.286535f, -0.000576f, -0.000480f}, + {+0.541635f, +0.014116f, +0.002290f}, + {+0.286228f, +0.009795f, -0.003869f}, + {+0.299965f, +0.009735f, -0.003167f}, + {+0.328736f, +0.018968f, +0.006082f}, + {-0.037520f, +0.034439f, -0.002184f}, + {+0.042204f, -0.003541f, +0.000630f}, + {-0.115659f, -0.004656f, -0.004969f}, + {+0.039051f, -0.003041f, -0.004257f}, + {+0.056424f, +0.001120f, +0.003167f}, + {-0.144869f, +0.019123f, -0.003415f}, + {-0.166286f, -0.018086f, +0.003983f}, + {-0.101679f, +0.021538f, -0.005021f}, + {-0.078280f, -0.006671f, -0.006794f}, + {-0.140047f, -0.004747f, -0.001252f} + }, + { + {+0.388388f, -0.009881f, -0.001847f}, + {+0.316128f, -0.000090f, -0.004009f}, + {+0.513290f, +0.035603f, +0.000300f}, + {+0.296513f, -0.005786f, -0.000267f}, + {+0.333378f, -0.007221f, -0.002877f}, + {+0.295424f, +0.041070f, +0.003600f}, + {+0.114311f, -0.042170f, +0.000214f}, + {+0.081378f, -0.006284f, -0.003240f}, + {-0.150267f, -0.005614f, +0.000485f}, + {+0.005390f, +0.000214f, -0.000390f}, + {+0.064645f, +0.002835f, +0.002892f}, + {-0.026756f, -0.044985f, +0.000392f}, + {-0.170480f, -0.001979f, -0.000156f}, + {-0.050780f, -0.025790f, +0.003317f}, + {-0.047515f, -0.026029f, -0.004739f}, + {-0.153995f, -0.004894f, +0.001183f} + }, + { + {+0.430636f, +0.009808f, -0.001195f}, + {+0.343293f, +0.010478f, -0.003913f}, + {+0.388765f, -0.049553f, -0.008265f}, + {+0.266407f, -0.016789f, +0.000864f}, + {+0.328141f, -0.007654f, -0.002512f}, + {+0.155445f, -0.060858f, -0.009380f}, + {+0.269010f, +0.026881f, -0.000978f}, + {+0.158656f, +0.025362f, -0.003743f}, + {-0.171832f, +0.002756f, +0.006554f}, + {-0.043647f, -0.009482f, +0.003918f}, + {+0.090667f, -0.001476f, -0.001048f}, + {+0.132548f, +0.036105f, +0.003022f}, + {-0.106351f, +0.024154f, -0.000421f}, + {-0.000521f, +0.009705f, +0.007542f}, + {+0.019829f, +0.036619f, +0.006700f}, + {-0.155900f, +0.002824f, +0.004883f} + }, + { + {+0.471455f, -0.008296f, -0.001200f}, + {+0.377731f, -0.016768f, +0.000590f}, + {+0.234888f, +0.026343f, -0.008776f}, + {+0.198215f, +0.029257f, -0.004797f}, + {+0.279113f, +0.015431f, -0.003236f}, + {-0.033581f, +0.032760f, -0.011351f}, + {+0.370767f, -0.006318f, -0.006828f}, + {+0.266209f, -0.029783f, -0.001410f}, + {-0.185419f, +0.012636f, +0.005498f}, + {-0.100533f, +0.019010f, +0.003209f}, + {+0.151097f, -0.010446f, -0.007094f}, + {+0.274631f, -0.012724f, -0.003901f}, + {+0.013966f, -0.029859f, -0.001195f}, + {+0.031705f, +0.010192f, +0.002683f}, + {+0.102880f, -0.011055f, +0.011106f}, + {-0.143777f, +0.006427f, +0.002026f} + }, + { + {+0.505485f, +0.006321f, -0.001405f}, + {+0.419164f, +0.009705f, +0.004024f}, + {+0.115231f, -0.006245f, -0.000430f}, + {+0.110599f, -0.013787f, -0.006578f}, + {+0.197526f, -0.015552f, -0.000736f}, + {-0.208411f, -0.008219f, +0.002566f}, + {+0.381442f, -0.001142f, -0.007728f}, + {+0.371664f, +0.016115f, -0.002975f}, + {-0.191819f, -0.017185f, -0.004447f}, + {-0.147317f, -0.015855f, -0.001243f}, + {+0.239821f, +0.029217f, -0.008681f}, + {+0.348287f, +0.007454f, -0.010181f}, + {+0.149521f, +0.030650f, -0.003365f}, + {+0.048588f, -0.006717f, -0.005355f}, + {+0.186826f, -0.010831f, -0.001024f}, + {-0.115953f, +0.001790f, -0.004618f} + }, + { + {+0.527959f, -0.004605f, -0.000793f}, + {+0.465933f, +0.000734f, +0.000648f}, + {+0.058769f, +0.003399f, +0.003980f}, + {+0.020939f, +0.002500f, +0.001602f}, + {+0.102989f, +0.023640f, +0.000907f}, + {-0.330754f, +0.015227f, +0.013490f}, + {+0.293504f, +0.012966f, +0.002367f}, + {+0.435673f, -0.007769f, -0.006056f}, + {-0.189456f, -0.010551f, -0.008519f}, + {-0.165864f, -0.001568f, -0.003516f}, + {+0.320806f, -0.034715f, -0.000873f}, + {+0.324855f, -0.004016f, -0.002288f}, + {+0.248230f, -0.023651f, -0.001117f}, + {+0.067435f, -0.016300f, -0.003833f}, + {+0.272913f, -0.007587f, -0.015541f}, + {-0.076620f, -0.021772f, -0.003143f} + }, + { + {+0.537963f, +0.000122f, -0.000129f}, + {+0.521439f, +0.006120f, -0.005687f}, + {+0.059349f, +0.002731f, +0.001179f}, + {-0.063524f, -0.015179f, +0.008462f}, + {+0.018295f, -0.018831f, -0.001086f}, + {-0.382316f, -0.020820f, +0.008228f}, + {+0.133723f, -0.051158f, +0.007642f}, + {+0.427333f, -0.004801f, -0.004396f}, + {-0.189172f, +0.025571f, +0.003440f}, + {-0.153064f, +0.017940f, +0.000618f}, + {+0.344855f, +0.000841f, +0.007255f}, + {+0.204120f, -0.035702f, +0.007554f}, + {+0.269414f, -0.005639f, +0.002449f}, + {+0.098719f, +0.013856f, +0.002962f}, + {+0.355359f, +0.040342f, -0.012703f}, + {-0.043435f, +0.014923f, +0.004398f} + }, + { + {+0.539918f, +0.002520f, -0.000803f}, + {+0.586780f, -0.022878f, -0.005664f}, + {+0.088465f, -0.012487f, -0.000009f}, + {-0.133857f, +0.024436f, +0.005429f}, + {-0.038815f, +0.004600f, -0.001199f}, + {-0.354019f, -0.005760f, -0.002225f}, + {-0.035479f, +0.061479f, -0.003852f}, + {+0.333448f, +0.030542f, -0.002292f}, + {-0.214917f, +0.009773f, +0.013046f}, + {-0.126578f, -0.010093f, +0.005470f}, + {+0.286447f, +0.044878f, +0.001444f}, + {+0.026257f, +0.067149f, +0.001093f}, + {+0.208042f, +0.035382f, -0.000884f}, + {+0.140716f, -0.000405f, +0.001329f}, + {+0.398750f, -0.026334f, +0.002502f}, + {-0.035058f, +0.007558f, +0.005919f} + }, + { + {+0.542223f, +0.000691f, -0.001439f}, + {+0.649673f, +0.023205f, +0.000535f}, + {+0.109219f, +0.005980f, +0.002282f}, + {-0.171779f, -0.010220f, -0.000656f}, + {-0.066150f, +0.005365f, +0.002547f}, + {-0.254746f, +0.041005f, -0.002026f}, + {-0.138924f, -0.008674f, -0.012149f}, + {+0.169249f, -0.044112f, -0.002599f}, + {-0.272638f, -0.040677f, +0.004640f}, + {-0.110153f, -0.006462f, +0.003434f}, + {+0.169903f, -0.042984f, -0.010056f}, + {-0.132794f, -0.036153f, -0.009130f}, + {+0.102112f, -0.031703f, -0.006139f}, + {+0.188913f, +0.004870f, -0.004839f}, + {+0.357390f, -0.030371f, +0.006291f}, + {-0.051114f, -0.020551f, -0.000894f} + }, + { + {+0.551847f, -0.004875f, -0.000679f}, + {+0.690272f, -0.004312f, +0.004016f}, + {+0.095639f, +0.010071f, +0.002809f}, + {-0.161818f, -0.013824f, -0.000790f}, + {-0.076081f, +0.002390f, +0.004308f}, + {-0.122361f, -0.040035f, +0.004601f}, + {-0.144006f, -0.036671f, -0.003198f}, + {-0.024466f, +0.039610f, -0.000882f}, + {-0.331827f, +0.020929f, -0.006635f}, + {-0.113319f, +0.007876f, -0.000927f}, + {+0.048322f, +0.009251f, -0.008004f}, + {-0.207982f, -0.015726f, -0.004350f}, + {+0.006949f, +0.009330f, -0.004246f}, + {+0.233905f, -0.014811f, -0.005355f}, + {+0.223143f, +0.054998f, -0.002434f}, + {-0.070208f, +0.002186f, -0.004895f} + }, + { + {+0.570043f, +0.005432f, +0.000103f}, + {+0.699360f, -0.014398f, -0.000427f}, + {+0.048501f, -0.018143f, +0.001306f}, + {-0.107295f, +0.023902f, +0.003671f}, + {-0.082584f, -0.006076f, +0.001731f}, + {-0.005834f, +0.019340f, +0.006865f}, + {-0.085415f, +0.035831f, +0.009933f}, + {-0.202459f, -0.035934f, +0.000303f}, + {-0.353113f, +0.015051f, -0.004263f}, + {-0.130123f, -0.004257f, -0.001776f}, + {-0.043254f, -0.003167f, +0.001496f}, + {-0.189334f, +0.031601f, +0.007634f}, + {-0.040215f, +0.005301f, +0.001534f}, + {+0.256999f, +0.008098f, -0.001598f}, + {+0.036347f, -0.049036f, -0.008301f}, + {-0.070389f, +0.011544f, -0.000794f} + }, + { + {+0.593416f, -0.005649f, +0.000278f}, + {+0.688298f, +0.007364f, -0.005463f}, + {-0.008044f, +0.018190f, -0.001207f}, + {-0.030689f, -0.015365f, +0.004543f}, + {-0.091891f, +0.004696f, -0.000919f}, + {+0.064670f, +0.007573f, +0.000965f}, + {-0.030187f, +0.002153f, +0.010834f}, + {-0.331404f, +0.015975f, +0.000858f}, + {-0.323976f, -0.025164f, +0.004961f}, + {-0.148829f, -0.000188f, +0.000078f}, + {-0.101305f, +0.006103f, +0.005181f}, + {-0.115300f, -0.016832f, +0.010749f}, + {-0.032766f, -0.011589f, +0.005290f}, + {+0.239406f, +0.007974f, +0.000705f}, + {-0.145255f, +0.023713f, -0.004941f}, + {-0.046369f, -0.012177f, +0.003695f} + }, + { + {+0.616579f, +0.002929f, -0.000295f}, + {+0.676588f, +0.004629f, -0.003842f}, + {-0.043537f, -0.004766f, -0.003324f}, + {+0.044220f, +0.013845f, +0.003072f}, + {-0.101856f, +0.006437f, +0.001748f}, + {+0.092523f, -0.007377f, -0.006975f}, + {-0.023470f, -0.026713f, -0.000479f}, + {-0.400554f, +0.001062f, +0.004867f}, + {-0.261565f, +0.014128f, +0.007944f}, + {-0.159121f, +0.002751f, +0.002980f}, + {-0.138765f, -0.008950f, +0.004189f}, + {-0.034625f, -0.000481f, +0.002727f}, + {+0.012613f, +0.005909f, +0.003331f}, + {+0.175748f, -0.024801f, -0.000902f}, + {-0.281594f, -0.008334f, +0.003990f}, + {-0.007054f, +0.002604f, +0.002155f} + }, + { + {+0.635179f, -0.002823f, -0.001148f}, + {+0.674199f, -0.007986f, +0.000991f}, + {-0.041014f, -0.013849f, -0.001185f}, + {+0.104750f, -0.003964f, +0.000987f}, + {-0.107619f, +0.003736f, +0.004502f}, + {+0.101204f, -0.003739f, -0.008397f}, + {-0.064575f, +0.021388f, -0.009658f}, + {-0.422196f, -0.004265f, +0.008954f}, + {-0.190975f, -0.003688f, +0.002622f}, + {-0.155793f, +0.001509f, +0.003088f}, + {-0.169274f, +0.008874f, +0.002289f}, + {+0.023162f, -0.001981f, -0.005597f}, + {+0.073018f, -0.010252f, -0.000970f}, + {+0.080452f, +0.024265f, -0.002891f}, + {-0.363635f, +0.004698f, +0.010523f}, + {+0.035663f, -0.006812f, -0.001722f} + }, + { + {+0.647447f, +0.003124f, -0.000778f}, + {+0.678396f, -0.001222f, +0.002175f}, + {-0.008003f, +0.018788f, +0.004232f}, + {+0.153771f, +0.006824f, -0.001505f}, + {-0.102284f, -0.006283f, +0.000369f}, + {+0.107854f, +0.015766f, -0.002536f}, + {-0.127703f, -0.002824f, -0.007472f}, + {-0.415367f, -0.005027f, +0.007128f}, + {-0.124975f, +0.011994f, -0.001327f}, + {-0.135698f, +0.002841f, +0.000522f}, + {-0.197083f, -0.008952f, +0.000525f}, + {+0.049410f, +0.008433f, -0.005306f}, + {+0.128034f, +0.008755f, -0.002993f}, + {-0.020098f, -0.017083f, -0.001266f}, + {-0.399229f, -0.010519f, +0.009961f}, + {+0.073610f, +0.013100f, -0.000219f} + }, + { + {+0.653287f, -0.000651f, -0.000132f}, + {+0.682914f, +0.002014f, -0.000124f}, + {+0.032972f, -0.005837f, +0.006215f}, + {+0.202805f, -0.008225f, -0.002812f}, + {-0.078083f, -0.005921f, -0.003749f}, + {+0.111320f, -0.004540f, +0.003693f}, + {-0.194460f, +0.001719f, +0.000738f}, + {-0.388630f, -0.001712f, +0.002133f}, + {-0.064250f, -0.011691f, -0.000978f}, + {-0.097911f, -0.010340f, -0.000589f}, + {-0.217935f, +0.002537f, -0.000189f}, + {+0.043003f, -0.001190f, -0.000648f}, + {+0.160424f, -0.006445f, -0.003025f}, + {-0.102796f, +0.011222f, +0.001449f}, + {-0.392994f, +0.003832f, +0.004205f}, + {+0.101814f, -0.004741f, +0.002529f} + }, + { + {+0.655085f, -0.000496f, -0.000073f}, + {+0.685269f, +0.000562f, -0.000824f}, + {+0.064749f, -0.008716f, +0.000371f}, + {+0.258268f, +0.016126f, -0.002727f}, + {-0.038467f, +0.019915f, -0.001374f}, + {+0.101519f, -0.013031f, +0.001724f}, + {-0.262717f, -0.010913f, +0.005785f}, + {-0.340935f, +0.010917f, -0.000109f}, + {-0.005117f, +0.011670f, -0.001141f}, + {-0.047975f, +0.015016f, +0.000510f}, + {-0.227673f, +0.001545f, +0.000844f}, + {+0.006815f, -0.010613f, +0.001679f}, + {+0.158152f, -0.002971f, -0.001763f}, + {-0.154604f, -0.004393f, +0.003495f}, + {-0.341946f, +0.012918f, +0.000060f}, + {+0.123129f, -0.003187f, +0.000554f} + }, + { + {+0.657162f, +0.001154f, -0.000704f}, + {+0.686405f, -0.001174f, +0.000024f}, + {+0.087607f, -0.002335f, -0.004967f}, + {+0.314889f, -0.015378f, -0.000770f}, + {-0.001549f, -0.013009f, +0.003904f}, + {+0.077871f, +0.011151f, -0.003120f}, + {-0.333383f, +0.022033f, +0.004891f}, + {-0.273704f, -0.019370f, +0.000308f}, + {+0.054701f, -0.011371f, -0.002150f}, + {+0.003312f, -0.012026f, +0.002061f}, + {-0.228798f, -0.001402f, +0.001592f}, + {-0.048684f, +0.018229f, +0.000520f}, + {+0.117088f, +0.012634f, -0.000896f}, + {-0.173410f, +0.001735f, +0.003820f}, + {-0.247906f, -0.029903f, +0.000682f}, + {+0.148293f, -0.000926f, -0.003582f} + }, + { + {+0.663635f, +0.002010f, -0.001316f}, + {+0.689882f, -0.000220f, +0.000110f}, + {+0.108949f, +0.013447f, -0.002013f}, + {+0.358661f, +0.009695f, +0.001033f}, + {+0.013352f, -0.004281f, +0.004550f}, + {+0.049096f, -0.001505f, -0.002637f}, + {-0.398463f, -0.021957f, -0.000327f}, + {-0.196600f, +0.019778f, +0.001903f}, + {+0.110988f, +0.014423f, -0.001867f}, + {+0.045870f, +0.004558f, +0.001576f}, + {-0.228188f, +0.000097f, +0.001476f}, + {-0.105835f, -0.015244f, -0.001995f}, + {+0.044580f, -0.021539f, -0.001382f}, + {-0.164082f, +0.001655f, +0.001885f}, + {-0.126620f, +0.032568f, +0.003705f}, + {+0.185481f, +0.013419f, -0.004184f} + }, + { + {+0.675624f, -0.004827f, -0.000839f}, + {+0.700179f, -0.002102f, -0.000678f}, + {+0.128613f, -0.006572f, +0.002141f}, + {+0.378743f, +0.002887f, +0.000648f}, + {+0.004220f, +0.012669f, +0.000801f}, + {+0.022440f, +0.000653f, +0.000869f}, + {-0.441665f, +0.002210f, -0.002042f}, + {-0.124814f, -0.014411f, +0.002833f}, + {+0.153596f, -0.007894f, -0.000675f}, + {+0.077085f, -0.001217f, -0.000703f}, + {-0.231308f, -0.000725f, +0.002147f}, + {-0.147273f, +0.003213f, -0.002198f}, + {-0.042268f, +0.020842f, -0.002800f}, + {-0.133721f, -0.009739f, +0.001057f}, + {-0.003152f, -0.021386f, +0.003714f}, + {+0.229253f, -0.015325f, -0.001319f} + }, + { + {+0.689875f, +0.004735f, +0.000183f}, + {+0.720017f, +0.006167f, -0.000699f}, + {+0.141755f, -0.003516f, +0.000834f}, + {+0.376706f, -0.006807f, -0.001713f}, + {-0.011000f, -0.005016f, -0.001618f}, + {+0.000647f, -0.004137f, +0.002283f}, + {-0.454292f, +0.009561f, +0.002281f}, + {-0.069428f, +0.004651f, +0.001574f}, + {+0.172906f, +0.000456f, -0.000712f}, + {+0.102160f, +0.005230f, -0.001608f}, + {-0.237600f, -0.001176f, +0.003651f}, + {-0.166513f, +0.006046f, +0.001258f}, + {-0.123162f, -0.009523f, -0.000972f}, + {-0.093037f, +0.007808f, +0.000738f}, + {+0.101706f, +0.008107f, -0.001772f}, + {+0.261899f, +0.005910f, +0.000263f} + }, + { + {+0.701449f, -0.001309f, +0.000513f}, + {+0.747852f, -0.007083f, -0.000295f}, + {+0.146674f, +0.002063f, -0.002067f}, + {+0.365508f, +0.004005f, -0.003093f}, + {-0.009820f, -0.003073f, -0.001694f}, + {-0.014954f, +0.005079f, +0.001243f}, + {-0.444057f, -0.005273f, +0.005170f}, + {-0.030220f, -0.001713f, -0.001402f}, + {+0.167308f, +0.005594f, -0.001307f}, + {+0.126894f, -0.005843f, -0.001163f}, + {-0.239461f, +0.006087f, +0.002206f}, + {-0.171030f, -0.001130f, +0.003837f}, + {-0.185728f, +0.008176f, +0.002303f}, + {-0.053859f, -0.008398f, -0.000003f}, + {+0.180213f, -0.012225f, -0.006311f}, + {+0.267399f, +0.003688f, -0.000070f} + }, + { + {+0.707682f, -0.001614f, -0.000417f}, + {+0.778938f, +0.006537f, -0.000334f}, + {+0.145291f, +0.002890f, -0.001284f}, + {+0.359528f, +0.005062f, -0.001469f}, + {+0.019378f, +0.015221f, -0.000076f}, + {-0.021977f, -0.000916f, +0.000266f}, + {-0.425305f, -0.000822f, +0.003160f}, + {+0.002113f, +0.007052f, -0.002427f}, + {+0.143996f, -0.006679f, -0.001487f}, + {+0.153276f, +0.008199f, -0.000318f}, + {-0.224106f, +0.002607f, -0.000957f}, + {-0.172702f, -0.005631f, +0.001975f}, + {-0.227595f, -0.009189f, +0.001906f}, + {-0.024550f, +0.006878f, +0.000998f}, + {+0.231993f, +0.016149f, -0.003555f}, + {+0.242520f, -0.012045f, -0.001170f} + }, + { + {+0.709804f, +0.000997f, -0.001515f}, + {+0.808027f, -0.005290f, -0.000583f}, + {+0.139809f, +0.000435f, +0.000818f}, + {+0.365924f, -0.006226f, +0.001737f}, + {+0.071369f, -0.017742f, +0.003060f}, + {-0.017802f, -0.003027f, +0.000621f}, + {-0.407651f, -0.000451f, +0.000175f}, + {+0.034591f, -0.007791f, -0.002030f}, + {+0.114950f, +0.006228f, -0.001120f}, + {+0.179490f, -0.006128f, +0.000795f}, + {-0.183246f, -0.015768f, -0.000773f}, + {-0.177035f, +0.003531f, -0.000696f}, + {-0.250400f, +0.001355f, +0.001108f}, + {-0.008187f, +0.000159f, +0.001456f}, + {+0.254611f, -0.001384f, -0.000532f}, + {+0.198496f, +0.013948f, -0.002759f} + }, + { + {+0.710823f, +0.002381f, -0.001069f}, + {+0.831214f, +0.003447f, -0.000878f}, + {+0.132056f, -0.007797f, -0.000969f}, + {+0.382880f, -0.001094f, +0.000711f}, + {+0.129160f, +0.007502f, +0.002763f}, + {-0.003161f, +0.000767f, -0.000443f}, + {-0.392711f, +0.006305f, +0.000815f}, + {+0.067053f, +0.011901f, -0.000327f}, + {+0.090742f, -0.003835f, -0.000996f}, + {+0.202084f, +0.000560f, -0.000195f}, + {-0.122322f, +0.020924f, +0.002535f}, + {-0.182462f, +0.002778f, +0.000258f}, + {-0.259161f, +0.001293f, +0.002195f}, + {+0.000645f, -0.003627f, -0.000469f}, + {+0.248733f, -0.007401f, -0.001654f}, + {+0.153178f, -0.008546f, -0.003483f} + }, + { + {+0.712186f, -0.002003f, +0.000341f}, + {+0.846788f, -0.001521f, -0.001394f}, + {+0.124294f, +0.003415f, -0.004317f}, + {+0.406372f, -0.002613f, -0.002804f}, + {+0.179207f, -0.002493f, -0.001438f}, + {+0.017437f, -0.004122f, -0.002593f}, + {-0.378082f, -0.002349f, +0.002279f}, + {+0.093160f, -0.004321f, +0.001305f}, + {+0.077016f, -0.001502f, +0.000076f}, + {+0.220676f, -0.001245f, -0.002361f}, + {-0.057208f, -0.011096f, +0.003599f}, + {-0.185276f, -0.001151f, +0.002614f}, + {-0.259729f, -0.001827f, +0.003455f}, + {+0.012127f, +0.000504f, -0.003413f}, + {+0.221948f, +0.010321f, -0.003531f}, + {+0.118717f, -0.000242f, -0.001468f} + }, + { + {+0.713662f, -0.000828f, +0.000545f}, + {+0.855438f, +0.002950f, -0.000977f}, + {+0.115830f, +0.005727f, -0.002674f}, + {+0.431080f, +0.008386f, -0.003025f}, + {+0.218522f, +0.008054f, -0.003300f}, + {+0.036091f, +0.008702f, -0.001428f}, + {-0.359216f, +0.001218f, +0.000904f}, + {+0.107642f, -0.001544f, +0.000220f}, + {+0.072571f, -0.000752f, +0.000715f}, + {+0.237634f, +0.007061f, -0.001792f}, + {-0.001551f, +0.003678f, +0.000322f}, + {-0.181633f, -0.003122f, +0.001514f}, + {-0.255564f, -0.003731f, +0.002293f}, + {+0.032826f, +0.012636f, -0.002484f}, + {+0.185211f, -0.004024f, -0.002705f}, + {+0.094101f, -0.001623f, +0.001061f} + }, + { + {+0.715808f, +0.001447f, -0.000564f}, + {+0.858599f, -0.000128f, -0.000166f}, + {+0.099314f, +0.001041f, +0.001297f}, + {+0.448457f, -0.007760f, -0.000064f}, + {+0.248826f, -0.008996f, -0.001277f}, + {+0.041985f, -0.000319f, +0.000791f}, + {-0.330901f, -0.006650f, -0.000552f}, + {+0.113746f, +0.002963f, -0.001774f}, + {+0.073588f, -0.000327f, +0.000159f}, + {+0.253601f, -0.004683f, +0.000245f}, + {+0.041369f, -0.004973f, -0.002735f}, + {-0.166731f, -0.003863f, -0.000533f}, + {-0.246518f, -0.001268f, -0.000049f}, + {+0.057814f, -0.010629f, +0.001615f}, + {+0.147641f, +0.004485f, +0.000244f}, + {+0.070521f, +0.005007f, +0.001670f} + }, + { + {+0.720382f, +0.001583f, -0.001168f}, + {+0.858507f, -0.001602f, -0.000561f}, + {+0.067329f, -0.015190f, +0.000273f}, + {+0.450274f, -0.005070f, +0.000753f}, + {+0.271109f, +0.002256f, -0.000399f}, + {+0.028488f, -0.011815f, -0.001154f}, + {-0.292330f, +0.012166f, +0.000199f}, + {+0.120202f, +0.001560f, -0.002785f}, + {+0.077618f, +0.000385f, -0.000057f}, + {+0.267478f, -0.001019f, -0.000455f}, + {+0.074822f, +0.008817f, -0.002528f}, + {-0.138952f, +0.011104f, +0.000590f}, + {-0.231196f, +0.009528f, +0.001492f}, + {+0.074656f, -0.000989f, +0.002061f}, + {+0.113858f, -0.008628f, +0.000648f}, + {+0.041189f, -0.009773f, +0.000867f} + }, + { + {+0.728412f, -0.003781f, -0.000442f}, + {+0.858915f, +0.000641f, -0.001243f}, + {+0.021588f, +0.015568f, -0.003718f}, + {+0.435021f, +0.011190f, -0.002580f}, + {+0.286107f, +0.000454f, -0.002042f}, + {-0.001012f, +0.010763f, -0.004584f}, + {-0.248323f, -0.011164f, +0.001788f}, + {+0.134196f, -0.006281f, -0.001978f}, + {+0.082702f, +0.001367f, -0.001190f}, + {+0.278772f, +0.000302f, -0.002741f}, + {+0.102933f, -0.009391f, +0.000025f}, + {-0.103537f, -0.008673f, +0.002139f}, + {-0.211947f, -0.006496f, +0.004418f}, + {+0.077185f, +0.005220f, -0.000312f}, + {+0.087037f, +0.006765f, -0.000943f}, + {+0.005530f, +0.010882f, -0.000993f} + }, + { + {+0.738976f, +0.002329f, +0.000136f}, + {+0.861896f, -0.000932f, -0.002377f}, + {-0.029402f, -0.003271f, -0.002468f}, + {+0.408989f, -0.003243f, -0.003584f}, + {+0.293612f, +0.002313f, -0.002730f}, + {-0.038002f, -0.000412f, -0.002803f}, + {-0.206194f, +0.003320f, +0.000488f}, + {+0.155421f, +0.006078f, -0.001116f}, + {+0.087818f, +0.003223f, -0.001518f}, + {+0.285833f, +0.006231f, -0.001960f}, + {+0.128249f, +0.001074f, +0.000243f}, + {-0.068575f, +0.002940f, +0.000700f}, + {-0.191804f, -0.003014f, +0.002724f}, + {+0.067942f, -0.005643f, -0.002245f}, + {+0.068213f, -0.000980f, -0.001053f}, + {-0.030778f, -0.002407f, -0.000036f} + }, + { + {+0.750300f, +0.000058f, -0.000825f}, + {+0.866279f, -0.001749f, -0.003432f}, + {-0.078123f, -0.003921f, +0.005991f}, + {+0.379010f, -0.005518f, +0.002243f}, + {+0.292486f, -0.009941f, +0.001947f}, + {-0.075433f, -0.005336f, +0.005378f}, + {-0.170771f, -0.002341f, -0.003169f}, + {+0.177886f, -0.005886f, -0.000679f}, + {+0.091281f, -0.005785f, +0.001198f}, + {+0.285767f, -0.012433f, +0.005156f}, + {+0.152796f, +0.004962f, -0.005079f}, + {-0.040112f, -0.002644f, -0.001940f}, + {-0.171647f, +0.007661f, -0.004705f}, + {+0.053028f, -0.000873f, -0.001571f}, + {+0.054373f, -0.002064f, +0.001211f}, + {-0.062123f, +0.000837f, +0.004082f} + }, + { + {+0.760695f, +0.000187f, -0.002580f}, + {+0.869383f, +0.005374f, -0.001979f}, + {-0.118984f, -0.003432f, +0.014567f}, + {+0.349914f, +0.003949f, +0.011712f}, + {+0.283867f, +0.008607f, +0.011966f}, + {-0.106829f, -0.003798f, +0.012953f}, + {-0.143863f, +0.007735f, -0.004012f}, + {+0.195900f, +0.004792f, +0.000560f}, + {+0.091845f, +0.002959f, +0.004936f}, + {+0.279043f, +0.006225f, +0.015628f}, + {+0.177000f, -0.001330f, -0.012704f}, + {-0.021476f, +0.006516f, -0.001630f}, + {-0.154239f, +0.000969f, -0.011998f}, + {+0.037152f, +0.007671f, +0.004251f}, + {+0.041126f, +0.001005f, +0.004482f}, + {-0.085797f, -0.005363f, +0.006097f} + } +}; +const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +{ + { + {-0.191323f, +0.550462f, -0.164703f}, + {-0.179339f, +0.105827f, +0.022109f}, + {-0.016317f, +0.069138f, -0.026386f}, + {-0.031302f, +0.044550f, -0.011983f}, + {-0.011873f, -0.049933f, +0.022817f}, + {+0.002100f, -0.025417f, +0.008917f}, + {+0.008673f, +0.072165f, -0.030658f}, + {+0.009984f, -0.046099f, +0.014260f}, + {-0.017932f, +0.200113f, -0.071972f}, + {-0.009948f, -0.076380f, +0.035799f}, + {+0.000500f, +0.013211f, -0.007415f}, + {-0.005467f, -0.017109f, +0.007909f}, + {-0.001381f, -0.024397f, +0.011565f}, + {+0.001735f, -0.017167f, +0.009148f}, + {-0.006994f, -0.015041f, +0.007364f}, + {-0.000274f, +0.004190f, -0.001467f} + }, + { + {-0.330036f, +0.333647f, -0.215680f}, + {-0.446962f, -0.557076f, -0.195252f}, + {-0.017152f, +0.086610f, -0.016060f}, + {-0.053984f, +0.030859f, -0.007361f}, + {-0.031663f, -0.050397f, +0.030580f}, + {+0.013130f, +0.075028f, +0.055072f}, + {+0.035680f, +0.080722f, -0.037346f}, + {+0.011258f, -0.044042f, +0.013548f}, + {+0.004710f, +0.152351f, -0.099878f}, + {-0.054304f, -0.216938f, -0.014289f}, + {+0.014461f, +0.090558f, +0.026436f}, + {-0.019523f, -0.056800f, -0.001967f}, + {-0.012667f, -0.065948f, -0.004877f}, + {-0.011111f, -0.088384f, -0.022179f}, + {-0.018869f, -0.025704f, +0.006997f}, + {+0.000817f, +0.008300f, +0.000651f} + }, + { + {-0.096856f, -0.591788f, +0.084769f}, + {-0.247542f, -1.016515f, -0.073842f}, + {-0.000574f, +0.046908f, -0.004371f}, + {-0.019540f, +0.031177f, -0.013825f}, + {-0.037796f, +0.124420f, -0.041797f}, + {-0.007360f, +0.192733f, +0.007619f}, + {+0.072377f, -0.160383f, +0.061576f}, + {-0.003711f, +0.021943f, -0.004227f}, + {+0.112964f, -0.363004f, +0.093285f}, + {-0.056746f, -0.090813f, -0.072980f}, + {+0.006103f, +0.134417f, +0.008866f}, + {-0.005326f, -0.101653f, +0.016759f}, + {-0.002749f, -0.090650f, +0.006843f}, + {-0.000089f, -0.179843f, +0.016051f}, + {+0.001814f, -0.087437f, +0.037078f}, + {+0.005267f, -0.010738f, +0.007098f} + }, + { + {+0.063555f, -0.411417f, +0.075756f}, + {+0.093014f, -0.372322f, +0.077805f}, + {+0.007107f, +0.054992f, -0.008311f}, + {+0.033886f, +0.080359f, -0.013428f}, + {+0.014436f, +0.207733f, -0.015885f}, + {-0.013408f, +0.128849f, -0.020860f}, + {+0.024255f, -0.374328f, -0.023256f}, + {-0.002134f, +0.023939f, +0.000696f}, + {+0.058983f, -0.666227f, -0.050398f}, + {-0.014357f, -0.059836f, -0.078919f}, + {-0.009066f, +0.055606f, -0.025373f}, + {-0.008234f, -0.193844f, -0.040018f}, + {+0.010778f, -0.088365f, +0.004018f}, + {+0.007190f, -0.141067f, +0.033486f}, + {+0.015950f, -0.182801f, -0.014037f}, + {-0.004549f, -0.103305f, -0.035896f} + }, + { + {+0.019484f, -0.338410f, +0.083536f}, + {+0.202040f, -0.634536f, +0.185332f}, + {+0.007949f, -0.067812f, +0.047529f}, + {+0.048582f, -0.153833f, +0.075433f}, + {+0.054773f, -0.008273f, +0.058696f}, + {+0.024929f, -0.021715f, +0.041866f}, + {-0.026392f, -0.170362f, -0.104628f}, + {+0.014816f, -0.001719f, +0.003760f}, + {-0.050384f, -0.474129f, -0.111890f}, + {+0.050928f, -0.326828f, +0.037272f}, + {-0.005968f, +0.019903f, -0.009428f}, + {-0.002366f, -0.233633f, -0.019586f}, + {+0.014235f, -0.074982f, -0.008001f}, + {-0.003852f, +0.000864f, -0.026540f}, + {+0.024596f, -0.140123f, -0.045292f}, + {+0.007335f, -0.140212f, -0.016737f} + }, + { + {-0.203259f, -0.677311f, +0.036974f}, + {-0.017307f, -0.878070f, +0.170118f}, + {-0.043215f, -0.181813f, +0.012035f}, + {-0.067120f, -0.199982f, +0.078357f}, + {-0.003334f, -0.005382f, +0.060963f}, + {+0.037369f, -0.095076f, +0.002797f}, + {-0.007145f, +0.024172f, -0.016239f}, + {+0.025809f, +0.035193f, +0.010462f}, + {-0.123278f, -0.317455f, +0.005941f}, + {+0.071780f, -0.152842f, +0.115403f}, + {-0.009047f, +0.007435f, -0.015219f}, + {+0.009240f, -0.131025f, +0.037457f}, + {+0.010330f, -0.013791f, +0.019556f}, + {+0.018073f, +0.051639f, -0.007415f}, + {+0.023065f, +0.024816f, +0.028060f}, + {+0.023145f, -0.072535f, +0.012653f} + }, + { + {-0.363585f, -0.196908f, -0.132849f}, + {-0.400794f, +0.061111f, -0.146774f}, + {-0.088996f, -0.035461f, -0.039728f}, + {-0.248102f, +0.210034f, -0.044008f}, + {-0.136603f, +0.269455f, -0.014678f}, + {+0.039867f, -0.056544f, -0.018785f}, + {+0.012335f, -0.061064f, +0.014746f}, + {+0.001640f, +0.021263f, +0.019567f}, + {-0.164395f, -0.120409f, -0.065761f}, + {+0.005008f, +0.124444f, +0.002355f}, + {-0.006089f, -0.036166f, +0.003168f}, + {+0.008972f, -0.027316f, -0.008811f}, + {-0.026456f, +0.074066f, -0.007831f}, + {+0.036264f, -0.025445f, +0.017552f}, + {-0.046783f, +0.110385f, +0.011511f}, + {+0.016634f, -0.063190f, +0.003470f} + }, + { + {-0.140043f, +0.331564f, +0.031879f}, + {-0.418213f, +0.323867f, -0.026950f}, + {-0.066524f, +0.078043f, +0.003209f}, + {-0.275295f, +0.106284f, -0.069212f}, + {-0.205855f, +0.059809f, -0.074823f}, + {+0.024267f, +0.018141f, +0.016347f}, + {+0.021686f, -0.056152f, +0.012278f}, + {-0.065157f, -0.071098f, -0.001681f}, + {-0.025332f, +0.159594f, +0.013561f}, + {-0.029475f, +0.035218f, -0.023811f}, + {-0.011328f, -0.030605f, +0.007685f}, + {+0.054740f, +0.020295f, +0.000302f}, + {-0.047455f, +0.027854f, -0.019731f}, + {+0.022053f, -0.039858f, +0.012679f}, + {-0.116347f, -0.040132f, -0.032026f}, + {-0.007321f, -0.043491f, +0.015668f} + }, + { + {+0.232420f, -0.042183f, +0.090352f}, + {-0.143907f, -0.128870f, +0.081606f}, + {-0.019255f, -0.008481f, +0.025359f}, + {-0.079364f, -0.195197f, +0.009060f}, + {-0.092435f, -0.165349f, -0.007306f}, + {-0.037358f, +0.066958f, +0.009347f}, + {+0.002010f, -0.000201f, -0.007048f}, + {-0.118479f, -0.000141f, -0.016298f}, + {+0.131479f, -0.025371f, +0.046423f}, + {-0.013254f, -0.056073f, +0.007964f}, + {-0.020421f, +0.014051f, -0.008057f}, + {+0.102505f, -0.044999f, +0.012472f}, + {-0.028717f, -0.037569f, +0.002612f}, + {-0.021286f, +0.036718f, -0.008001f}, + {-0.110557f, -0.093273f, -0.012580f}, + {-0.060924f, +0.023756f, -0.000190f} + }, + { + {+0.533983f, -0.079000f, +0.018330f}, + {+0.217748f, -0.012931f, +0.048151f}, + {+0.025802f, -0.036354f, +0.006267f}, + {+0.205140f, +0.060899f, +0.046660f}, + {+0.113290f, +0.081234f, +0.041909f}, + {-0.105415f, -0.030348f, -0.015181f}, + {-0.034112f, -0.007984f, -0.002032f}, + {-0.109019f, +0.032142f, -0.005021f}, + {+0.186112f, -0.090334f, +0.010289f}, + {+0.018376f, -0.004638f, +0.018235f}, + {-0.011521f, +0.024596f, -0.005093f}, + {+0.106685f, -0.043319f, +0.011207f}, + {+0.003719f, +0.002813f, +0.009833f}, + {-0.061529f, +0.014049f, -0.008239f}, + {-0.045872f, +0.041391f, +0.025100f}, + {-0.106073f, -0.025839f, -0.009219f} + }, + { + {+0.689088f, +0.021676f, -0.035498f}, + {+0.512497f, +0.013050f, -0.008139f}, + {+0.080900f, -0.013233f, -0.008488f}, + {+0.415840f, +0.041814f, +0.013996f}, + {+0.278767f, +0.050484f, +0.020716f}, + {-0.124237f, -0.048494f, -0.003541f}, + {-0.083860f, +0.012095f, -0.001839f}, + {-0.040470f, -0.043256f, +0.009440f}, + {+0.127554f, +0.052174f, -0.027560f}, + {+0.038197f, +0.025553f, +0.002386f}, + {+0.013296f, -0.017618f, +0.006802f}, + {+0.049000f, +0.034411f, -0.008434f}, + {+0.023951f, +0.015385f, +0.000397f}, + {-0.079741f, -0.014689f, +0.006056f}, + {+0.015937f, +0.036771f, +0.013501f}, + {-0.116284f, -0.032742f, -0.005608f} + }, + { + {+0.733240f, +0.033897f, -0.028463f}, + {+0.683283f, +0.019108f, -0.024422f}, + {+0.165878f, +0.024612f, -0.005353f}, + {+0.489377f, -0.026929f, -0.018187f}, + {+0.343135f, -0.029846f, -0.016631f}, + {-0.086256f, +0.016816f, +0.014815f}, + {-0.129107f, +0.000075f, +0.000830f}, + {+0.047145f, -0.000801f, +0.008881f}, + {+0.023844f, +0.003992f, -0.023086f}, + {+0.042301f, -0.008336f, -0.009579f}, + {+0.039371f, -0.014019f, +0.003266f}, + {-0.037930f, -0.005491f, -0.006528f}, + {+0.020403f, -0.000483f, -0.004551f}, + {-0.081119f, -0.016241f, +0.003920f}, + {+0.051945f, -0.020771f, -0.013605f}, + {-0.091078f, +0.021518f, +0.009604f} + }, + { + {+0.733114f, -0.029809f, -0.003150f}, + {+0.758988f, -0.025935f, -0.015102f}, + {+0.280906f, -0.031811f, -0.003778f}, + {+0.459117f, +0.008405f, -0.019040f}, + {+0.333055f, -0.004022f, -0.017856f}, + {-0.012149f, +0.009636f, +0.003754f}, + {-0.156853f, +0.003236f, +0.004887f}, + {+0.114968f, +0.002815f, -0.004184f}, + {-0.064559f, -0.023528f, +0.001333f}, + {+0.039134f, -0.015161f, -0.005522f}, + {+0.063282f, -0.001881f, -0.005278f}, + {-0.121057f, +0.006821f, +0.003568f}, + {-0.006828f, +0.002343f, -0.000194f}, + {-0.069156f, -0.009861f, -0.001545f}, + {+0.070362f, -0.029774f, -0.011253f}, + {-0.061366f, +0.013312f, +0.005905f} + }, + { + {+0.724625f, -0.001203f, +0.006316f}, + {+0.787100f, +0.019364f, -0.003117f}, + {+0.401617f, +0.025467f, -0.004330f}, + {+0.392760f, +0.000769f, -0.009132f}, + {+0.296783f, +0.006051f, -0.006244f}, + {+0.080677f, +0.011855f, -0.011409f}, + {-0.155686f, -0.003923f, +0.003032f}, + {+0.152027f, +0.011289f, -0.005772f}, + {-0.122199f, -0.008679f, +0.013528f}, + {+0.032224f, +0.005650f, +0.003051f}, + {+0.086101f, +0.012645f, -0.003029f}, + {-0.171824f, -0.008018f, +0.006233f}, + {-0.049811f, -0.010853f, +0.002128f}, + {-0.046385f, +0.014661f, +0.005149f}, + {+0.075593f, +0.018900f, +0.006819f}, + {-0.042682f, -0.001204f, -0.002701f} + }, + { + {+0.710313f, +0.016351f, +0.000594f}, + {+0.788202f, +0.001698f, +0.001880f}, + {+0.478276f, -0.009988f, -0.006465f}, + {+0.338553f, -0.006580f, +0.000873f}, + {+0.267876f, -0.004181f, +0.000561f}, + {+0.161632f, -0.031504f, -0.010015f}, + {-0.112024f, -0.007981f, -0.001560f}, + {+0.161078f, -0.006395f, +0.000785f}, + {-0.159938f, +0.023767f, +0.006167f}, + {+0.016977f, +0.011649f, +0.002458f}, + {+0.101033f, -0.005466f, +0.000979f}, + {-0.168147f, -0.002987f, +0.004477f}, + {-0.090853f, +0.008103f, +0.002155f}, + {-0.019160f, +0.010061f, +0.003516f}, + {+0.068113f, +0.017356f, +0.008667f}, + {-0.034415f, -0.006094f, -0.000653f} + }, + { + {+0.687296f, -0.010309f, -0.005056f}, + {+0.764260f, -0.015559f, -0.000832f}, + {+0.464886f, -0.002946f, -0.003297f}, + {+0.298384f, -0.012876f, +0.002489f}, + {+0.246598f, -0.005940f, +0.001267f}, + {+0.184060f, +0.014332f, +0.000763f}, + {-0.024137f, +0.022250f, -0.004819f}, + {+0.154151f, -0.010440f, +0.001340f}, + {-0.181725f, -0.011644f, -0.002738f}, + {-0.007528f, -0.010988f, -0.002133f}, + {+0.103221f, -0.002109f, +0.001628f}, + {-0.103776f, +0.007568f, -0.001735f}, + {-0.108578f, +0.000395f, +0.003349f}, + {+0.017935f, -0.001653f, -0.006823f}, + {+0.063247f, -0.018078f, -0.002599f}, + {-0.031929f, -0.003751f, +0.000579f} + }, + { + {+0.659915f, +0.003181f, -0.004789f}, + {+0.723641f, +0.015598f, -0.004701f}, + {+0.344320f, +0.034439f, +0.003396f}, + {+0.252485f, +0.010951f, -0.000869f}, + {+0.213766f, +0.011294f, -0.001229f}, + {+0.112272f, +0.023126f, +0.008479f}, + {+0.086512f, -0.032942f, -0.003959f}, + {+0.151070f, +0.005416f, -0.003241f}, + {-0.183618f, -0.008669f, -0.002985f}, + {-0.037360f, +0.003147f, -0.002379f}, + {+0.095879f, +0.005536f, +0.000670f}, + {+0.009973f, -0.033041f, -0.006312f}, + {-0.086652f, -0.000941f, +0.001227f}, + {+0.070708f, -0.028404f, -0.005854f}, + {+0.082798f, -0.007130f, -0.008870f}, + {-0.024953f, -0.002080f, -0.001188f} + }, + { + {+0.634763f, -0.001208f, -0.002397f}, + {+0.683670f, -0.007693f, -0.006039f}, + {+0.143818f, -0.065248f, +0.001626f}, + {+0.187585f, -0.010607f, +0.001657f}, + {+0.155102f, -0.012347f, -0.000836f}, + {-0.047669f, -0.064360f, +0.004465f}, + {+0.176375f, +0.020282f, -0.000832f}, + {+0.166599f, +0.005868f, -0.005383f}, + {-0.165581f, +0.017111f, +0.003241f}, + {-0.067470f, +0.001639f, +0.002026f}, + {+0.090399f, -0.004464f, -0.000923f}, + {+0.138735f, +0.040116f, -0.001857f}, + {-0.018624f, +0.015969f, -0.003767f}, + {+0.124121f, +0.022397f, +0.003509f}, + {+0.132318f, +0.030070f, -0.004033f}, + {-0.005451f, +0.010583f, +0.000461f} + }, + { + {+0.613639f, +0.002441f, -0.000996f}, + {+0.658994f, -0.004033f, -0.003708f}, + {-0.066781f, +0.052613f, -0.005380f}, + {+0.103141f, +0.024662f, +0.003094f}, + {+0.069224f, +0.020885f, +0.001016f}, + {-0.237901f, +0.057325f, -0.006669f}, + {+0.198251f, +0.008139f, -0.001238f}, + {+0.196297f, -0.014019f, -0.004087f}, + {-0.137085f, -0.006189f, +0.006787f}, + {-0.092626f, +0.005231f, +0.005081f}, + {+0.098805f, +0.001528f, -0.003973f}, + {+0.227978f, -0.011869f, +0.001188f}, + {+0.083502f, -0.031761f, -0.003653f}, + {+0.154304f, +0.003532f, +0.005157f}, + {+0.192731f, -0.026618f, +0.005738f}, + {+0.025619f, -0.008251f, +0.002697f} + }, + { + {+0.592443f, -0.004265f, -0.000675f}, + {+0.651475f, +0.007639f, +0.001077f}, + {-0.211884f, -0.008375f, -0.003618f}, + {+0.015847f, -0.026610f, -0.001288f}, + {-0.030980f, -0.024402f, +0.000682f}, + {-0.377865f, -0.004628f, -0.005328f}, + {+0.127740f, -0.031243f, -0.004692f}, + {+0.216064f, +0.008428f, -0.000840f}, + {-0.107665f, -0.004148f, +0.003207f}, + {-0.104222f, -0.007982f, +0.002781f}, + {+0.121055f, +0.007151f, -0.006643f}, + {+0.232842f, -0.021111f, -0.004010f}, + {+0.181984f, +0.020598f, -0.002112f}, + {+0.154857f, -0.016563f, -0.001311f}, + {+0.234230f, -0.006972f, +0.006138f}, + {+0.062816f, -0.000374f, -0.000261f} + }, + { + {+0.565815f, +0.006621f, -0.000731f}, + {+0.652157f, +0.001839f, +0.002786f}, + {-0.256941f, -0.016709f, +0.005201f}, + {-0.049457f, +0.004802f, -0.002568f}, + {-0.121870f, +0.014390f, +0.001453f}, + {-0.418806f, -0.025565f, +0.008436f}, + {-0.023252f, +0.033441f, -0.003455f}, + {+0.192750f, +0.014454f, -0.000969f}, + {-0.080190f, +0.006138f, -0.004702f}, + {-0.090978f, -0.000288f, -0.001642f}, + {+0.136520f, -0.012063f, -0.004637f}, + {+0.143202f, +0.027531f, -0.007344f}, + {+0.230859f, -0.004544f, -0.002668f}, + {+0.140224f, +0.009293f, -0.007214f}, + {+0.242282f, +0.025199f, -0.006229f}, + {+0.100859f, -0.005416f, -0.004924f} + }, + { + {+0.532337f, -0.007417f, -0.000543f}, + {+0.652955f, -0.010368f, -0.001740f}, + {-0.220699f, +0.013404f, +0.007323f}, + {-0.077945f, +0.013141f, +0.004826f}, + {-0.182039f, -0.009934f, +0.002503f}, + {-0.362601f, +0.019757f, +0.014603f}, + {-0.211924f, -0.030990f, +0.005294f}, + {+0.105625f, -0.028087f, -0.003678f}, + {-0.054535f, +0.015575f, -0.006139f}, + {-0.049202f, +0.015528f, -0.003083f}, + {+0.111395f, +0.002877f, +0.002743f}, + {-0.015299f, -0.023373f, +0.001099f}, + {+0.201870f, -0.009975f, -0.000096f}, + {+0.130715f, +0.012877f, -0.003882f}, + {+0.221564f, -0.009858f, -0.016146f}, + {+0.132494f, +0.017520f, -0.002095f} + }, + { + {+0.495834f, +0.008532f, -0.000369f}, + {+0.652356f, +0.003292f, -0.006811f}, + {-0.149624f, -0.011936f, +0.002662f}, + {-0.071256f, -0.002030f, +0.009341f}, + {-0.200363f, +0.000872f, +0.001071f}, + {-0.238216f, -0.009887f, +0.004541f}, + {-0.381151f, +0.041781f, +0.008291f}, + {-0.039667f, +0.026941f, +0.000063f}, + {-0.036683f, -0.023635f, +0.004916f}, + {+0.009186f, -0.024708f, +0.001260f}, + {+0.023299f, +0.026996f, +0.008496f}, + {-0.194696f, +0.039072f, +0.009744f}, + {+0.098003f, +0.033287f, +0.002536f}, + {+0.131758f, -0.006621f, +0.002658f}, + {+0.173806f, -0.018597f, -0.006932f}, + {+0.145380f, -0.006223f, +0.004430f} + }, + { + {+0.463299f, -0.007155f, -0.000770f}, + {+0.648076f, +0.009295f, -0.004610f}, + {-0.089513f, +0.010398f, +0.000359f}, + {-0.033244f, -0.002975f, +0.003236f}, + {-0.178153f, +0.013477f, +0.001343f}, + {-0.077802f, +0.029144f, -0.007460f}, + {-0.474851f, -0.029171f, -0.001803f}, + {-0.217055f, -0.041281f, +0.004828f}, + {-0.037249f, -0.008239f, +0.011497f}, + {+0.059921f, +0.009759f, +0.005233f}, + {-0.114758f, -0.056676f, +0.002229f}, + {-0.334964f, -0.046076f, +0.002995f}, + {-0.042473f, -0.043913f, -0.000922f}, + {+0.133390f, -0.007415f, +0.001167f}, + {+0.081735f, -0.007332f, +0.010523f}, + {+0.133499f, -0.015420f, +0.003583f} + }, + { + {+0.441203f, +0.002482f, -0.000824f}, + {+0.629545f, -0.003537f, +0.002292f}, + {-0.068500f, -0.000883f, +0.001586f}, + {+0.038519f, -0.014498f, -0.003426f}, + {-0.131180f, -0.015847f, +0.003732f}, + {+0.083693f, -0.047317f, -0.005981f}, + {-0.461803f, -0.022290f, -0.008344f}, + {-0.384732f, +0.037693f, +0.003505f}, + {-0.048144f, +0.029049f, +0.001374f}, + {+0.084768f, +0.008739f, +0.001947f}, + {-0.251499f, +0.035994f, -0.008053f}, + {-0.379916f, +0.000042f, -0.006724f}, + {-0.160178f, +0.020677f, -0.004025f}, + {+0.124411f, +0.010697f, -0.004992f}, + {-0.067302f, +0.056203f, +0.010926f}, + {+0.110573f, +0.015976f, -0.002867f} + }, + { + {+0.430897f, +0.000433f, -0.000350f}, + {+0.586004f, -0.017187f, +0.004129f}, + {-0.087700f, -0.011728f, +0.002208f}, + {+0.139979f, +0.032148f, -0.002572f}, + {-0.080931f, +0.008008f, +0.004145f}, + {+0.204274f, +0.031020f, +0.002988f}, + {-0.365555f, +0.057171f, +0.001535f}, + {-0.496090f, -0.014326f, +0.002762f}, + {-0.036347f, -0.000076f, -0.009610f}, + {+0.087371f, -0.006753f, -0.002953f}, + {-0.332582f, +0.010055f, -0.004412f}, + {-0.314151f, +0.048523f, -0.001669f}, + {-0.210677f, +0.006259f, -0.001554f}, + {+0.097223f, +0.002730f, -0.004153f}, + {-0.243214f, -0.058784f, -0.001131f}, + {+0.100970f, +0.001509f, -0.005827f} + }, + { + {+0.427847f, -0.001191f, +0.000192f}, + {+0.522040f, +0.027328f, -0.001322f}, + {-0.123746f, +0.015960f, -0.000425f}, + {+0.250557f, -0.029225f, +0.001401f}, + {-0.041411f, +0.001671f, +0.000435f}, + {+0.251666f, +0.011713f, +0.002737f}, + {-0.259410f, -0.030558f, +0.013501f}, + {-0.523363f, -0.008886f, +0.005097f}, + {+0.023565f, -0.037779f, -0.005281f}, + {+0.085570f, -0.002595f, -0.003055f}, + {-0.343956f, -0.022947f, +0.008052f}, + {-0.182050f, -0.049717f, +0.010139f}, + {-0.188646f, -0.025113f, +0.004590f}, + {+0.043971f, +0.008025f, +0.002158f}, + {-0.383316f, +0.019159f, -0.004800f}, + {+0.118679f, -0.020135f, -0.001036f} + }, + { + {+0.424775f, -0.001427f, +0.000274f}, + {+0.458547f, -0.013186f, -0.005324f}, + {-0.143005f, -0.001551f, -0.002520f}, + {+0.342091f, +0.013355f, +0.001866f}, + {-0.012473f, +0.005183f, -0.002228f}, + {+0.229007f, -0.024031f, -0.004922f}, + {-0.213143f, -0.021386f, +0.008846f}, + {-0.469349f, +0.018839f, +0.005224f}, + {+0.120107f, +0.037044f, +0.005367f}, + {+0.094940f, +0.009229f, +0.000146f}, + {-0.312164f, +0.002650f, +0.009985f}, + {-0.056636f, +0.008288f, +0.009234f}, + {-0.124730f, +0.013388f, +0.006509f}, + {-0.037461f, -0.023127f, +0.003625f}, + {-0.438903f, +0.013352f, +0.002069f}, + {+0.155431f, +0.012048f, +0.004072f} + }, + { + {+0.415850f, +0.004534f, -0.000668f}, + {+0.414572f, -0.002652f, -0.002367f}, + {-0.124613f, -0.010725f, -0.002281f}, + {+0.397126f, -0.000677f, -0.001120f}, + {+0.014003f, -0.010619f, +0.000267f}, + {+0.170253f, +0.018842f, -0.008960f}, + {-0.241128f, +0.034417f, -0.004698f}, + {-0.359282f, -0.033550f, +0.005250f}, + {+0.216676f, -0.010427f, +0.006057f}, + {+0.120954f, -0.008613f, +0.002469f}, + {-0.268504f, -0.001802f, +0.003587f}, + {+0.013045f, +0.010217f, -0.002327f}, + {-0.059871f, -0.003931f, +0.001188f}, + {-0.132164f, +0.026563f, +0.001240f}, + {-0.403193f, -0.027848f, +0.009266f}, + {+0.190953f, +0.002021f, +0.001187f} + }, + { + {+0.399726f, -0.003989f, -0.001238f}, + {+0.392346f, +0.005321f, +0.003177f}, + {-0.072827f, +0.023138f, +0.000364f}, + {+0.417980f, -0.003176f, -0.003953f}, + {+0.044470f, +0.006065f, +0.002234f}, + {+0.111558f, -0.001243f, -0.006696f}, + {-0.306891f, -0.017879f, -0.010556f}, + {-0.227947f, +0.027747f, +0.006660f}, + {+0.285131f, -0.003545f, -0.002248f}, + {+0.160581f, +0.005372f, +0.001188f}, + {-0.228536f, +0.004194f, +0.000473f}, + {+0.021041f, -0.010096f, -0.009272f}, + {-0.021484f, +0.000358f, -0.003354f}, + {-0.213365f, -0.015260f, -0.000168f}, + {-0.303399f, +0.026027f, +0.011571f}, + {+0.212111f, -0.000447f, -0.003261f} + }, + { + {+0.378407f, +0.003850f, -0.000653f}, + {+0.380175f, +0.007586f, +0.003255f}, + {-0.012127f, -0.017400f, +0.004348f}, + {+0.420589f, +0.000881f, -0.004600f}, + {+0.082045f, -0.000538f, -0.001160f}, + {+0.069379f, -0.007873f, +0.001279f}, + {-0.364957f, -0.009593f, -0.003601f}, + {-0.103978f, -0.012644f, +0.002536f}, + {+0.322327f, -0.004962f, -0.006100f}, + {+0.208381f, -0.007687f, -0.001556f}, + {-0.193755f, -0.004206f, -0.000887f}, + {-0.012722f, -0.002660f, -0.005208f}, + {-0.021028f, +0.002645f, -0.003959f}, + {-0.256559f, +0.000206f, +0.001247f}, + {-0.175255f, -0.013434f, +0.005713f}, + {+0.216424f, -0.004406f, -0.001903f} + }, + { + {+0.355186f, -0.004417f, +0.000047f}, + {+0.367959f, -0.007051f, -0.000589f}, + {+0.030278f, -0.000745f, +0.003677f}, + {+0.419972f, +0.001580f, -0.004098f}, + {+0.126164f, +0.010538f, -0.004622f}, + {+0.036142f, -0.005050f, +0.006483f}, + {-0.395580f, +0.008424f, +0.006868f}, + {+0.004418f, +0.013200f, -0.004102f}, + {+0.338438f, +0.004391f, -0.003969f}, + {+0.257936f, +0.011270f, -0.002562f}, + {-0.157184f, +0.010190f, -0.001022f}, + {-0.066694f, -0.007499f, +0.001955f}, + {-0.058038f, -0.007898f, -0.001836f}, + {-0.252063f, +0.011457f, +0.004218f}, + {-0.038996f, +0.019229f, -0.002930f}, + {+0.207135f, -0.002683f, +0.000920f} + }, + { + {+0.333833f, +0.005141f, -0.000033f}, + {+0.354343f, +0.002376f, -0.001512f}, + {+0.044789f, +0.011943f, -0.002345f}, + {+0.420054f, -0.005203f, -0.002411f}, + {+0.168493f, -0.019086f, -0.001101f}, + {-0.000312f, +0.019974f, +0.002740f}, + {-0.404430f, +0.003854f, +0.008761f}, + {+0.101609f, -0.024344f, -0.004621f}, + {+0.343021f, -0.002003f, -0.002287f}, + {+0.300798f, -0.012232f, -0.000926f}, + {-0.115201f, -0.012523f, +0.000667f}, + {-0.124884f, +0.013322f, +0.003505f}, + {-0.124657f, +0.015080f, +0.000444f}, + {-0.208063f, -0.009838f, +0.004149f}, + {+0.098778f, -0.030234f, -0.005691f}, + {+0.191672f, +0.010274f, -0.000986f} + }, + { + {+0.317651f, -0.003399f, -0.000638f}, + {+0.342009f, -0.000734f, -0.000383f}, + {+0.041234f, -0.003266f, -0.006626f}, + {+0.412818f, +0.000564f, -0.000053f}, + {+0.193269f, +0.005756f, +0.003803f}, + {-0.038455f, -0.012921f, -0.002898f}, + {-0.397973f, -0.006421f, +0.004371f}, + {+0.186407f, +0.018164f, -0.002443f}, + {+0.339213f, -0.001972f, -0.002251f}, + {+0.327935f, +0.003077f, +0.000361f}, + {-0.072360f, +0.008411f, +0.001308f}, + {-0.171731f, -0.013927f, +0.001434f}, + {-0.206591f, -0.018817f, +0.001471f}, + {-0.140714f, +0.015540f, +0.002302f}, + {+0.227639f, +0.031497f, -0.003750f}, + {+0.179263f, -0.004105f, -0.004389f} + }, + { + {+0.307693f, +0.001076f, -0.000945f}, + {+0.334320f, +0.001717f, -0.000049f}, + {+0.033552f, -0.011447f, -0.002121f}, + {+0.387841f, +0.007421f, +0.001088f}, + {+0.192595f, +0.010377f, +0.002843f}, + {-0.067483f, -0.002402f, -0.001682f}, + {-0.373557f, +0.001444f, -0.001449f}, + {+0.251051f, -0.016030f, -0.000496f}, + {+0.323516f, +0.001530f, -0.001658f}, + {+0.335944f, +0.003218f, -0.000567f}, + {-0.034654f, -0.006672f, +0.000906f}, + {-0.193976f, +0.003406f, -0.001146f}, + {-0.284432f, +0.017472f, +0.001142f}, + {-0.067179f, -0.009754f, -0.000138f}, + {+0.329347f, -0.022749f, -0.000471f}, + {+0.172128f, -0.005358f, -0.003493f} + }, + { + {+0.301577f, +0.001184f, -0.000322f}, + {+0.332736f, -0.000666f, -0.000894f}, + {+0.023585f, -0.000609f, +0.003132f}, + {+0.344006f, -0.015803f, +0.000034f}, + {+0.177998f, -0.013137f, -0.002069f}, + {-0.082056f, +0.003433f, +0.002633f}, + {-0.324370f, +0.018955f, -0.002626f}, + {+0.287377f, +0.000225f, -0.000071f}, + {+0.290720f, -0.007672f, -0.000038f}, + {+0.329996f, -0.006498f, -0.002605f}, + {-0.003682f, +0.004563f, +0.000624f}, + {-0.185737f, +0.009876f, -0.000494f}, + {-0.338831f, -0.008465f, +0.000490f}, + {-0.000651f, +0.014424f, -0.001842f}, + {+0.385445f, -0.000494f, -0.001075f}, + {+0.160154f, +0.003230f, +0.000530f} + }, + { + {+0.294359f, +0.001008f, +0.000587f}, + {+0.335716f, -0.002537f, -0.000929f}, + {+0.006697f, +0.010781f, +0.001057f}, + {+0.292769f, +0.014442f, -0.002216f}, + {+0.173218f, -0.002305f, -0.004071f}, + {-0.084637f, +0.001890f, +0.003059f}, + {-0.253587f, -0.025906f, +0.002221f}, + {+0.295508f, +0.003624f, -0.001780f}, + {+0.240102f, +0.014422f, -0.000050f}, + {+0.320004f, -0.000226f, -0.002968f}, + {+0.025595f, -0.006552f, +0.001052f}, + {-0.154653f, -0.014381f, +0.002635f}, + {-0.357893f, -0.004680f, +0.001836f}, + {+0.050259f, -0.009177f, -0.001013f}, + {+0.390921f, +0.011091f, -0.005488f}, + {+0.128396f, +0.010797f, +0.002030f} + }, + { + {+0.281980f, -0.004479f, +0.000473f}, + {+0.338235f, +0.000938f, -0.000317f}, + {-0.016443f, -0.008216f, -0.002310f}, + {+0.250822f, -0.005381f, -0.002547f}, + {+0.194113f, +0.011993f, -0.002133f}, + {-0.078814f, -0.001480f, +0.000683f}, + {-0.178794f, +0.013791f, +0.004329f}, + {+0.286440f, -0.008258f, -0.003815f}, + {+0.180165f, -0.014312f, -0.000718f}, + {+0.312559f, +0.001222f, -0.001335f}, + {+0.061211f, +0.002642f, -0.000385f}, + {-0.117426f, +0.006897f, +0.004033f}, + {-0.342706f, +0.010139f, +0.004471f}, + {+0.079430f, +0.002660f, -0.001268f}, + {+0.356398f, -0.011250f, -0.007640f}, + {+0.072072f, -0.018003f, +0.000575f} + }, + { + {+0.264584f, +0.006225f, -0.000553f}, + {+0.334355f, +0.002104f, -0.000390f}, + {-0.041411f, +0.000660f, -0.001379f}, + {+0.227742f, -0.002231f, -0.000499f}, + {+0.236723f, -0.015277f, -0.000143f}, + {-0.066692f, -0.002089f, -0.000940f}, + {-0.116641f, -0.003621f, +0.000856f}, + {+0.274189f, -0.002260f, -0.003775f}, + {+0.124476f, +0.010538f, -0.000672f}, + {+0.307116f, -0.000375f, -0.000391f}, + {+0.109323f, -0.010339f, -0.003218f}, + {-0.087624f, +0.002282f, +0.001095f}, + {-0.305220f, -0.004246f, +0.003226f}, + {+0.088209f, -0.001890f, -0.000514f}, + {+0.297714f, +0.002109f, -0.002943f}, + {+0.002305f, +0.018254f, -0.000698f} + }, + { + {+0.245860f, -0.004071f, -0.001278f}, + {+0.320735f, -0.004451f, -0.000718f}, + {-0.064973f, -0.003268f, +0.001022f}, + {+0.221237f, +0.003408f, +0.001969f}, + {+0.282979f, +0.012181f, +0.001619f}, + {-0.050139f, +0.005534f, -0.000714f}, + {-0.071497f, +0.004571f, -0.002571f}, + {+0.265456f, +0.000937f, -0.001591f}, + {+0.084560f, -0.004757f, +0.000011f}, + {+0.300229f, -0.001315f, +0.000134f}, + {+0.168137f, +0.018612f, -0.002406f}, + {-0.066781f, +0.001637f, -0.001882f}, + {-0.257378f, +0.011005f, +0.000980f}, + {+0.083095f, -0.005045f, -0.000085f}, + {+0.224972f, -0.016565f, +0.001685f}, + {-0.061472f, -0.012660f, -0.001272f} + }, + { + {+0.229589f, +0.000720f, -0.000554f}, + {+0.297388f, +0.006061f, -0.000830f}, + {-0.086308f, +0.008311f, -0.000100f}, + {+0.220891f, +0.005343f, +0.000760f}, + {+0.312804f, +0.002048f, +0.000535f}, + {-0.033600f, -0.001954f, -0.000821f}, + {-0.037726f, -0.009547f, -0.001800f}, + {+0.256770f, -0.001354f, -0.000172f}, + {+0.064615f, +0.001499f, +0.000378f}, + {+0.288880f, +0.006082f, -0.000716f}, + {+0.223988f, -0.015499f, +0.000654f}, + {-0.048524f, -0.007439f, -0.000777f}, + {-0.208116f, -0.011040f, +0.001557f}, + {+0.074335f, +0.004704f, -0.001723f}, + {+0.146222f, +0.020815f, +0.000166f}, + {-0.103517f, +0.003200f, -0.000724f} + }, + { + {+0.216659f, -0.000775f, +0.000774f}, + {+0.266859f, -0.007292f, -0.000934f}, + {-0.105304f, -0.004788f, -0.002437f}, + {+0.217403f, -0.003973f, -0.002583f}, + {+0.318044f, -0.007929f, -0.003539f}, + {-0.023696f, +0.000702f, -0.001989f}, + {-0.008068f, +0.006711f, +0.000114f}, + {+0.242367f, -0.004361f, +0.000832f}, + {+0.061343f, +0.003214f, +0.000949f}, + {+0.273736f, -0.004941f, -0.002356f}, + {+0.260361f, +0.001261f, +0.000909f}, + {-0.027365f, +0.006696f, +0.001482f}, + {-0.163814f, +0.008052f, +0.001931f}, + {+0.071141f, -0.000562f, -0.003221f}, + {+0.073591f, -0.015255f, -0.001489f}, + {-0.121162f, +0.004631f, +0.001675f} + }, + { + {+0.205784f, +0.003757f, +0.000700f}, + {+0.232994f, +0.005953f, -0.000561f}, + {-0.123682f, -0.003377f, -0.000485f}, + {+0.205753f, -0.000981f, -0.002067f}, + {+0.304943f, +0.001966f, -0.004525f}, + {-0.026104f, -0.002420f, -0.000748f}, + {+0.021981f, -0.003022f, -0.000957f}, + {+0.220204f, +0.009944f, -0.000624f}, + {+0.066717f, -0.001208f, +0.001408f}, + {+0.258003f, -0.000477f, -0.001518f}, + {+0.270472f, +0.007879f, -0.002698f}, + {-0.001424f, -0.001591f, +0.000485f}, + {-0.125885f, -0.003310f, +0.000529f}, + {+0.074527f, -0.008121f, -0.001699f}, + {+0.017069f, +0.005535f, -0.000272f}, + {-0.124829f, -0.001926f, +0.003798f} + }, + { + {+0.196417f, -0.003644f, -0.000603f}, + {+0.199207f, -0.006086f, +0.000295f}, + {-0.146052f, -0.001687f, +0.003740f}, + {+0.182052f, -0.002076f, +0.001266f}, + {+0.282909f, +0.000690f, -0.001105f}, + {-0.044152f, -0.004210f, +0.001817f}, + {+0.054138f, +0.007409f, -0.002335f}, + {+0.196668f, -0.006189f, -0.002331f}, + {+0.072925f, -0.001260f, +0.000239f}, + {+0.242629f, -0.000541f, +0.000943f}, + {+0.260897f, -0.003994f, -0.004883f}, + {+0.029070f, +0.005485f, -0.001962f}, + {-0.092855f, +0.004046f, -0.001954f}, + {+0.076259f, +0.005415f, +0.002510f}, + {-0.019261f, -0.001366f, +0.002709f}, + {-0.127606f, -0.004435f, +0.002949f} + }, + { + {+0.189173f, +0.000560f, -0.001059f}, + {+0.167547f, +0.008258f, -0.000141f}, + {-0.174715f, +0.013815f, +0.002907f}, + {+0.145627f, +0.012083f, +0.002087f}, + {+0.256566f, +0.006772f, +0.000776f}, + {-0.075271f, +0.013763f, +0.000701f}, + {+0.085309f, -0.009140f, -0.001366f}, + {+0.180099f, +0.000959f, -0.002178f}, + {+0.077061f, -0.000891f, -0.000372f}, + {+0.225986f, +0.007128f, +0.000680f}, + {+0.242442f, +0.000129f, -0.003190f}, + {+0.061120f, -0.011120f, -0.001079f}, + {-0.062759f, -0.011288f, -0.001129f}, + {+0.065406f, +0.009942f, +0.002436f}, + {-0.038027f, +0.005472f, +0.002780f}, + {-0.134062f, +0.004375f, +0.001136f} + }, + { + {+0.183656f, +0.000923f, -0.000164f}, + {+0.139835f, -0.005429f, -0.001020f}, + {-0.202643f, -0.008873f, -0.000639f}, + {+0.102603f, -0.014782f, -0.000700f}, + {+0.227902f, -0.008291f, -0.000524f}, + {-0.108562f, -0.007847f, -0.001593f}, + {+0.108523f, +0.004720f, -0.000054f}, + {+0.172882f, +0.003322f, -0.000542f}, + {+0.078483f, -0.001260f, -0.000596f}, + {+0.207608f, -0.004999f, -0.001085f}, + {+0.221842f, -0.000718f, -0.000351f}, + {+0.087045f, +0.004787f, +0.000547f}, + {-0.037398f, +0.005336f, +0.001064f}, + {+0.041563f, -0.010757f, -0.000998f}, + {-0.043387f, -0.001956f, +0.000527f}, + {-0.140276f, -0.003188f, -0.000142f} + }, + { + {+0.177711f, +0.001442f, +0.000461f}, + {+0.115859f, +0.004532f, -0.001235f}, + {-0.218668f, -0.005427f, +0.000911f}, + {+0.063962f, +0.003468f, -0.001219f}, + {+0.198372f, +0.004393f, -0.000814f}, + {-0.132046f, -0.004112f, +0.000882f}, + {+0.118012f, +0.003780f, -0.001160f}, + {+0.169530f, -0.000759f, +0.000923f}, + {+0.077288f, -0.001422f, -0.000499f}, + {+0.187625f, -0.000022f, -0.000030f}, + {+0.200958f, +0.007075f, +0.000014f}, + {+0.099701f, +0.002974f, -0.000910f}, + {-0.019722f, +0.003866f, -0.001104f}, + {+0.014166f, +0.005774f, -0.002177f}, + {-0.039277f, -0.003862f, +0.000381f}, + {-0.138918f, -0.005302f, +0.000608f} + }, + { + {+0.169075f, -0.003877f, -0.000219f}, + {+0.092373f, -0.003200f, -0.000934f}, + {-0.217383f, +0.010383f, +0.006743f}, + {+0.037373f, +0.004176f, +0.003172f}, + {+0.168763f, -0.000238f, +0.001996f}, + {-0.140535f, +0.007256f, +0.006564f}, + {+0.113037f, -0.005040f, -0.003602f}, + {+0.161555f, -0.002184f, +0.001327f}, + {+0.073875f, +0.002628f, +0.001536f}, + {+0.165667f, +0.001239f, +0.003853f}, + {+0.179435f, -0.009646f, -0.002896f}, + {+0.097770f, -0.003616f, -0.003027f}, + {-0.009431f, -0.004981f, -0.006157f}, + {-0.008081f, +0.000345f, -0.000806f}, + {-0.031139f, +0.005138f, +0.002262f}, + {-0.125572f, +0.007103f, +0.003194f} + }, + { + {+0.156703f, +0.003123f, -0.000930f}, + {+0.066141f, +0.001589f, +0.001238f}, + {-0.199134f, -0.002236f, +0.009123f}, + {+0.024449f, +0.000091f, +0.006919f}, + {+0.141646f, +0.003103f, +0.005668f}, + {-0.133486f, +0.000744f, +0.008630f}, + {+0.097019f, -0.000327f, -0.002792f}, + {+0.144791f, +0.002980f, +0.002476f}, + {+0.068698f, +0.001637f, +0.003084f}, + {+0.144321f, +0.006179f, +0.006251f}, + {+0.155892f, +0.002625f, -0.004264f}, + {+0.084319f, +0.000388f, -0.002288f}, + {-0.006549f, -0.002981f, -0.008326f}, + {-0.021606f, -0.003867f, +0.002491f}, + {-0.023191f, -0.001810f, +0.003729f}, + {-0.101442f, -0.001244f, +0.002402f} + }, + { + {+0.140100f, -0.000742f, +0.000187f}, + {+0.036425f, -0.005652f, +0.004036f}, + {-0.165186f, -0.002894f, +0.004265f}, + {+0.025616f, -0.008625f, +0.004162f}, + {+0.121725f, -0.015558f, +0.002974f}, + {-0.111098f, -0.006811f, +0.003090f}, + {+0.072921f, -0.001667f, +0.000669f}, + {+0.120893f, -0.005073f, +0.004382f}, + {+0.065161f, -0.005346f, +0.001749f}, + {+0.129726f, -0.017304f, +0.000877f}, + {+0.126372f, +0.005082f, +0.000663f}, + {+0.063630f, -0.002788f, +0.000025f}, + {-0.013562f, +0.008476f, -0.004178f}, + {-0.027532f, -0.002871f, +0.003910f}, + {-0.014651f, +0.000004f, +0.003901f}, + {-0.068381f, +0.002931f, -0.001605f} + } +}; +const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +{ + { + {+0.353305f, +0.566845f, +0.200116f}, + {-0.451504f, +0.563006f, -0.083565f}, + {+0.022092f, +0.111945f, -0.003135f}, + {+0.047133f, +0.000194f, -0.000386f}, + {-0.039375f, +0.036049f, +0.015307f}, + {-0.013502f, +0.004406f, -0.016833f}, + {-0.050267f, +0.058356f, +0.017434f}, + {-0.013681f, +0.080836f, -0.019699f}, + {-0.037136f, +0.024371f, +0.052200f}, + {-0.050122f, +0.078803f, +0.019790f}, + {+0.004565f, -0.007656f, +0.001338f}, + {-0.009821f, +0.051585f, +0.003219f}, + {-0.003833f, -0.023411f, -0.003160f}, + {+0.007736f, -0.042621f, +0.010291f}, + {+0.014210f, -0.003392f, -0.001270f}, + {-0.005609f, +0.001063f, +0.001854f} + }, + { + {+0.011160f, -0.509237f, -0.132176f}, + {-0.142996f, +0.819544f, -0.093135f}, + {+0.003358f, +0.077333f, -0.008548f}, + {+0.004495f, +0.024167f, +0.025614f}, + {-0.020911f, -0.057490f, -0.024558f}, + {-0.020938f, -0.024631f, -0.022840f}, + {-0.049990f, -0.113634f, -0.053590f}, + {+0.010020f, +0.210234f, +0.026992f}, + {-0.094579f, -0.407023f, -0.103353f}, + {-0.038956f, -0.088489f, -0.058039f}, + {-0.002875f, -0.015645f, +0.000778f}, + {-0.020714f, -0.104784f, -0.070444f}, + {-0.008794f, +0.002924f, +0.009615f}, + {+0.004361f, -0.056762f, +0.007070f}, + {+0.010128f, +0.073116f, +0.035032f}, + {-0.005641f, -0.006012f, -0.000245f} + }, + { + {-0.192410f, -0.206164f, -0.191132f}, + {+0.278956f, -0.236216f, +0.253095f}, + {-0.002616f, +0.068222f, +0.000710f}, + {-0.043976f, +0.107663f, +0.006000f}, + {+0.022830f, -0.121862f, -0.008267f}, + {-0.007646f, -0.104913f, +0.016048f}, + {+0.008805f, -0.278895f, +0.005919f}, + {+0.015200f, +0.180293f, +0.037960f}, + {-0.037987f, -0.531186f, -0.053722f}, + {+0.053411f, -0.405963f, +0.066106f}, + {-0.004225f, -0.049392f, +0.020098f}, + {+0.032849f, -0.404382f, +0.057080f}, + {-0.020343f, +0.025697f, +0.003018f}, + {+0.000399f, -0.049237f, +0.005564f}, + {-0.018895f, +0.170897f, -0.004768f}, + {-0.014229f, +0.049740f, -0.026663f} + }, + { + {-0.062917f, +0.511673f, +0.062418f}, + {+0.164174f, -1.090974f, -0.108397f}, + {+0.009127f, +0.065188f, -0.003083f}, + {-0.018593f, +0.081738f, -0.000771f}, + {+0.020686f, -0.093603f, -0.012011f}, + {-0.000826f, -0.118498f, +0.001498f}, + {+0.025996f, -0.307659f, -0.023797f}, + {-0.008194f, +0.054598f, -0.009722f}, + {+0.040351f, -0.445888f, -0.056326f}, + {+0.030847f, -0.708631f, -0.081623f}, + {-0.002063f, -0.033938f, +0.025075f}, + {+0.027403f, -0.458795f, +0.033429f}, + {-0.021373f, -0.007009f, -0.010388f}, + {-0.002090f, -0.031407f, +0.008158f}, + {-0.028475f, +0.071069f, -0.046847f}, + {-0.007602f, +0.116385f, +0.002531f} + }, + { + {+0.114739f, +0.069536f, +0.170911f}, + {-0.106068f, -0.653946f, -0.186091f}, + {+0.032435f, +0.023922f, +0.003440f}, + {+0.048701f, +0.139999f, -0.053329f}, + {-0.008680f, -0.251941f, +0.071200f}, + {+0.004397f, -0.120323f, -0.000310f}, + {+0.025654f, -0.324361f, -0.006461f}, + {-0.004810f, +0.061858f, -0.007597f}, + {+0.097919f, -0.641143f, +0.015289f}, + {-0.011357f, -0.557580f, -0.143138f}, + {-0.004726f, +0.016709f, -0.000434f}, + {-0.013229f, -0.166606f, -0.093126f}, + {-0.007411f, +0.011792f, -0.021547f}, + {-0.005396f, -0.034575f, +0.011453f}, + {+0.010644f, +0.011719f, -0.021909f}, + {+0.005419f, +0.030988f, +0.043631f} + }, + { + {+0.066623f, -0.089947f, +0.096291f}, + {-0.228582f, -0.462839f, -0.023355f}, + {+0.030597f, +0.055459f, +0.010541f}, + {+0.104887f, +0.337465f, -0.003674f}, + {-0.072691f, -0.405228f, +0.038864f}, + {-0.004864f, -0.081470f, +0.022241f}, + {+0.026067f, -0.215427f, +0.055659f}, + {+0.015556f, +0.034465f, -0.026853f}, + {+0.081559f, -0.329728f, +0.167841f}, + {-0.004434f, -0.224966f, +0.027520f}, + {-0.000854f, +0.017986f, -0.001169f}, + {+0.017103f, -0.022207f, -0.026879f}, + {+0.016949f, +0.070641f, -0.004353f}, + {-0.006585f, -0.086138f, -0.004695f}, + {+0.059412f, +0.107209f, +0.004895f}, + {+0.005676f, -0.059162f, +0.003180f} + }, + { + {-0.248577f, +0.462186f, -0.044825f}, + {-0.092220f, -0.576619f, -0.031483f}, + {-0.018552f, +0.118241f, -0.000190f}, + {+0.024038f, +0.192235f, +0.076006f}, + {-0.073463f, -0.111697f, -0.085309f}, + {-0.045418f, -0.052428f, +0.014128f}, + {+0.004341f, -0.088144f, -0.002830f}, + {+0.058183f, -0.067481f, +0.003537f}, + {-0.112838f, +0.181474f, -0.013812f}, + {-0.051144f, -0.057123f, -0.036471f}, + {+0.002310f, +0.009489f, +0.002928f}, + {+0.036815f, -0.070367f, -0.013190f}, + {+0.025238f, +0.001933f, +0.022381f}, + {+0.011799f, -0.070089f, -0.017261f}, + {+0.079383f, -0.005050f, +0.042259f}, + {+0.027513f, -0.031781f, -0.014727f} + }, + { + {-0.588729f, +0.069942f, -0.118192f}, + {+0.336864f, +0.087523f, +0.133178f}, + {-0.091818f, +0.000222f, -0.031435f}, + {-0.240072f, -0.209090f, -0.026656f}, + {+0.106536f, +0.210008f, +0.006949f}, + {-0.086566f, -0.077574f, +0.013942f}, + {+0.036640f, -0.012230f, +0.021355f}, + {+0.059977f, -0.024737f, +0.017673f}, + {-0.214469f, +0.026100f, -0.046140f}, + {-0.016107f, +0.082852f, +0.011968f}, + {+0.003608f, -0.021470f, -0.008749f}, + {+0.046323f, +0.010871f, +0.015628f}, + {-0.008214f, -0.079699f, -0.002987f}, + {+0.052373f, +0.029312f, +0.014086f}, + {+0.018742f, -0.113603f, +0.010455f}, + {+0.059520f, +0.032936f, +0.004294f} + }, + { + {-0.672439f, -0.199370f, +0.003424f}, + {+0.631922f, +0.138094f, +0.043549f}, + {-0.130748f, -0.058055f, -0.001266f}, + {-0.452933f, -0.003480f, -0.056408f}, + {+0.285057f, -0.030036f, +0.056968f}, + {-0.110275f, +0.011467f, -0.016793f}, + {+0.065972f, +0.005614f, +0.004420f}, + {-0.003151f, +0.047883f, +0.002061f}, + {-0.163084f, -0.130815f, +0.001810f}, + {+0.019555f, +0.025290f, +0.023258f}, + {+0.018781f, -0.034389f, -0.006142f}, + {+0.002509f, +0.046479f, +0.009162f}, + {-0.041047f, -0.024011f, -0.016940f}, + {+0.065623f, +0.027310f, +0.010505f}, + {-0.073560f, +0.039971f, -0.029159f}, + {+0.062876f, +0.006797f, +0.012019f} + }, + { + {-0.543455f, +0.059523f, +0.064094f}, + {+0.700107f, -0.080270f, -0.041520f}, + {-0.154990f, -0.009275f, +0.018360f}, + {-0.474326f, +0.126377f, -0.003035f}, + {+0.327360f, -0.114048f, +0.014833f}, + {-0.071241f, +0.058994f, -0.004572f}, + {+0.087784f, +0.000125f, -0.001107f}, + {-0.094160f, -0.038960f, -0.011917f}, + {-0.019089f, +0.055284f, +0.038765f}, + {+0.023647f, -0.039958f, -0.003588f}, + {+0.043021f, +0.013443f, +0.008032f}, + {-0.077825f, -0.044990f, -0.010103f}, + {-0.040861f, +0.021619f, +0.002193f}, + {+0.044745f, -0.030859f, -0.007951f}, + {-0.123807f, +0.055927f, -0.012492f}, + {+0.025663f, -0.034745f, +0.003611f} + }, + { + {-0.336060f, +0.028886f, +0.031505f}, + {+0.587287f, +0.009083f, -0.042775f}, + {-0.182505f, +0.025753f, +0.007772f}, + {-0.327915f, -0.064183f, +0.035026f}, + {+0.233666f, +0.067260f, -0.031214f}, + {+0.007323f, -0.030500f, +0.014877f}, + {+0.086165f, +0.005866f, -0.002682f}, + {-0.157983f, -0.017671f, -0.007972f}, + {+0.103610f, +0.038997f, +0.019660f}, + {+0.007681f, +0.004657f, -0.015128f}, + {+0.055812f, +0.017923f, +0.003300f}, + {-0.143968f, -0.013845f, -0.008347f}, + {-0.017716f, -0.004963f, +0.006287f}, + {+0.008786f, -0.012160f, -0.007210f}, + {-0.121102f, -0.034578f, +0.019391f}, + {-0.032193f, +0.031317f, -0.010154f} + }, + { + {-0.153248f, -0.008370f, -0.009310f}, + {+0.402033f, -0.000118f, -0.012937f}, + {-0.199763f, -0.006595f, +0.001228f}, + {-0.128842f, +0.004526f, +0.020419f}, + {+0.092842f, +0.010605f, -0.021993f}, + {+0.077909f, -0.025349f, +0.002895f}, + {+0.057392f, -0.008479f, -0.003710f}, + {-0.165419f, +0.022789f, +0.007822f}, + {+0.148908f, -0.037324f, -0.013709f}, + {-0.011296f, +0.018097f, -0.005621f}, + {+0.055136f, -0.008613f, -0.006635f}, + {-0.160576f, +0.015557f, +0.006131f}, + {+0.014844f, -0.003364f, +0.000064f}, + {-0.027453f, -0.001660f, +0.003786f}, + {-0.097934f, -0.032125f, +0.013700f}, + {-0.074549f, +0.020854f, -0.006292f} + }, + { + {-0.021458f, -0.031294f, -0.015786f}, + {+0.225566f, +0.016671f, +0.005476f}, + {-0.179128f, -0.006436f, +0.000989f}, + {+0.030888f, -0.004116f, -0.001010f}, + {-0.023526f, -0.004404f, +0.002301f}, + {+0.113727f, +0.001584f, -0.014207f}, + {+0.006187f, +0.003628f, -0.000322f}, + {-0.130415f, +0.000132f, +0.008388f}, + {+0.133114f, -0.001415f, -0.020106f}, + {-0.026233f, -0.006894f, +0.005590f}, + {+0.046982f, -0.011852f, -0.003518f}, + {-0.124161f, -0.003790f, +0.005992f}, + {+0.039303f, -0.005121f, -0.003574f}, + {-0.061746f, +0.020157f, -0.000385f}, + {-0.073801f, +0.016410f, -0.009153f}, + {-0.089034f, -0.008662f, +0.006612f} + }, + { + {+0.079072f, +0.039673f, -0.003004f}, + {+0.077618f, -0.033045f, +0.007328f}, + {-0.090967f, +0.027848f, +0.000971f}, + {+0.121511f, -0.002007f, -0.010039f}, + {-0.095609f, -0.005944f, +0.008880f}, + {+0.100415f, +0.015820f, -0.006869f}, + {-0.060544f, -0.012856f, +0.004470f}, + {-0.077695f, +0.001667f, -0.001003f}, + {+0.092912f, +0.018201f, -0.005273f}, + {-0.040823f, -0.014455f, +0.004325f}, + {+0.030102f, -0.002197f, +0.002719f}, + {-0.043620f, +0.016980f, +0.000122f}, + {+0.041014f, +0.001499f, -0.001303f}, + {-0.088431f, +0.009078f, -0.001327f}, + {-0.051030f, +0.024992f, -0.008833f}, + {-0.091055f, -0.011437f, +0.003728f} + }, + { + {+0.165755f, -0.020564f, +0.004876f}, + {-0.050384f, +0.037239f, +0.000994f}, + {+0.070084f, -0.036144f, -0.001750f}, + {+0.168503f, -0.016906f, -0.008961f}, + {-0.141507f, +0.014408f, +0.005947f}, + {+0.022796f, +0.010807f, +0.007047f}, + {-0.126569f, +0.016739f, +0.005274f}, + {-0.026827f, -0.017151f, -0.002196f}, + {+0.045512f, +0.004295f, +0.005991f}, + {-0.054896f, +0.008311f, -0.001754f}, + {+0.003645f, +0.010307f, +0.002009f}, + {+0.057176f, -0.014805f, -0.004774f}, + {+0.011072f, +0.010642f, -0.000248f}, + {-0.108885f, -0.004650f, +0.007771f}, + {-0.039664f, -0.018793f, +0.005550f}, + {-0.092338f, -0.000767f, -0.000795f} + }, + { + {+0.239774f, +0.007034f, +0.002631f}, + {-0.158490f, -0.023748f, -0.003698f}, + {+0.270403f, +0.044381f, -0.006888f}, + {+0.208319f, +0.016522f, -0.001863f}, + {-0.188853f, -0.017009f, +0.001321f}, + {-0.109689f, -0.039932f, +0.010880f}, + {-0.162224f, -0.011965f, +0.002284f}, + {+0.008275f, +0.010941f, +0.003208f}, + {-0.008632f, -0.022468f, +0.003767f}, + {-0.062087f, +0.004201f, -0.001503f}, + {-0.024938f, -0.010189f, -0.000489f}, + {+0.144572f, +0.021004f, -0.007356f}, + {-0.046268f, -0.010126f, +0.001327f}, + {-0.126844f, -0.020412f, +0.005586f}, + {-0.049688f, -0.012221f, +0.009513f}, + {-0.100800f, -0.001133f, +0.001097f} + }, + { + {+0.298828f, -0.005793f, -0.001373f}, + {-0.237768f, +0.008765f, -0.003046f}, + {+0.449357f, -0.047352f, -0.004642f}, + {+0.250753f, -0.004865f, -0.001957f}, + {-0.245484f, +0.010819f, +0.000881f}, + {-0.249706f, +0.049408f, +0.003961f}, + {-0.136738f, -0.008753f, -0.001855f}, + {+0.025853f, +0.003385f, +0.004139f}, + {-0.065934f, +0.022501f, -0.003288f}, + {-0.057527f, -0.008394f, +0.002717f}, + {-0.046206f, +0.004855f, -0.002123f}, + {+0.183725f, -0.015903f, -0.001405f}, + {-0.114051f, +0.012348f, +0.005264f}, + {-0.129436f, +0.010088f, -0.004805f}, + {-0.071460f, +0.022939f, +0.001488f}, + {-0.119149f, +0.009223f, +0.000555f} + }, + { + {+0.346011f, +0.008343f, -0.002521f}, + {-0.286535f, +0.000576f, +0.000480f}, + {+0.541635f, +0.014116f, +0.002290f}, + {+0.286228f, +0.009795f, -0.003869f}, + {-0.299965f, -0.009735f, +0.003167f}, + {-0.328736f, -0.018968f, -0.006082f}, + {-0.037520f, +0.034439f, -0.002184f}, + {+0.042204f, -0.003541f, +0.000630f}, + {-0.115659f, -0.004656f, -0.004969f}, + {-0.039051f, +0.003041f, +0.004257f}, + {-0.056424f, -0.001120f, -0.003167f}, + {+0.144869f, -0.019123f, +0.003415f}, + {-0.166286f, -0.018086f, +0.003983f}, + {-0.101679f, +0.021538f, -0.005021f}, + {-0.078280f, -0.006671f, -0.006794f}, + {-0.140047f, -0.004747f, -0.001252f} + }, + { + {+0.388388f, -0.009881f, -0.001847f}, + {-0.316128f, +0.000090f, +0.004009f}, + {+0.513290f, +0.035603f, +0.000300f}, + {+0.296513f, -0.005786f, -0.000267f}, + {-0.333378f, +0.007221f, +0.002877f}, + {-0.295424f, -0.041070f, -0.003600f}, + {+0.114311f, -0.042170f, +0.000214f}, + {+0.081378f, -0.006284f, -0.003240f}, + {-0.150267f, -0.005614f, +0.000485f}, + {-0.005390f, -0.000214f, +0.000390f}, + {-0.064645f, -0.002835f, -0.002892f}, + {+0.026756f, +0.044985f, -0.000392f}, + {-0.170480f, -0.001979f, -0.000156f}, + {-0.050780f, -0.025790f, +0.003317f}, + {-0.047515f, -0.026029f, -0.004739f}, + {-0.153995f, -0.004894f, +0.001183f} + }, + { + {+0.430636f, +0.009808f, -0.001195f}, + {-0.343293f, -0.010478f, +0.003913f}, + {+0.388765f, -0.049553f, -0.008265f}, + {+0.266407f, -0.016789f, +0.000864f}, + {-0.328141f, +0.007654f, +0.002512f}, + {-0.155445f, +0.060858f, +0.009380f}, + {+0.269010f, +0.026881f, -0.000978f}, + {+0.158656f, +0.025362f, -0.003743f}, + {-0.171832f, +0.002756f, +0.006554f}, + {+0.043647f, +0.009482f, -0.003918f}, + {-0.090667f, +0.001476f, +0.001048f}, + {-0.132548f, -0.036105f, -0.003022f}, + {-0.106351f, +0.024154f, -0.000421f}, + {-0.000521f, +0.009705f, +0.007542f}, + {+0.019829f, +0.036619f, +0.006700f}, + {-0.155900f, +0.002824f, +0.004883f} + }, + { + {+0.471455f, -0.008296f, -0.001200f}, + {-0.377731f, +0.016768f, -0.000590f}, + {+0.234888f, +0.026343f, -0.008776f}, + {+0.198215f, +0.029257f, -0.004797f}, + {-0.279113f, -0.015431f, +0.003236f}, + {+0.033581f, -0.032760f, +0.011351f}, + {+0.370767f, -0.006318f, -0.006828f}, + {+0.266209f, -0.029783f, -0.001410f}, + {-0.185419f, +0.012636f, +0.005498f}, + {+0.100533f, -0.019010f, -0.003209f}, + {-0.151097f, +0.010446f, +0.007094f}, + {-0.274631f, +0.012724f, +0.003901f}, + {+0.013966f, -0.029859f, -0.001195f}, + {+0.031705f, +0.010192f, +0.002683f}, + {+0.102880f, -0.011055f, +0.011106f}, + {-0.143777f, +0.006427f, +0.002026f} + }, + { + {+0.505485f, +0.006321f, -0.001405f}, + {-0.419164f, -0.009705f, -0.004024f}, + {+0.115231f, -0.006245f, -0.000430f}, + {+0.110599f, -0.013787f, -0.006578f}, + {-0.197526f, +0.015552f, +0.000736f}, + {+0.208411f, +0.008219f, -0.002566f}, + {+0.381442f, -0.001142f, -0.007728f}, + {+0.371664f, +0.016115f, -0.002975f}, + {-0.191819f, -0.017185f, -0.004447f}, + {+0.147317f, +0.015855f, +0.001243f}, + {-0.239821f, -0.029217f, +0.008681f}, + {-0.348287f, -0.007454f, +0.010181f}, + {+0.149521f, +0.030650f, -0.003365f}, + {+0.048588f, -0.006717f, -0.005355f}, + {+0.186826f, -0.010831f, -0.001024f}, + {-0.115953f, +0.001790f, -0.004618f} + }, + { + {+0.527959f, -0.004605f, -0.000793f}, + {-0.465933f, -0.000734f, -0.000648f}, + {+0.058769f, +0.003399f, +0.003980f}, + {+0.020939f, +0.002500f, +0.001602f}, + {-0.102989f, -0.023640f, -0.000907f}, + {+0.330754f, -0.015227f, -0.013490f}, + {+0.293504f, +0.012966f, +0.002367f}, + {+0.435673f, -0.007769f, -0.006056f}, + {-0.189456f, -0.010551f, -0.008519f}, + {+0.165864f, +0.001568f, +0.003516f}, + {-0.320806f, +0.034715f, +0.000873f}, + {-0.324855f, +0.004016f, +0.002288f}, + {+0.248230f, -0.023651f, -0.001117f}, + {+0.067435f, -0.016300f, -0.003833f}, + {+0.272913f, -0.007587f, -0.015541f}, + {-0.076620f, -0.021772f, -0.003143f} + }, + { + {+0.537963f, +0.000122f, -0.000129f}, + {-0.521439f, -0.006120f, +0.005687f}, + {+0.059349f, +0.002731f, +0.001179f}, + {-0.063524f, -0.015179f, +0.008462f}, + {-0.018295f, +0.018831f, +0.001086f}, + {+0.382316f, +0.020820f, -0.008228f}, + {+0.133723f, -0.051158f, +0.007642f}, + {+0.427333f, -0.004801f, -0.004396f}, + {-0.189172f, +0.025571f, +0.003440f}, + {+0.153064f, -0.017940f, -0.000618f}, + {-0.344855f, -0.000841f, -0.007255f}, + {-0.204120f, +0.035702f, -0.007554f}, + {+0.269414f, -0.005639f, +0.002449f}, + {+0.098719f, +0.013856f, +0.002962f}, + {+0.355359f, +0.040342f, -0.012703f}, + {-0.043435f, +0.014923f, +0.004398f} + }, + { + {+0.539918f, +0.002520f, -0.000803f}, + {-0.586780f, +0.022878f, +0.005664f}, + {+0.088465f, -0.012487f, -0.000009f}, + {-0.133857f, +0.024436f, +0.005429f}, + {+0.038815f, -0.004600f, +0.001199f}, + {+0.354019f, +0.005760f, +0.002225f}, + {-0.035479f, +0.061479f, -0.003852f}, + {+0.333448f, +0.030542f, -0.002292f}, + {-0.214917f, +0.009773f, +0.013046f}, + {+0.126578f, +0.010093f, -0.005470f}, + {-0.286447f, -0.044878f, -0.001444f}, + {-0.026257f, -0.067149f, -0.001093f}, + {+0.208042f, +0.035382f, -0.000884f}, + {+0.140716f, -0.000405f, +0.001329f}, + {+0.398750f, -0.026334f, +0.002502f}, + {-0.035058f, +0.007558f, +0.005919f} + }, + { + {+0.542223f, +0.000691f, -0.001439f}, + {-0.649673f, -0.023205f, -0.000535f}, + {+0.109219f, +0.005980f, +0.002282f}, + {-0.171779f, -0.010220f, -0.000656f}, + {+0.066150f, -0.005365f, -0.002547f}, + {+0.254746f, -0.041005f, +0.002026f}, + {-0.138924f, -0.008674f, -0.012149f}, + {+0.169249f, -0.044112f, -0.002599f}, + {-0.272638f, -0.040677f, +0.004640f}, + {+0.110153f, +0.006462f, -0.003434f}, + {-0.169903f, +0.042984f, +0.010056f}, + {+0.132794f, +0.036153f, +0.009130f}, + {+0.102112f, -0.031703f, -0.006139f}, + {+0.188913f, +0.004870f, -0.004839f}, + {+0.357390f, -0.030371f, +0.006291f}, + {-0.051114f, -0.020551f, -0.000894f} + }, + { + {+0.551847f, -0.004875f, -0.000679f}, + {-0.690272f, +0.004312f, -0.004016f}, + {+0.095639f, +0.010071f, +0.002809f}, + {-0.161818f, -0.013824f, -0.000790f}, + {+0.076081f, -0.002390f, -0.004308f}, + {+0.122361f, +0.040035f, -0.004601f}, + {-0.144006f, -0.036671f, -0.003198f}, + {-0.024466f, +0.039610f, -0.000882f}, + {-0.331827f, +0.020929f, -0.006635f}, + {+0.113319f, -0.007876f, +0.000927f}, + {-0.048322f, -0.009251f, +0.008004f}, + {+0.207982f, +0.015726f, +0.004350f}, + {+0.006949f, +0.009330f, -0.004246f}, + {+0.233905f, -0.014811f, -0.005355f}, + {+0.223143f, +0.054998f, -0.002434f}, + {-0.070208f, +0.002186f, -0.004895f} + }, + { + {+0.570043f, +0.005432f, +0.000103f}, + {-0.699360f, +0.014398f, +0.000427f}, + {+0.048501f, -0.018143f, +0.001306f}, + {-0.107295f, +0.023902f, +0.003671f}, + {+0.082584f, +0.006076f, -0.001731f}, + {+0.005834f, -0.019340f, -0.006865f}, + {-0.085415f, +0.035831f, +0.009933f}, + {-0.202459f, -0.035934f, +0.000303f}, + {-0.353113f, +0.015051f, -0.004263f}, + {+0.130123f, +0.004257f, +0.001776f}, + {+0.043254f, +0.003167f, -0.001496f}, + {+0.189334f, -0.031601f, -0.007634f}, + {-0.040215f, +0.005301f, +0.001534f}, + {+0.256999f, +0.008098f, -0.001598f}, + {+0.036347f, -0.049036f, -0.008301f}, + {-0.070389f, +0.011544f, -0.000794f} + }, + { + {+0.593416f, -0.005649f, +0.000278f}, + {-0.688298f, -0.007364f, +0.005463f}, + {-0.008044f, +0.018190f, -0.001207f}, + {-0.030689f, -0.015365f, +0.004543f}, + {+0.091891f, -0.004696f, +0.000919f}, + {-0.064670f, -0.007573f, -0.000965f}, + {-0.030187f, +0.002153f, +0.010834f}, + {-0.331404f, +0.015975f, +0.000858f}, + {-0.323976f, -0.025164f, +0.004961f}, + {+0.148829f, +0.000188f, -0.000078f}, + {+0.101305f, -0.006103f, -0.005181f}, + {+0.115300f, +0.016832f, -0.010749f}, + {-0.032766f, -0.011589f, +0.005290f}, + {+0.239406f, +0.007974f, +0.000705f}, + {-0.145255f, +0.023713f, -0.004941f}, + {-0.046369f, -0.012177f, +0.003695f} + }, + { + {+0.616579f, +0.002929f, -0.000295f}, + {-0.676588f, -0.004629f, +0.003842f}, + {-0.043537f, -0.004766f, -0.003324f}, + {+0.044220f, +0.013845f, +0.003072f}, + {+0.101856f, -0.006437f, -0.001748f}, + {-0.092523f, +0.007377f, +0.006975f}, + {-0.023470f, -0.026713f, -0.000479f}, + {-0.400554f, +0.001062f, +0.004867f}, + {-0.261565f, +0.014128f, +0.007944f}, + {+0.159121f, -0.002751f, -0.002980f}, + {+0.138765f, +0.008950f, -0.004189f}, + {+0.034625f, +0.000481f, -0.002727f}, + {+0.012613f, +0.005909f, +0.003331f}, + {+0.175748f, -0.024801f, -0.000902f}, + {-0.281594f, -0.008334f, +0.003990f}, + {-0.007054f, +0.002604f, +0.002155f} + }, + { + {+0.635179f, -0.002823f, -0.001148f}, + {-0.674199f, +0.007986f, -0.000991f}, + {-0.041014f, -0.013849f, -0.001185f}, + {+0.104750f, -0.003964f, +0.000987f}, + {+0.107619f, -0.003736f, -0.004502f}, + {-0.101204f, +0.003739f, +0.008397f}, + {-0.064575f, +0.021388f, -0.009658f}, + {-0.422196f, -0.004265f, +0.008954f}, + {-0.190975f, -0.003688f, +0.002622f}, + {+0.155793f, -0.001509f, -0.003088f}, + {+0.169274f, -0.008874f, -0.002289f}, + {-0.023162f, +0.001981f, +0.005597f}, + {+0.073018f, -0.010252f, -0.000970f}, + {+0.080452f, +0.024265f, -0.002891f}, + {-0.363635f, +0.004698f, +0.010523f}, + {+0.035663f, -0.006812f, -0.001722f} + }, + { + {+0.647447f, +0.003124f, -0.000778f}, + {-0.678396f, +0.001222f, -0.002175f}, + {-0.008003f, +0.018788f, +0.004232f}, + {+0.153771f, +0.006824f, -0.001505f}, + {+0.102284f, +0.006283f, -0.000369f}, + {-0.107854f, -0.015766f, +0.002536f}, + {-0.127703f, -0.002824f, -0.007472f}, + {-0.415367f, -0.005027f, +0.007128f}, + {-0.124975f, +0.011994f, -0.001327f}, + {+0.135698f, -0.002841f, -0.000522f}, + {+0.197083f, +0.008952f, -0.000525f}, + {-0.049410f, -0.008433f, +0.005306f}, + {+0.128034f, +0.008755f, -0.002993f}, + {-0.020098f, -0.017083f, -0.001266f}, + {-0.399229f, -0.010519f, +0.009961f}, + {+0.073610f, +0.013100f, -0.000219f} + }, + { + {+0.653287f, -0.000651f, -0.000132f}, + {-0.682914f, -0.002014f, +0.000124f}, + {+0.032972f, -0.005837f, +0.006215f}, + {+0.202805f, -0.008225f, -0.002812f}, + {+0.078083f, +0.005921f, +0.003749f}, + {-0.111320f, +0.004540f, -0.003693f}, + {-0.194460f, +0.001719f, +0.000738f}, + {-0.388630f, -0.001712f, +0.002133f}, + {-0.064250f, -0.011691f, -0.000978f}, + {+0.097911f, +0.010340f, +0.000589f}, + {+0.217935f, -0.002537f, +0.000189f}, + {-0.043003f, +0.001190f, +0.000648f}, + {+0.160424f, -0.006445f, -0.003025f}, + {-0.102796f, +0.011222f, +0.001449f}, + {-0.392994f, +0.003832f, +0.004205f}, + {+0.101814f, -0.004741f, +0.002529f} + }, + { + {+0.655085f, -0.000496f, -0.000073f}, + {-0.685269f, -0.000562f, +0.000824f}, + {+0.064749f, -0.008716f, +0.000371f}, + {+0.258268f, +0.016126f, -0.002727f}, + {+0.038467f, -0.019915f, +0.001374f}, + {-0.101519f, +0.013031f, -0.001724f}, + {-0.262717f, -0.010913f, +0.005785f}, + {-0.340935f, +0.010917f, -0.000109f}, + {-0.005117f, +0.011670f, -0.001141f}, + {+0.047975f, -0.015016f, -0.000510f}, + {+0.227673f, -0.001545f, -0.000844f}, + {-0.006815f, +0.010613f, -0.001679f}, + {+0.158152f, -0.002971f, -0.001763f}, + {-0.154604f, -0.004393f, +0.003495f}, + {-0.341946f, +0.012918f, +0.000060f}, + {+0.123129f, -0.003187f, +0.000554f} + }, + { + {+0.657162f, +0.001154f, -0.000704f}, + {-0.686405f, +0.001174f, -0.000024f}, + {+0.087607f, -0.002335f, -0.004967f}, + {+0.314889f, -0.015378f, -0.000770f}, + {+0.001549f, +0.013009f, -0.003904f}, + {-0.077871f, -0.011151f, +0.003120f}, + {-0.333383f, +0.022033f, +0.004891f}, + {-0.273704f, -0.019370f, +0.000308f}, + {+0.054701f, -0.011371f, -0.002150f}, + {-0.003312f, +0.012026f, -0.002061f}, + {+0.228798f, +0.001402f, -0.001592f}, + {+0.048684f, -0.018229f, -0.000520f}, + {+0.117088f, +0.012634f, -0.000896f}, + {-0.173410f, +0.001735f, +0.003820f}, + {-0.247906f, -0.029903f, +0.000682f}, + {+0.148293f, -0.000926f, -0.003582f} + }, + { + {+0.663635f, +0.002010f, -0.001316f}, + {-0.689882f, +0.000220f, -0.000110f}, + {+0.108949f, +0.013447f, -0.002013f}, + {+0.358661f, +0.009695f, +0.001033f}, + {-0.013352f, +0.004281f, -0.004550f}, + {-0.049096f, +0.001505f, +0.002637f}, + {-0.398463f, -0.021957f, -0.000327f}, + {-0.196600f, +0.019778f, +0.001903f}, + {+0.110988f, +0.014423f, -0.001867f}, + {-0.045870f, -0.004558f, -0.001576f}, + {+0.228188f, -0.000097f, -0.001476f}, + {+0.105835f, +0.015244f, +0.001995f}, + {+0.044580f, -0.021539f, -0.001382f}, + {-0.164082f, +0.001655f, +0.001885f}, + {-0.126620f, +0.032568f, +0.003705f}, + {+0.185481f, +0.013419f, -0.004184f} + }, + { + {+0.675624f, -0.004827f, -0.000839f}, + {-0.700179f, +0.002102f, +0.000678f}, + {+0.128613f, -0.006572f, +0.002141f}, + {+0.378743f, +0.002887f, +0.000648f}, + {-0.004220f, -0.012669f, -0.000801f}, + {-0.022440f, -0.000653f, -0.000869f}, + {-0.441665f, +0.002210f, -0.002042f}, + {-0.124814f, -0.014411f, +0.002833f}, + {+0.153596f, -0.007894f, -0.000675f}, + {-0.077085f, +0.001217f, +0.000703f}, + {+0.231308f, +0.000725f, -0.002147f}, + {+0.147273f, -0.003213f, +0.002198f}, + {-0.042268f, +0.020842f, -0.002800f}, + {-0.133721f, -0.009739f, +0.001057f}, + {-0.003152f, -0.021386f, +0.003714f}, + {+0.229253f, -0.015325f, -0.001319f} + }, + { + {+0.689875f, +0.004735f, +0.000183f}, + {-0.720017f, -0.006167f, +0.000699f}, + {+0.141755f, -0.003516f, +0.000834f}, + {+0.376706f, -0.006807f, -0.001713f}, + {+0.011000f, +0.005016f, +0.001618f}, + {-0.000647f, +0.004137f, -0.002283f}, + {-0.454292f, +0.009561f, +0.002281f}, + {-0.069428f, +0.004651f, +0.001574f}, + {+0.172906f, +0.000456f, -0.000712f}, + {-0.102160f, -0.005230f, +0.001608f}, + {+0.237600f, +0.001176f, -0.003651f}, + {+0.166513f, -0.006046f, -0.001258f}, + {-0.123162f, -0.009523f, -0.000972f}, + {-0.093037f, +0.007808f, +0.000738f}, + {+0.101706f, +0.008107f, -0.001772f}, + {+0.261899f, +0.005910f, +0.000263f} + }, + { + {+0.701449f, -0.001309f, +0.000513f}, + {-0.747852f, +0.007083f, +0.000295f}, + {+0.146674f, +0.002063f, -0.002067f}, + {+0.365508f, +0.004005f, -0.003093f}, + {+0.009820f, +0.003073f, +0.001694f}, + {+0.014954f, -0.005079f, -0.001243f}, + {-0.444057f, -0.005273f, +0.005170f}, + {-0.030220f, -0.001713f, -0.001402f}, + {+0.167308f, +0.005594f, -0.001307f}, + {-0.126894f, +0.005843f, +0.001163f}, + {+0.239461f, -0.006087f, -0.002206f}, + {+0.171030f, +0.001130f, -0.003837f}, + {-0.185728f, +0.008176f, +0.002303f}, + {-0.053859f, -0.008398f, -0.000003f}, + {+0.180213f, -0.012225f, -0.006311f}, + {+0.267399f, +0.003688f, -0.000070f} + }, + { + {+0.707682f, -0.001614f, -0.000417f}, + {-0.778938f, -0.006537f, +0.000334f}, + {+0.145291f, +0.002890f, -0.001284f}, + {+0.359528f, +0.005062f, -0.001469f}, + {-0.019378f, -0.015221f, +0.000076f}, + {+0.021977f, +0.000916f, -0.000266f}, + {-0.425305f, -0.000822f, +0.003160f}, + {+0.002113f, +0.007052f, -0.002427f}, + {+0.143996f, -0.006679f, -0.001487f}, + {-0.153276f, -0.008199f, +0.000318f}, + {+0.224106f, -0.002607f, +0.000957f}, + {+0.172702f, +0.005631f, -0.001975f}, + {-0.227595f, -0.009189f, +0.001906f}, + {-0.024550f, +0.006878f, +0.000998f}, + {+0.231993f, +0.016149f, -0.003555f}, + {+0.242520f, -0.012045f, -0.001170f} + }, + { + {+0.709804f, +0.000997f, -0.001515f}, + {-0.808027f, +0.005290f, +0.000583f}, + {+0.139809f, +0.000435f, +0.000818f}, + {+0.365924f, -0.006226f, +0.001737f}, + {-0.071369f, +0.017742f, -0.003060f}, + {+0.017802f, +0.003027f, -0.000621f}, + {-0.407651f, -0.000451f, +0.000175f}, + {+0.034591f, -0.007791f, -0.002030f}, + {+0.114950f, +0.006228f, -0.001120f}, + {-0.179490f, +0.006128f, -0.000795f}, + {+0.183246f, +0.015768f, +0.000773f}, + {+0.177035f, -0.003531f, +0.000696f}, + {-0.250400f, +0.001355f, +0.001108f}, + {-0.008187f, +0.000159f, +0.001456f}, + {+0.254611f, -0.001384f, -0.000532f}, + {+0.198496f, +0.013948f, -0.002759f} + }, + { + {+0.710823f, +0.002381f, -0.001069f}, + {-0.831214f, -0.003447f, +0.000878f}, + {+0.132056f, -0.007797f, -0.000969f}, + {+0.382880f, -0.001094f, +0.000711f}, + {-0.129160f, -0.007502f, -0.002763f}, + {+0.003161f, -0.000767f, +0.000443f}, + {-0.392711f, +0.006305f, +0.000815f}, + {+0.067053f, +0.011901f, -0.000327f}, + {+0.090742f, -0.003835f, -0.000996f}, + {-0.202084f, -0.000560f, +0.000195f}, + {+0.122322f, -0.020924f, -0.002535f}, + {+0.182462f, -0.002778f, -0.000258f}, + {-0.259161f, +0.001293f, +0.002195f}, + {+0.000645f, -0.003627f, -0.000469f}, + {+0.248733f, -0.007401f, -0.001654f}, + {+0.153178f, -0.008546f, -0.003483f} + }, + { + {+0.712186f, -0.002003f, +0.000341f}, + {-0.846788f, +0.001521f, +0.001394f}, + {+0.124294f, +0.003415f, -0.004317f}, + {+0.406372f, -0.002613f, -0.002804f}, + {-0.179207f, +0.002493f, +0.001438f}, + {-0.017437f, +0.004122f, +0.002593f}, + {-0.378082f, -0.002349f, +0.002279f}, + {+0.093160f, -0.004321f, +0.001305f}, + {+0.077016f, -0.001502f, +0.000076f}, + {-0.220676f, +0.001245f, +0.002361f}, + {+0.057208f, +0.011096f, -0.003599f}, + {+0.185276f, +0.001151f, -0.002614f}, + {-0.259729f, -0.001827f, +0.003455f}, + {+0.012127f, +0.000504f, -0.003413f}, + {+0.221948f, +0.010321f, -0.003531f}, + {+0.118717f, -0.000242f, -0.001468f} + }, + { + {+0.713662f, -0.000828f, +0.000545f}, + {-0.855438f, -0.002950f, +0.000977f}, + {+0.115830f, +0.005727f, -0.002674f}, + {+0.431080f, +0.008386f, -0.003025f}, + {-0.218522f, -0.008054f, +0.003300f}, + {-0.036091f, -0.008702f, +0.001428f}, + {-0.359216f, +0.001218f, +0.000904f}, + {+0.107642f, -0.001544f, +0.000220f}, + {+0.072571f, -0.000752f, +0.000715f}, + {-0.237634f, -0.007061f, +0.001792f}, + {+0.001551f, -0.003678f, -0.000322f}, + {+0.181633f, +0.003122f, -0.001514f}, + {-0.255564f, -0.003731f, +0.002293f}, + {+0.032826f, +0.012636f, -0.002484f}, + {+0.185211f, -0.004024f, -0.002705f}, + {+0.094101f, -0.001623f, +0.001061f} + }, + { + {+0.715808f, +0.001447f, -0.000564f}, + {-0.858599f, +0.000128f, +0.000166f}, + {+0.099314f, +0.001041f, +0.001297f}, + {+0.448457f, -0.007760f, -0.000064f}, + {-0.248826f, +0.008996f, +0.001277f}, + {-0.041985f, +0.000319f, -0.000791f}, + {-0.330901f, -0.006650f, -0.000552f}, + {+0.113746f, +0.002963f, -0.001774f}, + {+0.073588f, -0.000327f, +0.000159f}, + {-0.253601f, +0.004683f, -0.000245f}, + {-0.041369f, +0.004973f, +0.002735f}, + {+0.166731f, +0.003863f, +0.000533f}, + {-0.246518f, -0.001268f, -0.000049f}, + {+0.057814f, -0.010629f, +0.001615f}, + {+0.147641f, +0.004485f, +0.000244f}, + {+0.070521f, +0.005007f, +0.001670f} + }, + { + {+0.720382f, +0.001583f, -0.001168f}, + {-0.858507f, +0.001602f, +0.000561f}, + {+0.067329f, -0.015190f, +0.000273f}, + {+0.450274f, -0.005070f, +0.000753f}, + {-0.271109f, -0.002256f, +0.000399f}, + {-0.028488f, +0.011815f, +0.001154f}, + {-0.292330f, +0.012166f, +0.000199f}, + {+0.120202f, +0.001560f, -0.002785f}, + {+0.077618f, +0.000385f, -0.000057f}, + {-0.267478f, +0.001019f, +0.000455f}, + {-0.074822f, -0.008817f, +0.002528f}, + {+0.138952f, -0.011104f, -0.000590f}, + {-0.231196f, +0.009528f, +0.001492f}, + {+0.074656f, -0.000989f, +0.002061f}, + {+0.113858f, -0.008628f, +0.000648f}, + {+0.041189f, -0.009773f, +0.000867f} + }, + { + {+0.728412f, -0.003781f, -0.000442f}, + {-0.858915f, -0.000641f, +0.001243f}, + {+0.021588f, +0.015568f, -0.003718f}, + {+0.435021f, +0.011190f, -0.002580f}, + {-0.286107f, -0.000454f, +0.002042f}, + {+0.001012f, -0.010763f, +0.004584f}, + {-0.248323f, -0.011164f, +0.001788f}, + {+0.134196f, -0.006281f, -0.001978f}, + {+0.082702f, +0.001367f, -0.001190f}, + {-0.278772f, -0.000302f, +0.002741f}, + {-0.102933f, +0.009391f, -0.000025f}, + {+0.103537f, +0.008673f, -0.002139f}, + {-0.211947f, -0.006496f, +0.004418f}, + {+0.077185f, +0.005220f, -0.000312f}, + {+0.087037f, +0.006765f, -0.000943f}, + {+0.005530f, +0.010882f, -0.000993f} + }, + { + {+0.738976f, +0.002329f, +0.000136f}, + {-0.861896f, +0.000932f, +0.002377f}, + {-0.029402f, -0.003271f, -0.002468f}, + {+0.408989f, -0.003243f, -0.003584f}, + {-0.293612f, -0.002313f, +0.002730f}, + {+0.038002f, +0.000412f, +0.002803f}, + {-0.206194f, +0.003320f, +0.000488f}, + {+0.155421f, +0.006078f, -0.001116f}, + {+0.087818f, +0.003223f, -0.001518f}, + {-0.285833f, -0.006231f, +0.001960f}, + {-0.128249f, -0.001074f, -0.000243f}, + {+0.068575f, -0.002940f, -0.000700f}, + {-0.191804f, -0.003014f, +0.002724f}, + {+0.067942f, -0.005643f, -0.002245f}, + {+0.068213f, -0.000980f, -0.001053f}, + {-0.030778f, -0.002407f, -0.000036f} + }, + { + {+0.750300f, +0.000058f, -0.000825f}, + {-0.866279f, +0.001749f, +0.003432f}, + {-0.078123f, -0.003921f, +0.005991f}, + {+0.379010f, -0.005518f, +0.002243f}, + {-0.292486f, +0.009941f, -0.001947f}, + {+0.075433f, +0.005336f, -0.005378f}, + {-0.170771f, -0.002341f, -0.003169f}, + {+0.177886f, -0.005886f, -0.000679f}, + {+0.091281f, -0.005785f, +0.001198f}, + {-0.285767f, +0.012433f, -0.005156f}, + {-0.152796f, -0.004962f, +0.005079f}, + {+0.040112f, +0.002644f, +0.001940f}, + {-0.171647f, +0.007661f, -0.004705f}, + {+0.053028f, -0.000873f, -0.001571f}, + {+0.054373f, -0.002064f, +0.001211f}, + {-0.062123f, +0.000837f, +0.004082f} + }, + { + {+0.760695f, +0.000187f, -0.002580f}, + {-0.869383f, -0.005374f, +0.001979f}, + {-0.118984f, -0.003432f, +0.014567f}, + {+0.349914f, +0.003949f, +0.011712f}, + {-0.283867f, -0.008607f, -0.011966f}, + {+0.106829f, +0.003798f, -0.012953f}, + {-0.143863f, +0.007735f, -0.004012f}, + {+0.195900f, +0.004792f, +0.000560f}, + {+0.091845f, +0.002959f, +0.004936f}, + {-0.279043f, -0.006225f, -0.015628f}, + {-0.177000f, +0.001330f, +0.012704f}, + {+0.021476f, -0.006516f, +0.001630f}, + {-0.154239f, +0.000969f, -0.011998f}, + {+0.037152f, +0.007671f, +0.004251f}, + {+0.041126f, +0.001005f, +0.004482f}, + {-0.085797f, -0.005363f, +0.006097f} + } +}; + +const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +{ + { + {-0.191323f, +0.550462f, -0.164703f}, + {+0.179339f, -0.105827f, -0.022109f}, + {-0.016317f, +0.069138f, -0.026386f}, + {-0.031302f, +0.044550f, -0.011983f}, + {+0.011873f, +0.049933f, -0.022817f}, + {-0.002100f, +0.025417f, -0.008917f}, + {+0.008673f, +0.072165f, -0.030658f}, + {+0.009984f, -0.046099f, +0.014260f}, + {-0.017932f, +0.200113f, -0.071972f}, + {+0.009948f, +0.076380f, -0.035799f}, + {-0.000500f, -0.013211f, +0.007415f}, + {+0.005467f, +0.017109f, -0.007909f}, + {-0.001381f, -0.024397f, +0.011565f}, + {+0.001735f, -0.017167f, +0.009148f}, + {-0.006994f, -0.015041f, +0.007364f}, + {-0.000274f, +0.004190f, -0.001467f} + }, + { + {-0.330036f, +0.333647f, -0.215680f}, + {+0.446962f, +0.557076f, +0.195252f}, + {-0.017152f, +0.086610f, -0.016060f}, + {-0.053984f, +0.030859f, -0.007361f}, + {+0.031663f, +0.050397f, -0.030580f}, + {-0.013130f, -0.075028f, -0.055072f}, + {+0.035680f, +0.080722f, -0.037346f}, + {+0.011258f, -0.044042f, +0.013548f}, + {+0.004710f, +0.152351f, -0.099878f}, + {+0.054304f, +0.216938f, +0.014289f}, + {-0.014461f, -0.090558f, -0.026436f}, + {+0.019523f, +0.056800f, +0.001967f}, + {-0.012667f, -0.065948f, -0.004877f}, + {-0.011111f, -0.088384f, -0.022179f}, + {-0.018869f, -0.025704f, +0.006997f}, + {+0.000817f, +0.008300f, +0.000651f} + }, + { + {-0.096856f, -0.591788f, +0.084769f}, + {+0.247542f, +1.016515f, +0.073842f}, + {-0.000574f, +0.046908f, -0.004371f}, + {-0.019540f, +0.031177f, -0.013825f}, + {+0.037796f, -0.124420f, +0.041797f}, + {+0.007360f, -0.192733f, -0.007619f}, + {+0.072377f, -0.160383f, +0.061576f}, + {-0.003711f, +0.021943f, -0.004227f}, + {+0.112964f, -0.363004f, +0.093285f}, + {+0.056746f, +0.090813f, +0.072980f}, + {-0.006103f, -0.134417f, -0.008866f}, + {+0.005326f, +0.101653f, -0.016759f}, + {-0.002749f, -0.090650f, +0.006843f}, + {-0.000089f, -0.179843f, +0.016051f}, + {+0.001814f, -0.087437f, +0.037078f}, + {+0.005267f, -0.010738f, +0.007098f} + }, + { + {+0.063555f, -0.411417f, +0.075756f}, + {-0.093014f, +0.372322f, -0.077805f}, + {+0.007107f, +0.054992f, -0.008311f}, + {+0.033886f, +0.080359f, -0.013428f}, + {-0.014436f, -0.207733f, +0.015885f}, + {+0.013408f, -0.128849f, +0.020860f}, + {+0.024255f, -0.374328f, -0.023256f}, + {-0.002134f, +0.023939f, +0.000696f}, + {+0.058983f, -0.666227f, -0.050398f}, + {+0.014357f, +0.059836f, +0.078919f}, + {+0.009066f, -0.055606f, +0.025373f}, + {+0.008234f, +0.193844f, +0.040018f}, + {+0.010778f, -0.088365f, +0.004018f}, + {+0.007190f, -0.141067f, +0.033486f}, + {+0.015950f, -0.182801f, -0.014037f}, + {-0.004549f, -0.103305f, -0.035896f} + }, + { + {+0.019484f, -0.338410f, +0.083536f}, + {-0.202040f, +0.634536f, -0.185332f}, + {+0.007949f, -0.067812f, +0.047529f}, + {+0.048582f, -0.153833f, +0.075433f}, + {-0.054773f, +0.008273f, -0.058696f}, + {-0.024929f, +0.021715f, -0.041866f}, + {-0.026392f, -0.170362f, -0.104628f}, + {+0.014816f, -0.001719f, +0.003760f}, + {-0.050384f, -0.474129f, -0.111890f}, + {-0.050928f, +0.326828f, -0.037272f}, + {+0.005968f, -0.019903f, +0.009428f}, + {+0.002366f, +0.233633f, +0.019586f}, + {+0.014235f, -0.074982f, -0.008001f}, + {-0.003852f, +0.000864f, -0.026540f}, + {+0.024596f, -0.140123f, -0.045292f}, + {+0.007335f, -0.140212f, -0.016737f} + }, + { + {-0.203259f, -0.677311f, +0.036974f}, + {+0.017307f, +0.878070f, -0.170118f}, + {-0.043215f, -0.181813f, +0.012035f}, + {-0.067120f, -0.199982f, +0.078357f}, + {+0.003334f, +0.005382f, -0.060963f}, + {-0.037369f, +0.095076f, -0.002797f}, + {-0.007145f, +0.024172f, -0.016239f}, + {+0.025809f, +0.035193f, +0.010462f}, + {-0.123278f, -0.317455f, +0.005941f}, + {-0.071780f, +0.152842f, -0.115403f}, + {+0.009047f, -0.007435f, +0.015219f}, + {-0.009240f, +0.131025f, -0.037457f}, + {+0.010330f, -0.013791f, +0.019556f}, + {+0.018073f, +0.051639f, -0.007415f}, + {+0.023065f, +0.024816f, +0.028060f}, + {+0.023145f, -0.072535f, +0.012653f} + }, + { + {-0.363585f, -0.196908f, -0.132849f}, + {+0.400794f, -0.061111f, +0.146774f}, + {-0.088996f, -0.035461f, -0.039728f}, + {-0.248102f, +0.210034f, -0.044008f}, + {+0.136603f, -0.269455f, +0.014678f}, + {-0.039867f, +0.056544f, +0.018785f}, + {+0.012335f, -0.061064f, +0.014746f}, + {+0.001640f, +0.021263f, +0.019567f}, + {-0.164395f, -0.120409f, -0.065761f}, + {-0.005008f, -0.124444f, -0.002355f}, + {+0.006089f, +0.036166f, -0.003168f}, + {-0.008972f, +0.027316f, +0.008811f}, + {-0.026456f, +0.074066f, -0.007831f}, + {+0.036264f, -0.025445f, +0.017552f}, + {-0.046783f, +0.110385f, +0.011511f}, + {+0.016634f, -0.063190f, +0.003470f} + }, + { + {-0.140043f, +0.331564f, +0.031879f}, + {+0.418213f, -0.323867f, +0.026950f}, + {-0.066524f, +0.078043f, +0.003209f}, + {-0.275295f, +0.106284f, -0.069212f}, + {+0.205855f, -0.059809f, +0.074823f}, + {-0.024267f, -0.018141f, -0.016347f}, + {+0.021686f, -0.056152f, +0.012278f}, + {-0.065157f, -0.071098f, -0.001681f}, + {-0.025332f, +0.159594f, +0.013561f}, + {+0.029475f, -0.035218f, +0.023811f}, + {+0.011328f, +0.030605f, -0.007685f}, + {-0.054740f, -0.020295f, -0.000302f}, + {-0.047455f, +0.027854f, -0.019731f}, + {+0.022053f, -0.039858f, +0.012679f}, + {-0.116347f, -0.040132f, -0.032026f}, + {-0.007321f, -0.043491f, +0.015668f} + }, + { + {+0.232420f, -0.042183f, +0.090352f}, + {+0.143907f, +0.128870f, -0.081606f}, + {-0.019255f, -0.008481f, +0.025359f}, + {-0.079364f, -0.195197f, +0.009060f}, + {+0.092435f, +0.165349f, +0.007306f}, + {+0.037358f, -0.066958f, -0.009347f}, + {+0.002010f, -0.000201f, -0.007048f}, + {-0.118479f, -0.000141f, -0.016298f}, + {+0.131479f, -0.025371f, +0.046423f}, + {+0.013254f, +0.056073f, -0.007964f}, + {+0.020421f, -0.014051f, +0.008057f}, + {-0.102505f, +0.044999f, -0.012472f}, + {-0.028717f, -0.037569f, +0.002612f}, + {-0.021286f, +0.036718f, -0.008001f}, + {-0.110557f, -0.093273f, -0.012580f}, + {-0.060924f, +0.023756f, -0.000190f} + }, + { + {+0.533983f, -0.079000f, +0.018330f}, + {-0.217748f, +0.012931f, -0.048151f}, + {+0.025802f, -0.036354f, +0.006267f}, + {+0.205140f, +0.060899f, +0.046660f}, + {-0.113290f, -0.081234f, -0.041909f}, + {+0.105415f, +0.030348f, +0.015181f}, + {-0.034112f, -0.007984f, -0.002032f}, + {-0.109019f, +0.032142f, -0.005021f}, + {+0.186112f, -0.090334f, +0.010289f}, + {-0.018376f, +0.004638f, -0.018235f}, + {+0.011521f, -0.024596f, +0.005093f}, + {-0.106685f, +0.043319f, -0.011207f}, + {+0.003719f, +0.002813f, +0.009833f}, + {-0.061529f, +0.014049f, -0.008239f}, + {-0.045872f, +0.041391f, +0.025100f}, + {-0.106073f, -0.025839f, -0.009219f} + }, + { + {+0.689088f, +0.021676f, -0.035498f}, + {-0.512497f, -0.013050f, +0.008139f}, + {+0.080900f, -0.013233f, -0.008488f}, + {+0.415840f, +0.041814f, +0.013996f}, + {-0.278767f, -0.050484f, -0.020716f}, + {+0.124237f, +0.048494f, +0.003541f}, + {-0.083860f, +0.012095f, -0.001839f}, + {-0.040470f, -0.043256f, +0.009440f}, + {+0.127554f, +0.052174f, -0.027560f}, + {-0.038197f, -0.025553f, -0.002386f}, + {-0.013296f, +0.017618f, -0.006802f}, + {-0.049000f, -0.034411f, +0.008434f}, + {+0.023951f, +0.015385f, +0.000397f}, + {-0.079741f, -0.014689f, +0.006056f}, + {+0.015937f, +0.036771f, +0.013501f}, + {-0.116284f, -0.032742f, -0.005608f} + }, + { + {+0.733240f, +0.033897f, -0.028463f}, + {-0.683283f, -0.019108f, +0.024422f}, + {+0.165878f, +0.024612f, -0.005353f}, + {+0.489377f, -0.026929f, -0.018187f}, + {-0.343135f, +0.029846f, +0.016631f}, + {+0.086256f, -0.016816f, -0.014815f}, + {-0.129107f, +0.000075f, +0.000830f}, + {+0.047145f, -0.000801f, +0.008881f}, + {+0.023844f, +0.003992f, -0.023086f}, + {-0.042301f, +0.008336f, +0.009579f}, + {-0.039371f, +0.014019f, -0.003266f}, + {+0.037930f, +0.005491f, +0.006528f}, + {+0.020403f, -0.000483f, -0.004551f}, + {-0.081119f, -0.016241f, +0.003920f}, + {+0.051945f, -0.020771f, -0.013605f}, + {-0.091078f, +0.021518f, +0.009604f} + }, + { + {+0.733114f, -0.029809f, -0.003150f}, + {-0.758988f, +0.025935f, +0.015102f}, + {+0.280906f, -0.031811f, -0.003778f}, + {+0.459117f, +0.008405f, -0.019040f}, + {-0.333055f, +0.004022f, +0.017856f}, + {+0.012149f, -0.009636f, -0.003754f}, + {-0.156853f, +0.003236f, +0.004887f}, + {+0.114968f, +0.002815f, -0.004184f}, + {-0.064559f, -0.023528f, +0.001333f}, + {-0.039134f, +0.015161f, +0.005522f}, + {-0.063282f, +0.001881f, +0.005278f}, + {+0.121057f, -0.006821f, -0.003568f}, + {-0.006828f, +0.002343f, -0.000194f}, + {-0.069156f, -0.009861f, -0.001545f}, + {+0.070362f, -0.029774f, -0.011253f}, + {-0.061366f, +0.013312f, +0.005905f} + }, + { + {+0.724625f, -0.001203f, +0.006316f}, + {-0.787100f, -0.019364f, +0.003117f}, + {+0.401617f, +0.025467f, -0.004330f}, + {+0.392760f, +0.000769f, -0.009132f}, + {-0.296783f, -0.006051f, +0.006244f}, + {-0.080677f, -0.011855f, +0.011409f}, + {-0.155686f, -0.003923f, +0.003032f}, + {+0.152027f, +0.011289f, -0.005772f}, + {-0.122199f, -0.008679f, +0.013528f}, + {-0.032224f, -0.005650f, -0.003051f}, + {-0.086101f, -0.012645f, +0.003029f}, + {+0.171824f, +0.008018f, -0.006233f}, + {-0.049811f, -0.010853f, +0.002128f}, + {-0.046385f, +0.014661f, +0.005149f}, + {+0.075593f, +0.018900f, +0.006819f}, + {-0.042682f, -0.001204f, -0.002701f} + }, + { + {+0.710313f, +0.016351f, +0.000594f}, + {-0.788202f, -0.001698f, -0.001880f}, + {+0.478276f, -0.009988f, -0.006465f}, + {+0.338553f, -0.006580f, +0.000873f}, + {-0.267876f, +0.004181f, -0.000561f}, + {-0.161632f, +0.031504f, +0.010015f}, + {-0.112024f, -0.007981f, -0.001560f}, + {+0.161078f, -0.006395f, +0.000785f}, + {-0.159938f, +0.023767f, +0.006167f}, + {-0.016977f, -0.011649f, -0.002458f}, + {-0.101033f, +0.005466f, -0.000979f}, + {+0.168147f, +0.002987f, -0.004477f}, + {-0.090853f, +0.008103f, +0.002155f}, + {-0.019160f, +0.010061f, +0.003516f}, + {+0.068113f, +0.017356f, +0.008667f}, + {-0.034415f, -0.006094f, -0.000653f} + }, + { + {+0.687296f, -0.010309f, -0.005056f}, + {-0.764260f, +0.015559f, +0.000832f}, + {+0.464886f, -0.002946f, -0.003297f}, + {+0.298384f, -0.012876f, +0.002489f}, + {-0.246598f, +0.005940f, -0.001267f}, + {-0.184060f, -0.014332f, -0.000763f}, + {-0.024137f, +0.022250f, -0.004819f}, + {+0.154151f, -0.010440f, +0.001340f}, + {-0.181725f, -0.011644f, -0.002738f}, + {+0.007528f, +0.010988f, +0.002133f}, + {-0.103221f, +0.002109f, -0.001628f}, + {+0.103776f, -0.007568f, +0.001735f}, + {-0.108578f, +0.000395f, +0.003349f}, + {+0.017935f, -0.001653f, -0.006823f}, + {+0.063247f, -0.018078f, -0.002599f}, + {-0.031929f, -0.003751f, +0.000579f} + }, + { + {+0.659915f, +0.003181f, -0.004789f}, + {-0.723641f, -0.015598f, +0.004701f}, + {+0.344320f, +0.034439f, +0.003396f}, + {+0.252485f, +0.010951f, -0.000869f}, + {-0.213766f, -0.011294f, +0.001229f}, + {-0.112272f, -0.023126f, -0.008479f}, + {+0.086512f, -0.032942f, -0.003959f}, + {+0.151070f, +0.005416f, -0.003241f}, + {-0.183618f, -0.008669f, -0.002985f}, + {+0.037360f, -0.003147f, +0.002379f}, + {-0.095879f, -0.005536f, -0.000670f}, + {-0.009973f, +0.033041f, +0.006312f}, + {-0.086652f, -0.000941f, +0.001227f}, + {+0.070708f, -0.028404f, -0.005854f}, + {+0.082798f, -0.007130f, -0.008870f}, + {-0.024953f, -0.002080f, -0.001188f} + }, + { + {+0.634763f, -0.001208f, -0.002397f}, + {-0.683670f, +0.007693f, +0.006039f}, + {+0.143818f, -0.065248f, +0.001626f}, + {+0.187585f, -0.010607f, +0.001657f}, + {-0.155102f, +0.012347f, +0.000836f}, + {+0.047669f, +0.064360f, -0.004465f}, + {+0.176375f, +0.020282f, -0.000832f}, + {+0.166599f, +0.005868f, -0.005383f}, + {-0.165581f, +0.017111f, +0.003241f}, + {+0.067470f, -0.001639f, -0.002026f}, + {-0.090399f, +0.004464f, +0.000923f}, + {-0.138735f, -0.040116f, +0.001857f}, + {-0.018624f, +0.015969f, -0.003767f}, + {+0.124121f, +0.022397f, +0.003509f}, + {+0.132318f, +0.030070f, -0.004033f}, + {-0.005451f, +0.010583f, +0.000461f} + }, + { + {+0.613639f, +0.002441f, -0.000996f}, + {-0.658994f, +0.004033f, +0.003708f}, + {-0.066781f, +0.052613f, -0.005380f}, + {+0.103141f, +0.024662f, +0.003094f}, + {-0.069224f, -0.020885f, -0.001016f}, + {+0.237901f, -0.057325f, +0.006669f}, + {+0.198251f, +0.008139f, -0.001238f}, + {+0.196297f, -0.014019f, -0.004087f}, + {-0.137085f, -0.006189f, +0.006787f}, + {+0.092626f, -0.005231f, -0.005081f}, + {-0.098805f, -0.001528f, +0.003973f}, + {-0.227978f, +0.011869f, -0.001188f}, + {+0.083502f, -0.031761f, -0.003653f}, + {+0.154304f, +0.003532f, +0.005157f}, + {+0.192731f, -0.026618f, +0.005738f}, + {+0.025619f, -0.008251f, +0.002697f} + }, + { + {+0.592443f, -0.004265f, -0.000675f}, + {-0.651475f, -0.007639f, -0.001077f}, + {-0.211884f, -0.008375f, -0.003618f}, + {+0.015847f, -0.026610f, -0.001288f}, + {+0.030980f, +0.024402f, -0.000682f}, + {+0.377865f, +0.004628f, +0.005328f}, + {+0.127740f, -0.031243f, -0.004692f}, + {+0.216064f, +0.008428f, -0.000840f}, + {-0.107665f, -0.004148f, +0.003207f}, + {+0.104222f, +0.007982f, -0.002781f}, + {-0.121055f, -0.007151f, +0.006643f}, + {-0.232842f, +0.021111f, +0.004010f}, + {+0.181984f, +0.020598f, -0.002112f}, + {+0.154857f, -0.016563f, -0.001311f}, + {+0.234230f, -0.006972f, +0.006138f}, + {+0.062816f, -0.000374f, -0.000261f} + }, + { + {+0.565815f, +0.006621f, -0.000731f}, + {-0.652157f, -0.001839f, -0.002786f}, + {-0.256941f, -0.016709f, +0.005201f}, + {-0.049457f, +0.004802f, -0.002568f}, + {+0.121870f, -0.014390f, -0.001453f}, + {+0.418806f, +0.025565f, -0.008436f}, + {-0.023252f, +0.033441f, -0.003455f}, + {+0.192750f, +0.014454f, -0.000969f}, + {-0.080190f, +0.006138f, -0.004702f}, + {+0.090978f, +0.000288f, +0.001642f}, + {-0.136520f, +0.012063f, +0.004637f}, + {-0.143202f, -0.027531f, +0.007344f}, + {+0.230859f, -0.004544f, -0.002668f}, + {+0.140224f, +0.009293f, -0.007214f}, + {+0.242282f, +0.025199f, -0.006229f}, + {+0.100859f, -0.005416f, -0.004924f} + }, + { + {+0.532337f, -0.007417f, -0.000543f}, + {-0.652955f, +0.010368f, +0.001740f}, + {-0.220699f, +0.013404f, +0.007323f}, + {-0.077945f, +0.013141f, +0.004826f}, + {+0.182039f, +0.009934f, -0.002503f}, + {+0.362601f, -0.019757f, -0.014603f}, + {-0.211924f, -0.030990f, +0.005294f}, + {+0.105625f, -0.028087f, -0.003678f}, + {-0.054535f, +0.015575f, -0.006139f}, + {+0.049202f, -0.015528f, +0.003083f}, + {-0.111395f, -0.002877f, -0.002743f}, + {+0.015299f, +0.023373f, -0.001099f}, + {+0.201870f, -0.009975f, -0.000096f}, + {+0.130715f, +0.012877f, -0.003882f}, + {+0.221564f, -0.009858f, -0.016146f}, + {+0.132494f, +0.017520f, -0.002095f} + }, + { + {+0.495834f, +0.008532f, -0.000369f}, + {-0.652356f, -0.003292f, +0.006811f}, + {-0.149624f, -0.011936f, +0.002662f}, + {-0.071256f, -0.002030f, +0.009341f}, + {+0.200363f, -0.000872f, -0.001071f}, + {+0.238216f, +0.009887f, -0.004541f}, + {-0.381151f, +0.041781f, +0.008291f}, + {-0.039667f, +0.026941f, +0.000063f}, + {-0.036683f, -0.023635f, +0.004916f}, + {-0.009186f, +0.024708f, -0.001260f}, + {-0.023299f, -0.026996f, -0.008496f}, + {+0.194696f, -0.039072f, -0.009744f}, + {+0.098003f, +0.033287f, +0.002536f}, + {+0.131758f, -0.006621f, +0.002658f}, + {+0.173806f, -0.018597f, -0.006932f}, + {+0.145380f, -0.006223f, +0.004430f} + }, + { + {+0.463299f, -0.007155f, -0.000770f}, + {-0.648076f, -0.009295f, +0.004610f}, + {-0.089513f, +0.010398f, +0.000359f}, + {-0.033244f, -0.002975f, +0.003236f}, + {+0.178153f, -0.013477f, -0.001343f}, + {+0.077802f, -0.029144f, +0.007460f}, + {-0.474851f, -0.029171f, -0.001803f}, + {-0.217055f, -0.041281f, +0.004828f}, + {-0.037249f, -0.008239f, +0.011497f}, + {-0.059921f, -0.009759f, -0.005233f}, + {+0.114758f, +0.056676f, -0.002229f}, + {+0.334964f, +0.046076f, -0.002995f}, + {-0.042473f, -0.043913f, -0.000922f}, + {+0.133390f, -0.007415f, +0.001167f}, + {+0.081735f, -0.007332f, +0.010523f}, + {+0.133499f, -0.015420f, +0.003583f} + }, + { + {+0.441203f, +0.002482f, -0.000824f}, + {-0.629545f, +0.003537f, -0.002292f}, + {-0.068500f, -0.000883f, +0.001586f}, + {+0.038519f, -0.014498f, -0.003426f}, + {+0.131180f, +0.015847f, -0.003732f}, + {-0.083693f, +0.047317f, +0.005981f}, + {-0.461803f, -0.022290f, -0.008344f}, + {-0.384732f, +0.037693f, +0.003505f}, + {-0.048144f, +0.029049f, +0.001374f}, + {-0.084768f, -0.008739f, -0.001947f}, + {+0.251499f, -0.035994f, +0.008053f}, + {+0.379916f, -0.000042f, +0.006724f}, + {-0.160178f, +0.020677f, -0.004025f}, + {+0.124411f, +0.010697f, -0.004992f}, + {-0.067302f, +0.056203f, +0.010926f}, + {+0.110573f, +0.015976f, -0.002867f} + }, + { + {+0.430897f, +0.000433f, -0.000350f}, + {-0.586004f, +0.017187f, -0.004129f}, + {-0.087700f, -0.011728f, +0.002208f}, + {+0.139979f, +0.032148f, -0.002572f}, + {+0.080931f, -0.008008f, -0.004145f}, + {-0.204274f, -0.031020f, -0.002988f}, + {-0.365555f, +0.057171f, +0.001535f}, + {-0.496090f, -0.014326f, +0.002762f}, + {-0.036347f, -0.000076f, -0.009610f}, + {-0.087371f, +0.006753f, +0.002953f}, + {+0.332582f, -0.010055f, +0.004412f}, + {+0.314151f, -0.048523f, +0.001669f}, + {-0.210677f, +0.006259f, -0.001554f}, + {+0.097223f, +0.002730f, -0.004153f}, + {-0.243214f, -0.058784f, -0.001131f}, + {+0.100970f, +0.001509f, -0.005827f} + }, + { + {+0.427847f, -0.001191f, +0.000192f}, + {-0.522040f, -0.027328f, +0.001322f}, + {-0.123746f, +0.015960f, -0.000425f}, + {+0.250557f, -0.029225f, +0.001401f}, + {+0.041411f, -0.001671f, -0.000435f}, + {-0.251666f, -0.011713f, -0.002737f}, + {-0.259410f, -0.030558f, +0.013501f}, + {-0.523363f, -0.008886f, +0.005097f}, + {+0.023565f, -0.037779f, -0.005281f}, + {-0.085570f, +0.002595f, +0.003055f}, + {+0.343956f, +0.022947f, -0.008052f}, + {+0.182050f, +0.049717f, -0.010139f}, + {-0.188646f, -0.025113f, +0.004590f}, + {+0.043971f, +0.008025f, +0.002158f}, + {-0.383316f, +0.019159f, -0.004800f}, + {+0.118679f, -0.020135f, -0.001036f} + }, + { + {+0.424775f, -0.001427f, +0.000274f}, + {-0.458547f, +0.013186f, +0.005324f}, + {-0.143005f, -0.001551f, -0.002520f}, + {+0.342091f, +0.013355f, +0.001866f}, + {+0.012473f, -0.005183f, +0.002228f}, + {-0.229007f, +0.024031f, +0.004922f}, + {-0.213143f, -0.021386f, +0.008846f}, + {-0.469349f, +0.018839f, +0.005224f}, + {+0.120107f, +0.037044f, +0.005367f}, + {-0.094940f, -0.009229f, -0.000146f}, + {+0.312164f, -0.002650f, -0.009985f}, + {+0.056636f, -0.008288f, -0.009234f}, + {-0.124730f, +0.013388f, +0.006509f}, + {-0.037461f, -0.023127f, +0.003625f}, + {-0.438903f, +0.013352f, +0.002069f}, + {+0.155431f, +0.012048f, +0.004072f} + }, + { + {+0.415850f, +0.004534f, -0.000668f}, + {-0.414572f, +0.002652f, +0.002367f}, + {-0.124613f, -0.010725f, -0.002281f}, + {+0.397126f, -0.000677f, -0.001120f}, + {-0.014003f, +0.010619f, -0.000267f}, + {-0.170253f, -0.018842f, +0.008960f}, + {-0.241128f, +0.034417f, -0.004698f}, + {-0.359282f, -0.033550f, +0.005250f}, + {+0.216676f, -0.010427f, +0.006057f}, + {-0.120954f, +0.008613f, -0.002469f}, + {+0.268504f, +0.001802f, -0.003587f}, + {-0.013045f, -0.010217f, +0.002327f}, + {-0.059871f, -0.003931f, +0.001188f}, + {-0.132164f, +0.026563f, +0.001240f}, + {-0.403193f, -0.027848f, +0.009266f}, + {+0.190953f, +0.002021f, +0.001187f} + }, + { + {+0.399726f, -0.003989f, -0.001238f}, + {-0.392346f, -0.005321f, -0.003177f}, + {-0.072827f, +0.023138f, +0.000364f}, + {+0.417980f, -0.003176f, -0.003953f}, + {-0.044470f, -0.006065f, -0.002234f}, + {-0.111558f, +0.001243f, +0.006696f}, + {-0.306891f, -0.017879f, -0.010556f}, + {-0.227947f, +0.027747f, +0.006660f}, + {+0.285131f, -0.003545f, -0.002248f}, + {-0.160581f, -0.005372f, -0.001188f}, + {+0.228536f, -0.004194f, -0.000473f}, + {-0.021041f, +0.010096f, +0.009272f}, + {-0.021484f, +0.000358f, -0.003354f}, + {-0.213365f, -0.015260f, -0.000168f}, + {-0.303399f, +0.026027f, +0.011571f}, + {+0.212111f, -0.000447f, -0.003261f} + }, + { + {+0.378407f, +0.003850f, -0.000653f}, + {-0.380175f, -0.007586f, -0.003255f}, + {-0.012127f, -0.017400f, +0.004348f}, + {+0.420589f, +0.000881f, -0.004600f}, + {-0.082045f, +0.000538f, +0.001160f}, + {-0.069379f, +0.007873f, -0.001279f}, + {-0.364957f, -0.009593f, -0.003601f}, + {-0.103978f, -0.012644f, +0.002536f}, + {+0.322327f, -0.004962f, -0.006100f}, + {-0.208381f, +0.007687f, +0.001556f}, + {+0.193755f, +0.004206f, +0.000887f}, + {+0.012722f, +0.002660f, +0.005208f}, + {-0.021028f, +0.002645f, -0.003959f}, + {-0.256559f, +0.000206f, +0.001247f}, + {-0.175255f, -0.013434f, +0.005713f}, + {+0.216424f, -0.004406f, -0.001903f} + }, + { + {+0.355186f, -0.004417f, +0.000047f}, + {-0.367959f, +0.007051f, +0.000589f}, + {+0.030278f, -0.000745f, +0.003677f}, + {+0.419972f, +0.001580f, -0.004098f}, + {-0.126164f, -0.010538f, +0.004622f}, + {-0.036142f, +0.005050f, -0.006483f}, + {-0.395580f, +0.008424f, +0.006868f}, + {+0.004418f, +0.013200f, -0.004102f}, + {+0.338438f, +0.004391f, -0.003969f}, + {-0.257936f, -0.011270f, +0.002562f}, + {+0.157184f, -0.010190f, +0.001022f}, + {+0.066694f, +0.007499f, -0.001955f}, + {-0.058038f, -0.007898f, -0.001836f}, + {-0.252063f, +0.011457f, +0.004218f}, + {-0.038996f, +0.019229f, -0.002930f}, + {+0.207135f, -0.002683f, +0.000920f} + }, + { + {+0.333833f, +0.005141f, -0.000033f}, + {-0.354343f, -0.002376f, +0.001512f}, + {+0.044789f, +0.011943f, -0.002345f}, + {+0.420054f, -0.005203f, -0.002411f}, + {-0.168493f, +0.019086f, +0.001101f}, + {+0.000312f, -0.019974f, -0.002740f}, + {-0.404430f, +0.003854f, +0.008761f}, + {+0.101609f, -0.024344f, -0.004621f}, + {+0.343021f, -0.002003f, -0.002287f}, + {-0.300798f, +0.012232f, +0.000926f}, + {+0.115201f, +0.012523f, -0.000667f}, + {+0.124884f, -0.013322f, -0.003505f}, + {-0.124657f, +0.015080f, +0.000444f}, + {-0.208063f, -0.009838f, +0.004149f}, + {+0.098778f, -0.030234f, -0.005691f}, + {+0.191672f, +0.010274f, -0.000986f} + }, + { + {+0.317651f, -0.003399f, -0.000638f}, + {-0.342009f, +0.000734f, +0.000383f}, + {+0.041234f, -0.003266f, -0.006626f}, + {+0.412818f, +0.000564f, -0.000053f}, + {-0.193269f, -0.005756f, -0.003803f}, + {+0.038455f, +0.012921f, +0.002898f}, + {-0.397973f, -0.006421f, +0.004371f}, + {+0.186407f, +0.018164f, -0.002443f}, + {+0.339213f, -0.001972f, -0.002251f}, + {-0.327935f, -0.003077f, -0.000361f}, + {+0.072360f, -0.008411f, -0.001308f}, + {+0.171731f, +0.013927f, -0.001434f}, + {-0.206591f, -0.018817f, +0.001471f}, + {-0.140714f, +0.015540f, +0.002302f}, + {+0.227639f, +0.031497f, -0.003750f}, + {+0.179263f, -0.004105f, -0.004389f} + }, + { + {+0.307693f, +0.001076f, -0.000945f}, + {-0.334320f, -0.001717f, +0.000049f}, + {+0.033552f, -0.011447f, -0.002121f}, + {+0.387841f, +0.007421f, +0.001088f}, + {-0.192595f, -0.010377f, -0.002843f}, + {+0.067483f, +0.002402f, +0.001682f}, + {-0.373557f, +0.001444f, -0.001449f}, + {+0.251051f, -0.016030f, -0.000496f}, + {+0.323516f, +0.001530f, -0.001658f}, + {-0.335944f, -0.003218f, +0.000567f}, + {+0.034654f, +0.006672f, -0.000906f}, + {+0.193976f, -0.003406f, +0.001146f}, + {-0.284432f, +0.017472f, +0.001142f}, + {-0.067179f, -0.009754f, -0.000138f}, + {+0.329347f, -0.022749f, -0.000471f}, + {+0.172128f, -0.005358f, -0.003493f} + }, + { + {+0.301577f, +0.001184f, -0.000322f}, + {-0.332736f, +0.000666f, +0.000894f}, + {+0.023585f, -0.000609f, +0.003132f}, + {+0.344006f, -0.015803f, +0.000034f}, + {-0.177998f, +0.013137f, +0.002069f}, + {+0.082056f, -0.003433f, -0.002633f}, + {-0.324370f, +0.018955f, -0.002626f}, + {+0.287377f, +0.000225f, -0.000071f}, + {+0.290720f, -0.007672f, -0.000038f}, + {-0.329996f, +0.006498f, +0.002605f}, + {+0.003682f, -0.004563f, -0.000624f}, + {+0.185737f, -0.009876f, +0.000494f}, + {-0.338831f, -0.008465f, +0.000490f}, + {-0.000651f, +0.014424f, -0.001842f}, + {+0.385445f, -0.000494f, -0.001075f}, + {+0.160154f, +0.003230f, +0.000530f} + }, + { + {+0.294359f, +0.001008f, +0.000587f}, + {-0.335716f, +0.002537f, +0.000929f}, + {+0.006697f, +0.010781f, +0.001057f}, + {+0.292769f, +0.014442f, -0.002216f}, + {-0.173218f, +0.002305f, +0.004071f}, + {+0.084637f, -0.001890f, -0.003059f}, + {-0.253587f, -0.025906f, +0.002221f}, + {+0.295508f, +0.003624f, -0.001780f}, + {+0.240102f, +0.014422f, -0.000050f}, + {-0.320004f, +0.000226f, +0.002968f}, + {-0.025595f, +0.006552f, -0.001052f}, + {+0.154653f, +0.014381f, -0.002635f}, + {-0.357893f, -0.004680f, +0.001836f}, + {+0.050259f, -0.009177f, -0.001013f}, + {+0.390921f, +0.011091f, -0.005488f}, + {+0.128396f, +0.010797f, +0.002030f} + }, + { + {+0.281980f, -0.004479f, +0.000473f}, + {-0.338235f, -0.000938f, +0.000317f}, + {-0.016443f, -0.008216f, -0.002310f}, + {+0.250822f, -0.005381f, -0.002547f}, + {-0.194113f, -0.011993f, +0.002133f}, + {+0.078814f, +0.001480f, -0.000683f}, + {-0.178794f, +0.013791f, +0.004329f}, + {+0.286440f, -0.008258f, -0.003815f}, + {+0.180165f, -0.014312f, -0.000718f}, + {-0.312559f, -0.001222f, +0.001335f}, + {-0.061211f, -0.002642f, +0.000385f}, + {+0.117426f, -0.006897f, -0.004033f}, + {-0.342706f, +0.010139f, +0.004471f}, + {+0.079430f, +0.002660f, -0.001268f}, + {+0.356398f, -0.011250f, -0.007640f}, + {+0.072072f, -0.018003f, +0.000575f} + }, + { + {+0.264584f, +0.006225f, -0.000553f}, + {-0.334355f, -0.002104f, +0.000390f}, + {-0.041411f, +0.000660f, -0.001379f}, + {+0.227742f, -0.002231f, -0.000499f}, + {-0.236723f, +0.015277f, +0.000143f}, + {+0.066692f, +0.002089f, +0.000940f}, + {-0.116641f, -0.003621f, +0.000856f}, + {+0.274189f, -0.002260f, -0.003775f}, + {+0.124476f, +0.010538f, -0.000672f}, + {-0.307116f, +0.000375f, +0.000391f}, + {-0.109323f, +0.010339f, +0.003218f}, + {+0.087624f, -0.002282f, -0.001095f}, + {-0.305220f, -0.004246f, +0.003226f}, + {+0.088209f, -0.001890f, -0.000514f}, + {+0.297714f, +0.002109f, -0.002943f}, + {+0.002305f, +0.018254f, -0.000698f} + }, + { + {+0.245860f, -0.004071f, -0.001278f}, + {-0.320735f, +0.004451f, +0.000718f}, + {-0.064973f, -0.003268f, +0.001022f}, + {+0.221237f, +0.003408f, +0.001969f}, + {-0.282979f, -0.012181f, -0.001619f}, + {+0.050139f, -0.005534f, +0.000714f}, + {-0.071497f, +0.004571f, -0.002571f}, + {+0.265456f, +0.000937f, -0.001591f}, + {+0.084560f, -0.004757f, +0.000011f}, + {-0.300229f, +0.001315f, -0.000134f}, + {-0.168137f, -0.018612f, +0.002406f}, + {+0.066781f, -0.001637f, +0.001882f}, + {-0.257378f, +0.011005f, +0.000980f}, + {+0.083095f, -0.005045f, -0.000085f}, + {+0.224972f, -0.016565f, +0.001685f}, + {-0.061472f, -0.012660f, -0.001272f} + }, + { + {+0.229589f, +0.000720f, -0.000554f}, + {-0.297388f, -0.006061f, +0.000830f}, + {-0.086308f, +0.008311f, -0.000100f}, + {+0.220891f, +0.005343f, +0.000760f}, + {-0.312804f, -0.002048f, -0.000535f}, + {+0.033600f, +0.001954f, +0.000821f}, + {-0.037726f, -0.009547f, -0.001800f}, + {+0.256770f, -0.001354f, -0.000172f}, + {+0.064615f, +0.001499f, +0.000378f}, + {-0.288880f, -0.006082f, +0.000716f}, + {-0.223988f, +0.015499f, -0.000654f}, + {+0.048524f, +0.007439f, +0.000777f}, + {-0.208116f, -0.011040f, +0.001557f}, + {+0.074335f, +0.004704f, -0.001723f}, + {+0.146222f, +0.020815f, +0.000166f}, + {-0.103517f, +0.003200f, -0.000724f} + }, + { + {+0.216659f, -0.000775f, +0.000774f}, + {-0.266859f, +0.007292f, +0.000934f}, + {-0.105304f, -0.004788f, -0.002437f}, + {+0.217403f, -0.003973f, -0.002583f}, + {-0.318044f, +0.007929f, +0.003539f}, + {+0.023696f, -0.000702f, +0.001989f}, + {-0.008068f, +0.006711f, +0.000114f}, + {+0.242367f, -0.004361f, +0.000832f}, + {+0.061343f, +0.003214f, +0.000949f}, + {-0.273736f, +0.004941f, +0.002356f}, + {-0.260361f, -0.001261f, -0.000909f}, + {+0.027365f, -0.006696f, -0.001482f}, + {-0.163814f, +0.008052f, +0.001931f}, + {+0.071141f, -0.000562f, -0.003221f}, + {+0.073591f, -0.015255f, -0.001489f}, + {-0.121162f, +0.004631f, +0.001675f} + }, + { + {+0.205784f, +0.003757f, +0.000700f}, + {-0.232994f, -0.005953f, +0.000561f}, + {-0.123682f, -0.003377f, -0.000485f}, + {+0.205753f, -0.000981f, -0.002067f}, + {-0.304943f, -0.001966f, +0.004525f}, + {+0.026104f, +0.002420f, +0.000748f}, + {+0.021981f, -0.003022f, -0.000957f}, + {+0.220204f, +0.009944f, -0.000624f}, + {+0.066717f, -0.001208f, +0.001408f}, + {-0.258003f, +0.000477f, +0.001518f}, + {-0.270472f, -0.007879f, +0.002698f}, + {+0.001424f, +0.001591f, -0.000485f}, + {-0.125885f, -0.003310f, +0.000529f}, + {+0.074527f, -0.008121f, -0.001699f}, + {+0.017069f, +0.005535f, -0.000272f}, + {-0.124829f, -0.001926f, +0.003798f} + }, + { + {+0.196417f, -0.003644f, -0.000603f}, + {-0.199207f, +0.006086f, -0.000295f}, + {-0.146052f, -0.001687f, +0.003740f}, + {+0.182052f, -0.002076f, +0.001266f}, + {-0.282909f, -0.000690f, +0.001105f}, + {+0.044152f, +0.004210f, -0.001817f}, + {+0.054138f, +0.007409f, -0.002335f}, + {+0.196668f, -0.006189f, -0.002331f}, + {+0.072925f, -0.001260f, +0.000239f}, + {-0.242629f, +0.000541f, -0.000943f}, + {-0.260897f, +0.003994f, +0.004883f}, + {-0.029070f, -0.005485f, +0.001962f}, + {-0.092855f, +0.004046f, -0.001954f}, + {+0.076259f, +0.005415f, +0.002510f}, + {-0.019261f, -0.001366f, +0.002709f}, + {-0.127606f, -0.004435f, +0.002949f} + }, + { + {+0.189173f, +0.000560f, -0.001059f}, + {-0.167547f, -0.008258f, +0.000141f}, + {-0.174715f, +0.013815f, +0.002907f}, + {+0.145627f, +0.012083f, +0.002087f}, + {-0.256566f, -0.006772f, -0.000776f}, + {+0.075271f, -0.013763f, -0.000701f}, + {+0.085309f, -0.009140f, -0.001366f}, + {+0.180099f, +0.000959f, -0.002178f}, + {+0.077061f, -0.000891f, -0.000372f}, + {-0.225986f, -0.007128f, -0.000680f}, + {-0.242442f, -0.000129f, +0.003190f}, + {-0.061120f, +0.011120f, +0.001079f}, + {-0.062759f, -0.011288f, -0.001129f}, + {+0.065406f, +0.009942f, +0.002436f}, + {-0.038027f, +0.005472f, +0.002780f}, + {-0.134062f, +0.004375f, +0.001136f} + }, + { + {+0.183656f, +0.000923f, -0.000164f}, + {-0.139835f, +0.005429f, +0.001020f}, + {-0.202643f, -0.008873f, -0.000639f}, + {+0.102603f, -0.014782f, -0.000700f}, + {-0.227902f, +0.008291f, +0.000524f}, + {+0.108562f, +0.007847f, +0.001593f}, + {+0.108523f, +0.004720f, -0.000054f}, + {+0.172882f, +0.003322f, -0.000542f}, + {+0.078483f, -0.001260f, -0.000596f}, + {-0.207608f, +0.004999f, +0.001085f}, + {-0.221842f, +0.000718f, +0.000351f}, + {-0.087045f, -0.004787f, -0.000547f}, + {-0.037398f, +0.005336f, +0.001064f}, + {+0.041563f, -0.010757f, -0.000998f}, + {-0.043387f, -0.001956f, +0.000527f}, + {-0.140276f, -0.003188f, -0.000142f} + }, + { + {+0.177711f, +0.001442f, +0.000461f}, + {-0.115859f, -0.004532f, +0.001235f}, + {-0.218668f, -0.005427f, +0.000911f}, + {+0.063962f, +0.003468f, -0.001219f}, + {-0.198372f, -0.004393f, +0.000814f}, + {+0.132046f, +0.004112f, -0.000882f}, + {+0.118012f, +0.003780f, -0.001160f}, + {+0.169530f, -0.000759f, +0.000923f}, + {+0.077288f, -0.001422f, -0.000499f}, + {-0.187625f, +0.000022f, +0.000030f}, + {-0.200958f, -0.007075f, -0.000014f}, + {-0.099701f, -0.002974f, +0.000910f}, + {-0.019722f, +0.003866f, -0.001104f}, + {+0.014166f, +0.005774f, -0.002177f}, + {-0.039277f, -0.003862f, +0.000381f}, + {-0.138918f, -0.005302f, +0.000608f} + }, + { + {+0.169075f, -0.003877f, -0.000219f}, + {-0.092373f, +0.003200f, +0.000934f}, + {-0.217383f, +0.010383f, +0.006743f}, + {+0.037373f, +0.004176f, +0.003172f}, + {-0.168763f, +0.000238f, -0.001996f}, + {+0.140535f, -0.007256f, -0.006564f}, + {+0.113037f, -0.005040f, -0.003602f}, + {+0.161555f, -0.002184f, +0.001327f}, + {+0.073875f, +0.002628f, +0.001536f}, + {-0.165667f, -0.001239f, -0.003853f}, + {-0.179435f, +0.009646f, +0.002896f}, + {-0.097770f, +0.003616f, +0.003027f}, + {-0.009431f, -0.004981f, -0.006157f}, + {-0.008081f, +0.000345f, -0.000806f}, + {-0.031139f, +0.005138f, +0.002262f}, + {-0.125572f, +0.007103f, +0.003194f} + }, + { + {+0.156703f, +0.003123f, -0.000930f}, + {-0.066141f, -0.001589f, -0.001238f}, + {-0.199134f, -0.002236f, +0.009123f}, + {+0.024449f, +0.000091f, +0.006919f}, + {-0.141646f, -0.003103f, -0.005668f}, + {+0.133486f, -0.000744f, -0.008630f}, + {+0.097019f, -0.000327f, -0.002792f}, + {+0.144791f, +0.002980f, +0.002476f}, + {+0.068698f, +0.001637f, +0.003084f}, + {-0.144321f, -0.006179f, -0.006251f}, + {-0.155892f, -0.002625f, +0.004264f}, + {-0.084319f, -0.000388f, +0.002288f}, + {-0.006549f, -0.002981f, -0.008326f}, + {-0.021606f, -0.003867f, +0.002491f}, + {-0.023191f, -0.001810f, +0.003729f}, + {-0.101442f, -0.001244f, +0.002402f} + }, + { + {+0.140100f, -0.000742f, +0.000187f}, + {-0.036425f, +0.005652f, -0.004036f}, + {-0.165186f, -0.002894f, +0.004265f}, + {+0.025616f, -0.008625f, +0.004162f}, + {-0.121725f, +0.015558f, -0.002974f}, + {+0.111098f, +0.006811f, -0.003090f}, + {+0.072921f, -0.001667f, +0.000669f}, + {+0.120893f, -0.005073f, +0.004382f}, + {+0.065161f, -0.005346f, +0.001749f}, + {-0.129726f, +0.017304f, -0.000877f}, + {-0.126372f, -0.005082f, -0.000663f}, + {-0.063630f, +0.002788f, -0.000025f}, + {-0.013562f, +0.008476f, -0.004178f}, + {-0.027532f, -0.002871f, +0.003910f}, + {-0.014651f, +0.000004f, +0.003901f}, + {-0.068381f, +0.002931f, -0.001605f} + } +}; + +#endif + + +#ifndef UPDATE_FASTCONV_SBA_FILTER const float FASTCONV_HOA2_latency_s = 0.000666667f; const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]= { @@ -5892,8 +9513,2228 @@ const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]= } }; +#else +const float FASTCONV_HOA2_latency_s = 0.000020833f; +const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +{ + { + {+0.018159f, +0.985146f, +0.240506f}, + {+0.077046f, -0.024713f, +0.260411f}, + {+0.000593f, +0.132269f, +0.000009f}, + {+0.009213f, +0.054471f, +0.004257f}, + {+0.039823f, -0.044599f, -0.001606f}, + {+0.011090f, -0.028094f, +0.011739f}, + {-0.057613f, +0.083209f, +0.004522f}, + {+0.010244f, +0.028373f, -0.010969f}, + {-0.107601f, +0.182275f, +0.052385f} + }, + { + {-0.152534f, -0.329898f, -0.242342f}, + {-0.209786f, -1.273585f, -0.112026f}, + {-0.011413f, +0.080591f, -0.013524f}, + {-0.034221f, +0.013783f, +0.008826f}, + {-0.012372f, +0.014808f, +0.038195f}, + {+0.003235f, +0.083338f, +0.068446f}, + {+0.003314f, -0.032912f, -0.065265f}, + {+0.003322f, +0.076317f, +0.007937f}, + {-0.015189f, -0.220191f, -0.130843f} + }, + { + {-0.023093f, -0.558938f, -0.150964f}, + {-0.270176f, -0.589966f, -0.359432f}, + {-0.003260f, +0.097037f, -0.014970f}, + {-0.058519f, +0.107799f, -0.014627f}, + {-0.084143f, +0.174088f, -0.006734f}, + {-0.035814f, +0.281769f, -0.006166f}, + {+0.116511f, -0.307921f, +0.020292f}, + {-0.013401f, +0.086307f, +0.012981f}, + {+0.209526f, -0.554513f, -0.048661f} + }, + { + {+0.261551f, +0.304347f, +0.114032f}, + {+0.250896f, +0.779633f, +0.070356f}, + {+0.023786f, +0.088663f, -0.030815f}, + {+0.003407f, +0.082081f, -0.041209f}, + {-0.062118f, +0.047824f, -0.057239f}, + {-0.026013f, +0.155692f, -0.065882f}, + {+0.127095f, -0.164040f, +0.077176f}, + {-0.022006f, +0.035999f, -0.005698f}, + {+0.327951f, -0.045215f, +0.125831f} + }, + { + {+0.359497f, +0.205525f, +0.109865f}, + {+0.745384f, +0.051437f, +0.216054f}, + {+0.066207f, -0.076438f, +0.024748f}, + {+0.143496f, -0.123266f, +0.007838f}, + {+0.098368f, -0.139294f, -0.014972f}, + {+0.065224f, -0.122143f, +0.029816f}, + {-0.019520f, +0.163808f, -0.024174f}, + {+0.008568f, -0.024216f, +0.013284f}, + {+0.111141f, +0.311803f, +0.021197f} + }, + { + {+0.165159f, -0.254129f, -0.025534f}, + {+0.780421f, -0.408205f, +0.025264f}, + {+0.043262f, -0.082839f, +0.025956f}, + {+0.214774f, -0.021619f, +0.026192f}, + {+0.266921f, +0.073753f, +0.026414f}, + {+0.110056f, -0.068805f, +0.038706f}, + {-0.162323f, +0.018037f, -0.046919f}, + {+0.046582f, -0.024241f, +0.003856f}, + {-0.254154f, -0.105995f, -0.060073f} + }, + { + {-0.177496f, +0.069944f, -0.070544f}, + {+0.384878f, +0.205067f, -0.111476f}, + {-0.035734f, +0.067378f, -0.014549f}, + {+0.125583f, +0.062055f, +0.008649f}, + {+0.294346f, +0.048254f, +0.026299f}, + {+0.090207f, +0.084523f, -0.015326f}, + {-0.211714f, -0.100002f, +0.007755f}, + {+0.078344f, -0.022510f, -0.004774f}, + {-0.527842f, -0.045905f, -0.024578f} + }, + { + {-0.463362f, +0.056885f, -0.021761f}, + {-0.150954f, +0.026543f, -0.068293f}, + {-0.101521f, +0.000813f, -0.025478f}, + {-0.095046f, -0.089523f, -0.003261f}, + {+0.134616f, -0.104561f, +0.001013f}, + {+0.059105f, +0.025388f, -0.028020f}, + {-0.181070f, -0.006996f, +0.032275f}, + {+0.082036f, -0.002388f, +0.001840f}, + {-0.586330f, +0.048806f, +0.016554f} + }, + { + {-0.592381f, -0.044571f, +0.029549f}, + {-0.576892f, -0.036976f, +0.022220f}, + {-0.119596f, -0.060394f, -0.001555f}, + {-0.338453f, +0.063985f, -0.014668f}, + {-0.125238f, +0.093159f, -0.021501f}, + {+0.045169f, -0.044028f, +0.000433f}, + {-0.115198f, +0.025252f, +0.004920f}, + {+0.041077f, +0.008697f, +0.004995f}, + {-0.438497f, -0.055561f, +0.020980f} + }, + { + {-0.599054f, -0.014356f, +0.032985f}, + {-0.822874f, -0.044354f, +0.046136f}, + {-0.117506f, +0.008009f, +0.019868f}, + {-0.479925f, +0.018761f, -0.007799f}, + {-0.339581f, -0.001799f, -0.018360f}, + {+0.028531f, -0.004096f, +0.014580f}, + {-0.035532f, +0.016131f, -0.009871f}, + {-0.031577f, -0.038412f, +0.000988f}, + {-0.188266f, +0.051427f, +0.014971f} + }, + { + {-0.558565f, +0.027629f, +0.008677f}, + {-0.934558f, +0.055883f, +0.019701f}, + {-0.143536f, +0.040687f, +0.009496f}, + {-0.475498f, -0.046650f, +0.012347f}, + {-0.418986f, -0.046808f, +0.009187f}, + {-0.019973f, +0.045258f, +0.001389f}, + {+0.040837f, -0.027615f, -0.004137f}, + {-0.104086f, +0.015540f, -0.006688f}, + {+0.045132f, -0.020688f, +0.004131f} + }, + { + {-0.508817f, +0.002572f, -0.006006f}, + {-0.966334f, -0.010598f, +0.000935f}, + {-0.200114f, -0.021501f, -0.002245f}, + {-0.374199f, +0.021235f, +0.015875f}, + {-0.383236f, +0.011504f, +0.019281f}, + {-0.101681f, -0.007702f, -0.004459f}, + {+0.098607f, +0.009824f, -0.000170f}, + {-0.142186f, +0.015367f, -0.000073f}, + {+0.202499f, +0.007942f, -0.007850f} + }, + { + {-0.449816f, -0.025700f, -0.002766f}, + {-0.942805f, -0.019015f, +0.002630f}, + {-0.251515f, +0.005009f, -0.000037f}, + {-0.247529f, -0.018163f, +0.007953f}, + {-0.297646f, -0.008359f, +0.008978f}, + {-0.194833f, +0.010293f, +0.006773f}, + {+0.127610f, -0.005400f, -0.000110f}, + {-0.141062f, -0.005988f, +0.007030f}, + {+0.285592f, -0.008291f, -0.012555f} + }, + { + {-0.376168f, +0.026055f, +0.004627f}, + {-0.871841f, +0.021874f, +0.006470f}, + {-0.251474f, +0.012379f, +0.004839f}, + {-0.143351f, +0.003085f, +0.000557f}, + {-0.213031f, +0.008846f, +0.002525f}, + {-0.266224f, -0.023397f, +0.007678f}, + {+0.122414f, -0.005951f, +0.000933f}, + {-0.115352f, -0.004480f, +0.001947f}, + {+0.318209f, +0.018171f, -0.006837f} + }, + { + {-0.293873f, -0.014103f, +0.005564f}, + {-0.763509f, -0.026484f, +0.005957f}, + {-0.167339f, -0.021635f, +0.004681f}, + {-0.071079f, -0.008355f, -0.004673f}, + {-0.149092f, -0.004738f, -0.000445f}, + {-0.269948f, +0.002632f, +0.000196f}, + {+0.088484f, +0.013962f, +0.000022f}, + {-0.080315f, -0.009623f, -0.002700f}, + {+0.315546f, +0.000498f, +0.000137f} + }, + { + {-0.214030f, +0.010451f, +0.001827f}, + {-0.638609f, +0.024424f, +0.004195f}, + {-0.000480f, +0.033426f, -0.002795f}, + {-0.011678f, +0.017775f, -0.002438f}, + {-0.092630f, +0.011217f, -0.001499f}, + {-0.179494f, +0.027872f, -0.004886f}, + {+0.049375f, -0.006195f, +0.000322f}, + {-0.050886f, +0.014806f, +0.001580f}, + {+0.284102f, -0.013452f, -0.000223f} + }, + { + {-0.142407f, -0.012908f, -0.000129f}, + {-0.521031f, -0.021513f, +0.002424f}, + {+0.212730f, -0.053828f, -0.007313f}, + {+0.050092f, -0.009707f, -0.001567f}, + {-0.022713f, -0.014891f, -0.001899f}, + {-0.013352f, -0.051652f, -0.004824f}, + {+0.034982f, -0.000584f, +0.002038f}, + {-0.037735f, -0.000643f, +0.005700f}, + {+0.234664f, +0.015884f, -0.002619f} + }, + { + {-0.078162f, +0.013149f, +0.000240f}, + {-0.425304f, +0.016123f, +0.001883f}, + {+0.408229f, +0.052323f, -0.001957f}, + {+0.116415f, +0.013525f, -0.004497f}, + {+0.067314f, +0.020251f, -0.003762f}, + {+0.167553f, +0.051767f, +0.000869f}, + {+0.068137f, +0.009479f, +0.001235f}, + {-0.034203f, -0.008399f, +0.003763f}, + {+0.180796f, -0.011205f, -0.003598f} + }, + { + {-0.016750f, -0.012127f, +0.000498f}, + {-0.353965f, -0.008335f, +0.000653f}, + {+0.518342f, -0.011173f, +0.002964f}, + {+0.177026f, -0.019969f, -0.002705f}, + {+0.164814f, -0.026646f, -0.003238f}, + {+0.286213f, -0.012718f, +0.003816f}, + {+0.155640f, -0.020546f, -0.001850f}, + {-0.016416f, +0.003918f, -0.001774f}, + {+0.133919f, +0.003314f, -0.001822f} + }, + { + {+0.046182f, +0.012351f, -0.000034f}, + {-0.298885f, +0.009039f, -0.000810f}, + {+0.511610f, -0.032188f, -0.002291f}, + {+0.211380f, +0.005455f, +0.000933f}, + {+0.241218f, +0.015123f, -0.001103f}, + {+0.293508f, -0.029470f, -0.003051f}, + {+0.280548f, +0.030234f, -0.004368f}, + {+0.041260f, +0.018979f, -0.004541f}, + {+0.098998f, +0.002094f, +0.002904f} + }, + { + {+0.111605f, -0.013530f, -0.000652f}, + {-0.246690f, -0.016108f, +0.001020f}, + {+0.413977f, +0.038179f, -0.009520f}, + {+0.203190f, +0.017508f, -0.002191f}, + {+0.268601f, +0.003682f, -0.001755f}, + {+0.196136f, +0.036857f, -0.009761f}, + {+0.402137f, -0.026686f, -0.005055f}, + {+0.145035f, -0.035432f, -0.001365f}, + {+0.074946f, +0.007868f, +0.004954f} + }, + { + {+0.176108f, +0.013431f, -0.000958f}, + {-0.185298f, +0.016846f, +0.004677f}, + {+0.286889f, -0.019450f, -0.007487f}, + {+0.153787f, -0.015814f, -0.006505f}, + {+0.239195f, -0.011851f, -0.001930f}, + {+0.042102f, -0.023553f, -0.004947f}, + {+0.470133f, +0.012898f, -0.003624f}, + {+0.270107f, +0.025928f, -0.000154f}, + {+0.059116f, -0.020434f, -0.003101f} + }, + { + {+0.234033f, -0.013522f, -0.000160f}, + {-0.105917f, -0.008837f, +0.002769f}, + {+0.184987f, +0.008247f, -0.000624f}, + {+0.076510f, +0.005900f, -0.001804f}, + {+0.166708f, +0.022644f, -0.001485f}, + {-0.112604f, +0.020438f, +0.005184f}, + {+0.450824f, +0.006092f, +0.002002f}, + {+0.374333f, -0.013645f, -0.004183f}, + {+0.050668f, -0.002470f, -0.009849f} + }, + { + {+0.280701f, +0.008633f, +0.001045f}, + {-0.002220f, +0.016553f, -0.003998f}, + {+0.131643f, -0.003842f, +0.001872f}, + {-0.015690f, -0.016479f, +0.005047f}, + {+0.077685f, -0.023492f, -0.003551f}, + {-0.223388f, -0.024340f, +0.007042f}, + {+0.346787f, -0.042038f, +0.003586f}, + {+0.418985f, +0.005219f, -0.005591f}, + {+0.040023f, +0.024273f, +0.000362f} + }, + { + {+0.315972f, -0.002222f, +0.000114f}, + {+0.123110f, -0.036764f, -0.004764f}, + {+0.119199f, -0.002064f, +0.000988f}, + {-0.106689f, +0.025325f, +0.004605f}, + {-0.000310f, +0.007517f, -0.002748f}, + {-0.262374f, +0.010338f, +0.000067f}, + {+0.204029f, +0.052292f, -0.005305f}, + {+0.380172f, +0.016758f, -0.003741f}, + {+0.003388f, +0.008217f, +0.011667f} + }, + { + {+0.346296f, +0.003536f, -0.001898f}, + {+0.248976f, +0.036524f, +0.001389f}, + {+0.120849f, +0.002931f, +0.000722f}, + {-0.173186f, -0.016622f, +0.000289f}, + {-0.054827f, -0.000181f, +0.002418f}, + {-0.225358f, +0.023135f, -0.002820f}, + {+0.091375f, -0.014867f, -0.010230f}, + {+0.260139f, -0.034357f, -0.002468f}, + {-0.068405f, -0.042485f, +0.005111f} + }, + { + {+0.379862f, -0.009494f, -0.001961f}, + {+0.345947f, -0.013885f, +0.004347f}, + {+0.108945f, +0.001609f, +0.002277f}, + {-0.194971f, -0.005237f, -0.000216f}, + {-0.090631f, +0.007307f, +0.004497f}, + {-0.139916f, -0.036851f, +0.003429f}, + {+0.049457f, -0.016676f, -0.004125f}, + {+0.089658f, +0.040648f, -0.001276f}, + {-0.147747f, +0.028109f, -0.006357f} + }, + { + {+0.419521f, +0.011992f, -0.000293f}, + {+0.399888f, -0.006995f, -0.000613f}, + {+0.071268f, -0.013451f, +0.003383f}, + {-0.169244f, +0.016170f, +0.002968f}, + {-0.116230f, -0.009802f, +0.001756f}, + {-0.053621f, +0.017175f, +0.008163f}, + {+0.065166f, +0.025359f, +0.005381f}, + {-0.086447f, -0.037823f, -0.001051f}, + {-0.194782f, +0.007204f, -0.005393f} + }, + { + {+0.461674f, -0.009238f, +0.000744f}, + {+0.422873f, +0.002942f, -0.006024f}, + {+0.017965f, +0.019932f, +0.001068f}, + {-0.112940f, -0.014296f, +0.003691f}, + {-0.135675f, +0.004946f, -0.000913f}, + {-0.001359f, +0.007810f, +0.003619f}, + {+0.090834f, -0.000688f, +0.008234f}, + {-0.227027f, +0.020653f, -0.000262f}, + {-0.193552f, -0.020886f, +0.003761f} + }, + { + {+0.500543f, +0.004460f, -0.000339f}, + {+0.438946f, +0.008173f, -0.005382f}, + {-0.025063f, -0.012096f, -0.002727f}, + {-0.048264f, +0.016297f, +0.004137f}, + {-0.148356f, +0.006714f, +0.001928f}, + {+0.016069f, -0.011271f, -0.004203f}, + {+0.085225f, -0.019738f, +0.001763f}, + {-0.310418f, -0.002136f, +0.003576f}, + {-0.158213f, +0.011793f, +0.008536f} + }, + { + {+0.533110f, -0.005084f, -0.001776f}, + {+0.463561f, -0.015347f, -0.000549f}, + {-0.035070f, -0.007804f, -0.002842f}, + {+0.008595f, -0.003050f, +0.002916f}, + {-0.153491f, +0.002287f, +0.004867f}, + {+0.021318f, +0.000337f, -0.007722f}, + {+0.040490f, +0.023364f, -0.005685f}, + {-0.339640f, -0.004014f, +0.007635f}, + {-0.113068f, +0.002471f, +0.003970f} + }, + { + {+0.559507f, +0.006521f, -0.001337f}, + {+0.495821f, +0.006508f, +0.001808f}, + {-0.009393f, +0.020033f, +0.002230f}, + {+0.057093f, +0.005006f, -0.000599f}, + {-0.147824f, -0.005127f, +0.001599f}, + {+0.035200f, +0.017556f, -0.003623f}, + {-0.026148f, -0.010270f, -0.006517f}, + {-0.331865f, -0.002383f, +0.006123f}, + {-0.069791f, +0.006016f, -0.000948f} + }, + { + {+0.580524f, -0.004095f, -0.000494f}, + {+0.527187f, -0.003574f, +0.000131f}, + {+0.034392f, -0.012275f, +0.006324f}, + {+0.108521f, -0.008134f, -0.002780f}, + {-0.124651f, -0.003736f, -0.002434f}, + {+0.058607f, -0.013665f, +0.003392f}, + {-0.096848f, +0.005058f, -0.001324f}, + {-0.301438f, -0.004261f, +0.001796f}, + {-0.026983f, -0.008052f, -0.001333f} + }, + { + {+0.597812f, +0.002656f, -0.000522f}, + {+0.552363f, +0.003313f, -0.001014f}, + {+0.075214f, -0.005271f, +0.002238f}, + {+0.170571f, +0.018162f, -0.002847f}, + {-0.083934f, +0.017743f, -0.001407f}, + {+0.076846f, -0.004888f, +0.003003f}, + {-0.166265f, -0.007573f, +0.004024f}, + {-0.256165f, +0.011081f, +0.000547f}, + {+0.019750f, +0.010957f, -0.001327f} + }, + { + {+0.613921f, -0.002403f, -0.000945f}, + {+0.571681f, -0.004061f, -0.000722f}, + {+0.106010f, -0.000496f, -0.004030f}, + {+0.238299f, -0.018447f, -0.000821f}, + {-0.038282f, -0.014684f, +0.002501f}, + {+0.080622f, +0.007409f, -0.002126f}, + {-0.235224f, +0.017619f, +0.005449f}, + {-0.203255f, -0.012695f, +0.000929f}, + {+0.070865f, -0.011018f, -0.001639f} + }, + { + {+0.630982f, +0.003698f, -0.001234f}, + {+0.590355f, +0.003219f, -0.000406f}, + {+0.130676f, +0.011921f, -0.002723f}, + {+0.295756f, +0.013516f, +0.001143f}, + {-0.005092f, +0.003596f, +0.003545f}, + {+0.072459f, +0.000272f, -0.002800f}, + {-0.299780f, -0.022696f, +0.001211f}, + {-0.150313f, +0.011501f, +0.001280f}, + {+0.118367f, +0.011753f, -0.001359f} + }, + { + {+0.649444f, -0.004884f, -0.000984f}, + {+0.615054f, -0.005408f, -0.000735f}, + {+0.149940f, -0.006453f, +0.001164f}, + {+0.328584f, -0.000395f, +0.001275f}, + {+0.008438f, +0.005199f, +0.001454f}, + {+0.058218f, -0.000064f, +0.000029f}, + {-0.346981f, +0.007071f, -0.001972f}, + {-0.104327f, -0.007957f, +0.001209f}, + {+0.149121f, -0.004220f, -0.000790f} + }, + { + {+0.667442f, +0.004369f, -0.000509f}, + {+0.649912f, +0.008091f, -0.001108f}, + {+0.160941f, -0.003110f, +0.000358f}, + {+0.335024f, -0.007340f, -0.001370f}, + {+0.010516f, -0.004138f, -0.001016f}, + {+0.042559f, -0.003980f, +0.001022f}, + {-0.366888f, +0.007198f, +0.001062f}, + {-0.068558f, +0.004871f, +0.000722f}, + {+0.153026f, -0.002598f, -0.000878f} + }, + { + {+0.682283f, -0.002839f, -0.000182f}, + {+0.693711f, -0.010677f, -0.001270f}, + {+0.163061f, +0.001749f, -0.001941f}, + {+0.327679f, +0.004372f, -0.003551f}, + {+0.017128f, -0.001449f, -0.002254f}, + {+0.029387f, +0.003404f, +0.000254f}, + {-0.363800f, -0.005157f, +0.004344f}, + {-0.041106f, -0.002019f, -0.000551f}, + {+0.130106f, +0.008236f, -0.000670f} + }, + { + {+0.692437f, +0.000095f, -0.000537f}, + {+0.740634f, +0.011604f, -0.000655f}, + {+0.157996f, +0.002060f, -0.000837f}, + {+0.323158f, +0.005481f, -0.001955f}, + {+0.039932f, +0.012585f, -0.000817f}, + {+0.021634f, -0.000010f, +0.000230f}, + {-0.350228f, -0.000420f, +0.003173f}, + {-0.016658f, +0.005630f, -0.001178f}, + {+0.089943f, -0.012079f, -0.001069f} + }, + { + {+0.698662f, +0.000230f, -0.001425f}, + {+0.782838f, -0.007193f, -0.000387f}, + {+0.147754f, +0.002321f, +0.001054f}, + {+0.330876f, -0.007440f, +0.001734f}, + {+0.078436f, -0.014161f, +0.002562f}, + {+0.020690f, -0.001093f, +0.000930f}, + {-0.336354f, +0.000244f, +0.000495f}, + {+0.007725f, -0.004802f, -0.001236f}, + {+0.047620f, +0.008277f, -0.001417f} + }, + { + {+0.703246f, +0.002409f, -0.001250f}, + {+0.814977f, +0.003204f, -0.001382f}, + {+0.135217f, -0.009385f, -0.001169f}, + {+0.350177f, -0.000838f, +0.000877f}, + {+0.122288f, +0.004476f, +0.002216f}, + {+0.025713f, -0.002869f, -0.000621f}, + {-0.325782f, +0.004520f, +0.000748f}, + {+0.030650f, +0.008462f, -0.000266f}, + {+0.015647f, -0.003005f, -0.000601f} + }, + { + {+0.707436f, -0.002159f, -0.000184f}, + {+0.836328f, -0.001420f, -0.002805f}, + {+0.124343f, +0.003534f, -0.004617f}, + {+0.377173f, -0.003128f, -0.002966f}, + {+0.162938f, -0.001908f, -0.001890f}, + {+0.034346f, -0.001148f, -0.003196f}, + {-0.317600f, -0.001145f, +0.002065f}, + {+0.047783f, -0.002726f, +0.001091f}, + {-0.001518f, -0.002014f, +0.001386f} + }, + { + {+0.711316f, +0.000190f, +0.000116f}, + {+0.849400f, +0.005461f, -0.002132f}, + {+0.115220f, +0.006522f, -0.002677f}, + {+0.406205f, +0.009733f, -0.003200f}, + {+0.198229f, +0.008830f, -0.003296f}, + {+0.041723f, +0.007295f, -0.001797f}, + {-0.307751f, -0.000513f, +0.001061f}, + {+0.056384f, -0.001852f, +0.000252f}, + {-0.007409f, -0.002688f, +0.001636f} + }, + { + {+0.715564f, +0.000878f, -0.000712f}, + {+0.856145f, -0.001865f, -0.000304f}, + {+0.099717f, +0.000516f, +0.001510f}, + {+0.427792f, -0.008621f, -0.000103f}, + {+0.227122f, -0.009743f, -0.000742f}, + {+0.038969f, +0.000573f, +0.000890f}, + {-0.290500f, -0.003837f, -0.000282f}, + {+0.060351f, +0.002258f, -0.001388f}, + {-0.007102f, +0.000681f, +0.000051f} + }, + { + {+0.721724f, +0.001440f, -0.001419f}, + {+0.857928f, -0.002494f, -0.000723f}, + {+0.068940f, -0.015230f, +0.000407f}, + {+0.432906f, -0.004606f, +0.000685f}, + {+0.246924f, +0.000678f, +0.000115f}, + {+0.019686f, -0.012823f, -0.000958f}, + {-0.263371f, +0.009394f, +0.000248f}, + {+0.066836f, +0.001658f, -0.002275f}, + {-0.003255f, +0.001689f, -0.000037f} + }, + { + {+0.730712f, -0.003910f, -0.000870f}, + {+0.858450f, +0.001220f, -0.001946f}, + {+0.023475f, +0.016216f, -0.003883f}, + {+0.419872f, +0.011121f, -0.002752f}, + {+0.256682f, +0.002820f, -0.002128f}, + {-0.013513f, +0.011639f, -0.004607f}, + {-0.229180f, -0.009683f, +0.001814f}, + {+0.080511f, -0.005798f, -0.001723f}, + {+0.001435f, +0.000756f, -0.000451f} + }, + { + {+0.741590f, +0.003101f, -0.000011f}, + {+0.860726f, -0.000300f, -0.002853f}, + {-0.028493f, -0.003694f, -0.002869f}, + {+0.395211f, -0.003270f, -0.003914f}, + {+0.257602f, +0.001422f, -0.002810f}, + {-0.053057f, -0.000570f, -0.002860f}, + {-0.193999f, +0.002947f, +0.000888f}, + {+0.099824f, +0.006425f, -0.000616f}, + {+0.005522f, +0.002697f, -0.000570f} + }, + { + {+0.752785f, -0.000581f, -0.000328f}, + {+0.864679f, -0.002652f, -0.003144f}, + {-0.079249f, -0.003995f, +0.005777f}, + {+0.366044f, -0.005911f, +0.001913f}, + {+0.251095f, -0.009072f, +0.002248f}, + {-0.092600f, -0.005125f, +0.005522f}, + {-0.162554f, -0.001717f, -0.002557f}, + {+0.119626f, -0.005564f, +0.000516f}, + {+0.008439f, -0.004393f, +0.001712f} + }, + { + {+0.763163f, -0.000862f, -0.002020f}, + {+0.868650f, +0.005188f, -0.001363f}, + {-0.122932f, -0.003612f, +0.014766f}, + {+0.337176f, +0.004705f, +0.011739f}, + {+0.240301f, +0.007676f, +0.011938f}, + {-0.125784f, -0.004581f, +0.013027f}, + {-0.137073f, +0.006965f, -0.003725f}, + {+0.136715f, +0.001962f, +0.001072f}, + {+0.010881f, +0.001506f, +0.004158f} + } +}; +const float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +{ + { + {-0.067351f, +0.619497f, -0.224314f}, + {-0.139294f, +0.771571f, -0.258097f}, + {-0.003713f, +0.028657f, -0.008450f}, + {-0.024048f, +0.069155f, -0.020553f}, + {-0.025678f, -0.026025f, +0.019233f}, + {-0.009936f, -0.011063f, +0.007565f}, + {+0.034483f, +0.043638f, -0.029489f}, + {+0.006138f, -0.086263f, +0.038216f}, + {+0.046480f, +0.249243f, -0.117268f} + }, + { + {+0.012648f, +0.734658f, -0.184512f}, + {-0.111037f, +0.538674f, -0.336987f}, + {-0.002627f, -0.020803f, -0.029183f}, + {-0.030921f, +0.004858f, -0.041299f}, + {-0.051115f, -0.078198f, +0.009636f}, + {-0.016252f, -0.028855f, +0.008268f}, + {+0.084591f, +0.153968f, -0.000650f}, + {-0.017068f, -0.206982f, -0.012636f}, + {+0.164507f, +0.469681f, -0.054789f} + }, + { + {+0.223221f, -0.320495f, +0.172323f}, + {+0.327663f, -0.928806f, +0.128055f}, + {+0.019358f, -0.074304f, -0.015400f}, + {+0.035210f, -0.082508f, -0.021387f}, + {-0.001915f, +0.019754f, -0.041779f}, + {+0.009482f, -0.004447f, -0.006672f}, + {+0.039341f, +0.054366f, +0.052326f}, + {-0.015501f, -0.146235f, -0.037803f}, + {+0.140215f, +0.011558f, +0.133087f} + }, + { + {+0.158118f, -0.393316f, +0.132368f}, + {+0.546868f, -0.311888f, +0.284518f}, + {+0.031012f, +0.036496f, +0.023744f}, + {+0.107357f, +0.078785f, +0.019930f}, + {+0.117669f, +0.168393f, -0.014741f}, + {+0.063269f, +0.132935f, +0.029018f}, + {-0.110215f, -0.232883f, -0.026283f}, + {+0.026325f, -0.007643f, +0.015801f}, + {-0.156350f, -0.444539f, +0.006974f} + }, + { + {-0.158057f, +0.298412f, -0.065118f}, + {+0.180062f, +0.634611f, -0.013767f}, + {-0.011461f, +0.071086f, +0.018569f}, + {+0.074813f, +0.048439f, +0.032538f}, + {+0.176343f, -0.017086f, +0.039934f}, + {+0.070878f, +0.087909f, +0.042882f}, + {-0.196698f, -0.095181f, -0.059079f}, + {+0.043237f, +0.006669f, +0.001955f}, + {-0.440379f, +0.000452f, -0.098398f} + }, + { + {-0.449468f, +0.042993f, -0.088093f}, + {-0.450454f, -0.142745f, -0.162071f}, + {-0.082857f, -0.081326f, -0.023342f}, + {-0.091693f, -0.115333f, +0.002878f}, + {+0.059625f, -0.113643f, +0.022660f}, + {+0.002551f, -0.114733f, -0.021413f}, + {-0.134830f, +0.127944f, +0.015214f}, + {+0.039406f, -0.002734f, -0.000806f}, + {-0.456803f, +0.175205f, -0.017055f} + }, + { + {-0.521027f, -0.156261f, +0.000350f}, + {-0.908889f, -0.180570f, -0.051670f}, + {-0.108770f, -0.053291f, -0.027241f}, + {-0.287995f, +0.046150f, -0.015860f}, + {-0.175042f, +0.108856f, -0.012453f}, + {-0.059786f, -0.044325f, -0.033874f}, + {-0.008998f, -0.011671f, +0.039397f}, + {+0.004422f, -0.001021f, +0.005255f}, + {-0.225556f, -0.103116f, +0.036951f} + }, + { + {-0.371766f, +0.087065f, +0.052523f}, + {-1.010425f, +0.130810f, +0.067243f}, + {-0.070822f, +0.064314f, +0.008682f}, + {-0.381257f, -0.000635f, -0.013290f}, + {-0.375703f, -0.033440f, -0.023774f}, + {-0.081888f, +0.060050f, +0.009146f}, + {+0.099530f, -0.054172f, +0.002402f}, + {-0.055187f, -0.030383f, +0.004615f}, + {+0.113698f, +0.047344f, +0.023699f} + }, + { + {-0.133153f, +0.006407f, +0.034476f}, + {-0.837054f, +0.001398f, +0.067755f}, + {-0.019596f, -0.013995f, +0.025797f}, + {-0.306127f, -0.073720f, -0.002010f}, + {-0.417535f, -0.051347f, -0.011222f}, + {-0.096752f, +0.015410f, +0.024298f}, + {+0.165604f, -0.014311f, -0.020675f}, + {-0.110129f, +0.012754f, -0.001173f}, + {+0.396896f, -0.022479f, +0.001703f} + }, + { + {+0.076154f, -0.015041f, -0.005731f}, + {-0.558795f, -0.016178f, +0.011329f}, + {+0.001783f, -0.050805f, +0.008376f}, + {-0.100163f, +0.081596f, +0.016700f}, + {-0.287003f, +0.097687f, +0.016950f}, + {-0.130328f, -0.051441f, +0.002818f}, + {+0.194137f, +0.028286f, -0.006100f}, + {-0.128998f, -0.007273f, -0.004964f}, + {+0.525370f, -0.013001f, -0.010543f} + }, + { + {+0.227729f, -0.027128f, -0.019508f}, + {-0.280803f, -0.046474f, -0.016340f}, + {+0.006184f, +0.007629f, -0.010663f}, + {+0.124161f, -0.022132f, +0.014831f}, + {-0.082170f, -0.023992f, +0.023358f}, + {-0.168199f, +0.000379f, -0.008102f}, + {+0.185287f, +0.007140f, +0.002454f}, + {-0.098830f, -0.034738f, -0.000610f}, + {+0.505599f, +0.024919f, -0.016122f} + }, + { + {+0.345183f, +0.044417f, -0.008489f}, + {-0.029206f, +0.069971f, -0.008062f}, + {+0.040780f, +0.025656f, -0.005557f}, + {+0.280661f, +0.000086f, -0.001939f}, + {+0.091189f, -0.001516f, +0.001765f}, + {-0.178051f, +0.018186f, +0.003683f}, + {+0.147526f, -0.011735f, +0.000472f}, + {-0.034700f, +0.017373f, +0.007552f}, + {+0.404231f, -0.018810f, -0.013580f} + }, + { + {+0.447376f, -0.029945f, +0.002359f}, + {+0.196485f, -0.048776f, +0.000528f}, + {+0.131413f, -0.031345f, +0.001264f}, + {+0.352086f, -0.000092f, -0.009252f}, + {+0.196164f, -0.010102f, -0.008244f}, + {-0.137927f, -0.001411f, +0.005445f}, + {+0.094224f, +0.013361f, +0.000776f}, + {+0.030220f, +0.002376f, +0.001349f}, + {+0.282599f, +0.004869f, -0.002937f} + }, + { + {+0.532898f, +0.008836f, +0.002166f}, + {+0.392609f, +0.034792f, -0.000679f}, + {+0.270895f, +0.030297f, -0.000156f}, + {+0.364913f, -0.004283f, -0.009820f}, + {+0.243967f, +0.002627f, -0.007384f}, + {-0.037047f, +0.017787f, -0.004491f}, + {+0.041930f, -0.015182f, -0.000239f}, + {+0.078287f, +0.007042f, -0.004821f}, + {+0.167608f, -0.019027f, +0.005545f} + }, + { + {+0.594888f, -0.002438f, -0.003208f}, + {+0.547092f, -0.023930f, -0.003204f}, + {+0.418638f, -0.023295f, -0.006545f}, + {+0.358947f, -0.011193f, -0.005371f}, + {+0.268043f, -0.007992f, -0.005934f}, + {+0.108159f, -0.040803f, -0.007847f}, + {+0.014237f, +0.000657f, -0.000908f}, + {+0.104780f, -0.013359f, -0.000511f}, + {+0.064568f, +0.028680f, +0.003338f} + }, + { + {+0.635005f, +0.006702f, -0.005006f}, + {+0.650934f, +0.013984f, -0.004474f}, + {+0.519015f, +0.020899f, -0.008786f}, + {+0.354058f, +0.000065f, -0.000944f}, + {+0.293166f, +0.009243f, -0.003786f}, + {+0.244478f, +0.036317f, -0.004273f}, + {+0.027137f, +0.008991f, +0.000305f}, + {+0.112434f, -0.002933f, +0.003310f}, + {-0.019782f, -0.018420f, -0.000608f} + }, + { + {+0.661388f, -0.006850f, -0.003249f}, + {+0.709859f, -0.007935f, -0.004126f}, + {+0.524557f, -0.002414f, -0.002080f}, + {+0.344994f, +0.003888f, -0.002639f}, + {+0.316812f, -0.006036f, -0.003412f}, + {+0.307717f, -0.012550f, +0.001272f}, + {+0.076841f, -0.011681f, -0.000880f}, + {+0.115864f, +0.008381f, -0.000189f}, + {-0.078312f, +0.007256f, -0.000761f} + }, + { + {+0.681780f, +0.004317f, -0.002114f}, + {+0.740600f, +0.002506f, -0.003738f}, + {+0.416864f, -0.038264f, +0.003168f}, + {+0.319577f, -0.000792f, -0.001313f}, + {+0.319873f, +0.002666f, -0.002245f}, + {+0.258538f, -0.029824f, +0.003409f}, + {+0.141548f, +0.012818f, -0.003839f}, + {+0.135337f, +0.001218f, -0.005061f}, + {-0.109830f, +0.001645f, +0.001441f} + }, + { + {+0.699871f, -0.003221f, -0.002308f}, + {+0.762514f, -0.004609f, -0.003814f}, + {+0.225434f, +0.064939f, -0.001450f}, + {+0.266431f, +0.012897f, +0.002255f}, + {+0.282175f, +0.010311f, +0.000422f}, + {+0.108713f, +0.058556f, -0.002399f}, + {+0.186968f, -0.009396f, -0.004807f}, + {+0.178376f, -0.016506f, -0.006062f}, + {-0.120383f, -0.003023f, +0.004088f} + }, + { + {+0.714529f, +0.003253f, -0.002414f}, + {+0.790696f, +0.011388f, -0.001985f}, + {+0.020833f, -0.046458f, -0.007156f}, + {+0.185944f, -0.029249f, +0.000016f}, + {+0.197551f, -0.028731f, -0.000138f}, + {-0.079181f, -0.043101f, -0.006863f}, + {+0.176963f, -0.004258f, -0.002861f}, + {+0.228839f, +0.021085f, -0.002090f}, + {-0.119574f, -0.002646f, +0.004158f} + }, + { + {+0.721602f, -0.001258f, -0.002069f}, + {+0.831027f, -0.010846f, +0.000173f}, + {-0.126177f, +0.009153f, -0.003439f}, + {+0.096173f, +0.020892f, -0.003906f}, + {+0.084227f, +0.027335f, -0.001653f}, + {-0.229925f, +0.010207f, -0.000875f}, + {+0.090658f, +0.023511f, +0.000256f}, + {+0.250703f, +0.000323f, +0.000133f}, + {-0.115659f, +0.011998f, -0.001947f} + }, + { + {+0.717593f, -0.001188f, -0.001513f}, + {+0.881199f, +0.003795f, -0.002266f}, + {-0.186085f, +0.008805f, +0.004207f}, + {+0.021886f, +0.000682f, +0.000980f}, + {-0.024639f, -0.019808f, -0.000274f}, + {-0.296639f, +0.006775f, +0.008463f}, + {-0.060930f, -0.036828f, +0.003817f}, + {+0.210581f, -0.022700f, -0.003357f}, + {-0.112881f, +0.004715f, -0.006188f} + }, + { + {+0.702872f, +0.004202f, -0.000899f}, + {+0.934393f, -0.006557f, -0.007476f}, + {-0.176147f, -0.010014f, +0.006716f}, + {-0.022135f, +0.003624f, +0.007346f}, + {-0.100594f, +0.012448f, +0.000135f}, + {-0.271960f, -0.005598f, +0.007977f}, + {-0.233701f, +0.046766f, +0.003616f}, + {+0.101020f, +0.023227f, -0.002321f}, + {-0.116785f, -0.020405f, +0.002997f} + }, + { + {+0.682250f, -0.007566f, -0.001501f}, + {+0.978417f, +0.017585f, -0.006636f}, + {-0.137592f, +0.005047f, +0.003880f}, + {-0.028458f, -0.006826f, +0.004609f}, + {-0.129898f, +0.005880f, +0.001391f}, + {-0.175874f, +0.016526f, -0.001013f}, + {-0.367276f, -0.033929f, -0.002775f}, + {-0.060514f, -0.037887f, +0.002465f}, + {-0.137333f, -0.006964f, +0.011955f} + }, + { + {+0.663415f, +0.004606f, -0.002781f}, + {+0.993852f, -0.009178f, +0.000038f}, + {-0.108250f, -0.003270f, +0.001437f}, + {+0.009848f, -0.008477f, -0.000681f}, + {-0.118923f, -0.012268f, +0.005212f}, + {-0.044501f, -0.037572f, -0.003962f}, + {-0.416290f, -0.006378f, -0.006076f}, + {-0.236610f, +0.040350f, +0.002858f}, + {-0.168887f, +0.032800f, +0.004036f} + }, + { + {+0.651781f, +0.001152f, -0.002457f}, + {+0.965546f, -0.016499f, +0.002125f}, + {-0.105651f, -0.001646f, +0.002481f}, + {+0.090167f, +0.025763f, -0.001130f}, + {-0.087686f, +0.003999f, +0.005549f}, + {+0.075223f, +0.035790f, +0.002847f}, + {-0.383115f, +0.037796f, +0.001566f}, + {-0.378556f, -0.025237f, +0.002287f}, + {-0.179845f, -0.008941f, -0.008124f} + }, + { + {+0.645685f, -0.002682f, -0.000593f}, + {+0.900401f, +0.029783f, -0.003285f}, + {-0.124380f, +0.012275f, +0.001822f}, + {+0.193225f, -0.027406f, +0.000945f}, + {-0.052400f, +0.001580f, +0.000684f}, + {+0.141411f, +0.002262f, +0.004491f}, + {-0.319576f, -0.023501f, +0.010635f}, + {-0.448327f, +0.001574f, +0.004044f}, + {-0.141908f, -0.032139f, -0.005596f} + }, + { + {+0.638137f, -0.002412f, +0.000310f}, + {+0.826423f, -0.017144f, -0.007574f}, + {-0.140725f, -0.006104f, -0.000815f}, + {+0.290930f, +0.019453f, +0.001904f}, + {-0.016875f, +0.009182f, -0.001656f}, + {+0.145675f, -0.017736f, -0.001807f}, + {-0.285941f, -0.010851f, +0.008570f}, + {-0.435070f, +0.011023f, +0.004307f}, + {-0.062178f, +0.036767f, +0.005654f} + }, + { + {+0.623287f, +0.007299f, -0.001056f}, + {+0.770521f, -0.001075f, -0.004559f}, + {-0.130645f, -0.003274f, -0.002902f}, + {+0.361351f, -0.005902f, +0.000348f}, + {+0.020477f, -0.011841f, +0.000752f}, + {+0.114514f, +0.018145f, -0.007488f}, + {-0.305625f, +0.026256f, -0.000446f}, + {-0.353862f, -0.030431f, +0.004835f}, + {+0.024417f, -0.010793f, +0.007820f} + }, + { + {+0.600902f, -0.006021f, -0.002348f}, + {+0.739248f, +0.005015f, +0.001571f}, + {-0.087167f, +0.021027f, -0.001847f}, + {+0.400187f, +0.000286f, -0.002317f}, + {+0.060945f, +0.009244f, +0.002589f}, + {+0.083328f, +0.001928f, -0.007725f}, + {-0.359405f, -0.019595f, -0.006438f}, + {-0.237042f, +0.027090f, +0.006659f}, + {+0.089013f, -0.004244f, -0.000128f} + }, + { + {+0.574438f, +0.003368f, -0.001494f}, + {+0.720431f, +0.005878f, +0.002928f}, + {-0.025553f, -0.022088f, +0.002875f}, + {+0.419048f, +0.001480f, -0.004334f}, + {+0.105303f, -0.000852f, -0.000385f}, + {+0.070507f, -0.013892f, -0.000793f}, + {-0.411663f, -0.001662f, -0.003755f}, + {-0.118815f, -0.013893f, +0.002937f}, + {+0.127181f, -0.002212f, -0.005490f} + }, + { + {+0.546941f, -0.004959f, -0.000239f}, + {+0.700235f, -0.009986f, -0.000285f}, + {+0.026874f, +0.006811f, +0.004565f}, + {+0.432826f, +0.004148f, -0.005149f}, + {+0.153860f, +0.009932f, -0.004309f}, + {+0.067445f, +0.005555f, +0.005512f}, + {-0.441084f, +0.007824f, +0.003852f}, + {-0.016912f, +0.012081f, -0.003174f}, + {+0.148914f, +0.007013f, -0.004323f} + }, + { + {+0.520436f, +0.006384f, -0.000382f}, + {+0.674657f, +0.006620f, -0.001998f}, + {+0.052406f, +0.010142f, -0.000198f}, + {+0.447102f, -0.009070f, -0.003159f}, + {+0.202135f, -0.018081f, -0.002032f}, + {+0.055887f, +0.014144f, +0.003615f}, + {-0.448314f, -0.001324f, +0.007309f}, + {+0.065957f, -0.020607f, -0.003258f}, + {+0.162472f, -0.004875f, -0.002127f} + }, + { + {+0.496665f, -0.004859f, -0.000887f}, + {+0.647428f, -0.004741f, -0.001434f}, + {+0.053060f, -0.007546f, -0.006118f}, + {+0.453309f, +0.004051f, -0.000324f}, + {+0.237178f, +0.009221f, +0.002058f}, + {+0.029969f, -0.014850f, -0.002643f}, + {-0.439805f, -0.002523f, +0.005619f}, + {+0.128558f, +0.010056f, -0.001511f}, + {+0.167737f, +0.001236f, -0.001456f} + }, + { + {+0.475983f, +0.003710f, -0.000970f}, + {+0.624608f, +0.003603f, -0.000812f}, + {+0.042149f, -0.008534f, -0.003432f}, + {+0.438672f, +0.005526f, +0.000965f}, + {+0.249063f, +0.004782f, +0.002016f}, + {-0.000807f, +0.001028f, -0.002841f}, + {-0.416440f, +0.003745f, +0.000359f}, + {+0.170217f, -0.009457f, -0.000867f}, + {+0.158107f, +0.002167f, -0.000901f} + }, + { + {+0.456962f, -0.002559f, -0.000574f}, + {+0.609653f, -0.002905f, -0.001117f}, + {+0.025784f, -0.000666f, +0.002060f}, + {+0.399694f, -0.014955f, +0.000161f}, + {+0.242149f, -0.009905f, -0.001262f}, + {-0.026686f, +0.000156f, +0.001218f}, + {-0.373014f, +0.013273f, -0.002730f}, + {+0.191984f, -0.000973f, -0.000838f}, + {+0.127455f, -0.008313f, +0.000023f} + }, + { + {+0.437008f, +0.003925f, -0.000081f}, + {+0.601093f, +0.000232f, -0.001372f}, + {+0.002960f, +0.010345f, +0.001054f}, + {+0.347170f, +0.016956f, -0.002319f}, + {+0.233004f, +0.002825f, -0.003373f}, + {-0.044339f, +0.004384f, +0.002020f}, + {-0.309506f, -0.024368f, +0.000882f}, + {+0.198003f, -0.000405f, -0.001486f}, + {+0.077236f, +0.014350f, -0.000034f} + }, + { + {+0.414109f, -0.005431f, -0.000037f}, + {+0.592705f, -0.001470f, -0.001222f}, + {-0.024584f, -0.008451f, -0.001721f}, + {+0.300043f, -0.007510f, -0.003376f}, + {+0.236922f, +0.005189f, -0.002904f}, + {-0.053435f, -0.002953f, +0.000365f}, + {-0.239443f, +0.015553f, +0.003945f}, + {+0.195817f, -0.003961f, -0.001987f}, + {+0.019225f, -0.012398f, -0.000024f} + }, + { + {+0.388577f, +0.006627f, -0.000411f}, + {+0.576851f, +0.002898f, -0.000753f}, + {-0.052952f, +0.001666f, -0.000781f}, + {+0.271771f, -0.002315f, -0.001136f}, + {+0.256751f, -0.010892f, -0.000933f}, + {-0.055321f, -0.000623f, -0.000321f}, + {-0.178829f, -0.004699f, +0.001577f}, + {+0.192108f, -0.001841f, -0.002156f}, + {-0.030601f, +0.010281f, +0.000029f} + }, + { + {+0.362659f, -0.006023f, -0.001007f}, + {+0.548393f, -0.008477f, -0.000553f}, + {-0.079254f, -0.004768f, +0.001192f}, + {+0.262246f, +0.003901f, +0.002002f}, + {+0.282691f, +0.009035f, +0.001549f}, + {-0.052737f, +0.001616f, +0.000062f}, + {-0.134033f, +0.004191f, -0.001751f}, + {+0.189322f, +0.000295f, -0.001194f}, + {-0.059659f, -0.002213f, -0.000053f} + }, + { + {+0.339002f, +0.002927f, -0.000712f}, + {+0.507223f, +0.011672f, -0.001408f}, + {-0.101892f, +0.008754f, -0.000366f}, + {+0.261016f, +0.005455f, +0.000964f}, + {+0.300336f, +0.003329f, +0.000659f}, + {-0.049601f, +0.001946f, -0.000746f}, + {-0.101681f, -0.008021f, -0.001522f}, + {+0.184646f, -0.000891f, -0.000474f}, + {-0.064232f, -0.004100f, +0.000831f} + }, + { + {+0.318447f, -0.002583f, +0.000342f}, + {+0.458166f, -0.011334f, -0.002134f}, + {-0.119857f, -0.003793f, -0.002673f}, + {+0.257649f, -0.004527f, -0.002750f}, + {+0.302642f, -0.006786f, -0.003304f}, + {-0.050079f, -0.001140f, -0.002294f}, + {-0.075154f, +0.006079f, +0.000154f}, + {+0.175259f, -0.002462f, +0.000450f}, + {-0.050689f, +0.006815f, +0.002112f} + }, + { + {+0.300124f, +0.004647f, +0.000429f}, + {+0.407177f, +0.007551f, -0.001229f}, + {-0.135280f, -0.004904f, -0.000353f}, + {+0.246029f, -0.001362f, -0.002342f}, + {+0.292460f, +0.000038f, -0.003938f}, + {-0.057770f, -0.002994f, -0.000700f}, + {-0.048950f, -0.002677f, -0.000542f}, + {+0.161196f, +0.006930f, -0.000490f}, + {-0.030107f, -0.002304f, +0.001927f} + }, + { + {+0.283695f, -0.004672f, -0.000499f}, + {+0.357931f, -0.007644f, +0.000792f}, + {-0.154465f, -0.001114f, +0.004046f}, + {+0.221394f, -0.002251f, +0.001225f}, + {+0.274104f, +0.001365f, -0.000312f}, + {-0.076006f, -0.003175f, +0.002372f}, + {-0.019797f, +0.006502f, -0.001827f}, + {+0.147944f, -0.003560f, -0.001898f}, + {-0.011081f, -0.000127f, -0.000375f} + }, + { + {+0.269518f, +0.002457f, -0.001001f}, + {+0.311326f, +0.012837f, +0.000327f}, + {-0.181319f, +0.014112f, +0.003014f}, + {+0.182651f, +0.012951f, +0.002036f}, + {+0.248875f, +0.007948f, +0.001266f}, + {-0.104063f, +0.013233f, +0.001219f}, + {+0.010928f, -0.008987f, -0.001152f}, + {+0.141371f, -0.000838f, -0.001781f}, + {+0.004297f, -0.004808f, -0.000787f} + }, + { + {+0.257138f, -0.000471f, -0.000295f}, + {+0.269065f, -0.008971f, -0.001327f}, + {-0.209242f, -0.009445f, -0.000789f}, + {+0.136359f, -0.015642f, -0.000837f}, + {+0.218917f, -0.009939f, -0.000695f}, + {-0.133100f, -0.007332f, -0.001415f}, + {+0.037336f, +0.006071f, +0.000081f}, + {+0.141848f, +0.003924f, -0.000450f}, + {+0.015759f, +0.001304f, -0.000104f} + }, + { + {+0.244594f, +0.002255f, +0.000537f}, + {+0.232039f, +0.006188f, -0.001385f}, + {-0.226456f, -0.005183f, +0.000708f}, + {+0.094177f, +0.004239f, -0.001379f}, + {+0.188550f, +0.003755f, -0.001033f}, + {-0.152408f, -0.005083f, +0.000982f}, + {+0.053373f, +0.001503f, -0.000759f}, + {+0.144008f, -0.001965f, +0.000959f}, + {+0.023577f, -0.002308f, -0.000076f} + }, + { + {+0.229867f, -0.004876f, +0.000170f}, + {+0.197603f, -0.004728f, -0.000560f}, + {-0.226600f, +0.010780f, +0.006854f}, + {+0.064221f, +0.003891f, +0.003122f}, + {+0.161189f, +0.001104f, +0.002261f}, + {-0.157190f, +0.008241f, +0.006888f}, + {+0.056895f, -0.003410f, -0.003127f}, + {+0.141412f, -0.001071f, +0.001644f}, + {+0.029485f, +0.003593f, +0.001358f} + }, + { + {+0.212288f, +0.005142f, -0.000800f}, + {+0.162483f, +0.004117f, +0.001433f}, + {-0.209328f, -0.002547f, +0.009702f}, + {+0.048193f, +0.000129f, +0.007210f}, + {+0.139874f, +0.002121f, +0.005784f}, + {-0.146647f, +0.000237f, +0.009054f}, + {+0.049793f, -0.001403f, -0.002729f}, + {+0.132126f, +0.003164f, +0.002133f}, + {+0.035201f, -0.000152f, +0.002301f} + }, + { + {+0.191599f, -0.002871f, -0.000708f}, + {+0.125250f, -0.008746f, +0.003116f}, + {-0.175384f, -0.002970f, +0.005044f}, + {+0.046507f, -0.009000f, +0.004794f}, + {+0.128202f, -0.013178f, +0.002850f}, + {-0.120273f, -0.005762f, +0.003583f}, + {+0.034030f, -0.000067f, +0.000427f}, + {+0.118790f, -0.004116f, +0.002419f}, + {+0.044052f, -0.001094f, +0.001102f} + } +}; +const float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +{ + { + {+0.018159f, +0.985146f, +0.240506f}, + {-0.077046f, +0.024713f, -0.260411f}, + {+0.000593f, +0.132269f, +0.000009f}, + {+0.009213f, +0.054471f, +0.004257f}, + {-0.039823f, +0.044599f, +0.001606f}, + {-0.011090f, +0.028094f, -0.011739f}, + {-0.057613f, +0.083209f, +0.004522f}, + {+0.010244f, +0.028373f, -0.010969f}, + {-0.107601f, +0.182275f, +0.052385f} + }, + { + {-0.152534f, -0.329898f, -0.242342f}, + {+0.209786f, +1.273585f, +0.112026f}, + {-0.011413f, +0.080591f, -0.013524f}, + {-0.034221f, +0.013783f, +0.008826f}, + {+0.012372f, -0.014808f, -0.038195f}, + {-0.003235f, -0.083338f, -0.068446f}, + {+0.003314f, -0.032912f, -0.065265f}, + {+0.003322f, +0.076317f, +0.007937f}, + {-0.015189f, -0.220191f, -0.130843f} + }, + { + {-0.023093f, -0.558938f, -0.150964f}, + {+0.270176f, +0.589966f, +0.359432f}, + {-0.003260f, +0.097037f, -0.014970f}, + {-0.058519f, +0.107799f, -0.014627f}, + {+0.084143f, -0.174088f, +0.006734f}, + {+0.035814f, -0.281769f, +0.006166f}, + {+0.116511f, -0.307921f, +0.020292f}, + {-0.013401f, +0.086307f, +0.012981f}, + {+0.209526f, -0.554513f, -0.048661f} + }, + { + {+0.261551f, +0.304347f, +0.114032f}, + {-0.250896f, -0.779633f, -0.070356f}, + {+0.023786f, +0.088663f, -0.030815f}, + {+0.003407f, +0.082081f, -0.041209f}, + {+0.062118f, -0.047824f, +0.057239f}, + {+0.026013f, -0.155692f, +0.065882f}, + {+0.127095f, -0.164040f, +0.077176f}, + {-0.022006f, +0.035999f, -0.005698f}, + {+0.327951f, -0.045215f, +0.125831f} + }, + { + {+0.359497f, +0.205525f, +0.109865f}, + {-0.745384f, -0.051437f, -0.216054f}, + {+0.066207f, -0.076438f, +0.024748f}, + {+0.143496f, -0.123266f, +0.007838f}, + {-0.098368f, +0.139294f, +0.014972f}, + {-0.065224f, +0.122143f, -0.029816f}, + {-0.019520f, +0.163808f, -0.024174f}, + {+0.008568f, -0.024216f, +0.013284f}, + {+0.111141f, +0.311803f, +0.021197f} + }, + { + {+0.165159f, -0.254129f, -0.025534f}, + {-0.780421f, +0.408205f, -0.025264f}, + {+0.043262f, -0.082839f, +0.025956f}, + {+0.214774f, -0.021619f, +0.026192f}, + {-0.266921f, -0.073753f, -0.026414f}, + {-0.110056f, +0.068805f, -0.038706f}, + {-0.162323f, +0.018037f, -0.046919f}, + {+0.046582f, -0.024241f, +0.003856f}, + {-0.254154f, -0.105995f, -0.060073f} + }, + { + {-0.177496f, +0.069944f, -0.070544f}, + {-0.384878f, -0.205067f, +0.111476f}, + {-0.035734f, +0.067378f, -0.014549f}, + {+0.125583f, +0.062055f, +0.008649f}, + {-0.294346f, -0.048254f, -0.026299f}, + {-0.090207f, -0.084523f, +0.015326f}, + {-0.211714f, -0.100002f, +0.007755f}, + {+0.078344f, -0.022510f, -0.004774f}, + {-0.527842f, -0.045905f, -0.024578f} + }, + { + {-0.463362f, +0.056885f, -0.021761f}, + {+0.150954f, -0.026543f, +0.068293f}, + {-0.101521f, +0.000813f, -0.025478f}, + {-0.095046f, -0.089523f, -0.003261f}, + {-0.134616f, +0.104561f, -0.001013f}, + {-0.059105f, -0.025388f, +0.028020f}, + {-0.181070f, -0.006996f, +0.032275f}, + {+0.082036f, -0.002388f, +0.001840f}, + {-0.586330f, +0.048806f, +0.016554f} + }, + { + {-0.592381f, -0.044571f, +0.029549f}, + {+0.576892f, +0.036976f, -0.022220f}, + {-0.119596f, -0.060394f, -0.001555f}, + {-0.338453f, +0.063985f, -0.014668f}, + {+0.125238f, -0.093159f, +0.021501f}, + {-0.045169f, +0.044028f, -0.000433f}, + {-0.115198f, +0.025252f, +0.004920f}, + {+0.041077f, +0.008697f, +0.004995f}, + {-0.438497f, -0.055561f, +0.020980f} + }, + { + {-0.599054f, -0.014356f, +0.032985f}, + {+0.822874f, +0.044354f, -0.046136f}, + {-0.117506f, +0.008009f, +0.019868f}, + {-0.479925f, +0.018761f, -0.007799f}, + {+0.339581f, +0.001799f, +0.018360f}, + {-0.028531f, +0.004096f, -0.014580f}, + {-0.035532f, +0.016131f, -0.009871f}, + {-0.031577f, -0.038412f, +0.000988f}, + {-0.188266f, +0.051427f, +0.014971f} + }, + { + {-0.558565f, +0.027629f, +0.008677f}, + {+0.934558f, -0.055883f, -0.019701f}, + {-0.143536f, +0.040687f, +0.009496f}, + {-0.475498f, -0.046650f, +0.012347f}, + {+0.418986f, +0.046808f, -0.009187f}, + {+0.019973f, -0.045258f, -0.001389f}, + {+0.040837f, -0.027615f, -0.004137f}, + {-0.104086f, +0.015540f, -0.006688f}, + {+0.045132f, -0.020688f, +0.004131f} + }, + { + {-0.508817f, +0.002572f, -0.006006f}, + {+0.966334f, +0.010598f, -0.000935f}, + {-0.200114f, -0.021501f, -0.002245f}, + {-0.374199f, +0.021235f, +0.015875f}, + {+0.383236f, -0.011504f, -0.019281f}, + {+0.101681f, +0.007702f, +0.004459f}, + {+0.098607f, +0.009824f, -0.000170f}, + {-0.142186f, +0.015367f, -0.000073f}, + {+0.202499f, +0.007942f, -0.007850f} + }, + { + {-0.449816f, -0.025700f, -0.002766f}, + {+0.942805f, +0.019015f, -0.002630f}, + {-0.251515f, +0.005009f, -0.000037f}, + {-0.247529f, -0.018163f, +0.007953f}, + {+0.297646f, +0.008359f, -0.008978f}, + {+0.194833f, -0.010293f, -0.006773f}, + {+0.127610f, -0.005400f, -0.000110f}, + {-0.141062f, -0.005988f, +0.007030f}, + {+0.285592f, -0.008291f, -0.012555f} + }, + { + {-0.376168f, +0.026055f, +0.004627f}, + {+0.871841f, -0.021874f, -0.006470f}, + {-0.251474f, +0.012379f, +0.004839f}, + {-0.143351f, +0.003085f, +0.000557f}, + {+0.213031f, -0.008846f, -0.002525f}, + {+0.266224f, +0.023397f, -0.007678f}, + {+0.122414f, -0.005951f, +0.000933f}, + {-0.115352f, -0.004480f, +0.001947f}, + {+0.318209f, +0.018171f, -0.006837f} + }, + { + {-0.293873f, -0.014103f, +0.005564f}, + {+0.763509f, +0.026484f, -0.005957f}, + {-0.167339f, -0.021635f, +0.004681f}, + {-0.071079f, -0.008355f, -0.004673f}, + {+0.149092f, +0.004738f, +0.000445f}, + {+0.269948f, -0.002632f, -0.000196f}, + {+0.088484f, +0.013962f, +0.000022f}, + {-0.080315f, -0.009623f, -0.002700f}, + {+0.315546f, +0.000498f, +0.000137f} + }, + { + {-0.214030f, +0.010451f, +0.001827f}, + {+0.638609f, -0.024424f, -0.004195f}, + {-0.000480f, +0.033426f, -0.002795f}, + {-0.011678f, +0.017775f, -0.002438f}, + {+0.092630f, -0.011217f, +0.001499f}, + {+0.179494f, -0.027872f, +0.004886f}, + {+0.049375f, -0.006195f, +0.000322f}, + {-0.050886f, +0.014806f, +0.001580f}, + {+0.284102f, -0.013452f, -0.000223f} + }, + { + {-0.142407f, -0.012908f, -0.000129f}, + {+0.521031f, +0.021513f, -0.002424f}, + {+0.212730f, -0.053828f, -0.007313f}, + {+0.050092f, -0.009707f, -0.001567f}, + {+0.022713f, +0.014891f, +0.001899f}, + {+0.013352f, +0.051652f, +0.004824f}, + {+0.034982f, -0.000584f, +0.002038f}, + {-0.037735f, -0.000643f, +0.005700f}, + {+0.234664f, +0.015884f, -0.002619f} + }, + { + {-0.078162f, +0.013149f, +0.000240f}, + {+0.425304f, -0.016123f, -0.001883f}, + {+0.408229f, +0.052323f, -0.001957f}, + {+0.116415f, +0.013525f, -0.004497f}, + {-0.067314f, -0.020251f, +0.003762f}, + {-0.167553f, -0.051767f, -0.000869f}, + {+0.068137f, +0.009479f, +0.001235f}, + {-0.034203f, -0.008399f, +0.003763f}, + {+0.180796f, -0.011205f, -0.003598f} + }, + { + {-0.016750f, -0.012127f, +0.000498f}, + {+0.353965f, +0.008335f, -0.000653f}, + {+0.518342f, -0.011173f, +0.002964f}, + {+0.177026f, -0.019969f, -0.002705f}, + {-0.164814f, +0.026646f, +0.003238f}, + {-0.286213f, +0.012718f, -0.003816f}, + {+0.155640f, -0.020546f, -0.001850f}, + {-0.016416f, +0.003918f, -0.001774f}, + {+0.133919f, +0.003314f, -0.001822f} + }, + { + {+0.046182f, +0.012351f, -0.000034f}, + {+0.298885f, -0.009039f, +0.000810f}, + {+0.511610f, -0.032188f, -0.002291f}, + {+0.211380f, +0.005455f, +0.000933f}, + {-0.241218f, -0.015123f, +0.001103f}, + {-0.293508f, +0.029470f, +0.003051f}, + {+0.280548f, +0.030234f, -0.004368f}, + {+0.041260f, +0.018979f, -0.004541f}, + {+0.098998f, +0.002094f, +0.002904f} + }, + { + {+0.111605f, -0.013530f, -0.000652f}, + {+0.246690f, +0.016108f, -0.001020f}, + {+0.413977f, +0.038179f, -0.009520f}, + {+0.203190f, +0.017508f, -0.002191f}, + {-0.268601f, -0.003682f, +0.001755f}, + {-0.196136f, -0.036857f, +0.009761f}, + {+0.402137f, -0.026686f, -0.005055f}, + {+0.145035f, -0.035432f, -0.001365f}, + {+0.074946f, +0.007868f, +0.004954f} + }, + { + {+0.176108f, +0.013431f, -0.000958f}, + {+0.185298f, -0.016846f, -0.004677f}, + {+0.286889f, -0.019450f, -0.007487f}, + {+0.153787f, -0.015814f, -0.006505f}, + {-0.239195f, +0.011851f, +0.001930f}, + {-0.042102f, +0.023553f, +0.004947f}, + {+0.470133f, +0.012898f, -0.003624f}, + {+0.270107f, +0.025928f, -0.000154f}, + {+0.059116f, -0.020434f, -0.003101f} + }, + { + {+0.234033f, -0.013522f, -0.000160f}, + {+0.105917f, +0.008837f, -0.002769f}, + {+0.184987f, +0.008247f, -0.000624f}, + {+0.076510f, +0.005900f, -0.001804f}, + {-0.166708f, -0.022644f, +0.001485f}, + {+0.112604f, -0.020438f, -0.005184f}, + {+0.450824f, +0.006092f, +0.002002f}, + {+0.374333f, -0.013645f, -0.004183f}, + {+0.050668f, -0.002470f, -0.009849f} + }, + { + {+0.280701f, +0.008633f, +0.001045f}, + {+0.002220f, -0.016553f, +0.003998f}, + {+0.131643f, -0.003842f, +0.001872f}, + {-0.015690f, -0.016479f, +0.005047f}, + {-0.077685f, +0.023492f, +0.003551f}, + {+0.223388f, +0.024340f, -0.007042f}, + {+0.346787f, -0.042038f, +0.003586f}, + {+0.418985f, +0.005219f, -0.005591f}, + {+0.040023f, +0.024273f, +0.000362f} + }, + { + {+0.315972f, -0.002222f, +0.000114f}, + {-0.123110f, +0.036764f, +0.004764f}, + {+0.119199f, -0.002064f, +0.000988f}, + {-0.106689f, +0.025325f, +0.004605f}, + {+0.000310f, -0.007517f, +0.002748f}, + {+0.262374f, -0.010338f, -0.000067f}, + {+0.204029f, +0.052292f, -0.005305f}, + {+0.380172f, +0.016758f, -0.003741f}, + {+0.003388f, +0.008217f, +0.011667f} + }, + { + {+0.346296f, +0.003536f, -0.001898f}, + {-0.248976f, -0.036524f, -0.001389f}, + {+0.120849f, +0.002931f, +0.000722f}, + {-0.173186f, -0.016622f, +0.000289f}, + {+0.054827f, +0.000181f, -0.002418f}, + {+0.225358f, -0.023135f, +0.002820f}, + {+0.091375f, -0.014867f, -0.010230f}, + {+0.260139f, -0.034357f, -0.002468f}, + {-0.068405f, -0.042485f, +0.005111f} + }, + { + {+0.379862f, -0.009494f, -0.001961f}, + {-0.345947f, +0.013885f, -0.004347f}, + {+0.108945f, +0.001609f, +0.002277f}, + {-0.194971f, -0.005237f, -0.000216f}, + {+0.090631f, -0.007307f, -0.004497f}, + {+0.139916f, +0.036851f, -0.003429f}, + {+0.049457f, -0.016676f, -0.004125f}, + {+0.089658f, +0.040648f, -0.001276f}, + {-0.147747f, +0.028109f, -0.006357f} + }, + { + {+0.419521f, +0.011992f, -0.000293f}, + {-0.399888f, +0.006995f, +0.000613f}, + {+0.071268f, -0.013451f, +0.003383f}, + {-0.169244f, +0.016170f, +0.002968f}, + {+0.116230f, +0.009802f, -0.001756f}, + {+0.053621f, -0.017175f, -0.008163f}, + {+0.065166f, +0.025359f, +0.005381f}, + {-0.086447f, -0.037823f, -0.001051f}, + {-0.194782f, +0.007204f, -0.005393f} + }, + { + {+0.461674f, -0.009238f, +0.000744f}, + {-0.422873f, -0.002942f, +0.006024f}, + {+0.017965f, +0.019932f, +0.001068f}, + {-0.112940f, -0.014296f, +0.003691f}, + {+0.135675f, -0.004946f, +0.000913f}, + {+0.001359f, -0.007810f, -0.003619f}, + {+0.090834f, -0.000688f, +0.008234f}, + {-0.227027f, +0.020653f, -0.000262f}, + {-0.193552f, -0.020886f, +0.003761f} + }, + { + {+0.500543f, +0.004460f, -0.000339f}, + {-0.438946f, -0.008173f, +0.005382f}, + {-0.025063f, -0.012096f, -0.002727f}, + {-0.048264f, +0.016297f, +0.004137f}, + {+0.148356f, -0.006714f, -0.001928f}, + {-0.016069f, +0.011271f, +0.004203f}, + {+0.085225f, -0.019738f, +0.001763f}, + {-0.310418f, -0.002136f, +0.003576f}, + {-0.158213f, +0.011793f, +0.008536f} + }, + { + {+0.533110f, -0.005084f, -0.001776f}, + {-0.463561f, +0.015347f, +0.000549f}, + {-0.035070f, -0.007804f, -0.002842f}, + {+0.008595f, -0.003050f, +0.002916f}, + {+0.153491f, -0.002287f, -0.004867f}, + {-0.021318f, -0.000337f, +0.007722f}, + {+0.040490f, +0.023364f, -0.005685f}, + {-0.339640f, -0.004014f, +0.007635f}, + {-0.113068f, +0.002471f, +0.003970f} + }, + { + {+0.559507f, +0.006521f, -0.001337f}, + {-0.495821f, -0.006508f, -0.001808f}, + {-0.009393f, +0.020033f, +0.002230f}, + {+0.057093f, +0.005006f, -0.000599f}, + {+0.147824f, +0.005127f, -0.001599f}, + {-0.035200f, -0.017556f, +0.003623f}, + {-0.026148f, -0.010270f, -0.006517f}, + {-0.331865f, -0.002383f, +0.006123f}, + {-0.069791f, +0.006016f, -0.000948f} + }, + { + {+0.580524f, -0.004095f, -0.000494f}, + {-0.527187f, +0.003574f, -0.000131f}, + {+0.034392f, -0.012275f, +0.006324f}, + {+0.108521f, -0.008134f, -0.002780f}, + {+0.124651f, +0.003736f, +0.002434f}, + {-0.058607f, +0.013665f, -0.003392f}, + {-0.096848f, +0.005058f, -0.001324f}, + {-0.301438f, -0.004261f, +0.001796f}, + {-0.026983f, -0.008052f, -0.001333f} + }, + { + {+0.597812f, +0.002656f, -0.000522f}, + {-0.552363f, -0.003313f, +0.001014f}, + {+0.075214f, -0.005271f, +0.002238f}, + {+0.170571f, +0.018162f, -0.002847f}, + {+0.083934f, -0.017743f, +0.001407f}, + {-0.076846f, +0.004888f, -0.003003f}, + {-0.166265f, -0.007573f, +0.004024f}, + {-0.256165f, +0.011081f, +0.000547f}, + {+0.019750f, +0.010957f, -0.001327f} + }, + { + {+0.613921f, -0.002403f, -0.000945f}, + {-0.571681f, +0.004061f, +0.000722f}, + {+0.106010f, -0.000496f, -0.004030f}, + {+0.238299f, -0.018447f, -0.000821f}, + {+0.038282f, +0.014684f, -0.002501f}, + {-0.080622f, -0.007409f, +0.002126f}, + {-0.235224f, +0.017619f, +0.005449f}, + {-0.203255f, -0.012695f, +0.000929f}, + {+0.070865f, -0.011018f, -0.001639f} + }, + { + {+0.630982f, +0.003698f, -0.001234f}, + {-0.590355f, -0.003219f, +0.000406f}, + {+0.130676f, +0.011921f, -0.002723f}, + {+0.295756f, +0.013516f, +0.001143f}, + {+0.005092f, -0.003596f, -0.003545f}, + {-0.072459f, -0.000272f, +0.002800f}, + {-0.299780f, -0.022696f, +0.001211f}, + {-0.150313f, +0.011501f, +0.001280f}, + {+0.118367f, +0.011753f, -0.001359f} + }, + { + {+0.649444f, -0.004884f, -0.000984f}, + {-0.615054f, +0.005408f, +0.000735f}, + {+0.149940f, -0.006453f, +0.001164f}, + {+0.328584f, -0.000395f, +0.001275f}, + {-0.008438f, -0.005199f, -0.001454f}, + {-0.058218f, +0.000064f, -0.000029f}, + {-0.346981f, +0.007071f, -0.001972f}, + {-0.104327f, -0.007957f, +0.001209f}, + {+0.149121f, -0.004220f, -0.000790f} + }, + { + {+0.667442f, +0.004369f, -0.000509f}, + {-0.649912f, -0.008091f, +0.001108f}, + {+0.160941f, -0.003110f, +0.000358f}, + {+0.335024f, -0.007340f, -0.001370f}, + {-0.010516f, +0.004138f, +0.001016f}, + {-0.042559f, +0.003980f, -0.001022f}, + {-0.366888f, +0.007198f, +0.001062f}, + {-0.068558f, +0.004871f, +0.000722f}, + {+0.153026f, -0.002598f, -0.000878f} + }, + { + {+0.682283f, -0.002839f, -0.000182f}, + {-0.693711f, +0.010677f, +0.001270f}, + {+0.163061f, +0.001749f, -0.001941f}, + {+0.327679f, +0.004372f, -0.003551f}, + {-0.017128f, +0.001449f, +0.002254f}, + {-0.029387f, -0.003404f, -0.000254f}, + {-0.363800f, -0.005157f, +0.004344f}, + {-0.041106f, -0.002019f, -0.000551f}, + {+0.130106f, +0.008236f, -0.000670f} + }, + { + {+0.692437f, +0.000095f, -0.000537f}, + {-0.740634f, -0.011604f, +0.000655f}, + {+0.157996f, +0.002060f, -0.000837f}, + {+0.323158f, +0.005481f, -0.001955f}, + {-0.039932f, -0.012585f, +0.000817f}, + {-0.021634f, +0.000010f, -0.000230f}, + {-0.350228f, -0.000420f, +0.003173f}, + {-0.016658f, +0.005630f, -0.001178f}, + {+0.089943f, -0.012079f, -0.001069f} + }, + { + {+0.698662f, +0.000230f, -0.001425f}, + {-0.782838f, +0.007193f, +0.000387f}, + {+0.147754f, +0.002321f, +0.001054f}, + {+0.330876f, -0.007440f, +0.001734f}, + {-0.078436f, +0.014161f, -0.002562f}, + {-0.020690f, +0.001093f, -0.000930f}, + {-0.336354f, +0.000244f, +0.000495f}, + {+0.007725f, -0.004802f, -0.001236f}, + {+0.047620f, +0.008277f, -0.001417f} + }, + { + {+0.703246f, +0.002409f, -0.001250f}, + {-0.814977f, -0.003204f, +0.001382f}, + {+0.135217f, -0.009385f, -0.001169f}, + {+0.350177f, -0.000838f, +0.000877f}, + {-0.122288f, -0.004476f, -0.002216f}, + {-0.025713f, +0.002869f, +0.000621f}, + {-0.325782f, +0.004520f, +0.000748f}, + {+0.030650f, +0.008462f, -0.000266f}, + {+0.015647f, -0.003005f, -0.000601f} + }, + { + {+0.707436f, -0.002159f, -0.000184f}, + {-0.836328f, +0.001420f, +0.002805f}, + {+0.124343f, +0.003534f, -0.004617f}, + {+0.377173f, -0.003128f, -0.002966f}, + {-0.162938f, +0.001908f, +0.001890f}, + {-0.034346f, +0.001148f, +0.003196f}, + {-0.317600f, -0.001145f, +0.002065f}, + {+0.047783f, -0.002726f, +0.001091f}, + {-0.001518f, -0.002014f, +0.001386f} + }, + { + {+0.711316f, +0.000190f, +0.000116f}, + {-0.849400f, -0.005461f, +0.002132f}, + {+0.115220f, +0.006522f, -0.002677f}, + {+0.406205f, +0.009733f, -0.003200f}, + {-0.198229f, -0.008830f, +0.003296f}, + {-0.041723f, -0.007295f, +0.001797f}, + {-0.307751f, -0.000513f, +0.001061f}, + {+0.056384f, -0.001852f, +0.000252f}, + {-0.007409f, -0.002688f, +0.001636f} + }, + { + {+0.715564f, +0.000878f, -0.000712f}, + {-0.856145f, +0.001865f, +0.000304f}, + {+0.099717f, +0.000516f, +0.001510f}, + {+0.427792f, -0.008621f, -0.000103f}, + {-0.227122f, +0.009743f, +0.000742f}, + {-0.038969f, -0.000573f, -0.000890f}, + {-0.290500f, -0.003837f, -0.000282f}, + {+0.060351f, +0.002258f, -0.001388f}, + {-0.007102f, +0.000681f, +0.000051f} + }, + { + {+0.721724f, +0.001440f, -0.001419f}, + {-0.857928f, +0.002494f, +0.000723f}, + {+0.068940f, -0.015230f, +0.000407f}, + {+0.432906f, -0.004606f, +0.000685f}, + {-0.246924f, -0.000678f, -0.000115f}, + {-0.019686f, +0.012823f, +0.000958f}, + {-0.263371f, +0.009394f, +0.000248f}, + {+0.066836f, +0.001658f, -0.002275f}, + {-0.003255f, +0.001689f, -0.000037f} + }, + { + {+0.730712f, -0.003910f, -0.000870f}, + {-0.858450f, -0.001220f, +0.001946f}, + {+0.023475f, +0.016216f, -0.003883f}, + {+0.419872f, +0.011121f, -0.002752f}, + {-0.256682f, -0.002820f, +0.002128f}, + {+0.013513f, -0.011639f, +0.004607f}, + {-0.229180f, -0.009683f, +0.001814f}, + {+0.080511f, -0.005798f, -0.001723f}, + {+0.001435f, +0.000756f, -0.000451f} + }, + { + {+0.741590f, +0.003101f, -0.000011f}, + {-0.860726f, +0.000300f, +0.002853f}, + {-0.028493f, -0.003694f, -0.002869f}, + {+0.395211f, -0.003270f, -0.003914f}, + {-0.257602f, -0.001422f, +0.002810f}, + {+0.053057f, +0.000570f, +0.002860f}, + {-0.193999f, +0.002947f, +0.000888f}, + {+0.099824f, +0.006425f, -0.000616f}, + {+0.005522f, +0.002697f, -0.000570f} + }, + { + {+0.752785f, -0.000581f, -0.000328f}, + {-0.864679f, +0.002652f, +0.003144f}, + {-0.079249f, -0.003995f, +0.005777f}, + {+0.366044f, -0.005911f, +0.001913f}, + {-0.251095f, +0.009072f, -0.002248f}, + {+0.092600f, +0.005125f, -0.005522f}, + {-0.162554f, -0.001717f, -0.002557f}, + {+0.119626f, -0.005564f, +0.000516f}, + {+0.008439f, -0.004393f, +0.001712f} + }, + { + {+0.763163f, -0.000862f, -0.002020f}, + {-0.868650f, -0.005188f, +0.001363f}, + {-0.122932f, -0.003612f, +0.014766f}, + {+0.337176f, +0.004705f, +0.011739f}, + {-0.240301f, -0.007676f, -0.011938f}, + {+0.125784f, +0.004581f, -0.013027f}, + {-0.137073f, +0.006965f, -0.003725f}, + {+0.136715f, +0.001962f, +0.001072f}, + {+0.010881f, +0.001506f, +0.004158f} + } +}; + +const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +{ + { + {-0.067351f, +0.619497f, -0.224314f}, + {+0.139294f, -0.771571f, +0.258097f}, + {-0.003713f, +0.028657f, -0.008450f}, + {-0.024048f, +0.069155f, -0.020553f}, + {+0.025678f, +0.026025f, -0.019233f}, + {+0.009936f, +0.011063f, -0.007565f}, + {+0.034483f, +0.043638f, -0.029489f}, + {+0.006138f, -0.086263f, +0.038216f}, + {+0.046480f, +0.249243f, -0.117268f} + }, + { + {+0.012648f, +0.734658f, -0.184512f}, + {+0.111037f, -0.538674f, +0.336987f}, + {-0.002627f, -0.020803f, -0.029183f}, + {-0.030921f, +0.004858f, -0.041299f}, + {+0.051115f, +0.078198f, -0.009636f}, + {+0.016252f, +0.028855f, -0.008268f}, + {+0.084591f, +0.153968f, -0.000650f}, + {-0.017068f, -0.206982f, -0.012636f}, + {+0.164507f, +0.469681f, -0.054789f} + }, + { + {+0.223221f, -0.320495f, +0.172323f}, + {-0.327663f, +0.928806f, -0.128055f}, + {+0.019358f, -0.074304f, -0.015400f}, + {+0.035210f, -0.082508f, -0.021387f}, + {+0.001915f, -0.019754f, +0.041779f}, + {-0.009482f, +0.004447f, +0.006672f}, + {+0.039341f, +0.054366f, +0.052326f}, + {-0.015501f, -0.146235f, -0.037803f}, + {+0.140215f, +0.011558f, +0.133087f} + }, + { + {+0.158118f, -0.393316f, +0.132368f}, + {-0.546868f, +0.311888f, -0.284518f}, + {+0.031012f, +0.036496f, +0.023744f}, + {+0.107357f, +0.078785f, +0.019930f}, + {-0.117669f, -0.168393f, +0.014741f}, + {-0.063269f, -0.132935f, -0.029018f}, + {-0.110215f, -0.232883f, -0.026283f}, + {+0.026325f, -0.007643f, +0.015801f}, + {-0.156350f, -0.444539f, +0.006974f} + }, + { + {-0.158057f, +0.298412f, -0.065118f}, + {-0.180062f, -0.634611f, +0.013767f}, + {-0.011461f, +0.071086f, +0.018569f}, + {+0.074813f, +0.048439f, +0.032538f}, + {-0.176343f, +0.017086f, -0.039934f}, + {-0.070878f, -0.087909f, -0.042882f}, + {-0.196698f, -0.095181f, -0.059079f}, + {+0.043237f, +0.006669f, +0.001955f}, + {-0.440379f, +0.000452f, -0.098398f} + }, + { + {-0.449468f, +0.042993f, -0.088093f}, + {+0.450454f, +0.142745f, +0.162071f}, + {-0.082857f, -0.081326f, -0.023342f}, + {-0.091693f, -0.115333f, +0.002878f}, + {-0.059625f, +0.113643f, -0.022660f}, + {-0.002551f, +0.114733f, +0.021413f}, + {-0.134830f, +0.127944f, +0.015214f}, + {+0.039406f, -0.002734f, -0.000806f}, + {-0.456803f, +0.175205f, -0.017055f} + }, + { + {-0.521027f, -0.156261f, +0.000350f}, + {+0.908889f, +0.180570f, +0.051670f}, + {-0.108770f, -0.053291f, -0.027241f}, + {-0.287995f, +0.046150f, -0.015860f}, + {+0.175042f, -0.108856f, +0.012453f}, + {+0.059786f, +0.044325f, +0.033874f}, + {-0.008998f, -0.011671f, +0.039397f}, + {+0.004422f, -0.001021f, +0.005255f}, + {-0.225556f, -0.103116f, +0.036951f} + }, + { + {-0.371766f, +0.087065f, +0.052523f}, + {+1.010425f, -0.130810f, -0.067243f}, + {-0.070822f, +0.064314f, +0.008682f}, + {-0.381257f, -0.000635f, -0.013290f}, + {+0.375703f, +0.033440f, +0.023774f}, + {+0.081888f, -0.060050f, -0.009146f}, + {+0.099530f, -0.054172f, +0.002402f}, + {-0.055187f, -0.030383f, +0.004615f}, + {+0.113698f, +0.047344f, +0.023699f} + }, + { + {-0.133153f, +0.006407f, +0.034476f}, + {+0.837054f, -0.001398f, -0.067755f}, + {-0.019596f, -0.013995f, +0.025797f}, + {-0.306127f, -0.073720f, -0.002010f}, + {+0.417535f, +0.051347f, +0.011222f}, + {+0.096752f, -0.015410f, -0.024298f}, + {+0.165604f, -0.014311f, -0.020675f}, + {-0.110129f, +0.012754f, -0.001173f}, + {+0.396896f, -0.022479f, +0.001703f} + }, + { + {+0.076154f, -0.015041f, -0.005731f}, + {+0.558795f, +0.016178f, -0.011329f}, + {+0.001783f, -0.050805f, +0.008376f}, + {-0.100163f, +0.081596f, +0.016700f}, + {+0.287003f, -0.097687f, -0.016950f}, + {+0.130328f, +0.051441f, -0.002818f}, + {+0.194137f, +0.028286f, -0.006100f}, + {-0.128998f, -0.007273f, -0.004964f}, + {+0.525370f, -0.013001f, -0.010543f} + }, + { + {+0.227729f, -0.027128f, -0.019508f}, + {+0.280803f, +0.046474f, +0.016340f}, + {+0.006184f, +0.007629f, -0.010663f}, + {+0.124161f, -0.022132f, +0.014831f}, + {+0.082170f, +0.023992f, -0.023358f}, + {+0.168199f, -0.000379f, +0.008102f}, + {+0.185287f, +0.007140f, +0.002454f}, + {-0.098830f, -0.034738f, -0.000610f}, + {+0.505599f, +0.024919f, -0.016122f} + }, + { + {+0.345183f, +0.044417f, -0.008489f}, + {+0.029206f, -0.069971f, +0.008062f}, + {+0.040780f, +0.025656f, -0.005557f}, + {+0.280661f, +0.000086f, -0.001939f}, + {-0.091189f, +0.001516f, -0.001765f}, + {+0.178051f, -0.018186f, -0.003683f}, + {+0.147526f, -0.011735f, +0.000472f}, + {-0.034700f, +0.017373f, +0.007552f}, + {+0.404231f, -0.018810f, -0.013580f} + }, + { + {+0.447376f, -0.029945f, +0.002359f}, + {-0.196485f, +0.048776f, -0.000528f}, + {+0.131413f, -0.031345f, +0.001264f}, + {+0.352086f, -0.000092f, -0.009252f}, + {-0.196164f, +0.010102f, +0.008244f}, + {+0.137927f, +0.001411f, -0.005445f}, + {+0.094224f, +0.013361f, +0.000776f}, + {+0.030220f, +0.002376f, +0.001349f}, + {+0.282599f, +0.004869f, -0.002937f} + }, + { + {+0.532898f, +0.008836f, +0.002166f}, + {-0.392609f, -0.034792f, +0.000679f}, + {+0.270895f, +0.030297f, -0.000156f}, + {+0.364913f, -0.004283f, -0.009820f}, + {-0.243967f, -0.002627f, +0.007384f}, + {+0.037047f, -0.017787f, +0.004491f}, + {+0.041930f, -0.015182f, -0.000239f}, + {+0.078287f, +0.007042f, -0.004821f}, + {+0.167608f, -0.019027f, +0.005545f} + }, + { + {+0.594888f, -0.002438f, -0.003208f}, + {-0.547092f, +0.023930f, +0.003204f}, + {+0.418638f, -0.023295f, -0.006545f}, + {+0.358947f, -0.011193f, -0.005371f}, + {-0.268043f, +0.007992f, +0.005934f}, + {-0.108159f, +0.040803f, +0.007847f}, + {+0.014237f, +0.000657f, -0.000908f}, + {+0.104780f, -0.013359f, -0.000511f}, + {+0.064568f, +0.028680f, +0.003338f} + }, + { + {+0.635005f, +0.006702f, -0.005006f}, + {-0.650934f, -0.013984f, +0.004474f}, + {+0.519015f, +0.020899f, -0.008786f}, + {+0.354058f, +0.000065f, -0.000944f}, + {-0.293166f, -0.009243f, +0.003786f}, + {-0.244478f, -0.036317f, +0.004273f}, + {+0.027137f, +0.008991f, +0.000305f}, + {+0.112434f, -0.002933f, +0.003310f}, + {-0.019782f, -0.018420f, -0.000608f} + }, + { + {+0.661388f, -0.006850f, -0.003249f}, + {-0.709859f, +0.007935f, +0.004126f}, + {+0.524557f, -0.002414f, -0.002080f}, + {+0.344994f, +0.003888f, -0.002639f}, + {-0.316812f, +0.006036f, +0.003412f}, + {-0.307717f, +0.012550f, -0.001272f}, + {+0.076841f, -0.011681f, -0.000880f}, + {+0.115864f, +0.008381f, -0.000189f}, + {-0.078312f, +0.007256f, -0.000761f} + }, + { + {+0.681780f, +0.004317f, -0.002114f}, + {-0.740600f, -0.002506f, +0.003738f}, + {+0.416864f, -0.038264f, +0.003168f}, + {+0.319577f, -0.000792f, -0.001313f}, + {-0.319873f, -0.002666f, +0.002245f}, + {-0.258538f, +0.029824f, -0.003409f}, + {+0.141548f, +0.012818f, -0.003839f}, + {+0.135337f, +0.001218f, -0.005061f}, + {-0.109830f, +0.001645f, +0.001441f} + }, + { + {+0.699871f, -0.003221f, -0.002308f}, + {-0.762514f, +0.004609f, +0.003814f}, + {+0.225434f, +0.064939f, -0.001450f}, + {+0.266431f, +0.012897f, +0.002255f}, + {-0.282175f, -0.010311f, -0.000422f}, + {-0.108713f, -0.058556f, +0.002399f}, + {+0.186968f, -0.009396f, -0.004807f}, + {+0.178376f, -0.016506f, -0.006062f}, + {-0.120383f, -0.003023f, +0.004088f} + }, + { + {+0.714529f, +0.003253f, -0.002414f}, + {-0.790696f, -0.011388f, +0.001985f}, + {+0.020833f, -0.046458f, -0.007156f}, + {+0.185944f, -0.029249f, +0.000016f}, + {-0.197551f, +0.028731f, +0.000138f}, + {+0.079181f, +0.043101f, +0.006863f}, + {+0.176963f, -0.004258f, -0.002861f}, + {+0.228839f, +0.021085f, -0.002090f}, + {-0.119574f, -0.002646f, +0.004158f} + }, + { + {+0.721602f, -0.001258f, -0.002069f}, + {-0.831027f, +0.010846f, -0.000173f}, + {-0.126177f, +0.009153f, -0.003439f}, + {+0.096173f, +0.020892f, -0.003906f}, + {-0.084227f, -0.027335f, +0.001653f}, + {+0.229925f, -0.010207f, +0.000875f}, + {+0.090658f, +0.023511f, +0.000256f}, + {+0.250703f, +0.000323f, +0.000133f}, + {-0.115659f, +0.011998f, -0.001947f} + }, + { + {+0.717593f, -0.001188f, -0.001513f}, + {-0.881199f, -0.003795f, +0.002266f}, + {-0.186085f, +0.008805f, +0.004207f}, + {+0.021886f, +0.000682f, +0.000980f}, + {+0.024639f, +0.019808f, +0.000274f}, + {+0.296639f, -0.006775f, -0.008463f}, + {-0.060930f, -0.036828f, +0.003817f}, + {+0.210581f, -0.022700f, -0.003357f}, + {-0.112881f, +0.004715f, -0.006188f} + }, + { + {+0.702872f, +0.004202f, -0.000899f}, + {-0.934393f, +0.006557f, +0.007476f}, + {-0.176147f, -0.010014f, +0.006716f}, + {-0.022135f, +0.003624f, +0.007346f}, + {+0.100594f, -0.012448f, -0.000135f}, + {+0.271960f, +0.005598f, -0.007977f}, + {-0.233701f, +0.046766f, +0.003616f}, + {+0.101020f, +0.023227f, -0.002321f}, + {-0.116785f, -0.020405f, +0.002997f} + }, + { + {+0.682250f, -0.007566f, -0.001501f}, + {-0.978417f, -0.017585f, +0.006636f}, + {-0.137592f, +0.005047f, +0.003880f}, + {-0.028458f, -0.006826f, +0.004609f}, + {+0.129898f, -0.005880f, -0.001391f}, + {+0.175874f, -0.016526f, +0.001013f}, + {-0.367276f, -0.033929f, -0.002775f}, + {-0.060514f, -0.037887f, +0.002465f}, + {-0.137333f, -0.006964f, +0.011955f} + }, + { + {+0.663415f, +0.004606f, -0.002781f}, + {-0.993852f, +0.009178f, -0.000038f}, + {-0.108250f, -0.003270f, +0.001437f}, + {+0.009848f, -0.008477f, -0.000681f}, + {+0.118923f, +0.012268f, -0.005212f}, + {+0.044501f, +0.037572f, +0.003962f}, + {-0.416290f, -0.006378f, -0.006076f}, + {-0.236610f, +0.040350f, +0.002858f}, + {-0.168887f, +0.032800f, +0.004036f} + }, + { + {+0.651781f, +0.001152f, -0.002457f}, + {-0.965546f, +0.016499f, -0.002125f}, + {-0.105651f, -0.001646f, +0.002481f}, + {+0.090167f, +0.025763f, -0.001130f}, + {+0.087686f, -0.003999f, -0.005549f}, + {-0.075223f, -0.035790f, -0.002847f}, + {-0.383115f, +0.037796f, +0.001566f}, + {-0.378556f, -0.025237f, +0.002287f}, + {-0.179845f, -0.008941f, -0.008124f} + }, + { + {+0.645685f, -0.002682f, -0.000593f}, + {-0.900401f, -0.029783f, +0.003285f}, + {-0.124380f, +0.012275f, +0.001822f}, + {+0.193225f, -0.027406f, +0.000945f}, + {+0.052400f, -0.001580f, -0.000684f}, + {-0.141411f, -0.002262f, -0.004491f}, + {-0.319576f, -0.023501f, +0.010635f}, + {-0.448327f, +0.001574f, +0.004044f}, + {-0.141908f, -0.032139f, -0.005596f} + }, + { + {+0.638137f, -0.002412f, +0.000310f}, + {-0.826423f, +0.017144f, +0.007574f}, + {-0.140725f, -0.006104f, -0.000815f}, + {+0.290930f, +0.019453f, +0.001904f}, + {+0.016875f, -0.009182f, +0.001656f}, + {-0.145675f, +0.017736f, +0.001807f}, + {-0.285941f, -0.010851f, +0.008570f}, + {-0.435070f, +0.011023f, +0.004307f}, + {-0.062178f, +0.036767f, +0.005654f} + }, + { + {+0.623287f, +0.007299f, -0.001056f}, + {-0.770521f, +0.001075f, +0.004559f}, + {-0.130645f, -0.003274f, -0.002902f}, + {+0.361351f, -0.005902f, +0.000348f}, + {-0.020477f, +0.011841f, -0.000752f}, + {-0.114514f, -0.018145f, +0.007488f}, + {-0.305625f, +0.026256f, -0.000446f}, + {-0.353862f, -0.030431f, +0.004835f}, + {+0.024417f, -0.010793f, +0.007820f} + }, + { + {+0.600902f, -0.006021f, -0.002348f}, + {-0.739248f, -0.005015f, -0.001571f}, + {-0.087167f, +0.021027f, -0.001847f}, + {+0.400187f, +0.000286f, -0.002317f}, + {-0.060945f, -0.009244f, -0.002589f}, + {-0.083328f, -0.001928f, +0.007725f}, + {-0.359405f, -0.019595f, -0.006438f}, + {-0.237042f, +0.027090f, +0.006659f}, + {+0.089013f, -0.004244f, -0.000128f} + }, + { + {+0.574438f, +0.003368f, -0.001494f}, + {-0.720431f, -0.005878f, -0.002928f}, + {-0.025553f, -0.022088f, +0.002875f}, + {+0.419048f, +0.001480f, -0.004334f}, + {-0.105303f, +0.000852f, +0.000385f}, + {-0.070507f, +0.013892f, +0.000793f}, + {-0.411663f, -0.001662f, -0.003755f}, + {-0.118815f, -0.013893f, +0.002937f}, + {+0.127181f, -0.002212f, -0.005490f} + }, + { + {+0.546941f, -0.004959f, -0.000239f}, + {-0.700235f, +0.009986f, +0.000285f}, + {+0.026874f, +0.006811f, +0.004565f}, + {+0.432826f, +0.004148f, -0.005149f}, + {-0.153860f, -0.009932f, +0.004309f}, + {-0.067445f, -0.005555f, -0.005512f}, + {-0.441084f, +0.007824f, +0.003852f}, + {-0.016912f, +0.012081f, -0.003174f}, + {+0.148914f, +0.007013f, -0.004323f} + }, + { + {+0.520436f, +0.006384f, -0.000382f}, + {-0.674657f, -0.006620f, +0.001998f}, + {+0.052406f, +0.010142f, -0.000198f}, + {+0.447102f, -0.009070f, -0.003159f}, + {-0.202135f, +0.018081f, +0.002032f}, + {-0.055887f, -0.014144f, -0.003615f}, + {-0.448314f, -0.001324f, +0.007309f}, + {+0.065957f, -0.020607f, -0.003258f}, + {+0.162472f, -0.004875f, -0.002127f} + }, + { + {+0.496665f, -0.004859f, -0.000887f}, + {-0.647428f, +0.004741f, +0.001434f}, + {+0.053060f, -0.007546f, -0.006118f}, + {+0.453309f, +0.004051f, -0.000324f}, + {-0.237178f, -0.009221f, -0.002058f}, + {-0.029969f, +0.014850f, +0.002643f}, + {-0.439805f, -0.002523f, +0.005619f}, + {+0.128558f, +0.010056f, -0.001511f}, + {+0.167737f, +0.001236f, -0.001456f} + }, + { + {+0.475983f, +0.003710f, -0.000970f}, + {-0.624608f, -0.003603f, +0.000812f}, + {+0.042149f, -0.008534f, -0.003432f}, + {+0.438672f, +0.005526f, +0.000965f}, + {-0.249063f, -0.004782f, -0.002016f}, + {+0.000807f, -0.001028f, +0.002841f}, + {-0.416440f, +0.003745f, +0.000359f}, + {+0.170217f, -0.009457f, -0.000867f}, + {+0.158107f, +0.002167f, -0.000901f} + }, + { + {+0.456962f, -0.002559f, -0.000574f}, + {-0.609653f, +0.002905f, +0.001117f}, + {+0.025784f, -0.000666f, +0.002060f}, + {+0.399694f, -0.014955f, +0.000161f}, + {-0.242149f, +0.009905f, +0.001262f}, + {+0.026686f, -0.000156f, -0.001218f}, + {-0.373014f, +0.013273f, -0.002730f}, + {+0.191984f, -0.000973f, -0.000838f}, + {+0.127455f, -0.008313f, +0.000023f} + }, + { + {+0.437008f, +0.003925f, -0.000081f}, + {-0.601093f, -0.000232f, +0.001372f}, + {+0.002960f, +0.010345f, +0.001054f}, + {+0.347170f, +0.016956f, -0.002319f}, + {-0.233004f, -0.002825f, +0.003373f}, + {+0.044339f, -0.004384f, -0.002020f}, + {-0.309506f, -0.024368f, +0.000882f}, + {+0.198003f, -0.000405f, -0.001486f}, + {+0.077236f, +0.014350f, -0.000034f} + }, + { + {+0.414109f, -0.005431f, -0.000037f}, + {-0.592705f, +0.001470f, +0.001222f}, + {-0.024584f, -0.008451f, -0.001721f}, + {+0.300043f, -0.007510f, -0.003376f}, + {-0.236922f, -0.005189f, +0.002904f}, + {+0.053435f, +0.002953f, -0.000365f}, + {-0.239443f, +0.015553f, +0.003945f}, + {+0.195817f, -0.003961f, -0.001987f}, + {+0.019225f, -0.012398f, -0.000024f} + }, + { + {+0.388577f, +0.006627f, -0.000411f}, + {-0.576851f, -0.002898f, +0.000753f}, + {-0.052952f, +0.001666f, -0.000781f}, + {+0.271771f, -0.002315f, -0.001136f}, + {-0.256751f, +0.010892f, +0.000933f}, + {+0.055321f, +0.000623f, +0.000321f}, + {-0.178829f, -0.004699f, +0.001577f}, + {+0.192108f, -0.001841f, -0.002156f}, + {-0.030601f, +0.010281f, +0.000029f} + }, + { + {+0.362659f, -0.006023f, -0.001007f}, + {-0.548393f, +0.008477f, +0.000553f}, + {-0.079254f, -0.004768f, +0.001192f}, + {+0.262246f, +0.003901f, +0.002002f}, + {-0.282691f, -0.009035f, -0.001549f}, + {+0.052737f, -0.001616f, -0.000062f}, + {-0.134033f, +0.004191f, -0.001751f}, + {+0.189322f, +0.000295f, -0.001194f}, + {-0.059659f, -0.002213f, -0.000053f} + }, + { + {+0.339002f, +0.002927f, -0.000712f}, + {-0.507223f, -0.011672f, +0.001408f}, + {-0.101892f, +0.008754f, -0.000366f}, + {+0.261016f, +0.005455f, +0.000964f}, + {-0.300336f, -0.003329f, -0.000659f}, + {+0.049601f, -0.001946f, +0.000746f}, + {-0.101681f, -0.008021f, -0.001522f}, + {+0.184646f, -0.000891f, -0.000474f}, + {-0.064232f, -0.004100f, +0.000831f} + }, + { + {+0.318447f, -0.002583f, +0.000342f}, + {-0.458166f, +0.011334f, +0.002134f}, + {-0.119857f, -0.003793f, -0.002673f}, + {+0.257649f, -0.004527f, -0.002750f}, + {-0.302642f, +0.006786f, +0.003304f}, + {+0.050079f, +0.001140f, +0.002294f}, + {-0.075154f, +0.006079f, +0.000154f}, + {+0.175259f, -0.002462f, +0.000450f}, + {-0.050689f, +0.006815f, +0.002112f} + }, + { + {+0.300124f, +0.004647f, +0.000429f}, + {-0.407177f, -0.007551f, +0.001229f}, + {-0.135280f, -0.004904f, -0.000353f}, + {+0.246029f, -0.001362f, -0.002342f}, + {-0.292460f, -0.000038f, +0.003938f}, + {+0.057770f, +0.002994f, +0.000700f}, + {-0.048950f, -0.002677f, -0.000542f}, + {+0.161196f, +0.006930f, -0.000490f}, + {-0.030107f, -0.002304f, +0.001927f} + }, + { + {+0.283695f, -0.004672f, -0.000499f}, + {-0.357931f, +0.007644f, -0.000792f}, + {-0.154465f, -0.001114f, +0.004046f}, + {+0.221394f, -0.002251f, +0.001225f}, + {-0.274104f, -0.001365f, +0.000312f}, + {+0.076006f, +0.003175f, -0.002372f}, + {-0.019797f, +0.006502f, -0.001827f}, + {+0.147944f, -0.003560f, -0.001898f}, + {-0.011081f, -0.000127f, -0.000375f} + }, + { + {+0.269518f, +0.002457f, -0.001001f}, + {-0.311326f, -0.012837f, -0.000327f}, + {-0.181319f, +0.014112f, +0.003014f}, + {+0.182651f, +0.012951f, +0.002036f}, + {-0.248875f, -0.007948f, -0.001266f}, + {+0.104063f, -0.013233f, -0.001219f}, + {+0.010928f, -0.008987f, -0.001152f}, + {+0.141371f, -0.000838f, -0.001781f}, + {+0.004297f, -0.004808f, -0.000787f} + }, + { + {+0.257138f, -0.000471f, -0.000295f}, + {-0.269065f, +0.008971f, +0.001327f}, + {-0.209242f, -0.009445f, -0.000789f}, + {+0.136359f, -0.015642f, -0.000837f}, + {-0.218917f, +0.009939f, +0.000695f}, + {+0.133100f, +0.007332f, +0.001415f}, + {+0.037336f, +0.006071f, +0.000081f}, + {+0.141848f, +0.003924f, -0.000450f}, + {+0.015759f, +0.001304f, -0.000104f} + }, + { + {+0.244594f, +0.002255f, +0.000537f}, + {-0.232039f, -0.006188f, +0.001385f}, + {-0.226456f, -0.005183f, +0.000708f}, + {+0.094177f, +0.004239f, -0.001379f}, + {-0.188550f, -0.003755f, +0.001033f}, + {+0.152408f, +0.005083f, -0.000982f}, + {+0.053373f, +0.001503f, -0.000759f}, + {+0.144008f, -0.001965f, +0.000959f}, + {+0.023577f, -0.002308f, -0.000076f} + }, + { + {+0.229867f, -0.004876f, +0.000170f}, + {-0.197603f, +0.004728f, +0.000560f}, + {-0.226600f, +0.010780f, +0.006854f}, + {+0.064221f, +0.003891f, +0.003122f}, + {-0.161189f, -0.001104f, -0.002261f}, + {+0.157190f, -0.008241f, -0.006888f}, + {+0.056895f, -0.003410f, -0.003127f}, + {+0.141412f, -0.001071f, +0.001644f}, + {+0.029485f, +0.003593f, +0.001358f} + }, + { + {+0.212288f, +0.005142f, -0.000800f}, + {-0.162483f, -0.004117f, -0.001433f}, + {-0.209328f, -0.002547f, +0.009702f}, + {+0.048193f, +0.000129f, +0.007210f}, + {-0.139874f, -0.002121f, -0.005784f}, + {+0.146647f, -0.000237f, -0.009054f}, + {+0.049793f, -0.001403f, -0.002729f}, + {+0.132126f, +0.003164f, +0.002133f}, + {+0.035201f, -0.000152f, +0.002301f} + }, + { + {+0.191599f, -0.002871f, -0.000708f}, + {-0.125250f, +0.008746f, -0.003116f}, + {-0.175384f, -0.002970f, +0.005044f}, + {+0.046507f, -0.009000f, +0.004794f}, + {-0.128202f, +0.013178f, -0.002850f}, + {+0.120273f, +0.005762f, -0.003583f}, + {+0.034030f, -0.000067f, +0.000427f}, + {+0.118790f, -0.004116f, +0.002419f}, + {+0.044052f, -0.001094f, +0.001102f} + } +}; + +#endif + + +#ifndef UPDATE_FASTCONV_SBA_FILTER const float FASTCONV_FOA_latency_s = 0.000666667f; const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]= { @@ -7110,6 +12951,1224 @@ const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]= {-0.118370f, +0.031720f, -0.024225f, -0.000048f, +0.000065f} } }; +#else +const float FASTCONV_FOA_latency_s = 0.000020833f; +const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +{ + { + {+0.181652f, +0.754551f, +0.218658f}, + {+0.313875f, -0.422228f, +0.135528f}, + {+0.014440f, +0.116710f, -0.013575f}, + {+0.042997f, +0.018886f, -0.015597f} + }, + { + {-0.171103f, -0.431000f, -0.158827f}, + {-0.162330f, -1.016290f, +0.055279f}, + {-0.009076f, +0.107488f, -0.010075f}, + {-0.002269f, +0.060685f, +0.014338f} + }, + { + {-0.320265f, -0.250765f, -0.167171f}, + {-0.685853f, +0.069215f, -0.258616f}, + {-0.021745f, +0.080557f, +0.010049f}, + {-0.070084f, +0.090970f, +0.018109f} + }, + { + {-0.090062f, +0.396798f, +0.031329f}, + {-0.547868f, +0.612159f, -0.064837f}, + {-0.014055f, +0.010916f, -0.020054f}, + {-0.104609f, -0.009719f, -0.014645f} + }, + { + {+0.310752f, -0.054756f, +0.106519f}, + {+0.077791f, -0.305320f, +0.144875f}, + {+0.048626f, -0.050345f, -0.007511f}, + {-0.035749f, -0.049561f, -0.008157f} + }, + { + {+0.590278f, -0.119063f, +0.024674f}, + {+0.708076f, -0.088569f, +0.094265f}, + {+0.119880f, +0.048720f, +0.014661f}, + {+0.120422f, +0.058573f, +0.004643f} + }, + { + {+0.638355f, +0.074625f, -0.043889f}, + {+1.048572f, +0.131298f, -0.037692f}, + {+0.143385f, +0.033975f, +0.014623f}, + {+0.293747f, -0.017822f, -0.000451f} + }, + { + {+0.521197f, -0.005266f, -0.041412f}, + {+1.094584f, +0.000210f, -0.073803f}, + {+0.109004f, -0.035628f, -0.003452f}, + {+0.407579f, +0.034241f, -0.002887f} + }, + { + {+0.361479f, -0.014806f, -0.009497f}, + {+0.986770f, -0.046512f, -0.029288f}, + {+0.057809f, +0.027844f, -0.015215f}, + {+0.409283f, +0.014805f, +0.005752f} + }, + { + {+0.229108f, -0.009840f, +0.009477f}, + {+0.839323f, +0.000705f, +0.009034f}, + {+0.036287f, +0.030074f, -0.010227f}, + {+0.293083f, -0.069929f, -0.004421f} + }, + { + {+0.125590f, +0.030181f, +0.007318f}, + {+0.687756f, +0.052219f, +0.009126f}, + {+0.052382f, -0.019274f, +0.003613f}, + {+0.122951f, +0.036356f, -0.013394f} + }, + { + {+0.030890f, -0.030176f, -0.000832f}, + {+0.531513f, -0.048483f, -0.004668f}, + {+0.067811f, -0.004747f, +0.002746f}, + {-0.026040f, -0.009502f, -0.004388f} + }, + { + {-0.062962f, +0.019124f, -0.003537f}, + {+0.376029f, +0.026217f, -0.006323f}, + {+0.042499f, +0.013437f, -0.001738f}, + {-0.120763f, +0.008891f, +0.001968f} + }, + { + {-0.150437f, -0.012367f, -0.001050f}, + {+0.234297f, -0.021072f, -0.000774f}, + {-0.046092f, -0.025628f, -0.001827f}, + {-0.163500f, +0.007913f, +0.005640f} + }, + { + {-0.224579f, +0.011037f, +0.001567f}, + {+0.118032f, +0.020982f, +0.001167f}, + {-0.190587f, +0.031698f, +0.001189f}, + {-0.181600f, +0.008625f, +0.006827f} + }, + { + {-0.283765f, -0.012148f, +0.001665f}, + {+0.031141f, -0.014212f, +0.000704f}, + {-0.354999f, -0.033990f, +0.005051f}, + {-0.201565f, -0.012572f, +0.001547f} + }, + { + {-0.330851f, +0.010110f, +0.000281f}, + {-0.032740f, +0.010680f, +0.000608f}, + {-0.489897f, +0.028555f, +0.005370f}, + {-0.226930f, +0.003469f, +0.000412f} + }, + { + {-0.370651f, -0.006974f, -0.000273f}, + {-0.085140f, -0.009699f, +0.000484f}, + {-0.550417f, -0.008550f, +0.002078f}, + {-0.248676f, -0.002190f, +0.002941f} + }, + { + {-0.408944f, +0.005900f, +0.000497f}, + {-0.135902f, +0.010386f, +0.000573f}, + {-0.516823f, -0.021637f, +0.000484f}, + {-0.254059f, +0.003659f, +0.002185f} + }, + { + {-0.450752f, -0.008484f, +0.001446f}, + {-0.191283f, -0.014617f, -0.000163f}, + {-0.408035f, +0.040263f, +0.003661f}, + {-0.231639f, +0.007741f, +0.000045f} + }, + { + {-0.497579f, +0.012039f, +0.001191f}, + {-0.253854f, +0.015815f, -0.001949f}, + {-0.274552f, -0.030994f, +0.006408f}, + {-0.178594f, -0.020739f, +0.002028f} + }, + { + {-0.545362f, -0.010634f, +0.000559f}, + {-0.324146f, -0.011460f, -0.001641f}, + {-0.169370f, +0.009075f, +0.003395f}, + {-0.105323f, +0.013694f, +0.002900f} + }, + { + {-0.587196f, +0.008279f, +0.000328f}, + {-0.403134f, +0.010566f, +0.002217f}, + {-0.118490f, +0.003381f, -0.001814f}, + {-0.027446f, -0.008251f, -0.001827f} + }, + { + {-0.618017f, -0.004259f, +0.000361f}, + {-0.490358f, -0.020714f, +0.004529f}, + {-0.113358f, -0.003251f, -0.002770f}, + {+0.041459f, +0.013481f, -0.005194f} + }, + { + {-0.637687f, +0.001567f, +0.000820f}, + {-0.576790f, +0.023931f, +0.002213f}, + {-0.125198f, +0.004103f, -0.001443f}, + {+0.086209f, -0.010781f, -0.003979f} + }, + { + {-0.651150f, -0.001076f, +0.001428f}, + {-0.645409f, -0.014669f, -0.000718f}, + {-0.123622f, +0.001940f, -0.001608f}, + {+0.092869f, +0.002431f, -0.000324f} + }, + { + {-0.664780f, +0.003292f, +0.001710f}, + {-0.683586f, +0.000299f, -0.000557f}, + {-0.092026f, -0.012393f, -0.001589f}, + {+0.056395f, +0.017649f, +0.000374f} + }, + { + {-0.682371f, -0.006662f, +0.000792f}, + {-0.693411f, +0.007664f, +0.002560f}, + {-0.036899f, +0.016426f, -0.000987f}, + {-0.012285f, -0.023342f, -0.003158f} + }, + { + {-0.702854f, +0.004929f, -0.000169f}, + {-0.690742f, -0.001912f, +0.004494f}, + {+0.017981f, -0.013806f, -0.000030f}, + {-0.088921f, +0.012514f, -0.003181f} + }, + { + {-0.722549f, -0.002146f, +0.000430f}, + {-0.692300f, -0.005917f, +0.002876f}, + {+0.046872f, +0.003463f, +0.001220f}, + {-0.154235f, -0.010645f, -0.001356f} + }, + { + {-0.739092f, +0.002594f, +0.001242f}, + {-0.704186f, +0.008734f, -0.000319f}, + {+0.036822f, +0.011640f, +0.000478f}, + {-0.201705f, +0.002195f, +0.000385f} + }, + { + {-0.751826f, -0.003070f, +0.000998f}, + {-0.721419f, -0.002290f, -0.001142f}, + {-0.005059f, -0.018609f, -0.002901f}, + {-0.237750f, -0.005780f, +0.002036f} + }, + { + {-0.760887f, +0.001608f, +0.000546f}, + {-0.736911f, +0.001064f, +0.000228f}, + {-0.057870f, +0.010116f, -0.004534f}, + {-0.273933f, +0.006641f, +0.002467f} + }, + { + {-0.767195f, -0.000265f, +0.000748f}, + {-0.748024f, -0.000586f, +0.001053f}, + {-0.102334f, +0.003212f, +0.000059f}, + {-0.315083f, -0.011342f, +0.002600f} + }, + { + {-0.772327f, +0.001114f, +0.000964f}, + {-0.756683f, +0.002199f, +0.000983f}, + {-0.133057f, +0.004906f, +0.003973f}, + {-0.355964f, +0.012189f, +0.001107f} + }, + { + {-0.777379f, -0.001664f, +0.000676f}, + {-0.767213f, -0.002558f, +0.000597f}, + {-0.152753f, -0.009690f, +0.001092f}, + {-0.384303f, -0.006913f, -0.001047f} + }, + { + {-0.782304f, +0.001186f, +0.000401f}, + {-0.783173f, +0.004116f, +0.000499f}, + {-0.161920f, -0.000439f, -0.001076f}, + {-0.390874f, -0.005592f, -0.000791f} + }, + { + {-0.786466f, -0.000413f, +0.000504f}, + {-0.805468f, -0.004296f, +0.000905f}, + {-0.161504f, +0.005798f, +0.001317f}, + {-0.378159f, +0.009420f, +0.002017f} + }, + { + {-0.789480f, +0.000911f, +0.000469f}, + {-0.831991f, +0.006156f, +0.001415f}, + {-0.154727f, +0.000127f, +0.002457f}, + {-0.358994f, -0.003224f, +0.003001f} + }, + { + {-0.791179f, +0.000118f, +0.000378f}, + {-0.858608f, -0.007156f, +0.000826f}, + {-0.143224f, -0.002141f, -0.000223f}, + {-0.346009f, -0.003832f, +0.000505f} + }, + { + {-0.791713f, -0.000506f, +0.000690f}, + {-0.880258f, +0.003409f, +0.000310f}, + {-0.126671f, -0.005516f, -0.001744f}, + {-0.344447f, +0.002552f, -0.002098f} + }, + { + {-0.791760f, -0.000637f, +0.000646f}, + {-0.894068f, +0.000147f, +0.001099f}, + {-0.106700f, +0.011976f, +0.001536f}, + {-0.352724f, +0.003880f, -0.000028f} + }, + { + {-0.791607f, +0.000326f, +0.000259f}, + {-0.900705f, -0.000766f, +0.002346f}, + {-0.087833f, -0.003369f, +0.004535f}, + {-0.367814f, +0.002794f, +0.003185f} + }, + { + {-0.791360f, +0.000216f, +0.000145f}, + {-0.902761f, -0.003469f, +0.001579f}, + {-0.071216f, -0.005336f, +0.001636f}, + {-0.384313f, -0.008317f, +0.002102f} + }, + { + {-0.791514f, -0.000959f, +0.000554f}, + {-0.901431f, +0.000403f, -0.000135f}, + {-0.050334f, -0.003160f, -0.002061f}, + {-0.392811f, +0.004068f, -0.000843f} + }, + { + {-0.792816f, -0.000333f, +0.001006f}, + {-0.897192f, +0.003319f, +0.000240f}, + {-0.018937f, +0.014843f, -0.000267f}, + {-0.385889f, +0.008000f, -0.000602f} + }, + { + {-0.795515f, +0.001892f, +0.000664f}, + {-0.892619f, -0.002628f, +0.001553f}, + {+0.020997f, -0.013093f, +0.003597f}, + {-0.364329f, -0.010852f, +0.002618f} + }, + { + {-0.798742f, -0.001369f, -0.000006f}, + {-0.889854f, +0.001159f, +0.002594f}, + {+0.062746f, +0.000823f, +0.002081f}, + {-0.335764f, +0.002095f, +0.002620f} + }, + { + {-0.801561f, -0.000332f, -0.000055f}, + {-0.888481f, +0.002442f, +0.002445f}, + {+0.101614f, +0.005650f, -0.006242f}, + {-0.306982f, +0.005040f, -0.003292f} + }, + { + {-0.803505f, +0.001996f, +0.000969f}, + {-0.886774f, -0.004132f, +0.000094f}, + {+0.134585f, +0.001923f, -0.014731f}, + {-0.282127f, -0.002996f, -0.011457f} + } +}; + +const float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +{ + { + {-0.171042f, +0.590899f, -0.184148f}, + {-0.244016f, +0.359802f, -0.065072f}, + {-0.014995f, +0.035748f, -0.012250f}, + {-0.031507f, +0.034780f, -0.009895f} + }, + { + {-0.228601f, +0.478433f, -0.200802f}, + {-0.468416f, -0.184796f, -0.220307f}, + {-0.021499f, +0.027785f, -0.012584f}, + {-0.060325f, +0.030602f, -0.002599f} + }, + { + {+0.101029f, -0.456163f, +0.083058f}, + {-0.043611f, -0.870939f, -0.055288f}, + {+0.001858f, +0.027597f, -0.016310f}, + {-0.029059f, +0.033806f, -0.005356f} + }, + { + {+0.410000f, -0.084502f, +0.139239f}, + {+0.675225f, +0.218111f, +0.204844f}, + {+0.040662f, +0.051315f, -0.018039f}, + {+0.063503f, +0.056458f, -0.016519f} + }, + { + {+0.415696f, +0.265055f, +0.002626f}, + {+1.013647f, +0.334903f, +0.081079f}, + {+0.065042f, -0.040883f, +0.012352f}, + {+0.181037f, -0.059880f, +0.005085f} + }, + { + {+0.148368f, -0.111388f, -0.073685f}, + {+0.845933f, -0.250930f, -0.091257f}, + {+0.025616f, -0.060138f, +0.012766f}, + {+0.228995f, -0.032819f, +0.003215f} + }, + { + {-0.193830f, -0.014212f, -0.040266f}, + {+0.402943f, +0.020025f, -0.092885f}, + {-0.058690f, +0.041101f, -0.008172f}, + {+0.161828f, +0.015394f, -0.004824f} + }, + { + {-0.448848f, +0.024310f, +0.012126f}, + {-0.042491f, +0.043522f, -0.007450f}, + {-0.129054f, -0.013924f, -0.014446f}, + {-0.004772f, -0.042423f, +0.005623f} + }, + { + {-0.581348f, +0.015560f, +0.027528f}, + {-0.364335f, +0.028974f, +0.038991f}, + {-0.152614f, -0.032355f, -0.005641f}, + {-0.218401f, +0.075676f, -0.000317f} + }, + { + {-0.641251f, -0.033204f, +0.014171f}, + {-0.576730f, -0.078039f, +0.024279f}, + {-0.144066f, +0.021824f, +0.009938f}, + {-0.391879f, -0.026769f, -0.009335f} + }, + { + {-0.678995f, +0.021986f, +0.000075f}, + {-0.725441f, +0.048920f, -0.000285f}, + {-0.153455f, +0.022432f, +0.008363f}, + {-0.464657f, -0.026611f, +0.001799f} + }, + { + {-0.709246f, -0.001743f, -0.002228f}, + {-0.829481f, -0.007880f, -0.002786f}, + {-0.208073f, -0.023291f, +0.000232f}, + {-0.446725f, +0.013756f, +0.010505f} + }, + { + {-0.725841f, -0.005310f, +0.002197f}, + {-0.889756f, -0.003342f, +0.005446f}, + {-0.296494f, +0.020861f, +0.000461f}, + {-0.383826f, -0.016046f, +0.008157f} + }, + { + {-0.724803f, +0.003851f, +0.004749f}, + {-0.910037f, -0.002807f, +0.007312f}, + {-0.382641f, -0.013902f, +0.003575f}, + {-0.319137f, +0.005237f, +0.005556f} + }, + { + {-0.710495f, -0.001176f, +0.003666f}, + {-0.902293f, -0.002075f, +0.004352f}, + {-0.421514f, +0.001837f, +0.005564f}, + {-0.276374f, +0.006416f, -0.000678f} + }, + { + {-0.690926f, +0.001911f, +0.001428f}, + {-0.883286f, +0.004067f, +0.003096f}, + {-0.382030f, +0.012331f, +0.003744f}, + {-0.247702f, +0.008689f, -0.002881f} + }, + { + {-0.672402f, -0.004418f, +0.000819f}, + {-0.868037f, -0.001291f, +0.002503f}, + {-0.260382f, -0.031252f, -0.000392f}, + {-0.215212f, -0.010735f, +0.000421f} + }, + { + {-0.658558f, +0.003708f, +0.001700f}, + {-0.863001f, -0.000603f, +0.002111f}, + {-0.084457f, +0.046037f, -0.001989f}, + {-0.169471f, +0.007931f, +0.000103f} + }, + { + {-0.650017f, -0.001079f, +0.002333f}, + {-0.867523f, +0.003563f, +0.001620f}, + {+0.093137f, -0.042759f, +0.000290f}, + {-0.110082f, -0.012804f, -0.002290f} + }, + { + {-0.643665f, -0.001088f, +0.001723f}, + {-0.877421f, -0.003410f, +0.000713f}, + {+0.217492f, +0.016953f, +0.001740f}, + {-0.046668f, +0.018761f, -0.001213f} + }, + { + {-0.633405f, -0.001560f, +0.000669f}, + {-0.887575f, -0.001389f, +0.001467f}, + {+0.260289f, +0.010429f, -0.001427f}, + {+0.003491f, -0.008000f, +0.000581f} + }, + { + {-0.613764f, +0.006196f, +0.000648f}, + {-0.893912f, +0.004015f, +0.004684f}, + {+0.234569f, -0.016937f, -0.004729f}, + {+0.024290f, -0.008269f, -0.003225f} + }, + { + {-0.584438f, -0.007700f, +0.000979f}, + {-0.892617f, +0.003169f, +0.005373f}, + {+0.180710f, +0.012490f, -0.004688f}, + {+0.010563f, +0.002672f, -0.005332f} + }, + { + {-0.550310f, +0.008552f, +0.001243f}, + {-0.875679f, -0.001053f, +0.001808f}, + {+0.139761f, -0.001299f, -0.002407f}, + {-0.037114f, -0.006797f, -0.001129f} + }, + { + {-0.518417f, -0.006133f, +0.001495f}, + {-0.833856f, -0.011056f, -0.000737f}, + {+0.132343f, -0.004055f, -0.000776f}, + {-0.115163f, +0.018375f, +0.002028f} + }, + { + {-0.493716f, +0.003010f, +0.001174f}, + {-0.768131f, +0.020508f, -0.000066f}, + {+0.152693f, +0.008282f, -0.001169f}, + {-0.209710f, -0.025096f, +0.001590f} + }, + { + {-0.475954f, -0.001122f, +0.000352f}, + {-0.692851f, -0.022031f, +0.002804f}, + {+0.177765f, -0.009921f, +0.000059f}, + {-0.298030f, +0.020217f, -0.000155f} + }, + { + {-0.460792f, +0.002405f, -0.000376f}, + {-0.628175f, +0.009296f, +0.003825f}, + {+0.180171f, -0.003908f, +0.001064f}, + {-0.358358f, -0.006713f, -0.000347f} + }, + { + {-0.443319f, -0.006234f, +0.000246f}, + {-0.585810f, +0.000344f, +0.001004f}, + {+0.146499f, +0.011689f, +0.000951f}, + {-0.382061f, -0.004531f, +0.001751f} + }, + { + {-0.421955f, +0.005364f, +0.001214f}, + {-0.561763f, -0.000808f, -0.002176f}, + {+0.084775f, -0.020993f, +0.000045f}, + {-0.377713f, +0.006390f, +0.003942f} + }, + { + {-0.398163f, -0.003724f, +0.000751f}, + {-0.543402f, -0.007140f, -0.001937f}, + {+0.018165f, +0.017000f, -0.002291f}, + {-0.362688f, -0.001927f, +0.003741f} + }, + { + {-0.373625f, +0.004821f, +0.000045f}, + {-0.521728f, +0.008459f, +0.000565f}, + {-0.028207f, -0.002987f, -0.002148f}, + {-0.349401f, +0.000605f, +0.002646f} + }, + { + {-0.349815f, -0.005517f, +0.000230f}, + {-0.496496f, -0.005695f, +0.001454f}, + {-0.043081f, -0.009641f, +0.002012f}, + {-0.338864f, +0.001346f, +0.001602f} + }, + { + {-0.328050f, +0.004001f, +0.000439f}, + {-0.471819f, +0.004175f, +0.001005f}, + {-0.032608f, +0.005428f, +0.005314f}, + {-0.322952f, +0.001273f, -0.000092f} + }, + { + {-0.308595f, -0.003134f, +0.000145f}, + {-0.451672f, -0.002574f, +0.000427f}, + {-0.010290f, +0.004974f, +0.001398f}, + {-0.292677f, -0.007601f, -0.001415f} + }, + { + {-0.290597f, +0.003355f, -0.000136f}, + {-0.436743f, +0.002865f, +0.000374f}, + {+0.017338f, +0.007331f, -0.002166f}, + {-0.247618f, +0.015355f, -0.000635f} + }, + { + {-0.272998f, -0.004175f, +0.000021f}, + {-0.424310f, -0.002403f, +0.000711f}, + {+0.047898f, -0.011482f, +0.000426f}, + {-0.198447f, -0.014503f, +0.001973f} + }, + { + {-0.255459f, +0.003452f, +0.000162f}, + {-0.409862f, +0.003440f, +0.000963f}, + {+0.077199f, +0.004028f, +0.001741f}, + {-0.160349f, +0.003060f, +0.002227f} + }, + { + {-0.238237f, -0.003448f, +0.000017f}, + {-0.389274f, -0.003315f, +0.000451f}, + {+0.103396f, -0.000155f, -0.000865f}, + {-0.141016f, +0.003270f, -0.000528f} + }, + { + {-0.221659f, +0.003880f, +0.000200f}, + {-0.360274f, +0.007600f, -0.000068f}, + {+0.127118f, +0.006707f, -0.002120f}, + {-0.136776f, -0.001506f, -0.002388f} + }, + { + {-0.206321f, -0.002421f, +0.000222f}, + {-0.323761f, -0.010008f, +0.000633f}, + {+0.147702f, -0.009697f, +0.000777f}, + {-0.138196f, -0.005501f, -0.000185f} + }, + { + {-0.192402f, +0.002339f, -0.000141f}, + {-0.283782f, +0.009026f, +0.001400f}, + {+0.162715f, +0.001250f, +0.002766f}, + {-0.137599f, +0.001369f, +0.002680f} + }, + { + {-0.179623f, -0.002933f, -0.000145f}, + {-0.244500f, -0.005039f, +0.000589f}, + {+0.172860f, +0.006728f, -0.000517f}, + {-0.130069f, +0.003207f, +0.001003f} + }, + { + {-0.168039f, +0.002857f, +0.000210f}, + {-0.207651f, +0.005569f, -0.001162f}, + {+0.183789f, +0.001069f, -0.004319f}, + {-0.111107f, +0.002870f, -0.002170f} + }, + { + {-0.157725f, -0.001947f, +0.000454f}, + {-0.172892f, -0.010252f, -0.000596f}, + {+0.198825f, -0.011358f, -0.002404f}, + {-0.080708f, -0.012176f, -0.001780f} + }, + { + {-0.148241f, +0.000618f, +0.000026f}, + {-0.141203f, +0.007243f, +0.001063f}, + {+0.212313f, +0.004737f, +0.000973f}, + {-0.046659f, +0.011069f, +0.000996f} + }, + { + {-0.138402f, -0.001765f, -0.000579f}, + {-0.113224f, -0.004585f, +0.001287f}, + {+0.215767f, +0.007978f, -0.001019f}, + {-0.020004f, +0.000374f, +0.000573f} + }, + { + {-0.127236f, +0.003443f, -0.000426f}, + {-0.086775f, +0.002732f, +0.000319f}, + {+0.206200f, -0.011017f, -0.006667f}, + {-0.006720f, -0.005737f, -0.003684f} + }, + { + {-0.114738f, -0.003852f, +0.000286f}, + {-0.059179f, -0.002958f, -0.001772f}, + {+0.184707f, +0.002148f, -0.008785f}, + {-0.006688f, +0.000728f, -0.006182f} + }, + { + {-0.100815f, +0.002358f, +0.000595f}, + {-0.029594f, +0.008594f, -0.002770f}, + {+0.151524f, +0.003310f, -0.003987f}, + {-0.019197f, +0.005615f, -0.002853f} + } +}; + +const float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +{ + { + {+0.181652f, +0.754551f, +0.218658f}, + {-0.313875f, +0.422228f, -0.135528f}, + {+0.014440f, +0.116710f, -0.013575f}, + {+0.042997f, +0.018886f, -0.015597f} + }, + { + {-0.171103f, -0.431000f, -0.158827f}, + {+0.162330f, +1.016290f, -0.055279f}, + {-0.009076f, +0.107488f, -0.010075f}, + {-0.002269f, +0.060685f, +0.014338f} + }, + { + {-0.320265f, -0.250765f, -0.167171f}, + {+0.685853f, -0.069215f, +0.258616f}, + {-0.021745f, +0.080557f, +0.010049f}, + {-0.070084f, +0.090970f, +0.018109f} + }, + { + {-0.090062f, +0.396798f, +0.031329f}, + {+0.547868f, -0.612159f, +0.064837f}, + {-0.014055f, +0.010916f, -0.020054f}, + {-0.104609f, -0.009719f, -0.014645f} + }, + { + {+0.310752f, -0.054756f, +0.106519f}, + {-0.077791f, +0.305320f, -0.144875f}, + {+0.048626f, -0.050345f, -0.007511f}, + {-0.035749f, -0.049561f, -0.008157f} + }, + { + {+0.590278f, -0.119063f, +0.024674f}, + {-0.708076f, +0.088569f, -0.094265f}, + {+0.119880f, +0.048720f, +0.014661f}, + {+0.120422f, +0.058573f, +0.004643f} + }, + { + {+0.638355f, +0.074625f, -0.043889f}, + {-1.048572f, -0.131298f, +0.037692f}, + {+0.143385f, +0.033975f, +0.014623f}, + {+0.293747f, -0.017822f, -0.000451f} + }, + { + {+0.521197f, -0.005266f, -0.041412f}, + {-1.094584f, -0.000210f, +0.073803f}, + {+0.109004f, -0.035628f, -0.003452f}, + {+0.407579f, +0.034241f, -0.002887f} + }, + { + {+0.361479f, -0.014806f, -0.009497f}, + {-0.986770f, +0.046512f, +0.029288f}, + {+0.057809f, +0.027844f, -0.015215f}, + {+0.409283f, +0.014805f, +0.005752f} + }, + { + {+0.229108f, -0.009840f, +0.009477f}, + {-0.839323f, -0.000705f, -0.009034f}, + {+0.036287f, +0.030074f, -0.010227f}, + {+0.293083f, -0.069929f, -0.004421f} + }, + { + {+0.125590f, +0.030181f, +0.007318f}, + {-0.687756f, -0.052219f, -0.009126f}, + {+0.052382f, -0.019274f, +0.003613f}, + {+0.122951f, +0.036356f, -0.013394f} + }, + { + {+0.030890f, -0.030176f, -0.000832f}, + {-0.531513f, +0.048483f, +0.004668f}, + {+0.067811f, -0.004747f, +0.002746f}, + {-0.026040f, -0.009502f, -0.004388f} + }, + { + {-0.062962f, +0.019124f, -0.003537f}, + {-0.376029f, -0.026217f, +0.006323f}, + {+0.042499f, +0.013437f, -0.001738f}, + {-0.120763f, +0.008891f, +0.001968f} + }, + { + {-0.150437f, -0.012367f, -0.001050f}, + {-0.234297f, +0.021072f, +0.000774f}, + {-0.046092f, -0.025628f, -0.001827f}, + {-0.163500f, +0.007913f, +0.005640f} + }, + { + {-0.224579f, +0.011037f, +0.001567f}, + {-0.118032f, -0.020982f, -0.001167f}, + {-0.190587f, +0.031698f, +0.001189f}, + {-0.181600f, +0.008625f, +0.006827f} + }, + { + {-0.283765f, -0.012148f, +0.001665f}, + {-0.031141f, +0.014212f, -0.000704f}, + {-0.354999f, -0.033990f, +0.005051f}, + {-0.201565f, -0.012572f, +0.001547f} + }, + { + {-0.330851f, +0.010110f, +0.000281f}, + {+0.032740f, -0.010680f, -0.000608f}, + {-0.489897f, +0.028555f, +0.005370f}, + {-0.226930f, +0.003469f, +0.000412f} + }, + { + {-0.370651f, -0.006974f, -0.000273f}, + {+0.085140f, +0.009699f, -0.000484f}, + {-0.550417f, -0.008550f, +0.002078f}, + {-0.248676f, -0.002190f, +0.002941f} + }, + { + {-0.408944f, +0.005900f, +0.000497f}, + {+0.135902f, -0.010386f, -0.000573f}, + {-0.516823f, -0.021637f, +0.000484f}, + {-0.254059f, +0.003659f, +0.002185f} + }, + { + {-0.450752f, -0.008484f, +0.001446f}, + {+0.191283f, +0.014617f, +0.000163f}, + {-0.408035f, +0.040263f, +0.003661f}, + {-0.231639f, +0.007741f, +0.000045f} + }, + { + {-0.497579f, +0.012039f, +0.001191f}, + {+0.253854f, -0.015815f, +0.001949f}, + {-0.274552f, -0.030994f, +0.006408f}, + {-0.178594f, -0.020739f, +0.002028f} + }, + { + {-0.545362f, -0.010634f, +0.000559f}, + {+0.324146f, +0.011460f, +0.001641f}, + {-0.169370f, +0.009075f, +0.003395f}, + {-0.105323f, +0.013694f, +0.002900f} + }, + { + {-0.587196f, +0.008279f, +0.000328f}, + {+0.403134f, -0.010566f, -0.002217f}, + {-0.118490f, +0.003381f, -0.001814f}, + {-0.027446f, -0.008251f, -0.001827f} + }, + { + {-0.618017f, -0.004259f, +0.000361f}, + {+0.490358f, +0.020714f, -0.004529f}, + {-0.113358f, -0.003251f, -0.002770f}, + {+0.041459f, +0.013481f, -0.005194f} + }, + { + {-0.637687f, +0.001567f, +0.000820f}, + {+0.576790f, -0.023931f, -0.002213f}, + {-0.125198f, +0.004103f, -0.001443f}, + {+0.086209f, -0.010781f, -0.003979f} + }, + { + {-0.651150f, -0.001076f, +0.001428f}, + {+0.645409f, +0.014669f, +0.000718f}, + {-0.123622f, +0.001940f, -0.001608f}, + {+0.092869f, +0.002431f, -0.000324f} + }, + { + {-0.664780f, +0.003292f, +0.001710f}, + {+0.683586f, -0.000299f, +0.000557f}, + {-0.092026f, -0.012393f, -0.001589f}, + {+0.056395f, +0.017649f, +0.000374f} + }, + { + {-0.682371f, -0.006662f, +0.000792f}, + {+0.693411f, -0.007664f, -0.002560f}, + {-0.036899f, +0.016426f, -0.000987f}, + {-0.012285f, -0.023342f, -0.003158f} + }, + { + {-0.702854f, +0.004929f, -0.000169f}, + {+0.690742f, +0.001912f, -0.004494f}, + {+0.017981f, -0.013806f, -0.000030f}, + {-0.088921f, +0.012514f, -0.003181f} + }, + { + {-0.722549f, -0.002146f, +0.000430f}, + {+0.692300f, +0.005917f, -0.002876f}, + {+0.046872f, +0.003463f, +0.001220f}, + {-0.154235f, -0.010645f, -0.001356f} + }, + { + {-0.739092f, +0.002594f, +0.001242f}, + {+0.704186f, -0.008734f, +0.000319f}, + {+0.036822f, +0.011640f, +0.000478f}, + {-0.201705f, +0.002195f, +0.000385f} + }, + { + {-0.751826f, -0.003070f, +0.000998f}, + {+0.721419f, +0.002290f, +0.001142f}, + {-0.005059f, -0.018609f, -0.002901f}, + {-0.237750f, -0.005780f, +0.002036f} + }, + { + {-0.760887f, +0.001608f, +0.000546f}, + {+0.736911f, -0.001064f, -0.000228f}, + {-0.057870f, +0.010116f, -0.004534f}, + {-0.273933f, +0.006641f, +0.002467f} + }, + { + {-0.767195f, -0.000265f, +0.000748f}, + {+0.748024f, +0.000586f, -0.001053f}, + {-0.102334f, +0.003212f, +0.000059f}, + {-0.315083f, -0.011342f, +0.002600f} + }, + { + {-0.772327f, +0.001114f, +0.000964f}, + {+0.756683f, -0.002199f, -0.000983f}, + {-0.133057f, +0.004906f, +0.003973f}, + {-0.355964f, +0.012189f, +0.001107f} + }, + { + {-0.777379f, -0.001664f, +0.000676f}, + {+0.767213f, +0.002558f, -0.000597f}, + {-0.152753f, -0.009690f, +0.001092f}, + {-0.384303f, -0.006913f, -0.001047f} + }, + { + {-0.782304f, +0.001186f, +0.000401f}, + {+0.783173f, -0.004116f, -0.000499f}, + {-0.161920f, -0.000439f, -0.001076f}, + {-0.390874f, -0.005592f, -0.000791f} + }, + { + {-0.786466f, -0.000413f, +0.000504f}, + {+0.805468f, +0.004296f, -0.000905f}, + {-0.161504f, +0.005798f, +0.001317f}, + {-0.378159f, +0.009420f, +0.002017f} + }, + { + {-0.789480f, +0.000911f, +0.000469f}, + {+0.831991f, -0.006156f, -0.001415f}, + {-0.154727f, +0.000127f, +0.002457f}, + {-0.358994f, -0.003224f, +0.003001f} + }, + { + {-0.791179f, +0.000118f, +0.000378f}, + {+0.858608f, +0.007156f, -0.000826f}, + {-0.143224f, -0.002141f, -0.000223f}, + {-0.346009f, -0.003832f, +0.000505f} + }, + { + {-0.791713f, -0.000506f, +0.000690f}, + {+0.880258f, -0.003409f, -0.000310f}, + {-0.126671f, -0.005516f, -0.001744f}, + {-0.344447f, +0.002552f, -0.002098f} + }, + { + {-0.791760f, -0.000637f, +0.000646f}, + {+0.894068f, -0.000147f, -0.001099f}, + {-0.106700f, +0.011976f, +0.001536f}, + {-0.352724f, +0.003880f, -0.000028f} + }, + { + {-0.791607f, +0.000326f, +0.000259f}, + {+0.900705f, +0.000766f, -0.002346f}, + {-0.087833f, -0.003369f, +0.004535f}, + {-0.367814f, +0.002794f, +0.003185f} + }, + { + {-0.791360f, +0.000216f, +0.000145f}, + {+0.902761f, +0.003469f, -0.001579f}, + {-0.071216f, -0.005336f, +0.001636f}, + {-0.384313f, -0.008317f, +0.002102f} + }, + { + {-0.791514f, -0.000959f, +0.000554f}, + {+0.901431f, -0.000403f, +0.000135f}, + {-0.050334f, -0.003160f, -0.002061f}, + {-0.392811f, +0.004068f, -0.000843f} + }, + { + {-0.792816f, -0.000333f, +0.001006f}, + {+0.897192f, -0.003319f, -0.000240f}, + {-0.018937f, +0.014843f, -0.000267f}, + {-0.385889f, +0.008000f, -0.000602f} + }, + { + {-0.795515f, +0.001892f, +0.000664f}, + {+0.892619f, +0.002628f, -0.001553f}, + {+0.020997f, -0.013093f, +0.003597f}, + {-0.364329f, -0.010852f, +0.002618f} + }, + { + {-0.798742f, -0.001369f, -0.000006f}, + {+0.889854f, -0.001159f, -0.002594f}, + {+0.062746f, +0.000823f, +0.002081f}, + {-0.335764f, +0.002095f, +0.002620f} + }, + { + {-0.801561f, -0.000332f, -0.000055f}, + {+0.888481f, -0.002442f, -0.002445f}, + {+0.101614f, +0.005650f, -0.006242f}, + {-0.306982f, +0.005040f, -0.003292f} + }, + { + {-0.803505f, +0.001996f, +0.000969f}, + {+0.886774f, +0.004132f, -0.000094f}, + {+0.134585f, +0.001923f, -0.014731f}, + {-0.282127f, -0.002996f, -0.011457f} + } +}; + +const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +{ + { + {-0.171042f, +0.590899f, -0.184148f}, + {+0.244016f, -0.359802f, +0.065072f}, + {-0.014995f, +0.035748f, -0.012250f}, + {-0.031507f, +0.034780f, -0.009895f} + }, + { + {-0.228601f, +0.478433f, -0.200802f}, + {+0.468416f, +0.184796f, +0.220307f}, + {-0.021499f, +0.027785f, -0.012584f}, + {-0.060325f, +0.030602f, -0.002599f} + }, + { + {+0.101029f, -0.456163f, +0.083058f}, + {+0.043611f, +0.870939f, +0.055288f}, + {+0.001858f, +0.027597f, -0.016310f}, + {-0.029059f, +0.033806f, -0.005356f} + }, + { + {+0.410000f, -0.084502f, +0.139239f}, + {-0.675225f, -0.218111f, -0.204844f}, + {+0.040662f, +0.051315f, -0.018039f}, + {+0.063503f, +0.056458f, -0.016519f} + }, + { + {+0.415696f, +0.265055f, +0.002626f}, + {-1.013647f, -0.334903f, -0.081079f}, + {+0.065042f, -0.040883f, +0.012352f}, + {+0.181037f, -0.059880f, +0.005085f} + }, + { + {+0.148368f, -0.111388f, -0.073685f}, + {-0.845933f, +0.250930f, +0.091257f}, + {+0.025616f, -0.060138f, +0.012766f}, + {+0.228995f, -0.032819f, +0.003215f} + }, + { + {-0.193830f, -0.014212f, -0.040266f}, + {-0.402943f, -0.020025f, +0.092885f}, + {-0.058690f, +0.041101f, -0.008172f}, + {+0.161828f, +0.015394f, -0.004824f} + }, + { + {-0.448848f, +0.024310f, +0.012126f}, + {+0.042491f, -0.043522f, +0.007450f}, + {-0.129054f, -0.013924f, -0.014446f}, + {-0.004772f, -0.042423f, +0.005623f} + }, + { + {-0.581348f, +0.015560f, +0.027528f}, + {+0.364335f, -0.028974f, -0.038991f}, + {-0.152614f, -0.032355f, -0.005641f}, + {-0.218401f, +0.075676f, -0.000317f} + }, + { + {-0.641251f, -0.033204f, +0.014171f}, + {+0.576730f, +0.078039f, -0.024279f}, + {-0.144066f, +0.021824f, +0.009938f}, + {-0.391879f, -0.026769f, -0.009335f} + }, + { + {-0.678995f, +0.021986f, +0.000075f}, + {+0.725441f, -0.048920f, +0.000285f}, + {-0.153455f, +0.022432f, +0.008363f}, + {-0.464657f, -0.026611f, +0.001799f} + }, + { + {-0.709246f, -0.001743f, -0.002228f}, + {+0.829481f, +0.007880f, +0.002786f}, + {-0.208073f, -0.023291f, +0.000232f}, + {-0.446725f, +0.013756f, +0.010505f} + }, + { + {-0.725841f, -0.005310f, +0.002197f}, + {+0.889756f, +0.003342f, -0.005446f}, + {-0.296494f, +0.020861f, +0.000461f}, + {-0.383826f, -0.016046f, +0.008157f} + }, + { + {-0.724803f, +0.003851f, +0.004749f}, + {+0.910037f, +0.002807f, -0.007312f}, + {-0.382641f, -0.013902f, +0.003575f}, + {-0.319137f, +0.005237f, +0.005556f} + }, + { + {-0.710495f, -0.001176f, +0.003666f}, + {+0.902293f, +0.002075f, -0.004352f}, + {-0.421514f, +0.001837f, +0.005564f}, + {-0.276374f, +0.006416f, -0.000678f} + }, + { + {-0.690926f, +0.001911f, +0.001428f}, + {+0.883286f, -0.004067f, -0.003096f}, + {-0.382030f, +0.012331f, +0.003744f}, + {-0.247702f, +0.008689f, -0.002881f} + }, + { + {-0.672402f, -0.004418f, +0.000819f}, + {+0.868037f, +0.001291f, -0.002503f}, + {-0.260382f, -0.031252f, -0.000392f}, + {-0.215212f, -0.010735f, +0.000421f} + }, + { + {-0.658558f, +0.003708f, +0.001700f}, + {+0.863001f, +0.000603f, -0.002111f}, + {-0.084457f, +0.046037f, -0.001989f}, + {-0.169471f, +0.007931f, +0.000103f} + }, + { + {-0.650017f, -0.001079f, +0.002333f}, + {+0.867523f, -0.003563f, -0.001620f}, + {+0.093137f, -0.042759f, +0.000290f}, + {-0.110082f, -0.012804f, -0.002290f} + }, + { + {-0.643665f, -0.001088f, +0.001723f}, + {+0.877421f, +0.003410f, -0.000713f}, + {+0.217492f, +0.016953f, +0.001740f}, + {-0.046668f, +0.018761f, -0.001213f} + }, + { + {-0.633405f, -0.001560f, +0.000669f}, + {+0.887575f, +0.001389f, -0.001467f}, + {+0.260289f, +0.010429f, -0.001427f}, + {+0.003491f, -0.008000f, +0.000581f} + }, + { + {-0.613764f, +0.006196f, +0.000648f}, + {+0.893912f, -0.004015f, -0.004684f}, + {+0.234569f, -0.016937f, -0.004729f}, + {+0.024290f, -0.008269f, -0.003225f} + }, + { + {-0.584438f, -0.007700f, +0.000979f}, + {+0.892617f, -0.003169f, -0.005373f}, + {+0.180710f, +0.012490f, -0.004688f}, + {+0.010563f, +0.002672f, -0.005332f} + }, + { + {-0.550310f, +0.008552f, +0.001243f}, + {+0.875679f, +0.001053f, -0.001808f}, + {+0.139761f, -0.001299f, -0.002407f}, + {-0.037114f, -0.006797f, -0.001129f} + }, + { + {-0.518417f, -0.006133f, +0.001495f}, + {+0.833856f, +0.011056f, +0.000737f}, + {+0.132343f, -0.004055f, -0.000776f}, + {-0.115163f, +0.018375f, +0.002028f} + }, + { + {-0.493716f, +0.003010f, +0.001174f}, + {+0.768131f, -0.020508f, +0.000066f}, + {+0.152693f, +0.008282f, -0.001169f}, + {-0.209710f, -0.025096f, +0.001590f} + }, + { + {-0.475954f, -0.001122f, +0.000352f}, + {+0.692851f, +0.022031f, -0.002804f}, + {+0.177765f, -0.009921f, +0.000059f}, + {-0.298030f, +0.020217f, -0.000155f} + }, + { + {-0.460792f, +0.002405f, -0.000376f}, + {+0.628175f, -0.009296f, -0.003825f}, + {+0.180171f, -0.003908f, +0.001064f}, + {-0.358358f, -0.006713f, -0.000347f} + }, + { + {-0.443319f, -0.006234f, +0.000246f}, + {+0.585810f, -0.000344f, -0.001004f}, + {+0.146499f, +0.011689f, +0.000951f}, + {-0.382061f, -0.004531f, +0.001751f} + }, + { + {-0.421955f, +0.005364f, +0.001214f}, + {+0.561763f, +0.000808f, +0.002176f}, + {+0.084775f, -0.020993f, +0.000045f}, + {-0.377713f, +0.006390f, +0.003942f} + }, + { + {-0.398163f, -0.003724f, +0.000751f}, + {+0.543402f, +0.007140f, +0.001937f}, + {+0.018165f, +0.017000f, -0.002291f}, + {-0.362688f, -0.001927f, +0.003741f} + }, + { + {-0.373625f, +0.004821f, +0.000045f}, + {+0.521728f, -0.008459f, -0.000565f}, + {-0.028207f, -0.002987f, -0.002148f}, + {-0.349401f, +0.000605f, +0.002646f} + }, + { + {-0.349815f, -0.005517f, +0.000230f}, + {+0.496496f, +0.005695f, -0.001454f}, + {-0.043081f, -0.009641f, +0.002012f}, + {-0.338864f, +0.001346f, +0.001602f} + }, + { + {-0.328050f, +0.004001f, +0.000439f}, + {+0.471819f, -0.004175f, -0.001005f}, + {-0.032608f, +0.005428f, +0.005314f}, + {-0.322952f, +0.001273f, -0.000092f} + }, + { + {-0.308595f, -0.003134f, +0.000145f}, + {+0.451672f, +0.002574f, -0.000427f}, + {-0.010290f, +0.004974f, +0.001398f}, + {-0.292677f, -0.007601f, -0.001415f} + }, + { + {-0.290597f, +0.003355f, -0.000136f}, + {+0.436743f, -0.002865f, -0.000374f}, + {+0.017338f, +0.007331f, -0.002166f}, + {-0.247618f, +0.015355f, -0.000635f} + }, + { + {-0.272998f, -0.004175f, +0.000021f}, + {+0.424310f, +0.002403f, -0.000711f}, + {+0.047898f, -0.011482f, +0.000426f}, + {-0.198447f, -0.014503f, +0.001973f} + }, + { + {-0.255459f, +0.003452f, +0.000162f}, + {+0.409862f, -0.003440f, -0.000963f}, + {+0.077199f, +0.004028f, +0.001741f}, + {-0.160349f, +0.003060f, +0.002227f} + }, + { + {-0.238237f, -0.003448f, +0.000017f}, + {+0.389274f, +0.003315f, -0.000451f}, + {+0.103396f, -0.000155f, -0.000865f}, + {-0.141016f, +0.003270f, -0.000528f} + }, + { + {-0.221659f, +0.003880f, +0.000200f}, + {+0.360274f, -0.007600f, +0.000068f}, + {+0.127118f, +0.006707f, -0.002120f}, + {-0.136776f, -0.001506f, -0.002388f} + }, + { + {-0.206321f, -0.002421f, +0.000222f}, + {+0.323761f, +0.010008f, -0.000633f}, + {+0.147702f, -0.009697f, +0.000777f}, + {-0.138196f, -0.005501f, -0.000185f} + }, + { + {-0.192402f, +0.002339f, -0.000141f}, + {+0.283782f, -0.009026f, -0.001400f}, + {+0.162715f, +0.001250f, +0.002766f}, + {-0.137599f, +0.001369f, +0.002680f} + }, + { + {-0.179623f, -0.002933f, -0.000145f}, + {+0.244500f, +0.005039f, -0.000589f}, + {+0.172860f, +0.006728f, -0.000517f}, + {-0.130069f, +0.003207f, +0.001003f} + }, + { + {-0.168039f, +0.002857f, +0.000210f}, + {+0.207651f, -0.005569f, +0.001162f}, + {+0.183789f, +0.001069f, -0.004319f}, + {-0.111107f, +0.002870f, -0.002170f} + }, + { + {-0.157725f, -0.001947f, +0.000454f}, + {+0.172892f, +0.010252f, +0.000596f}, + {+0.198825f, -0.011358f, -0.002404f}, + {-0.080708f, -0.012176f, -0.001780f} + }, + { + {-0.148241f, +0.000618f, +0.000026f}, + {+0.141203f, -0.007243f, -0.001063f}, + {+0.212313f, +0.004737f, +0.000973f}, + {-0.046659f, +0.011069f, +0.000996f} + }, + { + {-0.138402f, -0.001765f, -0.000579f}, + {+0.113224f, +0.004585f, -0.001287f}, + {+0.215767f, +0.007978f, -0.001019f}, + {-0.020004f, +0.000374f, +0.000573f} + }, + { + {-0.127236f, +0.003443f, -0.000426f}, + {+0.086775f, -0.002732f, -0.000319f}, + {+0.206200f, -0.011017f, -0.006667f}, + {-0.006720f, -0.005737f, -0.003684f} + }, + { + {-0.114738f, -0.003852f, +0.000286f}, + {+0.059179f, +0.002958f, +0.001772f}, + {+0.184707f, +0.002148f, -0.008785f}, + {-0.006688f, +0.000728f, -0.006182f} + }, + { + {-0.100815f, +0.002358f, +0.000595f}, + {+0.029594f, -0.008594f, +0.002770f}, + {+0.151524f, +0.003310f, -0.003987f}, + {-0.019197f, +0.005615f, -0.002853f} + } +}; +#endif const float FASTCONV_HRIR_latency_s = 0.000666667f; diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index 0cf8e35a6d..9bfa68b074 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -44,6 +44,20 @@ /* Binaural rendering data set based on HRIRs */ extern const float FASTCONV_HRIR_latency_s; +#ifdef UPDATE_FASTCONV_SBA_FILTER +extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; +extern float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; +extern float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; +extern float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; +extern float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; +extern float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; +extern float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; +extern float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; +#else extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; @@ -56,6 +70,7 @@ extern float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; extern float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; extern float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; extern float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; +#endif extern float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c763630325..abba25124c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -756,6 +756,22 @@ typedef struct ivas_hrtfs_fastconv_struct float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; float FASTCONV_HOA3_latency_s; +#ifdef UPDATE_FASTCONV_SBA_FILTER + float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; + float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; + float FASTCONV_HOA2_latency_s; + float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; + float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; + float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; + float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; + float FASTCONV_FOA_latency_s; + float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; + float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; + float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; + float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; +#else float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; @@ -771,6 +787,7 @@ typedef struct ivas_hrtfs_fastconv_struct float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; +#endif float FASTCONV_BRIR_latency_s; float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index e2181ca6e1..c2408e89ca 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -969,10 +969,17 @@ static ivas_error init_fastconv_HRTF_handle( { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + set_zero( hHrtf->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); +#else set_zero( hHrtf->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); +#endif } } hHrtf->FASTCONV_HOA2_latency_s = 0; @@ -980,10 +987,17 @@ static ivas_error init_fastconv_HRTF_handle( { for ( j = 0; j < 9; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + set_zero( hHrtf->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); +#else set_zero( hHrtf->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); +#endif } } hHrtf->FASTCONV_FOA_latency_s = 0; @@ -991,10 +1005,17 @@ static ivas_error init_fastconv_HRTF_handle( { for ( j = 0; j < 4; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + set_zero( hHrtf->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); + set_zero( hHrtf->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); +#else set_zero( hHrtf->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS ); +#endif } } @@ -1114,42 +1135,69 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } hrtf_data_rptr += sizeof( uint16_t ); +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" ); + } +#else if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); } +#endif hrtf_data_rptr += sizeof( uint16_t ); for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } } @@ -1165,42 +1213,69 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } hrtf_data_rptr += sizeof( uint16_t ); +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" ); + } +#else if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); } +#endif hrtf_data_rptr += sizeof( uint16_t ); for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } } @@ -1216,42 +1291,69 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } hrtf_data_rptr += sizeof( uint16_t ); +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" ); + } +#else if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); } +#endif hrtf_data_rptr += sizeof( uint16_t ); for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { +#ifdef UPDATE_FASTCONV_SBA_FILTER + memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#else memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); +#endif } } } -- GitLab From 077bc4b90d4f72a528bebff165579a242ef99c3d Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 28 Jun 2023 15:47:27 +0530 Subject: [PATCH 227/591] Added fix for bit inexactness of renderer pytest [x]Also added fix for a few ASAN warnings --- lib_dec/ivas_binRenderer_internal.c | 17 ++++++++--------- lib_dec/ivas_dec.c | 21 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index ed84955daf..f1e39caf8a 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1589,7 +1589,7 @@ void ivas_binaural_reverb_processFrame( return; } -void ivas_binRenderer_2( +static void ivas_binRenderer_2( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1747,16 +1747,14 @@ void ivas_binRenderer_2( } } #endif - - +#ifdef FIX_SPLIT_REND_MERGE /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) { - float reverbRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float reverbIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float inRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float inIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - + float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float inRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float inIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; ivas_binaural_obtain_DMX( numTimeSlots, hBinRenderer, RealBuffer, ImagBuffer, inRe, inIm ); for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) @@ -1768,7 +1766,7 @@ void ivas_binRenderer_2( } } - ivas_binaural_reverb_processFrame( hBinRenderer->hReverb, BINAURAL_CHANNELS, inRe, inIm, reverbRe, reverbIm, 0u ); + ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); /* Add the conv module and reverb module output */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) @@ -1791,6 +1789,7 @@ void ivas_binRenderer_2( } } +#endif pop_wmops(); return; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index fdabbaf08f..2ecb26f530 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -70,7 +70,9 @@ ivas_error ivas_dec( float pan_left, pan_right; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; - +#ifdef FIX_BIT_EXACT + int16_t i, j, k, l; +#endif error = IVAS_ERR_OK; push_wmops( "ivas_dec" ); @@ -761,7 +763,22 @@ ivas_error ivas_dec( hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; - +#ifdef FIX_BIT_EXACT + for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < CLDFB_NO_COL_MAX; k++ ) + { + for ( l = 0; l < CLDFB_NO_CHANNELS_MAX; l++ ) + { + hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[i][j][k][l] = 0.0f; + hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[i][j][k][l] = 0.0f; + } + } + } + } +#endif ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, -- GitLab From e23c90a0410f224baaa6e5323b907921e2c34b90 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 29 Jun 2023 13:14:52 +0530 Subject: [PATCH 228/591] Fixes for the updation of the branch with main --- lib_dec/ivas_binRenderer_internal.c | 4 ++-- lib_dec/ivas_dec.c | 21 ++-------------- lib_dec/ivas_dirac_dec.c | 25 +++++++++++++++++-- lib_rend/lib_rend.c | 37 ++++++++++++++++++++++++++++- 4 files changed, 63 insertions(+), 24 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f1e39caf8a..6c66a47ec7 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1395,8 +1395,8 @@ void ivas_binaural_cldfb_sf( #ifdef FIX_SPLIT_REND_MERGE st_ivas->hHeadTrackData, #endif -#ifdef FIX_SPLIT_REND_MERGE - NULL, +#ifdef SPLIT_REND_WITH_HEAD_ROT + &st_ivas->splitBinRend.splitrend.multiBinPoseData, #endif st_ivas->hCombinedOrientationData, subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 2ecb26f530..fdabbaf08f 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -70,9 +70,7 @@ ivas_error ivas_dec( float pan_left, pan_right; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; -#ifdef FIX_BIT_EXACT - int16_t i, j, k, l; -#endif + error = IVAS_ERR_OK; push_wmops( "ivas_dec" ); @@ -763,22 +761,7 @@ ivas_error ivas_dec( hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; -#ifdef FIX_BIT_EXACT - for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) - { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; k < CLDFB_NO_COL_MAX; k++ ) - { - for ( l = 0; l < CLDFB_NO_CHANNELS_MAX; l++ ) - { - hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[i][j][k][l] = 0.0f; - hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[i][j][k][l] = 0.0f; - } - } - } - } -#endif + ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 7940350a40..ef0a9de92d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2937,7 +2937,7 @@ void ivas_dirac_dec_render_sf( st_ivas->hHeadTrackData, #endif #ifdef SPLIT_REND_WITH_HEAD_ROT - NULL, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, #endif st_ivas->hCombinedOrientationData, subframe_idx, @@ -2946,7 +2946,28 @@ void ivas_dirac_dec_render_sf( Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + int16_t pos_idx; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) +#else + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) +#endif + { + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][index_slot + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][index_slot + slot_idx], hDirAC->num_freq_bands ); + } + } + } + } +#endif /* Inverse CLDFB*/ for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0b1f104408..061481e0dc 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1422,12 +1422,13 @@ static ivas_error setRendInputActiveIsm( error = IVAS_ERR_OK; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_LC3PLUS || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { +#ifndef FIX_SPLIT_REND_MERGE if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, NULL, *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1438,6 +1439,12 @@ static ivas_error setRendInputActiveIsm( { return error; } +#else + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif } else if ( outConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || outConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) { @@ -1448,17 +1455,45 @@ static ivas_error setRendInputActiveIsm( } else { +#ifndef FIX_SPLIT_REND_MERGE + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } + else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR) + { + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, + NULL, *rendCtx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 1 +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } -- GitLab From f190d90bbfa1783e1c296b87789811aab3c9b42f Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Thu, 29 Jun 2023 17:53:57 +1000 Subject: [PATCH 229/591] Use macros for SBA channel numbers --- lib_com/ivas_cnst.h | 7 +++++++ lib_com/options.h | 3 +-- lib_dec/ivas_binRenderer_internal.c | 6 +++--- lib_rend/ivas_rom_binauralRenderer.c | 24 ++++++++++++------------ lib_rend/ivas_rom_binauralRenderer.h | 24 ++++++++++++------------ lib_rend/ivas_stat_rend.h | 24 ++++++++++++------------ lib_util/hrtf_file_reader.c | 18 ++++++++++++------ 7 files changed, 59 insertions(+), 47 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3228c578d7..fdb256474c 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -174,6 +174,9 @@ typedef enum #define CPE_CHANNELS 2 /* number of CPE (stereo) channels */ #define FOA_CHANNELS 4 /* number of FOA channels */ #define HOA2_CHANNELS 9 +#ifdef UPDATE_FASTCONV_SBA_FILTER +#define HOA3_CHANNELS 16 +#endif #define MAX_NUM_OBJECTS 4 /* max. number of audio objects */ @@ -1509,7 +1512,11 @@ typedef enum #define BINAURAL_NTAPS_MAX 96 #define HRTF_SH_ORDER 3 +#ifdef UPDATE_FASTCONV_SBA_FILTER +#define HRTF_SH_CHANNELS HOA3_CHANNELS +#else #define HRTF_SH_CHANNELS 16 +#endif #define HRTF_LS_CHANNELS 15 #define HRTF_NUM_BINS 60 #define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ diff --git a/lib_com/options.h b/lib_com/options.h index 012bb52d42..d91da64469 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,8 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ - -#define UPDATE_FASTCONV_SBA_FILTER +#define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index cc855055ec..348833d0b1 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -441,21 +441,21 @@ static ivas_error ivas_binaural_hrtf_open( } #ifdef UPDATE_FASTCONV_SBA_FILTER - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + for ( j = 0; j < HOA3_CHANNELS; j++ ) { mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); mvr2r( leftHRIRImag_HOA3[i][j], HrtfFastConv->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); mvr2r( rightHRIRReal_HOA3[i][j], HrtfFastConv->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); } - for ( j = 0; j < 9; j++ ) + for ( j = 0; j < HOA2_CHANNELS; j++ ) { mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); mvr2r( leftHRIRImag_HOA2[i][j], HrtfFastConv->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); mvr2r( rightHRIRReal_HOA2[i][j], HrtfFastConv->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); } - for ( j = 0; j < 4; j++ ) + for ( j = 0; j < FOA_CHANNELS; j++ ) { mvr2r( leftHRIRReal_FOA[i][j], HrtfFastConv->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); mvr2r( leftHRIRImag_FOA[i][j], HrtfFastConv->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 2aea03c406..dfd82e0583 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -3676,7 +3676,7 @@ const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS]= #else const float FASTCONV_HOA3_latency_s = 0.000020833f; -const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { {+0.353305f, +0.566845f, +0.200116f}, @@ -4580,7 +4580,7 @@ const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= } }; -const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { {-0.191323f, +0.550462f, -0.164703f}, @@ -5484,7 +5484,7 @@ const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= } }; -const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { {+0.353305f, +0.566845f, +0.200116f}, @@ -6388,7 +6388,7 @@ const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= } }; -const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][BINAURAL_NTAPS_SBA]= +const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { {-0.191323f, +0.550462f, -0.164703f}, @@ -9515,7 +9515,7 @@ const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]= #else const float FASTCONV_HOA2_latency_s = 0.000020833f; -const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { {+0.018159f, +0.985146f, +0.240506f}, @@ -10069,7 +10069,7 @@ const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= } }; -const float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +const float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { {-0.067351f, +0.619497f, -0.224314f}, @@ -10623,7 +10623,7 @@ const float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= } }; -const float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +const float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { {+0.018159f, +0.985146f, +0.240506f}, @@ -11177,7 +11177,7 @@ const float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= } }; -const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]= +const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { {-0.067351f, +0.619497f, -0.224314f}, @@ -12953,7 +12953,7 @@ const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]= }; #else const float FASTCONV_FOA_latency_s = 0.000020833f; -const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { {+0.181652f, +0.754551f, +0.218658f}, @@ -13257,7 +13257,7 @@ const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= } }; -const float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +const float leftHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { {-0.171042f, +0.590899f, -0.184148f}, @@ -13561,7 +13561,7 @@ const float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= } }; -const float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +const float rightHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { {+0.181652f, +0.754551f, +0.218658f}, @@ -13865,7 +13865,7 @@ const float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= } }; -const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]= +const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { {-0.171042f, +0.590899f, -0.184148f}, diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index 9bfa68b074..daf6794c57 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -45,18 +45,18 @@ /* Binaural rendering data set based on HRIRs */ extern const float FASTCONV_HRIR_latency_s; #ifdef UPDATE_FASTCONV_SBA_FILTER -extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; -extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; -extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; -extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; -extern float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; -extern float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; -extern float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; -extern float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; -extern float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; -extern float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; -extern float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; -extern float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; +extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float leftHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; #else extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index abba25124c..f60e64b661 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -757,20 +757,20 @@ typedef struct ivas_hrtfs_fastconv_struct float FASTCONV_HOA3_latency_s; #ifdef UPDATE_FASTCONV_SBA_FILTER - float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; - float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; - float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; - float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS_SBA]; + float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; + float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; float FASTCONV_HOA2_latency_s; - float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; - float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; - float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; - float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS_SBA]; + float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; + float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; float FASTCONV_FOA_latency_s; - float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; - float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; - float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; - float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS_SBA]; + float leftHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; + float leftHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; + float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; #else float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index c2408e89ca..ed2e446a1a 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -967,14 +967,16 @@ static ivas_error init_fastconv_HRTF_handle( hHrtf->FASTCONV_HOA3_latency_s = 0; for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { set_zero( hHrtf->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { set_zero( hHrtf->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); @@ -985,14 +987,16 @@ static ivas_error init_fastconv_HRTF_handle( hHrtf->FASTCONV_HOA2_latency_s = 0; for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < 9; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { set_zero( hHrtf->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); #else + for ( j = 0; j < 9; j++ ) + { set_zero( hHrtf->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); @@ -1003,14 +1007,16 @@ static ivas_error init_fastconv_HRTF_handle( hHrtf->FASTCONV_FOA_latency_s = 0; for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < 4; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < FOA_CHANNELS; j++ ) + { set_zero( hHrtf->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); set_zero( hHrtf->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); #else + for ( j = 0; j < 4; j++ ) + { set_zero( hHrtf->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS ); set_zero( hHrtf->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS ); -- GitLab From 4eaa34396476f3125b857fc642f61463beeb6a89 Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Fri, 30 Jun 2023 11:40:12 +1000 Subject: [PATCH 230/591] Fix bug with checking of channel numbers when reading HOA2 and FOA HRTF binary files --- lib_util/hrtf_file_reader.c | 93 +++++++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 24 deletions(-) diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index ed2e446a1a..4ad3073029 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1135,10 +1135,17 @@ static ivas_error create_fastconv_HRTF_from_rawdata( ( *hHRTF )->FASTCONV_HOA3_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" ); + } +#else if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); } +#endif hrtf_data_rptr += sizeof( uint16_t ); #ifdef UPDATE_FASTCONV_SBA_FILTER @@ -1156,12 +1163,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1169,12 +1178,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1182,12 +1193,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1195,12 +1208,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1213,10 +1228,17 @@ static ivas_error create_fastconv_HRTF_from_rawdata( ( *hHRTF )->FASTCONV_HOA2_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); + } +#else if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); } +#endif hrtf_data_rptr += sizeof( uint16_t ); #ifdef UPDATE_FASTCONV_SBA_FILTER @@ -1234,12 +1256,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1247,12 +1271,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1260,12 +1286,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1273,12 +1301,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1291,10 +1321,17 @@ static ivas_error create_fastconv_HRTF_from_rawdata( ( *hHRTF )->FASTCONV_FOA_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); +#ifdef UPDATE_FASTCONV_SBA_FILTER + if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" ); + } +#else if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); } +#endif hrtf_data_rptr += sizeof( uint16_t ); #ifdef UPDATE_FASTCONV_SBA_FILTER @@ -1312,12 +1349,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < FOA_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1325,12 +1364,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < FOA_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1338,12 +1379,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < FOA_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif @@ -1351,12 +1394,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { #ifdef UPDATE_FASTCONV_SBA_FILTER + for ( j = 0; j < FOA_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); #else + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); #endif -- GitLab From d4a62614e7ed0f52e565c5361e67636c4fa8fa71 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 30 Jun 2023 09:02:32 +0300 Subject: [PATCH 231/591] Fixes issue 585 by correcting condition --- lib_com/ivas_prot.h | 4 ++++ lib_com/options.h | 1 + lib_dec/ivas_dec.c | 4 ++++ lib_dec/ivas_jbm_dec.c | 4 ++++ lib_dec/ivas_masa_dec.c | 10 +++++++++- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9bc253776d..f39e5a4aa5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5121,6 +5121,10 @@ void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ const int16_t output_frame /* i : output frame length per channel */ +#ifdef FIX_585_MASA_2TC_DTX_EXT + , + const int16_t nchan_remapped /* i : number of transports used in core */ +#endif ); diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..81f53ae13c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ +#define FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 439a90fb2c..6ba9a31bb1 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -390,7 +390,11 @@ ivas_error ivas_dec( if ( st_ivas->ivas_format == MASA_FORMAT ) { +#ifdef FIX_585_MASA_2TC_DTX_EXT + ivas_masa_prerender( st_ivas, output, output_frame, nchan_remapped ); +#else ivas_masa_prerender( st_ivas, output, output_frame ); +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ff28af051a..9c0fc76955 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -292,7 +292,11 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->ivas_format == MASA_FORMAT ) { +#ifdef FIX_585_MASA_2TC_DTX_EXT + ivas_masa_prerender( st_ivas, output, output_frame, nchan_remapped ); +#else ivas_masa_prerender( st_ivas, output, output_frame ); +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 0576fe8121..57b628b5f8 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -565,10 +565,18 @@ static ivas_error ivas_masa_dec_config( void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ - const int16_t output_frame /* i : output frame length per channel */ + const int16_t output_frame /* i : output frame length per channel */ +#ifdef FIX_585_MASA_2TC_DTX_EXT + , + const int16_t nchan_remapped /* i : number of transports used in core */ +#endif ) { +#ifdef FIX_585_MASA_2TC_DTX_EXT + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && nchan_remapped == 1 ) +#else if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) +#endif { if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { -- GitLab From 27b490a31ea94e3e53d29b6ef51cf1987e3e6217 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 30 Jun 2023 09:18:51 +0300 Subject: [PATCH 232/591] Apply clang format --- lib_dec/ivas_masa_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 57b628b5f8..1ad0a36427 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -565,7 +565,7 @@ static ivas_error ivas_masa_dec_config( void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ - const int16_t output_frame /* i : output frame length per channel */ + const int16_t output_frame /* i : output frame length per channel */ #ifdef FIX_585_MASA_2TC_DTX_EXT , const int16_t nchan_remapped /* i : number of transports used in core */ -- GitLab From 15281eaf66487c23e903fd0c30591db5f605609c Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Fri, 30 Jun 2023 09:32:42 +0200 Subject: [PATCH 233/591] Fix binaural crash --- lib_dec/ivas_jbm_dec.c | 3 +- lib_dec/ivas_mc_paramupmix_dec.c | 58 +++++++++++++++++++------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index c86739c323..9119451443 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -397,7 +397,6 @@ ivas_error ivas_jbm_dec_tc( ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); } } - } #endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -1494,7 +1493,7 @@ int16_t ivas_jbm_dec_get_num_tc_channels( #ifdef JBM_PARAMUPMIX else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - num_tc = MC_PARAMUPMIX_MAX_INPUT_CHANS; + num_tc = MC_PARAMUPMIX_MAX_INPUT_CHANS; } #endif else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index d23be11bf5..421f008396 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -302,8 +302,8 @@ void ivas_mc_paramupmix_dec( #ifdef JBM_PARAMUPMIX 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 */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots /* i : number of CLFBS slots in the transport channels */ ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; @@ -311,7 +311,7 @@ void ivas_mc_paramupmix_dec_digest_tc( assert( hMCParamUpmix ); push_wmops( "ivas_mc_paramupmix_dec_digest_tc" ); - + ivas_param_upmix_dec_decorr_subframes( st_ivas ); /* adapt subframes */ @@ -324,12 +324,12 @@ void ivas_mc_paramupmix_dec_digest_tc( 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 */ - float *input_f[], /* i: core-coder transport channels */ - float *output_f[] /* i/o: synthesized core-coder transport channels */ + 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 */ ) { int16_t slots_to_render, first_sf, last_sf, subframe_idx; @@ -346,7 +346,7 @@ void ivas_mc_paramupmix_dec_render( output_f_local[ch] = output_f[ch]; } - slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + slot_size = st_ivas->hTcBuffer->n_samples_granularity; /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, nSamplesAsked / slot_size ); @@ -356,7 +356,7 @@ void ivas_mc_paramupmix_dec_render( for ( ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++ ) { - mvr2r( input_f[ch], output_f_local[ch], *nSamplesRendered); + mvr2r( input_f[ch], output_f_local[ch], *nSamplesRendered ); } while ( slots_to_render > 0 ) @@ -387,12 +387,19 @@ void ivas_mc_paramupmix_dec_render( *nSamplesAvailable = ( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered ) * slot_size; + /* Binaural renderer will do the slot rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + st_ivas->hTcBuffer->slots_rendered = 0; + st_ivas->hTcBuffer->subframes_rendered = 0; + } + + pop_wmops(); } #endif - /*------------------------------------------------------------------------- * ivas_mc_paramupmix_dec_open() * @@ -478,9 +485,12 @@ ivas_error ivas_mc_paramupmix_dec_open( { nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - 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 ) + if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - return error; + 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; + } } if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) { @@ -588,14 +598,14 @@ static void paramupmix_td_decorr_process_jbm( } static void ivas_param_upmix_dec_decorr_subframes( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; int16_t i, ch; int32_t output_Fs; int16_t output_frame; - float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ float *p_tc[MC_PARAMUPMIX_MAX_INPUT_CHANS]; hMCParamUpmix = st_ivas->hMCParamUpmix; @@ -613,7 +623,7 @@ static void ivas_param_upmix_dec_decorr_subframes( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { - pPcm_temp[i] = p_tc[8+i]; /* decorrelated */ + pPcm_temp[i] = p_tc[8 + i]; /* decorrelated */ } paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, &( p_tc[4] ), pPcm_temp, output_frame ); @@ -753,13 +763,13 @@ 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 */ +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 */ ) { int16_t i, ch, slot_idx, k; - float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ /*CLDFB*/ float Cldfb_RealBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -772,7 +782,7 @@ static void ivas_mc_paramupmix_dec_sf( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { - pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ + pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ pPcm_temp[2 * i + 1] = output_f[i + 8]; /* decorrelated */ } @@ -839,7 +849,7 @@ static void ivas_mc_paramupmix_dec_sf( /* adjust delay of other channels */ noparamupmix_delay = NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS ); n_samples_rendered = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] * hMCParamUpmix->num_freq_bands; - if (n_samples_rendered > noparamupmix_delay) + if ( n_samples_rendered > noparamupmix_delay ) { for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { @@ -858,7 +868,7 @@ static void ivas_mc_paramupmix_dec_sf( mvr2r( &output_f[ch][0], tmp_buf, n_samples_rendered ); mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], n_samples_rendered ); mvr2r( &hMCParamUpmix->pcm_delay[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay[ch][0], noparamupmix_delay - n_samples_rendered ); - mvr2r( tmp_buf, &hMCParamUpmix->pcm_delay[ch][noparamupmix_delay-n_samples_rendered], n_samples_rendered ); + mvr2r( tmp_buf, &hMCParamUpmix->pcm_delay[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered ); } } -- GitLab From d9deaa78ac41b63ce1ece98aaf41f833725a6e9a Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Fri, 30 Jun 2023 09:57:02 +0200 Subject: [PATCH 234/591] Adapt interpolators --- lib_dec/ivas_mc_paramupmix_dec.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 421f008396..d1e25c18e1 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -317,8 +317,15 @@ void ivas_mc_paramupmix_dec_digest_tc( /* adapt subframes */ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); - + if (st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM) + { + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_SUBFRAMES_5MS, nCldfbSlots, hMCParamUpmix->param_interpolator ); + } + else + { + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); + } + pop_wmops(); } @@ -394,7 +401,6 @@ void ivas_mc_paramupmix_dec_render( st_ivas->hTcBuffer->subframes_rendered = 0; } - pop_wmops(); } #endif @@ -475,6 +481,11 @@ ivas_error ivas_mc_paramupmix_dec_open( buffer_mode = TC_BUFFER_MODE_RENDERER; nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); nchan_to_allocate = nchan_tc; + if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); + } + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) { buffer_mode = TC_BUFFER_MODE_BUFFER; @@ -485,18 +496,18 @@ ivas_error ivas_mc_paramupmix_dec_open( { nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_SUBFRAMES_5MS, DEFAULT_JBM_SUBFRAMES_5MS, hMCParamUpmix->param_interpolator ); + } + else { 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; } + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } - if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); - } - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } #endif -- GitLab From b282f5e8a26b00fcee60f4d1b2f20955482d8442 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Fri, 30 Jun 2023 10:50:23 +0200 Subject: [PATCH 235/591] Move printout message up --- apps/renderer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 557c626871..17300a695a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1393,13 +1393,6 @@ int main( exit( -1 ); } - if ( !args.quietModeEnabled && args.delayCompensationEnabled ) - { - fprintf( stdout, "\nRenderer delay: %-5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); - } - - fprintf( stdout, "\n\nRendering of %d frames finished\n\n", frame ); - #ifdef FIX_488_SYNC_DELAY if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { @@ -1407,6 +1400,13 @@ int main( } #endif + if ( !args.quietModeEnabled && args.delayCompensationEnabled ) + { + fprintf( stdout, "\nRenderer delay: %-5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); + } + + fprintf( stdout, "\n\nRendering of %d frames finished\n\n", frame ); + #ifdef DEBUGGING int32_t cnt_frames_limited, noClipping; if ( ( cnt_frames_limited = IVAS_REND_GetCntFramesLimited( hIvasRend ) ) > 0 ) -- GitLab From b8c5069e6b8c468be39388199ba7d17de0cb1a79 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 30 Jun 2023 18:57:06 +0530 Subject: [PATCH 236/591] Minor modification [x]A change that that missed while updating the branch --- lib_dec/ivas_spar_decoder.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 906a73b317..352d99ba9e 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1678,7 +1678,11 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -- GitLab From 06554bba18feafa8234bda4d5d672fb9a386ac78 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 3 Jul 2023 11:57:49 +0200 Subject: [PATCH 237/591] with MONO output, OMASA should not initialize hDirAC for rendering. this was triggered in bitrate switching. pre-compiler switch: OMASA_BRSW_MONO_FIX --- lib_com/options.h | 1 + lib_dec/ivas_masa_dec.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 8bb76b3452..3d341e277b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,6 +166,7 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix +#define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 10d90e9ee7..aec5991fbe 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1279,7 +1279,11 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); +#ifdef OMASA_BRSW_MONO_FIX + if ( ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) && st_ivas->hDirAC == NULL ) +#else if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->hDirAC == NULL ) +#endif { /* init a new DirAC dec */ if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) @@ -1287,7 +1291,11 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } +#ifdef OMASA_BRSW_MONO_FIX + else if ( ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) && st_ivas->hDirAC != NULL ) +#else else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) +#endif { /* close unnecessary DirAC dec */ ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); -- GitLab From d63fd0684518506f6445a94d9a68b387b810edb7 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 3 Jul 2023 13:27:13 +0200 Subject: [PATCH 238/591] Change granularity of MIXER_CONV for PARAMUPMIX --- lib_com/ivas_prot.h | 6 +++++- lib_dec/ivas_init_dec.c | 11 +++++++++++ lib_dec/ivas_ism_dec.c | 5 ++++- lib_dec/ivas_jbm_dec.c | 31 ++++++++++++++++++++++++++++++- lib_dec/ivas_mc_paramupmix_dec.c | 14 +++++--------- lib_dec/ivas_mct_dec.c | 4 ++++ 6 files changed, 59 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6014794be5..66eb5b6233 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -837,7 +837,11 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( const RENDERER_TYPE rendererType, /* i : renderer type */ - const int32_t output_Fs /* i : sampling rate */ +#ifdef JBM_PARAMUPMIX + const IVAS_FORMAT ivas_format, /* i : ivas format */ + const MC_MODE mc_mode, /* i : MC mode */ +#endif + const int32_t output_Fs /* i : sampling rate */ ); ivas_error ivas_jbm_dec_tc_buffer_open( diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2294203053..0e63166be3 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1332,7 +1332,18 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->voip_active ) { +#ifdef JBM_PARAMUPMIX + if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) + { + granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + } + else + { + granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + } +#else granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); +#endif n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index c031ec8c4b..b3c5acc2e4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -133,8 +133,11 @@ static ivas_error ivas_ism_bitrate_switching( /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ +#ifdef JBM_PARAMUPMIX + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#else tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->hDecoderConfig->output_Fs ); - +#endif 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, data ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9119451443..f77beed717 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1579,7 +1579,36 @@ static void ivas_jbm_dec_copy_tc( * * *--------------------------------------------------------------------------*/ +#ifdef JBM_PARAMUPMIX +/*! r: render granularity */ +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 */ +) +{ + int16_t render_granularity; + + if ( rendererType == RENDERER_BINAURAL_OBJECTS_TD || rendererType == RENDERER_BINAURAL_MIXER_CONV || rendererType == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( ivas_format == MC_FORMAT ) && ( mc_mode == MC_MODE_PARAMUPMIX ) ) + { + render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + } + else + { + render_granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + } + } + else + { + render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + } + return render_granularity; +} +#else /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( const RENDERER_TYPE rendererType, /* i : renderer type */ @@ -1599,7 +1628,7 @@ int16_t ivas_jbm_dec_get_render_granularity( return render_granularity; } - +#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_open() diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index d1e25c18e1..98385d9394 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -317,15 +317,15 @@ void ivas_mc_paramupmix_dec_digest_tc( /* adapt subframes */ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); - if (st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_SUBFRAMES_5MS, nCldfbSlots, hMCParamUpmix->param_interpolator ); + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); } else { ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); } - + pop_wmops(); } @@ -496,18 +496,14 @@ ivas_error ivas_mc_paramupmix_dec_open( { nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_SUBFRAMES_5MS, DEFAULT_JBM_SUBFRAMES_5MS, hMCParamUpmix->param_interpolator ); - } - else + if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) { 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; } - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } #endif diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 51d6856987..acdd30811b 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -748,7 +748,11 @@ static ivas_error ivas_mc_dec_reconfig( /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv render what still fits in the new granularity */ +#ifdef JBM_PARAMUPMIX + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#else tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->hDecoderConfig->output_Fs ); +#endif 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, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -- GitLab From c21992b0b8386318525445b8c2a5a631e25f5fe4 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Mon, 3 Jul 2023 18:24:31 +0200 Subject: [PATCH 239/591] [fix] enable reverb for ISM mode switching - enable reverb when switching from ParamISM to DiscISM for the first time. --- lib_dec/ivas_ism_dec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index c031ec8c4b..cae5ebaf4d 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -184,6 +184,15 @@ static ivas_error ivas_ism_bitrate_switching( { return error; } +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if ( st_ivas->hIntSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } } else @@ -258,6 +267,14 @@ static ivas_error ivas_ism_bitrate_switching( { st_ivas->hHrtfTD = NULL; } + +#ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM + if (st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB) + { + ivas_reverb_close( &st_ivas->hReverb ); + } + +#endif } } else -- GitLab From 8295a205d3cd2c3778769754886fd334be186d96 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Tue, 4 Jul 2023 09:23:19 +0200 Subject: [PATCH 240/591] Fix memory error --- lib_dec/ivas_mc_paramupmix_dec.c | 4 +++- lib_dec/ivas_stat_dec.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 98385d9394..318f7f1705 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -472,6 +472,7 @@ ivas_error ivas_mc_paramupmix_dec_open( #ifdef JBM_PARAMUPMIX /* allocate transport channels*/ + hMCParamUpmix->free_param_interpolator = 0; if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; @@ -502,6 +503,7 @@ ivas_error ivas_mc_paramupmix_dec_open( { return error; } + hMCParamUpmix->free_param_interpolator = 1; } ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } @@ -541,7 +543,7 @@ void ivas_mc_paramupmix_dec_close( } } #ifdef JBM_PARAMUPMIX - if ( ( *hMCParamUpmix )->param_interpolator != NULL ) + if ( ( ( *hMCParamUpmix )->param_interpolator != NULL ) && ( ( *hMCParamUpmix )->free_param_interpolator == 1 ) ) { free( ( *hMCParamUpmix )->param_interpolator ); } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 697a577c87..152cf5091e 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -804,6 +804,7 @@ typedef struct ivas_mc_paramupmix_dec_data_structure float *pcm_delay[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS]; #ifdef JBM_PARAMUPMIX float *param_interpolator; + int16_t free_param_interpolator; #endif } MC_PARAMUPMIX_DEC_DATA, *MC_PARAMUPMIX_DEC_HANDLE; -- GitLab From 128fd43c203a70de57a50e28007c915d5eb5516e Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 4 Jul 2023 11:26:11 +0200 Subject: [PATCH 241/591] clang-format --- lib_dec/ivas_ism_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index cae5ebaf4d..5533fcd6b3 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -269,7 +269,7 @@ static ivas_error ivas_ism_bitrate_switching( } #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if (st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB) + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { ivas_reverb_close( &st_ivas->hReverb ); } -- GitLab From 40008d54638d967cd14c988aa03a2863f3bbd797 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Tue, 4 Jul 2023 12:16:29 +0200 Subject: [PATCH 242/591] Decorrelation JBM split up --- lib_com/ivas_prot.h | 3 +- lib_dec/ivas_jbm_dec.c | 2 +- lib_dec/ivas_mc_paramupmix_dec.c | 48 +++++++++++++++++++------------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a185318a7a..5f18f27668 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3884,7 +3884,8 @@ void ivas_mc_paramupmix_dec_read_BS( #ifdef JBM_PARAMUPMIX 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 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( diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9fffa4a0f5..3b26ef44e1 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -625,7 +625,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( #ifdef JBM_PARAMUPMIX else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots ); + ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); } #endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 318f7f1705..d63a67302c 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -60,7 +60,7 @@ static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_ static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] ); -static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas ); +static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering ); #endif static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float pcm_in[][L_FRAME48k], float **pp_out_pcm, const int16_t output_frame ); @@ -302,8 +302,9 @@ void ivas_mc_paramupmix_dec( #ifdef JBM_PARAMUPMIX 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 */ + 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 */ ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; @@ -312,7 +313,7 @@ void ivas_mc_paramupmix_dec_digest_tc( push_wmops( "ivas_mc_paramupmix_dec_digest_tc" ); - ivas_param_upmix_dec_decorr_subframes( st_ivas ); + ivas_param_upmix_dec_decorr_subframes( st_ivas, nSamplesForRendering ); /* adapt subframes */ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); @@ -607,35 +608,44 @@ static void paramupmix_td_decorr_process_jbm( } static void ivas_param_upmix_dec_decorr_subframes( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -) + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nSamplesForRendering ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; - int16_t i, ch; - int32_t output_Fs; - int16_t output_frame; - float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ - float *p_tc[MC_PARAMUPMIX_MAX_INPUT_CHANS]; + float *pPcm_tmp[MC_PARAMUPMIX_COMBINATIONS]; + float *p_tc[MC_PARAMUPMIX_COMBINATIONS]; + int16_t nchan_internal, ch; + int16_t nSamplesLeftForTD, default_frame; hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); push_wmops( "ivas_param_upmix_dec_decorr_subframes" ); - output_Fs = st_ivas->hDecoderConfig->output_Fs; - output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); + /* TD decorrelator */ + default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + nSamplesLeftForTD = nSamplesForRendering; + nchan_internal = MC_PARAMUPMIX_COMBINATIONS; - for ( ch = 0; ch < MC_PARAMUPMIX_MAX_INPUT_CHANS; ch++ ) + for ( ch = 0; ch < nchan_internal; ch++ ) { - p_tc[ch] = st_ivas->hTcBuffer->tc[ch]; + pPcm_tmp[ch] = st_ivas->hTcBuffer->tc[ch + 8]; + p_tc[ch] = st_ivas->hTcBuffer->tc[ch + 4]; } - for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + while ( nSamplesLeftForTD ) { - pPcm_temp[i] = p_tc[8 + i]; /* decorrelated */ - } + int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); + + paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); + + for ( ch = 0; ch < nchan_internal; ch++ ) + { + p_tc[ch] += nSamplesToDecorr; + } - paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, &( p_tc[4] ), pPcm_temp, output_frame ); + nSamplesLeftForTD -= nSamplesToDecorr; + } pop_wmops(); -- GitLab From 60a5fe0352d3a63c692c9508d08d4d2527830082 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Tue, 4 Jul 2023 13:12:07 +0200 Subject: [PATCH 243/591] Msan fix --- lib_dec/ivas_mc_paramupmix_dec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index d63a67302c..fdedb13e77 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -474,6 +474,7 @@ ivas_error ivas_mc_paramupmix_dec_open( #ifdef JBM_PARAMUPMIX /* allocate transport channels*/ hMCParamUpmix->free_param_interpolator = 0; + hMCParamUpmix->param_interpolator = NULL; if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; @@ -544,9 +545,12 @@ void ivas_mc_paramupmix_dec_close( } } #ifdef JBM_PARAMUPMIX - if ( ( ( *hMCParamUpmix )->param_interpolator != NULL ) && ( ( *hMCParamUpmix )->free_param_interpolator == 1 ) ) + if ( ( *hMCParamUpmix )->param_interpolator != NULL ) { - free( ( *hMCParamUpmix )->param_interpolator ); + if ( ( *hMCParamUpmix )->free_param_interpolator == 1 ) + { + free( ( *hMCParamUpmix )->param_interpolator ); + } } #endif free( *hMCParamUpmix ); -- GitLab From e0d7ebc680f4cc4a6fa87ab6f3dead6e52bca071 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Tue, 4 Jul 2023 15:43:25 +0200 Subject: [PATCH 244/591] Clang issue --- lib_rend/ivas_reverb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index cfea5594a1..0ec7e1f1f4 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1905,7 +1905,7 @@ ivas_error ivas_binaural_reverb_open( else { #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if (renderer_type == RENDERER_BINAURAL_FASTCONV ) + if ( renderer_type == RENDERER_BINAURAL_FASTCONV ) #else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) #endif -- GitLab From 31f625e1791124d8dcd636f5dadc7bf0b8586e3e Mon Sep 17 00:00:00 2001 From: Michael Schug Date: Tue, 4 Jul 2023 17:12:36 +0200 Subject: [PATCH 245/591] for paramupmix jbm -vs 100 compared to normal operation should give identical output --- lib_dec/ivas_mc_paramupmix_dec.c | 42 ++++++++++++++++++++++++++------ lib_dec/ivas_stat_dec.h | 2 ++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index fdedb13e77..25538a2ae4 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -56,7 +56,7 @@ static void ps_pred_process( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, float qmf_mod_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t ch ); #ifdef JBM_PARAMUPMIX -static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, const int16_t ch ); +static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, const int16_t ch, const int16_t slots_rendered ); static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] ); @@ -376,6 +376,12 @@ void ivas_mc_paramupmix_dec_render( assert( slots_to_render == 0 ); #endif + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + mvr2r( hMCParamUpmix->alpha_prev[ch], hMCParamUpmix->alpha_sf[ch], IVAS_MAX_NUM_BANDS ); + mvr2r( hMCParamUpmix->beta_prev[ch], hMCParamUpmix->beta_sf[ch], IVAS_MAX_NUM_BANDS ); + } + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; @@ -733,7 +739,8 @@ static void ps_pred_process_sf( float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, - const int16_t ch ) + const int16_t ch, + const int16_t slots_rendered ) { float vmre, vmim, vsre, vsim; int16_t iqmf, ipar, ismp, iismp; @@ -742,6 +749,10 @@ static void ps_pred_process_sf( float *beta1, *beta2; float *alpha_prev = hMCParamUpmix->alpha_prev[ch]; float *beta_prev = hMCParamUpmix->beta_prev[ch]; + float *alpha_sf = hMCParamUpmix->alpha_sf[ch]; + float *beta_sf = hMCParamUpmix->beta_sf[ch]; + float dalpha, dbeta, ifac; + float alpha_start[IVAS_MAX_NUM_BANDS], beta_start[IVAS_MAX_NUM_BANDS]; const int16_t qmf_to_par_band[] = { 0, 1, 2, 3, 4, 5, 5, 6, 6, 7, @@ -752,9 +763,10 @@ static void ps_pred_process_sf( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; + mvr2r(alpha_sf, alpha_start, IVAS_MAX_NUM_BANDS); + mvr2r(beta_sf, beta_start, IVAS_MAX_NUM_BANDS); for ( iqmf = 0; iqmf < CLDFB_NO_CHANNELS_MAX; iqmf++ ) { - /* For changing no of parameter bands (ipar1 != ipar2), TIGGER_FRAMING assumed */ ipar = qmf_to_par_band[iqmf]; alpha1 = alpha_prev; beta1 = beta_prev; @@ -762,13 +774,24 @@ static void ps_pred_process_sf( ismp = 0; alpha2 = hMCParamUpmix->alphas[ch]; beta2 = hMCParamUpmix->betas[ch]; - alpha_smp = alpha1[ipar]; - beta_smp = beta1[ipar]; + alpha_smp = alpha_start[ipar]; + beta_smp = beta_start[ipar]; for ( iismp = 0; iismp < hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered]; iismp++ ) { - alpha_smp = alpha1[ipar] + ( alpha2[ipar] - alpha1[ipar] ) * param_interpol[iismp]; - beta_smp = beta1[ipar] + ( beta2[ipar] - beta1[ipar] ) * param_interpol[iismp]; + if ((slots_rendered == 0) && (iismp == 0)) + { + ifac = param_interpol[iismp]; + } + else + { + ifac = param_interpol[iismp] - param_interpol[iismp-1]; + } + dalpha = (alpha2[ipar] - alpha1[ipar]) * ifac; + dbeta = (beta2[ipar] - beta1[ipar]) * ifac; + + alpha_smp += dalpha; + beta_smp += dbeta; vmre = qmf_mod_re[ismp][iqmf]; vmim = qmf_mod_im[ismp][iqmf]; @@ -780,6 +803,8 @@ static void ps_pred_process_sf( ismp++; } + alpha_sf[ipar] = alpha_smp; + beta_sf[ipar] = beta_smp; } return; @@ -827,7 +852,8 @@ static void ivas_mc_paramupmix_dec_sf( Cldfb_RealBuffer[2 * ch + 1], /* in/out decorr */ Cldfb_ImagBuffer[2 * ch + 1], &hMCParamUpmix->param_interpolator[st_ivas->hTcBuffer->slots_rendered], - ch ); + ch, + st_ivas->hTcBuffer->slots_rendered ); /*-- m, s -> l, r ----------------------------*/ for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 152cf5091e..e13be18793 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -804,6 +804,8 @@ typedef struct ivas_mc_paramupmix_dec_data_structure float *pcm_delay[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS]; #ifdef JBM_PARAMUPMIX float *param_interpolator; + float alpha_sf[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + float beta_sf[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; int16_t free_param_interpolator; #endif -- GitLab From 1f1b79c01f3c0ded99a4d884715934efbd18fad0 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 5 Jul 2023 18:07:19 +1000 Subject: [PATCH 246/591] merge fixes --- lib_com/ivas_prot.h | 3 - lib_com/options.h | 57 ++-- lib_dec/ivas_binRenderer_internal.c | 439 ++-------------------------- lib_dec/ivas_dec.c | 26 +- lib_dec/ivas_dirac_dec.c | 7 +- lib_dec/ivas_mc_param_dec.c | 3 - lib_dec/ivas_output_config.c | 17 +- lib_rend/ivas_prot_rend.h | 17 +- lib_rend/ivas_rotation.c | 157 +++------- lib_rend/ivas_splitRendererPre.c | 7 + lib_rend/ivas_stat_rend.h | 3 + lib_rend/lib_rend.c | 180 ++---------- 12 files changed, 162 insertions(+), 754 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index bf28f2c545..4d91ff2a98 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5172,9 +5172,6 @@ void ivas_binaural_cldfb_sf( #endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - #ifdef FIX_SPLIT_REND_MERGE - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ - #endif #ifdef SPLIT_REND_WITH_HEAD_ROT MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, #endif diff --git a/lib_com/options.h b/lib_com/options.h index 11c1790886..f788eb8f41 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -138,12 +138,40 @@ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define FIX_BIT_EXACT /* fix for bit-inexactness in splitrendering renderer pytest*/ -#define FIX_SPLIT_REND_MERGE /* Resolving the compilation warnings after splitrenderer main updation */ + +#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ +#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ +#define RENAME_GWLPR /* FhG: Rename clashing symbol */ + +#define FIX_563_PARAMMC_LIMITER /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set */ +#define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ +#define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ +#define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ +#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ +#define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ +#define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ +#define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ +#define FIX_568_ISM_BITRATE_SWITCHING /* Philips: Issue 568: Bugfix for renderer re-initialization by ISM and bitrate switching */ +#define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ +#define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ +#define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ +#define FIX_572_LFE_LPF_ENC /* FhG: issue 572: always apply the low pass filter to the LFE channel */ +#define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ +#define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ +#define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ +#define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ +#define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ +#define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ +#define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ + #define SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT + +#define FIX_SPLIT_REND_MERGE /* Resolving the compilation warnings after splitrenderer main updation */ + + //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER @@ -183,31 +211,6 @@ #define FIX_SPLIT_REND_OPEN_ERROR_HANDLING /* adds missing error handling around ivas_split_renderer_open calls */ // #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ #endif -#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ -#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ -#define RENAME_GWLPR /* FhG: Rename clashing symbol */ - -#define FIX_563_PARAMMC_LIMITER /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set */ -#define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ -#define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ -#define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ -#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ -#define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ -#define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ -#define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ -#define FIX_568_ISM_BITRATE_SWITCHING /* Philips: Issue 568: Bugfix for renderer re-initialization by ISM and bitrate switching */ -#define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ -#define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ -#define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ -#define FIX_572_LFE_LPF_ENC /* FhG: issue 572: always apply the low pass filter to the LFE channel */ -#define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ -#define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ -#define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ -#define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ -#define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ -#define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ - /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 6c66a47ec7..c29d8a6858 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -680,9 +680,6 @@ ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, -#ifndef FIX_SPLIT_REND_MERGE - RENDER_CONFIG_DATA *hRendCfg, -#endif MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { @@ -745,9 +742,6 @@ ivas_error ivas_rend_openCldfbRend( /* Allocate memories and buffers needed for convolutional module */ if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, in_config, -#ifndef FIX_SPLIT_REND_MERGE - hRendCfg, -#endif pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK ) { return error; @@ -856,9 +850,6 @@ ivas_error ivas_binRenderer_open( st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, -#ifndef FIX_SPLIT_REND_MERGE - st_ivas->hRenderConfig, -#endif st_ivas->hHrtfFastConv #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -889,9 +880,6 @@ ivas_error ivas_binRenderer_open( st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, -#ifndef FIX_SPLIT_REND_MERGE - st_ivas->hRenderConfig, -#endif st_ivas->hHrtfFastConv #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -1276,9 +1264,6 @@ void ivas_binaural_cldfb( /* Implement binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef FIX_SPLIT_REND_MERGE - st_ivas->hHeadTrackData, -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT &st_ivas->splitBinRend.splitrend.multiBinPoseData, #endif @@ -1392,9 +1377,6 @@ void ivas_binaural_cldfb_sf( /* Implement binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef FIX_SPLIT_REND_MERGE - st_ivas->hHeadTrackData, -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT &st_ivas->splitBinRend.splitrend.multiBinPoseData, #endif @@ -1428,373 +1410,7 @@ void ivas_binaural_cldfb_sf( return; } #endif -#ifdef FIX_BIT_EXACT -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_processFrame() - * - * Compute the reverberation - room effect - *------------------------------------------------------------------------*/ - -void ivas_binaural_reverb_processFrame( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t numInChannels, /* i : num inputs to be processed */ - float inReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ - float inImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ - float outReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ - float outImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ - const uint8_t offsetSamplesIO /* i : number of offset samples */ -) -{ - /* Declare the required variables */ - int16_t idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; - float **tapRealPr, **tapImagPr; - - /* 1) Rotate the data in the loop buffer of the reverberator. - * Notice that the audio at the loop buffers is at time-inverted order - * for convolution purposes later on. */ - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ - mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - - /* Add the data from the end of the loop to the beginning, with an attenuation factor - * according to RT60. This procedure generates an IIR decaying response. The response - * is decorrelated later on. */ - v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); - v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); - } - - /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ - idx = hReverb->preDelayBufferIndex; - for ( sample = 0; sample < hReverb->blockSize; sample++ ) - { - uint16_t sampleWithOffset; - sampleWithOffset = sample + offsetSamplesIO; - invertSampleIndex = hReverb->blockSize - sample - 1; - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - /* Add from pre-delay buffer a sample to the loop buffer, in a time-inverted order. - * Also apply the spectral gains determined for the reverberation */ - hReverb->loopBufReal[bin][invertSampleIndex] += hReverb->preDelayBufferReal[idx][bin] * hReverb->reverbEqGains[bin]; - hReverb->loopBufImag[bin][invertSampleIndex] += hReverb->preDelayBufferImag[idx][bin] * hReverb->reverbEqGains[bin]; - hReverb->preDelayBufferReal[idx][bin] = 0.0f; - hReverb->preDelayBufferImag[idx][bin] = 0.0f; - } - - /* Add every second input channel as is to the pre-delay buffer, and every second input channel with - * 90 degrees phase shift to reduce energy imbalances between coherent and incoherent sounds */ - for ( ch = 0; ch < numInChannels; ch++ ) - { - if ( ch % 2 ) - { - v_add( hReverb->preDelayBufferReal[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); - v_add( hReverb->preDelayBufferImag[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); - } - else - { - v_sub( hReverb->preDelayBufferReal[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); - v_add( hReverb->preDelayBufferImag[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); - } - } - idx = ( idx + 1 ) % hReverb->preDelayBufferLength; - } - hReverb->preDelayBufferIndex = idx; - - /* 3) Perform the filtering/decorrelating, using complex and sparse FIR filtering */ - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - /* These tap pointers have been determined to point to the loop buffer at sparse locations */ - tapRealPr = hReverb->tapPointersReal[bin][ch]; - tapImagPr = hReverb->tapPointersImag[bin][ch]; - phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; - - /* Flush output */ - set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); - set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); - /* Add from temporally decaying sparse tap locations the audio to the output. */ - for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) - { - switch ( phaseShiftTypePr[tapIdx] ) - { - case 0: /* 0 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 1: /* 90 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 2: /* 180 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - default: /* 270 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - } - } - } - - /* Generate diffuse field binaural coherence by mixing the incoherent reverberated channels with pre-defined gains */ - if ( bin <= hReverb->highestBinauralCoherenceBin ) - { - if ( hReverb->useBinauralCoherence ) - { - for ( sample = 0; sample < hReverb->blockSize; sample++ ) - { - float leftRe, rightRe, leftIm, rightIm; - - leftRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][1][sample]; - rightRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][0][sample]; - leftIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][1][sample]; - rightIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][0][sample]; - - hReverb->outputBufferReal[bin][0][sample] = leftRe; - hReverb->outputBufferReal[bin][1][sample] = rightRe; - hReverb->outputBufferImag[bin][0][sample] = leftIm; - hReverb->outputBufferImag[bin][1][sample] = rightIm; - } - } - } - } - - /* 4) Write data to output */ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - for ( sample = 0; sample < hReverb->blockSize; sample++ ) - { - uint16_t sampleWithOffset; - - sampleWithOffset = sample + offsetSamplesIO; - /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ - invertSampleIndex = hReverb->blockSize - sample - 1; - - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - outReal[ch][sampleWithOffset][bin] = hReverb->outputBufferReal[bin][ch][invertSampleIndex]; - outImag[ch][sampleWithOffset][bin] = hReverb->outputBufferImag[bin][ch][invertSampleIndex]; - } - for ( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) - { - outReal[ch][sampleWithOffset][bin] = 0.0f; - outImag[ch][sampleWithOffset][bin] = 0.0f; - } - } - } - - return; -} -static void ivas_binRenderer_2( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT - float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ -#else - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ -#endif - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ -) -{ - int16_t chIdx, k; -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t pos_idx, num_poses; -#endif - int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; - - push_wmops( "fastconv_binaural_rendering" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - num_poses = hBinRenderer->numPoses; -#endif - - /* Compute Convolution */ - /* memory reset for the binaural output */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) - { - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - set_zero( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], CLDFB_NO_CHANNELS_MAX ); - set_zero( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], CLDFB_NO_CHANNELS_MAX ); - } - } - } -#else - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - set_zero( Cldfb_RealBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); - set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); - } - } -#endif - - /* Head rotation in HOA3 or CICPx */ - if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) - { - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) - { - /* Rotation in SHD (HOA3) */ - if ( hHeadTrackData->shd_rot_max_order == -1 ) - { - QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, MAX_PARAM_SPATIAL_SUBFRAMES, 3 ); - } - else if ( hHeadTrackData->shd_rot_max_order > 0 ) - { - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, MAX_PARAM_SPATIAL_SUBFRAMES, hHeadTrackData->shd_rot_max_order ); - } - } - else - { - /* Rotation in SD (CICPx) */ - rotateFrame_sd_cldfb_2( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, hBinRenderer->conv_band ); - } - } - - /* HOA decoding to CICP19 if needed*/ - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) - { - ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, MAX_PARAM_SPATIAL_SUBFRAMES, hBinRenderer->hoa_dec_mtx ); - } - -#ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], RealBuffer, ImagBuffer, MAX_PARAM_SPATIAL_SUBFRAMES, hBinRenderer, 0 ); -#else - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - 0 -#endif - ); -#endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT - /*TODO : move this to a separate function*/ - if ( pMultiBinPoseData->num_poses > 1 ) - { - IVAS_QUATERNION Quaternions_rel, Quaternions_abs, *Quaternions_ref; - float Rmat_local[3][3]; - - if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) - { - Quaternions_ref = &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions - 1]; - Quaternions_rel.w = -3.0f; /*euler*/ - Quaternions_abs.w = -3.0f; /*euler*/ - Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ - - for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) - { - Quaternions_rel.x = pMultiBinPoseData->relative_head_poses[pos_idx][0] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - Quaternions_rel.y = pMultiBinPoseData->relative_head_poses[pos_idx][1] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - Quaternions_rel.z = pMultiBinPoseData->relative_head_poses[pos_idx][2] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; - Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; - Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; - Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; - - - QuatToRotMat( Quaternions_rel, Rmat_local ); - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, MAX_PARAM_SPATIAL_SUBFRAMES, 3 ); - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, MAX_PARAM_SPATIAL_SUBFRAMES, hBinRenderer -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - pos_idx -#endif - ); - } - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - if ( hPostRendHeadTrackData != NULL ) - { - IVAS_QUATERNION *Quaternions_new1; - IVAS_QUATERNION Quaternions_new; - Quaternions_new1 = &hPostRendHeadTrackData->Quaternions[hPostRendHeadTrackData->num_quaternions++]; - Quaternions_new.w = -3.0f; /*euler*/ - Quat2EulerDegree( *Quaternions_new1, &Quaternions_new.z, &Quaternions_new.y, &Quaternions_new.x ); /*order in Quat2Euler seems to be reversed ?*/ - Quaternions_rel.x = Quaternions_new.x - Quaternions_abs.x; - Quaternions_rel.y = Quaternions_new.y - Quaternions_abs.y; - Quaternions_rel.z = Quaternions_new.z - Quaternions_abs.z; - Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; - Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; - Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; - - QuatToRotMat( Quaternions_rel, Rmat_local ); - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[num_poses], Cldfb_ImagBuffer_Binaural[num_poses], RealBuffer, ImagBuffer, hBinRenderer -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - num_poses -#endif - ); - } -#endif - } - } -#endif -#ifdef FIX_SPLIT_REND_MERGE - /* Obtain the binaural dmx and compute the reverb */ - if ( hBinRenderer->hReverb != NULL ) - { - float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float inRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float inIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - ivas_binaural_obtain_DMX( numTimeSlots, hBinRenderer, RealBuffer, ImagBuffer, inRe, inIm ); - - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - set_zero( reverbRe[chIdx][k], hBinRenderer->max_band ); - set_zero( reverbIm[chIdx][k], hBinRenderer->max_band ); - } - } - - ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); - - /* Add the conv module and reverb module output */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) - { - /* Combine first and second parts to generate binaural output signal with room effect */ - v_add( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); - v_add( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); - } -#else - /* Combine first and second parts to generate binaural output signal with room effect */ - v_add( Cldfb_RealBuffer_Binaural[chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); - v_add( Cldfb_ImagBuffer_Binaural[chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); -#endif - } - } - } - -#endif - pop_wmops(); - - return; -} -#endif /*------------------------------------------------------------------------- * ivas_binRenderer() * @@ -1803,9 +1419,6 @@ static void ivas_binRenderer_2( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ -#ifdef FIX_SPLIT_REND_MERGE - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, #endif @@ -1903,18 +1516,16 @@ void ivas_binRenderer( #ifdef SPLIT_REND_WITH_HEAD_ROT /*TODO : move this to a separate function*/ -#ifdef FIX_SPLIT_REND_MERGE if ( pMultiBinPoseData != NULL ) { -#endif if ( pMultiBinPoseData->num_poses > 1 ) { IVAS_QUATERNION Quaternions_rel, Quaternions_abs, *Quaternions_ref; float Rmat_local[3][3]; - if ( hHeadTrackData && hHeadTrackData->num_quaternions >= 0 && hBinRenderer->rotInCldfb ) + if ( hCombinedOrientationData && hBinRenderer->rotInCldfb ) { - Quaternions_ref = &hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions - 1]; + Quaternions_ref = &hCombinedOrientationData->Quaternions[0]; Quaternions_rel.w = -3.0f; /*euler*/ Quaternions_abs.w = -3.0f; /*euler*/ Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ @@ -1966,9 +1577,7 @@ void ivas_binRenderer( #endif } } -#ifdef FIX_SPLIT_REND_MERGE } -#endif #endif /* Obtain the binaural dmx and compute the reverb */ @@ -2020,7 +1629,7 @@ void ivas_binRenderer( #ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, - const IVAS_REND_HeadRotData *pHeadRotData, + const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -2028,8 +1637,7 @@ void ivas_rend_CldfbMultiBinRendProcess( float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot ) { - int16_t sf_idx, slot_idx, ch_idx, idx, pose_idx; - HEAD_TRACK_DATA head_track; + int16_t sf_idx, slot_idx, ch_idx, idx, pose_idx, i, j; float Cldfb_RealBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -2053,41 +1661,36 @@ void ivas_rend_CldfbMultiBinRendProcess( mvr2r( &Cldfb_In_Imag[ch_idx][idx][0], &Cldfb_ImagBuffer_sfIn[ch_idx][slot_idx][0], hCldfbRend->max_band ); } } - head_track.num_quaternions = 0; - head_track.shd_rot_max_order = -1; - if ( low_res_pre_rend_rot ) - { - head_track.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, 0 ); - } - else + + if ( ( *pCombinedOrientationData ) != NULL ) { - head_track.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); + if ( low_res_pre_rend_rot ) + { + ( *pCombinedOrientationData )->Quaternions[sf_idx] = ( *pCombinedOrientationData )->Quaternions[0]; + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) + { + ( *pCombinedOrientationData )->Rmat[sf_idx][i][j] = ( *pCombinedOrientationData )->Rmat[0][i][j]; + } + } + } + ( *pCombinedOrientationData )->shd_rot_max_order = -1; } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG head_track_post.num_quaternions = 0; head_track_post.shd_rot_max_order = -1; head_track_post.Quaternions[0] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositionsPostRend, sf_idx ); #endif -#ifdef FIX_BIT_EXACT - ivas_binRenderer_2( hCldfbRend, &head_track, - pMultiBinPoseData, -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - &head_track_post, -#endif - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn ); -#else - ivas_binRenderer( hCldfbRend, &head_track, + + ivas_binRenderer( hCldfbRend, pMultiBinPoseData, -#ifdef FIX_SPLIT_REND_MERGE - NULL, - 0, MAX_PARAM_SPATIAL_SUBFRAMES, -#endif + *pCombinedOrientationData, sf_idx, MAX_PARAM_SPATIAL_SUBFRAMES, #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG &head_track_post, #endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn ); -#endif for ( pose_idx = 0; pose_idx < hCldfbRend->numPoses; pose_idx++ ) { for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index fdabbaf08f..d57d5cba53 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -102,18 +102,6 @@ ivas_error ivas_dec( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || - ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { -#ifdef SPLIT_REND_LC3PLUS - assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA or discrete ISM format and 48k sampling rate only" ); -#else - assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); -#endif - ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hHeadTrackData, hSplitRendBits ); - } -#endif for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { p_output[n] = &output[n][0]; @@ -128,6 +116,18 @@ ivas_error ivas_dec( return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { +#ifdef SPLIT_REND_LC3PLUS + assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA or discrete ISM format and 48k sampling rate only" ); +#else + assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); +#endif + ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits ); + } +#endif /*----------------------------------------------------------------* * Decoding + Rendering *----------------------------------------------------------------*/ @@ -581,7 +581,7 @@ ivas_error ivas_dec( , 0 #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ef0a9de92d..dc36c64f9f 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2933,9 +2933,6 @@ void ivas_dirac_dec_render_sf( { /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef FIX_SPLIT_REND_MERGE - st_ivas->hHeadTrackData, -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT &st_ivas->splitBinRend.splitrend.multiBinPoseData, #endif @@ -2961,8 +2958,8 @@ void ivas_dirac_dec_render_sf( { for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { - mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][index_slot + slot_idx], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][index_slot + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); } } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 264202e811..bd55264e5b 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1756,9 +1756,6 @@ void ivas_param_mc_dec_render( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef FIX_SPLIT_REND_MERGE - st_ivas->hHeadTrackData, -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT &st_ivas->splitBinRend.splitrend.multiBinPoseData, #endif diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 4af9523ff6..e87b5cd0cb 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -448,7 +448,7 @@ void ivas_renderer_select( } #ifdef SPLIT_REND_WITH_HEAD_ROT -void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ) +void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ) { hSplitRendBits->bits_written = 0; hSplitRendBits->bits_read = 0; @@ -459,15 +459,22 @@ void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS ivas_renderSplitGetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, - hHeadTrackData->sr_pose_pred_axis ); + hCombinedOrientationData->sr_pose_pred_axis ); #ifdef SPLIT_REND_IVAS_DEC_HT_TR - if ( hHeadTrackData != NULL ) + if ( hCombinedOrientationData != NULL ) { - int16_t sf; + int16_t sf, i, j; for ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - hHeadTrackData->Quaternions[sf] = hHeadTrackData->Quaternions[0]; + hCombinedOrientationData->Quaternions[sf] = hCombinedOrientationData->Quaternions[0]; + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) + { + hCombinedOrientationData->Rmat[sf][i][j] = hCombinedOrientationData->Rmat[0][i][j]; + } + } } } #endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index dd3be52c41..898bf3fc3b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -539,7 +539,7 @@ ivas_error ivas_rend_openMultiBinCrend( #ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, - const IVAS_REND_HeadRotData *pHeadRotData, + const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -555,9 +555,6 @@ ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, -#ifndef FIX_SPLIT_REND_MERGE - RENDER_CONFIG_DATA *hRendCfg, -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, #endif @@ -942,17 +939,7 @@ void rotateFrame_shd_cldfb( const int16_t numTimeSlots, /* i : number of time slots to process */ const int16_t shd_rot_max_order /* i : split-order rotation method */ ); -#ifdef FIX_BIT_EXACT -void rotateFrame_sd_cldfb_2( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ - const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t nb_band /* i : number of CLDFB bands to process */ -); -#endif void rotateFrame_sd_cldfb( float Rmat[3][3], /* i : real-space rotation matrix */ float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ @@ -1081,7 +1068,7 @@ ivas_error ivas_orient_trk_Process( void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, - HEAD_TRACK_DATA_HANDLE hHeadTrackData, + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ); void ivas_init_split_rend_handles( diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 4e817ed33b..01d6b68420 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -48,7 +48,13 @@ * Local funtion declarations *-----------------------------------------------------------------------*/ -static ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, IVAS_VECTOR3 *listenerPos, int16_t numHeadRotQuaternions, EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); +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*/ +#endif + int16_t numHeadRotQuaternions, + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); static void external_target_interpolation( EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, const int16_t i ); @@ -666,112 +672,6 @@ void rotateFrame_shd_cldfb( return; } -#ifdef FIX_BIT_EXACT -void rotateFrame_sd_cldfb_2( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ - const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t nb_band /* i : number of CLDFB bands to process */ -) -{ - int16_t iBlock, iBand, m, n; - float gains[MAX_CICP_CHANNELS - 1][MAX_CICP_CHANNELS - 1]; - int16_t azimuth, elevation; - float Rmat[3][3]; - float g1; - float realRot[MAX_CICP_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; - float imagRot[MAX_CICP_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; - float *p_realRot, *p_imagRot; - float *p_real, *p_imag; - int16_t nInChannels; - int16_t isPlanar; - - push_wmops( "rotateFrame_sd_cldfb" ); - - nInChannels = hOutputSetup->nchan_out_woLFE; - isPlanar = 1; - for ( n = 0; n < nInChannels; n++ ) - { - if ( hOutputSetup->ls_elevation[n] != 0 ) - { - isPlanar = 0; - break; - } - } - - /* Get next quaternion and calculate rotation matrix */ - QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], Rmat ); - - /* rotation of Euler angles */ - for ( n = 0; n < nInChannels; n++ ) - { - rotateAziEle( hOutputSetup->ls_azimuth[n], hOutputSetup->ls_elevation[n], &azimuth, &elevation, Rmat, isPlanar ); - if ( hEFAPdata != NULL && ( hOutputSetup->ls_azimuth[n] != azimuth || hOutputSetup->ls_elevation[n] != elevation ) ) - { - efap_determine_gains( hEFAPdata, gains[n], azimuth, elevation, EFAP_MODE_EFAP ); - } - else - { - set_zero( gains[n], nInChannels ); - gains[n][n] = 1.0f; - } - } - - /* Apply panning gains by mtx multiplication*/ - for ( n = 0; n < nInChannels; n++ ) - { - set_zero( realRot[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_band ); - set_zero( imagRot[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_band ); - for ( m = 0; m < nInChannels; m++ ) - { - g1 = gains[m][n]; - p_realRot = realRot[n]; - p_imagRot = imagRot[n]; - if ( g1 > 0.f ) - { - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) - { - p_real = Cldfb_RealBuffer[m][iBlock]; - p_imag = Cldfb_ImagBuffer[m][iBlock]; - for ( iBand = 0; iBand < nb_band; iBand++ ) - { - *( p_realRot ) = *p_realRot + g1 * *( p_real++ ); - *( p_imagRot ) = *p_imagRot + g1 * *( p_imag++ ); - p_realRot++; - p_imagRot++; - } - } - } - } - } - - for ( n = 0; n < nInChannels; n++ ) - { - p_realRot = realRot[n]; - p_imagRot = imagRot[n]; - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) - { - p_real = Cldfb_RealBuffer[n][iBlock]; - p_imag = Cldfb_ImagBuffer[n][iBlock]; - for ( iBand = 0; iBand < nb_band; iBand++ ) - { - *( p_real++ ) = *( p_realRot++ ); - *( p_imag++ ) = *( p_imagRot++ ); - } - for ( ; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) - { - *( p_real++ ) = 0.f; - *( p_imag++ ) = 0.f; - } - } - } - pop_wmops(); - - return; -} -#endif /*------------------------------------------------------------------------- * rotateFrame_sd_cldfb() @@ -1041,6 +941,9 @@ ivas_error combine_external_and_head_orientations_dec( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; +#endif IVAS_QUATERNION *headRotQuaternions = NULL; IVAS_VECTOR3 *listenerPos = NULL; int16_t numHeadRotQuaternions = 0; @@ -1053,9 +956,22 @@ ivas_error combine_external_and_head_orientations_dec( headRotQuaternions = hHeadTrackData->Quaternions; listenerPos = hHeadTrackData->Pos; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis; +#endif + } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else + { + sr_pose_pred_axis = DEFAULT_AXIS; } +#endif - return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); + return combine_external_and_head_orientations( headRotQuaternions, listenerPos, +#ifdef SPLIT_REND_WITH_HEAD_ROT + sr_pose_pred_axis, +#endif + numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); } @@ -1071,11 +987,17 @@ ivas_error combine_external_and_head_orientations_rend( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; +#endif IVAS_QUATERNION *headRotQuaternions = NULL; IVAS_VECTOR3 *listenerPos = NULL; int16_t numHeadRotQuaternions = 0; int16_t i; +#ifdef SPLIT_REND_WITH_HEAD_ROT + sr_pose_pred_axis = DEFAULT_AXIS; +#endif if ( hHeadTrackData != NULL ) { if ( hHeadTrackData->headRotEnabled ) @@ -1083,6 +1005,9 @@ ivas_error combine_external_and_head_orientations_rend( headRotQuaternions = hHeadTrackData->headPositions; listenerPos = hHeadTrackData->Pos; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis; +#endif } else if ( hExtOrientationData != NULL ) { @@ -1096,7 +1021,11 @@ ivas_error combine_external_and_head_orientations_rend( } } - return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); + return combine_external_and_head_orientations( headRotQuaternions, listenerPos, +#ifdef SPLIT_REND_WITH_HEAD_ROT + sr_pose_pred_axis, +#endif + numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); } @@ -1108,8 +1037,11 @@ ivas_error combine_external_and_head_orientations_rend( *------------------------------------------------------------------------*/ static ivas_error combine_external_and_head_orientations( - IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ - IVAS_VECTOR3 *listenerPos, /* i : listener position */ + IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/ +#endif int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ @@ -1350,6 +1282,9 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->enableCombinedOrientation[i] = 0; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + hCombinedOrientationData->sr_pose_pred_axis = sr_pose_pred_axis; +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 9fccbb8ec6..3892b4710d 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2193,6 +2193,13 @@ ivas_error ivas_renderMultiBinToSplitBinaural( } #endif } +#ifdef SPLIT_REND_LC3PLUS + else + { + pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; + pBits->codec = IVAS_SPLIT_REND_CODEC_NONE; + } +#endif /*zero pad*/ /*TODO: do this inside the LCLD ENC codec */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 5103342d0b..674ba95d6c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -514,6 +514,9 @@ typedef struct ivas_combined_orientation_struct float procChEneIIR[2][MASA_FREQUENCY_BANDS]; int16_t shd_rot_max_order; IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; +#endif } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 061481e0dc..ff1a048508 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1474,13 +1474,13 @@ static ivas_error setRendInputActiveIsm( } if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR) + else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, NULL, *rendCtx.pOutSampleRate @@ -2644,9 +2644,6 @@ updateSbaPanGains( { assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, -#ifndef FIX_SPLIT_REND_MERGE - hRendCfg, -#endif &inputSba->splitRendWrapper.multiBinPoseData, *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) @@ -2683,9 +2680,6 @@ updateSbaPanGains( { error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, -#ifndef FIX_SPLIT_REND_MERGE - hRendCfg, -#endif &inputSba->splitRendWrapper.multiBinPoseData, *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) @@ -5698,128 +5692,7 @@ static ivas_error rotateFrameSba( return IVAS_ERR_OK; } -#ifdef FIX_BIT_EXACT -static ivas_error rotateFrameSba_2( - IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ - const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ - rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ - IVAS_REND_AudioBuffer outAudio /* o : Output Audio buffer */ -) -{ - int16_t i, l, n, m; - int16_t m1, m2; - int16_t shd_rot_max_order; - int16_t subframe_idx, subframe_len; -#ifdef SBA_CREND_ROT_OPT - float *writePtr; -#else - float *readPtr, *writePtr; -#endif - rotation_matrix Rmat; - float tmpRot[2 * HEADROT_ORDER + 1]; - rotation_gains gains; - ivas_error error; -#ifdef SBA_CREND_ROT_OPT - int16_t idx; - float val, cf, oneminuscf; -#endif - - push_wmops( "rotateFrameSba" ); - - if ( ( error = getAmbisonicsOrder( inConfig, &shd_rot_max_order ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* subframe loop */ - subframe_len = inAudio.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) - { - /* initialize rotation matrices with zeros */ - for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) - { - set_zero( gains[i], HEADROT_SHMAT_DIM ); - } - - /* Get next quaternion and calculate rotation matrix */ - QuatToRotMat( headRotData->headPositions[subframe_idx], Rmat ); - - /* calculate ambisonics rotation matrices for the previous and current frames */ - SHrotmatgen( gains, Rmat, shd_rot_max_order ); - - for ( i = 0; i < subframe_len; i++ ) - { -#ifdef SBA_CREND_ROT_OPT - idx = subframe_idx * subframe_len + i; - cf = headRotData->crossfade[i]; - oneminuscf = 1 - cf; -#endif - /* As the rotation matrix becomes block diagonal in a SH basis, we can*/ - /* apply each angular-momentum block individually to save complexity. */ - - /* loop over l blocks */ - m1 = 1; - m2 = 4; - for ( l = 1; l <= shd_rot_max_order; l++ ) - { - /* compute mtx-vector product for this l */ - for ( n = m1; n < m2; n++ ) - { - tmpRot[n - m1] = 0.f; - for ( m = m1; m < m2; m++ ) - { -#ifdef SBA_CREND_ROT_OPT - val = inAudio.data[m * inAudio.config.numSamplesPerChannel + idx]; - /* crossfade with previous rotation gains */ - tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val ); -#else - readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); - /* crossfade with previous rotation gains */ - tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + - ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); -#endif - } - } - /* write back the result */ - for ( n = m1; n < m2; n++ ) - { - writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); - ( *writePtr ) = tmpRot[n - m1]; - } - m1 = m2; - m2 += 2 * ( l + 1 ) + 1; - } - } - - /*unoptimized code for reference (full matrix multiplication)*/ - // for ( n = 0; n < nchan; n++ ) - // { - // tmpRot[n] = 0.f; - // - // for ( m = 0; m < nchan; m++ ) - // { - // tmpRot[n] += SHrotmat[n][m] * output[m][i]; - // } - // } - // for ( n = 0; n < nchan; n++ ) - // { - // output[n][i] = tmpRot[n]; - // } - - /* move SHrotmat to SHrotmat_prev */ - for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) - { - mvr2r( gains[i], gains_prev[i], HEADROT_SHMAT_DIM ); - } - } - - pop_wmops(); - - return IVAS_ERR_OK; -} -#endif static ivas_error renderIsmToBinaural( const input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -7176,8 +7049,9 @@ static ivas_error renderSbaToMultiBinaural( float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; #endif - int16_t i, pos_idx; - IVAS_REND_HeadRotData HeadRotDataLocal; + int16_t sf, i, j, pos_idx; + COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; + COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; ivas_error error; @@ -7190,12 +7064,18 @@ static ivas_error renderSbaToMultiBinaural( } #endif push_wmops( "renderSbaToMultiBinaural" ); - - HeadRotDataLocal = *sbaInput->base.ctx.pHeadRotData; - for ( i = 1; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) - + pCombinedOrientationDataLocal = *sbaInput->base.ctx.pCombinedOrientationData; + combinedOrientationDataLocal = *pCombinedOrientationDataLocal; + for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; sf++ ) { - HeadRotDataLocal.headPositions[i] = HeadRotDataLocal.headPositions[0]; + combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) + { + combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + } + } } tmpRotBuffer = sbaInput->base.inputBuffer; @@ -7207,14 +7087,15 @@ static ivas_error renderSbaToMultiBinaural( IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { - Quaternions_orig[i] = HeadRotDataLocal.headPositions[i]; + Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i]; Quaternions_abs.w = -3.0f; - Quat2EulerDegree( HeadRotDataLocal.headPositions[i], &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + Quat2EulerDegree( combinedOrientationDataLocal.Quaternions[i], &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ Quaternions_abs.x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; Quaternions_abs.y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; Quaternions_abs.z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; - HeadRotDataLocal.headPositions[i] = Quaternions_abs; + combinedOrientationDataLocal.Quaternions[i] = Quaternions_abs; + QuatToRotMat( combinedOrientationDataLocal.Quaternions[i], combinedOrientationDataLocal.Rmat[i] ); } @@ -7222,23 +7103,14 @@ static ivas_error renderSbaToMultiBinaural( mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - -#ifdef FIX_BIT_EXACT - rotateFrameSba_2( sbaInput->base.inputBuffer, - sbaInput->base.inConfig, - &HeadRotDataLocal, - sbaInput->rot_gains_prev[pos_idx], - tmpRotBuffer ); -#else + pCombinedOrientationDataLocal = &combinedOrientationDataLocal; rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, - &HeadRotDataLocal, -#ifdef FIX_SPLIT_REND_MERGE - sbaInput->base.ctx.pCombinedOrientationData, -#endif + sbaInput->base.ctx.pHeadRotData, + &pCombinedOrientationDataLocal, sbaInput->rot_gains_prev[pos_idx], tmpRotBuffer ); -#endif + copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL ); @@ -7258,7 +7130,7 @@ static ivas_error renderSbaToMultiBinaural( for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { - HeadRotDataLocal.headPositions[i] = Quaternions_orig[i]; + combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i]; } /* move to output */ @@ -7289,7 +7161,7 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, ivas_rend_CldfbMultiBinRendProcess( sbaInput->cldfbRendWrapper.hCldfbRend, - sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, &sbaInput->splitRendWrapper.multiBinPoseData, Cldfb_RealBuffer, Cldfb_ImagBuffer, -- GitLab From 67d82c2aa3298894c094c5cc3d645bf22e1230d9 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Wed, 5 Jul 2023 11:23:42 +0200 Subject: [PATCH 247/591] Clang and msan fix --- lib_dec/ivas_init_dec.c | 17 ++++++++++++++++- lib_dec/ivas_jbm_dec.c | 2 +- lib_dec/ivas_mc_paramupmix_dec.c | 18 +++++++++--------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0e63166be3..3154f19461 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1336,20 +1336,35 @@ ivas_error ivas_init_decoder( if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) { granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } } else { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } } #else granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) { return error; } +#endif } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 3b26ef44e1..43ad5d59fe 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1486,7 +1486,7 @@ int16_t ivas_jbm_dec_get_num_tc_channels( #ifdef JBM_PARAMUPMIX else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - num_tc = MC_PARAMUPMIX_MAX_INPUT_CHANS; + num_tc = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; } #endif else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 25538a2ae4..c790d5b59d 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -489,7 +489,7 @@ ivas_error ivas_mc_paramupmix_dec_open( buffer_mode = TC_BUFFER_MODE_RENDERER; nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - nchan_to_allocate = nchan_tc; + nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); @@ -503,7 +503,7 @@ ivas_error ivas_mc_paramupmix_dec_open( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { - nchan_to_allocate = 2 * BINAURAL_CHANNELS; + nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) { @@ -763,8 +763,8 @@ static void ps_pred_process_sf( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; - mvr2r(alpha_sf, alpha_start, IVAS_MAX_NUM_BANDS); - mvr2r(beta_sf, beta_start, IVAS_MAX_NUM_BANDS); + mvr2r( alpha_sf, alpha_start, IVAS_MAX_NUM_BANDS ); + mvr2r( beta_sf, beta_start, IVAS_MAX_NUM_BANDS ); for ( iqmf = 0; iqmf < CLDFB_NO_CHANNELS_MAX; iqmf++ ) { ipar = qmf_to_par_band[iqmf]; @@ -779,16 +779,16 @@ static void ps_pred_process_sf( for ( iismp = 0; iismp < hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered]; iismp++ ) { - if ((slots_rendered == 0) && (iismp == 0)) + if ( ( slots_rendered == 0 ) && ( iismp == 0 ) ) { ifac = param_interpol[iismp]; } else { - ifac = param_interpol[iismp] - param_interpol[iismp-1]; + ifac = param_interpol[iismp] - param_interpol[iismp - 1]; } - dalpha = (alpha2[ipar] - alpha1[ipar]) * ifac; - dbeta = (beta2[ipar] - beta1[ipar]) * ifac; + dalpha = ( alpha2[ipar] - alpha1[ipar] ) * ifac; + dbeta = ( beta2[ipar] - beta1[ipar] ) * ifac; alpha_smp += dalpha; beta_smp += dbeta; @@ -852,7 +852,7 @@ static void ivas_mc_paramupmix_dec_sf( Cldfb_RealBuffer[2 * ch + 1], /* in/out decorr */ Cldfb_ImagBuffer[2 * ch + 1], &hMCParamUpmix->param_interpolator[st_ivas->hTcBuffer->slots_rendered], - ch, + ch, st_ivas->hTcBuffer->slots_rendered ); /*-- m, s -> l, r ----------------------------*/ -- GitLab From c4d393b219f0e620ceee541562d98e38bbc52097 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 5 Jul 2023 11:57:12 +0200 Subject: [PATCH 248/591] add split rendering support for MC format --- lib_com/options.h | 1 + lib_dec/ivas_dec.c | 57 ++++-- lib_dec/ivas_init_dec.c | 27 ++- lib_dec/ivas_output_config.c | 4 + lib_rend/ivas_crend.c | 116 +++++++++++ lib_rend/ivas_objectRenderer.c | 8 + lib_rend/ivas_prot_rend.h | 9 + lib_rend/lib_rend.c | 356 ++++++++++++++++++++++++++++++++- 8 files changed, 560 insertions(+), 18 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 11c1790886..1e287d1b20 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #define SPLIT_REND_STACK_OPT #define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ +#define SPLIT_REND_LC3PLUS_MC /* FhG: split rendering using LC3plus codec for Multichannel content */ #define FIX_SPLIT_REND_OPEN_ERROR_HANDLING /* adds missing error handling around ivas_split_renderer_open calls */ // #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index fdabbaf08f..b8e55507bc 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -107,12 +107,19 @@ ivas_error ivas_dec( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_LC3PLUS_MC + assert( ( st_ivas->ivas_format == SBA_FORMAT || + ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) || + ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ) && + ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); +#else assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA or discrete ISM format and 48k sampling rate only" ); +#endif #else assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); #endif ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hHeadTrackData, hSplitRendBits ); - } + } #endif for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { @@ -511,19 +518,30 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs +#ifdef SPLIT_REND_LC3PLUS_MC + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); + } + else + { +#endif + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT - , - 0 + , + 0 #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) - { - return error; - } + { + return error; + } - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#ifdef SPLIT_REND_LC3PLUS_MC + } +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -535,12 +553,23 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_LC3PLUS_MC + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { - return error; + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); // TODO tmu check } + else + { +#endif + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#ifdef SPLIT_REND_LC3PLUS_MC + } +#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -581,7 +610,7 @@ ivas_error ivas_dec( , 0 #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 46d6cc0904..cfb45b5eb0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1333,7 +1333,7 @@ ivas_error ivas_init_decoder( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->splitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis ); - /* Split rendering with ISMs only supported with LC3plus */ + /* Split rendering with MC/ISMs only supported with LC3plus */ #ifndef SPLIT_REND_CLDFB_ISM assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ); #endif @@ -1392,12 +1392,37 @@ ivas_error ivas_init_decoder( return error; } } +#ifdef SPLIT_REND_LC3PLUS_MC + + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + { + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + + /* Split rendering with MC only supported with LC3plus */ + assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ); + + error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 0, 0 ); + if ( error != IVAS_ERR_OK ) + { + return error; + } + } +#endif if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , +#ifdef SPLIT_REND_LC3PLUS_MC + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses : 1 +#else 1 +#endif #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 4af9523ff6..604f136623 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -203,7 +203,11 @@ void ivas_renderer_select( else { *internal_config = transport_config; +#ifdef SPLIT_REND_LC3PLUS_MC + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { #ifdef DEBUGGING if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 22ec6406d2..a520a44dfa 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1741,3 +1741,119 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_LC3PLUS_MC + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_rend_crend_ProcessSplitBin() + * + * Process call for IVAS Crend renderer + *-----------------------------------------------------------------------------------------*/ + +ivas_error ivas_rend_crendProcessSplitBin( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ +) +{ + int16_t i; + int16_t pos_idx; + float gain_lfe; + float tmpLfeBuffer[L_FRAME48k]; + float tmpInputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float tmpSplitBinBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + ivas_error error; + + pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; + + /* Save current head positions */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + originalHeadRot[i] = st_ivas->hHeadTrackData->Quaternions[i]; + } + + /* copy input */ + for ( i = 0; i < st_ivas->nchan_transport; ++i ) + { + mvr2r( output[i], tmpInputBuffer[i], output_frame ); + } + + /* TODO tmu : partial duplication of ivas_binaural_add_LFE() for efficiency */ + /* copy LFE */ + mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); + gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; + v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame ); + + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; ++pos_idx ) + { + /* Update head positions */ + if ( pos_idx != 0 ) + { + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + if ( originalHeadRot[i].w == -3.0f ) + { + st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; + st_ivas->hHeadTrackData->Quaternions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; + st_ivas->hHeadTrackData->Quaternions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; + st_ivas->hHeadTrackData->Quaternions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; + } + else + { + st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; + Quat2EulerDegree( originalHeadRot[i], /* TODO tmu : fix bug with ordering*/ + &st_ivas->hHeadTrackData->Quaternions[i].z, + &st_ivas->hHeadTrackData->Quaternions[i].y, + &st_ivas->hHeadTrackData->Quaternions[i].x ); + st_ivas->hHeadTrackData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + st_ivas->hHeadTrackData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + st_ivas->hHeadTrackData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; + } + } + } + + /* render inplace to first two channels of tmpInputBuffer */ + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, + st_ivas->hDecoderConfig, + st_ivas->hHeadTrackData, + &st_ivas->hIntSetup, + st_ivas->hEFAPdata, + tmpInputBuffer, + st_ivas->hDecoderConfig->output_Fs, + pos_idx ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( i = 0; i < BINAURAL_CHANNELS; ++i ) + { + /* accumulate LFE to output */ + v_add( tmpInputBuffer[i], tmpLfeBuffer, tmpInputBuffer[i], output_frame ); + + /* move to split bin output buffer */ + mvr2r( tmpInputBuffer[i], tmpSplitBinBuffer[pos_idx * BINAURAL_CHANNELS + i], output_frame ); + + /* overwrite rendered channels with input again for next iteration */ + mvr2r( output[i], tmpInputBuffer[i], output_frame ); + } + } + + /* copy split binaural rendered signals to final output */ + for ( i = 0; i < BINAURAL_CHANNELS * pMultiBinPoseData->num_poses; ++i ) + { + mvr2r( tmpSplitBinBuffer[i], output[i], output_frame ); + } + + /* Restore original head rotation */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + st_ivas->hHeadTrackData->Quaternions[i] = originalHeadRot[i]; + } + + return IVAS_ERR_OK; +} +#endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 50f31c48a6..6ce2664c55 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -718,7 +718,11 @@ void ObjRenderIvasFrame_splitBinaural( ) { int32_t i; +#ifdef SPLIT_REND_LC3PLUS_MC + float tmpProcessing[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#else float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; +#endif float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k]; #ifdef FIX_SPLIT_REND_MERGE float *p_tmpProcessing[MAX_NUM_OBJECTS]; @@ -759,7 +763,11 @@ void ObjRenderIvasFrame_splitBinaural( /* Copy input audio to a processing buffer. Cannot render in-place because binaurally rendered * audio would overwrite original material, which is still needed for rendering next head pose. */ +#ifdef SPLIT_REND_LC3PLUS_MC + for ( i = 0; i < st_ivas->nchan_transport; ++i ) +#else for ( i = 0; i < MAX_NUM_OBJECTS; ++i ) +#endif { mvr2r( output[i], tmpProcessing[i], output_frame ); } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index dd3be52c41..c5c1786f87 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -640,6 +640,15 @@ ivas_error ivas_rend_crendProcessSubframe( const int32_t output_Fs /* i : output sampling rate */ ); +#ifdef SPLIT_REND_LC3PLUS_MC +/* TODO tmu : interface cleanup */ +ivas_error ivas_rend_crendProcessSplitBin( + Decoder_Struct *st_ivas, + float output[][L_FRAME48k], + const int16_t output_frame +); +#endif + /*----------------------------------------------------------------------------------* * Reverberator *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 061481e0dc..d641606441 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include "options.h" +#include "ivas_stat_rend.h" #include "lib_rend.h" #include "prot.h" #include "ivas_prot.h" @@ -177,6 +178,9 @@ typedef struct EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; +#ifdef SPLIT_REND_LC3PLUS_MC + TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ +#endif REVERB_HANDLE hReverb; rotation_gains rot_gains_prev; int16_t nonDiegeticPan; @@ -1474,13 +1478,13 @@ static ivas_error setRendInputActiveIsm( } if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR) + else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, NULL, *rendCtx.pOutSampleRate @@ -2135,6 +2139,10 @@ static ivas_error updateMcPanGains( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: +#ifdef SPLIT_REND_LC3PLUS_MC + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: +#endif break; /* Do nothing */ case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: @@ -2181,6 +2189,9 @@ static ivas_error initMcBinauralRendering( RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; +#ifdef SPLIT_REND_LC3PLUS_MC + int16_t i; +#endif int32_t outSampleRate; /* check if re-initialization */ @@ -2190,6 +2201,16 @@ static ivas_error initMcBinauralRendering( inputMc->tdRendWrapper.hHrtfTD = NULL; } +#ifdef SPLIT_REND_LC3PLUS_MC + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); + inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; + } + } +#endif ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2235,6 +2256,27 @@ static ivas_error initMcBinauralRendering( return error; } +#ifdef SPLIT_REND_LC3PLUS_MC + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + /* Open TD renderer wrappers */ + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( ( error = ivas_td_binaural_open_ext( &inputMc->splitTdRendWrappers[i], + inConfig, + hRendCfg, + &inputMc->customLsInput, + outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Assert same delay as main TD renderer */ + assert( inputMc->splitTdRendWrappers[i].binaural_latency_ns == inputMc->tdRendWrapper.binaural_latency_ns ); + } + } + +#endif if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) @@ -2365,6 +2407,9 @@ static ivas_error setRendInputActiveMc( const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { +#ifdef SPLIT_REND_LC3PLUS_MC + int16_t i; +#endif ivas_error error; rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; @@ -2399,8 +2444,19 @@ static ivas_error setRendInputActiveMc( inputMc->hMcMasa = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); +#ifdef SPLIT_REND_LC3PLUS_MC + for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) + { + inputMc->splitTdRendWrappers[i] = defaultTdRendWrapper(); + } +#endif + +#ifdef SPLIT_REND_LC3PLUS_MC + if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) +#else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { @@ -2427,6 +2483,9 @@ static ivas_error setRendInputActiveMc( static void clearInputMc( input_mc *inputMc ) { +#ifdef SPLIT_REND_LC3PLUS_MC + int16_t i; +#endif rendering_context rendCtx; rendCtx = inputMc->base.ctx; @@ -2462,6 +2521,17 @@ static void clearInputMc( inputMc->tdRendWrapper.hHrtfTD = NULL; } +#ifdef SPLIT_REND_LC3PLUS_MC + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); + inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; + } + } +#endif + ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); return; @@ -4242,7 +4312,11 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } +#ifdef SPLIT_REND_LC3PLUS_MC + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) +#else if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { @@ -6400,14 +6474,24 @@ static ivas_error renderActiveInputsIsm( static ivas_error renderLfeToBinaural( const input_mc *mcInput, +#ifdef SPLIT_REND_LC3PLUS_MC + const IVAS_REND_AudioConfig outConfig, +#endif IVAS_REND_AudioBuffer outAudio ) { int16_t i; int16_t lfe_idx; +#ifdef SPLIT_REND_LC3PLUS_MC + int16_t pose_idx, num_poses; +#endif float gain; float *readPtr, *writePtr; +#ifdef SPLIT_REND_LC3PLUS_MC + assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); +#else assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); +#endif push_wmops( "renderLfeToBinaural" ); @@ -6427,6 +6511,34 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_LC3PLUS_MC + /* Copy LFE to left and right binaural channels */ + if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) + { + num_poses = mcInput->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; + } + else + { + num_poses = 1; + } + + for ( pose_idx = 0; pose_idx < num_poses; ++pose_idx ) + { + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + writePtr = getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS, 0 ); + for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + writePtr = getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS + 1, 0 ); + for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + } +#else /* Copy LFE to left and right ears */ readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); writePtr = getSmplPtr( outAudio, 0, 0 ); @@ -6441,6 +6553,7 @@ static ivas_error renderLfeToBinaural( { *writePtr++ += gain * ( *readPtr++ ); } +#endif pop_wmops(); @@ -6539,7 +6652,11 @@ static ivas_error renderMcToBinaural( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#ifdef SPLIT_REND_LC3PLUS_MC + if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) +#else if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -6637,7 +6754,11 @@ static ivas_error renderMcToBinauralRoom( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#ifdef SPLIT_REND_LC3PLUS_MC + if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) +#else if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -6735,7 +6856,11 @@ static ivas_error renderMcCustomLsToBinauralRoom( accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); +#ifdef SPLIT_REND_LC3PLUS_MC + if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) +#else if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -6810,6 +6935,220 @@ static ivas_error renderMcToMasa( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_LC3PLUS_MC +static ivas_error renderMcToSplitBinaural( + input_mc *mcInput, + const IVAS_REND_AudioConfig outConfig, + IVAS_REND_AudioBuffer outAudio ) +{ + int16_t i, pos_idx; + int16_t output_frame; + ivas_error error; + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + const SPLIT_REND_WRAPPER *pSplitRendWrapper; + float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; + float tmpSplitBinauralBuffer[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; + IVAS_REND_AudioConfig inConfig; + IVAS_REND_AudioBuffer tmpRotBuffer; + IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; + IVAS_REND_HeadRotData modifiedHeadRotData; + const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; + + push_wmops( "renderMcToSplitBinaural" ); + + inConfig = mcInput->base.inConfig; + output_frame = mcInput->base.inputBuffer.config.numSamplesPerChannel; + + pSplitRendWrapper = mcInput->base.ctx.pSplitRendWrapper; + pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData; + + for ( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + p_tmpRendBuffer[i] = tmpRendBuffer[i]; + } + + /* save current head positions */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + originalHeadRot[i] = mcInput->base.ctx.pHeadRotData->headPositions[i]; + } + modifiedHeadRotData = *mcInput->base.ctx.pHeadRotData; + + + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + /* Update head positions */ + if ( pos_idx != 0 ) + { + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + if ( originalHeadRot[i].w == -3.0f ) + { + modifiedHeadRotData.headPositions[i].w = -3.0f; + modifiedHeadRotData.headPositions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; + modifiedHeadRotData.headPositions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; + modifiedHeadRotData.headPositions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + } + else + { + modifiedHeadRotData.headPositions[i].w = -3.0f; + Quat2EulerDegree( originalHeadRot[i], + &modifiedHeadRotData.headPositions[i].z, + &modifiedHeadRotData.headPositions[i].y, + &modifiedHeadRotData.headPositions[i].x ); + modifiedHeadRotData.headPositions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; + modifiedHeadRotData.headPositions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; + modifiedHeadRotData.headPositions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + } + + ( *mcInput->base.ctx.pCombinedOrientationData )->Quaternions[i] = modifiedHeadRotData.headPositions[i]; + } + } + + if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM || inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) + { + /* tdrend processing overview: + * 1. copy from inputBuffer to tmpRendBuffer + * 2. td_binaural_renderer_ext: inplace processing in tmpRendBuffer + * 3. copy from tmpRendBuffer to tmpSplitBinBuffer + * 4. LFE mixing + * 5. tmpSplitBinBuffer accumulated to outBuffer */ + + /* copy input to tdrend input/output buffer */ + copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); + + /* set quaternions */ + hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; + + /* Render */ + if ( pos_idx == 0 ) + { + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, + mcInput->base.inConfig, + &mcInput->customLsInput, + hCombinedOrientationData, + NULL, + mcInput->hReverb, + mcInput->base.inputBuffer.config.numSamplesPerChannel, + tmpRendBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->splitTdRendWrappers[pos_idx - 1], + mcInput->base.inConfig, + &mcInput->customLsInput, + hCombinedOrientationData, + NULL, + mcInput->hReverb, + mcInput->base.inputBuffer.config.numSamplesPerChannel, + tmpRendBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Copy rendered audio to tmp storage buffer. Copying directly to output would + * overwrite original audio, which is still needed for rendering next head pose. */ + mvr2r( tmpRendBuffer[0], tmpSplitBinauralBuffer[2 * pos_idx], output_frame ); + mvr2r( tmpRendBuffer[1], tmpSplitBinauralBuffer[2 * pos_idx + 1], output_frame ); + } + else + { + /* crend processing overview: + * 1. rotateFrameMc: inputBuffer to tmpRotBuffer + * 2. crend_process: tmpRotBuffer to tmpRendBuffer + * 3. copy from tmpRendBuffer to tmpSplitBinBuffer + * 4. LFE mixing + * 5. tmpSplitBinBuffer accumulated to outBuffer */ + + /* temporary buffer for rotation in source format */ + tmpRotBuffer = mcInput->base.inputBuffer; + tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + + + /* perform rotation in source format to tmpRotBuffer */ + if ( pos_idx == 0 ) + { + 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 ) + { + return error; + } + } + else + { + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, + mcInput->base.inConfig, + mcInput->customLsInput, + &modifiedHeadRotData, + mcInput->base.ctx.pCombinedOrientationData, + mcInput->rot_gains_prev, + mcInput->efapInWrapper.hEfap, + tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); + + /* call CREND (rotation already performed) */ + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, + getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, + NULL, + NULL, + NULL, + p_tmpRendBuffer, + *mcInput->base.ctx.pOutSampleRate +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Copy rendererd audio to tmp storage buffer, Copying directly to output would + * overwrite original audio, which is still needed for rendering next head pose. */ + mvr2r( tmpRendBuffer[0], tmpSplitBinauralBuffer[2 * pos_idx], output_frame ); + mvr2r( tmpRendBuffer[1], tmpSplitBinauralBuffer[2 * pos_idx + 1], output_frame ); + + free( tmpRotBuffer.data ); + } + } + + /* TODO tmu : needs delay compensation */ + if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } + + accumulate2dArrayToBuffer( tmpSplitBinauralBuffer, &outAudio ); + + /* restore original headrotation data */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + ( *mcInput->base.ctx.pCombinedOrientationData )->Quaternions[i] = originalHeadRot[i]; + } + pop_wmops(); + + return IVAS_ERR_OK; +} + +#endif static ivas_error renderInputMc( input_mc *mcInput, IVAS_REND_AudioConfig outConfig, @@ -6860,6 +7199,12 @@ static ivas_error renderInputMc( error = renderMcToBinauralRoom( mcInput, outConfig, outAudio ); } break; +#ifdef SPLIT_REND_LC3PLUS_MC + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + error = renderMcToSplitBinaural( mcInput, outConfig, outAudio ); + break; +#endif default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -8453,8 +8798,13 @@ ivas_error IVAS_REND_GetSamples( || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) - /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ + /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ +#ifdef SPLIT_REND_LC3PLUS_MC + && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || + ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) +#else && hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) +#endif { /* TODO: doesn't work for multiple SBA inputs, needs to be updated like the ISM path for TD */ ivas_split_rend_bits_t bits; -- GitLab From fb3b7225f26bc68ffde4ffe097358974f07c9d6b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 5 Jul 2023 14:17:29 +0200 Subject: [PATCH 249/591] remove unnecessary include --- lib_rend/lib_rend.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d641606441..6b539f5f52 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include "options.h" -#include "ivas_stat_rend.h" #include "lib_rend.h" #include "prot.h" #include "ivas_prot.h" -- GitLab From d89bfe77e4ea1f219ff8cab8aa9a60911e700de0 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 5 Jul 2023 14:36:41 +0200 Subject: [PATCH 250/591] fix warnings related to combined orientation data --- lib_rend/ivas_crend.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index a520a44dfa..cdb590cc31 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1761,6 +1761,7 @@ ivas_error ivas_rend_crendProcessSplitBin( float gain_lfe; float tmpLfeBuffer[L_FRAME48k]; float tmpInputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float *p_tmpInputBuffer[MAX_OUTPUT_CHANNELS]; float tmpSplitBinBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; @@ -1780,6 +1781,11 @@ ivas_error ivas_rend_crendProcessSplitBin( mvr2r( output[i], tmpInputBuffer[i], output_frame ); } + for ( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + p_tmpInputBuffer[i] = tmpInputBuffer[i]; + } + /* TODO tmu : partial duplication of ivas_binaural_add_LFE() for efficiency */ /* copy LFE */ mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); @@ -1811,6 +1817,8 @@ ivas_error ivas_rend_crendProcessSplitBin( st_ivas->hHeadTrackData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; st_ivas->hHeadTrackData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; } + + st_ivas->hCombinedOrientationData->Quaternions[i] = st_ivas->hHeadTrackData->Quaternions[i]; } } @@ -1819,10 +1827,10 @@ ivas_error ivas_rend_crendProcessSplitBin( st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hHeadTrackData, + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, - tmpInputBuffer, + p_tmpInputBuffer, st_ivas->hDecoderConfig->output_Fs, pos_idx ) ) != IVAS_ERR_OK ) { @@ -1852,6 +1860,7 @@ ivas_error ivas_rend_crendProcessSplitBin( for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) { st_ivas->hHeadTrackData->Quaternions[i] = originalHeadRot[i]; + st_ivas->hCombinedOrientationData->Quaternions[i] = originalHeadRot[i]; } return IVAS_ERR_OK; -- GitLab From 3a03810bae910dc734501b468748de0fa8c88f68 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 5 Jul 2023 16:08:06 +0200 Subject: [PATCH 251/591] add lc3plus source files --- .gitlab-ci.yml | 16 + CMakeLists.txt | 20 +- Makefile | 27 +- Workspace_msvc/Workspace_msvc.sln | 2 +- Workspace_msvc/lib_com.vcxproj | 6 +- Workspace_msvc/lib_dec.vcxproj | 6 +- Workspace_msvc/lib_enc.vcxproj | 6 +- Workspace_msvc/lib_rend.vcxproj | 8 +- Workspace_msvc/lib_util.vcxproj | 4 +- Workspace_msvc/renderer.vcxproj | 6 +- lc3plus/adjust_global_gain.c | 86 + lc3plus/al_fec_fl.c | 2329 ++++++++++ lc3plus/apply_global_gain.c | 21 + lc3plus/ari_codec.c | 1122 +++++ lc3plus/attack_detector.c | 105 + lc3plus/clib.h | 27 + lc3plus/constants.c | 3803 +++++++++++++++++ lc3plus/constants.h | 203 + lc3plus/cutoff_bandwidth.c | 27 + lc3plus/dct4.c | 95 + lc3plus/dec_entropy.c | 277 ++ lc3plus/dec_lc3_fl.c | 365 ++ lc3plus/defines.h | 238 ++ lc3plus/detect_cutoff_warped.c | 84 + lc3plus/enc_entropy.c | 126 + lc3plus/enc_lc3_fl.c | 270 ++ lc3plus/estimate_global_gain.c | 128 + lc3plus/fft/cfft.c | 421 ++ lc3plus/fft/cfft.h | 42 + lc3plus/fft/fft_15_16.h | 401 ++ lc3plus/fft/fft_240_480.h | 185 + lc3plus/fft/fft_2_9.h | 278 ++ lc3plus/fft/fft_32.h | 467 ++ lc3plus/fft/fft_384_768.h | 103 + lc3plus/fft/fft_60_128.h | 161 + lc3plus/fft/fft_generic.h | 699 +++ lc3plus/fft/iis_fft.c | 164 + lc3plus/fft/iis_fft.h | 142 + lc3plus/fft/iisfft.c | 166 + lc3plus/fft/iisfft.h | 86 + lc3plus/functions.h | 304 ++ lc3plus/imdct.c | 102 + lc3plus/lc3.c | 431 ++ lc3plus/lc3.h | 517 +++ lc3plus/lc3plus_fft.c | 99 + lc3plus/license.h | 22 + lc3plus/ltpf_coder.c | 264 ++ lc3plus/ltpf_decoder.c | 356 ++ lc3plus/makefile | 143 + lc3plus/mdct.c | 128 + lc3plus/mdct_shaping.c | 23 + lc3plus/msvc/.gitignore | 1 + lc3plus/msvc/LC3plus.sln | 28 + lc3plus/msvc/LC3plus.vcxproj | 184 + lc3plus/near_nyquist_detector.c | 38 + lc3plus/noise_factor.c | 112 + lc3plus/noise_filling.c | 81 + lc3plus/olpa.c | 144 + lc3plus/pc_apply.c | 73 + lc3plus/pc_classify.c | 170 + lc3plus/pc_main.c | 43 + lc3plus/pc_update.c | 37 + lc3plus/per_band_energy.c | 59 + lc3plus/plc_classify.c | 199 + lc3plus/plc_compute_stab_fac.c | 64 + lc3plus/plc_damping_scrambling.c | 206 + lc3plus/plc_main.c | 209 + lc3plus/plc_noise_substitution.c | 22 + lc3plus/plc_noise_substitution0.c | 14 + lc3plus/plc_phecu_f0_refine_first.c | 75 + lc3plus/plc_phecu_fec_hq.c | 159 + lc3plus/plc_phecu_hq_ecu.c | 116 + lc3plus/plc_phecu_lf_peak_analysis.c | 112 + lc3plus/plc_phecu_rec_frame.c | 147 + lc3plus/plc_phecu_setf0hz.c | 28 + lc3plus/plc_phecu_spec_ana.c | 599 +++ lc3plus/plc_phecu_subst_spec.c | 247 ++ lc3plus/plc_phecu_tba_per_band_gain.c | 44 + lc3plus/plc_phecu_tba_spect_Xavg.c | 45 + lc3plus/plc_phecu_tba_trans_dect_gains.c | 320 ++ lc3plus/plc_phecu_trans_burst_ana_sub.c | 48 + lc3plus/plc_tdc.c | 763 ++++ lc3plus/plc_tdc_tdac.c | 80 + lc3plus/plc_update.c | 125 + lc3plus/quantize_spec.c | 196 + lc3plus/reorder_bitstream.c | 41 + lc3plus/resamp12k8.c | 107 + lc3plus/residual_coding.c | 76 + lc3plus/residual_decoding.c | 97 + lc3plus/setup_com_lc3.c | 30 + lc3plus/setup_dec_lc3.c | 444 ++ lc3plus/setup_dec_lc3.h | 112 + lc3plus/setup_enc_lc3.c | 546 +++ lc3plus/setup_enc_lc3.h | 119 + lc3plus/sns_compute_scf.c | 177 + lc3plus/sns_interpolate_scf.c | 90 + lc3plus/sns_quantize_scf.c | 517 +++ lc3plus/structs.h | 186 + lc3plus/tinywavein_c.h | 605 +++ lc3plus/tinywaveout_c.h | 892 ++++ lc3plus/tns_coder.c | 374 ++ lc3plus/tns_decoder.c | 52 + lc3plus/util.h | 222 + lib_rend/ivas_lc3plus_common.c | 2 +- lib_rend/ivas_lc3plus_common.h | 2 +- lib_rend/ivas_lc3plus_dec.c | 2 +- lib_rend/ivas_lc3plus_dec.h | 2 +- lib_rend/ivas_lc3plus_enc.c | 2 +- lib_rend/ivas_lc3plus_enc.h | 2 +- lib_rend/lc3plus_codec/.gitignore | 3 - lib_rend/lc3plus_codec/README.md | 6 - lib_rend/lc3plus_codec/get_lc3plus.ps1 | 9 - .../lc3plus_lib_setup}/get_lc3plus.sh | 21 +- .../lc3plus_lib_setup}/lc3plus.patch | 595 ++- scripts/prepare_instrumentation.sh | 7 +- 115 files changed, 25012 insertions(+), 227 deletions(-) create mode 100755 lc3plus/adjust_global_gain.c create mode 100755 lc3plus/al_fec_fl.c create mode 100755 lc3plus/apply_global_gain.c create mode 100755 lc3plus/ari_codec.c create mode 100755 lc3plus/attack_detector.c create mode 100755 lc3plus/clib.h create mode 100755 lc3plus/constants.c create mode 100755 lc3plus/constants.h create mode 100755 lc3plus/cutoff_bandwidth.c create mode 100755 lc3plus/dct4.c create mode 100755 lc3plus/dec_entropy.c create mode 100755 lc3plus/dec_lc3_fl.c create mode 100755 lc3plus/defines.h create mode 100755 lc3plus/detect_cutoff_warped.c create mode 100755 lc3plus/enc_entropy.c create mode 100755 lc3plus/enc_lc3_fl.c create mode 100755 lc3plus/estimate_global_gain.c create mode 100755 lc3plus/fft/cfft.c create mode 100755 lc3plus/fft/cfft.h create mode 100755 lc3plus/fft/fft_15_16.h create mode 100755 lc3plus/fft/fft_240_480.h create mode 100755 lc3plus/fft/fft_2_9.h create mode 100755 lc3plus/fft/fft_32.h create mode 100755 lc3plus/fft/fft_384_768.h create mode 100755 lc3plus/fft/fft_60_128.h create mode 100755 lc3plus/fft/fft_generic.h create mode 100755 lc3plus/fft/iis_fft.c create mode 100755 lc3plus/fft/iis_fft.h create mode 100755 lc3plus/fft/iisfft.c create mode 100755 lc3plus/fft/iisfft.h create mode 100755 lc3plus/functions.h create mode 100755 lc3plus/imdct.c create mode 100755 lc3plus/lc3.c create mode 100755 lc3plus/lc3.h create mode 100644 lc3plus/lc3plus_fft.c create mode 100755 lc3plus/license.h create mode 100755 lc3plus/ltpf_coder.c create mode 100755 lc3plus/ltpf_decoder.c create mode 100755 lc3plus/makefile create mode 100755 lc3plus/mdct.c create mode 100755 lc3plus/mdct_shaping.c create mode 100644 lc3plus/msvc/.gitignore create mode 100755 lc3plus/msvc/LC3plus.sln create mode 100755 lc3plus/msvc/LC3plus.vcxproj create mode 100755 lc3plus/near_nyquist_detector.c create mode 100755 lc3plus/noise_factor.c create mode 100755 lc3plus/noise_filling.c create mode 100755 lc3plus/olpa.c create mode 100755 lc3plus/pc_apply.c create mode 100755 lc3plus/pc_classify.c create mode 100755 lc3plus/pc_main.c create mode 100755 lc3plus/pc_update.c create mode 100755 lc3plus/per_band_energy.c create mode 100755 lc3plus/plc_classify.c create mode 100755 lc3plus/plc_compute_stab_fac.c create mode 100755 lc3plus/plc_damping_scrambling.c create mode 100755 lc3plus/plc_main.c create mode 100755 lc3plus/plc_noise_substitution.c create mode 100755 lc3plus/plc_noise_substitution0.c create mode 100755 lc3plus/plc_phecu_f0_refine_first.c create mode 100755 lc3plus/plc_phecu_fec_hq.c create mode 100755 lc3plus/plc_phecu_hq_ecu.c create mode 100755 lc3plus/plc_phecu_lf_peak_analysis.c create mode 100755 lc3plus/plc_phecu_rec_frame.c create mode 100755 lc3plus/plc_phecu_setf0hz.c create mode 100755 lc3plus/plc_phecu_spec_ana.c create mode 100755 lc3plus/plc_phecu_subst_spec.c create mode 100755 lc3plus/plc_phecu_tba_per_band_gain.c create mode 100755 lc3plus/plc_phecu_tba_spect_Xavg.c create mode 100755 lc3plus/plc_phecu_tba_trans_dect_gains.c create mode 100755 lc3plus/plc_phecu_trans_burst_ana_sub.c create mode 100755 lc3plus/plc_tdc.c create mode 100755 lc3plus/plc_tdc_tdac.c create mode 100755 lc3plus/plc_update.c create mode 100755 lc3plus/quantize_spec.c create mode 100755 lc3plus/reorder_bitstream.c create mode 100755 lc3plus/resamp12k8.c create mode 100755 lc3plus/residual_coding.c create mode 100755 lc3plus/residual_decoding.c create mode 100755 lc3plus/setup_com_lc3.c create mode 100755 lc3plus/setup_dec_lc3.c create mode 100755 lc3plus/setup_dec_lc3.h create mode 100755 lc3plus/setup_enc_lc3.c create mode 100755 lc3plus/setup_enc_lc3.h create mode 100755 lc3plus/sns_compute_scf.c create mode 100755 lc3plus/sns_interpolate_scf.c create mode 100755 lc3plus/sns_quantize_scf.c create mode 100755 lc3plus/structs.h create mode 100755 lc3plus/tinywavein_c.h create mode 100755 lc3plus/tinywaveout_c.h create mode 100755 lc3plus/tns_coder.c create mode 100755 lc3plus/tns_decoder.c create mode 100755 lc3plus/util.h delete mode 100644 lib_rend/lc3plus_codec/.gitignore delete mode 100644 lib_rend/lc3plus_codec/README.md delete mode 100755 lib_rend/lc3plus_codec/get_lc3plus.ps1 rename {lib_rend/lc3plus_codec => scripts/lc3plus_lib_setup}/get_lc3plus.sh (53%) rename {lib_rend/lc3plus_codec => scripts/lc3plus_lib_setup}/lc3plus.patch (77%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2dfe47373f..bfdc075dbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -732,6 +732,22 @@ selection-test-processing: when: on_failure expire_in: 1 week +lc3plus-ensure-no-code-changes: + extends: + - .test-job-linux + - .rules-merge-request + stage: validate + needs: [] + timeout: "5 minutes" + script: + # Replace code commited to repo with code downloaded from ETSI + - ./scripts/lc3plus_lib_setup/get_lc3plus.sh + + # Ensure git reports no changes + - modified_files=$(git status -s) + - if [[ $modified_files ]]; then printf 'LC3plus codebase was modified!\n\n'"$modified_files"'\n\n'; exit $EXIT_CODE_FAIL; fi + + # --------------------------------------------------------------- # Test jobs for main branch # --------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d468dfeac..7a6cc317ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ add_library(lib_com ${libComSrcs} ${libComHeaders}) if(UNIX) target_link_libraries(lib_com PRIVATE m) endif() -target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug) +target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug lc3plus) file(GLOB libDebugSrcs "lib_debug/*.c") file(GLOB libDebugHeaders "lib_debug/*.h") @@ -130,18 +130,14 @@ file(GLOB libEncSrcs "lib_enc/*.c") file(GLOB libEncHeaders "lib_enc/*.h") add_library(lib_enc ${libEncSrcs} ${libEncHeaders}) target_link_libraries(lib_enc lib_com lib_debug) -target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend) +target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend lc3plus) -set(lc3plus_floating_point_dir ${CMAKE_CURRENT_SOURCE_DIR}/lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point) -if(NOT EXISTS ${lc3plus_floating_point_dir}) - MESSAGE(FATAL_ERROR "${lc3plus_floating_point_dir} does not exist. Please follow instructions in lib_rend/lc3plus_codec/README.md and download the LC3plus codec") -endif() -file(GLOB libLC3plusSrcs "${lc3plus_floating_point_dir}/*.c") -file(GLOB libLC3plusHeaders "${lc3plus_floating_point_dir}/*.h") -file(GLOB libLC3plusFftSrcs "${lc3plus_floating_point_dir}/fft/*.c") -file(GLOB libLC3plusFftHeaders "${lc3plus_floating_point_dir}/fft/*.h") +file(GLOB libLC3plusSrcs "lc3plus/*.c") +file(GLOB libLC3plusHeaders "lc3plus/*.h") +file(GLOB libLC3plusFftSrcs "lc3plus/fft/*.c") +file(GLOB libLC3plusFftHeaders "lc3plus/fft/*.h") add_library(lc3plus ${libLC3plusSrcs} ${libLC3plusFftSrcs} ${libLC3plusHeaders} ${libLC3plusFftHeaders}) -target_include_directories(lc3plus PUBLIC ${floating_point_dir} PRIVATE ${floating_point_dir}/fft ) +target_include_directories(lc3plus PUBLIC lc3plus PRIVATE lc3plus/fft ) target_link_libraries(lc3plus lib_com) # For including options.h, which is needed for instrumentation to work correctly if(WMOPS) target_link_libraries(lc3plus lib_debug) @@ -165,7 +161,7 @@ target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc) file(GLOB libUtilSrcs "lib_util/*.c") file(GLOB libUtilHeaders "lib_util/*.h") add_library(lib_util ${libUtilSrcs} ${libUtilHeaders}) -target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug) +target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug lc3plus) if(NOT WMOPS) file(GLOB unitTestIvasLc3plusSrcs "scripts/split_rendering/lc3plus/*.c") diff --git a/Makefile b/Makefile index baf4a1ead7..d14ddfbd1b 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,14 @@ SRC_LIBCOM = lib_com SRC_LIBDEBUG = lib_debug SRC_LIBDEC = lib_dec SRC_LIBENC = lib_enc -SRC_LIBREND = lib_rend lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft +SRC_LIBREND = lib_rend +SRC_LC3PLUS = lc3plus lc3plus/fft SRC_LIBUTIL = lib_util SRC_APP = apps BUILD = build OBJDIR = obj -SRC_DIRS = $(sort -u $(SRC_LIBCOM) $(SRC_LIBDEBUG) $(SRC_LIBDEC) $(SRC_LIBENC) $(SRC_LIBREND) $(SRC_LIBUTIL) $(SRC_APP)) +SRC_DIRS = $(sort -u $(SRC_LIBCOM) $(SRC_LIBDEBUG) $(SRC_LIBDEC) $(SRC_LIBENC) $(SRC_LIBREND) $(SRC_LC3PLUS) $(SRC_LIBUTIL) $(SRC_APP)) # Name of CLI binaries CLI_APIDEC ?= IVAS_dec @@ -22,6 +23,7 @@ LIB_LIBDEBUG ?= libivasdebug.a LIB_LIBDEC ?= libivasdec.a LIB_LIBENC ?= libivasenc.a LIB_LIBREND ?= libivasrend.a +LIB_LC3PLUS ?= liblc3plus.a LIB_LIBUTIL ?= libivasutil.a # Default tool settings @@ -118,6 +120,7 @@ SRCS_LIBDEBUG = $(foreach DIR,$(SRC_LIBDEBUG),$(patsubst $(DIR)/%,%,$(wildcard $ SRCS_LIBDEC = $(foreach DIR,$(SRC_LIBDEC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) SRCS_LIBENC = $(foreach DIR,$(SRC_LIBENC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) SRCS_LIBREND = $(foreach DIR,$(SRC_LIBREND),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) +SRCS_LC3PLUS = $(foreach DIR,$(SRC_LC3PLUS),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) SRCS_LIBUTIL = $(foreach DIR,$(SRC_LIBUTIL),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) OBJS_LIBCOM = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.o)) @@ -125,13 +128,14 @@ OBJS_LIBDEBUG = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEBUG:.c=.o)) OBJS_LIBDEC = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEC:.c=.o)) OBJS_LIBENC = $(addprefix $(OBJDIR)/,$(SRCS_LIBENC:.c=.o)) OBJS_LIBREND = $(addprefix $(OBJDIR)/,$(SRCS_LIBREND:.c=.o)) +OBJS_LC3PLUS = $(addprefix $(OBJDIR)/,$(SRCS_LC3PLUS:.c=.o)) OBJS_LIBUTIL = $(addprefix $(OBJDIR)/,$(SRCS_LIBUTIL:.c=.o)) OBJS_CLI_APIDEC = $(OBJDIR)/decoder.o OBJS_CLI_APIENC = $(OBJDIR)/encoder.o OBJS_CLI_APPREND = $(OBJDIR)/renderer.o DEPS = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.P) $(SRCS_LIBDEBUG:.c=.P) $(SRCS_LIBDEC:.c=.P) \ - $(SRCS_LIBENC:.c=.P) $(SRCS_LIBUTIL:.c=.P)) + $(SRCS_LIBENC:.c=.P) $(SRCS_LIBUTIL:.c=.P) $(SRCS_LIBREND:.c=.P) $(SRCS_LC3PLUS:.c=.P)) ############################################################################### @@ -157,25 +161,28 @@ $(LIB_LIBENC): $(OBJS_LIBENC) $(LIB_LIBREND): $(OBJS_LIBREND) $(QUIET_AR)$(AR) rcs $@ $^ +$(LIB_LC3PLUS): $(OBJS_LC3PLUS) + $(QUIET_AR)$(AR) rcs $@ $^ + $(LIB_LIBUTIL): $(OBJS_LIBUTIL) $(QUIET_AR)$(AR) rcs $@ $^ -$(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) +$(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS) $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIENC) -L. -livasenc -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIENC) -$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) - $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIDEC) +$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug -llc3plus $(LDLIBS) -o $(CLI_APIDEC) -$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC) - $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasdec -livasutil -livasdebug -livascom $(LDLIBS) -o $(CLI_APIREND) +$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC) $(LIB_LC3PLUS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasdec -livasutil -livasdebug -livascom -llc3plus $(LDLIBS) -o $(CLI_APIREND) -libs: $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBREND) $(LIB_LIBUTIL) +libs: $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBREND) $(LIB_LC3PLUS) $(LIB_LIBUTIL) clean: $(QUIET)$(RM) $(OBJS_LIBENC) $(OBJS_LIBDEC) $(DEPS) $(QUIET)$(RM) $(DEPS:.P=.d) $(QUIET)test ! -d $(OBJDIR) || rm -rf $(OBJDIR) - $(QUIET)$(RM) $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBUTIL) $(LIB_LIBREND) + $(QUIET)$(RM) $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBUTIL) $(LIB_LIBREND) $(LIB_LC3PLUS) $(OBJDIR)/%.o : %.c | $(OBJDIR) $(QUIET_CC)$(CC) $(CFLAGS) -c -MD -o $@ $< diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index 5bf4656fd7..d2a00f6c00 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -20,7 +20,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "..\lib_rend\lc3plus_codec\ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\msvc\LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "..\lc3plus\msvc\LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" ProjectSection(SolutionItems) = preProject diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 23aa2ae3f0..6667182575 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -78,7 +78,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -109,7 +109,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;../lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -147,7 +147,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;../lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 80910aa5e7..645828db60 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index 3378ac10f0..6f88f77c4f 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -129,7 +129,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -176,7 +176,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index e8e981ebe8..54c34de274 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true @@ -272,7 +272,7 @@ {54509728-928b-44d9-a118-a6f92f08b34f} false - + {95030B82-70CD-4C6B-84D4-61096035BEA2} false diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 46dec2de9b..71723a07cb 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) false @@ -117,7 +117,7 @@ AnySuitable false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 94ad9f774e..eee6eed340 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -86,7 +86,7 @@ Disabled - ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -130,7 +130,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) @@ -180,7 +180,7 @@ Neither false false - ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/lc3plus/adjust_global_gain.c b/lc3plus/adjust_global_gain.c new file mode 100755 index 0000000000..e7674dd710 --- /dev/null +++ b/lc3plus/adjust_global_gain.c @@ -0,0 +1,86 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx + , LC3_INT16 hrmode, LC3_INT16 frame_dms + ) +{ + LC3_FLOAT delta = 0; + LC3_INT delta2 = 0; + LC3_INT gg_idx_inc; + LC3_INT factor; + + + if (frame_dms == 25) + { + if (target < 520) + { + factor = 3; + } else { + factor = 4; + } + } else if (frame_dms == 50) + { + factor = 2; + } else + { + factor = 1; + } + + if (nBits < gg_p1[fs_idx]) { + delta = (nBits + 48.0) / 16.0; + } else if (nBits < gg_p2[fs_idx]) { + delta = (nBits + gg_d[fs_idx]) * gg_c[fs_idx]; + } else if (nBits < gg_p3[fs_idx]) { + delta = nBits / 48.0; + } else { + delta = gg_p3[fs_idx] / 48.0; + } + + delta = round(delta); + delta2 = delta + 2; + + *gainChange = 0; + + if (*gg_idx == 255 && nBits > target) { + *gainChange = 1; + } + + if ((*gg_idx < 255 && nBits > target) || (*gg_idx > 0 && nBits < target - delta2)) { + if (hrmode) + { + if (nBits > target) { + gg_idx_inc = (int) factor * (((nBits - target)/ delta) + 1); + gg_idx_inc = MIN(gg_idx_inc, 10 * factor); + + *gg_idx += gg_idx_inc; + } + + *gg_idx = MIN(*gg_idx, 255); + } + else + { + if (nBits < target - delta2) { + *gg_idx = *gg_idx - 1; + } else if (*gg_idx == 254 || nBits < target + delta) { + *gg_idx = *gg_idx + 1; + } else { + *gg_idx = *gg_idx + 2; + } + } + + *gg_idx = MAX(*gg_idx, gg_idx_min - gg_idx_off); + *gain = LC3_POW(10, (LC3_FLOAT)(*gg_idx + gg_idx_off) / 28); + *gainChange = 1; + } +} diff --git a/lc3plus/al_fec_fl.c b/lc3plus/al_fec_fl.c new file mode 100755 index 0000000000..0cae36dade --- /dev/null +++ b/lc3plus/al_fec_fl.c @@ -0,0 +1,2329 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "stdint.h" +#include +#include +#include + +#include "functions.h" + + +/* channel coder specific constants and macros */ +#define RS16_CW_LEN_MAX 15 + +#define FEC_N_MODES 4 +#define FEC_N_SYNDROMES_MAX 6 +#define FEC_N_ERR_POS_MAX 3 +#define FEC_N_ELP_COEFF_MAX 4 +#define FEC_N_ERR_SYMB_MAX 3 +#define FEC_N_MODE_DETECTION_CW 6 + +#define SYNDROME_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_SYNDROMES_MAX) +#define ELP_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_ELP_COEFF_MAX) +#define ERR_POS_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_ERR_POS_MAX) +#define ERR_SYMB_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_ERR_SYMB_MAX) +#define DEG_ELP_IDX(mode_index, cw_index) ((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) + +#define FEC_TOTAL_SYNDROME_SIZE (FEC_N_SYNDROMES_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_ELP_SIZE (FEC_N_ELP_COEFF_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_ERR_POS_SIZE (FEC_N_ERR_POS_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_ERROR_SIZE (FEC_N_ERR_SYMB_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_DEG_ELP_SIZE (FEC_N_MODES * FEC_N_MODE_DETECTION_CW) + +#define ERROR_REPORT_BEC_MASK ((0x0FFF)>>1) +#define ERROR_REPORT_EP1_OK ((0x1000)>>1) +#define ERROR_REPORT_EP2_OK ((0x2000)>>1) +#define ERROR_REPORT_EP3_OK ((0x4000)>>1) +#define ERROR_REPORT_EP4_OK ((0x8000)>>1) +#define ERROR_REPORT_ALL_OK (ERROR_REPORT_EP1_OK | ERROR_REPORT_EP2_OK | ERROR_REPORT_EP3_OK | ERROR_REPORT_EP4_OK) + +/* debugging switches */ + +/* constants concerning mode detection */ +#define EP_RISK_THRESH_NS_M 21990 +#define EP_RISK_THRESH_NS_E -23 +#define EP_RISK_THRESH_OS_M 25166 +#define EP_RISK_THRESH_OS_E -10 + +#define SIMPLE_FLOAT_1_MANTISSA 16384 + +#define FEC_STATIC static + +/* DISCLAIMER: Strict instrumentation of GF16 arithmetic would have to take into account + * the initial conversion of the arguments from LC3_UINT8 to LC3_INT16 (one move16() per argument). + * Behind this is the assumption that one would store GF16 elements in LC3_INT16 for strict BASOP + * implementation. + */ +#define GF16_MUL(a, b) gf16_mult_table[(a) | (b << 4)] +#define GF16_MUL0(a, b) gf16_mult_table[(a) | (b)] +#define GF16_ADD(a, b) ((a) ^ (b)) + +/* tables for finite field arithmetic */ +/* tables for arithmetic in GF(16) * + * generator polynomial: 19 + * unit group generator (g): 2 + */ + +static const LC3_UINT8 gf16_mult_table[256] = { + /* gf16_mult_table[a | (b << 4)] contains the product of a and b in GF(16) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 0, 2, 4, 6, 8, 10, 12, 14, 3, 1, 7, 5, 11, 9, 15, 13, 0, 3, 6, 5, 12, 15, 10, 9, 11, 8, + 13, 14, 7, 4, 1, 2, 0, 4, 8, 12, 3, 7, 11, 15, 6, 2, 14, 10, 5, 1, 13, 9, 0, 5, 10, 15, 7, 2, 13, + 8, 14, 11, 4, 1, 9, 12, 3, 6, 0, 6, 12, 10, 11, 13, 7, 1, 5, 3, 9, 15, 14, 8, 2, 4, 0, 7, 14, 9, + 15, 8, 1, 6, 13, 10, 3, 4, 2, 5, 12, 11, 0, 8, 3, 11, 6, 14, 5, 13, 12, 4, 15, 7, 10, 2, 9, 1, 0, + 9, 1, 8, 2, 11, 3, 10, 4, 13, 5, 12, 6, 15, 7, 14, 0, 10, 7, 13, 14, 4, 9, 3, 15, 5, 8, 2, 1, 11, + 6, 12, 0, 11, 5, 14, 10, 1, 15, 4, 7, 12, 2, 9, 13, 6, 8, 3, 0, 12, 11, 7, 5, 9, 14, 2, 10, 6, 1, + 13, 15, 3, 4, 8, 0, 13, 9, 4, 1, 12, 8, 5, 2, 15, 11, 6, 3, 14, 10, 7, 0, 14, 15, 1, 13, 3, 2, 12, + 9, 7, 6, 8, 4, 10, 11, 5, 0, 15, 13, 2, 9, 6, 4, 11, 1, 14, 12, 3, 8, 7, 5, 10, +}; + +static const LC3_UINT8 rs16_elp_deg2_table[256] = { + /* If the polynomial x^2 + ax + b has distinct non-zero roots z1 and z2 in GF(16), * + * then table entry a + 16*b contains log_g(z1) | log_g(z2) << 4, and otherwise it * + * contains 0. */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, + 105, 195, 0, 210, 0, 225, 0, 180, 120, 0, 0, 121, 0, 16, 0, 211, 0, 0, 181, 0, 0, 106, + 196, 226, 0, 0, 0, 214, 64, 0, 199, 0, 0, 0, 0, 0, 49, 184, 0, 154, 0, 229, 0, 227, + 182, 0, 0, 32, 0, 0, 0, 197, 0, 0, 122, 0, 212, 152, 0, 203, 0, 158, 128, 0, 0, 0, + 98, 113, 218, 0, 0, 0, 53, 0, 0, 65, 0, 0, 185, 110, 215, 80, 0, 0, 200, 0, 50, 0, + 0, 0, 0, 130, 205, 115, 0, 0, 160, 190, 145, 0, 0, 0, 0, 0, 0, 100, 0, 0, 168, 198, + 0, 183, 33, 0, 0, 48, 228, 213, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 179, 0, 224, 104, + 0, 194, 149, 0, 0, 209, 0, 0, 0, 189, 99, 84, 0, 129, 0, 0, 0, 144, 0, 0, 234, 114, + 0, 0, 82, 0, 0, 0, 0, 217, 202, 0, 112, 52, 232, 0, 97, 0, 0, 0, 126, 0, 81, 201, + 0, 36, 216, 186, 0, 0, 0, 96, 0, 0, 0, 0, 0, 88, 0, 0, 0, 103, 0, 148, 178, 0, + 208, 193, 0, 58, 0, 0, 0, 0, 0, 161, 206, 0, 116, 0, 101, 0, 0, 56, 146, 176, 0, 0, + 147, 162, 222, 0, 132, 0, 0, 0, 0, 0, 177, 117, 192, 0, +}; + +static const LC3_UINT16 rs16_elp_deg3_table[256] = { + /* If the polynomial x^3 + ax + b has distinct roots z1, z2 and z3 in GF(16), * + * then table entry a + 16*b contains z1) | z2 << 4 | z3 << 8, and otherwise it * + * contains 0. */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1889, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2977, 0, 0, 0, 0, 0, 3990, 1859, 0, + 0, 0, 0, 0, 0, 0, 3521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1874, 0, 3718, 0, 0, 0, + 0, 0, 0, 2433, 0, 0, 1619, 0, 0, 0, 0, 3495, 0, 0, 0, 0, 0, 0, 4065, 0, 0, 0, + 0, 0, 0, 3255, 0, 0, 0, 1602, 0, 3735, 0, 0, 0, 0, 3238, 801, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3510, 0, 0, 0, 0, 1345, 3975, 0, 0, 0, 0, 0, 0, 0, 0, 3778, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2947, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3476, 0, 4005, 0, 3461, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3748, 0, 0, 2962, 0, 0, 0, 0, 4035, 0, 0, 4020, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3221, 0, 0, 0, 0, 0, 0, 2690, + 0, 0, 0, 3795, 0, 0, 0, 4050, 0, 0, 0, 0, 0, 3204, 3765, 0, 0, 0, 0, 0, 2707, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const LC3_UINT8 gf16_g_pow[16] = {1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9, 1}; +/* g_pow[i] contains g^i*/ + +static const LC3_UINT8 gf16_log_g[16] = {255, 0, 1, 4, 2, 8, 5, 10, 3, 14, 9, 7, 6, 13, 11, 12}; +/* log_g[n] contains contains the value i such that g^i = n for n=1, 2, ..., 15, log_g[0] is set to 255 */ + +static const LC3_UINT8 gf16_inv_table[16] = {255, 1, 9, 14, 13, 11, 7, 6, 15, 2, 12, 5, 10, 4, 3, 8}; +/* gf16_inv_table[n] contains the multiplicative inverse of n in GF(16) (1/0 is set to 255)*/ + +/* RS16 generating polynomials (from lowest to highest coefficient without leading 1)*/ + +static const LC3_UINT8 rs16_gp_d3[] = {8, 6}; +static const LC3_UINT8 rs16_gp_d5[] = {7, 8, 12, 13}; +static const LC3_UINT8 rs16_gp_d7[] = {12, 10, 12, 3, 9, 7}; + +/* FEC mode signaling polynomials */ + +#define EP_SIG_POLY_DEG 12 + +static const LC3_UINT8 sig_polys[4][15] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 15, 5, 6, 14, 9, 1, 3, 12, 10, 13, 3, 2, 0, 0}, + {7, 11, 14, 1, 2, 3, 12, 11, 6, 15, 7, 6, 12, 0, 0}, + {6, 15, 12, 2, 9, 15, 2, 8, 12, 3, 10, 5, 4, 0, 0}}; + +static const LC3_UINT8 sig_poly_syndr[4][6] = { + {0, 0, 0, 0, 0, 0}, {0, 4, 5, 11, 5, 8}, {0, 5, 9, 0, 1, 7}, {0, 12, 5, 12, 9, 8}}; + +/* bit count table for error report (0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111) */ + +static const LC3_UINT8 rs16_bit_count_table[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; + +/* List of RS16 generators by Hamming distance */ + +static const LC3_UINT8 *const rs16_gp_by_hd[8] = {NULL, NULL, NULL, rs16_gp_d3, NULL, rs16_gp_d5, NULL, rs16_gp_d7}; + +/* fec config data */ + +static const LC3_UINT8 hamming_distance_by_mode0[] = {1, 3, 3, 5, 7}; +static const LC3_UINT8 hamming_distance_by_mode1[] = {1, 1, 3, 5, 7}; + +static const LC3_UINT8 crc1_bytes_by_mode0[] = {0, 3, 2, 2, 2}; +static const LC3_UINT8 crc1_bytes_by_mode1[] = {0, 3, 3, 3, 3}; +static const LC3_UINT8 crc2_bytes_by_mode[] = {0, 0, 2, 2, 2}; + +/* fec mode risk table */ +typedef struct +{ + LC3_UINT32 mantissa; + LC3_INT16 exponent; +} simple_float; + +static const simple_float risk_table_f[4][4] = {{{16384, 0}, {16384, 0}, {16384, 0}, {16384, 0}}, + {{16384, -8}, {26880, -1}, {16384, 0}, {16384, 0}}, + {{16384, -16}, {26880, -9}, {20475, -2}, {16384, 0}}, + {{16384, -24}, {26880, -17}, {20475, -10}, {19195, -4}}}; +/* bit error limits for slot size 40 */ +static LC3_INT16 const low_br_max_bit_errors_by_mode[] = {0, 0, 3, 9, 18}; + +/* +corresponding float values: + {1.f, 1.f, 1.f, 1.f}, + {0.00390625f, 0.820312f, 1.f, 1.f}, + {1.52588e-05f, 0.00320435f, 0.312424f, 1.f}, + {5.96046e-08f, 1.2517e-05f, 0.00122041f, 0.0732243f} +*/ + +/* internal encoder routines */ + +FEC_STATIC void fec_interleave_pack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords); + +FEC_STATIC void rs16_enc(LC3_UINT8 *iobuf, LC3_INT16 codeword_length, LC3_INT16 hamming_distance, LC3_INT16 fec_mode, + LC3_INT16 signal_mode); + +/* internal decoder routines */ + +FEC_STATIC void fec_deinterleave_unpack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords); + +FEC_STATIC LC3_INT16 fec_data_preproc(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_UINT8 *cw_buf, LC3_INT16 data_bytes, + LC3_INT16 slot_bytes, LC3_INT16 pc_split); + +FEC_STATIC void fec_data_postproc(LC3_INT16 mode, LC3PLUS_EpModeRequest *epmr, LC3_UINT8 *iobuf, LC3_INT16 data_bytes, LC3_UINT8 *cw_buf, + LC3_INT16 slot_bytes, LC3_INT16 pc_split, LC3_INT32 *bfi); + +FEC_STATIC LC3_INT32 rs16_detect_and_correct(LC3_UINT8 *iobuf, LC3_INT32 n_symb, LC3_INT32 n_codewords, LC3PLUS_EpModeRequest *epmr, LC3_INT16 *error_report, + LC3_INT32 *bfi, LC3_UINT8 *array_of_trust, LC3_INT32 ccc_flag_flag, LC3_INT16 *n_pccw); + +FEC_STATIC void rs16_calculate_six_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg); + +FEC_STATIC void rs16_calculate_four_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg); + +FEC_STATIC void rs16_calculate_two_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg); + +FEC_STATIC LC3_INT8 rs16_calculate_elp(LC3_UINT8 *elp, LC3_UINT8 *syndromes, LC3_INT16 hamming_distance); + +FEC_STATIC LC3_INT16 rs16_factorize_elp(LC3_UINT8 *error_locations, LC3_UINT8 *elp, LC3_INT16 deg_elp, LC3_INT16 max_pos); + +FEC_STATIC void rs16_calculate_errors(LC3_UINT8 *errors, LC3_UINT8 *err_pos, LC3_UINT8 *syndromes, LC3_INT8 deg_elp, LC3_INT8 t); + +/* auxiliary routines */ + +FEC_STATIC LC3_INT16 crc1(LC3_UINT8 *data, LC3_INT16 data_size, LC3_INT16 epmr, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check); + +FEC_STATIC LC3PLUS_EpModeRequest fec_estimate_epmr_from_cw0(LC3_UINT8 *cw0, LC3_INT8 *t, LC3_UINT8 *syndromes, LC3_UINT8 *elp, LC3_INT8 *deg_elp, + LC3_UINT8 *err_pos, LC3_UINT8 *err_symb, LC3_INT16 n_codewords, LC3_INT16 n_symb); + +FEC_STATIC void dw0_bitswap(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_bytes); + +FEC_STATIC LC3PLUS_EpModeRequest cw0_get_epmr(LC3_UINT8 *cw0, LC3_INT16 epmr_position); + +FEC_STATIC LC3PLUS_EpModeRequest dw0_get_epmr(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_size); + +FEC_STATIC LC3_INT16 crc2(LC3_UINT8 *data, LC3_INT16 data_size, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check); + +FEC_STATIC simple_float simple_float_mul(simple_float op1, simple_float op2); + +FEC_STATIC LC3_INT16 simple_float_cmp(simple_float op1, simple_float op2); + +FEC_STATIC LC3_INT16 get_total_crc_size(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 pc_split); + +FEC_STATIC LC3_INT16 get_n_codewords(LC3_INT16 slot_bytes); + +FEC_STATIC LC3_INT16 get_codeword_length(LC3_INT16 n_codewords, LC3_INT16 slot_nibbles, LC3_INT16 codeword_index); + + + +LC3_INT16 fec_get_n_pccw(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 ccc_flag) +{ + LC3_INT16 n_pccw; + + if (fec_mode == 3) + { + n_pccw = (LC3_INT16) (0.080447761194030 * slot_bytes - 1.791044776119394 + 0.5); + } + else if (fec_mode == 4) + { + n_pccw = (LC3_INT16) (0.066492537313433 * slot_bytes - 1.970149253731338 + 0.5); + } + else + { + n_pccw = 0; + } + + if (ccc_flag == 1 || slot_bytes < 80) + { + n_pccw = 0; + } + + return n_pccw; +} + +FEC_STATIC LC3_INT16 get_total_crc_size(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 pc_split) +{ + LC3_INT16 n_crc; + + n_crc = crc1_bytes_by_mode1[fec_mode]; + if (slot_bytes == 40) + { + n_crc = crc1_bytes_by_mode0[fec_mode]; + } + + if (pc_split > 0) + { + n_crc = n_crc + crc2_bytes_by_mode[fec_mode]; + } + + + + return n_crc; +} + +FEC_STATIC LC3_INT16 get_n_codewords(LC3_INT16 slot_bytes) +{ + return (2*slot_bytes + 14)/15; +} + +FEC_STATIC LC3_INT16 get_codeword_length(LC3_INT16 n_codewords, LC3_INT16 slot_nibbles, LC3_INT16 codeword_index) +{ + return (slot_nibbles - codeword_index - 1) / n_codewords + 1; +} + +/* Encoder */ + +LC3_INT16 fec_get_data_size(LC3_INT16 fec_mode, LC3_INT16 ccc_flag, LC3_INT16 slot_bytes) +/* not time critical */ +{ + LC3_INT16 n_codewords, payload_size; + + n_codewords = get_n_codewords(slot_bytes); + + assert(n_codewords == (2 * slot_bytes + RS16_CW_LEN_MAX - 1) / RS16_CW_LEN_MAX); + payload_size = slot_bytes; + + if (fec_mode > 0) + { + if (fec_mode == 1) + { + payload_size --; + } + else + { + payload_size -= (fec_mode - 1) * n_codewords; + } + if (slot_bytes == 40) + { + payload_size -= crc1_bytes_by_mode0[fec_mode]; + } + else + { + payload_size -= crc1_bytes_by_mode1[fec_mode]; + } + + if (ccc_flag == 0 && fec_mode > 2 && slot_bytes >= 80) + { + payload_size -= crc2_bytes_by_mode[fec_mode]; + } + } + + + + return payload_size; +} + +LC3_INT16 fec_get_n_pc(LC3_INT16 fec_mode, LC3_INT16 n_pccw, LC3_INT16 slot_bytes) +/* not time critical */ +{ + LC3_INT16 n_codewords, pc_split; + LC3_INT32 i; + + n_codewords = get_n_codewords(slot_bytes); + + assert(n_codewords == (2 * slot_bytes + RS16_CW_LEN_MAX - 1) / RS16_CW_LEN_MAX); + + pc_split = - 2*n_pccw*(fec_mode - 1); + + if (fec_mode == 1 || slot_bytes < 80) + { + pc_split = 0; + } + else + { + for (i = 0; i < n_pccw; i++) + { + pc_split += (2 * slot_bytes + i) / n_codewords; + } + } + + + + return pc_split; +} + +/* functions for EPMR handling */ +FEC_STATIC void dw0_bitswap(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_bytes) +/* swap epmr bits with bits that will be positioned at 30 and 32 in code word 0 */ +{ + LC3_UINT8 tmp; + LC3_INT32 ind0, ind1, position; + + position = get_codeword_length(get_n_codewords(slot_bytes), 2*slot_bytes, 0) - 1; + + if (slot_bytes == 40) + { + ind0 = 2*crc1_bytes_by_mode0[mode] - 1; + } + else + { + ind0 = 2*crc1_bytes_by_mode1[mode] - 1; + } + + ind1 = position - hamming_distance_by_mode0[mode] + 1; + + /* swap bits 2 and 3 of dw0[ind0] with bits 0 and 1 of dw0[ind1] */ + tmp = (dw0[ind0] >> 2) & 3; + dw0[ind0] = dw0[ind0] & 3; + dw0[ind0] = dw0[ind0] | ((dw0[ind1] & 3) << 2); + dw0[ind1] = dw0[ind1] & 12; + dw0[ind1] = dw0[ind1] | tmp; + + +} + +FEC_STATIC LC3PLUS_EpModeRequest cw0_get_epmr(LC3_UINT8 *cw0, LC3_INT16 position) +{ + return (LC3PLUS_EpModeRequest)(cw0[position] & 3); +} + +FEC_STATIC LC3PLUS_EpModeRequest dw0_get_epmr(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_size) +{ + LC3_INT32 ncrc1; + LC3PLUS_EpModeRequest epmr; + + ncrc1 = crc1_bytes_by_mode1[mode]; + + if (slot_size == 40) + { + ncrc1 = crc1_bytes_by_mode0[mode]; + } + + epmr = (LC3PLUS_EpModeRequest)(dw0[2 * ncrc1 - 1] >> 2); + + + + return epmr; +} + + +FEC_STATIC LC3_INT16 fec_data_preproc(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_UINT8 *cw_buf, LC3_INT16 data_bytes, + LC3_INT16 slot_bytes, LC3_INT16 pc_split) +{ + LC3_INT16 data_offset, n_crc1, n_crc2; + LC3_INT32 i, j; + + data_offset = 2*(slot_bytes - data_bytes); + + /* extract and reverse data*/ + j = 2*slot_bytes - 1; + for (i = 0; i < data_bytes; i++) + { + cw_buf[j--] = iobuf[i] & 15; + cw_buf[j--] = iobuf[i] >> 4; + } + + /* add crc hashes */ + if (slot_bytes == 40) + { + n_crc1 = crc1_bytes_by_mode0[mode]; + } + else + { + n_crc1 = crc1_bytes_by_mode1[mode]; + } + + if (pc_split > 0 && mode > 1) + { + n_crc2 = crc2_bytes_by_mode[mode]; + } + else + { + n_crc2 = 0; + } + + if (n_crc2) + { + crc2(cw_buf + data_offset + 2 * data_bytes - pc_split, pc_split, cw_buf + data_offset - 2 * n_crc2, n_crc2, 0); + } + if (n_crc1) + { + crc1(cw_buf + data_offset, 2 * data_bytes - pc_split, epmr, cw_buf + data_offset - 2 * (n_crc1 + n_crc2), n_crc1, + 0); + } + + data_offset -= 2* (n_crc1 + n_crc2); + + dw0_bitswap(cw_buf + data_offset, mode, slot_bytes); + + + + return data_offset; +} + +void fec_encoder(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_INT16 data_bytes, LC3_INT16 slot_bytes, LC3_INT16 n_pccw) +{ + LC3_INT16 n_codewords, codeword_length, hd, redundancy_nibbles, cw_offset, dw_offset, pc_split; + LC3_INT32 i, j; + LC3_UINT8 cw_buf[2 * FEC_SLOT_BYTES_MAX]; + + cw_offset = 0; + dw_offset = 0; + pc_split = 0; + + n_codewords = get_n_codewords(slot_bytes); + + /* some sanity checks */ + { + LC3_INT32 tmp = slot_bytes; + + assert((slot_bytes >= FEC_SLOT_BYTES_MIN && slot_bytes <= FEC_SLOT_BYTES_MAX) && + "fec_encoder: slot_bytes out of range"); + tmp -= mode == 1 ? 1 : n_codewords * (mode - 1); // reed solomon redundancy + tmp -= slot_bytes == 40 ? crc1_bytes_by_mode0[mode] : crc1_bytes_by_mode1[mode]; // crc1 + tmp -= (n_pccw > 0) && (mode > 1) ? crc2_bytes_by_mode[mode] : 0; // crc2 + assert(data_bytes == tmp && "fec_encoder: inconsistent payload size"); + assert(n_codewords - n_pccw >= 6); + } + + /* data preproc: re-ordering and hash extension */ + pc_split = fec_get_n_pc(mode, n_pccw, slot_bytes); + + dw_offset = fec_data_preproc(mode, epmr, iobuf, cw_buf, data_bytes, slot_bytes, pc_split); + + /* encoding of first data word*/ + hd = hamming_distance_by_mode0[mode]; + redundancy_nibbles = hd - 1; + codeword_length = get_codeword_length(n_codewords, 2 * slot_bytes, 0); + + assert(codeword_length == (2 * slot_bytes - 1) / n_codewords + 1); + + for (j = redundancy_nibbles; j < codeword_length; (j++, dw_offset++)) + { + cw_buf[j] = cw_buf[dw_offset]; + } + + rs16_enc(cw_buf, codeword_length, hd, mode, 1); + + cw_offset += codeword_length; + + /* encoding of remaining data words */ + hd = hamming_distance_by_mode1[mode]; + redundancy_nibbles = hd - 1; + + for (i = 1; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, 2*slot_bytes, i); + + for (j = redundancy_nibbles; j < codeword_length; (j++, dw_offset++)) + { + cw_buf[cw_offset + j] = cw_buf[dw_offset]; + } + + rs16_enc(cw_buf + cw_offset, codeword_length, hd, mode, i < 6); + + cw_offset += codeword_length; + } + + assert(cw_offset == 2 * slot_bytes && dw_offset == 2 * slot_bytes); + + fec_interleave_pack(iobuf, cw_buf, 2 * slot_bytes, n_codewords); + + +} + +FEC_STATIC void rs16_enc(LC3_UINT8 *iobuf, LC3_INT16 codeword_length, LC3_INT16 hamming_distance, LC3_INT16 fec_mode, + LC3_INT16 signal_mode) +/* expects (data polynomial) * x^(hamming_distance - 1) in iobuf */ +{ + LC3_UINT8 const *gp; + LC3_UINT8 shift_buffer[RS16_CW_LEN_MAX + 1], lc; + LC3_INT32 i, j, deg_gp; + + memset(shift_buffer, 0, sizeof(shift_buffer)); + gp = rs16_gp_by_hd[hamming_distance]; + deg_gp = hamming_distance - 1; + + if (hamming_distance > 1) + { + assert(codeword_length > deg_gp); + + /* initialize redundancy part to zero */ + memset(iobuf, 0, deg_gp); + + /* initialize shift_buffer */ + memmove(shift_buffer + 1, iobuf + codeword_length - deg_gp, deg_gp); + + /* calculate remainder */ + for (i = codeword_length - deg_gp - 1; i >= 0; i--) + { + shift_buffer[0] = iobuf[i]; + lc = shift_buffer[deg_gp] << 4; + + for (j = deg_gp - 1; j >= 0; j--) + { + shift_buffer[j + 1] = GF16_ADD(shift_buffer[j], GF16_MUL0(gp[j], lc)); + } + } + + /* add remainder to shifted data polynomial */ + for (i = 0; i < deg_gp; i++) + { + iobuf[i] = shift_buffer[i + 1]; + } + + /* add signaling polynomial */ + if (signal_mode) + { + assert(codeword_length > EP_SIG_POLY_DEG); + for (i = 0; i <= EP_SIG_POLY_DEG; i++) + { + iobuf[i] = GF16_ADD(iobuf[i], sig_polys[fec_mode - 1][i]); + } + } + } + + +} + +FEC_STATIC void fec_interleave_pack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords) +{ + LC3_INT16 out_offset, cw_offset, codeword_length; + LC3_INT32 i, j; + + out_offset = 0; + cw_offset = 0; + + /* initialize output buffer to zero */ + memset(out, 0, n_nibbles >> 1); + + /* interleave and pack codewords */ + for (i = 0; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, n_nibbles, i); + + for (j = 0; j < codeword_length; j++) + { + out_offset = n_nibbles - 1 - j*n_codewords - i; + out[out_offset >> 1] |= in[cw_offset] << ((out_offset & 1) << 2); + cw_offset = cw_offset + 1; + } + } + + + assert(cw_offset == n_nibbles); +} + +/* Decoder */ +FEC_STATIC void fec_data_postproc(LC3_INT16 mode, LC3PLUS_EpModeRequest *epmr, LC3_UINT8 *obuf, LC3_INT16 data_bytes, LC3_UINT8 *cw_buf, + LC3_INT16 slot_bytes, LC3_INT16 pc_split, LC3_INT32 *bfi) +{ + LC3_INT16 i; + LC3_INT16 n_crc1, n_crc2; + LC3_INT16 cw_buf_len; + LC3PLUS_EpModeRequest tmp_epmr; + + n_crc1 = crc1_bytes_by_mode1[mode]; + if (slot_bytes == 40) + { + n_crc1 = crc1_bytes_by_mode0[mode]; + } + + n_crc2 = 0; + if (pc_split > 0) + { + n_crc2 = crc2_bytes_by_mode[mode]; + } + + assert(n_crc1 == (slot_bytes == 40 ? crc1_bytes_by_mode0[mode] : crc1_bytes_by_mode1[mode])); + assert(n_crc2 == ((pc_split > 0) && (mode > 1) ? crc2_bytes_by_mode[mode] : 0)); + + cw_buf_len = 2 * (data_bytes + n_crc1 + n_crc2); + + if ((mode - 1)) + { + /* reverse bit-swap */ + dw0_bitswap(cw_buf, mode, slot_bytes); + tmp_epmr = dw0_get_epmr(cw_buf, mode, slot_bytes); + + if (crc1(cw_buf + ((n_crc1 + n_crc2) << 1), ((data_bytes << 1) - pc_split), tmp_epmr, cw_buf, n_crc1, 1)) + { + *bfi = 1; + + return; + } + else + { + *epmr = tmp_epmr; + } + } + + if (pc_split > 0 && *bfi != 2) + { + if (crc2(cw_buf + (((data_bytes + (n_crc1 + n_crc2)) << 1) - pc_split), pc_split, + cw_buf + (n_crc1 << 1), n_crc2, 1)) + { + *bfi = 2; + } + } + + for (i = 0; i < data_bytes; i++) + { + obuf[i] = (LC3_UINT8)(cw_buf[cw_buf_len - 2 * i - 1] | (cw_buf[cw_buf_len - 2 * i - 2] << 4)); + } + + +} + +LC3_INT32 fec_decoder(LC3_UINT8 *iobuf, LC3_INT16 slot_bytes, LC3_INT32 *data_bytes, LC3PLUS_EpModeRequest *epmr, LC3_INT16 ccc_flag, LC3_INT16 *n_pccw, + LC3_INT32 *bfi, LC3_INT16 *be_bp_left, LC3_INT16 *be_bp_right, LC3_INT16 *n_pc, LC3_INT16 *m_fec) +{ + LC3_UINT8 cw_buf[2 * FEC_SLOT_BYTES_MAX]; + LC3_UINT8 array_of_trust[MAX_LEN]; + LC3_INT16 i, j; + LC3_INT16 cw_offset, dw_offset; + LC3_INT16 n_codewords, redundancy_nibbles, codeword_length; + LC3_INT16 mode, error_report; + LC3_INT16 n_crc; + LC3_INT16 first_bad_cw; + LC3_INT16 pc_split; + + UNUSED(n_crc); + + + if (*bfi == 1) + { + + return ERROR_REPORT_BEC_MASK; + } + + if (slot_bytes < FEC_SLOT_BYTES_MIN || slot_bytes > FEC_SLOT_BYTES_MAX) + { + *bfi = 1; + + return ERROR_REPORT_BEC_MASK; + } + + if (ccc_flag == 0) + { + *be_bp_left = -1; + *be_bp_right = -1; + } + + n_codewords = get_n_codewords(slot_bytes); + + /* extract and de-interleave nibbles */ + fec_deinterleave_unpack(cw_buf, iobuf, 2 * slot_bytes, n_codewords); + + /* mode detection and error correction */ + mode = rs16_detect_and_correct(cw_buf, 2 * slot_bytes, n_codewords, epmr, &error_report, bfi, array_of_trust, + ccc_flag, n_pccw); + + /* for normal slots the maximal number of bit errors is limited */ +#ifndef APPLY_MAX_ERRORS + if (slot_bytes == 40 && mode > 0) + { + if ((error_report & ERROR_REPORT_BEC_MASK) > low_br_max_bit_errors_by_mode[mode]) + { + error_report &= ERROR_REPORT_BEC_MASK; + mode = -1; + *bfi = 1; + } + else + { + if ((error_report & ERROR_REPORT_BEC_MASK) > low_br_max_bit_errors_by_mode[2]) + { + error_report &= ~ERROR_REPORT_EP2_OK; + } + if ((error_report & ERROR_REPORT_BEC_MASK) > low_br_max_bit_errors_by_mode[3]) + { + error_report &= ~ERROR_REPORT_EP3_OK; + } + } + } +#endif + + if (*bfi == 1) + { + *data_bytes = 0; + + + return error_report; + } + + /* initialization for decoding */ + *data_bytes = fec_get_data_size(mode, ccc_flag, slot_bytes); + pc_split = fec_get_n_pc(mode, *n_pccw, slot_bytes); + n_crc = get_total_crc_size(slot_bytes, mode, pc_split); + + /* decoding of first code word */ + redundancy_nibbles = hamming_distance_by_mode0[mode] - 1; + codeword_length = get_codeword_length(n_codewords, slot_bytes + slot_bytes, 0); + + dw_offset = 0; + cw_offset = 0; + + for (j = redundancy_nibbles; j < codeword_length; j++) + { + cw_buf[dw_offset++] = cw_buf[j]; + } + cw_offset = cw_offset + codeword_length; + + /* decoding of remaining code words */ + redundancy_nibbles = hamming_distance_by_mode1[mode] - 1; + + for (i = 1; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, slot_bytes + slot_bytes, i); + + for (j = redundancy_nibbles; j < codeword_length; j++) + { + cw_buf[dw_offset++] = cw_buf[j + cw_offset]; + } + + cw_offset = cw_offset + codeword_length; + } + + /* data postproc: hash validation and re-ordering */ + + fec_data_postproc(mode, epmr, iobuf, *data_bytes, cw_buf, slot_bytes, pc_split, bfi); + + if (*bfi == 1) + { + *data_bytes = 0; + + error_report &= ERROR_REPORT_BEC_MASK; + + + return error_report; + } + + if (*bfi == 2) + { + first_bad_cw = 0; + array_of_trust[*n_pccw] = 0; + while (array_of_trust[first_bad_cw] != 0) + { + first_bad_cw = first_bad_cw + 1; + } + if (first_bad_cw == *n_pccw) + { + /* this is the case when CRC failed */ + *be_bp_left = 0; + } + else + { + *be_bp_left = 4*fec_get_n_pc(mode, first_bad_cw, slot_bytes); + } + + for (i = *n_pccw - 1; i >= 0; i--) + { + if (!array_of_trust[i]) + { + break; + } + } + if (i < 0) + { + i = *n_pccw - 1; + } + *be_bp_right = 4*fec_get_n_pc(mode, i + 1, slot_bytes) - 1; + } + + if (ccc_flag == 0) + { + *n_pc = pc_split; + *m_fec = mode; + } + + + return error_report; +} + +FEC_STATIC void fec_deinterleave_unpack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords) +{ + LC3_INT16 in_offset, out_offset, codeword_length; + LC3_INT32 i, j; + + in_offset = 0; + out_offset = 0; + + /* unpack nibbles in input buffer and deinterleave codewords */ + for (i = 0; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, n_nibbles, i); + for (j = 0; j < codeword_length; (j++, out_offset++)) + { + in_offset = n_nibbles - 1 - j*n_codewords - i; + out[out_offset] = (in[in_offset >> 1] >> ((in_offset & 1) << 2)) & 15; + } + } + + + assert(out_offset == n_nibbles); + +} + +FEC_STATIC LC3PLUS_EpModeRequest fec_estimate_epmr_from_cw0(LC3_UINT8 *cw0, LC3_INT8 *t, LC3_UINT8 *syndromes, LC3_UINT8 *elp, LC3_INT8 *deg_elp, + LC3_UINT8 *err_pos, LC3_UINT8 *err_symb, LC3_INT16 n_codewords, LC3_INT16 n_symb) +{ + LC3_INT32 epmr_lowest_risk_exp; + LC3_INT32 start, inc, i, n_candidates; + LC3_INT32 first_codeword_length; + LC3_INT32 mode_counter; + LC3PLUS_EpModeRequest epmr; + + epmr_lowest_risk_exp = 0; + first_codeword_length = get_codeword_length(n_codewords, n_symb, 0); + start = 2; + inc = 1; + n_candidates = 0; + + /* test if first code word decodes in mode 0 or 1 without error correction */ + if ((syndromes[SYNDROME_IDX(0, 0)] | syndromes[SYNDROME_IDX(0, 0) + 1]) == 0 || + (syndromes[SYNDROME_IDX(1, 0)] | syndromes[SYNDROME_IDX(1, 0) + 1]) == 0) + { + epmr_lowest_risk_exp = risk_table_f[1][0].exponent; + } + /* test if first code word decodes in mode 2 or 3 with lower risk */ + if (deg_elp[DEG_ELP_IDX(2, 0)] <= t[2]) + { + if (risk_table_f[2][deg_elp[DEG_ELP_IDX(2, 0)]].exponent <= -8) + { + n_candidates++; + start = 2; + } + } + + if (deg_elp[DEG_ELP_IDX(3, 0)] <= t[3]) + { + if (risk_table_f[3][deg_elp[DEG_ELP_IDX(3, 0)]].exponent <= -8) + { + n_candidates++; + start = 3; + } + } + + if (n_candidates > 1) + { + /* decide on order if mode 2 and 3 are considered */ + if (simple_float_cmp(risk_table_f[2][deg_elp[DEG_ELP_IDX(2, 0)]], risk_table_f[3][deg_elp[DEG_ELP_IDX(3, 0)]]) < + 0) + { + start = 2; + inc = 1; + } + else + { + start = 3; + inc = -1; + } + } + + for (mode_counter = start, i = 0; i < n_candidates; mode_counter += inc, i++) + { + if (risk_table_f[mode_counter][deg_elp[DEG_ELP_IDX(mode_counter, 0)]].exponent < epmr_lowest_risk_exp) + { + if (!rs16_factorize_elp(err_pos + ERR_POS_IDX(mode_counter, 0), elp + ELP_IDX(mode_counter, 0), + deg_elp[DEG_ELP_IDX(mode_counter, 0)], first_codeword_length - 1)) + { + /* code word is decodable with error correction */ + epmr_lowest_risk_exp = risk_table_f[mode_counter][deg_elp[DEG_ELP_IDX(mode_counter, 0)]].exponent; + + rs16_calculate_errors(err_symb + ERR_SYMB_IDX(mode_counter, 0), err_pos + ERR_POS_IDX(mode_counter, 0), + syndromes + SYNDROME_IDX(mode_counter, 0), deg_elp[DEG_ELP_IDX(mode_counter, 0)], + t[mode_counter]); + + for (i = 0; i < deg_elp[DEG_ELP_IDX(mode_counter, 0)]; i++) + { + cw0[err_pos[ERR_POS_IDX(mode_counter, 0) + i]] = GF16_ADD( + cw0[err_pos[ERR_POS_IDX(mode_counter, 0) + i]], err_symb[ERR_SYMB_IDX(mode_counter, 0) + i]); + } + break; + } + } + } + + epmr = cw0_get_epmr(cw0, first_codeword_length - 1); + + if (epmr_lowest_risk_exp > -16) + { + epmr += 4; + } + if (epmr_lowest_risk_exp > -8) + { + epmr += 4; + } + + + return epmr; +} + +FEC_STATIC LC3_INT32 rs16_detect_and_correct(LC3_UINT8 *iobuf, LC3_INT32 n_symb, LC3_INT32 n_codewords, LC3PLUS_EpModeRequest *epmr, LC3_INT16 *error_report, + LC3_INT32 *bfi, LC3_UINT8 *array_of_trust, LC3_INT32 ccc_flag, LC3_INT16 *n_pccw) +{ + + LC3_INT16 mode_broken[4]; + LC3_INT16 error_report_ep_ok[4]; + LC3_INT16 i, cw_counter, mode_counter, cw_offset; + LC3_INT16 codeword_length; + LC3_INT16 mode; + LC3_INT16 mode_candidates[4]; + LC3_INT16 n_mode_candidates; + LC3_INT16 broken_cw, n_broken_cw; + LC3_INT16 j, idx_min; + LC3_INT16 n_pccw0; + simple_float val_min_f; + LC3_INT16 tmp; + LC3_INT16 epmr_position; + simple_float dec_risk_f[FEC_N_MODES]; + simple_float risk_min_f; + simple_float ep_risk_thresh; + LC3_INT32 epmr_dec_fail_increment; + LC3_UINT8 const *hamming_distance; + LC3_UINT8 syndromes[FEC_TOTAL_SYNDROME_SIZE]; + LC3_UINT8 elp[FEC_TOTAL_ELP_SIZE]; + LC3_UINT8 err_pos[FEC_TOTAL_ERR_POS_SIZE]; + LC3_UINT8 err_symb[FEC_TOTAL_ERROR_SIZE]; + LC3_INT8 t[FEC_N_MODES]; + LC3_INT8 deg_elp[FEC_TOTAL_DEG_ELP_SIZE]; + LC3_UINT8 blacklist[FEC_N_MODES]; + LC3_INT32 rop; + + void (*syndr_calc[3])(LC3_UINT8 *, LC3_UINT8 *, LC3_INT32); + rop = 0; + + /* initialization */ + blacklist[0] = 0; + blacklist[1] = 0; + blacklist[2] = 0; + blacklist[3] = 0; + mode_broken[0] = 0; + mode_broken[1] = 0; + mode_broken[2] = 0; + mode_broken[3] = 0; + error_report_ep_ok[0] = ERROR_REPORT_EP1_OK; + error_report_ep_ok[1] = ERROR_REPORT_EP2_OK; + error_report_ep_ok[2] = ERROR_REPORT_EP3_OK; + error_report_ep_ok[3] = ERROR_REPORT_EP4_OK; + hamming_distance = &hamming_distance_by_mode0[1]; + mode = -1; + n_mode_candidates = 0; + risk_min_f.mantissa = SIMPLE_FLOAT_1_MANTISSA; + risk_min_f.exponent = 0; + + if (n_symb <= 80) + { + ep_risk_thresh.mantissa = EP_RISK_THRESH_NS_M; + ep_risk_thresh.exponent = EP_RISK_THRESH_NS_E; + } + else + { + ep_risk_thresh.mantissa = EP_RISK_THRESH_OS_M; + ep_risk_thresh.exponent = EP_RISK_THRESH_OS_E; + } + + syndr_calc[0] = &rs16_calculate_two_syndromes; + syndr_calc[1] = &rs16_calculate_four_syndromes; + syndr_calc[2] = &rs16_calculate_six_syndromes; + + for (i = 0; i < FEC_N_MODES; i++) + { + t[i] = (hamming_distance[i] -1)/2; + } + + *error_report = 0; + *bfi = 0; + + /* mode detection (stage 1) */ + codeword_length = get_codeword_length(n_codewords, n_symb, 0); + + epmr_position = codeword_length - 1; + + rs16_calculate_two_syndromes(syndromes + SYNDROME_IDX(0, 0), iobuf, codeword_length - 1); + + if ((syndromes[0 + SYNDROME_IDX(0, 0)] | syndromes[1 + SYNDROME_IDX(0, 0)]) == 0) + { + + /* data validation for fec mode 1 */ + *epmr = cw0_get_epmr(iobuf, epmr_position); + + dw0_bitswap(iobuf + 2, 1, n_symb / 2); + + if (!crc1(iobuf + 8, n_symb - 8, *epmr, iobuf + 2, 3, 1)) + { + *error_report |= ERROR_REPORT_ALL_OK; + mode = 0; + + + rop = mode + 1; + goto CLEANUP; + } + else + { + /* reverse bit swap */ + dw0_bitswap(iobuf + 2, 1, n_symb / 2); + + *epmr += 4; + } + } + + blacklist[0] = 1; + + /* mode detection (stage 2) */ + + /* calculate syndromes of code words 0 to 5 and modes 1 to 3 */ + cw_offset = 0; + + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + + rs16_calculate_six_syndromes(syndromes + SYNDROME_IDX(1, cw_counter), iobuf + cw_offset, + codeword_length - 1); + + cw_offset += codeword_length; + + for (mode_counter = FEC_N_MODES - 1; mode_counter >= 1; mode_counter--) + { + for (i = 0; i < hamming_distance[mode_counter] - 1; i++) + { + syndromes[SYNDROME_IDX(mode_counter, cw_counter) + i] = GF16_ADD( + syndromes[SYNDROME_IDX(1, cw_counter) + i], sig_poly_syndr[mode_counter][i]); + } + } + } + + /* check for valid code words */ + for (mode_counter = 1; mode_counter < FEC_N_MODES; mode_counter++) + { + n_broken_cw = 0; + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + broken_cw = 0; + for (i = 0; i < hamming_distance[mode_counter] - 1; i++) + { + broken_cw |= syndromes[SYNDROME_IDX(mode_counter, cw_counter) + i]; + } + if (broken_cw != 0) + { + n_broken_cw ++; + } + } + + if (n_broken_cw == 0) + { + mode = mode_counter; + cw_offset = 0; + + *epmr = cw0_get_epmr(iobuf, epmr_position); + + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + for (i = 0; i <= EP_SIG_POLY_DEG; i++) + { + iobuf[cw_offset + i] = GF16_ADD(iobuf[cw_offset + i], sig_polys[mode][i]); + } + cw_offset += codeword_length; + } + } + } + + if (mode < 0) /* mode hasn't been detected so far -> errors occurred in transmission */ + { + /* calculate error locator polynomials for code words 0 to 5 */ + for (mode_counter = 1; mode_counter < FEC_N_MODES; mode_counter++) + { + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + deg_elp[DEG_ELP_IDX(mode_counter, cw_counter)] = rs16_calculate_elp( + elp + ELP_IDX(mode_counter, cw_counter), syndromes + SYNDROME_IDX(mode_counter, cw_counter), + t[mode_counter]); + if (deg_elp[DEG_ELP_IDX(mode_counter, cw_counter)] > t[mode_counter]) + { + blacklist[mode_counter] = 1; + break; + } + } + } + + /* risk analysis for mode candidate selection */ + for (mode_counter = 1; mode_counter < FEC_N_MODES; mode_counter++) + { + dec_risk_f[mode_counter].mantissa = SIMPLE_FLOAT_1_MANTISSA; + dec_risk_f[mode_counter].exponent = 0; + + if (blacklist[mode_counter] == 0) + { + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + dec_risk_f[mode_counter] = simple_float_mul( + dec_risk_f[mode_counter], + risk_table_f[mode_counter][deg_elp[DEG_ELP_IDX(mode_counter, cw_counter)]]); + } + + if (simple_float_cmp(dec_risk_f[mode_counter], ep_risk_thresh) <= 0) + { + mode_candidates[n_mode_candidates++] = mode_counter; + } + + if (simple_float_cmp(dec_risk_f[mode_counter], risk_min_f) < 0) + { + risk_min_f = dec_risk_f[mode_counter]; + } + } + } + assert(n_mode_candidates <= 4); // suppress false gcc warning when OPTIM=3 + + /* sort mode candidates by risk */ + for (i = 0; i < n_mode_candidates; i++) + { + idx_min = i; + val_min_f = dec_risk_f[mode_candidates[i]]; + + for (j = i + 1; j < n_mode_candidates; j++) + { + if (simple_float_cmp(dec_risk_f[mode_candidates[j]], val_min_f) < 0) + { + val_min_f = dec_risk_f[mode_candidates[j]]; + idx_min = j; + } + } + + if (idx_min > i) + { + tmp = mode_candidates[i]; + mode_candidates[i] = mode_candidates[idx_min]; + mode_candidates[idx_min] = tmp; + } + } + + /* try out candidate modes */ + for (i = 0; i < n_mode_candidates; i++) + { + mode = mode_candidates[i]; + + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + + if (deg_elp[DEG_ELP_IDX(mode, cw_counter)]) + { + if (rs16_factorize_elp(err_pos + ERR_POS_IDX(mode, cw_counter), elp + ELP_IDX(mode, cw_counter), + deg_elp[DEG_ELP_IDX(mode, cw_counter)], codeword_length - 1)) + { + /* elp did not split into distinct linear factors or error position was out of range */ + mode = -1; + break; + } + } + } + if (mode > 0) + { + /* decodable mode with lowest risk has been found */ + break; + } + } + + if (mode < 0) + { + /* no decodable mode has been found */ + *error_report = ERROR_REPORT_BEC_MASK; + *bfi = 1; + mode = -1; + + *epmr = fec_estimate_epmr_from_cw0(iobuf, t, syndromes, elp, deg_elp, err_pos, err_symb, n_codewords, + n_symb); + + + rop = mode; + goto CLEANUP; + } + + /* perform error correction */ + cw_offset = 0; + *error_report = 0; + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + + if (deg_elp[DEG_ELP_IDX(mode, cw_counter)]) + { + rs16_calculate_errors( + err_symb + ERR_SYMB_IDX(mode, cw_counter), err_pos + ERR_POS_IDX(mode, cw_counter), + syndromes + SYNDROME_IDX(mode, cw_counter), deg_elp[DEG_ELP_IDX(mode, cw_counter)], t[mode]); + + /* correct errors and sum up number of corrected bits */ + for (i = 0; i < deg_elp[DEG_ELP_IDX(mode, cw_counter)]; i++) + { + iobuf[err_pos[ERR_POS_IDX(mode, cw_counter) + i] + cw_offset] = + GF16_ADD(iobuf[err_pos[ERR_POS_IDX(mode, cw_counter) + i] + cw_offset], + err_symb[ERR_SYMB_IDX(mode, cw_counter) + i]); + *error_report += rs16_bit_count_table[err_symb[ERR_SYMB_IDX(mode, cw_counter) + i]]; + } + + for (i = 0; i < mode; i ++) + { + if(deg_elp[DEG_ELP_IDX(mode, cw_counter)] > i) + { + mode_broken[i] = 1; + } + } + + } + + for (i = 0; i <= EP_SIG_POLY_DEG; i++) + { + iobuf[cw_offset + i] = GF16_ADD(iobuf[cw_offset + i], sig_polys[mode][i]); + } + cw_offset += codeword_length; + } + + /* set epmr according to risk value of cw0 */ + epmr_dec_fail_increment = 8; + + if (risk_table_f[mode][deg_elp[DEG_ELP_IDX(mode, 0)]].exponent <= -8) + { + epmr_dec_fail_increment -= 4; + } + if (risk_table_f[mode][deg_elp[DEG_ELP_IDX(mode, 0)]].exponent <= -16) + { + epmr_dec_fail_increment -= 4; + } + + *epmr = (LC3PLUS_EpModeRequest)(cw0_get_epmr(iobuf, epmr_position) + epmr_dec_fail_increment); + } + + /* mode has been successfully detected -> now check and try to correct remaining code words*/ + *n_pccw = fec_get_n_pccw(n_symb / 2, mode + 1, ccc_flag); + if (ccc_flag == 0) + { + n_pccw0 = fec_get_n_pccw(n_symb / 2, mode + 1, ccc_flag); + *n_pccw = n_pccw0; + } + else + { + n_pccw0 = 0; + } + + for (cw_counter = 6; cw_counter < n_codewords; cw_counter++) + { + /* usual error correction scheme: syndromes -> elp's, errors, etc. */ + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + array_of_trust[n_codewords - 1 - cw_counter] = 1; + + syndr_calc[t[mode] - 1](syndromes, iobuf + cw_offset, codeword_length -1); + + deg_elp[0] = rs16_calculate_elp(elp, syndromes, t[mode]); + + for (i = 0; i < mode; i ++) + { + if (deg_elp[0] > i) + { + mode_broken[i] = 1; + } + } + + if (deg_elp[0] > t[mode]) + { + for (i = 0; i < 4; i ++) + { + mode_broken[i] = 1; + } + cw_offset += codeword_length; + if (cw_counter < n_codewords - n_pccw0) + { + *error_report = ERROR_REPORT_BEC_MASK; + mode = -1; + *bfi = 1; + break; + } + else + { + *bfi = 2; + array_of_trust[n_codewords - 1 - cw_counter] = 0; + continue; + } + } + + if (deg_elp[0]) + { + if (rs16_factorize_elp(err_pos, elp, deg_elp[0], codeword_length - 1)) + { + cw_offset += codeword_length; + for (i = 0; i < 4; i ++) + { + mode_broken[i] = 1; + } + if (cw_counter < n_codewords - n_pccw0) + { + *error_report = ERROR_REPORT_BEC_MASK; + mode = -1; + *bfi = 1; + + break; + } + else + { + *bfi = 2; + array_of_trust[n_codewords - 1 - cw_counter] = 0; + continue; + } + } + + rs16_calculate_errors(err_symb, err_pos, syndromes, deg_elp[0], t[mode]); + + /* correct errors and sum up number of corrected bits */ + for (i = 0; i < deg_elp[0]; i++) + { + iobuf[err_pos[i] + cw_offset] = GF16_ADD(iobuf[err_pos[i] + cw_offset], err_symb[i]); + *error_report += rs16_bit_count_table[err_symb[i]]; + } + } + cw_offset += codeword_length; + if (risk_table_f[mode][deg_elp[0]].exponent > -16) + { + array_of_trust[n_codewords - 1 - cw_counter] = 0; + } + } + + *error_report &= ERROR_REPORT_BEC_MASK; + for (i = 0; i < 4; i ++) + { + if (!mode_broken[i]) + { + *error_report |= error_report_ep_ok[i]; + } + } + + if (mode >= 0) + { + rop = mode + 1; + } else { + rop = -1; + } + + + +CLEANUP: + return rop; +} + +FEC_STATIC void rs16_calculate_six_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg) +{ + LC3_INT32 i; + LC3_UINT8 buffer[15]; + + assert(cw_poly_deg >= 12); + + for (i = 0; i <= cw_poly_deg; i++) + { + buffer[i] = cw[i]; + } + + syndromes[0] = buffer[0]; + syndromes[1] = buffer[0]; + syndromes[2] = buffer[0]; + syndromes[3] = buffer[0]; + syndromes[4] = buffer[0]; + syndromes[5] = buffer[0]; + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[1], 32)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[1], 64)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[1], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[1], 48)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[1], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[1], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[2], 64)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[2], 48)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[2], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[2], 80)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[2], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[2], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[3], 128)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[3], 192)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[3], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[3], 240)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[3], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[3], 128)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[4], 48)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[4], 80)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[4], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[4], 32)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[4], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[4], 160)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[5], 96)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[5], 112)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[5], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[5], 96)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[5], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[5], 16)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[6], 192)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[6], 240)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[6], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[6], 160)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[6], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[6], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[7], 176)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[7], 144)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[7], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[7], 208)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[7], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[7], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[8], 80)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[8], 32)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[8], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[8], 64)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[8], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[8], 128)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[9], 160)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[9], 128)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[9], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[9], 192)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[9], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[9], 160)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[10], 112)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[10], 96)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[10], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[10], 112)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[10], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[10], 16)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[11], 224)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[11], 176)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[11], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[11], 144)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[11], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[11], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[12], 240)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[12], 160)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[12], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[12], 128)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[12], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[12], 240)); + + if (cw_poly_deg >= 13) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[13], 208)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[13], 224)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[13], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[13], 176)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[13], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[13], 128)); + } + + if (cw_poly_deg >= 14) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[14], 144)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[14], 208)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[14], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[14], 224)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[14], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[14], 160)); + } + + +} + +FEC_STATIC void rs16_calculate_four_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg) +{ + LC3_INT32 i; + LC3_UINT8 buffer[15]; + + assert(cw_poly_deg >= 12); + + for (i = 0; i <= cw_poly_deg; i++) + { + buffer[i] = cw[i]; + } + + syndromes[0] = buffer[0]; + syndromes[1] = buffer[0]; + syndromes[2] = buffer[0]; + syndromes[3] = buffer[0]; + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[1], 32)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[1], 64)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[1], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[1], 48)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[2], 64)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[2], 48)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[2], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[2], 80)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[3], 128)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[3], 192)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[3], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[3], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[4], 48)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[4], 80)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[4], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[4], 32)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[5], 96)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[5], 112)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[5], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[5], 96)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[6], 192)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[6], 240)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[6], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[6], 160)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[7], 176)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[7], 144)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[7], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[7], 208)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[8], 80)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[8], 32)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[8], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[8], 64)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[9], 160)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[9], 128)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[9], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[9], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[10], 112)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[10], 96)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[10], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[10], 112)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[11], 224)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[11], 176)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[11], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[11], 144)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[12], 240)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[12], 160)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[12], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[12], 128)); + + if (cw_poly_deg >= 13) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[13], 208)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[13], 224)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[13], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[13], 176)); + } + + if (cw_poly_deg >= 14) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[14], 144)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[14], 208)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[14], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[14], 224)); + } + + +} + +FEC_STATIC void rs16_calculate_two_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg) +{ + LC3_INT32 i; + LC3_UINT8 buffer[15]; + + assert(cw_poly_deg >= 12); + + for (i = 0; i <= cw_poly_deg; i++) + { + buffer[i] = cw[i]; + } + + syndromes[0] = buffer[0]; + syndromes[1] = buffer[0]; + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[1], 32)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[1], 64)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[2], 64)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[2], 48)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[3], 128)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[3], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[4], 48)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[4], 80)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[5], 96)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[5], 112)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[6], 192)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[6], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[7], 176)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[7], 144)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[8], 80)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[8], 32)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[9], 160)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[9], 128)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[10], 112)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[10], 96)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[11], 224)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[11], 176)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[12], 240)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[12], 160)); + + if (cw_poly_deg >= 13) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[13], 208)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[13], 224)); + } + + if (cw_poly_deg >= 14) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[14], 144)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[14], 208)); + } + + +} + +FEC_STATIC LC3_INT8 rs16_calculate_elp(LC3_UINT8 *elp, LC3_UINT8 *syndromes, LC3_INT16 t) +/* calculates error locator polynomial vie Petterson's algorithm */ +{ + LC3_INT8 ret; + LC3_UINT8 det, det_inv, aux, all_s, *s; + LC3_UINT8 s22, s33, s44, s13, s14, s15; + LC3_UINT8 s23, s24, s25, s34, s35; + LC3_UINT8 a, b, c, d, e, f; + + ret = 0; + all_s = 0; + s = syndromes; + elp[0] = 1; + memset(elp + 1, 0, 3); + + switch (t) + { + case 3: + { + /* check for errors */ + all_s = s[0] | s[1] | s[2] | s[3] | s[4] | s[5]; + + if (all_s == 0) + { + break; + } + + /* assume 3 errors */ + s22 = GF16_MUL(s[1], s[1]); + s33 = GF16_MUL(s[2], s[2]); + s44 = GF16_MUL(s[3], s[3]); + s13 = GF16_MUL(s[0], s[2]); + + det = GF16_ADD(GF16_ADD(GF16_MUL(s13, s[4]), GF16_MUL(s44, s[0])), + GF16_ADD(GF16_MUL(s22, s[4]), GF16_MUL(s33, s[2]))); + + if (det) + { + det_inv = gf16_inv_table[det] << 4; + + s14 = GF16_MUL(s[0], s[3]); + s15 = GF16_MUL(s[0], s[4]); + + s23 = GF16_MUL(s[1], s[2]); + s24 = GF16_MUL(s[1], s[3]); + s25 = GF16_MUL(s[1], s[4]); + + s34 = GF16_MUL(s[2], s[3]); + s35 = GF16_MUL(s[2], s[4]); + + a = GF16_ADD(s35, s44) << 4; + b = GF16_ADD(s15, s33) << 4; + c = GF16_ADD(s13, s22) << 4; + d = GF16_ADD(s34, s25) << 4; + e = GF16_ADD(s23, s14) << 4; + f = GF16_ADD(s24, s33) << 4; + + aux = GF16_ADD(GF16_ADD(GF16_MUL0(a, s[3]), GF16_MUL0(d, s[4])), GF16_MUL0(f, s[5])); + elp[3] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_ADD(GF16_MUL0(d, s[3]), GF16_MUL0(b, s[4])), GF16_MUL0(e, s[5])); + elp[2] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_ADD(GF16_MUL0(f, s[3]), GF16_MUL0(e, s[4])), GF16_MUL0(c, s[5])); + elp[1] = GF16_MUL0(aux, det_inv); + + if (elp[3] == 0) + { + ret = t+1; + } + else + { + ret = 3; + } + break; + } + + /* assume two errors */ + det = GF16_ADD(GF16_MUL(syndromes[0], syndromes[2]), GF16_MUL(syndromes[1], syndromes[1])); + + if (det) + { + det_inv = gf16_inv_table[det] << 4; + + aux = GF16_ADD(GF16_MUL(syndromes[1], syndromes[2]), GF16_MUL(syndromes[0], syndromes[3])); + elp[1] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_MUL(syndromes[2], syndromes[2]), GF16_MUL(syndromes[1], syndromes[3])); + elp[2] = GF16_MUL0(aux, det_inv); + + /* check remaining LSF relations */ + aux = GF16_ADD(GF16_ADD(GF16_MUL(elp[2], s[2]), GF16_MUL(elp[1], s[3])), s[4]) + | GF16_ADD(GF16_ADD(GF16_MUL(elp[2], s[3]), GF16_MUL(elp[1], s[4])), s[5]); + + aux |= elp[2] == 0; + + if (aux != 0) + { + ret = t + 1; + } + else + { + ret = 2; + } + break; + } + + /* assume one error */ + if (syndromes[0] != 0) + { + elp[1] = GF16_MUL(syndromes[1], gf16_inv_table[syndromes[0]]); + + /* check remaining LSF relations */ + aux = GF16_ADD(GF16_MUL(elp[1], s[1]), s[2]) + | GF16_ADD(GF16_MUL(elp[1], s[2]), s[3]) + | GF16_ADD(GF16_MUL(elp[1], s[3]), s[4]) + | GF16_ADD(GF16_MUL(elp[1], s[4]), s[5]); + + aux |= elp[1] == 0; + + if (aux != 0) + { + ret = t + 1; + } + else + { + ret = 1; + } + break; + } + + ret = t + 1; + break; + } + case 2: + { + all_s = s[0] | s[1] | s[2] | s[3]; + + if (all_s == 0) + { + break; + } + + /* assume two errors */ + det = GF16_ADD(GF16_MUL(syndromes[0], syndromes[2]), GF16_MUL(syndromes[1], syndromes[1])); + + if (det) + { + det_inv = gf16_inv_table[det] << 4; + + aux = GF16_ADD(GF16_MUL(syndromes[1], syndromes[2]), GF16_MUL(syndromes[0], syndromes[3])); + elp[1] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_MUL(syndromes[2], syndromes[2]), GF16_MUL(syndromes[1], syndromes[3])); + elp[2] = GF16_MUL0(aux, det_inv); + + if (elp[2] == 0) + { + ret = t + 1; + } + else + { + ret = 2; + } + break; + } + + /* assume one error */ + if (syndromes[0] != 0) + { + elp[1] = GF16_MUL(syndromes[1], gf16_inv_table[syndromes[0]]); + + /* check remaining LSF relation */ + aux = GF16_ADD(GF16_MUL(elp[1], s[1]), s[2]) | GF16_ADD(GF16_MUL(elp[1], s[2]), s[3]); + aux |= elp[1] == 0; + + if (aux != 0) + { + ret = t + 1; + } + else + { + ret = 1; + } + break; + } + + ret = t + 1; + break; + } + case 1: + { + all_s = s[0] | s[1]; + + if (all_s == 0) + { + break; + } + + if (syndromes[0] != 0) + { + elp[1] = GF16_MUL(syndromes[1], gf16_inv_table[syndromes[0]]); + if (elp[1] == 0) + { + ret = t + 1; + } + else + { + ret = 1; + } + break; + } + + ret = t + 1; + break; + } + default: assert(0 && "calculating elp of this degree not implemented"); + } + + + return ret; +} + +FEC_STATIC LC3_INT16 rs16_factorize_elp(LC3_UINT8 *err_pos, LC3_UINT8 *elp, LC3_INT16 deg_elp, LC3_INT16 max_pos) +{ + LC3_UINT8 beta, gamma; + LC3_INT16 zeros, err_pos0, err_pos1, err_pos2, ret; + + beta = 0; + gamma = 0; + zeros = 0; + ret = 0; + + switch (deg_elp) + { + case 0: break; + + case 1: + err_pos0 = gf16_log_g[elp[1]]; + if (err_pos0 > max_pos) + { + ret = 1; + break; + } + + err_pos[0] = (LC3_UINT8)err_pos0; + break; + + case 2: + zeros = rs16_elp_deg2_table[elp[1] | (elp[2] << 4)]; + if (zeros == 0) + { + + return 1; + } + + err_pos0 = zeros & 15; + err_pos1 = (zeros >> 4) & 15; + + if (err_pos0 > max_pos || err_pos1 > max_pos) + { + ret = 1; + break; + } + + err_pos[0] = (LC3_UINT8)err_pos0; + err_pos[1] = (LC3_UINT8)err_pos1; + break; + + case 3: + /* beta = a*a + b, gamma = a*b + c */ + beta = GF16_ADD(GF16_MUL(elp[1], elp[1]), elp[2]); + gamma = GF16_ADD(GF16_MUL(elp[1], elp[2]), elp[3]); + zeros = rs16_elp_deg3_table[beta | gamma << 4]; + + if (zeros == 0) + /* elp does not split over GF(16) or has multiple zeros */ + { + ret = 1; + break; + } + + /* remove shift from zeros */ + err_pos0 = GF16_ADD(zeros & 15, elp[1]); + err_pos1 = GF16_ADD((zeros >> 4) & 15, elp[1]); + err_pos2 = GF16_ADD((zeros >> 8) & 15, elp[1]); + + if (err_pos0 == 0 || err_pos1 == 0 || err_pos2 == 0) + { + + return 1; + } + + err_pos0 = gf16_log_g[err_pos0]; + err_pos1 = gf16_log_g[err_pos1]; + err_pos2 = gf16_log_g[err_pos2]; + + if (err_pos0 > max_pos || err_pos1 > max_pos || err_pos2 > max_pos) + { + ret = 1; + break; + } + + err_pos[0] = (LC3_UINT8)err_pos0; + err_pos[1] = (LC3_UINT8)err_pos1; + err_pos[2] = (LC3_UINT8)err_pos2; + + break; + + default: assert(0 && "invalid degree in rs16_error_locator"); + } + + + return ret; +} + +FEC_STATIC void rs16_calculate_errors(LC3_UINT8 *err_symb, LC3_UINT8 *err_pos, LC3_UINT8 *syndromes, LC3_INT8 deg_elp, LC3_INT8 t) +{ + LC3_UINT8 det_inv; + LC3_UINT8 x0, x1, x2; + LC3_UINT8 x0sq, x1sq, x2sq; + LC3_UINT8 c0, c1, c2; + LC3_UINT8 s0, s1, s2; + LC3_UINT8 tmp; + + UNUSED(t); + + assert(deg_elp <= t); + + switch (deg_elp) + { + case 0: break; + + case 1: + err_symb[0] = GF16_MUL(gf16_g_pow[15 - err_pos[0]], syndromes[0]); + + break; + + case 2: + s0 = (LC3_UINT8) (syndromes[0] << 4); + s1 = (LC3_UINT8) (syndromes[1] << 4); + + x0 = gf16_g_pow[err_pos[0]]; + x1 = gf16_g_pow[err_pos[1]]; + + x0sq = GF16_MUL(x0, x0); + x1sq = GF16_MUL(x1, x1); + + tmp = GF16_ADD(GF16_MUL(x0sq, x1), GF16_MUL(x1sq, x0)); + det_inv = gf16_inv_table[tmp] << 4; + + tmp = GF16_ADD(GF16_MUL0(x1sq, s0), GF16_MUL0(x1, s1)); + err_symb[0] = GF16_MUL0(tmp, det_inv); + + tmp = GF16_ADD(GF16_MUL0(x0sq, s0), GF16_MUL0(x0, s1)); + err_symb[1] = GF16_MUL0(tmp, det_inv); + + break; + + case 3: + s0 = syndromes[0] << 4; + s1 = syndromes[1] << 4; + s2 = syndromes[2] << 4; + + x0 = gf16_g_pow[err_pos[0]]; + x1 = gf16_g_pow[err_pos[1]]; + x2 = gf16_g_pow[err_pos[2]]; + + x0sq = GF16_MUL(x0, x0); + x1sq = GF16_MUL(x1, x1); + x2sq = GF16_MUL(x2, x2); + + tmp = GF16_MUL(GF16_ADD(x1, x0), GF16_ADD(x2, x0)); + tmp = GF16_MUL(GF16_ADD(x2, x1), tmp); + det_inv = gf16_inv_table[tmp] << 4; + + c0 = GF16_ADD(GF16_MUL(x1, x2sq), GF16_MUL(x2, x1sq)); + c1 = GF16_ADD(x2sq, x1sq); + c2 = GF16_ADD(x2, x1); + + err_symb[0] = GF16_ADD(GF16_ADD(GF16_MUL0(c0, s0), GF16_MUL0(c1, s1)), GF16_MUL0(c2, s2)); + + c0 = GF16_ADD(GF16_MUL(x0, x2sq), GF16_MUL(x2, x0sq)); + c1 = GF16_ADD(x2sq, x0sq); + c2 = GF16_ADD(x2, x0); + + err_symb[1] = GF16_ADD(GF16_ADD(GF16_MUL0(c0, s0), GF16_MUL0(c1, s1)), GF16_MUL0(c2, s2)); + + c0 = GF16_ADD(GF16_MUL(x0, x1sq), GF16_MUL(x1, x0sq)); + c1 = GF16_ADD(x1sq, x0sq); + c2 = GF16_ADD(x1, x0); + + err_symb[2] = GF16_ADD(GF16_ADD(GF16_MUL0(c0, s0), GF16_MUL0(c1, s1)), GF16_MUL0(c2, s2)); + + tmp = GF16_MUL0(err_symb[0], det_inv); + err_symb[0] = GF16_MUL(tmp, gf16_inv_table[x0]); + + tmp = GF16_MUL0(err_symb[1], det_inv); + err_symb[1] = GF16_MUL(tmp, gf16_inv_table[x1]); + + tmp = GF16_MUL0(err_symb[2], det_inv); + err_symb[2] = GF16_MUL(tmp, gf16_inv_table[x2]); + + break; + + default: assert(0 && "method not implemented\n"); break; + } + + +} + +/* hash functions for data validation */ + +/* hamming distance 4 */ +static const LC3_UINT32 crc14_mask[16] = {0, 17989, 35978, 51919, 71956, 89937, 103838, 119771, + 143912, 160877, 179874, 194791, 207676, 224633, 239542, 254451}; + +/* hamming distance 4 */ +static const LC3_UINT32 crc22_mask[16] = {0, 4788009, 9576018, 14356859, 19152036, 23933837, 28713718, 33500639, + 33650273, 38304072, 43214899, 47867674, 52775621, 57427436, 62346391, 67001278}; + +FEC_STATIC LC3_INT16 crc1(LC3_UINT8 *data, LC3_INT16 data_size, LC3_INT16 epmr, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check) +{ + LC3_UINT32 const *mask; + LC3_INT32 shift, i, fail; + LC3_UINT32 rem; + + fail = 0; + rem = 0; + + assert(hash_size > 0); + + switch (hash_size) + { + case 2: + shift = 14; + mask = crc14_mask; + break; + case 3: + shift = 22; + mask = crc22_mask; + break; + default: + shift = 0; + mask = 0; + assert(0 && "crc hash size not implemented"); + } + + /* data array contains 4-bit words */ + for (i = data_size - 1; i >= 0; i--) + { + rem = (rem << 4) ^ data[i]; + rem ^= mask[(rem >> shift) & 15]; + } + + rem = (rem << 4) ^ (epmr << 2); + rem ^= mask[(rem >> shift) & 15]; + + for (i = 0; i < 2 * hash_size - 1; i++) + { + rem <<= 4; + rem ^= mask[(rem >> shift) & 15]; + } + + rem ^= ((LC3_UINT32) epmr) << shift; + + if (check) + { + /* test hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + fail |= hash_val[i] ^ ((rem >> (4*i)) & 15); + } + } + else + { + /* write hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + hash_val[i] = (LC3_UINT8) ((rem >> (4*i)) & 15); + } + } + + + return fail; +} + +/* hamming distance = 4 */ +static const LC3_UINT32 crc16_mask[16] = {0, 107243, 190269, 214486, 289937, 380538, 428972, 469319, + 579874, 621513, 671263, 761076, 832947, 857944, 938638, 1044581}; + +FEC_STATIC LC3_INT16 crc2(LC3_UINT8 *data, LC3_INT16 data_size, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check) +{ + LC3_UINT32 const *mask; + LC3_INT32 shift, i, fail; + LC3_UINT32 rem; + + fail = 0; + rem = 0; + + assert(hash_size > 0); + + switch (hash_size) + { + case 2: + shift = 16; + mask = crc16_mask; + break; + default: + shift = 0; + mask = 0; + assert(0 && "crc hash size not implemented"); + } + + /* data array contains 4-bit words */ + for (i = data_size - 1; i >= 0; i--) + { + rem = (rem << 4) ^ data[i]; + rem ^= mask[(rem >> shift) & 15]; + } + + for (i = 0; i < 2 * hash_size; i++) + { + rem <<= 4; + rem ^= mask[(rem >> shift) & 15]; + } + + if (check) + { + /* test hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + fail |= hash_val[i] ^ ((rem >> (4*i)) & 15); + } + } + else + { + /* write hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + hash_val[i] = (LC3_UINT8) ((rem >> (4*i)) & 15); + } + } + + + return fail; +} + +/* simple float implementation */ +FEC_STATIC simple_float simple_float_mul(simple_float op1, simple_float op2) +{ + simple_float rop; + LC3_INT32 aux; + + aux = (op1.mantissa * op2.mantissa) >> 14; + rop.exponent = op1.exponent + op2.exponent; + if (aux & 32768L) + { + aux >>= 1; + rop.exponent ++; + } + rop.mantissa = (LC3_INT16) aux; + + + return rop; +} + +/* Auxiliary */ + +FEC_STATIC LC3_INT16 simple_float_cmp(simple_float op1, simple_float op2) +/* returns 1 if op1 > op2, 0 if op1 = op2, and -1 if op1 < op2 */ +{ + LC3_INT16 rval; + LC3_INT16 mdiff; + LC3_INT16 ediff; + + rval = 0; + + ediff = op1.exponent - op2.exponent; + mdiff = (LC3_INT16) op1.mantissa - (LC3_INT16) op2.mantissa; + + if (ediff == 0) + { + if (mdiff > 0) + { + rval = 1; + } + if (mdiff < 0) + { + rval = -1; + } + } + else + { + if (ediff > 0) + { + rval = 1; + } + if (ediff < 0) + { + rval = -1; + } + } + + + return rval; +} + diff --git a/lc3plus/apply_global_gain.c b/lc3plus/apply_global_gain.c new file mode 100755 index 0000000000..c67432e2c3 --- /dev/null +++ b/lc3plus/apply_global_gain.c @@ -0,0 +1,21 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) +{ + LC3_FLOAT gg = 0; + + gg = LC3_POW(10, (LC3_FLOAT)(global_gain_idx + global_gain_off) / 28); + + mult_const(x, gg, xLen); +} diff --git a/lc3plus/ari_codec.c b/lc3plus/ari_codec.c new file mode 100755 index 0000000000..80c75fcf0c --- /dev/null +++ b/lc3plus/ari_codec.c @@ -0,0 +1,1122 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void ac_shift_fl(Encoder_State_fl* st); +static void ac_encode_fl(Encoder_State_fl* st, LC3_INT sym_freq, LC3_INT cum_freq); +static void tns_order_freq_enc(LC3_INT enable_lpc_weighting, LC3_INT order, LC3_INT* symfreq, LC3_INT* cumfreq); +static void tns_coef_freq_enc(LC3_INT k, LC3_INT idx, LC3_INT* symfreq, LC3_INT* cumfreq); +static void ac_freq_fl(LC3_INT pki, LC3_INT s, LC3_INT* symfreq, LC3_INT* cumfreq); +static void ac_finalize_fl(Encoder_State_fl* st); +static void write_uint_forward_fl(Encoder_State_fl* st, LC3_INT val, LC3_INT numbits); +static void ari_enc_init(Encoder_State_fl* st, LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side); +static LC3_INT sign(LC3_INT x); +static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left); +static void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); +static void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); +static void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); +static LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); +static void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); +static void findNonZero(LC3_INT* in, LC3_INT* out, LC3_INT len, LC3_INT* outLen); +static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side); +static void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed); + +void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed) +{ + LC3_INT k = 0; + + *nf_seed = 0; + + for (k = 0; k < L_spec; k++) { + *nf_seed = *nf_seed + (abs(x[k]) & 32767) * k; + } + *nf_seed = *nf_seed & 65535; + + if (*nf_seed >= 32768) { + *nf_seed = *nf_seed - 65536; + } +} + +static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side) +{ + LC3_INT32 bp_local, bp_side_local, offset; + + if (st_fl->pc_bytes > 0) + { + if (!from_left && mask_side != 1) + { + return; + } + + if (st_fl->pc_c_bp_side > 0 && *bp_side < 0) + { + assert(mask_side == 1); + assert(st_fl->pc_b_right != -1); + *bp_side = st_fl->pc_b_right; + return; + } + + bp_local = *bp; + bp_side_local = *bp_side; + + if (from_left) + { + if (mask_side == 1) + { + bp_side_local = bp_side_local + 1; + } + } else { + bp_local = bp_local - 1; + } + + if (st_fl->pc_b_right == -1) + { + offset = -1; + if (!st_fl->pc_enc) + { + offset = offset + st_fl->pc_bytes; + } + + if ((bp_side_local + offset - bp_local) == st_fl->pc_bytes) + { + st_fl->pc_b_left = bp_local + 1; + st_fl->pc_b_right = bp_side_local - 1; + + if (st_fl->pc_enc) + { + st_fl->pc_return = 1; + return; + } + } + } + + if (!st_fl->pc_enc && st_fl->pc_b_right > -1) + { + if (from_left && *bp == st_fl->pc_b_left) + { + *bp = 0; + st_fl->pc_c_bp = 1; + } + + if (!from_left && bp_side_local == st_fl->pc_b_right) + { + *bp_side = st_fl->pc_bytes - 1; + st_fl->pc_c_bp_side = 1; + } + + if (st_fl->pc_bfi == 2) + { + + if ((st_fl->pc_c_bp && (*bp + 1) >= st_fl->pc_be_bp_left) || (st_fl->pc_c_bp_side && (*bp_side + 1) <= st_fl->pc_be_bp_right)) + { + st_fl->pc_bbi = 2; + } else if ((st_fl->pc_c_bp && *bp >= 0) || (st_fl->pc_c_bp_side && *bp_side <= (st_fl->pc_bytes - 1))) + { + st_fl->pc_bbi = 1; + } + } + } + } + + return; +} + + +void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) +{ + LC3_INT i = 0; + + if (!st_fl->pc_enc) + { + *bp = *bp + st_fl->pc_bytes; + } + + st_fl->ac_low_fl = 0; + + st_fl->ac_range_fl = (LC3_UINT32)pow(2, 24) - (LC3_UINT32)1; + for (i = 0; i < 3; i++) { + pc_check_bytes(bp, st_fl, from_left, mask_side, bp_side); + + st_fl->ac_low_fl = (st_fl->ac_low_fl << 8) + (LC3_UINT32)ptr[*bp]; + *bp = *bp + 1; + } + + st_fl->BER_detect = 0; +} + +void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) +{ + LC3_INT i = 0, j = 0; + + *numsym = 8; + + j = 0; + for (i = 1; i < 9; i++) { + symfreq[j] = ari_tns_order_cf[enable_lpc_weighting][i]; + j++; + } + + for (i = 0; i < *numsym; i++) { + symfreq[i] -= ari_tns_order_cf[enable_lpc_weighting][i]; + } + + for (i = 0; i < *numsym; i++) { + cumfreq[i] = ari_tns_order_cf[enable_lpc_weighting][i]; + } +} + +/* Returns val */ +LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) +{ + LC3_INT val = 0, tmp = 0; + + + tmp = st->ac_range_fl >> 10; + + if (st->ac_low_fl >= (LC3_UINT32)(tmp << 10)) { + st->BER_detect = 1; + } + + val = num_sym - 1; + + while (st->ac_low_fl < (LC3_UINT32)(tmp * cum_freq[val])) { + val--; + } + + st->ac_low_fl = st->ac_low_fl - tmp * cum_freq[val]; + st->ac_range_fl = tmp * sym_freq[val]; + + while (st->ac_range_fl < pow(2, 16)) { + st->ac_low_fl = st->ac_low_fl << 8; + st->ac_low_fl = ((LC3_INT)st->ac_low_fl) & ((LC3_INT)(pow(2, 24) - 1)); + + pc_check_bytes(bp, st, from_left, mask_side, bp_side); + + st->ac_low_fl = st->ac_low_fl + ptr[*bp]; + *bp = *bp + 1; + st->ac_range_fl = st->ac_range_fl << 8; + } + + return val; +} + +void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) +{ + LC3_INT i = 0, j = 0; + + *numsym = 18 - 1; + + j = 0; + for (i = 1; i <= *numsym; i++) { + symfreq[j] = ari_tns_freq_cf[k][i]; + j++; + } + + for (i = 0; i < *numsym; i++) { + symfreq[i] -= ari_tns_freq_cf[k][i]; + } + + for (i = 0; i < *numsym; i++) { + cumfreq[i] = ari_tns_freq_cf[k][i]; + } +} + +void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) +{ + LC3_INT i = 0, j = 0; + + *numsym = 18 - 1; + + j = 0; + for (i = 1; i <= *numsym; i++) { + symfreq[j] = ari_spec_cumfreq_fl[pki][i]; + j++; + } + + for (i = 0; i < *numsym; i++) { + symfreq[i] -= ari_spec_cumfreq_fl[pki][i]; + } + + for (i = 0; i < *numsym; i++) { + cumfreq[i] = ari_spec_cumfreq_fl[pki][i]; + } +} + +void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left) +{ + *bit = 0; + + UNUSED(bp); + UNUSED(st_fl); + UNUSED(from_left); + + if (ptr[*bp_side] & *mask_side) { + *bit = 1; + } else { + *bit = 0; + } + + if (*mask_side == 128) { + *mask_side = 1; + *bp_side = *bp_side - 1; + } else { + *mask_side = *mask_side * 2; + } +} + +void findNonZero(LC3_INT* in, LC3_INT* out, LC3_INT len, LC3_INT* outLen) +{ + LC3_INT i = 0, j = 0; + + for (i = 0; i < len; i++) { + if (in[i] != 0) { + out[j] = i; + j++; + } + } + + *outLen = j; +} + +void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting, + LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx, + LC3_INT gg_idx, uint8_t * resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes, + LC3_INT* nbits_residual, LC3_INT* residualPresent, LC3_INT frame_dms, + LC3_INT32 n_pc, LC3_INT32 be_bp_left, LC3_INT32 be_bp_right, LC3_INT32 enc, LC3_INT32 *b_left, LC3_INT32 *spec_inv_idx, + LC3_INT hrmode +) +{ + Decoder_State_fl st; + LC3_INT a = 0, b = 0, t = 0, bp = 0; + LC3_INT c = 0; + LC3_INT nbits_side = 0, extra_bits = 0; + LC3_UINT8* ptr = NULL; + LC3_INT n = 0, k = 0, lev = 0; + LC3_INT max_lev = 0, tmp = 0; + LC3_INT sym_freq[MAX_LEN] = {0}, cum_freq[MAX_LEN] = {0}, numsym = 0, bit = 0, lev1 = 0, pki = 0, sym = 0, + save_lev[MAX_LEN] = {0}, idx_len = 0, total_bits = 0, nbits_ari = 0, idx[MAX_LEN] = {0}, rateFlag = 0; + + total_bits = 8 * numbytes; + + memset(&st, 0, sizeof(st)); + + + st.pc_bytes = (n_pc + 1) >> 1; + st.pc_b_left = numbytes + 1; + st.pc_b_right = -1; + st.pc_enc = enc; + st.pc_bfi = *bfi; + st.pc_be_bp_left = floor(be_bp_left / 8); + st.pc_be_bp_right = floor(be_bp_right / 8) - 1; + *spec_inv_idx = L_spec + 1; + assert(st.pc_be_bp_right < st.pc_bytes || st.pc_bytes == 0); + + /* Rate flag */ + if (fs_idx != 5) + { + if (total_bits > (160 + fs_idx * 160)) { + rateFlag = 512; + } + } + + /* Init */ + c = 0; + t = 0; + bp = 0; + + *b_left = -1; + + ptr = bytes; + + /* Start Decoding */ + ac_dec_init_fl(ptr, &bp, &st, 1, mask_side, &bp_side); + + /* Decode TNS data */ + tmp = MAXLAG; + if (frame_dms == 25) + { + tmp /= 2; + } + if (frame_dms == 50) + { + tmp /= 2; + } + + /* Decode TNS data */ + for (n = 0; n < tns_numfilters; n++) { + + if (tns_order[n] > 0) { + tns_order_freq(enable_lpc_weighting, sym_freq, cum_freq, &numsym); + + tns_order[n] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + tns_order[n] = tns_order[n] + 1; + + if (tns_order[n] > tmp) + { + st.BER_detect = 1; + } + + if (st.pc_bbi == 1) + { + spec_inv_idx = 0; + } else if (st.pc_bbi == 2) + { + st.BER_detect = 1; + } + + for (k = 0; k < tns_order[n]; k++) { + if (bp_side < bp) + { + *bfi = 1; + return; + } + + tns_coef_freq(k, sym_freq, cum_freq, &numsym); + tns_idx[n * 8 + k] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 1) + { + spec_inv_idx = 0; + } else if (st.pc_bbi == 2) + { + st.BER_detect = 1; + } + } + } + } + + if (st.BER_detect > 0) { + *bfi = 1; + return; + } + + /* Spectral data */ + for (k = 0; k < lastnz; k = k + 2) { + /* Context */ + t = c + rateFlag; + + if (k > L_spec / 2) { + t = t + 256; + } + + /* Decode amplitude */ + x[k] = 0; + x[k + 1] = 0; + + if (hrmode == 1) { + max_lev = 13 + 8; + } else { + max_lev = 13; + } + + for (lev = 0; lev <= max_lev; lev++) { + lev1 = MIN(lev, 3); + pki = ari_spec_lookup_fl[t + lev1 * 1024]; + ac_freq(pki, sym_freq, cum_freq, &numsym); + sym = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 1) + { + *spec_inv_idx = MIN(*spec_inv_idx, k); + } else if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + if (sym < 16) { + break; + } + + if (lsbMode == 0 || lev > 0) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + x[k] = x[k] + (bit << lev); + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + x[k + 1] = x[k + 1] + (bit << lev); + } + } + + if ((lev - 1) == 13 && sym == 16) + { + st.BER_detect = 1; + } + + if (hrmode == 0) { + lev = MIN(lev, 13); + } + + if (lsbMode == 1) { + save_lev[k] = lev; + } + + a = sym & 3; + b = sym >> 2; + + x[k] = x[k] + (a << lev); + x[k + 1] = x[k + 1] + (b << lev); + + /* Decode signs */ + if (x[k] > 0) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + if (bit == 1) { + x[k] = -x[k]; + } + } + + if (x[k + 1] > 0) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k + 1; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + if (bit == 1) { + x[k + 1] = -x[k + 1]; + } + } + + /* Context */ + lev1 = MIN(lev, 3); + if (lev1 <= 1) { + t = 1 + (a + b) * (lev1 + 1); + } else { + t = 12 + lev1; + } + + c = (c & 15) * 16 + t; + + if (((bp - bp_side) > 3 && (st.pc_c_bp == st.pc_c_bp_side))) { + + if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) + { + *bfi = 2; + calculate_nfseed(x, k, nf_seed); + return; + } + + *bfi = 1; + return; + } + + if (st.BER_detect > 0) + { + if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) + { + *bfi = 2; + calculate_nfseed(x, k, nf_seed); + return; + } + + *bfi = 1; + return; + } + } + + /* Residual bits */ + nbits_side = total_bits - (8 * bp_side + 8 - (31 - clz_func(mask_side))); + nbits_ari = (bp - 3) * 8; + extra_bits = 25 - (31 - clz_func(st.ac_range_fl)); + + if (enc == 0) + { + if (st.pc_c_bp == 0) + { + nbits_ari = (bp - st.pc_bytes - 3) * 8; + } else { + nbits_ari = (bp + st.pc_b_left - st.pc_bytes - 3) * 8; + } + + if (st.pc_c_bp_side != 0) + { + nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side)); + } + } + + + *nbits_residual = total_bits - (nbits_side + nbits_ari + extra_bits); + + if (*nbits_residual < 0) { + if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) + { + *bfi = 2; + calculate_nfseed(x, k, nf_seed); + return; + } + + *bfi = 1; + return; + } + + if (lsbMode == 0) { + findNonZero(x, idx, L_spec, &idx_len); + if (hrmode) + { + idx_len *= EXT_RES_ITER_MAX; + } + *nbits_residual = MIN(*nbits_residual, idx_len); + *residualPresent = 1; + + memset(resBits, 0, MAX_RESBITS_LEN); + + for (k = 0; k < *nbits_residual; k++) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &tmp, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(uint8_t) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + resBits[k >> 3] |= tmp << (k & 7); + } + } else { + for (k = 0; k < lastnz; k = k + 2) { + if (save_lev[k] > 0) { + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 1) { + if (x[k] > 0) { + x[k] = x[k] + 1; + } else if (x[k] < 0) { + x[k] = x[k] - 1; + } else { + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 0) { + x[k] = 1; + } else { + x[k] = -1; + } + } + } + + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 1) { + if (x[k + 1] > 0) { + x[k + 1] = x[k + 1] + 1; + } else if (x[k + 1] < 0) { + x[k + 1] = x[k + 1] - 1; + } else { + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 0) { + x[k + 1] = 1; + } else { + x[k + 1] = -1; + } + } + } + } + } + } + + /* Noise-filling seed */ + calculate_nfseed(x, L_spec, nf_seed); + + /* Zero frame flag */ + if (lastnz == 2 && x[0] == 0 && x[1] == 0 && gg_idx == 0 && fac_ns_idx == 7) { + *zero_frame = 1; + } else { + *zero_frame = 0; + } + + if (enc) + { + if (st.pc_bytes > 0) + { + if (st.pc_b_left > numbytes) + { + *b_left = bp_side - st.pc_bytes; + } + } + } + + if ((*bfi == 2) && (*spec_inv_idx == (L_spec + 1))) + { + *bfi = 0; + } + + *spec_inv_idx = *spec_inv_idx - 1; +} + +void ac_encode_fl(Encoder_State_fl* st, LC3_INT sym_freq, LC3_INT cum_freq) +{ + LC3_INT r = 0; + + r = st->range >> 10; + st->low = st->low + r * cum_freq; + + if ((st->low >> 24) == 1) { + st->carry = 1; + } + + st->low = (st->low) & ((LC3_INT)pow(2, 24) - 1); + st->range = r * sym_freq; + + while (st->range < (LC3_INT)pow(2, 16)) { + st->range = st->range << 8; + ac_shift_fl(st); + } +} + +void ac_shift_fl(Encoder_State_fl* st) +{ + if (st->low < 16711680 || st->carry == 1) { + if (st->cache >= 0) { + st->ptr[st->bp] = st->cache + st->carry; + st->bp = st->bp + 1; + } + + while (st->carry_count > 0) { + st->ptr[st->bp] = (st->carry + 255) & 255; + st->bp = st->bp + 1; + st->carry_count = st->carry_count - 1; + } + + st->cache = st->low >> 16; + st->carry = 0; + } else { + st->carry_count = st->carry_count + 1; + } + + st->low = st->low << 8; + st->low = (st->low) & ((LC3_INT)pow(2, 24) - 1); +} + +void tns_order_freq_enc(LC3_INT enable_lpc_weighting, LC3_INT order, LC3_INT* symfreq, LC3_INT* cumfreq) +{ + *symfreq = tns_freq_cf[enable_lpc_weighting][order] - tns_freq_cf[enable_lpc_weighting][order - 1]; + *cumfreq = tns_freq_cf[enable_lpc_weighting][order - 1]; +} + +void tns_coef_freq_enc(LC3_INT k, LC3_INT idx, LC3_INT* symfreq, LC3_INT* cumfreq) +{ + *symfreq = tns_cf[k][idx + 1] - tns_cf[k][idx]; + *cumfreq = tns_cf[k][idx]; +} + +void ac_freq_fl(LC3_INT pki, LC3_INT s, LC3_INT* symfreq, LC3_INT* cumfreq) +{ + *symfreq = ari_spec_cumfreq_fl[pki][s + 1] - ari_spec_cumfreq_fl[pki][s]; + *cumfreq = ari_spec_cumfreq_fl[pki][s]; +} + +void ac_finalize_fl(Encoder_State_fl* st) +{ + LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0; + + bits = 24 - floor(LC3_LOGTWO(st->range)); + mask = ((LC3_INT)pow(2, 24) - 1) >> bits; + val = st->low + mask; + over1 = val >> 24; + + val = (val) & ((LC3_INT)pow(2, 24) - 1); + high = st->low + st->range; + over2 = high >> 24; + high = high & ((LC3_INT)pow(2, 24) - 1); + val = val & (((LC3_INT)pow(2, 24) - 1) - mask); + + if (over1 == over2) { + if (val + mask >= high) { + bits = bits + 1; + mask = mask >> 1; + val = ((st->low + mask) & ((LC3_INT)pow(2, 24) - 1)) & (((LC3_INT)pow(2, 24) - 1) - mask); + } + + if (val < st->low) { + st->carry = 1; + } + } + + st->low = val; + + b = bits; + + if (bits > 8) { + for (; b >= 1; b = b - 8) { + ac_shift_fl(st); + } + } else { + ac_shift_fl(st); + } + + bits = b; + if (bits < 0) { + bits += 8; + } + + if (st->carry_count > 0) { + st->ptr[st->bp] = st->cache; + st->bp = st->bp + 1; + + for (c = st->carry_count; c >= 2; c--) { + st->ptr[st->bp] = 255; + st->bp = st->bp + 1; + } + + write_uint_forward_fl(st, 255 << (bits - 8), bits); + } else { + write_uint_forward_fl(st, st->cache, bits); + } +} + +void write_uint_forward_fl(Encoder_State_fl* st, LC3_INT val, LC3_INT numbits) +{ + LC3_INT k = 0, bit = 0, mask = 128; + + for (k = 0; k < numbits; k++) { + bit = val & mask; + + if (bit == 0) { + st->ptr[st->bp] = st->ptr[st->bp] & (255 - mask); + } else { + st->ptr[st->bp] = st->ptr[st->bp] | mask; + } + + mask = mask >> 1; + } +} + +void ari_enc_init(Encoder_State_fl* st, LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side) +{ + st->ptr = bytes; + st->bp_side = bp_side; + st->mask_side = mask_side; + st->bp = 0; + st->low = 0; + st->range = (LC3_INT)pow(2, 24) - 1; + st->cache = -1; + st->carry = 0; + st->carry_count = 0; +} + +LC3_INT sign(LC3_INT x) +{ + if (x > 0) + return 1; + + if (x < 0) + return -1; + + return 0; +} + +void processAriEncoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT* x, LC3_INT* tns_order, LC3_INT tns_numfilters, + LC3_INT* tns_idx, LC3_INT lastnz, LC3_INT* codingdata, uint8_t* res_bits, LC3_INT resBitsLen, LC3_INT lsbMode, + LC3_INT nbbits, LC3_INT enable_lpc_weighting) +{ + LC3_INT total_bits = 0, cumfreq = 0, symfreq = 0, k = 0, i = 0, j = 0, lev = 0, lev1 = 0; + LC3_INT bit1 = 0, bit2 = 0, lsb1 = 0, lsb2 = 0, a = 0, b = 0, bit = 0, pki = 0, nbits_side = 0; + LC3_INT nbits_residual_enc = 0, nbits_ari = 0, lsbs[MAX_LEN] = {0}, lsbsLen = 0; + Encoder_State_fl st; + + ari_enc_init(&st, bytes, &bp_side, &mask_side); + + total_bits = nbbits; + + /* TNS data */ + for (i = 0; i < tns_numfilters; i++) { + if (tns_order[i] > 0) { + tns_order_freq_enc(enable_lpc_weighting, tns_order[i], &symfreq, &cumfreq); + ac_encode_fl(&st, symfreq, cumfreq); + + for (j = 0; j < tns_order[i]; j++) { + tns_coef_freq_enc(j, tns_idx[i * 8 + j], &symfreq, &cumfreq); + ac_encode_fl(&st, symfreq, cumfreq); + } + } + } + + /* Spectral data */ + for (k = 0; k < lastnz; k = k + 2) { + for (lev = 0; lev < codingdata[1]; lev++) { + lev1 = MIN(lev, 3); + pki = ari_spec_lookup_fl[codingdata[0] + lev1 * 1024]; + ac_freq_fl(pki, 16, &symfreq, &cumfreq); + + ac_encode_fl(&st, symfreq, cumfreq); + bit1 = (abs(x[k]) >> lev) & 1; + bit2 = (abs(x[k + 1]) >> lev) & 1; + + if (lsbMode == 1 && lev == 0) { + lsb1 = bit1; + lsb2 = bit2; + } else { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit1); + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit2); + } + } + + lev1 = MIN(MAX(codingdata[1], 0), 3); + pki = ari_spec_lookup_fl[codingdata[0] + lev1 * 1024]; + + ac_freq_fl(pki, codingdata[2], &symfreq, &cumfreq); + ac_encode_fl(&st, symfreq, cumfreq); + + a = abs(x[k]); + b = abs(x[k + 1]); + + if (lsbMode == 1 && codingdata[1] > 0) { + a = a >> 1; + lsbs[lsbsLen] = lsb1; + lsbsLen++; + + if (a == 0 && x[k] != 0) { + bit = MAX(0, -sign(x[k])); + lsbs[lsbsLen] = bit; + lsbsLen++; + } + + b = b >> 1; + lsbs[lsbsLen] = lsb2; + lsbsLen++; + + if (b == 0 && x[k + 1] != 0) { + bit = MAX(0, -sign(x[k + 1])); + lsbs[lsbsLen] = bit; + lsbsLen++; + } + } + + if (a != 0) { + bit = MAX(0, -sign(x[k])); + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit); + } + + if (b != 0) { + bit = MAX(0, -sign(x[k + 1])); + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit); + } + + codingdata += 3; + } + + /* Residual bits */ + nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOGTWO(*(st.mask_side))); + nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOGTWO(st.range)); + + if (st.cache >= 0) { + nbits_ari = nbits_ari + 8; + } + + if (st.carry_count > 0) { + nbits_ari = nbits_ari + st.carry_count * 8; + } + + nbits_residual_enc = MAX(total_bits - (nbits_side + nbits_ari), 0); + /* the max operation avoids in very rare cases, that + * nbits_residual_enc becomes negative; having overwritten + * the last bit(s) of the side information is in this case + * assumed to be not critical, since no spectral data bits + * were written */ + + if (lsbMode == 0) { + nbits_residual_enc = MIN(nbits_residual_enc, resBitsLen); + for (k = 0; k < nbits_residual_enc; k++) { + if (res_bits[k >> 3] & (1 << (k & 7))) + { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, 1); + } + else + { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, 0); + } + } + } else { + nbits_residual_enc = MIN(nbits_residual_enc, lsbsLen); + + for (k = 0; k < nbits_residual_enc; k++) { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, lsbs[k]); + } + } + + ac_finalize_fl(&st); +} + diff --git a/lc3plus/attack_detector.c b/lc3plus/attack_detector.c new file mode 100755 index 0000000000..c9f7c0a94c --- /dev/null +++ b/lc3plus/attack_detector.c @@ -0,0 +1,105 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, + LC3_FLOAT* attdec_filter_mem, LC3_INT attackHandlingOn, LC3_INT attdec_nblocks, LC3_INT attdec_hangover_threshold) +{ + LC3_FLOAT f_sig[160] = {0}, block_nrg[4] = {0}, sum = 0, tmpEne = 0, *ptr = NULL, tmp[162] = {0}; + LC3_INT i = 0, j = 0, attackPosition = 0; + LC3_FLOAT mval = 0; + LC3_INT frame_size_16k = attdec_nblocks * 40; + + + ptr = &tmp[2]; + + + + if (attackHandlingOn) { + /* Decimate 96, 48 and 32 kHz signals to 16 kHz */ + if (fs == 96000) { + for (i = 0; i < frame_size;) { + ptr[j] = in[i] + in[i + 1] + in[i + 2] + in[i + 3] + in[i + 4] + in[i + 5]; + i = i + 6; + j++; + } + mval = 1e-5; + } else if (fs == 48000) { + j = 0; + for (i = 0; i < frame_size;) { + ptr[j] = (in[i] + in[i + 1] + in[i + 2]); + i = i + 3; + j++; + } + } else if (fs == 32000) { + j = 0; + for (i = 0; i < frame_size;) { + ptr[j] = (in[i] + in[i + 1]); + i = i + 2; + j++; + } + } else if (fs == 24000) { + j = 0; + for (i = 0; i < frame_size;) { + ptr[j] = (in[i] + (in[i + 1] + in[i + 2]) / 2.0); + i = i + 3; + j++; + } + } + + /* Filter */ + ptr[-2] = (LC3_FLOAT)attdec_filter_mem[0]; + ptr[-1] = (LC3_FLOAT)attdec_filter_mem[1]; + + attdec_filter_mem[0] = ptr[frame_size_16k - 2]; + attdec_filter_mem[1] = ptr[frame_size_16k - 1]; + + for (i = 159; i >= 0; i--) { + tmpEne = 0; + + tmpEne += ptr[i] * 0.375; + tmpEne += ptr[i - 1] * (-0.5); + tmpEne += ptr[i - 2] * (0.125); + + f_sig[i] = tmpEne; + } + + for (i = 0; i < attdec_nblocks; i++) { + sum = 0; + for (j = 0; j < 40; j++) { + sum += f_sig[j + i * 40] * f_sig[j + i * 40]; + } + + block_nrg[i] = sum; + } + + *attackFlag = 0; + attackPosition = -1; + + for (i = 0; i < attdec_nblocks; i++) { + tmpEne = block_nrg[i] / 8.5; + + if (tmpEne > MAX(*accNrg, mval)) { + *attackFlag = 1; + attackPosition = i + 1; + } + + *accNrg = MAX(block_nrg[i], 0.25 * (*accNrg)); + } + + if (*lastAttackPosition > attdec_hangover_threshold) { + *attackFlag = 1; + } + + *lastAttackPosition = attackPosition; + } +} diff --git a/lc3plus/clib.h b/lc3plus/clib.h new file mode 100755 index 0000000000..bd70927808 --- /dev/null +++ b/lc3plus/clib.h @@ -0,0 +1,27 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef CLIB_H +#define CLIB_H + +#include +#include +#include +#include +#include +#include +#include +#ifndef _MSC_VER +#include "strings.h" +#else +#include +#endif + +#endif diff --git a/lc3plus/constants.c b/lc3plus/constants.c new file mode 100755 index 0000000000..8189761a04 --- /dev/null +++ b/lc3plus/constants.c @@ -0,0 +1,3803 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +/* DCT */ +#define ENTRY_DCT2_1 {0.353553, 0.000000} +#define ENTRY_DCT2_2 {0.351851, -0.034654} +#define ENTRY_DCT2_3 {0.346760, -0.068975} +#define ENTRY_DCT2_4 {0.338329, -0.102631} +#define ENTRY_DCT2_5 {0.326641, -0.135299} +#define ENTRY_DCT2_6 {0.311806, -0.166664} +#define ENTRY_DCT2_7 {0.293969, -0.196424} +#define ENTRY_DCT2_8 {0.273300, -0.224292} +#define ENTRY_DCT2_9 {0.250000, -0.250000} +#define ENTRY_DCT2_10 {0.224292, -0.273300} +#define ENTRY_DCT2_11 {0.196424, -0.293969} +#define ENTRY_DCT2_12 {0.166664, -0.311806} +#define ENTRY_DCT2_13 {0.135299, -0.326641} +#define ENTRY_DCT2_14 {0.102631, -0.338329} +#define ENTRY_DCT2_15 {0.068975, -0.346760} +#define ENTRY_DCT2_16 {0.034654, -0.351851} + +const Complex dct2_16[16] = { +ENTRY_DCT2_1, +ENTRY_DCT2_2, +ENTRY_DCT2_3, +ENTRY_DCT2_4, +ENTRY_DCT2_5, +ENTRY_DCT2_6, +ENTRY_DCT2_7, +ENTRY_DCT2_8, +ENTRY_DCT2_9, +ENTRY_DCT2_10, +ENTRY_DCT2_11, +ENTRY_DCT2_12, +ENTRY_DCT2_13, +ENTRY_DCT2_14, +ENTRY_DCT2_15, +ENTRY_DCT2_16 +}; + +const LC3_INT ari_tns_order_cf[2][9] = {{0, 3, 12, 35, 89, 200, 390, 658, 1024}, + {0, 14, 56, 156, 313, 494, 672, 839, 1024}}; + +const LC3_INT ari_tns_freq_cf[8][18] = { + {0, 1, 6, 21, 52, 106, 192, 289, 409, 568, 720, 831, 935, 994, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 17, 60, 154, 293, 466, 626, 780, 911, 989, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 13, 56, 162, 361, 578, 788, 929, 1003, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 6, 17, 66, 270, 555, 852, 972, 1011, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 12, 54, 295, 636, 950, 1008, 1017, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 224, 590, 967, 1014, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 300, 630, 1001, 1018, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 11, 308, 309, 991, 1017, 1019, 1020, 1021, 1022, 1023, 1024}}; + +const LC3_INT ari_spec_lookup_fl[4096] = { + 0x01, 0x27, 0x07, 0x19, 0x16, 0x16, 0x1C, 0x16, 0x16, 0x16, 0x16, 0x1C, 0x1C, 0x1C, 0x22, 0x1F, 0x1F, 0x28, 0x2B, + 0x2E, 0x31, 0x34, 0x0E, 0x11, 0x24, 0x24, 0x24, 0x26, 0x00, 0x39, 0x26, 0x16, 0x00, 0x08, 0x09, 0x0B, 0x2F, 0x0E, + 0x0E, 0x11, 0x24, 0x24, 0x24, 0x26, 0x3B, 0x3B, 0x26, 0x16, 0x16, 0x1A, 0x2E, 0x1D, 0x1E, 0x20, 0x21, 0x23, 0x24, + 0x24, 0x24, 0x26, 0x00, 0x3B, 0x17, 0x16, 0x2E, 0x2E, 0x2D, 0x2F, 0x30, 0x32, 0x32, 0x12, 0x36, 0x36, 0x36, 0x26, + 0x3B, 0x3B, 0x3B, 0x16, 0x00, 0x3E, 0x3F, 0x03, 0x21, 0x02, 0x02, 0x3D, 0x14, 0x14, 0x14, 0x15, 0x3B, 0x3B, 0x27, + 0x1C, 0x1C, 0x3F, 0x3F, 0x03, 0x21, 0x02, 0x02, 0x3D, 0x26, 0x26, 0x26, 0x15, 0x3B, 0x3B, 0x27, 0x1C, 0x1C, 0x06, + 0x06, 0x06, 0x02, 0x12, 0x3D, 0x14, 0x15, 0x15, 0x15, 0x3B, 0x27, 0x27, 0x07, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x35, 0x36, 0x14, 0x26, + 0x26, 0x39, 0x27, 0x27, 0x27, 0x07, 0x18, 0x22, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x38, 0x26, 0x39, 0x39, 0x3B, 0x07, 0x07, 0x07, 0x2A, + 0x2A, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x04, 0x04, 0x05, 0x15, 0x15, 0x3B, 0x07, 0x07, 0x07, 0x07, 0x19, 0x19, 0x19, 0x22, 0x04, 0x04, 0x04, 0x04, + 0x05, 0x17, 0x17, 0x27, 0x07, 0x07, 0x07, 0x2A, 0x19, 0x19, 0x16, 0x1F, 0x1F, 0x27, 0x27, 0x27, 0x27, 0x07, 0x07, + 0x2A, 0x00, 0x19, 0x16, 0x16, 0x16, 0x1C, 0x22, 0x1F, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x28, 0x08, 0x09, 0x31, 0x31, 0x34, 0x11, 0x11, 0x11, 0x04, 0x00, + 0x14, 0x11, 0x3C, 0x28, 0x28, 0x08, 0x2B, 0x1B, 0x31, 0x31, 0x0E, 0x11, 0x11, 0x11, 0x24, 0x2A, 0x2A, 0x11, 0x39, + 0x39, 0x28, 0x08, 0x1A, 0x1B, 0x31, 0x0C, 0x0E, 0x11, 0x11, 0x11, 0x24, 0x00, 0x26, 0x24, 0x01, 0x08, 0x08, 0x2B, + 0x09, 0x0B, 0x31, 0x0C, 0x0E, 0x0E, 0x21, 0x32, 0x32, 0x32, 0x3D, 0x24, 0x27, 0x08, 0x08, 0x2B, 0x2E, 0x31, 0x34, + 0x1E, 0x0E, 0x0E, 0x21, 0x32, 0x32, 0x32, 0x32, 0x12, 0x19, 0x08, 0x08, 0x2B, 0x2E, 0x31, 0x34, 0x1E, 0x0E, 0x0E, + 0x12, 0x05, 0x05, 0x05, 0x3D, 0x12, 0x17, 0x2B, 0x2B, 0x2B, 0x09, 0x31, 0x34, 0x03, 0x0E, 0x0E, 0x32, 0x32, 0x32, + 0x32, 0x3D, 0x11, 0x18, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, + 0x2B, 0x2B, 0x2B, 0x2B, 0x09, 0x0B, 0x34, 0x34, 0x0E, 0x0E, 0x11, 0x3D, 0x3D, 0x3D, 0x36, 0x11, 0x27, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2C, 0x1B, 0x1D, + 0x34, 0x30, 0x34, 0x34, 0x11, 0x11, 0x11, 0x11, 0x02, 0x11, 0x07, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, + 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x09, 0x1B, 0x1B, 0x0C, 0x34, 0x0E, 0x0E, 0x3A, 0x29, + 0x29, 0x29, 0x06, 0x11, 0x25, 0x09, 0x09, 0x09, 0x1B, 0x0B, 0x31, 0x0C, 0x34, 0x0E, 0x0E, 0x0E, 0x32, 0x00, 0x35, + 0x11, 0x1C, 0x34, 0x34, 0x31, 0x34, 0x0C, 0x34, 0x1E, 0x0E, 0x0E, 0x11, 0x02, 0x02, 0x02, 0x26, 0x26, 0x22, 0x1F, + 0x22, 0x22, 0x1F, 0x1F, 0x1F, 0x1F, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x1F, 0x13, 0x2C, 0x2C, 0x3E, 0x1E, + 0x20, 0x3A, 0x23, 0x24, 0x24, 0x26, 0x00, 0x3B, 0x07, 0x07, 0x27, 0x22, 0x22, 0x2D, 0x2F, 0x30, 0x21, 0x23, 0x23, + 0x24, 0x26, 0x26, 0x26, 0x3B, 0x07, 0x07, 0x27, 0x22, 0x22, 0x3E, 0x1E, 0x0F, 0x32, 0x35, 0x35, 0x36, 0x15, 0x15, + 0x15, 0x3B, 0x07, 0x07, 0x07, 0x22, 0x1E, 0x1E, 0x30, 0x21, 0x3A, 0x12, 0x12, 0x38, 0x17, 0x17, 0x17, 0x3B, 0x07, + 0x07, 0x18, 0x22, 0x22, 0x06, 0x06, 0x3A, 0x35, 0x36, 0x36, 0x15, 0x3B, 0x3B, 0x3B, 0x27, 0x07, 0x07, 0x2A, 0x22, + 0x06, 0x06, 0x21, 0x3A, 0x35, 0x36, 0x3D, 0x15, 0x3B, 0x3B, 0x3B, 0x27, 0x07, 0x07, 0x2A, 0x22, 0x22, 0x33, 0x33, + 0x35, 0x36, 0x38, 0x38, 0x39, 0x27, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x19, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x04, 0x04, 0x04, 0x05, 0x17, 0x17, 0x27, 0x07, + 0x07, 0x07, 0x2A, 0x19, 0x19, 0x16, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x05, 0x05, 0x39, 0x39, 0x27, 0x18, 0x18, 0x18, 0x2A, 0x16, 0x16, 0x1C, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x29, + 0x29, 0x29, 0x29, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x2A, 0x19, 0x1C, 0x1C, 0x1C, 0x1F, 0x1F, 0x29, 0x29, 0x29, 0x29, + 0x27, 0x27, 0x18, 0x19, 0x19, 0x19, 0x16, 0x1C, 0x1C, 0x22, 0x1F, 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x1C, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1F, 0x13, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x0B, 0x2F, 0x20, 0x32, 0x12, 0x12, 0x14, 0x15, 0x15, 0x15, 0x27, + 0x3B, 0x22, 0x1A, 0x1A, 0x1B, 0x1D, 0x1E, 0x21, 0x32, 0x12, 0x12, 0x14, 0x39, 0x39, 0x39, 0x3B, 0x3B, 0x22, 0x1B, + 0x1B, 0x0B, 0x0C, 0x30, 0x32, 0x3A, 0x3D, 0x3D, 0x38, 0x39, 0x39, 0x39, 0x3B, 0x27, 0x22, 0x2D, 0x2D, 0x0C, 0x1E, + 0x20, 0x02, 0x02, 0x3D, 0x26, 0x26, 0x26, 0x39, 0x00, 0x3B, 0x27, 0x22, 0x3F, 0x3F, 0x03, 0x20, 0x3A, 0x12, 0x12, + 0x14, 0x15, 0x15, 0x15, 0x3B, 0x27, 0x27, 0x07, 0x1F, 0x1F, 0x03, 0x03, 0x21, 0x3A, 0x12, 0x12, 0x14, 0x15, 0x15, + 0x15, 0x3B, 0x07, 0x07, 0x07, 0x1F, 0x06, 0x06, 0x33, 0x33, 0x35, 0x36, 0x36, 0x26, 0x39, 0x39, 0x39, 0x27, 0x07, + 0x07, 0x2A, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x33, 0x35, 0x35, 0x36, 0x38, 0x38, 0x39, 0x3B, 0x3B, 0x3B, 0x07, 0x18, 0x18, 0x19, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x04, 0x04, 0x04, 0x36, 0x15, + 0x15, 0x39, 0x27, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x16, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x05, 0x05, 0x17, 0x17, 0x3B, 0x07, 0x07, 0x07, 0x2A, + 0x16, 0x16, 0x1C, 0x1F, 0x1F, 0x04, 0x04, 0x04, 0x05, 0x17, 0x17, 0x27, 0x18, 0x18, 0x18, 0x19, 0x1C, 0x1C, 0x22, + 0x1F, 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x1C, 0x22, 0x22, 0x22, 0x1F, 0x1F, 0x1F, 0x1F, 0x13, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, + 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3C, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x10, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, + 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x13, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, + 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +const LC3_INT ari_spec_cumfreq_fl[64][18] = { + {0, 1, 2, 177, 225, 226, 227, 336, 372, 543, 652, 699, 719, 768, 804, 824, 834, 1024}, + {0, 18, 44, 61, 71, 98, 135, 159, 175, 197, 229, 251, 265, 282, 308, 328, 341, 1024}, + {0, 71, 163, 212, 237, 318, 420, 481, 514, 556, 613, 652, 675, 697, 727, 749, 764, 1024}, + {0, 160, 290, 336, 354, 475, 598, 653, 677, 722, 777, 808, 823, 842, 866, 881, 890, 1024}, + {0, 71, 144, 177, 195, 266, 342, 385, 411, 445, 489, 519, 539, 559, 586, 607, 622, 1024}, + {0, 48, 108, 140, 159, 217, 285, 327, 354, 385, 427, 457, 478, 497, 524, 545, 561, 1024}, + {0, 138, 247, 290, 308, 419, 531, 584, 609, 655, 710, 742, 759, 780, 807, 825, 836, 1024}, + {0, 16, 40, 62, 79, 103, 139, 170, 195, 215, 245, 270, 290, 305, 327, 346, 362, 1024}, + {0, 579, 729, 741, 743, 897, 970, 980, 982, 996, 1007, 1010, 1011, 1014, 1017, 1018, 1019, 1024}, + {0, 398, 582, 607, 612, 788, 902, 925, 931, 956, 979, 987, 990, 996, 1002, 1005, 1007, 1024}, + {0, 13, 34, 52, 63, 83, 112, 134, 149, 163, 183, 199, 211, 221, 235, 247, 257, 1024}, + {0, 281, 464, 501, 510, 681, 820, 857, 867, 902, 938, 953, 959, 968, 978, 984, 987, 1024}, + {0, 198, 362, 408, 421, 575, 722, 773, 789, 832, 881, 905, 915, 928, 944, 954, 959, 1024}, + {0, 1, 2, 95, 139, 140, 141, 213, 251, 337, 407, 450, 475, 515, 551, 576, 592, 1024}, + {0, 133, 274, 338, 366, 483, 605, 664, 691, 730, 778, 807, 822, 837, 857, 870, 878, 1024}, + {0, 128, 253, 302, 320, 443, 577, 636, 659, 708, 767, 799, 814, 833, 857, 872, 881, 1024}, + {0, 1, 2, 25, 42, 43, 44, 67, 85, 105, 126, 144, 159, 174, 191, 205, 217, 1024}, + {0, 70, 166, 229, 267, 356, 468, 533, 569, 606, 653, 685, 705, 722, 745, 762, 774, 1024}, + {0, 55, 130, 175, 200, 268, 358, 416, 449, 488, 542, 581, 606, 628, 659, 683, 699, 1024}, + {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 1024}, + {0, 34, 85, 123, 147, 196, 265, 317, 352, 386, 433, 470, 497, 518, 549, 574, 593, 1024}, + {0, 30, 73, 105, 127, 170, 229, 274, 305, 335, 377, 411, 436, 455, 483, 506, 524, 1024}, + {0, 9, 24, 38, 51, 65, 87, 108, 126, 139, 159, 177, 193, 204, 221, 236, 250, 1024}, + {0, 30, 74, 105, 125, 166, 224, 266, 294, 322, 361, 391, 413, 431, 457, 478, 494, 1024}, + {0, 15, 38, 58, 73, 95, 128, 156, 178, 196, 222, 245, 263, 276, 296, 314, 329, 1024}, + {0, 11, 28, 44, 57, 74, 100, 123, 142, 157, 179, 199, 216, 228, 246, 262, 276, 1024}, + {0, 448, 619, 639, 643, 821, 926, 944, 948, 971, 991, 998, 1000, 1005, 1010, 1012, 1013, 1024}, + {0, 332, 520, 549, 555, 741, 874, 903, 910, 940, 970, 981, 985, 991, 998, 1002, 1004, 1024}, + {0, 8, 21, 34, 45, 58, 78, 96, 112, 124, 141, 157, 170, 180, 194, 207, 219, 1024}, + {0, 239, 415, 457, 468, 631, 776, 820, 833, 872, 914, 933, 940, 951, 964, 971, 975, 1024}, + {0, 165, 310, 359, 375, 513, 652, 707, 727, 774, 828, 856, 868, 884, 904, 916, 923, 1024}, + {0, 3, 8, 13, 18, 23, 30, 37, 44, 48, 55, 62, 68, 72, 78, 84, 90, 1024}, + {0, 115, 237, 289, 311, 422, 547, 608, 635, 680, 737, 771, 788, 807, 832, 849, 859, 1024}, + {0, 107, 221, 272, 293, 399, 521, 582, 610, 656, 714, 749, 767, 787, 813, 831, 842, 1024}, + {0, 6, 16, 26, 35, 45, 60, 75, 89, 98, 112, 125, 137, 145, 157, 168, 178, 1024}, + {0, 72, 160, 210, 236, 320, 422, 482, 514, 555, 608, 644, 665, 685, 712, 732, 745, 1024}, + {0, 45, 108, 153, 183, 244, 327, 385, 421, 455, 502, 536, 559, 578, 605, 626, 641, 1024}, + {0, 1, 2, 9, 16, 17, 18, 26, 34, 40, 48, 55, 62, 68, 75, 82, 88, 1024}, + {0, 29, 73, 108, 132, 174, 236, 284, 318, 348, 391, 426, 452, 471, 500, 524, 543, 1024}, + {0, 20, 51, 76, 93, 123, 166, 200, 225, 247, 279, 305, 326, 342, 365, 385, 401, 1024}, + {0, 742, 845, 850, 851, 959, 997, 1001, 1002, 1009, 1014, 1016, 1017, 1019, 1020, 1021, 1022, 1024}, + {0, 42, 94, 121, 137, 186, 244, 280, 303, 330, 366, 392, 410, 427, 451, 470, 484, 1024}, + {0, 13, 33, 51, 66, 85, 114, 140, 161, 178, 203, 225, 243, 256, 275, 292, 307, 1024}, + {0, 501, 670, 689, 693, 848, 936, 952, 956, 975, 991, 997, 999, 1004, 1008, 1010, 1011, 1024}, + {0, 445, 581, 603, 609, 767, 865, 888, 895, 926, 954, 964, 968, 977, 986, 991, 993, 1024}, + {0, 285, 442, 479, 489, 650, 779, 818, 830, 870, 912, 930, 937, 949, 963, 971, 975, 1024}, + {0, 349, 528, 561, 569, 731, 852, 883, 892, 923, 953, 965, 970, 978, 987, 992, 994, 1024}, + {0, 199, 355, 402, 417, 563, 700, 750, 767, 811, 860, 884, 894, 909, 926, 936, 942, 1024}, + {0, 141, 275, 325, 343, 471, 606, 664, 686, 734, 791, 822, 836, 854, 877, 891, 899, 1024}, + {0, 243, 437, 493, 510, 649, 775, 820, 836, 869, 905, 923, 931, 941, 953, 960, 964, 1024}, + {0, 91, 197, 248, 271, 370, 487, 550, 580, 625, 684, 721, 741, 761, 788, 807, 819, 1024}, + {0, 107, 201, 242, 262, 354, 451, 503, 531, 573, 626, 660, 680, 701, 730, 751, 765, 1024}, + {0, 168, 339, 407, 432, 553, 676, 731, 755, 789, 830, 854, 866, 879, 895, 906, 912, 1024}, + {0, 67, 147, 191, 214, 290, 384, 441, 472, 513, 567, 604, 627, 648, 678, 700, 715, 1024}, + {0, 46, 109, 148, 171, 229, 307, 359, 391, 427, 476, 513, 537, 558, 588, 612, 629, 1024}, + {0, 848, 918, 920, 921, 996, 1012, 1013, 1014, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 36, 88, 123, 145, 193, 260, 308, 340, 372, 417, 452, 476, 496, 525, 548, 565, 1024}, + {0, 24, 61, 90, 110, 145, 196, 237, 266, 292, 330, 361, 385, 403, 430, 453, 471, 1024}, + {0, 85, 182, 230, 253, 344, 454, 515, 545, 590, 648, 685, 706, 727, 756, 776, 789, 1024}, + {0, 22, 55, 82, 102, 135, 183, 222, 252, 278, 315, 345, 368, 385, 410, 431, 448, 1024}, + {0, 1, 2, 56, 89, 90, 91, 140, 172, 221, 268, 303, 328, 358, 388, 412, 430, 1024}, + {0, 45, 109, 152, 177, 239, 320, 376, 411, 448, 499, 537, 563, 585, 616, 640, 658, 1024}, + {0, 247, 395, 433, 445, 599, 729, 771, 785, 829, 875, 896, 905, 920, 937, 946, 951, 1024}, + {0, 231, 367, 408, 423, 557, 676, 723, 742, 786, 835, 860, 872, 889, 909, 921, 928, 1024}}; + +const LC3_INT ari_spec_bits_fl[64][17] = { + {20480, 20480, 5220, 9042, 20480, 20480, 6619, 9892, 5289, 6619, 9105, 11629, 8982, 9892, 11629, 13677, 4977}, + {11940, 10854, 12109, 13677, 10742, 9812, 11090, 12288, 11348, 10240, 11348, 12683, 12109, 10854, 11629, 12902, + 1197}, + {7886, 7120, 8982, 10970, 7496, 6815, 8334, 10150, 9437, 8535, 9656, 11216, 11348, 10431, 11348, 12479, 4051}, + {5485, 6099, 9168, 11940, 6311, 6262, 8640, 11090, 9233, 8640, 10334, 12479, 11781, 11090, 12479, 13988, 6009}, + {7886, 7804, 10150, 11940, 7886, 7685, 9368, 10854, 10061, 9300, 10431, 11629, 11629, 10742, 11485, 12479, 2763}, + {9042, 8383, 10240, 11781, 8483, 8013, 9437, 10742, 10334, 9437, 10431, 11485, 11781, 10742, 11485, 12288, 2346}, + {5922, 6619, 9368, 11940, 6566, 6539, 8750, 10970, 9168, 8640, 10240, 12109, 11485, 10742, 11940, 13396, 5009}, + {12288, 11090, 11348, 12109, 11090, 9892, 10334, 10970, 11629, 10431, 10970, 11629, 12479, 11348, 11781, 12288, + 1289}, + {1685, 5676, 13138, 18432, 5598, 7804, 13677, 18432, 12683, 13396, 17234, 20480, 17234, 17234, 20480, 20480, 15725}, + {2793, 5072, 10970, 15725, 5204, 6487, 11216, 15186, 10970, 11216, 14336, 17234, 15186, 15186, 17234, 18432, 12109}, + {12902, 11485, 11940, 13396, 11629, 10531, 11348, 12479, 12683, 11629, 12288, 13138, 13677, 12683, 13138, 13677, + 854}, + {3821, 5088, 9812, 13988, 5289, 5901, 9812, 13677, 9976, 9892, 12479, 15186, 13988, 13677, 15186, 17234, 9812}, + {4856, 5412, 9168, 12902, 5598, 5736, 8863, 12288, 9368, 8982, 11090, 13677, 12902, 12288, 13677, 15725, 8147}, + {20480, 20480, 7088, 9300, 20480, 20480, 7844, 9733, 7320, 7928, 9368, 10970, 9581, 9892, 10970, 12288, 2550}, + {6031, 5859, 8192, 10635, 6410, 6286, 8433, 10742, 9656, 9042, 10531, 12479, 12479, 11629, 12902, 14336, 5756}, + {6144, 6215, 8982, 11940, 6262, 6009, 8433, 11216, 8982, 8433, 10240, 12479, 11781, 11090, 12479, 13988, 5817}, + {20480, 20480, 11216, 12109, 20480, 20480, 11216, 11940, 11629, 11485, 11940, 12479, 12479, 12109, 12683, 13138, + 704}, + {7928, 6994, 8239, 9733, 7218, 6539, 8147, 9892, 9812, 9105, 10240, 11629, 12109, 11216, 12109, 13138, 4167}, + {8640, 7724, 9233, 10970, 8013, 7185, 8483, 10150, 9656, 8694, 9656, 10970, 11348, 10334, 11090, 12288, 3391}, + {20480, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, + 91}, + {10061, 8863, 9733, 11090, 8982, 7970, 8806, 9976, 10061, 9105, 9812, 10742, 11485, 10334, 10970, 11781, 2557}, + {10431, 9368, 10240, 11348, 9368, 8433, 9233, 10334, 10431, 9437, 10061, 10970, 11781, 10635, 11216, 11940, 2119}, + {13988, 12479, 12683, 12902, 12683, 11348, 11485, 11940, 12902, 11629, 11940, 12288, 13396, 12109, 12479, 12683, + 828}, + {10431, 9300, 10334, 11629, 9508, 8483, 9437, 10635, 10635, 9656, 10431, 11348, 11940, 10854, 11485, 12288, 1946}, + {12479, 11216, 11629, 12479, 11348, 10150, 10635, 11348, 11940, 10854, 11216, 11940, 12902, 11629, 11940, 12479, + 1146}, + {13396, 12109, 12288, 12902, 12109, 10854, 11216, 11781, 12479, 11348, 11629, 12109, 13138, 11940, 12288, 12683, + 928}, + {2443, 5289, 11629, 16384, 5170, 6730, 11940, 16384, 11216, 11629, 14731, 18432, 15725, 15725, 18432, 20480, 13396}, + {3328, 5009, 10531, 15186, 5040, 6031, 10531, 14731, 10431, 10431, 13396, 16384, 15186, 14731, 16384, 18432, 11629}, + {14336, 12902, 12902, 13396, 12902, 11629, 11940, 12288, 13138, 12109, 12288, 12902, 13677, 12683, 12902, 13138, + 711}, + {4300, 5204, 9437, 13396, 5430, 5776, 9300, 12902, 9656, 9437, 11781, 14731, 13396, 12902, 14731, 16384, 8982}, + {5394, 5776, 8982, 12288, 5922, 5901, 8640, 11629, 9105, 8694, 10635, 13138, 12288, 11629, 13138, 14731, 6844}, + {17234, 15725, 15725, 15725, 15725, 14731, 14731, 14731, 16384, 14731, 14731, 15186, 16384, 15186, 15186, 15186, + 272}, + {6461, 6286, 8806, 11348, 6566, 6215, 8334, 10742, 9233, 8535, 10061, 12109, 11781, 10970, 12109, 13677, 5394}, + {6674, 6487, 8863, 11485, 6702, 6286, 8334, 10635, 9168, 8483, 9976, 11940, 11629, 10854, 11940, 13396, 5105}, + {15186, 13677, 13677, 13988, 13677, 12479, 12479, 12683, 13988, 12683, 12902, 13138, 14336, 13138, 13396, 13677, + 565}, + {7844, 7252, 8922, 10854, 7389, 6815, 8383, 10240, 9508, 8750, 9892, 11485, 11629, 10742, 11629, 12902, 3842}, + {9233, 8239, 9233, 10431, 8334, 7424, 8483, 9892, 10061, 9105, 10061, 11216, 11781, 10742, 11485, 12479, 2906}, + {20480, 20480, 14731, 14731, 20480, 20480, 14336, 14336, 15186, 14336, 14731, 14731, 15186, 14731, 14731, 15186, + 266}, + {10531, 9300, 9976, 11090, 9437, 8286, 9042, 10061, 10431, 9368, 9976, 10854, 11781, 10531, 11090, 11781, 2233}, + {11629, 10334, 10970, 12109, 10431, 9368, 10061, 10970, 11348, 10240, 10854, 11485, 12288, 11216, 11629, 12288, + 1469}, + {952, 6787, 15725, 20480, 6646, 9733, 16384, 20480, 14731, 15725, 18432, 20480, 18432, 20480, 20480, 20480, 18432}, + {9437, 8806, 10742, 12288, 8982, 8483, 9892, 11216, 10742, 9892, 10854, 11940, 12109, 11090, 11781, 12683, 1891}, + {12902, 11629, 11940, 12479, 11781, 10531, 10854, 11485, 12109, 10970, 11348, 11940, 12902, 11781, 12109, 12479, + 1054}, + {2113, 5323, 11781, 16384, 5579, 7252, 12288, 16384, 11781, 12288, 15186, 18432, 15725, 16384, 18432, 20480, 12902}, + {2463, 5965, 11348, 15186, 5522, 6934, 11216, 14731, 10334, 10635, 13677, 16384, 13988, 13988, 15725, 18432, 10334}, + {3779, 5541, 9812, 13677, 5467, 6122, 9656, 13138, 9581, 9437, 11940, 14731, 13138, 12683, 14336, 16384, 8982}, + {3181, 5154, 10150, 14336, 5448, 6311, 10334, 13988, 10334, 10431, 13138, 15725, 14336, 13988, 15725, 18432, 10431}, + {4841, 5560, 9105, 12479, 5756, 5944, 8922, 12109, 9300, 8982, 11090, 13677, 12479, 12109, 13677, 15186, 7460}, + {5859, 6009, 8922, 11940, 6144, 5987, 8483, 11348, 9042, 8535, 10334, 12683, 11940, 11216, 12683, 14336, 6215}, + {4250, 4916, 8587, 12109, 5901, 6191, 9233, 12288, 10150, 9892, 11940, 14336, 13677, 13138, 14731, 16384, 8383}, + {7153, 6702, 8863, 11216, 6904, 6410, 8239, 10431, 9233, 8433, 9812, 11629, 11629, 10742, 11781, 13138, 4753}, + {6674, 7057, 9508, 11629, 7120, 6964, 8806, 10635, 9437, 8750, 10061, 11629, 11485, 10531, 11485, 12683, 4062}, + {5341, 5289, 8013, 10970, 6311, 6262, 8640, 11090, 10061, 9508, 11090, 13138, 12902, 12288, 13396, 15186, 6539}, + {8057, 7533, 9300, 11216, 7685, 7057, 8535, 10334, 9508, 8694, 9812, 11216, 11485, 10431, 11348, 12479, 3541}, + {9168, 8239, 9656, 11216, 8483, 7608, 8806, 10240, 9892, 8982, 9812, 11090, 11485, 10431, 11090, 12109, 2815}, + {558, 7928, 18432, 20480, 7724, 12288, 20480, 20480, 18432, 20480, 20480, 20480, 20480, 20480, 20480, 20480, 20480}, + {9892, 8806, 9976, 11348, 9042, 8057, 9042, 10240, 10240, 9233, 9976, 11090, 11629, 10531, 11216, 12109, 2371}, + {11090, 9812, 10531, 11629, 9976, 8863, 9508, 10531, 10854, 9733, 10334, 11090, 11940, 10742, 11216, 11940, 1821}, + {7354, 6964, 9042, 11216, 7153, 6592, 8334, 10431, 9233, 8483, 9812, 11485, 11485, 10531, 11629, 12902, 4349}, + {11348, 10150, 10742, 11629, 10150, 9042, 9656, 10431, 10854, 9812, 10431, 11216, 12109, 10970, 11485, 12109, 1700}, + {20480, 20480, 8694, 10150, 20480, 20480, 8982, 10240, 8982, 9105, 9976, 10970, 10431, 10431, 11090, 11940, 1610}, + {9233, 8192, 9368, 10970, 8286, 7496, 8587, 9976, 9812, 8863, 9733, 10854, 11348, 10334, 11090, 11940, 3040}, + {4202, 5716, 9733, 13138, 5598, 6099, 9437, 12683, 9300, 9168, 11485, 13988, 12479, 12109, 13988, 15725, 7804}, + {4400, 5965, 9508, 12479, 6009, 6360, 9105, 11781, 9300, 8982, 10970, 13138, 12109, 11629, 13138, 14731, 6994}}; + +const LC3_FLOAT sns_LFCB[8][32] = { + {2.26283365592678, 2.94516479191376, -2.18610707009979, 0.693688236528920, -1.29752132315296, 0.914652037830672, + -2.51428812578962, -0.922188404812385, 0.790322288369266, 1.44775580178724, 0.793354526417474, 2.72425347385034, + -0.530830198375400, 1.68728410845006, -2.95183272801858, 0.101878342785628, 2.68254575498426, 4.82697923680403, + 0.0878419936470335, 1.39102308204326, 0.384585893889182, 1.93227399441719, 0.175080462899884, -1.18817020250556, + 2.53322203327061, 3.99889837485606, 0.507902593186381, 3.16856825107569, 1.89414766731764, 0.948880604517188, + -1.88026757045628, 0.246375746277129}, + {0.813311269061339, 2.41143317956679, -1.97152135675228, 0.955609857158220, -0.740369057177853, + 1.74293043435257, -2.89175271384373, 0.632495141440552, 0.628401261876199, 2.72399951674952, + 0.0143931185523454, 2.95947572404824, -0.212690682812164, 2.43614509237656, -1.59393496773345, + 0.589857324228917, 1.32738010899420, 3.11947804492488, -0.569586840238501, 1.98146479199466, + -0.160588785536510, 3.01030180412057, -0.750522832248985, 0.366792873662636, 2.11274642695908, + 4.07901751451956, 1.58838449789527, 3.25853458159407, 1.25108694609232, 2.13239439249982, + -1.26431072758705, 0.955621773393099}, + {-0.530193494871436, 0.960455106400727, -1.78718619681006, 0.575230787038733, -0.345372483642106, + 1.90906626859986, -2.00450666759434, 1.08736431254641, 0.393117923540450, 2.31083268737528, + -0.567834844729679, 1.84953559268461, 0.00576613628377097, 2.33019429078225, -0.109918772878022, + 0.619047646793466, 0.130185273804048, 1.39513671385178, -1.14506015668811, 1.11265796388770, + -0.539366809557710, 3.06543893826204, -1.03943893342231, 1.30957830409096, 1.26288411502064, + 2.82285661102496, 1.72899023869209, 2.42230591328599, 0.590451210720628, 2.72345350344278, + 0.311424976968699, 1.52046776741766}, + {-1.35664835903442, -0.443226488076917, -1.91865895685577, -0.114603419462889, -0.313285696247940, + 1.54408483842665, -0.750912273903127, 0.608628624535820, 0.480007710866901, 0.935051269566529, + -0.654760467916745, 0.563284922322364, 0.424871484383745, 1.77983777835091, 0.388609072919257, + 1.26731313851796, -0.338533088511347, 0.250295315918722, -1.66968488172598, -0.220107509420743, + -0.529309078789857, 2.50110160870008, -1.13577508937648, 1.68330687280491, 0.761513512430427, + 1.72607212849580, 1.00692230241726, 1.79446077643261, 0.608358583293714, 2.76986076866588, + 1.83670210306430, 1.97647400419457}, + {-1.59952176563196, -1.22913612425590, -1.79399121836596, -0.646050637436029, -0.402977242824477, + 1.09344960761455, 0.441202104904691, 0.131174567547348, 0.447815138050143, -0.274743911383688, + -0.479458998475743, 0.139917088125072, 0.473128952158668, 1.44411295390082, 0.512932649517584, + 2.41961047769804, -0.368219235899667, -0.393613839379793, -1.84534417603682, -0.774965611552366, + 0.190433547437932, 1.93089592978934, -1.04197903837494, 1.25100924225127, 0.522117937976170, + 0.647144377348619, 0.377121231816382, 1.52177910653089, 0.878171010011082, 2.54286973254946, + 2.25634191839874, 1.94043867177462}, + {-1.44098768430095, -1.55590039118170, -1.35738404257288, -0.952351370449625, -0.372020853465227, + 0.647479549518278, 1.20190987601009, -0.296149157743752, 0.209734214552234, -0.902077696828602, + -0.173894661902889, 0.359641093366222, 0.858894199321281, 1.51995177009730, 0.628112597063497, + 2.25174252572187, -0.191689946715961, -0.643458173054701, -1.56468027328802, -0.594063874149117, + 2.56062918106522, 0.572153810961837, -0.0152060098993382, 0.942375751628615, 0.118680069757121, + -0.331148521217238, 0.476370766899498, 1.17196706537602, 1.11912510950950, 2.02046263825019, + 2.04818998463474, 2.23375847282686}, + {-1.14381648305821, -1.49688655952376, -0.705444279353869, -1.07405247226150, -0.0783414177323738, + 0.0361790752449642, 1.32742857257290, -0.207013516525629, 0.00656691996428021, -0.940681511945404, + 0.0680162705515438, 0.689461354774589, 1.19111160854435, 1.47199393750425, 0.822621796430634, + 0.526537030991201, -0.154782377153908, -0.642570736856943, -1.11746759076420, 0.136937680628923, + 2.81896398245248, -0.811741794081091, 2.07048391716707, 0.826250483374133, -0.452346827507370, + -0.884042570848749, 1.08754740372170, 0.489394596980695, 1.01857661550342, 0.830045859400910, + 2.19526837458568, 1.98835977758407}, + {-0.755203767909064, -1.11689986501469, -0.0478172944777711, -0.758087707094905, 0.0970441303992295, + -0.297092807178889, 1.22049081140984, 0.134924916642080, -0.0861242342061857, -0.633697038974310, + 0.295125948369794, 0.639790176833105, 0.996189669638358, 0.977682473891761, 0.875891424655081, + -0.396591513227999, -0.234207177774392, -0.723193223444072, -0.533981663366786, 0.818242891264338, + 0.656670875696161, -1.17641810861903, 3.42948918081689, 0.439952741120956, -0.700352426161103, + -1.12697340645478, 1.08756266099221, -0.0622795715718769, 0.620453891011724, -0.0275569173888263, + 2.02659613836619, 1.27232672554701}}; + +const LC3_FLOAT sns_HFCB[8][32] = { + {0.232028419124465, -1.29503936673618, 0.139285716045803, -0.316513102185725, 0.879518405226496, + -0.296701922455375, 0.340981100469697, -1.41229759077597, -0.228839511827379, -1.07148628544449, + -0.590988511188051, -0.848434098836164, 1.14069145562382, -0.376283237967464, 0.665004120598402, + -0.826265953982679, 1.41008326832173, 0.361386817574348, 0.437469239330329, 0.648100318996503, + 1.11919833091304, 0.141847497087176, 0.504046955390252, -0.501076050479357, 3.74970982709642, + -1.15258990980549, 1.02827246422140, 0.128831971707817, 1.34033030334757, 2.13843105419313, + 0.564830487355396, -0.422460547586087}, + {-1.00890270604455, -1.79929965384339, -0.258185126171752, -0.477747657209805, 0.298340096007189, + -0.975004919174553, 0.268899788946055, -1.48522119349852, -0.333719069784662, -1.41767015456261, + -0.0711737758537628, -0.583226810708889, 0.964016892398293, 0.0425675462096105, 1.09790764690795, + -0.671181232766603, 0.754441907835468, -0.0219991705427826, 0.305440419605961, 0.682299133640680, + 1.23465532536005, -0.110660070633151, 0.826982162959097, -0.325678006081417, 1.52342611847045, + -1.10800885906241, 1.09770519389828, 0.689439395264878, 1.38996825067789, 4.24711267303104, + 1.59184977958743, 0.326149625049801}, + {-2.14223502789471, -1.88703147531519, -0.650804572670110, -0.551162075879755, -0.915386396405710, + -1.35857500246993, 0.0563335684828033, -1.18603579834700, -0.809321359324656, -1.54891762265441, + 0.345719522947313, 0.0900423688142873, 0.381461205984798, 0.516547696592306, 1.38342667112079, + -0.228495592779472, -1.30550584958631, -0.579368833633824, -0.00738786566478374, 0.253247464332976, + 0.589170238085318, -0.282824592543629, 1.11981236291828, 0.0280798194947077, -0.457715661897855, + -0.562615116512472, 0.768645545764776, 1.12346905009575, 1.04467921708883, 2.89734109830439, + 2.39771699015146, 1.39171313342261}, + {-2.37533813570664, -1.80991659687332, -1.06815731781969, -0.484788283381197, -2.20645974739762, + -0.983721105837444, 0.0499114046826685, -0.625001634441352, -1.63587876923797, -1.45296062475530, + 0.300549460996251, 0.845025007556886, -0.482849340608998, 0.251716881864630, 1.34327358628285, + 0.518980852551937, -1.87133711350971, -0.879427960941070, -0.495649854710252, 0.0735842143788469, + -1.37192459653166, -0.00659813474614194, 1.17914044332734, 0.262054554763133, -0.798711008243192, + -0.220562123765675, 0.206081977740766, 1.30934523106594, 0.635822746244367, 0.932730658026815, + 3.03697343600704, 2.23146614636474}, + {-2.23041933049655, -1.76340038479206, -1.61928741524302, -0.238388394455814, -2.74142180959951, + -0.652956939100809, -0.0954130727414369, 0.153902497468304, -1.88486397330982, -1.03182970062270, + -1.11865218295857, 1.06572384501716, -1.81632721260589, -0.216179967524303, 0.822978836855922, + 1.36721896340278, -1.24008685156305, -0.850685023408119, -0.806651271118393, 0.314216709389010, + -2.37095707241577, 0.285929279627216, 1.07987429197260, 0.360590806085767, -0.386819329309100, + -0.349842880336644, -0.342805735091998, 1.35511964713935, -0.274733755518482, -0.292822249729810, + 2.66424350337151, 2.61179442169688}, + {-2.17595881223696, -1.83418428467950, -2.18762566441756, -0.143024507285504, -2.86139074276891, + -0.989986992921811, -0.760166146083885, 0.576386497810755, -1.64496691316356, -0.690642640272584, + -2.44089151148049, 0.737582999377756, -2.80279512728555, -0.534074091124504, 0.215876798515679, + 2.18023038253092, -1.26712924866274, -0.779397050155816, -1.22431891984401, 0.234729880923679, + -2.00779782682360, 0.0460445529952971, 0.697536239067500, 0.635623722053700, -0.375901062231203, + -0.753432770250495, -0.754939404625340, 1.42311381470799, -1.54923372430695, -0.810404296853182, + 1.39304485032606, 2.66540340196570}, + {-2.29065913541000, -1.80480980687405, -2.63757586939054, 0.0683186673649074, -2.88841597105271, + -1.61467224598900, -2.32758120177007, 0.795092603798871, -1.40515778046612, -0.428843804532171, + -2.22854732450735, 0.256590452459912, -3.23385724833864, -0.640786096262196, -0.404925753080293, + 2.53596092750107, -2.03670813003907, -0.732182927291826, -1.70157770043181, 0.144600134479837, + -1.66688540224395, -0.602596415577886, -0.912548817371081, 0.959012467178154, -0.657836899930538, + -0.988596593396384, -1.04196177632000, 1.15706449190905, -2.44239710278007, -0.788868098756483, + 0.403834023595745, 2.40103554105707}, + {-2.53286397979846, -1.73679545317401, -2.97897749575096, 0.0883061717288066, -2.95182608262521, + -2.40712302385116, -3.77155485385656, 0.596564632144913, -1.46666471326146, -0.494960215408874, + -1.89509228210853, -0.491963359762378, -3.45908714491473, -0.869745032374135, -1.07025605870523, + 2.20121098860036, -2.89685162242381, -0.888348514821255, -2.24491913755611, -0.0682120178880174, + -1.92631846258406, -2.26568728632575, -3.57684747062773, 1.30745156688653, -1.28163964243603, + -1.28790471791471, -1.50335652955529, 0.406319437516838, -3.02457606944550, -0.935353148761338, + -0.656270971328114, 1.75920379670881}}; + +const LC3_INT pvq_enc_A[16][11] = {{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19}, + {0, 1, 5, 13, 25, 41, 61, 85, 113, 145, 181}, + {0, 1, 7, 25, 63, 129, 231, 377, 575, 833, 1159}, + {0, 1, 9, 41, 129, 321, 681, 1289, 2241, 3649, 5641}, + {0, 1, 11, 61, 231, 681, 1683, 3653, 7183, 13073, 22363}, + {0, 1, 13, 85, 377, 1289, 3653, 8989, 19825, 40081, 75517}, + {0, 1, 15, 113, 575, 2241, 7183, 19825, 48639, 108545, 224143}, + {0, 1, 17, 145, 833, 3649, 13073, 40081, 108545, 265729, 598417}, + {0, 1, 19, 181, 1159, 5641, 22363, 75517, 224143, 598417, 1462563}, + {0, 1, 21, 221, 1561, 8361, 36365, 134245, 433905, 1256465, 3317445}, + {0, 1, 23, 265, 2047, 11969, 56695, 227305, 795455, 2485825, 7059735}, + {0, 1, 25, 313, 2625, 16641, 85305, 369305, 1392065, 4673345, 14218905}, + {0, 1, 27, 365, 3303, 22569, 124515, 579125, 2340495, 8405905, 27298155}, + {0, 1, 29, 421, 4089, 29961, 177045, 880685, 3800305, 14546705, 50250765}, + {0, 1, 31, 481, 4991, 39041, 246047, 1303777, 5984767, 24331777, 89129247}}; + +const LC3_FLOAT lp_scale_factors[6] = {1, 1, 0.6666666666666666, .5, 0.3333333333333333, 0.16666666666666666}; + + +/* 12.8 kHz resampler */ +const LC3_FLOAT highpass50_filt_b[3] = {0.9827947082978771, -1.965589416595754, 0.9827947082978771}; +const LC3_FLOAT highpass50_filt_a[3] = {1, -1.9652933726226904, 0.9658854605688177}; + +const LC3_INT32 resamp_params[][4] = { + {24, 5, 0, 15}, + {12, 10, 1, 3}, + {8, 15, 1, 7}, + {6, 20, 2, 3}, + {4, 30, 3, 3}, + {2, 60, 7, 1} +}; + + +const LC3_FLOAT lp_filter_8[240] = {0.0065408750, 0.0127360141, -0.0320970677, -0.1382038444, 0.8005587459, -0.1382038444, -0.0320970677, 0.0127360141, 0.0065408750, 0.0000000000, 0.0064595463, 0.0084537705, -0.0391003005, -0.1198658869, 0.7945935130, -0.1519452035, -0.0230523963, 0.0167804975, 0.0063002659, -0.0002451667, 0.0060938913, 0.0041435249, -0.0439039879, -0.0980933905, 0.7768620253, -0.1600013375, -0.0122310519, 0.0203715712, 0.0057131811, -0.0005356151, 0.0054914863, 0.0000000000, -0.0464562289, -0.0740769655, 0.7478516698, -0.1614013463, 0.0000000000, 0.0232978407, 0.0047708568, -0.0008596397, 0.0047065411, -0.0038048958, -0.0468063876, -0.0489920303, 0.7083564401, -0.1553338468, 0.0131809860, 0.0253629088, 0.0034824028, -0.0012012133, 0.0037965439, -0.0071282135, -0.0450960808, -0.0239577144, 0.6594504118, -0.1411849856, 0.0267735831, 0.0263961889, 0.0018761361, -0.0015404741, 0.0028190494, -0.0098603060, -0.0415467210, -0.0000000000, 0.6024519205, -0.1185704023, 0.0401797108, 0.0262632743, -0.0000000000, -0.0018545259, 0.0018287648, -0.0119272992, -0.0364444591, 0.0219798349, 0.5388799906, -0.0873604342, 0.0527642742, 0.0248753466, -0.0020790326, -0.0021185349, 0.0008750616, -0.0132916924, -0.0301232301, 0.0412303619, 0.4704038501, -0.0476967618, 0.0638811216, 0.0221970305, -0.0042766319, -0.0023070835, 0.0000000000, -0.0139512215, -0.0229468606, 0.0571681485, 0.3987891078, 0.0000000000, 0.0729012638, 0.0182522610, -0.0064938627, -0.0023957258, -0.0007630716, -0.0139361415, -0.0152910165, 0.0693885013, 0.3258404732, 0.0550325289, 0.0792422444, 0.0131276902, -0.0086209681, -0.0023626641, -0.0013903243, -0.0133052040, -0.0075258445, 0.0776687115, 0.2533447146, 0.1164389849, 0.0823974460, 0.0069732964, -0.0105420630, -0.0021904600, -0.0018676731, -0.0121405739, -0.0000000000, 0.0819641128, 0.1830149740, 0.1830149740, 0.0819641128, -0.0000000000, -0.0121405739, -0.0018676731, -0.0021904600, -0.0105420630, 0.0069732964, 0.0823974460, 0.1164389849, 0.2533447146, 0.0776687115, -0.0075258445, -0.0133052040, -0.0013903243, -0.0023626641, -0.0086209681, 0.0131276902, 0.0792422444, 0.0550325289, 0.3258404732, 0.0693885013, -0.0152910165, -0.0139361415, -0.0007630716, -0.0023957258, -0.0064938627, 0.0182522610, 0.0729012638, 0.0000000000, 0.3987891078, 0.0571681485, -0.0229468606, -0.0139512215, 0.0000000000, -0.0023070835, -0.0042766319, 0.0221970305, 0.0638811216, -0.0476967618, 0.4704038501, 0.0412303619, -0.0301232301, -0.0132916924, 0.0008750616, -0.0021185349, -0.0020790326, 0.0248753466, 0.0527642742, -0.0873604342, 0.5388799906, 0.0219798349, -0.0364444591, -0.0119272992, 0.0018287648, -0.0018545259, -0.0000000000, 0.0262632743, 0.0401797108, -0.1185704023, 0.6024519205, -0.0000000000, -0.0415467210, -0.0098603060, 0.0028190494, -0.0015404741, 0.0018761361, 0.0263961889, 0.0267735831, -0.1411849856, 0.6594504118, -0.0239577144, -0.0450960808, -0.0071282135, 0.0037965439, -0.0012012133, 0.0034824028, 0.0253629088, 0.0131809860, -0.1553338468, 0.7083564401, -0.0489920303, -0.0468063876, -0.0038048958, 0.0047065411, -0.0008596397, 0.0047708568, 0.0232978407, 0.0000000000, -0.1614013463, 0.7478516698, -0.0740769655, -0.0464562289, 0.0000000000, 0.0054914863, -0.0005356151, 0.0057131811, 0.0203715712, -0.0122310519, -0.1600013375, 0.7768620253, -0.0980933905, -0.0439039879, 0.0041435249, 0.0060938913, -0.0002451667, 0.0063002659, 0.0167804975, -0.0230523963, -0.1519452035, 0.7945935130, -0.1198658869, -0.0391003005, 0.0084537705, 0.0064595463}; + +const LC3_FLOAT lp_filter_16[240] = { +-0.0018676731, 0.0065408750, -0.0121405739, 0.0127360141, -0.0000000000, -0.0320970677, 0.0819641128, -0.1382038444, 0.1830149740, 0.8005587459, 0.1830149740, -0.1382038444, 0.0819641128, -0.0320970677, -0.0000000000, 0.0127360141, -0.0121405739, 0.0065408750, -0.0018676731, 0.0000000000, -0.0021904600, 0.0064595463, -0.0105420630, 0.0084537705, 0.0069732964, -0.0391003005, 0.0823974460, -0.1198658869, 0.1164389849, 0.7945935130, 0.2533447146, -0.1519452035, 0.0776687115, -0.0230523963, -0.0075258445, 0.0167804975, -0.0133052040, 0.0063002659, -0.0013903243, -0.0002451667, -0.0023626641, 0.0060938913, -0.0086209681, 0.0041435249, 0.0131276902, -0.0439039879, 0.0792422444, -0.0980933905, 0.0550325289, 0.7768620253, 0.3258404732, -0.1600013375, 0.0693885013, -0.0122310519, -0.0152910165, 0.0203715712, -0.0139361415, 0.0057131811, -0.0007630716, -0.0005356151, -0.0023957258, 0.0054914863, -0.0064938627, 0.0000000000, 0.0182522610, -0.0464562289, 0.0729012638, -0.0740769655, 0.0000000000, 0.7478516698, 0.3987891078, -0.1614013463, 0.0571681485, 0.0000000000, -0.0229468606, 0.0232978407, -0.0139512215, 0.0047708568, 0.0000000000, -0.0008596397, -0.0023070835, 0.0047065411, -0.0042766319, -0.0038048958, 0.0221970305, -0.0468063876, 0.0638811216, -0.0489920303, -0.0476967618, 0.7083564401, 0.4704038501, -0.1553338468, 0.0412303619, 0.0131809860, -0.0301232301, 0.0253629088, -0.0132916924, 0.0034824028, 0.0008750616, -0.0012012133, -0.0021185349, 0.0037965439, -0.0020790326, -0.0071282135, 0.0248753466, -0.0450960808, 0.0527642742, -0.0239577144, -0.0873604342, 0.6594504118, 0.5388799906, -0.1411849856, 0.0219798349, 0.0267735831, -0.0364444591, 0.0263961889, -0.0119272992, 0.0018761361, 0.0018287648, -0.0015404741, -0.0018545259, 0.0028190494, -0.0000000000, -0.0098603060, 0.0262632743, -0.0415467210, 0.0401797108, -0.0000000000, -0.1185704023, 0.6024519205, 0.6024519205, -0.1185704023, -0.0000000000, 0.0401797108, -0.0415467210, 0.0262632743, -0.0098603060, -0.0000000000, 0.0028190494, -0.0018545259, -0.0015404741, 0.0018287648, 0.0018761361, -0.0119272992, 0.0263961889, -0.0364444591, 0.0267735831, 0.0219798349, -0.1411849856, 0.5388799906, 0.6594504118, -0.0873604342, -0.0239577144, 0.0527642742, -0.0450960808, 0.0248753466, -0.0071282135, -0.0020790326, 0.0037965439, -0.0021185349, -0.0012012133, 0.0008750616, 0.0034824028, -0.0132916924, 0.0253629088, -0.0301232301, 0.0131809860, 0.0412303619, -0.1553338468, 0.4704038501, 0.7083564401, -0.0476967618, -0.0489920303, 0.0638811216, -0.0468063876, 0.0221970305, -0.0038048958, -0.0042766319, 0.0047065411, -0.0023070835, -0.0008596397, 0.0000000000, 0.0047708568, -0.0139512215, 0.0232978407, -0.0229468606, 0.0000000000, 0.0571681485, -0.1614013463, 0.3987891078, 0.7478516698, 0.0000000000, -0.0740769655, 0.0729012638, -0.0464562289, 0.0182522610, 0.0000000000, -0.0064938627, 0.0054914863, -0.0023957258, -0.0005356151, -0.0007630716, 0.0057131811, -0.0139361415, 0.0203715712, -0.0152910165, -0.0122310519, 0.0693885013, -0.1600013375, 0.3258404732, 0.7768620253, 0.0550325289, -0.0980933905, 0.0792422444, -0.0439039879, 0.0131276902, 0.0041435249, -0.0086209681, 0.0060938913, -0.0023626641, -0.0002451667, -0.0013903243, 0.0063002659, -0.0133052040, 0.0167804975, -0.0075258445, -0.0230523963, 0.0776687115, -0.1519452035, 0.2533447146, 0.7945935130, 0.1164389849, -0.1198658869, 0.0823974460, -0.0391003005, 0.0069732964, 0.0084537705, -0.0105420630, 0.0064595463, -0.0021904600 +}; + +const LC3_FLOAT lp_filter_24[240] = { +-0.0015380557, 0.0005833744, 0.0043605831, -0.0028510878, -0.0088611282, 0.0084906761, 0.0147980200, -0.0200821534, -0.0213980451, 0.0425874144, 0.0274869073, -0.0921358988, -0.0317978412, 0.3136025667, 0.5337058306, 0.3136025667, -0.0317978412, -0.0921358988, 0.0274869073, 0.0425874144, -0.0213980451, -0.0200821534, 0.0147980200, 0.0084906761, -0.0088611282, -0.0028510878, 0.0043605831, 0.0005833744, -0.0015380557, 0.0000000000, -0.0014123565, 0.0000000000, 0.0043063643, -0.0013860217, -0.0093008140, 0.0056358469, 0.0165835638, -0.0152979074, -0.0260668676, 0.0351761840, 0.0381121002, -0.0799105912, -0.0582402907, 0.2658593953, 0.5297290087, 0.3592533171, 0.0000000000, -0.1012968048, 0.0146532226, 0.0486008413, -0.0153682642, -0.0242963061, 0.0121681746, 0.0111869983, -0.0079515325, -0.0043292418, 0.0042001773, 0.0012191766, -0.0015971506, -0.0001634445, -0.0012363506, -0.0005087144, 0.0040625944, -0.0000000000, -0.0092907613, 0.0027623500, 0.0175088495, -0.0101940110, -0.0292693246, 0.0267864745, 0.0462590009, -0.0653955936, -0.0790469348, 0.2172269821, 0.5179080367, 0.4016346335, 0.0366883539, -0.1066675633, -0.0000000000, 0.0528281629, -0.0081540346, -0.0276978146, 0.0087517938, 0.0135810468, -0.0065735374, -0.0057473122, 0.0038087873, 0.0018793662, -0.0015751094, -0.0003570767, -0.0010269828, -0.0009268829, 0.0036609909, 0.0012507574, -0.0088701360, 0.0000000000, 0.0175974593, -0.0050172298, -0.0309708193, 0.0178490561, 0.0517791398, -0.0493846424, -0.0941233262, 0.1688964665, 0.4985677898, 0.4396336079, 0.0776259899, -0.1076008976, -0.0159718096, 0.0549316332, 0.0000000000, -0.0300640538, 0.0046488643, 0.0155318938, -0.0047521424, -0.0070280419, 0.0031805711, 0.0025310293, -0.0014603067, -0.0005730931, -0.0008008089, -0.0012451154, 0.0031376940, 0.0023216018, -0.0080937156, -0.0025365972, 0.0169086065, -0.0000000000, -0.0312042590, 0.0087873237, 0.0546427406, -0.0326613523, -0.1035559028, 0.1220099851, 0.4722376168, 0.4722376168, 0.1220099851, -0.1035559028, -0.0326613523, 0.0546427406, 0.0087873237, -0.0312042590, -0.0000000000, 0.0169086065, -0.0025365972, -0.0080937156, 0.0023216018, 0.0031376940, -0.0012451154, -0.0008008089, -0.0005730931, -0.0014603067, 0.0025310293, 0.0031805711, -0.0070280419, -0.0047521424, 0.0155318938, 0.0046488643, -0.0300640538, 0.0000000000, 0.0549316332, -0.0159718096, -0.1076008976, 0.0776259899, 0.4396336079, 0.4985677898, 0.1688964665, -0.0941233262, -0.0493846424, 0.0517791398, 0.0178490561, -0.0309708193, -0.0050172298, 0.0175974593, 0.0000000000, -0.0088701360, 0.0012507574, 0.0036609909, -0.0009268829, -0.0010269828, -0.0003570767, -0.0015751094, 0.0018793662, 0.0038087873, -0.0057473122, -0.0065735374, 0.0135810468, 0.0087517938, -0.0276978146, -0.0081540346, 0.0528281629, -0.0000000000, -0.1066675633, 0.0366883539, 0.4016346335, 0.5179080367, 0.2172269821, -0.0790469348, -0.0653955936, 0.0462590009, 0.0267864745, -0.0292693246, -0.0101940110, 0.0175088495, 0.0027623500, -0.0092907613, -0.0000000000, 0.0040625944, -0.0005087144, -0.0012363506, -0.0001634445, -0.0015971506, 0.0012191766, 0.0042001773, -0.0043292418, -0.0079515325, 0.0111869983, 0.0121681746, -0.0242963061, -0.0153682642, 0.0486008413, 0.0146532226, -0.1012968048, 0.0000000000, 0.3592533171, 0.5297290087, 0.2658593953, -0.0582402907, -0.0799105912, 0.0381121002, 0.0351761840, -0.0260668676, -0.0152979074, 0.0165835638, 0.0056358469, -0.0093008140, -0.0013860217, 0.0043063643, 0.0000000000, -0.0014123565 +}; + +const LC3_FLOAT lp_filter_32[240] = { +-0.0009272629, -0.0009338366, 0.0014095247, 0.0032704375, -0.0000000000, -0.0060702870, -0.0049301530, 0.0063680070, 0.0131316371, -0.0000000000, -0.0207733605, -0.0160485338, 0.0200898554, 0.0409820564, -0.0000000000, -0.0691019222, -0.0592852011, 0.0915074870, 0.3012259603, 0.4002793729, 0.3012259603, 0.0915074870, -0.0592852011, -0.0691019222, -0.0000000000, 0.0409820564, 0.0200898554, -0.0160485338, -0.0207733605, -0.0000000000, 0.0131316371, 0.0063680070, -0.0049301530, -0.0060702870, -0.0000000000, 0.0032704375, 0.0014095247, -0.0009338366, -0.0009272629, 0.0000000000, -0.0007702371, -0.0010952300, 0.0009143824, 0.0032297731, 0.0009380680, -0.0052710315, -0.0059636496, 0.0042268853, 0.0131980944, 0.0034866482, -0.0182222296, -0.0195501503, 0.0133867916, 0.0411987230, 0.0109899174, -0.0599329434, -0.0705924928, 0.0582194924, 0.2694399953, 0.3972967565, 0.3297252059, 0.1266723573, -0.0436802171, -0.0759726018, -0.0119788572, 0.0388343558, 0.0263821371, -0.0115261981, -0.0225480404, -0.0037629222, 0.0124376733, 0.0083902488, -0.0035641068, -0.0066526020, -0.0010395163, 0.0031501330, 0.0018982720, -0.0006951622, -0.0010592674, -0.0001225834, -0.0006006067, -0.0011813320, 0.0004375308, 0.0030469457, 0.0017412014, -0.0043104840, -0.0066458462, 0.0020717625, 0.0126814544, 0.0065638451, -0.0150616150, -0.0219519939, 0.0065904930, 0.0396211222, 0.0206151810, -0.0490466952, -0.0776669234, 0.0275162645, 0.2352019250, 0.3884310126, 0.3541782200, 0.1629202366, -0.0238483809, -0.0800006688, -0.0244960152, 0.0346942507, 0.0319405608, -0.0061155260, -0.0234031938, -0.0076455083, 0.0110985152, 0.0101857856, -0.0019024479, -0.0069680708, -0.0021383159, 0.0028565906, 0.0023532705, -0.0003815358, -0.0011535417, -0.0002678075, -0.0004298199, -0.0011978629, 0.0000000000, 0.0027457431, 0.0023854284, -0.0032469314, -0.0069756107, 0.0000000000, 0.0116489204, 0.0091261305, -0.0114734303, -0.0232281145, 0.0000000000, 0.0364506319, 0.0285840742, -0.0370384827, -0.0807006732, 0.0000000000, 0.1993945539, 0.3739258349, 0.3739258349, 0.1993945539, 0.0000000000, -0.0807006732, -0.0370384827, 0.0285840742, 0.0364506319, 0.0000000000, -0.0232281145, -0.0114734303, 0.0091261305, 0.0116489204, 0.0000000000, -0.0069756107, -0.0032469314, 0.0023854284, 0.0027457431, 0.0000000000, -0.0011978629, -0.0004298199, -0.0002678075, -0.0011535417, -0.0003815358, 0.0023532705, 0.0028565906, -0.0021383159, -0.0069680708, -0.0019024479, 0.0101857856, 0.0110985152, -0.0076455083, -0.0234031938, -0.0061155260, 0.0319405608, 0.0346942507, -0.0244960152, -0.0800006688, -0.0238483809, 0.1629202366, 0.3541782200, 0.3884310126, 0.2352019250, 0.0275162645, -0.0776669234, -0.0490466952, 0.0206151810, 0.0396211222, 0.0065904930, -0.0219519939, -0.0150616150, 0.0065638451, 0.0126814544, 0.0020717625, -0.0066458462, -0.0043104840, 0.0017412014, 0.0030469457, 0.0004375308, -0.0011813320, -0.0006006067, -0.0001225834, -0.0010592674, -0.0006951622, 0.0018982720, 0.0031501330, -0.0010395163, -0.0066526020, -0.0035641068, 0.0083902488, 0.0124376733, -0.0037629222, -0.0225480404, -0.0115261981, 0.0263821371, 0.0388343558, -0.0119788572, -0.0759726018, -0.0436802171, 0.1266723573, 0.3297252059, 0.3972967565, 0.2694399953, 0.0582194924, -0.0705924928, -0.0599329434, 0.0109899174, 0.0411987230, 0.0133867916, -0.0195501503, -0.0182222296, 0.0034866482, 0.0131980944, 0.0042268853, -0.0059636496, -0.0052710315, 0.0009380680, 0.0032297731, 0.0009143824, -0.0010952300, -0.0007702371 +}; + +const LC3_FLOAT lp_filter_48[240] = { +-0.0004004044, -0.0007690279, -0.0006225577, 0.0002916872, 0.0015688470, 0.0021802916, 0.0011608009, -0.0014255439, -0.0040468578, -0.0044305641, -0.0012682986, 0.0042453380, 0.0084543033, 0.0073990100, -0.0000000000, -0.0100410767, -0.0156021295, -0.0106990226, 0.0043936619, 0.0212937072, 0.0273213703, 0.0137434537, -0.0163306762, -0.0460679494, -0.0517779514, -0.0158989206, 0.0610049926, 0.1568012834, 0.2361188084, 0.2668529153, 0.2361188084, 0.1568012834, 0.0610049926, -0.0158989206, -0.0517779514, -0.0460679494, -0.0163306762, 0.0137434537, 0.0273213703, 0.0212937072, 0.0043936619, -0.0106990226, -0.0156021295, -0.0100410767, -0.0000000000, 0.0073990100, 0.0084543033, 0.0042453380, -0.0012682986, -0.0044305641, -0.0040468578, -0.0014255439, 0.0011608009, 0.0021802916, 0.0015688470, 0.0002916872, -0.0006225577, -0.0007690279, -0.0004004044, 0.0000000000, -0.0002865466, -0.0007061783, -0.0007301533, 0.0000000000, 0.0012655146, 0.0021531822, 0.0015902856, -0.0006930109, -0.0035140209, -0.0046504070, -0.0023760712, 0.0028179234, 0.0077659469, 0.0082917819, 0.0023244321, -0.0076489537, -0.0150320269, -0.0130334338, 0.0000000000, 0.0175880920, 0.0274658166, 0.0190560501, -0.0079859048, -0.0399552956, -0.0538004488, -0.0291201454, 0.0388129950, 0.1329296976, 0.2198168039, 0.2648645043, 0.2492838949, 0.1796266586, 0.0844482332, 0.0000000000, -0.0470616631, -0.0506484024, -0.0246923212, 0.0073266113, 0.0258895699, 0.0243004207, 0.0089245280, -0.0076841321, -0.0154854096, -0.0121481530, -0.0025086149, 0.0060840873, 0.0087987296, 0.0055934992, 0.0000000000, -0.0039757662, -0.0044350680, -0.0021646209, 0.0006253787, 0.0021000886, 0.0018304954, 0.0006095883, -0.0004634415, -0.0007985753, -0.0005134914, -0.0000817222, -0.0001785384, -0.0006181753, -0.0007875547, -0.0002543572, 0.0009396831, 0.0020312972, 0.0019043937, -0.0000000000, -0.0028736561, -0.0046453807, -0.0032867687, 0.0013811750, 0.0067905234, 0.0087544248, 0.0043758969, -0.0050970055, -0.0138489073, -0.0146346623, -0.0040770173, 0.0133932373, 0.0264140815, 0.0231295004, -0.0000000000, -0.0326977968, -0.0533337817, -0.0395234674, 0.0183441769, 0.1086134911, 0.2008173168, 0.2589540184, 0.2589540184, 0.2008173168, 0.1086134911, 0.0183441769, -0.0395234674, -0.0533337817, -0.0326977968, -0.0000000000, 0.0231295004, 0.0264140815, 0.0133932373, -0.0040770173, -0.0146346623, -0.0138489073, -0.0050970055, 0.0043758969, 0.0087544248, 0.0067905234, 0.0013811750, -0.0032867687, -0.0046453807, -0.0028736561, -0.0000000000, 0.0019043937, 0.0020312972, 0.0009396831, -0.0002543572, -0.0007875547, -0.0006181753, -0.0001785384, -0.0000817222, -0.0005134914, -0.0007985753, -0.0004634415, 0.0006095883, 0.0018304954, 0.0021000886, 0.0006253787, -0.0021646209, -0.0044350680, -0.0039757662, 0.0000000000, 0.0055934992, 0.0087987296, 0.0060840873, -0.0025086149, -0.0121481530, -0.0154854096, -0.0076841321, 0.0089245280, 0.0243004207, 0.0258895699, 0.0073266113, -0.0246923212, -0.0506484024, -0.0470616631, 0.0000000000, 0.0844482332, 0.1796266586, 0.2492838949, 0.2648645043, 0.2198168039, 0.1329296976, 0.0388129950, -0.0291201454, -0.0538004488, -0.0399552956, -0.0079859048, 0.0190560501, 0.0274658166, 0.0175880920, 0.0000000000, -0.0130334338, -0.0150320269, -0.0076489537, 0.0023244321, 0.0082917819, 0.0077659469, 0.0028179234, -0.0023760712, -0.0046504070, -0.0035140209, -0.0006930109, 0.0015902856, 0.0021531822, 0.0012655146, 0.0000000000, -0.0007301533, -0.0007061783, -0.0002865466 +}; + +const LC3_FLOAT lp_filter_96[240] = { +-0.0000892692, -0.0002002022, -0.0003090877, -0.0003845139, -0.0003937774, -0.0003112789, -0.0001271786, 0.0001458436, 0.0004698416, 0.0007844235, 0.0010156486, 0.0010901458, 0.0009521968, 0.0005804005, -0.0000000000, -0.0007127720, -0.0014368281, -0.0020234289, -0.0023226903, -0.0022152821, -0.0016433843, -0.0006341493, 0.0006905875, 0.0021226690, 0.0033952617, 0.0042271516, 0.0043772124, 0.0036995050, 0.0021879484, -0.0000000000, -0.0025485028, -0.0050205383, -0.0069244537, -0.0078010648, -0.0073173312, -0.0053495113, -0.0020385087, 0.0021968309, 0.0066966186, 0.0106468536, 0.0132070407, 0.0136606852, 0.0115647502, 0.0068717268, -0.0000000000, -0.0081653381, -0.0163488984, -0.0230339747, -0.0266668908, -0.0258889757, -0.0197617337, -0.0079494603, 0.0091720885, 0.0305024963, 0.0543067455, 0.0784006417, 0.1004086584, 0.1180594042, 0.1294770092, 0.1334264576, 0.1294770092, 0.1180594042, 0.1004086584, 0.0784006417, 0.0543067455, 0.0305024963, 0.0091720885, -0.0079494603, -0.0197617337, -0.0258889757, -0.0266668908, -0.0230339747, -0.0163488984, -0.0081653381, -0.0000000000, 0.0068717268, 0.0115647502, 0.0136606852, 0.0132070407, 0.0106468536, 0.0066966186, 0.0021968309, -0.0020385087, -0.0053495113, -0.0073173312, -0.0078010648, -0.0069244537, -0.0050205383, -0.0025485028, -0.0000000000, 0.0021879484, 0.0036995050, 0.0043772124, 0.0042271516, 0.0033952617, 0.0021226690, 0.0006905875, -0.0006341493, -0.0016433843, -0.0022152821, -0.0023226903, -0.0020234289, -0.0014368281, -0.0007127720, -0.0000000000, 0.0005804005, 0.0009521968, 0.0010901458, 0.0010156486, 0.0007844235, 0.0004698416, 0.0001458436, -0.0001271786, -0.0003112789, -0.0003937774, -0.0003845139, -0.0003090877, -0.0002002022, -0.0000892692, 0.0000000000, -0.0000408611, -0.0001432733, -0.0002567457, -0.0003530891, -0.0003992876, -0.0003650767, -0.0002317207, 0.0000000000, 0.0003047941, 0.0006327573, 0.0009152477, 0.0010765911, 0.0010500443, 0.0007951428, 0.0003126893, -0.0003465054, -0.0010823105, -0.0017570105, -0.0022175340, -0.0023252035, -0.0019878831, -0.0011880356, 0.0000000000, 0.0014089617, 0.0027967496, 0.0038829735, 0.0043993648, 0.0041458909, 0.0030420437, 0.0011622161, -0.0012543075, -0.0038244769, -0.0060740765, -0.0075160135, -0.0077427048, -0.0065167169, -0.0038420660, 0.0000000000, 0.0044622640, 0.0087940460, 0.0121502103, 0.0137329083, 0.0129447849, 0.0095280251, 0.0036633057, -0.0039929524, -0.0123461606, -0.0199776478, -0.0253242012, -0.0269002244, -0.0235308316, -0.0145600727, 0.0000000000, 0.0194064975, 0.0422241166, 0.0664648488, 0.0898133293, 0.1099084020, 0.1246419474, 0.1324322522, 0.1324322522, 0.1246419474, 0.1099084020, 0.0898133293, 0.0664648488, 0.0422241166, 0.0194064975, 0.0000000000, -0.0145600727, -0.0235308316, -0.0269002244, -0.0253242012, -0.0199776478, -0.0123461606, -0.0039929524, 0.0036633057, 0.0095280251, 0.0129447849, 0.0137329083, 0.0121502103, 0.0087940460, 0.0044622640, 0.0000000000, -0.0038420660, -0.0065167169, -0.0077427048, -0.0075160135, -0.0060740765, -0.0038244769, -0.0012543075, 0.0011622161, 0.0030420437, 0.0041458909, 0.0043993648, 0.0038829735, 0.0027967496, 0.0014089617, 0.0000000000, -0.0011880356, -0.0019878831, -0.0023252035, -0.0022175340, -0.0017570105, -0.0010823105, -0.0003465054, 0.0003126893, 0.0007951428, 0.0010500443, 0.0010765911, 0.0009152477, 0.0006327573, 0.0003047941, 0.0000000000, -0.0002317207, -0.0003650767, -0.0003992876, -0.0003530891, -0.0002567457, -0.0001432733, -0.0000408611 +}; + +const LC3_FLOAT *lp_filter[] = {lp_filter_8, lp_filter_16, lp_filter_24, lp_filter_32, lp_filter_48, lp_filter_96}; + +const LC3_INT up_fac[6] = {24, 12, 8, 6, 4, 2}; + +/* TNS */ +const LC3_INT huff_bits_tns[8][17] = { + {20480, 15725, 12479, 10334, 8694, 7320, 6964, 6335, 5504, 5637, 6566, 6758, 8433, 11348, 15186, 20480, 20480}, + {20480, 20480, 20480, 20480, 12902, 9368, 7057, 5901, 5254, 5485, 5598, 6076, 7608, 10742, 15186, 20480, 20480}, + {20480, 20480, 20480, 20480, 13988, 9368, 6702, 4841, 4585, 4682, 5859, 7764, 12109, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 18432, 13396, 8982, 4767, 3779, 3658, 6335, 9656, 13988, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 20480, 14731, 9437, 4275, 3249, 3493, 8483, 13988, 17234, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 20480, 20480, 12902, 4753, 3040, 2953, 9105, 15725, 20480, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 20480, 20480, 12902, 3821, 3346, 3000, 12109, 20480, 20480, 20480, 20480, 20480, + 20480}, + {20480, 20480, 20480, 20480, 20480, 20480, 15725, 3658, 20480, 1201, 10854, 18432, 20480, 20480, 20480, 20480, + 20480}}; + +const LC3_INT order1_tns[8] = {17234, 13988, 11216, 8694, 6566, 4977, 3961, 3040}; +const LC3_INT order2_tns[8] = {12683, 9437, 6874, 5541, 5121, 5170, 5359, 5056}; + +const LC3_FLOAT lagw_tns[9] = {1, + 0.998028026020383, + 0.992135405511397, + 0.982391584470799, + 0.968910791191297, + 0.951849807369274, + 0.931404933402306, + 0.907808229996959, + 0.881323136669471}; + +const LC3_FLOAT quants_pts_tns[17] = { -0.995727539062500, -0.961822509765625, -0.895172119140625, + -0.798004150390625, -0.673706054687500, -0.526428222656250, + -0.361236572265625, -0.183746337890625, 0.000000000000000, + 0.183746337890625, 0.361236572265625, 0.526428222656250, + 0.673706054687500, 0.798004150390625, 0.895172119140625, + 0.961822509765625, 0.995727539062500}; + +const LC3_FLOAT quants_thr_tns[18] = {-1, + -0.982973099683902, + -0.932472229404356, + -0.850217135729614, + -0.739008917220659, + -0.602634636379256, + -0.445738355776538, + -0.273662990072083, + -0.0922683594633020, + 0.0922683594633020, + 0.273662990072083, + 0.445738355776538, + 0.602634636379256, + 0.739008917220659, + 0.850217135729614, + 0.932472229404356, + 0.982973099683902, + 1}; + +/* SNS */ +const LC3_FLOAT sns_vq_far_adj_gains_fl[8] = {1.05859375000000, 1.23706054687500, 1.43920898437500, 1.98950195312500, + 2.49877929687500, 3.13110351562500, 4.11816406250000, 4.85400390625000}; + +const LC3_FLOAT sns_vq_near_adj_gains_fl[4] = {1.73315429687500, 2.22949218750000, 2.74731445312500, 3.61523437500000}; + +const LC3_FLOAT sns_vq_reg_lf_adj_gains_fl[4] = {1.52465820312500, 3.67260742187500, 4.36059570312500, + 5.13037109375000}; + +const LC3_FLOAT q_g_sns[6] = {2.17651367187500, 2.94287109375000, 1.52465820312500, + 3.67260742187500, 4.36059570312500, 5.13037109375000}; + +const LC3_FLOAT sns_vq_reg_adj_gains_fl[2] = {2.17651367187500, 2.94287109375000}; + +/* First element in each row is multiplied with norm2 = 1 / sqrt(2) */ +const LC3_FLOAT idct_lookup[M][M] = { + {0.707106781186547, 0.995184726672197, 0.980785280403230, 0.956940335732209, 0.923879532511287, 0.881921264348355, 0.831469612302545, 0.773010453362737, 0.707106781186548, 0.634393284163646, 0.555570233019602, 0.471396736825998, 0.382683432365090, 0.290284677254462, 0.195090322016128, 0.0980171403295608}, + {0.707106781186547, 0.956940335732209, 0.831469612302545, 0.634393284163646, 0.382683432365090, 0.0980171403295608, -0.195090322016128, -0.471396736825998, -0.707106781186548, -0.881921264348355, -0.980785280403230, -0.995184726672197, -0.923879532511287, -0.773010453362737, -0.555570233019602, -0.290284677254462}, + {0.707106781186547, 0.881921264348355, 0.555570233019602, 0.0980171403295608, -0.382683432365090, -0.773010453362737, -0.980785280403230, -0.956940335732209, -0.707106781186548, -0.290284677254462, 0.195090322016128, 0.634393284163646, 0.923879532511287, 0.995184726672197, 0.831469612302546, 0.471396736825998}, + {0.707106781186547, 0.773010453362737, 0.195090322016128, -0.471396736825998, -0.923879532511287, -0.956940335732209, -0.555570233019602, 0.0980171403295601, 0.707106781186547, 0.995184726672197, 0.831469612302546, 0.290284677254463, -0.382683432365090, -0.881921264348355, -0.980785280403231, -0.634393284163645}, + {0.707106781186547, 0.634393284163646, -0.195090322016128, -0.881921264348355, -0.923879532511287, -0.290284677254462, 0.555570233019602, 0.995184726672197, 0.707106781186548, -0.0980171403295600, -0.831469612302545, -0.956940335732209, -0.382683432365091, 0.471396736825997, 0.980785280403230, 0.773010453362738}, + {0.707106781186547, 0.471396736825998, -0.555570233019602, -0.995184726672197, -0.382683432365090, 0.634393284163645, 0.980785280403231, 0.290284677254463, -0.707106781186547, -0.956940335732209, -0.195090322016130, 0.773010453362736, 0.923879532511287, 0.0980171403295626, -0.831469612302544, -0.881921264348356}, + {0.707106781186547, 0.290284677254462, -0.831469612302545, -0.773010453362737, 0.382683432365090, 0.995184726672197, 0.195090322016128, -0.881921264348356, -0.707106781186547, 0.471396736825997, 0.980785280403230, 0.0980171403295591, -0.923879532511287, -0.634393284163646, 0.555570233019604, 0.956940335732208}, + {0.707106781186547, 0.0980171403295608, -0.980785280403230, -0.290284677254463, 0.923879532511287, 0.471396736825998, -0.831469612302544, -0.634393284163647, 0.707106781186547, 0.773010453362738, -0.555570233019602, -0.881921264348356, 0.382683432365086, 0.956940335732209, -0.195090322016125, -0.995184726672197}, + {0.707106781186547, -0.0980171403295607, -0.980785280403230, 0.290284677254463, 0.923879532511287, -0.471396736825998, -0.831469612302545, 0.634393284163646, 0.707106781186547, -0.773010453362737, -0.555570233019603, 0.881921264348356, 0.382683432365088, -0.956940335732209, -0.195090322016127, 0.995184726672197}, + {0.707106781186547, -0.290284677254462, -0.831469612302546, 0.773010453362737, 0.382683432365090, -0.995184726672197, 0.195090322016127, 0.881921264348356, -0.707106781186547, -0.471396736825998, 0.980785280403230, -0.0980171403295577, -0.923879532511288, 0.634393284163644, 0.555570233019606, -0.956940335732208}, + {0.707106781186547, -0.471396736825998, -0.555570233019602, 0.995184726672197, -0.382683432365090, -0.634393284163645, 0.980785280403230, -0.290284677254463, -0.707106781186547, 0.956940335732209, -0.195090322016129, -0.773010453362737, 0.923879532511287, -0.0980171403295610, -0.831469612302545, 0.881921264348355}, + {0.707106781186547, -0.634393284163645, -0.195090322016129, 0.881921264348355, -0.923879532511286, 0.290284677254461, 0.555570233019603, -0.995184726672197, 0.707106781186547, 0.0980171403295628, -0.831469612302547, 0.956940335732208, -0.382683432365089, -0.471396736825999, 0.980785280403231, -0.773010453362733}, + {0.707106781186547, -0.773010453362737, 0.195090322016128, 0.471396736825998, -0.923879532511287, 0.956940335732209, -0.555570233019602, -0.0980171403295592, 0.707106781186548, -0.995184726672197, 0.831469612302546, -0.290284677254462, -0.382683432365091, 0.881921264348355, -0.980785280403231, 0.634393284163644}, + {0.707106781186547, -0.881921264348355, 0.555570233019602, -0.0980171403295600, -0.382683432365091, 0.773010453362738, -0.980785280403231, 0.956940335732208, -0.707106781186546, 0.290284677254462, 0.195090322016130, -0.634393284163649, 0.923879532511288, -0.995184726672197, 0.831469612302542, -0.471396736825993}, + {0.707106781186547, -0.956940335732209, 0.831469612302545, -0.634393284163645, 0.382683432365090, -0.0980171403295615, -0.195090322016130, 0.471396736825998, -0.707106781186548, 0.881921264348355, -0.980785280403230, 0.995184726672197, -0.923879532511285, 0.773010453362735, -0.555570233019601, 0.290284677254462}, + {0.707106781186547, -0.995184726672197, 0.980785280403230, -0.956940335732209, 0.923879532511286, -0.881921264348355, 0.831469612302544, -0.773010453362736, 0.707106781186546, -0.634393284163644, 0.555570233019601, -0.471396736825994, 0.382683432365086, -0.290284677254458, 0.195090322016124, -0.0980171403295567} +}; + +const LC3_FLOAT sns_dec_gains[4][8] = { + {2.17651367187500, 2.94287109375000, 0, 0, 0, 0, 0, 0}, + {1.52465820312500, 3.67260742187500, 4.36059570312500, 5.13037109375000, 0, 0, 0, 0}, + {1.73315429687500, 2.22949218750000, 2.74731445312500, 3.61523437500000, 0, 0, 0, 0}, + {1.05859375000000, 1.23706054687500, 1.43920898437500, 1.98950195312500, 2.49877929687500, 3.13110351562500, + 4.11816406250000, 4.85400390625000}}; + +/* Global Gain */ +const LC3_INT gg_p1[6] = {80, 230, 380, 530, 680, 830}; +const LC3_INT gg_p2[6] = {500, 1025, 1550, 2075, 2600, 3125}; +const LC3_INT gg_p3[6] = {850, 1700, 2550, 3400, 4250, 5100}; + +const LC3_FLOAT gg_c[6] = {0.00575396825396825, 0.00500524109014675, 0.00473646723646723, + 0.00459816612729234, 0.00451388888888889, 0.004457153231663}; +const LC3_FLOAT gg_d[6] = {1310.34482758621, 3241.36125654450, 5267.66917293233, + 7326.39296187684, 9400.00000000000, 11481.67006109979}; + +/* Olpa */ +const LC3_FLOAT olpa_down2[5] = {0.1236796411180537, 0.2353512128364889, 0.2819382920909148, 0.2353512128364889, + 0.1236796411180537}; + +const LC3_FLOAT olpa_acw[98] = {1.0, + 0.994845360824742, + 0.989690721649485, + 0.984536082474227, + 0.979381443298969, + 0.974226804123711, + 0.969072164948454, + 0.963917525773196, + 0.958762886597938, + 0.953608247422680, + 0.948453608247423, + 0.943298969072165, + 0.938144329896907, + 0.932989690721650, + 0.927835051546392, + 0.922680412371134, + 0.917525773195876, + 0.912371134020619, + 0.907216494845361, + 0.902061855670103, + 0.896907216494845, + 0.891752577319588, + 0.886597938144330, + 0.881443298969072, + 0.876288659793814, + 0.871134020618557, + 0.865979381443299, + 0.860824742268041, + 0.855670103092784, + 0.850515463917526, + 0.845360824742268, + 0.840206185567010, + 0.835051546391753, + 0.829896907216495, + 0.824742268041237, + 0.819587628865979, + 0.814432989690722, + 0.809278350515464, + 0.804123711340206, + 0.798969072164949, + 0.793814432989691, + 0.788659793814433, + 0.783505154639175, + 0.778350515463918, + 0.773195876288660, + 0.768041237113402, + 0.762886597938144, + 0.757731958762887, + 0.752577319587629, + 0.747422680412371, + 0.742268041237113, + 0.737113402061856, + 0.731958762886598, + 0.726804123711340, + 0.721649484536083, + 0.716494845360825, + 0.711340206185567, + 0.706185567010309, + 0.701030927835052, + 0.695876288659794, + 0.690721649484536, + 0.685567010309278, + 0.680412371134021, + 0.675257731958763, + 0.670103092783505, + 0.664948453608247, + 0.659793814432990, + 0.654639175257732, + 0.649484536082474, + 0.644329896907216, + 0.639175257731959, + 0.634020618556701, + 0.628865979381443, + 0.623711340206186, + 0.618556701030928, + 0.613402061855670, + 0.608247422680412, + 0.603092783505155, + 0.597938144329897, + 0.592783505154639, + 0.587628865979382, + 0.582474226804124, + 0.577319587628866, + 0.572164948453608, + 0.567010309278351, + 0.561855670103093, + 0.556701030927835, + 0.551546391752577, + 0.546391752577320, + 0.541237113402062, + 0.536082474226804, + 0.530927835051546, + 0.525773195876289, + 0.520618556701031, + 0.515463917525773, + 0.510309278350515, + 0.505154639175258, + 0.500000000000000}; + +/* LTPF */ +const LC3_FLOAT conf_tilt_filter_16[4][3] = {{6.023618207009578e-01, 4.197609261363617e-01, -1.883424527883687e-02}, + {5.994768582584314e-01, 4.197609261363620e-01, -1.594928283631041e-02}, + {5.967764663733787e-01, 4.197609261363617e-01, -1.324889095125780e-02}, + {5.942410120098895e-01, 4.197609261363618e-01, -1.071343658776831e-02}}; + +const LC3_FLOAT conf_tilt_filter_24[4][5] = {{3.989695588963494e-01, 5.142508607708275e-01, 1.004382966157454e-01, + -1.278893956818042e-02, -1.572280075461383e-03}, + {3.948634911286333e-01, 5.123819208048688e-01, 1.043194926386267e-01, + -1.091999960222166e-02, -1.347408330627317e-03}, + {3.909844475885914e-01, 5.106053522688359e-01, 1.079832524685944e-01, + -9.143431066188848e-03, -1.132124620551895e-03}, + {3.873093888199928e-01, 5.089122083363975e-01, 1.114517380217371e-01, + -7.450287133750717e-03, -9.255514050963111e-04}}; + +const LC3_FLOAT conf_tilt_filter_32[4][7] = { + {2.982379446702096e-01, 4.652809203721290e-01, 2.105997428614279e-01, 3.766780380806063e-02, -1.015696155796564e-02, + -2.535880996101096e-03, -3.182946168719958e-04}, + {2.943834154510240e-01, 4.619294002718798e-01, 2.129465770091844e-01, 4.066175002688857e-02, -8.693272297010050e-03, + -2.178307114679820e-03, -2.742888063983188e-04}, + {2.907439213122688e-01, 4.587461910960279e-01, 2.151456974108970e-01, 4.350104772529774e-02, -7.295495347716925e-03, + -1.834395637237086e-03, -2.316920186482416e-04}, + {2.872975852589158e-01, 4.557148886861379e-01, 2.172126950911401e-01, 4.620088878229615e-02, -5.957463802125952e-03, + -1.502934284345198e-03, -1.903851911308866e-04}}; + +const LC3_FLOAT conf_tilt_filter_48[4][11] = { + {1.981363739883217e-01, 3.524494903964904e-01, 2.513695269649414e-01, 1.424146237314458e-01, 5.704731023952599e-02, + 9.293366241586384e-03, -7.226025368953745e-03, -3.172679890356356e-03, -1.121835963567014e-03, + -2.902957238400140e-04, -4.270815593769240e-05}, + {1.950709426598375e-01, 3.484660408341632e-01, 2.509988459466574e-01, 1.441167412482088e-01, 5.928947317677285e-02, + 1.108923827452231e-02, -6.192908108653504e-03, -2.726705509251737e-03, -9.667125826217151e-04, + -2.508100923165204e-04, -3.699938766131869e-05}, + {1.921810055196015e-01, 3.446945561091513e-01, 2.506220094626024e-01, 1.457102447664837e-01, 6.141132133664525e-02, + 1.279941396562798e-02, -5.203721087886321e-03, -2.297324511109085e-03, -8.165608133217555e-04, + -2.123855748277408e-04, -3.141271330981649e-05}, + {1.894485314175868e-01, 3.411139251108252e-01, 2.502406876894361e-01, 1.472065631098081e-01, 6.342477229539051e-02, + 1.443203434150312e-02, -4.254449144657098e-03, -1.883081472613493e-03, -6.709619060722140e-04, + -1.749363341966872e-04, -2.593864735284285e-05}}; + +const LC3_FLOAT conf_inter_filter_16[4][4] = { + {2.098804630681809e-01, 5.835275754221211e-01, 2.098804630681809e-01, 0.000000000000000e+00}, + {1.069991860896389e-01, 5.500750019177116e-01, 3.356906254147840e-01, 6.698858366939680e-03}, + {3.967114782344967e-02, 4.592209296082350e-01, 4.592209296082350e-01, 3.967114782344967e-02}, + {6.698858366939680e-03, 3.356906254147840e-01, 5.500750019177116e-01, 1.069991860896389e-01}}; + +const LC3_FLOAT conf_inter_filter_24[4][6] = {{6.322231627323796e-02, 2.507309606013235e-01, 3.713909428901578e-01, + 2.507309606013235e-01, 6.322231627323796e-02, 0.000000000000000e+00}, + {3.459272174099855e-02, 1.986515602645028e-01, 3.626411726581452e-01, + 2.986750548992179e-01, 1.013092873505928e-01, 4.263543712369752e-03}, + {1.535746784963907e-02, 1.474344878058222e-01, 3.374259553990717e-01, + 3.374259553990717e-01, 1.474344878058222e-01, 1.535746784963907e-02}, + {4.263543712369752e-03, 1.013092873505928e-01, 2.986750548992179e-01, + 3.626411726581452e-01, 1.986515602645028e-01, 3.459272174099855e-02}}; + +const LC3_FLOAT conf_inter_filter_32[4][8] = { + {2.900401878228730e-02, 1.129857420560927e-01, 2.212024028097570e-01, 2.723909472446145e-01, 2.212024028097570e-01, + 1.129857420560927e-01, 2.900401878228730e-02, 0.000000000000000e+00}, + {1.703153418385261e-02, 8.722503785537784e-02, 1.961407762232199e-01, 2.689237982237257e-01, 2.424999102756389e-01, + 1.405773364650031e-01, 4.474877169485788e-02, 3.127030243100724e-03}, + {8.563673748488349e-03, 6.426222944493845e-02, 1.687676705918012e-01, 2.587445937795505e-01, 2.587445937795505e-01, + 1.687676705918012e-01, 6.426222944493845e-02, 8.563673748488349e-03}, + {3.127030243100724e-03, 4.474877169485788e-02, 1.405773364650031e-01, 2.424999102756389e-01, 2.689237982237257e-01, + 1.961407762232199e-01, 8.722503785537784e-02, 1.703153418385261e-02}}; + +const LC3_FLOAT conf_inter_filter_48[4][12] = { + {1.082359386659387e-02, 3.608969221303979e-02, 7.676401468099964e-02, 1.241530577501703e-01, 1.627596438300696e-01, + 1.776771417779109e-01, 1.627596438300696e-01, 1.241530577501703e-01, 7.676401468099964e-02, 3.608969221303979e-02, + 1.082359386659387e-02, 0.000000000000000e+00}, + {7.041404930459358e-03, 2.819702319820420e-02, 6.547044935127551e-02, 1.124647986743299e-01, 1.548418956489015e-01, + 1.767122381341857e-01, 1.691507213057663e-01, 1.352901577989766e-01, 8.851425011427483e-02, 4.499353848562444e-02, + 1.557613714732002e-02, 2.039721956502016e-03}, + {4.146998467444788e-03, 2.135757310741917e-02, 5.482735584552816e-02, 1.004971444643720e-01, 1.456060342830002e-01, + 1.738439838565869e-01, 1.738439838565869e-01, 1.456060342830002e-01, 1.004971444643720e-01, 5.482735584552816e-02, + 2.135757310741917e-02, 4.146998467444788e-03}, + {2.039721956502016e-03, 1.557613714732002e-02, 4.499353848562444e-02, 8.851425011427483e-02, 1.352901577989766e-01, + 1.691507213057663e-01, 1.767122381341857e-01, 1.548418956489015e-01, 1.124647986743299e-01, 6.547044935127551e-02, + 2.819702319820420e-02, 7.041404930459358e-03}}; + +const LC3_FLOAT inter4_1[33] = {0, + -2.874561161519444e-03, + -3.001251025861499e-03, + +2.745471654059321e-03, + +1.535727698935322e-02, + +2.868234046665657e-02, + +2.950385026557377e-02, + +4.598334491135473e-03, + -4.729632459043440e-02, + -1.058359163062837e-01, + -1.303050213607112e-01, + -7.544046357555201e-02, + +8.357885725250529e-02, + +3.301825710764459e-01, + +6.032970076366158e-01, + +8.174886856243178e-01, + +8.986382851273982e-01, + +8.174886856243178e-01, + +6.032970076366158e-01, + +3.301825710764459e-01, + +8.357885725250529e-02, + -7.544046357555201e-02, + -1.303050213607112e-01, + -1.058359163062837e-01, + -4.729632459043440e-02, + +4.598334491135473e-03, + +2.950385026557377e-02, + +2.868234046665657e-02, + +1.535727698935322e-02, + +2.745471654059321e-03, + -3.001251025861499e-03, + -2.874561161519444e-03, + 0}; + +const LC3_FLOAT enc_inter_filter[4][4] = { + {+2.098804630681809e-01, +5.835275754221211e-01, +2.098804630681809e-01, 0}, + {+1.069991860896389e-01, +5.500750019177116e-01, +3.356906254147840e-01, +6.698858366939680e-03}, + {+3.967114782344967e-02, +4.592209296082350e-01, +4.592209296082350e-01, +3.967114782344967e-02}, + {+6.698858366939680e-03, +3.356906254147840e-01, +5.500750019177116e-01, +1.069991860896389e-01}}; + +/* Bandwidth Detector */ +const LC3_INT threshold_quiet[4] = {20, 10, 10, 10}; +const LC3_INT threshold_brickwall[4] = {15, 23, 20, 20}; +const LC3_INT brickwall_dist[4] = {4, 4, 3, 1}; +const LC3_INT BW_warp_idx_start_16k[4] = {53, 0, 0, 0}; +const LC3_INT BW_warp_idx_stop_16k[4] = {63, 0, 0, 0}; +const LC3_INT BW_warp_idx_start_24k[4] = {47, 59, 0, 0}; +const LC3_INT BW_warp_idx_stop_24k[4] = {56, 63, 0, 0}; +const LC3_INT BW_warp_idx_start_32k[4] = {44, 54, 60, 0}; +const LC3_INT BW_warp_idx_stop_32k[4] = {52, 59, 63, 0}; +const LC3_INT BW_warp_idx_start_48k[4] = {41, 51, 57, 61}; +const LC3_INT BW_warp_idx_stop_48k[4] = {49, 55, 60, 63}; +const LC3_INT* BW_warp_idx_start_all[4] = {BW_warp_idx_start_16k, BW_warp_idx_start_24k, BW_warp_idx_start_32k, + BW_warp_idx_start_48k}; +const LC3_INT* BW_warp_idx_stop_all[4] = {BW_warp_idx_stop_16k, BW_warp_idx_stop_24k, BW_warp_idx_stop_32k, + BW_warp_idx_stop_48k}; + +const LC3_INT BW_warp_idx_start_16k_2_5ms[4] = {24, 0, 0, 0}; +const LC3_INT BW_warp_idx_stop_16k_2_5ms[4] = {34, 0, 0, 0}; +const LC3_INT BW_warp_idx_start_24k_2_5ms[4] = {24, 35, 0, 0}; +const LC3_INT BW_warp_idx_stop_24k_2_5ms[4] = {32, 39, 0, 0}; +const LC3_INT BW_warp_idx_start_32k_2_5ms[4] = {24, 33, 39, 0}; +const LC3_INT BW_warp_idx_stop_32k_2_5ms[4] = {31, 38, 42, 0}; +const LC3_INT BW_warp_idx_start_48k_2_5ms[4] = {22, 31, 37, 41}; +const LC3_INT BW_warp_idx_stop_48k_2_5ms[4] = {29, 35, 40, 43}; + +const LC3_INT* BW_warp_idx_start_all_2_5ms[4] = {BW_warp_idx_start_16k_2_5ms, BW_warp_idx_start_24k_2_5ms, + BW_warp_idx_start_32k_2_5ms, BW_warp_idx_start_48k_2_5ms}; +const LC3_INT* BW_warp_idx_stop_all_2_5ms[4] = {BW_warp_idx_stop_16k_2_5ms, BW_warp_idx_stop_24k_2_5ms, + BW_warp_idx_stop_32k_2_5ms, BW_warp_idx_stop_48k_2_5ms}; + +const LC3_INT bands_number_2_5ms_HR[6] = {20, 35, 40, 43, 45, 49}; + +const LC3_INT bands_number_2_5ms[5] = {20, 35, 40, 43, 44}; + + +const LC3_INT BW_warp_idx_start_16k_5ms[4] = {39, 0, 0, 0}; +const LC3_INT BW_warp_idx_stop_16k_5ms[4] = {49, 0, 0, 0}; +const LC3_INT BW_warp_idx_start_24k_5ms[4] = {35, 47, 0, 0}; +const LC3_INT BW_warp_idx_stop_24k_5ms[4] = {44, 51, 0, 0}; +const LC3_INT BW_warp_idx_start_32k_5ms[4] = {34, 44, 50, 0}; +const LC3_INT BW_warp_idx_stop_32k_5ms[4] = {42, 49, 53, 0}; +const LC3_INT BW_warp_idx_start_48k_5ms[4] = {32, 42, 48, 52}; +const LC3_INT BW_warp_idx_stop_48k_5ms[4] = {40, 46, 51, 54}; + +const LC3_INT* BW_warp_idx_start_all_5ms[4] = {BW_warp_idx_start_16k_5ms, BW_warp_idx_start_24k_5ms, + BW_warp_idx_start_32k_5ms, BW_warp_idx_start_48k_5ms}; +const LC3_INT* BW_warp_idx_stop_all_5ms[4] = {BW_warp_idx_stop_16k_5ms, BW_warp_idx_stop_24k_5ms, + BW_warp_idx_stop_32k_5ms, BW_warp_idx_stop_48k_5ms}; + +const LC3_INT bands_number_5ms[6] = {39, 50, 52, 54, 55, 58}; + + +const LC3_INT BW_cutoff_bin_all[MAX_BW_BANDS_NUMBER] = {80, 160, 240, 320, 400, 400}; +const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER] = {0, 1, 2, 2, 3, 0}; + +const LC3_INT BW_cutoff_bin_all_5ms[MAX_BW_BANDS_NUMBER] = {40, 80, 120, 160, 200, 200}; +const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER] = {20, 40, 60, 80, 100, 100}; + +/* Arithmetic coding */ +const LC3_INT tns_cf[8][18] = {{0, 1, 6, 21, 52, 106, 192, 289, 409, 568, 720, 831, 935, 994, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 17, 60, 154, 293, 466, 626, 780, 911, 989, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 13, 56, 162, 361, 578, 788, 929, 1003, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 6, 17, 66, 270, 555, 852, 972, 1011, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 12, 54, 295, 636, 950, 1008, 1017, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 224, 590, 967, 1014, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 300, 630, 1001, 1018, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 11, 308, 309, 991, 1017, 1019, 1020, 1021, 1022, 1023, 1024}}; + +const LC3_INT tns_freq_cf[2][9] = {{0, 3, 12, 35, 89, 200, 390, 658, 1024}, {0, 14, 56, 156, 313, 494, 672, 839, 1024}}; + +/* MDCT Windows */ + + +const LC3_FLOAT MDCT_WINDOW_80_2_5ms[40] = { + 6.737914289329320e-03, 2.732289618100209e-02, 6.163560962361236e-02, 1.119125037883055e-01, 1.787053464784875e-01, + 2.607525136824537e-01, 3.549776504187033e-01, 4.567696724165073e-01, 5.605239559005871e-01, 6.603665285212146e-01, + 7.509434386216048e-01, 8.281382099997300e-01, 8.895849967038094e-01, 9.348747871791264e-01, 9.654056798094166e-01, + 9.839026370225886e-01, 9.937180643904148e-01, 9.980987183772584e-01, 9.996266599807562e-01, 9.999772999978698e-01, + 9.999772999978698e-01, 9.996266599807562e-01, 9.980987183772584e-01, 9.937180643904148e-01, 9.839026370225886e-01, + 9.654056798094166e-01, 9.348747871791264e-01, 8.895849967038094e-01, 8.281382099997300e-01, 7.509434386216048e-01, + 6.603665285212146e-01, 5.605239559005871e-01, 4.567696724165073e-01, 3.549776504187033e-01, 2.607525136824537e-01, + 1.787053464784875e-01, 1.119125037883055e-01, 6.163560962361236e-02, 2.732289618100209e-02, 6.737914289329320e-03}; + +const LC3_FLOAT MDCT_WINDOW_160_2_5ms[80] = { + 4.764416154578566e-03, 1.204636278996989e-02, 2.226396539371650e-02, 3.580223111285056e-02, 5.299054649961241e-02, + 7.408518398076024e-02, 9.925385917916330e-02, 1.285631180041137e-01, 1.619692437449073e-01, 1.993132407013812e-01, + 2.403202823615340e-01, 2.846038181323611e-01, 3.316743228466244e-01, 3.809524578920635e-01, 4.317862022264749e-01, + 4.834713159013930e-01, 5.352743274612082e-01, 5.864570980113353e-01, 6.363019156559162e-01, 6.841360194558924e-01, + 7.293544453028629e-01, 7.714401286766273e-01, 8.099802912368443e-01, 8.446782786131956e-01, 8.753602039735273e-01, + 9.019759839191052e-01, 9.245946272967390e-01, 9.433939492938426e-01, 9.586452246292587e-01, 9.706936498636800e-01, + 9.799358305935717e-01, 9.867958066797319e-01, 9.917013283691115e-01, 9.950621445106043e-01, 9.972519167765670e-01, + 9.985950139980033e-01, 9.993588946156141e-01, 9.997521272020117e-01, 9.999274399392850e-01, 9.999886501049429e-01, + 9.999886501049429e-01, 9.999274399392850e-01, 9.997521272020117e-01, 9.993588946156141e-01, 9.985950139980033e-01, + 9.972519167765670e-01, 9.950621445106043e-01, 9.917013283691115e-01, 9.867958066797319e-01, 9.799358305935717e-01, + 9.706936498636800e-01, 9.586452246292587e-01, 9.433939492938426e-01, 9.245946272967390e-01, 9.019759839191052e-01, + 8.753602039735273e-01, 8.446782786131956e-01, 8.099802912368443e-01, 7.714401286766273e-01, 7.293544453028629e-01, + 6.841360194558924e-01, 6.363019156559162e-01, 5.864570980113353e-01, 5.352743274612082e-01, 4.834713159013930e-01, + 4.317862022264749e-01, 3.809524578920635e-01, 3.316743228466244e-01, 2.846038181323611e-01, 2.403202823615340e-01, + 1.993132407013812e-01, 1.619692437449073e-01, 1.285631180041137e-01, 9.925385917916330e-02, 7.408518398076024e-02, + 5.299054649961241e-02, 3.580223111285056e-02, 2.226396539371650e-02, 1.204636278996989e-02, 4.764416154578566e-03}; + +const LC3_FLOAT MDCT_WINDOW_240_2_5ms[120] = { + 3.890134207235998e-03, 8.202595078385781e-03, 1.370235555340779e-02, 2.052968531182845e-02, 2.880307728389693e-02, + 3.862785141889536e-02, 5.009569719921809e-02, 6.328296540190831e-02, 7.824881086160715e-02, 9.503346510857243e-02, + 1.136567491769230e-01, 1.341168883357315e-01, 1.563896708020576e-01, 1.804279808512455e-01, 2.061617274373514e-01, + 2.334981807379911e-01, 2.623227204239969e-01, 2.924999908279060e-01, 3.238754496100354e-01, 3.562772881250116e-01, + 3.895186936283779e-01, 4.234004158919065e-01, 4.577135938730904e-01, 4.922427919542673e-01, 5.267691900603833e-01, + 5.610738677940736e-01, 5.949411196851041e-01, 6.281617368097510e-01, 6.605361894447956e-01, 6.918776461105686e-01, + 7.220147663396499e-01, 7.507942077785026e-01, 7.780827927721814e-01, 8.037692853722609e-01, 8.277657367145603e-01, + 8.500083649018569e-01, 8.704579448595252e-01, 8.890996940634835e-01, 9.059426515086708e-01, 9.210185597011833e-01, + 9.343802726761132e-01, 9.460997268469628e-01, 9.562655255553633e-01, 9.649802020504638e-01, 9.723572386690237e-01, + 9.785179314351103e-01, 9.835881982445411e-01, 9.876954342642392e-01, 9.909655192099981e-01, 9.935200769821082e-01, + 9.954740782709803e-01, 9.969338611957889e-01, 9.979956243841658e-01, 9.987444223234112e-01, 9.992536660401901e-01, + 9.995851053006831e-01, 9.997892438014110e-01, 9.999061183192590e-01, 9.999663581511030e-01, 9.999924333992981e-01, + 9.999924333992981e-01, 9.999663581511030e-01, 9.999061183192590e-01, 9.997892438014110e-01, 9.995851053006831e-01, + 9.992536660401901e-01, 9.987444223234112e-01, 9.979956243841658e-01, 9.969338611957889e-01, 9.954740782709803e-01, + 9.935200769821082e-01, 9.909655192099981e-01, 9.876954342642392e-01, 9.835881982445411e-01, 9.785179314351103e-01, + 9.723572386690237e-01, 9.649802020504638e-01, 9.562655255553633e-01, 9.460997268469628e-01, 9.343802726761132e-01, + 9.210185597011833e-01, 9.059426515086708e-01, 8.890996940634835e-01, 8.704579448595252e-01, 8.500083649018569e-01, + 8.277657367145603e-01, 8.037692853722609e-01, 7.780827927721814e-01, 7.507942077785026e-01, 7.220147663396499e-01, + 6.918776461105686e-01, 6.605361894447956e-01, 6.281617368097510e-01, 5.949411196851041e-01, 5.610738677940736e-01, + 5.267691900603833e-01, 4.922427919542673e-01, 4.577135938730904e-01, 4.234004158919065e-01, 3.895186936283779e-01, + 3.562772881250116e-01, 3.238754496100354e-01, 2.924999908279060e-01, 2.623227204239969e-01, 2.334981807379911e-01, + 2.061617274373514e-01, 1.804279808512455e-01, 1.563896708020576e-01, 1.341168883357315e-01, 1.136567491769230e-01, + 9.503346510857243e-02, 7.824881086160715e-02, 6.328296540190831e-02, 5.009569719921809e-02, 3.862785141889536e-02, + 2.880307728389693e-02, 2.052968531182845e-02, 1.370235555340779e-02, 8.202595078385781e-03, 3.890134207235998e-03}; + +const LC3_FLOAT MDCT_WINDOW_320_2_5ms[160] = { + 3.368958353152859e-03, 6.455557414799749e-03, 1.014308076237845e-02, 1.452126850237346e-02, 1.965076732239952e-02, + 2.558352795411825e-02, 3.236628529621430e-02, 4.004117865352276e-02, 4.864564178753818e-02, 5.821207082124419e-02, + 6.876742903793599e-02, 8.033284980531531e-02, 9.292326595333501e-02, 1.065470811378728e-01, 1.212058930254449e-01, + 1.368942751980506e-01, 1.535996228917228e-01, 1.713020663983868e-01, 1.899744548998832e-01, 2.095824125414741e-01, + 2.300844676343023e-01, 2.514322549787097e-01, 2.735707904154788e-01, 2.964388158404272e-01, 3.199692120640840e-01, + 3.440894760693133e-01, 3.687222584236977e-01, 3.937859558486231e-01, 4.191953532416662e-01, 4.448623088011174e-01, + 4.706964753188311e-01, 4.966060501969578e-01, 5.224985463116437e-01, 5.482815754977786e-01, 5.738636361677886e-01, + 5.991548964078475e-01, 6.240679638193776e-01, 6.485186333941402e-01, 6.724266048285701e-01, 6.957161608975563e-01, + 7.183167988192716e-01, 7.401638069500036e-01, 7.611987796499656e-01, 7.813700637561797e-01, 8.006331307849442e-01, + 8.189508697622124e-01, 8.362937964433754e-01, 8.526401756322647e-01, 8.679760543400818e-01, 8.822952046352904e-01, + 8.955989762210201e-01, 9.078960600314304e-01, 9.192021654545784e-01, 9.295396151552272e-01, 9.389368628711653e-01, + 9.474279409702298e-01, 9.550518459555614e-01, 9.618518714601797e-01, 9.678748995383242e-01, 9.731706621931426e-01, + 9.777909860257944e-01, 9.817890335940264e-01, 9.852185554726640e-01, 9.881331670617683e-01, 9.905856638463937e-01, + 9.926273880444285e-01, 9.943076583739057e-01, 9.956732730391862e-01, 9.967680940129237e-01, 9.976327183405286e-01, + 9.983042396036903e-01, 9.988160999578843e-01, 9.991980304284215e-01, 9.994760745391177e-01, 9.996726879821318e-01, + 9.998069050289865e-01, 9.998945608218308e-01, 9.999485576331654e-01, 9.999791626721350e-01, 9.999943250437048e-01, + 9.999943250437048e-01, 9.999791626721350e-01, 9.999485576331654e-01, 9.998945608218308e-01, 9.998069050289865e-01, + 9.996726879821318e-01, 9.994760745391177e-01, 9.991980304284215e-01, 9.988160999578843e-01, 9.983042396036903e-01, + 9.976327183405286e-01, 9.967680940129237e-01, 9.956732730391862e-01, 9.943076583739057e-01, 9.926273880444285e-01, + 9.905856638463937e-01, 9.881331670617683e-01, 9.852185554726640e-01, 9.817890335940264e-01, 9.777909860257944e-01, + 9.731706621931426e-01, 9.678748995383242e-01, 9.618518714601797e-01, 9.550518459555614e-01, 9.474279409702298e-01, + 9.389368628711653e-01, 9.295396151552272e-01, 9.192021654545784e-01, 9.078960600314304e-01, 8.955989762210201e-01, + 8.822952046352904e-01, 8.679760543400818e-01, 8.526401756322647e-01, 8.362937964433754e-01, 8.189508697622124e-01, + 8.006331307849442e-01, 7.813700637561797e-01, 7.611987796499656e-01, 7.401638069500036e-01, 7.183167988192716e-01, + 6.957161608975563e-01, 6.724266048285701e-01, 6.485186333941402e-01, 6.240679638193776e-01, 5.991548964078475e-01, + 5.738636361677886e-01, 5.482815754977786e-01, 5.224985463116437e-01, 4.966060501969578e-01, 4.706964753188311e-01, + 4.448623088011174e-01, 4.191953532416662e-01, 3.937859558486231e-01, 3.687222584236977e-01, 3.440894760693133e-01, + 3.199692120640840e-01, 2.964388158404272e-01, 2.735707904154788e-01, 2.514322549787097e-01, 2.300844676343023e-01, + 2.095824125414741e-01, 1.899744548998832e-01, 1.713020663983868e-01, 1.535996228917228e-01, 1.368942751980506e-01, + 1.212058930254449e-01, 1.065470811378728e-01, 9.292326595333501e-02, 8.033284980531531e-02, 6.876742903793599e-02, + 5.821207082124419e-02, 4.864564178753818e-02, 4.004117865352276e-02, 3.236628529621430e-02, 2.558352795411825e-02, + 1.965076732239952e-02, 1.452126850237346e-02, 1.014308076237845e-02, 6.455557414799749e-03, 3.368958353152859e-03}; + +const LC3_FLOAT MDCT_WINDOW_480_2_5ms[240] = { + 2.750746382614873e-03, 4.775245154322467e-03, 6.991265476184880e-03, 9.470118155887091e-03, 1.224415763156159e-02, + 1.533559472880042e-02, 1.876266772162453e-02, 2.254154337372088e-02, 2.668701415521377e-02, 3.121277069249126e-02, + 3.613150075407039e-02, 4.145491000214293e-02, 4.719370517091751e-02, 5.335755875796826e-02, 5.995506493224793e-02, + 6.699369195627566e-02, 7.447973421347953e-02, 8.241826576309315e-02, 9.081309669365416e-02, 9.966673316465058e-02, + 1.089803417907089e-01, 1.187537188695662e-01, 1.289852648491186e-01, 1.396719643506733e-01, 1.508093720039881e-01, + 1.623916042982366e-01, 1.744113376077630e-01, 1.868598125100347e-01, 1.997268444741311e-01, 2.130008409605561e-01, + 2.266688249366323e-01, 2.407164647759538e-01, 2.551281104752023e-01, 2.698868360870567e-01, 2.849744882339612e-01, + 3.003717405342550e-01, 3.160581537396951e-01, 3.320122413518523e-01, 3.482115404543554e-01, 3.646326874686314e-01, + 3.812514985127824e-01, 3.980430540166849e-01, 4.149817872214252e-01, 4.320415761679195e-01, 4.491958387581356e-01, + 4.664176304528364e-01, 4.836797441523142e-01, 5.009548117912680e-01, 5.182154071658814e-01, 5.354341495003542e-01, + 5.525838072516958e-01, 5.696374016455559e-01, 5.865683094322820e-01, 6.033503643513004e-01, 6.199579567933325e-01, + 6.363661311538971e-01, 6.525506803780192e-01, 6.684882372050696e-01, 6.841563616341746e-01, 6.995336241446708e-01, + 7.145996842225878e-01, 7.293353637631239e-01, 7.437227149404935e-01, 7.577450821603423e-01, 7.713871577361272e-01, + 7.846350309593857e-01, 7.974762302646725e-01, 8.098997582230498e-01, 8.218961191333729e-01, 8.334573390181531e-01, + 8.445769778704795e-01, 8.552501340402698e-01, 8.654734406919574e-01, 8.752450543115063e-01, 8.845646352883213e-01, + 8.934333206470277e-01, 9.018536890551258e-01, 9.098297182849719e-01, 9.173667353621834e-01, 9.244713596871228e-01, + 9.311514394712620e-01, 9.374159818855259e-01, 9.432750773727245e-01, 9.487398186303003e-01, 9.538222148222497e-01, + 9.585351016294561e-01, 9.628920477950361e-01, 9.669072588647543e-01, 9.705954788611818e-01, 9.739718906630962e-01, + 9.770520158876372e-01, 9.798516150909821e-01, 9.823865891128170e-01, 9.846728823898172e-01, 9.867263890529354e-01, + 9.885628626019504e-01, 9.901978299180545e-01, 9.916465103310770e-01, 9.929237404023775e-01, 9.940439050178721e-01, + 9.950208753087979e-01, 9.958679538316859e-01, 9.965978273449145e-01, 9.972225274187749e-01, 9.977533990110320e-01, + 9.982010770325636e-01, 9.985754708200026e-01, 9.988857563266385e-01, 9.991403757414241e-01, 9.993470441509588e-01, + 9.995127627727911e-01, 9.996438382121301e-01, 9.997459071295719e-01, 9.998239656559388e-01, 9.998824028526124e-01, + 9.999250374922579e-01, 9.999551574256286e-01, 9.999755608048836e-01, 9.999885984518604e-01, 9.999962166900126e-01, + 9.999962166900126e-01, 9.999885984518604e-01, 9.999755608048836e-01, 9.999551574256286e-01, 9.999250374922579e-01, + 9.998824028526124e-01, 9.998239656559388e-01, 9.997459071295719e-01, 9.996438382121301e-01, 9.995127627727911e-01, + 9.993470441509588e-01, 9.991403757414241e-01, 9.988857563266385e-01, 9.985754708200026e-01, 9.982010770325636e-01, + 9.977533990110320e-01, 9.972225274187749e-01, 9.965978273449145e-01, 9.958679538316859e-01, 9.950208753087979e-01, + 9.940439050178721e-01, 9.929237404023775e-01, 9.916465103310770e-01, 9.901978299180545e-01, 9.885628626019504e-01, + 9.867263890529354e-01, 9.846728823898172e-01, 9.823865891128170e-01, 9.798516150909821e-01, 9.770520158876372e-01, + 9.739718906630962e-01, 9.705954788611818e-01, 9.669072588647543e-01, 9.628920477950361e-01, 9.585351016294561e-01, + 9.538222148222497e-01, 9.487398186303003e-01, 9.432750773727245e-01, 9.374159818855259e-01, 9.311514394712620e-01, + 9.244713596871228e-01, 9.173667353621834e-01, 9.098297182849719e-01, 9.018536890551258e-01, 8.934333206470277e-01, + 8.845646352883213e-01, 8.752450543115063e-01, 8.654734406919574e-01, 8.552501340402698e-01, 8.445769778704795e-01, + 8.334573390181531e-01, 8.218961191333729e-01, 8.098997582230498e-01, 7.974762302646725e-01, 7.846350309593857e-01, + 7.713871577361272e-01, 7.577450821603423e-01, 7.437227149404935e-01, 7.293353637631239e-01, 7.145996842225878e-01, + 6.995336241446708e-01, 6.841563616341746e-01, 6.684882372050696e-01, 6.525506803780192e-01, 6.363661311538971e-01, + 6.199579567933325e-01, 6.033503643513004e-01, 5.865683094322820e-01, 5.696374016455559e-01, 5.525838072516958e-01, + 5.354341495003542e-01, 5.182154071658814e-01, 5.009548117912680e-01, 4.836797441523142e-01, 4.664176304528364e-01, + 4.491958387581356e-01, 4.320415761679195e-01, 4.149817872214252e-01, 3.980430540166849e-01, 3.812514985127824e-01, + 3.646326874686314e-01, 3.482115404543554e-01, 3.320122413518523e-01, 3.160581537396951e-01, 3.003717405342550e-01, + 2.849744882339612e-01, 2.698868360870567e-01, 2.551281104752023e-01, 2.407164647759538e-01, 2.266688249366323e-01, + 2.130008409605561e-01, 1.997268444741311e-01, 1.868598125100347e-01, 1.744113376077630e-01, 1.623916042982366e-01, + 1.508093720039881e-01, 1.396719643506733e-01, 1.289852648491186e-01, 1.187537188695662e-01, 1.089803417907089e-01, + 9.966673316465058e-02, 9.081309669365416e-02, 8.241826576309315e-02, 7.447973421347953e-02, 6.699369195627566e-02, + 5.995506493224793e-02, 5.335755875796826e-02, 4.719370517091751e-02, 4.145491000214293e-02, 3.613150075407039e-02, + 3.121277069249126e-02, 2.668701415521377e-02, 2.254154337372088e-02, 1.876266772162453e-02, 1.533559472880042e-02, + 1.224415763156159e-02, 9.470118155887091e-03, 6.991265476184880e-03, 4.775245154322467e-03, 2.750746382614873e-03}; + +const LC3_FLOAT MDCT_WINDOW_80[160] = { + -7.078546706512391e-04, -2.098197727900724e-03, -4.525198076002370e-03, -8.233976327300612e-03, + -1.337713096257934e-02, -1.999721557401502e-02, -2.800909464274782e-02, -3.721502082245055e-02, + -4.731768261606175e-02, -5.794654834034055e-02, -6.867606753531441e-02, -7.904647440788692e-02, + -8.859705468085925e-02, -9.688303623049199e-02, -1.034961241263523e-01, -1.080766457616878e-01, + -1.103242262600913e-01, -1.099809851424550e-01, -1.068172142230882e-01, -1.006190418791648e-01, + -9.116452506492527e-02, -7.820617483254730e-02, -6.146688124166948e-02, -4.063362855701623e-02, + -1.536329520788766e-02, 1.470155068746303e-02, 4.989736509080558e-02, 9.050369257152079e-02, + 1.366911019414417e-01, 1.884686389218322e-01, 2.456456803467095e-01, 3.077789078889820e-01, + 3.741642373060188e-01, 4.438114799213576e-01, 5.154735456539700e-01, 5.876661722564289e-01, + 6.587619767809000e-01, 7.270576699841359e-01, 7.908752989295335e-01, 8.486643364959733e-01, + 8.991320235484349e-01, 9.413348145272842e-01, 9.747634827941575e-01, 9.994114730415857e-01, + 1.015760373791603e+00, 1.024736164069697e+00, 1.027634294456205e+00, 1.025991493983836e+00, + 1.021427210603284e+00, 1.015439859549357e+00, 1.009366925499550e+00, 1.003508162416449e+00, + 9.988898206257559e-01, 9.953133902427869e-01, 9.925943919208190e-01, 9.905771957917731e-01, + 9.891371616557014e-01, 9.881790747212391e-01, 9.876249269174586e-01, 9.874056275509585e-01, + 9.874524849192456e-01, 9.876951134084213e-01, 9.880640617030884e-01, 9.884926873551375e-01, + 9.889230031022089e-01, 9.893074965384659e-01, 9.896146331889107e-01, 9.898319269347060e-01, + 9.899693102025342e-01, 9.900603352632121e-01, 9.901575015155720e-01, 9.903255289051605e-01, + 9.906303787150326e-01, 9.911298894709990e-01, 9.918665491182922e-01, 9.928619727154252e-01, + 9.941156069136238e-01, 9.956033775539884e-01, 9.972793109558521e-01, 9.990784840729244e-01, + 1.000922365901945e+00, 1.002728111386909e+00, 1.004416038098237e+00, 1.005919224127911e+00, + 1.007189345025525e+00, 1.008200146369426e+00, 1.008949493525753e+00, 1.009458241425143e+00, + 1.009768980817384e+00, 1.009940336228694e+00, 1.010039453539107e+00, 1.010132323996401e+00, + 1.010272524848519e+00, 1.010494354532353e+00, 1.010808068774316e+00, 1.011201071127927e+00, + 1.011641272406023e+00, 1.012080125934687e+00, 1.012458183122033e+00, 1.012706955800289e+00, + 1.012755013843985e+00, 1.012530134411619e+00, 1.011962331100864e+00, 1.010982135506986e+00, + 1.009512438049510e+00, 1.007460860286395e+00, 1.004708677491086e+00, 1.001111413242302e+00, + 9.965041017623596e-01, 9.907199995730845e-01, 9.823765865983288e-01, 9.708821747608998e-01, + 9.546732976073705e-01, 9.321553861564006e-01, 9.018003682081348e-01, 8.623984077953557e-01, + 8.132817365236141e-01, 7.544551974836834e-01, 6.866580716267418e-01, 6.113488038789190e-01, + 5.306181649316597e-01, 4.471309850999502e-01, 3.639114681156236e-01, 2.841647033392408e-01, + 2.110209448747969e-01, 1.472287968327703e-01, 9.482665349502291e-02, 5.482436608328477e-02, + 2.701461405056264e-02, 9.996743588367519e-03, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_160[320] = { + -4.619898752628163e-04, -9.747166718929050e-04, -1.664473096973725e-03, -2.597106916737789e-03, + -3.806285163352241e-03, -5.324608721716763e-03, -7.175885277771099e-03, -9.382480860899108e-03, + -1.195270300743193e-02, -1.489528159506296e-02, -1.820666399965468e-02, -2.187570925786862e-02, + -2.588471937157619e-02, -3.020862738245264e-02, -3.481597793538342e-02, -3.967067992672979e-02, + -4.472698045914417e-02, -4.994225863256500e-02, -5.526334794593565e-02, -6.063717235243996e-02, + -6.600961519440657e-02, -7.131966266443390e-02, -7.651178225890490e-02, -8.152964005319532e-02, + -8.631137544905677e-02, -9.080411291245728e-02, -9.495377758870335e-02, -9.870736514214426e-02, + -1.020202684361974e-01, -1.048438825017798e-01, -1.071382314127799e-01, -1.088690135027248e-01, + -1.099969655786929e-01, -1.104898474883336e-01, -1.103225838568563e-01, -1.094621746650760e-01, + -1.078834293141886e-01, -1.055612509762041e-01, -1.024650162703341e-01, -9.857014566194629e-02, + -9.384684920715425e-02, -8.826309993000785e-02, -8.178792716809512e-02, -7.438785600211463e-02, + -6.602189797715241e-02, -5.665655641133161e-02, -4.624456893420224e-02, -3.474585776145929e-02, + -2.211581608120528e-02, -8.310425696208936e-03, 6.717697635290676e-03, 2.300642061077823e-02, + 4.060106462625085e-02, 5.953239090915557e-02, 7.983354189816511e-02, 1.015233140203748e-01, + 1.246171387327525e-01, 1.491152519299797e-01, 1.750067399059861e-01, 2.022699854906251e-01, + 2.308655379767671e-01, 2.607365124918583e-01, 2.918144694729168e-01, 3.240095704645023e-01, + 3.572175180786021e-01, 3.913146885756875e-01, 4.261571642320424e-01, 4.615925445090212e-01, + 4.974471592901086e-01, 5.335326819631583e-01, 5.696546730080154e-01, 6.056083823929643e-01, + 6.411830842823245e-01, 6.761653499550255e-01, 7.103400549562944e-01, 7.434943718765665e-01, + 7.754281892901473e-01, 8.059437233154637e-01, 8.348589373399948e-01, 8.620108336276733e-01, + 8.872599706865123e-01, 9.104863121445679e-01, 9.315962496426278e-01, 9.505220861927248e-01, + 9.672366712325431e-01, 9.817397501303696e-01, 9.940557180662704e-01, 1.004247514102417e+00, + 1.012407428282884e+00, 1.018650990561848e+00, 1.023118841384460e+00, 1.025972450969440e+00, + 1.027397523939210e+00, 1.027585830688143e+00, 1.026738673647482e+00, 1.025061777648234e+00, + 1.022756514615106e+00, 1.020009139549275e+00, 1.016996499560845e+00, 1.013915946100629e+00, + 1.011044869639164e+00, 1.007773858455400e+00, 1.004848753962734e+00, 1.002245009135684e+00, + 9.999393169239009e-01, 9.979055415627330e-01, 9.961203379971326e-01, 9.945597525471822e-01, + 9.932031606606762e-01, 9.920297273323891e-01, 9.910230654424902e-01, 9.901668953434221e-01, + 9.894488374513719e-01, 9.888556356037892e-01, 9.883778520531268e-01, 9.880051626345804e-01, + 9.877295459610343e-01, 9.875412739766566e-01, 9.874329809802893e-01, 9.873949921033299e-01, + 9.874197049003676e-01, 9.874973205882319e-01, 9.876201238703241e-01, 9.877781920433015e-01, + 9.879637979933339e-01, 9.881678007807095e-01, 9.883835200189653e-01, 9.886022219397892e-01, + 9.888182771263505e-01, 9.890247977602895e-01, 9.892178658748239e-01, 9.893923680007577e-01, + 9.895463342815009e-01, 9.896772011542693e-01, 9.897859195209235e-01, 9.898725363809847e-01, + 9.899410789223559e-01, 9.899945557067980e-01, 9.900394023736973e-01, 9.900814722948890e-01, + 9.901293790312005e-01, 9.901902265696609e-01, 9.902734448815004e-01, 9.903862280081246e-01, + 9.905379830873822e-01, 9.907348826312993e-01, 9.909842592301273e-01, 9.912905118607647e-01, + 9.916586940166509e-01, 9.920906151219310e-01, 9.925887208794144e-01, 9.931516528513824e-01, + 9.937790866568735e-01, 9.944668184371617e-01, 9.952116634297566e-01, 9.960068616185641e-01, + 9.968461329825753e-01, 9.977203369515556e-01, 9.986213520769593e-01, 9.995382582242990e-01, + 1.000461955079660e+00, 1.001380551217109e+00, 1.002284871786226e+00, 1.003163845364970e+00, + 1.004009147462043e+00, 1.004811375053364e+00, 1.005563968008037e+00, 1.006259855360867e+00, + 1.006895570408563e+00, 1.007466616298057e+00, 1.007972441990187e+00, 1.008411468616852e+00, + 1.008786009787269e+00, 1.009097763850333e+00, 1.009351762546296e+00, 1.009552401900961e+00, + 1.009707093778162e+00, 1.009822090220407e+00, 1.009906958448099e+00, 1.009969021400474e+00, + 1.010017890428877e+00, 1.010060809299530e+00, 1.010106564965965e+00, 1.010161131093372e+00, + 1.010231078494249e+00, 1.010319484524512e+00, 1.010430470494512e+00, 1.010564099281000e+00, + 1.010721360243234e+00, 1.010899655674578e+00, 1.011096993993037e+00, 1.011308167670753e+00, + 1.011529185153809e+00, 1.011753008569803e+00, 1.011973876511603e+00, 1.012182837094955e+00, + 1.012373028737774e+00, 1.012535058602453e+00, 1.012660975529858e+00, 1.012740575296603e+00, + 1.012765922449960e+00, 1.012726958954961e+00, 1.012615904116265e+00, 1.012422888521601e+00, + 1.012140460211194e+00, 1.011758810583150e+00, 1.011269960947744e+00, 1.010663676735228e+00, + 1.009930754807923e+00, 1.009058249873833e+00, 1.008034308295421e+00, 1.006843352506855e+00, + 1.005470005637052e+00, 1.003894772403371e+00, 1.002098854400575e+00, 1.000060686758758e+00, + 9.977600196406868e-01, 9.951746430061121e-01, 9.922861082472264e-01, 9.890757868707590e-01, + 9.847362453480265e-01, 9.798613526271561e-01, 9.741378617337759e-01, 9.673331975559332e-01, + 9.592539757044516e-01, 9.496984081652284e-01, 9.384634163826711e-01, 9.253567968750328e-01, + 9.101986790930605e-01, 8.928338316495705e-01, 8.731437835983047e-01, 8.510420440685049e-01, + 8.264839911291133e-01, 7.994681492797084e-01, 7.700431275216928e-01, 7.383028603058783e-01, + 7.043814340356083e-01, 6.684616478236647e-01, 6.307755329382612e-01, 5.915799587176216e-01, + 5.511703155400274e-01, 5.098915423728179e-01, 4.681017110047964e-01, 4.261772971493010e-01, + 3.845172335531009e-01, 3.435228672445613e-01, 3.036004651973099e-01, 2.651434678028531e-01, + 2.285283969438072e-01, 1.941021906320984e-01, 1.621735416384830e-01, 1.330015240938615e-01, + 1.067840430193724e-01, 8.365057236623041e-02, 6.365188111381356e-02, 4.676538412257621e-02, + 3.288072750732215e-02, 2.183057564646270e-02, 1.336381425803019e-02, 6.758124889697787e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_240[480] = { + -3.613496418928369e-04, -7.078546706512391e-04, -1.074443637110903e-03, -1.533478537964509e-03, + -2.098197727900724e-03, -2.778420871815740e-03, -3.584129920673041e-03, -4.525198076002370e-03, + -5.609327243712055e-03, -6.843234536105624e-03, -8.233976327300612e-03, -9.785314755557023e-03, + -1.149880303071551e-02, -1.337713096257934e-02, -1.542181679511618e-02, -1.762979910961727e-02, + -1.999721557401502e-02, -2.252080561390149e-02, -2.519406300389030e-02, -2.800909464274782e-02, + -3.095765092956728e-02, -3.402996266948349e-02, -3.721502082245055e-02, -4.050053247568393e-02, + -4.387219218706189e-02, -4.731768261606175e-02, -5.082325342672667e-02, -5.437166635159518e-02, + -5.794654834034055e-02, -6.153426201732499e-02, -6.511708163113709e-02, -6.867606753531441e-02, + -7.219447805250771e-02, -7.565695975592170e-02, -7.904647440788692e-02, -8.234442557322251e-02, + -8.553324579905185e-02, -8.859705468085925e-02, -9.152091100798199e-02, -9.428847446755965e-02, + -9.688303623049198e-02, -9.929123258537813e-02, -1.015008467688577e-01, -1.034961241263523e-01, + -1.052637003544443e-01, -1.067939984687745e-01, -1.080766457616878e-01, -1.090997300590506e-01, + -1.098524491515805e-01, -1.103242262600913e-01, -1.105084619148789e-01, -1.103977408741932e-01, + -1.099809851424550e-01, -1.092492774392824e-01, -1.081974227416502e-01, -1.068172142230882e-01, + -1.050995803285455e-01, -1.030360111111103e-01, -1.006190418791648e-01, -9.784120023411771e-02, + -9.469304216883027e-02, -9.116452506492527e-02, -8.724644532866996e-02, -8.293043914044632e-02, + -7.820617483254730e-02, -7.306142427456862e-02, -6.748468182105991e-02, -6.146688124166948e-02, + -5.499497258200362e-02, -4.805444424454820e-02, -4.063362855701623e-02, -3.272045590229335e-02, + -2.430122582451853e-02, -1.536329520788766e-02, -5.891434269890659e-03, 4.126595858583295e-03, + 1.470155068746303e-02, 2.584738191459814e-02, 3.757652772246801e-02, 4.989736509080558e-02, + 6.282034030592902e-02, 7.635397728566121e-02, 9.050369257152079e-02, 1.052747118478660e-01, + 1.206703467513333e-01, 1.366911019414417e-01, 1.533343890681390e-01, 1.705954709184399e-01, + 1.884686389218322e-01, 2.069449962574092e-01, 2.260093000067393e-01, 2.456456803467095e-01, + 2.658346019332584e-01, 2.865543814049772e-01, 3.077789078889820e-01, 3.294769437072290e-01, + 3.516171481750350e-01, 3.741642373060188e-01, 3.970739591211551e-01, 4.203043046885219e-01, + 4.438114799213576e-01, 4.675442291623012e-01, 4.914498631045615e-01, 5.154735456539700e-01, + 5.395557644293222e-01, 5.636399817032525e-01, 5.876661722564289e-01, 6.115695310143157e-01, + 6.352890592874099e-01, 6.587619767809000e-01, 6.819230974423550e-01, 7.047092819314779e-01, + 7.270576699841359e-01, 7.489068963384272e-01, 7.701990187606995e-01, 7.908752989295335e-01, + 8.108788692151807e-01, 8.301579139160681e-01, 8.486643364959733e-01, 8.663548164329093e-01, + 8.831896853053627e-01, 8.991320235484349e-01, 9.141540563656075e-01, 9.282282546151819e-01, + 9.413348145272842e-01, 9.534619388400459e-01, 9.646048250501910e-01, 9.747634827941575e-01, + 9.839435385219192e-01, 9.921529097154242e-01, 9.994114730415857e-01, 1.005746084650236e+00, + 1.011183971347815e+00, 1.015760373791603e+00, 1.019515072412387e+00, 1.022490937034641e+00, + 1.024736164069697e+00, 1.026304095700693e+00, 1.027250978292214e+00, 1.027634294456205e+00, + 1.027511063644843e+00, 1.026942795115598e+00, 1.025991493983836e+00, 1.024716149969084e+00, + 1.023175976163407e+00, 1.021427210603284e+00, 1.019521566634239e+00, 1.017510118327508e+00, + 1.015439859549357e+00, 1.013460916839174e+00, 1.011654901040475e+00, 1.009366925499550e+00, + 1.007263182132894e+00, 1.005313192386866e+00, 1.003508162416449e+00, 1.001840787319378e+00, + 1.000303927234380e+00, 9.988898206257559e-01, 9.975915283480670e-01, 9.964015284765968e-01, + 9.953133902427869e-01, 9.943201078053212e-01, 9.934158959186011e-01, 9.925943919208190e-01, + 9.918510277326026e-01, 9.911797988363887e-01, 9.905771957917731e-01, 9.900381047643838e-01, + 9.895594394179152e-01, 9.891371616557014e-01, 9.887684373604154e-01, 9.884497924570929e-01, + 9.881790747212391e-01, 9.879528358230726e-01, 9.877691368590689e-01, 9.876249269174586e-01, + 9.875179947346887e-01, 9.874458127312921e-01, 9.874056275509585e-01, 9.873951115886979e-01, + 9.874115368168944e-01, 9.874524849192456e-01, 9.875149888347144e-01, 9.875968894760857e-01, + 9.876951134084213e-01, 9.878075819424549e-01, 9.879311998177238e-01, 9.880640617030884e-01, + 9.882032571565917e-01, 9.883471084085503e-01, 9.884926873551375e-01, 9.886386592120545e-01, + 9.887825578295630e-01, 9.889230031022089e-01, 9.890581715933395e-01, 9.891867674284610e-01, + 9.893074965384659e-01, 9.894196399062921e-01, 9.895220757174378e-01, 9.896146331889107e-01, + 9.896970346678272e-01, 9.897692596535289e-01, 9.898319269347060e-01, 9.898852572653667e-01, + 9.899307640365727e-01, 9.899693102025343e-01, 9.900025692522435e-01, 9.900321562263099e-01, + 9.900603352632121e-01, 9.900889812894406e-01, 9.901206586012907e-01, 9.901575015155720e-01, + 9.902023946214220e-01, 9.902575406142213e-01, 9.903255289051605e-01, 9.904087914462694e-01, + 9.905096491583045e-01, 9.906303787150326e-01, 9.907727108894024e-01, 9.909387444078919e-01, + 9.911298894709990e-01, 9.913476318763218e-01, 9.915928560402563e-01, 9.918665491182922e-01, + 9.921691315380984e-01, 9.925010851461232e-01, 9.928619727154252e-01, 9.932519181564613e-01, + 9.936700207375173e-01, 9.941156069136238e-01, 9.945873147903244e-01, 9.950837402063278e-01, + 9.956033775539884e-01, 9.961439922621166e-01, 9.967034533921340e-01, 9.972793109558521e-01, + 9.978690858367024e-01, 9.984697087896268e-01, 9.990784840729244e-01, 9.996919011206490e-01, + 1.000308193833526e+00, 1.000922365901945e+00, 1.001532636590676e+00, 1.002135464655177e+00, + 1.002728111386909e+00, 1.003307449770187e+00, 1.003870934089686e+00, 1.004416038098237e+00, + 1.004940548815171e+00, 1.005442141810160e+00, 1.005919224127911e+00, 1.006370303149314e+00, + 1.006793927824538e+00, 1.007189345025525e+00, 1.007555573455895e+00, 1.007892674961336e+00, + 1.008200146369426e+00, 1.008478423284851e+00, 1.008727884997619e+00, 1.008949493525753e+00, + 1.009144112734761e+00, 1.009313224929575e+00, 1.009458241425143e+00, 1.009581280555682e+00, + 1.009684090687164e+00, 1.009768980817384e+00, 1.009838308708799e+00, 1.009894548257807e+00, + 1.009940336228694e+00, 1.009977916643680e+00, 1.010010230290263e+00, 1.010039453539107e+00, + 1.010068202038694e+00, 1.010098388689342e+00, 1.010132323996401e+00, 1.010171656775640e+00, + 1.010218096148412e+00, 1.010272524848519e+00, 1.010336490294771e+00, 1.010410221483215e+00, + 1.010494354532353e+00, 1.010588873699422e+00, 1.010693501186928e+00, 1.010808068774316e+00, + 1.010931436739342e+00, 1.011062876503041e+00, 1.011201071127927e+00, 1.011344700694417e+00, + 1.011491904228184e+00, 1.011641272406023e+00, 1.011790282474963e+00, 1.011937567254485e+00, + 1.012080125934687e+00, 1.012216235487353e+00, 1.012342907951334e+00, 1.012458183122033e+00, + 1.012558879696851e+00, 1.012642857380847e+00, 1.012706955800289e+00, 1.012748952907404e+00, + 1.012765799894453e+00, 1.012755013843985e+00, 1.012713798678211e+00, 1.012639775003457e+00, + 1.012530134411619e+00, 1.012382309473470e+00, 1.012194068117524e+00, 1.011962331100864e+00, + 1.011685173724601e+00, 1.011359143572147e+00, 1.010982135506986e+00, 1.010550715971368e+00, + 1.010062133151922e+00, 1.009512438049510e+00, 1.008898689394160e+00, 1.008215923600973e+00, + 1.007460860286395e+00, 1.006627741823389e+00, 1.005712337656749e+00, 1.004708677491086e+00, + 1.003611467285588e+00, 1.002414286392268e+00, 1.001111413242302e+00, 9.996961651093181e-01, + 9.981625949525345e-01, 9.965041017623596e-01, 9.947148884277037e-01, 9.927891912841345e-01, + 9.907199995730845e-01, 9.884793707533194e-01, 9.855347660016696e-01, 9.823765865983286e-01, + 9.789747333404933e-01, 9.751623811486372e-01, 9.708821747608998e-01, 9.660805524695870e-01, + 9.606976399184645e-01, 9.546732976073706e-01, 9.479479345282376e-01, 9.404609052933396e-01, + 9.321553861564006e-01, 9.229775478442888e-01, 9.128745354570823e-01, 9.018003682081348e-01, + 8.897163275605041e-01, 8.765908974996186e-01, 8.623984077953557e-01, 8.471200801854385e-01, + 8.307479727020245e-01, 8.132817365236141e-01, 7.947291447585267e-01, 7.751108841891807e-01, + 7.544551974836834e-01, 7.327963552921717e-01, 7.101790843209148e-01, 6.866580716267418e-01, + 6.622962432368731e-01, 6.371684119604742e-01, 6.113488038789190e-01, 5.849206604934815e-01, + 5.579747428663487e-01, 5.306181649316717e-01, 5.029523957059122e-01, 4.750868825511614e-01, + 4.471309850999535e-01, 4.192049917945288e-01, 3.914252910998820e-01, 3.639114681156252e-01, + 3.367837772954476e-01, 3.101627843160973e-01, 2.841647033392418e-01, 2.589033711808454e-01, + 2.344880603710975e-01, 2.110209448747974e-01, 1.885997642296488e-01, 1.673100807904834e-01, + 1.472287968327706e-01, 1.284223074167396e-01, 1.109422548710344e-01, 9.482665349502306e-02, + 8.009914366829558e-02, 6.676765847398403e-02, 5.482436608328485e-02, 4.424588851571281e-02, + 3.499361000717621e-02, 2.701461405056267e-02, 2.024370180670145e-02, 1.460796755137538e-02, + 9.996743588367531e-03, 5.305235098871444e-03, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_320[640] = { + -3.021153494057143e-04, -5.867737487939294e-04, -8.366504004139796e-04, -1.126635355725494e-03, + -1.470492941694331e-03, -1.873473391018495e-03, -2.339292362082021e-03, -2.872008069419264e-03, + -3.476256385086407e-03, -4.155963816705528e-03, -4.914563787665504e-03, -5.755172503953251e-03, + -6.680623380533122e-03, -7.693816924650567e-03, -8.796760749750191e-03, -9.990503073705982e-03, + -1.127574117138621e-02, -1.265334152129685e-02, -1.412438986522702e-02, -1.568889620430290e-02, + -1.734512089366117e-02, -1.909097368362797e-02, -2.092546711168754e-02, -2.284684792818856e-02, + -2.485207716234951e-02, -2.693746704328349e-02, -2.909952486193999e-02, -3.133504629493832e-02, + -3.363960728361352e-02, -3.600820974457969e-02, -3.843601741746971e-02, -4.091746034850161e-02, + -4.344654894948344e-02, -4.601786724624048e-02, -4.862598509282497e-02, -5.126474204655663e-02, + -5.392644753556616e-02, -5.660384311081047e-02, -5.929116747072080e-02, -6.198268202511926e-02, + -6.467025548071184e-02, -6.734542216184526e-02, -7.000099017198280e-02, -7.263057011354321e-02, + -7.522784961377151e-02, -7.778525942347714e-02, -8.029480247839878e-02, -8.274924535373614e-02, + -8.514125464087215e-02, -8.746379123238275e-02, -8.971069341834263e-02, -9.187564084638347e-02, + -9.395176975347193e-02, -9.593137735886889e-02, -9.780843257659243e-02, -9.957851303827886e-02, + -1.012361165314596e-01, -1.027741036495644e-01, -1.041861222641119e-01, -1.054680247057000e-01, + -1.066160875985523e-01, -1.076255384835563e-01, -1.084912299471198e-01, -1.092087422379003e-01, + -1.097736146613313e-01, -1.101808861640070e-01, -1.104271876052675e-01, -1.105108362290460e-01, + -1.104281465492726e-01, -1.101739218186236e-01, -1.097437360338336e-01, -1.091353125572511e-01, + -1.083467335729228e-01, -1.073739938306107e-01, -1.062130155324388e-01, -1.048606145834788e-01, + -1.033132401525343e-01, -1.015673163469357e-01, -9.962005506126154e-02, -9.746803229469267e-02, + -9.510723623306666e-02, -9.253303383231506e-02, -8.974125216128212e-02, -8.672877689119252e-02, + -8.349213839083708e-02, -8.002639902061687e-02, -7.632679536516856e-02, -7.238806162166744e-02, + -6.820576796149519e-02, -6.377611429172260e-02, -5.909386001558149e-02, -5.415316322402774e-02, + -4.894812724598650e-02, -4.347347112195197e-02, -3.772461300253332e-02, -3.169587609244436e-02, + -2.538179830690266e-02, -1.877689096555516e-02, -1.187461378850388e-02, -4.669099247423082e-03, + 2.844096748870385e-03, 1.066976124794342e-02, 1.881355950582949e-02, 2.728156010437695e-02, + 3.607810469851272e-02, 4.520702759803914e-02, 5.467238802204326e-02, 6.447866054615346e-02, + 7.462862199422061e-02, 8.512490568723846e-02, 9.596983987496970e-02, 1.071650779014335e-01, + 1.187115850305241e-01, 1.306101067250375e-01, 1.428596447589721e-01, 1.554584725339102e-01, + 1.684041609371527e-01, 1.816947894623263e-01, 1.953273880886783e-01, 2.092963206850239e-01, + 2.235945635254679e-01, 2.382160219461597e-01, 2.531529721334063e-01, 2.683961570569586e-01, + 2.839361392493072e-01, 2.997624255177811e-01, 3.158619077906196e-01, 3.322210551086769e-01, + 3.488264676990591e-01, 3.656640377499646e-01, 3.827152968157059e-01, 3.999611859760947e-01, + 4.173843265025887e-01, 4.349669624916473e-01, 4.526876397402144e-01, 4.705242008503956e-01, + 4.884539254831315e-01, 5.064545550235134e-01, 5.245006748662190e-01, 5.425674372882107e-01, + 5.606312044701524e-01, 5.786672646386708e-01, 5.966477035050948e-01, 6.145458904162185e-01, + 6.323361944662236e-01, 6.499926319211774e-01, 6.674874032292857e-01, 6.847932667399612e-01, + 7.018835463513400e-01, 7.187322544823347e-01, 7.353128213893310e-01, 7.516001985652684e-01, + 7.675699252273948e-01, 7.831974571624924e-01, 7.984583859818390e-01, 8.133295347030278e-01, + 8.277892271515950e-01, 8.418178561101360e-01, 8.553961300139363e-01, 8.685068980898102e-01, + 8.811334436653052e-01, 8.932596784799233e-01, 9.048748835980528e-01, 9.159657608120536e-01, + 9.265215299450000e-01, 9.365339988633418e-01, 9.459977028429117e-01, 9.549088408436811e-01, + 9.632658122557368e-01, 9.710688896122810e-01, 9.783204156360773e-01, 9.850226760127131e-01, + 9.911792082081333e-01, 9.967989944502682e-01, 1.001894024615659e+00, 1.006474342231823e+00, + 1.010552057109195e+00, 1.014142538208007e+00, 1.017262593268930e+00, 1.019928842669923e+00, + 1.022159867011177e+00, 1.023976320927187e+00, 1.025400734608122e+00, 1.026455340400072e+00, + 1.027164510654160e+00, 1.027552729180790e+00, 1.027644462380432e+00, 1.027463246660797e+00, + 1.027035903410657e+00, 1.026389068000259e+00, 1.025548201799728e+00, 1.024537134749709e+00, + 1.023380803775376e+00, 1.022103695693341e+00, 1.020728359657958e+00, 1.019275334687329e+00, + 1.017765178792830e+00, 1.016217355867531e+00, 1.014665311686846e+00, 1.013249071090664e+00, + 1.011948006992127e+00, 1.010189090179223e+00, 1.008557961167850e+00, 1.007011287608451e+00, + 1.005548764575910e+00, 1.004168417268956e+00, 1.002867268893035e+00, 1.001641769115897e+00, + 1.000489068954641e+00, 9.994060799749374e-01, 9.983898865406841e-01, 9.974370849972721e-01, + 9.965444836911705e-01, 9.957098545943852e-01, 9.949302413030897e-01, 9.942024045863540e-01, + 9.935241604969254e-01, 9.928930430130044e-01, 9.923068103443909e-01, 9.917633778190438e-01, + 9.912597642374404e-01, 9.907954498484041e-01, 9.903677893656558e-01, 9.899751611066148e-01, + 9.896160337369861e-01, 9.892890160408989e-01, 9.889928511129679e-01, 9.887260333430423e-01, + 9.884868721088945e-01, 9.882751039537586e-01, 9.880892168751595e-01, 9.879277114724612e-01, + 9.877898261218510e-01, 9.876743442038471e-01, 9.875807496078497e-01, 9.875072021876561e-01, + 9.874529447589979e-01, 9.874169741527905e-01, 9.873984685207834e-01, 9.873958301311858e-01, + 9.874080027710336e-01, 9.874343401290739e-01, 9.874736235387018e-01, 9.875243137719285e-01, + 9.875856201221135e-01, 9.876563785063032e-01, 9.877358921155149e-01, 9.878225576787804e-01, + 9.879150968481590e-01, 9.880132731565830e-01, 9.881156946084619e-01, 9.882211314188272e-01, + 9.883289032519310e-01, 9.884378310018685e-01, 9.885476787868710e-01, 9.886568414746639e-01, + 9.887645868459630e-01, 9.888708540445242e-01, 9.889744320992592e-01, 9.890747269455915e-01, + 9.891710038703801e-01, 9.892631024032380e-01, 9.893507219573624e-01, 9.894330645494204e-01, + 9.895096919388534e-01, 9.895810813422480e-01, 9.896467469067676e-01, 9.897067365020641e-01, + 9.897606930400666e-01, 9.898094478563998e-01, 9.898530133261707e-01, 9.898914705684924e-01, + 9.899254194103574e-01, 9.899554202030650e-01, 9.899824494486951e-01, 9.900065116928948e-01, + 9.900284805353695e-01, 9.900497484789281e-01, 9.900709561632662e-01, 9.900928358611601e-01, + 9.901163920607219e-01, 9.901427479709606e-01, 9.901734275350572e-01, 9.902087332329851e-01, + 9.902498637985275e-01, 9.902983686695558e-01, 9.903548501470234e-01, 9.904205084933333e-01, + 9.904959297726740e-01, 9.905825150202904e-01, 9.906812569810133e-01, 9.907922087340426e-01, + 9.909165464981378e-01, 9.910550740962871e-01, 9.912084614290896e-01, 9.913768610980639e-01, + 9.915605826937839e-01, 9.917604214872976e-01, 9.919767175562684e-01, 9.922091101818779e-01, + 9.924579135466506e-01, 9.927231225056266e-01, 9.930049538427406e-01, 9.933027281437943e-01, + 9.936161084869942e-01, 9.939453714404443e-01, 9.942895145656371e-01, 9.946481676207727e-01, + 9.950203031067961e-01, 9.954058173659507e-01, 9.958038713694317e-01, 9.962130271017117e-01, + 9.966324689957675e-01, 9.970615306490058e-01, 9.974990583293081e-01, 9.979437430375855e-01, + 9.983940572002874e-01, 9.988493116887893e-01, 9.993083430214909e-01, 9.997689221333534e-01, + 1.000231131275969e+00, 1.000692135698996e+00, 1.001152013920163e+00, 1.001608526000461e+00, + 1.002060493867275e+00, 1.002507212061815e+00, 1.002947129400411e+00, 1.003378909587027e+00, + 1.003801368578070e+00, 1.004213810320699e+00, 1.004615386562846e+00, 1.005004618375781e+00, + 1.005380628601598e+00, 1.005743282364652e+00, 1.006091510392348e+00, 1.006424907424988e+00, + 1.006742427727669e+00, 1.007044321511378e+00, 1.007330218597112e+00, 1.007599401798709e+00, + 1.007852064386603e+00, 1.008088176165563e+00, 1.008308033204578e+00, 1.008511247273756e+00, + 1.008698144207627e+00, 1.008869515256392e+00, 1.009025659761512e+00, 1.009166718967367e+00, + 1.009293362609020e+00, 1.009406398832440e+00, 1.009507017171120e+00, 1.009595264293017e+00, + 1.009672145744679e+00, 1.009739084785160e+00, 1.009796675060142e+00, 1.009846137382005e+00, + 1.009888083631667e+00, 1.009924092276850e+00, 1.009955384765721e+00, 1.009982268770147e+00, + 1.010006298177305e+00, 1.010028618428735e+00, 1.010050254076988e+00, 1.010071952131355e+00, + 1.010094366238073e+00, 1.010118917317053e+00, 1.010146497096682e+00, 1.010177110711677e+00, + 1.010211755260102e+00, 1.010251003469427e+00, 1.010295468653759e+00, 1.010345234996637e+00, + 1.010400316698172e+00, 1.010461564316351e+00, 1.010528615445659e+00, 1.010601521285347e+00, + 1.010679788081867e+00, 1.010763905869062e+00, 1.010853429760676e+00, 1.010947547074519e+00, + 1.011045953108263e+00, 1.011148486293359e+00, 1.011254397791134e+00, 1.011363082075863e+00, + 1.011473302008831e+00, 1.011584996312149e+00, 1.011697416504599e+00, 1.011808919793469e+00, + 1.011919264025716e+00, 1.012027240794153e+00, 1.012132151631041e+00, 1.012232734564333e+00, + 1.012327560477901e+00, 1.012416383754384e+00, 1.012497890726292e+00, 1.012570434021054e+00, + 1.012633295255708e+00, 1.012685277016726e+00, 1.012725564992284e+00, 1.012752577651415e+00, + 1.012765062889864e+00, 1.012762356719162e+00, 1.012743376077777e+00, 1.012706484200181e+00, + 1.012650842226435e+00, 1.012575427778520e+00, 1.012479473490919e+00, 1.012361105121003e+00, + 1.012219809594718e+00, 1.012054359992419e+00, 1.011864000215460e+00, 1.011647223869087e+00, + 1.011402518267713e+00, 1.011129654652857e+00, 1.010826951260377e+00, 1.010492924436361e+00, + 1.010126353960416e+00, 1.009725892479312e+00, 1.009290060983833e+00, 1.008817301052548e+00, + 1.008305027555130e+00, 1.007752833675443e+00, 1.007157827358150e+00, 1.006518049344503e+00, + 1.005831403532018e+00, 1.005095592119373e+00, 1.004308630055050e+00, 1.003467498305776e+00, + 1.002569500413888e+00, 1.001612710105563e+00, 1.000594272975683e+00, 9.995111701168786e-01, + 9.983609218719522e-01, 9.971409288327860e-01, 9.958488863050556e-01, 9.944818543153893e-01, + 9.930375282832211e-01, 9.915146560759479e-01, 9.899136802423638e-01, 9.881930623810997e-01, + 9.859422591203311e-01, 9.835667898378924e-01, 9.811423034808365e-01, 9.785214441250228e-01, + 9.756636036109838e-01, 9.725453442532574e-01, 9.691456634185092e-01, 9.654406178310209e-01, + 9.614043615076308e-01, 9.570113065179300e-01, 9.522367669696690e-01, 9.470548839544214e-01, + 9.414403740008491e-01, 9.353691612846549e-01, 9.288190093977164e-01, 9.217662887169115e-01, + 9.141896283466009e-01, 9.060694681113471e-01, 8.973891675497357e-01, 8.881332000806269e-01, + 8.782893885841422e-01, 8.678469565343039e-01, 8.567970644671067e-01, 8.451334654019180e-01, + 8.328542805780399e-01, 8.199594783897041e-01, 8.064511006873497e-01, 7.923346478686025e-01, + 7.776204488292163e-01, 7.623206183595970e-01, 7.464486491227057e-01, 7.300205729992958e-01, + 7.130567383226717e-01, 6.955805444755916e-01, 6.776173229836567e-01, 6.591955305148172e-01, + 6.403486426892321e-01, 6.211072197441818e-01, 6.015049275244730e-01, 5.815787608870452e-01, + 5.613674511156324e-01, 5.409188627354076e-01, 5.202736834971303e-01, 4.994780733459294e-01, + 4.785774177949064e-01, 4.576172599874928e-01, 4.366490208265804e-01, 4.157221460415995e-01, + 3.948856590950757e-01, 3.741903189229770e-01, 3.536868899553974e-01, 3.334260017756462e-01, + 3.134586473252229e-01, 2.938337904395871e-01, 2.745992637590817e-01, 2.558030636168172e-01, + 2.374902188466697e-01, 2.197036032185785e-01, 2.024855415115456e-01, 1.858749915117319e-01, + 1.699067802117410e-01, 1.546132267478873e-01, 1.400238206749695e-01, 1.261637395672913e-01, + 1.130534434072719e-01, 1.007084973747940e-01, 8.914024389873081e-02, 7.835612100141792e-02, + 6.835821233920988e-02, 5.914211536028976e-02, 5.069893012340832e-02, 4.301717763585550e-02, + 3.608020726673359e-02, 2.986316337017630e-02, 2.433722657129812e-02, 1.947675241971700e-02, + 1.525710171255895e-02, 1.163787492636240e-02, 8.433087782643718e-03, 4.449668997344735e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_480[960] = { + -2.353032150516754e-04, -4.619898752628163e-04, -6.262931535610879e-04, -7.929180432976445e-04, + -9.747166718929050e-04, -1.180256894474562e-03, -1.409209039594871e-03, -1.664473096973725e-03, + -1.946591608170231e-03, -2.257081732588478e-03, -2.597106916737789e-03, -2.967607624839524e-03, + -3.370454877988472e-03, -3.806285163352241e-03, -4.276873767639064e-03, -4.782469904501813e-03, + -5.324608721716763e-03, -5.903403814095400e-03, -6.520419726599805e-03, -7.175885277771099e-03, + -7.871422820642307e-03, -8.606586039759667e-03, -9.382480860899108e-03, -1.019827182163307e-02, + -1.105520547739066e-02, -1.195270300743193e-02, -1.289205910303846e-02, -1.387263484323160e-02, + -1.489528159506296e-02, -1.595856621933800e-02, -1.706288556735433e-02, -1.820666399965468e-02, + -1.939065975232718e-02, -2.061355417582714e-02, -2.187570925786862e-02, -2.317526315266411e-02, + -2.451227449041489e-02, -2.588471937157619e-02, -2.729263737090799e-02, -2.873390902713615e-02, + -3.020862738245264e-02, -3.171440372994384e-02, -3.325098858986303e-02, -3.481597793538342e-02, + -3.640892406933019e-02, -3.802742318209150e-02, -3.967067992672979e-02, -4.133575417353826e-02, + -4.302203371734278e-02, -4.472698045914417e-02, -4.645022292934329e-02, -4.818891490266687e-02, + -4.994225863256500e-02, -5.170690802826666e-02, -5.348162036097223e-02, -5.526334794593565e-02, + -5.705123152423822e-02, -5.884271749745559e-02, -6.063717235243996e-02, -6.243104027829089e-02, + -6.422303545004304e-02, -6.600961519440657e-02, -6.778962269634495e-02, -6.955996868581379e-02, + -7.131966266443390e-02, -7.306581273272733e-02, -7.479758913001458e-02, -7.651178225890490e-02, + -7.820711420768856e-02, -7.988010693411644e-02, -8.152964005319532e-02, -8.315237353264004e-02, + -8.474728946770714e-02, -8.631137544905677e-02, -8.784374452959058e-02, -8.934164364321417e-02, + -9.080411291245728e-02, -9.222795761428432e-02, -9.361232867223340e-02, -9.495377758870335e-02, + -9.625155313139856e-02, -9.750284620437569e-02, -9.870736514214426e-02, -9.986271288271026e-02, + -1.009680221406219e-01, -1.020202684361974e-01, -1.030183804850491e-01, -1.039596356759290e-01, + -1.048438825017798e-01, -1.056686838192766e-01, -1.064342821660323e-01, -1.071382314127799e-01, + -1.077799961121537e-01, -1.083570625865931e-01, -1.088690135027248e-01, -1.093135588677235e-01, + -1.096903559498340e-01, -1.099969655786929e-01, -1.102332261219973e-01, -1.103972812085189e-01, + -1.104898474883336e-01, -1.105086416532167e-01, -1.104537426996073e-01, -1.103225838568563e-01, + -1.101145827722143e-01, -1.098276928170364e-01, -1.094621746650760e-01, -1.090163960055733e-01, + -1.084908852561722e-01, -1.078834293141886e-01, -1.071937180231978e-01, -1.064196358069465e-01, + -1.055612509762041e-01, -1.046162812518618e-01, -1.035849043557610e-01, -1.024650162703341e-01, + -1.012568997532046e-01, -9.995864571932928e-02, -9.857014566194627e-02, -9.708911135857967e-02, + -9.551545820689084e-02, -9.384684920715425e-02, -9.208300062891550e-02, -9.022171021406450e-02, + -8.826309993000785e-02, -8.620493821803937e-02, -8.404742152815330e-02, -8.178792716809512e-02, + -7.942625026703617e-02, -7.695980775819990e-02, -7.438785600211463e-02, -7.170797002873608e-02, + -6.891994783815969e-02, -6.602189797715241e-02, -6.301349420724424e-02, -5.989191912667712e-02, + -5.665655641133161e-02, -5.330406164482222e-02, -4.983427241976235e-02, -4.624456893420224e-02, + -4.253455686336916e-02, -3.870195772538443e-02, -3.474585776145929e-02, -3.066341518682682e-02, + -2.645425077642105e-02, -2.211581608120528e-02, -1.764740541599136e-02, -1.304581363895818e-02, + -8.310425696208936e-03, -3.438268661133170e-03, 1.570315476576933e-03, 6.717697635290676e-03, + 1.200477020244778e-02, 1.743398319747869e-02, 2.300642061077823e-02, 2.872481423270595e-02, + 3.458896350634671e-02, 4.060106462625085e-02, 4.676102915752826e-02, 5.307133911821893e-02, + 5.953239090915557e-02, 6.614647812869151e-02, 7.291293184312803e-02, 7.983354189816511e-02, + 8.690807412770696e-02, 9.413813765275064e-02, 1.015233140203748e-01, 1.090651518336202e-01, + 1.167626546016197e-01, 1.246171387327525e-01, 1.326272948938113e-01, 1.407938190608664e-01, + 1.491152519299797e-01, 1.575921408388593e-01, 1.662224799248571e-01, 1.750067399059861e-01, + 1.839431938620024e-01, 1.930318183054904e-01, 2.022699854906251e-01, 2.116567430906184e-01, + 2.211888523410642e-01, 2.308655379767671e-01, 2.406837992341654e-01, 2.506420640291662e-01, + 2.607365124918583e-01, 2.709659073501196e-01, 2.813259021832532e-01, 2.918144694729168e-01, + 3.024270279840051e-01, 3.131603499997996e-01, 3.240095704645023e-01, 3.349719592361666e-01, + 3.460422935204829e-01, 3.572175180786021e-01, 3.684915649120530e-01, 3.798595119591716e-01, + 3.913146885756875e-01, 4.028532873867052e-01, 4.144688328137527e-01, 4.261571642320424e-01, + 4.379113897565727e-01, 4.497256320417501e-01, 4.615925445090212e-01, 4.735067030065239e-01, + 4.854600184866710e-01, 4.974471592901086e-01, 5.094597228333853e-01, 5.214909841729947e-01, + 5.335326819631583e-01, 5.455789811615239e-01, 5.576217157959890e-01, 5.696546730080154e-01, + 5.816685576268035e-01, 5.936560624526468e-01, 6.056083823929643e-01, 6.175192060085208e-01, + 6.293796611336280e-01, 6.411830842823245e-01, 6.529203544876097e-01, 6.645840786371451e-01, + 6.761653499550255e-01, 6.876573952173626e-01, 6.990511539119996e-01, 7.103400549562944e-01, + 7.215149331458728e-01, 7.325691772738999e-01, 7.434943718765665e-01, 7.542846327442048e-01, + 7.649313654540612e-01, 7.754281892901473e-01, 7.857670170752049e-01, 7.959414651061612e-01, + 8.059437233154637e-01, 8.157687070715176e-01, 8.254086223972127e-01, 8.348589373399948e-01, + 8.441125827416620e-01, 8.531651194538425e-01, 8.620108336276733e-01, 8.706456337542150e-01, + 8.790631561061171e-01, 8.872599706865123e-01, 8.952313288619367e-01, 9.029751680353524e-01, + 9.104863121445679e-01, 9.177625550620636e-01, 9.247997426966093e-01, 9.315962496426278e-01, + 9.381494858921667e-01, 9.444588390359354e-01, 9.505220861927248e-01, 9.563402921286364e-01, + 9.619114522936701e-01, 9.672366712325431e-01, 9.723156637834687e-01, 9.771501187120180e-01, + 9.817397501303696e-01, 9.860865871353246e-01, 9.901906380163595e-01, 9.940557180662704e-01, + 9.976842395284637e-01, 1.001080961257010e+00, 1.004247514102417e+00, 1.007188578458507e+00, + 1.009906654565108e+00, 1.012407428282884e+00, 1.014694702432600e+00, 1.016774659209400e+00, + 1.018650990561848e+00, 1.020330464463111e+00, 1.021817328911793e+00, 1.023118841384460e+00, + 1.024240262467000e+00, 1.025189721888128e+00, 1.025972450969440e+00, 1.026596938589443e+00, + 1.027069179375841e+00, 1.027397523939210e+00, 1.027587902203109e+00, 1.027648951922701e+00, + 1.027585830688143e+00, 1.027408519661012e+00, 1.027122986826984e+00, 1.026738673647482e+00, + 1.026261663878092e+00, 1.025701002415063e+00, 1.025061777648234e+00, 1.024353980976701e+00, + 1.023582385618774e+00, 1.022756514615106e+00, 1.021880604350422e+00, 1.020963871317665e+00, + 1.020009139549275e+00, 1.019027285501251e+00, 1.018019442784231e+00, 1.016996499560845e+00, + 1.015957433206324e+00, 1.014923441259795e+00, 1.013915946100629e+00, 1.013047565149327e+00, + 1.012216130365610e+00, 1.011044869639164e+00, 1.009914592130044e+00, 1.008824888092573e+00, + 1.007773858455400e+00, 1.006761700412993e+00, 1.005786648810854e+00, 1.004848753962734e+00, + 1.003946083413733e+00, 1.003078846506546e+00, 1.002245009135684e+00, 1.001444733905817e+00, + 1.000676188436651e+00, 9.999393169239009e-01, 9.992320848298057e-01, 9.985548127155425e-01, + 9.979055415627330e-01, 9.972842679758880e-01, 9.966890948441745e-01, 9.961203379971326e-01, + 9.955761256313581e-01, 9.950565724564597e-01, 9.945597525471822e-01, 9.940860378486615e-01, + 9.936337788972491e-01, 9.932031606606759e-01, 9.927921871265732e-01, 9.924015177880798e-01, + 9.920297273323891e-01, 9.916767775088281e-01, 9.913408767719142e-01, 9.910230654424902e-01, + 9.907216425865902e-01, 9.904366799536263e-01, 9.901668953434221e-01, 9.899131011580791e-01, + 9.896735637374597e-01, 9.894488374513719e-01, 9.892374835404283e-01, 9.890401927796704e-01, + 9.888556356037892e-01, 9.886843467692753e-01, 9.885247606051014e-01, 9.883778520531268e-01, + 9.882423270582524e-01, 9.881185638915363e-01, 9.880051626345804e-01, 9.879032023766432e-01, + 9.878111744348976e-01, 9.877295459610343e-01, 9.876571983429736e-01, 9.875949843246187e-01, + 9.875412739766566e-01, 9.874969061399389e-01, 9.874606249127551e-01, 9.874329809802893e-01, + 9.874126414437681e-01, 9.874004750404033e-01, 9.873949921033299e-01, 9.873969162747074e-01, + 9.874049060317581e-01, 9.874197049003676e-01, 9.874399717110517e-01, 9.874663281231737e-01, + 9.874973205882319e-01, 9.875338926695315e-01, 9.875746535410983e-01, 9.876201238703241e-01, + 9.876689801932402e-01, 9.877221556193183e-01, 9.877781920433015e-01, 9.878376489591358e-01, + 9.878991990245439e-01, 9.879637979933339e-01, 9.880300303653743e-01, 9.880984675859855e-01, + 9.881678007807095e-01, 9.882390300097154e-01, 9.883107693992456e-01, 9.883835200189653e-01, + 9.884560159878955e-01, 9.885294200392185e-01, 9.886022219397892e-01, 9.886749404176028e-01, + 9.887466261142505e-01, 9.888182771263505e-01, 9.888882480852147e-01, 9.889574384705896e-01, + 9.890247977602895e-01, 9.890911247701029e-01, 9.891551701556196e-01, 9.892178658748239e-01, + 9.892779555818088e-01, 9.893365186903538e-01, 9.893923680007577e-01, 9.894462830852175e-01, + 9.894972124952000e-01, 9.895463342815009e-01, 9.895923617530382e-01, 9.896362652966239e-01, + 9.896772011542693e-01, 9.897162195263046e-01, 9.897520286480039e-01, 9.897859195209235e-01, + 9.898170267411330e-01, 9.898462068764986e-01, 9.898725363809847e-01, 9.898975138787787e-01, + 9.899200050208486e-01, 9.899410789223559e-01, 9.899600605054418e-01, 9.899782261038060e-01, + 9.899945557067980e-01, 9.900103500807507e-01, 9.900248320990181e-01, 9.900394023736973e-01, + 9.900532105829365e-01, 9.900674746047259e-01, 9.900814722948890e-01, 9.900966926051257e-01, + 9.901122448734595e-01, 9.901293790312005e-01, 9.901474648912307e-01, 9.901680598867444e-01, + 9.901902265696609e-01, 9.902151896501201e-01, 9.902424418296485e-01, 9.902734448815004e-01, + 9.903071270768942e-01, 9.903448913950654e-01, 9.903862280081246e-01, 9.904324484666853e-01, + 9.904825650601110e-01, 9.905379830873822e-01, 9.905980602136440e-01, 9.906640366554630e-01, + 9.907348826312993e-01, 9.908120376822228e-01, 9.908947858311721e-01, 9.909842592301273e-01, + 9.910795247770178e-01, 9.911819240108124e-01, 9.912905118607647e-01, 9.914064705361564e-01, + 9.915288011543961e-01, 9.916586940166509e-01, 9.917952720685562e-01, 9.919396217291009e-01, + 9.920906151219310e-01, 9.922495028313456e-01, 9.924152398352751e-01, 9.925887208794144e-01, + 9.927688708468421e-01, 9.929569112537944e-01, 9.931516528513824e-01, 9.933539244159140e-01, + 9.935626893131695e-01, 9.937790866568735e-01, 9.940016434044485e-01, 9.942312024833810e-01, + 9.944668184371617e-01, 9.947093441694513e-01, 9.949572854565533e-01, 9.952116634297566e-01, + 9.954712635321227e-01, 9.957367951478069e-01, 9.960068616185641e-01, 9.962823025614079e-01, + 9.965617986382630e-01, 9.968461329825753e-01, 9.971338271912752e-01, 9.974256691222113e-01, + 9.977203369515556e-01, 9.980185087055744e-01, 9.983185871761977e-01, 9.986213520769593e-01, + 9.989255426466267e-01, 9.992317314100975e-01, 9.995382582242990e-01, 9.998461160718275e-01, + 1.000153907612080e+00, 1.000461955079660e+00, 1.000768859280338e+00, 1.001075613053728e+00, + 1.001380551217109e+00, 1.001684244734497e+00, 1.001985425397567e+00, 1.002284871786226e+00, + 1.002580975161843e+00, 1.002874411368430e+00, 1.003163845364970e+00, 1.003450063374329e+00, + 1.003731570287893e+00, 1.004009147462043e+00, 1.004281457582935e+00, 1.004549339226336e+00, + 1.004811375053364e+00, 1.005068272394360e+00, 1.005318795748286e+00, 1.005563968008037e+00, + 1.005802269635282e+00, 1.006034554002353e+00, 1.006259855360867e+00, 1.006479018139540e+00, + 1.006690541428116e+00, 1.006895570408563e+00, 1.007093045696527e+00, 1.007283799246233e+00, + 1.007466616298057e+00, 1.007642728426847e+00, 1.007811036585595e+00, 1.007972441990187e+00, + 1.008125875904472e+00, 1.008272602383284e+00, 1.008411468616852e+00, 1.008543573152632e+00, + 1.008668018334797e+00, 1.008786009787269e+00, 1.008896526233555e+00, 1.009000766336071e+00, + 1.009097763850333e+00, 1.009188880897370e+00, 1.009273163797313e+00, 1.009351762546296e+00, + 1.009423944949143e+00, 1.009491175244507e+00, 1.009552401900961e+00, 1.009608886895764e+00, + 1.009659973830751e+00, 1.009707093778162e+00, 1.009749238562067e+00, 1.009787744284661e+00, + 1.009822090220407e+00, 1.009853706282597e+00, 1.009881498943010e+00, 1.009906958448099e+00, + 1.009929567021562e+00, 1.009950573483366e+00, 1.009969021400474e+00, 1.009986499185054e+00, + 1.010002363879044e+00, 1.010017890428877e+00, 1.010032170180360e+00, 1.010046722045583e+00, + 1.010060809299530e+00, 1.010075674445289e+00, 1.010090449982098e+00, 1.010106564965965e+00, + 1.010123226584120e+00, 1.010141762173145e+00, 1.010161131093372e+00, 1.010182635897876e+00, + 1.010205587931660e+00, 1.010231078494249e+00, 1.010257950227988e+00, 1.010287732968580e+00, + 1.010319484524512e+00, 1.010354079663767e+00, 1.010390635488037e+00, 1.010430470494512e+00, + 1.010472266495074e+00, 1.010517096381509e+00, 1.010564099281000e+00, 1.010614266894512e+00, + 1.010666285876455e+00, 1.010721360243234e+00, 1.010778416755264e+00, 1.010838252644461e+00, + 1.010899655674578e+00, 1.010963729626641e+00, 1.011029191301694e+00, 1.011096993993037e+00, + 1.011165861239173e+00, 1.011236610341260e+00, 1.011308167670753e+00, 1.011381453638912e+00, + 1.011454785713102e+00, 1.011529185153809e+00, 1.011603680910505e+00, 1.011678803938046e+00, + 1.011753008569803e+00, 1.011827484797985e+00, 1.011900936547881e+00, 1.011973876511603e+00, + 1.012044885003304e+00, 1.012114985644919e+00, 1.012182837094955e+00, 1.012249023976742e+00, + 1.012312095063070e+00, 1.012373028737774e+00, 1.012430463679316e+00, 1.012484972246822e+00, + 1.012535058602453e+00, 1.012581678169188e+00, 1.012623472898504e+00, 1.012660975529858e+00, + 1.012692758750213e+00, 1.012719789201144e+00, 1.012740575296603e+00, 1.012755753887085e+00, + 1.012763948841204e+00, 1.012765922449960e+00, 1.012760298661069e+00, 1.012747819936584e+00, + 1.012726958954961e+00, 1.012698607692183e+00, 1.012661400539405e+00, 1.012615904116265e+00, + 1.012560833005713e+00, 1.012497050269805e+00, 1.012422888521601e+00, 1.012339226241367e+00, + 1.012244921966297e+00, 1.012140460211194e+00, 1.012024302085441e+00, 1.011897560567707e+00, + 1.011758810583150e+00, 1.011608449127642e+00, 1.011445162723270e+00, 1.011269960947744e+00, + 1.011081255645969e+00, 1.010879608424312e+00, 1.010663676735228e+00, 1.010434184200640e+00, + 1.010189681124657e+00, 1.009930754807923e+00, 1.009655660215271e+00, 1.009365251564694e+00, + 1.009058249873833e+00, 1.008734758578989e+00, 1.008393079963091e+00, 1.008034308295421e+00, + 1.007656661215973e+00, 1.007260142622887e+00, 1.006843352506855e+00, 1.006407009542103e+00, + 1.005949145170711e+00, 1.005470005637052e+00, 1.004967986424467e+00, 1.004443531995945e+00, + 1.003894772403371e+00, 1.003321903663793e+00, 1.002723127308148e+00, 1.002098854400575e+00, + 1.001447278873483e+00, 1.000768505317086e+00, 1.000060686758758e+00, 9.993242684851855e-01, + 9.985573503390627e-01, 9.977600196406868e-01, 9.969306036935497e-01, 9.960694269553644e-01, + 9.951746430061121e-01, 9.942466438407230e-01, 9.932837131068657e-01, 9.922861082472264e-01, + 9.912523092989319e-01, 9.901827419790691e-01, 9.890757868707590e-01, 9.879313024174022e-01, + 9.863553220272523e-01, 9.847362453480265e-01, 9.831750948772566e-01, 9.815583336011345e-01, + 9.798613526271561e-01, 9.780617486993630e-01, 9.761574317374303e-01, 9.741378617337759e-01, + 9.719990112065752e-01, 9.697327413658168e-01, 9.673331975559332e-01, 9.647915124057732e-01, + 9.621011497566145e-01, 9.592539757044516e-01, 9.562427177295731e-01, 9.530600909726344e-01, + 9.496984081652284e-01, 9.461498120176854e-01, 9.424071613625743e-01, 9.384634163826711e-01, + 9.343112966094085e-01, 9.299449872197452e-01, 9.253567968750328e-01, 9.205404627076625e-01, + 9.154896280575360e-01, 9.101986790930605e-01, 9.046620597741508e-01, 8.988755194372424e-01, + 8.928338316495705e-01, 8.865337190368053e-01, 8.799712722567934e-01, 8.731437835983047e-01, + 8.660476534563131e-01, 8.586812520174252e-01, 8.510420440685049e-01, 8.431297226886574e-01, + 8.349435141989714e-01, 8.264839911291133e-01, 8.177505366573690e-01, 8.087449817124315e-01, + 7.994681492797084e-01, 7.899235162194718e-01, 7.801137731566502e-01, 7.700431275216928e-01, + 7.597145736971065e-01, 7.491330971820804e-01, 7.383028603058783e-01, 7.272298755824693e-01, + 7.159201919962611e-01, 7.043814340356083e-01, 6.926196927377140e-01, 6.806438831866077e-01, + 6.684616478236647e-01, 6.560830137986515e-01, 6.435179268559957e-01, 6.307755329382612e-01, + 6.178641647786525e-01, 6.047954625702541e-01, 5.915799587176216e-01, 5.782289366005894e-01, + 5.647535885752191e-01, 5.511703155400274e-01, 5.374905090437071e-01, 5.237263500445715e-01, + 5.098915423728255e-01, 4.960008074926423e-01, 4.820662943337458e-01, 4.681017110048007e-01, + 4.541216995958746e-01, 4.401421815729068e-01, 4.261772971493010e-01, 4.122417888542512e-01, + 3.983499612526493e-01, 3.845172335531009e-01, 3.707583717376236e-01, 3.570886786795506e-01, + 3.435228672445627e-01, 3.300763764703638e-01, 3.167640325043893e-01, 3.036004651973109e-01, + 2.905996158436682e-01, 2.777758503744847e-01, 2.651434678028531e-01, 2.527161881181577e-01, + 2.405069849650012e-01, 2.285283969438072e-01, 2.167933432162879e-01, 2.053139897833021e-01, + 1.941021906320988e-01, 1.831680872008943e-01, 1.725221947208913e-01, 1.621735416384834e-01, + 1.521320683467849e-01, 1.424052801149985e-01, 1.330015240938615e-01, 1.239260664828526e-01, + 1.151858295527293e-01, 1.067840430193724e-01, 9.872637505002878e-02, 9.101379000888035e-02, + 8.365057236623055e-02, 7.663508305536153e-02, 6.997033405748826e-02, 6.365188111381365e-02, + 5.768176015814392e-02, 5.205244216987966e-02, 4.676538412257621e-02, 4.180950541438362e-02, + 3.718640251368464e-02, 3.288072750732215e-02, 2.889548499582958e-02, 2.520980565928884e-02, + 2.183057564646272e-02, 1.872896194002638e-02, 1.592127815153420e-02, 1.336381425803020e-02, + 1.108558877807282e-02, 8.943474189364638e-03, 6.758124889697787e-03, 3.504438130619497e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_80_5ms[80] = { + 9.959086585790517e-04, 3.819056787237678e-03, 9.540832613229890e-03, 1.921659800166160e-02, 3.382719081038548e-02, + 5.424831667522354e-02, 8.120777668775610e-02, 1.152171887125930e-01, 1.564942331034909e-01, 2.049363422022628e-01, + 2.601166575816199e-01, 3.212814164616093e-01, 3.873472997948746e-01, 4.569497078592333e-01, 5.285192958868393e-01, + 6.003522489375573e-01, 6.706896380227332e-01, 7.378044458510402e-01, 8.000925313431716e-01, 8.561409184410547e-01, + 9.048272294524792e-01, 9.453685031730190e-01, 9.773507430600533e-01, 1.000800872826561e+00, 1.016171590112097e+00, + 1.024315247630982e+00, 1.026415431432931e+00, 1.023858366571912e+00, 1.018135705524407e+00, 1.010794822557756e+00, + 1.003406509762925e+00, 9.967831265986109e-01, 9.920995520917141e-01, 9.892206942816891e-01, 9.879658322200813e-01, + 9.881273531631907e-01, 9.894805541465801e-01, 9.917849916000535e-01, 9.947847580943504e-01, 9.982119669301160e-01, + 1.001791235858836e+00, 1.005242583245485e+00, 1.008283053756130e+00, 1.010631281038659e+00, 1.012015300253356e+00, + 1.012180753005270e+00, 1.010896765282633e+00, 1.007963362035220e+00, 1.003227255072391e+00, 9.966050551498514e-01, + 9.868284225039941e-01, 9.731250287581631e-01, 9.540636479502398e-01, 9.283864275822276e-01, 8.950916858157935e-01, + 8.534769362643825e-01, 8.032090930429980e-01, 7.444735201251689e-01, 6.780787033699449e-01, 6.053970453856138e-01, + 5.282077505750667e-01, 4.486552956056635e-01, 3.691875990296312e-01, 2.924566408966777e-01, 2.210718537110463e-01, + 1.573148583944309e-01, 1.030525757797768e-01, 5.982732244758054e-02, 2.871831923385133e-02, 9.683884928956490e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_160_5ms[160] = { + 6.143388180964179e-04, 1.489582832987000e-03, 2.884104959764029e-03, 4.934298832466617e-03, 7.779130464154915e-03, + 1.154910606525086e-02, 1.637155619860352e-02, 2.237116158648752e-02, 2.966159685753317e-02, 3.835663329277230e-02, + 4.855610986150206e-02, 6.035055738891727e-02, 7.382288203064732e-02, 8.903563687211119e-02, 1.060356225286319e-01, + 1.248534855777947e-01, 1.454931890869180e-01, 1.679435556337752e-01, 1.921728622634411e-01, 2.181238261985594e-01, + 2.457259744642953e-01, 2.748839432649996e-01, 3.054824712370942e-01, 3.373873799614014e-01, 3.704415932452488e-01, + 4.044749630814483e-01, 4.393004362003260e-01, 4.747225454237193e-01, 5.105341492548225e-01, 5.465201916422433e-01, + 5.824658100332457e-01, 6.181452662624718e-01, 6.533411462740817e-01, 6.878367295965062e-01, 7.214176027060971e-01, + 7.538887973483771e-01, 7.850546571907628e-01, 8.147397447696774e-01, 8.427819363777799e-01, 8.690376742017057e-01, + 8.933935477349644e-01, 9.157483563218768e-01, 9.360270196617569e-01, 9.541731142261065e-01, 9.701635474343885e-01, + 9.840036439809510e-01, 9.957199420334376e-01, 1.005374268639838e+00, 1.013046655758663e+00, 1.018843380560658e+00, + 1.022896948293643e+00, 1.025355286710874e+00, 1.026382881625701e+00, 1.026155530733488e+00, 1.024853974580724e+00, + 1.022664602721801e+00, 1.019779396547454e+00, 1.016391686789653e+00, 1.012697033320358e+00, 1.008885191761748e+00, + 1.005378742804807e+00, 1.001563778373068e+00, 9.982531564931281e-01, 9.954346644968789e-01, 9.930950268060122e-01, + 9.912170911359961e-01, 9.897805192546195e-01, 9.887624937408933e-01, 9.881383235740961e-01, 9.878819413827574e-01, + 9.879662130250981e-01, 9.883630508181326e-01, 9.890434070785485e-01, 9.899772316163624e-01, 9.911334564321237e-01, + 9.924800441092685e-01, 9.939841207305906e-01, 9.956121471675398e-01, 9.973300590248015e-01, 9.991033633647473e-01, + 1.000897441314013e+00, 1.002677088643863e+00, 1.004407190937699e+00, 1.006052289109999e+00, 1.007576934100958e+00, + 1.008945862447015e+00, 1.010124241309341e+00, 1.011077969726137e+00, 1.011773962181442e+00, 1.012180362866919e+00, + 1.012266707295288e+00, 1.012004064757857e+00, 1.011365223023975e+00, 1.010324996851905e+00, 1.008860731864438e+00, + 1.006952983357691e+00, 1.004586273379809e+00, 1.001749900308864e+00, 9.984386632116344e-01, 9.946500332901397e-01, + 9.895756853352172e-01, 9.838303127859196e-01, 9.769999155793757e-01, 9.689141159310996e-01, 9.594038121639412e-01, + 9.483086322505029e-01, 9.354860218216989e-01, 9.208101305030523e-01, 9.041732260327581e-01, 8.854882249661838e-01, + 8.646864947605046e-01, 8.417237467711145e-01, 8.165875713256009e-01, 7.892986353718001e-01, 7.599171886893816e-01, + 7.285474515411827e-01, 6.953282935906302e-01, 6.604334017809461e-01, 6.240661431421666e-01, 5.864461424698465e-01, + 5.478160663871147e-01, 5.084499758302218e-01, 4.686361426418982e-01, 4.286789889246253e-01, 3.889032719013045e-01, + 3.496431418636314e-01, 3.112360816586544e-01, 2.740128472224535e-01, 2.382847225401666e-01, 2.043379825955252e-01, + 1.724305860483632e-01, 1.427939789949265e-01, 1.156385879569741e-01, 9.115821766571995e-02, 6.952749039054593e-02, + 5.088975408628225e-02, 3.533430192568954e-02, 2.286680405144430e-02, 1.338005016725895e-02, 6.640506529168652e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_240_5ms[240] = { + 5.087227626168386e-04, 9.959086585790517e-04, 1.682208006328800e-03, 2.609697259047744e-03, 3.819056787237678e-03, + 5.349319592933909e-03, 7.243906383895192e-03, 9.540832613229890e-03, 1.227637642543709e-02, 1.548950238899404e-02, + 1.921659800166160e-02, 2.349369619441617e-02, 2.835199581667961e-02, 3.382719081038548e-02, 3.994939538719628e-02, + 4.674775238543380e-02, 5.424831667522354e-02, 6.247770776443612e-02, 7.145835917501348e-02, 8.120777668775610e-02, + 9.174400412319896e-02, 1.030764959637497e-01, 1.152171887125930e-01, 1.281665713944242e-01, 1.419264381068653e-01, + 1.564942331034909e-01, 1.718593189799504e-01, 1.880134254543744e-01, 2.049363422022628e-01, 2.226123055761096e-01, + 2.410151242797736e-01, 2.601166575816199e-01, 2.798871008989962e-01, 3.002880135563586e-01, 3.212814164616093e-01, + 3.428208463088390e-01, 3.648596557863134e-01, 3.873472997948746e-01, 4.102294951869188e-01, 4.334494534591082e-01, + 4.569497078592333e-01, 4.806696403251166e-01, 5.045473815014847e-01, 5.285192958868393e-01, 5.525196099932443e-01, + 5.764872452085427e-01, 6.003522489375573e-01, 6.240509872809882e-01, 6.475182586093196e-01, 6.706896380227332e-01, + 6.935029068990036e-01, 7.158927516396895e-01, 7.378044458510402e-01, 7.591787241845952e-01, 7.799586608897265e-01, + 8.000925313431716e-01, 8.195318652294690e-01, 8.382288957404715e-01, 8.561409184410547e-01, 8.732316951214179e-01, + 8.894702022170831e-01, 9.048272294524792e-01, 9.192736375782965e-01, 9.327940405054362e-01, 9.453685031730190e-01, + 9.569883933538136e-01, 9.676486424195593e-01, 9.773507430600533e-01, 9.861027831072527e-01, 9.939122412655677e-01, + 1.000800872826561e+00, 1.006787811971719e+00, 1.011901269172423e+00, 1.016171590112097e+00, 1.019636414864842e+00, + 1.022336613864005e+00, 1.024315247630982e+00, 1.025621299895396e+00, 1.026303439275662e+00, 1.026415431432931e+00, + 1.026007933174836e+00, 1.025137435167917e+00, 1.023858366571912e+00, 1.022226936424625e+00, 1.020300550334848e+00, + 1.018135705524407e+00, 1.015792146756340e+00, 1.013325966774524e+00, 1.010794822557756e+00, 1.008265131568879e+00, + 1.006046874304407e+00, 1.003406509762925e+00, 1.000977398831985e+00, 9.987704535700208e-01, 9.967831265986109e-01, + 9.950118905889862e-01, 9.934523971504882e-01, 9.920995520917141e-01, 9.909475998606236e-01, 9.899902426925508e-01, + 9.892206942816891e-01, 9.886318043013834e-01, 9.882160904669929e-01, 9.879658322200813e-01, 9.878730767519871e-01, + 9.879296932443894e-01, 9.881273531631907e-01, 9.884575535474619e-01, 9.889115869213529e-01, 9.894805541465801e-01, + 9.901553455166457e-01, 9.909266562913843e-01, 9.917849916000535e-01, 9.927206838643636e-01, 9.937239208721489e-01, + 9.947847580943504e-01, 9.958931493776203e-01, 9.970389567617592e-01, 9.982119669301160e-01, 9.994020338838508e-01, + 1.000598323893564e+00, 1.001791235858836e+00, 1.002969837054169e+00, 1.004123786397111e+00, 1.005242583245485e+00, + 1.006315717067918e+00, 1.007332693127034e+00, 1.008283053756130e+00, 1.009156423082384e+00, 1.009942535308151e+00, + 1.010631281038659e+00, 1.011212744622770e+00, 1.011677230257499e+00, 1.012015300253356e+00, 1.012217779097186e+00, + 1.012275790821109e+00, 1.012180753005270e+00, 1.011924425888915e+00, 1.011498917644724e+00, 1.010896765282633e+00, + 1.010110965619444e+00, 1.009135094671655e+00, 1.007963362035220e+00, 1.006590756505588e+00, 1.005013115379014e+00, + 1.003227255072391e+00, 1.001231060075500e+00, 9.990235555436858e-01, 9.966050551498514e-01, 9.939894706113089e-01, + 9.904539200261149e-01, 9.868284225039941e-01, 9.827716736909488e-01, 9.782206672373213e-01, 9.731250287581631e-01, + 9.674323528812744e-01, 9.610947043524248e-01, 9.540636479502398e-01, 9.462952991190324e-01, 9.377489107516087e-01, + 9.283864275822276e-01, 9.181762606422500e-01, 9.070861558801854e-01, 8.950916858157935e-01, 8.821696237804294e-01, + 8.683025287048570e-01, 8.534769362643825e-01, 8.376852006833730e-01, 8.209275259764013e-01, 8.032090930429980e-01, + 7.845450482523652e-01, 7.649554851899686e-01, 7.444735201251689e-01, 7.231348066419057e-01, 7.009860555207412e-01, + 6.780787033699450e-01, 6.544686506489734e-01, 6.302212149502727e-01, 6.053970453856138e-01, 5.800715766089168e-01, + 5.543129276657669e-01, 5.282077505750727e-01, 5.018369724442092e-01, 4.752902962082383e-01, 4.486552956056652e-01, + 4.220281118338883e-01, 3.955057965950340e-01, 3.691875990296320e-01, 3.431732847389720e-01, 3.175633015043183e-01, + 2.924566408966782e-01, 2.679463783886042e-01, 2.441231331518492e-01, 2.210718537110466e-01, 1.988719153219592e-01, + 1.775967625327044e-01, 1.573148583944310e-01, 1.380903364946733e-01, 1.199837497591550e-01, 1.030525757797769e-01, + 8.735085011789188e-02, 7.292811584897502e-02, 5.982732244758056e-02, 4.808178837444506e-02, 3.771135297837851e-02, + 2.871831923385135e-02, 2.108352028641225e-02, 1.476289412849005e-02, 9.683884928956495e-03, 5.642168789286858e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_320_5ms[320] = { + 4.595886345493055e-04, 7.919323614002698e-04, 1.227927169310031e-03, 1.783653266717233e-03, 2.479549413444207e-03, + 3.329799454594261e-03, 4.353535478916468e-03, 5.564965156664018e-03, 6.986108359341676e-03, 8.629882322202329e-03, + 1.051343406844975e-02, 1.265082642578719e-02, 1.506090447446532e-02, 1.775591229287213e-02, 2.075475983187825e-02, + 2.406813715401559e-02, 2.771207863541604e-02, 3.169933248543932e-02, 3.604609640533871e-02, 4.076128638095439e-02, + 4.586038120884381e-02, 5.135136676471998e-02, 5.724780220726930e-02, 6.355854744461048e-02, 7.029450733434550e-02, + 7.745987198268531e-02, 8.506635369887924e-02, 9.311641620512773e-02, 1.016162955027316e-01, 1.105690806271684e-01, + 1.199789286645804e-01, 1.298417294090302e-01, 1.401623800497866e-01, 1.509371564593891e-01, 1.621632295622287e-01, + 1.738354123649302e-01, 1.859520359191026e-01, 1.985008828937603e-01, 2.114778554475382e-01, 2.248732557074316e-01, + 2.386763947872762e-01, 2.528729453658238e-01, 2.674547009618951e-01, 2.824031465430401e-01, 2.977050145264297e-01, + 3.133419120661713e-01, 3.292976696294886e-01, 3.455490160824131e-01, 3.620795045342974e-01, 3.788648665671841e-01, + 3.958851576591690e-01, 4.131143794748322e-01, 4.305308301005456e-01, 4.481076715576617e-01, 4.658227790464821e-01, + 4.836466393241829e-01, 5.015564851667653e-01, 5.195228071176610e-01, 5.375197039843709e-01, 5.555183841040963e-01, + 5.734957812557457e-01, 5.914186654649489e-01, 6.092622887527459e-01, 6.269981160888640e-01, 6.446002007776794e-01, + 6.620384583071039e-01, 6.792906550106088e-01, 6.963256426589250e-01, 7.131194393772130e-01, 7.296469905863920e-01, + 7.458864594794676e-01, 7.618094719403713e-01, 7.773958448163656e-01, 7.926208751337592e-01, 8.074666387233143e-01, + 8.219101564897180e-01, 8.359343163788637e-01, 8.495180470826319e-01, 8.626485837105826e-01, 8.753083234662220e-01, + 8.874884715160425e-01, 8.991737724042251e-01, 9.103527429187326e-01, 9.210144133066616e-01, 9.311556192776946e-01, + 9.407644740241826e-01, 9.498382236872068e-01, 9.583732599601223e-01, 9.663690412284377e-01, 9.738235617865406e-01, + 9.807442506043361e-01, 9.871297972052695e-01, 9.929872268444632e-01, 9.983241398929388e-01, 1.003150760219063e+00, + 1.007473713377193e+00, 1.011309151636166e+00, 1.014666681083198e+00, 1.017563337333301e+00, 1.020014681326785e+00, + 1.022039872150903e+00, 1.023654257342442e+00, 1.024881624147540e+00, 1.025739288978437e+00, 1.026250709375593e+00, + 1.026436666375082e+00, 1.026320857404224e+00, 1.025922917798664e+00, 1.025269979527211e+00, 1.024382188798244e+00, + 1.023284940887058e+00, 1.022000829220643e+00, 1.020555973231408e+00, 1.018971390778550e+00, 1.017275179369116e+00, + 1.015489129111694e+00, 1.013639356938881e+00, 1.011747750709711e+00, 1.009840844244693e+00, 1.007939764480188e+00, + 1.006407400915498e+00, 1.004374825095777e+00, 1.002469814737132e+00, 1.000689073754539e+00, 9.990346001249977e-01, + 9.975024904153303e-01, 9.960941547576162e-01, 9.948051243621099e-01, 9.936362728142866e-01, 9.925826537087717e-01, + 9.916447007525191e-01, 9.908170758245324e-01, 9.900998445795673e-01, 9.894873685512386e-01, 9.889794323427195e-01, + 9.885701787626714e-01, 9.882591911282058e-01, 9.880404423341358e-01, 9.879133688360181e-01, 9.878718098237022e-01, + 9.879150762106034e-01, 9.880368938846610e-01, 9.882364564839506e-01, 9.885073687439192e-01, 9.888487088987707e-01, + 9.892539488627546e-01, 9.897220412447528e-01, 9.902463287269285e-01, 9.908256340476208e-01, 9.914531811725067e-01, + 9.921276814881759e-01, 9.928422499725458e-01, 9.935955098307742e-01, 9.943804814776256e-01, 9.951957244449919e-01, + 9.960341878404958e-01, 9.968943831870675e-01, 9.977692009836100e-01, 9.986571134591464e-01, 9.995509738170480e-01, + 1.000449227898040e+00, 1.001344692310058e+00, 1.002235786606954e+00, 1.003115291715261e+00, 1.003981602446902e+00, + 1.004827468041713e+00, 1.005651275972376e+00, 1.006445772052972e+00, 1.007209352772459e+00, 1.007934783656087e+00, + 1.008620496650569e+00, 1.009259314290145e+00, 1.009849742422788e+00, 1.010384692193296e+00, 1.010862783160582e+00, + 1.011277044709547e+00, 1.011626247430694e+00, 1.011903571699736e+00, 1.012107954864219e+00, 1.012232755709885e+00, + 1.012277089047072e+00, 1.012234505114778e+00, 1.012104319978655e+00, 1.011880293122688e+00, 1.011561972516341e+00, + 1.011143373963981e+00, 1.010624321020038e+00, 1.009999148545101e+00, 1.009268031808824e+00, 1.008425698479647e+00, + 1.007472774447058e+00, 1.006404483571931e+00, 1.005222003295591e+00, 1.003921160689206e+00, 1.002503762756151e+00, + 1.000966332772540e+00, 9.993114007411373e-01, 9.975362702189898e-01, 9.956442306333592e-01, 9.936333924912825e-01, + 9.908677480361242e-01, 9.882326326262749e-01, 9.853620567056602e-01, 9.822305093671991e-01, 9.788185853162172e-01, + 9.751026333215268e-01, 9.710631852370086e-01, 9.666759668947944e-01, 9.619242192293307e-01, 9.567841986369235e-01, + 9.512394303101863e-01, 9.452700238623795e-01, 9.388615698236068e-01, 9.319946435581106e-01, 9.246592033932568e-01, + 9.168383396399868e-01, 9.085218034087421e-01, 8.996967011299613e-01, 8.903562054918268e-01, 8.804877931535187e-01, + 8.700884209228057e-01, 8.591492134848259e-01, 8.476686394755906e-01, 8.356428970797861e-01, 8.230753889817990e-01, + 8.099649296155544e-01, 7.963204506324437e-01, 7.821460539775005e-01, 7.674541821769616e-01, 7.522563457568547e-01, + 7.365702052057368e-01, 7.204090552899627e-01, 7.037975107157410e-01, 6.867542812151157e-01, 6.693041888771051e-01, + 6.514710959179395e-01, 6.332854832820911e-01, 6.147685389896460e-01, 5.959553778639692e-01, 5.768737955463938e-01, + 5.575534287167304e-01, 5.380320138068979e-01, 5.183454027643563e-01, 4.985259415650634e-01, 4.786156067459849e-01, + 4.586473038370941e-01, 4.386643656872842e-01, 4.187046888325280e-01, 3.988123056192917e-01, 3.790262923635886e-01, + 3.593914828698096e-01, 3.399474132903109e-01, 3.207392420889753e-01, 3.018061113177048e-01, 2.831905952786929e-01, + 2.649288369241889e-01, 2.470608550624402e-01, 2.296201119084317e-01, 2.126433716126151e-01, 1.961601816145380e-01, + 1.802035203864437e-01, 1.647996883470626e-01, 1.499787548077656e-01, 1.357643522991611e-01, 1.221842534547464e-01, + 1.092601994264172e-01, 9.701788451015501e-02, 8.547680283183663e-02, 7.465976378295235e-02, 6.458254322751883e-02, + 5.526281189874138e-02, 4.670976978373095e-02, 3.893244425578719e-02, 3.192976013776996e-02, 2.569810636390756e-02, + 2.022259265088492e-02, 1.548317776486452e-02, 1.144924909653903e-02, 8.076482660383199e-03, 5.300044080947794e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_480_5ms[480] = { + 4.090106504820579e-04, 6.143388180964179e-04, 8.571759876954877e-04, 1.147015057857495e-03, 1.489582832987000e-03, + 1.889770382231583e-03, 2.353000800169909e-03, 2.884104959764029e-03, 3.488213786635855e-03, 4.170040431489613e-03, + 4.934298832466617e-03, 5.787076505403503e-03, 6.733811743137561e-03, 7.779130464154915e-03, 8.927044958757816e-03, + 1.018202888968871e-02, 1.154910606525086e-02, 1.303349217699797e-02, 1.463951288465963e-02, 1.637155619860352e-02, + 1.823455383898077e-02, 2.023309488998589e-02, 2.237116158648752e-02, 2.465237348403478e-02, 2.708101935270475e-02, + 2.966159685753317e-02, 3.239884850877327e-02, 3.529601774976465e-02, 3.835663329277230e-02, 4.158447932459513e-02, + 4.498322421745353e-02, 4.855610986150206e-02, 5.230596475016741e-02, 5.623624576084146e-02, 6.035055738891727e-02, + 6.465186317477950e-02, 6.914195749790462e-02, 7.382288203064732e-02, 7.869709331995660e-02, 8.376761638427657e-02, + 8.903563687211118e-02, 9.450199243028472e-02, 1.001680193006426e-01, 1.060356225286319e-01, 1.121060220821844e-01, + 1.183788547045326e-01, 1.248534855777947e-01, 1.315302847610869e-01, 1.384103079528939e-01, 1.454931890869180e-01, + 1.527772946853750e-01, 1.602608842337125e-01, 1.679435556337752e-01, 1.758245615079801e-01, 1.839020119821303e-01, + 1.921728622634411e-01, 2.006344295681524e-01, 2.092853879977170e-01, 2.181238261985594e-01, 2.271462264407930e-01, + 2.363479205237173e-01, 2.457259744642953e-01, 2.552771551741124e-01, 2.649981094228982e-01, 2.748839432649996e-01, + 2.849296444030153e-01, 2.951306505827265e-01, 3.054824712370942e-01, 3.159799638238941e-01, 3.266169794538543e-01, + 3.373873799614014e-01, 3.482855915638277e-01, 3.593057693987583e-01, 3.704415932452488e-01, 3.816862385160692e-01, + 3.930329782788047e-01, 4.044749630814483e-01, 4.160051103939122e-01, 4.276159595085598e-01, 4.393004362003260e-01, + 4.510516333434032e-01, 4.628616046119925e-01, 4.747225454237193e-01, 4.866266705542529e-01, 4.985664508456704e-01, + 5.105341492548225e-01, 5.225212793188740e-01, 5.345190505841265e-01, 5.465201916422433e-01, 5.585172769552711e-01, + 5.705021536899105e-01, 5.824658100332457e-01, 5.943991720381216e-01, 6.062948176207270e-01, 6.181452662624718e-01, + 6.299422016714543e-01, 6.416768736044914e-01, 6.533411462740817e-01, 6.649277540000037e-01, 6.764292700223311e-01, + 6.878367295965062e-01, 6.991421467689277e-01, 7.103379606632721e-01, 7.214176027060971e-01, 7.323746102405828e-01, + 7.432008025932804e-01, 7.538887973483771e-01, 7.644315495717613e-01, 7.748223151443820e-01, 7.850546571907628e-01, + 7.951223518167163e-01, 8.050193862201107e-01, 8.147397447696774e-01, 8.242774413707643e-01, 8.336267114335371e-01, + 8.427819363777799e-01, 8.517386186427548e-01, 8.604920874939698e-01, 8.690376742017057e-01, 8.773720451249032e-01, + 8.854927938913381e-01, 8.933935477349644e-01, 9.010727088526728e-01, 9.085249398881980e-01, 9.157483563218768e-01, + 9.227413839712016e-01, 9.295017469413066e-01, 9.360270196617569e-01, 9.423143052164881e-01, 9.483629792665091e-01, + 9.541731142261065e-01, 9.597438382130120e-01, 9.650738394220176e-01, 9.701635474343885e-01, 9.750143364412617e-01, + 9.796277191617885e-01, 9.840036439809510e-01, 9.881426772731259e-01, 9.920470446911211e-01, 9.957199420334376e-01, + 9.991640812275709e-01, 1.002381307710643e+00, 1.005374268639838e+00, 1.008146718214831e+00, 1.010703123647275e+00, + 1.013046655758663e+00, 1.015181271161417e+00, 1.017111643578857e+00, 1.018843380560658e+00, 1.020381713994816e+00, + 1.021731101971518e+00, 1.022896948293643e+00, 1.023885455671576e+00, 1.024702974608899e+00, 1.025355286710874e+00, + 1.025848243050604e+00, 1.026188366261215e+00, 1.026382881625701e+00, 1.026438102255574e+00, 1.026360125820994e+00, + 1.026155530733488e+00, 1.025831456886557e+00, 1.025395432284244e+00, 1.024853974580724e+00, 1.024213482124578e+00, + 1.023481184943025e+00, 1.022664602721801e+00, 1.021770903480975e+00, 1.020806917660529e+00, 1.019779396547454e+00, + 1.018695995335235e+00, 1.017564416918053e+00, 1.016391686789653e+00, 1.015184918030332e+00, 1.013950835315021e+00, + 1.012697033320358e+00, 1.011430749860716e+00, 1.010158346781076e+00, 1.008885191761748e+00, 1.007592718305943e+00, + 1.006805603478092e+00, 1.005378742804807e+00, 1.004049051787112e+00, 1.002778356298787e+00, 1.001563778373068e+00, + 1.000404915291105e+00, 9.993014844615166e-01, 9.982531564931281e-01, 9.972595460676951e-01, 9.963202131848272e-01, + 9.954346644968789e-01, 9.946023543844607e-01, 9.938226881029791e-01, 9.930950268060122e-01, 9.924186919309267e-01, + 9.917929657090736e-01, 9.912170911359961e-01, 9.906902760441473e-01, 9.902117003786811e-01, 9.897805192546193e-01, + 9.893958602389157e-01, 9.890568243690241e-01, 9.887624937408933e-01, 9.885119364350415e-01, 9.883042028597552e-01, + 9.881383235740961e-01, 9.880133161159576e-01, 9.879281898513085e-01, 9.878819413827574e-01, 9.878735508484809e-01, + 9.879019873841568e-01, 9.879662130250981e-01, 9.880651778500144e-01, 9.881978162133899e-01, 9.883630508181326e-01, + 9.885597957603544e-01, 9.887869526128024e-01, 9.890434070785485e-01, 9.893280319166613e-01, 9.896396899060125e-01, + 9.899772316163624e-01, 9.903394929409673e-01, 9.907252968668226e-01, 9.911334564321237e-01, 9.915627747807666e-01, + 9.920120436855326e-01, 9.924800441092685e-01, 9.929655482846576e-01, 9.934673212537685e-01, 9.939841207305906e-01, + 9.945146969322154e-01, 9.950577931942117e-01, 9.956121471675398e-01, 9.961764915534302e-01, 9.967495543671935e-01, + 9.973300590248015e-01, 9.979167245036720e-01, 9.985082643417953e-01, 9.991033633647473e-01, 9.997003478609010e-01, + 1.000299741957418e+00, 1.000897441314013e+00, 1.001493964257960e+00, 1.002087624593489e+00, 1.002677088643863e+00, + 1.003261045483858e+00, 1.003838183774652e+00, 1.004407190937699e+00, 1.004966753528881e+00, 1.005515557572658e+00, + 1.006052289109999e+00, 1.006575635258931e+00, 1.007084285781611e+00, 1.007576934100958e+00, 1.008052277555815e+00, + 1.008509017718116e+00, 1.008945862447015e+00, 1.009361528531177e+00, 1.009754742820913e+00, 1.010124241309341e+00, + 1.010468769795370e+00, 1.010787087537248e+00, 1.011077969726137e+00, 1.011340205650538e+00, 1.011572597114216e+00, + 1.011773962181442e+00, 1.011943138906979e+00, 1.012078982659783e+00, 1.012180362866919e+00, 1.012246166897464e+00, + 1.012275305013586e+00, 1.012266707295288e+00, 1.012219319453278e+00, 1.012132107622966e+00, 1.012004064757857e+00, + 1.011834207632025e+00, 1.011621572933544e+00, 1.011365223023975e+00, 1.011064253702468e+00, 1.010717792733157e+00, + 1.010324996851905e+00, 1.009885057526159e+00, 1.009397209381147e+00, 1.008860731864438e+00, 1.008274947065247e+00, + 1.007639223374887e+00, 1.006952983357691e+00, 1.006215708265639e+00, 1.005426938305289e+00, 1.004586273379809e+00, + 1.003693377657581e+00, 1.002747984657666e+00, 1.001749900308864e+00, 1.000699003803502e+00, 9.995952485989262e-01, + 9.984386632116344e-01, 9.972293415774932e-01, 9.959672769174924e-01, 9.946500332901397e-01, 9.932403996813470e-01, + 9.912511516117244e-01, 9.895756853352172e-01, 9.877713214760662e-01, 9.858577479051078e-01, 9.838303127859196e-01, + 9.816822625580078e-01, 9.794074486605805e-01, 9.769999155793757e-01, 9.744528356359687e-01, 9.717597500340699e-01, + 9.689141159310996e-01, 9.659101618500662e-01, 9.627421831412876e-01, 9.594038121639412e-01, 9.558889978382734e-01, + 9.521922434090249e-01, 9.483086322505029e-01, 9.442332539187503e-01, 9.399607238929982e-01, 9.354860218216989e-01, + 9.308052967663477e-01, 9.259146970284931e-01, 9.208101305030523e-01, 9.154873597416558e-01, 9.099426066529104e-01, + 9.041732260327581e-01, 8.981763729936715e-01, 8.919490241013392e-01, 8.854882249661838e-01, 8.787919436722827e-01, + 8.718585835568161e-01, 8.646864947605047e-01, 8.572738135700366e-01, 8.496195859658071e-01, 8.417237467711145e-01, + 8.335862715770727e-01, 8.252074428838668e-01, 8.165875713256009e-01, 8.077280370477699e-01, 7.986311592191131e-01, + 7.892986353718001e-01, 7.797330954210866e-01, 7.699379531983687e-01, 7.599171886893816e-01, 7.496758423734833e-01, + 7.392176841476761e-01, 7.285474515411827e-01, 7.176714478163359e-01, 7.065962311464494e-01, 6.953282935906302e-01, + 6.838739059112046e-01, 6.722395305539791e-01, 6.604334017809461e-01, 6.484643596235256e-01, 6.363395004626368e-01, + 6.240661431421666e-01, 6.116530334821534e-01, 5.991098644638286e-01, 5.864461424698465e-01, 5.736694851703749e-01, + 5.607881029948401e-01, 5.478160663871271e-01, 5.347619788897301e-01, 5.216365147692703e-01, 5.084499758302256e-01, + 4.952135086430446e-01, 4.819387562519412e-01, 4.686361426419003e-01, 4.553170769563941e-01, 4.419939954454178e-01, + 4.286789889246267e-01, 4.153837786572842e-01, 4.021211063103491e-01, 3.889032719013054e-01, 3.757425439137077e-01, + 3.626515183776310e-01, 3.496431418636322e-01, 3.367290822653354e-01, 3.239228075238623e-01, 3.112360816586549e-01, + 2.986807941537710e-01, 2.862694673284843e-01, 2.740128472224539e-01, 2.619228330079575e-01, 2.500098438708934e-01, + 2.382847225401669e-01, 2.267578490199104e-01, 2.154390996938547e-01, 2.043379825955254e-01, 1.934636765792024e-01, + 1.828250319214460e-01, 1.724305860483634e-01, 1.622886348529314e-01, 1.524071880359812e-01, 1.427939789949266e-01, + 1.334565845242183e-01, 1.244023922999665e-01, 1.156385879569742e-01, 1.071721547807196e-01, 9.900985872728905e-02, + 9.115821766572002e-02, 8.362344855837105e-02, 7.641140367416376e-02, 6.952749039054598e-02, 6.297656454790079e-02, + 5.676284244020858e-02, 5.088975408628229e-02, 4.535983304624439e-02, 4.017457306236873e-02, 3.533430192568957e-02, + 3.083806062123772e-02, 2.668355420358626e-02, 2.286680405144430e-02, 1.938236337675363e-02, 1.622312720409645e-02, + 1.338005016725895e-02, 1.084218595595746e-02, 8.596753980908744e-03, 6.640506529168652e-03, 5.172703110468352e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + + +const LC3_FLOAT MDCT_HRA_WINDOW_480_2_5ms[240] = { + 1.928875250471185e-07, 1.268623078914631e-06, 3.736943081685792e-06, 8.649386473419844e-06, 1.752499879209154e-05, + 3.251004192297566e-05, 5.654995150945631e-05, 9.358653414327445e-05, 1.487809853781833e-04, 2.287619057346095e-04, + 3.418963835622074e-04, 4.985810015573861e-04, 7.115482671394238e-04, 9.961824750040105e-04, 1.370837415765066e-03, + 1.857146703383843e-03, 2.480315886706181e-03, 3.269384042869696e-03, 4.257441351253188e-03, 5.481788360538607e-03, + 6.984022437256788e-03, 8.810037359146468e-03, 1.100992329671028e-02, 1.363775656493463e-02, 1.675127150559057e-02, + 2.041141057401967e-02, 2.468175295733717e-02, 2.962782656580052e-02, 3.531631267855188e-02, 4.181415652877682e-02, + 4.918760034374654e-02, 5.750115754515065e-02, 6.681654781077175e-02, 7.719161248813326e-02, 8.867922857347045e-02, + 1.013262374019720e-01, 1.151724017179353e-01, 1.302494023407827e-01, 1.465798836473051e-01, 1.641765559275968e-01, + 1.830413626142431e-01, 2.031647215674081e-01, 2.245248520040451e-01, 2.470872021104946e-01, 2.708039965464759e-01, + 2.956139274737775e-01, 3.214420168557505e-01, 3.481996809305596e-01, 3.757850292873181e-01, 4.040834302177654e-01, + 4.329683704138883e-01, 4.623026302356333e-01, 4.919397855296871e-01, 5.217260335074649e-01, 5.515023240298861e-01, + 5.811067597335228e-01, 6.103772100633116e-01, 6.391540670154212e-01, 6.672830559207561e-01, 6.946180045149623e-01, + 7.210234691482331e-01, 7.463771190956836e-01, 7.705717887049389e-01, 7.935171220325148e-01, 8.151407544921331e-01, + 8.353889991744725e-01, 8.542270299166949e-01, 8.716385768842180e-01, 8.876251715716619e-01, 9.022049953400274e-01, + 9.154113980197115e-01, 9.272911604251438e-01, 9.379025770646191e-01, 9.473134335138002e-01, 9.555989477431630e-01, + 9.628397371519567e-01, 9.691198641470655e-01, 9.745250036731624e-01, 9.791407668194774e-01, 9.830512059497915e-01, + 9.863375189657285e-01, 9.890769633791019e-01, 9.913419847656554e-01, 9.931995587544050e-01, 9.947107408108303e-01, + 9.959304135675596e-01, 9.969072172806543e-01, 9.976836451676292e-01, 9.982962820245519e-01, 9.987761617973335e-01, + 9.991492178976376e-01, 9.994367991905715e-01, 9.996562248627440e-01, 9.998213528339476e-01, 9.999431389208511e-01, + 1.000030167405588e+00, 1.000089137729581e+00, 1.000125296398298e+00, 1.000142807515464e+00, 1.000145059370791e+00, + 1.000134907956303e+00, 1.000114861040898e+00, 1.000087208438067e+00, 1.000054105383460e+00, 1.000017616583971e+00, + 9.999797286315710e-01, 9.999423382309206e-01, 9.999072232012880e-01, 9.998760025910959e-01, 9.998500915686289e-01, + 9.998306560737898e-01, 9.998185715517388e-01, 9.998143894342878e-01, 9.998183143680869e-01, 9.998301944838478e-01, + 9.998495262367371e-01, 9.998754745167079e-01, 9.999069078401956e-01, 9.999424475239904e-01, 9.999805288598742e-01, + 1.000019471519221e+00, 1.000057555786879e+00, 1.000093100812805e+00, 1.000124540917058e+00, 1.000150496102128e+00, + 1.000169833298924e+00, 1.000181715452526e+00, 1.000185636273393e+00, 1.000181439257840e+00, 1.000169320335504e+00, + 1.000149814156658e+00, 1.000123764529774e+00, 1.000092279821119e+00, 1.000056674215966e+00, 1.000018395617911e+00, + 9.999789406480724e-01, 9.999397567326687e-01, 9.999021306794866e-01, 9.998670624939285e-01, 9.998351225350340e-01, + 9.998062895304436e-01, 9.997797665333356e-01, 9.997537716957203e-01, 9.997253008334399e-01, 9.996898592447866e-01, + 9.996411611766667e-01, 9.995707967428177e-01, 9.994678679836200e-01, 9.993185980679096e-01, 9.991059202780914e-01, + 9.988090562524252e-01, 9.984030958127336e-01, 9.978585933978946e-01, 9.971411984750603e-01, 9.962113391583908e-01, + 9.950239795154223e-01, 9.935284716160412e-01, 9.916685232530794e-01, 9.893823014422549e-01, 9.866026903106617e-01, + 9.832577198181265e-01, 9.792711789106039e-01, 9.745634231307387e-01, 9.690523823244767e-01, 9.626547687789766e-01, + 9.552874798038419e-01, 9.468691813614447e-01, 9.373220508813107e-01, 9.265736480032657e-01, 9.145588719963409e-01, + 9.012219545005915e-01, 8.865184267401519e-01, 8.704169923325978e-01, 8.529012312555665e-01, 8.339710584198038e-01, + 8.136438625110305e-01, 7.919552579077074e-01, 7.689593947581650e-01, 7.447287893964823e-01, 7.193536583208960e-01, + 6.929407625549489e-01, 6.656117935585394e-01, 6.375013549431151e-01, 6.087546140984144e-01, 5.795247127727363e-01, + 5.499700344866872e-01, 5.202514288725478e-01, 4.905294887819369e-01, 4.609619660928919e-01, 4.317013978660552e-01, + 4.028929974356116e-01, 3.746728468420245e-01, 3.471664092737412e-01, 3.204873641715565e-01, 2.947367542923338e-01, + 2.700024238683050e-01, 2.463587202023185e-01, 2.238664274584689e-01, 2.025729006480214e-01, 1.825123693148748e-01, + 1.637063835467572e-01, 1.461643790086412e-01, 1.298843420747792e-01, 1.148535602600838e-01, 1.010494465619472e-01, + 8.844042869400506e-02, 7.698689534753124e-02, 6.664219153548699e-02, 5.735365389394342e-02, 4.906367480666277e-02, + 4.171078175510523e-02, 3.523071580898128e-02, 2.955749109487545e-02, 2.462441579169607e-02, 2.036505497804320e-02, + 1.671411663728698e-02, 1.360824429995981e-02, 1.098670301702559e-02, 8.791949345648940e-03, 6.970080454492374e-03, + 5.471161958930394e-03, 4.249438341364304e-03, 3.263433520599239e-03, 2.475952111493295e-03, 1.853994056678125e-03, + 1.368596596909542e-03, 9.946180283333026e-04, 7.104774789034889e-04, 4.978641589703932e-04, 3.414283510010364e-04, + 2.284649445606105e-04, 1.485987233730432e-04, 9.347897725317759e-05, 5.648942347847280e-05, 3.247793542861785e-05, + 1.750922386335714e-05, 8.642407336226362e-06, 3.734302301245202e-06, 1.267861256795911e-06, 1.927766981311251e-07}; + +const LC3_FLOAT MDCT_HRA_WINDOW_960_2_5ms[480] = { + 1.363353492760669e-07, 4.577676005269251e-07, 9.975675168391671e-07, 1.840776229085288e-06, 3.092248230077047e-06, + 4.880943708557620e-06, 7.363817805099883e-06, 1.073000750387602e-05, 1.520538607055496e-05, 2.105750528134522e-05, + 2.860093592119667e-05, 3.820301288710557e-05, 5.028998805188179e-05, 6.535359090391442e-05, 8.395799364585048e-05, + 1.067471738361778e-04, 1.344526637637966e-04, 1.679016715435404e-04, 2.080255544044134e-04, 2.558686198117505e-04, + 3.125972249248099e-04, 3.795091394541575e-04, 4.580431312676675e-04, 5.497887281277575e-04, 6.564961027629782e-04, + 7.800860221325537e-04, 9.226597952927381e-04, 1.086509147791288e-03, 1.274125944085974e-03, 1.488211673202887e-03, + 1.731686606830910e-03, 2.007698533412427e-03, 2.319630966669840e-03, 2.671110722544265e-03, 3.066014754864068e-03, + 3.508476137357141e-03, 4.002889078021606e-03, 4.553912851519276e-03, 5.166474536289647e-03, 5.845770445618693e-03, + 6.597266146035767e-03, 7.426694962226363e-03, 8.340054875180547e-03, 9.343603729551937e-03, 1.044385267714563e-02, + 1.164755779600632e-02, 1.296170983861615e-02, 1.439352207806304e-02, 1.595041623748902e-02, 1.764000650541313e-02, + 1.947008165734806e-02, 2.144858532216432e-02, 2.358359444954804e-02, 2.588329605228426e-02, 2.835596231360897e-02, + 3.100992416515645e-02, 3.385354345474830e-02, 3.689518383513415e-02, 4.014318051454780e-02, 4.360580901740066e-02, + 4.729125310846769e-02, 5.120757203648361e-02, 5.536266725318061e-02, 5.976424876157179e-02, 6.441980124289254e-02, + 6.933655010531084e-02, 7.452142758961615e-02, 7.998103905796611e-02, 8.572162958181787e-02, 9.174905093483054e-02, + 9.806872908624656e-02, 1.046856322804917e-01, 1.116042397799019e-01, 1.188285113399959e-01, 1.263618574809210e-01, + 1.342071106149135e-01, 1.423664970880752e-01, 1.508416101956496e-01, 1.596333842333865e-01, 1.687420696535257e-01, + 1.781672094023636e-01, 1.879076165271377e-01, 1.979613531528743e-01, 2.083257109445936e-01, 2.189971931864894e-01, + 2.299714986269890e-01, 2.412435072564368e-01, 2.528072682020181e-01, 2.646559899418406e-01, 2.767820330562002e-01, + 2.891769057483280e-01, 3.018312623786579e-01, 3.147349052652145e-01, 3.278767900074122e-01, 3.412450345907444e-01, + 3.548269325249284e-01, 3.686089702575019e-01, 3.825768490881926e-01, 3.967155117862224e-01, 4.110091740828488e-01, + 4.254413611747417e-01, 4.399949493303511e-01, 4.546522126414323e-01, 4.693948749058132e-01, 4.842041665659120e-01, + 4.990608865612834e-01, 5.139454688835927e-01, 5.288380535501122e-01, 5.437185616384643e-01, 5.585667739524391e-01, + 5.733624128178846e-01, 5.880852264406471e-01, 6.027150751969793e-01, 6.172320191724501e-01, 6.316164062197546e-01, + 6.458489597703579e-01, 6.599108656108541e-01, 6.737838568232726e-01, 6.874502960899853e-01, 7.008932545787268e-01, + 7.140965866515435e-01, 7.270449996828834e-01, 7.397241183258171e-01, 7.521205426304834e-01, 7.642218994939656e-01, + 7.760168870042503e-01, 7.874953113309442e-01, 7.986481159099932e-01, 8.094674027667472e-01, 8.199464459192338e-01, + 8.300796968994718e-01, 8.398627825231116e-01, 8.492924951249206e-01, 8.583667755581161e-01, 8.670846893280041e-01, + 8.754463962937875e-01, 8.834531144261093e-01, 8.911070781514043e-01, 8.984114918473676e-01, 9.053704790768982e-01, + 9.119890281611266e-01, 9.182729346961321e-01, 9.242287416134559e-01, 9.298636773723805e-01, 9.351855928531210e-01, + 9.402028974955879e-01, 9.449244951992589e-01, 9.493597204669394e-01, 9.535182752397909e-01, 9.574101668338553e-01, + 9.610456473502188e-01, 9.644351548926832e-01, 9.675892568889318e-01, 9.705185957742447e-01, 9.732338372611643e-01, + 9.757456213845153e-01, 9.780645164789403e-01, 9.802009762158145e-01, 9.821652997980082e-01, 9.839675953844861e-01, + 9.856177467920233e-01, 9.871253834983186e-01, 9.884998539492639e-01, 9.897502021530162e-01, 9.908851475245483e-01, + 9.919130679264989e-01, 9.928419858351684e-01, 9.936795575444219e-01, 9.944330653049196e-01, 9.951094122815642e-01, + 9.957151201982998e-01, 9.962563295265126e-01, 9.967388020613602e-01, 9.971679257195168e-01, 9.975487213822326e-01, + 9.978858515994010e-01, 9.981836309637017e-01, 9.984460379589807e-01, 9.986767280839717e-01, 9.988790480513948e-01, + 9.990560508634377e-01, 9.992105115676724e-01, 9.993449435025852e-01, 9.994616148490124e-01, 9.995625653127808e-01, + 9.996496227746003e-01, 9.997244197555017e-01, 9.997884095596641e-01, 9.998428819710351e-01, 9.998889783954170e-01, + 9.999277063554146e-01, 9.999599532614691e-01, 9.999864993978808e-01, 1.000008030077971e+00, 1.000025146937107e+00, + 1.000038378346013e+00, 1.000048188939381e+00, 1.000054988266291e+00, 1.000059138579006e+00, 1.000060961785582e+00, + 1.000060745599070e+00, 1.000058748922255e+00, 1.000055206511563e+00, 1.000050332967367e+00, 1.000044326100310e+00, + 1.000037369724671e+00, 1.000029635930232e+00, 1.000021286883873e+00, 1.000012476211096e+00, 1.000003350006250e+00, + 9.999940475182815e-01, 9.999847015566445e-01, 9.999754386595657e-01, 9.999663790642979e-01, 9.999576365163719e-01, + 9.999493179522237e-01, 9.999415230869807e-01, 9.999343439366570e-01, 9.999278643015735e-01, 9.999221592354568e-01, + 9.999172945224162e-01, 9.999133261818468e-01, 9.999103000191805e-01, 9.999082512384065e-01, 9.999072041302636e-01, + 9.999071718480597e-01, 9.999081562811047e-01, 9.999101480338050e-01, 9.999131265164656e-01, 9.999170601519115e-01, + 9.999219066999991e-01, 9.999276137001288e-01, 9.999341190298563e-01, 9.999413515757679e-01, 9.999492320108540e-01, + 9.999576736708096e-01, 9.999665835199758e-01, 9.999758631960602e-01, 9.999854101213793e-01, 9.999951186671812e-01, + 1.000004881356628e+00, 1.000014590091279e+00, 1.000024137385544e+00, 1.000033417593335e+00, 1.000042328111225e+00, + 1.000050770542848e+00, 1.000058651809861e+00, 1.000065885195634e+00, 1.000072391308898e+00, 1.000078098955774e+00, + 1.000082945909961e+00, 1.000086879572280e+00, 1.000089857512229e+00, 1.000091847885646e+00, 1.000092829723974e+00, + 1.000092793091916e+00, 1.000091739111420e+00, 1.000089679850895e+00, 1.000086638079347e+00, 1.000082646885623e+00, + 1.000077749163242e+00, 1.000071996961268e+00, 1.000065450701385e+00, 1.000058178260741e+00, 1.000050253919262e+00, + 1.000041757168942e+00, 1.000032771381191e+00, 1.000023382326608e+00, 1.000013676539597e+00, 1.000003739518099e+00, + 9.999936537463840e-01, 9.999834965263427e-01, 9.999733376002018e-01, 9.999632365449369e-01, 9.999532399160947e-01, + 9.999433781162252e-01, 9.999336619607787e-01, 9.999240789122246e-01, 9.999145889513631e-01, 9.999051200534473e-01, + 9.998955632358651e-01, 9.998857671439174e-01, 9.998755321416521e-01, 9.998646038760159e-01, 9.998526662846789e-01, + 9.998393340210341e-01, 9.998241442739438e-01, 9.998065479650342e-01, 9.997859003125656e-01, 9.997614507583039e-01, + 9.997323322622099e-01, 9.996975499792088e-01, 9.996559693426429e-01, 9.996063035901801e-01, 9.995471007797664e-01, + 9.994767303555520e-01, 9.993933693363640e-01, 9.992949882120472e-01, 9.991793366456373e-01, 9.990439290916592e-01, + 9.988860304525888e-01, 9.987026419065322e-01, 9.984904870492169e-01, 9.982459985022988e-01, 9.979653051476074e-01, + 9.976442201531890e-01, 9.972782299617136e-01, 9.968624844150069e-01, 9.963917881900651e-01, 9.958605937219481e-01, + 9.952629957874448e-01, 9.945927279204203e-01, 9.938431608253206e-01, 9.930073029495663e-01, 9.920778033684794e-01, + 9.910469571281373e-01, 9.899067131820748e-01, 9.886486850471784e-01, 9.872641642923781e-01, 9.857441369608847e-01, + 9.840793030126235e-01, 9.822600988582102e-01, 9.802767230390885e-01, 9.781191650903150e-01, 9.757772376026793e-01, + 9.732406114793927e-01, 9.704988543592059e-01, 9.675414721525257e-01, 9.643579536097365e-01, 9.609378178114939e-01, + 9.572706644392005e-01, 9.533462266503443e-01, 9.491544263479285e-01, 9.446854315961644e-01, 9.399297158962095e-01, + 9.348781189964488e-01, 9.295219088721776e-01, 9.238528444701966e-01, 9.178632387754598e-01, 9.115460217204322e-01, + 9.048948024240450e-01, 8.979039302171362e-01, 8.905685538859580e-01, 8.828846785458305e-01, 8.748492195442639e-01, + 8.664600527878369e-01, 8.577160608906681e-01, 8.486171745551603e-01, 8.391644086184020e-01, 8.293598922305367e-01, + 8.192068926746530e-01, 8.087098323911928e-01, 7.978742988330544e-01, 7.867070468498287e-01, 7.752159933798504e-01, + 7.634102043158196e-01, 7.512998735020282e-01, 7.388962939169839e-01, 7.262118211926384e-01, 7.132598297183557e-01, + 7.000546616722335e-01, 6.866115694122957e-01, 6.729466517435032e-01, 6.590767846515775e-01, 6.450195471597746e-01, + 6.307931430185830e-01, 6.164163189797930e-01, 6.019082804348481e-01, 5.872886052124403e-01, 5.725771563319307e-01, + 5.577939944978301e-01, 5.429592910967905e-01, 5.280932424234555e-01, 5.132159858162120e-01, 4.983475183298941e-01, + 4.835076185113182e-01, 4.687157717768828e-01, 4.539910998210603e-01, 4.393522944120604e-01, 4.248175558579833e-01, + 4.104045363548025e-01, 3.961302883579846e-01, 3.820112180536255e-01, 3.680630439436816e-01, 3.543007605040334e-01, + 3.407386068243548e-01, 3.273900400954695e-01, 3.142677137733552e-01, 3.013834602191723e-01, 2.887482775916394e-01, + 2.763723207514489e-01, 2.642648959268686e-01, 2.524344588847748e-01, 2.408886163515173e-01, 2.296341304326797e-01, + 2.186769257893048e-01, 2.080220993398264e-01, 1.976739322711464e-01, 1.876359041583237e-01, 1.779107090095517e-01, + 1.685002730708834e-01, 1.594057742429125e-01, 1.506276629788181e-01, 1.421656845493104e-01, 1.340189025746913e-01, + 1.261857237370651e-01, 1.186639235964411e-01, 1.114506734428340e-01, 1.045425681223503e-01, 9.793565477860058e-02, + 9.162546245161339e-02, 8.560703247484407e-02, 7.987494960705163e-02, 7.442337382999228e-02, 6.924607273536325e-02, + 6.433645441557491e-02, 5.968760076313909e-02, 5.529230107316437e-02, 5.114308583308901e-02, 4.723226057381158e-02, + 4.355193964722984e-02, 4.009407978727676e-02, 3.685051330522059e-02, 3.381298076557955e-02, 3.097316298675063e-02, + 2.832271221053797e-02, 2.585328228730008e-02, 2.355655772843824e-02, 2.142428148537503e-02, 1.944828132389286e-02, + 1.762049467453352e-02, 1.593299185344667e-02, 1.437799756332653e-02, 1.294791060055676e-02, 1.163532171204003e-02, + 1.043302956305446e-02, 9.334054795489547e-03, 8.331652173617308e-03, 7.419320831822072e-03, 6.590812655146027e-03, + 5.840138838848342e-03, 5.161574687206487e-03, 4.549662724337389e-03, 3.999214200759286e-03, 3.505309088672846e-03, + 3.063294666478038e-03, 2.668782798866110e-03, 2.317646022975776e-03, 2.006012553652158e-03, 1.730260321894845e-03, + 1.487010160247016e-03, 1.273118247295162e-03, 1.085667920762688e-03, 9.219609650399310e-04, 7.795084745479000e-04, + 6.560213892304477e-04, 5.494007928508220e-04, 4.577280587661532e-04, 3.792549215895880e-04, 3.123935467349105e-04, + 2.557066633705375e-04, 2.078978198736850e-04, 1.678018145436083e-04, 1.343753481649133e-04, 1.066879390562912e-04, + 8.391313553401788e-05, 6.532005529093359e-05, 5.026527605947520e-05, 3.818509710338716e-05, 2.858818657228189e-05, + 2.104862555598476e-05, 1.519935578579325e-05, 1.072603433419925e-05, 7.361295334616452e-06, 4.879415604699819e-06, + 3.091377877253446e-06, 1.840321200267112e-06, 9.973582966273186e-07, 4.576899867970956e-07, 1.363156993327630e-07}; + +const LC3_FLOAT MDCT_HRA_WINDOW_480_5ms[480] = { + 9.752475122178133e-08, 6.413568706385488e-07, 1.888722582859778e-06, 4.370037451432268e-06, 8.850535239285388e-06, + 1.640976145163547e-05, 2.852654713353143e-05, 4.717577700625728e-05, 7.493695610161539e-05, 1.151138634046934e-04, + 1.718640547726665e-04, 2.503364524287818e-04, 3.568147253529307e-04, 4.988636346654247e-04, 6.854750052598100e-04, + 9.272095051506971e-04, 1.236329983123574e-03, 1.626921748932395e-03, 2.114994893578391e-03, 2.718563554424897e-03, + 3.457696944351759e-03, 4.354536997897421e-03, 5.433277651003014e-03, 6.720101073517573e-03, 8.243066622086374e-03, + 1.003194888027514e-02, 1.211802190514137e-02, 1.453378770448280e-02, 1.731264802301458e-02, 2.048851971150478e-02, + 2.409539527917081e-02, 2.816685167069475e-02, 3.273551184443837e-02, 3.783246533188810e-02, 4.348665559839211e-02, + 4.972424366422929e-02, 5.656795903921283e-02, 6.403645052356303e-02, 7.214365077720192e-02, 8.089816969852329e-02, + 9.030273251800713e-02, 1.003536790358444e-01, 1.110405405506510e-01, 1.223457106767086e-01, 1.342442253757111e-01, + 1.467036660932157e-01, 1.596841978637899e-01, 1.731387516273307e-01, 1.870133568030685e-01, 2.012476264477750e-01, + 2.157753931632489e-01, 2.305254894308376e-01, 2.454226613848142e-01, 2.603886003668338e-01, 2.753430721265570e-01, + 2.902051194568206e-01, 3.048943105839568e-01, 3.193320029709852e-01, 3.334425905036104e-01, 3.471547014476447e-01, + 3.604024000326147e-01, 3.731263195417857e-01, 3.852742256277580e-01, 3.968020335005454e-01, 4.076742901287472e-01, + 4.178645650568324e-01, 4.273556452755667e-01, 4.361395400809099e-01, 4.442173028452789e-01, 4.515986821559811e-01, + 4.583016198658067e-01, 4.643516178635941e-01, 4.697809986240601e-01, 4.746280867221525e-01, 4.789363394414859e-01, + 4.827534543679447e-01, 4.861304804889396e-01, 4.891209569144257e-01, 4.917801000389275e-01, 4.941640559535466e-01, + 4.963292304037445e-01, 4.983317038070890e-01, 5.002267340435251e-01, 5.020683451596181e-01, 5.039089960260009e-01, + 5.057993195650324e-01, 5.077879205925190e-01, 5.099212187075181e-01, 5.122433220684072e-01, 5.147959182947806e-01, + 5.176181700509677e-01, 5.207466049576202e-01, 5.242149921562288e-01, 5.280542009005510e-01, 5.322920397381714e-01, + 5.369530779485470e-01, 5.420584537149585e-01, 5.476256758552612e-01, 5.536684276931489e-01, 5.601963827419005e-01, + 5.672150422730262e-01, 5.747256045798048e-01, 5.827248748908062e-01, 5.912052235447917e-01, 6.001545983308831e-01, + 6.095565949599409e-01, 6.193905875944715e-01, 6.296319193412947e-01, 6.402521506992933e-01, 6.512193622254838e-01, + 6.624985061836945e-01, 6.740518006968909e-01, 6.858391589448801e-01, 6.978186452298805e-01, 7.099469492625143e-01, + 7.221798697869513e-01, 7.344727986533678e-01, 7.467811966479000e-01, 7.590610527959840e-01, 7.712693194564819e-01, + 7.833643163120154e-01, 7.953060973228134e-01, 8.070567758283893e-01, 8.185808042273020e-01, 8.298452060049231e-01, + 8.408197592685507e-01, 8.514771323358515e-01, 8.617929732481214e-01, 8.717459562819760e-01, 8.813177895502246e-01, + 8.904931885580764e-01, 8.992598210679454e-01, 9.076082287937692e-01, 9.155317312832600e-01, 9.230263168675006e-01, + 9.300905248019673e-01, 9.367253217576155e-01, 9.429339747337118e-01, 9.487219213595656e-01, 9.540966375393273e-01, + 9.590675015747306e-01, 9.636456533576906e-01, 9.678438470101040e-01, 9.716762954761368e-01, 9.751585060165801e-01, + 9.783071062524560e-01, 9.811396612648455e-01, 9.836744831733611e-01, 9.859304354792453e-01, 9.879267351759304e-01, + 9.896827561287711e-01, 9.912178374656364e-01, 9.925511006920656e-01, 9.937012789694025e-01, 9.946865615154821e-01, + 9.955244554643670e-01, 9.962316668199601e-01, 9.968240014222112e-01, 9.973162861697706e-01, 9.977223101520583e-01, + 9.980547848638137e-01, 9.983253223174189e-01, 9.985444296291865e-01, 9.987215185204544e-01, 9.988649281201196e-01, + 9.989819594562657e-01, 9.990789200557365e-01, 9.991611771110095e-01, 9.992332177094652e-01, 9.992987146446982e-01, + 9.993605963440879e-01, 9.994211194587087e-01, 9.994819426820254e-01, 9.995442004050701e-01, 9.996085748889234e-01, + 9.996753657478641e-01, 9.997445556919270e-01, 9.998158716802928e-01, 9.998888409489480e-01, 9.999628437059447e-01, + 1.000037122530308e+00, 1.000110932111342e+00, 1.000183434550577e+00, 1.000253775458271e+00, 1.000321131235573e+00, + 1.000384720523657e+00, 1.000443814718821e+00, 1.000497747347372e+00, 1.000545922137548e+00, 1.000587819673348e+00, + 1.000623002564305e+00, 1.000651119113520e+00, 1.000671905511154e+00, 1.000685186620367e+00, 1.000690875455855e+00, + 1.000688971480779e+00, 1.000679557865722e+00, 1.000662797863287e+00, 1.000638930454792e+00, 1.000608265421794e+00, + 1.000571177986086e+00, 1.000528103148456e+00, 1.000479529839953e+00, 1.000425994980975e+00, 1.000368077524065e+00, + 1.000306392536921e+00, 1.000241585363485e+00, 1.000174325883803e+00, 1.000105302878071e+00, 1.000035218487335e+00, + 9.999647827529677e-01, 9.998947082094627e-01, 9.998257045004189e-01, 9.997584729859116e-01, 9.996937013107159e-01, + 9.996320579071534e-01, 9.995741864134795e-01, 9.995206999987033e-01, 9.994721755972762e-01, 9.994291480719714e-01, + 9.993921043401182e-01, 9.993614775166697e-01, 9.993376411467469e-01, 9.993209036195655e-01, 9.993115028741053e-01, + 9.993096015235072e-01, 9.993152825388751e-01, 9.993285456427281e-01, 9.993493045667127e-01, 9.993773853262324e-01, + 9.994125256556279e-01, 9.994543757308175e-01, 9.995025002817920e-01, 9.995563821653024e-01, 9.996154274293025e-01, + 9.996789718565903e-01, 9.997462889273712e-01, 9.998165990914856e-01, 9.998890801932255e-01, 9.999628788477228e-01, + 1.000037122530308e+00, 1.000110932111343e+00, 1.000183434550578e+00, 1.000253775458273e+00, 1.000321131235574e+00, + 1.000384720523658e+00, 1.000443814718822e+00, 1.000497747347373e+00, 1.000545922137550e+00, 1.000587819673349e+00, + 1.000623002564306e+00, 1.000651119113521e+00, 1.000671905511155e+00, 1.000685186620368e+00, 1.000690875455855e+00, + 1.000688971480779e+00, 1.000679557865721e+00, 1.000662797863286e+00, 1.000638930454791e+00, 1.000608265421792e+00, + 1.000571177986083e+00, 1.000528103148453e+00, 1.000479529839950e+00, 1.000425994980971e+00, 1.000368077524061e+00, + 1.000306392536917e+00, 1.000241585363480e+00, 1.000174325883798e+00, 1.000105302878066e+00, 1.000035218487330e+00, + 9.999647827529627e-01, 9.998947082094576e-01, 9.998257045004140e-01, 9.997584729859067e-01, 9.996937013107114e-01, + 9.996320579071492e-01, 9.995741864134757e-01, 9.995206999987001e-01, 9.994721755972732e-01, 9.994291480719688e-01, + 9.993921043401160e-01, 9.993614775166682e-01, 9.993376411467459e-01, 9.993209036195649e-01, 9.993115028741050e-01, + 9.993096015235075e-01, 9.993152825388757e-01, 9.993285456427290e-01, 9.993493045667138e-01, 9.993773853262338e-01, + 9.994125256556294e-01, 9.994543757308189e-01, 9.995025002817937e-01, 9.995563821653038e-01, 9.996154274293039e-01, + 9.996789718565914e-01, 9.997462889273723e-01, 9.998165990914865e-01, 9.998890801932260e-01, 9.999628788477231e-01, + 1.000037087385911e+00, 1.000110692813570e+00, 1.000182706868929e+00, 1.000252041323928e+00, 1.000317522732163e+00, + 1.000377862440740e+00, 1.000431621330905e+00, 1.000477167056245e+00, 1.000512623941274e+00, 1.000535816073234e+00, + 1.000544204364164e+00, 1.000534818530052e+00, 1.000504185023504e+00, 1.000448251960702e+00, 1.000362312003691e+00, + 1.000240924003935e+00, 1.000077833997232e+00, 9.998658958833085e-01, 9.995969918486358e-01, 9.992619523233789e-01, + 9.988504750288640e-01, 9.983510424973004e-01, 9.977508373579080e-01, 9.970356547108338e-01, 9.961898110802319e-01, + 9.951960497774461e-01, 9.940354430376489e-01, 9.926872920341389e-01, 9.911290268265915e-01, 9.893361094467528e-01, + 9.872819446267991e-01, 9.849378040627681e-01, 9.822727714796871e-01, 9.792537170020328e-01, 9.758453102910697e-01, + 9.720100824436398e-01, 9.677085466217928e-01, 9.628993866974633e-01, 9.575397217975740e-01, 9.515854525300023e-01, + 9.449916919338839e-01, 9.377132809663818e-01, 9.297053848015243e-01, 9.209241625967119e-01, 9.113274999097554e-01, + 9.008757898394824e-01, 8.895327463959180e-01, 8.772662317107712e-01, 8.640490775465693e-01, 8.498598811668777e-01, + 8.346837559540076e-01, 8.185130181287622e-01, 8.013477924378186e-01, 7.831965216140859e-01, 7.640763666675557e-01, + 7.440134875182273e-01, 7.230431960387166e-01, 7.012099761451619e-01, 6.785673680876833e-01, 6.551777164863924e-01, + 6.311117838899523e-01, 6.064482336696789e-01, 5.812729878873076e-01, 5.556784673902739e-01, 5.297627228142773e-01, + 5.036284664469868e-01, 4.773820160836825e-01, 4.511321631520609e-01, 4.249889785709717e-01, 3.990625711023555e-01, + 3.734618144045748e-01, 3.482930606136814e-01, 3.236588600361913e-01, 2.996567083459001e-01, 2.763778443910257e-01, + 2.539061231327225e-01, 2.323169891052670e-01, 2.116765758470110e-01, 1.920409557494601e-01, 1.734555625129627e-01, + 1.559548047768156e-01, 1.395618845278644e-01, 1.242888277448971e-01, 1.101367277067382e-01, 9.709619389909366e-02, + 8.514799199591219e-02, 7.426385348588532e-02, 6.440742764829473e-02, 5.553534414838273e-02, 4.759835178173250e-02, + 4.054249795560948e-02, 3.431031430250281e-02, 2.884197618951215e-02, 2.407640752522409e-02, 1.995230681955070e-02, + 1.640907554818694e-02, 1.338763515624311e-02, 1.083112419588716e-02, 8.685471885106049e-03, 6.899848624541457e-03, + 5.426997611391803e-03, 4.223454598964128e-03, 3.249665071710221e-03, 2.470009678121166e-03, 1.852749750240329e-03, + 1.369905213535462e-03, 9.970772330834560e-04, 7.132276282050243e-04, 5.004264891539459e-04, 3.435786103798425e-04, + 2.301383718361825e-04, 1.498216022111699e-04, 9.432178886435202e-05, 5.703679621983551e-05, 3.281105011319028e-05, + 1.769696765784037e-05, 8.738278469978569e-06, 3.776770390150926e-06, 1.282520060393973e-06, 1.950213832061108e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_HRA_WINDOW_960_5ms[960] = { + 6.895487963711672e-08, 2.315162529310440e-07, 5.044776791712418e-07, 9.307951082662299e-07, 1.563406927329763e-06, + 2.467387587537570e-06, 3.721891688909285e-06, 5.422241751611354e-06, 7.682193559629735e-06, 1.063638764371401e-05, + 1.444299034054517e-05, 1.928652559405143e-05, 2.538089690430043e-05, 3.297259712577839e-05, 4.234410206521111e-05, + 5.381744200626993e-05, 6.775794339454556e-05, 8.457813095885401e-05, 1.047417785352287e-04, 1.287680948104183e-04, + 1.572360281259058e-04, 1.907886723956216e-04, 2.301377541053808e-04, 2.760681782947526e-04, 3.294426093879363e-04, + 3.912060607548454e-04, 4.623904649625926e-04, 5.441191948366056e-04, 6.376115037051945e-04, 7.441868515669874e-04, + 8.652690824124538e-04, 1.002390416563642e-03, 1.157195220684898e-03, 1.331443517075892e-03, 1.527014193000520e-03, + 1.745907870144461e-03, 1.990249393843025e-03, 2.262289901491620e-03, 2.564408429555132e-03, 2.899113018840483e-03, + 3.269041278198808e-03, 3.676960367589013e-03, 4.125766362471570e-03, 4.618482962817473e-03, 5.158259511618939e-03, + 5.748368289680850e-03, 6.392201055659471e-03, 7.093264802800713e-03, 7.855176706615627e-03, 8.681658240816716e-03, + 9.576528442223354e-03, 1.054369630902618e-02, 1.158715232077375e-02, 1.271095907270489e-02, 1.391924102158781e-02, + 1.521617334503430e-02, 1.660596992132020e-02, 1.809287044204954e-02, 1.968112667553175e-02, 2.137498790448110e-02, + 2.317868556757386e-02, 2.509641714048705e-02, 2.713232929826755e-02, 2.929050040721149e-02, 3.157492240084053e-02, + 3.398948210100576e-02, 3.653794205159846e-02, 3.922392093875195e-02, 4.205087367774323e-02, 4.502207125299418e-02, + 4.814058040358271e-02, 5.140924325245049e-02, 5.483065698298122e-02, 5.840715367176064e-02, 6.214078039106200e-02, + 6.603327969885861e-02, 7.008607063789310e-02, 7.430023036845897e-02, 7.867647656201358e-02, 8.321515068447660e-02, + 8.791620229900704e-02, 9.277917451814051e-02, 9.780319073433394e-02, 1.029869427561657e-01, 1.083286804746118e-01, + 1.138262031799212e-01, 1.194768526446087e-01, 1.252775080819347e-01, 1.312245830819321e-01, 1.373140246185531e-01, + 1.435413142118472e-01, 1.499014713182564e-01, 1.563890590101503e-01, 1.629981919926660e-01, 1.697225469918130e-01, + 1.765553755327395e-01, 1.834895191111025e-01, 1.905174267437600e-01, 1.976311748676255e-01, 2.048224895376239e-01, + 2.120827708564311e-01, 2.194031195502149e-01, 2.267743655861134e-01, 2.341870987088808e-01, 2.416317007561807e-01, + 2.490983795946414e-01, 2.565772045021951e-01, 2.640581428066213e-01, 2.715310975758094e-01, 2.789859461422405e-01, + 2.864125792327671e-01, 2.938009404650995e-01, 3.011410659646723e-01, 3.084231238498945e-01, 3.156374533302977e-01, + 3.227746031609007e-01, 3.298253691972654e-01, 3.367808307992519e-01, 3.436323858374391e-01, 3.503717840645000e-01, + 3.569912187918766e-01, 3.634832564154323e-01, 3.698408960767766e-01, 3.760576237679591e-01, 3.821274200069671e-01, + 3.880447807855012e-01, 3.938047354128900e-01, 3.994028614671444e-01, 4.048352968090768e-01, 4.100987486186185e-01, + 4.151904994338012e-01, 4.201084101968628e-01, 4.248509203362432e-01, 4.294170449371775e-01, 4.338063690767977e-01, + 4.380190394218450e-01, 4.420557532080190e-01, 4.459177447394188e-01, 4.496067695642793e-01, 4.531250864990879e-01, + 4.564754376870322e-01, 4.596610268884718e-01, 4.626854962106256e-01, 4.655529014908880e-01, 4.682676865530477e-01, + 4.708346565582213e-01, 4.732589506724937e-01, 4.755460142711474e-01, 4.777015708950234e-01, 4.797315941680489e-01, + 4.816422798764418e-01, 4.834400183996339e-01, 4.851313676707616e-01, 4.867230268307342e-01, 4.882218107246894e-01, + 4.896346253731921e-01, 4.909684445331096e-01, 4.922302874448856e-01, 4.934271978441982e-01, 4.945662242969564e-01, + 4.956544018975119e-01, 4.966987353511036e-01, 4.977061834431282e-01, 4.986836448801200e-01, 4.996379454705324e-01, + 5.005758265977741e-01, 5.015039349236500e-01, 5.024288132476197e-01, 5.033568924361829e-01, 5.042944843274677e-01, + 5.052477755087517e-01, 5.062228218592734e-01, 5.072255437473754e-01, 5.082617217696771e-01, 5.093369929206453e-01, + 5.104568470835084e-01, 5.116266237378464e-01, 5.128515087852868e-01, 5.141365314023457e-01, 5.154865608384481e-01, + 5.169063030872989e-01, 5.184002973708743e-01, 5.199729123871391e-01, 5.216283422849100e-01, 5.233706023418981e-01, + 5.252035243345977e-01, 5.271307516011422e-01, 5.291557338103311e-01, 5.312817214614957e-01, 5.335117601505942e-01, + 5.358486846476969e-01, 5.382951128397399e-01, 5.408534395999681e-01, 5.435258306517384e-01, 5.463142164993156e-01, + 5.492202865018518e-01, 5.522454831689516e-01, 5.553909967570894e-01, 5.586577602456578e-01, 5.620464447697334e-01, + 5.655574555837481e-01, 5.691909286262941e-01, 5.729467277513715e-01, 5.768244426856284e-01, 5.808233877646608e-01, + 5.849426014943921e-01, 5.891808469760642e-01, 5.935366132255452e-01, 5.980081174096790e-01, 6.025933080143371e-01, + 6.072898689508155e-01, 6.120952245993402e-01, 6.170065457808297e-01, 6.220207566407007e-01, 6.271345424215810e-01, + 6.323443580952387e-01, 6.376464378179791e-01, 6.430368051681870e-01, 6.485112841196261e-01, 6.540655106995645e-01, + 6.596949452767820e-01, 6.653948854210106e-01, 6.711604792723804e-01, 6.769867393569574e-01, 6.828685567824609e-01, + 6.888007157467320e-01, 6.947779082904570e-01, 7.007947492250285e-01, 7.068457911662456e-01, 7.129255396047764e-01, + 7.190284679449507e-01, 7.251490324444848e-01, 7.312816869891655e-01, 7.374208976383266e-01, 7.435611568791312e-01, + 7.496969975302182e-01, 7.558230062381704e-01, 7.619338365135002e-01, 7.680242212564293e-01, 7.740889847266266e-01, + 7.801230539152502e-01, 7.861214692821104e-01, 7.920793948254449e-01, 7.979921274567765e-01, 8.038551056583576e-01, + 8.096639174059964e-01, 8.154143073453887e-01, 8.211021832154612e-01, 8.267236215176270e-01, 8.322748724351863e-01, + 8.377523640123131e-01, 8.431527056071227e-01, 8.484726906381246e-01, 8.537092986478724e-01, 8.588596967118024e-01, + 8.639212402239919e-01, 8.688914730948750e-01, 8.737681273987250e-01, 8.785491225109360e-01, 8.832325637767802e-01, + 8.878167407543193e-01, 8.923001250745454e-01, 8.966813679615423e-01, 9.009592974545819e-01, 9.051329153725320e-01, + 9.092013940588521e-01, 9.131640729428008e-01, 9.170204549493250e-01, 9.207702027865553e-01, 9.244131351359152e-01, + 9.279492227657136e-01, 9.313785845847777e-01, 9.347014836483568e-01, 9.379183231242151e-01, 9.410296422227417e-01, + 9.440361120910473e-01, 9.469385316675432e-01, 9.497378234904927e-01, 9.524350294515523e-01, 9.550313064834267e-01, + 9.575279221695473e-01, 9.599262502631155e-01, 9.622277661029504e-01, 9.644340419143761e-01, 9.665467419847689e-01, + 9.685676177053684e-01, 9.704985024734301e-01, 9.723413064517235e-01, 9.740980111855780e-01, 9.757706640811671e-01, + 9.773613727522825e-01, 9.788722992464219e-01, 9.803056541645230e-01, 9.816636906919504e-01, 9.829486985613498e-01, + 9.841629979706453e-01, 9.853089334816367e-01, 9.863888679264271e-01, 9.874051763501168e-01, 9.883602400189044e-01, + 9.892564405229114e-01, 9.900961540026917e-01, 9.908817455275554e-01, 9.916155636525488e-01, 9.922999351792323e-01, + 9.929371601433686e-01, 9.935295070502858e-01, 9.940792083761523e-01, 9.945884563506685e-01, 9.950593990338927e-01, + 9.954941366970841e-01, 9.958947185146307e-01, 9.962631395714290e-01, 9.966013381874510e-01, 9.969111935588407e-01, + 9.971945237126117e-01, 9.974530837700109e-01, 9.976885645118487e-01, 9.979025912375212e-01, 9.980967229081705e-01, + 9.982724515633580e-01, 9.984312019997783e-01, 9.985743316998982e-01, 9.987031309979628e-01, 9.988188234704969e-01, + 9.989225665382725e-01, 9.990154522666818e-01, 9.990985083514453e-01, 9.991726992767055e-01, 9.992389276326772e-01, + 9.992980355801597e-01, 9.993508064493677e-01, 9.993979664606926e-01, 9.994401865550964e-01, 9.994780843219823e-01, + 9.995122260124369e-01, 9.995431286258258e-01, 9.995712620577665e-01, 9.995970512975859e-01, 9.996208786634017e-01, + 9.996430860630976e-01, 9.996639772695648e-01, 9.996838201987696e-01, 9.997028491794524e-01, 9.997212672035590e-01, + 9.997392481469061e-01, 9.997569389500512e-01, 9.997744617498990e-01, 9.997919159532207e-01, 9.998093802440068e-01, + 9.998269145173621e-01, 9.998445617335565e-01, 9.998623496867628e-01, 9.998802926840086e-01, 9.998983931308962e-01, + 9.999166430217568e-01, 9.999350253331990e-01, 9.999535153223720e-01, 9.999720817407219e-01, 9.999906880869937e-01, + 1.000009287384094e+00, 1.000027834887701e+00, 1.000046300263356e+00, 1.000064628855653e+00, 1.000082766500416e+00, + 1.000100659718907e+00, 1.000118255908114e+00, 1.000135503526064e+00, 1.000152352271145e+00, 1.000168753254485e+00, + 1.000184659164501e+00, 1.000200024422812e+00, 1.000214805330795e+00, 1.000228960206152e+00, 1.000242449508936e+00, + 1.000255235956603e+00, 1.000267284627736e+00, 1.000278563054190e+00, 1.000289041301502e+00, 1.000298692037510e+00, + 1.000307490589210e+00, 1.000315414987954e+00, 1.000322446003211e+00, 1.000328567165139e+00, 1.000333764776314e+00, + 1.000338027913029e+00, 1.000341348416600e+00, 1.000343720875191e+00, 1.000345142596687e+00, 1.000345613573201e+00, + 1.000345136437780e+00, 1.000343716413940e+00, 1.000341361258634e+00, 1.000338081199265e+00, 1.000333888865364e+00, + 1.000328799215526e+00, 1.000322829460192e+00, 1.000315998980821e+00, 1.000308329246033e+00, 1.000299843725172e+00, + 1.000290567799819e+00, 1.000280528673668e+00, 1.000269755281177e+00, 1.000258278195373e+00, 1.000246129535135e+00, + 1.000233342872247e+00, 1.000219953138478e+00, 1.000205996532915e+00, 1.000191510429709e+00, 1.000176533286394e+00, + 1.000161104552890e+00, 1.000145264581248e+00, 1.000129054536203e+00, 1.000112516306544e+00, 1.000095692417284e+00, + 1.000078625942615e+00, 1.000061360419570e+00, 1.000043939762341e+00, 1.000026408177143e+00, 1.000008810077537e+00, + 9.999911900000854e-01, 9.999735925202352e-01, 9.999560621682817e-01, 9.999386433453050e-01, 9.999213802389432e-01, + 9.999043167388835e-01, 9.998874963519558e-01, 9.998709621167259e-01, 9.998547565174905e-01, 9.998389213976104e-01, + 9.998234978721111e-01, 9.998085262395175e-01, 9.997940458929213e-01, 9.997800952302701e-01, 9.997667115639504e-01, + 9.997539310297094e-01, 9.997417884950316e-01, 9.997303174671138e-01, 9.997195500006013e-01, 9.997095166053042e-01, + 9.997002461541395e-01, 9.996917657915899e-01, 9.996841008429919e-01, 9.996772747250358e-01, 9.996713088578647e-01, + 9.996662225792015e-01, 9.996620330610038e-01, 9.996587552291110e-01, 9.996564016864400e-01, 9.996549826402822e-01, + 9.996545058342721e-01, 9.996549764856241e-01, 9.996563972282545e-01, 9.996587680623811e-01, 9.996620863112294e-01, + 9.996663465854424e-01, 9.996715407557830e-01, 9.996776579346981e-01, 9.996846844672899e-01, 9.996926039321870e-01, + 9.997013971527812e-01, 9.997110422192300e-01, 9.997215145215743e-01, 9.997327867942448e-01, 9.997448291721661e-01, + 9.997576092585791e-01, 9.997710922046226e-01, 9.997852408006243e-01, 9.998000155789548e-01, 9.998153749282088e-01, + 9.998312752183693e-01, 9.998476709365326e-01, 9.998645148326526e-01, 9.998817580746910e-01, 9.998993504124509e-01, + 9.999172403493095e-01, 9.999353753209654e-01, 9.999537018802583e-01, 9.999721658870582e-01, 9.999907127021609e-01, + 1.000009287384094e+00, 1.000027834887701e+00, 1.000046300263357e+00, 1.000064628855654e+00, 1.000082766500417e+00, + 1.000100659718908e+00, 1.000118255908115e+00, 1.000135503526065e+00, 1.000152352271146e+00, 1.000168753254487e+00, + 1.000184659164503e+00, 1.000200024422814e+00, 1.000214805330797e+00, 1.000228960206154e+00, 1.000242449508937e+00, + 1.000255235956604e+00, 1.000267284627737e+00, 1.000278563054191e+00, 1.000289041301503e+00, 1.000298692037512e+00, + 1.000307490589211e+00, 1.000315414987955e+00, 1.000322446003212e+00, 1.000328567165140e+00, 1.000333764776315e+00, + 1.000338027913030e+00, 1.000341348416601e+00, 1.000343720875191e+00, 1.000345142596688e+00, 1.000345613573201e+00, + 1.000345136437780e+00, 1.000343716413940e+00, 1.000341361258634e+00, 1.000338081199264e+00, 1.000333888865363e+00, + 1.000328799215525e+00, 1.000322829460191e+00, 1.000315998980820e+00, 1.000308329246031e+00, 1.000299843725170e+00, + 1.000290567799817e+00, 1.000280528673665e+00, 1.000269755281174e+00, 1.000258278195370e+00, 1.000246129535132e+00, + 1.000233342872243e+00, 1.000219953138474e+00, 1.000205996532911e+00, 1.000191510429705e+00, 1.000176533286390e+00, + 1.000161104552886e+00, 1.000145264581243e+00, 1.000129054536198e+00, 1.000112516306539e+00, 1.000095692417279e+00, + 1.000078625942610e+00, 1.000061360419565e+00, 1.000043939762336e+00, 1.000026408177138e+00, 1.000008810077532e+00, + 9.999911900000801e-01, 9.999735925202301e-01, 9.999560621682765e-01, 9.999386433453000e-01, 9.999213802389382e-01, + 9.999043167388785e-01, 9.998874963519510e-01, 9.998709621167211e-01, 9.998547565174859e-01, 9.998389213976059e-01, + 9.998234978721068e-01, 9.998085262395136e-01, 9.997940458929174e-01, 9.997800952302665e-01, 9.997667115639468e-01, + 9.997539310297062e-01, 9.997417884950285e-01, 9.997303174671109e-01, 9.997195500005988e-01, 9.997095166053018e-01, + 9.997002461541374e-01, 9.996917657915880e-01, 9.996841008429901e-01, 9.996772747250343e-01, 9.996713088578635e-01, + 9.996662225792006e-01, 9.996620330610030e-01, 9.996587552291103e-01, 9.996564016864398e-01, 9.996549826402821e-01, + 9.996545058342721e-01, 9.996549764856244e-01, 9.996563972282549e-01, 9.996587680623816e-01, 9.996620863112300e-01, + 9.996663465854433e-01, 9.996715407557840e-01, 9.996776579346992e-01, 9.996846844672912e-01, 9.996926039321883e-01, + 9.997013971527825e-01, 9.997110422192316e-01, 9.997215145215756e-01, 9.997327867942462e-01, 9.997448291721677e-01, + 9.997576092585806e-01, 9.997710922046239e-01, 9.997852408006256e-01, 9.998000155789563e-01, 9.998153749282102e-01, + 9.998312752183705e-01, 9.998476709365336e-01, 9.998645148326535e-01, 9.998817580746918e-01, 9.998993504124516e-01, + 9.999172403493102e-01, 9.999353753209660e-01, 9.999537018802587e-01, 9.999721658870584e-01, 9.999907127021610e-01, + 1.000009262768464e+00, 1.000027750736626e+00, 1.000046113687940e+00, 1.000064278821780e+00, 1.000082169071538e+00, + 1.000099702238537e+00, 1.000116790156982e+00, 1.000133337763978e+00, 1.000149242061725e+00, 1.000164390968527e+00, + 1.000178662057694e+00, 1.000191921184823e+00, 1.000204021005123e+00, 1.000214799383556e+00, 1.000224077701589e+00, + 1.000231659065357e+00, 1.000237326420850e+00, 1.000240840582544e+00, 1.000241938182520e+00, 1.000240329547572e+00, + 1.000235696512191e+00, 1.000227690175467e+00, 1.000215928609961e+00, 1.000199994530463e+00, 1.000179432930259e+00, + 1.000153748692032e+00, 1.000122404179984e+00, 1.000084816818973e+00, 1.000040356665695e+00, 9.999883439759534e-01, + 9.999280467710976e-01, 9.998586784056549e-01, 9.997793951371076e-01, 9.996892936976876e-01, 9.995874088670188e-01, + 9.994727110434261e-01, 9.993441038107910e-01, 9.992004214970033e-01, 9.990404267193601e-01, 9.988628079116455e-01, + 9.986661768272946e-01, 9.984490660128014e-01, 9.982099262455740e-01, 9.979471239307242e-01, 9.976589384518300e-01, + 9.973435594715599e-01, 9.969990841792483e-01, 9.966235144840385e-01, 9.962147541541155e-01, 9.957706059048574e-01, + 9.952887684414411e-01, 9.947668334645193e-01, 9.942022826511501e-01, 9.935924846270409e-01, 9.929346919504907e-01, + 9.922260381330554e-01, 9.914635347268980e-01, 9.906440685140006e-01, 9.897643988377397e-01, 9.888211551228012e-01, + 9.878108346347950e-01, 9.867298005362246e-01, 9.855742803004703e-01, 9.843403645500459e-01, 9.830240063894612e-01, + 9.816210213063771e-01, 9.801270877173017e-01, 9.785377482356147e-01, 9.768484117402024e-01, 9.750543563222487e-01, + 9.731507331856758e-01, 9.711325715733536e-01, 9.689947847863860e-01, 9.667321773575633e-01, 9.643394534324848e-01, + 9.618112264029069e-01, 9.591420298267040e-01, 9.563263296575538e-01, 9.533585377951747e-01, 9.502330269539270e-01, + 9.469441468339291e-01, 9.434862415648529e-01, 9.398536683783788e-01, 9.360408174512334e-01, 9.320421328469384e-01, + 9.278521344711611e-01, 9.234654409430395e-01, 9.188767932732427e-01, 9.140810792290244e-01, 9.090733582572249e-01, + 9.038488868282046e-01, 8.984031440571518e-01, 8.927318574541139e-01, 8.868310286504967e-01, 8.806969589476717e-01, + 8.743262745326578e-01, 8.677159512065934e-01, 8.608633384737868e-01, 8.537661828424618e-01, 8.464226501927783e-01, + 8.388313470732423e-01, 8.309913407930509e-01, 8.229021781851953e-01, 8.145639029231079e-01, 8.059770712821837e-01, + 7.971427662465509e-01, 7.880626098708469e-01, 7.787387738164395e-01, 7.691739879913762e-01, 7.593715472332762e-01, + 7.493353159843403e-01, 7.390697309175267e-01, 7.285798014827035e-01, 7.178711083511555e-01, 7.069497997461519e-01, + 6.958225856563154e-01, 6.844967299372567e-01, 6.729800403152869e-01, 6.612808563149986e-01, 6.494080351400781e-01, + 6.373709355438772e-01, 6.251793997330287e-01, 6.128437333537300e-01, 6.003746836162993e-01, 5.877834156192006e-01, + 5.750814869390165e-01, 5.622808205578382e-01, 5.493936762043069e-01, 5.364326201891255e-01, 5.234104938203454e-01, + 5.103403804881693e-01, 4.972355715134865e-01, 4.841095308589323e-01, 4.709758588060189e-01, 4.578482547068641e-01, + 4.447404789243264e-01, 4.316663140799624e-01, 4.186395257351866e-01, 4.056738226373441e-01, 3.927828166690819e-01, + 3.799799826463771e-01, 3.672786181177968e-01, 3.546918033248968e-01, 3.422323614910038e-01, 3.299128196128071e-01, + 3.177453699359932e-01, 3.057418323024091e-01, 2.939136175616680e-01, 2.822716922444745e-01, 2.708265446979701e-01, + 2.595881528848133e-01, 2.485659540472639e-01, 2.377688164349652e-01, 2.272050132902212e-01, 2.168821992771410e-01, + 2.068073895309444e-01, 1.969869414909128e-01, 1.874265396648929e-01, 1.781311834549869e-01, 1.691051781531976e-01, + 1.603521291925451e-01, 1.518749397137918e-01, 1.436758114807520e-01, 1.357562491485994e-01, 1.281170678600890e-01, + 1.207584041146470e-01, 1.136797298253828e-01, 1.068798694497608e-01, 1.003570200514591e-01, 9.410877412434678e-02, + 8.813214498499827e-02, 8.242359451816077e-02, 7.697906304046008e-02, 7.179400103167609e-02, 6.686340247035585e-02, + 6.218183950151154e-02, 5.774349815872721e-02, 5.354221486116098e-02, 4.957151340757950e-02, 4.582464219454362e-02, + 4.229461139394613e-02, 3.897422983601720e-02, 3.585614135733534e-02, 3.293286038897012e-02, 3.019680657726779e-02, + 2.764033824859545e-02, 2.525578454921406e-02, 2.303547611198478e-02, 2.097177412248857e-02, 1.905709767802756e-02, + 1.728394935359176e-02, 1.564493890895436e-02, 1.413280509038132e-02, 1.274043549881785e-02, 1.146088451369467e-02, + 1.028738927756386e-02, 9.213383761543762e-03, 8.232510944970423e-03, 7.338633154694566e-03, 6.525840620123105e-03, + 5.788458309403464e-03, 5.121051120120478e-03, 4.518427504569718e-03, 3.975641615147556e-03, 3.487994059724770e-03, + 3.051031360120983e-03, 2.660544209048234e-03, 2.312564622222088e-03, 2.003362082825875e-03, 1.729438775235064e-03, + 1.487524003938835e-03, 1.274567892006584e-03, 1.087734451306357e-03, 9.243941140548951e-04, 7.821158122256320e-04, + 6.586586879186365e-04, 5.519635140582476e-04, 4.601439007796695e-04, 3.814773586413279e-04, 3.143962853984603e-04, + 2.574789385355991e-04, 2.094404511189233e-04, 1.691239438292752e-04, 1.354917813061114e-04, 1.076170162029800e-04, + 8.467505965565773e-05, 6.593561222250244e-05, 5.075488479887568e-05, 3.856813455801580e-05, 2.888253665201353e-05, + 2.127040823889544e-05, 1.536279740228267e-05, 1.084344570939908e-05, 7.443129506680882e-06, 4.934381529209004e-06, + 3.126590786650604e-06, 1.861474073153740e-06, 1.008902130957542e-06, 4.630128105556161e-07, 1.379047824504878e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_HRA_WINDOW_480_10ms[960] = { + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 9.423411645757145e-08, 6.198383813913816e-07, 1.826038044753334e-06, 4.227415544684874e-06, 8.568221371240009e-06, + 1.590138306691229e-05, 2.767384916372097e-05, 4.582461489197476e-05, 7.289566442148343e-05, 1.121553337189409e-04, + 1.677330226576781e-04, 2.447635817250988e-04, 3.495390594774230e-04, 4.896648355656373e-04, 6.742165007916612e-04, + 9.138932038423809e-04, 1.221162590096684e-03, 1.610391938745493e-03, 2.097959688543948e-03, 2.702341257534836e-03, + 3.444162934209273e-03, 4.346217670272292e-03, 5.433436858058855e-03, 6.732812643305091e-03, 8.273266014983896e-03, + 1.008545682987358e-02, 1.220153306437313e-02, 1.465481792555360e-02, 1.747943497487382e-02, 2.070987309036685e-02, + 2.438049487743156e-02, 2.852499398840518e-02, 3.317580867440409e-02, 3.836350071222914e-02, 4.411611056397528e-02, + 5.045850117560903e-02, 5.741170414223051e-02, 6.499228300404947e-02, 7.321172913556540e-02, 8.207590600577601e-02, + 9.158455748369454e-02, 1.017308953166495e-01, 1.125012799073065e-01, 1.238750070616895e-01, 1.358242114920720e-01, + 1.483138955678087e-01, 1.613020891609740e-01, 1.747401434927874e-01, 1.885731587242474e-01, 2.027405417335493e-01, + 2.171766871750067e-01, 2.318117716158385e-01, 2.465726473968904e-01, 2.613838199586506e-01, 2.761684898079396e-01, + 2.908496381590925e-01, 3.053511336415384e-01, 3.195988363856895e-01, 3.335216753280081e-01, 3.470526747443392e-01, + 3.601299968134419e-01, 3.726979341699064e-01, 3.847073300820699e-01, 3.961165192918680e-01, 4.068917464693262e-01, + 4.170075357150957e-01, 4.264469007050540e-01, 4.352013996719531e-01, 4.432710380854631e-01, 4.506640257151909e-01, + 4.573963985795680e-01, 4.634915197715306e-01, 4.689794761564862e-01, 4.738963903364035e-01, 4.782836689638748e-01, + 4.821872093925473e-01, 4.856565867140006e-01, 4.887442424370954e-01, 4.915046944332492e-01, 4.939937853618382e-01, + 4.962679837116828e-01, 4.983837480011794e-01, 5.003969607669508e-01, 5.023624349677376e-01, 5.043334915837460e-01, + 5.063616037481589e-01, 5.084960999306821e-01, 5.107839166820760e-01, 5.132693903594975e-01, 5.159940771247666e-01, + 5.189965912996581e-01, 5.223124537547313e-01, 5.259739442166247e-01, 5.300099539725758e-01, 5.344458381774531e-01, + 5.393032695777062e-01, 5.446000977350559e-01, 5.503502195833738e-01, 5.565634682679432e-01, 5.632455276465002e-01, + 5.703978795909497e-01, 5.780177903898996e-01, 5.860983412324646e-01, 5.946285060985402e-01, 6.035932785464501e-01, + 6.129738470263359e-01, 6.227478165890419e-01, 6.328894733093686e-01, 6.433700864704220e-01, 6.541582425999274e-01, + 6.652202048172945e-01, 6.765202906248624e-01, 6.880212612236103e-01, 6.996847156078869e-01, 7.114714830467992e-01, + 7.233420080447298e-01, 7.352567224482216e-01, 7.471763999968595e-01, 7.590624892758133e-01, 7.708774216994878e-01, + 7.825848918282421e-01, 7.941501079877761e-01, 8.055400118211323e-01, 8.167234660553659e-01, 8.276714104070468e-01, + 8.383569861788307e-01, 8.487556307051457e-01, 8.588451433758131e-01, 8.686057254837016e-01, 8.780199965830640e-01, + 8.870729903819699e-01, 8.957521333967015e-01, 9.040472096414102e-01, 9.119503144919421e-01, 9.194558005383104e-01, + 9.265602177306744e-01, 9.332622494524668e-01, 9.395626453655078e-01, 9.454641510291475e-01, 9.509714334776073e-01, + 9.560910012334918e-01, 9.608311167251793e-01, 9.652016988316350e-01, 9.692142133449947e-01, 9.728815495300325e-01, + 9.762178816434048e-01, 9.792385151909874e-01, 9.819597187561544e-01, 9.843985433157453e-01, 9.865726319613708e-01, + 9.885000237614154e-01, 9.901989560579394e-01, 9.916876697497727e-01, 9.929842220610799e-01, 9.941063109595989e-01, + 9.950711148231832e-01, 9.958951502269355e-01, 9.965941499123417e-01, 9.971829621771531e-01, 9.976754721515079e-01, + 9.980845447462318e-01, 9.984219884986877e-01, 9.986985391068631e-01, 9.989238611254968e-01, 9.991065660804971e-01, + 9.992542451163898e-01, 9.993735142030505e-01, 9.994700698738658e-01, 9.995487534360048e-01, 9.996136215806155e-01, + 9.996680213292980e-01, 9.997146672907700e-01, 9.997557192777461e-01, 9.997928584573587e-01, 9.998273603841155e-01, + 9.998601634925650e-01, 9.998919319028886e-01, 9.999231117133845e-01, 9.999539803782231e-01, 9.999846913144619e-01, + 1.000015271687402e+00, 1.000045768313827e+00, 1.000076123719886e+00, 1.000106243781657e+00, 1.000136035347070e+00, + 1.000165406619359e+00, 1.000194267530612e+00, 1.000222530102796e+00, 1.000250108793741e+00, 1.000276920825814e+00, + 1.000302886495191e+00, 1.000327929459891e+00, 1.000351977005012e+00, 1.000374960283849e+00, 1.000396814533868e+00, + 1.000417479266803e+00, 1.000436898432418e+00, 1.000455020555724e+00, 1.000471798847772e+00, 1.000487191290310e+00, + 1.000501160694917e+00, 1.000513674737357e+00, 1.000524705968167e+00, 1.000534231800605e+00, 1.000542234477265e+00, + 1.000548701016775e+00, 1.000553623142091e+00, 1.000556997191966e+00, 1.000558824017243e+00, 1.000559108863603e+00, + 1.000557861242456e+00, 1.000555094791586e+00, 1.000550827127188e+00, 1.000545079688822e+00, 1.000537877578802e+00, + 1.000529249397403e+00, 1.000519227075235e+00, 1.000507845704000e+00, 1.000495143366764e+00, 1.000481160968755e+00, + 1.000465942069620e+00, 1.000449532717920e+00, 1.000431981288574e+00, 1.000413338323831e+00, 1.000393656378250e+00, + 1.000372989868060e+00, 1.000351394925194e+00, 1.000328929256167e+00, 1.000305652005906e+00, 1.000281623626542e+00, + 1.000256905751110e+00, 1.000231561072014e+00, 1.000205653224064e+00, 1.000179246671831e+00, 1.000152406601017e+00, + 1.000125198813461e+00, 1.000097689625410e+00, 1.000069945768613e+00, 1.000042034293768e+00, 1.000014022475844e+00, + 9.999859777207831e-01, 9.999579674730398e-01, 9.999300591234549e-01, 9.999023199169207e-01, 9.998748168593201e-01, + 9.998476166232155e-01, 9.998207854517803e-01, 9.997943890604891e-01, 9.997684925361024e-01, 9.997431602325028e-01, + 9.997184556629950e-01, 9.996944413886967e-01, 9.996711789027117e-01, 9.996487285098250e-01, 9.996271492015102e-01, + 9.996064985261154e-01, 9.995868324541498e-01, 9.995682052386838e-01, 9.995506692709443e-01, 9.995342749312822e-01, + 9.995190704357798e-01, 9.995051016788571e-01, 9.994924120723486e-01, 9.994810423816121e-01, 9.994710305593550e-01, + 9.994624115779566e-01, 9.994552172611834e-01, 9.994494761163015e-01, 9.994452131676952e-01, 9.994424497931953e-01, + 9.994412035644367e-01, 9.994414880926250e-01, 9.994433128811957e-01, 9.994466831869019e-01, 9.994515998909221e-01, + 9.994580593816230e-01, 9.994660534506217e-01, 9.994755692038015e-01, 9.994865889889091e-01, 9.994990903413156e-01, + 9.995130459494618e-01, 9.995284236414108e-01, 9.995451863938154e-01, 9.995632923644638e-01, 9.995826949494031e-01, + 9.996033428654485e-01, 9.996251802586674e-01, 9.996481468392096e-01, 9.996721780425870e-01, 9.996972052172600e-01, + 9.997231558380996e-01, 9.997499537450264e-01, 9.997775194058337e-01, 9.998057702019313e-01, 9.998346207354666e-01, + 9.998639831560286e-01, 9.998937675048852e-01, 9.999238820744936e-01, 9.999542337808154e-01, 9.999847285458191e-01, + 1.000015271687393e+00, 1.000045768313818e+00, 1.000076123719878e+00, 1.000106243781648e+00, 1.000136035347061e+00, + 1.000165406619350e+00, 1.000194267530604e+00, 1.000222530102788e+00, 1.000250108793733e+00, 1.000276920825807e+00, + 1.000302886495184e+00, 1.000327929459883e+00, 1.000351977005006e+00, 1.000374960283843e+00, 1.000396814533862e+00, + 1.000417479266798e+00, 1.000436898432413e+00, 1.000455020555719e+00, 1.000471798847767e+00, 1.000487191290306e+00, + 1.000501160694914e+00, 1.000513674737354e+00, 1.000524705968165e+00, 1.000534231800603e+00, 1.000542234477263e+00, + 1.000548701016774e+00, 1.000553623142090e+00, 1.000556997191965e+00, 1.000558824017242e+00, 1.000559108863603e+00, + 1.000557861242456e+00, 1.000555094791587e+00, 1.000550827127188e+00, 1.000545079688823e+00, 1.000537877578803e+00, + 1.000529249397404e+00, 1.000519227075236e+00, 1.000507845704002e+00, 1.000495143366766e+00, 1.000481160968757e+00, + 1.000465942069622e+00, 1.000449532717922e+00, 1.000431981288576e+00, 1.000413338323833e+00, 1.000393656378252e+00, + 1.000372989868062e+00, 1.000351394925196e+00, 1.000328929256169e+00, 1.000305652005908e+00, 1.000281623626544e+00, + 1.000256905751112e+00, 1.000231561072016e+00, 1.000205653224065e+00, 1.000179246671832e+00, 1.000152406601018e+00, + 1.000125198813462e+00, 1.000097689625411e+00, 1.000069945768614e+00, 1.000042034293768e+00, 1.000014022475844e+00, + 9.999859777207829e-01, 9.999579674730393e-01, 9.999300591234543e-01, 9.999023199169199e-01, 9.998748168593190e-01, + 9.998476166232144e-01, 9.998207854517789e-01, 9.997943890604876e-01, 9.997684925361007e-01, 9.997431602325010e-01, + 9.997184556629931e-01, 9.996944413886946e-01, 9.996711789027095e-01, 9.996487285098227e-01, 9.996271492015080e-01, + 9.996064985261129e-01, 9.995868324541474e-01, 9.995682052386815e-01, 9.995506692709419e-01, 9.995342749312801e-01, + 9.995190704357777e-01, 9.995051016788550e-01, 9.994924120723468e-01, 9.994810423816103e-01, 9.994710305593536e-01, + 9.994624115779553e-01, 9.994552172611824e-01, 9.994494761163009e-01, 9.994452131676944e-01, 9.994424497931950e-01, + 9.994412035644368e-01, 9.994414880926255e-01, 9.994433128811966e-01, 9.994466831869030e-01, 9.994515998909239e-01, + 9.994580593816250e-01, 9.994660534506239e-01, 9.994755692038041e-01, 9.994865889889122e-01, 9.994990903413189e-01, + 9.995130459494656e-01, 9.995284236414153e-01, 9.995451863938203e-01, 9.995632923644688e-01, 9.995826949494085e-01, + 9.996033428654543e-01, 9.996251802586735e-01, 9.996481468392161e-01, 9.996721780425940e-01, 9.996972052172670e-01, + 9.997231558381070e-01, 9.997499537450341e-01, 9.997775194058416e-01, 9.998057702019393e-01, 9.998346207354748e-01, + 9.998639831560371e-01, 9.998937675048939e-01, 9.999238820745020e-01, 9.999542337808240e-01, 9.999847285458278e-01, + 1.000015271687402e+00, 1.000045768313827e+00, 1.000076123719886e+00, 1.000106243781657e+00, 1.000136035347070e+00, + 1.000165406619359e+00, 1.000194267530612e+00, 1.000222530102796e+00, 1.000250108793741e+00, 1.000276920825814e+00, + 1.000302886495191e+00, 1.000327929459890e+00, 1.000351977005012e+00, 1.000374960283849e+00, 1.000396814533868e+00, + 1.000417479266803e+00, 1.000436898432418e+00, 1.000455020555724e+00, 1.000471798847772e+00, 1.000487191290310e+00, + 1.000501160694917e+00, 1.000513674737357e+00, 1.000524705968167e+00, 1.000534231800605e+00, 1.000542234477265e+00, + 1.000548701016775e+00, 1.000553623142091e+00, 1.000556997191966e+00, 1.000558824017243e+00, 1.000559108863603e+00, + 1.000557861242456e+00, 1.000555094791586e+00, 1.000550827127188e+00, 1.000545079688822e+00, 1.000537877578802e+00, + 1.000529249397403e+00, 1.000519227075234e+00, 1.000507845704000e+00, 1.000495143366764e+00, 1.000481160968755e+00, + 1.000465942069620e+00, 1.000449532717920e+00, 1.000431981288574e+00, 1.000413338323831e+00, 1.000393656378250e+00, + 1.000372989868060e+00, 1.000351394925194e+00, 1.000328929256167e+00, 1.000305652005906e+00, 1.000281623626542e+00, + 1.000256905751111e+00, 1.000231561072014e+00, 1.000205653224064e+00, 1.000179246671831e+00, 1.000152406601017e+00, + 1.000125198813461e+00, 1.000097689625410e+00, 1.000069945768614e+00, 1.000042034293768e+00, 1.000014022475844e+00, + 9.999859777207832e-01, 9.999579674730399e-01, 9.999300591234550e-01, 9.999023199169208e-01, 9.998748168593202e-01, + 9.998476166232156e-01, 9.998207854517805e-01, 9.997943890604892e-01, 9.997684925361026e-01, 9.997431602325029e-01, + 9.997184556629951e-01, 9.996944413886968e-01, 9.996711789027117e-01, 9.996487285098250e-01, 9.996271492015103e-01, + 9.996064985261155e-01, 9.995868324541498e-01, 9.995682052386839e-01, 9.995506692709443e-01, 9.995342749312823e-01, + 9.995190704357798e-01, 9.995051016788571e-01, 9.994924120723486e-01, 9.994810423816120e-01, 9.994710305593552e-01, + 9.994624115779566e-01, 9.994552172611834e-01, 9.994494761163015e-01, 9.994452131676951e-01, 9.994424497931953e-01, + 9.994412035644367e-01, 9.994414880926250e-01, 9.994433128811958e-01, 9.994466831869019e-01, 9.994515998909221e-01, + 9.994580593816230e-01, 9.994660534506217e-01, 9.994755692038015e-01, 9.994865889889089e-01, 9.994990903413155e-01, + 9.995130459494618e-01, 9.995284236414110e-01, 9.995451863938154e-01, 9.995632923644640e-01, 9.995826949494031e-01, + 9.996033428654485e-01, 9.996251802586674e-01, 9.996481468392096e-01, 9.996721780425870e-01, 9.996972052172600e-01, + 9.997231558380997e-01, 9.997499537450264e-01, 9.997775194058337e-01, 9.998057702019313e-01, 9.998346207354665e-01, + 9.998639831560286e-01, 9.998937675048852e-01, 9.999238820744936e-01, 9.999542337808154e-01, 9.999847285458191e-01, + 1.000015234454879e+00, 1.000045514887559e+00, 1.000075353237462e+00, 1.000104407768116e+00, 1.000132214556229e+00, + 1.000158143563050e+00, 1.000181349852841e+00, 1.000200717764093e+00, 1.000214798354899e+00, 1.000221740822748e+00, + 1.000219218852980e+00, 1.000204353032496e+00, 1.000173630567007e+00, 1.000122823551604e+00, 1.000046906963284e+00, + 9.999399773758973e-01, 9.997951731574873e-01, 9.996045966188434e-01, 9.993592382687311e-01, 9.990489030278769e-01, + 9.986621379953039e-01, 9.981861611823875e-01, 9.976067905662288e-01, 9.969083728962124e-01, 9.960737119427251e-01, + 9.950839963248127e-01, 9.939187277034516e-01, 9.925556509742455e-01, 9.909706891139552e-01, 9.891378864826104e-01, + 9.870293655848442e-01, 9.846153034530920e-01, 9.818639348132027e-01, 9.787415898998961e-01, 9.752127750773143e-01, + 9.712403041791187e-01, 9.667854876397981e-01, 9.618083850218845e-01, 9.562681244917907e-01, 9.501232902622440e-01, + 9.433323761603356e-01, 9.358543004959359e-01, 9.276489745130293e-01, 9.186779141170132e-01, 9.089048824643602e-01, + 8.982965495078461e-01, 8.868231537804969e-01, 8.744591515805539e-01, 8.611838392360764e-01, 8.469819351830896e-01, + 8.318441100567543e-01, 8.157674547284579e-01, 7.987558780821055e-01, 7.808204281831013e-01, 7.619795322485697e-01, + 7.422591523986999e-01, 7.216928555056540e-01, 7.003217965330363e-01, 6.781946155731466e-01, 6.553672493579565e-01, + 6.319026583753357e-01, 6.078704709095413e-01, 5.833465453994711e-01, 5.584124525334641e-01, 5.331548785464441e-01, + 5.076649513306994e-01, 4.820374912962984e-01, 4.563701895024020e-01, 4.307627165039317e-01, 4.053157666856800e-01, + 3.801300446346412e-01, 3.553052023472212e-01, 3.309387387548210e-01, 3.071248760994941e-01, 2.839534309593199e-01, + 2.615087010038701e-01, 2.398683915856861e-01, 2.191026087292818e-01, 1.992729466284019e-01, 1.804316980820018e-01, + 1.626212151220100e-01, 1.458734442426148e-01, 1.302096560997370e-01, 1.156403834405376e-01, 1.021655736434582e-01, + 8.977495404596501e-02, 7.844859976518601e-02, 6.815768558157265e-02, 5.886539624579484e-02, 5.052796378898961e-02, + 4.309579643342800e-02, 3.651466171052548e-02, 3.072688641085486e-02, 2.567253786455677e-02, 2.129055449466347e-02, + 1.751979822585132e-02, 1.430000675209340e-02, 1.157262945800897e-02, 9.281536579910191e-03, 7.373596677207363e-03, + 5.799122432483531e-03, 4.512189056010577e-03, 3.470833055336534e-03, 2.637141819806632e-03, 1.977246386436426e-03, + 1.461230953040205e-03, 1.062973263413438e-03, 7.599299954798238e-04, 5.328808285940163e-04, 3.656440417062249e-04, + 2.447753867250028e-04, 1.592606718286519e-04, 1.002110509628055e-04, 6.056851356108083e-05, 3.482755929907460e-05, + 1.877757338165862e-05, 9.269020516017977e-06, 4.005234147116555e-06, 1.359891615054068e-06, 2.067694412143206e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_HRA_WINDOW_960_10ms[1920] = { + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 6.663107991278473e-08, 2.237239208214098e-07, 4.875418283123564e-07, 8.996727135884617e-07, 1.511418282137696e-06, + 2.385908181307981e-06, 3.600021534325060e-06, 5.246458929559746e-06, 7.435999429480928e-06, 1.029995277226023e-05, + 1.399281202683861e-05, 1.869510977726803e-05, 2.461647918005920e-05, 3.199891951615131e-05, 4.112026404149671e-05, + 5.229784600131515e-05, 6.589235661010597e-05, 8.231188661821365e-05, 1.020161407958678e-04, 1.255208122795613e-04, + 1.534021012578998e-04, 1.863013599410517e-04, 2.249298431778123e-04, 2.700735414768832e-04, 3.225980705756125e-04, + 3.834535891028970e-04, 4.536797133272969e-04, 5.344103954917697e-04, 6.268787298389575e-04, 7.324216481524320e-04, + 8.524844645071808e-04, 9.886252269645022e-04, 1.142518832190136e-03, 1.315960857447457e-03, 1.510871063146860e-03, + 1.729296518144556e-03, 1.973414299303950e-03, 2.245533716484770e-03, 2.548098014131402e-03, 2.883685501012940e-03, + 3.255010060441685e-03, 3.664920994479873e-03, 4.116402157249738e-03, 4.612570334499312e-03, 5.156672829053223e-03, + 5.752084214696966e-03, 6.402302224405338e-03, 7.110942742626702e-03, 7.881733875566514e-03, 8.718509078064964e-03, + 9.625199320718177e-03, 1.060582428632988e-02, 1.166448259057781e-02, 1.280534102790626e-02, 1.403262285008227e-02, + 1.535059509154052e-02, 1.676355496255211e-02, 1.827581533833950e-02, 1.989168937947954e-02, 2.161547432623578e-02, + 2.345143451678970e-02, 2.540378368664082e-02, 2.747666661366220e-02, 2.967414018037076e-02, 3.200015393184128e-02, + 3.445853021429810e-02, 3.705294398569962e-02, 3.978690239552551e-02, 4.266372423642605e-02, 4.568651937534197e-02, + 4.885816827608890e-02, 5.218130172917755e-02, 5.565828090775238e-02, 5.929117787093344e-02, 6.308175663749782e-02, + 6.703145495369379e-02, 7.114136687902073e-02, 7.541222631299167e-02, 7.984439158421140e-02, 8.443783122053150e-02, + 8.919211101557852e-02, 9.410638250258946e-02, 9.917937294123873e-02, 1.044093769170137e-01, 1.097942496457128e-01, + 1.153314020678296e-01, 1.210177978089837e-01, 1.268499520732061e-01, 1.328239325258333e-01, 1.389353622120686e-01, + 1.451794245459895e-01, 1.515508703929904e-01, 1.580440272564225e-01, 1.646528105666080e-01, 1.713707370575420e-01, + 1.781909402035578e-01, 1.851061876750831e-01, 1.921089007594860e-01, 1.991911756799545e-01, 2.063448067325118e-01, + 2.135613111487021e-01, 2.208319555793100e-01, 2.281477840827779e-01, 2.354996474908733e-01, 2.428782340136974e-01, + 2.502741009364257e-01, 2.576777072513037e-01, 2.650794470604564e-01, 2.724696835780986e-01, 2.798387835547953e-01, + 2.871771519416024e-01, 2.944752666082350e-01, 3.017237129269402e-01, 3.089132180325088e-01, 3.160346845688595e-01, + 3.230792237339257e-01, 3.300381874371329e-01, 3.369031993875939e-01, 3.436661849362722e-01, 3.503193995017128e-01, + 3.568555192112148e-01, 3.632675601002685e-01, 3.695489358061075e-01, 3.756935099828519e-01, 3.816956001322418e-01, + 3.875499962002574e-01, 3.932519766094684e-01, 3.987973219750102e-01, 4.041823264714043e-01, 4.094038068104935e-01, + 4.144591088030795e-01, 4.193461114921915e-01, 4.240632288619702e-01, 4.286094091423471e-01, 4.329841317457969e-01, + 4.371874018882834e-01, 4.412197429619175e-01, 4.450821867417134e-01, 4.487762615229755e-01, 4.523039782991779e-01, + 4.556678151025579e-01, 4.588706996409412e-01, 4.619159903744011e-01, 4.648074561841559e-01, 4.675492547935124e-01, + 4.701459101065887e-01, 4.726022886349306e-01, 4.749235751849055e-01, 4.771152479798792e-01, 4.791830533906173e-01, + 4.811329804451050e-01, 4.829712352850382e-01, 4.847042157306455e-01, 4.863384861083030e-01, 4.878807524866530e-01, + 4.893378384567565e-01, 4.907166615802867e-01, 4.920242106170628e-01, 4.932675236294833e-01, 4.944536670468351e-01, + 4.955897157572258e-01, 4.966827342792363e-01, 4.977397590495528e-01, 4.987677818470457e-01, 4.997737343582849e-01, + 5.007644738745453e-01, 5.017467700962179e-01, 5.027272930074345e-01, 5.037126017718407e-01, 5.047091345900308e-01, + 5.057231994503223e-01, 5.067609656974670e-01, 5.078284563386384e-01, 5.089315410026908e-01, 5.100759294672467e-01, + 5.112671656686335e-01, 5.125106221119896e-01, 5.138114946028988e-01, 5.151747972275419e-01, 5.166053575154047e-01, + 5.181078117268841e-01, 5.196866002174090e-01, 5.213459628397580e-01, 5.230899343568223e-01, 5.249223398478975e-01, + 5.268467901024086e-01, 5.288666770055838e-01, 5.309851689306879e-01, 5.332052061618728e-01, 5.355294963802417e-01, + 5.379605102532377e-01, 5.405004771737987e-01, 5.431513812007881e-01, 5.459149572559273e-01, 5.487926876348163e-01, + 5.517857988905945e-01, 5.548952591484511e-01, 5.581217759075547e-01, 5.614657943841375e-01, 5.649274964455743e-01, + 5.685068001804389e-01, 5.722033601438381e-01, 5.760165683110121e-01, 5.799455557653441e-01, 5.839891951397580e-01, + 5.881461038230944e-01, 5.924146479356704e-01, 5.967929470708762e-01, 6.012788797925822e-01, 6.058700898713546e-01, + 6.105639932361040e-01, 6.153577856119751e-01, 6.202484508099709e-01, 6.252327696291247e-01, 6.303073293279928e-01, + 6.354685336188206e-01, 6.407126131349797e-01, 6.460356363201389e-01, 6.514335206861067e-01, 6.569020443853303e-01, + 6.624368580436263e-01, 6.680334967987880e-01, 6.736873924912369e-01, 6.793938859538112e-01, 6.851482393490396e-01, + 6.909456485038137e-01, 6.967812551932001e-01, 7.026501593271524e-01, 7.085474309960862e-01, 7.144681223336159e-01, + 7.204072791571976e-01, 7.263599523499238e-01, 7.323212089493037e-01, 7.382861429114533e-01, 7.442498855217515e-01, + 7.502076154256456e-01, 7.561545682559222e-01, 7.620860458353852e-01, 7.679974249364871e-01, 7.738841655820752e-01, + 7.797418188739772e-01, 7.855660343387494e-01, 7.913525667824293e-01, 7.970972826487233e-01, 8.027961658775241e-01, + 8.084453232632074e-01, 8.140409893145931e-01, 8.195795306209357e-01, 8.250574497306905e-01, 8.304713885521608e-01, + 8.358181312874381e-01, 8.410946069132281e-01, 8.462978912242891e-01, 8.514252084571686e-01, 8.564739325137894e-01, + 8.614415878060635e-01, 8.663258497442113e-01, 8.711245448926651e-01, 8.758356508184248e-01, 8.804572956574126e-01, + 8.849877574247438e-01, 8.894254630948657e-01, 8.937689874771898e-01, 8.980170519121489e-01, 9.021685228115252e-01, + 9.062224100654551e-01, 9.101778653366538e-01, 9.140341802602550e-01, 9.177907845650995e-01, 9.214472441295430e-01, + 9.250032589817625e-01, 9.284586612513364e-01, 9.318134130755062e-01, 9.350676044601444e-01, 9.382214510920930e-01, + 9.412752920963378e-01, 9.442295877284584e-01, 9.470849169901138e-01, 9.498419751530142e-01, 9.525015711749794e-01, + 9.550646249903935e-01, 9.575321646566392e-01, 9.599053233380030e-01, 9.621853361091064e-01, 9.643735365611265e-01, + 9.664713531959190e-01, 9.684803055955929e-01, 9.704020003580881e-01, 9.722381267927611e-01, 9.739904523738324e-01, + 9.756608179536774e-01, 9.772511327422573e-01, 9.787633690633392e-01, 9.801995569024828e-01, 9.815617782659093e-01, + 9.828521613732500e-01, 9.840728747106564e-01, 9.852261209738314e-01, 9.863141309330354e-01, 9.873391572540936e-01, + 9.883034683107520e-01, 9.892093420244598e-01, 9.900590597677280e-01, 9.908549003667192e-01, 9.915991342376211e-01, + 9.922940176897662e-01, 9.929417874263897e-01, 9.935446552714569e-01, 9.941048031482164e-01, 9.946243783321176e-01, + 9.951054889975415e-01, 9.955502000745265e-01, 9.959605294283782e-01, 9.963384443718103e-01, 9.966858585161255e-01, + 9.970046289649677e-01, 9.972965538513794e-01, 9.975633702163375e-01, 9.978067522246161e-01, 9.980283097117545e-01, + 9.982295870540839e-01, 9.984120623522111e-01, 9.985771469170162e-01, 9.987261850461071e-01, 9.988604540777616e-01, + 9.989811647086401e-01, 9.990894615609515e-01, 9.991864239842999e-01, 9.992730670770456e-01, 9.993503429117423e-01, + 9.994191419489804e-01, 9.994802946237851e-01, 9.995345730885834e-01, 9.995826930966561e-01, 9.996253160099111e-01, + 9.996630509147824e-01, 9.996964568300586e-01, 9.997260449905023e-01, 9.997522811902100e-01, 9.997755881698448e-01, + 9.997963480321130e-01, 9.998149046701891e-01, 9.998315661942099e-01, 9.998466073415005e-01, 9.998602718567984e-01, + 9.998727748295070e-01, 9.998843049758280e-01, 9.998950268545727e-01, 9.999050830064863e-01, 9.999145960080379e-01, + 9.999236704318017e-01, 9.999323947068164e-01, 9.999408428735685e-01, 9.999490762295546e-01, 9.999571448627051e-01, + 9.999650890712967e-01, 9.999729406705412e-01, 9.999807241886484e-01, 9.999884579652744e-01, 9.999961552850937e-01, + 1.000003818641721e+00, 1.000011453001950e+00, 1.000019078522643e+00, 1.000026689281996e+00, 1.000034279373492e+00, + 1.000041842912049e+00, 1.000049374040126e+00, 1.000056866933785e+00, 1.000064315808680e+00, 1.000071714925990e+00, + 1.000079058598250e+00, 1.000086341195099e+00, 1.000093557148926e+00, 1.000100700960395e+00, 1.000107767203853e+00, + 1.000114750532603e+00, 1.000121645684037e+00, 1.000128447484626e+00, 1.000135150854742e+00, 1.000141750813332e+00, + 1.000148242482408e+00, 1.000154621091371e+00, 1.000160881981147e+00, 1.000167020608141e+00, 1.000173032547996e+00, + 1.000178913499161e+00, 1.000184659286256e+00, 1.000190265863238e+00, 1.000195729316362e+00, 1.000201045866939e+00, + 1.000206211873884e+00, 1.000211223836059e+00, 1.000216078394407e+00, 1.000220772333881e+00, 1.000225302585160e+00, + 1.000229666226172e+00, 1.000233860483401e+00, 1.000237882733002e+00, 1.000241730501714e+00, 1.000245401467578e+00, + 1.000248893460465e+00, 1.000252204462412e+00, 1.000255332607784e+00, 1.000258276183243e+00, 1.000261033627556e+00, + 1.000263603531226e+00, 1.000265984635963e+00, 1.000268175833992e+00, 1.000270176167217e+00, 1.000271984826231e+00, + 1.000273601149186e+00, 1.000275024620537e+00, 1.000276254869646e+00, 1.000277291669272e+00, 1.000278134933949e+00, + 1.000278784718248e+00, 1.000279241214938e+00, 1.000279504753058e+00, 1.000279575795894e+00, 1.000279454938873e+00, + 1.000279142907386e+00, 1.000278640554535e+00, 1.000277948858822e+00, 1.000277068921773e+00, 1.000276001965517e+00, + 1.000274749330316e+00, 1.000273312472054e+00, 1.000271692959694e+00, 1.000269892472703e+00, 1.000267912798451e+00, + 1.000265755829598e+00, 1.000263423561457e+00, 1.000260918089352e+00, 1.000258241605975e+00, 1.000255396398729e+00, + 1.000252384847089e+00, 1.000249209419954e+00, 1.000245872673023e+00, 1.000242377246174e+00, 1.000238725860863e+00, + 1.000234921317548e+00, 1.000230966493118e+00, 1.000226864338370e+00, 1.000222617875491e+00, 1.000218230195586e+00, + 1.000213704456221e+00, 1.000209043879012e+00, 1.000204251747240e+00, 1.000199331403501e+00, 1.000194286247397e+00, + 1.000189119733258e+00, 1.000183835367906e+00, 1.000178436708454e+00, 1.000172927360150e+00, 1.000167310974248e+00, + 1.000161591245930e+00, 1.000155771912258e+00, 1.000149856750174e+00, 1.000143849574523e+00, 1.000137754236130e+00, + 1.000131574619904e+00, 1.000125314642979e+00, 1.000118978252895e+00, 1.000112569425805e+00, 1.000106092164726e+00, + 1.000099550497809e+00, 1.000092948476653e+00, 1.000086290174636e+00, 1.000079579685283e+00, 1.000072821120651e+00, + 1.000066018609750e+00, 1.000059176296973e+00, 1.000052298340563e+00, 1.000045388911081e+00, 1.000038452189909e+00, + 1.000031492367753e+00, 1.000024513643172e+00, 1.000017520221111e+00, 1.000010516311443e+00, 1.000003506127529e+00, + 9.999964938847642e-01, 9.999894837991481e-01, 9.999824800858419e-01, 9.999754869577321e-01, 9.999685086239848e-01, + 9.999615492886049e-01, 9.999546131489783e-01, 9.999477043944101e-01, 9.999408272046536e-01, 9.999339857484195e-01, + 9.999271841818784e-01, 9.999204266471391e-01, 9.999137172707154e-01, 9.999070601619628e-01, 9.999004594115060e-01, + 9.998939190896278e-01, 9.998874432446441e-01, 9.998810359012452e-01, 9.998747010588128e-01, 9.998684426896991e-01, + 9.998622647374855e-01, 9.998561711152009e-01, 9.998501657035072e-01, 9.998442523488513e-01, 9.998384348615825e-01, + 9.998327170140316e-01, 9.998271025385516e-01, 9.998215951255243e-01, 9.998161984213253e-01, 9.998109160262525e-01, + 9.998057514924167e-01, 9.998007083215891e-01, 9.997957899630165e-01, 9.997909998111978e-01, 9.997863412036158e-01, + 9.997818174184411e-01, 9.997774316721972e-01, 9.997731871173844e-01, 9.997690868400847e-01, 9.997651338575159e-01, + 9.997613311155714e-01, 9.997576814863203e-01, 9.997541877654884e-01, 9.997508526699078e-01, 9.997476788349500e-01, + 9.997446688119369e-01, 9.997418250655351e-01, 9.997391499711387e-01, 9.997366458122413e-01, 9.997343147777986e-01, + 9.997321589595916e-01, 9.997301803495896e-01, 9.997283808373202e-01, 9.997267622072430e-01, 9.997253261361446e-01, + 9.997240741905490e-01, 9.997230078241506e-01, 9.997221283752786e-01, 9.997214370643954e-01, 9.997209349916318e-01, + 9.997206231343719e-01, 9.997205023448855e-01, 9.997205733480192e-01, 9.997208367389500e-01, 9.997212929810099e-01, + 9.997219424035818e-01, 9.997227852000825e-01, 9.997238214260301e-01, 9.997250509972079e-01, 9.997264736879267e-01, + 9.997280891294001e-01, 9.997298968082279e-01, 9.997318960650045e-01, 9.997340860930513e-01, 9.997364659372833e-01, + 9.997390344932165e-01, 9.997417905061193e-01, 9.997447325703145e-01, 9.997478591286405e-01, 9.997511684720751e-01, + 9.997546587395272e-01, 9.997583279177997e-01, 9.997621738417346e-01, 9.997661941945379e-01, 9.997703865082921e-01, + 9.997747481646607e-01, 9.997792763957842e-01, 9.997839682853786e-01, 9.997888207700281e-01, 9.997938306406862e-01, + 9.997989945443773e-01, 9.998043089861064e-01, 9.998097703309746e-01, 9.998153748065003e-01, 9.998211185051531e-01, + 9.998269973870870e-01, 9.998330072830846e-01, 9.998391438977015e-01, 9.998454028126147e-01, 9.998517794901678e-01, + 9.998582692771129e-01, 9.998648674085433e-01, 9.998715690120116e-01, 9.998783691118356e-01, 9.998852626335712e-01, + 9.998922444086656e-01, 9.998993091792668e-01, 9.999064516031954e-01, 9.999136662590592e-01, 9.999209476515181e-01, + 9.999282902166716e-01, 9.999356883275767e-01, 9.999431362998797e-01, 9.999506283975492e-01, 9.999581588387069e-01, + 9.999657218015428e-01, 9.999733114303027e-01, 9.999809218413399e-01, 9.999885471292198e-01, 9.999961813728609e-01, + 1.000003818641712e+00, 1.000011453001941e+00, 1.000019078522634e+00, 1.000026689281987e+00, 1.000034279373484e+00, + 1.000041842912040e+00, 1.000049374040118e+00, 1.000056866933776e+00, 1.000064315808672e+00, 1.000071714925982e+00, + 1.000079058598242e+00, 1.000086341195091e+00, 1.000093557148918e+00, 1.000100700960387e+00, 1.000107767203845e+00, + 1.000114750532595e+00, 1.000121645684029e+00, 1.000128447484618e+00, 1.000135150854734e+00, 1.000141750813325e+00, + 1.000148242482401e+00, 1.000154621091364e+00, 1.000160881981140e+00, 1.000167020608134e+00, 1.000173032547989e+00, + 1.000178913499155e+00, 1.000184659286250e+00, 1.000190265863232e+00, 1.000195729316356e+00, 1.000201045866933e+00, + 1.000206211873878e+00, 1.000211223836054e+00, 1.000216078394402e+00, 1.000220772333876e+00, 1.000225302585155e+00, + 1.000229666226167e+00, 1.000233860483396e+00, 1.000237882732998e+00, 1.000241730501710e+00, 1.000245401467574e+00, + 1.000248893460461e+00, 1.000252204462409e+00, 1.000255332607781e+00, 1.000258276183240e+00, 1.000261033627553e+00, + 1.000263603531224e+00, 1.000265984635960e+00, 1.000268175833990e+00, 1.000270176167215e+00, 1.000271984826229e+00, + 1.000273601149185e+00, 1.000275024620536e+00, 1.000276254869644e+00, 1.000277291669271e+00, 1.000278134933948e+00, + 1.000278784718247e+00, 1.000279241214938e+00, 1.000279504753058e+00, 1.000279575795894e+00, 1.000279454938873e+00, + 1.000279142907386e+00, 1.000278640554536e+00, 1.000277948858822e+00, 1.000277068921773e+00, 1.000276001965517e+00, + 1.000274749330316e+00, 1.000273312472055e+00, 1.000271692959695e+00, 1.000269892472704e+00, 1.000267912798453e+00, + 1.000265755829599e+00, 1.000263423561458e+00, 1.000260918089354e+00, 1.000258241605976e+00, 1.000255396398731e+00, + 1.000252384847091e+00, 1.000249209419956e+00, 1.000245872673025e+00, 1.000242377246176e+00, 1.000238725860866e+00, + 1.000234921317550e+00, 1.000230966493120e+00, 1.000226864338372e+00, 1.000222617875493e+00, 1.000218230195589e+00, + 1.000213704456224e+00, 1.000209043879015e+00, 1.000204251747242e+00, 1.000199331403503e+00, 1.000194286247399e+00, + 1.000189119733260e+00, 1.000183835367908e+00, 1.000178436708457e+00, 1.000172927360152e+00, 1.000167310974250e+00, + 1.000161591245932e+00, 1.000155771912260e+00, 1.000149856750176e+00, 1.000143849574525e+00, 1.000137754236132e+00, + 1.000131574619906e+00, 1.000125314642981e+00, 1.000118978252897e+00, 1.000112569425807e+00, 1.000106092164727e+00, + 1.000099550497811e+00, 1.000092948476655e+00, 1.000086290174638e+00, 1.000079579685284e+00, 1.000072821120652e+00, + 1.000066018609751e+00, 1.000059176296974e+00, 1.000052298340564e+00, 1.000045388911082e+00, 1.000038452189910e+00, + 1.000031492367754e+00, 1.000024513643172e+00, 1.000017520221111e+00, 1.000010516311444e+00, 1.000003506127529e+00, + 9.999964938847641e-01, 9.999894837991480e-01, 9.999824800858417e-01, 9.999754869577318e-01, 9.999685086239841e-01, + 9.999615492886044e-01, 9.999546131489776e-01, 9.999477043944092e-01, 9.999408272046527e-01, 9.999339857484185e-01, + 9.999271841818773e-01, 9.999204266471379e-01, 9.999137172707140e-01, 9.999070601619615e-01, 9.999004594115044e-01, + 9.998939190896263e-01, 9.998874432446425e-01, 9.998810359012436e-01, 9.998747010588109e-01, 9.998684426896972e-01, + 9.998622647374836e-01, 9.998561711151988e-01, 9.998501657035050e-01, 9.998442523488493e-01, 9.998384348615804e-01, + 9.998327170140294e-01, 9.998271025385493e-01, 9.998215951255222e-01, 9.998161984213230e-01, 9.998109160262503e-01, + 9.998057514924145e-01, 9.998007083215869e-01, 9.997957899630143e-01, 9.997909998111957e-01, 9.997863412036135e-01, + 9.997818174184390e-01, 9.997774316721950e-01, 9.997731871173822e-01, 9.997690868400825e-01, 9.997651338575136e-01, + 9.997613311155693e-01, 9.997576814863183e-01, 9.997541877654863e-01, 9.997508526699059e-01, 9.997476788349481e-01, + 9.997446688119350e-01, 9.997418250655334e-01, 9.997391499711371e-01, 9.997366458122399e-01, 9.997343147777973e-01, + 9.997321589595902e-01, 9.997301803495884e-01, 9.997283808373191e-01, 9.997267622072419e-01, 9.997253261361438e-01, + 9.997240741905483e-01, 9.997230078241500e-01, 9.997221283752783e-01, 9.997214370643952e-01, 9.997209349916318e-01, + 9.997206231343722e-01, 9.997205023448859e-01, 9.997205733480196e-01, 9.997208367389504e-01, 9.997212929810105e-01, + 9.997219424035826e-01, 9.997227852000836e-01, 9.997238214260314e-01, 9.997250509972092e-01, 9.997264736879284e-01, + 9.997280891294021e-01, 9.997298968082300e-01, 9.997318960650067e-01, 9.997340860930538e-01, 9.997364659372859e-01, + 9.997390344932195e-01, 9.997417905061224e-01, 9.997447325703176e-01, 9.997478591286439e-01, 9.997511684720787e-01, + 9.997546587395311e-01, 9.997583279178037e-01, 9.997621738417388e-01, 9.997661941945423e-01, 9.997703865082966e-01, + 9.997747481646656e-01, 9.997792763957892e-01, 9.997839682853837e-01, 9.997888207700335e-01, 9.997938306406916e-01, + 9.997989945443829e-01, 9.998043089861125e-01, 9.998097703309806e-01, 9.998153748065066e-01, 9.998211185051595e-01, + 9.998269973870937e-01, 9.998330072830913e-01, 9.998391438977084e-01, 9.998454028126217e-01, 9.998517794901752e-01, + 9.998582692771203e-01, 9.998648674085506e-01, 9.998715690120191e-01, 9.998783691118432e-01, 9.998852626335790e-01, + 9.998922444086736e-01, 9.998993091792749e-01, 9.999064516032034e-01, 9.999136662590675e-01, 9.999209476515264e-01, + 9.999282902166798e-01, 9.999356883275852e-01, 9.999431362998885e-01, 9.999506283975580e-01, 9.999581588387155e-01, + 9.999657218015514e-01, 9.999733114303114e-01, 9.999809218413486e-01, 9.999885471292286e-01, 9.999961813728698e-01, + 1.000003818641721e+00, 1.000011453001950e+00, 1.000019078522643e+00, 1.000026689281996e+00, 1.000034279373492e+00, + 1.000041842912049e+00, 1.000049374040126e+00, 1.000056866933785e+00, 1.000064315808680e+00, 1.000071714925990e+00, + 1.000079058598250e+00, 1.000086341195099e+00, 1.000093557148926e+00, 1.000100700960395e+00, 1.000107767203853e+00, + 1.000114750532602e+00, 1.000121645684037e+00, 1.000128447484626e+00, 1.000135150854742e+00, 1.000141750813332e+00, + 1.000148242482408e+00, 1.000154621091371e+00, 1.000160881981147e+00, 1.000167020608141e+00, 1.000173032547996e+00, + 1.000178913499161e+00, 1.000184659286256e+00, 1.000190265863238e+00, 1.000195729316362e+00, 1.000201045866939e+00, + 1.000206211873884e+00, 1.000211223836059e+00, 1.000216078394407e+00, 1.000220772333881e+00, 1.000225302585160e+00, + 1.000229666226172e+00, 1.000233860483401e+00, 1.000237882733002e+00, 1.000241730501714e+00, 1.000245401467578e+00, + 1.000248893460465e+00, 1.000252204462412e+00, 1.000255332607784e+00, 1.000258276183243e+00, 1.000261033627556e+00, + 1.000263603531226e+00, 1.000265984635963e+00, 1.000268175833992e+00, 1.000270176167217e+00, 1.000271984826231e+00, + 1.000273601149187e+00, 1.000275024620537e+00, 1.000276254869646e+00, 1.000277291669272e+00, 1.000278134933949e+00, + 1.000278784718248e+00, 1.000279241214938e+00, 1.000279504753058e+00, 1.000279575795894e+00, 1.000279454938873e+00, + 1.000279142907386e+00, 1.000278640554535e+00, 1.000277948858822e+00, 1.000277068921773e+00, 1.000276001965517e+00, + 1.000274749330316e+00, 1.000273312472054e+00, 1.000271692959694e+00, 1.000269892472703e+00, 1.000267912798451e+00, + 1.000265755829598e+00, 1.000263423561457e+00, 1.000260918089352e+00, 1.000258241605975e+00, 1.000255396398729e+00, + 1.000252384847089e+00, 1.000249209419954e+00, 1.000245872673023e+00, 1.000242377246174e+00, 1.000238725860863e+00, + 1.000234921317548e+00, 1.000230966493118e+00, 1.000226864338370e+00, 1.000222617875491e+00, 1.000218230195586e+00, + 1.000213704456221e+00, 1.000209043879013e+00, 1.000204251747240e+00, 1.000199331403501e+00, 1.000194286247397e+00, + 1.000189119733258e+00, 1.000183835367906e+00, 1.000178436708454e+00, 1.000172927360150e+00, 1.000167310974248e+00, + 1.000161591245930e+00, 1.000155771912258e+00, 1.000149856750174e+00, 1.000143849574523e+00, 1.000137754236130e+00, + 1.000131574619904e+00, 1.000125314642979e+00, 1.000118978252895e+00, 1.000112569425805e+00, 1.000106092164726e+00, + 1.000099550497809e+00, 1.000092948476653e+00, 1.000086290174636e+00, 1.000079579685283e+00, 1.000072821120651e+00, + 1.000066018609750e+00, 1.000059176296973e+00, 1.000052298340563e+00, 1.000045388911081e+00, 1.000038452189909e+00, + 1.000031492367753e+00, 1.000024513643172e+00, 1.000017520221111e+00, 1.000010516311443e+00, 1.000003506127529e+00, + 9.999964938847643e-01, 9.999894837991482e-01, 9.999824800858421e-01, 9.999754869577322e-01, 9.999685086239848e-01, + 9.999615492886050e-01, 9.999546131489783e-01, 9.999477043944101e-01, 9.999408272046536e-01, 9.999339857484195e-01, + 9.999271841818784e-01, 9.999204266471392e-01, 9.999137172707154e-01, 9.999070601619630e-01, 9.999004594115060e-01, + 9.998939190896279e-01, 9.998874432446442e-01, 9.998810359012452e-01, 9.998747010588128e-01, 9.998684426896991e-01, + 9.998622647374856e-01, 9.998561711152009e-01, 9.998501657035073e-01, 9.998442523488514e-01, 9.998384348615826e-01, + 9.998327170140316e-01, 9.998271025385517e-01, 9.998215951255245e-01, 9.998161984213253e-01, 9.998109160262525e-01, + 9.998057514924167e-01, 9.998007083215890e-01, 9.997957899630168e-01, 9.997909998111979e-01, 9.997863412036158e-01, + 9.997818174184412e-01, 9.997774316721972e-01, 9.997731871173845e-01, 9.997690868400848e-01, 9.997651338575160e-01, + 9.997613311155714e-01, 9.997576814863203e-01, 9.997541877654884e-01, 9.997508526699078e-01, 9.997476788349500e-01, + 9.997446688119369e-01, 9.997418250655351e-01, 9.997391499711387e-01, 9.997366458122413e-01, 9.997343147777986e-01, + 9.997321589595916e-01, 9.997301803495896e-01, 9.997283808373202e-01, 9.997267622072429e-01, 9.997253261361446e-01, + 9.997240741905490e-01, 9.997230078241506e-01, 9.997221283752786e-01, 9.997214370643954e-01, 9.997209349916318e-01, + 9.997206231343720e-01, 9.997205023448855e-01, 9.997205733480192e-01, 9.997208367389500e-01, 9.997212929810099e-01, + 9.997219424035817e-01, 9.997227852000825e-01, 9.997238214260302e-01, 9.997250509972079e-01, 9.997264736879269e-01, + 9.997280891294001e-01, 9.997298968082279e-01, 9.997318960650045e-01, 9.997340860930511e-01, 9.997364659372833e-01, + 9.997390344932165e-01, 9.997417905061193e-01, 9.997447325703143e-01, 9.997478591286405e-01, 9.997511684720751e-01, + 9.997546587395272e-01, 9.997583279177997e-01, 9.997621738417345e-01, 9.997661941945379e-01, 9.997703865082921e-01, + 9.997747481646605e-01, 9.997792763957843e-01, 9.997839682853786e-01, 9.997888207700281e-01, 9.997938306406862e-01, + 9.997989945443773e-01, 9.998043089861064e-01, 9.998097703309746e-01, 9.998153748065003e-01, 9.998211185051530e-01, + 9.998269973870870e-01, 9.998330072830846e-01, 9.998391438977015e-01, 9.998454028126147e-01, 9.998517794901678e-01, + 9.998582692771129e-01, 9.998648674085431e-01, 9.998715690120116e-01, 9.998783691118356e-01, 9.998852626335712e-01, + 9.998922444086656e-01, 9.998993091792668e-01, 9.999064516031954e-01, 9.999136662590593e-01, 9.999209476515181e-01, + 9.999282902166716e-01, 9.999356883275767e-01, 9.999431362998797e-01, 9.999506283975492e-01, 9.999581588387069e-01, + 9.999657218015426e-01, 9.999733114303028e-01, 9.999809218413399e-01, 9.999885471292198e-01, 9.999961813728609e-01, + 1.000003792553732e+00, 1.000011363835885e+00, 1.000018880862106e+00, 1.000026318501453e+00, 1.000033646597102e+00, + 1.000040828844329e+00, 1.000047821703262e+00, 1.000054573213544e+00, 1.000061021697840e+00, 1.000067094351168e+00, + 1.000072705715621e+00, 1.000077756041457e+00, 1.000082129536869e+00, 1.000085692509860e+00, 1.000088291406840e+00, + 1.000089750753633e+00, 1.000089871005573e+00, 1.000088426314299e+00, 1.000085162219593e+00, 1.000079793275302e+00, + 1.000072000618805e+00, 1.000061429493851e+00, 1.000047686736686e+00, 1.000030338235356e+00, 1.000008906371822e+00, + 9.999828674561138e-01, 9.999516491611377e-01, 9.999146279660260e-01, 9.998711266149775e-01, 9.998204115975446e-01, + 9.997616906551822e-01, 9.996941103176716e-01, 9.996167534717882e-01, 9.995286369633262e-01, 9.994287092323502e-01, + 9.993158479803570e-01, 9.991888578669340e-01, 9.990464682325365e-01, 9.988873308431691e-01, 9.987100176521666e-01, + 9.985130185738464e-01, 9.982947392636853e-01, 9.980534988998219e-01, 9.977875279611558e-01, 9.974949659981255e-01, + 9.971738593934303e-01, 9.968221591115168e-01, 9.964377184376065e-01, 9.960182907094022e-01, 9.955615270473709e-01, + 9.950649740926601e-01, 9.945260717652322e-01, 9.939421510586981e-01, 9.933104318925129e-01, 9.926280210466711e-01, + 9.918919102086680e-01, 9.910989741672799e-01, 9.902459691925082e-01, 9.893295316457497e-01, 9.883461768687914e-01, + 9.872922984044433e-01, 9.861641676054160e-01, 9.849579336912377e-01, 9.836696243155244e-01, 9.822951467075759e-01, + 9.808302894530008e-01, 9.792707249777252e-01, 9.776120127982821e-01, 9.758496035985741e-01, 9.739788441893990e-01, + 9.719949834018297e-01, 9.698931789591444e-01, 9.676685053644012e-01, 9.653159628320954e-01, 9.628304872826687e-01, + 9.602069614081798e-01, 9.574402268063275e-01, 9.545250971684157e-01, 9.514563724950412e-01, 9.482288543014010e-01, + 9.448373617624480e-01, 9.412767487368542e-01, 9.375419215980740e-01, 9.336278577909594e-01, 9.295296250234834e-01, + 9.252424009953755e-01, 9.207614935589523e-01, 9.160823612022024e-01, 9.112006337403594e-01, 9.061121330997502e-01, + 9.008128940766279e-01, 8.952991849539681e-01, 8.895675278607562e-01, 8.836147187609806e-01, 8.774378469633509e-01, + 8.710343140474714e-01, 8.644018521077256e-01, 8.575385412223282e-01, 8.504428260617042e-01, 8.431135315574496e-01, + 8.355498775604459e-01, 8.277514924241404e-01, 8.197184254564199e-01, 8.114511581907922e-01, 8.029506144346715e-01, + 7.942181690593274e-01, 7.852556555024425e-01, 7.760653719601955e-01, 7.666500862512726e-01, 7.570130393401874e-01, + 7.471579475117688e-01, 7.370890031926083e-01, 7.268108744186758e-01, 7.163287029512231e-01, 7.056481010455187e-01, + 6.947751468789124e-01, 6.837163786462801e-01, 6.724787873320510e-01, 6.610698081688499e-01, 6.494973107933384e-01, + 6.377695881101478e-01, 6.258953438749761e-01, 6.138836790079482e-01, 6.017440766483936e-01, 5.894863859622419e-01, + 5.771208047134243e-01, 5.646578606110257e-01, 5.521083914445795e-01, 5.394835240208723e-01, 5.267946519170417e-01, + 5.140534120666679e-01, 5.012716601980810e-01, 4.884614451472596e-01, 4.756349820716255e-01, 4.628046245957236e-01, + 4.499828359253513e-01, 4.371821589731387e-01, 4.244151855459629e-01, 4.116945246528834e-01, 3.990327700015137e-01, + 3.864424667608565e-01, 3.739360776795802e-01, 3.615259486603844e-01, 3.492242739034092e-01, 3.370430607443994e-01, + 3.249940943263768e-01, 3.130889022566745e-01, 3.013387194140940e-01, 2.897544530833894e-01, 2.783466486059465e-01, + 2.671254557460968e-01, 2.561005959816459e-01, 2.452813309345670e-01, 2.346764321630724e-01, 2.242941525391207e-01, + 2.141421994355449e-01, 2.042277099441413e-01, 1.945572283400477e-01, 1.851366859983997e-01, 1.759713839565222e-01, + 1.670659782987828e-01, 1.584244685217862e-01, 1.500501890149949e-01, 1.419458037663698e-01, 1.341133043745716e-01, + 1.265540114190599e-01, 1.192685792075560e-01, 1.122570038873269e-01, 1.055186348731866e-01, 9.905218951159138e-02, + 9.285577086735504e-02, 8.692688848791834e-02, 8.126248197036480e-02, 7.585894712900819e-02, 7.071216453687493e-02, + 6.581753019316379e-02, 6.116998805112477e-02, 5.676406412698673e-02, 5.259390190074066e-02, 4.865329871379729e-02, + 4.493574286675733e-02, 4.143445112264064e-02, 3.814240632671975e-02, 3.505239486333388e-02, 3.215704368240290e-02, + 2.944885664345253e-02, 2.692024994241165e-02, 2.456358640583462e-02, 2.237120845811709e-02, 2.033546958929542e-02, + 1.844876417374586e-02, 1.670355551314538e-02, 1.509240200007160e-02, 1.360798132128038e-02, 1.224311264172586e-02, + 1.099077673153155e-02, 9.844134018179273e-03, 8.796540564986736e-03, 7.841561994366898e-03, 6.972985390308479e-03, + 6.184829228925801e-03, 5.471351398766137e-03, 4.827055383826915e-03, 4.246694691940794e-03, 3.725275619368065e-03, + 3.258058449144477e-03, 2.840557186031939e-03, 2.468537934882437e-03, 2.138016031933214e-03, 1.845252040089026e-03, + 1.586746719704406e-03, 1.359235085846040e-03, 1.159679661583578e-03, 9.852630346169412e-04, 8.333798215882749e-04, + 7.016281408336979e-04, 5.878006901877478e-04, 4.898755218427234e-04, 4.060066012630820e-04, 3.345142318353532e-04, + 2.738754213664553e-04, 2.227142607936653e-04, 1.797923795997266e-04, 1.439995364945199e-04, 1.143443979841680e-04, + 8.994555154915584e-05, 7.002279434068894e-05, 5.388873262066439e-05, 4.094072165278127e-05, 3.065317043363458e-05, + 2.257023056170620e-05, 1.629888370183569e-05, 1.150243752713366e-05, 7.894435705240934e-06, 5.232983386684600e-06, + 3.315485520548709e-06, 1.973790197100917e-06, 1.069718110365652e-06, 4.909053882102472e-07, 1.462097501755241e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + + + +const LC3_FLOAT* MDCT_WINS_10ms[2][6] = { + {MDCT_WINDOW_80, MDCT_WINDOW_160, MDCT_WINDOW_240, MDCT_WINDOW_320, MDCT_WINDOW_480, NULL}, + {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_10ms, MDCT_HRA_WINDOW_960_10ms}}; +const LC3_INT MDCT_la_zeroes[6] = {30, 60, 90, 120, 180, 360}; + + +const LC3_FLOAT* MDCT_WINS_2_5ms[2][6] = { + {MDCT_WINDOW_80_2_5ms, MDCT_WINDOW_160_2_5ms, MDCT_WINDOW_240_2_5ms, MDCT_WINDOW_320_2_5ms, MDCT_WINDOW_480_2_5ms, + NULL}, + {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_2_5ms, MDCT_HRA_WINDOW_960_2_5ms}}; +const LC3_INT MDCT_la_zeroes_2_5ms[6] = {0, 0, 0, 0, 0, 0}; + +const LC3_FLOAT* MDCT_WINS_5ms[2][6] = { + {MDCT_WINDOW_80_5ms, MDCT_WINDOW_160_5ms, MDCT_WINDOW_240_5ms, MDCT_WINDOW_320_5ms, MDCT_WINDOW_480_5ms, NULL}, + {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_5ms, MDCT_HRA_WINDOW_960_5ms}}; +const LC3_INT MDCT_la_zeroes_5ms[6] = {10, 20, 30, 40, 60, 120}; + +const LC3_INT MDCT_WINDOWS_LENGTHS_10ms[6] = {160, 320, 480, 640, 960, 1920}; /* Last 960 dummy */ + +const LC3_INT MDCT_WINDOWS_LENGTHS_2_5ms[6] = {40, 80, 120, 160, 240, 480}; + + +const LC3_INT MDCT_WINDOWS_LENGTHS_5ms[6] = {80, 160, 240, 320, 480, 960}; + +/* Per band energy */ +const LC3_INT ACC_COEFF_PER_BAND_8[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, + 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_16[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 36, 38, + 40, 42, 44, 46, 48, 50, 52, 55, 58, 61, 64, 67, 70, 73, 76, 80, 84, + 88, 92, 96, 101, 106, 111, 116, 121, 127, 133, 139, 146, 153, 160}; + +const LC3_INT ACC_COEFF_PER_BAND_24[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 46, 49, 52, 55, 58, 61, 64, 68, 72, 76, + 80, 85, 90, 95, 100, 106, 112, 118, 125, 132, 139, 147, 155, 164, 173, 183, 193, 204, 215, 227, 240}; + +const LC3_INT ACC_COEFF_PER_BAND_32[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, + 24, 26, 28, 30, 32, 34, 36, 38, 41, 44, 47, 50, 53, 56, 60, 64, 68, 72, 76, 81, 86, 91, + 97, 103, 109, 116, 123, 131, 139, 148, 157, 166, 176, 187, 199, 211, 224, 238, 252, 268, 284, 302, 320}; + +const LC3_INT ACC_COEFF_PER_BAND_48[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, + 26, 28, 30, 32, 34, 36, 39, 42, 45, 48, 51, 55, 59, 63, 67, 71, 76, 81, 86, 92, 98, 105, + 112, 119, 127, 135, 144, 154, 164, 175, 186, 198, 211, 225, 240, 256, 273, 291, 310, 330, 352, 375, 400}; + +const LC3_INT ACC_COEFF_PER_BAND_8_2_5ms[21] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + +const LC3_INT ACC_COEFF_PER_BAND_16_2_5ms[36] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, 38, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_24_2_5ms[41] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, + 30, 32, 34, 36, 38, 40, 42, 44, 47, 50, 53, 56, 60}; + +const LC3_INT ACC_COEFF_PER_BAND_32_2_5ms[44] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, + 36, 38, 40, 43, 46, 49, 52, 55, 59, 63, 67, 71, 75, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_48_2_5ms[45] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 40, 43, 46, 49, 52, 56, 60, 64, 68, 72, 77, 82, 87, 93, 100}; + +const LC3_INT ACC_COEFF_PER_BAND_48_2_5ms_HR[46] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, 43, 46, + 49, 53, 57, 61, 65, 69, 74, 79, 85, 91, 97, 104, 112, 120}; +const LC3_INT ACC_COEFF_PER_BAND_96_2_5ms_HR[50] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, + 35, 38, 41, 45, 49, 53, 57, 62, 67, 73, 79, 85, 92, 100, 108, 117, 127, 137, 149, 161, 174, 189, 204, 221, 240}; + + +const LC3_INT ACC_COEFF_PER_BAND_8_5ms[40] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_16_5ms[51] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, + 38, 40, 42, 44, 46, 48, 50, 52, 54, 57, 60, 63, 66, 69, 72, 76, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_24_5ms[53] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, + 30, 32, 34, 36, 38, 40, 42, 44, 47, 50, 53, 56, 59, 62, 65, 69, 73, 77, 81, 86, 91, 96, 101, 107, 113, 120}; + +const LC3_INT ACC_COEFF_PER_BAND_32_5ms[55] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 28, 30, 32, + 34, 36, 38, 40, 42, 45, 48, 51, 54, 57, 61, 65, 69, 73, + 78, 83, 88, 93, 99, 105, 112, 119, 126, 134, 142, 151, 160}; +const LC3_INT ACC_COEFF_PER_BAND_48_5ms_HR[56] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 21, 23, 25, 27, 29, 31, 33, 35, + 38, 41, 44, 47, 50, 54, 58, 62, 66, 71, 76, 81, 87, 93, + 100, 107, 114, 122, 131, 140, 149, 160, 171, 183, 196, 209, 224, 240}; +const LC3_INT ACC_COEFF_PER_BAND_48_5ms[56] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 27, 29, 31, 33, + 35, 37, 40, 43, 46, 49, 52, 55, 59, 63, 67, 72, 77, 82, + 87, 93, 99, 105, 112, 120, 128, 136, 145, 155, 165, 176, 187, 200}; +const LC3_INT ACC_COEFF_PER_BAND_96_5ms_HR[59] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, + 23, 25, 27, 29, 31, 34, 37, 40, 44, 48, 52, 56, 61, 66, 71, 77, 83, 90, 98, 106, + 115, 124, 135, 146, 158, 171, 185, 200, 217, 235, 254, 275, 298, 323, 349, 378, 409, 443, 480}; + + +const LC3_INT ACC_COEFF_PER_BAND_48_HR[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 23, 25, + 27, 29, 31, 33, 36, 39, 42, 45, 48, 51, 55, 59, 63, 67, 72, 77, 83, 89, 95, 101, 108, 116, + 124, 133, 142, 152, 163, 174, 187, 200, 214, 229, 244, 262, 280, 299, 320, 343, 367, 392, 419, 449, 480}; + +const LC3_INT ACC_COEFF_PER_BAND_96_HR[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 33, 36, 39, 42, 46, 50, 54, 59, 64, 69, 75, 82, 89, 96, 104, 113, 122, 132, 143, 155, 168, 181, 196, 213, 230, 249, 270, 292, 316, 342, 371, 401, 434, 470, 509, 551, 596, 646, 699, 757, 819, 887, 960}; + +const LC3_INT* ACC_COEFF_PER_BAND_HR[6] = {NULL, NULL, NULL, NULL, ACC_COEFF_PER_BAND_48_HR, ACC_COEFF_PER_BAND_96_HR}; + +const LC3_INT* ACC_COEFF_PER_BAND[6] = {ACC_COEFF_PER_BAND_8, ACC_COEFF_PER_BAND_16, ACC_COEFF_PER_BAND_24, + ACC_COEFF_PER_BAND_32, ACC_COEFF_PER_BAND_48, NULL}; + +const LC3_INT* ACC_COEFF_PER_BAND_2_5ms_HR[6] = { + NULL, NULL, NULL, NULL, ACC_COEFF_PER_BAND_48_2_5ms_HR, ACC_COEFF_PER_BAND_96_2_5ms_HR}; + +const LC3_INT* ACC_COEFF_PER_BAND_2_5ms[5] = {ACC_COEFF_PER_BAND_8_2_5ms, ACC_COEFF_PER_BAND_16_2_5ms, + ACC_COEFF_PER_BAND_24_2_5ms, ACC_COEFF_PER_BAND_32_2_5ms, + ACC_COEFF_PER_BAND_48_2_5ms}; + + +const LC3_INT* ACC_COEFF_PER_BAND_5ms_HR[6] = { + NULL, NULL, NULL, NULL, ACC_COEFF_PER_BAND_48_5ms_HR, ACC_COEFF_PER_BAND_96_5ms_HR}; + +const LC3_INT* ACC_COEFF_PER_BAND_5ms[5] = {ACC_COEFF_PER_BAND_8_5ms, ACC_COEFF_PER_BAND_16_5ms, + ACC_COEFF_PER_BAND_24_5ms, ACC_COEFF_PER_BAND_32_5ms, + ACC_COEFF_PER_BAND_48_5ms}; + +/* Near Nyquist detector */ +const LC3_INT NN_thresh = 30; + + +const LC3_INT32 xavg_N_grp[5] = { 4, 5, 6, 7, 8 }; + + +const LC3_INT32 gwlpr[MAX_LGW+1] = { 1, 3*QUOT_LPR_LTR, 5*QUOT_LPR_LTR, 9*QUOT_LPR_LTR, 17*QUOT_LPR_LTR, 33*QUOT_LPR_LTR, 49*QUOT_LPR_LTR, 65*QUOT_LPR_LTR, 81*QUOT_LPR_LTR, 97*QUOT_LPR_LTR}; + + +const LC3_FLOAT PhECU_whr16ms_NB[128]={ +8.000000000000002e-02, 8.393536376804722e-02, 9.567411990702857e-02, 1.150154150448081e-01, 1.416283142591582e-01, +1.750574634660318e-01, 2.147308806541882e-01, 2.599697426559885e-01, 3.099999999999999e-01, 3.639656211120587e-01, +4.209432392528405e-01, 4.799579515787762e-01, 5.400000000000000e-01, 6.000420484212237e-01, 6.590567607471596e-01, +7.160343788879413e-01, 7.699999999999999e-01, 8.200302573440115e-01, 8.652691193458119e-01, 9.049425365339682e-01, +9.383716857408418e-01, 9.649845849551919e-01, 9.843258800929715e-01, 9.960646362319528e-01, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +9.960646362319528e-01, 9.843258800929715e-01, 9.649845849551919e-01, 9.383716857408418e-01, 9.049425365339682e-01, +8.652691193458119e-01, 8.200302573440115e-01, 7.699999999999999e-01, 7.160343788879413e-01, 6.590567607471596e-01, +6.000420484212237e-01, 5.400000000000000e-01, 4.799579515787762e-01, 4.209432392528405e-01, 3.639656211120587e-01, +3.099999999999999e-01, 2.599697426559885e-01, 2.147308806541882e-01, 1.750574634660318e-01, 1.416283142591582e-01, +1.150154150448081e-01, 9.567411990702857e-02, 8.393536376804722e-02 +}; +const LC3_FLOAT PhECU_whr16ms_WB[256]={ +8.000000000000002e-02, 8.098489531024239e-02, 8.393536376804722e-02, 8.883877101451404e-02, 9.567411990702857e-02, +1.044121404322514e-01, 1.150154150448081e-01, 1.274385388949634e-01, 1.416283142591582e-01, 1.575239783408292e-01, +1.750574634660318e-01, 1.941536885596704e-01, 2.147308806541882e-01, 2.367009250539683e-01, 2.599697426559885e-01, +2.844376928109830e-01, 3.099999999999999e-01, 3.365472024992595e-01, 3.639656211120587e-01, 3.921378459605457e-01, +4.209432392528405e-01, 4.502584518725810e-01, 4.799579515787762e-01, 5.099145605541342e-01, 5.400000000000000e-01, +5.700854394458659e-01, 6.000420484212237e-01, 6.297415481274190e-01, 6.590567607471596e-01, 6.878621540394543e-01, +7.160343788879413e-01, 7.434527975007406e-01, 7.699999999999999e-01, 7.955623071890170e-01, 8.200302573440115e-01, +8.432990749460317e-01, 8.652691193458119e-01, 8.858463114403297e-01, 9.049425365339682e-01, 9.224760216591710e-01, +9.383716857408418e-01, 9.525614611050366e-01, 9.649845849551919e-01, 9.755878595677486e-01, 9.843258800929715e-01, +9.911612289854861e-01, 9.960646362319528e-01, 9.990151046897577e-01, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 9.990151046897577e-01, +9.960646362319528e-01, 9.911612289854861e-01, 9.843258800929715e-01, 9.755878595677486e-01, 9.649845849551919e-01, +9.525614611050366e-01, 9.383716857408418e-01, 9.224760216591710e-01, 9.049425365339682e-01, 8.858463114403297e-01, +8.652691193458119e-01, 8.432990749460317e-01, 8.200302573440115e-01, 7.955623071890170e-01, 7.699999999999999e-01, +7.434527975007406e-01, 7.160343788879413e-01, 6.878621540394543e-01, 6.590567607471596e-01, 6.297415481274190e-01, +6.000420484212237e-01, 5.700854394458659e-01, 5.400000000000000e-01, 5.099145605541342e-01, 4.799579515787762e-01, +4.502584518725810e-01, 4.209432392528405e-01, 3.921378459605457e-01, 3.639656211120587e-01, 3.365472024992595e-01, +3.099999999999999e-01, 2.844376928109830e-01, 2.599697426559885e-01, 2.367009250539683e-01, 2.147308806541882e-01, +1.941536885596704e-01, 1.750574634660318e-01, 1.575239783408292e-01, 1.416283142591582e-01, 1.274385388949634e-01, +1.150154150448081e-01, 1.044121404322514e-01, 9.567411990702857e-02, 8.883877101451404e-02, 8.393536376804722e-02, +8.098489531024239e-02 +}; +const LC3_FLOAT PhECU_whr16ms_SSWB[384]={ +8.000000000000002e-02, 8.043781807234540e-02, 8.175043887779704e-02, 8.393536376804722e-02, 8.698843361438435e-02, +9.090383672483066e-02, 9.567411990702857e-02, 1.012902026558156e-01, 1.077413944384821e-01, 1.150154150448081e-01, +1.230984179631410e-01, 1.319750167380180e-01, 1.416283142591582e-01, 1.520399349260726e-01, 1.631900596270638e-01, +1.750574634660318e-01, 1.876195561652702e-01, 2.008524250673430e-01, 2.147308806541882e-01, 2.292285044967963e-01, +2.443176995441919e-01, 2.599697426559885e-01, 2.761548392785189e-01, 2.928421801604610e-01, 3.099999999999999e-01, +3.275956379118843e-01, 3.455955995992783e-01, 3.639656211120587e-01, 3.826707340701924e-01, 4.016753322280344e-01, +4.209432392528405e-01, 4.404377775884727e-01, 4.601218382732121e-01, 4.799579515787762e-01, 4.999083583360772e-01, +5.199350818119455e-01, 5.400000000000000e-01, 5.600649181880546e-01, 5.800916416639228e-01, 6.000420484212237e-01, +6.198781617267880e-01, 6.395622224115274e-01, 6.590567607471596e-01, 6.783246677719657e-01, 6.973292659298076e-01, +7.160343788879413e-01, 7.344044004007217e-01, 7.524043620881156e-01, 7.699999999999999e-01, 7.871578198395390e-01, +8.038451607214812e-01, 8.200302573440115e-01, 8.356823004558082e-01, 8.507714955032037e-01, 8.652691193458119e-01, +8.791475749326572e-01, 8.923804438347298e-01, 9.049425365339682e-01, 9.168099403729364e-01, 9.279600650739274e-01, +9.383716857408418e-01, 9.480249832619820e-01, 9.569015820368590e-01, 9.649845849551919e-01, 9.722586055615179e-01, +9.787097973441844e-01, 9.843258800929715e-01, 9.890961632751694e-01, 9.930115663856157e-01, 9.960646362319528e-01, +9.982495611222031e-01, 9.995621819276547e-01, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 9.995621819276547e-01, 9.982495611222031e-01, +9.960646362319528e-01, 9.930115663856157e-01, 9.890961632751694e-01, 9.843258800929715e-01, 9.787097973441844e-01, +9.722586055615179e-01, 9.649845849551919e-01, 9.569015820368590e-01, 9.480249832619820e-01, 9.383716857408418e-01, +9.279600650739274e-01, 9.168099403729364e-01, 9.049425365339682e-01, 8.923804438347298e-01, 8.791475749326572e-01, +8.652691193458119e-01, 8.507714955032037e-01, 8.356823004558082e-01, 8.200302573440115e-01, 8.038451607214812e-01, +7.871578198395390e-01, 7.699999999999999e-01, 7.524043620881156e-01, 7.344044004007217e-01, 7.160343788879413e-01, +6.973292659298076e-01, 6.783246677719657e-01, 6.590567607471596e-01, 6.395622224115274e-01, 6.198781617267880e-01, +6.000420484212237e-01, 5.800916416639228e-01, 5.600649181880546e-01, 5.400000000000000e-01, 5.199350818119455e-01, +4.999083583360772e-01, 4.799579515787762e-01, 4.601218382732121e-01, 4.404377775884727e-01, 4.209432392528405e-01, +4.016753322280344e-01, 3.826707340701924e-01, 3.639656211120587e-01, 3.455955995992783e-01, 3.275956379118843e-01, +3.099999999999999e-01, 2.928421801604610e-01, 2.761548392785189e-01, 2.599697426559885e-01, 2.443176995441919e-01, +2.292285044967963e-01, 2.147308806541882e-01, 2.008524250673430e-01, 1.876195561652702e-01, 1.750574634660318e-01, +1.631900596270638e-01, 1.520399349260726e-01, 1.416283142591582e-01, 1.319750167380180e-01, 1.230984179631410e-01, +1.150154150448081e-01, 1.077413944384821e-01, 1.012902026558156e-01, 9.567411990702857e-02, 9.090383672483066e-02, +8.698843361438435e-02, 8.393536376804722e-02, 8.175043887779704e-02, 8.043781807234540e-02 +}; +const LC3_FLOAT PhECU_whr16ms_SWB[512]={ +8.000000000000002e-02, 8.024628976087178e-02, 8.098489531024239e-02, 8.221502573078943e-02, 8.393536376804722e-02, +8.614406724095569e-02, 8.883877101451404e-02, 9.201658953242653e-02, 9.567411990702857e-02, 9.980744556318394e-02, +1.044121404322514e-01, 1.094832736916302e-01, 1.150154150448081e-01, 1.210026405362591e-01, 1.274385388949634e-01, +1.343162183997567e-01, 1.416283142591582e-01, 1.493669964977737e-01, 1.575239783408292e-01, 1.660905250878570e-01, +1.750574634660318e-01, 1.844151914531410e-01, 1.941536885596704e-01, 2.042625265589956e-01, 2.147308806541882e-01, +2.255475410694793e-01, 2.367009250539683e-01, 2.481790892847231e-01, 2.599697426559885e-01, 2.720602594408110e-01, +2.844376928109830e-01, 2.970887887008307e-01, 3.099999999999999e-01, 3.231575010600410e-01, 3.365472024992595e-01, +3.501547662899784e-01, 3.639656211120587e-01, 3.779649779562326e-01, 3.921378459605457e-01, 4.064690484629473e-01, +4.209432392528405e-01, 4.355449190041883e-01, 4.502584518725810e-01, 4.650680822384892e-01, 4.799579515787762e-01, +4.949121154484021e-01, 5.099145605541342e-01, 5.249492219019830e-01, 5.400000000000000e-01, 5.550507780980171e-01, +5.700854394458659e-01, 5.850878845515979e-01, 6.000420484212237e-01, 6.149319177615109e-01, 6.297415481274190e-01, +6.444550809958116e-01, 6.590567607471596e-01, 6.735309515370527e-01, 6.878621540394543e-01, 7.020350220437674e-01, +7.160343788879413e-01, 7.298452337100215e-01, 7.434527975007406e-01, 7.568424989399589e-01, 7.699999999999999e-01, +7.829112112991693e-01, 7.955623071890170e-01, 8.079397405591890e-01, 8.200302573440115e-01, 8.318209107152770e-01, +8.432990749460317e-01, 8.544524589305209e-01, 8.652691193458119e-01, 8.757374734410044e-01, 8.858463114403297e-01, +8.955848085468591e-01, 9.049425365339682e-01, 9.139094749121430e-01, 9.224760216591710e-01, 9.306330035022263e-01, +9.383716857408418e-01, 9.456837816002432e-01, 9.525614611050366e-01, 9.589973594637410e-01, 9.649845849551919e-01, +9.705167263083698e-01, 9.755878595677486e-01, 9.801925544368162e-01, 9.843258800929715e-01, 9.879834104675735e-01, +9.911612289854861e-01, 9.938559327590444e-01, 9.960646362319528e-01, 9.977849742692106e-01, 9.990151046897577e-01, +9.997537102391283e-01, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 9.997537102391283e-01, 9.990151046897577e-01, 9.977849742692106e-01, +9.960646362319528e-01, 9.938559327590444e-01, 9.911612289854861e-01, 9.879834104675735e-01, 9.843258800929715e-01, +9.801925544368162e-01, 9.755878595677486e-01, 9.705167263083698e-01, 9.649845849551919e-01, 9.589973594637410e-01, +9.525614611050366e-01, 9.456837816002432e-01, 9.383716857408418e-01, 9.306330035022263e-01, 9.224760216591710e-01, +9.139094749121430e-01, 9.049425365339682e-01, 8.955848085468591e-01, 8.858463114403297e-01, 8.757374734410044e-01, +8.652691193458119e-01, 8.544524589305209e-01, 8.432990749460317e-01, 8.318209107152770e-01, 8.200302573440115e-01, +8.079397405591890e-01, 7.955623071890170e-01, 7.829112112991693e-01, 7.699999999999999e-01, 7.568424989399589e-01, +7.434527975007406e-01, 7.298452337100215e-01, 7.160343788879413e-01, 7.020350220437674e-01, 6.878621540394543e-01, +6.735309515370527e-01, 6.590567607471596e-01, 6.444550809958116e-01, 6.297415481274190e-01, 6.149319177615109e-01, +6.000420484212237e-01, 5.850878845515979e-01, 5.700854394458659e-01, 5.550507780980171e-01, 5.400000000000000e-01, +5.249492219019830e-01, 5.099145605541342e-01, 4.949121154484021e-01, 4.799579515787762e-01, 4.650680822384892e-01, +4.502584518725810e-01, 4.355449190041883e-01, 4.209432392528405e-01, 4.064690484629473e-01, 3.921378459605457e-01, +3.779649779562326e-01, 3.639656211120587e-01, 3.501547662899784e-01, 3.365472024992595e-01, 3.231575010600410e-01, +3.099999999999999e-01, 2.970887887008307e-01, 2.844376928109830e-01, 2.720602594408110e-01, 2.599697426559885e-01, +2.481790892847231e-01, 2.367009250539683e-01, 2.255475410694793e-01, 2.147308806541882e-01, 2.042625265589956e-01, +1.941536885596704e-01, 1.844151914531410e-01, 1.750574634660318e-01, 1.660905250878570e-01, 1.575239783408292e-01, +1.493669964977737e-01, 1.416283142591582e-01, 1.343162183997567e-01, 1.274385388949634e-01, 1.210026405362591e-01, +1.150154150448081e-01, 1.094832736916302e-01, 1.044121404322514e-01, 9.980744556318394e-02, 9.567411990702857e-02, +9.201658953242653e-02, 8.883877101451404e-02, 8.614406724095569e-02, 8.393536376804722e-02, 8.221502573078943e-02, +8.098489531024239e-02, 8.024628976087178e-02 +}; +const LC3_FLOAT PhECU_whr16ms_FB[768]={ +8.000000000000002e-02, 8.010946754324183e-02, 8.043781807234540e-02, 8.098489531024239e-02, 8.175043887779704e-02, +8.273408441773300e-02, 8.393536376804722e-02, 8.535370518483010e-02, 8.698843361438435e-02, 8.883877101451404e-02, +9.090383672483066e-02, 9.318264788589975e-02, 9.567411990702857e-02, 9.837706698247278e-02, 1.012902026558156e-01, +1.044121404322514e-01, 1.077413944384821e-01, 1.112763801299127e-01, 1.150154150448081e-01, 1.189567196050543e-01, +1.230984179631410e-01, 1.274385388949634e-01, 1.319750167380180e-01, 1.367056923745465e-01, 1.416283142591582e-01, +1.467405394904446e-01, 1.520399349260726e-01, 1.575239783408292e-01, 1.631900596270638e-01, 1.690354820369581e-01, +1.750574634660318e-01, 1.812531377772744e-01, 1.876195561652702e-01, 1.941536885596704e-01, 2.008524250673430e-01, +2.077125774525124e-01, 2.147308806541882e-01, 2.219039943401561e-01, 2.292285044967963e-01, 2.367009250539683e-01, +2.443176995441919e-01, 2.520752027953329e-01, 2.599697426559885e-01, 2.679975617527521e-01, 2.761548392785189e-01, +2.844376928109830e-01, 2.928421801604610e-01, 3.013643012461601e-01, 3.099999999999999e-01, 3.187451662970817e-01, +3.275956379118843e-01, 3.365472024992595e-01, 3.455955995992783e-01, 3.547365226649809e-01, 3.639656211120587e-01, +3.732785023894972e-01, 3.826707340701924e-01, 3.921378459605457e-01, 4.016753322280344e-01, 4.112786535457436e-01, +4.209432392528405e-01, 4.306644895299604e-01, 4.404377775884727e-01, 4.502584518725810e-01, 4.601218382732121e-01, +4.700232423526383e-01, 4.799579515787762e-01, 4.899212375680964e-01, 4.999083583360772e-01, 5.099145605541342e-01, +5.199350818119455e-01, 5.299651528841020e-01, 5.400000000000000e-01, 5.500348471158981e-01, 5.600649181880546e-01, +5.700854394458659e-01, 5.800916416639228e-01, 5.900787624319037e-01, 6.000420484212237e-01, 6.099767576473617e-01, +6.198781617267880e-01, 6.297415481274190e-01, 6.395622224115274e-01, 6.493355104700396e-01, 6.590567607471596e-01, +6.687213464542564e-01, 6.783246677719657e-01, 6.878621540394543e-01, 6.973292659298076e-01, 7.067214976105027e-01, +7.160343788879413e-01, 7.252634773350191e-01, 7.344044004007217e-01, 7.434527975007406e-01, 7.524043620881156e-01, +7.612548337029182e-01, 7.699999999999999e-01, 7.786356987538400e-01, 7.871578198395390e-01, 7.955623071890170e-01, +8.038451607214812e-01, 8.120024382472478e-01, 8.200302573440115e-01, 8.279247972046673e-01, 8.356823004558082e-01, +8.432990749460317e-01, 8.507714955032037e-01, 8.580960056598439e-01, 8.652691193458119e-01, 8.722874225474876e-01, +8.791475749326572e-01, 8.858463114403297e-01, 8.923804438347298e-01, 8.987468622227257e-01, 9.049425365339682e-01, +9.109645179630421e-01, 9.168099403729364e-01, 9.224760216591710e-01, 9.279600650739274e-01, 9.332594605095554e-01, +9.383716857408418e-01, 9.432943076254536e-01, 9.480249832619820e-01, 9.525614611050366e-01, 9.569015820368590e-01, +9.610432803949458e-01, 9.649845849551919e-01, 9.687236198700873e-01, 9.722586055615179e-01, 9.755878595677486e-01, +9.787097973441844e-01, 9.816229330175272e-01, 9.843258800929715e-01, 9.868173521141004e-01, 9.890961632751694e-01, +9.911612289854861e-01, 9.930115663856157e-01, 9.946462948151700e-01, 9.960646362319528e-01, 9.972659155822671e-01, +9.982495611222031e-01, 9.990151046897577e-01, 9.995621819276547e-01, 9.998905324567582e-01, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +9.998905324567582e-01, 9.995621819276547e-01, 9.990151046897577e-01, 9.982495611222031e-01, 9.972659155822671e-01, +9.960646362319528e-01, 9.946462948151700e-01, 9.930115663856157e-01, 9.911612289854861e-01, 9.890961632751694e-01, +9.868173521141004e-01, 9.843258800929715e-01, 9.816229330175272e-01, 9.787097973441844e-01, 9.755878595677486e-01, +9.722586055615179e-01, 9.687236198700873e-01, 9.649845849551919e-01, 9.610432803949458e-01, 9.569015820368590e-01, +9.525614611050366e-01, 9.480249832619820e-01, 9.432943076254536e-01, 9.383716857408418e-01, 9.332594605095554e-01, +9.279600650739274e-01, 9.224760216591710e-01, 9.168099403729364e-01, 9.109645179630421e-01, 9.049425365339682e-01, +8.987468622227257e-01, 8.923804438347298e-01, 8.858463114403297e-01, 8.791475749326572e-01, 8.722874225474876e-01, +8.652691193458119e-01, 8.580960056598439e-01, 8.507714955032037e-01, 8.432990749460317e-01, 8.356823004558082e-01, +8.279247972046673e-01, 8.200302573440115e-01, 8.120024382472478e-01, 8.038451607214812e-01, 7.955623071890170e-01, +7.871578198395390e-01, 7.786356987538400e-01, 7.699999999999999e-01, 7.612548337029182e-01, 7.524043620881156e-01, +7.434527975007406e-01, 7.344044004007217e-01, 7.252634773350191e-01, 7.160343788879413e-01, 7.067214976105027e-01, +6.973292659298076e-01, 6.878621540394543e-01, 6.783246677719657e-01, 6.687213464542564e-01, 6.590567607471596e-01, +6.493355104700396e-01, 6.395622224115274e-01, 6.297415481274190e-01, 6.198781617267880e-01, 6.099767576473617e-01, +6.000420484212237e-01, 5.900787624319037e-01, 5.800916416639228e-01, 5.700854394458659e-01, 5.600649181880546e-01, +5.500348471158981e-01, 5.400000000000000e-01, 5.299651528841020e-01, 5.199350818119455e-01, 5.099145605541342e-01, +4.999083583360772e-01, 4.899212375680964e-01, 4.799579515787762e-01, 4.700232423526383e-01, 4.601218382732121e-01, +4.502584518725810e-01, 4.404377775884727e-01, 4.306644895299604e-01, 4.209432392528405e-01, 4.112786535457436e-01, +4.016753322280344e-01, 3.921378459605457e-01, 3.826707340701924e-01, 3.732785023894972e-01, 3.639656211120587e-01, +3.547365226649809e-01, 3.455955995992783e-01, 3.365472024992595e-01, 3.275956379118843e-01, 3.187451662970817e-01, +3.099999999999999e-01, 3.013643012461601e-01, 2.928421801604610e-01, 2.844376928109830e-01, 2.761548392785189e-01, +2.679975617527521e-01, 2.599697426559885e-01, 2.520752027953329e-01, 2.443176995441919e-01, 2.367009250539683e-01, +2.292285044967963e-01, 2.219039943401561e-01, 2.147308806541882e-01, 2.077125774525124e-01, 2.008524250673430e-01, +1.941536885596704e-01, 1.876195561652702e-01, 1.812531377772744e-01, 1.750574634660318e-01, 1.690354820369581e-01, +1.631900596270638e-01, 1.575239783408292e-01, 1.520399349260726e-01, 1.467405394904446e-01, 1.416283142591582e-01, +1.367056923745465e-01, 1.319750167380180e-01, 1.274385388949634e-01, 1.230984179631410e-01, 1.189567196050543e-01, +1.150154150448081e-01, 1.112763801299127e-01, 1.077413944384821e-01, 1.044121404322514e-01, 1.012902026558156e-01, +9.837706698247278e-02, 9.567411990702857e-02, 9.318264788589975e-02, 9.090383672483066e-02, 8.883877101451404e-02, +8.698843361438435e-02, 8.535370518483010e-02, 8.393536376804722e-02, 8.273408441773300e-02, 8.175043887779704e-02, +8.098489531024239e-02, 8.043781807234540e-02, 8.010946754324183e-02 +}; + +const LC3_FLOAT* PhECU_whr16ms_wins[5] = { + PhECU_whr16ms_NB,PhECU_whr16ms_WB,PhECU_whr16ms_SSWB,PhECU_whr16ms_SWB, PhECU_whr16ms_FB +}; + + +const LC3_FLOAT hannOla_8k[28 / 2 + 1] = { + 0.0000000000, 0.0125360439, 0.0495155660, 0.1090842588, 0.1882550991, 0.2830581304, 0.3887395330, 0.5000000000, 0.6112604670, 0.7169418696, 0.8117449009, 0.8909157412, 0.9504844340, + 0.9874639561, 1.0000000000 }; + +const LC3_FLOAT hannOla_16k[56 / 2 + 1] = { + 0.0000000000, 0.0031438951, 0.0125360439, 0.0280583348, 0.0495155660, 0.0766379004, 0.1090842588, 0.1464466094, 0.1882550991, 0.2339839617, 0.2830581304, 0.3348604690, 0.3887395330, + 0.4440177619, 0.5000000000, 0.5559822381, 0.6112604670, 0.6651395310, 0.7169418696, 0.7660160383, 0.8117449009, 0.8535533906, 0.8909157412, 0.9233620996, 0.9504844340, 0.9719416652, + 0.9874639561, 0.9968561049, 1.0000000000 }; + +const LC3_FLOAT hannOla_24k[84 / 2 + 1] = { + 0.0000000000, 0.0013981014, 0.0055845869, 0.0125360439, 0.0222135971, 0.0345631257, 0.0495155660, 0.0669872981, 0.0868806128, 0.1090842588, 0.1334740641, 0.1599136311, 0.1882550991, + 0.2183399710, 0.2500000000, 0.2830581304, 0.3173294878, 0.3526224128, 0.3887395330, 0.4254788669, 0.4626349532, 0.5000000000, 0.5373650468, 0.5745211331, 0.6112604670, 0.6473775872, + 0.6826705122, 0.7169418696, 0.7500000000, 0.7816600290, 0.8117449009, 0.8400863689, 0.8665259359, 0.8909157412, 0.9131193872, 0.9330127019, 0.9504844340, 0.9654368743, 0.9777864029, + 0.9874639561, 0.9944154131, 0.9986018986, 1.0000000000 }; + +const LC3_FLOAT hannOla_32k[112 / 2 + 1] = { + 0.0000000000, 0.0007865925, 0.0031438951, 0.0070644907, 0.0125360439, 0.0195413390, 0.0280583348, 0.0380602337, 0.0495155660, 0.0623882890, 0.0766379004, 0.0922195655, 0.1090842588, + 0.1271789176, 0.1464466094, 0.1668267110, 0.1882550991, 0.2106643519, 0.2339839617, 0.2581405564, 0.2830581304, 0.3086582838, 0.3348604690, 0.3615822443, 0.3887395330, 0.4162468883, + 0.4440177619, 0.4719647764, 0.5000000000, 0.5280352236, 0.5559822381, 0.5837531117, 0.6112604670, 0.6384177557, 0.6651395310, 0.6913417162, 0.7169418696, 0.7418594436, 0.7660160383, + 0.7893356481, 0.8117449009, 0.8331732890, 0.8535533906, 0.8728210824, 0.8909157412, 0.9077804345, 0.9233620996, 0.9376117110, 0.9504844340, 0.9619397663, 0.9719416652, 0.9804586610, + 0.9874639561, 0.9929355093, 0.9968561049, 0.9992134075, 1.0000000000 }; + +const LC3_FLOAT hannOla_48k[168 / 2 + 1] = { + 0.0000000000, 0.0003496476, 0.0013981014, 0.0031438951, 0.0055845869, 0.0087167634, 0.0125360439, 0.0170370869, 0.0222135971, 0.0280583348, 0.0345631257, 0.0417188721, 0.0495155660, + 0.0579423032, 0.0669872981, 0.0766379004, 0.0868806128, 0.0977011101, 0.1090842588, 0.1210141384, 0.1334740641, 0.1464466094, 0.1599136311, 0.1738562944, 0.1882550991, 0.2030899072, + 0.2183399710, 0.2339839617, 0.2500000000, 0.2663656859, 0.2830581304, 0.3000539878, 0.3173294878, 0.3348604690, 0.3526224128, 0.3705904774, 0.3887395330, 0.4070441964, 0.4254788669, + 0.4440177619, 0.4626349532, 0.4813044029, 0.5000000000, 0.5186955971, 0.5373650468, 0.5559822381, 0.5745211331, 0.5929558036, 0.6112604670, 0.6294095226, 0.6473775872, 0.6651395310, + 0.6826705122, 0.6999460122, 0.7169418696, 0.7336343141, 0.7500000000, 0.7660160383, 0.7816600290, 0.7969100928, 0.8117449009, 0.8261437056, 0.8400863689, 0.8535533906, 0.8665259359, + 0.8789858616, 0.8909157412, 0.9022988899, 0.9131193872, 0.9233620996, 0.9330127019, 0.9420576968, 0.9504844340, 0.9582811279, 0.9654368743, 0.9719416652, 0.9777864029, 0.9829629131, + 0.9874639561, 0.9912832366, 0.9944154131, 0.9968561049, 0.9986018986, 0.9996503524, 1.0000000000 }; + +const LC3_FLOAT *hannOla_wins[5] = { hannOla_8k, hannOla_16k, hannOla_24k, hannOla_32k, hannOla_48k }; + +const LC3_FLOAT plc_tdc_lpc_8[17] = {1, 0.998890285693703, 0.995568526105076, 0.990056789412169, 0.982391584470799, 0.972623458066693, 0.960816439805232, 0.947047343167065, 0.931404933402306, 0.913988974871173, 0.894909172128633, 0.874284020464791, 0.852239582727672, 0.828908210053904, 0.804427224606163, 0.778937582561901, 0.752582535420797}; + +const LC3_FLOAT plc_tdc_lpc_16[17] = {1, 0.999722455898711, 0.998890285693703, 0.997504874399492, 0.995568526105076, 0.993084457588532, 0.990056789412169, 0.986490534532745, 0.982391584470799, 0.977766693092529, 0.972623458066693, 0.966970300067793, 0.960816439805232, 0.954171872966123, 0.947047343167065, 0.939454313017299, 0.931404933402306}; + +const LC3_FLOAT plc_tdc_lpc_24[17] = {1, 0.999876637554759, 0.999506641521283, 0.998890285693703, 0.998028026020383, 0.996920500041823, 0.995568526105076, 0.993973102356048, 0.992135405511397, 0.990056789412169, 0.987738783361644, 0.985183090250255, 0.982391584470799, 0.979366309627507, 0.976109476042902, 0.972623458066693, 0.968910791191297}; + +const LC3_FLOAT plc_tdc_lpc_32[17] = {1, 0.999930606751878, 0.999722455898711, 0.999375634094057, 0.998890285693703, 0.998266612655538, 0.997504874399492, 0.996605387627705, 0.995568526105076, 0.994394720400431, 0.993084457588532, 0.991638280913245, 0.990056789412169, 0.988340637503103, 0.986490534532745, 0.984507244288062, 0.982391584470799}; + +const LC3_FLOAT plc_tdc_lpc_48[17] = {1, 0.999969157961872, 0.999876637554759, 0.999722455898711, 0.999506641521283, 0.999229234348730, 0.998890285693703, 0.998489858239427, 0.998028026020383, 0.997504874399492, 0.996920500041823, 0.996275010884819, 0.995568526105076, 0.994801176081669, 0.993973102356048, 0.993084457588532, 0.992135405511397}; + +const LC3_FLOAT plc_tdc_lpc_96[17] = {1, 0.999992289401289, 0.999969157961872, 0.999930606751878, 0.999876637554759, 0.999807252867157, 0.999722455898711, 0.999622250571809, 0.999506641521283, 0.999375634094057, 0.999229234348730, 0.999067449055113, 0.998890285693703, 0.998697752455111, 0.998489858239427, 0.998266612655538, 0.998028026020383}; + +const LC3_FLOAT *plc_tdc_lpc_all[6] = {plc_tdc_lpc_8, plc_tdc_lpc_16, plc_tdc_lpc_24, plc_tdc_lpc_32, plc_tdc_lpc_48, plc_tdc_lpc_96}; + +const LC3_FLOAT plc_tdc_lpc_8_25ms[9] = {1, 0.998890285693703, 0.995568526105076, 0.990056789412169, 0.982391584470799, 0.972623458066693, 0.960816439805232, 0.947047343167065, 0.931404933402306}; + +const LC3_FLOAT plc_preemph_fac[] = {0.62, 0.72, 0.82, 0.92, 0.92, 0.92}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_8_10ms[81] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_16_10ms[81] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, + 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_24_10ms[81] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, + 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, + 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, + 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_32_10ms[81] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, + 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, + 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, + 252, 256, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308, 312, 316, 320}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_48_10ms[81] = { + 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, + 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, + 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360, 366, 372, + 378, 384, 390, 396 , 402, 408, 414, 420, 426, 432, 438, 444, 450, 456, 462, 468, 474, 480}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_96_10ms[81] = { + 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240, + 252, 264, 276, 288, 300, 312, 324, 336, 348, 360, 372, 384, 396, 408, 420, 432, 444, 456, 468, 480, 492, + 504, 516, 528, 540, 552, 564, 576, 588, 600, 612, 624, 636, 648, 660, 672, 684, 696, 708, 720, 732, 744, + 756, 768, 780, 792, 804, 816, 828, 840, 852, 864, 876, 888, 900, 912, 924, 936, 948, 960}; + +const LC3_INT* ACC_COEFF_PER_BAND_PLC[] = { + ACC_COEFF_PER_BAND_PLC_8_10ms, ACC_COEFF_PER_BAND_PLC_16_10ms, ACC_COEFF_PER_BAND_PLC_24_10ms, + ACC_COEFF_PER_BAND_PLC_32_10ms, ACC_COEFF_PER_BAND_PLC_48_10ms, ACC_COEFF_PER_BAND_PLC_96_10ms}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_8_2_5ms[21] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_16_2_5ms[41] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_24_2_5ms[61] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_32_2_5ms[81] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_48_2_5ms[61] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_96_2_5ms[81] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, + 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, + 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, + 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240}; + +const LC3_INT* ACC_COEFF_PER_BAND_PLC_2_5ms[] = { + ACC_COEFF_PER_BAND_PLC_8_2_5ms, ACC_COEFF_PER_BAND_PLC_16_2_5ms, ACC_COEFF_PER_BAND_PLC_24_2_5ms, + ACC_COEFF_PER_BAND_PLC_32_2_5ms, ACC_COEFF_PER_BAND_PLC_48_2_5ms, ACC_COEFF_PER_BAND_PLC_96_2_5ms}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_8_5ms[41] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_16_5ms[81] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_24_5ms[41] = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, + 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, + 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_32_5ms[81] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, + 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_48_5ms[81] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, + 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, + 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, + 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_96_5ms[81] = { + 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, + 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, + 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360, 366, 372, + 378, 384, 390, 396, 402, 408, 414, 420, 426, 432, 438, 444, 450, 456, 462, 468, 474, 480}; + +const LC3_INT* ACC_COEFF_PER_BAND_PLC_5ms[] = { + ACC_COEFF_PER_BAND_PLC_8_5ms, ACC_COEFF_PER_BAND_PLC_16_5ms, ACC_COEFF_PER_BAND_PLC_24_5ms, + ACC_COEFF_PER_BAND_PLC_32_5ms, ACC_COEFF_PER_BAND_PLC_48_5ms, ACC_COEFF_PER_BAND_PLC_96_5ms}; + +const LC3_INT32 mdct_grp_bins[10] = { 4, 14, 24, 44, 84, 164, 244, 324, 404, 484 }; + diff --git a/lc3plus/constants.h b/lc3plus/constants.h new file mode 100755 index 0000000000..c0c9e286e5 --- /dev/null +++ b/lc3plus/constants.h @@ -0,0 +1,203 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef CONSTANTS_H +#define CONSTANTS_H + +#include "defines.h" +#include "structs.h" + +/* DCT */ +extern const Complex dct2_16[16]; + +/* Ari coder */ +extern const LC3_INT ari_tns_order_cf[2][9]; +extern const LC3_INT ari_tns_freq_cf[8][18]; +extern const LC3_INT ari_spec_lookup_fl[4096]; +extern const LC3_INT ari_spec_cumfreq_fl[64][18]; +extern const LC3_INT ari_spec_bits_fl[64][17]; + +/* SNS */ +extern const LC3_FLOAT sns_LFCB[8][32]; +extern const LC3_FLOAT sns_HFCB[8][32]; +extern const LC3_INT pvq_enc_A[16][11]; +extern const LC3_FLOAT idct_lookup[M][M]; + +/* 12.8 kHz resampler */ +extern const LC3_FLOAT lp_scale_factors[6]; + +extern const LC3_INT32 resamp_params[][4]; +extern const LC3_FLOAT *lp_filter[6]; +extern const LC3_FLOAT highpass50_filt_b[3]; +extern const LC3_FLOAT highpass50_filt_a[3]; +extern const LC3_INT up_fac[6]; + +/* TNS */ +extern const LC3_FLOAT quants_pts_tns[17]; +extern const LC3_INT huff_bits_tns[8][17]; +extern const LC3_INT order1_tns[8]; +extern const LC3_INT order2_tns[8]; +extern const LC3_FLOAT lagw_tns[9]; +extern const LC3_FLOAT quants_pts_tns[17]; +extern const LC3_FLOAT quants_thr_tns[18]; + +/* SNS */ +extern const LC3_FLOAT sns_vq_far_adj_gains_fl[8]; +extern const LC3_FLOAT sns_vq_near_adj_gains_fl[4]; +extern const LC3_FLOAT sns_vq_reg_lf_adj_gains_fl[4]; +extern const LC3_FLOAT q_g_sns[6]; +extern const LC3_FLOAT sns_vq_reg_adj_gains_fl[2]; +extern const LC3_FLOAT sns_dec_gains[4][8]; + +/* Global Gain */ +extern const LC3_INT gg_p1[6]; +extern const LC3_INT gg_p2[6]; +extern const LC3_INT gg_p3[6]; +extern const LC3_FLOAT gg_c[6]; +extern const LC3_FLOAT gg_d[6]; + +/* Olpa */ +extern const LC3_FLOAT olpa_down2[5]; +extern const LC3_FLOAT olpa_acw[98]; + +/* LTPF */ +extern const LC3_FLOAT conf_inter_filter_48[4][12]; +extern const LC3_FLOAT conf_inter_filter_32[4][8]; +extern const LC3_FLOAT conf_inter_filter_24[4][6]; +extern const LC3_FLOAT conf_inter_filter_16[4][4]; +extern const LC3_FLOAT conf_tilt_filter_48[4][11]; +extern const LC3_FLOAT conf_tilt_filter_32[4][7]; +extern const LC3_FLOAT conf_tilt_filter_24[4][5]; +extern const LC3_FLOAT conf_tilt_filter_16[4][3]; +extern const LC3_FLOAT inter4_1[33]; +extern const LC3_FLOAT enc_inter_filter[4][4]; + +/* Bandwidth Detector */ +extern const LC3_INT threshold_quiet[4]; +extern const LC3_INT threshold_brickwall[4]; +extern const LC3_INT brickwall_dist[4]; +extern const LC3_INT BW_warp_idx_start_16k[4]; +extern const LC3_INT BW_warp_idx_stop_16k[4]; +extern const LC3_INT BW_warp_idx_start_24k[4]; +extern const LC3_INT BW_warp_idx_stop_24k[4]; +extern const LC3_INT BW_warp_idx_start_32k[4]; +extern const LC3_INT BW_warp_idx_stop_32k[4]; +extern const LC3_INT BW_warp_idx_start_48k[4]; +extern const LC3_INT BW_warp_idx_stop_48k[4]; +extern const LC3_INT* BW_warp_idx_start_all[4]; +extern const LC3_INT* BW_warp_idx_stop_all[4]; + +extern const LC3_INT BW_warp_idx_start_16k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_16k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_start_24k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_24k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_start_32k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_32k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_start_48k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_48k_2_5ms[4]; +extern const LC3_INT* BW_warp_idx_start_all_2_5ms[4]; +extern const LC3_INT* BW_warp_idx_stop_all_2_5ms[4]; +extern const LC3_INT BW_cutoff_bin_all_2_5ms_HR[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT bands_number_2_5ms_HR[6]; + +extern const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT bands_number_2_5ms[5]; + + +extern const LC3_INT BW_warp_idx_start_16k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_16k_5ms[4]; +extern const LC3_INT BW_warp_idx_start_24k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_24k_5ms[4]; +extern const LC3_INT BW_warp_idx_start_32k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_32k_5ms[4]; +extern const LC3_INT BW_warp_idx_start_48k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_48k_5ms[4]; +extern const LC3_INT* BW_warp_idx_start_all_5ms[4]; +extern const LC3_INT* BW_warp_idx_stop_all_5ms[4]; +extern const LC3_INT BW_cutoff_bin_all_5ms[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT bands_number_5ms[6]; +extern const LC3_INT BW_cutoff_bin_all_HR[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT BW_cutoff_bin_all_5ms_HR[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT BW_cutoff_bin_all[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER]; + +/* Arithmetic coding */ +extern const LC3_INT tns_cf[8][18]; +extern const LC3_INT tns_freq_cf[2][9]; + +/* MDCT Windows */ +extern const LC3_FLOAT MDCT_WINDOW_80[160]; +extern const LC3_FLOAT MDCT_WINDOW_160[320]; +extern const LC3_FLOAT MDCT_WINDOW_240[480]; +extern const LC3_FLOAT MDCT_WINDOW_320[640]; +extern const LC3_FLOAT MDCT_WINDOW_480[960]; +extern const LC3_FLOAT MDCT_WINDOW_960[1920]; +extern const LC3_FLOAT* MDCT_WINS_10ms[2][6]; +extern const LC3_INT MDCT_la_zeroes[6]; + +extern const LC3_FLOAT MDCT_WINDOW_80_2_5ms[40]; +extern const LC3_FLOAT MDCT_WINDOW_160_2_5ms[80]; +extern const LC3_FLOAT MDCT_WINDOW_240_2_5ms[120]; +extern const LC3_FLOAT MDCT_WINDOW_320_2_5ms[160]; +extern const LC3_FLOAT MDCT_WINDOW_480_2_5ms[240]; +extern const LC3_FLOAT* MDCT_WINS_2_5ms[2][6]; +extern const LC3_INT MDCT_la_zeroes_2_5ms[6]; + + +extern const LC3_FLOAT MDCT_WINDOW_80_5ms[80]; +extern const LC3_FLOAT MDCT_WINDOW_160_5ms[160]; +extern const LC3_FLOAT MDCT_WINDOW_240_5ms[240]; +extern const LC3_FLOAT MDCT_WINDOW_320_5ms[320]; +extern const LC3_FLOAT MDCT_WINDOW_480_5ms[480]; +extern const LC3_FLOAT* MDCT_WINS_5ms[2][6]; +extern const LC3_INT MDCT_la_zeroes_5ms[6]; + +extern const LC3_INT MDCT_WINDOWS_LENGTHS_10ms[6]; + +extern const LC3_INT MDCT_WINDOWS_LENGTHS_2_5ms[6]; + + +extern const LC3_INT MDCT_WINDOWS_LENGTHS_5ms[6]; + +/* Per band energy */ +extern const LC3_INT* ACC_COEFF_PER_BAND[6]; +extern const LC3_INT* ACC_COEFF_PER_BAND_HR[6]; + +extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms_HR[6]; +extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms[5]; + + +extern const LC3_INT* ACC_COEFF_PER_BAND_5ms_HR[6]; +extern const LC3_INT* ACC_COEFF_PER_BAND_5ms[5]; + +/* Near Nyquist detector */ +extern const LC3_INT NN_thresh; + + +extern const LC3_INT32 xavg_N_grp[5]; +extern const LC3_FLOAT *hannOla_wins[5]; +extern const LC3_INT32 gwlpr[MAX_LGW+1]; +extern const LC3_INT32 mdct_grp_bins[10]; +extern const LC3_FLOAT* PhECU_whr16ms_wins[5]; + +extern const LC3_FLOAT plc_preemph_fac[]; +extern const LC3_INT* ACC_COEFF_PER_BAND_PLC[]; +extern const LC3_INT* ACC_COEFF_PER_BAND_PLC_2_5ms[]; +extern const LC3_INT* ACC_COEFF_PER_BAND_PLC_5ms[]; +extern const LC3_FLOAT *plc_tdc_lpc_all[6]; +extern const LC3_FLOAT plc_tdc_lpc_8[17]; +extern const LC3_FLOAT plc_tdc_lpc_16[17]; +extern const LC3_FLOAT plc_tdc_lpc_24[17]; +extern const LC3_FLOAT plc_tdc_lpc_32[17]; +extern const LC3_FLOAT plc_tdc_lpc_48[17]; +extern const LC3_FLOAT plc_tdc_lpc_96[17]; +extern const LC3_FLOAT plc_tdc_lpc_8_25ms[9]; + +#endif diff --git a/lc3plus/cutoff_bandwidth.c b/lc3plus/cutoff_bandwidth.c new file mode 100755 index 0000000000..642b2afda2 --- /dev/null +++ b/lc3plus/cutoff_bandwidth.c @@ -0,0 +1,27 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) +{ + LC3_INT i = 0; + + if (len > bw_bin){ + for (i = -1; i < 3; i++) { + d_fl[bw_bin + i] = d_fl[bw_bin + i] * LC3_POW(2, -(i + 2)); + } + + for (i = bw_bin + 3; i < len; i++) { + d_fl[i] = 0; + } + } +} diff --git a/lc3plus/dct4.c b/lc3plus/dct4.c new file mode 100755 index 0000000000..8fd5784b28 --- /dev/null +++ b/lc3plus/dct4.c @@ -0,0 +1,95 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void dct2_init(Dct2* dct, int length) +{ + assert(length <= MAX_LEN); + dct->length = length; + fft_init(&dct->fft, length); +} + +void dct2_free(Dct2* dct) +{ + if (dct) { + fft_free(&dct->fft); + memset(dct, 0, sizeof(*dct)); + } +} + +void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output) +{ + Complex tmp1[MAX_LEN]; + Complex tmp2[MAX_LEN]; + int i = 0; + const int len = dct->length; + assert(input != output); + + for (i = 0; i < len / 2; i++) { + tmp1[i] = cmplx(input[i * 2], 0); + tmp1[len - i - 1] = cmplx(input[i * 2 + 1], 0); + } + + fft_apply(&dct->fft, tmp1, tmp2); + + for (i = 0; i < len; i++) { + output[i] = cmul(tmp2[i], dct2_16[i]).r; + } + output[0] /= (LC3_FLOAT)1.414213562373095; /* SQRT(2) */ +} + + +void dct4_init(Dct4* dct, int length) +{ + int i = 0; + assert(length <= MAX_LEN); + dct->length = length; + dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); + dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); + for (i = 0; i < length / 2; i++) { + dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI * (i + (LC3_FLOAT)0.25) / length); + dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI * i / length); + } + fft_init(&dct->fft, length / 2); +} + +void dct4_free(Dct4* dct) +{ + if (dct) { + free(dct->twid1); + free(dct->twid2); + fft_free(&dct->fft); + memset(dct, 0, sizeof(*dct)); + } +} + +void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output) +{ + Complex tmp2[MAX_LEN / 2]; + int i = 0; + Complex* tmp1 = (Complex*)output; + const int len = dct->length; + const LC3_FLOAT norm = (LC3_FLOAT)1.0 / LC3_SQRT((LC3_FLOAT)(len >> 1)); + assert(input != output); + + for (i = 0; i < len / 2; i++) { + tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); + } + + fft_apply(&dct->fft, tmp1, tmp2); + + for (i = 0; i < len / 2; i++) { + Complex t = cmul(tmp2[i], dct->twid2[i]); + output[i * 2] = t.r * norm; + output[len - i * 2 - 1] = -t.i * norm; + } +} diff --git a/lc3plus/dec_entropy.c b/lc3plus/dec_entropy.c new file mode 100755 index 0000000000..d8512a1068 --- /dev/null +++ b/lc3plus/dec_entropy.c @@ -0,0 +1,277 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); +static void read_uint_fl(LC3_INT nbits, LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* val); + +void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit) +{ + if (ptr[*bp_side] & *mask_side) { + *bit = 1; + } else { + *bit = 0; + } + + if (*mask_side == 128) { + *mask_side = 1; + *bp_side = *bp_side - 1; + } else { + *mask_side = *mask_side * 2; + } +} + +void read_uint_fl(LC3_INT nbits, LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* val) +{ + LC3_INT bit = 0, i = 0; + + read_bit_fl(ptr, mask_side, bp_side, val); + + for (i = 1; i < nbits; i++) { + read_bit_fl(ptr, mask_side, bp_side, &bit); + *val = *val + (bit << i); + } +} + +#ifdef ENABLE_PADDING +LC3_INT paddingDec_fl(LC3_UINT8* bytes, LC3_INT nbbits, LC3_INT L_spec, LC3_INT bw_cutoff_bits, LC3_INT ep_enabled, LC3_INT* total_padding, LC3_INT *np_zero) +{ + LC3_INT lastnz_threshold; + LC3_INT val, padding_len_bits, padding_len; + LC3_INT bp_side; + LC3_INT mask_side; + LC3_UINT8* ptr = bytes; + + LC3_INT nbbytes = nbbits >> 3; + LC3_INT lastnz; + LC3_INT bw_cutoff_idx; + LC3_INT nbits = ceil(LC3_LOGTWO(L_spec / 2)); + + if (nbits > nbbits) + { + return 1; + } + + *np_zero = 0; + + *total_padding = 0; + + bp_side = (nbbits - 1) >> 3; + mask_side = 1 << (8 - (nbbits - (bp_side << 3))); + + if (bp_side < 19 || bp_side >= LC3PLUS_MAX_BYTES) { + return 1; + } + + ptr = bytes; + + if (bw_cutoff_bits > 0) { + read_uint_fl(bw_cutoff_bits, ptr, &mask_side, &bp_side, &bw_cutoff_idx); + } + + read_uint_fl(nbits, ptr, &mask_side, &bp_side, &lastnz); + + lastnz_threshold = (1 << nbits) - 1 - 1; + + while (lastnz == lastnz_threshold) { + padding_len_bits = 16 - nbits - bw_cutoff_bits - 4; + + /*Read padding length*/ + read_uint_fl(padding_len_bits, ptr, &mask_side, &bp_side, &padding_len); + + /* Read 4 reserved bits */ + read_uint_fl(4, ptr, &mask_side, &bp_side, &val); + + if (ep_enabled == 0) + { + /* Discard padding length bytes */ + bp_side = bp_side - padding_len; + *total_padding = *total_padding + padding_len + 2; + } + else + { + *total_padding = *total_padding + 2; + *np_zero = *np_zero + padding_len; + } + + /* check if minimum payload size is reached */ + if ((nbbytes - (*total_padding + *np_zero)) < 20) { + return 1; + } + + /* Read bandwidth bits */ + if (bw_cutoff_bits > 0) { + read_uint_fl(bw_cutoff_bits, ptr, &mask_side, &bp_side, &bw_cutoff_idx); + } + + read_uint_fl(nbits, ptr, &mask_side, &bp_side, &lastnz); + } + + if (ep_enabled != 0) + { + *total_padding = *total_padding + *np_zero; + } + + return 0; +} +#endif + +void processDecoderEntropy_fl(LC3_UINT8* bytes, LC3_INT numbytes, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT N, LC3_INT fs_idx, + LC3_INT bw_cutoff_bits, LC3_INT* bfi, LC3_INT* gg_idx, LC3_INT* scf_idx, LC3_INT* fac_ns_idx, + LC3_INT* tns_numfilters, LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* bw_cutoff_idx, LC3_INT* lastnz, + LC3_INT* lsbMode, LC3_INT frame_dms) +{ + + LC3_INT plc_trigger_bw = 0, plc_trigger_last_nz = 0, plc_trigger_SNS1 = 0, plc_trigger_SNS2 = 0, tmp = 0, bit = 0, + submodeMSB = 0, i = 0, ltpf_tmp[3] = {0}, ind = 0, submodeLSB = 0, bp_side_local = 0, mask_side_local = 0; + LC3_UINT8* ptr; + LC3_INT gainMSBbits[4] = {1, 1, 2, 2}; + + *bp_side = -1; + bp_side_local = numbytes - 1; /* Matlab offset by 1 */ + mask_side_local = 1; + *mask_side = -1; + ptr = bytes; + *lsbMode = -1; + *lastnz = -1; + + plc_trigger_bw = 1; /* Bandwidth */ + plc_trigger_last_nz = 1; /* Last non-zero tuple */ + plc_trigger_SNS1 = 1; /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + plc_trigger_SNS2 = 1; /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + + + + /* Bandwidth */ + if (bw_cutoff_bits > 0) { + read_uint_fl(bw_cutoff_bits, ptr, &mask_side_local, &bp_side_local, bw_cutoff_idx); + + if (fs_idx < *bw_cutoff_idx) { + *bfi = plc_trigger_bw; + + if (*bfi) { + return; + } + } + } else { + *bw_cutoff_idx = fs_idx; + } + + /* Number of TNS filters */ + if (*bw_cutoff_idx < 3 || frame_dms == 25) { + *tns_numfilters = 1; + } else { + *tns_numfilters = 2; + } + + /* Last non-zero tuple */ + read_uint_fl(ceil(LC3_LOGTWO(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz); + *lastnz = (*lastnz + 1) * 2; + + if (*lastnz > N) { + *bfi = plc_trigger_last_nz; + if (*bfi) { + return; + } + } + + /* LSB mode bit */ + read_bit_fl(ptr, &mask_side_local, &bp_side_local, lsbMode); + + /* Global gain */ + read_uint_fl(8, ptr, &mask_side_local, &bp_side_local, gg_idx); + + /* TNS activation flag */ + for (i = 0; i < *tns_numfilters; i++) { + read_bit_fl(ptr, &mask_side_local, &bp_side_local, &bit); + tns_order[i] = bit; + } + + /* LTPF activation flag */ + read_bit_fl(ptr, &mask_side_local, &bp_side_local, <pf_tmp[0]); + + /* SNS-VQ 1st stage */ + read_uint_fl(5, ptr, &mask_side_local, &bp_side_local, &scf_idx[0]); + read_uint_fl(5, ptr, &mask_side_local, &bp_side_local, &scf_idx[1]); + + /* SNS-VQ 2nd stage side-info (3-4 bits) */ + read_bit_fl(ptr, &mask_side_local, &bp_side_local, &submodeMSB); + scf_idx[2] = submodeMSB * 2; + + read_uint_fl(gainMSBbits[scf_idx[2]], ptr, &mask_side_local, &bp_side_local, &scf_idx[3]); + read_bit_fl(ptr, &mask_side_local, &bp_side_local, &scf_idx[4]); + + /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + if (submodeMSB == 0) { + read_uint_fl(25, ptr, &mask_side_local, &bp_side_local, &tmp); + if (tmp >= 33460056) { + *bfi = plc_trigger_SNS1; + if (*bfi) { + return; + } + } + + ind = floor(tmp / 2390004); + scf_idx[5] = tmp - ind * 2390004; + + if (ind < 2) { + submodeLSB = 1; + scf_idx[3] = scf_idx[3] * 2 + ind; + scf_idx[6] = -2; + } else { + submodeLSB = 0; + scf_idx[6] = ind - 2; + } + + } else { + read_uint_fl(24, ptr, &mask_side_local, &bp_side_local, &tmp); + + if (tmp >= 16708096) { + *bfi = plc_trigger_SNS2; + if (*bfi) { + return; + } + } + + if (tmp >= 15158272) { + submodeLSB = 1; + scf_idx[3] = scf_idx[3] * 2 + ((tmp - 15158272) & 1); + scf_idx[5] = floor((tmp - 15158272) / 2); + scf_idx[6] = -2; + } else { + submodeLSB = 0; + scf_idx[5] = tmp; + scf_idx[6] = -1; + } + } + + scf_idx[2] = scf_idx[2] + submodeLSB; + + /* LTPF data */ + if (ltpf_tmp[0] == 1) { + read_bit_fl(ptr, &mask_side_local, &bp_side_local, <pf_tmp[1]); + read_uint_fl(9, ptr, &mask_side_local, &bp_side_local, <pf_tmp[2]); + } else { + ltpf_tmp[1] = 0; + ltpf_tmp[2] = 0; + } + + for (i = 0; i < 3; i++) { + ltpf_idx[i] = ltpf_tmp[i]; + } + + /* Noise factor */ + read_uint_fl(3, ptr, &mask_side_local, &bp_side_local, fac_ns_idx); + + *bp_side = bp_side_local; + *mask_side = mask_side_local; +} diff --git a/lc3plus/dec_lc3_fl.c b/lc3plus/dec_lc3_fl.c new file mode 100755 index 0000000000..88c528b0f6 --- /dev/null +++ b/lc3plus/dec_lc3_fl.c @@ -0,0 +1,365 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs_in, void* s_out, int bps, int bfi_ext) +{ + DecSetup* h_DecSetup; + LC3_INT mask_side = 0, bp_side = 0, bfi = 0, gg_idx = 0, fac_ns_idx = 0, tns_numfilters = 0, bw_cutoff_idx = 0, + lastnz = 0, lsbMode = 0, nf_seed = 0, zero_frame = 0, residualPresent = 0, nbits_residual = 0, bitsRead = 0, + i = 0, tns_order[2] = {0}, sqQdec[MAX_LEN] = {0}; + LC3_INT b_left; + LC3_FLOAT stab_fac = 0; + + h_DecSetup = decoder->channel_setup[channel]; + + memset(h_DecSetup->tns_idx, 0, sizeof(*h_DecSetup->tns_idx) * TNS_NUMFILTERS_MAX * MAXLAG); + + bfi = bfi_ext; + + decoder->rframe = 0; + if (bfi == 3) + { + bfi = 2; + decoder->rframe = 1; + } + + /* Entropy decoding */ + if (bfi != 1) { + processDecoderEntropy_fl(bs_in, h_DecSetup->targetBytes, &mask_side, &bp_side, decoder->yLen, decoder->fs_idx, + decoder->BW_cutoff_bits, &bfi, &gg_idx, h_DecSetup->scf_idx, &fac_ns_idx, + &tns_numfilters, tns_order, h_DecSetup->ltpf_param, &bw_cutoff_idx, &lastnz, &lsbMode, decoder->frame_dms + ); + h_DecSetup->BW_cutoff_idx_nf = bw_cutoff_idx; + } + + /* Arithmetic decoding */ + if (bfi != 1) { + processAriDecoder_fl(bs_in, bp_side, mask_side, decoder->yLen, decoder->fs_idx, + h_DecSetup->enable_lpc_weighting, tns_numfilters, lsbMode, lastnz, &bfi, tns_order, fac_ns_idx, gg_idx, h_DecSetup->resBits, + sqQdec, &nf_seed, h_DecSetup->tns_idx, &zero_frame, h_DecSetup->targetBytes, &nbits_residual, &residualPresent, decoder->frame_dms, + decoder->n_pc, decoder->be_bp_left, decoder->be_bp_right, 0, &b_left, &h_DecSetup->spec_inv_idx, + decoder->hrmode + ); + + if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1) + { + LC3_INT32 max_bw_stopband = BW_cutoff_bin_all[bw_cutoff_idx]; + bfi = 2; + switch (decoder->frame_dms) + { +# ifdef ENABLE_025_DMS_MODE + case 25: + max_bw_stopband = max_bw_stopband >> 2; + break; +# endif +# ifdef ENABLE_050_DMS_MODE + case 50: + max_bw_stopband = max_bw_stopband >> 1; + break; +# endif +# ifdef ENABLE_075_DMS_MODE + case 75: + max_bw_stopband = 3 * (max_bw_stopband >> 2); + break; +# endif + case 100: + break; + } + + h_DecSetup->spec_inv_idx = MAX(lastnz, max_bw_stopband); + } + + /* Cast from int to float */ + for (i = 0; i < decoder->yLen; i++) { + h_DecSetup->sqQdec_fl[i] = (LC3_FLOAT)sqQdec[i]; + } + } + + if (bfi != 1) + { + /* SNS Quantize Decoder */ + process_snsQuantizesScf_Dec(h_DecSetup->scf_idx, h_DecSetup->scf_q); + } + if (h_DecSetup->PlcAdvSetup) + { + processPlcComputeStabFacMain_fl(h_DecSetup->scf_q, h_DecSetup->PlcAdvSetup->scf_q_old, h_DecSetup->PlcAdvSetup->scf_q_old_old, bfi, h_DecSetup->PlcSetup.prevBfi, + h_DecSetup->PlcSetup.prevprevBfi, &h_DecSetup->PlcAdvSetup->stabFac); + } + + if ( bfi != 1 ) + { + stab_fac = 1; + if (h_DecSetup->PlcAdvSetup) + { + stab_fac = h_DecSetup->PlcAdvSetup->stabFac; + } + + /* Partial Concealment */ + processPcMain_fl(&bfi, decoder, h_DecSetup->sqQdec_fl, h_DecSetup, h_DecSetup->ltpf_param[0], stab_fac, gg_idx, h_DecSetup->quantizedGainOff, + fac_ns_idx, &h_DecSetup->statePC, h_DecSetup->spec_inv_idx, decoder->yLen); + } + + /* Decoding only if no bit error detected */ + if (bfi != 1) { + /* Residual decoding */ + if (residualPresent) { + processResidualDecoding_fl(&bitsRead, h_DecSetup->sqQdec_fl, decoder->yLen, h_DecSetup->resBits, + nbits_residual + , decoder->hrmode + ); + } + + + /* Noise filling */ + if (zero_frame == 0) { + processNoiseFilling_fl(h_DecSetup->sqQdec_fl, nf_seed, fac_ns_idx, decoder->cutoffBins[h_DecSetup->BW_cutoff_idx_nf], decoder->frame_dms, h_DecSetup->prev_fac_ns, h_DecSetup->spec_inv_idx); + } + + /* Application of global gain */ + processApplyGlobalGain_fl(h_DecSetup->sqQdec_fl, decoder->yLen, gg_idx, h_DecSetup->quantizedGainOff); + + /* TNS decoder */ + processTnsDecoder_fl(h_DecSetup->sqQdec_fl, h_DecSetup->tns_idx, tns_order, tns_numfilters, + decoder->cutoffBins[bw_cutoff_idx], h_DecSetup->N_red_tns, h_DecSetup->fs_red_tns); + + /* SNS interpolation */ + processSnsInterpolateScf_fl(h_DecSetup->scf_q, 0, decoder->bands_number, h_DecSetup->int_scf); + + /* MDCT shaping */ + processMdctShaping_fl(h_DecSetup->sqQdec_fl, h_DecSetup->int_scf, decoder->bands_offset, decoder->bands_number); + } + + /* PLC */ + processPlcMain_fl(h_DecSetup->sqQdec_fl, h_DecSetup->x_fl, decoder, h_DecSetup, bfi, h_DecSetup->PlcAdvSetup, &h_DecSetup->PlcSetup, + decoder->plcMeth, h_DecSetup->ltpf_mem_pitch, h_DecSetup->ltpf_mem_pitch_fr, decoder->tilt, decoder->bands_offset, + decoder->bands_number, decoder->bands_offsetPLC, decoder->n_bandsPLC, decoder->hrmode, &h_DecSetup->statePC); + + processPlcDampingScramblingMain_fl(&h_DecSetup->PlcNsSetup.seed, + &h_DecSetup->statePC.seed, h_DecSetup->statePC.ns_nbLostCmpt_pc, + h_DecSetup->PlcSetup.nbLostCmpt, &h_DecSetup->PlcAdvSetup->stabFac, + &h_DecSetup->PlcAdvSetup->cum_fading_slow, &h_DecSetup->PlcAdvSetup->cum_fading_fast, + h_DecSetup->PlcSetup.q_d_prev, h_DecSetup->sqQdec_fl, h_DecSetup->spec_inv_idx, decoder->yLen, bfi, + decoder->frame_dms, h_DecSetup->concealMethod, h_DecSetup->ltpf_mem_pitch, h_DecSetup->ltpf_param[0], + &h_DecSetup->PlcAdvSetup->cum_fflcAtten); + + /* IMDCT */ + if (h_DecSetup->concealMethod == 4 || bfi != 1 ) + { + ProcessingIMDCT_fl(h_DecSetup->sqQdec_fl, decoder->frame_length, decoder->imdct_win, decoder->imdct_winLen, decoder->imdct_laZeros, + h_DecSetup->imdct_mem, h_DecSetup->x_fl, &h_DecSetup->dct4structImdct); + } + + processPlcUpdate_fl(h_DecSetup->PlcAdvSetup + , decoder->frame_length, h_DecSetup->x_fl, h_DecSetup->scf_q, + &h_DecSetup->PlcSetup.nbLostCmpt, &h_DecSetup->PlcNsSetup.cum_alpha, bfi, &h_DecSetup->PlcSetup.prevBfi, &h_DecSetup->PlcSetup.prevprevBfi); + + /* LTPF decoder */ + process_ltpf_decoder_fl(h_DecSetup->x_fl, decoder->frame_length, h_DecSetup->x_fl, decoder->fs, + h_DecSetup->ltpf_mem_x, h_DecSetup->ltpf_mem_y, &h_DecSetup->ltpf_mem_pitch, + &h_DecSetup->ltpf_mem_pitch_fr, &h_DecSetup->ltpf_mem_gain, &h_DecSetup->ltpf_mem_beta_idx, + bfi, h_DecSetup->ltpf_param, h_DecSetup->ltpf_param_mem, h_DecSetup->ltpf_conf_beta_idx, + h_DecSetup->ltpf_conf_beta, h_DecSetup->concealMethod, h_DecSetup->alpha + , &h_DecSetup->ltpf_mem_active + ); + + { + /* Round, scale and copy output to output buffer */ + if (bps == 16) { + for (i = 0; i < decoder->frame_length; i++) { + LC3_FLOAT tmp = round(h_DecSetup->x_fl[i]); + ((int16_t*)s_out)[i] = (int16_t)fmaxf(fminf(tmp, 32767), -32768); + } + } else { + for (i = 0; i < decoder->frame_length; i++) { + LC3_FLOAT tmp = round(LC3_CONST_POW_2_23 * LC3_CONST_POW_2_M15 * h_DecSetup->x_fl[i]); + ((int32_t*)s_out)[i] = (int32_t)fmaxf(fminf(tmp, LC3_CONST_POW_2_23_RED), LC3_CONST_POW_2_23_NEG); + } + } + } + return bfi; +} + +LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num_bytes, void** output, LC3_INT32 bps, LC3_INT32 bfi_ext) +{ + LC3_INT32 ch, bfi, lc3_num_bytes; + LC3PLUS_Error err; + LC3_INT32 fec_num_bytes; + LC3_INT32 lc3_channel_num_bytes; + LC3_INT32 channel_bfi, out_bfi; + LC3PLUS_EpModeRequest channel_epmr; + + bfi = bfi_ext; + lc3_num_bytes = 0; + err = LC3PLUS_OK; + + if (bfi == 0) + { + bfi = !num_bytes; + } + + if (decoder->ep_enabled) + { + decoder->combined_channel_coding = decoder->channels > 1 && num_bytes <= 160; + + if (decoder->combined_channel_coding) + { + fec_num_bytes = num_bytes; + + decoder->error_report = + fec_decoder(input, fec_num_bytes, &lc3_num_bytes, (LC3PLUS_EpModeRequest*)&decoder->epmr, decoder->combined_channel_coding, + &decoder->n_pccw, &bfi, &decoder->be_bp_left, &decoder->be_bp_right, &decoder->n_pc, &decoder->m_fec); + + for (ch = 0; ch < decoder->channels; ch++) + { + lc3_channel_num_bytes = lc3_num_bytes / decoder->channels + (ch < (lc3_num_bytes % decoder->channels)); + + + if (bfi != 1 && lc3_channel_num_bytes != decoder->channel_setup[ch]->last_size) + { + err = update_dec_bitrate(decoder, ch, lc3_channel_num_bytes); + if (err) + { + bfi = 1; + decoder->last_error = err; + } + else + { + decoder->channel_setup[ch]->last_size = lc3_channel_num_bytes; + } + } + + bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi); + input += decoder->channel_setup[ch]->targetBytes; + } + } + else + { + decoder->epmr = LC3PLUS_EPMR_HIGH_NC; + out_bfi = 0; + + for (ch = 0; ch < decoder->channels; ch++) + { + fec_num_bytes = num_bytes / decoder->channels + (ch < (num_bytes % decoder->channels)); + + channel_bfi = bfi; + + decoder->error_report = fec_decoder(input, fec_num_bytes, &lc3_num_bytes, &channel_epmr, + decoder->combined_channel_coding, &decoder->n_pccw, &channel_bfi, + &decoder->be_bp_left, &decoder->be_bp_right, &decoder->n_pc, &decoder->m_fec); + + decoder->epmr = MIN((LC3PLUS_EpModeRequest) decoder->epmr, channel_epmr); + + +#ifdef ENABLE_PADDING + if (channel_bfi != 1) + { + LC3_INT32 padding_len = 0, np_zero = 0; + + if (paddingDec_fl(input, (lc3_num_bytes << 3), decoder->yLen, decoder->BW_cutoff_bits, decoder->ep_enabled, &padding_len, &np_zero)) + { + channel_bfi = 1; + } + + input = input + np_zero; + decoder->n_pc = MAX(decoder->n_pc - (2 * np_zero), 0); + + if (channel_bfi == 2) + { + if (decoder->be_bp_right < (8 * np_zero)) + { + channel_bfi = 0; + decoder->be_bp_left = -1; + decoder->be_bp_right = -1; + } + else + { + decoder->be_bp_right = decoder->be_bp_right - (8 * np_zero); + decoder->be_bp_left = MAX(decoder->be_bp_left - (8 * np_zero), 0); + } + } + lc3_num_bytes = lc3_num_bytes - padding_len; + } +#endif + + if (channel_bfi != 1 && lc3_num_bytes != decoder->channel_setup[ch]->last_size) + { + err = update_dec_bitrate(decoder, ch, lc3_num_bytes); + if (err) + { + channel_bfi = 1; + decoder->last_error = err; + } + else + { + decoder->channel_setup[ch]->last_size = lc3_num_bytes; + } + } + + channel_bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, channel_bfi); + + out_bfi |= channel_bfi; + input += fec_num_bytes; + } + + bfi = out_bfi & 1; + } + } + else + { + for (ch = 0; ch < decoder->channels; ch++) + { + lc3_num_bytes = num_bytes / decoder->channels + (ch < (num_bytes % decoder->channels)); + +#ifdef ENABLE_PADDING + if (bfi != 1) + { + LC3_INT32 padding_len = 0, np_zero = 0; + + if (paddingDec_fl(input, (lc3_num_bytes << 3), decoder->yLen, decoder->BW_cutoff_bits, decoder->ep_enabled, &padding_len, &np_zero)) + { + bfi = 1; + decoder->last_error = LC3PLUS_PADDING_ERROR; + } + + lc3_num_bytes = lc3_num_bytes - padding_len; + if (lc3_num_bytes < 20 || lc3_num_bytes > LC3PLUS_MAX_BYTES) + { + bfi = 1; /* mark frame as broken if frame size is below the minimum of 20 bytes or above the maximum of LC3PLUS_MAX_BYTES */ + decoder->last_error = FRAMESIZE_ERROR; + } + } +#endif + + if (bfi != 1 && lc3_num_bytes != decoder->channel_setup[ch]->last_size) + { + err = update_dec_bitrate(decoder, ch, lc3_num_bytes); + if (err) + { + bfi = 1; + decoder->last_error = err; + } + else + { + decoder->channel_setup[ch]->last_size = lc3_num_bytes; + } + } + + bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi); + input += decoder->channel_setup[ch]->targetBytes; + } + } + + if (decoder->last_error == LC3PLUS_OK && bfi) decoder->last_error = LC3PLUS_DECODE_ERROR; + return bfi == 1 ? LC3PLUS_DECODE_ERROR : LC3PLUS_OK; +} diff --git a/lc3plus/defines.h b/lc3plus/defines.h new file mode 100755 index 0000000000..d978fa4e15 --- /dev/null +++ b/lc3plus/defines.h @@ -0,0 +1,238 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef DEFINES_H +#define DEFINES_H + +#include "stdint.h" + + +typedef float LC3_FLOAT; +typedef int32_t LC3_INT; +typedef int16_t LC3_INT16; +typedef uint16_t LC3_UINT16; +typedef short LC3_SHORT; +typedef uint8_t LC3_UINT8; +typedef int8_t LC3_INT8; +typedef uint32_t LC3_UINT32; + +/* Release defines */ +// #define ENABLE_2_5MS_MODE +#define ENABLE_5MS_MODE +#define ENABLE_10_MS_MODE +#define ENABLE_ADVANCED_PLC_FL +#define ENABLE_ADVANCED_PLC_FL_DEFAULT +#define ENABLE_BW_CONTROLLER +//#define ENABLE_HR_MODE_FL +#define ENABLE_PADDING +#define ENABLE_RFRAME_FL +#define ENABLE_PLC +/* flags */ +#define ENABLE_PLC_MODE_FLAG +#define ENABLE_BANDWIDTH_FLAG +#define ENABLE_EP_MODE_FLAG +#define ENABLE_FRAME_MS_FLAG +#define ENABLE_HR_MODE_FL_FLAG + +#ifndef NO_POST_REL_CHANGES +/* Post-release non-bitexact changes */ + +#endif /* NO_POST_REL_CHANGES */ + +/* Precision Defines */ +#define LC3_FABS(x) (fabsf(x)) +#define LC3_POW(x, y) (powf(x, y)) +#define LC3_LOGTEN(x) (log10f(x)) +#define LC3_LOGTWO(x) (log2f(x)) +# define LC3_COS(x) (cos(x)) +# define LC3_SIN(x) (sin(x)) +#define LC3_SQRT(x) (sqrtf(x)) +#define LC3_EXP(x) (expf(x)) + +# define MAX_BR 320000 /* 400 * 800 */ +# define MIN_BR_100DMS 16000 /* 20 * 800 * 100/100 */ +# define MIN_BR_025DMS 64000 /* 20 * 800 * 100/ 25 */ +# define MIN_BR_050DMS 32000 /* 20 * 800 * 100/ 50 */ +# define MAX_BR_050DMS_NB 260800 /* 163 * 800 * 100/ 50 */ +# define MAX_BR_100DMS_NB 114400 /* for 100ms at 8kHz */ + +# define MAX_BR_100DMS_WB 221600 /* for 100ms at 16kHz */ +# define MAX_BR_100DMS_SSWB 314400 /* for 100ms at 24kHz */ + +typedef int32_t LC3_INT32; + +# if defined(__xtensa__) +# define ALIGNMENT_BALLOC 4 +# define ALIGNMENT_BALLOC_RED 3 +# else +# define ALIGNMENT_BALLOC 8 +# define ALIGNMENT_BALLOC_RED 7 +# endif + +# define PLC2_FADEOUT_IN_MS 30 +# define PHECU_FRES 62.5 +# define PHECU_C_JACOB 1.1429 +# define MAX_LGW 9 /* LGW48K + 1 !! */ +# define QUOT_LPR_LTR 4 +# define MAX_PLC_LPROT ((512 * 48) / 32) +# define MAX_PLC_NPLOCS ((MAX_PLC_LPROT / 4) + 1) +# define MAX_PLC_LMSPEC ((MAX_PLC_LPROT / 2) + 1) +# define MAX_PLC_LMEM (400) /* "only" up to 20kHz (400 MDCT bins at 10 ms) at 48 kHz supported by PhEcu */ + +# define POS_ONE_Q15 (32767.0 / 32768.0) +# define PHECU_LTOT_MIN_MAN 1 /* lowest possible mantissa energy value */ +# define PHECU_LTOT_MIN_EXP -61 /* L_tot = PHECU_LTOT_MIN_MAN*2^(PHECU_LTOT_MIN_EXP-31) */ +# define PHECU_LTOT_MIN +# define PHECU_GRP_SHAPE_INIT 0 /* BASOP Q15 */ +# define PHECU_ENV_STAB_LOCAL POS_ONE_Q15 +# define PHECU_DELTA_CORR 5 +# define PHECU_PFIND_SENS 0.93 +# define PHECU_LA 0 + +# define LC3_ROUND(x) (roundf(x)) +# define LC3_FLOOR(x) (floorf(x)) + +# define LC3_CONST_POW_2_16 65536 +# define LC3_CONST_POW_2_M16 1.525878906250000e-05 +# define LC3_CONST_POW_2_100 1.267650600228229e+30 + +# define MAX_LEN_PCM_PLC (MAX_PITCH + MAX_LEN) +# define MAX_PITCH CEILING((MAX_PITCH_12K8 * MAX_LEN * 100), 12800) +# define TDC_L_FIR_HP 11 +# define PLC3_HPBLENDTHROTTLE 30 /* higher numbers increase throttled blending from hp filtered to unfiltered uv excitation (0 is no throttle) */ + +# define PLC_FADEOUT_IN_MS 60 /* fade-out to zero in ms for TD-PLC and NS, minimum value is 20 */ +# define PLC4_TRANSIT_START_IN_MS 20 /* begin of transition time for noise substitution for voiced signals */ +# define PLC4_TRANSIT_END_IN_MS PLC_FADEOUT_IN_MS /* end of transition time for noise substitution */ +# define PLC34_ATTEN_FAC_100 0.5000 /* attenuation factor for NS and TDC @ 10 ms*/ +# define PLC34_ATTEN_FAC_050 0.7071 /* attenuation factor for NS and TDC @ 5.0 ms*/ +# define PLC34_ATTEN_FAC_025 0.8409 /* attenuation factor for NS and TDC @ 2.5 ms*/ + +# define FEC_SLOT_BYTES_MIN 40 +# define FEC_SLOT_BYTES_MAX 400 + + +# define LC3_CONST_POW_2_M15 3.051757812500000e-05 +# define LC3_CONST_POW_2_23 8388608 +# define LC3_CONST_POW_2_23_NEG -8388608 +# define LC3_CONST_POW_2_23_RED 8388607 + +# define LC3_CONST_POW_2_100 1.267650600228229e+30 + +/* G192 bitstream writing/reading */ +#define G192_REDUNDANCY_FRAME 0x6B22 +#define G192_GOOD_FRAME 0x6B21 +#define G192_BAD_FRAME 0x6B20 +#define G192_ZERO 0x007F +#define G192_ONE 0x0081 +#define READ_G192FER /* Allow C executable to also read G192 formatted FER files */ + +# define LC3_EPS (1.1e-7f) + +#define M_PI 3.14159265358979323846 + +/* FUNCTION MACROS */ +#define CEILING(x, y) (((x) + (y)-1) / (y)) +#define FRAME2FS_IDX(x) (x / 100) /* 80 -> 0, 160 -> 1, 240 -> 2, 320 -> 3, 480 -> 4*/ +#define FS2FS_IDX(x) \ + (x / 10000) /* 8000 -> 0, 16000 -> 1, 24000 -> 2, 32000 -> 3, 48000 -> 4 \ + */ +#define UNUSED(x) (void)(x) /* silence unused parameter warning */ +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define STATIC_ASSERTS(cond, s) typedef char assert_##s[(cond) ? 1 : -1] +#define STATIC_ASSERTI(cond, i) STATIC_ASSERTS(cond, i) +#define STATIC_ASSERT(cond) STATIC_ASSERTI(cond, __LINE__) + +/* For dynamic memory calculations */ +#define CODEC_FS(fs) ((fs) == 44100 ? 48000 : (fs)) +#define DYN_MAX_LEN(fs) MAX(CODEC_FS(fs) / 100, 160) +# define DYN_MAX_LEN_EXT(fs) MAX(CODEC_FS(fs) / 100, 160) /* extension to length 160 for NB(fs=8000) */ +#define DYN_MAX_MDCT_LEN(fs) (DYN_MAX_LEN(fs) - (180 * DYN_MAX_LEN(fs) / 480)) + +/* OPTIONS */ + +#define MAX_SR 96000 +#define EXT_RES_ITER_MAX 20 +#define MAX_BW_BANDS_NUMBER 6 +#define MAX_LEN MAX_SR/100 /* = 10ms at 96kHz */ +#define MAX_RESBITS 5000 +#define MAX_RESBITS_LEN ((MAX_RESBITS + 7)/8) + +#define MAX_CHANNELS 2 +#define MIN_NBYTES 20 /* 100dms: 16 kbps at !=44.1kHz, 14.7kbps at 44.1kHz + 50dms: 32 kbps at !=44.1kHz, 29.4kbps at 44.1kHz + 25dms: 64 kbps at !=44.1kHz, 58.8kbps at 44.1kHz */ +#define MAX_NBYTES_025 100 /* any dms: 320 kbps at !=44.1kHz, 294 kbps at 44.1kHz */ +#define MAX_NBYTES_050 200 /* any dms: 320 kbps at !=44.1kHz, 294 kbps at 44.1kHz */ +#define MAX_NBYTES_100 400 /* any dms: 320 kbps at !=44.1kHz, 294 kbps at 44.1kHz */ + +#ifdef ENABLE_HR_MODE_FL +# define MIN_BR_25MS_48KHZ_HR ((int)172800/3200/2)*3200 +# define MIN_BR_25MS_96KHZ_HR ((int)198400/3200/2)*3200 +# define MIN_BR_50MS_48KHZ_HR ((int)148800/1600/2)*1600 +# define MIN_BR_50MS_96KHZ_HR ((int)174400/1600/2)*1600 +# define MIN_BR_100MS_48KHZ_HR ((int)124800/800/2)*800 +# define MIN_BR_100MS_96KHZ_HR ((int)149600/800/2)*800 +#endif /* ENABLE_HR_MODE */ +#define MAX_NBYTES2 625 +#define BYTESBUFSIZE (MAX_NBYTES2 * MAX_CHANNELS) +#define MAX_BW_BIN 400 +#if MAX_BW_BIN > MAX_LEN +# define MAX_BW MAX_LEN +#else +# define MAX_BW MAX_BW_BIN +#endif + +# ifdef ENABLE_HR_MODE_FL +# define MAX_BW_HR 960 +# endif + +/* SCF */ +#define M 16 +#define MAX_BANDS_NUMBER 64 +#define MAX_BANDS_NUMBER_PLC 80 +#define PVQ_MAX_VEC_SIZE M + +/* PVQ VQ setup */ +#define SCF_MAX_PARAM \ + 7 /* (L+H) + submode_MSB +gain+(Ia_leads+Ia_mpvq)+(Ib_joint_mpvq), \ + submode-LSB */ + +/* RESIDUAL CODING */ +#define NPRM_RESQ 5 * MAX_LEN + +/* MDCT */ +#define MDCT_MEM_LEN_MAX (MAX_LEN - ((180 * MAX_LEN) / 480)) + +/* TNS */ +#define TNS_NUMFILTERS_MAX 2 +#define MAXLAG 8 + +/* OLPA/LTPF */ +#define LEN_12K8 128 +#define LEN_6K4 64 +#define MIN_PITCH_6K4 17 +#define MAX_PITCH_6K4 114 +#define RANGE_PITCH_6K4 98 +#define MIN_PITCH_12K8 32 +#define MAX_PITCH_12K8 228 +#define RES2_PITCH_12K8 157 +#define RES4_PITCH_12K8 127 +#define LTPF_MEMIN_LEN (MAX_PITCH_12K8 + 4) + +/* Advanced PLC */ + + + +/* some configurations leave empty translation units. */ +extern int fix_empty_translation_unit_warning; + +#endif diff --git a/lc3plus/detect_cutoff_warped.c b/lc3plus/detect_cutoff_warped.c new file mode 100755 index 0000000000..9392867208 --- /dev/null +++ b/lc3plus/detect_cutoff_warped.c @@ -0,0 +1,84 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) +{ + const LC3_INT *warp_idx_start = NULL, *warp_idx_stop = NULL; + LC3_INT counter = 0, brickwall = 0, i = 0, stop = 0, dist = 0; + LC3_FLOAT d2_mean = 0, d2_sum = 0, e_diff = 0, thr = 0; + const LC3_INT *bw_dist = NULL; + + warp_idx_start = BW_warp_idx_start_all[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all[fs_idx - 1]; + + switch (frame_dms) + { + case 25: + warp_idx_start = BW_warp_idx_start_all_2_5ms[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all_2_5ms[fs_idx - 1]; + bw_dist = brickwall_dist; + break; + case 50: + warp_idx_start = BW_warp_idx_start_all_5ms[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all_5ms[fs_idx - 1]; + bw_dist = brickwall_dist; + break; + case 100: + warp_idx_start = BW_warp_idx_start_all[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all[fs_idx - 1]; + bw_dist = brickwall_dist; + break; + } + + counter = fs_idx; + + d2_sum = sum_vec(&d2[warp_idx_start[counter - 1]], warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + + d2_mean = d2_sum / (warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + + while (d2_mean < threshold_quiet[counter - 1]) { + d2_sum = 0; + counter--; + if (counter == 0) { + break; + } + + /* calculate mean energy per band */ + d2_sum = + sum_vec(&d2[warp_idx_start[counter - 1]], warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + + d2_mean = d2_sum / (warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + } + + *bw_idx = counter; + + /* check if energy difference between bands is present */ + if (*bw_idx < fs_idx) { + thr = (LC3_FLOAT)threshold_brickwall[counter]; + stop = warp_idx_start[counter]; + dist = bw_dist[counter]; + + for (i = stop; i >= stop - dist; i--) { + e_diff = 10.0 * LC3_LOGTEN(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOGTEN(d2[i + 1] + FLT_EPSILON); + + if (e_diff > thr) { + brickwall = 1; + break; + } + } + + if (brickwall == 0) { + *bw_idx = fs_idx; + } + } +} diff --git a/lc3plus/enc_entropy.c b/lc3plus/enc_entropy.c new file mode 100755 index 0000000000..a7ff8cd700 --- /dev/null +++ b/lc3plus/enc_entropy.c @@ -0,0 +1,126 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, + LC3_INT bw_cutoff_idx, LC3_INT lastnz, LC3_INT N, LC3_INT lsbMode, LC3_INT gg_idx, LC3_INT num_tns_filters, + LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* scf_idx, LC3_INT fac_ns_idx + , LC3_INT bfi_ext, LC3_INT fs_idx + ) +{ + LC3_UINT8* ptr; + LC3_INT i = 0, submodeMSB = 0, submodeLSB = 0, tmp = 0, gainMSB = 0, gainLSB = 0; + LC3_INT gainMSBbits[4] = {1, 1, 2, 2}, gainLSBbits[4] = {0, 1, 0, 1}; + + LC3_INT16 lastnzTrigger[5] = {63, 127, 127, 255, 255}; + + *bp_side = numbytes - 1; + *mask_side = 1; + ptr = bytes; + + /* Bandwidth */ + if (bw_cutoff_bits > 0) { + write_uint_backward_fl(ptr, bp_side, mask_side, bw_cutoff_idx, bw_cutoff_bits); + } + + /* Last non zero touple */ + if (bfi_ext == 1) { + write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOGTWO(N >> 1))); + } + else + { + write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOGTWO(N / 2))); + } + + /* LSB mode bit */ + write_bit_backward_fl(ptr, bp_side, mask_side, lsbMode); + + /* Global gain */ + write_uint_backward_fl(ptr, bp_side, mask_side, gg_idx, 8); + + /* TNS activation flag */ + for (i = 0; i < num_tns_filters; i++) { + write_bit_backward_fl(ptr, bp_side, mask_side, MIN(1, tns_order[i])); + } + + /* LTPF activation flag */ + write_bit_backward_fl(ptr, bp_side, mask_side, ltpf_idx[0]); + + /* SNS-VQ 1st stage */ + write_uint_backward_fl(ptr, bp_side, mask_side, scf_idx[0], 5); + write_uint_backward_fl(ptr, bp_side, mask_side, scf_idx[1], 5); + + /* SNS-VQ 2nd stage side-info (3-4 bits) */ + submodeMSB = scf_idx[2] / 2; + submodeLSB = scf_idx[2] & 1; + write_bit_backward_fl(ptr, bp_side, mask_side, submodeMSB); + gainMSB = scf_idx[3] >> (gainLSBbits[scf_idx[2]]); + gainLSB = scf_idx[3] & 1; + write_uint_backward_fl(ptr, bp_side, mask_side, gainMSB, gainMSBbits[scf_idx[2]]); + write_bit_backward_fl(ptr, bp_side, mask_side, scf_idx[4]); + + /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + if (submodeMSB == 0) { + if (submodeLSB == 0) { + tmp = scf_idx[6] + 2; + } else { + tmp = gainLSB; + } + + tmp = tmp * 2390004 + scf_idx[5]; + write_uint_backward_fl(ptr, bp_side, mask_side, tmp, 25); + } else { + tmp = scf_idx[5]; + + if (submodeLSB != 0) { + tmp = 2 * tmp + gainLSB + 15158272; + } + + write_uint_backward_fl(ptr, bp_side, mask_side, tmp, 24); + } + + /* LTPF data */ + if (ltpf_idx[0] == 1) { + write_uint_backward_fl(ptr, bp_side, mask_side, ltpf_idx[1], 1); + write_uint_backward_fl(ptr, bp_side, mask_side, ltpf_idx[2], 9); + } + + /* Noise factor */ + write_uint_backward_fl(ptr, bp_side, mask_side, fac_ns_idx, 3); +} + +void write_uint_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT val, LC3_INT numbits) +{ + LC3_INT k = 0, bit = 0; + + for (k = 0; k < numbits; k++) { + bit = val & 1; + write_bit_backward_fl(ptr, bp_side, mask_side, bit); + val = val / 2; + } +} + +void write_bit_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT bit) +{ + if (bit == 0) { + ptr[*bp_side] = ptr[*bp_side] & (255 - *mask_side); + } else { + ptr[*bp_side] = ptr[*bp_side] | *mask_side; + } + + if (*mask_side == 128) { + *mask_side = 1; + *bp_side = *bp_side - 1; + } else { + *mask_side = *mask_side * 2; + } +} diff --git a/lc3plus/enc_lc3_fl.c b/lc3plus/enc_lc3_fl.c new file mode 100755 index 0000000000..c89f7244ca --- /dev/null +++ b/lc3plus/enc_lc3_fl.c @@ -0,0 +1,270 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps +, LC3_INT32 bfi_ext +) +{ + EncSetup* h_EncSetup; + + LC3_INT s_12k8_len = 0, T0_out = 0, ltpfBits = 0, BW_cutoff_idx = 0, tns_numfilters = 0, quantizedGain = 0, + quantizedGainMin = 0, nbits = 0, nbits2 = 0, lastnz = 0, lsbMode = 0, gainChange = 0, bp_side = 0, + mask_side = 0, fac_ns_idx = 0, numResBits = 0, tns_order[2] = {0}, i = 0; + LC3_FLOAT normcorr = 0, gain = 0; + + + LC3_FLOAT d_fl[MAX_LEN] = {0}; + LC3_INT q_d[MAX_LEN] = {0}; + LC3_INT indexes[TNS_NUMFILTERS_MAX * MAXLAG] = {0}; + + h_EncSetup = encoder->channel_setup[channel]; + memset(bytes, 0, sizeof(uint8_t) * h_EncSetup->targetBytes); + + if (bps == 24) { + for (i = 0; i < encoder->frame_length; i++) { + int32_t tmp = ((int32_t*)s_in)[i]; + + if (tmp >= 0) + { + tmp = tmp & 0x007fffff; + } + else + { + tmp = tmp | (int32_t)0xff800000; + } + + h_EncSetup->s_in_scaled[i] = ((LC3_FLOAT) tmp / (float) LC3_POW(2, 8)); + } + } else if (bps == 16) { + for (i = 0; i < encoder->frame_length; i++) { + h_EncSetup->s_in_scaled[i] = (LC3_FLOAT)((int16_t*)s_in)[i]; + } + } + + /* MDCT */ + processMdct_fl(h_EncSetup->s_in_scaled, d_fl, &h_EncSetup->mdctStruct); + + /* 12.8 kHz resampler */ + process_resamp12k8_fl(h_EncSetup->s_in_scaled, encoder->frame_length, h_EncSetup->r12k8_mem_in, + encoder->r12k8_mem_in_len, h_EncSetup->r12k8_mem_50, h_EncSetup->r12k8_mem_out, + encoder->r12k8_mem_out_len, h_EncSetup->s_12k8, &s_12k8_len, encoder->fs_idx, + encoder->frame_dms, encoder->fs); + + /* Pitch estimation */ + processOlpa_fl(h_EncSetup->s_12k8, h_EncSetup->olpa_mem_s12k8, h_EncSetup->olpa_mem_s6k4, + &h_EncSetup->olpa_mem_pitch, &T0_out, &normcorr, s_12k8_len, encoder->frame_dms); + + /* LTPF encoder */ + process_ltpf_coder_fl(h_EncSetup->s_12k8, s_12k8_len + 1, h_EncSetup->ltpf_enable, T0_out, normcorr, + encoder->frame_dms, h_EncSetup->ltpf_mem_in, encoder->ltpf_mem_in_len, + &h_EncSetup->ltpf_mem_normcorr, &h_EncSetup->ltpf_mem_ltpf_on, + &h_EncSetup->ltpf_mem_pitch, h_EncSetup->ltpf_param, &h_EncSetup->ltpf_mem_mem_normcorr, + <pfBits); + + /* Attack detector */ + attack_detector_fl(h_EncSetup->s_in_scaled, encoder->frame_length, encoder->fs, &h_EncSetup->attdec_position, + &h_EncSetup->attdec_acc_energy, &h_EncSetup->attdec_detected, h_EncSetup->attdec_filter_mem, + h_EncSetup->attack_handling, encoder->attdec_nblocks, encoder->attdec_hangover_thresh); + + /* Per-band energy */ + processPerBandEnergy_fl(encoder->bands_number, encoder->bands_offset, encoder->hrmode, encoder->frame_dms, h_EncSetup->ener, d_fl); + /* Near Nyquist detector */ + processNearNyquistdetector_fl(&encoder->near_nyquist_flag, encoder->fs_idx, encoder->near_nyquist_index, encoder->bands_number, h_EncSetup->ener); + + /* Disable LTPF if nyquist detector triggers or -lfe mode is active*/ + if (encoder->near_nyquist_flag != 0 || h_EncSetup->lfe == 1) + { + h_EncSetup->ltpf_mem_ltpf_on = 0; + h_EncSetup->ltpf_param[1] = 0; + } + + /* Bandwidth cut-off detection */ + if (h_EncSetup->lfe == 0) { + /* No BW Cutoff for 8 kHz and 96 kHz. No detection if bandwidth controller is active */ + if (encoder->fs_idx > 0 && encoder->hrmode == 0 && encoder->bw_ctrl_active == 0) { + processDetectCutoffWarped_fl(h_EncSetup->ener, encoder->fs_idx, encoder->frame_dms, &BW_cutoff_idx); + } else { + BW_cutoff_idx = encoder->fs_idx; + } + } else { + BW_cutoff_idx = 0; + } + + processSnsComputeScf_fl(h_EncSetup->ener, encoder->tilt, encoder->bands_number, h_EncSetup->scf, + h_EncSetup->attdec_detected, encoder->sns_damping, encoder->attdec_damping); + + /* SNS Quantizer */ + process_snsQuantizesScf_Enc(h_EncSetup->scf, h_EncSetup->L_scf_idx, h_EncSetup->scf_q, h_EncSetup->dct2StructSNS); + + /* SNS Interpolation */ + processSnsInterpolateScf_fl(h_EncSetup->scf_q, 1, encoder->bands_number, h_EncSetup->int_scf); + + /* MDCT shaping */ + processMdctShaping_fl(d_fl, h_EncSetup->int_scf, encoder->bands_offset, encoder->bands_number); + + /* Bandwidth controller */ + if (encoder->bandwidth < encoder->fs / 2) { + process_cutoff_bandwidth(d_fl, encoder->yLen, encoder->bw_ctrl_cutoff_bin); + BW_cutoff_idx = MIN(BW_cutoff_idx, encoder->bw_index); + } + + /* TNS encoder */ + if (h_EncSetup->lfe == 0) + { + processTnsCoder_fl(d_fl, BW_cutoff_idx, encoder->cutoffBins[BW_cutoff_idx], encoder->fs, encoder->frame_length, + encoder->frame_dms, h_EncSetup->total_bits, tns_order, indexes, &tns_numfilters, + &(h_EncSetup->tns_bits) + , encoder->near_nyquist_flag + ); + } + else + { + tns_numfilters = 1; + tns_order[0] = 0; + h_EncSetup->tns_bits = tns_numfilters; + } + /* Global Gain Estimation */ + h_EncSetup->targetBitsQuant = h_EncSetup->targetBitsInit - (h_EncSetup->tns_bits + ltpfBits); + + if (h_EncSetup->targetBitsQuant < 0 && ltpfBits > 1) + { + /* Disable LTPF */ + h_EncSetup->ltpf_mem_ltpf_on = 0; + h_EncSetup->ltpf_param[1] = 0; + ltpfBits = 1; + h_EncSetup->targetBitsQuant = h_EncSetup->targetBitsInit - (h_EncSetup->tns_bits + ltpfBits); + } + + processEstimateGlobalGain_fl(d_fl, encoder->yLen, h_EncSetup->targetBitsQuant, &gain, &quantizedGain, + &quantizedGainMin, h_EncSetup->quantizedGainOff, &h_EncSetup->targetBitsOff, + &h_EncSetup->mem_targetBits, h_EncSetup->mem_specBits + , encoder->hrmode, h_EncSetup->regBits, encoder->frame_ms + + ); + + /* 1. Quantization */ + processQuantizeSpec_fl(d_fl, gain, q_d, encoder->yLen, h_EncSetup->total_bits, &nbits, &nbits2, encoder->fs, + &lastnz, h_EncSetup->codingdata, &lsbMode, -1, h_EncSetup->targetBitsQuant, encoder->hrmode + ); + + h_EncSetup->mem_specBits = nbits; + + /* Global Gain Adjustment */ + processAdjustGlobalGain_fl(&quantizedGain, quantizedGainMin, h_EncSetup->quantizedGainOff, &gain, + h_EncSetup->targetBitsQuant, h_EncSetup->mem_specBits, &gainChange, encoder->fs_idx + , encoder->hrmode, encoder->frame_dms + ); + + /* 2. Quantization */ + if (gainChange) { + processQuantizeSpec_fl(d_fl, gain, q_d, encoder->yLen, h_EncSetup->total_bits, &nbits, &nbits2, encoder->fs, + &lastnz, + h_EncSetup->codingdata, + &lsbMode, 0, h_EncSetup->targetBitsQuant + , encoder->hrmode + ); + } + + /* Noise factor */ + if (h_EncSetup->lfe == 0) + { + processNoiseFactor_fl(&fac_ns_idx, d_fl, q_d, gain, encoder->cutoffBins[BW_cutoff_idx], encoder->frame_dms, + h_EncSetup->targetBytes + ); + } + else + { + fac_ns_idx = 7; + } + /* Residual Coding */ + if (lsbMode == 0) { + processResidualCoding_fl(d_fl, q_d, gain, encoder->yLen, h_EncSetup->targetBitsQuant, nbits2, + h_EncSetup->resBits, &numResBits + , encoder->hrmode + ); + } else { + numResBits = 0; + } + + /* Entropy encoding */ + processEncoderEntropy_fl(bytes, &bp_side, &mask_side, h_EncSetup->targetBytes, encoder->BW_cutoff_bits, + BW_cutoff_idx, lastnz, encoder->yLen, lsbMode, quantizedGain, tns_numfilters, tns_order, + h_EncSetup->ltpf_param, h_EncSetup->L_scf_idx, fac_ns_idx + , bfi_ext, encoder->fs_idx + ); + + /* Artithmetic encoding */ + processAriEncoder_fl(bytes, bp_side, mask_side, q_d, tns_order, tns_numfilters, indexes, lastnz, + h_EncSetup->codingdata, + h_EncSetup->resBits, numResBits, lsbMode, h_EncSetup->targetBitsAri, + h_EncSetup->enable_lpc_weighting); + + if (encoder->combined_channel_coding == 0 && h_EncSetup->n_pc > 0) + { + LC3_INT32 xbuf[MAX_LEN] = {0}, nf_seed, tns_idx[M], zero_frame, nbits_residual, residualPresent, b_left, spec_inv_idx; + + memset(h_EncSetup->resBits, 0, sizeof(*(h_EncSetup->resBits)) * MAX_RESBITS_LEN); + + processAriDecoder_fl(bytes, bp_side, mask_side, encoder->yLen, encoder->fs_idx, h_EncSetup->enable_lpc_weighting, + tns_numfilters, lsbMode, lastnz, &bfi_ext, tns_order, fac_ns_idx, quantizedGain, + h_EncSetup->resBits, xbuf, &nf_seed, tns_idx, &zero_frame, h_EncSetup->targetBytes, &nbits_residual, + &residualPresent, encoder->frame_dms, h_EncSetup->n_pc, 0, h_EncSetup->total_bits >> 3, 1, &b_left, + &spec_inv_idx, encoder->hrmode); + + processReorderBitstream_fl(bytes, h_EncSetup->n_pccw, h_EncSetup->n_pc, b_left, h_EncSetup->targetBytes); + } + +} + +int Enc_LC3PLUS_fl(LC3PLUS_Enc* encoder, void** input, uint8_t* output, int bps +, LC3_INT32 bfi_ext +) +{ + int ch = 0, output_size = 0; + uint8_t* lc3buf = output; + + LC3_INT32 totalBytes; + LC3_INT32 output_size2, input_size; + + totalBytes = encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in); + + for (ch = 0; ch < encoder->channels; ch++) + { + Enc_LC3PLUS_Channel_fl(encoder, ch, input[ch], lc3buf, bps, bfi_ext); + if (encoder->epmode && encoder->combined_channel_coding == 0) + { + output_size2 = totalBytes / encoder->channels + (ch < (totalBytes % encoder->channels)); + + fec_encoder(encoder->epmode, encoder->epmr, lc3buf, encoder->channel_setup[ch]->targetBytes, output_size2, + encoder->channel_setup[ch]->n_pccw); + + lc3buf += output_size2; + output_size += output_size2; + } + else + { + lc3buf += encoder->channel_setup[ch]->targetBytes; + output_size += encoder->channel_setup[ch]->targetBytes; + } + } + + if (encoder->epmode > 0 && encoder->combined_channel_coding) + { + input_size = output_size; + output_size = encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in); + + fec_encoder(encoder->epmode, encoder->epmr, output, input_size, output_size, encoder->channel_setup[0]->n_pccw); + } + + return output_size; +} diff --git a/lc3plus/estimate_global_gain.c b/lc3plus/estimate_global_gain.c new file mode 100755 index 0000000000..df9b1f5f23 --- /dev/null +++ b/lc3plus/estimate_global_gain.c @@ -0,0 +1,128 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processEstimateGlobalGain_fl(LC3_FLOAT x[], LC3_INT lg, LC3_INT nbitsSQ, LC3_FLOAT* gain, LC3_INT* quantizedGain, + LC3_INT* quantizedGainMin, LC3_INT quantizedGainOff, LC3_FLOAT* targetBitsOff, + LC3_INT* old_targetBits, LC3_INT old_specBits + , LC3_INT hrmode , LC3_INT regBits, LC3_FLOAT frame_ms +) +{ + + LC3_INT i = 0, N = 0, offset = 0, j = 0, iszero = 0; + LC3_FLOAT g_min = 0, x_max = 0, tmp = 0, ind = 0, ind_min = 0, target = 0, fac = 0, ener = 0; + LC3_FLOAT en[MAX_LEN / 4] = {0}; + LC3_FLOAT reg_val = 4.656612873077393e-10; + + if (*old_targetBits < 0) { + *targetBitsOff = 0; + } else { + tmp = MIN(40, MAX(-40, *targetBitsOff + *old_targetBits - old_specBits)); + *targetBitsOff = 0.8 * *targetBitsOff + 0.2 * tmp; + } + + *old_targetBits = nbitsSQ; + nbitsSQ = nbitsSQ + round(*targetBitsOff); + + x_max = array_max_abs(x, lg); + + if (hrmode && regBits > 0) + { + LC3_FLOAT M0 = 1e-5, M1 = 1e-5, rB_offset; + LC3_FLOAT thresh = 2*frame_ms; + for (i = 0; i < lg; i++) + { + M0 += fabs(x[i]); + M1 += i*fabs(x[i]); + } + + rB_offset = 8 * (1 - MIN(M1/M0, thresh) / thresh); + reg_val = x_max * LC3_POW(2,-regBits - rB_offset); + } + + if (x_max < LC3_EPS) + { + ind_min = quantizedGainOff; + ind = 0; + *old_targetBits = -1; + } else { + if (hrmode == 1) { + g_min = x_max / (32768 * 256 - 2); + } else { + g_min = x_max / (32767 - 0.375); + } + /* Prevent positive rounding errors from LC3_LOGTEN function */ + ind_min = 28.0 * LC3_LOGTEN(g_min); + + ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS); + + assert(LC3_POW(10, ind_min / 28.0) >= g_min); + assert(ind_min <= (255 + quantizedGainOff)); + + N = lg; + + j = 0; + for (i = 0; i < N; i = i + 4) { + tmp = x[i] * x[i]; + tmp += x[i + 1] * x[i + 1]; + tmp += x[i + 2] * x[i + 2]; + tmp += x[i + 3] * x[i + 3]; + en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOGTEN(tmp + reg_val)); + j++; + } + + target = (28.0 / 20.0) * (1.4) * nbitsSQ; + fac = 256; + offset = 255 + quantizedGainOff; + + for (i = 0; i < 8; i++) { + fac = fac * 0.5; + offset = offset - fac; + ener = 0; + iszero = 1; + + for (j = N / 4 - 1; j >= 0; j--) { + tmp = en[j] - offset; + + if (tmp < (7.0) * (28.0 / 20.0)) { + if (iszero == 0) { + ener = ener + (2.7) * (28.0 / 20.0); + } + } else { + if (tmp > (50.0) * (28.0 / 20.0)) { + ener = ener + 2.0 * tmp - (50.0) * (28.0 / 20.0); + } else { + ener = ener + tmp; + } + + iszero = 0; + } + } + + if (ener > target && iszero == 0) { + offset = offset + fac; + } + } + + if (offset < ind_min) { + *old_targetBits = -1; + } + + ind = MAX(ind_min, offset) - quantizedGainOff; + } + + *quantizedGainMin = ind_min; + *quantizedGain = ind; + + *gain = LC3_POW(10.0, ((ind + quantizedGainOff) / 28.0)); +} diff --git a/lc3plus/fft/cfft.c b/lc3plus/fft/cfft.c new file mode 100755 index 0000000000..4bd8d29ade --- /dev/null +++ b/lc3plus/fft/cfft.c @@ -0,0 +1,421 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "cfft.h" +#include "iisfft.h" /* for M_PIl */ +#include /* for abs() */ +#include + +#define MAX_FFT_SIZE 1024 +#define MAX_TRIGDATA_SIZE (MAX_FFT_SIZE / 2) + +/** + * \brief table aTrigData + + Generate table: aTrigData[i] = sin( pi * i / (2*MAX_TRIGDATA_SIZE) ); i = 0, ... MAX_TRIGDATA_SIZE + */ +static const LC3_FLOAT static_table[MAX_TRIGDATA_SIZE + 1] = { + 0.0000000000e+000, 3.0679567717e-003, 6.1358846724e-003, 9.2037543654e-003, 1.2271538377e-002, 1.5339205973e-002, + 1.8406730145e-002, 2.1474080160e-002, 2.4541229010e-002, 2.7608145028e-002, 3.0674804002e-002, 3.3741172403e-002, + 3.6807224154e-002, 3.9872925729e-002, 4.2938258499e-002, 4.6003181487e-002, 4.9067676067e-002, 5.2131704986e-002, + 5.5195245892e-002, 5.8258265257e-002, 6.1320737004e-002, 6.4382627606e-002, 6.7443922162e-002, 7.0504575968e-002, + 7.3564566672e-002, 7.6623864472e-002, 7.9682439566e-002, 8.2740262151e-002, 8.5797309875e-002, 8.8853552938e-002, + 9.1908954084e-002, 9.4963498414e-002, 9.8017141223e-002, 1.0106986016e-001, 1.0412163287e-001, 1.0717242211e-001, + 1.1022220552e-001, 1.1327095330e-001, 1.1631862819e-001, 1.1936521530e-001, 1.2241067737e-001, 1.2545497715e-001, + 1.2849810719e-001, 1.3154003024e-001, 1.3458070159e-001, 1.3762012124e-001, 1.4065824449e-001, 1.4369502664e-001, + 1.4673046768e-001, 1.4976453781e-001, 1.5279719234e-001, 1.5582840145e-001, 1.5885815024e-001, 1.6188639402e-001, + 1.6491311789e-001, 1.6793829203e-001, 1.7096188664e-001, 1.7398387194e-001, 1.7700421810e-001, 1.8002289534e-001, + 1.8303988874e-001, 1.8605515361e-001, 1.8906866014e-001, 1.9208039343e-001, 1.9509032369e-001, 1.9809840620e-001, + 2.0110464096e-001, 2.0410896838e-001, 2.0711137354e-001, 2.1011184156e-001, 2.1311031282e-001, 2.1610680223e-001, + 2.1910123527e-001, 2.2209362686e-001, 2.2508391738e-001, 2.2807207704e-001, 2.3105810583e-001, 2.3404195905e-001, + 2.3702360690e-001, 2.4000301957e-001, 2.4298018217e-001, 2.4595504999e-001, 2.4892760813e-001, 2.5189781189e-001, + 2.5486564636e-001, 2.5783109665e-001, 2.6079410315e-001, 2.6375466585e-001, 2.6671275496e-001, 2.6966831088e-001, + 2.7262136340e-001, 2.7557182312e-001, 2.7851969004e-001, 2.8146493435e-001, 2.8440752625e-001, 2.8734746575e-001, + 2.9028466344e-001, 2.9321914911e-001, 2.9615089297e-001, 2.9907983541e-001, 3.0200594664e-001, 3.0492922664e-001, + 3.0784964561e-001, 3.1076714396e-001, 3.1368175149e-001, 3.1659337878e-001, 3.1950202584e-001, 3.2240769267e-001, + 3.2531028986e-001, 3.2820984721e-001, 3.3110630512e-001, 3.3399966359e-001, 3.3688986301e-001, 3.3977687359e-001, + 3.4266072512e-001, 3.4554132819e-001, 3.4841868281e-001, 3.5129275918e-001, 3.5416352749e-001, 3.5703095794e-001, + 3.5989505053e-001, 3.6275571585e-001, 3.6561298370e-001, 3.6846682429e-001, 3.7131720781e-001, 3.7416407466e-001, + 3.7700742483e-001, 3.7984719872e-001, 3.8268342614e-001, 3.8551604748e-001, 3.8834503293e-001, 3.9117038250e-001, + 3.9399203658e-001, 3.9680999517e-001, 3.9962419868e-001, 4.0243464708e-001, 4.0524131060e-001, 4.0804415941e-001, + 4.1084316373e-001, 4.1363832355e-001, 4.1642954946e-001, 4.1921690106e-001, 4.2200025916e-001, 4.2477968335e-001, + 4.2755508423e-001, 4.3032649159e-001, 4.3309381604e-001, 4.3585708737e-001, 4.3861624599e-001, 4.4137126207e-001, + 4.4412213564e-001, 4.4686883688e-001, 4.4961133599e-001, 4.5234957337e-001, 4.5508357882e-001, 4.5781329274e-001, + 4.6053871512e-001, 4.6325978637e-001, 4.6597650647e-001, 4.6868881583e-001, 4.7139674425e-001, 4.7410020232e-001, + 4.7679921985e-001, 4.7949376702e-001, 4.8218378425e-001, 4.8486924171e-001, 4.8755016923e-001, 4.9022647738e-001, + 4.9289819598e-001, 4.9556526542e-001, 4.9822765589e-001, 5.0088536739e-001, 5.0353837013e-001, 5.0618666410e-001, + 5.0883013010e-001, 5.1146882772e-001, 5.1410275698e-001, 5.1673179865e-001, 5.1935601234e-001, 5.2197527885e-001, + 5.2458965778e-001, 5.2719914913e-001, 5.2980363369e-001, 5.3240311146e-001, 5.3499764204e-001, 5.3758704662e-001, + 5.4017144442e-001, 5.4275077581e-001, 5.4532498121e-001, 5.4789406061e-001, 5.5045795441e-001, 5.5301672220e-001, + 5.5557024479e-001, 5.5811852217e-001, 5.6066155434e-001, 5.6319934130e-001, 5.6573182344e-001, 5.6825894117e-001, + 5.7078075409e-001, 5.7329714298e-001, 5.7580816746e-001, 5.7831376791e-001, 5.8081394434e-001, 5.8330863714e-001, + 5.8579784632e-001, 5.8828157187e-001, 5.9075969458e-001, 5.9323227406e-001, 5.9569931030e-001, 5.9816068411e-001, + 6.0061645508e-001, 6.0306662321e-001, 6.0551106930e-001, 6.0794979334e-001, 6.1038279533e-001, 6.1281007528e-001, + 6.1523157358e-001, 6.1764729023e-001, 6.2005722523e-001, 6.2246125937e-001, 6.2485951185e-001, 6.2725180387e-001, + 6.2963825464e-001, 6.3201874495e-001, 6.3439327478e-001, 6.3676184416e-001, 6.3912445307e-001, 6.4148104191e-001, + 6.4383155107e-001, 6.4617604017e-001, 6.4851438999e-001, 6.5084666014e-001, 6.5317285061e-001, 6.5549284220e-001, + 6.5780669451e-001, 6.6011434793e-001, 6.6241580248e-001, 6.6471099854e-001, 6.6699993610e-001, 6.6928261518e-001, + 6.7155897617e-001, 6.7382901907e-001, 6.7609268427e-001, 6.7835003138e-001, 6.8060100079e-001, 6.8284553289e-001, + 6.8508368731e-001, 6.8731534481e-001, 6.8954056501e-001, 6.9175922871e-001, 6.9397145510e-001, 6.9617712498e-001, + 6.9837623835e-001, 7.0056879520e-001, 7.0275473595e-001, 7.0493406057e-001, 7.0710676908e-001, 7.0927280188e-001, + 7.1143221855e-001, 7.1358484030e-001, 7.1573084593e-001, 7.1787005663e-001, 7.2000253201e-001, 7.2212821245e-001, + 7.2424709797e-001, 7.2635912895e-001, 7.2846436501e-001, 7.3056274652e-001, 7.3265427351e-001, 7.3473888636e-001, + 7.3681658506e-001, 7.3888731003e-001, 7.4095112085e-001, 7.4300795794e-001, 7.4505776167e-001, 7.4710059166e-001, + 7.4913638830e-001, 7.5116515160e-001, 7.5318682194e-001, 7.5520139933e-001, 7.5720882416e-001, 7.5920921564e-001, + 7.6120239496e-001, 7.6318842173e-001, 7.6516723633e-001, 7.6713889837e-001, 7.6910334826e-001, 7.7106052637e-001, + 7.7301043272e-001, 7.7495312691e-001, 7.7688848972e-001, 7.7881652117e-001, 7.8073722124e-001, 7.8265058994e-001, + 7.8455656767e-001, 7.8645521402e-001, 7.8834640980e-001, 7.9023021460e-001, 7.9210656881e-001, 7.9397547245e-001, + 7.9583692551e-001, 7.9769086838e-001, 7.9953724146e-001, 8.0137616396e-001, 8.0320751667e-001, 8.0503135920e-001, + 8.0684757233e-001, 8.0865615606e-001, 8.1045717001e-001, 8.1225061417e-001, 8.1403630972e-001, 8.1581443548e-001, + 8.1758481264e-001, 8.1934750080e-001, 8.2110249996e-001, 8.2284981012e-001, 8.2458931208e-001, 8.2632106543e-001, + 8.2804507017e-001, 8.2976120710e-001, 8.3146959543e-001, 8.3317017555e-001, 8.3486288786e-001, 8.3654773235e-001, + 8.3822470903e-001, 8.3989381790e-001, 8.4155499935e-001, 8.4320825338e-001, 8.4485358000e-001, 8.4649091959e-001, + 8.4812033176e-001, 8.4974175692e-001, 8.5135519505e-001, 8.5296058655e-001, 8.5455799103e-001, 8.5614734888e-001, + 8.5772860050e-001, 8.5930180550e-001, 8.6086696386e-001, 8.6242395639e-001, 8.6397284269e-001, 8.6551362276e-001, + 8.6704623699e-001, 8.6857068539e-001, 8.7008696795e-001, 8.7159508467e-001, 8.7309497595e-001, 8.7458664179e-001, + 8.7607008219e-001, 8.7754529715e-001, 8.7901222706e-001, 8.8047087193e-001, 8.8192129135e-001, 8.8336336613e-001, + 8.8479709625e-001, 8.8622254133e-001, 8.8763964176e-001, 8.8904833794e-001, 8.9044874907e-001, 8.9184069633e-001, + 8.9322429895e-001, 8.9459949732e-001, 8.9596623182e-001, 8.9732456207e-001, 8.9867448807e-001, 9.0001589060e-001, + 9.0134882927e-001, 9.0267330408e-001, 9.0398931503e-001, 9.0529674292e-001, 9.0659570694e-001, 9.0788608789e-001, + 9.0916800499e-001, 9.1044127941e-001, 9.1170603037e-001, 9.1296219826e-001, 9.1420978308e-001, 9.1544872522e-001, + 9.1667908430e-001, 9.1790080070e-001, 9.1911387444e-001, 9.2031830549e-001, 9.2151403427e-001, 9.2270112038e-001, + 9.2387950420e-001, 9.2504924536e-001, 9.2621022463e-001, 9.2736250162e-001, 9.2850607634e-001, 9.2964088917e-001, + 9.3076694012e-001, 9.3188428879e-001, 9.3299281597e-001, 9.3409252167e-001, 9.3518352509e-001, 9.3626564741e-001, + 9.3733900785e-001, 9.3840354681e-001, 9.3945920467e-001, 9.4050604105e-001, 9.4154405594e-001, 9.4257318974e-001, + 9.4359344244e-001, 9.4460481405e-001, 9.4560730457e-001, 9.4660091400e-001, 9.4758558273e-001, 9.4856137037e-001, + 9.4952815771e-001, 9.5048606396e-001, 9.5143502951e-001, 9.5237499475e-001, 9.5330601931e-001, 9.5422810316e-001, + 9.5514118671e-001, 9.5604526997e-001, 9.5694035292e-001, 9.5782643557e-001, 9.5870345831e-001, 9.5957154036e-001, + 9.6043050289e-001, 9.6128046513e-001, 9.6212142706e-001, 9.6295326948e-001, 9.6377605200e-001, 9.6458977461e-001, + 9.6539443731e-001, 9.6618998051e-001, 9.6697646379e-001, 9.6775382757e-001, 9.6852207184e-001, 9.6928125620e-001, + 9.7003126144e-001, 9.7077214718e-001, 9.7150391340e-001, 9.7222650051e-001, 9.7293996811e-001, 9.7364425659e-001, + 9.7433936596e-001, 9.7502535582e-001, 9.7570210695e-001, 9.7636973858e-001, 9.7702813148e-001, 9.7767734528e-001, + 9.7831737995e-001, 9.7894817591e-001, 9.7956979275e-001, 9.8018211126e-001, 9.8078525066e-001, 9.8137921095e-001, + 9.8196387291e-001, 9.8253929615e-001, 9.8310548067e-001, 9.8366242647e-001, 9.8421007395e-001, 9.8474848270e-001, + 9.8527765274e-001, 9.8579752445e-001, 9.8630809784e-001, 9.8680937290e-001, 9.8730140924e-001, 9.8778414726e-001, + 9.8825758696e-001, 9.8872166872e-001, 9.8917651176e-001, 9.8962199688e-001, 9.9005818367e-001, 9.9048507214e-001, + 9.9090266228e-001, 9.9131083488e-001, 9.9170976877e-001, 9.9209928513e-001, 9.9247956276e-001, 9.9285042286e-001, + 9.9321192503e-001, 9.9356412888e-001, 9.9390697479e-001, 9.9424046278e-001, 9.9456459284e-001, 9.9487930536e-001, + 9.9518471956e-001, 9.9548077583e-001, 9.9576741457e-001, 9.9604469538e-001, 9.9631261826e-001, 9.9657112360e-001, + 9.9682027102e-001, 9.9706006050e-001, 9.9729043245e-001, 9.9751144648e-001, 9.9772304296e-001, 9.9792528152e-001, + 9.9811810255e-001, 9.9830156565e-001, 9.9847555161e-001, 9.9864023924e-001, 9.9879544973e-001, 9.9894130230e-001, + 9.9907773733e-001, 9.9920475483e-001, 9.9932235479e-001, 9.9943059683e-001, 9.9952942133e-001, 9.9961882830e-001, + 9.9969881773e-001, 9.9976938963e-001, 9.9983060360e-001, 9.9988234043e-001, 9.9992471933e-001, 9.9995762110e-001, + 9.9998116493e-001, 9.9999529123e-001, 1.0000000000e+000}; + +/** + * \brief scramble + The function sorts the complex vector re/im of length n from 'in-order' to 'bitreversed order'. + + * \param[i/o] re: real input + * \param[i/o] im: imag input + * \param[i ] n: size of fft + * \param[i ] s: stride of real and imag input + + * \return none + */ +static void scramble(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT n, LC3_INT s) +{ + LC3_FLOAT tmp; + LC3_INT m, k, j; + + for (m = 1, j = 0; m < (n - 1); m++) { + { + for (k = n >> 1; (!((j ^= k) & k)); k >>= 1) + ; + } + + if (j > m) { + tmp = re[s * m]; + re[s * m] = re[s * j]; + re[s * j] = tmp; + + tmp = im[s * m]; + im[s * m] = im[s * j]; + im[s * j] = tmp; + } + } +} + +/** + * \brief fft + The function performs a radix-2, decimation in time complex fft. The calculation takes place inplace. + The real and imaginary part can reside in separate buffers as well as interleaved in one buffer. The + stride length has to be set accordingly. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + + * \return none + */ +static void fft(const LC3_FLOAT* aTrigData, LC3_INT trigdata_size, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT sizeOfFft, + LC3_INT s) +{ + LC3_INT trigstep, i, ldm, n; + LC3_INT trigDataSize; + LC3_INT ldn = 0; + + trigDataSize = sizeOfFft / 2; + + while (sizeOfFft >>= 1) { + ldn++; + } + + n = 1 << ldn; + + scramble(re, im, n, s); + + /* 1+2 stage implemented as radix 4 */ + for (i = 0; i < n; i += 4) { + LC3_FLOAT a00, a01, a10, a11; + LC3_FLOAT a20, a21, a30, a31; + + a00 = re[s * (i + 0)] + re[s * (i + 1)]; + a10 = re[s * (i + 2)] + re[s * (i + 3)]; + a20 = im[s * (i + 0)] + im[s * (i + 1)]; + a30 = im[s * (i + 2)] + im[s * (i + 3)]; + + a01 = re[s * (i + 0)] - re[s * (i + 1)]; + a21 = re[s * (i + 2)] - re[s * (i + 3)]; + a31 = im[s * (i + 0)] - im[s * (i + 1)]; + a11 = im[s * (i + 2)] - im[s * (i + 3)]; + + re[s * (i + 0)] = a00 + a10; + re[s * (i + 2)] = a00 - a10; + im[s * (i + 0)] = a20 + a30; + im[s * (i + 2)] = a20 - a30; + re[s * (i + 1)] = a11 + a01; + re[s * (i + 3)] = a01 - a11; + im[s * (i + 1)] = a31 - a21; + im[s * (i + 3)] = a21 + a31; + } + + /* next stages implemented as radix 2 */ + for (ldm = 3; ldm <= ldn; ++ldm) { + const LC3_INT m = (1 << ldm); + const LC3_INT mh = (m >> 1); + LC3_INT j, r; + + trigstep = ((trigDataSize * 4) >> ldm) * trigdata_size / trigDataSize; + + for (j = 0; j < mh / 2; ++j) { + LC3_FLOAT c1, c2; + + c2 = aTrigData[j * trigstep]; + c1 = aTrigData[trigdata_size - j * trigstep]; + + for (r = 0; r < n; r += m) { + LC3_FLOAT vr, vi, ur, ui; + + LC3_INT t0 = r + j; + LC3_INT t1 = s * t0; + LC3_INT t2 = s * (t0 + mh); + + vr = re[t2] * c1 + im[t2] * c2; + vi = -re[t2] * c2 + im[t2] * c1; + + ur = re[t1]; + ui = im[t1]; + + re[t1] = re[t1] + vr; + im[t1] = im[t1] + vi; + + re[t2] = ur - vr; + im[t2] = ui - vi; + + t0 = r + j + mh / 2; + t1 = s * t0; + t2 = s * (t0 + mh); + + vr = -re[t2] * c2 + im[t2] * c1; + vi = -re[t2] * c1 - im[t2] * c2; + + ur = re[t1]; + ui = im[t1]; + re[t1] = re[t1] + vr; + im[t1] = im[t1] + vi; + + re[t2] = ur - vr; + im[t2] = ui - vi; + } + } + } +} + +/** + * \brief ifft + The function performs a radix-2, decimation in time complex inverse fft. The calculation takes place + inplace. The real and imaginary part can reside in separate buffers as well as interleaved in one buffer. + The stride length has to be set accordingly. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + + * \return none + */ +static void ifft(const LC3_FLOAT* aTrigData, LC3_INT trigdata_size, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT sizeOfFft, + LC3_INT s) +{ + LC3_INT trigstep, i, ldm, n; + LC3_INT trigDataSize; + LC3_INT ldn = 0; + + trigDataSize = sizeOfFft; + + while (sizeOfFft >>= 1) { + ldn++; + } + + n = 1 << ldn; + + scramble(re, im, n, s); + + /* 1+2 stage radix 4 */ + for (i = 0; i < n; i += 4) { + LC3_FLOAT a00, a01, a10, a11; + LC3_FLOAT a20, a21, a30, a31; + + a00 = re[s * (i + 0)] + re[s * (i + 1)]; + a10 = re[s * (i + 2)] + re[s * (i + 3)]; + a20 = im[s * (i + 0)] + im[s * (i + 1)]; + a30 = im[s * (i + 2)] + im[s * (i + 3)]; + + a01 = re[s * (i + 0)] - re[s * (i + 1)]; + a21 = re[s * (i + 2)] - re[s * (i + 3)]; + a31 = im[s * (i + 0)] - im[s * (i + 1)]; + a11 = im[s * (i + 2)] - im[s * (i + 3)]; + + re[s * (i + 0)] = a00 + a10; + re[s * (i + 2)] = a00 - a10; + im[s * (i + 0)] = a20 + a30; + im[s * (i + 2)] = a20 - a30; + + re[s * (i + 1)] = a01 - a11; + re[s * (i + 3)] = a01 + a11; + im[s * (i + 1)] = a31 + a21; + im[s * (i + 3)] = a31 - a21; + } + + for (ldm = 3; ldm <= ldn; ++ldm) { + const LC3_INT m = (1 << ldm); + const LC3_INT mh = (m >> 1); + LC3_INT j, r; + + trigstep = ((trigDataSize * 4) >> ldm) * trigdata_size / trigDataSize; + + for (j = 0; j < mh / 2; ++j) { + LC3_FLOAT c1, c2; + + c2 = aTrigData[j * trigstep]; + c1 = aTrigData[trigdata_size - j * trigstep]; + + for (r = 0; r < n; r += m) { + LC3_FLOAT vr, vi, ur, ui; + + LC3_INT t0 = r + j; + LC3_INT t1 = s * t0; + LC3_INT t2 = s * (t0 + mh); + + vr = re[t2] * c1 - im[t2] * c2; + vi = re[t2] * c2 + im[t2] * c1; + + ur = re[t1]; + ui = im[t1]; + + re[t1] = ur + vr; + im[t1] = ui + vi; + + re[t2] = ur - vr; + im[t2] = ui - vi; + + t0 = r + j + mh / 2; + t1 = s * t0; + t2 = s * (t0 + mh); + + vr = -re[t2] * c2 - im[t2] * c1; + vi = re[t2] * c1 - im[t2] * c2; + + ur = re[t1]; + ui = im[t1]; + + re[t1] = ur + vr; + im[t1] = ui + vi; + re[t2] = ur - vr; + im[t2] = ui - vi; + } + } + } +} + +/** + * \brief cfft + The function serves as wrapper for the forward and inverse fft. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + * \param[i ] iSign: forward fft: -1 / inverse fft: 1 + + * \return none + */ +void LC3_cfft(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT length, LC3_INT stride, LC3_INT sign) +{ + assert(abs(sign) == 1); + assert(CFFT_SUPPORT(length)); + + if (sign == -1) { + fft(static_table, MAX_TRIGDATA_SIZE, re, im, length, stride); + } else { + ifft(static_table, MAX_TRIGDATA_SIZE, re, im, length, stride); + } +} + +LC3_INT LC3_cfft_plan(Cfft* handle, LC3_INT length, LC3_INT sign) +{ + /* check if length is power of two */ + if (!CFFT_PLAN_SUPPORT(length) || abs(sign) != 1) + return 0; + + handle->len = length; + handle->sign = sign; + + if (length <= MAX_FFT_SIZE) { + handle->table = NULL; + } else { + LC3_INT i = 0; + handle->table = (LC3_FLOAT*)malloc((length / 2 + 1) * sizeof(LC3_FLOAT)); + for (i = 0; i < length / 2 + 1; i++) { + handle->table[i] = (LC3_FLOAT)LC3_SIN((LC3_FLOAT)M_PIl * i / length); + } + } + return 1; +} + +void LC3_cfft_apply(Cfft* handle, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT stride) +{ + if (handle->len <= MAX_FFT_SIZE) { + LC3_cfft(re, im, handle->len, stride, handle->sign); + } else if (handle->sign == -1) { + fft(handle->table, handle->len / 2, re, im, handle->len, stride); + } else { + ifft(handle->table, handle->len / 2, re, im, handle->len, stride); + } +} + +void LC3_cfft_free(Cfft* handle) +{ + if (handle->table) + free(handle->table); +} diff --git a/lc3plus/fft/cfft.h b/lc3plus/fft/cfft.h new file mode 100755 index 0000000000..3902b4c396 --- /dev/null +++ b/lc3plus/fft/cfft.h @@ -0,0 +1,42 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + + +#include "../functions.h" + +#ifndef CFFT_H +#define CFFT_H + + +/* macro to check if cfft supports len */ +#define CFFT_IS_POWER_OF_TWO(n) ((n != 0) && ((n & (~n + 1)) == n)) +#define CFFT_SUPPORT(len) (len >= 4 && len <= 1024 && CFFT_IS_POWER_OF_TWO(len)) +#define CFFT_PLAN_SUPPORT(len) (len >= 4 && CFFT_IS_POWER_OF_TWO(len)) + +/** + * \brief fft_radix2 + The function serves as wrapper for the forward and inverse complex fft. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + * \param[i ] iSign: forward fft: -1 / inverse fft: 1 + + * \return none + */ + +void LC3_cfft(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT sizeOfFft, LC3_INT stride, LC3_INT sign); + +LC3_INT LC3_cfft_plan(Cfft* handle, LC3_INT length, LC3_INT sign); +void LC3_cfft_apply(Cfft* handle, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT stride); +void LC3_cfft_free(Cfft* handle); + +#endif /* FFT_RADIX2_H */ diff --git a/lc3plus/fft/fft_15_16.h b/lc3plus/fft/fft_15_16.h new file mode 100755 index 0000000000..83ca77353b --- /dev/null +++ b/lc3plus/fft/fft_15_16.h @@ -0,0 +1,401 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft15(LC3_FLOAT* vec) +{ + LC3_FLOAT r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, i0, i1, i2, i3, i4, i5, + i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, + tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp18, tmp19, tmp20, tmp21, tmp22, tmp23, tmp24, + tmp25, tmp26, tmp27, tmp28, tmp29; + + /* Pre-additions real part */ + r1 = vec[2] + vec[8]; + r2 = vec[2] - vec[8]; + r3 = vec[4] + vec[16]; + r4 = vec[4] - vec[16]; + r5 = vec[6] + vec[24]; + r6 = vec[6] - vec[24]; + r7 = vec[10] + vec[20]; + r8 = vec[10] - vec[20]; + r9 = vec[12] + vec[18]; + r10 = vec[12] - vec[18]; + r11 = vec[14] + vec[26]; + r12 = vec[14] - vec[26]; + r13 = vec[22] + vec[28]; + r14 = vec[22] - vec[28]; + + tmp2 = r1 + r3; + tmp4 = r1 - r3; + tmp6 = r2 + r14; + tmp8 = r2 - r14; + tmp10 = r4 + r12; + tmp12 = r4 - r12; + tmp14 = r5 + r9; + tmp16 = r5 - r9; + tmp18 = r11 + r13; + tmp20 = r11 - r13; + + /* Pre-additions imaginary part */ + i1 = vec[3] + vec[9]; + i2 = vec[3] - vec[9]; + i3 = vec[5] + vec[17]; + i4 = vec[5] - vec[17]; + i5 = vec[7] + vec[25]; + i6 = vec[7] - vec[25]; + i7 = vec[11] + vec[21]; + i8 = vec[11] - vec[21]; + i9 = vec[13] + vec[19]; + i10 = vec[13] - vec[19]; + i11 = vec[15] + vec[27]; + i12 = vec[15] - vec[27]; + i13 = vec[23] + vec[29]; + i14 = vec[23] - vec[29]; + + tmp3 = i1 + i3; + tmp5 = i1 - i3; + tmp7 = i2 + i14; + tmp9 = i2 - i14; + tmp11 = i4 + i12; + tmp13 = i4 - i12; + tmp15 = i5 + i9; + tmp17 = i5 - i9; + tmp19 = i11 + i13; + tmp21 = i11 - i13; + + /* Pre-additions and core multiplications */ + tmp28 = tmp4 + tmp20; + tmp29 = tmp5 + tmp21; + r4 = tmp2 + tmp18; + i4 = tmp3 + tmp19; + r3 = (r4 + tmp14) * (LC3_FLOAT)-1.25; + i3 = (i4 + tmp15) * (LC3_FLOAT)-1.25; + r2 = (tmp29 - i8) * (LC3_FLOAT)-8.660254037844387e-1; + i2 = (tmp28 - r8) * (LC3_FLOAT)8.660254037844387e-1; + r1 = r4 + r7; + i1 = i4 + i7; + r0 = r1 + vec[0] + tmp14; + i0 = i1 + vec[1] + tmp15; + r7 = tmp4 - tmp20; + i7 = tmp5 - tmp21; + r8 = (tmp3 - tmp19) * (LC3_FLOAT)-4.841229182759272e-1; + i8 = (tmp2 - tmp18) * (LC3_FLOAT)4.841229182759272e-1; + tmp0 = tmp6 + r10; + tmp1 = tmp7 + i10; + tmp2 = r6 - tmp10; + tmp3 = i6 - tmp11; + r10 = tmp7 * (LC3_FLOAT)-2.308262652881440; + i10 = tmp6 * (LC3_FLOAT)2.308262652881440; + r11 = tmp8 * (LC3_FLOAT)1.332676064001459; + i11 = tmp9 * (LC3_FLOAT)1.332676064001459; + r6 = (r7 - tmp16) * (LC3_FLOAT)5.590169943749475e-1; + i6 = (i7 - tmp17) * (LC3_FLOAT)5.590169943749475e-1; + r12 = (tmp1 + tmp3) * (LC3_FLOAT)5.877852522924733e-1; + i12 = (tmp0 + tmp2) * (LC3_FLOAT)-5.877852522924733e-1; + r13 = (tmp7 - tmp11) * (LC3_FLOAT)-8.816778784387098e-1; + i13 = (tmp6 - tmp10) * (LC3_FLOAT)8.816778784387098e-1; + r14 = (tmp8 + tmp12) * (LC3_FLOAT)5.090369604551274e-1; + i14 = (tmp9 + tmp13) * (LC3_FLOAT)5.090369604551274e-1; + r16 = tmp11 * (LC3_FLOAT)5.449068960040204e-1; + i16 = tmp10 * (LC3_FLOAT)-5.449068960040204e-1; + r17 = tmp12 * (LC3_FLOAT)3.146021430912046e-1; + i17 = tmp13 * (LC3_FLOAT)3.146021430912046e-1; + + r4 *= (LC3_FLOAT)1.875; + i4 *= (LC3_FLOAT)1.875; + r1 *= (LC3_FLOAT)-1.5; + i1 *= (LC3_FLOAT)-1.5; + r7 *= (LC3_FLOAT)-8.385254915624212e-1; + i7 *= (LC3_FLOAT)-8.385254915624212e-1; + r5 = tmp29 * (LC3_FLOAT)1.082531754730548; + i5 = tmp28 * (LC3_FLOAT)-1.082531754730548; + r9 = tmp1 * (LC3_FLOAT)1.538841768587627; + i9 = tmp0 * (LC3_FLOAT)-1.538841768587627; + r15 = tmp3 * (LC3_FLOAT)3.632712640026803e-1; + i15 = tmp2 * (LC3_FLOAT)-3.632712640026803e-1; + + /* Post-additions real part */ + tmp2 = r0 + r1; + tmp4 = r3 + r6; + tmp6 = r3 - r6; + tmp8 = r4 + r5; + tmp10 = r4 - r5; + tmp12 = r7 + r8; + tmp14 = r7 - r8; + tmp16 = r13 + r16; + tmp18 = r14 + r17; + tmp20 = r10 - r13; + tmp22 = r11 - r14; + tmp24 = r12 + r15; + tmp26 = r12 - r9; + + r1 = tmp2 + r2; + r2 = tmp2 - r2; + r3 = tmp4 + tmp26; + r4 = tmp4 - tmp26; + r5 = tmp6 + tmp24; + r6 = tmp6 - tmp24; + r7 = tmp16 + tmp18; + r8 = tmp16 - tmp18; + r9 = tmp20 - tmp22; + r10 = tmp20 + tmp22; + r11 = r1 + tmp8; + r12 = r2 + tmp10; + r13 = r11 - tmp12; + r14 = r12 - tmp14; + r15 = r12 + tmp14; + r16 = r11 + tmp12; + + /* Post-additions imaginary part */ + tmp3 = i0 + i1; + tmp5 = i3 + i6; + tmp7 = i3 - i6; + tmp9 = i4 + i5; + tmp11 = i4 - i5; + tmp13 = i7 + i8; + tmp15 = i7 - i8; + tmp17 = i13 + i16; + tmp19 = i14 + i17; + tmp21 = i10 - i13; + tmp23 = i11 - i14; + tmp25 = i12 + i15; + tmp27 = i12 - i9; + + i1 = tmp3 + i2; + i2 = tmp3 - i2; + i3 = tmp5 + tmp27; + i4 = tmp5 - tmp27; + i5 = tmp7 + tmp25; + i6 = tmp7 - tmp25; + i7 = tmp17 + tmp19; + i8 = tmp17 - tmp19; + i9 = tmp21 - tmp23; + i10 = tmp21 + tmp23; + i11 = i1 + tmp9; + i12 = i2 + tmp11; + i13 = i11 - tmp13; + i14 = i12 - tmp15; + i15 = i12 + tmp15; + i16 = i11 + tmp13; + + *vec++ = r0; + *vec++ = i0; + *vec++ = r13 + r5 + r7; + *vec++ = i13 + i5 + i7; + *vec++ = r15 + r3 - r9; + *vec++ = i15 + i3 - i9; + *vec++ = r0 + r4; + *vec++ = i0 + i4; + *vec++ = r13 + r6 - r7; + *vec++ = i13 + i6 - i7; + *vec++ = r2; + *vec++ = i2; + *vec++ = r0 + r5; + *vec++ = i0 + i5; + *vec++ = r16 + r3 - r10; + *vec++ = i16 + i3 - i10; + *vec++ = r15 + r4 + r9; + *vec++ = i15 + i4 + i9; + *vec++ = r0 + r6; + *vec++ = i0 + i6; + *vec++ = r1; + *vec++ = i1; + *vec++ = r14 + r5 + r8; + *vec++ = i14 + i5 + i8; + *vec++ = r0 + r3; + *vec++ = i0 + i3; + *vec++ = r16 + r4 + r10; + *vec++ = i16 + i4 + i10; + *vec++ = r14 + r6 - r8; + *vec++ = i14 + i6 - i8; +} + +static void fft16(LC3_FLOAT* vec) +{ + const LC3_FLOAT INV_SQRT2 = 7.071067811865475e-1; + const LC3_FLOAT COS_PI_DIV8 = 9.238795325112867e-1; + const LC3_FLOAT COS_3PI_DIV8 = 3.826834323650898e-1; + const LC3_FLOAT SQRT2PLUS1 = 2.414213562373095; + const LC3_FLOAT SQRT2MINUS1 = 4.142135623730952e-1; + + LC3_FLOAT temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp110, temp111, temp112, + temp113, temp114, temp115, temp20, temp21, temp22, temp23, temp24, temp25, temp26, temp27, temp28, temp29, + temp210, temp211, temp212, temp213, temp214, temp215, vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, + vec9, vec10, vec11, vec12, vec13, vec14, vec15; + + /* even */ + vec0 = vec[0] + vec[16]; + vec1 = vec[1] + vec[17]; + vec2 = vec[2] + vec[18]; + vec3 = vec[3] + vec[19]; + vec4 = vec[4] + vec[20]; + vec5 = vec[5] + vec[21]; + vec6 = vec[6] + vec[22]; + vec7 = vec[7] + vec[23]; + vec8 = vec[8] + vec[24]; + vec9 = vec[9] + vec[25]; + vec10 = vec[10] + vec[26]; + vec11 = vec[11] + vec[27]; + vec12 = vec[12] + vec[28]; + vec13 = vec[13] + vec[29]; + vec14 = vec[14] + vec[30]; + vec15 = vec[15] + vec[31]; + + /* Pre-additions */ + temp10 = vec0 + vec8; + temp12 = vec0 - vec8; + temp11 = vec1 + vec9; + temp13 = vec1 - vec9; + temp14 = vec2 + vec10; + temp16 = vec2 - vec10; + temp15 = vec3 + vec11; + temp17 = vec3 - vec11; + temp18 = vec4 + vec12; + temp110 = vec4 - vec12; + temp19 = vec5 + vec13; + temp111 = vec5 - vec13; + temp112 = vec6 + vec14; + temp114 = vec6 - vec14; + temp113 = vec7 + vec15; + temp115 = vec7 - vec15; + + /* Pre-additions and core multiplications */ + temp20 = temp10 + temp18; + temp24 = temp10 - temp18; + temp21 = temp11 + temp19; + temp25 = temp11 - temp19; + temp28 = temp12 - temp111; + temp210 = temp12 + temp111; + temp29 = temp13 + temp110; + temp211 = temp13 - temp110; + temp22 = temp14 + temp112; + temp27 = temp14 - temp112; + temp23 = temp15 + temp113; + temp26 = temp113 - temp15; + + temp11 = temp16 + temp114; + temp12 = temp16 - temp114; + temp10 = temp17 + temp115; + temp13 = temp17 - temp115; + temp212 = (temp10 + temp12) * INV_SQRT2; + temp214 = (temp10 - temp12) * INV_SQRT2; + temp213 = (temp13 - temp11) * INV_SQRT2; + temp215 = (temp11 + temp13) * -INV_SQRT2; + + /* odd */ + vec0 = vec[0] - vec[16]; + vec1 = vec[1] - vec[17]; + vec2 = vec[2] - vec[18]; + vec3 = vec[3] - vec[19]; + vec4 = vec[4] - vec[20]; + vec5 = vec[5] - vec[21]; + vec6 = vec[6] - vec[22]; + vec7 = vec[7] - vec[23]; + vec8 = vec[8] - vec[24]; + vec9 = vec[9] - vec[25]; + vec10 = vec[10] - vec[26]; + vec11 = vec[11] - vec[27]; + vec12 = vec[12] - vec[28]; + vec13 = vec[13] - vec[29]; + vec14 = vec[14] - vec[30]; + vec15 = vec[15] - vec[31]; + + /* Pre-additions and core multiplications */ + temp19 = (vec2 + vec14) * -COS_3PI_DIV8; + temp110 = (vec2 - vec14) * COS_PI_DIV8; + temp18 = (vec3 + vec15) * COS_3PI_DIV8; + temp111 = (vec3 - vec15) * COS_PI_DIV8; + temp15 = (vec4 + vec12) * -INV_SQRT2; + temp16 = (vec4 - vec12) * INV_SQRT2; + temp14 = (vec5 + vec13) * INV_SQRT2; + temp17 = (vec5 - vec13) * INV_SQRT2; + temp113 = (vec6 + vec10) * -COS_PI_DIV8; + temp114 = (vec6 - vec10) * COS_3PI_DIV8; + temp112 = (vec7 + vec11) * COS_PI_DIV8; + temp115 = (vec7 - vec11) * COS_3PI_DIV8; + + /* Core multiplications */ + vec2 = temp18 * SQRT2PLUS1 - temp112 * SQRT2MINUS1; + vec3 = temp19 * SQRT2PLUS1 - temp113 * SQRT2MINUS1; + vec4 = temp110 * SQRT2MINUS1 - temp114 * SQRT2PLUS1; + vec5 = temp111 * SQRT2MINUS1 - temp115 * SQRT2PLUS1; + + /* Post-additions */ + temp18 += temp112; + temp19 += temp113; + temp110 += temp114; + temp111 += temp115; + vec6 = vec0 + temp14; + vec10 = vec0 - temp14; + vec7 = vec1 + temp15; + vec11 = vec1 - temp15; + + vec12 = temp16 - vec9; + vec14 = temp16 + vec9; + vec13 = vec8 + temp17; + vec15 = vec8 - temp17; + + temp10 = vec6 - vec14; + temp12 = vec6 + vec14; + temp11 = vec7 + vec15; + temp13 = vec7 - vec15; + temp14 = vec10 + vec12; + temp16 = vec10 - vec12; + temp15 = vec11 + vec13; + temp17 = vec11 - vec13; + + vec10 = temp18 + temp110; + temp110 = temp18 - temp110; + vec11 = temp19 + temp111; + temp111 = temp19 - temp111; + + temp112 = vec2 + vec4; + temp114 = vec2 - vec4; + temp113 = vec3 + vec5; + temp115 = vec3 - vec5; + + /* Post-additions */ + *vec++ = temp20 + temp22; + *vec++ = temp21 + temp23; + *vec++ = temp12 + vec10; + *vec++ = temp13 + vec11; + *vec++ = temp210 + temp212; + *vec++ = temp211 + temp213; + *vec++ = temp10 + temp112; + *vec++ = temp11 + temp113; + *vec++ = temp24 - temp26; + *vec++ = temp25 - temp27; + *vec++ = temp16 + temp114; + *vec++ = temp17 + temp115; + *vec++ = temp28 + temp214; + *vec++ = temp29 + temp215; + *vec++ = temp14 + temp110; + *vec++ = temp15 + temp111; + *vec++ = temp20 - temp22; + *vec++ = temp21 - temp23; + *vec++ = temp12 - vec10; + *vec++ = temp13 - vec11; + *vec++ = temp210 - temp212; + *vec++ = temp211 - temp213; + *vec++ = temp10 - temp112; + *vec++ = temp11 - temp113; + *vec++ = temp24 + temp26; + *vec++ = temp25 + temp27; + *vec++ = temp16 - temp114; + *vec++ = temp17 - temp115; + *vec++ = temp28 - temp214; + *vec++ = temp29 - temp215; + *vec++ = temp14 - temp110; + *vec++ = temp15 - temp111; +} diff --git a/lc3plus/fft/fft_240_480.h b/lc3plus/fft/fft_240_480.h new file mode 100755 index 0000000000..c1d96c87b8 --- /dev/null +++ b/lc3plus/fft/fft_240_480.h @@ -0,0 +1,185 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft240(LC3_FLOAT* in) +{ + const LC3_INT table1[240] = { + 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 225, 1, 17, 33, 49, 65, 81, + 97, 113, 129, 145, 161, 177, 193, 209, 210, 226, 2, 18, 34, 50, 66, 82, 98, 114, 130, 146, 162, 178, + 194, 195, 211, 227, 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, 179, 180, 196, 212, 228, 4, 20, + 36, 52, 68, 84, 100, 116, 132, 148, 164, 165, 181, 197, 213, 229, 5, 21, 37, 53, 69, 85, 101, 117, + 133, 149, 150, 166, 182, 198, 214, 230, 6, 22, 38, 54, 70, 86, 102, 118, 134, 135, 151, 167, 183, 199, + 215, 231, 7, 23, 39, 55, 71, 87, 103, 119, 120, 136, 152, 168, 184, 200, 216, 232, 8, 24, 40, 56, + 72, 88, 104, 105, 121, 137, 153, 169, 185, 201, 217, 233, 9, 25, 41, 57, 73, 89, 90, 106, 122, 138, + 154, 170, 186, 202, 218, 234, 10, 26, 42, 58, 74, 75, 91, 107, 123, 139, 155, 171, 187, 203, 219, 235, + 11, 27, 43, 59, 60, 76, 92, 108, 124, 140, 156, 172, 188, 204, 220, 236, 12, 28, 44, 45, 61, 77, + 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 13, 29, 30, 46, 62, 78, 94, 110, 126, 142, 158, 174, + 190, 206, 222, 238, 14, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239}; + const LC3_INT table2[240] = { + 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 15, 31, 47, 63, 79, 95, 111, + 127, 143, 159, 175, 191, 207, 223, 239, 30, 46, 62, 78, 94, 110, 126, 142, 158, 174, 190, 206, 222, 238, + 14, 45, 61, 77, 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 13, 29, 60, 76, 92, 108, 124, 140, + 156, 172, 188, 204, 220, 236, 12, 28, 44, 75, 91, 107, 123, 139, 155, 171, 187, 203, 219, 235, 11, 27, + 43, 59, 90, 106, 122, 138, 154, 170, 186, 202, 218, 234, 10, 26, 42, 58, 74, 105, 121, 137, 153, 169, + 185, 201, 217, 233, 9, 25, 41, 57, 73, 89, 120, 136, 152, 168, 184, 200, 216, 232, 8, 24, 40, 56, + 72, 88, 104, 135, 151, 167, 183, 199, 215, 231, 7, 23, 39, 55, 71, 87, 103, 119, 150, 166, 182, 198, + 214, 230, 6, 22, 38, 54, 70, 86, 102, 118, 134, 165, 181, 197, 213, 229, 5, 21, 37, 53, 69, 85, + 101, 117, 133, 149, 180, 196, 212, 228, 4, 20, 36, 52, 68, 84, 100, 116, 132, 148, 164, 195, 211, 227, + 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, 179, 210, 226, 2, 18, 34, 50, 66, 82, 98, 114, + 130, 146, 162, 178, 194, 225, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209}; + + const LC3_INT L = 240; + const LC3_INT A = 15; + const LC3_INT B = 16; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_INT k, l; + LC3_FLOAT temp[32], out[480]; + + for (k = 0; k < A; k++) { + for (l = 0; l < B; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += A; + } + + fft16(temp); /* 16-point FFT */ + idx1 -= L; + + for (l = 0; l < B; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += A; + } + + idx1 -= L - 1; + } + + idx1 -= A; + + for (k = 0; k < B; k++) { + for (l = 0; l < A; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft15(temp); /* 15-point FFT */ + + for (l = 0; l < A; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} + +/* description in iis_fft.h */ +static void fft480(LC3_FLOAT* in) +{ + const LC3_INT table1[480] = { + 0, 256, 32, 288, 64, 320, 96, 352, 128, 384, 160, 416, 192, 448, 224, 225, 1, 257, 33, 289, 65, 321, + 97, 353, 129, 385, 161, 417, 193, 449, 450, 226, 2, 258, 34, 290, 66, 322, 98, 354, 130, 386, 162, 418, + 194, 195, 451, 227, 3, 259, 35, 291, 67, 323, 99, 355, 131, 387, 163, 419, 420, 196, 452, 228, 4, 260, + 36, 292, 68, 324, 100, 356, 132, 388, 164, 165, 421, 197, 453, 229, 5, 261, 37, 293, 69, 325, 101, 357, + 133, 389, 390, 166, 422, 198, 454, 230, 6, 262, 38, 294, 70, 326, 102, 358, 134, 135, 391, 167, 423, 199, + 455, 231, 7, 263, 39, 295, 71, 327, 103, 359, 360, 136, 392, 168, 424, 200, 456, 232, 8, 264, 40, 296, + 72, 328, 104, 105, 361, 137, 393, 169, 425, 201, 457, 233, 9, 265, 41, 297, 73, 329, 330, 106, 362, 138, + 394, 170, 426, 202, 458, 234, 10, 266, 42, 298, 74, 75, 331, 107, 363, 139, 395, 171, 427, 203, 459, 235, + 11, 267, 43, 299, 300, 76, 332, 108, 364, 140, 396, 172, 428, 204, 460, 236, 12, 268, 44, 45, 301, 77, + 333, 109, 365, 141, 397, 173, 429, 205, 461, 237, 13, 269, 270, 46, 302, 78, 334, 110, 366, 142, 398, 174, + 430, 206, 462, 238, 14, 15, 271, 47, 303, 79, 335, 111, 367, 143, 399, 175, 431, 207, 463, 239, 240, 16, + 272, 48, 304, 80, 336, 112, 368, 144, 400, 176, 432, 208, 464, 465, 241, 17, 273, 49, 305, 81, 337, 113, + 369, 145, 401, 177, 433, 209, 210, 466, 242, 18, 274, 50, 306, 82, 338, 114, 370, 146, 402, 178, 434, 435, + 211, 467, 243, 19, 275, 51, 307, 83, 339, 115, 371, 147, 403, 179, 180, 436, 212, 468, 244, 20, 276, 52, + 308, 84, 340, 116, 372, 148, 404, 405, 181, 437, 213, 469, 245, 21, 277, 53, 309, 85, 341, 117, 373, 149, + 150, 406, 182, 438, 214, 470, 246, 22, 278, 54, 310, 86, 342, 118, 374, 375, 151, 407, 183, 439, 215, 471, + 247, 23, 279, 55, 311, 87, 343, 119, 120, 376, 152, 408, 184, 440, 216, 472, 248, 24, 280, 56, 312, 88, + 344, 345, 121, 377, 153, 409, 185, 441, 217, 473, 249, 25, 281, 57, 313, 89, 90, 346, 122, 378, 154, 410, + 186, 442, 218, 474, 250, 26, 282, 58, 314, 315, 91, 347, 123, 379, 155, 411, 187, 443, 219, 475, 251, 27, + 283, 59, 60, 316, 92, 348, 124, 380, 156, 412, 188, 444, 220, 476, 252, 28, 284, 285, 61, 317, 93, 349, + 125, 381, 157, 413, 189, 445, 221, 477, 253, 29, 30, 286, 62, 318, 94, 350, 126, 382, 158, 414, 190, 446, + 222, 478, 254, 255, 31, 287, 63, 319, 95, 351, 127, 383, 159, 415, 191, 447, 223, 479}; + const LC3_INT table2[480] = { + 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 15, 47, 79, 111, 143, 175, 207, + 239, 271, 303, 335, 367, 399, 431, 463, 30, 62, 94, 126, 158, 190, 222, 254, 286, 318, 350, 382, 414, 446, + 478, 45, 77, 109, 141, 173, 205, 237, 269, 301, 333, 365, 397, 429, 461, 13, 60, 92, 124, 156, 188, 220, + 252, 284, 316, 348, 380, 412, 444, 476, 28, 75, 107, 139, 171, 203, 235, 267, 299, 331, 363, 395, 427, 459, + 11, 43, 90, 122, 154, 186, 218, 250, 282, 314, 346, 378, 410, 442, 474, 26, 58, 105, 137, 169, 201, 233, + 265, 297, 329, 361, 393, 425, 457, 9, 41, 73, 120, 152, 184, 216, 248, 280, 312, 344, 376, 408, 440, 472, + 24, 56, 88, 135, 167, 199, 231, 263, 295, 327, 359, 391, 423, 455, 7, 39, 71, 103, 150, 182, 214, 246, + 278, 310, 342, 374, 406, 438, 470, 22, 54, 86, 118, 165, 197, 229, 261, 293, 325, 357, 389, 421, 453, 5, + 37, 69, 101, 133, 180, 212, 244, 276, 308, 340, 372, 404, 436, 468, 20, 52, 84, 116, 148, 195, 227, 259, + 291, 323, 355, 387, 419, 451, 3, 35, 67, 99, 131, 163, 210, 242, 274, 306, 338, 370, 402, 434, 466, 18, + 50, 82, 114, 146, 178, 225, 257, 289, 321, 353, 385, 417, 449, 1, 33, 65, 97, 129, 161, 193, 240, 272, + 304, 336, 368, 400, 432, 464, 16, 48, 80, 112, 144, 176, 208, 255, 287, 319, 351, 383, 415, 447, 479, 31, + 63, 95, 127, 159, 191, 223, 270, 302, 334, 366, 398, 430, 462, 14, 46, 78, 110, 142, 174, 206, 238, 285, + 317, 349, 381, 413, 445, 477, 29, 61, 93, 125, 157, 189, 221, 253, 300, 332, 364, 396, 428, 460, 12, 44, + 76, 108, 140, 172, 204, 236, 268, 315, 347, 379, 411, 443, 475, 27, 59, 91, 123, 155, 187, 219, 251, 283, + 330, 362, 394, 426, 458, 10, 42, 74, 106, 138, 170, 202, 234, 266, 298, 345, 377, 409, 441, 473, 25, 57, + 89, 121, 153, 185, 217, 249, 281, 313, 360, 392, 424, 456, 8, 40, 72, 104, 136, 168, 200, 232, 264, 296, + 328, 375, 407, 439, 471, 23, 55, 87, 119, 151, 183, 215, 247, 279, 311, 343, 390, 422, 454, 6, 38, 70, + 102, 134, 166, 198, 230, 262, 294, 326, 358, 405, 437, 469, 21, 53, 85, 117, 149, 181, 213, 245, 277, 309, + 341, 373, 420, 452, 4, 36, 68, 100, 132, 164, 196, 228, 260, 292, 324, 356, 388, 435, 467, 19, 51, 83, + 115, 147, 179, 211, 243, 275, 307, 339, 371, 403, 450, 2, 34, 66, 98, 130, 162, 194, 226, 258, 290, 322, + 354, 386, 418, 465, 17, 49, 81, 113, 145, 177, 209, 241, 273, 305, 337, 369, 401, 433}; + + const LC3_INT L = 480; + const LC3_INT A = 15; + const LC3_INT B = 32; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_INT k, l; + LC3_FLOAT temp[64], out[960]; + + for (k = 0; k < A; k++) { + for (l = 0; l < B; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += A; + } + + fft32(temp); /* 32-point FFT */ + idx1 -= L; + + for (l = 0; l < B; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += A; + } + + idx1 -= L - 1; + } + + idx1 -= A; + + for (k = 0; k < B; k++) { + for (l = 0; l < A; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft15(temp); /* 15-point FFT */ + + for (l = 0; l < A; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} diff --git a/lc3plus/fft/fft_2_9.h b/lc3plus/fft/fft_2_9.h new file mode 100755 index 0000000000..54f4f839df --- /dev/null +++ b/lc3plus/fft/fft_2_9.h @@ -0,0 +1,278 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static __inline void butterfly(const LC3_FLOAT a, const LC3_FLOAT b, LC3_FLOAT* aPlusb, LC3_FLOAT* aMinusb) +{ + *aPlusb = a + b; + *aMinusb = a - b; +} + +static void fft2(LC3_FLOAT* vec) +{ + /* + 1.0000 1.0000 + 1.0000 -1.0000 + */ + LC3_FLOAT re1 = vec[0]; + LC3_FLOAT im1 = vec[1]; + LC3_FLOAT re2 = vec[2]; + LC3_FLOAT im2 = vec[3]; + + vec[0] = re1 + re2; + vec[1] = im1 + im2; + vec[2] = re1 - re2; + vec[3] = im1 - im2; +} + +static void fft3(LC3_FLOAT* vec) +{ + const LC3_FLOAT C31 = 0.5; /* cos(PI/3); sin(2*PI/3) */ + const LC3_FLOAT C32 = 0.866025403784439; /* cos(PI/3); sin(2*PI/3) */ + + LC3_FLOAT re1 = vec[0]; + LC3_FLOAT im1 = vec[1]; + LC3_FLOAT re2 = vec[2]; + LC3_FLOAT im2 = vec[3]; + LC3_FLOAT re3 = vec[4]; + LC3_FLOAT im3 = vec[5]; + /* + 1.0000 1.0000 1.0000 + C31 C32 + 1.0000 -0.5000 - 0.8660i -0.5000 + 0.8660i + 1.0000 -0.5000 + 0.8660i -0.5000 - 0.8660i + */ + LC3_FLOAT tmp1 = re2 + re3; + LC3_FLOAT tmp3 = im2 + im3; + LC3_FLOAT tmp2 = re2 - re3; + LC3_FLOAT tmp4 = im2 - im3; + + vec[0] = re1 + tmp1; + vec[1] = im1 + tmp3; + vec[2] = re1 - C31 * tmp1 + C32 * tmp4; + vec[4] = re1 - C31 * tmp1 - C32 * tmp4; + vec[3] = im1 - C32 * tmp2 - C31 * tmp3; + vec[5] = im1 + C32 * tmp2 - C31 * tmp3; +} + +static void fft4(LC3_FLOAT* vec) +{ + LC3_FLOAT temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + + /* Pre-additions */ + temp0 = vec[0] + vec[4]; + temp2 = vec[0] - vec[4]; + temp1 = vec[1] + vec[5]; + temp3 = vec[1] - vec[5]; + temp4 = vec[2] + vec[6]; + temp7 = vec[2] - vec[6]; + temp5 = vec[7] + vec[3]; + temp6 = vec[7] - vec[3]; + + /* Post-additions */ + vec[0] = temp0 + temp4; + vec[1] = temp1 + temp5; + vec[2] = temp2 - temp6; + vec[3] = temp3 - temp7; + vec[4] = temp0 - temp4; + vec[5] = temp1 - temp5; + vec[6] = temp2 + temp6; + vec[7] = temp3 + temp7; +} + +static void fft5(LC3_FLOAT* vec) +{ + const LC3_FLOAT C51 = 0.309016994374947; /* cos(2*PI/5); */ + const LC3_FLOAT C52 = 0.951056516295154; /* sin(2*PI/5); */ + const LC3_FLOAT C53 = 0.809016994374947; /* cos( PI/5); */ + const LC3_FLOAT C54 = 0.587785252292473; /* sin( PI/5); */ + + LC3_FLOAT re1, im1, re2, im2, re3, im3, re4, im4, re5, im5, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; + + re1 = vec[0]; + im1 = vec[1]; + re2 = vec[2]; + im2 = vec[3]; + re3 = vec[4]; + im3 = vec[5]; + re4 = vec[6]; + im4 = vec[7]; + re5 = vec[8]; + im5 = vec[9]; + /* + 1.0000 1.0000 1.0000 1.0000 1.0000 + C51 C52 C53 C54 + 1.0000 0.3090 - 0.9511i -0.8090 - 0.5878i -0.8090 + 0.5878i 0.3090 + 0.9511i + 1.0000 -0.8090 - 0.5878i 0.3090 + 0.9511i 0.3090 - 0.9511i -0.8090 + 0.5878i + 1.0000 -0.8090 + 0.5878i 0.3090 - 0.9511i 0.3090 + 0.9511i -0.8090 - 0.5878i + 1.0000 0.3090 + 0.9511i -0.8090 + 0.5878i -0.8090 - 0.5878i 0.3090 - 0.9511i + */ + tmp1 = re2 + re5; + tmp2 = re2 - re5; + tmp3 = im2 + im5; + tmp4 = im2 - im5; + tmp5 = re3 + re4; + tmp6 = re3 - re4; + tmp7 = im3 + im4; + tmp8 = im3 - im4; + + vec[0] = re1 + tmp1 + tmp5; + vec[1] = im1 + tmp3 + tmp7; + vec[2] = re1 + C51 * tmp1 - C53 * tmp5 + C52 * tmp4 + C54 * tmp8; + vec[8] = re1 + C51 * tmp1 - C53 * tmp5 - C52 * tmp4 - C54 * tmp8; + vec[3] = im1 - C52 * tmp2 - C54 * tmp6 + C51 * tmp3 - C53 * tmp7; + vec[9] = im1 + C52 * tmp2 + C54 * tmp6 + C51 * tmp3 - C53 * tmp7; + vec[4] = re1 - C53 * tmp1 + C51 * tmp5 + C54 * tmp4 - C52 * tmp8; + vec[6] = re1 - C53 * tmp1 + C51 * tmp5 - C54 * tmp4 + C52 * tmp8; + vec[5] = im1 - C54 * tmp2 + C52 * tmp6 - C53 * tmp3 + C51 * tmp7; + vec[7] = im1 + C54 * tmp2 - C52 * tmp6 - C53 * tmp3 + C51 * tmp7; +} + + + +static void fft8(LC3_FLOAT* vec) +{ + const LC3_FLOAT INV_SQRT2 = 7.071067811865475e-1; + LC3_FLOAT temp1[16], temp2[16]; + + /* Pre-additions */ + temp1[0] = vec[0] + vec[8]; + temp1[2] = vec[0] - vec[8]; + temp1[1] = vec[1] + vec[9]; + temp1[3] = vec[1] - vec[9]; + temp1[4] = vec[2] + vec[10]; + temp1[6] = vec[2] - vec[10]; + temp1[5] = vec[3] + vec[11]; + temp1[7] = vec[3] - vec[11]; + temp1[8] = vec[4] + vec[12]; + temp1[10] = vec[4] - vec[12]; + temp1[9] = vec[5] + vec[13]; + temp1[11] = vec[5] - vec[13]; + temp1[12] = vec[6] + vec[14]; + temp1[14] = vec[6] - vec[14]; + temp1[13] = vec[7] + vec[15]; + temp1[15] = vec[7] - vec[15]; + + /* Pre-additions and core multiplications */ + temp2[0] = temp1[0] + temp1[8]; + temp2[4] = temp1[0] - temp1[8]; + temp2[1] = temp1[1] + temp1[9]; + temp2[5] = temp1[1] - temp1[9]; + temp2[8] = temp1[2] - temp1[11]; + temp2[10] = temp1[2] + temp1[11]; + temp2[9] = temp1[3] + temp1[10]; + temp2[11] = temp1[3] - temp1[10]; + temp2[2] = temp1[4] + temp1[12]; + temp2[7] = temp1[4] - temp1[12]; + temp2[3] = temp1[5] + temp1[13]; + temp2[6] = temp1[13] - temp1[5]; + + temp1[1] = temp1[6] + temp1[14]; + temp1[2] = temp1[6] - temp1[14]; + temp1[0] = temp1[7] + temp1[15]; + temp1[3] = temp1[7] - temp1[15]; + temp2[12] = (temp1[0] + temp1[2]) * INV_SQRT2; + temp2[14] = (temp1[0] - temp1[2]) * INV_SQRT2; + temp2[13] = (temp1[3] - temp1[1]) * INV_SQRT2; + temp2[15] = (temp1[1] + temp1[3]) * -INV_SQRT2; + + /* Post-additions */ + vec[0] = temp2[0] + temp2[2]; + vec[8] = temp2[0] - temp2[2]; + vec[1] = temp2[1] + temp2[3]; + vec[9] = temp2[1] - temp2[3]; + vec[4] = temp2[4] - temp2[6]; + vec[12] = temp2[4] + temp2[6]; + vec[5] = temp2[5] - temp2[7]; + vec[13] = temp2[5] + temp2[7]; + vec[6] = temp2[8] + temp2[14]; + vec[14] = temp2[8] - temp2[14]; + vec[7] = temp2[9] + temp2[15]; + vec[15] = temp2[9] - temp2[15]; + vec[2] = temp2[10] + temp2[12]; + vec[10] = temp2[10] - temp2[12]; + vec[3] = temp2[11] + temp2[13]; + vec[11] = temp2[11] - temp2[13]; +} + + +static void fft9(LC3_FLOAT* vec) +{ + const LC3_FLOAT C91 = 0.766044443118978; /* cos(2*PI/5); */ + const LC3_FLOAT C92 = 0.642787609686539; + const LC3_FLOAT C93 = 0.17364817766693; + const LC3_FLOAT C94 = 0.984807753012208; + const LC3_FLOAT C95 = 0.5; + const LC3_FLOAT C96 = 0.866025403784439; + const LC3_FLOAT C97 = 0.939692620785908; + const LC3_FLOAT C98 = 0.342020143325669; + + LC3_FLOAT re1, im1, re2_9p, re2_9m, im2_9p, im2_9m, re3_8p, re3_8m, im3_8p, im3_8m, re4_7p, re4_7m, im4_7p, im4_7m, + re5_6p, re5_6m, im5_6p, im5_6m; + + re1 = vec[0]; + im1 = vec[1]; + + butterfly(vec[1 * 2], vec[8 * 2], &re2_9p, &re2_9m); + butterfly(vec[1 * 2 + 1], vec[8 * 2 + 1], &im2_9p, &im2_9m); + butterfly(vec[2 * 2], vec[7 * 2], &re3_8p, &re3_8m); + butterfly(vec[2 * 2 + 1], vec[7 * 2 + 1], &im3_8p, &im3_8m); + butterfly(vec[3 * 2], vec[6 * 2], &re4_7p, &re4_7m); + butterfly(vec[3 * 2 + 1], vec[6 * 2 + 1], &im4_7p, &im4_7m); + butterfly(vec[4 * 2], vec[5 * 2], &re5_6p, &re5_6m); + butterfly(vec[4 * 2 + 1], vec[5 * 2 + 1], &im5_6p, &im5_6m); + + /* + 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 + 1.0000 C91 - C92i C93 - C94i -C95 - C96i -C97 - C98i -C97 + C98i -C95 + C96i C93 + C94i C91 + C92i + 1.0000 C93 - C94i -C97 - C98i -C95 + C96i C91 + C92i C91 - C92i -C95 - C96i -C97 + C98i C93 + C94i + 1.0000 -C95 - C96i -C95 + C96i 1.0000 -C95 - C96i -C95 + C96i 1.0000 -C95 - C96i -C95 + C96i + 1.0000 -C97 - C98i C91 + C92i -C95 - C96i C93 + C94i C93 - C94i -C95 + C96i C91 - C92i -C97 + C98i + 1.0000 -C97 + C98i C91 - C92i -C95 + C96i C93 - C94i C93 + C94i -C95 - C96i C91 + C92i -C97 - C98i + 1.0000 -C95 + C96i -C95 - C96i 1.0000 -C95 + C96i -C95 - C96i 1.0000 -C95 + C96i -C95 - C96i + 1.0000 C93 + C94i -C97 + C98i -C95 - C96i C91 - C92i C91 + C92i -C95 + C96i -C97 - C98i C93 - C94i + 1.0000 C91 + C92i C93 + C94i -C95 + C96i -C97 + C98i -C97 - C98i -C95 - C96i C93 - C94i C91 - C92i + */ + vec[0] = re1 + re2_9p + re3_8p + re4_7p + re5_6p; + vec[1] = im1 + im2_9p + im3_8p + im4_7p + im5_6p; + vec[2] = re1 + C91 * re2_9p + C93 * re3_8p - C95 * re4_7p - C97 * re5_6p + C92 * im2_9m + C94 * im3_8m + + C96 * im4_7m + C98 * im5_6m; + vec[16] = re1 + C91 * re2_9p + C93 * re3_8p - C95 * re4_7p - C97 * re5_6p - C92 * im2_9m - C94 * im3_8m - + C96 * im4_7m - C98 * im5_6m; + vec[3] = im1 - C92 * re2_9m - C94 * re3_8m - C96 * re4_7m - C98 * re5_6m + C91 * im2_9p + C93 * im3_8p - + C95 * im4_7p - C97 * im5_6p; + vec[17] = im1 + C92 * re2_9m + C94 * re3_8m + C96 * re4_7m + C98 * re5_6m + C91 * im2_9p + C93 * im3_8p - + C95 * im4_7p - C97 * im5_6p; + vec[4] = re1 + C93 * re2_9p - C97 * re3_8p - C95 * re4_7p + C91 * re5_6p + C94 * im2_9m + C98 * im3_8m - + C96 * im4_7m - C92 * im5_6m; + vec[14] = re1 + C93 * re2_9p - C97 * re3_8p - C95 * re4_7p + C91 * re5_6p - C94 * im2_9m - C98 * im3_8m + + C96 * im4_7m + C92 * im5_6m; + vec[5] = im1 - C94 * re2_9m - C98 * re3_8m + C96 * re4_7m + C92 * re5_6m + C93 * im2_9p - C97 * im3_8p - + C95 * im4_7p + C91 * im5_6p; + vec[15] = im1 + C94 * re2_9m + C98 * re3_8m - C96 * re4_7m - C92 * re5_6m + C93 * im2_9p - C97 * im3_8p - + C95 * im4_7p + C91 * im5_6p; + vec[6] = re1 - C95 * (re2_9p + re3_8p + re5_6p) + re4_7p + C96 * (im2_9m - im3_8m + im5_6m); + vec[12] = re1 - C95 * (re2_9p + re3_8p + re5_6p) + re4_7p - C96 * (im2_9m - im3_8m + im5_6m); + vec[7] = im1 - C96 * (re2_9m - re3_8m + re5_6m) - C95 * (im2_9p + im3_8p + im5_6p) + im4_7p; + vec[13] = im1 + C96 * (re2_9m - re3_8m + re5_6m) - C95 * (im2_9p + im3_8p + im5_6p) + im4_7p; + vec[8] = re1 - C97 * re2_9p + C91 * re3_8p - C95 * re4_7p + C93 * re5_6p + C98 * im2_9m - C92 * im3_8m + + C96 * im4_7m - C94 * im5_6m; + vec[10] = re1 - C97 * re2_9p + C91 * re3_8p - C95 * re4_7p + C93 * re5_6p - C98 * im2_9m + C92 * im3_8m - + C96 * im4_7m + C94 * im5_6m; + vec[9] = im1 - C98 * re2_9m + C92 * re3_8m - C96 * re4_7m + C94 * re5_6m - C97 * im2_9p + C91 * im3_8p - + C95 * im4_7p + C93 * im5_6p; + vec[11] = im1 + C98 * re2_9m - C92 * re3_8m + C96 * re4_7m - C94 * re5_6m - C97 * im2_9p + C91 * im3_8p - + C95 * im4_7p + C93 * im5_6p; +} + diff --git a/lc3plus/fft/fft_32.h b/lc3plus/fft/fft_32.h new file mode 100755 index 0000000000..48b891108b --- /dev/null +++ b/lc3plus/fft/fft_32.h @@ -0,0 +1,467 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft32(LC3_FLOAT* vec) +{ + const LC3_FLOAT INV_SQRT2 = 7.071067811865475e-1; + const LC3_FLOAT COS_PI_DIV8 = 9.238795325112867e-1; + const LC3_FLOAT COS_3PI_DIV8 = 3.826834323650898e-1; + const LC3_FLOAT SQRT2PLUS1 = 2.414213562373095; + const LC3_FLOAT SQRT2MINUS1 = 4.142135623730952e-1; + + const LC3_FLOAT c[4] = {9.807852804032304e-1, 8.314696123025452e-1, 5.555702330196023e-1, 1.950903220161283e-1}; + + LC3_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, + temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp110, temp111, temp112, + temp113, temp114, temp115, temp20, temp21, temp22, temp23, temp24, temp25, temp26, temp27, temp28, temp29, + temp210, temp211, temp212, temp213, temp214, temp215, temp30, temp31, temp32, temp33, temp34, temp35, temp36, + temp37, temp38, temp39, temp310, temp311, temp312, temp313, temp314, temp315, temp316, temp317, temp318, + temp319, temp320, temp321, temp322, temp323, temp324, temp325, temp326, temp327, temp328, temp329, temp330, + temp331, temp40, temp41, temp42, temp43, temp44, temp45, temp46, temp47, temp48, temp49, temp410, temp411, + temp412, temp413, temp414, temp415; + + temp20 = vec[2] - vec[34]; + temp21 = vec[3] - vec[35]; + temp30 = vec[0] + vec[32]; + temp31 = vec[1] + vec[33]; + temp32 = vec[2] + vec[34]; + temp33 = vec[3] + vec[35]; + + temp22 = vec[6] - vec[38]; + temp23 = vec[7] - vec[39]; + temp34 = vec[4] + vec[36]; + temp35 = vec[5] + vec[37]; + temp36 = vec[6] + vec[38]; + temp37 = vec[7] + vec[39]; + + temp24 = vec[10] - vec[42]; + temp25 = vec[11] - vec[43]; + temp38 = vec[8] + vec[40]; + temp39 = vec[9] + vec[41]; + temp310 = vec[10] + vec[42]; + temp311 = vec[11] + vec[43]; + + temp26 = vec[14] - vec[46]; + temp27 = vec[15] - vec[47]; + temp312 = vec[12] + vec[44]; + temp313 = vec[13] + vec[45]; + temp314 = vec[14] + vec[46]; + temp315 = vec[15] + vec[47]; + + temp28 = vec[18] - vec[50]; + temp29 = vec[19] - vec[51]; + temp316 = vec[16] + vec[48]; + temp317 = vec[17] + vec[49]; + temp318 = vec[18] + vec[50]; + temp319 = vec[19] + vec[51]; + + temp210 = vec[22] - vec[54]; + temp211 = vec[23] - vec[55]; + temp320 = vec[20] + vec[52]; + temp321 = vec[21] + vec[53]; + temp322 = vec[22] + vec[54]; + temp323 = vec[23] + vec[55]; + + temp212 = vec[26] - vec[58]; + temp213 = vec[27] - vec[59]; + temp324 = vec[24] + vec[56]; + temp325 = vec[25] + vec[57]; + temp326 = vec[26] + vec[58]; + temp327 = vec[27] + vec[59]; + + temp214 = vec[30] - vec[62]; + temp215 = vec[31] - vec[63]; + temp328 = vec[28] + vec[60]; + temp329 = vec[29] + vec[61]; + temp330 = vec[30] + vec[62]; + temp331 = vec[31] + vec[63]; + + /* Pre-additions */ + temp41 = -(temp20 + temp214); + temp42 = temp20 - temp214; + temp40 = temp21 + temp215; + temp43 = temp21 - temp215; + temp45 = -(temp22 + temp212); + temp46 = temp22 - temp212; + temp44 = temp23 + temp213; + temp47 = temp23 - temp213; + temp49 = -(temp24 + temp210); + temp410 = temp24 - temp210; + temp48 = temp25 + temp211; + temp411 = temp25 - temp211; + temp413 = -(temp26 + temp28); + temp414 = temp26 - temp28; + temp412 = temp27 + temp29; + temp415 = temp27 - temp29; + + /* Core multiplications */ + temp20 = temp40 * c[3] + temp44 * c[2] + temp48 * c[1] + temp412 * c[0]; + temp24 = temp40 * c[2] + temp44 * c[0] + temp48 * c[3] - temp412 * c[1]; + temp28 = temp40 * c[1] + temp44 * c[3] - temp48 * c[0] + temp412 * c[2]; + temp212 = temp40 * c[0] - temp44 * c[1] + temp48 * c[2] - temp412 * c[3]; + temp21 = temp41 * c[3] + temp45 * c[2] + temp49 * c[1] + temp413 * c[0]; + temp25 = temp41 * c[2] + temp45 * c[0] + temp49 * c[3] - temp413 * c[1]; + temp29 = temp41 * c[1] + temp45 * c[3] - temp49 * c[0] + temp413 * c[2]; + temp213 = temp41 * c[0] - temp45 * c[1] + temp49 * c[2] - temp413 * c[3]; + temp22 = temp42 * c[0] + temp46 * c[1] + temp410 * c[2] + temp414 * c[3]; + temp26 = temp42 * c[1] - temp46 * c[3] - temp410 * c[0] - temp414 * c[2]; + temp210 = temp42 * c[2] - temp46 * c[0] + temp410 * c[3] + temp414 * c[1]; + temp214 = temp42 * c[3] - temp46 * c[2] + temp410 * c[1] - temp414 * c[0]; + temp23 = temp43 * c[0] + temp47 * c[1] + temp411 * c[2] + temp415 * c[3]; + temp27 = temp43 * c[1] - temp47 * c[3] - temp411 * c[0] - temp415 * c[2]; + temp211 = temp43 * c[2] - temp47 * c[0] + temp411 * c[3] + temp415 * c[1]; + temp215 = temp43 * c[3] - temp47 * c[2] + temp411 * c[1] - temp415 * c[0]; + + /* Post-additions */ + temp40 = temp20 + temp22; + temp414 = temp20 - temp22; + temp41 = temp21 + temp23; + temp415 = temp21 - temp23; + temp42 = temp24 + temp26; + temp412 = temp24 - temp26; + temp43 = temp25 + temp27; + temp413 = temp25 - temp27; + temp44 = temp28 + temp210; + temp410 = temp28 - temp210; + temp45 = temp29 + temp211; + temp411 = temp29 - temp211; + temp46 = temp212 + temp214; + temp48 = temp212 - temp214; + temp47 = temp213 + temp215; + temp49 = temp213 - temp215; + + /* fft16(temp3); */ + /* even */ + temp10 = temp30 + temp316; + temp11 = temp31 + temp317; + temp12 = temp32 + temp318; + temp13 = temp33 + temp319; + temp14 = temp34 + temp320; + temp15 = temp35 + temp321; + temp16 = temp36 + temp322; + temp17 = temp37 + temp323; + temp18 = temp38 + temp324; + temp19 = temp39 + temp325; + temp110 = temp310 + temp326; + temp111 = temp311 + temp327; + temp112 = temp312 + temp328; + temp113 = temp313 + temp329; + temp114 = temp314 + temp330; + temp115 = temp315 + temp331; + + /* Pre-additions */ + tmp0 = temp10 + temp18; + tmp2 = temp10 - temp18; + tmp1 = temp11 + temp19; + tmp3 = temp11 - temp19; + tmp4 = temp12 + temp110; + tmp6 = temp12 - temp110; + tmp5 = temp13 + temp111; + tmp7 = temp13 - temp111; + tmp8 = temp14 + temp112; + tmp10 = temp14 - temp112; + tmp9 = temp15 + temp113; + tmp11 = temp15 - temp113; + tmp12 = temp16 + temp114; + tmp14 = temp16 - temp114; + tmp13 = temp17 + temp115; + tmp15 = temp17 - temp115; + + /* Pre-additions and core multiplications */ + temp20 = tmp0 + tmp8; + temp24 = tmp0 - tmp8; + temp21 = tmp1 + tmp9; + temp25 = tmp1 - tmp9; + temp28 = tmp2 - tmp11; + temp210 = tmp2 + tmp11; + temp29 = tmp3 + tmp10; + temp211 = tmp3 - tmp10; + temp22 = tmp4 + tmp12; + temp27 = tmp4 - tmp12; + temp23 = tmp5 + tmp13; + temp26 = tmp13 - tmp5; + + tmp1 = tmp6 + tmp14; + tmp2 = tmp6 - tmp14; + tmp0 = tmp7 + tmp15; + tmp3 = tmp7 - tmp15; + temp212 = (tmp0 + tmp2) * INV_SQRT2; + temp214 = (tmp0 - tmp2) * INV_SQRT2; + temp213 = (tmp3 - tmp1) * INV_SQRT2; + temp215 = (tmp1 + tmp3) * -INV_SQRT2; + + /* odd */ + temp10 = temp30 - temp316; + temp11 = temp31 - temp317; + temp12 = temp32 - temp318; + temp13 = temp33 - temp319; + temp14 = temp34 - temp320; + temp15 = temp35 - temp321; + temp16 = temp36 - temp322; + temp17 = temp37 - temp323; + temp18 = temp38 - temp324; + temp19 = temp39 - temp325; + temp110 = temp310 - temp326; + temp111 = temp311 - temp327; + temp112 = temp312 - temp328; + temp113 = temp313 - temp329; + temp114 = temp314 - temp330; + temp115 = temp315 - temp331; + + /* Post-additions */ + temp30 = temp20 + temp22; + temp316 = temp20 - temp22; + temp31 = temp21 + temp23; + temp317 = temp21 - temp23; + temp38 = temp24 - temp26; + temp324 = temp24 + temp26; + temp39 = temp25 - temp27; + temp325 = temp25 + temp27; + temp312 = temp28 + temp214; + temp328 = temp28 - temp214; + temp313 = temp29 + temp215; + temp329 = temp29 - temp215; + temp34 = temp210 + temp212; + temp320 = temp210 - temp212; + temp35 = temp211 + temp213; + temp321 = temp211 - temp213; + + /* Pre-additions and core multiplications */ + tmp9 = (temp12 + temp114) * -COS_3PI_DIV8; + tmp10 = (temp12 - temp114) * COS_PI_DIV8; + tmp8 = (temp13 + temp115) * COS_3PI_DIV8; + tmp11 = (temp13 - temp115) * COS_PI_DIV8; + tmp5 = (temp14 + temp112) * -INV_SQRT2; + tmp6 = (temp14 - temp112) * INV_SQRT2; + tmp4 = (temp15 + temp113) * INV_SQRT2; + tmp7 = (temp15 - temp113) * INV_SQRT2; + tmp13 = (temp16 + temp110) * -COS_PI_DIV8; + tmp14 = (temp16 - temp110) * COS_3PI_DIV8; + tmp12 = (temp17 + temp111) * COS_PI_DIV8; + tmp15 = (temp17 - temp111) * COS_3PI_DIV8; + + /* Core multiplications */ + temp12 = tmp8 * SQRT2PLUS1 - tmp12 * SQRT2MINUS1; + temp13 = tmp9 * SQRT2PLUS1 - tmp13 * SQRT2MINUS1; + temp14 = tmp10 * SQRT2MINUS1 - tmp14 * SQRT2PLUS1; + temp15 = tmp11 * SQRT2MINUS1 - tmp15 * SQRT2PLUS1; + + /* Post-additions */ + tmp8 += tmp12; + tmp9 += tmp13; + tmp10 += tmp14; + tmp11 += tmp15; + temp16 = temp10 + tmp4; + temp110 = temp10 - tmp4; + temp17 = temp11 + tmp5; + temp111 = temp11 - tmp5; + + temp112 = tmp6 - temp19; + temp114 = tmp6 + temp19; + temp113 = temp18 + tmp7; + temp115 = temp18 - tmp7; + + tmp0 = temp16 - temp114; + tmp2 = temp16 + temp114; + tmp1 = temp17 + temp115; + tmp3 = temp17 - temp115; + tmp4 = temp110 + temp112; + tmp6 = temp110 - temp112; + tmp5 = temp111 + temp113; + tmp7 = temp111 - temp113; + + temp110 = tmp8 + tmp10; + tmp10 = tmp8 - tmp10; + temp111 = tmp9 + tmp11; + tmp11 = tmp9 - tmp11; + + tmp12 = temp12 + temp14; + tmp14 = temp12 - temp14; + tmp13 = temp13 + temp15; + tmp15 = temp13 - temp15; + + temp32 = tmp2 + temp110; + temp318 = tmp2 - temp110; + temp33 = tmp3 + temp111; + temp319 = tmp3 - temp111; + temp36 = tmp0 + tmp12; + temp322 = tmp0 - tmp12; + temp37 = tmp1 + tmp13; + temp323 = tmp1 - tmp13; + temp314 = tmp4 + tmp10; + temp330 = tmp4 - tmp10; + temp315 = tmp5 + tmp11; + temp331 = tmp5 - tmp11; + temp310 = tmp6 + tmp14; + temp326 = tmp6 - tmp14; + temp311 = tmp7 + tmp15; + temp327 = tmp7 - tmp15; + /* fft16(temp3); end */ + + /* fft8even(temp1); */ + temp10 = vec[0] - vec[32]; + temp11 = vec[1] - vec[33]; + temp12 = vec[4] - vec[36]; + temp13 = vec[5] - vec[37]; + temp14 = vec[8] - vec[40]; + temp15 = vec[9] - vec[41]; + temp16 = vec[12] - vec[44]; + temp17 = vec[13] - vec[45]; + temp18 = vec[16] - vec[48]; + temp19 = vec[17] - vec[49]; + temp110 = vec[20] - vec[52]; + temp111 = vec[21] - vec[53]; + temp112 = vec[24] - vec[56]; + temp113 = vec[25] - vec[57]; + temp114 = vec[28] - vec[60]; + temp115 = vec[29] - vec[61]; + + /* Pre-additions and core multiplications */ + tmp9 = (temp12 + temp114) * -COS_3PI_DIV8; + tmp10 = (temp12 - temp114) * COS_PI_DIV8; + tmp8 = (temp13 + temp115) * COS_3PI_DIV8; + tmp11 = (temp13 - temp115) * COS_PI_DIV8; + tmp5 = (temp14 + temp112) * -INV_SQRT2; + tmp6 = (temp14 - temp112) * INV_SQRT2; + tmp4 = (temp15 + temp113) * INV_SQRT2; + tmp7 = (temp15 - temp113) * INV_SQRT2; + tmp13 = (temp16 + temp110) * -COS_PI_DIV8; + tmp14 = (temp16 - temp110) * COS_3PI_DIV8; + tmp12 = (temp17 + temp111) * COS_PI_DIV8; + tmp15 = (temp17 - temp111) * COS_3PI_DIV8; + + /* Core multiplications */ + temp12 = tmp8 * SQRT2PLUS1 - tmp12 * SQRT2MINUS1; + temp13 = tmp9 * SQRT2PLUS1 - tmp13 * SQRT2MINUS1; + temp14 = tmp10 * SQRT2MINUS1 - tmp14 * SQRT2PLUS1; + temp15 = tmp11 * SQRT2MINUS1 - tmp15 * SQRT2PLUS1; + + /* Post-additions */ + tmp8 += tmp12; + tmp9 += tmp13; + tmp10 += tmp14; + tmp11 += tmp15; + temp16 = temp10 + tmp4; + temp110 = temp10 - tmp4; + temp17 = temp11 + tmp5; + temp111 = temp11 - tmp5; + + temp112 = tmp6 - temp19; + temp114 = tmp6 + temp19; + temp113 = temp18 + tmp7; + temp115 = temp18 - tmp7; + + tmp0 = temp16 - temp114; + tmp2 = temp16 + temp114; + tmp1 = temp17 + temp115; + tmp3 = temp17 - temp115; + tmp4 = temp110 + temp112; + tmp6 = temp110 - temp112; + tmp5 = temp111 + temp113; + tmp7 = temp111 - temp113; + + temp110 = tmp8 + tmp10; + tmp10 = tmp8 - tmp10; + temp111 = tmp9 + tmp11; + tmp11 = tmp9 - tmp11; + + tmp12 = temp12 + temp14; + tmp14 = temp12 - temp14; + tmp13 = temp13 + temp15; + tmp15 = temp13 - temp15; + + temp10 = tmp2 + temp110; + temp18 = tmp2 - temp110; + temp11 = tmp3 + temp111; + temp19 = tmp3 - temp111; + temp12 = tmp0 + tmp12; + temp110 = tmp0 - tmp12; + temp13 = tmp1 + tmp13; + temp111 = tmp1 - tmp13; + temp16 = tmp4 + tmp10; + temp114 = tmp4 - tmp10; + temp17 = tmp5 + tmp11; + temp115 = tmp5 - tmp11; + temp14 = tmp6 + tmp14; + temp112 = tmp6 - tmp14; + temp15 = tmp7 + tmp15; + temp113 = tmp7 - tmp15; + /* fft8even(temp1); end */ + + *vec++ = temp30; + *vec++ = temp31; + *vec++ = temp10 + temp40; + *vec++ = temp11 + temp41; + *vec++ = temp32; + *vec++ = temp33; + *vec++ = temp12 + temp42; + *vec++ = temp13 + temp43; + *vec++ = temp34; + *vec++ = temp35; + *vec++ = temp14 + temp44; + *vec++ = temp15 + temp45; + *vec++ = temp36; + *vec++ = temp37; + *vec++ = temp16 + temp46; + *vec++ = temp17 + temp47; + *vec++ = temp38; + *vec++ = temp39; + *vec++ = temp18 + temp48; + *vec++ = temp19 + temp49; + *vec++ = temp310; + *vec++ = temp311; + *vec++ = temp110 + temp410; + *vec++ = temp111 + temp411; + *vec++ = temp312; + *vec++ = temp313; + *vec++ = temp112 + temp412; + *vec++ = temp113 + temp413; + *vec++ = temp314; + *vec++ = temp315; + *vec++ = temp114 + temp414; + *vec++ = temp115 + temp415; + *vec++ = temp316; + *vec++ = temp317; + *vec++ = temp10 - temp40; + *vec++ = temp11 - temp41; + *vec++ = temp318; + *vec++ = temp319; + *vec++ = temp12 - temp42; + *vec++ = temp13 - temp43; + *vec++ = temp320; + *vec++ = temp321; + *vec++ = temp14 - temp44; + *vec++ = temp15 - temp45; + *vec++ = temp322; + *vec++ = temp323; + *vec++ = temp16 - temp46; + *vec++ = temp17 - temp47; + *vec++ = temp324; + *vec++ = temp325; + *vec++ = temp18 - temp48; + *vec++ = temp19 - temp49; + *vec++ = temp326; + *vec++ = temp327; + *vec++ = temp110 - temp410; + *vec++ = temp111 - temp411; + *vec++ = temp328; + *vec++ = temp329; + *vec++ = temp112 - temp412; + *vec++ = temp113 - temp413; + *vec++ = temp330; + *vec++ = temp331; + *vec++ = temp114 - temp414; + *vec++ = temp115 - temp415; +} diff --git a/lc3plus/fft/fft_384_768.h b/lc3plus/fft/fft_384_768.h new file mode 100755 index 0000000000..47f42e90d6 --- /dev/null +++ b/lc3plus/fft/fft_384_768.h @@ -0,0 +1,103 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft384(LC3_FLOAT* restrict in) +{ + const LC3_INT table1[384] = { + 0, 256, 128, 129, 1, 257, 258, 130, 2, 3, 259, 131, 132, 4, 260, 261, 133, 5, 6, 262, 134, 135, + 7, 263, 264, 136, 8, 9, 265, 137, 138, 10, 266, 267, 139, 11, 12, 268, 140, 141, 13, 269, 270, 142, + 14, 15, 271, 143, 144, 16, 272, 273, 145, 17, 18, 274, 146, 147, 19, 275, 276, 148, 20, 21, 277, 149, + 150, 22, 278, 279, 151, 23, 24, 280, 152, 153, 25, 281, 282, 154, 26, 27, 283, 155, 156, 28, 284, 285, + 157, 29, 30, 286, 158, 159, 31, 287, 288, 160, 32, 33, 289, 161, 162, 34, 290, 291, 163, 35, 36, 292, + 164, 165, 37, 293, 294, 166, 38, 39, 295, 167, 168, 40, 296, 297, 169, 41, 42, 298, 170, 171, 43, 299, + 300, 172, 44, 45, 301, 173, 174, 46, 302, 303, 175, 47, 48, 304, 176, 177, 49, 305, 306, 178, 50, 51, + 307, 179, 180, 52, 308, 309, 181, 53, 54, 310, 182, 183, 55, 311, 312, 184, 56, 57, 313, 185, 186, 58, + 314, 315, 187, 59, 60, 316, 188, 189, 61, 317, 318, 190, 62, 63, 319, 191, 192, 64, 320, 321, 193, 65, + 66, 322, 194, 195, 67, 323, 324, 196, 68, 69, 325, 197, 198, 70, 326, 327, 199, 71, 72, 328, 200, 201, + 73, 329, 330, 202, 74, 75, 331, 203, 204, 76, 332, 333, 205, 77, 78, 334, 206, 207, 79, 335, 336, 208, + 80, 81, 337, 209, 210, 82, 338, 339, 211, 83, 84, 340, 212, 213, 85, 341, 342, 214, 86, 87, 343, 215, + 216, 88, 344, 345, 217, 89, 90, 346, 218, 219, 91, 347, 348, 220, 92, 93, 349, 221, 222, 94, 350, 351, + 223, 95, 96, 352, 224, 225, 97, 353, 354, 226, 98, 99, 355, 227, 228, 100, 356, 357, 229, 101, 102, 358, + 230, 231, 103, 359, 360, 232, 104, 105, 361, 233, 234, 106, 362, 363, 235, 107, 108, 364, 236, 237, 109, 365, + 366, 238, 110, 111, 367, 239, 240, 112, 368, 369, 241, 113, 114, 370, 242, 243, 115, 371, 372, 244, 116, 117, + 373, 245, 246, 118, 374, 375, 247, 119, 120, 376, 248, 249, 121, 377, 378, 250, 122, 123, 379, 251, 252, 124, + 380, 381, 253, 125, 126, 382, 254, 255, 127, 383}; + const LC3_INT table2[384] = { + 0, 128, 256, 3, 131, 259, 6, 134, 262, 9, 137, 265, 12, 140, 268, 15, 143, 271, 18, 146, 274, 21, + 149, 277, 24, 152, 280, 27, 155, 283, 30, 158, 286, 33, 161, 289, 36, 164, 292, 39, 167, 295, 42, 170, + 298, 45, 173, 301, 48, 176, 304, 51, 179, 307, 54, 182, 310, 57, 185, 313, 60, 188, 316, 63, 191, 319, + 66, 194, 322, 69, 197, 325, 72, 200, 328, 75, 203, 331, 78, 206, 334, 81, 209, 337, 84, 212, 340, 87, + 215, 343, 90, 218, 346, 93, 221, 349, 96, 224, 352, 99, 227, 355, 102, 230, 358, 105, 233, 361, 108, 236, + 364, 111, 239, 367, 114, 242, 370, 117, 245, 373, 120, 248, 376, 123, 251, 379, 126, 254, 382, 129, 257, 1, + 132, 260, 4, 135, 263, 7, 138, 266, 10, 141, 269, 13, 144, 272, 16, 147, 275, 19, 150, 278, 22, 153, + 281, 25, 156, 284, 28, 159, 287, 31, 162, 290, 34, 165, 293, 37, 168, 296, 40, 171, 299, 43, 174, 302, + 46, 177, 305, 49, 180, 308, 52, 183, 311, 55, 186, 314, 58, 189, 317, 61, 192, 320, 64, 195, 323, 67, + 198, 326, 70, 201, 329, 73, 204, 332, 76, 207, 335, 79, 210, 338, 82, 213, 341, 85, 216, 344, 88, 219, + 347, 91, 222, 350, 94, 225, 353, 97, 228, 356, 100, 231, 359, 103, 234, 362, 106, 237, 365, 109, 240, 368, + 112, 243, 371, 115, 246, 374, 118, 249, 377, 121, 252, 380, 124, 255, 383, 127, 258, 2, 130, 261, 5, 133, + 264, 8, 136, 267, 11, 139, 270, 14, 142, 273, 17, 145, 276, 20, 148, 279, 23, 151, 282, 26, 154, 285, + 29, 157, 288, 32, 160, 291, 35, 163, 294, 38, 166, 297, 41, 169, 300, 44, 172, 303, 47, 175, 306, 50, + 178, 309, 53, 181, 312, 56, 184, 315, 59, 187, 318, 62, 190, 321, 65, 193, 324, 68, 196, 327, 71, 199, + 330, 74, 202, 333, 77, 205, 336, 80, 208, 339, 83, 211, 342, 86, 214, 345, 89, 217, 348, 92, 220, 351, + 95, 223, 354, 98, 226, 357, 101, 229, 360, 104, 232, 363, 107, 235, 366, 110, 238, 369, 113, 241, 372, 116, + 244, 375, 119, 247, 378, 122, 250, 381, 125, 253}; + + const LC3_INT L = 384; + const LC3_INT A = 3; + const LC3_INT B = 128; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_INT k, l; + LC3_FLOAT temp[256], out[768]; + + for (k = 0; k < A; k++) { + for (l = 0; l < B; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += A; + } + + fft128(temp); /* 128-point FFT */ + idx1 -= L; + + for (l = 0; l < B; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += A; + } + + idx1 -= L - 1; + } + + idx1 -= A; + + for (k = 0; k < B; k++) { + for (l = 0; l < A; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft3(temp); /* 3-point FFT */ + + for (l = 0; l < A; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} + diff --git a/lc3plus/fft/fft_60_128.h b/lc3plus/fft/fft_60_128.h new file mode 100755 index 0000000000..75f1aaef45 --- /dev/null +++ b/lc3plus/fft/fft_60_128.h @@ -0,0 +1,161 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft60(LC3_FLOAT* in) +{ + const LC3_INT table1[] = {0, 45, 30, 15, 16, 1, 46, 31, 32, 17, 2, 47, 48, 33, 18, 3, 4, 49, 34, 19, + 20, 5, 50, 35, 36, 21, 6, 51, 52, 37, 22, 7, 8, 53, 38, 23, 24, 9, 54, 39, + 40, 25, 10, 55, 56, 41, 26, 11, 12, 57, 42, 27, 28, 13, 58, 43, 44, 29, 14, 59}; + const LC3_INT table2[] = {0, 15, 30, 45, 4, 19, 34, 49, 8, 23, 38, 53, 12, 27, 42, 57, 16, 31, 46, 1, + 20, 35, 50, 5, 24, 39, 54, 9, 28, 43, 58, 13, 32, 47, 2, 17, 36, 51, 6, 21, + 40, 55, 10, 25, 44, 59, 14, 29, 48, 3, 18, 33, 52, 7, 22, 37, 56, 11, 26, 41}; + const LC3_INT a = 4; + const LC3_INT b = 15; + const LC3_INT L = 60; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_FLOAT temp[30], out[120]; + LC3_INT k, l; + + for (k = 0; k < a; k++) { + for (l = 0; l < b; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += a; + } + + fft15(temp); /* 15-point FFT */ + idx1 -= L; + + for (l = 0; l < b; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += a; + } + idx1 -= L - 1; + } + + idx1 -= a; + + for (k = 0; k < b; k++) { + for (l = 0; l < a; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft4(temp); /* 4-point FFT */ + + for (l = 0; l < a; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} + +static void fft64(LC3_FLOAT* vec) +{ + const LC3_FLOAT w[] = { + 1.0000000000f, 0.9951847267f, 0.9807852804f, 0.9569403357f, 0.9238795325f, 0.8819212643f, 0.8314696123f, + 0.7730104534f, 0.7071067812f, 0.6343932842f, 0.5555702330f, 0.4713967368f, 0.3826834324f, 0.2902846773f, + 0.1950903220f, 0.0980171403f, 0.0000000000f, -0.0980171403f, -0.1950903220f, -0.2902846773f, -0.3826834324f, + -0.4713967368f, -0.5555702330f, -0.6343932842f, -0.7071067812f, -0.7730104534f, -0.8314696123f, -0.8819212643f, + -0.9238795325f, -0.9569403357f, -0.9807852804f, -0.9951847267f, -1.0000000000f, -0.9951847267f, -0.9807852804f, + -0.9569403357f, -0.9238795325f, -0.8819212643f, -0.8314696123f, -0.7730104534f, -0.7071067812f, -0.6343932842f, + -0.5555702330f, -0.4713967368f, -0.3826834324f, -0.2902846773f, -0.1950903220f, -0.0980171403f}; + + LC3_FLOAT temp1[64], temp2[64]; + LC3_INT i; + + for (i = 0; i < 32; i++) { + temp1[2 * i] = vec[4 * i]; + temp1[2 * i + 1] = vec[4 * i + 1]; + temp2[2 * i] = vec[4 * i + 2]; + temp2[2 * i + 1] = vec[4 * i + 3]; + } + + fft32(temp1); + fft32(temp2); + + for (i = 0; i < 32; i++) { + LC3_FLOAT re, im, wre, wim, tre, tim; + + re = temp2[2 * i]; + im = temp2[2 * i + 1]; + + wre = w[i]; + wim = w[i + 16]; + + tre = re * wre - im * wim; + tim = re * wim + im * wre; + + vec[2 * i] = temp1[2 * i] + tre; + vec[2 * i + 1] = temp1[2 * i + 1] + tim; + vec[2 * i + 64] = temp1[2 * i] - tre; + vec[2 * i + 65] = temp1[2 * i + 1] - tim; + } +} + +static void fft128(LC3_FLOAT* vec) +{ + const LC3_FLOAT w[] = { + 1.0000000000f, 0.9987954562f, 0.9951847267f, 0.9891765100f, 0.9807852804f, 0.9700312532f, 0.9569403357f, + 0.9415440652f, 0.9238795325f, 0.9039892931f, 0.8819212643f, 0.8577286100f, 0.8314696123f, 0.8032075315f, + 0.7730104534f, 0.7409511254f, 0.7071067812f, 0.6715589548f, 0.6343932842f, 0.5956993045f, 0.5555702330f, + 0.5141027442f, 0.4713967368f, 0.4275550934f, 0.3826834324f, 0.3368898534f, 0.2902846773f, 0.2429801799f, + 0.1950903220f, 0.1467304745f, 0.0980171403f, 0.0490676743f, 0.0000000000f, -0.0490676743f, -0.0980171403f, + -0.1467304745f, -0.1950903220f, -0.2429801799f, -0.2902846773f, -0.3368898534f, -0.3826834324f, -0.4275550934f, + -0.4713967368f, -0.5141027442f, -0.5555702330f, -0.5956993045f, -0.6343932842f, -0.6715589548f, -0.7071067812f, + -0.7409511254f, -0.7730104534f, -0.8032075315f, -0.8314696123f, -0.8577286100f, -0.8819212643f, -0.9039892931f, + -0.9238795325f, -0.9415440652f, -0.9569403357f, -0.9700312532f, -0.9807852804f, -0.9891765100f, -0.9951847267f, + -0.9987954562f, -1.0000000000f, -0.9987954562f, -0.9951847267f, -0.9891765100f, -0.9807852804f, -0.9700312532f, + -0.9569403357f, -0.9415440652f, -0.9238795325f, -0.9039892931f, -0.8819212643f, -0.8577286100f, -0.8314696123f, + -0.8032075315f, -0.7730104534f, -0.7409511254f, -0.7071067812f, -0.6715589548f, -0.6343932842f, -0.5956993045f, + -0.5555702330f, -0.5141027442f, -0.4713967368f, -0.4275550934f, -0.3826834324f, -0.3368898534f, -0.2902846773f, + -0.2429801799f, -0.1950903220f, -0.1467304745f, -0.0980171403f, -0.0490676743f, + }; + + LC3_FLOAT temp1[128], temp2[128]; + LC3_INT i; + + for (i = 0; i < 64; i++) { + temp1[2 * i] = vec[4 * i]; + temp1[2 * i + 1] = vec[4 * i + 1]; + temp2[2 * i] = vec[4 * i + 2]; + temp2[2 * i + 1] = vec[4 * i + 3]; + } + + fft64(temp1); + fft64(temp2); + + for (i = 0; i < 64; i++) { + LC3_FLOAT re, im, wre, wim, tre, tim; + + re = temp2[2 * i]; + im = temp2[2 * i + 1]; + + wre = w[i]; + wim = w[i + 32]; + + tre = re * wre - im * wim; + tim = re * wim + im * wre; + + vec[2 * i] = temp1[2 * i] + tre; + vec[2 * i + 1] = temp1[2 * i + 1] + tim; + vec[2 * i + 128] = temp1[2 * i] - tre; + vec[2 * i + 129] = temp1[2 * i + 1] - tim; + } +} diff --git a/lc3plus/fft/fft_generic.h b/lc3plus/fft/fft_generic.h new file mode 100755 index 0000000000..e517ffb250 --- /dev/null +++ b/lc3plus/fft/fft_generic.h @@ -0,0 +1,699 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +#define FFT_INTERNAL_TRIG_PREC double +#define BORDER_FOR_SECOND_SCRATCH 100 + +static const LC3_INT primeFactors[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 0}; + +/* fft, returns 1 if length is supported and fft was applied */ +static LC3_INT fft_n(LC3_FLOAT* x, LC3_INT length) +{ + switch (length) { + case 2: + fft2(x); + return 1; + case 3: + fft3(x); + return 1; + case 4: + fft4(x); + return 1; + case 5: + fft5(x); + return 1; + case 8: + fft8(x); + return 1; + case 9: + fft9(x); + return 1; + case 15: + fft15(x); + return 1; + case 16: + fft16(x); + return 1; + case 32: + fft32(x); + return 1; + case 60: + fft60(x); + return 1; + case 64: + fft64(x); + return 1; + case 128: + fft128(x); + return 1; + case 240: + fft240(x); + return 1; + case 256: + LC3_cfft(x, x + 1, 256, 2, -1); + return 1; + case 384: + fft384(x); + return 1; + case 480: + fft480(x); + return 1; + case 512: + LC3_cfft(x, x + 1, 512, 2, -1); + return 1; + case 1024: + LC3_cfft(x, x + 1, 1024, 2, -1); + return 1; + default: + return 0; + } +} + + +/* returns 1 on success or 0 if IISFFT_MAXFACTORS is too small */ +static LC3_INT factorize(LC3_INT length, LC3_INT* restrict numFactors, LC3_INT* restrict factor, + LC3_INT* restrict isPrime) +{ + LC3_INT remainder = length; + LC3_INT idx = 0, cnt = 0; + LC3_INT actFac = primeFactors[idx]; + LC3_INT inc = 0; + + *numFactors = 0; + + while (remainder > 1 && actFac != 0) { + if (remainder % actFac == 0) { + if (inc == 0) { + inc = 1; + (*numFactors)++; + } + remainder /= actFac; + } else { + actFac = primeFactors[++idx]; + inc = 0; + } + } + if (remainder > 1) { + (*numFactors)++; + } + + if (*numFactors > IISFFT_MAXFACTORS) + return 0; + + idx = 0, cnt = 0, inc = 0; + remainder = length; + actFac = primeFactors[idx]; + (factor)[cnt] = 1; + while (remainder > 1 && actFac != 0) { + if (remainder % actFac == 0) { + (factor)[cnt] *= actFac; + remainder /= actFac; + inc = 1; + if (factor[cnt] == actFac) { /* first appearance of the factor */ + isPrime[cnt] = 1; + } else { + isPrime[cnt] = 0; + } + } else { + actFac = primeFactors[++idx]; + if (inc == 1) { + cnt++; + } + inc = 0; + (factor)[cnt] = 1; + } + } + if (remainder > 1) { + factor[cnt] = remainder; + } + return 1; +} + +static void oddFFT(LC3_FLOAT* restrict x, LC3_INT length, LC3_FLOAT* restrict scratch) +{ + LC3_INT i, k, n; + LC3_FLOAT * src1, *src2, *dest1, *dest2; + FFT_INTERNAL_TRIG_PREC sinValOrg, cosValOrg; + + dest1 = scratch + 1; + dest2 = scratch + length + 1; + src1 = x + 2; + src2 = x + 2 * length - 1; + + scratch[0] = x[0]; + scratch[length] = x[1]; + + for (i = 2; i < length; i += 2) { + LC3_FLOAT tmp1R, tmp1I, tmp2R, tmp2I; + tmp1R = *src1++; + tmp1I = *src1++; + tmp2I = *src2--; + tmp2R = *src2--; + *dest1++ = tmp1R + tmp2R; + *dest1++ = tmp1R - tmp2R; + *dest2++ = tmp1I + tmp2I; + *dest2++ = tmp1I - tmp2I; + + x[0] += tmp1R + tmp2R; + x[1] += tmp1I + tmp2I; + } + + dest1 = x + 2; + dest2 = x + 2 * length - 2; + for (k = 2; k < length; k += 2) { + FFT_INTERNAL_TRIG_PREC sinVal = 0, cosVal = 1; + cosValOrg = LC3_COS(-M_PIl * k / length); + sinValOrg = LC3_SIN(-M_PIl * k / length); + + *dest1 = *dest2 = scratch[0]; + *(dest1 + 1) = *(dest2 + 1) = scratch[length]; + + src1 = scratch + 1; + src2 = scratch + length + 1; + + for (n = 2; n < length; n += 2) { + LC3_FLOAT rePre, reMre, imPim, imMim; + /* + cos(x+y) = cox(x) cos(y) - sin(x) sin(y); + sin(x+y) = sin(x) cos(y) + cos(x) sin(y); + */ + FFT_INTERNAL_TRIG_PREC tmp = cosVal * cosValOrg - sinVal * sinValOrg; + sinVal = sinVal * cosValOrg + cosVal * sinValOrg; + cosVal = tmp; + + rePre = *src1++; + reMre = *src1++; + imPim = *src2++; + imMim = *src2++; + + *dest1 += (LC3_FLOAT)cosVal * rePre - (LC3_FLOAT)sinVal * imMim; + *(dest1 + 1) += (LC3_FLOAT)sinVal * reMre + (LC3_FLOAT)cosVal * imPim; + *dest2 += (LC3_FLOAT)cosVal * rePre + (LC3_FLOAT)sinVal * imMim; + *(dest2 + 1) += (LC3_FLOAT)-sinVal * reMre + (LC3_FLOAT)cosVal * imPim; + } + dest1 += 2; + dest2 -= 2; + } +} + +static LC3_INT findInverse(LC3_INT a, LC3_INT b) +{ + LC3_INT b0 = b, t, q; + LC3_INT x0 = 0, x1 = 1; + + if (b == 1) { + return 1; + } + + while (a > 1) { + q = a / b; + t = b, b = a % b, a = t; + t = x0, x0 = x1 - q * x0, x1 = t; + } + + if (x1 < 0) { + x1 += b0; + } + + return x1; +} + +static LC3_INT getGeneratorStupid(LC3_INT groupLength) +{ + LC3_INT generator = 2; /* start value */ + LC3_INT count = 1, number = generator; + + while (generator < 100) { /* hopefully the generator is smaller than 100 */ + while (number != 1) { + number = (number * generator) % groupLength; + count++; + } + if (count == groupLength - 1) { + return generator; + } else { + generator++; + count = 1; + number = generator; + } + } + + return -1; +} + +static LC3_INT getGenerator(LC3_INT groupLength) +{ + LC3_INT generator = 2; /* start value */ + LC3_INT count, number, factorCount, found, count2; + LC3_INT factors[16] = {0}; + + /* factorize: only for a group length with factors < 300 */ + factorCount = 0; + number = groupLength - 1; + found = 0; + count = 0; + while (number != 1) { + if (primeFactors[count] == 0) { + /* Not all factors listed */ + return getGeneratorStupid(groupLength); + } + if (number % primeFactors[count] == 0) { + number /= primeFactors[count]; + if (found == 0) { + factors[factorCount++] = primeFactors[count]; + found = 1; + } + } else { + count++; + found = 0; + } + } + + for (count = 0; factors[count] != 0; count++) { + factors[count] = (groupLength - 1) / factors[count]; + } + + /* calculate generator */ + number = generator; + count = 0; + while (factors[count] != 0) { + for (count2 = 0; count2 < factors[count] - 1; count2++) { + number = (number * generator) % groupLength; + } + if (number != 1) { + count++; + number = generator; + if (factors[count] == 0) { + return generator; + } + } else { + count = 0; + generator++; + number = generator; + } + } + + return -1; +} + +static void primeFFT(LC3_FLOAT* restrict x, LC3_INT length, LC3_FLOAT* restrict scratch, LC3_INT* restrict scratch2) +{ + LC3_INT i, k, middle = (length - 1) / 2; + LC3_FLOAT *src1, *src2, *dest1, *dest2; + LC3_INT * mapping, *map; + LC3_INT generator; + + LC3_INT mappingTable[25][97] = { + {0, 2}, + {0, 2, 4}, + {0, 2, 4, 8, 6}, + {0, 2, 6, 4, 12, 8, 10}, + {0, 2, 4, 8, 16, 10, 20, 18, 14, 6, 12}, + {0, 2, 4, 8, 16, 6, 12, 24, 22, 18, 10, 20, 14}, + {0, 2, 6, 18, 20, 26, 10, 30, 22, 32, 28, 16, 14, 8, 24, 4, 12}, + {0, 2, 4, 8, 16, 32, 26, 14, 28, 18, 36, 34, 30, 22, 6, 12, 24, 10, 20}, + {0, 2, 10, 4, 20, 8, 40, 16, 34, 32, 22, 18, 44, 36, 42, 26, 38, 6, 30, 12, 14, 24, 28}, + {0, 2, 4, 8, 16, 32, 6, 12, 24, 48, 38, 18, 36, 14, 28, 56, 54, 50, 42, 26, 52, 46, 34, 10, 20, 40, 22, 44, 30}, + {0, 2, 6, 18, 54, 38, 52, 32, 34, 40, 58, 50, 26, 16, 48, 20, + 60, 56, 44, 8, 24, 10, 30, 28, 22, 4, 12, 36, 46, 14, 42}, + {0, 2, 4, 8, 16, 32, 64, 54, 34, 68, 62, 50, 26, 52, 30, 60, 46, 18, 36, + 72, 70, 66, 58, 42, 10, 20, 40, 6, 12, 24, 48, 22, 44, 14, 28, 56, 38}, + {0, 2, 12, 72, 22, 50, 54, 78, 58, 20, 38, 64, 56, 8, 48, 42, 6, 36, 52, 66, 68, + 80, 70, 10, 60, 32, 28, 4, 24, 62, 44, 18, 26, 74, 34, 40, 76, 46, 30, 16, 14}, + {0, 2, 6, 18, 54, 76, 56, 82, 74, 50, 64, 20, 60, 8, 24, 72, 44, 46, 52, 70, 38, 28, + 84, 80, 68, 32, 10, 30, 4, 12, 36, 22, 66, 26, 78, 62, 14, 42, 40, 34, 16, 48, 58}, + {0, 2, 10, 50, 62, 28, 46, 42, 22, 16, 80, 24, 26, 36, 86, 54, 82, 34, 76, 4, 20, 6, 30, 56, + 92, 84, 44, 32, 66, 48, 52, 72, 78, 14, 70, 68, 58, 8, 40, 12, 60, 18, 90, 74, 88, 64, 38}, + {0, 2, 4, 8, 16, 32, 64, 22, 44, 88, 70, 34, 68, 30, 60, 14, 28, 56, 6, 12, 24, 48, 96, 86, 66, 26, 52, + 104, 102, 98, 90, 74, 42, 84, 62, 18, 36, 72, 38, 76, 46, 92, 78, 50, 100, 94, 82, 58, 10, 20, 40, 80, 54}, + {0, 2, 4, 8, 16, 32, 64, 10, 20, 40, 80, 42, 84, 50, 100, 82, 46, 92, 66, 14, + 28, 56, 112, 106, 94, 70, 22, 44, 88, 58, 116, 114, 110, 102, 86, 54, 108, 98, 78, 38, + 76, 34, 68, 18, 36, 72, 26, 52, 104, 90, 62, 6, 12, 24, 48, 96, 74, 30, 60}, + {0, 2, 4, 8, 16, 32, 64, 6, 12, 24, 48, 96, 70, 18, 36, 72, 22, 44, 88, 54, 108, + 94, 66, 10, 20, 40, 80, 38, 76, 30, 60, 120, 118, 114, 106, 90, 58, 116, 110, 98, 74, 26, + 52, 104, 86, 50, 100, 78, 34, 68, 14, 28, 56, 112, 102, 82, 42, 84, 46, 92, 62}, + {0, 2, 4, 8, 16, 32, 64, 128, 122, 110, 86, 38, 76, 18, 36, 72, 10, 20, 40, 80, 26, 52, 104, + 74, 14, 28, 56, 112, 90, 46, 92, 50, 100, 66, 132, 130, 126, 118, 102, 70, 6, 12, 24, 48, 96, 58, + 116, 98, 62, 124, 114, 94, 54, 108, 82, 30, 60, 120, 106, 78, 22, 44, 88, 42, 84, 34, 68}, + {0, 2, 14, 98, 118, 116, 102, 4, 28, 54, 94, 90, 62, 8, 56, 108, 46, 38, 124, 16, 112, 74, 92, 76, + 106, 32, 82, 6, 42, 10, 70, 64, 22, 12, 84, 20, 140, 128, 44, 24, 26, 40, 138, 114, 88, 48, 52, 80, + 134, 86, 34, 96, 104, 18, 126, 30, 68, 50, 66, 36, 110, 60, 136, 100, 132, 72, 78, 120, 130, 58, 122}, + {0, 2, 10, 50, 104, 82, 118, 6, 30, 4, 20, 100, 62, 18, 90, 12, 60, 8, 40, + 54, 124, 36, 34, 24, 120, 16, 80, 108, 102, 72, 68, 48, 94, 32, 14, 70, 58, 144, + 136, 96, 42, 64, 28, 140, 116, 142, 126, 46, 84, 128, 56, 134, 86, 138, 106, 92, 22, + 110, 112, 122, 26, 130, 66, 38, 44, 74, 78, 98, 52, 114, 132, 76, 88}, + {0, 2, 6, 18, 54, 4, 12, 36, 108, 8, 24, 72, 58, 16, 48, 144, 116, 32, 96, 130, + 74, 64, 34, 102, 148, 128, 68, 46, 138, 98, 136, 92, 118, 38, 114, 26, 78, 76, 70, 52, + 156, 152, 140, 104, 154, 146, 122, 50, 150, 134, 86, 100, 142, 110, 14, 42, 126, 62, 28, 84, + 94, 124, 56, 10, 30, 90, 112, 20, 60, 22, 66, 40, 120, 44, 132, 80, 82, 88, 106}, + {0, 2, 4, 8, 16, 32, 64, 128, 90, 14, 28, 56, 112, 58, 116, 66, 132, 98, 30, 60, 120, + 74, 148, 130, 94, 22, 44, 88, 10, 20, 40, 80, 160, 154, 142, 118, 70, 140, 114, 62, 124, 82, + 164, 162, 158, 150, 134, 102, 38, 76, 152, 138, 110, 54, 108, 50, 100, 34, 68, 136, 106, 46, 92, + 18, 36, 72, 144, 122, 78, 156, 146, 126, 86, 6, 12, 24, 48, 96, 26, 52, 104, 42, 84}, + {0, 2, 6, 18, 54, 162, 130, 34, 102, 128, 28, 84, 74, 44, 132, 40, 120, 4, + 12, 36, 108, 146, 82, 68, 26, 78, 56, 168, 148, 88, 86, 80, 62, 8, 24, 72, + 38, 114, 164, 136, 52, 156, 112, 158, 118, 176, 172, 160, 124, 16, 48, 144, 76, 50, + 150, 94, 104, 134, 46, 138, 58, 174, 166, 142, 70, 32, 96, 110, 152, 100, 122, 10, + 30, 90, 92, 98, 116, 170, 154, 106, 140, 64, 14, 42, 126, 22, 66, 20, 60}, + {0, 2, 10, 50, 56, 86, 42, 16, 80, 12, 60, 106, 142, 128, 58, 96, 92, 72, 166, 54, + 76, 186, 154, 188, 164, 44, 26, 130, 68, 146, 148, 158, 14, 70, 156, 4, 20, 100, 112, 172, + 84, 32, 160, 24, 120, 18, 90, 62, 116, 192, 184, 144, 138, 108, 152, 178, 114, 182, 134, 88, + 52, 66, 136, 98, 102, 122, 28, 140, 118, 8, 40, 6, 30, 150, 168, 64, 126, 48, 46, 36, + 180, 124, 38, 190, 174, 94, 82, 22, 110, 162, 34, 170, 74, 176, 104, 132, 78}}; + + if (length < BORDER_FOR_SECOND_SCRATCH) { + for (i = 1;; i++) { + if (primeFactors[i] == length) { + mapping = mappingTable[i]; + break; + } + assert(primeFactors[i] != 0); + } + } else { + mapping = scratch2; + + /* get primitive root */ + generator = getGenerator(length); + assert(generator != -1); + + /* init mapping */ + mapping[0] = 0; + mapping[1] = 1; + for (i = 2; i < length; i++) { + mapping[i] = mapping[i - 1] * generator; + if (mapping[i] > length - 1) { + mapping[i] = (mapping[i] % length - 1) + 1; + } + } + + /* double mapping value */ + for (i = 1; i < length; i++) { + mapping[i] *= 2; + } + } + + /* remap input to scratch */ + scratch[0] = x[0]; + scratch[1] = x[1]; + scratch[2] = x[2]; + scratch[3] = x[3]; + map = mapping + length - 1; + for (i = 4; i < 2 * length; map--) { + scratch[i++] = x[(*map)]; + scratch[i++] = x[(*map) + 1]; + } + + /* print sums and diffs into scratch by using symmetry */ + x[length] = x[1]; /* imaginary und real part */ + dest1 = x + 1; + dest2 = x + length + 1; + src1 = scratch + 2; + src2 = scratch + length + 1; + + for (i = 2; i < length; i += 2) { + LC3_FLOAT tmp1R, tmp1I, tmp2R, tmp2I; + tmp1R = *src1++; + tmp1I = *src1++; + tmp2R = *src2++; + tmp2I = *src2++; + *dest1++ = tmp1R + tmp2R; + *dest1++ = tmp1R - tmp2R; + *dest2++ = tmp1I + tmp2I; + *dest2++ = tmp1I - tmp2I; + + scratch[0] += tmp1R + tmp2R; + scratch[1] += tmp1I + tmp2I; + } + + /* init with values from the first column */ + dest1 = scratch + 2; + for (i = 1; i < length; i++) { + *dest1++ = x[0]; /* add real part of x(0)(factor = 1) */ + *dest1++ = x[length]; /* add imaginary part of x(0)(factor = 1) */ + } + + for (k = 1; k <= middle; k++) { + /* loop through all cos/sin values */ + LC3_FLOAT sinVal, cosVal; + LC3_INT length1, length2; + LC3_FLOAT rePre, reMre, imPim, imMim; + + cosVal = (LC3_FLOAT)LC3_COS(-M_PIl * mapping[k] / length); + sinVal = (LC3_FLOAT)LC3_SIN(-M_PIl * mapping[k] / length); + + /* compute in two parts (length1, length2) to avoid if() in for loop */ + length1 = middle - k + 1; + length2 = middle - length1; + src1 = x + 1; + src2 = x + length + 1; + dest1 = scratch + 2 * k; + dest2 = scratch + 2 * (middle + k); + + for (i = 0; i < length1; i++) { + rePre = *src1++; + reMre = *src1++; + imPim = *src2++; + imMim = *src2++; + + *dest1++ += cosVal * rePre - sinVal * imMim; + *dest1++ += cosVal * imPim + sinVal * reMre; + + *dest2++ += cosVal * rePre + sinVal * imMim; + *dest2++ += cosVal * imPim - sinVal * reMre; + } + if (dest2 == scratch + 2 * length) { + dest2 = scratch + 2; + } + for (i = 0; i < length2; i++) { + rePre = *src1++; + reMre = *src1++; + imPim = *src2++; + imMim = *src2++; + + *dest1++ += cosVal * rePre - sinVal * imMim; + *dest1++ += cosVal * imPim + sinVal * reMre; + + *dest2++ += cosVal * rePre + sinVal * imMim; + *dest2++ += cosVal * imPim - sinVal * reMre; + } + } + + /* remap output to x */ + x[0] = scratch[0]; + x[1] = scratch[1]; + map = mapping + 1; + for (i = 2; i < 2 * length; map++) { + x[(*map)] = scratch[i++]; + x[(*map) + 1] = scratch[i++]; + } +} + +static void nextFFT(LC3_FLOAT* x, LC3_INT length, LC3_FLOAT* scratch) +{ + if (fft_n(x, length)) /* have function for length */ + return; + + assert(length % 2 != 0); + oddFFT(x, length, scratch); +} + +static inline LC3_INT findFactor(const LC3_INT length) +{ + static const LC3_INT factors[] = {16, 9, 8, 7, 5, 4, 3, 2, 0}; + LC3_INT i = 0, factor = 0; + for (i = 0; factors[i] != 0; i++) { + if (length % factors[i] == 0) { + factor = factors[i]; + break; + } + } + return factor; +} + +static inline void twiddle(LC3_FLOAT* x, const LC3_INT length, const LC3_INT n1, const LC3_INT n2) +{ + LC3_INT i, ii; + FFT_INTERNAL_TRIG_PREC sinValOrg, cosValOrg; + FFT_INTERNAL_TRIG_PREC sinVal = 0, cosVal = 1; + FFT_INTERNAL_TRIG_PREC twReal = 0, twImag = 1; + + cosValOrg = LC3_COS(-2 * (LC3_FLOAT)M_PIl / length); + sinValOrg = LC3_SIN(-2 * (LC3_FLOAT)M_PIl / length); + + for (i = 1; i < n1; i++) { + FFT_INTERNAL_TRIG_PREC tmp = 0.; + twReal = 1; + twImag = 0; + + tmp = cosVal * cosValOrg - sinVal * sinValOrg; + sinVal = sinVal * cosValOrg + cosVal * sinValOrg; + cosVal = tmp; + + for (ii = 1; ii < n2; ii++) { + LC3_FLOAT xRe, xIm; + FFT_INTERNAL_TRIG_PREC tmpReal; + + tmpReal = twReal * cosVal - twImag * sinVal; + twImag = twImag * cosVal + sinVal * twReal; + twReal = tmpReal; + + xRe = x[2 * (i * n2 + ii)]; + xIm = x[2 * (i * n2 + ii) + 1]; + + x[2 * (i * n2 + ii)] = (LC3_FLOAT)twReal * xRe - (LC3_FLOAT)twImag * xIm; + x[2 * (i * n2 + ii) + 1] = (LC3_FLOAT)twImag * xRe + (LC3_FLOAT)twReal * xIm; + } + } +} + +static void cooleyTukeyFFT(LC3_FLOAT* restrict x, const LC3_INT length, LC3_FLOAT* restrict scratch, + LC3_INT* restrict scratch2, LC3_INT isPrime) +{ + LC3_INT factor; + LC3_INT i, ii; + LC3_INT n1, n2; + LC3_INT cnt = 0; + LC3_FLOAT *src, *dest; + + if (fft_n(x, length)) + return; + + factor = findFactor(length); + if (factor > 0 && (length / factor > 1)) { + n1 = factor; + n2 = length / factor; + + /* DATA Resorting for stage1 */ + dest = scratch; + for (i = 0; i < 2 * n1; i += 2) { + src = x + i; + for (ii = 0; ii < n2; ii++) { + /* *dest++ = x[2*(i+ii*n1)]; */ + /* *dest++ = x[2*(i+ii*n1)+1]; */ + *dest++ = *src; + *dest++ = *(src + 1); + src += 2 * n1; + } + } + src = scratch; + dest = x; + for (i = 0; i < length; i++) { + *dest++ = *src++; + *dest++ = *src++; + } + /* perform n1 ffts of length n2 */ + for (i = 0; i < n1; i++) { + cooleyTukeyFFT(x + 2 * i * n2, n2, scratch + 2 * i * n2, scratch2, isPrime); + } + /*data twiddeling */ + twiddle(x, length, n1, n2); + /* DATA Resorting for stage2 */ + cnt = 0; + for (i = 0; i < n2; i++) { + for (ii = 0; ii < n1; ii++) { + scratch[2 * cnt] = x[2 * (i + ii * n2)]; + scratch[2 * cnt + 1] = x[2 * (i + ii * n2) + 1]; + cnt++; + } + } + /* perform n2 ffts of length n1 */ + for (i = 0; i < n2; i++) { + nextFFT(scratch + 2 * i * n1, n1, x + 2 * i * n1); + } + cnt = 0; + for (i = 0; i < n1; i++) { + for (ii = 0; ii < n2; ii++) { + x[2 * cnt] = scratch[2 * (i + ii * n1)]; + x[2 * cnt + 1] = scratch[2 * (i + ii * n1) + 1]; + cnt++; + } + } + } else { + if (isPrime == 1 && length > 23) { + primeFFT(x, length, scratch, scratch2); + } else { + oddFFT(x, length, scratch); + } + } +} + +static void pfaDFT(LC3_FLOAT* restrict x, const LC3_INT length, LC3_FLOAT* restrict scratch1, const LC3_INT numFactors, + const LC3_INT* const factor, LC3_INT* restrict scratch2, const LC3_INT* const isPrime) +{ + LC3_FLOAT* tmp = scratch1; + LC3_INT i, ii, n1, n2, idx, incr, cnt; + LC3_INT n1_inv = 1; + + if (numFactors <= 1) { + cooleyTukeyFFT(x, length, scratch1, scratch2, isPrime[0]); + return; + } + + n2 = factor[0]; + n1 = length / n2; + + n1_inv = findInverse(n1, n2); + + idx = 0; + incr = n1 * n1_inv; + cnt = 0; + for (i = 0; i < n1; i++) { + for (ii = 0; ii < n2 - 1; ii++) { + tmp[cnt++] = x[2 * idx]; + tmp[cnt++] = x[2 * idx + 1]; + + idx += incr; + if (idx > length) { + idx -= length; + } + } + tmp[cnt++] = x[2 * idx]; + tmp[cnt++] = x[2 * idx + 1]; + idx++; + } + + for (cnt = 0; cnt < length; cnt += n2) { + cooleyTukeyFFT(tmp + 2 * cnt, n2, x + 2 * cnt, scratch2, isPrime[0]); + } + for (cnt = 0; cnt < n1; cnt++) { + for (i = 0; i < n2; i++) { + x[2 * (cnt + i * n1)] = tmp[2 * (cnt * n2 + i)]; + x[2 * (cnt + i * n1) + 1] = tmp[2 * (cnt * n2 + i) + 1]; + } + } + for (cnt = 0; cnt < length; cnt += n1) { + pfaDFT(x + 2 * cnt, n1, tmp, numFactors - 1, &factor[1], scratch2, &isPrime[1]); + } + + cnt = 0; + for (i = 0; i < n2; i++) { + idx = i * n1; + for (ii = 0; ii < n1; ii++) { + tmp[2 * idx] = x[cnt++]; + tmp[2 * idx + 1] = x[cnt++]; + idx += n2; + if (idx > length) { + idx -= length; + } + } + } + + for (cnt = 0; cnt < length; cnt++) { + x[2 * cnt] = tmp[2 * cnt]; + x[2 * cnt + 1] = tmp[2 * cnt + 1]; + } +} diff --git a/lc3plus/fft/iis_fft.c b/lc3plus/fft/iis_fft.c new file mode 100755 index 0000000000..b1f8ab5ab8 --- /dev/null +++ b/lc3plus/fft/iis_fft.c @@ -0,0 +1,164 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include +#include +#include +#include +#include +#include + +#include "iis_fft.h" +/**************************************************************************************************/ + +/* AFFT uses two fft implementations + * cfft is used for lengths of power of two, >= 256. + * iisfft is used for everything else. it is optimized for certain lengths. for a list of + fast lengths, check the fft_n function. +*/ + + +#define FFT_COMPLEX 1 +#define FFT_REAL 2 + + +static IIS_FFT_ERROR create(HANDLE_IIS_FFT* handle, LC3_INT type, LC3_INT len, IIS_FFT_DIR sign) +{ + IIS_FFT_ERROR err = IIS_FFT_MEMORY_ERROR; + + /* for real transforms the actual performed fft is half length */ + LC3_INT trlen = (type == FFT_COMPLEX) ? len : len / 2; + + /* check argument sanity */ + if (sign != IIS_FFT_FWD && sign != IIS_FFT_BWD) + return IIS_FFT_INTERNAL_ERROR; + + + if (!(*handle)) + (*handle) = (HANDLE_IIS_FFT)calloc(1, sizeof(IIS_FFT)); + if (!(*handle)) + return IIS_FFT_MEMORY_ERROR; + + (*handle)->len = len; + (*handle)->sign = sign; + + /* create sine lookup table for real ffts */ + if (type == FFT_REAL) + { + LC3_create_sine_table(len, (*handle)->sine_table); + if (!(*handle)->sine_table) + { + goto handle_error1; + } + } + + /* set default cfft_plan to 0(length). (and default iisfft_plan to zero length) */ + (*handle)->cfft.len = 0; /* 0 length means that cfft should not be called */ + (*handle)->iisfft.length = 0; /*saftey setting for iisfft length struct */ + + /* use cfft for legth of power two larger than 256. for length below iisfft is faster */ + if (trlen >= 256 && CFFT_PLAN_SUPPORT(trlen)) { + LC3_INT s = (type == FFT_REAL) ? IIS_FFT_FWD : sign; + err = LC3_cfft_plan(&(*handle)->cfft, trlen, s) ? IIS_FFT_NO_ERROR : IIS_FFT_INTERNAL_ERROR; + } else { + LC3_INT s = (type == FFT_REAL) ? IIS_FFT_FWD : sign; + err = LC3_iisfft_plan(&(*handle)->iisfft, trlen, s); + } + + return IIS_FFT_NO_ERROR; + +handle_error1: + free((*handle)); + + return err; +} + +IIS_FFT_ERROR LC3_IIS_RFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT32 len, IIS_FFT_DIR sign) +{ + return create(handle, FFT_REAL, len, sign); +} + +static IIS_FFT_ERROR destroy(HANDLE_IIS_FFT* handle) +{ + if (handle && *handle) { + LC3_iisfft_free(&(*handle)->iisfft); + LC3_cfft_free(&(*handle)->cfft); + free(*handle); + *handle = NULL; + } + return IIS_FFT_NO_ERROR; +} + +IIS_FFT_ERROR LC3_IIS_CFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT len, IIS_FFT_DIR sign) +{ + return create(handle, FFT_COMPLEX, len, sign); +} + + +IIS_FFT_ERROR LC3_IIS_xFFT_Destroy(HANDLE_IIS_FFT* handle) { return destroy(handle); } + +IIS_FFT_ERROR LC3_IIS_CFFT_Destroy(HANDLE_IIS_FFT* handle) { return destroy(handle); } + +static IIS_FFT_ERROR real_destroy(HANDLE_IIS_FFT* handle) +{ + if (handle && *handle) { + LC3_iisfft_free(&(*handle)->iisfft); + *handle = NULL; + } + return IIS_FFT_NO_ERROR; +} + +IIS_FFT_ERROR LC3_IIS_RFFT_Destroy(HANDLE_IIS_FFT* handle) { return real_destroy(handle); } + +IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output) +{ + LC3_FLOAT* dummy; + if (!handle) + return IIS_FFT_INTERNAL_ERROR; + + /* check for inplace operation */ + memmove(output, input, sizeof(*input) * handle->len); + dummy = (LC3_FLOAT*)output; + if (handle->cfft.len > 0) { + LC3_cfft_apply(&handle->cfft, dummy, dummy + 1, 2); + } else { + LC3_iisfft_apply(&handle->iisfft, dummy); + } + + return IIS_FFT_NO_ERROR; +} + + +IIS_FFT_ERROR LC3_IIS_FFT_Apply_RFFT(HANDLE_IIS_FFT handle, const LC3_FLOAT* in, LC3_FLOAT* out) +{ + if (!handle) { + return IIS_FFT_INTERNAL_ERROR; + } + + memmove(out, in, sizeof(LC3_FLOAT) * handle->len); + + if (handle->sign == IIS_FFT_BWD) { + LC3_rfft_pre(handle->sine_table, out, handle->len); + } + + if (handle->cfft.len > 0) { + LC3_cfft_apply(&handle->cfft, out, out + 1, 2); + } + else { + LC3_iisfft_apply(&handle->iisfft, out); + } + + if (handle->sign == IIS_FFT_FWD) { + LC3_rfft_post(handle->sine_table, out, handle->len); + } + + return IIS_FFT_NO_ERROR; +} diff --git a/lc3plus/fft/iis_fft.h b/lc3plus/fft/iis_fft.h new file mode 100755 index 0000000000..b658930fa7 --- /dev/null +++ b/lc3plus/fft/iis_fft.h @@ -0,0 +1,142 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef IIS_FFT_H +#define IIS_FFT_H + +#include "../structs.h" +#include "../defines.h" +#include "cfft.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/*! + * \brief n-point complex FFT + * + * There are optimized FFTs for lengths 2, 3, 4, 7, 8, 9, 15, 16, 32, 60, 64, 128, + * 240, 256, 384, 480, 512, 768, 1024. Other lengths below 1024 use a stack allocated + * buffer and offer reasonable speed. Above 1024 a buffer is allocated each time + * iis_fftf() is called resulting in reduced performance. + * + * >>>>>> DO NOT USE UNOPTIMIZED LENGTHS IN PRODUCTION CODE! <<<<<< + * + * \param[in,out] vec pointer to data, interleaved real / imaginary + * \param[in] length length of fft (number of real/imaginary pairs) + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_iis_fftf(LC3_FLOAT* vec, LC3_INT length); +/*! + * \brief n-point inverse complex FFT + * + * The output is not normalized. See iis_fftf() for optimized lengths. + * + * >>>>>> DO NOT USE UNOPTIMIZED LENGTHS IN PRODUCTION CODE! <<<<<< + * + * \param[in,out] vec pointer to data, interleaved real / imaginary + * \param[in] length length of fft (number of real/imaginary pairs) + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_iis_ifftf(LC3_FLOAT* vec, LC3_INT length); + +/*! + * \brief allocate and initialize a new real FFT instance. + * + * \param[in,out] handle pointer to FFT handle + * \param[in] len transform length, must be an even number + * \param[in] sign IIS_FFT_FWD(-1) for forward, IIS_FFT_BWD(1) for backward transform + * BEWARE OF THE SIGNS! + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_RFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT len, IIS_FFT_DIR sign); + +/*! + * \brief allocate and initialize a new complex FFT instance + * + * \param[in,out] handle pointer to FFT handle + * \param[in] len transform length + * \param[in] sign IIS_FFT_FWD(-1) for forward, IIS_FFT_BWD(1) for backward transform + * BEWARE OF THE SIGNS !!!!!! + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_CFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT len, IIS_FFT_DIR sign); + +/*! + * \brief computes the forward or backward fourier transform of a real signal + * + * For complex data (in or out) the real part of the Nyquist band (len / 2 + 1) is stored + * in the imaginary part of the DC band (0). This allows for the complex data of + * real to complex transforms to fit into the same buffer. For this to work length must be even. + * + * Complex to real transforms are normalized (1.0/len). Input and ouput buffers may + *be identical. + * + * \param[in] handle FFT handle + * \param[in] in pointer to the input array containing real values for the forward transform (FFT) + * or packed complex values (Perm) for the backward transform (IFFT) + * \param[out] out pointer to the output array containing real values resulted from the backward transform + * (IFFT) or packed complex (perm) values reulted from the forward transform + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_FFT_Apply_RFFT(HANDLE_IIS_FFT handle, const LC3_FLOAT* in, LC3_FLOAT* out); + +/*! + * \brief compute complex backward or forward FFT + * + * Input and ouput buffers may be identical. Real/imaginary parts may be interleaved. + * The output is not normalized. + * + * \param[in] handle FFT handle + * \param[in] in_re pointer to the input array containing real parts of the signal for the + * forward transform (FFT) or for the backward transform (IFFT) + * \param[in] in_im pointer to the input array containing imaginary parts of the signal for + * the forward transform (FFT) or for the backward transform (IFFT) + * \param[out] out_re pointer to the output array containing real values resulted from the + * forward transform (FFT) or from the backward transform (IFFT) + * \param[out] out_im pointer to the output array containing imaginary values resulted from + * the forward transform (FFT) or from the backward transform (IFFT) + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output); + +/*! + * \brief deallocate a FFT instance (complex or real) + * \param[in,out] handle pointer to FFT handle, set to NULL if call succeeds + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_xFFT_Destroy(HANDLE_IIS_FFT* handle); + +/*! + * \brief deallocate a real FFT instance + * \param[in,out] handle pointer to FFT handle, set to NULL if call succeeds + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_RFFT_Destroy(HANDLE_IIS_FFT* handle); + +/*! + * \brief deallocate a complex FFT instance + * \param[in,out] handle pointer to FFT handle, set to NULL if call succeeds + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_CFFT_Destroy(HANDLE_IIS_FFT* handle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lc3plus/fft/iisfft.c b/lc3plus/fft/iisfft.c new file mode 100755 index 0000000000..227d2b6037 --- /dev/null +++ b/lc3plus/fft/iisfft.c @@ -0,0 +1,166 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" + +#include +#include /* for mmove */ +#include +#include +#include "iisfft.h" +#include "cfft.h" + +/* the fixed length fft functions have been split into sevelral headers to + have smaller files. to give the compiler more room to optimize the ffts + can't be in separate compilation units. the header approach seemed to be + the best compromise. to prevent them being included from anywhere else, + they are guarded by the INCLUDED_FROM_IISFFT_C macro. +*/ +#define INCLUDED_FROM_IISFFT_C +#include "fft_2_9.h" +#include "fft_15_16.h" +#include "fft_32.h" +#include "fft_60_128.h" +#include "fft_240_480.h" +#include "fft_384_768.h" +#include "fft_generic.h" + + +void LC3_iisfft_apply(Iisfft* handle, LC3_FLOAT* x) +{ + if (handle->sign == -1) { + if (!fft_n(x, handle->length)) + { + LC3_FLOAT scratch[2*MAX_LEN]; + pfaDFT(x, handle->length, scratch, handle->num_factors, handle->factors, handle->scratch2, + handle->isPrime); + } + } else { + assert(0); + } +} + +/* returns 1 if there is no specialized function for length or 1 if a scratch needs to be allocated. + check the fft_n function */ +static LC3_INT need_scratch(LC3_INT n) +{ + return n != 2 && n != 3 && n != 4 && n != 5 && n != 7 && n != 8 && n != 9 && n != 15 && n != 16 && n != 32 && + n != 60 && n != 64 && n != 128 && n != 192 && n != 240 && n != 256 && n != 384 && n != 480 && n != 512 && n != 768 && + n != 1024; +} + +IIS_FFT_ERROR LC3_iisfft_plan(Iisfft* handle, LC3_INT length, LC3_INT sign) +{ + memset(handle, 0, sizeof(Iisfft)); + if (length < 2) + return IIS_FFT_LENGTH_ERROR; + handle->length = length; + handle->sign = sign; + if (need_scratch(length)) { + /* only needed for prime numbers bigger than BORDER_FOR_SECOND_SCRATCH */ + LC3_INT i = 0; + LC3_INT lengthOfPrimeScratch = BORDER_FOR_SECOND_SCRATCH; + if (!factorize(length, &handle->num_factors, handle->factors, handle->isPrime)) + return IIS_FFT_LENGTH_ERROR; + /* create additional scratch for primeFFT() */ + for (i = 0; i < handle->num_factors; i++) { + if (handle->isPrime[i] == 1 && handle->factors[i] > lengthOfPrimeScratch) { + lengthOfPrimeScratch = handle->factors[i]; + } + } + if (lengthOfPrimeScratch > BORDER_FOR_SECOND_SCRATCH) { + handle->scratch2 = (LC3_INT*)malloc(sizeof(LC3_INT) * lengthOfPrimeScratch); + if (!handle->scratch2) + return IIS_FFT_MEMORY_ERROR; + } + } + + return IIS_FFT_NO_ERROR; +} + +void LC3_iisfft_free(Iisfft* handle) +{ + handle->length = 0; + if (handle->scratch2) + free(handle->scratch2); +} + + + +/* generate sine table needed by LC3_rfft_pre/rfft/post. the table must be freed with iisFree */ +void LC3_create_sine_table(LC3_INT32 len, LC3_FLOAT *sine_table) +{ + LC3_INT32 i; + + for (i = 0; i < len / 2 + 1; i++) { + sine_table[i] = (LC3_FLOAT)sin(2.0 * M_PIl * i / len); + } +} + +void LC3_rfft_post(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT32 len) +{ + LC3_FLOAT tmp1, tmp2, tmp3, tmp4, s, c; + LC3_INT32 i; + + tmp1 = buf[0] + buf[1]; + buf[1] = buf[0] - buf[1]; + buf[0] = tmp1; + + for (i = 1; i <= (len + 2) / 4; i++) { + s = sine_table[i]; /* sin(pi*i/(len/2)) */ + c = sine_table[i + len / 4]; /* cos(pi*i/(len/2)) */ + + tmp1 = buf[2 * i] - buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] + buf[len - 2 * i + 1]; + tmp3 = s * tmp1 - c * tmp2; /* real part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp4 = c * tmp1 + s * tmp2; /* imag part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp1 = buf[2 * i] + buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] - buf[len - 2 * i + 1]; + + buf[2 * i] = 0.5f * (tmp1 - tmp3); + buf[2 * i + 1] = 0.5f * (tmp2 - tmp4); + buf[len - 2 * i] = 0.5f * (tmp1 + tmp3); + buf[len - 2 * i + 1] = -0.5f * (tmp2 + tmp4); + } + + return; +} + +void LC3_rfft_pre(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT32 len) +{ + LC3_FLOAT scale ; + LC3_FLOAT tmp1, tmp2, tmp3, tmp4, s, c; + LC3_INT32 i; + + scale = 1.0f / len; /* constant */ + + tmp1 = buf[0] + buf[1]; + buf[1] = scale * (buf[0] - buf[1]); + buf[0] = scale * tmp1; + + for (i = 1; i <= (len + 2) / 4; i++) { + s = sine_table[i]; /* sin(pi*i/(len/2)) */ + c = sine_table[i + len / 4]; /* cos(pi*i/(len/2)) */ + + tmp1 = buf[2 * i] - buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] + buf[len - 2 * i + 1]; + tmp3 = s * tmp1 + c * tmp2; /* real part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp4 = -c * tmp1 + s * tmp2; /* imag part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp1 = buf[2 * i] + buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] - buf[len - 2 * i + 1]; + + buf[2 * i] = scale * (tmp1 + tmp3); + buf[2 * i + 1] = -scale * (tmp2 + tmp4); + buf[len - 2 * i] = scale * (tmp1 - tmp3); + buf[len - 2 * i + 1] = scale * (tmp2 - tmp4); + } + return; +} + diff --git a/lc3plus/fft/iisfft.h b/lc3plus/fft/iisfft.h new file mode 100755 index 0000000000..7b448e2bbe --- /dev/null +++ b/lc3plus/fft/iisfft.h @@ -0,0 +1,86 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef IISFFT_H +#define IISFFT_H + +#include "../defines.h" + +#ifndef M_PIl +#define M_PIl 3.1415926535897932384626433832795029L /* pi */ +#endif + +/* compiler specific macros + + the restrict keyword only gives a improvelent if more than one pointers are + passed to a function. also note that the MSVC __restrict behaves differently + from c99, the restrict property is not transferred to aliases. + + alloca is a bit problematic because behavior is not defined in case of stack + overflow. most probably the program will crash. it might be possible to catch + those errors but it depends on compiler support. msvc has a safer _malloca + but gcc has nothing similar. */ +#if defined _MSC_VER || defined __INTEL_COMPILER +#include +#define ALLOCA(size) _alloca(size) +#define restrict __restrict +#define inline __inline +#elif defined __GNUC__ || defined __clang__ +#define ALLOCA(size) __builtin_alloca(size) +#define restrict __restrict__ +#define inline __inline +#elif defined __TI_COMPILER_VERSION__ +#include +#define ALLOCA(size) (assert(0 && "ALLOCA is not present for your compiler"), NULL) +#warn "no stack allocation for you compiler" +#else +#error "no stack allocation for your compiler" +#endif + + +#define IISFFT_MAXSTACKLENGTH 1024 +#define IISFFT_MAXFACTORS 10 + +typedef struct { + LC3_INT* scratch2; + LC3_INT length; + LC3_INT sign; + LC3_INT num_factors; + LC3_INT factors[IISFFT_MAXFACTORS]; + LC3_INT isPrime[IISFFT_MAXFACTORS]; +} Iisfft; + +typedef enum { + IIS_FFT_NO_ERROR = 0, + IIS_FFT_INTERNAL_ERROR, /**< a mystical error appeard */ + IIS_FFT_LENGTH_ERROR, /**< the requested fft length is not supported */ + IIS_FFT_MEMORY_ERROR /**< memory allocation failed */ +} IIS_FFT_ERROR; + +typedef enum { + IIS_FFT_FWD = -1, /**< forward transform */ + IIS_FFT_BWD = 1 /**< inverse / backward transform */ +} IIS_FFT_DIR; + +/* plan, apply and free forward / backward fft */ +IIS_FFT_ERROR LC3_iisfft_plan(Iisfft* handle, LC3_INT length, LC3_INT sign); +void LC3_iisfft_apply(Iisfft* handle, LC3_FLOAT* x); +void LC3_iisfft_free(Iisfft* handle); + +/* fft related helper functions */ +void LC3_create_sine_table(LC3_INT32 len, LC3_FLOAT *sine_table); + +void LC3_rfft_pre(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT len); +void LC3_rfft_post(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT len); +void LC3_fftf_interleave(const LC3_FLOAT* restrict re, const LC3_FLOAT* restrict im, LC3_FLOAT* restrict out, + LC3_INT len); +void LC3_fftf_deinterleave(const LC3_FLOAT* restrict in, LC3_FLOAT* restrict re, LC3_FLOAT* restrict im, LC3_INT len); + +#endif /* IISFFT_H */ diff --git a/lc3plus/functions.h b/lc3plus/functions.h new file mode 100755 index 0000000000..7a529a25d7 --- /dev/null +++ b/lc3plus/functions.h @@ -0,0 +1,304 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef FUNCTIONS_H +#define FUNCTIONS_H + +#include "clib.h" +#include "defines.h" +#include "float.h" +#include "lc3.h" +#include "setup_dec_lc3.h" +#include "setup_enc_lc3.h" +#include "structs.h" +#include "util.h" + +/* FFT */ +#include "fft/iisfft.h" + +/* fft.c */ +void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle); +void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle); +void real_fft_apply(Fft* fft, const LC3_FLOAT* in, LC3_FLOAT* out); + +void fft_init(Fft* fft, LC3_INT length); +void fft_free(Fft* fft); +void real_fft_free(Fft* fft); +void fft_apply(Fft* fft, const Complex* input, Complex* output); + +/* dct.c */ +void dct2_init(Dct2* dct, LC3_INT length); +void dct2_free(Dct2* dct); +void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output); + +void dct3_init(Dct3* dct, LC3_INT length); +void dct3_free(Dct3* dct); +void dct3_apply(Dct3* dct, const LC3_FLOAT* input, LC3_FLOAT* output); + +void dct4_init(Dct4* dct, LC3_INT length); +void dct4_free(Dct4* dct); +void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output); + +/* mdct.c */ +void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC3_INT hrmode); +void mdct_free(Mdct* mdct); +void mdct_apply(const LC3_FLOAT* input, LC3_FLOAT* output, Mdct* mdct); + +#ifdef ENABLE_PADDING +LC3_INT paddingDec_fl(LC3_UINT8* bytes, LC3_INT nbbits, LC3_INT L_spec, LC3_INT bw_cutoff_bits, LC3_INT ep_enabled, LC3_INT* total_padding, LC3_INT *np_zero); +#endif + +void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, + LC3_INT bw_cutoff_idx, LC3_INT lastnz, LC3_INT N, LC3_INT lsbMode, LC3_INT gg_idx, LC3_INT num_tns_filters, + LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* scf_idx, LC3_INT fac_ns_idx + , LC3_INT bfi_ext, LC3_INT fs_idx + ); +void processDecoderEntropy_fl(LC3_UINT8* bytes, LC3_INT numbytes, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT N, LC3_INT fs_idx, + LC3_INT bw_cutoff_bits, LC3_INT* bfi, LC3_INT* gg_idx, LC3_INT* scf_idx, LC3_INT* fac_ns_idx, + LC3_INT* tns_numfilters, LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* bw_cutoff_idx, LC3_INT* lastnz, + LC3_INT* lsbMode, LC3_INT frame_dms + ); +void processQuantizeSpec_fl(LC3_FLOAT x[], LC3_FLOAT gain, LC3_INT xq[], LC3_INT nt, LC3_INT totalBits, LC3_INT* nbits, LC3_INT* nbits2, LC3_INT fs, + LC3_INT* lastnzout, LC3_INT* codingdata, LC3_INT* lsbMode, LC3_INT mode, LC3_INT target, LC3_INT hrmode); + +void processEstimateGlobalGain_fl(LC3_FLOAT x[], LC3_INT lg, LC3_INT nbitsSQ, LC3_FLOAT* gain, LC3_INT* quantizedGain, + LC3_INT* quantizedGainMin, LC3_INT quantizedGainOff, LC3_FLOAT* targetBitsOff, + LC3_INT* old_targetBits, LC3_INT old_specBits, LC3_INT bq_mode + , LC3_INT regBits, LC3_FLOAT frame_ms +); + +void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting, + LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx, + LC3_INT gg_idx, uint8_t* resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes, + LC3_INT* nbits_residual, LC3_INT* residualPresent, LC3_INT frame_dms, + LC3_INT32 n_pc, LC3_INT32 be_bp_left, LC3_INT32 be_bp_right, LC3_INT32 enc, LC3_INT32 *b_left, LC3_INT32 *spec_inv_idx, + LC3_INT hrmode + ); + +void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT gains[], const LC3_INT bands_offset[], LC3_INT fdns_npts); + +void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t * resBits, + LC3_INT* numResBits + , LC3_INT hrmode +); + +void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits + , LC3_INT hrmode +); + +void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, + LC3_INT* gainChange, LC3_INT fs_idx + , LC3_INT16 hrmode, LC3_INT16 frame_dms + ); + +void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off); + +void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, + LC3_INT target_bytes + ); + +void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx); + +void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4, LC3_INT* mem_old_T0, LC3_INT* T0_out, + LC3_FLOAT* normcorr_out, LC3_INT len, LC3_INT frame_dms); + +void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, LC3_INT fs, LC3_INT N, LC3_INT frame_dms, LC3_INT nBits, + LC3_INT* order_out, LC3_INT* rc_idx, LC3_INT* tns_numfilters, LC3_INT* bits_out + , LC3_INT16 near_nyquist_flag + ); +void levinsonDurbin(LC3_FLOAT* r, LC3_FLOAT* out_lev, LC3_FLOAT* rc_unq, LC3_FLOAT* error, LC3_INT len); + +void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs); + +void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor); + +void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_LC3_INT); + +void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx); +void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, + const LC3_INT bands_number, const LC3_FLOAT* ener); + +void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d); + +void ProcessingIMDCT_fl(LC3_FLOAT* y, LC3_INT yLen, const LC3_FLOAT* win, LC3_INT winLen, LC3_INT last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x, + Dct4* dct); + +void ProcessingITDA_WIN_OLA_fl(LC3_FLOAT* x_tda, LC3_INT32 yLen, const LC3_FLOAT* win, LC3_INT32 winLen, LC3_INT32 last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x); + +void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC3_INT pitch_ol, LC3_FLOAT pitch_ol_norm_corr, LC3_INT frame_dms, + LC3_FLOAT* mem_old_x, LC3_INT memLen, LC3_FLOAT* mem_norm_corr_past, LC3_INT* mem_on, LC3_FLOAT* mem_pitch, + LC3_INT* param, LC3_FLOAT* mem_norm_corr_past_past, LC3_INT* bits); + +void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, + LC3_INT* mem_pitch_LC3_INT, LC3_INT* mem_pitch_fr, LC3_FLOAT* mem_gain, LC3_INT* mem_beta_idx, LC3_INT bfi, + LC3_INT* param, LC3_INT* mem_param, LC3_INT conf_beta_idx, LC3_FLOAT conf_beta, LC3_INT concealMethod, LC3_FLOAT damping + , LC3_INT *mem_ltpf_active +); + +void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], + LC3_INT mem_out_len, LC3_FLOAT y[], LC3_INT* y_len, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT fs); + +void write_bit_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT bit); +void write_uint_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT val, LC3_INT numbits); + +void processAriEncoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT* x, LC3_INT* tns_order, LC3_INT tns_numfilters, + LC3_INT* tns_idx, LC3_INT lastnz, + LC3_INT* codingdata, uint8_t* res_bits, LC3_INT resBitsLen, LC3_INT lsbMode, + LC3_INT nbbits, LC3_INT enable_lpc_weighting); + +void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, + LC3_FLOAT* attdec_filter_mem, LC3_INT attackHandlingOn, LC3_INT attdec_nblocks, LC3_INT attdec_hangover_threshold); + +void process_snsQuantizesScf_Enc(LC3_FLOAT* env, LC3_INT* index, LC3_FLOAT* envq, Dct2 dct2structSNS); + +void process_snsQuantizesScf_Dec(LC3_INT* scf_idx, LC3_FLOAT* scf_q); + +void processMdct_fl(LC3_FLOAT* in, LC3_FLOAT* out, Mdct* mdctStruct); + +int alloc_encoder(LC3PLUS_Enc* encoder, int channels); +void set_enc_frame_params(LC3PLUS_Enc* encoder); +LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate); + +LC3PLUS_Error FillEncSetup(LC3PLUS_Enc* encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]); + +/* Setup Functions */ +int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels); +void set_dec_frame_params(LC3PLUS_Dec* decoder); +LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes); + +LC3PLUS_Error FillDecSetup(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode, int hrmode); + +int Enc_LC3PLUS_fl(LC3PLUS_Enc* encoder, void** input, LC3_UINT8* output, int bps +, LC3_INT32 bfi_ext +); +LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, LC3_UINT8* input, int input_bytes, void** output, int bps, int bfi_ext); + +void* balloc(void* base, size_t* base_size, size_t size); + +void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, + PlcAdvSetup *PlcAdvSetup, PlcSetup *PlcSetup, LC3_INT plcMeth, LC3_INT ltpf_pitch_int, LC3_INT ltpf_pitch_fr, + LC3_INT tilt, const LC3_INT *bands_offset, LC3_INT bands_number, const LC3_INT *bands_offsetPLC, + LC3_INT n_bandsPLC, LC3_INT16 hrmode, pcState *statePC); + +void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, + LC3_INT32 *nbLostCmpt, LC3_FLOAT *cum_alpha, LC3_INT32 bfi, LC3_INT32 *prevBfi, LC3_INT32 *prevprevBfi); + +void processPlcUpdateSpec_fl(LC3_FLOAT *q_d_prev, LC3_FLOAT *q_d_fl_c, LC3_INT yLen); + +void processNoiseSubstitution_fl(LC3_FLOAT* spec, LC3_FLOAT* spec_prev, LC3_INT32 yLen); + +void process_cutoff_bandwidth(LC3_FLOAT* d_fl, LC3_INT len, LC3_INT bw_bin); +void update_enc_bandwidth(LC3PLUS_Enc* encoder, LC3_INT bandwidth); + +/* al_fec.c */ +LC3_INT16 fec_get_n_pccw(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 ccc_flag); +LC3_INT16 fec_get_data_size(LC3_INT16 fec_mode, LC3_INT16 ccc_flag, LC3_INT16 slot_bytes); +LC3_INT16 fec_get_n_pc(LC3_INT16 fec_mode, LC3_INT16 n_pccw, LC3_INT16 slot_bytes); +void processReorderBitstream_fl(LC3_UINT8* bytes, LC3_INT32 n_pccw, LC3_INT32 n_pc, LC3_INT32 b_left, LC3_INT32 len); +void fec_encoder(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_INT16 data_bytes, LC3_INT16 slot_bytes, LC3_INT16 n_pccw); +LC3_INT32 fec_decoder(LC3_UINT8 *iobuf, LC3_INT16 slot_bytes, LC3_INT32 *data_bytes, LC3PLUS_EpModeRequest *epmr, LC3_INT16 ccc_flag, LC3_INT16 *n_pccw, LC3_INT32 *bfi, + LC3_INT16 *be_bp_left, LC3_INT16 *be_bp_right, LC3_INT16 *n_pc, LC3_INT16 *m_fec); + +LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len); + +void processPcClassify_fl(LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *q_d_prev, LC3_FLOAT *q_old_res, LC3_INT32 yLen, LC3_INT32 spec_inv_idx, LC3_FLOAT stab_fac, LC3_INT32 *bfi); +void processPcMain_fl(LC3_INT32 *bfi, LC3PLUS_Dec* decoder, LC3_FLOAT *sqQdec, DecSetup* h_DecSetup, LC3_INT32 pitch_present, LC3_FLOAT stab_fac, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 fac_ns_idx, pcState *statePC, LC3_INT32 spec_inv_idx, LC3_INT32 yLen); +void processPcUpdate_fl(LC3_INT32 bfi, LC3_FLOAT *q_res, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 rframe, LC3_INT32 *BW_cutoff_idx_nf, LC3_INT32 *prev_BW_cutoff_idx_nf, LC3_INT32 fac_ns_idx, LC3_FLOAT *prev_fac_ns, LC3_FLOAT *fac, LC3_FLOAT *q_old_res, LC3_FLOAT *prev_gg, LC3_INT32 spec_inv_idx, LC3_INT32 yLen); +void processPcApply_fl(LC3_FLOAT *q_res, LC3_FLOAT *q_old_res, LC3_FLOAT *q_d_prev, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_FLOAT *prev_gg, LC3_FLOAT *fac, LC3_INT32 *pc_nbLostCmpt); + +void processPlcClassify_fl(LC3_INT plcMeth, LC3_INT *concealMethod, LC3_INT32 *nbLostCmpt, LC3_INT32 bfi, + LC3_FLOAT *xcorr, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 pitch_int, + LC3_INT32 fs, const LC3_INT *band_offsets, LC3_INT32 bands_number, LC3_INT32 tilt, PlcAdvSetup *plcAd + , LC3_INT32 hrmode +); +void processPlcComputeStabFacMain_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_FLOAT *old_old_scf_q, LC3_INT32 bfi, LC3_INT32 prev_bfi, LC3_INT32 prev_prev_bfi, LC3_FLOAT *stab_fac); + +void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, + LC3_INT32 *pc_seed, LC3_INT32 ns_nbLostCmpt_pc, + LC3_INT32 ns_nbLostCmpt, LC3_FLOAT *stabFac, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, + LC3_FLOAT *spec_prev, LC3_FLOAT *spec, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 bfi, + LC3_INT32 frame_dms, LC3_INT32 concealMethod, LC3_INT32 pitch_present_bfi1, LC3_INT32 pitch_present_bfi2, + LC3_FLOAT *cum_fflcAtten); +void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 nbLostCmpt, LC3_FLOAT *stabFac, LC3_INT32 processDampScramb, + LC3_FLOAT *cum_fflcAtten, LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *cum_fading_slow, + LC3_FLOAT *cum_fading_fast, LC3_INT32 *seed, LC3_INT32 spec_inv_idx); + +void plc_phEcu_F0_refine_first(LC3_INT32 *plocs, LC3_INT32 n_plocs, LC3_FLOAT *f0est, const LC3_INT32 Xabs_len, + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0gainPtr, const LC3_INT32 nSubm); +void processTdcLpcEstimation_fl(LC3_FLOAT *r, LC3_INT32 fs_idx, LC3_INT32 len, LC3_FLOAT *A, LC3_INT32 frame_dms); + +LC3_FLOAT plc_phEcuSetF0Hz(LC3_INT32 fs, LC3_FLOAT *old_pitchPtr); + +void plc_phEcu_processPLCspec2shape(LC3_INT16 prev_bfi, LC3_INT16 bfi, LC3_FLOAT q_d[], LC3_INT32 yLen, LC3_FLOAT *stPhECU_oold_grp_shape, LC3_FLOAT *stPhECU_old_grp_shape); +void plc_phEcu_LF_peak_analysis(LC3_INT32 *plocs, LC3_INT32 *n_plocs, LC3_FLOAT *f0est, const LC3_FLOAT *Xabs, + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0gainPtr, const LC3_INT32 nSubm); + +void plc_phEcu_F0_refine_first(LC3_INT32 *plocs, LC3_INT32 n_plocs, LC3_FLOAT *f0est, const LC3_INT32 Xabs_len, + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0gainPtr, const LC3_INT32 nSubm); + +LC3_FLOAT plc_phEcu_imax2_jacobsen_mag(const Complex *y, LC3_FLOAT *c_jacobPtr); +LC3_FLOAT plc_phEcu_interp_max(const LC3_FLOAT *y, LC3_INT32 y_len); +void plc_phEcu_fft_spec2_sqrt_approx(const Complex* x, LC3_INT32 x_len, LC3_FLOAT* x_abs); +LC3_INT32 plc_phEcu_pitch_in_plocs(LC3_INT32* plocs, LC3_INT32 n_plocs); +void plc_phEcu_spec_ana(LC3_FLOAT* xfp, LC3_INT32 xfp_len, const LC3_FLOAT* whr, + LC3_FLOAT* pfind_sensPtr, LC3_INT32* plocs, + LC3_INT32* n_plocs, LC3_FLOAT* f0est, Complex* x, LC3_INT32* x_len, + LC3_FLOAT* f0hzLtpBinPtr, LC3_FLOAT* f0gainLtpPtr, LC3_INT32 bw_idx, Fft* PhEcu_Fft); +void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_INT32 time_offs, Complex* X, LC3_INT32 X_len, + LC3_FLOAT* mag_chg_gr, LC3_INT32 *seed, LC3_FLOAT* alpha, LC3_FLOAT* beta, LC3_FLOAT* Xavg, + LC3_INT32 t_adv_in, LC3_INT32 Lprot, LC3_INT32 delta_corr, LC3_FLOAT *corr_phase_dbg, + LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg); +void plc_phEcu_rec_frame(Complex *X_in, LC3_INT32 xfp_len, LC3_INT32 Lecu, const LC3_FLOAT *whr, const LC3_FLOAT *winMDCT, LC3_INT32 Lprot, + LC3_FLOAT *xfp, LC3_INT32 time_offs, LC3_FLOAT *x_out, + Complex *full_spec_dbg, LC3_FLOAT* ifft_out_dbg, LC3_FLOAT* xsubst_dbg, + LC3_INT32 LA_ZEROS, LC3_INT32 LA, Fft* PhEcu_Ifft + + ); +void plc_phEcu_tba_spect_Xavg(LC3_INT32 fs_idx, LC3_INT32 n_grp, LC3_FLOAT *oold_spec_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spec_shape, LC3_FLOAT *old_EwPtr, + LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *Xavg); +void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change); +void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *grp_pow_change, + LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, + LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_FLOAT *ph_dith, LC3_INT32 *tr_dec, + LC3_FLOAT *att_val, LC3_INT32 *attDegreeFrames, LC3_FLOAT *thresh_dbg); +void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, + LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, + LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg); +void plc_phEcu_hq_ecu( + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0ltpGainPtr, + LC3_FLOAT *xfp, LC3_INT16 prev_bfi, LC3_INT32 *short_flag_prev, + LC3_INT32 fs, LC3_INT32 * time_offs, + Complex *X_sav_m, LC3_INT32 *n_plocs, LC3_INT32 *plocs, LC3_FLOAT *f0est, const LC3_FLOAT *mdctWin, + LC3_FLOAT *env_stabPtr, LC3_INT32 delta_corr, + LC3_FLOAT *pfind_sensPtr, + LC3_INT32 PhECU_LA, LC3_INT32 t_adv, const LC3_FLOAT *winWhr, LC3_FLOAT *oold_grp_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_grp_shape, + LC3_FLOAT *old_EwPtr, + LC3_FLOAT *st_beta_mute, LC3_FLOAT *st_mag_chg_1st, LC3_FLOAT *st_Xavg, LC3_INT32 LA_ZEROS, LC3_FLOAT *x_tda, LC3_FLOAT *xsubst_dbg, Complex *X_out_m_dbg, + LC3_INT32 *seed_dbg, LC3_FLOAT *mag_chg_dbg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg, LC3_FLOAT *corr_phase_dbg + ,Fft* PhEcu_Fft,Fft* PhEcu_Ifft +); + +void processTdcPreemphasis_fl(LC3_FLOAT *in, LC3_FLOAT *pre_emph_factor, LC3_INT32 n_bands); + +void processTdcTdac_fl(const LC3_FLOAT *synth_inp, const LC3_FLOAT *win, LC3_INT32 frame_length, LC3_INT32 la_zeroes, LC3_FLOAT *ola_mem); +void processTdcInverseOdft_fl(LC3_FLOAT *in, LC3_INT32 n_bands, LC3_FLOAT *out, LC3_INT32 lpc_order); + +void processTdcApply_fl(const LC3_INT32 pitch_LC3_INT, const LC3_FLOAT *preemphFac, const LC3_FLOAT* A, const LC3_INT32 lpc_order, const LC3_FLOAT* pcmbufHist, const LC3_INT32 max_len_pcm_plc, const LC3_INT32 N, const LC3_INT32 frame_dms, + const LC3_INT32 SampRate, const LC3_INT32 nbLostCmpt, const LC3_INT32 overlap, const LC3_FLOAT *stabFac, LC3_FLOAT harmonicBuf[MAX_PITCH], LC3_FLOAT synthHist[M], + LC3_INT32* fract, LC3_INT16* seed, LC3_FLOAT* gain_c, LC3_FLOAT* alpha, LC3_FLOAT* synth); +void* balloc(void* base, size_t* base_size, size_t size); + + + +#endif diff --git a/lc3plus/imdct.c b/lc3plus/imdct.c new file mode 100755 index 0000000000..5d38aa6cc7 --- /dev/null +++ b/lc3plus/imdct.c @@ -0,0 +1,102 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +/* Function expects already flipped window */ +void ProcessingIMDCT_fl(LC3_FLOAT* y, LC3_INT yLen, const LC3_FLOAT* win, LC3_INT winLen, LC3_INT last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x, Dct4* dct) +{ + LC3_FLOAT x_tda[MAX_LEN] = {0}, x_ov[2 * MAX_LEN] = {0}; + LC3_INT i = 0, j = 0; + + /* Flip imdct window up to down */ + i = winLen - 1; + j = 0; + + dct4_apply(dct, y, x_tda); + + move_float(x_ov, &x_tda[yLen / 2], yLen / 2); + + j = yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen - 1 - i]; + j++; + } + + j = yLen; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen / 2 - 1 - i]; + j++; + } + + j = yLen + yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[i]; + j++; + } + + for (i = 0; i < winLen; i++) { + x_ov[i] = x_ov[i] * win[winLen - 1 - i]; + } + + /* Buffer update */ + j = 0; + for (i = last_zeros; i < yLen; i++) { + x_ov[i] = x_ov[i] + mem[j]; + j++; + } + + move_float(&x[0], &x_ov[last_zeros], yLen); + + move_float(&mem[0], &x_ov[yLen + last_zeros], (winLen - (yLen + last_zeros))); +} + +void ProcessingITDA_WIN_OLA_fl(LC3_FLOAT* x_tda, LC3_INT32 yLen, const LC3_FLOAT* win, LC3_INT32 winLen, LC3_INT32 last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x) +{ + LC3_FLOAT x_ov[2 * MAX_LEN] = {0}; + LC3_INT32 i, j; + + move_float(x_ov, &x_tda[yLen / 2], yLen / 2); + + j = yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen - 1 - i]; + j++; + } + + j = yLen; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen / 2 - 1 - i]; + j++; + } + + j = yLen + yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[i]; + j++; + } + + for (i = 0; i < winLen; i++) { + x_ov[i] = x_ov[i] * win[winLen - 1 - i]; + } + + /* Buffer update */ + j = 0; + + for (i = last_zeros; i < yLen; i++) { + x[j] = x_ov[i] + mem[j]; + j++; + } + + move_float(&x[j], &x_ov[last_zeros+j], yLen-j); + + move_float(&mem[0], &x_ov[yLen + last_zeros], (winLen - (yLen + last_zeros))); +} diff --git a/lc3plus/lc3.c b/lc3plus/lc3.c new file mode 100755 index 0000000000..17d2ccb712 --- /dev/null +++ b/lc3plus/lc3.c @@ -0,0 +1,431 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "lc3.h" +#include "defines.h" +#include "functions.h" +#include + +#include "setup_dec_lc3.h" +#include "setup_enc_lc3.h" + +#define RETURN_IF(cond, error) \ + if (cond) \ + return (error) + +/* ensure api header constants are up to date */ +STATIC_ASSERT(LC3PLUS_MAX_SAMPLES >= MAX_LEN); +STATIC_ASSERT(LC3PLUS_MAX_CHANNELS >= MAX_CHANNELS); +STATIC_ASSERT(LC3PLUS_MAX_BYTES >= BYTESBUFSIZE); + +/* misc functions ************************************************************/ + +int lc3plus_version(void) +{ + return LC3PLUS_VERSION; +} + +int lc3plus_channels_supported(int channels) +{ + return channels >= 1 && channels <= MAX_CHANNELS; +} + +int lc3plus_samplerate_supported(int samplerate) +{ + switch (samplerate) + { + case 8000: return 1; + case 16000: return 1; + case 24000: return 1; + case 32000: return 1; + case 44100: return 1; + case 48000: return 1; + case 96000: return 1; + default: break; + } + return 0; +} + +static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) +{ + switch ((int)plc_mode) + { + case LC3PLUS_PLC_ADVANCED: /* fallthru */ + return 1; + default: break; + } + return 0; +} + +static int lc3plus_frame_size_supported(float frame_ms) +{ + switch ((int)(ceil(frame_ms * 10))) + { + case 25: /* fallthru */ + case 50: /* fallthru */ + case 100: return 1; + default: break; + } + return 0; +} + +static int null_in_list(void **list, int n) +{ + while (--n >= 0) + RETURN_IF(list[n] == NULL, 1); + return 0; +} + +/* return pointer to aligned base + base_size, *base_size += size + 4 bytes align */ +void *balloc(void *base, size_t *base_size, size_t size) +{ + uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & ~3; + assert((uintptr_t)base % 4 == 0); /* base must be 4-byte aligned */ + *base_size = (*base_size + size + 3) & ~3; + return (void *)ptr; +} + +int32_t lc3_enc_supported_lfe(void) +{ + return 1; +} + +/* encoder functions *********************************************************/ +LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]) +{ + int ch = 0; + + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((uintptr_t)encoder % 4 != 0, LC3PLUS_ALIGN_ERROR); + RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR); + RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); + RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); + + for (ch = 0; ch < channels; ch++) + { + RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); + } + + return FillEncSetup(encoder, samplerate, channels, hrmode, lfe_channel_array); /* real bitrate check happens here */ +} + +int lc3plus_enc_get_size(int samplerate, int channels) +{ + RETURN_IF(!lc3plus_samplerate_supported(samplerate), 0); + RETURN_IF(!lc3plus_channels_supported(channels), 0); + return alloc_encoder(NULL, channels); +} + +/* Dummy function for API alignment */ +int lc3plus_enc_get_scratch_size(const LC3PLUS_Enc *encoder) +{ + UNUSED(encoder); + return 0; +} + +int lc3plus_enc_get_input_samples(const LC3PLUS_Enc *encoder) +{ + RETURN_IF(encoder == NULL, 0); + return encoder->frame_length; +} + +int lc3plus_enc_get_num_bytes(const LC3PLUS_Enc *encoder) +{ + RETURN_IF(encoder == NULL, 0); + + return encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in); +} + +int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder) +{ + int ch = 0, totalBytes = 0; + int bitrate; + RETURN_IF(encoder == NULL, 0); + RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR); + + for (ch = 0; ch < encoder->channels; ch++) + { + totalBytes += encoder->channel_setup[ch]->targetBytes; + } + + bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms; + + if (encoder->fs_in == 44100) + { + int rem = bitrate % 480; + bitrate = ((bitrate - rem) / 480) * 441 + (rem * 441) / 480; + } + + return bitrate; +} + + +LC3PLUS_Error lc3plus_enc_set_bitrate(LC3PLUS_Enc *encoder, int bitrate) +{ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(bitrate <= 0, LC3PLUS_BITRATE_ERROR); +#ifndef STRIP_HR_MODE_API + RETURN_IF(encoder->fs_idx == 5 && encoder->hrmode == 0, LC3PLUS_HRMODE_ERROR); +#endif + return update_enc_bitrate(encoder, bitrate); +} + +int lc3plus_enc_get_delay(const LC3PLUS_Enc *encoder) +{ + RETURN_IF(encoder == NULL, 0); + return encoder->frame_length - 2 * encoder->la_zeroes; +} + +LC3PLUS_Error lc3plus_enc_set_frame_dms(LC3PLUS_Enc *encoder, int frame_dms) +{ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(!lc3plus_frame_size_supported(frame_dms / 10.0), LC3PLUS_FRAMEMS_ERROR); + RETURN_IF(encoder->lc3_br_set, LC3PLUS_BITRATE_SET_ERROR); + encoder->frame_dms = frame_dms; + encoder->frame_ms = frame_dms / 10.0; + set_enc_frame_params(encoder); + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth) +{ + LC3_INT effective_fs; + + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); +#ifdef ENABLE_HR_MODE_FL_FLAG + RETURN_IF(encoder->hrmode == 1, LC3PLUS_HRMODE_BW_ERROR); +#endif + effective_fs = encoder->fs_in; + if (encoder->bandwidth != bandwidth) { + if (encoder->fs_in > 40000) { + effective_fs = 40000; + } + if ((bandwidth * 2) > effective_fs) { + return LC3PLUS_BW_WARNING; + } + else { + encoder->bandwidth = bandwidth; + encoder->bandwidth_preset = bandwidth; + encoder->bw_ctrl_active = 1; + update_enc_bitrate(encoder, encoder->bitrate); + } + } + return LC3PLUS_OK; +} + + +LC3PLUS_Error lc3plus_enc16(LC3PLUS_Enc* encoder, int16_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +) +{ + UNUSED(scratch); + return lc3plus_enc_fl(encoder, (void**)input_samples, 16, output_bytes, num_bytes); +} + +LC3PLUS_Error lc3plus_enc24(LC3PLUS_Enc* encoder, int32_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +) +{ + UNUSED(scratch); + return lc3plus_enc_fl(encoder, (void**)input_samples, 24, output_bytes, num_bytes); +} + + +LC3PLUS_Error lc3plus_enc_fl(LC3PLUS_Enc* encoder, void** input_samples, int bitdepth, void* output_bytes, int* num_bytes) +{ + RETURN_IF(!encoder || !input_samples || !output_bytes || !num_bytes, LC3PLUS_NULL_ERROR); + RETURN_IF(null_in_list(input_samples, encoder->channels), LC3PLUS_NULL_ERROR); + RETURN_IF(bitdepth != 16 && bitdepth != 24, LC3PLUS_ERROR); + *num_bytes = Enc_LC3PLUS_fl(encoder, input_samples, output_bytes, bitdepth + , *num_bytes == -1 + ); + assert(*num_bytes == lc3plus_enc_get_num_bytes(encoder)); + return LC3PLUS_OK; +} + +/* decoder functions *********************************************************/ + +LC3PLUS_Error lc3plus_dec_init(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode, int hrmode) +{ + RETURN_IF(decoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR); + RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); + RETURN_IF(!lc3plus_plc_mode_supported(plc_mode), LC3PLUS_PLCMODE_ERROR); + RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); + return FillDecSetup(decoder, samplerate, channels, plc_mode, hrmode); +} + +int lc3plus_dec_get_size(int samplerate, int channels) +{ + RETURN_IF(!lc3plus_samplerate_supported(samplerate), 0); + RETURN_IF(!lc3plus_channels_supported(channels), 0); + return alloc_decoder(NULL, samplerate, channels); +} + +/* Dummy function for API alignment */ +int lc3plus_dec_get_scratch_size(const LC3PLUS_Dec *decoder) +{ + UNUSED(decoder); + return 0; +} + +LC3PLUS_Error lc3plus_dec_set_frame_dms(LC3PLUS_Dec *decoder, int frame_dms) +{ + RETURN_IF(decoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(!lc3plus_frame_size_supported(frame_dms / 10.0), LC3PLUS_FRAMEMS_ERROR); + RETURN_IF(decoder->plcMeth == 2 && frame_dms != 100, LC3PLUS_FRAMEMS_ERROR); + + decoder->frame_dms = frame_dms; + decoder->frame_ms = frame_dms / 10.0; + set_dec_frame_params(decoder); + return LC3PLUS_OK; +} + +int lc3plus_dec_get_output_samples(const LC3PLUS_Dec* decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->frame_length; +} + +int lc3plus_dec_get_delay(const LC3PLUS_Dec* decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->frame_length - 2 * decoder->la_zeroes; +} + +LC3PLUS_Error lc3plus_dec_fl(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, void** output_samples, int bps, int bfi_ext) +{ + RETURN_IF(!decoder || !input_bytes || !output_samples, LC3PLUS_NULL_ERROR); + RETURN_IF(null_in_list((void**)output_samples, decoder->channels), LC3PLUS_NULL_ERROR); + return Dec_LC3PLUS_fl(decoder, input_bytes, num_bytes, output_samples, bps, bfi_ext); +} + +LC3PLUS_Error lc3plus_dec16(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int16_t** output_samples, + void* scratch, + int bfi_ext) +{ + UNUSED(scratch); + return lc3plus_dec_fl(decoder, input_bytes, num_bytes, (void**)output_samples, 16, bfi_ext); +} + +LC3PLUS_Error lc3plus_dec24(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int32_t** output_samples, + void* scratch, + int bfi_ext) +{ + UNUSED(scratch); + return lc3plus_dec_fl(decoder, input_bytes, num_bytes, (void**)output_samples, 24, bfi_ext); +} + +/* memory functions *********************************************************/ + +LC3PLUS_Error lc3plus_enc_free_memory(LC3PLUS_Enc* encoder) +{ + RETURN_IF(!encoder, LC3PLUS_NULL_ERROR); + + lc3plus_free_encoder_structs(encoder); + + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_dec_free_memory(LC3PLUS_Dec* decoder) +{ + RETURN_IF(!decoder, LC3PLUS_NULL_ERROR); + + lc3plus_free_decoder_structs(decoder); + + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder) +{ + int ch = 0; + RETURN_IF(!encoder, LC3PLUS_NULL_ERROR); + + for (ch = 0; ch < encoder->channels; ch++) { + mdct_free(&encoder->channel_setup[ch]->mdctStruct); + dct2_free(&encoder->channel_setup[ch]->dct2StructSNS); + } + + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder) +{ + int ch = 0; + RETURN_IF(!decoder, LC3PLUS_NULL_ERROR); + + for (ch = 0; ch < decoder->channels; ch++) { + dct4_free(&decoder->channel_setup[ch]->dct4structImdct); + real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft); + real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft); + } + + return LC3PLUS_OK; +} + + +LC3PLUS_EpModeRequest lc3plus_dec_get_ep_mode_request(const LC3PLUS_Dec *decoder) +{ + RETURN_IF(decoder == NULL, LC3PLUS_EPMR_ZERO); + return (LC3PLUS_EpModeRequest)decoder->epmr; +} + +int lc3plus_dec_get_error_report(const LC3PLUS_Dec *decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->error_report == 2047 ? -1 : decoder->error_report & 0x07FF; +} + +LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode) +{ + LC3PLUS_EpMode oldEpmode; + LC3PLUS_Error error; + + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((unsigned)epmode > LC3PLUS_EP_HIGH, LC3PLUS_EPMODE_ERROR); + oldEpmode = encoder->epmode; + encoder->epmode = epmode; + error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK; + if (error != LC3PLUS_OK) + { + encoder->epmode = oldEpmode; // preserve old epmode in case of failure + } + return error; +} + +LC3PLUS_Error lc3plus_enc_set_ep_mode_request(LC3PLUS_Enc *encoder, LC3PLUS_EpModeRequest epmr) +{ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((unsigned)epmr > LC3PLUS_EPMR_HIGH, LC3PLUS_EPMODE_ERROR); + encoder->epmr = epmr; + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_dec_set_ep_enabled(LC3PLUS_Dec *decoder, int32_t ep_enabled) +{ + RETURN_IF(decoder == NULL, LC3PLUS_NULL_ERROR); + decoder->ep_enabled = ep_enabled != 0; + decoder->epmr = LC3PLUS_EPMR_ZERO; + return LC3PLUS_OK; +} + +int lc3plus_dec_get_epok_flags(const LC3PLUS_Dec *decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->error_report >> 11; +} + +#ifndef STRIP_ERROR_PROTECTION_API_FL +#endif /* STRIP_ERROR_PROTECTION_API_FL */ + +#ifndef STRIP_ERROR_PROTECTION_API_FL +#endif /* STRIP_ERROR_PROTECTION_API_FL */ + diff --git a/lc3plus/lc3.h b/lc3plus/lc3.h new file mode 100755 index 0000000000..3e45438fed --- /dev/null +++ b/lc3plus/lc3.h @@ -0,0 +1,517 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/*! \file lc3.h + * This header provides the API for LC3plus. + * + * This library is targeting devices with extreme memory limitations, so memory management + * must be handeled by the user. This includes allocating memory for the structs. The structs are persistent + * between function calls. + * + * The amount of memory needed for various configurations can be obtained from the lc3plus_*_get_size + * function. The LC3PLUS_*_MAX_SIZE macro can be used for all configurations. + * + * Depending on the build configuration some functions might not be available. + */ + +#ifndef LC3PLUS_H +#define LC3PLUS_H + +#ifndef _MSC_VER +#include +#else +typedef unsigned char uint8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +#endif + +/*! Construct version number from major/minor/micro values. */ +#define LC3PLUS_VERSION_INT(major, minor, micro) (((major) << 16) | ((minor) << 8) | (micro)) + +/*! Version number to ensure header and binary are matching. */ +#define LC3PLUS_VERSION LC3PLUS_VERSION_INT(1, 6, 9) + +/*! Maximum number of supported channels. The actual binary might support + * less, use lc3plus_channels_supported() to check. */ +#define LC3PLUS_MAX_CHANNELS 2 + +/*! Maximum number of samples per channel that can be stored in one LC3plus frame. + */ +#define LC3PLUS_MAX_SAMPLES 960 + +/*! Maximum number of bytes of one LC3plus frame. */ +#define LC3PLUS_MAX_BYTES 1250 + +/*! Maximum size needed to store encoder state. */ +#define LC3PLUS_ENC_MAX_SIZE 20392 + +/*! Maximum size needed to store decoder state. */ +#define LC3PLUS_DEC_MAX_SIZE 87528 + +/*! Error codes returned by functions. */ +typedef enum +{ + LC3PLUS_PLC_ADVANCED = 1 /*!< Enhanced concealment method */ +} LC3PLUS_PlcMode; + +/*! Error protection mode. LC3PLUS_EP_ZERO differs to LC3PLUS_EP_OFF in that + * errors can be detected but not corrected. */ +typedef enum +{ + LC3PLUS_EP_OFF = 0, /*!< Error protection is disabled */ + LC3PLUS_EP_ZERO = 1, /*!< Error protection with 0 bit correction */ + LC3PLUS_EP_LOW = 2, /*!< Error protection correcting one symbol per codeword */ + LC3PLUS_EP_MEDIUM = 3, /*!< Error protection correcting two symbols per codeword */ + LC3PLUS_EP_HIGH = 4 /*!< Error protection correcting three symbols per codeword */ +} LC3PLUS_EpMode; + +/*! Error protection mode request. On the encoder sidem, LC3PLUS_EPMR_ZERO to LC3PLUS_EPMR_HIGH + * can be set. The decoder returns mode requests with different confidences. */ +typedef enum +{ + LC3PLUS_EPMR_ZERO = 0, /*!< Request no error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_LOW = 1, /*!< Request low error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_MEDIUM = 2, /*!< Request medium error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_HIGH = 3, /*!< Request high error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_ZERO_MC = 4, /*!< No error correction requested, medium confidence. */ + LC3PLUS_EPMR_LOW_MC = 5, /*!< Low error correction requested, medium confidence. */ + LC3PLUS_EPMR_MEDIUM_MC = 6, /*!< Medium error correction requested, medium confidence. */ + LC3PLUS_EPMR_HIGH_MC = 7, /*!< High error correction requested, medium confidence. */ + LC3PLUS_EPMR_ZERO_NC = 8, /*!< No error correction requested, unvalidated. */ + LC3PLUS_EPMR_LOW_NC = 9, /*!< Low error correction requested, unvalidated. */ + LC3PLUS_EPMR_MEDIUM_NC = 10, /*!< Medium error correction requested, unvalidated. */ + LC3PLUS_EPMR_HIGH_NC = 11 /*!< High error correction requested, unvalidated. */ +} LC3PLUS_EpModeRequest; + +/*! Error codes returned by functions. */ +typedef enum +{ + LC3PLUS_OK = 0, /*!< No error occurred */ + LC3PLUS_ERROR = 1, /*!< Function call failed */ + LC3PLUS_DECODE_ERROR = 2, /*!< Frame failed to decode and was concealed */ + LC3PLUS_NULL_ERROR = 3, /*!< Pointer argument is null */ + LC3PLUS_SAMPLERATE_ERROR = 4, /*!< Invalid samplerate value */ + LC3PLUS_CHANNELS_ERROR = 5, /*!< Invalid channels value */ + LC3PLUS_BITRATE_ERROR = 6, /*!< Invalid bitrate value */ + LC3PLUS_NUMBYTES_ERROR = 7, /*!< Invalid num_bytes value */ + LC3PLUS_EPMODE_ERROR = 8, /*!< Invalid plc_method value */ + LC3PLUS_FRAMEMS_ERROR = 9, /*!< Invalid epmode value */ + LC3PLUS_ALIGN_ERROR = 10, /*!< Invalid frame_ms value */ + LC3PLUS_HRMODE_ERROR = 11, /*!< Unaligned pointer */ + LC3PLUS_BITRATE_UNSET_ERROR = 12, /*!< Invalid epmr value */ + LC3PLUS_BITRATE_SET_ERROR = 13, /*!< Invalid usage of hrmode, sampling rate and frame size */ + LC3PLUS_HRMODE_BW_ERROR = 14, /*!< Function called before bitrate has been set */ + LC3PLUS_PLCMODE_ERROR = 15, /*!< Function called after bitrate has been set */ + LC3PLUS_EPMR_ERROR = 16, /*!< Invalid external bad frame index */ + LC3PLUS_PADDING_ERROR = 17, /*!< Incorrect padding value */ + FRAMESIZE_ERROR = 18, /*!< Incorrect frame size during decoding */ + LC3PLUS_LFE_MODE_NOT_SUPPORTED = 19, /*!< LFE support not available */ + + /* START WARNING */ + LC3PLUS_WARNING = 20, + LC3PLUS_BW_WARNING = 21 /*!< Invalid bandwidth cutoff frequency */ + +} LC3PLUS_Error; + +typedef struct LC3PLUS_Enc LC3PLUS_Enc; /*!< Opaque encoder struct. */ +typedef struct LC3PLUS_Dec LC3PLUS_Dec; /*!< Opaque decoder struct. */ + +/*! \addtogroup Misc + * \{ */ + +/*! Test LFE mode support. + * + * Tests the support of the LFE mode. + * + * \return 1 for true, 0 for false. + */ +int32_t lc3_enc_supported_lfe(void); + +/*! Return library version number. It should match LC3PLUS_VERSION. */ +int lc3plus_version(void); + +/*! Tests if the library supports number of channels. + * + * \param[in] channels Number of channels. + * \return 1 for true, 0 for false. + */ +int lc3plus_channels_supported(int channels); + +/*! Tests if the library supports a sampling rate. + * + * \param[in] samplerate Sampling rate + * \return 1 for true, 0 for false + */ +int lc3plus_samplerate_supported(int samplerate); + +/*! \} + * \addtogroup Encoder + * \{ */ + +/*! + * Initialize LC3plus encoder. + * + * This function is used to fill a user-allocated encoder struct. This is typically + * called once for a samplerate / channel configuration. After init and before encoding + * the first frame you must call lc3plus_enc_set_bitrate(). + * + * \param[out] encoder Pointer to allocated encoder memory. It must have a size provided + * by lc3plus_enc_get_size() for matching samplerate / channels + * configuration or LC3PLUS_ENC_MAX_SIZE. + * \param[in] channels Number of channels. + * \param[in] samplerate Input sampling rate. Allowed sampling rates are: + * 8000, 16000, 24000, 32000, 44100, 48000 + * \param[in] hrmode High resolution mode. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc* encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]); + +/*! + * Encode LC3plus frame with 16 bit input. + * + * Each call consumes a fixed number of samples. The number of input samples + * can be obtained from lc3plus_enc_get_input_samples(). + * Scratch parameter only works as dummy parameter to align fixed-point and floating-point APIs + * + * \param[in] encoder Encoder handle initialized by lc3plus_enc_init(). + * \param[in] input_samples Input samples. The left channel is stored in input_samples[0], + * the right channel in input_samples[1]. The input is not changed + * by the encoder. + * \param[out] output_bytes Output buffer. It must have a at least lc3plus_enc_get_num_bytes() + * or at most LC3PLUS_MAX_BYTES. + * \param[out] num_bytes Number of bytes written to output_bytes. + * \param scratch See comment above. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc16(LC3PLUS_Enc* encoder, int16_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +); + +/*! Encode LC3plus frame with 24 bit input. + * + * The input samples are expected to be 24-bit values, sign-extended to 32-bit. + * See lc3plus_enc16() for parameter documentation. + */ +LC3PLUS_Error lc3plus_enc24(LC3PLUS_Enc* encoder, int32_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +); + +/*! + * Internal function. Use lc3plus_enc16() or lc3plus_enc24() for encoding. + */ + +LC3PLUS_Error lc3plus_enc_fl(LC3PLUS_Enc* encoder, void** input_samples, int bitdepth, void* output_bytes, int* num_bytes); + +/*! Get the size of the LC3plus encoder struct for a samplerate / channel + * configuration. If memory is not restricted LC3PLUS_ENC_MAX_SIZE can be used for + * all configurations. + * + * \param[in] samplerate Sampling rate. + * \param[in] channels Number of channels. + * \return Size in bytes or 0 on error. + */ +int lc3plus_enc_get_size(int samplerate, int channels); + +/*! Dummy function as no scratch management available in floating-point code. Returns always zero. Used to align fixed-point and floating-point APIs. + * + * \param[in] encoder Encoder handle. + * \return Size in bytes or 0 on error. + */ +int lc3plus_enc_get_scratch_size(const LC3PLUS_Enc *encoder); + +/*! Get number of samples per channel expected by lc3plus_enc16() or lc3plus_enc24(). + * + * \param[in] encoder Encoder handle. + * \return Number of samples or 0 on error. + */ +int lc3plus_enc_get_input_samples(const LC3PLUS_Enc* encoder); + +/*! Get real internal bitrate of the encoder. It might differ from the requested + * bitrate due to 44.1 kHz input. + * + * \param[in] encoder Encoder handle. + * \return Bitrate in bits per second or 0 on error. + */ +int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc* encoder); + +/*! Get the maximum number of bytes produced by lc3plus_enc16() or lc3plus_enc24() for the current + * bitrate. It should be equal to the num_bytes output of lc3plus_enc16/24(). + * + * \param[in] encoder Encoder handle. + * \return Size in bytes or 0 on error. + */ +int lc3plus_enc_get_num_bytes(const LC3PLUS_Enc *encoder); + +/*! Set encoder bitrate for all channels. + * This function must be called at least once before encoding the first frame, but + * after other configuration functions such as lc3plus_enc_set_frame_ms(). + * + * Recommended bitrates for input sampling rates with 10 ms framing: + * kHz | kbps + * --------|----- + * 8 | 24 + * 16 | 32 + * 24 | 48 + * 32 | 64 + * 44.1/48 | 80(voice) 128(music) + * 96 | 128 + * + * \param[in] encoder Encoder handle. + * \param[in] bitrate Bitrate in bits per second. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_bitrate(LC3PLUS_Enc* encoder, int bitrate); + +/*! Get the encoder delay in number of samples. + * + * \param[in] encoder Encoder handle. + * \return Encoder in samples or 0 on error. + */ +int lc3plus_enc_get_delay(const LC3PLUS_Enc *encoder); + +/*! Set the frame length for LC3plus decoder in deci milliseconds. + * Not all lengths may be enabled, in that case LC3PLUS_FRAMEMS_ERROR is returned. + * This only works correcly if the encoder was configured with the same vale. + * + * \param[in] decoder Decoder handle. + * \param[in] frame_ms Frame length in ms. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_frame_dms(LC3PLUS_Enc *encoder, int frame_ms); + + +/*! Set encoder Low-frequency effect moded. deactivates LTPF, TNS, NF + * + * \param[in] encoder Encoder handle. + * \param[in] lfe LFE mode flag + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_lfe(LC3PLUS_Enc* encoder, int lfe); + +/*! Free memory allocated within LC3plus encoder struct. + * + * \param[in] encoder Encoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_free_memory(LC3PLUS_Enc* encoder); + +/*! Set encoder bandwidth to a different value. All frequency bins above the cutoff + * frequency are cut off. Allowed frequencies are: 4 kHz, 8 kHz, 12 kHz, 16 kHz and 24 kHz. + * + * \param[in] encoder Encoder handle. + * \param[in] bandwidth Cutoff Frequency in Hz + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth); + +/*! Internal function called by lc3plus_enc_free_memory. + * + * \param[in] encoder Encoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder); + +/*! Sets error protection mode request transmitted in each channel encoded frame. + * The channel coder includes an error protection mode request (EPMR) in every frame. + * The EPMR takes value 0, 1, 2, and 3 which request ep modes 1, 2, 3, and 4 from the + * decoding device. The EPMR can be retrieved from the channel decoder via the interface + * routine lc3plus_dec_get_ep_mode_request(). + * + * \param[in] encoder Encoder handle. + * \param[in] epmr Error Protection Mode Request + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_ep_mode_request(LC3PLUS_Enc *encoder, LC3PLUS_EpModeRequest epmr); + +/*! Set error protection mode. The default is LC3PLUS_EP_OFF. It is possible to switch between + * different modees during encoding. Dynamic switching is only allowed between LC3PLUS_EP_ZERO, + * LC3PLUS_EP_LOW, LC3_EP_MEDIUM, and LC3PLUS_EP_HIGH. The the decoder must be notified with + * lc3plus_dec_set_ep_enabled() to expect protected data if epmode is other than LC3PLUS_EP_OFF. + * + * \param[in] encoder Encoder handle. + * \param[in] epmode Error protection mode. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode); + +/*! \} + * \addtogroup Decoder + * \{ */ + +/*! + * Initialize LC3plus decoder. + * + * This function is used to fill a user-allocated decoder struct. This is + * typically called once for a samplerate / channel configuration. + * + * The samplerate and channel arguments must have the same values that were + * used for encoding. LC3plus does not provide a signalling scheme, transporting + * these values is the responsibility of the application. + * + * \param[out] decoder Pointer to decoder memory. It must have as size + * of least lc3plus_dec_get_size() or at most LC3PLUS_DEC_MAX_SIZE. + * \param[in] samplerate Bitstream sampling rate. \param[in] channels Bitstream + * number of channels. + * + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_init(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode, int hrmode); + + + +/*! + * Decode compressed LC3plus frame to 16 bit PCM output. + * + * Each call decodes a fixed number of samples. Use lc3plus_dec_get_output_samples() to obtain this + * number. When the input is corrupted and can not be decoded, LC3PLUS_DECODE_ERROR is returned and + * packet loss concealment is applied, so the output is still usable. + * If error protection is enabled and the errors can be corrected the frame is corrected and + * normally decoded. Use lc3plus_dec_get_error_report() to check if errors were corrected. + * + * \param[in] decoder Decoder initialized by lc3plus_dec_init(). + * \param[in] input_bytes Input bytes. If error protection is enabled the input bytes can be + * altered when error correction is applied. This is why this buffer + * must be writable. + * \param[in] num_bytes Number of valid bytes in input_bytes. To signal a lost frame and + * generate concealment output this value must be set to 0. + * \param[out] output_samples Array of pointers to output channel buffers. Each channel buffer + * should provide enough space to hold at most LC3PLUS_MAX_SAMPLES. The + * left channel is stored in output_samples[0], the right channel in + * output_samples[1]. + * \param scratch Scratch parameter only works as dummy parameter to align fixed-point and floating-point APIs + * \return Returns LC3PLUS_OK on success or appropriate error code. Note there is + * a special case for LC3PLUS_DECODE_ERROR where the output is still valid. + */ +LC3PLUS_Error lc3plus_dec16(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int16_t** output_samples, + void* scratch, + int bfi_ext); + +/*! Decode compressed LC3plus frame to 24 bit PCM output. + * + * The output samples are 24-bit values, sign-extended to 32-bit. + * See lc3plus_dec16() for parameter documentation. + */ +LC3PLUS_Error lc3plus_dec24(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int32_t** output_samples, + void* scratch, + int bfi_ext); + +/* Internal function */ + LC3PLUS_Error lc3plus_dec_fl(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, void** output_samples, int bps, int bfi_ext); + +/*! Get the size of the LC3plus decoder struct for a samplerate / channel + * configuration. If memory is not restricted LC3PLUS_DEC_MAX_SIZE can be used for + * all configurations. + * + * \param[in] channels Number of channels. + * \param[in] samplerate Sampling rate. + * \return Size in bytes or 0 on error. + */ +int lc3plus_dec_get_size(int samplerate, int channels); + +/*! Dummy function as no scratch management available in floating-point code. Returns always zero. Used to align fixed-point and floating-point APIs. + * + * \param[in] decoder Decoder handle. + * \return Size in bytes or 0 on error. + */ +int lc3plus_dec_get_scratch_size(const LC3PLUS_Dec *decoder); + +/*! Get the number of samples per channel produced by lc3plus_dec16() or lc3plus_dec24. + * + * \param[in] decoder Decoder handle. + * \return Number of samples or 0 on error. + */ +int lc3plus_dec_get_output_samples(const LC3PLUS_Dec* decoder); + +/*! Get the decoder delay in number of samples. + * + * \param[in] decoder Decoder handle. + * \return Delay in samples or 0 on error. + */ +int lc3plus_dec_get_delay(const LC3PLUS_Dec* decoder); + +/*! Set the frame length for LC3plus encoder in deci milliseconds. + * Not all lengths may be enabled, in that case LC3PLUS_FRAMEMS_ERROR is returned. + * This function must be called before lc3plus_enc_set_bitrate(). The decoder must be + * configured with lc3plus_dec_set_frame_dms() with the same value. + * + * \param[in] encoder Encoder handle. + * \param[in] frame_ms Frame length in ms. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_set_frame_dms(LC3PLUS_Dec *decoder, int frame_ms); + + +/*! Free memory allocated within LC3plus decoder struct. + * + * \param[in] decoder Decoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_free_memory(LC3PLUS_Dec* decoder); + +/*! Internal function called by lc3plus_dec_free_memory. + * + * \param[in] decoder Decoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder); + +/*! Enable or disable error protection. Default value is 0 (disabled). If error protection is + * enabled, the decoder expects that the frames were encoded with error protection mode + * LC3PLUS_EP_ZERO or higher. + * + * \param[in] decoder Decoder handle. + * \param[in] ep_enabled 1 (or any nonzero) for true, 0 for false. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_set_ep_enabled(LC3PLUS_Dec *decoder, int ep_enabled); + +/*! Retrieves the error protection mode reqeust from channel decoder. + * + * The return value encodes both the error protection mode request (EPMR) + * and the confidence of the method by which it was retrieved. + * + * The requested error protection mode is (epmr % 4) + 1, where epmr is the + * function's return value. The confidence is specified as follows. + * + * Confidence | Range + * -----------|------------- + * high | 0 <= epmr < 4 + * medium | 4 <= epmr < 8 + * no | 8 <= epmr < 12 + * + * When receiving stereo content of separately channel encoded audio frames the + * return value is the minimum of two values retrieved from the individual channels. + * + * \param[in] decoder Decoder handle. + * \return Error protection mode reqeust. + */ +LC3PLUS_EpModeRequest lc3plus_dec_get_ep_mode_request(const LC3PLUS_Dec *decoder); + +/*! Get the number of corrected bit errors in the last decoded frame. This only works if + * error protection is active. If the number of errors is greater than the current error + * protection mode can correct, -1 is returned. If the last frame had no errors or the + * decoder handle is NULL, 0 is returned, + * + * \param[in] decoder Decoder handle. + * \return Number of corrected bits or -1. See description for details. + */ +int lc3plus_dec_get_error_report(const LC3PLUS_Dec *decoder); +/*! This function returns an set of flags indicating whether the last frame + * would have been channel decodable in epmode m, m ranging from 1 to 4. Note that + * this information is not available in case the last frame was not channel + * decodable in which case the return value is 0. If the last frame would have + * been decodable in epmode m, m-1th of the return value will be 1. + * Otherwise, if the frame would not have been decodable or if this information + * cannot be retrieved, the m-1th bit of the return value will be 0. + */ +int lc3plus_dec_get_epok_flags(const LC3PLUS_Dec *decoder); + +/*! \} */ +#endif /* LC3plus */ diff --git a/lc3plus/lc3plus_fft.c b/lc3plus/lc3plus_fft.c new file mode 100644 index 0000000000..14f443f860 --- /dev/null +++ b/lc3plus/lc3plus_fft.c @@ -0,0 +1,99 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" +#include "fft/iis_fft.c" +#include "fft/iisfft.c" +#include "fft/cfft.c" + +void fft_init(Fft* fft, int length) +{ + HANDLE_IIS_FFT handle = NULL; + IIS_FFT_ERROR error = 0; + assert(length % 2 == 0); + + fft->length = length; + + error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); + + assert(error == IIS_FFT_NO_ERROR); + fft->handle = handle; +} + +void fft_free(Fft* fft) +{ + IIS_FFT_ERROR error = 0; + + if (fft) { + error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); + + assert(error == IIS_FFT_NO_ERROR); + memset(fft, 0, sizeof(*fft)); + } +} + +void real_fft_free(Fft* fft) +{ + IIS_FFT_ERROR error = 0; + + if (fft) { + error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); + + assert(error == IIS_FFT_NO_ERROR); + memset(fft, 0, sizeof(*fft)); + } +} + +void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) +{ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ + + fft->length = length; + + error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); + assert(error == IIS_FFT_NO_ERROR); + fft->handle = *handle; +} + + +void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) +{ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ + + fft->length = length; + + error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); + + assert(error == IIS_FFT_NO_ERROR); + fft->handle = *handle; +} + +void fft_apply(Fft* fft, const Complex* input, Complex* output) +{ + IIS_FFT_ERROR error = 0; + error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); + + assert(error == IIS_FFT_NO_ERROR); +} + + +void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) +{ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + + UNUSED(error); + + error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); + + assert(error == IIS_FFT_NO_ERROR); +} diff --git a/lc3plus/license.h b/lc3plus/license.h new file mode 100755 index 0000000000..d9d6c89675 --- /dev/null +++ b/lc3plus/license.h @@ -0,0 +1,22 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "defines.h" + +static const char *const LICENSE = + "*******************************************************************************\n" + "* ETSI TS 103 634 V1.4.1 *\n" + "* Low Complexity Communication Codec Plus (LC3plus) *\n" + "* Floating Point Software V%i.%i.%iETSI, " __DATE__ " *\n" + "* Copyright licence is solely granted through ETSI Intellectual Property *\n" + "* Rights Policy, 3rd April 2019. No patent licence is granted by implication, *\n" + "* estoppel or otherwise. *\n" + "*******************************************************************************\n" + "\n"; diff --git a/lc3plus/ltpf_coder.c b/lc3plus/ltpf_coder.c new file mode 100755 index 0000000000..fac8c481c0 --- /dev/null +++ b/lc3plus/ltpf_coder.c @@ -0,0 +1,264 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); + +LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len) +{ + LC3_INT max_i = 0, i = 0; + LC3_FLOAT max = 0; + + if (len <= 0) { + return -128; + } + + for (i = 0; i < len; i++) { + if (in[i] > max) { + max = in[i]; + max_i = i; + } + } + + return max_i; +} + +void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC3_INT pitch_ol, LC3_FLOAT pitch_ol_norm_corr, LC3_INT frame_dms, + LC3_FLOAT* mem_old_x, LC3_INT memLen, LC3_FLOAT* mem_norm_corr_past, LC3_INT* mem_on, LC3_FLOAT* mem_pitch, + LC3_INT* param, LC3_FLOAT* mem_norm_corr_past_past, LC3_INT* bits) +{ + LC3_FLOAT buffer[LTPF_MEMIN_LEN + LEN_12K8 + 1 + (LEN_12K8 >> 2)] = {0}, sum = 0, buf_tmp[MAX_LEN] = {0}, cor_up[MAX_LEN] = {0}, *x; + LC3_INT i = 0, j = 0, k = 0, n = 0, step = 0, N = 0, ltpf_active = 0, pitch_search_delta = 0, + pitch_search_upsamp = 0, pitch_search_L_interpol1 = 0, + t0_min = 0, t0_max = 0, t_min = 0, t_max = 0, temp2 = 0, t1 = 0, pitch_int = 0, pitch_fr = 0, midpoint = 0, + delta_up = 0, delta_down = 0, pitch_index = 0, gain = 0, acflen = 0; + LC3_FLOAT norm_corr = 0, cor[MAX_LEN] = {0}, cor_int[MAX_LEN] = {0}, currFrame[MAX_LEN] = {0}, predFrame[MAX_LEN] = {0}, sum1 = 0, sum2 = 0, sum3 = 0; + LC3_FLOAT pitch = 0; + + /* Signal Buffer */ + N = xLen - 1; + x = &buffer[memLen]; + + move_float(buffer, mem_old_x, memLen); + move_float(x, xin, xLen); + move_float(mem_old_x, &buffer[N], xLen + memLen - N); + + ltpf_active = 0; + norm_corr = 0; + + pitch_search_delta = 4; + pitch_search_upsamp = 4; + pitch_search_L_interpol1 = 4; + + if (pitch_ol_norm_corr > 0.6) { + /* Search Bounds */ + t0_min = pitch_ol - pitch_search_delta; + t0_max = pitch_ol + pitch_search_delta; + t0_min = MAX(t0_min, MIN_PITCH_12K8); + t0_max = MIN(t0_max, MAX_PITCH_12K8); + acflen = N; + + if (frame_dms == 25) + { + acflen = 2 * N; + x = x - N; + } + + /* Cross-Correlation Bounds */ + t_min = t0_min - pitch_search_L_interpol1; + t_max = t0_max + pitch_search_L_interpol1; + + /* Compute norm */ + sum1 = sum2 = 0; + for (j = 0; j < acflen; j++) { + sum1 += x[j] * x[j]; + sum2 += x[j - t_min] * x[j - t_min]; + } + + /* Compute Cross-Correlation */ + for (i = t_min; i <= t_max; i++) { + sum = 0; + for (j = 0; j < acflen; j++) { + sum += x[j] * x[j - i]; + } + + if (i > t_min) { + sum2 = sum2 + x[-i]*x[-i] + - x[acflen - 1 - ( i - 1 )]*x[acflen - 1 - ( i - 1 )]; + } + sum3 = LC3_SQRT(sum1 * sum2) + LC3_POW(10, -5); + norm_corr = sum / sum3; + + norm_corr = MAX(0, norm_corr); + cor[i - t_min] = norm_corr; + + } + + /* Find Integer Pitch-Lag */ + j = 0; + for (i = pitch_search_L_interpol1; i <= t_max - t_min - pitch_search_L_interpol1; i++) { + buf_tmp[j] = cor[i]; + j++; + } + + temp2 = searchMaxIndice(buf_tmp, j); + + t1 = temp2 + t0_min; + assert(t1 >= t0_min && t1 <= t0_max); + + /* Find Fractional Pitch-Lag */ + if (t1 >= RES2_PITCH_12K8) { + pitch_int = t1; + pitch_fr = 0; + } else { + j = 0; + + for (i = 0; i < pitch_search_upsamp * (t_max - t_min) + 1; i = i + pitch_search_upsamp) { + cor_up[i] = cor[j]; + j++; + } + + for (i = 0; i < pitch_search_upsamp * (t0_max - t0_min + 1); i++) { + sum = 0; + + k = 0; + for (j = i; j < i + 32; j++) { + sum += cor_up[j] * inter4_1[k]; + k++; + } + + cor_int[i] = sum; + } + + if (t1 >= RES4_PITCH_12K8) { + step = 2; + } else { + step = 1; + } + + midpoint = pitch_search_upsamp * (t1 - t0_min) + 1; + delta_up = pitch_search_upsamp - step; + + if (t1 == t0_min) { + delta_down = 0; + } else { + delta_down = pitch_search_upsamp - step; + } + + j = 0; + for (i = midpoint - delta_down - 1; i <= midpoint + delta_up; i = i + step) { + buf_tmp[j] = cor_int[i]; + j++; + } + + temp2 = searchMaxIndice(buf_tmp, ((midpoint + delta_up) - (midpoint - delta_down)) / step + 1); + pitch_fr = temp2 * step - delta_down; + + if (pitch_fr >= 0) { + pitch_int = t1; + } else { + pitch_int = t1 - 1; + pitch_fr = pitch_search_upsamp + pitch_fr; + } + } + + assert((pitch_int <= MAX_PITCH_12K8 && pitch_int >= RES2_PITCH_12K8 && pitch_fr == 0) || + (pitch_int < RES2_PITCH_12K8 && pitch_int >= RES4_PITCH_12K8 && (pitch_fr == 0 || pitch_fr == 2)) || + (pitch_int < RES4_PITCH_12K8 && pitch_int >= MIN_PITCH_12K8 && + (pitch_fr == 0 || pitch_fr == 1 || pitch_fr == 2 || pitch_fr == 3))); + + if (pitch_int < RES4_PITCH_12K8) { + pitch_index = pitch_int * 4 + pitch_fr - (MIN_PITCH_12K8 * 4); + } else if (pitch_int < RES2_PITCH_12K8) { + pitch_index = pitch_int * 2 + floor(pitch_fr / 2) - (RES4_PITCH_12K8 * 2) + ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4); + } else { + pitch_index = pitch_int - RES2_PITCH_12K8 + ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) + ((RES2_PITCH_12K8 - RES4_PITCH_12K8) * 2); + } + + assert(pitch_index >= 0 && pitch_index < 512); + pitch = (LC3_FLOAT) pitch_int + (LC3_FLOAT) pitch_fr / 4.0; + + + for (n = 0; n < acflen; n++) + { + currFrame[n] = x[n + 1] * enc_inter_filter[0][0] + + x[n] * enc_inter_filter[0][1] + + x[n - 1] * enc_inter_filter[0][2]; + + predFrame[n] = x[n - pitch_int + 1] * enc_inter_filter[pitch_fr][0] + + x[n - pitch_int] * enc_inter_filter[pitch_fr][1] + + x[n - pitch_int - 1] * enc_inter_filter[pitch_fr][2] + + x[n - pitch_int - 2] * enc_inter_filter[pitch_fr][3]; + } + + /* Normalized Correlation */ + sum1 = sum2 = sum3 = 0; + + for (i = 0; i < acflen; i++) { + sum1 += currFrame[i] * predFrame[i]; + } + + for (i = 0; i < acflen; i++) { + sum2 += currFrame[i] * currFrame[i]; + } + + for (i = 0; i < acflen; i++) { + sum3 += predFrame[i] * predFrame[i]; + } + + sum2 = LC3_SQRT(sum2 * sum3) + LC3_POW(10, -5); + norm_corr = sum1 / sum2; + + assert(norm_corr >= -1.00001 && norm_corr <= 1.00001); + norm_corr = MIN(1, MAX(-1, norm_corr)); + if (norm_corr < 0) { + norm_corr = 0; + } + + if (ltpf_enable == 1) { + /* Decision if ltpf active */ + if ((*mem_on == 0 && (frame_dms == 100 || *mem_norm_corr_past_past > 0.94) && *mem_norm_corr_past > 0.94 && + norm_corr > 0.94) || + (*mem_on == 1 && norm_corr > 0.9) || + (*mem_on == 1 && LC3_FABS(pitch - *mem_pitch) < 2 && (norm_corr - *mem_norm_corr_past) > -0.1 && + norm_corr > 0.84)) { + ltpf_active = 1; + } + } + + gain = 4; + + } else { + gain = 0; + norm_corr = pitch_ol_norm_corr; + pitch = 0; + } + + if (gain > 0) { + param[0] = 1; + param[1] = ltpf_active; + param[2] = pitch_index; + *bits = 11; + } else { + zero_int(param, 3); + + *bits = 1; + } + + if (frame_dms < 100) { + *mem_norm_corr_past_past = *mem_norm_corr_past; + } + + *mem_norm_corr_past = norm_corr; + *mem_on = ltpf_active; + *mem_pitch = pitch; +} diff --git a/lc3plus/ltpf_decoder.c b/lc3plus/ltpf_decoder.c new file mode 100755 index 0000000000..a40c85213a --- /dev/null +++ b/lc3plus/ltpf_decoder.c @@ -0,0 +1,356 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, + LC3_INT* mem_pitch_int, LC3_INT* mem_pitch_fr, LC3_FLOAT* mem_gain, LC3_INT* mem_beta_idx, LC3_INT bfi, + LC3_INT* param, LC3_INT* mem_param, LC3_INT conf_beta_idx, LC3_FLOAT conf_beta, LC3_INT concealMethod, + LC3_FLOAT damping + , LC3_INT *mem_ltpf_active +) +{ + LC3_INT i = 0, j = 0, n = 0, N = 0, L_past_x = 0, N4 = 0, N34 = 0, + pitch_int = 0, pitch_fr = 0, p1 = 0, p2 = 0, L_past_y = 0, inter_len = 0, tilt_len = 0, + tilt_len_r = 0, inter_len_r = 0, old_x_len = 0, old_y_len = 0; + + LC3_FLOAT conf_alpha = 0, gain = 0, a1[MAX_LEN] = {0}, a2[MAX_LEN] = {0}, b1[MAX_LEN] = {0}, b2[MAX_LEN] = {0}, + buf_x[4 * MAX_LEN] = {0}, buf_y[4 * MAX_LEN] = {0}, buf_z[4 * MAX_LEN] = {0}, pitch = 0, sum1 = 0, sum2 = 0; + + const LC3_FLOAT *inter_filter[4], *tilt_filter[4]; + + + conf_alpha = 0.85; + + if (bfi != 1) { + /* Decode pitch */ + if (param[0] == 1) { + if (param[2] < (RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) { + pitch_int = MIN_PITCH_12K8 + floor(param[2] / 4); + pitch_fr = param[2] - ((pitch_int - MIN_PITCH_12K8) * 4); + } else if (param[2] < ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) + ((RES2_PITCH_12K8 - RES4_PITCH_12K8) * 2)) { + param[2] = param[2] - ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4); + pitch_int = RES4_PITCH_12K8 + floor(param[2] / 2); + pitch_fr = param[2] - ((pitch_int - RES4_PITCH_12K8) * 2); + pitch_fr = pitch_fr * 2; + } else { + pitch_int = + param[2] + (RES2_PITCH_12K8 - ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) - ((RES2_PITCH_12K8 - RES4_PITCH_12K8) * 2)); + pitch_fr = 0; + } + + pitch = ((LC3_FLOAT)pitch_int + (LC3_FLOAT)pitch_fr / 4.0) * (LC3_FLOAT)fs / 12800.0; + pitch = round(pitch * 4.0) / 4.0; + pitch_int = floor(pitch); + pitch_fr = (LC3_INT)((pitch - (LC3_FLOAT)pitch_int) * 4.0); + } else { + pitch_int = 0; + pitch_fr = 0; + } + + /* Decode gain */ + if (conf_beta_idx < 0) { + param[1] = 0; + } + + if (param[1] == 1) { + gain = conf_beta; + } else { + gain = 0; + } + } + else if (concealMethod > 0) { + if (conf_beta_idx < 0) { + if (mem_param[1] && *mem_beta_idx >= 0) + { + conf_beta_idx = *mem_beta_idx; + } + } + + memmove(param, mem_param, sizeof(LC3_INT32) * 3); + if (concealMethod == 2) + { + /* cause the ltpf to "fade_out" and only filter during initial 2.5 ms and then its buffer during 7.5 ms */ + assert(bfi == 1); + param[1] = 0; /* ltpf_active = 0 */ + } + + pitch_int = *mem_pitch_int; + pitch_fr = *mem_pitch_fr; + gain = (LC3_FLOAT) *mem_gain * damping; + } + + if ((conf_beta <= 0) && (*mem_ltpf_active == 0)) + { + if (fs == 8000 || fs == 16000) { + tilt_len = 4 - 2; + } + else if (fs == 24000) { + tilt_len = 6 - 2; + } + else if (fs == 32000) { + tilt_len = 8 - 2; + } + else if (fs == 44100 || fs == 48000) { + tilt_len = 12 - 2; + } + + N = xLen; + old_x_len = tilt_len; + inter_len = MAX(fs, 16000) / 8000; + old_y_len = ceilf((LC3_FLOAT)228.0 * fs / 12800.0) + inter_len; /* 228.0 needed to make use of ceil */ + + move_float(mem_old_y, &mem_old_y[N], (old_y_len - N)); + move_float(&mem_old_y[old_y_len - N], x, N); + move_float(mem_old_x, &x[N - old_x_len], old_x_len); + + *mem_ltpf_active = 0; + } + else + { + inter_len_r = 0; tilt_len_r = 0; + if (fs == 8000 || fs == 16000) { + inter_filter[0] = conf_inter_filter_16[0]; + inter_filter[1] = conf_inter_filter_16[1]; + inter_filter[2] = conf_inter_filter_16[2]; + inter_filter[3] = conf_inter_filter_16[3]; + inter_len_r = 4; + + tilt_filter[0] = conf_tilt_filter_16[0]; + tilt_filter[1] = conf_tilt_filter_16[1]; + tilt_filter[2] = conf_tilt_filter_16[2]; + tilt_filter[3] = conf_tilt_filter_16[3]; + tilt_len = 4 - 2; + tilt_len_r = 3; + } else if (fs == 24000) { + inter_filter[0] = conf_inter_filter_24[0]; + inter_filter[1] = conf_inter_filter_24[1]; + inter_filter[2] = conf_inter_filter_24[2]; + inter_filter[3] = conf_inter_filter_24[3]; + inter_len_r = 6; + + tilt_filter[0] = conf_tilt_filter_24[0]; + tilt_filter[1] = conf_tilt_filter_24[1]; + tilt_filter[2] = conf_tilt_filter_24[2]; + tilt_filter[3] = conf_tilt_filter_24[3]; + tilt_len = 6 - 2; + tilt_len_r = 5; + } else if (fs == 32000) { + inter_filter[0] = conf_inter_filter_32[0]; + inter_filter[1] = conf_inter_filter_32[1]; + inter_filter[2] = conf_inter_filter_32[2]; + inter_filter[3] = conf_inter_filter_32[3]; + inter_len_r = 8; + + tilt_filter[0] = conf_tilt_filter_32[0]; + tilt_filter[1] = conf_tilt_filter_32[1]; + tilt_filter[2] = conf_tilt_filter_32[2]; + tilt_filter[3] = conf_tilt_filter_32[3]; + tilt_len = 8 - 2; + tilt_len_r = 7; + } else if (fs == 44100 || fs == 48000) { + inter_filter[0] = conf_inter_filter_48[0]; + inter_filter[1] = conf_inter_filter_48[1]; + inter_filter[2] = conf_inter_filter_48[2]; + inter_filter[3] = conf_inter_filter_48[3]; + inter_len_r = 12; + + tilt_filter[0] = conf_tilt_filter_48[0]; + tilt_filter[1] = conf_tilt_filter_48[1]; + tilt_filter[2] = conf_tilt_filter_48[2]; + tilt_filter[3] = conf_tilt_filter_48[3]; + tilt_len = 12 - 2; + tilt_len_r = 11; + } + + inter_len = MAX(fs, 16000) / 8000; + + /* Init buffers */ + N = xLen; + old_x_len = tilt_len; + old_y_len = ceilf(228.0 * fs / 12800.0) + inter_len; + L_past_x = old_x_len; + move_float(buf_x, mem_old_x, old_x_len); + move_float(&buf_x[old_x_len], x, xLen); + L_past_y = old_y_len; + move_float(buf_y, mem_old_y, old_y_len); + zero_float(&buf_y[old_y_len], xLen); + + N4 = fs * 0.0025; + N34 = N - N4; + + /* Init filter parameters */ + if (mem_param[1] == 1) { + for (i = 0; i < inter_len_r; i++) { + a1[i] = *mem_gain * inter_filter[*mem_pitch_fr][i]; + } + + for (i = 0; i < tilt_len_r; i++) { + b1[i] = conf_alpha * (*mem_gain) * tilt_filter[*mem_beta_idx][i]; + } + + p1 = *mem_pitch_int; + } + + if (param[1] == 1) { + for (i = 0; i < tilt_len_r; i++) { + b2[i] = conf_alpha * gain * tilt_filter[conf_beta_idx][i]; + } + + for (i = 0; i < inter_len_r; i++) { + a2[i] = gain * inter_filter[pitch_fr][i]; + } + + p2 = pitch_int; + } + + /* First quarter of the current frame: cross-fading */ + if (mem_param[1] == 0 && param[1] == 0) { + memmove(&buf_y[L_past_y], &buf_x[L_past_x], sizeof(LC3_FLOAT) * N4); + + } else if (mem_param[1] == 1 && param[1] == 0) { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b1[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p1 + inter_len - 1; i >= L_past_y + n - p1 - inter_len; i--) { + sum2 += a1[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum1 + + (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum2; + } + + } else if (mem_param[1] == 0 && param[1] == 1) { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b2[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum1 + ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum2; + } + } else if (*mem_pitch_int == pitch_int && *mem_pitch_fr == pitch_fr) { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b2[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - sum1 + sum2; + } + } else { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b1[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p1 + inter_len - 1; i >= L_past_y + n - p1 - inter_len; i--) { + sum2 += a1[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum1 + + (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum2; + } + + memmove(buf_z, buf_y, sizeof(LC3_FLOAT) * 4 * MAX_LEN); + + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_y + n; i >= L_past_y + n - tilt_len; i--) { + sum1 += b2[j] * buf_z[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_z[L_past_y + n] - ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum1 + ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum2; + } + } + + /* Second quarter of the current frame */ + if (param[1] == 0) { + memmove(&buf_y[L_past_y + N4], &buf_x[L_past_x + N4], + sizeof(LC3_FLOAT) * ((L_past_x + N4 + N34) - (L_past_x + N4))); + } else { + for (n = 0; n < N34; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + N4 + n; i >= L_past_x + n + N4 - tilt_len; i--) { + sum1 += b2[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + N4 + n - p2 + inter_len - 1; i >= L_past_y + N4 + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + N4 + n] = buf_x[L_past_x + N4 + n] - sum1 + sum2; + } + } + + /* Output */ + move_float(y, &buf_y[L_past_y], N); + + /* Update memory */ + move_float(mem_old_x, &buf_x[N], old_x_len); + move_float(mem_old_y, &buf_y[N], old_y_len); + + *mem_ltpf_active = (conf_beta > 0); + } + + /* Update ltpf param memory */ + move_int(mem_param, param, 3); + *mem_pitch_int = pitch_int; + *mem_pitch_fr = pitch_fr; + *mem_gain = gain; + *mem_beta_idx = conf_beta_idx; +} diff --git a/lc3plus/makefile b/lc3plus/makefile new file mode 100755 index 0000000000..16758fc306 --- /dev/null +++ b/lc3plus/makefile @@ -0,0 +1,143 @@ +# GNU Makefile + +# Options +AFL = 0 +CLANG = 0 +GCOV = 0 +NO_POST_REL_CHANGES_TEST = 0 +OPTIM = 0 + +# Paths +VPATH = . +BUILD = build +CC = gcc +LINK = $(CC) + +# Binary Name +NAME_LC3 = LC3plus +# Shared Library Name +LIB_LC3 = libLC3plus.so + +# Default tool settings +CC = gcc +RM = rm -f + +# Preprocessor(-I/-D) / Compiler / Linker flags +CFLAGS += -std=c99 -fPIC \ + -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ + -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ + -Werror-implicit-function-declaration + +LDFLAGS += -lm -g +# Include dependency flags +DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD)/$*.Td + +ifneq "$(DEBUG)" "0" + CFLAGS += -g3 + LDFLAGS += -g3 +endif + +ifeq "$(GCOV)" "1" + CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs -ftest-coverage +endif + +OPTIM ?= 0 +CFLAGS += -O$(OPTIM) +CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) + +ifeq "$(NO_POST_REL_CHANGES_TEST)" "1" +CFLAGS += -DNO_POST_REL_CHANGES +endif + +# memory sanitizer, find use of uninitialized memory +ifeq "$(CLANG)" "1" + CC = clang + CFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer + LDFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer + OPTIM = 2 +endif + +# address sanitizer, find buffer overflows +ifeq "$(CLANG)" "2" + CC = clang + CFLAGS += -fsanitize=address -fno-omit-frame-pointer + LDFLAGS += -fsanitize=address -fno-omit-frame-pointer + OPTIM = 2 +endif + +# undefined behavior sanitizer, find bugs like integer overflows +ifeq "$(CLANG)" "3" + CC = clang + CFLAGS += -fsanitize=undefined + LDFLAGS += -fsanitize=undefined + OPTIM = 2 +endif + +# for code coverate test +ifeq "$(GCOV)" "1" + CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs -ftest-coverage +endif + +# verbose output +ifneq "$(VERBOSE)" "1" + QUIET = @ +endif + +# dependency magic +CC_FLAGS = '$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)' +POSTCOMPILE = mv -f $(BUILD)/$*.Td $(BUILD)/$*.d && touch $@ + +######## Generate source / object lists ######## + +SRCS := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) +SRCS_LIB := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) +OBJS := $(addprefix $(BUILD)/, $(SRCS:.c=.o)) + +LIBSRCS := $(filter-out $(DIR)/ccConvert.c $(DIR)/codec_exe.c, $(SRCS)) +LIBOBJS := $(addprefix $(BUILD)/, $(LIBSRCS:.c=.o)) + +.PHONY: all clean help force + +.PRECIOUS: $(BUILD)/%.d + +all: $(NAME_LC3) + +help: + @echo 'Targets:' + @echo ' $(NAME_LC3) (default)' + @echo ' $(LIB_LC3)' + @echo 'Syntax: make [OPTION=VALUE ...]' + @echo 'Build options:' + @echo ' NO_POST_REL_CHANGES_TEST $(NO_POST_REL_CHANGES_TEST) [0,1]' + @echo ' OPTIM $(OPTIM) [0-3]' + @echo 'Debug options:' + @echo ' AFL $(AFL) [0,1]' + @echo ' CLANG $(CLANG) [0-3]' + @echo ' GCOV $(GCOV) [0,1]' + +$(NAME_LC3): $(OBJS) + @echo 'Linking' $@ + $(QUIET) $(LINK) $(OBJS) -o $@ $(LDFLAGS) + +$(LIB_LC3): $(LIBOBJS) + @echo 'Linking' $@ + $(QUIET) $(LINK) --shared $(OBJS) -o $@ $(LDFLAGS) + +clean: + $(QUIET) rm -rf $(NAME_LC3) $(LIB_LC3) $(BUILD) ccConvert + +$(BUILD)/%.o : %.c $(BUILD)/cc_flags + @echo 'Compiling' $< + $(QUIET) $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(QUIET) $(POSTCOMPILE) + +# force rebuild if compilation flags changed +$(BUILD)/cc_flags: force + $(QUIET) mkdir -p $(BUILD) + $(QUIET) echo $(CC_FLAGS) | cmp -s - $@ || echo $(CC_FLAGS) > $@ + +# force rebuild if include dependency changed +$(BUILD)/%.d: ; +include $(wildcard $(patsubst %, $(BUILD)/%.d, $(basename $(SRCS)))) diff --git a/lc3plus/mdct.c b/lc3plus/mdct.c new file mode 100755 index 0000000000..11618b9465 --- /dev/null +++ b/lc3plus/mdct.c @@ -0,0 +1,128 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) +{ + if (frame_dms == 100) { + switch (length) { + case 80: + return MDCT_WINS_10ms[hrmode][0]; + case 160: + return MDCT_WINS_10ms[hrmode][1]; + case 240: + return MDCT_WINS_10ms[hrmode][2]; + case 320: + return MDCT_WINS_10ms[hrmode][3]; + case 480: + return MDCT_WINS_10ms[hrmode][4]; + case 960: + return MDCT_WINS_10ms[hrmode][5]; + default: + return NULL; + } + } + else if (frame_dms == 50) { + switch (length) { + case 40: + return MDCT_WINS_5ms[hrmode][0]; + case 80: + return MDCT_WINS_5ms[hrmode][1]; + case 120: + return MDCT_WINS_5ms[hrmode][2]; + case 160: + return MDCT_WINS_5ms[hrmode][3]; + case 240: + return MDCT_WINS_5ms[hrmode][4]; + case 480: + return MDCT_WINS_5ms[hrmode][5]; + default: + return NULL; + } + } + else if (frame_dms == 25) { + switch (length) { + case 20: + return MDCT_WINS_2_5ms[hrmode][0]; + case 40: + return MDCT_WINS_2_5ms[hrmode][1]; + case 60: + return MDCT_WINS_2_5ms[hrmode][2]; + case 80: + return MDCT_WINS_2_5ms[hrmode][3]; + case 120: + return MDCT_WINS_2_5ms[hrmode][4]; + case 240: + return MDCT_WINS_2_5ms[hrmode][5]; + default: + return NULL; + } + } + return NULL; +} + +void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC3_INT hrmode) +{ + if (frame_dms == 100) { + mdct->leading_zeros = MDCT_la_zeroes[fs_idx]; + } + else if (frame_dms == 50) { + mdct->leading_zeros = MDCT_la_zeroes_5ms[fs_idx]; + } + else if (frame_dms == 25) { + mdct->leading_zeros = MDCT_la_zeroes_2_5ms[fs_idx]; + } + else { + assert(!"invalid frame_ms"); + } + + mdct->length = length; + mdct->mem_length = length - mdct->leading_zeros; + mdct->window = mdct_window(length, frame_dms, hrmode); + mdct->mem = calloc(sizeof(*mdct->mem), mdct->mem_length); + dct4_init(&mdct->dct, length); +} + +void mdct_free(Mdct* mdct) +{ + if (mdct) { + free(mdct->mem); + dct4_free(&mdct->dct); + memset(mdct, 0, sizeof(*mdct)); + } +} + +void mdct_apply(const LC3_FLOAT* input, LC3_FLOAT* output, Mdct* mdct) +{ + LC3_FLOAT tmp[MAX_LEN * 2] = {0}; + LC3_INT i = 0; + LC3_INT hlen; + + move_float(tmp, mdct->mem, mdct->mem_length); + move_float(tmp + mdct->mem_length, input, mdct->length); + zero_float(tmp + mdct->length * 2 - mdct->leading_zeros, mdct->leading_zeros); + move_float(mdct->mem, tmp + mdct->length, mdct->mem_length); + + mult_vec(tmp, mdct->window, mdct->length * 2); + + hlen = mdct->length / 2; + for (i = 0; i < hlen; i++) { + output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i]; + output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; + } + + move_float(tmp, output, mdct->length); + + dct4_apply(&mdct->dct, tmp, output); +} + +void processMdct_fl(LC3_FLOAT* in, LC3_FLOAT* out, Mdct* mdctStruct) { mdct_apply(in, out, mdctStruct); } diff --git a/lc3plus/mdct_shaping.c b/lc3plus/mdct_shaping.c new file mode 100755 index 0000000000..1876192504 --- /dev/null +++ b/lc3plus/mdct_shaping.c @@ -0,0 +1,23 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +{ + LC3_INT i = 0, j = 0; + + for (i = 0; i < fdns_npts; i++) { + for (; j < bands_offset[i + 1]; j++) { + x[j] = x[j] * scf[i]; + } + } +} diff --git a/lc3plus/msvc/.gitignore b/lc3plus/msvc/.gitignore new file mode 100644 index 0000000000..f40a919a54 --- /dev/null +++ b/lc3plus/msvc/.gitignore @@ -0,0 +1 @@ +Win32/ \ No newline at end of file diff --git a/lc3plus/msvc/LC3plus.sln b/lc3plus/msvc/LC3plus.sln new file mode 100755 index 0000000000..a8ee38ea81 --- /dev/null +++ b/lc3plus/msvc/LC3plus.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3_FL", "LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|x64 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.Build.0 = Release|x64 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/lc3plus/msvc/LC3plus.vcxproj b/lc3plus/msvc/LC3plus.vcxproj new file mode 100755 index 0000000000..ffbfdf344b --- /dev/null +++ b/lc3plus/msvc/LC3plus.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {95030B82-70CD-4C6B-84D4-61096035BEA2} + Win32Proj + LC3_FL + 10.0.17763.0 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + true + LC3plus + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + + + false + LC3plus + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + + + + + + Level3 + ..\..\lib_com;%(AdditionalIncludeDirectories) + Disabled + MultiThreadedDebug + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4305;4244;4996 + + + Console + true + + + + + Level3 + + + ..\..\lib_com;%(AdditionalIncludeDirectories) + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4244;4305;4996 + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lc3plus/near_nyquist_detector.c b/lc3plus/near_nyquist_detector.c new file mode 100755 index 0000000000..ce94351302 --- /dev/null +++ b/lc3plus/near_nyquist_detector.c @@ -0,0 +1,38 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + +#include "functions.h" +#include "options.h" + + +void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, + const LC3_INT bands_number, const LC3_FLOAT* ener) +{ + *near_nyquist_flag = 0; + + if (fs_idx < 4) + { + LC3_INT i = 0; + LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0; + + for (i=0; i NN_thresh * ener_low){ + *near_nyquist_flag = 1; + } + } +} diff --git a/lc3plus/noise_factor.c b/lc3plus/noise_factor.c new file mode 100755 index 0000000000..c5aa582e45 --- /dev/null +++ b/lc3plus/noise_factor.c @@ -0,0 +1,112 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, + LC3_INT target_bytes +) +{ + LC3_INT sumZeroLines = 0, kZeroLines = 0, startOffset = 0, nTransWidth = 0, end = 0, start = 0, i = 0, j = 0, k = 0, + allZeros = 0, m = 0; + LC3_FLOAT fac_ns_unq = 0, mean = 0, idx = 0, nsf1 = 0, nsf2 = 0; + LC3_INT zeroLines[MAX_LEN] = {0}, zL1[MAX_LEN] = {0}, zL2[MAX_LEN] = {0}; + + switch (frame_dms) + { + case 25: + nTransWidth = 4; + startOffset = 6; + break; + case 50: + nTransWidth = 4; + startOffset = 12; + break; + case 100: + nTransWidth = 8; + startOffset = 24; + break; + } + + for (k = startOffset; k < BW_cutoff_idx; k++) { + allZeros = 1; + + start = k - (nTransWidth - 2) / 2; + end = MIN(BW_cutoff_idx - 1, k + (nTransWidth - 2) / 2); + + for (i = start; i <= end; i++) { + if (xq[i] != 0) { + allZeros = 0; + } + } + + if (allZeros == 1) { + zeroLines[j] = k + 1; + kZeroLines++; + j++; + } + } + + for (i = 0; i < kZeroLines; i++) { + sumZeroLines += zeroLines[i]; + } + + if (sumZeroLines > 0) { + for (j = 0; j < kZeroLines; j++) { + mean += LC3_FABS(x[zeroLines[j] - 1]); + } + + fac_ns_unq = mean / (gg * kZeroLines); + } else { + fac_ns_unq = 0; + } + + if (kZeroLines > 0) + { + if (target_bytes <= 20 && frame_dms == 100) { + j = 0, k = 0; + m = floor(sumZeroLines / kZeroLines); + + for (i = 0; i < kZeroLines; i++) { + if (zeroLines[i] <= m) { + zL1[j] = zeroLines[i]; + j++; + } + + if (zeroLines[i] > m) { + zL2[k] = zeroLines[i]; + k++; + } + } + + mean = 0; + for (i = 0; i < j; i++) { + mean += LC3_FABS(x[zL1[i] - 1]) / gg; + } + + nsf1 = mean / j; + + mean = 0; + for (i = 0; i < k; i++) { + mean += LC3_FABS(x[zL2[i] - 1]) / gg; + } + + nsf2 = mean / k; + + fac_ns_unq = MIN(nsf1, nsf2); + } + } + + idx = round(8 - 16 * fac_ns_unq); + idx = MIN(MAX(idx, 0), 7); + + *fac_ns_idx = idx; +} diff --git a/lc3plus/noise_filling.c b/lc3plus/noise_filling.c new file mode 100755 index 0000000000..7fac5e0f72 --- /dev/null +++ b/lc3plus/noise_filling.c @@ -0,0 +1,81 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) +{ + LC3_INT zeroLines[MAX_LEN] = {0}; + LC3_INT nTransWidth = 0, startOffset = 0, i = 0, j = 0, k = 0, start = 0, end = 0, allZeros = 0, kZeroLines = 0; + LC3_FLOAT fac_ns = 0; + + switch (frame_dms) + { + case 25: + nTransWidth = 1; + startOffset = 6; + break; + case 50: + nTransWidth = 1; + startOffset = 12; + break; + case 100: + nTransWidth = 3; + startOffset = 24; + break; + } + + fac_ns = (8.0 - fac_ns_idx) / 16.0; + + j = 0; + + for (k = startOffset; k < bw_stopband; k++) { + allZeros = 1; + + start = k - nTransWidth; + end = MIN(bw_stopband - 1, k + nTransWidth); + + for (i = start; i <= end; i++) { + if (xq[i] != 0) { + allZeros = 0; + } + } + + if (allZeros == 1) { + zeroLines[j] = k; + kZeroLines++; + j++; + } + } + + for (k = 0; k < kZeroLines; k++) { + nfseed = (13849 + (nfseed + 32768) * 31821) & 65535; + nfseed -= 32768; + + if (nfseed >= 0) { + if (zeroLines[k] < spec_inv_idx) + { + xq[zeroLines[k]] = fac_ns; + } else { + xq[zeroLines[k]] = fac_ns_pc; + } + } else { + if (zeroLines[k] < spec_inv_idx) + { + xq[zeroLines[k]] = -fac_ns; + } else { + xq[zeroLines[k]] = -fac_ns_pc; + } + } + } + + return; +} diff --git a/lc3plus/olpa.c b/lc3plus/olpa.c new file mode 100755 index 0000000000..6bec50952e --- /dev/null +++ b/lc3plus/olpa.c @@ -0,0 +1,144 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); +static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); + +void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input) +{ + LC3_INT i = 0, j = 0; + LC3_FLOAT sum = 0; + /* a = 1, so denominator == 1, nothing to do here */ + + for (i = 0; i < len_input; i++) { + j = 0; + sum = 0; + for (j = 0; (j < len_buf) && (j <= i); j++) { + sum += buf[j] * in[i - j]; + } + + out[i] = sum; + } +} + +LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len) +{ + LC3_INT max_i = 0, i = 0; + LC3_FLOAT max = in[0]; + + if (len <= 0) { + return -128; + } + + for (i = 0; i < len; i++) { + if (in[i] > max) { + max = in[i]; + max_i = i; + } + } + + return max_i; +} + +void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4, LC3_INT* mem_old_T0, LC3_INT* T0_out, + LC3_FLOAT* normcorr_out, LC3_INT len, LC3_INT frame_dms) +{ + LC3_FLOAT norm_corr = 0, sum = 0, sum0 = 0, sum1 = 0, sum2 = 0, norm_corr2 = 0, *s6k4; + LC3_FLOAT buf[LEN_6K4 + MAX_PITCH_6K4] = {0}, filt_out[LEN_12K8 + 3] = {0}, d_wsp[LEN_6K4] = {0}, R0[RANGE_PITCH_6K4] = {0}, R[RANGE_PITCH_6K4] = {0}; /* constant length */ + LC3_INT i = 0, j = 0, len2 = 0, T0 = 0, T02 = 0, min_pitch = 0, max_pitch = 0, L = 0, mem_in_len = 0, acflen = 0; + + + mem_in_len = MAX_PITCH_6K4; + len2 = len / 2; + acflen = len2; + if (frame_dms == 25) + { + mem_in_len += 16; + acflen += 16; + } + + /* Downsampling */ + move_float(buf, mem_s12k8, 3); + move_float(&buf[3], s_12k8, len); + move_float(mem_s12k8, &buf[len], 3); + filter_olpa(buf, filt_out, olpa_down2, 5, len + 3); + for (i = 4, j = 0; i < len + 3; i = i + 2) { + d_wsp[j] = filt_out[i]; + j++; + } + + /* Compute autocorrelation */ + s6k4 = &buf[mem_in_len]; + move_float(buf, mem_s6k4, mem_in_len); + move_float(s6k4, d_wsp, len2); + move_float(mem_s6k4, &buf[len2], mem_in_len); + if (frame_dms == 25) + { + s6k4 = s6k4 - 16; + } + for (i = MIN_PITCH_6K4; i <= MAX_PITCH_6K4; i++) { + sum = 0; + for (j = 0; j < acflen; j++) { + sum += s6k4[j] * s6k4[j - i]; + } + R0[i - MIN_PITCH_6K4] = sum; + } + + /* Weight autocorrelation and find maximum */ + move_float(R, R0, RANGE_PITCH_6K4); + for (i = 0; i < RANGE_PITCH_6K4; i++) { + R0[i] = R0[i] * olpa_acw[i]; + } + L = searchMaxIndice(R0, RANGE_PITCH_6K4); + T0 = L + MIN_PITCH_6K4; + + /* Compute normalized correlation */ + sum0 = sum1 = sum2 = 0; + for (i = 0; i < acflen; i++) { + sum0 += s6k4[i] * s6k4[i - T0]; + sum1 += s6k4[i - T0] * s6k4[i - T0]; + sum2 += s6k4[i] * s6k4[i]; + } + sum1 = sum1 * sum2; + sum1 = LC3_SQRT(sum1) + LC3_POW(10.0, -5.0); + norm_corr = sum0 / sum1; + norm_corr = MAX(0, norm_corr); + + /* Second try in the neighborhood of the previous pitch */ + min_pitch = MAX(MIN_PITCH_6K4, *mem_old_T0 - 4); + max_pitch = MIN(MAX_PITCH_6K4, *mem_old_T0 + 4); + L = searchMaxIndice(&R[min_pitch - MIN_PITCH_6K4], max_pitch - min_pitch + 1 ); + T02 = L + min_pitch; + + if (T02 != T0) { + sum0 = sum1 = sum2 = 0; + for (i = 0; i < acflen; i++) { + sum0 += s6k4[i] * s6k4[i - T02]; + sum1 += s6k4[i - T02] * s6k4[i - T02]; + sum2 += s6k4[i] * s6k4[i]; + } + sum1 = sum1 * sum2; + sum1 = LC3_SQRT(sum1) + LC3_POW(10.0, -5.0); + norm_corr2 = sum0 / sum1; + norm_corr2 = MAX(0, norm_corr2); + + if (norm_corr2 > (norm_corr * 0.85)) { + T0 = T02; + norm_corr = norm_corr2; + } + } + + *mem_old_T0 = T0; + *T0_out = T0 * 2.0; + *normcorr_out = norm_corr; +} diff --git a/lc3plus/pc_apply.c b/lc3plus/pc_apply.c new file mode 100755 index 0000000000..1d1bc40005 --- /dev/null +++ b/lc3plus/pc_apply.c @@ -0,0 +1,73 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPcApply_fl(LC3_FLOAT *q_res, LC3_FLOAT *q_old_res, LC3_FLOAT *q_d_prev, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_FLOAT *prev_gg, LC3_FLOAT *fac, LC3_INT32 *pc_nbLostCmpt) +{ + LC3_FLOAT gg, mean_nrg_low, mean_nrg_high, ener_prev, ener_curr, fac_local; + LC3_INT32 i; + + ener_prev = 0; ener_curr = 0; mean_nrg_low = 0; mean_nrg_high = 0; + + *pc_nbLostCmpt = *pc_nbLostCmpt + 1; + + assert(spec_inv_idx > 1); + + gg = LC3_POW(10, (((LC3_FLOAT) (gg_idx + gg_idx_off)) / 28.0)); + + for (i = 0; i < spec_inv_idx; i++) + { + mean_nrg_low += LC3_POW(q_d_prev[i], 2); + } + + mean_nrg_low /= (LC3_FLOAT) spec_inv_idx; + + if (spec_inv_idx < yLen) + { + for (i = spec_inv_idx; i < yLen; i++) + { + mean_nrg_high += LC3_POW(q_d_prev[i], 2); + } + } + + mean_nrg_high /= (LC3_FLOAT) (yLen - spec_inv_idx); + + for (i = 0; i < spec_inv_idx; i++) + { + ener_prev += LC3_POW(q_old_res[i], 2); + ener_curr += LC3_POW(q_res[i], 2); + } + + *fac = 1; + if (ener_prev > 0) + { + *fac = LC3_SQRT(ener_curr / ener_prev); + } + + fac_local = *fac; + if (mean_nrg_low <= mean_nrg_high || ener_prev * LC3_POW(*prev_gg, 2) <= ener_curr * LC3_POW(gg, 2)) + { + fac_local = *prev_gg / gg; + } + + for (i = spec_inv_idx; i < yLen; i++) + { + q_res[i] = q_old_res[i] * fac_local; + + if (LC3_FABS(q_res[i]) < (1 - 0.375)) + { + q_res[i] = 0; + } + } +} + diff --git a/lc3plus/pc_classify.c b/lc3plus/pc_classify.c new file mode 100755 index 0000000000..71196edb89 --- /dev/null +++ b/lc3plus/pc_classify.c @@ -0,0 +1,170 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +LC3_FLOAT pc_peak_detector(LC3_FLOAT *q_d_prev, LC3_INT32 yLen); + +void processPcClassify_fl(LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *q_d_prev, LC3_FLOAT *q_old_res, LC3_INT32 yLen, LC3_INT32 spec_inv_idx, LC3_FLOAT stab_fac, LC3_INT32 *bfi) +{ + LC3_INT32 maxPitchBin, xover, i; + LC3_FLOAT part_nrg, full_nrg; + + part_nrg = 0; full_nrg = 0; + + if (spec_inv_idx < (4 * frame_dms / 10)) + { + if (stab_fac < 0.5) + { + *bfi = 1; + } else if (pitch_present == 1) + { + maxPitchBin = 8; + if (frame_dms == 50) + { + maxPitchBin = 4; + } + xover = pc_peak_detector(q_d_prev, yLen); + if (spec_inv_idx < xover || spec_inv_idx < maxPitchBin) + { + *bfi = 1; + } + } else { + for (i = 0; i < spec_inv_idx; i++) + { + part_nrg += LC3_POW(q_old_res[i], 2); + } + + for (i = 0; i < yLen; i++) + { + full_nrg += LC3_POW(q_old_res[i], 2); + } + + if (part_nrg < (0.3 * full_nrg)) + { + *bfi = 1; + } + } + } +} + +LC3_FLOAT pc_peak_detector(LC3_FLOAT *q_d_prev, LC3_INT32 yLen) +{ + LC3_INT32 block_size, thresh1, i, peak, j, k; + LC3_FLOAT fac, mean_block_nrg, cur_max, block_cent, maxPeak, next_max, prev_max; + + mean_block_nrg = 0; + + block_size = 3; + thresh1 = 8; + fac = 0.3; + + for (i = 0; i < yLen; i++) + { + mean_block_nrg += LC3_POW(q_d_prev[i], 2); + } + + mean_block_nrg /= yLen; + + maxPeak = 0; + peak = 0; + + if (LC3_FABS(q_d_prev[0]) > LC3_FABS(q_d_prev[1])) + { + block_cent = LC3_POW(q_d_prev[0], 2) + LC3_POW(q_d_prev[1], 2); + + if ((block_cent / block_size) > (thresh1 * mean_block_nrg)) + { + cur_max = MAX(LC3_FABS(q_d_prev[0]), LC3_FABS(q_d_prev[1])); + next_max = array_max_abs(&q_d_prev[2], 3); + + if (cur_max > next_max) + { + maxPeak = block_cent; + peak = 1; + } + } + } + + for (i = 0; i < block_size; i++) + { + if ((LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i])) && LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i + 2])) + { + block_cent = 0; + for (j = i; j < i + block_size; j++) + { + block_cent += LC3_POW(q_d_prev[j], 2); + } + + if ((block_cent / block_size) > (thresh1 * mean_block_nrg)) + { + cur_max = array_max_abs(&q_d_prev[i], block_size); + prev_max = 0; + + for (k = i - block_size; k < i; k++) + { + if (k > 0) + { + prev_max = MAX(LC3_FABS(q_d_prev[k]), prev_max); + } + } + next_max = array_max_abs(&q_d_prev[i + block_size], block_size); + + if ((cur_max >= prev_max) && (cur_max > next_max)) + { + if (block_cent > (fac * maxPeak)) + { + peak = i + block_size - 1; + if (block_cent >= maxPeak) + { + maxPeak = block_cent; + } + } + } + } + } + } + + for (i = block_size; i < yLen - (2 * block_size); i++) + { + if ((LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i])) && LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i + 2])) + { + block_cent = 0; + for (j = i; j < i + block_size; j++) + { + block_cent += LC3_POW(q_d_prev[j], 2); + } + + if ((block_cent / block_size) > (thresh1 * mean_block_nrg)) + { + cur_max = array_max_abs(&q_d_prev[i], block_size); + prev_max = array_max_abs(&q_d_prev[i - block_size], block_size); + next_max = array_max_abs(&q_d_prev[i + block_size], block_size); + + if ((cur_max >= prev_max) && (cur_max > next_max)) + { + if (block_cent > (fac * maxPeak)) + { + peak = i + block_size - 1; + if (block_cent >= maxPeak) + { + maxPeak = block_cent; + } + } + } + } + } + } + + return peak; +} + diff --git a/lc3plus/pc_main.c b/lc3plus/pc_main.c new file mode 100755 index 0000000000..268ee94d2a --- /dev/null +++ b/lc3plus/pc_main.c @@ -0,0 +1,43 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPcMain_fl(LC3_INT32 *bfi, LC3PLUS_Dec* decoder, LC3_FLOAT *sqQdec, DecSetup* h_DecSetup, LC3_INT32 pitch_present, LC3_FLOAT stab_fac, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 fac_ns_idx, pcState *statePC, LC3_INT32 spec_inv_idx, LC3_INT32 yLen) +{ + LC3_FLOAT fac; + + /* PC Classifier */ + if (*bfi == 2) + { + processPcClassify_fl(pitch_present, decoder->frame_dms, h_DecSetup->PlcSetup.q_d_prev, statePC->q_old_res, decoder->yLen, h_DecSetup->spec_inv_idx, stab_fac, bfi); + } + + /* PC Apply */ + if (*bfi == 2) + { + processPcApply_fl(sqQdec, statePC->q_old_res, h_DecSetup->PlcSetup.q_d_prev, h_DecSetup->spec_inv_idx, decoder->yLen, gg_idx, gg_idx_off, &statePC->prev_gg, &fac, &statePC->ns_nbLostCmpt_pc); + } + + /* PC Update */ + if (*bfi != 1) + { + processPcUpdate_fl(*bfi, sqQdec, gg_idx, gg_idx_off, decoder->rframe, &h_DecSetup->BW_cutoff_idx_nf, &h_DecSetup->prev_BW_cutoff_idx_nf, fac_ns_idx, &h_DecSetup->prev_fac_ns, &fac, statePC->q_old_res, &statePC->prev_gg, spec_inv_idx, yLen); + } + + /* Reset counter */ + if (*bfi == 0) + { + statePC->ns_nbLostCmpt_pc = 0; + } +} + diff --git a/lc3plus/pc_update.c b/lc3plus/pc_update.c new file mode 100755 index 0000000000..57539b5079 --- /dev/null +++ b/lc3plus/pc_update.c @@ -0,0 +1,37 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPcUpdate_fl(LC3_INT32 bfi, LC3_FLOAT *q_res, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 rframe, LC3_INT32 *BW_cutoff_idx_nf, LC3_INT32 *prev_BW_cutoff_idx_nf, + LC3_INT32 fac_ns_idx, LC3_FLOAT *prev_fac_ns, LC3_FLOAT *fac, LC3_FLOAT *q_old_res, LC3_FLOAT *prev_gg, LC3_INT32 spec_inv_idx, LC3_INT32 yLen) +{ + LC3_FLOAT gg; + + gg = LC3_POW(10.0, ((LC3_FLOAT) (gg_idx + gg_idx_off)) / 28.0); + *prev_gg = gg; + move_float(q_old_res, q_res, yLen); + + if (rframe == 0) + { + *prev_BW_cutoff_idx_nf = *BW_cutoff_idx_nf; + *prev_fac_ns = (8.0 - (LC3_FLOAT) fac_ns_idx) / 16.0; + } else if ((bfi == 2) && (*BW_cutoff_idx_nf != *prev_BW_cutoff_idx_nf) && (spec_inv_idx < yLen)) + { + *BW_cutoff_idx_nf = *prev_BW_cutoff_idx_nf; + *prev_fac_ns = *prev_fac_ns * (*fac); + *prev_fac_ns = MAX(*prev_fac_ns, (8.0 - 7.0) / 16.0); + *prev_fac_ns = MIN(*prev_fac_ns, (8.0 - 0.0) / 16.0); + } + +} + diff --git a/lc3plus/per_band_energy.c b/lc3plus/per_band_energy.c new file mode 100755 index 0000000000..db1b5b2d0f --- /dev/null +++ b/lc3plus/per_band_energy.c @@ -0,0 +1,59 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) +{ + LC3_INT i = 0, j = 0, start = 0, stop = 0, maxBwBin = 0; + LC3_FLOAT sum = 0; + +# ifdef ENABLE_HR_MODE_FL + if (hrmode) + { + maxBwBin = MAX_BW_HR; + } + else +# else + UNUSED(hrmode); +# endif + { + maxBwBin = MAX_BW; + } + switch (frame_dms) + { +# ifdef ENABLE_2_5MS_MODE + case 25: + maxBwBin = maxBwBin >> 2; + break; +# endif +# ifdef ENABLE_5MS_MODE + case 50: + maxBwBin = maxBwBin >> 1; + break; +# endif + } + + for (i = 0; i < bands_number; i++) { + sum = 0; + start = acc_coeff_per_band[i]; + stop = MIN(acc_coeff_per_band[i + 1], maxBwBin); + + for (j = start; j < stop; j++) { + sum += d[j] * d[j]; + } + + if (stop - start > 0) { + sum = sum / (LC3_FLOAT)(stop - start); + } + d2[i] = sum; + } +} diff --git a/lc3plus/plc_classify.c b/lc3plus/plc_classify.c new file mode 100755 index 0000000000..619a1f7419 --- /dev/null +++ b/lc3plus/plc_classify.c @@ -0,0 +1,199 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +static void plc_xcorr_lc(LC3_FLOAT *pcmbufHist, LC3_INT32 max_len_pcm_plc, LC3_INT32 pitch_int, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 fs, LC3_FLOAT *xcorr); +static void spectral_centroid_lc(LC3_FLOAT *gains, LC3_INT32 tilt, const LC3_INT *bands_offset, LC3_INT32 bands_number, LC3_INT32 framelength, LC3_INT32 fs, LC3_FLOAT *sc); + +void processPlcClassify_fl(LC3_INT plcMeth, LC3_INT *concealMethod, LC3_INT32 *nbLostCmpt, LC3_INT32 bfi, + LC3_FLOAT *xcorr, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 pitch_int, + LC3_INT32 fs, const LC3_INT *band_offsets, LC3_INT32 bands_number, LC3_INT32 tilt, PlcAdvSetup *plcAd + , LC3_INT32 hrmode +) +{ + LC3_FLOAT sc, class; + + if (plcAd) + { + *xcorr = 0; + } + + if (bfi == 1) + { + *nbLostCmpt = *nbLostCmpt + 1; + + /* Use pitch correlation at ltpf integer lag if available */ + if (*nbLostCmpt == 1) + { + *concealMethod = plcMeth; // this is a dangerous mapping! + + /* Advanced PLC */ + if (pitch_int > 0) + { + *concealMethod = 3; /* Timedomain PLC assumed */ + plc_xcorr_lc(plcAd->pcmbufHist, plcAd->max_len_pcm_plc, pitch_int, framelength, frame_dms, fs, xcorr); + + spectral_centroid_lc(plcAd->scf_q_old, tilt, band_offsets, bands_number, framelength, fs, &sc); + class = *xcorr * 7640.0/32768.0 - sc - 5112.0/32768.0; + + if (class <= 0) + { + if (frame_dms == 100 && hrmode == 0) + { + *concealMethod = 2; /* PhaseEcu selected */ + } + else + { + *concealMethod = 4; /* Noise Substitution */ + } + } + } + else + { + *concealMethod = 4; /* Noise Substitution */ + } + } + } +} + +static void spectral_centroid_lc(LC3_FLOAT *gains, LC3_INT32 tilt, const LC3_INT *band_offsets, LC3_INT32 bands_number, LC3_INT32 framelength, LC3_INT32 fs, LC3_FLOAT *sc) +{ + LC3_FLOAT gains_lin[M], gains_dee[M], numerator, denumerator; + LC3_INT32 i, j, sum, len, start, stop; + LC3_INT band_offsets_local[MAX_BANDS_NUMBER + 1]; + + numerator = 0; + + for (i = 0; i < M; i++) + { + gains_lin[i] = LC3_POW(2, gains[i]); + } + + for (i = 0; i < M; i++) + { + gains_dee[i] = gains_lin[i] / LC3_POW(10, i * (LC3_FLOAT) tilt / (LC3_FLOAT) (M - 1) / 10.0); + } + + if (bands_number == 64) + { + memmove(band_offsets_local, band_offsets, (bands_number + 1) * sizeof(LC3_INT)); + } + + if (bands_number < 32) + { + band_offsets_local[0] = 0; + j = 32 - bands_number; + for (i = bands_number - 1; i >= j; i--) + { + band_offsets_local[(i + j) * 2 + 1 + 1] = band_offsets[i + 1]; + band_offsets_local[(i + j) * 2 + 0 + 1] = band_offsets[i + 1]; + } + for (i = j - 1; i >= 0; i--) + { + band_offsets_local[i * 4 + 3 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 4 + 2 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 4 + 1 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 4 + 0 + 1] = band_offsets[i + 1]; + } + } + else + if (bands_number < 64) + { + band_offsets_local[0] = 0; + j = 64 - bands_number; + for (i = bands_number - 1; i >= j; i--) + { + band_offsets_local[i + j + 1] = band_offsets[i + 1]; + } + for (i = j - 1; i >= 0; i--) + { + band_offsets_local[i * 2 + 1 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 2 + 0 + 1] = band_offsets[i + 1]; + } + } + + denumerator = 0.001; + + for (i = 0; i < M; i++) + { + sum = 0; len = 0; + start = band_offsets_local[i * 4] + 1; stop = band_offsets_local[i * 4 + 4]; + + for (j = stop; j >= start; j--) + { + sum += j; + len++; + } + + numerator += gains_dee[i] * ((LC3_FLOAT) sum / (LC3_FLOAT) framelength); + denumerator += gains_dee[i] * len; + } + + *sc = numerator / denumerator; + *sc = *sc * (LC3_FLOAT) fs / 48000.0; /* scaling, because training is for 48kHz */ +} + +static void plc_xcorr_lc(LC3_FLOAT *pcmbufHist, LC3_INT32 max_len_pcm_plc, LC3_INT32 pitch_int, LC3_INT32 framelength, + LC3_INT32 frame_dms, LC3_INT32 fs, LC3_FLOAT *xcorr) +{ + LC3_INT32 max_corr_len, pitch_min, corr_len, min_corr_len, pcm_max_corr_len, range1Start, range2Start, i; + LC3_FLOAT norm_w, norm_w_t; + + norm_w_t = 0; norm_w = 0; + + assert(pitch_int >= 0); + assert(pitch_int <= MAX_LEN*100*MAX_PITCH_12K8/12800); + + *xcorr = 0; + + if (pitch_int > 0) + { + pitch_min = fs * MIN_PITCH_12K8/12800; + pcm_max_corr_len = max_len_pcm_plc - pitch_int; + + min_corr_len = 2 * pitch_min; /* at least 5 ms (=2*pitchmin*) corr length */ + max_corr_len = framelength*100/frame_dms; /* maximum 10 ms */ + max_corr_len = MIN( max_corr_len, pcm_max_corr_len ); + + corr_len = MIN( max_corr_len, pitch_int ); /* pitch_int is prefered, but maximum 10ms or left pcm buf size */ + corr_len = MAX( min_corr_len, corr_len ); + + range1Start = max_len_pcm_plc - corr_len; + range2Start = range1Start - pitch_int; + + assert( corr_len >= min_corr_len ); + assert( corr_len <= max_corr_len ); + assert( range2Start >= 0 ); + + for (i = 0; i < corr_len; i++) + { + norm_w += pcmbufHist[range1Start + i] * pcmbufHist[range1Start + i]; + } + + for (i = 0; i < corr_len; i++) + { + norm_w_t += pcmbufHist[range2Start + i] * pcmbufHist[range2Start + i]; + } + + for (i = 0; i < corr_len; i++) + { + *xcorr = *xcorr + pcmbufHist[range1Start + i] * pcmbufHist[range2Start + i]; + } + + *xcorr = *xcorr / sqrt(norm_w * norm_w_t + 0.1); + *xcorr = MAX(0, *xcorr); + } else { + *xcorr = 0; + } +} + diff --git a/lc3plus/plc_compute_stab_fac.c b/lc3plus/plc_compute_stab_fac.c new file mode 100755 index 0000000000..4a1111a2c7 --- /dev/null +++ b/lc3plus/plc_compute_stab_fac.c @@ -0,0 +1,64 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +static void processPlcComputeStabFac_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_INT32 prev_bfi, LC3_FLOAT *stab_fac); + +void processPlcComputeStabFacMain_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_FLOAT *old_old_scf_q, LC3_INT32 bfi, LC3_INT32 prev_bfi, + LC3_INT32 prev_prev_bfi, LC3_FLOAT *stab_fac) +{ + if (bfi == 1) + { + if (prev_bfi != 1) + { + processPlcComputeStabFac_fl(old_scf_q, old_old_scf_q, prev_prev_bfi, stab_fac); + } + } + else if (bfi == 2) + { + processPlcComputeStabFac_fl(scf_q, old_scf_q, prev_bfi, stab_fac); + } +} + +static void processPlcComputeStabFac_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_INT32 prev_bfi, LC3_FLOAT *stab_fac) +{ + LC3_FLOAT tmp; + LC3_INT32 i; + + tmp = 0; + + if (prev_bfi == 1) + { + *stab_fac = 0.8; + } + else + { + for (i = 0; i < M; i++) + { + tmp += (scf_q[i] - old_scf_q[i]) * (scf_q[i] - old_scf_q[i]); + } + + *stab_fac = 1.25 - tmp / 25.0; + + if (*stab_fac > 1) + { + *stab_fac = 1; + } + + if (*stab_fac < 0) + { + *stab_fac = 0; + } + } +} + diff --git a/lc3plus/plc_damping_scrambling.c b/lc3plus/plc_damping_scrambling.c new file mode 100755 index 0000000000..ecea32be5f --- /dev/null +++ b/lc3plus/plc_damping_scrambling.c @@ -0,0 +1,206 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, + LC3_INT32 *pc_seed, LC3_INT32 ns_nbLostCmpt_pc, + LC3_INT32 ns_nbLostCmpt, LC3_FLOAT *stabFac, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, + LC3_FLOAT *spec_prev, LC3_FLOAT *spec, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 bfi, + LC3_INT32 frame_dms, LC3_INT32 concealMethod, LC3_INT32 pitch_present_bfi1, LC3_INT32 pitch_present_bfi2, + LC3_FLOAT *cum_fflcAtten) +{ + + LC3_INT32 processDampScramb; + + processDampScramb = 0; + + + if ( bfi != 0 ) + { + if (concealMethod == 4 || bfi == 2) + { + processDampScramb = 1; + } + if ( bfi == 1 ) + { + processPlcDampingScrambling_fl(spec, yLen, ns_nbLostCmpt, stabFac, processDampScramb, cum_fflcAtten, + pitch_present_bfi1, frame_dms, cum_fading_slow, cum_fading_fast, ns_seed, 0); + } + else /* bfi == 2 */ + { + processPlcDampingScrambling_fl(spec, yLen, ns_nbLostCmpt_pc, stabFac, processDampScramb, cum_fflcAtten, + pitch_present_bfi2, frame_dms, cum_fading_slow, cum_fading_fast, pc_seed, spec_inv_idx); + processPlcUpdateSpec_fl(spec_prev, spec, yLen); + } + } +} + +void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 nbLostCmpt, LC3_FLOAT *stabFac, LC3_INT32 processDampScramb, + LC3_FLOAT *cum_fflcAtten, LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *cum_fading_slow, + LC3_FLOAT *cum_fading_fast, LC3_INT32 *seed, LC3_INT32 spec_inv_idx) +{ + LC3_INT32 plc_start_inFrames, plc_end_inFrames, plc_duration_inFrames, x, b, i, ad_ThreshFac_start; + LC3_FLOAT slow, fast, linFuncStartStop, randThreshold, ad_ThreshFac_end, ad_threshFac, frame_energy, mean_energy, energThreshold, fac, m, n, fflcAtten, cum_fading_slow_local, cum_fading_fast_local; + + frame_energy = 0; + + /* Main process */ + if (nbLostCmpt == 1) + { + *cum_fading_slow = 1; + *cum_fading_fast = 1; + *cum_fflcAtten = 1; + } + + slow = 0.8 + 0.2 * (*stabFac); + fast = 0.3 + 0.2 * (*stabFac); + + switch (frame_dms) + { + case 25: + slow = LC3_SQRT(LC3_SQRT(slow)); + fast = LC3_SQRT(LC3_SQRT(fast)); + break; + case 50: + slow = LC3_SQRT(slow); + fast = LC3_SQRT(fast); + break; + } + + *cum_fading_slow = *cum_fading_slow * slow; + *cum_fading_fast = *cum_fading_fast * fast; + + if (processDampScramb == 1) + { + fflcAtten = 1; + cum_fading_slow_local = *cum_fading_slow; + cum_fading_fast_local = *cum_fading_fast; + + if (spec_inv_idx == 0) + { + if (nbLostCmpt * frame_dms > PLC_FADEOUT_IN_MS * 10) + { + fflcAtten = 0; + *cum_fflcAtten = 0; + } + else if (nbLostCmpt * frame_dms > 200) + { + switch(frame_dms) + { + case 25: fflcAtten = PLC34_ATTEN_FAC_025; break; + case 50: fflcAtten = PLC34_ATTEN_FAC_050; break; + case 100: fflcAtten = PLC34_ATTEN_FAC_100; break; + } + } + + + *cum_fflcAtten = *cum_fflcAtten * fflcAtten; + cum_fading_slow_local = *cum_fading_slow * *cum_fflcAtten; + cum_fading_fast_local = *cum_fading_fast * *cum_fflcAtten; + } + + if (pitch_present == 0) + { + plc_start_inFrames = 1; + } else { + plc_start_inFrames = floor(PLC4_TRANSIT_START_IN_MS / (frame_dms / 10.0)); + } + + plc_end_inFrames = floor(PLC4_TRANSIT_END_IN_MS / (frame_dms / 10.0)); + plc_duration_inFrames = plc_end_inFrames - plc_start_inFrames; + + if (nbLostCmpt <= plc_start_inFrames) + { + linFuncStartStop = 1; + } else if (nbLostCmpt >= plc_end_inFrames) + { + linFuncStartStop = 0; + } else { + x = nbLostCmpt; + m = -1.0 / plc_duration_inFrames; + b = -plc_end_inFrames; + linFuncStartStop = m * (x + b); + } + + randThreshold = -32768 * linFuncStartStop; + + for (i = spec_inv_idx; i < yLen; i++) + { + *seed = 16831 + *seed * 12821; + + *seed = (LC3_INT16)(*seed); + if (*seed == 32768) + { + *seed -= 32768; + } + + if (*seed < 0) + { + if (pitch_present == 0 || *seed < randThreshold) + { + spec[i] = -spec[i]; + } + } + } + + ad_ThreshFac_start = 10; + ad_ThreshFac_end = 1.2; + ad_threshFac = (ad_ThreshFac_start - ad_ThreshFac_end) * linFuncStartStop + ad_ThreshFac_end; + + if (spec_inv_idx < yLen) + { + for (i = spec_inv_idx; i < yLen; i++) + { + frame_energy = frame_energy + (spec[i] * spec[i]); + } + + mean_energy = frame_energy * 1 / (yLen - spec_inv_idx); + } + else + { + mean_energy = 0; + } + + energThreshold = LC3_SQRT(ad_threshFac * mean_energy); + fac = (cum_fading_slow_local - cum_fading_fast_local) * energThreshold; + + for (i = spec_inv_idx; i < yLen; i++) + { + if (LC3_FABS(spec[i]) < energThreshold) + { + m = cum_fading_slow_local; + n = 0; + } + else + { + m = cum_fading_fast_local; + + if (spec[i] > 0) + { + n = fac; + } + else if (spec[i] == 0) + { + n = 0; + } + else + { + n = -fac; + } + } + + spec[i] = m * spec[i] + n; + } + } +} + diff --git a/lc3plus/plc_main.c b/lc3plus/plc_main.c new file mode 100755 index 0000000000..df3fd184d9 --- /dev/null +++ b/lc3plus/plc_main.c @@ -0,0 +1,209 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, + PlcAdvSetup *PlcAdvSetup, PlcSetup *PlcSetup, LC3_INT plcMeth, LC3_INT ltpf_pitch_int, LC3_INT ltpf_pitch_fr, + LC3_INT tilt, const LC3_INT *bands_offset, LC3_INT bands_number, const LC3_INT *bands_offsetPLC, + LC3_INT n_bandsPLC, LC3_INT16 hrmode, pcState *statePC +) +{ + LC3_FLOAT r[MAX_BANDS_NUMBER_PLC], A[M + 1], synth[MAX_LEN + MDCT_MEM_LEN_MAX], energies[MAX_BANDS_NUMBER_PLC]; + LC3_INT32 pitch_classifier; + LC3_FLOAT xcorr; + LC3_INT32 yLen; + LC3_INT16 prev_bfi_plc2; + LC3_FLOAT phEcu_env_stab_local[1]; + LC3_FLOAT phEcu_pfind_sens[1]; + + prev_bfi_plc2 = 1; + if (PlcSetup->nbLostCmpt == 0) + { + prev_bfi_plc2 = 0; + } + assert((h_DecSetup->PlcSetup.prevBfi == 1) == (prev_bfi_plc2 == 1)); + + if (bfi == 1 && PlcAdvSetup) + { + /* FFLC increases the PFLC counter */ + statePC->ns_nbLostCmpt_pc = statePC->ns_nbLostCmpt_pc + 1; + } + + pitch_classifier = ltpf_pitch_int; +#ifdef NONBE_PLC_CLASSIFER_LAG_FIX + if (ltpf_pitch_fr > 2) + { + pitch_classifier++; + } +#endif + + processPlcClassify_fl(plcMeth, &h_DecSetup->concealMethod, &PlcSetup->nbLostCmpt, bfi, &xcorr, + decoder->frame_length, decoder->frame_dms, pitch_classifier, decoder->fs, + bands_offset, bands_number, tilt, PlcAdvSetup, hrmode + ); + + if (bfi == 1) + { + switch (h_DecSetup->concealMethod) + { + case 2: + { + LC3_FLOAT pitch_fl_c; + + assert(decoder->fs_idx == floor(decoder->fs / 10000)); + // phaseECU supports only 10ms framing + assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100); + + if (decoder->frame_dms != 100) + { + // muting, if frame size changed during phaseECU concealment + memset(q_d_fl_c, 0, sizeof(LC3_FLOAT) * decoder->frame_length); + h_DecSetup->alpha = 0; + break; + } + + /* call phaseEcu */ + pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */ + + + if (prev_bfi_plc2 == 0) + { + /* convert fractional pitch lag info at current fs to a normalized fractional bin-frequency */ + PlcAdvSetup->PlcPhEcuSetup.PhECU_f0hzLtpBin = plc_phEcuSetF0Hz(decoder->fs, &pitch_fl_c); + /* several buffers used in Cflt , a copy pcmbufHist, right before calling PhEcu in bad frames */ + assert(bfi == 1); + move_float(PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp, + &(PlcAdvSetup->pcmbufHist[PlcAdvSetup->max_len_pcm_plc - PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot]), + PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot); + + /* a first bfi frame:: calc windowed 16 ms energy twice in a 26 ms buffer separated by 10 ms*/ + { + const LC3_FLOAT *w, *prev_xfp; + LC3_INT32 i, oold_start; + + oold_start = PlcAdvSetup->max_len_pcm_plc - (decoder->frame_length + PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot); + assert(oold_start > 0); + w = PhECU_whr16ms_wins[decoder->fs_idx]; /* hammrect table */ + prev_xfp = &(PlcAdvSetup->pcmbufHist[oold_start + 0]); + + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E = 0; + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E = 0; + for (i = 0; i < PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot; i++) + { + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E += sqrf(prev_xfp[i] * w[i]); + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E += sqrf(PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp[i] * w[i]); + } + + } + + } /* (prev_bfi_plc2 == 0)*/ + else + { + /* overwrite last 3.75 ms of xfp with most recent pcmbufHist tail , right before calling PhEcu in bursts of bad frames */ + LC3_INT32 lenCopyOla = decoder->la_zeroes; /*copy_part + ola_part = 3.75 ms for 10 ms frame*/ + + assert(bfi == 1 && prev_bfi_plc2); + move_float(&(PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp[PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot-lenCopyOla]), + &(PlcAdvSetup->pcmbufHist[PlcAdvSetup->max_len_pcm_plc - lenCopyOla]), lenCopyOla); + + } + + { + LC3_FLOAT x_tda[MAX_LEN]; /* 960/2 */ + PlcAdvSetup->PlcPhEcuSetup.PhECU_norm_corr = xcorr; + phEcu_env_stab_local[0] = (LC3_FLOAT)PHECU_ENV_STAB_LOCAL; + phEcu_pfind_sens[0] = (LC3_FLOAT)PHECU_PFIND_SENS; + + plc_phEcu_hq_ecu(&(PlcAdvSetup->PlcPhEcuSetup.PhECU_f0hzLtpBin), + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_norm_corr), + PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp, + prev_bfi_plc2, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev), + decoder->fs, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_time_offs), + PlcAdvSetup->PlcPhEcuSetup.PhECU_X_sav_m, /* Complex */ + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_num_plocs), + PlcAdvSetup->PlcPhEcuSetup.PhECU_plocs, + PlcAdvSetup->PlcPhEcuSetup.PhECU_f0est, + MDCT_WINS_10ms[hrmode][decoder->fs_idx], + + phEcu_env_stab_local, + PHECU_DELTA_CORR, + phEcu_pfind_sens, + PHECU_LA, + PlcAdvSetup->PlcPhEcuSetup.PhECU_t_adv, + PhECU_whr16ms_wins[decoder->fs_idx], + PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E), + PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E), + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_beta_mute), + PlcAdvSetup->PlcPhEcuSetup.PhECU_mag_chg_1st, + PlcAdvSetup->PlcPhEcuSetup.PhECU_Xavg, + decoder->la_zeroes, + x_tda, /* time domain aliased output */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + , + &(PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft), + &(PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft) + ); + + + ProcessingITDA_WIN_OLA_fl(x_tda, decoder->frame_length, decoder->imdct_win, decoder->imdct_winLen, decoder->imdct_laZeros, + h_DecSetup->imdct_mem, synth); + move_float(syntM_fl_c, synth, decoder->frame_length); + + + + } + } + break; + case 3: + if (PlcSetup->nbLostCmpt == 1) + { + PlcAdvSetup->PlcTdcSetup.fract = ltpf_pitch_fr; + } + + processPerBandEnergy_fl(n_bandsPLC, bands_offsetPLC, hrmode, decoder->frame_dms, energies, PlcSetup->q_d_prev); + processTdcPreemphasis_fl(energies, &PlcAdvSetup->PlcTdcSetup.preemphFac, n_bandsPLC); + processTdcInverseOdft_fl(energies, n_bandsPLC, r, PlcAdvSetup->PlcTdcSetup.lpcorder); + processTdcLpcEstimation_fl(r, decoder->fs_idx, PlcAdvSetup->PlcTdcSetup.lpcorder + 1, A, decoder->frame_dms); + processTdcApply_fl(ltpf_pitch_int, &PlcAdvSetup->PlcTdcSetup.preemphFac, A, PlcAdvSetup->PlcTdcSetup.lpcorder, PlcAdvSetup->pcmbufHist, PlcAdvSetup->max_len_pcm_plc, decoder->frame_length, + decoder->frame_dms, decoder->fs, PlcSetup->nbLostCmpt, decoder->frame_length - decoder->la_zeroes, &PlcAdvSetup->stabFac, PlcAdvSetup->PlcTdcSetup.harmonicBuf, + PlcAdvSetup->PlcTdcSetup.synthHist, &PlcAdvSetup->PlcTdcSetup.fract, &PlcAdvSetup->PlcTdcSetup.seed, &PlcAdvSetup->PlcTdcSetup.gain_c, + &h_DecSetup->alpha, synth); + + processTdcTdac_fl(synth, decoder->imdct_win, decoder->frame_length, decoder->la_zeroes, h_DecSetup->imdct_mem); + memmove(syntM_fl_c, synth, sizeof(LC3_FLOAT) * decoder->frame_length); + break; + case 4: + processNoiseSubstitution_fl(q_d_fl_c, PlcSetup->q_d_prev, decoder->yLen); + break; + default: + assert("Invalid PLC method!"); + } + } + + if (bfi == 0) + { + processPlcUpdateSpec_fl(PlcSetup->q_d_prev, q_d_fl_c, decoder->yLen); + } + + yLen = MIN(decoder->frame_length, MAX_PLC_LMEM); + if (PlcAdvSetup != NULL && (decoder->frame_dms == 100) && (hrmode == 0)) + { + /* BASOP processPLCspec2shape_fx(prev_bfi, bfi, q_old_d_fx, yLen, plcAd->PhECU_oold_grp_shape_fx, plcAd->PhECU_old_grp_shape_fx);*/ + plc_phEcu_processPLCspec2shape(prev_bfi_plc2, bfi, q_d_fl_c, yLen, + PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape, PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape); + } +} + diff --git a/lc3plus/plc_noise_substitution.c b/lc3plus/plc_noise_substitution.c new file mode 100755 index 0000000000..4913ee53e5 --- /dev/null +++ b/lc3plus/plc_noise_substitution.c @@ -0,0 +1,22 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processNoiseSubstitution_fl(LC3_FLOAT* spec, LC3_FLOAT* spec_prev, LC3_INT32 yLen) +{ + memmove(spec, spec_prev, sizeof(LC3_FLOAT) * yLen); + + spec[0] *= 0.2; + spec[1] *= 0.5; +} + diff --git a/lc3plus/plc_noise_substitution0.c b/lc3plus/plc_noise_substitution0.c new file mode 100755 index 0000000000..da050e3dd2 --- /dev/null +++ b/lc3plus/plc_noise_substitution0.c @@ -0,0 +1,14 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + diff --git a/lc3plus/plc_phecu_f0_refine_first.c b/lc3plus/plc_phecu_f0_refine_first.c new file mode 100755 index 0000000000..11ebf276b1 --- /dev/null +++ b/lc3plus/plc_phecu_f0_refine_first.c @@ -0,0 +1,75 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_F0_refine_first( LC3_INT32 *plocs, /* i/o 0 ... Lprot/2 +1*/ + LC3_INT32 n_plocs, + LC3_FLOAT *f0est, /* i/o f0est */ + const LC3_INT32 Xabs_len, + LC3_FLOAT *f0binPtr, /* i */ + LC3_FLOAT *f0gainPtr, /* i */ + const LC3_INT32 nSubm + ) +{ + LC3_FLOAT sens; + LC3_INT32 i, j, high_idx, breakflag; + LC3_FLOAT f0est_lim[MAX_PLC_NPLOCS]; + LC3_FLOAT f0bin; + LC3_FLOAT f0gain; + + f0bin = *f0binPtr; + f0gain = *f0gainPtr; + + if (n_plocs > 0 && f0gain > 0.25) { + + sens = 0.5; + if (f0gain < 0.75) { + sens = 0.25; + } + + high_idx = -1; + for (i = 0; i < n_plocs; i++) { + if (plocs[i] <= 25) { /* 25 ~= 1550 Hz */ + high_idx = MAX(high_idx, i); + } else { + /* Optimization, only works if plocs vector is sorted. Which it should be. */ + break; + } + } + + if (high_idx != -1) { + high_idx++; + move_float(f0est_lim, f0est, high_idx); + + breakflag = 0; + for (i = 0; i < nSubm; i++) { + for (j = 0; j < high_idx; j++) { + if (LC3_FABS(f0est_lim[j] - (i+1) * f0bin) < sens) { + f0est[j] = (i+1)*f0bin; + plocs[j] = MIN(Xabs_len-1, MAX(1,(LC3_INT32) LC3_ROUND(f0est[j]))); + breakflag = 1; + break; + } + } + if (breakflag) { + break; + } + sens *= 0.875; + } + } + } + + return; +} + diff --git a/lc3plus/plc_phecu_fec_hq.c b/lc3plus/plc_phecu_fec_hq.c new file mode 100755 index 0000000000..c25466c3e9 --- /dev/null +++ b/lc3plus/plc_phecu_fec_hq.c @@ -0,0 +1,159 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +LC3_FLOAT plc_phEcu_imax2_jacobsen_mag(const Complex *y, LC3_FLOAT *c_jacobPtr) { + + LC3_FLOAT posi; + const Complex *pY; + Complex y_m1, y_0, y_p1; + Complex N; + Complex D; + LC3_FLOAT numer, denom; + + /* Jacobsen estimates peak offset relative y_0 using + * X_m1 - X_p1 + * d = REAL ( ------------------- ) * c_jacob + * 2*X_0 - X_m1 -Xp1 + * + * Where c_jacob is a window dependent constant + */ + + /* Get the parameters into variables */ + pY = y; + y_m1 = *pY++; + y_0 = *pY++; + y_p1 = *pY++; + + /* prepare numerator real and imaginary parts*/ + N = csub(y_m1, y_p1); + + /* prepare denominator real and imaginary parts */ + D = cmul(cmplx(2.0, 0.0), y_0); + D = csub(D, y_m1); + D = csub(D, y_p1); + + /* REAL part of complex division */ + numer = N.r*D.r + N.i*D.i; + denom = D.r*D.r + D.i*D.i; + + if (numer != 0 && denom != 0) { + posi = numer / denom * (*c_jacobPtr); + } else { + posi = 0.0; /* flat top, division is not possible choose center freq */ + } + + + posi = fclampf(-1.0, posi, 1.0); + return posi; +} + +/*-------------------------------------------------------------------* + * imax() + * + * Get interpolated maximum position + *-------------------------------------------------------------------*/ + +LC3_FLOAT plc_phEcu_interp_max(const LC3_FLOAT *y, LC3_INT32 y_len) { + LC3_FLOAT posi, y1, y2, y3, y3_y1, y2i; + LC3_FLOAT ftmp_den1, ftmp_den2; + + /* Seek the extrema of the parabola P(x) defined by 3 consecutive points so that P([-1 0 1]) = [y1 y2 y3] */ + y1 = y[0]; + y2 = y[1]; + + /* If interp between two values only */ + if (y_len == 2) { + if (y1 < y2) { + return 1.0; + } else { + return 0.0; + } + } + + y3 = y[2]; + y3_y1 = y3-y1; + ftmp_den1 = (y1+y3-2*y2); + ftmp_den2 = (4*y2 - 2*y1 - 2*y3); + + if(ftmp_den2 == 0.0 || ftmp_den1 == 0.0) { + return 0.0; /* early exit with left-most value */ + } + + y2i = ((LC3_FLOAT)-0.125) * sqrf(y3_y1) /(ftmp_den1) + y2; + /* their corresponding normalized locations */ + posi = y3_y1/(ftmp_den2); + /* Interpolated maxima if locations are not within [-1,1], calculated extrema are ignored */ + if (posi >= (LC3_FLOAT)1.0 || posi <= (LC3_FLOAT)-1.0) { + posi = y3 > y1 ? (LC3_FLOAT)1.0 : (LC3_FLOAT)-1.0; + } else { + if (y1 >= y2i) { + posi = (y1 > y3) ? (LC3_FLOAT)-1.0 :(LC3_FLOAT) 1.0; + } else if (y3 >= y2i) { + posi = (LC3_FLOAT)1.0; + } + } + + return posi + (LC3_FLOAT)1.0; +} + +/*----------------------------------------------------------------------------- + * fft_spec2_sqrt_approx_ () + * + * Approximation of sqrt(Square magnitude) of fft spectrum + * if min_abs <= 0.4142135*max_abs + * abs = 0.99 max_abs + 0.197*min_abs + * else + * abs = 0.84 max_abs + 0.561*min_abs + * end + * + + *----------------------------------------------------------------------------*/ + +void plc_phEcu_fft_spec2_sqrt_approx(const Complex* x, LC3_INT32 x_len, LC3_FLOAT* x_abs) { + LC3_INT32 i; + LC3_FLOAT max_abs, min_abs, re, im; + + for (i = 0; i < x_len; i++) { + re = LC3_FABS(x[i].r); + im = LC3_FABS(x[i].i); + max_abs = MAX(re, im); + min_abs = MIN(re, im); + + if (min_abs <= (LC3_FLOAT)0.4142135 * max_abs) { + x_abs[i] = (LC3_FLOAT)0.99*max_abs + (LC3_FLOAT)0.197*min_abs; + } else { + x_abs[i] = (LC3_FLOAT)0.84*max_abs + (LC3_FLOAT)0.561*min_abs; + } + } + + return; +} + +LC3_INT32 plc_phEcu_pitch_in_plocs(LC3_INT32* plocs, LC3_INT32 n_plocs) { + + LC3_INT32 i; + LC3_INT32 p_in_plocs; + + p_in_plocs = 0; + + for (i = 0; i < n_plocs; i++) { + if (plocs[i] > 0 && plocs[i] < 7) { + p_in_plocs++; + } + } + + return p_in_plocs; +} + diff --git a/lc3plus/plc_phecu_hq_ecu.c b/lc3plus/plc_phecu_hq_ecu.c new file mode 100755 index 0000000000..5b1978bcab --- /dev/null +++ b/lc3plus/plc_phecu_hq_ecu.c @@ -0,0 +1,116 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_hq_ecu( + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0ltpGainPtr, LC3_FLOAT *xfp, + LC3_INT16 prev_bfi, LC3_INT32 *short_flag_prev, LC3_INT32 fs, + LC3_INT32 *time_offs, Complex *X_sav_m, LC3_INT32 *n_plocs, LC3_INT32 *plocs, LC3_FLOAT *f0est, + const LC3_FLOAT *mdctWin, LC3_FLOAT *env_stabPtr, LC3_INT32 delta_corr, LC3_FLOAT *pfind_sensPtr, + LC3_INT32 PhECU_LA, LC3_INT32 t_adv, const LC3_FLOAT *winWhr, + LC3_FLOAT *oold_grp_shape, LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_grp_shape, LC3_FLOAT *old_EwPtr, + LC3_FLOAT *st_beta_mute, LC3_FLOAT *st_mag_chg_1st, LC3_FLOAT *st_Xavg, LC3_INT32 LA_ZEROS, LC3_FLOAT *x_tda, + LC3_FLOAT *xsubst_dbg, Complex *X_out_m_dbg, + LC3_INT32 *seed_dbg, LC3_FLOAT *mag_chg_dbg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg, + LC3_FLOAT *corr_phase_dbg, + Fft *PhEcu_Fft, Fft *PhEcu_Ifft) +{ + LC3_INT32 i; + LC3_INT32 fs_idx, L, Lprot, n_grp, Lecu, LXsav, Lxfp_inuse; + LC3_FLOAT alpha[8]; + LC3_FLOAT beta[8]; + LC3_FLOAT mag_chg[8]; + LC3_FLOAT xfp_local_rnd[2*MAX_LEN]; + Complex X_out_m[2*MAX_LEN]; + LC3_INT32 seed; + LC3_INT32 burst_len; + + + fs_idx = (LC3_INT32)floor(fs / 10000.0); + L = (LC3_INT32)floor(0.01 * fs); + Lprot = (LC3_INT32)(1.6 * L); + n_grp = xavg_N_grp[fs_idx]; + Lecu = 2 * L; + LXsav = Lprot / 2 + 1; /* 48 kHz may be optimized , to save only up to 20 kHz as in BASOP */ + Lxfp_inuse = Lprot ; + if (prev_bfi == 1){ + Lxfp_inuse = (LC3_INT32)(L*(3.75/10.0)); + } + + UNUSED(env_stabPtr); + UNUSED(xsubst_dbg); + UNUSED(X_out_m_dbg); + UNUSED(seed_dbg); + UNUSED(mag_chg_dbg); + UNUSED(tr_dec_dbg); + UNUSED(gpc_dbg); + UNUSED(X_i_new_re_dbg); + UNUSED(X_i_new_im_dbg); + UNUSED(corr_phase_dbg); + + + if (prev_bfi != 1) + { + for (i = (Lprot-Lxfp_inuse); i < Lprot; i++) { + xfp_local_rnd[i] = xfp[i]; + /* hysteresis of low level input aligns float fft analysis and peak picking to BASOP performance for low level noisy signals */ + if (xfp[i] >= -0.5 && xfp[i] <= 0.5) { + xfp_local_rnd[i] = 0.0; + } + } + + + *time_offs = 0; + burst_len = (*time_offs / L + 1); + plc_phEcu_trans_burst_ana_sub(fs_idx, burst_len, n_grp, oold_grp_shape, oold_EwPtr , old_grp_shape, old_EwPtr, st_beta_mute, + st_mag_chg_1st, st_Xavg, alpha, beta, mag_chg, NULL, NULL); + + plc_phEcu_spec_ana(xfp_local_rnd, Lprot, winWhr, pfind_sensPtr, plocs, n_plocs, f0est, X_sav_m, &LXsav, f0binPtr, f0ltpGainPtr, fs_idx, PhEcu_Fft); + } + else + { + *time_offs = *time_offs + L; + *time_offs = imin(32767 ,*time_offs); /* limit to Word16 range as in BASOP ~= 70 10ms frames@48kHz */ + burst_len = ((*time_offs / L) + 1); + + plc_phEcu_trans_burst_ana_sub(fs_idx, burst_len, n_grp, oold_grp_shape, oold_EwPtr, old_grp_shape, old_EwPtr, st_beta_mute, + st_mag_chg_1st, st_Xavg, alpha, beta, mag_chg, NULL, NULL); + + } + + seed = *time_offs; + + if (*short_flag_prev != 0) + { + *n_plocs = 0; + } + + move_cmplx( X_out_m, X_sav_m, LXsav); + + /* inplace X_out_m update */ + plc_phEcu_subst_spec(plocs, *n_plocs, f0est, *time_offs, X_out_m, LXsav, mag_chg, &seed, alpha, beta, st_Xavg, t_adv, Lprot, delta_corr, + NULL, NULL, NULL); + + + + + plc_phEcu_rec_frame(X_out_m, L, Lecu, winWhr, mdctWin, Lprot, + xfp, /* last 3.75ms of non-rounded xfp used here */ + *time_offs, + x_tda /* output */, + NULL, NULL, NULL, + LA_ZEROS, PhECU_LA, PhEcu_Ifft); + +} + diff --git a/lc3plus/plc_phecu_lf_peak_analysis.c b/lc3plus/plc_phecu_lf_peak_analysis.c new file mode 100755 index 0000000000..0bcc98d7a4 --- /dev/null +++ b/lc3plus/plc_phecu_lf_peak_analysis.c @@ -0,0 +1,112 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_LF_peak_analysis(LC3_INT32 *plocs, /* i/o 0 ... Lprot/2 +1*/ + LC3_INT32 *n_plocs, /* i/o 0.. MAX_PLOCS */ + LC3_FLOAT *f0est, /* i/o Q16*/ + const LC3_FLOAT *Xabs, + LC3_FLOAT *f0binPtr, + LC3_FLOAT *f0gainPtr, + const LC3_INT32 nSubm +) +{ + LC3_INT32 i, j, fin, f_ind, prel_low, prel_high, start; + LC3_FLOAT f0est_prel[3]; + LC3_INT32 plocs_prel[3]; + LC3_INT32 n_prel; + LC3_FLOAT f0est_old[MAX_PLC_NPLOCS]; + LC3_INT32 plocs_old[MAX_PLC_NPLOCS]; + LC3_FLOAT peakLF_Xval, f; + LC3_FLOAT f0bin ; + LC3_FLOAT f0gain ; + + f0bin = *f0binPtr; + f0gain = *f0gainPtr; + + if (*n_plocs > 0 && f0gain > 0.25 && f0bin < 2.75) { + + /* Assumes sorted plocs */ + if (plocs[0] < 3) { + fin = MIN(3, *n_plocs); + peakLF_Xval = Xabs[plocs[0]]; + for (i = 1; i < fin; i++) { + peakLF_Xval = MAX(peakLF_Xval, Xabs[plocs[i]]); + } + + n_prel = 0; + for (i = 0; i < nSubm; i++) { + f = (i+1)*f0bin; + f_ind = (LC3_INT32)LC3_ROUND(f); + if (f*PHECU_FRES <= 400 && Xabs[f_ind] > peakLF_Xval*0.375) { + f0est_prel[n_prel] = f; + plocs_prel[n_prel] = f_ind; + n_prel++; + } + } + + if (n_prel > 0) { + prel_low = plocs_prel[0]; + prel_high = plocs_prel[n_prel-1]; + + /* initial assumption:: all original peaks (1 or 2 of them) are positioned below prel_low */ + start = (*n_plocs); /* at this point 'start' is the location_c where to add any harmonics peaks */ + for (i = (*n_plocs)-1; i >= 0; i--) { + if (plocs[i] >= prel_low) { + start = i; + } + } + + /* found position_c where to start adding */ + start = (start-1 ); /* one step lower, now start is of original LF peaks to keep */ + start = MAX(start, -1); /* limit for loop */ + + if (prel_high < plocs[0]) { + fin = 0; + } else { + fin = (*n_plocs)+1; + for (i = 0; i < *n_plocs; i++) { + if (plocs[i] <= prel_high) { + fin = i; + } + } + fin++; + } + + move_int(plocs_old, plocs, *n_plocs); + move_float(f0est_old, f0est, *n_plocs); + + j = (start+1); /* [0..(j-1)] of original LF peaks will be kept */ + /* j now points to first location_c where to add peaks */ + + for (i = 0; i < n_prel; i++) { + plocs[j] = plocs_prel[i]; + f0est[j] = f0est_prel[i]; + j++; + } + for (i = fin; i < *n_plocs; i++) { + plocs[j] = plocs_old[i]; + f0est[j] = f0est_old[i]; + j++; + } + + *n_plocs = j; + + } + } + } + + return; +} + diff --git a/lc3plus/plc_phecu_rec_frame.c b/lc3plus/plc_phecu_rec_frame.c new file mode 100755 index 0000000000..0e6570743a --- /dev/null +++ b/lc3plus/plc_phecu_rec_frame.c @@ -0,0 +1,147 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_rec_frame(Complex *X_in, + LC3_INT32 L, + LC3_INT32 Lecu, + const LC3_FLOAT *whr, + const LC3_FLOAT *winMDCT, + LC3_INT32 Lprot, + LC3_FLOAT *xfp, + LC3_INT32 time_offs, + LC3_FLOAT *x_out, + Complex *full_spec_dbg, + LC3_FLOAT* ifft_out_dbg, + LC3_FLOAT* xsubst_dbg, + LC3_INT32 LA_ZEROS, + LC3_INT32 LA, + Fft* PhEcu_ifft +) +{ + + LC3_INT32 i; + + LC3_FLOAT xrec[2*MAX_LEN]; + LC3_FLOAT xsubst[2*MAX_LEN]; + LC3_FLOAT xsubst_LL[2*MAX_LEN]; + LC3_FLOAT *pXsubst_LL; + + LC3_INT32 fs_idx; + + LC3_FLOAT *pXfp, *pOlaXsubst, *pXOut; + LC3_INT32 work_part, copy_part, ola_part; + + const LC3_FLOAT *hannOla; + const LC3_FLOAT *pHannOla; + + UNUSED(time_offs); + UNUSED(full_spec_dbg); + UNUSED(ifft_out_dbg); + UNUSED(xsubst_dbg); + UNUSED(xsubst_LL); + fs_idx = FRAME2FS_IDX(L); + hannOla = hannOla_wins[fs_idx]; + + X_in[0].i = X_in[Lprot / 2].r; /* move fs/2 real to imag part of X_in[0]*/ + + real_fft_apply(PhEcu_ifft, (LC3_FLOAT*)X_in, xrec); + + move_float(xsubst, xrec, Lprot); + + + + + { + for (i = 0; i < Lprot; i++) { + + if (whr[i] != 0) { + xsubst[i] = xsubst[i] / whr[i]; /* inverse stored in BASOP */ + } + + } + + assert(xsubst_LL != NULL); + zero_float(xsubst_LL, (Lecu-Lprot)/2); /* initial 2ms */ + zero_float(&(xsubst_LL[ Lecu- (Lecu-Lprot)/2]), (Lecu-Lprot)/2); /* tail 2ms */ + { + /* position reconstruction properly */ + /* pXsubst_LL = &xsubst_LL[Lecu - Lprot - (Lecu - Lprot) / 2]; */ + pXsubst_LL = &xsubst_LL[(Lecu - Lprot) / 2]; + for (i = 0; i < Lprot ; i++) { + *pXsubst_LL++ = xsubst[i]; /* copy required 14.25 ms into center */ + } + } + + } + + + + work_part = LA_ZEROS + LA; + copy_part = (Lecu - Lprot) / 2; + ola_part = work_part - copy_part; + + pXfp = &xfp[Lprot - work_part]; + for (i = 0; i < copy_part; i++) { + xsubst_LL[i] = *pXfp++; + } + + assert(xsubst_LL != NULL); + pOlaXsubst = &(xsubst_LL[copy_part]); + pHannOla = hannOla; + for (i = 0; i < ola_part; i++) { + *pOlaXsubst = *pOlaXsubst * *pHannOla++; + pOlaXsubst++; + } + + pOlaXsubst = &(xsubst_LL[copy_part]); + for (i = 0; i < ola_part; i++) { + *pOlaXsubst = *pOlaXsubst + *pXfp++ * *pHannOla--; + pOlaXsubst++; + } + + + /* clear x_out to start with */ + assert(x_out != NULL); + zero_float(x_out, L); + + + for (i = 0; i < (Lecu - LA_ZEROS); i++) { + + xsubst_LL[i] = xsubst_LL[i] * winMDCT[i]; /* xsubstLL windowing up to 16.25 ms i.e not last 3.75 ms */ + + } + zero_float(&(xsubst_LL[Lecu - LA_ZEROS]), LA_ZEROS); /* tail 3.75ms always zero */ + + /* perform tda */ + + /* first half */ + pXsubst_LL = &xsubst_LL[3 * Lecu / 4]; + pXfp = &xsubst_LL[(3 * Lecu / 4) - 1]; + + pXOut = x_out; + for (i = 0; i < Lecu / 4; i++) { + *pXOut++ = -*pXsubst_LL++ - *pXfp--; /* 3.75 ms mults with 0 . may be skipped, see BASOP */ + } + + /* second half */ + /* */ + + pXsubst_LL = &(xsubst_LL[0]); + pXfp = &xsubst_LL[(Lecu / 2) - 1]; + for (i = 0; i < Lecu / 4; i++) { + *pXOut++ = *pXsubst_LL++ - *pXfp--; + } +} + diff --git a/lc3plus/plc_phecu_setf0hz.c b/lc3plus/plc_phecu_setf0hz.c new file mode 100755 index 0000000000..b14327e2b2 --- /dev/null +++ b/lc3plus/plc_phecu_setf0hz.c @@ -0,0 +1,28 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +LC3_FLOAT plc_phEcuSetF0Hz(LC3_INT32 fs, LC3_FLOAT * old_pitchPtr) +{ + LC3_FLOAT result; + + result = 0; + if (*old_pitchPtr != 0) + { + result = LC3_ROUND(fs/(*old_pitchPtr)/PHECU_FRES * 128.0) / 128.0; + } + + return result; +} + diff --git a/lc3plus/plc_phecu_spec_ana.c b/lc3plus/plc_phecu_spec_ana.c new file mode 100755 index 0000000000..b496900305 --- /dev/null +++ b/lc3plus/plc_phecu_spec_ana.c @@ -0,0 +1,599 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +#define PEAK_LOCATOR_RES_FX 1 /* fixed point resolution minimum value */ + + +static LC3_INT16 plc_phEcu_find_ind_fx( /* o : output maximum indx 0.. len-1 */ + const LC3_INT16 *inp, /* i : vector */ + const LC3_INT16 len, /* i : length */ + const LC3_INT16 val /* i : value to find */ +); + +static void plc_phEcu_peak_locator_fxlike(const LC3_INT16 *inp, /* i: vector with values >=0 ,Qx */ + const LC3_INT16 inp_len, /* i: length of inp */ + LC3_INT16 * int_plocs, /* o: array of filtered integer plocs Q0 */ + LC3_INT16 * n_fsc, /* o: total_ number of filtered located highs Q0 */ + const LC3_INT16 sens, /* i sensitivity, Qx */ + const LC3_INT16 inp_high, /* i global high , Qx */ + const LC3_INT16 inp_low /* i: global low, Qx */ +); + + +void plc_phEcu_spec_ana(LC3_FLOAT* xfp, + LC3_INT32 xfp_len, + const LC3_FLOAT* whr, + LC3_FLOAT *pfind_sensPtr, + LC3_INT32* plocs, + LC3_INT32* n_plocs, + LC3_FLOAT* f0est, + Complex* x, + LC3_INT32* x_len, + LC3_FLOAT * f0hzLtpBinPtr, + LC3_FLOAT * f0gainLtpPtr, + LC3_INT32 bw_idx, + Fft* PhEcu_fft +) +{ + + + LC3_INT32 i, peak_range_1, curr; + LC3_FLOAT xfp_w[MAX_PLC_LPROT]; + + LC3_FLOAT Xabs[MAX_LEN] = {0}; + LC3_FLOAT inp_high, inp_low, sens; + LC3_FLOAT interPos; + Complex Xana_p[3]; + LC3_INT32 P_in_plocs; + LC3_INT32 nSubs; + LC3_INT32 n_plocs_in; + LC3_FLOAT phEcu_c_jacob[1]; + + LC3_FLOAT fx_fft_scale; + LC3_FLOAT fft_fs_scale; + + LC3_FLOAT max_xfp_abs; + LC3_FLOAT PLC2_Q_flt; + LC3_FLOAT Q_scale_flt; + + LC3_INT16 Xabs_fx[MAX_LEN]; + LC3_INT16 plocs_fx[MAX_LEN]; + + LC3_INT16 sens_fx; + LC3_INT16 inp_high_fx; + LC3_INT16 inp_low_fx; + LC3_INT16 n_plocs_fx; + + LC3_FLOAT pfind_sens ; + LC3_FLOAT f0hzLtpBin ; + LC3_FLOAT f0gainLtp ; + + pfind_sens = *pfind_sensPtr; + f0hzLtpBin = *f0hzLtpBinPtr; + f0gainLtp = *f0gainLtpPtr; + + for (i = 0; i < xfp_len; i++) + { + xfp_w[i] = xfp[i] * whr[i]; /* whr windowing may be split into three segments , two loops, and possibly inplace */ + } + real_fft_apply(PhEcu_fft, xfp_w, (LC3_FLOAT *)x); + + x[xfp_len/2].r = x[0].i; /* move the real Fs/2 value to end */ + x[xfp_len/2].i = 0; /* safety clear imaginary Fs/2 value at end */ + x[0].i = 0.0; /* safety, make DC value only real */ + + + *x_len = xfp_len/2 + 1; + + i =(LC3_INT32) LC3_FLOOR(20000.0/PHECU_FRES)+1; + zero_cmplx( &(x[i]), *x_len - i); + + peak_range_1 = (LC3_INT32) MIN(*x_len, (40000.0 / 100 * 1.6) / 2 + 1); + + plc_phEcu_fft_spec2_sqrt_approx(x, peak_range_1, Xabs); + + zero_float(&(Xabs[peak_range_1]), *x_len - peak_range_1); + + inp_high = Xabs[0]; + inp_low = Xabs[0]; + + for (i = 1; i < peak_range_1; i++) { + inp_high = MAX(inp_high, Xabs[i]); + inp_low = MIN(inp_low, Xabs[i]); + } + + sens = (inp_high-inp_low)*(1-pfind_sens); + + if (inp_high > ((LC3_FLOAT) PEAK_LOCATOR_RES_FX)/2.0) + { + { + /* from ROM constants.c */ + LC3_FLOAT fx_fft_scales[5] = { 6, 7, 7, 8, 8 }; /*NB,WB, sSWB, SWB, FB*/ + fx_fft_scale = LC3_POW(2.0, fx_fft_scales[bw_idx]); /*% scaling due to up / dn pre shifts in fx FFT */ + } + { /* from ROM constants.c */ + LC3_FLOAT fx_fs_scales[5] = { 1.0, 1.0, 1.5, 1.0, 1.5 }; /*NB,WB, sSWB, SWB, FB*/ + fft_fs_scale = fx_fs_scales[bw_idx]; + } + + + max_xfp_abs = (LC3_FLOAT) LC3_FABS(xfp[0]); + for (i = 1; i < xfp_len; i++) { + max_xfp_abs = (LC3_FLOAT) MAX(max_xfp_abs, LC3_FABS(xfp[i])); + } + + if (max_xfp_abs >= 0.5) + { + PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / max_xfp_abs)); + Q_scale_flt = LC3_POW(2.0, PLC2_Q_flt) / fx_fft_scale / fft_fs_scale; /* basop way using xfp scale */ + + /* C-Float additional safety limit/verification of the integer xfp based scaling using the available C-float Xabs max value inp_high as well */ + { + LC3_FLOAT tmp_scale; + tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / inp_high))); + if (Q_scale_flt > tmp_scale) { + Q_scale_flt = tmp_scale; + } + } + /* Round sens, inp_high, inp_low according to BASOP fix-point scaling */ + + for (i = 0; i < peak_range_1; i++) { + Xabs_fx[i] = (LC3_INT16) LC3_ROUND(Xabs[i] * Q_scale_flt) ; + } + sens_fx = (LC3_INT16) LC3_ROUND(sens * Q_scale_flt) ; + inp_high_fx = (LC3_INT16) LC3_ROUND(inp_high * Q_scale_flt) ; + inp_low_fx = (LC3_INT16) LC3_ROUND(inp_low * Q_scale_flt) ; + plc_phEcu_peak_locator_fxlike(Xabs_fx, peak_range_1, plocs_fx, &n_plocs_fx, sens_fx, inp_high_fx, inp_low_fx); + + *n_plocs = (LC3_INT32)n_plocs_fx; + for (i = 0; i < *n_plocs; i++) { + plocs[i] = (LC3_INT32)plocs_fx[i]; /* short Word16 values now stored/saved as Word32 */ + } + } + else + { + *n_plocs = 0; /* time domain xfp level near zero */ + } + } + else + { + *n_plocs = 0; /* Freq domain Xabs max level near zero */ + } + + for (i = 0; i < *n_plocs; i++) { + curr = plocs[i]; + if (curr == 0) { + interPos = plc_phEcu_interp_max(Xabs, 3); /* returns 0.0 ... 2.0 */ + if (interPos == 2) { + /* integer peak was at DC, restrict to one of coeffs at [DC or DC+1] */ + interPos = plc_phEcu_interp_max(Xabs, 2); /* returns 0.0 or 1.0 */ + } + interPos += plocs[i]; + } else if (curr == 1) { + interPos = plc_phEcu_interp_max(Xabs, 3); + interPos += plocs[i] - 1; + } else if (curr == *x_len - 2) { + interPos = plc_phEcu_interp_max(&Xabs[*x_len - 3], 3); + interPos += plocs[i] - 1; + } else if (curr == *x_len - 1) { + /* integer curr at Fs/2, a real coeff */ + interPos = plc_phEcu_interp_max(&Xabs[*x_len - 3], 3); /* returns 0.0 ... 2.0 */ + interPos += plocs[i] - 2; /* valid for range ]... 1.0 ... 2.0] , where 1 is fs/2-1 and 2.0 is Fs/2 */ + if (interPos == 0) { + /* restrict to one of coeffs at [fs/2-1, fs/2 ] */ + interPos = plc_phEcu_interp_max(&Xabs[*x_len - 2], 2); /* returns 0.0 or 1.0 */ + interPos += plocs[i] - 1; + } + + if (interPos > (*x_len - 1) ) { /* interPos only defined up to Fs/2 */ + interPos = (LC3_FLOAT)(*x_len - 1); + } + } else { + Xana_p[0] = x[plocs[i]-1]; + Xana_p[1] = x[plocs[i]]; + Xana_p[2] = x[plocs[i]+1]; + phEcu_c_jacob[0] = (LC3_FLOAT)PHECU_C_JACOB; + interPos = plc_phEcu_imax2_jacobsen_mag(Xana_p, phEcu_c_jacob ); + interPos += (LC3_FLOAT) plocs[i]; + } + f0est[i] = interPos; + } + + if (*n_plocs >= 2 && plocs[0] == 0 && + f0est[0] > f0est[1] && plocs[1] <= 2 && Xabs[0] < Xabs[plocs[1]+1]) + { + f0est[0] = f0est[1]; + } + + P_in_plocs = plc_phEcu_pitch_in_plocs(plocs, *n_plocs); + + if (f0hzLtpBin > 0.0 && P_in_plocs > 0) { + nSubs = 2; + n_plocs_in = *n_plocs; + plc_phEcu_LF_peak_analysis(plocs, n_plocs, f0est, Xabs, &f0hzLtpBin, &f0gainLtp, nSubs); + + if (n_plocs_in == *n_plocs) { + nSubs = 3; + plc_phEcu_F0_refine_first(plocs, *n_plocs, f0est, *x_len, &f0hzLtpBin, &f0gainLtp, nSubs); + } + } + + if (f0gainLtp > 0.0 && f0gainLtp < 0.5 && *n_plocs > 14) { + if (P_in_plocs > 0) { + *n_plocs = 0; + } + } + + return; +} + + +#define sub(a,b) (a - b) +#define add(a,b) (a + b) +#define s_xor(a,b) (a ^ b) + +/* in case a value (e.g max or min) is already known , find the first corresponding array index */ +static LC3_INT16 plc_phEcu_find_ind_fx( /* o : output maximum indx 0.. len-1 */ + const LC3_INT16 *inp, /* i : vector */ + const LC3_INT16 len, /* i : length */ + const LC3_INT16 val /* i : value to find */ +) +{ + LC3_INT16 val_ind; + LC3_INT16 pos; + + val_ind = -1; + + for(pos = 0; pos < len; pos++) + { + if (sub(inp[pos], val) == 0) + { + val_ind = pos; + } + } + + return val_ind; +} + + + +/* BASOP function adapted to compile in float/integer environment */ +/*----------------------------------------------------------------------------- + * plc_phEcu_peak_locator_fxlike() + *----------------------------------------------------------------------------*/ +static void plc_phEcu_peak_locator_fxlike(const LC3_INT16 *inp, /* i: vector with values >=0 ,Qx */ + const LC3_INT16 inp_len, /* i: length of inp */ + LC3_INT16 * int_plocs, /* o: array of filtered integer plocs Q0 */ + LC3_INT16 * n_fsc, /* o: total_ number of filtered located highs Q0 */ + const LC3_INT16 sens, /* i sensitivity, Qx */ + const LC3_INT16 inp_high, /* i global high , Qx */ + const LC3_INT16 inp_low /* i: global low, Qx */ +) +{ + + LC3_INT16 j, k, n, idx_high, idx_low; + LC3_INT16 inp_len_minus1; + LC3_INT16 pairs_start, pairs_end; + LC3_INT16 *p_tmp; + LC3_INT16 prev_delta, curr_delta; + LC3_INT16 delta_predc, delta_fin; + LC3_INT16 add_dc_flag, add_fin_flag; + LC3_INT16 low_val_cand_pairs, val_range; + LC3_INT16 num_pairs, n_tail_values; + LC3_INT16 cand_phase_start, cand_idx, prev_low_plus_sens, tmp; + LC3_INT16 cand_high, prev_low; + LC3_INT16 *cand_pairs; /* actually [DC ] + pairs + [FS/2] */ + + LC3_INT16 sc_idx[1 + 368 + 1]; + LC3_INT16 cand_pairs_buf[1 + 1 + 368 + 1]; + LC3_INT16 fsc_idx[1 + 368 / 2 + 1]; + + + inp_len_minus1 = sub(inp_len, 1); /* size of delta=derivative array ,and last index in inp */ + + cand_pairs = &cand_pairs_buf[1]; /* ptr init , make space for storing a lowest amplitude value in location -1 */ + pairs_start = 1; /* adjusted to zero or 1 or 2 when/if, DC is injected as sc_idx[0], or initial plateau skipped */ + + p_tmp = &(sc_idx[pairs_start]); /* ptr init */ + + + /* xor high/low pairs of delta_inp and save sign changes */ + prev_delta = sub(inp[1], inp[0]); /* precompute very first delta */ + + for(n = 1; n < inp_len_minus1; n++) + { /* sign change analysis */ + curr_delta = sub(inp[n + 1], inp[n]); /* n+1 ,n , are loop ptrs */ + if (s_xor(prev_delta, curr_delta) < 0) /* a "0" delta treated as a positive sign */ + { + *p_tmp++ = n; /* store sign change bin locations , location n in the inp[] signal */ + } + prev_delta = curr_delta; + } + + k = (LC3_INT16)(p_tmp - &(sc_idx[pairs_start])); + + /* copy sign change location values to a pairs array */ + /* leave one initial sc_idx location open for a potential initial DC value */ + + for(j = 0; j < k; j++){ + cand_pairs[j + pairs_start] = inp[sc_idx[j + pairs_start]]; + } + + /* filter away a potential single initial/trailing plateau + to enable correct analysis for adding DC or fs/2 bins */ + + + if((sub(k, 2) >= 0) && + (sub(cand_pairs[pairs_start], cand_pairs[pairs_start + 1]) == 0)){ + pairs_start = add(pairs_start, 1); + k = sub(k, 1); + } + + /* filter away potential single trailing plateu */ + pairs_end = sub(add(pairs_start, k), 1); /* point to last established sign change element */ + + if ((sub(k, 2) >= 0) && + (sub(cand_pairs[sub(pairs_end, 1)], cand_pairs[pairs_end]) == 0)){ + k = sub(k, 1); + } + pairs_end = sub(add(pairs_start, k), 1); /* recalc ptr to last element */ + + + /* conditionally add high/lows on both sides of input (pre_dc or fin) as candidates */ + add_dc_flag = 0; + add_fin_flag = 0; + + + if(sub(k, 1) == 0) /* one single sign change found special case */ + { + if (sub(inp[0], cand_pairs[pairs_start]) != 0) + { + add_dc_flag = 1; /* not plateau */ + } + + if (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) != 0) + { + add_fin_flag = 1; /* not plateau */ + } + } + + if(sub(k, 2) >= 0) + { + delta_predc = sub(cand_pairs[pairs_start + 1], cand_pairs[pairs_start]); + delta_fin = sub(cand_pairs[pairs_end], cand_pairs[pairs_end - 1]); + + /* plateaus are allowed to be detected by xor sign change, + but still not allowed at the start nor at the end */ + + add_dc_flag = 1; + if (sub(inp[0], cand_pairs[pairs_start]) == 0) + { + add_dc_flag = 0; /* plateau down or , plateaus up., --> do not add DC */ + } + + + if ((sub(inp[0], cand_pairs[pairs_start]) < 0) && (delta_predc > 0)) + { + add_dc_flag = -1; /*UP - up ... replace */ + } + + if ((sub(inp[0], cand_pairs[pairs_start]) > 0) && (delta_predc < 0)) + { + add_dc_flag = -1; /* DOWN - down ... % replace */ + } + + add_fin_flag = 1; + if (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) == 0) + { + add_fin_flag = 0; /* up - plateau ... */ + } + + if ((delta_fin > 0) && (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) < 0)) + { + add_fin_flag = -1; /* up - UP ... % replace , hard to hit */ + } + + if ((delta_fin < 0) && (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) > 0)) + { + add_fin_flag = -1; /*down - DOWN ... % replace */ + } + + } + + if(add_dc_flag > 0) + { /* add DC */ + pairs_start = sub(pairs_start, 1); + cand_pairs[pairs_start] = inp[0]; + sc_idx[pairs_start] = 0; + k = add(k, 1); + } + if(add_dc_flag < 0) + { /* -1 --> replace with DC*/ + cand_pairs[pairs_start] = inp[0]; + sc_idx[pairs_start] = 0; + } + + if(add_fin_flag > 0) + { /* add FS/2 */ + pairs_end = add(pairs_end, 1); + cand_pairs[pairs_end] = inp[inp_len_minus1]; + sc_idx[pairs_end] = inp_len_minus1; + k = add(k, 1); + } + if(add_fin_flag < 0) + { /* -1, replace tail with FS/2*/ + cand_pairs[pairs_end] = inp[inp_len_minus1]; + sc_idx[pairs_end] = inp_len_minus1; + } + /* preliminary cand_pairs now only have highs , lows , no initial/trailing plateaus */ + + + /* we allow the DC/FsBy2 lows to be used as the candidatelLow */ + low_val_cand_pairs = inp_low; + val_range = sub(inp_high, low_val_cand_pairs); /* used to determine if search is useful at all */ + + + if ((sub(val_range, PEAK_LOCATOR_RES_FX) < 0) || + (sub(inp_high, sens) < 0)) + { + k = 0; + } + + + if ((k == 0) && (sub(val_range, sens) >= 0)) + { + k = 1; + } + + + if(sub(k, 2) > 0) + { + /* low, high, low, ... or + high, low, high, ...*/ + + cand_phase_start = pairs_start; /*assume first candidate is a high */ + if (sub(cand_pairs[pairs_start], cand_pairs[pairs_start + 1]) < 0) + { + cand_phase_start = add(pairs_start, 1); /* first is a low, --> skip to next higher cand */ + } + + /* high, low, high, ... */ + tmp = k; + if (sub(cand_phase_start, pairs_start) != 0) + { + tmp = sub(tmp, 1); + } + num_pairs = tmp / 2; // shr(tmp, 1); + n_tail_values = sub(tmp, num_pairs * 2); // shl(num_pairs, 1)); + + /* filter preliminary sign changes into sensitivity filtered sign changes */ + + *n_fsc = 0; /* counter of filtered fsc_idx */ + cand_high = low_val_cand_pairs; + cand_idx = -1; /* sentinel location for no high cand found yet. */ + cand_pairs[-1] = low_val_cand_pairs; + + prev_low = low_val_cand_pairs; + prev_low_plus_sens = add(prev_low, sens); + + /* filter loop for high - low sign change pairs */ + /* idx_high, idx_low are raw pointers into the cand_pairs and sc_idx arrays */ + + for(idx_high = cand_phase_start; idx_high < (cand_phase_start + 2 * num_pairs); idx_high += 2) + { + idx_low = idx_high + 1; /* loop ptr increase */ + + /* new high candidate larger than previous candidate and */ + /* sensitivity still larger than the the previous low */ + tmp = MAX(cand_high, prev_low_plus_sens); + if (sub(cand_pairs[idx_high], tmp) > 0) + { + cand_idx = idx_high; /* enable or shift candidate position fwd */ + } + cand_high = cand_pairs[cand_idx]; /* NB, cand_pairs[-1] , has the low_val_cand_pairs value stored */ + + /* now check the fwd idx_low of the current {high,low} pair */ + prev_low = MIN(cand_pairs[idx_low], prev_low); + + tmp = sub(cand_high, sens); + if(sub(tmp, cand_pairs[idx_low]) > 0) + { + /* this low point is now low enough to fix a previous high candidate */ + + fsc_idx[*n_fsc] = cand_idx; /*% add cand high idx -> output idx list*/ + *n_fsc = add(*n_fsc, 1); + + prev_low = cand_pairs[idx_low]; /* use this value as new low estimate */ + cand_idx = -1; /* no candidate until next pair or tail bin, and pt to lowVal */ + cand_high = low_val_cand_pairs; /* enable next candidate to be selected immediately */ + } + prev_low_plus_sens = add(prev_low, sens); + } /* { high, low} for loop */ + + + if((n_tail_values == 0) && (cand_idx >= 0)) + { + /* no tail low or high value to analyze + still may need to lock a non-locked but qualified candidate */ + fsc_idx[*n_fsc] = cand_idx; + *n_fsc = add(*n_fsc, 1); + } + + + /* cand_pairs vector may have a last orphan value */ + if(n_tail_values > 0) + { + /* cand_pairs vector may have a last orphan tail value */ + /* + logic boils down to if (nTailValues > 0) && (cand_pairs(n_end) > tmp) + there is a last one trailing high to process + + a) the last high, may be a new high Peak if we have not yet + locked the current candidate + b) if we have locked the last candidate, the last high may also be + a highpeak if it is high enough from the(newly set previous) valley floor. + + tmp=a||b + */ + + tmp = MAX(cand_high, prev_low_plus_sens); + tmp = sub(cand_pairs[pairs_end], tmp); + if(tmp > 0) + { + fsc_idx[*n_fsc] = pairs_end; + *n_fsc = add(*n_fsc, 1); + } + else + { + if(cand_idx >= 0) + { /* we have a previously established high candidate */ + fsc_idx[*n_fsc] = cand_idx; + *n_fsc = add(*n_fsc, 1); + } + + } + } + + /* move high locations info from fsc_idx , to output */ + for(j = 0; j < *n_fsc; j++) + { + int_plocs[j] = sc_idx[fsc_idx[j]]; + + } + + } /* end of pairs + [tail] section filtering */ + else + { + /* constant/single rise or constant decay or very low overall values, cases */ + *n_fsc = 0; + + tmp = sub(inp_high, sens); + if((k != 0) && (sub(tmp, low_val_cand_pairs) > 0)) + { + /* low,high */ + /* high,low */ + tmp = plc_phEcu_find_ind_fx(inp, inp_len, inp_high); + int_plocs[0] = tmp; /* simply locate the high peak*/ + *n_fsc = 1; + if (tmp < 0) + { /*safety in case max value index was not found */ + *n_fsc = 0; + } + } + } + + return; +} + diff --git a/lc3plus/plc_phecu_subst_spec.c b/lc3plus/plc_phecu_subst_spec.c new file mode 100755 index 0000000000..43f806339b --- /dev/null +++ b/lc3plus/plc_phecu_subst_spec.c @@ -0,0 +1,247 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" +#include "constants.h" + + +static LC3_INT32 own_rand(LC3_INT32 seed); +static Complex valley_magnitude_adj(Complex X_i_in, LC3_INT32 uni_seed, LC3_FLOAT cos_F); +static LC3_INT32 rand_phase(LC3_INT32 seed_in, LC3_FLOAT* cos_F); + +void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_INT32 time_offs, Complex* X, LC3_INT32 X_len, + LC3_FLOAT* mag_chg_gr, LC3_INT32 *seed, LC3_FLOAT* alpha, LC3_FLOAT* beta, LC3_FLOAT* Xavg, + LC3_INT32 t_adv_in, LC3_INT32 Lprot, LC3_INT32 delta_corr, LC3_FLOAT *corr_phase_dbg, + LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg) { + + LC3_INT32 i, i2, lprotBy2Minus1, one_peak_flag_mask, noise_mag_scale; + LC3_INT32 t_adv; + LC3_FLOAT corr_phase[MAX_PLC_NPLOCS] = {0}; + LC3_FLOAT cos_F, mag_chg_local, alpha_local, beta_local, tmp; + Complex X_i, X_i_new; + LC3_INT32 segmentLen, e; + LC3_FLOAT Xph; + LC3_FLOAT seed_local; + LC3_INT32 binCounter, subInd; + + UNUSED(corr_phase_dbg); + UNUSED(X_i_new_re_dbg); + UNUSED(X_i_new_im_dbg); + + seed_local = (LC3_FLOAT) *seed; + + + lprotBy2Minus1 = imin(320, Lprot/2 - 1); /* limit to 20 KHz */ + + + t_adv = t_adv_in + time_offs; + + for (i = 0; i < n_plocs; i++) { + corr_phase[i] = (LC3_FLOAT)2.0 * (LC3_FLOAT)M_PI * (f0est[i]/Lprot)*(LC3_FLOAT)t_adv; + } + + + // EVOLVE PHASE ----------------- + binCounter = 1; + subInd = 0; + + one_peak_flag_mask = -1; + if (n_plocs < 3 && n_plocs > 0) { + one_peak_flag_mask = 0; + } + + noise_mag_scale = 0; + if (n_plocs == 0 || time_offs != 0) { + noise_mag_scale = 1; + } + + if (n_plocs == 0) { + X[0] = realtoc(0); + X[X_len-1] = realtoc(0); + } + + + if (n_plocs != 0) { + for (i = 0; i < n_plocs; i++) { + LC3_INT32 delta_corr_dn = delta_corr; + LC3_INT32 delta_corr_up = delta_corr; + + if (i > 0) { + delta_corr_dn = imin( ((plocs[i] - plocs[i - 1] - 1) / 2), delta_corr_dn); + } + + if (i < n_plocs - 1) { + delta_corr_up = imin( ((plocs[i + 1] - plocs[i] - 1) / 2), delta_corr_up); + } + + segmentLen = (plocs[i] - delta_corr_dn) - binCounter; + + for (i2 = 0; i2 < segmentLen; i2++) { + seed_local = (LC3_FLOAT)rand_phase((LC3_INT32)seed_local, &cos_F); + + X_i = X[binCounter]; + X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0)); + + + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + + if (noise_mag_scale != 0) { + X_i = valley_magnitude_adj(X_i_new,(LC3_INT32) seed_local, cos_F); + X_i_new = X_i; + } + + mag_chg_local = mag_chg_gr[subInd]; + alpha_local = alpha[subInd]; + + if (beta[subInd] != 0) { + tmp = beta[subInd] * Xavg[subInd]; + if (one_peak_flag_mask == 0) { + tmp = 0; + X_i_new = realtoc(0); + } + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0))); + } + else { + if (one_peak_flag_mask == 0) { + X_i_new = realtoc(0); + } + + X[binCounter] = cmul(realtoc(mag_chg_local), X_i_new); + } + + binCounter++; + + if (binCounter >= gwlpr[subInd + 1]) { + subInd++; + } + } + + e = plocs[i] + delta_corr_up; + if (e > lprotBy2Minus1) { + e = lprotBy2Minus1; + } + + Xph = corr_phase[i]; + + segmentLen = e - (binCounter - 1); + + for (i2 = 0; i2 < segmentLen; i2++) + { + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + X_i = X[binCounter]; + + { + LC3_INT32 nrep =(LC3_INT32) LC3_FLOOR(Xph / (2.0f*(LC3_FLOAT)M_PI)); + + X_i_new = cmul(X_i, cexpi(Xph - (2.0f*(LC3_FLOAT)M_PI*(LC3_FLOAT)nrep))); + } + + + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + + mag_chg_local = mag_chg_gr[subInd]; + alpha_local = alpha[subInd]; + beta_local = beta[subInd]; + if (beta_local != 0) { + + assert(alpha_local == mag_chg_local); + tmp = beta_local * Xavg[subInd]; + + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0))); + } + else + { + X[binCounter] = cmul(realtoc(mag_chg_local), X_i_new); + } + + binCounter++; + + if (binCounter >= gwlpr[subInd + 1]) { + subInd++; + } + } + } + } + + segmentLen = lprotBy2Minus1 - (binCounter - 1); + + for (i = 0; i < segmentLen; i++) { + seed_local = (LC3_FLOAT)rand_phase((LC3_INT32)seed_local, &cos_F); + + X_i = X[binCounter]; + X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI*seed_local/(LC3_FLOAT)32768.0)); + + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + + if (noise_mag_scale != 0) { + X_i = valley_magnitude_adj(X_i_new, (LC3_INT32)seed_local, cos_F); + X_i_new = X_i; + } + + if (one_peak_flag_mask == 0) { + X_i_new = realtoc(0); + } + + alpha_local = alpha[subInd]; + mag_chg_local = mag_chg_gr[subInd]; + + if (beta[subInd] != 0) { + assert(alpha_local == mag_chg_local); + tmp = beta[subInd]*Xavg[subInd]; + + if (one_peak_flag_mask == 0) { + tmp = 0; + } + + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local/(LC3_FLOAT)32768.0))); + } + else + { + X[binCounter] = cmul(realtoc(mag_chg_local), X_i_new); + } + + binCounter++; + + if (binCounter >= gwlpr[subInd + 1]) { + subInd++; + } + } + + + *seed = (LC3_INT32)seed_local; +} + +static LC3_INT32 own_rand(LC3_INT32 seed) { + LC3_INT32 retSeed; + assert(seed <= 32767 && seed >= -32768); + retSeed = (13849 + (seed + 32768) * 31821) & 65535; + retSeed -= 32768; + assert(retSeed <= 32767 && retSeed >= -32768); + return retSeed; +} + +static Complex valley_magnitude_adj(Complex X_i_in, LC3_INT32 uni_seed, LC3_FLOAT cos_F) { + LC3_FLOAT scale = ((LC3_FLOAT)0.5*(LC3_FLOAT)uni_seed/(LC3_FLOAT)32768.0) + (LC3_FLOAT)0.5*cos_F; + scale = (LC3_FLOAT)1.0 + (LC3_FLOAT)0.25*scale; + + assert(scale <= (LC3_FLOAT)1.25); + assert(scale >= (LC3_FLOAT)0.75); + + return cmul(X_i_in, realtoc(scale)); +} + +static LC3_INT32 rand_phase(LC3_INT32 seed_in, LC3_FLOAT* cos_F) { + LC3_FLOAT seed = (LC3_FLOAT)own_rand(seed_in); + *cos_F = LC3_COS((LC3_FLOAT)M_PI*seed/(LC3_FLOAT)32768.0); + return (LC3_INT32) seed; +} + diff --git a/lc3plus/plc_phecu_tba_per_band_gain.c b/lc3plus/plc_phecu_tba_per_band_gain.c new file mode 100755 index 0000000000..9f585f28dd --- /dev/null +++ b/lc3plus/plc_phecu_tba_per_band_gain.c @@ -0,0 +1,44 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) +{ + LC3_INT32 i; + + /* per band gain */ + for (i = 0; i < n_grp; i++) { + if (gr_pow_left[i] > 0) + { + trans[i] = gr_pow_right[i] / gr_pow_left[i]; + } + else + { + /* handle division by zero case */ + if (gr_pow_right[i] > 0) + { + trans[i] = 10.0; /* positive/0 transient */ + } + else + { + trans[i] = 1.0; /* 0/0 no transient , no power change */ + } + } + grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOGTEN(trans[i]); + + } + + return; +} + diff --git a/lc3plus/plc_phecu_tba_spect_Xavg.c b/lc3plus/plc_phecu_tba_spect_Xavg.c new file mode 100755 index 0000000000..600b9714e4 --- /dev/null +++ b/lc3plus/plc_phecu_tba_spect_Xavg.c @@ -0,0 +1,45 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_tba_spect_Xavg(LC3_INT32 fs_idx, LC3_INT32 n_grp, LC3_FLOAT *oold_spec_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spec_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *Xavg) +{ + LC3_INT32 i; + LC3_FLOAT XavgEn[MAX_LGW]; + LC3_FLOAT xfp_w_scale, oold_Escale, old_Escale; + + /* 8k 16k 24k 32k 48k */ + LC3_FLOAT flt_xfp_wE_MDCT2FFT_target[5] = { (LC3_FLOAT) 1.9906, (LC3_FLOAT) 4.0445, (LC3_FLOAT) 6.0980, (LC3_FLOAT) 8.1533, (LC3_FLOAT) 12.2603 }; + LC3_INT32 gw_0[10] = { 1, 3, 5, 9, 17, 33, 49, 65, 81, 97 }; + + /* prepare scale factor */ + + xfp_w_scale = LC3_ROUND(flt_xfp_wE_MDCT2FFT_target[fs_idx]/(LC3_FLOAT)16.0*(LC3_FLOAT) 32768.0) / (LC3_FLOAT) LC3_POW(2,11); + + /* prepare left and right subband energies */ + oold_Escale = (*oold_EwPtr) * xfp_w_scale; + old_Escale = (*old_EwPtr) * xfp_w_scale; + for (i = 0;i < n_grp;i++) { + gr_pow_left[i] = oold_spec_shape[i] * oold_Escale; + gr_pow_right[i] = old_spec_shape[i] * old_Escale; + + XavgEn[i] = ((LC3_FLOAT) 0.5) * (gr_pow_left[i] + gr_pow_right[i]) / (gw_0[i + 1] - gw_0[i]); + Xavg[i] = LC3_SQRT(XavgEn[i]); + } + + return; +} + diff --git a/lc3plus/plc_phecu_tba_trans_dect_gains.c b/lc3plus/plc_phecu_tba_trans_dect_gains.c new file mode 100755 index 0000000000..e5f0d3caae --- /dev/null +++ b/lc3plus/plc_phecu_tba_trans_dect_gains.c @@ -0,0 +1,320 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +#define BETA_MUTE_FAC 0.5 /* % attenuation factor per additional bad frame, FX uses 0.5 (shift right with 1 bit) */ +#define BETA_MUTE_FAC_INI 0.5 + + +#define OFF_FRAMES_LIMIT 30 /* 300 ms for LC3 10 ms */ + + + +#define LGW32k 7 +#define LGW16k 5 + + +/* Tables for attentuation of mag_chg, copied from FX */ +/* Tables are in Q15 */ +/* 0.3 dB attenuation per frame for 16 frames, then 6 dB attenuation per frame */ +const LC3_INT32 POW_ATT_TABLE1[OFF_FRAMES_LIMIT + 1] = { 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 24857, 24013, + 23198, 22410, 21650, 20915, 20205, 19519, 9759, 4880, 2440, 1220, + 610, 305, 152, 76, 38, 19, 10, 5, 2, 1, + 0 }; +/* % 0.4 dB attenuation per frame for 16 frames, then 6 dB attenuation per frame */ +const LC3_INT32 POW_ATT_TABLE0[OFF_FRAMES_LIMIT + 1] = { 32767, 31293, 29885, 28540, 27255, 26029, 24857, 23738, 22670, 21650, + 20675, 19745, 18856, 18007, 17197, 16423, 8211, 4106, 2053, 1026, + 513, 257, 128, 64, 32, 16, 8, 4, 2, 1, + 0 }; + +#ifdef PLC2_FADEOUT_IN_MS +#if PLC2_FADEOUT_IN_MS == 0 +/* default setting only requieres two tables */ +const Word16* const POW_ATT_TABLES[1 + 2] = +{ NULL, POW_ATT_TABLE1/*1 0.3dB steps */ , POW_ATT_TABLE0/*2 0.4 dB steps*/, +}; +#else +const LC3_INT32 POW_ATT_TABLE_p3x8_6[] = { + 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 12865, 6433, + 3216, 1608, 804, 402, 201, 101, 50, 25, 13, 6, + 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x8_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31293, 29885, 28540, 27255, 26029, 24857, 23738, 11869, 5935, + 2967, 1484, 742, 371, 185, 93, 46, 23, 12, 6, + 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; + +const LC3_INT32 POW_ATT_TABLE_p3x4_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31656, 30581, 29543, 14772, 7386, 3693, 1847, 923, 462, + 231, 115, 58, 29, 14, 7, 4, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x4_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31293, 29885, 28540, 14270, 7135, 3568, 1784, 892, 446, + 223, 111, 56, 28, 14, 7, 3, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +const LC3_INT32 POW_ATT_TABLE_p3x2_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31656, 15828, 7914, 3957, 1979, 989, 495, 247, 124, + 62, 31, 15, 8, 4, 2, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x2_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31293, 15647, 7823, 3912, 1956, 978, 489, 244, 122, + 61, 31, 15, 8, 4, 2, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +const LC3_INT32 POW_ATT_TABLE_p3x1_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, + 32, 16, 8, 4, 2, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x1_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, + 32, 16, 8, 4, 2, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + +const LC3_INT32* const POW_ATT_TABLES[1 + 10] = +{ NULL, + POW_ATT_TABLE1 , POW_ATT_TABLE0, /* .3dB x16,16 6dB steps */ /* .4dB x16, 16 6dB steps */ /*original/default */ + POW_ATT_TABLE_p3x8_6, POW_ATT_TABLE_p4x8_6, /* .3dB x8, 24 6dB steps */ /* .4dB x8, 24 6dB steps */ + POW_ATT_TABLE_p3x4_6, POW_ATT_TABLE_p4x4_6, /* .3dB x4, 28 6dB steps */ /* .4dB x4, 28 6dB steps */ + POW_ATT_TABLE_p3x2_6, POW_ATT_TABLE_p4x2_6, /* .3dB x2, 30 6dB steps */ /* .4dB x2, 30 6dB steps */ + POW_ATT_TABLE_p3x1_6, POW_ATT_TABLE_p4x1_6 /* .3dB x1, 30 6dB steps */ /* .4dB x1, 30 6dB steps */ +}; +#endif +#endif + +void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *grp_pow_change, + LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, + LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_FLOAT *ph_dith, LC3_INT32 *tr_dec, + LC3_FLOAT *att_val, LC3_INT32 *attDegreeFrames_dbg, LC3_FLOAT *thresh_dbg) +{ + + LC3_INT32 i; + LC3_FLOAT thresh_tr_dB, max_increase_grp_pow; + LC3_FLOAT max_increase_grp_pow_lin; + LC3_FLOAT grp_pow_change_lin[MAX_LGW]; + LC3_FLOAT XavgFadeinFactor; + + LC3_INT32 burst_att_thresh; + LC3_INT32 att_per_frame_idx; + LC3_INT32 att_always, attDegreeFrames; + + LC3_INT32 FADEOUT_IN_MS, PLC_P800_SPEECH_FADEOUT_IN_FRAMES, + PLC2_FADEOUT_IN_FRAMES, BURST_ATT_THRESH_PRE; + const LC3_INT32 *TABLEQ15; + LC3_INT32 BURST_ATT_THRESH; /* start attenuate with losses in a row, also starts FADE2AVG actions */ + LC3_INT32 ATT_PER_FRAME; /* initial msuic attenuation table ptr, actually implemented in table lookup! */ + LC3_INT32 BETA_MUTE_THR; /* time threshold in 10 ms frames to start beta - noise attenuation */ + + UNUSED(attDegreeFrames_dbg); + + /* constants setup */ + att_always = 0; + + XavgFadeinFactor = -1.0; + + if (PLC2_FADEOUT_IN_MS != 0) + { + if (PLC2_FADEOUT_IN_MS < 0) + { + FADEOUT_IN_MS = PLC_FADEOUT_IN_MS; /* % use TDC - SETTING as input */ + } + else + { + FADEOUT_IN_MS = PLC2_FADEOUT_IN_MS; /* % use a PLC2 individual settinsg */ + } + + PLC_P800_SPEECH_FADEOUT_IN_FRAMES = (LC3_INT32) LC3_FLOOR((LC3_FLOAT)FADEOUT_IN_MS / (LC3_FLOAT)10.0); /* % nominal svaleu for speech */ + + PLC2_FADEOUT_IN_FRAMES = MIN(OFF_FRAMES_LIMIT, MAX(6, 3 * PLC_P800_SPEECH_FADEOUT_IN_FRAMES)); /* for PLC2 we typically maintain energy 3x longer */ + + BURST_ATT_THRESH_PRE = MIN(5, MAX(1, (1 * PLC2_FADEOUT_IN_FRAMES) / 6)); /* nominal 20-40 ms to start actual muting, will be thresh +1 fot assumed music */ + + ATT_PER_FRAME = MIN(10, MAX(2, 2 * (6 - BURST_ATT_THRESH_PRE))); /* % we let the BURST_ATT_thresh control the initial table selection */ + BURST_ATT_THRESH = MIN(BURST_ATT_THRESH_PRE, 4); + BETA_MUTE_THR = MIN(4 + (OFF_FRAMES_LIMIT / 2) + 1, MAX(4, BURST_ATT_THRESH + 1 + (LC3_INT32)LC3_POW((LC3_FLOAT)2.0,BURST_ATT_THRESH_PRE - (LC3_FLOAT)1))); /* nominal time to start mandatory decrease of Xavg */ + } + + + /* Initialize in the same way as done in trans_burst_ana_fx(), even though this is not really needed */ + burst_att_thresh = BURST_ATT_THRESH; + att_per_frame_idx = ATT_PER_FRAME; + + + /* 10ms constants */ + thresh_tr_dB = 10.0; /* dB threshold kept same as for 20ms, even though transient analysis frame size was shortened */ + max_increase_grp_pow = 0; /* maximum amplification(dB) in case of onset transients, offset always deacy */ + + max_increase_grp_pow_lin = (LC3_FLOAT)1.0*LC3_POW((LC3_FLOAT)10.0, max_increase_grp_pow / (LC3_FLOAT)10.0)*(LC3_FLOAT)(32767.0 / 32768.0); + + + /* envelope setting */ + burst_att_thresh = BURST_ATT_THRESH + 1; + att_per_frame_idx = ATT_PER_FRAME - 1; + + + attDegreeFrames = 0; + if (burst_len > burst_att_thresh) + { + att_always = 1; + + /* Added to be able to able to use tables to be aligned with FX */ + /* Limit attDegreeFrames to OFF_FRAMES_LIMIT */ + attDegreeFrames = burst_len - burst_att_thresh; + + if (attDegreeFrames > OFF_FRAMES_LIMIT) + { + attDegreeFrames = OFF_FRAMES_LIMIT; + } + } + + + set_vec(1.0 * (32767.0/32768.0), mag_chg, n_grp); + set_vec(0.0, ph_dith, n_grp); + + set_vec(1.0 * (32767.0/32768.0), alpha, n_grp); + set_vec(0.0, beta, n_grp); + set_vec_int(0, tr_dec, n_grp); + + set_vec(1.0 * (32767.0/32768.0), att_val, n_grp); + + + + /* transient detection per band */ + for (i = 0;i < n_grp; i++) { + if(burst_len == 1) + { + /* first bad frame */ + grp_pow_change_lin[i] = LC3_POW((LC3_FLOAT)10.0, grp_pow_change[i]/(LC3_FLOAT)10.0); + + *stPhECU_beta_mute = BETA_MUTE_FAC_INI; + *stPhECU_beta_mute = *stPhECU_beta_mute / (LC3_FLOAT)2.0; + + /* transient processing */ + /* transients may be both rise and decay transients !! */ + + + if(LC3_FABS(grp_pow_change[i]) >= thresh_tr_dB) + { + + tr_dec[i] = 1; + } + + + /* magnitude modification */ + att_val[i] = 0.0f; + if(tr_dec[i] || att_always) { + + att_val[i] = MIN(max_increase_grp_pow_lin, grp_pow_change_lin[i]); /* % linear values !! */ + att_val[i] = LC3_SQRT(att_val[i]); + mag_chg[i] = att_val[i]; + stPhECU_mag_chg_1st[i] = att_val[i]; + } + else + { + mag_chg[i] = 1.0 * (LC3_FLOAT)(32767.0/32768.0); + stPhECU_mag_chg_1st[i] = (LC3_FLOAT)1.0; + } + } + else + { + /* burst handling based on states */ + + assert(burst_len >= 2); /* states used here */ + tr_dec[i] = 0; + + if (PLC_FADEOUT_IN_MS > 0) + { + assert(att_per_frame_idx >= 1 && att_per_frame_idx <= 10); + TABLEQ15 = POW_ATT_TABLES[att_per_frame_idx]; + att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT) TABLEQ15[MIN(OFF_FRAMES_LIMIT, attDegreeFrames )] / (LC3_FLOAT)32768.0); /* Table idx 0...N-1 therefore no + 1 */ + att_val[i] = att_val[i]; + } + else + { + + if (att_per_frame_idx == ATT_PER_FRAME) + { + att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT)POW_ATT_TABLE0[MIN(OFF_FRAMES_LIMIT, attDegreeFrames)] / (LC3_FLOAT)32768.0); + } + else + { + att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT)POW_ATT_TABLE1[MIN(OFF_FRAMES_LIMIT, attDegreeFrames)] / (LC3_FLOAT)32768.0); + } + } + + + if ( (att_val[i] != 0) && (att_val[i] * (LC3_FLOAT)32768.0 < (LC3_FLOAT)0.5) ) + { + att_val[i] = 0.0; /* for SNR measurments match in float lowest possible level to BASOP representation */ + } + + /* Apply attenuation */ + mag_chg[i] = stPhECU_mag_chg_1st[i]; + + mag_chg[i] = mag_chg[i] * att_val[i]; /* add additional attenuation from burst attenation logic */ + + if ((mag_chg[i] != 0) && (mag_chg[i] * (LC3_FLOAT)32768.0 < (LC3_FLOAT)0.5)) + { + mag_chg[i] = 0; /* for SNR measurments match in float lowest possible level to BASOP representation */ + } + + + + if(burst_len > BETA_MUTE_THR) + { + *stPhECU_beta_mute = *stPhECU_beta_mute * (LC3_FLOAT)BETA_MUTE_FAC; + } + + alpha[i] = mag_chg[i]; + + if (alpha[i] >= (LC3_FLOAT)(32766.0 / 32768.0)) + { + beta[i] = 0; /* align to BASOP more efficent use of beta */ + } + else + { + beta[i] = LC3_SQRT((LC3_FLOAT)1.0 - alpha[i]* alpha[i]) * *stPhECU_beta_mute; + } + + if ( i >= LGW32k-1) { + beta[i] = beta[i] * (LC3_FLOAT)0.1; + } + else if( i >= LGW16k-1) + { + beta[i] = beta[i] * (LC3_FLOAT)0.5; + } + + + /* limit Xavg noise contribution further in case of offset / tr_decay */ + + if ((burst_len <= burst_att_thresh) && (stPhECU_mag_chg_1st[i] < (LC3_FLOAT)(32767.0 / 32768.0))) + { + XavgFadeinFactor = (LC3_FLOAT)(burst_len - (LC3_FLOAT)1.0) / burst_att_thresh; + + XavgFadeinFactor = MIN((LC3_FLOAT)1.0, XavgFadeinFactor); + + beta[i] = beta[i] * XavgFadeinFactor; + + } + } + } + + if (thresh_dbg != NULL) + { + *thresh_dbg = XavgFadeinFactor; + } + + return; +} + diff --git a/lc3plus/plc_phecu_trans_burst_ana_sub.c b/lc3plus/plc_phecu_trans_burst_ana_sub.c new file mode 100755 index 0000000000..c860cd6ce3 --- /dev/null +++ b/lc3plus/plc_phecu_trans_burst_ana_sub.c @@ -0,0 +1,48 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, + LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg) +{ + LC3_FLOAT gr_pow_left[MAX_LGW]; + LC3_FLOAT gr_pow_right[MAX_LGW]; + LC3_FLOAT trans[MAX_LGW]; + LC3_FLOAT grp_pow_change[MAX_LGW]; + LC3_FLOAT ph_dith[MAX_LGW]; + LC3_FLOAT att_val[MAX_LGW]; + LC3_INT32 tr_dec[MAX_LGW]; + + LC3_INT32 attDegreeFrames; + LC3_FLOAT thresh_dbg; + + UNUSED(tr_dec_dbg); + UNUSED(gpc_dbg); + + if (burst_len <= 1) + { + plc_phEcu_tba_spect_Xavg(fs_idx, n_grp, oold_spect_shape, oold_EwPtr, old_spect_shape, old_EwPtr, gr_pow_left, gr_pow_right, stPhECU_Xavg); + + plc_phEcu_tba_per_band_gain(n_grp, gr_pow_left, gr_pow_right, trans, grp_pow_change); + + } + + + plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg); + + return; +} + diff --git a/lc3plus/plc_tdc.c b/lc3plus/plc_tdc.c new file mode 100755 index 0000000000..1a1a408f4d --- /dev/null +++ b/lc3plus/plc_tdc.c @@ -0,0 +1,763 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +/***************************************************************************\ + * contents/description: Main function for Time domain concealment +\***************************************************************************/ + +#include +#include "functions.h" + + +static LC3_INT16 TDC_random_short(LC3_INT16 *seed); +static LC3_FLOAT TDC_get_gainp(const LC3_FLOAT x[], const LC3_FLOAT y[], LC3_INT32 n); +static LC3_FLOAT TDC_get_gainc(const LC3_FLOAT x[], const LC3_FLOAT y[], const LC3_FLOAT *gain_p, const LC3_INT32 n, const LC3_INT32 frame_dms); +static void TDC_LPC_synthesis(const LC3_FLOAT a[], LC3_FLOAT x[], LC3_FLOAT y[], LC3_INT32 l, const LC3_FLOAT mem[], LC3_INT32 lpcorder, LC3_FLOAT *buf); +static void TDC_LPC_residu(const LC3_FLOAT *a, LC3_FLOAT *x, LC3_FLOAT *y, LC3_INT32 l, LC3_INT32 lpcorder); +static void TDC_highPassFiltering(const LC3_INT32 L_buffer, LC3_FLOAT exc2[], const LC3_FLOAT hp_filt[], const LC3_INT32 l_fir_fer); +static void TDC_f_preemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, LC3_FLOAT *mem); +static void TDC_deemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, const LC3_FLOAT *mem); +const LC3_FLOAT TDC_high_16[TDC_L_FIR_HP] = { 0.f, -0.0205f, -0.0651f, -0.1256f, -0.1792f, 0.8028f, -0.1792f, -0.1256f, -0.0651f, -0.0205f, 0.f }; +const LC3_FLOAT TDC_high_32[TDC_L_FIR_HP] = {-0.0517f, -0.0587f, -0.0820f, -0.1024f, -0.1164f, 0.8786f, -0.1164f, -0.1024f, -0.0820f, -0.0587f, -0.0517f}; +const LC3_FLOAT TDC_high_16_harm[TDC_L_FIR_HP] = { 0.0053f, 0.0000f, -0.0440f, 0.0000f, 0.2637f, 0.5500f, 0.2637f, 0.0000f, -0.0440f, 0.0000f, 0.0053f}; +const LC3_FLOAT TDC_high_32_harm[TDC_L_FIR_HP] = {-0.0053f, -0.0037f, -0.0140f, 0.0180f, 0.2668f, 0.4991f, 0.2668f, 0.0180f, -0.0140f, -0.0037f, -0.0053f}; +static void TDC_levinson(LC3_FLOAT *acf, LC3_INT32 len, LC3_FLOAT *out); +static void TDC_copyFLOAT(const LC3_FLOAT * X, LC3_FLOAT * Z, LC3_INT32 n); +static LC3_FLOAT TDC_dotFLOAT(const LC3_FLOAT * X, const LC3_FLOAT * Y, LC3_INT32 n); + +const LC3_INT32 beforeNextIncArray[4][4] = {{0,0,0,1}, + {0,1,0,1}, + {0,1,1,1}, + {1,1,1,1}}; +const LC3_INT32 nextIncArray[4][4] = {{1,0,0,0}, + {1,0,1,0}, + {1,0,1,1}, + {1,1,1,1}}; + +void processTdcApply_fl(const LC3_INT32 pitch_int, + const LC3_FLOAT *preemphFac, + const LC3_FLOAT* A, + const LC3_INT32 lpc_order, + const LC3_FLOAT* pcmbufHist, + const LC3_INT32 max_len_pcm_plc, + const LC3_INT32 N, + const LC3_INT32 frame_dms, + const LC3_INT32 SampRate, + const LC3_INT32 nbLostFramesInRow, + const LC3_INT32 overlap, + const LC3_FLOAT *stabFac, + LC3_FLOAT harmonicBuf[MAX_PITCH], + LC3_FLOAT synthHist[M], + LC3_INT32* fract, + LC3_INT16* seed, + LC3_FLOAT* gain_c, + LC3_FLOAT* alpha, + LC3_FLOAT* synth + ) +{ + LC3_FLOAT step, step_n; + LC3_INT32 i, len, Tc, nbLostCmpt_loc, nextInc, beforeNextInc; + LC3_FLOAT gain_h, tmp, gain_p; + LC3_FLOAT *exc2, *exc_buf, *exc, *x_pre, *buf, *pt_exc, *pt1_exc, *synthMemPtr; + LC3_FLOAT *harmonicBufPtr; + LC3_FLOAT synth_mem[M]; + const LC3_FLOAT *hp_filt, *high_harm; + LC3_FLOAT gainInov; + LC3_FLOAT hpBlendFac; + char *scratchSpace1st, *scratchSpaceTmp; + char scratchSpace[(MAX_LEN_PCM_PLC + MDCT_MEM_LEN_MAX + MAX_LEN_PCM_PLC + 1 + M) * sizeof(LC3_FLOAT)]; + LC3_FLOAT alphaPrev; + LC3_FLOAT throttle; + LC3_INT32 frame_dms_idx, nbLostFramesInRow_mod; + + memset(synth_mem, 0, M * sizeof(LC3_FLOAT)); + memset(scratchSpace, 0, (MAX_LEN_PCM_PLC + MDCT_MEM_LEN_MAX + MAX_LEN_PCM_PLC + 1 + M) * sizeof(LC3_FLOAT)); + + /* len of synthesized signal */ + len = N + overlap; + + nbLostCmpt_loc = floor(frame_dms/100.0 * (nbLostFramesInRow - 1) + 1); + frame_dms_idx = frame_dms / 25 - 1; /* 0,1,2,3 */ + nbLostFramesInRow_mod = (nbLostFramesInRow - 1) % 4; + + beforeNextInc = beforeNextIncArray[frame_dms_idx][nbLostFramesInRow_mod]; + nextInc = nextIncArray [frame_dms_idx][nbLostFramesInRow_mod]; + + if (nbLostCmpt_loc > PLC_FADEOUT_IN_MS/10) + { + gain_p = 0; + *gain_c = 0; + *alpha = 0; + memset(synth, 0, len * sizeof(LC3_FLOAT)); + return; + } + + Tc = pitch_int; + if (*fract > 0) { + Tc++; + } + + /*---------------------------------------------------------------- + * Buffer Initialization for timeDomainConcealment_Apply + * + * 1st + * |--exc_buf--|--x_pre--| + * | |--exc2--| + * | |--buf (LPC Syn)--| + * + *---------------------------------------------------------------*/ + + scratchSpace1st = scratchSpace; + exc_buf = (LC3_FLOAT*)scratchSpace1st; scratchSpace1st += (LC3_INT32)sizeof(LC3_FLOAT) * (Tc + N/2 + len); + exc = exc_buf + (Tc + N/2); + + scratchSpaceTmp = scratchSpace1st; + x_pre = (LC3_FLOAT*)scratchSpaceTmp; scratchSpaceTmp += (LC3_INT32)sizeof(LC3_FLOAT) * (lpc_order + Tc + N/2 + 1); + + /*---------------------------------------------------------------* + * LPC Residual * + *---------------------------------------------------------------*/ + if (nbLostFramesInRow == 1) + { + /* copy buffer to pre-emphasis buffer */ + TDC_copyFLOAT(&(pcmbufHist[max_len_pcm_plc-(lpc_order+Tc+N/2+1)]), &(x_pre[0]), lpc_order+Tc+N/2+1); + + /* apply pre-emphasis to the signal */ + TDC_f_preemph(&(x_pre[1]), preemphFac, lpc_order+Tc+N/2, &x_pre[0]); + + /* copy memory for LPC synth */ + TDC_copyFLOAT(&(x_pre[Tc+N/2+1]), synth_mem, lpc_order); + + /* LPC Residual */ + TDC_LPC_residu(A, &(x_pre[lpc_order+1]), &(exc[-(Tc+N/2)]), Tc+N/2, lpc_order); + } + + /*---------------------------------------------------------------* + * Calculate gains * + *---------------------------------------------------------------*/ + if (nbLostFramesInRow == 1) + { + if (pitch_int == Tc) + { + gain_p = TDC_get_gainp( &(x_pre[lpc_order+Tc+1]), &(x_pre[lpc_order+1]), N/2 ); + } + else + { + tmp = TDC_get_gainp( &(x_pre[lpc_order+Tc+1]), &(x_pre[lpc_order+2]), N/2 ); + gain_p = TDC_get_gainp( &(x_pre[lpc_order+Tc+1]), &(x_pre[lpc_order+1]), N/2 ); + + if (tmp > gain_p) { + Tc = pitch_int; + gain_p = tmp; + *fract = 0; + } + } + + if(gain_p < 0.0f) + { + gain_p = 0.0f; + } + + if(gain_p > 1.0f) + { + gain_p = 1.0f; + } + + *gain_c = 0.0f; + + if (pitch_int == Tc) + { + *gain_c = TDC_get_gainc( &(exc[-1]), &(exc[-1-Tc]), &gain_p, N/2, frame_dms ); + } + else + { + tmp = TDC_get_gainc( &(exc[-1]), &(exc[-1-pitch_int]), &gain_p, N/2, frame_dms ); + *gain_c = TDC_get_gainc( &(exc[-1]), &(exc[-1-Tc]) , &gain_p, N/2, frame_dms ); + *gain_c = MIN(*gain_c, tmp); + } + } + else + { + gain_p = *alpha; + } + + /*---------------------------------------------------------------* + * Damping factor * + *---------------------------------------------------------------*/ + + alphaPrev = 1; + if (nbLostFramesInRow > 1) + { + alphaPrev = *alpha; + } + + if (nextInc != 0) + { + switch (nbLostCmpt_loc) + { + case 1: + *alpha = (LC3_FLOAT)sqrt(gain_p); + if ( *alpha > 0.98f ) + { + *alpha = 0.98f; + } + else if ( *alpha < 0.925f ) + { + *alpha = 0.925f; + } + break; + case 2: + *alpha = (0.63f + 0.35f * (*stabFac)) * gain_p; + if ( *alpha < 0.919f ) + { + *alpha = 0.919f; + } + break; + default: + *alpha = (0.652f + 0.328f * (*stabFac)) * gain_p; + } + } + + if (nbLostCmpt_loc > 3) + { + switch (frame_dms) + { + case 25: *alpha *= PLC34_ATTEN_FAC_025; break; + case 50: *alpha *= PLC34_ATTEN_FAC_050; break; + case 100: *alpha *= PLC34_ATTEN_FAC_100; break; + } + } + + if (nbLostCmpt_loc > 5) + { + gain_p = *alpha; + } + + /*---------------------------------------------------------------* + * Construct the harmonic part * + * Last pitch cycle of the previous frame is repeatedly copied. * + *---------------------------------------------------------------*/ + + pt_exc = harmonicBuf; + pt1_exc = exc - Tc; + + if( nbLostFramesInRow == 1 ) + { + if (*stabFac >= 1) + { + TDC_copyFLOAT(pt1_exc, pt_exc, Tc); + } + else + { + /* These values are necessary for the last five filtered samples */ + TDC_copyFLOAT(&exc[-Tc], exc, (TDC_L_FIR_HP-1)/2); + + high_harm = TDC_high_32_harm; + if (SampRate <= 16000) + { + high_harm = TDC_high_16_harm; + } + + for( i = 0; i < Tc; i++ ) + { + pt_exc[i] = TDC_dotFLOAT(&pt1_exc[i-(TDC_L_FIR_HP-1)/2], high_harm, TDC_L_FIR_HP); + } + } + } + + /*---------------------------------------------------------------* + * Construct the random part of excitation * + *---------------------------------------------------------------*/ + scratchSpaceTmp = scratchSpace1st; + exc2 = (LC3_FLOAT*)scratchSpaceTmp; scratchSpaceTmp += (LC3_INT32)sizeof(LC3_FLOAT) * (len + TDC_L_FIR_HP - 1); + + for (i = 0; i < len + TDC_L_FIR_HP - 1; i++) { + exc2[i] = (LC3_FLOAT)TDC_random_short(seed); + } + + /* high pass noise */ + if (SampRate <= 16000 ) + { + hp_filt = TDC_high_16; + } else { + hp_filt = TDC_high_32; + } + + if ( nbLostFramesInRow == 1 ) + { + TDC_highPassFiltering(len, exc2, hp_filt, TDC_L_FIR_HP); + } + else + { + /* moves from 0 to 1, speed is defined by PLC3_HPBLENDTHROTTLE */ + throttle = (LC3_FLOAT)nbLostCmpt_loc / (nbLostCmpt_loc + PLC3_HPBLENDTHROTTLE); + hpBlendFac = (1 - *alpha) * throttle; + + for (i = 0; i < len; i++) + { + exc2[i] = hpBlendFac * exc2[i+TDC_L_FIR_HP/2] + (1 - hpBlendFac) * TDC_dotFLOAT(&exc2[i], hp_filt, TDC_L_FIR_HP ); + } + } + + /* normalize energy */ + gainInov = 1.0f / (LC3_FLOAT)sqrt(TDC_dotFLOAT( exc2, exc2, N ) / (LC3_FLOAT)N + 0.01f ); + gainInov *= (1.1f - 0.75* gain_p); + + /* gains */ + gain_h = alphaPrev; + tmp = *gain_c * *alpha / alphaPrev; + + /* update steps */ + step = (1.0f/(LC3_FLOAT)N) * (gain_h - *alpha); + step_n = (1.0f/(LC3_FLOAT)N) * (*gain_c - tmp); + + /*---------------------------------------------------------------* + * Construct the total excitation * + *---------------------------------------------------------------*/ + harmonicBufPtr = harmonicBuf + ((nbLostFramesInRow - 1) * N) % Tc; + + for ( i = 0; i < len; i++ ) { + /* harmonic */ + if (harmonicBufPtr - harmonicBuf >= Tc) { + harmonicBufPtr = harmonicBuf; + } + exc[i] = *harmonicBufPtr++; + exc[i] *= gain_h; + + /* random */ + exc2[i] *= *gain_c * gainInov; + + /* total */ + exc[i] = exc[i] + exc2[i]; + + /* update */ + gain_h -= step; + gain_h = MAX(gain_h, 0); + *gain_c -= step_n; + *gain_c = MAX(*gain_c, 0); + } + + *gain_c = tmp; + + /*----------------------------------------------------------* + * Compute the synthesis speech * + *----------------------------------------------------------*/ + buf = (LC3_FLOAT*)scratchSpace1st; scratchSpace1st += (LC3_INT32)sizeof(LC3_FLOAT) * (len + lpc_order); + synthMemPtr = synth_mem; + if (nbLostFramesInRow != 1) + { + synthMemPtr = synthHist; + } + + TDC_LPC_synthesis(A, + &exc[0], + synth, + len, + synthMemPtr, + lpc_order, + buf); + + TDC_copyFLOAT(&synth[N-lpc_order], synthHist, lpc_order); + + /*----------------------------------------------------------* + * Deemphasis * + *----------------------------------------------------------*/ + TDC_deemph( synth, preemphFac, len, &pcmbufHist[max_len_pcm_plc-1] ); + + /*----------------------------------------------------------* + * Fade to zero * + *----------------------------------------------------------*/ + if (beforeNextInc != 0) + { + if (nbLostCmpt_loc == PLC_FADEOUT_IN_MS/10) + { + gain_h = 1; + step = 1.0f/(LC3_FLOAT)N; + for ( i = 0; i < N; i++ ) { + synth[i] *= gain_h; + gain_h -= step; + } + memset(&synth[N], 0, overlap * sizeof(LC3_FLOAT)); + } + } +} + +/* Take only real part */ +void processTdcInverseOdft_fl(LC3_FLOAT *in, LC3_INT32 n_bands, LC3_FLOAT *out, LC3_INT32 lpc_order) +{ + LC3_INT32 i, j, k; + LC3_FLOAT buf[2*MAX_BANDS_NUMBER_PLC]; + Complex sum; + Complex res; + + /* Buffer for ifft */ + j = 0; + for (i = 0; i < n_bands - 1; i += 2) + { + buf[j] = in[i]; + j++; + } + + for (i = n_bands - 1; i > 0; i -= 2) + { + buf[j] = in[i]; + j++; + } + + for (i = 0; i < n_bands; i++) + { + buf[j] = in[i]; + j++; + } + + /* ifft */ + for (j = 0; j < n_bands; j++) + { + sum.r = 0, sum.i = 0; + res.r = 0, res.i = 0; + for (k = 0; k < n_bands; k++) + { + res = cexpi((2 * M_PI * (LC3_FLOAT) (j * k)) / (LC3_FLOAT) n_bands); + res.r = res.r * buf[k]; + res.i = res.i * buf[k]; + sum = cadd(sum, res); + } + + res = cexpi((LC3_FLOAT) j * M_PI / (2.0 * (LC3_FLOAT) n_bands)); + out[j] = (sum.r * res.r - sum.i * res.i); + } + + out[0] = out[0] * 1.0001; + if (out[0] == 0) + { + out[0] = 1; + zero_float(&out[1], lpc_order); + } +} + +void processTdcPreemphasis_fl(LC3_FLOAT *in, LC3_FLOAT *pre_emph_factor, LC3_INT32 n_bands) +{ + LC3_INT32 i; + + for (i = 0; i < n_bands; i++) + { + in[i] = in[i] * (1.0 - 2.0 * (*pre_emph_factor) * LC3_COS(2.0 * M_PI * (0.5 + (LC3_FLOAT) i) / (2.0 * (LC3_FLOAT) n_bands)) + (*pre_emph_factor) * (*pre_emph_factor)); + } +} + +void processTdcLpcEstimation_fl(LC3_FLOAT *r, LC3_INT32 fs_idx, LC3_INT32 len, LC3_FLOAT *A, LC3_INT32 frame_dms) +{ + LC3_INT32 i; + const LC3_FLOAT *lpc_array; + + lpc_array = plc_tdc_lpc_all[fs_idx]; + + if (fs_idx == 0 && frame_dms == 25) + { + lpc_array = plc_tdc_lpc_8_25ms; + } + + /* r[0] = r[0] * 1 */ + for (i = 1; i < len; i++) + { + r[i] = r[i] * lpc_array[i]; + } + + TDC_levinson(r, len - 1, A); +} + +/** random + * + * Parameters: + * seed I/O: seed for random number + * + * Function: + * Signed 16 bits random generator. + * + * Returns: + * random number + */ +static LC3_INT16 TDC_random_short(LC3_INT16 *seed) +{ + *seed = (LC3_INT16) (*seed * 12821L + 16831L); + return(*seed); +} + +static LC3_FLOAT TDC_get_gainp( /* output: gain of pitch */ + const LC3_FLOAT x[], /* input : input signal */ + const LC3_FLOAT y[], /* input : shifted input signal */ + LC3_INT32 n /* input : vector length */ +) +{ + LC3_FLOAT corr, ener; + LC3_INT16 i; + + corr = 0; ener = 1e-6f; + + for (i = 0; i < n; i++) + { + corr += x[i]*y[i]; + ener += y[i]*y[i]; + } + + return(corr/ener); +} + +static LC3_FLOAT TDC_get_gainc( /* output: gain of code */ + const LC3_FLOAT x[], /* input : input signal */ + const LC3_FLOAT y[], /* input : shifted input signal */ + const LC3_FLOAT *gain_p, /* input : gain of pitch */ + const LC3_INT32 n, /* input : vector length */ + const LC3_INT32 frame_dms /* input : frame length in dms */ +) +{ + LC3_FLOAT gain_c; + LC3_FLOAT gain_c_max; + LC3_INT16 i; + + gain_c = 0; gain_c_max = 0; + + for (i = 0; i < n; i++) + { + gain_c += ( x[-i] - *gain_p * y[-i] ) * ( x[-i] - *gain_p * y[-i] ); + } + + if (frame_dms < 100) + { + for (i = 0; i < n; i++) + { + gain_c_max += (x[-i] * x[-i]); + } + gain_c = MIN(gain_c, gain_c_max); + } + + gain_c = (LC3_FLOAT)sqrt(gain_c / n ); + + return gain_c; +} + +static void TDC_highPassFiltering(const LC3_INT32 L_buffer, /* i: buffer length */ + LC3_FLOAT exc2[], /* i/o: unvoiced excitation before the high pass filtering */ + const LC3_FLOAT hp_filt[], /* i: high pass filter coefficients */ + const LC3_INT32 l_fir_fer) /* i: high pass filter length */ +{ + LC3_INT32 i; + + for( i=0 ; i< L_buffer; i++ ) { + exc2[i] = TDC_dotFLOAT(&exc2[i], hp_filt, l_fir_fer); + } +} + +static void TDC_LPC_synthesis( + const LC3_FLOAT a[], + LC3_FLOAT x[], + LC3_FLOAT y[], + LC3_INT32 l, + const LC3_FLOAT mem[], + LC3_INT32 lpcorder, + LC3_FLOAT *buf + ) +{ + LC3_FLOAT s, *yy; + LC3_INT32 i, j; + + /* copy initial filter states into synthesis buffer */ + for (i=0; i < lpcorder; i++) + { + buf[i] = mem[i]; + } + yy = &buf[i]; + + for (i = 0; i < l; i++) + { + s = x[i]; + for (j = 1; j <= lpcorder; j++) + { + s -= a[j] * yy[i- j]; + } + y[i] = s; + yy[i] = y[i]; + } + + return; +} + + +/** TDC_LPC_residu + * + * Parameters: + * a I: LP filter coefficients (Q12) + * x I: input signal (usually speech) + * y O: output signal (usually residual) + * l I: size of filtering + * lpcorder I: Order of LP filter + * + * Function: + * Compute the LP residual by filtering the input speech through A(z). + * + * Returns: + * void + */ +static void TDC_LPC_residu(const LC3_FLOAT *a, LC3_FLOAT *x, LC3_FLOAT *y, LC3_INT32 l, LC3_INT32 lpcorder) +{ + LC3_FLOAT s; + LC3_INT32 i, j; + + for (i = 0; i < l; i++) + { + s = x[i]; + for (j = 1; j <= lpcorder; j++) + { + s += a[j] * x[i - j]; + } + y[i] = s; + } + + return; +} + + +/** TDC_f_preemph + * + * Parameters: + * signal I/O: signal + * mu I: preemphasis factor + * L I: vector size + * mem I: memory (x[-1]) + * + * Function: + * Filtering through 1 - mu z^-1 + * + * + * Returns: + * void + */ + +static void TDC_f_preemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, LC3_FLOAT *mem) +{ + LC3_INT32 i; + + for (i = L - 1; i > 0; i--) + { + signal[i] = signal[i] - *mu * signal[i - 1]; + } + + signal[0] -= *mu * (*mem); + + return; +} + +/* + * TDC_deemph + * + * Parameters: + * signal I/O: signal + * mu I: deemphasis factor + * L I: vector size + * mem I: memory (signal[-1]) + * + * Function: + * Filtering through 1/(1-mu z^-1) + * Signal is divided by 2. + * + * Returns: + * void + */ +static void TDC_deemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, const LC3_FLOAT *mem) +{ + LC3_INT32 i; + + signal[0] = signal[0] + *mu * (*mem); + + for (i = 1; i < L; i++) + { + signal[i] = signal[i] + *mu * signal[i - 1]; + } + + return; +} + +static void TDC_copyFLOAT(const LC3_FLOAT * X, LC3_FLOAT * Z, LC3_INT32 n) +{ + /* no values to copy */ + if ( (n < 1) || (X == Z) ){ + return; + } + /* If overlapping */ + if ( ( (Z > X) && (Z < X+n) ) || ( (Z < X) && (X < Z+n) ) ) { + memmove(Z, X, sizeof(LC3_FLOAT)*n); + } + else{ + memcpy(Z, X, sizeof(LC3_FLOAT)*n); + } +} + +static LC3_FLOAT TDC_dotFLOAT(const LC3_FLOAT * X, const LC3_FLOAT * Y, LC3_INT32 n) +{ + LC3_FLOAT acc; + LC3_INT32 i; + + acc = 0; + if (n) { + acc = X[0]*Y[0]; + } + + for (i=1; i= 0; i--) + { + out[j] = buf[k] - g * buf2[i]; + j++; k++; + } + + v = v * (1.0 - g * g); + } + + move_float(buf, out, len); + out[0] = 1; + + j = 1; + for (i = len - 1; i >= 0; i--) + { + out[j] = -buf[i]; + j++; + } +} + diff --git a/lc3plus/plc_tdc_tdac.c b/lc3plus/plc_tdc_tdac.c new file mode 100755 index 0000000000..329361b14c --- /dev/null +++ b/lc3plus/plc_tdc_tdac.c @@ -0,0 +1,80 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processTdcTdac_fl(const LC3_FLOAT *synth_inp, const LC3_FLOAT *win, LC3_INT32 frame_length, LC3_INT32 la_zeroes, LC3_FLOAT *ola_mem) +{ + LC3_INT32 i, L, LD2, NZ, synth_len; + LC3_FLOAT synth[(MAX_LEN + MDCT_MEM_LEN_MAX)], *synth1, *synth2, *ola_mem1, *ola_mem2, sz; + const LC3_FLOAT *win1, *win2, *win3, *win4; + + assert(la_zeroes <= frame_length / 2); + + L = frame_length; + LD2 = L/2; + NZ = LD2 - la_zeroes; + synth_len = 2*L - la_zeroes; + + move_float(synth, synth_inp, synth_len); + + /* calculate x_ov[L+la_zeroes] ... x_ov[2*L-1] */ + win1 = &win[L + LD2 - 1]; + win2 = &win[L + LD2]; + + win3 = &win[LD2 - 1]; + win4 = &win[LD2]; + + synth1 = &synth[L + LD2 - 1 - la_zeroes]; + synth2 = &synth[L + LD2 - la_zeroes]; + + ola_mem1 = &ola_mem[LD2 - la_zeroes]; + ola_mem2 = &ola_mem[LD2 - la_zeroes - 1]; + + for (i = 0; i < NZ; i++) + { + /* analysis windowing + 2N -> N */ + sz = *synth1 * *win1 + *synth2 * *win2; + + /* N -> 2N + synthesis windowing */ + *ola_mem1 = sz * *win3; + *ola_mem2 = sz * *win4; + + /* pointer update */ + win1--; + win2++; + win3--; + win4++; + synth1--; + synth2++; + ola_mem1++; + ola_mem2--; + } + + for (; i < LD2; i++) + { + /* analysis windowing + 2N -> N */ + sz = *synth1 * *win1; + + /* N -> 2N + synthesis windowing */ + *ola_mem1 = sz * *win3; + + /* pointer update */ + win1--; + win2++; + win3--; + synth1--; + synth2++; + ola_mem1++; + } +} + diff --git a/lc3plus/plc_update.c b/lc3plus/plc_update.c new file mode 100755 index 0000000000..a151420eb7 --- /dev/null +++ b/lc3plus/plc_update.c @@ -0,0 +1,125 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + +#include "functions.h" +#include "options.h" + + +void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, + LC3_INT32 *nbLostCmpt, LC3_FLOAT *cum_alpha, LC3_INT32 bfi, LC3_INT32 *prevBfi, LC3_INT32 *prevprevBfi) +{ + LC3_FLOAT tmp[MAX_LEN_PCM_PLC]; + + move_float(tmp, &PlcAdvSetup->pcmbufHist[frame_length], PlcAdvSetup->max_len_pcm_plc - frame_length); + move_float(&PlcAdvSetup->pcmbufHist[0], tmp, PlcAdvSetup->max_len_pcm_plc - frame_length); + move_float(&PlcAdvSetup->pcmbufHist[PlcAdvSetup->max_len_pcm_plc - frame_length], syntM, frame_length); + + if (bfi != 1) + { + *nbLostCmpt = 0; + *cum_alpha = 1; + + if (PlcAdvSetup) + { + move_float(PlcAdvSetup->scf_q_old_old, PlcAdvSetup->scf_q_old, M); + move_float(PlcAdvSetup->scf_q_old, scf_q, M); + /* PLC fullband transient detector setting for non-bfi frames */ + PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev = 0; /* fullband transient not active */ + } + } + + *prevprevBfi = *prevBfi; + *prevBfi = bfi; +} + +void plc_phEcu_processPLCspec2shape(LC3_INT16 prev_bfi, LC3_INT16 bfi, LC3_FLOAT q_d[], LC3_INT32 yLen, + LC3_FLOAT *stPhECU_oold_grp_shape, LC3_FLOAT *stPhECU_old_grp_shape) +{ + LC3_INT32 i, j, N_grp; + LC3_INT32 local_prev_bfi; + LC3_INT32 fs_idx; + LC3_FLOAT E_tot = 0.0; + LC3_INT32 l_grp; + LC3_FLOAT *pX; + + if (bfi != 1) /* compute only for bfi== 0 or 2 */ + { + fs_idx = (LC3_INT32)floor(yLen / 100); + assert(fs_idx < 5); + N_grp = xavg_N_grp[fs_idx]; + + local_prev_bfi = prev_bfi; + if (local_prev_bfi == 2) { + local_prev_bfi = 0; + } + + + /* Copy old to oold grp shape */ + for (i = 0; i < MAX_LGW; i++) + { + stPhECU_oold_grp_shape[i] = stPhECU_old_grp_shape[i]; + } + + /* Accumulate DC-coupled bins to total */ + E_tot = 0; + pX = q_d; /* ptr setup */ + for (i = 0; i < mdct_grp_bins[0]; i++) + { + E_tot += sqrf( *pX ); + pX++; + } + + /* Accumulate middle grps and add to total */ + for (i = 0; i < (N_grp - 1); i++) + { + l_grp = mdct_grp_bins[i + 1] - mdct_grp_bins[i]; ; + stPhECU_old_grp_shape[i] = 0.0; + for (j = 0; j < l_grp; j++) { + stPhECU_old_grp_shape[i] += sqrf( *pX ); + pX++; + } + E_tot += stPhECU_old_grp_shape[i]; + } + + /* Accumulate last subbband and add to total */ + stPhECU_old_grp_shape[(N_grp - 1)] = 0.0; + l_grp = mdct_grp_bins[N_grp] - mdct_grp_bins[N_grp - 1] - mdct_grp_bins[0]; + assert( (mdct_grp_bins[N_grp] - mdct_grp_bins[0]) <= yLen); + for (j = 0; j < l_grp; j++) + { + stPhECU_old_grp_shape[(N_grp - 1)] += sqrf( *pX ); + pX++; + } + E_tot += stPhECU_old_grp_shape[(N_grp - 1)]; + + + /* Normalize shape */ + for (i = 0; i < (N_grp); i++) { + if (E_tot > 0.0) { + stPhECU_old_grp_shape[i] /= E_tot; + } + else + { + stPhECU_old_grp_shape[i] = 0.0; + } + } + if (local_prev_bfi == 1) { + for (i = 0; i < MAX_LGW; i++) { + stPhECU_oold_grp_shape[i] = stPhECU_old_grp_shape[i]; + } + } + }/*bfi*/ + return; +} + +void processPlcUpdateSpec_fl(LC3_FLOAT *q_d_prev, LC3_FLOAT *q_d_fl_c, LC3_INT32 yLen) +{ + move_float(q_d_prev, q_d_fl_c, yLen); +} + diff --git a/lc3plus/quantize_spec.c b/lc3plus/quantize_spec.c new file mode 100755 index 0000000000..7886b4586d --- /dev/null +++ b/lc3plus/quantize_spec.c @@ -0,0 +1,196 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static LC3_INT sign(LC3_FLOAT x); + +LC3_INT sign(LC3_FLOAT x) +{ + if (x > 0) + return 1; + + if (x < 0) + return -1; + + return 0; +} + +void processQuantizeSpec_fl(LC3_FLOAT x[], LC3_FLOAT gain, LC3_INT xq[], LC3_INT nt, LC3_INT totalBits, LC3_INT* nbits, LC3_INT* nbits2, LC3_INT fs, + LC3_INT* lastnzout, LC3_INT* codingdata, LC3_INT* lsbMode, LC3_INT mode, LC3_INT target, LC3_INT hrmode) +{ + + LC3_INT rateFlag = 0, i = 0, lastnz2 = 0, m = 0, maxlev = 0, k = 0; + LC3_INT nbits_lsb = 0; + LC3_INT c = 0; + LC3_INT a = 0, b = 0, lev1 = 0, sym = 0, t = 0, pki = 0; + LC3_INT a1_msb = 0, b1_msb = 0; + LC3_INT lastnz = 1; + LC3_FLOAT offset = 0.375; + + if (hrmode) + { + offset = 0.5; + } + + + /* Quantization */ + for (i = 0; i < nt; i++) { + xq[i] = trunc(x[i] / gain + offset * sign(x[i])); + if (hrmode == 0) { + assert(xq[i] <= 32767 && xq[i] >= -32768); + } + } + + /* Rate flag */ + + if ((fs < 48000 && totalBits > 320 + (fs / 8000 - 2) * 160) || (fs == 48000 && totalBits > 800)) { + rateFlag = 512; + } + + /* Init */ + if (mode == 0 && ((fs < 48000 && totalBits >= 640 + (fs / 8000 - 2) * 160) || (fs == 48000 && totalBits >= 1120))) { + mode = 1; + } + + /* Last non-zero 2-tuple */ + + for (i = nt - 2; i >= 2; i = i - 2) { + if (xq[i + 1] != 0 || xq[i] != 0) { + lastnz = i + 1; + break; + } + } + + + if (mode < 0) { + lastnz2 = lastnz + 1; + } else { + lastnz2 = 2; + } + + *nbits = 0; + *nbits2 = 0; + + /* Calculate number of estimated bits */ + + for (k = 0; k < lastnz; k = k + 2) { + t = c + rateFlag; + if (k > nt / 2) { + t += 256; + } + + codingdata[0] = t; + + a = abs(xq[k]); + b = abs(xq[k + 1]); + m = MAX(a, b); + + if (m == 0) { + maxlev = -1; + } else { + maxlev = 29 - (clz_func(MAX(m, 3)) - 1); + } + + codingdata[1] = maxlev; + + if (mode <= 0) { + *nbits = *nbits + MIN(a, 1) * 2048; + *nbits = *nbits + MIN(b, 1) * 2048; + } + + lev1 = 0; + + while (MAX(a, b) >= 4) { + pki = ari_spec_lookup_fl[t + lev1 * 1024]; + *nbits = *nbits + ari_spec_bits_fl[pki][16]; + + if (lev1 == 0 && mode > 0) { + nbits_lsb += 2; + } else { + *nbits = *nbits + 2 * 2048; + } + + a = a >> 1; + b = b >> 1; + lev1 = MIN(lev1 + 1, 3); + } + + pki = ari_spec_lookup_fl[t + lev1 * 1024]; + sym = a + 4 * b; + codingdata[2] = sym; + codingdata += 3; + *nbits = *nbits + ari_spec_bits_fl[pki][sym]; + + if (mode > 0) { + a1_msb = abs(xq[k]); + b1_msb = abs(xq[k + 1]); + + if (lev1 > 0) { + a1_msb = a1_msb >> 1; + b1_msb = b1_msb >> 1; + + if (a1_msb == 0 && xq[k] != 0) { + nbits_lsb++; + } + + if (b1_msb == 0 && xq[k + 1] != 0) { + nbits_lsb++; + } + } + + *nbits = *nbits + MIN(a1_msb, 1) * 2048; + *nbits = *nbits + MIN(b1_msb, 1) * 2048; + } + + if (mode >= 0 && (abs(xq[k]) != 0 || abs(xq[k + 1]) != 0) && *nbits <= target * 2048) { + lastnz2 = k + 2; + *nbits2 = *nbits; + } + + lev1 = lev1 - 1; + if (lev1 <= 0) { + t = 1 + (a + b) * (lev1 + 2); + } else { + t = 13 + lev1; + } + + c = (c & 15) * 16 + t; + } + + /* Number of bits */ + *nbits = ceil((LC3_FLOAT)*nbits / 2048.0); + + if (mode >= 0) { + *nbits2 = ceil((LC3_FLOAT)*nbits2 / 2048.0); + } else { + *nbits2 = *nbits; + } + + if (mode > 0) { + *nbits += nbits_lsb; + *nbits2 += nbits_lsb; + } + + /* Truncation of high-frequency coefficients */ + for (i = lastnz2; i <= lastnz; i++) { + xq[i] = 0; + } + + /* Truncation of LSBs */ + if (mode > 0 && *nbits > target) { + *lsbMode = 1; + } else { + *lsbMode = 0; + } + + *lastnzout = lastnz2; +} diff --git a/lc3plus/reorder_bitstream.c b/lc3plus/reorder_bitstream.c new file mode 100755 index 0000000000..77b50d7a13 --- /dev/null +++ b/lc3plus/reorder_bitstream.c @@ -0,0 +1,41 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processReorderBitstream_fl(LC3_UINT8* bytes, LC3_INT32 n_pccw, LC3_INT32 n_pc, LC3_INT32 b_left, LC3_INT32 len) +{ + LC3_UINT8 bytes_local[MAX_NBYTES2]; + LC3_INT32 i, block_bytes; + + assert(b_left > 0); + + memcpy(bytes_local, bytes, len * sizeof(LC3_UINT8)); + + if (n_pccw == 0) + { + return; + } + + block_bytes = ceil((LC3_FLOAT) n_pc / 2.0); + + for (i = 0; i < block_bytes; i++) + { + bytes[i] = bytes_local[b_left + i]; + } + + for (i = 0; i < b_left; i++) + { + bytes[block_bytes + i] = bytes_local[i]; + } +} + diff --git a/lc3plus/resamp12k8.c b/lc3plus/resamp12k8.c new file mode 100755 index 0000000000..0cab5daae9 --- /dev/null +++ b/lc3plus/resamp12k8.c @@ -0,0 +1,107 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], + LC3_INT mem_out_len, LC3_FLOAT y[], LC3_INT* y_len, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT fs) +{ + + + LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0; + LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0}; + LC3_INT32 index_int, index_frac, resamp_upfac, resamp_delay, resamp_off_int, resamp_off_frac; + LC3_FLOAT u_11, u_21, u_1, u_2; + + const LC3_FLOAT *filter; + const LC3_FLOAT *filt_input, *filt_coeff; + + + switch (frame_dms) + { + case 25: + len_12k8 = LEN_12K8 / 4; + break; + case 50: + len_12k8 = LEN_12K8 / 2; + break; + case 100: + len_12k8 = LEN_12K8; + break; + } + + *y_len = len_12k8; + N12k8 = x_len * 12800 / fs; + + /* Init Input Buffer */ + memmove(buf, mem_in, mem_in_len * sizeof(LC3_FLOAT)); + memmove(&buf[mem_in_len], x, x_len * sizeof(LC3_FLOAT)); + memmove(mem_in, &buf[x_len], mem_in_len * sizeof(LC3_FLOAT)); + + + + filter = lp_filter[fs_idx]; + + /* Upsampling & Low-pass Filtering & Downsampling */ + + index_int = 1; + index_frac = 0; + resamp_upfac = resamp_params[fs_idx][0]; + resamp_delay = resamp_params[fs_idx][1]; + resamp_off_int = resamp_params[fs_idx][2]; + resamp_off_frac = resamp_params[fs_idx][3]; + + k = 0; + for (i = 0; i < N12k8; i++) { + + filt_input = &buf[index_int]; + filt_coeff = &filter[index_frac * resamp_delay * 2]; + + mac = mac_loop(filt_input, filt_coeff, (2 * resamp_delay)); + + bufdown[k++] = mac; + + index_int = index_int + resamp_off_int; + index_frac = index_frac + resamp_off_frac; + + if ((resamp_upfac - index_frac) <= 0) + { + index_int = index_int + 1; + index_frac = index_frac - resamp_upfac; + } + } + + + /* 50Hz High-Pass */ + u_11 = mem_50[0]; + u_21 = mem_50[1]; + + for (i = 0; i < len_12k8; i++) { + LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); + u_1 = (highpass50_filt_b[1] * bufdown[i] + u_21) - highpass50_filt_a[1] * y1; + u_2 = highpass50_filt_b[2] * bufdown[i] - highpass50_filt_a[2] * y1; + u_11 = u_1; + u_21 = u_2; + bufdown[i] = (LC3_FLOAT)y1; + } + + mem_50[0] = (LC3_FLOAT)u_11; + mem_50[1] = (LC3_FLOAT)u_21; + + /* Output Buffer */ + memmove(buf_out, mem_out, mem_out_len * sizeof(LC3_FLOAT)); + + memmove(&buf_out[mem_out_len], bufdown, len_12k8 * sizeof(LC3_FLOAT)); + + memmove(y, buf_out, (*y_len + 1) * sizeof(LC3_FLOAT)); + + memmove(mem_out, &buf_out[N12k8], mem_out_len * sizeof(LC3_FLOAT)); +} diff --git a/lc3plus/residual_coding.c b/lc3plus/residual_coding.c new file mode 100755 index 0000000000..42094d275f --- /dev/null +++ b/lc3plus/residual_coding.c @@ -0,0 +1,76 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits + , LC3_INT hrmode +) +{ + LC3_INT n = 0, m = 0, k = 0; + LC3_INT iter=0; + LC3_FLOAT offset; + LC3_INT iter_max = 1; + LC3_INT nz_idx[MAX_LEN] = {0}; + LC3_INT N_nz = 0, idx = 0; + + + memset(resBits, 0, MAX_RESBITS_LEN); + + m = targetBits - nBits + 4; + if (hrmode) + { + m += 10; + } + + assert(m <= MAX_RESBITS); + + offset = .25; + if (hrmode) + { + iter_max = EXT_RES_ITER_MAX; + + } + for (k = 0; k < L_spec; k ++) + { + if (xq[k]) + { + nz_idx[N_nz ++] = k; + } + } + while (iter < iter_max && n < m) + { + k = 0; + while (k < N_nz && n < m) + { + idx = nz_idx[k]; + + if (x[idx] >= (LC3_FLOAT)xq[idx] * gain) + { + resBits[n >> 3] |= 1 << (n & 7); + x[idx] -= gain * offset; + } + else + { + resBits[n >> 3] &= ~(1 << (n & 7)); + x[idx] += gain * offset; + } + + n++; + + k++; + } + iter ++; + offset *= .5; + } + + *numResBits = n; +} diff --git a/lc3plus/residual_decoding.c b/lc3plus/residual_decoding.c new file mode 100755 index 0000000000..97fd94afc3 --- /dev/null +++ b/lc3plus/residual_decoding.c @@ -0,0 +1,97 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits + , LC3_INT hrmode +) +{ + LC3_INT k = 0, n = 0; + LC3_FLOAT offset1 = 0, offset2 = 0; + LC3_FLOAT offset = 0; + LC3_INT nz_idx[MAX_LEN] = {0}; + LC3_INT N_nz = 0, idx = 0; + + LC3_INT iter = 0, iter_max = 1; + + if (hrmode) + { + iter_max = EXT_RES_ITER_MAX; + offset = offset1 = offset2 = 0.25; + } + else + { + offset1 = 0.1875; + offset2 = 0.3125; + } + + if (hrmode) + { + /* enumerat non-zero coefficients */ + for (k = 0; k < L_spec; k ++) + { + if (x[k]) + { + nz_idx[N_nz ++] = k; + } + } + /* apply residual corrections */ + while (n < resQBits && iter < iter_max) + { + for (k = 0; k < N_nz; k ++) + { + idx = nz_idx[k]; + + if ((prm[n >> 3] & 1 << (n & 7)) == 0) + { + x[idx] -= offset; + } + else + { + + x[idx] += offset; + } + if (++n >= resQBits) + { + break; + } + } + offset /= 2; + iter ++; + } + } + else + { + while (k < L_spec && n < resQBits) { + if (x[k] != 0) { + if ((prm[n >> 3] & 1 << (n & 7)) == 0) + { + if (x[k] > 0) { + x[k] -= offset1; + } else { + x[k] -= offset2; + } + } else { + if (x[k] > 0) { + x[k] += offset2; + } else { + x[k] += offset1; + } + } + n++; + } + + k++; + } + } + *bitsRead = n; +} diff --git a/lc3plus/setup_com_lc3.c b/lc3plus/setup_com_lc3.c new file mode 100755 index 0000000000..17054d1ffc --- /dev/null +++ b/lc3plus/setup_com_lc3.c @@ -0,0 +1,30 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + +#include "functions.h" +#include "options.h" + +LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) +{ + LC3_FLOAT max; + LC3_INT32 i; + + max = LC3_FABS(in[0]); + + for (i = 0; i < len; i++) + { + if (LC3_FABS(in[i]) > LC3_FABS(max)) + { + max = LC3_FABS(in[i]); + } + } + + return max; +} + diff --git a/lc3plus/setup_dec_lc3.c b/lc3plus/setup_dec_lc3.c new file mode 100755 index 0000000000..c14309720e --- /dev/null +++ b/lc3plus/setup_dec_lc3.c @@ -0,0 +1,444 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "setup_dec_lc3.h" +#include "functions.h" +#include +#include + +/* if decoder is null only size is reported */ +# include "fft/iis_fft.h" + +int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels) +{ + int ch = 0; + size_t size = sizeof(LC3PLUS_Dec); + size_t frame_len = DYN_MAX_LEN_EXT(samplerate); + + void *PlcAdvSetup = NULL; + LC3_FLOAT *pcmbufHist, *harmonicBuf; + LC3_FLOAT *PhECU_oold_grp_shape, *PhECU_old_grp_shape; + LC3_FLOAT *PhECU_xfp; + Complex *PhECU_X_sav_m; + LC3_INT32 *PhECU_plocs; + LC3_FLOAT *PhECU_f0est, *PhECU_mag_chg_1st, *PhECU_Xavg; + LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu; + HANDLE_IIS_FFT handle_fft_phaseecu; + HANDLE_IIS_FFT handle_ifft_phaseecu; + LC3_FLOAT *q_old_res; + + for (ch = 0; ch < channels; ch++) { + DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); + + size_t max_pitch = ceilf(228.0 * CODEC_FS(samplerate) / 12800.0); + size_t pcm_plc_len = max_pitch + frame_len; + pcmbufHist = balloc(decoder, &size, sizeof(LC3_FLOAT) * pcm_plc_len); + harmonicBuf = balloc(decoder, &size, sizeof(LC3_FLOAT) * max_pitch); + PlcAdvSetup = balloc(decoder, &size, sizeof(*setup->PlcAdvSetup)); + PhECU_oold_grp_shape = balloc(decoder, &size, sizeof(LC3_FLOAT) *MAX_LGW); /* BASOP Word16 PhECU_oold_grp_shape_fx[MAX_LGW]; */ + PhECU_old_grp_shape = balloc(decoder, &size, sizeof(LC3_FLOAT) *MAX_LGW); /* BASOP Word16 PhECU_old_grp_shape_fx[MAX_LGW] ; */ + PhECU_xfp = balloc(decoder, &size, sizeof(LC3_FLOAT) *(frame_len * 16 / 10)); + PhECU_X_sav_m = balloc(decoder, &size, sizeof(Complex) *(((frame_len * 16 / 10) / 2) + 1));/*MAX_PLC_LMSPEC*/ + PhECU_plocs = balloc(decoder, &size, sizeof(LC3_INT32) * (((frame_len * 16 / 10) / 4) + 1 + 1)); /* BASOP Word16 *PhECU_plocs; */ + + handle_fft_phaseecu = balloc(decoder, &size, sizeof(IIS_FFT) * 1); + handle_ifft_phaseecu = balloc(decoder, &size, sizeof(IIS_FFT) * 1); + PhECU_f0est = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((frame_len * 16 / 10) / 4) + 1)); /*BASOP Word32 *PhECU_f0est;*/ + PhECU_mag_chg_1st = balloc(decoder, &size, sizeof(LC3_FLOAT) *MAX_LGW); /* BASOP Word16 PhECU_mag_chg_1st[MAX_LGW];*/ + PhECU_Xavg = balloc(decoder, &size, sizeof(LC3_FLOAT) * MAX_LGW); /* BASOP Word16 PhECU_Xavg[MAX_LGW] ; */ + + sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); + sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); + + q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); + + if (decoder) { + decoder->channel_setup[ch] = setup; + + setup->PlcAdvSetup = PlcAdvSetup; + + setup->PlcAdvSetup->pcmbufHist = pcmbufHist; + setup->PlcAdvSetup->PlcTdcSetup.harmonicBuf = harmonicBuf; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape = PhECU_oold_grp_shape; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape = PhECU_old_grp_shape; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp = PhECU_xfp; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_X_sav_m = PhECU_X_sav_m; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_plocs = PhECU_plocs; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_f0est = PhECU_f0est; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_mag_chg_1st = PhECU_mag_chg_1st; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Xavg = PhECU_Xavg; + setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu = handle_fft_phaseecu; + setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu = handle_ifft_phaseecu; + + setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu->sine_table = sine_table1_phecu; + setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu->sine_table = sine_table2_phecu; + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot = (CODEC_FS(samplerate) * 16) / 1000; + real_fft_init(&(setup->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft), setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot, &(setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu)); + real_ifft_init(&(setup->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft), setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot, &(setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu)); + setup->statePC.q_old_res = q_old_res; + } + } + + return (int)size; +} + +LC3PLUS_Error FillDecSetup(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode + , int hrmode +) +{ + memset(decoder, 0, lc3plus_dec_get_size(samplerate, channels)); + alloc_decoder(decoder, samplerate, channels); + + decoder->fs = CODEC_FS(samplerate); + decoder->fs_out = samplerate; + decoder->fs_idx = FS2FS_IDX(decoder->fs); + decoder->plcMeth = plc_mode; + + decoder->hrmode = hrmode != 0; + + if (decoder->fs_idx > 4) { + decoder->fs_idx = 5; + } + decoder->channels = channels; + decoder->frame_ms = 10; + decoder->frame_dms = 100; + decoder->BW_cutoff_bits = BW_cutoff_bits_all[decoder->fs_idx]; + + if (decoder->fs == 8000) { + decoder->tilt = 14; + } else if (decoder->fs == 16000) { + decoder->tilt = 18; + } else if (decoder->fs == 24000) { + decoder->tilt = 22; + } else if (decoder->fs == 32000) { + decoder->tilt = 26; + } else if (decoder->fs == 48000) { + decoder->tilt = 30; + } + else if (decoder->fs == 96000) { + decoder->tilt = 34; + } + + set_dec_frame_params(decoder); + + lc3plus_dec_set_ep_enabled(decoder, 0); + + return LC3PLUS_OK; +} + +/* set frame config params */ +void set_dec_frame_params(LC3PLUS_Dec* decoder) +{ + int ch = 0; + + if (decoder->fs_idx == 5) + { + decoder->hrmode = 1; + } + + decoder->frame_length = ceil(decoder->fs * 10 / 1000); /* fs * 0.01*2^6 */ + if (decoder->hrmode == 1) + { + decoder->yLen = decoder->frame_length; + } + else + { + decoder->yLen = MIN(MAX_BW, decoder->frame_length); + } + + decoder->bands_number = 64; + if (decoder->frame_ms == 2.5) + { + decoder->frame_length = decoder->frame_length >> 2; + decoder->yLen /= 4; + if (decoder->hrmode) + { + decoder->bands_number = bands_number_2_5ms_HR[decoder->fs_idx]; + } + else + { + decoder->bands_number = bands_number_2_5ms[decoder->fs_idx]; + } + } + if (decoder->frame_ms == 5) + { + decoder->frame_length = decoder->frame_length >> 1; + decoder->yLen /= 2; + decoder->bands_number = bands_number_5ms[decoder->fs_idx]; + } + + if (decoder->hrmode) + { + decoder->BW_cutoff_bits = 0; + } + else + { + decoder->BW_cutoff_bits = BW_cutoff_bits_all[decoder->fs_idx]; + } + + if (decoder->frame_ms == 10) + { + if (decoder->hrmode) + { + decoder->bands_offset = ACC_COEFF_PER_BAND_HR[decoder->fs_idx]; + } + else + { + decoder->bands_offset = ACC_COEFF_PER_BAND[decoder->fs_idx]; + } + decoder->cutoffBins = BW_cutoff_bin_all; + } + else if (decoder->frame_ms == 2.5) + { + if (decoder->hrmode) + { + decoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms_HR[decoder->fs_idx]; + } + else + { + decoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms[decoder->fs_idx]; + } + decoder->cutoffBins = BW_cutoff_bin_all_2_5ms; + } + else if (decoder->frame_ms == 5) + { + if (decoder->hrmode) + { + decoder->bands_offset = ACC_COEFF_PER_BAND_5ms_HR[decoder->fs_idx]; + } + else + { + decoder->bands_offset = ACC_COEFF_PER_BAND_5ms[decoder->fs_idx]; + } + decoder->cutoffBins = BW_cutoff_bin_all_5ms; + } + + decoder->n_bandsPLC = MIN(decoder->frame_length, 80); + + if (decoder->frame_ms == 10) + { + decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC[decoder->fs_idx]; + } + else if (decoder->frame_ms == 5) + { + decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC_5ms[decoder->fs_idx]; + + if (decoder->fs == 24000) + { + decoder->n_bandsPLC = 40; + } + } + else if (decoder->frame_ms == 2.5) + { + decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC_2_5ms[decoder->fs_idx]; + + if (decoder->fs == 48000) + { + decoder->n_bandsPLC = 60; + } + } + assert(decoder->bands_offsetPLC); + + if (decoder->frame_ms == 10) { + decoder->imdct_win = MDCT_WINS_10ms[decoder->hrmode][decoder->fs_idx]; + decoder->imdct_laZeros = MDCT_la_zeroes[decoder->fs_idx]; + decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_10ms[decoder->fs_idx]; + } + else if (decoder->frame_ms == 2.5) { + decoder->imdct_win = MDCT_WINS_2_5ms[decoder->hrmode][decoder->fs_idx]; + decoder->imdct_laZeros = MDCT_la_zeroes_2_5ms[decoder->fs_idx]; + decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_2_5ms[decoder->fs_idx]; + } + else if (decoder->frame_ms == 5) { + decoder->imdct_win = MDCT_WINS_5ms[decoder->hrmode][decoder->fs_idx]; + decoder->imdct_laZeros = MDCT_la_zeroes_5ms[decoder->fs_idx]; + decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_5ms[decoder->fs_idx]; + } + + decoder->la_zeroes = decoder->imdct_laZeros; + + decoder->imdct_memLen = decoder->frame_length - decoder->imdct_laZeros; + + for (ch = 0; ch < decoder->channels; ch++) { + DecSetup* setup = decoder->channel_setup[ch]; + + setup->ltpf_mem_beta_idx = -1; + + setup->statePC.seed = 24607; + + if (decoder) { + /* Init DCT4 structs */ + if (setup->dct4structImdct.length != 0) { + dct4_free(&setup->dct4structImdct); + dct4_init(&setup->dct4structImdct, decoder->frame_length); + } else { + dct4_init(&setup->dct4structImdct, decoder->frame_length); + } + + setup->PlcNsSetup.cum_alpha = 1; + setup->PlcNsSetup.seed = 24607; + setup->alpha = 1; + if (setup->PlcAdvSetup) + { + LC3_INT32 pitch_max = 0, pitch_ana_len = 0, tdc_synt_len = 0; + pitch_max = ceil(228.0 * (LC3_FLOAT) decoder->fs / 12800.0); + pitch_ana_len = pitch_max + decoder->frame_length * (LC3_FLOAT) 100 / decoder->frame_dms; + tdc_synt_len = 16 + 1 + pitch_max + ceil(decoder->frame_length / 2); + setup->PlcAdvSetup->max_len_pcm_plc = MAX(pitch_ana_len, tdc_synt_len); + setup->PlcAdvSetup->PlcTdcSetup.preemphFac = plc_preemph_fac[decoder->fs_idx]; + setup->PlcAdvSetup->PlcTdcSetup.seed = 24607; + setup->PlcAdvSetup->PlcTdcSetup.lpcorder = 16; + + if (decoder->fs_idx == 0 && decoder->frame_dms == 25) + { + setup->PlcAdvSetup->PlcTdcSetup.lpcorder = 8; + } + + setup->PlcAdvSetup->stabFac = 1; + setup->PlcAdvSetup->cum_fading_fast = 1; + setup->PlcAdvSetup->cum_fading_slow = 1; + setup->PlcAdvSetup->cum_fflcAtten = 1; + + if (decoder->fs_idx <= 4 && decoder->frame_dms == 100) + { + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot = (decoder->fs * 16) / 1000; /* 16 ms of samples at fs*/ + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_f0hzLtpBin = 0; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_norm_corr = 0; + + set_vec(PHECU_GRP_SHAPE_INIT, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape, MAX_LGW); + set_vec(PHECU_GRP_SHAPE_INIT, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape, MAX_LGW); + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E = (LC3_FLOAT)PHECU_LTOT_MIN_MAN * LC3_POW(2.0, PHECU_LTOT_MIN_EXP - 31); + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E = (LC3_FLOAT)PHECU_LTOT_MIN_MAN * LC3_POW(2.0, PHECU_LTOT_MIN_EXP - 31); + + /* CFL uses separate buffers for pcmHist, xfp and Xsav and q_d , BASOP uses an optimized joint buffer*/ + zero_float(setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot); + zero_cmplx(setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_X_sav_m, (setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot/2 + 1)); + + set_vec(POS_ONE_Q15, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_mag_chg_1st, MAX_LGW); + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_beta_mute = (16384.0/32768.0); + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_seed = 21845; + + assert(decoder->frame_dms == 100); + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_LDWIN_OLAP = (decoder->frame_length / 4 ); /* 2.5 ms for regular 10 ms MDCT */ + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_t_adv = ( + decoder->frame_length + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_LDWIN_OLAP )/ 2; + } + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev = 0; /* fullband transient */ + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_num_plocs = 0; + } + } + } +} + +LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) +{ + int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0; + DecSetup* setup; + + if (decoder->hrmode) + { + switch (decoder->frame_dms) + { + case 25: + maxBytes = 210; + minBytes = MIN_NBYTES; + break; + case 50: + maxBytes = 375; + minBytes = MIN_NBYTES; + break; + case 100: + maxBytes = 625; + minBytes = MIN_NBYTES; + break; + default: + return LC3PLUS_HRMODE_ERROR; + } + } + else + { + minBytes = MIN_NBYTES; + maxBytes = MAX_NBYTES_100; // for backward compatibility, MAX_NBYTES_100 is used for all frame lengths + } + + channel_bytes = nBytes; + + setup = decoder->channel_setup[ch]; + + if (channel_bytes < minBytes || channel_bytes > maxBytes) + { + return LC3PLUS_NUMBYTES_ERROR; + } + + setup->targetBytes = channel_bytes; + setup->total_bits = setup->targetBytes << 3; + setup->enable_lpc_weighting = (setup->total_bits < 480); + setup->quantizedGainOff = + -(MIN(115, setup->total_bits / (10 * (decoder->fs_idx + 1))) + 105 + 5 * (decoder->fs_idx + 1)); + + if (decoder->hrmode && decoder->fs_idx == 5) + { + setup->quantizedGainOff = MAX(setup->quantizedGainOff, -181); + } + + totalBits = setup->total_bits; + + if (decoder->frame_ms == 2.5) { + setup->enable_lpc_weighting = setup->total_bits < 120; + totalBits = setup->total_bits * 4.0 * (1.0 - 0.4); + } + if (decoder->frame_ms == 5) { + setup->enable_lpc_weighting = (setup->total_bits < 240); + totalBits = setup->total_bits * 2 - 160; + } + + if (decoder->frame_length > 40 * ((LC3_FLOAT) (decoder->frame_dms) / 10.0)) { + setup->N_red_tns = 40 * ((LC3_FLOAT) (decoder->frame_dms) / 10.0); + setup->fs_red_tns = 40000; + } else { + setup->N_red_tns = decoder->frame_length; + setup->fs_red_tns = decoder->fs; + } + + bitsTmp = totalBits; + + if (bitsTmp < 400 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.4; + setup->ltpf_conf_beta_idx = 0; + } else if (bitsTmp < 480 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.35; + setup->ltpf_conf_beta_idx = 1; + } else if (bitsTmp < 560 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.3; + setup->ltpf_conf_beta_idx = 2; + } else if (bitsTmp < 640 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.25; + setup->ltpf_conf_beta_idx = 3; + } else { + setup->ltpf_conf_beta = 0; + setup->ltpf_conf_beta_idx = -1; + } + + /* No LTPF in hrmode */ + if (decoder->hrmode == 1) { + setup->ltpf_conf_beta = 0; + setup->ltpf_conf_beta_idx = -1; + } + + return LC3PLUS_OK; +} diff --git a/lc3plus/setup_dec_lc3.h b/lc3plus/setup_dec_lc3.h new file mode 100755 index 0000000000..6ed0f438ea --- /dev/null +++ b/lc3plus/setup_dec_lc3.h @@ -0,0 +1,112 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef SETUP_DEC_LC3_FL_H +#define SETUP_DEC_LC3_FL_H + +#include "constants.h" + +/* Channel state and bitrate-derived values go in this struct */ +typedef struct { + LC3_INT* stDec_ola_mem_fx; /* MDCT_MEM_LEN_MAX */ + LC3_INT total_bits; + LC3_INT enable_lpc_weighting; + LC3_INT targetBytes; + LC3_INT quantizedGainOff; + LC3_INT ltpf_param[3]; + LC3_INT ltpf_param_mem[3]; + LC3_INT ltpf_mem_pitch; + LC3_INT ltpf_mem_active; + LC3_INT ltpf_mem_pitch_fr; + LC3_INT ltpf_mem_beta_idx; + LC3_INT ltpf_conf_beta_idx; + LC3_INT spec_inv_idx; + LC3_INT concealMethod; + LC3_INT last_size; + LC3_INT BW_cutoff_idx_nf; + LC3_INT prev_BW_cutoff_idx_nf; + LC3_INT fs_red_tns; + LC3_INT N_red_tns; + LC3_INT scf_idx[SCF_MAX_PARAM]; + uint8_t resBits[MAX_RESBITS_LEN]; + LC3_INT tns_idx[TNS_NUMFILTERS_MAX * MAXLAG]; + + LC3_FLOAT prev_fac_ns; + LC3_FLOAT ltpf_mem_x[3 * MAX_LEN]; + LC3_FLOAT ltpf_mem_y[3 * MAX_LEN]; + LC3_FLOAT ltpf_mem_gain; + LC3_FLOAT ltpf_conf_beta; + LC3_FLOAT sqQdec_fl[MAX_LEN]; + LC3_FLOAT scf_q[M]; + LC3_FLOAT int_scf[MAX_BANDS_NUMBER]; + LC3_FLOAT x_fl[MAX_LEN]; + LC3_FLOAT imdct_mem[MAX_LEN]; + LC3_FLOAT alpha; + + Dct4 dct4structImdct; + + PlcSetup PlcSetup; + PlcNsSetup PlcNsSetup; + + pcState statePC; + PlcAdvSetup* PlcAdvSetup; +} DecSetup; + +/* Constants and sampling rate derived values go in this struct */ +struct LC3PLUS_Dec { + DecSetup* channel_setup[MAX_CHANNELS]; + const LC3_INT* W_fx; + const LC3_INT* bands_offset; + const LC3_INT* cutoffBins; + + LC3_INT fs; /* sampling rate, 44.1 maps to 48 */ + LC3_INT fs_out; /* output sampling rate */ + LC3_INT fs_idx; /* sampling rate index */ + LC3_INT frame_length; /* sampling rate index */ + LC3_INT channels; /* number of channels */ + LC3_FLOAT frame_ms; /* frame length in ms (wrong for 44.1) */ + LC3_INT frame_dms; /* frame length in ms * 10 (wrong for 44.1) */ + LC3_INT last_size; /* size of last frame, without error protection */ + LC3_INT ep_enabled; /* error protection enabled */ + LC3_INT error_report; /* corrected errors in last frame or -1 on error */ + + LC3_INT imdct_memLen; + LC3_INT imdct_winLen; + LC3_INT imdct_laZeros; + const LC3_FLOAT* imdct_win; + + LC3_INT yLen; + LC3_INT W_size; + LC3_INT la_zeroes; + LC3_INT bands_number; + LC3_INT ltpf_mem_x_len; + LC3_INT ltpf_mem_y_len; + LC3_INT BW_cutoff_bits; + LC3_INT tilt; + + LC3_INT hrmode; + LC3_INT specflip; + + const LC3_INT* bands_offsetPLC; + LC3_INT n_bandsPLC; + + LC3_INT32 rframe; + int plcMeth; /* PLC method for all channels */ + LC3_INT16 n_pccw; + LC3_INT16 be_bp_left; + LC3_INT16 be_bp_right; + LC3_INT16 n_pc; + LC3_INT16 m_fec; + int epmr; + LC3_INT16 combined_channel_coding; + int last_error; +}; + +#endif diff --git a/lc3plus/setup_enc_lc3.c b/lc3plus/setup_enc_lc3.c new file mode 100755 index 0000000000..986b43d608 --- /dev/null +++ b/lc3plus/setup_enc_lc3.c @@ -0,0 +1,546 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "setup_enc_lc3.h" +#include "functions.h" +#include + +/* if encoder is null only size is reported */ +int alloc_encoder(LC3PLUS_Enc* encoder, int channels) +{ + int ch = 0; + size_t size = sizeof(LC3PLUS_Enc); + + for (ch = 0; ch < channels; ch++) { + EncSetup* setup = balloc(encoder, &size, sizeof(EncSetup)); + if (encoder) { + encoder->channel_setup[ch] = setup; + } + } + + return (int)size; +} + +LC3PLUS_Error FillEncSetup(LC3PLUS_Enc* encoder, int samplerate, int channels + , int hrmode + , int32_t lfe_channel_array[] +) +{ + int ch = 0; + memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels)); + alloc_encoder(encoder, channels); + + encoder->fs = CODEC_FS(samplerate); + encoder->fs_in = samplerate; + encoder->fs_idx = FS2FS_IDX(encoder->fs); + encoder->frame_dms = 100; + if (encoder->fs_idx > 4) { + encoder->fs_idx = 5; + } + + encoder->hrmode = hrmode != 0; + + encoder->channels = channels; + encoder->frame_ms = 10; + encoder->envelope_bits = 38; + encoder->global_gain_bits = 8; + encoder->noise_fac_bits = 3; + encoder->BW_cutoff_bits = BW_cutoff_bits_all[encoder->fs_idx]; + + encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; + encoder->r12k8_mem_out_len = 24; + + for (ch = 0; ch < encoder->channels; ch++) + { + encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; + } + + encoder->bw_ctrl_active = 0; + encoder->bandwidth = encoder->fs / 2; + encoder->bandwidth_preset = encoder->fs / 2; + + + if (encoder->fs == 8000) { + encoder->tilt = 14; + } else if (encoder->fs == 16000) { + encoder->tilt = 18; + } else if (encoder->fs == 24000) { + encoder->tilt = 22; + } else if (encoder->fs == 32000) { + encoder->tilt = 26; + } else if (encoder->fs == 48000) { + encoder->tilt = 30; + } + else if (encoder->fs == 96000) { + encoder->tilt = 34; + } + + set_enc_frame_params(encoder); + return LC3PLUS_OK; +} + +/* set frame config params */ +void set_enc_frame_params(LC3PLUS_Enc* encoder) +{ + int ch = 0; + EncSetup* setup; + + encoder->frame_length = ceil(encoder->fs * 10 / 1000); /* fs * 0.01*2^6 */ + if (encoder->hrmode == 1) + { + encoder->yLen = encoder->frame_length; + } + else + { + encoder->yLen = MIN(MAX_BW, encoder->frame_length); + encoder->sns_damping = 0.85; + } + encoder->stEnc_mdct_mem_len = encoder->frame_length - encoder->la_zeroes; + encoder->bands_number = 64; + encoder->nSubdivisions = 3; + encoder->near_nyquist_index = encoder->bands_number - 2; + encoder->near_nyquist_flag = 0; + encoder->ltpf_mem_in_len = LTPF_MEMIN_LEN; + + if (encoder->fs_idx == 5) + { + encoder->hrmode = 1; + } + + if (encoder->hrmode) + { + encoder->BW_cutoff_bits = 0; + } + else + { + encoder->BW_cutoff_bits = BW_cutoff_bits_all[encoder->fs_idx]; + } + + if (encoder->frame_ms == 10) { + encoder->la_zeroes = MDCT_la_zeroes[encoder->fs_idx]; + if (encoder->hrmode) + { + encoder->bands_offset = ACC_COEFF_PER_BAND_HR[encoder->fs_idx]; + } + else + { + encoder->bands_offset = ACC_COEFF_PER_BAND[encoder->fs_idx]; + } + encoder->cutoffBins = BW_cutoff_bin_all; + + encoder->attdec_nblocks = 4; + encoder->attdec_damping = 0.5; + encoder->attdec_hangover_thresh = 2; + } + else if (encoder->frame_ms == 2.5) { + encoder->la_zeroes = MDCT_la_zeroes_2_5ms[encoder->fs_idx]; + if (encoder->hrmode) + { + encoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms_HR[encoder->fs_idx]; + } + else + { + encoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms[encoder->fs_idx]; + } + encoder->cutoffBins = BW_cutoff_bin_all_2_5ms; + } + else if (encoder->frame_ms == 5) { + encoder->la_zeroes = MDCT_la_zeroes_5ms[encoder->fs_idx]; + if (encoder->hrmode) + { + encoder->bands_offset = ACC_COEFF_PER_BAND_5ms_HR[encoder->fs_idx]; + } + else + { + encoder->bands_offset = ACC_COEFF_PER_BAND_5ms[encoder->fs_idx]; + } + encoder->cutoffBins = BW_cutoff_bin_all_5ms; + } + + if (encoder->frame_ms == 2.5) { + encoder->frame_length = encoder->frame_length >> 2; + encoder->yLen /= 4; + encoder->stEnc_mdct_mem_len = encoder->frame_length - encoder->la_zeroes; + if (encoder->hrmode) + { + encoder->bands_number = bands_number_2_5ms_HR[encoder->fs_idx]; + } + else + { + encoder->bands_number = bands_number_2_5ms[encoder->fs_idx]; + } + + encoder->nSubdivisions = 2; + encoder->near_nyquist_index = encoder->bands_number - 2; + encoder->ltpf_mem_in_len = LTPF_MEMIN_LEN + (LEN_12K8 >> 2); + } + + + if (encoder->frame_ms == 5) { + encoder->frame_length = encoder->frame_length >> 1; + encoder->yLen /= 2; + encoder->stEnc_mdct_mem_len = encoder->frame_length - encoder->la_zeroes; + encoder->bands_number = bands_number_5ms[encoder->fs_idx]; + encoder->nSubdivisions = 2; + encoder->near_nyquist_index = encoder->bands_number - 3; + } + + for (ch = 0; ch < encoder->channels; ch++) { + setup = encoder->channel_setup[ch]; + + setup->olpa_mem_pitch = 17; + + if (setup->mdctStruct.mem != NULL) { + mdct_free(&setup->mdctStruct); + mdct_init(&setup->mdctStruct, encoder->frame_length, encoder->frame_dms, encoder->fs_idx, encoder->hrmode); + + dct2_free(&setup->dct2StructSNS); + dct2_init(&setup->dct2StructSNS, M); + } + else + { + mdct_init(&setup->mdctStruct, encoder->frame_length, encoder->frame_dms, encoder->fs_idx, encoder->hrmode); + dct2_init(&setup->dct2StructSNS, M); + } + } +} + +/* change encoder bitrate */ +LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) +{ + int ch = 0, bitsTmp = 0, minBR = 0, maxBR = 0, totalBytes = 0; + LC3_INT channel_bytes = 0, max_bytes = 0; + + if (encoder->hrmode) + { +#ifdef ENABLE_HR_MODE_FL + switch (encoder->frame_dms) + { + case 25: + maxBR = 672000; + if (encoder->fs == 48000) {minBR = MIN_BR_25MS_48KHZ_HR;} + else if (encoder->fs == 96000) {minBR = MIN_BR_25MS_96KHZ_HR;} + else { return LC3PLUS_HRMODE_ERROR;} + break; + case 50: + maxBR = 600000; + if (encoder->fs == 48000) {minBR = MIN_BR_50MS_48KHZ_HR;} + else if (encoder->fs == 96000) {minBR = MIN_BR_50MS_96KHZ_HR;} + else { return LC3PLUS_HRMODE_ERROR;} + break; + case 100: + maxBR = 500000; + if (encoder->fs == 48000) {minBR = MIN_BR_100MS_48KHZ_HR;} + else if (encoder->fs == 96000) {minBR = MIN_BR_100MS_96KHZ_HR;} + else { return LC3PLUS_HRMODE_ERROR;} + break; + default: + return LC3PLUS_HRMODE_ERROR; + } +#endif + } + else + { + minBR = (MIN_NBYTES << 3); + maxBR = MAX_BR; + + switch (encoder->frame_dms) + { + case 25: + minBR = MIN_BR_025DMS; + maxBR = MAX_BR; + break; + case 50: + minBR = MIN_BR_050DMS; + maxBR = MAX_BR; + /* have additional limitations for 5.0ms */ + switch (encoder->fs_in) + { + case 8000: maxBR = MAX_BR_050DMS_NB; break; + default: break; + } + break; + case 100: + /* have additional limitations for 10ms */ + minBR = MIN_BR_100DMS; + maxBR = MAX_BR; + switch (encoder->fs_in) + { + case 8000: maxBR = MAX_BR_100DMS_NB ; break; + case 16000: maxBR = MAX_BR_100DMS_WB ; break; + case 24000: maxBR = MAX_BR_100DMS_SSWB; break; + default: maxBR = MAX_BR; break; + } + break; + default: return LC3PLUS_FRAMEMS_ERROR; + } + maxBR *= (encoder->fs_in == 44100 ? 441. / 480 : 1); + } + minBR *= encoder->channels; + maxBR *= encoder->channels; + + encoder->combined_channel_coding = 0; + + if (encoder->channels > 1 && encoder->epmode) + { + if (encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in) <= 160) + { + encoder->combined_channel_coding = 1; + } + } + + if (encoder->epmode > 0) + { + max_bytes = bitrate * encoder->frame_length / (8 * encoder->fs_in * encoder->channels); + if (max_bytes < FEC_SLOT_BYTES_MIN || max_bytes > FEC_SLOT_BYTES_MAX) + { + encoder->lc3_br_set = 0; + return LC3PLUS_BITRATE_ERROR; + } + } + + if (encoder->combined_channel_coding) + { + totalBytes = fec_get_data_size(encoder->epmode, encoder->combined_channel_coding, + bitrate * encoder->frame_length / (8 * encoder->fs_in)); + + encoder->channel_setup[0]->n_pccw = + fec_get_n_pccw(bitrate * encoder->frame_length / (8 * encoder->fs_in), encoder->epmode, + encoder->combined_channel_coding); + + encoder->channel_setup[0]->n_pc = fec_get_n_pc(encoder->epmode, encoder->channel_setup[0]->n_pccw, + bitrate * encoder->frame_length / (8 * encoder->fs_in)); + } + else + { + totalBytes = bitrate * encoder->frame_length / (8 * encoder->fs_in); + } + + if (encoder->frame_dms <= 50) + { + encoder->tnsMaxOrder = 4; + } else { + encoder->tnsMaxOrder = 8; + } + + if (bitrate < minBR || bitrate > maxBR) { + return LC3PLUS_BITRATE_ERROR; + } + + encoder->lc3_br_set = 1; + for (ch = 0; ch < encoder->channels; ch++) { + + EncSetup* setup = encoder->channel_setup[ch]; + + setup->targetBytes = totalBytes / encoder->channels + (ch < (totalBytes % encoder->channels)); + channel_bytes = totalBytes / encoder->channels + (ch < (totalBytes % encoder->channels)); + + if (encoder->combined_channel_coding) + { + setup->targetBytes = channel_bytes; + } + else + { + setup->targetBytes = fec_get_data_size(encoder->epmode, encoder->combined_channel_coding, channel_bytes); + setup->n_pccw = fec_get_n_pccw(channel_bytes, encoder->epmode, encoder->combined_channel_coding); + setup->n_pc = fec_get_n_pc(encoder->epmode, setup->n_pccw, channel_bytes); + } + // reduce bandwith to 12kHz if bitrate is low + if (encoder->frame_dms == 100 && + ((setup->targetBytes < 40 && encoder->fs == 48000) || + (setup->targetBytes < 36 && encoder->fs == 32000))) + { + encoder->bandwidth = MIN(12000, encoder->bandwidth_preset); + } + else + { + /* channel with highest index has lowest bitrate. + For a second channel with lower targetBytes, bandwidth is overwritten */ + encoder->bandwidth = encoder->bandwidth_preset; + } + encoder->bw_ctrl_cutoff_bin = encoder->bandwidth * encoder->frame_dms / 5000; + encoder->bw_index = (encoder->bandwidth / 4000) - 1; + setup->total_bits = setup->targetBytes << 3; + setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits - + encoder->noise_fac_bits - encoder->BW_cutoff_bits - + ceil(LC3_LOGTWO(encoder->frame_length / 2)) - 2 - 1; + + if (setup->total_bits > 1280) { + setup->targetBitsInit = setup->targetBitsInit - 1; + } + if (setup->total_bits > 2560) { + setup->targetBitsInit = setup->targetBitsInit - 1; + } + + if (encoder->hrmode) + { + setup->targetBitsInit -= 1; + } + + setup->targetBitsAri = setup->total_bits; + setup->enable_lpc_weighting = setup->total_bits < 480; + + if (encoder->frame_ms == 5) { + setup->enable_lpc_weighting = setup->total_bits < 240; + } + if (encoder->frame_ms == 2.5) { + setup->enable_lpc_weighting = setup->total_bits < 120; + } + + setup->quantizedGainOff = + -(MIN(115, setup->total_bits / (10 * (encoder->fs_idx + 1))) + 105 + 5 * (encoder->fs_idx + 1)); + + if (encoder->hrmode && encoder->fs_idx == 5) + { + setup->quantizedGainOff = MAX(setup->quantizedGainOff, -181); + } + + if (encoder->frame_ms == 10 && ((encoder->fs_in >= 44100 && setup->targetBytes >= 100) || + (encoder->fs_in == 32000 && setup->targetBytes >= 81)) && setup->targetBytes < 340 && encoder->hrmode == 0) { + setup->attack_handling = 1; + + } + else if (encoder->frame_dms == 75 && ((encoder->fs_in >= 44100 && setup->targetBytes >= 75) || + (encoder->fs_in == 32000 && setup->targetBytes >= 61)) && setup->targetBytes < 150 && encoder->hrmode == 0) + { + setup->attack_handling = 1; + } + else + { + /* reset for bitrate switching */ + setup->attack_handling = 0; + + setup->attdec_filter_mem[0] = 0; + setup->attdec_filter_mem[1] = 0; + + setup->attdec_detected = 0; + setup->attdec_position = 0; + setup->attdec_acc_energy = 0; + } + + bitsTmp = setup->total_bits; + if (encoder->frame_ms == 2.5) { + bitsTmp = bitsTmp * 4.0 * (1.0 - 0.4); + } + if (encoder->frame_ms == 5) { + bitsTmp = bitsTmp * 2 - 160; + } + + if (bitsTmp < 400 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else if (bitsTmp < 480 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else if (bitsTmp < 560 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else if (bitsTmp < 640 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else { + setup->ltpf_enable = 0; + } + if (encoder->hrmode) { + setup->ltpf_enable = 0; + } + + /* turn down SNS shaping for higher rates */ + if (encoder->hrmode == 0) { + encoder->sns_damping = 0.85; + } else { + encoder->sns_damping = 0.6; + if (encoder->fs_idx >= 4) { + if (encoder->frame_ms == 10) + { + if (setup->total_bits > 4400) { + encoder->sns_damping = 6881.0/32768.0; + } + } + if (encoder->frame_ms == 5) + { + if (setup->total_bits > 4600/2) { + encoder->sns_damping = 4915.0/32768.0; + } + } + if (encoder->frame_ms == 2.5) + { + if (setup->total_bits > 4600/4) { + encoder->sns_damping = 4915.0/32768.0; + } + } + } + } + + if (encoder->hrmode && encoder->fs_idx >= 4) + { + int real_rate = setup->targetBytes * 8000 / encoder->frame_ms; + setup->regBits = real_rate / 12500; + + if (encoder->fs_idx == 5) + { + if (encoder->frame_ms == 10) + { + setup->regBits +=2; + } + if (encoder->frame_ms == 2.5) + { + setup->regBits -= 6; + } + } + else + { + if (encoder->frame_ms == 2.5) + { + setup->regBits -= 6; + } + else if (encoder->frame_ms == 5) + { + setup->regBits += 0; + } + if (encoder->frame_ms == 10) + { + setup->regBits += 5; + } + } + if (setup->regBits < 6) + { + setup->regBits = 6; + } + if (setup->regBits > 23) + { + setup->regBits = 23; + } + } + else + { + setup->regBits = -1; + } + } + + encoder->bitrate = bitrate; + + return LC3PLUS_OK; +} + +void update_enc_bandwidth(LC3PLUS_Enc* encoder, int bandwidth) +{ + int index = 0; + + if (bandwidth >= encoder->fs_in) { + encoder->bandwidth = 0; + } + else + { + encoder->bandwidth = bandwidth; + index = FS2FS_IDX(bandwidth); + if (index > 4) { + index = 5; + } + encoder->bw_ctrl_cutoff_bin = encoder->cutoffBins[index]; + } +} diff --git a/lc3plus/setup_enc_lc3.h b/lc3plus/setup_enc_lc3.h new file mode 100755 index 0000000000..31f0cbeb50 --- /dev/null +++ b/lc3plus/setup_enc_lc3.h @@ -0,0 +1,119 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef SETUP_ENC_LC3_FL_H +#define SETUP_ENC_LC3_FL_H + +#include "constants.h" + +/* Channel state and bitrate-derived values go in this struct */ +typedef struct { + LC3_FLOAT targetBitsOff; + LC3_FLOAT ltpf_mem_normcorr; + LC3_FLOAT ltpf_mem_mem_normcorr; + LC3_FLOAT attdec_filter_mem[2]; + LC3_FLOAT attdec_acc_energy; + LC3_FLOAT r12k8_mem_50[2]; + LC3_FLOAT r12k8_mem_in[120]; + LC3_FLOAT r12k8_mem_out[24]; + LC3_FLOAT olpa_mem_s12k8[3]; + LC3_FLOAT olpa_mem_s6k4[LEN_6K4 + MAX_PITCH_6K4 + 16]; + LC3_FLOAT ltpf_mem_in[LTPF_MEMIN_LEN + LEN_12K8 + 1]; + LC3_FLOAT s_in_scaled[MAX_LEN]; + LC3_FLOAT s_12k8[LEN_12K8 + 1]; + LC3_FLOAT ener[MAX_BANDS_NUMBER]; + LC3_FLOAT scf_q[M]; + LC3_FLOAT scf[M]; + LC3_FLOAT int_scf[MAX_BANDS_NUMBER]; + LC3_FLOAT ltpf_mem_pitch; + + LC3_INT targetBytes; + LC3_INT total_bits; + LC3_INT targetBitsInit; + LC3_INT targetBitsAri; + LC3_INT enable_lpc_weighting; + LC3_INT ltpf_enable; + LC3_INT quantizedGainOff; + LC3_INT tns_bits; + LC3_INT targetBitsQuant; + LC3_INT olpa_mem_pitch; + LC3_INT ltpf_mem_ltpf_on; + LC3_INT mem_targetBits; + LC3_INT mem_specBits; + LC3_INT attack_handling; /* flag to enable attack handling */ + LC3_INT attdec_detected; + LC3_INT attdec_position; + LC3_INT ltpf_param[3]; + LC3_INT L_scf_idx[SCF_MAX_PARAM]; + LC3_INT codingdata[3 * MAX_LEN]; + uint8_t resBits[MAX_RESBITS_LEN]; + LC3_INT regBits; + + LC3_INT16 n_pc; + LC3_INT16 n_pccw; + LC3_INT16 be_bp_left; + LC3_INT16 be_bp_right; + + Mdct mdctStruct; + Dct2 dct2StructSNS; + + LC3_INT lfe; +} EncSetup; + +/* Constants and sampling rate derived values go in this struct */ +struct LC3PLUS_Enc { + EncSetup* channel_setup[MAX_CHANNELS]; + const LC3_INT* W_fx; + const LC3_INT* bands_offset; + const LC3_INT* cutoffBins; + + LC3_INT fs; /* encoder sampling rate 44.1 -> 48 */ + LC3_INT fs_in; /* input sampling rate */ + LC3_INT bitrate; /* global bitrate */ + LC3_INT fs_idx; /* sampling rate index */ + LC3_INT frame_length; /* audio samples / frame */ + LC3_INT channels; /* number of channels */ + LC3_INT epmode; /* error protection mode */ + LC3_FLOAT frame_ms; /* frame length in ms (wrong for 44.1) */ + LC3_INT frame_dms; /* frame length in ms * 10 (wrong for 44.1) */ + LC3_INT tilt; + LC3_INT lc3_br_set; + LC3_INT yLen; + LC3_INT W_size; + LC3_INT la_zeroes; + LC3_INT stEnc_mdct_mem_len; + LC3_INT bands_number; + LC3_INT nSubdivisions; + LC3_INT ltpf_mem_in_len; + LC3_INT envelope_bits; + LC3_INT global_gain_bits; + LC3_INT noise_fac_bits; + LC3_INT BW_cutoff_bits; + LC3_INT r12k8_mem_in_len; + LC3_INT r12k8_mem_out_len; + LC3_INT16 near_nyquist_index; + LC3_INT16 near_nyquist_flag; + LC3_INT tnsMaxOrder; + LC3_INT hrmode; + LC3_INT bandwidth; + LC3_INT bandwidth_preset; + LC3_INT bw_ctrl_active; + LC3_INT bw_ctrl_cutoff_bin; + LC3_INT bw_index; + LC3_FLOAT sns_damping; + LC3_INT attdec_nblocks; + LC3_FLOAT attdec_damping; + LC3_INT attdec_hangover_thresh; + + LC3_INT16 combined_channel_coding; + LC3_INT16 epmr; +}; + +#endif diff --git a/lc3plus/sns_compute_scf.c b/lc3plus/sns_compute_scf.c new file mode 100755 index 0000000000..5cb041925b --- /dev/null +++ b/lc3plus/sns_compute_scf.c @@ -0,0 +1,177 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) +{ + LC3_INT bands_number = 0, d = 0, i = 0, j = 0, n = 0, n2 = 0, n4 = 0, mapping[64] = {0}; + LC3_FLOAT tmp[64] = {0}, x_tmp1[MAX_LEN] = {0}, x_tmp2[MAX_LEN] = {0}, sum = 0, mean = 0, xl4[16] = {0}, nf = 0, xl[64] = {0}, gains_smooth[M] = {0}, ratio = 0; + LC3_FLOAT W[6] = {1.0 / 12.0, 2.0 / 12.0, 3.0 / 12.0, 3.0 / 12.0, 2.0 / 12.0, 1.0 / 12.0}; + + bands_number = xLen; + assert(bands_number <= 64); + + /* 5 ms */ + if (bands_number < 64) { + d = 64 - bands_number; + + if (d < xLen) + { + j = 0; + for (i = 0; i < 2 * d; i = i + 2) { + tmp[i] = x[j]; + tmp[i + 1] = x[j]; + j++; + } + + move_float(&tmp[2 * d], &x[d], 64 - 2 * d); + } else if (ceil(64.0 / (LC3_FLOAT) xLen) == 4) + { + ratio = LC3_FABS((LC3_FLOAT) (1.0 - 32.0 / (LC3_FLOAT) xLen)); + n4 = round(ratio * xLen); + n2 = xLen - n4; + + j = 0; + for(i = 1; i <= n4; i++) + { + mapping[j] = i; + mapping[j + 1] = i; + mapping[j + 2] = i; + mapping[j + 3] = i; + j += 4; + } + + for (i = n4 + 1; i <= n4 + n2; i++) + { + mapping[j] = i; + mapping[j + 1] = i; + j += 2; + } + + + for (i = 0; i < 64; i++) + { + tmp[i] = x[mapping[i] - 1]; + } + } else { + assert(0 && "Unsupported number of bands!"); + } + + move_float(x, tmp, 64); + + bands_number = 64; + xLen = bands_number; + } + + + /* Smoothing */ + + x_tmp1[0] = x[0]; + + move_float(&x_tmp1[1], &x[0], xLen - 1); + + move_float(&x_tmp2[0], &x[1], xLen - 1); + + x_tmp2[xLen - 1] = x[xLen - 1]; + + for (i = 0; i < xLen; i++) { + x[i] = 0.5 * x[i] + 0.25 * (x_tmp1[i] + x_tmp2[i]); + } + + /* Pre-emphasis */ + for (i = 0; i < xLen; i++) { + x[i] = x[i] * LC3_POW(10.0, (LC3_FLOAT)i * (LC3_FLOAT)tilt / ((LC3_FLOAT)bands_number - 1.0) / 10.0); + } + + /* Noise floor at -40dB */ + for (i = 0; i < 64; i++) { + sum += x[i]; + } + + mean = sum / (LC3_FLOAT)xLen; + + nf = mean * LC3_POW(10.0, -40.0 / 10.0); + nf = MAX(nf, LC3_POW(2.0, -32.0)); + + for (i = 0; i < 64; i++) { + if (x[i] < nf) { + x[i] = nf; + } + } + + /* Log-domain */ + for (i = 0; i < 64; i++) { + xl[i] = LC3_LOGTWO(x[i]) / 2.0; + } + + /* Downsampling */ + for (n = 0; n < bands_number / 4; n++) { + if (n == 0) { + tmp[0] = xl[0]; + + move_float(&tmp[1], &xl[0], 5); + + } else if (n == (bands_number / 4 - 1)) { + move_float(tmp, &xl[59], 5); + + tmp[5] = xl[63]; + + } else { + move_float(tmp, &xl[n * 4 - 1], ((n * 4 + 5 - 1) - (n * 4 - 1) + 1)); + } + + sum = 0; + for (i = 0; i < 6; i++) { + sum += tmp[i] * W[i]; + } + + xl4[n] = sum; + } + + + /* Remove mean and scaling */ + + sum = 0; + for (i = 0; i < bands_number / 4; i++) { + sum += xl4[i]; + } + + mean = sum / ((LC3_FLOAT)bands_number / 4.0); + + for (i = 0; i < bands_number / 4; i++) { + gains[i] = sns_damping * (xl4[i] - mean); + } + + /* Smoothing */ + if (smooth) { + gains_smooth[0] = (gains[0] + gains[1] + gains[2]) / 3.0; + gains_smooth[1] = (gains[0] + gains[1] + gains[2] + gains[3]) / 4.0; + + for (i = 2; i < 14; i++) { + gains_smooth[i] = (gains[i - 2] + gains[i - 1] + gains[i] + gains[i + 1] + gains[i + 2]) / 5.0; + } + + gains_smooth[M - 2] = (gains[M - 4] + gains[M - 3] + gains[M - 2] + gains[M - 1]) / 4.0; + gains_smooth[M - 1] = (gains[M - 3] + gains[M - 2] + gains[M - 1]) / 3.0; + + sum = 0; + for (i = 0; i < M; i++) { + sum += gains_smooth[i]; + } + + mean = sum / (LC3_FLOAT)M; + + for (i = 0; i < M; i++) { + gains[i] = attdec_damping_factor * (gains_smooth[i] - mean); + } + } +} diff --git a/lc3plus/sns_interpolate_scf.c b/lc3plus/sns_interpolate_scf.c new file mode 100755 index 0000000000..4419397890 --- /dev/null +++ b/lc3plus/sns_interpolate_scf.c @@ -0,0 +1,90 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) +{ + LC3_INT i = 0, n = 0, d = 0, n4 = 0; + LC3_FLOAT tmp[MAX_BANDS_NUMBER_PLC] = {0}, ratio = 0; + + /* Interpolation */ + + gains_int[0] = gains[0]; + gains_int[1] = gains[0]; + + for (n = 0; n <= 14; n++) { + gains_int[n * 4 + 2] = gains[n] + (gains[n + 1] - gains[n]) / 8.0; + gains_int[n * 4 + 3] = gains[n] + 3.0 * (gains[n + 1] - gains[n]) / 8.0; + gains_int[n * 4 + 4] = gains[n] + 5.0 * (gains[n + 1] - gains[n]) / 8.0; + gains_int[n * 4 + 5] = gains[n] + 7.0 * (gains[n + 1] - gains[n]) / 8.0; + } + + gains_int[62] = gains[15] + (gains[15] - gains[14]) / 8.0; + gains_int[63] = gains[15] + 3.0 * (gains[15] - gains[14]) / 8.0; + + /* For 5ms */ + + if (bands_number < 64) { + d = 64 - bands_number; + + if (d < 32) + { + i = 0; + for (n = 0; n < 2 * d; n = n + 2) { + tmp[i] = (gains_int[n] + gains_int[n + 1]) / (LC3_FLOAT)2.0; + i++; + } + + for (n = 1; n < d; n++) { + gains_int[n] = gains_int[2 * n]; + } + + for (n = 2 * d; n < 64; n++) { + gains_int[n - d] = gains_int[n]; + } + + move_float(gains_int, tmp, d); + } else if (ceil(64.0 / (LC3_FLOAT) bands_number) == 4) + { + ratio = LC3_FABS((LC3_FLOAT) ((LC3_FLOAT)1.0 - (LC3_FLOAT)32.0 / (LC3_FLOAT) bands_number)); + n4 = LC3_ROUND(ratio * (LC3_FLOAT)bands_number); + + for (i = 0; i < n4; i++) + { + tmp[i] = (gains_int[4 * i] + gains_int[4 * i + 1] + gains_int[4 * i + 2] + gains_int[4 * i + 3]) / 4.0; + } + + for (i = 0; i < bands_number - n4; i++) + { + tmp[n4 + i] = (gains_int[4 * n4 + 2 * i] + gains_int[4 * n4 + 2 * i + 1]) / 2.0; + } + + move_float(gains_int, tmp, bands_number); + } else { + assert(0 && "Unsupported number of bands!"); + } + } + + /* Inversion at encoder-side */ + + if (encoder_side == 1) { + for (n = 0; n < bands_number; n++) { + gains_int[n] = -gains_int[n]; + } + } + + /* Linear domain */ + + for (n = 0; n < bands_number; n++) { + gains_int[n] = LC3_POW(2, gains_int[n]); + } +} diff --git a/lc3plus/sns_quantize_scf.c b/lc3plus/sns_quantize_scf.c new file mode 100755 index 0000000000..704127cce7 --- /dev/null +++ b/lc3plus/sns_quantize_scf.c @@ -0,0 +1,517 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); +static LC3_INT find_last_indice_le(LC3_INT compare, const LC3_INT* array, LC3_INT len); +static void idct_II(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT len); + +void idct_II(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT len) +{ + LC3_INT i; + LC3_FLOAT norm1, sum; + + norm1 = 0.353553390593274; /* sqrt(2 / 16) */ + + for (i = 0; i < len; i++) { + sum = mac_loop(in, idct_lookup[i], len); + out[i] = norm1 * sum; + } +} + +static LC3_INT pvq_pulse_search(LC3_FLOAT *xabs, LC3_FLOAT *ener, LC3_FLOAT *corr, LC3_INT *y, LC3_INT start, LC3_INT end) +{ + LC3_INT i; + LC3_INT nBest; + LC3_FLOAT bestCorrSq, bestEn; + LC3_FLOAT corrSq, currCorr, currEn; + + nBest = 0; + bestCorrSq = 0.0; + bestEn = 0.0; + + *ener += 1; // Added once for the entire loop + + i = start; + + currCorr = *corr + xabs[i]; + currEn = *ener + (2 * y[i]); + + corrSq = currCorr * currCorr; + + bestEn = currEn; + bestCorrSq = corrSq; + nBest = i; + + /* Iterative max search as recommended in the spec */ + for (; i < end; i++) + { + currCorr = *corr + xabs[i]; + currEn = *ener + (2 * y[i]); + + corrSq = currCorr * currCorr; + + if ((corrSq * bestEn) > (bestCorrSq * currEn)) + { + bestEn = currEn; + bestCorrSq = corrSq; + nBest = i; + } + } + + *corr += xabs[nBest]; + *ener += (2 * y[nBest]); + + y[nBest] += 1; /* Add the selected unit pulse */ + + return nBest; +} + +static void pvq_enc_vec_normalize(LC3_FLOAT *vec, LC3_INT N) +{ + LC3_FLOAT mag = 0.0, norm_fac; + LC3_INT i; + + for (i = 0; i < N; i++) + { + mag += (vec[i] * vec[i]); + } + + norm_fac = 1.0 / LC3_SQRT(mag); + + for (i = 0; i < N; i++) + { + vec[i] = vec[i] * norm_fac; + } + + return; +} + +static void pvq_enc_search(LC3_FLOAT* x_in, LC3_INT y[4][M]) +{ + LC3_INT i, N, K, pulse_total, N_setA; + LC3_FLOAT abs_sum, projfac; + LC3_FLOAT xabs[16]; + LC3_FLOAT yy, xy; + + abs_sum = 0.0; + + /* Step 1 : Projection to pyramid N=16, K=6 */ + N = 16; + K = 6; + pulse_total = 0; + N_setA = 10; + + yy = xy = 0.0f; + + for (i = 0; i < N; i++) + { + xabs[i] = LC3_FABS(x_in[i]); + abs_sum += xabs[i]; + } + + projfac = (K - 1) / abs_sum; + + for (i = 0; i < N; i++) + { + y[3][i] = floor(xabs[i] * projfac); + + pulse_total += y[3][i]; + + yy += (y[3][i] * y[3][i]); + xy += (xabs[i] * y[3][i]); + } + + /* Step 2: Adding unit pulses up to K = 6 */ + for (; pulse_total < K; pulse_total++) + { + pvq_pulse_search(xabs, &yy, &xy, y[3], 0, N); + } + + /* Step 3: Adding unit pulses up to K = 8 */ + memcpy(y[2], y[3], sizeof(LC3_INT)*N); + K = 8; + + for (; pulse_total < K; pulse_total++) + { + pvq_pulse_search(xabs, &yy, &xy, y[2], 0, N); + } + + memcpy(y[1], y[2], sizeof(LC3_INT)*N_setA); + + /* Step 4: Remove unit pulses not belonging to set A */ + for (i = N_setA; i < N; i++) + { + y[1][i] = 0; + } + + /* Step 5: Update yy and xy terms to reflect y1 */ + yy = 0; + xy = 0; + pulse_total = 0; + + for (i = 0; i < N_setA; i++) + { + yy += (y[1][i] * y[1][i]); + xy += (xabs[i] * y[1][i]); + + pulse_total += y[1][i]; + } + + /* Step 6: Add unit pulses until K = 10 over N = 10 */ + K = 10; + for (; pulse_total < K; pulse_total++) + { + pvq_pulse_search(xabs, &yy, &xy, y[1], 0, N_setA); + } + + memcpy(y[0], y[1], sizeof(LC3_INT)*N); + + /* Step 7: Add unit pulses until K = 1 over N = 6 in set B*/ + pvq_pulse_search(xabs, &yy, &xy, y[0], N_setA, N); + + /* Step 8: Add signs to each of the 4 vectors from x */ + for (i = 0; i < N; i++) + { + if (x_in[i] < 0) + { + y[0][i] = -y[0][i]; + y[1][i] = -y[1][i]; + y[2][i] = -y[2][i]; + y[3][i] = -y[3][i]; + } + } + + return; +} + +static inline LC3_FLOAT calc_mse(LC3_FLOAT *t2rot, LC3_FLOAT *y, LC3_FLOAT gain, LC3_INT N) +{ + LC3_FLOAT mse; + LC3_INT i; + + mse = 0.0; + + for (i = 0; i < N; i++) + { + LC3_FLOAT err = (t2rot[i] - gain * y[i]); + mse += (err * err); + } + + return mse; +} + +static void sns_quant_adj_gain_shape_search(LC3_FLOAT *t2rot, LC3_INT y[4][M] , + LC3_INT *gain_idx, LC3_INT *shape_idx, LC3_FLOAT *y_norm, LC3_FLOAT *scq_gain) +{ + LC3_INT gidx, sidx; + LC3_FLOAT min_mse, mse; + LC3_INT N; + LC3_FLOAT yCur[4][16]; + LC3_INT i; + + const LC3_INT gain_levels[4] = { 2, 4, 4, 8 }; + const LC3_FLOAT *sns_vq_gains[4] = { sns_vq_reg_adj_gains_fl , sns_vq_reg_lf_adj_gains_fl , + sns_vq_near_adj_gains_fl , sns_vq_far_adj_gains_fl }; + + min_mse = -1.0; + N = 16; + + + *gain_idx = *shape_idx = 0; + + for (sidx = 0; sidx < 4; sidx++) + { + for (i = 0; i < N; i++) + { + yCur[sidx][i] = (LC3_FLOAT)y[sidx][i]; + } + + /* Step 9: Normalize the vectors */ + pvq_enc_vec_normalize(yCur[sidx], N); + + for (gidx = 0; gidx < gain_levels[sidx]; gidx++) + { + mse = calc_mse(t2rot, yCur[sidx], sns_vq_gains[sidx][gidx], N); + + if ((mse < min_mse) || (min_mse < 0)) + { + *gain_idx = gidx; + *shape_idx = sidx; + min_mse = mse; + } + } + } + + for (i = 0; i < N; i++) + { + y_norm[i] = yCur[*shape_idx][i]; + } + + *scq_gain = sns_vq_gains[*shape_idx][*gain_idx]; + + return; +} + +static void enc_push_sign(LC3_FLOAT val, LC3_UINT32 *next_sign_ind, LC3_INT *index) +{ + if (((*next_sign_ind & 0x80000000U) == 0) && (val != 0)) { + *index = 2 * (*index) + *next_sign_ind; + } + if (val < 0) { + *next_sign_ind = 1; + } + if (val > 0) { + *next_sign_ind = 0; + } + + return; +} + +static void MPVQ_enum(LC3_INT dim, LC3_INT *sns_vec, LC3_INT *index_val, LC3_INT *lead_sign_ind) +{ + LC3_UINT32 next_sign_ind; + LC3_INT k_val_acc; + LC3_INT pos; + LC3_INT index, n; + LC3_INT const *row_ptr; + + /* MPVQ-index composition loop */ + LC3_INT tmp_h_row; + LC3_INT tmp_val; + + next_sign_ind = 0x80000000U; + k_val_acc = 0; + pos = dim; + index = 0; + n = 0; + + row_ptr = (LC3_INT const *)&(pvq_enc_A[n]); + tmp_h_row = row_ptr[0]; + + for (pos--; pos >= 0; pos--) + { + tmp_val = sns_vec[pos]; + enc_push_sign(tmp_val, &next_sign_ind, &index); + + index += tmp_h_row; + k_val_acc += abs(tmp_val); + if (pos != 0) { + n += 1; /* switch row in offset table MPVQ_offsets(n, k) */ + } + row_ptr = (LC3_INT const *)&(pvq_enc_A[n]); + + tmp_h_row = row_ptr[k_val_acc]; + } + + *index_val = index; + *lead_sign_ind = next_sign_ind; + + return; +} + +static LC3_INT MSEsearch (LC3_FLOAT *scf, const LC3_FLOAT sns_CB[8][32]) +{ + LC3_FLOAT distance, mse; + LC3_INT i, n, ind; + + ind = 0; + + distance = (LC3_FLOAT) LC3_CONST_POW_2_100; + for (i = 0; i < 32; i++) { + mse = 0; + for (n = 0; n < 8; n++) { + mse += (scf[n] - sns_CB[n][i]) * (scf[n] - sns_CB[n][i]); + } + + if (mse < distance) { + distance = mse; + ind = i; + } + } + return ind; +} + +void process_snsQuantizesScf_Enc(LC3_FLOAT* env, LC3_INT* index, LC3_FLOAT* envq, Dct2 dct2structSNS) +{ + LC3_FLOAT stage2_en1_norm_sub[M]; + LC3_INT i, j; + LC3_FLOAT st1_vector[M]; + LC3_FLOAT pvq_target_pre[M]; + LC3_FLOAT pvq_target[M]; + LC3_FLOAT stage2_en1_norm_pre_sub[M]; + LC3_INT gain, shape; + LC3_FLOAT scfq_gain; + LC3_INT y[4][M]; + + /* Stage 1 split VQ */ + index[0] = MSEsearch(&env[0], sns_LFCB); /* ind_LF */ + index[1] = MSEsearch(&env[8], sns_HFCB); /* ind_HF */ + + j = 8; + for (i = 0; i < 8; i++, j++) { + st1_vector[i] = sns_LFCB[i][index[0]]; + st1_vector[j] = sns_HFCB[i][index[1]]; + } + + /* STAGE 2 */ + for (i = 0; i < 16; i++) { + pvq_target_pre[i] = env[i] - st1_vector[i]; + } + + dct2_apply(&dct2structSNS, pvq_target_pre, pvq_target); + pvq_enc_search(pvq_target, y); + sns_quant_adj_gain_shape_search(pvq_target, y, &gain, &shape, stage2_en1_norm_pre_sub, &scfq_gain); + + /* Inverse transform */ + idct_II(stage2_en1_norm_pre_sub, stage2_en1_norm_sub, M); + + index[2] = shape; + index[3] = gain; + + if (shape < 2) { + MPVQ_enum(10, y[shape], &index[5], &index[4]); + } + else { + MPVQ_enum(M, y[shape], &index[5], &index[4]); + } + + if (shape == 0) { + LC3_INT ls_ind, ind; + MPVQ_enum(6, &y[shape][10], &ind, &ls_ind); + index[6] = ind * 2 + ls_ind; + } + else if (shape == 2) { + index[6] = -1; + } + else { + index[6] = -2; + } + + for (i = 0; i < M; i++) { + envq[i] = st1_vector[i] + (stage2_en1_norm_sub[i] * scfq_gain); + } +} + +LC3_INT find_last_indice_le(LC3_INT compare, const LC3_INT* array, LC3_INT len) +{ + LC3_INT idx = 0, i = 0; + + for (i = 0; i < len; i++) { + if (compare >= array[i]) { + idx++; + } + } + + if (idx > 0) { + idx--; + } + + return idx; +} + +void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses) +{ + LC3_INT leading_sign = 0, idx = 0, k_delta = 0, pos = 0; + + leading_sign = 1 - 2 * LS_ind; + + /* Decoding loop */ + + for (pos = 0; pos < m; pos++) { + if (MPVQ_ind != 0) { + /* Find last indice */ + idx = find_last_indice_le(MPVQ_ind, &pvq_enc_A[m - pos - 1][0], k + 1); + MPVQ_ind = MPVQ_ind - pvq_enc_A[m - pos - 1][idx]; + k_delta = k - idx; + } else { + pulses[pos] = leading_sign * k; + break; + } + + if (k_delta != 0) { + pulses[pos] = leading_sign * k_delta; + if ((MPVQ_ind % 2) != 0) { + leading_sign = -1; + } else { + leading_sign = 1; + } + + MPVQ_ind = floor(MPVQ_ind / 2); + k = k - k_delta; + } + } +} + +void process_snsQuantizesScf_Dec(LC3_INT* scf_idx, LC3_FLOAT* scf_q) +{ + LC3_INT i = 0, submode = 0; + LC3_INT pulses2[6] = {0}, pulses[M] = {0}; + LC3_FLOAT st2_vector[M] = {0}, st2_vector_idct[M] = {0}, sum = 0; + + /* Decode first stage */ + + for (i = 0; i < 8; i++) { + scf_q[i] = sns_LFCB[i][scf_idx[0]]; + scf_q[i + 8] = sns_HFCB[i][scf_idx[1]]; + } + + /* STAGE 2 */ + /* Decode submode */ + + submode = scf_idx[2]; + + /* Decode pulses */ + + if (submode < 2) { + pvq_dec(10, 10, scf_idx[4], scf_idx[5], pulses); + + if (submode == 0) { + pvq_dec(1, 6, (scf_idx[6] % 2), floor(scf_idx[6] / 2), pulses2); + + move_int(&pulses[10], pulses2, 6); + + } else { + pulses[15] = 0; + } + } else if (submode == 2) { + pvq_dec(8, 16, scf_idx[4], scf_idx[5], pulses); + } else { + pvq_dec(6, 16, scf_idx[4], scf_idx[5], pulses); + } + + /* Normalization */ + + for (i = 0; i < M; i++) { + sum += pulses[i] * pulses[i]; + } + + sum = 1.0 / LC3_SQRT(sum); + + for (i = 0; i < M; i++) { + st2_vector[i] = pulses[i] * sum; + } + + /* Inverse transform */ + idct_II(st2_vector, st2_vector_idct, M); + + /* Gain */ + for (i = 0; i < M; i++) { + st2_vector_idct[i] = st2_vector_idct[i] * sns_dec_gains[submode][scf_idx[3]]; + } + + /* Add stage 1 and stage 2 */ + + for (i = 0; i < M; i++) { + scf_q[i] = scf_q[i] + st2_vector_idct[i]; + } +} diff --git a/lc3plus/structs.h b/lc3plus/structs.h new file mode 100755 index 0000000000..fea377da41 --- /dev/null +++ b/lc3plus/structs.h @@ -0,0 +1,186 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef STRUCTS_H +#define STRUCTS_H + +#include "defines.h" +#include "fft/iisfft.h" + +typedef struct { + LC3_FLOAT r; /* real part */ + LC3_FLOAT i; /* imaginary part */ +} Complex; + +typedef struct { + LC3_INT length; + void *handle; +} Fft; + +typedef struct { + LC3_INT length; + Fft fft; +} Dct2; + +typedef struct { + LC3_INT length; + Fft fft; +} Dct3; + +typedef struct { + LC3_INT length; + Complex *twid1; + Complex *twid2; + Fft fft; +} Dct4; + +typedef struct { + LC3_INT length; + LC3_INT leading_zeros; + LC3_INT mem_length; + const LC3_FLOAT *window; + LC3_FLOAT *mem; + Dct4 dct; +} Mdct; + +typedef struct { + uint32_t ac_low_fl; + uint32_t ac_range_fl; + int BER_detect; + + LC3_INT32 pc_c_bp; + LC3_INT32 pc_c_bp_side; + LC3_INT32 pc_bytes; + LC3_INT32 pc_b_left; + LC3_INT32 pc_b_right; + LC3_INT32 pc_enc; + LC3_INT32 pc_bfi; + LC3_INT32 pc_bbi; + LC3_INT32 pc_be_bp_left; + LC3_INT32 pc_be_bp_right; + LC3_INT32 pc_return; +} Decoder_State_fl; + +typedef struct { + LC3_INT bp; + LC3_INT low; + LC3_INT range; + LC3_INT cache; + LC3_INT carry; + LC3_INT carry_count; + uint8_t *ptr; + LC3_INT *bp_side; + LC3_INT *mask_side; +} Encoder_State_fl; + +typedef struct { + LC3_INT nbLostCmpt; + LC3_INT prevBfi; + LC3_INT prevprevBfi; + LC3_FLOAT q_d[MAX_LEN]; + LC3_FLOAT q_d_prev[MAX_LEN]; +} PlcSetup; + + +typedef struct { + LC3_FLOAT cum_alpha; + LC3_INT seed; +} PlcNsSetup; + +typedef struct { + LC3_INT32 seed; + LC3_INT32 ns_nbLostCmpt_pc; + LC3_FLOAT *q_old_res; + LC3_FLOAT prev_gg; +} pcState; + +typedef struct { + LC3_INT len; + LC3_INT sign; + LC3_FLOAT* table; +} Cfft; + +typedef struct T_IIS_FFT { + IIS_FFT_DIR sign; + LC3_INT32 len; + LC3_FLOAT* buffer; + LC3_FLOAT* sine_table; + Iisfft iisfft; + Cfft cfft; +} IIS_FFT; + +typedef struct T_IIS_FFT* HANDLE_IIS_FFT; + +typedef struct { + Fft PhEcu_Fft; /*no counterpart in BASOP */ + Fft PhEcu_Ifft; /*no counterpart in BASOP */ + + + LC3_FLOAT PhECU_f0hzLtpBin; /* BASOP Word16 PhECU_f0hzLtpBinQ7 */ + LC3_FLOAT PhECU_norm_corr; /* BASOP Word16 norm_corrQ15 */ + + LC3_FLOAT *PhECU_oold_grp_shape; /* BASOP Word16 PhECU_oold_grp_shape_fx[MAX_LGW]; */ + LC3_FLOAT *PhECU_old_grp_shape; /* BASOP Word16 PhECU_old_grp_shape_fx[MAX_LGW] ; */ + + LC3_FLOAT PhECU_L_oold_xfp_w_E; /* BASOP Word32 PhECU_L_oold_xfp_w_E_fx;*/ + LC3_FLOAT PhECU_L_old_xfp_w_E; /* BASOP Word32 PhECU_L_old_xfp_w_E_fx; */ + + LC3_INT32 PhECU_Lprot ; /* BASOP Word16 PhECU_Lprot_fx;*/ + + LC3_FLOAT *PhECU_xfp; + Complex *PhECU_X_sav_m; + LC3_INT32 *PhECU_plocs; /* BASOP Word16 *PhECU_plocs; */ /* MAX_PLOCS */ + LC3_FLOAT *PhECU_f0est; /*BASOP Word32 *PhECU_f0est;*/ + + LC3_FLOAT *PhECU_mag_chg_1st; /* BASOP Word16 PhECU_mag_chg_1st[MAX_LGW];*/ + LC3_FLOAT *PhECU_Xavg; /* BASOP Word16 PhECU_Xavg[MAX_LGW] ; */ + + LC3_FLOAT PhECU_beta_mute; /* BASOP Word16 PhECU_beta_mute*/ + + LC3_INT16 PhECU_seed; /* BASOP Word16 PhECU_seed_fx;*/ + + LC3_INT32 PhECU_LDWIN_OLAP; /* BASOP Word16 PhECU_LDWIN_OLAP; */ + LC3_INT32 PhECU_t_adv; /* BASOP Word16 t_adv; */ + + LC3_INT32 PhECU_short_flag_prev; + LC3_INT32 PhECU_time_offs; + LC3_INT32 PhECU_num_plocs; + HANDLE_IIS_FFT handle_fft_phaseecu; + HANDLE_IIS_FFT handle_ifft_phaseecu; + +} PlcPhEcuSetup; + +typedef struct { + LC3_INT16 seed; + LC3_FLOAT gain_c; + LC3_INT32 lpcorder; + LC3_FLOAT A[M+1]; + LC3_INT32 fract; + LC3_INT32 lagw_bw; + LC3_FLOAT preemphFac; + LC3_FLOAT *harmonicBuf; + LC3_FLOAT synthHist[M]; +} PlcTdcSetup; + +typedef struct { + LC3_FLOAT *pcmbufHist; + LC3_INT32 max_len_pcm_plc; + PlcTdcSetup PlcTdcSetup; + LC3_FLOAT stabFac; + LC3_FLOAT cum_fading_slow; + LC3_FLOAT cum_fading_fast; + LC3_FLOAT cum_fflcAtten; + LC3_FLOAT scf_q_old[M]; + LC3_FLOAT scf_q_old_old[M]; + PlcPhEcuSetup PlcPhEcuSetup; +} PlcAdvSetup; + + +#endif diff --git a/lc3plus/tinywavein_c.h b/lc3plus/tinywavein_c.h new file mode 100755 index 0000000000..c7bd58593c --- /dev/null +++ b/lc3plus/tinywavein_c.h @@ -0,0 +1,605 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef __TINYWAVEIN_C_H__ +#define __TINYWAVEIN_C_H__ + +/*#define SUPPORT_BWF*/ + +#include +#include +#include + + +#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ + defined(__aarch64__) +#define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ +#endif + +#if defined(__POWERPC__) +#define __TWI_BE /* _T_iny _W_ave _I_n _B_ig _E_ndian */ +#endif + +#if !defined(__TWI_LE) && !defined(__TWI_BE) +#error unknown processor +#endif + +#define __TWI_SUCCESS (0) +#define __TWI_ERROR (-1) + +#ifdef SUPPORT_BWF +typedef struct +{ + float loudnessVal; + float loudnessRange; + float maxTruePeakLevel; + float maxMomentaryLoudnes; + float maxShortTermLoudness; +} WAVEIN_LOUDNESSINFO; +#endif + +typedef struct __tinyWaveInHandle +{ + FILE * theFile; + fpos_t dataChunkPos; + unsigned int position; + unsigned int length; + unsigned int bps; +#ifdef SUPPORT_BWF + WAVEIN_LOUDNESSINFO *loudnessInfo; +#endif +} __tinyWaveInHandle, WAVEFILEIN; + +typedef struct +{ + short compressionCode; + short numberOfChannels; + unsigned int sampleRate; + unsigned int averageBytesPerSecond; + short blockAlign; + short bitsPerSample; + /* short extraFormatBytes ; */ +} SWavInfo; + +#ifdef SUPPORT_BWF +typedef struct +{ + unsigned char description[256]; + unsigned char originator[32]; + unsigned char originatorReference[32]; + unsigned char originatorDate[10]; /* ASCII: <> */ + unsigned char originationTime[8]; /* ASCII: <> */ + unsigned int timeReferenceLow; + unsigned int timeReferenceHigh; + unsigned short version; + unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ + + signed short loudnessVal; + signed short loudnessRange; + signed short maxTruePeakLevel; + signed short maxMomentaryLoudnes; + signed short maxShortTermLoudness; + + unsigned char Reserved[180]; + + unsigned char codingHistory; /* ASCII: <> */ +} SBwfWav; +#endif + +typedef struct +{ + char chunkID[4]; + unsigned int chunkSize; + /* long dataOffset ; */ /* never used */ +} SChunk; + +/* local wrapper, always returns correct endian */ +static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream); + +#ifdef __TWI_BE +static short BigEndian16(short v); +static int BigEndian32(int v); +#endif + +/*! + * \brief Read header from a WAVEfile. Host endianess is handled accordingly. + * \fp filepointer of type FILE*. + * \wavinfo SWavInfo struct where the decoded header info is stored into. + * \return 0 on success and non-zero on failure. + * + */ +static WAVEFILEIN *OpenWav(const char *filename, unsigned int *samplerate, short *channels, unsigned int *samplesInFile, + short *bps) +{ + WAVEFILEIN *self; + + SChunk fmt_chunk, data_chunk; + int offset; + unsigned int tmpSize; + char tmpFormat[4]; + SWavInfo wavinfo = {0, 0, 0, 0, 0, 0}; + + self = (WAVEFILEIN *)calloc(1, sizeof(WAVEFILEIN)); + if (!self) + goto bail; /* return NULL; */ + + if (!filename) + goto bail; + if (!samplerate) + goto bail; + if (!channels) + goto bail; + if (!samplesInFile) + goto bail; + if (!bps) + goto bail; + + self->theFile = fopen(filename, "rb"); + if (!self->theFile) + goto bail; + + /* read RIFF-chunk */ + if (fread(tmpFormat, 1, 4, self->theFile) != 4) + { + goto bail; + } + + if (strncmp("RIFF", tmpFormat, 4)) + { + goto bail; + } + + /* Read RIFF size. Ignored. */ + fread_LE(&tmpSize, 4, 1, self->theFile); + + /* read WAVE-chunk */ + if (fread(tmpFormat, 1, 4, self->theFile) != 4) + { + goto bail; + } + + if (strncmp("WAVE", tmpFormat, 4)) + { + goto bail; + } + + /* read format/bext-chunk */ + if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + +#ifdef SUPPORT_BWF + /* test for bext-chunk */ + if (!strncmp("bext", fmt_chunk.chunkID, 4)) + { + /*unsigned int i;*/ + unsigned int bextSize = 0; + + if (fread_LE(&bextSize, 1, 4, self->theFile) != 4) + { + goto bail; + } + + self->loudnessInfo = (WAVEIN_LOUDNESSINFO *)calloc(1, sizeof(WAVEIN_LOUDNESSINFO)); + + if (bextSize >= 602) + { /* minimum size bext-data, w/o 'CodingHistory' */ + int i; + signed short readBuf = 0; + signed int nulbuf = 0; + + /* first skip all descriptive data */ + for (i = 0; i < 412; i++) + { + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + bextSize -= 1; + } + /* second, read loudness data */ + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->loudnessVal = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->loudnessRange = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->maxTruePeakLevel = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->maxMomentaryLoudnes = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->maxShortTermLoudness = (float)readBuf * 0.01f; + + /* skip reserved data */ + for (i = 0; i < 180; i++) + { + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + bextSize -= 1; + } + } + + /* skip remaining data */ + while (bextSize) + { + int nulbuf; + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + bextSize -= 1; + } + + /* read next chunk header */ + if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + } +#endif + + /* skip some potential chunks up to fmt chunk */ + + while (strncmp("fmt ", fmt_chunk.chunkID, 4) != 0) + { + unsigned int chunkSize = 0; + + if (fread_LE(&chunkSize, 1, 4, self->theFile) != 4) + { + goto bail; + } + + /* skip chunk data */ + while (chunkSize) + { + int nulbuf; + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + chunkSize -= 1; + } + + /* read next chunk header */ + if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + } + + /* go on with fmt-chunk */ + if (strncmp("fmt ", fmt_chunk.chunkID, 4)) + { + goto bail; + } + + if (fread_LE(&fmt_chunk.chunkSize, 4, 1, self->theFile) != 1) + { /* should be 16 for PCM-format (uncompressed) */ + goto bail; + } + + + /* read info */ + fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); + fread_LE(&(wavinfo.numberOfChannels), 2, 1, self->theFile); + fread_LE(&(wavinfo.sampleRate), 4, 1, self->theFile); + fread_LE(&(wavinfo.averageBytesPerSecond), 4, 1, self->theFile); + fread_LE(&(wavinfo.blockAlign), 2, 1, self->theFile); + fread_LE(&(wavinfo.bitsPerSample), 2, 1, self->theFile); + + if (wavinfo.compressionCode == -2) + { + fseek(self->theFile, 8, SEEK_CUR); // skip channel mask + fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); // part of GUID + fseek(self->theFile, 14, SEEK_CUR); // skip rest of GUID + offset = fmt_chunk.chunkSize - 40; + } + else + offset = fmt_chunk.chunkSize - 16; + + if (wavinfo.compressionCode == 0x01) + { + if ((wavinfo.bitsPerSample != 16) && (wavinfo.bitsPerSample != 24) && (wavinfo.bitsPerSample != 32)) + /* we do only support 16,24 and 32 bit PCM audio */ + goto bail; + } + else + { + /* if(wavinfo.bitsPerSample != 32) */ + printf("compressioncode: %02x\n", wavinfo.compressionCode); + puts("Error! We only support 16,24 and 32 bit PCM audio"); + exit(1); + goto bail; + } + + /* Skip rest of fmt header if any. */ + for (; offset > 0; offset--) + { + fread(&tmpSize, 1, 1, self->theFile); + } + + do + { + + /* Read data chunk ID */ + if (fread(data_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + + /* Read chunk length. */ + + if (fread_LE(&offset, 4, 1, self->theFile) != 1) + { + goto bail; + } + + /* Check for data chunk signature. */ + if (strncmp("data", data_chunk.chunkID, 4) == 0) + { + data_chunk.chunkSize = offset; + break; + } + + /* unused 1 byte present, if size is odd */ + /* see https://www.daubnet.com/en/file-format-riff */ + if (offset % 2) + { + offset++; + } + + /* Jump over non data chunk. */ + for (; offset > 0; offset--) + { + fread(&tmpSize, 1, 1, self->theFile); + } + + } while (!feof(self->theFile)); + + /* success so far */ + *samplerate = wavinfo.sampleRate; + *channels = wavinfo.numberOfChannels; + *samplesInFile = data_chunk.chunkSize / wavinfo.numberOfChannels; + *samplesInFile /= ((wavinfo.bitsPerSample + 7) / 8); + *bps = wavinfo.bitsPerSample; + + self->position = 0; + self->bps = wavinfo.bitsPerSample; + self->length = *samplesInFile * wavinfo.numberOfChannels; + + fgetpos(self->theFile, &self->dataChunkPos); + + return self; + +bail: + free(self); + return NULL; +} + +#ifdef SUPPORT_BWF +static void ReadBWF(WAVEFILEIN *self, WAVEIN_LOUDNESSINFO **wavInLoudness) +{ + *wavInLoudness = self->loudnessInfo; +} +#endif + +static int __ReadSample16(WAVEFILEIN *self, int *sample) +{ + size_t cnt; + short v = 0; + + cnt = fread(&v, 2, 1, self->theFile); + + if (cnt != 1) + { + return __TWI_ERROR; + } + + self->position += 1; + +#ifdef __TWI_BE + v = BigEndian16(v); +#endif + *sample = v; + return __TWI_SUCCESS; +} + +static int __ReadSample24(WAVEFILEIN *self, int *sample) +{ + size_t cnt; + int v = 0; + + cnt = fread(&v, 3, 1, self->theFile); + + if (cnt != 1) + { + return __TWI_ERROR; + } + + self->position += 1; + +#ifdef __TWI_BE + v = BigEndian32(v); +#endif + + if (v >= 0x800000) + { + v |= 0xff000000; + } + + *sample = v; + + return __TWI_SUCCESS; +} + +static int __ReadSample32(WAVEFILEIN *self, int *sample) +{ + size_t cnt; + int v = 0; + + cnt = fread(&v, 4, 1, self->theFile); + + if (cnt != 1) + { + return __TWI_ERROR; + } + + self->position += 1; + +#ifdef __TWI_BE + v = BigEndian32(v); +#endif + + *sample = v >> 8; + + return __TWI_SUCCESS; +} + +static int __ReadSampleInternal(WAVEFILEIN *self, int *sample, int scale) +{ + int err; + + if (!self) + { + return __TWI_ERROR; + } + + switch (scale) + { + + case 16: err = __ReadSample16(self, sample); break; + + case 24: err = __ReadSample24(self, sample); break; + + case 32: err = __ReadSample32(self, sample); break; + + default: err = __TWI_ERROR; break; + } + + return err; +} + +/* this function returns normalized values in the range +8388607..-8388608 */ +static int ReadWavInt(WAVEFILEIN *self, int sampleBuffer[], unsigned int nSamplesToRead, unsigned int *nSamplesRead) +{ + unsigned int i; + int err = __TWI_SUCCESS; + *nSamplesRead = 0; + + if (!sampleBuffer) + { + return __TWI_ERROR; + } + + /* check if we have enough samples left, if not, + set nSamplesToRead to number of samples left. */ + if (self->position + nSamplesToRead > self->length) + { + nSamplesToRead = self->length - self->position; + } + + for (i = 0; i < nSamplesToRead; i++) + { + + int tmp; + err = __ReadSampleInternal(self, &tmp, self->bps); + if (err != __TWI_SUCCESS) + { + return err; + } + sampleBuffer[i] = tmp; + *nSamplesRead += 1; + } + + return __TWI_SUCCESS; +} + +static int CloseWavIn(WAVEFILEIN *self) +{ + if (self) + { + if (self->theFile) + { + fclose(self->theFile); + } + } + free(self); + + return __TWI_SUCCESS; +} +/* +static int ResetWavIn(WAVEFILEIN* self) +{ + if (self) { + if (self->theFile) { + fsetpos(self->theFile, &self->dataChunkPos); + self->position = 0; + } + } + return __TWI_SUCCESS; +} +*/ +/*------------- local subs ----------------*/ + +static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ +#ifdef __TWI_LE + return fread(ptr, size, nmemb, stream); +#endif +#ifdef __TWI_BE + + unsigned char x[sizeof(int)]; + unsigned char *y = (unsigned char *)ptr; + int i; + int len; + + len = fread(x, size, nmemb, stream); + + for (i = 0; i < size * nmemb; i++) + { + *y++ = x[size * nmemb - i - 1]; + } + + return len; +#endif +} + +#ifdef __TWI_BE +static short BigEndian16(short v) +{ + short a = (v & 0x0ff); + short b = (v & 0x0ff00) >> 8; + + return a << 8 | b; +} + +static int BigEndian32(int v) +{ + int a = (v & 0x0ff); + int b = (v & 0x0ff00) >> 8; + int c = (v & 0x0ff0000) >> 16; + int d = (v & 0xff000000) >> 24; + + return a << 24 | b << 16 | c << 8 | d; +} +#endif + +#endif /* __TINYWAVEIN_C_H__ */ diff --git a/lc3plus/tinywaveout_c.h b/lc3plus/tinywaveout_c.h new file mode 100755 index 0000000000..323b09d51c --- /dev/null +++ b/lc3plus/tinywaveout_c.h @@ -0,0 +1,892 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + + + +#ifndef __TINYWAVEOUT_C_H__ +#define __TINYWAVEOUT_C_H__ + +/*#define TWO_SUPPORT_BWF*/ + +#include +#include +#include +#include +#ifdef TWO_SUPPORT_BWF +#include +#endif + +/***** Interface *********************************************************/ + +#ifndef TWO_UINT64 + #if !(defined(WIN32)) + #include + #define TWO_UINT64 uint64_t + #else + #define TWO_UINT64 unsigned __int64 + #endif +#endif + +typedef struct WAVEFILEOUT WAVEFILEOUT; +#ifdef TWO_SUPPORT_BWF +typedef struct WAVEOUT_LOUDNESSINFO WAVEOUT_LOUDNESSINFO; +#endif + +#define __TWO_SUCCESS (0) +#define __TWO_ERROR (-1) + +static WAVEFILEOUT* CreateWav( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps + ); + +#ifdef TWO_SUPPORT_BWF +static WAVEFILEOUT* CreateWavBWF( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps, + const WAVEOUT_LOUDNESSINFO *hBwfData + ); +#endif + +/* this function expects values in the 16 bit range +32767..-32768 */ +static int WriteWavShort( + WAVEFILEOUT* self, + short sampleBuffer[], + unsigned int nSamples + ); + +/* this function expects values in the 24 bit range +8388607..-8388608 */ +static int WriteWavLong( + WAVEFILEOUT* self, + int sampleBuffer[], + unsigned int nSamples + ); + +/* this function expects normalized values in the range +-1.0f */ +static int WriteWavFloat( + WAVEFILEOUT* self, + float sampleBuffer[], + unsigned int nSamples + ); + +static int CloseWav(WAVEFILEOUT* self); +#ifdef TWO_SUPPORT_BWF +static int CloseWavBWF(WAVEFILEOUT* self, WAVEOUT_LOUDNESSINFO bextData); +#endif + +/***** Implementation *********************************************************/ + +#if defined (__i386__) || defined (_M_IX86) || defined (_M_X64) || defined (__x86_64__) || defined (__arm__) || defined (__xtensa__) || defined (__aarch64__) || defined (__EMSCRIPTEN__) +#define __TWO_LE /* _T_iny _W_ave _O_ut _L_ittle _E_ndian */ +#endif + +#if defined (__POWERPC__) +#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ +#endif + +#if defined (__sparc__) +#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ +#endif + +#if ! defined (__TWO_LE) && ! defined (__TWO_BE) +#error unknown processor +#endif + +/*--- local types/structs ----------------------------------*/ + +#if defined(_MSC_VER) + #pragma pack(push, 1) +#else + #pragma pack(1) +#endif + + +#ifdef TWO_SUPPORT_BWF +struct WAVEOUT_LOUDNESSINFO { + float loudnessVal; + float loudnessRange; + float maxTruePeakLevel; + float maxMomentaryLoudnes; + float maxShortTermLoudness; +}; +#endif + + +typedef struct __tinyWaveOutHeader +{ + unsigned int riffType; /* 'RIFF/RF64' */ + unsigned int riffSize; /* file size/-1 */ + unsigned int waveType; /* 'WAVE' */ +} __tinyWaveOutHeader; + +typedef struct __tinyWaveOutDs64Chunk +{ + unsigned int formatType; /* = 'JUNK/ds64' */ + unsigned int formatSize; /* size info */ + TWO_UINT64 riffSize64; + TWO_UINT64 dataSize64; + TWO_UINT64 sampleCount64; + unsigned int tableLength; /* optional tables, always 0 for tinywaveout */ + /* here: optional tables */ +} __tinyWaveOutDs64Chunk; + +#ifdef TWO_SUPPORT_BWF +typedef struct __tinyWaveOutBextChunk +{ + unsigned int formatType; /* = 'bext' */ + unsigned int formatSize; /* size info */ + + unsigned char description[256]; + unsigned char originator[32]; + unsigned char originatorReference[32]; + unsigned char originatorDate[10]; /* ASCII: <> */ + unsigned char originationTime[8]; /* ASCII: <> */ + unsigned int timeReferenceLow; + unsigned int timeReferenceHigh; + unsigned short version; + unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ + + signed short loudnessVal; + signed short loudnessRange; + signed short maxTruePeakLevel; + signed short maxMomentaryLoudnes; + signed short maxShortTermLoudness; + + unsigned char Reserved[180]; + + unsigned char codingHistory; /* ASCII: <> - undefined length! */ + /* for variable length, mve this out of this struct */ +} __tinyWaveOutBextChunk; +#endif + +typedef struct __tinyWaveOutFmtChunk +{ + unsigned int formatType; + unsigned int formatSize; + + unsigned short formatTag; + unsigned short numChannels; + unsigned int sampleRate; + unsigned int bytesPerSecond; + unsigned short blockAlignment; + unsigned short bitsPerSample; + + /* wav fmt ext hdr here */ +} __tinyWaveOutFmtChunk; + +typedef struct __tinyWaveOutDataChunk +{ + unsigned int dataType; + unsigned int dataSize; + +} __tinyWaveOutDataChunk; + + +struct WAVEFILEOUT { + /* for reasons of memory alignment, have 64 bit data types first */ + TWO_UINT64 dataSize; + TWO_UINT64 dataSizeLimit; /* maximum size for data chunk for 4 GB files */ + TWO_UINT64 dataSizeLimit64; /* maximum size for data chunk for 2^64 B addressable files */ + TWO_UINT64 clipCount; + FILE* theFile; + unsigned int junkChunkOffset; + unsigned int fmtChunkOffset; +#ifdef TWO_SUPPORT_BWF + unsigned int bextChunkOffset; +#endif + unsigned int dataChunkOffset; + unsigned int bps; + + /* only needed for RF64: */ + unsigned int blockAlign; /* only needed for close() of ds64 chunk */ +}; + + +/*--- local protos --------------------------------------------------*/ +static __inline unsigned int BigEndian32(char, char, char, char); +static __inline unsigned int LittleEndian32(unsigned int); +static __inline unsigned int LittleEndian32s(int); +static __inline short LittleEndian16(short); +static __inline TWO_UINT64 LittleEndian64(TWO_UINT64); +#ifdef TWO_SUPPORT_BWF +static unsigned int EncodeLoudness(float); +#endif +static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ); + +#if defined(_MSC_VER) + #pragma pack(pop) +#else + #pragma pack() +#endif + + +#ifdef TWO_SUPPORT_BWF +static void setDefaultLoudness(WAVEOUT_LOUDNESSINFO *x) +{ + x->loudnessVal = 1.0f; + x->loudnessRange = 2.0f; + x->maxTruePeakLevel = 3.0f; + x->maxMomentaryLoudnes = 4.0f; + x->maxShortTermLoudness = 5.0f; +} +#endif + +static WAVEFILEOUT* __CreateWavInternal( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps +#ifdef TWO_SUPPORT_BWF + , + const WAVEOUT_LOUDNESSINFO *hBwfData +#endif + ) +{ + WAVEFILEOUT* self = NULL; + __tinyWaveOutHeader whdr; + __tinyWaveOutDs64Chunk ds64ch; +#ifdef TWO_SUPPORT_BWF + __tinyWaveOutBextChunk wbextch; +#endif + __tinyWaveOutFmtChunk wfch; + __tinyWaveOutDataChunk wdch; + unsigned int blockAlignment = 0; + unsigned int ByteCnt = 0; /* Byte counter for fwrite */ + + /* pseudo use to avoid unused symbols */ + (void)WriteWavShort; + (void)WriteWavLong; + (void)WriteWavFloat; +#ifdef TWI_SUPPORT_BWF + (void)CreateWavBWF; + (void)CloseWavBWF; + (void)setDefaultLoudness; +#endif + + /* param check */ + if (!fileName) goto bail; + if (sampleRate == 0) goto bail; + if (sampleRate > 768000) goto bail; + if (numChannels == 0) goto bail; + if (numChannels > 64) goto bail; + if (bps != 16 && bps != 24 && bps != 32) goto bail; + + self = (WAVEFILEOUT*)calloc(1, sizeof(WAVEFILEOUT)); + if (!self) goto bail; /* return NULL; */ + + self->theFile = fopen(fileName, "wb+"); + if (!self->theFile) goto bail; + + /* WAV-Header */ + whdr.riffType = BigEndian32('R','I','F','F'); + whdr.riffSize = LittleEndian32(0xffffffff); /* set to maximum, if fseek() doesn't work later */ + whdr.waveType = BigEndian32('W','A','V','E'); + /* write to file */ + ByteCnt = 0; + ByteCnt += fwrite(&whdr, 1, sizeof(whdr), self->theFile); + + /* ds64/JUNK-Chunk */ + ds64ch.formatType = BigEndian32('J','U','N','K'); + ds64ch.formatSize = LittleEndian32(sizeof(__tinyWaveOutDs64Chunk) - 8); + ds64ch.riffSize64 = (TWO_UINT64) -1; + ds64ch.dataSize64 = (TWO_UINT64) -1; + ds64ch.sampleCount64 = (TWO_UINT64) -1; + ds64ch.tableLength = 0; + self->junkChunkOffset = ByteCnt; + ByteCnt += fwrite(&ds64ch, 1, sizeof(ds64ch), self->theFile); + +#ifdef TWO_SUPPORT_BWF + /* BEXT-Chunk */ + if (hBwfData) { + memset(&wbextch, 0, sizeof(__tinyWaveOutBextChunk)); + wbextch.formatType = BigEndian32('b','e','x','t'); + wbextch.formatSize = LittleEndian32(sizeof(__tinyWaveOutBextChunk) - 8); + wbextch.version = 0x0002; + wbextch.loudnessVal = EncodeLoudness(hBwfData->loudnessVal); + wbextch.loudnessRange = EncodeLoudness(hBwfData->loudnessRange); + wbextch.maxTruePeakLevel = EncodeLoudness(hBwfData->maxTruePeakLevel); + wbextch.maxMomentaryLoudnes = EncodeLoudness(hBwfData->maxMomentaryLoudnes); + wbextch.maxShortTermLoudness = EncodeLoudness(hBwfData->maxShortTermLoudness); + /* t.b.d.: more values */ + + /* write to file */ + self->bextChunkOffset = ByteCnt; + ByteCnt += fwrite(&wbextch, 1, sizeof(wbextch), self->theFile); + } +#endif + + /* FMT-Chunk */ + wfch.formatType = BigEndian32('f','m','t',' '); + wfch.formatSize = LittleEndian32(16); + switch (bps) { + case 16: + case 24: + wfch.formatTag = LittleEndian16(0x0001); /* WAVE_FORMAT_PCM */ + break; + case 32: + wfch.formatTag = LittleEndian16(0x0003); /* WAVE_FORMAT_IEEE_FLOAT */ + break; + default: + goto bail; + } + self->bps = bps; + wfch.bitsPerSample = LittleEndian16(bps); + wfch.numChannels = LittleEndian16(numChannels); + blockAlignment = numChannels * (bps >> 3); + wfch.blockAlignment = LittleEndian16(blockAlignment); + wfch.sampleRate = LittleEndian32(sampleRate); + wfch.bytesPerSecond = LittleEndian32(sampleRate * blockAlignment); + /* tbd: wavfmt ext hdr here */ + /* write to file */ + self->fmtChunkOffset = ByteCnt; + ByteCnt += fwrite(&wfch, 1, sizeof(wfch), self->theFile); + + /* DATA-Chunk */ + self->dataChunkOffset = ByteCnt; + wdch.dataType = BigEndian32('d','a','t','a'); + wdch.dataSize = LittleEndian32(0xffffffff - ByteCnt); /* yet unknown. set to maximum of 4 GB file */ + /* write to file */ + ByteCnt += fwrite(&wdch, 1, sizeof(wdch), self->theFile); + + self->dataSize = 0; + + /* self->dataSizeLimit = 0x7fffffff - ByteCnt; */ /* maximum size for data chunk for 2 GB files */ + self->dataSizeLimit = 0xffffffff - ByteCnt; /* maximum size for data chunk for 4 GB files */ + self->dataSizeLimit64 = 0xffffffffffffffff - ByteCnt; /* maximum size for data chunk for 64 bit addressable files */ + + self->clipCount = 0; + self->blockAlign = blockAlignment; + + return self; + + bail: + if ( NULL != self) { + free(self); + } + + return NULL; +} + +static WAVEFILEOUT* CreateWav( + const char* fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps + ) +{ +#ifdef TWO_SUPPORT_BWF + return __CreateWavInternal(fileName, sampleRate, numChannels, bps, NULL); +#else + return __CreateWavInternal(fileName, sampleRate, numChannels, bps); +#endif +} + +#ifdef TWO_SUPPORT_BWF +static WAVEFILEOUT* CreateWavBWF( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps, + const WAVEOUT_LOUDNESSINFO *hBwfData + ) +{ + return __CreateWavInternal(fileName, sampleRate, numChannels, bps, hBwfData); +} +#endif + +#define MAX_PCM16 (+32767) +#define MIN_PCM16 (-32768) +static __inline int CLIP_PCM16(int sample, TWO_UINT64* clipcount) +{ + int tmp = sample; + + if (sample >= MAX_PCM16) { + tmp = MAX_PCM16; + (*clipcount)++; + } else { + if (sample <= MIN_PCM16) { + tmp = MIN_PCM16; + (*clipcount)++; + } + } + + return tmp; +} + +#define MAX_PCM24 (+8388607) +#define MIN_PCM24 (-8388608) +static __inline int CLIP_PCM24(int sample, TWO_UINT64* clipcount) +{ + int tmp = sample; + + if (sample >= MAX_PCM24) { + tmp = MAX_PCM24; + (*clipcount)++; + } else { + if (sample <= MIN_PCM24) { + tmp = MIN_PCM24; + (*clipcount)++; + } + } + + return tmp; +} + +#define MAX_FLOAT32 (+1.0f) +#define MIN_FLOAT32 (-1.0f) +static __inline float CLIP_FLOAT32(float sample, TWO_UINT64* clipcount) +{ + float tmp = sample; + + if (sample >= MAX_FLOAT32) { + tmp = MAX_FLOAT32; + (*clipcount)++; + } else { + if (sample <= MIN_FLOAT32) { + tmp = MIN_FLOAT32; + (*clipcount)++; + } + } + + return tmp; +} + + + +static int __WriteSample16( + WAVEFILEOUT* self, + int sample, + int scale + ) +{ + size_t cnt; + short v; + + if ((scale - 16) > 0) + sample = sample >> (scale - 16); + else + sample = (int) ((uint32_t) sample << (16 - scale)); + + v = (short)CLIP_PCM16(sample, &(self->clipCount)); +#ifdef __TWO_BE + v = LittleEndian16(v); +#endif + + cnt = fwrite(&v, sizeof(short), 1, self->theFile); + + if (cnt == 1) { + self->dataSize += 2; + return __TWO_SUCCESS; + } + + return __TWO_ERROR; +} + + +static int __WriteSample24( + WAVEFILEOUT* self, + int sample, + int scale + ) +{ + size_t cnt; + int v; + + if ((scale - 24) > 0) + sample = sample >> (scale - 24); + else + sample = (int) (((unsigned int)sample) << (24 - scale)); + + v = (int)CLIP_PCM24(sample, &(self->clipCount)); +#ifdef __TWO_BE + v = LittleEndian32s(v); +#endif + cnt = fwrite(&v, 3, 1, self->theFile); + + if (cnt == 1) { + self->dataSize += 3; + return __TWO_SUCCESS; + } + + return __TWO_ERROR; +} + + +static int __WriteSample32( + WAVEFILEOUT* self, + float sample + ) +{ + size_t cnt; + union fl_int { + float v_float; + int v_int; + }; + union fl_int v; + +#if CLIP_FLOAT + v.v_float = CLIP_FLOAT32(sample, &(self->clipCount)); +#else + v.v_float = sample; + if((sample > 1.0f) || (sample <-1.0f)) + self->clipCount++; +#endif + +#ifdef __TWO_BE + v.v_int = LittleEndian32s(v.v_int); +#endif + cnt = fwrite(&v, 4, 1, self->theFile); + + if (cnt == 1) { + self->dataSize += 4; + return __TWO_SUCCESS; + } + + return __TWO_ERROR; +} + + +static int __WriteSampleInt( + WAVEFILEOUT* self, + int sample, + int scale + ) +{ + int err; + + if (!self) return __TWO_ERROR; + + + switch (self->bps) { + + case 16: + err = __WriteSample16(self, sample, scale); + break; + + case 24: + err = __WriteSample24(self, sample, scale); + break; + + default: + err = __TWO_ERROR; + break; + } + + return err; +} + + +/* this function expects values in the 16 bit range +-32767/8 */ +static int WriteWavShort( + WAVEFILEOUT* self, + short sampleBuffer[], + unsigned int nSamples + ) +{ + unsigned long i; + int err = __TWO_SUCCESS; + + if (!self) return __TWO_ERROR; + if (!sampleBuffer) return __TWO_ERROR; + if (__dataSizeChk(self, nSamples * sizeof(short))) return __TWO_ERROR; + + for (i=0; i< nSamples; i++) { + if (self->bps == 32) + { + err = __WriteSample32(self, sampleBuffer[i] / 32768.0f); + } + else + { + err = __WriteSampleInt(self, (int)sampleBuffer[i], 16); + } + if (err != __TWO_SUCCESS) return err; + } + + return __TWO_SUCCESS; +} + + +/* this function expects values in the 24 bit range +-8388607/8 */ +static int WriteWavLong( + WAVEFILEOUT* self, + int sampleBuffer[], + unsigned int nSamples + ) +{ + unsigned long i; + int err = __TWO_SUCCESS; + + if (!self) return __TWO_ERROR; + if (!sampleBuffer) return __TWO_ERROR; + if (__dataSizeChk(self, nSamples * sizeof(int))) return __TWO_ERROR; + + for (i = 0; i < nSamples; i++) { + if (self->bps == 32) + { + err = __WriteSample32(self, sampleBuffer[i] / 8388608.0f); + } + else + { + err = __WriteSampleInt(self, sampleBuffer[i], 24); + } + if (err != __TWO_SUCCESS) return err; + } + + return __TWO_SUCCESS; +} + + +/* this function expects normalized values in the range +-1.0 */ +#define MAX_FL (+2.0f * 8388608.0f ) +#define MIN_FL (-2.0f * 8388608.0f ) +#define CLIP_FL(x) ( ((x) >= MAX_FL) ? MAX_FL : (((x) <= MIN_FL) ? MIN_FL : (x)) ) +static int WriteWavFloat( + WAVEFILEOUT* self, + float sampleBuffer[], + unsigned int nSamples + ) +{ + unsigned int i; + int err = __TWO_SUCCESS; + + if (!self) return __TWO_ERROR; + if (!sampleBuffer) return __TWO_ERROR; + if (__dataSizeChk(self, nSamples * sizeof(float))) return __TWO_ERROR; + + for (i=0; ibps == 32) + { + err = __WriteSample32(self, sampleBuffer[i]); + } + else + { + float tmp = CLIP_FL(sampleBuffer[i] * 8388608.0f); /* CLIP_FL is just to avoid an INT overrun before the actual cast to int, real clipping and counting is done below */ + err = __WriteSampleInt(self, (int) tmp, 24); + } + if (err != __TWO_SUCCESS) return err; + } + + return __TWO_SUCCESS; +} + + +static int CloseWav(WAVEFILEOUT* self) +{ + unsigned int riffSize_le = 0; + unsigned int dataSize_le = 0; + TWO_UINT64 riffSize64 = 0; + TWO_UINT64 dataSize64 = 0; + TWO_UINT64 sampleCount64 = 0; /* nr of samples in the WAVE sense: 1 sample are all pcm samples of all channels of one time slice */ + int mustWriteRF64 = 0; + + if (!self) return __TWO_ERROR; + + /* check for 4 GB (switch to RF64) */ + if ( self->dataSize > self->dataSizeLimit ) { + /* when we exceed 4 GB: switch from std wave header to RF64 header */ + mustWriteRF64 = 1; + } + + /* calc header values */ + if (mustWriteRF64 == 0) { + /* write padding byte if dataSize is uneven */ + int pad = 0; + if (self->dataSize % 2 > 0) { + char tmp= 0x00; + fwrite(&tmp, sizeof(char), 1, self->theFile); + pad = 1; + } + riffSize_le = LittleEndian32(self->dataChunkOffset - 8 + 8 + (unsigned int)self->dataSize + pad); /* sizeof(hdr) - (8 bytes of riff chunk header) + (8 bytes data chunk header) + sizeof(raw-pcm-data) + padding Byte */ + dataSize_le = LittleEndian32((unsigned int)self->dataSize); + } else { + riffSize_le = 0xffffffff; + dataSize_le = 0xffffffff; + riffSize64 = LittleEndian64( self->dataSize + (TWO_UINT64)self->dataChunkOffset ); + dataSize64 = LittleEndian64( self->dataSize ); + sampleCount64 = LittleEndian64( self->dataSize / (TWO_UINT64)self->blockAlign ); + } + + /* now overwrite length/size values in header with the actual/real ones */ + if (mustWriteRF64 == 0) { + /* riffsize32 */ + fseek(self->theFile, 4, SEEK_SET); + fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); + /* datasize32 */ + fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); + fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); + } else { + unsigned int rf64sig = BigEndian32('R','F','6','4'); + unsigned int ds64sig = BigEndian32('d','s','6','4'); + + /* replace RIFF->RF64 */ + fseek(self->theFile, 0, SEEK_SET); + fwrite(&rf64sig, sizeof(rf64sig), 1, self->theFile); + + /* riffsize32 */ + fseek(self->theFile, 4, SEEK_SET); + fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); + + /* replace JUNK->ds64 */ + fseek(self->theFile, self->junkChunkOffset, SEEK_SET); + fwrite(&ds64sig, sizeof(ds64sig), 1, self->theFile); + + /* riffSize64, dataSize64, sampleCount64 */ + fseek(self->theFile, self->junkChunkOffset + 8, SEEK_SET); + fwrite(&riffSize64, sizeof(riffSize64), 1, self->theFile); + fwrite(&dataSize64, sizeof(dataSize64), 1, self->theFile); + fwrite(&sampleCount64, sizeof(sampleCount64), 1, self->theFile); + + /* datasize32 */ + fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); + fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); + } + + fclose(self->theFile); + free(self); + + return __TWO_SUCCESS; +} + +#ifdef TWO_SUPPORT_BWF +static int CloseWavBWF( + WAVEFILEOUT* self, + WAVEOUT_LOUDNESSINFO bextData + ) +{ + int wordData; + + if (!self) return __TWO_ERROR; + + if (self->bextChunkOffset) { + /* Offset for Loudness Data in bext-chunk: 8: Chunk-Header, 412:prev.Data */ + fseek(self->theFile, self->bextChunkOffset+8+412, SEEK_SET); + + wordData = LittleEndian32(EncodeLoudness(bextData.loudnessVal)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.loudnessRange)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.maxTruePeakLevel)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.maxMomentaryLoudnes)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.maxShortTermLoudness)); + fwrite(&wordData, 2, 1, self->theFile); + } + + return CloseWav(self); +} +#endif + +/*------------- local subs ----------------*/ + +static __inline unsigned int BigEndian32(char a, char b, char c, char d) +{ +#ifdef __TWO_LE + return + (unsigned int) d << 24 | + (unsigned int) c << 16 | + (unsigned int) b << 8 | + (unsigned int) a ; +#else + return + (unsigned int) a << 24 | + (unsigned int) b << 16 | + (unsigned int) c << 8 | + (unsigned int) d ; +#endif +} + + +static __inline unsigned int LittleEndian32(unsigned int v) +{ +#ifdef __TWO_LE + return v; +#else + return + (v & 0x000000FF) << 24 | + (v & 0x0000FF00) << 8 | + (v & 0x00FF0000) >> 8 | + (v & 0xFF000000) >> 24 ; +#endif +} + + +/* signed version of the above */ +static __inline unsigned int LittleEndian32s(int v) +{ +#ifdef __TWO_LE + return v; +#else + return + (v & 0x000000FF) << 24 | + (v & 0x0000FF00) << 8 | + (v & 0x00FF0000) >> 8 | + (v & 0xFF000000) >> 24 ; +#endif +} + + +static __inline short LittleEndian16(short v) +{ +#ifdef __TWO_LE + return v; +#else + return ((v << 8) & 0xFF00) | ((v >> 8) & 0x00FF); +#endif +} + +static __inline TWO_UINT64 LittleEndian64(TWO_UINT64 v) +{ +#ifdef __TWO_LE + return v; +#else + return + (v & 0x00000000000000FF) << 56 | + (v & 0x000000000000FF00) << 40 | + (v & 0x0000000000FF0000) << 24 | + (v & 0x00000000FF000000) << 8 | + (v & 0x000000FF00000000) >> 8 | + (v & 0x0000FF0000000000) >> 24 | + (v & 0x00FF000000000000) >> 40 | + (v & 0xFF00000000000000) >> 56 ; +#endif +} + +#ifdef TWO_SUPPORT_BWF +static unsigned int EncodeLoudness(float x) +{ + int s = (x>0)-(x<0); + return (int)( x*100.0f + s*0.5f ); +} +#endif + +static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ) +{ + if (!self) return __TWO_ERROR; + + if ( (self->dataSize + ((TWO_UINT64)newbytes) ) > self->dataSizeLimit64 ) { + return __TWO_ERROR; + } + + return __TWO_SUCCESS; +} + +#endif /* __TINYWAVEOUT_C_H__ */ + + + diff --git a/lc3plus/tns_coder.c b/lc3plus/tns_coder.c new file mode 100755 index 0000000000..ff3883d2b5 --- /dev/null +++ b/lc3plus/tns_coder.c @@ -0,0 +1,374 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); +static void levdown(LC3_FLOAT* anxt, LC3_FLOAT* out_a, LC3_INT* len); +static void poly2rc(LC3_FLOAT* a, LC3_FLOAT* out, LC3_INT len); +static LC3_INT findRC_idx(const LC3_FLOAT* in1, const LC3_FLOAT* in2, LC3_FLOAT checkValue); + +void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen) +{ + LC3_INT i = 0, m = 0; + LC3_FLOAT sum = 0, tmp_buf[MAX_LEN] = {0}; + + for (m = -lag; m <= lag; m++) { + /* Append zeros and input vector */ + + zero_float(tmp_buf, abs(m)); + + move_float(&tmp_buf[abs(m)], in, inLen - abs(m)); + + /* Calculate sum */ + sum = 0; + + for (i = 0; i < inLen; i++) { + sum += in[i] * tmp_buf[i]; + } + + out[m + lag] = sum; + } +} + +void levinsonDurbin(LC3_FLOAT* r, LC3_FLOAT* out_lev, LC3_FLOAT* rc_unq, LC3_FLOAT* error, LC3_INT len) +{ + LC3_INT t = 0, i = 0, j = 0; + LC3_FLOAT g = 0, v = 0, sum = 0, buf_tmp[MAX_LEN] = {0}; + + g = r[1] / r[0]; + out_lev[0] = g; + + v = (1.0 - g * g) * r[0]; + rc_unq[0] = -g; + + for (t = 1; t < len; t++) { + zero_float(buf_tmp, len + 1); + + sum = 0; + for (i = 1; i <= t; i++) { + sum += out_lev[i - 1] * r[i]; + } + + g = (r[t + 1] - sum) / v; + + j = 1; + for (i = t - 1; i >= 0; i--) { + buf_tmp[j] = out_lev[j - 1] - g * out_lev[i]; + j++; + } + + move_float(&out_lev[1], &buf_tmp[1], len); + + out_lev[0] = g; + + v = v * (1 - g * g); + rc_unq[t] = -g; + } + + /* Reorder out_lev */ + out_lev[0] = 1; + j = 1; + for (i = len - 1; i >= 0; i--) { + buf_tmp[j] = -out_lev[i]; + j++; + } + + move_float(&out_lev[1], &buf_tmp[1], (len - 1)); + + out_lev[len] = rc_unq[len - 1]; + + *error = v; +} + +void levdown(LC3_FLOAT* anxt, LC3_FLOAT* out_a, LC3_INT* len) +{ + LC3_INT i = 0, j = 0; + LC3_FLOAT tmp_buf[8] = {0}, tmp_buf1[8] = {0}, tmp_buf2[8] = {0}, knxt = 0; + + /* Initial length = 9 */ + + /* Drop the leading 1 */ + + move_float(&tmp_buf[0], &anxt[1], (*len - 1)); + + *len = *len - 1; /* Lenght = 8 */ + + /* Last coefficient */ + knxt = tmp_buf[*len - 1]; /* At [7] */ + + *len = *len - 1; /* Lenght = 7 */ + + move_float(tmp_buf1, tmp_buf, *len); + + j = 0; + for (i = *len - 1; i >= 0; i--) { + tmp_buf2[j] = knxt * tmp_buf[i]; + j++; + } + + out_a[0] = 1; + for (i = 0; i < *len; i++) { + out_a[i + 1] = (tmp_buf1[i] - tmp_buf2[i]) / (1.0 - (LC3_FABS(knxt)) * (LC3_FABS(knxt))); + } + + *len = *len + 1; /* Length = 8 */ +} + +void poly2rc(LC3_FLOAT* a, LC3_FLOAT* out, LC3_INT len) +{ + LC3_INT k = 0, i = 0, len_old = 0; + LC3_FLOAT buf[9] = {0}; + + len_old = len; + + zero_float(out, len - 1); + + /* Length = 9 */ + + /* Normalize */ + for (i = 0; i < len; i++) { + a[i] = a[i] / a[0]; + } + + out[len - 1] = a[len - 1]; + + /* Process */ + for (k = len - 2; k >= 0; k--) { + levdown(a, buf, &len); + out[k] = buf[len - 1]; /* Store last value */ + + move_float(a, buf, len); + } + + /* Shift output array by one to the left to lose leading 1 */ + for (i = 0; i < len_old - 1; i++) { + out[i] = out[i + 1]; + } +} + +LC3_INT findRC_idx(const LC3_FLOAT* in1, const LC3_FLOAT* in2, LC3_FLOAT checkValue) +{ + LC3_INT i = 0, ret = 0; + + for (i = 0; i < 17; i++) { + if (checkValue <= in1[i] && checkValue > in2[i]) { + ret = i; + } + } + + return ret; +} + +void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, LC3_INT fs, LC3_INT N, LC3_INT frame_dms, LC3_INT nBits, + LC3_INT* order_out, LC3_INT* rc_idx, LC3_INT* tns_numfilters, LC3_INT* bits_out + , LC3_INT16 near_nyquist_flag +) +{ + LC3_INT i = 0, stopfreq[2] = {0}, startfreq[2] = {0}, f = 0, numfilters = 0, maxOrder = 0, bits = 0, sub = 0, + subdiv_startfreq = 0, subdiv_stopfreq = 0, j = 0, rc_idx_tmp[8] = {0}, order_tmp[8] = {0}, tmp = 0, tns = 0; + LC3_FLOAT minPGfac = 0, minPredictionGain = 0, maxPG = 0, xcorr_out[MAX_LEN] = {0}, buf_tmp[MAX_LEN] = {0}, sum = 0, + subdiv_len = 0, nSubdivisions = 0, r[9] = {0}, out_lev[9] = {0}, rc_unq[9] = {0}, error_lev = 0, predGain = 0, + alpha = 0, rc[8] = {0}, st[9] = {0}, s = 0, tmpSave = 0, tmp_fl = 0; + const LC3_INT* order; + + /* Init */ + + if (fs >= 32000 && frame_dms >= 50) { + numfilters = 2; + } else { + numfilters = 1; + } + + if (N > 40 * ((LC3_FLOAT) (frame_dms) / 10.0)) { + N = 40 * ((LC3_FLOAT) (frame_dms) / 10.0); + fs = 40000; + } + + if (numfilters == 1) { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + stopfreq[0] = N; + } else { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + startfreq[1] = N / 2 + 1; + stopfreq[0] = N / 2; + stopfreq[1] = N; + } + + switch (frame_dms) + { + case 25: + maxOrder = 4; + nSubdivisions = 2.0; + break; + case 50: + maxOrder = 4; + nSubdivisions = 2.0; + break; + case 100: + maxOrder = 8; + nSubdivisions = 3.0; + break; + } + + minPGfac = 0.85; + maxPG = 2; + minPredictionGain = 1.5; + + if ((frame_dms >= 50 && nBits >= 48 * ((LC3_FLOAT) frame_dms / 10.0)) || frame_dms == 25) { + maxPG = minPredictionGain; + } + + if ((frame_dms >= 50 && nBits >= 48 * ((LC3_FLOAT) frame_dms / 10.0)) || frame_dms == 25) { + order = order1_tns; + } else { + order = order2_tns; + } + + /* Processing */ + if (bw_cutoff_idx >= 3 && numfilters == 2) { + numfilters = 2; + startfreq[1] = bw_fcbin / 2 + 1; + stopfreq[0] = bw_fcbin / 2; + stopfreq[1] = bw_fcbin; + } else { + numfilters = 1; + stopfreq[0] = bw_fcbin; + } + + bits = 0; + + for (f = 0; f < numfilters; f++) { + subdiv_len = ((LC3_FLOAT)stopfreq[f] + 1.0 - (LC3_FLOAT)startfreq[f]) / nSubdivisions; + + zero_float(r, 9); + + for (sub = 1; sub <= nSubdivisions; sub++) { + subdiv_startfreq = floor(subdiv_len * (sub - 1)) + startfreq[f] - 1; + subdiv_stopfreq = floor(subdiv_len * sub) + startfreq[f] - 1; + + sum = 0; + for (i = subdiv_startfreq; i < subdiv_stopfreq; i++) { + sum += x[i] * x[i]; + } + + if (sum < LC3_EPS) + { + zero_float(r, 9); + r[0] = 1; + break; + } + + move_float(buf_tmp, &x[subdiv_startfreq], subdiv_stopfreq - subdiv_startfreq); + + xcorr(buf_tmp, xcorr_out, maxOrder, subdiv_stopfreq - subdiv_startfreq); + + j = 0; + for (i = maxOrder; i >= 0; i--) { + r[j] = r[j] + xcorr_out[i] / sum; + j++; + } + } + + for (i = 0; i <= maxOrder; i++) { + r[i] = r[i] * lagw_tns[i]; + } + + levinsonDurbin(r, out_lev, rc_unq, &error_lev, maxOrder); + + predGain = r[0] / error_lev; + + if (predGain > minPredictionGain && near_nyquist_flag == 0) { + tns = 1; + } else { + tns = 0; + } + + bits++; + + if (tns == 1) { + /* LPC weighting */ + if (predGain < maxPG) { + alpha = (maxPG - predGain) * (minPGfac - 1.0) / (maxPG - minPredictionGain) + 1.0; + + for (i = 0; i <= maxOrder; i++) { + out_lev[i] = out_lev[i] * LC3_POW(alpha, i); + } + + poly2rc(out_lev, rc_unq, maxOrder + 1); + } + + /* PARCOR Quantization */ + for (i = 0; i < maxOrder; i++) { + rc_idx_tmp[i] = findRC_idx(&quants_thr_tns[1], &quants_thr_tns[0], rc_unq[i]); + } + + /* Filter Order */ + j = 0; + for (i = 0; i < maxOrder; i++) { + rc[i] = quants_pts_tns[rc_idx_tmp[i]]; + + if (rc[i] != 0) { + order_tmp[j] = i + 1; + j++; + } + } + + order_out[f] = order_tmp[j - 1]; + // Disable TNS if order is 0: + if (order_out[f] == 0) { + tns = 0; + + // Jump to else statement + goto tns_disabled; + } + tmp = order[order_out[f] - 1]; + + /* Huffman Coding of PARCOR coefficients */ + for (i = 0; i <= order_out[f] - 1; i++) { + tmp += huff_bits_tns[i][rc_idx_tmp[i]]; + } + + bits = bits + ceil((LC3_FLOAT)tmp / 2048.0); + + j = 0; + for (i = f * 8; i <= f * 8 + order_out[f] - 1; i++) { + rc_idx[i] = rc_idx_tmp[j]; + j++; + } + } + + /* Filtering */ + if (tns == 1) { + for (i = startfreq[f]; i <= stopfreq[f]; i++) { + s = x[i - 1]; + tmpSave = s; + + for (j = 0; j < order_out[f] - 1; j++) { + tmp_fl = rc[j] * s + st[j]; + s += rc[j] * st[j]; + + st[j] = tmpSave; + tmpSave = tmp_fl; + } + + s += rc[order_out[f] - 1] * st[order_out[f] - 1]; + + st[order_out[f] - 1] = tmpSave; + x[i - 1] = s; + } + } + } +tns_disabled: + + *tns_numfilters = numfilters; + *bits_out = bits; +} diff --git a/lc3plus/tns_decoder.c b/lc3plus/tns_decoder.c new file mode 100755 index 0000000000..d3aeefc3a3 --- /dev/null +++ b/lc3plus/tns_decoder.c @@ -0,0 +1,52 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) +{ + LC3_INT startfreq[2] = {0}, stopfreq[2] = {0}, f = 0, i = 0, j = 0, m = 0, l = 0, rc_idx_f[9] = {0}; + LC3_FLOAT rc[9] = {0}, s = 0, st[9] = {0}; + + if (numfilters == 2) { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + stopfreq[0] = bw_fcbin / 2; + startfreq[1] = bw_fcbin / 2 + 1; + stopfreq[1] = bw_fcbin; + } else { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + stopfreq[0] = bw_fcbin; + } + + for (f = 0; f < numfilters; f++) { + if (order[f] > 0) { + j = 0; + + for (i = f * 8; i < f * 8 + 8; i++) { + rc_idx_f[j] = rc_idx[i]; + rc[j] = quants_pts_tns[rc_idx_f[j]]; + j++; + } + + for (m = startfreq[f]; m <= stopfreq[f]; m++) { + s = x[m - 1] - rc[order[f] - 1] * st[order[f] - 1]; + + for (l = order[f] - 2; l >= 0; l--) { + s = s - rc[l] * st[l]; + st[l + 1] = rc[l] * s + st[l]; + } + + st[0] = s; + x[m - 1] = s; + } + } + } +} diff --git a/lc3plus/util.h b/lc3plus/util.h new file mode 100755 index 0000000000..7ef6dedef7 --- /dev/null +++ b/lc3plus/util.h @@ -0,0 +1,222 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef UTIL_H +#define UTIL_H + +#include "clib.h" +#include "math.h" + +#ifdef _MSC_VER +/* strcasecmp is not available on visual studio */ +static LC3_INT strcasecmp(const char* a, const char* b) { + return _stricmp(a,b); +} +#endif + +/* restrict is not available on visual studio */ +#ifdef _MSC_VER +#define restrict __restrict +/* inline is not recognized in visual studio 13 required by matlab r2015a in win10 */ +#define inline __inline +#endif + +/* number of elements in array */ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +/* min max with no side effects */ +static inline LC3_INT imin(LC3_INT a, LC3_INT b) { return a < b ? a : b; } +static inline LC3_INT imax(LC3_INT a, LC3_INT b) { return a > b ? a : b; } + +/* restrict x to range [min, max] */ +static inline LC3_INT iclamp(LC3_INT min, LC3_INT x, LC3_INT max) { + return x < min ? min : x > max ? max : x; +} +static inline double fcmamp(double min, double x, double max) { + return x < min ? min : x > max ? max : x; +} +static inline LC3_FLOAT fclampf(LC3_FLOAT min, LC3_FLOAT x, LC3_FLOAT max) { + return x < min ? min : x > max ? max : x; +} + +/* x² */ +static inline LC3_FLOAT sqrf(LC3_FLOAT x) { return x * x; } + +/* convenience wrappers around memmove */ +static inline void move_float(LC3_FLOAT *dst, const LC3_FLOAT *src, LC3_INT len) { + memmove(dst, src, len * sizeof(LC3_FLOAT)); +} +static inline void move_int(LC3_INT *dst, const LC3_INT *src, LC3_INT len) { + memmove(dst, src, len * sizeof(LC3_INT)); +} + +/* convenience wrappers around memset */ +static inline void zero_float(LC3_FLOAT *x, LC3_INT len) { + memset(x, 0, len * sizeof(LC3_FLOAT)); +} +static inline void zero_int(LC3_INT *x, LC3_INT len) { + memset(x, 0, len * sizeof(LC3_INT)); +} + +/* multiply float vectors element by element, in-place */ +static inline void mult_vec(LC3_FLOAT *a, const LC3_FLOAT *b, + LC3_INT len) { + LC3_INT i = 0; + for (i = 0; i < len; i++) { + a[i] *= b[i]; + } +} + +/* multiply float vector with constant, in-place */ +static inline void mult_const(LC3_FLOAT *a, LC3_FLOAT b, LC3_INT len) { + LC3_INT i = 0; + for (i = 0; i < len; i++) { + a[i] *= b; + } +} + +/* sum of vector */ +static inline LC3_FLOAT sum_vec(const LC3_FLOAT *x, LC3_INT len) { + LC3_FLOAT sum = 0; + LC3_INT i = 0; + for (i = 0; i < len; i++) { + sum += x[i]; + } + return sum; +} + +/* complex constructor */ +static inline Complex cmplx(LC3_FLOAT r, LC3_FLOAT i) { return (Complex){r, i}; } + +/* complex a + b */ +static inline Complex cadd(Complex a, Complex b) { + return cmplx(a.r + b.r, a.i + b.i); +} + +/* complex a * b */ +static inline Complex cmul(Complex a, Complex b) { + return cmplx(a.r * b.r - a.i * b.i, a.i * b.r + a.r * b.i); +} + +/* mac operator */ +static inline LC3_FLOAT mac_loop(const LC3_FLOAT *array1, const LC3_FLOAT *array2, LC3_INT len) +{ + LC3_INT i; + LC3_FLOAT sum = 0.0; + + for (i = 0; i < len; i++) + { + sum += (*array1++) * (*array2++); + } + + return sum; +} + +/* complex eᶦˣ */ +static inline Complex cexpi(LC3_FLOAT x) { return cmplx(LC3_COS(x), LC3_SIN(x)); } + +/* complex -x */ +static inline Complex cneg(Complex x) { return cmplx(-x.r, -x.i); } + +/* convert string to number. return true on success */ +static inline bool str_to_int(const char *str, LC3_INT *value) { + char *end = NULL; + long v = str ? strtol(str, &end, 0) : 0; + *value = (LC3_INT)v; + return str && *end == 0 && v >= INT_MIN && v <= INT_MAX; +} + +/* returns true if str ends with str ends with suffix. ignoring case. str may be + * NULL */ +static inline bool str_ends_with(const char *str, const char *suffix) { + char *tmp = str ? strrchr(str, suffix[0]) : NULL; + return tmp && !strcasecmp(tmp, suffix); +} + +/* complex a - b */ +static inline Complex csub(Complex a, Complex b) { + return cmplx(a.r - b.r, a.i - b.i); +} + +static inline void move_cmplx(Complex *dst, const Complex *src, LC3_INT32 len) { + if (len > 0) { + memmove(dst, src, len * sizeof(Complex)); + assert(src[len - 1].r == dst[len - 1].r && src[len - 1].i == dst[len - 1].i); /*check that Cmplx is stored contiguously*/ + assert(src[0].r == dst[0].r && src[0].i == dst[0].i); /*check that Cmplx is stored contiguously*/ + } +} + +static inline void zero_cmplx(Complex *x, LC3_INT32 len) { + if(len > 0) { + memset(x, 0, len * sizeof(Complex)); + assert(x[0].r == 0 && x[0].i == 0 && x[len-1].r == 0 && x[len-1].i == 0); + } +} + +static inline Complex realtoc(LC3_FLOAT r) { return cmplx(r, 0); } + +/* set float vector to constant */ +static inline void set_vec(const LC3_FLOAT c, LC3_FLOAT *x, LC3_INT32 len) { + LC3_INT32 i = 0; + for (i = 0; i < len; i++) { + x[i] = c; + } +} + +/* set float vector to constant */ +static inline void set_vec_int(const LC3_INT32 c, LC3_INT32 *x, LC3_INT32 len) { + LC3_INT32 i = 0; + for (i = 0; i < len; i++) { + x[i] = c; + } +} + +static inline LC3_INT32 clz_func(LC3_INT32 inp) +{ +#if defined(__clang__) || defined(__GNUC__) + if (inp == 0) + { + return 0; + } + return __builtin_clz(inp); + +#elif defined(_WIN32) || defined(_WIN64) + LC3_INT32 leading_zero = 0; + + if (_BitScanReverse(&leading_zero, inp)) + { + return 31 - leading_zero; + } + else + return 0; + +#else + LC3_INT32 i = 0; + int64_t x = inp; + + if (inp == 0) + { + return 0; + } + + inp = (inp < 0) ? ~inp : inp; + + while (x < (int64_t)0x80000000L) + { + inp <<= 1; + i += 1; + } + + return i; +#endif +} + + +#endif diff --git a/lib_rend/ivas_lc3plus_common.c b/lib_rend/ivas_lc3plus_common.c index 3b12f78be5..1f0dea1043 100644 --- a/lib_rend/ivas_lc3plus_common.c +++ b/lib_rend/ivas_lc3plus_common.c @@ -32,7 +32,7 @@ #include "ivas_lc3plus_common.h" #include "ivas_error.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ) { diff --git a/lib_rend/ivas_lc3plus_common.h b/lib_rend/ivas_lc3plus_common.h index 01971679d2..eae0a5396b 100644 --- a/lib_rend/ivas_lc3plus_common.h +++ b/lib_rend/ivas_lc3plus_common.h @@ -34,7 +34,7 @@ #include #include "ivas_error.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" /*! common configuration parameters between encoder and decoder */ typedef struct LC3PLUS_CONFIG diff --git a/lib_rend/ivas_lc3plus_dec.c b/lib_rend/ivas_lc3plus_dec.c index f81d7fd176..45d56d3c63 100644 --- a/lib_rend/ivas_lc3plus_dec.c +++ b/lib_rend/ivas_lc3plus_dec.c @@ -34,7 +34,7 @@ #include "ivas_prot.h" #include "ivas_lc3plus_dec.h" #include "ivas_lc3plus_common.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error_utils.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h index 38abf70bd6..f834f4dcd8 100644 --- a/lib_rend/ivas_lc3plus_dec.h +++ b/lib_rend/ivas_lc3plus_dec.h @@ -33,7 +33,7 @@ #pragma once #include -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error.h" #include "ivas_lc3plus_common.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_lc3plus_enc.c b/lib_rend/ivas_lc3plus_enc.c index 758299c067..1b655c6ce9 100644 --- a/lib_rend/ivas_lc3plus_enc.c +++ b/lib_rend/ivas_lc3plus_enc.c @@ -32,7 +32,7 @@ #include "ivas_lc3plus_enc.h" #include "ivas_lc3plus_common.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error_utils.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_lc3plus_enc.h b/lib_rend/ivas_lc3plus_enc.h index e1edd9016c..1eea994a7e 100644 --- a/lib_rend/ivas_lc3plus_enc.h +++ b/lib_rend/ivas_lc3plus_enc.h @@ -33,7 +33,7 @@ #pragma once #include -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error.h" #include "ivas_lc3plus_common.h" diff --git a/lib_rend/lc3plus_codec/.gitignore b/lib_rend/lc3plus_codec/.gitignore deleted file mode 100644 index 5514f3a7bc..0000000000 --- a/lib_rend/lc3plus_codec/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228 -package.info -lc3plus_sources.zip \ No newline at end of file diff --git a/lib_rend/lc3plus_codec/README.md b/lib_rend/lc3plus_codec/README.md deleted file mode 100644 index 4dc05171ab..0000000000 --- a/lib_rend/lc3plus_codec/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Download and unzip LC3plus - -1. Download the V1.4.1 version of the LC3plus source code from ETSI: https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip -2. Unzip it into this folder. After unzipping, the path to the `Readme.txt` of the LC3plus sources must be: `lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/Readme.txt` -3. Apply the `lc3plus.patch`, for example by using the command `git apply --ignore-whitespace lc3plus.patch` -4. Remove files `ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c` `ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c` diff --git a/lib_rend/lc3plus_codec/get_lc3plus.ps1 b/lib_rend/lc3plus_codec/get_lc3plus.ps1 deleted file mode 100755 index d660f78310..0000000000 --- a/lib_rend/lc3plus_codec/get_lc3plus.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -# This script shall only be used by automated continuous integration systems -# Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md -Remove-Item -Force -Recurse ETSI_Release -ErrorAction 'silentlycontinue' -(new-object System.Net.WebClient).DownloadFile('https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip',"$(pwd)\lc3plus_sources.zip") -Expand-Archive -Force -Path .\lc3plus_sources.zip -DestinationPath . -Remove-Item -Force lc3plus_sources.zip -git apply --ignore-whitespace lc3plus.patch -Remove-Item -Force ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\fft.c -Remove-Item -Force ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\codec_exe.c diff --git a/lib_rend/lc3plus_codec/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh similarity index 53% rename from lib_rend/lc3plus_codec/get_lc3plus.sh rename to scripts/lc3plus_lib_setup/get_lc3plus.sh index f605c98688..51ead5aab2 100755 --- a/lib_rend/lc3plus_codec/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -1,8 +1,25 @@ +#!/usr/bin/env bash + # This script shall only be used by automated continuous integration systems -# Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md + +scriptdir=$(dirname "$0") +pushd "$scriptdir" || exit 1 + +# Download and unzip LC3plus code rm -rf ETSI_Release curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip unzip lc3plus_sources.zip -d . -rm -f lc3plus_sources.zip + +# Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) git apply --ignore-whitespace lc3plus.patch rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c + +# Move to output dir +rm -rf ../../lc3plus +mkdir ../../lc3plus +mv ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/* ../../lc3plus + +# Clean up +rm -rf lc3plus_sources.zip ETSI_Release + +popd || exit diff --git a/lib_rend/lc3plus_codec/lc3plus.patch b/scripts/lc3plus_lib_setup/lc3plus.patch similarity index 77% rename from lib_rend/lc3plus_codec/lc3plus.patch rename to scripts/lc3plus_lib_setup/lc3plus.patch index 816f664fef..9435fb4d22 100644 --- a/lib_rend/lc3plus_codec/lc3plus.patch +++ b/scripts/lc3plus_lib_setup/lc3plus.patch @@ -1,6 +1,6 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -11,7 +11,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -32,7 +32,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin blacklist[0] = 0; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -43,7 +43,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -83,7 +83,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin nbits_ari = nbits_ari + 8; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -94,7 +94,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -105,7 +105,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* DCT */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -116,7 +116,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -164,7 +164,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -193,7 +193,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (*lastnz > N) { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -214,7 +214,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin # ifdef ENABLE_025_DMS_MODE diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-06-29 12:58:27 @@ -24,13 +24,13 @@ typedef uint32_t LC3_UINT32; @@ -244,7 +244,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define LC3_SQRT(x) (sqrtf(x)) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -264,7 +264,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin brickwall = 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -289,7 +289,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* LSB mode bit */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -300,7 +300,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -331,7 +331,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-06-29 12:58:27 @@ -8,7 +8,7 @@ ******************************************************************************/ @@ -343,7 +343,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include /* for abs() */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-06-29 12:58:27 @@ -8,14 +8,15 @@ ******************************************************************************/ @@ -389,7 +389,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-06-29 12:58:27 @@ -12,6 +12,7 @@ #define IIS_FFT_H @@ -400,7 +400,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #ifdef __cplusplus diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -411,7 +411,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include /* for mmove */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-06-29 12:58:27 @@ -11,6 +11,7 @@ #ifndef IISFFT_H #define IISFFT_H @@ -422,7 +422,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define M_PIl 3.1415926535897932384626433832795029L /* pi */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -433,7 +433,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* Function expects already flipped window */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -564,7 +564,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin encoder->epmode = oldEpmode; // preserve old epmode in case of failure diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-06-29 12:58:27 @@ -0,0 +1,99 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * @@ -667,7 +667,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin +} diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -678,7 +678,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -689,7 +689,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -717,7 +717,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -726,27 +726,56 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include "functions.h" void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 1970-01-01 01:00:00 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 2023-06-29 12:58:27 +@@ -0,0 +1 @@ ++Win32/ +\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-06-12 14:50:03 -@@ -26,31 +26,18 @@ - - - ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-06-29 12:58:27 +@@ -1,243 +1,184 @@ +- +- +- +- +- Debug +- Win32 +- +- +- Debug +- x64 +- +- +- Release +- Win32 +- +- +- Release +- x64 +- +- +- +- {95030B82-70CD-4C6B-84D4-61096035BEA2} +- Win32Proj +- LC3_FL +- 10.0.17763.0 +- +- +- - Application -+ StaticLibrary - true - v141 - Unicode - - +- true +- v141 +- Unicode +- +- - Application -+ StaticLibrary - false - v141 - true - Unicode - +- false +- v141 +- true +- Unicode +- - - Application - true @@ -760,59 +789,62 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin - true - Unicode - - - - -@@ -62,12 +49,6 @@ - - - +- +- +- +- +- +- +- +- +- +- +- - - - - - - - - - true -@@ -75,30 +56,20 @@ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - +- +- +- true +- LC3plus +- $(Platform)\$(Configuration)\ +- $(Platform)\$(Configuration)\Obj\ +- - - true - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - false - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - +- +- false +- LC3plus +- $(Platform)\$(Configuration)\ +- $(Platform)\$(Configuration)\Obj\ +- - - false - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - - - - Level3 -+ ..\..\..\..\..\..\..\lib_com;%(AdditionalIncludeDirectories) - Disabled -+ MultiThreadedDebug - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - 4305;4244;4996 - -@@ -107,25 +78,14 @@ - true - - +- +- +- +- +- Level3 +- Disabled +- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) +- 4305;4244;4996 +- +- +- Console +- true +- +- - - - @@ -826,21 +858,24 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin - true - - - - - Level3 - - -+ ..\..\..\..\..\..\..\lib_com;%(AdditionalIncludeDirectories) - MaxSpeed -+ MultiThreaded - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) -@@ -138,31 +98,12 @@ - true - - +- +- +- Level3 +- +- +- MaxSpeed +- true +- true +- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) +- 4244;4305;4996 +- +- +- Console +- true +- true +- true +- +- - - - Level3 @@ -859,28 +894,278 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin - true - - - - - - - - +- +- +- +- +- +- - - - - -@@ -173,7 +114,7 @@ - - - +- +- +- +- +- +- +- +- +- +- - +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ Debug ++ Win32 ++ ++ ++ Debug ++ x64 ++ ++ ++ Release ++ Win32 ++ ++ ++ Release ++ x64 ++ ++ ++ ++ {95030B82-70CD-4C6B-84D4-61096035BEA2} ++ Win32Proj ++ LC3_FL ++ 10.0.17763.0 ++ ++ ++ ++ StaticLibrary ++ true ++ v141 ++ Unicode ++ ++ ++ StaticLibrary ++ false ++ v141 ++ true ++ Unicode ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ true ++ LC3plus ++ $(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\Obj\ ++ ++ ++ false ++ LC3plus ++ $(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\Obj\ ++ ++ ++ ++ ++ ++ Level3 ++ ..\..\lib_com;%(AdditionalIncludeDirectories) ++ Disabled ++ MultiThreadedDebug ++ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ++ 4305;4244;4996 ++ ++ ++ Console ++ true ++ ++ ++ ++ ++ Level3 ++ ++ ++ ..\..\lib_com;%(AdditionalIncludeDirectories) ++ MaxSpeed ++ MultiThreaded ++ true ++ true ++ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ++ 4244;4305;4996 ++ ++ ++ Console ++ true ++ true ++ true ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + - - - ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-12 12:10:26 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35 @@ -8,15 +8,16 @@ ******************************************************************************/ @@ -902,7 +1187,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -913,7 +1198,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -924,7 +1209,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -935,7 +1220,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -946,7 +1231,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -957,7 +1242,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -968,7 +1253,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -979,7 +1264,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -990,7 +1275,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1001,7 +1286,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1012,7 +1297,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1023,7 +1308,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1052,7 +1337,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (prev_bfi_plc2 == 0) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1063,7 +1348,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1074,7 +1359,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1085,7 +1370,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1096,7 +1381,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1107,7 +1392,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1118,7 +1403,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1129,7 +1414,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1140,7 +1425,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1167,7 +1452,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1211,7 +1496,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-12 12:10:26 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-29 12:58:35 @@ -6,13 +6,14 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * @@ -1244,7 +1529,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1255,7 +1540,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1266,7 +1551,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-12 12:10:26 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-29 12:58:35 @@ -6,16 +6,17 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * @@ -1309,7 +1594,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin return; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1320,7 +1605,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin \***************************************************************************/ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1331,7 +1616,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1341,8 +1626,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-12 12:26:35 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-12 12:28:54 +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1353,7 +1638,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static LC3_INT sign(LC3_FLOAT x); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1364,7 +1649,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1415,7 +1700,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1426,7 +1711,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1437,7 +1722,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1448,7 +1733,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1493,7 +1778,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1545,7 +1830,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin setup->targetBitsInit = setup->targetBitsInit - 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1565,7 +1850,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* Downsampling */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1576,7 +1861,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1587,7 +1872,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-06-29 12:58:27 @@ -17,6 +17,7 @@ #include #include @@ -1598,7 +1883,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1609,7 +1894,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index c62bc08b9f..01dffb2978 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -63,6 +63,7 @@ mkdir $targetdir # copy files from source-dir cp -R ../lib_* $targetdir +cp -R ../lc3plus $targetdir cp -R ../apps $targetdir cp -R ../Makefile $targetdir cp -R ../CMakeLists.txt $targetdir @@ -102,14 +103,10 @@ shopt -u extglob # patch code before wmc_tool: replace hexadecimal unsigned long constants (0x...UL) by regular integer constant + cast to unsigned long find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; -lc3plus_main_dir="lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/*.c" -lc3plus_fft_dir="lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/*.c" - # run wmc_tool "tools/$system/wmc_tool" -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null -"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" "$targetdir/$lc3plus_main_dir" "$targetdir/$lc3plus_fft_dir" >> /dev/null "tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" >> /dev/null -"tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null +"tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lc3plus/*.c" "$targetdir/lc3plus/fft/*.c" >> /dev/null # automatically enable #define WMOPS in options.h sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h -- GitLab From addfef1efb5bf82312fed1084b993ffb4a331781 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 5 Jul 2023 16:08:06 +0200 Subject: [PATCH 252/591] add lc3plus source files --- .gitlab-ci.yml | 16 + CMakeLists.txt | 20 +- Makefile | 27 +- Workspace_msvc/Workspace_msvc.sln | 2 +- Workspace_msvc/lib_com.vcxproj | 6 +- Workspace_msvc/lib_dec.vcxproj | 6 +- Workspace_msvc/lib_enc.vcxproj | 6 +- Workspace_msvc/lib_rend.vcxproj | 8 +- Workspace_msvc/lib_util.vcxproj | 4 +- Workspace_msvc/renderer.vcxproj | 6 +- lc3plus/adjust_global_gain.c | 86 + lc3plus/al_fec_fl.c | 2329 ++++++++++ lc3plus/apply_global_gain.c | 21 + lc3plus/ari_codec.c | 1122 +++++ lc3plus/attack_detector.c | 105 + lc3plus/clib.h | 27 + lc3plus/constants.c | 3803 +++++++++++++++++ lc3plus/constants.h | 203 + lc3plus/cutoff_bandwidth.c | 27 + lc3plus/dct4.c | 95 + lc3plus/dec_entropy.c | 277 ++ lc3plus/dec_lc3_fl.c | 365 ++ lc3plus/defines.h | 238 ++ lc3plus/detect_cutoff_warped.c | 84 + lc3plus/enc_entropy.c | 126 + lc3plus/enc_lc3_fl.c | 270 ++ lc3plus/estimate_global_gain.c | 128 + lc3plus/fft/cfft.c | 421 ++ lc3plus/fft/cfft.h | 42 + lc3plus/fft/fft_15_16.h | 401 ++ lc3plus/fft/fft_240_480.h | 185 + lc3plus/fft/fft_2_9.h | 278 ++ lc3plus/fft/fft_32.h | 467 ++ lc3plus/fft/fft_384_768.h | 103 + lc3plus/fft/fft_60_128.h | 161 + lc3plus/fft/fft_generic.h | 699 +++ lc3plus/fft/iis_fft.c | 164 + lc3plus/fft/iis_fft.h | 142 + lc3plus/fft/iisfft.c | 166 + lc3plus/fft/iisfft.h | 86 + lc3plus/functions.h | 304 ++ lc3plus/imdct.c | 102 + lc3plus/lc3.c | 431 ++ lc3plus/lc3.h | 517 +++ lc3plus/lc3plus_fft.c | 99 + lc3plus/license.h | 22 + lc3plus/ltpf_coder.c | 264 ++ lc3plus/ltpf_decoder.c | 356 ++ lc3plus/makefile | 143 + lc3plus/mdct.c | 128 + lc3plus/mdct_shaping.c | 23 + lc3plus/msvc/.gitignore | 1 + lc3plus/msvc/LC3plus.sln | 28 + lc3plus/msvc/LC3plus.vcxproj | 184 + lc3plus/near_nyquist_detector.c | 38 + lc3plus/noise_factor.c | 112 + lc3plus/noise_filling.c | 81 + lc3plus/olpa.c | 144 + lc3plus/pc_apply.c | 73 + lc3plus/pc_classify.c | 170 + lc3plus/pc_main.c | 43 + lc3plus/pc_update.c | 37 + lc3plus/per_band_energy.c | 59 + lc3plus/plc_classify.c | 199 + lc3plus/plc_compute_stab_fac.c | 64 + lc3plus/plc_damping_scrambling.c | 206 + lc3plus/plc_main.c | 209 + lc3plus/plc_noise_substitution.c | 22 + lc3plus/plc_noise_substitution0.c | 14 + lc3plus/plc_phecu_f0_refine_first.c | 75 + lc3plus/plc_phecu_fec_hq.c | 159 + lc3plus/plc_phecu_hq_ecu.c | 116 + lc3plus/plc_phecu_lf_peak_analysis.c | 112 + lc3plus/plc_phecu_rec_frame.c | 147 + lc3plus/plc_phecu_setf0hz.c | 28 + lc3plus/plc_phecu_spec_ana.c | 599 +++ lc3plus/plc_phecu_subst_spec.c | 247 ++ lc3plus/plc_phecu_tba_per_band_gain.c | 44 + lc3plus/plc_phecu_tba_spect_Xavg.c | 45 + lc3plus/plc_phecu_tba_trans_dect_gains.c | 320 ++ lc3plus/plc_phecu_trans_burst_ana_sub.c | 48 + lc3plus/plc_tdc.c | 763 ++++ lc3plus/plc_tdc_tdac.c | 80 + lc3plus/plc_update.c | 125 + lc3plus/quantize_spec.c | 196 + lc3plus/reorder_bitstream.c | 41 + lc3plus/resamp12k8.c | 107 + lc3plus/residual_coding.c | 76 + lc3plus/residual_decoding.c | 97 + lc3plus/setup_com_lc3.c | 30 + lc3plus/setup_dec_lc3.c | 444 ++ lc3plus/setup_dec_lc3.h | 112 + lc3plus/setup_enc_lc3.c | 546 +++ lc3plus/setup_enc_lc3.h | 119 + lc3plus/sns_compute_scf.c | 177 + lc3plus/sns_interpolate_scf.c | 90 + lc3plus/sns_quantize_scf.c | 517 +++ lc3plus/structs.h | 186 + lc3plus/tinywavein_c.h | 605 +++ lc3plus/tinywaveout_c.h | 892 ++++ lc3plus/tns_coder.c | 374 ++ lc3plus/tns_decoder.c | 52 + lc3plus/util.h | 222 + lib_rend/ivas_lc3plus_common.c | 2 +- lib_rend/ivas_lc3plus_common.h | 2 +- lib_rend/ivas_lc3plus_dec.c | 2 +- lib_rend/ivas_lc3plus_dec.h | 2 +- lib_rend/ivas_lc3plus_enc.c | 2 +- lib_rend/ivas_lc3plus_enc.h | 2 +- lib_rend/lc3plus_codec/.gitignore | 3 - lib_rend/lc3plus_codec/README.md | 6 - lib_rend/lc3plus_codec/get_lc3plus.ps1 | 9 - .../lc3plus_lib_setup}/get_lc3plus.sh | 21 +- .../lc3plus_lib_setup}/lc3plus.patch | 595 ++- scripts/prepare_instrumentation.sh | 7 +- 115 files changed, 25012 insertions(+), 227 deletions(-) create mode 100755 lc3plus/adjust_global_gain.c create mode 100755 lc3plus/al_fec_fl.c create mode 100755 lc3plus/apply_global_gain.c create mode 100755 lc3plus/ari_codec.c create mode 100755 lc3plus/attack_detector.c create mode 100755 lc3plus/clib.h create mode 100755 lc3plus/constants.c create mode 100755 lc3plus/constants.h create mode 100755 lc3plus/cutoff_bandwidth.c create mode 100755 lc3plus/dct4.c create mode 100755 lc3plus/dec_entropy.c create mode 100755 lc3plus/dec_lc3_fl.c create mode 100755 lc3plus/defines.h create mode 100755 lc3plus/detect_cutoff_warped.c create mode 100755 lc3plus/enc_entropy.c create mode 100755 lc3plus/enc_lc3_fl.c create mode 100755 lc3plus/estimate_global_gain.c create mode 100755 lc3plus/fft/cfft.c create mode 100755 lc3plus/fft/cfft.h create mode 100755 lc3plus/fft/fft_15_16.h create mode 100755 lc3plus/fft/fft_240_480.h create mode 100755 lc3plus/fft/fft_2_9.h create mode 100755 lc3plus/fft/fft_32.h create mode 100755 lc3plus/fft/fft_384_768.h create mode 100755 lc3plus/fft/fft_60_128.h create mode 100755 lc3plus/fft/fft_generic.h create mode 100755 lc3plus/fft/iis_fft.c create mode 100755 lc3plus/fft/iis_fft.h create mode 100755 lc3plus/fft/iisfft.c create mode 100755 lc3plus/fft/iisfft.h create mode 100755 lc3plus/functions.h create mode 100755 lc3plus/imdct.c create mode 100755 lc3plus/lc3.c create mode 100755 lc3plus/lc3.h create mode 100644 lc3plus/lc3plus_fft.c create mode 100755 lc3plus/license.h create mode 100755 lc3plus/ltpf_coder.c create mode 100755 lc3plus/ltpf_decoder.c create mode 100755 lc3plus/makefile create mode 100755 lc3plus/mdct.c create mode 100755 lc3plus/mdct_shaping.c create mode 100644 lc3plus/msvc/.gitignore create mode 100755 lc3plus/msvc/LC3plus.sln create mode 100755 lc3plus/msvc/LC3plus.vcxproj create mode 100755 lc3plus/near_nyquist_detector.c create mode 100755 lc3plus/noise_factor.c create mode 100755 lc3plus/noise_filling.c create mode 100755 lc3plus/olpa.c create mode 100755 lc3plus/pc_apply.c create mode 100755 lc3plus/pc_classify.c create mode 100755 lc3plus/pc_main.c create mode 100755 lc3plus/pc_update.c create mode 100755 lc3plus/per_band_energy.c create mode 100755 lc3plus/plc_classify.c create mode 100755 lc3plus/plc_compute_stab_fac.c create mode 100755 lc3plus/plc_damping_scrambling.c create mode 100755 lc3plus/plc_main.c create mode 100755 lc3plus/plc_noise_substitution.c create mode 100755 lc3plus/plc_noise_substitution0.c create mode 100755 lc3plus/plc_phecu_f0_refine_first.c create mode 100755 lc3plus/plc_phecu_fec_hq.c create mode 100755 lc3plus/plc_phecu_hq_ecu.c create mode 100755 lc3plus/plc_phecu_lf_peak_analysis.c create mode 100755 lc3plus/plc_phecu_rec_frame.c create mode 100755 lc3plus/plc_phecu_setf0hz.c create mode 100755 lc3plus/plc_phecu_spec_ana.c create mode 100755 lc3plus/plc_phecu_subst_spec.c create mode 100755 lc3plus/plc_phecu_tba_per_band_gain.c create mode 100755 lc3plus/plc_phecu_tba_spect_Xavg.c create mode 100755 lc3plus/plc_phecu_tba_trans_dect_gains.c create mode 100755 lc3plus/plc_phecu_trans_burst_ana_sub.c create mode 100755 lc3plus/plc_tdc.c create mode 100755 lc3plus/plc_tdc_tdac.c create mode 100755 lc3plus/plc_update.c create mode 100755 lc3plus/quantize_spec.c create mode 100755 lc3plus/reorder_bitstream.c create mode 100755 lc3plus/resamp12k8.c create mode 100755 lc3plus/residual_coding.c create mode 100755 lc3plus/residual_decoding.c create mode 100755 lc3plus/setup_com_lc3.c create mode 100755 lc3plus/setup_dec_lc3.c create mode 100755 lc3plus/setup_dec_lc3.h create mode 100755 lc3plus/setup_enc_lc3.c create mode 100755 lc3plus/setup_enc_lc3.h create mode 100755 lc3plus/sns_compute_scf.c create mode 100755 lc3plus/sns_interpolate_scf.c create mode 100755 lc3plus/sns_quantize_scf.c create mode 100755 lc3plus/structs.h create mode 100755 lc3plus/tinywavein_c.h create mode 100755 lc3plus/tinywaveout_c.h create mode 100755 lc3plus/tns_coder.c create mode 100755 lc3plus/tns_decoder.c create mode 100755 lc3plus/util.h delete mode 100644 lib_rend/lc3plus_codec/.gitignore delete mode 100644 lib_rend/lc3plus_codec/README.md delete mode 100755 lib_rend/lc3plus_codec/get_lc3plus.ps1 rename {lib_rend/lc3plus_codec => scripts/lc3plus_lib_setup}/get_lc3plus.sh (53%) rename {lib_rend/lc3plus_codec => scripts/lc3plus_lib_setup}/lc3plus.patch (77%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b75ffe37f..c0d30e9e53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -732,6 +732,22 @@ selection-test-processing: when: on_failure expire_in: 1 week +lc3plus-ensure-no-code-changes: + extends: + - .test-job-linux + - .rules-merge-request + stage: validate + needs: [] + timeout: "5 minutes" + script: + # Replace code commited to repo with code downloaded from ETSI + - ./scripts/lc3plus_lib_setup/get_lc3plus.sh + + # Ensure git reports no changes + - modified_files=$(git status -s) + - if [[ $modified_files ]]; then printf 'LC3plus codebase was modified!\n\n'"$modified_files"'\n\n'; exit $EXIT_CODE_FAIL; fi + + # --------------------------------------------------------------- # Test jobs for main branch # --------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d468dfeac..7a6cc317ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ add_library(lib_com ${libComSrcs} ${libComHeaders}) if(UNIX) target_link_libraries(lib_com PRIVATE m) endif() -target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug) +target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug lc3plus) file(GLOB libDebugSrcs "lib_debug/*.c") file(GLOB libDebugHeaders "lib_debug/*.h") @@ -130,18 +130,14 @@ file(GLOB libEncSrcs "lib_enc/*.c") file(GLOB libEncHeaders "lib_enc/*.h") add_library(lib_enc ${libEncSrcs} ${libEncHeaders}) target_link_libraries(lib_enc lib_com lib_debug) -target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend) +target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend lc3plus) -set(lc3plus_floating_point_dir ${CMAKE_CURRENT_SOURCE_DIR}/lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point) -if(NOT EXISTS ${lc3plus_floating_point_dir}) - MESSAGE(FATAL_ERROR "${lc3plus_floating_point_dir} does not exist. Please follow instructions in lib_rend/lc3plus_codec/README.md and download the LC3plus codec") -endif() -file(GLOB libLC3plusSrcs "${lc3plus_floating_point_dir}/*.c") -file(GLOB libLC3plusHeaders "${lc3plus_floating_point_dir}/*.h") -file(GLOB libLC3plusFftSrcs "${lc3plus_floating_point_dir}/fft/*.c") -file(GLOB libLC3plusFftHeaders "${lc3plus_floating_point_dir}/fft/*.h") +file(GLOB libLC3plusSrcs "lc3plus/*.c") +file(GLOB libLC3plusHeaders "lc3plus/*.h") +file(GLOB libLC3plusFftSrcs "lc3plus/fft/*.c") +file(GLOB libLC3plusFftHeaders "lc3plus/fft/*.h") add_library(lc3plus ${libLC3plusSrcs} ${libLC3plusFftSrcs} ${libLC3plusHeaders} ${libLC3plusFftHeaders}) -target_include_directories(lc3plus PUBLIC ${floating_point_dir} PRIVATE ${floating_point_dir}/fft ) +target_include_directories(lc3plus PUBLIC lc3plus PRIVATE lc3plus/fft ) target_link_libraries(lc3plus lib_com) # For including options.h, which is needed for instrumentation to work correctly if(WMOPS) target_link_libraries(lc3plus lib_debug) @@ -165,7 +161,7 @@ target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc) file(GLOB libUtilSrcs "lib_util/*.c") file(GLOB libUtilHeaders "lib_util/*.h") add_library(lib_util ${libUtilSrcs} ${libUtilHeaders}) -target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug) +target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug lc3plus) if(NOT WMOPS) file(GLOB unitTestIvasLc3plusSrcs "scripts/split_rendering/lc3plus/*.c") diff --git a/Makefile b/Makefile index baf4a1ead7..d14ddfbd1b 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,14 @@ SRC_LIBCOM = lib_com SRC_LIBDEBUG = lib_debug SRC_LIBDEC = lib_dec SRC_LIBENC = lib_enc -SRC_LIBREND = lib_rend lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft +SRC_LIBREND = lib_rend +SRC_LC3PLUS = lc3plus lc3plus/fft SRC_LIBUTIL = lib_util SRC_APP = apps BUILD = build OBJDIR = obj -SRC_DIRS = $(sort -u $(SRC_LIBCOM) $(SRC_LIBDEBUG) $(SRC_LIBDEC) $(SRC_LIBENC) $(SRC_LIBREND) $(SRC_LIBUTIL) $(SRC_APP)) +SRC_DIRS = $(sort -u $(SRC_LIBCOM) $(SRC_LIBDEBUG) $(SRC_LIBDEC) $(SRC_LIBENC) $(SRC_LIBREND) $(SRC_LC3PLUS) $(SRC_LIBUTIL) $(SRC_APP)) # Name of CLI binaries CLI_APIDEC ?= IVAS_dec @@ -22,6 +23,7 @@ LIB_LIBDEBUG ?= libivasdebug.a LIB_LIBDEC ?= libivasdec.a LIB_LIBENC ?= libivasenc.a LIB_LIBREND ?= libivasrend.a +LIB_LC3PLUS ?= liblc3plus.a LIB_LIBUTIL ?= libivasutil.a # Default tool settings @@ -118,6 +120,7 @@ SRCS_LIBDEBUG = $(foreach DIR,$(SRC_LIBDEBUG),$(patsubst $(DIR)/%,%,$(wildcard $ SRCS_LIBDEC = $(foreach DIR,$(SRC_LIBDEC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) SRCS_LIBENC = $(foreach DIR,$(SRC_LIBENC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) SRCS_LIBREND = $(foreach DIR,$(SRC_LIBREND),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) +SRCS_LC3PLUS = $(foreach DIR,$(SRC_LC3PLUS),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) SRCS_LIBUTIL = $(foreach DIR,$(SRC_LIBUTIL),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))) OBJS_LIBCOM = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.o)) @@ -125,13 +128,14 @@ OBJS_LIBDEBUG = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEBUG:.c=.o)) OBJS_LIBDEC = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEC:.c=.o)) OBJS_LIBENC = $(addprefix $(OBJDIR)/,$(SRCS_LIBENC:.c=.o)) OBJS_LIBREND = $(addprefix $(OBJDIR)/,$(SRCS_LIBREND:.c=.o)) +OBJS_LC3PLUS = $(addprefix $(OBJDIR)/,$(SRCS_LC3PLUS:.c=.o)) OBJS_LIBUTIL = $(addprefix $(OBJDIR)/,$(SRCS_LIBUTIL:.c=.o)) OBJS_CLI_APIDEC = $(OBJDIR)/decoder.o OBJS_CLI_APIENC = $(OBJDIR)/encoder.o OBJS_CLI_APPREND = $(OBJDIR)/renderer.o DEPS = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.P) $(SRCS_LIBDEBUG:.c=.P) $(SRCS_LIBDEC:.c=.P) \ - $(SRCS_LIBENC:.c=.P) $(SRCS_LIBUTIL:.c=.P)) + $(SRCS_LIBENC:.c=.P) $(SRCS_LIBUTIL:.c=.P) $(SRCS_LIBREND:.c=.P) $(SRCS_LC3PLUS:.c=.P)) ############################################################################### @@ -157,25 +161,28 @@ $(LIB_LIBENC): $(OBJS_LIBENC) $(LIB_LIBREND): $(OBJS_LIBREND) $(QUIET_AR)$(AR) rcs $@ $^ +$(LIB_LC3PLUS): $(OBJS_LC3PLUS) + $(QUIET_AR)$(AR) rcs $@ $^ + $(LIB_LIBUTIL): $(OBJS_LIBUTIL) $(QUIET_AR)$(AR) rcs $@ $^ -$(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) +$(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS) $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIENC) -L. -livasenc -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIENC) -$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) - $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIDEC) +$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug -llc3plus $(LDLIBS) -o $(CLI_APIDEC) -$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC) - $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasdec -livasutil -livasdebug -livascom $(LDLIBS) -o $(CLI_APIREND) +$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC) $(LIB_LC3PLUS) + $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasdec -livasutil -livasdebug -livascom -llc3plus $(LDLIBS) -o $(CLI_APIREND) -libs: $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBREND) $(LIB_LIBUTIL) +libs: $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBREND) $(LIB_LC3PLUS) $(LIB_LIBUTIL) clean: $(QUIET)$(RM) $(OBJS_LIBENC) $(OBJS_LIBDEC) $(DEPS) $(QUIET)$(RM) $(DEPS:.P=.d) $(QUIET)test ! -d $(OBJDIR) || rm -rf $(OBJDIR) - $(QUIET)$(RM) $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBUTIL) $(LIB_LIBREND) + $(QUIET)$(RM) $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBUTIL) $(LIB_LIBREND) $(LIB_LC3PLUS) $(OBJDIR)/%.o : %.c | $(OBJDIR) $(QUIET_CC)$(CC) $(CFLAGS) -c -MD -o $@ $< diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index 5bf4656fd7..d2a00f6c00 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -20,7 +20,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "..\lib_rend\lc3plus_codec\ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\msvc\LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "..\lc3plus\msvc\LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" ProjectSection(SolutionItems) = preProject diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 23aa2ae3f0..6667182575 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -78,7 +78,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -109,7 +109,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;../lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -147,7 +147,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;../lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 80910aa5e7..645828db60 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index 3378ac10f0..6f88f77c4f 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -129,7 +129,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -176,7 +176,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index e8e981ebe8..54c34de274 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -126,7 +126,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -169,7 +169,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true @@ -272,7 +272,7 @@ {54509728-928b-44d9-a118-a6f92f08b34f} false - + {95030B82-70CD-4C6B-84D4-61096035BEA2} false diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 46dec2de9b..71723a07cb 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) false @@ -117,7 +117,7 @@ AnySuitable false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 94ad9f774e..eee6eed340 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -86,7 +86,7 @@ Disabled - ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -130,7 +130,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) @@ -180,7 +180,7 @@ Neither false false - ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/lc3plus/adjust_global_gain.c b/lc3plus/adjust_global_gain.c new file mode 100755 index 0000000000..e7674dd710 --- /dev/null +++ b/lc3plus/adjust_global_gain.c @@ -0,0 +1,86 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx + , LC3_INT16 hrmode, LC3_INT16 frame_dms + ) +{ + LC3_FLOAT delta = 0; + LC3_INT delta2 = 0; + LC3_INT gg_idx_inc; + LC3_INT factor; + + + if (frame_dms == 25) + { + if (target < 520) + { + factor = 3; + } else { + factor = 4; + } + } else if (frame_dms == 50) + { + factor = 2; + } else + { + factor = 1; + } + + if (nBits < gg_p1[fs_idx]) { + delta = (nBits + 48.0) / 16.0; + } else if (nBits < gg_p2[fs_idx]) { + delta = (nBits + gg_d[fs_idx]) * gg_c[fs_idx]; + } else if (nBits < gg_p3[fs_idx]) { + delta = nBits / 48.0; + } else { + delta = gg_p3[fs_idx] / 48.0; + } + + delta = round(delta); + delta2 = delta + 2; + + *gainChange = 0; + + if (*gg_idx == 255 && nBits > target) { + *gainChange = 1; + } + + if ((*gg_idx < 255 && nBits > target) || (*gg_idx > 0 && nBits < target - delta2)) { + if (hrmode) + { + if (nBits > target) { + gg_idx_inc = (int) factor * (((nBits - target)/ delta) + 1); + gg_idx_inc = MIN(gg_idx_inc, 10 * factor); + + *gg_idx += gg_idx_inc; + } + + *gg_idx = MIN(*gg_idx, 255); + } + else + { + if (nBits < target - delta2) { + *gg_idx = *gg_idx - 1; + } else if (*gg_idx == 254 || nBits < target + delta) { + *gg_idx = *gg_idx + 1; + } else { + *gg_idx = *gg_idx + 2; + } + } + + *gg_idx = MAX(*gg_idx, gg_idx_min - gg_idx_off); + *gain = LC3_POW(10, (LC3_FLOAT)(*gg_idx + gg_idx_off) / 28); + *gainChange = 1; + } +} diff --git a/lc3plus/al_fec_fl.c b/lc3plus/al_fec_fl.c new file mode 100755 index 0000000000..0cae36dade --- /dev/null +++ b/lc3plus/al_fec_fl.c @@ -0,0 +1,2329 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "stdint.h" +#include +#include +#include + +#include "functions.h" + + +/* channel coder specific constants and macros */ +#define RS16_CW_LEN_MAX 15 + +#define FEC_N_MODES 4 +#define FEC_N_SYNDROMES_MAX 6 +#define FEC_N_ERR_POS_MAX 3 +#define FEC_N_ELP_COEFF_MAX 4 +#define FEC_N_ERR_SYMB_MAX 3 +#define FEC_N_MODE_DETECTION_CW 6 + +#define SYNDROME_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_SYNDROMES_MAX) +#define ELP_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_ELP_COEFF_MAX) +#define ERR_POS_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_ERR_POS_MAX) +#define ERR_SYMB_IDX(mode_index, cw_index) (((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) * FEC_N_ERR_SYMB_MAX) +#define DEG_ELP_IDX(mode_index, cw_index) ((mode_index)*FEC_N_MODE_DETECTION_CW + (cw_index)) + +#define FEC_TOTAL_SYNDROME_SIZE (FEC_N_SYNDROMES_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_ELP_SIZE (FEC_N_ELP_COEFF_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_ERR_POS_SIZE (FEC_N_ERR_POS_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_ERROR_SIZE (FEC_N_ERR_SYMB_MAX * FEC_N_MODES * FEC_N_MODE_DETECTION_CW) +#define FEC_TOTAL_DEG_ELP_SIZE (FEC_N_MODES * FEC_N_MODE_DETECTION_CW) + +#define ERROR_REPORT_BEC_MASK ((0x0FFF)>>1) +#define ERROR_REPORT_EP1_OK ((0x1000)>>1) +#define ERROR_REPORT_EP2_OK ((0x2000)>>1) +#define ERROR_REPORT_EP3_OK ((0x4000)>>1) +#define ERROR_REPORT_EP4_OK ((0x8000)>>1) +#define ERROR_REPORT_ALL_OK (ERROR_REPORT_EP1_OK | ERROR_REPORT_EP2_OK | ERROR_REPORT_EP3_OK | ERROR_REPORT_EP4_OK) + +/* debugging switches */ + +/* constants concerning mode detection */ +#define EP_RISK_THRESH_NS_M 21990 +#define EP_RISK_THRESH_NS_E -23 +#define EP_RISK_THRESH_OS_M 25166 +#define EP_RISK_THRESH_OS_E -10 + +#define SIMPLE_FLOAT_1_MANTISSA 16384 + +#define FEC_STATIC static + +/* DISCLAIMER: Strict instrumentation of GF16 arithmetic would have to take into account + * the initial conversion of the arguments from LC3_UINT8 to LC3_INT16 (one move16() per argument). + * Behind this is the assumption that one would store GF16 elements in LC3_INT16 for strict BASOP + * implementation. + */ +#define GF16_MUL(a, b) gf16_mult_table[(a) | (b << 4)] +#define GF16_MUL0(a, b) gf16_mult_table[(a) | (b)] +#define GF16_ADD(a, b) ((a) ^ (b)) + +/* tables for finite field arithmetic */ +/* tables for arithmetic in GF(16) * + * generator polynomial: 19 + * unit group generator (g): 2 + */ + +static const LC3_UINT8 gf16_mult_table[256] = { + /* gf16_mult_table[a | (b << 4)] contains the product of a and b in GF(16) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 0, 2, 4, 6, 8, 10, 12, 14, 3, 1, 7, 5, 11, 9, 15, 13, 0, 3, 6, 5, 12, 15, 10, 9, 11, 8, + 13, 14, 7, 4, 1, 2, 0, 4, 8, 12, 3, 7, 11, 15, 6, 2, 14, 10, 5, 1, 13, 9, 0, 5, 10, 15, 7, 2, 13, + 8, 14, 11, 4, 1, 9, 12, 3, 6, 0, 6, 12, 10, 11, 13, 7, 1, 5, 3, 9, 15, 14, 8, 2, 4, 0, 7, 14, 9, + 15, 8, 1, 6, 13, 10, 3, 4, 2, 5, 12, 11, 0, 8, 3, 11, 6, 14, 5, 13, 12, 4, 15, 7, 10, 2, 9, 1, 0, + 9, 1, 8, 2, 11, 3, 10, 4, 13, 5, 12, 6, 15, 7, 14, 0, 10, 7, 13, 14, 4, 9, 3, 15, 5, 8, 2, 1, 11, + 6, 12, 0, 11, 5, 14, 10, 1, 15, 4, 7, 12, 2, 9, 13, 6, 8, 3, 0, 12, 11, 7, 5, 9, 14, 2, 10, 6, 1, + 13, 15, 3, 4, 8, 0, 13, 9, 4, 1, 12, 8, 5, 2, 15, 11, 6, 3, 14, 10, 7, 0, 14, 15, 1, 13, 3, 2, 12, + 9, 7, 6, 8, 4, 10, 11, 5, 0, 15, 13, 2, 9, 6, 4, 11, 1, 14, 12, 3, 8, 7, 5, 10, +}; + +static const LC3_UINT8 rs16_elp_deg2_table[256] = { + /* If the polynomial x^2 + ax + b has distinct non-zero roots z1 and z2 in GF(16), * + * then table entry a + 16*b contains log_g(z1) | log_g(z2) << 4, and otherwise it * + * contains 0. */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, + 105, 195, 0, 210, 0, 225, 0, 180, 120, 0, 0, 121, 0, 16, 0, 211, 0, 0, 181, 0, 0, 106, + 196, 226, 0, 0, 0, 214, 64, 0, 199, 0, 0, 0, 0, 0, 49, 184, 0, 154, 0, 229, 0, 227, + 182, 0, 0, 32, 0, 0, 0, 197, 0, 0, 122, 0, 212, 152, 0, 203, 0, 158, 128, 0, 0, 0, + 98, 113, 218, 0, 0, 0, 53, 0, 0, 65, 0, 0, 185, 110, 215, 80, 0, 0, 200, 0, 50, 0, + 0, 0, 0, 130, 205, 115, 0, 0, 160, 190, 145, 0, 0, 0, 0, 0, 0, 100, 0, 0, 168, 198, + 0, 183, 33, 0, 0, 48, 228, 213, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 179, 0, 224, 104, + 0, 194, 149, 0, 0, 209, 0, 0, 0, 189, 99, 84, 0, 129, 0, 0, 0, 144, 0, 0, 234, 114, + 0, 0, 82, 0, 0, 0, 0, 217, 202, 0, 112, 52, 232, 0, 97, 0, 0, 0, 126, 0, 81, 201, + 0, 36, 216, 186, 0, 0, 0, 96, 0, 0, 0, 0, 0, 88, 0, 0, 0, 103, 0, 148, 178, 0, + 208, 193, 0, 58, 0, 0, 0, 0, 0, 161, 206, 0, 116, 0, 101, 0, 0, 56, 146, 176, 0, 0, + 147, 162, 222, 0, 132, 0, 0, 0, 0, 0, 177, 117, 192, 0, +}; + +static const LC3_UINT16 rs16_elp_deg3_table[256] = { + /* If the polynomial x^3 + ax + b has distinct roots z1, z2 and z3 in GF(16), * + * then table entry a + 16*b contains z1) | z2 << 4 | z3 << 8, and otherwise it * + * contains 0. */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1889, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2977, 0, 0, 0, 0, 0, 3990, 1859, 0, + 0, 0, 0, 0, 0, 0, 3521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1874, 0, 3718, 0, 0, 0, + 0, 0, 0, 2433, 0, 0, 1619, 0, 0, 0, 0, 3495, 0, 0, 0, 0, 0, 0, 4065, 0, 0, 0, + 0, 0, 0, 3255, 0, 0, 0, 1602, 0, 3735, 0, 0, 0, 0, 3238, 801, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3510, 0, 0, 0, 0, 1345, 3975, 0, 0, 0, 0, 0, 0, 0, 0, 3778, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2947, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3476, 0, 4005, 0, 3461, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3748, 0, 0, 2962, 0, 0, 0, 0, 4035, 0, 0, 4020, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3221, 0, 0, 0, 0, 0, 0, 2690, + 0, 0, 0, 3795, 0, 0, 0, 4050, 0, 0, 0, 0, 0, 3204, 3765, 0, 0, 0, 0, 0, 2707, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const LC3_UINT8 gf16_g_pow[16] = {1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9, 1}; +/* g_pow[i] contains g^i*/ + +static const LC3_UINT8 gf16_log_g[16] = {255, 0, 1, 4, 2, 8, 5, 10, 3, 14, 9, 7, 6, 13, 11, 12}; +/* log_g[n] contains contains the value i such that g^i = n for n=1, 2, ..., 15, log_g[0] is set to 255 */ + +static const LC3_UINT8 gf16_inv_table[16] = {255, 1, 9, 14, 13, 11, 7, 6, 15, 2, 12, 5, 10, 4, 3, 8}; +/* gf16_inv_table[n] contains the multiplicative inverse of n in GF(16) (1/0 is set to 255)*/ + +/* RS16 generating polynomials (from lowest to highest coefficient without leading 1)*/ + +static const LC3_UINT8 rs16_gp_d3[] = {8, 6}; +static const LC3_UINT8 rs16_gp_d5[] = {7, 8, 12, 13}; +static const LC3_UINT8 rs16_gp_d7[] = {12, 10, 12, 3, 9, 7}; + +/* FEC mode signaling polynomials */ + +#define EP_SIG_POLY_DEG 12 + +static const LC3_UINT8 sig_polys[4][15] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 15, 5, 6, 14, 9, 1, 3, 12, 10, 13, 3, 2, 0, 0}, + {7, 11, 14, 1, 2, 3, 12, 11, 6, 15, 7, 6, 12, 0, 0}, + {6, 15, 12, 2, 9, 15, 2, 8, 12, 3, 10, 5, 4, 0, 0}}; + +static const LC3_UINT8 sig_poly_syndr[4][6] = { + {0, 0, 0, 0, 0, 0}, {0, 4, 5, 11, 5, 8}, {0, 5, 9, 0, 1, 7}, {0, 12, 5, 12, 9, 8}}; + +/* bit count table for error report (0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111) */ + +static const LC3_UINT8 rs16_bit_count_table[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; + +/* List of RS16 generators by Hamming distance */ + +static const LC3_UINT8 *const rs16_gp_by_hd[8] = {NULL, NULL, NULL, rs16_gp_d3, NULL, rs16_gp_d5, NULL, rs16_gp_d7}; + +/* fec config data */ + +static const LC3_UINT8 hamming_distance_by_mode0[] = {1, 3, 3, 5, 7}; +static const LC3_UINT8 hamming_distance_by_mode1[] = {1, 1, 3, 5, 7}; + +static const LC3_UINT8 crc1_bytes_by_mode0[] = {0, 3, 2, 2, 2}; +static const LC3_UINT8 crc1_bytes_by_mode1[] = {0, 3, 3, 3, 3}; +static const LC3_UINT8 crc2_bytes_by_mode[] = {0, 0, 2, 2, 2}; + +/* fec mode risk table */ +typedef struct +{ + LC3_UINT32 mantissa; + LC3_INT16 exponent; +} simple_float; + +static const simple_float risk_table_f[4][4] = {{{16384, 0}, {16384, 0}, {16384, 0}, {16384, 0}}, + {{16384, -8}, {26880, -1}, {16384, 0}, {16384, 0}}, + {{16384, -16}, {26880, -9}, {20475, -2}, {16384, 0}}, + {{16384, -24}, {26880, -17}, {20475, -10}, {19195, -4}}}; +/* bit error limits for slot size 40 */ +static LC3_INT16 const low_br_max_bit_errors_by_mode[] = {0, 0, 3, 9, 18}; + +/* +corresponding float values: + {1.f, 1.f, 1.f, 1.f}, + {0.00390625f, 0.820312f, 1.f, 1.f}, + {1.52588e-05f, 0.00320435f, 0.312424f, 1.f}, + {5.96046e-08f, 1.2517e-05f, 0.00122041f, 0.0732243f} +*/ + +/* internal encoder routines */ + +FEC_STATIC void fec_interleave_pack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords); + +FEC_STATIC void rs16_enc(LC3_UINT8 *iobuf, LC3_INT16 codeword_length, LC3_INT16 hamming_distance, LC3_INT16 fec_mode, + LC3_INT16 signal_mode); + +/* internal decoder routines */ + +FEC_STATIC void fec_deinterleave_unpack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords); + +FEC_STATIC LC3_INT16 fec_data_preproc(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_UINT8 *cw_buf, LC3_INT16 data_bytes, + LC3_INT16 slot_bytes, LC3_INT16 pc_split); + +FEC_STATIC void fec_data_postproc(LC3_INT16 mode, LC3PLUS_EpModeRequest *epmr, LC3_UINT8 *iobuf, LC3_INT16 data_bytes, LC3_UINT8 *cw_buf, + LC3_INT16 slot_bytes, LC3_INT16 pc_split, LC3_INT32 *bfi); + +FEC_STATIC LC3_INT32 rs16_detect_and_correct(LC3_UINT8 *iobuf, LC3_INT32 n_symb, LC3_INT32 n_codewords, LC3PLUS_EpModeRequest *epmr, LC3_INT16 *error_report, + LC3_INT32 *bfi, LC3_UINT8 *array_of_trust, LC3_INT32 ccc_flag_flag, LC3_INT16 *n_pccw); + +FEC_STATIC void rs16_calculate_six_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg); + +FEC_STATIC void rs16_calculate_four_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg); + +FEC_STATIC void rs16_calculate_two_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg); + +FEC_STATIC LC3_INT8 rs16_calculate_elp(LC3_UINT8 *elp, LC3_UINT8 *syndromes, LC3_INT16 hamming_distance); + +FEC_STATIC LC3_INT16 rs16_factorize_elp(LC3_UINT8 *error_locations, LC3_UINT8 *elp, LC3_INT16 deg_elp, LC3_INT16 max_pos); + +FEC_STATIC void rs16_calculate_errors(LC3_UINT8 *errors, LC3_UINT8 *err_pos, LC3_UINT8 *syndromes, LC3_INT8 deg_elp, LC3_INT8 t); + +/* auxiliary routines */ + +FEC_STATIC LC3_INT16 crc1(LC3_UINT8 *data, LC3_INT16 data_size, LC3_INT16 epmr, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check); + +FEC_STATIC LC3PLUS_EpModeRequest fec_estimate_epmr_from_cw0(LC3_UINT8 *cw0, LC3_INT8 *t, LC3_UINT8 *syndromes, LC3_UINT8 *elp, LC3_INT8 *deg_elp, + LC3_UINT8 *err_pos, LC3_UINT8 *err_symb, LC3_INT16 n_codewords, LC3_INT16 n_symb); + +FEC_STATIC void dw0_bitswap(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_bytes); + +FEC_STATIC LC3PLUS_EpModeRequest cw0_get_epmr(LC3_UINT8 *cw0, LC3_INT16 epmr_position); + +FEC_STATIC LC3PLUS_EpModeRequest dw0_get_epmr(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_size); + +FEC_STATIC LC3_INT16 crc2(LC3_UINT8 *data, LC3_INT16 data_size, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check); + +FEC_STATIC simple_float simple_float_mul(simple_float op1, simple_float op2); + +FEC_STATIC LC3_INT16 simple_float_cmp(simple_float op1, simple_float op2); + +FEC_STATIC LC3_INT16 get_total_crc_size(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 pc_split); + +FEC_STATIC LC3_INT16 get_n_codewords(LC3_INT16 slot_bytes); + +FEC_STATIC LC3_INT16 get_codeword_length(LC3_INT16 n_codewords, LC3_INT16 slot_nibbles, LC3_INT16 codeword_index); + + + +LC3_INT16 fec_get_n_pccw(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 ccc_flag) +{ + LC3_INT16 n_pccw; + + if (fec_mode == 3) + { + n_pccw = (LC3_INT16) (0.080447761194030 * slot_bytes - 1.791044776119394 + 0.5); + } + else if (fec_mode == 4) + { + n_pccw = (LC3_INT16) (0.066492537313433 * slot_bytes - 1.970149253731338 + 0.5); + } + else + { + n_pccw = 0; + } + + if (ccc_flag == 1 || slot_bytes < 80) + { + n_pccw = 0; + } + + return n_pccw; +} + +FEC_STATIC LC3_INT16 get_total_crc_size(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 pc_split) +{ + LC3_INT16 n_crc; + + n_crc = crc1_bytes_by_mode1[fec_mode]; + if (slot_bytes == 40) + { + n_crc = crc1_bytes_by_mode0[fec_mode]; + } + + if (pc_split > 0) + { + n_crc = n_crc + crc2_bytes_by_mode[fec_mode]; + } + + + + return n_crc; +} + +FEC_STATIC LC3_INT16 get_n_codewords(LC3_INT16 slot_bytes) +{ + return (2*slot_bytes + 14)/15; +} + +FEC_STATIC LC3_INT16 get_codeword_length(LC3_INT16 n_codewords, LC3_INT16 slot_nibbles, LC3_INT16 codeword_index) +{ + return (slot_nibbles - codeword_index - 1) / n_codewords + 1; +} + +/* Encoder */ + +LC3_INT16 fec_get_data_size(LC3_INT16 fec_mode, LC3_INT16 ccc_flag, LC3_INT16 slot_bytes) +/* not time critical */ +{ + LC3_INT16 n_codewords, payload_size; + + n_codewords = get_n_codewords(slot_bytes); + + assert(n_codewords == (2 * slot_bytes + RS16_CW_LEN_MAX - 1) / RS16_CW_LEN_MAX); + payload_size = slot_bytes; + + if (fec_mode > 0) + { + if (fec_mode == 1) + { + payload_size --; + } + else + { + payload_size -= (fec_mode - 1) * n_codewords; + } + if (slot_bytes == 40) + { + payload_size -= crc1_bytes_by_mode0[fec_mode]; + } + else + { + payload_size -= crc1_bytes_by_mode1[fec_mode]; + } + + if (ccc_flag == 0 && fec_mode > 2 && slot_bytes >= 80) + { + payload_size -= crc2_bytes_by_mode[fec_mode]; + } + } + + + + return payload_size; +} + +LC3_INT16 fec_get_n_pc(LC3_INT16 fec_mode, LC3_INT16 n_pccw, LC3_INT16 slot_bytes) +/* not time critical */ +{ + LC3_INT16 n_codewords, pc_split; + LC3_INT32 i; + + n_codewords = get_n_codewords(slot_bytes); + + assert(n_codewords == (2 * slot_bytes + RS16_CW_LEN_MAX - 1) / RS16_CW_LEN_MAX); + + pc_split = - 2*n_pccw*(fec_mode - 1); + + if (fec_mode == 1 || slot_bytes < 80) + { + pc_split = 0; + } + else + { + for (i = 0; i < n_pccw; i++) + { + pc_split += (2 * slot_bytes + i) / n_codewords; + } + } + + + + return pc_split; +} + +/* functions for EPMR handling */ +FEC_STATIC void dw0_bitswap(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_bytes) +/* swap epmr bits with bits that will be positioned at 30 and 32 in code word 0 */ +{ + LC3_UINT8 tmp; + LC3_INT32 ind0, ind1, position; + + position = get_codeword_length(get_n_codewords(slot_bytes), 2*slot_bytes, 0) - 1; + + if (slot_bytes == 40) + { + ind0 = 2*crc1_bytes_by_mode0[mode] - 1; + } + else + { + ind0 = 2*crc1_bytes_by_mode1[mode] - 1; + } + + ind1 = position - hamming_distance_by_mode0[mode] + 1; + + /* swap bits 2 and 3 of dw0[ind0] with bits 0 and 1 of dw0[ind1] */ + tmp = (dw0[ind0] >> 2) & 3; + dw0[ind0] = dw0[ind0] & 3; + dw0[ind0] = dw0[ind0] | ((dw0[ind1] & 3) << 2); + dw0[ind1] = dw0[ind1] & 12; + dw0[ind1] = dw0[ind1] | tmp; + + +} + +FEC_STATIC LC3PLUS_EpModeRequest cw0_get_epmr(LC3_UINT8 *cw0, LC3_INT16 position) +{ + return (LC3PLUS_EpModeRequest)(cw0[position] & 3); +} + +FEC_STATIC LC3PLUS_EpModeRequest dw0_get_epmr(LC3_UINT8 *dw0, LC3_INT16 mode, LC3_INT16 slot_size) +{ + LC3_INT32 ncrc1; + LC3PLUS_EpModeRequest epmr; + + ncrc1 = crc1_bytes_by_mode1[mode]; + + if (slot_size == 40) + { + ncrc1 = crc1_bytes_by_mode0[mode]; + } + + epmr = (LC3PLUS_EpModeRequest)(dw0[2 * ncrc1 - 1] >> 2); + + + + return epmr; +} + + +FEC_STATIC LC3_INT16 fec_data_preproc(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_UINT8 *cw_buf, LC3_INT16 data_bytes, + LC3_INT16 slot_bytes, LC3_INT16 pc_split) +{ + LC3_INT16 data_offset, n_crc1, n_crc2; + LC3_INT32 i, j; + + data_offset = 2*(slot_bytes - data_bytes); + + /* extract and reverse data*/ + j = 2*slot_bytes - 1; + for (i = 0; i < data_bytes; i++) + { + cw_buf[j--] = iobuf[i] & 15; + cw_buf[j--] = iobuf[i] >> 4; + } + + /* add crc hashes */ + if (slot_bytes == 40) + { + n_crc1 = crc1_bytes_by_mode0[mode]; + } + else + { + n_crc1 = crc1_bytes_by_mode1[mode]; + } + + if (pc_split > 0 && mode > 1) + { + n_crc2 = crc2_bytes_by_mode[mode]; + } + else + { + n_crc2 = 0; + } + + if (n_crc2) + { + crc2(cw_buf + data_offset + 2 * data_bytes - pc_split, pc_split, cw_buf + data_offset - 2 * n_crc2, n_crc2, 0); + } + if (n_crc1) + { + crc1(cw_buf + data_offset, 2 * data_bytes - pc_split, epmr, cw_buf + data_offset - 2 * (n_crc1 + n_crc2), n_crc1, + 0); + } + + data_offset -= 2* (n_crc1 + n_crc2); + + dw0_bitswap(cw_buf + data_offset, mode, slot_bytes); + + + + return data_offset; +} + +void fec_encoder(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_INT16 data_bytes, LC3_INT16 slot_bytes, LC3_INT16 n_pccw) +{ + LC3_INT16 n_codewords, codeword_length, hd, redundancy_nibbles, cw_offset, dw_offset, pc_split; + LC3_INT32 i, j; + LC3_UINT8 cw_buf[2 * FEC_SLOT_BYTES_MAX]; + + cw_offset = 0; + dw_offset = 0; + pc_split = 0; + + n_codewords = get_n_codewords(slot_bytes); + + /* some sanity checks */ + { + LC3_INT32 tmp = slot_bytes; + + assert((slot_bytes >= FEC_SLOT_BYTES_MIN && slot_bytes <= FEC_SLOT_BYTES_MAX) && + "fec_encoder: slot_bytes out of range"); + tmp -= mode == 1 ? 1 : n_codewords * (mode - 1); // reed solomon redundancy + tmp -= slot_bytes == 40 ? crc1_bytes_by_mode0[mode] : crc1_bytes_by_mode1[mode]; // crc1 + tmp -= (n_pccw > 0) && (mode > 1) ? crc2_bytes_by_mode[mode] : 0; // crc2 + assert(data_bytes == tmp && "fec_encoder: inconsistent payload size"); + assert(n_codewords - n_pccw >= 6); + } + + /* data preproc: re-ordering and hash extension */ + pc_split = fec_get_n_pc(mode, n_pccw, slot_bytes); + + dw_offset = fec_data_preproc(mode, epmr, iobuf, cw_buf, data_bytes, slot_bytes, pc_split); + + /* encoding of first data word*/ + hd = hamming_distance_by_mode0[mode]; + redundancy_nibbles = hd - 1; + codeword_length = get_codeword_length(n_codewords, 2 * slot_bytes, 0); + + assert(codeword_length == (2 * slot_bytes - 1) / n_codewords + 1); + + for (j = redundancy_nibbles; j < codeword_length; (j++, dw_offset++)) + { + cw_buf[j] = cw_buf[dw_offset]; + } + + rs16_enc(cw_buf, codeword_length, hd, mode, 1); + + cw_offset += codeword_length; + + /* encoding of remaining data words */ + hd = hamming_distance_by_mode1[mode]; + redundancy_nibbles = hd - 1; + + for (i = 1; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, 2*slot_bytes, i); + + for (j = redundancy_nibbles; j < codeword_length; (j++, dw_offset++)) + { + cw_buf[cw_offset + j] = cw_buf[dw_offset]; + } + + rs16_enc(cw_buf + cw_offset, codeword_length, hd, mode, i < 6); + + cw_offset += codeword_length; + } + + assert(cw_offset == 2 * slot_bytes && dw_offset == 2 * slot_bytes); + + fec_interleave_pack(iobuf, cw_buf, 2 * slot_bytes, n_codewords); + + +} + +FEC_STATIC void rs16_enc(LC3_UINT8 *iobuf, LC3_INT16 codeword_length, LC3_INT16 hamming_distance, LC3_INT16 fec_mode, + LC3_INT16 signal_mode) +/* expects (data polynomial) * x^(hamming_distance - 1) in iobuf */ +{ + LC3_UINT8 const *gp; + LC3_UINT8 shift_buffer[RS16_CW_LEN_MAX + 1], lc; + LC3_INT32 i, j, deg_gp; + + memset(shift_buffer, 0, sizeof(shift_buffer)); + gp = rs16_gp_by_hd[hamming_distance]; + deg_gp = hamming_distance - 1; + + if (hamming_distance > 1) + { + assert(codeword_length > deg_gp); + + /* initialize redundancy part to zero */ + memset(iobuf, 0, deg_gp); + + /* initialize shift_buffer */ + memmove(shift_buffer + 1, iobuf + codeword_length - deg_gp, deg_gp); + + /* calculate remainder */ + for (i = codeword_length - deg_gp - 1; i >= 0; i--) + { + shift_buffer[0] = iobuf[i]; + lc = shift_buffer[deg_gp] << 4; + + for (j = deg_gp - 1; j >= 0; j--) + { + shift_buffer[j + 1] = GF16_ADD(shift_buffer[j], GF16_MUL0(gp[j], lc)); + } + } + + /* add remainder to shifted data polynomial */ + for (i = 0; i < deg_gp; i++) + { + iobuf[i] = shift_buffer[i + 1]; + } + + /* add signaling polynomial */ + if (signal_mode) + { + assert(codeword_length > EP_SIG_POLY_DEG); + for (i = 0; i <= EP_SIG_POLY_DEG; i++) + { + iobuf[i] = GF16_ADD(iobuf[i], sig_polys[fec_mode - 1][i]); + } + } + } + + +} + +FEC_STATIC void fec_interleave_pack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords) +{ + LC3_INT16 out_offset, cw_offset, codeword_length; + LC3_INT32 i, j; + + out_offset = 0; + cw_offset = 0; + + /* initialize output buffer to zero */ + memset(out, 0, n_nibbles >> 1); + + /* interleave and pack codewords */ + for (i = 0; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, n_nibbles, i); + + for (j = 0; j < codeword_length; j++) + { + out_offset = n_nibbles - 1 - j*n_codewords - i; + out[out_offset >> 1] |= in[cw_offset] << ((out_offset & 1) << 2); + cw_offset = cw_offset + 1; + } + } + + + assert(cw_offset == n_nibbles); +} + +/* Decoder */ +FEC_STATIC void fec_data_postproc(LC3_INT16 mode, LC3PLUS_EpModeRequest *epmr, LC3_UINT8 *obuf, LC3_INT16 data_bytes, LC3_UINT8 *cw_buf, + LC3_INT16 slot_bytes, LC3_INT16 pc_split, LC3_INT32 *bfi) +{ + LC3_INT16 i; + LC3_INT16 n_crc1, n_crc2; + LC3_INT16 cw_buf_len; + LC3PLUS_EpModeRequest tmp_epmr; + + n_crc1 = crc1_bytes_by_mode1[mode]; + if (slot_bytes == 40) + { + n_crc1 = crc1_bytes_by_mode0[mode]; + } + + n_crc2 = 0; + if (pc_split > 0) + { + n_crc2 = crc2_bytes_by_mode[mode]; + } + + assert(n_crc1 == (slot_bytes == 40 ? crc1_bytes_by_mode0[mode] : crc1_bytes_by_mode1[mode])); + assert(n_crc2 == ((pc_split > 0) && (mode > 1) ? crc2_bytes_by_mode[mode] : 0)); + + cw_buf_len = 2 * (data_bytes + n_crc1 + n_crc2); + + if ((mode - 1)) + { + /* reverse bit-swap */ + dw0_bitswap(cw_buf, mode, slot_bytes); + tmp_epmr = dw0_get_epmr(cw_buf, mode, slot_bytes); + + if (crc1(cw_buf + ((n_crc1 + n_crc2) << 1), ((data_bytes << 1) - pc_split), tmp_epmr, cw_buf, n_crc1, 1)) + { + *bfi = 1; + + return; + } + else + { + *epmr = tmp_epmr; + } + } + + if (pc_split > 0 && *bfi != 2) + { + if (crc2(cw_buf + (((data_bytes + (n_crc1 + n_crc2)) << 1) - pc_split), pc_split, + cw_buf + (n_crc1 << 1), n_crc2, 1)) + { + *bfi = 2; + } + } + + for (i = 0; i < data_bytes; i++) + { + obuf[i] = (LC3_UINT8)(cw_buf[cw_buf_len - 2 * i - 1] | (cw_buf[cw_buf_len - 2 * i - 2] << 4)); + } + + +} + +LC3_INT32 fec_decoder(LC3_UINT8 *iobuf, LC3_INT16 slot_bytes, LC3_INT32 *data_bytes, LC3PLUS_EpModeRequest *epmr, LC3_INT16 ccc_flag, LC3_INT16 *n_pccw, + LC3_INT32 *bfi, LC3_INT16 *be_bp_left, LC3_INT16 *be_bp_right, LC3_INT16 *n_pc, LC3_INT16 *m_fec) +{ + LC3_UINT8 cw_buf[2 * FEC_SLOT_BYTES_MAX]; + LC3_UINT8 array_of_trust[MAX_LEN]; + LC3_INT16 i, j; + LC3_INT16 cw_offset, dw_offset; + LC3_INT16 n_codewords, redundancy_nibbles, codeword_length; + LC3_INT16 mode, error_report; + LC3_INT16 n_crc; + LC3_INT16 first_bad_cw; + LC3_INT16 pc_split; + + UNUSED(n_crc); + + + if (*bfi == 1) + { + + return ERROR_REPORT_BEC_MASK; + } + + if (slot_bytes < FEC_SLOT_BYTES_MIN || slot_bytes > FEC_SLOT_BYTES_MAX) + { + *bfi = 1; + + return ERROR_REPORT_BEC_MASK; + } + + if (ccc_flag == 0) + { + *be_bp_left = -1; + *be_bp_right = -1; + } + + n_codewords = get_n_codewords(slot_bytes); + + /* extract and de-interleave nibbles */ + fec_deinterleave_unpack(cw_buf, iobuf, 2 * slot_bytes, n_codewords); + + /* mode detection and error correction */ + mode = rs16_detect_and_correct(cw_buf, 2 * slot_bytes, n_codewords, epmr, &error_report, bfi, array_of_trust, + ccc_flag, n_pccw); + + /* for normal slots the maximal number of bit errors is limited */ +#ifndef APPLY_MAX_ERRORS + if (slot_bytes == 40 && mode > 0) + { + if ((error_report & ERROR_REPORT_BEC_MASK) > low_br_max_bit_errors_by_mode[mode]) + { + error_report &= ERROR_REPORT_BEC_MASK; + mode = -1; + *bfi = 1; + } + else + { + if ((error_report & ERROR_REPORT_BEC_MASK) > low_br_max_bit_errors_by_mode[2]) + { + error_report &= ~ERROR_REPORT_EP2_OK; + } + if ((error_report & ERROR_REPORT_BEC_MASK) > low_br_max_bit_errors_by_mode[3]) + { + error_report &= ~ERROR_REPORT_EP3_OK; + } + } + } +#endif + + if (*bfi == 1) + { + *data_bytes = 0; + + + return error_report; + } + + /* initialization for decoding */ + *data_bytes = fec_get_data_size(mode, ccc_flag, slot_bytes); + pc_split = fec_get_n_pc(mode, *n_pccw, slot_bytes); + n_crc = get_total_crc_size(slot_bytes, mode, pc_split); + + /* decoding of first code word */ + redundancy_nibbles = hamming_distance_by_mode0[mode] - 1; + codeword_length = get_codeword_length(n_codewords, slot_bytes + slot_bytes, 0); + + dw_offset = 0; + cw_offset = 0; + + for (j = redundancy_nibbles; j < codeword_length; j++) + { + cw_buf[dw_offset++] = cw_buf[j]; + } + cw_offset = cw_offset + codeword_length; + + /* decoding of remaining code words */ + redundancy_nibbles = hamming_distance_by_mode1[mode] - 1; + + for (i = 1; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, slot_bytes + slot_bytes, i); + + for (j = redundancy_nibbles; j < codeword_length; j++) + { + cw_buf[dw_offset++] = cw_buf[j + cw_offset]; + } + + cw_offset = cw_offset + codeword_length; + } + + /* data postproc: hash validation and re-ordering */ + + fec_data_postproc(mode, epmr, iobuf, *data_bytes, cw_buf, slot_bytes, pc_split, bfi); + + if (*bfi == 1) + { + *data_bytes = 0; + + error_report &= ERROR_REPORT_BEC_MASK; + + + return error_report; + } + + if (*bfi == 2) + { + first_bad_cw = 0; + array_of_trust[*n_pccw] = 0; + while (array_of_trust[first_bad_cw] != 0) + { + first_bad_cw = first_bad_cw + 1; + } + if (first_bad_cw == *n_pccw) + { + /* this is the case when CRC failed */ + *be_bp_left = 0; + } + else + { + *be_bp_left = 4*fec_get_n_pc(mode, first_bad_cw, slot_bytes); + } + + for (i = *n_pccw - 1; i >= 0; i--) + { + if (!array_of_trust[i]) + { + break; + } + } + if (i < 0) + { + i = *n_pccw - 1; + } + *be_bp_right = 4*fec_get_n_pc(mode, i + 1, slot_bytes) - 1; + } + + if (ccc_flag == 0) + { + *n_pc = pc_split; + *m_fec = mode; + } + + + return error_report; +} + +FEC_STATIC void fec_deinterleave_unpack(LC3_UINT8 *out, LC3_UINT8 *in, LC3_INT16 n_nibbles, LC3_INT16 n_codewords) +{ + LC3_INT16 in_offset, out_offset, codeword_length; + LC3_INT32 i, j; + + in_offset = 0; + out_offset = 0; + + /* unpack nibbles in input buffer and deinterleave codewords */ + for (i = 0; i < n_codewords; i++) + { + codeword_length = get_codeword_length(n_codewords, n_nibbles, i); + for (j = 0; j < codeword_length; (j++, out_offset++)) + { + in_offset = n_nibbles - 1 - j*n_codewords - i; + out[out_offset] = (in[in_offset >> 1] >> ((in_offset & 1) << 2)) & 15; + } + } + + + assert(out_offset == n_nibbles); + +} + +FEC_STATIC LC3PLUS_EpModeRequest fec_estimate_epmr_from_cw0(LC3_UINT8 *cw0, LC3_INT8 *t, LC3_UINT8 *syndromes, LC3_UINT8 *elp, LC3_INT8 *deg_elp, + LC3_UINT8 *err_pos, LC3_UINT8 *err_symb, LC3_INT16 n_codewords, LC3_INT16 n_symb) +{ + LC3_INT32 epmr_lowest_risk_exp; + LC3_INT32 start, inc, i, n_candidates; + LC3_INT32 first_codeword_length; + LC3_INT32 mode_counter; + LC3PLUS_EpModeRequest epmr; + + epmr_lowest_risk_exp = 0; + first_codeword_length = get_codeword_length(n_codewords, n_symb, 0); + start = 2; + inc = 1; + n_candidates = 0; + + /* test if first code word decodes in mode 0 or 1 without error correction */ + if ((syndromes[SYNDROME_IDX(0, 0)] | syndromes[SYNDROME_IDX(0, 0) + 1]) == 0 || + (syndromes[SYNDROME_IDX(1, 0)] | syndromes[SYNDROME_IDX(1, 0) + 1]) == 0) + { + epmr_lowest_risk_exp = risk_table_f[1][0].exponent; + } + /* test if first code word decodes in mode 2 or 3 with lower risk */ + if (deg_elp[DEG_ELP_IDX(2, 0)] <= t[2]) + { + if (risk_table_f[2][deg_elp[DEG_ELP_IDX(2, 0)]].exponent <= -8) + { + n_candidates++; + start = 2; + } + } + + if (deg_elp[DEG_ELP_IDX(3, 0)] <= t[3]) + { + if (risk_table_f[3][deg_elp[DEG_ELP_IDX(3, 0)]].exponent <= -8) + { + n_candidates++; + start = 3; + } + } + + if (n_candidates > 1) + { + /* decide on order if mode 2 and 3 are considered */ + if (simple_float_cmp(risk_table_f[2][deg_elp[DEG_ELP_IDX(2, 0)]], risk_table_f[3][deg_elp[DEG_ELP_IDX(3, 0)]]) < + 0) + { + start = 2; + inc = 1; + } + else + { + start = 3; + inc = -1; + } + } + + for (mode_counter = start, i = 0; i < n_candidates; mode_counter += inc, i++) + { + if (risk_table_f[mode_counter][deg_elp[DEG_ELP_IDX(mode_counter, 0)]].exponent < epmr_lowest_risk_exp) + { + if (!rs16_factorize_elp(err_pos + ERR_POS_IDX(mode_counter, 0), elp + ELP_IDX(mode_counter, 0), + deg_elp[DEG_ELP_IDX(mode_counter, 0)], first_codeword_length - 1)) + { + /* code word is decodable with error correction */ + epmr_lowest_risk_exp = risk_table_f[mode_counter][deg_elp[DEG_ELP_IDX(mode_counter, 0)]].exponent; + + rs16_calculate_errors(err_symb + ERR_SYMB_IDX(mode_counter, 0), err_pos + ERR_POS_IDX(mode_counter, 0), + syndromes + SYNDROME_IDX(mode_counter, 0), deg_elp[DEG_ELP_IDX(mode_counter, 0)], + t[mode_counter]); + + for (i = 0; i < deg_elp[DEG_ELP_IDX(mode_counter, 0)]; i++) + { + cw0[err_pos[ERR_POS_IDX(mode_counter, 0) + i]] = GF16_ADD( + cw0[err_pos[ERR_POS_IDX(mode_counter, 0) + i]], err_symb[ERR_SYMB_IDX(mode_counter, 0) + i]); + } + break; + } + } + } + + epmr = cw0_get_epmr(cw0, first_codeword_length - 1); + + if (epmr_lowest_risk_exp > -16) + { + epmr += 4; + } + if (epmr_lowest_risk_exp > -8) + { + epmr += 4; + } + + + return epmr; +} + +FEC_STATIC LC3_INT32 rs16_detect_and_correct(LC3_UINT8 *iobuf, LC3_INT32 n_symb, LC3_INT32 n_codewords, LC3PLUS_EpModeRequest *epmr, LC3_INT16 *error_report, + LC3_INT32 *bfi, LC3_UINT8 *array_of_trust, LC3_INT32 ccc_flag, LC3_INT16 *n_pccw) +{ + + LC3_INT16 mode_broken[4]; + LC3_INT16 error_report_ep_ok[4]; + LC3_INT16 i, cw_counter, mode_counter, cw_offset; + LC3_INT16 codeword_length; + LC3_INT16 mode; + LC3_INT16 mode_candidates[4]; + LC3_INT16 n_mode_candidates; + LC3_INT16 broken_cw, n_broken_cw; + LC3_INT16 j, idx_min; + LC3_INT16 n_pccw0; + simple_float val_min_f; + LC3_INT16 tmp; + LC3_INT16 epmr_position; + simple_float dec_risk_f[FEC_N_MODES]; + simple_float risk_min_f; + simple_float ep_risk_thresh; + LC3_INT32 epmr_dec_fail_increment; + LC3_UINT8 const *hamming_distance; + LC3_UINT8 syndromes[FEC_TOTAL_SYNDROME_SIZE]; + LC3_UINT8 elp[FEC_TOTAL_ELP_SIZE]; + LC3_UINT8 err_pos[FEC_TOTAL_ERR_POS_SIZE]; + LC3_UINT8 err_symb[FEC_TOTAL_ERROR_SIZE]; + LC3_INT8 t[FEC_N_MODES]; + LC3_INT8 deg_elp[FEC_TOTAL_DEG_ELP_SIZE]; + LC3_UINT8 blacklist[FEC_N_MODES]; + LC3_INT32 rop; + + void (*syndr_calc[3])(LC3_UINT8 *, LC3_UINT8 *, LC3_INT32); + rop = 0; + + /* initialization */ + blacklist[0] = 0; + blacklist[1] = 0; + blacklist[2] = 0; + blacklist[3] = 0; + mode_broken[0] = 0; + mode_broken[1] = 0; + mode_broken[2] = 0; + mode_broken[3] = 0; + error_report_ep_ok[0] = ERROR_REPORT_EP1_OK; + error_report_ep_ok[1] = ERROR_REPORT_EP2_OK; + error_report_ep_ok[2] = ERROR_REPORT_EP3_OK; + error_report_ep_ok[3] = ERROR_REPORT_EP4_OK; + hamming_distance = &hamming_distance_by_mode0[1]; + mode = -1; + n_mode_candidates = 0; + risk_min_f.mantissa = SIMPLE_FLOAT_1_MANTISSA; + risk_min_f.exponent = 0; + + if (n_symb <= 80) + { + ep_risk_thresh.mantissa = EP_RISK_THRESH_NS_M; + ep_risk_thresh.exponent = EP_RISK_THRESH_NS_E; + } + else + { + ep_risk_thresh.mantissa = EP_RISK_THRESH_OS_M; + ep_risk_thresh.exponent = EP_RISK_THRESH_OS_E; + } + + syndr_calc[0] = &rs16_calculate_two_syndromes; + syndr_calc[1] = &rs16_calculate_four_syndromes; + syndr_calc[2] = &rs16_calculate_six_syndromes; + + for (i = 0; i < FEC_N_MODES; i++) + { + t[i] = (hamming_distance[i] -1)/2; + } + + *error_report = 0; + *bfi = 0; + + /* mode detection (stage 1) */ + codeword_length = get_codeword_length(n_codewords, n_symb, 0); + + epmr_position = codeword_length - 1; + + rs16_calculate_two_syndromes(syndromes + SYNDROME_IDX(0, 0), iobuf, codeword_length - 1); + + if ((syndromes[0 + SYNDROME_IDX(0, 0)] | syndromes[1 + SYNDROME_IDX(0, 0)]) == 0) + { + + /* data validation for fec mode 1 */ + *epmr = cw0_get_epmr(iobuf, epmr_position); + + dw0_bitswap(iobuf + 2, 1, n_symb / 2); + + if (!crc1(iobuf + 8, n_symb - 8, *epmr, iobuf + 2, 3, 1)) + { + *error_report |= ERROR_REPORT_ALL_OK; + mode = 0; + + + rop = mode + 1; + goto CLEANUP; + } + else + { + /* reverse bit swap */ + dw0_bitswap(iobuf + 2, 1, n_symb / 2); + + *epmr += 4; + } + } + + blacklist[0] = 1; + + /* mode detection (stage 2) */ + + /* calculate syndromes of code words 0 to 5 and modes 1 to 3 */ + cw_offset = 0; + + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + + rs16_calculate_six_syndromes(syndromes + SYNDROME_IDX(1, cw_counter), iobuf + cw_offset, + codeword_length - 1); + + cw_offset += codeword_length; + + for (mode_counter = FEC_N_MODES - 1; mode_counter >= 1; mode_counter--) + { + for (i = 0; i < hamming_distance[mode_counter] - 1; i++) + { + syndromes[SYNDROME_IDX(mode_counter, cw_counter) + i] = GF16_ADD( + syndromes[SYNDROME_IDX(1, cw_counter) + i], sig_poly_syndr[mode_counter][i]); + } + } + } + + /* check for valid code words */ + for (mode_counter = 1; mode_counter < FEC_N_MODES; mode_counter++) + { + n_broken_cw = 0; + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + broken_cw = 0; + for (i = 0; i < hamming_distance[mode_counter] - 1; i++) + { + broken_cw |= syndromes[SYNDROME_IDX(mode_counter, cw_counter) + i]; + } + if (broken_cw != 0) + { + n_broken_cw ++; + } + } + + if (n_broken_cw == 0) + { + mode = mode_counter; + cw_offset = 0; + + *epmr = cw0_get_epmr(iobuf, epmr_position); + + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + for (i = 0; i <= EP_SIG_POLY_DEG; i++) + { + iobuf[cw_offset + i] = GF16_ADD(iobuf[cw_offset + i], sig_polys[mode][i]); + } + cw_offset += codeword_length; + } + } + } + + if (mode < 0) /* mode hasn't been detected so far -> errors occurred in transmission */ + { + /* calculate error locator polynomials for code words 0 to 5 */ + for (mode_counter = 1; mode_counter < FEC_N_MODES; mode_counter++) + { + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + deg_elp[DEG_ELP_IDX(mode_counter, cw_counter)] = rs16_calculate_elp( + elp + ELP_IDX(mode_counter, cw_counter), syndromes + SYNDROME_IDX(mode_counter, cw_counter), + t[mode_counter]); + if (deg_elp[DEG_ELP_IDX(mode_counter, cw_counter)] > t[mode_counter]) + { + blacklist[mode_counter] = 1; + break; + } + } + } + + /* risk analysis for mode candidate selection */ + for (mode_counter = 1; mode_counter < FEC_N_MODES; mode_counter++) + { + dec_risk_f[mode_counter].mantissa = SIMPLE_FLOAT_1_MANTISSA; + dec_risk_f[mode_counter].exponent = 0; + + if (blacklist[mode_counter] == 0) + { + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + dec_risk_f[mode_counter] = simple_float_mul( + dec_risk_f[mode_counter], + risk_table_f[mode_counter][deg_elp[DEG_ELP_IDX(mode_counter, cw_counter)]]); + } + + if (simple_float_cmp(dec_risk_f[mode_counter], ep_risk_thresh) <= 0) + { + mode_candidates[n_mode_candidates++] = mode_counter; + } + + if (simple_float_cmp(dec_risk_f[mode_counter], risk_min_f) < 0) + { + risk_min_f = dec_risk_f[mode_counter]; + } + } + } + assert(n_mode_candidates <= 4); // suppress false gcc warning when OPTIM=3 + + /* sort mode candidates by risk */ + for (i = 0; i < n_mode_candidates; i++) + { + idx_min = i; + val_min_f = dec_risk_f[mode_candidates[i]]; + + for (j = i + 1; j < n_mode_candidates; j++) + { + if (simple_float_cmp(dec_risk_f[mode_candidates[j]], val_min_f) < 0) + { + val_min_f = dec_risk_f[mode_candidates[j]]; + idx_min = j; + } + } + + if (idx_min > i) + { + tmp = mode_candidates[i]; + mode_candidates[i] = mode_candidates[idx_min]; + mode_candidates[idx_min] = tmp; + } + } + + /* try out candidate modes */ + for (i = 0; i < n_mode_candidates; i++) + { + mode = mode_candidates[i]; + + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + + if (deg_elp[DEG_ELP_IDX(mode, cw_counter)]) + { + if (rs16_factorize_elp(err_pos + ERR_POS_IDX(mode, cw_counter), elp + ELP_IDX(mode, cw_counter), + deg_elp[DEG_ELP_IDX(mode, cw_counter)], codeword_length - 1)) + { + /* elp did not split into distinct linear factors or error position was out of range */ + mode = -1; + break; + } + } + } + if (mode > 0) + { + /* decodable mode with lowest risk has been found */ + break; + } + } + + if (mode < 0) + { + /* no decodable mode has been found */ + *error_report = ERROR_REPORT_BEC_MASK; + *bfi = 1; + mode = -1; + + *epmr = fec_estimate_epmr_from_cw0(iobuf, t, syndromes, elp, deg_elp, err_pos, err_symb, n_codewords, + n_symb); + + + rop = mode; + goto CLEANUP; + } + + /* perform error correction */ + cw_offset = 0; + *error_report = 0; + for (cw_counter = 0; cw_counter < 6; cw_counter++) + { + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + + if (deg_elp[DEG_ELP_IDX(mode, cw_counter)]) + { + rs16_calculate_errors( + err_symb + ERR_SYMB_IDX(mode, cw_counter), err_pos + ERR_POS_IDX(mode, cw_counter), + syndromes + SYNDROME_IDX(mode, cw_counter), deg_elp[DEG_ELP_IDX(mode, cw_counter)], t[mode]); + + /* correct errors and sum up number of corrected bits */ + for (i = 0; i < deg_elp[DEG_ELP_IDX(mode, cw_counter)]; i++) + { + iobuf[err_pos[ERR_POS_IDX(mode, cw_counter) + i] + cw_offset] = + GF16_ADD(iobuf[err_pos[ERR_POS_IDX(mode, cw_counter) + i] + cw_offset], + err_symb[ERR_SYMB_IDX(mode, cw_counter) + i]); + *error_report += rs16_bit_count_table[err_symb[ERR_SYMB_IDX(mode, cw_counter) + i]]; + } + + for (i = 0; i < mode; i ++) + { + if(deg_elp[DEG_ELP_IDX(mode, cw_counter)] > i) + { + mode_broken[i] = 1; + } + } + + } + + for (i = 0; i <= EP_SIG_POLY_DEG; i++) + { + iobuf[cw_offset + i] = GF16_ADD(iobuf[cw_offset + i], sig_polys[mode][i]); + } + cw_offset += codeword_length; + } + + /* set epmr according to risk value of cw0 */ + epmr_dec_fail_increment = 8; + + if (risk_table_f[mode][deg_elp[DEG_ELP_IDX(mode, 0)]].exponent <= -8) + { + epmr_dec_fail_increment -= 4; + } + if (risk_table_f[mode][deg_elp[DEG_ELP_IDX(mode, 0)]].exponent <= -16) + { + epmr_dec_fail_increment -= 4; + } + + *epmr = (LC3PLUS_EpModeRequest)(cw0_get_epmr(iobuf, epmr_position) + epmr_dec_fail_increment); + } + + /* mode has been successfully detected -> now check and try to correct remaining code words*/ + *n_pccw = fec_get_n_pccw(n_symb / 2, mode + 1, ccc_flag); + if (ccc_flag == 0) + { + n_pccw0 = fec_get_n_pccw(n_symb / 2, mode + 1, ccc_flag); + *n_pccw = n_pccw0; + } + else + { + n_pccw0 = 0; + } + + for (cw_counter = 6; cw_counter < n_codewords; cw_counter++) + { + /* usual error correction scheme: syndromes -> elp's, errors, etc. */ + codeword_length = get_codeword_length(n_codewords, n_symb, cw_counter); + array_of_trust[n_codewords - 1 - cw_counter] = 1; + + syndr_calc[t[mode] - 1](syndromes, iobuf + cw_offset, codeword_length -1); + + deg_elp[0] = rs16_calculate_elp(elp, syndromes, t[mode]); + + for (i = 0; i < mode; i ++) + { + if (deg_elp[0] > i) + { + mode_broken[i] = 1; + } + } + + if (deg_elp[0] > t[mode]) + { + for (i = 0; i < 4; i ++) + { + mode_broken[i] = 1; + } + cw_offset += codeword_length; + if (cw_counter < n_codewords - n_pccw0) + { + *error_report = ERROR_REPORT_BEC_MASK; + mode = -1; + *bfi = 1; + break; + } + else + { + *bfi = 2; + array_of_trust[n_codewords - 1 - cw_counter] = 0; + continue; + } + } + + if (deg_elp[0]) + { + if (rs16_factorize_elp(err_pos, elp, deg_elp[0], codeword_length - 1)) + { + cw_offset += codeword_length; + for (i = 0; i < 4; i ++) + { + mode_broken[i] = 1; + } + if (cw_counter < n_codewords - n_pccw0) + { + *error_report = ERROR_REPORT_BEC_MASK; + mode = -1; + *bfi = 1; + + break; + } + else + { + *bfi = 2; + array_of_trust[n_codewords - 1 - cw_counter] = 0; + continue; + } + } + + rs16_calculate_errors(err_symb, err_pos, syndromes, deg_elp[0], t[mode]); + + /* correct errors and sum up number of corrected bits */ + for (i = 0; i < deg_elp[0]; i++) + { + iobuf[err_pos[i] + cw_offset] = GF16_ADD(iobuf[err_pos[i] + cw_offset], err_symb[i]); + *error_report += rs16_bit_count_table[err_symb[i]]; + } + } + cw_offset += codeword_length; + if (risk_table_f[mode][deg_elp[0]].exponent > -16) + { + array_of_trust[n_codewords - 1 - cw_counter] = 0; + } + } + + *error_report &= ERROR_REPORT_BEC_MASK; + for (i = 0; i < 4; i ++) + { + if (!mode_broken[i]) + { + *error_report |= error_report_ep_ok[i]; + } + } + + if (mode >= 0) + { + rop = mode + 1; + } else { + rop = -1; + } + + + +CLEANUP: + return rop; +} + +FEC_STATIC void rs16_calculate_six_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg) +{ + LC3_INT32 i; + LC3_UINT8 buffer[15]; + + assert(cw_poly_deg >= 12); + + for (i = 0; i <= cw_poly_deg; i++) + { + buffer[i] = cw[i]; + } + + syndromes[0] = buffer[0]; + syndromes[1] = buffer[0]; + syndromes[2] = buffer[0]; + syndromes[3] = buffer[0]; + syndromes[4] = buffer[0]; + syndromes[5] = buffer[0]; + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[1], 32)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[1], 64)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[1], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[1], 48)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[1], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[1], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[2], 64)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[2], 48)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[2], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[2], 80)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[2], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[2], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[3], 128)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[3], 192)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[3], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[3], 240)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[3], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[3], 128)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[4], 48)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[4], 80)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[4], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[4], 32)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[4], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[4], 160)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[5], 96)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[5], 112)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[5], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[5], 96)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[5], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[5], 16)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[6], 192)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[6], 240)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[6], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[6], 160)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[6], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[6], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[7], 176)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[7], 144)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[7], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[7], 208)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[7], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[7], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[8], 80)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[8], 32)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[8], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[8], 64)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[8], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[8], 128)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[9], 160)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[9], 128)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[9], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[9], 192)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[9], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[9], 160)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[10], 112)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[10], 96)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[10], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[10], 112)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[10], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[10], 16)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[11], 224)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[11], 176)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[11], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[11], 144)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[11], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[11], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[12], 240)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[12], 160)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[12], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[12], 128)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[12], 16)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[12], 240)); + + if (cw_poly_deg >= 13) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[13], 208)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[13], 224)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[13], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[13], 176)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[13], 96)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[13], 128)); + } + + if (cw_poly_deg >= 14) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[14], 144)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[14], 208)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[14], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[14], 224)); + syndromes[4] = GF16_ADD(syndromes[4], GF16_MUL0(buffer[14], 112)); + syndromes[5] = GF16_ADD(syndromes[5], GF16_MUL0(buffer[14], 160)); + } + + +} + +FEC_STATIC void rs16_calculate_four_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg) +{ + LC3_INT32 i; + LC3_UINT8 buffer[15]; + + assert(cw_poly_deg >= 12); + + for (i = 0; i <= cw_poly_deg; i++) + { + buffer[i] = cw[i]; + } + + syndromes[0] = buffer[0]; + syndromes[1] = buffer[0]; + syndromes[2] = buffer[0]; + syndromes[3] = buffer[0]; + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[1], 32)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[1], 64)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[1], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[1], 48)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[2], 64)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[2], 48)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[2], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[2], 80)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[3], 128)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[3], 192)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[3], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[3], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[4], 48)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[4], 80)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[4], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[4], 32)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[5], 96)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[5], 112)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[5], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[5], 96)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[6], 192)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[6], 240)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[6], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[6], 160)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[7], 176)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[7], 144)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[7], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[7], 208)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[8], 80)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[8], 32)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[8], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[8], 64)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[9], 160)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[9], 128)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[9], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[9], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[10], 112)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[10], 96)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[10], 16)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[10], 112)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[11], 224)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[11], 176)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[11], 128)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[11], 144)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[12], 240)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[12], 160)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[12], 192)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[12], 128)); + + if (cw_poly_deg >= 13) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[13], 208)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[13], 224)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[13], 160)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[13], 176)); + } + + if (cw_poly_deg >= 14) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[14], 144)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[14], 208)); + syndromes[2] = GF16_ADD(syndromes[2], GF16_MUL0(buffer[14], 240)); + syndromes[3] = GF16_ADD(syndromes[3], GF16_MUL0(buffer[14], 224)); + } + + +} + +FEC_STATIC void rs16_calculate_two_syndromes(LC3_UINT8 *syndromes, LC3_UINT8 *cw, LC3_INT32 cw_poly_deg) +{ + LC3_INT32 i; + LC3_UINT8 buffer[15]; + + assert(cw_poly_deg >= 12); + + for (i = 0; i <= cw_poly_deg; i++) + { + buffer[i] = cw[i]; + } + + syndromes[0] = buffer[0]; + syndromes[1] = buffer[0]; + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[1], 32)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[1], 64)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[2], 64)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[2], 48)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[3], 128)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[3], 192)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[4], 48)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[4], 80)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[5], 96)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[5], 112)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[6], 192)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[6], 240)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[7], 176)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[7], 144)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[8], 80)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[8], 32)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[9], 160)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[9], 128)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[10], 112)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[10], 96)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[11], 224)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[11], 176)); + + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[12], 240)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[12], 160)); + + if (cw_poly_deg >= 13) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[13], 208)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[13], 224)); + } + + if (cw_poly_deg >= 14) + { + syndromes[0] = GF16_ADD(syndromes[0], GF16_MUL0(buffer[14], 144)); + syndromes[1] = GF16_ADD(syndromes[1], GF16_MUL0(buffer[14], 208)); + } + + +} + +FEC_STATIC LC3_INT8 rs16_calculate_elp(LC3_UINT8 *elp, LC3_UINT8 *syndromes, LC3_INT16 t) +/* calculates error locator polynomial vie Petterson's algorithm */ +{ + LC3_INT8 ret; + LC3_UINT8 det, det_inv, aux, all_s, *s; + LC3_UINT8 s22, s33, s44, s13, s14, s15; + LC3_UINT8 s23, s24, s25, s34, s35; + LC3_UINT8 a, b, c, d, e, f; + + ret = 0; + all_s = 0; + s = syndromes; + elp[0] = 1; + memset(elp + 1, 0, 3); + + switch (t) + { + case 3: + { + /* check for errors */ + all_s = s[0] | s[1] | s[2] | s[3] | s[4] | s[5]; + + if (all_s == 0) + { + break; + } + + /* assume 3 errors */ + s22 = GF16_MUL(s[1], s[1]); + s33 = GF16_MUL(s[2], s[2]); + s44 = GF16_MUL(s[3], s[3]); + s13 = GF16_MUL(s[0], s[2]); + + det = GF16_ADD(GF16_ADD(GF16_MUL(s13, s[4]), GF16_MUL(s44, s[0])), + GF16_ADD(GF16_MUL(s22, s[4]), GF16_MUL(s33, s[2]))); + + if (det) + { + det_inv = gf16_inv_table[det] << 4; + + s14 = GF16_MUL(s[0], s[3]); + s15 = GF16_MUL(s[0], s[4]); + + s23 = GF16_MUL(s[1], s[2]); + s24 = GF16_MUL(s[1], s[3]); + s25 = GF16_MUL(s[1], s[4]); + + s34 = GF16_MUL(s[2], s[3]); + s35 = GF16_MUL(s[2], s[4]); + + a = GF16_ADD(s35, s44) << 4; + b = GF16_ADD(s15, s33) << 4; + c = GF16_ADD(s13, s22) << 4; + d = GF16_ADD(s34, s25) << 4; + e = GF16_ADD(s23, s14) << 4; + f = GF16_ADD(s24, s33) << 4; + + aux = GF16_ADD(GF16_ADD(GF16_MUL0(a, s[3]), GF16_MUL0(d, s[4])), GF16_MUL0(f, s[5])); + elp[3] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_ADD(GF16_MUL0(d, s[3]), GF16_MUL0(b, s[4])), GF16_MUL0(e, s[5])); + elp[2] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_ADD(GF16_MUL0(f, s[3]), GF16_MUL0(e, s[4])), GF16_MUL0(c, s[5])); + elp[1] = GF16_MUL0(aux, det_inv); + + if (elp[3] == 0) + { + ret = t+1; + } + else + { + ret = 3; + } + break; + } + + /* assume two errors */ + det = GF16_ADD(GF16_MUL(syndromes[0], syndromes[2]), GF16_MUL(syndromes[1], syndromes[1])); + + if (det) + { + det_inv = gf16_inv_table[det] << 4; + + aux = GF16_ADD(GF16_MUL(syndromes[1], syndromes[2]), GF16_MUL(syndromes[0], syndromes[3])); + elp[1] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_MUL(syndromes[2], syndromes[2]), GF16_MUL(syndromes[1], syndromes[3])); + elp[2] = GF16_MUL0(aux, det_inv); + + /* check remaining LSF relations */ + aux = GF16_ADD(GF16_ADD(GF16_MUL(elp[2], s[2]), GF16_MUL(elp[1], s[3])), s[4]) + | GF16_ADD(GF16_ADD(GF16_MUL(elp[2], s[3]), GF16_MUL(elp[1], s[4])), s[5]); + + aux |= elp[2] == 0; + + if (aux != 0) + { + ret = t + 1; + } + else + { + ret = 2; + } + break; + } + + /* assume one error */ + if (syndromes[0] != 0) + { + elp[1] = GF16_MUL(syndromes[1], gf16_inv_table[syndromes[0]]); + + /* check remaining LSF relations */ + aux = GF16_ADD(GF16_MUL(elp[1], s[1]), s[2]) + | GF16_ADD(GF16_MUL(elp[1], s[2]), s[3]) + | GF16_ADD(GF16_MUL(elp[1], s[3]), s[4]) + | GF16_ADD(GF16_MUL(elp[1], s[4]), s[5]); + + aux |= elp[1] == 0; + + if (aux != 0) + { + ret = t + 1; + } + else + { + ret = 1; + } + break; + } + + ret = t + 1; + break; + } + case 2: + { + all_s = s[0] | s[1] | s[2] | s[3]; + + if (all_s == 0) + { + break; + } + + /* assume two errors */ + det = GF16_ADD(GF16_MUL(syndromes[0], syndromes[2]), GF16_MUL(syndromes[1], syndromes[1])); + + if (det) + { + det_inv = gf16_inv_table[det] << 4; + + aux = GF16_ADD(GF16_MUL(syndromes[1], syndromes[2]), GF16_MUL(syndromes[0], syndromes[3])); + elp[1] = GF16_MUL0(aux, det_inv); + + aux = GF16_ADD(GF16_MUL(syndromes[2], syndromes[2]), GF16_MUL(syndromes[1], syndromes[3])); + elp[2] = GF16_MUL0(aux, det_inv); + + if (elp[2] == 0) + { + ret = t + 1; + } + else + { + ret = 2; + } + break; + } + + /* assume one error */ + if (syndromes[0] != 0) + { + elp[1] = GF16_MUL(syndromes[1], gf16_inv_table[syndromes[0]]); + + /* check remaining LSF relation */ + aux = GF16_ADD(GF16_MUL(elp[1], s[1]), s[2]) | GF16_ADD(GF16_MUL(elp[1], s[2]), s[3]); + aux |= elp[1] == 0; + + if (aux != 0) + { + ret = t + 1; + } + else + { + ret = 1; + } + break; + } + + ret = t + 1; + break; + } + case 1: + { + all_s = s[0] | s[1]; + + if (all_s == 0) + { + break; + } + + if (syndromes[0] != 0) + { + elp[1] = GF16_MUL(syndromes[1], gf16_inv_table[syndromes[0]]); + if (elp[1] == 0) + { + ret = t + 1; + } + else + { + ret = 1; + } + break; + } + + ret = t + 1; + break; + } + default: assert(0 && "calculating elp of this degree not implemented"); + } + + + return ret; +} + +FEC_STATIC LC3_INT16 rs16_factorize_elp(LC3_UINT8 *err_pos, LC3_UINT8 *elp, LC3_INT16 deg_elp, LC3_INT16 max_pos) +{ + LC3_UINT8 beta, gamma; + LC3_INT16 zeros, err_pos0, err_pos1, err_pos2, ret; + + beta = 0; + gamma = 0; + zeros = 0; + ret = 0; + + switch (deg_elp) + { + case 0: break; + + case 1: + err_pos0 = gf16_log_g[elp[1]]; + if (err_pos0 > max_pos) + { + ret = 1; + break; + } + + err_pos[0] = (LC3_UINT8)err_pos0; + break; + + case 2: + zeros = rs16_elp_deg2_table[elp[1] | (elp[2] << 4)]; + if (zeros == 0) + { + + return 1; + } + + err_pos0 = zeros & 15; + err_pos1 = (zeros >> 4) & 15; + + if (err_pos0 > max_pos || err_pos1 > max_pos) + { + ret = 1; + break; + } + + err_pos[0] = (LC3_UINT8)err_pos0; + err_pos[1] = (LC3_UINT8)err_pos1; + break; + + case 3: + /* beta = a*a + b, gamma = a*b + c */ + beta = GF16_ADD(GF16_MUL(elp[1], elp[1]), elp[2]); + gamma = GF16_ADD(GF16_MUL(elp[1], elp[2]), elp[3]); + zeros = rs16_elp_deg3_table[beta | gamma << 4]; + + if (zeros == 0) + /* elp does not split over GF(16) or has multiple zeros */ + { + ret = 1; + break; + } + + /* remove shift from zeros */ + err_pos0 = GF16_ADD(zeros & 15, elp[1]); + err_pos1 = GF16_ADD((zeros >> 4) & 15, elp[1]); + err_pos2 = GF16_ADD((zeros >> 8) & 15, elp[1]); + + if (err_pos0 == 0 || err_pos1 == 0 || err_pos2 == 0) + { + + return 1; + } + + err_pos0 = gf16_log_g[err_pos0]; + err_pos1 = gf16_log_g[err_pos1]; + err_pos2 = gf16_log_g[err_pos2]; + + if (err_pos0 > max_pos || err_pos1 > max_pos || err_pos2 > max_pos) + { + ret = 1; + break; + } + + err_pos[0] = (LC3_UINT8)err_pos0; + err_pos[1] = (LC3_UINT8)err_pos1; + err_pos[2] = (LC3_UINT8)err_pos2; + + break; + + default: assert(0 && "invalid degree in rs16_error_locator"); + } + + + return ret; +} + +FEC_STATIC void rs16_calculate_errors(LC3_UINT8 *err_symb, LC3_UINT8 *err_pos, LC3_UINT8 *syndromes, LC3_INT8 deg_elp, LC3_INT8 t) +{ + LC3_UINT8 det_inv; + LC3_UINT8 x0, x1, x2; + LC3_UINT8 x0sq, x1sq, x2sq; + LC3_UINT8 c0, c1, c2; + LC3_UINT8 s0, s1, s2; + LC3_UINT8 tmp; + + UNUSED(t); + + assert(deg_elp <= t); + + switch (deg_elp) + { + case 0: break; + + case 1: + err_symb[0] = GF16_MUL(gf16_g_pow[15 - err_pos[0]], syndromes[0]); + + break; + + case 2: + s0 = (LC3_UINT8) (syndromes[0] << 4); + s1 = (LC3_UINT8) (syndromes[1] << 4); + + x0 = gf16_g_pow[err_pos[0]]; + x1 = gf16_g_pow[err_pos[1]]; + + x0sq = GF16_MUL(x0, x0); + x1sq = GF16_MUL(x1, x1); + + tmp = GF16_ADD(GF16_MUL(x0sq, x1), GF16_MUL(x1sq, x0)); + det_inv = gf16_inv_table[tmp] << 4; + + tmp = GF16_ADD(GF16_MUL0(x1sq, s0), GF16_MUL0(x1, s1)); + err_symb[0] = GF16_MUL0(tmp, det_inv); + + tmp = GF16_ADD(GF16_MUL0(x0sq, s0), GF16_MUL0(x0, s1)); + err_symb[1] = GF16_MUL0(tmp, det_inv); + + break; + + case 3: + s0 = syndromes[0] << 4; + s1 = syndromes[1] << 4; + s2 = syndromes[2] << 4; + + x0 = gf16_g_pow[err_pos[0]]; + x1 = gf16_g_pow[err_pos[1]]; + x2 = gf16_g_pow[err_pos[2]]; + + x0sq = GF16_MUL(x0, x0); + x1sq = GF16_MUL(x1, x1); + x2sq = GF16_MUL(x2, x2); + + tmp = GF16_MUL(GF16_ADD(x1, x0), GF16_ADD(x2, x0)); + tmp = GF16_MUL(GF16_ADD(x2, x1), tmp); + det_inv = gf16_inv_table[tmp] << 4; + + c0 = GF16_ADD(GF16_MUL(x1, x2sq), GF16_MUL(x2, x1sq)); + c1 = GF16_ADD(x2sq, x1sq); + c2 = GF16_ADD(x2, x1); + + err_symb[0] = GF16_ADD(GF16_ADD(GF16_MUL0(c0, s0), GF16_MUL0(c1, s1)), GF16_MUL0(c2, s2)); + + c0 = GF16_ADD(GF16_MUL(x0, x2sq), GF16_MUL(x2, x0sq)); + c1 = GF16_ADD(x2sq, x0sq); + c2 = GF16_ADD(x2, x0); + + err_symb[1] = GF16_ADD(GF16_ADD(GF16_MUL0(c0, s0), GF16_MUL0(c1, s1)), GF16_MUL0(c2, s2)); + + c0 = GF16_ADD(GF16_MUL(x0, x1sq), GF16_MUL(x1, x0sq)); + c1 = GF16_ADD(x1sq, x0sq); + c2 = GF16_ADD(x1, x0); + + err_symb[2] = GF16_ADD(GF16_ADD(GF16_MUL0(c0, s0), GF16_MUL0(c1, s1)), GF16_MUL0(c2, s2)); + + tmp = GF16_MUL0(err_symb[0], det_inv); + err_symb[0] = GF16_MUL(tmp, gf16_inv_table[x0]); + + tmp = GF16_MUL0(err_symb[1], det_inv); + err_symb[1] = GF16_MUL(tmp, gf16_inv_table[x1]); + + tmp = GF16_MUL0(err_symb[2], det_inv); + err_symb[2] = GF16_MUL(tmp, gf16_inv_table[x2]); + + break; + + default: assert(0 && "method not implemented\n"); break; + } + + +} + +/* hash functions for data validation */ + +/* hamming distance 4 */ +static const LC3_UINT32 crc14_mask[16] = {0, 17989, 35978, 51919, 71956, 89937, 103838, 119771, + 143912, 160877, 179874, 194791, 207676, 224633, 239542, 254451}; + +/* hamming distance 4 */ +static const LC3_UINT32 crc22_mask[16] = {0, 4788009, 9576018, 14356859, 19152036, 23933837, 28713718, 33500639, + 33650273, 38304072, 43214899, 47867674, 52775621, 57427436, 62346391, 67001278}; + +FEC_STATIC LC3_INT16 crc1(LC3_UINT8 *data, LC3_INT16 data_size, LC3_INT16 epmr, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check) +{ + LC3_UINT32 const *mask; + LC3_INT32 shift, i, fail; + LC3_UINT32 rem; + + fail = 0; + rem = 0; + + assert(hash_size > 0); + + switch (hash_size) + { + case 2: + shift = 14; + mask = crc14_mask; + break; + case 3: + shift = 22; + mask = crc22_mask; + break; + default: + shift = 0; + mask = 0; + assert(0 && "crc hash size not implemented"); + } + + /* data array contains 4-bit words */ + for (i = data_size - 1; i >= 0; i--) + { + rem = (rem << 4) ^ data[i]; + rem ^= mask[(rem >> shift) & 15]; + } + + rem = (rem << 4) ^ (epmr << 2); + rem ^= mask[(rem >> shift) & 15]; + + for (i = 0; i < 2 * hash_size - 1; i++) + { + rem <<= 4; + rem ^= mask[(rem >> shift) & 15]; + } + + rem ^= ((LC3_UINT32) epmr) << shift; + + if (check) + { + /* test hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + fail |= hash_val[i] ^ ((rem >> (4*i)) & 15); + } + } + else + { + /* write hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + hash_val[i] = (LC3_UINT8) ((rem >> (4*i)) & 15); + } + } + + + return fail; +} + +/* hamming distance = 4 */ +static const LC3_UINT32 crc16_mask[16] = {0, 107243, 190269, 214486, 289937, 380538, 428972, 469319, + 579874, 621513, 671263, 761076, 832947, 857944, 938638, 1044581}; + +FEC_STATIC LC3_INT16 crc2(LC3_UINT8 *data, LC3_INT16 data_size, LC3_UINT8 *hash_val, LC3_INT16 hash_size, LC3_INT16 check) +{ + LC3_UINT32 const *mask; + LC3_INT32 shift, i, fail; + LC3_UINT32 rem; + + fail = 0; + rem = 0; + + assert(hash_size > 0); + + switch (hash_size) + { + case 2: + shift = 16; + mask = crc16_mask; + break; + default: + shift = 0; + mask = 0; + assert(0 && "crc hash size not implemented"); + } + + /* data array contains 4-bit words */ + for (i = data_size - 1; i >= 0; i--) + { + rem = (rem << 4) ^ data[i]; + rem ^= mask[(rem >> shift) & 15]; + } + + for (i = 0; i < 2 * hash_size; i++) + { + rem <<= 4; + rem ^= mask[(rem >> shift) & 15]; + } + + if (check) + { + /* test hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + fail |= hash_val[i] ^ ((rem >> (4*i)) & 15); + } + } + else + { + /* write hash value */ + for (i = 0; i < 2 * hash_size; i++) + { + hash_val[i] = (LC3_UINT8) ((rem >> (4*i)) & 15); + } + } + + + return fail; +} + +/* simple float implementation */ +FEC_STATIC simple_float simple_float_mul(simple_float op1, simple_float op2) +{ + simple_float rop; + LC3_INT32 aux; + + aux = (op1.mantissa * op2.mantissa) >> 14; + rop.exponent = op1.exponent + op2.exponent; + if (aux & 32768L) + { + aux >>= 1; + rop.exponent ++; + } + rop.mantissa = (LC3_INT16) aux; + + + return rop; +} + +/* Auxiliary */ + +FEC_STATIC LC3_INT16 simple_float_cmp(simple_float op1, simple_float op2) +/* returns 1 if op1 > op2, 0 if op1 = op2, and -1 if op1 < op2 */ +{ + LC3_INT16 rval; + LC3_INT16 mdiff; + LC3_INT16 ediff; + + rval = 0; + + ediff = op1.exponent - op2.exponent; + mdiff = (LC3_INT16) op1.mantissa - (LC3_INT16) op2.mantissa; + + if (ediff == 0) + { + if (mdiff > 0) + { + rval = 1; + } + if (mdiff < 0) + { + rval = -1; + } + } + else + { + if (ediff > 0) + { + rval = 1; + } + if (ediff < 0) + { + rval = -1; + } + } + + + return rval; +} + diff --git a/lc3plus/apply_global_gain.c b/lc3plus/apply_global_gain.c new file mode 100755 index 0000000000..c67432e2c3 --- /dev/null +++ b/lc3plus/apply_global_gain.c @@ -0,0 +1,21 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) +{ + LC3_FLOAT gg = 0; + + gg = LC3_POW(10, (LC3_FLOAT)(global_gain_idx + global_gain_off) / 28); + + mult_const(x, gg, xLen); +} diff --git a/lc3plus/ari_codec.c b/lc3plus/ari_codec.c new file mode 100755 index 0000000000..80c75fcf0c --- /dev/null +++ b/lc3plus/ari_codec.c @@ -0,0 +1,1122 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void ac_shift_fl(Encoder_State_fl* st); +static void ac_encode_fl(Encoder_State_fl* st, LC3_INT sym_freq, LC3_INT cum_freq); +static void tns_order_freq_enc(LC3_INT enable_lpc_weighting, LC3_INT order, LC3_INT* symfreq, LC3_INT* cumfreq); +static void tns_coef_freq_enc(LC3_INT k, LC3_INT idx, LC3_INT* symfreq, LC3_INT* cumfreq); +static void ac_freq_fl(LC3_INT pki, LC3_INT s, LC3_INT* symfreq, LC3_INT* cumfreq); +static void ac_finalize_fl(Encoder_State_fl* st); +static void write_uint_forward_fl(Encoder_State_fl* st, LC3_INT val, LC3_INT numbits); +static void ari_enc_init(Encoder_State_fl* st, LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side); +static LC3_INT sign(LC3_INT x); +static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left); +static void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); +static void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); +static void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); +static LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); +static void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); +static void findNonZero(LC3_INT* in, LC3_INT* out, LC3_INT len, LC3_INT* outLen); +static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side); +static void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed); + +void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed) +{ + LC3_INT k = 0; + + *nf_seed = 0; + + for (k = 0; k < L_spec; k++) { + *nf_seed = *nf_seed + (abs(x[k]) & 32767) * k; + } + *nf_seed = *nf_seed & 65535; + + if (*nf_seed >= 32768) { + *nf_seed = *nf_seed - 65536; + } +} + +static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side) +{ + LC3_INT32 bp_local, bp_side_local, offset; + + if (st_fl->pc_bytes > 0) + { + if (!from_left && mask_side != 1) + { + return; + } + + if (st_fl->pc_c_bp_side > 0 && *bp_side < 0) + { + assert(mask_side == 1); + assert(st_fl->pc_b_right != -1); + *bp_side = st_fl->pc_b_right; + return; + } + + bp_local = *bp; + bp_side_local = *bp_side; + + if (from_left) + { + if (mask_side == 1) + { + bp_side_local = bp_side_local + 1; + } + } else { + bp_local = bp_local - 1; + } + + if (st_fl->pc_b_right == -1) + { + offset = -1; + if (!st_fl->pc_enc) + { + offset = offset + st_fl->pc_bytes; + } + + if ((bp_side_local + offset - bp_local) == st_fl->pc_bytes) + { + st_fl->pc_b_left = bp_local + 1; + st_fl->pc_b_right = bp_side_local - 1; + + if (st_fl->pc_enc) + { + st_fl->pc_return = 1; + return; + } + } + } + + if (!st_fl->pc_enc && st_fl->pc_b_right > -1) + { + if (from_left && *bp == st_fl->pc_b_left) + { + *bp = 0; + st_fl->pc_c_bp = 1; + } + + if (!from_left && bp_side_local == st_fl->pc_b_right) + { + *bp_side = st_fl->pc_bytes - 1; + st_fl->pc_c_bp_side = 1; + } + + if (st_fl->pc_bfi == 2) + { + + if ((st_fl->pc_c_bp && (*bp + 1) >= st_fl->pc_be_bp_left) || (st_fl->pc_c_bp_side && (*bp_side + 1) <= st_fl->pc_be_bp_right)) + { + st_fl->pc_bbi = 2; + } else if ((st_fl->pc_c_bp && *bp >= 0) || (st_fl->pc_c_bp_side && *bp_side <= (st_fl->pc_bytes - 1))) + { + st_fl->pc_bbi = 1; + } + } + } + } + + return; +} + + +void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) +{ + LC3_INT i = 0; + + if (!st_fl->pc_enc) + { + *bp = *bp + st_fl->pc_bytes; + } + + st_fl->ac_low_fl = 0; + + st_fl->ac_range_fl = (LC3_UINT32)pow(2, 24) - (LC3_UINT32)1; + for (i = 0; i < 3; i++) { + pc_check_bytes(bp, st_fl, from_left, mask_side, bp_side); + + st_fl->ac_low_fl = (st_fl->ac_low_fl << 8) + (LC3_UINT32)ptr[*bp]; + *bp = *bp + 1; + } + + st_fl->BER_detect = 0; +} + +void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) +{ + LC3_INT i = 0, j = 0; + + *numsym = 8; + + j = 0; + for (i = 1; i < 9; i++) { + symfreq[j] = ari_tns_order_cf[enable_lpc_weighting][i]; + j++; + } + + for (i = 0; i < *numsym; i++) { + symfreq[i] -= ari_tns_order_cf[enable_lpc_weighting][i]; + } + + for (i = 0; i < *numsym; i++) { + cumfreq[i] = ari_tns_order_cf[enable_lpc_weighting][i]; + } +} + +/* Returns val */ +LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) +{ + LC3_INT val = 0, tmp = 0; + + + tmp = st->ac_range_fl >> 10; + + if (st->ac_low_fl >= (LC3_UINT32)(tmp << 10)) { + st->BER_detect = 1; + } + + val = num_sym - 1; + + while (st->ac_low_fl < (LC3_UINT32)(tmp * cum_freq[val])) { + val--; + } + + st->ac_low_fl = st->ac_low_fl - tmp * cum_freq[val]; + st->ac_range_fl = tmp * sym_freq[val]; + + while (st->ac_range_fl < pow(2, 16)) { + st->ac_low_fl = st->ac_low_fl << 8; + st->ac_low_fl = ((LC3_INT)st->ac_low_fl) & ((LC3_INT)(pow(2, 24) - 1)); + + pc_check_bytes(bp, st, from_left, mask_side, bp_side); + + st->ac_low_fl = st->ac_low_fl + ptr[*bp]; + *bp = *bp + 1; + st->ac_range_fl = st->ac_range_fl << 8; + } + + return val; +} + +void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) +{ + LC3_INT i = 0, j = 0; + + *numsym = 18 - 1; + + j = 0; + for (i = 1; i <= *numsym; i++) { + symfreq[j] = ari_tns_freq_cf[k][i]; + j++; + } + + for (i = 0; i < *numsym; i++) { + symfreq[i] -= ari_tns_freq_cf[k][i]; + } + + for (i = 0; i < *numsym; i++) { + cumfreq[i] = ari_tns_freq_cf[k][i]; + } +} + +void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) +{ + LC3_INT i = 0, j = 0; + + *numsym = 18 - 1; + + j = 0; + for (i = 1; i <= *numsym; i++) { + symfreq[j] = ari_spec_cumfreq_fl[pki][i]; + j++; + } + + for (i = 0; i < *numsym; i++) { + symfreq[i] -= ari_spec_cumfreq_fl[pki][i]; + } + + for (i = 0; i < *numsym; i++) { + cumfreq[i] = ari_spec_cumfreq_fl[pki][i]; + } +} + +void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left) +{ + *bit = 0; + + UNUSED(bp); + UNUSED(st_fl); + UNUSED(from_left); + + if (ptr[*bp_side] & *mask_side) { + *bit = 1; + } else { + *bit = 0; + } + + if (*mask_side == 128) { + *mask_side = 1; + *bp_side = *bp_side - 1; + } else { + *mask_side = *mask_side * 2; + } +} + +void findNonZero(LC3_INT* in, LC3_INT* out, LC3_INT len, LC3_INT* outLen) +{ + LC3_INT i = 0, j = 0; + + for (i = 0; i < len; i++) { + if (in[i] != 0) { + out[j] = i; + j++; + } + } + + *outLen = j; +} + +void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting, + LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx, + LC3_INT gg_idx, uint8_t * resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes, + LC3_INT* nbits_residual, LC3_INT* residualPresent, LC3_INT frame_dms, + LC3_INT32 n_pc, LC3_INT32 be_bp_left, LC3_INT32 be_bp_right, LC3_INT32 enc, LC3_INT32 *b_left, LC3_INT32 *spec_inv_idx, + LC3_INT hrmode +) +{ + Decoder_State_fl st; + LC3_INT a = 0, b = 0, t = 0, bp = 0; + LC3_INT c = 0; + LC3_INT nbits_side = 0, extra_bits = 0; + LC3_UINT8* ptr = NULL; + LC3_INT n = 0, k = 0, lev = 0; + LC3_INT max_lev = 0, tmp = 0; + LC3_INT sym_freq[MAX_LEN] = {0}, cum_freq[MAX_LEN] = {0}, numsym = 0, bit = 0, lev1 = 0, pki = 0, sym = 0, + save_lev[MAX_LEN] = {0}, idx_len = 0, total_bits = 0, nbits_ari = 0, idx[MAX_LEN] = {0}, rateFlag = 0; + + total_bits = 8 * numbytes; + + memset(&st, 0, sizeof(st)); + + + st.pc_bytes = (n_pc + 1) >> 1; + st.pc_b_left = numbytes + 1; + st.pc_b_right = -1; + st.pc_enc = enc; + st.pc_bfi = *bfi; + st.pc_be_bp_left = floor(be_bp_left / 8); + st.pc_be_bp_right = floor(be_bp_right / 8) - 1; + *spec_inv_idx = L_spec + 1; + assert(st.pc_be_bp_right < st.pc_bytes || st.pc_bytes == 0); + + /* Rate flag */ + if (fs_idx != 5) + { + if (total_bits > (160 + fs_idx * 160)) { + rateFlag = 512; + } + } + + /* Init */ + c = 0; + t = 0; + bp = 0; + + *b_left = -1; + + ptr = bytes; + + /* Start Decoding */ + ac_dec_init_fl(ptr, &bp, &st, 1, mask_side, &bp_side); + + /* Decode TNS data */ + tmp = MAXLAG; + if (frame_dms == 25) + { + tmp /= 2; + } + if (frame_dms == 50) + { + tmp /= 2; + } + + /* Decode TNS data */ + for (n = 0; n < tns_numfilters; n++) { + + if (tns_order[n] > 0) { + tns_order_freq(enable_lpc_weighting, sym_freq, cum_freq, &numsym); + + tns_order[n] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + tns_order[n] = tns_order[n] + 1; + + if (tns_order[n] > tmp) + { + st.BER_detect = 1; + } + + if (st.pc_bbi == 1) + { + spec_inv_idx = 0; + } else if (st.pc_bbi == 2) + { + st.BER_detect = 1; + } + + for (k = 0; k < tns_order[n]; k++) { + if (bp_side < bp) + { + *bfi = 1; + return; + } + + tns_coef_freq(k, sym_freq, cum_freq, &numsym); + tns_idx[n * 8 + k] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 1) + { + spec_inv_idx = 0; + } else if (st.pc_bbi == 2) + { + st.BER_detect = 1; + } + } + } + } + + if (st.BER_detect > 0) { + *bfi = 1; + return; + } + + /* Spectral data */ + for (k = 0; k < lastnz; k = k + 2) { + /* Context */ + t = c + rateFlag; + + if (k > L_spec / 2) { + t = t + 256; + } + + /* Decode amplitude */ + x[k] = 0; + x[k + 1] = 0; + + if (hrmode == 1) { + max_lev = 13 + 8; + } else { + max_lev = 13; + } + + for (lev = 0; lev <= max_lev; lev++) { + lev1 = MIN(lev, 3); + pki = ari_spec_lookup_fl[t + lev1 * 1024]; + ac_freq(pki, sym_freq, cum_freq, &numsym); + sym = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 1) + { + *spec_inv_idx = MIN(*spec_inv_idx, k); + } else if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + if (sym < 16) { + break; + } + + if (lsbMode == 0 || lev > 0) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + x[k] = x[k] + (bit << lev); + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + x[k + 1] = x[k + 1] + (bit << lev); + } + } + + if ((lev - 1) == 13 && sym == 16) + { + st.BER_detect = 1; + } + + if (hrmode == 0) { + lev = MIN(lev, 13); + } + + if (lsbMode == 1) { + save_lev[k] = lev; + } + + a = sym & 3; + b = sym >> 2; + + x[k] = x[k] + (a << lev); + x[k + 1] = x[k + 1] + (b << lev); + + /* Decode signs */ + if (x[k] > 0) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k; + x[k] = 0; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + if (bit == 1) { + x[k] = -x[k]; + } + } + + if (x[k + 1] > 0) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *spec_inv_idx = k + 1; + x[k + 1] = 0; + calculate_nfseed(x, k, nf_seed); + return; + } + + if (bit == 1) { + x[k + 1] = -x[k + 1]; + } + } + + /* Context */ + lev1 = MIN(lev, 3); + if (lev1 <= 1) { + t = 1 + (a + b) * (lev1 + 1); + } else { + t = 12 + lev1; + } + + c = (c & 15) * 16 + t; + + if (((bp - bp_side) > 3 && (st.pc_c_bp == st.pc_c_bp_side))) { + + if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) + { + *bfi = 2; + calculate_nfseed(x, k, nf_seed); + return; + } + + *bfi = 1; + return; + } + + if (st.BER_detect > 0) + { + if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) + { + *bfi = 2; + calculate_nfseed(x, k, nf_seed); + return; + } + + *bfi = 1; + return; + } + } + + /* Residual bits */ + nbits_side = total_bits - (8 * bp_side + 8 - (31 - clz_func(mask_side))); + nbits_ari = (bp - 3) * 8; + extra_bits = 25 - (31 - clz_func(st.ac_range_fl)); + + if (enc == 0) + { + if (st.pc_c_bp == 0) + { + nbits_ari = (bp - st.pc_bytes - 3) * 8; + } else { + nbits_ari = (bp + st.pc_b_left - st.pc_bytes - 3) * 8; + } + + if (st.pc_c_bp_side != 0) + { + nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side)); + } + } + + + *nbits_residual = total_bits - (nbits_side + nbits_ari + extra_bits); + + if (*nbits_residual < 0) { + if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) + { + *bfi = 2; + calculate_nfseed(x, k, nf_seed); + return; + } + + *bfi = 1; + return; + } + + if (lsbMode == 0) { + findNonZero(x, idx, L_spec, &idx_len); + if (hrmode) + { + idx_len *= EXT_RES_ITER_MAX; + } + *nbits_residual = MIN(*nbits_residual, idx_len); + *residualPresent = 1; + + memset(resBits, 0, MAX_RESBITS_LEN); + + for (k = 0; k < *nbits_residual; k++) { + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &tmp, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(uint8_t) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + resBits[k >> 3] |= tmp << (k & 7); + } + } else { + for (k = 0; k < lastnz; k = k + 2) { + if (save_lev[k] > 0) { + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 1) { + if (x[k] > 0) { + x[k] = x[k] + 1; + } else if (x[k] < 0) { + x[k] = x[k] - 1; + } else { + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 0) { + x[k] = 1; + } else { + x[k] = -1; + } + } + } + + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 1) { + if (x[k + 1] > 0) { + x[k + 1] = x[k + 1] + 1; + } else if (x[k + 1] < 0) { + x[k + 1] = x[k + 1] - 1; + } else { + if (*nbits_residual == 0) { + break; + } + + pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); + read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); + + if (st.pc_return) + { + *b_left = st.pc_b_left; + return; + } + + if (st.pc_bbi == 2) + { + *bfi = 0; + memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); + calculate_nfseed(x, k, nf_seed); + return; + } + + *nbits_residual = *nbits_residual - 1; + + if (bit == 0) { + x[k + 1] = 1; + } else { + x[k + 1] = -1; + } + } + } + } + } + } + + /* Noise-filling seed */ + calculate_nfseed(x, L_spec, nf_seed); + + /* Zero frame flag */ + if (lastnz == 2 && x[0] == 0 && x[1] == 0 && gg_idx == 0 && fac_ns_idx == 7) { + *zero_frame = 1; + } else { + *zero_frame = 0; + } + + if (enc) + { + if (st.pc_bytes > 0) + { + if (st.pc_b_left > numbytes) + { + *b_left = bp_side - st.pc_bytes; + } + } + } + + if ((*bfi == 2) && (*spec_inv_idx == (L_spec + 1))) + { + *bfi = 0; + } + + *spec_inv_idx = *spec_inv_idx - 1; +} + +void ac_encode_fl(Encoder_State_fl* st, LC3_INT sym_freq, LC3_INT cum_freq) +{ + LC3_INT r = 0; + + r = st->range >> 10; + st->low = st->low + r * cum_freq; + + if ((st->low >> 24) == 1) { + st->carry = 1; + } + + st->low = (st->low) & ((LC3_INT)pow(2, 24) - 1); + st->range = r * sym_freq; + + while (st->range < (LC3_INT)pow(2, 16)) { + st->range = st->range << 8; + ac_shift_fl(st); + } +} + +void ac_shift_fl(Encoder_State_fl* st) +{ + if (st->low < 16711680 || st->carry == 1) { + if (st->cache >= 0) { + st->ptr[st->bp] = st->cache + st->carry; + st->bp = st->bp + 1; + } + + while (st->carry_count > 0) { + st->ptr[st->bp] = (st->carry + 255) & 255; + st->bp = st->bp + 1; + st->carry_count = st->carry_count - 1; + } + + st->cache = st->low >> 16; + st->carry = 0; + } else { + st->carry_count = st->carry_count + 1; + } + + st->low = st->low << 8; + st->low = (st->low) & ((LC3_INT)pow(2, 24) - 1); +} + +void tns_order_freq_enc(LC3_INT enable_lpc_weighting, LC3_INT order, LC3_INT* symfreq, LC3_INT* cumfreq) +{ + *symfreq = tns_freq_cf[enable_lpc_weighting][order] - tns_freq_cf[enable_lpc_weighting][order - 1]; + *cumfreq = tns_freq_cf[enable_lpc_weighting][order - 1]; +} + +void tns_coef_freq_enc(LC3_INT k, LC3_INT idx, LC3_INT* symfreq, LC3_INT* cumfreq) +{ + *symfreq = tns_cf[k][idx + 1] - tns_cf[k][idx]; + *cumfreq = tns_cf[k][idx]; +} + +void ac_freq_fl(LC3_INT pki, LC3_INT s, LC3_INT* symfreq, LC3_INT* cumfreq) +{ + *symfreq = ari_spec_cumfreq_fl[pki][s + 1] - ari_spec_cumfreq_fl[pki][s]; + *cumfreq = ari_spec_cumfreq_fl[pki][s]; +} + +void ac_finalize_fl(Encoder_State_fl* st) +{ + LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0; + + bits = 24 - floor(LC3_LOGTWO(st->range)); + mask = ((LC3_INT)pow(2, 24) - 1) >> bits; + val = st->low + mask; + over1 = val >> 24; + + val = (val) & ((LC3_INT)pow(2, 24) - 1); + high = st->low + st->range; + over2 = high >> 24; + high = high & ((LC3_INT)pow(2, 24) - 1); + val = val & (((LC3_INT)pow(2, 24) - 1) - mask); + + if (over1 == over2) { + if (val + mask >= high) { + bits = bits + 1; + mask = mask >> 1; + val = ((st->low + mask) & ((LC3_INT)pow(2, 24) - 1)) & (((LC3_INT)pow(2, 24) - 1) - mask); + } + + if (val < st->low) { + st->carry = 1; + } + } + + st->low = val; + + b = bits; + + if (bits > 8) { + for (; b >= 1; b = b - 8) { + ac_shift_fl(st); + } + } else { + ac_shift_fl(st); + } + + bits = b; + if (bits < 0) { + bits += 8; + } + + if (st->carry_count > 0) { + st->ptr[st->bp] = st->cache; + st->bp = st->bp + 1; + + for (c = st->carry_count; c >= 2; c--) { + st->ptr[st->bp] = 255; + st->bp = st->bp + 1; + } + + write_uint_forward_fl(st, 255 << (bits - 8), bits); + } else { + write_uint_forward_fl(st, st->cache, bits); + } +} + +void write_uint_forward_fl(Encoder_State_fl* st, LC3_INT val, LC3_INT numbits) +{ + LC3_INT k = 0, bit = 0, mask = 128; + + for (k = 0; k < numbits; k++) { + bit = val & mask; + + if (bit == 0) { + st->ptr[st->bp] = st->ptr[st->bp] & (255 - mask); + } else { + st->ptr[st->bp] = st->ptr[st->bp] | mask; + } + + mask = mask >> 1; + } +} + +void ari_enc_init(Encoder_State_fl* st, LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side) +{ + st->ptr = bytes; + st->bp_side = bp_side; + st->mask_side = mask_side; + st->bp = 0; + st->low = 0; + st->range = (LC3_INT)pow(2, 24) - 1; + st->cache = -1; + st->carry = 0; + st->carry_count = 0; +} + +LC3_INT sign(LC3_INT x) +{ + if (x > 0) + return 1; + + if (x < 0) + return -1; + + return 0; +} + +void processAriEncoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT* x, LC3_INT* tns_order, LC3_INT tns_numfilters, + LC3_INT* tns_idx, LC3_INT lastnz, LC3_INT* codingdata, uint8_t* res_bits, LC3_INT resBitsLen, LC3_INT lsbMode, + LC3_INT nbbits, LC3_INT enable_lpc_weighting) +{ + LC3_INT total_bits = 0, cumfreq = 0, symfreq = 0, k = 0, i = 0, j = 0, lev = 0, lev1 = 0; + LC3_INT bit1 = 0, bit2 = 0, lsb1 = 0, lsb2 = 0, a = 0, b = 0, bit = 0, pki = 0, nbits_side = 0; + LC3_INT nbits_residual_enc = 0, nbits_ari = 0, lsbs[MAX_LEN] = {0}, lsbsLen = 0; + Encoder_State_fl st; + + ari_enc_init(&st, bytes, &bp_side, &mask_side); + + total_bits = nbbits; + + /* TNS data */ + for (i = 0; i < tns_numfilters; i++) { + if (tns_order[i] > 0) { + tns_order_freq_enc(enable_lpc_weighting, tns_order[i], &symfreq, &cumfreq); + ac_encode_fl(&st, symfreq, cumfreq); + + for (j = 0; j < tns_order[i]; j++) { + tns_coef_freq_enc(j, tns_idx[i * 8 + j], &symfreq, &cumfreq); + ac_encode_fl(&st, symfreq, cumfreq); + } + } + } + + /* Spectral data */ + for (k = 0; k < lastnz; k = k + 2) { + for (lev = 0; lev < codingdata[1]; lev++) { + lev1 = MIN(lev, 3); + pki = ari_spec_lookup_fl[codingdata[0] + lev1 * 1024]; + ac_freq_fl(pki, 16, &symfreq, &cumfreq); + + ac_encode_fl(&st, symfreq, cumfreq); + bit1 = (abs(x[k]) >> lev) & 1; + bit2 = (abs(x[k + 1]) >> lev) & 1; + + if (lsbMode == 1 && lev == 0) { + lsb1 = bit1; + lsb2 = bit2; + } else { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit1); + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit2); + } + } + + lev1 = MIN(MAX(codingdata[1], 0), 3); + pki = ari_spec_lookup_fl[codingdata[0] + lev1 * 1024]; + + ac_freq_fl(pki, codingdata[2], &symfreq, &cumfreq); + ac_encode_fl(&st, symfreq, cumfreq); + + a = abs(x[k]); + b = abs(x[k + 1]); + + if (lsbMode == 1 && codingdata[1] > 0) { + a = a >> 1; + lsbs[lsbsLen] = lsb1; + lsbsLen++; + + if (a == 0 && x[k] != 0) { + bit = MAX(0, -sign(x[k])); + lsbs[lsbsLen] = bit; + lsbsLen++; + } + + b = b >> 1; + lsbs[lsbsLen] = lsb2; + lsbsLen++; + + if (b == 0 && x[k + 1] != 0) { + bit = MAX(0, -sign(x[k + 1])); + lsbs[lsbsLen] = bit; + lsbsLen++; + } + } + + if (a != 0) { + bit = MAX(0, -sign(x[k])); + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit); + } + + if (b != 0) { + bit = MAX(0, -sign(x[k + 1])); + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, bit); + } + + codingdata += 3; + } + + /* Residual bits */ + nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOGTWO(*(st.mask_side))); + nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOGTWO(st.range)); + + if (st.cache >= 0) { + nbits_ari = nbits_ari + 8; + } + + if (st.carry_count > 0) { + nbits_ari = nbits_ari + st.carry_count * 8; + } + + nbits_residual_enc = MAX(total_bits - (nbits_side + nbits_ari), 0); + /* the max operation avoids in very rare cases, that + * nbits_residual_enc becomes negative; having overwritten + * the last bit(s) of the side information is in this case + * assumed to be not critical, since no spectral data bits + * were written */ + + if (lsbMode == 0) { + nbits_residual_enc = MIN(nbits_residual_enc, resBitsLen); + for (k = 0; k < nbits_residual_enc; k++) { + if (res_bits[k >> 3] & (1 << (k & 7))) + { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, 1); + } + else + { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, 0); + } + } + } else { + nbits_residual_enc = MIN(nbits_residual_enc, lsbsLen); + + for (k = 0; k < nbits_residual_enc; k++) { + write_bit_backward_fl(st.ptr, st.bp_side, st.mask_side, lsbs[k]); + } + } + + ac_finalize_fl(&st); +} + diff --git a/lc3plus/attack_detector.c b/lc3plus/attack_detector.c new file mode 100755 index 0000000000..c9f7c0a94c --- /dev/null +++ b/lc3plus/attack_detector.c @@ -0,0 +1,105 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, + LC3_FLOAT* attdec_filter_mem, LC3_INT attackHandlingOn, LC3_INT attdec_nblocks, LC3_INT attdec_hangover_threshold) +{ + LC3_FLOAT f_sig[160] = {0}, block_nrg[4] = {0}, sum = 0, tmpEne = 0, *ptr = NULL, tmp[162] = {0}; + LC3_INT i = 0, j = 0, attackPosition = 0; + LC3_FLOAT mval = 0; + LC3_INT frame_size_16k = attdec_nblocks * 40; + + + ptr = &tmp[2]; + + + + if (attackHandlingOn) { + /* Decimate 96, 48 and 32 kHz signals to 16 kHz */ + if (fs == 96000) { + for (i = 0; i < frame_size;) { + ptr[j] = in[i] + in[i + 1] + in[i + 2] + in[i + 3] + in[i + 4] + in[i + 5]; + i = i + 6; + j++; + } + mval = 1e-5; + } else if (fs == 48000) { + j = 0; + for (i = 0; i < frame_size;) { + ptr[j] = (in[i] + in[i + 1] + in[i + 2]); + i = i + 3; + j++; + } + } else if (fs == 32000) { + j = 0; + for (i = 0; i < frame_size;) { + ptr[j] = (in[i] + in[i + 1]); + i = i + 2; + j++; + } + } else if (fs == 24000) { + j = 0; + for (i = 0; i < frame_size;) { + ptr[j] = (in[i] + (in[i + 1] + in[i + 2]) / 2.0); + i = i + 3; + j++; + } + } + + /* Filter */ + ptr[-2] = (LC3_FLOAT)attdec_filter_mem[0]; + ptr[-1] = (LC3_FLOAT)attdec_filter_mem[1]; + + attdec_filter_mem[0] = ptr[frame_size_16k - 2]; + attdec_filter_mem[1] = ptr[frame_size_16k - 1]; + + for (i = 159; i >= 0; i--) { + tmpEne = 0; + + tmpEne += ptr[i] * 0.375; + tmpEne += ptr[i - 1] * (-0.5); + tmpEne += ptr[i - 2] * (0.125); + + f_sig[i] = tmpEne; + } + + for (i = 0; i < attdec_nblocks; i++) { + sum = 0; + for (j = 0; j < 40; j++) { + sum += f_sig[j + i * 40] * f_sig[j + i * 40]; + } + + block_nrg[i] = sum; + } + + *attackFlag = 0; + attackPosition = -1; + + for (i = 0; i < attdec_nblocks; i++) { + tmpEne = block_nrg[i] / 8.5; + + if (tmpEne > MAX(*accNrg, mval)) { + *attackFlag = 1; + attackPosition = i + 1; + } + + *accNrg = MAX(block_nrg[i], 0.25 * (*accNrg)); + } + + if (*lastAttackPosition > attdec_hangover_threshold) { + *attackFlag = 1; + } + + *lastAttackPosition = attackPosition; + } +} diff --git a/lc3plus/clib.h b/lc3plus/clib.h new file mode 100755 index 0000000000..bd70927808 --- /dev/null +++ b/lc3plus/clib.h @@ -0,0 +1,27 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef CLIB_H +#define CLIB_H + +#include +#include +#include +#include +#include +#include +#include +#ifndef _MSC_VER +#include "strings.h" +#else +#include +#endif + +#endif diff --git a/lc3plus/constants.c b/lc3plus/constants.c new file mode 100755 index 0000000000..8189761a04 --- /dev/null +++ b/lc3plus/constants.c @@ -0,0 +1,3803 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +/* DCT */ +#define ENTRY_DCT2_1 {0.353553, 0.000000} +#define ENTRY_DCT2_2 {0.351851, -0.034654} +#define ENTRY_DCT2_3 {0.346760, -0.068975} +#define ENTRY_DCT2_4 {0.338329, -0.102631} +#define ENTRY_DCT2_5 {0.326641, -0.135299} +#define ENTRY_DCT2_6 {0.311806, -0.166664} +#define ENTRY_DCT2_7 {0.293969, -0.196424} +#define ENTRY_DCT2_8 {0.273300, -0.224292} +#define ENTRY_DCT2_9 {0.250000, -0.250000} +#define ENTRY_DCT2_10 {0.224292, -0.273300} +#define ENTRY_DCT2_11 {0.196424, -0.293969} +#define ENTRY_DCT2_12 {0.166664, -0.311806} +#define ENTRY_DCT2_13 {0.135299, -0.326641} +#define ENTRY_DCT2_14 {0.102631, -0.338329} +#define ENTRY_DCT2_15 {0.068975, -0.346760} +#define ENTRY_DCT2_16 {0.034654, -0.351851} + +const Complex dct2_16[16] = { +ENTRY_DCT2_1, +ENTRY_DCT2_2, +ENTRY_DCT2_3, +ENTRY_DCT2_4, +ENTRY_DCT2_5, +ENTRY_DCT2_6, +ENTRY_DCT2_7, +ENTRY_DCT2_8, +ENTRY_DCT2_9, +ENTRY_DCT2_10, +ENTRY_DCT2_11, +ENTRY_DCT2_12, +ENTRY_DCT2_13, +ENTRY_DCT2_14, +ENTRY_DCT2_15, +ENTRY_DCT2_16 +}; + +const LC3_INT ari_tns_order_cf[2][9] = {{0, 3, 12, 35, 89, 200, 390, 658, 1024}, + {0, 14, 56, 156, 313, 494, 672, 839, 1024}}; + +const LC3_INT ari_tns_freq_cf[8][18] = { + {0, 1, 6, 21, 52, 106, 192, 289, 409, 568, 720, 831, 935, 994, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 17, 60, 154, 293, 466, 626, 780, 911, 989, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 13, 56, 162, 361, 578, 788, 929, 1003, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 6, 17, 66, 270, 555, 852, 972, 1011, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 12, 54, 295, 636, 950, 1008, 1017, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 224, 590, 967, 1014, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 300, 630, 1001, 1018, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 11, 308, 309, 991, 1017, 1019, 1020, 1021, 1022, 1023, 1024}}; + +const LC3_INT ari_spec_lookup_fl[4096] = { + 0x01, 0x27, 0x07, 0x19, 0x16, 0x16, 0x1C, 0x16, 0x16, 0x16, 0x16, 0x1C, 0x1C, 0x1C, 0x22, 0x1F, 0x1F, 0x28, 0x2B, + 0x2E, 0x31, 0x34, 0x0E, 0x11, 0x24, 0x24, 0x24, 0x26, 0x00, 0x39, 0x26, 0x16, 0x00, 0x08, 0x09, 0x0B, 0x2F, 0x0E, + 0x0E, 0x11, 0x24, 0x24, 0x24, 0x26, 0x3B, 0x3B, 0x26, 0x16, 0x16, 0x1A, 0x2E, 0x1D, 0x1E, 0x20, 0x21, 0x23, 0x24, + 0x24, 0x24, 0x26, 0x00, 0x3B, 0x17, 0x16, 0x2E, 0x2E, 0x2D, 0x2F, 0x30, 0x32, 0x32, 0x12, 0x36, 0x36, 0x36, 0x26, + 0x3B, 0x3B, 0x3B, 0x16, 0x00, 0x3E, 0x3F, 0x03, 0x21, 0x02, 0x02, 0x3D, 0x14, 0x14, 0x14, 0x15, 0x3B, 0x3B, 0x27, + 0x1C, 0x1C, 0x3F, 0x3F, 0x03, 0x21, 0x02, 0x02, 0x3D, 0x26, 0x26, 0x26, 0x15, 0x3B, 0x3B, 0x27, 0x1C, 0x1C, 0x06, + 0x06, 0x06, 0x02, 0x12, 0x3D, 0x14, 0x15, 0x15, 0x15, 0x3B, 0x27, 0x27, 0x07, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33, 0x35, 0x36, 0x14, 0x26, + 0x26, 0x39, 0x27, 0x27, 0x27, 0x07, 0x18, 0x22, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x38, 0x26, 0x39, 0x39, 0x3B, 0x07, 0x07, 0x07, 0x2A, + 0x2A, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x04, 0x04, 0x05, 0x15, 0x15, 0x3B, 0x07, 0x07, 0x07, 0x07, 0x19, 0x19, 0x19, 0x22, 0x04, 0x04, 0x04, 0x04, + 0x05, 0x17, 0x17, 0x27, 0x07, 0x07, 0x07, 0x2A, 0x19, 0x19, 0x16, 0x1F, 0x1F, 0x27, 0x27, 0x27, 0x27, 0x07, 0x07, + 0x2A, 0x00, 0x19, 0x16, 0x16, 0x16, 0x1C, 0x22, 0x1F, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x28, 0x08, 0x09, 0x31, 0x31, 0x34, 0x11, 0x11, 0x11, 0x04, 0x00, + 0x14, 0x11, 0x3C, 0x28, 0x28, 0x08, 0x2B, 0x1B, 0x31, 0x31, 0x0E, 0x11, 0x11, 0x11, 0x24, 0x2A, 0x2A, 0x11, 0x39, + 0x39, 0x28, 0x08, 0x1A, 0x1B, 0x31, 0x0C, 0x0E, 0x11, 0x11, 0x11, 0x24, 0x00, 0x26, 0x24, 0x01, 0x08, 0x08, 0x2B, + 0x09, 0x0B, 0x31, 0x0C, 0x0E, 0x0E, 0x21, 0x32, 0x32, 0x32, 0x3D, 0x24, 0x27, 0x08, 0x08, 0x2B, 0x2E, 0x31, 0x34, + 0x1E, 0x0E, 0x0E, 0x21, 0x32, 0x32, 0x32, 0x32, 0x12, 0x19, 0x08, 0x08, 0x2B, 0x2E, 0x31, 0x34, 0x1E, 0x0E, 0x0E, + 0x12, 0x05, 0x05, 0x05, 0x3D, 0x12, 0x17, 0x2B, 0x2B, 0x2B, 0x09, 0x31, 0x34, 0x03, 0x0E, 0x0E, 0x32, 0x32, 0x32, + 0x32, 0x3D, 0x11, 0x18, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, + 0x2B, 0x2B, 0x2B, 0x2B, 0x09, 0x0B, 0x34, 0x34, 0x0E, 0x0E, 0x11, 0x3D, 0x3D, 0x3D, 0x36, 0x11, 0x27, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2C, 0x1B, 0x1D, + 0x34, 0x30, 0x34, 0x34, 0x11, 0x11, 0x11, 0x11, 0x02, 0x11, 0x07, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, + 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x09, 0x1B, 0x1B, 0x0C, 0x34, 0x0E, 0x0E, 0x3A, 0x29, + 0x29, 0x29, 0x06, 0x11, 0x25, 0x09, 0x09, 0x09, 0x1B, 0x0B, 0x31, 0x0C, 0x34, 0x0E, 0x0E, 0x0E, 0x32, 0x00, 0x35, + 0x11, 0x1C, 0x34, 0x34, 0x31, 0x34, 0x0C, 0x34, 0x1E, 0x0E, 0x0E, 0x11, 0x02, 0x02, 0x02, 0x26, 0x26, 0x22, 0x1F, + 0x22, 0x22, 0x1F, 0x1F, 0x1F, 0x1F, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x1F, 0x13, 0x2C, 0x2C, 0x3E, 0x1E, + 0x20, 0x3A, 0x23, 0x24, 0x24, 0x26, 0x00, 0x3B, 0x07, 0x07, 0x27, 0x22, 0x22, 0x2D, 0x2F, 0x30, 0x21, 0x23, 0x23, + 0x24, 0x26, 0x26, 0x26, 0x3B, 0x07, 0x07, 0x27, 0x22, 0x22, 0x3E, 0x1E, 0x0F, 0x32, 0x35, 0x35, 0x36, 0x15, 0x15, + 0x15, 0x3B, 0x07, 0x07, 0x07, 0x22, 0x1E, 0x1E, 0x30, 0x21, 0x3A, 0x12, 0x12, 0x38, 0x17, 0x17, 0x17, 0x3B, 0x07, + 0x07, 0x18, 0x22, 0x22, 0x06, 0x06, 0x3A, 0x35, 0x36, 0x36, 0x15, 0x3B, 0x3B, 0x3B, 0x27, 0x07, 0x07, 0x2A, 0x22, + 0x06, 0x06, 0x21, 0x3A, 0x35, 0x36, 0x3D, 0x15, 0x3B, 0x3B, 0x3B, 0x27, 0x07, 0x07, 0x2A, 0x22, 0x22, 0x33, 0x33, + 0x35, 0x36, 0x38, 0x38, 0x39, 0x27, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x19, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x04, 0x04, 0x04, 0x05, 0x17, 0x17, 0x27, 0x07, + 0x07, 0x07, 0x2A, 0x19, 0x19, 0x16, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x05, 0x05, 0x39, 0x39, 0x27, 0x18, 0x18, 0x18, 0x2A, 0x16, 0x16, 0x1C, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x29, + 0x29, 0x29, 0x29, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x2A, 0x19, 0x1C, 0x1C, 0x1C, 0x1F, 0x1F, 0x29, 0x29, 0x29, 0x29, + 0x27, 0x27, 0x18, 0x19, 0x19, 0x19, 0x16, 0x1C, 0x1C, 0x22, 0x1F, 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x1C, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1F, 0x13, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x0B, 0x2F, 0x20, 0x32, 0x12, 0x12, 0x14, 0x15, 0x15, 0x15, 0x27, + 0x3B, 0x22, 0x1A, 0x1A, 0x1B, 0x1D, 0x1E, 0x21, 0x32, 0x12, 0x12, 0x14, 0x39, 0x39, 0x39, 0x3B, 0x3B, 0x22, 0x1B, + 0x1B, 0x0B, 0x0C, 0x30, 0x32, 0x3A, 0x3D, 0x3D, 0x38, 0x39, 0x39, 0x39, 0x3B, 0x27, 0x22, 0x2D, 0x2D, 0x0C, 0x1E, + 0x20, 0x02, 0x02, 0x3D, 0x26, 0x26, 0x26, 0x39, 0x00, 0x3B, 0x27, 0x22, 0x3F, 0x3F, 0x03, 0x20, 0x3A, 0x12, 0x12, + 0x14, 0x15, 0x15, 0x15, 0x3B, 0x27, 0x27, 0x07, 0x1F, 0x1F, 0x03, 0x03, 0x21, 0x3A, 0x12, 0x12, 0x14, 0x15, 0x15, + 0x15, 0x3B, 0x07, 0x07, 0x07, 0x1F, 0x06, 0x06, 0x33, 0x33, 0x35, 0x36, 0x36, 0x26, 0x39, 0x39, 0x39, 0x27, 0x07, + 0x07, 0x2A, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x33, 0x35, 0x35, 0x36, 0x38, 0x38, 0x39, 0x3B, 0x3B, 0x3B, 0x07, 0x18, 0x18, 0x19, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x04, 0x04, 0x04, 0x36, 0x15, + 0x15, 0x39, 0x27, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x16, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x05, 0x05, 0x17, 0x17, 0x3B, 0x07, 0x07, 0x07, 0x2A, + 0x16, 0x16, 0x1C, 0x1F, 0x1F, 0x04, 0x04, 0x04, 0x05, 0x17, 0x17, 0x27, 0x18, 0x18, 0x18, 0x19, 0x1C, 0x1C, 0x22, + 0x1F, 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x1C, 0x22, 0x22, 0x22, 0x1F, 0x1F, 0x1F, 0x1F, 0x13, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, + 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3C, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x10, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, + 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x13, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, + 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, + 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +const LC3_INT ari_spec_cumfreq_fl[64][18] = { + {0, 1, 2, 177, 225, 226, 227, 336, 372, 543, 652, 699, 719, 768, 804, 824, 834, 1024}, + {0, 18, 44, 61, 71, 98, 135, 159, 175, 197, 229, 251, 265, 282, 308, 328, 341, 1024}, + {0, 71, 163, 212, 237, 318, 420, 481, 514, 556, 613, 652, 675, 697, 727, 749, 764, 1024}, + {0, 160, 290, 336, 354, 475, 598, 653, 677, 722, 777, 808, 823, 842, 866, 881, 890, 1024}, + {0, 71, 144, 177, 195, 266, 342, 385, 411, 445, 489, 519, 539, 559, 586, 607, 622, 1024}, + {0, 48, 108, 140, 159, 217, 285, 327, 354, 385, 427, 457, 478, 497, 524, 545, 561, 1024}, + {0, 138, 247, 290, 308, 419, 531, 584, 609, 655, 710, 742, 759, 780, 807, 825, 836, 1024}, + {0, 16, 40, 62, 79, 103, 139, 170, 195, 215, 245, 270, 290, 305, 327, 346, 362, 1024}, + {0, 579, 729, 741, 743, 897, 970, 980, 982, 996, 1007, 1010, 1011, 1014, 1017, 1018, 1019, 1024}, + {0, 398, 582, 607, 612, 788, 902, 925, 931, 956, 979, 987, 990, 996, 1002, 1005, 1007, 1024}, + {0, 13, 34, 52, 63, 83, 112, 134, 149, 163, 183, 199, 211, 221, 235, 247, 257, 1024}, + {0, 281, 464, 501, 510, 681, 820, 857, 867, 902, 938, 953, 959, 968, 978, 984, 987, 1024}, + {0, 198, 362, 408, 421, 575, 722, 773, 789, 832, 881, 905, 915, 928, 944, 954, 959, 1024}, + {0, 1, 2, 95, 139, 140, 141, 213, 251, 337, 407, 450, 475, 515, 551, 576, 592, 1024}, + {0, 133, 274, 338, 366, 483, 605, 664, 691, 730, 778, 807, 822, 837, 857, 870, 878, 1024}, + {0, 128, 253, 302, 320, 443, 577, 636, 659, 708, 767, 799, 814, 833, 857, 872, 881, 1024}, + {0, 1, 2, 25, 42, 43, 44, 67, 85, 105, 126, 144, 159, 174, 191, 205, 217, 1024}, + {0, 70, 166, 229, 267, 356, 468, 533, 569, 606, 653, 685, 705, 722, 745, 762, 774, 1024}, + {0, 55, 130, 175, 200, 268, 358, 416, 449, 488, 542, 581, 606, 628, 659, 683, 699, 1024}, + {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 1024}, + {0, 34, 85, 123, 147, 196, 265, 317, 352, 386, 433, 470, 497, 518, 549, 574, 593, 1024}, + {0, 30, 73, 105, 127, 170, 229, 274, 305, 335, 377, 411, 436, 455, 483, 506, 524, 1024}, + {0, 9, 24, 38, 51, 65, 87, 108, 126, 139, 159, 177, 193, 204, 221, 236, 250, 1024}, + {0, 30, 74, 105, 125, 166, 224, 266, 294, 322, 361, 391, 413, 431, 457, 478, 494, 1024}, + {0, 15, 38, 58, 73, 95, 128, 156, 178, 196, 222, 245, 263, 276, 296, 314, 329, 1024}, + {0, 11, 28, 44, 57, 74, 100, 123, 142, 157, 179, 199, 216, 228, 246, 262, 276, 1024}, + {0, 448, 619, 639, 643, 821, 926, 944, 948, 971, 991, 998, 1000, 1005, 1010, 1012, 1013, 1024}, + {0, 332, 520, 549, 555, 741, 874, 903, 910, 940, 970, 981, 985, 991, 998, 1002, 1004, 1024}, + {0, 8, 21, 34, 45, 58, 78, 96, 112, 124, 141, 157, 170, 180, 194, 207, 219, 1024}, + {0, 239, 415, 457, 468, 631, 776, 820, 833, 872, 914, 933, 940, 951, 964, 971, 975, 1024}, + {0, 165, 310, 359, 375, 513, 652, 707, 727, 774, 828, 856, 868, 884, 904, 916, 923, 1024}, + {0, 3, 8, 13, 18, 23, 30, 37, 44, 48, 55, 62, 68, 72, 78, 84, 90, 1024}, + {0, 115, 237, 289, 311, 422, 547, 608, 635, 680, 737, 771, 788, 807, 832, 849, 859, 1024}, + {0, 107, 221, 272, 293, 399, 521, 582, 610, 656, 714, 749, 767, 787, 813, 831, 842, 1024}, + {0, 6, 16, 26, 35, 45, 60, 75, 89, 98, 112, 125, 137, 145, 157, 168, 178, 1024}, + {0, 72, 160, 210, 236, 320, 422, 482, 514, 555, 608, 644, 665, 685, 712, 732, 745, 1024}, + {0, 45, 108, 153, 183, 244, 327, 385, 421, 455, 502, 536, 559, 578, 605, 626, 641, 1024}, + {0, 1, 2, 9, 16, 17, 18, 26, 34, 40, 48, 55, 62, 68, 75, 82, 88, 1024}, + {0, 29, 73, 108, 132, 174, 236, 284, 318, 348, 391, 426, 452, 471, 500, 524, 543, 1024}, + {0, 20, 51, 76, 93, 123, 166, 200, 225, 247, 279, 305, 326, 342, 365, 385, 401, 1024}, + {0, 742, 845, 850, 851, 959, 997, 1001, 1002, 1009, 1014, 1016, 1017, 1019, 1020, 1021, 1022, 1024}, + {0, 42, 94, 121, 137, 186, 244, 280, 303, 330, 366, 392, 410, 427, 451, 470, 484, 1024}, + {0, 13, 33, 51, 66, 85, 114, 140, 161, 178, 203, 225, 243, 256, 275, 292, 307, 1024}, + {0, 501, 670, 689, 693, 848, 936, 952, 956, 975, 991, 997, 999, 1004, 1008, 1010, 1011, 1024}, + {0, 445, 581, 603, 609, 767, 865, 888, 895, 926, 954, 964, 968, 977, 986, 991, 993, 1024}, + {0, 285, 442, 479, 489, 650, 779, 818, 830, 870, 912, 930, 937, 949, 963, 971, 975, 1024}, + {0, 349, 528, 561, 569, 731, 852, 883, 892, 923, 953, 965, 970, 978, 987, 992, 994, 1024}, + {0, 199, 355, 402, 417, 563, 700, 750, 767, 811, 860, 884, 894, 909, 926, 936, 942, 1024}, + {0, 141, 275, 325, 343, 471, 606, 664, 686, 734, 791, 822, 836, 854, 877, 891, 899, 1024}, + {0, 243, 437, 493, 510, 649, 775, 820, 836, 869, 905, 923, 931, 941, 953, 960, 964, 1024}, + {0, 91, 197, 248, 271, 370, 487, 550, 580, 625, 684, 721, 741, 761, 788, 807, 819, 1024}, + {0, 107, 201, 242, 262, 354, 451, 503, 531, 573, 626, 660, 680, 701, 730, 751, 765, 1024}, + {0, 168, 339, 407, 432, 553, 676, 731, 755, 789, 830, 854, 866, 879, 895, 906, 912, 1024}, + {0, 67, 147, 191, 214, 290, 384, 441, 472, 513, 567, 604, 627, 648, 678, 700, 715, 1024}, + {0, 46, 109, 148, 171, 229, 307, 359, 391, 427, 476, 513, 537, 558, 588, 612, 629, 1024}, + {0, 848, 918, 920, 921, 996, 1012, 1013, 1014, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 36, 88, 123, 145, 193, 260, 308, 340, 372, 417, 452, 476, 496, 525, 548, 565, 1024}, + {0, 24, 61, 90, 110, 145, 196, 237, 266, 292, 330, 361, 385, 403, 430, 453, 471, 1024}, + {0, 85, 182, 230, 253, 344, 454, 515, 545, 590, 648, 685, 706, 727, 756, 776, 789, 1024}, + {0, 22, 55, 82, 102, 135, 183, 222, 252, 278, 315, 345, 368, 385, 410, 431, 448, 1024}, + {0, 1, 2, 56, 89, 90, 91, 140, 172, 221, 268, 303, 328, 358, 388, 412, 430, 1024}, + {0, 45, 109, 152, 177, 239, 320, 376, 411, 448, 499, 537, 563, 585, 616, 640, 658, 1024}, + {0, 247, 395, 433, 445, 599, 729, 771, 785, 829, 875, 896, 905, 920, 937, 946, 951, 1024}, + {0, 231, 367, 408, 423, 557, 676, 723, 742, 786, 835, 860, 872, 889, 909, 921, 928, 1024}}; + +const LC3_INT ari_spec_bits_fl[64][17] = { + {20480, 20480, 5220, 9042, 20480, 20480, 6619, 9892, 5289, 6619, 9105, 11629, 8982, 9892, 11629, 13677, 4977}, + {11940, 10854, 12109, 13677, 10742, 9812, 11090, 12288, 11348, 10240, 11348, 12683, 12109, 10854, 11629, 12902, + 1197}, + {7886, 7120, 8982, 10970, 7496, 6815, 8334, 10150, 9437, 8535, 9656, 11216, 11348, 10431, 11348, 12479, 4051}, + {5485, 6099, 9168, 11940, 6311, 6262, 8640, 11090, 9233, 8640, 10334, 12479, 11781, 11090, 12479, 13988, 6009}, + {7886, 7804, 10150, 11940, 7886, 7685, 9368, 10854, 10061, 9300, 10431, 11629, 11629, 10742, 11485, 12479, 2763}, + {9042, 8383, 10240, 11781, 8483, 8013, 9437, 10742, 10334, 9437, 10431, 11485, 11781, 10742, 11485, 12288, 2346}, + {5922, 6619, 9368, 11940, 6566, 6539, 8750, 10970, 9168, 8640, 10240, 12109, 11485, 10742, 11940, 13396, 5009}, + {12288, 11090, 11348, 12109, 11090, 9892, 10334, 10970, 11629, 10431, 10970, 11629, 12479, 11348, 11781, 12288, + 1289}, + {1685, 5676, 13138, 18432, 5598, 7804, 13677, 18432, 12683, 13396, 17234, 20480, 17234, 17234, 20480, 20480, 15725}, + {2793, 5072, 10970, 15725, 5204, 6487, 11216, 15186, 10970, 11216, 14336, 17234, 15186, 15186, 17234, 18432, 12109}, + {12902, 11485, 11940, 13396, 11629, 10531, 11348, 12479, 12683, 11629, 12288, 13138, 13677, 12683, 13138, 13677, + 854}, + {3821, 5088, 9812, 13988, 5289, 5901, 9812, 13677, 9976, 9892, 12479, 15186, 13988, 13677, 15186, 17234, 9812}, + {4856, 5412, 9168, 12902, 5598, 5736, 8863, 12288, 9368, 8982, 11090, 13677, 12902, 12288, 13677, 15725, 8147}, + {20480, 20480, 7088, 9300, 20480, 20480, 7844, 9733, 7320, 7928, 9368, 10970, 9581, 9892, 10970, 12288, 2550}, + {6031, 5859, 8192, 10635, 6410, 6286, 8433, 10742, 9656, 9042, 10531, 12479, 12479, 11629, 12902, 14336, 5756}, + {6144, 6215, 8982, 11940, 6262, 6009, 8433, 11216, 8982, 8433, 10240, 12479, 11781, 11090, 12479, 13988, 5817}, + {20480, 20480, 11216, 12109, 20480, 20480, 11216, 11940, 11629, 11485, 11940, 12479, 12479, 12109, 12683, 13138, + 704}, + {7928, 6994, 8239, 9733, 7218, 6539, 8147, 9892, 9812, 9105, 10240, 11629, 12109, 11216, 12109, 13138, 4167}, + {8640, 7724, 9233, 10970, 8013, 7185, 8483, 10150, 9656, 8694, 9656, 10970, 11348, 10334, 11090, 12288, 3391}, + {20480, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, + 91}, + {10061, 8863, 9733, 11090, 8982, 7970, 8806, 9976, 10061, 9105, 9812, 10742, 11485, 10334, 10970, 11781, 2557}, + {10431, 9368, 10240, 11348, 9368, 8433, 9233, 10334, 10431, 9437, 10061, 10970, 11781, 10635, 11216, 11940, 2119}, + {13988, 12479, 12683, 12902, 12683, 11348, 11485, 11940, 12902, 11629, 11940, 12288, 13396, 12109, 12479, 12683, + 828}, + {10431, 9300, 10334, 11629, 9508, 8483, 9437, 10635, 10635, 9656, 10431, 11348, 11940, 10854, 11485, 12288, 1946}, + {12479, 11216, 11629, 12479, 11348, 10150, 10635, 11348, 11940, 10854, 11216, 11940, 12902, 11629, 11940, 12479, + 1146}, + {13396, 12109, 12288, 12902, 12109, 10854, 11216, 11781, 12479, 11348, 11629, 12109, 13138, 11940, 12288, 12683, + 928}, + {2443, 5289, 11629, 16384, 5170, 6730, 11940, 16384, 11216, 11629, 14731, 18432, 15725, 15725, 18432, 20480, 13396}, + {3328, 5009, 10531, 15186, 5040, 6031, 10531, 14731, 10431, 10431, 13396, 16384, 15186, 14731, 16384, 18432, 11629}, + {14336, 12902, 12902, 13396, 12902, 11629, 11940, 12288, 13138, 12109, 12288, 12902, 13677, 12683, 12902, 13138, + 711}, + {4300, 5204, 9437, 13396, 5430, 5776, 9300, 12902, 9656, 9437, 11781, 14731, 13396, 12902, 14731, 16384, 8982}, + {5394, 5776, 8982, 12288, 5922, 5901, 8640, 11629, 9105, 8694, 10635, 13138, 12288, 11629, 13138, 14731, 6844}, + {17234, 15725, 15725, 15725, 15725, 14731, 14731, 14731, 16384, 14731, 14731, 15186, 16384, 15186, 15186, 15186, + 272}, + {6461, 6286, 8806, 11348, 6566, 6215, 8334, 10742, 9233, 8535, 10061, 12109, 11781, 10970, 12109, 13677, 5394}, + {6674, 6487, 8863, 11485, 6702, 6286, 8334, 10635, 9168, 8483, 9976, 11940, 11629, 10854, 11940, 13396, 5105}, + {15186, 13677, 13677, 13988, 13677, 12479, 12479, 12683, 13988, 12683, 12902, 13138, 14336, 13138, 13396, 13677, + 565}, + {7844, 7252, 8922, 10854, 7389, 6815, 8383, 10240, 9508, 8750, 9892, 11485, 11629, 10742, 11629, 12902, 3842}, + {9233, 8239, 9233, 10431, 8334, 7424, 8483, 9892, 10061, 9105, 10061, 11216, 11781, 10742, 11485, 12479, 2906}, + {20480, 20480, 14731, 14731, 20480, 20480, 14336, 14336, 15186, 14336, 14731, 14731, 15186, 14731, 14731, 15186, + 266}, + {10531, 9300, 9976, 11090, 9437, 8286, 9042, 10061, 10431, 9368, 9976, 10854, 11781, 10531, 11090, 11781, 2233}, + {11629, 10334, 10970, 12109, 10431, 9368, 10061, 10970, 11348, 10240, 10854, 11485, 12288, 11216, 11629, 12288, + 1469}, + {952, 6787, 15725, 20480, 6646, 9733, 16384, 20480, 14731, 15725, 18432, 20480, 18432, 20480, 20480, 20480, 18432}, + {9437, 8806, 10742, 12288, 8982, 8483, 9892, 11216, 10742, 9892, 10854, 11940, 12109, 11090, 11781, 12683, 1891}, + {12902, 11629, 11940, 12479, 11781, 10531, 10854, 11485, 12109, 10970, 11348, 11940, 12902, 11781, 12109, 12479, + 1054}, + {2113, 5323, 11781, 16384, 5579, 7252, 12288, 16384, 11781, 12288, 15186, 18432, 15725, 16384, 18432, 20480, 12902}, + {2463, 5965, 11348, 15186, 5522, 6934, 11216, 14731, 10334, 10635, 13677, 16384, 13988, 13988, 15725, 18432, 10334}, + {3779, 5541, 9812, 13677, 5467, 6122, 9656, 13138, 9581, 9437, 11940, 14731, 13138, 12683, 14336, 16384, 8982}, + {3181, 5154, 10150, 14336, 5448, 6311, 10334, 13988, 10334, 10431, 13138, 15725, 14336, 13988, 15725, 18432, 10431}, + {4841, 5560, 9105, 12479, 5756, 5944, 8922, 12109, 9300, 8982, 11090, 13677, 12479, 12109, 13677, 15186, 7460}, + {5859, 6009, 8922, 11940, 6144, 5987, 8483, 11348, 9042, 8535, 10334, 12683, 11940, 11216, 12683, 14336, 6215}, + {4250, 4916, 8587, 12109, 5901, 6191, 9233, 12288, 10150, 9892, 11940, 14336, 13677, 13138, 14731, 16384, 8383}, + {7153, 6702, 8863, 11216, 6904, 6410, 8239, 10431, 9233, 8433, 9812, 11629, 11629, 10742, 11781, 13138, 4753}, + {6674, 7057, 9508, 11629, 7120, 6964, 8806, 10635, 9437, 8750, 10061, 11629, 11485, 10531, 11485, 12683, 4062}, + {5341, 5289, 8013, 10970, 6311, 6262, 8640, 11090, 10061, 9508, 11090, 13138, 12902, 12288, 13396, 15186, 6539}, + {8057, 7533, 9300, 11216, 7685, 7057, 8535, 10334, 9508, 8694, 9812, 11216, 11485, 10431, 11348, 12479, 3541}, + {9168, 8239, 9656, 11216, 8483, 7608, 8806, 10240, 9892, 8982, 9812, 11090, 11485, 10431, 11090, 12109, 2815}, + {558, 7928, 18432, 20480, 7724, 12288, 20480, 20480, 18432, 20480, 20480, 20480, 20480, 20480, 20480, 20480, 20480}, + {9892, 8806, 9976, 11348, 9042, 8057, 9042, 10240, 10240, 9233, 9976, 11090, 11629, 10531, 11216, 12109, 2371}, + {11090, 9812, 10531, 11629, 9976, 8863, 9508, 10531, 10854, 9733, 10334, 11090, 11940, 10742, 11216, 11940, 1821}, + {7354, 6964, 9042, 11216, 7153, 6592, 8334, 10431, 9233, 8483, 9812, 11485, 11485, 10531, 11629, 12902, 4349}, + {11348, 10150, 10742, 11629, 10150, 9042, 9656, 10431, 10854, 9812, 10431, 11216, 12109, 10970, 11485, 12109, 1700}, + {20480, 20480, 8694, 10150, 20480, 20480, 8982, 10240, 8982, 9105, 9976, 10970, 10431, 10431, 11090, 11940, 1610}, + {9233, 8192, 9368, 10970, 8286, 7496, 8587, 9976, 9812, 8863, 9733, 10854, 11348, 10334, 11090, 11940, 3040}, + {4202, 5716, 9733, 13138, 5598, 6099, 9437, 12683, 9300, 9168, 11485, 13988, 12479, 12109, 13988, 15725, 7804}, + {4400, 5965, 9508, 12479, 6009, 6360, 9105, 11781, 9300, 8982, 10970, 13138, 12109, 11629, 13138, 14731, 6994}}; + +const LC3_FLOAT sns_LFCB[8][32] = { + {2.26283365592678, 2.94516479191376, -2.18610707009979, 0.693688236528920, -1.29752132315296, 0.914652037830672, + -2.51428812578962, -0.922188404812385, 0.790322288369266, 1.44775580178724, 0.793354526417474, 2.72425347385034, + -0.530830198375400, 1.68728410845006, -2.95183272801858, 0.101878342785628, 2.68254575498426, 4.82697923680403, + 0.0878419936470335, 1.39102308204326, 0.384585893889182, 1.93227399441719, 0.175080462899884, -1.18817020250556, + 2.53322203327061, 3.99889837485606, 0.507902593186381, 3.16856825107569, 1.89414766731764, 0.948880604517188, + -1.88026757045628, 0.246375746277129}, + {0.813311269061339, 2.41143317956679, -1.97152135675228, 0.955609857158220, -0.740369057177853, + 1.74293043435257, -2.89175271384373, 0.632495141440552, 0.628401261876199, 2.72399951674952, + 0.0143931185523454, 2.95947572404824, -0.212690682812164, 2.43614509237656, -1.59393496773345, + 0.589857324228917, 1.32738010899420, 3.11947804492488, -0.569586840238501, 1.98146479199466, + -0.160588785536510, 3.01030180412057, -0.750522832248985, 0.366792873662636, 2.11274642695908, + 4.07901751451956, 1.58838449789527, 3.25853458159407, 1.25108694609232, 2.13239439249982, + -1.26431072758705, 0.955621773393099}, + {-0.530193494871436, 0.960455106400727, -1.78718619681006, 0.575230787038733, -0.345372483642106, + 1.90906626859986, -2.00450666759434, 1.08736431254641, 0.393117923540450, 2.31083268737528, + -0.567834844729679, 1.84953559268461, 0.00576613628377097, 2.33019429078225, -0.109918772878022, + 0.619047646793466, 0.130185273804048, 1.39513671385178, -1.14506015668811, 1.11265796388770, + -0.539366809557710, 3.06543893826204, -1.03943893342231, 1.30957830409096, 1.26288411502064, + 2.82285661102496, 1.72899023869209, 2.42230591328599, 0.590451210720628, 2.72345350344278, + 0.311424976968699, 1.52046776741766}, + {-1.35664835903442, -0.443226488076917, -1.91865895685577, -0.114603419462889, -0.313285696247940, + 1.54408483842665, -0.750912273903127, 0.608628624535820, 0.480007710866901, 0.935051269566529, + -0.654760467916745, 0.563284922322364, 0.424871484383745, 1.77983777835091, 0.388609072919257, + 1.26731313851796, -0.338533088511347, 0.250295315918722, -1.66968488172598, -0.220107509420743, + -0.529309078789857, 2.50110160870008, -1.13577508937648, 1.68330687280491, 0.761513512430427, + 1.72607212849580, 1.00692230241726, 1.79446077643261, 0.608358583293714, 2.76986076866588, + 1.83670210306430, 1.97647400419457}, + {-1.59952176563196, -1.22913612425590, -1.79399121836596, -0.646050637436029, -0.402977242824477, + 1.09344960761455, 0.441202104904691, 0.131174567547348, 0.447815138050143, -0.274743911383688, + -0.479458998475743, 0.139917088125072, 0.473128952158668, 1.44411295390082, 0.512932649517584, + 2.41961047769804, -0.368219235899667, -0.393613839379793, -1.84534417603682, -0.774965611552366, + 0.190433547437932, 1.93089592978934, -1.04197903837494, 1.25100924225127, 0.522117937976170, + 0.647144377348619, 0.377121231816382, 1.52177910653089, 0.878171010011082, 2.54286973254946, + 2.25634191839874, 1.94043867177462}, + {-1.44098768430095, -1.55590039118170, -1.35738404257288, -0.952351370449625, -0.372020853465227, + 0.647479549518278, 1.20190987601009, -0.296149157743752, 0.209734214552234, -0.902077696828602, + -0.173894661902889, 0.359641093366222, 0.858894199321281, 1.51995177009730, 0.628112597063497, + 2.25174252572187, -0.191689946715961, -0.643458173054701, -1.56468027328802, -0.594063874149117, + 2.56062918106522, 0.572153810961837, -0.0152060098993382, 0.942375751628615, 0.118680069757121, + -0.331148521217238, 0.476370766899498, 1.17196706537602, 1.11912510950950, 2.02046263825019, + 2.04818998463474, 2.23375847282686}, + {-1.14381648305821, -1.49688655952376, -0.705444279353869, -1.07405247226150, -0.0783414177323738, + 0.0361790752449642, 1.32742857257290, -0.207013516525629, 0.00656691996428021, -0.940681511945404, + 0.0680162705515438, 0.689461354774589, 1.19111160854435, 1.47199393750425, 0.822621796430634, + 0.526537030991201, -0.154782377153908, -0.642570736856943, -1.11746759076420, 0.136937680628923, + 2.81896398245248, -0.811741794081091, 2.07048391716707, 0.826250483374133, -0.452346827507370, + -0.884042570848749, 1.08754740372170, 0.489394596980695, 1.01857661550342, 0.830045859400910, + 2.19526837458568, 1.98835977758407}, + {-0.755203767909064, -1.11689986501469, -0.0478172944777711, -0.758087707094905, 0.0970441303992295, + -0.297092807178889, 1.22049081140984, 0.134924916642080, -0.0861242342061857, -0.633697038974310, + 0.295125948369794, 0.639790176833105, 0.996189669638358, 0.977682473891761, 0.875891424655081, + -0.396591513227999, -0.234207177774392, -0.723193223444072, -0.533981663366786, 0.818242891264338, + 0.656670875696161, -1.17641810861903, 3.42948918081689, 0.439952741120956, -0.700352426161103, + -1.12697340645478, 1.08756266099221, -0.0622795715718769, 0.620453891011724, -0.0275569173888263, + 2.02659613836619, 1.27232672554701}}; + +const LC3_FLOAT sns_HFCB[8][32] = { + {0.232028419124465, -1.29503936673618, 0.139285716045803, -0.316513102185725, 0.879518405226496, + -0.296701922455375, 0.340981100469697, -1.41229759077597, -0.228839511827379, -1.07148628544449, + -0.590988511188051, -0.848434098836164, 1.14069145562382, -0.376283237967464, 0.665004120598402, + -0.826265953982679, 1.41008326832173, 0.361386817574348, 0.437469239330329, 0.648100318996503, + 1.11919833091304, 0.141847497087176, 0.504046955390252, -0.501076050479357, 3.74970982709642, + -1.15258990980549, 1.02827246422140, 0.128831971707817, 1.34033030334757, 2.13843105419313, + 0.564830487355396, -0.422460547586087}, + {-1.00890270604455, -1.79929965384339, -0.258185126171752, -0.477747657209805, 0.298340096007189, + -0.975004919174553, 0.268899788946055, -1.48522119349852, -0.333719069784662, -1.41767015456261, + -0.0711737758537628, -0.583226810708889, 0.964016892398293, 0.0425675462096105, 1.09790764690795, + -0.671181232766603, 0.754441907835468, -0.0219991705427826, 0.305440419605961, 0.682299133640680, + 1.23465532536005, -0.110660070633151, 0.826982162959097, -0.325678006081417, 1.52342611847045, + -1.10800885906241, 1.09770519389828, 0.689439395264878, 1.38996825067789, 4.24711267303104, + 1.59184977958743, 0.326149625049801}, + {-2.14223502789471, -1.88703147531519, -0.650804572670110, -0.551162075879755, -0.915386396405710, + -1.35857500246993, 0.0563335684828033, -1.18603579834700, -0.809321359324656, -1.54891762265441, + 0.345719522947313, 0.0900423688142873, 0.381461205984798, 0.516547696592306, 1.38342667112079, + -0.228495592779472, -1.30550584958631, -0.579368833633824, -0.00738786566478374, 0.253247464332976, + 0.589170238085318, -0.282824592543629, 1.11981236291828, 0.0280798194947077, -0.457715661897855, + -0.562615116512472, 0.768645545764776, 1.12346905009575, 1.04467921708883, 2.89734109830439, + 2.39771699015146, 1.39171313342261}, + {-2.37533813570664, -1.80991659687332, -1.06815731781969, -0.484788283381197, -2.20645974739762, + -0.983721105837444, 0.0499114046826685, -0.625001634441352, -1.63587876923797, -1.45296062475530, + 0.300549460996251, 0.845025007556886, -0.482849340608998, 0.251716881864630, 1.34327358628285, + 0.518980852551937, -1.87133711350971, -0.879427960941070, -0.495649854710252, 0.0735842143788469, + -1.37192459653166, -0.00659813474614194, 1.17914044332734, 0.262054554763133, -0.798711008243192, + -0.220562123765675, 0.206081977740766, 1.30934523106594, 0.635822746244367, 0.932730658026815, + 3.03697343600704, 2.23146614636474}, + {-2.23041933049655, -1.76340038479206, -1.61928741524302, -0.238388394455814, -2.74142180959951, + -0.652956939100809, -0.0954130727414369, 0.153902497468304, -1.88486397330982, -1.03182970062270, + -1.11865218295857, 1.06572384501716, -1.81632721260589, -0.216179967524303, 0.822978836855922, + 1.36721896340278, -1.24008685156305, -0.850685023408119, -0.806651271118393, 0.314216709389010, + -2.37095707241577, 0.285929279627216, 1.07987429197260, 0.360590806085767, -0.386819329309100, + -0.349842880336644, -0.342805735091998, 1.35511964713935, -0.274733755518482, -0.292822249729810, + 2.66424350337151, 2.61179442169688}, + {-2.17595881223696, -1.83418428467950, -2.18762566441756, -0.143024507285504, -2.86139074276891, + -0.989986992921811, -0.760166146083885, 0.576386497810755, -1.64496691316356, -0.690642640272584, + -2.44089151148049, 0.737582999377756, -2.80279512728555, -0.534074091124504, 0.215876798515679, + 2.18023038253092, -1.26712924866274, -0.779397050155816, -1.22431891984401, 0.234729880923679, + -2.00779782682360, 0.0460445529952971, 0.697536239067500, 0.635623722053700, -0.375901062231203, + -0.753432770250495, -0.754939404625340, 1.42311381470799, -1.54923372430695, -0.810404296853182, + 1.39304485032606, 2.66540340196570}, + {-2.29065913541000, -1.80480980687405, -2.63757586939054, 0.0683186673649074, -2.88841597105271, + -1.61467224598900, -2.32758120177007, 0.795092603798871, -1.40515778046612, -0.428843804532171, + -2.22854732450735, 0.256590452459912, -3.23385724833864, -0.640786096262196, -0.404925753080293, + 2.53596092750107, -2.03670813003907, -0.732182927291826, -1.70157770043181, 0.144600134479837, + -1.66688540224395, -0.602596415577886, -0.912548817371081, 0.959012467178154, -0.657836899930538, + -0.988596593396384, -1.04196177632000, 1.15706449190905, -2.44239710278007, -0.788868098756483, + 0.403834023595745, 2.40103554105707}, + {-2.53286397979846, -1.73679545317401, -2.97897749575096, 0.0883061717288066, -2.95182608262521, + -2.40712302385116, -3.77155485385656, 0.596564632144913, -1.46666471326146, -0.494960215408874, + -1.89509228210853, -0.491963359762378, -3.45908714491473, -0.869745032374135, -1.07025605870523, + 2.20121098860036, -2.89685162242381, -0.888348514821255, -2.24491913755611, -0.0682120178880174, + -1.92631846258406, -2.26568728632575, -3.57684747062773, 1.30745156688653, -1.28163964243603, + -1.28790471791471, -1.50335652955529, 0.406319437516838, -3.02457606944550, -0.935353148761338, + -0.656270971328114, 1.75920379670881}}; + +const LC3_INT pvq_enc_A[16][11] = {{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19}, + {0, 1, 5, 13, 25, 41, 61, 85, 113, 145, 181}, + {0, 1, 7, 25, 63, 129, 231, 377, 575, 833, 1159}, + {0, 1, 9, 41, 129, 321, 681, 1289, 2241, 3649, 5641}, + {0, 1, 11, 61, 231, 681, 1683, 3653, 7183, 13073, 22363}, + {0, 1, 13, 85, 377, 1289, 3653, 8989, 19825, 40081, 75517}, + {0, 1, 15, 113, 575, 2241, 7183, 19825, 48639, 108545, 224143}, + {0, 1, 17, 145, 833, 3649, 13073, 40081, 108545, 265729, 598417}, + {0, 1, 19, 181, 1159, 5641, 22363, 75517, 224143, 598417, 1462563}, + {0, 1, 21, 221, 1561, 8361, 36365, 134245, 433905, 1256465, 3317445}, + {0, 1, 23, 265, 2047, 11969, 56695, 227305, 795455, 2485825, 7059735}, + {0, 1, 25, 313, 2625, 16641, 85305, 369305, 1392065, 4673345, 14218905}, + {0, 1, 27, 365, 3303, 22569, 124515, 579125, 2340495, 8405905, 27298155}, + {0, 1, 29, 421, 4089, 29961, 177045, 880685, 3800305, 14546705, 50250765}, + {0, 1, 31, 481, 4991, 39041, 246047, 1303777, 5984767, 24331777, 89129247}}; + +const LC3_FLOAT lp_scale_factors[6] = {1, 1, 0.6666666666666666, .5, 0.3333333333333333, 0.16666666666666666}; + + +/* 12.8 kHz resampler */ +const LC3_FLOAT highpass50_filt_b[3] = {0.9827947082978771, -1.965589416595754, 0.9827947082978771}; +const LC3_FLOAT highpass50_filt_a[3] = {1, -1.9652933726226904, 0.9658854605688177}; + +const LC3_INT32 resamp_params[][4] = { + {24, 5, 0, 15}, + {12, 10, 1, 3}, + {8, 15, 1, 7}, + {6, 20, 2, 3}, + {4, 30, 3, 3}, + {2, 60, 7, 1} +}; + + +const LC3_FLOAT lp_filter_8[240] = {0.0065408750, 0.0127360141, -0.0320970677, -0.1382038444, 0.8005587459, -0.1382038444, -0.0320970677, 0.0127360141, 0.0065408750, 0.0000000000, 0.0064595463, 0.0084537705, -0.0391003005, -0.1198658869, 0.7945935130, -0.1519452035, -0.0230523963, 0.0167804975, 0.0063002659, -0.0002451667, 0.0060938913, 0.0041435249, -0.0439039879, -0.0980933905, 0.7768620253, -0.1600013375, -0.0122310519, 0.0203715712, 0.0057131811, -0.0005356151, 0.0054914863, 0.0000000000, -0.0464562289, -0.0740769655, 0.7478516698, -0.1614013463, 0.0000000000, 0.0232978407, 0.0047708568, -0.0008596397, 0.0047065411, -0.0038048958, -0.0468063876, -0.0489920303, 0.7083564401, -0.1553338468, 0.0131809860, 0.0253629088, 0.0034824028, -0.0012012133, 0.0037965439, -0.0071282135, -0.0450960808, -0.0239577144, 0.6594504118, -0.1411849856, 0.0267735831, 0.0263961889, 0.0018761361, -0.0015404741, 0.0028190494, -0.0098603060, -0.0415467210, -0.0000000000, 0.6024519205, -0.1185704023, 0.0401797108, 0.0262632743, -0.0000000000, -0.0018545259, 0.0018287648, -0.0119272992, -0.0364444591, 0.0219798349, 0.5388799906, -0.0873604342, 0.0527642742, 0.0248753466, -0.0020790326, -0.0021185349, 0.0008750616, -0.0132916924, -0.0301232301, 0.0412303619, 0.4704038501, -0.0476967618, 0.0638811216, 0.0221970305, -0.0042766319, -0.0023070835, 0.0000000000, -0.0139512215, -0.0229468606, 0.0571681485, 0.3987891078, 0.0000000000, 0.0729012638, 0.0182522610, -0.0064938627, -0.0023957258, -0.0007630716, -0.0139361415, -0.0152910165, 0.0693885013, 0.3258404732, 0.0550325289, 0.0792422444, 0.0131276902, -0.0086209681, -0.0023626641, -0.0013903243, -0.0133052040, -0.0075258445, 0.0776687115, 0.2533447146, 0.1164389849, 0.0823974460, 0.0069732964, -0.0105420630, -0.0021904600, -0.0018676731, -0.0121405739, -0.0000000000, 0.0819641128, 0.1830149740, 0.1830149740, 0.0819641128, -0.0000000000, -0.0121405739, -0.0018676731, -0.0021904600, -0.0105420630, 0.0069732964, 0.0823974460, 0.1164389849, 0.2533447146, 0.0776687115, -0.0075258445, -0.0133052040, -0.0013903243, -0.0023626641, -0.0086209681, 0.0131276902, 0.0792422444, 0.0550325289, 0.3258404732, 0.0693885013, -0.0152910165, -0.0139361415, -0.0007630716, -0.0023957258, -0.0064938627, 0.0182522610, 0.0729012638, 0.0000000000, 0.3987891078, 0.0571681485, -0.0229468606, -0.0139512215, 0.0000000000, -0.0023070835, -0.0042766319, 0.0221970305, 0.0638811216, -0.0476967618, 0.4704038501, 0.0412303619, -0.0301232301, -0.0132916924, 0.0008750616, -0.0021185349, -0.0020790326, 0.0248753466, 0.0527642742, -0.0873604342, 0.5388799906, 0.0219798349, -0.0364444591, -0.0119272992, 0.0018287648, -0.0018545259, -0.0000000000, 0.0262632743, 0.0401797108, -0.1185704023, 0.6024519205, -0.0000000000, -0.0415467210, -0.0098603060, 0.0028190494, -0.0015404741, 0.0018761361, 0.0263961889, 0.0267735831, -0.1411849856, 0.6594504118, -0.0239577144, -0.0450960808, -0.0071282135, 0.0037965439, -0.0012012133, 0.0034824028, 0.0253629088, 0.0131809860, -0.1553338468, 0.7083564401, -0.0489920303, -0.0468063876, -0.0038048958, 0.0047065411, -0.0008596397, 0.0047708568, 0.0232978407, 0.0000000000, -0.1614013463, 0.7478516698, -0.0740769655, -0.0464562289, 0.0000000000, 0.0054914863, -0.0005356151, 0.0057131811, 0.0203715712, -0.0122310519, -0.1600013375, 0.7768620253, -0.0980933905, -0.0439039879, 0.0041435249, 0.0060938913, -0.0002451667, 0.0063002659, 0.0167804975, -0.0230523963, -0.1519452035, 0.7945935130, -0.1198658869, -0.0391003005, 0.0084537705, 0.0064595463}; + +const LC3_FLOAT lp_filter_16[240] = { +-0.0018676731, 0.0065408750, -0.0121405739, 0.0127360141, -0.0000000000, -0.0320970677, 0.0819641128, -0.1382038444, 0.1830149740, 0.8005587459, 0.1830149740, -0.1382038444, 0.0819641128, -0.0320970677, -0.0000000000, 0.0127360141, -0.0121405739, 0.0065408750, -0.0018676731, 0.0000000000, -0.0021904600, 0.0064595463, -0.0105420630, 0.0084537705, 0.0069732964, -0.0391003005, 0.0823974460, -0.1198658869, 0.1164389849, 0.7945935130, 0.2533447146, -0.1519452035, 0.0776687115, -0.0230523963, -0.0075258445, 0.0167804975, -0.0133052040, 0.0063002659, -0.0013903243, -0.0002451667, -0.0023626641, 0.0060938913, -0.0086209681, 0.0041435249, 0.0131276902, -0.0439039879, 0.0792422444, -0.0980933905, 0.0550325289, 0.7768620253, 0.3258404732, -0.1600013375, 0.0693885013, -0.0122310519, -0.0152910165, 0.0203715712, -0.0139361415, 0.0057131811, -0.0007630716, -0.0005356151, -0.0023957258, 0.0054914863, -0.0064938627, 0.0000000000, 0.0182522610, -0.0464562289, 0.0729012638, -0.0740769655, 0.0000000000, 0.7478516698, 0.3987891078, -0.1614013463, 0.0571681485, 0.0000000000, -0.0229468606, 0.0232978407, -0.0139512215, 0.0047708568, 0.0000000000, -0.0008596397, -0.0023070835, 0.0047065411, -0.0042766319, -0.0038048958, 0.0221970305, -0.0468063876, 0.0638811216, -0.0489920303, -0.0476967618, 0.7083564401, 0.4704038501, -0.1553338468, 0.0412303619, 0.0131809860, -0.0301232301, 0.0253629088, -0.0132916924, 0.0034824028, 0.0008750616, -0.0012012133, -0.0021185349, 0.0037965439, -0.0020790326, -0.0071282135, 0.0248753466, -0.0450960808, 0.0527642742, -0.0239577144, -0.0873604342, 0.6594504118, 0.5388799906, -0.1411849856, 0.0219798349, 0.0267735831, -0.0364444591, 0.0263961889, -0.0119272992, 0.0018761361, 0.0018287648, -0.0015404741, -0.0018545259, 0.0028190494, -0.0000000000, -0.0098603060, 0.0262632743, -0.0415467210, 0.0401797108, -0.0000000000, -0.1185704023, 0.6024519205, 0.6024519205, -0.1185704023, -0.0000000000, 0.0401797108, -0.0415467210, 0.0262632743, -0.0098603060, -0.0000000000, 0.0028190494, -0.0018545259, -0.0015404741, 0.0018287648, 0.0018761361, -0.0119272992, 0.0263961889, -0.0364444591, 0.0267735831, 0.0219798349, -0.1411849856, 0.5388799906, 0.6594504118, -0.0873604342, -0.0239577144, 0.0527642742, -0.0450960808, 0.0248753466, -0.0071282135, -0.0020790326, 0.0037965439, -0.0021185349, -0.0012012133, 0.0008750616, 0.0034824028, -0.0132916924, 0.0253629088, -0.0301232301, 0.0131809860, 0.0412303619, -0.1553338468, 0.4704038501, 0.7083564401, -0.0476967618, -0.0489920303, 0.0638811216, -0.0468063876, 0.0221970305, -0.0038048958, -0.0042766319, 0.0047065411, -0.0023070835, -0.0008596397, 0.0000000000, 0.0047708568, -0.0139512215, 0.0232978407, -0.0229468606, 0.0000000000, 0.0571681485, -0.1614013463, 0.3987891078, 0.7478516698, 0.0000000000, -0.0740769655, 0.0729012638, -0.0464562289, 0.0182522610, 0.0000000000, -0.0064938627, 0.0054914863, -0.0023957258, -0.0005356151, -0.0007630716, 0.0057131811, -0.0139361415, 0.0203715712, -0.0152910165, -0.0122310519, 0.0693885013, -0.1600013375, 0.3258404732, 0.7768620253, 0.0550325289, -0.0980933905, 0.0792422444, -0.0439039879, 0.0131276902, 0.0041435249, -0.0086209681, 0.0060938913, -0.0023626641, -0.0002451667, -0.0013903243, 0.0063002659, -0.0133052040, 0.0167804975, -0.0075258445, -0.0230523963, 0.0776687115, -0.1519452035, 0.2533447146, 0.7945935130, 0.1164389849, -0.1198658869, 0.0823974460, -0.0391003005, 0.0069732964, 0.0084537705, -0.0105420630, 0.0064595463, -0.0021904600 +}; + +const LC3_FLOAT lp_filter_24[240] = { +-0.0015380557, 0.0005833744, 0.0043605831, -0.0028510878, -0.0088611282, 0.0084906761, 0.0147980200, -0.0200821534, -0.0213980451, 0.0425874144, 0.0274869073, -0.0921358988, -0.0317978412, 0.3136025667, 0.5337058306, 0.3136025667, -0.0317978412, -0.0921358988, 0.0274869073, 0.0425874144, -0.0213980451, -0.0200821534, 0.0147980200, 0.0084906761, -0.0088611282, -0.0028510878, 0.0043605831, 0.0005833744, -0.0015380557, 0.0000000000, -0.0014123565, 0.0000000000, 0.0043063643, -0.0013860217, -0.0093008140, 0.0056358469, 0.0165835638, -0.0152979074, -0.0260668676, 0.0351761840, 0.0381121002, -0.0799105912, -0.0582402907, 0.2658593953, 0.5297290087, 0.3592533171, 0.0000000000, -0.1012968048, 0.0146532226, 0.0486008413, -0.0153682642, -0.0242963061, 0.0121681746, 0.0111869983, -0.0079515325, -0.0043292418, 0.0042001773, 0.0012191766, -0.0015971506, -0.0001634445, -0.0012363506, -0.0005087144, 0.0040625944, -0.0000000000, -0.0092907613, 0.0027623500, 0.0175088495, -0.0101940110, -0.0292693246, 0.0267864745, 0.0462590009, -0.0653955936, -0.0790469348, 0.2172269821, 0.5179080367, 0.4016346335, 0.0366883539, -0.1066675633, -0.0000000000, 0.0528281629, -0.0081540346, -0.0276978146, 0.0087517938, 0.0135810468, -0.0065735374, -0.0057473122, 0.0038087873, 0.0018793662, -0.0015751094, -0.0003570767, -0.0010269828, -0.0009268829, 0.0036609909, 0.0012507574, -0.0088701360, 0.0000000000, 0.0175974593, -0.0050172298, -0.0309708193, 0.0178490561, 0.0517791398, -0.0493846424, -0.0941233262, 0.1688964665, 0.4985677898, 0.4396336079, 0.0776259899, -0.1076008976, -0.0159718096, 0.0549316332, 0.0000000000, -0.0300640538, 0.0046488643, 0.0155318938, -0.0047521424, -0.0070280419, 0.0031805711, 0.0025310293, -0.0014603067, -0.0005730931, -0.0008008089, -0.0012451154, 0.0031376940, 0.0023216018, -0.0080937156, -0.0025365972, 0.0169086065, -0.0000000000, -0.0312042590, 0.0087873237, 0.0546427406, -0.0326613523, -0.1035559028, 0.1220099851, 0.4722376168, 0.4722376168, 0.1220099851, -0.1035559028, -0.0326613523, 0.0546427406, 0.0087873237, -0.0312042590, -0.0000000000, 0.0169086065, -0.0025365972, -0.0080937156, 0.0023216018, 0.0031376940, -0.0012451154, -0.0008008089, -0.0005730931, -0.0014603067, 0.0025310293, 0.0031805711, -0.0070280419, -0.0047521424, 0.0155318938, 0.0046488643, -0.0300640538, 0.0000000000, 0.0549316332, -0.0159718096, -0.1076008976, 0.0776259899, 0.4396336079, 0.4985677898, 0.1688964665, -0.0941233262, -0.0493846424, 0.0517791398, 0.0178490561, -0.0309708193, -0.0050172298, 0.0175974593, 0.0000000000, -0.0088701360, 0.0012507574, 0.0036609909, -0.0009268829, -0.0010269828, -0.0003570767, -0.0015751094, 0.0018793662, 0.0038087873, -0.0057473122, -0.0065735374, 0.0135810468, 0.0087517938, -0.0276978146, -0.0081540346, 0.0528281629, -0.0000000000, -0.1066675633, 0.0366883539, 0.4016346335, 0.5179080367, 0.2172269821, -0.0790469348, -0.0653955936, 0.0462590009, 0.0267864745, -0.0292693246, -0.0101940110, 0.0175088495, 0.0027623500, -0.0092907613, -0.0000000000, 0.0040625944, -0.0005087144, -0.0012363506, -0.0001634445, -0.0015971506, 0.0012191766, 0.0042001773, -0.0043292418, -0.0079515325, 0.0111869983, 0.0121681746, -0.0242963061, -0.0153682642, 0.0486008413, 0.0146532226, -0.1012968048, 0.0000000000, 0.3592533171, 0.5297290087, 0.2658593953, -0.0582402907, -0.0799105912, 0.0381121002, 0.0351761840, -0.0260668676, -0.0152979074, 0.0165835638, 0.0056358469, -0.0093008140, -0.0013860217, 0.0043063643, 0.0000000000, -0.0014123565 +}; + +const LC3_FLOAT lp_filter_32[240] = { +-0.0009272629, -0.0009338366, 0.0014095247, 0.0032704375, -0.0000000000, -0.0060702870, -0.0049301530, 0.0063680070, 0.0131316371, -0.0000000000, -0.0207733605, -0.0160485338, 0.0200898554, 0.0409820564, -0.0000000000, -0.0691019222, -0.0592852011, 0.0915074870, 0.3012259603, 0.4002793729, 0.3012259603, 0.0915074870, -0.0592852011, -0.0691019222, -0.0000000000, 0.0409820564, 0.0200898554, -0.0160485338, -0.0207733605, -0.0000000000, 0.0131316371, 0.0063680070, -0.0049301530, -0.0060702870, -0.0000000000, 0.0032704375, 0.0014095247, -0.0009338366, -0.0009272629, 0.0000000000, -0.0007702371, -0.0010952300, 0.0009143824, 0.0032297731, 0.0009380680, -0.0052710315, -0.0059636496, 0.0042268853, 0.0131980944, 0.0034866482, -0.0182222296, -0.0195501503, 0.0133867916, 0.0411987230, 0.0109899174, -0.0599329434, -0.0705924928, 0.0582194924, 0.2694399953, 0.3972967565, 0.3297252059, 0.1266723573, -0.0436802171, -0.0759726018, -0.0119788572, 0.0388343558, 0.0263821371, -0.0115261981, -0.0225480404, -0.0037629222, 0.0124376733, 0.0083902488, -0.0035641068, -0.0066526020, -0.0010395163, 0.0031501330, 0.0018982720, -0.0006951622, -0.0010592674, -0.0001225834, -0.0006006067, -0.0011813320, 0.0004375308, 0.0030469457, 0.0017412014, -0.0043104840, -0.0066458462, 0.0020717625, 0.0126814544, 0.0065638451, -0.0150616150, -0.0219519939, 0.0065904930, 0.0396211222, 0.0206151810, -0.0490466952, -0.0776669234, 0.0275162645, 0.2352019250, 0.3884310126, 0.3541782200, 0.1629202366, -0.0238483809, -0.0800006688, -0.0244960152, 0.0346942507, 0.0319405608, -0.0061155260, -0.0234031938, -0.0076455083, 0.0110985152, 0.0101857856, -0.0019024479, -0.0069680708, -0.0021383159, 0.0028565906, 0.0023532705, -0.0003815358, -0.0011535417, -0.0002678075, -0.0004298199, -0.0011978629, 0.0000000000, 0.0027457431, 0.0023854284, -0.0032469314, -0.0069756107, 0.0000000000, 0.0116489204, 0.0091261305, -0.0114734303, -0.0232281145, 0.0000000000, 0.0364506319, 0.0285840742, -0.0370384827, -0.0807006732, 0.0000000000, 0.1993945539, 0.3739258349, 0.3739258349, 0.1993945539, 0.0000000000, -0.0807006732, -0.0370384827, 0.0285840742, 0.0364506319, 0.0000000000, -0.0232281145, -0.0114734303, 0.0091261305, 0.0116489204, 0.0000000000, -0.0069756107, -0.0032469314, 0.0023854284, 0.0027457431, 0.0000000000, -0.0011978629, -0.0004298199, -0.0002678075, -0.0011535417, -0.0003815358, 0.0023532705, 0.0028565906, -0.0021383159, -0.0069680708, -0.0019024479, 0.0101857856, 0.0110985152, -0.0076455083, -0.0234031938, -0.0061155260, 0.0319405608, 0.0346942507, -0.0244960152, -0.0800006688, -0.0238483809, 0.1629202366, 0.3541782200, 0.3884310126, 0.2352019250, 0.0275162645, -0.0776669234, -0.0490466952, 0.0206151810, 0.0396211222, 0.0065904930, -0.0219519939, -0.0150616150, 0.0065638451, 0.0126814544, 0.0020717625, -0.0066458462, -0.0043104840, 0.0017412014, 0.0030469457, 0.0004375308, -0.0011813320, -0.0006006067, -0.0001225834, -0.0010592674, -0.0006951622, 0.0018982720, 0.0031501330, -0.0010395163, -0.0066526020, -0.0035641068, 0.0083902488, 0.0124376733, -0.0037629222, -0.0225480404, -0.0115261981, 0.0263821371, 0.0388343558, -0.0119788572, -0.0759726018, -0.0436802171, 0.1266723573, 0.3297252059, 0.3972967565, 0.2694399953, 0.0582194924, -0.0705924928, -0.0599329434, 0.0109899174, 0.0411987230, 0.0133867916, -0.0195501503, -0.0182222296, 0.0034866482, 0.0131980944, 0.0042268853, -0.0059636496, -0.0052710315, 0.0009380680, 0.0032297731, 0.0009143824, -0.0010952300, -0.0007702371 +}; + +const LC3_FLOAT lp_filter_48[240] = { +-0.0004004044, -0.0007690279, -0.0006225577, 0.0002916872, 0.0015688470, 0.0021802916, 0.0011608009, -0.0014255439, -0.0040468578, -0.0044305641, -0.0012682986, 0.0042453380, 0.0084543033, 0.0073990100, -0.0000000000, -0.0100410767, -0.0156021295, -0.0106990226, 0.0043936619, 0.0212937072, 0.0273213703, 0.0137434537, -0.0163306762, -0.0460679494, -0.0517779514, -0.0158989206, 0.0610049926, 0.1568012834, 0.2361188084, 0.2668529153, 0.2361188084, 0.1568012834, 0.0610049926, -0.0158989206, -0.0517779514, -0.0460679494, -0.0163306762, 0.0137434537, 0.0273213703, 0.0212937072, 0.0043936619, -0.0106990226, -0.0156021295, -0.0100410767, -0.0000000000, 0.0073990100, 0.0084543033, 0.0042453380, -0.0012682986, -0.0044305641, -0.0040468578, -0.0014255439, 0.0011608009, 0.0021802916, 0.0015688470, 0.0002916872, -0.0006225577, -0.0007690279, -0.0004004044, 0.0000000000, -0.0002865466, -0.0007061783, -0.0007301533, 0.0000000000, 0.0012655146, 0.0021531822, 0.0015902856, -0.0006930109, -0.0035140209, -0.0046504070, -0.0023760712, 0.0028179234, 0.0077659469, 0.0082917819, 0.0023244321, -0.0076489537, -0.0150320269, -0.0130334338, 0.0000000000, 0.0175880920, 0.0274658166, 0.0190560501, -0.0079859048, -0.0399552956, -0.0538004488, -0.0291201454, 0.0388129950, 0.1329296976, 0.2198168039, 0.2648645043, 0.2492838949, 0.1796266586, 0.0844482332, 0.0000000000, -0.0470616631, -0.0506484024, -0.0246923212, 0.0073266113, 0.0258895699, 0.0243004207, 0.0089245280, -0.0076841321, -0.0154854096, -0.0121481530, -0.0025086149, 0.0060840873, 0.0087987296, 0.0055934992, 0.0000000000, -0.0039757662, -0.0044350680, -0.0021646209, 0.0006253787, 0.0021000886, 0.0018304954, 0.0006095883, -0.0004634415, -0.0007985753, -0.0005134914, -0.0000817222, -0.0001785384, -0.0006181753, -0.0007875547, -0.0002543572, 0.0009396831, 0.0020312972, 0.0019043937, -0.0000000000, -0.0028736561, -0.0046453807, -0.0032867687, 0.0013811750, 0.0067905234, 0.0087544248, 0.0043758969, -0.0050970055, -0.0138489073, -0.0146346623, -0.0040770173, 0.0133932373, 0.0264140815, 0.0231295004, -0.0000000000, -0.0326977968, -0.0533337817, -0.0395234674, 0.0183441769, 0.1086134911, 0.2008173168, 0.2589540184, 0.2589540184, 0.2008173168, 0.1086134911, 0.0183441769, -0.0395234674, -0.0533337817, -0.0326977968, -0.0000000000, 0.0231295004, 0.0264140815, 0.0133932373, -0.0040770173, -0.0146346623, -0.0138489073, -0.0050970055, 0.0043758969, 0.0087544248, 0.0067905234, 0.0013811750, -0.0032867687, -0.0046453807, -0.0028736561, -0.0000000000, 0.0019043937, 0.0020312972, 0.0009396831, -0.0002543572, -0.0007875547, -0.0006181753, -0.0001785384, -0.0000817222, -0.0005134914, -0.0007985753, -0.0004634415, 0.0006095883, 0.0018304954, 0.0021000886, 0.0006253787, -0.0021646209, -0.0044350680, -0.0039757662, 0.0000000000, 0.0055934992, 0.0087987296, 0.0060840873, -0.0025086149, -0.0121481530, -0.0154854096, -0.0076841321, 0.0089245280, 0.0243004207, 0.0258895699, 0.0073266113, -0.0246923212, -0.0506484024, -0.0470616631, 0.0000000000, 0.0844482332, 0.1796266586, 0.2492838949, 0.2648645043, 0.2198168039, 0.1329296976, 0.0388129950, -0.0291201454, -0.0538004488, -0.0399552956, -0.0079859048, 0.0190560501, 0.0274658166, 0.0175880920, 0.0000000000, -0.0130334338, -0.0150320269, -0.0076489537, 0.0023244321, 0.0082917819, 0.0077659469, 0.0028179234, -0.0023760712, -0.0046504070, -0.0035140209, -0.0006930109, 0.0015902856, 0.0021531822, 0.0012655146, 0.0000000000, -0.0007301533, -0.0007061783, -0.0002865466 +}; + +const LC3_FLOAT lp_filter_96[240] = { +-0.0000892692, -0.0002002022, -0.0003090877, -0.0003845139, -0.0003937774, -0.0003112789, -0.0001271786, 0.0001458436, 0.0004698416, 0.0007844235, 0.0010156486, 0.0010901458, 0.0009521968, 0.0005804005, -0.0000000000, -0.0007127720, -0.0014368281, -0.0020234289, -0.0023226903, -0.0022152821, -0.0016433843, -0.0006341493, 0.0006905875, 0.0021226690, 0.0033952617, 0.0042271516, 0.0043772124, 0.0036995050, 0.0021879484, -0.0000000000, -0.0025485028, -0.0050205383, -0.0069244537, -0.0078010648, -0.0073173312, -0.0053495113, -0.0020385087, 0.0021968309, 0.0066966186, 0.0106468536, 0.0132070407, 0.0136606852, 0.0115647502, 0.0068717268, -0.0000000000, -0.0081653381, -0.0163488984, -0.0230339747, -0.0266668908, -0.0258889757, -0.0197617337, -0.0079494603, 0.0091720885, 0.0305024963, 0.0543067455, 0.0784006417, 0.1004086584, 0.1180594042, 0.1294770092, 0.1334264576, 0.1294770092, 0.1180594042, 0.1004086584, 0.0784006417, 0.0543067455, 0.0305024963, 0.0091720885, -0.0079494603, -0.0197617337, -0.0258889757, -0.0266668908, -0.0230339747, -0.0163488984, -0.0081653381, -0.0000000000, 0.0068717268, 0.0115647502, 0.0136606852, 0.0132070407, 0.0106468536, 0.0066966186, 0.0021968309, -0.0020385087, -0.0053495113, -0.0073173312, -0.0078010648, -0.0069244537, -0.0050205383, -0.0025485028, -0.0000000000, 0.0021879484, 0.0036995050, 0.0043772124, 0.0042271516, 0.0033952617, 0.0021226690, 0.0006905875, -0.0006341493, -0.0016433843, -0.0022152821, -0.0023226903, -0.0020234289, -0.0014368281, -0.0007127720, -0.0000000000, 0.0005804005, 0.0009521968, 0.0010901458, 0.0010156486, 0.0007844235, 0.0004698416, 0.0001458436, -0.0001271786, -0.0003112789, -0.0003937774, -0.0003845139, -0.0003090877, -0.0002002022, -0.0000892692, 0.0000000000, -0.0000408611, -0.0001432733, -0.0002567457, -0.0003530891, -0.0003992876, -0.0003650767, -0.0002317207, 0.0000000000, 0.0003047941, 0.0006327573, 0.0009152477, 0.0010765911, 0.0010500443, 0.0007951428, 0.0003126893, -0.0003465054, -0.0010823105, -0.0017570105, -0.0022175340, -0.0023252035, -0.0019878831, -0.0011880356, 0.0000000000, 0.0014089617, 0.0027967496, 0.0038829735, 0.0043993648, 0.0041458909, 0.0030420437, 0.0011622161, -0.0012543075, -0.0038244769, -0.0060740765, -0.0075160135, -0.0077427048, -0.0065167169, -0.0038420660, 0.0000000000, 0.0044622640, 0.0087940460, 0.0121502103, 0.0137329083, 0.0129447849, 0.0095280251, 0.0036633057, -0.0039929524, -0.0123461606, -0.0199776478, -0.0253242012, -0.0269002244, -0.0235308316, -0.0145600727, 0.0000000000, 0.0194064975, 0.0422241166, 0.0664648488, 0.0898133293, 0.1099084020, 0.1246419474, 0.1324322522, 0.1324322522, 0.1246419474, 0.1099084020, 0.0898133293, 0.0664648488, 0.0422241166, 0.0194064975, 0.0000000000, -0.0145600727, -0.0235308316, -0.0269002244, -0.0253242012, -0.0199776478, -0.0123461606, -0.0039929524, 0.0036633057, 0.0095280251, 0.0129447849, 0.0137329083, 0.0121502103, 0.0087940460, 0.0044622640, 0.0000000000, -0.0038420660, -0.0065167169, -0.0077427048, -0.0075160135, -0.0060740765, -0.0038244769, -0.0012543075, 0.0011622161, 0.0030420437, 0.0041458909, 0.0043993648, 0.0038829735, 0.0027967496, 0.0014089617, 0.0000000000, -0.0011880356, -0.0019878831, -0.0023252035, -0.0022175340, -0.0017570105, -0.0010823105, -0.0003465054, 0.0003126893, 0.0007951428, 0.0010500443, 0.0010765911, 0.0009152477, 0.0006327573, 0.0003047941, 0.0000000000, -0.0002317207, -0.0003650767, -0.0003992876, -0.0003530891, -0.0002567457, -0.0001432733, -0.0000408611 +}; + +const LC3_FLOAT *lp_filter[] = {lp_filter_8, lp_filter_16, lp_filter_24, lp_filter_32, lp_filter_48, lp_filter_96}; + +const LC3_INT up_fac[6] = {24, 12, 8, 6, 4, 2}; + +/* TNS */ +const LC3_INT huff_bits_tns[8][17] = { + {20480, 15725, 12479, 10334, 8694, 7320, 6964, 6335, 5504, 5637, 6566, 6758, 8433, 11348, 15186, 20480, 20480}, + {20480, 20480, 20480, 20480, 12902, 9368, 7057, 5901, 5254, 5485, 5598, 6076, 7608, 10742, 15186, 20480, 20480}, + {20480, 20480, 20480, 20480, 13988, 9368, 6702, 4841, 4585, 4682, 5859, 7764, 12109, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 18432, 13396, 8982, 4767, 3779, 3658, 6335, 9656, 13988, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 20480, 14731, 9437, 4275, 3249, 3493, 8483, 13988, 17234, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 20480, 20480, 12902, 4753, 3040, 2953, 9105, 15725, 20480, 20480, 20480, 20480, 20480}, + {20480, 20480, 20480, 20480, 20480, 20480, 12902, 3821, 3346, 3000, 12109, 20480, 20480, 20480, 20480, 20480, + 20480}, + {20480, 20480, 20480, 20480, 20480, 20480, 15725, 3658, 20480, 1201, 10854, 18432, 20480, 20480, 20480, 20480, + 20480}}; + +const LC3_INT order1_tns[8] = {17234, 13988, 11216, 8694, 6566, 4977, 3961, 3040}; +const LC3_INT order2_tns[8] = {12683, 9437, 6874, 5541, 5121, 5170, 5359, 5056}; + +const LC3_FLOAT lagw_tns[9] = {1, + 0.998028026020383, + 0.992135405511397, + 0.982391584470799, + 0.968910791191297, + 0.951849807369274, + 0.931404933402306, + 0.907808229996959, + 0.881323136669471}; + +const LC3_FLOAT quants_pts_tns[17] = { -0.995727539062500, -0.961822509765625, -0.895172119140625, + -0.798004150390625, -0.673706054687500, -0.526428222656250, + -0.361236572265625, -0.183746337890625, 0.000000000000000, + 0.183746337890625, 0.361236572265625, 0.526428222656250, + 0.673706054687500, 0.798004150390625, 0.895172119140625, + 0.961822509765625, 0.995727539062500}; + +const LC3_FLOAT quants_thr_tns[18] = {-1, + -0.982973099683902, + -0.932472229404356, + -0.850217135729614, + -0.739008917220659, + -0.602634636379256, + -0.445738355776538, + -0.273662990072083, + -0.0922683594633020, + 0.0922683594633020, + 0.273662990072083, + 0.445738355776538, + 0.602634636379256, + 0.739008917220659, + 0.850217135729614, + 0.932472229404356, + 0.982973099683902, + 1}; + +/* SNS */ +const LC3_FLOAT sns_vq_far_adj_gains_fl[8] = {1.05859375000000, 1.23706054687500, 1.43920898437500, 1.98950195312500, + 2.49877929687500, 3.13110351562500, 4.11816406250000, 4.85400390625000}; + +const LC3_FLOAT sns_vq_near_adj_gains_fl[4] = {1.73315429687500, 2.22949218750000, 2.74731445312500, 3.61523437500000}; + +const LC3_FLOAT sns_vq_reg_lf_adj_gains_fl[4] = {1.52465820312500, 3.67260742187500, 4.36059570312500, + 5.13037109375000}; + +const LC3_FLOAT q_g_sns[6] = {2.17651367187500, 2.94287109375000, 1.52465820312500, + 3.67260742187500, 4.36059570312500, 5.13037109375000}; + +const LC3_FLOAT sns_vq_reg_adj_gains_fl[2] = {2.17651367187500, 2.94287109375000}; + +/* First element in each row is multiplied with norm2 = 1 / sqrt(2) */ +const LC3_FLOAT idct_lookup[M][M] = { + {0.707106781186547, 0.995184726672197, 0.980785280403230, 0.956940335732209, 0.923879532511287, 0.881921264348355, 0.831469612302545, 0.773010453362737, 0.707106781186548, 0.634393284163646, 0.555570233019602, 0.471396736825998, 0.382683432365090, 0.290284677254462, 0.195090322016128, 0.0980171403295608}, + {0.707106781186547, 0.956940335732209, 0.831469612302545, 0.634393284163646, 0.382683432365090, 0.0980171403295608, -0.195090322016128, -0.471396736825998, -0.707106781186548, -0.881921264348355, -0.980785280403230, -0.995184726672197, -0.923879532511287, -0.773010453362737, -0.555570233019602, -0.290284677254462}, + {0.707106781186547, 0.881921264348355, 0.555570233019602, 0.0980171403295608, -0.382683432365090, -0.773010453362737, -0.980785280403230, -0.956940335732209, -0.707106781186548, -0.290284677254462, 0.195090322016128, 0.634393284163646, 0.923879532511287, 0.995184726672197, 0.831469612302546, 0.471396736825998}, + {0.707106781186547, 0.773010453362737, 0.195090322016128, -0.471396736825998, -0.923879532511287, -0.956940335732209, -0.555570233019602, 0.0980171403295601, 0.707106781186547, 0.995184726672197, 0.831469612302546, 0.290284677254463, -0.382683432365090, -0.881921264348355, -0.980785280403231, -0.634393284163645}, + {0.707106781186547, 0.634393284163646, -0.195090322016128, -0.881921264348355, -0.923879532511287, -0.290284677254462, 0.555570233019602, 0.995184726672197, 0.707106781186548, -0.0980171403295600, -0.831469612302545, -0.956940335732209, -0.382683432365091, 0.471396736825997, 0.980785280403230, 0.773010453362738}, + {0.707106781186547, 0.471396736825998, -0.555570233019602, -0.995184726672197, -0.382683432365090, 0.634393284163645, 0.980785280403231, 0.290284677254463, -0.707106781186547, -0.956940335732209, -0.195090322016130, 0.773010453362736, 0.923879532511287, 0.0980171403295626, -0.831469612302544, -0.881921264348356}, + {0.707106781186547, 0.290284677254462, -0.831469612302545, -0.773010453362737, 0.382683432365090, 0.995184726672197, 0.195090322016128, -0.881921264348356, -0.707106781186547, 0.471396736825997, 0.980785280403230, 0.0980171403295591, -0.923879532511287, -0.634393284163646, 0.555570233019604, 0.956940335732208}, + {0.707106781186547, 0.0980171403295608, -0.980785280403230, -0.290284677254463, 0.923879532511287, 0.471396736825998, -0.831469612302544, -0.634393284163647, 0.707106781186547, 0.773010453362738, -0.555570233019602, -0.881921264348356, 0.382683432365086, 0.956940335732209, -0.195090322016125, -0.995184726672197}, + {0.707106781186547, -0.0980171403295607, -0.980785280403230, 0.290284677254463, 0.923879532511287, -0.471396736825998, -0.831469612302545, 0.634393284163646, 0.707106781186547, -0.773010453362737, -0.555570233019603, 0.881921264348356, 0.382683432365088, -0.956940335732209, -0.195090322016127, 0.995184726672197}, + {0.707106781186547, -0.290284677254462, -0.831469612302546, 0.773010453362737, 0.382683432365090, -0.995184726672197, 0.195090322016127, 0.881921264348356, -0.707106781186547, -0.471396736825998, 0.980785280403230, -0.0980171403295577, -0.923879532511288, 0.634393284163644, 0.555570233019606, -0.956940335732208}, + {0.707106781186547, -0.471396736825998, -0.555570233019602, 0.995184726672197, -0.382683432365090, -0.634393284163645, 0.980785280403230, -0.290284677254463, -0.707106781186547, 0.956940335732209, -0.195090322016129, -0.773010453362737, 0.923879532511287, -0.0980171403295610, -0.831469612302545, 0.881921264348355}, + {0.707106781186547, -0.634393284163645, -0.195090322016129, 0.881921264348355, -0.923879532511286, 0.290284677254461, 0.555570233019603, -0.995184726672197, 0.707106781186547, 0.0980171403295628, -0.831469612302547, 0.956940335732208, -0.382683432365089, -0.471396736825999, 0.980785280403231, -0.773010453362733}, + {0.707106781186547, -0.773010453362737, 0.195090322016128, 0.471396736825998, -0.923879532511287, 0.956940335732209, -0.555570233019602, -0.0980171403295592, 0.707106781186548, -0.995184726672197, 0.831469612302546, -0.290284677254462, -0.382683432365091, 0.881921264348355, -0.980785280403231, 0.634393284163644}, + {0.707106781186547, -0.881921264348355, 0.555570233019602, -0.0980171403295600, -0.382683432365091, 0.773010453362738, -0.980785280403231, 0.956940335732208, -0.707106781186546, 0.290284677254462, 0.195090322016130, -0.634393284163649, 0.923879532511288, -0.995184726672197, 0.831469612302542, -0.471396736825993}, + {0.707106781186547, -0.956940335732209, 0.831469612302545, -0.634393284163645, 0.382683432365090, -0.0980171403295615, -0.195090322016130, 0.471396736825998, -0.707106781186548, 0.881921264348355, -0.980785280403230, 0.995184726672197, -0.923879532511285, 0.773010453362735, -0.555570233019601, 0.290284677254462}, + {0.707106781186547, -0.995184726672197, 0.980785280403230, -0.956940335732209, 0.923879532511286, -0.881921264348355, 0.831469612302544, -0.773010453362736, 0.707106781186546, -0.634393284163644, 0.555570233019601, -0.471396736825994, 0.382683432365086, -0.290284677254458, 0.195090322016124, -0.0980171403295567} +}; + +const LC3_FLOAT sns_dec_gains[4][8] = { + {2.17651367187500, 2.94287109375000, 0, 0, 0, 0, 0, 0}, + {1.52465820312500, 3.67260742187500, 4.36059570312500, 5.13037109375000, 0, 0, 0, 0}, + {1.73315429687500, 2.22949218750000, 2.74731445312500, 3.61523437500000, 0, 0, 0, 0}, + {1.05859375000000, 1.23706054687500, 1.43920898437500, 1.98950195312500, 2.49877929687500, 3.13110351562500, + 4.11816406250000, 4.85400390625000}}; + +/* Global Gain */ +const LC3_INT gg_p1[6] = {80, 230, 380, 530, 680, 830}; +const LC3_INT gg_p2[6] = {500, 1025, 1550, 2075, 2600, 3125}; +const LC3_INT gg_p3[6] = {850, 1700, 2550, 3400, 4250, 5100}; + +const LC3_FLOAT gg_c[6] = {0.00575396825396825, 0.00500524109014675, 0.00473646723646723, + 0.00459816612729234, 0.00451388888888889, 0.004457153231663}; +const LC3_FLOAT gg_d[6] = {1310.34482758621, 3241.36125654450, 5267.66917293233, + 7326.39296187684, 9400.00000000000, 11481.67006109979}; + +/* Olpa */ +const LC3_FLOAT olpa_down2[5] = {0.1236796411180537, 0.2353512128364889, 0.2819382920909148, 0.2353512128364889, + 0.1236796411180537}; + +const LC3_FLOAT olpa_acw[98] = {1.0, + 0.994845360824742, + 0.989690721649485, + 0.984536082474227, + 0.979381443298969, + 0.974226804123711, + 0.969072164948454, + 0.963917525773196, + 0.958762886597938, + 0.953608247422680, + 0.948453608247423, + 0.943298969072165, + 0.938144329896907, + 0.932989690721650, + 0.927835051546392, + 0.922680412371134, + 0.917525773195876, + 0.912371134020619, + 0.907216494845361, + 0.902061855670103, + 0.896907216494845, + 0.891752577319588, + 0.886597938144330, + 0.881443298969072, + 0.876288659793814, + 0.871134020618557, + 0.865979381443299, + 0.860824742268041, + 0.855670103092784, + 0.850515463917526, + 0.845360824742268, + 0.840206185567010, + 0.835051546391753, + 0.829896907216495, + 0.824742268041237, + 0.819587628865979, + 0.814432989690722, + 0.809278350515464, + 0.804123711340206, + 0.798969072164949, + 0.793814432989691, + 0.788659793814433, + 0.783505154639175, + 0.778350515463918, + 0.773195876288660, + 0.768041237113402, + 0.762886597938144, + 0.757731958762887, + 0.752577319587629, + 0.747422680412371, + 0.742268041237113, + 0.737113402061856, + 0.731958762886598, + 0.726804123711340, + 0.721649484536083, + 0.716494845360825, + 0.711340206185567, + 0.706185567010309, + 0.701030927835052, + 0.695876288659794, + 0.690721649484536, + 0.685567010309278, + 0.680412371134021, + 0.675257731958763, + 0.670103092783505, + 0.664948453608247, + 0.659793814432990, + 0.654639175257732, + 0.649484536082474, + 0.644329896907216, + 0.639175257731959, + 0.634020618556701, + 0.628865979381443, + 0.623711340206186, + 0.618556701030928, + 0.613402061855670, + 0.608247422680412, + 0.603092783505155, + 0.597938144329897, + 0.592783505154639, + 0.587628865979382, + 0.582474226804124, + 0.577319587628866, + 0.572164948453608, + 0.567010309278351, + 0.561855670103093, + 0.556701030927835, + 0.551546391752577, + 0.546391752577320, + 0.541237113402062, + 0.536082474226804, + 0.530927835051546, + 0.525773195876289, + 0.520618556701031, + 0.515463917525773, + 0.510309278350515, + 0.505154639175258, + 0.500000000000000}; + +/* LTPF */ +const LC3_FLOAT conf_tilt_filter_16[4][3] = {{6.023618207009578e-01, 4.197609261363617e-01, -1.883424527883687e-02}, + {5.994768582584314e-01, 4.197609261363620e-01, -1.594928283631041e-02}, + {5.967764663733787e-01, 4.197609261363617e-01, -1.324889095125780e-02}, + {5.942410120098895e-01, 4.197609261363618e-01, -1.071343658776831e-02}}; + +const LC3_FLOAT conf_tilt_filter_24[4][5] = {{3.989695588963494e-01, 5.142508607708275e-01, 1.004382966157454e-01, + -1.278893956818042e-02, -1.572280075461383e-03}, + {3.948634911286333e-01, 5.123819208048688e-01, 1.043194926386267e-01, + -1.091999960222166e-02, -1.347408330627317e-03}, + {3.909844475885914e-01, 5.106053522688359e-01, 1.079832524685944e-01, + -9.143431066188848e-03, -1.132124620551895e-03}, + {3.873093888199928e-01, 5.089122083363975e-01, 1.114517380217371e-01, + -7.450287133750717e-03, -9.255514050963111e-04}}; + +const LC3_FLOAT conf_tilt_filter_32[4][7] = { + {2.982379446702096e-01, 4.652809203721290e-01, 2.105997428614279e-01, 3.766780380806063e-02, -1.015696155796564e-02, + -2.535880996101096e-03, -3.182946168719958e-04}, + {2.943834154510240e-01, 4.619294002718798e-01, 2.129465770091844e-01, 4.066175002688857e-02, -8.693272297010050e-03, + -2.178307114679820e-03, -2.742888063983188e-04}, + {2.907439213122688e-01, 4.587461910960279e-01, 2.151456974108970e-01, 4.350104772529774e-02, -7.295495347716925e-03, + -1.834395637237086e-03, -2.316920186482416e-04}, + {2.872975852589158e-01, 4.557148886861379e-01, 2.172126950911401e-01, 4.620088878229615e-02, -5.957463802125952e-03, + -1.502934284345198e-03, -1.903851911308866e-04}}; + +const LC3_FLOAT conf_tilt_filter_48[4][11] = { + {1.981363739883217e-01, 3.524494903964904e-01, 2.513695269649414e-01, 1.424146237314458e-01, 5.704731023952599e-02, + 9.293366241586384e-03, -7.226025368953745e-03, -3.172679890356356e-03, -1.121835963567014e-03, + -2.902957238400140e-04, -4.270815593769240e-05}, + {1.950709426598375e-01, 3.484660408341632e-01, 2.509988459466574e-01, 1.441167412482088e-01, 5.928947317677285e-02, + 1.108923827452231e-02, -6.192908108653504e-03, -2.726705509251737e-03, -9.667125826217151e-04, + -2.508100923165204e-04, -3.699938766131869e-05}, + {1.921810055196015e-01, 3.446945561091513e-01, 2.506220094626024e-01, 1.457102447664837e-01, 6.141132133664525e-02, + 1.279941396562798e-02, -5.203721087886321e-03, -2.297324511109085e-03, -8.165608133217555e-04, + -2.123855748277408e-04, -3.141271330981649e-05}, + {1.894485314175868e-01, 3.411139251108252e-01, 2.502406876894361e-01, 1.472065631098081e-01, 6.342477229539051e-02, + 1.443203434150312e-02, -4.254449144657098e-03, -1.883081472613493e-03, -6.709619060722140e-04, + -1.749363341966872e-04, -2.593864735284285e-05}}; + +const LC3_FLOAT conf_inter_filter_16[4][4] = { + {2.098804630681809e-01, 5.835275754221211e-01, 2.098804630681809e-01, 0.000000000000000e+00}, + {1.069991860896389e-01, 5.500750019177116e-01, 3.356906254147840e-01, 6.698858366939680e-03}, + {3.967114782344967e-02, 4.592209296082350e-01, 4.592209296082350e-01, 3.967114782344967e-02}, + {6.698858366939680e-03, 3.356906254147840e-01, 5.500750019177116e-01, 1.069991860896389e-01}}; + +const LC3_FLOAT conf_inter_filter_24[4][6] = {{6.322231627323796e-02, 2.507309606013235e-01, 3.713909428901578e-01, + 2.507309606013235e-01, 6.322231627323796e-02, 0.000000000000000e+00}, + {3.459272174099855e-02, 1.986515602645028e-01, 3.626411726581452e-01, + 2.986750548992179e-01, 1.013092873505928e-01, 4.263543712369752e-03}, + {1.535746784963907e-02, 1.474344878058222e-01, 3.374259553990717e-01, + 3.374259553990717e-01, 1.474344878058222e-01, 1.535746784963907e-02}, + {4.263543712369752e-03, 1.013092873505928e-01, 2.986750548992179e-01, + 3.626411726581452e-01, 1.986515602645028e-01, 3.459272174099855e-02}}; + +const LC3_FLOAT conf_inter_filter_32[4][8] = { + {2.900401878228730e-02, 1.129857420560927e-01, 2.212024028097570e-01, 2.723909472446145e-01, 2.212024028097570e-01, + 1.129857420560927e-01, 2.900401878228730e-02, 0.000000000000000e+00}, + {1.703153418385261e-02, 8.722503785537784e-02, 1.961407762232199e-01, 2.689237982237257e-01, 2.424999102756389e-01, + 1.405773364650031e-01, 4.474877169485788e-02, 3.127030243100724e-03}, + {8.563673748488349e-03, 6.426222944493845e-02, 1.687676705918012e-01, 2.587445937795505e-01, 2.587445937795505e-01, + 1.687676705918012e-01, 6.426222944493845e-02, 8.563673748488349e-03}, + {3.127030243100724e-03, 4.474877169485788e-02, 1.405773364650031e-01, 2.424999102756389e-01, 2.689237982237257e-01, + 1.961407762232199e-01, 8.722503785537784e-02, 1.703153418385261e-02}}; + +const LC3_FLOAT conf_inter_filter_48[4][12] = { + {1.082359386659387e-02, 3.608969221303979e-02, 7.676401468099964e-02, 1.241530577501703e-01, 1.627596438300696e-01, + 1.776771417779109e-01, 1.627596438300696e-01, 1.241530577501703e-01, 7.676401468099964e-02, 3.608969221303979e-02, + 1.082359386659387e-02, 0.000000000000000e+00}, + {7.041404930459358e-03, 2.819702319820420e-02, 6.547044935127551e-02, 1.124647986743299e-01, 1.548418956489015e-01, + 1.767122381341857e-01, 1.691507213057663e-01, 1.352901577989766e-01, 8.851425011427483e-02, 4.499353848562444e-02, + 1.557613714732002e-02, 2.039721956502016e-03}, + {4.146998467444788e-03, 2.135757310741917e-02, 5.482735584552816e-02, 1.004971444643720e-01, 1.456060342830002e-01, + 1.738439838565869e-01, 1.738439838565869e-01, 1.456060342830002e-01, 1.004971444643720e-01, 5.482735584552816e-02, + 2.135757310741917e-02, 4.146998467444788e-03}, + {2.039721956502016e-03, 1.557613714732002e-02, 4.499353848562444e-02, 8.851425011427483e-02, 1.352901577989766e-01, + 1.691507213057663e-01, 1.767122381341857e-01, 1.548418956489015e-01, 1.124647986743299e-01, 6.547044935127551e-02, + 2.819702319820420e-02, 7.041404930459358e-03}}; + +const LC3_FLOAT inter4_1[33] = {0, + -2.874561161519444e-03, + -3.001251025861499e-03, + +2.745471654059321e-03, + +1.535727698935322e-02, + +2.868234046665657e-02, + +2.950385026557377e-02, + +4.598334491135473e-03, + -4.729632459043440e-02, + -1.058359163062837e-01, + -1.303050213607112e-01, + -7.544046357555201e-02, + +8.357885725250529e-02, + +3.301825710764459e-01, + +6.032970076366158e-01, + +8.174886856243178e-01, + +8.986382851273982e-01, + +8.174886856243178e-01, + +6.032970076366158e-01, + +3.301825710764459e-01, + +8.357885725250529e-02, + -7.544046357555201e-02, + -1.303050213607112e-01, + -1.058359163062837e-01, + -4.729632459043440e-02, + +4.598334491135473e-03, + +2.950385026557377e-02, + +2.868234046665657e-02, + +1.535727698935322e-02, + +2.745471654059321e-03, + -3.001251025861499e-03, + -2.874561161519444e-03, + 0}; + +const LC3_FLOAT enc_inter_filter[4][4] = { + {+2.098804630681809e-01, +5.835275754221211e-01, +2.098804630681809e-01, 0}, + {+1.069991860896389e-01, +5.500750019177116e-01, +3.356906254147840e-01, +6.698858366939680e-03}, + {+3.967114782344967e-02, +4.592209296082350e-01, +4.592209296082350e-01, +3.967114782344967e-02}, + {+6.698858366939680e-03, +3.356906254147840e-01, +5.500750019177116e-01, +1.069991860896389e-01}}; + +/* Bandwidth Detector */ +const LC3_INT threshold_quiet[4] = {20, 10, 10, 10}; +const LC3_INT threshold_brickwall[4] = {15, 23, 20, 20}; +const LC3_INT brickwall_dist[4] = {4, 4, 3, 1}; +const LC3_INT BW_warp_idx_start_16k[4] = {53, 0, 0, 0}; +const LC3_INT BW_warp_idx_stop_16k[4] = {63, 0, 0, 0}; +const LC3_INT BW_warp_idx_start_24k[4] = {47, 59, 0, 0}; +const LC3_INT BW_warp_idx_stop_24k[4] = {56, 63, 0, 0}; +const LC3_INT BW_warp_idx_start_32k[4] = {44, 54, 60, 0}; +const LC3_INT BW_warp_idx_stop_32k[4] = {52, 59, 63, 0}; +const LC3_INT BW_warp_idx_start_48k[4] = {41, 51, 57, 61}; +const LC3_INT BW_warp_idx_stop_48k[4] = {49, 55, 60, 63}; +const LC3_INT* BW_warp_idx_start_all[4] = {BW_warp_idx_start_16k, BW_warp_idx_start_24k, BW_warp_idx_start_32k, + BW_warp_idx_start_48k}; +const LC3_INT* BW_warp_idx_stop_all[4] = {BW_warp_idx_stop_16k, BW_warp_idx_stop_24k, BW_warp_idx_stop_32k, + BW_warp_idx_stop_48k}; + +const LC3_INT BW_warp_idx_start_16k_2_5ms[4] = {24, 0, 0, 0}; +const LC3_INT BW_warp_idx_stop_16k_2_5ms[4] = {34, 0, 0, 0}; +const LC3_INT BW_warp_idx_start_24k_2_5ms[4] = {24, 35, 0, 0}; +const LC3_INT BW_warp_idx_stop_24k_2_5ms[4] = {32, 39, 0, 0}; +const LC3_INT BW_warp_idx_start_32k_2_5ms[4] = {24, 33, 39, 0}; +const LC3_INT BW_warp_idx_stop_32k_2_5ms[4] = {31, 38, 42, 0}; +const LC3_INT BW_warp_idx_start_48k_2_5ms[4] = {22, 31, 37, 41}; +const LC3_INT BW_warp_idx_stop_48k_2_5ms[4] = {29, 35, 40, 43}; + +const LC3_INT* BW_warp_idx_start_all_2_5ms[4] = {BW_warp_idx_start_16k_2_5ms, BW_warp_idx_start_24k_2_5ms, + BW_warp_idx_start_32k_2_5ms, BW_warp_idx_start_48k_2_5ms}; +const LC3_INT* BW_warp_idx_stop_all_2_5ms[4] = {BW_warp_idx_stop_16k_2_5ms, BW_warp_idx_stop_24k_2_5ms, + BW_warp_idx_stop_32k_2_5ms, BW_warp_idx_stop_48k_2_5ms}; + +const LC3_INT bands_number_2_5ms_HR[6] = {20, 35, 40, 43, 45, 49}; + +const LC3_INT bands_number_2_5ms[5] = {20, 35, 40, 43, 44}; + + +const LC3_INT BW_warp_idx_start_16k_5ms[4] = {39, 0, 0, 0}; +const LC3_INT BW_warp_idx_stop_16k_5ms[4] = {49, 0, 0, 0}; +const LC3_INT BW_warp_idx_start_24k_5ms[4] = {35, 47, 0, 0}; +const LC3_INT BW_warp_idx_stop_24k_5ms[4] = {44, 51, 0, 0}; +const LC3_INT BW_warp_idx_start_32k_5ms[4] = {34, 44, 50, 0}; +const LC3_INT BW_warp_idx_stop_32k_5ms[4] = {42, 49, 53, 0}; +const LC3_INT BW_warp_idx_start_48k_5ms[4] = {32, 42, 48, 52}; +const LC3_INT BW_warp_idx_stop_48k_5ms[4] = {40, 46, 51, 54}; + +const LC3_INT* BW_warp_idx_start_all_5ms[4] = {BW_warp_idx_start_16k_5ms, BW_warp_idx_start_24k_5ms, + BW_warp_idx_start_32k_5ms, BW_warp_idx_start_48k_5ms}; +const LC3_INT* BW_warp_idx_stop_all_5ms[4] = {BW_warp_idx_stop_16k_5ms, BW_warp_idx_stop_24k_5ms, + BW_warp_idx_stop_32k_5ms, BW_warp_idx_stop_48k_5ms}; + +const LC3_INT bands_number_5ms[6] = {39, 50, 52, 54, 55, 58}; + + +const LC3_INT BW_cutoff_bin_all[MAX_BW_BANDS_NUMBER] = {80, 160, 240, 320, 400, 400}; +const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER] = {0, 1, 2, 2, 3, 0}; + +const LC3_INT BW_cutoff_bin_all_5ms[MAX_BW_BANDS_NUMBER] = {40, 80, 120, 160, 200, 200}; +const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER] = {20, 40, 60, 80, 100, 100}; + +/* Arithmetic coding */ +const LC3_INT tns_cf[8][18] = {{0, 1, 6, 21, 52, 106, 192, 289, 409, 568, 720, 831, 935, 994, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 17, 60, 154, 293, 466, 626, 780, 911, 989, 1016, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 13, 56, 162, 361, 578, 788, 929, 1003, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 6, 17, 66, 270, 555, 852, 972, 1011, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 12, 54, 295, 636, 950, 1008, 1017, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 224, 590, 967, 1014, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 19, 300, 630, 1001, 1018, 1019, 1020, 1021, 1022, 1023, 1024}, + {0, 1, 2, 3, 4, 5, 6, 11, 308, 309, 991, 1017, 1019, 1020, 1021, 1022, 1023, 1024}}; + +const LC3_INT tns_freq_cf[2][9] = {{0, 3, 12, 35, 89, 200, 390, 658, 1024}, {0, 14, 56, 156, 313, 494, 672, 839, 1024}}; + +/* MDCT Windows */ + + +const LC3_FLOAT MDCT_WINDOW_80_2_5ms[40] = { + 6.737914289329320e-03, 2.732289618100209e-02, 6.163560962361236e-02, 1.119125037883055e-01, 1.787053464784875e-01, + 2.607525136824537e-01, 3.549776504187033e-01, 4.567696724165073e-01, 5.605239559005871e-01, 6.603665285212146e-01, + 7.509434386216048e-01, 8.281382099997300e-01, 8.895849967038094e-01, 9.348747871791264e-01, 9.654056798094166e-01, + 9.839026370225886e-01, 9.937180643904148e-01, 9.980987183772584e-01, 9.996266599807562e-01, 9.999772999978698e-01, + 9.999772999978698e-01, 9.996266599807562e-01, 9.980987183772584e-01, 9.937180643904148e-01, 9.839026370225886e-01, + 9.654056798094166e-01, 9.348747871791264e-01, 8.895849967038094e-01, 8.281382099997300e-01, 7.509434386216048e-01, + 6.603665285212146e-01, 5.605239559005871e-01, 4.567696724165073e-01, 3.549776504187033e-01, 2.607525136824537e-01, + 1.787053464784875e-01, 1.119125037883055e-01, 6.163560962361236e-02, 2.732289618100209e-02, 6.737914289329320e-03}; + +const LC3_FLOAT MDCT_WINDOW_160_2_5ms[80] = { + 4.764416154578566e-03, 1.204636278996989e-02, 2.226396539371650e-02, 3.580223111285056e-02, 5.299054649961241e-02, + 7.408518398076024e-02, 9.925385917916330e-02, 1.285631180041137e-01, 1.619692437449073e-01, 1.993132407013812e-01, + 2.403202823615340e-01, 2.846038181323611e-01, 3.316743228466244e-01, 3.809524578920635e-01, 4.317862022264749e-01, + 4.834713159013930e-01, 5.352743274612082e-01, 5.864570980113353e-01, 6.363019156559162e-01, 6.841360194558924e-01, + 7.293544453028629e-01, 7.714401286766273e-01, 8.099802912368443e-01, 8.446782786131956e-01, 8.753602039735273e-01, + 9.019759839191052e-01, 9.245946272967390e-01, 9.433939492938426e-01, 9.586452246292587e-01, 9.706936498636800e-01, + 9.799358305935717e-01, 9.867958066797319e-01, 9.917013283691115e-01, 9.950621445106043e-01, 9.972519167765670e-01, + 9.985950139980033e-01, 9.993588946156141e-01, 9.997521272020117e-01, 9.999274399392850e-01, 9.999886501049429e-01, + 9.999886501049429e-01, 9.999274399392850e-01, 9.997521272020117e-01, 9.993588946156141e-01, 9.985950139980033e-01, + 9.972519167765670e-01, 9.950621445106043e-01, 9.917013283691115e-01, 9.867958066797319e-01, 9.799358305935717e-01, + 9.706936498636800e-01, 9.586452246292587e-01, 9.433939492938426e-01, 9.245946272967390e-01, 9.019759839191052e-01, + 8.753602039735273e-01, 8.446782786131956e-01, 8.099802912368443e-01, 7.714401286766273e-01, 7.293544453028629e-01, + 6.841360194558924e-01, 6.363019156559162e-01, 5.864570980113353e-01, 5.352743274612082e-01, 4.834713159013930e-01, + 4.317862022264749e-01, 3.809524578920635e-01, 3.316743228466244e-01, 2.846038181323611e-01, 2.403202823615340e-01, + 1.993132407013812e-01, 1.619692437449073e-01, 1.285631180041137e-01, 9.925385917916330e-02, 7.408518398076024e-02, + 5.299054649961241e-02, 3.580223111285056e-02, 2.226396539371650e-02, 1.204636278996989e-02, 4.764416154578566e-03}; + +const LC3_FLOAT MDCT_WINDOW_240_2_5ms[120] = { + 3.890134207235998e-03, 8.202595078385781e-03, 1.370235555340779e-02, 2.052968531182845e-02, 2.880307728389693e-02, + 3.862785141889536e-02, 5.009569719921809e-02, 6.328296540190831e-02, 7.824881086160715e-02, 9.503346510857243e-02, + 1.136567491769230e-01, 1.341168883357315e-01, 1.563896708020576e-01, 1.804279808512455e-01, 2.061617274373514e-01, + 2.334981807379911e-01, 2.623227204239969e-01, 2.924999908279060e-01, 3.238754496100354e-01, 3.562772881250116e-01, + 3.895186936283779e-01, 4.234004158919065e-01, 4.577135938730904e-01, 4.922427919542673e-01, 5.267691900603833e-01, + 5.610738677940736e-01, 5.949411196851041e-01, 6.281617368097510e-01, 6.605361894447956e-01, 6.918776461105686e-01, + 7.220147663396499e-01, 7.507942077785026e-01, 7.780827927721814e-01, 8.037692853722609e-01, 8.277657367145603e-01, + 8.500083649018569e-01, 8.704579448595252e-01, 8.890996940634835e-01, 9.059426515086708e-01, 9.210185597011833e-01, + 9.343802726761132e-01, 9.460997268469628e-01, 9.562655255553633e-01, 9.649802020504638e-01, 9.723572386690237e-01, + 9.785179314351103e-01, 9.835881982445411e-01, 9.876954342642392e-01, 9.909655192099981e-01, 9.935200769821082e-01, + 9.954740782709803e-01, 9.969338611957889e-01, 9.979956243841658e-01, 9.987444223234112e-01, 9.992536660401901e-01, + 9.995851053006831e-01, 9.997892438014110e-01, 9.999061183192590e-01, 9.999663581511030e-01, 9.999924333992981e-01, + 9.999924333992981e-01, 9.999663581511030e-01, 9.999061183192590e-01, 9.997892438014110e-01, 9.995851053006831e-01, + 9.992536660401901e-01, 9.987444223234112e-01, 9.979956243841658e-01, 9.969338611957889e-01, 9.954740782709803e-01, + 9.935200769821082e-01, 9.909655192099981e-01, 9.876954342642392e-01, 9.835881982445411e-01, 9.785179314351103e-01, + 9.723572386690237e-01, 9.649802020504638e-01, 9.562655255553633e-01, 9.460997268469628e-01, 9.343802726761132e-01, + 9.210185597011833e-01, 9.059426515086708e-01, 8.890996940634835e-01, 8.704579448595252e-01, 8.500083649018569e-01, + 8.277657367145603e-01, 8.037692853722609e-01, 7.780827927721814e-01, 7.507942077785026e-01, 7.220147663396499e-01, + 6.918776461105686e-01, 6.605361894447956e-01, 6.281617368097510e-01, 5.949411196851041e-01, 5.610738677940736e-01, + 5.267691900603833e-01, 4.922427919542673e-01, 4.577135938730904e-01, 4.234004158919065e-01, 3.895186936283779e-01, + 3.562772881250116e-01, 3.238754496100354e-01, 2.924999908279060e-01, 2.623227204239969e-01, 2.334981807379911e-01, + 2.061617274373514e-01, 1.804279808512455e-01, 1.563896708020576e-01, 1.341168883357315e-01, 1.136567491769230e-01, + 9.503346510857243e-02, 7.824881086160715e-02, 6.328296540190831e-02, 5.009569719921809e-02, 3.862785141889536e-02, + 2.880307728389693e-02, 2.052968531182845e-02, 1.370235555340779e-02, 8.202595078385781e-03, 3.890134207235998e-03}; + +const LC3_FLOAT MDCT_WINDOW_320_2_5ms[160] = { + 3.368958353152859e-03, 6.455557414799749e-03, 1.014308076237845e-02, 1.452126850237346e-02, 1.965076732239952e-02, + 2.558352795411825e-02, 3.236628529621430e-02, 4.004117865352276e-02, 4.864564178753818e-02, 5.821207082124419e-02, + 6.876742903793599e-02, 8.033284980531531e-02, 9.292326595333501e-02, 1.065470811378728e-01, 1.212058930254449e-01, + 1.368942751980506e-01, 1.535996228917228e-01, 1.713020663983868e-01, 1.899744548998832e-01, 2.095824125414741e-01, + 2.300844676343023e-01, 2.514322549787097e-01, 2.735707904154788e-01, 2.964388158404272e-01, 3.199692120640840e-01, + 3.440894760693133e-01, 3.687222584236977e-01, 3.937859558486231e-01, 4.191953532416662e-01, 4.448623088011174e-01, + 4.706964753188311e-01, 4.966060501969578e-01, 5.224985463116437e-01, 5.482815754977786e-01, 5.738636361677886e-01, + 5.991548964078475e-01, 6.240679638193776e-01, 6.485186333941402e-01, 6.724266048285701e-01, 6.957161608975563e-01, + 7.183167988192716e-01, 7.401638069500036e-01, 7.611987796499656e-01, 7.813700637561797e-01, 8.006331307849442e-01, + 8.189508697622124e-01, 8.362937964433754e-01, 8.526401756322647e-01, 8.679760543400818e-01, 8.822952046352904e-01, + 8.955989762210201e-01, 9.078960600314304e-01, 9.192021654545784e-01, 9.295396151552272e-01, 9.389368628711653e-01, + 9.474279409702298e-01, 9.550518459555614e-01, 9.618518714601797e-01, 9.678748995383242e-01, 9.731706621931426e-01, + 9.777909860257944e-01, 9.817890335940264e-01, 9.852185554726640e-01, 9.881331670617683e-01, 9.905856638463937e-01, + 9.926273880444285e-01, 9.943076583739057e-01, 9.956732730391862e-01, 9.967680940129237e-01, 9.976327183405286e-01, + 9.983042396036903e-01, 9.988160999578843e-01, 9.991980304284215e-01, 9.994760745391177e-01, 9.996726879821318e-01, + 9.998069050289865e-01, 9.998945608218308e-01, 9.999485576331654e-01, 9.999791626721350e-01, 9.999943250437048e-01, + 9.999943250437048e-01, 9.999791626721350e-01, 9.999485576331654e-01, 9.998945608218308e-01, 9.998069050289865e-01, + 9.996726879821318e-01, 9.994760745391177e-01, 9.991980304284215e-01, 9.988160999578843e-01, 9.983042396036903e-01, + 9.976327183405286e-01, 9.967680940129237e-01, 9.956732730391862e-01, 9.943076583739057e-01, 9.926273880444285e-01, + 9.905856638463937e-01, 9.881331670617683e-01, 9.852185554726640e-01, 9.817890335940264e-01, 9.777909860257944e-01, + 9.731706621931426e-01, 9.678748995383242e-01, 9.618518714601797e-01, 9.550518459555614e-01, 9.474279409702298e-01, + 9.389368628711653e-01, 9.295396151552272e-01, 9.192021654545784e-01, 9.078960600314304e-01, 8.955989762210201e-01, + 8.822952046352904e-01, 8.679760543400818e-01, 8.526401756322647e-01, 8.362937964433754e-01, 8.189508697622124e-01, + 8.006331307849442e-01, 7.813700637561797e-01, 7.611987796499656e-01, 7.401638069500036e-01, 7.183167988192716e-01, + 6.957161608975563e-01, 6.724266048285701e-01, 6.485186333941402e-01, 6.240679638193776e-01, 5.991548964078475e-01, + 5.738636361677886e-01, 5.482815754977786e-01, 5.224985463116437e-01, 4.966060501969578e-01, 4.706964753188311e-01, + 4.448623088011174e-01, 4.191953532416662e-01, 3.937859558486231e-01, 3.687222584236977e-01, 3.440894760693133e-01, + 3.199692120640840e-01, 2.964388158404272e-01, 2.735707904154788e-01, 2.514322549787097e-01, 2.300844676343023e-01, + 2.095824125414741e-01, 1.899744548998832e-01, 1.713020663983868e-01, 1.535996228917228e-01, 1.368942751980506e-01, + 1.212058930254449e-01, 1.065470811378728e-01, 9.292326595333501e-02, 8.033284980531531e-02, 6.876742903793599e-02, + 5.821207082124419e-02, 4.864564178753818e-02, 4.004117865352276e-02, 3.236628529621430e-02, 2.558352795411825e-02, + 1.965076732239952e-02, 1.452126850237346e-02, 1.014308076237845e-02, 6.455557414799749e-03, 3.368958353152859e-03}; + +const LC3_FLOAT MDCT_WINDOW_480_2_5ms[240] = { + 2.750746382614873e-03, 4.775245154322467e-03, 6.991265476184880e-03, 9.470118155887091e-03, 1.224415763156159e-02, + 1.533559472880042e-02, 1.876266772162453e-02, 2.254154337372088e-02, 2.668701415521377e-02, 3.121277069249126e-02, + 3.613150075407039e-02, 4.145491000214293e-02, 4.719370517091751e-02, 5.335755875796826e-02, 5.995506493224793e-02, + 6.699369195627566e-02, 7.447973421347953e-02, 8.241826576309315e-02, 9.081309669365416e-02, 9.966673316465058e-02, + 1.089803417907089e-01, 1.187537188695662e-01, 1.289852648491186e-01, 1.396719643506733e-01, 1.508093720039881e-01, + 1.623916042982366e-01, 1.744113376077630e-01, 1.868598125100347e-01, 1.997268444741311e-01, 2.130008409605561e-01, + 2.266688249366323e-01, 2.407164647759538e-01, 2.551281104752023e-01, 2.698868360870567e-01, 2.849744882339612e-01, + 3.003717405342550e-01, 3.160581537396951e-01, 3.320122413518523e-01, 3.482115404543554e-01, 3.646326874686314e-01, + 3.812514985127824e-01, 3.980430540166849e-01, 4.149817872214252e-01, 4.320415761679195e-01, 4.491958387581356e-01, + 4.664176304528364e-01, 4.836797441523142e-01, 5.009548117912680e-01, 5.182154071658814e-01, 5.354341495003542e-01, + 5.525838072516958e-01, 5.696374016455559e-01, 5.865683094322820e-01, 6.033503643513004e-01, 6.199579567933325e-01, + 6.363661311538971e-01, 6.525506803780192e-01, 6.684882372050696e-01, 6.841563616341746e-01, 6.995336241446708e-01, + 7.145996842225878e-01, 7.293353637631239e-01, 7.437227149404935e-01, 7.577450821603423e-01, 7.713871577361272e-01, + 7.846350309593857e-01, 7.974762302646725e-01, 8.098997582230498e-01, 8.218961191333729e-01, 8.334573390181531e-01, + 8.445769778704795e-01, 8.552501340402698e-01, 8.654734406919574e-01, 8.752450543115063e-01, 8.845646352883213e-01, + 8.934333206470277e-01, 9.018536890551258e-01, 9.098297182849719e-01, 9.173667353621834e-01, 9.244713596871228e-01, + 9.311514394712620e-01, 9.374159818855259e-01, 9.432750773727245e-01, 9.487398186303003e-01, 9.538222148222497e-01, + 9.585351016294561e-01, 9.628920477950361e-01, 9.669072588647543e-01, 9.705954788611818e-01, 9.739718906630962e-01, + 9.770520158876372e-01, 9.798516150909821e-01, 9.823865891128170e-01, 9.846728823898172e-01, 9.867263890529354e-01, + 9.885628626019504e-01, 9.901978299180545e-01, 9.916465103310770e-01, 9.929237404023775e-01, 9.940439050178721e-01, + 9.950208753087979e-01, 9.958679538316859e-01, 9.965978273449145e-01, 9.972225274187749e-01, 9.977533990110320e-01, + 9.982010770325636e-01, 9.985754708200026e-01, 9.988857563266385e-01, 9.991403757414241e-01, 9.993470441509588e-01, + 9.995127627727911e-01, 9.996438382121301e-01, 9.997459071295719e-01, 9.998239656559388e-01, 9.998824028526124e-01, + 9.999250374922579e-01, 9.999551574256286e-01, 9.999755608048836e-01, 9.999885984518604e-01, 9.999962166900126e-01, + 9.999962166900126e-01, 9.999885984518604e-01, 9.999755608048836e-01, 9.999551574256286e-01, 9.999250374922579e-01, + 9.998824028526124e-01, 9.998239656559388e-01, 9.997459071295719e-01, 9.996438382121301e-01, 9.995127627727911e-01, + 9.993470441509588e-01, 9.991403757414241e-01, 9.988857563266385e-01, 9.985754708200026e-01, 9.982010770325636e-01, + 9.977533990110320e-01, 9.972225274187749e-01, 9.965978273449145e-01, 9.958679538316859e-01, 9.950208753087979e-01, + 9.940439050178721e-01, 9.929237404023775e-01, 9.916465103310770e-01, 9.901978299180545e-01, 9.885628626019504e-01, + 9.867263890529354e-01, 9.846728823898172e-01, 9.823865891128170e-01, 9.798516150909821e-01, 9.770520158876372e-01, + 9.739718906630962e-01, 9.705954788611818e-01, 9.669072588647543e-01, 9.628920477950361e-01, 9.585351016294561e-01, + 9.538222148222497e-01, 9.487398186303003e-01, 9.432750773727245e-01, 9.374159818855259e-01, 9.311514394712620e-01, + 9.244713596871228e-01, 9.173667353621834e-01, 9.098297182849719e-01, 9.018536890551258e-01, 8.934333206470277e-01, + 8.845646352883213e-01, 8.752450543115063e-01, 8.654734406919574e-01, 8.552501340402698e-01, 8.445769778704795e-01, + 8.334573390181531e-01, 8.218961191333729e-01, 8.098997582230498e-01, 7.974762302646725e-01, 7.846350309593857e-01, + 7.713871577361272e-01, 7.577450821603423e-01, 7.437227149404935e-01, 7.293353637631239e-01, 7.145996842225878e-01, + 6.995336241446708e-01, 6.841563616341746e-01, 6.684882372050696e-01, 6.525506803780192e-01, 6.363661311538971e-01, + 6.199579567933325e-01, 6.033503643513004e-01, 5.865683094322820e-01, 5.696374016455559e-01, 5.525838072516958e-01, + 5.354341495003542e-01, 5.182154071658814e-01, 5.009548117912680e-01, 4.836797441523142e-01, 4.664176304528364e-01, + 4.491958387581356e-01, 4.320415761679195e-01, 4.149817872214252e-01, 3.980430540166849e-01, 3.812514985127824e-01, + 3.646326874686314e-01, 3.482115404543554e-01, 3.320122413518523e-01, 3.160581537396951e-01, 3.003717405342550e-01, + 2.849744882339612e-01, 2.698868360870567e-01, 2.551281104752023e-01, 2.407164647759538e-01, 2.266688249366323e-01, + 2.130008409605561e-01, 1.997268444741311e-01, 1.868598125100347e-01, 1.744113376077630e-01, 1.623916042982366e-01, + 1.508093720039881e-01, 1.396719643506733e-01, 1.289852648491186e-01, 1.187537188695662e-01, 1.089803417907089e-01, + 9.966673316465058e-02, 9.081309669365416e-02, 8.241826576309315e-02, 7.447973421347953e-02, 6.699369195627566e-02, + 5.995506493224793e-02, 5.335755875796826e-02, 4.719370517091751e-02, 4.145491000214293e-02, 3.613150075407039e-02, + 3.121277069249126e-02, 2.668701415521377e-02, 2.254154337372088e-02, 1.876266772162453e-02, 1.533559472880042e-02, + 1.224415763156159e-02, 9.470118155887091e-03, 6.991265476184880e-03, 4.775245154322467e-03, 2.750746382614873e-03}; + +const LC3_FLOAT MDCT_WINDOW_80[160] = { + -7.078546706512391e-04, -2.098197727900724e-03, -4.525198076002370e-03, -8.233976327300612e-03, + -1.337713096257934e-02, -1.999721557401502e-02, -2.800909464274782e-02, -3.721502082245055e-02, + -4.731768261606175e-02, -5.794654834034055e-02, -6.867606753531441e-02, -7.904647440788692e-02, + -8.859705468085925e-02, -9.688303623049199e-02, -1.034961241263523e-01, -1.080766457616878e-01, + -1.103242262600913e-01, -1.099809851424550e-01, -1.068172142230882e-01, -1.006190418791648e-01, + -9.116452506492527e-02, -7.820617483254730e-02, -6.146688124166948e-02, -4.063362855701623e-02, + -1.536329520788766e-02, 1.470155068746303e-02, 4.989736509080558e-02, 9.050369257152079e-02, + 1.366911019414417e-01, 1.884686389218322e-01, 2.456456803467095e-01, 3.077789078889820e-01, + 3.741642373060188e-01, 4.438114799213576e-01, 5.154735456539700e-01, 5.876661722564289e-01, + 6.587619767809000e-01, 7.270576699841359e-01, 7.908752989295335e-01, 8.486643364959733e-01, + 8.991320235484349e-01, 9.413348145272842e-01, 9.747634827941575e-01, 9.994114730415857e-01, + 1.015760373791603e+00, 1.024736164069697e+00, 1.027634294456205e+00, 1.025991493983836e+00, + 1.021427210603284e+00, 1.015439859549357e+00, 1.009366925499550e+00, 1.003508162416449e+00, + 9.988898206257559e-01, 9.953133902427869e-01, 9.925943919208190e-01, 9.905771957917731e-01, + 9.891371616557014e-01, 9.881790747212391e-01, 9.876249269174586e-01, 9.874056275509585e-01, + 9.874524849192456e-01, 9.876951134084213e-01, 9.880640617030884e-01, 9.884926873551375e-01, + 9.889230031022089e-01, 9.893074965384659e-01, 9.896146331889107e-01, 9.898319269347060e-01, + 9.899693102025342e-01, 9.900603352632121e-01, 9.901575015155720e-01, 9.903255289051605e-01, + 9.906303787150326e-01, 9.911298894709990e-01, 9.918665491182922e-01, 9.928619727154252e-01, + 9.941156069136238e-01, 9.956033775539884e-01, 9.972793109558521e-01, 9.990784840729244e-01, + 1.000922365901945e+00, 1.002728111386909e+00, 1.004416038098237e+00, 1.005919224127911e+00, + 1.007189345025525e+00, 1.008200146369426e+00, 1.008949493525753e+00, 1.009458241425143e+00, + 1.009768980817384e+00, 1.009940336228694e+00, 1.010039453539107e+00, 1.010132323996401e+00, + 1.010272524848519e+00, 1.010494354532353e+00, 1.010808068774316e+00, 1.011201071127927e+00, + 1.011641272406023e+00, 1.012080125934687e+00, 1.012458183122033e+00, 1.012706955800289e+00, + 1.012755013843985e+00, 1.012530134411619e+00, 1.011962331100864e+00, 1.010982135506986e+00, + 1.009512438049510e+00, 1.007460860286395e+00, 1.004708677491086e+00, 1.001111413242302e+00, + 9.965041017623596e-01, 9.907199995730845e-01, 9.823765865983288e-01, 9.708821747608998e-01, + 9.546732976073705e-01, 9.321553861564006e-01, 9.018003682081348e-01, 8.623984077953557e-01, + 8.132817365236141e-01, 7.544551974836834e-01, 6.866580716267418e-01, 6.113488038789190e-01, + 5.306181649316597e-01, 4.471309850999502e-01, 3.639114681156236e-01, 2.841647033392408e-01, + 2.110209448747969e-01, 1.472287968327703e-01, 9.482665349502291e-02, 5.482436608328477e-02, + 2.701461405056264e-02, 9.996743588367519e-03, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_160[320] = { + -4.619898752628163e-04, -9.747166718929050e-04, -1.664473096973725e-03, -2.597106916737789e-03, + -3.806285163352241e-03, -5.324608721716763e-03, -7.175885277771099e-03, -9.382480860899108e-03, + -1.195270300743193e-02, -1.489528159506296e-02, -1.820666399965468e-02, -2.187570925786862e-02, + -2.588471937157619e-02, -3.020862738245264e-02, -3.481597793538342e-02, -3.967067992672979e-02, + -4.472698045914417e-02, -4.994225863256500e-02, -5.526334794593565e-02, -6.063717235243996e-02, + -6.600961519440657e-02, -7.131966266443390e-02, -7.651178225890490e-02, -8.152964005319532e-02, + -8.631137544905677e-02, -9.080411291245728e-02, -9.495377758870335e-02, -9.870736514214426e-02, + -1.020202684361974e-01, -1.048438825017798e-01, -1.071382314127799e-01, -1.088690135027248e-01, + -1.099969655786929e-01, -1.104898474883336e-01, -1.103225838568563e-01, -1.094621746650760e-01, + -1.078834293141886e-01, -1.055612509762041e-01, -1.024650162703341e-01, -9.857014566194629e-02, + -9.384684920715425e-02, -8.826309993000785e-02, -8.178792716809512e-02, -7.438785600211463e-02, + -6.602189797715241e-02, -5.665655641133161e-02, -4.624456893420224e-02, -3.474585776145929e-02, + -2.211581608120528e-02, -8.310425696208936e-03, 6.717697635290676e-03, 2.300642061077823e-02, + 4.060106462625085e-02, 5.953239090915557e-02, 7.983354189816511e-02, 1.015233140203748e-01, + 1.246171387327525e-01, 1.491152519299797e-01, 1.750067399059861e-01, 2.022699854906251e-01, + 2.308655379767671e-01, 2.607365124918583e-01, 2.918144694729168e-01, 3.240095704645023e-01, + 3.572175180786021e-01, 3.913146885756875e-01, 4.261571642320424e-01, 4.615925445090212e-01, + 4.974471592901086e-01, 5.335326819631583e-01, 5.696546730080154e-01, 6.056083823929643e-01, + 6.411830842823245e-01, 6.761653499550255e-01, 7.103400549562944e-01, 7.434943718765665e-01, + 7.754281892901473e-01, 8.059437233154637e-01, 8.348589373399948e-01, 8.620108336276733e-01, + 8.872599706865123e-01, 9.104863121445679e-01, 9.315962496426278e-01, 9.505220861927248e-01, + 9.672366712325431e-01, 9.817397501303696e-01, 9.940557180662704e-01, 1.004247514102417e+00, + 1.012407428282884e+00, 1.018650990561848e+00, 1.023118841384460e+00, 1.025972450969440e+00, + 1.027397523939210e+00, 1.027585830688143e+00, 1.026738673647482e+00, 1.025061777648234e+00, + 1.022756514615106e+00, 1.020009139549275e+00, 1.016996499560845e+00, 1.013915946100629e+00, + 1.011044869639164e+00, 1.007773858455400e+00, 1.004848753962734e+00, 1.002245009135684e+00, + 9.999393169239009e-01, 9.979055415627330e-01, 9.961203379971326e-01, 9.945597525471822e-01, + 9.932031606606762e-01, 9.920297273323891e-01, 9.910230654424902e-01, 9.901668953434221e-01, + 9.894488374513719e-01, 9.888556356037892e-01, 9.883778520531268e-01, 9.880051626345804e-01, + 9.877295459610343e-01, 9.875412739766566e-01, 9.874329809802893e-01, 9.873949921033299e-01, + 9.874197049003676e-01, 9.874973205882319e-01, 9.876201238703241e-01, 9.877781920433015e-01, + 9.879637979933339e-01, 9.881678007807095e-01, 9.883835200189653e-01, 9.886022219397892e-01, + 9.888182771263505e-01, 9.890247977602895e-01, 9.892178658748239e-01, 9.893923680007577e-01, + 9.895463342815009e-01, 9.896772011542693e-01, 9.897859195209235e-01, 9.898725363809847e-01, + 9.899410789223559e-01, 9.899945557067980e-01, 9.900394023736973e-01, 9.900814722948890e-01, + 9.901293790312005e-01, 9.901902265696609e-01, 9.902734448815004e-01, 9.903862280081246e-01, + 9.905379830873822e-01, 9.907348826312993e-01, 9.909842592301273e-01, 9.912905118607647e-01, + 9.916586940166509e-01, 9.920906151219310e-01, 9.925887208794144e-01, 9.931516528513824e-01, + 9.937790866568735e-01, 9.944668184371617e-01, 9.952116634297566e-01, 9.960068616185641e-01, + 9.968461329825753e-01, 9.977203369515556e-01, 9.986213520769593e-01, 9.995382582242990e-01, + 1.000461955079660e+00, 1.001380551217109e+00, 1.002284871786226e+00, 1.003163845364970e+00, + 1.004009147462043e+00, 1.004811375053364e+00, 1.005563968008037e+00, 1.006259855360867e+00, + 1.006895570408563e+00, 1.007466616298057e+00, 1.007972441990187e+00, 1.008411468616852e+00, + 1.008786009787269e+00, 1.009097763850333e+00, 1.009351762546296e+00, 1.009552401900961e+00, + 1.009707093778162e+00, 1.009822090220407e+00, 1.009906958448099e+00, 1.009969021400474e+00, + 1.010017890428877e+00, 1.010060809299530e+00, 1.010106564965965e+00, 1.010161131093372e+00, + 1.010231078494249e+00, 1.010319484524512e+00, 1.010430470494512e+00, 1.010564099281000e+00, + 1.010721360243234e+00, 1.010899655674578e+00, 1.011096993993037e+00, 1.011308167670753e+00, + 1.011529185153809e+00, 1.011753008569803e+00, 1.011973876511603e+00, 1.012182837094955e+00, + 1.012373028737774e+00, 1.012535058602453e+00, 1.012660975529858e+00, 1.012740575296603e+00, + 1.012765922449960e+00, 1.012726958954961e+00, 1.012615904116265e+00, 1.012422888521601e+00, + 1.012140460211194e+00, 1.011758810583150e+00, 1.011269960947744e+00, 1.010663676735228e+00, + 1.009930754807923e+00, 1.009058249873833e+00, 1.008034308295421e+00, 1.006843352506855e+00, + 1.005470005637052e+00, 1.003894772403371e+00, 1.002098854400575e+00, 1.000060686758758e+00, + 9.977600196406868e-01, 9.951746430061121e-01, 9.922861082472264e-01, 9.890757868707590e-01, + 9.847362453480265e-01, 9.798613526271561e-01, 9.741378617337759e-01, 9.673331975559332e-01, + 9.592539757044516e-01, 9.496984081652284e-01, 9.384634163826711e-01, 9.253567968750328e-01, + 9.101986790930605e-01, 8.928338316495705e-01, 8.731437835983047e-01, 8.510420440685049e-01, + 8.264839911291133e-01, 7.994681492797084e-01, 7.700431275216928e-01, 7.383028603058783e-01, + 7.043814340356083e-01, 6.684616478236647e-01, 6.307755329382612e-01, 5.915799587176216e-01, + 5.511703155400274e-01, 5.098915423728179e-01, 4.681017110047964e-01, 4.261772971493010e-01, + 3.845172335531009e-01, 3.435228672445613e-01, 3.036004651973099e-01, 2.651434678028531e-01, + 2.285283969438072e-01, 1.941021906320984e-01, 1.621735416384830e-01, 1.330015240938615e-01, + 1.067840430193724e-01, 8.365057236623041e-02, 6.365188111381356e-02, 4.676538412257621e-02, + 3.288072750732215e-02, 2.183057564646270e-02, 1.336381425803019e-02, 6.758124889697787e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_240[480] = { + -3.613496418928369e-04, -7.078546706512391e-04, -1.074443637110903e-03, -1.533478537964509e-03, + -2.098197727900724e-03, -2.778420871815740e-03, -3.584129920673041e-03, -4.525198076002370e-03, + -5.609327243712055e-03, -6.843234536105624e-03, -8.233976327300612e-03, -9.785314755557023e-03, + -1.149880303071551e-02, -1.337713096257934e-02, -1.542181679511618e-02, -1.762979910961727e-02, + -1.999721557401502e-02, -2.252080561390149e-02, -2.519406300389030e-02, -2.800909464274782e-02, + -3.095765092956728e-02, -3.402996266948349e-02, -3.721502082245055e-02, -4.050053247568393e-02, + -4.387219218706189e-02, -4.731768261606175e-02, -5.082325342672667e-02, -5.437166635159518e-02, + -5.794654834034055e-02, -6.153426201732499e-02, -6.511708163113709e-02, -6.867606753531441e-02, + -7.219447805250771e-02, -7.565695975592170e-02, -7.904647440788692e-02, -8.234442557322251e-02, + -8.553324579905185e-02, -8.859705468085925e-02, -9.152091100798199e-02, -9.428847446755965e-02, + -9.688303623049198e-02, -9.929123258537813e-02, -1.015008467688577e-01, -1.034961241263523e-01, + -1.052637003544443e-01, -1.067939984687745e-01, -1.080766457616878e-01, -1.090997300590506e-01, + -1.098524491515805e-01, -1.103242262600913e-01, -1.105084619148789e-01, -1.103977408741932e-01, + -1.099809851424550e-01, -1.092492774392824e-01, -1.081974227416502e-01, -1.068172142230882e-01, + -1.050995803285455e-01, -1.030360111111103e-01, -1.006190418791648e-01, -9.784120023411771e-02, + -9.469304216883027e-02, -9.116452506492527e-02, -8.724644532866996e-02, -8.293043914044632e-02, + -7.820617483254730e-02, -7.306142427456862e-02, -6.748468182105991e-02, -6.146688124166948e-02, + -5.499497258200362e-02, -4.805444424454820e-02, -4.063362855701623e-02, -3.272045590229335e-02, + -2.430122582451853e-02, -1.536329520788766e-02, -5.891434269890659e-03, 4.126595858583295e-03, + 1.470155068746303e-02, 2.584738191459814e-02, 3.757652772246801e-02, 4.989736509080558e-02, + 6.282034030592902e-02, 7.635397728566121e-02, 9.050369257152079e-02, 1.052747118478660e-01, + 1.206703467513333e-01, 1.366911019414417e-01, 1.533343890681390e-01, 1.705954709184399e-01, + 1.884686389218322e-01, 2.069449962574092e-01, 2.260093000067393e-01, 2.456456803467095e-01, + 2.658346019332584e-01, 2.865543814049772e-01, 3.077789078889820e-01, 3.294769437072290e-01, + 3.516171481750350e-01, 3.741642373060188e-01, 3.970739591211551e-01, 4.203043046885219e-01, + 4.438114799213576e-01, 4.675442291623012e-01, 4.914498631045615e-01, 5.154735456539700e-01, + 5.395557644293222e-01, 5.636399817032525e-01, 5.876661722564289e-01, 6.115695310143157e-01, + 6.352890592874099e-01, 6.587619767809000e-01, 6.819230974423550e-01, 7.047092819314779e-01, + 7.270576699841359e-01, 7.489068963384272e-01, 7.701990187606995e-01, 7.908752989295335e-01, + 8.108788692151807e-01, 8.301579139160681e-01, 8.486643364959733e-01, 8.663548164329093e-01, + 8.831896853053627e-01, 8.991320235484349e-01, 9.141540563656075e-01, 9.282282546151819e-01, + 9.413348145272842e-01, 9.534619388400459e-01, 9.646048250501910e-01, 9.747634827941575e-01, + 9.839435385219192e-01, 9.921529097154242e-01, 9.994114730415857e-01, 1.005746084650236e+00, + 1.011183971347815e+00, 1.015760373791603e+00, 1.019515072412387e+00, 1.022490937034641e+00, + 1.024736164069697e+00, 1.026304095700693e+00, 1.027250978292214e+00, 1.027634294456205e+00, + 1.027511063644843e+00, 1.026942795115598e+00, 1.025991493983836e+00, 1.024716149969084e+00, + 1.023175976163407e+00, 1.021427210603284e+00, 1.019521566634239e+00, 1.017510118327508e+00, + 1.015439859549357e+00, 1.013460916839174e+00, 1.011654901040475e+00, 1.009366925499550e+00, + 1.007263182132894e+00, 1.005313192386866e+00, 1.003508162416449e+00, 1.001840787319378e+00, + 1.000303927234380e+00, 9.988898206257559e-01, 9.975915283480670e-01, 9.964015284765968e-01, + 9.953133902427869e-01, 9.943201078053212e-01, 9.934158959186011e-01, 9.925943919208190e-01, + 9.918510277326026e-01, 9.911797988363887e-01, 9.905771957917731e-01, 9.900381047643838e-01, + 9.895594394179152e-01, 9.891371616557014e-01, 9.887684373604154e-01, 9.884497924570929e-01, + 9.881790747212391e-01, 9.879528358230726e-01, 9.877691368590689e-01, 9.876249269174586e-01, + 9.875179947346887e-01, 9.874458127312921e-01, 9.874056275509585e-01, 9.873951115886979e-01, + 9.874115368168944e-01, 9.874524849192456e-01, 9.875149888347144e-01, 9.875968894760857e-01, + 9.876951134084213e-01, 9.878075819424549e-01, 9.879311998177238e-01, 9.880640617030884e-01, + 9.882032571565917e-01, 9.883471084085503e-01, 9.884926873551375e-01, 9.886386592120545e-01, + 9.887825578295630e-01, 9.889230031022089e-01, 9.890581715933395e-01, 9.891867674284610e-01, + 9.893074965384659e-01, 9.894196399062921e-01, 9.895220757174378e-01, 9.896146331889107e-01, + 9.896970346678272e-01, 9.897692596535289e-01, 9.898319269347060e-01, 9.898852572653667e-01, + 9.899307640365727e-01, 9.899693102025343e-01, 9.900025692522435e-01, 9.900321562263099e-01, + 9.900603352632121e-01, 9.900889812894406e-01, 9.901206586012907e-01, 9.901575015155720e-01, + 9.902023946214220e-01, 9.902575406142213e-01, 9.903255289051605e-01, 9.904087914462694e-01, + 9.905096491583045e-01, 9.906303787150326e-01, 9.907727108894024e-01, 9.909387444078919e-01, + 9.911298894709990e-01, 9.913476318763218e-01, 9.915928560402563e-01, 9.918665491182922e-01, + 9.921691315380984e-01, 9.925010851461232e-01, 9.928619727154252e-01, 9.932519181564613e-01, + 9.936700207375173e-01, 9.941156069136238e-01, 9.945873147903244e-01, 9.950837402063278e-01, + 9.956033775539884e-01, 9.961439922621166e-01, 9.967034533921340e-01, 9.972793109558521e-01, + 9.978690858367024e-01, 9.984697087896268e-01, 9.990784840729244e-01, 9.996919011206490e-01, + 1.000308193833526e+00, 1.000922365901945e+00, 1.001532636590676e+00, 1.002135464655177e+00, + 1.002728111386909e+00, 1.003307449770187e+00, 1.003870934089686e+00, 1.004416038098237e+00, + 1.004940548815171e+00, 1.005442141810160e+00, 1.005919224127911e+00, 1.006370303149314e+00, + 1.006793927824538e+00, 1.007189345025525e+00, 1.007555573455895e+00, 1.007892674961336e+00, + 1.008200146369426e+00, 1.008478423284851e+00, 1.008727884997619e+00, 1.008949493525753e+00, + 1.009144112734761e+00, 1.009313224929575e+00, 1.009458241425143e+00, 1.009581280555682e+00, + 1.009684090687164e+00, 1.009768980817384e+00, 1.009838308708799e+00, 1.009894548257807e+00, + 1.009940336228694e+00, 1.009977916643680e+00, 1.010010230290263e+00, 1.010039453539107e+00, + 1.010068202038694e+00, 1.010098388689342e+00, 1.010132323996401e+00, 1.010171656775640e+00, + 1.010218096148412e+00, 1.010272524848519e+00, 1.010336490294771e+00, 1.010410221483215e+00, + 1.010494354532353e+00, 1.010588873699422e+00, 1.010693501186928e+00, 1.010808068774316e+00, + 1.010931436739342e+00, 1.011062876503041e+00, 1.011201071127927e+00, 1.011344700694417e+00, + 1.011491904228184e+00, 1.011641272406023e+00, 1.011790282474963e+00, 1.011937567254485e+00, + 1.012080125934687e+00, 1.012216235487353e+00, 1.012342907951334e+00, 1.012458183122033e+00, + 1.012558879696851e+00, 1.012642857380847e+00, 1.012706955800289e+00, 1.012748952907404e+00, + 1.012765799894453e+00, 1.012755013843985e+00, 1.012713798678211e+00, 1.012639775003457e+00, + 1.012530134411619e+00, 1.012382309473470e+00, 1.012194068117524e+00, 1.011962331100864e+00, + 1.011685173724601e+00, 1.011359143572147e+00, 1.010982135506986e+00, 1.010550715971368e+00, + 1.010062133151922e+00, 1.009512438049510e+00, 1.008898689394160e+00, 1.008215923600973e+00, + 1.007460860286395e+00, 1.006627741823389e+00, 1.005712337656749e+00, 1.004708677491086e+00, + 1.003611467285588e+00, 1.002414286392268e+00, 1.001111413242302e+00, 9.996961651093181e-01, + 9.981625949525345e-01, 9.965041017623596e-01, 9.947148884277037e-01, 9.927891912841345e-01, + 9.907199995730845e-01, 9.884793707533194e-01, 9.855347660016696e-01, 9.823765865983286e-01, + 9.789747333404933e-01, 9.751623811486372e-01, 9.708821747608998e-01, 9.660805524695870e-01, + 9.606976399184645e-01, 9.546732976073706e-01, 9.479479345282376e-01, 9.404609052933396e-01, + 9.321553861564006e-01, 9.229775478442888e-01, 9.128745354570823e-01, 9.018003682081348e-01, + 8.897163275605041e-01, 8.765908974996186e-01, 8.623984077953557e-01, 8.471200801854385e-01, + 8.307479727020245e-01, 8.132817365236141e-01, 7.947291447585267e-01, 7.751108841891807e-01, + 7.544551974836834e-01, 7.327963552921717e-01, 7.101790843209148e-01, 6.866580716267418e-01, + 6.622962432368731e-01, 6.371684119604742e-01, 6.113488038789190e-01, 5.849206604934815e-01, + 5.579747428663487e-01, 5.306181649316717e-01, 5.029523957059122e-01, 4.750868825511614e-01, + 4.471309850999535e-01, 4.192049917945288e-01, 3.914252910998820e-01, 3.639114681156252e-01, + 3.367837772954476e-01, 3.101627843160973e-01, 2.841647033392418e-01, 2.589033711808454e-01, + 2.344880603710975e-01, 2.110209448747974e-01, 1.885997642296488e-01, 1.673100807904834e-01, + 1.472287968327706e-01, 1.284223074167396e-01, 1.109422548710344e-01, 9.482665349502306e-02, + 8.009914366829558e-02, 6.676765847398403e-02, 5.482436608328485e-02, 4.424588851571281e-02, + 3.499361000717621e-02, 2.701461405056267e-02, 2.024370180670145e-02, 1.460796755137538e-02, + 9.996743588367531e-03, 5.305235098871444e-03, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_320[640] = { + -3.021153494057143e-04, -5.867737487939294e-04, -8.366504004139796e-04, -1.126635355725494e-03, + -1.470492941694331e-03, -1.873473391018495e-03, -2.339292362082021e-03, -2.872008069419264e-03, + -3.476256385086407e-03, -4.155963816705528e-03, -4.914563787665504e-03, -5.755172503953251e-03, + -6.680623380533122e-03, -7.693816924650567e-03, -8.796760749750191e-03, -9.990503073705982e-03, + -1.127574117138621e-02, -1.265334152129685e-02, -1.412438986522702e-02, -1.568889620430290e-02, + -1.734512089366117e-02, -1.909097368362797e-02, -2.092546711168754e-02, -2.284684792818856e-02, + -2.485207716234951e-02, -2.693746704328349e-02, -2.909952486193999e-02, -3.133504629493832e-02, + -3.363960728361352e-02, -3.600820974457969e-02, -3.843601741746971e-02, -4.091746034850161e-02, + -4.344654894948344e-02, -4.601786724624048e-02, -4.862598509282497e-02, -5.126474204655663e-02, + -5.392644753556616e-02, -5.660384311081047e-02, -5.929116747072080e-02, -6.198268202511926e-02, + -6.467025548071184e-02, -6.734542216184526e-02, -7.000099017198280e-02, -7.263057011354321e-02, + -7.522784961377151e-02, -7.778525942347714e-02, -8.029480247839878e-02, -8.274924535373614e-02, + -8.514125464087215e-02, -8.746379123238275e-02, -8.971069341834263e-02, -9.187564084638347e-02, + -9.395176975347193e-02, -9.593137735886889e-02, -9.780843257659243e-02, -9.957851303827886e-02, + -1.012361165314596e-01, -1.027741036495644e-01, -1.041861222641119e-01, -1.054680247057000e-01, + -1.066160875985523e-01, -1.076255384835563e-01, -1.084912299471198e-01, -1.092087422379003e-01, + -1.097736146613313e-01, -1.101808861640070e-01, -1.104271876052675e-01, -1.105108362290460e-01, + -1.104281465492726e-01, -1.101739218186236e-01, -1.097437360338336e-01, -1.091353125572511e-01, + -1.083467335729228e-01, -1.073739938306107e-01, -1.062130155324388e-01, -1.048606145834788e-01, + -1.033132401525343e-01, -1.015673163469357e-01, -9.962005506126154e-02, -9.746803229469267e-02, + -9.510723623306666e-02, -9.253303383231506e-02, -8.974125216128212e-02, -8.672877689119252e-02, + -8.349213839083708e-02, -8.002639902061687e-02, -7.632679536516856e-02, -7.238806162166744e-02, + -6.820576796149519e-02, -6.377611429172260e-02, -5.909386001558149e-02, -5.415316322402774e-02, + -4.894812724598650e-02, -4.347347112195197e-02, -3.772461300253332e-02, -3.169587609244436e-02, + -2.538179830690266e-02, -1.877689096555516e-02, -1.187461378850388e-02, -4.669099247423082e-03, + 2.844096748870385e-03, 1.066976124794342e-02, 1.881355950582949e-02, 2.728156010437695e-02, + 3.607810469851272e-02, 4.520702759803914e-02, 5.467238802204326e-02, 6.447866054615346e-02, + 7.462862199422061e-02, 8.512490568723846e-02, 9.596983987496970e-02, 1.071650779014335e-01, + 1.187115850305241e-01, 1.306101067250375e-01, 1.428596447589721e-01, 1.554584725339102e-01, + 1.684041609371527e-01, 1.816947894623263e-01, 1.953273880886783e-01, 2.092963206850239e-01, + 2.235945635254679e-01, 2.382160219461597e-01, 2.531529721334063e-01, 2.683961570569586e-01, + 2.839361392493072e-01, 2.997624255177811e-01, 3.158619077906196e-01, 3.322210551086769e-01, + 3.488264676990591e-01, 3.656640377499646e-01, 3.827152968157059e-01, 3.999611859760947e-01, + 4.173843265025887e-01, 4.349669624916473e-01, 4.526876397402144e-01, 4.705242008503956e-01, + 4.884539254831315e-01, 5.064545550235134e-01, 5.245006748662190e-01, 5.425674372882107e-01, + 5.606312044701524e-01, 5.786672646386708e-01, 5.966477035050948e-01, 6.145458904162185e-01, + 6.323361944662236e-01, 6.499926319211774e-01, 6.674874032292857e-01, 6.847932667399612e-01, + 7.018835463513400e-01, 7.187322544823347e-01, 7.353128213893310e-01, 7.516001985652684e-01, + 7.675699252273948e-01, 7.831974571624924e-01, 7.984583859818390e-01, 8.133295347030278e-01, + 8.277892271515950e-01, 8.418178561101360e-01, 8.553961300139363e-01, 8.685068980898102e-01, + 8.811334436653052e-01, 8.932596784799233e-01, 9.048748835980528e-01, 9.159657608120536e-01, + 9.265215299450000e-01, 9.365339988633418e-01, 9.459977028429117e-01, 9.549088408436811e-01, + 9.632658122557368e-01, 9.710688896122810e-01, 9.783204156360773e-01, 9.850226760127131e-01, + 9.911792082081333e-01, 9.967989944502682e-01, 1.001894024615659e+00, 1.006474342231823e+00, + 1.010552057109195e+00, 1.014142538208007e+00, 1.017262593268930e+00, 1.019928842669923e+00, + 1.022159867011177e+00, 1.023976320927187e+00, 1.025400734608122e+00, 1.026455340400072e+00, + 1.027164510654160e+00, 1.027552729180790e+00, 1.027644462380432e+00, 1.027463246660797e+00, + 1.027035903410657e+00, 1.026389068000259e+00, 1.025548201799728e+00, 1.024537134749709e+00, + 1.023380803775376e+00, 1.022103695693341e+00, 1.020728359657958e+00, 1.019275334687329e+00, + 1.017765178792830e+00, 1.016217355867531e+00, 1.014665311686846e+00, 1.013249071090664e+00, + 1.011948006992127e+00, 1.010189090179223e+00, 1.008557961167850e+00, 1.007011287608451e+00, + 1.005548764575910e+00, 1.004168417268956e+00, 1.002867268893035e+00, 1.001641769115897e+00, + 1.000489068954641e+00, 9.994060799749374e-01, 9.983898865406841e-01, 9.974370849972721e-01, + 9.965444836911705e-01, 9.957098545943852e-01, 9.949302413030897e-01, 9.942024045863540e-01, + 9.935241604969254e-01, 9.928930430130044e-01, 9.923068103443909e-01, 9.917633778190438e-01, + 9.912597642374404e-01, 9.907954498484041e-01, 9.903677893656558e-01, 9.899751611066148e-01, + 9.896160337369861e-01, 9.892890160408989e-01, 9.889928511129679e-01, 9.887260333430423e-01, + 9.884868721088945e-01, 9.882751039537586e-01, 9.880892168751595e-01, 9.879277114724612e-01, + 9.877898261218510e-01, 9.876743442038471e-01, 9.875807496078497e-01, 9.875072021876561e-01, + 9.874529447589979e-01, 9.874169741527905e-01, 9.873984685207834e-01, 9.873958301311858e-01, + 9.874080027710336e-01, 9.874343401290739e-01, 9.874736235387018e-01, 9.875243137719285e-01, + 9.875856201221135e-01, 9.876563785063032e-01, 9.877358921155149e-01, 9.878225576787804e-01, + 9.879150968481590e-01, 9.880132731565830e-01, 9.881156946084619e-01, 9.882211314188272e-01, + 9.883289032519310e-01, 9.884378310018685e-01, 9.885476787868710e-01, 9.886568414746639e-01, + 9.887645868459630e-01, 9.888708540445242e-01, 9.889744320992592e-01, 9.890747269455915e-01, + 9.891710038703801e-01, 9.892631024032380e-01, 9.893507219573624e-01, 9.894330645494204e-01, + 9.895096919388534e-01, 9.895810813422480e-01, 9.896467469067676e-01, 9.897067365020641e-01, + 9.897606930400666e-01, 9.898094478563998e-01, 9.898530133261707e-01, 9.898914705684924e-01, + 9.899254194103574e-01, 9.899554202030650e-01, 9.899824494486951e-01, 9.900065116928948e-01, + 9.900284805353695e-01, 9.900497484789281e-01, 9.900709561632662e-01, 9.900928358611601e-01, + 9.901163920607219e-01, 9.901427479709606e-01, 9.901734275350572e-01, 9.902087332329851e-01, + 9.902498637985275e-01, 9.902983686695558e-01, 9.903548501470234e-01, 9.904205084933333e-01, + 9.904959297726740e-01, 9.905825150202904e-01, 9.906812569810133e-01, 9.907922087340426e-01, + 9.909165464981378e-01, 9.910550740962871e-01, 9.912084614290896e-01, 9.913768610980639e-01, + 9.915605826937839e-01, 9.917604214872976e-01, 9.919767175562684e-01, 9.922091101818779e-01, + 9.924579135466506e-01, 9.927231225056266e-01, 9.930049538427406e-01, 9.933027281437943e-01, + 9.936161084869942e-01, 9.939453714404443e-01, 9.942895145656371e-01, 9.946481676207727e-01, + 9.950203031067961e-01, 9.954058173659507e-01, 9.958038713694317e-01, 9.962130271017117e-01, + 9.966324689957675e-01, 9.970615306490058e-01, 9.974990583293081e-01, 9.979437430375855e-01, + 9.983940572002874e-01, 9.988493116887893e-01, 9.993083430214909e-01, 9.997689221333534e-01, + 1.000231131275969e+00, 1.000692135698996e+00, 1.001152013920163e+00, 1.001608526000461e+00, + 1.002060493867275e+00, 1.002507212061815e+00, 1.002947129400411e+00, 1.003378909587027e+00, + 1.003801368578070e+00, 1.004213810320699e+00, 1.004615386562846e+00, 1.005004618375781e+00, + 1.005380628601598e+00, 1.005743282364652e+00, 1.006091510392348e+00, 1.006424907424988e+00, + 1.006742427727669e+00, 1.007044321511378e+00, 1.007330218597112e+00, 1.007599401798709e+00, + 1.007852064386603e+00, 1.008088176165563e+00, 1.008308033204578e+00, 1.008511247273756e+00, + 1.008698144207627e+00, 1.008869515256392e+00, 1.009025659761512e+00, 1.009166718967367e+00, + 1.009293362609020e+00, 1.009406398832440e+00, 1.009507017171120e+00, 1.009595264293017e+00, + 1.009672145744679e+00, 1.009739084785160e+00, 1.009796675060142e+00, 1.009846137382005e+00, + 1.009888083631667e+00, 1.009924092276850e+00, 1.009955384765721e+00, 1.009982268770147e+00, + 1.010006298177305e+00, 1.010028618428735e+00, 1.010050254076988e+00, 1.010071952131355e+00, + 1.010094366238073e+00, 1.010118917317053e+00, 1.010146497096682e+00, 1.010177110711677e+00, + 1.010211755260102e+00, 1.010251003469427e+00, 1.010295468653759e+00, 1.010345234996637e+00, + 1.010400316698172e+00, 1.010461564316351e+00, 1.010528615445659e+00, 1.010601521285347e+00, + 1.010679788081867e+00, 1.010763905869062e+00, 1.010853429760676e+00, 1.010947547074519e+00, + 1.011045953108263e+00, 1.011148486293359e+00, 1.011254397791134e+00, 1.011363082075863e+00, + 1.011473302008831e+00, 1.011584996312149e+00, 1.011697416504599e+00, 1.011808919793469e+00, + 1.011919264025716e+00, 1.012027240794153e+00, 1.012132151631041e+00, 1.012232734564333e+00, + 1.012327560477901e+00, 1.012416383754384e+00, 1.012497890726292e+00, 1.012570434021054e+00, + 1.012633295255708e+00, 1.012685277016726e+00, 1.012725564992284e+00, 1.012752577651415e+00, + 1.012765062889864e+00, 1.012762356719162e+00, 1.012743376077777e+00, 1.012706484200181e+00, + 1.012650842226435e+00, 1.012575427778520e+00, 1.012479473490919e+00, 1.012361105121003e+00, + 1.012219809594718e+00, 1.012054359992419e+00, 1.011864000215460e+00, 1.011647223869087e+00, + 1.011402518267713e+00, 1.011129654652857e+00, 1.010826951260377e+00, 1.010492924436361e+00, + 1.010126353960416e+00, 1.009725892479312e+00, 1.009290060983833e+00, 1.008817301052548e+00, + 1.008305027555130e+00, 1.007752833675443e+00, 1.007157827358150e+00, 1.006518049344503e+00, + 1.005831403532018e+00, 1.005095592119373e+00, 1.004308630055050e+00, 1.003467498305776e+00, + 1.002569500413888e+00, 1.001612710105563e+00, 1.000594272975683e+00, 9.995111701168786e-01, + 9.983609218719522e-01, 9.971409288327860e-01, 9.958488863050556e-01, 9.944818543153893e-01, + 9.930375282832211e-01, 9.915146560759479e-01, 9.899136802423638e-01, 9.881930623810997e-01, + 9.859422591203311e-01, 9.835667898378924e-01, 9.811423034808365e-01, 9.785214441250228e-01, + 9.756636036109838e-01, 9.725453442532574e-01, 9.691456634185092e-01, 9.654406178310209e-01, + 9.614043615076308e-01, 9.570113065179300e-01, 9.522367669696690e-01, 9.470548839544214e-01, + 9.414403740008491e-01, 9.353691612846549e-01, 9.288190093977164e-01, 9.217662887169115e-01, + 9.141896283466009e-01, 9.060694681113471e-01, 8.973891675497357e-01, 8.881332000806269e-01, + 8.782893885841422e-01, 8.678469565343039e-01, 8.567970644671067e-01, 8.451334654019180e-01, + 8.328542805780399e-01, 8.199594783897041e-01, 8.064511006873497e-01, 7.923346478686025e-01, + 7.776204488292163e-01, 7.623206183595970e-01, 7.464486491227057e-01, 7.300205729992958e-01, + 7.130567383226717e-01, 6.955805444755916e-01, 6.776173229836567e-01, 6.591955305148172e-01, + 6.403486426892321e-01, 6.211072197441818e-01, 6.015049275244730e-01, 5.815787608870452e-01, + 5.613674511156324e-01, 5.409188627354076e-01, 5.202736834971303e-01, 4.994780733459294e-01, + 4.785774177949064e-01, 4.576172599874928e-01, 4.366490208265804e-01, 4.157221460415995e-01, + 3.948856590950757e-01, 3.741903189229770e-01, 3.536868899553974e-01, 3.334260017756462e-01, + 3.134586473252229e-01, 2.938337904395871e-01, 2.745992637590817e-01, 2.558030636168172e-01, + 2.374902188466697e-01, 2.197036032185785e-01, 2.024855415115456e-01, 1.858749915117319e-01, + 1.699067802117410e-01, 1.546132267478873e-01, 1.400238206749695e-01, 1.261637395672913e-01, + 1.130534434072719e-01, 1.007084973747940e-01, 8.914024389873081e-02, 7.835612100141792e-02, + 6.835821233920988e-02, 5.914211536028976e-02, 5.069893012340832e-02, 4.301717763585550e-02, + 3.608020726673359e-02, 2.986316337017630e-02, 2.433722657129812e-02, 1.947675241971700e-02, + 1.525710171255895e-02, 1.163787492636240e-02, 8.433087782643718e-03, 4.449668997344735e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_480[960] = { + -2.353032150516754e-04, -4.619898752628163e-04, -6.262931535610879e-04, -7.929180432976445e-04, + -9.747166718929050e-04, -1.180256894474562e-03, -1.409209039594871e-03, -1.664473096973725e-03, + -1.946591608170231e-03, -2.257081732588478e-03, -2.597106916737789e-03, -2.967607624839524e-03, + -3.370454877988472e-03, -3.806285163352241e-03, -4.276873767639064e-03, -4.782469904501813e-03, + -5.324608721716763e-03, -5.903403814095400e-03, -6.520419726599805e-03, -7.175885277771099e-03, + -7.871422820642307e-03, -8.606586039759667e-03, -9.382480860899108e-03, -1.019827182163307e-02, + -1.105520547739066e-02, -1.195270300743193e-02, -1.289205910303846e-02, -1.387263484323160e-02, + -1.489528159506296e-02, -1.595856621933800e-02, -1.706288556735433e-02, -1.820666399965468e-02, + -1.939065975232718e-02, -2.061355417582714e-02, -2.187570925786862e-02, -2.317526315266411e-02, + -2.451227449041489e-02, -2.588471937157619e-02, -2.729263737090799e-02, -2.873390902713615e-02, + -3.020862738245264e-02, -3.171440372994384e-02, -3.325098858986303e-02, -3.481597793538342e-02, + -3.640892406933019e-02, -3.802742318209150e-02, -3.967067992672979e-02, -4.133575417353826e-02, + -4.302203371734278e-02, -4.472698045914417e-02, -4.645022292934329e-02, -4.818891490266687e-02, + -4.994225863256500e-02, -5.170690802826666e-02, -5.348162036097223e-02, -5.526334794593565e-02, + -5.705123152423822e-02, -5.884271749745559e-02, -6.063717235243996e-02, -6.243104027829089e-02, + -6.422303545004304e-02, -6.600961519440657e-02, -6.778962269634495e-02, -6.955996868581379e-02, + -7.131966266443390e-02, -7.306581273272733e-02, -7.479758913001458e-02, -7.651178225890490e-02, + -7.820711420768856e-02, -7.988010693411644e-02, -8.152964005319532e-02, -8.315237353264004e-02, + -8.474728946770714e-02, -8.631137544905677e-02, -8.784374452959058e-02, -8.934164364321417e-02, + -9.080411291245728e-02, -9.222795761428432e-02, -9.361232867223340e-02, -9.495377758870335e-02, + -9.625155313139856e-02, -9.750284620437569e-02, -9.870736514214426e-02, -9.986271288271026e-02, + -1.009680221406219e-01, -1.020202684361974e-01, -1.030183804850491e-01, -1.039596356759290e-01, + -1.048438825017798e-01, -1.056686838192766e-01, -1.064342821660323e-01, -1.071382314127799e-01, + -1.077799961121537e-01, -1.083570625865931e-01, -1.088690135027248e-01, -1.093135588677235e-01, + -1.096903559498340e-01, -1.099969655786929e-01, -1.102332261219973e-01, -1.103972812085189e-01, + -1.104898474883336e-01, -1.105086416532167e-01, -1.104537426996073e-01, -1.103225838568563e-01, + -1.101145827722143e-01, -1.098276928170364e-01, -1.094621746650760e-01, -1.090163960055733e-01, + -1.084908852561722e-01, -1.078834293141886e-01, -1.071937180231978e-01, -1.064196358069465e-01, + -1.055612509762041e-01, -1.046162812518618e-01, -1.035849043557610e-01, -1.024650162703341e-01, + -1.012568997532046e-01, -9.995864571932928e-02, -9.857014566194627e-02, -9.708911135857967e-02, + -9.551545820689084e-02, -9.384684920715425e-02, -9.208300062891550e-02, -9.022171021406450e-02, + -8.826309993000785e-02, -8.620493821803937e-02, -8.404742152815330e-02, -8.178792716809512e-02, + -7.942625026703617e-02, -7.695980775819990e-02, -7.438785600211463e-02, -7.170797002873608e-02, + -6.891994783815969e-02, -6.602189797715241e-02, -6.301349420724424e-02, -5.989191912667712e-02, + -5.665655641133161e-02, -5.330406164482222e-02, -4.983427241976235e-02, -4.624456893420224e-02, + -4.253455686336916e-02, -3.870195772538443e-02, -3.474585776145929e-02, -3.066341518682682e-02, + -2.645425077642105e-02, -2.211581608120528e-02, -1.764740541599136e-02, -1.304581363895818e-02, + -8.310425696208936e-03, -3.438268661133170e-03, 1.570315476576933e-03, 6.717697635290676e-03, + 1.200477020244778e-02, 1.743398319747869e-02, 2.300642061077823e-02, 2.872481423270595e-02, + 3.458896350634671e-02, 4.060106462625085e-02, 4.676102915752826e-02, 5.307133911821893e-02, + 5.953239090915557e-02, 6.614647812869151e-02, 7.291293184312803e-02, 7.983354189816511e-02, + 8.690807412770696e-02, 9.413813765275064e-02, 1.015233140203748e-01, 1.090651518336202e-01, + 1.167626546016197e-01, 1.246171387327525e-01, 1.326272948938113e-01, 1.407938190608664e-01, + 1.491152519299797e-01, 1.575921408388593e-01, 1.662224799248571e-01, 1.750067399059861e-01, + 1.839431938620024e-01, 1.930318183054904e-01, 2.022699854906251e-01, 2.116567430906184e-01, + 2.211888523410642e-01, 2.308655379767671e-01, 2.406837992341654e-01, 2.506420640291662e-01, + 2.607365124918583e-01, 2.709659073501196e-01, 2.813259021832532e-01, 2.918144694729168e-01, + 3.024270279840051e-01, 3.131603499997996e-01, 3.240095704645023e-01, 3.349719592361666e-01, + 3.460422935204829e-01, 3.572175180786021e-01, 3.684915649120530e-01, 3.798595119591716e-01, + 3.913146885756875e-01, 4.028532873867052e-01, 4.144688328137527e-01, 4.261571642320424e-01, + 4.379113897565727e-01, 4.497256320417501e-01, 4.615925445090212e-01, 4.735067030065239e-01, + 4.854600184866710e-01, 4.974471592901086e-01, 5.094597228333853e-01, 5.214909841729947e-01, + 5.335326819631583e-01, 5.455789811615239e-01, 5.576217157959890e-01, 5.696546730080154e-01, + 5.816685576268035e-01, 5.936560624526468e-01, 6.056083823929643e-01, 6.175192060085208e-01, + 6.293796611336280e-01, 6.411830842823245e-01, 6.529203544876097e-01, 6.645840786371451e-01, + 6.761653499550255e-01, 6.876573952173626e-01, 6.990511539119996e-01, 7.103400549562944e-01, + 7.215149331458728e-01, 7.325691772738999e-01, 7.434943718765665e-01, 7.542846327442048e-01, + 7.649313654540612e-01, 7.754281892901473e-01, 7.857670170752049e-01, 7.959414651061612e-01, + 8.059437233154637e-01, 8.157687070715176e-01, 8.254086223972127e-01, 8.348589373399948e-01, + 8.441125827416620e-01, 8.531651194538425e-01, 8.620108336276733e-01, 8.706456337542150e-01, + 8.790631561061171e-01, 8.872599706865123e-01, 8.952313288619367e-01, 9.029751680353524e-01, + 9.104863121445679e-01, 9.177625550620636e-01, 9.247997426966093e-01, 9.315962496426278e-01, + 9.381494858921667e-01, 9.444588390359354e-01, 9.505220861927248e-01, 9.563402921286364e-01, + 9.619114522936701e-01, 9.672366712325431e-01, 9.723156637834687e-01, 9.771501187120180e-01, + 9.817397501303696e-01, 9.860865871353246e-01, 9.901906380163595e-01, 9.940557180662704e-01, + 9.976842395284637e-01, 1.001080961257010e+00, 1.004247514102417e+00, 1.007188578458507e+00, + 1.009906654565108e+00, 1.012407428282884e+00, 1.014694702432600e+00, 1.016774659209400e+00, + 1.018650990561848e+00, 1.020330464463111e+00, 1.021817328911793e+00, 1.023118841384460e+00, + 1.024240262467000e+00, 1.025189721888128e+00, 1.025972450969440e+00, 1.026596938589443e+00, + 1.027069179375841e+00, 1.027397523939210e+00, 1.027587902203109e+00, 1.027648951922701e+00, + 1.027585830688143e+00, 1.027408519661012e+00, 1.027122986826984e+00, 1.026738673647482e+00, + 1.026261663878092e+00, 1.025701002415063e+00, 1.025061777648234e+00, 1.024353980976701e+00, + 1.023582385618774e+00, 1.022756514615106e+00, 1.021880604350422e+00, 1.020963871317665e+00, + 1.020009139549275e+00, 1.019027285501251e+00, 1.018019442784231e+00, 1.016996499560845e+00, + 1.015957433206324e+00, 1.014923441259795e+00, 1.013915946100629e+00, 1.013047565149327e+00, + 1.012216130365610e+00, 1.011044869639164e+00, 1.009914592130044e+00, 1.008824888092573e+00, + 1.007773858455400e+00, 1.006761700412993e+00, 1.005786648810854e+00, 1.004848753962734e+00, + 1.003946083413733e+00, 1.003078846506546e+00, 1.002245009135684e+00, 1.001444733905817e+00, + 1.000676188436651e+00, 9.999393169239009e-01, 9.992320848298057e-01, 9.985548127155425e-01, + 9.979055415627330e-01, 9.972842679758880e-01, 9.966890948441745e-01, 9.961203379971326e-01, + 9.955761256313581e-01, 9.950565724564597e-01, 9.945597525471822e-01, 9.940860378486615e-01, + 9.936337788972491e-01, 9.932031606606759e-01, 9.927921871265732e-01, 9.924015177880798e-01, + 9.920297273323891e-01, 9.916767775088281e-01, 9.913408767719142e-01, 9.910230654424902e-01, + 9.907216425865902e-01, 9.904366799536263e-01, 9.901668953434221e-01, 9.899131011580791e-01, + 9.896735637374597e-01, 9.894488374513719e-01, 9.892374835404283e-01, 9.890401927796704e-01, + 9.888556356037892e-01, 9.886843467692753e-01, 9.885247606051014e-01, 9.883778520531268e-01, + 9.882423270582524e-01, 9.881185638915363e-01, 9.880051626345804e-01, 9.879032023766432e-01, + 9.878111744348976e-01, 9.877295459610343e-01, 9.876571983429736e-01, 9.875949843246187e-01, + 9.875412739766566e-01, 9.874969061399389e-01, 9.874606249127551e-01, 9.874329809802893e-01, + 9.874126414437681e-01, 9.874004750404033e-01, 9.873949921033299e-01, 9.873969162747074e-01, + 9.874049060317581e-01, 9.874197049003676e-01, 9.874399717110517e-01, 9.874663281231737e-01, + 9.874973205882319e-01, 9.875338926695315e-01, 9.875746535410983e-01, 9.876201238703241e-01, + 9.876689801932402e-01, 9.877221556193183e-01, 9.877781920433015e-01, 9.878376489591358e-01, + 9.878991990245439e-01, 9.879637979933339e-01, 9.880300303653743e-01, 9.880984675859855e-01, + 9.881678007807095e-01, 9.882390300097154e-01, 9.883107693992456e-01, 9.883835200189653e-01, + 9.884560159878955e-01, 9.885294200392185e-01, 9.886022219397892e-01, 9.886749404176028e-01, + 9.887466261142505e-01, 9.888182771263505e-01, 9.888882480852147e-01, 9.889574384705896e-01, + 9.890247977602895e-01, 9.890911247701029e-01, 9.891551701556196e-01, 9.892178658748239e-01, + 9.892779555818088e-01, 9.893365186903538e-01, 9.893923680007577e-01, 9.894462830852175e-01, + 9.894972124952000e-01, 9.895463342815009e-01, 9.895923617530382e-01, 9.896362652966239e-01, + 9.896772011542693e-01, 9.897162195263046e-01, 9.897520286480039e-01, 9.897859195209235e-01, + 9.898170267411330e-01, 9.898462068764986e-01, 9.898725363809847e-01, 9.898975138787787e-01, + 9.899200050208486e-01, 9.899410789223559e-01, 9.899600605054418e-01, 9.899782261038060e-01, + 9.899945557067980e-01, 9.900103500807507e-01, 9.900248320990181e-01, 9.900394023736973e-01, + 9.900532105829365e-01, 9.900674746047259e-01, 9.900814722948890e-01, 9.900966926051257e-01, + 9.901122448734595e-01, 9.901293790312005e-01, 9.901474648912307e-01, 9.901680598867444e-01, + 9.901902265696609e-01, 9.902151896501201e-01, 9.902424418296485e-01, 9.902734448815004e-01, + 9.903071270768942e-01, 9.903448913950654e-01, 9.903862280081246e-01, 9.904324484666853e-01, + 9.904825650601110e-01, 9.905379830873822e-01, 9.905980602136440e-01, 9.906640366554630e-01, + 9.907348826312993e-01, 9.908120376822228e-01, 9.908947858311721e-01, 9.909842592301273e-01, + 9.910795247770178e-01, 9.911819240108124e-01, 9.912905118607647e-01, 9.914064705361564e-01, + 9.915288011543961e-01, 9.916586940166509e-01, 9.917952720685562e-01, 9.919396217291009e-01, + 9.920906151219310e-01, 9.922495028313456e-01, 9.924152398352751e-01, 9.925887208794144e-01, + 9.927688708468421e-01, 9.929569112537944e-01, 9.931516528513824e-01, 9.933539244159140e-01, + 9.935626893131695e-01, 9.937790866568735e-01, 9.940016434044485e-01, 9.942312024833810e-01, + 9.944668184371617e-01, 9.947093441694513e-01, 9.949572854565533e-01, 9.952116634297566e-01, + 9.954712635321227e-01, 9.957367951478069e-01, 9.960068616185641e-01, 9.962823025614079e-01, + 9.965617986382630e-01, 9.968461329825753e-01, 9.971338271912752e-01, 9.974256691222113e-01, + 9.977203369515556e-01, 9.980185087055744e-01, 9.983185871761977e-01, 9.986213520769593e-01, + 9.989255426466267e-01, 9.992317314100975e-01, 9.995382582242990e-01, 9.998461160718275e-01, + 1.000153907612080e+00, 1.000461955079660e+00, 1.000768859280338e+00, 1.001075613053728e+00, + 1.001380551217109e+00, 1.001684244734497e+00, 1.001985425397567e+00, 1.002284871786226e+00, + 1.002580975161843e+00, 1.002874411368430e+00, 1.003163845364970e+00, 1.003450063374329e+00, + 1.003731570287893e+00, 1.004009147462043e+00, 1.004281457582935e+00, 1.004549339226336e+00, + 1.004811375053364e+00, 1.005068272394360e+00, 1.005318795748286e+00, 1.005563968008037e+00, + 1.005802269635282e+00, 1.006034554002353e+00, 1.006259855360867e+00, 1.006479018139540e+00, + 1.006690541428116e+00, 1.006895570408563e+00, 1.007093045696527e+00, 1.007283799246233e+00, + 1.007466616298057e+00, 1.007642728426847e+00, 1.007811036585595e+00, 1.007972441990187e+00, + 1.008125875904472e+00, 1.008272602383284e+00, 1.008411468616852e+00, 1.008543573152632e+00, + 1.008668018334797e+00, 1.008786009787269e+00, 1.008896526233555e+00, 1.009000766336071e+00, + 1.009097763850333e+00, 1.009188880897370e+00, 1.009273163797313e+00, 1.009351762546296e+00, + 1.009423944949143e+00, 1.009491175244507e+00, 1.009552401900961e+00, 1.009608886895764e+00, + 1.009659973830751e+00, 1.009707093778162e+00, 1.009749238562067e+00, 1.009787744284661e+00, + 1.009822090220407e+00, 1.009853706282597e+00, 1.009881498943010e+00, 1.009906958448099e+00, + 1.009929567021562e+00, 1.009950573483366e+00, 1.009969021400474e+00, 1.009986499185054e+00, + 1.010002363879044e+00, 1.010017890428877e+00, 1.010032170180360e+00, 1.010046722045583e+00, + 1.010060809299530e+00, 1.010075674445289e+00, 1.010090449982098e+00, 1.010106564965965e+00, + 1.010123226584120e+00, 1.010141762173145e+00, 1.010161131093372e+00, 1.010182635897876e+00, + 1.010205587931660e+00, 1.010231078494249e+00, 1.010257950227988e+00, 1.010287732968580e+00, + 1.010319484524512e+00, 1.010354079663767e+00, 1.010390635488037e+00, 1.010430470494512e+00, + 1.010472266495074e+00, 1.010517096381509e+00, 1.010564099281000e+00, 1.010614266894512e+00, + 1.010666285876455e+00, 1.010721360243234e+00, 1.010778416755264e+00, 1.010838252644461e+00, + 1.010899655674578e+00, 1.010963729626641e+00, 1.011029191301694e+00, 1.011096993993037e+00, + 1.011165861239173e+00, 1.011236610341260e+00, 1.011308167670753e+00, 1.011381453638912e+00, + 1.011454785713102e+00, 1.011529185153809e+00, 1.011603680910505e+00, 1.011678803938046e+00, + 1.011753008569803e+00, 1.011827484797985e+00, 1.011900936547881e+00, 1.011973876511603e+00, + 1.012044885003304e+00, 1.012114985644919e+00, 1.012182837094955e+00, 1.012249023976742e+00, + 1.012312095063070e+00, 1.012373028737774e+00, 1.012430463679316e+00, 1.012484972246822e+00, + 1.012535058602453e+00, 1.012581678169188e+00, 1.012623472898504e+00, 1.012660975529858e+00, + 1.012692758750213e+00, 1.012719789201144e+00, 1.012740575296603e+00, 1.012755753887085e+00, + 1.012763948841204e+00, 1.012765922449960e+00, 1.012760298661069e+00, 1.012747819936584e+00, + 1.012726958954961e+00, 1.012698607692183e+00, 1.012661400539405e+00, 1.012615904116265e+00, + 1.012560833005713e+00, 1.012497050269805e+00, 1.012422888521601e+00, 1.012339226241367e+00, + 1.012244921966297e+00, 1.012140460211194e+00, 1.012024302085441e+00, 1.011897560567707e+00, + 1.011758810583150e+00, 1.011608449127642e+00, 1.011445162723270e+00, 1.011269960947744e+00, + 1.011081255645969e+00, 1.010879608424312e+00, 1.010663676735228e+00, 1.010434184200640e+00, + 1.010189681124657e+00, 1.009930754807923e+00, 1.009655660215271e+00, 1.009365251564694e+00, + 1.009058249873833e+00, 1.008734758578989e+00, 1.008393079963091e+00, 1.008034308295421e+00, + 1.007656661215973e+00, 1.007260142622887e+00, 1.006843352506855e+00, 1.006407009542103e+00, + 1.005949145170711e+00, 1.005470005637052e+00, 1.004967986424467e+00, 1.004443531995945e+00, + 1.003894772403371e+00, 1.003321903663793e+00, 1.002723127308148e+00, 1.002098854400575e+00, + 1.001447278873483e+00, 1.000768505317086e+00, 1.000060686758758e+00, 9.993242684851855e-01, + 9.985573503390627e-01, 9.977600196406868e-01, 9.969306036935497e-01, 9.960694269553644e-01, + 9.951746430061121e-01, 9.942466438407230e-01, 9.932837131068657e-01, 9.922861082472264e-01, + 9.912523092989319e-01, 9.901827419790691e-01, 9.890757868707590e-01, 9.879313024174022e-01, + 9.863553220272523e-01, 9.847362453480265e-01, 9.831750948772566e-01, 9.815583336011345e-01, + 9.798613526271561e-01, 9.780617486993630e-01, 9.761574317374303e-01, 9.741378617337759e-01, + 9.719990112065752e-01, 9.697327413658168e-01, 9.673331975559332e-01, 9.647915124057732e-01, + 9.621011497566145e-01, 9.592539757044516e-01, 9.562427177295731e-01, 9.530600909726344e-01, + 9.496984081652284e-01, 9.461498120176854e-01, 9.424071613625743e-01, 9.384634163826711e-01, + 9.343112966094085e-01, 9.299449872197452e-01, 9.253567968750328e-01, 9.205404627076625e-01, + 9.154896280575360e-01, 9.101986790930605e-01, 9.046620597741508e-01, 8.988755194372424e-01, + 8.928338316495705e-01, 8.865337190368053e-01, 8.799712722567934e-01, 8.731437835983047e-01, + 8.660476534563131e-01, 8.586812520174252e-01, 8.510420440685049e-01, 8.431297226886574e-01, + 8.349435141989714e-01, 8.264839911291133e-01, 8.177505366573690e-01, 8.087449817124315e-01, + 7.994681492797084e-01, 7.899235162194718e-01, 7.801137731566502e-01, 7.700431275216928e-01, + 7.597145736971065e-01, 7.491330971820804e-01, 7.383028603058783e-01, 7.272298755824693e-01, + 7.159201919962611e-01, 7.043814340356083e-01, 6.926196927377140e-01, 6.806438831866077e-01, + 6.684616478236647e-01, 6.560830137986515e-01, 6.435179268559957e-01, 6.307755329382612e-01, + 6.178641647786525e-01, 6.047954625702541e-01, 5.915799587176216e-01, 5.782289366005894e-01, + 5.647535885752191e-01, 5.511703155400274e-01, 5.374905090437071e-01, 5.237263500445715e-01, + 5.098915423728255e-01, 4.960008074926423e-01, 4.820662943337458e-01, 4.681017110048007e-01, + 4.541216995958746e-01, 4.401421815729068e-01, 4.261772971493010e-01, 4.122417888542512e-01, + 3.983499612526493e-01, 3.845172335531009e-01, 3.707583717376236e-01, 3.570886786795506e-01, + 3.435228672445627e-01, 3.300763764703638e-01, 3.167640325043893e-01, 3.036004651973109e-01, + 2.905996158436682e-01, 2.777758503744847e-01, 2.651434678028531e-01, 2.527161881181577e-01, + 2.405069849650012e-01, 2.285283969438072e-01, 2.167933432162879e-01, 2.053139897833021e-01, + 1.941021906320988e-01, 1.831680872008943e-01, 1.725221947208913e-01, 1.621735416384834e-01, + 1.521320683467849e-01, 1.424052801149985e-01, 1.330015240938615e-01, 1.239260664828526e-01, + 1.151858295527293e-01, 1.067840430193724e-01, 9.872637505002878e-02, 9.101379000888035e-02, + 8.365057236623055e-02, 7.663508305536153e-02, 6.997033405748826e-02, 6.365188111381365e-02, + 5.768176015814392e-02, 5.205244216987966e-02, 4.676538412257621e-02, 4.180950541438362e-02, + 3.718640251368464e-02, 3.288072750732215e-02, 2.889548499582958e-02, 2.520980565928884e-02, + 2.183057564646272e-02, 1.872896194002638e-02, 1.592127815153420e-02, 1.336381425803020e-02, + 1.108558877807282e-02, 8.943474189364638e-03, 6.758124889697787e-03, 3.504438130619497e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_80_5ms[80] = { + 9.959086585790517e-04, 3.819056787237678e-03, 9.540832613229890e-03, 1.921659800166160e-02, 3.382719081038548e-02, + 5.424831667522354e-02, 8.120777668775610e-02, 1.152171887125930e-01, 1.564942331034909e-01, 2.049363422022628e-01, + 2.601166575816199e-01, 3.212814164616093e-01, 3.873472997948746e-01, 4.569497078592333e-01, 5.285192958868393e-01, + 6.003522489375573e-01, 6.706896380227332e-01, 7.378044458510402e-01, 8.000925313431716e-01, 8.561409184410547e-01, + 9.048272294524792e-01, 9.453685031730190e-01, 9.773507430600533e-01, 1.000800872826561e+00, 1.016171590112097e+00, + 1.024315247630982e+00, 1.026415431432931e+00, 1.023858366571912e+00, 1.018135705524407e+00, 1.010794822557756e+00, + 1.003406509762925e+00, 9.967831265986109e-01, 9.920995520917141e-01, 9.892206942816891e-01, 9.879658322200813e-01, + 9.881273531631907e-01, 9.894805541465801e-01, 9.917849916000535e-01, 9.947847580943504e-01, 9.982119669301160e-01, + 1.001791235858836e+00, 1.005242583245485e+00, 1.008283053756130e+00, 1.010631281038659e+00, 1.012015300253356e+00, + 1.012180753005270e+00, 1.010896765282633e+00, 1.007963362035220e+00, 1.003227255072391e+00, 9.966050551498514e-01, + 9.868284225039941e-01, 9.731250287581631e-01, 9.540636479502398e-01, 9.283864275822276e-01, 8.950916858157935e-01, + 8.534769362643825e-01, 8.032090930429980e-01, 7.444735201251689e-01, 6.780787033699449e-01, 6.053970453856138e-01, + 5.282077505750667e-01, 4.486552956056635e-01, 3.691875990296312e-01, 2.924566408966777e-01, 2.210718537110463e-01, + 1.573148583944309e-01, 1.030525757797768e-01, 5.982732244758054e-02, 2.871831923385133e-02, 9.683884928956490e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_160_5ms[160] = { + 6.143388180964179e-04, 1.489582832987000e-03, 2.884104959764029e-03, 4.934298832466617e-03, 7.779130464154915e-03, + 1.154910606525086e-02, 1.637155619860352e-02, 2.237116158648752e-02, 2.966159685753317e-02, 3.835663329277230e-02, + 4.855610986150206e-02, 6.035055738891727e-02, 7.382288203064732e-02, 8.903563687211119e-02, 1.060356225286319e-01, + 1.248534855777947e-01, 1.454931890869180e-01, 1.679435556337752e-01, 1.921728622634411e-01, 2.181238261985594e-01, + 2.457259744642953e-01, 2.748839432649996e-01, 3.054824712370942e-01, 3.373873799614014e-01, 3.704415932452488e-01, + 4.044749630814483e-01, 4.393004362003260e-01, 4.747225454237193e-01, 5.105341492548225e-01, 5.465201916422433e-01, + 5.824658100332457e-01, 6.181452662624718e-01, 6.533411462740817e-01, 6.878367295965062e-01, 7.214176027060971e-01, + 7.538887973483771e-01, 7.850546571907628e-01, 8.147397447696774e-01, 8.427819363777799e-01, 8.690376742017057e-01, + 8.933935477349644e-01, 9.157483563218768e-01, 9.360270196617569e-01, 9.541731142261065e-01, 9.701635474343885e-01, + 9.840036439809510e-01, 9.957199420334376e-01, 1.005374268639838e+00, 1.013046655758663e+00, 1.018843380560658e+00, + 1.022896948293643e+00, 1.025355286710874e+00, 1.026382881625701e+00, 1.026155530733488e+00, 1.024853974580724e+00, + 1.022664602721801e+00, 1.019779396547454e+00, 1.016391686789653e+00, 1.012697033320358e+00, 1.008885191761748e+00, + 1.005378742804807e+00, 1.001563778373068e+00, 9.982531564931281e-01, 9.954346644968789e-01, 9.930950268060122e-01, + 9.912170911359961e-01, 9.897805192546195e-01, 9.887624937408933e-01, 9.881383235740961e-01, 9.878819413827574e-01, + 9.879662130250981e-01, 9.883630508181326e-01, 9.890434070785485e-01, 9.899772316163624e-01, 9.911334564321237e-01, + 9.924800441092685e-01, 9.939841207305906e-01, 9.956121471675398e-01, 9.973300590248015e-01, 9.991033633647473e-01, + 1.000897441314013e+00, 1.002677088643863e+00, 1.004407190937699e+00, 1.006052289109999e+00, 1.007576934100958e+00, + 1.008945862447015e+00, 1.010124241309341e+00, 1.011077969726137e+00, 1.011773962181442e+00, 1.012180362866919e+00, + 1.012266707295288e+00, 1.012004064757857e+00, 1.011365223023975e+00, 1.010324996851905e+00, 1.008860731864438e+00, + 1.006952983357691e+00, 1.004586273379809e+00, 1.001749900308864e+00, 9.984386632116344e-01, 9.946500332901397e-01, + 9.895756853352172e-01, 9.838303127859196e-01, 9.769999155793757e-01, 9.689141159310996e-01, 9.594038121639412e-01, + 9.483086322505029e-01, 9.354860218216989e-01, 9.208101305030523e-01, 9.041732260327581e-01, 8.854882249661838e-01, + 8.646864947605046e-01, 8.417237467711145e-01, 8.165875713256009e-01, 7.892986353718001e-01, 7.599171886893816e-01, + 7.285474515411827e-01, 6.953282935906302e-01, 6.604334017809461e-01, 6.240661431421666e-01, 5.864461424698465e-01, + 5.478160663871147e-01, 5.084499758302218e-01, 4.686361426418982e-01, 4.286789889246253e-01, 3.889032719013045e-01, + 3.496431418636314e-01, 3.112360816586544e-01, 2.740128472224535e-01, 2.382847225401666e-01, 2.043379825955252e-01, + 1.724305860483632e-01, 1.427939789949265e-01, 1.156385879569741e-01, 9.115821766571995e-02, 6.952749039054593e-02, + 5.088975408628225e-02, 3.533430192568954e-02, 2.286680405144430e-02, 1.338005016725895e-02, 6.640506529168652e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_240_5ms[240] = { + 5.087227626168386e-04, 9.959086585790517e-04, 1.682208006328800e-03, 2.609697259047744e-03, 3.819056787237678e-03, + 5.349319592933909e-03, 7.243906383895192e-03, 9.540832613229890e-03, 1.227637642543709e-02, 1.548950238899404e-02, + 1.921659800166160e-02, 2.349369619441617e-02, 2.835199581667961e-02, 3.382719081038548e-02, 3.994939538719628e-02, + 4.674775238543380e-02, 5.424831667522354e-02, 6.247770776443612e-02, 7.145835917501348e-02, 8.120777668775610e-02, + 9.174400412319896e-02, 1.030764959637497e-01, 1.152171887125930e-01, 1.281665713944242e-01, 1.419264381068653e-01, + 1.564942331034909e-01, 1.718593189799504e-01, 1.880134254543744e-01, 2.049363422022628e-01, 2.226123055761096e-01, + 2.410151242797736e-01, 2.601166575816199e-01, 2.798871008989962e-01, 3.002880135563586e-01, 3.212814164616093e-01, + 3.428208463088390e-01, 3.648596557863134e-01, 3.873472997948746e-01, 4.102294951869188e-01, 4.334494534591082e-01, + 4.569497078592333e-01, 4.806696403251166e-01, 5.045473815014847e-01, 5.285192958868393e-01, 5.525196099932443e-01, + 5.764872452085427e-01, 6.003522489375573e-01, 6.240509872809882e-01, 6.475182586093196e-01, 6.706896380227332e-01, + 6.935029068990036e-01, 7.158927516396895e-01, 7.378044458510402e-01, 7.591787241845952e-01, 7.799586608897265e-01, + 8.000925313431716e-01, 8.195318652294690e-01, 8.382288957404715e-01, 8.561409184410547e-01, 8.732316951214179e-01, + 8.894702022170831e-01, 9.048272294524792e-01, 9.192736375782965e-01, 9.327940405054362e-01, 9.453685031730190e-01, + 9.569883933538136e-01, 9.676486424195593e-01, 9.773507430600533e-01, 9.861027831072527e-01, 9.939122412655677e-01, + 1.000800872826561e+00, 1.006787811971719e+00, 1.011901269172423e+00, 1.016171590112097e+00, 1.019636414864842e+00, + 1.022336613864005e+00, 1.024315247630982e+00, 1.025621299895396e+00, 1.026303439275662e+00, 1.026415431432931e+00, + 1.026007933174836e+00, 1.025137435167917e+00, 1.023858366571912e+00, 1.022226936424625e+00, 1.020300550334848e+00, + 1.018135705524407e+00, 1.015792146756340e+00, 1.013325966774524e+00, 1.010794822557756e+00, 1.008265131568879e+00, + 1.006046874304407e+00, 1.003406509762925e+00, 1.000977398831985e+00, 9.987704535700208e-01, 9.967831265986109e-01, + 9.950118905889862e-01, 9.934523971504882e-01, 9.920995520917141e-01, 9.909475998606236e-01, 9.899902426925508e-01, + 9.892206942816891e-01, 9.886318043013834e-01, 9.882160904669929e-01, 9.879658322200813e-01, 9.878730767519871e-01, + 9.879296932443894e-01, 9.881273531631907e-01, 9.884575535474619e-01, 9.889115869213529e-01, 9.894805541465801e-01, + 9.901553455166457e-01, 9.909266562913843e-01, 9.917849916000535e-01, 9.927206838643636e-01, 9.937239208721489e-01, + 9.947847580943504e-01, 9.958931493776203e-01, 9.970389567617592e-01, 9.982119669301160e-01, 9.994020338838508e-01, + 1.000598323893564e+00, 1.001791235858836e+00, 1.002969837054169e+00, 1.004123786397111e+00, 1.005242583245485e+00, + 1.006315717067918e+00, 1.007332693127034e+00, 1.008283053756130e+00, 1.009156423082384e+00, 1.009942535308151e+00, + 1.010631281038659e+00, 1.011212744622770e+00, 1.011677230257499e+00, 1.012015300253356e+00, 1.012217779097186e+00, + 1.012275790821109e+00, 1.012180753005270e+00, 1.011924425888915e+00, 1.011498917644724e+00, 1.010896765282633e+00, + 1.010110965619444e+00, 1.009135094671655e+00, 1.007963362035220e+00, 1.006590756505588e+00, 1.005013115379014e+00, + 1.003227255072391e+00, 1.001231060075500e+00, 9.990235555436858e-01, 9.966050551498514e-01, 9.939894706113089e-01, + 9.904539200261149e-01, 9.868284225039941e-01, 9.827716736909488e-01, 9.782206672373213e-01, 9.731250287581631e-01, + 9.674323528812744e-01, 9.610947043524248e-01, 9.540636479502398e-01, 9.462952991190324e-01, 9.377489107516087e-01, + 9.283864275822276e-01, 9.181762606422500e-01, 9.070861558801854e-01, 8.950916858157935e-01, 8.821696237804294e-01, + 8.683025287048570e-01, 8.534769362643825e-01, 8.376852006833730e-01, 8.209275259764013e-01, 8.032090930429980e-01, + 7.845450482523652e-01, 7.649554851899686e-01, 7.444735201251689e-01, 7.231348066419057e-01, 7.009860555207412e-01, + 6.780787033699450e-01, 6.544686506489734e-01, 6.302212149502727e-01, 6.053970453856138e-01, 5.800715766089168e-01, + 5.543129276657669e-01, 5.282077505750727e-01, 5.018369724442092e-01, 4.752902962082383e-01, 4.486552956056652e-01, + 4.220281118338883e-01, 3.955057965950340e-01, 3.691875990296320e-01, 3.431732847389720e-01, 3.175633015043183e-01, + 2.924566408966782e-01, 2.679463783886042e-01, 2.441231331518492e-01, 2.210718537110466e-01, 1.988719153219592e-01, + 1.775967625327044e-01, 1.573148583944310e-01, 1.380903364946733e-01, 1.199837497591550e-01, 1.030525757797769e-01, + 8.735085011789188e-02, 7.292811584897502e-02, 5.982732244758056e-02, 4.808178837444506e-02, 3.771135297837851e-02, + 2.871831923385135e-02, 2.108352028641225e-02, 1.476289412849005e-02, 9.683884928956495e-03, 5.642168789286858e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_320_5ms[320] = { + 4.595886345493055e-04, 7.919323614002698e-04, 1.227927169310031e-03, 1.783653266717233e-03, 2.479549413444207e-03, + 3.329799454594261e-03, 4.353535478916468e-03, 5.564965156664018e-03, 6.986108359341676e-03, 8.629882322202329e-03, + 1.051343406844975e-02, 1.265082642578719e-02, 1.506090447446532e-02, 1.775591229287213e-02, 2.075475983187825e-02, + 2.406813715401559e-02, 2.771207863541604e-02, 3.169933248543932e-02, 3.604609640533871e-02, 4.076128638095439e-02, + 4.586038120884381e-02, 5.135136676471998e-02, 5.724780220726930e-02, 6.355854744461048e-02, 7.029450733434550e-02, + 7.745987198268531e-02, 8.506635369887924e-02, 9.311641620512773e-02, 1.016162955027316e-01, 1.105690806271684e-01, + 1.199789286645804e-01, 1.298417294090302e-01, 1.401623800497866e-01, 1.509371564593891e-01, 1.621632295622287e-01, + 1.738354123649302e-01, 1.859520359191026e-01, 1.985008828937603e-01, 2.114778554475382e-01, 2.248732557074316e-01, + 2.386763947872762e-01, 2.528729453658238e-01, 2.674547009618951e-01, 2.824031465430401e-01, 2.977050145264297e-01, + 3.133419120661713e-01, 3.292976696294886e-01, 3.455490160824131e-01, 3.620795045342974e-01, 3.788648665671841e-01, + 3.958851576591690e-01, 4.131143794748322e-01, 4.305308301005456e-01, 4.481076715576617e-01, 4.658227790464821e-01, + 4.836466393241829e-01, 5.015564851667653e-01, 5.195228071176610e-01, 5.375197039843709e-01, 5.555183841040963e-01, + 5.734957812557457e-01, 5.914186654649489e-01, 6.092622887527459e-01, 6.269981160888640e-01, 6.446002007776794e-01, + 6.620384583071039e-01, 6.792906550106088e-01, 6.963256426589250e-01, 7.131194393772130e-01, 7.296469905863920e-01, + 7.458864594794676e-01, 7.618094719403713e-01, 7.773958448163656e-01, 7.926208751337592e-01, 8.074666387233143e-01, + 8.219101564897180e-01, 8.359343163788637e-01, 8.495180470826319e-01, 8.626485837105826e-01, 8.753083234662220e-01, + 8.874884715160425e-01, 8.991737724042251e-01, 9.103527429187326e-01, 9.210144133066616e-01, 9.311556192776946e-01, + 9.407644740241826e-01, 9.498382236872068e-01, 9.583732599601223e-01, 9.663690412284377e-01, 9.738235617865406e-01, + 9.807442506043361e-01, 9.871297972052695e-01, 9.929872268444632e-01, 9.983241398929388e-01, 1.003150760219063e+00, + 1.007473713377193e+00, 1.011309151636166e+00, 1.014666681083198e+00, 1.017563337333301e+00, 1.020014681326785e+00, + 1.022039872150903e+00, 1.023654257342442e+00, 1.024881624147540e+00, 1.025739288978437e+00, 1.026250709375593e+00, + 1.026436666375082e+00, 1.026320857404224e+00, 1.025922917798664e+00, 1.025269979527211e+00, 1.024382188798244e+00, + 1.023284940887058e+00, 1.022000829220643e+00, 1.020555973231408e+00, 1.018971390778550e+00, 1.017275179369116e+00, + 1.015489129111694e+00, 1.013639356938881e+00, 1.011747750709711e+00, 1.009840844244693e+00, 1.007939764480188e+00, + 1.006407400915498e+00, 1.004374825095777e+00, 1.002469814737132e+00, 1.000689073754539e+00, 9.990346001249977e-01, + 9.975024904153303e-01, 9.960941547576162e-01, 9.948051243621099e-01, 9.936362728142866e-01, 9.925826537087717e-01, + 9.916447007525191e-01, 9.908170758245324e-01, 9.900998445795673e-01, 9.894873685512386e-01, 9.889794323427195e-01, + 9.885701787626714e-01, 9.882591911282058e-01, 9.880404423341358e-01, 9.879133688360181e-01, 9.878718098237022e-01, + 9.879150762106034e-01, 9.880368938846610e-01, 9.882364564839506e-01, 9.885073687439192e-01, 9.888487088987707e-01, + 9.892539488627546e-01, 9.897220412447528e-01, 9.902463287269285e-01, 9.908256340476208e-01, 9.914531811725067e-01, + 9.921276814881759e-01, 9.928422499725458e-01, 9.935955098307742e-01, 9.943804814776256e-01, 9.951957244449919e-01, + 9.960341878404958e-01, 9.968943831870675e-01, 9.977692009836100e-01, 9.986571134591464e-01, 9.995509738170480e-01, + 1.000449227898040e+00, 1.001344692310058e+00, 1.002235786606954e+00, 1.003115291715261e+00, 1.003981602446902e+00, + 1.004827468041713e+00, 1.005651275972376e+00, 1.006445772052972e+00, 1.007209352772459e+00, 1.007934783656087e+00, + 1.008620496650569e+00, 1.009259314290145e+00, 1.009849742422788e+00, 1.010384692193296e+00, 1.010862783160582e+00, + 1.011277044709547e+00, 1.011626247430694e+00, 1.011903571699736e+00, 1.012107954864219e+00, 1.012232755709885e+00, + 1.012277089047072e+00, 1.012234505114778e+00, 1.012104319978655e+00, 1.011880293122688e+00, 1.011561972516341e+00, + 1.011143373963981e+00, 1.010624321020038e+00, 1.009999148545101e+00, 1.009268031808824e+00, 1.008425698479647e+00, + 1.007472774447058e+00, 1.006404483571931e+00, 1.005222003295591e+00, 1.003921160689206e+00, 1.002503762756151e+00, + 1.000966332772540e+00, 9.993114007411373e-01, 9.975362702189898e-01, 9.956442306333592e-01, 9.936333924912825e-01, + 9.908677480361242e-01, 9.882326326262749e-01, 9.853620567056602e-01, 9.822305093671991e-01, 9.788185853162172e-01, + 9.751026333215268e-01, 9.710631852370086e-01, 9.666759668947944e-01, 9.619242192293307e-01, 9.567841986369235e-01, + 9.512394303101863e-01, 9.452700238623795e-01, 9.388615698236068e-01, 9.319946435581106e-01, 9.246592033932568e-01, + 9.168383396399868e-01, 9.085218034087421e-01, 8.996967011299613e-01, 8.903562054918268e-01, 8.804877931535187e-01, + 8.700884209228057e-01, 8.591492134848259e-01, 8.476686394755906e-01, 8.356428970797861e-01, 8.230753889817990e-01, + 8.099649296155544e-01, 7.963204506324437e-01, 7.821460539775005e-01, 7.674541821769616e-01, 7.522563457568547e-01, + 7.365702052057368e-01, 7.204090552899627e-01, 7.037975107157410e-01, 6.867542812151157e-01, 6.693041888771051e-01, + 6.514710959179395e-01, 6.332854832820911e-01, 6.147685389896460e-01, 5.959553778639692e-01, 5.768737955463938e-01, + 5.575534287167304e-01, 5.380320138068979e-01, 5.183454027643563e-01, 4.985259415650634e-01, 4.786156067459849e-01, + 4.586473038370941e-01, 4.386643656872842e-01, 4.187046888325280e-01, 3.988123056192917e-01, 3.790262923635886e-01, + 3.593914828698096e-01, 3.399474132903109e-01, 3.207392420889753e-01, 3.018061113177048e-01, 2.831905952786929e-01, + 2.649288369241889e-01, 2.470608550624402e-01, 2.296201119084317e-01, 2.126433716126151e-01, 1.961601816145380e-01, + 1.802035203864437e-01, 1.647996883470626e-01, 1.499787548077656e-01, 1.357643522991611e-01, 1.221842534547464e-01, + 1.092601994264172e-01, 9.701788451015501e-02, 8.547680283183663e-02, 7.465976378295235e-02, 6.458254322751883e-02, + 5.526281189874138e-02, 4.670976978373095e-02, 3.893244425578719e-02, 3.192976013776996e-02, 2.569810636390756e-02, + 2.022259265088492e-02, 1.548317776486452e-02, 1.144924909653903e-02, 8.076482660383199e-03, 5.300044080947794e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_WINDOW_480_5ms[480] = { + 4.090106504820579e-04, 6.143388180964179e-04, 8.571759876954877e-04, 1.147015057857495e-03, 1.489582832987000e-03, + 1.889770382231583e-03, 2.353000800169909e-03, 2.884104959764029e-03, 3.488213786635855e-03, 4.170040431489613e-03, + 4.934298832466617e-03, 5.787076505403503e-03, 6.733811743137561e-03, 7.779130464154915e-03, 8.927044958757816e-03, + 1.018202888968871e-02, 1.154910606525086e-02, 1.303349217699797e-02, 1.463951288465963e-02, 1.637155619860352e-02, + 1.823455383898077e-02, 2.023309488998589e-02, 2.237116158648752e-02, 2.465237348403478e-02, 2.708101935270475e-02, + 2.966159685753317e-02, 3.239884850877327e-02, 3.529601774976465e-02, 3.835663329277230e-02, 4.158447932459513e-02, + 4.498322421745353e-02, 4.855610986150206e-02, 5.230596475016741e-02, 5.623624576084146e-02, 6.035055738891727e-02, + 6.465186317477950e-02, 6.914195749790462e-02, 7.382288203064732e-02, 7.869709331995660e-02, 8.376761638427657e-02, + 8.903563687211118e-02, 9.450199243028472e-02, 1.001680193006426e-01, 1.060356225286319e-01, 1.121060220821844e-01, + 1.183788547045326e-01, 1.248534855777947e-01, 1.315302847610869e-01, 1.384103079528939e-01, 1.454931890869180e-01, + 1.527772946853750e-01, 1.602608842337125e-01, 1.679435556337752e-01, 1.758245615079801e-01, 1.839020119821303e-01, + 1.921728622634411e-01, 2.006344295681524e-01, 2.092853879977170e-01, 2.181238261985594e-01, 2.271462264407930e-01, + 2.363479205237173e-01, 2.457259744642953e-01, 2.552771551741124e-01, 2.649981094228982e-01, 2.748839432649996e-01, + 2.849296444030153e-01, 2.951306505827265e-01, 3.054824712370942e-01, 3.159799638238941e-01, 3.266169794538543e-01, + 3.373873799614014e-01, 3.482855915638277e-01, 3.593057693987583e-01, 3.704415932452488e-01, 3.816862385160692e-01, + 3.930329782788047e-01, 4.044749630814483e-01, 4.160051103939122e-01, 4.276159595085598e-01, 4.393004362003260e-01, + 4.510516333434032e-01, 4.628616046119925e-01, 4.747225454237193e-01, 4.866266705542529e-01, 4.985664508456704e-01, + 5.105341492548225e-01, 5.225212793188740e-01, 5.345190505841265e-01, 5.465201916422433e-01, 5.585172769552711e-01, + 5.705021536899105e-01, 5.824658100332457e-01, 5.943991720381216e-01, 6.062948176207270e-01, 6.181452662624718e-01, + 6.299422016714543e-01, 6.416768736044914e-01, 6.533411462740817e-01, 6.649277540000037e-01, 6.764292700223311e-01, + 6.878367295965062e-01, 6.991421467689277e-01, 7.103379606632721e-01, 7.214176027060971e-01, 7.323746102405828e-01, + 7.432008025932804e-01, 7.538887973483771e-01, 7.644315495717613e-01, 7.748223151443820e-01, 7.850546571907628e-01, + 7.951223518167163e-01, 8.050193862201107e-01, 8.147397447696774e-01, 8.242774413707643e-01, 8.336267114335371e-01, + 8.427819363777799e-01, 8.517386186427548e-01, 8.604920874939698e-01, 8.690376742017057e-01, 8.773720451249032e-01, + 8.854927938913381e-01, 8.933935477349644e-01, 9.010727088526728e-01, 9.085249398881980e-01, 9.157483563218768e-01, + 9.227413839712016e-01, 9.295017469413066e-01, 9.360270196617569e-01, 9.423143052164881e-01, 9.483629792665091e-01, + 9.541731142261065e-01, 9.597438382130120e-01, 9.650738394220176e-01, 9.701635474343885e-01, 9.750143364412617e-01, + 9.796277191617885e-01, 9.840036439809510e-01, 9.881426772731259e-01, 9.920470446911211e-01, 9.957199420334376e-01, + 9.991640812275709e-01, 1.002381307710643e+00, 1.005374268639838e+00, 1.008146718214831e+00, 1.010703123647275e+00, + 1.013046655758663e+00, 1.015181271161417e+00, 1.017111643578857e+00, 1.018843380560658e+00, 1.020381713994816e+00, + 1.021731101971518e+00, 1.022896948293643e+00, 1.023885455671576e+00, 1.024702974608899e+00, 1.025355286710874e+00, + 1.025848243050604e+00, 1.026188366261215e+00, 1.026382881625701e+00, 1.026438102255574e+00, 1.026360125820994e+00, + 1.026155530733488e+00, 1.025831456886557e+00, 1.025395432284244e+00, 1.024853974580724e+00, 1.024213482124578e+00, + 1.023481184943025e+00, 1.022664602721801e+00, 1.021770903480975e+00, 1.020806917660529e+00, 1.019779396547454e+00, + 1.018695995335235e+00, 1.017564416918053e+00, 1.016391686789653e+00, 1.015184918030332e+00, 1.013950835315021e+00, + 1.012697033320358e+00, 1.011430749860716e+00, 1.010158346781076e+00, 1.008885191761748e+00, 1.007592718305943e+00, + 1.006805603478092e+00, 1.005378742804807e+00, 1.004049051787112e+00, 1.002778356298787e+00, 1.001563778373068e+00, + 1.000404915291105e+00, 9.993014844615166e-01, 9.982531564931281e-01, 9.972595460676951e-01, 9.963202131848272e-01, + 9.954346644968789e-01, 9.946023543844607e-01, 9.938226881029791e-01, 9.930950268060122e-01, 9.924186919309267e-01, + 9.917929657090736e-01, 9.912170911359961e-01, 9.906902760441473e-01, 9.902117003786811e-01, 9.897805192546193e-01, + 9.893958602389157e-01, 9.890568243690241e-01, 9.887624937408933e-01, 9.885119364350415e-01, 9.883042028597552e-01, + 9.881383235740961e-01, 9.880133161159576e-01, 9.879281898513085e-01, 9.878819413827574e-01, 9.878735508484809e-01, + 9.879019873841568e-01, 9.879662130250981e-01, 9.880651778500144e-01, 9.881978162133899e-01, 9.883630508181326e-01, + 9.885597957603544e-01, 9.887869526128024e-01, 9.890434070785485e-01, 9.893280319166613e-01, 9.896396899060125e-01, + 9.899772316163624e-01, 9.903394929409673e-01, 9.907252968668226e-01, 9.911334564321237e-01, 9.915627747807666e-01, + 9.920120436855326e-01, 9.924800441092685e-01, 9.929655482846576e-01, 9.934673212537685e-01, 9.939841207305906e-01, + 9.945146969322154e-01, 9.950577931942117e-01, 9.956121471675398e-01, 9.961764915534302e-01, 9.967495543671935e-01, + 9.973300590248015e-01, 9.979167245036720e-01, 9.985082643417953e-01, 9.991033633647473e-01, 9.997003478609010e-01, + 1.000299741957418e+00, 1.000897441314013e+00, 1.001493964257960e+00, 1.002087624593489e+00, 1.002677088643863e+00, + 1.003261045483858e+00, 1.003838183774652e+00, 1.004407190937699e+00, 1.004966753528881e+00, 1.005515557572658e+00, + 1.006052289109999e+00, 1.006575635258931e+00, 1.007084285781611e+00, 1.007576934100958e+00, 1.008052277555815e+00, + 1.008509017718116e+00, 1.008945862447015e+00, 1.009361528531177e+00, 1.009754742820913e+00, 1.010124241309341e+00, + 1.010468769795370e+00, 1.010787087537248e+00, 1.011077969726137e+00, 1.011340205650538e+00, 1.011572597114216e+00, + 1.011773962181442e+00, 1.011943138906979e+00, 1.012078982659783e+00, 1.012180362866919e+00, 1.012246166897464e+00, + 1.012275305013586e+00, 1.012266707295288e+00, 1.012219319453278e+00, 1.012132107622966e+00, 1.012004064757857e+00, + 1.011834207632025e+00, 1.011621572933544e+00, 1.011365223023975e+00, 1.011064253702468e+00, 1.010717792733157e+00, + 1.010324996851905e+00, 1.009885057526159e+00, 1.009397209381147e+00, 1.008860731864438e+00, 1.008274947065247e+00, + 1.007639223374887e+00, 1.006952983357691e+00, 1.006215708265639e+00, 1.005426938305289e+00, 1.004586273379809e+00, + 1.003693377657581e+00, 1.002747984657666e+00, 1.001749900308864e+00, 1.000699003803502e+00, 9.995952485989262e-01, + 9.984386632116344e-01, 9.972293415774932e-01, 9.959672769174924e-01, 9.946500332901397e-01, 9.932403996813470e-01, + 9.912511516117244e-01, 9.895756853352172e-01, 9.877713214760662e-01, 9.858577479051078e-01, 9.838303127859196e-01, + 9.816822625580078e-01, 9.794074486605805e-01, 9.769999155793757e-01, 9.744528356359687e-01, 9.717597500340699e-01, + 9.689141159310996e-01, 9.659101618500662e-01, 9.627421831412876e-01, 9.594038121639412e-01, 9.558889978382734e-01, + 9.521922434090249e-01, 9.483086322505029e-01, 9.442332539187503e-01, 9.399607238929982e-01, 9.354860218216989e-01, + 9.308052967663477e-01, 9.259146970284931e-01, 9.208101305030523e-01, 9.154873597416558e-01, 9.099426066529104e-01, + 9.041732260327581e-01, 8.981763729936715e-01, 8.919490241013392e-01, 8.854882249661838e-01, 8.787919436722827e-01, + 8.718585835568161e-01, 8.646864947605047e-01, 8.572738135700366e-01, 8.496195859658071e-01, 8.417237467711145e-01, + 8.335862715770727e-01, 8.252074428838668e-01, 8.165875713256009e-01, 8.077280370477699e-01, 7.986311592191131e-01, + 7.892986353718001e-01, 7.797330954210866e-01, 7.699379531983687e-01, 7.599171886893816e-01, 7.496758423734833e-01, + 7.392176841476761e-01, 7.285474515411827e-01, 7.176714478163359e-01, 7.065962311464494e-01, 6.953282935906302e-01, + 6.838739059112046e-01, 6.722395305539791e-01, 6.604334017809461e-01, 6.484643596235256e-01, 6.363395004626368e-01, + 6.240661431421666e-01, 6.116530334821534e-01, 5.991098644638286e-01, 5.864461424698465e-01, 5.736694851703749e-01, + 5.607881029948401e-01, 5.478160663871271e-01, 5.347619788897301e-01, 5.216365147692703e-01, 5.084499758302256e-01, + 4.952135086430446e-01, 4.819387562519412e-01, 4.686361426419003e-01, 4.553170769563941e-01, 4.419939954454178e-01, + 4.286789889246267e-01, 4.153837786572842e-01, 4.021211063103491e-01, 3.889032719013054e-01, 3.757425439137077e-01, + 3.626515183776310e-01, 3.496431418636322e-01, 3.367290822653354e-01, 3.239228075238623e-01, 3.112360816586549e-01, + 2.986807941537710e-01, 2.862694673284843e-01, 2.740128472224539e-01, 2.619228330079575e-01, 2.500098438708934e-01, + 2.382847225401669e-01, 2.267578490199104e-01, 2.154390996938547e-01, 2.043379825955254e-01, 1.934636765792024e-01, + 1.828250319214460e-01, 1.724305860483634e-01, 1.622886348529314e-01, 1.524071880359812e-01, 1.427939789949266e-01, + 1.334565845242183e-01, 1.244023922999665e-01, 1.156385879569742e-01, 1.071721547807196e-01, 9.900985872728905e-02, + 9.115821766572002e-02, 8.362344855837105e-02, 7.641140367416376e-02, 6.952749039054598e-02, 6.297656454790079e-02, + 5.676284244020858e-02, 5.088975408628229e-02, 4.535983304624439e-02, 4.017457306236873e-02, 3.533430192568957e-02, + 3.083806062123772e-02, 2.668355420358626e-02, 2.286680405144430e-02, 1.938236337675363e-02, 1.622312720409645e-02, + 1.338005016725895e-02, 1.084218595595746e-02, 8.596753980908744e-03, 6.640506529168652e-03, 5.172703110468352e-03, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + + +const LC3_FLOAT MDCT_HRA_WINDOW_480_2_5ms[240] = { + 1.928875250471185e-07, 1.268623078914631e-06, 3.736943081685792e-06, 8.649386473419844e-06, 1.752499879209154e-05, + 3.251004192297566e-05, 5.654995150945631e-05, 9.358653414327445e-05, 1.487809853781833e-04, 2.287619057346095e-04, + 3.418963835622074e-04, 4.985810015573861e-04, 7.115482671394238e-04, 9.961824750040105e-04, 1.370837415765066e-03, + 1.857146703383843e-03, 2.480315886706181e-03, 3.269384042869696e-03, 4.257441351253188e-03, 5.481788360538607e-03, + 6.984022437256788e-03, 8.810037359146468e-03, 1.100992329671028e-02, 1.363775656493463e-02, 1.675127150559057e-02, + 2.041141057401967e-02, 2.468175295733717e-02, 2.962782656580052e-02, 3.531631267855188e-02, 4.181415652877682e-02, + 4.918760034374654e-02, 5.750115754515065e-02, 6.681654781077175e-02, 7.719161248813326e-02, 8.867922857347045e-02, + 1.013262374019720e-01, 1.151724017179353e-01, 1.302494023407827e-01, 1.465798836473051e-01, 1.641765559275968e-01, + 1.830413626142431e-01, 2.031647215674081e-01, 2.245248520040451e-01, 2.470872021104946e-01, 2.708039965464759e-01, + 2.956139274737775e-01, 3.214420168557505e-01, 3.481996809305596e-01, 3.757850292873181e-01, 4.040834302177654e-01, + 4.329683704138883e-01, 4.623026302356333e-01, 4.919397855296871e-01, 5.217260335074649e-01, 5.515023240298861e-01, + 5.811067597335228e-01, 6.103772100633116e-01, 6.391540670154212e-01, 6.672830559207561e-01, 6.946180045149623e-01, + 7.210234691482331e-01, 7.463771190956836e-01, 7.705717887049389e-01, 7.935171220325148e-01, 8.151407544921331e-01, + 8.353889991744725e-01, 8.542270299166949e-01, 8.716385768842180e-01, 8.876251715716619e-01, 9.022049953400274e-01, + 9.154113980197115e-01, 9.272911604251438e-01, 9.379025770646191e-01, 9.473134335138002e-01, 9.555989477431630e-01, + 9.628397371519567e-01, 9.691198641470655e-01, 9.745250036731624e-01, 9.791407668194774e-01, 9.830512059497915e-01, + 9.863375189657285e-01, 9.890769633791019e-01, 9.913419847656554e-01, 9.931995587544050e-01, 9.947107408108303e-01, + 9.959304135675596e-01, 9.969072172806543e-01, 9.976836451676292e-01, 9.982962820245519e-01, 9.987761617973335e-01, + 9.991492178976376e-01, 9.994367991905715e-01, 9.996562248627440e-01, 9.998213528339476e-01, 9.999431389208511e-01, + 1.000030167405588e+00, 1.000089137729581e+00, 1.000125296398298e+00, 1.000142807515464e+00, 1.000145059370791e+00, + 1.000134907956303e+00, 1.000114861040898e+00, 1.000087208438067e+00, 1.000054105383460e+00, 1.000017616583971e+00, + 9.999797286315710e-01, 9.999423382309206e-01, 9.999072232012880e-01, 9.998760025910959e-01, 9.998500915686289e-01, + 9.998306560737898e-01, 9.998185715517388e-01, 9.998143894342878e-01, 9.998183143680869e-01, 9.998301944838478e-01, + 9.998495262367371e-01, 9.998754745167079e-01, 9.999069078401956e-01, 9.999424475239904e-01, 9.999805288598742e-01, + 1.000019471519221e+00, 1.000057555786879e+00, 1.000093100812805e+00, 1.000124540917058e+00, 1.000150496102128e+00, + 1.000169833298924e+00, 1.000181715452526e+00, 1.000185636273393e+00, 1.000181439257840e+00, 1.000169320335504e+00, + 1.000149814156658e+00, 1.000123764529774e+00, 1.000092279821119e+00, 1.000056674215966e+00, 1.000018395617911e+00, + 9.999789406480724e-01, 9.999397567326687e-01, 9.999021306794866e-01, 9.998670624939285e-01, 9.998351225350340e-01, + 9.998062895304436e-01, 9.997797665333356e-01, 9.997537716957203e-01, 9.997253008334399e-01, 9.996898592447866e-01, + 9.996411611766667e-01, 9.995707967428177e-01, 9.994678679836200e-01, 9.993185980679096e-01, 9.991059202780914e-01, + 9.988090562524252e-01, 9.984030958127336e-01, 9.978585933978946e-01, 9.971411984750603e-01, 9.962113391583908e-01, + 9.950239795154223e-01, 9.935284716160412e-01, 9.916685232530794e-01, 9.893823014422549e-01, 9.866026903106617e-01, + 9.832577198181265e-01, 9.792711789106039e-01, 9.745634231307387e-01, 9.690523823244767e-01, 9.626547687789766e-01, + 9.552874798038419e-01, 9.468691813614447e-01, 9.373220508813107e-01, 9.265736480032657e-01, 9.145588719963409e-01, + 9.012219545005915e-01, 8.865184267401519e-01, 8.704169923325978e-01, 8.529012312555665e-01, 8.339710584198038e-01, + 8.136438625110305e-01, 7.919552579077074e-01, 7.689593947581650e-01, 7.447287893964823e-01, 7.193536583208960e-01, + 6.929407625549489e-01, 6.656117935585394e-01, 6.375013549431151e-01, 6.087546140984144e-01, 5.795247127727363e-01, + 5.499700344866872e-01, 5.202514288725478e-01, 4.905294887819369e-01, 4.609619660928919e-01, 4.317013978660552e-01, + 4.028929974356116e-01, 3.746728468420245e-01, 3.471664092737412e-01, 3.204873641715565e-01, 2.947367542923338e-01, + 2.700024238683050e-01, 2.463587202023185e-01, 2.238664274584689e-01, 2.025729006480214e-01, 1.825123693148748e-01, + 1.637063835467572e-01, 1.461643790086412e-01, 1.298843420747792e-01, 1.148535602600838e-01, 1.010494465619472e-01, + 8.844042869400506e-02, 7.698689534753124e-02, 6.664219153548699e-02, 5.735365389394342e-02, 4.906367480666277e-02, + 4.171078175510523e-02, 3.523071580898128e-02, 2.955749109487545e-02, 2.462441579169607e-02, 2.036505497804320e-02, + 1.671411663728698e-02, 1.360824429995981e-02, 1.098670301702559e-02, 8.791949345648940e-03, 6.970080454492374e-03, + 5.471161958930394e-03, 4.249438341364304e-03, 3.263433520599239e-03, 2.475952111493295e-03, 1.853994056678125e-03, + 1.368596596909542e-03, 9.946180283333026e-04, 7.104774789034889e-04, 4.978641589703932e-04, 3.414283510010364e-04, + 2.284649445606105e-04, 1.485987233730432e-04, 9.347897725317759e-05, 5.648942347847280e-05, 3.247793542861785e-05, + 1.750922386335714e-05, 8.642407336226362e-06, 3.734302301245202e-06, 1.267861256795911e-06, 1.927766981311251e-07}; + +const LC3_FLOAT MDCT_HRA_WINDOW_960_2_5ms[480] = { + 1.363353492760669e-07, 4.577676005269251e-07, 9.975675168391671e-07, 1.840776229085288e-06, 3.092248230077047e-06, + 4.880943708557620e-06, 7.363817805099883e-06, 1.073000750387602e-05, 1.520538607055496e-05, 2.105750528134522e-05, + 2.860093592119667e-05, 3.820301288710557e-05, 5.028998805188179e-05, 6.535359090391442e-05, 8.395799364585048e-05, + 1.067471738361778e-04, 1.344526637637966e-04, 1.679016715435404e-04, 2.080255544044134e-04, 2.558686198117505e-04, + 3.125972249248099e-04, 3.795091394541575e-04, 4.580431312676675e-04, 5.497887281277575e-04, 6.564961027629782e-04, + 7.800860221325537e-04, 9.226597952927381e-04, 1.086509147791288e-03, 1.274125944085974e-03, 1.488211673202887e-03, + 1.731686606830910e-03, 2.007698533412427e-03, 2.319630966669840e-03, 2.671110722544265e-03, 3.066014754864068e-03, + 3.508476137357141e-03, 4.002889078021606e-03, 4.553912851519276e-03, 5.166474536289647e-03, 5.845770445618693e-03, + 6.597266146035767e-03, 7.426694962226363e-03, 8.340054875180547e-03, 9.343603729551937e-03, 1.044385267714563e-02, + 1.164755779600632e-02, 1.296170983861615e-02, 1.439352207806304e-02, 1.595041623748902e-02, 1.764000650541313e-02, + 1.947008165734806e-02, 2.144858532216432e-02, 2.358359444954804e-02, 2.588329605228426e-02, 2.835596231360897e-02, + 3.100992416515645e-02, 3.385354345474830e-02, 3.689518383513415e-02, 4.014318051454780e-02, 4.360580901740066e-02, + 4.729125310846769e-02, 5.120757203648361e-02, 5.536266725318061e-02, 5.976424876157179e-02, 6.441980124289254e-02, + 6.933655010531084e-02, 7.452142758961615e-02, 7.998103905796611e-02, 8.572162958181787e-02, 9.174905093483054e-02, + 9.806872908624656e-02, 1.046856322804917e-01, 1.116042397799019e-01, 1.188285113399959e-01, 1.263618574809210e-01, + 1.342071106149135e-01, 1.423664970880752e-01, 1.508416101956496e-01, 1.596333842333865e-01, 1.687420696535257e-01, + 1.781672094023636e-01, 1.879076165271377e-01, 1.979613531528743e-01, 2.083257109445936e-01, 2.189971931864894e-01, + 2.299714986269890e-01, 2.412435072564368e-01, 2.528072682020181e-01, 2.646559899418406e-01, 2.767820330562002e-01, + 2.891769057483280e-01, 3.018312623786579e-01, 3.147349052652145e-01, 3.278767900074122e-01, 3.412450345907444e-01, + 3.548269325249284e-01, 3.686089702575019e-01, 3.825768490881926e-01, 3.967155117862224e-01, 4.110091740828488e-01, + 4.254413611747417e-01, 4.399949493303511e-01, 4.546522126414323e-01, 4.693948749058132e-01, 4.842041665659120e-01, + 4.990608865612834e-01, 5.139454688835927e-01, 5.288380535501122e-01, 5.437185616384643e-01, 5.585667739524391e-01, + 5.733624128178846e-01, 5.880852264406471e-01, 6.027150751969793e-01, 6.172320191724501e-01, 6.316164062197546e-01, + 6.458489597703579e-01, 6.599108656108541e-01, 6.737838568232726e-01, 6.874502960899853e-01, 7.008932545787268e-01, + 7.140965866515435e-01, 7.270449996828834e-01, 7.397241183258171e-01, 7.521205426304834e-01, 7.642218994939656e-01, + 7.760168870042503e-01, 7.874953113309442e-01, 7.986481159099932e-01, 8.094674027667472e-01, 8.199464459192338e-01, + 8.300796968994718e-01, 8.398627825231116e-01, 8.492924951249206e-01, 8.583667755581161e-01, 8.670846893280041e-01, + 8.754463962937875e-01, 8.834531144261093e-01, 8.911070781514043e-01, 8.984114918473676e-01, 9.053704790768982e-01, + 9.119890281611266e-01, 9.182729346961321e-01, 9.242287416134559e-01, 9.298636773723805e-01, 9.351855928531210e-01, + 9.402028974955879e-01, 9.449244951992589e-01, 9.493597204669394e-01, 9.535182752397909e-01, 9.574101668338553e-01, + 9.610456473502188e-01, 9.644351548926832e-01, 9.675892568889318e-01, 9.705185957742447e-01, 9.732338372611643e-01, + 9.757456213845153e-01, 9.780645164789403e-01, 9.802009762158145e-01, 9.821652997980082e-01, 9.839675953844861e-01, + 9.856177467920233e-01, 9.871253834983186e-01, 9.884998539492639e-01, 9.897502021530162e-01, 9.908851475245483e-01, + 9.919130679264989e-01, 9.928419858351684e-01, 9.936795575444219e-01, 9.944330653049196e-01, 9.951094122815642e-01, + 9.957151201982998e-01, 9.962563295265126e-01, 9.967388020613602e-01, 9.971679257195168e-01, 9.975487213822326e-01, + 9.978858515994010e-01, 9.981836309637017e-01, 9.984460379589807e-01, 9.986767280839717e-01, 9.988790480513948e-01, + 9.990560508634377e-01, 9.992105115676724e-01, 9.993449435025852e-01, 9.994616148490124e-01, 9.995625653127808e-01, + 9.996496227746003e-01, 9.997244197555017e-01, 9.997884095596641e-01, 9.998428819710351e-01, 9.998889783954170e-01, + 9.999277063554146e-01, 9.999599532614691e-01, 9.999864993978808e-01, 1.000008030077971e+00, 1.000025146937107e+00, + 1.000038378346013e+00, 1.000048188939381e+00, 1.000054988266291e+00, 1.000059138579006e+00, 1.000060961785582e+00, + 1.000060745599070e+00, 1.000058748922255e+00, 1.000055206511563e+00, 1.000050332967367e+00, 1.000044326100310e+00, + 1.000037369724671e+00, 1.000029635930232e+00, 1.000021286883873e+00, 1.000012476211096e+00, 1.000003350006250e+00, + 9.999940475182815e-01, 9.999847015566445e-01, 9.999754386595657e-01, 9.999663790642979e-01, 9.999576365163719e-01, + 9.999493179522237e-01, 9.999415230869807e-01, 9.999343439366570e-01, 9.999278643015735e-01, 9.999221592354568e-01, + 9.999172945224162e-01, 9.999133261818468e-01, 9.999103000191805e-01, 9.999082512384065e-01, 9.999072041302636e-01, + 9.999071718480597e-01, 9.999081562811047e-01, 9.999101480338050e-01, 9.999131265164656e-01, 9.999170601519115e-01, + 9.999219066999991e-01, 9.999276137001288e-01, 9.999341190298563e-01, 9.999413515757679e-01, 9.999492320108540e-01, + 9.999576736708096e-01, 9.999665835199758e-01, 9.999758631960602e-01, 9.999854101213793e-01, 9.999951186671812e-01, + 1.000004881356628e+00, 1.000014590091279e+00, 1.000024137385544e+00, 1.000033417593335e+00, 1.000042328111225e+00, + 1.000050770542848e+00, 1.000058651809861e+00, 1.000065885195634e+00, 1.000072391308898e+00, 1.000078098955774e+00, + 1.000082945909961e+00, 1.000086879572280e+00, 1.000089857512229e+00, 1.000091847885646e+00, 1.000092829723974e+00, + 1.000092793091916e+00, 1.000091739111420e+00, 1.000089679850895e+00, 1.000086638079347e+00, 1.000082646885623e+00, + 1.000077749163242e+00, 1.000071996961268e+00, 1.000065450701385e+00, 1.000058178260741e+00, 1.000050253919262e+00, + 1.000041757168942e+00, 1.000032771381191e+00, 1.000023382326608e+00, 1.000013676539597e+00, 1.000003739518099e+00, + 9.999936537463840e-01, 9.999834965263427e-01, 9.999733376002018e-01, 9.999632365449369e-01, 9.999532399160947e-01, + 9.999433781162252e-01, 9.999336619607787e-01, 9.999240789122246e-01, 9.999145889513631e-01, 9.999051200534473e-01, + 9.998955632358651e-01, 9.998857671439174e-01, 9.998755321416521e-01, 9.998646038760159e-01, 9.998526662846789e-01, + 9.998393340210341e-01, 9.998241442739438e-01, 9.998065479650342e-01, 9.997859003125656e-01, 9.997614507583039e-01, + 9.997323322622099e-01, 9.996975499792088e-01, 9.996559693426429e-01, 9.996063035901801e-01, 9.995471007797664e-01, + 9.994767303555520e-01, 9.993933693363640e-01, 9.992949882120472e-01, 9.991793366456373e-01, 9.990439290916592e-01, + 9.988860304525888e-01, 9.987026419065322e-01, 9.984904870492169e-01, 9.982459985022988e-01, 9.979653051476074e-01, + 9.976442201531890e-01, 9.972782299617136e-01, 9.968624844150069e-01, 9.963917881900651e-01, 9.958605937219481e-01, + 9.952629957874448e-01, 9.945927279204203e-01, 9.938431608253206e-01, 9.930073029495663e-01, 9.920778033684794e-01, + 9.910469571281373e-01, 9.899067131820748e-01, 9.886486850471784e-01, 9.872641642923781e-01, 9.857441369608847e-01, + 9.840793030126235e-01, 9.822600988582102e-01, 9.802767230390885e-01, 9.781191650903150e-01, 9.757772376026793e-01, + 9.732406114793927e-01, 9.704988543592059e-01, 9.675414721525257e-01, 9.643579536097365e-01, 9.609378178114939e-01, + 9.572706644392005e-01, 9.533462266503443e-01, 9.491544263479285e-01, 9.446854315961644e-01, 9.399297158962095e-01, + 9.348781189964488e-01, 9.295219088721776e-01, 9.238528444701966e-01, 9.178632387754598e-01, 9.115460217204322e-01, + 9.048948024240450e-01, 8.979039302171362e-01, 8.905685538859580e-01, 8.828846785458305e-01, 8.748492195442639e-01, + 8.664600527878369e-01, 8.577160608906681e-01, 8.486171745551603e-01, 8.391644086184020e-01, 8.293598922305367e-01, + 8.192068926746530e-01, 8.087098323911928e-01, 7.978742988330544e-01, 7.867070468498287e-01, 7.752159933798504e-01, + 7.634102043158196e-01, 7.512998735020282e-01, 7.388962939169839e-01, 7.262118211926384e-01, 7.132598297183557e-01, + 7.000546616722335e-01, 6.866115694122957e-01, 6.729466517435032e-01, 6.590767846515775e-01, 6.450195471597746e-01, + 6.307931430185830e-01, 6.164163189797930e-01, 6.019082804348481e-01, 5.872886052124403e-01, 5.725771563319307e-01, + 5.577939944978301e-01, 5.429592910967905e-01, 5.280932424234555e-01, 5.132159858162120e-01, 4.983475183298941e-01, + 4.835076185113182e-01, 4.687157717768828e-01, 4.539910998210603e-01, 4.393522944120604e-01, 4.248175558579833e-01, + 4.104045363548025e-01, 3.961302883579846e-01, 3.820112180536255e-01, 3.680630439436816e-01, 3.543007605040334e-01, + 3.407386068243548e-01, 3.273900400954695e-01, 3.142677137733552e-01, 3.013834602191723e-01, 2.887482775916394e-01, + 2.763723207514489e-01, 2.642648959268686e-01, 2.524344588847748e-01, 2.408886163515173e-01, 2.296341304326797e-01, + 2.186769257893048e-01, 2.080220993398264e-01, 1.976739322711464e-01, 1.876359041583237e-01, 1.779107090095517e-01, + 1.685002730708834e-01, 1.594057742429125e-01, 1.506276629788181e-01, 1.421656845493104e-01, 1.340189025746913e-01, + 1.261857237370651e-01, 1.186639235964411e-01, 1.114506734428340e-01, 1.045425681223503e-01, 9.793565477860058e-02, + 9.162546245161339e-02, 8.560703247484407e-02, 7.987494960705163e-02, 7.442337382999228e-02, 6.924607273536325e-02, + 6.433645441557491e-02, 5.968760076313909e-02, 5.529230107316437e-02, 5.114308583308901e-02, 4.723226057381158e-02, + 4.355193964722984e-02, 4.009407978727676e-02, 3.685051330522059e-02, 3.381298076557955e-02, 3.097316298675063e-02, + 2.832271221053797e-02, 2.585328228730008e-02, 2.355655772843824e-02, 2.142428148537503e-02, 1.944828132389286e-02, + 1.762049467453352e-02, 1.593299185344667e-02, 1.437799756332653e-02, 1.294791060055676e-02, 1.163532171204003e-02, + 1.043302956305446e-02, 9.334054795489547e-03, 8.331652173617308e-03, 7.419320831822072e-03, 6.590812655146027e-03, + 5.840138838848342e-03, 5.161574687206487e-03, 4.549662724337389e-03, 3.999214200759286e-03, 3.505309088672846e-03, + 3.063294666478038e-03, 2.668782798866110e-03, 2.317646022975776e-03, 2.006012553652158e-03, 1.730260321894845e-03, + 1.487010160247016e-03, 1.273118247295162e-03, 1.085667920762688e-03, 9.219609650399310e-04, 7.795084745479000e-04, + 6.560213892304477e-04, 5.494007928508220e-04, 4.577280587661532e-04, 3.792549215895880e-04, 3.123935467349105e-04, + 2.557066633705375e-04, 2.078978198736850e-04, 1.678018145436083e-04, 1.343753481649133e-04, 1.066879390562912e-04, + 8.391313553401788e-05, 6.532005529093359e-05, 5.026527605947520e-05, 3.818509710338716e-05, 2.858818657228189e-05, + 2.104862555598476e-05, 1.519935578579325e-05, 1.072603433419925e-05, 7.361295334616452e-06, 4.879415604699819e-06, + 3.091377877253446e-06, 1.840321200267112e-06, 9.973582966273186e-07, 4.576899867970956e-07, 1.363156993327630e-07}; + +const LC3_FLOAT MDCT_HRA_WINDOW_480_5ms[480] = { + 9.752475122178133e-08, 6.413568706385488e-07, 1.888722582859778e-06, 4.370037451432268e-06, 8.850535239285388e-06, + 1.640976145163547e-05, 2.852654713353143e-05, 4.717577700625728e-05, 7.493695610161539e-05, 1.151138634046934e-04, + 1.718640547726665e-04, 2.503364524287818e-04, 3.568147253529307e-04, 4.988636346654247e-04, 6.854750052598100e-04, + 9.272095051506971e-04, 1.236329983123574e-03, 1.626921748932395e-03, 2.114994893578391e-03, 2.718563554424897e-03, + 3.457696944351759e-03, 4.354536997897421e-03, 5.433277651003014e-03, 6.720101073517573e-03, 8.243066622086374e-03, + 1.003194888027514e-02, 1.211802190514137e-02, 1.453378770448280e-02, 1.731264802301458e-02, 2.048851971150478e-02, + 2.409539527917081e-02, 2.816685167069475e-02, 3.273551184443837e-02, 3.783246533188810e-02, 4.348665559839211e-02, + 4.972424366422929e-02, 5.656795903921283e-02, 6.403645052356303e-02, 7.214365077720192e-02, 8.089816969852329e-02, + 9.030273251800713e-02, 1.003536790358444e-01, 1.110405405506510e-01, 1.223457106767086e-01, 1.342442253757111e-01, + 1.467036660932157e-01, 1.596841978637899e-01, 1.731387516273307e-01, 1.870133568030685e-01, 2.012476264477750e-01, + 2.157753931632489e-01, 2.305254894308376e-01, 2.454226613848142e-01, 2.603886003668338e-01, 2.753430721265570e-01, + 2.902051194568206e-01, 3.048943105839568e-01, 3.193320029709852e-01, 3.334425905036104e-01, 3.471547014476447e-01, + 3.604024000326147e-01, 3.731263195417857e-01, 3.852742256277580e-01, 3.968020335005454e-01, 4.076742901287472e-01, + 4.178645650568324e-01, 4.273556452755667e-01, 4.361395400809099e-01, 4.442173028452789e-01, 4.515986821559811e-01, + 4.583016198658067e-01, 4.643516178635941e-01, 4.697809986240601e-01, 4.746280867221525e-01, 4.789363394414859e-01, + 4.827534543679447e-01, 4.861304804889396e-01, 4.891209569144257e-01, 4.917801000389275e-01, 4.941640559535466e-01, + 4.963292304037445e-01, 4.983317038070890e-01, 5.002267340435251e-01, 5.020683451596181e-01, 5.039089960260009e-01, + 5.057993195650324e-01, 5.077879205925190e-01, 5.099212187075181e-01, 5.122433220684072e-01, 5.147959182947806e-01, + 5.176181700509677e-01, 5.207466049576202e-01, 5.242149921562288e-01, 5.280542009005510e-01, 5.322920397381714e-01, + 5.369530779485470e-01, 5.420584537149585e-01, 5.476256758552612e-01, 5.536684276931489e-01, 5.601963827419005e-01, + 5.672150422730262e-01, 5.747256045798048e-01, 5.827248748908062e-01, 5.912052235447917e-01, 6.001545983308831e-01, + 6.095565949599409e-01, 6.193905875944715e-01, 6.296319193412947e-01, 6.402521506992933e-01, 6.512193622254838e-01, + 6.624985061836945e-01, 6.740518006968909e-01, 6.858391589448801e-01, 6.978186452298805e-01, 7.099469492625143e-01, + 7.221798697869513e-01, 7.344727986533678e-01, 7.467811966479000e-01, 7.590610527959840e-01, 7.712693194564819e-01, + 7.833643163120154e-01, 7.953060973228134e-01, 8.070567758283893e-01, 8.185808042273020e-01, 8.298452060049231e-01, + 8.408197592685507e-01, 8.514771323358515e-01, 8.617929732481214e-01, 8.717459562819760e-01, 8.813177895502246e-01, + 8.904931885580764e-01, 8.992598210679454e-01, 9.076082287937692e-01, 9.155317312832600e-01, 9.230263168675006e-01, + 9.300905248019673e-01, 9.367253217576155e-01, 9.429339747337118e-01, 9.487219213595656e-01, 9.540966375393273e-01, + 9.590675015747306e-01, 9.636456533576906e-01, 9.678438470101040e-01, 9.716762954761368e-01, 9.751585060165801e-01, + 9.783071062524560e-01, 9.811396612648455e-01, 9.836744831733611e-01, 9.859304354792453e-01, 9.879267351759304e-01, + 9.896827561287711e-01, 9.912178374656364e-01, 9.925511006920656e-01, 9.937012789694025e-01, 9.946865615154821e-01, + 9.955244554643670e-01, 9.962316668199601e-01, 9.968240014222112e-01, 9.973162861697706e-01, 9.977223101520583e-01, + 9.980547848638137e-01, 9.983253223174189e-01, 9.985444296291865e-01, 9.987215185204544e-01, 9.988649281201196e-01, + 9.989819594562657e-01, 9.990789200557365e-01, 9.991611771110095e-01, 9.992332177094652e-01, 9.992987146446982e-01, + 9.993605963440879e-01, 9.994211194587087e-01, 9.994819426820254e-01, 9.995442004050701e-01, 9.996085748889234e-01, + 9.996753657478641e-01, 9.997445556919270e-01, 9.998158716802928e-01, 9.998888409489480e-01, 9.999628437059447e-01, + 1.000037122530308e+00, 1.000110932111342e+00, 1.000183434550577e+00, 1.000253775458271e+00, 1.000321131235573e+00, + 1.000384720523657e+00, 1.000443814718821e+00, 1.000497747347372e+00, 1.000545922137548e+00, 1.000587819673348e+00, + 1.000623002564305e+00, 1.000651119113520e+00, 1.000671905511154e+00, 1.000685186620367e+00, 1.000690875455855e+00, + 1.000688971480779e+00, 1.000679557865722e+00, 1.000662797863287e+00, 1.000638930454792e+00, 1.000608265421794e+00, + 1.000571177986086e+00, 1.000528103148456e+00, 1.000479529839953e+00, 1.000425994980975e+00, 1.000368077524065e+00, + 1.000306392536921e+00, 1.000241585363485e+00, 1.000174325883803e+00, 1.000105302878071e+00, 1.000035218487335e+00, + 9.999647827529677e-01, 9.998947082094627e-01, 9.998257045004189e-01, 9.997584729859116e-01, 9.996937013107159e-01, + 9.996320579071534e-01, 9.995741864134795e-01, 9.995206999987033e-01, 9.994721755972762e-01, 9.994291480719714e-01, + 9.993921043401182e-01, 9.993614775166697e-01, 9.993376411467469e-01, 9.993209036195655e-01, 9.993115028741053e-01, + 9.993096015235072e-01, 9.993152825388751e-01, 9.993285456427281e-01, 9.993493045667127e-01, 9.993773853262324e-01, + 9.994125256556279e-01, 9.994543757308175e-01, 9.995025002817920e-01, 9.995563821653024e-01, 9.996154274293025e-01, + 9.996789718565903e-01, 9.997462889273712e-01, 9.998165990914856e-01, 9.998890801932255e-01, 9.999628788477228e-01, + 1.000037122530308e+00, 1.000110932111343e+00, 1.000183434550578e+00, 1.000253775458273e+00, 1.000321131235574e+00, + 1.000384720523658e+00, 1.000443814718822e+00, 1.000497747347373e+00, 1.000545922137550e+00, 1.000587819673349e+00, + 1.000623002564306e+00, 1.000651119113521e+00, 1.000671905511155e+00, 1.000685186620368e+00, 1.000690875455855e+00, + 1.000688971480779e+00, 1.000679557865721e+00, 1.000662797863286e+00, 1.000638930454791e+00, 1.000608265421792e+00, + 1.000571177986083e+00, 1.000528103148453e+00, 1.000479529839950e+00, 1.000425994980971e+00, 1.000368077524061e+00, + 1.000306392536917e+00, 1.000241585363480e+00, 1.000174325883798e+00, 1.000105302878066e+00, 1.000035218487330e+00, + 9.999647827529627e-01, 9.998947082094576e-01, 9.998257045004140e-01, 9.997584729859067e-01, 9.996937013107114e-01, + 9.996320579071492e-01, 9.995741864134757e-01, 9.995206999987001e-01, 9.994721755972732e-01, 9.994291480719688e-01, + 9.993921043401160e-01, 9.993614775166682e-01, 9.993376411467459e-01, 9.993209036195649e-01, 9.993115028741050e-01, + 9.993096015235075e-01, 9.993152825388757e-01, 9.993285456427290e-01, 9.993493045667138e-01, 9.993773853262338e-01, + 9.994125256556294e-01, 9.994543757308189e-01, 9.995025002817937e-01, 9.995563821653038e-01, 9.996154274293039e-01, + 9.996789718565914e-01, 9.997462889273723e-01, 9.998165990914865e-01, 9.998890801932260e-01, 9.999628788477231e-01, + 1.000037087385911e+00, 1.000110692813570e+00, 1.000182706868929e+00, 1.000252041323928e+00, 1.000317522732163e+00, + 1.000377862440740e+00, 1.000431621330905e+00, 1.000477167056245e+00, 1.000512623941274e+00, 1.000535816073234e+00, + 1.000544204364164e+00, 1.000534818530052e+00, 1.000504185023504e+00, 1.000448251960702e+00, 1.000362312003691e+00, + 1.000240924003935e+00, 1.000077833997232e+00, 9.998658958833085e-01, 9.995969918486358e-01, 9.992619523233789e-01, + 9.988504750288640e-01, 9.983510424973004e-01, 9.977508373579080e-01, 9.970356547108338e-01, 9.961898110802319e-01, + 9.951960497774461e-01, 9.940354430376489e-01, 9.926872920341389e-01, 9.911290268265915e-01, 9.893361094467528e-01, + 9.872819446267991e-01, 9.849378040627681e-01, 9.822727714796871e-01, 9.792537170020328e-01, 9.758453102910697e-01, + 9.720100824436398e-01, 9.677085466217928e-01, 9.628993866974633e-01, 9.575397217975740e-01, 9.515854525300023e-01, + 9.449916919338839e-01, 9.377132809663818e-01, 9.297053848015243e-01, 9.209241625967119e-01, 9.113274999097554e-01, + 9.008757898394824e-01, 8.895327463959180e-01, 8.772662317107712e-01, 8.640490775465693e-01, 8.498598811668777e-01, + 8.346837559540076e-01, 8.185130181287622e-01, 8.013477924378186e-01, 7.831965216140859e-01, 7.640763666675557e-01, + 7.440134875182273e-01, 7.230431960387166e-01, 7.012099761451619e-01, 6.785673680876833e-01, 6.551777164863924e-01, + 6.311117838899523e-01, 6.064482336696789e-01, 5.812729878873076e-01, 5.556784673902739e-01, 5.297627228142773e-01, + 5.036284664469868e-01, 4.773820160836825e-01, 4.511321631520609e-01, 4.249889785709717e-01, 3.990625711023555e-01, + 3.734618144045748e-01, 3.482930606136814e-01, 3.236588600361913e-01, 2.996567083459001e-01, 2.763778443910257e-01, + 2.539061231327225e-01, 2.323169891052670e-01, 2.116765758470110e-01, 1.920409557494601e-01, 1.734555625129627e-01, + 1.559548047768156e-01, 1.395618845278644e-01, 1.242888277448971e-01, 1.101367277067382e-01, 9.709619389909366e-02, + 8.514799199591219e-02, 7.426385348588532e-02, 6.440742764829473e-02, 5.553534414838273e-02, 4.759835178173250e-02, + 4.054249795560948e-02, 3.431031430250281e-02, 2.884197618951215e-02, 2.407640752522409e-02, 1.995230681955070e-02, + 1.640907554818694e-02, 1.338763515624311e-02, 1.083112419588716e-02, 8.685471885106049e-03, 6.899848624541457e-03, + 5.426997611391803e-03, 4.223454598964128e-03, 3.249665071710221e-03, 2.470009678121166e-03, 1.852749750240329e-03, + 1.369905213535462e-03, 9.970772330834560e-04, 7.132276282050243e-04, 5.004264891539459e-04, 3.435786103798425e-04, + 2.301383718361825e-04, 1.498216022111699e-04, 9.432178886435202e-05, 5.703679621983551e-05, 3.281105011319028e-05, + 1.769696765784037e-05, 8.738278469978569e-06, 3.776770390150926e-06, 1.282520060393973e-06, 1.950213832061108e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_HRA_WINDOW_960_5ms[960] = { + 6.895487963711672e-08, 2.315162529310440e-07, 5.044776791712418e-07, 9.307951082662299e-07, 1.563406927329763e-06, + 2.467387587537570e-06, 3.721891688909285e-06, 5.422241751611354e-06, 7.682193559629735e-06, 1.063638764371401e-05, + 1.444299034054517e-05, 1.928652559405143e-05, 2.538089690430043e-05, 3.297259712577839e-05, 4.234410206521111e-05, + 5.381744200626993e-05, 6.775794339454556e-05, 8.457813095885401e-05, 1.047417785352287e-04, 1.287680948104183e-04, + 1.572360281259058e-04, 1.907886723956216e-04, 2.301377541053808e-04, 2.760681782947526e-04, 3.294426093879363e-04, + 3.912060607548454e-04, 4.623904649625926e-04, 5.441191948366056e-04, 6.376115037051945e-04, 7.441868515669874e-04, + 8.652690824124538e-04, 1.002390416563642e-03, 1.157195220684898e-03, 1.331443517075892e-03, 1.527014193000520e-03, + 1.745907870144461e-03, 1.990249393843025e-03, 2.262289901491620e-03, 2.564408429555132e-03, 2.899113018840483e-03, + 3.269041278198808e-03, 3.676960367589013e-03, 4.125766362471570e-03, 4.618482962817473e-03, 5.158259511618939e-03, + 5.748368289680850e-03, 6.392201055659471e-03, 7.093264802800713e-03, 7.855176706615627e-03, 8.681658240816716e-03, + 9.576528442223354e-03, 1.054369630902618e-02, 1.158715232077375e-02, 1.271095907270489e-02, 1.391924102158781e-02, + 1.521617334503430e-02, 1.660596992132020e-02, 1.809287044204954e-02, 1.968112667553175e-02, 2.137498790448110e-02, + 2.317868556757386e-02, 2.509641714048705e-02, 2.713232929826755e-02, 2.929050040721149e-02, 3.157492240084053e-02, + 3.398948210100576e-02, 3.653794205159846e-02, 3.922392093875195e-02, 4.205087367774323e-02, 4.502207125299418e-02, + 4.814058040358271e-02, 5.140924325245049e-02, 5.483065698298122e-02, 5.840715367176064e-02, 6.214078039106200e-02, + 6.603327969885861e-02, 7.008607063789310e-02, 7.430023036845897e-02, 7.867647656201358e-02, 8.321515068447660e-02, + 8.791620229900704e-02, 9.277917451814051e-02, 9.780319073433394e-02, 1.029869427561657e-01, 1.083286804746118e-01, + 1.138262031799212e-01, 1.194768526446087e-01, 1.252775080819347e-01, 1.312245830819321e-01, 1.373140246185531e-01, + 1.435413142118472e-01, 1.499014713182564e-01, 1.563890590101503e-01, 1.629981919926660e-01, 1.697225469918130e-01, + 1.765553755327395e-01, 1.834895191111025e-01, 1.905174267437600e-01, 1.976311748676255e-01, 2.048224895376239e-01, + 2.120827708564311e-01, 2.194031195502149e-01, 2.267743655861134e-01, 2.341870987088808e-01, 2.416317007561807e-01, + 2.490983795946414e-01, 2.565772045021951e-01, 2.640581428066213e-01, 2.715310975758094e-01, 2.789859461422405e-01, + 2.864125792327671e-01, 2.938009404650995e-01, 3.011410659646723e-01, 3.084231238498945e-01, 3.156374533302977e-01, + 3.227746031609007e-01, 3.298253691972654e-01, 3.367808307992519e-01, 3.436323858374391e-01, 3.503717840645000e-01, + 3.569912187918766e-01, 3.634832564154323e-01, 3.698408960767766e-01, 3.760576237679591e-01, 3.821274200069671e-01, + 3.880447807855012e-01, 3.938047354128900e-01, 3.994028614671444e-01, 4.048352968090768e-01, 4.100987486186185e-01, + 4.151904994338012e-01, 4.201084101968628e-01, 4.248509203362432e-01, 4.294170449371775e-01, 4.338063690767977e-01, + 4.380190394218450e-01, 4.420557532080190e-01, 4.459177447394188e-01, 4.496067695642793e-01, 4.531250864990879e-01, + 4.564754376870322e-01, 4.596610268884718e-01, 4.626854962106256e-01, 4.655529014908880e-01, 4.682676865530477e-01, + 4.708346565582213e-01, 4.732589506724937e-01, 4.755460142711474e-01, 4.777015708950234e-01, 4.797315941680489e-01, + 4.816422798764418e-01, 4.834400183996339e-01, 4.851313676707616e-01, 4.867230268307342e-01, 4.882218107246894e-01, + 4.896346253731921e-01, 4.909684445331096e-01, 4.922302874448856e-01, 4.934271978441982e-01, 4.945662242969564e-01, + 4.956544018975119e-01, 4.966987353511036e-01, 4.977061834431282e-01, 4.986836448801200e-01, 4.996379454705324e-01, + 5.005758265977741e-01, 5.015039349236500e-01, 5.024288132476197e-01, 5.033568924361829e-01, 5.042944843274677e-01, + 5.052477755087517e-01, 5.062228218592734e-01, 5.072255437473754e-01, 5.082617217696771e-01, 5.093369929206453e-01, + 5.104568470835084e-01, 5.116266237378464e-01, 5.128515087852868e-01, 5.141365314023457e-01, 5.154865608384481e-01, + 5.169063030872989e-01, 5.184002973708743e-01, 5.199729123871391e-01, 5.216283422849100e-01, 5.233706023418981e-01, + 5.252035243345977e-01, 5.271307516011422e-01, 5.291557338103311e-01, 5.312817214614957e-01, 5.335117601505942e-01, + 5.358486846476969e-01, 5.382951128397399e-01, 5.408534395999681e-01, 5.435258306517384e-01, 5.463142164993156e-01, + 5.492202865018518e-01, 5.522454831689516e-01, 5.553909967570894e-01, 5.586577602456578e-01, 5.620464447697334e-01, + 5.655574555837481e-01, 5.691909286262941e-01, 5.729467277513715e-01, 5.768244426856284e-01, 5.808233877646608e-01, + 5.849426014943921e-01, 5.891808469760642e-01, 5.935366132255452e-01, 5.980081174096790e-01, 6.025933080143371e-01, + 6.072898689508155e-01, 6.120952245993402e-01, 6.170065457808297e-01, 6.220207566407007e-01, 6.271345424215810e-01, + 6.323443580952387e-01, 6.376464378179791e-01, 6.430368051681870e-01, 6.485112841196261e-01, 6.540655106995645e-01, + 6.596949452767820e-01, 6.653948854210106e-01, 6.711604792723804e-01, 6.769867393569574e-01, 6.828685567824609e-01, + 6.888007157467320e-01, 6.947779082904570e-01, 7.007947492250285e-01, 7.068457911662456e-01, 7.129255396047764e-01, + 7.190284679449507e-01, 7.251490324444848e-01, 7.312816869891655e-01, 7.374208976383266e-01, 7.435611568791312e-01, + 7.496969975302182e-01, 7.558230062381704e-01, 7.619338365135002e-01, 7.680242212564293e-01, 7.740889847266266e-01, + 7.801230539152502e-01, 7.861214692821104e-01, 7.920793948254449e-01, 7.979921274567765e-01, 8.038551056583576e-01, + 8.096639174059964e-01, 8.154143073453887e-01, 8.211021832154612e-01, 8.267236215176270e-01, 8.322748724351863e-01, + 8.377523640123131e-01, 8.431527056071227e-01, 8.484726906381246e-01, 8.537092986478724e-01, 8.588596967118024e-01, + 8.639212402239919e-01, 8.688914730948750e-01, 8.737681273987250e-01, 8.785491225109360e-01, 8.832325637767802e-01, + 8.878167407543193e-01, 8.923001250745454e-01, 8.966813679615423e-01, 9.009592974545819e-01, 9.051329153725320e-01, + 9.092013940588521e-01, 9.131640729428008e-01, 9.170204549493250e-01, 9.207702027865553e-01, 9.244131351359152e-01, + 9.279492227657136e-01, 9.313785845847777e-01, 9.347014836483568e-01, 9.379183231242151e-01, 9.410296422227417e-01, + 9.440361120910473e-01, 9.469385316675432e-01, 9.497378234904927e-01, 9.524350294515523e-01, 9.550313064834267e-01, + 9.575279221695473e-01, 9.599262502631155e-01, 9.622277661029504e-01, 9.644340419143761e-01, 9.665467419847689e-01, + 9.685676177053684e-01, 9.704985024734301e-01, 9.723413064517235e-01, 9.740980111855780e-01, 9.757706640811671e-01, + 9.773613727522825e-01, 9.788722992464219e-01, 9.803056541645230e-01, 9.816636906919504e-01, 9.829486985613498e-01, + 9.841629979706453e-01, 9.853089334816367e-01, 9.863888679264271e-01, 9.874051763501168e-01, 9.883602400189044e-01, + 9.892564405229114e-01, 9.900961540026917e-01, 9.908817455275554e-01, 9.916155636525488e-01, 9.922999351792323e-01, + 9.929371601433686e-01, 9.935295070502858e-01, 9.940792083761523e-01, 9.945884563506685e-01, 9.950593990338927e-01, + 9.954941366970841e-01, 9.958947185146307e-01, 9.962631395714290e-01, 9.966013381874510e-01, 9.969111935588407e-01, + 9.971945237126117e-01, 9.974530837700109e-01, 9.976885645118487e-01, 9.979025912375212e-01, 9.980967229081705e-01, + 9.982724515633580e-01, 9.984312019997783e-01, 9.985743316998982e-01, 9.987031309979628e-01, 9.988188234704969e-01, + 9.989225665382725e-01, 9.990154522666818e-01, 9.990985083514453e-01, 9.991726992767055e-01, 9.992389276326772e-01, + 9.992980355801597e-01, 9.993508064493677e-01, 9.993979664606926e-01, 9.994401865550964e-01, 9.994780843219823e-01, + 9.995122260124369e-01, 9.995431286258258e-01, 9.995712620577665e-01, 9.995970512975859e-01, 9.996208786634017e-01, + 9.996430860630976e-01, 9.996639772695648e-01, 9.996838201987696e-01, 9.997028491794524e-01, 9.997212672035590e-01, + 9.997392481469061e-01, 9.997569389500512e-01, 9.997744617498990e-01, 9.997919159532207e-01, 9.998093802440068e-01, + 9.998269145173621e-01, 9.998445617335565e-01, 9.998623496867628e-01, 9.998802926840086e-01, 9.998983931308962e-01, + 9.999166430217568e-01, 9.999350253331990e-01, 9.999535153223720e-01, 9.999720817407219e-01, 9.999906880869937e-01, + 1.000009287384094e+00, 1.000027834887701e+00, 1.000046300263356e+00, 1.000064628855653e+00, 1.000082766500416e+00, + 1.000100659718907e+00, 1.000118255908114e+00, 1.000135503526064e+00, 1.000152352271145e+00, 1.000168753254485e+00, + 1.000184659164501e+00, 1.000200024422812e+00, 1.000214805330795e+00, 1.000228960206152e+00, 1.000242449508936e+00, + 1.000255235956603e+00, 1.000267284627736e+00, 1.000278563054190e+00, 1.000289041301502e+00, 1.000298692037510e+00, + 1.000307490589210e+00, 1.000315414987954e+00, 1.000322446003211e+00, 1.000328567165139e+00, 1.000333764776314e+00, + 1.000338027913029e+00, 1.000341348416600e+00, 1.000343720875191e+00, 1.000345142596687e+00, 1.000345613573201e+00, + 1.000345136437780e+00, 1.000343716413940e+00, 1.000341361258634e+00, 1.000338081199265e+00, 1.000333888865364e+00, + 1.000328799215526e+00, 1.000322829460192e+00, 1.000315998980821e+00, 1.000308329246033e+00, 1.000299843725172e+00, + 1.000290567799819e+00, 1.000280528673668e+00, 1.000269755281177e+00, 1.000258278195373e+00, 1.000246129535135e+00, + 1.000233342872247e+00, 1.000219953138478e+00, 1.000205996532915e+00, 1.000191510429709e+00, 1.000176533286394e+00, + 1.000161104552890e+00, 1.000145264581248e+00, 1.000129054536203e+00, 1.000112516306544e+00, 1.000095692417284e+00, + 1.000078625942615e+00, 1.000061360419570e+00, 1.000043939762341e+00, 1.000026408177143e+00, 1.000008810077537e+00, + 9.999911900000854e-01, 9.999735925202352e-01, 9.999560621682817e-01, 9.999386433453050e-01, 9.999213802389432e-01, + 9.999043167388835e-01, 9.998874963519558e-01, 9.998709621167259e-01, 9.998547565174905e-01, 9.998389213976104e-01, + 9.998234978721111e-01, 9.998085262395175e-01, 9.997940458929213e-01, 9.997800952302701e-01, 9.997667115639504e-01, + 9.997539310297094e-01, 9.997417884950316e-01, 9.997303174671138e-01, 9.997195500006013e-01, 9.997095166053042e-01, + 9.997002461541395e-01, 9.996917657915899e-01, 9.996841008429919e-01, 9.996772747250358e-01, 9.996713088578647e-01, + 9.996662225792015e-01, 9.996620330610038e-01, 9.996587552291110e-01, 9.996564016864400e-01, 9.996549826402822e-01, + 9.996545058342721e-01, 9.996549764856241e-01, 9.996563972282545e-01, 9.996587680623811e-01, 9.996620863112294e-01, + 9.996663465854424e-01, 9.996715407557830e-01, 9.996776579346981e-01, 9.996846844672899e-01, 9.996926039321870e-01, + 9.997013971527812e-01, 9.997110422192300e-01, 9.997215145215743e-01, 9.997327867942448e-01, 9.997448291721661e-01, + 9.997576092585791e-01, 9.997710922046226e-01, 9.997852408006243e-01, 9.998000155789548e-01, 9.998153749282088e-01, + 9.998312752183693e-01, 9.998476709365326e-01, 9.998645148326526e-01, 9.998817580746910e-01, 9.998993504124509e-01, + 9.999172403493095e-01, 9.999353753209654e-01, 9.999537018802583e-01, 9.999721658870582e-01, 9.999907127021609e-01, + 1.000009287384094e+00, 1.000027834887701e+00, 1.000046300263357e+00, 1.000064628855654e+00, 1.000082766500417e+00, + 1.000100659718908e+00, 1.000118255908115e+00, 1.000135503526065e+00, 1.000152352271146e+00, 1.000168753254487e+00, + 1.000184659164503e+00, 1.000200024422814e+00, 1.000214805330797e+00, 1.000228960206154e+00, 1.000242449508937e+00, + 1.000255235956604e+00, 1.000267284627737e+00, 1.000278563054191e+00, 1.000289041301503e+00, 1.000298692037512e+00, + 1.000307490589211e+00, 1.000315414987955e+00, 1.000322446003212e+00, 1.000328567165140e+00, 1.000333764776315e+00, + 1.000338027913030e+00, 1.000341348416601e+00, 1.000343720875191e+00, 1.000345142596688e+00, 1.000345613573201e+00, + 1.000345136437780e+00, 1.000343716413940e+00, 1.000341361258634e+00, 1.000338081199264e+00, 1.000333888865363e+00, + 1.000328799215525e+00, 1.000322829460191e+00, 1.000315998980820e+00, 1.000308329246031e+00, 1.000299843725170e+00, + 1.000290567799817e+00, 1.000280528673665e+00, 1.000269755281174e+00, 1.000258278195370e+00, 1.000246129535132e+00, + 1.000233342872243e+00, 1.000219953138474e+00, 1.000205996532911e+00, 1.000191510429705e+00, 1.000176533286390e+00, + 1.000161104552886e+00, 1.000145264581243e+00, 1.000129054536198e+00, 1.000112516306539e+00, 1.000095692417279e+00, + 1.000078625942610e+00, 1.000061360419565e+00, 1.000043939762336e+00, 1.000026408177138e+00, 1.000008810077532e+00, + 9.999911900000801e-01, 9.999735925202301e-01, 9.999560621682765e-01, 9.999386433453000e-01, 9.999213802389382e-01, + 9.999043167388785e-01, 9.998874963519510e-01, 9.998709621167211e-01, 9.998547565174859e-01, 9.998389213976059e-01, + 9.998234978721068e-01, 9.998085262395136e-01, 9.997940458929174e-01, 9.997800952302665e-01, 9.997667115639468e-01, + 9.997539310297062e-01, 9.997417884950285e-01, 9.997303174671109e-01, 9.997195500005988e-01, 9.997095166053018e-01, + 9.997002461541374e-01, 9.996917657915880e-01, 9.996841008429901e-01, 9.996772747250343e-01, 9.996713088578635e-01, + 9.996662225792006e-01, 9.996620330610030e-01, 9.996587552291103e-01, 9.996564016864398e-01, 9.996549826402821e-01, + 9.996545058342721e-01, 9.996549764856244e-01, 9.996563972282549e-01, 9.996587680623816e-01, 9.996620863112300e-01, + 9.996663465854433e-01, 9.996715407557840e-01, 9.996776579346992e-01, 9.996846844672912e-01, 9.996926039321883e-01, + 9.997013971527825e-01, 9.997110422192316e-01, 9.997215145215756e-01, 9.997327867942462e-01, 9.997448291721677e-01, + 9.997576092585806e-01, 9.997710922046239e-01, 9.997852408006256e-01, 9.998000155789563e-01, 9.998153749282102e-01, + 9.998312752183705e-01, 9.998476709365336e-01, 9.998645148326535e-01, 9.998817580746918e-01, 9.998993504124516e-01, + 9.999172403493102e-01, 9.999353753209660e-01, 9.999537018802587e-01, 9.999721658870584e-01, 9.999907127021610e-01, + 1.000009262768464e+00, 1.000027750736626e+00, 1.000046113687940e+00, 1.000064278821780e+00, 1.000082169071538e+00, + 1.000099702238537e+00, 1.000116790156982e+00, 1.000133337763978e+00, 1.000149242061725e+00, 1.000164390968527e+00, + 1.000178662057694e+00, 1.000191921184823e+00, 1.000204021005123e+00, 1.000214799383556e+00, 1.000224077701589e+00, + 1.000231659065357e+00, 1.000237326420850e+00, 1.000240840582544e+00, 1.000241938182520e+00, 1.000240329547572e+00, + 1.000235696512191e+00, 1.000227690175467e+00, 1.000215928609961e+00, 1.000199994530463e+00, 1.000179432930259e+00, + 1.000153748692032e+00, 1.000122404179984e+00, 1.000084816818973e+00, 1.000040356665695e+00, 9.999883439759534e-01, + 9.999280467710976e-01, 9.998586784056549e-01, 9.997793951371076e-01, 9.996892936976876e-01, 9.995874088670188e-01, + 9.994727110434261e-01, 9.993441038107910e-01, 9.992004214970033e-01, 9.990404267193601e-01, 9.988628079116455e-01, + 9.986661768272946e-01, 9.984490660128014e-01, 9.982099262455740e-01, 9.979471239307242e-01, 9.976589384518300e-01, + 9.973435594715599e-01, 9.969990841792483e-01, 9.966235144840385e-01, 9.962147541541155e-01, 9.957706059048574e-01, + 9.952887684414411e-01, 9.947668334645193e-01, 9.942022826511501e-01, 9.935924846270409e-01, 9.929346919504907e-01, + 9.922260381330554e-01, 9.914635347268980e-01, 9.906440685140006e-01, 9.897643988377397e-01, 9.888211551228012e-01, + 9.878108346347950e-01, 9.867298005362246e-01, 9.855742803004703e-01, 9.843403645500459e-01, 9.830240063894612e-01, + 9.816210213063771e-01, 9.801270877173017e-01, 9.785377482356147e-01, 9.768484117402024e-01, 9.750543563222487e-01, + 9.731507331856758e-01, 9.711325715733536e-01, 9.689947847863860e-01, 9.667321773575633e-01, 9.643394534324848e-01, + 9.618112264029069e-01, 9.591420298267040e-01, 9.563263296575538e-01, 9.533585377951747e-01, 9.502330269539270e-01, + 9.469441468339291e-01, 9.434862415648529e-01, 9.398536683783788e-01, 9.360408174512334e-01, 9.320421328469384e-01, + 9.278521344711611e-01, 9.234654409430395e-01, 9.188767932732427e-01, 9.140810792290244e-01, 9.090733582572249e-01, + 9.038488868282046e-01, 8.984031440571518e-01, 8.927318574541139e-01, 8.868310286504967e-01, 8.806969589476717e-01, + 8.743262745326578e-01, 8.677159512065934e-01, 8.608633384737868e-01, 8.537661828424618e-01, 8.464226501927783e-01, + 8.388313470732423e-01, 8.309913407930509e-01, 8.229021781851953e-01, 8.145639029231079e-01, 8.059770712821837e-01, + 7.971427662465509e-01, 7.880626098708469e-01, 7.787387738164395e-01, 7.691739879913762e-01, 7.593715472332762e-01, + 7.493353159843403e-01, 7.390697309175267e-01, 7.285798014827035e-01, 7.178711083511555e-01, 7.069497997461519e-01, + 6.958225856563154e-01, 6.844967299372567e-01, 6.729800403152869e-01, 6.612808563149986e-01, 6.494080351400781e-01, + 6.373709355438772e-01, 6.251793997330287e-01, 6.128437333537300e-01, 6.003746836162993e-01, 5.877834156192006e-01, + 5.750814869390165e-01, 5.622808205578382e-01, 5.493936762043069e-01, 5.364326201891255e-01, 5.234104938203454e-01, + 5.103403804881693e-01, 4.972355715134865e-01, 4.841095308589323e-01, 4.709758588060189e-01, 4.578482547068641e-01, + 4.447404789243264e-01, 4.316663140799624e-01, 4.186395257351866e-01, 4.056738226373441e-01, 3.927828166690819e-01, + 3.799799826463771e-01, 3.672786181177968e-01, 3.546918033248968e-01, 3.422323614910038e-01, 3.299128196128071e-01, + 3.177453699359932e-01, 3.057418323024091e-01, 2.939136175616680e-01, 2.822716922444745e-01, 2.708265446979701e-01, + 2.595881528848133e-01, 2.485659540472639e-01, 2.377688164349652e-01, 2.272050132902212e-01, 2.168821992771410e-01, + 2.068073895309444e-01, 1.969869414909128e-01, 1.874265396648929e-01, 1.781311834549869e-01, 1.691051781531976e-01, + 1.603521291925451e-01, 1.518749397137918e-01, 1.436758114807520e-01, 1.357562491485994e-01, 1.281170678600890e-01, + 1.207584041146470e-01, 1.136797298253828e-01, 1.068798694497608e-01, 1.003570200514591e-01, 9.410877412434678e-02, + 8.813214498499827e-02, 8.242359451816077e-02, 7.697906304046008e-02, 7.179400103167609e-02, 6.686340247035585e-02, + 6.218183950151154e-02, 5.774349815872721e-02, 5.354221486116098e-02, 4.957151340757950e-02, 4.582464219454362e-02, + 4.229461139394613e-02, 3.897422983601720e-02, 3.585614135733534e-02, 3.293286038897012e-02, 3.019680657726779e-02, + 2.764033824859545e-02, 2.525578454921406e-02, 2.303547611198478e-02, 2.097177412248857e-02, 1.905709767802756e-02, + 1.728394935359176e-02, 1.564493890895436e-02, 1.413280509038132e-02, 1.274043549881785e-02, 1.146088451369467e-02, + 1.028738927756386e-02, 9.213383761543762e-03, 8.232510944970423e-03, 7.338633154694566e-03, 6.525840620123105e-03, + 5.788458309403464e-03, 5.121051120120478e-03, 4.518427504569718e-03, 3.975641615147556e-03, 3.487994059724770e-03, + 3.051031360120983e-03, 2.660544209048234e-03, 2.312564622222088e-03, 2.003362082825875e-03, 1.729438775235064e-03, + 1.487524003938835e-03, 1.274567892006584e-03, 1.087734451306357e-03, 9.243941140548951e-04, 7.821158122256320e-04, + 6.586586879186365e-04, 5.519635140582476e-04, 4.601439007796695e-04, 3.814773586413279e-04, 3.143962853984603e-04, + 2.574789385355991e-04, 2.094404511189233e-04, 1.691239438292752e-04, 1.354917813061114e-04, 1.076170162029800e-04, + 8.467505965565773e-05, 6.593561222250244e-05, 5.075488479887568e-05, 3.856813455801580e-05, 2.888253665201353e-05, + 2.127040823889544e-05, 1.536279740228267e-05, 1.084344570939908e-05, 7.443129506680882e-06, 4.934381529209004e-06, + 3.126590786650604e-06, 1.861474073153740e-06, 1.008902130957542e-06, 4.630128105556161e-07, 1.379047824504878e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_HRA_WINDOW_480_10ms[960] = { + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 9.423411645757145e-08, 6.198383813913816e-07, 1.826038044753334e-06, 4.227415544684874e-06, 8.568221371240009e-06, + 1.590138306691229e-05, 2.767384916372097e-05, 4.582461489197476e-05, 7.289566442148343e-05, 1.121553337189409e-04, + 1.677330226576781e-04, 2.447635817250988e-04, 3.495390594774230e-04, 4.896648355656373e-04, 6.742165007916612e-04, + 9.138932038423809e-04, 1.221162590096684e-03, 1.610391938745493e-03, 2.097959688543948e-03, 2.702341257534836e-03, + 3.444162934209273e-03, 4.346217670272292e-03, 5.433436858058855e-03, 6.732812643305091e-03, 8.273266014983896e-03, + 1.008545682987358e-02, 1.220153306437313e-02, 1.465481792555360e-02, 1.747943497487382e-02, 2.070987309036685e-02, + 2.438049487743156e-02, 2.852499398840518e-02, 3.317580867440409e-02, 3.836350071222914e-02, 4.411611056397528e-02, + 5.045850117560903e-02, 5.741170414223051e-02, 6.499228300404947e-02, 7.321172913556540e-02, 8.207590600577601e-02, + 9.158455748369454e-02, 1.017308953166495e-01, 1.125012799073065e-01, 1.238750070616895e-01, 1.358242114920720e-01, + 1.483138955678087e-01, 1.613020891609740e-01, 1.747401434927874e-01, 1.885731587242474e-01, 2.027405417335493e-01, + 2.171766871750067e-01, 2.318117716158385e-01, 2.465726473968904e-01, 2.613838199586506e-01, 2.761684898079396e-01, + 2.908496381590925e-01, 3.053511336415384e-01, 3.195988363856895e-01, 3.335216753280081e-01, 3.470526747443392e-01, + 3.601299968134419e-01, 3.726979341699064e-01, 3.847073300820699e-01, 3.961165192918680e-01, 4.068917464693262e-01, + 4.170075357150957e-01, 4.264469007050540e-01, 4.352013996719531e-01, 4.432710380854631e-01, 4.506640257151909e-01, + 4.573963985795680e-01, 4.634915197715306e-01, 4.689794761564862e-01, 4.738963903364035e-01, 4.782836689638748e-01, + 4.821872093925473e-01, 4.856565867140006e-01, 4.887442424370954e-01, 4.915046944332492e-01, 4.939937853618382e-01, + 4.962679837116828e-01, 4.983837480011794e-01, 5.003969607669508e-01, 5.023624349677376e-01, 5.043334915837460e-01, + 5.063616037481589e-01, 5.084960999306821e-01, 5.107839166820760e-01, 5.132693903594975e-01, 5.159940771247666e-01, + 5.189965912996581e-01, 5.223124537547313e-01, 5.259739442166247e-01, 5.300099539725758e-01, 5.344458381774531e-01, + 5.393032695777062e-01, 5.446000977350559e-01, 5.503502195833738e-01, 5.565634682679432e-01, 5.632455276465002e-01, + 5.703978795909497e-01, 5.780177903898996e-01, 5.860983412324646e-01, 5.946285060985402e-01, 6.035932785464501e-01, + 6.129738470263359e-01, 6.227478165890419e-01, 6.328894733093686e-01, 6.433700864704220e-01, 6.541582425999274e-01, + 6.652202048172945e-01, 6.765202906248624e-01, 6.880212612236103e-01, 6.996847156078869e-01, 7.114714830467992e-01, + 7.233420080447298e-01, 7.352567224482216e-01, 7.471763999968595e-01, 7.590624892758133e-01, 7.708774216994878e-01, + 7.825848918282421e-01, 7.941501079877761e-01, 8.055400118211323e-01, 8.167234660553659e-01, 8.276714104070468e-01, + 8.383569861788307e-01, 8.487556307051457e-01, 8.588451433758131e-01, 8.686057254837016e-01, 8.780199965830640e-01, + 8.870729903819699e-01, 8.957521333967015e-01, 9.040472096414102e-01, 9.119503144919421e-01, 9.194558005383104e-01, + 9.265602177306744e-01, 9.332622494524668e-01, 9.395626453655078e-01, 9.454641510291475e-01, 9.509714334776073e-01, + 9.560910012334918e-01, 9.608311167251793e-01, 9.652016988316350e-01, 9.692142133449947e-01, 9.728815495300325e-01, + 9.762178816434048e-01, 9.792385151909874e-01, 9.819597187561544e-01, 9.843985433157453e-01, 9.865726319613708e-01, + 9.885000237614154e-01, 9.901989560579394e-01, 9.916876697497727e-01, 9.929842220610799e-01, 9.941063109595989e-01, + 9.950711148231832e-01, 9.958951502269355e-01, 9.965941499123417e-01, 9.971829621771531e-01, 9.976754721515079e-01, + 9.980845447462318e-01, 9.984219884986877e-01, 9.986985391068631e-01, 9.989238611254968e-01, 9.991065660804971e-01, + 9.992542451163898e-01, 9.993735142030505e-01, 9.994700698738658e-01, 9.995487534360048e-01, 9.996136215806155e-01, + 9.996680213292980e-01, 9.997146672907700e-01, 9.997557192777461e-01, 9.997928584573587e-01, 9.998273603841155e-01, + 9.998601634925650e-01, 9.998919319028886e-01, 9.999231117133845e-01, 9.999539803782231e-01, 9.999846913144619e-01, + 1.000015271687402e+00, 1.000045768313827e+00, 1.000076123719886e+00, 1.000106243781657e+00, 1.000136035347070e+00, + 1.000165406619359e+00, 1.000194267530612e+00, 1.000222530102796e+00, 1.000250108793741e+00, 1.000276920825814e+00, + 1.000302886495191e+00, 1.000327929459891e+00, 1.000351977005012e+00, 1.000374960283849e+00, 1.000396814533868e+00, + 1.000417479266803e+00, 1.000436898432418e+00, 1.000455020555724e+00, 1.000471798847772e+00, 1.000487191290310e+00, + 1.000501160694917e+00, 1.000513674737357e+00, 1.000524705968167e+00, 1.000534231800605e+00, 1.000542234477265e+00, + 1.000548701016775e+00, 1.000553623142091e+00, 1.000556997191966e+00, 1.000558824017243e+00, 1.000559108863603e+00, + 1.000557861242456e+00, 1.000555094791586e+00, 1.000550827127188e+00, 1.000545079688822e+00, 1.000537877578802e+00, + 1.000529249397403e+00, 1.000519227075235e+00, 1.000507845704000e+00, 1.000495143366764e+00, 1.000481160968755e+00, + 1.000465942069620e+00, 1.000449532717920e+00, 1.000431981288574e+00, 1.000413338323831e+00, 1.000393656378250e+00, + 1.000372989868060e+00, 1.000351394925194e+00, 1.000328929256167e+00, 1.000305652005906e+00, 1.000281623626542e+00, + 1.000256905751110e+00, 1.000231561072014e+00, 1.000205653224064e+00, 1.000179246671831e+00, 1.000152406601017e+00, + 1.000125198813461e+00, 1.000097689625410e+00, 1.000069945768613e+00, 1.000042034293768e+00, 1.000014022475844e+00, + 9.999859777207831e-01, 9.999579674730398e-01, 9.999300591234549e-01, 9.999023199169207e-01, 9.998748168593201e-01, + 9.998476166232155e-01, 9.998207854517803e-01, 9.997943890604891e-01, 9.997684925361024e-01, 9.997431602325028e-01, + 9.997184556629950e-01, 9.996944413886967e-01, 9.996711789027117e-01, 9.996487285098250e-01, 9.996271492015102e-01, + 9.996064985261154e-01, 9.995868324541498e-01, 9.995682052386838e-01, 9.995506692709443e-01, 9.995342749312822e-01, + 9.995190704357798e-01, 9.995051016788571e-01, 9.994924120723486e-01, 9.994810423816121e-01, 9.994710305593550e-01, + 9.994624115779566e-01, 9.994552172611834e-01, 9.994494761163015e-01, 9.994452131676952e-01, 9.994424497931953e-01, + 9.994412035644367e-01, 9.994414880926250e-01, 9.994433128811957e-01, 9.994466831869019e-01, 9.994515998909221e-01, + 9.994580593816230e-01, 9.994660534506217e-01, 9.994755692038015e-01, 9.994865889889091e-01, 9.994990903413156e-01, + 9.995130459494618e-01, 9.995284236414108e-01, 9.995451863938154e-01, 9.995632923644638e-01, 9.995826949494031e-01, + 9.996033428654485e-01, 9.996251802586674e-01, 9.996481468392096e-01, 9.996721780425870e-01, 9.996972052172600e-01, + 9.997231558380996e-01, 9.997499537450264e-01, 9.997775194058337e-01, 9.998057702019313e-01, 9.998346207354666e-01, + 9.998639831560286e-01, 9.998937675048852e-01, 9.999238820744936e-01, 9.999542337808154e-01, 9.999847285458191e-01, + 1.000015271687393e+00, 1.000045768313818e+00, 1.000076123719878e+00, 1.000106243781648e+00, 1.000136035347061e+00, + 1.000165406619350e+00, 1.000194267530604e+00, 1.000222530102788e+00, 1.000250108793733e+00, 1.000276920825807e+00, + 1.000302886495184e+00, 1.000327929459883e+00, 1.000351977005006e+00, 1.000374960283843e+00, 1.000396814533862e+00, + 1.000417479266798e+00, 1.000436898432413e+00, 1.000455020555719e+00, 1.000471798847767e+00, 1.000487191290306e+00, + 1.000501160694914e+00, 1.000513674737354e+00, 1.000524705968165e+00, 1.000534231800603e+00, 1.000542234477263e+00, + 1.000548701016774e+00, 1.000553623142090e+00, 1.000556997191965e+00, 1.000558824017242e+00, 1.000559108863603e+00, + 1.000557861242456e+00, 1.000555094791587e+00, 1.000550827127188e+00, 1.000545079688823e+00, 1.000537877578803e+00, + 1.000529249397404e+00, 1.000519227075236e+00, 1.000507845704002e+00, 1.000495143366766e+00, 1.000481160968757e+00, + 1.000465942069622e+00, 1.000449532717922e+00, 1.000431981288576e+00, 1.000413338323833e+00, 1.000393656378252e+00, + 1.000372989868062e+00, 1.000351394925196e+00, 1.000328929256169e+00, 1.000305652005908e+00, 1.000281623626544e+00, + 1.000256905751112e+00, 1.000231561072016e+00, 1.000205653224065e+00, 1.000179246671832e+00, 1.000152406601018e+00, + 1.000125198813462e+00, 1.000097689625411e+00, 1.000069945768614e+00, 1.000042034293768e+00, 1.000014022475844e+00, + 9.999859777207829e-01, 9.999579674730393e-01, 9.999300591234543e-01, 9.999023199169199e-01, 9.998748168593190e-01, + 9.998476166232144e-01, 9.998207854517789e-01, 9.997943890604876e-01, 9.997684925361007e-01, 9.997431602325010e-01, + 9.997184556629931e-01, 9.996944413886946e-01, 9.996711789027095e-01, 9.996487285098227e-01, 9.996271492015080e-01, + 9.996064985261129e-01, 9.995868324541474e-01, 9.995682052386815e-01, 9.995506692709419e-01, 9.995342749312801e-01, + 9.995190704357777e-01, 9.995051016788550e-01, 9.994924120723468e-01, 9.994810423816103e-01, 9.994710305593536e-01, + 9.994624115779553e-01, 9.994552172611824e-01, 9.994494761163009e-01, 9.994452131676944e-01, 9.994424497931950e-01, + 9.994412035644368e-01, 9.994414880926255e-01, 9.994433128811966e-01, 9.994466831869030e-01, 9.994515998909239e-01, + 9.994580593816250e-01, 9.994660534506239e-01, 9.994755692038041e-01, 9.994865889889122e-01, 9.994990903413189e-01, + 9.995130459494656e-01, 9.995284236414153e-01, 9.995451863938203e-01, 9.995632923644688e-01, 9.995826949494085e-01, + 9.996033428654543e-01, 9.996251802586735e-01, 9.996481468392161e-01, 9.996721780425940e-01, 9.996972052172670e-01, + 9.997231558381070e-01, 9.997499537450341e-01, 9.997775194058416e-01, 9.998057702019393e-01, 9.998346207354748e-01, + 9.998639831560371e-01, 9.998937675048939e-01, 9.999238820745020e-01, 9.999542337808240e-01, 9.999847285458278e-01, + 1.000015271687402e+00, 1.000045768313827e+00, 1.000076123719886e+00, 1.000106243781657e+00, 1.000136035347070e+00, + 1.000165406619359e+00, 1.000194267530612e+00, 1.000222530102796e+00, 1.000250108793741e+00, 1.000276920825814e+00, + 1.000302886495191e+00, 1.000327929459890e+00, 1.000351977005012e+00, 1.000374960283849e+00, 1.000396814533868e+00, + 1.000417479266803e+00, 1.000436898432418e+00, 1.000455020555724e+00, 1.000471798847772e+00, 1.000487191290310e+00, + 1.000501160694917e+00, 1.000513674737357e+00, 1.000524705968167e+00, 1.000534231800605e+00, 1.000542234477265e+00, + 1.000548701016775e+00, 1.000553623142091e+00, 1.000556997191966e+00, 1.000558824017243e+00, 1.000559108863603e+00, + 1.000557861242456e+00, 1.000555094791586e+00, 1.000550827127188e+00, 1.000545079688822e+00, 1.000537877578802e+00, + 1.000529249397403e+00, 1.000519227075234e+00, 1.000507845704000e+00, 1.000495143366764e+00, 1.000481160968755e+00, + 1.000465942069620e+00, 1.000449532717920e+00, 1.000431981288574e+00, 1.000413338323831e+00, 1.000393656378250e+00, + 1.000372989868060e+00, 1.000351394925194e+00, 1.000328929256167e+00, 1.000305652005906e+00, 1.000281623626542e+00, + 1.000256905751111e+00, 1.000231561072014e+00, 1.000205653224064e+00, 1.000179246671831e+00, 1.000152406601017e+00, + 1.000125198813461e+00, 1.000097689625410e+00, 1.000069945768614e+00, 1.000042034293768e+00, 1.000014022475844e+00, + 9.999859777207832e-01, 9.999579674730399e-01, 9.999300591234550e-01, 9.999023199169208e-01, 9.998748168593202e-01, + 9.998476166232156e-01, 9.998207854517805e-01, 9.997943890604892e-01, 9.997684925361026e-01, 9.997431602325029e-01, + 9.997184556629951e-01, 9.996944413886968e-01, 9.996711789027117e-01, 9.996487285098250e-01, 9.996271492015103e-01, + 9.996064985261155e-01, 9.995868324541498e-01, 9.995682052386839e-01, 9.995506692709443e-01, 9.995342749312823e-01, + 9.995190704357798e-01, 9.995051016788571e-01, 9.994924120723486e-01, 9.994810423816120e-01, 9.994710305593552e-01, + 9.994624115779566e-01, 9.994552172611834e-01, 9.994494761163015e-01, 9.994452131676951e-01, 9.994424497931953e-01, + 9.994412035644367e-01, 9.994414880926250e-01, 9.994433128811958e-01, 9.994466831869019e-01, 9.994515998909221e-01, + 9.994580593816230e-01, 9.994660534506217e-01, 9.994755692038015e-01, 9.994865889889089e-01, 9.994990903413155e-01, + 9.995130459494618e-01, 9.995284236414110e-01, 9.995451863938154e-01, 9.995632923644640e-01, 9.995826949494031e-01, + 9.996033428654485e-01, 9.996251802586674e-01, 9.996481468392096e-01, 9.996721780425870e-01, 9.996972052172600e-01, + 9.997231558380997e-01, 9.997499537450264e-01, 9.997775194058337e-01, 9.998057702019313e-01, 9.998346207354665e-01, + 9.998639831560286e-01, 9.998937675048852e-01, 9.999238820744936e-01, 9.999542337808154e-01, 9.999847285458191e-01, + 1.000015234454879e+00, 1.000045514887559e+00, 1.000075353237462e+00, 1.000104407768116e+00, 1.000132214556229e+00, + 1.000158143563050e+00, 1.000181349852841e+00, 1.000200717764093e+00, 1.000214798354899e+00, 1.000221740822748e+00, + 1.000219218852980e+00, 1.000204353032496e+00, 1.000173630567007e+00, 1.000122823551604e+00, 1.000046906963284e+00, + 9.999399773758973e-01, 9.997951731574873e-01, 9.996045966188434e-01, 9.993592382687311e-01, 9.990489030278769e-01, + 9.986621379953039e-01, 9.981861611823875e-01, 9.976067905662288e-01, 9.969083728962124e-01, 9.960737119427251e-01, + 9.950839963248127e-01, 9.939187277034516e-01, 9.925556509742455e-01, 9.909706891139552e-01, 9.891378864826104e-01, + 9.870293655848442e-01, 9.846153034530920e-01, 9.818639348132027e-01, 9.787415898998961e-01, 9.752127750773143e-01, + 9.712403041791187e-01, 9.667854876397981e-01, 9.618083850218845e-01, 9.562681244917907e-01, 9.501232902622440e-01, + 9.433323761603356e-01, 9.358543004959359e-01, 9.276489745130293e-01, 9.186779141170132e-01, 9.089048824643602e-01, + 8.982965495078461e-01, 8.868231537804969e-01, 8.744591515805539e-01, 8.611838392360764e-01, 8.469819351830896e-01, + 8.318441100567543e-01, 8.157674547284579e-01, 7.987558780821055e-01, 7.808204281831013e-01, 7.619795322485697e-01, + 7.422591523986999e-01, 7.216928555056540e-01, 7.003217965330363e-01, 6.781946155731466e-01, 6.553672493579565e-01, + 6.319026583753357e-01, 6.078704709095413e-01, 5.833465453994711e-01, 5.584124525334641e-01, 5.331548785464441e-01, + 5.076649513306994e-01, 4.820374912962984e-01, 4.563701895024020e-01, 4.307627165039317e-01, 4.053157666856800e-01, + 3.801300446346412e-01, 3.553052023472212e-01, 3.309387387548210e-01, 3.071248760994941e-01, 2.839534309593199e-01, + 2.615087010038701e-01, 2.398683915856861e-01, 2.191026087292818e-01, 1.992729466284019e-01, 1.804316980820018e-01, + 1.626212151220100e-01, 1.458734442426148e-01, 1.302096560997370e-01, 1.156403834405376e-01, 1.021655736434582e-01, + 8.977495404596501e-02, 7.844859976518601e-02, 6.815768558157265e-02, 5.886539624579484e-02, 5.052796378898961e-02, + 4.309579643342800e-02, 3.651466171052548e-02, 3.072688641085486e-02, 2.567253786455677e-02, 2.129055449466347e-02, + 1.751979822585132e-02, 1.430000675209340e-02, 1.157262945800897e-02, 9.281536579910191e-03, 7.373596677207363e-03, + 5.799122432483531e-03, 4.512189056010577e-03, 3.470833055336534e-03, 2.637141819806632e-03, 1.977246386436426e-03, + 1.461230953040205e-03, 1.062973263413438e-03, 7.599299954798238e-04, 5.328808285940163e-04, 3.656440417062249e-04, + 2.447753867250028e-04, 1.592606718286519e-04, 1.002110509628055e-04, 6.056851356108083e-05, 3.482755929907460e-05, + 1.877757338165862e-05, 9.269020516017977e-06, 4.005234147116555e-06, 1.359891615054068e-06, 2.067694412143206e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + +const LC3_FLOAT MDCT_HRA_WINDOW_960_10ms[1920] = { + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 6.663107991278473e-08, 2.237239208214098e-07, 4.875418283123564e-07, 8.996727135884617e-07, 1.511418282137696e-06, + 2.385908181307981e-06, 3.600021534325060e-06, 5.246458929559746e-06, 7.435999429480928e-06, 1.029995277226023e-05, + 1.399281202683861e-05, 1.869510977726803e-05, 2.461647918005920e-05, 3.199891951615131e-05, 4.112026404149671e-05, + 5.229784600131515e-05, 6.589235661010597e-05, 8.231188661821365e-05, 1.020161407958678e-04, 1.255208122795613e-04, + 1.534021012578998e-04, 1.863013599410517e-04, 2.249298431778123e-04, 2.700735414768832e-04, 3.225980705756125e-04, + 3.834535891028970e-04, 4.536797133272969e-04, 5.344103954917697e-04, 6.268787298389575e-04, 7.324216481524320e-04, + 8.524844645071808e-04, 9.886252269645022e-04, 1.142518832190136e-03, 1.315960857447457e-03, 1.510871063146860e-03, + 1.729296518144556e-03, 1.973414299303950e-03, 2.245533716484770e-03, 2.548098014131402e-03, 2.883685501012940e-03, + 3.255010060441685e-03, 3.664920994479873e-03, 4.116402157249738e-03, 4.612570334499312e-03, 5.156672829053223e-03, + 5.752084214696966e-03, 6.402302224405338e-03, 7.110942742626702e-03, 7.881733875566514e-03, 8.718509078064964e-03, + 9.625199320718177e-03, 1.060582428632988e-02, 1.166448259057781e-02, 1.280534102790626e-02, 1.403262285008227e-02, + 1.535059509154052e-02, 1.676355496255211e-02, 1.827581533833950e-02, 1.989168937947954e-02, 2.161547432623578e-02, + 2.345143451678970e-02, 2.540378368664082e-02, 2.747666661366220e-02, 2.967414018037076e-02, 3.200015393184128e-02, + 3.445853021429810e-02, 3.705294398569962e-02, 3.978690239552551e-02, 4.266372423642605e-02, 4.568651937534197e-02, + 4.885816827608890e-02, 5.218130172917755e-02, 5.565828090775238e-02, 5.929117787093344e-02, 6.308175663749782e-02, + 6.703145495369379e-02, 7.114136687902073e-02, 7.541222631299167e-02, 7.984439158421140e-02, 8.443783122053150e-02, + 8.919211101557852e-02, 9.410638250258946e-02, 9.917937294123873e-02, 1.044093769170137e-01, 1.097942496457128e-01, + 1.153314020678296e-01, 1.210177978089837e-01, 1.268499520732061e-01, 1.328239325258333e-01, 1.389353622120686e-01, + 1.451794245459895e-01, 1.515508703929904e-01, 1.580440272564225e-01, 1.646528105666080e-01, 1.713707370575420e-01, + 1.781909402035578e-01, 1.851061876750831e-01, 1.921089007594860e-01, 1.991911756799545e-01, 2.063448067325118e-01, + 2.135613111487021e-01, 2.208319555793100e-01, 2.281477840827779e-01, 2.354996474908733e-01, 2.428782340136974e-01, + 2.502741009364257e-01, 2.576777072513037e-01, 2.650794470604564e-01, 2.724696835780986e-01, 2.798387835547953e-01, + 2.871771519416024e-01, 2.944752666082350e-01, 3.017237129269402e-01, 3.089132180325088e-01, 3.160346845688595e-01, + 3.230792237339257e-01, 3.300381874371329e-01, 3.369031993875939e-01, 3.436661849362722e-01, 3.503193995017128e-01, + 3.568555192112148e-01, 3.632675601002685e-01, 3.695489358061075e-01, 3.756935099828519e-01, 3.816956001322418e-01, + 3.875499962002574e-01, 3.932519766094684e-01, 3.987973219750102e-01, 4.041823264714043e-01, 4.094038068104935e-01, + 4.144591088030795e-01, 4.193461114921915e-01, 4.240632288619702e-01, 4.286094091423471e-01, 4.329841317457969e-01, + 4.371874018882834e-01, 4.412197429619175e-01, 4.450821867417134e-01, 4.487762615229755e-01, 4.523039782991779e-01, + 4.556678151025579e-01, 4.588706996409412e-01, 4.619159903744011e-01, 4.648074561841559e-01, 4.675492547935124e-01, + 4.701459101065887e-01, 4.726022886349306e-01, 4.749235751849055e-01, 4.771152479798792e-01, 4.791830533906173e-01, + 4.811329804451050e-01, 4.829712352850382e-01, 4.847042157306455e-01, 4.863384861083030e-01, 4.878807524866530e-01, + 4.893378384567565e-01, 4.907166615802867e-01, 4.920242106170628e-01, 4.932675236294833e-01, 4.944536670468351e-01, + 4.955897157572258e-01, 4.966827342792363e-01, 4.977397590495528e-01, 4.987677818470457e-01, 4.997737343582849e-01, + 5.007644738745453e-01, 5.017467700962179e-01, 5.027272930074345e-01, 5.037126017718407e-01, 5.047091345900308e-01, + 5.057231994503223e-01, 5.067609656974670e-01, 5.078284563386384e-01, 5.089315410026908e-01, 5.100759294672467e-01, + 5.112671656686335e-01, 5.125106221119896e-01, 5.138114946028988e-01, 5.151747972275419e-01, 5.166053575154047e-01, + 5.181078117268841e-01, 5.196866002174090e-01, 5.213459628397580e-01, 5.230899343568223e-01, 5.249223398478975e-01, + 5.268467901024086e-01, 5.288666770055838e-01, 5.309851689306879e-01, 5.332052061618728e-01, 5.355294963802417e-01, + 5.379605102532377e-01, 5.405004771737987e-01, 5.431513812007881e-01, 5.459149572559273e-01, 5.487926876348163e-01, + 5.517857988905945e-01, 5.548952591484511e-01, 5.581217759075547e-01, 5.614657943841375e-01, 5.649274964455743e-01, + 5.685068001804389e-01, 5.722033601438381e-01, 5.760165683110121e-01, 5.799455557653441e-01, 5.839891951397580e-01, + 5.881461038230944e-01, 5.924146479356704e-01, 5.967929470708762e-01, 6.012788797925822e-01, 6.058700898713546e-01, + 6.105639932361040e-01, 6.153577856119751e-01, 6.202484508099709e-01, 6.252327696291247e-01, 6.303073293279928e-01, + 6.354685336188206e-01, 6.407126131349797e-01, 6.460356363201389e-01, 6.514335206861067e-01, 6.569020443853303e-01, + 6.624368580436263e-01, 6.680334967987880e-01, 6.736873924912369e-01, 6.793938859538112e-01, 6.851482393490396e-01, + 6.909456485038137e-01, 6.967812551932001e-01, 7.026501593271524e-01, 7.085474309960862e-01, 7.144681223336159e-01, + 7.204072791571976e-01, 7.263599523499238e-01, 7.323212089493037e-01, 7.382861429114533e-01, 7.442498855217515e-01, + 7.502076154256456e-01, 7.561545682559222e-01, 7.620860458353852e-01, 7.679974249364871e-01, 7.738841655820752e-01, + 7.797418188739772e-01, 7.855660343387494e-01, 7.913525667824293e-01, 7.970972826487233e-01, 8.027961658775241e-01, + 8.084453232632074e-01, 8.140409893145931e-01, 8.195795306209357e-01, 8.250574497306905e-01, 8.304713885521608e-01, + 8.358181312874381e-01, 8.410946069132281e-01, 8.462978912242891e-01, 8.514252084571686e-01, 8.564739325137894e-01, + 8.614415878060635e-01, 8.663258497442113e-01, 8.711245448926651e-01, 8.758356508184248e-01, 8.804572956574126e-01, + 8.849877574247438e-01, 8.894254630948657e-01, 8.937689874771898e-01, 8.980170519121489e-01, 9.021685228115252e-01, + 9.062224100654551e-01, 9.101778653366538e-01, 9.140341802602550e-01, 9.177907845650995e-01, 9.214472441295430e-01, + 9.250032589817625e-01, 9.284586612513364e-01, 9.318134130755062e-01, 9.350676044601444e-01, 9.382214510920930e-01, + 9.412752920963378e-01, 9.442295877284584e-01, 9.470849169901138e-01, 9.498419751530142e-01, 9.525015711749794e-01, + 9.550646249903935e-01, 9.575321646566392e-01, 9.599053233380030e-01, 9.621853361091064e-01, 9.643735365611265e-01, + 9.664713531959190e-01, 9.684803055955929e-01, 9.704020003580881e-01, 9.722381267927611e-01, 9.739904523738324e-01, + 9.756608179536774e-01, 9.772511327422573e-01, 9.787633690633392e-01, 9.801995569024828e-01, 9.815617782659093e-01, + 9.828521613732500e-01, 9.840728747106564e-01, 9.852261209738314e-01, 9.863141309330354e-01, 9.873391572540936e-01, + 9.883034683107520e-01, 9.892093420244598e-01, 9.900590597677280e-01, 9.908549003667192e-01, 9.915991342376211e-01, + 9.922940176897662e-01, 9.929417874263897e-01, 9.935446552714569e-01, 9.941048031482164e-01, 9.946243783321176e-01, + 9.951054889975415e-01, 9.955502000745265e-01, 9.959605294283782e-01, 9.963384443718103e-01, 9.966858585161255e-01, + 9.970046289649677e-01, 9.972965538513794e-01, 9.975633702163375e-01, 9.978067522246161e-01, 9.980283097117545e-01, + 9.982295870540839e-01, 9.984120623522111e-01, 9.985771469170162e-01, 9.987261850461071e-01, 9.988604540777616e-01, + 9.989811647086401e-01, 9.990894615609515e-01, 9.991864239842999e-01, 9.992730670770456e-01, 9.993503429117423e-01, + 9.994191419489804e-01, 9.994802946237851e-01, 9.995345730885834e-01, 9.995826930966561e-01, 9.996253160099111e-01, + 9.996630509147824e-01, 9.996964568300586e-01, 9.997260449905023e-01, 9.997522811902100e-01, 9.997755881698448e-01, + 9.997963480321130e-01, 9.998149046701891e-01, 9.998315661942099e-01, 9.998466073415005e-01, 9.998602718567984e-01, + 9.998727748295070e-01, 9.998843049758280e-01, 9.998950268545727e-01, 9.999050830064863e-01, 9.999145960080379e-01, + 9.999236704318017e-01, 9.999323947068164e-01, 9.999408428735685e-01, 9.999490762295546e-01, 9.999571448627051e-01, + 9.999650890712967e-01, 9.999729406705412e-01, 9.999807241886484e-01, 9.999884579652744e-01, 9.999961552850937e-01, + 1.000003818641721e+00, 1.000011453001950e+00, 1.000019078522643e+00, 1.000026689281996e+00, 1.000034279373492e+00, + 1.000041842912049e+00, 1.000049374040126e+00, 1.000056866933785e+00, 1.000064315808680e+00, 1.000071714925990e+00, + 1.000079058598250e+00, 1.000086341195099e+00, 1.000093557148926e+00, 1.000100700960395e+00, 1.000107767203853e+00, + 1.000114750532603e+00, 1.000121645684037e+00, 1.000128447484626e+00, 1.000135150854742e+00, 1.000141750813332e+00, + 1.000148242482408e+00, 1.000154621091371e+00, 1.000160881981147e+00, 1.000167020608141e+00, 1.000173032547996e+00, + 1.000178913499161e+00, 1.000184659286256e+00, 1.000190265863238e+00, 1.000195729316362e+00, 1.000201045866939e+00, + 1.000206211873884e+00, 1.000211223836059e+00, 1.000216078394407e+00, 1.000220772333881e+00, 1.000225302585160e+00, + 1.000229666226172e+00, 1.000233860483401e+00, 1.000237882733002e+00, 1.000241730501714e+00, 1.000245401467578e+00, + 1.000248893460465e+00, 1.000252204462412e+00, 1.000255332607784e+00, 1.000258276183243e+00, 1.000261033627556e+00, + 1.000263603531226e+00, 1.000265984635963e+00, 1.000268175833992e+00, 1.000270176167217e+00, 1.000271984826231e+00, + 1.000273601149186e+00, 1.000275024620537e+00, 1.000276254869646e+00, 1.000277291669272e+00, 1.000278134933949e+00, + 1.000278784718248e+00, 1.000279241214938e+00, 1.000279504753058e+00, 1.000279575795894e+00, 1.000279454938873e+00, + 1.000279142907386e+00, 1.000278640554535e+00, 1.000277948858822e+00, 1.000277068921773e+00, 1.000276001965517e+00, + 1.000274749330316e+00, 1.000273312472054e+00, 1.000271692959694e+00, 1.000269892472703e+00, 1.000267912798451e+00, + 1.000265755829598e+00, 1.000263423561457e+00, 1.000260918089352e+00, 1.000258241605975e+00, 1.000255396398729e+00, + 1.000252384847089e+00, 1.000249209419954e+00, 1.000245872673023e+00, 1.000242377246174e+00, 1.000238725860863e+00, + 1.000234921317548e+00, 1.000230966493118e+00, 1.000226864338370e+00, 1.000222617875491e+00, 1.000218230195586e+00, + 1.000213704456221e+00, 1.000209043879012e+00, 1.000204251747240e+00, 1.000199331403501e+00, 1.000194286247397e+00, + 1.000189119733258e+00, 1.000183835367906e+00, 1.000178436708454e+00, 1.000172927360150e+00, 1.000167310974248e+00, + 1.000161591245930e+00, 1.000155771912258e+00, 1.000149856750174e+00, 1.000143849574523e+00, 1.000137754236130e+00, + 1.000131574619904e+00, 1.000125314642979e+00, 1.000118978252895e+00, 1.000112569425805e+00, 1.000106092164726e+00, + 1.000099550497809e+00, 1.000092948476653e+00, 1.000086290174636e+00, 1.000079579685283e+00, 1.000072821120651e+00, + 1.000066018609750e+00, 1.000059176296973e+00, 1.000052298340563e+00, 1.000045388911081e+00, 1.000038452189909e+00, + 1.000031492367753e+00, 1.000024513643172e+00, 1.000017520221111e+00, 1.000010516311443e+00, 1.000003506127529e+00, + 9.999964938847642e-01, 9.999894837991481e-01, 9.999824800858419e-01, 9.999754869577321e-01, 9.999685086239848e-01, + 9.999615492886049e-01, 9.999546131489783e-01, 9.999477043944101e-01, 9.999408272046536e-01, 9.999339857484195e-01, + 9.999271841818784e-01, 9.999204266471391e-01, 9.999137172707154e-01, 9.999070601619628e-01, 9.999004594115060e-01, + 9.998939190896278e-01, 9.998874432446441e-01, 9.998810359012452e-01, 9.998747010588128e-01, 9.998684426896991e-01, + 9.998622647374855e-01, 9.998561711152009e-01, 9.998501657035072e-01, 9.998442523488513e-01, 9.998384348615825e-01, + 9.998327170140316e-01, 9.998271025385516e-01, 9.998215951255243e-01, 9.998161984213253e-01, 9.998109160262525e-01, + 9.998057514924167e-01, 9.998007083215891e-01, 9.997957899630165e-01, 9.997909998111978e-01, 9.997863412036158e-01, + 9.997818174184411e-01, 9.997774316721972e-01, 9.997731871173844e-01, 9.997690868400847e-01, 9.997651338575159e-01, + 9.997613311155714e-01, 9.997576814863203e-01, 9.997541877654884e-01, 9.997508526699078e-01, 9.997476788349500e-01, + 9.997446688119369e-01, 9.997418250655351e-01, 9.997391499711387e-01, 9.997366458122413e-01, 9.997343147777986e-01, + 9.997321589595916e-01, 9.997301803495896e-01, 9.997283808373202e-01, 9.997267622072430e-01, 9.997253261361446e-01, + 9.997240741905490e-01, 9.997230078241506e-01, 9.997221283752786e-01, 9.997214370643954e-01, 9.997209349916318e-01, + 9.997206231343719e-01, 9.997205023448855e-01, 9.997205733480192e-01, 9.997208367389500e-01, 9.997212929810099e-01, + 9.997219424035818e-01, 9.997227852000825e-01, 9.997238214260301e-01, 9.997250509972079e-01, 9.997264736879267e-01, + 9.997280891294001e-01, 9.997298968082279e-01, 9.997318960650045e-01, 9.997340860930513e-01, 9.997364659372833e-01, + 9.997390344932165e-01, 9.997417905061193e-01, 9.997447325703145e-01, 9.997478591286405e-01, 9.997511684720751e-01, + 9.997546587395272e-01, 9.997583279177997e-01, 9.997621738417346e-01, 9.997661941945379e-01, 9.997703865082921e-01, + 9.997747481646607e-01, 9.997792763957842e-01, 9.997839682853786e-01, 9.997888207700281e-01, 9.997938306406862e-01, + 9.997989945443773e-01, 9.998043089861064e-01, 9.998097703309746e-01, 9.998153748065003e-01, 9.998211185051531e-01, + 9.998269973870870e-01, 9.998330072830846e-01, 9.998391438977015e-01, 9.998454028126147e-01, 9.998517794901678e-01, + 9.998582692771129e-01, 9.998648674085433e-01, 9.998715690120116e-01, 9.998783691118356e-01, 9.998852626335712e-01, + 9.998922444086656e-01, 9.998993091792668e-01, 9.999064516031954e-01, 9.999136662590592e-01, 9.999209476515181e-01, + 9.999282902166716e-01, 9.999356883275767e-01, 9.999431362998797e-01, 9.999506283975492e-01, 9.999581588387069e-01, + 9.999657218015428e-01, 9.999733114303027e-01, 9.999809218413399e-01, 9.999885471292198e-01, 9.999961813728609e-01, + 1.000003818641712e+00, 1.000011453001941e+00, 1.000019078522634e+00, 1.000026689281987e+00, 1.000034279373484e+00, + 1.000041842912040e+00, 1.000049374040118e+00, 1.000056866933776e+00, 1.000064315808672e+00, 1.000071714925982e+00, + 1.000079058598242e+00, 1.000086341195091e+00, 1.000093557148918e+00, 1.000100700960387e+00, 1.000107767203845e+00, + 1.000114750532595e+00, 1.000121645684029e+00, 1.000128447484618e+00, 1.000135150854734e+00, 1.000141750813325e+00, + 1.000148242482401e+00, 1.000154621091364e+00, 1.000160881981140e+00, 1.000167020608134e+00, 1.000173032547989e+00, + 1.000178913499155e+00, 1.000184659286250e+00, 1.000190265863232e+00, 1.000195729316356e+00, 1.000201045866933e+00, + 1.000206211873878e+00, 1.000211223836054e+00, 1.000216078394402e+00, 1.000220772333876e+00, 1.000225302585155e+00, + 1.000229666226167e+00, 1.000233860483396e+00, 1.000237882732998e+00, 1.000241730501710e+00, 1.000245401467574e+00, + 1.000248893460461e+00, 1.000252204462409e+00, 1.000255332607781e+00, 1.000258276183240e+00, 1.000261033627553e+00, + 1.000263603531224e+00, 1.000265984635960e+00, 1.000268175833990e+00, 1.000270176167215e+00, 1.000271984826229e+00, + 1.000273601149185e+00, 1.000275024620536e+00, 1.000276254869644e+00, 1.000277291669271e+00, 1.000278134933948e+00, + 1.000278784718247e+00, 1.000279241214938e+00, 1.000279504753058e+00, 1.000279575795894e+00, 1.000279454938873e+00, + 1.000279142907386e+00, 1.000278640554536e+00, 1.000277948858822e+00, 1.000277068921773e+00, 1.000276001965517e+00, + 1.000274749330316e+00, 1.000273312472055e+00, 1.000271692959695e+00, 1.000269892472704e+00, 1.000267912798453e+00, + 1.000265755829599e+00, 1.000263423561458e+00, 1.000260918089354e+00, 1.000258241605976e+00, 1.000255396398731e+00, + 1.000252384847091e+00, 1.000249209419956e+00, 1.000245872673025e+00, 1.000242377246176e+00, 1.000238725860866e+00, + 1.000234921317550e+00, 1.000230966493120e+00, 1.000226864338372e+00, 1.000222617875493e+00, 1.000218230195589e+00, + 1.000213704456224e+00, 1.000209043879015e+00, 1.000204251747242e+00, 1.000199331403503e+00, 1.000194286247399e+00, + 1.000189119733260e+00, 1.000183835367908e+00, 1.000178436708457e+00, 1.000172927360152e+00, 1.000167310974250e+00, + 1.000161591245932e+00, 1.000155771912260e+00, 1.000149856750176e+00, 1.000143849574525e+00, 1.000137754236132e+00, + 1.000131574619906e+00, 1.000125314642981e+00, 1.000118978252897e+00, 1.000112569425807e+00, 1.000106092164727e+00, + 1.000099550497811e+00, 1.000092948476655e+00, 1.000086290174638e+00, 1.000079579685284e+00, 1.000072821120652e+00, + 1.000066018609751e+00, 1.000059176296974e+00, 1.000052298340564e+00, 1.000045388911082e+00, 1.000038452189910e+00, + 1.000031492367754e+00, 1.000024513643172e+00, 1.000017520221111e+00, 1.000010516311444e+00, 1.000003506127529e+00, + 9.999964938847641e-01, 9.999894837991480e-01, 9.999824800858417e-01, 9.999754869577318e-01, 9.999685086239841e-01, + 9.999615492886044e-01, 9.999546131489776e-01, 9.999477043944092e-01, 9.999408272046527e-01, 9.999339857484185e-01, + 9.999271841818773e-01, 9.999204266471379e-01, 9.999137172707140e-01, 9.999070601619615e-01, 9.999004594115044e-01, + 9.998939190896263e-01, 9.998874432446425e-01, 9.998810359012436e-01, 9.998747010588109e-01, 9.998684426896972e-01, + 9.998622647374836e-01, 9.998561711151988e-01, 9.998501657035050e-01, 9.998442523488493e-01, 9.998384348615804e-01, + 9.998327170140294e-01, 9.998271025385493e-01, 9.998215951255222e-01, 9.998161984213230e-01, 9.998109160262503e-01, + 9.998057514924145e-01, 9.998007083215869e-01, 9.997957899630143e-01, 9.997909998111957e-01, 9.997863412036135e-01, + 9.997818174184390e-01, 9.997774316721950e-01, 9.997731871173822e-01, 9.997690868400825e-01, 9.997651338575136e-01, + 9.997613311155693e-01, 9.997576814863183e-01, 9.997541877654863e-01, 9.997508526699059e-01, 9.997476788349481e-01, + 9.997446688119350e-01, 9.997418250655334e-01, 9.997391499711371e-01, 9.997366458122399e-01, 9.997343147777973e-01, + 9.997321589595902e-01, 9.997301803495884e-01, 9.997283808373191e-01, 9.997267622072419e-01, 9.997253261361438e-01, + 9.997240741905483e-01, 9.997230078241500e-01, 9.997221283752783e-01, 9.997214370643952e-01, 9.997209349916318e-01, + 9.997206231343722e-01, 9.997205023448859e-01, 9.997205733480196e-01, 9.997208367389504e-01, 9.997212929810105e-01, + 9.997219424035826e-01, 9.997227852000836e-01, 9.997238214260314e-01, 9.997250509972092e-01, 9.997264736879284e-01, + 9.997280891294021e-01, 9.997298968082300e-01, 9.997318960650067e-01, 9.997340860930538e-01, 9.997364659372859e-01, + 9.997390344932195e-01, 9.997417905061224e-01, 9.997447325703176e-01, 9.997478591286439e-01, 9.997511684720787e-01, + 9.997546587395311e-01, 9.997583279178037e-01, 9.997621738417388e-01, 9.997661941945423e-01, 9.997703865082966e-01, + 9.997747481646656e-01, 9.997792763957892e-01, 9.997839682853837e-01, 9.997888207700335e-01, 9.997938306406916e-01, + 9.997989945443829e-01, 9.998043089861125e-01, 9.998097703309806e-01, 9.998153748065066e-01, 9.998211185051595e-01, + 9.998269973870937e-01, 9.998330072830913e-01, 9.998391438977084e-01, 9.998454028126217e-01, 9.998517794901752e-01, + 9.998582692771203e-01, 9.998648674085506e-01, 9.998715690120191e-01, 9.998783691118432e-01, 9.998852626335790e-01, + 9.998922444086736e-01, 9.998993091792749e-01, 9.999064516032034e-01, 9.999136662590675e-01, 9.999209476515264e-01, + 9.999282902166798e-01, 9.999356883275852e-01, 9.999431362998885e-01, 9.999506283975580e-01, 9.999581588387155e-01, + 9.999657218015514e-01, 9.999733114303114e-01, 9.999809218413486e-01, 9.999885471292286e-01, 9.999961813728698e-01, + 1.000003818641721e+00, 1.000011453001950e+00, 1.000019078522643e+00, 1.000026689281996e+00, 1.000034279373492e+00, + 1.000041842912049e+00, 1.000049374040126e+00, 1.000056866933785e+00, 1.000064315808680e+00, 1.000071714925990e+00, + 1.000079058598250e+00, 1.000086341195099e+00, 1.000093557148926e+00, 1.000100700960395e+00, 1.000107767203853e+00, + 1.000114750532602e+00, 1.000121645684037e+00, 1.000128447484626e+00, 1.000135150854742e+00, 1.000141750813332e+00, + 1.000148242482408e+00, 1.000154621091371e+00, 1.000160881981147e+00, 1.000167020608141e+00, 1.000173032547996e+00, + 1.000178913499161e+00, 1.000184659286256e+00, 1.000190265863238e+00, 1.000195729316362e+00, 1.000201045866939e+00, + 1.000206211873884e+00, 1.000211223836059e+00, 1.000216078394407e+00, 1.000220772333881e+00, 1.000225302585160e+00, + 1.000229666226172e+00, 1.000233860483401e+00, 1.000237882733002e+00, 1.000241730501714e+00, 1.000245401467578e+00, + 1.000248893460465e+00, 1.000252204462412e+00, 1.000255332607784e+00, 1.000258276183243e+00, 1.000261033627556e+00, + 1.000263603531226e+00, 1.000265984635963e+00, 1.000268175833992e+00, 1.000270176167217e+00, 1.000271984826231e+00, + 1.000273601149187e+00, 1.000275024620537e+00, 1.000276254869646e+00, 1.000277291669272e+00, 1.000278134933949e+00, + 1.000278784718248e+00, 1.000279241214938e+00, 1.000279504753058e+00, 1.000279575795894e+00, 1.000279454938873e+00, + 1.000279142907386e+00, 1.000278640554535e+00, 1.000277948858822e+00, 1.000277068921773e+00, 1.000276001965517e+00, + 1.000274749330316e+00, 1.000273312472054e+00, 1.000271692959694e+00, 1.000269892472703e+00, 1.000267912798451e+00, + 1.000265755829598e+00, 1.000263423561457e+00, 1.000260918089352e+00, 1.000258241605975e+00, 1.000255396398729e+00, + 1.000252384847089e+00, 1.000249209419954e+00, 1.000245872673023e+00, 1.000242377246174e+00, 1.000238725860863e+00, + 1.000234921317548e+00, 1.000230966493118e+00, 1.000226864338370e+00, 1.000222617875491e+00, 1.000218230195586e+00, + 1.000213704456221e+00, 1.000209043879013e+00, 1.000204251747240e+00, 1.000199331403501e+00, 1.000194286247397e+00, + 1.000189119733258e+00, 1.000183835367906e+00, 1.000178436708454e+00, 1.000172927360150e+00, 1.000167310974248e+00, + 1.000161591245930e+00, 1.000155771912258e+00, 1.000149856750174e+00, 1.000143849574523e+00, 1.000137754236130e+00, + 1.000131574619904e+00, 1.000125314642979e+00, 1.000118978252895e+00, 1.000112569425805e+00, 1.000106092164726e+00, + 1.000099550497809e+00, 1.000092948476653e+00, 1.000086290174636e+00, 1.000079579685283e+00, 1.000072821120651e+00, + 1.000066018609750e+00, 1.000059176296973e+00, 1.000052298340563e+00, 1.000045388911081e+00, 1.000038452189909e+00, + 1.000031492367753e+00, 1.000024513643172e+00, 1.000017520221111e+00, 1.000010516311443e+00, 1.000003506127529e+00, + 9.999964938847643e-01, 9.999894837991482e-01, 9.999824800858421e-01, 9.999754869577322e-01, 9.999685086239848e-01, + 9.999615492886050e-01, 9.999546131489783e-01, 9.999477043944101e-01, 9.999408272046536e-01, 9.999339857484195e-01, + 9.999271841818784e-01, 9.999204266471392e-01, 9.999137172707154e-01, 9.999070601619630e-01, 9.999004594115060e-01, + 9.998939190896279e-01, 9.998874432446442e-01, 9.998810359012452e-01, 9.998747010588128e-01, 9.998684426896991e-01, + 9.998622647374856e-01, 9.998561711152009e-01, 9.998501657035073e-01, 9.998442523488514e-01, 9.998384348615826e-01, + 9.998327170140316e-01, 9.998271025385517e-01, 9.998215951255245e-01, 9.998161984213253e-01, 9.998109160262525e-01, + 9.998057514924167e-01, 9.998007083215890e-01, 9.997957899630168e-01, 9.997909998111979e-01, 9.997863412036158e-01, + 9.997818174184412e-01, 9.997774316721972e-01, 9.997731871173845e-01, 9.997690868400848e-01, 9.997651338575160e-01, + 9.997613311155714e-01, 9.997576814863203e-01, 9.997541877654884e-01, 9.997508526699078e-01, 9.997476788349500e-01, + 9.997446688119369e-01, 9.997418250655351e-01, 9.997391499711387e-01, 9.997366458122413e-01, 9.997343147777986e-01, + 9.997321589595916e-01, 9.997301803495896e-01, 9.997283808373202e-01, 9.997267622072429e-01, 9.997253261361446e-01, + 9.997240741905490e-01, 9.997230078241506e-01, 9.997221283752786e-01, 9.997214370643954e-01, 9.997209349916318e-01, + 9.997206231343720e-01, 9.997205023448855e-01, 9.997205733480192e-01, 9.997208367389500e-01, 9.997212929810099e-01, + 9.997219424035817e-01, 9.997227852000825e-01, 9.997238214260302e-01, 9.997250509972079e-01, 9.997264736879269e-01, + 9.997280891294001e-01, 9.997298968082279e-01, 9.997318960650045e-01, 9.997340860930511e-01, 9.997364659372833e-01, + 9.997390344932165e-01, 9.997417905061193e-01, 9.997447325703143e-01, 9.997478591286405e-01, 9.997511684720751e-01, + 9.997546587395272e-01, 9.997583279177997e-01, 9.997621738417345e-01, 9.997661941945379e-01, 9.997703865082921e-01, + 9.997747481646605e-01, 9.997792763957843e-01, 9.997839682853786e-01, 9.997888207700281e-01, 9.997938306406862e-01, + 9.997989945443773e-01, 9.998043089861064e-01, 9.998097703309746e-01, 9.998153748065003e-01, 9.998211185051530e-01, + 9.998269973870870e-01, 9.998330072830846e-01, 9.998391438977015e-01, 9.998454028126147e-01, 9.998517794901678e-01, + 9.998582692771129e-01, 9.998648674085431e-01, 9.998715690120116e-01, 9.998783691118356e-01, 9.998852626335712e-01, + 9.998922444086656e-01, 9.998993091792668e-01, 9.999064516031954e-01, 9.999136662590593e-01, 9.999209476515181e-01, + 9.999282902166716e-01, 9.999356883275767e-01, 9.999431362998797e-01, 9.999506283975492e-01, 9.999581588387069e-01, + 9.999657218015426e-01, 9.999733114303028e-01, 9.999809218413399e-01, 9.999885471292198e-01, 9.999961813728609e-01, + 1.000003792553732e+00, 1.000011363835885e+00, 1.000018880862106e+00, 1.000026318501453e+00, 1.000033646597102e+00, + 1.000040828844329e+00, 1.000047821703262e+00, 1.000054573213544e+00, 1.000061021697840e+00, 1.000067094351168e+00, + 1.000072705715621e+00, 1.000077756041457e+00, 1.000082129536869e+00, 1.000085692509860e+00, 1.000088291406840e+00, + 1.000089750753633e+00, 1.000089871005573e+00, 1.000088426314299e+00, 1.000085162219593e+00, 1.000079793275302e+00, + 1.000072000618805e+00, 1.000061429493851e+00, 1.000047686736686e+00, 1.000030338235356e+00, 1.000008906371822e+00, + 9.999828674561138e-01, 9.999516491611377e-01, 9.999146279660260e-01, 9.998711266149775e-01, 9.998204115975446e-01, + 9.997616906551822e-01, 9.996941103176716e-01, 9.996167534717882e-01, 9.995286369633262e-01, 9.994287092323502e-01, + 9.993158479803570e-01, 9.991888578669340e-01, 9.990464682325365e-01, 9.988873308431691e-01, 9.987100176521666e-01, + 9.985130185738464e-01, 9.982947392636853e-01, 9.980534988998219e-01, 9.977875279611558e-01, 9.974949659981255e-01, + 9.971738593934303e-01, 9.968221591115168e-01, 9.964377184376065e-01, 9.960182907094022e-01, 9.955615270473709e-01, + 9.950649740926601e-01, 9.945260717652322e-01, 9.939421510586981e-01, 9.933104318925129e-01, 9.926280210466711e-01, + 9.918919102086680e-01, 9.910989741672799e-01, 9.902459691925082e-01, 9.893295316457497e-01, 9.883461768687914e-01, + 9.872922984044433e-01, 9.861641676054160e-01, 9.849579336912377e-01, 9.836696243155244e-01, 9.822951467075759e-01, + 9.808302894530008e-01, 9.792707249777252e-01, 9.776120127982821e-01, 9.758496035985741e-01, 9.739788441893990e-01, + 9.719949834018297e-01, 9.698931789591444e-01, 9.676685053644012e-01, 9.653159628320954e-01, 9.628304872826687e-01, + 9.602069614081798e-01, 9.574402268063275e-01, 9.545250971684157e-01, 9.514563724950412e-01, 9.482288543014010e-01, + 9.448373617624480e-01, 9.412767487368542e-01, 9.375419215980740e-01, 9.336278577909594e-01, 9.295296250234834e-01, + 9.252424009953755e-01, 9.207614935589523e-01, 9.160823612022024e-01, 9.112006337403594e-01, 9.061121330997502e-01, + 9.008128940766279e-01, 8.952991849539681e-01, 8.895675278607562e-01, 8.836147187609806e-01, 8.774378469633509e-01, + 8.710343140474714e-01, 8.644018521077256e-01, 8.575385412223282e-01, 8.504428260617042e-01, 8.431135315574496e-01, + 8.355498775604459e-01, 8.277514924241404e-01, 8.197184254564199e-01, 8.114511581907922e-01, 8.029506144346715e-01, + 7.942181690593274e-01, 7.852556555024425e-01, 7.760653719601955e-01, 7.666500862512726e-01, 7.570130393401874e-01, + 7.471579475117688e-01, 7.370890031926083e-01, 7.268108744186758e-01, 7.163287029512231e-01, 7.056481010455187e-01, + 6.947751468789124e-01, 6.837163786462801e-01, 6.724787873320510e-01, 6.610698081688499e-01, 6.494973107933384e-01, + 6.377695881101478e-01, 6.258953438749761e-01, 6.138836790079482e-01, 6.017440766483936e-01, 5.894863859622419e-01, + 5.771208047134243e-01, 5.646578606110257e-01, 5.521083914445795e-01, 5.394835240208723e-01, 5.267946519170417e-01, + 5.140534120666679e-01, 5.012716601980810e-01, 4.884614451472596e-01, 4.756349820716255e-01, 4.628046245957236e-01, + 4.499828359253513e-01, 4.371821589731387e-01, 4.244151855459629e-01, 4.116945246528834e-01, 3.990327700015137e-01, + 3.864424667608565e-01, 3.739360776795802e-01, 3.615259486603844e-01, 3.492242739034092e-01, 3.370430607443994e-01, + 3.249940943263768e-01, 3.130889022566745e-01, 3.013387194140940e-01, 2.897544530833894e-01, 2.783466486059465e-01, + 2.671254557460968e-01, 2.561005959816459e-01, 2.452813309345670e-01, 2.346764321630724e-01, 2.242941525391207e-01, + 2.141421994355449e-01, 2.042277099441413e-01, 1.945572283400477e-01, 1.851366859983997e-01, 1.759713839565222e-01, + 1.670659782987828e-01, 1.584244685217862e-01, 1.500501890149949e-01, 1.419458037663698e-01, 1.341133043745716e-01, + 1.265540114190599e-01, 1.192685792075560e-01, 1.122570038873269e-01, 1.055186348731866e-01, 9.905218951159138e-02, + 9.285577086735504e-02, 8.692688848791834e-02, 8.126248197036480e-02, 7.585894712900819e-02, 7.071216453687493e-02, + 6.581753019316379e-02, 6.116998805112477e-02, 5.676406412698673e-02, 5.259390190074066e-02, 4.865329871379729e-02, + 4.493574286675733e-02, 4.143445112264064e-02, 3.814240632671975e-02, 3.505239486333388e-02, 3.215704368240290e-02, + 2.944885664345253e-02, 2.692024994241165e-02, 2.456358640583462e-02, 2.237120845811709e-02, 2.033546958929542e-02, + 1.844876417374586e-02, 1.670355551314538e-02, 1.509240200007160e-02, 1.360798132128038e-02, 1.224311264172586e-02, + 1.099077673153155e-02, 9.844134018179273e-03, 8.796540564986736e-03, 7.841561994366898e-03, 6.972985390308479e-03, + 6.184829228925801e-03, 5.471351398766137e-03, 4.827055383826915e-03, 4.246694691940794e-03, 3.725275619368065e-03, + 3.258058449144477e-03, 2.840557186031939e-03, 2.468537934882437e-03, 2.138016031933214e-03, 1.845252040089026e-03, + 1.586746719704406e-03, 1.359235085846040e-03, 1.159679661583578e-03, 9.852630346169412e-04, 8.333798215882749e-04, + 7.016281408336979e-04, 5.878006901877478e-04, 4.898755218427234e-04, 4.060066012630820e-04, 3.345142318353532e-04, + 2.738754213664553e-04, 2.227142607936653e-04, 1.797923795997266e-04, 1.439995364945199e-04, 1.143443979841680e-04, + 8.994555154915584e-05, 7.002279434068894e-05, 5.388873262066439e-05, 4.094072165278127e-05, 3.065317043363458e-05, + 2.257023056170620e-05, 1.629888370183569e-05, 1.150243752713366e-05, 7.894435705240934e-06, 5.232983386684600e-06, + 3.315485520548709e-06, 1.973790197100917e-06, 1.069718110365652e-06, 4.909053882102472e-07, 1.462097501755241e-07, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, + 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00}; + + + +const LC3_FLOAT* MDCT_WINS_10ms[2][6] = { + {MDCT_WINDOW_80, MDCT_WINDOW_160, MDCT_WINDOW_240, MDCT_WINDOW_320, MDCT_WINDOW_480, NULL}, + {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_10ms, MDCT_HRA_WINDOW_960_10ms}}; +const LC3_INT MDCT_la_zeroes[6] = {30, 60, 90, 120, 180, 360}; + + +const LC3_FLOAT* MDCT_WINS_2_5ms[2][6] = { + {MDCT_WINDOW_80_2_5ms, MDCT_WINDOW_160_2_5ms, MDCT_WINDOW_240_2_5ms, MDCT_WINDOW_320_2_5ms, MDCT_WINDOW_480_2_5ms, + NULL}, + {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_2_5ms, MDCT_HRA_WINDOW_960_2_5ms}}; +const LC3_INT MDCT_la_zeroes_2_5ms[6] = {0, 0, 0, 0, 0, 0}; + +const LC3_FLOAT* MDCT_WINS_5ms[2][6] = { + {MDCT_WINDOW_80_5ms, MDCT_WINDOW_160_5ms, MDCT_WINDOW_240_5ms, MDCT_WINDOW_320_5ms, MDCT_WINDOW_480_5ms, NULL}, + {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_5ms, MDCT_HRA_WINDOW_960_5ms}}; +const LC3_INT MDCT_la_zeroes_5ms[6] = {10, 20, 30, 40, 60, 120}; + +const LC3_INT MDCT_WINDOWS_LENGTHS_10ms[6] = {160, 320, 480, 640, 960, 1920}; /* Last 960 dummy */ + +const LC3_INT MDCT_WINDOWS_LENGTHS_2_5ms[6] = {40, 80, 120, 160, 240, 480}; + + +const LC3_INT MDCT_WINDOWS_LENGTHS_5ms[6] = {80, 160, 240, 320, 480, 960}; + +/* Per band energy */ +const LC3_INT ACC_COEFF_PER_BAND_8[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, + 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_16[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 36, 38, + 40, 42, 44, 46, 48, 50, 52, 55, 58, 61, 64, 67, 70, 73, 76, 80, 84, + 88, 92, 96, 101, 106, 111, 116, 121, 127, 133, 139, 146, 153, 160}; + +const LC3_INT ACC_COEFF_PER_BAND_24[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 46, 49, 52, 55, 58, 61, 64, 68, 72, 76, + 80, 85, 90, 95, 100, 106, 112, 118, 125, 132, 139, 147, 155, 164, 173, 183, 193, 204, 215, 227, 240}; + +const LC3_INT ACC_COEFF_PER_BAND_32[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, + 24, 26, 28, 30, 32, 34, 36, 38, 41, 44, 47, 50, 53, 56, 60, 64, 68, 72, 76, 81, 86, 91, + 97, 103, 109, 116, 123, 131, 139, 148, 157, 166, 176, 187, 199, 211, 224, 238, 252, 268, 284, 302, 320}; + +const LC3_INT ACC_COEFF_PER_BAND_48[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, + 26, 28, 30, 32, 34, 36, 39, 42, 45, 48, 51, 55, 59, 63, 67, 71, 76, 81, 86, 92, 98, 105, + 112, 119, 127, 135, 144, 154, 164, 175, 186, 198, 211, 225, 240, 256, 273, 291, 310, 330, 352, 375, 400}; + +const LC3_INT ACC_COEFF_PER_BAND_8_2_5ms[21] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + +const LC3_INT ACC_COEFF_PER_BAND_16_2_5ms[36] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, 38, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_24_2_5ms[41] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, + 30, 32, 34, 36, 38, 40, 42, 44, 47, 50, 53, 56, 60}; + +const LC3_INT ACC_COEFF_PER_BAND_32_2_5ms[44] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, + 36, 38, 40, 43, 46, 49, 52, 55, 59, 63, 67, 71, 75, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_48_2_5ms[45] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 40, 43, 46, 49, 52, 56, 60, 64, 68, 72, 77, 82, 87, 93, 100}; + +const LC3_INT ACC_COEFF_PER_BAND_48_2_5ms_HR[46] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, 43, 46, + 49, 53, 57, 61, 65, 69, 74, 79, 85, 91, 97, 104, 112, 120}; +const LC3_INT ACC_COEFF_PER_BAND_96_2_5ms_HR[50] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, + 35, 38, 41, 45, 49, 53, 57, 62, 67, 73, 79, 85, 92, 100, 108, 117, 127, 137, 149, 161, 174, 189, 204, 221, 240}; + + +const LC3_INT ACC_COEFF_PER_BAND_8_5ms[40] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_16_5ms[51] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, + 38, 40, 42, 44, 46, 48, 50, 52, 54, 57, 60, 63, 66, 69, 72, 76, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_24_5ms[53] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, + 30, 32, 34, 36, 38, 40, 42, 44, 47, 50, 53, 56, 59, 62, 65, 69, 73, 77, 81, 86, 91, 96, 101, 107, 113, 120}; + +const LC3_INT ACC_COEFF_PER_BAND_32_5ms[55] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 28, 30, 32, + 34, 36, 38, 40, 42, 45, 48, 51, 54, 57, 61, 65, 69, 73, + 78, 83, 88, 93, 99, 105, 112, 119, 126, 134, 142, 151, 160}; +const LC3_INT ACC_COEFF_PER_BAND_48_5ms_HR[56] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 21, 23, 25, 27, 29, 31, 33, 35, + 38, 41, 44, 47, 50, 54, 58, 62, 66, 71, 76, 81, 87, 93, + 100, 107, 114, 122, 131, 140, 149, 160, 171, 183, 196, 209, 224, 240}; +const LC3_INT ACC_COEFF_PER_BAND_48_5ms[56] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 27, 29, 31, 33, + 35, 37, 40, 43, 46, 49, 52, 55, 59, 63, 67, 72, 77, 82, + 87, 93, 99, 105, 112, 120, 128, 136, 145, 155, 165, 176, 187, 200}; +const LC3_INT ACC_COEFF_PER_BAND_96_5ms_HR[59] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, + 23, 25, 27, 29, 31, 34, 37, 40, 44, 48, 52, 56, 61, 66, 71, 77, 83, 90, 98, 106, + 115, 124, 135, 146, 158, 171, 185, 200, 217, 235, 254, 275, 298, 323, 349, 378, 409, 443, 480}; + + +const LC3_INT ACC_COEFF_PER_BAND_48_HR[65] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 23, 25, + 27, 29, 31, 33, 36, 39, 42, 45, 48, 51, 55, 59, 63, 67, 72, 77, 83, 89, 95, 101, 108, 116, + 124, 133, 142, 152, 163, 174, 187, 200, 214, 229, 244, 262, 280, 299, 320, 343, 367, 392, 419, 449, 480}; + +const LC3_INT ACC_COEFF_PER_BAND_96_HR[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 33, 36, 39, 42, 46, 50, 54, 59, 64, 69, 75, 82, 89, 96, 104, 113, 122, 132, 143, 155, 168, 181, 196, 213, 230, 249, 270, 292, 316, 342, 371, 401, 434, 470, 509, 551, 596, 646, 699, 757, 819, 887, 960}; + +const LC3_INT* ACC_COEFF_PER_BAND_HR[6] = {NULL, NULL, NULL, NULL, ACC_COEFF_PER_BAND_48_HR, ACC_COEFF_PER_BAND_96_HR}; + +const LC3_INT* ACC_COEFF_PER_BAND[6] = {ACC_COEFF_PER_BAND_8, ACC_COEFF_PER_BAND_16, ACC_COEFF_PER_BAND_24, + ACC_COEFF_PER_BAND_32, ACC_COEFF_PER_BAND_48, NULL}; + +const LC3_INT* ACC_COEFF_PER_BAND_2_5ms_HR[6] = { + NULL, NULL, NULL, NULL, ACC_COEFF_PER_BAND_48_2_5ms_HR, ACC_COEFF_PER_BAND_96_2_5ms_HR}; + +const LC3_INT* ACC_COEFF_PER_BAND_2_5ms[5] = {ACC_COEFF_PER_BAND_8_2_5ms, ACC_COEFF_PER_BAND_16_2_5ms, + ACC_COEFF_PER_BAND_24_2_5ms, ACC_COEFF_PER_BAND_32_2_5ms, + ACC_COEFF_PER_BAND_48_2_5ms}; + + +const LC3_INT* ACC_COEFF_PER_BAND_5ms_HR[6] = { + NULL, NULL, NULL, NULL, ACC_COEFF_PER_BAND_48_5ms_HR, ACC_COEFF_PER_BAND_96_5ms_HR}; + +const LC3_INT* ACC_COEFF_PER_BAND_5ms[5] = {ACC_COEFF_PER_BAND_8_5ms, ACC_COEFF_PER_BAND_16_5ms, + ACC_COEFF_PER_BAND_24_5ms, ACC_COEFF_PER_BAND_32_5ms, + ACC_COEFF_PER_BAND_48_5ms}; + +/* Near Nyquist detector */ +const LC3_INT NN_thresh = 30; + + +const LC3_INT32 xavg_N_grp[5] = { 4, 5, 6, 7, 8 }; + + +const LC3_INT32 gwlpr[MAX_LGW+1] = { 1, 3*QUOT_LPR_LTR, 5*QUOT_LPR_LTR, 9*QUOT_LPR_LTR, 17*QUOT_LPR_LTR, 33*QUOT_LPR_LTR, 49*QUOT_LPR_LTR, 65*QUOT_LPR_LTR, 81*QUOT_LPR_LTR, 97*QUOT_LPR_LTR}; + + +const LC3_FLOAT PhECU_whr16ms_NB[128]={ +8.000000000000002e-02, 8.393536376804722e-02, 9.567411990702857e-02, 1.150154150448081e-01, 1.416283142591582e-01, +1.750574634660318e-01, 2.147308806541882e-01, 2.599697426559885e-01, 3.099999999999999e-01, 3.639656211120587e-01, +4.209432392528405e-01, 4.799579515787762e-01, 5.400000000000000e-01, 6.000420484212237e-01, 6.590567607471596e-01, +7.160343788879413e-01, 7.699999999999999e-01, 8.200302573440115e-01, 8.652691193458119e-01, 9.049425365339682e-01, +9.383716857408418e-01, 9.649845849551919e-01, 9.843258800929715e-01, 9.960646362319528e-01, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +9.960646362319528e-01, 9.843258800929715e-01, 9.649845849551919e-01, 9.383716857408418e-01, 9.049425365339682e-01, +8.652691193458119e-01, 8.200302573440115e-01, 7.699999999999999e-01, 7.160343788879413e-01, 6.590567607471596e-01, +6.000420484212237e-01, 5.400000000000000e-01, 4.799579515787762e-01, 4.209432392528405e-01, 3.639656211120587e-01, +3.099999999999999e-01, 2.599697426559885e-01, 2.147308806541882e-01, 1.750574634660318e-01, 1.416283142591582e-01, +1.150154150448081e-01, 9.567411990702857e-02, 8.393536376804722e-02 +}; +const LC3_FLOAT PhECU_whr16ms_WB[256]={ +8.000000000000002e-02, 8.098489531024239e-02, 8.393536376804722e-02, 8.883877101451404e-02, 9.567411990702857e-02, +1.044121404322514e-01, 1.150154150448081e-01, 1.274385388949634e-01, 1.416283142591582e-01, 1.575239783408292e-01, +1.750574634660318e-01, 1.941536885596704e-01, 2.147308806541882e-01, 2.367009250539683e-01, 2.599697426559885e-01, +2.844376928109830e-01, 3.099999999999999e-01, 3.365472024992595e-01, 3.639656211120587e-01, 3.921378459605457e-01, +4.209432392528405e-01, 4.502584518725810e-01, 4.799579515787762e-01, 5.099145605541342e-01, 5.400000000000000e-01, +5.700854394458659e-01, 6.000420484212237e-01, 6.297415481274190e-01, 6.590567607471596e-01, 6.878621540394543e-01, +7.160343788879413e-01, 7.434527975007406e-01, 7.699999999999999e-01, 7.955623071890170e-01, 8.200302573440115e-01, +8.432990749460317e-01, 8.652691193458119e-01, 8.858463114403297e-01, 9.049425365339682e-01, 9.224760216591710e-01, +9.383716857408418e-01, 9.525614611050366e-01, 9.649845849551919e-01, 9.755878595677486e-01, 9.843258800929715e-01, +9.911612289854861e-01, 9.960646362319528e-01, 9.990151046897577e-01, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 9.990151046897577e-01, +9.960646362319528e-01, 9.911612289854861e-01, 9.843258800929715e-01, 9.755878595677486e-01, 9.649845849551919e-01, +9.525614611050366e-01, 9.383716857408418e-01, 9.224760216591710e-01, 9.049425365339682e-01, 8.858463114403297e-01, +8.652691193458119e-01, 8.432990749460317e-01, 8.200302573440115e-01, 7.955623071890170e-01, 7.699999999999999e-01, +7.434527975007406e-01, 7.160343788879413e-01, 6.878621540394543e-01, 6.590567607471596e-01, 6.297415481274190e-01, +6.000420484212237e-01, 5.700854394458659e-01, 5.400000000000000e-01, 5.099145605541342e-01, 4.799579515787762e-01, +4.502584518725810e-01, 4.209432392528405e-01, 3.921378459605457e-01, 3.639656211120587e-01, 3.365472024992595e-01, +3.099999999999999e-01, 2.844376928109830e-01, 2.599697426559885e-01, 2.367009250539683e-01, 2.147308806541882e-01, +1.941536885596704e-01, 1.750574634660318e-01, 1.575239783408292e-01, 1.416283142591582e-01, 1.274385388949634e-01, +1.150154150448081e-01, 1.044121404322514e-01, 9.567411990702857e-02, 8.883877101451404e-02, 8.393536376804722e-02, +8.098489531024239e-02 +}; +const LC3_FLOAT PhECU_whr16ms_SSWB[384]={ +8.000000000000002e-02, 8.043781807234540e-02, 8.175043887779704e-02, 8.393536376804722e-02, 8.698843361438435e-02, +9.090383672483066e-02, 9.567411990702857e-02, 1.012902026558156e-01, 1.077413944384821e-01, 1.150154150448081e-01, +1.230984179631410e-01, 1.319750167380180e-01, 1.416283142591582e-01, 1.520399349260726e-01, 1.631900596270638e-01, +1.750574634660318e-01, 1.876195561652702e-01, 2.008524250673430e-01, 2.147308806541882e-01, 2.292285044967963e-01, +2.443176995441919e-01, 2.599697426559885e-01, 2.761548392785189e-01, 2.928421801604610e-01, 3.099999999999999e-01, +3.275956379118843e-01, 3.455955995992783e-01, 3.639656211120587e-01, 3.826707340701924e-01, 4.016753322280344e-01, +4.209432392528405e-01, 4.404377775884727e-01, 4.601218382732121e-01, 4.799579515787762e-01, 4.999083583360772e-01, +5.199350818119455e-01, 5.400000000000000e-01, 5.600649181880546e-01, 5.800916416639228e-01, 6.000420484212237e-01, +6.198781617267880e-01, 6.395622224115274e-01, 6.590567607471596e-01, 6.783246677719657e-01, 6.973292659298076e-01, +7.160343788879413e-01, 7.344044004007217e-01, 7.524043620881156e-01, 7.699999999999999e-01, 7.871578198395390e-01, +8.038451607214812e-01, 8.200302573440115e-01, 8.356823004558082e-01, 8.507714955032037e-01, 8.652691193458119e-01, +8.791475749326572e-01, 8.923804438347298e-01, 9.049425365339682e-01, 9.168099403729364e-01, 9.279600650739274e-01, +9.383716857408418e-01, 9.480249832619820e-01, 9.569015820368590e-01, 9.649845849551919e-01, 9.722586055615179e-01, +9.787097973441844e-01, 9.843258800929715e-01, 9.890961632751694e-01, 9.930115663856157e-01, 9.960646362319528e-01, +9.982495611222031e-01, 9.995621819276547e-01, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 9.995621819276547e-01, 9.982495611222031e-01, +9.960646362319528e-01, 9.930115663856157e-01, 9.890961632751694e-01, 9.843258800929715e-01, 9.787097973441844e-01, +9.722586055615179e-01, 9.649845849551919e-01, 9.569015820368590e-01, 9.480249832619820e-01, 9.383716857408418e-01, +9.279600650739274e-01, 9.168099403729364e-01, 9.049425365339682e-01, 8.923804438347298e-01, 8.791475749326572e-01, +8.652691193458119e-01, 8.507714955032037e-01, 8.356823004558082e-01, 8.200302573440115e-01, 8.038451607214812e-01, +7.871578198395390e-01, 7.699999999999999e-01, 7.524043620881156e-01, 7.344044004007217e-01, 7.160343788879413e-01, +6.973292659298076e-01, 6.783246677719657e-01, 6.590567607471596e-01, 6.395622224115274e-01, 6.198781617267880e-01, +6.000420484212237e-01, 5.800916416639228e-01, 5.600649181880546e-01, 5.400000000000000e-01, 5.199350818119455e-01, +4.999083583360772e-01, 4.799579515787762e-01, 4.601218382732121e-01, 4.404377775884727e-01, 4.209432392528405e-01, +4.016753322280344e-01, 3.826707340701924e-01, 3.639656211120587e-01, 3.455955995992783e-01, 3.275956379118843e-01, +3.099999999999999e-01, 2.928421801604610e-01, 2.761548392785189e-01, 2.599697426559885e-01, 2.443176995441919e-01, +2.292285044967963e-01, 2.147308806541882e-01, 2.008524250673430e-01, 1.876195561652702e-01, 1.750574634660318e-01, +1.631900596270638e-01, 1.520399349260726e-01, 1.416283142591582e-01, 1.319750167380180e-01, 1.230984179631410e-01, +1.150154150448081e-01, 1.077413944384821e-01, 1.012902026558156e-01, 9.567411990702857e-02, 9.090383672483066e-02, +8.698843361438435e-02, 8.393536376804722e-02, 8.175043887779704e-02, 8.043781807234540e-02 +}; +const LC3_FLOAT PhECU_whr16ms_SWB[512]={ +8.000000000000002e-02, 8.024628976087178e-02, 8.098489531024239e-02, 8.221502573078943e-02, 8.393536376804722e-02, +8.614406724095569e-02, 8.883877101451404e-02, 9.201658953242653e-02, 9.567411990702857e-02, 9.980744556318394e-02, +1.044121404322514e-01, 1.094832736916302e-01, 1.150154150448081e-01, 1.210026405362591e-01, 1.274385388949634e-01, +1.343162183997567e-01, 1.416283142591582e-01, 1.493669964977737e-01, 1.575239783408292e-01, 1.660905250878570e-01, +1.750574634660318e-01, 1.844151914531410e-01, 1.941536885596704e-01, 2.042625265589956e-01, 2.147308806541882e-01, +2.255475410694793e-01, 2.367009250539683e-01, 2.481790892847231e-01, 2.599697426559885e-01, 2.720602594408110e-01, +2.844376928109830e-01, 2.970887887008307e-01, 3.099999999999999e-01, 3.231575010600410e-01, 3.365472024992595e-01, +3.501547662899784e-01, 3.639656211120587e-01, 3.779649779562326e-01, 3.921378459605457e-01, 4.064690484629473e-01, +4.209432392528405e-01, 4.355449190041883e-01, 4.502584518725810e-01, 4.650680822384892e-01, 4.799579515787762e-01, +4.949121154484021e-01, 5.099145605541342e-01, 5.249492219019830e-01, 5.400000000000000e-01, 5.550507780980171e-01, +5.700854394458659e-01, 5.850878845515979e-01, 6.000420484212237e-01, 6.149319177615109e-01, 6.297415481274190e-01, +6.444550809958116e-01, 6.590567607471596e-01, 6.735309515370527e-01, 6.878621540394543e-01, 7.020350220437674e-01, +7.160343788879413e-01, 7.298452337100215e-01, 7.434527975007406e-01, 7.568424989399589e-01, 7.699999999999999e-01, +7.829112112991693e-01, 7.955623071890170e-01, 8.079397405591890e-01, 8.200302573440115e-01, 8.318209107152770e-01, +8.432990749460317e-01, 8.544524589305209e-01, 8.652691193458119e-01, 8.757374734410044e-01, 8.858463114403297e-01, +8.955848085468591e-01, 9.049425365339682e-01, 9.139094749121430e-01, 9.224760216591710e-01, 9.306330035022263e-01, +9.383716857408418e-01, 9.456837816002432e-01, 9.525614611050366e-01, 9.589973594637410e-01, 9.649845849551919e-01, +9.705167263083698e-01, 9.755878595677486e-01, 9.801925544368162e-01, 9.843258800929715e-01, 9.879834104675735e-01, +9.911612289854861e-01, 9.938559327590444e-01, 9.960646362319528e-01, 9.977849742692106e-01, 9.990151046897577e-01, +9.997537102391283e-01, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 9.997537102391283e-01, 9.990151046897577e-01, 9.977849742692106e-01, +9.960646362319528e-01, 9.938559327590444e-01, 9.911612289854861e-01, 9.879834104675735e-01, 9.843258800929715e-01, +9.801925544368162e-01, 9.755878595677486e-01, 9.705167263083698e-01, 9.649845849551919e-01, 9.589973594637410e-01, +9.525614611050366e-01, 9.456837816002432e-01, 9.383716857408418e-01, 9.306330035022263e-01, 9.224760216591710e-01, +9.139094749121430e-01, 9.049425365339682e-01, 8.955848085468591e-01, 8.858463114403297e-01, 8.757374734410044e-01, +8.652691193458119e-01, 8.544524589305209e-01, 8.432990749460317e-01, 8.318209107152770e-01, 8.200302573440115e-01, +8.079397405591890e-01, 7.955623071890170e-01, 7.829112112991693e-01, 7.699999999999999e-01, 7.568424989399589e-01, +7.434527975007406e-01, 7.298452337100215e-01, 7.160343788879413e-01, 7.020350220437674e-01, 6.878621540394543e-01, +6.735309515370527e-01, 6.590567607471596e-01, 6.444550809958116e-01, 6.297415481274190e-01, 6.149319177615109e-01, +6.000420484212237e-01, 5.850878845515979e-01, 5.700854394458659e-01, 5.550507780980171e-01, 5.400000000000000e-01, +5.249492219019830e-01, 5.099145605541342e-01, 4.949121154484021e-01, 4.799579515787762e-01, 4.650680822384892e-01, +4.502584518725810e-01, 4.355449190041883e-01, 4.209432392528405e-01, 4.064690484629473e-01, 3.921378459605457e-01, +3.779649779562326e-01, 3.639656211120587e-01, 3.501547662899784e-01, 3.365472024992595e-01, 3.231575010600410e-01, +3.099999999999999e-01, 2.970887887008307e-01, 2.844376928109830e-01, 2.720602594408110e-01, 2.599697426559885e-01, +2.481790892847231e-01, 2.367009250539683e-01, 2.255475410694793e-01, 2.147308806541882e-01, 2.042625265589956e-01, +1.941536885596704e-01, 1.844151914531410e-01, 1.750574634660318e-01, 1.660905250878570e-01, 1.575239783408292e-01, +1.493669964977737e-01, 1.416283142591582e-01, 1.343162183997567e-01, 1.274385388949634e-01, 1.210026405362591e-01, +1.150154150448081e-01, 1.094832736916302e-01, 1.044121404322514e-01, 9.980744556318394e-02, 9.567411990702857e-02, +9.201658953242653e-02, 8.883877101451404e-02, 8.614406724095569e-02, 8.393536376804722e-02, 8.221502573078943e-02, +8.098489531024239e-02, 8.024628976087178e-02 +}; +const LC3_FLOAT PhECU_whr16ms_FB[768]={ +8.000000000000002e-02, 8.010946754324183e-02, 8.043781807234540e-02, 8.098489531024239e-02, 8.175043887779704e-02, +8.273408441773300e-02, 8.393536376804722e-02, 8.535370518483010e-02, 8.698843361438435e-02, 8.883877101451404e-02, +9.090383672483066e-02, 9.318264788589975e-02, 9.567411990702857e-02, 9.837706698247278e-02, 1.012902026558156e-01, +1.044121404322514e-01, 1.077413944384821e-01, 1.112763801299127e-01, 1.150154150448081e-01, 1.189567196050543e-01, +1.230984179631410e-01, 1.274385388949634e-01, 1.319750167380180e-01, 1.367056923745465e-01, 1.416283142591582e-01, +1.467405394904446e-01, 1.520399349260726e-01, 1.575239783408292e-01, 1.631900596270638e-01, 1.690354820369581e-01, +1.750574634660318e-01, 1.812531377772744e-01, 1.876195561652702e-01, 1.941536885596704e-01, 2.008524250673430e-01, +2.077125774525124e-01, 2.147308806541882e-01, 2.219039943401561e-01, 2.292285044967963e-01, 2.367009250539683e-01, +2.443176995441919e-01, 2.520752027953329e-01, 2.599697426559885e-01, 2.679975617527521e-01, 2.761548392785189e-01, +2.844376928109830e-01, 2.928421801604610e-01, 3.013643012461601e-01, 3.099999999999999e-01, 3.187451662970817e-01, +3.275956379118843e-01, 3.365472024992595e-01, 3.455955995992783e-01, 3.547365226649809e-01, 3.639656211120587e-01, +3.732785023894972e-01, 3.826707340701924e-01, 3.921378459605457e-01, 4.016753322280344e-01, 4.112786535457436e-01, +4.209432392528405e-01, 4.306644895299604e-01, 4.404377775884727e-01, 4.502584518725810e-01, 4.601218382732121e-01, +4.700232423526383e-01, 4.799579515787762e-01, 4.899212375680964e-01, 4.999083583360772e-01, 5.099145605541342e-01, +5.199350818119455e-01, 5.299651528841020e-01, 5.400000000000000e-01, 5.500348471158981e-01, 5.600649181880546e-01, +5.700854394458659e-01, 5.800916416639228e-01, 5.900787624319037e-01, 6.000420484212237e-01, 6.099767576473617e-01, +6.198781617267880e-01, 6.297415481274190e-01, 6.395622224115274e-01, 6.493355104700396e-01, 6.590567607471596e-01, +6.687213464542564e-01, 6.783246677719657e-01, 6.878621540394543e-01, 6.973292659298076e-01, 7.067214976105027e-01, +7.160343788879413e-01, 7.252634773350191e-01, 7.344044004007217e-01, 7.434527975007406e-01, 7.524043620881156e-01, +7.612548337029182e-01, 7.699999999999999e-01, 7.786356987538400e-01, 7.871578198395390e-01, 7.955623071890170e-01, +8.038451607214812e-01, 8.120024382472478e-01, 8.200302573440115e-01, 8.279247972046673e-01, 8.356823004558082e-01, +8.432990749460317e-01, 8.507714955032037e-01, 8.580960056598439e-01, 8.652691193458119e-01, 8.722874225474876e-01, +8.791475749326572e-01, 8.858463114403297e-01, 8.923804438347298e-01, 8.987468622227257e-01, 9.049425365339682e-01, +9.109645179630421e-01, 9.168099403729364e-01, 9.224760216591710e-01, 9.279600650739274e-01, 9.332594605095554e-01, +9.383716857408418e-01, 9.432943076254536e-01, 9.480249832619820e-01, 9.525614611050366e-01, 9.569015820368590e-01, +9.610432803949458e-01, 9.649845849551919e-01, 9.687236198700873e-01, 9.722586055615179e-01, 9.755878595677486e-01, +9.787097973441844e-01, 9.816229330175272e-01, 9.843258800929715e-01, 9.868173521141004e-01, 9.890961632751694e-01, +9.911612289854861e-01, 9.930115663856157e-01, 9.946462948151700e-01, 9.960646362319528e-01, 9.972659155822671e-01, +9.982495611222031e-01, 9.990151046897577e-01, 9.995621819276547e-01, 9.998905324567582e-01, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, +9.998905324567582e-01, 9.995621819276547e-01, 9.990151046897577e-01, 9.982495611222031e-01, 9.972659155822671e-01, +9.960646362319528e-01, 9.946462948151700e-01, 9.930115663856157e-01, 9.911612289854861e-01, 9.890961632751694e-01, +9.868173521141004e-01, 9.843258800929715e-01, 9.816229330175272e-01, 9.787097973441844e-01, 9.755878595677486e-01, +9.722586055615179e-01, 9.687236198700873e-01, 9.649845849551919e-01, 9.610432803949458e-01, 9.569015820368590e-01, +9.525614611050366e-01, 9.480249832619820e-01, 9.432943076254536e-01, 9.383716857408418e-01, 9.332594605095554e-01, +9.279600650739274e-01, 9.224760216591710e-01, 9.168099403729364e-01, 9.109645179630421e-01, 9.049425365339682e-01, +8.987468622227257e-01, 8.923804438347298e-01, 8.858463114403297e-01, 8.791475749326572e-01, 8.722874225474876e-01, +8.652691193458119e-01, 8.580960056598439e-01, 8.507714955032037e-01, 8.432990749460317e-01, 8.356823004558082e-01, +8.279247972046673e-01, 8.200302573440115e-01, 8.120024382472478e-01, 8.038451607214812e-01, 7.955623071890170e-01, +7.871578198395390e-01, 7.786356987538400e-01, 7.699999999999999e-01, 7.612548337029182e-01, 7.524043620881156e-01, +7.434527975007406e-01, 7.344044004007217e-01, 7.252634773350191e-01, 7.160343788879413e-01, 7.067214976105027e-01, +6.973292659298076e-01, 6.878621540394543e-01, 6.783246677719657e-01, 6.687213464542564e-01, 6.590567607471596e-01, +6.493355104700396e-01, 6.395622224115274e-01, 6.297415481274190e-01, 6.198781617267880e-01, 6.099767576473617e-01, +6.000420484212237e-01, 5.900787624319037e-01, 5.800916416639228e-01, 5.700854394458659e-01, 5.600649181880546e-01, +5.500348471158981e-01, 5.400000000000000e-01, 5.299651528841020e-01, 5.199350818119455e-01, 5.099145605541342e-01, +4.999083583360772e-01, 4.899212375680964e-01, 4.799579515787762e-01, 4.700232423526383e-01, 4.601218382732121e-01, +4.502584518725810e-01, 4.404377775884727e-01, 4.306644895299604e-01, 4.209432392528405e-01, 4.112786535457436e-01, +4.016753322280344e-01, 3.921378459605457e-01, 3.826707340701924e-01, 3.732785023894972e-01, 3.639656211120587e-01, +3.547365226649809e-01, 3.455955995992783e-01, 3.365472024992595e-01, 3.275956379118843e-01, 3.187451662970817e-01, +3.099999999999999e-01, 3.013643012461601e-01, 2.928421801604610e-01, 2.844376928109830e-01, 2.761548392785189e-01, +2.679975617527521e-01, 2.599697426559885e-01, 2.520752027953329e-01, 2.443176995441919e-01, 2.367009250539683e-01, +2.292285044967963e-01, 2.219039943401561e-01, 2.147308806541882e-01, 2.077125774525124e-01, 2.008524250673430e-01, +1.941536885596704e-01, 1.876195561652702e-01, 1.812531377772744e-01, 1.750574634660318e-01, 1.690354820369581e-01, +1.631900596270638e-01, 1.575239783408292e-01, 1.520399349260726e-01, 1.467405394904446e-01, 1.416283142591582e-01, +1.367056923745465e-01, 1.319750167380180e-01, 1.274385388949634e-01, 1.230984179631410e-01, 1.189567196050543e-01, +1.150154150448081e-01, 1.112763801299127e-01, 1.077413944384821e-01, 1.044121404322514e-01, 1.012902026558156e-01, +9.837706698247278e-02, 9.567411990702857e-02, 9.318264788589975e-02, 9.090383672483066e-02, 8.883877101451404e-02, +8.698843361438435e-02, 8.535370518483010e-02, 8.393536376804722e-02, 8.273408441773300e-02, 8.175043887779704e-02, +8.098489531024239e-02, 8.043781807234540e-02, 8.010946754324183e-02 +}; + +const LC3_FLOAT* PhECU_whr16ms_wins[5] = { + PhECU_whr16ms_NB,PhECU_whr16ms_WB,PhECU_whr16ms_SSWB,PhECU_whr16ms_SWB, PhECU_whr16ms_FB +}; + + +const LC3_FLOAT hannOla_8k[28 / 2 + 1] = { + 0.0000000000, 0.0125360439, 0.0495155660, 0.1090842588, 0.1882550991, 0.2830581304, 0.3887395330, 0.5000000000, 0.6112604670, 0.7169418696, 0.8117449009, 0.8909157412, 0.9504844340, + 0.9874639561, 1.0000000000 }; + +const LC3_FLOAT hannOla_16k[56 / 2 + 1] = { + 0.0000000000, 0.0031438951, 0.0125360439, 0.0280583348, 0.0495155660, 0.0766379004, 0.1090842588, 0.1464466094, 0.1882550991, 0.2339839617, 0.2830581304, 0.3348604690, 0.3887395330, + 0.4440177619, 0.5000000000, 0.5559822381, 0.6112604670, 0.6651395310, 0.7169418696, 0.7660160383, 0.8117449009, 0.8535533906, 0.8909157412, 0.9233620996, 0.9504844340, 0.9719416652, + 0.9874639561, 0.9968561049, 1.0000000000 }; + +const LC3_FLOAT hannOla_24k[84 / 2 + 1] = { + 0.0000000000, 0.0013981014, 0.0055845869, 0.0125360439, 0.0222135971, 0.0345631257, 0.0495155660, 0.0669872981, 0.0868806128, 0.1090842588, 0.1334740641, 0.1599136311, 0.1882550991, + 0.2183399710, 0.2500000000, 0.2830581304, 0.3173294878, 0.3526224128, 0.3887395330, 0.4254788669, 0.4626349532, 0.5000000000, 0.5373650468, 0.5745211331, 0.6112604670, 0.6473775872, + 0.6826705122, 0.7169418696, 0.7500000000, 0.7816600290, 0.8117449009, 0.8400863689, 0.8665259359, 0.8909157412, 0.9131193872, 0.9330127019, 0.9504844340, 0.9654368743, 0.9777864029, + 0.9874639561, 0.9944154131, 0.9986018986, 1.0000000000 }; + +const LC3_FLOAT hannOla_32k[112 / 2 + 1] = { + 0.0000000000, 0.0007865925, 0.0031438951, 0.0070644907, 0.0125360439, 0.0195413390, 0.0280583348, 0.0380602337, 0.0495155660, 0.0623882890, 0.0766379004, 0.0922195655, 0.1090842588, + 0.1271789176, 0.1464466094, 0.1668267110, 0.1882550991, 0.2106643519, 0.2339839617, 0.2581405564, 0.2830581304, 0.3086582838, 0.3348604690, 0.3615822443, 0.3887395330, 0.4162468883, + 0.4440177619, 0.4719647764, 0.5000000000, 0.5280352236, 0.5559822381, 0.5837531117, 0.6112604670, 0.6384177557, 0.6651395310, 0.6913417162, 0.7169418696, 0.7418594436, 0.7660160383, + 0.7893356481, 0.8117449009, 0.8331732890, 0.8535533906, 0.8728210824, 0.8909157412, 0.9077804345, 0.9233620996, 0.9376117110, 0.9504844340, 0.9619397663, 0.9719416652, 0.9804586610, + 0.9874639561, 0.9929355093, 0.9968561049, 0.9992134075, 1.0000000000 }; + +const LC3_FLOAT hannOla_48k[168 / 2 + 1] = { + 0.0000000000, 0.0003496476, 0.0013981014, 0.0031438951, 0.0055845869, 0.0087167634, 0.0125360439, 0.0170370869, 0.0222135971, 0.0280583348, 0.0345631257, 0.0417188721, 0.0495155660, + 0.0579423032, 0.0669872981, 0.0766379004, 0.0868806128, 0.0977011101, 0.1090842588, 0.1210141384, 0.1334740641, 0.1464466094, 0.1599136311, 0.1738562944, 0.1882550991, 0.2030899072, + 0.2183399710, 0.2339839617, 0.2500000000, 0.2663656859, 0.2830581304, 0.3000539878, 0.3173294878, 0.3348604690, 0.3526224128, 0.3705904774, 0.3887395330, 0.4070441964, 0.4254788669, + 0.4440177619, 0.4626349532, 0.4813044029, 0.5000000000, 0.5186955971, 0.5373650468, 0.5559822381, 0.5745211331, 0.5929558036, 0.6112604670, 0.6294095226, 0.6473775872, 0.6651395310, + 0.6826705122, 0.6999460122, 0.7169418696, 0.7336343141, 0.7500000000, 0.7660160383, 0.7816600290, 0.7969100928, 0.8117449009, 0.8261437056, 0.8400863689, 0.8535533906, 0.8665259359, + 0.8789858616, 0.8909157412, 0.9022988899, 0.9131193872, 0.9233620996, 0.9330127019, 0.9420576968, 0.9504844340, 0.9582811279, 0.9654368743, 0.9719416652, 0.9777864029, 0.9829629131, + 0.9874639561, 0.9912832366, 0.9944154131, 0.9968561049, 0.9986018986, 0.9996503524, 1.0000000000 }; + +const LC3_FLOAT *hannOla_wins[5] = { hannOla_8k, hannOla_16k, hannOla_24k, hannOla_32k, hannOla_48k }; + +const LC3_FLOAT plc_tdc_lpc_8[17] = {1, 0.998890285693703, 0.995568526105076, 0.990056789412169, 0.982391584470799, 0.972623458066693, 0.960816439805232, 0.947047343167065, 0.931404933402306, 0.913988974871173, 0.894909172128633, 0.874284020464791, 0.852239582727672, 0.828908210053904, 0.804427224606163, 0.778937582561901, 0.752582535420797}; + +const LC3_FLOAT plc_tdc_lpc_16[17] = {1, 0.999722455898711, 0.998890285693703, 0.997504874399492, 0.995568526105076, 0.993084457588532, 0.990056789412169, 0.986490534532745, 0.982391584470799, 0.977766693092529, 0.972623458066693, 0.966970300067793, 0.960816439805232, 0.954171872966123, 0.947047343167065, 0.939454313017299, 0.931404933402306}; + +const LC3_FLOAT plc_tdc_lpc_24[17] = {1, 0.999876637554759, 0.999506641521283, 0.998890285693703, 0.998028026020383, 0.996920500041823, 0.995568526105076, 0.993973102356048, 0.992135405511397, 0.990056789412169, 0.987738783361644, 0.985183090250255, 0.982391584470799, 0.979366309627507, 0.976109476042902, 0.972623458066693, 0.968910791191297}; + +const LC3_FLOAT plc_tdc_lpc_32[17] = {1, 0.999930606751878, 0.999722455898711, 0.999375634094057, 0.998890285693703, 0.998266612655538, 0.997504874399492, 0.996605387627705, 0.995568526105076, 0.994394720400431, 0.993084457588532, 0.991638280913245, 0.990056789412169, 0.988340637503103, 0.986490534532745, 0.984507244288062, 0.982391584470799}; + +const LC3_FLOAT plc_tdc_lpc_48[17] = {1, 0.999969157961872, 0.999876637554759, 0.999722455898711, 0.999506641521283, 0.999229234348730, 0.998890285693703, 0.998489858239427, 0.998028026020383, 0.997504874399492, 0.996920500041823, 0.996275010884819, 0.995568526105076, 0.994801176081669, 0.993973102356048, 0.993084457588532, 0.992135405511397}; + +const LC3_FLOAT plc_tdc_lpc_96[17] = {1, 0.999992289401289, 0.999969157961872, 0.999930606751878, 0.999876637554759, 0.999807252867157, 0.999722455898711, 0.999622250571809, 0.999506641521283, 0.999375634094057, 0.999229234348730, 0.999067449055113, 0.998890285693703, 0.998697752455111, 0.998489858239427, 0.998266612655538, 0.998028026020383}; + +const LC3_FLOAT *plc_tdc_lpc_all[6] = {plc_tdc_lpc_8, plc_tdc_lpc_16, plc_tdc_lpc_24, plc_tdc_lpc_32, plc_tdc_lpc_48, plc_tdc_lpc_96}; + +const LC3_FLOAT plc_tdc_lpc_8_25ms[9] = {1, 0.998890285693703, 0.995568526105076, 0.990056789412169, 0.982391584470799, 0.972623458066693, 0.960816439805232, 0.947047343167065, 0.931404933402306}; + +const LC3_FLOAT plc_preemph_fac[] = {0.62, 0.72, 0.82, 0.92, 0.92, 0.92}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_8_10ms[81] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_16_10ms[81] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, + 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_24_10ms[81] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, + 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, + 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, + 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_32_10ms[81] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, + 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, + 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, + 252, 256, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308, 312, 316, 320}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_48_10ms[81] = { + 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, + 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, + 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360, 366, 372, + 378, 384, 390, 396 , 402, 408, 414, 420, 426, 432, 438, 444, 450, 456, 462, 468, 474, 480}; +const LC3_INT ACC_COEFF_PER_BAND_PLC_96_10ms[81] = { + 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240, + 252, 264, 276, 288, 300, 312, 324, 336, 348, 360, 372, 384, 396, 408, 420, 432, 444, 456, 468, 480, 492, + 504, 516, 528, 540, 552, 564, 576, 588, 600, 612, 624, 636, 648, 660, 672, 684, 696, 708, 720, 732, 744, + 756, 768, 780, 792, 804, 816, 828, 840, 852, 864, 876, 888, 900, 912, 924, 936, 948, 960}; + +const LC3_INT* ACC_COEFF_PER_BAND_PLC[] = { + ACC_COEFF_PER_BAND_PLC_8_10ms, ACC_COEFF_PER_BAND_PLC_16_10ms, ACC_COEFF_PER_BAND_PLC_24_10ms, + ACC_COEFF_PER_BAND_PLC_32_10ms, ACC_COEFF_PER_BAND_PLC_48_10ms, ACC_COEFF_PER_BAND_PLC_96_10ms}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_8_2_5ms[21] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_16_2_5ms[41] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_24_2_5ms[61] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_32_2_5ms[81] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_48_2_5ms[61] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_96_2_5ms[81] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, + 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, + 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, + 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240}; + +const LC3_INT* ACC_COEFF_PER_BAND_PLC_2_5ms[] = { + ACC_COEFF_PER_BAND_PLC_8_2_5ms, ACC_COEFF_PER_BAND_PLC_16_2_5ms, ACC_COEFF_PER_BAND_PLC_24_2_5ms, + ACC_COEFF_PER_BAND_PLC_32_2_5ms, ACC_COEFF_PER_BAND_PLC_48_2_5ms, ACC_COEFF_PER_BAND_PLC_96_2_5ms}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_8_5ms[41] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_16_5ms[81] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_24_5ms[41] = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, + 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, + 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_32_5ms[81] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, + 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_48_5ms[81] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, + 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, + 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, + 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240}; + +const LC3_INT ACC_COEFF_PER_BAND_PLC_96_5ms[81] = { + 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, + 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, + 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360, 366, 372, + 378, 384, 390, 396, 402, 408, 414, 420, 426, 432, 438, 444, 450, 456, 462, 468, 474, 480}; + +const LC3_INT* ACC_COEFF_PER_BAND_PLC_5ms[] = { + ACC_COEFF_PER_BAND_PLC_8_5ms, ACC_COEFF_PER_BAND_PLC_16_5ms, ACC_COEFF_PER_BAND_PLC_24_5ms, + ACC_COEFF_PER_BAND_PLC_32_5ms, ACC_COEFF_PER_BAND_PLC_48_5ms, ACC_COEFF_PER_BAND_PLC_96_5ms}; + +const LC3_INT32 mdct_grp_bins[10] = { 4, 14, 24, 44, 84, 164, 244, 324, 404, 484 }; + diff --git a/lc3plus/constants.h b/lc3plus/constants.h new file mode 100755 index 0000000000..c0c9e286e5 --- /dev/null +++ b/lc3plus/constants.h @@ -0,0 +1,203 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef CONSTANTS_H +#define CONSTANTS_H + +#include "defines.h" +#include "structs.h" + +/* DCT */ +extern const Complex dct2_16[16]; + +/* Ari coder */ +extern const LC3_INT ari_tns_order_cf[2][9]; +extern const LC3_INT ari_tns_freq_cf[8][18]; +extern const LC3_INT ari_spec_lookup_fl[4096]; +extern const LC3_INT ari_spec_cumfreq_fl[64][18]; +extern const LC3_INT ari_spec_bits_fl[64][17]; + +/* SNS */ +extern const LC3_FLOAT sns_LFCB[8][32]; +extern const LC3_FLOAT sns_HFCB[8][32]; +extern const LC3_INT pvq_enc_A[16][11]; +extern const LC3_FLOAT idct_lookup[M][M]; + +/* 12.8 kHz resampler */ +extern const LC3_FLOAT lp_scale_factors[6]; + +extern const LC3_INT32 resamp_params[][4]; +extern const LC3_FLOAT *lp_filter[6]; +extern const LC3_FLOAT highpass50_filt_b[3]; +extern const LC3_FLOAT highpass50_filt_a[3]; +extern const LC3_INT up_fac[6]; + +/* TNS */ +extern const LC3_FLOAT quants_pts_tns[17]; +extern const LC3_INT huff_bits_tns[8][17]; +extern const LC3_INT order1_tns[8]; +extern const LC3_INT order2_tns[8]; +extern const LC3_FLOAT lagw_tns[9]; +extern const LC3_FLOAT quants_pts_tns[17]; +extern const LC3_FLOAT quants_thr_tns[18]; + +/* SNS */ +extern const LC3_FLOAT sns_vq_far_adj_gains_fl[8]; +extern const LC3_FLOAT sns_vq_near_adj_gains_fl[4]; +extern const LC3_FLOAT sns_vq_reg_lf_adj_gains_fl[4]; +extern const LC3_FLOAT q_g_sns[6]; +extern const LC3_FLOAT sns_vq_reg_adj_gains_fl[2]; +extern const LC3_FLOAT sns_dec_gains[4][8]; + +/* Global Gain */ +extern const LC3_INT gg_p1[6]; +extern const LC3_INT gg_p2[6]; +extern const LC3_INT gg_p3[6]; +extern const LC3_FLOAT gg_c[6]; +extern const LC3_FLOAT gg_d[6]; + +/* Olpa */ +extern const LC3_FLOAT olpa_down2[5]; +extern const LC3_FLOAT olpa_acw[98]; + +/* LTPF */ +extern const LC3_FLOAT conf_inter_filter_48[4][12]; +extern const LC3_FLOAT conf_inter_filter_32[4][8]; +extern const LC3_FLOAT conf_inter_filter_24[4][6]; +extern const LC3_FLOAT conf_inter_filter_16[4][4]; +extern const LC3_FLOAT conf_tilt_filter_48[4][11]; +extern const LC3_FLOAT conf_tilt_filter_32[4][7]; +extern const LC3_FLOAT conf_tilt_filter_24[4][5]; +extern const LC3_FLOAT conf_tilt_filter_16[4][3]; +extern const LC3_FLOAT inter4_1[33]; +extern const LC3_FLOAT enc_inter_filter[4][4]; + +/* Bandwidth Detector */ +extern const LC3_INT threshold_quiet[4]; +extern const LC3_INT threshold_brickwall[4]; +extern const LC3_INT brickwall_dist[4]; +extern const LC3_INT BW_warp_idx_start_16k[4]; +extern const LC3_INT BW_warp_idx_stop_16k[4]; +extern const LC3_INT BW_warp_idx_start_24k[4]; +extern const LC3_INT BW_warp_idx_stop_24k[4]; +extern const LC3_INT BW_warp_idx_start_32k[4]; +extern const LC3_INT BW_warp_idx_stop_32k[4]; +extern const LC3_INT BW_warp_idx_start_48k[4]; +extern const LC3_INT BW_warp_idx_stop_48k[4]; +extern const LC3_INT* BW_warp_idx_start_all[4]; +extern const LC3_INT* BW_warp_idx_stop_all[4]; + +extern const LC3_INT BW_warp_idx_start_16k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_16k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_start_24k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_24k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_start_32k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_32k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_start_48k_2_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_48k_2_5ms[4]; +extern const LC3_INT* BW_warp_idx_start_all_2_5ms[4]; +extern const LC3_INT* BW_warp_idx_stop_all_2_5ms[4]; +extern const LC3_INT BW_cutoff_bin_all_2_5ms_HR[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT bands_number_2_5ms_HR[6]; + +extern const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT bands_number_2_5ms[5]; + + +extern const LC3_INT BW_warp_idx_start_16k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_16k_5ms[4]; +extern const LC3_INT BW_warp_idx_start_24k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_24k_5ms[4]; +extern const LC3_INT BW_warp_idx_start_32k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_32k_5ms[4]; +extern const LC3_INT BW_warp_idx_start_48k_5ms[4]; +extern const LC3_INT BW_warp_idx_stop_48k_5ms[4]; +extern const LC3_INT* BW_warp_idx_start_all_5ms[4]; +extern const LC3_INT* BW_warp_idx_stop_all_5ms[4]; +extern const LC3_INT BW_cutoff_bin_all_5ms[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT bands_number_5ms[6]; +extern const LC3_INT BW_cutoff_bin_all_HR[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT BW_cutoff_bin_all_5ms_HR[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT BW_cutoff_bin_all[MAX_BW_BANDS_NUMBER]; +extern const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER]; + +/* Arithmetic coding */ +extern const LC3_INT tns_cf[8][18]; +extern const LC3_INT tns_freq_cf[2][9]; + +/* MDCT Windows */ +extern const LC3_FLOAT MDCT_WINDOW_80[160]; +extern const LC3_FLOAT MDCT_WINDOW_160[320]; +extern const LC3_FLOAT MDCT_WINDOW_240[480]; +extern const LC3_FLOAT MDCT_WINDOW_320[640]; +extern const LC3_FLOAT MDCT_WINDOW_480[960]; +extern const LC3_FLOAT MDCT_WINDOW_960[1920]; +extern const LC3_FLOAT* MDCT_WINS_10ms[2][6]; +extern const LC3_INT MDCT_la_zeroes[6]; + +extern const LC3_FLOAT MDCT_WINDOW_80_2_5ms[40]; +extern const LC3_FLOAT MDCT_WINDOW_160_2_5ms[80]; +extern const LC3_FLOAT MDCT_WINDOW_240_2_5ms[120]; +extern const LC3_FLOAT MDCT_WINDOW_320_2_5ms[160]; +extern const LC3_FLOAT MDCT_WINDOW_480_2_5ms[240]; +extern const LC3_FLOAT* MDCT_WINS_2_5ms[2][6]; +extern const LC3_INT MDCT_la_zeroes_2_5ms[6]; + + +extern const LC3_FLOAT MDCT_WINDOW_80_5ms[80]; +extern const LC3_FLOAT MDCT_WINDOW_160_5ms[160]; +extern const LC3_FLOAT MDCT_WINDOW_240_5ms[240]; +extern const LC3_FLOAT MDCT_WINDOW_320_5ms[320]; +extern const LC3_FLOAT MDCT_WINDOW_480_5ms[480]; +extern const LC3_FLOAT* MDCT_WINS_5ms[2][6]; +extern const LC3_INT MDCT_la_zeroes_5ms[6]; + +extern const LC3_INT MDCT_WINDOWS_LENGTHS_10ms[6]; + +extern const LC3_INT MDCT_WINDOWS_LENGTHS_2_5ms[6]; + + +extern const LC3_INT MDCT_WINDOWS_LENGTHS_5ms[6]; + +/* Per band energy */ +extern const LC3_INT* ACC_COEFF_PER_BAND[6]; +extern const LC3_INT* ACC_COEFF_PER_BAND_HR[6]; + +extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms_HR[6]; +extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms[5]; + + +extern const LC3_INT* ACC_COEFF_PER_BAND_5ms_HR[6]; +extern const LC3_INT* ACC_COEFF_PER_BAND_5ms[5]; + +/* Near Nyquist detector */ +extern const LC3_INT NN_thresh; + + +extern const LC3_INT32 xavg_N_grp[5]; +extern const LC3_FLOAT *hannOla_wins[5]; +extern const LC3_INT32 gwlpr[MAX_LGW+1]; +extern const LC3_INT32 mdct_grp_bins[10]; +extern const LC3_FLOAT* PhECU_whr16ms_wins[5]; + +extern const LC3_FLOAT plc_preemph_fac[]; +extern const LC3_INT* ACC_COEFF_PER_BAND_PLC[]; +extern const LC3_INT* ACC_COEFF_PER_BAND_PLC_2_5ms[]; +extern const LC3_INT* ACC_COEFF_PER_BAND_PLC_5ms[]; +extern const LC3_FLOAT *plc_tdc_lpc_all[6]; +extern const LC3_FLOAT plc_tdc_lpc_8[17]; +extern const LC3_FLOAT plc_tdc_lpc_16[17]; +extern const LC3_FLOAT plc_tdc_lpc_24[17]; +extern const LC3_FLOAT plc_tdc_lpc_32[17]; +extern const LC3_FLOAT plc_tdc_lpc_48[17]; +extern const LC3_FLOAT plc_tdc_lpc_96[17]; +extern const LC3_FLOAT plc_tdc_lpc_8_25ms[9]; + +#endif diff --git a/lc3plus/cutoff_bandwidth.c b/lc3plus/cutoff_bandwidth.c new file mode 100755 index 0000000000..642b2afda2 --- /dev/null +++ b/lc3plus/cutoff_bandwidth.c @@ -0,0 +1,27 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) +{ + LC3_INT i = 0; + + if (len > bw_bin){ + for (i = -1; i < 3; i++) { + d_fl[bw_bin + i] = d_fl[bw_bin + i] * LC3_POW(2, -(i + 2)); + } + + for (i = bw_bin + 3; i < len; i++) { + d_fl[i] = 0; + } + } +} diff --git a/lc3plus/dct4.c b/lc3plus/dct4.c new file mode 100755 index 0000000000..8fd5784b28 --- /dev/null +++ b/lc3plus/dct4.c @@ -0,0 +1,95 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void dct2_init(Dct2* dct, int length) +{ + assert(length <= MAX_LEN); + dct->length = length; + fft_init(&dct->fft, length); +} + +void dct2_free(Dct2* dct) +{ + if (dct) { + fft_free(&dct->fft); + memset(dct, 0, sizeof(*dct)); + } +} + +void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output) +{ + Complex tmp1[MAX_LEN]; + Complex tmp2[MAX_LEN]; + int i = 0; + const int len = dct->length; + assert(input != output); + + for (i = 0; i < len / 2; i++) { + tmp1[i] = cmplx(input[i * 2], 0); + tmp1[len - i - 1] = cmplx(input[i * 2 + 1], 0); + } + + fft_apply(&dct->fft, tmp1, tmp2); + + for (i = 0; i < len; i++) { + output[i] = cmul(tmp2[i], dct2_16[i]).r; + } + output[0] /= (LC3_FLOAT)1.414213562373095; /* SQRT(2) */ +} + + +void dct4_init(Dct4* dct, int length) +{ + int i = 0; + assert(length <= MAX_LEN); + dct->length = length; + dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); + dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); + for (i = 0; i < length / 2; i++) { + dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI * (i + (LC3_FLOAT)0.25) / length); + dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI * i / length); + } + fft_init(&dct->fft, length / 2); +} + +void dct4_free(Dct4* dct) +{ + if (dct) { + free(dct->twid1); + free(dct->twid2); + fft_free(&dct->fft); + memset(dct, 0, sizeof(*dct)); + } +} + +void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output) +{ + Complex tmp2[MAX_LEN / 2]; + int i = 0; + Complex* tmp1 = (Complex*)output; + const int len = dct->length; + const LC3_FLOAT norm = (LC3_FLOAT)1.0 / LC3_SQRT((LC3_FLOAT)(len >> 1)); + assert(input != output); + + for (i = 0; i < len / 2; i++) { + tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); + } + + fft_apply(&dct->fft, tmp1, tmp2); + + for (i = 0; i < len / 2; i++) { + Complex t = cmul(tmp2[i], dct->twid2[i]); + output[i * 2] = t.r * norm; + output[len - i * 2 - 1] = -t.i * norm; + } +} diff --git a/lc3plus/dec_entropy.c b/lc3plus/dec_entropy.c new file mode 100755 index 0000000000..d8512a1068 --- /dev/null +++ b/lc3plus/dec_entropy.c @@ -0,0 +1,277 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); +static void read_uint_fl(LC3_INT nbits, LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* val); + +void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit) +{ + if (ptr[*bp_side] & *mask_side) { + *bit = 1; + } else { + *bit = 0; + } + + if (*mask_side == 128) { + *mask_side = 1; + *bp_side = *bp_side - 1; + } else { + *mask_side = *mask_side * 2; + } +} + +void read_uint_fl(LC3_INT nbits, LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* val) +{ + LC3_INT bit = 0, i = 0; + + read_bit_fl(ptr, mask_side, bp_side, val); + + for (i = 1; i < nbits; i++) { + read_bit_fl(ptr, mask_side, bp_side, &bit); + *val = *val + (bit << i); + } +} + +#ifdef ENABLE_PADDING +LC3_INT paddingDec_fl(LC3_UINT8* bytes, LC3_INT nbbits, LC3_INT L_spec, LC3_INT bw_cutoff_bits, LC3_INT ep_enabled, LC3_INT* total_padding, LC3_INT *np_zero) +{ + LC3_INT lastnz_threshold; + LC3_INT val, padding_len_bits, padding_len; + LC3_INT bp_side; + LC3_INT mask_side; + LC3_UINT8* ptr = bytes; + + LC3_INT nbbytes = nbbits >> 3; + LC3_INT lastnz; + LC3_INT bw_cutoff_idx; + LC3_INT nbits = ceil(LC3_LOGTWO(L_spec / 2)); + + if (nbits > nbbits) + { + return 1; + } + + *np_zero = 0; + + *total_padding = 0; + + bp_side = (nbbits - 1) >> 3; + mask_side = 1 << (8 - (nbbits - (bp_side << 3))); + + if (bp_side < 19 || bp_side >= LC3PLUS_MAX_BYTES) { + return 1; + } + + ptr = bytes; + + if (bw_cutoff_bits > 0) { + read_uint_fl(bw_cutoff_bits, ptr, &mask_side, &bp_side, &bw_cutoff_idx); + } + + read_uint_fl(nbits, ptr, &mask_side, &bp_side, &lastnz); + + lastnz_threshold = (1 << nbits) - 1 - 1; + + while (lastnz == lastnz_threshold) { + padding_len_bits = 16 - nbits - bw_cutoff_bits - 4; + + /*Read padding length*/ + read_uint_fl(padding_len_bits, ptr, &mask_side, &bp_side, &padding_len); + + /* Read 4 reserved bits */ + read_uint_fl(4, ptr, &mask_side, &bp_side, &val); + + if (ep_enabled == 0) + { + /* Discard padding length bytes */ + bp_side = bp_side - padding_len; + *total_padding = *total_padding + padding_len + 2; + } + else + { + *total_padding = *total_padding + 2; + *np_zero = *np_zero + padding_len; + } + + /* check if minimum payload size is reached */ + if ((nbbytes - (*total_padding + *np_zero)) < 20) { + return 1; + } + + /* Read bandwidth bits */ + if (bw_cutoff_bits > 0) { + read_uint_fl(bw_cutoff_bits, ptr, &mask_side, &bp_side, &bw_cutoff_idx); + } + + read_uint_fl(nbits, ptr, &mask_side, &bp_side, &lastnz); + } + + if (ep_enabled != 0) + { + *total_padding = *total_padding + *np_zero; + } + + return 0; +} +#endif + +void processDecoderEntropy_fl(LC3_UINT8* bytes, LC3_INT numbytes, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT N, LC3_INT fs_idx, + LC3_INT bw_cutoff_bits, LC3_INT* bfi, LC3_INT* gg_idx, LC3_INT* scf_idx, LC3_INT* fac_ns_idx, + LC3_INT* tns_numfilters, LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* bw_cutoff_idx, LC3_INT* lastnz, + LC3_INT* lsbMode, LC3_INT frame_dms) +{ + + LC3_INT plc_trigger_bw = 0, plc_trigger_last_nz = 0, plc_trigger_SNS1 = 0, plc_trigger_SNS2 = 0, tmp = 0, bit = 0, + submodeMSB = 0, i = 0, ltpf_tmp[3] = {0}, ind = 0, submodeLSB = 0, bp_side_local = 0, mask_side_local = 0; + LC3_UINT8* ptr; + LC3_INT gainMSBbits[4] = {1, 1, 2, 2}; + + *bp_side = -1; + bp_side_local = numbytes - 1; /* Matlab offset by 1 */ + mask_side_local = 1; + *mask_side = -1; + ptr = bytes; + *lsbMode = -1; + *lastnz = -1; + + plc_trigger_bw = 1; /* Bandwidth */ + plc_trigger_last_nz = 1; /* Last non-zero tuple */ + plc_trigger_SNS1 = 1; /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + plc_trigger_SNS2 = 1; /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + + + + /* Bandwidth */ + if (bw_cutoff_bits > 0) { + read_uint_fl(bw_cutoff_bits, ptr, &mask_side_local, &bp_side_local, bw_cutoff_idx); + + if (fs_idx < *bw_cutoff_idx) { + *bfi = plc_trigger_bw; + + if (*bfi) { + return; + } + } + } else { + *bw_cutoff_idx = fs_idx; + } + + /* Number of TNS filters */ + if (*bw_cutoff_idx < 3 || frame_dms == 25) { + *tns_numfilters = 1; + } else { + *tns_numfilters = 2; + } + + /* Last non-zero tuple */ + read_uint_fl(ceil(LC3_LOGTWO(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz); + *lastnz = (*lastnz + 1) * 2; + + if (*lastnz > N) { + *bfi = plc_trigger_last_nz; + if (*bfi) { + return; + } + } + + /* LSB mode bit */ + read_bit_fl(ptr, &mask_side_local, &bp_side_local, lsbMode); + + /* Global gain */ + read_uint_fl(8, ptr, &mask_side_local, &bp_side_local, gg_idx); + + /* TNS activation flag */ + for (i = 0; i < *tns_numfilters; i++) { + read_bit_fl(ptr, &mask_side_local, &bp_side_local, &bit); + tns_order[i] = bit; + } + + /* LTPF activation flag */ + read_bit_fl(ptr, &mask_side_local, &bp_side_local, <pf_tmp[0]); + + /* SNS-VQ 1st stage */ + read_uint_fl(5, ptr, &mask_side_local, &bp_side_local, &scf_idx[0]); + read_uint_fl(5, ptr, &mask_side_local, &bp_side_local, &scf_idx[1]); + + /* SNS-VQ 2nd stage side-info (3-4 bits) */ + read_bit_fl(ptr, &mask_side_local, &bp_side_local, &submodeMSB); + scf_idx[2] = submodeMSB * 2; + + read_uint_fl(gainMSBbits[scf_idx[2]], ptr, &mask_side_local, &bp_side_local, &scf_idx[3]); + read_bit_fl(ptr, &mask_side_local, &bp_side_local, &scf_idx[4]); + + /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + if (submodeMSB == 0) { + read_uint_fl(25, ptr, &mask_side_local, &bp_side_local, &tmp); + if (tmp >= 33460056) { + *bfi = plc_trigger_SNS1; + if (*bfi) { + return; + } + } + + ind = floor(tmp / 2390004); + scf_idx[5] = tmp - ind * 2390004; + + if (ind < 2) { + submodeLSB = 1; + scf_idx[3] = scf_idx[3] * 2 + ind; + scf_idx[6] = -2; + } else { + submodeLSB = 0; + scf_idx[6] = ind - 2; + } + + } else { + read_uint_fl(24, ptr, &mask_side_local, &bp_side_local, &tmp); + + if (tmp >= 16708096) { + *bfi = plc_trigger_SNS2; + if (*bfi) { + return; + } + } + + if (tmp >= 15158272) { + submodeLSB = 1; + scf_idx[3] = scf_idx[3] * 2 + ((tmp - 15158272) & 1); + scf_idx[5] = floor((tmp - 15158272) / 2); + scf_idx[6] = -2; + } else { + submodeLSB = 0; + scf_idx[5] = tmp; + scf_idx[6] = -1; + } + } + + scf_idx[2] = scf_idx[2] + submodeLSB; + + /* LTPF data */ + if (ltpf_tmp[0] == 1) { + read_bit_fl(ptr, &mask_side_local, &bp_side_local, <pf_tmp[1]); + read_uint_fl(9, ptr, &mask_side_local, &bp_side_local, <pf_tmp[2]); + } else { + ltpf_tmp[1] = 0; + ltpf_tmp[2] = 0; + } + + for (i = 0; i < 3; i++) { + ltpf_idx[i] = ltpf_tmp[i]; + } + + /* Noise factor */ + read_uint_fl(3, ptr, &mask_side_local, &bp_side_local, fac_ns_idx); + + *bp_side = bp_side_local; + *mask_side = mask_side_local; +} diff --git a/lc3plus/dec_lc3_fl.c b/lc3plus/dec_lc3_fl.c new file mode 100755 index 0000000000..88c528b0f6 --- /dev/null +++ b/lc3plus/dec_lc3_fl.c @@ -0,0 +1,365 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs_in, void* s_out, int bps, int bfi_ext) +{ + DecSetup* h_DecSetup; + LC3_INT mask_side = 0, bp_side = 0, bfi = 0, gg_idx = 0, fac_ns_idx = 0, tns_numfilters = 0, bw_cutoff_idx = 0, + lastnz = 0, lsbMode = 0, nf_seed = 0, zero_frame = 0, residualPresent = 0, nbits_residual = 0, bitsRead = 0, + i = 0, tns_order[2] = {0}, sqQdec[MAX_LEN] = {0}; + LC3_INT b_left; + LC3_FLOAT stab_fac = 0; + + h_DecSetup = decoder->channel_setup[channel]; + + memset(h_DecSetup->tns_idx, 0, sizeof(*h_DecSetup->tns_idx) * TNS_NUMFILTERS_MAX * MAXLAG); + + bfi = bfi_ext; + + decoder->rframe = 0; + if (bfi == 3) + { + bfi = 2; + decoder->rframe = 1; + } + + /* Entropy decoding */ + if (bfi != 1) { + processDecoderEntropy_fl(bs_in, h_DecSetup->targetBytes, &mask_side, &bp_side, decoder->yLen, decoder->fs_idx, + decoder->BW_cutoff_bits, &bfi, &gg_idx, h_DecSetup->scf_idx, &fac_ns_idx, + &tns_numfilters, tns_order, h_DecSetup->ltpf_param, &bw_cutoff_idx, &lastnz, &lsbMode, decoder->frame_dms + ); + h_DecSetup->BW_cutoff_idx_nf = bw_cutoff_idx; + } + + /* Arithmetic decoding */ + if (bfi != 1) { + processAriDecoder_fl(bs_in, bp_side, mask_side, decoder->yLen, decoder->fs_idx, + h_DecSetup->enable_lpc_weighting, tns_numfilters, lsbMode, lastnz, &bfi, tns_order, fac_ns_idx, gg_idx, h_DecSetup->resBits, + sqQdec, &nf_seed, h_DecSetup->tns_idx, &zero_frame, h_DecSetup->targetBytes, &nbits_residual, &residualPresent, decoder->frame_dms, + decoder->n_pc, decoder->be_bp_left, decoder->be_bp_right, 0, &b_left, &h_DecSetup->spec_inv_idx, + decoder->hrmode + ); + + if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1) + { + LC3_INT32 max_bw_stopband = BW_cutoff_bin_all[bw_cutoff_idx]; + bfi = 2; + switch (decoder->frame_dms) + { +# ifdef ENABLE_025_DMS_MODE + case 25: + max_bw_stopband = max_bw_stopband >> 2; + break; +# endif +# ifdef ENABLE_050_DMS_MODE + case 50: + max_bw_stopband = max_bw_stopband >> 1; + break; +# endif +# ifdef ENABLE_075_DMS_MODE + case 75: + max_bw_stopband = 3 * (max_bw_stopband >> 2); + break; +# endif + case 100: + break; + } + + h_DecSetup->spec_inv_idx = MAX(lastnz, max_bw_stopband); + } + + /* Cast from int to float */ + for (i = 0; i < decoder->yLen; i++) { + h_DecSetup->sqQdec_fl[i] = (LC3_FLOAT)sqQdec[i]; + } + } + + if (bfi != 1) + { + /* SNS Quantize Decoder */ + process_snsQuantizesScf_Dec(h_DecSetup->scf_idx, h_DecSetup->scf_q); + } + if (h_DecSetup->PlcAdvSetup) + { + processPlcComputeStabFacMain_fl(h_DecSetup->scf_q, h_DecSetup->PlcAdvSetup->scf_q_old, h_DecSetup->PlcAdvSetup->scf_q_old_old, bfi, h_DecSetup->PlcSetup.prevBfi, + h_DecSetup->PlcSetup.prevprevBfi, &h_DecSetup->PlcAdvSetup->stabFac); + } + + if ( bfi != 1 ) + { + stab_fac = 1; + if (h_DecSetup->PlcAdvSetup) + { + stab_fac = h_DecSetup->PlcAdvSetup->stabFac; + } + + /* Partial Concealment */ + processPcMain_fl(&bfi, decoder, h_DecSetup->sqQdec_fl, h_DecSetup, h_DecSetup->ltpf_param[0], stab_fac, gg_idx, h_DecSetup->quantizedGainOff, + fac_ns_idx, &h_DecSetup->statePC, h_DecSetup->spec_inv_idx, decoder->yLen); + } + + /* Decoding only if no bit error detected */ + if (bfi != 1) { + /* Residual decoding */ + if (residualPresent) { + processResidualDecoding_fl(&bitsRead, h_DecSetup->sqQdec_fl, decoder->yLen, h_DecSetup->resBits, + nbits_residual + , decoder->hrmode + ); + } + + + /* Noise filling */ + if (zero_frame == 0) { + processNoiseFilling_fl(h_DecSetup->sqQdec_fl, nf_seed, fac_ns_idx, decoder->cutoffBins[h_DecSetup->BW_cutoff_idx_nf], decoder->frame_dms, h_DecSetup->prev_fac_ns, h_DecSetup->spec_inv_idx); + } + + /* Application of global gain */ + processApplyGlobalGain_fl(h_DecSetup->sqQdec_fl, decoder->yLen, gg_idx, h_DecSetup->quantizedGainOff); + + /* TNS decoder */ + processTnsDecoder_fl(h_DecSetup->sqQdec_fl, h_DecSetup->tns_idx, tns_order, tns_numfilters, + decoder->cutoffBins[bw_cutoff_idx], h_DecSetup->N_red_tns, h_DecSetup->fs_red_tns); + + /* SNS interpolation */ + processSnsInterpolateScf_fl(h_DecSetup->scf_q, 0, decoder->bands_number, h_DecSetup->int_scf); + + /* MDCT shaping */ + processMdctShaping_fl(h_DecSetup->sqQdec_fl, h_DecSetup->int_scf, decoder->bands_offset, decoder->bands_number); + } + + /* PLC */ + processPlcMain_fl(h_DecSetup->sqQdec_fl, h_DecSetup->x_fl, decoder, h_DecSetup, bfi, h_DecSetup->PlcAdvSetup, &h_DecSetup->PlcSetup, + decoder->plcMeth, h_DecSetup->ltpf_mem_pitch, h_DecSetup->ltpf_mem_pitch_fr, decoder->tilt, decoder->bands_offset, + decoder->bands_number, decoder->bands_offsetPLC, decoder->n_bandsPLC, decoder->hrmode, &h_DecSetup->statePC); + + processPlcDampingScramblingMain_fl(&h_DecSetup->PlcNsSetup.seed, + &h_DecSetup->statePC.seed, h_DecSetup->statePC.ns_nbLostCmpt_pc, + h_DecSetup->PlcSetup.nbLostCmpt, &h_DecSetup->PlcAdvSetup->stabFac, + &h_DecSetup->PlcAdvSetup->cum_fading_slow, &h_DecSetup->PlcAdvSetup->cum_fading_fast, + h_DecSetup->PlcSetup.q_d_prev, h_DecSetup->sqQdec_fl, h_DecSetup->spec_inv_idx, decoder->yLen, bfi, + decoder->frame_dms, h_DecSetup->concealMethod, h_DecSetup->ltpf_mem_pitch, h_DecSetup->ltpf_param[0], + &h_DecSetup->PlcAdvSetup->cum_fflcAtten); + + /* IMDCT */ + if (h_DecSetup->concealMethod == 4 || bfi != 1 ) + { + ProcessingIMDCT_fl(h_DecSetup->sqQdec_fl, decoder->frame_length, decoder->imdct_win, decoder->imdct_winLen, decoder->imdct_laZeros, + h_DecSetup->imdct_mem, h_DecSetup->x_fl, &h_DecSetup->dct4structImdct); + } + + processPlcUpdate_fl(h_DecSetup->PlcAdvSetup + , decoder->frame_length, h_DecSetup->x_fl, h_DecSetup->scf_q, + &h_DecSetup->PlcSetup.nbLostCmpt, &h_DecSetup->PlcNsSetup.cum_alpha, bfi, &h_DecSetup->PlcSetup.prevBfi, &h_DecSetup->PlcSetup.prevprevBfi); + + /* LTPF decoder */ + process_ltpf_decoder_fl(h_DecSetup->x_fl, decoder->frame_length, h_DecSetup->x_fl, decoder->fs, + h_DecSetup->ltpf_mem_x, h_DecSetup->ltpf_mem_y, &h_DecSetup->ltpf_mem_pitch, + &h_DecSetup->ltpf_mem_pitch_fr, &h_DecSetup->ltpf_mem_gain, &h_DecSetup->ltpf_mem_beta_idx, + bfi, h_DecSetup->ltpf_param, h_DecSetup->ltpf_param_mem, h_DecSetup->ltpf_conf_beta_idx, + h_DecSetup->ltpf_conf_beta, h_DecSetup->concealMethod, h_DecSetup->alpha + , &h_DecSetup->ltpf_mem_active + ); + + { + /* Round, scale and copy output to output buffer */ + if (bps == 16) { + for (i = 0; i < decoder->frame_length; i++) { + LC3_FLOAT tmp = round(h_DecSetup->x_fl[i]); + ((int16_t*)s_out)[i] = (int16_t)fmaxf(fminf(tmp, 32767), -32768); + } + } else { + for (i = 0; i < decoder->frame_length; i++) { + LC3_FLOAT tmp = round(LC3_CONST_POW_2_23 * LC3_CONST_POW_2_M15 * h_DecSetup->x_fl[i]); + ((int32_t*)s_out)[i] = (int32_t)fmaxf(fminf(tmp, LC3_CONST_POW_2_23_RED), LC3_CONST_POW_2_23_NEG); + } + } + } + return bfi; +} + +LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num_bytes, void** output, LC3_INT32 bps, LC3_INT32 bfi_ext) +{ + LC3_INT32 ch, bfi, lc3_num_bytes; + LC3PLUS_Error err; + LC3_INT32 fec_num_bytes; + LC3_INT32 lc3_channel_num_bytes; + LC3_INT32 channel_bfi, out_bfi; + LC3PLUS_EpModeRequest channel_epmr; + + bfi = bfi_ext; + lc3_num_bytes = 0; + err = LC3PLUS_OK; + + if (bfi == 0) + { + bfi = !num_bytes; + } + + if (decoder->ep_enabled) + { + decoder->combined_channel_coding = decoder->channels > 1 && num_bytes <= 160; + + if (decoder->combined_channel_coding) + { + fec_num_bytes = num_bytes; + + decoder->error_report = + fec_decoder(input, fec_num_bytes, &lc3_num_bytes, (LC3PLUS_EpModeRequest*)&decoder->epmr, decoder->combined_channel_coding, + &decoder->n_pccw, &bfi, &decoder->be_bp_left, &decoder->be_bp_right, &decoder->n_pc, &decoder->m_fec); + + for (ch = 0; ch < decoder->channels; ch++) + { + lc3_channel_num_bytes = lc3_num_bytes / decoder->channels + (ch < (lc3_num_bytes % decoder->channels)); + + + if (bfi != 1 && lc3_channel_num_bytes != decoder->channel_setup[ch]->last_size) + { + err = update_dec_bitrate(decoder, ch, lc3_channel_num_bytes); + if (err) + { + bfi = 1; + decoder->last_error = err; + } + else + { + decoder->channel_setup[ch]->last_size = lc3_channel_num_bytes; + } + } + + bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi); + input += decoder->channel_setup[ch]->targetBytes; + } + } + else + { + decoder->epmr = LC3PLUS_EPMR_HIGH_NC; + out_bfi = 0; + + for (ch = 0; ch < decoder->channels; ch++) + { + fec_num_bytes = num_bytes / decoder->channels + (ch < (num_bytes % decoder->channels)); + + channel_bfi = bfi; + + decoder->error_report = fec_decoder(input, fec_num_bytes, &lc3_num_bytes, &channel_epmr, + decoder->combined_channel_coding, &decoder->n_pccw, &channel_bfi, + &decoder->be_bp_left, &decoder->be_bp_right, &decoder->n_pc, &decoder->m_fec); + + decoder->epmr = MIN((LC3PLUS_EpModeRequest) decoder->epmr, channel_epmr); + + +#ifdef ENABLE_PADDING + if (channel_bfi != 1) + { + LC3_INT32 padding_len = 0, np_zero = 0; + + if (paddingDec_fl(input, (lc3_num_bytes << 3), decoder->yLen, decoder->BW_cutoff_bits, decoder->ep_enabled, &padding_len, &np_zero)) + { + channel_bfi = 1; + } + + input = input + np_zero; + decoder->n_pc = MAX(decoder->n_pc - (2 * np_zero), 0); + + if (channel_bfi == 2) + { + if (decoder->be_bp_right < (8 * np_zero)) + { + channel_bfi = 0; + decoder->be_bp_left = -1; + decoder->be_bp_right = -1; + } + else + { + decoder->be_bp_right = decoder->be_bp_right - (8 * np_zero); + decoder->be_bp_left = MAX(decoder->be_bp_left - (8 * np_zero), 0); + } + } + lc3_num_bytes = lc3_num_bytes - padding_len; + } +#endif + + if (channel_bfi != 1 && lc3_num_bytes != decoder->channel_setup[ch]->last_size) + { + err = update_dec_bitrate(decoder, ch, lc3_num_bytes); + if (err) + { + channel_bfi = 1; + decoder->last_error = err; + } + else + { + decoder->channel_setup[ch]->last_size = lc3_num_bytes; + } + } + + channel_bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, channel_bfi); + + out_bfi |= channel_bfi; + input += fec_num_bytes; + } + + bfi = out_bfi & 1; + } + } + else + { + for (ch = 0; ch < decoder->channels; ch++) + { + lc3_num_bytes = num_bytes / decoder->channels + (ch < (num_bytes % decoder->channels)); + +#ifdef ENABLE_PADDING + if (bfi != 1) + { + LC3_INT32 padding_len = 0, np_zero = 0; + + if (paddingDec_fl(input, (lc3_num_bytes << 3), decoder->yLen, decoder->BW_cutoff_bits, decoder->ep_enabled, &padding_len, &np_zero)) + { + bfi = 1; + decoder->last_error = LC3PLUS_PADDING_ERROR; + } + + lc3_num_bytes = lc3_num_bytes - padding_len; + if (lc3_num_bytes < 20 || lc3_num_bytes > LC3PLUS_MAX_BYTES) + { + bfi = 1; /* mark frame as broken if frame size is below the minimum of 20 bytes or above the maximum of LC3PLUS_MAX_BYTES */ + decoder->last_error = FRAMESIZE_ERROR; + } + } +#endif + + if (bfi != 1 && lc3_num_bytes != decoder->channel_setup[ch]->last_size) + { + err = update_dec_bitrate(decoder, ch, lc3_num_bytes); + if (err) + { + bfi = 1; + decoder->last_error = err; + } + else + { + decoder->channel_setup[ch]->last_size = lc3_num_bytes; + } + } + + bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi); + input += decoder->channel_setup[ch]->targetBytes; + } + } + + if (decoder->last_error == LC3PLUS_OK && bfi) decoder->last_error = LC3PLUS_DECODE_ERROR; + return bfi == 1 ? LC3PLUS_DECODE_ERROR : LC3PLUS_OK; +} diff --git a/lc3plus/defines.h b/lc3plus/defines.h new file mode 100755 index 0000000000..d978fa4e15 --- /dev/null +++ b/lc3plus/defines.h @@ -0,0 +1,238 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef DEFINES_H +#define DEFINES_H + +#include "stdint.h" + + +typedef float LC3_FLOAT; +typedef int32_t LC3_INT; +typedef int16_t LC3_INT16; +typedef uint16_t LC3_UINT16; +typedef short LC3_SHORT; +typedef uint8_t LC3_UINT8; +typedef int8_t LC3_INT8; +typedef uint32_t LC3_UINT32; + +/* Release defines */ +// #define ENABLE_2_5MS_MODE +#define ENABLE_5MS_MODE +#define ENABLE_10_MS_MODE +#define ENABLE_ADVANCED_PLC_FL +#define ENABLE_ADVANCED_PLC_FL_DEFAULT +#define ENABLE_BW_CONTROLLER +//#define ENABLE_HR_MODE_FL +#define ENABLE_PADDING +#define ENABLE_RFRAME_FL +#define ENABLE_PLC +/* flags */ +#define ENABLE_PLC_MODE_FLAG +#define ENABLE_BANDWIDTH_FLAG +#define ENABLE_EP_MODE_FLAG +#define ENABLE_FRAME_MS_FLAG +#define ENABLE_HR_MODE_FL_FLAG + +#ifndef NO_POST_REL_CHANGES +/* Post-release non-bitexact changes */ + +#endif /* NO_POST_REL_CHANGES */ + +/* Precision Defines */ +#define LC3_FABS(x) (fabsf(x)) +#define LC3_POW(x, y) (powf(x, y)) +#define LC3_LOGTEN(x) (log10f(x)) +#define LC3_LOGTWO(x) (log2f(x)) +# define LC3_COS(x) (cos(x)) +# define LC3_SIN(x) (sin(x)) +#define LC3_SQRT(x) (sqrtf(x)) +#define LC3_EXP(x) (expf(x)) + +# define MAX_BR 320000 /* 400 * 800 */ +# define MIN_BR_100DMS 16000 /* 20 * 800 * 100/100 */ +# define MIN_BR_025DMS 64000 /* 20 * 800 * 100/ 25 */ +# define MIN_BR_050DMS 32000 /* 20 * 800 * 100/ 50 */ +# define MAX_BR_050DMS_NB 260800 /* 163 * 800 * 100/ 50 */ +# define MAX_BR_100DMS_NB 114400 /* for 100ms at 8kHz */ + +# define MAX_BR_100DMS_WB 221600 /* for 100ms at 16kHz */ +# define MAX_BR_100DMS_SSWB 314400 /* for 100ms at 24kHz */ + +typedef int32_t LC3_INT32; + +# if defined(__xtensa__) +# define ALIGNMENT_BALLOC 4 +# define ALIGNMENT_BALLOC_RED 3 +# else +# define ALIGNMENT_BALLOC 8 +# define ALIGNMENT_BALLOC_RED 7 +# endif + +# define PLC2_FADEOUT_IN_MS 30 +# define PHECU_FRES 62.5 +# define PHECU_C_JACOB 1.1429 +# define MAX_LGW 9 /* LGW48K + 1 !! */ +# define QUOT_LPR_LTR 4 +# define MAX_PLC_LPROT ((512 * 48) / 32) +# define MAX_PLC_NPLOCS ((MAX_PLC_LPROT / 4) + 1) +# define MAX_PLC_LMSPEC ((MAX_PLC_LPROT / 2) + 1) +# define MAX_PLC_LMEM (400) /* "only" up to 20kHz (400 MDCT bins at 10 ms) at 48 kHz supported by PhEcu */ + +# define POS_ONE_Q15 (32767.0 / 32768.0) +# define PHECU_LTOT_MIN_MAN 1 /* lowest possible mantissa energy value */ +# define PHECU_LTOT_MIN_EXP -61 /* L_tot = PHECU_LTOT_MIN_MAN*2^(PHECU_LTOT_MIN_EXP-31) */ +# define PHECU_LTOT_MIN +# define PHECU_GRP_SHAPE_INIT 0 /* BASOP Q15 */ +# define PHECU_ENV_STAB_LOCAL POS_ONE_Q15 +# define PHECU_DELTA_CORR 5 +# define PHECU_PFIND_SENS 0.93 +# define PHECU_LA 0 + +# define LC3_ROUND(x) (roundf(x)) +# define LC3_FLOOR(x) (floorf(x)) + +# define LC3_CONST_POW_2_16 65536 +# define LC3_CONST_POW_2_M16 1.525878906250000e-05 +# define LC3_CONST_POW_2_100 1.267650600228229e+30 + +# define MAX_LEN_PCM_PLC (MAX_PITCH + MAX_LEN) +# define MAX_PITCH CEILING((MAX_PITCH_12K8 * MAX_LEN * 100), 12800) +# define TDC_L_FIR_HP 11 +# define PLC3_HPBLENDTHROTTLE 30 /* higher numbers increase throttled blending from hp filtered to unfiltered uv excitation (0 is no throttle) */ + +# define PLC_FADEOUT_IN_MS 60 /* fade-out to zero in ms for TD-PLC and NS, minimum value is 20 */ +# define PLC4_TRANSIT_START_IN_MS 20 /* begin of transition time for noise substitution for voiced signals */ +# define PLC4_TRANSIT_END_IN_MS PLC_FADEOUT_IN_MS /* end of transition time for noise substitution */ +# define PLC34_ATTEN_FAC_100 0.5000 /* attenuation factor for NS and TDC @ 10 ms*/ +# define PLC34_ATTEN_FAC_050 0.7071 /* attenuation factor for NS and TDC @ 5.0 ms*/ +# define PLC34_ATTEN_FAC_025 0.8409 /* attenuation factor for NS and TDC @ 2.5 ms*/ + +# define FEC_SLOT_BYTES_MIN 40 +# define FEC_SLOT_BYTES_MAX 400 + + +# define LC3_CONST_POW_2_M15 3.051757812500000e-05 +# define LC3_CONST_POW_2_23 8388608 +# define LC3_CONST_POW_2_23_NEG -8388608 +# define LC3_CONST_POW_2_23_RED 8388607 + +# define LC3_CONST_POW_2_100 1.267650600228229e+30 + +/* G192 bitstream writing/reading */ +#define G192_REDUNDANCY_FRAME 0x6B22 +#define G192_GOOD_FRAME 0x6B21 +#define G192_BAD_FRAME 0x6B20 +#define G192_ZERO 0x007F +#define G192_ONE 0x0081 +#define READ_G192FER /* Allow C executable to also read G192 formatted FER files */ + +# define LC3_EPS (1.1e-7f) + +#define M_PI 3.14159265358979323846 + +/* FUNCTION MACROS */ +#define CEILING(x, y) (((x) + (y)-1) / (y)) +#define FRAME2FS_IDX(x) (x / 100) /* 80 -> 0, 160 -> 1, 240 -> 2, 320 -> 3, 480 -> 4*/ +#define FS2FS_IDX(x) \ + (x / 10000) /* 8000 -> 0, 16000 -> 1, 24000 -> 2, 32000 -> 3, 48000 -> 4 \ + */ +#define UNUSED(x) (void)(x) /* silence unused parameter warning */ +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define STATIC_ASSERTS(cond, s) typedef char assert_##s[(cond) ? 1 : -1] +#define STATIC_ASSERTI(cond, i) STATIC_ASSERTS(cond, i) +#define STATIC_ASSERT(cond) STATIC_ASSERTI(cond, __LINE__) + +/* For dynamic memory calculations */ +#define CODEC_FS(fs) ((fs) == 44100 ? 48000 : (fs)) +#define DYN_MAX_LEN(fs) MAX(CODEC_FS(fs) / 100, 160) +# define DYN_MAX_LEN_EXT(fs) MAX(CODEC_FS(fs) / 100, 160) /* extension to length 160 for NB(fs=8000) */ +#define DYN_MAX_MDCT_LEN(fs) (DYN_MAX_LEN(fs) - (180 * DYN_MAX_LEN(fs) / 480)) + +/* OPTIONS */ + +#define MAX_SR 96000 +#define EXT_RES_ITER_MAX 20 +#define MAX_BW_BANDS_NUMBER 6 +#define MAX_LEN MAX_SR/100 /* = 10ms at 96kHz */ +#define MAX_RESBITS 5000 +#define MAX_RESBITS_LEN ((MAX_RESBITS + 7)/8) + +#define MAX_CHANNELS 2 +#define MIN_NBYTES 20 /* 100dms: 16 kbps at !=44.1kHz, 14.7kbps at 44.1kHz + 50dms: 32 kbps at !=44.1kHz, 29.4kbps at 44.1kHz + 25dms: 64 kbps at !=44.1kHz, 58.8kbps at 44.1kHz */ +#define MAX_NBYTES_025 100 /* any dms: 320 kbps at !=44.1kHz, 294 kbps at 44.1kHz */ +#define MAX_NBYTES_050 200 /* any dms: 320 kbps at !=44.1kHz, 294 kbps at 44.1kHz */ +#define MAX_NBYTES_100 400 /* any dms: 320 kbps at !=44.1kHz, 294 kbps at 44.1kHz */ + +#ifdef ENABLE_HR_MODE_FL +# define MIN_BR_25MS_48KHZ_HR ((int)172800/3200/2)*3200 +# define MIN_BR_25MS_96KHZ_HR ((int)198400/3200/2)*3200 +# define MIN_BR_50MS_48KHZ_HR ((int)148800/1600/2)*1600 +# define MIN_BR_50MS_96KHZ_HR ((int)174400/1600/2)*1600 +# define MIN_BR_100MS_48KHZ_HR ((int)124800/800/2)*800 +# define MIN_BR_100MS_96KHZ_HR ((int)149600/800/2)*800 +#endif /* ENABLE_HR_MODE */ +#define MAX_NBYTES2 625 +#define BYTESBUFSIZE (MAX_NBYTES2 * MAX_CHANNELS) +#define MAX_BW_BIN 400 +#if MAX_BW_BIN > MAX_LEN +# define MAX_BW MAX_LEN +#else +# define MAX_BW MAX_BW_BIN +#endif + +# ifdef ENABLE_HR_MODE_FL +# define MAX_BW_HR 960 +# endif + +/* SCF */ +#define M 16 +#define MAX_BANDS_NUMBER 64 +#define MAX_BANDS_NUMBER_PLC 80 +#define PVQ_MAX_VEC_SIZE M + +/* PVQ VQ setup */ +#define SCF_MAX_PARAM \ + 7 /* (L+H) + submode_MSB +gain+(Ia_leads+Ia_mpvq)+(Ib_joint_mpvq), \ + submode-LSB */ + +/* RESIDUAL CODING */ +#define NPRM_RESQ 5 * MAX_LEN + +/* MDCT */ +#define MDCT_MEM_LEN_MAX (MAX_LEN - ((180 * MAX_LEN) / 480)) + +/* TNS */ +#define TNS_NUMFILTERS_MAX 2 +#define MAXLAG 8 + +/* OLPA/LTPF */ +#define LEN_12K8 128 +#define LEN_6K4 64 +#define MIN_PITCH_6K4 17 +#define MAX_PITCH_6K4 114 +#define RANGE_PITCH_6K4 98 +#define MIN_PITCH_12K8 32 +#define MAX_PITCH_12K8 228 +#define RES2_PITCH_12K8 157 +#define RES4_PITCH_12K8 127 +#define LTPF_MEMIN_LEN (MAX_PITCH_12K8 + 4) + +/* Advanced PLC */ + + + +/* some configurations leave empty translation units. */ +extern int fix_empty_translation_unit_warning; + +#endif diff --git a/lc3plus/detect_cutoff_warped.c b/lc3plus/detect_cutoff_warped.c new file mode 100755 index 0000000000..9392867208 --- /dev/null +++ b/lc3plus/detect_cutoff_warped.c @@ -0,0 +1,84 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) +{ + const LC3_INT *warp_idx_start = NULL, *warp_idx_stop = NULL; + LC3_INT counter = 0, brickwall = 0, i = 0, stop = 0, dist = 0; + LC3_FLOAT d2_mean = 0, d2_sum = 0, e_diff = 0, thr = 0; + const LC3_INT *bw_dist = NULL; + + warp_idx_start = BW_warp_idx_start_all[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all[fs_idx - 1]; + + switch (frame_dms) + { + case 25: + warp_idx_start = BW_warp_idx_start_all_2_5ms[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all_2_5ms[fs_idx - 1]; + bw_dist = brickwall_dist; + break; + case 50: + warp_idx_start = BW_warp_idx_start_all_5ms[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all_5ms[fs_idx - 1]; + bw_dist = brickwall_dist; + break; + case 100: + warp_idx_start = BW_warp_idx_start_all[fs_idx - 1]; + warp_idx_stop = BW_warp_idx_stop_all[fs_idx - 1]; + bw_dist = brickwall_dist; + break; + } + + counter = fs_idx; + + d2_sum = sum_vec(&d2[warp_idx_start[counter - 1]], warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + + d2_mean = d2_sum / (warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + + while (d2_mean < threshold_quiet[counter - 1]) { + d2_sum = 0; + counter--; + if (counter == 0) { + break; + } + + /* calculate mean energy per band */ + d2_sum = + sum_vec(&d2[warp_idx_start[counter - 1]], warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + + d2_mean = d2_sum / (warp_idx_stop[counter - 1] - warp_idx_start[counter - 1] + 1); + } + + *bw_idx = counter; + + /* check if energy difference between bands is present */ + if (*bw_idx < fs_idx) { + thr = (LC3_FLOAT)threshold_brickwall[counter]; + stop = warp_idx_start[counter]; + dist = bw_dist[counter]; + + for (i = stop; i >= stop - dist; i--) { + e_diff = 10.0 * LC3_LOGTEN(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOGTEN(d2[i + 1] + FLT_EPSILON); + + if (e_diff > thr) { + brickwall = 1; + break; + } + } + + if (brickwall == 0) { + *bw_idx = fs_idx; + } + } +} diff --git a/lc3plus/enc_entropy.c b/lc3plus/enc_entropy.c new file mode 100755 index 0000000000..a7ff8cd700 --- /dev/null +++ b/lc3plus/enc_entropy.c @@ -0,0 +1,126 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, + LC3_INT bw_cutoff_idx, LC3_INT lastnz, LC3_INT N, LC3_INT lsbMode, LC3_INT gg_idx, LC3_INT num_tns_filters, + LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* scf_idx, LC3_INT fac_ns_idx + , LC3_INT bfi_ext, LC3_INT fs_idx + ) +{ + LC3_UINT8* ptr; + LC3_INT i = 0, submodeMSB = 0, submodeLSB = 0, tmp = 0, gainMSB = 0, gainLSB = 0; + LC3_INT gainMSBbits[4] = {1, 1, 2, 2}, gainLSBbits[4] = {0, 1, 0, 1}; + + LC3_INT16 lastnzTrigger[5] = {63, 127, 127, 255, 255}; + + *bp_side = numbytes - 1; + *mask_side = 1; + ptr = bytes; + + /* Bandwidth */ + if (bw_cutoff_bits > 0) { + write_uint_backward_fl(ptr, bp_side, mask_side, bw_cutoff_idx, bw_cutoff_bits); + } + + /* Last non zero touple */ + if (bfi_ext == 1) { + write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOGTWO(N >> 1))); + } + else + { + write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOGTWO(N / 2))); + } + + /* LSB mode bit */ + write_bit_backward_fl(ptr, bp_side, mask_side, lsbMode); + + /* Global gain */ + write_uint_backward_fl(ptr, bp_side, mask_side, gg_idx, 8); + + /* TNS activation flag */ + for (i = 0; i < num_tns_filters; i++) { + write_bit_backward_fl(ptr, bp_side, mask_side, MIN(1, tns_order[i])); + } + + /* LTPF activation flag */ + write_bit_backward_fl(ptr, bp_side, mask_side, ltpf_idx[0]); + + /* SNS-VQ 1st stage */ + write_uint_backward_fl(ptr, bp_side, mask_side, scf_idx[0], 5); + write_uint_backward_fl(ptr, bp_side, mask_side, scf_idx[1], 5); + + /* SNS-VQ 2nd stage side-info (3-4 bits) */ + submodeMSB = scf_idx[2] / 2; + submodeLSB = scf_idx[2] & 1; + write_bit_backward_fl(ptr, bp_side, mask_side, submodeMSB); + gainMSB = scf_idx[3] >> (gainLSBbits[scf_idx[2]]); + gainLSB = scf_idx[3] & 1; + write_uint_backward_fl(ptr, bp_side, mask_side, gainMSB, gainMSBbits[scf_idx[2]]); + write_bit_backward_fl(ptr, bp_side, mask_side, scf_idx[4]); + + /* SNS-VQ 2nd stage MPVQ data (24-25 bits) */ + if (submodeMSB == 0) { + if (submodeLSB == 0) { + tmp = scf_idx[6] + 2; + } else { + tmp = gainLSB; + } + + tmp = tmp * 2390004 + scf_idx[5]; + write_uint_backward_fl(ptr, bp_side, mask_side, tmp, 25); + } else { + tmp = scf_idx[5]; + + if (submodeLSB != 0) { + tmp = 2 * tmp + gainLSB + 15158272; + } + + write_uint_backward_fl(ptr, bp_side, mask_side, tmp, 24); + } + + /* LTPF data */ + if (ltpf_idx[0] == 1) { + write_uint_backward_fl(ptr, bp_side, mask_side, ltpf_idx[1], 1); + write_uint_backward_fl(ptr, bp_side, mask_side, ltpf_idx[2], 9); + } + + /* Noise factor */ + write_uint_backward_fl(ptr, bp_side, mask_side, fac_ns_idx, 3); +} + +void write_uint_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT val, LC3_INT numbits) +{ + LC3_INT k = 0, bit = 0; + + for (k = 0; k < numbits; k++) { + bit = val & 1; + write_bit_backward_fl(ptr, bp_side, mask_side, bit); + val = val / 2; + } +} + +void write_bit_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT bit) +{ + if (bit == 0) { + ptr[*bp_side] = ptr[*bp_side] & (255 - *mask_side); + } else { + ptr[*bp_side] = ptr[*bp_side] | *mask_side; + } + + if (*mask_side == 128) { + *mask_side = 1; + *bp_side = *bp_side - 1; + } else { + *mask_side = *mask_side * 2; + } +} diff --git a/lc3plus/enc_lc3_fl.c b/lc3plus/enc_lc3_fl.c new file mode 100755 index 0000000000..c89f7244ca --- /dev/null +++ b/lc3plus/enc_lc3_fl.c @@ -0,0 +1,270 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps +, LC3_INT32 bfi_ext +) +{ + EncSetup* h_EncSetup; + + LC3_INT s_12k8_len = 0, T0_out = 0, ltpfBits = 0, BW_cutoff_idx = 0, tns_numfilters = 0, quantizedGain = 0, + quantizedGainMin = 0, nbits = 0, nbits2 = 0, lastnz = 0, lsbMode = 0, gainChange = 0, bp_side = 0, + mask_side = 0, fac_ns_idx = 0, numResBits = 0, tns_order[2] = {0}, i = 0; + LC3_FLOAT normcorr = 0, gain = 0; + + + LC3_FLOAT d_fl[MAX_LEN] = {0}; + LC3_INT q_d[MAX_LEN] = {0}; + LC3_INT indexes[TNS_NUMFILTERS_MAX * MAXLAG] = {0}; + + h_EncSetup = encoder->channel_setup[channel]; + memset(bytes, 0, sizeof(uint8_t) * h_EncSetup->targetBytes); + + if (bps == 24) { + for (i = 0; i < encoder->frame_length; i++) { + int32_t tmp = ((int32_t*)s_in)[i]; + + if (tmp >= 0) + { + tmp = tmp & 0x007fffff; + } + else + { + tmp = tmp | (int32_t)0xff800000; + } + + h_EncSetup->s_in_scaled[i] = ((LC3_FLOAT) tmp / (float) LC3_POW(2, 8)); + } + } else if (bps == 16) { + for (i = 0; i < encoder->frame_length; i++) { + h_EncSetup->s_in_scaled[i] = (LC3_FLOAT)((int16_t*)s_in)[i]; + } + } + + /* MDCT */ + processMdct_fl(h_EncSetup->s_in_scaled, d_fl, &h_EncSetup->mdctStruct); + + /* 12.8 kHz resampler */ + process_resamp12k8_fl(h_EncSetup->s_in_scaled, encoder->frame_length, h_EncSetup->r12k8_mem_in, + encoder->r12k8_mem_in_len, h_EncSetup->r12k8_mem_50, h_EncSetup->r12k8_mem_out, + encoder->r12k8_mem_out_len, h_EncSetup->s_12k8, &s_12k8_len, encoder->fs_idx, + encoder->frame_dms, encoder->fs); + + /* Pitch estimation */ + processOlpa_fl(h_EncSetup->s_12k8, h_EncSetup->olpa_mem_s12k8, h_EncSetup->olpa_mem_s6k4, + &h_EncSetup->olpa_mem_pitch, &T0_out, &normcorr, s_12k8_len, encoder->frame_dms); + + /* LTPF encoder */ + process_ltpf_coder_fl(h_EncSetup->s_12k8, s_12k8_len + 1, h_EncSetup->ltpf_enable, T0_out, normcorr, + encoder->frame_dms, h_EncSetup->ltpf_mem_in, encoder->ltpf_mem_in_len, + &h_EncSetup->ltpf_mem_normcorr, &h_EncSetup->ltpf_mem_ltpf_on, + &h_EncSetup->ltpf_mem_pitch, h_EncSetup->ltpf_param, &h_EncSetup->ltpf_mem_mem_normcorr, + <pfBits); + + /* Attack detector */ + attack_detector_fl(h_EncSetup->s_in_scaled, encoder->frame_length, encoder->fs, &h_EncSetup->attdec_position, + &h_EncSetup->attdec_acc_energy, &h_EncSetup->attdec_detected, h_EncSetup->attdec_filter_mem, + h_EncSetup->attack_handling, encoder->attdec_nblocks, encoder->attdec_hangover_thresh); + + /* Per-band energy */ + processPerBandEnergy_fl(encoder->bands_number, encoder->bands_offset, encoder->hrmode, encoder->frame_dms, h_EncSetup->ener, d_fl); + /* Near Nyquist detector */ + processNearNyquistdetector_fl(&encoder->near_nyquist_flag, encoder->fs_idx, encoder->near_nyquist_index, encoder->bands_number, h_EncSetup->ener); + + /* Disable LTPF if nyquist detector triggers or -lfe mode is active*/ + if (encoder->near_nyquist_flag != 0 || h_EncSetup->lfe == 1) + { + h_EncSetup->ltpf_mem_ltpf_on = 0; + h_EncSetup->ltpf_param[1] = 0; + } + + /* Bandwidth cut-off detection */ + if (h_EncSetup->lfe == 0) { + /* No BW Cutoff for 8 kHz and 96 kHz. No detection if bandwidth controller is active */ + if (encoder->fs_idx > 0 && encoder->hrmode == 0 && encoder->bw_ctrl_active == 0) { + processDetectCutoffWarped_fl(h_EncSetup->ener, encoder->fs_idx, encoder->frame_dms, &BW_cutoff_idx); + } else { + BW_cutoff_idx = encoder->fs_idx; + } + } else { + BW_cutoff_idx = 0; + } + + processSnsComputeScf_fl(h_EncSetup->ener, encoder->tilt, encoder->bands_number, h_EncSetup->scf, + h_EncSetup->attdec_detected, encoder->sns_damping, encoder->attdec_damping); + + /* SNS Quantizer */ + process_snsQuantizesScf_Enc(h_EncSetup->scf, h_EncSetup->L_scf_idx, h_EncSetup->scf_q, h_EncSetup->dct2StructSNS); + + /* SNS Interpolation */ + processSnsInterpolateScf_fl(h_EncSetup->scf_q, 1, encoder->bands_number, h_EncSetup->int_scf); + + /* MDCT shaping */ + processMdctShaping_fl(d_fl, h_EncSetup->int_scf, encoder->bands_offset, encoder->bands_number); + + /* Bandwidth controller */ + if (encoder->bandwidth < encoder->fs / 2) { + process_cutoff_bandwidth(d_fl, encoder->yLen, encoder->bw_ctrl_cutoff_bin); + BW_cutoff_idx = MIN(BW_cutoff_idx, encoder->bw_index); + } + + /* TNS encoder */ + if (h_EncSetup->lfe == 0) + { + processTnsCoder_fl(d_fl, BW_cutoff_idx, encoder->cutoffBins[BW_cutoff_idx], encoder->fs, encoder->frame_length, + encoder->frame_dms, h_EncSetup->total_bits, tns_order, indexes, &tns_numfilters, + &(h_EncSetup->tns_bits) + , encoder->near_nyquist_flag + ); + } + else + { + tns_numfilters = 1; + tns_order[0] = 0; + h_EncSetup->tns_bits = tns_numfilters; + } + /* Global Gain Estimation */ + h_EncSetup->targetBitsQuant = h_EncSetup->targetBitsInit - (h_EncSetup->tns_bits + ltpfBits); + + if (h_EncSetup->targetBitsQuant < 0 && ltpfBits > 1) + { + /* Disable LTPF */ + h_EncSetup->ltpf_mem_ltpf_on = 0; + h_EncSetup->ltpf_param[1] = 0; + ltpfBits = 1; + h_EncSetup->targetBitsQuant = h_EncSetup->targetBitsInit - (h_EncSetup->tns_bits + ltpfBits); + } + + processEstimateGlobalGain_fl(d_fl, encoder->yLen, h_EncSetup->targetBitsQuant, &gain, &quantizedGain, + &quantizedGainMin, h_EncSetup->quantizedGainOff, &h_EncSetup->targetBitsOff, + &h_EncSetup->mem_targetBits, h_EncSetup->mem_specBits + , encoder->hrmode, h_EncSetup->regBits, encoder->frame_ms + + ); + + /* 1. Quantization */ + processQuantizeSpec_fl(d_fl, gain, q_d, encoder->yLen, h_EncSetup->total_bits, &nbits, &nbits2, encoder->fs, + &lastnz, h_EncSetup->codingdata, &lsbMode, -1, h_EncSetup->targetBitsQuant, encoder->hrmode + ); + + h_EncSetup->mem_specBits = nbits; + + /* Global Gain Adjustment */ + processAdjustGlobalGain_fl(&quantizedGain, quantizedGainMin, h_EncSetup->quantizedGainOff, &gain, + h_EncSetup->targetBitsQuant, h_EncSetup->mem_specBits, &gainChange, encoder->fs_idx + , encoder->hrmode, encoder->frame_dms + ); + + /* 2. Quantization */ + if (gainChange) { + processQuantizeSpec_fl(d_fl, gain, q_d, encoder->yLen, h_EncSetup->total_bits, &nbits, &nbits2, encoder->fs, + &lastnz, + h_EncSetup->codingdata, + &lsbMode, 0, h_EncSetup->targetBitsQuant + , encoder->hrmode + ); + } + + /* Noise factor */ + if (h_EncSetup->lfe == 0) + { + processNoiseFactor_fl(&fac_ns_idx, d_fl, q_d, gain, encoder->cutoffBins[BW_cutoff_idx], encoder->frame_dms, + h_EncSetup->targetBytes + ); + } + else + { + fac_ns_idx = 7; + } + /* Residual Coding */ + if (lsbMode == 0) { + processResidualCoding_fl(d_fl, q_d, gain, encoder->yLen, h_EncSetup->targetBitsQuant, nbits2, + h_EncSetup->resBits, &numResBits + , encoder->hrmode + ); + } else { + numResBits = 0; + } + + /* Entropy encoding */ + processEncoderEntropy_fl(bytes, &bp_side, &mask_side, h_EncSetup->targetBytes, encoder->BW_cutoff_bits, + BW_cutoff_idx, lastnz, encoder->yLen, lsbMode, quantizedGain, tns_numfilters, tns_order, + h_EncSetup->ltpf_param, h_EncSetup->L_scf_idx, fac_ns_idx + , bfi_ext, encoder->fs_idx + ); + + /* Artithmetic encoding */ + processAriEncoder_fl(bytes, bp_side, mask_side, q_d, tns_order, tns_numfilters, indexes, lastnz, + h_EncSetup->codingdata, + h_EncSetup->resBits, numResBits, lsbMode, h_EncSetup->targetBitsAri, + h_EncSetup->enable_lpc_weighting); + + if (encoder->combined_channel_coding == 0 && h_EncSetup->n_pc > 0) + { + LC3_INT32 xbuf[MAX_LEN] = {0}, nf_seed, tns_idx[M], zero_frame, nbits_residual, residualPresent, b_left, spec_inv_idx; + + memset(h_EncSetup->resBits, 0, sizeof(*(h_EncSetup->resBits)) * MAX_RESBITS_LEN); + + processAriDecoder_fl(bytes, bp_side, mask_side, encoder->yLen, encoder->fs_idx, h_EncSetup->enable_lpc_weighting, + tns_numfilters, lsbMode, lastnz, &bfi_ext, tns_order, fac_ns_idx, quantizedGain, + h_EncSetup->resBits, xbuf, &nf_seed, tns_idx, &zero_frame, h_EncSetup->targetBytes, &nbits_residual, + &residualPresent, encoder->frame_dms, h_EncSetup->n_pc, 0, h_EncSetup->total_bits >> 3, 1, &b_left, + &spec_inv_idx, encoder->hrmode); + + processReorderBitstream_fl(bytes, h_EncSetup->n_pccw, h_EncSetup->n_pc, b_left, h_EncSetup->targetBytes); + } + +} + +int Enc_LC3PLUS_fl(LC3PLUS_Enc* encoder, void** input, uint8_t* output, int bps +, LC3_INT32 bfi_ext +) +{ + int ch = 0, output_size = 0; + uint8_t* lc3buf = output; + + LC3_INT32 totalBytes; + LC3_INT32 output_size2, input_size; + + totalBytes = encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in); + + for (ch = 0; ch < encoder->channels; ch++) + { + Enc_LC3PLUS_Channel_fl(encoder, ch, input[ch], lc3buf, bps, bfi_ext); + if (encoder->epmode && encoder->combined_channel_coding == 0) + { + output_size2 = totalBytes / encoder->channels + (ch < (totalBytes % encoder->channels)); + + fec_encoder(encoder->epmode, encoder->epmr, lc3buf, encoder->channel_setup[ch]->targetBytes, output_size2, + encoder->channel_setup[ch]->n_pccw); + + lc3buf += output_size2; + output_size += output_size2; + } + else + { + lc3buf += encoder->channel_setup[ch]->targetBytes; + output_size += encoder->channel_setup[ch]->targetBytes; + } + } + + if (encoder->epmode > 0 && encoder->combined_channel_coding) + { + input_size = output_size; + output_size = encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in); + + fec_encoder(encoder->epmode, encoder->epmr, output, input_size, output_size, encoder->channel_setup[0]->n_pccw); + } + + return output_size; +} diff --git a/lc3plus/estimate_global_gain.c b/lc3plus/estimate_global_gain.c new file mode 100755 index 0000000000..df9b1f5f23 --- /dev/null +++ b/lc3plus/estimate_global_gain.c @@ -0,0 +1,128 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processEstimateGlobalGain_fl(LC3_FLOAT x[], LC3_INT lg, LC3_INT nbitsSQ, LC3_FLOAT* gain, LC3_INT* quantizedGain, + LC3_INT* quantizedGainMin, LC3_INT quantizedGainOff, LC3_FLOAT* targetBitsOff, + LC3_INT* old_targetBits, LC3_INT old_specBits + , LC3_INT hrmode , LC3_INT regBits, LC3_FLOAT frame_ms +) +{ + + LC3_INT i = 0, N = 0, offset = 0, j = 0, iszero = 0; + LC3_FLOAT g_min = 0, x_max = 0, tmp = 0, ind = 0, ind_min = 0, target = 0, fac = 0, ener = 0; + LC3_FLOAT en[MAX_LEN / 4] = {0}; + LC3_FLOAT reg_val = 4.656612873077393e-10; + + if (*old_targetBits < 0) { + *targetBitsOff = 0; + } else { + tmp = MIN(40, MAX(-40, *targetBitsOff + *old_targetBits - old_specBits)); + *targetBitsOff = 0.8 * *targetBitsOff + 0.2 * tmp; + } + + *old_targetBits = nbitsSQ; + nbitsSQ = nbitsSQ + round(*targetBitsOff); + + x_max = array_max_abs(x, lg); + + if (hrmode && regBits > 0) + { + LC3_FLOAT M0 = 1e-5, M1 = 1e-5, rB_offset; + LC3_FLOAT thresh = 2*frame_ms; + for (i = 0; i < lg; i++) + { + M0 += fabs(x[i]); + M1 += i*fabs(x[i]); + } + + rB_offset = 8 * (1 - MIN(M1/M0, thresh) / thresh); + reg_val = x_max * LC3_POW(2,-regBits - rB_offset); + } + + if (x_max < LC3_EPS) + { + ind_min = quantizedGainOff; + ind = 0; + *old_targetBits = -1; + } else { + if (hrmode == 1) { + g_min = x_max / (32768 * 256 - 2); + } else { + g_min = x_max / (32767 - 0.375); + } + /* Prevent positive rounding errors from LC3_LOGTEN function */ + ind_min = 28.0 * LC3_LOGTEN(g_min); + + ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS); + + assert(LC3_POW(10, ind_min / 28.0) >= g_min); + assert(ind_min <= (255 + quantizedGainOff)); + + N = lg; + + j = 0; + for (i = 0; i < N; i = i + 4) { + tmp = x[i] * x[i]; + tmp += x[i + 1] * x[i + 1]; + tmp += x[i + 2] * x[i + 2]; + tmp += x[i + 3] * x[i + 3]; + en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOGTEN(tmp + reg_val)); + j++; + } + + target = (28.0 / 20.0) * (1.4) * nbitsSQ; + fac = 256; + offset = 255 + quantizedGainOff; + + for (i = 0; i < 8; i++) { + fac = fac * 0.5; + offset = offset - fac; + ener = 0; + iszero = 1; + + for (j = N / 4 - 1; j >= 0; j--) { + tmp = en[j] - offset; + + if (tmp < (7.0) * (28.0 / 20.0)) { + if (iszero == 0) { + ener = ener + (2.7) * (28.0 / 20.0); + } + } else { + if (tmp > (50.0) * (28.0 / 20.0)) { + ener = ener + 2.0 * tmp - (50.0) * (28.0 / 20.0); + } else { + ener = ener + tmp; + } + + iszero = 0; + } + } + + if (ener > target && iszero == 0) { + offset = offset + fac; + } + } + + if (offset < ind_min) { + *old_targetBits = -1; + } + + ind = MAX(ind_min, offset) - quantizedGainOff; + } + + *quantizedGainMin = ind_min; + *quantizedGain = ind; + + *gain = LC3_POW(10.0, ((ind + quantizedGainOff) / 28.0)); +} diff --git a/lc3plus/fft/cfft.c b/lc3plus/fft/cfft.c new file mode 100755 index 0000000000..4bd8d29ade --- /dev/null +++ b/lc3plus/fft/cfft.c @@ -0,0 +1,421 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "cfft.h" +#include "iisfft.h" /* for M_PIl */ +#include /* for abs() */ +#include + +#define MAX_FFT_SIZE 1024 +#define MAX_TRIGDATA_SIZE (MAX_FFT_SIZE / 2) + +/** + * \brief table aTrigData + + Generate table: aTrigData[i] = sin( pi * i / (2*MAX_TRIGDATA_SIZE) ); i = 0, ... MAX_TRIGDATA_SIZE + */ +static const LC3_FLOAT static_table[MAX_TRIGDATA_SIZE + 1] = { + 0.0000000000e+000, 3.0679567717e-003, 6.1358846724e-003, 9.2037543654e-003, 1.2271538377e-002, 1.5339205973e-002, + 1.8406730145e-002, 2.1474080160e-002, 2.4541229010e-002, 2.7608145028e-002, 3.0674804002e-002, 3.3741172403e-002, + 3.6807224154e-002, 3.9872925729e-002, 4.2938258499e-002, 4.6003181487e-002, 4.9067676067e-002, 5.2131704986e-002, + 5.5195245892e-002, 5.8258265257e-002, 6.1320737004e-002, 6.4382627606e-002, 6.7443922162e-002, 7.0504575968e-002, + 7.3564566672e-002, 7.6623864472e-002, 7.9682439566e-002, 8.2740262151e-002, 8.5797309875e-002, 8.8853552938e-002, + 9.1908954084e-002, 9.4963498414e-002, 9.8017141223e-002, 1.0106986016e-001, 1.0412163287e-001, 1.0717242211e-001, + 1.1022220552e-001, 1.1327095330e-001, 1.1631862819e-001, 1.1936521530e-001, 1.2241067737e-001, 1.2545497715e-001, + 1.2849810719e-001, 1.3154003024e-001, 1.3458070159e-001, 1.3762012124e-001, 1.4065824449e-001, 1.4369502664e-001, + 1.4673046768e-001, 1.4976453781e-001, 1.5279719234e-001, 1.5582840145e-001, 1.5885815024e-001, 1.6188639402e-001, + 1.6491311789e-001, 1.6793829203e-001, 1.7096188664e-001, 1.7398387194e-001, 1.7700421810e-001, 1.8002289534e-001, + 1.8303988874e-001, 1.8605515361e-001, 1.8906866014e-001, 1.9208039343e-001, 1.9509032369e-001, 1.9809840620e-001, + 2.0110464096e-001, 2.0410896838e-001, 2.0711137354e-001, 2.1011184156e-001, 2.1311031282e-001, 2.1610680223e-001, + 2.1910123527e-001, 2.2209362686e-001, 2.2508391738e-001, 2.2807207704e-001, 2.3105810583e-001, 2.3404195905e-001, + 2.3702360690e-001, 2.4000301957e-001, 2.4298018217e-001, 2.4595504999e-001, 2.4892760813e-001, 2.5189781189e-001, + 2.5486564636e-001, 2.5783109665e-001, 2.6079410315e-001, 2.6375466585e-001, 2.6671275496e-001, 2.6966831088e-001, + 2.7262136340e-001, 2.7557182312e-001, 2.7851969004e-001, 2.8146493435e-001, 2.8440752625e-001, 2.8734746575e-001, + 2.9028466344e-001, 2.9321914911e-001, 2.9615089297e-001, 2.9907983541e-001, 3.0200594664e-001, 3.0492922664e-001, + 3.0784964561e-001, 3.1076714396e-001, 3.1368175149e-001, 3.1659337878e-001, 3.1950202584e-001, 3.2240769267e-001, + 3.2531028986e-001, 3.2820984721e-001, 3.3110630512e-001, 3.3399966359e-001, 3.3688986301e-001, 3.3977687359e-001, + 3.4266072512e-001, 3.4554132819e-001, 3.4841868281e-001, 3.5129275918e-001, 3.5416352749e-001, 3.5703095794e-001, + 3.5989505053e-001, 3.6275571585e-001, 3.6561298370e-001, 3.6846682429e-001, 3.7131720781e-001, 3.7416407466e-001, + 3.7700742483e-001, 3.7984719872e-001, 3.8268342614e-001, 3.8551604748e-001, 3.8834503293e-001, 3.9117038250e-001, + 3.9399203658e-001, 3.9680999517e-001, 3.9962419868e-001, 4.0243464708e-001, 4.0524131060e-001, 4.0804415941e-001, + 4.1084316373e-001, 4.1363832355e-001, 4.1642954946e-001, 4.1921690106e-001, 4.2200025916e-001, 4.2477968335e-001, + 4.2755508423e-001, 4.3032649159e-001, 4.3309381604e-001, 4.3585708737e-001, 4.3861624599e-001, 4.4137126207e-001, + 4.4412213564e-001, 4.4686883688e-001, 4.4961133599e-001, 4.5234957337e-001, 4.5508357882e-001, 4.5781329274e-001, + 4.6053871512e-001, 4.6325978637e-001, 4.6597650647e-001, 4.6868881583e-001, 4.7139674425e-001, 4.7410020232e-001, + 4.7679921985e-001, 4.7949376702e-001, 4.8218378425e-001, 4.8486924171e-001, 4.8755016923e-001, 4.9022647738e-001, + 4.9289819598e-001, 4.9556526542e-001, 4.9822765589e-001, 5.0088536739e-001, 5.0353837013e-001, 5.0618666410e-001, + 5.0883013010e-001, 5.1146882772e-001, 5.1410275698e-001, 5.1673179865e-001, 5.1935601234e-001, 5.2197527885e-001, + 5.2458965778e-001, 5.2719914913e-001, 5.2980363369e-001, 5.3240311146e-001, 5.3499764204e-001, 5.3758704662e-001, + 5.4017144442e-001, 5.4275077581e-001, 5.4532498121e-001, 5.4789406061e-001, 5.5045795441e-001, 5.5301672220e-001, + 5.5557024479e-001, 5.5811852217e-001, 5.6066155434e-001, 5.6319934130e-001, 5.6573182344e-001, 5.6825894117e-001, + 5.7078075409e-001, 5.7329714298e-001, 5.7580816746e-001, 5.7831376791e-001, 5.8081394434e-001, 5.8330863714e-001, + 5.8579784632e-001, 5.8828157187e-001, 5.9075969458e-001, 5.9323227406e-001, 5.9569931030e-001, 5.9816068411e-001, + 6.0061645508e-001, 6.0306662321e-001, 6.0551106930e-001, 6.0794979334e-001, 6.1038279533e-001, 6.1281007528e-001, + 6.1523157358e-001, 6.1764729023e-001, 6.2005722523e-001, 6.2246125937e-001, 6.2485951185e-001, 6.2725180387e-001, + 6.2963825464e-001, 6.3201874495e-001, 6.3439327478e-001, 6.3676184416e-001, 6.3912445307e-001, 6.4148104191e-001, + 6.4383155107e-001, 6.4617604017e-001, 6.4851438999e-001, 6.5084666014e-001, 6.5317285061e-001, 6.5549284220e-001, + 6.5780669451e-001, 6.6011434793e-001, 6.6241580248e-001, 6.6471099854e-001, 6.6699993610e-001, 6.6928261518e-001, + 6.7155897617e-001, 6.7382901907e-001, 6.7609268427e-001, 6.7835003138e-001, 6.8060100079e-001, 6.8284553289e-001, + 6.8508368731e-001, 6.8731534481e-001, 6.8954056501e-001, 6.9175922871e-001, 6.9397145510e-001, 6.9617712498e-001, + 6.9837623835e-001, 7.0056879520e-001, 7.0275473595e-001, 7.0493406057e-001, 7.0710676908e-001, 7.0927280188e-001, + 7.1143221855e-001, 7.1358484030e-001, 7.1573084593e-001, 7.1787005663e-001, 7.2000253201e-001, 7.2212821245e-001, + 7.2424709797e-001, 7.2635912895e-001, 7.2846436501e-001, 7.3056274652e-001, 7.3265427351e-001, 7.3473888636e-001, + 7.3681658506e-001, 7.3888731003e-001, 7.4095112085e-001, 7.4300795794e-001, 7.4505776167e-001, 7.4710059166e-001, + 7.4913638830e-001, 7.5116515160e-001, 7.5318682194e-001, 7.5520139933e-001, 7.5720882416e-001, 7.5920921564e-001, + 7.6120239496e-001, 7.6318842173e-001, 7.6516723633e-001, 7.6713889837e-001, 7.6910334826e-001, 7.7106052637e-001, + 7.7301043272e-001, 7.7495312691e-001, 7.7688848972e-001, 7.7881652117e-001, 7.8073722124e-001, 7.8265058994e-001, + 7.8455656767e-001, 7.8645521402e-001, 7.8834640980e-001, 7.9023021460e-001, 7.9210656881e-001, 7.9397547245e-001, + 7.9583692551e-001, 7.9769086838e-001, 7.9953724146e-001, 8.0137616396e-001, 8.0320751667e-001, 8.0503135920e-001, + 8.0684757233e-001, 8.0865615606e-001, 8.1045717001e-001, 8.1225061417e-001, 8.1403630972e-001, 8.1581443548e-001, + 8.1758481264e-001, 8.1934750080e-001, 8.2110249996e-001, 8.2284981012e-001, 8.2458931208e-001, 8.2632106543e-001, + 8.2804507017e-001, 8.2976120710e-001, 8.3146959543e-001, 8.3317017555e-001, 8.3486288786e-001, 8.3654773235e-001, + 8.3822470903e-001, 8.3989381790e-001, 8.4155499935e-001, 8.4320825338e-001, 8.4485358000e-001, 8.4649091959e-001, + 8.4812033176e-001, 8.4974175692e-001, 8.5135519505e-001, 8.5296058655e-001, 8.5455799103e-001, 8.5614734888e-001, + 8.5772860050e-001, 8.5930180550e-001, 8.6086696386e-001, 8.6242395639e-001, 8.6397284269e-001, 8.6551362276e-001, + 8.6704623699e-001, 8.6857068539e-001, 8.7008696795e-001, 8.7159508467e-001, 8.7309497595e-001, 8.7458664179e-001, + 8.7607008219e-001, 8.7754529715e-001, 8.7901222706e-001, 8.8047087193e-001, 8.8192129135e-001, 8.8336336613e-001, + 8.8479709625e-001, 8.8622254133e-001, 8.8763964176e-001, 8.8904833794e-001, 8.9044874907e-001, 8.9184069633e-001, + 8.9322429895e-001, 8.9459949732e-001, 8.9596623182e-001, 8.9732456207e-001, 8.9867448807e-001, 9.0001589060e-001, + 9.0134882927e-001, 9.0267330408e-001, 9.0398931503e-001, 9.0529674292e-001, 9.0659570694e-001, 9.0788608789e-001, + 9.0916800499e-001, 9.1044127941e-001, 9.1170603037e-001, 9.1296219826e-001, 9.1420978308e-001, 9.1544872522e-001, + 9.1667908430e-001, 9.1790080070e-001, 9.1911387444e-001, 9.2031830549e-001, 9.2151403427e-001, 9.2270112038e-001, + 9.2387950420e-001, 9.2504924536e-001, 9.2621022463e-001, 9.2736250162e-001, 9.2850607634e-001, 9.2964088917e-001, + 9.3076694012e-001, 9.3188428879e-001, 9.3299281597e-001, 9.3409252167e-001, 9.3518352509e-001, 9.3626564741e-001, + 9.3733900785e-001, 9.3840354681e-001, 9.3945920467e-001, 9.4050604105e-001, 9.4154405594e-001, 9.4257318974e-001, + 9.4359344244e-001, 9.4460481405e-001, 9.4560730457e-001, 9.4660091400e-001, 9.4758558273e-001, 9.4856137037e-001, + 9.4952815771e-001, 9.5048606396e-001, 9.5143502951e-001, 9.5237499475e-001, 9.5330601931e-001, 9.5422810316e-001, + 9.5514118671e-001, 9.5604526997e-001, 9.5694035292e-001, 9.5782643557e-001, 9.5870345831e-001, 9.5957154036e-001, + 9.6043050289e-001, 9.6128046513e-001, 9.6212142706e-001, 9.6295326948e-001, 9.6377605200e-001, 9.6458977461e-001, + 9.6539443731e-001, 9.6618998051e-001, 9.6697646379e-001, 9.6775382757e-001, 9.6852207184e-001, 9.6928125620e-001, + 9.7003126144e-001, 9.7077214718e-001, 9.7150391340e-001, 9.7222650051e-001, 9.7293996811e-001, 9.7364425659e-001, + 9.7433936596e-001, 9.7502535582e-001, 9.7570210695e-001, 9.7636973858e-001, 9.7702813148e-001, 9.7767734528e-001, + 9.7831737995e-001, 9.7894817591e-001, 9.7956979275e-001, 9.8018211126e-001, 9.8078525066e-001, 9.8137921095e-001, + 9.8196387291e-001, 9.8253929615e-001, 9.8310548067e-001, 9.8366242647e-001, 9.8421007395e-001, 9.8474848270e-001, + 9.8527765274e-001, 9.8579752445e-001, 9.8630809784e-001, 9.8680937290e-001, 9.8730140924e-001, 9.8778414726e-001, + 9.8825758696e-001, 9.8872166872e-001, 9.8917651176e-001, 9.8962199688e-001, 9.9005818367e-001, 9.9048507214e-001, + 9.9090266228e-001, 9.9131083488e-001, 9.9170976877e-001, 9.9209928513e-001, 9.9247956276e-001, 9.9285042286e-001, + 9.9321192503e-001, 9.9356412888e-001, 9.9390697479e-001, 9.9424046278e-001, 9.9456459284e-001, 9.9487930536e-001, + 9.9518471956e-001, 9.9548077583e-001, 9.9576741457e-001, 9.9604469538e-001, 9.9631261826e-001, 9.9657112360e-001, + 9.9682027102e-001, 9.9706006050e-001, 9.9729043245e-001, 9.9751144648e-001, 9.9772304296e-001, 9.9792528152e-001, + 9.9811810255e-001, 9.9830156565e-001, 9.9847555161e-001, 9.9864023924e-001, 9.9879544973e-001, 9.9894130230e-001, + 9.9907773733e-001, 9.9920475483e-001, 9.9932235479e-001, 9.9943059683e-001, 9.9952942133e-001, 9.9961882830e-001, + 9.9969881773e-001, 9.9976938963e-001, 9.9983060360e-001, 9.9988234043e-001, 9.9992471933e-001, 9.9995762110e-001, + 9.9998116493e-001, 9.9999529123e-001, 1.0000000000e+000}; + +/** + * \brief scramble + The function sorts the complex vector re/im of length n from 'in-order' to 'bitreversed order'. + + * \param[i/o] re: real input + * \param[i/o] im: imag input + * \param[i ] n: size of fft + * \param[i ] s: stride of real and imag input + + * \return none + */ +static void scramble(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT n, LC3_INT s) +{ + LC3_FLOAT tmp; + LC3_INT m, k, j; + + for (m = 1, j = 0; m < (n - 1); m++) { + { + for (k = n >> 1; (!((j ^= k) & k)); k >>= 1) + ; + } + + if (j > m) { + tmp = re[s * m]; + re[s * m] = re[s * j]; + re[s * j] = tmp; + + tmp = im[s * m]; + im[s * m] = im[s * j]; + im[s * j] = tmp; + } + } +} + +/** + * \brief fft + The function performs a radix-2, decimation in time complex fft. The calculation takes place inplace. + The real and imaginary part can reside in separate buffers as well as interleaved in one buffer. The + stride length has to be set accordingly. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + + * \return none + */ +static void fft(const LC3_FLOAT* aTrigData, LC3_INT trigdata_size, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT sizeOfFft, + LC3_INT s) +{ + LC3_INT trigstep, i, ldm, n; + LC3_INT trigDataSize; + LC3_INT ldn = 0; + + trigDataSize = sizeOfFft / 2; + + while (sizeOfFft >>= 1) { + ldn++; + } + + n = 1 << ldn; + + scramble(re, im, n, s); + + /* 1+2 stage implemented as radix 4 */ + for (i = 0; i < n; i += 4) { + LC3_FLOAT a00, a01, a10, a11; + LC3_FLOAT a20, a21, a30, a31; + + a00 = re[s * (i + 0)] + re[s * (i + 1)]; + a10 = re[s * (i + 2)] + re[s * (i + 3)]; + a20 = im[s * (i + 0)] + im[s * (i + 1)]; + a30 = im[s * (i + 2)] + im[s * (i + 3)]; + + a01 = re[s * (i + 0)] - re[s * (i + 1)]; + a21 = re[s * (i + 2)] - re[s * (i + 3)]; + a31 = im[s * (i + 0)] - im[s * (i + 1)]; + a11 = im[s * (i + 2)] - im[s * (i + 3)]; + + re[s * (i + 0)] = a00 + a10; + re[s * (i + 2)] = a00 - a10; + im[s * (i + 0)] = a20 + a30; + im[s * (i + 2)] = a20 - a30; + re[s * (i + 1)] = a11 + a01; + re[s * (i + 3)] = a01 - a11; + im[s * (i + 1)] = a31 - a21; + im[s * (i + 3)] = a21 + a31; + } + + /* next stages implemented as radix 2 */ + for (ldm = 3; ldm <= ldn; ++ldm) { + const LC3_INT m = (1 << ldm); + const LC3_INT mh = (m >> 1); + LC3_INT j, r; + + trigstep = ((trigDataSize * 4) >> ldm) * trigdata_size / trigDataSize; + + for (j = 0; j < mh / 2; ++j) { + LC3_FLOAT c1, c2; + + c2 = aTrigData[j * trigstep]; + c1 = aTrigData[trigdata_size - j * trigstep]; + + for (r = 0; r < n; r += m) { + LC3_FLOAT vr, vi, ur, ui; + + LC3_INT t0 = r + j; + LC3_INT t1 = s * t0; + LC3_INT t2 = s * (t0 + mh); + + vr = re[t2] * c1 + im[t2] * c2; + vi = -re[t2] * c2 + im[t2] * c1; + + ur = re[t1]; + ui = im[t1]; + + re[t1] = re[t1] + vr; + im[t1] = im[t1] + vi; + + re[t2] = ur - vr; + im[t2] = ui - vi; + + t0 = r + j + mh / 2; + t1 = s * t0; + t2 = s * (t0 + mh); + + vr = -re[t2] * c2 + im[t2] * c1; + vi = -re[t2] * c1 - im[t2] * c2; + + ur = re[t1]; + ui = im[t1]; + re[t1] = re[t1] + vr; + im[t1] = im[t1] + vi; + + re[t2] = ur - vr; + im[t2] = ui - vi; + } + } + } +} + +/** + * \brief ifft + The function performs a radix-2, decimation in time complex inverse fft. The calculation takes place + inplace. The real and imaginary part can reside in separate buffers as well as interleaved in one buffer. + The stride length has to be set accordingly. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + + * \return none + */ +static void ifft(const LC3_FLOAT* aTrigData, LC3_INT trigdata_size, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT sizeOfFft, + LC3_INT s) +{ + LC3_INT trigstep, i, ldm, n; + LC3_INT trigDataSize; + LC3_INT ldn = 0; + + trigDataSize = sizeOfFft; + + while (sizeOfFft >>= 1) { + ldn++; + } + + n = 1 << ldn; + + scramble(re, im, n, s); + + /* 1+2 stage radix 4 */ + for (i = 0; i < n; i += 4) { + LC3_FLOAT a00, a01, a10, a11; + LC3_FLOAT a20, a21, a30, a31; + + a00 = re[s * (i + 0)] + re[s * (i + 1)]; + a10 = re[s * (i + 2)] + re[s * (i + 3)]; + a20 = im[s * (i + 0)] + im[s * (i + 1)]; + a30 = im[s * (i + 2)] + im[s * (i + 3)]; + + a01 = re[s * (i + 0)] - re[s * (i + 1)]; + a21 = re[s * (i + 2)] - re[s * (i + 3)]; + a31 = im[s * (i + 0)] - im[s * (i + 1)]; + a11 = im[s * (i + 2)] - im[s * (i + 3)]; + + re[s * (i + 0)] = a00 + a10; + re[s * (i + 2)] = a00 - a10; + im[s * (i + 0)] = a20 + a30; + im[s * (i + 2)] = a20 - a30; + + re[s * (i + 1)] = a01 - a11; + re[s * (i + 3)] = a01 + a11; + im[s * (i + 1)] = a31 + a21; + im[s * (i + 3)] = a31 - a21; + } + + for (ldm = 3; ldm <= ldn; ++ldm) { + const LC3_INT m = (1 << ldm); + const LC3_INT mh = (m >> 1); + LC3_INT j, r; + + trigstep = ((trigDataSize * 4) >> ldm) * trigdata_size / trigDataSize; + + for (j = 0; j < mh / 2; ++j) { + LC3_FLOAT c1, c2; + + c2 = aTrigData[j * trigstep]; + c1 = aTrigData[trigdata_size - j * trigstep]; + + for (r = 0; r < n; r += m) { + LC3_FLOAT vr, vi, ur, ui; + + LC3_INT t0 = r + j; + LC3_INT t1 = s * t0; + LC3_INT t2 = s * (t0 + mh); + + vr = re[t2] * c1 - im[t2] * c2; + vi = re[t2] * c2 + im[t2] * c1; + + ur = re[t1]; + ui = im[t1]; + + re[t1] = ur + vr; + im[t1] = ui + vi; + + re[t2] = ur - vr; + im[t2] = ui - vi; + + t0 = r + j + mh / 2; + t1 = s * t0; + t2 = s * (t0 + mh); + + vr = -re[t2] * c2 - im[t2] * c1; + vi = re[t2] * c1 - im[t2] * c2; + + ur = re[t1]; + ui = im[t1]; + + re[t1] = ur + vr; + im[t1] = ui + vi; + re[t2] = ur - vr; + im[t2] = ui - vi; + } + } + } +} + +/** + * \brief cfft + The function serves as wrapper for the forward and inverse fft. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + * \param[i ] iSign: forward fft: -1 / inverse fft: 1 + + * \return none + */ +void LC3_cfft(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT length, LC3_INT stride, LC3_INT sign) +{ + assert(abs(sign) == 1); + assert(CFFT_SUPPORT(length)); + + if (sign == -1) { + fft(static_table, MAX_TRIGDATA_SIZE, re, im, length, stride); + } else { + ifft(static_table, MAX_TRIGDATA_SIZE, re, im, length, stride); + } +} + +LC3_INT LC3_cfft_plan(Cfft* handle, LC3_INT length, LC3_INT sign) +{ + /* check if length is power of two */ + if (!CFFT_PLAN_SUPPORT(length) || abs(sign) != 1) + return 0; + + handle->len = length; + handle->sign = sign; + + if (length <= MAX_FFT_SIZE) { + handle->table = NULL; + } else { + LC3_INT i = 0; + handle->table = (LC3_FLOAT*)malloc((length / 2 + 1) * sizeof(LC3_FLOAT)); + for (i = 0; i < length / 2 + 1; i++) { + handle->table[i] = (LC3_FLOAT)LC3_SIN((LC3_FLOAT)M_PIl * i / length); + } + } + return 1; +} + +void LC3_cfft_apply(Cfft* handle, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT stride) +{ + if (handle->len <= MAX_FFT_SIZE) { + LC3_cfft(re, im, handle->len, stride, handle->sign); + } else if (handle->sign == -1) { + fft(handle->table, handle->len / 2, re, im, handle->len, stride); + } else { + ifft(handle->table, handle->len / 2, re, im, handle->len, stride); + } +} + +void LC3_cfft_free(Cfft* handle) +{ + if (handle->table) + free(handle->table); +} diff --git a/lc3plus/fft/cfft.h b/lc3plus/fft/cfft.h new file mode 100755 index 0000000000..3902b4c396 --- /dev/null +++ b/lc3plus/fft/cfft.h @@ -0,0 +1,42 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + + +#include "../functions.h" + +#ifndef CFFT_H +#define CFFT_H + + +/* macro to check if cfft supports len */ +#define CFFT_IS_POWER_OF_TWO(n) ((n != 0) && ((n & (~n + 1)) == n)) +#define CFFT_SUPPORT(len) (len >= 4 && len <= 1024 && CFFT_IS_POWER_OF_TWO(len)) +#define CFFT_PLAN_SUPPORT(len) (len >= 4 && CFFT_IS_POWER_OF_TWO(len)) + +/** + * \brief fft_radix2 + The function serves as wrapper for the forward and inverse complex fft. + + * \param[i/o] re: real input / real output + * \param[i/o] im: imag input / imag output + * \param[i ] sizeOfFft: size of fft + * \param[i ] s: stride of real and imag input / output + * \param[i ] iSign: forward fft: -1 / inverse fft: 1 + + * \return none + */ + +void LC3_cfft(LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT sizeOfFft, LC3_INT stride, LC3_INT sign); + +LC3_INT LC3_cfft_plan(Cfft* handle, LC3_INT length, LC3_INT sign); +void LC3_cfft_apply(Cfft* handle, LC3_FLOAT* re, LC3_FLOAT* im, LC3_INT stride); +void LC3_cfft_free(Cfft* handle); + +#endif /* FFT_RADIX2_H */ diff --git a/lc3plus/fft/fft_15_16.h b/lc3plus/fft/fft_15_16.h new file mode 100755 index 0000000000..83ca77353b --- /dev/null +++ b/lc3plus/fft/fft_15_16.h @@ -0,0 +1,401 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft15(LC3_FLOAT* vec) +{ + LC3_FLOAT r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, i0, i1, i2, i3, i4, i5, + i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, + tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp18, tmp19, tmp20, tmp21, tmp22, tmp23, tmp24, + tmp25, tmp26, tmp27, tmp28, tmp29; + + /* Pre-additions real part */ + r1 = vec[2] + vec[8]; + r2 = vec[2] - vec[8]; + r3 = vec[4] + vec[16]; + r4 = vec[4] - vec[16]; + r5 = vec[6] + vec[24]; + r6 = vec[6] - vec[24]; + r7 = vec[10] + vec[20]; + r8 = vec[10] - vec[20]; + r9 = vec[12] + vec[18]; + r10 = vec[12] - vec[18]; + r11 = vec[14] + vec[26]; + r12 = vec[14] - vec[26]; + r13 = vec[22] + vec[28]; + r14 = vec[22] - vec[28]; + + tmp2 = r1 + r3; + tmp4 = r1 - r3; + tmp6 = r2 + r14; + tmp8 = r2 - r14; + tmp10 = r4 + r12; + tmp12 = r4 - r12; + tmp14 = r5 + r9; + tmp16 = r5 - r9; + tmp18 = r11 + r13; + tmp20 = r11 - r13; + + /* Pre-additions imaginary part */ + i1 = vec[3] + vec[9]; + i2 = vec[3] - vec[9]; + i3 = vec[5] + vec[17]; + i4 = vec[5] - vec[17]; + i5 = vec[7] + vec[25]; + i6 = vec[7] - vec[25]; + i7 = vec[11] + vec[21]; + i8 = vec[11] - vec[21]; + i9 = vec[13] + vec[19]; + i10 = vec[13] - vec[19]; + i11 = vec[15] + vec[27]; + i12 = vec[15] - vec[27]; + i13 = vec[23] + vec[29]; + i14 = vec[23] - vec[29]; + + tmp3 = i1 + i3; + tmp5 = i1 - i3; + tmp7 = i2 + i14; + tmp9 = i2 - i14; + tmp11 = i4 + i12; + tmp13 = i4 - i12; + tmp15 = i5 + i9; + tmp17 = i5 - i9; + tmp19 = i11 + i13; + tmp21 = i11 - i13; + + /* Pre-additions and core multiplications */ + tmp28 = tmp4 + tmp20; + tmp29 = tmp5 + tmp21; + r4 = tmp2 + tmp18; + i4 = tmp3 + tmp19; + r3 = (r4 + tmp14) * (LC3_FLOAT)-1.25; + i3 = (i4 + tmp15) * (LC3_FLOAT)-1.25; + r2 = (tmp29 - i8) * (LC3_FLOAT)-8.660254037844387e-1; + i2 = (tmp28 - r8) * (LC3_FLOAT)8.660254037844387e-1; + r1 = r4 + r7; + i1 = i4 + i7; + r0 = r1 + vec[0] + tmp14; + i0 = i1 + vec[1] + tmp15; + r7 = tmp4 - tmp20; + i7 = tmp5 - tmp21; + r8 = (tmp3 - tmp19) * (LC3_FLOAT)-4.841229182759272e-1; + i8 = (tmp2 - tmp18) * (LC3_FLOAT)4.841229182759272e-1; + tmp0 = tmp6 + r10; + tmp1 = tmp7 + i10; + tmp2 = r6 - tmp10; + tmp3 = i6 - tmp11; + r10 = tmp7 * (LC3_FLOAT)-2.308262652881440; + i10 = tmp6 * (LC3_FLOAT)2.308262652881440; + r11 = tmp8 * (LC3_FLOAT)1.332676064001459; + i11 = tmp9 * (LC3_FLOAT)1.332676064001459; + r6 = (r7 - tmp16) * (LC3_FLOAT)5.590169943749475e-1; + i6 = (i7 - tmp17) * (LC3_FLOAT)5.590169943749475e-1; + r12 = (tmp1 + tmp3) * (LC3_FLOAT)5.877852522924733e-1; + i12 = (tmp0 + tmp2) * (LC3_FLOAT)-5.877852522924733e-1; + r13 = (tmp7 - tmp11) * (LC3_FLOAT)-8.816778784387098e-1; + i13 = (tmp6 - tmp10) * (LC3_FLOAT)8.816778784387098e-1; + r14 = (tmp8 + tmp12) * (LC3_FLOAT)5.090369604551274e-1; + i14 = (tmp9 + tmp13) * (LC3_FLOAT)5.090369604551274e-1; + r16 = tmp11 * (LC3_FLOAT)5.449068960040204e-1; + i16 = tmp10 * (LC3_FLOAT)-5.449068960040204e-1; + r17 = tmp12 * (LC3_FLOAT)3.146021430912046e-1; + i17 = tmp13 * (LC3_FLOAT)3.146021430912046e-1; + + r4 *= (LC3_FLOAT)1.875; + i4 *= (LC3_FLOAT)1.875; + r1 *= (LC3_FLOAT)-1.5; + i1 *= (LC3_FLOAT)-1.5; + r7 *= (LC3_FLOAT)-8.385254915624212e-1; + i7 *= (LC3_FLOAT)-8.385254915624212e-1; + r5 = tmp29 * (LC3_FLOAT)1.082531754730548; + i5 = tmp28 * (LC3_FLOAT)-1.082531754730548; + r9 = tmp1 * (LC3_FLOAT)1.538841768587627; + i9 = tmp0 * (LC3_FLOAT)-1.538841768587627; + r15 = tmp3 * (LC3_FLOAT)3.632712640026803e-1; + i15 = tmp2 * (LC3_FLOAT)-3.632712640026803e-1; + + /* Post-additions real part */ + tmp2 = r0 + r1; + tmp4 = r3 + r6; + tmp6 = r3 - r6; + tmp8 = r4 + r5; + tmp10 = r4 - r5; + tmp12 = r7 + r8; + tmp14 = r7 - r8; + tmp16 = r13 + r16; + tmp18 = r14 + r17; + tmp20 = r10 - r13; + tmp22 = r11 - r14; + tmp24 = r12 + r15; + tmp26 = r12 - r9; + + r1 = tmp2 + r2; + r2 = tmp2 - r2; + r3 = tmp4 + tmp26; + r4 = tmp4 - tmp26; + r5 = tmp6 + tmp24; + r6 = tmp6 - tmp24; + r7 = tmp16 + tmp18; + r8 = tmp16 - tmp18; + r9 = tmp20 - tmp22; + r10 = tmp20 + tmp22; + r11 = r1 + tmp8; + r12 = r2 + tmp10; + r13 = r11 - tmp12; + r14 = r12 - tmp14; + r15 = r12 + tmp14; + r16 = r11 + tmp12; + + /* Post-additions imaginary part */ + tmp3 = i0 + i1; + tmp5 = i3 + i6; + tmp7 = i3 - i6; + tmp9 = i4 + i5; + tmp11 = i4 - i5; + tmp13 = i7 + i8; + tmp15 = i7 - i8; + tmp17 = i13 + i16; + tmp19 = i14 + i17; + tmp21 = i10 - i13; + tmp23 = i11 - i14; + tmp25 = i12 + i15; + tmp27 = i12 - i9; + + i1 = tmp3 + i2; + i2 = tmp3 - i2; + i3 = tmp5 + tmp27; + i4 = tmp5 - tmp27; + i5 = tmp7 + tmp25; + i6 = tmp7 - tmp25; + i7 = tmp17 + tmp19; + i8 = tmp17 - tmp19; + i9 = tmp21 - tmp23; + i10 = tmp21 + tmp23; + i11 = i1 + tmp9; + i12 = i2 + tmp11; + i13 = i11 - tmp13; + i14 = i12 - tmp15; + i15 = i12 + tmp15; + i16 = i11 + tmp13; + + *vec++ = r0; + *vec++ = i0; + *vec++ = r13 + r5 + r7; + *vec++ = i13 + i5 + i7; + *vec++ = r15 + r3 - r9; + *vec++ = i15 + i3 - i9; + *vec++ = r0 + r4; + *vec++ = i0 + i4; + *vec++ = r13 + r6 - r7; + *vec++ = i13 + i6 - i7; + *vec++ = r2; + *vec++ = i2; + *vec++ = r0 + r5; + *vec++ = i0 + i5; + *vec++ = r16 + r3 - r10; + *vec++ = i16 + i3 - i10; + *vec++ = r15 + r4 + r9; + *vec++ = i15 + i4 + i9; + *vec++ = r0 + r6; + *vec++ = i0 + i6; + *vec++ = r1; + *vec++ = i1; + *vec++ = r14 + r5 + r8; + *vec++ = i14 + i5 + i8; + *vec++ = r0 + r3; + *vec++ = i0 + i3; + *vec++ = r16 + r4 + r10; + *vec++ = i16 + i4 + i10; + *vec++ = r14 + r6 - r8; + *vec++ = i14 + i6 - i8; +} + +static void fft16(LC3_FLOAT* vec) +{ + const LC3_FLOAT INV_SQRT2 = 7.071067811865475e-1; + const LC3_FLOAT COS_PI_DIV8 = 9.238795325112867e-1; + const LC3_FLOAT COS_3PI_DIV8 = 3.826834323650898e-1; + const LC3_FLOAT SQRT2PLUS1 = 2.414213562373095; + const LC3_FLOAT SQRT2MINUS1 = 4.142135623730952e-1; + + LC3_FLOAT temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp110, temp111, temp112, + temp113, temp114, temp115, temp20, temp21, temp22, temp23, temp24, temp25, temp26, temp27, temp28, temp29, + temp210, temp211, temp212, temp213, temp214, temp215, vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, + vec9, vec10, vec11, vec12, vec13, vec14, vec15; + + /* even */ + vec0 = vec[0] + vec[16]; + vec1 = vec[1] + vec[17]; + vec2 = vec[2] + vec[18]; + vec3 = vec[3] + vec[19]; + vec4 = vec[4] + vec[20]; + vec5 = vec[5] + vec[21]; + vec6 = vec[6] + vec[22]; + vec7 = vec[7] + vec[23]; + vec8 = vec[8] + vec[24]; + vec9 = vec[9] + vec[25]; + vec10 = vec[10] + vec[26]; + vec11 = vec[11] + vec[27]; + vec12 = vec[12] + vec[28]; + vec13 = vec[13] + vec[29]; + vec14 = vec[14] + vec[30]; + vec15 = vec[15] + vec[31]; + + /* Pre-additions */ + temp10 = vec0 + vec8; + temp12 = vec0 - vec8; + temp11 = vec1 + vec9; + temp13 = vec1 - vec9; + temp14 = vec2 + vec10; + temp16 = vec2 - vec10; + temp15 = vec3 + vec11; + temp17 = vec3 - vec11; + temp18 = vec4 + vec12; + temp110 = vec4 - vec12; + temp19 = vec5 + vec13; + temp111 = vec5 - vec13; + temp112 = vec6 + vec14; + temp114 = vec6 - vec14; + temp113 = vec7 + vec15; + temp115 = vec7 - vec15; + + /* Pre-additions and core multiplications */ + temp20 = temp10 + temp18; + temp24 = temp10 - temp18; + temp21 = temp11 + temp19; + temp25 = temp11 - temp19; + temp28 = temp12 - temp111; + temp210 = temp12 + temp111; + temp29 = temp13 + temp110; + temp211 = temp13 - temp110; + temp22 = temp14 + temp112; + temp27 = temp14 - temp112; + temp23 = temp15 + temp113; + temp26 = temp113 - temp15; + + temp11 = temp16 + temp114; + temp12 = temp16 - temp114; + temp10 = temp17 + temp115; + temp13 = temp17 - temp115; + temp212 = (temp10 + temp12) * INV_SQRT2; + temp214 = (temp10 - temp12) * INV_SQRT2; + temp213 = (temp13 - temp11) * INV_SQRT2; + temp215 = (temp11 + temp13) * -INV_SQRT2; + + /* odd */ + vec0 = vec[0] - vec[16]; + vec1 = vec[1] - vec[17]; + vec2 = vec[2] - vec[18]; + vec3 = vec[3] - vec[19]; + vec4 = vec[4] - vec[20]; + vec5 = vec[5] - vec[21]; + vec6 = vec[6] - vec[22]; + vec7 = vec[7] - vec[23]; + vec8 = vec[8] - vec[24]; + vec9 = vec[9] - vec[25]; + vec10 = vec[10] - vec[26]; + vec11 = vec[11] - vec[27]; + vec12 = vec[12] - vec[28]; + vec13 = vec[13] - vec[29]; + vec14 = vec[14] - vec[30]; + vec15 = vec[15] - vec[31]; + + /* Pre-additions and core multiplications */ + temp19 = (vec2 + vec14) * -COS_3PI_DIV8; + temp110 = (vec2 - vec14) * COS_PI_DIV8; + temp18 = (vec3 + vec15) * COS_3PI_DIV8; + temp111 = (vec3 - vec15) * COS_PI_DIV8; + temp15 = (vec4 + vec12) * -INV_SQRT2; + temp16 = (vec4 - vec12) * INV_SQRT2; + temp14 = (vec5 + vec13) * INV_SQRT2; + temp17 = (vec5 - vec13) * INV_SQRT2; + temp113 = (vec6 + vec10) * -COS_PI_DIV8; + temp114 = (vec6 - vec10) * COS_3PI_DIV8; + temp112 = (vec7 + vec11) * COS_PI_DIV8; + temp115 = (vec7 - vec11) * COS_3PI_DIV8; + + /* Core multiplications */ + vec2 = temp18 * SQRT2PLUS1 - temp112 * SQRT2MINUS1; + vec3 = temp19 * SQRT2PLUS1 - temp113 * SQRT2MINUS1; + vec4 = temp110 * SQRT2MINUS1 - temp114 * SQRT2PLUS1; + vec5 = temp111 * SQRT2MINUS1 - temp115 * SQRT2PLUS1; + + /* Post-additions */ + temp18 += temp112; + temp19 += temp113; + temp110 += temp114; + temp111 += temp115; + vec6 = vec0 + temp14; + vec10 = vec0 - temp14; + vec7 = vec1 + temp15; + vec11 = vec1 - temp15; + + vec12 = temp16 - vec9; + vec14 = temp16 + vec9; + vec13 = vec8 + temp17; + vec15 = vec8 - temp17; + + temp10 = vec6 - vec14; + temp12 = vec6 + vec14; + temp11 = vec7 + vec15; + temp13 = vec7 - vec15; + temp14 = vec10 + vec12; + temp16 = vec10 - vec12; + temp15 = vec11 + vec13; + temp17 = vec11 - vec13; + + vec10 = temp18 + temp110; + temp110 = temp18 - temp110; + vec11 = temp19 + temp111; + temp111 = temp19 - temp111; + + temp112 = vec2 + vec4; + temp114 = vec2 - vec4; + temp113 = vec3 + vec5; + temp115 = vec3 - vec5; + + /* Post-additions */ + *vec++ = temp20 + temp22; + *vec++ = temp21 + temp23; + *vec++ = temp12 + vec10; + *vec++ = temp13 + vec11; + *vec++ = temp210 + temp212; + *vec++ = temp211 + temp213; + *vec++ = temp10 + temp112; + *vec++ = temp11 + temp113; + *vec++ = temp24 - temp26; + *vec++ = temp25 - temp27; + *vec++ = temp16 + temp114; + *vec++ = temp17 + temp115; + *vec++ = temp28 + temp214; + *vec++ = temp29 + temp215; + *vec++ = temp14 + temp110; + *vec++ = temp15 + temp111; + *vec++ = temp20 - temp22; + *vec++ = temp21 - temp23; + *vec++ = temp12 - vec10; + *vec++ = temp13 - vec11; + *vec++ = temp210 - temp212; + *vec++ = temp211 - temp213; + *vec++ = temp10 - temp112; + *vec++ = temp11 - temp113; + *vec++ = temp24 + temp26; + *vec++ = temp25 + temp27; + *vec++ = temp16 - temp114; + *vec++ = temp17 - temp115; + *vec++ = temp28 - temp214; + *vec++ = temp29 - temp215; + *vec++ = temp14 - temp110; + *vec++ = temp15 - temp111; +} diff --git a/lc3plus/fft/fft_240_480.h b/lc3plus/fft/fft_240_480.h new file mode 100755 index 0000000000..c1d96c87b8 --- /dev/null +++ b/lc3plus/fft/fft_240_480.h @@ -0,0 +1,185 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft240(LC3_FLOAT* in) +{ + const LC3_INT table1[240] = { + 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 225, 1, 17, 33, 49, 65, 81, + 97, 113, 129, 145, 161, 177, 193, 209, 210, 226, 2, 18, 34, 50, 66, 82, 98, 114, 130, 146, 162, 178, + 194, 195, 211, 227, 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, 179, 180, 196, 212, 228, 4, 20, + 36, 52, 68, 84, 100, 116, 132, 148, 164, 165, 181, 197, 213, 229, 5, 21, 37, 53, 69, 85, 101, 117, + 133, 149, 150, 166, 182, 198, 214, 230, 6, 22, 38, 54, 70, 86, 102, 118, 134, 135, 151, 167, 183, 199, + 215, 231, 7, 23, 39, 55, 71, 87, 103, 119, 120, 136, 152, 168, 184, 200, 216, 232, 8, 24, 40, 56, + 72, 88, 104, 105, 121, 137, 153, 169, 185, 201, 217, 233, 9, 25, 41, 57, 73, 89, 90, 106, 122, 138, + 154, 170, 186, 202, 218, 234, 10, 26, 42, 58, 74, 75, 91, 107, 123, 139, 155, 171, 187, 203, 219, 235, + 11, 27, 43, 59, 60, 76, 92, 108, 124, 140, 156, 172, 188, 204, 220, 236, 12, 28, 44, 45, 61, 77, + 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 13, 29, 30, 46, 62, 78, 94, 110, 126, 142, 158, 174, + 190, 206, 222, 238, 14, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239}; + const LC3_INT table2[240] = { + 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 15, 31, 47, 63, 79, 95, 111, + 127, 143, 159, 175, 191, 207, 223, 239, 30, 46, 62, 78, 94, 110, 126, 142, 158, 174, 190, 206, 222, 238, + 14, 45, 61, 77, 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 13, 29, 60, 76, 92, 108, 124, 140, + 156, 172, 188, 204, 220, 236, 12, 28, 44, 75, 91, 107, 123, 139, 155, 171, 187, 203, 219, 235, 11, 27, + 43, 59, 90, 106, 122, 138, 154, 170, 186, 202, 218, 234, 10, 26, 42, 58, 74, 105, 121, 137, 153, 169, + 185, 201, 217, 233, 9, 25, 41, 57, 73, 89, 120, 136, 152, 168, 184, 200, 216, 232, 8, 24, 40, 56, + 72, 88, 104, 135, 151, 167, 183, 199, 215, 231, 7, 23, 39, 55, 71, 87, 103, 119, 150, 166, 182, 198, + 214, 230, 6, 22, 38, 54, 70, 86, 102, 118, 134, 165, 181, 197, 213, 229, 5, 21, 37, 53, 69, 85, + 101, 117, 133, 149, 180, 196, 212, 228, 4, 20, 36, 52, 68, 84, 100, 116, 132, 148, 164, 195, 211, 227, + 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, 179, 210, 226, 2, 18, 34, 50, 66, 82, 98, 114, + 130, 146, 162, 178, 194, 225, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209}; + + const LC3_INT L = 240; + const LC3_INT A = 15; + const LC3_INT B = 16; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_INT k, l; + LC3_FLOAT temp[32], out[480]; + + for (k = 0; k < A; k++) { + for (l = 0; l < B; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += A; + } + + fft16(temp); /* 16-point FFT */ + idx1 -= L; + + for (l = 0; l < B; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += A; + } + + idx1 -= L - 1; + } + + idx1 -= A; + + for (k = 0; k < B; k++) { + for (l = 0; l < A; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft15(temp); /* 15-point FFT */ + + for (l = 0; l < A; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} + +/* description in iis_fft.h */ +static void fft480(LC3_FLOAT* in) +{ + const LC3_INT table1[480] = { + 0, 256, 32, 288, 64, 320, 96, 352, 128, 384, 160, 416, 192, 448, 224, 225, 1, 257, 33, 289, 65, 321, + 97, 353, 129, 385, 161, 417, 193, 449, 450, 226, 2, 258, 34, 290, 66, 322, 98, 354, 130, 386, 162, 418, + 194, 195, 451, 227, 3, 259, 35, 291, 67, 323, 99, 355, 131, 387, 163, 419, 420, 196, 452, 228, 4, 260, + 36, 292, 68, 324, 100, 356, 132, 388, 164, 165, 421, 197, 453, 229, 5, 261, 37, 293, 69, 325, 101, 357, + 133, 389, 390, 166, 422, 198, 454, 230, 6, 262, 38, 294, 70, 326, 102, 358, 134, 135, 391, 167, 423, 199, + 455, 231, 7, 263, 39, 295, 71, 327, 103, 359, 360, 136, 392, 168, 424, 200, 456, 232, 8, 264, 40, 296, + 72, 328, 104, 105, 361, 137, 393, 169, 425, 201, 457, 233, 9, 265, 41, 297, 73, 329, 330, 106, 362, 138, + 394, 170, 426, 202, 458, 234, 10, 266, 42, 298, 74, 75, 331, 107, 363, 139, 395, 171, 427, 203, 459, 235, + 11, 267, 43, 299, 300, 76, 332, 108, 364, 140, 396, 172, 428, 204, 460, 236, 12, 268, 44, 45, 301, 77, + 333, 109, 365, 141, 397, 173, 429, 205, 461, 237, 13, 269, 270, 46, 302, 78, 334, 110, 366, 142, 398, 174, + 430, 206, 462, 238, 14, 15, 271, 47, 303, 79, 335, 111, 367, 143, 399, 175, 431, 207, 463, 239, 240, 16, + 272, 48, 304, 80, 336, 112, 368, 144, 400, 176, 432, 208, 464, 465, 241, 17, 273, 49, 305, 81, 337, 113, + 369, 145, 401, 177, 433, 209, 210, 466, 242, 18, 274, 50, 306, 82, 338, 114, 370, 146, 402, 178, 434, 435, + 211, 467, 243, 19, 275, 51, 307, 83, 339, 115, 371, 147, 403, 179, 180, 436, 212, 468, 244, 20, 276, 52, + 308, 84, 340, 116, 372, 148, 404, 405, 181, 437, 213, 469, 245, 21, 277, 53, 309, 85, 341, 117, 373, 149, + 150, 406, 182, 438, 214, 470, 246, 22, 278, 54, 310, 86, 342, 118, 374, 375, 151, 407, 183, 439, 215, 471, + 247, 23, 279, 55, 311, 87, 343, 119, 120, 376, 152, 408, 184, 440, 216, 472, 248, 24, 280, 56, 312, 88, + 344, 345, 121, 377, 153, 409, 185, 441, 217, 473, 249, 25, 281, 57, 313, 89, 90, 346, 122, 378, 154, 410, + 186, 442, 218, 474, 250, 26, 282, 58, 314, 315, 91, 347, 123, 379, 155, 411, 187, 443, 219, 475, 251, 27, + 283, 59, 60, 316, 92, 348, 124, 380, 156, 412, 188, 444, 220, 476, 252, 28, 284, 285, 61, 317, 93, 349, + 125, 381, 157, 413, 189, 445, 221, 477, 253, 29, 30, 286, 62, 318, 94, 350, 126, 382, 158, 414, 190, 446, + 222, 478, 254, 255, 31, 287, 63, 319, 95, 351, 127, 383, 159, 415, 191, 447, 223, 479}; + const LC3_INT table2[480] = { + 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 15, 47, 79, 111, 143, 175, 207, + 239, 271, 303, 335, 367, 399, 431, 463, 30, 62, 94, 126, 158, 190, 222, 254, 286, 318, 350, 382, 414, 446, + 478, 45, 77, 109, 141, 173, 205, 237, 269, 301, 333, 365, 397, 429, 461, 13, 60, 92, 124, 156, 188, 220, + 252, 284, 316, 348, 380, 412, 444, 476, 28, 75, 107, 139, 171, 203, 235, 267, 299, 331, 363, 395, 427, 459, + 11, 43, 90, 122, 154, 186, 218, 250, 282, 314, 346, 378, 410, 442, 474, 26, 58, 105, 137, 169, 201, 233, + 265, 297, 329, 361, 393, 425, 457, 9, 41, 73, 120, 152, 184, 216, 248, 280, 312, 344, 376, 408, 440, 472, + 24, 56, 88, 135, 167, 199, 231, 263, 295, 327, 359, 391, 423, 455, 7, 39, 71, 103, 150, 182, 214, 246, + 278, 310, 342, 374, 406, 438, 470, 22, 54, 86, 118, 165, 197, 229, 261, 293, 325, 357, 389, 421, 453, 5, + 37, 69, 101, 133, 180, 212, 244, 276, 308, 340, 372, 404, 436, 468, 20, 52, 84, 116, 148, 195, 227, 259, + 291, 323, 355, 387, 419, 451, 3, 35, 67, 99, 131, 163, 210, 242, 274, 306, 338, 370, 402, 434, 466, 18, + 50, 82, 114, 146, 178, 225, 257, 289, 321, 353, 385, 417, 449, 1, 33, 65, 97, 129, 161, 193, 240, 272, + 304, 336, 368, 400, 432, 464, 16, 48, 80, 112, 144, 176, 208, 255, 287, 319, 351, 383, 415, 447, 479, 31, + 63, 95, 127, 159, 191, 223, 270, 302, 334, 366, 398, 430, 462, 14, 46, 78, 110, 142, 174, 206, 238, 285, + 317, 349, 381, 413, 445, 477, 29, 61, 93, 125, 157, 189, 221, 253, 300, 332, 364, 396, 428, 460, 12, 44, + 76, 108, 140, 172, 204, 236, 268, 315, 347, 379, 411, 443, 475, 27, 59, 91, 123, 155, 187, 219, 251, 283, + 330, 362, 394, 426, 458, 10, 42, 74, 106, 138, 170, 202, 234, 266, 298, 345, 377, 409, 441, 473, 25, 57, + 89, 121, 153, 185, 217, 249, 281, 313, 360, 392, 424, 456, 8, 40, 72, 104, 136, 168, 200, 232, 264, 296, + 328, 375, 407, 439, 471, 23, 55, 87, 119, 151, 183, 215, 247, 279, 311, 343, 390, 422, 454, 6, 38, 70, + 102, 134, 166, 198, 230, 262, 294, 326, 358, 405, 437, 469, 21, 53, 85, 117, 149, 181, 213, 245, 277, 309, + 341, 373, 420, 452, 4, 36, 68, 100, 132, 164, 196, 228, 260, 292, 324, 356, 388, 435, 467, 19, 51, 83, + 115, 147, 179, 211, 243, 275, 307, 339, 371, 403, 450, 2, 34, 66, 98, 130, 162, 194, 226, 258, 290, 322, + 354, 386, 418, 465, 17, 49, 81, 113, 145, 177, 209, 241, 273, 305, 337, 369, 401, 433}; + + const LC3_INT L = 480; + const LC3_INT A = 15; + const LC3_INT B = 32; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_INT k, l; + LC3_FLOAT temp[64], out[960]; + + for (k = 0; k < A; k++) { + for (l = 0; l < B; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += A; + } + + fft32(temp); /* 32-point FFT */ + idx1 -= L; + + for (l = 0; l < B; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += A; + } + + idx1 -= L - 1; + } + + idx1 -= A; + + for (k = 0; k < B; k++) { + for (l = 0; l < A; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft15(temp); /* 15-point FFT */ + + for (l = 0; l < A; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} diff --git a/lc3plus/fft/fft_2_9.h b/lc3plus/fft/fft_2_9.h new file mode 100755 index 0000000000..54f4f839df --- /dev/null +++ b/lc3plus/fft/fft_2_9.h @@ -0,0 +1,278 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static __inline void butterfly(const LC3_FLOAT a, const LC3_FLOAT b, LC3_FLOAT* aPlusb, LC3_FLOAT* aMinusb) +{ + *aPlusb = a + b; + *aMinusb = a - b; +} + +static void fft2(LC3_FLOAT* vec) +{ + /* + 1.0000 1.0000 + 1.0000 -1.0000 + */ + LC3_FLOAT re1 = vec[0]; + LC3_FLOAT im1 = vec[1]; + LC3_FLOAT re2 = vec[2]; + LC3_FLOAT im2 = vec[3]; + + vec[0] = re1 + re2; + vec[1] = im1 + im2; + vec[2] = re1 - re2; + vec[3] = im1 - im2; +} + +static void fft3(LC3_FLOAT* vec) +{ + const LC3_FLOAT C31 = 0.5; /* cos(PI/3); sin(2*PI/3) */ + const LC3_FLOAT C32 = 0.866025403784439; /* cos(PI/3); sin(2*PI/3) */ + + LC3_FLOAT re1 = vec[0]; + LC3_FLOAT im1 = vec[1]; + LC3_FLOAT re2 = vec[2]; + LC3_FLOAT im2 = vec[3]; + LC3_FLOAT re3 = vec[4]; + LC3_FLOAT im3 = vec[5]; + /* + 1.0000 1.0000 1.0000 + C31 C32 + 1.0000 -0.5000 - 0.8660i -0.5000 + 0.8660i + 1.0000 -0.5000 + 0.8660i -0.5000 - 0.8660i + */ + LC3_FLOAT tmp1 = re2 + re3; + LC3_FLOAT tmp3 = im2 + im3; + LC3_FLOAT tmp2 = re2 - re3; + LC3_FLOAT tmp4 = im2 - im3; + + vec[0] = re1 + tmp1; + vec[1] = im1 + tmp3; + vec[2] = re1 - C31 * tmp1 + C32 * tmp4; + vec[4] = re1 - C31 * tmp1 - C32 * tmp4; + vec[3] = im1 - C32 * tmp2 - C31 * tmp3; + vec[5] = im1 + C32 * tmp2 - C31 * tmp3; +} + +static void fft4(LC3_FLOAT* vec) +{ + LC3_FLOAT temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + + /* Pre-additions */ + temp0 = vec[0] + vec[4]; + temp2 = vec[0] - vec[4]; + temp1 = vec[1] + vec[5]; + temp3 = vec[1] - vec[5]; + temp4 = vec[2] + vec[6]; + temp7 = vec[2] - vec[6]; + temp5 = vec[7] + vec[3]; + temp6 = vec[7] - vec[3]; + + /* Post-additions */ + vec[0] = temp0 + temp4; + vec[1] = temp1 + temp5; + vec[2] = temp2 - temp6; + vec[3] = temp3 - temp7; + vec[4] = temp0 - temp4; + vec[5] = temp1 - temp5; + vec[6] = temp2 + temp6; + vec[7] = temp3 + temp7; +} + +static void fft5(LC3_FLOAT* vec) +{ + const LC3_FLOAT C51 = 0.309016994374947; /* cos(2*PI/5); */ + const LC3_FLOAT C52 = 0.951056516295154; /* sin(2*PI/5); */ + const LC3_FLOAT C53 = 0.809016994374947; /* cos( PI/5); */ + const LC3_FLOAT C54 = 0.587785252292473; /* sin( PI/5); */ + + LC3_FLOAT re1, im1, re2, im2, re3, im3, re4, im4, re5, im5, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; + + re1 = vec[0]; + im1 = vec[1]; + re2 = vec[2]; + im2 = vec[3]; + re3 = vec[4]; + im3 = vec[5]; + re4 = vec[6]; + im4 = vec[7]; + re5 = vec[8]; + im5 = vec[9]; + /* + 1.0000 1.0000 1.0000 1.0000 1.0000 + C51 C52 C53 C54 + 1.0000 0.3090 - 0.9511i -0.8090 - 0.5878i -0.8090 + 0.5878i 0.3090 + 0.9511i + 1.0000 -0.8090 - 0.5878i 0.3090 + 0.9511i 0.3090 - 0.9511i -0.8090 + 0.5878i + 1.0000 -0.8090 + 0.5878i 0.3090 - 0.9511i 0.3090 + 0.9511i -0.8090 - 0.5878i + 1.0000 0.3090 + 0.9511i -0.8090 + 0.5878i -0.8090 - 0.5878i 0.3090 - 0.9511i + */ + tmp1 = re2 + re5; + tmp2 = re2 - re5; + tmp3 = im2 + im5; + tmp4 = im2 - im5; + tmp5 = re3 + re4; + tmp6 = re3 - re4; + tmp7 = im3 + im4; + tmp8 = im3 - im4; + + vec[0] = re1 + tmp1 + tmp5; + vec[1] = im1 + tmp3 + tmp7; + vec[2] = re1 + C51 * tmp1 - C53 * tmp5 + C52 * tmp4 + C54 * tmp8; + vec[8] = re1 + C51 * tmp1 - C53 * tmp5 - C52 * tmp4 - C54 * tmp8; + vec[3] = im1 - C52 * tmp2 - C54 * tmp6 + C51 * tmp3 - C53 * tmp7; + vec[9] = im1 + C52 * tmp2 + C54 * tmp6 + C51 * tmp3 - C53 * tmp7; + vec[4] = re1 - C53 * tmp1 + C51 * tmp5 + C54 * tmp4 - C52 * tmp8; + vec[6] = re1 - C53 * tmp1 + C51 * tmp5 - C54 * tmp4 + C52 * tmp8; + vec[5] = im1 - C54 * tmp2 + C52 * tmp6 - C53 * tmp3 + C51 * tmp7; + vec[7] = im1 + C54 * tmp2 - C52 * tmp6 - C53 * tmp3 + C51 * tmp7; +} + + + +static void fft8(LC3_FLOAT* vec) +{ + const LC3_FLOAT INV_SQRT2 = 7.071067811865475e-1; + LC3_FLOAT temp1[16], temp2[16]; + + /* Pre-additions */ + temp1[0] = vec[0] + vec[8]; + temp1[2] = vec[0] - vec[8]; + temp1[1] = vec[1] + vec[9]; + temp1[3] = vec[1] - vec[9]; + temp1[4] = vec[2] + vec[10]; + temp1[6] = vec[2] - vec[10]; + temp1[5] = vec[3] + vec[11]; + temp1[7] = vec[3] - vec[11]; + temp1[8] = vec[4] + vec[12]; + temp1[10] = vec[4] - vec[12]; + temp1[9] = vec[5] + vec[13]; + temp1[11] = vec[5] - vec[13]; + temp1[12] = vec[6] + vec[14]; + temp1[14] = vec[6] - vec[14]; + temp1[13] = vec[7] + vec[15]; + temp1[15] = vec[7] - vec[15]; + + /* Pre-additions and core multiplications */ + temp2[0] = temp1[0] + temp1[8]; + temp2[4] = temp1[0] - temp1[8]; + temp2[1] = temp1[1] + temp1[9]; + temp2[5] = temp1[1] - temp1[9]; + temp2[8] = temp1[2] - temp1[11]; + temp2[10] = temp1[2] + temp1[11]; + temp2[9] = temp1[3] + temp1[10]; + temp2[11] = temp1[3] - temp1[10]; + temp2[2] = temp1[4] + temp1[12]; + temp2[7] = temp1[4] - temp1[12]; + temp2[3] = temp1[5] + temp1[13]; + temp2[6] = temp1[13] - temp1[5]; + + temp1[1] = temp1[6] + temp1[14]; + temp1[2] = temp1[6] - temp1[14]; + temp1[0] = temp1[7] + temp1[15]; + temp1[3] = temp1[7] - temp1[15]; + temp2[12] = (temp1[0] + temp1[2]) * INV_SQRT2; + temp2[14] = (temp1[0] - temp1[2]) * INV_SQRT2; + temp2[13] = (temp1[3] - temp1[1]) * INV_SQRT2; + temp2[15] = (temp1[1] + temp1[3]) * -INV_SQRT2; + + /* Post-additions */ + vec[0] = temp2[0] + temp2[2]; + vec[8] = temp2[0] - temp2[2]; + vec[1] = temp2[1] + temp2[3]; + vec[9] = temp2[1] - temp2[3]; + vec[4] = temp2[4] - temp2[6]; + vec[12] = temp2[4] + temp2[6]; + vec[5] = temp2[5] - temp2[7]; + vec[13] = temp2[5] + temp2[7]; + vec[6] = temp2[8] + temp2[14]; + vec[14] = temp2[8] - temp2[14]; + vec[7] = temp2[9] + temp2[15]; + vec[15] = temp2[9] - temp2[15]; + vec[2] = temp2[10] + temp2[12]; + vec[10] = temp2[10] - temp2[12]; + vec[3] = temp2[11] + temp2[13]; + vec[11] = temp2[11] - temp2[13]; +} + + +static void fft9(LC3_FLOAT* vec) +{ + const LC3_FLOAT C91 = 0.766044443118978; /* cos(2*PI/5); */ + const LC3_FLOAT C92 = 0.642787609686539; + const LC3_FLOAT C93 = 0.17364817766693; + const LC3_FLOAT C94 = 0.984807753012208; + const LC3_FLOAT C95 = 0.5; + const LC3_FLOAT C96 = 0.866025403784439; + const LC3_FLOAT C97 = 0.939692620785908; + const LC3_FLOAT C98 = 0.342020143325669; + + LC3_FLOAT re1, im1, re2_9p, re2_9m, im2_9p, im2_9m, re3_8p, re3_8m, im3_8p, im3_8m, re4_7p, re4_7m, im4_7p, im4_7m, + re5_6p, re5_6m, im5_6p, im5_6m; + + re1 = vec[0]; + im1 = vec[1]; + + butterfly(vec[1 * 2], vec[8 * 2], &re2_9p, &re2_9m); + butterfly(vec[1 * 2 + 1], vec[8 * 2 + 1], &im2_9p, &im2_9m); + butterfly(vec[2 * 2], vec[7 * 2], &re3_8p, &re3_8m); + butterfly(vec[2 * 2 + 1], vec[7 * 2 + 1], &im3_8p, &im3_8m); + butterfly(vec[3 * 2], vec[6 * 2], &re4_7p, &re4_7m); + butterfly(vec[3 * 2 + 1], vec[6 * 2 + 1], &im4_7p, &im4_7m); + butterfly(vec[4 * 2], vec[5 * 2], &re5_6p, &re5_6m); + butterfly(vec[4 * 2 + 1], vec[5 * 2 + 1], &im5_6p, &im5_6m); + + /* + 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 + 1.0000 C91 - C92i C93 - C94i -C95 - C96i -C97 - C98i -C97 + C98i -C95 + C96i C93 + C94i C91 + C92i + 1.0000 C93 - C94i -C97 - C98i -C95 + C96i C91 + C92i C91 - C92i -C95 - C96i -C97 + C98i C93 + C94i + 1.0000 -C95 - C96i -C95 + C96i 1.0000 -C95 - C96i -C95 + C96i 1.0000 -C95 - C96i -C95 + C96i + 1.0000 -C97 - C98i C91 + C92i -C95 - C96i C93 + C94i C93 - C94i -C95 + C96i C91 - C92i -C97 + C98i + 1.0000 -C97 + C98i C91 - C92i -C95 + C96i C93 - C94i C93 + C94i -C95 - C96i C91 + C92i -C97 - C98i + 1.0000 -C95 + C96i -C95 - C96i 1.0000 -C95 + C96i -C95 - C96i 1.0000 -C95 + C96i -C95 - C96i + 1.0000 C93 + C94i -C97 + C98i -C95 - C96i C91 - C92i C91 + C92i -C95 + C96i -C97 - C98i C93 - C94i + 1.0000 C91 + C92i C93 + C94i -C95 + C96i -C97 + C98i -C97 - C98i -C95 - C96i C93 - C94i C91 - C92i + */ + vec[0] = re1 + re2_9p + re3_8p + re4_7p + re5_6p; + vec[1] = im1 + im2_9p + im3_8p + im4_7p + im5_6p; + vec[2] = re1 + C91 * re2_9p + C93 * re3_8p - C95 * re4_7p - C97 * re5_6p + C92 * im2_9m + C94 * im3_8m + + C96 * im4_7m + C98 * im5_6m; + vec[16] = re1 + C91 * re2_9p + C93 * re3_8p - C95 * re4_7p - C97 * re5_6p - C92 * im2_9m - C94 * im3_8m - + C96 * im4_7m - C98 * im5_6m; + vec[3] = im1 - C92 * re2_9m - C94 * re3_8m - C96 * re4_7m - C98 * re5_6m + C91 * im2_9p + C93 * im3_8p - + C95 * im4_7p - C97 * im5_6p; + vec[17] = im1 + C92 * re2_9m + C94 * re3_8m + C96 * re4_7m + C98 * re5_6m + C91 * im2_9p + C93 * im3_8p - + C95 * im4_7p - C97 * im5_6p; + vec[4] = re1 + C93 * re2_9p - C97 * re3_8p - C95 * re4_7p + C91 * re5_6p + C94 * im2_9m + C98 * im3_8m - + C96 * im4_7m - C92 * im5_6m; + vec[14] = re1 + C93 * re2_9p - C97 * re3_8p - C95 * re4_7p + C91 * re5_6p - C94 * im2_9m - C98 * im3_8m + + C96 * im4_7m + C92 * im5_6m; + vec[5] = im1 - C94 * re2_9m - C98 * re3_8m + C96 * re4_7m + C92 * re5_6m + C93 * im2_9p - C97 * im3_8p - + C95 * im4_7p + C91 * im5_6p; + vec[15] = im1 + C94 * re2_9m + C98 * re3_8m - C96 * re4_7m - C92 * re5_6m + C93 * im2_9p - C97 * im3_8p - + C95 * im4_7p + C91 * im5_6p; + vec[6] = re1 - C95 * (re2_9p + re3_8p + re5_6p) + re4_7p + C96 * (im2_9m - im3_8m + im5_6m); + vec[12] = re1 - C95 * (re2_9p + re3_8p + re5_6p) + re4_7p - C96 * (im2_9m - im3_8m + im5_6m); + vec[7] = im1 - C96 * (re2_9m - re3_8m + re5_6m) - C95 * (im2_9p + im3_8p + im5_6p) + im4_7p; + vec[13] = im1 + C96 * (re2_9m - re3_8m + re5_6m) - C95 * (im2_9p + im3_8p + im5_6p) + im4_7p; + vec[8] = re1 - C97 * re2_9p + C91 * re3_8p - C95 * re4_7p + C93 * re5_6p + C98 * im2_9m - C92 * im3_8m + + C96 * im4_7m - C94 * im5_6m; + vec[10] = re1 - C97 * re2_9p + C91 * re3_8p - C95 * re4_7p + C93 * re5_6p - C98 * im2_9m + C92 * im3_8m - + C96 * im4_7m + C94 * im5_6m; + vec[9] = im1 - C98 * re2_9m + C92 * re3_8m - C96 * re4_7m + C94 * re5_6m - C97 * im2_9p + C91 * im3_8p - + C95 * im4_7p + C93 * im5_6p; + vec[11] = im1 + C98 * re2_9m - C92 * re3_8m + C96 * re4_7m - C94 * re5_6m - C97 * im2_9p + C91 * im3_8p - + C95 * im4_7p + C93 * im5_6p; +} + diff --git a/lc3plus/fft/fft_32.h b/lc3plus/fft/fft_32.h new file mode 100755 index 0000000000..48b891108b --- /dev/null +++ b/lc3plus/fft/fft_32.h @@ -0,0 +1,467 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft32(LC3_FLOAT* vec) +{ + const LC3_FLOAT INV_SQRT2 = 7.071067811865475e-1; + const LC3_FLOAT COS_PI_DIV8 = 9.238795325112867e-1; + const LC3_FLOAT COS_3PI_DIV8 = 3.826834323650898e-1; + const LC3_FLOAT SQRT2PLUS1 = 2.414213562373095; + const LC3_FLOAT SQRT2MINUS1 = 4.142135623730952e-1; + + const LC3_FLOAT c[4] = {9.807852804032304e-1, 8.314696123025452e-1, 5.555702330196023e-1, 1.950903220161283e-1}; + + LC3_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, + temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp110, temp111, temp112, + temp113, temp114, temp115, temp20, temp21, temp22, temp23, temp24, temp25, temp26, temp27, temp28, temp29, + temp210, temp211, temp212, temp213, temp214, temp215, temp30, temp31, temp32, temp33, temp34, temp35, temp36, + temp37, temp38, temp39, temp310, temp311, temp312, temp313, temp314, temp315, temp316, temp317, temp318, + temp319, temp320, temp321, temp322, temp323, temp324, temp325, temp326, temp327, temp328, temp329, temp330, + temp331, temp40, temp41, temp42, temp43, temp44, temp45, temp46, temp47, temp48, temp49, temp410, temp411, + temp412, temp413, temp414, temp415; + + temp20 = vec[2] - vec[34]; + temp21 = vec[3] - vec[35]; + temp30 = vec[0] + vec[32]; + temp31 = vec[1] + vec[33]; + temp32 = vec[2] + vec[34]; + temp33 = vec[3] + vec[35]; + + temp22 = vec[6] - vec[38]; + temp23 = vec[7] - vec[39]; + temp34 = vec[4] + vec[36]; + temp35 = vec[5] + vec[37]; + temp36 = vec[6] + vec[38]; + temp37 = vec[7] + vec[39]; + + temp24 = vec[10] - vec[42]; + temp25 = vec[11] - vec[43]; + temp38 = vec[8] + vec[40]; + temp39 = vec[9] + vec[41]; + temp310 = vec[10] + vec[42]; + temp311 = vec[11] + vec[43]; + + temp26 = vec[14] - vec[46]; + temp27 = vec[15] - vec[47]; + temp312 = vec[12] + vec[44]; + temp313 = vec[13] + vec[45]; + temp314 = vec[14] + vec[46]; + temp315 = vec[15] + vec[47]; + + temp28 = vec[18] - vec[50]; + temp29 = vec[19] - vec[51]; + temp316 = vec[16] + vec[48]; + temp317 = vec[17] + vec[49]; + temp318 = vec[18] + vec[50]; + temp319 = vec[19] + vec[51]; + + temp210 = vec[22] - vec[54]; + temp211 = vec[23] - vec[55]; + temp320 = vec[20] + vec[52]; + temp321 = vec[21] + vec[53]; + temp322 = vec[22] + vec[54]; + temp323 = vec[23] + vec[55]; + + temp212 = vec[26] - vec[58]; + temp213 = vec[27] - vec[59]; + temp324 = vec[24] + vec[56]; + temp325 = vec[25] + vec[57]; + temp326 = vec[26] + vec[58]; + temp327 = vec[27] + vec[59]; + + temp214 = vec[30] - vec[62]; + temp215 = vec[31] - vec[63]; + temp328 = vec[28] + vec[60]; + temp329 = vec[29] + vec[61]; + temp330 = vec[30] + vec[62]; + temp331 = vec[31] + vec[63]; + + /* Pre-additions */ + temp41 = -(temp20 + temp214); + temp42 = temp20 - temp214; + temp40 = temp21 + temp215; + temp43 = temp21 - temp215; + temp45 = -(temp22 + temp212); + temp46 = temp22 - temp212; + temp44 = temp23 + temp213; + temp47 = temp23 - temp213; + temp49 = -(temp24 + temp210); + temp410 = temp24 - temp210; + temp48 = temp25 + temp211; + temp411 = temp25 - temp211; + temp413 = -(temp26 + temp28); + temp414 = temp26 - temp28; + temp412 = temp27 + temp29; + temp415 = temp27 - temp29; + + /* Core multiplications */ + temp20 = temp40 * c[3] + temp44 * c[2] + temp48 * c[1] + temp412 * c[0]; + temp24 = temp40 * c[2] + temp44 * c[0] + temp48 * c[3] - temp412 * c[1]; + temp28 = temp40 * c[1] + temp44 * c[3] - temp48 * c[0] + temp412 * c[2]; + temp212 = temp40 * c[0] - temp44 * c[1] + temp48 * c[2] - temp412 * c[3]; + temp21 = temp41 * c[3] + temp45 * c[2] + temp49 * c[1] + temp413 * c[0]; + temp25 = temp41 * c[2] + temp45 * c[0] + temp49 * c[3] - temp413 * c[1]; + temp29 = temp41 * c[1] + temp45 * c[3] - temp49 * c[0] + temp413 * c[2]; + temp213 = temp41 * c[0] - temp45 * c[1] + temp49 * c[2] - temp413 * c[3]; + temp22 = temp42 * c[0] + temp46 * c[1] + temp410 * c[2] + temp414 * c[3]; + temp26 = temp42 * c[1] - temp46 * c[3] - temp410 * c[0] - temp414 * c[2]; + temp210 = temp42 * c[2] - temp46 * c[0] + temp410 * c[3] + temp414 * c[1]; + temp214 = temp42 * c[3] - temp46 * c[2] + temp410 * c[1] - temp414 * c[0]; + temp23 = temp43 * c[0] + temp47 * c[1] + temp411 * c[2] + temp415 * c[3]; + temp27 = temp43 * c[1] - temp47 * c[3] - temp411 * c[0] - temp415 * c[2]; + temp211 = temp43 * c[2] - temp47 * c[0] + temp411 * c[3] + temp415 * c[1]; + temp215 = temp43 * c[3] - temp47 * c[2] + temp411 * c[1] - temp415 * c[0]; + + /* Post-additions */ + temp40 = temp20 + temp22; + temp414 = temp20 - temp22; + temp41 = temp21 + temp23; + temp415 = temp21 - temp23; + temp42 = temp24 + temp26; + temp412 = temp24 - temp26; + temp43 = temp25 + temp27; + temp413 = temp25 - temp27; + temp44 = temp28 + temp210; + temp410 = temp28 - temp210; + temp45 = temp29 + temp211; + temp411 = temp29 - temp211; + temp46 = temp212 + temp214; + temp48 = temp212 - temp214; + temp47 = temp213 + temp215; + temp49 = temp213 - temp215; + + /* fft16(temp3); */ + /* even */ + temp10 = temp30 + temp316; + temp11 = temp31 + temp317; + temp12 = temp32 + temp318; + temp13 = temp33 + temp319; + temp14 = temp34 + temp320; + temp15 = temp35 + temp321; + temp16 = temp36 + temp322; + temp17 = temp37 + temp323; + temp18 = temp38 + temp324; + temp19 = temp39 + temp325; + temp110 = temp310 + temp326; + temp111 = temp311 + temp327; + temp112 = temp312 + temp328; + temp113 = temp313 + temp329; + temp114 = temp314 + temp330; + temp115 = temp315 + temp331; + + /* Pre-additions */ + tmp0 = temp10 + temp18; + tmp2 = temp10 - temp18; + tmp1 = temp11 + temp19; + tmp3 = temp11 - temp19; + tmp4 = temp12 + temp110; + tmp6 = temp12 - temp110; + tmp5 = temp13 + temp111; + tmp7 = temp13 - temp111; + tmp8 = temp14 + temp112; + tmp10 = temp14 - temp112; + tmp9 = temp15 + temp113; + tmp11 = temp15 - temp113; + tmp12 = temp16 + temp114; + tmp14 = temp16 - temp114; + tmp13 = temp17 + temp115; + tmp15 = temp17 - temp115; + + /* Pre-additions and core multiplications */ + temp20 = tmp0 + tmp8; + temp24 = tmp0 - tmp8; + temp21 = tmp1 + tmp9; + temp25 = tmp1 - tmp9; + temp28 = tmp2 - tmp11; + temp210 = tmp2 + tmp11; + temp29 = tmp3 + tmp10; + temp211 = tmp3 - tmp10; + temp22 = tmp4 + tmp12; + temp27 = tmp4 - tmp12; + temp23 = tmp5 + tmp13; + temp26 = tmp13 - tmp5; + + tmp1 = tmp6 + tmp14; + tmp2 = tmp6 - tmp14; + tmp0 = tmp7 + tmp15; + tmp3 = tmp7 - tmp15; + temp212 = (tmp0 + tmp2) * INV_SQRT2; + temp214 = (tmp0 - tmp2) * INV_SQRT2; + temp213 = (tmp3 - tmp1) * INV_SQRT2; + temp215 = (tmp1 + tmp3) * -INV_SQRT2; + + /* odd */ + temp10 = temp30 - temp316; + temp11 = temp31 - temp317; + temp12 = temp32 - temp318; + temp13 = temp33 - temp319; + temp14 = temp34 - temp320; + temp15 = temp35 - temp321; + temp16 = temp36 - temp322; + temp17 = temp37 - temp323; + temp18 = temp38 - temp324; + temp19 = temp39 - temp325; + temp110 = temp310 - temp326; + temp111 = temp311 - temp327; + temp112 = temp312 - temp328; + temp113 = temp313 - temp329; + temp114 = temp314 - temp330; + temp115 = temp315 - temp331; + + /* Post-additions */ + temp30 = temp20 + temp22; + temp316 = temp20 - temp22; + temp31 = temp21 + temp23; + temp317 = temp21 - temp23; + temp38 = temp24 - temp26; + temp324 = temp24 + temp26; + temp39 = temp25 - temp27; + temp325 = temp25 + temp27; + temp312 = temp28 + temp214; + temp328 = temp28 - temp214; + temp313 = temp29 + temp215; + temp329 = temp29 - temp215; + temp34 = temp210 + temp212; + temp320 = temp210 - temp212; + temp35 = temp211 + temp213; + temp321 = temp211 - temp213; + + /* Pre-additions and core multiplications */ + tmp9 = (temp12 + temp114) * -COS_3PI_DIV8; + tmp10 = (temp12 - temp114) * COS_PI_DIV8; + tmp8 = (temp13 + temp115) * COS_3PI_DIV8; + tmp11 = (temp13 - temp115) * COS_PI_DIV8; + tmp5 = (temp14 + temp112) * -INV_SQRT2; + tmp6 = (temp14 - temp112) * INV_SQRT2; + tmp4 = (temp15 + temp113) * INV_SQRT2; + tmp7 = (temp15 - temp113) * INV_SQRT2; + tmp13 = (temp16 + temp110) * -COS_PI_DIV8; + tmp14 = (temp16 - temp110) * COS_3PI_DIV8; + tmp12 = (temp17 + temp111) * COS_PI_DIV8; + tmp15 = (temp17 - temp111) * COS_3PI_DIV8; + + /* Core multiplications */ + temp12 = tmp8 * SQRT2PLUS1 - tmp12 * SQRT2MINUS1; + temp13 = tmp9 * SQRT2PLUS1 - tmp13 * SQRT2MINUS1; + temp14 = tmp10 * SQRT2MINUS1 - tmp14 * SQRT2PLUS1; + temp15 = tmp11 * SQRT2MINUS1 - tmp15 * SQRT2PLUS1; + + /* Post-additions */ + tmp8 += tmp12; + tmp9 += tmp13; + tmp10 += tmp14; + tmp11 += tmp15; + temp16 = temp10 + tmp4; + temp110 = temp10 - tmp4; + temp17 = temp11 + tmp5; + temp111 = temp11 - tmp5; + + temp112 = tmp6 - temp19; + temp114 = tmp6 + temp19; + temp113 = temp18 + tmp7; + temp115 = temp18 - tmp7; + + tmp0 = temp16 - temp114; + tmp2 = temp16 + temp114; + tmp1 = temp17 + temp115; + tmp3 = temp17 - temp115; + tmp4 = temp110 + temp112; + tmp6 = temp110 - temp112; + tmp5 = temp111 + temp113; + tmp7 = temp111 - temp113; + + temp110 = tmp8 + tmp10; + tmp10 = tmp8 - tmp10; + temp111 = tmp9 + tmp11; + tmp11 = tmp9 - tmp11; + + tmp12 = temp12 + temp14; + tmp14 = temp12 - temp14; + tmp13 = temp13 + temp15; + tmp15 = temp13 - temp15; + + temp32 = tmp2 + temp110; + temp318 = tmp2 - temp110; + temp33 = tmp3 + temp111; + temp319 = tmp3 - temp111; + temp36 = tmp0 + tmp12; + temp322 = tmp0 - tmp12; + temp37 = tmp1 + tmp13; + temp323 = tmp1 - tmp13; + temp314 = tmp4 + tmp10; + temp330 = tmp4 - tmp10; + temp315 = tmp5 + tmp11; + temp331 = tmp5 - tmp11; + temp310 = tmp6 + tmp14; + temp326 = tmp6 - tmp14; + temp311 = tmp7 + tmp15; + temp327 = tmp7 - tmp15; + /* fft16(temp3); end */ + + /* fft8even(temp1); */ + temp10 = vec[0] - vec[32]; + temp11 = vec[1] - vec[33]; + temp12 = vec[4] - vec[36]; + temp13 = vec[5] - vec[37]; + temp14 = vec[8] - vec[40]; + temp15 = vec[9] - vec[41]; + temp16 = vec[12] - vec[44]; + temp17 = vec[13] - vec[45]; + temp18 = vec[16] - vec[48]; + temp19 = vec[17] - vec[49]; + temp110 = vec[20] - vec[52]; + temp111 = vec[21] - vec[53]; + temp112 = vec[24] - vec[56]; + temp113 = vec[25] - vec[57]; + temp114 = vec[28] - vec[60]; + temp115 = vec[29] - vec[61]; + + /* Pre-additions and core multiplications */ + tmp9 = (temp12 + temp114) * -COS_3PI_DIV8; + tmp10 = (temp12 - temp114) * COS_PI_DIV8; + tmp8 = (temp13 + temp115) * COS_3PI_DIV8; + tmp11 = (temp13 - temp115) * COS_PI_DIV8; + tmp5 = (temp14 + temp112) * -INV_SQRT2; + tmp6 = (temp14 - temp112) * INV_SQRT2; + tmp4 = (temp15 + temp113) * INV_SQRT2; + tmp7 = (temp15 - temp113) * INV_SQRT2; + tmp13 = (temp16 + temp110) * -COS_PI_DIV8; + tmp14 = (temp16 - temp110) * COS_3PI_DIV8; + tmp12 = (temp17 + temp111) * COS_PI_DIV8; + tmp15 = (temp17 - temp111) * COS_3PI_DIV8; + + /* Core multiplications */ + temp12 = tmp8 * SQRT2PLUS1 - tmp12 * SQRT2MINUS1; + temp13 = tmp9 * SQRT2PLUS1 - tmp13 * SQRT2MINUS1; + temp14 = tmp10 * SQRT2MINUS1 - tmp14 * SQRT2PLUS1; + temp15 = tmp11 * SQRT2MINUS1 - tmp15 * SQRT2PLUS1; + + /* Post-additions */ + tmp8 += tmp12; + tmp9 += tmp13; + tmp10 += tmp14; + tmp11 += tmp15; + temp16 = temp10 + tmp4; + temp110 = temp10 - tmp4; + temp17 = temp11 + tmp5; + temp111 = temp11 - tmp5; + + temp112 = tmp6 - temp19; + temp114 = tmp6 + temp19; + temp113 = temp18 + tmp7; + temp115 = temp18 - tmp7; + + tmp0 = temp16 - temp114; + tmp2 = temp16 + temp114; + tmp1 = temp17 + temp115; + tmp3 = temp17 - temp115; + tmp4 = temp110 + temp112; + tmp6 = temp110 - temp112; + tmp5 = temp111 + temp113; + tmp7 = temp111 - temp113; + + temp110 = tmp8 + tmp10; + tmp10 = tmp8 - tmp10; + temp111 = tmp9 + tmp11; + tmp11 = tmp9 - tmp11; + + tmp12 = temp12 + temp14; + tmp14 = temp12 - temp14; + tmp13 = temp13 + temp15; + tmp15 = temp13 - temp15; + + temp10 = tmp2 + temp110; + temp18 = tmp2 - temp110; + temp11 = tmp3 + temp111; + temp19 = tmp3 - temp111; + temp12 = tmp0 + tmp12; + temp110 = tmp0 - tmp12; + temp13 = tmp1 + tmp13; + temp111 = tmp1 - tmp13; + temp16 = tmp4 + tmp10; + temp114 = tmp4 - tmp10; + temp17 = tmp5 + tmp11; + temp115 = tmp5 - tmp11; + temp14 = tmp6 + tmp14; + temp112 = tmp6 - tmp14; + temp15 = tmp7 + tmp15; + temp113 = tmp7 - tmp15; + /* fft8even(temp1); end */ + + *vec++ = temp30; + *vec++ = temp31; + *vec++ = temp10 + temp40; + *vec++ = temp11 + temp41; + *vec++ = temp32; + *vec++ = temp33; + *vec++ = temp12 + temp42; + *vec++ = temp13 + temp43; + *vec++ = temp34; + *vec++ = temp35; + *vec++ = temp14 + temp44; + *vec++ = temp15 + temp45; + *vec++ = temp36; + *vec++ = temp37; + *vec++ = temp16 + temp46; + *vec++ = temp17 + temp47; + *vec++ = temp38; + *vec++ = temp39; + *vec++ = temp18 + temp48; + *vec++ = temp19 + temp49; + *vec++ = temp310; + *vec++ = temp311; + *vec++ = temp110 + temp410; + *vec++ = temp111 + temp411; + *vec++ = temp312; + *vec++ = temp313; + *vec++ = temp112 + temp412; + *vec++ = temp113 + temp413; + *vec++ = temp314; + *vec++ = temp315; + *vec++ = temp114 + temp414; + *vec++ = temp115 + temp415; + *vec++ = temp316; + *vec++ = temp317; + *vec++ = temp10 - temp40; + *vec++ = temp11 - temp41; + *vec++ = temp318; + *vec++ = temp319; + *vec++ = temp12 - temp42; + *vec++ = temp13 - temp43; + *vec++ = temp320; + *vec++ = temp321; + *vec++ = temp14 - temp44; + *vec++ = temp15 - temp45; + *vec++ = temp322; + *vec++ = temp323; + *vec++ = temp16 - temp46; + *vec++ = temp17 - temp47; + *vec++ = temp324; + *vec++ = temp325; + *vec++ = temp18 - temp48; + *vec++ = temp19 - temp49; + *vec++ = temp326; + *vec++ = temp327; + *vec++ = temp110 - temp410; + *vec++ = temp111 - temp411; + *vec++ = temp328; + *vec++ = temp329; + *vec++ = temp112 - temp412; + *vec++ = temp113 - temp413; + *vec++ = temp330; + *vec++ = temp331; + *vec++ = temp114 - temp414; + *vec++ = temp115 - temp415; +} diff --git a/lc3plus/fft/fft_384_768.h b/lc3plus/fft/fft_384_768.h new file mode 100755 index 0000000000..47f42e90d6 --- /dev/null +++ b/lc3plus/fft/fft_384_768.h @@ -0,0 +1,103 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft384(LC3_FLOAT* restrict in) +{ + const LC3_INT table1[384] = { + 0, 256, 128, 129, 1, 257, 258, 130, 2, 3, 259, 131, 132, 4, 260, 261, 133, 5, 6, 262, 134, 135, + 7, 263, 264, 136, 8, 9, 265, 137, 138, 10, 266, 267, 139, 11, 12, 268, 140, 141, 13, 269, 270, 142, + 14, 15, 271, 143, 144, 16, 272, 273, 145, 17, 18, 274, 146, 147, 19, 275, 276, 148, 20, 21, 277, 149, + 150, 22, 278, 279, 151, 23, 24, 280, 152, 153, 25, 281, 282, 154, 26, 27, 283, 155, 156, 28, 284, 285, + 157, 29, 30, 286, 158, 159, 31, 287, 288, 160, 32, 33, 289, 161, 162, 34, 290, 291, 163, 35, 36, 292, + 164, 165, 37, 293, 294, 166, 38, 39, 295, 167, 168, 40, 296, 297, 169, 41, 42, 298, 170, 171, 43, 299, + 300, 172, 44, 45, 301, 173, 174, 46, 302, 303, 175, 47, 48, 304, 176, 177, 49, 305, 306, 178, 50, 51, + 307, 179, 180, 52, 308, 309, 181, 53, 54, 310, 182, 183, 55, 311, 312, 184, 56, 57, 313, 185, 186, 58, + 314, 315, 187, 59, 60, 316, 188, 189, 61, 317, 318, 190, 62, 63, 319, 191, 192, 64, 320, 321, 193, 65, + 66, 322, 194, 195, 67, 323, 324, 196, 68, 69, 325, 197, 198, 70, 326, 327, 199, 71, 72, 328, 200, 201, + 73, 329, 330, 202, 74, 75, 331, 203, 204, 76, 332, 333, 205, 77, 78, 334, 206, 207, 79, 335, 336, 208, + 80, 81, 337, 209, 210, 82, 338, 339, 211, 83, 84, 340, 212, 213, 85, 341, 342, 214, 86, 87, 343, 215, + 216, 88, 344, 345, 217, 89, 90, 346, 218, 219, 91, 347, 348, 220, 92, 93, 349, 221, 222, 94, 350, 351, + 223, 95, 96, 352, 224, 225, 97, 353, 354, 226, 98, 99, 355, 227, 228, 100, 356, 357, 229, 101, 102, 358, + 230, 231, 103, 359, 360, 232, 104, 105, 361, 233, 234, 106, 362, 363, 235, 107, 108, 364, 236, 237, 109, 365, + 366, 238, 110, 111, 367, 239, 240, 112, 368, 369, 241, 113, 114, 370, 242, 243, 115, 371, 372, 244, 116, 117, + 373, 245, 246, 118, 374, 375, 247, 119, 120, 376, 248, 249, 121, 377, 378, 250, 122, 123, 379, 251, 252, 124, + 380, 381, 253, 125, 126, 382, 254, 255, 127, 383}; + const LC3_INT table2[384] = { + 0, 128, 256, 3, 131, 259, 6, 134, 262, 9, 137, 265, 12, 140, 268, 15, 143, 271, 18, 146, 274, 21, + 149, 277, 24, 152, 280, 27, 155, 283, 30, 158, 286, 33, 161, 289, 36, 164, 292, 39, 167, 295, 42, 170, + 298, 45, 173, 301, 48, 176, 304, 51, 179, 307, 54, 182, 310, 57, 185, 313, 60, 188, 316, 63, 191, 319, + 66, 194, 322, 69, 197, 325, 72, 200, 328, 75, 203, 331, 78, 206, 334, 81, 209, 337, 84, 212, 340, 87, + 215, 343, 90, 218, 346, 93, 221, 349, 96, 224, 352, 99, 227, 355, 102, 230, 358, 105, 233, 361, 108, 236, + 364, 111, 239, 367, 114, 242, 370, 117, 245, 373, 120, 248, 376, 123, 251, 379, 126, 254, 382, 129, 257, 1, + 132, 260, 4, 135, 263, 7, 138, 266, 10, 141, 269, 13, 144, 272, 16, 147, 275, 19, 150, 278, 22, 153, + 281, 25, 156, 284, 28, 159, 287, 31, 162, 290, 34, 165, 293, 37, 168, 296, 40, 171, 299, 43, 174, 302, + 46, 177, 305, 49, 180, 308, 52, 183, 311, 55, 186, 314, 58, 189, 317, 61, 192, 320, 64, 195, 323, 67, + 198, 326, 70, 201, 329, 73, 204, 332, 76, 207, 335, 79, 210, 338, 82, 213, 341, 85, 216, 344, 88, 219, + 347, 91, 222, 350, 94, 225, 353, 97, 228, 356, 100, 231, 359, 103, 234, 362, 106, 237, 365, 109, 240, 368, + 112, 243, 371, 115, 246, 374, 118, 249, 377, 121, 252, 380, 124, 255, 383, 127, 258, 2, 130, 261, 5, 133, + 264, 8, 136, 267, 11, 139, 270, 14, 142, 273, 17, 145, 276, 20, 148, 279, 23, 151, 282, 26, 154, 285, + 29, 157, 288, 32, 160, 291, 35, 163, 294, 38, 166, 297, 41, 169, 300, 44, 172, 303, 47, 175, 306, 50, + 178, 309, 53, 181, 312, 56, 184, 315, 59, 187, 318, 62, 190, 321, 65, 193, 324, 68, 196, 327, 71, 199, + 330, 74, 202, 333, 77, 205, 336, 80, 208, 339, 83, 211, 342, 86, 214, 345, 89, 217, 348, 92, 220, 351, + 95, 223, 354, 98, 226, 357, 101, 229, 360, 104, 232, 363, 107, 235, 366, 110, 238, 369, 113, 241, 372, 116, + 244, 375, 119, 247, 378, 122, 250, 381, 125, 253}; + + const LC3_INT L = 384; + const LC3_INT A = 3; + const LC3_INT B = 128; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_INT k, l; + LC3_FLOAT temp[256], out[768]; + + for (k = 0; k < A; k++) { + for (l = 0; l < B; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += A; + } + + fft128(temp); /* 128-point FFT */ + idx1 -= L; + + for (l = 0; l < B; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += A; + } + + idx1 -= L - 1; + } + + idx1 -= A; + + for (k = 0; k < B; k++) { + for (l = 0; l < A; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft3(temp); /* 3-point FFT */ + + for (l = 0; l < A; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} + diff --git a/lc3plus/fft/fft_60_128.h b/lc3plus/fft/fft_60_128.h new file mode 100755 index 0000000000..75f1aaef45 --- /dev/null +++ b/lc3plus/fft/fft_60_128.h @@ -0,0 +1,161 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +static void fft60(LC3_FLOAT* in) +{ + const LC3_INT table1[] = {0, 45, 30, 15, 16, 1, 46, 31, 32, 17, 2, 47, 48, 33, 18, 3, 4, 49, 34, 19, + 20, 5, 50, 35, 36, 21, 6, 51, 52, 37, 22, 7, 8, 53, 38, 23, 24, 9, 54, 39, + 40, 25, 10, 55, 56, 41, 26, 11, 12, 57, 42, 27, 28, 13, 58, 43, 44, 29, 14, 59}; + const LC3_INT table2[] = {0, 15, 30, 45, 4, 19, 34, 49, 8, 23, 38, 53, 12, 27, 42, 57, 16, 31, 46, 1, + 20, 35, 50, 5, 24, 39, 54, 9, 28, 43, 58, 13, 32, 47, 2, 17, 36, 51, 6, 21, + 40, 55, 10, 25, 44, 59, 14, 29, 48, 3, 18, 33, 52, 7, 22, 37, 56, 11, 26, 41}; + const LC3_INT a = 4; + const LC3_INT b = 15; + const LC3_INT L = 60; + const LC3_INT* idx1 = table1; + const LC3_INT* idx2 = table2; + + LC3_FLOAT temp[30], out[120]; + LC3_INT k, l; + + for (k = 0; k < a; k++) { + for (l = 0; l < b; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1 + 1]; + idx1 += a; + } + + fft15(temp); /* 15-point FFT */ + idx1 -= L; + + for (l = 0; l < b; l++) { + in[2 * *idx1] = temp[2 * l]; + in[2 * *idx1 + 1] = temp[2 * l + 1]; + idx1 += a; + } + idx1 -= L - 1; + } + + idx1 -= a; + + for (k = 0; k < b; k++) { + for (l = 0; l < a; l++) { + temp[2 * l] = in[2 * *idx1]; + temp[2 * l + 1] = in[2 * *idx1++ + 1]; + } + + fft4(temp); /* 4-point FFT */ + + for (l = 0; l < a; l++) { + out[2 * *idx2] = temp[2 * l]; + out[2 * *idx2++ + 1] = temp[2 * l + 1]; + } + } + memmove(in, out, 2 * L * sizeof(LC3_FLOAT)); +} + +static void fft64(LC3_FLOAT* vec) +{ + const LC3_FLOAT w[] = { + 1.0000000000f, 0.9951847267f, 0.9807852804f, 0.9569403357f, 0.9238795325f, 0.8819212643f, 0.8314696123f, + 0.7730104534f, 0.7071067812f, 0.6343932842f, 0.5555702330f, 0.4713967368f, 0.3826834324f, 0.2902846773f, + 0.1950903220f, 0.0980171403f, 0.0000000000f, -0.0980171403f, -0.1950903220f, -0.2902846773f, -0.3826834324f, + -0.4713967368f, -0.5555702330f, -0.6343932842f, -0.7071067812f, -0.7730104534f, -0.8314696123f, -0.8819212643f, + -0.9238795325f, -0.9569403357f, -0.9807852804f, -0.9951847267f, -1.0000000000f, -0.9951847267f, -0.9807852804f, + -0.9569403357f, -0.9238795325f, -0.8819212643f, -0.8314696123f, -0.7730104534f, -0.7071067812f, -0.6343932842f, + -0.5555702330f, -0.4713967368f, -0.3826834324f, -0.2902846773f, -0.1950903220f, -0.0980171403f}; + + LC3_FLOAT temp1[64], temp2[64]; + LC3_INT i; + + for (i = 0; i < 32; i++) { + temp1[2 * i] = vec[4 * i]; + temp1[2 * i + 1] = vec[4 * i + 1]; + temp2[2 * i] = vec[4 * i + 2]; + temp2[2 * i + 1] = vec[4 * i + 3]; + } + + fft32(temp1); + fft32(temp2); + + for (i = 0; i < 32; i++) { + LC3_FLOAT re, im, wre, wim, tre, tim; + + re = temp2[2 * i]; + im = temp2[2 * i + 1]; + + wre = w[i]; + wim = w[i + 16]; + + tre = re * wre - im * wim; + tim = re * wim + im * wre; + + vec[2 * i] = temp1[2 * i] + tre; + vec[2 * i + 1] = temp1[2 * i + 1] + tim; + vec[2 * i + 64] = temp1[2 * i] - tre; + vec[2 * i + 65] = temp1[2 * i + 1] - tim; + } +} + +static void fft128(LC3_FLOAT* vec) +{ + const LC3_FLOAT w[] = { + 1.0000000000f, 0.9987954562f, 0.9951847267f, 0.9891765100f, 0.9807852804f, 0.9700312532f, 0.9569403357f, + 0.9415440652f, 0.9238795325f, 0.9039892931f, 0.8819212643f, 0.8577286100f, 0.8314696123f, 0.8032075315f, + 0.7730104534f, 0.7409511254f, 0.7071067812f, 0.6715589548f, 0.6343932842f, 0.5956993045f, 0.5555702330f, + 0.5141027442f, 0.4713967368f, 0.4275550934f, 0.3826834324f, 0.3368898534f, 0.2902846773f, 0.2429801799f, + 0.1950903220f, 0.1467304745f, 0.0980171403f, 0.0490676743f, 0.0000000000f, -0.0490676743f, -0.0980171403f, + -0.1467304745f, -0.1950903220f, -0.2429801799f, -0.2902846773f, -0.3368898534f, -0.3826834324f, -0.4275550934f, + -0.4713967368f, -0.5141027442f, -0.5555702330f, -0.5956993045f, -0.6343932842f, -0.6715589548f, -0.7071067812f, + -0.7409511254f, -0.7730104534f, -0.8032075315f, -0.8314696123f, -0.8577286100f, -0.8819212643f, -0.9039892931f, + -0.9238795325f, -0.9415440652f, -0.9569403357f, -0.9700312532f, -0.9807852804f, -0.9891765100f, -0.9951847267f, + -0.9987954562f, -1.0000000000f, -0.9987954562f, -0.9951847267f, -0.9891765100f, -0.9807852804f, -0.9700312532f, + -0.9569403357f, -0.9415440652f, -0.9238795325f, -0.9039892931f, -0.8819212643f, -0.8577286100f, -0.8314696123f, + -0.8032075315f, -0.7730104534f, -0.7409511254f, -0.7071067812f, -0.6715589548f, -0.6343932842f, -0.5956993045f, + -0.5555702330f, -0.5141027442f, -0.4713967368f, -0.4275550934f, -0.3826834324f, -0.3368898534f, -0.2902846773f, + -0.2429801799f, -0.1950903220f, -0.1467304745f, -0.0980171403f, -0.0490676743f, + }; + + LC3_FLOAT temp1[128], temp2[128]; + LC3_INT i; + + for (i = 0; i < 64; i++) { + temp1[2 * i] = vec[4 * i]; + temp1[2 * i + 1] = vec[4 * i + 1]; + temp2[2 * i] = vec[4 * i + 2]; + temp2[2 * i + 1] = vec[4 * i + 3]; + } + + fft64(temp1); + fft64(temp2); + + for (i = 0; i < 64; i++) { + LC3_FLOAT re, im, wre, wim, tre, tim; + + re = temp2[2 * i]; + im = temp2[2 * i + 1]; + + wre = w[i]; + wim = w[i + 32]; + + tre = re * wre - im * wim; + tim = re * wim + im * wre; + + vec[2 * i] = temp1[2 * i] + tre; + vec[2 * i + 1] = temp1[2 * i + 1] + tim; + vec[2 * i + 128] = temp1[2 * i] - tre; + vec[2 * i + 129] = temp1[2 * i + 1] - tim; + } +} diff --git a/lc3plus/fft/fft_generic.h b/lc3plus/fft/fft_generic.h new file mode 100755 index 0000000000..e517ffb250 --- /dev/null +++ b/lc3plus/fft/fft_generic.h @@ -0,0 +1,699 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/* guard against unindended includes */ +#ifndef INCLUDED_FROM_IISFFT_C +#error "this file must not be included" +#endif + +#define FFT_INTERNAL_TRIG_PREC double +#define BORDER_FOR_SECOND_SCRATCH 100 + +static const LC3_INT primeFactors[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 0}; + +/* fft, returns 1 if length is supported and fft was applied */ +static LC3_INT fft_n(LC3_FLOAT* x, LC3_INT length) +{ + switch (length) { + case 2: + fft2(x); + return 1; + case 3: + fft3(x); + return 1; + case 4: + fft4(x); + return 1; + case 5: + fft5(x); + return 1; + case 8: + fft8(x); + return 1; + case 9: + fft9(x); + return 1; + case 15: + fft15(x); + return 1; + case 16: + fft16(x); + return 1; + case 32: + fft32(x); + return 1; + case 60: + fft60(x); + return 1; + case 64: + fft64(x); + return 1; + case 128: + fft128(x); + return 1; + case 240: + fft240(x); + return 1; + case 256: + LC3_cfft(x, x + 1, 256, 2, -1); + return 1; + case 384: + fft384(x); + return 1; + case 480: + fft480(x); + return 1; + case 512: + LC3_cfft(x, x + 1, 512, 2, -1); + return 1; + case 1024: + LC3_cfft(x, x + 1, 1024, 2, -1); + return 1; + default: + return 0; + } +} + + +/* returns 1 on success or 0 if IISFFT_MAXFACTORS is too small */ +static LC3_INT factorize(LC3_INT length, LC3_INT* restrict numFactors, LC3_INT* restrict factor, + LC3_INT* restrict isPrime) +{ + LC3_INT remainder = length; + LC3_INT idx = 0, cnt = 0; + LC3_INT actFac = primeFactors[idx]; + LC3_INT inc = 0; + + *numFactors = 0; + + while (remainder > 1 && actFac != 0) { + if (remainder % actFac == 0) { + if (inc == 0) { + inc = 1; + (*numFactors)++; + } + remainder /= actFac; + } else { + actFac = primeFactors[++idx]; + inc = 0; + } + } + if (remainder > 1) { + (*numFactors)++; + } + + if (*numFactors > IISFFT_MAXFACTORS) + return 0; + + idx = 0, cnt = 0, inc = 0; + remainder = length; + actFac = primeFactors[idx]; + (factor)[cnt] = 1; + while (remainder > 1 && actFac != 0) { + if (remainder % actFac == 0) { + (factor)[cnt] *= actFac; + remainder /= actFac; + inc = 1; + if (factor[cnt] == actFac) { /* first appearance of the factor */ + isPrime[cnt] = 1; + } else { + isPrime[cnt] = 0; + } + } else { + actFac = primeFactors[++idx]; + if (inc == 1) { + cnt++; + } + inc = 0; + (factor)[cnt] = 1; + } + } + if (remainder > 1) { + factor[cnt] = remainder; + } + return 1; +} + +static void oddFFT(LC3_FLOAT* restrict x, LC3_INT length, LC3_FLOAT* restrict scratch) +{ + LC3_INT i, k, n; + LC3_FLOAT * src1, *src2, *dest1, *dest2; + FFT_INTERNAL_TRIG_PREC sinValOrg, cosValOrg; + + dest1 = scratch + 1; + dest2 = scratch + length + 1; + src1 = x + 2; + src2 = x + 2 * length - 1; + + scratch[0] = x[0]; + scratch[length] = x[1]; + + for (i = 2; i < length; i += 2) { + LC3_FLOAT tmp1R, tmp1I, tmp2R, tmp2I; + tmp1R = *src1++; + tmp1I = *src1++; + tmp2I = *src2--; + tmp2R = *src2--; + *dest1++ = tmp1R + tmp2R; + *dest1++ = tmp1R - tmp2R; + *dest2++ = tmp1I + tmp2I; + *dest2++ = tmp1I - tmp2I; + + x[0] += tmp1R + tmp2R; + x[1] += tmp1I + tmp2I; + } + + dest1 = x + 2; + dest2 = x + 2 * length - 2; + for (k = 2; k < length; k += 2) { + FFT_INTERNAL_TRIG_PREC sinVal = 0, cosVal = 1; + cosValOrg = LC3_COS(-M_PIl * k / length); + sinValOrg = LC3_SIN(-M_PIl * k / length); + + *dest1 = *dest2 = scratch[0]; + *(dest1 + 1) = *(dest2 + 1) = scratch[length]; + + src1 = scratch + 1; + src2 = scratch + length + 1; + + for (n = 2; n < length; n += 2) { + LC3_FLOAT rePre, reMre, imPim, imMim; + /* + cos(x+y) = cox(x) cos(y) - sin(x) sin(y); + sin(x+y) = sin(x) cos(y) + cos(x) sin(y); + */ + FFT_INTERNAL_TRIG_PREC tmp = cosVal * cosValOrg - sinVal * sinValOrg; + sinVal = sinVal * cosValOrg + cosVal * sinValOrg; + cosVal = tmp; + + rePre = *src1++; + reMre = *src1++; + imPim = *src2++; + imMim = *src2++; + + *dest1 += (LC3_FLOAT)cosVal * rePre - (LC3_FLOAT)sinVal * imMim; + *(dest1 + 1) += (LC3_FLOAT)sinVal * reMre + (LC3_FLOAT)cosVal * imPim; + *dest2 += (LC3_FLOAT)cosVal * rePre + (LC3_FLOAT)sinVal * imMim; + *(dest2 + 1) += (LC3_FLOAT)-sinVal * reMre + (LC3_FLOAT)cosVal * imPim; + } + dest1 += 2; + dest2 -= 2; + } +} + +static LC3_INT findInverse(LC3_INT a, LC3_INT b) +{ + LC3_INT b0 = b, t, q; + LC3_INT x0 = 0, x1 = 1; + + if (b == 1) { + return 1; + } + + while (a > 1) { + q = a / b; + t = b, b = a % b, a = t; + t = x0, x0 = x1 - q * x0, x1 = t; + } + + if (x1 < 0) { + x1 += b0; + } + + return x1; +} + +static LC3_INT getGeneratorStupid(LC3_INT groupLength) +{ + LC3_INT generator = 2; /* start value */ + LC3_INT count = 1, number = generator; + + while (generator < 100) { /* hopefully the generator is smaller than 100 */ + while (number != 1) { + number = (number * generator) % groupLength; + count++; + } + if (count == groupLength - 1) { + return generator; + } else { + generator++; + count = 1; + number = generator; + } + } + + return -1; +} + +static LC3_INT getGenerator(LC3_INT groupLength) +{ + LC3_INT generator = 2; /* start value */ + LC3_INT count, number, factorCount, found, count2; + LC3_INT factors[16] = {0}; + + /* factorize: only for a group length with factors < 300 */ + factorCount = 0; + number = groupLength - 1; + found = 0; + count = 0; + while (number != 1) { + if (primeFactors[count] == 0) { + /* Not all factors listed */ + return getGeneratorStupid(groupLength); + } + if (number % primeFactors[count] == 0) { + number /= primeFactors[count]; + if (found == 0) { + factors[factorCount++] = primeFactors[count]; + found = 1; + } + } else { + count++; + found = 0; + } + } + + for (count = 0; factors[count] != 0; count++) { + factors[count] = (groupLength - 1) / factors[count]; + } + + /* calculate generator */ + number = generator; + count = 0; + while (factors[count] != 0) { + for (count2 = 0; count2 < factors[count] - 1; count2++) { + number = (number * generator) % groupLength; + } + if (number != 1) { + count++; + number = generator; + if (factors[count] == 0) { + return generator; + } + } else { + count = 0; + generator++; + number = generator; + } + } + + return -1; +} + +static void primeFFT(LC3_FLOAT* restrict x, LC3_INT length, LC3_FLOAT* restrict scratch, LC3_INT* restrict scratch2) +{ + LC3_INT i, k, middle = (length - 1) / 2; + LC3_FLOAT *src1, *src2, *dest1, *dest2; + LC3_INT * mapping, *map; + LC3_INT generator; + + LC3_INT mappingTable[25][97] = { + {0, 2}, + {0, 2, 4}, + {0, 2, 4, 8, 6}, + {0, 2, 6, 4, 12, 8, 10}, + {0, 2, 4, 8, 16, 10, 20, 18, 14, 6, 12}, + {0, 2, 4, 8, 16, 6, 12, 24, 22, 18, 10, 20, 14}, + {0, 2, 6, 18, 20, 26, 10, 30, 22, 32, 28, 16, 14, 8, 24, 4, 12}, + {0, 2, 4, 8, 16, 32, 26, 14, 28, 18, 36, 34, 30, 22, 6, 12, 24, 10, 20}, + {0, 2, 10, 4, 20, 8, 40, 16, 34, 32, 22, 18, 44, 36, 42, 26, 38, 6, 30, 12, 14, 24, 28}, + {0, 2, 4, 8, 16, 32, 6, 12, 24, 48, 38, 18, 36, 14, 28, 56, 54, 50, 42, 26, 52, 46, 34, 10, 20, 40, 22, 44, 30}, + {0, 2, 6, 18, 54, 38, 52, 32, 34, 40, 58, 50, 26, 16, 48, 20, + 60, 56, 44, 8, 24, 10, 30, 28, 22, 4, 12, 36, 46, 14, 42}, + {0, 2, 4, 8, 16, 32, 64, 54, 34, 68, 62, 50, 26, 52, 30, 60, 46, 18, 36, + 72, 70, 66, 58, 42, 10, 20, 40, 6, 12, 24, 48, 22, 44, 14, 28, 56, 38}, + {0, 2, 12, 72, 22, 50, 54, 78, 58, 20, 38, 64, 56, 8, 48, 42, 6, 36, 52, 66, 68, + 80, 70, 10, 60, 32, 28, 4, 24, 62, 44, 18, 26, 74, 34, 40, 76, 46, 30, 16, 14}, + {0, 2, 6, 18, 54, 76, 56, 82, 74, 50, 64, 20, 60, 8, 24, 72, 44, 46, 52, 70, 38, 28, + 84, 80, 68, 32, 10, 30, 4, 12, 36, 22, 66, 26, 78, 62, 14, 42, 40, 34, 16, 48, 58}, + {0, 2, 10, 50, 62, 28, 46, 42, 22, 16, 80, 24, 26, 36, 86, 54, 82, 34, 76, 4, 20, 6, 30, 56, + 92, 84, 44, 32, 66, 48, 52, 72, 78, 14, 70, 68, 58, 8, 40, 12, 60, 18, 90, 74, 88, 64, 38}, + {0, 2, 4, 8, 16, 32, 64, 22, 44, 88, 70, 34, 68, 30, 60, 14, 28, 56, 6, 12, 24, 48, 96, 86, 66, 26, 52, + 104, 102, 98, 90, 74, 42, 84, 62, 18, 36, 72, 38, 76, 46, 92, 78, 50, 100, 94, 82, 58, 10, 20, 40, 80, 54}, + {0, 2, 4, 8, 16, 32, 64, 10, 20, 40, 80, 42, 84, 50, 100, 82, 46, 92, 66, 14, + 28, 56, 112, 106, 94, 70, 22, 44, 88, 58, 116, 114, 110, 102, 86, 54, 108, 98, 78, 38, + 76, 34, 68, 18, 36, 72, 26, 52, 104, 90, 62, 6, 12, 24, 48, 96, 74, 30, 60}, + {0, 2, 4, 8, 16, 32, 64, 6, 12, 24, 48, 96, 70, 18, 36, 72, 22, 44, 88, 54, 108, + 94, 66, 10, 20, 40, 80, 38, 76, 30, 60, 120, 118, 114, 106, 90, 58, 116, 110, 98, 74, 26, + 52, 104, 86, 50, 100, 78, 34, 68, 14, 28, 56, 112, 102, 82, 42, 84, 46, 92, 62}, + {0, 2, 4, 8, 16, 32, 64, 128, 122, 110, 86, 38, 76, 18, 36, 72, 10, 20, 40, 80, 26, 52, 104, + 74, 14, 28, 56, 112, 90, 46, 92, 50, 100, 66, 132, 130, 126, 118, 102, 70, 6, 12, 24, 48, 96, 58, + 116, 98, 62, 124, 114, 94, 54, 108, 82, 30, 60, 120, 106, 78, 22, 44, 88, 42, 84, 34, 68}, + {0, 2, 14, 98, 118, 116, 102, 4, 28, 54, 94, 90, 62, 8, 56, 108, 46, 38, 124, 16, 112, 74, 92, 76, + 106, 32, 82, 6, 42, 10, 70, 64, 22, 12, 84, 20, 140, 128, 44, 24, 26, 40, 138, 114, 88, 48, 52, 80, + 134, 86, 34, 96, 104, 18, 126, 30, 68, 50, 66, 36, 110, 60, 136, 100, 132, 72, 78, 120, 130, 58, 122}, + {0, 2, 10, 50, 104, 82, 118, 6, 30, 4, 20, 100, 62, 18, 90, 12, 60, 8, 40, + 54, 124, 36, 34, 24, 120, 16, 80, 108, 102, 72, 68, 48, 94, 32, 14, 70, 58, 144, + 136, 96, 42, 64, 28, 140, 116, 142, 126, 46, 84, 128, 56, 134, 86, 138, 106, 92, 22, + 110, 112, 122, 26, 130, 66, 38, 44, 74, 78, 98, 52, 114, 132, 76, 88}, + {0, 2, 6, 18, 54, 4, 12, 36, 108, 8, 24, 72, 58, 16, 48, 144, 116, 32, 96, 130, + 74, 64, 34, 102, 148, 128, 68, 46, 138, 98, 136, 92, 118, 38, 114, 26, 78, 76, 70, 52, + 156, 152, 140, 104, 154, 146, 122, 50, 150, 134, 86, 100, 142, 110, 14, 42, 126, 62, 28, 84, + 94, 124, 56, 10, 30, 90, 112, 20, 60, 22, 66, 40, 120, 44, 132, 80, 82, 88, 106}, + {0, 2, 4, 8, 16, 32, 64, 128, 90, 14, 28, 56, 112, 58, 116, 66, 132, 98, 30, 60, 120, + 74, 148, 130, 94, 22, 44, 88, 10, 20, 40, 80, 160, 154, 142, 118, 70, 140, 114, 62, 124, 82, + 164, 162, 158, 150, 134, 102, 38, 76, 152, 138, 110, 54, 108, 50, 100, 34, 68, 136, 106, 46, 92, + 18, 36, 72, 144, 122, 78, 156, 146, 126, 86, 6, 12, 24, 48, 96, 26, 52, 104, 42, 84}, + {0, 2, 6, 18, 54, 162, 130, 34, 102, 128, 28, 84, 74, 44, 132, 40, 120, 4, + 12, 36, 108, 146, 82, 68, 26, 78, 56, 168, 148, 88, 86, 80, 62, 8, 24, 72, + 38, 114, 164, 136, 52, 156, 112, 158, 118, 176, 172, 160, 124, 16, 48, 144, 76, 50, + 150, 94, 104, 134, 46, 138, 58, 174, 166, 142, 70, 32, 96, 110, 152, 100, 122, 10, + 30, 90, 92, 98, 116, 170, 154, 106, 140, 64, 14, 42, 126, 22, 66, 20, 60}, + {0, 2, 10, 50, 56, 86, 42, 16, 80, 12, 60, 106, 142, 128, 58, 96, 92, 72, 166, 54, + 76, 186, 154, 188, 164, 44, 26, 130, 68, 146, 148, 158, 14, 70, 156, 4, 20, 100, 112, 172, + 84, 32, 160, 24, 120, 18, 90, 62, 116, 192, 184, 144, 138, 108, 152, 178, 114, 182, 134, 88, + 52, 66, 136, 98, 102, 122, 28, 140, 118, 8, 40, 6, 30, 150, 168, 64, 126, 48, 46, 36, + 180, 124, 38, 190, 174, 94, 82, 22, 110, 162, 34, 170, 74, 176, 104, 132, 78}}; + + if (length < BORDER_FOR_SECOND_SCRATCH) { + for (i = 1;; i++) { + if (primeFactors[i] == length) { + mapping = mappingTable[i]; + break; + } + assert(primeFactors[i] != 0); + } + } else { + mapping = scratch2; + + /* get primitive root */ + generator = getGenerator(length); + assert(generator != -1); + + /* init mapping */ + mapping[0] = 0; + mapping[1] = 1; + for (i = 2; i < length; i++) { + mapping[i] = mapping[i - 1] * generator; + if (mapping[i] > length - 1) { + mapping[i] = (mapping[i] % length - 1) + 1; + } + } + + /* double mapping value */ + for (i = 1; i < length; i++) { + mapping[i] *= 2; + } + } + + /* remap input to scratch */ + scratch[0] = x[0]; + scratch[1] = x[1]; + scratch[2] = x[2]; + scratch[3] = x[3]; + map = mapping + length - 1; + for (i = 4; i < 2 * length; map--) { + scratch[i++] = x[(*map)]; + scratch[i++] = x[(*map) + 1]; + } + + /* print sums and diffs into scratch by using symmetry */ + x[length] = x[1]; /* imaginary und real part */ + dest1 = x + 1; + dest2 = x + length + 1; + src1 = scratch + 2; + src2 = scratch + length + 1; + + for (i = 2; i < length; i += 2) { + LC3_FLOAT tmp1R, tmp1I, tmp2R, tmp2I; + tmp1R = *src1++; + tmp1I = *src1++; + tmp2R = *src2++; + tmp2I = *src2++; + *dest1++ = tmp1R + tmp2R; + *dest1++ = tmp1R - tmp2R; + *dest2++ = tmp1I + tmp2I; + *dest2++ = tmp1I - tmp2I; + + scratch[0] += tmp1R + tmp2R; + scratch[1] += tmp1I + tmp2I; + } + + /* init with values from the first column */ + dest1 = scratch + 2; + for (i = 1; i < length; i++) { + *dest1++ = x[0]; /* add real part of x(0)(factor = 1) */ + *dest1++ = x[length]; /* add imaginary part of x(0)(factor = 1) */ + } + + for (k = 1; k <= middle; k++) { + /* loop through all cos/sin values */ + LC3_FLOAT sinVal, cosVal; + LC3_INT length1, length2; + LC3_FLOAT rePre, reMre, imPim, imMim; + + cosVal = (LC3_FLOAT)LC3_COS(-M_PIl * mapping[k] / length); + sinVal = (LC3_FLOAT)LC3_SIN(-M_PIl * mapping[k] / length); + + /* compute in two parts (length1, length2) to avoid if() in for loop */ + length1 = middle - k + 1; + length2 = middle - length1; + src1 = x + 1; + src2 = x + length + 1; + dest1 = scratch + 2 * k; + dest2 = scratch + 2 * (middle + k); + + for (i = 0; i < length1; i++) { + rePre = *src1++; + reMre = *src1++; + imPim = *src2++; + imMim = *src2++; + + *dest1++ += cosVal * rePre - sinVal * imMim; + *dest1++ += cosVal * imPim + sinVal * reMre; + + *dest2++ += cosVal * rePre + sinVal * imMim; + *dest2++ += cosVal * imPim - sinVal * reMre; + } + if (dest2 == scratch + 2 * length) { + dest2 = scratch + 2; + } + for (i = 0; i < length2; i++) { + rePre = *src1++; + reMre = *src1++; + imPim = *src2++; + imMim = *src2++; + + *dest1++ += cosVal * rePre - sinVal * imMim; + *dest1++ += cosVal * imPim + sinVal * reMre; + + *dest2++ += cosVal * rePre + sinVal * imMim; + *dest2++ += cosVal * imPim - sinVal * reMre; + } + } + + /* remap output to x */ + x[0] = scratch[0]; + x[1] = scratch[1]; + map = mapping + 1; + for (i = 2; i < 2 * length; map++) { + x[(*map)] = scratch[i++]; + x[(*map) + 1] = scratch[i++]; + } +} + +static void nextFFT(LC3_FLOAT* x, LC3_INT length, LC3_FLOAT* scratch) +{ + if (fft_n(x, length)) /* have function for length */ + return; + + assert(length % 2 != 0); + oddFFT(x, length, scratch); +} + +static inline LC3_INT findFactor(const LC3_INT length) +{ + static const LC3_INT factors[] = {16, 9, 8, 7, 5, 4, 3, 2, 0}; + LC3_INT i = 0, factor = 0; + for (i = 0; factors[i] != 0; i++) { + if (length % factors[i] == 0) { + factor = factors[i]; + break; + } + } + return factor; +} + +static inline void twiddle(LC3_FLOAT* x, const LC3_INT length, const LC3_INT n1, const LC3_INT n2) +{ + LC3_INT i, ii; + FFT_INTERNAL_TRIG_PREC sinValOrg, cosValOrg; + FFT_INTERNAL_TRIG_PREC sinVal = 0, cosVal = 1; + FFT_INTERNAL_TRIG_PREC twReal = 0, twImag = 1; + + cosValOrg = LC3_COS(-2 * (LC3_FLOAT)M_PIl / length); + sinValOrg = LC3_SIN(-2 * (LC3_FLOAT)M_PIl / length); + + for (i = 1; i < n1; i++) { + FFT_INTERNAL_TRIG_PREC tmp = 0.; + twReal = 1; + twImag = 0; + + tmp = cosVal * cosValOrg - sinVal * sinValOrg; + sinVal = sinVal * cosValOrg + cosVal * sinValOrg; + cosVal = tmp; + + for (ii = 1; ii < n2; ii++) { + LC3_FLOAT xRe, xIm; + FFT_INTERNAL_TRIG_PREC tmpReal; + + tmpReal = twReal * cosVal - twImag * sinVal; + twImag = twImag * cosVal + sinVal * twReal; + twReal = tmpReal; + + xRe = x[2 * (i * n2 + ii)]; + xIm = x[2 * (i * n2 + ii) + 1]; + + x[2 * (i * n2 + ii)] = (LC3_FLOAT)twReal * xRe - (LC3_FLOAT)twImag * xIm; + x[2 * (i * n2 + ii) + 1] = (LC3_FLOAT)twImag * xRe + (LC3_FLOAT)twReal * xIm; + } + } +} + +static void cooleyTukeyFFT(LC3_FLOAT* restrict x, const LC3_INT length, LC3_FLOAT* restrict scratch, + LC3_INT* restrict scratch2, LC3_INT isPrime) +{ + LC3_INT factor; + LC3_INT i, ii; + LC3_INT n1, n2; + LC3_INT cnt = 0; + LC3_FLOAT *src, *dest; + + if (fft_n(x, length)) + return; + + factor = findFactor(length); + if (factor > 0 && (length / factor > 1)) { + n1 = factor; + n2 = length / factor; + + /* DATA Resorting for stage1 */ + dest = scratch; + for (i = 0; i < 2 * n1; i += 2) { + src = x + i; + for (ii = 0; ii < n2; ii++) { + /* *dest++ = x[2*(i+ii*n1)]; */ + /* *dest++ = x[2*(i+ii*n1)+1]; */ + *dest++ = *src; + *dest++ = *(src + 1); + src += 2 * n1; + } + } + src = scratch; + dest = x; + for (i = 0; i < length; i++) { + *dest++ = *src++; + *dest++ = *src++; + } + /* perform n1 ffts of length n2 */ + for (i = 0; i < n1; i++) { + cooleyTukeyFFT(x + 2 * i * n2, n2, scratch + 2 * i * n2, scratch2, isPrime); + } + /*data twiddeling */ + twiddle(x, length, n1, n2); + /* DATA Resorting for stage2 */ + cnt = 0; + for (i = 0; i < n2; i++) { + for (ii = 0; ii < n1; ii++) { + scratch[2 * cnt] = x[2 * (i + ii * n2)]; + scratch[2 * cnt + 1] = x[2 * (i + ii * n2) + 1]; + cnt++; + } + } + /* perform n2 ffts of length n1 */ + for (i = 0; i < n2; i++) { + nextFFT(scratch + 2 * i * n1, n1, x + 2 * i * n1); + } + cnt = 0; + for (i = 0; i < n1; i++) { + for (ii = 0; ii < n2; ii++) { + x[2 * cnt] = scratch[2 * (i + ii * n1)]; + x[2 * cnt + 1] = scratch[2 * (i + ii * n1) + 1]; + cnt++; + } + } + } else { + if (isPrime == 1 && length > 23) { + primeFFT(x, length, scratch, scratch2); + } else { + oddFFT(x, length, scratch); + } + } +} + +static void pfaDFT(LC3_FLOAT* restrict x, const LC3_INT length, LC3_FLOAT* restrict scratch1, const LC3_INT numFactors, + const LC3_INT* const factor, LC3_INT* restrict scratch2, const LC3_INT* const isPrime) +{ + LC3_FLOAT* tmp = scratch1; + LC3_INT i, ii, n1, n2, idx, incr, cnt; + LC3_INT n1_inv = 1; + + if (numFactors <= 1) { + cooleyTukeyFFT(x, length, scratch1, scratch2, isPrime[0]); + return; + } + + n2 = factor[0]; + n1 = length / n2; + + n1_inv = findInverse(n1, n2); + + idx = 0; + incr = n1 * n1_inv; + cnt = 0; + for (i = 0; i < n1; i++) { + for (ii = 0; ii < n2 - 1; ii++) { + tmp[cnt++] = x[2 * idx]; + tmp[cnt++] = x[2 * idx + 1]; + + idx += incr; + if (idx > length) { + idx -= length; + } + } + tmp[cnt++] = x[2 * idx]; + tmp[cnt++] = x[2 * idx + 1]; + idx++; + } + + for (cnt = 0; cnt < length; cnt += n2) { + cooleyTukeyFFT(tmp + 2 * cnt, n2, x + 2 * cnt, scratch2, isPrime[0]); + } + for (cnt = 0; cnt < n1; cnt++) { + for (i = 0; i < n2; i++) { + x[2 * (cnt + i * n1)] = tmp[2 * (cnt * n2 + i)]; + x[2 * (cnt + i * n1) + 1] = tmp[2 * (cnt * n2 + i) + 1]; + } + } + for (cnt = 0; cnt < length; cnt += n1) { + pfaDFT(x + 2 * cnt, n1, tmp, numFactors - 1, &factor[1], scratch2, &isPrime[1]); + } + + cnt = 0; + for (i = 0; i < n2; i++) { + idx = i * n1; + for (ii = 0; ii < n1; ii++) { + tmp[2 * idx] = x[cnt++]; + tmp[2 * idx + 1] = x[cnt++]; + idx += n2; + if (idx > length) { + idx -= length; + } + } + } + + for (cnt = 0; cnt < length; cnt++) { + x[2 * cnt] = tmp[2 * cnt]; + x[2 * cnt + 1] = tmp[2 * cnt + 1]; + } +} diff --git a/lc3plus/fft/iis_fft.c b/lc3plus/fft/iis_fft.c new file mode 100755 index 0000000000..b1f8ab5ab8 --- /dev/null +++ b/lc3plus/fft/iis_fft.c @@ -0,0 +1,164 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include +#include +#include +#include +#include +#include + +#include "iis_fft.h" +/**************************************************************************************************/ + +/* AFFT uses two fft implementations + * cfft is used for lengths of power of two, >= 256. + * iisfft is used for everything else. it is optimized for certain lengths. for a list of + fast lengths, check the fft_n function. +*/ + + +#define FFT_COMPLEX 1 +#define FFT_REAL 2 + + +static IIS_FFT_ERROR create(HANDLE_IIS_FFT* handle, LC3_INT type, LC3_INT len, IIS_FFT_DIR sign) +{ + IIS_FFT_ERROR err = IIS_FFT_MEMORY_ERROR; + + /* for real transforms the actual performed fft is half length */ + LC3_INT trlen = (type == FFT_COMPLEX) ? len : len / 2; + + /* check argument sanity */ + if (sign != IIS_FFT_FWD && sign != IIS_FFT_BWD) + return IIS_FFT_INTERNAL_ERROR; + + + if (!(*handle)) + (*handle) = (HANDLE_IIS_FFT)calloc(1, sizeof(IIS_FFT)); + if (!(*handle)) + return IIS_FFT_MEMORY_ERROR; + + (*handle)->len = len; + (*handle)->sign = sign; + + /* create sine lookup table for real ffts */ + if (type == FFT_REAL) + { + LC3_create_sine_table(len, (*handle)->sine_table); + if (!(*handle)->sine_table) + { + goto handle_error1; + } + } + + /* set default cfft_plan to 0(length). (and default iisfft_plan to zero length) */ + (*handle)->cfft.len = 0; /* 0 length means that cfft should not be called */ + (*handle)->iisfft.length = 0; /*saftey setting for iisfft length struct */ + + /* use cfft for legth of power two larger than 256. for length below iisfft is faster */ + if (trlen >= 256 && CFFT_PLAN_SUPPORT(trlen)) { + LC3_INT s = (type == FFT_REAL) ? IIS_FFT_FWD : sign; + err = LC3_cfft_plan(&(*handle)->cfft, trlen, s) ? IIS_FFT_NO_ERROR : IIS_FFT_INTERNAL_ERROR; + } else { + LC3_INT s = (type == FFT_REAL) ? IIS_FFT_FWD : sign; + err = LC3_iisfft_plan(&(*handle)->iisfft, trlen, s); + } + + return IIS_FFT_NO_ERROR; + +handle_error1: + free((*handle)); + + return err; +} + +IIS_FFT_ERROR LC3_IIS_RFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT32 len, IIS_FFT_DIR sign) +{ + return create(handle, FFT_REAL, len, sign); +} + +static IIS_FFT_ERROR destroy(HANDLE_IIS_FFT* handle) +{ + if (handle && *handle) { + LC3_iisfft_free(&(*handle)->iisfft); + LC3_cfft_free(&(*handle)->cfft); + free(*handle); + *handle = NULL; + } + return IIS_FFT_NO_ERROR; +} + +IIS_FFT_ERROR LC3_IIS_CFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT len, IIS_FFT_DIR sign) +{ + return create(handle, FFT_COMPLEX, len, sign); +} + + +IIS_FFT_ERROR LC3_IIS_xFFT_Destroy(HANDLE_IIS_FFT* handle) { return destroy(handle); } + +IIS_FFT_ERROR LC3_IIS_CFFT_Destroy(HANDLE_IIS_FFT* handle) { return destroy(handle); } + +static IIS_FFT_ERROR real_destroy(HANDLE_IIS_FFT* handle) +{ + if (handle && *handle) { + LC3_iisfft_free(&(*handle)->iisfft); + *handle = NULL; + } + return IIS_FFT_NO_ERROR; +} + +IIS_FFT_ERROR LC3_IIS_RFFT_Destroy(HANDLE_IIS_FFT* handle) { return real_destroy(handle); } + +IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output) +{ + LC3_FLOAT* dummy; + if (!handle) + return IIS_FFT_INTERNAL_ERROR; + + /* check for inplace operation */ + memmove(output, input, sizeof(*input) * handle->len); + dummy = (LC3_FLOAT*)output; + if (handle->cfft.len > 0) { + LC3_cfft_apply(&handle->cfft, dummy, dummy + 1, 2); + } else { + LC3_iisfft_apply(&handle->iisfft, dummy); + } + + return IIS_FFT_NO_ERROR; +} + + +IIS_FFT_ERROR LC3_IIS_FFT_Apply_RFFT(HANDLE_IIS_FFT handle, const LC3_FLOAT* in, LC3_FLOAT* out) +{ + if (!handle) { + return IIS_FFT_INTERNAL_ERROR; + } + + memmove(out, in, sizeof(LC3_FLOAT) * handle->len); + + if (handle->sign == IIS_FFT_BWD) { + LC3_rfft_pre(handle->sine_table, out, handle->len); + } + + if (handle->cfft.len > 0) { + LC3_cfft_apply(&handle->cfft, out, out + 1, 2); + } + else { + LC3_iisfft_apply(&handle->iisfft, out); + } + + if (handle->sign == IIS_FFT_FWD) { + LC3_rfft_post(handle->sine_table, out, handle->len); + } + + return IIS_FFT_NO_ERROR; +} diff --git a/lc3plus/fft/iis_fft.h b/lc3plus/fft/iis_fft.h new file mode 100755 index 0000000000..b658930fa7 --- /dev/null +++ b/lc3plus/fft/iis_fft.h @@ -0,0 +1,142 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef IIS_FFT_H +#define IIS_FFT_H + +#include "../structs.h" +#include "../defines.h" +#include "cfft.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/*! + * \brief n-point complex FFT + * + * There are optimized FFTs for lengths 2, 3, 4, 7, 8, 9, 15, 16, 32, 60, 64, 128, + * 240, 256, 384, 480, 512, 768, 1024. Other lengths below 1024 use a stack allocated + * buffer and offer reasonable speed. Above 1024 a buffer is allocated each time + * iis_fftf() is called resulting in reduced performance. + * + * >>>>>> DO NOT USE UNOPTIMIZED LENGTHS IN PRODUCTION CODE! <<<<<< + * + * \param[in,out] vec pointer to data, interleaved real / imaginary + * \param[in] length length of fft (number of real/imaginary pairs) + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_iis_fftf(LC3_FLOAT* vec, LC3_INT length); +/*! + * \brief n-point inverse complex FFT + * + * The output is not normalized. See iis_fftf() for optimized lengths. + * + * >>>>>> DO NOT USE UNOPTIMIZED LENGTHS IN PRODUCTION CODE! <<<<<< + * + * \param[in,out] vec pointer to data, interleaved real / imaginary + * \param[in] length length of fft (number of real/imaginary pairs) + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_iis_ifftf(LC3_FLOAT* vec, LC3_INT length); + +/*! + * \brief allocate and initialize a new real FFT instance. + * + * \param[in,out] handle pointer to FFT handle + * \param[in] len transform length, must be an even number + * \param[in] sign IIS_FFT_FWD(-1) for forward, IIS_FFT_BWD(1) for backward transform + * BEWARE OF THE SIGNS! + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_RFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT len, IIS_FFT_DIR sign); + +/*! + * \brief allocate and initialize a new complex FFT instance + * + * \param[in,out] handle pointer to FFT handle + * \param[in] len transform length + * \param[in] sign IIS_FFT_FWD(-1) for forward, IIS_FFT_BWD(1) for backward transform + * BEWARE OF THE SIGNS !!!!!! + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_CFFT_Create(HANDLE_IIS_FFT* handle, LC3_INT len, IIS_FFT_DIR sign); + +/*! + * \brief computes the forward or backward fourier transform of a real signal + * + * For complex data (in or out) the real part of the Nyquist band (len / 2 + 1) is stored + * in the imaginary part of the DC band (0). This allows for the complex data of + * real to complex transforms to fit into the same buffer. For this to work length must be even. + * + * Complex to real transforms are normalized (1.0/len). Input and ouput buffers may + *be identical. + * + * \param[in] handle FFT handle + * \param[in] in pointer to the input array containing real values for the forward transform (FFT) + * or packed complex values (Perm) for the backward transform (IFFT) + * \param[out] out pointer to the output array containing real values resulted from the backward transform + * (IFFT) or packed complex (perm) values reulted from the forward transform + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_FFT_Apply_RFFT(HANDLE_IIS_FFT handle, const LC3_FLOAT* in, LC3_FLOAT* out); + +/*! + * \brief compute complex backward or forward FFT + * + * Input and ouput buffers may be identical. Real/imaginary parts may be interleaved. + * The output is not normalized. + * + * \param[in] handle FFT handle + * \param[in] in_re pointer to the input array containing real parts of the signal for the + * forward transform (FFT) or for the backward transform (IFFT) + * \param[in] in_im pointer to the input array containing imaginary parts of the signal for + * the forward transform (FFT) or for the backward transform (IFFT) + * \param[out] out_re pointer to the output array containing real values resulted from the + * forward transform (FFT) or from the backward transform (IFFT) + * \param[out] out_im pointer to the output array containing imaginary values resulted from + * the forward transform (FFT) or from the backward transform (IFFT) + * + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output); + +/*! + * \brief deallocate a FFT instance (complex or real) + * \param[in,out] handle pointer to FFT handle, set to NULL if call succeeds + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_xFFT_Destroy(HANDLE_IIS_FFT* handle); + +/*! + * \brief deallocate a real FFT instance + * \param[in,out] handle pointer to FFT handle, set to NULL if call succeeds + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_RFFT_Destroy(HANDLE_IIS_FFT* handle); + +/*! + * \brief deallocate a complex FFT instance + * \param[in,out] handle pointer to FFT handle, set to NULL if call succeeds + * \return IIS_FFT_NO_ERROR on success + */ +IIS_FFT_ERROR LC3_IIS_CFFT_Destroy(HANDLE_IIS_FFT* handle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lc3plus/fft/iisfft.c b/lc3plus/fft/iisfft.c new file mode 100755 index 0000000000..227d2b6037 --- /dev/null +++ b/lc3plus/fft/iisfft.c @@ -0,0 +1,166 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" + +#include +#include /* for mmove */ +#include +#include +#include "iisfft.h" +#include "cfft.h" + +/* the fixed length fft functions have been split into sevelral headers to + have smaller files. to give the compiler more room to optimize the ffts + can't be in separate compilation units. the header approach seemed to be + the best compromise. to prevent them being included from anywhere else, + they are guarded by the INCLUDED_FROM_IISFFT_C macro. +*/ +#define INCLUDED_FROM_IISFFT_C +#include "fft_2_9.h" +#include "fft_15_16.h" +#include "fft_32.h" +#include "fft_60_128.h" +#include "fft_240_480.h" +#include "fft_384_768.h" +#include "fft_generic.h" + + +void LC3_iisfft_apply(Iisfft* handle, LC3_FLOAT* x) +{ + if (handle->sign == -1) { + if (!fft_n(x, handle->length)) + { + LC3_FLOAT scratch[2*MAX_LEN]; + pfaDFT(x, handle->length, scratch, handle->num_factors, handle->factors, handle->scratch2, + handle->isPrime); + } + } else { + assert(0); + } +} + +/* returns 1 if there is no specialized function for length or 1 if a scratch needs to be allocated. + check the fft_n function */ +static LC3_INT need_scratch(LC3_INT n) +{ + return n != 2 && n != 3 && n != 4 && n != 5 && n != 7 && n != 8 && n != 9 && n != 15 && n != 16 && n != 32 && + n != 60 && n != 64 && n != 128 && n != 192 && n != 240 && n != 256 && n != 384 && n != 480 && n != 512 && n != 768 && + n != 1024; +} + +IIS_FFT_ERROR LC3_iisfft_plan(Iisfft* handle, LC3_INT length, LC3_INT sign) +{ + memset(handle, 0, sizeof(Iisfft)); + if (length < 2) + return IIS_FFT_LENGTH_ERROR; + handle->length = length; + handle->sign = sign; + if (need_scratch(length)) { + /* only needed for prime numbers bigger than BORDER_FOR_SECOND_SCRATCH */ + LC3_INT i = 0; + LC3_INT lengthOfPrimeScratch = BORDER_FOR_SECOND_SCRATCH; + if (!factorize(length, &handle->num_factors, handle->factors, handle->isPrime)) + return IIS_FFT_LENGTH_ERROR; + /* create additional scratch for primeFFT() */ + for (i = 0; i < handle->num_factors; i++) { + if (handle->isPrime[i] == 1 && handle->factors[i] > lengthOfPrimeScratch) { + lengthOfPrimeScratch = handle->factors[i]; + } + } + if (lengthOfPrimeScratch > BORDER_FOR_SECOND_SCRATCH) { + handle->scratch2 = (LC3_INT*)malloc(sizeof(LC3_INT) * lengthOfPrimeScratch); + if (!handle->scratch2) + return IIS_FFT_MEMORY_ERROR; + } + } + + return IIS_FFT_NO_ERROR; +} + +void LC3_iisfft_free(Iisfft* handle) +{ + handle->length = 0; + if (handle->scratch2) + free(handle->scratch2); +} + + + +/* generate sine table needed by LC3_rfft_pre/rfft/post. the table must be freed with iisFree */ +void LC3_create_sine_table(LC3_INT32 len, LC3_FLOAT *sine_table) +{ + LC3_INT32 i; + + for (i = 0; i < len / 2 + 1; i++) { + sine_table[i] = (LC3_FLOAT)sin(2.0 * M_PIl * i / len); + } +} + +void LC3_rfft_post(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT32 len) +{ + LC3_FLOAT tmp1, tmp2, tmp3, tmp4, s, c; + LC3_INT32 i; + + tmp1 = buf[0] + buf[1]; + buf[1] = buf[0] - buf[1]; + buf[0] = tmp1; + + for (i = 1; i <= (len + 2) / 4; i++) { + s = sine_table[i]; /* sin(pi*i/(len/2)) */ + c = sine_table[i + len / 4]; /* cos(pi*i/(len/2)) */ + + tmp1 = buf[2 * i] - buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] + buf[len - 2 * i + 1]; + tmp3 = s * tmp1 - c * tmp2; /* real part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp4 = c * tmp1 + s * tmp2; /* imag part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp1 = buf[2 * i] + buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] - buf[len - 2 * i + 1]; + + buf[2 * i] = 0.5f * (tmp1 - tmp3); + buf[2 * i + 1] = 0.5f * (tmp2 - tmp4); + buf[len - 2 * i] = 0.5f * (tmp1 + tmp3); + buf[len - 2 * i + 1] = -0.5f * (tmp2 + tmp4); + } + + return; +} + +void LC3_rfft_pre(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT32 len) +{ + LC3_FLOAT scale ; + LC3_FLOAT tmp1, tmp2, tmp3, tmp4, s, c; + LC3_INT32 i; + + scale = 1.0f / len; /* constant */ + + tmp1 = buf[0] + buf[1]; + buf[1] = scale * (buf[0] - buf[1]); + buf[0] = scale * tmp1; + + for (i = 1; i <= (len + 2) / 4; i++) { + s = sine_table[i]; /* sin(pi*i/(len/2)) */ + c = sine_table[i + len / 4]; /* cos(pi*i/(len/2)) */ + + tmp1 = buf[2 * i] - buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] + buf[len - 2 * i + 1]; + tmp3 = s * tmp1 + c * tmp2; /* real part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp4 = -c * tmp1 + s * tmp2; /* imag part of j*W(k,N)*[T(k) - T'(N-k)] */ + tmp1 = buf[2 * i] + buf[len - 2 * i]; + tmp2 = buf[2 * i + 1] - buf[len - 2 * i + 1]; + + buf[2 * i] = scale * (tmp1 + tmp3); + buf[2 * i + 1] = -scale * (tmp2 + tmp4); + buf[len - 2 * i] = scale * (tmp1 - tmp3); + buf[len - 2 * i + 1] = scale * (tmp2 - tmp4); + } + return; +} + diff --git a/lc3plus/fft/iisfft.h b/lc3plus/fft/iisfft.h new file mode 100755 index 0000000000..7b448e2bbe --- /dev/null +++ b/lc3plus/fft/iisfft.h @@ -0,0 +1,86 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef IISFFT_H +#define IISFFT_H + +#include "../defines.h" + +#ifndef M_PIl +#define M_PIl 3.1415926535897932384626433832795029L /* pi */ +#endif + +/* compiler specific macros + + the restrict keyword only gives a improvelent if more than one pointers are + passed to a function. also note that the MSVC __restrict behaves differently + from c99, the restrict property is not transferred to aliases. + + alloca is a bit problematic because behavior is not defined in case of stack + overflow. most probably the program will crash. it might be possible to catch + those errors but it depends on compiler support. msvc has a safer _malloca + but gcc has nothing similar. */ +#if defined _MSC_VER || defined __INTEL_COMPILER +#include +#define ALLOCA(size) _alloca(size) +#define restrict __restrict +#define inline __inline +#elif defined __GNUC__ || defined __clang__ +#define ALLOCA(size) __builtin_alloca(size) +#define restrict __restrict__ +#define inline __inline +#elif defined __TI_COMPILER_VERSION__ +#include +#define ALLOCA(size) (assert(0 && "ALLOCA is not present for your compiler"), NULL) +#warn "no stack allocation for you compiler" +#else +#error "no stack allocation for your compiler" +#endif + + +#define IISFFT_MAXSTACKLENGTH 1024 +#define IISFFT_MAXFACTORS 10 + +typedef struct { + LC3_INT* scratch2; + LC3_INT length; + LC3_INT sign; + LC3_INT num_factors; + LC3_INT factors[IISFFT_MAXFACTORS]; + LC3_INT isPrime[IISFFT_MAXFACTORS]; +} Iisfft; + +typedef enum { + IIS_FFT_NO_ERROR = 0, + IIS_FFT_INTERNAL_ERROR, /**< a mystical error appeard */ + IIS_FFT_LENGTH_ERROR, /**< the requested fft length is not supported */ + IIS_FFT_MEMORY_ERROR /**< memory allocation failed */ +} IIS_FFT_ERROR; + +typedef enum { + IIS_FFT_FWD = -1, /**< forward transform */ + IIS_FFT_BWD = 1 /**< inverse / backward transform */ +} IIS_FFT_DIR; + +/* plan, apply and free forward / backward fft */ +IIS_FFT_ERROR LC3_iisfft_plan(Iisfft* handle, LC3_INT length, LC3_INT sign); +void LC3_iisfft_apply(Iisfft* handle, LC3_FLOAT* x); +void LC3_iisfft_free(Iisfft* handle); + +/* fft related helper functions */ +void LC3_create_sine_table(LC3_INT32 len, LC3_FLOAT *sine_table); + +void LC3_rfft_pre(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT len); +void LC3_rfft_post(const LC3_FLOAT* restrict sine_table, LC3_FLOAT* restrict buf, LC3_INT len); +void LC3_fftf_interleave(const LC3_FLOAT* restrict re, const LC3_FLOAT* restrict im, LC3_FLOAT* restrict out, + LC3_INT len); +void LC3_fftf_deinterleave(const LC3_FLOAT* restrict in, LC3_FLOAT* restrict re, LC3_FLOAT* restrict im, LC3_INT len); + +#endif /* IISFFT_H */ diff --git a/lc3plus/functions.h b/lc3plus/functions.h new file mode 100755 index 0000000000..7a529a25d7 --- /dev/null +++ b/lc3plus/functions.h @@ -0,0 +1,304 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef FUNCTIONS_H +#define FUNCTIONS_H + +#include "clib.h" +#include "defines.h" +#include "float.h" +#include "lc3.h" +#include "setup_dec_lc3.h" +#include "setup_enc_lc3.h" +#include "structs.h" +#include "util.h" + +/* FFT */ +#include "fft/iisfft.h" + +/* fft.c */ +void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle); +void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle); +void real_fft_apply(Fft* fft, const LC3_FLOAT* in, LC3_FLOAT* out); + +void fft_init(Fft* fft, LC3_INT length); +void fft_free(Fft* fft); +void real_fft_free(Fft* fft); +void fft_apply(Fft* fft, const Complex* input, Complex* output); + +/* dct.c */ +void dct2_init(Dct2* dct, LC3_INT length); +void dct2_free(Dct2* dct); +void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output); + +void dct3_init(Dct3* dct, LC3_INT length); +void dct3_free(Dct3* dct); +void dct3_apply(Dct3* dct, const LC3_FLOAT* input, LC3_FLOAT* output); + +void dct4_init(Dct4* dct, LC3_INT length); +void dct4_free(Dct4* dct); +void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output); + +/* mdct.c */ +void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC3_INT hrmode); +void mdct_free(Mdct* mdct); +void mdct_apply(const LC3_FLOAT* input, LC3_FLOAT* output, Mdct* mdct); + +#ifdef ENABLE_PADDING +LC3_INT paddingDec_fl(LC3_UINT8* bytes, LC3_INT nbbits, LC3_INT L_spec, LC3_INT bw_cutoff_bits, LC3_INT ep_enabled, LC3_INT* total_padding, LC3_INT *np_zero); +#endif + +void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, + LC3_INT bw_cutoff_idx, LC3_INT lastnz, LC3_INT N, LC3_INT lsbMode, LC3_INT gg_idx, LC3_INT num_tns_filters, + LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* scf_idx, LC3_INT fac_ns_idx + , LC3_INT bfi_ext, LC3_INT fs_idx + ); +void processDecoderEntropy_fl(LC3_UINT8* bytes, LC3_INT numbytes, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT N, LC3_INT fs_idx, + LC3_INT bw_cutoff_bits, LC3_INT* bfi, LC3_INT* gg_idx, LC3_INT* scf_idx, LC3_INT* fac_ns_idx, + LC3_INT* tns_numfilters, LC3_INT* tns_order, LC3_INT* ltpf_idx, LC3_INT* bw_cutoff_idx, LC3_INT* lastnz, + LC3_INT* lsbMode, LC3_INT frame_dms + ); +void processQuantizeSpec_fl(LC3_FLOAT x[], LC3_FLOAT gain, LC3_INT xq[], LC3_INT nt, LC3_INT totalBits, LC3_INT* nbits, LC3_INT* nbits2, LC3_INT fs, + LC3_INT* lastnzout, LC3_INT* codingdata, LC3_INT* lsbMode, LC3_INT mode, LC3_INT target, LC3_INT hrmode); + +void processEstimateGlobalGain_fl(LC3_FLOAT x[], LC3_INT lg, LC3_INT nbitsSQ, LC3_FLOAT* gain, LC3_INT* quantizedGain, + LC3_INT* quantizedGainMin, LC3_INT quantizedGainOff, LC3_FLOAT* targetBitsOff, + LC3_INT* old_targetBits, LC3_INT old_specBits, LC3_INT bq_mode + , LC3_INT regBits, LC3_FLOAT frame_ms +); + +void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting, + LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx, + LC3_INT gg_idx, uint8_t* resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes, + LC3_INT* nbits_residual, LC3_INT* residualPresent, LC3_INT frame_dms, + LC3_INT32 n_pc, LC3_INT32 be_bp_left, LC3_INT32 be_bp_right, LC3_INT32 enc, LC3_INT32 *b_left, LC3_INT32 *spec_inv_idx, + LC3_INT hrmode + ); + +void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT gains[], const LC3_INT bands_offset[], LC3_INT fdns_npts); + +void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t * resBits, + LC3_INT* numResBits + , LC3_INT hrmode +); + +void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits + , LC3_INT hrmode +); + +void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, + LC3_INT* gainChange, LC3_INT fs_idx + , LC3_INT16 hrmode, LC3_INT16 frame_dms + ); + +void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off); + +void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, + LC3_INT target_bytes + ); + +void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx); + +void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4, LC3_INT* mem_old_T0, LC3_INT* T0_out, + LC3_FLOAT* normcorr_out, LC3_INT len, LC3_INT frame_dms); + +void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, LC3_INT fs, LC3_INT N, LC3_INT frame_dms, LC3_INT nBits, + LC3_INT* order_out, LC3_INT* rc_idx, LC3_INT* tns_numfilters, LC3_INT* bits_out + , LC3_INT16 near_nyquist_flag + ); +void levinsonDurbin(LC3_FLOAT* r, LC3_FLOAT* out_lev, LC3_FLOAT* rc_unq, LC3_FLOAT* error, LC3_INT len); + +void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs); + +void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor); + +void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_LC3_INT); + +void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx); +void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, + const LC3_INT bands_number, const LC3_FLOAT* ener); + +void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d); + +void ProcessingIMDCT_fl(LC3_FLOAT* y, LC3_INT yLen, const LC3_FLOAT* win, LC3_INT winLen, LC3_INT last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x, + Dct4* dct); + +void ProcessingITDA_WIN_OLA_fl(LC3_FLOAT* x_tda, LC3_INT32 yLen, const LC3_FLOAT* win, LC3_INT32 winLen, LC3_INT32 last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x); + +void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC3_INT pitch_ol, LC3_FLOAT pitch_ol_norm_corr, LC3_INT frame_dms, + LC3_FLOAT* mem_old_x, LC3_INT memLen, LC3_FLOAT* mem_norm_corr_past, LC3_INT* mem_on, LC3_FLOAT* mem_pitch, + LC3_INT* param, LC3_FLOAT* mem_norm_corr_past_past, LC3_INT* bits); + +void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, + LC3_INT* mem_pitch_LC3_INT, LC3_INT* mem_pitch_fr, LC3_FLOAT* mem_gain, LC3_INT* mem_beta_idx, LC3_INT bfi, + LC3_INT* param, LC3_INT* mem_param, LC3_INT conf_beta_idx, LC3_FLOAT conf_beta, LC3_INT concealMethod, LC3_FLOAT damping + , LC3_INT *mem_ltpf_active +); + +void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], + LC3_INT mem_out_len, LC3_FLOAT y[], LC3_INT* y_len, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT fs); + +void write_bit_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT bit); +void write_uint_backward_fl(LC3_UINT8* ptr, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT val, LC3_INT numbits); + +void processAriEncoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT* x, LC3_INT* tns_order, LC3_INT tns_numfilters, + LC3_INT* tns_idx, LC3_INT lastnz, + LC3_INT* codingdata, uint8_t* res_bits, LC3_INT resBitsLen, LC3_INT lsbMode, + LC3_INT nbbits, LC3_INT enable_lpc_weighting); + +void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, + LC3_FLOAT* attdec_filter_mem, LC3_INT attackHandlingOn, LC3_INT attdec_nblocks, LC3_INT attdec_hangover_threshold); + +void process_snsQuantizesScf_Enc(LC3_FLOAT* env, LC3_INT* index, LC3_FLOAT* envq, Dct2 dct2structSNS); + +void process_snsQuantizesScf_Dec(LC3_INT* scf_idx, LC3_FLOAT* scf_q); + +void processMdct_fl(LC3_FLOAT* in, LC3_FLOAT* out, Mdct* mdctStruct); + +int alloc_encoder(LC3PLUS_Enc* encoder, int channels); +void set_enc_frame_params(LC3PLUS_Enc* encoder); +LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate); + +LC3PLUS_Error FillEncSetup(LC3PLUS_Enc* encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]); + +/* Setup Functions */ +int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels); +void set_dec_frame_params(LC3PLUS_Dec* decoder); +LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes); + +LC3PLUS_Error FillDecSetup(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode, int hrmode); + +int Enc_LC3PLUS_fl(LC3PLUS_Enc* encoder, void** input, LC3_UINT8* output, int bps +, LC3_INT32 bfi_ext +); +LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, LC3_UINT8* input, int input_bytes, void** output, int bps, int bfi_ext); + +void* balloc(void* base, size_t* base_size, size_t size); + +void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, + PlcAdvSetup *PlcAdvSetup, PlcSetup *PlcSetup, LC3_INT plcMeth, LC3_INT ltpf_pitch_int, LC3_INT ltpf_pitch_fr, + LC3_INT tilt, const LC3_INT *bands_offset, LC3_INT bands_number, const LC3_INT *bands_offsetPLC, + LC3_INT n_bandsPLC, LC3_INT16 hrmode, pcState *statePC); + +void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, + LC3_INT32 *nbLostCmpt, LC3_FLOAT *cum_alpha, LC3_INT32 bfi, LC3_INT32 *prevBfi, LC3_INT32 *prevprevBfi); + +void processPlcUpdateSpec_fl(LC3_FLOAT *q_d_prev, LC3_FLOAT *q_d_fl_c, LC3_INT yLen); + +void processNoiseSubstitution_fl(LC3_FLOAT* spec, LC3_FLOAT* spec_prev, LC3_INT32 yLen); + +void process_cutoff_bandwidth(LC3_FLOAT* d_fl, LC3_INT len, LC3_INT bw_bin); +void update_enc_bandwidth(LC3PLUS_Enc* encoder, LC3_INT bandwidth); + +/* al_fec.c */ +LC3_INT16 fec_get_n_pccw(LC3_INT16 slot_bytes, LC3_INT16 fec_mode, LC3_INT16 ccc_flag); +LC3_INT16 fec_get_data_size(LC3_INT16 fec_mode, LC3_INT16 ccc_flag, LC3_INT16 slot_bytes); +LC3_INT16 fec_get_n_pc(LC3_INT16 fec_mode, LC3_INT16 n_pccw, LC3_INT16 slot_bytes); +void processReorderBitstream_fl(LC3_UINT8* bytes, LC3_INT32 n_pccw, LC3_INT32 n_pc, LC3_INT32 b_left, LC3_INT32 len); +void fec_encoder(LC3_INT16 mode, LC3_INT16 epmr, LC3_UINT8 *iobuf, LC3_INT16 data_bytes, LC3_INT16 slot_bytes, LC3_INT16 n_pccw); +LC3_INT32 fec_decoder(LC3_UINT8 *iobuf, LC3_INT16 slot_bytes, LC3_INT32 *data_bytes, LC3PLUS_EpModeRequest *epmr, LC3_INT16 ccc_flag, LC3_INT16 *n_pccw, LC3_INT32 *bfi, + LC3_INT16 *be_bp_left, LC3_INT16 *be_bp_right, LC3_INT16 *n_pc, LC3_INT16 *m_fec); + +LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len); + +void processPcClassify_fl(LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *q_d_prev, LC3_FLOAT *q_old_res, LC3_INT32 yLen, LC3_INT32 spec_inv_idx, LC3_FLOAT stab_fac, LC3_INT32 *bfi); +void processPcMain_fl(LC3_INT32 *bfi, LC3PLUS_Dec* decoder, LC3_FLOAT *sqQdec, DecSetup* h_DecSetup, LC3_INT32 pitch_present, LC3_FLOAT stab_fac, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 fac_ns_idx, pcState *statePC, LC3_INT32 spec_inv_idx, LC3_INT32 yLen); +void processPcUpdate_fl(LC3_INT32 bfi, LC3_FLOAT *q_res, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 rframe, LC3_INT32 *BW_cutoff_idx_nf, LC3_INT32 *prev_BW_cutoff_idx_nf, LC3_INT32 fac_ns_idx, LC3_FLOAT *prev_fac_ns, LC3_FLOAT *fac, LC3_FLOAT *q_old_res, LC3_FLOAT *prev_gg, LC3_INT32 spec_inv_idx, LC3_INT32 yLen); +void processPcApply_fl(LC3_FLOAT *q_res, LC3_FLOAT *q_old_res, LC3_FLOAT *q_d_prev, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_FLOAT *prev_gg, LC3_FLOAT *fac, LC3_INT32 *pc_nbLostCmpt); + +void processPlcClassify_fl(LC3_INT plcMeth, LC3_INT *concealMethod, LC3_INT32 *nbLostCmpt, LC3_INT32 bfi, + LC3_FLOAT *xcorr, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 pitch_int, + LC3_INT32 fs, const LC3_INT *band_offsets, LC3_INT32 bands_number, LC3_INT32 tilt, PlcAdvSetup *plcAd + , LC3_INT32 hrmode +); +void processPlcComputeStabFacMain_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_FLOAT *old_old_scf_q, LC3_INT32 bfi, LC3_INT32 prev_bfi, LC3_INT32 prev_prev_bfi, LC3_FLOAT *stab_fac); + +void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, + LC3_INT32 *pc_seed, LC3_INT32 ns_nbLostCmpt_pc, + LC3_INT32 ns_nbLostCmpt, LC3_FLOAT *stabFac, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, + LC3_FLOAT *spec_prev, LC3_FLOAT *spec, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 bfi, + LC3_INT32 frame_dms, LC3_INT32 concealMethod, LC3_INT32 pitch_present_bfi1, LC3_INT32 pitch_present_bfi2, + LC3_FLOAT *cum_fflcAtten); +void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 nbLostCmpt, LC3_FLOAT *stabFac, LC3_INT32 processDampScramb, + LC3_FLOAT *cum_fflcAtten, LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *cum_fading_slow, + LC3_FLOAT *cum_fading_fast, LC3_INT32 *seed, LC3_INT32 spec_inv_idx); + +void plc_phEcu_F0_refine_first(LC3_INT32 *plocs, LC3_INT32 n_plocs, LC3_FLOAT *f0est, const LC3_INT32 Xabs_len, + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0gainPtr, const LC3_INT32 nSubm); +void processTdcLpcEstimation_fl(LC3_FLOAT *r, LC3_INT32 fs_idx, LC3_INT32 len, LC3_FLOAT *A, LC3_INT32 frame_dms); + +LC3_FLOAT plc_phEcuSetF0Hz(LC3_INT32 fs, LC3_FLOAT *old_pitchPtr); + +void plc_phEcu_processPLCspec2shape(LC3_INT16 prev_bfi, LC3_INT16 bfi, LC3_FLOAT q_d[], LC3_INT32 yLen, LC3_FLOAT *stPhECU_oold_grp_shape, LC3_FLOAT *stPhECU_old_grp_shape); +void plc_phEcu_LF_peak_analysis(LC3_INT32 *plocs, LC3_INT32 *n_plocs, LC3_FLOAT *f0est, const LC3_FLOAT *Xabs, + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0gainPtr, const LC3_INT32 nSubm); + +void plc_phEcu_F0_refine_first(LC3_INT32 *plocs, LC3_INT32 n_plocs, LC3_FLOAT *f0est, const LC3_INT32 Xabs_len, + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0gainPtr, const LC3_INT32 nSubm); + +LC3_FLOAT plc_phEcu_imax2_jacobsen_mag(const Complex *y, LC3_FLOAT *c_jacobPtr); +LC3_FLOAT plc_phEcu_interp_max(const LC3_FLOAT *y, LC3_INT32 y_len); +void plc_phEcu_fft_spec2_sqrt_approx(const Complex* x, LC3_INT32 x_len, LC3_FLOAT* x_abs); +LC3_INT32 plc_phEcu_pitch_in_plocs(LC3_INT32* plocs, LC3_INT32 n_plocs); +void plc_phEcu_spec_ana(LC3_FLOAT* xfp, LC3_INT32 xfp_len, const LC3_FLOAT* whr, + LC3_FLOAT* pfind_sensPtr, LC3_INT32* plocs, + LC3_INT32* n_plocs, LC3_FLOAT* f0est, Complex* x, LC3_INT32* x_len, + LC3_FLOAT* f0hzLtpBinPtr, LC3_FLOAT* f0gainLtpPtr, LC3_INT32 bw_idx, Fft* PhEcu_Fft); +void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_INT32 time_offs, Complex* X, LC3_INT32 X_len, + LC3_FLOAT* mag_chg_gr, LC3_INT32 *seed, LC3_FLOAT* alpha, LC3_FLOAT* beta, LC3_FLOAT* Xavg, + LC3_INT32 t_adv_in, LC3_INT32 Lprot, LC3_INT32 delta_corr, LC3_FLOAT *corr_phase_dbg, + LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg); +void plc_phEcu_rec_frame(Complex *X_in, LC3_INT32 xfp_len, LC3_INT32 Lecu, const LC3_FLOAT *whr, const LC3_FLOAT *winMDCT, LC3_INT32 Lprot, + LC3_FLOAT *xfp, LC3_INT32 time_offs, LC3_FLOAT *x_out, + Complex *full_spec_dbg, LC3_FLOAT* ifft_out_dbg, LC3_FLOAT* xsubst_dbg, + LC3_INT32 LA_ZEROS, LC3_INT32 LA, Fft* PhEcu_Ifft + + ); +void plc_phEcu_tba_spect_Xavg(LC3_INT32 fs_idx, LC3_INT32 n_grp, LC3_FLOAT *oold_spec_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spec_shape, LC3_FLOAT *old_EwPtr, + LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *Xavg); +void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change); +void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *grp_pow_change, + LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, + LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_FLOAT *ph_dith, LC3_INT32 *tr_dec, + LC3_FLOAT *att_val, LC3_INT32 *attDegreeFrames, LC3_FLOAT *thresh_dbg); +void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, + LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, + LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg); +void plc_phEcu_hq_ecu( + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0ltpGainPtr, + LC3_FLOAT *xfp, LC3_INT16 prev_bfi, LC3_INT32 *short_flag_prev, + LC3_INT32 fs, LC3_INT32 * time_offs, + Complex *X_sav_m, LC3_INT32 *n_plocs, LC3_INT32 *plocs, LC3_FLOAT *f0est, const LC3_FLOAT *mdctWin, + LC3_FLOAT *env_stabPtr, LC3_INT32 delta_corr, + LC3_FLOAT *pfind_sensPtr, + LC3_INT32 PhECU_LA, LC3_INT32 t_adv, const LC3_FLOAT *winWhr, LC3_FLOAT *oold_grp_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_grp_shape, + LC3_FLOAT *old_EwPtr, + LC3_FLOAT *st_beta_mute, LC3_FLOAT *st_mag_chg_1st, LC3_FLOAT *st_Xavg, LC3_INT32 LA_ZEROS, LC3_FLOAT *x_tda, LC3_FLOAT *xsubst_dbg, Complex *X_out_m_dbg, + LC3_INT32 *seed_dbg, LC3_FLOAT *mag_chg_dbg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg, LC3_FLOAT *corr_phase_dbg + ,Fft* PhEcu_Fft,Fft* PhEcu_Ifft +); + +void processTdcPreemphasis_fl(LC3_FLOAT *in, LC3_FLOAT *pre_emph_factor, LC3_INT32 n_bands); + +void processTdcTdac_fl(const LC3_FLOAT *synth_inp, const LC3_FLOAT *win, LC3_INT32 frame_length, LC3_INT32 la_zeroes, LC3_FLOAT *ola_mem); +void processTdcInverseOdft_fl(LC3_FLOAT *in, LC3_INT32 n_bands, LC3_FLOAT *out, LC3_INT32 lpc_order); + +void processTdcApply_fl(const LC3_INT32 pitch_LC3_INT, const LC3_FLOAT *preemphFac, const LC3_FLOAT* A, const LC3_INT32 lpc_order, const LC3_FLOAT* pcmbufHist, const LC3_INT32 max_len_pcm_plc, const LC3_INT32 N, const LC3_INT32 frame_dms, + const LC3_INT32 SampRate, const LC3_INT32 nbLostCmpt, const LC3_INT32 overlap, const LC3_FLOAT *stabFac, LC3_FLOAT harmonicBuf[MAX_PITCH], LC3_FLOAT synthHist[M], + LC3_INT32* fract, LC3_INT16* seed, LC3_FLOAT* gain_c, LC3_FLOAT* alpha, LC3_FLOAT* synth); +void* balloc(void* base, size_t* base_size, size_t size); + + + +#endif diff --git a/lc3plus/imdct.c b/lc3plus/imdct.c new file mode 100755 index 0000000000..5d38aa6cc7 --- /dev/null +++ b/lc3plus/imdct.c @@ -0,0 +1,102 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +/* Function expects already flipped window */ +void ProcessingIMDCT_fl(LC3_FLOAT* y, LC3_INT yLen, const LC3_FLOAT* win, LC3_INT winLen, LC3_INT last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x, Dct4* dct) +{ + LC3_FLOAT x_tda[MAX_LEN] = {0}, x_ov[2 * MAX_LEN] = {0}; + LC3_INT i = 0, j = 0; + + /* Flip imdct window up to down */ + i = winLen - 1; + j = 0; + + dct4_apply(dct, y, x_tda); + + move_float(x_ov, &x_tda[yLen / 2], yLen / 2); + + j = yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen - 1 - i]; + j++; + } + + j = yLen; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen / 2 - 1 - i]; + j++; + } + + j = yLen + yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[i]; + j++; + } + + for (i = 0; i < winLen; i++) { + x_ov[i] = x_ov[i] * win[winLen - 1 - i]; + } + + /* Buffer update */ + j = 0; + for (i = last_zeros; i < yLen; i++) { + x_ov[i] = x_ov[i] + mem[j]; + j++; + } + + move_float(&x[0], &x_ov[last_zeros], yLen); + + move_float(&mem[0], &x_ov[yLen + last_zeros], (winLen - (yLen + last_zeros))); +} + +void ProcessingITDA_WIN_OLA_fl(LC3_FLOAT* x_tda, LC3_INT32 yLen, const LC3_FLOAT* win, LC3_INT32 winLen, LC3_INT32 last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x) +{ + LC3_FLOAT x_ov[2 * MAX_LEN] = {0}; + LC3_INT32 i, j; + + move_float(x_ov, &x_tda[yLen / 2], yLen / 2); + + j = yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen - 1 - i]; + j++; + } + + j = yLen; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[yLen / 2 - 1 - i]; + j++; + } + + j = yLen + yLen / 2; + for (i = 0; i < yLen / 2; i++) { + x_ov[j] = -x_tda[i]; + j++; + } + + for (i = 0; i < winLen; i++) { + x_ov[i] = x_ov[i] * win[winLen - 1 - i]; + } + + /* Buffer update */ + j = 0; + + for (i = last_zeros; i < yLen; i++) { + x[j] = x_ov[i] + mem[j]; + j++; + } + + move_float(&x[j], &x_ov[last_zeros+j], yLen-j); + + move_float(&mem[0], &x_ov[yLen + last_zeros], (winLen - (yLen + last_zeros))); +} diff --git a/lc3plus/lc3.c b/lc3plus/lc3.c new file mode 100755 index 0000000000..17d2ccb712 --- /dev/null +++ b/lc3plus/lc3.c @@ -0,0 +1,431 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "lc3.h" +#include "defines.h" +#include "functions.h" +#include + +#include "setup_dec_lc3.h" +#include "setup_enc_lc3.h" + +#define RETURN_IF(cond, error) \ + if (cond) \ + return (error) + +/* ensure api header constants are up to date */ +STATIC_ASSERT(LC3PLUS_MAX_SAMPLES >= MAX_LEN); +STATIC_ASSERT(LC3PLUS_MAX_CHANNELS >= MAX_CHANNELS); +STATIC_ASSERT(LC3PLUS_MAX_BYTES >= BYTESBUFSIZE); + +/* misc functions ************************************************************/ + +int lc3plus_version(void) +{ + return LC3PLUS_VERSION; +} + +int lc3plus_channels_supported(int channels) +{ + return channels >= 1 && channels <= MAX_CHANNELS; +} + +int lc3plus_samplerate_supported(int samplerate) +{ + switch (samplerate) + { + case 8000: return 1; + case 16000: return 1; + case 24000: return 1; + case 32000: return 1; + case 44100: return 1; + case 48000: return 1; + case 96000: return 1; + default: break; + } + return 0; +} + +static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) +{ + switch ((int)plc_mode) + { + case LC3PLUS_PLC_ADVANCED: /* fallthru */ + return 1; + default: break; + } + return 0; +} + +static int lc3plus_frame_size_supported(float frame_ms) +{ + switch ((int)(ceil(frame_ms * 10))) + { + case 25: /* fallthru */ + case 50: /* fallthru */ + case 100: return 1; + default: break; + } + return 0; +} + +static int null_in_list(void **list, int n) +{ + while (--n >= 0) + RETURN_IF(list[n] == NULL, 1); + return 0; +} + +/* return pointer to aligned base + base_size, *base_size += size + 4 bytes align */ +void *balloc(void *base, size_t *base_size, size_t size) +{ + uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & ~3; + assert((uintptr_t)base % 4 == 0); /* base must be 4-byte aligned */ + *base_size = (*base_size + size + 3) & ~3; + return (void *)ptr; +} + +int32_t lc3_enc_supported_lfe(void) +{ + return 1; +} + +/* encoder functions *********************************************************/ +LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]) +{ + int ch = 0; + + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((uintptr_t)encoder % 4 != 0, LC3PLUS_ALIGN_ERROR); + RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR); + RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); + RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); + + for (ch = 0; ch < channels; ch++) + { + RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); + } + + return FillEncSetup(encoder, samplerate, channels, hrmode, lfe_channel_array); /* real bitrate check happens here */ +} + +int lc3plus_enc_get_size(int samplerate, int channels) +{ + RETURN_IF(!lc3plus_samplerate_supported(samplerate), 0); + RETURN_IF(!lc3plus_channels_supported(channels), 0); + return alloc_encoder(NULL, channels); +} + +/* Dummy function for API alignment */ +int lc3plus_enc_get_scratch_size(const LC3PLUS_Enc *encoder) +{ + UNUSED(encoder); + return 0; +} + +int lc3plus_enc_get_input_samples(const LC3PLUS_Enc *encoder) +{ + RETURN_IF(encoder == NULL, 0); + return encoder->frame_length; +} + +int lc3plus_enc_get_num_bytes(const LC3PLUS_Enc *encoder) +{ + RETURN_IF(encoder == NULL, 0); + + return encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in); +} + +int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder) +{ + int ch = 0, totalBytes = 0; + int bitrate; + RETURN_IF(encoder == NULL, 0); + RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR); + + for (ch = 0; ch < encoder->channels; ch++) + { + totalBytes += encoder->channel_setup[ch]->targetBytes; + } + + bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms; + + if (encoder->fs_in == 44100) + { + int rem = bitrate % 480; + bitrate = ((bitrate - rem) / 480) * 441 + (rem * 441) / 480; + } + + return bitrate; +} + + +LC3PLUS_Error lc3plus_enc_set_bitrate(LC3PLUS_Enc *encoder, int bitrate) +{ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(bitrate <= 0, LC3PLUS_BITRATE_ERROR); +#ifndef STRIP_HR_MODE_API + RETURN_IF(encoder->fs_idx == 5 && encoder->hrmode == 0, LC3PLUS_HRMODE_ERROR); +#endif + return update_enc_bitrate(encoder, bitrate); +} + +int lc3plus_enc_get_delay(const LC3PLUS_Enc *encoder) +{ + RETURN_IF(encoder == NULL, 0); + return encoder->frame_length - 2 * encoder->la_zeroes; +} + +LC3PLUS_Error lc3plus_enc_set_frame_dms(LC3PLUS_Enc *encoder, int frame_dms) +{ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(!lc3plus_frame_size_supported(frame_dms / 10.0), LC3PLUS_FRAMEMS_ERROR); + RETURN_IF(encoder->lc3_br_set, LC3PLUS_BITRATE_SET_ERROR); + encoder->frame_dms = frame_dms; + encoder->frame_ms = frame_dms / 10.0; + set_enc_frame_params(encoder); + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth) +{ + LC3_INT effective_fs; + + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); +#ifdef ENABLE_HR_MODE_FL_FLAG + RETURN_IF(encoder->hrmode == 1, LC3PLUS_HRMODE_BW_ERROR); +#endif + effective_fs = encoder->fs_in; + if (encoder->bandwidth != bandwidth) { + if (encoder->fs_in > 40000) { + effective_fs = 40000; + } + if ((bandwidth * 2) > effective_fs) { + return LC3PLUS_BW_WARNING; + } + else { + encoder->bandwidth = bandwidth; + encoder->bandwidth_preset = bandwidth; + encoder->bw_ctrl_active = 1; + update_enc_bitrate(encoder, encoder->bitrate); + } + } + return LC3PLUS_OK; +} + + +LC3PLUS_Error lc3plus_enc16(LC3PLUS_Enc* encoder, int16_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +) +{ + UNUSED(scratch); + return lc3plus_enc_fl(encoder, (void**)input_samples, 16, output_bytes, num_bytes); +} + +LC3PLUS_Error lc3plus_enc24(LC3PLUS_Enc* encoder, int32_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +) +{ + UNUSED(scratch); + return lc3plus_enc_fl(encoder, (void**)input_samples, 24, output_bytes, num_bytes); +} + + +LC3PLUS_Error lc3plus_enc_fl(LC3PLUS_Enc* encoder, void** input_samples, int bitdepth, void* output_bytes, int* num_bytes) +{ + RETURN_IF(!encoder || !input_samples || !output_bytes || !num_bytes, LC3PLUS_NULL_ERROR); + RETURN_IF(null_in_list(input_samples, encoder->channels), LC3PLUS_NULL_ERROR); + RETURN_IF(bitdepth != 16 && bitdepth != 24, LC3PLUS_ERROR); + *num_bytes = Enc_LC3PLUS_fl(encoder, input_samples, output_bytes, bitdepth + , *num_bytes == -1 + ); + assert(*num_bytes == lc3plus_enc_get_num_bytes(encoder)); + return LC3PLUS_OK; +} + +/* decoder functions *********************************************************/ + +LC3PLUS_Error lc3plus_dec_init(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode, int hrmode) +{ + RETURN_IF(decoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR); + RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); + RETURN_IF(!lc3plus_plc_mode_supported(plc_mode), LC3PLUS_PLCMODE_ERROR); + RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); + return FillDecSetup(decoder, samplerate, channels, plc_mode, hrmode); +} + +int lc3plus_dec_get_size(int samplerate, int channels) +{ + RETURN_IF(!lc3plus_samplerate_supported(samplerate), 0); + RETURN_IF(!lc3plus_channels_supported(channels), 0); + return alloc_decoder(NULL, samplerate, channels); +} + +/* Dummy function for API alignment */ +int lc3plus_dec_get_scratch_size(const LC3PLUS_Dec *decoder) +{ + UNUSED(decoder); + return 0; +} + +LC3PLUS_Error lc3plus_dec_set_frame_dms(LC3PLUS_Dec *decoder, int frame_dms) +{ + RETURN_IF(decoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF(!lc3plus_frame_size_supported(frame_dms / 10.0), LC3PLUS_FRAMEMS_ERROR); + RETURN_IF(decoder->plcMeth == 2 && frame_dms != 100, LC3PLUS_FRAMEMS_ERROR); + + decoder->frame_dms = frame_dms; + decoder->frame_ms = frame_dms / 10.0; + set_dec_frame_params(decoder); + return LC3PLUS_OK; +} + +int lc3plus_dec_get_output_samples(const LC3PLUS_Dec* decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->frame_length; +} + +int lc3plus_dec_get_delay(const LC3PLUS_Dec* decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->frame_length - 2 * decoder->la_zeroes; +} + +LC3PLUS_Error lc3plus_dec_fl(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, void** output_samples, int bps, int bfi_ext) +{ + RETURN_IF(!decoder || !input_bytes || !output_samples, LC3PLUS_NULL_ERROR); + RETURN_IF(null_in_list((void**)output_samples, decoder->channels), LC3PLUS_NULL_ERROR); + return Dec_LC3PLUS_fl(decoder, input_bytes, num_bytes, output_samples, bps, bfi_ext); +} + +LC3PLUS_Error lc3plus_dec16(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int16_t** output_samples, + void* scratch, + int bfi_ext) +{ + UNUSED(scratch); + return lc3plus_dec_fl(decoder, input_bytes, num_bytes, (void**)output_samples, 16, bfi_ext); +} + +LC3PLUS_Error lc3plus_dec24(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int32_t** output_samples, + void* scratch, + int bfi_ext) +{ + UNUSED(scratch); + return lc3plus_dec_fl(decoder, input_bytes, num_bytes, (void**)output_samples, 24, bfi_ext); +} + +/* memory functions *********************************************************/ + +LC3PLUS_Error lc3plus_enc_free_memory(LC3PLUS_Enc* encoder) +{ + RETURN_IF(!encoder, LC3PLUS_NULL_ERROR); + + lc3plus_free_encoder_structs(encoder); + + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_dec_free_memory(LC3PLUS_Dec* decoder) +{ + RETURN_IF(!decoder, LC3PLUS_NULL_ERROR); + + lc3plus_free_decoder_structs(decoder); + + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder) +{ + int ch = 0; + RETURN_IF(!encoder, LC3PLUS_NULL_ERROR); + + for (ch = 0; ch < encoder->channels; ch++) { + mdct_free(&encoder->channel_setup[ch]->mdctStruct); + dct2_free(&encoder->channel_setup[ch]->dct2StructSNS); + } + + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder) +{ + int ch = 0; + RETURN_IF(!decoder, LC3PLUS_NULL_ERROR); + + for (ch = 0; ch < decoder->channels; ch++) { + dct4_free(&decoder->channel_setup[ch]->dct4structImdct); + real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft); + real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft); + } + + return LC3PLUS_OK; +} + + +LC3PLUS_EpModeRequest lc3plus_dec_get_ep_mode_request(const LC3PLUS_Dec *decoder) +{ + RETURN_IF(decoder == NULL, LC3PLUS_EPMR_ZERO); + return (LC3PLUS_EpModeRequest)decoder->epmr; +} + +int lc3plus_dec_get_error_report(const LC3PLUS_Dec *decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->error_report == 2047 ? -1 : decoder->error_report & 0x07FF; +} + +LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode) +{ + LC3PLUS_EpMode oldEpmode; + LC3PLUS_Error error; + + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((unsigned)epmode > LC3PLUS_EP_HIGH, LC3PLUS_EPMODE_ERROR); + oldEpmode = encoder->epmode; + encoder->epmode = epmode; + error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK; + if (error != LC3PLUS_OK) + { + encoder->epmode = oldEpmode; // preserve old epmode in case of failure + } + return error; +} + +LC3PLUS_Error lc3plus_enc_set_ep_mode_request(LC3PLUS_Enc *encoder, LC3PLUS_EpModeRequest epmr) +{ + RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); + RETURN_IF((unsigned)epmr > LC3PLUS_EPMR_HIGH, LC3PLUS_EPMODE_ERROR); + encoder->epmr = epmr; + return LC3PLUS_OK; +} + +LC3PLUS_Error lc3plus_dec_set_ep_enabled(LC3PLUS_Dec *decoder, int32_t ep_enabled) +{ + RETURN_IF(decoder == NULL, LC3PLUS_NULL_ERROR); + decoder->ep_enabled = ep_enabled != 0; + decoder->epmr = LC3PLUS_EPMR_ZERO; + return LC3PLUS_OK; +} + +int lc3plus_dec_get_epok_flags(const LC3PLUS_Dec *decoder) +{ + RETURN_IF(decoder == NULL, 0); + return decoder->error_report >> 11; +} + +#ifndef STRIP_ERROR_PROTECTION_API_FL +#endif /* STRIP_ERROR_PROTECTION_API_FL */ + +#ifndef STRIP_ERROR_PROTECTION_API_FL +#endif /* STRIP_ERROR_PROTECTION_API_FL */ + diff --git a/lc3plus/lc3.h b/lc3plus/lc3.h new file mode 100755 index 0000000000..3e45438fed --- /dev/null +++ b/lc3plus/lc3.h @@ -0,0 +1,517 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +/*! \file lc3.h + * This header provides the API for LC3plus. + * + * This library is targeting devices with extreme memory limitations, so memory management + * must be handeled by the user. This includes allocating memory for the structs. The structs are persistent + * between function calls. + * + * The amount of memory needed for various configurations can be obtained from the lc3plus_*_get_size + * function. The LC3PLUS_*_MAX_SIZE macro can be used for all configurations. + * + * Depending on the build configuration some functions might not be available. + */ + +#ifndef LC3PLUS_H +#define LC3PLUS_H + +#ifndef _MSC_VER +#include +#else +typedef unsigned char uint8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +#endif + +/*! Construct version number from major/minor/micro values. */ +#define LC3PLUS_VERSION_INT(major, minor, micro) (((major) << 16) | ((minor) << 8) | (micro)) + +/*! Version number to ensure header and binary are matching. */ +#define LC3PLUS_VERSION LC3PLUS_VERSION_INT(1, 6, 9) + +/*! Maximum number of supported channels. The actual binary might support + * less, use lc3plus_channels_supported() to check. */ +#define LC3PLUS_MAX_CHANNELS 2 + +/*! Maximum number of samples per channel that can be stored in one LC3plus frame. + */ +#define LC3PLUS_MAX_SAMPLES 960 + +/*! Maximum number of bytes of one LC3plus frame. */ +#define LC3PLUS_MAX_BYTES 1250 + +/*! Maximum size needed to store encoder state. */ +#define LC3PLUS_ENC_MAX_SIZE 20392 + +/*! Maximum size needed to store decoder state. */ +#define LC3PLUS_DEC_MAX_SIZE 87528 + +/*! Error codes returned by functions. */ +typedef enum +{ + LC3PLUS_PLC_ADVANCED = 1 /*!< Enhanced concealment method */ +} LC3PLUS_PlcMode; + +/*! Error protection mode. LC3PLUS_EP_ZERO differs to LC3PLUS_EP_OFF in that + * errors can be detected but not corrected. */ +typedef enum +{ + LC3PLUS_EP_OFF = 0, /*!< Error protection is disabled */ + LC3PLUS_EP_ZERO = 1, /*!< Error protection with 0 bit correction */ + LC3PLUS_EP_LOW = 2, /*!< Error protection correcting one symbol per codeword */ + LC3PLUS_EP_MEDIUM = 3, /*!< Error protection correcting two symbols per codeword */ + LC3PLUS_EP_HIGH = 4 /*!< Error protection correcting three symbols per codeword */ +} LC3PLUS_EpMode; + +/*! Error protection mode request. On the encoder sidem, LC3PLUS_EPMR_ZERO to LC3PLUS_EPMR_HIGH + * can be set. The decoder returns mode requests with different confidences. */ +typedef enum +{ + LC3PLUS_EPMR_ZERO = 0, /*!< Request no error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_LOW = 1, /*!< Request low error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_MEDIUM = 2, /*!< Request medium error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_HIGH = 3, /*!< Request high error correction. High confidence if returned by decoder. */ + LC3PLUS_EPMR_ZERO_MC = 4, /*!< No error correction requested, medium confidence. */ + LC3PLUS_EPMR_LOW_MC = 5, /*!< Low error correction requested, medium confidence. */ + LC3PLUS_EPMR_MEDIUM_MC = 6, /*!< Medium error correction requested, medium confidence. */ + LC3PLUS_EPMR_HIGH_MC = 7, /*!< High error correction requested, medium confidence. */ + LC3PLUS_EPMR_ZERO_NC = 8, /*!< No error correction requested, unvalidated. */ + LC3PLUS_EPMR_LOW_NC = 9, /*!< Low error correction requested, unvalidated. */ + LC3PLUS_EPMR_MEDIUM_NC = 10, /*!< Medium error correction requested, unvalidated. */ + LC3PLUS_EPMR_HIGH_NC = 11 /*!< High error correction requested, unvalidated. */ +} LC3PLUS_EpModeRequest; + +/*! Error codes returned by functions. */ +typedef enum +{ + LC3PLUS_OK = 0, /*!< No error occurred */ + LC3PLUS_ERROR = 1, /*!< Function call failed */ + LC3PLUS_DECODE_ERROR = 2, /*!< Frame failed to decode and was concealed */ + LC3PLUS_NULL_ERROR = 3, /*!< Pointer argument is null */ + LC3PLUS_SAMPLERATE_ERROR = 4, /*!< Invalid samplerate value */ + LC3PLUS_CHANNELS_ERROR = 5, /*!< Invalid channels value */ + LC3PLUS_BITRATE_ERROR = 6, /*!< Invalid bitrate value */ + LC3PLUS_NUMBYTES_ERROR = 7, /*!< Invalid num_bytes value */ + LC3PLUS_EPMODE_ERROR = 8, /*!< Invalid plc_method value */ + LC3PLUS_FRAMEMS_ERROR = 9, /*!< Invalid epmode value */ + LC3PLUS_ALIGN_ERROR = 10, /*!< Invalid frame_ms value */ + LC3PLUS_HRMODE_ERROR = 11, /*!< Unaligned pointer */ + LC3PLUS_BITRATE_UNSET_ERROR = 12, /*!< Invalid epmr value */ + LC3PLUS_BITRATE_SET_ERROR = 13, /*!< Invalid usage of hrmode, sampling rate and frame size */ + LC3PLUS_HRMODE_BW_ERROR = 14, /*!< Function called before bitrate has been set */ + LC3PLUS_PLCMODE_ERROR = 15, /*!< Function called after bitrate has been set */ + LC3PLUS_EPMR_ERROR = 16, /*!< Invalid external bad frame index */ + LC3PLUS_PADDING_ERROR = 17, /*!< Incorrect padding value */ + FRAMESIZE_ERROR = 18, /*!< Incorrect frame size during decoding */ + LC3PLUS_LFE_MODE_NOT_SUPPORTED = 19, /*!< LFE support not available */ + + /* START WARNING */ + LC3PLUS_WARNING = 20, + LC3PLUS_BW_WARNING = 21 /*!< Invalid bandwidth cutoff frequency */ + +} LC3PLUS_Error; + +typedef struct LC3PLUS_Enc LC3PLUS_Enc; /*!< Opaque encoder struct. */ +typedef struct LC3PLUS_Dec LC3PLUS_Dec; /*!< Opaque decoder struct. */ + +/*! \addtogroup Misc + * \{ */ + +/*! Test LFE mode support. + * + * Tests the support of the LFE mode. + * + * \return 1 for true, 0 for false. + */ +int32_t lc3_enc_supported_lfe(void); + +/*! Return library version number. It should match LC3PLUS_VERSION. */ +int lc3plus_version(void); + +/*! Tests if the library supports number of channels. + * + * \param[in] channels Number of channels. + * \return 1 for true, 0 for false. + */ +int lc3plus_channels_supported(int channels); + +/*! Tests if the library supports a sampling rate. + * + * \param[in] samplerate Sampling rate + * \return 1 for true, 0 for false + */ +int lc3plus_samplerate_supported(int samplerate); + +/*! \} + * \addtogroup Encoder + * \{ */ + +/*! + * Initialize LC3plus encoder. + * + * This function is used to fill a user-allocated encoder struct. This is typically + * called once for a samplerate / channel configuration. After init and before encoding + * the first frame you must call lc3plus_enc_set_bitrate(). + * + * \param[out] encoder Pointer to allocated encoder memory. It must have a size provided + * by lc3plus_enc_get_size() for matching samplerate / channels + * configuration or LC3PLUS_ENC_MAX_SIZE. + * \param[in] channels Number of channels. + * \param[in] samplerate Input sampling rate. Allowed sampling rates are: + * 8000, 16000, 24000, 32000, 44100, 48000 + * \param[in] hrmode High resolution mode. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc* encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]); + +/*! + * Encode LC3plus frame with 16 bit input. + * + * Each call consumes a fixed number of samples. The number of input samples + * can be obtained from lc3plus_enc_get_input_samples(). + * Scratch parameter only works as dummy parameter to align fixed-point and floating-point APIs + * + * \param[in] encoder Encoder handle initialized by lc3plus_enc_init(). + * \param[in] input_samples Input samples. The left channel is stored in input_samples[0], + * the right channel in input_samples[1]. The input is not changed + * by the encoder. + * \param[out] output_bytes Output buffer. It must have a at least lc3plus_enc_get_num_bytes() + * or at most LC3PLUS_MAX_BYTES. + * \param[out] num_bytes Number of bytes written to output_bytes. + * \param scratch See comment above. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc16(LC3PLUS_Enc* encoder, int16_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +); + +/*! Encode LC3plus frame with 24 bit input. + * + * The input samples are expected to be 24-bit values, sign-extended to 32-bit. + * See lc3plus_enc16() for parameter documentation. + */ +LC3PLUS_Error lc3plus_enc24(LC3PLUS_Enc* encoder, int32_t** input_samples, void* output_bytes, int* num_bytes +, void *scratch +); + +/*! + * Internal function. Use lc3plus_enc16() or lc3plus_enc24() for encoding. + */ + +LC3PLUS_Error lc3plus_enc_fl(LC3PLUS_Enc* encoder, void** input_samples, int bitdepth, void* output_bytes, int* num_bytes); + +/*! Get the size of the LC3plus encoder struct for a samplerate / channel + * configuration. If memory is not restricted LC3PLUS_ENC_MAX_SIZE can be used for + * all configurations. + * + * \param[in] samplerate Sampling rate. + * \param[in] channels Number of channels. + * \return Size in bytes or 0 on error. + */ +int lc3plus_enc_get_size(int samplerate, int channels); + +/*! Dummy function as no scratch management available in floating-point code. Returns always zero. Used to align fixed-point and floating-point APIs. + * + * \param[in] encoder Encoder handle. + * \return Size in bytes or 0 on error. + */ +int lc3plus_enc_get_scratch_size(const LC3PLUS_Enc *encoder); + +/*! Get number of samples per channel expected by lc3plus_enc16() or lc3plus_enc24(). + * + * \param[in] encoder Encoder handle. + * \return Number of samples or 0 on error. + */ +int lc3plus_enc_get_input_samples(const LC3PLUS_Enc* encoder); + +/*! Get real internal bitrate of the encoder. It might differ from the requested + * bitrate due to 44.1 kHz input. + * + * \param[in] encoder Encoder handle. + * \return Bitrate in bits per second or 0 on error. + */ +int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc* encoder); + +/*! Get the maximum number of bytes produced by lc3plus_enc16() or lc3plus_enc24() for the current + * bitrate. It should be equal to the num_bytes output of lc3plus_enc16/24(). + * + * \param[in] encoder Encoder handle. + * \return Size in bytes or 0 on error. + */ +int lc3plus_enc_get_num_bytes(const LC3PLUS_Enc *encoder); + +/*! Set encoder bitrate for all channels. + * This function must be called at least once before encoding the first frame, but + * after other configuration functions such as lc3plus_enc_set_frame_ms(). + * + * Recommended bitrates for input sampling rates with 10 ms framing: + * kHz | kbps + * --------|----- + * 8 | 24 + * 16 | 32 + * 24 | 48 + * 32 | 64 + * 44.1/48 | 80(voice) 128(music) + * 96 | 128 + * + * \param[in] encoder Encoder handle. + * \param[in] bitrate Bitrate in bits per second. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_bitrate(LC3PLUS_Enc* encoder, int bitrate); + +/*! Get the encoder delay in number of samples. + * + * \param[in] encoder Encoder handle. + * \return Encoder in samples or 0 on error. + */ +int lc3plus_enc_get_delay(const LC3PLUS_Enc *encoder); + +/*! Set the frame length for LC3plus decoder in deci milliseconds. + * Not all lengths may be enabled, in that case LC3PLUS_FRAMEMS_ERROR is returned. + * This only works correcly if the encoder was configured with the same vale. + * + * \param[in] decoder Decoder handle. + * \param[in] frame_ms Frame length in ms. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_frame_dms(LC3PLUS_Enc *encoder, int frame_ms); + + +/*! Set encoder Low-frequency effect moded. deactivates LTPF, TNS, NF + * + * \param[in] encoder Encoder handle. + * \param[in] lfe LFE mode flag + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_lfe(LC3PLUS_Enc* encoder, int lfe); + +/*! Free memory allocated within LC3plus encoder struct. + * + * \param[in] encoder Encoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_free_memory(LC3PLUS_Enc* encoder); + +/*! Set encoder bandwidth to a different value. All frequency bins above the cutoff + * frequency are cut off. Allowed frequencies are: 4 kHz, 8 kHz, 12 kHz, 16 kHz and 24 kHz. + * + * \param[in] encoder Encoder handle. + * \param[in] bandwidth Cutoff Frequency in Hz + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth); + +/*! Internal function called by lc3plus_enc_free_memory. + * + * \param[in] encoder Encoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder); + +/*! Sets error protection mode request transmitted in each channel encoded frame. + * The channel coder includes an error protection mode request (EPMR) in every frame. + * The EPMR takes value 0, 1, 2, and 3 which request ep modes 1, 2, 3, and 4 from the + * decoding device. The EPMR can be retrieved from the channel decoder via the interface + * routine lc3plus_dec_get_ep_mode_request(). + * + * \param[in] encoder Encoder handle. + * \param[in] epmr Error Protection Mode Request + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_ep_mode_request(LC3PLUS_Enc *encoder, LC3PLUS_EpModeRequest epmr); + +/*! Set error protection mode. The default is LC3PLUS_EP_OFF. It is possible to switch between + * different modees during encoding. Dynamic switching is only allowed between LC3PLUS_EP_ZERO, + * LC3PLUS_EP_LOW, LC3_EP_MEDIUM, and LC3PLUS_EP_HIGH. The the decoder must be notified with + * lc3plus_dec_set_ep_enabled() to expect protected data if epmode is other than LC3PLUS_EP_OFF. + * + * \param[in] encoder Encoder handle. + * \param[in] epmode Error protection mode. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode); + +/*! \} + * \addtogroup Decoder + * \{ */ + +/*! + * Initialize LC3plus decoder. + * + * This function is used to fill a user-allocated decoder struct. This is + * typically called once for a samplerate / channel configuration. + * + * The samplerate and channel arguments must have the same values that were + * used for encoding. LC3plus does not provide a signalling scheme, transporting + * these values is the responsibility of the application. + * + * \param[out] decoder Pointer to decoder memory. It must have as size + * of least lc3plus_dec_get_size() or at most LC3PLUS_DEC_MAX_SIZE. + * \param[in] samplerate Bitstream sampling rate. \param[in] channels Bitstream + * number of channels. + * + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_init(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode, int hrmode); + + + +/*! + * Decode compressed LC3plus frame to 16 bit PCM output. + * + * Each call decodes a fixed number of samples. Use lc3plus_dec_get_output_samples() to obtain this + * number. When the input is corrupted and can not be decoded, LC3PLUS_DECODE_ERROR is returned and + * packet loss concealment is applied, so the output is still usable. + * If error protection is enabled and the errors can be corrected the frame is corrected and + * normally decoded. Use lc3plus_dec_get_error_report() to check if errors were corrected. + * + * \param[in] decoder Decoder initialized by lc3plus_dec_init(). + * \param[in] input_bytes Input bytes. If error protection is enabled the input bytes can be + * altered when error correction is applied. This is why this buffer + * must be writable. + * \param[in] num_bytes Number of valid bytes in input_bytes. To signal a lost frame and + * generate concealment output this value must be set to 0. + * \param[out] output_samples Array of pointers to output channel buffers. Each channel buffer + * should provide enough space to hold at most LC3PLUS_MAX_SAMPLES. The + * left channel is stored in output_samples[0], the right channel in + * output_samples[1]. + * \param scratch Scratch parameter only works as dummy parameter to align fixed-point and floating-point APIs + * \return Returns LC3PLUS_OK on success or appropriate error code. Note there is + * a special case for LC3PLUS_DECODE_ERROR where the output is still valid. + */ +LC3PLUS_Error lc3plus_dec16(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int16_t** output_samples, + void* scratch, + int bfi_ext); + +/*! Decode compressed LC3plus frame to 24 bit PCM output. + * + * The output samples are 24-bit values, sign-extended to 32-bit. + * See lc3plus_dec16() for parameter documentation. + */ +LC3PLUS_Error lc3plus_dec24(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, int32_t** output_samples, + void* scratch, + int bfi_ext); + +/* Internal function */ + LC3PLUS_Error lc3plus_dec_fl(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, void** output_samples, int bps, int bfi_ext); + +/*! Get the size of the LC3plus decoder struct for a samplerate / channel + * configuration. If memory is not restricted LC3PLUS_DEC_MAX_SIZE can be used for + * all configurations. + * + * \param[in] channels Number of channels. + * \param[in] samplerate Sampling rate. + * \return Size in bytes or 0 on error. + */ +int lc3plus_dec_get_size(int samplerate, int channels); + +/*! Dummy function as no scratch management available in floating-point code. Returns always zero. Used to align fixed-point and floating-point APIs. + * + * \param[in] decoder Decoder handle. + * \return Size in bytes or 0 on error. + */ +int lc3plus_dec_get_scratch_size(const LC3PLUS_Dec *decoder); + +/*! Get the number of samples per channel produced by lc3plus_dec16() or lc3plus_dec24. + * + * \param[in] decoder Decoder handle. + * \return Number of samples or 0 on error. + */ +int lc3plus_dec_get_output_samples(const LC3PLUS_Dec* decoder); + +/*! Get the decoder delay in number of samples. + * + * \param[in] decoder Decoder handle. + * \return Delay in samples or 0 on error. + */ +int lc3plus_dec_get_delay(const LC3PLUS_Dec* decoder); + +/*! Set the frame length for LC3plus encoder in deci milliseconds. + * Not all lengths may be enabled, in that case LC3PLUS_FRAMEMS_ERROR is returned. + * This function must be called before lc3plus_enc_set_bitrate(). The decoder must be + * configured with lc3plus_dec_set_frame_dms() with the same value. + * + * \param[in] encoder Encoder handle. + * \param[in] frame_ms Frame length in ms. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_set_frame_dms(LC3PLUS_Dec *decoder, int frame_ms); + + +/*! Free memory allocated within LC3plus decoder struct. + * + * \param[in] decoder Decoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_free_memory(LC3PLUS_Dec* decoder); + +/*! Internal function called by lc3plus_dec_free_memory. + * + * \param[in] decoder Decoder handle. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder); + +/*! Enable or disable error protection. Default value is 0 (disabled). If error protection is + * enabled, the decoder expects that the frames were encoded with error protection mode + * LC3PLUS_EP_ZERO or higher. + * + * \param[in] decoder Decoder handle. + * \param[in] ep_enabled 1 (or any nonzero) for true, 0 for false. + * \return LC3PLUS_OK on success or appropriate error code. + */ +LC3PLUS_Error lc3plus_dec_set_ep_enabled(LC3PLUS_Dec *decoder, int ep_enabled); + +/*! Retrieves the error protection mode reqeust from channel decoder. + * + * The return value encodes both the error protection mode request (EPMR) + * and the confidence of the method by which it was retrieved. + * + * The requested error protection mode is (epmr % 4) + 1, where epmr is the + * function's return value. The confidence is specified as follows. + * + * Confidence | Range + * -----------|------------- + * high | 0 <= epmr < 4 + * medium | 4 <= epmr < 8 + * no | 8 <= epmr < 12 + * + * When receiving stereo content of separately channel encoded audio frames the + * return value is the minimum of two values retrieved from the individual channels. + * + * \param[in] decoder Decoder handle. + * \return Error protection mode reqeust. + */ +LC3PLUS_EpModeRequest lc3plus_dec_get_ep_mode_request(const LC3PLUS_Dec *decoder); + +/*! Get the number of corrected bit errors in the last decoded frame. This only works if + * error protection is active. If the number of errors is greater than the current error + * protection mode can correct, -1 is returned. If the last frame had no errors or the + * decoder handle is NULL, 0 is returned, + * + * \param[in] decoder Decoder handle. + * \return Number of corrected bits or -1. See description for details. + */ +int lc3plus_dec_get_error_report(const LC3PLUS_Dec *decoder); +/*! This function returns an set of flags indicating whether the last frame + * would have been channel decodable in epmode m, m ranging from 1 to 4. Note that + * this information is not available in case the last frame was not channel + * decodable in which case the return value is 0. If the last frame would have + * been decodable in epmode m, m-1th of the return value will be 1. + * Otherwise, if the frame would not have been decodable or if this information + * cannot be retrieved, the m-1th bit of the return value will be 0. + */ +int lc3plus_dec_get_epok_flags(const LC3PLUS_Dec *decoder); + +/*! \} */ +#endif /* LC3plus */ diff --git a/lc3plus/lc3plus_fft.c b/lc3plus/lc3plus_fft.c new file mode 100644 index 0000000000..14f443f860 --- /dev/null +++ b/lc3plus/lc3plus_fft.c @@ -0,0 +1,99 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" +#include "fft/iis_fft.c" +#include "fft/iisfft.c" +#include "fft/cfft.c" + +void fft_init(Fft* fft, int length) +{ + HANDLE_IIS_FFT handle = NULL; + IIS_FFT_ERROR error = 0; + assert(length % 2 == 0); + + fft->length = length; + + error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); + + assert(error == IIS_FFT_NO_ERROR); + fft->handle = handle; +} + +void fft_free(Fft* fft) +{ + IIS_FFT_ERROR error = 0; + + if (fft) { + error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); + + assert(error == IIS_FFT_NO_ERROR); + memset(fft, 0, sizeof(*fft)); + } +} + +void real_fft_free(Fft* fft) +{ + IIS_FFT_ERROR error = 0; + + if (fft) { + error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); + + assert(error == IIS_FFT_NO_ERROR); + memset(fft, 0, sizeof(*fft)); + } +} + +void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) +{ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ + + fft->length = length; + + error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); + assert(error == IIS_FFT_NO_ERROR); + fft->handle = *handle; +} + + +void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) +{ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ + + fft->length = length; + + error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); + + assert(error == IIS_FFT_NO_ERROR); + fft->handle = *handle; +} + +void fft_apply(Fft* fft, const Complex* input, Complex* output) +{ + IIS_FFT_ERROR error = 0; + error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); + + assert(error == IIS_FFT_NO_ERROR); +} + + +void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) +{ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + + UNUSED(error); + + error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); + + assert(error == IIS_FFT_NO_ERROR); +} diff --git a/lc3plus/license.h b/lc3plus/license.h new file mode 100755 index 0000000000..d9d6c89675 --- /dev/null +++ b/lc3plus/license.h @@ -0,0 +1,22 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "defines.h" + +static const char *const LICENSE = + "*******************************************************************************\n" + "* ETSI TS 103 634 V1.4.1 *\n" + "* Low Complexity Communication Codec Plus (LC3plus) *\n" + "* Floating Point Software V%i.%i.%iETSI, " __DATE__ " *\n" + "* Copyright licence is solely granted through ETSI Intellectual Property *\n" + "* Rights Policy, 3rd April 2019. No patent licence is granted by implication, *\n" + "* estoppel or otherwise. *\n" + "*******************************************************************************\n" + "\n"; diff --git a/lc3plus/ltpf_coder.c b/lc3plus/ltpf_coder.c new file mode 100755 index 0000000000..fac8c481c0 --- /dev/null +++ b/lc3plus/ltpf_coder.c @@ -0,0 +1,264 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); + +LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len) +{ + LC3_INT max_i = 0, i = 0; + LC3_FLOAT max = 0; + + if (len <= 0) { + return -128; + } + + for (i = 0; i < len; i++) { + if (in[i] > max) { + max = in[i]; + max_i = i; + } + } + + return max_i; +} + +void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC3_INT pitch_ol, LC3_FLOAT pitch_ol_norm_corr, LC3_INT frame_dms, + LC3_FLOAT* mem_old_x, LC3_INT memLen, LC3_FLOAT* mem_norm_corr_past, LC3_INT* mem_on, LC3_FLOAT* mem_pitch, + LC3_INT* param, LC3_FLOAT* mem_norm_corr_past_past, LC3_INT* bits) +{ + LC3_FLOAT buffer[LTPF_MEMIN_LEN + LEN_12K8 + 1 + (LEN_12K8 >> 2)] = {0}, sum = 0, buf_tmp[MAX_LEN] = {0}, cor_up[MAX_LEN] = {0}, *x; + LC3_INT i = 0, j = 0, k = 0, n = 0, step = 0, N = 0, ltpf_active = 0, pitch_search_delta = 0, + pitch_search_upsamp = 0, pitch_search_L_interpol1 = 0, + t0_min = 0, t0_max = 0, t_min = 0, t_max = 0, temp2 = 0, t1 = 0, pitch_int = 0, pitch_fr = 0, midpoint = 0, + delta_up = 0, delta_down = 0, pitch_index = 0, gain = 0, acflen = 0; + LC3_FLOAT norm_corr = 0, cor[MAX_LEN] = {0}, cor_int[MAX_LEN] = {0}, currFrame[MAX_LEN] = {0}, predFrame[MAX_LEN] = {0}, sum1 = 0, sum2 = 0, sum3 = 0; + LC3_FLOAT pitch = 0; + + /* Signal Buffer */ + N = xLen - 1; + x = &buffer[memLen]; + + move_float(buffer, mem_old_x, memLen); + move_float(x, xin, xLen); + move_float(mem_old_x, &buffer[N], xLen + memLen - N); + + ltpf_active = 0; + norm_corr = 0; + + pitch_search_delta = 4; + pitch_search_upsamp = 4; + pitch_search_L_interpol1 = 4; + + if (pitch_ol_norm_corr > 0.6) { + /* Search Bounds */ + t0_min = pitch_ol - pitch_search_delta; + t0_max = pitch_ol + pitch_search_delta; + t0_min = MAX(t0_min, MIN_PITCH_12K8); + t0_max = MIN(t0_max, MAX_PITCH_12K8); + acflen = N; + + if (frame_dms == 25) + { + acflen = 2 * N; + x = x - N; + } + + /* Cross-Correlation Bounds */ + t_min = t0_min - pitch_search_L_interpol1; + t_max = t0_max + pitch_search_L_interpol1; + + /* Compute norm */ + sum1 = sum2 = 0; + for (j = 0; j < acflen; j++) { + sum1 += x[j] * x[j]; + sum2 += x[j - t_min] * x[j - t_min]; + } + + /* Compute Cross-Correlation */ + for (i = t_min; i <= t_max; i++) { + sum = 0; + for (j = 0; j < acflen; j++) { + sum += x[j] * x[j - i]; + } + + if (i > t_min) { + sum2 = sum2 + x[-i]*x[-i] + - x[acflen - 1 - ( i - 1 )]*x[acflen - 1 - ( i - 1 )]; + } + sum3 = LC3_SQRT(sum1 * sum2) + LC3_POW(10, -5); + norm_corr = sum / sum3; + + norm_corr = MAX(0, norm_corr); + cor[i - t_min] = norm_corr; + + } + + /* Find Integer Pitch-Lag */ + j = 0; + for (i = pitch_search_L_interpol1; i <= t_max - t_min - pitch_search_L_interpol1; i++) { + buf_tmp[j] = cor[i]; + j++; + } + + temp2 = searchMaxIndice(buf_tmp, j); + + t1 = temp2 + t0_min; + assert(t1 >= t0_min && t1 <= t0_max); + + /* Find Fractional Pitch-Lag */ + if (t1 >= RES2_PITCH_12K8) { + pitch_int = t1; + pitch_fr = 0; + } else { + j = 0; + + for (i = 0; i < pitch_search_upsamp * (t_max - t_min) + 1; i = i + pitch_search_upsamp) { + cor_up[i] = cor[j]; + j++; + } + + for (i = 0; i < pitch_search_upsamp * (t0_max - t0_min + 1); i++) { + sum = 0; + + k = 0; + for (j = i; j < i + 32; j++) { + sum += cor_up[j] * inter4_1[k]; + k++; + } + + cor_int[i] = sum; + } + + if (t1 >= RES4_PITCH_12K8) { + step = 2; + } else { + step = 1; + } + + midpoint = pitch_search_upsamp * (t1 - t0_min) + 1; + delta_up = pitch_search_upsamp - step; + + if (t1 == t0_min) { + delta_down = 0; + } else { + delta_down = pitch_search_upsamp - step; + } + + j = 0; + for (i = midpoint - delta_down - 1; i <= midpoint + delta_up; i = i + step) { + buf_tmp[j] = cor_int[i]; + j++; + } + + temp2 = searchMaxIndice(buf_tmp, ((midpoint + delta_up) - (midpoint - delta_down)) / step + 1); + pitch_fr = temp2 * step - delta_down; + + if (pitch_fr >= 0) { + pitch_int = t1; + } else { + pitch_int = t1 - 1; + pitch_fr = pitch_search_upsamp + pitch_fr; + } + } + + assert((pitch_int <= MAX_PITCH_12K8 && pitch_int >= RES2_PITCH_12K8 && pitch_fr == 0) || + (pitch_int < RES2_PITCH_12K8 && pitch_int >= RES4_PITCH_12K8 && (pitch_fr == 0 || pitch_fr == 2)) || + (pitch_int < RES4_PITCH_12K8 && pitch_int >= MIN_PITCH_12K8 && + (pitch_fr == 0 || pitch_fr == 1 || pitch_fr == 2 || pitch_fr == 3))); + + if (pitch_int < RES4_PITCH_12K8) { + pitch_index = pitch_int * 4 + pitch_fr - (MIN_PITCH_12K8 * 4); + } else if (pitch_int < RES2_PITCH_12K8) { + pitch_index = pitch_int * 2 + floor(pitch_fr / 2) - (RES4_PITCH_12K8 * 2) + ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4); + } else { + pitch_index = pitch_int - RES2_PITCH_12K8 + ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) + ((RES2_PITCH_12K8 - RES4_PITCH_12K8) * 2); + } + + assert(pitch_index >= 0 && pitch_index < 512); + pitch = (LC3_FLOAT) pitch_int + (LC3_FLOAT) pitch_fr / 4.0; + + + for (n = 0; n < acflen; n++) + { + currFrame[n] = x[n + 1] * enc_inter_filter[0][0] + + x[n] * enc_inter_filter[0][1] + + x[n - 1] * enc_inter_filter[0][2]; + + predFrame[n] = x[n - pitch_int + 1] * enc_inter_filter[pitch_fr][0] + + x[n - pitch_int] * enc_inter_filter[pitch_fr][1] + + x[n - pitch_int - 1] * enc_inter_filter[pitch_fr][2] + + x[n - pitch_int - 2] * enc_inter_filter[pitch_fr][3]; + } + + /* Normalized Correlation */ + sum1 = sum2 = sum3 = 0; + + for (i = 0; i < acflen; i++) { + sum1 += currFrame[i] * predFrame[i]; + } + + for (i = 0; i < acflen; i++) { + sum2 += currFrame[i] * currFrame[i]; + } + + for (i = 0; i < acflen; i++) { + sum3 += predFrame[i] * predFrame[i]; + } + + sum2 = LC3_SQRT(sum2 * sum3) + LC3_POW(10, -5); + norm_corr = sum1 / sum2; + + assert(norm_corr >= -1.00001 && norm_corr <= 1.00001); + norm_corr = MIN(1, MAX(-1, norm_corr)); + if (norm_corr < 0) { + norm_corr = 0; + } + + if (ltpf_enable == 1) { + /* Decision if ltpf active */ + if ((*mem_on == 0 && (frame_dms == 100 || *mem_norm_corr_past_past > 0.94) && *mem_norm_corr_past > 0.94 && + norm_corr > 0.94) || + (*mem_on == 1 && norm_corr > 0.9) || + (*mem_on == 1 && LC3_FABS(pitch - *mem_pitch) < 2 && (norm_corr - *mem_norm_corr_past) > -0.1 && + norm_corr > 0.84)) { + ltpf_active = 1; + } + } + + gain = 4; + + } else { + gain = 0; + norm_corr = pitch_ol_norm_corr; + pitch = 0; + } + + if (gain > 0) { + param[0] = 1; + param[1] = ltpf_active; + param[2] = pitch_index; + *bits = 11; + } else { + zero_int(param, 3); + + *bits = 1; + } + + if (frame_dms < 100) { + *mem_norm_corr_past_past = *mem_norm_corr_past; + } + + *mem_norm_corr_past = norm_corr; + *mem_on = ltpf_active; + *mem_pitch = pitch; +} diff --git a/lc3plus/ltpf_decoder.c b/lc3plus/ltpf_decoder.c new file mode 100755 index 0000000000..a40c85213a --- /dev/null +++ b/lc3plus/ltpf_decoder.c @@ -0,0 +1,356 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, + LC3_INT* mem_pitch_int, LC3_INT* mem_pitch_fr, LC3_FLOAT* mem_gain, LC3_INT* mem_beta_idx, LC3_INT bfi, + LC3_INT* param, LC3_INT* mem_param, LC3_INT conf_beta_idx, LC3_FLOAT conf_beta, LC3_INT concealMethod, + LC3_FLOAT damping + , LC3_INT *mem_ltpf_active +) +{ + LC3_INT i = 0, j = 0, n = 0, N = 0, L_past_x = 0, N4 = 0, N34 = 0, + pitch_int = 0, pitch_fr = 0, p1 = 0, p2 = 0, L_past_y = 0, inter_len = 0, tilt_len = 0, + tilt_len_r = 0, inter_len_r = 0, old_x_len = 0, old_y_len = 0; + + LC3_FLOAT conf_alpha = 0, gain = 0, a1[MAX_LEN] = {0}, a2[MAX_LEN] = {0}, b1[MAX_LEN] = {0}, b2[MAX_LEN] = {0}, + buf_x[4 * MAX_LEN] = {0}, buf_y[4 * MAX_LEN] = {0}, buf_z[4 * MAX_LEN] = {0}, pitch = 0, sum1 = 0, sum2 = 0; + + const LC3_FLOAT *inter_filter[4], *tilt_filter[4]; + + + conf_alpha = 0.85; + + if (bfi != 1) { + /* Decode pitch */ + if (param[0] == 1) { + if (param[2] < (RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) { + pitch_int = MIN_PITCH_12K8 + floor(param[2] / 4); + pitch_fr = param[2] - ((pitch_int - MIN_PITCH_12K8) * 4); + } else if (param[2] < ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) + ((RES2_PITCH_12K8 - RES4_PITCH_12K8) * 2)) { + param[2] = param[2] - ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4); + pitch_int = RES4_PITCH_12K8 + floor(param[2] / 2); + pitch_fr = param[2] - ((pitch_int - RES4_PITCH_12K8) * 2); + pitch_fr = pitch_fr * 2; + } else { + pitch_int = + param[2] + (RES2_PITCH_12K8 - ((RES4_PITCH_12K8 - MIN_PITCH_12K8) * 4) - ((RES2_PITCH_12K8 - RES4_PITCH_12K8) * 2)); + pitch_fr = 0; + } + + pitch = ((LC3_FLOAT)pitch_int + (LC3_FLOAT)pitch_fr / 4.0) * (LC3_FLOAT)fs / 12800.0; + pitch = round(pitch * 4.0) / 4.0; + pitch_int = floor(pitch); + pitch_fr = (LC3_INT)((pitch - (LC3_FLOAT)pitch_int) * 4.0); + } else { + pitch_int = 0; + pitch_fr = 0; + } + + /* Decode gain */ + if (conf_beta_idx < 0) { + param[1] = 0; + } + + if (param[1] == 1) { + gain = conf_beta; + } else { + gain = 0; + } + } + else if (concealMethod > 0) { + if (conf_beta_idx < 0) { + if (mem_param[1] && *mem_beta_idx >= 0) + { + conf_beta_idx = *mem_beta_idx; + } + } + + memmove(param, mem_param, sizeof(LC3_INT32) * 3); + if (concealMethod == 2) + { + /* cause the ltpf to "fade_out" and only filter during initial 2.5 ms and then its buffer during 7.5 ms */ + assert(bfi == 1); + param[1] = 0; /* ltpf_active = 0 */ + } + + pitch_int = *mem_pitch_int; + pitch_fr = *mem_pitch_fr; + gain = (LC3_FLOAT) *mem_gain * damping; + } + + if ((conf_beta <= 0) && (*mem_ltpf_active == 0)) + { + if (fs == 8000 || fs == 16000) { + tilt_len = 4 - 2; + } + else if (fs == 24000) { + tilt_len = 6 - 2; + } + else if (fs == 32000) { + tilt_len = 8 - 2; + } + else if (fs == 44100 || fs == 48000) { + tilt_len = 12 - 2; + } + + N = xLen; + old_x_len = tilt_len; + inter_len = MAX(fs, 16000) / 8000; + old_y_len = ceilf((LC3_FLOAT)228.0 * fs / 12800.0) + inter_len; /* 228.0 needed to make use of ceil */ + + move_float(mem_old_y, &mem_old_y[N], (old_y_len - N)); + move_float(&mem_old_y[old_y_len - N], x, N); + move_float(mem_old_x, &x[N - old_x_len], old_x_len); + + *mem_ltpf_active = 0; + } + else + { + inter_len_r = 0; tilt_len_r = 0; + if (fs == 8000 || fs == 16000) { + inter_filter[0] = conf_inter_filter_16[0]; + inter_filter[1] = conf_inter_filter_16[1]; + inter_filter[2] = conf_inter_filter_16[2]; + inter_filter[3] = conf_inter_filter_16[3]; + inter_len_r = 4; + + tilt_filter[0] = conf_tilt_filter_16[0]; + tilt_filter[1] = conf_tilt_filter_16[1]; + tilt_filter[2] = conf_tilt_filter_16[2]; + tilt_filter[3] = conf_tilt_filter_16[3]; + tilt_len = 4 - 2; + tilt_len_r = 3; + } else if (fs == 24000) { + inter_filter[0] = conf_inter_filter_24[0]; + inter_filter[1] = conf_inter_filter_24[1]; + inter_filter[2] = conf_inter_filter_24[2]; + inter_filter[3] = conf_inter_filter_24[3]; + inter_len_r = 6; + + tilt_filter[0] = conf_tilt_filter_24[0]; + tilt_filter[1] = conf_tilt_filter_24[1]; + tilt_filter[2] = conf_tilt_filter_24[2]; + tilt_filter[3] = conf_tilt_filter_24[3]; + tilt_len = 6 - 2; + tilt_len_r = 5; + } else if (fs == 32000) { + inter_filter[0] = conf_inter_filter_32[0]; + inter_filter[1] = conf_inter_filter_32[1]; + inter_filter[2] = conf_inter_filter_32[2]; + inter_filter[3] = conf_inter_filter_32[3]; + inter_len_r = 8; + + tilt_filter[0] = conf_tilt_filter_32[0]; + tilt_filter[1] = conf_tilt_filter_32[1]; + tilt_filter[2] = conf_tilt_filter_32[2]; + tilt_filter[3] = conf_tilt_filter_32[3]; + tilt_len = 8 - 2; + tilt_len_r = 7; + } else if (fs == 44100 || fs == 48000) { + inter_filter[0] = conf_inter_filter_48[0]; + inter_filter[1] = conf_inter_filter_48[1]; + inter_filter[2] = conf_inter_filter_48[2]; + inter_filter[3] = conf_inter_filter_48[3]; + inter_len_r = 12; + + tilt_filter[0] = conf_tilt_filter_48[0]; + tilt_filter[1] = conf_tilt_filter_48[1]; + tilt_filter[2] = conf_tilt_filter_48[2]; + tilt_filter[3] = conf_tilt_filter_48[3]; + tilt_len = 12 - 2; + tilt_len_r = 11; + } + + inter_len = MAX(fs, 16000) / 8000; + + /* Init buffers */ + N = xLen; + old_x_len = tilt_len; + old_y_len = ceilf(228.0 * fs / 12800.0) + inter_len; + L_past_x = old_x_len; + move_float(buf_x, mem_old_x, old_x_len); + move_float(&buf_x[old_x_len], x, xLen); + L_past_y = old_y_len; + move_float(buf_y, mem_old_y, old_y_len); + zero_float(&buf_y[old_y_len], xLen); + + N4 = fs * 0.0025; + N34 = N - N4; + + /* Init filter parameters */ + if (mem_param[1] == 1) { + for (i = 0; i < inter_len_r; i++) { + a1[i] = *mem_gain * inter_filter[*mem_pitch_fr][i]; + } + + for (i = 0; i < tilt_len_r; i++) { + b1[i] = conf_alpha * (*mem_gain) * tilt_filter[*mem_beta_idx][i]; + } + + p1 = *mem_pitch_int; + } + + if (param[1] == 1) { + for (i = 0; i < tilt_len_r; i++) { + b2[i] = conf_alpha * gain * tilt_filter[conf_beta_idx][i]; + } + + for (i = 0; i < inter_len_r; i++) { + a2[i] = gain * inter_filter[pitch_fr][i]; + } + + p2 = pitch_int; + } + + /* First quarter of the current frame: cross-fading */ + if (mem_param[1] == 0 && param[1] == 0) { + memmove(&buf_y[L_past_y], &buf_x[L_past_x], sizeof(LC3_FLOAT) * N4); + + } else if (mem_param[1] == 1 && param[1] == 0) { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b1[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p1 + inter_len - 1; i >= L_past_y + n - p1 - inter_len; i--) { + sum2 += a1[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum1 + + (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum2; + } + + } else if (mem_param[1] == 0 && param[1] == 1) { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b2[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum1 + ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum2; + } + } else if (*mem_pitch_int == pitch_int && *mem_pitch_fr == pitch_fr) { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b2[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - sum1 + sum2; + } + } else { + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { + sum1 += b1[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p1 + inter_len - 1; i >= L_past_y + n - p1 - inter_len; i--) { + sum2 += a1[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_x[L_past_x + n] - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum1 + + (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum2; + } + + memmove(buf_z, buf_y, sizeof(LC3_FLOAT) * 4 * MAX_LEN); + + for (n = 0; n < N4; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_y + n; i >= L_past_y + n - tilt_len; i--) { + sum1 += b2[j] * buf_z[i]; + j++; + } + + j = 0; + for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + n] = buf_z[L_past_y + n] - ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum1 + ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum2; + } + } + + /* Second quarter of the current frame */ + if (param[1] == 0) { + memmove(&buf_y[L_past_y + N4], &buf_x[L_past_x + N4], + sizeof(LC3_FLOAT) * ((L_past_x + N4 + N34) - (L_past_x + N4))); + } else { + for (n = 0; n < N34; n++) { + sum1 = 0; + sum2 = 0; + j = 0; + for (i = L_past_x + N4 + n; i >= L_past_x + n + N4 - tilt_len; i--) { + sum1 += b2[j] * buf_x[i]; + j++; + } + + j = 0; + for (i = L_past_y + N4 + n - p2 + inter_len - 1; i >= L_past_y + N4 + n - p2 - inter_len; i--) { + sum2 += a2[j] * buf_y[i]; + j++; + } + + buf_y[L_past_y + N4 + n] = buf_x[L_past_x + N4 + n] - sum1 + sum2; + } + } + + /* Output */ + move_float(y, &buf_y[L_past_y], N); + + /* Update memory */ + move_float(mem_old_x, &buf_x[N], old_x_len); + move_float(mem_old_y, &buf_y[N], old_y_len); + + *mem_ltpf_active = (conf_beta > 0); + } + + /* Update ltpf param memory */ + move_int(mem_param, param, 3); + *mem_pitch_int = pitch_int; + *mem_pitch_fr = pitch_fr; + *mem_gain = gain; + *mem_beta_idx = conf_beta_idx; +} diff --git a/lc3plus/makefile b/lc3plus/makefile new file mode 100755 index 0000000000..16758fc306 --- /dev/null +++ b/lc3plus/makefile @@ -0,0 +1,143 @@ +# GNU Makefile + +# Options +AFL = 0 +CLANG = 0 +GCOV = 0 +NO_POST_REL_CHANGES_TEST = 0 +OPTIM = 0 + +# Paths +VPATH = . +BUILD = build +CC = gcc +LINK = $(CC) + +# Binary Name +NAME_LC3 = LC3plus +# Shared Library Name +LIB_LC3 = libLC3plus.so + +# Default tool settings +CC = gcc +RM = rm -f + +# Preprocessor(-I/-D) / Compiler / Linker flags +CFLAGS += -std=c99 -fPIC \ + -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ + -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ + -Werror-implicit-function-declaration + +LDFLAGS += -lm -g +# Include dependency flags +DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD)/$*.Td + +ifneq "$(DEBUG)" "0" + CFLAGS += -g3 + LDFLAGS += -g3 +endif + +ifeq "$(GCOV)" "1" + CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs -ftest-coverage +endif + +OPTIM ?= 0 +CFLAGS += -O$(OPTIM) +CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) + +ifeq "$(NO_POST_REL_CHANGES_TEST)" "1" +CFLAGS += -DNO_POST_REL_CHANGES +endif + +# memory sanitizer, find use of uninitialized memory +ifeq "$(CLANG)" "1" + CC = clang + CFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer + LDFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer + OPTIM = 2 +endif + +# address sanitizer, find buffer overflows +ifeq "$(CLANG)" "2" + CC = clang + CFLAGS += -fsanitize=address -fno-omit-frame-pointer + LDFLAGS += -fsanitize=address -fno-omit-frame-pointer + OPTIM = 2 +endif + +# undefined behavior sanitizer, find bugs like integer overflows +ifeq "$(CLANG)" "3" + CC = clang + CFLAGS += -fsanitize=undefined + LDFLAGS += -fsanitize=undefined + OPTIM = 2 +endif + +# for code coverate test +ifeq "$(GCOV)" "1" + CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs -ftest-coverage +endif + +# verbose output +ifneq "$(VERBOSE)" "1" + QUIET = @ +endif + +# dependency magic +CC_FLAGS = '$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)' +POSTCOMPILE = mv -f $(BUILD)/$*.Td $(BUILD)/$*.d && touch $@ + +######## Generate source / object lists ######## + +SRCS := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) +SRCS_LIB := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) +OBJS := $(addprefix $(BUILD)/, $(SRCS:.c=.o)) + +LIBSRCS := $(filter-out $(DIR)/ccConvert.c $(DIR)/codec_exe.c, $(SRCS)) +LIBOBJS := $(addprefix $(BUILD)/, $(LIBSRCS:.c=.o)) + +.PHONY: all clean help force + +.PRECIOUS: $(BUILD)/%.d + +all: $(NAME_LC3) + +help: + @echo 'Targets:' + @echo ' $(NAME_LC3) (default)' + @echo ' $(LIB_LC3)' + @echo 'Syntax: make [OPTION=VALUE ...]' + @echo 'Build options:' + @echo ' NO_POST_REL_CHANGES_TEST $(NO_POST_REL_CHANGES_TEST) [0,1]' + @echo ' OPTIM $(OPTIM) [0-3]' + @echo 'Debug options:' + @echo ' AFL $(AFL) [0,1]' + @echo ' CLANG $(CLANG) [0-3]' + @echo ' GCOV $(GCOV) [0,1]' + +$(NAME_LC3): $(OBJS) + @echo 'Linking' $@ + $(QUIET) $(LINK) $(OBJS) -o $@ $(LDFLAGS) + +$(LIB_LC3): $(LIBOBJS) + @echo 'Linking' $@ + $(QUIET) $(LINK) --shared $(OBJS) -o $@ $(LDFLAGS) + +clean: + $(QUIET) rm -rf $(NAME_LC3) $(LIB_LC3) $(BUILD) ccConvert + +$(BUILD)/%.o : %.c $(BUILD)/cc_flags + @echo 'Compiling' $< + $(QUIET) $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(QUIET) $(POSTCOMPILE) + +# force rebuild if compilation flags changed +$(BUILD)/cc_flags: force + $(QUIET) mkdir -p $(BUILD) + $(QUIET) echo $(CC_FLAGS) | cmp -s - $@ || echo $(CC_FLAGS) > $@ + +# force rebuild if include dependency changed +$(BUILD)/%.d: ; +include $(wildcard $(patsubst %, $(BUILD)/%.d, $(basename $(SRCS)))) diff --git a/lc3plus/mdct.c b/lc3plus/mdct.c new file mode 100755 index 0000000000..11618b9465 --- /dev/null +++ b/lc3plus/mdct.c @@ -0,0 +1,128 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) +{ + if (frame_dms == 100) { + switch (length) { + case 80: + return MDCT_WINS_10ms[hrmode][0]; + case 160: + return MDCT_WINS_10ms[hrmode][1]; + case 240: + return MDCT_WINS_10ms[hrmode][2]; + case 320: + return MDCT_WINS_10ms[hrmode][3]; + case 480: + return MDCT_WINS_10ms[hrmode][4]; + case 960: + return MDCT_WINS_10ms[hrmode][5]; + default: + return NULL; + } + } + else if (frame_dms == 50) { + switch (length) { + case 40: + return MDCT_WINS_5ms[hrmode][0]; + case 80: + return MDCT_WINS_5ms[hrmode][1]; + case 120: + return MDCT_WINS_5ms[hrmode][2]; + case 160: + return MDCT_WINS_5ms[hrmode][3]; + case 240: + return MDCT_WINS_5ms[hrmode][4]; + case 480: + return MDCT_WINS_5ms[hrmode][5]; + default: + return NULL; + } + } + else if (frame_dms == 25) { + switch (length) { + case 20: + return MDCT_WINS_2_5ms[hrmode][0]; + case 40: + return MDCT_WINS_2_5ms[hrmode][1]; + case 60: + return MDCT_WINS_2_5ms[hrmode][2]; + case 80: + return MDCT_WINS_2_5ms[hrmode][3]; + case 120: + return MDCT_WINS_2_5ms[hrmode][4]; + case 240: + return MDCT_WINS_2_5ms[hrmode][5]; + default: + return NULL; + } + } + return NULL; +} + +void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC3_INT hrmode) +{ + if (frame_dms == 100) { + mdct->leading_zeros = MDCT_la_zeroes[fs_idx]; + } + else if (frame_dms == 50) { + mdct->leading_zeros = MDCT_la_zeroes_5ms[fs_idx]; + } + else if (frame_dms == 25) { + mdct->leading_zeros = MDCT_la_zeroes_2_5ms[fs_idx]; + } + else { + assert(!"invalid frame_ms"); + } + + mdct->length = length; + mdct->mem_length = length - mdct->leading_zeros; + mdct->window = mdct_window(length, frame_dms, hrmode); + mdct->mem = calloc(sizeof(*mdct->mem), mdct->mem_length); + dct4_init(&mdct->dct, length); +} + +void mdct_free(Mdct* mdct) +{ + if (mdct) { + free(mdct->mem); + dct4_free(&mdct->dct); + memset(mdct, 0, sizeof(*mdct)); + } +} + +void mdct_apply(const LC3_FLOAT* input, LC3_FLOAT* output, Mdct* mdct) +{ + LC3_FLOAT tmp[MAX_LEN * 2] = {0}; + LC3_INT i = 0; + LC3_INT hlen; + + move_float(tmp, mdct->mem, mdct->mem_length); + move_float(tmp + mdct->mem_length, input, mdct->length); + zero_float(tmp + mdct->length * 2 - mdct->leading_zeros, mdct->leading_zeros); + move_float(mdct->mem, tmp + mdct->length, mdct->mem_length); + + mult_vec(tmp, mdct->window, mdct->length * 2); + + hlen = mdct->length / 2; + for (i = 0; i < hlen; i++) { + output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i]; + output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; + } + + move_float(tmp, output, mdct->length); + + dct4_apply(&mdct->dct, tmp, output); +} + +void processMdct_fl(LC3_FLOAT* in, LC3_FLOAT* out, Mdct* mdctStruct) { mdct_apply(in, out, mdctStruct); } diff --git a/lc3plus/mdct_shaping.c b/lc3plus/mdct_shaping.c new file mode 100755 index 0000000000..1876192504 --- /dev/null +++ b/lc3plus/mdct_shaping.c @@ -0,0 +1,23 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +{ + LC3_INT i = 0, j = 0; + + for (i = 0; i < fdns_npts; i++) { + for (; j < bands_offset[i + 1]; j++) { + x[j] = x[j] * scf[i]; + } + } +} diff --git a/lc3plus/msvc/.gitignore b/lc3plus/msvc/.gitignore new file mode 100644 index 0000000000..f40a919a54 --- /dev/null +++ b/lc3plus/msvc/.gitignore @@ -0,0 +1 @@ +Win32/ \ No newline at end of file diff --git a/lc3plus/msvc/LC3plus.sln b/lc3plus/msvc/LC3plus.sln new file mode 100755 index 0000000000..a8ee38ea81 --- /dev/null +++ b/lc3plus/msvc/LC3plus.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3_FL", "LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.ActiveCfg = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.Build.0 = Debug|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|x64 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.Build.0 = Release|x64 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.ActiveCfg = Release|Win32 + {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/lc3plus/msvc/LC3plus.vcxproj b/lc3plus/msvc/LC3plus.vcxproj new file mode 100755 index 0000000000..ffbfdf344b --- /dev/null +++ b/lc3plus/msvc/LC3plus.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {95030B82-70CD-4C6B-84D4-61096035BEA2} + Win32Proj + LC3_FL + 10.0.17763.0 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + true + LC3plus + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + + + false + LC3plus + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\Obj\ + + + + + + Level3 + ..\..\lib_com;%(AdditionalIncludeDirectories) + Disabled + MultiThreadedDebug + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4305;4244;4996 + + + Console + true + + + + + Level3 + + + ..\..\lib_com;%(AdditionalIncludeDirectories) + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4244;4305;4996 + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lc3plus/near_nyquist_detector.c b/lc3plus/near_nyquist_detector.c new file mode 100755 index 0000000000..ce94351302 --- /dev/null +++ b/lc3plus/near_nyquist_detector.c @@ -0,0 +1,38 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + +#include "functions.h" +#include "options.h" + + +void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, + const LC3_INT bands_number, const LC3_FLOAT* ener) +{ + *near_nyquist_flag = 0; + + if (fs_idx < 4) + { + LC3_INT i = 0; + LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0; + + for (i=0; i NN_thresh * ener_low){ + *near_nyquist_flag = 1; + } + } +} diff --git a/lc3plus/noise_factor.c b/lc3plus/noise_factor.c new file mode 100755 index 0000000000..c5aa582e45 --- /dev/null +++ b/lc3plus/noise_factor.c @@ -0,0 +1,112 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, + LC3_INT target_bytes +) +{ + LC3_INT sumZeroLines = 0, kZeroLines = 0, startOffset = 0, nTransWidth = 0, end = 0, start = 0, i = 0, j = 0, k = 0, + allZeros = 0, m = 0; + LC3_FLOAT fac_ns_unq = 0, mean = 0, idx = 0, nsf1 = 0, nsf2 = 0; + LC3_INT zeroLines[MAX_LEN] = {0}, zL1[MAX_LEN] = {0}, zL2[MAX_LEN] = {0}; + + switch (frame_dms) + { + case 25: + nTransWidth = 4; + startOffset = 6; + break; + case 50: + nTransWidth = 4; + startOffset = 12; + break; + case 100: + nTransWidth = 8; + startOffset = 24; + break; + } + + for (k = startOffset; k < BW_cutoff_idx; k++) { + allZeros = 1; + + start = k - (nTransWidth - 2) / 2; + end = MIN(BW_cutoff_idx - 1, k + (nTransWidth - 2) / 2); + + for (i = start; i <= end; i++) { + if (xq[i] != 0) { + allZeros = 0; + } + } + + if (allZeros == 1) { + zeroLines[j] = k + 1; + kZeroLines++; + j++; + } + } + + for (i = 0; i < kZeroLines; i++) { + sumZeroLines += zeroLines[i]; + } + + if (sumZeroLines > 0) { + for (j = 0; j < kZeroLines; j++) { + mean += LC3_FABS(x[zeroLines[j] - 1]); + } + + fac_ns_unq = mean / (gg * kZeroLines); + } else { + fac_ns_unq = 0; + } + + if (kZeroLines > 0) + { + if (target_bytes <= 20 && frame_dms == 100) { + j = 0, k = 0; + m = floor(sumZeroLines / kZeroLines); + + for (i = 0; i < kZeroLines; i++) { + if (zeroLines[i] <= m) { + zL1[j] = zeroLines[i]; + j++; + } + + if (zeroLines[i] > m) { + zL2[k] = zeroLines[i]; + k++; + } + } + + mean = 0; + for (i = 0; i < j; i++) { + mean += LC3_FABS(x[zL1[i] - 1]) / gg; + } + + nsf1 = mean / j; + + mean = 0; + for (i = 0; i < k; i++) { + mean += LC3_FABS(x[zL2[i] - 1]) / gg; + } + + nsf2 = mean / k; + + fac_ns_unq = MIN(nsf1, nsf2); + } + } + + idx = round(8 - 16 * fac_ns_unq); + idx = MIN(MAX(idx, 0), 7); + + *fac_ns_idx = idx; +} diff --git a/lc3plus/noise_filling.c b/lc3plus/noise_filling.c new file mode 100755 index 0000000000..7fac5e0f72 --- /dev/null +++ b/lc3plus/noise_filling.c @@ -0,0 +1,81 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) +{ + LC3_INT zeroLines[MAX_LEN] = {0}; + LC3_INT nTransWidth = 0, startOffset = 0, i = 0, j = 0, k = 0, start = 0, end = 0, allZeros = 0, kZeroLines = 0; + LC3_FLOAT fac_ns = 0; + + switch (frame_dms) + { + case 25: + nTransWidth = 1; + startOffset = 6; + break; + case 50: + nTransWidth = 1; + startOffset = 12; + break; + case 100: + nTransWidth = 3; + startOffset = 24; + break; + } + + fac_ns = (8.0 - fac_ns_idx) / 16.0; + + j = 0; + + for (k = startOffset; k < bw_stopband; k++) { + allZeros = 1; + + start = k - nTransWidth; + end = MIN(bw_stopband - 1, k + nTransWidth); + + for (i = start; i <= end; i++) { + if (xq[i] != 0) { + allZeros = 0; + } + } + + if (allZeros == 1) { + zeroLines[j] = k; + kZeroLines++; + j++; + } + } + + for (k = 0; k < kZeroLines; k++) { + nfseed = (13849 + (nfseed + 32768) * 31821) & 65535; + nfseed -= 32768; + + if (nfseed >= 0) { + if (zeroLines[k] < spec_inv_idx) + { + xq[zeroLines[k]] = fac_ns; + } else { + xq[zeroLines[k]] = fac_ns_pc; + } + } else { + if (zeroLines[k] < spec_inv_idx) + { + xq[zeroLines[k]] = -fac_ns; + } else { + xq[zeroLines[k]] = -fac_ns_pc; + } + } + } + + return; +} diff --git a/lc3plus/olpa.c b/lc3plus/olpa.c new file mode 100755 index 0000000000..6bec50952e --- /dev/null +++ b/lc3plus/olpa.c @@ -0,0 +1,144 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); +static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); + +void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input) +{ + LC3_INT i = 0, j = 0; + LC3_FLOAT sum = 0; + /* a = 1, so denominator == 1, nothing to do here */ + + for (i = 0; i < len_input; i++) { + j = 0; + sum = 0; + for (j = 0; (j < len_buf) && (j <= i); j++) { + sum += buf[j] * in[i - j]; + } + + out[i] = sum; + } +} + +LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len) +{ + LC3_INT max_i = 0, i = 0; + LC3_FLOAT max = in[0]; + + if (len <= 0) { + return -128; + } + + for (i = 0; i < len; i++) { + if (in[i] > max) { + max = in[i]; + max_i = i; + } + } + + return max_i; +} + +void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4, LC3_INT* mem_old_T0, LC3_INT* T0_out, + LC3_FLOAT* normcorr_out, LC3_INT len, LC3_INT frame_dms) +{ + LC3_FLOAT norm_corr = 0, sum = 0, sum0 = 0, sum1 = 0, sum2 = 0, norm_corr2 = 0, *s6k4; + LC3_FLOAT buf[LEN_6K4 + MAX_PITCH_6K4] = {0}, filt_out[LEN_12K8 + 3] = {0}, d_wsp[LEN_6K4] = {0}, R0[RANGE_PITCH_6K4] = {0}, R[RANGE_PITCH_6K4] = {0}; /* constant length */ + LC3_INT i = 0, j = 0, len2 = 0, T0 = 0, T02 = 0, min_pitch = 0, max_pitch = 0, L = 0, mem_in_len = 0, acflen = 0; + + + mem_in_len = MAX_PITCH_6K4; + len2 = len / 2; + acflen = len2; + if (frame_dms == 25) + { + mem_in_len += 16; + acflen += 16; + } + + /* Downsampling */ + move_float(buf, mem_s12k8, 3); + move_float(&buf[3], s_12k8, len); + move_float(mem_s12k8, &buf[len], 3); + filter_olpa(buf, filt_out, olpa_down2, 5, len + 3); + for (i = 4, j = 0; i < len + 3; i = i + 2) { + d_wsp[j] = filt_out[i]; + j++; + } + + /* Compute autocorrelation */ + s6k4 = &buf[mem_in_len]; + move_float(buf, mem_s6k4, mem_in_len); + move_float(s6k4, d_wsp, len2); + move_float(mem_s6k4, &buf[len2], mem_in_len); + if (frame_dms == 25) + { + s6k4 = s6k4 - 16; + } + for (i = MIN_PITCH_6K4; i <= MAX_PITCH_6K4; i++) { + sum = 0; + for (j = 0; j < acflen; j++) { + sum += s6k4[j] * s6k4[j - i]; + } + R0[i - MIN_PITCH_6K4] = sum; + } + + /* Weight autocorrelation and find maximum */ + move_float(R, R0, RANGE_PITCH_6K4); + for (i = 0; i < RANGE_PITCH_6K4; i++) { + R0[i] = R0[i] * olpa_acw[i]; + } + L = searchMaxIndice(R0, RANGE_PITCH_6K4); + T0 = L + MIN_PITCH_6K4; + + /* Compute normalized correlation */ + sum0 = sum1 = sum2 = 0; + for (i = 0; i < acflen; i++) { + sum0 += s6k4[i] * s6k4[i - T0]; + sum1 += s6k4[i - T0] * s6k4[i - T0]; + sum2 += s6k4[i] * s6k4[i]; + } + sum1 = sum1 * sum2; + sum1 = LC3_SQRT(sum1) + LC3_POW(10.0, -5.0); + norm_corr = sum0 / sum1; + norm_corr = MAX(0, norm_corr); + + /* Second try in the neighborhood of the previous pitch */ + min_pitch = MAX(MIN_PITCH_6K4, *mem_old_T0 - 4); + max_pitch = MIN(MAX_PITCH_6K4, *mem_old_T0 + 4); + L = searchMaxIndice(&R[min_pitch - MIN_PITCH_6K4], max_pitch - min_pitch + 1 ); + T02 = L + min_pitch; + + if (T02 != T0) { + sum0 = sum1 = sum2 = 0; + for (i = 0; i < acflen; i++) { + sum0 += s6k4[i] * s6k4[i - T02]; + sum1 += s6k4[i - T02] * s6k4[i - T02]; + sum2 += s6k4[i] * s6k4[i]; + } + sum1 = sum1 * sum2; + sum1 = LC3_SQRT(sum1) + LC3_POW(10.0, -5.0); + norm_corr2 = sum0 / sum1; + norm_corr2 = MAX(0, norm_corr2); + + if (norm_corr2 > (norm_corr * 0.85)) { + T0 = T02; + norm_corr = norm_corr2; + } + } + + *mem_old_T0 = T0; + *T0_out = T0 * 2.0; + *normcorr_out = norm_corr; +} diff --git a/lc3plus/pc_apply.c b/lc3plus/pc_apply.c new file mode 100755 index 0000000000..1d1bc40005 --- /dev/null +++ b/lc3plus/pc_apply.c @@ -0,0 +1,73 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPcApply_fl(LC3_FLOAT *q_res, LC3_FLOAT *q_old_res, LC3_FLOAT *q_d_prev, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_FLOAT *prev_gg, LC3_FLOAT *fac, LC3_INT32 *pc_nbLostCmpt) +{ + LC3_FLOAT gg, mean_nrg_low, mean_nrg_high, ener_prev, ener_curr, fac_local; + LC3_INT32 i; + + ener_prev = 0; ener_curr = 0; mean_nrg_low = 0; mean_nrg_high = 0; + + *pc_nbLostCmpt = *pc_nbLostCmpt + 1; + + assert(spec_inv_idx > 1); + + gg = LC3_POW(10, (((LC3_FLOAT) (gg_idx + gg_idx_off)) / 28.0)); + + for (i = 0; i < spec_inv_idx; i++) + { + mean_nrg_low += LC3_POW(q_d_prev[i], 2); + } + + mean_nrg_low /= (LC3_FLOAT) spec_inv_idx; + + if (spec_inv_idx < yLen) + { + for (i = spec_inv_idx; i < yLen; i++) + { + mean_nrg_high += LC3_POW(q_d_prev[i], 2); + } + } + + mean_nrg_high /= (LC3_FLOAT) (yLen - spec_inv_idx); + + for (i = 0; i < spec_inv_idx; i++) + { + ener_prev += LC3_POW(q_old_res[i], 2); + ener_curr += LC3_POW(q_res[i], 2); + } + + *fac = 1; + if (ener_prev > 0) + { + *fac = LC3_SQRT(ener_curr / ener_prev); + } + + fac_local = *fac; + if (mean_nrg_low <= mean_nrg_high || ener_prev * LC3_POW(*prev_gg, 2) <= ener_curr * LC3_POW(gg, 2)) + { + fac_local = *prev_gg / gg; + } + + for (i = spec_inv_idx; i < yLen; i++) + { + q_res[i] = q_old_res[i] * fac_local; + + if (LC3_FABS(q_res[i]) < (1 - 0.375)) + { + q_res[i] = 0; + } + } +} + diff --git a/lc3plus/pc_classify.c b/lc3plus/pc_classify.c new file mode 100755 index 0000000000..71196edb89 --- /dev/null +++ b/lc3plus/pc_classify.c @@ -0,0 +1,170 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +LC3_FLOAT pc_peak_detector(LC3_FLOAT *q_d_prev, LC3_INT32 yLen); + +void processPcClassify_fl(LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *q_d_prev, LC3_FLOAT *q_old_res, LC3_INT32 yLen, LC3_INT32 spec_inv_idx, LC3_FLOAT stab_fac, LC3_INT32 *bfi) +{ + LC3_INT32 maxPitchBin, xover, i; + LC3_FLOAT part_nrg, full_nrg; + + part_nrg = 0; full_nrg = 0; + + if (spec_inv_idx < (4 * frame_dms / 10)) + { + if (stab_fac < 0.5) + { + *bfi = 1; + } else if (pitch_present == 1) + { + maxPitchBin = 8; + if (frame_dms == 50) + { + maxPitchBin = 4; + } + xover = pc_peak_detector(q_d_prev, yLen); + if (spec_inv_idx < xover || spec_inv_idx < maxPitchBin) + { + *bfi = 1; + } + } else { + for (i = 0; i < spec_inv_idx; i++) + { + part_nrg += LC3_POW(q_old_res[i], 2); + } + + for (i = 0; i < yLen; i++) + { + full_nrg += LC3_POW(q_old_res[i], 2); + } + + if (part_nrg < (0.3 * full_nrg)) + { + *bfi = 1; + } + } + } +} + +LC3_FLOAT pc_peak_detector(LC3_FLOAT *q_d_prev, LC3_INT32 yLen) +{ + LC3_INT32 block_size, thresh1, i, peak, j, k; + LC3_FLOAT fac, mean_block_nrg, cur_max, block_cent, maxPeak, next_max, prev_max; + + mean_block_nrg = 0; + + block_size = 3; + thresh1 = 8; + fac = 0.3; + + for (i = 0; i < yLen; i++) + { + mean_block_nrg += LC3_POW(q_d_prev[i], 2); + } + + mean_block_nrg /= yLen; + + maxPeak = 0; + peak = 0; + + if (LC3_FABS(q_d_prev[0]) > LC3_FABS(q_d_prev[1])) + { + block_cent = LC3_POW(q_d_prev[0], 2) + LC3_POW(q_d_prev[1], 2); + + if ((block_cent / block_size) > (thresh1 * mean_block_nrg)) + { + cur_max = MAX(LC3_FABS(q_d_prev[0]), LC3_FABS(q_d_prev[1])); + next_max = array_max_abs(&q_d_prev[2], 3); + + if (cur_max > next_max) + { + maxPeak = block_cent; + peak = 1; + } + } + } + + for (i = 0; i < block_size; i++) + { + if ((LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i])) && LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i + 2])) + { + block_cent = 0; + for (j = i; j < i + block_size; j++) + { + block_cent += LC3_POW(q_d_prev[j], 2); + } + + if ((block_cent / block_size) > (thresh1 * mean_block_nrg)) + { + cur_max = array_max_abs(&q_d_prev[i], block_size); + prev_max = 0; + + for (k = i - block_size; k < i; k++) + { + if (k > 0) + { + prev_max = MAX(LC3_FABS(q_d_prev[k]), prev_max); + } + } + next_max = array_max_abs(&q_d_prev[i + block_size], block_size); + + if ((cur_max >= prev_max) && (cur_max > next_max)) + { + if (block_cent > (fac * maxPeak)) + { + peak = i + block_size - 1; + if (block_cent >= maxPeak) + { + maxPeak = block_cent; + } + } + } + } + } + } + + for (i = block_size; i < yLen - (2 * block_size); i++) + { + if ((LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i])) && LC3_FABS(q_d_prev[i + 1]) >= LC3_FABS(q_d_prev[i + 2])) + { + block_cent = 0; + for (j = i; j < i + block_size; j++) + { + block_cent += LC3_POW(q_d_prev[j], 2); + } + + if ((block_cent / block_size) > (thresh1 * mean_block_nrg)) + { + cur_max = array_max_abs(&q_d_prev[i], block_size); + prev_max = array_max_abs(&q_d_prev[i - block_size], block_size); + next_max = array_max_abs(&q_d_prev[i + block_size], block_size); + + if ((cur_max >= prev_max) && (cur_max > next_max)) + { + if (block_cent > (fac * maxPeak)) + { + peak = i + block_size - 1; + if (block_cent >= maxPeak) + { + maxPeak = block_cent; + } + } + } + } + } + } + + return peak; +} + diff --git a/lc3plus/pc_main.c b/lc3plus/pc_main.c new file mode 100755 index 0000000000..268ee94d2a --- /dev/null +++ b/lc3plus/pc_main.c @@ -0,0 +1,43 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPcMain_fl(LC3_INT32 *bfi, LC3PLUS_Dec* decoder, LC3_FLOAT *sqQdec, DecSetup* h_DecSetup, LC3_INT32 pitch_present, LC3_FLOAT stab_fac, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 fac_ns_idx, pcState *statePC, LC3_INT32 spec_inv_idx, LC3_INT32 yLen) +{ + LC3_FLOAT fac; + + /* PC Classifier */ + if (*bfi == 2) + { + processPcClassify_fl(pitch_present, decoder->frame_dms, h_DecSetup->PlcSetup.q_d_prev, statePC->q_old_res, decoder->yLen, h_DecSetup->spec_inv_idx, stab_fac, bfi); + } + + /* PC Apply */ + if (*bfi == 2) + { + processPcApply_fl(sqQdec, statePC->q_old_res, h_DecSetup->PlcSetup.q_d_prev, h_DecSetup->spec_inv_idx, decoder->yLen, gg_idx, gg_idx_off, &statePC->prev_gg, &fac, &statePC->ns_nbLostCmpt_pc); + } + + /* PC Update */ + if (*bfi != 1) + { + processPcUpdate_fl(*bfi, sqQdec, gg_idx, gg_idx_off, decoder->rframe, &h_DecSetup->BW_cutoff_idx_nf, &h_DecSetup->prev_BW_cutoff_idx_nf, fac_ns_idx, &h_DecSetup->prev_fac_ns, &fac, statePC->q_old_res, &statePC->prev_gg, spec_inv_idx, yLen); + } + + /* Reset counter */ + if (*bfi == 0) + { + statePC->ns_nbLostCmpt_pc = 0; + } +} + diff --git a/lc3plus/pc_update.c b/lc3plus/pc_update.c new file mode 100755 index 0000000000..57539b5079 --- /dev/null +++ b/lc3plus/pc_update.c @@ -0,0 +1,37 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPcUpdate_fl(LC3_INT32 bfi, LC3_FLOAT *q_res, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 rframe, LC3_INT32 *BW_cutoff_idx_nf, LC3_INT32 *prev_BW_cutoff_idx_nf, + LC3_INT32 fac_ns_idx, LC3_FLOAT *prev_fac_ns, LC3_FLOAT *fac, LC3_FLOAT *q_old_res, LC3_FLOAT *prev_gg, LC3_INT32 spec_inv_idx, LC3_INT32 yLen) +{ + LC3_FLOAT gg; + + gg = LC3_POW(10.0, ((LC3_FLOAT) (gg_idx + gg_idx_off)) / 28.0); + *prev_gg = gg; + move_float(q_old_res, q_res, yLen); + + if (rframe == 0) + { + *prev_BW_cutoff_idx_nf = *BW_cutoff_idx_nf; + *prev_fac_ns = (8.0 - (LC3_FLOAT) fac_ns_idx) / 16.0; + } else if ((bfi == 2) && (*BW_cutoff_idx_nf != *prev_BW_cutoff_idx_nf) && (spec_inv_idx < yLen)) + { + *BW_cutoff_idx_nf = *prev_BW_cutoff_idx_nf; + *prev_fac_ns = *prev_fac_ns * (*fac); + *prev_fac_ns = MAX(*prev_fac_ns, (8.0 - 7.0) / 16.0); + *prev_fac_ns = MIN(*prev_fac_ns, (8.0 - 0.0) / 16.0); + } + +} + diff --git a/lc3plus/per_band_energy.c b/lc3plus/per_band_energy.c new file mode 100755 index 0000000000..db1b5b2d0f --- /dev/null +++ b/lc3plus/per_band_energy.c @@ -0,0 +1,59 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) +{ + LC3_INT i = 0, j = 0, start = 0, stop = 0, maxBwBin = 0; + LC3_FLOAT sum = 0; + +# ifdef ENABLE_HR_MODE_FL + if (hrmode) + { + maxBwBin = MAX_BW_HR; + } + else +# else + UNUSED(hrmode); +# endif + { + maxBwBin = MAX_BW; + } + switch (frame_dms) + { +# ifdef ENABLE_2_5MS_MODE + case 25: + maxBwBin = maxBwBin >> 2; + break; +# endif +# ifdef ENABLE_5MS_MODE + case 50: + maxBwBin = maxBwBin >> 1; + break; +# endif + } + + for (i = 0; i < bands_number; i++) { + sum = 0; + start = acc_coeff_per_band[i]; + stop = MIN(acc_coeff_per_band[i + 1], maxBwBin); + + for (j = start; j < stop; j++) { + sum += d[j] * d[j]; + } + + if (stop - start > 0) { + sum = sum / (LC3_FLOAT)(stop - start); + } + d2[i] = sum; + } +} diff --git a/lc3plus/plc_classify.c b/lc3plus/plc_classify.c new file mode 100755 index 0000000000..619a1f7419 --- /dev/null +++ b/lc3plus/plc_classify.c @@ -0,0 +1,199 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +static void plc_xcorr_lc(LC3_FLOAT *pcmbufHist, LC3_INT32 max_len_pcm_plc, LC3_INT32 pitch_int, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 fs, LC3_FLOAT *xcorr); +static void spectral_centroid_lc(LC3_FLOAT *gains, LC3_INT32 tilt, const LC3_INT *bands_offset, LC3_INT32 bands_number, LC3_INT32 framelength, LC3_INT32 fs, LC3_FLOAT *sc); + +void processPlcClassify_fl(LC3_INT plcMeth, LC3_INT *concealMethod, LC3_INT32 *nbLostCmpt, LC3_INT32 bfi, + LC3_FLOAT *xcorr, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 pitch_int, + LC3_INT32 fs, const LC3_INT *band_offsets, LC3_INT32 bands_number, LC3_INT32 tilt, PlcAdvSetup *plcAd + , LC3_INT32 hrmode +) +{ + LC3_FLOAT sc, class; + + if (plcAd) + { + *xcorr = 0; + } + + if (bfi == 1) + { + *nbLostCmpt = *nbLostCmpt + 1; + + /* Use pitch correlation at ltpf integer lag if available */ + if (*nbLostCmpt == 1) + { + *concealMethod = plcMeth; // this is a dangerous mapping! + + /* Advanced PLC */ + if (pitch_int > 0) + { + *concealMethod = 3; /* Timedomain PLC assumed */ + plc_xcorr_lc(plcAd->pcmbufHist, plcAd->max_len_pcm_plc, pitch_int, framelength, frame_dms, fs, xcorr); + + spectral_centroid_lc(plcAd->scf_q_old, tilt, band_offsets, bands_number, framelength, fs, &sc); + class = *xcorr * 7640.0/32768.0 - sc - 5112.0/32768.0; + + if (class <= 0) + { + if (frame_dms == 100 && hrmode == 0) + { + *concealMethod = 2; /* PhaseEcu selected */ + } + else + { + *concealMethod = 4; /* Noise Substitution */ + } + } + } + else + { + *concealMethod = 4; /* Noise Substitution */ + } + } + } +} + +static void spectral_centroid_lc(LC3_FLOAT *gains, LC3_INT32 tilt, const LC3_INT *band_offsets, LC3_INT32 bands_number, LC3_INT32 framelength, LC3_INT32 fs, LC3_FLOAT *sc) +{ + LC3_FLOAT gains_lin[M], gains_dee[M], numerator, denumerator; + LC3_INT32 i, j, sum, len, start, stop; + LC3_INT band_offsets_local[MAX_BANDS_NUMBER + 1]; + + numerator = 0; + + for (i = 0; i < M; i++) + { + gains_lin[i] = LC3_POW(2, gains[i]); + } + + for (i = 0; i < M; i++) + { + gains_dee[i] = gains_lin[i] / LC3_POW(10, i * (LC3_FLOAT) tilt / (LC3_FLOAT) (M - 1) / 10.0); + } + + if (bands_number == 64) + { + memmove(band_offsets_local, band_offsets, (bands_number + 1) * sizeof(LC3_INT)); + } + + if (bands_number < 32) + { + band_offsets_local[0] = 0; + j = 32 - bands_number; + for (i = bands_number - 1; i >= j; i--) + { + band_offsets_local[(i + j) * 2 + 1 + 1] = band_offsets[i + 1]; + band_offsets_local[(i + j) * 2 + 0 + 1] = band_offsets[i + 1]; + } + for (i = j - 1; i >= 0; i--) + { + band_offsets_local[i * 4 + 3 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 4 + 2 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 4 + 1 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 4 + 0 + 1] = band_offsets[i + 1]; + } + } + else + if (bands_number < 64) + { + band_offsets_local[0] = 0; + j = 64 - bands_number; + for (i = bands_number - 1; i >= j; i--) + { + band_offsets_local[i + j + 1] = band_offsets[i + 1]; + } + for (i = j - 1; i >= 0; i--) + { + band_offsets_local[i * 2 + 1 + 1] = band_offsets[i + 1]; + band_offsets_local[i * 2 + 0 + 1] = band_offsets[i + 1]; + } + } + + denumerator = 0.001; + + for (i = 0; i < M; i++) + { + sum = 0; len = 0; + start = band_offsets_local[i * 4] + 1; stop = band_offsets_local[i * 4 + 4]; + + for (j = stop; j >= start; j--) + { + sum += j; + len++; + } + + numerator += gains_dee[i] * ((LC3_FLOAT) sum / (LC3_FLOAT) framelength); + denumerator += gains_dee[i] * len; + } + + *sc = numerator / denumerator; + *sc = *sc * (LC3_FLOAT) fs / 48000.0; /* scaling, because training is for 48kHz */ +} + +static void plc_xcorr_lc(LC3_FLOAT *pcmbufHist, LC3_INT32 max_len_pcm_plc, LC3_INT32 pitch_int, LC3_INT32 framelength, + LC3_INT32 frame_dms, LC3_INT32 fs, LC3_FLOAT *xcorr) +{ + LC3_INT32 max_corr_len, pitch_min, corr_len, min_corr_len, pcm_max_corr_len, range1Start, range2Start, i; + LC3_FLOAT norm_w, norm_w_t; + + norm_w_t = 0; norm_w = 0; + + assert(pitch_int >= 0); + assert(pitch_int <= MAX_LEN*100*MAX_PITCH_12K8/12800); + + *xcorr = 0; + + if (pitch_int > 0) + { + pitch_min = fs * MIN_PITCH_12K8/12800; + pcm_max_corr_len = max_len_pcm_plc - pitch_int; + + min_corr_len = 2 * pitch_min; /* at least 5 ms (=2*pitchmin*) corr length */ + max_corr_len = framelength*100/frame_dms; /* maximum 10 ms */ + max_corr_len = MIN( max_corr_len, pcm_max_corr_len ); + + corr_len = MIN( max_corr_len, pitch_int ); /* pitch_int is prefered, but maximum 10ms or left pcm buf size */ + corr_len = MAX( min_corr_len, corr_len ); + + range1Start = max_len_pcm_plc - corr_len; + range2Start = range1Start - pitch_int; + + assert( corr_len >= min_corr_len ); + assert( corr_len <= max_corr_len ); + assert( range2Start >= 0 ); + + for (i = 0; i < corr_len; i++) + { + norm_w += pcmbufHist[range1Start + i] * pcmbufHist[range1Start + i]; + } + + for (i = 0; i < corr_len; i++) + { + norm_w_t += pcmbufHist[range2Start + i] * pcmbufHist[range2Start + i]; + } + + for (i = 0; i < corr_len; i++) + { + *xcorr = *xcorr + pcmbufHist[range1Start + i] * pcmbufHist[range2Start + i]; + } + + *xcorr = *xcorr / sqrt(norm_w * norm_w_t + 0.1); + *xcorr = MAX(0, *xcorr); + } else { + *xcorr = 0; + } +} + diff --git a/lc3plus/plc_compute_stab_fac.c b/lc3plus/plc_compute_stab_fac.c new file mode 100755 index 0000000000..4a1111a2c7 --- /dev/null +++ b/lc3plus/plc_compute_stab_fac.c @@ -0,0 +1,64 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +static void processPlcComputeStabFac_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_INT32 prev_bfi, LC3_FLOAT *stab_fac); + +void processPlcComputeStabFacMain_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_FLOAT *old_old_scf_q, LC3_INT32 bfi, LC3_INT32 prev_bfi, + LC3_INT32 prev_prev_bfi, LC3_FLOAT *stab_fac) +{ + if (bfi == 1) + { + if (prev_bfi != 1) + { + processPlcComputeStabFac_fl(old_scf_q, old_old_scf_q, prev_prev_bfi, stab_fac); + } + } + else if (bfi == 2) + { + processPlcComputeStabFac_fl(scf_q, old_scf_q, prev_bfi, stab_fac); + } +} + +static void processPlcComputeStabFac_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_INT32 prev_bfi, LC3_FLOAT *stab_fac) +{ + LC3_FLOAT tmp; + LC3_INT32 i; + + tmp = 0; + + if (prev_bfi == 1) + { + *stab_fac = 0.8; + } + else + { + for (i = 0; i < M; i++) + { + tmp += (scf_q[i] - old_scf_q[i]) * (scf_q[i] - old_scf_q[i]); + } + + *stab_fac = 1.25 - tmp / 25.0; + + if (*stab_fac > 1) + { + *stab_fac = 1; + } + + if (*stab_fac < 0) + { + *stab_fac = 0; + } + } +} + diff --git a/lc3plus/plc_damping_scrambling.c b/lc3plus/plc_damping_scrambling.c new file mode 100755 index 0000000000..ecea32be5f --- /dev/null +++ b/lc3plus/plc_damping_scrambling.c @@ -0,0 +1,206 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, + LC3_INT32 *pc_seed, LC3_INT32 ns_nbLostCmpt_pc, + LC3_INT32 ns_nbLostCmpt, LC3_FLOAT *stabFac, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, + LC3_FLOAT *spec_prev, LC3_FLOAT *spec, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 bfi, + LC3_INT32 frame_dms, LC3_INT32 concealMethod, LC3_INT32 pitch_present_bfi1, LC3_INT32 pitch_present_bfi2, + LC3_FLOAT *cum_fflcAtten) +{ + + LC3_INT32 processDampScramb; + + processDampScramb = 0; + + + if ( bfi != 0 ) + { + if (concealMethod == 4 || bfi == 2) + { + processDampScramb = 1; + } + if ( bfi == 1 ) + { + processPlcDampingScrambling_fl(spec, yLen, ns_nbLostCmpt, stabFac, processDampScramb, cum_fflcAtten, + pitch_present_bfi1, frame_dms, cum_fading_slow, cum_fading_fast, ns_seed, 0); + } + else /* bfi == 2 */ + { + processPlcDampingScrambling_fl(spec, yLen, ns_nbLostCmpt_pc, stabFac, processDampScramb, cum_fflcAtten, + pitch_present_bfi2, frame_dms, cum_fading_slow, cum_fading_fast, pc_seed, spec_inv_idx); + processPlcUpdateSpec_fl(spec_prev, spec, yLen); + } + } +} + +void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 nbLostCmpt, LC3_FLOAT *stabFac, LC3_INT32 processDampScramb, + LC3_FLOAT *cum_fflcAtten, LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *cum_fading_slow, + LC3_FLOAT *cum_fading_fast, LC3_INT32 *seed, LC3_INT32 spec_inv_idx) +{ + LC3_INT32 plc_start_inFrames, plc_end_inFrames, plc_duration_inFrames, x, b, i, ad_ThreshFac_start; + LC3_FLOAT slow, fast, linFuncStartStop, randThreshold, ad_ThreshFac_end, ad_threshFac, frame_energy, mean_energy, energThreshold, fac, m, n, fflcAtten, cum_fading_slow_local, cum_fading_fast_local; + + frame_energy = 0; + + /* Main process */ + if (nbLostCmpt == 1) + { + *cum_fading_slow = 1; + *cum_fading_fast = 1; + *cum_fflcAtten = 1; + } + + slow = 0.8 + 0.2 * (*stabFac); + fast = 0.3 + 0.2 * (*stabFac); + + switch (frame_dms) + { + case 25: + slow = LC3_SQRT(LC3_SQRT(slow)); + fast = LC3_SQRT(LC3_SQRT(fast)); + break; + case 50: + slow = LC3_SQRT(slow); + fast = LC3_SQRT(fast); + break; + } + + *cum_fading_slow = *cum_fading_slow * slow; + *cum_fading_fast = *cum_fading_fast * fast; + + if (processDampScramb == 1) + { + fflcAtten = 1; + cum_fading_slow_local = *cum_fading_slow; + cum_fading_fast_local = *cum_fading_fast; + + if (spec_inv_idx == 0) + { + if (nbLostCmpt * frame_dms > PLC_FADEOUT_IN_MS * 10) + { + fflcAtten = 0; + *cum_fflcAtten = 0; + } + else if (nbLostCmpt * frame_dms > 200) + { + switch(frame_dms) + { + case 25: fflcAtten = PLC34_ATTEN_FAC_025; break; + case 50: fflcAtten = PLC34_ATTEN_FAC_050; break; + case 100: fflcAtten = PLC34_ATTEN_FAC_100; break; + } + } + + + *cum_fflcAtten = *cum_fflcAtten * fflcAtten; + cum_fading_slow_local = *cum_fading_slow * *cum_fflcAtten; + cum_fading_fast_local = *cum_fading_fast * *cum_fflcAtten; + } + + if (pitch_present == 0) + { + plc_start_inFrames = 1; + } else { + plc_start_inFrames = floor(PLC4_TRANSIT_START_IN_MS / (frame_dms / 10.0)); + } + + plc_end_inFrames = floor(PLC4_TRANSIT_END_IN_MS / (frame_dms / 10.0)); + plc_duration_inFrames = plc_end_inFrames - plc_start_inFrames; + + if (nbLostCmpt <= plc_start_inFrames) + { + linFuncStartStop = 1; + } else if (nbLostCmpt >= plc_end_inFrames) + { + linFuncStartStop = 0; + } else { + x = nbLostCmpt; + m = -1.0 / plc_duration_inFrames; + b = -plc_end_inFrames; + linFuncStartStop = m * (x + b); + } + + randThreshold = -32768 * linFuncStartStop; + + for (i = spec_inv_idx; i < yLen; i++) + { + *seed = 16831 + *seed * 12821; + + *seed = (LC3_INT16)(*seed); + if (*seed == 32768) + { + *seed -= 32768; + } + + if (*seed < 0) + { + if (pitch_present == 0 || *seed < randThreshold) + { + spec[i] = -spec[i]; + } + } + } + + ad_ThreshFac_start = 10; + ad_ThreshFac_end = 1.2; + ad_threshFac = (ad_ThreshFac_start - ad_ThreshFac_end) * linFuncStartStop + ad_ThreshFac_end; + + if (spec_inv_idx < yLen) + { + for (i = spec_inv_idx; i < yLen; i++) + { + frame_energy = frame_energy + (spec[i] * spec[i]); + } + + mean_energy = frame_energy * 1 / (yLen - spec_inv_idx); + } + else + { + mean_energy = 0; + } + + energThreshold = LC3_SQRT(ad_threshFac * mean_energy); + fac = (cum_fading_slow_local - cum_fading_fast_local) * energThreshold; + + for (i = spec_inv_idx; i < yLen; i++) + { + if (LC3_FABS(spec[i]) < energThreshold) + { + m = cum_fading_slow_local; + n = 0; + } + else + { + m = cum_fading_fast_local; + + if (spec[i] > 0) + { + n = fac; + } + else if (spec[i] == 0) + { + n = 0; + } + else + { + n = -fac; + } + } + + spec[i] = m * spec[i] + n; + } + } +} + diff --git a/lc3plus/plc_main.c b/lc3plus/plc_main.c new file mode 100755 index 0000000000..df3fd184d9 --- /dev/null +++ b/lc3plus/plc_main.c @@ -0,0 +1,209 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, + PlcAdvSetup *PlcAdvSetup, PlcSetup *PlcSetup, LC3_INT plcMeth, LC3_INT ltpf_pitch_int, LC3_INT ltpf_pitch_fr, + LC3_INT tilt, const LC3_INT *bands_offset, LC3_INT bands_number, const LC3_INT *bands_offsetPLC, + LC3_INT n_bandsPLC, LC3_INT16 hrmode, pcState *statePC +) +{ + LC3_FLOAT r[MAX_BANDS_NUMBER_PLC], A[M + 1], synth[MAX_LEN + MDCT_MEM_LEN_MAX], energies[MAX_BANDS_NUMBER_PLC]; + LC3_INT32 pitch_classifier; + LC3_FLOAT xcorr; + LC3_INT32 yLen; + LC3_INT16 prev_bfi_plc2; + LC3_FLOAT phEcu_env_stab_local[1]; + LC3_FLOAT phEcu_pfind_sens[1]; + + prev_bfi_plc2 = 1; + if (PlcSetup->nbLostCmpt == 0) + { + prev_bfi_plc2 = 0; + } + assert((h_DecSetup->PlcSetup.prevBfi == 1) == (prev_bfi_plc2 == 1)); + + if (bfi == 1 && PlcAdvSetup) + { + /* FFLC increases the PFLC counter */ + statePC->ns_nbLostCmpt_pc = statePC->ns_nbLostCmpt_pc + 1; + } + + pitch_classifier = ltpf_pitch_int; +#ifdef NONBE_PLC_CLASSIFER_LAG_FIX + if (ltpf_pitch_fr > 2) + { + pitch_classifier++; + } +#endif + + processPlcClassify_fl(plcMeth, &h_DecSetup->concealMethod, &PlcSetup->nbLostCmpt, bfi, &xcorr, + decoder->frame_length, decoder->frame_dms, pitch_classifier, decoder->fs, + bands_offset, bands_number, tilt, PlcAdvSetup, hrmode + ); + + if (bfi == 1) + { + switch (h_DecSetup->concealMethod) + { + case 2: + { + LC3_FLOAT pitch_fl_c; + + assert(decoder->fs_idx == floor(decoder->fs / 10000)); + // phaseECU supports only 10ms framing + assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100); + + if (decoder->frame_dms != 100) + { + // muting, if frame size changed during phaseECU concealment + memset(q_d_fl_c, 0, sizeof(LC3_FLOAT) * decoder->frame_length); + h_DecSetup->alpha = 0; + break; + } + + /* call phaseEcu */ + pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */ + + + if (prev_bfi_plc2 == 0) + { + /* convert fractional pitch lag info at current fs to a normalized fractional bin-frequency */ + PlcAdvSetup->PlcPhEcuSetup.PhECU_f0hzLtpBin = plc_phEcuSetF0Hz(decoder->fs, &pitch_fl_c); + /* several buffers used in Cflt , a copy pcmbufHist, right before calling PhEcu in bad frames */ + assert(bfi == 1); + move_float(PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp, + &(PlcAdvSetup->pcmbufHist[PlcAdvSetup->max_len_pcm_plc - PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot]), + PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot); + + /* a first bfi frame:: calc windowed 16 ms energy twice in a 26 ms buffer separated by 10 ms*/ + { + const LC3_FLOAT *w, *prev_xfp; + LC3_INT32 i, oold_start; + + oold_start = PlcAdvSetup->max_len_pcm_plc - (decoder->frame_length + PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot); + assert(oold_start > 0); + w = PhECU_whr16ms_wins[decoder->fs_idx]; /* hammrect table */ + prev_xfp = &(PlcAdvSetup->pcmbufHist[oold_start + 0]); + + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E = 0; + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E = 0; + for (i = 0; i < PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot; i++) + { + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E += sqrf(prev_xfp[i] * w[i]); + PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E += sqrf(PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp[i] * w[i]); + } + + } + + } /* (prev_bfi_plc2 == 0)*/ + else + { + /* overwrite last 3.75 ms of xfp with most recent pcmbufHist tail , right before calling PhEcu in bursts of bad frames */ + LC3_INT32 lenCopyOla = decoder->la_zeroes; /*copy_part + ola_part = 3.75 ms for 10 ms frame*/ + + assert(bfi == 1 && prev_bfi_plc2); + move_float(&(PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp[PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot-lenCopyOla]), + &(PlcAdvSetup->pcmbufHist[PlcAdvSetup->max_len_pcm_plc - lenCopyOla]), lenCopyOla); + + } + + { + LC3_FLOAT x_tda[MAX_LEN]; /* 960/2 */ + PlcAdvSetup->PlcPhEcuSetup.PhECU_norm_corr = xcorr; + phEcu_env_stab_local[0] = (LC3_FLOAT)PHECU_ENV_STAB_LOCAL; + phEcu_pfind_sens[0] = (LC3_FLOAT)PHECU_PFIND_SENS; + + plc_phEcu_hq_ecu(&(PlcAdvSetup->PlcPhEcuSetup.PhECU_f0hzLtpBin), + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_norm_corr), + PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp, + prev_bfi_plc2, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev), + decoder->fs, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_time_offs), + PlcAdvSetup->PlcPhEcuSetup.PhECU_X_sav_m, /* Complex */ + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_num_plocs), + PlcAdvSetup->PlcPhEcuSetup.PhECU_plocs, + PlcAdvSetup->PlcPhEcuSetup.PhECU_f0est, + MDCT_WINS_10ms[hrmode][decoder->fs_idx], + + phEcu_env_stab_local, + PHECU_DELTA_CORR, + phEcu_pfind_sens, + PHECU_LA, + PlcAdvSetup->PlcPhEcuSetup.PhECU_t_adv, + PhECU_whr16ms_wins[decoder->fs_idx], + PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E), + PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape, + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E), + &(PlcAdvSetup->PlcPhEcuSetup.PhECU_beta_mute), + PlcAdvSetup->PlcPhEcuSetup.PhECU_mag_chg_1st, + PlcAdvSetup->PlcPhEcuSetup.PhECU_Xavg, + decoder->la_zeroes, + x_tda, /* time domain aliased output */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + , + &(PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft), + &(PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft) + ); + + + ProcessingITDA_WIN_OLA_fl(x_tda, decoder->frame_length, decoder->imdct_win, decoder->imdct_winLen, decoder->imdct_laZeros, + h_DecSetup->imdct_mem, synth); + move_float(syntM_fl_c, synth, decoder->frame_length); + + + + } + } + break; + case 3: + if (PlcSetup->nbLostCmpt == 1) + { + PlcAdvSetup->PlcTdcSetup.fract = ltpf_pitch_fr; + } + + processPerBandEnergy_fl(n_bandsPLC, bands_offsetPLC, hrmode, decoder->frame_dms, energies, PlcSetup->q_d_prev); + processTdcPreemphasis_fl(energies, &PlcAdvSetup->PlcTdcSetup.preemphFac, n_bandsPLC); + processTdcInverseOdft_fl(energies, n_bandsPLC, r, PlcAdvSetup->PlcTdcSetup.lpcorder); + processTdcLpcEstimation_fl(r, decoder->fs_idx, PlcAdvSetup->PlcTdcSetup.lpcorder + 1, A, decoder->frame_dms); + processTdcApply_fl(ltpf_pitch_int, &PlcAdvSetup->PlcTdcSetup.preemphFac, A, PlcAdvSetup->PlcTdcSetup.lpcorder, PlcAdvSetup->pcmbufHist, PlcAdvSetup->max_len_pcm_plc, decoder->frame_length, + decoder->frame_dms, decoder->fs, PlcSetup->nbLostCmpt, decoder->frame_length - decoder->la_zeroes, &PlcAdvSetup->stabFac, PlcAdvSetup->PlcTdcSetup.harmonicBuf, + PlcAdvSetup->PlcTdcSetup.synthHist, &PlcAdvSetup->PlcTdcSetup.fract, &PlcAdvSetup->PlcTdcSetup.seed, &PlcAdvSetup->PlcTdcSetup.gain_c, + &h_DecSetup->alpha, synth); + + processTdcTdac_fl(synth, decoder->imdct_win, decoder->frame_length, decoder->la_zeroes, h_DecSetup->imdct_mem); + memmove(syntM_fl_c, synth, sizeof(LC3_FLOAT) * decoder->frame_length); + break; + case 4: + processNoiseSubstitution_fl(q_d_fl_c, PlcSetup->q_d_prev, decoder->yLen); + break; + default: + assert("Invalid PLC method!"); + } + } + + if (bfi == 0) + { + processPlcUpdateSpec_fl(PlcSetup->q_d_prev, q_d_fl_c, decoder->yLen); + } + + yLen = MIN(decoder->frame_length, MAX_PLC_LMEM); + if (PlcAdvSetup != NULL && (decoder->frame_dms == 100) && (hrmode == 0)) + { + /* BASOP processPLCspec2shape_fx(prev_bfi, bfi, q_old_d_fx, yLen, plcAd->PhECU_oold_grp_shape_fx, plcAd->PhECU_old_grp_shape_fx);*/ + plc_phEcu_processPLCspec2shape(prev_bfi_plc2, bfi, q_d_fl_c, yLen, + PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape, PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape); + } +} + diff --git a/lc3plus/plc_noise_substitution.c b/lc3plus/plc_noise_substitution.c new file mode 100755 index 0000000000..4913ee53e5 --- /dev/null +++ b/lc3plus/plc_noise_substitution.c @@ -0,0 +1,22 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processNoiseSubstitution_fl(LC3_FLOAT* spec, LC3_FLOAT* spec_prev, LC3_INT32 yLen) +{ + memmove(spec, spec_prev, sizeof(LC3_FLOAT) * yLen); + + spec[0] *= 0.2; + spec[1] *= 0.5; +} + diff --git a/lc3plus/plc_noise_substitution0.c b/lc3plus/plc_noise_substitution0.c new file mode 100755 index 0000000000..da050e3dd2 --- /dev/null +++ b/lc3plus/plc_noise_substitution0.c @@ -0,0 +1,14 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + diff --git a/lc3plus/plc_phecu_f0_refine_first.c b/lc3plus/plc_phecu_f0_refine_first.c new file mode 100755 index 0000000000..11ebf276b1 --- /dev/null +++ b/lc3plus/plc_phecu_f0_refine_first.c @@ -0,0 +1,75 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_F0_refine_first( LC3_INT32 *plocs, /* i/o 0 ... Lprot/2 +1*/ + LC3_INT32 n_plocs, + LC3_FLOAT *f0est, /* i/o f0est */ + const LC3_INT32 Xabs_len, + LC3_FLOAT *f0binPtr, /* i */ + LC3_FLOAT *f0gainPtr, /* i */ + const LC3_INT32 nSubm + ) +{ + LC3_FLOAT sens; + LC3_INT32 i, j, high_idx, breakflag; + LC3_FLOAT f0est_lim[MAX_PLC_NPLOCS]; + LC3_FLOAT f0bin; + LC3_FLOAT f0gain; + + f0bin = *f0binPtr; + f0gain = *f0gainPtr; + + if (n_plocs > 0 && f0gain > 0.25) { + + sens = 0.5; + if (f0gain < 0.75) { + sens = 0.25; + } + + high_idx = -1; + for (i = 0; i < n_plocs; i++) { + if (plocs[i] <= 25) { /* 25 ~= 1550 Hz */ + high_idx = MAX(high_idx, i); + } else { + /* Optimization, only works if plocs vector is sorted. Which it should be. */ + break; + } + } + + if (high_idx != -1) { + high_idx++; + move_float(f0est_lim, f0est, high_idx); + + breakflag = 0; + for (i = 0; i < nSubm; i++) { + for (j = 0; j < high_idx; j++) { + if (LC3_FABS(f0est_lim[j] - (i+1) * f0bin) < sens) { + f0est[j] = (i+1)*f0bin; + plocs[j] = MIN(Xabs_len-1, MAX(1,(LC3_INT32) LC3_ROUND(f0est[j]))); + breakflag = 1; + break; + } + } + if (breakflag) { + break; + } + sens *= 0.875; + } + } + } + + return; +} + diff --git a/lc3plus/plc_phecu_fec_hq.c b/lc3plus/plc_phecu_fec_hq.c new file mode 100755 index 0000000000..c25466c3e9 --- /dev/null +++ b/lc3plus/plc_phecu_fec_hq.c @@ -0,0 +1,159 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +LC3_FLOAT plc_phEcu_imax2_jacobsen_mag(const Complex *y, LC3_FLOAT *c_jacobPtr) { + + LC3_FLOAT posi; + const Complex *pY; + Complex y_m1, y_0, y_p1; + Complex N; + Complex D; + LC3_FLOAT numer, denom; + + /* Jacobsen estimates peak offset relative y_0 using + * X_m1 - X_p1 + * d = REAL ( ------------------- ) * c_jacob + * 2*X_0 - X_m1 -Xp1 + * + * Where c_jacob is a window dependent constant + */ + + /* Get the parameters into variables */ + pY = y; + y_m1 = *pY++; + y_0 = *pY++; + y_p1 = *pY++; + + /* prepare numerator real and imaginary parts*/ + N = csub(y_m1, y_p1); + + /* prepare denominator real and imaginary parts */ + D = cmul(cmplx(2.0, 0.0), y_0); + D = csub(D, y_m1); + D = csub(D, y_p1); + + /* REAL part of complex division */ + numer = N.r*D.r + N.i*D.i; + denom = D.r*D.r + D.i*D.i; + + if (numer != 0 && denom != 0) { + posi = numer / denom * (*c_jacobPtr); + } else { + posi = 0.0; /* flat top, division is not possible choose center freq */ + } + + + posi = fclampf(-1.0, posi, 1.0); + return posi; +} + +/*-------------------------------------------------------------------* + * imax() + * + * Get interpolated maximum position + *-------------------------------------------------------------------*/ + +LC3_FLOAT plc_phEcu_interp_max(const LC3_FLOAT *y, LC3_INT32 y_len) { + LC3_FLOAT posi, y1, y2, y3, y3_y1, y2i; + LC3_FLOAT ftmp_den1, ftmp_den2; + + /* Seek the extrema of the parabola P(x) defined by 3 consecutive points so that P([-1 0 1]) = [y1 y2 y3] */ + y1 = y[0]; + y2 = y[1]; + + /* If interp between two values only */ + if (y_len == 2) { + if (y1 < y2) { + return 1.0; + } else { + return 0.0; + } + } + + y3 = y[2]; + y3_y1 = y3-y1; + ftmp_den1 = (y1+y3-2*y2); + ftmp_den2 = (4*y2 - 2*y1 - 2*y3); + + if(ftmp_den2 == 0.0 || ftmp_den1 == 0.0) { + return 0.0; /* early exit with left-most value */ + } + + y2i = ((LC3_FLOAT)-0.125) * sqrf(y3_y1) /(ftmp_den1) + y2; + /* their corresponding normalized locations */ + posi = y3_y1/(ftmp_den2); + /* Interpolated maxima if locations are not within [-1,1], calculated extrema are ignored */ + if (posi >= (LC3_FLOAT)1.0 || posi <= (LC3_FLOAT)-1.0) { + posi = y3 > y1 ? (LC3_FLOAT)1.0 : (LC3_FLOAT)-1.0; + } else { + if (y1 >= y2i) { + posi = (y1 > y3) ? (LC3_FLOAT)-1.0 :(LC3_FLOAT) 1.0; + } else if (y3 >= y2i) { + posi = (LC3_FLOAT)1.0; + } + } + + return posi + (LC3_FLOAT)1.0; +} + +/*----------------------------------------------------------------------------- + * fft_spec2_sqrt_approx_ () + * + * Approximation of sqrt(Square magnitude) of fft spectrum + * if min_abs <= 0.4142135*max_abs + * abs = 0.99 max_abs + 0.197*min_abs + * else + * abs = 0.84 max_abs + 0.561*min_abs + * end + * + + *----------------------------------------------------------------------------*/ + +void plc_phEcu_fft_spec2_sqrt_approx(const Complex* x, LC3_INT32 x_len, LC3_FLOAT* x_abs) { + LC3_INT32 i; + LC3_FLOAT max_abs, min_abs, re, im; + + for (i = 0; i < x_len; i++) { + re = LC3_FABS(x[i].r); + im = LC3_FABS(x[i].i); + max_abs = MAX(re, im); + min_abs = MIN(re, im); + + if (min_abs <= (LC3_FLOAT)0.4142135 * max_abs) { + x_abs[i] = (LC3_FLOAT)0.99*max_abs + (LC3_FLOAT)0.197*min_abs; + } else { + x_abs[i] = (LC3_FLOAT)0.84*max_abs + (LC3_FLOAT)0.561*min_abs; + } + } + + return; +} + +LC3_INT32 plc_phEcu_pitch_in_plocs(LC3_INT32* plocs, LC3_INT32 n_plocs) { + + LC3_INT32 i; + LC3_INT32 p_in_plocs; + + p_in_plocs = 0; + + for (i = 0; i < n_plocs; i++) { + if (plocs[i] > 0 && plocs[i] < 7) { + p_in_plocs++; + } + } + + return p_in_plocs; +} + diff --git a/lc3plus/plc_phecu_hq_ecu.c b/lc3plus/plc_phecu_hq_ecu.c new file mode 100755 index 0000000000..5b1978bcab --- /dev/null +++ b/lc3plus/plc_phecu_hq_ecu.c @@ -0,0 +1,116 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_hq_ecu( + LC3_FLOAT *f0binPtr, LC3_FLOAT *f0ltpGainPtr, LC3_FLOAT *xfp, + LC3_INT16 prev_bfi, LC3_INT32 *short_flag_prev, LC3_INT32 fs, + LC3_INT32 *time_offs, Complex *X_sav_m, LC3_INT32 *n_plocs, LC3_INT32 *plocs, LC3_FLOAT *f0est, + const LC3_FLOAT *mdctWin, LC3_FLOAT *env_stabPtr, LC3_INT32 delta_corr, LC3_FLOAT *pfind_sensPtr, + LC3_INT32 PhECU_LA, LC3_INT32 t_adv, const LC3_FLOAT *winWhr, + LC3_FLOAT *oold_grp_shape, LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_grp_shape, LC3_FLOAT *old_EwPtr, + LC3_FLOAT *st_beta_mute, LC3_FLOAT *st_mag_chg_1st, LC3_FLOAT *st_Xavg, LC3_INT32 LA_ZEROS, LC3_FLOAT *x_tda, + LC3_FLOAT *xsubst_dbg, Complex *X_out_m_dbg, + LC3_INT32 *seed_dbg, LC3_FLOAT *mag_chg_dbg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg, + LC3_FLOAT *corr_phase_dbg, + Fft *PhEcu_Fft, Fft *PhEcu_Ifft) +{ + LC3_INT32 i; + LC3_INT32 fs_idx, L, Lprot, n_grp, Lecu, LXsav, Lxfp_inuse; + LC3_FLOAT alpha[8]; + LC3_FLOAT beta[8]; + LC3_FLOAT mag_chg[8]; + LC3_FLOAT xfp_local_rnd[2*MAX_LEN]; + Complex X_out_m[2*MAX_LEN]; + LC3_INT32 seed; + LC3_INT32 burst_len; + + + fs_idx = (LC3_INT32)floor(fs / 10000.0); + L = (LC3_INT32)floor(0.01 * fs); + Lprot = (LC3_INT32)(1.6 * L); + n_grp = xavg_N_grp[fs_idx]; + Lecu = 2 * L; + LXsav = Lprot / 2 + 1; /* 48 kHz may be optimized , to save only up to 20 kHz as in BASOP */ + Lxfp_inuse = Lprot ; + if (prev_bfi == 1){ + Lxfp_inuse = (LC3_INT32)(L*(3.75/10.0)); + } + + UNUSED(env_stabPtr); + UNUSED(xsubst_dbg); + UNUSED(X_out_m_dbg); + UNUSED(seed_dbg); + UNUSED(mag_chg_dbg); + UNUSED(tr_dec_dbg); + UNUSED(gpc_dbg); + UNUSED(X_i_new_re_dbg); + UNUSED(X_i_new_im_dbg); + UNUSED(corr_phase_dbg); + + + if (prev_bfi != 1) + { + for (i = (Lprot-Lxfp_inuse); i < Lprot; i++) { + xfp_local_rnd[i] = xfp[i]; + /* hysteresis of low level input aligns float fft analysis and peak picking to BASOP performance for low level noisy signals */ + if (xfp[i] >= -0.5 && xfp[i] <= 0.5) { + xfp_local_rnd[i] = 0.0; + } + } + + + *time_offs = 0; + burst_len = (*time_offs / L + 1); + plc_phEcu_trans_burst_ana_sub(fs_idx, burst_len, n_grp, oold_grp_shape, oold_EwPtr , old_grp_shape, old_EwPtr, st_beta_mute, + st_mag_chg_1st, st_Xavg, alpha, beta, mag_chg, NULL, NULL); + + plc_phEcu_spec_ana(xfp_local_rnd, Lprot, winWhr, pfind_sensPtr, plocs, n_plocs, f0est, X_sav_m, &LXsav, f0binPtr, f0ltpGainPtr, fs_idx, PhEcu_Fft); + } + else + { + *time_offs = *time_offs + L; + *time_offs = imin(32767 ,*time_offs); /* limit to Word16 range as in BASOP ~= 70 10ms frames@48kHz */ + burst_len = ((*time_offs / L) + 1); + + plc_phEcu_trans_burst_ana_sub(fs_idx, burst_len, n_grp, oold_grp_shape, oold_EwPtr, old_grp_shape, old_EwPtr, st_beta_mute, + st_mag_chg_1st, st_Xavg, alpha, beta, mag_chg, NULL, NULL); + + } + + seed = *time_offs; + + if (*short_flag_prev != 0) + { + *n_plocs = 0; + } + + move_cmplx( X_out_m, X_sav_m, LXsav); + + /* inplace X_out_m update */ + plc_phEcu_subst_spec(plocs, *n_plocs, f0est, *time_offs, X_out_m, LXsav, mag_chg, &seed, alpha, beta, st_Xavg, t_adv, Lprot, delta_corr, + NULL, NULL, NULL); + + + + + plc_phEcu_rec_frame(X_out_m, L, Lecu, winWhr, mdctWin, Lprot, + xfp, /* last 3.75ms of non-rounded xfp used here */ + *time_offs, + x_tda /* output */, + NULL, NULL, NULL, + LA_ZEROS, PhECU_LA, PhEcu_Ifft); + +} + diff --git a/lc3plus/plc_phecu_lf_peak_analysis.c b/lc3plus/plc_phecu_lf_peak_analysis.c new file mode 100755 index 0000000000..0bcc98d7a4 --- /dev/null +++ b/lc3plus/plc_phecu_lf_peak_analysis.c @@ -0,0 +1,112 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_LF_peak_analysis(LC3_INT32 *plocs, /* i/o 0 ... Lprot/2 +1*/ + LC3_INT32 *n_plocs, /* i/o 0.. MAX_PLOCS */ + LC3_FLOAT *f0est, /* i/o Q16*/ + const LC3_FLOAT *Xabs, + LC3_FLOAT *f0binPtr, + LC3_FLOAT *f0gainPtr, + const LC3_INT32 nSubm +) +{ + LC3_INT32 i, j, fin, f_ind, prel_low, prel_high, start; + LC3_FLOAT f0est_prel[3]; + LC3_INT32 plocs_prel[3]; + LC3_INT32 n_prel; + LC3_FLOAT f0est_old[MAX_PLC_NPLOCS]; + LC3_INT32 plocs_old[MAX_PLC_NPLOCS]; + LC3_FLOAT peakLF_Xval, f; + LC3_FLOAT f0bin ; + LC3_FLOAT f0gain ; + + f0bin = *f0binPtr; + f0gain = *f0gainPtr; + + if (*n_plocs > 0 && f0gain > 0.25 && f0bin < 2.75) { + + /* Assumes sorted plocs */ + if (plocs[0] < 3) { + fin = MIN(3, *n_plocs); + peakLF_Xval = Xabs[plocs[0]]; + for (i = 1; i < fin; i++) { + peakLF_Xval = MAX(peakLF_Xval, Xabs[plocs[i]]); + } + + n_prel = 0; + for (i = 0; i < nSubm; i++) { + f = (i+1)*f0bin; + f_ind = (LC3_INT32)LC3_ROUND(f); + if (f*PHECU_FRES <= 400 && Xabs[f_ind] > peakLF_Xval*0.375) { + f0est_prel[n_prel] = f; + plocs_prel[n_prel] = f_ind; + n_prel++; + } + } + + if (n_prel > 0) { + prel_low = plocs_prel[0]; + prel_high = plocs_prel[n_prel-1]; + + /* initial assumption:: all original peaks (1 or 2 of them) are positioned below prel_low */ + start = (*n_plocs); /* at this point 'start' is the location_c where to add any harmonics peaks */ + for (i = (*n_plocs)-1; i >= 0; i--) { + if (plocs[i] >= prel_low) { + start = i; + } + } + + /* found position_c where to start adding */ + start = (start-1 ); /* one step lower, now start is of original LF peaks to keep */ + start = MAX(start, -1); /* limit for loop */ + + if (prel_high < plocs[0]) { + fin = 0; + } else { + fin = (*n_plocs)+1; + for (i = 0; i < *n_plocs; i++) { + if (plocs[i] <= prel_high) { + fin = i; + } + } + fin++; + } + + move_int(plocs_old, plocs, *n_plocs); + move_float(f0est_old, f0est, *n_plocs); + + j = (start+1); /* [0..(j-1)] of original LF peaks will be kept */ + /* j now points to first location_c where to add peaks */ + + for (i = 0; i < n_prel; i++) { + plocs[j] = plocs_prel[i]; + f0est[j] = f0est_prel[i]; + j++; + } + for (i = fin; i < *n_plocs; i++) { + plocs[j] = plocs_old[i]; + f0est[j] = f0est_old[i]; + j++; + } + + *n_plocs = j; + + } + } + } + + return; +} + diff --git a/lc3plus/plc_phecu_rec_frame.c b/lc3plus/plc_phecu_rec_frame.c new file mode 100755 index 0000000000..0e6570743a --- /dev/null +++ b/lc3plus/plc_phecu_rec_frame.c @@ -0,0 +1,147 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_rec_frame(Complex *X_in, + LC3_INT32 L, + LC3_INT32 Lecu, + const LC3_FLOAT *whr, + const LC3_FLOAT *winMDCT, + LC3_INT32 Lprot, + LC3_FLOAT *xfp, + LC3_INT32 time_offs, + LC3_FLOAT *x_out, + Complex *full_spec_dbg, + LC3_FLOAT* ifft_out_dbg, + LC3_FLOAT* xsubst_dbg, + LC3_INT32 LA_ZEROS, + LC3_INT32 LA, + Fft* PhEcu_ifft +) +{ + + LC3_INT32 i; + + LC3_FLOAT xrec[2*MAX_LEN]; + LC3_FLOAT xsubst[2*MAX_LEN]; + LC3_FLOAT xsubst_LL[2*MAX_LEN]; + LC3_FLOAT *pXsubst_LL; + + LC3_INT32 fs_idx; + + LC3_FLOAT *pXfp, *pOlaXsubst, *pXOut; + LC3_INT32 work_part, copy_part, ola_part; + + const LC3_FLOAT *hannOla; + const LC3_FLOAT *pHannOla; + + UNUSED(time_offs); + UNUSED(full_spec_dbg); + UNUSED(ifft_out_dbg); + UNUSED(xsubst_dbg); + UNUSED(xsubst_LL); + fs_idx = FRAME2FS_IDX(L); + hannOla = hannOla_wins[fs_idx]; + + X_in[0].i = X_in[Lprot / 2].r; /* move fs/2 real to imag part of X_in[0]*/ + + real_fft_apply(PhEcu_ifft, (LC3_FLOAT*)X_in, xrec); + + move_float(xsubst, xrec, Lprot); + + + + + { + for (i = 0; i < Lprot; i++) { + + if (whr[i] != 0) { + xsubst[i] = xsubst[i] / whr[i]; /* inverse stored in BASOP */ + } + + } + + assert(xsubst_LL != NULL); + zero_float(xsubst_LL, (Lecu-Lprot)/2); /* initial 2ms */ + zero_float(&(xsubst_LL[ Lecu- (Lecu-Lprot)/2]), (Lecu-Lprot)/2); /* tail 2ms */ + { + /* position reconstruction properly */ + /* pXsubst_LL = &xsubst_LL[Lecu - Lprot - (Lecu - Lprot) / 2]; */ + pXsubst_LL = &xsubst_LL[(Lecu - Lprot) / 2]; + for (i = 0; i < Lprot ; i++) { + *pXsubst_LL++ = xsubst[i]; /* copy required 14.25 ms into center */ + } + } + + } + + + + work_part = LA_ZEROS + LA; + copy_part = (Lecu - Lprot) / 2; + ola_part = work_part - copy_part; + + pXfp = &xfp[Lprot - work_part]; + for (i = 0; i < copy_part; i++) { + xsubst_LL[i] = *pXfp++; + } + + assert(xsubst_LL != NULL); + pOlaXsubst = &(xsubst_LL[copy_part]); + pHannOla = hannOla; + for (i = 0; i < ola_part; i++) { + *pOlaXsubst = *pOlaXsubst * *pHannOla++; + pOlaXsubst++; + } + + pOlaXsubst = &(xsubst_LL[copy_part]); + for (i = 0; i < ola_part; i++) { + *pOlaXsubst = *pOlaXsubst + *pXfp++ * *pHannOla--; + pOlaXsubst++; + } + + + /* clear x_out to start with */ + assert(x_out != NULL); + zero_float(x_out, L); + + + for (i = 0; i < (Lecu - LA_ZEROS); i++) { + + xsubst_LL[i] = xsubst_LL[i] * winMDCT[i]; /* xsubstLL windowing up to 16.25 ms i.e not last 3.75 ms */ + + } + zero_float(&(xsubst_LL[Lecu - LA_ZEROS]), LA_ZEROS); /* tail 3.75ms always zero */ + + /* perform tda */ + + /* first half */ + pXsubst_LL = &xsubst_LL[3 * Lecu / 4]; + pXfp = &xsubst_LL[(3 * Lecu / 4) - 1]; + + pXOut = x_out; + for (i = 0; i < Lecu / 4; i++) { + *pXOut++ = -*pXsubst_LL++ - *pXfp--; /* 3.75 ms mults with 0 . may be skipped, see BASOP */ + } + + /* second half */ + /* */ + + pXsubst_LL = &(xsubst_LL[0]); + pXfp = &xsubst_LL[(Lecu / 2) - 1]; + for (i = 0; i < Lecu / 4; i++) { + *pXOut++ = *pXsubst_LL++ - *pXfp--; + } +} + diff --git a/lc3plus/plc_phecu_setf0hz.c b/lc3plus/plc_phecu_setf0hz.c new file mode 100755 index 0000000000..b14327e2b2 --- /dev/null +++ b/lc3plus/plc_phecu_setf0hz.c @@ -0,0 +1,28 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +LC3_FLOAT plc_phEcuSetF0Hz(LC3_INT32 fs, LC3_FLOAT * old_pitchPtr) +{ + LC3_FLOAT result; + + result = 0; + if (*old_pitchPtr != 0) + { + result = LC3_ROUND(fs/(*old_pitchPtr)/PHECU_FRES * 128.0) / 128.0; + } + + return result; +} + diff --git a/lc3plus/plc_phecu_spec_ana.c b/lc3plus/plc_phecu_spec_ana.c new file mode 100755 index 0000000000..b496900305 --- /dev/null +++ b/lc3plus/plc_phecu_spec_ana.c @@ -0,0 +1,599 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +#define PEAK_LOCATOR_RES_FX 1 /* fixed point resolution minimum value */ + + +static LC3_INT16 plc_phEcu_find_ind_fx( /* o : output maximum indx 0.. len-1 */ + const LC3_INT16 *inp, /* i : vector */ + const LC3_INT16 len, /* i : length */ + const LC3_INT16 val /* i : value to find */ +); + +static void plc_phEcu_peak_locator_fxlike(const LC3_INT16 *inp, /* i: vector with values >=0 ,Qx */ + const LC3_INT16 inp_len, /* i: length of inp */ + LC3_INT16 * int_plocs, /* o: array of filtered integer plocs Q0 */ + LC3_INT16 * n_fsc, /* o: total_ number of filtered located highs Q0 */ + const LC3_INT16 sens, /* i sensitivity, Qx */ + const LC3_INT16 inp_high, /* i global high , Qx */ + const LC3_INT16 inp_low /* i: global low, Qx */ +); + + +void plc_phEcu_spec_ana(LC3_FLOAT* xfp, + LC3_INT32 xfp_len, + const LC3_FLOAT* whr, + LC3_FLOAT *pfind_sensPtr, + LC3_INT32* plocs, + LC3_INT32* n_plocs, + LC3_FLOAT* f0est, + Complex* x, + LC3_INT32* x_len, + LC3_FLOAT * f0hzLtpBinPtr, + LC3_FLOAT * f0gainLtpPtr, + LC3_INT32 bw_idx, + Fft* PhEcu_fft +) +{ + + + LC3_INT32 i, peak_range_1, curr; + LC3_FLOAT xfp_w[MAX_PLC_LPROT]; + + LC3_FLOAT Xabs[MAX_LEN] = {0}; + LC3_FLOAT inp_high, inp_low, sens; + LC3_FLOAT interPos; + Complex Xana_p[3]; + LC3_INT32 P_in_plocs; + LC3_INT32 nSubs; + LC3_INT32 n_plocs_in; + LC3_FLOAT phEcu_c_jacob[1]; + + LC3_FLOAT fx_fft_scale; + LC3_FLOAT fft_fs_scale; + + LC3_FLOAT max_xfp_abs; + LC3_FLOAT PLC2_Q_flt; + LC3_FLOAT Q_scale_flt; + + LC3_INT16 Xabs_fx[MAX_LEN]; + LC3_INT16 plocs_fx[MAX_LEN]; + + LC3_INT16 sens_fx; + LC3_INT16 inp_high_fx; + LC3_INT16 inp_low_fx; + LC3_INT16 n_plocs_fx; + + LC3_FLOAT pfind_sens ; + LC3_FLOAT f0hzLtpBin ; + LC3_FLOAT f0gainLtp ; + + pfind_sens = *pfind_sensPtr; + f0hzLtpBin = *f0hzLtpBinPtr; + f0gainLtp = *f0gainLtpPtr; + + for (i = 0; i < xfp_len; i++) + { + xfp_w[i] = xfp[i] * whr[i]; /* whr windowing may be split into three segments , two loops, and possibly inplace */ + } + real_fft_apply(PhEcu_fft, xfp_w, (LC3_FLOAT *)x); + + x[xfp_len/2].r = x[0].i; /* move the real Fs/2 value to end */ + x[xfp_len/2].i = 0; /* safety clear imaginary Fs/2 value at end */ + x[0].i = 0.0; /* safety, make DC value only real */ + + + *x_len = xfp_len/2 + 1; + + i =(LC3_INT32) LC3_FLOOR(20000.0/PHECU_FRES)+1; + zero_cmplx( &(x[i]), *x_len - i); + + peak_range_1 = (LC3_INT32) MIN(*x_len, (40000.0 / 100 * 1.6) / 2 + 1); + + plc_phEcu_fft_spec2_sqrt_approx(x, peak_range_1, Xabs); + + zero_float(&(Xabs[peak_range_1]), *x_len - peak_range_1); + + inp_high = Xabs[0]; + inp_low = Xabs[0]; + + for (i = 1; i < peak_range_1; i++) { + inp_high = MAX(inp_high, Xabs[i]); + inp_low = MIN(inp_low, Xabs[i]); + } + + sens = (inp_high-inp_low)*(1-pfind_sens); + + if (inp_high > ((LC3_FLOAT) PEAK_LOCATOR_RES_FX)/2.0) + { + { + /* from ROM constants.c */ + LC3_FLOAT fx_fft_scales[5] = { 6, 7, 7, 8, 8 }; /*NB,WB, sSWB, SWB, FB*/ + fx_fft_scale = LC3_POW(2.0, fx_fft_scales[bw_idx]); /*% scaling due to up / dn pre shifts in fx FFT */ + } + { /* from ROM constants.c */ + LC3_FLOAT fx_fs_scales[5] = { 1.0, 1.0, 1.5, 1.0, 1.5 }; /*NB,WB, sSWB, SWB, FB*/ + fft_fs_scale = fx_fs_scales[bw_idx]; + } + + + max_xfp_abs = (LC3_FLOAT) LC3_FABS(xfp[0]); + for (i = 1; i < xfp_len; i++) { + max_xfp_abs = (LC3_FLOAT) MAX(max_xfp_abs, LC3_FABS(xfp[i])); + } + + if (max_xfp_abs >= 0.5) + { + PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / max_xfp_abs)); + Q_scale_flt = LC3_POW(2.0, PLC2_Q_flt) / fx_fft_scale / fft_fs_scale; /* basop way using xfp scale */ + + /* C-Float additional safety limit/verification of the integer xfp based scaling using the available C-float Xabs max value inp_high as well */ + { + LC3_FLOAT tmp_scale; + tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / inp_high))); + if (Q_scale_flt > tmp_scale) { + Q_scale_flt = tmp_scale; + } + } + /* Round sens, inp_high, inp_low according to BASOP fix-point scaling */ + + for (i = 0; i < peak_range_1; i++) { + Xabs_fx[i] = (LC3_INT16) LC3_ROUND(Xabs[i] * Q_scale_flt) ; + } + sens_fx = (LC3_INT16) LC3_ROUND(sens * Q_scale_flt) ; + inp_high_fx = (LC3_INT16) LC3_ROUND(inp_high * Q_scale_flt) ; + inp_low_fx = (LC3_INT16) LC3_ROUND(inp_low * Q_scale_flt) ; + plc_phEcu_peak_locator_fxlike(Xabs_fx, peak_range_1, plocs_fx, &n_plocs_fx, sens_fx, inp_high_fx, inp_low_fx); + + *n_plocs = (LC3_INT32)n_plocs_fx; + for (i = 0; i < *n_plocs; i++) { + plocs[i] = (LC3_INT32)plocs_fx[i]; /* short Word16 values now stored/saved as Word32 */ + } + } + else + { + *n_plocs = 0; /* time domain xfp level near zero */ + } + } + else + { + *n_plocs = 0; /* Freq domain Xabs max level near zero */ + } + + for (i = 0; i < *n_plocs; i++) { + curr = plocs[i]; + if (curr == 0) { + interPos = plc_phEcu_interp_max(Xabs, 3); /* returns 0.0 ... 2.0 */ + if (interPos == 2) { + /* integer peak was at DC, restrict to one of coeffs at [DC or DC+1] */ + interPos = plc_phEcu_interp_max(Xabs, 2); /* returns 0.0 or 1.0 */ + } + interPos += plocs[i]; + } else if (curr == 1) { + interPos = plc_phEcu_interp_max(Xabs, 3); + interPos += plocs[i] - 1; + } else if (curr == *x_len - 2) { + interPos = plc_phEcu_interp_max(&Xabs[*x_len - 3], 3); + interPos += plocs[i] - 1; + } else if (curr == *x_len - 1) { + /* integer curr at Fs/2, a real coeff */ + interPos = plc_phEcu_interp_max(&Xabs[*x_len - 3], 3); /* returns 0.0 ... 2.0 */ + interPos += plocs[i] - 2; /* valid for range ]... 1.0 ... 2.0] , where 1 is fs/2-1 and 2.0 is Fs/2 */ + if (interPos == 0) { + /* restrict to one of coeffs at [fs/2-1, fs/2 ] */ + interPos = plc_phEcu_interp_max(&Xabs[*x_len - 2], 2); /* returns 0.0 or 1.0 */ + interPos += plocs[i] - 1; + } + + if (interPos > (*x_len - 1) ) { /* interPos only defined up to Fs/2 */ + interPos = (LC3_FLOAT)(*x_len - 1); + } + } else { + Xana_p[0] = x[plocs[i]-1]; + Xana_p[1] = x[plocs[i]]; + Xana_p[2] = x[plocs[i]+1]; + phEcu_c_jacob[0] = (LC3_FLOAT)PHECU_C_JACOB; + interPos = plc_phEcu_imax2_jacobsen_mag(Xana_p, phEcu_c_jacob ); + interPos += (LC3_FLOAT) plocs[i]; + } + f0est[i] = interPos; + } + + if (*n_plocs >= 2 && plocs[0] == 0 && + f0est[0] > f0est[1] && plocs[1] <= 2 && Xabs[0] < Xabs[plocs[1]+1]) + { + f0est[0] = f0est[1]; + } + + P_in_plocs = plc_phEcu_pitch_in_plocs(plocs, *n_plocs); + + if (f0hzLtpBin > 0.0 && P_in_plocs > 0) { + nSubs = 2; + n_plocs_in = *n_plocs; + plc_phEcu_LF_peak_analysis(plocs, n_plocs, f0est, Xabs, &f0hzLtpBin, &f0gainLtp, nSubs); + + if (n_plocs_in == *n_plocs) { + nSubs = 3; + plc_phEcu_F0_refine_first(plocs, *n_plocs, f0est, *x_len, &f0hzLtpBin, &f0gainLtp, nSubs); + } + } + + if (f0gainLtp > 0.0 && f0gainLtp < 0.5 && *n_plocs > 14) { + if (P_in_plocs > 0) { + *n_plocs = 0; + } + } + + return; +} + + +#define sub(a,b) (a - b) +#define add(a,b) (a + b) +#define s_xor(a,b) (a ^ b) + +/* in case a value (e.g max or min) is already known , find the first corresponding array index */ +static LC3_INT16 plc_phEcu_find_ind_fx( /* o : output maximum indx 0.. len-1 */ + const LC3_INT16 *inp, /* i : vector */ + const LC3_INT16 len, /* i : length */ + const LC3_INT16 val /* i : value to find */ +) +{ + LC3_INT16 val_ind; + LC3_INT16 pos; + + val_ind = -1; + + for(pos = 0; pos < len; pos++) + { + if (sub(inp[pos], val) == 0) + { + val_ind = pos; + } + } + + return val_ind; +} + + + +/* BASOP function adapted to compile in float/integer environment */ +/*----------------------------------------------------------------------------- + * plc_phEcu_peak_locator_fxlike() + *----------------------------------------------------------------------------*/ +static void plc_phEcu_peak_locator_fxlike(const LC3_INT16 *inp, /* i: vector with values >=0 ,Qx */ + const LC3_INT16 inp_len, /* i: length of inp */ + LC3_INT16 * int_plocs, /* o: array of filtered integer plocs Q0 */ + LC3_INT16 * n_fsc, /* o: total_ number of filtered located highs Q0 */ + const LC3_INT16 sens, /* i sensitivity, Qx */ + const LC3_INT16 inp_high, /* i global high , Qx */ + const LC3_INT16 inp_low /* i: global low, Qx */ +) +{ + + LC3_INT16 j, k, n, idx_high, idx_low; + LC3_INT16 inp_len_minus1; + LC3_INT16 pairs_start, pairs_end; + LC3_INT16 *p_tmp; + LC3_INT16 prev_delta, curr_delta; + LC3_INT16 delta_predc, delta_fin; + LC3_INT16 add_dc_flag, add_fin_flag; + LC3_INT16 low_val_cand_pairs, val_range; + LC3_INT16 num_pairs, n_tail_values; + LC3_INT16 cand_phase_start, cand_idx, prev_low_plus_sens, tmp; + LC3_INT16 cand_high, prev_low; + LC3_INT16 *cand_pairs; /* actually [DC ] + pairs + [FS/2] */ + + LC3_INT16 sc_idx[1 + 368 + 1]; + LC3_INT16 cand_pairs_buf[1 + 1 + 368 + 1]; + LC3_INT16 fsc_idx[1 + 368 / 2 + 1]; + + + inp_len_minus1 = sub(inp_len, 1); /* size of delta=derivative array ,and last index in inp */ + + cand_pairs = &cand_pairs_buf[1]; /* ptr init , make space for storing a lowest amplitude value in location -1 */ + pairs_start = 1; /* adjusted to zero or 1 or 2 when/if, DC is injected as sc_idx[0], or initial plateau skipped */ + + p_tmp = &(sc_idx[pairs_start]); /* ptr init */ + + + /* xor high/low pairs of delta_inp and save sign changes */ + prev_delta = sub(inp[1], inp[0]); /* precompute very first delta */ + + for(n = 1; n < inp_len_minus1; n++) + { /* sign change analysis */ + curr_delta = sub(inp[n + 1], inp[n]); /* n+1 ,n , are loop ptrs */ + if (s_xor(prev_delta, curr_delta) < 0) /* a "0" delta treated as a positive sign */ + { + *p_tmp++ = n; /* store sign change bin locations , location n in the inp[] signal */ + } + prev_delta = curr_delta; + } + + k = (LC3_INT16)(p_tmp - &(sc_idx[pairs_start])); + + /* copy sign change location values to a pairs array */ + /* leave one initial sc_idx location open for a potential initial DC value */ + + for(j = 0; j < k; j++){ + cand_pairs[j + pairs_start] = inp[sc_idx[j + pairs_start]]; + } + + /* filter away a potential single initial/trailing plateau + to enable correct analysis for adding DC or fs/2 bins */ + + + if((sub(k, 2) >= 0) && + (sub(cand_pairs[pairs_start], cand_pairs[pairs_start + 1]) == 0)){ + pairs_start = add(pairs_start, 1); + k = sub(k, 1); + } + + /* filter away potential single trailing plateu */ + pairs_end = sub(add(pairs_start, k), 1); /* point to last established sign change element */ + + if ((sub(k, 2) >= 0) && + (sub(cand_pairs[sub(pairs_end, 1)], cand_pairs[pairs_end]) == 0)){ + k = sub(k, 1); + } + pairs_end = sub(add(pairs_start, k), 1); /* recalc ptr to last element */ + + + /* conditionally add high/lows on both sides of input (pre_dc or fin) as candidates */ + add_dc_flag = 0; + add_fin_flag = 0; + + + if(sub(k, 1) == 0) /* one single sign change found special case */ + { + if (sub(inp[0], cand_pairs[pairs_start]) != 0) + { + add_dc_flag = 1; /* not plateau */ + } + + if (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) != 0) + { + add_fin_flag = 1; /* not plateau */ + } + } + + if(sub(k, 2) >= 0) + { + delta_predc = sub(cand_pairs[pairs_start + 1], cand_pairs[pairs_start]); + delta_fin = sub(cand_pairs[pairs_end], cand_pairs[pairs_end - 1]); + + /* plateaus are allowed to be detected by xor sign change, + but still not allowed at the start nor at the end */ + + add_dc_flag = 1; + if (sub(inp[0], cand_pairs[pairs_start]) == 0) + { + add_dc_flag = 0; /* plateau down or , plateaus up., --> do not add DC */ + } + + + if ((sub(inp[0], cand_pairs[pairs_start]) < 0) && (delta_predc > 0)) + { + add_dc_flag = -1; /*UP - up ... replace */ + } + + if ((sub(inp[0], cand_pairs[pairs_start]) > 0) && (delta_predc < 0)) + { + add_dc_flag = -1; /* DOWN - down ... % replace */ + } + + add_fin_flag = 1; + if (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) == 0) + { + add_fin_flag = 0; /* up - plateau ... */ + } + + if ((delta_fin > 0) && (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) < 0)) + { + add_fin_flag = -1; /* up - UP ... % replace , hard to hit */ + } + + if ((delta_fin < 0) && (sub(cand_pairs[pairs_end], inp[inp_len_minus1]) > 0)) + { + add_fin_flag = -1; /*down - DOWN ... % replace */ + } + + } + + if(add_dc_flag > 0) + { /* add DC */ + pairs_start = sub(pairs_start, 1); + cand_pairs[pairs_start] = inp[0]; + sc_idx[pairs_start] = 0; + k = add(k, 1); + } + if(add_dc_flag < 0) + { /* -1 --> replace with DC*/ + cand_pairs[pairs_start] = inp[0]; + sc_idx[pairs_start] = 0; + } + + if(add_fin_flag > 0) + { /* add FS/2 */ + pairs_end = add(pairs_end, 1); + cand_pairs[pairs_end] = inp[inp_len_minus1]; + sc_idx[pairs_end] = inp_len_minus1; + k = add(k, 1); + } + if(add_fin_flag < 0) + { /* -1, replace tail with FS/2*/ + cand_pairs[pairs_end] = inp[inp_len_minus1]; + sc_idx[pairs_end] = inp_len_minus1; + } + /* preliminary cand_pairs now only have highs , lows , no initial/trailing plateaus */ + + + /* we allow the DC/FsBy2 lows to be used as the candidatelLow */ + low_val_cand_pairs = inp_low; + val_range = sub(inp_high, low_val_cand_pairs); /* used to determine if search is useful at all */ + + + if ((sub(val_range, PEAK_LOCATOR_RES_FX) < 0) || + (sub(inp_high, sens) < 0)) + { + k = 0; + } + + + if ((k == 0) && (sub(val_range, sens) >= 0)) + { + k = 1; + } + + + if(sub(k, 2) > 0) + { + /* low, high, low, ... or + high, low, high, ...*/ + + cand_phase_start = pairs_start; /*assume first candidate is a high */ + if (sub(cand_pairs[pairs_start], cand_pairs[pairs_start + 1]) < 0) + { + cand_phase_start = add(pairs_start, 1); /* first is a low, --> skip to next higher cand */ + } + + /* high, low, high, ... */ + tmp = k; + if (sub(cand_phase_start, pairs_start) != 0) + { + tmp = sub(tmp, 1); + } + num_pairs = tmp / 2; // shr(tmp, 1); + n_tail_values = sub(tmp, num_pairs * 2); // shl(num_pairs, 1)); + + /* filter preliminary sign changes into sensitivity filtered sign changes */ + + *n_fsc = 0; /* counter of filtered fsc_idx */ + cand_high = low_val_cand_pairs; + cand_idx = -1; /* sentinel location for no high cand found yet. */ + cand_pairs[-1] = low_val_cand_pairs; + + prev_low = low_val_cand_pairs; + prev_low_plus_sens = add(prev_low, sens); + + /* filter loop for high - low sign change pairs */ + /* idx_high, idx_low are raw pointers into the cand_pairs and sc_idx arrays */ + + for(idx_high = cand_phase_start; idx_high < (cand_phase_start + 2 * num_pairs); idx_high += 2) + { + idx_low = idx_high + 1; /* loop ptr increase */ + + /* new high candidate larger than previous candidate and */ + /* sensitivity still larger than the the previous low */ + tmp = MAX(cand_high, prev_low_plus_sens); + if (sub(cand_pairs[idx_high], tmp) > 0) + { + cand_idx = idx_high; /* enable or shift candidate position fwd */ + } + cand_high = cand_pairs[cand_idx]; /* NB, cand_pairs[-1] , has the low_val_cand_pairs value stored */ + + /* now check the fwd idx_low of the current {high,low} pair */ + prev_low = MIN(cand_pairs[idx_low], prev_low); + + tmp = sub(cand_high, sens); + if(sub(tmp, cand_pairs[idx_low]) > 0) + { + /* this low point is now low enough to fix a previous high candidate */ + + fsc_idx[*n_fsc] = cand_idx; /*% add cand high idx -> output idx list*/ + *n_fsc = add(*n_fsc, 1); + + prev_low = cand_pairs[idx_low]; /* use this value as new low estimate */ + cand_idx = -1; /* no candidate until next pair or tail bin, and pt to lowVal */ + cand_high = low_val_cand_pairs; /* enable next candidate to be selected immediately */ + } + prev_low_plus_sens = add(prev_low, sens); + } /* { high, low} for loop */ + + + if((n_tail_values == 0) && (cand_idx >= 0)) + { + /* no tail low or high value to analyze + still may need to lock a non-locked but qualified candidate */ + fsc_idx[*n_fsc] = cand_idx; + *n_fsc = add(*n_fsc, 1); + } + + + /* cand_pairs vector may have a last orphan value */ + if(n_tail_values > 0) + { + /* cand_pairs vector may have a last orphan tail value */ + /* + logic boils down to if (nTailValues > 0) && (cand_pairs(n_end) > tmp) + there is a last one trailing high to process + + a) the last high, may be a new high Peak if we have not yet + locked the current candidate + b) if we have locked the last candidate, the last high may also be + a highpeak if it is high enough from the(newly set previous) valley floor. + + tmp=a||b + */ + + tmp = MAX(cand_high, prev_low_plus_sens); + tmp = sub(cand_pairs[pairs_end], tmp); + if(tmp > 0) + { + fsc_idx[*n_fsc] = pairs_end; + *n_fsc = add(*n_fsc, 1); + } + else + { + if(cand_idx >= 0) + { /* we have a previously established high candidate */ + fsc_idx[*n_fsc] = cand_idx; + *n_fsc = add(*n_fsc, 1); + } + + } + } + + /* move high locations info from fsc_idx , to output */ + for(j = 0; j < *n_fsc; j++) + { + int_plocs[j] = sc_idx[fsc_idx[j]]; + + } + + } /* end of pairs + [tail] section filtering */ + else + { + /* constant/single rise or constant decay or very low overall values, cases */ + *n_fsc = 0; + + tmp = sub(inp_high, sens); + if((k != 0) && (sub(tmp, low_val_cand_pairs) > 0)) + { + /* low,high */ + /* high,low */ + tmp = plc_phEcu_find_ind_fx(inp, inp_len, inp_high); + int_plocs[0] = tmp; /* simply locate the high peak*/ + *n_fsc = 1; + if (tmp < 0) + { /*safety in case max value index was not found */ + *n_fsc = 0; + } + } + } + + return; +} + diff --git a/lc3plus/plc_phecu_subst_spec.c b/lc3plus/plc_phecu_subst_spec.c new file mode 100755 index 0000000000..43f806339b --- /dev/null +++ b/lc3plus/plc_phecu_subst_spec.c @@ -0,0 +1,247 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" +#include "constants.h" + + +static LC3_INT32 own_rand(LC3_INT32 seed); +static Complex valley_magnitude_adj(Complex X_i_in, LC3_INT32 uni_seed, LC3_FLOAT cos_F); +static LC3_INT32 rand_phase(LC3_INT32 seed_in, LC3_FLOAT* cos_F); + +void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_INT32 time_offs, Complex* X, LC3_INT32 X_len, + LC3_FLOAT* mag_chg_gr, LC3_INT32 *seed, LC3_FLOAT* alpha, LC3_FLOAT* beta, LC3_FLOAT* Xavg, + LC3_INT32 t_adv_in, LC3_INT32 Lprot, LC3_INT32 delta_corr, LC3_FLOAT *corr_phase_dbg, + LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg) { + + LC3_INT32 i, i2, lprotBy2Minus1, one_peak_flag_mask, noise_mag_scale; + LC3_INT32 t_adv; + LC3_FLOAT corr_phase[MAX_PLC_NPLOCS] = {0}; + LC3_FLOAT cos_F, mag_chg_local, alpha_local, beta_local, tmp; + Complex X_i, X_i_new; + LC3_INT32 segmentLen, e; + LC3_FLOAT Xph; + LC3_FLOAT seed_local; + LC3_INT32 binCounter, subInd; + + UNUSED(corr_phase_dbg); + UNUSED(X_i_new_re_dbg); + UNUSED(X_i_new_im_dbg); + + seed_local = (LC3_FLOAT) *seed; + + + lprotBy2Minus1 = imin(320, Lprot/2 - 1); /* limit to 20 KHz */ + + + t_adv = t_adv_in + time_offs; + + for (i = 0; i < n_plocs; i++) { + corr_phase[i] = (LC3_FLOAT)2.0 * (LC3_FLOAT)M_PI * (f0est[i]/Lprot)*(LC3_FLOAT)t_adv; + } + + + // EVOLVE PHASE ----------------- + binCounter = 1; + subInd = 0; + + one_peak_flag_mask = -1; + if (n_plocs < 3 && n_plocs > 0) { + one_peak_flag_mask = 0; + } + + noise_mag_scale = 0; + if (n_plocs == 0 || time_offs != 0) { + noise_mag_scale = 1; + } + + if (n_plocs == 0) { + X[0] = realtoc(0); + X[X_len-1] = realtoc(0); + } + + + if (n_plocs != 0) { + for (i = 0; i < n_plocs; i++) { + LC3_INT32 delta_corr_dn = delta_corr; + LC3_INT32 delta_corr_up = delta_corr; + + if (i > 0) { + delta_corr_dn = imin( ((plocs[i] - plocs[i - 1] - 1) / 2), delta_corr_dn); + } + + if (i < n_plocs - 1) { + delta_corr_up = imin( ((plocs[i + 1] - plocs[i] - 1) / 2), delta_corr_up); + } + + segmentLen = (plocs[i] - delta_corr_dn) - binCounter; + + for (i2 = 0; i2 < segmentLen; i2++) { + seed_local = (LC3_FLOAT)rand_phase((LC3_INT32)seed_local, &cos_F); + + X_i = X[binCounter]; + X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0)); + + + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + + if (noise_mag_scale != 0) { + X_i = valley_magnitude_adj(X_i_new,(LC3_INT32) seed_local, cos_F); + X_i_new = X_i; + } + + mag_chg_local = mag_chg_gr[subInd]; + alpha_local = alpha[subInd]; + + if (beta[subInd] != 0) { + tmp = beta[subInd] * Xavg[subInd]; + if (one_peak_flag_mask == 0) { + tmp = 0; + X_i_new = realtoc(0); + } + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0))); + } + else { + if (one_peak_flag_mask == 0) { + X_i_new = realtoc(0); + } + + X[binCounter] = cmul(realtoc(mag_chg_local), X_i_new); + } + + binCounter++; + + if (binCounter >= gwlpr[subInd + 1]) { + subInd++; + } + } + + e = plocs[i] + delta_corr_up; + if (e > lprotBy2Minus1) { + e = lprotBy2Minus1; + } + + Xph = corr_phase[i]; + + segmentLen = e - (binCounter - 1); + + for (i2 = 0; i2 < segmentLen; i2++) + { + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + X_i = X[binCounter]; + + { + LC3_INT32 nrep =(LC3_INT32) LC3_FLOOR(Xph / (2.0f*(LC3_FLOAT)M_PI)); + + X_i_new = cmul(X_i, cexpi(Xph - (2.0f*(LC3_FLOAT)M_PI*(LC3_FLOAT)nrep))); + } + + + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + + mag_chg_local = mag_chg_gr[subInd]; + alpha_local = alpha[subInd]; + beta_local = beta[subInd]; + if (beta_local != 0) { + + assert(alpha_local == mag_chg_local); + tmp = beta_local * Xavg[subInd]; + + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0))); + } + else + { + X[binCounter] = cmul(realtoc(mag_chg_local), X_i_new); + } + + binCounter++; + + if (binCounter >= gwlpr[subInd + 1]) { + subInd++; + } + } + } + } + + segmentLen = lprotBy2Minus1 - (binCounter - 1); + + for (i = 0; i < segmentLen; i++) { + seed_local = (LC3_FLOAT)rand_phase((LC3_INT32)seed_local, &cos_F); + + X_i = X[binCounter]; + X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI*seed_local/(LC3_FLOAT)32768.0)); + + seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); + + if (noise_mag_scale != 0) { + X_i = valley_magnitude_adj(X_i_new, (LC3_INT32)seed_local, cos_F); + X_i_new = X_i; + } + + if (one_peak_flag_mask == 0) { + X_i_new = realtoc(0); + } + + alpha_local = alpha[subInd]; + mag_chg_local = mag_chg_gr[subInd]; + + if (beta[subInd] != 0) { + assert(alpha_local == mag_chg_local); + tmp = beta[subInd]*Xavg[subInd]; + + if (one_peak_flag_mask == 0) { + tmp = 0; + } + + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local/(LC3_FLOAT)32768.0))); + } + else + { + X[binCounter] = cmul(realtoc(mag_chg_local), X_i_new); + } + + binCounter++; + + if (binCounter >= gwlpr[subInd + 1]) { + subInd++; + } + } + + + *seed = (LC3_INT32)seed_local; +} + +static LC3_INT32 own_rand(LC3_INT32 seed) { + LC3_INT32 retSeed; + assert(seed <= 32767 && seed >= -32768); + retSeed = (13849 + (seed + 32768) * 31821) & 65535; + retSeed -= 32768; + assert(retSeed <= 32767 && retSeed >= -32768); + return retSeed; +} + +static Complex valley_magnitude_adj(Complex X_i_in, LC3_INT32 uni_seed, LC3_FLOAT cos_F) { + LC3_FLOAT scale = ((LC3_FLOAT)0.5*(LC3_FLOAT)uni_seed/(LC3_FLOAT)32768.0) + (LC3_FLOAT)0.5*cos_F; + scale = (LC3_FLOAT)1.0 + (LC3_FLOAT)0.25*scale; + + assert(scale <= (LC3_FLOAT)1.25); + assert(scale >= (LC3_FLOAT)0.75); + + return cmul(X_i_in, realtoc(scale)); +} + +static LC3_INT32 rand_phase(LC3_INT32 seed_in, LC3_FLOAT* cos_F) { + LC3_FLOAT seed = (LC3_FLOAT)own_rand(seed_in); + *cos_F = LC3_COS((LC3_FLOAT)M_PI*seed/(LC3_FLOAT)32768.0); + return (LC3_INT32) seed; +} + diff --git a/lc3plus/plc_phecu_tba_per_band_gain.c b/lc3plus/plc_phecu_tba_per_band_gain.c new file mode 100755 index 0000000000..9f585f28dd --- /dev/null +++ b/lc3plus/plc_phecu_tba_per_band_gain.c @@ -0,0 +1,44 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) +{ + LC3_INT32 i; + + /* per band gain */ + for (i = 0; i < n_grp; i++) { + if (gr_pow_left[i] > 0) + { + trans[i] = gr_pow_right[i] / gr_pow_left[i]; + } + else + { + /* handle division by zero case */ + if (gr_pow_right[i] > 0) + { + trans[i] = 10.0; /* positive/0 transient */ + } + else + { + trans[i] = 1.0; /* 0/0 no transient , no power change */ + } + } + grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOGTEN(trans[i]); + + } + + return; +} + diff --git a/lc3plus/plc_phecu_tba_spect_Xavg.c b/lc3plus/plc_phecu_tba_spect_Xavg.c new file mode 100755 index 0000000000..600b9714e4 --- /dev/null +++ b/lc3plus/plc_phecu_tba_spect_Xavg.c @@ -0,0 +1,45 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_tba_spect_Xavg(LC3_INT32 fs_idx, LC3_INT32 n_grp, LC3_FLOAT *oold_spec_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spec_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *Xavg) +{ + LC3_INT32 i; + LC3_FLOAT XavgEn[MAX_LGW]; + LC3_FLOAT xfp_w_scale, oold_Escale, old_Escale; + + /* 8k 16k 24k 32k 48k */ + LC3_FLOAT flt_xfp_wE_MDCT2FFT_target[5] = { (LC3_FLOAT) 1.9906, (LC3_FLOAT) 4.0445, (LC3_FLOAT) 6.0980, (LC3_FLOAT) 8.1533, (LC3_FLOAT) 12.2603 }; + LC3_INT32 gw_0[10] = { 1, 3, 5, 9, 17, 33, 49, 65, 81, 97 }; + + /* prepare scale factor */ + + xfp_w_scale = LC3_ROUND(flt_xfp_wE_MDCT2FFT_target[fs_idx]/(LC3_FLOAT)16.0*(LC3_FLOAT) 32768.0) / (LC3_FLOAT) LC3_POW(2,11); + + /* prepare left and right subband energies */ + oold_Escale = (*oold_EwPtr) * xfp_w_scale; + old_Escale = (*old_EwPtr) * xfp_w_scale; + for (i = 0;i < n_grp;i++) { + gr_pow_left[i] = oold_spec_shape[i] * oold_Escale; + gr_pow_right[i] = old_spec_shape[i] * old_Escale; + + XavgEn[i] = ((LC3_FLOAT) 0.5) * (gr_pow_left[i] + gr_pow_right[i]) / (gw_0[i + 1] - gw_0[i]); + Xavg[i] = LC3_SQRT(XavgEn[i]); + } + + return; +} + diff --git a/lc3plus/plc_phecu_tba_trans_dect_gains.c b/lc3plus/plc_phecu_tba_trans_dect_gains.c new file mode 100755 index 0000000000..e5f0d3caae --- /dev/null +++ b/lc3plus/plc_phecu_tba_trans_dect_gains.c @@ -0,0 +1,320 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +#define BETA_MUTE_FAC 0.5 /* % attenuation factor per additional bad frame, FX uses 0.5 (shift right with 1 bit) */ +#define BETA_MUTE_FAC_INI 0.5 + + +#define OFF_FRAMES_LIMIT 30 /* 300 ms for LC3 10 ms */ + + + +#define LGW32k 7 +#define LGW16k 5 + + +/* Tables for attentuation of mag_chg, copied from FX */ +/* Tables are in Q15 */ +/* 0.3 dB attenuation per frame for 16 frames, then 6 dB attenuation per frame */ +const LC3_INT32 POW_ATT_TABLE1[OFF_FRAMES_LIMIT + 1] = { 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 24857, 24013, + 23198, 22410, 21650, 20915, 20205, 19519, 9759, 4880, 2440, 1220, + 610, 305, 152, 76, 38, 19, 10, 5, 2, 1, + 0 }; +/* % 0.4 dB attenuation per frame for 16 frames, then 6 dB attenuation per frame */ +const LC3_INT32 POW_ATT_TABLE0[OFF_FRAMES_LIMIT + 1] = { 32767, 31293, 29885, 28540, 27255, 26029, 24857, 23738, 22670, 21650, + 20675, 19745, 18856, 18007, 17197, 16423, 8211, 4106, 2053, 1026, + 513, 257, 128, 64, 32, 16, 8, 4, 2, 1, + 0 }; + +#ifdef PLC2_FADEOUT_IN_MS +#if PLC2_FADEOUT_IN_MS == 0 +/* default setting only requieres two tables */ +const Word16* const POW_ATT_TABLES[1 + 2] = +{ NULL, POW_ATT_TABLE1/*1 0.3dB steps */ , POW_ATT_TABLE0/*2 0.4 dB steps*/, +}; +#else +const LC3_INT32 POW_ATT_TABLE_p3x8_6[] = { + 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 12865, 6433, + 3216, 1608, 804, 402, 201, 101, 50, 25, 13, 6, + 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x8_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31293, 29885, 28540, 27255, 26029, 24857, 23738, 11869, 5935, + 2967, 1484, 742, 371, 185, 93, 46, 23, 12, 6, + 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; + +const LC3_INT32 POW_ATT_TABLE_p3x4_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31656, 30581, 29543, 14772, 7386, 3693, 1847, 923, 462, + 231, 115, 58, 29, 14, 7, 4, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x4_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31293, 29885, 28540, 14270, 7135, 3568, 1784, 892, 446, + 223, 111, 56, 28, 14, 7, 3, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +const LC3_INT32 POW_ATT_TABLE_p3x2_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31656, 15828, 7914, 3957, 1979, 989, 495, 247, 124, + 62, 31, 15, 8, 4, 2, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x2_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 31293, 15647, 7823, 3912, 1956, 978, 489, 244, 122, + 61, 31, 15, 8, 4, 2, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +const LC3_INT32 POW_ATT_TABLE_p3x1_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, + 32, 16, 8, 4, 2, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const LC3_INT32 POW_ATT_TABLE_p4x1_6[OFF_FRAMES_LIMIT + 1] = { + 32767, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, + 32, 16, 8, 4, 2, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + +const LC3_INT32* const POW_ATT_TABLES[1 + 10] = +{ NULL, + POW_ATT_TABLE1 , POW_ATT_TABLE0, /* .3dB x16,16 6dB steps */ /* .4dB x16, 16 6dB steps */ /*original/default */ + POW_ATT_TABLE_p3x8_6, POW_ATT_TABLE_p4x8_6, /* .3dB x8, 24 6dB steps */ /* .4dB x8, 24 6dB steps */ + POW_ATT_TABLE_p3x4_6, POW_ATT_TABLE_p4x4_6, /* .3dB x4, 28 6dB steps */ /* .4dB x4, 28 6dB steps */ + POW_ATT_TABLE_p3x2_6, POW_ATT_TABLE_p4x2_6, /* .3dB x2, 30 6dB steps */ /* .4dB x2, 30 6dB steps */ + POW_ATT_TABLE_p3x1_6, POW_ATT_TABLE_p4x1_6 /* .3dB x1, 30 6dB steps */ /* .4dB x1, 30 6dB steps */ +}; +#endif +#endif + +void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *grp_pow_change, + LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, + LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_FLOAT *ph_dith, LC3_INT32 *tr_dec, + LC3_FLOAT *att_val, LC3_INT32 *attDegreeFrames_dbg, LC3_FLOAT *thresh_dbg) +{ + + LC3_INT32 i; + LC3_FLOAT thresh_tr_dB, max_increase_grp_pow; + LC3_FLOAT max_increase_grp_pow_lin; + LC3_FLOAT grp_pow_change_lin[MAX_LGW]; + LC3_FLOAT XavgFadeinFactor; + + LC3_INT32 burst_att_thresh; + LC3_INT32 att_per_frame_idx; + LC3_INT32 att_always, attDegreeFrames; + + LC3_INT32 FADEOUT_IN_MS, PLC_P800_SPEECH_FADEOUT_IN_FRAMES, + PLC2_FADEOUT_IN_FRAMES, BURST_ATT_THRESH_PRE; + const LC3_INT32 *TABLEQ15; + LC3_INT32 BURST_ATT_THRESH; /* start attenuate with losses in a row, also starts FADE2AVG actions */ + LC3_INT32 ATT_PER_FRAME; /* initial msuic attenuation table ptr, actually implemented in table lookup! */ + LC3_INT32 BETA_MUTE_THR; /* time threshold in 10 ms frames to start beta - noise attenuation */ + + UNUSED(attDegreeFrames_dbg); + + /* constants setup */ + att_always = 0; + + XavgFadeinFactor = -1.0; + + if (PLC2_FADEOUT_IN_MS != 0) + { + if (PLC2_FADEOUT_IN_MS < 0) + { + FADEOUT_IN_MS = PLC_FADEOUT_IN_MS; /* % use TDC - SETTING as input */ + } + else + { + FADEOUT_IN_MS = PLC2_FADEOUT_IN_MS; /* % use a PLC2 individual settinsg */ + } + + PLC_P800_SPEECH_FADEOUT_IN_FRAMES = (LC3_INT32) LC3_FLOOR((LC3_FLOAT)FADEOUT_IN_MS / (LC3_FLOAT)10.0); /* % nominal svaleu for speech */ + + PLC2_FADEOUT_IN_FRAMES = MIN(OFF_FRAMES_LIMIT, MAX(6, 3 * PLC_P800_SPEECH_FADEOUT_IN_FRAMES)); /* for PLC2 we typically maintain energy 3x longer */ + + BURST_ATT_THRESH_PRE = MIN(5, MAX(1, (1 * PLC2_FADEOUT_IN_FRAMES) / 6)); /* nominal 20-40 ms to start actual muting, will be thresh +1 fot assumed music */ + + ATT_PER_FRAME = MIN(10, MAX(2, 2 * (6 - BURST_ATT_THRESH_PRE))); /* % we let the BURST_ATT_thresh control the initial table selection */ + BURST_ATT_THRESH = MIN(BURST_ATT_THRESH_PRE, 4); + BETA_MUTE_THR = MIN(4 + (OFF_FRAMES_LIMIT / 2) + 1, MAX(4, BURST_ATT_THRESH + 1 + (LC3_INT32)LC3_POW((LC3_FLOAT)2.0,BURST_ATT_THRESH_PRE - (LC3_FLOAT)1))); /* nominal time to start mandatory decrease of Xavg */ + } + + + /* Initialize in the same way as done in trans_burst_ana_fx(), even though this is not really needed */ + burst_att_thresh = BURST_ATT_THRESH; + att_per_frame_idx = ATT_PER_FRAME; + + + /* 10ms constants */ + thresh_tr_dB = 10.0; /* dB threshold kept same as for 20ms, even though transient analysis frame size was shortened */ + max_increase_grp_pow = 0; /* maximum amplification(dB) in case of onset transients, offset always deacy */ + + max_increase_grp_pow_lin = (LC3_FLOAT)1.0*LC3_POW((LC3_FLOAT)10.0, max_increase_grp_pow / (LC3_FLOAT)10.0)*(LC3_FLOAT)(32767.0 / 32768.0); + + + /* envelope setting */ + burst_att_thresh = BURST_ATT_THRESH + 1; + att_per_frame_idx = ATT_PER_FRAME - 1; + + + attDegreeFrames = 0; + if (burst_len > burst_att_thresh) + { + att_always = 1; + + /* Added to be able to able to use tables to be aligned with FX */ + /* Limit attDegreeFrames to OFF_FRAMES_LIMIT */ + attDegreeFrames = burst_len - burst_att_thresh; + + if (attDegreeFrames > OFF_FRAMES_LIMIT) + { + attDegreeFrames = OFF_FRAMES_LIMIT; + } + } + + + set_vec(1.0 * (32767.0/32768.0), mag_chg, n_grp); + set_vec(0.0, ph_dith, n_grp); + + set_vec(1.0 * (32767.0/32768.0), alpha, n_grp); + set_vec(0.0, beta, n_grp); + set_vec_int(0, tr_dec, n_grp); + + set_vec(1.0 * (32767.0/32768.0), att_val, n_grp); + + + + /* transient detection per band */ + for (i = 0;i < n_grp; i++) { + if(burst_len == 1) + { + /* first bad frame */ + grp_pow_change_lin[i] = LC3_POW((LC3_FLOAT)10.0, grp_pow_change[i]/(LC3_FLOAT)10.0); + + *stPhECU_beta_mute = BETA_MUTE_FAC_INI; + *stPhECU_beta_mute = *stPhECU_beta_mute / (LC3_FLOAT)2.0; + + /* transient processing */ + /* transients may be both rise and decay transients !! */ + + + if(LC3_FABS(grp_pow_change[i]) >= thresh_tr_dB) + { + + tr_dec[i] = 1; + } + + + /* magnitude modification */ + att_val[i] = 0.0f; + if(tr_dec[i] || att_always) { + + att_val[i] = MIN(max_increase_grp_pow_lin, grp_pow_change_lin[i]); /* % linear values !! */ + att_val[i] = LC3_SQRT(att_val[i]); + mag_chg[i] = att_val[i]; + stPhECU_mag_chg_1st[i] = att_val[i]; + } + else + { + mag_chg[i] = 1.0 * (LC3_FLOAT)(32767.0/32768.0); + stPhECU_mag_chg_1st[i] = (LC3_FLOAT)1.0; + } + } + else + { + /* burst handling based on states */ + + assert(burst_len >= 2); /* states used here */ + tr_dec[i] = 0; + + if (PLC_FADEOUT_IN_MS > 0) + { + assert(att_per_frame_idx >= 1 && att_per_frame_idx <= 10); + TABLEQ15 = POW_ATT_TABLES[att_per_frame_idx]; + att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT) TABLEQ15[MIN(OFF_FRAMES_LIMIT, attDegreeFrames )] / (LC3_FLOAT)32768.0); /* Table idx 0...N-1 therefore no + 1 */ + att_val[i] = att_val[i]; + } + else + { + + if (att_per_frame_idx == ATT_PER_FRAME) + { + att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT)POW_ATT_TABLE0[MIN(OFF_FRAMES_LIMIT, attDegreeFrames)] / (LC3_FLOAT)32768.0); + } + else + { + att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT)POW_ATT_TABLE1[MIN(OFF_FRAMES_LIMIT, attDegreeFrames)] / (LC3_FLOAT)32768.0); + } + } + + + if ( (att_val[i] != 0) && (att_val[i] * (LC3_FLOAT)32768.0 < (LC3_FLOAT)0.5) ) + { + att_val[i] = 0.0; /* for SNR measurments match in float lowest possible level to BASOP representation */ + } + + /* Apply attenuation */ + mag_chg[i] = stPhECU_mag_chg_1st[i]; + + mag_chg[i] = mag_chg[i] * att_val[i]; /* add additional attenuation from burst attenation logic */ + + if ((mag_chg[i] != 0) && (mag_chg[i] * (LC3_FLOAT)32768.0 < (LC3_FLOAT)0.5)) + { + mag_chg[i] = 0; /* for SNR measurments match in float lowest possible level to BASOP representation */ + } + + + + if(burst_len > BETA_MUTE_THR) + { + *stPhECU_beta_mute = *stPhECU_beta_mute * (LC3_FLOAT)BETA_MUTE_FAC; + } + + alpha[i] = mag_chg[i]; + + if (alpha[i] >= (LC3_FLOAT)(32766.0 / 32768.0)) + { + beta[i] = 0; /* align to BASOP more efficent use of beta */ + } + else + { + beta[i] = LC3_SQRT((LC3_FLOAT)1.0 - alpha[i]* alpha[i]) * *stPhECU_beta_mute; + } + + if ( i >= LGW32k-1) { + beta[i] = beta[i] * (LC3_FLOAT)0.1; + } + else if( i >= LGW16k-1) + { + beta[i] = beta[i] * (LC3_FLOAT)0.5; + } + + + /* limit Xavg noise contribution further in case of offset / tr_decay */ + + if ((burst_len <= burst_att_thresh) && (stPhECU_mag_chg_1st[i] < (LC3_FLOAT)(32767.0 / 32768.0))) + { + XavgFadeinFactor = (LC3_FLOAT)(burst_len - (LC3_FLOAT)1.0) / burst_att_thresh; + + XavgFadeinFactor = MIN((LC3_FLOAT)1.0, XavgFadeinFactor); + + beta[i] = beta[i] * XavgFadeinFactor; + + } + } + } + + if (thresh_dbg != NULL) + { + *thresh_dbg = XavgFadeinFactor; + } + + return; +} + diff --git a/lc3plus/plc_phecu_trans_burst_ana_sub.c b/lc3plus/plc_phecu_trans_burst_ana_sub.c new file mode 100755 index 0000000000..c860cd6ce3 --- /dev/null +++ b/lc3plus/plc_phecu_trans_burst_ana_sub.c @@ -0,0 +1,48 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "defines.h" +#include "functions.h" + + +void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, + LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, + LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, + LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg) +{ + LC3_FLOAT gr_pow_left[MAX_LGW]; + LC3_FLOAT gr_pow_right[MAX_LGW]; + LC3_FLOAT trans[MAX_LGW]; + LC3_FLOAT grp_pow_change[MAX_LGW]; + LC3_FLOAT ph_dith[MAX_LGW]; + LC3_FLOAT att_val[MAX_LGW]; + LC3_INT32 tr_dec[MAX_LGW]; + + LC3_INT32 attDegreeFrames; + LC3_FLOAT thresh_dbg; + + UNUSED(tr_dec_dbg); + UNUSED(gpc_dbg); + + if (burst_len <= 1) + { + plc_phEcu_tba_spect_Xavg(fs_idx, n_grp, oold_spect_shape, oold_EwPtr, old_spect_shape, old_EwPtr, gr_pow_left, gr_pow_right, stPhECU_Xavg); + + plc_phEcu_tba_per_band_gain(n_grp, gr_pow_left, gr_pow_right, trans, grp_pow_change); + + } + + + plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg); + + return; +} + diff --git a/lc3plus/plc_tdc.c b/lc3plus/plc_tdc.c new file mode 100755 index 0000000000..1a1a408f4d --- /dev/null +++ b/lc3plus/plc_tdc.c @@ -0,0 +1,763 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +/***************************************************************************\ + * contents/description: Main function for Time domain concealment +\***************************************************************************/ + +#include +#include "functions.h" + + +static LC3_INT16 TDC_random_short(LC3_INT16 *seed); +static LC3_FLOAT TDC_get_gainp(const LC3_FLOAT x[], const LC3_FLOAT y[], LC3_INT32 n); +static LC3_FLOAT TDC_get_gainc(const LC3_FLOAT x[], const LC3_FLOAT y[], const LC3_FLOAT *gain_p, const LC3_INT32 n, const LC3_INT32 frame_dms); +static void TDC_LPC_synthesis(const LC3_FLOAT a[], LC3_FLOAT x[], LC3_FLOAT y[], LC3_INT32 l, const LC3_FLOAT mem[], LC3_INT32 lpcorder, LC3_FLOAT *buf); +static void TDC_LPC_residu(const LC3_FLOAT *a, LC3_FLOAT *x, LC3_FLOAT *y, LC3_INT32 l, LC3_INT32 lpcorder); +static void TDC_highPassFiltering(const LC3_INT32 L_buffer, LC3_FLOAT exc2[], const LC3_FLOAT hp_filt[], const LC3_INT32 l_fir_fer); +static void TDC_f_preemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, LC3_FLOAT *mem); +static void TDC_deemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, const LC3_FLOAT *mem); +const LC3_FLOAT TDC_high_16[TDC_L_FIR_HP] = { 0.f, -0.0205f, -0.0651f, -0.1256f, -0.1792f, 0.8028f, -0.1792f, -0.1256f, -0.0651f, -0.0205f, 0.f }; +const LC3_FLOAT TDC_high_32[TDC_L_FIR_HP] = {-0.0517f, -0.0587f, -0.0820f, -0.1024f, -0.1164f, 0.8786f, -0.1164f, -0.1024f, -0.0820f, -0.0587f, -0.0517f}; +const LC3_FLOAT TDC_high_16_harm[TDC_L_FIR_HP] = { 0.0053f, 0.0000f, -0.0440f, 0.0000f, 0.2637f, 0.5500f, 0.2637f, 0.0000f, -0.0440f, 0.0000f, 0.0053f}; +const LC3_FLOAT TDC_high_32_harm[TDC_L_FIR_HP] = {-0.0053f, -0.0037f, -0.0140f, 0.0180f, 0.2668f, 0.4991f, 0.2668f, 0.0180f, -0.0140f, -0.0037f, -0.0053f}; +static void TDC_levinson(LC3_FLOAT *acf, LC3_INT32 len, LC3_FLOAT *out); +static void TDC_copyFLOAT(const LC3_FLOAT * X, LC3_FLOAT * Z, LC3_INT32 n); +static LC3_FLOAT TDC_dotFLOAT(const LC3_FLOAT * X, const LC3_FLOAT * Y, LC3_INT32 n); + +const LC3_INT32 beforeNextIncArray[4][4] = {{0,0,0,1}, + {0,1,0,1}, + {0,1,1,1}, + {1,1,1,1}}; +const LC3_INT32 nextIncArray[4][4] = {{1,0,0,0}, + {1,0,1,0}, + {1,0,1,1}, + {1,1,1,1}}; + +void processTdcApply_fl(const LC3_INT32 pitch_int, + const LC3_FLOAT *preemphFac, + const LC3_FLOAT* A, + const LC3_INT32 lpc_order, + const LC3_FLOAT* pcmbufHist, + const LC3_INT32 max_len_pcm_plc, + const LC3_INT32 N, + const LC3_INT32 frame_dms, + const LC3_INT32 SampRate, + const LC3_INT32 nbLostFramesInRow, + const LC3_INT32 overlap, + const LC3_FLOAT *stabFac, + LC3_FLOAT harmonicBuf[MAX_PITCH], + LC3_FLOAT synthHist[M], + LC3_INT32* fract, + LC3_INT16* seed, + LC3_FLOAT* gain_c, + LC3_FLOAT* alpha, + LC3_FLOAT* synth + ) +{ + LC3_FLOAT step, step_n; + LC3_INT32 i, len, Tc, nbLostCmpt_loc, nextInc, beforeNextInc; + LC3_FLOAT gain_h, tmp, gain_p; + LC3_FLOAT *exc2, *exc_buf, *exc, *x_pre, *buf, *pt_exc, *pt1_exc, *synthMemPtr; + LC3_FLOAT *harmonicBufPtr; + LC3_FLOAT synth_mem[M]; + const LC3_FLOAT *hp_filt, *high_harm; + LC3_FLOAT gainInov; + LC3_FLOAT hpBlendFac; + char *scratchSpace1st, *scratchSpaceTmp; + char scratchSpace[(MAX_LEN_PCM_PLC + MDCT_MEM_LEN_MAX + MAX_LEN_PCM_PLC + 1 + M) * sizeof(LC3_FLOAT)]; + LC3_FLOAT alphaPrev; + LC3_FLOAT throttle; + LC3_INT32 frame_dms_idx, nbLostFramesInRow_mod; + + memset(synth_mem, 0, M * sizeof(LC3_FLOAT)); + memset(scratchSpace, 0, (MAX_LEN_PCM_PLC + MDCT_MEM_LEN_MAX + MAX_LEN_PCM_PLC + 1 + M) * sizeof(LC3_FLOAT)); + + /* len of synthesized signal */ + len = N + overlap; + + nbLostCmpt_loc = floor(frame_dms/100.0 * (nbLostFramesInRow - 1) + 1); + frame_dms_idx = frame_dms / 25 - 1; /* 0,1,2,3 */ + nbLostFramesInRow_mod = (nbLostFramesInRow - 1) % 4; + + beforeNextInc = beforeNextIncArray[frame_dms_idx][nbLostFramesInRow_mod]; + nextInc = nextIncArray [frame_dms_idx][nbLostFramesInRow_mod]; + + if (nbLostCmpt_loc > PLC_FADEOUT_IN_MS/10) + { + gain_p = 0; + *gain_c = 0; + *alpha = 0; + memset(synth, 0, len * sizeof(LC3_FLOAT)); + return; + } + + Tc = pitch_int; + if (*fract > 0) { + Tc++; + } + + /*---------------------------------------------------------------- + * Buffer Initialization for timeDomainConcealment_Apply + * + * 1st + * |--exc_buf--|--x_pre--| + * | |--exc2--| + * | |--buf (LPC Syn)--| + * + *---------------------------------------------------------------*/ + + scratchSpace1st = scratchSpace; + exc_buf = (LC3_FLOAT*)scratchSpace1st; scratchSpace1st += (LC3_INT32)sizeof(LC3_FLOAT) * (Tc + N/2 + len); + exc = exc_buf + (Tc + N/2); + + scratchSpaceTmp = scratchSpace1st; + x_pre = (LC3_FLOAT*)scratchSpaceTmp; scratchSpaceTmp += (LC3_INT32)sizeof(LC3_FLOAT) * (lpc_order + Tc + N/2 + 1); + + /*---------------------------------------------------------------* + * LPC Residual * + *---------------------------------------------------------------*/ + if (nbLostFramesInRow == 1) + { + /* copy buffer to pre-emphasis buffer */ + TDC_copyFLOAT(&(pcmbufHist[max_len_pcm_plc-(lpc_order+Tc+N/2+1)]), &(x_pre[0]), lpc_order+Tc+N/2+1); + + /* apply pre-emphasis to the signal */ + TDC_f_preemph(&(x_pre[1]), preemphFac, lpc_order+Tc+N/2, &x_pre[0]); + + /* copy memory for LPC synth */ + TDC_copyFLOAT(&(x_pre[Tc+N/2+1]), synth_mem, lpc_order); + + /* LPC Residual */ + TDC_LPC_residu(A, &(x_pre[lpc_order+1]), &(exc[-(Tc+N/2)]), Tc+N/2, lpc_order); + } + + /*---------------------------------------------------------------* + * Calculate gains * + *---------------------------------------------------------------*/ + if (nbLostFramesInRow == 1) + { + if (pitch_int == Tc) + { + gain_p = TDC_get_gainp( &(x_pre[lpc_order+Tc+1]), &(x_pre[lpc_order+1]), N/2 ); + } + else + { + tmp = TDC_get_gainp( &(x_pre[lpc_order+Tc+1]), &(x_pre[lpc_order+2]), N/2 ); + gain_p = TDC_get_gainp( &(x_pre[lpc_order+Tc+1]), &(x_pre[lpc_order+1]), N/2 ); + + if (tmp > gain_p) { + Tc = pitch_int; + gain_p = tmp; + *fract = 0; + } + } + + if(gain_p < 0.0f) + { + gain_p = 0.0f; + } + + if(gain_p > 1.0f) + { + gain_p = 1.0f; + } + + *gain_c = 0.0f; + + if (pitch_int == Tc) + { + *gain_c = TDC_get_gainc( &(exc[-1]), &(exc[-1-Tc]), &gain_p, N/2, frame_dms ); + } + else + { + tmp = TDC_get_gainc( &(exc[-1]), &(exc[-1-pitch_int]), &gain_p, N/2, frame_dms ); + *gain_c = TDC_get_gainc( &(exc[-1]), &(exc[-1-Tc]) , &gain_p, N/2, frame_dms ); + *gain_c = MIN(*gain_c, tmp); + } + } + else + { + gain_p = *alpha; + } + + /*---------------------------------------------------------------* + * Damping factor * + *---------------------------------------------------------------*/ + + alphaPrev = 1; + if (nbLostFramesInRow > 1) + { + alphaPrev = *alpha; + } + + if (nextInc != 0) + { + switch (nbLostCmpt_loc) + { + case 1: + *alpha = (LC3_FLOAT)sqrt(gain_p); + if ( *alpha > 0.98f ) + { + *alpha = 0.98f; + } + else if ( *alpha < 0.925f ) + { + *alpha = 0.925f; + } + break; + case 2: + *alpha = (0.63f + 0.35f * (*stabFac)) * gain_p; + if ( *alpha < 0.919f ) + { + *alpha = 0.919f; + } + break; + default: + *alpha = (0.652f + 0.328f * (*stabFac)) * gain_p; + } + } + + if (nbLostCmpt_loc > 3) + { + switch (frame_dms) + { + case 25: *alpha *= PLC34_ATTEN_FAC_025; break; + case 50: *alpha *= PLC34_ATTEN_FAC_050; break; + case 100: *alpha *= PLC34_ATTEN_FAC_100; break; + } + } + + if (nbLostCmpt_loc > 5) + { + gain_p = *alpha; + } + + /*---------------------------------------------------------------* + * Construct the harmonic part * + * Last pitch cycle of the previous frame is repeatedly copied. * + *---------------------------------------------------------------*/ + + pt_exc = harmonicBuf; + pt1_exc = exc - Tc; + + if( nbLostFramesInRow == 1 ) + { + if (*stabFac >= 1) + { + TDC_copyFLOAT(pt1_exc, pt_exc, Tc); + } + else + { + /* These values are necessary for the last five filtered samples */ + TDC_copyFLOAT(&exc[-Tc], exc, (TDC_L_FIR_HP-1)/2); + + high_harm = TDC_high_32_harm; + if (SampRate <= 16000) + { + high_harm = TDC_high_16_harm; + } + + for( i = 0; i < Tc; i++ ) + { + pt_exc[i] = TDC_dotFLOAT(&pt1_exc[i-(TDC_L_FIR_HP-1)/2], high_harm, TDC_L_FIR_HP); + } + } + } + + /*---------------------------------------------------------------* + * Construct the random part of excitation * + *---------------------------------------------------------------*/ + scratchSpaceTmp = scratchSpace1st; + exc2 = (LC3_FLOAT*)scratchSpaceTmp; scratchSpaceTmp += (LC3_INT32)sizeof(LC3_FLOAT) * (len + TDC_L_FIR_HP - 1); + + for (i = 0; i < len + TDC_L_FIR_HP - 1; i++) { + exc2[i] = (LC3_FLOAT)TDC_random_short(seed); + } + + /* high pass noise */ + if (SampRate <= 16000 ) + { + hp_filt = TDC_high_16; + } else { + hp_filt = TDC_high_32; + } + + if ( nbLostFramesInRow == 1 ) + { + TDC_highPassFiltering(len, exc2, hp_filt, TDC_L_FIR_HP); + } + else + { + /* moves from 0 to 1, speed is defined by PLC3_HPBLENDTHROTTLE */ + throttle = (LC3_FLOAT)nbLostCmpt_loc / (nbLostCmpt_loc + PLC3_HPBLENDTHROTTLE); + hpBlendFac = (1 - *alpha) * throttle; + + for (i = 0; i < len; i++) + { + exc2[i] = hpBlendFac * exc2[i+TDC_L_FIR_HP/2] + (1 - hpBlendFac) * TDC_dotFLOAT(&exc2[i], hp_filt, TDC_L_FIR_HP ); + } + } + + /* normalize energy */ + gainInov = 1.0f / (LC3_FLOAT)sqrt(TDC_dotFLOAT( exc2, exc2, N ) / (LC3_FLOAT)N + 0.01f ); + gainInov *= (1.1f - 0.75* gain_p); + + /* gains */ + gain_h = alphaPrev; + tmp = *gain_c * *alpha / alphaPrev; + + /* update steps */ + step = (1.0f/(LC3_FLOAT)N) * (gain_h - *alpha); + step_n = (1.0f/(LC3_FLOAT)N) * (*gain_c - tmp); + + /*---------------------------------------------------------------* + * Construct the total excitation * + *---------------------------------------------------------------*/ + harmonicBufPtr = harmonicBuf + ((nbLostFramesInRow - 1) * N) % Tc; + + for ( i = 0; i < len; i++ ) { + /* harmonic */ + if (harmonicBufPtr - harmonicBuf >= Tc) { + harmonicBufPtr = harmonicBuf; + } + exc[i] = *harmonicBufPtr++; + exc[i] *= gain_h; + + /* random */ + exc2[i] *= *gain_c * gainInov; + + /* total */ + exc[i] = exc[i] + exc2[i]; + + /* update */ + gain_h -= step; + gain_h = MAX(gain_h, 0); + *gain_c -= step_n; + *gain_c = MAX(*gain_c, 0); + } + + *gain_c = tmp; + + /*----------------------------------------------------------* + * Compute the synthesis speech * + *----------------------------------------------------------*/ + buf = (LC3_FLOAT*)scratchSpace1st; scratchSpace1st += (LC3_INT32)sizeof(LC3_FLOAT) * (len + lpc_order); + synthMemPtr = synth_mem; + if (nbLostFramesInRow != 1) + { + synthMemPtr = synthHist; + } + + TDC_LPC_synthesis(A, + &exc[0], + synth, + len, + synthMemPtr, + lpc_order, + buf); + + TDC_copyFLOAT(&synth[N-lpc_order], synthHist, lpc_order); + + /*----------------------------------------------------------* + * Deemphasis * + *----------------------------------------------------------*/ + TDC_deemph( synth, preemphFac, len, &pcmbufHist[max_len_pcm_plc-1] ); + + /*----------------------------------------------------------* + * Fade to zero * + *----------------------------------------------------------*/ + if (beforeNextInc != 0) + { + if (nbLostCmpt_loc == PLC_FADEOUT_IN_MS/10) + { + gain_h = 1; + step = 1.0f/(LC3_FLOAT)N; + for ( i = 0; i < N; i++ ) { + synth[i] *= gain_h; + gain_h -= step; + } + memset(&synth[N], 0, overlap * sizeof(LC3_FLOAT)); + } + } +} + +/* Take only real part */ +void processTdcInverseOdft_fl(LC3_FLOAT *in, LC3_INT32 n_bands, LC3_FLOAT *out, LC3_INT32 lpc_order) +{ + LC3_INT32 i, j, k; + LC3_FLOAT buf[2*MAX_BANDS_NUMBER_PLC]; + Complex sum; + Complex res; + + /* Buffer for ifft */ + j = 0; + for (i = 0; i < n_bands - 1; i += 2) + { + buf[j] = in[i]; + j++; + } + + for (i = n_bands - 1; i > 0; i -= 2) + { + buf[j] = in[i]; + j++; + } + + for (i = 0; i < n_bands; i++) + { + buf[j] = in[i]; + j++; + } + + /* ifft */ + for (j = 0; j < n_bands; j++) + { + sum.r = 0, sum.i = 0; + res.r = 0, res.i = 0; + for (k = 0; k < n_bands; k++) + { + res = cexpi((2 * M_PI * (LC3_FLOAT) (j * k)) / (LC3_FLOAT) n_bands); + res.r = res.r * buf[k]; + res.i = res.i * buf[k]; + sum = cadd(sum, res); + } + + res = cexpi((LC3_FLOAT) j * M_PI / (2.0 * (LC3_FLOAT) n_bands)); + out[j] = (sum.r * res.r - sum.i * res.i); + } + + out[0] = out[0] * 1.0001; + if (out[0] == 0) + { + out[0] = 1; + zero_float(&out[1], lpc_order); + } +} + +void processTdcPreemphasis_fl(LC3_FLOAT *in, LC3_FLOAT *pre_emph_factor, LC3_INT32 n_bands) +{ + LC3_INT32 i; + + for (i = 0; i < n_bands; i++) + { + in[i] = in[i] * (1.0 - 2.0 * (*pre_emph_factor) * LC3_COS(2.0 * M_PI * (0.5 + (LC3_FLOAT) i) / (2.0 * (LC3_FLOAT) n_bands)) + (*pre_emph_factor) * (*pre_emph_factor)); + } +} + +void processTdcLpcEstimation_fl(LC3_FLOAT *r, LC3_INT32 fs_idx, LC3_INT32 len, LC3_FLOAT *A, LC3_INT32 frame_dms) +{ + LC3_INT32 i; + const LC3_FLOAT *lpc_array; + + lpc_array = plc_tdc_lpc_all[fs_idx]; + + if (fs_idx == 0 && frame_dms == 25) + { + lpc_array = plc_tdc_lpc_8_25ms; + } + + /* r[0] = r[0] * 1 */ + for (i = 1; i < len; i++) + { + r[i] = r[i] * lpc_array[i]; + } + + TDC_levinson(r, len - 1, A); +} + +/** random + * + * Parameters: + * seed I/O: seed for random number + * + * Function: + * Signed 16 bits random generator. + * + * Returns: + * random number + */ +static LC3_INT16 TDC_random_short(LC3_INT16 *seed) +{ + *seed = (LC3_INT16) (*seed * 12821L + 16831L); + return(*seed); +} + +static LC3_FLOAT TDC_get_gainp( /* output: gain of pitch */ + const LC3_FLOAT x[], /* input : input signal */ + const LC3_FLOAT y[], /* input : shifted input signal */ + LC3_INT32 n /* input : vector length */ +) +{ + LC3_FLOAT corr, ener; + LC3_INT16 i; + + corr = 0; ener = 1e-6f; + + for (i = 0; i < n; i++) + { + corr += x[i]*y[i]; + ener += y[i]*y[i]; + } + + return(corr/ener); +} + +static LC3_FLOAT TDC_get_gainc( /* output: gain of code */ + const LC3_FLOAT x[], /* input : input signal */ + const LC3_FLOAT y[], /* input : shifted input signal */ + const LC3_FLOAT *gain_p, /* input : gain of pitch */ + const LC3_INT32 n, /* input : vector length */ + const LC3_INT32 frame_dms /* input : frame length in dms */ +) +{ + LC3_FLOAT gain_c; + LC3_FLOAT gain_c_max; + LC3_INT16 i; + + gain_c = 0; gain_c_max = 0; + + for (i = 0; i < n; i++) + { + gain_c += ( x[-i] - *gain_p * y[-i] ) * ( x[-i] - *gain_p * y[-i] ); + } + + if (frame_dms < 100) + { + for (i = 0; i < n; i++) + { + gain_c_max += (x[-i] * x[-i]); + } + gain_c = MIN(gain_c, gain_c_max); + } + + gain_c = (LC3_FLOAT)sqrt(gain_c / n ); + + return gain_c; +} + +static void TDC_highPassFiltering(const LC3_INT32 L_buffer, /* i: buffer length */ + LC3_FLOAT exc2[], /* i/o: unvoiced excitation before the high pass filtering */ + const LC3_FLOAT hp_filt[], /* i: high pass filter coefficients */ + const LC3_INT32 l_fir_fer) /* i: high pass filter length */ +{ + LC3_INT32 i; + + for( i=0 ; i< L_buffer; i++ ) { + exc2[i] = TDC_dotFLOAT(&exc2[i], hp_filt, l_fir_fer); + } +} + +static void TDC_LPC_synthesis( + const LC3_FLOAT a[], + LC3_FLOAT x[], + LC3_FLOAT y[], + LC3_INT32 l, + const LC3_FLOAT mem[], + LC3_INT32 lpcorder, + LC3_FLOAT *buf + ) +{ + LC3_FLOAT s, *yy; + LC3_INT32 i, j; + + /* copy initial filter states into synthesis buffer */ + for (i=0; i < lpcorder; i++) + { + buf[i] = mem[i]; + } + yy = &buf[i]; + + for (i = 0; i < l; i++) + { + s = x[i]; + for (j = 1; j <= lpcorder; j++) + { + s -= a[j] * yy[i- j]; + } + y[i] = s; + yy[i] = y[i]; + } + + return; +} + + +/** TDC_LPC_residu + * + * Parameters: + * a I: LP filter coefficients (Q12) + * x I: input signal (usually speech) + * y O: output signal (usually residual) + * l I: size of filtering + * lpcorder I: Order of LP filter + * + * Function: + * Compute the LP residual by filtering the input speech through A(z). + * + * Returns: + * void + */ +static void TDC_LPC_residu(const LC3_FLOAT *a, LC3_FLOAT *x, LC3_FLOAT *y, LC3_INT32 l, LC3_INT32 lpcorder) +{ + LC3_FLOAT s; + LC3_INT32 i, j; + + for (i = 0; i < l; i++) + { + s = x[i]; + for (j = 1; j <= lpcorder; j++) + { + s += a[j] * x[i - j]; + } + y[i] = s; + } + + return; +} + + +/** TDC_f_preemph + * + * Parameters: + * signal I/O: signal + * mu I: preemphasis factor + * L I: vector size + * mem I: memory (x[-1]) + * + * Function: + * Filtering through 1 - mu z^-1 + * + * + * Returns: + * void + */ + +static void TDC_f_preemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, LC3_FLOAT *mem) +{ + LC3_INT32 i; + + for (i = L - 1; i > 0; i--) + { + signal[i] = signal[i] - *mu * signal[i - 1]; + } + + signal[0] -= *mu * (*mem); + + return; +} + +/* + * TDC_deemph + * + * Parameters: + * signal I/O: signal + * mu I: deemphasis factor + * L I: vector size + * mem I: memory (signal[-1]) + * + * Function: + * Filtering through 1/(1-mu z^-1) + * Signal is divided by 2. + * + * Returns: + * void + */ +static void TDC_deemph(LC3_FLOAT *signal, const LC3_FLOAT *mu, LC3_INT32 L, const LC3_FLOAT *mem) +{ + LC3_INT32 i; + + signal[0] = signal[0] + *mu * (*mem); + + for (i = 1; i < L; i++) + { + signal[i] = signal[i] + *mu * signal[i - 1]; + } + + return; +} + +static void TDC_copyFLOAT(const LC3_FLOAT * X, LC3_FLOAT * Z, LC3_INT32 n) +{ + /* no values to copy */ + if ( (n < 1) || (X == Z) ){ + return; + } + /* If overlapping */ + if ( ( (Z > X) && (Z < X+n) ) || ( (Z < X) && (X < Z+n) ) ) { + memmove(Z, X, sizeof(LC3_FLOAT)*n); + } + else{ + memcpy(Z, X, sizeof(LC3_FLOAT)*n); + } +} + +static LC3_FLOAT TDC_dotFLOAT(const LC3_FLOAT * X, const LC3_FLOAT * Y, LC3_INT32 n) +{ + LC3_FLOAT acc; + LC3_INT32 i; + + acc = 0; + if (n) { + acc = X[0]*Y[0]; + } + + for (i=1; i= 0; i--) + { + out[j] = buf[k] - g * buf2[i]; + j++; k++; + } + + v = v * (1.0 - g * g); + } + + move_float(buf, out, len); + out[0] = 1; + + j = 1; + for (i = len - 1; i >= 0; i--) + { + out[j] = -buf[i]; + j++; + } +} + diff --git a/lc3plus/plc_tdc_tdac.c b/lc3plus/plc_tdc_tdac.c new file mode 100755 index 0000000000..329361b14c --- /dev/null +++ b/lc3plus/plc_tdc_tdac.c @@ -0,0 +1,80 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processTdcTdac_fl(const LC3_FLOAT *synth_inp, const LC3_FLOAT *win, LC3_INT32 frame_length, LC3_INT32 la_zeroes, LC3_FLOAT *ola_mem) +{ + LC3_INT32 i, L, LD2, NZ, synth_len; + LC3_FLOAT synth[(MAX_LEN + MDCT_MEM_LEN_MAX)], *synth1, *synth2, *ola_mem1, *ola_mem2, sz; + const LC3_FLOAT *win1, *win2, *win3, *win4; + + assert(la_zeroes <= frame_length / 2); + + L = frame_length; + LD2 = L/2; + NZ = LD2 - la_zeroes; + synth_len = 2*L - la_zeroes; + + move_float(synth, synth_inp, synth_len); + + /* calculate x_ov[L+la_zeroes] ... x_ov[2*L-1] */ + win1 = &win[L + LD2 - 1]; + win2 = &win[L + LD2]; + + win3 = &win[LD2 - 1]; + win4 = &win[LD2]; + + synth1 = &synth[L + LD2 - 1 - la_zeroes]; + synth2 = &synth[L + LD2 - la_zeroes]; + + ola_mem1 = &ola_mem[LD2 - la_zeroes]; + ola_mem2 = &ola_mem[LD2 - la_zeroes - 1]; + + for (i = 0; i < NZ; i++) + { + /* analysis windowing + 2N -> N */ + sz = *synth1 * *win1 + *synth2 * *win2; + + /* N -> 2N + synthesis windowing */ + *ola_mem1 = sz * *win3; + *ola_mem2 = sz * *win4; + + /* pointer update */ + win1--; + win2++; + win3--; + win4++; + synth1--; + synth2++; + ola_mem1++; + ola_mem2--; + } + + for (; i < LD2; i++) + { + /* analysis windowing + 2N -> N */ + sz = *synth1 * *win1; + + /* N -> 2N + synthesis windowing */ + *ola_mem1 = sz * *win3; + + /* pointer update */ + win1--; + win2++; + win3--; + synth1--; + synth2++; + ola_mem1++; + } +} + diff --git a/lc3plus/plc_update.c b/lc3plus/plc_update.c new file mode 100755 index 0000000000..a151420eb7 --- /dev/null +++ b/lc3plus/plc_update.c @@ -0,0 +1,125 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + +#include "functions.h" +#include "options.h" + + +void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, + LC3_INT32 *nbLostCmpt, LC3_FLOAT *cum_alpha, LC3_INT32 bfi, LC3_INT32 *prevBfi, LC3_INT32 *prevprevBfi) +{ + LC3_FLOAT tmp[MAX_LEN_PCM_PLC]; + + move_float(tmp, &PlcAdvSetup->pcmbufHist[frame_length], PlcAdvSetup->max_len_pcm_plc - frame_length); + move_float(&PlcAdvSetup->pcmbufHist[0], tmp, PlcAdvSetup->max_len_pcm_plc - frame_length); + move_float(&PlcAdvSetup->pcmbufHist[PlcAdvSetup->max_len_pcm_plc - frame_length], syntM, frame_length); + + if (bfi != 1) + { + *nbLostCmpt = 0; + *cum_alpha = 1; + + if (PlcAdvSetup) + { + move_float(PlcAdvSetup->scf_q_old_old, PlcAdvSetup->scf_q_old, M); + move_float(PlcAdvSetup->scf_q_old, scf_q, M); + /* PLC fullband transient detector setting for non-bfi frames */ + PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev = 0; /* fullband transient not active */ + } + } + + *prevprevBfi = *prevBfi; + *prevBfi = bfi; +} + +void plc_phEcu_processPLCspec2shape(LC3_INT16 prev_bfi, LC3_INT16 bfi, LC3_FLOAT q_d[], LC3_INT32 yLen, + LC3_FLOAT *stPhECU_oold_grp_shape, LC3_FLOAT *stPhECU_old_grp_shape) +{ + LC3_INT32 i, j, N_grp; + LC3_INT32 local_prev_bfi; + LC3_INT32 fs_idx; + LC3_FLOAT E_tot = 0.0; + LC3_INT32 l_grp; + LC3_FLOAT *pX; + + if (bfi != 1) /* compute only for bfi== 0 or 2 */ + { + fs_idx = (LC3_INT32)floor(yLen / 100); + assert(fs_idx < 5); + N_grp = xavg_N_grp[fs_idx]; + + local_prev_bfi = prev_bfi; + if (local_prev_bfi == 2) { + local_prev_bfi = 0; + } + + + /* Copy old to oold grp shape */ + for (i = 0; i < MAX_LGW; i++) + { + stPhECU_oold_grp_shape[i] = stPhECU_old_grp_shape[i]; + } + + /* Accumulate DC-coupled bins to total */ + E_tot = 0; + pX = q_d; /* ptr setup */ + for (i = 0; i < mdct_grp_bins[0]; i++) + { + E_tot += sqrf( *pX ); + pX++; + } + + /* Accumulate middle grps and add to total */ + for (i = 0; i < (N_grp - 1); i++) + { + l_grp = mdct_grp_bins[i + 1] - mdct_grp_bins[i]; ; + stPhECU_old_grp_shape[i] = 0.0; + for (j = 0; j < l_grp; j++) { + stPhECU_old_grp_shape[i] += sqrf( *pX ); + pX++; + } + E_tot += stPhECU_old_grp_shape[i]; + } + + /* Accumulate last subbband and add to total */ + stPhECU_old_grp_shape[(N_grp - 1)] = 0.0; + l_grp = mdct_grp_bins[N_grp] - mdct_grp_bins[N_grp - 1] - mdct_grp_bins[0]; + assert( (mdct_grp_bins[N_grp] - mdct_grp_bins[0]) <= yLen); + for (j = 0; j < l_grp; j++) + { + stPhECU_old_grp_shape[(N_grp - 1)] += sqrf( *pX ); + pX++; + } + E_tot += stPhECU_old_grp_shape[(N_grp - 1)]; + + + /* Normalize shape */ + for (i = 0; i < (N_grp); i++) { + if (E_tot > 0.0) { + stPhECU_old_grp_shape[i] /= E_tot; + } + else + { + stPhECU_old_grp_shape[i] = 0.0; + } + } + if (local_prev_bfi == 1) { + for (i = 0; i < MAX_LGW; i++) { + stPhECU_oold_grp_shape[i] = stPhECU_old_grp_shape[i]; + } + } + }/*bfi*/ + return; +} + +void processPlcUpdateSpec_fl(LC3_FLOAT *q_d_prev, LC3_FLOAT *q_d_fl_c, LC3_INT32 yLen) +{ + move_float(q_d_prev, q_d_fl_c, yLen); +} + diff --git a/lc3plus/quantize_spec.c b/lc3plus/quantize_spec.c new file mode 100755 index 0000000000..7886b4586d --- /dev/null +++ b/lc3plus/quantize_spec.c @@ -0,0 +1,196 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static LC3_INT sign(LC3_FLOAT x); + +LC3_INT sign(LC3_FLOAT x) +{ + if (x > 0) + return 1; + + if (x < 0) + return -1; + + return 0; +} + +void processQuantizeSpec_fl(LC3_FLOAT x[], LC3_FLOAT gain, LC3_INT xq[], LC3_INT nt, LC3_INT totalBits, LC3_INT* nbits, LC3_INT* nbits2, LC3_INT fs, + LC3_INT* lastnzout, LC3_INT* codingdata, LC3_INT* lsbMode, LC3_INT mode, LC3_INT target, LC3_INT hrmode) +{ + + LC3_INT rateFlag = 0, i = 0, lastnz2 = 0, m = 0, maxlev = 0, k = 0; + LC3_INT nbits_lsb = 0; + LC3_INT c = 0; + LC3_INT a = 0, b = 0, lev1 = 0, sym = 0, t = 0, pki = 0; + LC3_INT a1_msb = 0, b1_msb = 0; + LC3_INT lastnz = 1; + LC3_FLOAT offset = 0.375; + + if (hrmode) + { + offset = 0.5; + } + + + /* Quantization */ + for (i = 0; i < nt; i++) { + xq[i] = trunc(x[i] / gain + offset * sign(x[i])); + if (hrmode == 0) { + assert(xq[i] <= 32767 && xq[i] >= -32768); + } + } + + /* Rate flag */ + + if ((fs < 48000 && totalBits > 320 + (fs / 8000 - 2) * 160) || (fs == 48000 && totalBits > 800)) { + rateFlag = 512; + } + + /* Init */ + if (mode == 0 && ((fs < 48000 && totalBits >= 640 + (fs / 8000 - 2) * 160) || (fs == 48000 && totalBits >= 1120))) { + mode = 1; + } + + /* Last non-zero 2-tuple */ + + for (i = nt - 2; i >= 2; i = i - 2) { + if (xq[i + 1] != 0 || xq[i] != 0) { + lastnz = i + 1; + break; + } + } + + + if (mode < 0) { + lastnz2 = lastnz + 1; + } else { + lastnz2 = 2; + } + + *nbits = 0; + *nbits2 = 0; + + /* Calculate number of estimated bits */ + + for (k = 0; k < lastnz; k = k + 2) { + t = c + rateFlag; + if (k > nt / 2) { + t += 256; + } + + codingdata[0] = t; + + a = abs(xq[k]); + b = abs(xq[k + 1]); + m = MAX(a, b); + + if (m == 0) { + maxlev = -1; + } else { + maxlev = 29 - (clz_func(MAX(m, 3)) - 1); + } + + codingdata[1] = maxlev; + + if (mode <= 0) { + *nbits = *nbits + MIN(a, 1) * 2048; + *nbits = *nbits + MIN(b, 1) * 2048; + } + + lev1 = 0; + + while (MAX(a, b) >= 4) { + pki = ari_spec_lookup_fl[t + lev1 * 1024]; + *nbits = *nbits + ari_spec_bits_fl[pki][16]; + + if (lev1 == 0 && mode > 0) { + nbits_lsb += 2; + } else { + *nbits = *nbits + 2 * 2048; + } + + a = a >> 1; + b = b >> 1; + lev1 = MIN(lev1 + 1, 3); + } + + pki = ari_spec_lookup_fl[t + lev1 * 1024]; + sym = a + 4 * b; + codingdata[2] = sym; + codingdata += 3; + *nbits = *nbits + ari_spec_bits_fl[pki][sym]; + + if (mode > 0) { + a1_msb = abs(xq[k]); + b1_msb = abs(xq[k + 1]); + + if (lev1 > 0) { + a1_msb = a1_msb >> 1; + b1_msb = b1_msb >> 1; + + if (a1_msb == 0 && xq[k] != 0) { + nbits_lsb++; + } + + if (b1_msb == 0 && xq[k + 1] != 0) { + nbits_lsb++; + } + } + + *nbits = *nbits + MIN(a1_msb, 1) * 2048; + *nbits = *nbits + MIN(b1_msb, 1) * 2048; + } + + if (mode >= 0 && (abs(xq[k]) != 0 || abs(xq[k + 1]) != 0) && *nbits <= target * 2048) { + lastnz2 = k + 2; + *nbits2 = *nbits; + } + + lev1 = lev1 - 1; + if (lev1 <= 0) { + t = 1 + (a + b) * (lev1 + 2); + } else { + t = 13 + lev1; + } + + c = (c & 15) * 16 + t; + } + + /* Number of bits */ + *nbits = ceil((LC3_FLOAT)*nbits / 2048.0); + + if (mode >= 0) { + *nbits2 = ceil((LC3_FLOAT)*nbits2 / 2048.0); + } else { + *nbits2 = *nbits; + } + + if (mode > 0) { + *nbits += nbits_lsb; + *nbits2 += nbits_lsb; + } + + /* Truncation of high-frequency coefficients */ + for (i = lastnz2; i <= lastnz; i++) { + xq[i] = 0; + } + + /* Truncation of LSBs */ + if (mode > 0 && *nbits > target) { + *lsbMode = 1; + } else { + *lsbMode = 0; + } + + *lastnzout = lastnz2; +} diff --git a/lc3plus/reorder_bitstream.c b/lc3plus/reorder_bitstream.c new file mode 100755 index 0000000000..77b50d7a13 --- /dev/null +++ b/lc3plus/reorder_bitstream.c @@ -0,0 +1,41 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + + +void processReorderBitstream_fl(LC3_UINT8* bytes, LC3_INT32 n_pccw, LC3_INT32 n_pc, LC3_INT32 b_left, LC3_INT32 len) +{ + LC3_UINT8 bytes_local[MAX_NBYTES2]; + LC3_INT32 i, block_bytes; + + assert(b_left > 0); + + memcpy(bytes_local, bytes, len * sizeof(LC3_UINT8)); + + if (n_pccw == 0) + { + return; + } + + block_bytes = ceil((LC3_FLOAT) n_pc / 2.0); + + for (i = 0; i < block_bytes; i++) + { + bytes[i] = bytes_local[b_left + i]; + } + + for (i = 0; i < b_left; i++) + { + bytes[block_bytes + i] = bytes_local[i]; + } +} + diff --git a/lc3plus/resamp12k8.c b/lc3plus/resamp12k8.c new file mode 100755 index 0000000000..0cab5daae9 --- /dev/null +++ b/lc3plus/resamp12k8.c @@ -0,0 +1,107 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], + LC3_INT mem_out_len, LC3_FLOAT y[], LC3_INT* y_len, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT fs) +{ + + + LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0; + LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0}; + LC3_INT32 index_int, index_frac, resamp_upfac, resamp_delay, resamp_off_int, resamp_off_frac; + LC3_FLOAT u_11, u_21, u_1, u_2; + + const LC3_FLOAT *filter; + const LC3_FLOAT *filt_input, *filt_coeff; + + + switch (frame_dms) + { + case 25: + len_12k8 = LEN_12K8 / 4; + break; + case 50: + len_12k8 = LEN_12K8 / 2; + break; + case 100: + len_12k8 = LEN_12K8; + break; + } + + *y_len = len_12k8; + N12k8 = x_len * 12800 / fs; + + /* Init Input Buffer */ + memmove(buf, mem_in, mem_in_len * sizeof(LC3_FLOAT)); + memmove(&buf[mem_in_len], x, x_len * sizeof(LC3_FLOAT)); + memmove(mem_in, &buf[x_len], mem_in_len * sizeof(LC3_FLOAT)); + + + + filter = lp_filter[fs_idx]; + + /* Upsampling & Low-pass Filtering & Downsampling */ + + index_int = 1; + index_frac = 0; + resamp_upfac = resamp_params[fs_idx][0]; + resamp_delay = resamp_params[fs_idx][1]; + resamp_off_int = resamp_params[fs_idx][2]; + resamp_off_frac = resamp_params[fs_idx][3]; + + k = 0; + for (i = 0; i < N12k8; i++) { + + filt_input = &buf[index_int]; + filt_coeff = &filter[index_frac * resamp_delay * 2]; + + mac = mac_loop(filt_input, filt_coeff, (2 * resamp_delay)); + + bufdown[k++] = mac; + + index_int = index_int + resamp_off_int; + index_frac = index_frac + resamp_off_frac; + + if ((resamp_upfac - index_frac) <= 0) + { + index_int = index_int + 1; + index_frac = index_frac - resamp_upfac; + } + } + + + /* 50Hz High-Pass */ + u_11 = mem_50[0]; + u_21 = mem_50[1]; + + for (i = 0; i < len_12k8; i++) { + LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); + u_1 = (highpass50_filt_b[1] * bufdown[i] + u_21) - highpass50_filt_a[1] * y1; + u_2 = highpass50_filt_b[2] * bufdown[i] - highpass50_filt_a[2] * y1; + u_11 = u_1; + u_21 = u_2; + bufdown[i] = (LC3_FLOAT)y1; + } + + mem_50[0] = (LC3_FLOAT)u_11; + mem_50[1] = (LC3_FLOAT)u_21; + + /* Output Buffer */ + memmove(buf_out, mem_out, mem_out_len * sizeof(LC3_FLOAT)); + + memmove(&buf_out[mem_out_len], bufdown, len_12k8 * sizeof(LC3_FLOAT)); + + memmove(y, buf_out, (*y_len + 1) * sizeof(LC3_FLOAT)); + + memmove(mem_out, &buf_out[N12k8], mem_out_len * sizeof(LC3_FLOAT)); +} diff --git a/lc3plus/residual_coding.c b/lc3plus/residual_coding.c new file mode 100755 index 0000000000..42094d275f --- /dev/null +++ b/lc3plus/residual_coding.c @@ -0,0 +1,76 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits + , LC3_INT hrmode +) +{ + LC3_INT n = 0, m = 0, k = 0; + LC3_INT iter=0; + LC3_FLOAT offset; + LC3_INT iter_max = 1; + LC3_INT nz_idx[MAX_LEN] = {0}; + LC3_INT N_nz = 0, idx = 0; + + + memset(resBits, 0, MAX_RESBITS_LEN); + + m = targetBits - nBits + 4; + if (hrmode) + { + m += 10; + } + + assert(m <= MAX_RESBITS); + + offset = .25; + if (hrmode) + { + iter_max = EXT_RES_ITER_MAX; + + } + for (k = 0; k < L_spec; k ++) + { + if (xq[k]) + { + nz_idx[N_nz ++] = k; + } + } + while (iter < iter_max && n < m) + { + k = 0; + while (k < N_nz && n < m) + { + idx = nz_idx[k]; + + if (x[idx] >= (LC3_FLOAT)xq[idx] * gain) + { + resBits[n >> 3] |= 1 << (n & 7); + x[idx] -= gain * offset; + } + else + { + resBits[n >> 3] &= ~(1 << (n & 7)); + x[idx] += gain * offset; + } + + n++; + + k++; + } + iter ++; + offset *= .5; + } + + *numResBits = n; +} diff --git a/lc3plus/residual_decoding.c b/lc3plus/residual_decoding.c new file mode 100755 index 0000000000..97fd94afc3 --- /dev/null +++ b/lc3plus/residual_decoding.c @@ -0,0 +1,97 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits + , LC3_INT hrmode +) +{ + LC3_INT k = 0, n = 0; + LC3_FLOAT offset1 = 0, offset2 = 0; + LC3_FLOAT offset = 0; + LC3_INT nz_idx[MAX_LEN] = {0}; + LC3_INT N_nz = 0, idx = 0; + + LC3_INT iter = 0, iter_max = 1; + + if (hrmode) + { + iter_max = EXT_RES_ITER_MAX; + offset = offset1 = offset2 = 0.25; + } + else + { + offset1 = 0.1875; + offset2 = 0.3125; + } + + if (hrmode) + { + /* enumerat non-zero coefficients */ + for (k = 0; k < L_spec; k ++) + { + if (x[k]) + { + nz_idx[N_nz ++] = k; + } + } + /* apply residual corrections */ + while (n < resQBits && iter < iter_max) + { + for (k = 0; k < N_nz; k ++) + { + idx = nz_idx[k]; + + if ((prm[n >> 3] & 1 << (n & 7)) == 0) + { + x[idx] -= offset; + } + else + { + + x[idx] += offset; + } + if (++n >= resQBits) + { + break; + } + } + offset /= 2; + iter ++; + } + } + else + { + while (k < L_spec && n < resQBits) { + if (x[k] != 0) { + if ((prm[n >> 3] & 1 << (n & 7)) == 0) + { + if (x[k] > 0) { + x[k] -= offset1; + } else { + x[k] -= offset2; + } + } else { + if (x[k] > 0) { + x[k] += offset2; + } else { + x[k] += offset1; + } + } + n++; + } + + k++; + } + } + *bitsRead = n; +} diff --git a/lc3plus/setup_com_lc3.c b/lc3plus/setup_com_lc3.c new file mode 100755 index 0000000000..17054d1ffc --- /dev/null +++ b/lc3plus/setup_com_lc3.c @@ -0,0 +1,30 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + +#include "functions.h" +#include "options.h" + +LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) +{ + LC3_FLOAT max; + LC3_INT32 i; + + max = LC3_FABS(in[0]); + + for (i = 0; i < len; i++) + { + if (LC3_FABS(in[i]) > LC3_FABS(max)) + { + max = LC3_FABS(in[i]); + } + } + + return max; +} + diff --git a/lc3plus/setup_dec_lc3.c b/lc3plus/setup_dec_lc3.c new file mode 100755 index 0000000000..c14309720e --- /dev/null +++ b/lc3plus/setup_dec_lc3.c @@ -0,0 +1,444 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "setup_dec_lc3.h" +#include "functions.h" +#include +#include + +/* if decoder is null only size is reported */ +# include "fft/iis_fft.h" + +int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels) +{ + int ch = 0; + size_t size = sizeof(LC3PLUS_Dec); + size_t frame_len = DYN_MAX_LEN_EXT(samplerate); + + void *PlcAdvSetup = NULL; + LC3_FLOAT *pcmbufHist, *harmonicBuf; + LC3_FLOAT *PhECU_oold_grp_shape, *PhECU_old_grp_shape; + LC3_FLOAT *PhECU_xfp; + Complex *PhECU_X_sav_m; + LC3_INT32 *PhECU_plocs; + LC3_FLOAT *PhECU_f0est, *PhECU_mag_chg_1st, *PhECU_Xavg; + LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu; + HANDLE_IIS_FFT handle_fft_phaseecu; + HANDLE_IIS_FFT handle_ifft_phaseecu; + LC3_FLOAT *q_old_res; + + for (ch = 0; ch < channels; ch++) { + DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); + + size_t max_pitch = ceilf(228.0 * CODEC_FS(samplerate) / 12800.0); + size_t pcm_plc_len = max_pitch + frame_len; + pcmbufHist = balloc(decoder, &size, sizeof(LC3_FLOAT) * pcm_plc_len); + harmonicBuf = balloc(decoder, &size, sizeof(LC3_FLOAT) * max_pitch); + PlcAdvSetup = balloc(decoder, &size, sizeof(*setup->PlcAdvSetup)); + PhECU_oold_grp_shape = balloc(decoder, &size, sizeof(LC3_FLOAT) *MAX_LGW); /* BASOP Word16 PhECU_oold_grp_shape_fx[MAX_LGW]; */ + PhECU_old_grp_shape = balloc(decoder, &size, sizeof(LC3_FLOAT) *MAX_LGW); /* BASOP Word16 PhECU_old_grp_shape_fx[MAX_LGW] ; */ + PhECU_xfp = balloc(decoder, &size, sizeof(LC3_FLOAT) *(frame_len * 16 / 10)); + PhECU_X_sav_m = balloc(decoder, &size, sizeof(Complex) *(((frame_len * 16 / 10) / 2) + 1));/*MAX_PLC_LMSPEC*/ + PhECU_plocs = balloc(decoder, &size, sizeof(LC3_INT32) * (((frame_len * 16 / 10) / 4) + 1 + 1)); /* BASOP Word16 *PhECU_plocs; */ + + handle_fft_phaseecu = balloc(decoder, &size, sizeof(IIS_FFT) * 1); + handle_ifft_phaseecu = balloc(decoder, &size, sizeof(IIS_FFT) * 1); + PhECU_f0est = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((frame_len * 16 / 10) / 4) + 1)); /*BASOP Word32 *PhECU_f0est;*/ + PhECU_mag_chg_1st = balloc(decoder, &size, sizeof(LC3_FLOAT) *MAX_LGW); /* BASOP Word16 PhECU_mag_chg_1st[MAX_LGW];*/ + PhECU_Xavg = balloc(decoder, &size, sizeof(LC3_FLOAT) * MAX_LGW); /* BASOP Word16 PhECU_Xavg[MAX_LGW] ; */ + + sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); + sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); + + q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); + + if (decoder) { + decoder->channel_setup[ch] = setup; + + setup->PlcAdvSetup = PlcAdvSetup; + + setup->PlcAdvSetup->pcmbufHist = pcmbufHist; + setup->PlcAdvSetup->PlcTdcSetup.harmonicBuf = harmonicBuf; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape = PhECU_oold_grp_shape; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape = PhECU_old_grp_shape; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp = PhECU_xfp; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_X_sav_m = PhECU_X_sav_m; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_plocs = PhECU_plocs; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_f0est = PhECU_f0est; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_mag_chg_1st = PhECU_mag_chg_1st; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Xavg = PhECU_Xavg; + setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu = handle_fft_phaseecu; + setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu = handle_ifft_phaseecu; + + setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu->sine_table = sine_table1_phecu; + setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu->sine_table = sine_table2_phecu; + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot = (CODEC_FS(samplerate) * 16) / 1000; + real_fft_init(&(setup->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft), setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot, &(setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu)); + real_ifft_init(&(setup->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft), setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot, &(setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu)); + setup->statePC.q_old_res = q_old_res; + } + } + + return (int)size; +} + +LC3PLUS_Error FillDecSetup(LC3PLUS_Dec* decoder, int samplerate, int channels, LC3PLUS_PlcMode plc_mode + , int hrmode +) +{ + memset(decoder, 0, lc3plus_dec_get_size(samplerate, channels)); + alloc_decoder(decoder, samplerate, channels); + + decoder->fs = CODEC_FS(samplerate); + decoder->fs_out = samplerate; + decoder->fs_idx = FS2FS_IDX(decoder->fs); + decoder->plcMeth = plc_mode; + + decoder->hrmode = hrmode != 0; + + if (decoder->fs_idx > 4) { + decoder->fs_idx = 5; + } + decoder->channels = channels; + decoder->frame_ms = 10; + decoder->frame_dms = 100; + decoder->BW_cutoff_bits = BW_cutoff_bits_all[decoder->fs_idx]; + + if (decoder->fs == 8000) { + decoder->tilt = 14; + } else if (decoder->fs == 16000) { + decoder->tilt = 18; + } else if (decoder->fs == 24000) { + decoder->tilt = 22; + } else if (decoder->fs == 32000) { + decoder->tilt = 26; + } else if (decoder->fs == 48000) { + decoder->tilt = 30; + } + else if (decoder->fs == 96000) { + decoder->tilt = 34; + } + + set_dec_frame_params(decoder); + + lc3plus_dec_set_ep_enabled(decoder, 0); + + return LC3PLUS_OK; +} + +/* set frame config params */ +void set_dec_frame_params(LC3PLUS_Dec* decoder) +{ + int ch = 0; + + if (decoder->fs_idx == 5) + { + decoder->hrmode = 1; + } + + decoder->frame_length = ceil(decoder->fs * 10 / 1000); /* fs * 0.01*2^6 */ + if (decoder->hrmode == 1) + { + decoder->yLen = decoder->frame_length; + } + else + { + decoder->yLen = MIN(MAX_BW, decoder->frame_length); + } + + decoder->bands_number = 64; + if (decoder->frame_ms == 2.5) + { + decoder->frame_length = decoder->frame_length >> 2; + decoder->yLen /= 4; + if (decoder->hrmode) + { + decoder->bands_number = bands_number_2_5ms_HR[decoder->fs_idx]; + } + else + { + decoder->bands_number = bands_number_2_5ms[decoder->fs_idx]; + } + } + if (decoder->frame_ms == 5) + { + decoder->frame_length = decoder->frame_length >> 1; + decoder->yLen /= 2; + decoder->bands_number = bands_number_5ms[decoder->fs_idx]; + } + + if (decoder->hrmode) + { + decoder->BW_cutoff_bits = 0; + } + else + { + decoder->BW_cutoff_bits = BW_cutoff_bits_all[decoder->fs_idx]; + } + + if (decoder->frame_ms == 10) + { + if (decoder->hrmode) + { + decoder->bands_offset = ACC_COEFF_PER_BAND_HR[decoder->fs_idx]; + } + else + { + decoder->bands_offset = ACC_COEFF_PER_BAND[decoder->fs_idx]; + } + decoder->cutoffBins = BW_cutoff_bin_all; + } + else if (decoder->frame_ms == 2.5) + { + if (decoder->hrmode) + { + decoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms_HR[decoder->fs_idx]; + } + else + { + decoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms[decoder->fs_idx]; + } + decoder->cutoffBins = BW_cutoff_bin_all_2_5ms; + } + else if (decoder->frame_ms == 5) + { + if (decoder->hrmode) + { + decoder->bands_offset = ACC_COEFF_PER_BAND_5ms_HR[decoder->fs_idx]; + } + else + { + decoder->bands_offset = ACC_COEFF_PER_BAND_5ms[decoder->fs_idx]; + } + decoder->cutoffBins = BW_cutoff_bin_all_5ms; + } + + decoder->n_bandsPLC = MIN(decoder->frame_length, 80); + + if (decoder->frame_ms == 10) + { + decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC[decoder->fs_idx]; + } + else if (decoder->frame_ms == 5) + { + decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC_5ms[decoder->fs_idx]; + + if (decoder->fs == 24000) + { + decoder->n_bandsPLC = 40; + } + } + else if (decoder->frame_ms == 2.5) + { + decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC_2_5ms[decoder->fs_idx]; + + if (decoder->fs == 48000) + { + decoder->n_bandsPLC = 60; + } + } + assert(decoder->bands_offsetPLC); + + if (decoder->frame_ms == 10) { + decoder->imdct_win = MDCT_WINS_10ms[decoder->hrmode][decoder->fs_idx]; + decoder->imdct_laZeros = MDCT_la_zeroes[decoder->fs_idx]; + decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_10ms[decoder->fs_idx]; + } + else if (decoder->frame_ms == 2.5) { + decoder->imdct_win = MDCT_WINS_2_5ms[decoder->hrmode][decoder->fs_idx]; + decoder->imdct_laZeros = MDCT_la_zeroes_2_5ms[decoder->fs_idx]; + decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_2_5ms[decoder->fs_idx]; + } + else if (decoder->frame_ms == 5) { + decoder->imdct_win = MDCT_WINS_5ms[decoder->hrmode][decoder->fs_idx]; + decoder->imdct_laZeros = MDCT_la_zeroes_5ms[decoder->fs_idx]; + decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_5ms[decoder->fs_idx]; + } + + decoder->la_zeroes = decoder->imdct_laZeros; + + decoder->imdct_memLen = decoder->frame_length - decoder->imdct_laZeros; + + for (ch = 0; ch < decoder->channels; ch++) { + DecSetup* setup = decoder->channel_setup[ch]; + + setup->ltpf_mem_beta_idx = -1; + + setup->statePC.seed = 24607; + + if (decoder) { + /* Init DCT4 structs */ + if (setup->dct4structImdct.length != 0) { + dct4_free(&setup->dct4structImdct); + dct4_init(&setup->dct4structImdct, decoder->frame_length); + } else { + dct4_init(&setup->dct4structImdct, decoder->frame_length); + } + + setup->PlcNsSetup.cum_alpha = 1; + setup->PlcNsSetup.seed = 24607; + setup->alpha = 1; + if (setup->PlcAdvSetup) + { + LC3_INT32 pitch_max = 0, pitch_ana_len = 0, tdc_synt_len = 0; + pitch_max = ceil(228.0 * (LC3_FLOAT) decoder->fs / 12800.0); + pitch_ana_len = pitch_max + decoder->frame_length * (LC3_FLOAT) 100 / decoder->frame_dms; + tdc_synt_len = 16 + 1 + pitch_max + ceil(decoder->frame_length / 2); + setup->PlcAdvSetup->max_len_pcm_plc = MAX(pitch_ana_len, tdc_synt_len); + setup->PlcAdvSetup->PlcTdcSetup.preemphFac = plc_preemph_fac[decoder->fs_idx]; + setup->PlcAdvSetup->PlcTdcSetup.seed = 24607; + setup->PlcAdvSetup->PlcTdcSetup.lpcorder = 16; + + if (decoder->fs_idx == 0 && decoder->frame_dms == 25) + { + setup->PlcAdvSetup->PlcTdcSetup.lpcorder = 8; + } + + setup->PlcAdvSetup->stabFac = 1; + setup->PlcAdvSetup->cum_fading_fast = 1; + setup->PlcAdvSetup->cum_fading_slow = 1; + setup->PlcAdvSetup->cum_fflcAtten = 1; + + if (decoder->fs_idx <= 4 && decoder->frame_dms == 100) + { + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot = (decoder->fs * 16) / 1000; /* 16 ms of samples at fs*/ + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_f0hzLtpBin = 0; + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_norm_corr = 0; + + set_vec(PHECU_GRP_SHAPE_INIT, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_oold_grp_shape, MAX_LGW); + set_vec(PHECU_GRP_SHAPE_INIT, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_old_grp_shape, MAX_LGW); + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_L_oold_xfp_w_E = (LC3_FLOAT)PHECU_LTOT_MIN_MAN * LC3_POW(2.0, PHECU_LTOT_MIN_EXP - 31); + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_L_old_xfp_w_E = (LC3_FLOAT)PHECU_LTOT_MIN_MAN * LC3_POW(2.0, PHECU_LTOT_MIN_EXP - 31); + + /* CFL uses separate buffers for pcmHist, xfp and Xsav and q_d , BASOP uses an optimized joint buffer*/ + zero_float(setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_xfp, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot); + zero_cmplx(setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_X_sav_m, (setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot/2 + 1)); + + set_vec(POS_ONE_Q15, setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_mag_chg_1st, MAX_LGW); + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_beta_mute = (16384.0/32768.0); + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_seed = 21845; + + assert(decoder->frame_dms == 100); + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_LDWIN_OLAP = (decoder->frame_length / 4 ); /* 2.5 ms for regular 10 ms MDCT */ + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_t_adv = ( + decoder->frame_length + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot + + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_LDWIN_OLAP )/ 2; + } + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev = 0; /* fullband transient */ + setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_num_plocs = 0; + } + } + } +} + +LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) +{ + int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0; + DecSetup* setup; + + if (decoder->hrmode) + { + switch (decoder->frame_dms) + { + case 25: + maxBytes = 210; + minBytes = MIN_NBYTES; + break; + case 50: + maxBytes = 375; + minBytes = MIN_NBYTES; + break; + case 100: + maxBytes = 625; + minBytes = MIN_NBYTES; + break; + default: + return LC3PLUS_HRMODE_ERROR; + } + } + else + { + minBytes = MIN_NBYTES; + maxBytes = MAX_NBYTES_100; // for backward compatibility, MAX_NBYTES_100 is used for all frame lengths + } + + channel_bytes = nBytes; + + setup = decoder->channel_setup[ch]; + + if (channel_bytes < minBytes || channel_bytes > maxBytes) + { + return LC3PLUS_NUMBYTES_ERROR; + } + + setup->targetBytes = channel_bytes; + setup->total_bits = setup->targetBytes << 3; + setup->enable_lpc_weighting = (setup->total_bits < 480); + setup->quantizedGainOff = + -(MIN(115, setup->total_bits / (10 * (decoder->fs_idx + 1))) + 105 + 5 * (decoder->fs_idx + 1)); + + if (decoder->hrmode && decoder->fs_idx == 5) + { + setup->quantizedGainOff = MAX(setup->quantizedGainOff, -181); + } + + totalBits = setup->total_bits; + + if (decoder->frame_ms == 2.5) { + setup->enable_lpc_weighting = setup->total_bits < 120; + totalBits = setup->total_bits * 4.0 * (1.0 - 0.4); + } + if (decoder->frame_ms == 5) { + setup->enable_lpc_weighting = (setup->total_bits < 240); + totalBits = setup->total_bits * 2 - 160; + } + + if (decoder->frame_length > 40 * ((LC3_FLOAT) (decoder->frame_dms) / 10.0)) { + setup->N_red_tns = 40 * ((LC3_FLOAT) (decoder->frame_dms) / 10.0); + setup->fs_red_tns = 40000; + } else { + setup->N_red_tns = decoder->frame_length; + setup->fs_red_tns = decoder->fs; + } + + bitsTmp = totalBits; + + if (bitsTmp < 400 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.4; + setup->ltpf_conf_beta_idx = 0; + } else if (bitsTmp < 480 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.35; + setup->ltpf_conf_beta_idx = 1; + } else if (bitsTmp < 560 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.3; + setup->ltpf_conf_beta_idx = 2; + } else if (bitsTmp < 640 + (decoder->fs_idx - 1) * 80) { + setup->ltpf_conf_beta = 0.25; + setup->ltpf_conf_beta_idx = 3; + } else { + setup->ltpf_conf_beta = 0; + setup->ltpf_conf_beta_idx = -1; + } + + /* No LTPF in hrmode */ + if (decoder->hrmode == 1) { + setup->ltpf_conf_beta = 0; + setup->ltpf_conf_beta_idx = -1; + } + + return LC3PLUS_OK; +} diff --git a/lc3plus/setup_dec_lc3.h b/lc3plus/setup_dec_lc3.h new file mode 100755 index 0000000000..6ed0f438ea --- /dev/null +++ b/lc3plus/setup_dec_lc3.h @@ -0,0 +1,112 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef SETUP_DEC_LC3_FL_H +#define SETUP_DEC_LC3_FL_H + +#include "constants.h" + +/* Channel state and bitrate-derived values go in this struct */ +typedef struct { + LC3_INT* stDec_ola_mem_fx; /* MDCT_MEM_LEN_MAX */ + LC3_INT total_bits; + LC3_INT enable_lpc_weighting; + LC3_INT targetBytes; + LC3_INT quantizedGainOff; + LC3_INT ltpf_param[3]; + LC3_INT ltpf_param_mem[3]; + LC3_INT ltpf_mem_pitch; + LC3_INT ltpf_mem_active; + LC3_INT ltpf_mem_pitch_fr; + LC3_INT ltpf_mem_beta_idx; + LC3_INT ltpf_conf_beta_idx; + LC3_INT spec_inv_idx; + LC3_INT concealMethod; + LC3_INT last_size; + LC3_INT BW_cutoff_idx_nf; + LC3_INT prev_BW_cutoff_idx_nf; + LC3_INT fs_red_tns; + LC3_INT N_red_tns; + LC3_INT scf_idx[SCF_MAX_PARAM]; + uint8_t resBits[MAX_RESBITS_LEN]; + LC3_INT tns_idx[TNS_NUMFILTERS_MAX * MAXLAG]; + + LC3_FLOAT prev_fac_ns; + LC3_FLOAT ltpf_mem_x[3 * MAX_LEN]; + LC3_FLOAT ltpf_mem_y[3 * MAX_LEN]; + LC3_FLOAT ltpf_mem_gain; + LC3_FLOAT ltpf_conf_beta; + LC3_FLOAT sqQdec_fl[MAX_LEN]; + LC3_FLOAT scf_q[M]; + LC3_FLOAT int_scf[MAX_BANDS_NUMBER]; + LC3_FLOAT x_fl[MAX_LEN]; + LC3_FLOAT imdct_mem[MAX_LEN]; + LC3_FLOAT alpha; + + Dct4 dct4structImdct; + + PlcSetup PlcSetup; + PlcNsSetup PlcNsSetup; + + pcState statePC; + PlcAdvSetup* PlcAdvSetup; +} DecSetup; + +/* Constants and sampling rate derived values go in this struct */ +struct LC3PLUS_Dec { + DecSetup* channel_setup[MAX_CHANNELS]; + const LC3_INT* W_fx; + const LC3_INT* bands_offset; + const LC3_INT* cutoffBins; + + LC3_INT fs; /* sampling rate, 44.1 maps to 48 */ + LC3_INT fs_out; /* output sampling rate */ + LC3_INT fs_idx; /* sampling rate index */ + LC3_INT frame_length; /* sampling rate index */ + LC3_INT channels; /* number of channels */ + LC3_FLOAT frame_ms; /* frame length in ms (wrong for 44.1) */ + LC3_INT frame_dms; /* frame length in ms * 10 (wrong for 44.1) */ + LC3_INT last_size; /* size of last frame, without error protection */ + LC3_INT ep_enabled; /* error protection enabled */ + LC3_INT error_report; /* corrected errors in last frame or -1 on error */ + + LC3_INT imdct_memLen; + LC3_INT imdct_winLen; + LC3_INT imdct_laZeros; + const LC3_FLOAT* imdct_win; + + LC3_INT yLen; + LC3_INT W_size; + LC3_INT la_zeroes; + LC3_INT bands_number; + LC3_INT ltpf_mem_x_len; + LC3_INT ltpf_mem_y_len; + LC3_INT BW_cutoff_bits; + LC3_INT tilt; + + LC3_INT hrmode; + LC3_INT specflip; + + const LC3_INT* bands_offsetPLC; + LC3_INT n_bandsPLC; + + LC3_INT32 rframe; + int plcMeth; /* PLC method for all channels */ + LC3_INT16 n_pccw; + LC3_INT16 be_bp_left; + LC3_INT16 be_bp_right; + LC3_INT16 n_pc; + LC3_INT16 m_fec; + int epmr; + LC3_INT16 combined_channel_coding; + int last_error; +}; + +#endif diff --git a/lc3plus/setup_enc_lc3.c b/lc3plus/setup_enc_lc3.c new file mode 100755 index 0000000000..986b43d608 --- /dev/null +++ b/lc3plus/setup_enc_lc3.c @@ -0,0 +1,546 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "setup_enc_lc3.h" +#include "functions.h" +#include + +/* if encoder is null only size is reported */ +int alloc_encoder(LC3PLUS_Enc* encoder, int channels) +{ + int ch = 0; + size_t size = sizeof(LC3PLUS_Enc); + + for (ch = 0; ch < channels; ch++) { + EncSetup* setup = balloc(encoder, &size, sizeof(EncSetup)); + if (encoder) { + encoder->channel_setup[ch] = setup; + } + } + + return (int)size; +} + +LC3PLUS_Error FillEncSetup(LC3PLUS_Enc* encoder, int samplerate, int channels + , int hrmode + , int32_t lfe_channel_array[] +) +{ + int ch = 0; + memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels)); + alloc_encoder(encoder, channels); + + encoder->fs = CODEC_FS(samplerate); + encoder->fs_in = samplerate; + encoder->fs_idx = FS2FS_IDX(encoder->fs); + encoder->frame_dms = 100; + if (encoder->fs_idx > 4) { + encoder->fs_idx = 5; + } + + encoder->hrmode = hrmode != 0; + + encoder->channels = channels; + encoder->frame_ms = 10; + encoder->envelope_bits = 38; + encoder->global_gain_bits = 8; + encoder->noise_fac_bits = 3; + encoder->BW_cutoff_bits = BW_cutoff_bits_all[encoder->fs_idx]; + + encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; + encoder->r12k8_mem_out_len = 24; + + for (ch = 0; ch < encoder->channels; ch++) + { + encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; + } + + encoder->bw_ctrl_active = 0; + encoder->bandwidth = encoder->fs / 2; + encoder->bandwidth_preset = encoder->fs / 2; + + + if (encoder->fs == 8000) { + encoder->tilt = 14; + } else if (encoder->fs == 16000) { + encoder->tilt = 18; + } else if (encoder->fs == 24000) { + encoder->tilt = 22; + } else if (encoder->fs == 32000) { + encoder->tilt = 26; + } else if (encoder->fs == 48000) { + encoder->tilt = 30; + } + else if (encoder->fs == 96000) { + encoder->tilt = 34; + } + + set_enc_frame_params(encoder); + return LC3PLUS_OK; +} + +/* set frame config params */ +void set_enc_frame_params(LC3PLUS_Enc* encoder) +{ + int ch = 0; + EncSetup* setup; + + encoder->frame_length = ceil(encoder->fs * 10 / 1000); /* fs * 0.01*2^6 */ + if (encoder->hrmode == 1) + { + encoder->yLen = encoder->frame_length; + } + else + { + encoder->yLen = MIN(MAX_BW, encoder->frame_length); + encoder->sns_damping = 0.85; + } + encoder->stEnc_mdct_mem_len = encoder->frame_length - encoder->la_zeroes; + encoder->bands_number = 64; + encoder->nSubdivisions = 3; + encoder->near_nyquist_index = encoder->bands_number - 2; + encoder->near_nyquist_flag = 0; + encoder->ltpf_mem_in_len = LTPF_MEMIN_LEN; + + if (encoder->fs_idx == 5) + { + encoder->hrmode = 1; + } + + if (encoder->hrmode) + { + encoder->BW_cutoff_bits = 0; + } + else + { + encoder->BW_cutoff_bits = BW_cutoff_bits_all[encoder->fs_idx]; + } + + if (encoder->frame_ms == 10) { + encoder->la_zeroes = MDCT_la_zeroes[encoder->fs_idx]; + if (encoder->hrmode) + { + encoder->bands_offset = ACC_COEFF_PER_BAND_HR[encoder->fs_idx]; + } + else + { + encoder->bands_offset = ACC_COEFF_PER_BAND[encoder->fs_idx]; + } + encoder->cutoffBins = BW_cutoff_bin_all; + + encoder->attdec_nblocks = 4; + encoder->attdec_damping = 0.5; + encoder->attdec_hangover_thresh = 2; + } + else if (encoder->frame_ms == 2.5) { + encoder->la_zeroes = MDCT_la_zeroes_2_5ms[encoder->fs_idx]; + if (encoder->hrmode) + { + encoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms_HR[encoder->fs_idx]; + } + else + { + encoder->bands_offset = ACC_COEFF_PER_BAND_2_5ms[encoder->fs_idx]; + } + encoder->cutoffBins = BW_cutoff_bin_all_2_5ms; + } + else if (encoder->frame_ms == 5) { + encoder->la_zeroes = MDCT_la_zeroes_5ms[encoder->fs_idx]; + if (encoder->hrmode) + { + encoder->bands_offset = ACC_COEFF_PER_BAND_5ms_HR[encoder->fs_idx]; + } + else + { + encoder->bands_offset = ACC_COEFF_PER_BAND_5ms[encoder->fs_idx]; + } + encoder->cutoffBins = BW_cutoff_bin_all_5ms; + } + + if (encoder->frame_ms == 2.5) { + encoder->frame_length = encoder->frame_length >> 2; + encoder->yLen /= 4; + encoder->stEnc_mdct_mem_len = encoder->frame_length - encoder->la_zeroes; + if (encoder->hrmode) + { + encoder->bands_number = bands_number_2_5ms_HR[encoder->fs_idx]; + } + else + { + encoder->bands_number = bands_number_2_5ms[encoder->fs_idx]; + } + + encoder->nSubdivisions = 2; + encoder->near_nyquist_index = encoder->bands_number - 2; + encoder->ltpf_mem_in_len = LTPF_MEMIN_LEN + (LEN_12K8 >> 2); + } + + + if (encoder->frame_ms == 5) { + encoder->frame_length = encoder->frame_length >> 1; + encoder->yLen /= 2; + encoder->stEnc_mdct_mem_len = encoder->frame_length - encoder->la_zeroes; + encoder->bands_number = bands_number_5ms[encoder->fs_idx]; + encoder->nSubdivisions = 2; + encoder->near_nyquist_index = encoder->bands_number - 3; + } + + for (ch = 0; ch < encoder->channels; ch++) { + setup = encoder->channel_setup[ch]; + + setup->olpa_mem_pitch = 17; + + if (setup->mdctStruct.mem != NULL) { + mdct_free(&setup->mdctStruct); + mdct_init(&setup->mdctStruct, encoder->frame_length, encoder->frame_dms, encoder->fs_idx, encoder->hrmode); + + dct2_free(&setup->dct2StructSNS); + dct2_init(&setup->dct2StructSNS, M); + } + else + { + mdct_init(&setup->mdctStruct, encoder->frame_length, encoder->frame_dms, encoder->fs_idx, encoder->hrmode); + dct2_init(&setup->dct2StructSNS, M); + } + } +} + +/* change encoder bitrate */ +LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) +{ + int ch = 0, bitsTmp = 0, minBR = 0, maxBR = 0, totalBytes = 0; + LC3_INT channel_bytes = 0, max_bytes = 0; + + if (encoder->hrmode) + { +#ifdef ENABLE_HR_MODE_FL + switch (encoder->frame_dms) + { + case 25: + maxBR = 672000; + if (encoder->fs == 48000) {minBR = MIN_BR_25MS_48KHZ_HR;} + else if (encoder->fs == 96000) {minBR = MIN_BR_25MS_96KHZ_HR;} + else { return LC3PLUS_HRMODE_ERROR;} + break; + case 50: + maxBR = 600000; + if (encoder->fs == 48000) {minBR = MIN_BR_50MS_48KHZ_HR;} + else if (encoder->fs == 96000) {minBR = MIN_BR_50MS_96KHZ_HR;} + else { return LC3PLUS_HRMODE_ERROR;} + break; + case 100: + maxBR = 500000; + if (encoder->fs == 48000) {minBR = MIN_BR_100MS_48KHZ_HR;} + else if (encoder->fs == 96000) {minBR = MIN_BR_100MS_96KHZ_HR;} + else { return LC3PLUS_HRMODE_ERROR;} + break; + default: + return LC3PLUS_HRMODE_ERROR; + } +#endif + } + else + { + minBR = (MIN_NBYTES << 3); + maxBR = MAX_BR; + + switch (encoder->frame_dms) + { + case 25: + minBR = MIN_BR_025DMS; + maxBR = MAX_BR; + break; + case 50: + minBR = MIN_BR_050DMS; + maxBR = MAX_BR; + /* have additional limitations for 5.0ms */ + switch (encoder->fs_in) + { + case 8000: maxBR = MAX_BR_050DMS_NB; break; + default: break; + } + break; + case 100: + /* have additional limitations for 10ms */ + minBR = MIN_BR_100DMS; + maxBR = MAX_BR; + switch (encoder->fs_in) + { + case 8000: maxBR = MAX_BR_100DMS_NB ; break; + case 16000: maxBR = MAX_BR_100DMS_WB ; break; + case 24000: maxBR = MAX_BR_100DMS_SSWB; break; + default: maxBR = MAX_BR; break; + } + break; + default: return LC3PLUS_FRAMEMS_ERROR; + } + maxBR *= (encoder->fs_in == 44100 ? 441. / 480 : 1); + } + minBR *= encoder->channels; + maxBR *= encoder->channels; + + encoder->combined_channel_coding = 0; + + if (encoder->channels > 1 && encoder->epmode) + { + if (encoder->bitrate * encoder->frame_length / (8 * encoder->fs_in) <= 160) + { + encoder->combined_channel_coding = 1; + } + } + + if (encoder->epmode > 0) + { + max_bytes = bitrate * encoder->frame_length / (8 * encoder->fs_in * encoder->channels); + if (max_bytes < FEC_SLOT_BYTES_MIN || max_bytes > FEC_SLOT_BYTES_MAX) + { + encoder->lc3_br_set = 0; + return LC3PLUS_BITRATE_ERROR; + } + } + + if (encoder->combined_channel_coding) + { + totalBytes = fec_get_data_size(encoder->epmode, encoder->combined_channel_coding, + bitrate * encoder->frame_length / (8 * encoder->fs_in)); + + encoder->channel_setup[0]->n_pccw = + fec_get_n_pccw(bitrate * encoder->frame_length / (8 * encoder->fs_in), encoder->epmode, + encoder->combined_channel_coding); + + encoder->channel_setup[0]->n_pc = fec_get_n_pc(encoder->epmode, encoder->channel_setup[0]->n_pccw, + bitrate * encoder->frame_length / (8 * encoder->fs_in)); + } + else + { + totalBytes = bitrate * encoder->frame_length / (8 * encoder->fs_in); + } + + if (encoder->frame_dms <= 50) + { + encoder->tnsMaxOrder = 4; + } else { + encoder->tnsMaxOrder = 8; + } + + if (bitrate < minBR || bitrate > maxBR) { + return LC3PLUS_BITRATE_ERROR; + } + + encoder->lc3_br_set = 1; + for (ch = 0; ch < encoder->channels; ch++) { + + EncSetup* setup = encoder->channel_setup[ch]; + + setup->targetBytes = totalBytes / encoder->channels + (ch < (totalBytes % encoder->channels)); + channel_bytes = totalBytes / encoder->channels + (ch < (totalBytes % encoder->channels)); + + if (encoder->combined_channel_coding) + { + setup->targetBytes = channel_bytes; + } + else + { + setup->targetBytes = fec_get_data_size(encoder->epmode, encoder->combined_channel_coding, channel_bytes); + setup->n_pccw = fec_get_n_pccw(channel_bytes, encoder->epmode, encoder->combined_channel_coding); + setup->n_pc = fec_get_n_pc(encoder->epmode, setup->n_pccw, channel_bytes); + } + // reduce bandwith to 12kHz if bitrate is low + if (encoder->frame_dms == 100 && + ((setup->targetBytes < 40 && encoder->fs == 48000) || + (setup->targetBytes < 36 && encoder->fs == 32000))) + { + encoder->bandwidth = MIN(12000, encoder->bandwidth_preset); + } + else + { + /* channel with highest index has lowest bitrate. + For a second channel with lower targetBytes, bandwidth is overwritten */ + encoder->bandwidth = encoder->bandwidth_preset; + } + encoder->bw_ctrl_cutoff_bin = encoder->bandwidth * encoder->frame_dms / 5000; + encoder->bw_index = (encoder->bandwidth / 4000) - 1; + setup->total_bits = setup->targetBytes << 3; + setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits - + encoder->noise_fac_bits - encoder->BW_cutoff_bits - + ceil(LC3_LOGTWO(encoder->frame_length / 2)) - 2 - 1; + + if (setup->total_bits > 1280) { + setup->targetBitsInit = setup->targetBitsInit - 1; + } + if (setup->total_bits > 2560) { + setup->targetBitsInit = setup->targetBitsInit - 1; + } + + if (encoder->hrmode) + { + setup->targetBitsInit -= 1; + } + + setup->targetBitsAri = setup->total_bits; + setup->enable_lpc_weighting = setup->total_bits < 480; + + if (encoder->frame_ms == 5) { + setup->enable_lpc_weighting = setup->total_bits < 240; + } + if (encoder->frame_ms == 2.5) { + setup->enable_lpc_weighting = setup->total_bits < 120; + } + + setup->quantizedGainOff = + -(MIN(115, setup->total_bits / (10 * (encoder->fs_idx + 1))) + 105 + 5 * (encoder->fs_idx + 1)); + + if (encoder->hrmode && encoder->fs_idx == 5) + { + setup->quantizedGainOff = MAX(setup->quantizedGainOff, -181); + } + + if (encoder->frame_ms == 10 && ((encoder->fs_in >= 44100 && setup->targetBytes >= 100) || + (encoder->fs_in == 32000 && setup->targetBytes >= 81)) && setup->targetBytes < 340 && encoder->hrmode == 0) { + setup->attack_handling = 1; + + } + else if (encoder->frame_dms == 75 && ((encoder->fs_in >= 44100 && setup->targetBytes >= 75) || + (encoder->fs_in == 32000 && setup->targetBytes >= 61)) && setup->targetBytes < 150 && encoder->hrmode == 0) + { + setup->attack_handling = 1; + } + else + { + /* reset for bitrate switching */ + setup->attack_handling = 0; + + setup->attdec_filter_mem[0] = 0; + setup->attdec_filter_mem[1] = 0; + + setup->attdec_detected = 0; + setup->attdec_position = 0; + setup->attdec_acc_energy = 0; + } + + bitsTmp = setup->total_bits; + if (encoder->frame_ms == 2.5) { + bitsTmp = bitsTmp * 4.0 * (1.0 - 0.4); + } + if (encoder->frame_ms == 5) { + bitsTmp = bitsTmp * 2 - 160; + } + + if (bitsTmp < 400 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else if (bitsTmp < 480 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else if (bitsTmp < 560 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else if (bitsTmp < 640 + (encoder->fs_idx - 1) * 80) { + setup->ltpf_enable = 1; + } else { + setup->ltpf_enable = 0; + } + if (encoder->hrmode) { + setup->ltpf_enable = 0; + } + + /* turn down SNS shaping for higher rates */ + if (encoder->hrmode == 0) { + encoder->sns_damping = 0.85; + } else { + encoder->sns_damping = 0.6; + if (encoder->fs_idx >= 4) { + if (encoder->frame_ms == 10) + { + if (setup->total_bits > 4400) { + encoder->sns_damping = 6881.0/32768.0; + } + } + if (encoder->frame_ms == 5) + { + if (setup->total_bits > 4600/2) { + encoder->sns_damping = 4915.0/32768.0; + } + } + if (encoder->frame_ms == 2.5) + { + if (setup->total_bits > 4600/4) { + encoder->sns_damping = 4915.0/32768.0; + } + } + } + } + + if (encoder->hrmode && encoder->fs_idx >= 4) + { + int real_rate = setup->targetBytes * 8000 / encoder->frame_ms; + setup->regBits = real_rate / 12500; + + if (encoder->fs_idx == 5) + { + if (encoder->frame_ms == 10) + { + setup->regBits +=2; + } + if (encoder->frame_ms == 2.5) + { + setup->regBits -= 6; + } + } + else + { + if (encoder->frame_ms == 2.5) + { + setup->regBits -= 6; + } + else if (encoder->frame_ms == 5) + { + setup->regBits += 0; + } + if (encoder->frame_ms == 10) + { + setup->regBits += 5; + } + } + if (setup->regBits < 6) + { + setup->regBits = 6; + } + if (setup->regBits > 23) + { + setup->regBits = 23; + } + } + else + { + setup->regBits = -1; + } + } + + encoder->bitrate = bitrate; + + return LC3PLUS_OK; +} + +void update_enc_bandwidth(LC3PLUS_Enc* encoder, int bandwidth) +{ + int index = 0; + + if (bandwidth >= encoder->fs_in) { + encoder->bandwidth = 0; + } + else + { + encoder->bandwidth = bandwidth; + index = FS2FS_IDX(bandwidth); + if (index > 4) { + index = 5; + } + encoder->bw_ctrl_cutoff_bin = encoder->cutoffBins[index]; + } +} diff --git a/lc3plus/setup_enc_lc3.h b/lc3plus/setup_enc_lc3.h new file mode 100755 index 0000000000..31f0cbeb50 --- /dev/null +++ b/lc3plus/setup_enc_lc3.h @@ -0,0 +1,119 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef SETUP_ENC_LC3_FL_H +#define SETUP_ENC_LC3_FL_H + +#include "constants.h" + +/* Channel state and bitrate-derived values go in this struct */ +typedef struct { + LC3_FLOAT targetBitsOff; + LC3_FLOAT ltpf_mem_normcorr; + LC3_FLOAT ltpf_mem_mem_normcorr; + LC3_FLOAT attdec_filter_mem[2]; + LC3_FLOAT attdec_acc_energy; + LC3_FLOAT r12k8_mem_50[2]; + LC3_FLOAT r12k8_mem_in[120]; + LC3_FLOAT r12k8_mem_out[24]; + LC3_FLOAT olpa_mem_s12k8[3]; + LC3_FLOAT olpa_mem_s6k4[LEN_6K4 + MAX_PITCH_6K4 + 16]; + LC3_FLOAT ltpf_mem_in[LTPF_MEMIN_LEN + LEN_12K8 + 1]; + LC3_FLOAT s_in_scaled[MAX_LEN]; + LC3_FLOAT s_12k8[LEN_12K8 + 1]; + LC3_FLOAT ener[MAX_BANDS_NUMBER]; + LC3_FLOAT scf_q[M]; + LC3_FLOAT scf[M]; + LC3_FLOAT int_scf[MAX_BANDS_NUMBER]; + LC3_FLOAT ltpf_mem_pitch; + + LC3_INT targetBytes; + LC3_INT total_bits; + LC3_INT targetBitsInit; + LC3_INT targetBitsAri; + LC3_INT enable_lpc_weighting; + LC3_INT ltpf_enable; + LC3_INT quantizedGainOff; + LC3_INT tns_bits; + LC3_INT targetBitsQuant; + LC3_INT olpa_mem_pitch; + LC3_INT ltpf_mem_ltpf_on; + LC3_INT mem_targetBits; + LC3_INT mem_specBits; + LC3_INT attack_handling; /* flag to enable attack handling */ + LC3_INT attdec_detected; + LC3_INT attdec_position; + LC3_INT ltpf_param[3]; + LC3_INT L_scf_idx[SCF_MAX_PARAM]; + LC3_INT codingdata[3 * MAX_LEN]; + uint8_t resBits[MAX_RESBITS_LEN]; + LC3_INT regBits; + + LC3_INT16 n_pc; + LC3_INT16 n_pccw; + LC3_INT16 be_bp_left; + LC3_INT16 be_bp_right; + + Mdct mdctStruct; + Dct2 dct2StructSNS; + + LC3_INT lfe; +} EncSetup; + +/* Constants and sampling rate derived values go in this struct */ +struct LC3PLUS_Enc { + EncSetup* channel_setup[MAX_CHANNELS]; + const LC3_INT* W_fx; + const LC3_INT* bands_offset; + const LC3_INT* cutoffBins; + + LC3_INT fs; /* encoder sampling rate 44.1 -> 48 */ + LC3_INT fs_in; /* input sampling rate */ + LC3_INT bitrate; /* global bitrate */ + LC3_INT fs_idx; /* sampling rate index */ + LC3_INT frame_length; /* audio samples / frame */ + LC3_INT channels; /* number of channels */ + LC3_INT epmode; /* error protection mode */ + LC3_FLOAT frame_ms; /* frame length in ms (wrong for 44.1) */ + LC3_INT frame_dms; /* frame length in ms * 10 (wrong for 44.1) */ + LC3_INT tilt; + LC3_INT lc3_br_set; + LC3_INT yLen; + LC3_INT W_size; + LC3_INT la_zeroes; + LC3_INT stEnc_mdct_mem_len; + LC3_INT bands_number; + LC3_INT nSubdivisions; + LC3_INT ltpf_mem_in_len; + LC3_INT envelope_bits; + LC3_INT global_gain_bits; + LC3_INT noise_fac_bits; + LC3_INT BW_cutoff_bits; + LC3_INT r12k8_mem_in_len; + LC3_INT r12k8_mem_out_len; + LC3_INT16 near_nyquist_index; + LC3_INT16 near_nyquist_flag; + LC3_INT tnsMaxOrder; + LC3_INT hrmode; + LC3_INT bandwidth; + LC3_INT bandwidth_preset; + LC3_INT bw_ctrl_active; + LC3_INT bw_ctrl_cutoff_bin; + LC3_INT bw_index; + LC3_FLOAT sns_damping; + LC3_INT attdec_nblocks; + LC3_FLOAT attdec_damping; + LC3_INT attdec_hangover_thresh; + + LC3_INT16 combined_channel_coding; + LC3_INT16 epmr; +}; + +#endif diff --git a/lc3plus/sns_compute_scf.c b/lc3plus/sns_compute_scf.c new file mode 100755 index 0000000000..5cb041925b --- /dev/null +++ b/lc3plus/sns_compute_scf.c @@ -0,0 +1,177 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) +{ + LC3_INT bands_number = 0, d = 0, i = 0, j = 0, n = 0, n2 = 0, n4 = 0, mapping[64] = {0}; + LC3_FLOAT tmp[64] = {0}, x_tmp1[MAX_LEN] = {0}, x_tmp2[MAX_LEN] = {0}, sum = 0, mean = 0, xl4[16] = {0}, nf = 0, xl[64] = {0}, gains_smooth[M] = {0}, ratio = 0; + LC3_FLOAT W[6] = {1.0 / 12.0, 2.0 / 12.0, 3.0 / 12.0, 3.0 / 12.0, 2.0 / 12.0, 1.0 / 12.0}; + + bands_number = xLen; + assert(bands_number <= 64); + + /* 5 ms */ + if (bands_number < 64) { + d = 64 - bands_number; + + if (d < xLen) + { + j = 0; + for (i = 0; i < 2 * d; i = i + 2) { + tmp[i] = x[j]; + tmp[i + 1] = x[j]; + j++; + } + + move_float(&tmp[2 * d], &x[d], 64 - 2 * d); + } else if (ceil(64.0 / (LC3_FLOAT) xLen) == 4) + { + ratio = LC3_FABS((LC3_FLOAT) (1.0 - 32.0 / (LC3_FLOAT) xLen)); + n4 = round(ratio * xLen); + n2 = xLen - n4; + + j = 0; + for(i = 1; i <= n4; i++) + { + mapping[j] = i; + mapping[j + 1] = i; + mapping[j + 2] = i; + mapping[j + 3] = i; + j += 4; + } + + for (i = n4 + 1; i <= n4 + n2; i++) + { + mapping[j] = i; + mapping[j + 1] = i; + j += 2; + } + + + for (i = 0; i < 64; i++) + { + tmp[i] = x[mapping[i] - 1]; + } + } else { + assert(0 && "Unsupported number of bands!"); + } + + move_float(x, tmp, 64); + + bands_number = 64; + xLen = bands_number; + } + + + /* Smoothing */ + + x_tmp1[0] = x[0]; + + move_float(&x_tmp1[1], &x[0], xLen - 1); + + move_float(&x_tmp2[0], &x[1], xLen - 1); + + x_tmp2[xLen - 1] = x[xLen - 1]; + + for (i = 0; i < xLen; i++) { + x[i] = 0.5 * x[i] + 0.25 * (x_tmp1[i] + x_tmp2[i]); + } + + /* Pre-emphasis */ + for (i = 0; i < xLen; i++) { + x[i] = x[i] * LC3_POW(10.0, (LC3_FLOAT)i * (LC3_FLOAT)tilt / ((LC3_FLOAT)bands_number - 1.0) / 10.0); + } + + /* Noise floor at -40dB */ + for (i = 0; i < 64; i++) { + sum += x[i]; + } + + mean = sum / (LC3_FLOAT)xLen; + + nf = mean * LC3_POW(10.0, -40.0 / 10.0); + nf = MAX(nf, LC3_POW(2.0, -32.0)); + + for (i = 0; i < 64; i++) { + if (x[i] < nf) { + x[i] = nf; + } + } + + /* Log-domain */ + for (i = 0; i < 64; i++) { + xl[i] = LC3_LOGTWO(x[i]) / 2.0; + } + + /* Downsampling */ + for (n = 0; n < bands_number / 4; n++) { + if (n == 0) { + tmp[0] = xl[0]; + + move_float(&tmp[1], &xl[0], 5); + + } else if (n == (bands_number / 4 - 1)) { + move_float(tmp, &xl[59], 5); + + tmp[5] = xl[63]; + + } else { + move_float(tmp, &xl[n * 4 - 1], ((n * 4 + 5 - 1) - (n * 4 - 1) + 1)); + } + + sum = 0; + for (i = 0; i < 6; i++) { + sum += tmp[i] * W[i]; + } + + xl4[n] = sum; + } + + + /* Remove mean and scaling */ + + sum = 0; + for (i = 0; i < bands_number / 4; i++) { + sum += xl4[i]; + } + + mean = sum / ((LC3_FLOAT)bands_number / 4.0); + + for (i = 0; i < bands_number / 4; i++) { + gains[i] = sns_damping * (xl4[i] - mean); + } + + /* Smoothing */ + if (smooth) { + gains_smooth[0] = (gains[0] + gains[1] + gains[2]) / 3.0; + gains_smooth[1] = (gains[0] + gains[1] + gains[2] + gains[3]) / 4.0; + + for (i = 2; i < 14; i++) { + gains_smooth[i] = (gains[i - 2] + gains[i - 1] + gains[i] + gains[i + 1] + gains[i + 2]) / 5.0; + } + + gains_smooth[M - 2] = (gains[M - 4] + gains[M - 3] + gains[M - 2] + gains[M - 1]) / 4.0; + gains_smooth[M - 1] = (gains[M - 3] + gains[M - 2] + gains[M - 1]) / 3.0; + + sum = 0; + for (i = 0; i < M; i++) { + sum += gains_smooth[i]; + } + + mean = sum / (LC3_FLOAT)M; + + for (i = 0; i < M; i++) { + gains[i] = attdec_damping_factor * (gains_smooth[i] - mean); + } + } +} diff --git a/lc3plus/sns_interpolate_scf.c b/lc3plus/sns_interpolate_scf.c new file mode 100755 index 0000000000..4419397890 --- /dev/null +++ b/lc3plus/sns_interpolate_scf.c @@ -0,0 +1,90 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) +{ + LC3_INT i = 0, n = 0, d = 0, n4 = 0; + LC3_FLOAT tmp[MAX_BANDS_NUMBER_PLC] = {0}, ratio = 0; + + /* Interpolation */ + + gains_int[0] = gains[0]; + gains_int[1] = gains[0]; + + for (n = 0; n <= 14; n++) { + gains_int[n * 4 + 2] = gains[n] + (gains[n + 1] - gains[n]) / 8.0; + gains_int[n * 4 + 3] = gains[n] + 3.0 * (gains[n + 1] - gains[n]) / 8.0; + gains_int[n * 4 + 4] = gains[n] + 5.0 * (gains[n + 1] - gains[n]) / 8.0; + gains_int[n * 4 + 5] = gains[n] + 7.0 * (gains[n + 1] - gains[n]) / 8.0; + } + + gains_int[62] = gains[15] + (gains[15] - gains[14]) / 8.0; + gains_int[63] = gains[15] + 3.0 * (gains[15] - gains[14]) / 8.0; + + /* For 5ms */ + + if (bands_number < 64) { + d = 64 - bands_number; + + if (d < 32) + { + i = 0; + for (n = 0; n < 2 * d; n = n + 2) { + tmp[i] = (gains_int[n] + gains_int[n + 1]) / (LC3_FLOAT)2.0; + i++; + } + + for (n = 1; n < d; n++) { + gains_int[n] = gains_int[2 * n]; + } + + for (n = 2 * d; n < 64; n++) { + gains_int[n - d] = gains_int[n]; + } + + move_float(gains_int, tmp, d); + } else if (ceil(64.0 / (LC3_FLOAT) bands_number) == 4) + { + ratio = LC3_FABS((LC3_FLOAT) ((LC3_FLOAT)1.0 - (LC3_FLOAT)32.0 / (LC3_FLOAT) bands_number)); + n4 = LC3_ROUND(ratio * (LC3_FLOAT)bands_number); + + for (i = 0; i < n4; i++) + { + tmp[i] = (gains_int[4 * i] + gains_int[4 * i + 1] + gains_int[4 * i + 2] + gains_int[4 * i + 3]) / 4.0; + } + + for (i = 0; i < bands_number - n4; i++) + { + tmp[n4 + i] = (gains_int[4 * n4 + 2 * i] + gains_int[4 * n4 + 2 * i + 1]) / 2.0; + } + + move_float(gains_int, tmp, bands_number); + } else { + assert(0 && "Unsupported number of bands!"); + } + } + + /* Inversion at encoder-side */ + + if (encoder_side == 1) { + for (n = 0; n < bands_number; n++) { + gains_int[n] = -gains_int[n]; + } + } + + /* Linear domain */ + + for (n = 0; n < bands_number; n++) { + gains_int[n] = LC3_POW(2, gains_int[n]); + } +} diff --git a/lc3plus/sns_quantize_scf.c b/lc3plus/sns_quantize_scf.c new file mode 100755 index 0000000000..704127cce7 --- /dev/null +++ b/lc3plus/sns_quantize_scf.c @@ -0,0 +1,517 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); +static LC3_INT find_last_indice_le(LC3_INT compare, const LC3_INT* array, LC3_INT len); +static void idct_II(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT len); + +void idct_II(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT len) +{ + LC3_INT i; + LC3_FLOAT norm1, sum; + + norm1 = 0.353553390593274; /* sqrt(2 / 16) */ + + for (i = 0; i < len; i++) { + sum = mac_loop(in, idct_lookup[i], len); + out[i] = norm1 * sum; + } +} + +static LC3_INT pvq_pulse_search(LC3_FLOAT *xabs, LC3_FLOAT *ener, LC3_FLOAT *corr, LC3_INT *y, LC3_INT start, LC3_INT end) +{ + LC3_INT i; + LC3_INT nBest; + LC3_FLOAT bestCorrSq, bestEn; + LC3_FLOAT corrSq, currCorr, currEn; + + nBest = 0; + bestCorrSq = 0.0; + bestEn = 0.0; + + *ener += 1; // Added once for the entire loop + + i = start; + + currCorr = *corr + xabs[i]; + currEn = *ener + (2 * y[i]); + + corrSq = currCorr * currCorr; + + bestEn = currEn; + bestCorrSq = corrSq; + nBest = i; + + /* Iterative max search as recommended in the spec */ + for (; i < end; i++) + { + currCorr = *corr + xabs[i]; + currEn = *ener + (2 * y[i]); + + corrSq = currCorr * currCorr; + + if ((corrSq * bestEn) > (bestCorrSq * currEn)) + { + bestEn = currEn; + bestCorrSq = corrSq; + nBest = i; + } + } + + *corr += xabs[nBest]; + *ener += (2 * y[nBest]); + + y[nBest] += 1; /* Add the selected unit pulse */ + + return nBest; +} + +static void pvq_enc_vec_normalize(LC3_FLOAT *vec, LC3_INT N) +{ + LC3_FLOAT mag = 0.0, norm_fac; + LC3_INT i; + + for (i = 0; i < N; i++) + { + mag += (vec[i] * vec[i]); + } + + norm_fac = 1.0 / LC3_SQRT(mag); + + for (i = 0; i < N; i++) + { + vec[i] = vec[i] * norm_fac; + } + + return; +} + +static void pvq_enc_search(LC3_FLOAT* x_in, LC3_INT y[4][M]) +{ + LC3_INT i, N, K, pulse_total, N_setA; + LC3_FLOAT abs_sum, projfac; + LC3_FLOAT xabs[16]; + LC3_FLOAT yy, xy; + + abs_sum = 0.0; + + /* Step 1 : Projection to pyramid N=16, K=6 */ + N = 16; + K = 6; + pulse_total = 0; + N_setA = 10; + + yy = xy = 0.0f; + + for (i = 0; i < N; i++) + { + xabs[i] = LC3_FABS(x_in[i]); + abs_sum += xabs[i]; + } + + projfac = (K - 1) / abs_sum; + + for (i = 0; i < N; i++) + { + y[3][i] = floor(xabs[i] * projfac); + + pulse_total += y[3][i]; + + yy += (y[3][i] * y[3][i]); + xy += (xabs[i] * y[3][i]); + } + + /* Step 2: Adding unit pulses up to K = 6 */ + for (; pulse_total < K; pulse_total++) + { + pvq_pulse_search(xabs, &yy, &xy, y[3], 0, N); + } + + /* Step 3: Adding unit pulses up to K = 8 */ + memcpy(y[2], y[3], sizeof(LC3_INT)*N); + K = 8; + + for (; pulse_total < K; pulse_total++) + { + pvq_pulse_search(xabs, &yy, &xy, y[2], 0, N); + } + + memcpy(y[1], y[2], sizeof(LC3_INT)*N_setA); + + /* Step 4: Remove unit pulses not belonging to set A */ + for (i = N_setA; i < N; i++) + { + y[1][i] = 0; + } + + /* Step 5: Update yy and xy terms to reflect y1 */ + yy = 0; + xy = 0; + pulse_total = 0; + + for (i = 0; i < N_setA; i++) + { + yy += (y[1][i] * y[1][i]); + xy += (xabs[i] * y[1][i]); + + pulse_total += y[1][i]; + } + + /* Step 6: Add unit pulses until K = 10 over N = 10 */ + K = 10; + for (; pulse_total < K; pulse_total++) + { + pvq_pulse_search(xabs, &yy, &xy, y[1], 0, N_setA); + } + + memcpy(y[0], y[1], sizeof(LC3_INT)*N); + + /* Step 7: Add unit pulses until K = 1 over N = 6 in set B*/ + pvq_pulse_search(xabs, &yy, &xy, y[0], N_setA, N); + + /* Step 8: Add signs to each of the 4 vectors from x */ + for (i = 0; i < N; i++) + { + if (x_in[i] < 0) + { + y[0][i] = -y[0][i]; + y[1][i] = -y[1][i]; + y[2][i] = -y[2][i]; + y[3][i] = -y[3][i]; + } + } + + return; +} + +static inline LC3_FLOAT calc_mse(LC3_FLOAT *t2rot, LC3_FLOAT *y, LC3_FLOAT gain, LC3_INT N) +{ + LC3_FLOAT mse; + LC3_INT i; + + mse = 0.0; + + for (i = 0; i < N; i++) + { + LC3_FLOAT err = (t2rot[i] - gain * y[i]); + mse += (err * err); + } + + return mse; +} + +static void sns_quant_adj_gain_shape_search(LC3_FLOAT *t2rot, LC3_INT y[4][M] , + LC3_INT *gain_idx, LC3_INT *shape_idx, LC3_FLOAT *y_norm, LC3_FLOAT *scq_gain) +{ + LC3_INT gidx, sidx; + LC3_FLOAT min_mse, mse; + LC3_INT N; + LC3_FLOAT yCur[4][16]; + LC3_INT i; + + const LC3_INT gain_levels[4] = { 2, 4, 4, 8 }; + const LC3_FLOAT *sns_vq_gains[4] = { sns_vq_reg_adj_gains_fl , sns_vq_reg_lf_adj_gains_fl , + sns_vq_near_adj_gains_fl , sns_vq_far_adj_gains_fl }; + + min_mse = -1.0; + N = 16; + + + *gain_idx = *shape_idx = 0; + + for (sidx = 0; sidx < 4; sidx++) + { + for (i = 0; i < N; i++) + { + yCur[sidx][i] = (LC3_FLOAT)y[sidx][i]; + } + + /* Step 9: Normalize the vectors */ + pvq_enc_vec_normalize(yCur[sidx], N); + + for (gidx = 0; gidx < gain_levels[sidx]; gidx++) + { + mse = calc_mse(t2rot, yCur[sidx], sns_vq_gains[sidx][gidx], N); + + if ((mse < min_mse) || (min_mse < 0)) + { + *gain_idx = gidx; + *shape_idx = sidx; + min_mse = mse; + } + } + } + + for (i = 0; i < N; i++) + { + y_norm[i] = yCur[*shape_idx][i]; + } + + *scq_gain = sns_vq_gains[*shape_idx][*gain_idx]; + + return; +} + +static void enc_push_sign(LC3_FLOAT val, LC3_UINT32 *next_sign_ind, LC3_INT *index) +{ + if (((*next_sign_ind & 0x80000000U) == 0) && (val != 0)) { + *index = 2 * (*index) + *next_sign_ind; + } + if (val < 0) { + *next_sign_ind = 1; + } + if (val > 0) { + *next_sign_ind = 0; + } + + return; +} + +static void MPVQ_enum(LC3_INT dim, LC3_INT *sns_vec, LC3_INT *index_val, LC3_INT *lead_sign_ind) +{ + LC3_UINT32 next_sign_ind; + LC3_INT k_val_acc; + LC3_INT pos; + LC3_INT index, n; + LC3_INT const *row_ptr; + + /* MPVQ-index composition loop */ + LC3_INT tmp_h_row; + LC3_INT tmp_val; + + next_sign_ind = 0x80000000U; + k_val_acc = 0; + pos = dim; + index = 0; + n = 0; + + row_ptr = (LC3_INT const *)&(pvq_enc_A[n]); + tmp_h_row = row_ptr[0]; + + for (pos--; pos >= 0; pos--) + { + tmp_val = sns_vec[pos]; + enc_push_sign(tmp_val, &next_sign_ind, &index); + + index += tmp_h_row; + k_val_acc += abs(tmp_val); + if (pos != 0) { + n += 1; /* switch row in offset table MPVQ_offsets(n, k) */ + } + row_ptr = (LC3_INT const *)&(pvq_enc_A[n]); + + tmp_h_row = row_ptr[k_val_acc]; + } + + *index_val = index; + *lead_sign_ind = next_sign_ind; + + return; +} + +static LC3_INT MSEsearch (LC3_FLOAT *scf, const LC3_FLOAT sns_CB[8][32]) +{ + LC3_FLOAT distance, mse; + LC3_INT i, n, ind; + + ind = 0; + + distance = (LC3_FLOAT) LC3_CONST_POW_2_100; + for (i = 0; i < 32; i++) { + mse = 0; + for (n = 0; n < 8; n++) { + mse += (scf[n] - sns_CB[n][i]) * (scf[n] - sns_CB[n][i]); + } + + if (mse < distance) { + distance = mse; + ind = i; + } + } + return ind; +} + +void process_snsQuantizesScf_Enc(LC3_FLOAT* env, LC3_INT* index, LC3_FLOAT* envq, Dct2 dct2structSNS) +{ + LC3_FLOAT stage2_en1_norm_sub[M]; + LC3_INT i, j; + LC3_FLOAT st1_vector[M]; + LC3_FLOAT pvq_target_pre[M]; + LC3_FLOAT pvq_target[M]; + LC3_FLOAT stage2_en1_norm_pre_sub[M]; + LC3_INT gain, shape; + LC3_FLOAT scfq_gain; + LC3_INT y[4][M]; + + /* Stage 1 split VQ */ + index[0] = MSEsearch(&env[0], sns_LFCB); /* ind_LF */ + index[1] = MSEsearch(&env[8], sns_HFCB); /* ind_HF */ + + j = 8; + for (i = 0; i < 8; i++, j++) { + st1_vector[i] = sns_LFCB[i][index[0]]; + st1_vector[j] = sns_HFCB[i][index[1]]; + } + + /* STAGE 2 */ + for (i = 0; i < 16; i++) { + pvq_target_pre[i] = env[i] - st1_vector[i]; + } + + dct2_apply(&dct2structSNS, pvq_target_pre, pvq_target); + pvq_enc_search(pvq_target, y); + sns_quant_adj_gain_shape_search(pvq_target, y, &gain, &shape, stage2_en1_norm_pre_sub, &scfq_gain); + + /* Inverse transform */ + idct_II(stage2_en1_norm_pre_sub, stage2_en1_norm_sub, M); + + index[2] = shape; + index[3] = gain; + + if (shape < 2) { + MPVQ_enum(10, y[shape], &index[5], &index[4]); + } + else { + MPVQ_enum(M, y[shape], &index[5], &index[4]); + } + + if (shape == 0) { + LC3_INT ls_ind, ind; + MPVQ_enum(6, &y[shape][10], &ind, &ls_ind); + index[6] = ind * 2 + ls_ind; + } + else if (shape == 2) { + index[6] = -1; + } + else { + index[6] = -2; + } + + for (i = 0; i < M; i++) { + envq[i] = st1_vector[i] + (stage2_en1_norm_sub[i] * scfq_gain); + } +} + +LC3_INT find_last_indice_le(LC3_INT compare, const LC3_INT* array, LC3_INT len) +{ + LC3_INT idx = 0, i = 0; + + for (i = 0; i < len; i++) { + if (compare >= array[i]) { + idx++; + } + } + + if (idx > 0) { + idx--; + } + + return idx; +} + +void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses) +{ + LC3_INT leading_sign = 0, idx = 0, k_delta = 0, pos = 0; + + leading_sign = 1 - 2 * LS_ind; + + /* Decoding loop */ + + for (pos = 0; pos < m; pos++) { + if (MPVQ_ind != 0) { + /* Find last indice */ + idx = find_last_indice_le(MPVQ_ind, &pvq_enc_A[m - pos - 1][0], k + 1); + MPVQ_ind = MPVQ_ind - pvq_enc_A[m - pos - 1][idx]; + k_delta = k - idx; + } else { + pulses[pos] = leading_sign * k; + break; + } + + if (k_delta != 0) { + pulses[pos] = leading_sign * k_delta; + if ((MPVQ_ind % 2) != 0) { + leading_sign = -1; + } else { + leading_sign = 1; + } + + MPVQ_ind = floor(MPVQ_ind / 2); + k = k - k_delta; + } + } +} + +void process_snsQuantizesScf_Dec(LC3_INT* scf_idx, LC3_FLOAT* scf_q) +{ + LC3_INT i = 0, submode = 0; + LC3_INT pulses2[6] = {0}, pulses[M] = {0}; + LC3_FLOAT st2_vector[M] = {0}, st2_vector_idct[M] = {0}, sum = 0; + + /* Decode first stage */ + + for (i = 0; i < 8; i++) { + scf_q[i] = sns_LFCB[i][scf_idx[0]]; + scf_q[i + 8] = sns_HFCB[i][scf_idx[1]]; + } + + /* STAGE 2 */ + /* Decode submode */ + + submode = scf_idx[2]; + + /* Decode pulses */ + + if (submode < 2) { + pvq_dec(10, 10, scf_idx[4], scf_idx[5], pulses); + + if (submode == 0) { + pvq_dec(1, 6, (scf_idx[6] % 2), floor(scf_idx[6] / 2), pulses2); + + move_int(&pulses[10], pulses2, 6); + + } else { + pulses[15] = 0; + } + } else if (submode == 2) { + pvq_dec(8, 16, scf_idx[4], scf_idx[5], pulses); + } else { + pvq_dec(6, 16, scf_idx[4], scf_idx[5], pulses); + } + + /* Normalization */ + + for (i = 0; i < M; i++) { + sum += pulses[i] * pulses[i]; + } + + sum = 1.0 / LC3_SQRT(sum); + + for (i = 0; i < M; i++) { + st2_vector[i] = pulses[i] * sum; + } + + /* Inverse transform */ + idct_II(st2_vector, st2_vector_idct, M); + + /* Gain */ + for (i = 0; i < M; i++) { + st2_vector_idct[i] = st2_vector_idct[i] * sns_dec_gains[submode][scf_idx[3]]; + } + + /* Add stage 1 and stage 2 */ + + for (i = 0; i < M; i++) { + scf_q[i] = scf_q[i] + st2_vector_idct[i]; + } +} diff --git a/lc3plus/structs.h b/lc3plus/structs.h new file mode 100755 index 0000000000..fea377da41 --- /dev/null +++ b/lc3plus/structs.h @@ -0,0 +1,186 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef STRUCTS_H +#define STRUCTS_H + +#include "defines.h" +#include "fft/iisfft.h" + +typedef struct { + LC3_FLOAT r; /* real part */ + LC3_FLOAT i; /* imaginary part */ +} Complex; + +typedef struct { + LC3_INT length; + void *handle; +} Fft; + +typedef struct { + LC3_INT length; + Fft fft; +} Dct2; + +typedef struct { + LC3_INT length; + Fft fft; +} Dct3; + +typedef struct { + LC3_INT length; + Complex *twid1; + Complex *twid2; + Fft fft; +} Dct4; + +typedef struct { + LC3_INT length; + LC3_INT leading_zeros; + LC3_INT mem_length; + const LC3_FLOAT *window; + LC3_FLOAT *mem; + Dct4 dct; +} Mdct; + +typedef struct { + uint32_t ac_low_fl; + uint32_t ac_range_fl; + int BER_detect; + + LC3_INT32 pc_c_bp; + LC3_INT32 pc_c_bp_side; + LC3_INT32 pc_bytes; + LC3_INT32 pc_b_left; + LC3_INT32 pc_b_right; + LC3_INT32 pc_enc; + LC3_INT32 pc_bfi; + LC3_INT32 pc_bbi; + LC3_INT32 pc_be_bp_left; + LC3_INT32 pc_be_bp_right; + LC3_INT32 pc_return; +} Decoder_State_fl; + +typedef struct { + LC3_INT bp; + LC3_INT low; + LC3_INT range; + LC3_INT cache; + LC3_INT carry; + LC3_INT carry_count; + uint8_t *ptr; + LC3_INT *bp_side; + LC3_INT *mask_side; +} Encoder_State_fl; + +typedef struct { + LC3_INT nbLostCmpt; + LC3_INT prevBfi; + LC3_INT prevprevBfi; + LC3_FLOAT q_d[MAX_LEN]; + LC3_FLOAT q_d_prev[MAX_LEN]; +} PlcSetup; + + +typedef struct { + LC3_FLOAT cum_alpha; + LC3_INT seed; +} PlcNsSetup; + +typedef struct { + LC3_INT32 seed; + LC3_INT32 ns_nbLostCmpt_pc; + LC3_FLOAT *q_old_res; + LC3_FLOAT prev_gg; +} pcState; + +typedef struct { + LC3_INT len; + LC3_INT sign; + LC3_FLOAT* table; +} Cfft; + +typedef struct T_IIS_FFT { + IIS_FFT_DIR sign; + LC3_INT32 len; + LC3_FLOAT* buffer; + LC3_FLOAT* sine_table; + Iisfft iisfft; + Cfft cfft; +} IIS_FFT; + +typedef struct T_IIS_FFT* HANDLE_IIS_FFT; + +typedef struct { + Fft PhEcu_Fft; /*no counterpart in BASOP */ + Fft PhEcu_Ifft; /*no counterpart in BASOP */ + + + LC3_FLOAT PhECU_f0hzLtpBin; /* BASOP Word16 PhECU_f0hzLtpBinQ7 */ + LC3_FLOAT PhECU_norm_corr; /* BASOP Word16 norm_corrQ15 */ + + LC3_FLOAT *PhECU_oold_grp_shape; /* BASOP Word16 PhECU_oold_grp_shape_fx[MAX_LGW]; */ + LC3_FLOAT *PhECU_old_grp_shape; /* BASOP Word16 PhECU_old_grp_shape_fx[MAX_LGW] ; */ + + LC3_FLOAT PhECU_L_oold_xfp_w_E; /* BASOP Word32 PhECU_L_oold_xfp_w_E_fx;*/ + LC3_FLOAT PhECU_L_old_xfp_w_E; /* BASOP Word32 PhECU_L_old_xfp_w_E_fx; */ + + LC3_INT32 PhECU_Lprot ; /* BASOP Word16 PhECU_Lprot_fx;*/ + + LC3_FLOAT *PhECU_xfp; + Complex *PhECU_X_sav_m; + LC3_INT32 *PhECU_plocs; /* BASOP Word16 *PhECU_plocs; */ /* MAX_PLOCS */ + LC3_FLOAT *PhECU_f0est; /*BASOP Word32 *PhECU_f0est;*/ + + LC3_FLOAT *PhECU_mag_chg_1st; /* BASOP Word16 PhECU_mag_chg_1st[MAX_LGW];*/ + LC3_FLOAT *PhECU_Xavg; /* BASOP Word16 PhECU_Xavg[MAX_LGW] ; */ + + LC3_FLOAT PhECU_beta_mute; /* BASOP Word16 PhECU_beta_mute*/ + + LC3_INT16 PhECU_seed; /* BASOP Word16 PhECU_seed_fx;*/ + + LC3_INT32 PhECU_LDWIN_OLAP; /* BASOP Word16 PhECU_LDWIN_OLAP; */ + LC3_INT32 PhECU_t_adv; /* BASOP Word16 t_adv; */ + + LC3_INT32 PhECU_short_flag_prev; + LC3_INT32 PhECU_time_offs; + LC3_INT32 PhECU_num_plocs; + HANDLE_IIS_FFT handle_fft_phaseecu; + HANDLE_IIS_FFT handle_ifft_phaseecu; + +} PlcPhEcuSetup; + +typedef struct { + LC3_INT16 seed; + LC3_FLOAT gain_c; + LC3_INT32 lpcorder; + LC3_FLOAT A[M+1]; + LC3_INT32 fract; + LC3_INT32 lagw_bw; + LC3_FLOAT preemphFac; + LC3_FLOAT *harmonicBuf; + LC3_FLOAT synthHist[M]; +} PlcTdcSetup; + +typedef struct { + LC3_FLOAT *pcmbufHist; + LC3_INT32 max_len_pcm_plc; + PlcTdcSetup PlcTdcSetup; + LC3_FLOAT stabFac; + LC3_FLOAT cum_fading_slow; + LC3_FLOAT cum_fading_fast; + LC3_FLOAT cum_fflcAtten; + LC3_FLOAT scf_q_old[M]; + LC3_FLOAT scf_q_old_old[M]; + PlcPhEcuSetup PlcPhEcuSetup; +} PlcAdvSetup; + + +#endif diff --git a/lc3plus/tinywavein_c.h b/lc3plus/tinywavein_c.h new file mode 100755 index 0000000000..c7bd58593c --- /dev/null +++ b/lc3plus/tinywavein_c.h @@ -0,0 +1,605 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef __TINYWAVEIN_C_H__ +#define __TINYWAVEIN_C_H__ + +/*#define SUPPORT_BWF*/ + +#include +#include +#include + + +#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ + defined(__aarch64__) +#define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ +#endif + +#if defined(__POWERPC__) +#define __TWI_BE /* _T_iny _W_ave _I_n _B_ig _E_ndian */ +#endif + +#if !defined(__TWI_LE) && !defined(__TWI_BE) +#error unknown processor +#endif + +#define __TWI_SUCCESS (0) +#define __TWI_ERROR (-1) + +#ifdef SUPPORT_BWF +typedef struct +{ + float loudnessVal; + float loudnessRange; + float maxTruePeakLevel; + float maxMomentaryLoudnes; + float maxShortTermLoudness; +} WAVEIN_LOUDNESSINFO; +#endif + +typedef struct __tinyWaveInHandle +{ + FILE * theFile; + fpos_t dataChunkPos; + unsigned int position; + unsigned int length; + unsigned int bps; +#ifdef SUPPORT_BWF + WAVEIN_LOUDNESSINFO *loudnessInfo; +#endif +} __tinyWaveInHandle, WAVEFILEIN; + +typedef struct +{ + short compressionCode; + short numberOfChannels; + unsigned int sampleRate; + unsigned int averageBytesPerSecond; + short blockAlign; + short bitsPerSample; + /* short extraFormatBytes ; */ +} SWavInfo; + +#ifdef SUPPORT_BWF +typedef struct +{ + unsigned char description[256]; + unsigned char originator[32]; + unsigned char originatorReference[32]; + unsigned char originatorDate[10]; /* ASCII: <> */ + unsigned char originationTime[8]; /* ASCII: <> */ + unsigned int timeReferenceLow; + unsigned int timeReferenceHigh; + unsigned short version; + unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ + + signed short loudnessVal; + signed short loudnessRange; + signed short maxTruePeakLevel; + signed short maxMomentaryLoudnes; + signed short maxShortTermLoudness; + + unsigned char Reserved[180]; + + unsigned char codingHistory; /* ASCII: <> */ +} SBwfWav; +#endif + +typedef struct +{ + char chunkID[4]; + unsigned int chunkSize; + /* long dataOffset ; */ /* never used */ +} SChunk; + +/* local wrapper, always returns correct endian */ +static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream); + +#ifdef __TWI_BE +static short BigEndian16(short v); +static int BigEndian32(int v); +#endif + +/*! + * \brief Read header from a WAVEfile. Host endianess is handled accordingly. + * \fp filepointer of type FILE*. + * \wavinfo SWavInfo struct where the decoded header info is stored into. + * \return 0 on success and non-zero on failure. + * + */ +static WAVEFILEIN *OpenWav(const char *filename, unsigned int *samplerate, short *channels, unsigned int *samplesInFile, + short *bps) +{ + WAVEFILEIN *self; + + SChunk fmt_chunk, data_chunk; + int offset; + unsigned int tmpSize; + char tmpFormat[4]; + SWavInfo wavinfo = {0, 0, 0, 0, 0, 0}; + + self = (WAVEFILEIN *)calloc(1, sizeof(WAVEFILEIN)); + if (!self) + goto bail; /* return NULL; */ + + if (!filename) + goto bail; + if (!samplerate) + goto bail; + if (!channels) + goto bail; + if (!samplesInFile) + goto bail; + if (!bps) + goto bail; + + self->theFile = fopen(filename, "rb"); + if (!self->theFile) + goto bail; + + /* read RIFF-chunk */ + if (fread(tmpFormat, 1, 4, self->theFile) != 4) + { + goto bail; + } + + if (strncmp("RIFF", tmpFormat, 4)) + { + goto bail; + } + + /* Read RIFF size. Ignored. */ + fread_LE(&tmpSize, 4, 1, self->theFile); + + /* read WAVE-chunk */ + if (fread(tmpFormat, 1, 4, self->theFile) != 4) + { + goto bail; + } + + if (strncmp("WAVE", tmpFormat, 4)) + { + goto bail; + } + + /* read format/bext-chunk */ + if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + +#ifdef SUPPORT_BWF + /* test for bext-chunk */ + if (!strncmp("bext", fmt_chunk.chunkID, 4)) + { + /*unsigned int i;*/ + unsigned int bextSize = 0; + + if (fread_LE(&bextSize, 1, 4, self->theFile) != 4) + { + goto bail; + } + + self->loudnessInfo = (WAVEIN_LOUDNESSINFO *)calloc(1, sizeof(WAVEIN_LOUDNESSINFO)); + + if (bextSize >= 602) + { /* minimum size bext-data, w/o 'CodingHistory' */ + int i; + signed short readBuf = 0; + signed int nulbuf = 0; + + /* first skip all descriptive data */ + for (i = 0; i < 412; i++) + { + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + bextSize -= 1; + } + /* second, read loudness data */ + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->loudnessVal = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->loudnessRange = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->maxTruePeakLevel = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->maxMomentaryLoudnes = (float)readBuf * 0.01f; + + fread_LE(&readBuf, 2, 1, self->theFile); + bextSize -= 2; + self->loudnessInfo->maxShortTermLoudness = (float)readBuf * 0.01f; + + /* skip reserved data */ + for (i = 0; i < 180; i++) + { + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + bextSize -= 1; + } + } + + /* skip remaining data */ + while (bextSize) + { + int nulbuf; + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + bextSize -= 1; + } + + /* read next chunk header */ + if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + } +#endif + + /* skip some potential chunks up to fmt chunk */ + + while (strncmp("fmt ", fmt_chunk.chunkID, 4) != 0) + { + unsigned int chunkSize = 0; + + if (fread_LE(&chunkSize, 1, 4, self->theFile) != 4) + { + goto bail; + } + + /* skip chunk data */ + while (chunkSize) + { + int nulbuf; + if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) + { + goto bail; + } + chunkSize -= 1; + } + + /* read next chunk header */ + if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + } + + /* go on with fmt-chunk */ + if (strncmp("fmt ", fmt_chunk.chunkID, 4)) + { + goto bail; + } + + if (fread_LE(&fmt_chunk.chunkSize, 4, 1, self->theFile) != 1) + { /* should be 16 for PCM-format (uncompressed) */ + goto bail; + } + + + /* read info */ + fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); + fread_LE(&(wavinfo.numberOfChannels), 2, 1, self->theFile); + fread_LE(&(wavinfo.sampleRate), 4, 1, self->theFile); + fread_LE(&(wavinfo.averageBytesPerSecond), 4, 1, self->theFile); + fread_LE(&(wavinfo.blockAlign), 2, 1, self->theFile); + fread_LE(&(wavinfo.bitsPerSample), 2, 1, self->theFile); + + if (wavinfo.compressionCode == -2) + { + fseek(self->theFile, 8, SEEK_CUR); // skip channel mask + fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); // part of GUID + fseek(self->theFile, 14, SEEK_CUR); // skip rest of GUID + offset = fmt_chunk.chunkSize - 40; + } + else + offset = fmt_chunk.chunkSize - 16; + + if (wavinfo.compressionCode == 0x01) + { + if ((wavinfo.bitsPerSample != 16) && (wavinfo.bitsPerSample != 24) && (wavinfo.bitsPerSample != 32)) + /* we do only support 16,24 and 32 bit PCM audio */ + goto bail; + } + else + { + /* if(wavinfo.bitsPerSample != 32) */ + printf("compressioncode: %02x\n", wavinfo.compressionCode); + puts("Error! We only support 16,24 and 32 bit PCM audio"); + exit(1); + goto bail; + } + + /* Skip rest of fmt header if any. */ + for (; offset > 0; offset--) + { + fread(&tmpSize, 1, 1, self->theFile); + } + + do + { + + /* Read data chunk ID */ + if (fread(data_chunk.chunkID, 1, 4, self->theFile) != 4) + { + goto bail; + } + + /* Read chunk length. */ + + if (fread_LE(&offset, 4, 1, self->theFile) != 1) + { + goto bail; + } + + /* Check for data chunk signature. */ + if (strncmp("data", data_chunk.chunkID, 4) == 0) + { + data_chunk.chunkSize = offset; + break; + } + + /* unused 1 byte present, if size is odd */ + /* see https://www.daubnet.com/en/file-format-riff */ + if (offset % 2) + { + offset++; + } + + /* Jump over non data chunk. */ + for (; offset > 0; offset--) + { + fread(&tmpSize, 1, 1, self->theFile); + } + + } while (!feof(self->theFile)); + + /* success so far */ + *samplerate = wavinfo.sampleRate; + *channels = wavinfo.numberOfChannels; + *samplesInFile = data_chunk.chunkSize / wavinfo.numberOfChannels; + *samplesInFile /= ((wavinfo.bitsPerSample + 7) / 8); + *bps = wavinfo.bitsPerSample; + + self->position = 0; + self->bps = wavinfo.bitsPerSample; + self->length = *samplesInFile * wavinfo.numberOfChannels; + + fgetpos(self->theFile, &self->dataChunkPos); + + return self; + +bail: + free(self); + return NULL; +} + +#ifdef SUPPORT_BWF +static void ReadBWF(WAVEFILEIN *self, WAVEIN_LOUDNESSINFO **wavInLoudness) +{ + *wavInLoudness = self->loudnessInfo; +} +#endif + +static int __ReadSample16(WAVEFILEIN *self, int *sample) +{ + size_t cnt; + short v = 0; + + cnt = fread(&v, 2, 1, self->theFile); + + if (cnt != 1) + { + return __TWI_ERROR; + } + + self->position += 1; + +#ifdef __TWI_BE + v = BigEndian16(v); +#endif + *sample = v; + return __TWI_SUCCESS; +} + +static int __ReadSample24(WAVEFILEIN *self, int *sample) +{ + size_t cnt; + int v = 0; + + cnt = fread(&v, 3, 1, self->theFile); + + if (cnt != 1) + { + return __TWI_ERROR; + } + + self->position += 1; + +#ifdef __TWI_BE + v = BigEndian32(v); +#endif + + if (v >= 0x800000) + { + v |= 0xff000000; + } + + *sample = v; + + return __TWI_SUCCESS; +} + +static int __ReadSample32(WAVEFILEIN *self, int *sample) +{ + size_t cnt; + int v = 0; + + cnt = fread(&v, 4, 1, self->theFile); + + if (cnt != 1) + { + return __TWI_ERROR; + } + + self->position += 1; + +#ifdef __TWI_BE + v = BigEndian32(v); +#endif + + *sample = v >> 8; + + return __TWI_SUCCESS; +} + +static int __ReadSampleInternal(WAVEFILEIN *self, int *sample, int scale) +{ + int err; + + if (!self) + { + return __TWI_ERROR; + } + + switch (scale) + { + + case 16: err = __ReadSample16(self, sample); break; + + case 24: err = __ReadSample24(self, sample); break; + + case 32: err = __ReadSample32(self, sample); break; + + default: err = __TWI_ERROR; break; + } + + return err; +} + +/* this function returns normalized values in the range +8388607..-8388608 */ +static int ReadWavInt(WAVEFILEIN *self, int sampleBuffer[], unsigned int nSamplesToRead, unsigned int *nSamplesRead) +{ + unsigned int i; + int err = __TWI_SUCCESS; + *nSamplesRead = 0; + + if (!sampleBuffer) + { + return __TWI_ERROR; + } + + /* check if we have enough samples left, if not, + set nSamplesToRead to number of samples left. */ + if (self->position + nSamplesToRead > self->length) + { + nSamplesToRead = self->length - self->position; + } + + for (i = 0; i < nSamplesToRead; i++) + { + + int tmp; + err = __ReadSampleInternal(self, &tmp, self->bps); + if (err != __TWI_SUCCESS) + { + return err; + } + sampleBuffer[i] = tmp; + *nSamplesRead += 1; + } + + return __TWI_SUCCESS; +} + +static int CloseWavIn(WAVEFILEIN *self) +{ + if (self) + { + if (self->theFile) + { + fclose(self->theFile); + } + } + free(self); + + return __TWI_SUCCESS; +} +/* +static int ResetWavIn(WAVEFILEIN* self) +{ + if (self) { + if (self->theFile) { + fsetpos(self->theFile, &self->dataChunkPos); + self->position = 0; + } + } + return __TWI_SUCCESS; +} +*/ +/*------------- local subs ----------------*/ + +static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ +#ifdef __TWI_LE + return fread(ptr, size, nmemb, stream); +#endif +#ifdef __TWI_BE + + unsigned char x[sizeof(int)]; + unsigned char *y = (unsigned char *)ptr; + int i; + int len; + + len = fread(x, size, nmemb, stream); + + for (i = 0; i < size * nmemb; i++) + { + *y++ = x[size * nmemb - i - 1]; + } + + return len; +#endif +} + +#ifdef __TWI_BE +static short BigEndian16(short v) +{ + short a = (v & 0x0ff); + short b = (v & 0x0ff00) >> 8; + + return a << 8 | b; +} + +static int BigEndian32(int v) +{ + int a = (v & 0x0ff); + int b = (v & 0x0ff00) >> 8; + int c = (v & 0x0ff0000) >> 16; + int d = (v & 0xff000000) >> 24; + + return a << 24 | b << 16 | c << 8 | d; +} +#endif + +#endif /* __TINYWAVEIN_C_H__ */ diff --git a/lc3plus/tinywaveout_c.h b/lc3plus/tinywaveout_c.h new file mode 100755 index 0000000000..323b09d51c --- /dev/null +++ b/lc3plus/tinywaveout_c.h @@ -0,0 +1,892 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + + + +#ifndef __TINYWAVEOUT_C_H__ +#define __TINYWAVEOUT_C_H__ + +/*#define TWO_SUPPORT_BWF*/ + +#include +#include +#include +#include +#ifdef TWO_SUPPORT_BWF +#include +#endif + +/***** Interface *********************************************************/ + +#ifndef TWO_UINT64 + #if !(defined(WIN32)) + #include + #define TWO_UINT64 uint64_t + #else + #define TWO_UINT64 unsigned __int64 + #endif +#endif + +typedef struct WAVEFILEOUT WAVEFILEOUT; +#ifdef TWO_SUPPORT_BWF +typedef struct WAVEOUT_LOUDNESSINFO WAVEOUT_LOUDNESSINFO; +#endif + +#define __TWO_SUCCESS (0) +#define __TWO_ERROR (-1) + +static WAVEFILEOUT* CreateWav( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps + ); + +#ifdef TWO_SUPPORT_BWF +static WAVEFILEOUT* CreateWavBWF( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps, + const WAVEOUT_LOUDNESSINFO *hBwfData + ); +#endif + +/* this function expects values in the 16 bit range +32767..-32768 */ +static int WriteWavShort( + WAVEFILEOUT* self, + short sampleBuffer[], + unsigned int nSamples + ); + +/* this function expects values in the 24 bit range +8388607..-8388608 */ +static int WriteWavLong( + WAVEFILEOUT* self, + int sampleBuffer[], + unsigned int nSamples + ); + +/* this function expects normalized values in the range +-1.0f */ +static int WriteWavFloat( + WAVEFILEOUT* self, + float sampleBuffer[], + unsigned int nSamples + ); + +static int CloseWav(WAVEFILEOUT* self); +#ifdef TWO_SUPPORT_BWF +static int CloseWavBWF(WAVEFILEOUT* self, WAVEOUT_LOUDNESSINFO bextData); +#endif + +/***** Implementation *********************************************************/ + +#if defined (__i386__) || defined (_M_IX86) || defined (_M_X64) || defined (__x86_64__) || defined (__arm__) || defined (__xtensa__) || defined (__aarch64__) || defined (__EMSCRIPTEN__) +#define __TWO_LE /* _T_iny _W_ave _O_ut _L_ittle _E_ndian */ +#endif + +#if defined (__POWERPC__) +#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ +#endif + +#if defined (__sparc__) +#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ +#endif + +#if ! defined (__TWO_LE) && ! defined (__TWO_BE) +#error unknown processor +#endif + +/*--- local types/structs ----------------------------------*/ + +#if defined(_MSC_VER) + #pragma pack(push, 1) +#else + #pragma pack(1) +#endif + + +#ifdef TWO_SUPPORT_BWF +struct WAVEOUT_LOUDNESSINFO { + float loudnessVal; + float loudnessRange; + float maxTruePeakLevel; + float maxMomentaryLoudnes; + float maxShortTermLoudness; +}; +#endif + + +typedef struct __tinyWaveOutHeader +{ + unsigned int riffType; /* 'RIFF/RF64' */ + unsigned int riffSize; /* file size/-1 */ + unsigned int waveType; /* 'WAVE' */ +} __tinyWaveOutHeader; + +typedef struct __tinyWaveOutDs64Chunk +{ + unsigned int formatType; /* = 'JUNK/ds64' */ + unsigned int formatSize; /* size info */ + TWO_UINT64 riffSize64; + TWO_UINT64 dataSize64; + TWO_UINT64 sampleCount64; + unsigned int tableLength; /* optional tables, always 0 for tinywaveout */ + /* here: optional tables */ +} __tinyWaveOutDs64Chunk; + +#ifdef TWO_SUPPORT_BWF +typedef struct __tinyWaveOutBextChunk +{ + unsigned int formatType; /* = 'bext' */ + unsigned int formatSize; /* size info */ + + unsigned char description[256]; + unsigned char originator[32]; + unsigned char originatorReference[32]; + unsigned char originatorDate[10]; /* ASCII: <> */ + unsigned char originationTime[8]; /* ASCII: <> */ + unsigned int timeReferenceLow; + unsigned int timeReferenceHigh; + unsigned short version; + unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ + + signed short loudnessVal; + signed short loudnessRange; + signed short maxTruePeakLevel; + signed short maxMomentaryLoudnes; + signed short maxShortTermLoudness; + + unsigned char Reserved[180]; + + unsigned char codingHistory; /* ASCII: <> - undefined length! */ + /* for variable length, mve this out of this struct */ +} __tinyWaveOutBextChunk; +#endif + +typedef struct __tinyWaveOutFmtChunk +{ + unsigned int formatType; + unsigned int formatSize; + + unsigned short formatTag; + unsigned short numChannels; + unsigned int sampleRate; + unsigned int bytesPerSecond; + unsigned short blockAlignment; + unsigned short bitsPerSample; + + /* wav fmt ext hdr here */ +} __tinyWaveOutFmtChunk; + +typedef struct __tinyWaveOutDataChunk +{ + unsigned int dataType; + unsigned int dataSize; + +} __tinyWaveOutDataChunk; + + +struct WAVEFILEOUT { + /* for reasons of memory alignment, have 64 bit data types first */ + TWO_UINT64 dataSize; + TWO_UINT64 dataSizeLimit; /* maximum size for data chunk for 4 GB files */ + TWO_UINT64 dataSizeLimit64; /* maximum size for data chunk for 2^64 B addressable files */ + TWO_UINT64 clipCount; + FILE* theFile; + unsigned int junkChunkOffset; + unsigned int fmtChunkOffset; +#ifdef TWO_SUPPORT_BWF + unsigned int bextChunkOffset; +#endif + unsigned int dataChunkOffset; + unsigned int bps; + + /* only needed for RF64: */ + unsigned int blockAlign; /* only needed for close() of ds64 chunk */ +}; + + +/*--- local protos --------------------------------------------------*/ +static __inline unsigned int BigEndian32(char, char, char, char); +static __inline unsigned int LittleEndian32(unsigned int); +static __inline unsigned int LittleEndian32s(int); +static __inline short LittleEndian16(short); +static __inline TWO_UINT64 LittleEndian64(TWO_UINT64); +#ifdef TWO_SUPPORT_BWF +static unsigned int EncodeLoudness(float); +#endif +static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ); + +#if defined(_MSC_VER) + #pragma pack(pop) +#else + #pragma pack() +#endif + + +#ifdef TWO_SUPPORT_BWF +static void setDefaultLoudness(WAVEOUT_LOUDNESSINFO *x) +{ + x->loudnessVal = 1.0f; + x->loudnessRange = 2.0f; + x->maxTruePeakLevel = 3.0f; + x->maxMomentaryLoudnes = 4.0f; + x->maxShortTermLoudness = 5.0f; +} +#endif + +static WAVEFILEOUT* __CreateWavInternal( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps +#ifdef TWO_SUPPORT_BWF + , + const WAVEOUT_LOUDNESSINFO *hBwfData +#endif + ) +{ + WAVEFILEOUT* self = NULL; + __tinyWaveOutHeader whdr; + __tinyWaveOutDs64Chunk ds64ch; +#ifdef TWO_SUPPORT_BWF + __tinyWaveOutBextChunk wbextch; +#endif + __tinyWaveOutFmtChunk wfch; + __tinyWaveOutDataChunk wdch; + unsigned int blockAlignment = 0; + unsigned int ByteCnt = 0; /* Byte counter for fwrite */ + + /* pseudo use to avoid unused symbols */ + (void)WriteWavShort; + (void)WriteWavLong; + (void)WriteWavFloat; +#ifdef TWI_SUPPORT_BWF + (void)CreateWavBWF; + (void)CloseWavBWF; + (void)setDefaultLoudness; +#endif + + /* param check */ + if (!fileName) goto bail; + if (sampleRate == 0) goto bail; + if (sampleRate > 768000) goto bail; + if (numChannels == 0) goto bail; + if (numChannels > 64) goto bail; + if (bps != 16 && bps != 24 && bps != 32) goto bail; + + self = (WAVEFILEOUT*)calloc(1, sizeof(WAVEFILEOUT)); + if (!self) goto bail; /* return NULL; */ + + self->theFile = fopen(fileName, "wb+"); + if (!self->theFile) goto bail; + + /* WAV-Header */ + whdr.riffType = BigEndian32('R','I','F','F'); + whdr.riffSize = LittleEndian32(0xffffffff); /* set to maximum, if fseek() doesn't work later */ + whdr.waveType = BigEndian32('W','A','V','E'); + /* write to file */ + ByteCnt = 0; + ByteCnt += fwrite(&whdr, 1, sizeof(whdr), self->theFile); + + /* ds64/JUNK-Chunk */ + ds64ch.formatType = BigEndian32('J','U','N','K'); + ds64ch.formatSize = LittleEndian32(sizeof(__tinyWaveOutDs64Chunk) - 8); + ds64ch.riffSize64 = (TWO_UINT64) -1; + ds64ch.dataSize64 = (TWO_UINT64) -1; + ds64ch.sampleCount64 = (TWO_UINT64) -1; + ds64ch.tableLength = 0; + self->junkChunkOffset = ByteCnt; + ByteCnt += fwrite(&ds64ch, 1, sizeof(ds64ch), self->theFile); + +#ifdef TWO_SUPPORT_BWF + /* BEXT-Chunk */ + if (hBwfData) { + memset(&wbextch, 0, sizeof(__tinyWaveOutBextChunk)); + wbextch.formatType = BigEndian32('b','e','x','t'); + wbextch.formatSize = LittleEndian32(sizeof(__tinyWaveOutBextChunk) - 8); + wbextch.version = 0x0002; + wbextch.loudnessVal = EncodeLoudness(hBwfData->loudnessVal); + wbextch.loudnessRange = EncodeLoudness(hBwfData->loudnessRange); + wbextch.maxTruePeakLevel = EncodeLoudness(hBwfData->maxTruePeakLevel); + wbextch.maxMomentaryLoudnes = EncodeLoudness(hBwfData->maxMomentaryLoudnes); + wbextch.maxShortTermLoudness = EncodeLoudness(hBwfData->maxShortTermLoudness); + /* t.b.d.: more values */ + + /* write to file */ + self->bextChunkOffset = ByteCnt; + ByteCnt += fwrite(&wbextch, 1, sizeof(wbextch), self->theFile); + } +#endif + + /* FMT-Chunk */ + wfch.formatType = BigEndian32('f','m','t',' '); + wfch.formatSize = LittleEndian32(16); + switch (bps) { + case 16: + case 24: + wfch.formatTag = LittleEndian16(0x0001); /* WAVE_FORMAT_PCM */ + break; + case 32: + wfch.formatTag = LittleEndian16(0x0003); /* WAVE_FORMAT_IEEE_FLOAT */ + break; + default: + goto bail; + } + self->bps = bps; + wfch.bitsPerSample = LittleEndian16(bps); + wfch.numChannels = LittleEndian16(numChannels); + blockAlignment = numChannels * (bps >> 3); + wfch.blockAlignment = LittleEndian16(blockAlignment); + wfch.sampleRate = LittleEndian32(sampleRate); + wfch.bytesPerSecond = LittleEndian32(sampleRate * blockAlignment); + /* tbd: wavfmt ext hdr here */ + /* write to file */ + self->fmtChunkOffset = ByteCnt; + ByteCnt += fwrite(&wfch, 1, sizeof(wfch), self->theFile); + + /* DATA-Chunk */ + self->dataChunkOffset = ByteCnt; + wdch.dataType = BigEndian32('d','a','t','a'); + wdch.dataSize = LittleEndian32(0xffffffff - ByteCnt); /* yet unknown. set to maximum of 4 GB file */ + /* write to file */ + ByteCnt += fwrite(&wdch, 1, sizeof(wdch), self->theFile); + + self->dataSize = 0; + + /* self->dataSizeLimit = 0x7fffffff - ByteCnt; */ /* maximum size for data chunk for 2 GB files */ + self->dataSizeLimit = 0xffffffff - ByteCnt; /* maximum size for data chunk for 4 GB files */ + self->dataSizeLimit64 = 0xffffffffffffffff - ByteCnt; /* maximum size for data chunk for 64 bit addressable files */ + + self->clipCount = 0; + self->blockAlign = blockAlignment; + + return self; + + bail: + if ( NULL != self) { + free(self); + } + + return NULL; +} + +static WAVEFILEOUT* CreateWav( + const char* fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps + ) +{ +#ifdef TWO_SUPPORT_BWF + return __CreateWavInternal(fileName, sampleRate, numChannels, bps, NULL); +#else + return __CreateWavInternal(fileName, sampleRate, numChannels, bps); +#endif +} + +#ifdef TWO_SUPPORT_BWF +static WAVEFILEOUT* CreateWavBWF( + const char *fileName, + const unsigned int sampleRate, + const unsigned int numChannels, + const unsigned int bps, + const WAVEOUT_LOUDNESSINFO *hBwfData + ) +{ + return __CreateWavInternal(fileName, sampleRate, numChannels, bps, hBwfData); +} +#endif + +#define MAX_PCM16 (+32767) +#define MIN_PCM16 (-32768) +static __inline int CLIP_PCM16(int sample, TWO_UINT64* clipcount) +{ + int tmp = sample; + + if (sample >= MAX_PCM16) { + tmp = MAX_PCM16; + (*clipcount)++; + } else { + if (sample <= MIN_PCM16) { + tmp = MIN_PCM16; + (*clipcount)++; + } + } + + return tmp; +} + +#define MAX_PCM24 (+8388607) +#define MIN_PCM24 (-8388608) +static __inline int CLIP_PCM24(int sample, TWO_UINT64* clipcount) +{ + int tmp = sample; + + if (sample >= MAX_PCM24) { + tmp = MAX_PCM24; + (*clipcount)++; + } else { + if (sample <= MIN_PCM24) { + tmp = MIN_PCM24; + (*clipcount)++; + } + } + + return tmp; +} + +#define MAX_FLOAT32 (+1.0f) +#define MIN_FLOAT32 (-1.0f) +static __inline float CLIP_FLOAT32(float sample, TWO_UINT64* clipcount) +{ + float tmp = sample; + + if (sample >= MAX_FLOAT32) { + tmp = MAX_FLOAT32; + (*clipcount)++; + } else { + if (sample <= MIN_FLOAT32) { + tmp = MIN_FLOAT32; + (*clipcount)++; + } + } + + return tmp; +} + + + +static int __WriteSample16( + WAVEFILEOUT* self, + int sample, + int scale + ) +{ + size_t cnt; + short v; + + if ((scale - 16) > 0) + sample = sample >> (scale - 16); + else + sample = (int) ((uint32_t) sample << (16 - scale)); + + v = (short)CLIP_PCM16(sample, &(self->clipCount)); +#ifdef __TWO_BE + v = LittleEndian16(v); +#endif + + cnt = fwrite(&v, sizeof(short), 1, self->theFile); + + if (cnt == 1) { + self->dataSize += 2; + return __TWO_SUCCESS; + } + + return __TWO_ERROR; +} + + +static int __WriteSample24( + WAVEFILEOUT* self, + int sample, + int scale + ) +{ + size_t cnt; + int v; + + if ((scale - 24) > 0) + sample = sample >> (scale - 24); + else + sample = (int) (((unsigned int)sample) << (24 - scale)); + + v = (int)CLIP_PCM24(sample, &(self->clipCount)); +#ifdef __TWO_BE + v = LittleEndian32s(v); +#endif + cnt = fwrite(&v, 3, 1, self->theFile); + + if (cnt == 1) { + self->dataSize += 3; + return __TWO_SUCCESS; + } + + return __TWO_ERROR; +} + + +static int __WriteSample32( + WAVEFILEOUT* self, + float sample + ) +{ + size_t cnt; + union fl_int { + float v_float; + int v_int; + }; + union fl_int v; + +#if CLIP_FLOAT + v.v_float = CLIP_FLOAT32(sample, &(self->clipCount)); +#else + v.v_float = sample; + if((sample > 1.0f) || (sample <-1.0f)) + self->clipCount++; +#endif + +#ifdef __TWO_BE + v.v_int = LittleEndian32s(v.v_int); +#endif + cnt = fwrite(&v, 4, 1, self->theFile); + + if (cnt == 1) { + self->dataSize += 4; + return __TWO_SUCCESS; + } + + return __TWO_ERROR; +} + + +static int __WriteSampleInt( + WAVEFILEOUT* self, + int sample, + int scale + ) +{ + int err; + + if (!self) return __TWO_ERROR; + + + switch (self->bps) { + + case 16: + err = __WriteSample16(self, sample, scale); + break; + + case 24: + err = __WriteSample24(self, sample, scale); + break; + + default: + err = __TWO_ERROR; + break; + } + + return err; +} + + +/* this function expects values in the 16 bit range +-32767/8 */ +static int WriteWavShort( + WAVEFILEOUT* self, + short sampleBuffer[], + unsigned int nSamples + ) +{ + unsigned long i; + int err = __TWO_SUCCESS; + + if (!self) return __TWO_ERROR; + if (!sampleBuffer) return __TWO_ERROR; + if (__dataSizeChk(self, nSamples * sizeof(short))) return __TWO_ERROR; + + for (i=0; i< nSamples; i++) { + if (self->bps == 32) + { + err = __WriteSample32(self, sampleBuffer[i] / 32768.0f); + } + else + { + err = __WriteSampleInt(self, (int)sampleBuffer[i], 16); + } + if (err != __TWO_SUCCESS) return err; + } + + return __TWO_SUCCESS; +} + + +/* this function expects values in the 24 bit range +-8388607/8 */ +static int WriteWavLong( + WAVEFILEOUT* self, + int sampleBuffer[], + unsigned int nSamples + ) +{ + unsigned long i; + int err = __TWO_SUCCESS; + + if (!self) return __TWO_ERROR; + if (!sampleBuffer) return __TWO_ERROR; + if (__dataSizeChk(self, nSamples * sizeof(int))) return __TWO_ERROR; + + for (i = 0; i < nSamples; i++) { + if (self->bps == 32) + { + err = __WriteSample32(self, sampleBuffer[i] / 8388608.0f); + } + else + { + err = __WriteSampleInt(self, sampleBuffer[i], 24); + } + if (err != __TWO_SUCCESS) return err; + } + + return __TWO_SUCCESS; +} + + +/* this function expects normalized values in the range +-1.0 */ +#define MAX_FL (+2.0f * 8388608.0f ) +#define MIN_FL (-2.0f * 8388608.0f ) +#define CLIP_FL(x) ( ((x) >= MAX_FL) ? MAX_FL : (((x) <= MIN_FL) ? MIN_FL : (x)) ) +static int WriteWavFloat( + WAVEFILEOUT* self, + float sampleBuffer[], + unsigned int nSamples + ) +{ + unsigned int i; + int err = __TWO_SUCCESS; + + if (!self) return __TWO_ERROR; + if (!sampleBuffer) return __TWO_ERROR; + if (__dataSizeChk(self, nSamples * sizeof(float))) return __TWO_ERROR; + + for (i=0; ibps == 32) + { + err = __WriteSample32(self, sampleBuffer[i]); + } + else + { + float tmp = CLIP_FL(sampleBuffer[i] * 8388608.0f); /* CLIP_FL is just to avoid an INT overrun before the actual cast to int, real clipping and counting is done below */ + err = __WriteSampleInt(self, (int) tmp, 24); + } + if (err != __TWO_SUCCESS) return err; + } + + return __TWO_SUCCESS; +} + + +static int CloseWav(WAVEFILEOUT* self) +{ + unsigned int riffSize_le = 0; + unsigned int dataSize_le = 0; + TWO_UINT64 riffSize64 = 0; + TWO_UINT64 dataSize64 = 0; + TWO_UINT64 sampleCount64 = 0; /* nr of samples in the WAVE sense: 1 sample are all pcm samples of all channels of one time slice */ + int mustWriteRF64 = 0; + + if (!self) return __TWO_ERROR; + + /* check for 4 GB (switch to RF64) */ + if ( self->dataSize > self->dataSizeLimit ) { + /* when we exceed 4 GB: switch from std wave header to RF64 header */ + mustWriteRF64 = 1; + } + + /* calc header values */ + if (mustWriteRF64 == 0) { + /* write padding byte if dataSize is uneven */ + int pad = 0; + if (self->dataSize % 2 > 0) { + char tmp= 0x00; + fwrite(&tmp, sizeof(char), 1, self->theFile); + pad = 1; + } + riffSize_le = LittleEndian32(self->dataChunkOffset - 8 + 8 + (unsigned int)self->dataSize + pad); /* sizeof(hdr) - (8 bytes of riff chunk header) + (8 bytes data chunk header) + sizeof(raw-pcm-data) + padding Byte */ + dataSize_le = LittleEndian32((unsigned int)self->dataSize); + } else { + riffSize_le = 0xffffffff; + dataSize_le = 0xffffffff; + riffSize64 = LittleEndian64( self->dataSize + (TWO_UINT64)self->dataChunkOffset ); + dataSize64 = LittleEndian64( self->dataSize ); + sampleCount64 = LittleEndian64( self->dataSize / (TWO_UINT64)self->blockAlign ); + } + + /* now overwrite length/size values in header with the actual/real ones */ + if (mustWriteRF64 == 0) { + /* riffsize32 */ + fseek(self->theFile, 4, SEEK_SET); + fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); + /* datasize32 */ + fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); + fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); + } else { + unsigned int rf64sig = BigEndian32('R','F','6','4'); + unsigned int ds64sig = BigEndian32('d','s','6','4'); + + /* replace RIFF->RF64 */ + fseek(self->theFile, 0, SEEK_SET); + fwrite(&rf64sig, sizeof(rf64sig), 1, self->theFile); + + /* riffsize32 */ + fseek(self->theFile, 4, SEEK_SET); + fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); + + /* replace JUNK->ds64 */ + fseek(self->theFile, self->junkChunkOffset, SEEK_SET); + fwrite(&ds64sig, sizeof(ds64sig), 1, self->theFile); + + /* riffSize64, dataSize64, sampleCount64 */ + fseek(self->theFile, self->junkChunkOffset + 8, SEEK_SET); + fwrite(&riffSize64, sizeof(riffSize64), 1, self->theFile); + fwrite(&dataSize64, sizeof(dataSize64), 1, self->theFile); + fwrite(&sampleCount64, sizeof(sampleCount64), 1, self->theFile); + + /* datasize32 */ + fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); + fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); + } + + fclose(self->theFile); + free(self); + + return __TWO_SUCCESS; +} + +#ifdef TWO_SUPPORT_BWF +static int CloseWavBWF( + WAVEFILEOUT* self, + WAVEOUT_LOUDNESSINFO bextData + ) +{ + int wordData; + + if (!self) return __TWO_ERROR; + + if (self->bextChunkOffset) { + /* Offset for Loudness Data in bext-chunk: 8: Chunk-Header, 412:prev.Data */ + fseek(self->theFile, self->bextChunkOffset+8+412, SEEK_SET); + + wordData = LittleEndian32(EncodeLoudness(bextData.loudnessVal)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.loudnessRange)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.maxTruePeakLevel)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.maxMomentaryLoudnes)); + fwrite(&wordData, 2, 1, self->theFile); + + wordData = LittleEndian32(EncodeLoudness(bextData.maxShortTermLoudness)); + fwrite(&wordData, 2, 1, self->theFile); + } + + return CloseWav(self); +} +#endif + +/*------------- local subs ----------------*/ + +static __inline unsigned int BigEndian32(char a, char b, char c, char d) +{ +#ifdef __TWO_LE + return + (unsigned int) d << 24 | + (unsigned int) c << 16 | + (unsigned int) b << 8 | + (unsigned int) a ; +#else + return + (unsigned int) a << 24 | + (unsigned int) b << 16 | + (unsigned int) c << 8 | + (unsigned int) d ; +#endif +} + + +static __inline unsigned int LittleEndian32(unsigned int v) +{ +#ifdef __TWO_LE + return v; +#else + return + (v & 0x000000FF) << 24 | + (v & 0x0000FF00) << 8 | + (v & 0x00FF0000) >> 8 | + (v & 0xFF000000) >> 24 ; +#endif +} + + +/* signed version of the above */ +static __inline unsigned int LittleEndian32s(int v) +{ +#ifdef __TWO_LE + return v; +#else + return + (v & 0x000000FF) << 24 | + (v & 0x0000FF00) << 8 | + (v & 0x00FF0000) >> 8 | + (v & 0xFF000000) >> 24 ; +#endif +} + + +static __inline short LittleEndian16(short v) +{ +#ifdef __TWO_LE + return v; +#else + return ((v << 8) & 0xFF00) | ((v >> 8) & 0x00FF); +#endif +} + +static __inline TWO_UINT64 LittleEndian64(TWO_UINT64 v) +{ +#ifdef __TWO_LE + return v; +#else + return + (v & 0x00000000000000FF) << 56 | + (v & 0x000000000000FF00) << 40 | + (v & 0x0000000000FF0000) << 24 | + (v & 0x00000000FF000000) << 8 | + (v & 0x000000FF00000000) >> 8 | + (v & 0x0000FF0000000000) >> 24 | + (v & 0x00FF000000000000) >> 40 | + (v & 0xFF00000000000000) >> 56 ; +#endif +} + +#ifdef TWO_SUPPORT_BWF +static unsigned int EncodeLoudness(float x) +{ + int s = (x>0)-(x<0); + return (int)( x*100.0f + s*0.5f ); +} +#endif + +static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ) +{ + if (!self) return __TWO_ERROR; + + if ( (self->dataSize + ((TWO_UINT64)newbytes) ) > self->dataSizeLimit64 ) { + return __TWO_ERROR; + } + + return __TWO_SUCCESS; +} + +#endif /* __TINYWAVEOUT_C_H__ */ + + + diff --git a/lc3plus/tns_coder.c b/lc3plus/tns_coder.c new file mode 100755 index 0000000000..ff3883d2b5 --- /dev/null +++ b/lc3plus/tns_coder.c @@ -0,0 +1,374 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); +static void levdown(LC3_FLOAT* anxt, LC3_FLOAT* out_a, LC3_INT* len); +static void poly2rc(LC3_FLOAT* a, LC3_FLOAT* out, LC3_INT len); +static LC3_INT findRC_idx(const LC3_FLOAT* in1, const LC3_FLOAT* in2, LC3_FLOAT checkValue); + +void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen) +{ + LC3_INT i = 0, m = 0; + LC3_FLOAT sum = 0, tmp_buf[MAX_LEN] = {0}; + + for (m = -lag; m <= lag; m++) { + /* Append zeros and input vector */ + + zero_float(tmp_buf, abs(m)); + + move_float(&tmp_buf[abs(m)], in, inLen - abs(m)); + + /* Calculate sum */ + sum = 0; + + for (i = 0; i < inLen; i++) { + sum += in[i] * tmp_buf[i]; + } + + out[m + lag] = sum; + } +} + +void levinsonDurbin(LC3_FLOAT* r, LC3_FLOAT* out_lev, LC3_FLOAT* rc_unq, LC3_FLOAT* error, LC3_INT len) +{ + LC3_INT t = 0, i = 0, j = 0; + LC3_FLOAT g = 0, v = 0, sum = 0, buf_tmp[MAX_LEN] = {0}; + + g = r[1] / r[0]; + out_lev[0] = g; + + v = (1.0 - g * g) * r[0]; + rc_unq[0] = -g; + + for (t = 1; t < len; t++) { + zero_float(buf_tmp, len + 1); + + sum = 0; + for (i = 1; i <= t; i++) { + sum += out_lev[i - 1] * r[i]; + } + + g = (r[t + 1] - sum) / v; + + j = 1; + for (i = t - 1; i >= 0; i--) { + buf_tmp[j] = out_lev[j - 1] - g * out_lev[i]; + j++; + } + + move_float(&out_lev[1], &buf_tmp[1], len); + + out_lev[0] = g; + + v = v * (1 - g * g); + rc_unq[t] = -g; + } + + /* Reorder out_lev */ + out_lev[0] = 1; + j = 1; + for (i = len - 1; i >= 0; i--) { + buf_tmp[j] = -out_lev[i]; + j++; + } + + move_float(&out_lev[1], &buf_tmp[1], (len - 1)); + + out_lev[len] = rc_unq[len - 1]; + + *error = v; +} + +void levdown(LC3_FLOAT* anxt, LC3_FLOAT* out_a, LC3_INT* len) +{ + LC3_INT i = 0, j = 0; + LC3_FLOAT tmp_buf[8] = {0}, tmp_buf1[8] = {0}, tmp_buf2[8] = {0}, knxt = 0; + + /* Initial length = 9 */ + + /* Drop the leading 1 */ + + move_float(&tmp_buf[0], &anxt[1], (*len - 1)); + + *len = *len - 1; /* Lenght = 8 */ + + /* Last coefficient */ + knxt = tmp_buf[*len - 1]; /* At [7] */ + + *len = *len - 1; /* Lenght = 7 */ + + move_float(tmp_buf1, tmp_buf, *len); + + j = 0; + for (i = *len - 1; i >= 0; i--) { + tmp_buf2[j] = knxt * tmp_buf[i]; + j++; + } + + out_a[0] = 1; + for (i = 0; i < *len; i++) { + out_a[i + 1] = (tmp_buf1[i] - tmp_buf2[i]) / (1.0 - (LC3_FABS(knxt)) * (LC3_FABS(knxt))); + } + + *len = *len + 1; /* Length = 8 */ +} + +void poly2rc(LC3_FLOAT* a, LC3_FLOAT* out, LC3_INT len) +{ + LC3_INT k = 0, i = 0, len_old = 0; + LC3_FLOAT buf[9] = {0}; + + len_old = len; + + zero_float(out, len - 1); + + /* Length = 9 */ + + /* Normalize */ + for (i = 0; i < len; i++) { + a[i] = a[i] / a[0]; + } + + out[len - 1] = a[len - 1]; + + /* Process */ + for (k = len - 2; k >= 0; k--) { + levdown(a, buf, &len); + out[k] = buf[len - 1]; /* Store last value */ + + move_float(a, buf, len); + } + + /* Shift output array by one to the left to lose leading 1 */ + for (i = 0; i < len_old - 1; i++) { + out[i] = out[i + 1]; + } +} + +LC3_INT findRC_idx(const LC3_FLOAT* in1, const LC3_FLOAT* in2, LC3_FLOAT checkValue) +{ + LC3_INT i = 0, ret = 0; + + for (i = 0; i < 17; i++) { + if (checkValue <= in1[i] && checkValue > in2[i]) { + ret = i; + } + } + + return ret; +} + +void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, LC3_INT fs, LC3_INT N, LC3_INT frame_dms, LC3_INT nBits, + LC3_INT* order_out, LC3_INT* rc_idx, LC3_INT* tns_numfilters, LC3_INT* bits_out + , LC3_INT16 near_nyquist_flag +) +{ + LC3_INT i = 0, stopfreq[2] = {0}, startfreq[2] = {0}, f = 0, numfilters = 0, maxOrder = 0, bits = 0, sub = 0, + subdiv_startfreq = 0, subdiv_stopfreq = 0, j = 0, rc_idx_tmp[8] = {0}, order_tmp[8] = {0}, tmp = 0, tns = 0; + LC3_FLOAT minPGfac = 0, minPredictionGain = 0, maxPG = 0, xcorr_out[MAX_LEN] = {0}, buf_tmp[MAX_LEN] = {0}, sum = 0, + subdiv_len = 0, nSubdivisions = 0, r[9] = {0}, out_lev[9] = {0}, rc_unq[9] = {0}, error_lev = 0, predGain = 0, + alpha = 0, rc[8] = {0}, st[9] = {0}, s = 0, tmpSave = 0, tmp_fl = 0; + const LC3_INT* order; + + /* Init */ + + if (fs >= 32000 && frame_dms >= 50) { + numfilters = 2; + } else { + numfilters = 1; + } + + if (N > 40 * ((LC3_FLOAT) (frame_dms) / 10.0)) { + N = 40 * ((LC3_FLOAT) (frame_dms) / 10.0); + fs = 40000; + } + + if (numfilters == 1) { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + stopfreq[0] = N; + } else { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + startfreq[1] = N / 2 + 1; + stopfreq[0] = N / 2; + stopfreq[1] = N; + } + + switch (frame_dms) + { + case 25: + maxOrder = 4; + nSubdivisions = 2.0; + break; + case 50: + maxOrder = 4; + nSubdivisions = 2.0; + break; + case 100: + maxOrder = 8; + nSubdivisions = 3.0; + break; + } + + minPGfac = 0.85; + maxPG = 2; + minPredictionGain = 1.5; + + if ((frame_dms >= 50 && nBits >= 48 * ((LC3_FLOAT) frame_dms / 10.0)) || frame_dms == 25) { + maxPG = minPredictionGain; + } + + if ((frame_dms >= 50 && nBits >= 48 * ((LC3_FLOAT) frame_dms / 10.0)) || frame_dms == 25) { + order = order1_tns; + } else { + order = order2_tns; + } + + /* Processing */ + if (bw_cutoff_idx >= 3 && numfilters == 2) { + numfilters = 2; + startfreq[1] = bw_fcbin / 2 + 1; + stopfreq[0] = bw_fcbin / 2; + stopfreq[1] = bw_fcbin; + } else { + numfilters = 1; + stopfreq[0] = bw_fcbin; + } + + bits = 0; + + for (f = 0; f < numfilters; f++) { + subdiv_len = ((LC3_FLOAT)stopfreq[f] + 1.0 - (LC3_FLOAT)startfreq[f]) / nSubdivisions; + + zero_float(r, 9); + + for (sub = 1; sub <= nSubdivisions; sub++) { + subdiv_startfreq = floor(subdiv_len * (sub - 1)) + startfreq[f] - 1; + subdiv_stopfreq = floor(subdiv_len * sub) + startfreq[f] - 1; + + sum = 0; + for (i = subdiv_startfreq; i < subdiv_stopfreq; i++) { + sum += x[i] * x[i]; + } + + if (sum < LC3_EPS) + { + zero_float(r, 9); + r[0] = 1; + break; + } + + move_float(buf_tmp, &x[subdiv_startfreq], subdiv_stopfreq - subdiv_startfreq); + + xcorr(buf_tmp, xcorr_out, maxOrder, subdiv_stopfreq - subdiv_startfreq); + + j = 0; + for (i = maxOrder; i >= 0; i--) { + r[j] = r[j] + xcorr_out[i] / sum; + j++; + } + } + + for (i = 0; i <= maxOrder; i++) { + r[i] = r[i] * lagw_tns[i]; + } + + levinsonDurbin(r, out_lev, rc_unq, &error_lev, maxOrder); + + predGain = r[0] / error_lev; + + if (predGain > minPredictionGain && near_nyquist_flag == 0) { + tns = 1; + } else { + tns = 0; + } + + bits++; + + if (tns == 1) { + /* LPC weighting */ + if (predGain < maxPG) { + alpha = (maxPG - predGain) * (minPGfac - 1.0) / (maxPG - minPredictionGain) + 1.0; + + for (i = 0; i <= maxOrder; i++) { + out_lev[i] = out_lev[i] * LC3_POW(alpha, i); + } + + poly2rc(out_lev, rc_unq, maxOrder + 1); + } + + /* PARCOR Quantization */ + for (i = 0; i < maxOrder; i++) { + rc_idx_tmp[i] = findRC_idx(&quants_thr_tns[1], &quants_thr_tns[0], rc_unq[i]); + } + + /* Filter Order */ + j = 0; + for (i = 0; i < maxOrder; i++) { + rc[i] = quants_pts_tns[rc_idx_tmp[i]]; + + if (rc[i] != 0) { + order_tmp[j] = i + 1; + j++; + } + } + + order_out[f] = order_tmp[j - 1]; + // Disable TNS if order is 0: + if (order_out[f] == 0) { + tns = 0; + + // Jump to else statement + goto tns_disabled; + } + tmp = order[order_out[f] - 1]; + + /* Huffman Coding of PARCOR coefficients */ + for (i = 0; i <= order_out[f] - 1; i++) { + tmp += huff_bits_tns[i][rc_idx_tmp[i]]; + } + + bits = bits + ceil((LC3_FLOAT)tmp / 2048.0); + + j = 0; + for (i = f * 8; i <= f * 8 + order_out[f] - 1; i++) { + rc_idx[i] = rc_idx_tmp[j]; + j++; + } + } + + /* Filtering */ + if (tns == 1) { + for (i = startfreq[f]; i <= stopfreq[f]; i++) { + s = x[i - 1]; + tmpSave = s; + + for (j = 0; j < order_out[f] - 1; j++) { + tmp_fl = rc[j] * s + st[j]; + s += rc[j] * st[j]; + + st[j] = tmpSave; + tmpSave = tmp_fl; + } + + s += rc[order_out[f] - 1] * st[order_out[f] - 1]; + + st[order_out[f] - 1] = tmpSave; + x[i - 1] = s; + } + } + } +tns_disabled: + + *tns_numfilters = numfilters; + *bits_out = bits; +} diff --git a/lc3plus/tns_decoder.c b/lc3plus/tns_decoder.c new file mode 100755 index 0000000000..d3aeefc3a3 --- /dev/null +++ b/lc3plus/tns_decoder.c @@ -0,0 +1,52 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#include "options.h" +#include "functions.h" + +void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) +{ + LC3_INT startfreq[2] = {0}, stopfreq[2] = {0}, f = 0, i = 0, j = 0, m = 0, l = 0, rc_idx_f[9] = {0}; + LC3_FLOAT rc[9] = {0}, s = 0, st[9] = {0}; + + if (numfilters == 2) { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + stopfreq[0] = bw_fcbin / 2; + startfreq[1] = bw_fcbin / 2 + 1; + stopfreq[1] = bw_fcbin; + } else { + startfreq[0] = floor(600 * N * 2 / fs) + 1; + stopfreq[0] = bw_fcbin; + } + + for (f = 0; f < numfilters; f++) { + if (order[f] > 0) { + j = 0; + + for (i = f * 8; i < f * 8 + 8; i++) { + rc_idx_f[j] = rc_idx[i]; + rc[j] = quants_pts_tns[rc_idx_f[j]]; + j++; + } + + for (m = startfreq[f]; m <= stopfreq[f]; m++) { + s = x[m - 1] - rc[order[f] - 1] * st[order[f] - 1]; + + for (l = order[f] - 2; l >= 0; l--) { + s = s - rc[l] * st[l]; + st[l + 1] = rc[l] * s + st[l]; + } + + st[0] = s; + x[m - 1] = s; + } + } + } +} diff --git a/lc3plus/util.h b/lc3plus/util.h new file mode 100755 index 0000000000..7ef6dedef7 --- /dev/null +++ b/lc3plus/util.h @@ -0,0 +1,222 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * +* Low Complexity Communication Codec Plus (LC3plus) * +* * +* Copyright licence is solely granted through ETSI Intellectual Property * +* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * +* estoppel or otherwise. * +******************************************************************************/ + + +#ifndef UTIL_H +#define UTIL_H + +#include "clib.h" +#include "math.h" + +#ifdef _MSC_VER +/* strcasecmp is not available on visual studio */ +static LC3_INT strcasecmp(const char* a, const char* b) { + return _stricmp(a,b); +} +#endif + +/* restrict is not available on visual studio */ +#ifdef _MSC_VER +#define restrict __restrict +/* inline is not recognized in visual studio 13 required by matlab r2015a in win10 */ +#define inline __inline +#endif + +/* number of elements in array */ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +/* min max with no side effects */ +static inline LC3_INT imin(LC3_INT a, LC3_INT b) { return a < b ? a : b; } +static inline LC3_INT imax(LC3_INT a, LC3_INT b) { return a > b ? a : b; } + +/* restrict x to range [min, max] */ +static inline LC3_INT iclamp(LC3_INT min, LC3_INT x, LC3_INT max) { + return x < min ? min : x > max ? max : x; +} +static inline double fcmamp(double min, double x, double max) { + return x < min ? min : x > max ? max : x; +} +static inline LC3_FLOAT fclampf(LC3_FLOAT min, LC3_FLOAT x, LC3_FLOAT max) { + return x < min ? min : x > max ? max : x; +} + +/* x² */ +static inline LC3_FLOAT sqrf(LC3_FLOAT x) { return x * x; } + +/* convenience wrappers around memmove */ +static inline void move_float(LC3_FLOAT *dst, const LC3_FLOAT *src, LC3_INT len) { + memmove(dst, src, len * sizeof(LC3_FLOAT)); +} +static inline void move_int(LC3_INT *dst, const LC3_INT *src, LC3_INT len) { + memmove(dst, src, len * sizeof(LC3_INT)); +} + +/* convenience wrappers around memset */ +static inline void zero_float(LC3_FLOAT *x, LC3_INT len) { + memset(x, 0, len * sizeof(LC3_FLOAT)); +} +static inline void zero_int(LC3_INT *x, LC3_INT len) { + memset(x, 0, len * sizeof(LC3_INT)); +} + +/* multiply float vectors element by element, in-place */ +static inline void mult_vec(LC3_FLOAT *a, const LC3_FLOAT *b, + LC3_INT len) { + LC3_INT i = 0; + for (i = 0; i < len; i++) { + a[i] *= b[i]; + } +} + +/* multiply float vector with constant, in-place */ +static inline void mult_const(LC3_FLOAT *a, LC3_FLOAT b, LC3_INT len) { + LC3_INT i = 0; + for (i = 0; i < len; i++) { + a[i] *= b; + } +} + +/* sum of vector */ +static inline LC3_FLOAT sum_vec(const LC3_FLOAT *x, LC3_INT len) { + LC3_FLOAT sum = 0; + LC3_INT i = 0; + for (i = 0; i < len; i++) { + sum += x[i]; + } + return sum; +} + +/* complex constructor */ +static inline Complex cmplx(LC3_FLOAT r, LC3_FLOAT i) { return (Complex){r, i}; } + +/* complex a + b */ +static inline Complex cadd(Complex a, Complex b) { + return cmplx(a.r + b.r, a.i + b.i); +} + +/* complex a * b */ +static inline Complex cmul(Complex a, Complex b) { + return cmplx(a.r * b.r - a.i * b.i, a.i * b.r + a.r * b.i); +} + +/* mac operator */ +static inline LC3_FLOAT mac_loop(const LC3_FLOAT *array1, const LC3_FLOAT *array2, LC3_INT len) +{ + LC3_INT i; + LC3_FLOAT sum = 0.0; + + for (i = 0; i < len; i++) + { + sum += (*array1++) * (*array2++); + } + + return sum; +} + +/* complex eᶦˣ */ +static inline Complex cexpi(LC3_FLOAT x) { return cmplx(LC3_COS(x), LC3_SIN(x)); } + +/* complex -x */ +static inline Complex cneg(Complex x) { return cmplx(-x.r, -x.i); } + +/* convert string to number. return true on success */ +static inline bool str_to_int(const char *str, LC3_INT *value) { + char *end = NULL; + long v = str ? strtol(str, &end, 0) : 0; + *value = (LC3_INT)v; + return str && *end == 0 && v >= INT_MIN && v <= INT_MAX; +} + +/* returns true if str ends with str ends with suffix. ignoring case. str may be + * NULL */ +static inline bool str_ends_with(const char *str, const char *suffix) { + char *tmp = str ? strrchr(str, suffix[0]) : NULL; + return tmp && !strcasecmp(tmp, suffix); +} + +/* complex a - b */ +static inline Complex csub(Complex a, Complex b) { + return cmplx(a.r - b.r, a.i - b.i); +} + +static inline void move_cmplx(Complex *dst, const Complex *src, LC3_INT32 len) { + if (len > 0) { + memmove(dst, src, len * sizeof(Complex)); + assert(src[len - 1].r == dst[len - 1].r && src[len - 1].i == dst[len - 1].i); /*check that Cmplx is stored contiguously*/ + assert(src[0].r == dst[0].r && src[0].i == dst[0].i); /*check that Cmplx is stored contiguously*/ + } +} + +static inline void zero_cmplx(Complex *x, LC3_INT32 len) { + if(len > 0) { + memset(x, 0, len * sizeof(Complex)); + assert(x[0].r == 0 && x[0].i == 0 && x[len-1].r == 0 && x[len-1].i == 0); + } +} + +static inline Complex realtoc(LC3_FLOAT r) { return cmplx(r, 0); } + +/* set float vector to constant */ +static inline void set_vec(const LC3_FLOAT c, LC3_FLOAT *x, LC3_INT32 len) { + LC3_INT32 i = 0; + for (i = 0; i < len; i++) { + x[i] = c; + } +} + +/* set float vector to constant */ +static inline void set_vec_int(const LC3_INT32 c, LC3_INT32 *x, LC3_INT32 len) { + LC3_INT32 i = 0; + for (i = 0; i < len; i++) { + x[i] = c; + } +} + +static inline LC3_INT32 clz_func(LC3_INT32 inp) +{ +#if defined(__clang__) || defined(__GNUC__) + if (inp == 0) + { + return 0; + } + return __builtin_clz(inp); + +#elif defined(_WIN32) || defined(_WIN64) + LC3_INT32 leading_zero = 0; + + if (_BitScanReverse(&leading_zero, inp)) + { + return 31 - leading_zero; + } + else + return 0; + +#else + LC3_INT32 i = 0; + int64_t x = inp; + + if (inp == 0) + { + return 0; + } + + inp = (inp < 0) ? ~inp : inp; + + while (x < (int64_t)0x80000000L) + { + inp <<= 1; + i += 1; + } + + return i; +#endif +} + + +#endif diff --git a/lib_rend/ivas_lc3plus_common.c b/lib_rend/ivas_lc3plus_common.c index 3b12f78be5..1f0dea1043 100644 --- a/lib_rend/ivas_lc3plus_common.c +++ b/lib_rend/ivas_lc3plus_common.c @@ -32,7 +32,7 @@ #include "ivas_lc3plus_common.h" #include "ivas_error.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ) { diff --git a/lib_rend/ivas_lc3plus_common.h b/lib_rend/ivas_lc3plus_common.h index 01971679d2..eae0a5396b 100644 --- a/lib_rend/ivas_lc3plus_common.h +++ b/lib_rend/ivas_lc3plus_common.h @@ -34,7 +34,7 @@ #include #include "ivas_error.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" /*! common configuration parameters between encoder and decoder */ typedef struct LC3PLUS_CONFIG diff --git a/lib_rend/ivas_lc3plus_dec.c b/lib_rend/ivas_lc3plus_dec.c index f81d7fd176..45d56d3c63 100644 --- a/lib_rend/ivas_lc3plus_dec.c +++ b/lib_rend/ivas_lc3plus_dec.c @@ -34,7 +34,7 @@ #include "ivas_prot.h" #include "ivas_lc3plus_dec.h" #include "ivas_lc3plus_common.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error_utils.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h index 38abf70bd6..f834f4dcd8 100644 --- a/lib_rend/ivas_lc3plus_dec.h +++ b/lib_rend/ivas_lc3plus_dec.h @@ -33,7 +33,7 @@ #pragma once #include -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error.h" #include "ivas_lc3plus_common.h" #include "ivas_cnst.h" diff --git a/lib_rend/ivas_lc3plus_enc.c b/lib_rend/ivas_lc3plus_enc.c index 758299c067..1b655c6ce9 100644 --- a/lib_rend/ivas_lc3plus_enc.c +++ b/lib_rend/ivas_lc3plus_enc.c @@ -32,7 +32,7 @@ #include "ivas_lc3plus_enc.h" #include "ivas_lc3plus_common.h" -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error_utils.h" #include "prot.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_lc3plus_enc.h b/lib_rend/ivas_lc3plus_enc.h index e1edd9016c..1eea994a7e 100644 --- a/lib_rend/ivas_lc3plus_enc.h +++ b/lib_rend/ivas_lc3plus_enc.h @@ -33,7 +33,7 @@ #pragma once #include -#include "lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.h" +#include "lc3.h" #include "ivas_error.h" #include "ivas_lc3plus_common.h" diff --git a/lib_rend/lc3plus_codec/.gitignore b/lib_rend/lc3plus_codec/.gitignore deleted file mode 100644 index 5514f3a7bc..0000000000 --- a/lib_rend/lc3plus_codec/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228 -package.info -lc3plus_sources.zip \ No newline at end of file diff --git a/lib_rend/lc3plus_codec/README.md b/lib_rend/lc3plus_codec/README.md deleted file mode 100644 index 4dc05171ab..0000000000 --- a/lib_rend/lc3plus_codec/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Download and unzip LC3plus - -1. Download the V1.4.1 version of the LC3plus source code from ETSI: https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip -2. Unzip it into this folder. After unzipping, the path to the `Readme.txt` of the LC3plus sources must be: `lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/Readme.txt` -3. Apply the `lc3plus.patch`, for example by using the command `git apply --ignore-whitespace lc3plus.patch` -4. Remove files `ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c` `ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c` diff --git a/lib_rend/lc3plus_codec/get_lc3plus.ps1 b/lib_rend/lc3plus_codec/get_lc3plus.ps1 deleted file mode 100755 index d660f78310..0000000000 --- a/lib_rend/lc3plus_codec/get_lc3plus.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -# This script shall only be used by automated continuous integration systems -# Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md -Remove-Item -Force -Recurse ETSI_Release -ErrorAction 'silentlycontinue' -(new-object System.Net.WebClient).DownloadFile('https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip',"$(pwd)\lc3plus_sources.zip") -Expand-Archive -Force -Path .\lc3plus_sources.zip -DestinationPath . -Remove-Item -Force lc3plus_sources.zip -git apply --ignore-whitespace lc3plus.patch -Remove-Item -Force ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\fft.c -Remove-Item -Force ETSI_Release\LC3plus_ETSI_src_va15eb59632b_20230228\src\floating_point\codec_exe.c diff --git a/lib_rend/lc3plus_codec/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh similarity index 53% rename from lib_rend/lc3plus_codec/get_lc3plus.sh rename to scripts/lc3plus_lib_setup/get_lc3plus.sh index f605c98688..51ead5aab2 100755 --- a/lib_rend/lc3plus_codec/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -1,8 +1,25 @@ +#!/usr/bin/env bash + # This script shall only be used by automated continuous integration systems -# Humans shall follow the instructions in lib_rend/lc3plus_codec/README.md + +scriptdir=$(dirname "$0") +pushd "$scriptdir" || exit 1 + +# Download and unzip LC3plus code rm -rf ETSI_Release curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip unzip lc3plus_sources.zip -d . -rm -f lc3plus_sources.zip + +# Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) git apply --ignore-whitespace lc3plus.patch rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c + +# Move to output dir +rm -rf ../../lc3plus +mkdir ../../lc3plus +mv ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/* ../../lc3plus + +# Clean up +rm -rf lc3plus_sources.zip ETSI_Release + +popd || exit diff --git a/lib_rend/lc3plus_codec/lc3plus.patch b/scripts/lc3plus_lib_setup/lc3plus.patch similarity index 77% rename from lib_rend/lc3plus_codec/lc3plus.patch rename to scripts/lc3plus_lib_setup/lc3plus.patch index 816f664fef..9435fb4d22 100644 --- a/lib_rend/lc3plus_codec/lc3plus.patch +++ b/scripts/lc3plus_lib_setup/lc3plus.patch @@ -1,6 +1,6 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -11,7 +11,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -32,7 +32,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin blacklist[0] = 0; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -43,7 +43,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -83,7 +83,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin nbits_ari = nbits_ari + 8; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -94,7 +94,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -105,7 +105,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* DCT */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -116,7 +116,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -164,7 +164,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -193,7 +193,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (*lastnz > N) { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -214,7 +214,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin # ifdef ENABLE_025_DMS_MODE diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-06-29 12:58:27 @@ -24,13 +24,13 @@ typedef uint32_t LC3_UINT32; @@ -244,7 +244,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define LC3_SQRT(x) (sqrtf(x)) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -264,7 +264,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin brickwall = 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -289,7 +289,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* LSB mode bit */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -300,7 +300,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -331,7 +331,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-06-29 12:58:27 @@ -8,7 +8,7 @@ ******************************************************************************/ @@ -343,7 +343,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include /* for abs() */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-06-29 12:58:27 @@ -8,14 +8,15 @@ ******************************************************************************/ @@ -389,7 +389,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-06-29 12:58:27 @@ -12,6 +12,7 @@ #define IIS_FFT_H @@ -400,7 +400,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #ifdef __cplusplus diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -411,7 +411,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include /* for mmove */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-06-29 12:58:27 @@ -11,6 +11,7 @@ #ifndef IISFFT_H #define IISFFT_H @@ -422,7 +422,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define M_PIl 3.1415926535897932384626433832795029L /* pi */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -433,7 +433,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* Function expects already flipped window */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -564,7 +564,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin encoder->epmode = oldEpmode; // preserve old epmode in case of failure diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-06-29 12:58:27 @@ -0,0 +1,99 @@ +/****************************************************************************** +* ETSI TS 103 634 V1.4.1 * @@ -667,7 +667,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin +} diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -678,7 +678,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -689,7 +689,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -717,7 +717,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -726,27 +726,56 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include "functions.h" void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 1970-01-01 01:00:00 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 2023-06-29 12:58:27 +@@ -0,0 +1 @@ ++Win32/ +\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-06-12 14:50:03 -@@ -26,31 +26,18 @@ - - - ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-06-29 12:58:27 +@@ -1,243 +1,184 @@ +- +- +- +- +- Debug +- Win32 +- +- +- Debug +- x64 +- +- +- Release +- Win32 +- +- +- Release +- x64 +- +- +- +- {95030B82-70CD-4C6B-84D4-61096035BEA2} +- Win32Proj +- LC3_FL +- 10.0.17763.0 +- +- +- - Application -+ StaticLibrary - true - v141 - Unicode - - +- true +- v141 +- Unicode +- +- - Application -+ StaticLibrary - false - v141 - true - Unicode - +- false +- v141 +- true +- Unicode +- - - Application - true @@ -760,59 +789,62 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin - true - Unicode - - - - -@@ -62,12 +49,6 @@ - - - +- +- +- +- +- +- +- +- +- +- +- - - - - - - - - - true -@@ -75,30 +56,20 @@ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - +- +- +- true +- LC3plus +- $(Platform)\$(Configuration)\ +- $(Platform)\$(Configuration)\Obj\ +- - - true - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - false - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - +- +- false +- LC3plus +- $(Platform)\$(Configuration)\ +- $(Platform)\$(Configuration)\Obj\ +- - - false - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - - - - Level3 -+ ..\..\..\..\..\..\..\lib_com;%(AdditionalIncludeDirectories) - Disabled -+ MultiThreadedDebug - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - 4305;4244;4996 - -@@ -107,25 +78,14 @@ - true - - +- +- +- +- +- Level3 +- Disabled +- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) +- 4305;4244;4996 +- +- +- Console +- true +- +- - - - @@ -826,21 +858,24 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin - true - - - - - Level3 - - -+ ..\..\..\..\..\..\..\lib_com;%(AdditionalIncludeDirectories) - MaxSpeed -+ MultiThreaded - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) -@@ -138,31 +98,12 @@ - true - - +- +- +- Level3 +- +- +- MaxSpeed +- true +- true +- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) +- 4244;4305;4996 +- +- +- Console +- true +- true +- true +- +- - - - Level3 @@ -859,28 +894,278 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin - true - - - - - - - - +- +- +- +- +- +- - - - - -@@ -173,7 +114,7 @@ - - - +- +- +- +- +- +- +- +- +- +- - +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ Debug ++ Win32 ++ ++ ++ Debug ++ x64 ++ ++ ++ Release ++ Win32 ++ ++ ++ Release ++ x64 ++ ++ ++ ++ {95030B82-70CD-4C6B-84D4-61096035BEA2} ++ Win32Proj ++ LC3_FL ++ 10.0.17763.0 ++ ++ ++ ++ StaticLibrary ++ true ++ v141 ++ Unicode ++ ++ ++ StaticLibrary ++ false ++ v141 ++ true ++ Unicode ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ true ++ LC3plus ++ $(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\Obj\ ++ ++ ++ false ++ LC3plus ++ $(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\Obj\ ++ ++ ++ ++ ++ ++ Level3 ++ ..\..\lib_com;%(AdditionalIncludeDirectories) ++ Disabled ++ MultiThreadedDebug ++ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ++ 4305;4244;4996 ++ ++ ++ Console ++ true ++ ++ ++ ++ ++ Level3 ++ ++ ++ ..\..\lib_com;%(AdditionalIncludeDirectories) ++ MaxSpeed ++ MultiThreaded ++ true ++ true ++ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ++ 4244;4305;4996 ++ ++ ++ Console ++ true ++ true ++ true ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + - - - ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-12 12:10:26 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35 @@ -8,15 +8,16 @@ ******************************************************************************/ @@ -902,7 +1187,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -913,7 +1198,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -924,7 +1209,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -935,7 +1220,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -946,7 +1231,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -957,7 +1242,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -968,7 +1253,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -979,7 +1264,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -990,7 +1275,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1001,7 +1286,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1012,7 +1297,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1023,7 +1308,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1052,7 +1337,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (prev_bfi_plc2 == 0) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1063,7 +1348,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1074,7 +1359,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1085,7 +1370,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1096,7 +1381,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1107,7 +1392,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1118,7 +1403,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1129,7 +1414,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1140,7 +1425,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1167,7 +1452,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1211,7 +1496,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-12 12:10:26 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-29 12:58:35 @@ -6,13 +6,14 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * @@ -1244,7 +1529,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1255,7 +1540,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1266,7 +1551,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-12 12:10:26 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-29 12:58:35 @@ -6,16 +6,17 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * @@ -1309,7 +1594,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin return; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1320,7 +1605,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin \***************************************************************************/ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1331,7 +1616,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1341,8 +1626,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-12 12:26:35 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-12 12:28:54 +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1353,7 +1638,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static LC3_INT sign(LC3_FLOAT x); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1364,7 +1649,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1415,7 +1700,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1426,7 +1711,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1437,7 +1722,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1448,7 +1733,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1493,7 +1778,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1545,7 +1830,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin setup->targetBitsInit = setup->targetBitsInit - 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1565,7 +1850,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* Downsampling */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1576,7 +1861,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1587,7 +1872,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-06-29 12:58:27 @@ -17,6 +17,7 @@ #include #include @@ -1598,7 +1883,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ @@ -1609,7 +1894,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-05-31 14:59:52 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-06-29 12:58:27 @@ -8,6 +8,7 @@ ******************************************************************************/ diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index c62bc08b9f..01dffb2978 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -63,6 +63,7 @@ mkdir $targetdir # copy files from source-dir cp -R ../lib_* $targetdir +cp -R ../lc3plus $targetdir cp -R ../apps $targetdir cp -R ../Makefile $targetdir cp -R ../CMakeLists.txt $targetdir @@ -102,14 +103,10 @@ shopt -u extglob # patch code before wmc_tool: replace hexadecimal unsigned long constants (0x...UL) by regular integer constant + cast to unsigned long find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; -lc3plus_main_dir="lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/*.c" -lc3plus_fft_dir="lib_rend/lc3plus_codec/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/*.c" - # run wmc_tool "tools/$system/wmc_tool" -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null -"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" "$targetdir/$lc3plus_main_dir" "$targetdir/$lc3plus_fft_dir" >> /dev/null "tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" >> /dev/null -"tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null +"tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lc3plus/*.c" "$targetdir/lc3plus/fft/*.c" >> /dev/null # automatically enable #define WMOPS in options.h sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h -- GitLab From ca42ef8b32f9b364eb7af229444c654d3c8b4635 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 6 Jul 2023 00:50:08 +1000 Subject: [PATCH 253/591] ISM rend SPLIT PCM out bug fixes --- lib_rend/ivas_objectRenderer.c | 39 ++++++++-------------- lib_rend/lib_rend.c | 60 ++++++++++++++++++++-------------- 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 50f31c48a6..c249ad9486 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -720,9 +720,8 @@ void ObjRenderIvasFrame_splitBinaural( int32_t i; float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k]; -#ifdef FIX_SPLIT_REND_MERGE float *p_tmpProcessing[MAX_NUM_OBJECTS]; -#endif + int16_t pos_idx; IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; @@ -754,7 +753,7 @@ void ObjRenderIvasFrame_splitBinaural( /* Save current head positions */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) { - originalHeadRot[i] = st_ivas->hHeadTrackData->Quaternions[i]; + originalHeadRot[i] = st_ivas->hCombinedOrientationData->Quaternions[i]; } /* Copy input audio to a processing buffer. Cannot render in-place because binaurally rendered @@ -773,39 +772,33 @@ void ObjRenderIvasFrame_splitBinaural( { if ( originalHeadRot[i].w == -3.0f ) { - st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; - st_ivas->hHeadTrackData->Quaternions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; - st_ivas->hHeadTrackData->Quaternions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; - st_ivas->hHeadTrackData->Quaternions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; + st_ivas->hCombinedOrientationData->Quaternions[i].w = -3.0f; + st_ivas->hCombinedOrientationData->Quaternions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; + st_ivas->hCombinedOrientationData->Quaternions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; + st_ivas->hCombinedOrientationData->Quaternions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; } else { - st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; + st_ivas->hCombinedOrientationData->Quaternions[i].w = -3.0f; Quat2EulerDegree( originalHeadRot[i], /* TODO tmu : fix bug with ordering*/ - &st_ivas->hHeadTrackData->Quaternions[i].z, - &st_ivas->hHeadTrackData->Quaternions[i].y, - &st_ivas->hHeadTrackData->Quaternions[i].x ); - st_ivas->hHeadTrackData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; - st_ivas->hHeadTrackData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; - st_ivas->hHeadTrackData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; + &st_ivas->hCombinedOrientationData->Quaternions[i].z, + &st_ivas->hCombinedOrientationData->Quaternions[i].y, + &st_ivas->hCombinedOrientationData->Quaternions[i].x ); + st_ivas->hCombinedOrientationData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + st_ivas->hCombinedOrientationData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + st_ivas->hCombinedOrientationData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; } } } -#ifdef FIX_SPLIT_REND_MERGE for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { p_tmpProcessing[i] = tmpProcessing[i]; } -#endif /* Render */ if ( pos_idx == 0 ) { ivas_td_binaural_renderer( st_ivas, -#ifdef FIX_SPLIT_REND_MERGE p_tmpProcessing, -#else - tmpProcessing -#endif output_frame ); } else @@ -814,11 +807,7 @@ void ObjRenderIvasFrame_splitBinaural( tmpTdRendHandle = st_ivas->hBinRendererTd; st_ivas->hBinRendererTd = st_ivas->splitBinRend.splitrend.hTdRendHandles[pos_idx - 1]; ivas_td_binaural_renderer( st_ivas, -#ifdef FIX_SPLIT_REND_MERGE p_tmpProcessing, -#else - tmpProcessing -#endif output_frame ); st_ivas->hBinRendererTd = tmpTdRendHandle; } @@ -842,7 +831,7 @@ void ObjRenderIvasFrame_splitBinaural( /* Restore original head rotation */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) { - st_ivas->hHeadTrackData->Quaternions[i] = originalHeadRot[i]; + st_ivas->hCombinedOrientationData->Quaternions[i] = originalHeadRot[i]; } pop_wmops(); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ff1a048508..8b91d6fb75 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6037,7 +6037,7 @@ static ivas_error renderIsmToSplitBinaural( IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; int16_t output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel; - IVAS_REND_HeadRotData modifiedHeadRotData; + COMBINED_ORIENTATION_HANDLE pCombinedOrientationData; push_wmops( "renderIsmToSplitBinaural" ); @@ -6065,16 +6065,22 @@ static ivas_error renderIsmToSplitBinaural( assert( ismInput->splitTdRendWrappers[i].binaural_latency_ns == ismInput->tdRendWrapper.binaural_latency_ns ); } + pCombinedOrientationData = *ismInput->base.ctx.pCombinedOrientationData; + + for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + pCombinedOrientationData->Quaternions[i] = pCombinedOrientationData->Quaternions[0]; + } + /* Save current head positions */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) { - originalHeadRot[i] = ismInput->base.ctx.pHeadRotData->headPositions[i]; + originalHeadRot[i] = pCombinedOrientationData->Quaternions[i]; } /* Copy input audio to a processing buffer. */ copyBufferTo2dArray( ismInput->base.inputBuffer, tmpProcessing ); - modifiedHeadRotData = *ismInput->base.ctx.pHeadRotData; for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { /* Update head positions */ @@ -6084,21 +6090,21 @@ static ivas_error renderIsmToSplitBinaural( { if ( originalHeadRot[i].w == -3.0f ) { - modifiedHeadRotData.headPositions[i].w = -3.0f; - modifiedHeadRotData.headPositions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - modifiedHeadRotData.headPositions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - modifiedHeadRotData.headPositions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + pCombinedOrientationData->Quaternions[i].w = -3.0f; + pCombinedOrientationData->Quaternions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; + pCombinedOrientationData->Quaternions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; + pCombinedOrientationData->Quaternions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; } else { - modifiedHeadRotData.headPositions[i].w = -3.0f; + pCombinedOrientationData->Quaternions[i].w = -3.0f; Quat2EulerDegree( originalHeadRot[i], - &modifiedHeadRotData.headPositions[i].z, - &modifiedHeadRotData.headPositions[i].y, - &modifiedHeadRotData.headPositions[i].x ); - modifiedHeadRotData.headPositions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - modifiedHeadRotData.headPositions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - modifiedHeadRotData.headPositions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; + &pCombinedOrientationData->Quaternions[i].z, + &pCombinedOrientationData->Quaternions[i].y, + &pCombinedOrientationData->Quaternions[i].x ); + pCombinedOrientationData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + pCombinedOrientationData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + pCombinedOrientationData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; } } } @@ -6109,12 +6115,7 @@ static ivas_error renderIsmToSplitBinaural( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, -#ifndef FIX_SPLIT_REND_MERGE - ismInput->base.ctx.pHeadRotData, -#endif -#ifdef FIX_SPLIT_REND_MERGE ismInput->base.ctx.pCombinedOrientationData, -#endif &ismInput->currentPos, NULL, output_frame, @@ -6129,12 +6130,7 @@ static ivas_error renderIsmToSplitBinaural( error = ivas_td_binaural_renderer_ext( &ismInput->splitTdRendWrappers[pos_idx - 1], ismInput->base.inConfig, NULL, -#ifndef FIX_SPLIT_REND_MERGE - &modifiedHeadRotData, -#endif -#ifdef FIX_SPLIT_REND_MERGE ismInput->base.ctx.pCombinedOrientationData, -#endif &ismInput->currentPos, NULL, output_frame, @@ -6153,6 +6149,11 @@ static ivas_error renderIsmToSplitBinaural( /* Overwrite processing buffer with original input audio again */ copyBufferTo2dArray( ismInput->base.inputBuffer, tmpProcessing ); } + /* Restore original head rotation */ + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + pCombinedOrientationData->Quaternions[i] = originalHeadRot[i]; + } accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); pop_wmops(); @@ -8183,6 +8184,7 @@ ivas_error IVAS_REND_GetSamples( int16_t numOutChannels; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t cldfb2tdSampleFact; + IVAS_REND_AudioBuffer outAudioOrig; #endif /* Validate function arguments */ @@ -8261,8 +8263,14 @@ ivas_error IVAS_REND_GetSamples( } #ifdef SPLIT_REND_LC3PLUS + /* Clear original output buffer */ + set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); + + outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && + ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) { outAudio = hIvasRend->splitRendEncBuffer; } @@ -8360,6 +8368,8 @@ ivas_error IVAS_REND_GetSamples( return error; } convertInternalBitsBuffToBitsBuffer( hBits, bits ); + outAudio = outAudioOrig; + accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); } #endif -- GitLab From 6d7d0eff4a345e689c494bbb8a37aec3de9e4d82 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Wed, 5 Jul 2023 17:59:31 +0200 Subject: [PATCH 254/591] Fix binaural crash for vs!=100 --- lib_dec/ivas_mc_paramupmix_dec.c | 17 +++++++---------- lib_rend/ivas_crend.c | 6 +++++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index c790d5b59d..461072d79d 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -318,14 +318,7 @@ void ivas_mc_paramupmix_dec_digest_tc( /* adapt subframes */ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); - } - else - { - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); - } + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); pop_wmops(); } @@ -344,6 +337,8 @@ void ivas_mc_paramupmix_dec_render( uint16_t slot_size, ch; float *output_f_local[MAX_OUTPUT_CHANNELS]; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + int16_t saved_subframes_rendered; + int16_t saved_slots_rendered; hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); @@ -359,6 +354,8 @@ void ivas_mc_paramupmix_dec_render( /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; + saved_subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + saved_slots_rendered = st_ivas->hTcBuffer->slots_rendered; first_sf = st_ivas->hTcBuffer->subframes_rendered; last_sf = first_sf; @@ -404,8 +401,8 @@ void ivas_mc_paramupmix_dec_render( /* Binaural renderer will do the slot rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - st_ivas->hTcBuffer->slots_rendered = 0; - st_ivas->hTcBuffer->subframes_rendered = 0; + st_ivas->hTcBuffer->slots_rendered = saved_slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = saved_subframes_rendered; } pop_wmops(); diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index b2b4887499..6d536bd625 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1514,8 +1514,9 @@ ivas_error ivas_rend_crendProcessSubframe( slots_to_render = min( hTcBuffer->num_slots - hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); first_sf = hTcBuffer->subframes_rendered; last_sf = first_sf; +#ifndef JBM_PARAMUPMIX hTcBuffer->slots_rendered += slots_to_render; - +#endif while ( slots_to_render > 0 ) { slots_to_render -= hTcBuffer->subframe_nbslots[last_sf]; @@ -1569,6 +1570,9 @@ ivas_error ivas_rend_crendProcessSubframe( { p_pcm_tmp[ch] += subframe_len; } +#ifdef JBM_PARAMUPMIX + hTcBuffer->slots_rendered += hTcBuffer->subframe_nbslots[subframe_idx]; +#endif } else { -- GitLab From 75ad8cd9cebb21b03d00f58bf1120ea212c5c6d0 Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Thu, 6 Jul 2023 14:00:40 +1000 Subject: [PATCH 255/591] Use CLDFB HRTFs of the appropriate SBA order --- lib_com/options.h | 1 + lib_rend/ivas_reverb_utils.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..56f0ee7333 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ +#define UPDATE_REVERB_UTILS /* Use CLDFB HRTFs of the appropriate SBA order in get_IR_from_filter_taps() */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 6ff101bec5..c9d8af5147 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -52,7 +52,9 @@ #define FFT_SPECTRUM_SIZE ( 1 + ( RV_FILTER_MAX_FFT_SIZE / 2 ) ) #define N_INITIAL_IGNORED_FRAMES 4 +#ifndef UPDATE_REVERB_UTILS #define NUM_CLDFB_TAPES 7 +#endif /*-----------------------------------------------------------------------------------------* * Local function prototypes @@ -225,7 +227,11 @@ static void get_IR_from_filter_taps( output_sample_idx = 0; /* Assign CLDFB taps */ +#ifdef UPDATE_REVERB_UTILS + if ( input_audio_config == AUDIO_CONFIG_HOA3 ) +#else if ( input_audio_config == AUDIO_CONFIG_FOA || input_audio_config == AUDIO_CONFIG_HOA2 || input_audio_config == AUDIO_CONFIG_HOA3 ) +#endif { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { @@ -235,6 +241,28 @@ static void get_IR_from_filter_taps( convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag_HOA3[band_idx][hrtf_idx]; } } +#ifdef UPDATE_REVERB_UTILS + else if ( input_audio_config == AUDIO_CONFIG_HOA2 ) + { + for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) + { + convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftHRIRReal_HOA2[band_idx][hrtf_idx]; + convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftHRIRImag_HOA2[band_idx][hrtf_idx]; + convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightHRIRReal_HOA2[band_idx][hrtf_idx]; + convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag_HOA2[band_idx][hrtf_idx]; + } + } + else if ( input_audio_config == AUDIO_CONFIG_FOA ) + { + for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) + { + convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftHRIRReal_FOA[band_idx][hrtf_idx]; + convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftHRIRImag_FOA[band_idx][hrtf_idx]; + convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightHRIRReal_FOA[band_idx][hrtf_idx]; + convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag_FOA[band_idx][hrtf_idx]; + } + } +#endif else { array_idx = 0; @@ -313,7 +341,11 @@ static void get_IR_from_filter_taps( } } +#ifdef UPDATE_REVERB_UTILS + ivas_cldfb_convolver( &convolver_state, out_CLDFB_real, out_CLDFB_imag, real_buffer_in, imag_buffer_in, BINAURAL_CONVBANDS, BINAURAL_NTAPS ); +#else ivas_cldfb_convolver( &convolver_state, out_CLDFB_real, out_CLDFB_imag, real_buffer_in, imag_buffer_in, BINAURAL_CONVBANDS, NUM_CLDFB_TAPES ); +#endif ppRealBuf[0] = out_CLDFB_real[0]; ppImagBuf[0] = out_CLDFB_imag[0]; -- GitLab From b2842e2ed50fdf3e09d3c28e82a21a9b0a5e6b59 Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Thu, 6 Jul 2023 14:44:13 +1000 Subject: [PATCH 256/591] Fix clang formatting --- lib_rend/ivas_reverb_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index c9d8af5147..b821521b68 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -53,7 +53,7 @@ #define N_INITIAL_IGNORED_FRAMES 4 #ifndef UPDATE_REVERB_UTILS -#define NUM_CLDFB_TAPES 7 +#define NUM_CLDFB_TAPES 7 #endif /*-----------------------------------------------------------------------------------------* -- GitLab From 8d45ee8bd85b3ce4ea2a687a209c47bdf33b1191 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 6 Jul 2023 10:35:56 +0530 Subject: [PATCH 257/591] Modified the MD bits calculation --- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_enc/ivas_qmetadata_enc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 79641dc63f..a2d6d1502c 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1206,7 +1206,7 @@ int16_t ivas_qmetadata_dec_sid_decode( /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ #else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index be242fb4de..297b95b4bd 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -983,7 +983,7 @@ void ivas_qmetadata_enc_sid_encode( /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ #else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ + metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ #endif } -- GitLab From 3f5770a8c83c719b3fe1412627263d184e9b6652 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 6 Jul 2023 16:00:09 +1000 Subject: [PATCH 258/591] warning fixes, delay adjustment fix --- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/ivas_splitRendererPre.c | 17 ++++++++++------- lib_rend/lib_rend.c | 22 ++++++++++++++-------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 898bf3fc3b..a761b916f7 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1166,7 +1166,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, #ifdef SPLIT_REND_LC3PLUS - int8_t td_input, + int16_t td_input, #endif const int16_t pcm_out ); diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 3892b4710d..2c213b0d98 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1608,11 +1608,11 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra /* Alocate buffers for delay compensation */ if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) { - delayBufferLength = OutSampleRate / FRAMES_PER_SECOND + hSplitRendWrapper->lc3plusDelaySamples; + delayBufferLength = OutSampleRate / (int32_t) FRAMES_PER_SECOND + hSplitRendWrapper->lc3plusDelaySamples; for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i ) { hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ); - set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], delayBufferLength ); + set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], (int16_t) delayBufferLength ); } } else @@ -1625,7 +1625,7 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra for ( i = 0; i < hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++i ) { hSplitRendWrapper->lc3plusDelayBuffers[i] = malloc( delayBufferLength * sizeof( float ) ); - set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], delayBufferLength ); + set_zero( hSplitRendWrapper->lc3plusDelayBuffers[i], (int16_t) delayBufferLength ); } } @@ -1644,6 +1644,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, CLDFB_TYPE cldfbMode; uint8_t useLc3plus; uint8_t isCldfbNeeded = 0; + cldfbMode = CLDFB_ANALYSIS; if ( ( error = ivas_split_rend_validate_config( pSplitRendConfig ) ) != IVAS_ERR_OK ) { @@ -1891,14 +1892,14 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( if ( useLc3plus ) { - int32_t frame_size = hSplitBin->hLc3plusEnc->config.samplerate / FRAMES_PER_SECOND; + int32_t frame_size = hSplitBin->hLc3plusEnc->config.samplerate / (int32_t) FRAMES_PER_SECOND; for ( i = 0; i < num_poses * BINAURAL_CHANNELS; ++i ) { /* Artificially delay input to head pose correction analysis by LC3plus coding delay, so that audio and metadata are in sync after decoding */ - mvr2r( hSplitBin->lc3plusDelayBuffers[i] + frame_size, hSplitBin->lc3plusDelayBuffers[i], hSplitBin->lc3plusDelaySamples ); + mvr2r( hSplitBin->lc3plusDelayBuffers[i] + frame_size, hSplitBin->lc3plusDelayBuffers[i], (int16_t) hSplitBin->lc3plusDelaySamples ); in_delayed[i] = hSplitBin->lc3plusDelayBuffers[i]; - mvr2r( in[i], hSplitBin->lc3plusDelayBuffers[i] + hSplitBin->lc3plusDelaySamples, frame_size ); + mvr2r( in[i], hSplitBin->lc3plusDelayBuffers[i] + hSplitBin->lc3plusDelaySamples, (int16_t) frame_size ); } } else @@ -1931,6 +1932,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( #endif #ifdef SPLIT_REND_LC3PLUS + actual_md_bits = pBits->bits_written; if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; @@ -2093,7 +2095,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, #ifdef SPLIT_REND_LC3PLUS - int8_t td_input, + int16_t td_input, #endif const int16_t pcm_out ) { @@ -2129,6 +2131,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( lc3plusTimeAlignCldfbPoseCorr( hSplitBin, Cldfb_In_BinReal, Cldfb_In_BinImag ); } + actual_md_bits = pBits->bits_written; if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8b91d6fb75..f8f1fdecf2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4586,20 +4586,23 @@ ivas_error IVAS_REND_GetDelay( if ( hIvasRend->inputsSplitPost[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { #ifdef SPLIT_REND_LC3PLUS + latency_ns = 0; if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec != NULL ) { int32_t lc3plusDelaySamples; IVAS_LC3PLUS_DEC_GetDelay( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec, &lc3plusDelaySamples ); - max_latency_ns = max( max_latency_ns, (int32_t) roundf( lc3plusDelaySamples * 1000000000.f / *timeScale ) ); + latency_ns = (int32_t) roundf( lc3plusDelaySamples * 1000000000.f / *timeScale ); } - else +#endif +#ifdef SPLIT_REND_LC3PLUS + if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { #endif - latency_ns = IVAS_FB_DEC_DELAY_NS; - max_latency_ns = max( max_latency_ns, latency_ns ); + latency_ns += IVAS_FB_DEC_DELAY_NS; #ifdef SPLIT_REND_LC3PLUS } #endif + max_latency_ns = max( max_latency_ns, latency_ns ); } } #endif @@ -6881,7 +6884,7 @@ static ivas_error renderSplitBinauralWithPostRot( int16_t sf_idx; ivas_split_rend_bits_t bits; float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - const IVAS_REND_HeadRotData *pHeadRotData; + COMBINED_ORIENTATION_HANDLE pCombinedOrientationData; SPLIT_POST_REND_WRAPPER *hSplitBin; #ifdef SPLIT_REND_LC3PLUS int8_t isPostRendInputCldfb; @@ -6893,7 +6896,7 @@ static ivas_error renderSplitBinauralWithPostRot( error = IVAS_ERR_OK; - pHeadRotData = splitBinInput->base.ctx.pHeadRotData; + pCombinedOrientationData = *splitBinInput->base.ctx.pCombinedOrientationData; hSplitBin = &splitBinInput->splitPostRendWrapper; convertBitsBufferToInternalBitsBuff( *hBits, &bits ); @@ -6924,7 +6927,7 @@ static ivas_error renderSplitBinauralWithPostRot( for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { - QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pHeadRotData->headPositions, sf_idx ); + QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pCombinedOrientationData->Quaternions, sf_idx ); } #ifdef SPLIT_REND_PLC @@ -6938,7 +6941,6 @@ static ivas_error renderSplitBinauralWithPostRot( if ( hSplitBin->first_good_frame_received == 1 ) { #endif /* SPLIT_REND_PLC */ - if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { #ifdef SPLIT_REND_PLC @@ -6956,6 +6958,10 @@ static ivas_error renderSplitBinauralWithPostRot( ); } } + /*copy pose correction after MD is parsed*/ +#ifdef SPLIT_REND_LC3PLUS + hSplitBin->multiBinPoseData.poseCorrectionMode = bits.pose_correction; +#endif if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { -- GitLab From e5b4a0e8e32d2ad5cdc1630540f29f793021320c Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 6 Jul 2023 11:38:47 +0530 Subject: [PATCH 259/591] Reverted the change in reset_metadata_spatial() --- lib_enc/ivas_qmetadata_enc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 297b95b4bd..de0c9196d4 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -1280,14 +1280,11 @@ void reset_metadata_spatial( #endif hMetaData->ind_list[0].value = 1; metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#ifdef FIX_137_SID_MD_BITS - assert( hMetaData->nb_bits_tot == metadata_sid_bits ); -#else + while ( hMetaData->nb_bits_tot < metadata_sid_bits ) { push_next_indice( hMetaData, 0, 1 ); /*fill bit*/ } -#endif } else { -- GitLab From f25cb6f0799566e9aaa53ac5f12e5ce85cb7219b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Jul 2023 08:27:49 +0200 Subject: [PATCH 260/591] [fix] add missing CMakeLists.txt for tables_format_converter: `git checkout c08d1e255bfe6a21dfbc3c04d16579683e0a3cbc -- scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt` --- .../Table_Format_Converter/CMakeLists.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt b/scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt new file mode 100644 index 0000000000..259e3b97b6 --- /dev/null +++ b/scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.6) + +project(tables_format_converter) + +if(WIN32) + # MSVC compiler flags + add_definitions( + -D_CRT_SECURE_NO_WARNINGS + ) + + # CMake sets /W3 by default, until CMake version 3.15. Instead of setting /W4 separately, replace in existing settings + string(REGEX REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +endif() + +set(IVAS_PATH "${PROJECT_SOURCE_DIR}/../../..") +set(IVAS_UTIL_PATH ${IVAS_PATH}/lib_util) +set(IVAS_DEC_PATH ${IVAS_PATH}/lib_dec) +set(IVAS_ENC_PATH ${IVAS_PATH}/lib_enc) +set(IVAS_COM_PATH ${IVAS_PATH}/lib_com) +set(IVAS_REND_PATH ${IVAS_PATH}/lib_rend) +set(IVAS_DEBUG_PATH ${IVAS_PATH}/lib_debug) + +include_directories(${IVAS_UTIL_PATH} ${IVAS_ENC_PATH} ${IVAS_DEC_PATH} ${IVAS_COM_PATH} ${IVAS_REND_PATH} ${IVAS_DEBUG_PATH}) + +set(SOURCE_FILES_C + ${IVAS_REND_PATH}/ivas_rom_binauralRenderer.c + ${IVAS_REND_PATH}/ivas_rom_binaural_crend_head.c) + +set(SOURCE_FILES_H + ${IVAS_REND_PATH}/ivas_rom_binauralRenderer.h + ${IVAS_REND_PATH}/ivas_rom_binaural_crend_head.h) + +add_library(${PROJECT_NAME}_lib STATIC ${SOURCE_FILES_C} ${SOURCE_FILES_H}) + +add_executable(${PROJECT_NAME} generate_tables_from_rom_to_bin.c) +target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib) -- GitLab From cb854f6f0bc925f33ab9d562c557bb4811418107 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 6 Jul 2023 12:10:32 +0530 Subject: [PATCH 261/591] Reverting the change made in ivas_spar_dec() [x]Added back the reading of padding bits --- lib_dec/ivas_spar_decoder.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 1f2a50da6c..906a73b317 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -354,15 +354,11 @@ ivas_error ivas_spar_dec( if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { -#ifndef FIX_137_SID_MD_BITS int16_t zero_pad_bits; -#endif *nb_bits_read += SID_FORMAT_NBITS; -#ifndef FIX_137_SID_MD_BITS zero_pad_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - *nb_bits_read; assert( zero_pad_bits <= 1 ); *nb_bits_read += zero_pad_bits; -#endif } pop_wmops(); -- GitLab From 025792cd8add1288d2f30e91ba719df0fe666d77 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Jul 2023 16:23:58 +0200 Subject: [PATCH 262/591] [fix] bug for rendering with TD Object Renderer and switch to multiple instances of CREND --- lib_rend/ivas_objectRenderer.c | 8 ++ lib_rend/lib_rend.c | 154 +++++++++++++-------------------- 2 files changed, 66 insertions(+), 96 deletions(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 18ec1f5e6c..ef68bb7112 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -724,7 +724,11 @@ void ObjRenderIvasFrame_splitBinaural( float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; #endif float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k]; +#ifdef SPLIT_REND_LC3PLUS_MC + float *p_tmpProcessing[MAX_OUTPUT_CHANNELS]; +#else float *p_tmpProcessing[MAX_NUM_OBJECTS]; +#endif int16_t pos_idx; IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -798,7 +802,11 @@ void ObjRenderIvasFrame_splitBinaural( } } } +#ifdef SPLIT_REND_LC3PLUS_MC + for ( i = 0; i < st_ivas->nchan_transport; ++i ) +#else for ( i = 0; i < BINAURAL_CHANNELS; i++ ) +#endif { p_tmpProcessing[i] = tmpProcessing[i]; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 461b5b4b6c..bf48b799b1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2290,7 +2290,11 @@ static ivas_error initMcBinauralRendering( NULL, outSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , +#ifdef SPLIT_REND_LC3PLUS_MC + ( ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 +#else 1 +#endif #endif ) ) != IVAS_ERR_OK ) { @@ -6814,7 +6818,7 @@ static ivas_error renderMcToSplitBinaural( const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { - int16_t i, pos_idx; + int16_t i, j, sf, pos_idx; int16_t output_frame; ivas_error error; const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; @@ -6824,9 +6828,8 @@ static ivas_error renderMcToSplitBinaural( float tmpSplitBinauralBuffer[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; IVAS_REND_AudioConfig inConfig; IVAS_REND_AudioBuffer tmpRotBuffer; - IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; - IVAS_REND_HeadRotData modifiedHeadRotData; - const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; + COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; + COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; push_wmops( "renderMcToSplitBinaural" ); @@ -6842,41 +6845,36 @@ static ivas_error renderMcToSplitBinaural( } /* save current head positions */ - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + pCombinedOrientationDataLocal = *mcInput->base.ctx.pCombinedOrientationData; + combinedOrientationDataLocal = *pCombinedOrientationDataLocal; + for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) { - originalHeadRot[i] = mcInput->base.ctx.pHeadRotData->headPositions[i]; + combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) + { + combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + } + } } - modifiedHeadRotData = *mcInput->base.ctx.pHeadRotData; for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { /* Update head positions */ - if ( pos_idx != 0 ) + IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) - { - if ( originalHeadRot[i].w == -3.0f ) - { - modifiedHeadRotData.headPositions[i].w = -3.0f; - modifiedHeadRotData.headPositions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - modifiedHeadRotData.headPositions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - modifiedHeadRotData.headPositions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; - } - else - { - modifiedHeadRotData.headPositions[i].w = -3.0f; - Quat2EulerDegree( originalHeadRot[i], - &modifiedHeadRotData.headPositions[i].z, - &modifiedHeadRotData.headPositions[i].y, - &modifiedHeadRotData.headPositions[i].x ); - modifiedHeadRotData.headPositions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - modifiedHeadRotData.headPositions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - modifiedHeadRotData.headPositions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; - } + Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i]; + Quaternions_abs.w = -3.0f; + Quat2EulerDegree( combinedOrientationDataLocal.Quaternions[i], &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ - ( *mcInput->base.ctx.pCombinedOrientationData )->Quaternions[i] = modifiedHeadRotData.headPositions[i]; - } + Quaternions_abs.x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + Quaternions_abs.y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + Quaternions_abs.z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; + combinedOrientationDataLocal.Quaternions[i] = Quaternions_abs; + QuatToRotMat( combinedOrientationDataLocal.Quaternions[i], combinedOrientationDataLocal.Rmat[i] ); } if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM || inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) @@ -6891,37 +6889,17 @@ static ivas_error renderMcToSplitBinaural( /* copy input to tdrend input/output buffer */ copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - /* set quaternions */ - hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; - /* Render */ - if ( pos_idx == 0 ) + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->splitTdRendWrappers[pos_idx - 1], + mcInput->base.inConfig, + &mcInput->customLsInput, + &pCombinedOrientationDataLocal, + NULL, + mcInput->hReverb, + mcInput->base.inputBuffer.config.numSamplesPerChannel, + tmpRendBuffer ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, - mcInput->base.inConfig, - &mcInput->customLsInput, - hCombinedOrientationData, - NULL, - mcInput->hReverb, - mcInput->base.inputBuffer.config.numSamplesPerChannel, - tmpRendBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->splitTdRendWrappers[pos_idx - 1], - mcInput->base.inConfig, - &mcInput->customLsInput, - hCombinedOrientationData, - NULL, - mcInput->hReverb, - mcInput->base.inputBuffer.config.numSamplesPerChannel, - tmpRendBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } /* Copy rendered audio to tmp storage buffer. Copying directly to output would @@ -6942,35 +6920,22 @@ static ivas_error renderMcToSplitBinaural( tmpRotBuffer = mcInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + /* copy input for in-place rotation */ + mvr2r( mcInput->base.inputBuffer.data, tmpRotBuffer.data, + tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); /* perform rotation in source format to tmpRotBuffer */ - if ( pos_idx == 0 ) - { - 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 ) - { - return error; - } - } - else + pCombinedOrientationDataLocal = &combinedOrientationDataLocal; + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, + mcInput->base.inConfig, + mcInput->customLsInput, + mcInput->base.ctx.pHeadRotData, + &pCombinedOrientationDataLocal, + mcInput->rot_gains_prev, + mcInput->efapInWrapper.hEfap, + tmpRotBuffer ) ) != IVAS_ERR_OK ) { - if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - &modifiedHeadRotData, - mcInput->base.ctx.pCombinedOrientationData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); @@ -6984,12 +6949,8 @@ static ivas_error renderMcToSplitBinaural( NULL, NULL, p_tmpRendBuffer, - *mcInput->base.ctx.pOutSampleRate -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - 0 -#endif - ) ) != IVAS_ERR_OK ) + *mcInput->base.ctx.pOutSampleRate, + pos_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -7001,6 +6962,12 @@ static ivas_error renderMcToSplitBinaural( free( tmpRotBuffer.data ); } + + /* restore original headrotation data */ + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i]; + } } /* TODO tmu : needs delay compensation */ @@ -7011,11 +6978,6 @@ static ivas_error renderMcToSplitBinaural( accumulate2dArrayToBuffer( tmpSplitBinauralBuffer, &outAudio ); - /* restore original headrotation data */ - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) - { - ( *mcInput->base.ctx.pCombinedOrientationData )->Quaternions[i] = originalHeadRot[i]; - } pop_wmops(); return IVAS_ERR_OK; -- GitLab From 2a2e90ec7aa355951dc847eb31f34b5f8dcd8a0b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Jul 2023 16:42:43 +0200 Subject: [PATCH 263/591] [fix] rotation/combinedOrientation modification in ivas_rend_crendProcessSplitBin() --- lib_rend/ivas_crend.c | 82 ++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index cdb590cc31..05c8945e3c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1756,25 +1756,20 @@ ivas_error ivas_rend_crendProcessSplitBin( const int16_t output_frame /* i : output frame length */ ) { - int16_t i; + int16_t i, j, sf; int16_t pos_idx; + ivas_error error; float gain_lfe; float tmpLfeBuffer[L_FRAME48k]; float tmpInputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_tmpInputBuffer[MAX_OUTPUT_CHANNELS]; float tmpSplitBinBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; - ivas_error error; + COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; + COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; - /* Save current head positions */ - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) - { - originalHeadRot[i] = st_ivas->hHeadTrackData->Quaternions[i]; - } - /* copy input */ for ( i = 0; i < st_ivas->nchan_transport; ++i ) { @@ -1786,8 +1781,22 @@ ivas_error ivas_rend_crendProcessSplitBin( p_tmpInputBuffer[i] = tmpInputBuffer[i]; } - /* TODO tmu : partial duplication of ivas_binaural_add_LFE() for efficiency */ - /* copy LFE */ + /* save current head positions */ + pCombinedOrientationDataLocal = st_ivas->hCombinedOrientationData; + combinedOrientationDataLocal = *pCombinedOrientationDataLocal; + for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) + { + combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) + { + combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + } + } + } + + /* copy LFE to tmpLfeBuffer and apply gain only once */ mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame ); @@ -1795,39 +1804,27 @@ ivas_error ivas_rend_crendProcessSplitBin( for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; ++pos_idx ) { /* Update head positions */ - if ( pos_idx != 0 ) + IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) - { - if ( originalHeadRot[i].w == -3.0f ) - { - st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; - st_ivas->hHeadTrackData->Quaternions[i].x = originalHeadRot[i].x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; - st_ivas->hHeadTrackData->Quaternions[i].y = originalHeadRot[i].y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; - st_ivas->hHeadTrackData->Quaternions[i].z = originalHeadRot[i].z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; - } - else - { - st_ivas->hHeadTrackData->Quaternions[i].w = -3.0f; - Quat2EulerDegree( originalHeadRot[i], /* TODO tmu : fix bug with ordering*/ - &st_ivas->hHeadTrackData->Quaternions[i].z, - &st_ivas->hHeadTrackData->Quaternions[i].y, - &st_ivas->hHeadTrackData->Quaternions[i].x ); - st_ivas->hHeadTrackData->Quaternions[i].x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; - st_ivas->hHeadTrackData->Quaternions[i].y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; - st_ivas->hHeadTrackData->Quaternions[i].z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; - } - - st_ivas->hCombinedOrientationData->Quaternions[i] = st_ivas->hHeadTrackData->Quaternions[i]; - } + Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i]; + Quaternions_abs.w = -3.0f; + Quat2EulerDegree( combinedOrientationDataLocal.Quaternions[i], &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + + Quaternions_abs.x += pMultiBinPoseData->relative_head_poses[pos_idx][0]; + Quaternions_abs.y += pMultiBinPoseData->relative_head_poses[pos_idx][1]; + Quaternions_abs.z += pMultiBinPoseData->relative_head_poses[pos_idx][2]; + combinedOrientationDataLocal.Quaternions[i] = Quaternions_abs; + QuatToRotMat( combinedOrientationDataLocal.Quaternions[i], combinedOrientationDataLocal.Rmat[i] ); } /* render inplace to first two channels of tmpInputBuffer */ + pCombinedOrientationDataLocal = &combinedOrientationDataLocal; if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, + pCombinedOrientationDataLocal, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_tmpInputBuffer, @@ -1848,6 +1845,12 @@ ivas_error ivas_rend_crendProcessSplitBin( /* overwrite rendered channels with input again for next iteration */ mvr2r( output[i], tmpInputBuffer[i], output_frame ); } + + /* restore original headrotation data */ + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i]; + } } /* copy split binaural rendered signals to final output */ @@ -1856,13 +1859,6 @@ ivas_error ivas_rend_crendProcessSplitBin( mvr2r( tmpSplitBinBuffer[i], output[i], output_frame ); } - /* Restore original head rotation */ - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) - { - st_ivas->hHeadTrackData->Quaternions[i] = originalHeadRot[i]; - st_ivas->hCombinedOrientationData->Quaternions[i] = originalHeadRot[i]; - } - return IVAS_ERR_OK; } #endif -- GitLab From 3585b65818e6bcecce12444c6d73509a5796c55f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Jul 2023 17:02:09 +0200 Subject: [PATCH 264/591] [cfix] clang-format --- apps/decoder.c | 6 +++--- lib_dec/ivas_spar_decoder.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index fd5cb7a00e..939085acd1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -579,10 +579,10 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ -#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && + arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 352d99ba9e..fc5be70877 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1678,11 +1678,11 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif - ) ) + ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -- GitLab From 6d7aa532fc83de74ed7762650749a181a913e0c5 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 7 Jul 2023 00:41:45 +0300 Subject: [PATCH 265/591] Refactors hDirAC and all related inits into separate decoding and rendering structures. --- lib_com/ivas_prot.h | 65 +- lib_dec/ivas_dirac_dec.c | 1835 ++++++++++-------- lib_dec/ivas_dirac_output_synthesis_dec.c | 337 ++-- lib_dec/ivas_init_dec.c | 133 +- lib_dec/ivas_ism_dec.c | 29 +- lib_dec/ivas_ism_param_dec.c | 274 +-- lib_dec/ivas_jbm_dec.c | 4 +- lib_dec/ivas_masa_dec.c | 64 +- lib_dec/ivas_mcmasa_dec.c | 48 +- lib_dec/ivas_mct_dec.c | 73 +- lib_dec/ivas_sba_dec.c | 65 +- lib_dec/ivas_spar_decoder.c | 12 +- lib_dec/ivas_spar_md_dec.c | 29 +- lib_dec/ivas_stat_dec.h | 127 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 168 +- lib_rend/ivas_stat_rend.h | 103 +- lib_rend/lib_rend.c | 54 +- scripts/config/self_test.prm | 121 ++ 18 files changed, 1993 insertions(+), 1548 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9bc253776d..484bb62fd3 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1037,6 +1037,7 @@ ivas_error ivas_param_ism_dec_open( void ivas_param_ism_dec_close( DIRAC_DEC_HANDLE *hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out, /* i/o: common spatial renderer data */ const AUDIO_CONFIG output_config /* i : output audio configuration */ ); @@ -3162,8 +3163,9 @@ int16_t ivas_qmetadata_dec_sid_decode( void ivas_qmetadata_to_dirac( const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -3565,13 +3567,9 @@ ivas_error ivas_dirac_sba_config( const int16_t nbands /* i : number of frequency bands */ ); -ivas_error ivas_dirac_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - ivas_error ivas_dirac_allocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - const int16_t params_flag /* i : set of parameters flag */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ ); ivas_error ivas_dirac_dec_config( @@ -3580,18 +3578,27 @@ ivas_error ivas_dirac_dec_config( ); void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE *hDirAC /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC_out +); + +void ivas_spat_rend_common_data_close( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out +); + +void ivas_dirac_rend_close( + DIRAC_REND_HANDLE *hDirACRend_out ); void ivas_dirac_deallocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - const int16_t params_flag /* i : set of parameters flag */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ ); void ivas_dirac_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder Core state structure */ DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -3723,22 +3730,23 @@ void ivas_dirac_dec_decorr_close( ); ivas_error ivas_dirac_dec_output_synthesis_open( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs /* i : output sampling rate */ - , + const int32_t output_Fs, /* i : output sampling rate */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); void ivas_dirac_dec_output_synthesis_init( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); void ivas_dirac_dec_output_synthesis_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: DirAC handle */ + DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ ); void ivas_dirac_dec_output_synthesis_process_slot( @@ -3748,11 +3756,13 @@ void ivas_dirac_dec_output_synthesis_process_slot( const int16_t *elevation, const float *diffuseness, DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t sh_rot_max_order, const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_transport, /* i : number of transport channels */ const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -3761,6 +3771,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, @@ -3772,6 +3784,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nbslots, /* i : number of slots to process */ float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ float *reference_power_smooth, @@ -3809,7 +3823,8 @@ void ivas_dirac_dec_compute_power_factors( ); void ivas_dirac_dec_compute_directional_responses( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int16_t *azimuth, @@ -4855,14 +4870,14 @@ void ivas_spar_arith_coeffs_com_init( int16_t ivas_arith_encode_cmplx_cell_array( - ivas_arith_t *pArith_re, - ivas_arith_t *pArith_re_diff, - const int16_t *pDo_diff, - const int16_t nB, - int16_t *pSymbol_re, - int16_t *pSymbol_old_re, - ivas_cell_dim_t *pCell_dims, - BSTR_ENC_HANDLE hMetaData, + ivas_arith_t *pArith_re, + ivas_arith_t *pArith_re_diff, + const int16_t *pDo_diff, + const int16_t nB, + int16_t *pSymbol_re, + int16_t *pSymbol_old_re, + ivas_cell_dim_t *pCell_dims, + BSTR_ENC_HANDLE hMetaData, const int16_t any_diff , const int16_t wc_strat_arith ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index f3ea6912f3..ffc47bc30f 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -51,7 +51,7 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, const int16_t hodirac_flag ); +static ivas_error ivas_dirac_alloc_mem( DIRAC_REND_HANDLE hDirACRend, const RENDERER_TYPE renderer_type, const int16_t num_freq_bands, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, const int16_t hodirac_flag ); static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); @@ -67,7 +67,7 @@ static void protoSignalComputation2( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRA static void protoSignalComputation4( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands, const float *mtx_hoa_decoder, const int16_t nchan_transport, const int16_t *sba_map_tc_ind ); -static void ivas_dirac_dec_compute_diffuse_proto( DIRAC_DEC_HANDLE hDirAC, const int16_t slot_idx ); +static void ivas_dirac_dec_compute_diffuse_proto( DIRAC_REND_HANDLE hDirACRend, const int16_t num_freq_bands, const int16_t slot_idx ); static void computeDirectionAngles( float *intensity_real_x, float *intensity_real_y, float *intensity_real_z, const int16_t num_frequency_bands, int16_t *azimuth, int16_t *elevation ); @@ -80,29 +80,6 @@ static void ivas_lfe_synth_with_cldfb( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynt static void rotateAziEle_DirAC( int16_t *azi, int16_t *ele, const int16_t band1, const int16_t band2, const float *p_Rmat ); -/*------------------------------------------------------------------------- - * ivas_dirac_dec_open() - * - * Open decoder DirAC handle - *-------------------------------------------------------------------------*/ - -ivas_error ivas_dirac_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - ivas_error error; - - error = IVAS_ERR_OK; - - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) - { - return error; - } - - return error; -} - - /*------------------------------------------------------------------------- * ivas_dirac_allocate_parameters() * @@ -110,7 +87,7 @@ ivas_error ivas_dirac_dec_open( *-------------------------------------------------------------------------*/ ivas_error ivas_dirac_allocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ const int16_t params_flag /* i : set of parameters flag */ ) { @@ -118,138 +95,191 @@ ivas_error ivas_dirac_allocate_parameters( if ( params_flag == 1 ) { - if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + if ( ( rend_common_data->azimuth = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + if ( ( rend_common_data->elevation = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( rend_common_data->diffuseness_vector = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( rend_common_data->energy_ratio1 = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( rend_common_data->spreadCoherence = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( rend_common_data->surroundingCoherence = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < rend_common_data->dirac_md_buffer_length; i++ ) { - if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + if ( ( rend_common_data->azimuth[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); + set_s( rend_common_data->azimuth[i], 0, rend_common_data->num_freq_bands ); - if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + if ( ( rend_common_data->elevation[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); + set_s( rend_common_data->elevation[i], 0, rend_common_data->num_freq_bands ); - if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( rend_common_data->diffuseness_vector[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); + set_f( rend_common_data->diffuseness_vector[i], 1.0f, rend_common_data->num_freq_bands ); - if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( rend_common_data->energy_ratio1[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); + set_f( rend_common_data->energy_ratio1[i], 0.0f, rend_common_data->num_freq_bands ); - if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( rend_common_data->spreadCoherence[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); + set_f( rend_common_data->spreadCoherence[i], 0.0f, rend_common_data->num_freq_bands ); - if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( rend_common_data->surroundingCoherence[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); + set_f( rend_common_data->surroundingCoherence[i], 0.0f, rend_common_data->num_freq_bands ); } } else if ( params_flag == 2 ) { - if ( ( hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + if ( ( rend_common_data->azimuth2 = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + if ( ( rend_common_data->elevation2 = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( rend_common_data->energy_ratio2 = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( rend_common_data->spreadCoherence2 = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < rend_common_data->dirac_md_buffer_length; i++ ) { - if ( ( hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + if ( ( rend_common_data->azimuth2[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); + set_s( rend_common_data->azimuth2[i], 0, rend_common_data->num_freq_bands ); - if ( ( hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + if ( ( rend_common_data->elevation2[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); + set_s( rend_common_data->elevation2[i], 0, rend_common_data->num_freq_bands ); - if ( ( hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( rend_common_data->energy_ratio2[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); + set_f( rend_common_data->energy_ratio2[i], 0.0f, rend_common_data->num_freq_bands ); - if ( ( hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( rend_common_data->spreadCoherence2[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); + set_f( rend_common_data->spreadCoherence2[i], 0.0f, rend_common_data->num_freq_bands ); } } return IVAS_ERR_OK; } +static ivas_error ivas_dirac_dec_config_internal( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ +) +{ + DIRAC_DEC_HANDLE hDirAC; + ivas_error error; + DIRAC_CONFIG_FLAG flag_config; + + flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; + error = IVAS_ERR_OK; -/*------------------------------------------------------------------------- - * ivas_dirac_dec_config() - * - * Open or reconfigure decoder DirAC/MASA handle - *-------------------------------------------------------------------------*/ + hDirAC = NULL; -ivas_error ivas_dirac_dec_config( + if ( flag_config == DIRAC_RECONFIGURE ) + { + hDirAC = st_ivas->hDirAC; + } + else if ( flag_config == DIRAC_OPEN ) + { + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hDirAC = (DIRAC_DEC_HANDLE) malloc( sizeof( DIRAC_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->hConfig = (DIRAC_CONFIG_DATA_HANDLE) malloc( sizeof( DIRAC_CONFIG_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); + } + + hDirAC->hParamIsm = NULL; + hDirAC->hParamIsmRendering = NULL; + st_ivas->hDirAC = hDirAC; + } + + + /*-----------------------------------------------------------------* + * DirAC main configuration + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_dirac_config( (void *) st_ivas, DEC ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( flag_config == DIRAC_OPEN ) + { + hDirAC->spar_to_dirac_write_idx = 0; + hDirAC->dithering_seed = DIRAC_DITH_SEED; + st_ivas->hDirAC = hDirAC; + } + + return error; +} + +static ivas_error ivas_dirac_rend_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const int16_t dec_param_estim_old ) { DIRAC_DEC_HANDLE hDirAC; @@ -262,27 +292,30 @@ ivas_error ivas_dirac_dec_config( float *proto_frame_f_old; int16_t proto_signal_decorr_on_old; uint16_t i, j, k; - int16_t dec_param_estim_old; float ls_azimuth[MAX_OUTPUT_CHANNELS]; float ls_elevation[MAX_OUTPUT_CHANNELS]; int32_t output_Fs, ivas_total_brate; ivas_error error; int16_t nchan_transport_orig; int16_t hodirac_flag; - int16_t map_idx; DIRAC_CONFIG_FLAG flag_config; + DIRAC_REND_HANDLE hDirACRend; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; error = IVAS_ERR_OK; - hDirAC = NULL; + hDirACRend = NULL; output_Fs = st_ivas->hDecoderConfig->output_Fs; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); + hDirAC = st_ivas->hDirAC; + rend_common_data = st_ivas->rend_common_data; + if ( flag_config == DIRAC_RECONFIGURE ) { - hDirAC = st_ivas->hDirAC; + hDirACRend = st_ivas->hDirACRend; } else if ( flag_config == DIRAC_OPEN ) { @@ -290,29 +323,21 @@ ivas_error ivas_dirac_dec_config( * prepare library opening *-----------------------------------------------------------------*/ - if ( ( hDirAC = (DIRAC_DEC_HANDLE) malloc( sizeof( DIRAC_DEC_DATA ) ) ) == NULL ) + if ( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC renderer\n" ) ); } - if ( ( hDirAC->hConfig = (DIRAC_CONFIG_DATA_HANDLE) malloc( sizeof( DIRAC_CONFIG_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); - } nchan_transport_old = 0; - hDirAC->hParamIsm = NULL; - hDirAC->hParamIsmRendering = NULL; - st_ivas->hDirAC = hDirAC; } - dec_param_estim_old = ( flag_config == DIRAC_RECONFIGURE ) ? hDirAC->hConfig->dec_param_estim : FALSE; nchan_transport_old = 0; num_outputs_dir_old = 0; num_outputs_diff_old = 0; num_protos_diff_old = 0; nchan_transport_orig = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == SBA_FORMAT && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + if ( st_ivas->ivas_format == SBA_FORMAT ) { st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); } @@ -329,58 +354,40 @@ ivas_error ivas_dirac_dec_config( ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport_old, st_ivas->sba_planar, &tmp1, &tmp2, &tmp3 ); } - /*-----------------------------------------------------------------* - * DirAC main configuration - *-----------------------------------------------------------------*/ - - if ( ( error = ivas_dirac_config( (void *) st_ivas, DEC ) ) != IVAS_ERR_OK ) - { - return error; - } - /*-----------------------------------------------------------------* * output setup: for parametric binaural renderer, use output setup, otherwise internal setup *-----------------------------------------------------------------*/ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - hDirAC->hOutSetup = st_ivas->hOutSetup; + hDirACRend->hOutSetup = st_ivas->hIntSetup; + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; - hDirAC->hConfig->dec_param_estim = FALSE; - } - else + if ( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) { - hDirAC->hOutSetup = st_ivas->hIntSetup; + mvr2r( hDirACRend->hOutSetup.ls_azimuth, ls_azimuth, nchan_out_woLFE ); + mvr2r( hDirACRend->hOutSetup.ls_elevation, ls_elevation, nchan_out_woLFE ); } - nchan_out_woLFE = hDirAC->hOutSetup.nchan_out_woLFE; - if ( hDirAC->hOutSetup.ls_azimuth != NULL && hDirAC->hOutSetup.ls_elevation != NULL ) + if ( hDirACRend->hOutSetup.ambisonics_order == -1 ) { - mvr2r( hDirAC->hOutSetup.ls_azimuth, ls_azimuth, nchan_out_woLFE ); - mvr2r( hDirAC->hOutSetup.ls_elevation, ls_elevation, nchan_out_woLFE ); - } - - if ( hDirAC->hOutSetup.ambisonics_order == -1 ) - { - hDirAC->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ - if ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_MONO || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_STEREO ) + hDirACRend->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ + if ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_MONO || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_STEREO ) { - hDirAC->hOutSetup.ambisonics_order = SBA_FOA_ORDER; + hDirACRend->hOutSetup.ambisonics_order = SBA_FOA_ORDER; } } - else if ( hDirAC->hOutSetup.ambisonics_order >= SBA_FOA_ORDER ) + else if ( hDirACRend->hOutSetup.ambisonics_order >= SBA_FOA_ORDER ) { mvr2r( ls_azimuth_4d4, ls_azimuth, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); mvr2r( ls_elevation_4d4, ls_elevation, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); } - if ( hDirAC->hOutSetup.separateChannelEnabled && ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) { /* Remove the channel of the separated signal from the output setup of the spatial synthesis */ - hDirAC->hOutSetup.nchan_out_woLFE--; - nchan_out_woLFE = hDirAC->hOutSetup.nchan_out_woLFE; - mvr2r( &ls_azimuth[hDirAC->hOutSetup.separateChannelIndex + 1], &ls_azimuth[hDirAC->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirAC->hOutSetup.separateChannelIndex ); - mvr2r( &ls_elevation[hDirAC->hOutSetup.separateChannelIndex + 1], &ls_elevation[hDirAC->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirAC->hOutSetup.separateChannelIndex ); + hDirACRend->hOutSetup.nchan_out_woLFE--; + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; + mvr2r( &ls_azimuth[hDirACRend->hOutSetup.separateChannelIndex + 1], &ls_azimuth[hDirACRend->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirACRend->hOutSetup.separateChannelIndex ); + mvr2r( &ls_elevation[hDirACRend->hOutSetup.separateChannelIndex + 1], &ls_elevation[hDirACRend->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirACRend->hOutSetup.separateChannelIndex ); } /*-----------------------------------------------------------------* @@ -389,100 +396,62 @@ ivas_error ivas_dirac_dec_config( st_ivas->nchan_transport = nchan_transport_orig; - if ( flag_config == DIRAC_OPEN ) - { - hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); - set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - hDirAC->subframes_rendered = 0; - hDirAC->slots_rendered = 0; - hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - } - - if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE && ( ( ivas_total_brate > IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_256k ) || ( ivas_total_brate <= IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate > IVAS_256k ) ) ) - { - if ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k && hDirAC->azimuth2 == NULL ) - { - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 2 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_256k && hDirAC->azimuth2 != NULL ) - { - ivas_dirac_deallocate_parameters( hDirAC, 2 ); - } - } - - /* band config needed only for SPAR with FOA output */ - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) - { - return IVAS_ERR_OK; - } - - if ( nchan_transport_orig > 2 && hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC && !hodirac_flag ) + if ( nchan_transport_orig > 2 && hDirACRend->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC && !hodirac_flag ) { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; - hDirAC->panningConf = DIRAC_PANNING_VBAP; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; + hDirACRend->panningConf = DIRAC_PANNING_VBAP; } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_MONO ) { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; - hDirAC->panningConf = DIRAC_PANNING_VBAP; - } - else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.output_config == AUDIO_CONFIG_MONO ) - { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_MONO; - hDirAC->panningConf = DIRAC_PANNING_HOA3; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_MONO; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; nchan_out_woLFE = 1; } - else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.is_loudspeaker_setup ) + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->hOutSetup.is_loudspeaker_setup ) { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; - hDirAC->panningConf = DIRAC_PANNING_VBAP; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; + hDirACRend->panningConf = DIRAC_PANNING_VBAP; } - else if ( st_ivas->ivas_format == MASA_FORMAT && !hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) + else if ( st_ivas->ivas_format == MASA_FORMAT && !hDirACRend->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; - hDirAC->panningConf = DIRAC_PANNING_HOA3; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; } else { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; - hDirAC->panningConf = DIRAC_PANNING_HOA3; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; } if ( flag_config == DIRAC_OPEN ) { - hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); - if ( ( hDirAC->frequency_axis = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->frequency_axis = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->frequency_axis, 0.0f, hDirAC->num_freq_bands ); + set_f( hDirACRend->frequency_axis, 0.0f, rend_common_data->num_freq_bands ); - ivas_dirac_dec_get_frequency_axis( hDirAC->frequency_axis, output_Fs, hDirAC->num_freq_bands ); + ivas_dirac_dec_get_frequency_axis( hDirACRend->frequency_axis, output_Fs, rend_common_data->num_freq_bands ); } - if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) { - if ( ( flag_config == DIRAC_RECONFIGURE && hDirAC->masa_stereo_type_detect == NULL ) || flag_config == DIRAC_OPEN ) + if ( ( flag_config == DIRAC_RECONFIGURE && hDirACRend->masa_stereo_type_detect == NULL ) || flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + if ( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - ivas_masa_init_stereotype_detection( hDirAC->masa_stereo_type_detect ); + ivas_masa_init_stereotype_detection( hDirACRend->masa_stereo_type_detect ); } else { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->masa_stereo_type_detect != NULL ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->masa_stereo_type_detect != NULL ) { - free( hDirAC->masa_stereo_type_detect ); + free( hDirACRend->masa_stereo_type_detect ); } - hDirAC->masa_stereo_type_detect = NULL; + hDirACRend->masa_stereo_type_detect = NULL; } /*-----------------------------------------------------------------* @@ -492,45 +461,39 @@ ivas_error ivas_dirac_dec_config( /* prototype signal computation */ if ( flag_config == DIRAC_RECONFIGURE ) { - num_outputs_dir_old = hDirAC->num_outputs_dir; - num_outputs_diff_old = hDirAC->num_outputs_diff; - num_protos_diff_old = hDirAC->num_protos_diff; + num_outputs_dir_old = hDirACRend->num_outputs_dir; + num_outputs_diff_old = hDirACRend->num_outputs_diff; + num_protos_diff_old = hDirACRend->num_protos_diff; } /* allocate output setup related arrays */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - /* Two channels in parametric binaural rendering */ - hDirAC->num_outputs_diff = 2; - hDirAC->num_outputs_dir = 2; - } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) { /* Directional and diffuses components in output LS format */ - hDirAC->num_outputs_diff = nchan_out_woLFE; - hDirAC->num_outputs_dir = nchan_out_woLFE; + hDirACRend->num_outputs_diff = nchan_out_woLFE; + hDirACRend->num_outputs_dir = nchan_out_woLFE; } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /* Directional and diffuses components in SHD */ /* Diffuseness components up to 1st order */ - hDirAC->num_outputs_diff = ( min( hDirAC->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirAC->hOutSetup.ambisonics_order, 1 ) + 1 ); - if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ivas_total_brate >= IVAS_96k ) && ( hDirAC->hOutSetup.ambisonics_order > 1 ) && ( nchan_transport < 4 ) ) + hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); + if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ivas_total_brate >= IVAS_96k ) && ( hDirACRend->hOutSetup.ambisonics_order > 1 ) && ( nchan_transport < 4 ) ) { - hDirAC->num_outputs_diff += 2; /* Add 2nd-order planar components for HRs */ + hDirACRend->num_outputs_diff += 2; /* Add 2nd-order planar components for HRs */ } - hDirAC->num_outputs_dir = ivas_sba_get_nchan( hDirAC->hOutSetup.ambisonics_order, 0 ); + hDirACRend->num_outputs_dir = ivas_sba_get_nchan( hDirACRend->hOutSetup.ambisonics_order, 0 ); } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - hDirAC->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; - hDirAC->num_outputs_dir = nchan_out_woLFE; + hDirACRend->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; + hDirACRend->num_outputs_dir = nchan_out_woLFE; } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - hDirAC->num_outputs_diff = 1; /* There is one output channel in mono */ - hDirAC->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ + hDirACRend->num_outputs_diff = 1; /* There is one output channel in mono */ + hDirACRend->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ } else { @@ -539,154 +502,135 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - num_outputs_dir_old = hDirAC->num_outputs_dir; - if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + num_outputs_dir_old = hDirACRend->num_outputs_dir; + if ( ( hDirACRend->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - num_outputs_diff_old = hDirAC->num_outputs_diff; - if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + num_outputs_diff_old = hDirACRend->num_outputs_diff; + if ( ( hDirACRend->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - if ( hDirAC->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) + if ( hDirACRend->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) { - free( hDirAC->proto_index_dir ); - if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + free( hDirACRend->proto_index_dir ); + if ( ( hDirACRend->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_s( hDirAC->proto_index_dir, 0, hDirAC->num_outputs_dir ); + set_s( hDirACRend->proto_index_dir, 0, hDirACRend->num_outputs_dir ); - if ( hDirAC->num_outputs_diff != num_outputs_diff_old && flag_config == DIRAC_RECONFIGURE ) + if ( hDirACRend->num_outputs_diff != num_outputs_diff_old && flag_config == DIRAC_RECONFIGURE ) { - free( hDirAC->proto_index_diff ); - if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + free( hDirACRend->proto_index_diff ); + if ( ( hDirACRend->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); + set_s( hDirACRend->proto_index_diff, 0, hDirACRend->num_outputs_diff ); - hDirAC->sba_map_tc = sba_map_tc; + hDirACRend->sba_map_tc = sba_map_tc; if ( st_ivas->ivas_format == SBA_FORMAT ) { if ( st_ivas->sba_order > SBA_FOA_ORDER && ivas_total_brate >= IVAS_512k ) { - hDirAC->sba_map_tc = sba_map_tc_512; + hDirACRend->sba_map_tc = sba_map_tc_512; } } if ( nchan_transport == 1 ) { - hDirAC->num_protos_ambi = 1; - hDirAC->num_protos_dir = 1; - hDirAC->num_protos_diff = 1; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - hDirAC->num_protos_dir = 2; - hDirAC->num_protos_diff = 2; - hDirAC->proto_index_dir[0] = 0; - hDirAC->proto_index_dir[1] = 1; - hDirAC->proto_index_diff[0] = 0; - hDirAC->proto_index_diff[1] = 1; - } + hDirACRend->num_protos_ambi = 1; + hDirACRend->num_protos_dir = 1; + hDirACRend->num_protos_diff = 1; } else if ( nchan_transport == 2 ) { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC->num_protos_ambi = 2; - hDirAC->num_protos_diff = 1; - hDirAC->num_protos_dir = 2; - hDirAC->proto_index_dir[1] = 1; + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_diff = 1; + hDirACRend->num_protos_dir = 2; + hDirACRend->proto_index_dir[1] = 1; } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - hDirAC->num_protos_dir = 2; - hDirAC->num_protos_diff = 2; - hDirAC->proto_index_dir[0] = 0; - hDirAC->proto_index_dir[1] = 1; - hDirAC->proto_index_diff[0] = 0; - hDirAC->proto_index_diff[1] = 1; - } - else if ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_MONO ) + else if ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_MONO ) { /* Following the foa rendering for code compatibility */ - hDirAC->num_protos_ambi = 2; - hDirAC->num_protos_dir = 2; - hDirAC->num_protos_diff = 3; - hDirAC->proto_index_dir[0] = 0; - hDirAC->proto_index_diff[0] = 0; + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_dir = 2; + hDirACRend->num_protos_diff = 3; + hDirACRend->proto_index_dir[0] = 0; + hDirACRend->proto_index_diff[0] = 0; } else { - hDirAC->num_protos_ambi = 2; - hDirAC->num_protos_diff = 3; + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_diff = 3; - for ( k = 0; k < hDirAC->num_outputs_diff; k++ ) + for ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { if ( ls_azimuth[k] > 0.0f ) { - hDirAC->proto_index_diff[k] = 1; + hDirACRend->proto_index_diff[k] = 1; } else if ( ls_azimuth[k] < 0.0f ) { - hDirAC->proto_index_diff[k] = 2; + hDirACRend->proto_index_diff[k] = 2; } else { - hDirAC->proto_index_diff[k] = 0; + hDirACRend->proto_index_diff[k] = 0; } } - if ( hDirAC->hOutSetup.is_loudspeaker_setup ) + if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - hDirAC->num_protos_dir = 3; - mvs2s( hDirAC->proto_index_diff, hDirAC->proto_index_dir, nchan_out_woLFE ); + hDirACRend->num_protos_dir = 3; + mvs2s( hDirACRend->proto_index_diff, hDirACRend->proto_index_dir, nchan_out_woLFE ); } else { - hDirAC->num_protos_dir = 2; - hDirAC->proto_index_dir[1] = 1; + hDirACRend->num_protos_dir = 2; + hDirACRend->proto_index_dir[1] = 1; } } } else /* nchan_transport > 2 */ { - hDirAC->num_protos_ambi = 4; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + hDirACRend->num_protos_ambi = 4; + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) { - hDirAC->num_protos_diff = hDirAC->num_outputs_diff; - for ( k = 0; k < hDirAC->num_outputs_diff; k++ ) + hDirACRend->num_protos_diff = hDirACRend->num_outputs_diff; + for ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { - hDirAC->proto_index_diff[k] = k; + hDirACRend->proto_index_diff[k] = k; } - hDirAC->num_protos_dir = hDirAC->num_outputs_dir; - for ( k = 0; k < hDirAC->num_outputs_dir; k++ ) + hDirACRend->num_protos_dir = hDirACRend->num_outputs_dir; + for ( k = 0; k < hDirACRend->num_outputs_dir; k++ ) { - hDirAC->proto_index_dir[k] = k; + hDirACRend->proto_index_dir[k] = k; } } else { - hDirAC->num_protos_diff = 1; - hDirAC->num_protos_dir = nchan_transport; - if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT ) ) ) + hDirACRend->num_protos_diff = 1; + hDirACRend->num_protos_dir = nchan_transport; + if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT ) ) ) // Todo Dolby/FhG refactor: Is this ever true? { - hDirAC->num_protos_dir++; + hDirACRend->num_protos_dir++; } - for ( k = 0; k < min( hDirAC->num_outputs_dir, hDirAC->num_protos_dir ); k++ ) + for ( k = 0; k < min( hDirACRend->num_outputs_dir, hDirACRend->num_protos_dir ); k++ ) { - if ( hDirAC->sba_map_tc[k] < hDirAC->num_outputs_dir ) + if ( hDirACRend->sba_map_tc[k] < hDirACRend->num_outputs_dir ) { - hDirAC->proto_index_dir[hDirAC->sba_map_tc[k]] = k; + hDirACRend->proto_index_dir[hDirACRend->sba_map_tc[k]] = k; } } } @@ -695,61 +639,61 @@ ivas_error ivas_dirac_dec_config( /* direct/diffuse responses */ if ( flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } /* reallocate static memory */ - else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->num_outputs_dir != num_outputs_dir_old ) + else if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->num_outputs_dir != num_outputs_dir_old ) { - free( hDirAC->diffuse_response_function ); - hDirAC->diffuse_response_function = NULL; - if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + free( hDirACRend->diffuse_response_function ); + hDirACRend->diffuse_response_function = NULL; + if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - if ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) + if ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) { - initDiffuseResponses( hDirAC->diffuse_response_function, nchan_out_woLFE, hDirAC->hOutSetup.output_config, - hDirAC->hOutSetup, hDirAC->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirAC->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); + initDiffuseResponses( hDirACRend->diffuse_response_function, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, + hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); } else { - initDiffuseResponses( hDirAC->diffuse_response_function, hDirAC->num_outputs_dir, AUDIO_CONFIG_FOA, - hDirAC->hOutSetup, hDirAC->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirAC->num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG_INVALID ); + initDiffuseResponses( hDirACRend->diffuse_response_function, hDirACRend->num_outputs_dir, AUDIO_CONFIG_FOA, + hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG_INVALID ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { if ( flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder && ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) + else if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->hoa_encoder && ( hDirACRend->num_outputs_diff != num_outputs_diff_old ) ) { - free( hDirAC->hoa_encoder ); - hDirAC->hoa_encoder = NULL; - if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + free( hDirACRend->hoa_encoder ); + hDirACRend->hoa_encoder = NULL; + if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_f( hDirAC->hoa_encoder, 0.0f, nchan_out_woLFE * hDirAC->num_outputs_diff ); - compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirAC->hoa_encoder, hDirAC->num_outputs_diff, hDirAC->hOutSetup.ambisonics_order ); + set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); + compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirACRend->hoa_encoder, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); } else { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->hoa_encoder ) { - free( hDirAC->hoa_encoder ); + free( hDirACRend->hoa_encoder ); } - hDirAC->hoa_encoder = NULL; + hDirACRend->hoa_encoder = NULL; } /* VBAP */ @@ -758,7 +702,7 @@ ivas_error ivas_dirac_dec_config( st_ivas->hVBAPdata = NULL; } - if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) + if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) { if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { @@ -770,13 +714,13 @@ ivas_error ivas_dirac_dec_config( return error; } } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } - hDirAC->hoa_decoder = NULL; + hDirACRend->hoa_decoder = NULL; } else if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { @@ -786,67 +730,67 @@ ivas_error ivas_dirac_dec_config( /* HOA panning/dec */ if ( flag_config == DIRAC_OPEN ) { - hDirAC->hoa_decoder = NULL; - if ( ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->ivas_format == SBA_FORMAT || ( nchan_transport > 2 ) ) + hDirACRend->hoa_decoder = NULL; + if ( ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->ivas_format == SBA_FORMAT || ( nchan_transport > 2 ) ) { - if ( hDirAC->hOutSetup.is_loudspeaker_setup ) + if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { if ( st_ivas->hoa_dec_mtx != NULL ) { free( st_ivas->hoa_dec_mtx ); st_ivas->hoa_dec_mtx = NULL; } - if ( ( error = ivas_sba_get_hoa_dec_matrix( hDirAC->hOutSetup, &st_ivas->hoa_dec_mtx, hDirAC->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_get_hoa_dec_matrix( hDirACRend->hOutSetup, &st_ivas->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } - hDirAC->hoa_decoder = st_ivas->hoa_dec_mtx; + hDirACRend->hoa_decoder = st_ivas->hoa_dec_mtx; } } } /* decorrelation */ - proto_signal_decorr_on_old = ( flag_config == DIRAC_RECONFIGURE ) ? hDirAC->proto_signal_decorr_on : 0; - hDirAC->proto_signal_decorr_on = 1; - if ( ( nchan_transport > 2 ) && ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) ) + proto_signal_decorr_on_old = ( flag_config == DIRAC_RECONFIGURE ) ? hDirACRend->proto_signal_decorr_on : 0; + hDirACRend->proto_signal_decorr_on = 1; + if ( ( nchan_transport > 2 ) && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) ) { /*switch off decorrelation for 4 transport channels*/ - hDirAC->proto_signal_decorr_on = 0; + hDirACRend->proto_signal_decorr_on = 0; } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - hDirAC->proto_signal_decorr_on = 0; + hDirACRend->proto_signal_decorr_on = 0; } - if ( ( flag_config == DIRAC_OPEN && hDirAC->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) + if ( ( flag_config == DIRAC_OPEN && hDirACRend->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirACRend->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), + &( hDirACRend->h_freq_domain_decorr_ap_state ), + rend_common_data->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + hDirACRend->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; } } - else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) + else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirACRend->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { - ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); } - else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) + else if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_signal_decorr_on && proto_signal_decorr_on_old ) { - if ( nchan_transport != nchan_transport_old || hDirAC->num_outputs_diff != num_outputs_diff_old || flag_config_inp == DIRAC_RECONFIGURE_MODE ) + if ( nchan_transport != nchan_transport_old || hDirACRend->num_outputs_diff != num_outputs_diff_old || flag_config_inp == DIRAC_RECONFIGURE_MODE ) { /* close and reopen the decorrelator */ - ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), &( hDirAC->h_freq_domain_decorr_ap_state ), hDirAC->num_freq_bands, hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, hDirAC->synthesisConf, hDirAC->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), rend_common_data->num_freq_bands, hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -856,54 +800,54 @@ ivas_error ivas_dirac_dec_config( /* output synthesis */ if ( flag_config == DIRAC_OPEN ) { - if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( rend_common_data, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } - hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; } - else if ( ( flag_config == DIRAC_RECONFIGURE ) && ( ( nchan_transport != nchan_transport_old ) || ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) ) + else if ( ( flag_config == DIRAC_RECONFIGURE ) && ( ( nchan_transport != nchan_transport_old ) || ( hDirACRend->num_outputs_diff != num_outputs_diff_old ) ) ) { - ivas_dirac_dec_output_synthesis_close( hDirAC ); + ivas_dirac_dec_output_synthesis_close( hDirACRend ); - if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( rend_common_data, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } - hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC->h_output_synthesis_psd_params.use_onset_filters = 0; + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = 0; } /*-----------------------------------------------------------------* * memory allocation *-----------------------------------------------------------------*/ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_frame_f ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_frame_f ) { - free( hDirAC->proto_frame_f ); + free( hDirACRend->proto_frame_f ); } - hDirAC->proto_frame_f = NULL; + hDirACRend->proto_frame_f = NULL; } else { - if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_frame_f == NULL ) ) + if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_frame_f == NULL ) ) { - if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * rend_common_data->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - else if ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->num_protos_diff != num_protos_diff_old ) ) + else if ( flag_config == DIRAC_RECONFIGURE && ( hDirACRend->num_protos_diff != num_protos_diff_old ) ) { - proto_frame_f_old = hDirAC->proto_frame_f; + proto_frame_f_old = hDirACRend->proto_frame_f; free( proto_frame_f_old ); - if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * rend_common_data->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -913,31 +857,31 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - hDirAC->buffer_energy = NULL; + hDirACRend->buffer_energy = NULL; } if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == TRUE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == TRUE && dec_param_estim_old == FALSE ) ) ) { - hDirAC->index_buffer_intensity = 0; + hDirACRend->index_buffer_intensity = 0; for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); + set_f( hDirACRend->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); } } - if ( hDirAC->buffer_energy == NULL ) + if ( hDirACRend->buffer_energy == NULL ) { - if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); + set_f( hDirACRend->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } else if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == FALSE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == FALSE && dec_param_estim_old == TRUE ) ) ) { @@ -945,124 +889,366 @@ ivas_error ivas_dirac_dec_config( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->buffer_intensity_real[i][j] ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->buffer_intensity_real[i][j] ) { - free( hDirAC->buffer_intensity_real[i][j] ); + free( hDirACRend->buffer_intensity_real[i][j] ); } - hDirAC->buffer_intensity_real[i][j] = NULL; + hDirACRend->buffer_intensity_real[i][j] = NULL; } } - if ( hDirAC->buffer_energy != NULL ) + if ( hDirACRend->buffer_energy != NULL ) { - free( hDirAC->buffer_energy ); - hDirAC->buffer_energy = NULL; + free( hDirACRend->buffer_energy ); + hDirACRend->buffer_energy = NULL; } } /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE, hodirac_flag ); + ivas_dirac_dec_output_synthesis_init( rend_common_data, hDirACRend, nchan_out_woLFE, hodirac_flag ); /* Allocate stack memory */ if ( flag_config != DIRAC_OPEN ) { - ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); + ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); } - if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_alloc_mem( hDirACRend, st_ivas->renderer_type, rend_common_data->num_freq_bands, &( hDirACRend->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } - mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); + if ( flag_config == DIRAC_OPEN ) + { + st_ivas->hDirACRend = hDirACRend; + } + + return error; +} + +static ivas_error ivas_spat_rend_common_data_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ +) +{ + DIRAC_DEC_HANDLE hDirAC; + int32_t ivas_total_brate; + int32_t output_Fs; + ivas_error error; + int16_t hodirac_flag; + int16_t map_idx; + DIRAC_CONFIG_FLAG flag_config; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + + flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; + error = IVAS_ERR_OK; + + rend_common_data = NULL; + hDirAC = st_ivas->hDirAC; + output_Fs = st_ivas->hDecoderConfig->output_Fs; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); + + if ( flag_config == DIRAC_RECONFIGURE ) + { + rend_common_data = st_ivas->rend_common_data; + } + else if ( flag_config == DIRAC_OPEN ) + { + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( rend_common_data = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC meta\n" ) ); + } + + st_ivas->rend_common_data = rend_common_data; + } + if ( flag_config == DIRAC_OPEN ) { - hDirAC->dirac_md_buffer_length = 0; - hDirAC->dirac_bs_md_write_idx = 0; - hDirAC->dirac_read_idx = 0; - hDirAC->spar_to_dirac_write_idx = 0; + rend_common_data->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + set_s( rend_common_data->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( rend_common_data->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + rend_common_data->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + rend_common_data->subframes_rendered = 0; + rend_common_data->slots_rendered = 0; + rend_common_data->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + rend_common_data->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + } + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE ) + { + if ( hodirac_flag && rend_common_data->azimuth2 == NULL ) + { + if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( !hodirac_flag && rend_common_data->azimuth2 != NULL ) + { + ivas_dirac_deallocate_parameters( rend_common_data, 2 ); + } + } + + if ( flag_config == DIRAC_OPEN ) + { + rend_common_data->dirac_md_buffer_length = 0; + rend_common_data->dirac_bs_md_write_idx = 0; + rend_common_data->dirac_read_idx = 0; if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + rend_common_data->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) { - hDirAC->render_to_md_map[map_idx] = map_idx; + rend_common_data->render_to_md_map[map_idx] = map_idx; } } else if ( st_ivas->ivas_format == MASA_FORMAT ) { - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; - hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; + rend_common_data->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; + rend_common_data->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) { - hDirAC->render_to_md_map[map_idx] = map_idx; + rend_common_data->render_to_md_map[map_idx] = map_idx; } } else { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; - hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); - hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + rend_common_data->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); + rend_common_data->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - hDirAC->dirac_read_idx = 0; - hDirAC->dirac_estimator_idx = 0; + rend_common_data->dirac_read_idx = 0; - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS * num_slots_in_subfr; map_idx++ ) { - hDirAC->render_to_md_map[map_idx] = hDirAC->dirac_read_idx + map_idx / num_slots_in_subfr; + rend_common_data->render_to_md_map[map_idx] = rend_common_data->dirac_read_idx + map_idx / num_slots_in_subfr; } } - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 1 ) ) != IVAS_ERR_OK ) { return error; } - if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) ) + if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && hodirac_flag ) ) { - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 2 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 2 ) ) != IVAS_ERR_OK ) { return error; } } else { - hDirAC->azimuth2 = NULL; - hDirAC->elevation2 = NULL; - hDirAC->energy_ratio2 = NULL; - hDirAC->spreadCoherence2 = NULL; + rend_common_data->azimuth2 = NULL; + rend_common_data->elevation2 = NULL; + rend_common_data->energy_ratio2 = NULL; + rend_common_data->spreadCoherence2 = NULL; } + } - hDirAC->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + return error; +} - hDirAC->dithering_seed = DIRAC_DITH_SEED; - st_ivas->hDirAC = hDirAC; + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_config() + * + * Open or reconfigure decoder DirAC/MASA handle + *-------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_dec_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ +) +{ + ivas_error error; + int16_t hodirac_flag; + //int32_t output_Fs; + int32_t ivas_total_brate; + int16_t sparfoa_flag; + DIRAC_CONFIG_FLAG dec_config_flag; + DIRAC_CONFIG_FLAG rend_config_flag; + DIRAC_CONFIG_FLAG common_rend_config_flag; + int16_t need_dirac_rend; + int16_t need_parambin; + int16_t dec_param_estim_old; + + error = IVAS_ERR_OK; + + /* Solve and setup flags for inits */ + dec_config_flag = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; + + //output_Fs = st_ivas->hDecoderConfig->output_Fs; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); + dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE; + + + sparfoa_flag = 0; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) + { + sparfoa_flag = 1; } - /* allocate transport channels*/ - if ( flag_config == DIRAC_OPEN ) + if ( ( error = ivas_dirac_dec_config_internal( st_ivas, dec_config_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* This is required for parambin */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + st_ivas->hDirAC->hConfig->dec_param_estim = FALSE; + } + + + /* Setup renderers and meta */ + /* First, free everything if in reconfig and not the active renderer */ + need_parambin = 0; + switch ( st_ivas->renderer_type ) + { + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + case RENDERER_STEREO_PARAMETRIC: + need_parambin = 1; + break; + default: + need_parambin = 0; + } + + if ( !need_parambin ) + { + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + } + + need_dirac_rend = 0; + switch ( st_ivas->renderer_type ) + { + case RENDERER_DIRAC: + case RENDERER_BINAURAL_FASTCONV: + case RENDERER_BINAURAL_FASTCONV_ROOM: + case RENDERER_SBA_LINEAR_ENC: + case RENDERER_SBA_LINEAR_DEC: + need_dirac_rend = 1; + break; + default: + need_dirac_rend = 0; + } + + if ( !need_dirac_rend ) + { + ivas_dirac_rend_close( &st_ivas->hDirACRend ); + } + + if ( !sparfoa_flag ) + { + common_rend_config_flag = st_ivas->rend_common_data == NULL ? DIRAC_OPEN : flag_config_inp; + if ( (error = ivas_spat_rend_common_data_config( st_ivas, common_rend_config_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( need_dirac_rend ) + { + rend_config_flag = st_ivas->hDirACRend == NULL ? DIRAC_OPEN : flag_config_inp; + if ( ( error = ivas_dirac_rend_config( st_ivas, rend_config_flag, dec_param_estim_old ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( need_parambin ) + { + if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( st_ivas->hDiracDecBin == NULL ) + { + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */ + if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !(st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 )) + { + ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); + } + + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( !st_ivas->hDiracDecBin->useTdDecorr ) + { + if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) + { + float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->rend_common_data->num_freq_bands ); + if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), + st_ivas->rend_common_data->num_freq_bands, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + } + } + } + + /* Allocate transport channel buffers for SBA format when in JBM */ + if ( dec_config_flag == DIRAC_OPEN ) { if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { if ( st_ivas->ivas_format == SBA_FORMAT ) { int16_t nchan_to_allocate; + int16_t nchan_transport; + + nchan_transport = st_ivas->nchan_transport; nchan_to_allocate = nchan_transport; - if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { nchan_to_allocate++; /* we need a channel for the CNG in this case*/ } - 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 ) { nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, hDirAC->slot_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, st_ivas->rend_common_data->slot_size ) ) != IVAS_ERR_OK ) { return error; } @@ -1081,10 +1267,9 @@ ivas_error ivas_dirac_dec_config( *------------------------------------------------------------------------*/ void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE *hDirAC_out /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC_out ) { - int16_t i, j; DIRAC_DEC_HANDLE hDirAC; if ( hDirAC_out == NULL || *hDirAC_out == NULL ) @@ -1101,93 +1286,130 @@ void ivas_dirac_dec_close( hDirAC->hConfig = NULL; } + free( *hDirAC_out ); + *hDirAC_out = NULL; + + return; +} + +void ivas_spat_rend_common_data_close( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out +) +{ + if ( rend_common_data_out == NULL || *rend_common_data_out == NULL ) + { + return; + } + + ivas_dirac_deallocate_parameters( *rend_common_data_out, 1 ); + ivas_dirac_deallocate_parameters( *rend_common_data_out, 2 ); + + free( *rend_common_data_out ); + *rend_common_data_out = NULL; + + return; + +} + +void ivas_dirac_rend_close( + DIRAC_REND_HANDLE *hDirACRend_out +) +{ + int16_t i, j; + DIRAC_REND_HANDLE hDirACRend; + + if ( hDirACRend_out == NULL || *hDirACRend_out == NULL ) + { + return; + } + + hDirACRend = *hDirACRend_out; + /* close Output synthesis sub-module */ - ivas_dirac_dec_output_synthesis_close( hDirAC ); + ivas_dirac_dec_output_synthesis_close( hDirACRend ); /* close Decorrelator sub-module */ - if ( hDirAC->proto_signal_decorr_on ) + if ( hDirACRend->proto_signal_decorr_on ) { - ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); } /* Params */ /* free frequency axis buffer */ - if ( hDirAC->frequency_axis != NULL ) + if ( hDirACRend->frequency_axis != NULL ) { - free( hDirAC->frequency_axis ); - hDirAC->frequency_axis = NULL; + free( hDirACRend->frequency_axis ); + hDirACRend->frequency_axis = NULL; } - if ( hDirAC->diffuse_response_function != NULL ) + if ( hDirACRend->diffuse_response_function != NULL ) { - free( hDirAC->diffuse_response_function ); - hDirAC->diffuse_response_function = NULL; + free( hDirACRend->diffuse_response_function ); + hDirACRend->diffuse_response_function = NULL; } - if ( hDirAC->hoa_encoder != NULL ) + if ( hDirACRend->hoa_encoder != NULL ) { - free( hDirAC->hoa_encoder ); - hDirAC->hoa_encoder = NULL; + free( hDirACRend->hoa_encoder ); + hDirACRend->hoa_encoder = NULL; } /* prototype indexing */ - if ( hDirAC->proto_index_dir != NULL ) + if ( hDirACRend->proto_index_dir != NULL ) { - free( hDirAC->proto_index_dir ); - hDirAC->proto_index_dir = NULL; + free( hDirACRend->proto_index_dir ); + hDirACRend->proto_index_dir = NULL; } - if ( hDirAC->proto_index_diff != NULL ) + if ( hDirACRend->proto_index_diff != NULL ) { - free( hDirAC->proto_index_diff ); - hDirAC->proto_index_dir = NULL; + free( hDirACRend->proto_index_diff ); + hDirACRend->proto_index_dir = NULL; } /* States */ /* free prototype signal buffers */ - if ( hDirAC->proto_frame_f != NULL ) + if ( hDirACRend->proto_frame_f != NULL ) { - free( hDirAC->proto_frame_f ); - hDirAC->proto_frame_f = NULL; + free( hDirACRend->proto_frame_f ); + hDirACRend->proto_frame_f = NULL; } for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - if ( hDirAC->buffer_intensity_real[i][j] != NULL ) + if ( hDirACRend->buffer_intensity_real[i][j] != NULL ) { - free( hDirAC->buffer_intensity_real[i][j] ); - hDirAC->buffer_intensity_real[i][j] = NULL; + free( hDirACRend->buffer_intensity_real[i][j] ); + hDirACRend->buffer_intensity_real[i][j] = NULL; } } } - if ( hDirAC->buffer_energy != NULL ) + if ( hDirACRend->buffer_energy != NULL ) { - free( hDirAC->buffer_energy ); - hDirAC->buffer_energy = NULL; + free( hDirACRend->buffer_energy ); + hDirACRend->buffer_energy = NULL; } - ivas_dirac_deallocate_parameters( hDirAC, 1 ); - ivas_dirac_deallocate_parameters( hDirAC, 2 ); - - if ( hDirAC->masa_stereo_type_detect != NULL ) + if ( hDirACRend->masa_stereo_type_detect != NULL ) { - free( hDirAC->masa_stereo_type_detect ); - hDirAC->masa_stereo_type_detect = NULL; + free( hDirACRend->masa_stereo_type_detect ); + hDirACRend->masa_stereo_type_detect = NULL; } - ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); + ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); - free( *hDirAC_out ); - *hDirAC_out = NULL; + free( *hDirACRend_out ); + *hDirACRend_out = NULL; return; } + /*------------------------------------------------------------------------- * ivas_dirac_deallocate_parameters() * @@ -1195,157 +1417,164 @@ void ivas_dirac_dec_close( *-------------------------------------------------------------------------*/ void ivas_dirac_deallocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ const int16_t params_flag /* i : set of parameters flag */ ) { int16_t i; + if ( rend_common_data == NULL ) + { + return; + } + + int16_t md_buffer_length = rend_common_data->dirac_md_buffer_length; + if ( params_flag == 1 ) { - if ( hDirAC->azimuth != NULL ) + if ( rend_common_data->azimuth != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->azimuth[i] != NULL ) + if ( rend_common_data->azimuth[i] != NULL ) { - free( hDirAC->azimuth[i] ); - hDirAC->azimuth[i] = NULL; + free( rend_common_data->azimuth[i] ); + rend_common_data->azimuth[i] = NULL; } } - free( hDirAC->azimuth ); - hDirAC->azimuth = NULL; + free( rend_common_data->azimuth ); + rend_common_data->azimuth = NULL; } - if ( hDirAC->elevation != NULL ) + if ( rend_common_data->elevation != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->elevation[i] != NULL ) + if ( rend_common_data->elevation[i] != NULL ) { - free( hDirAC->elevation[i] ); - hDirAC->elevation[i] = NULL; + free( rend_common_data->elevation[i] ); + rend_common_data->elevation[i] = NULL; } } - free( hDirAC->elevation ); - hDirAC->elevation = NULL; + free( rend_common_data->elevation ); + rend_common_data->elevation = NULL; } - if ( hDirAC->energy_ratio1 != NULL ) + if ( rend_common_data->energy_ratio1 != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->energy_ratio1[i] != NULL ) + if ( rend_common_data->energy_ratio1[i] != NULL ) { - free( hDirAC->energy_ratio1[i] ); - hDirAC->energy_ratio1[i] = NULL; + free( rend_common_data->energy_ratio1[i] ); + rend_common_data->energy_ratio1[i] = NULL; } } - free( hDirAC->energy_ratio1 ); - hDirAC->energy_ratio1 = NULL; + free( rend_common_data->energy_ratio1 ); + rend_common_data->energy_ratio1 = NULL; } - if ( hDirAC->diffuseness_vector != NULL ) + if ( rend_common_data->diffuseness_vector != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->diffuseness_vector[i] != NULL ) + if ( rend_common_data->diffuseness_vector[i] != NULL ) { - free( hDirAC->diffuseness_vector[i] ); - hDirAC->diffuseness_vector[i] = NULL; + free( rend_common_data->diffuseness_vector[i] ); + rend_common_data->diffuseness_vector[i] = NULL; } } - free( hDirAC->diffuseness_vector ); - hDirAC->diffuseness_vector = NULL; + free( rend_common_data->diffuseness_vector ); + rend_common_data->diffuseness_vector = NULL; } - if ( hDirAC->spreadCoherence != NULL ) + if ( rend_common_data->spreadCoherence != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->spreadCoherence[i] != NULL ) + if ( rend_common_data->spreadCoherence[i] != NULL ) { - free( hDirAC->spreadCoherence[i] ); - hDirAC->spreadCoherence[i] = NULL; + free( rend_common_data->spreadCoherence[i] ); + rend_common_data->spreadCoherence[i] = NULL; } } - free( hDirAC->spreadCoherence ); - hDirAC->spreadCoherence = NULL; + free( rend_common_data->spreadCoherence ); + rend_common_data->spreadCoherence = NULL; } - if ( hDirAC->surroundingCoherence != NULL ) + if ( rend_common_data->surroundingCoherence != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->surroundingCoherence[i] != NULL ) + if ( rend_common_data->surroundingCoherence[i] != NULL ) { - free( hDirAC->surroundingCoherence[i] ); - hDirAC->surroundingCoherence[i] = NULL; + free( rend_common_data->surroundingCoherence[i] ); + rend_common_data->surroundingCoherence[i] = NULL; } } - free( hDirAC->surroundingCoherence ); - hDirAC->surroundingCoherence = NULL; + free( rend_common_data->surroundingCoherence ); + rend_common_data->surroundingCoherence = NULL; } } else if ( params_flag == 2 ) { - if ( hDirAC->azimuth2 != NULL ) + if ( rend_common_data->azimuth2 != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->azimuth2[i] != NULL ) + if ( rend_common_data->azimuth2[i] != NULL ) { - free( hDirAC->azimuth2[i] ); - hDirAC->azimuth2[i] = NULL; + free( rend_common_data->azimuth2[i] ); + rend_common_data->azimuth2[i] = NULL; } } - free( hDirAC->azimuth2 ); - hDirAC->azimuth2 = NULL; + free( rend_common_data->azimuth2 ); + rend_common_data->azimuth2 = NULL; } - if ( hDirAC->elevation2 != NULL ) + if ( rend_common_data->elevation2 != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->elevation2[i] != NULL ) + if ( rend_common_data->elevation2[i] != NULL ) { - free( hDirAC->elevation2[i] ); - hDirAC->elevation2[i] = NULL; + free( rend_common_data->elevation2[i] ); + rend_common_data->elevation2[i] = NULL; } } - free( hDirAC->elevation2 ); - hDirAC->elevation2 = NULL; + free( rend_common_data->elevation2 ); + rend_common_data->elevation2 = NULL; } - if ( hDirAC->energy_ratio2 != NULL ) + if ( rend_common_data->energy_ratio2 != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->energy_ratio2[i] != NULL ) + if ( rend_common_data->energy_ratio2[i] != NULL ) { - free( hDirAC->energy_ratio2[i] ); - hDirAC->energy_ratio2[i] = NULL; + free( rend_common_data->energy_ratio2[i] ); + rend_common_data->energy_ratio2[i] = NULL; } } - free( hDirAC->energy_ratio2 ); - hDirAC->energy_ratio2 = NULL; + free( rend_common_data->energy_ratio2 ); + rend_common_data->energy_ratio2 = NULL; } - if ( hDirAC->spreadCoherence2 != NULL ) + if ( rend_common_data->spreadCoherence2 != NULL ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( i = 0; i < md_buffer_length; i++ ) { - if ( hDirAC->spreadCoherence2[i] != NULL ) + if ( rend_common_data->spreadCoherence2[i] != NULL ) { - free( hDirAC->spreadCoherence2[i] ); - hDirAC->spreadCoherence2[i] = NULL; + free( rend_common_data->spreadCoherence2[i] ); + rend_common_data->spreadCoherence2[i] = NULL; } } - free( hDirAC->spreadCoherence2 ); - hDirAC->spreadCoherence2 = NULL; + free( rend_common_data->spreadCoherence2 ); + rend_common_data->spreadCoherence2 = NULL; } } @@ -1360,24 +1589,24 @@ void ivas_dirac_deallocate_parameters( *------------------------------------------------------------------------*/ static ivas_error ivas_dirac_alloc_mem( - DIRAC_DEC_HANDLE hDirAC, + DIRAC_REND_HANDLE hDirACRend, const RENDERER_TYPE renderer_type, + const int16_t num_freq_bands, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, const int16_t hodirac_flag ) { - int16_t num_freq_bands, num_freq_bands_diff, size; + int16_t num_freq_bands_diff, size; int16_t size_ho; int16_t size_pf; int16_t num_outputs_dir, num_outputs_diff; int16_t num_protos_dir; - num_protos_dir = hDirAC->num_protos_dir; + num_protos_dir = hDirACRend->num_protos_dir; - num_freq_bands = hDirAC->num_freq_bands; - num_freq_bands_diff = hDirAC->h_output_synthesis_psd_params.max_band_decorr; + num_freq_bands_diff = hDirACRend->h_output_synthesis_psd_params.max_band_decorr; - num_outputs_dir = hDirAC->num_outputs_dir; - num_outputs_diff = hDirAC->num_outputs_diff; + num_outputs_dir = hDirACRend->num_outputs_dir; + num_outputs_diff = hDirACRend->num_outputs_diff; size = num_freq_bands * num_outputs_dir; if ( hodirac_flag ) @@ -1397,7 +1626,7 @@ static ivas_error ivas_dirac_alloc_mem( hDirAC_mem->proto_power_diff_smooth = NULL; hDirAC_mem->direct_responses_square = NULL; hDirAC_mem->frame_dec_f = NULL; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) { @@ -1422,7 +1651,7 @@ static ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero( hDirAC_mem->direct_responses_square, size ); - if ( hDirAC->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) + if ( hDirACRend->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) { @@ -1430,10 +1659,10 @@ static ivas_error ivas_dirac_alloc_mem( } } } - hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; - hDirAC->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; - hDirAC->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; - hDirAC->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; + hDirACRend->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; /* Target and smoothed nrg factors/gains */ if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) @@ -1442,7 +1671,7 @@ static ivas_error ivas_dirac_alloc_mem( } set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) { @@ -1458,8 +1687,8 @@ static ivas_error ivas_dirac_alloc_mem( } set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); } - hDirAC->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; - hDirAC->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; /*Responses (gains/factors)*/ if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) @@ -1469,7 +1698,7 @@ static ivas_error ivas_dirac_alloc_mem( set_zero( hDirAC_mem->direct_responses, size ); - hDirAC->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; + hDirACRend->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; /* Prototypes */ hDirAC_mem->proto_direct_buffer_f = NULL; @@ -1481,9 +1710,9 @@ static ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } - if ( hDirAC->proto_signal_decorr_on ) + if ( hDirACRend->proto_signal_decorr_on ) { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) { @@ -1499,8 +1728,8 @@ static ivas_error ivas_dirac_alloc_mem( } } } - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; /* Gains/power factors*/ hDirAC_mem->direct_power_factor = NULL; @@ -1518,12 +1747,12 @@ static ivas_error ivas_dirac_alloc_mem( } } - hDirAC->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; + hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; hDirAC_mem->reference_power = NULL; hDirAC_mem->onset_filter = NULL; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { @@ -1531,7 +1760,7 @@ static ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } - if ( hDirAC->proto_signal_decorr_on ) + if ( hDirACRend->proto_signal_decorr_on ) { if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) { @@ -1550,7 +1779,7 @@ static ivas_error ivas_dirac_alloc_mem( } } - if ( hDirAC->proto_signal_decorr_on ) + if ( hDirACRend->proto_signal_decorr_on ) { if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) { @@ -1637,6 +1866,7 @@ void ivas_dirac_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder state structure */ DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -1760,9 +1990,9 @@ void ivas_dirac_dec_read_BS( st->next_bit_pos = next_bit_pos_orig; } - if ( hDirAC != NULL ) + if ( hDirAC != NULL && rend_common_data != NULL ) { - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); + ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, rend_common_data, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); } return; @@ -1777,8 +2007,9 @@ void ivas_dirac_dec_read_BS( void ivas_qmetadata_to_dirac( const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -1802,7 +2033,7 @@ void ivas_qmetadata_to_dirac( int16_t no_secs = 1; q_direction = &( hQMetaData->q_direction[0] ); - hDirAC->numSimultaneousDirections = hQMetaData->no_directions; + rend_common_data->numSimultaneousDirections = hQMetaData->no_directions; if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { @@ -1811,33 +2042,33 @@ void ivas_qmetadata_to_dirac( for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + block ) % rend_common_data->dirac_md_buffer_length; for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { - hDirAC->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; + rend_common_data->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + rend_common_data->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + rend_common_data->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + rend_common_data->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; if ( q_direction->coherence_band_data != NULL ) { - hDirAC->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + rend_common_data->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; } else { - hDirAC->spreadCoherence[meta_write_index][b] = 0.0f; + rend_common_data->spreadCoherence[meta_write_index][b] = 0.0f; } if ( hQMetaData->surcoh_band_data != NULL ) { - hDirAC->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; + rend_common_data->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; } else { - hDirAC->surroundingCoherence[meta_write_index][b] = 0.0f; + rend_common_data->surroundingCoherence[meta_write_index][b] = 0.0f; } } } @@ -1848,39 +2079,39 @@ void ivas_qmetadata_to_dirac( q_direction = &( hQMetaData->q_direction[1] ); for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + block ) % rend_common_data->dirac_md_buffer_length; for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { - hDirAC->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; + rend_common_data->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + rend_common_data->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + rend_common_data->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + rend_common_data->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; if ( q_direction->coherence_band_data != NULL ) { - hDirAC->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + rend_common_data->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; } else { - hDirAC->spreadCoherence2[meta_write_index][b] = 0.0f; + rend_common_data->spreadCoherence2[meta_write_index][b] = 0.0f; } } } } } - else if ( hDirAC->azimuth2 != NULL && hDirAC->elevation2 != NULL && hDirAC->energy_ratio2 != NULL && hDirAC->spreadCoherence2 != NULL ) + else if ( rend_common_data->azimuth2 != NULL && rend_common_data->elevation2 != NULL && rend_common_data->energy_ratio2 != NULL && rend_common_data->spreadCoherence2 != NULL ) { /* zero out old dir2 data */ for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - set_s( hDirAC->azimuth2[meta_write_index], 0, hDirAC->num_freq_bands ); - set_s( hDirAC->elevation2[meta_write_index], 0, hDirAC->num_freq_bands ); - set_zero( hDirAC->energy_ratio2[meta_write_index], hDirAC->num_freq_bands ); - set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); + meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + block ) % rend_common_data->dirac_md_buffer_length; + set_s( rend_common_data->azimuth2[meta_write_index], 0, rend_common_data->num_freq_bands ); + set_s( rend_common_data->elevation2[meta_write_index], 0, rend_common_data->num_freq_bands ); + set_zero( rend_common_data->energy_ratio2[meta_write_index], rend_common_data->num_freq_bands ); + set_zero( rend_common_data->spreadCoherence2[meta_write_index], rend_common_data->num_freq_bands ); } } } @@ -1931,24 +2162,24 @@ void ivas_qmetadata_to_dirac( { band_start = band_grouping[band]; band_end = band_grouping[band + 1]; - tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; + tmp_write_idx_param_band = rend_common_data->dirac_bs_md_write_idx; for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { for ( b = band_start; b < band_end; b++ ) { tmp_write_idx_band = tmp_write_idx_param_band; - hDirAC->spreadCoherence[block][b] = 0.0f; - hDirAC->surroundingCoherence[block][b] = 0.0f; + rend_common_data->spreadCoherence[block][b] = 0.0f; + rend_common_data->surroundingCoherence[block][b] = 0.0f; - hDirAC->elevation[tmp_write_idx_band][b] = 0; - hDirAC->azimuth[tmp_write_idx_band][b] = 0; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + rend_common_data->elevation[tmp_write_idx_band][b] = 0; + rend_common_data->azimuth[tmp_write_idx_band][b] = 0; + rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = 0.f; - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + rend_common_data->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + rend_common_data->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % rend_common_data->dirac_md_buffer_length; } } } @@ -1965,7 +2196,7 @@ void ivas_qmetadata_to_dirac( { band_start = band_grouping[band]; band_end = band_grouping[band + 1]; - tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; + tmp_write_idx_param_band = rend_common_data->dirac_bs_md_write_idx; if ( ivas_format == SBA_FORMAT ) { @@ -2027,79 +2258,79 @@ void ivas_qmetadata_to_dirac( if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) { - hDirAC->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; + rend_common_data->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; } else { - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + rend_common_data->spreadCoherence[tmp_write_idx_band][b] = 0.0f; } if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) { - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; + rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; } else { - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; } - hDirAC->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; + rend_common_data->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; + rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; if ( hodirac_flag ) { if ( idx_sec == 0 ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele; - hDirAC->azimuth[tmp_write_idx_band][b] = azi; - hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use + rend_common_data->elevation[tmp_write_idx_band][b] = ele; + rend_common_data->azimuth[tmp_write_idx_band][b] = azi; + rend_common_data->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use } else { assert( idx_sec == 1 ); - hDirAC->elevation2[tmp_write_idx_band][b] = ele; - hDirAC->azimuth2[tmp_write_idx_band][b] = azi; - hDirAC->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; + rend_common_data->elevation2[tmp_write_idx_band][b] = ele; + rend_common_data->azimuth2[tmp_write_idx_band][b] = azi; + rend_common_data->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; } } else { - hDirAC->elevation[tmp_write_idx_band][b] = ele; - hDirAC->azimuth[tmp_write_idx_band][b] = azi; + rend_common_data->elevation[tmp_write_idx_band][b] = ele; + rend_common_data->azimuth[tmp_write_idx_band][b] = azi; } } - tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % hDirAC->dirac_md_buffer_length; + tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % rend_common_data->dirac_md_buffer_length; } /* for ( block =...) */ } /* for ( band = ...) */ } /* for ( idx_sec = ...)*/ /* Bands not transmitted -> zeroed*/ - for ( b = band_grouping[band]; b < hDirAC->num_freq_bands; b++ ) + for ( b = band_grouping[band]; b < rend_common_data->num_freq_bands; b++ ) { - tmp_write_idx_band = hDirAC->dirac_bs_md_write_idx; + tmp_write_idx_band = rend_common_data->dirac_bs_md_write_idx; for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - hDirAC->spreadCoherence[block][b] = 0.0f; - hDirAC->surroundingCoherence[block][b] = 0.0f; - hDirAC->energy_ratio1[block][b] = 0; - - hDirAC->elevation[tmp_write_idx_band][b] = 0; - hDirAC->azimuth[tmp_write_idx_band][b] = 0; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + rend_common_data->spreadCoherence[block][b] = 0.0f; + rend_common_data->surroundingCoherence[block][b] = 0.0f; + rend_common_data->energy_ratio1[block][b] = 0; + + rend_common_data->elevation[tmp_write_idx_band][b] = 0; + rend_common_data->azimuth[tmp_write_idx_band][b] = 0; + rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + rend_common_data->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + rend_common_data->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % rend_common_data->dirac_md_buffer_length; } } } /* update buffer write index */ - hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_bs_md_write_idx = ( rend_common_data->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % rend_common_data->dirac_md_buffer_length; return; } @@ -2118,39 +2349,42 @@ void ivas_dirac_dec_set_md_map( { int16_t num_slots_in_subfr; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; hDirAC = st_ivas->hDirAC; + rend_common_data = st_ivas->rend_common_data; #ifdef DEBUGGING assert( hDirAC ); + assert( rend_common_data ); #endif /* adapt subframes */ - hDirAC->num_slots = nCldfbTs; - hDirAC->slots_rendered = 0; + rend_common_data->num_slots = nCldfbTs; + rend_common_data->slots_rendered = 0; num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; - hDirAC->subframes_rendered = 0; + rend_common_data->subframes_rendered = 0; - ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hDirAC->subframe_nbslots, &hDirAC->nb_subframes ); + ivas_jbm_dec_get_adapted_subframes( nCldfbTs, rend_common_data->subframe_nbslots, &rend_common_data->nb_subframes ); /* set mapping according to dirac_read_idx */ - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); #ifdef FIX_470_MASA_JBM_EXT if ( st_ivas->ivas_format == MASA_FORMAT ) { - ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); + ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, rend_common_data->dirac_md_buffer_length, rend_common_data->render_to_md_map ); } else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) #else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) #endif { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, rend_common_data->dirac_md_buffer_length, rend_common_data->render_to_md_map ); } else { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hDirAC->dirac_read_idx, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, rend_common_data->dirac_read_idx, rend_common_data->dirac_md_buffer_length, rend_common_data->render_to_md_map ); } if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) @@ -2159,18 +2393,18 @@ void ivas_dirac_dec_set_md_map( int16_t sf_idx, slot_idx, slot_idx_abs; slot_idx_abs = 0; - for ( sf_idx = 0; sf_idx < hDirAC->nb_subframes; sf_idx++ ) + for ( sf_idx = 0; sf_idx < rend_common_data->nb_subframes; sf_idx++ ) { tmp = 0.0f; - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[sf_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[sf_idx]; slot_idx++ ) { - tmp += (float) hDirAC->render_to_md_map[slot_idx_abs]; + tmp += (float) rend_common_data->render_to_md_map[slot_idx_abs]; slot_idx_abs++; } - hDirAC->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) hDirAC->subframe_nbslots[sf_idx] ) + hDirAC->dirac_read_idx ) % hDirAC->dirac_md_buffer_length; + rend_common_data->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) rend_common_data->subframe_nbslots[sf_idx] ) + rend_common_data->dirac_read_idx ) % rend_common_data->dirac_md_buffer_length; } - set_s( &hDirAC->render_to_md_map[hDirAC->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - hDirAC->nb_subframes ); + set_s( &rend_common_data->render_to_md_map[rend_common_data->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - rend_common_data->nb_subframes ); } return; @@ -2193,9 +2427,12 @@ void ivas_dirac_dec( float *output_f_local[MAX_OUTPUT_CHANNELS]; float cng_td_buffer[L_FRAME16k]; int16_t nchan_out, n, n_samples_sf; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + + rend_common_data = st_ivas->rend_common_data; nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; - n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * st_ivas->hDirAC->slot_size; + n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * rend_common_data->slot_size; for ( n = 0; n < nchan_out; n++ ) { @@ -2227,11 +2464,11 @@ void ivas_dirac_dec( if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; } else { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; } for ( n = 0; n < nchan_transport; n++ ) @@ -2266,9 +2503,11 @@ void ivas_dirac_dec_render( int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, n_samples_sf, ch, nchan_intern; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float *output_f_local[MAX_OUTPUT_CHANNELS]; hDirAC = st_ivas->hDirAC; + rend_common_data = st_ivas->rend_common_data; nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; #ifdef DEBUGGING @@ -2281,14 +2520,14 @@ void ivas_dirac_dec_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( rend_common_data->num_slots - rend_common_data->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = hDirAC->subframes_rendered; + first_sf = rend_common_data->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + slots_to_render -= rend_common_data->subframe_nbslots[last_sf]; last_sf++; } @@ -2298,26 +2537,26 @@ void ivas_dirac_dec_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); - n_samples_sf = hDirAC->subframe_nbslots[subframe_idx] * st_ivas->hDirAC->slot_size; + n_samples_sf = rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->slot_size; for ( ch = 0; ch < nchan_intern; ch++ ) { output_f_local[ch] += n_samples_sf; } } - if ( hDirAC->slots_rendered == hDirAC->num_slots ) + if ( rend_common_data->slots_rendered == rend_common_data->num_slots ) { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; } else { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; } } - *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + *nSamplesAvailable = ( rend_common_data->num_slots - rend_common_data->slots_rendered ) * slot_size; return; } @@ -2338,6 +2577,7 @@ void ivas_dirac_dec_render_sf( { int16_t i, ch, idx_in, idx_lfe; DIRAC_DEC_HANDLE hDirAC; + DIRAC_REND_HANDLE hDirACRend; float dirEne; float surCohEner; float surCohRatio[CLDFB_NO_CHANNELS_MAX]; @@ -2363,18 +2603,21 @@ void ivas_dirac_dec_render_sf( float *reference_power, *reference_power_smooth; float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; push_wmops( "ivas_dirac_dec_render" ); /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; + hDirACRend = st_ivas->hDirACRend; + rend_common_data = st_ivas->rend_common_data; - DirAC_mem = st_ivas->hDirAC->stack_mem; + DirAC_mem = hDirACRend->stack_mem; reference_power = DirAC_mem.reference_power; - reference_power_smooth = DirAC_mem.reference_power + hDirAC->num_freq_bands; + reference_power_smooth = DirAC_mem.reference_power + rend_common_data->num_freq_bands; onset_filter = DirAC_mem.onset_filter; - onset_filter_subframe = DirAC_mem.onset_filter + hDirAC->num_freq_bands; + onset_filter_subframe = DirAC_mem.onset_filter + rend_common_data->num_freq_bands; hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); @@ -2406,39 +2649,39 @@ void ivas_dirac_dec_render_sf( #endif /* Subframe loop */ - slot_idx_start = hDirAC->slots_rendered; + slot_idx_start = rend_common_data->slots_rendered; slot_idx_start_cldfb_synth = 0; - subframe_idx = hDirAC->subframes_rendered; + subframe_idx = rend_common_data->subframes_rendered; if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - md_idx = hDirAC->render_to_md_map[subframe_idx]; + md_idx = rend_common_data->render_to_md_map[subframe_idx]; } else { - md_idx = hDirAC->render_to_md_map[slot_idx_start]; + md_idx = rend_common_data->render_to_md_map[slot_idx_start]; } /* ToDo: Another workaround for self test BE */ /* copy parameters into local buffers*/ if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[subframe_idx]], azimuth, hDirAC->num_freq_bands ); - mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[subframe_idx]], elevation, hDirAC->num_freq_bands ); - mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[subframe_idx]], diffuseness_vector, hDirAC->num_freq_bands ); + mvs2s( rend_common_data->azimuth[rend_common_data->render_to_md_map[subframe_idx]], azimuth, rend_common_data->num_freq_bands ); + mvs2s( rend_common_data->elevation[rend_common_data->render_to_md_map[subframe_idx]], elevation, rend_common_data->num_freq_bands ); + mvr2r( rend_common_data->diffuseness_vector[rend_common_data->render_to_md_map[subframe_idx]], diffuseness_vector, rend_common_data->num_freq_bands ); } else { - set_zero( diffuseness_vector, hDirAC->num_freq_bands ); + set_zero( diffuseness_vector, rend_common_data->num_freq_bands ); } - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - set_zero( reference_power_smooth, hDirAC->num_freq_bands ); + set_zero( reference_power_smooth, rend_common_data->num_freq_bands ); } else { - set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); + set_zero( onset_filter_subframe, rend_common_data->num_freq_bands ); } if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) @@ -2450,7 +2693,7 @@ void ivas_dirac_dec_render_sf( num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); + rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, rend_common_data->num_freq_bands, p_Rmat ); } } } @@ -2462,54 +2705,55 @@ void ivas_dirac_dec_render_sf( if ( hDirAC->hConfig->dec_param_estim == FALSE ) { /* compute response */ - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - ivas_dirac_dec_compute_power_factors( hDirAC->num_freq_bands, + ivas_dirac_dec_compute_power_factors( rend_common_data->num_freq_bands, diffuseness_vector, - hDirAC->h_output_synthesis_psd_params.max_band_decorr, - hDirAC->h_output_synthesis_psd_state.direct_power_factor, - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); if ( coherence_flag ) { - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) + for ( i = 0; i < rend_common_data->num_freq_bands; i++ ) { - dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[md_idx][i]; - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; - hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; + dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i]; + surCohEner = hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] * rend_common_data->surroundingCoherence[md_idx][i]; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); } } else { - set_zero( surCohRatio, hDirAC->num_freq_bands ); + set_zero( surCohRatio, rend_common_data->num_freq_bands ); } } else { - ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands, - hDirAC->diffuseness_vector[md_idx], - hDirAC->h_output_synthesis_psd_params.max_band_decorr, - hDirAC->h_output_synthesis_psd_state.direct_power_factor, - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); + ivas_dirac_dec_compute_gain_factors( rend_common_data->num_freq_bands, + rend_common_data->diffuseness_vector[md_idx], + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); if ( coherence_flag ) { - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) + for ( i = 0; i < rend_common_data->num_freq_bands; i++ ) { - surCohRatio[i] = hDirAC->surroundingCoherence[md_idx][i]; + surCohRatio[i] = rend_common_data->surroundingCoherence[md_idx][i]; } } else { - set_zero( surCohRatio, hDirAC->num_freq_bands ); + set_zero( surCohRatio, rend_common_data->num_freq_bands ); } } if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) { - ivas_dirac_dec_compute_directional_responses( hDirAC, + ivas_dirac_dec_compute_directional_responses( rend_common_data, + hDirACRend, st_ivas->hVBAPdata, st_ivas->hMasa, azimuth, @@ -2522,7 +2766,8 @@ void ivas_dirac_dec_render_sf( } else { - ivas_dirac_dec_compute_directional_responses( hDirAC, + ivas_dirac_dec_compute_directional_responses( rend_common_data, + hDirACRend, st_ivas->hVBAPdata, st_ivas->hMasa, azimuth, @@ -2535,24 +2780,24 @@ void ivas_dirac_dec_render_sf( } } - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; if ( hDirAC->hConfig->dec_param_estim == TRUE ) { - md_idx = hDirAC->render_to_md_map[index_slot]; + md_idx = rend_common_data->render_to_md_map[index_slot]; } else { - md_idx = hDirAC->render_to_md_map[subframe_idx]; + md_idx = rend_common_data->render_to_md_map[subframe_idx]; } if ( st_ivas->ivas_format == SBA_FORMAT ) { for ( ch = 0; ch < nchan_transport; ch++ ) { - mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); - mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); + mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], rend_common_data->num_freq_bands ); + mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], rend_common_data->num_freq_bands ); } } else @@ -2560,10 +2805,10 @@ void ivas_dirac_dec_render_sf( /* CLDFB Analysis*/ for ( ch = 0; ch < nchan_transport; ch++ ) { - cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][rend_common_data->num_freq_bands * index_slot] ), Cldfb_RealBuffer[ch][0], Cldfb_ImagBuffer[ch][0], - hDirAC->num_freq_bands, + rend_common_data->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); } } @@ -2584,7 +2829,7 @@ void ivas_dirac_dec_render_sf( } /* LFE synthesis */ - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled && !( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirAC->hOutSetup.num_lfe == 0 ) ) + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled && !( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirACRend->hOutSetup.num_lfe == 0 ) ) { ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, Cldfb_RealBuffer, Cldfb_ImagBuffer, @@ -2598,35 +2843,35 @@ void ivas_dirac_dec_render_sf( * protoype signal computation *-----------------------------------------------------------------*/ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) { protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, reference_power, slot_idx, nchan_transport, - hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, + hDirACRend->num_outputs_diff, + rend_common_data->num_freq_bands, p_Rmat ); } else { protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, reference_power, slot_idx, nchan_transport, - hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, + hDirACRend->num_outputs_diff, + rend_common_data->num_freq_bands, 0 ); } } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - 0, slot_idx, hDirAC->num_freq_bands, hDirAC->masa_stereo_type_detect ); + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + 0, slot_idx, rend_common_data->num_freq_bands, hDirACRend->masa_stereo_type_detect ); } else { @@ -2637,36 +2882,36 @@ void ivas_dirac_dec_render_sf( case 6: case 4: protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - hDirAC->hoa_decoder, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, hDirACRend->num_outputs_diff, + rend_common_data->num_freq_bands, + hDirACRend->hoa_decoder, nchan_transport, - hDirAC->sba_map_tc ); + hDirACRend->sba_map_tc ); break; case 2: protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - hDirAC->hOutSetup.is_loudspeaker_setup, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + hDirACRend->hOutSetup.is_loudspeaker_setup, slot_idx, - hDirAC->num_freq_bands, - hDirAC->masa_stereo_type_detect ); + rend_common_data->num_freq_bands, + hDirACRend->masa_stereo_type_detect ); break; case 1: protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, slot_idx, - hDirAC->num_protos_diff, - hDirAC->num_freq_bands ); + hDirACRend->num_protos_diff, + rend_common_data->num_freq_bands ); break; default: return; @@ -2680,37 +2925,37 @@ void ivas_dirac_dec_render_sf( if ( hDirAC->hConfig->dec_param_estim == TRUE ) { - mvs2s( &hDirAC->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], hDirAC->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - mvs2s( &hDirAC->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], hDirAC->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); + mvs2s( &rend_common_data->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], rend_common_data->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); + mvs2s( &rend_common_data->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], rend_common_data->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) { num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); + rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, rend_common_data->num_freq_bands, p_Rmat ); } - hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ - index = hDirAC->index_buffer_intensity; + index = hDirACRend->index_buffer_intensity; num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; computeIntensityVector_dec( Cldfb_RealBuffer, Cldfb_ImagBuffer, num_freq_bands, - hDirAC->buffer_intensity_real[0][index - 1], - hDirAC->buffer_intensity_real[1][index - 1], - hDirAC->buffer_intensity_real[2][index - 1] ); + hDirACRend->buffer_intensity_real[0][index - 1], + hDirACRend->buffer_intensity_real[1][index - 1], + hDirACRend->buffer_intensity_real[2][index - 1] ); - computeDirectionAngles( hDirAC->buffer_intensity_real[0][index - 1], - hDirAC->buffer_intensity_real[1][index - 1], - hDirAC->buffer_intensity_real[2][index - 1], + computeDirectionAngles( hDirACRend->buffer_intensity_real[0][index - 1], + hDirACRend->buffer_intensity_real[1][index - 1], + hDirACRend->buffer_intensity_real[2][index - 1], num_freq_bands, azimuth, elevation ); - mvr2r( reference_power, &( hDirAC->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + mvr2r( reference_power, &( hDirACRend->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - computeDiffuseness( hDirAC->buffer_intensity_real, hDirAC->buffer_energy, num_freq_bands, hDirAC->diffuseness_vector[md_idx] ); + computeDiffuseness( hDirACRend->buffer_intensity_real, hDirACRend->buffer_energy, num_freq_bands, rend_common_data->diffuseness_vector[md_idx] ); } #ifdef DEBUG_MODE_DIRAC @@ -2726,7 +2971,7 @@ void ivas_dirac_dec_render_sf( fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) + for ( i = 0; i < rend_common_data->num_freq_bands; i++ ) { float radius_length; float dv[3]; @@ -2740,7 +2985,7 @@ void ivas_dirac_dec_render_sf( fwrite( dv, sizeof( float ), 3, fp_direction_vector ); fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; } @@ -2765,58 +3010,58 @@ void ivas_dirac_dec_render_sf( * frequency domain decorrelation *-----------------------------------------------------------------*/ - if ( hDirAC->proto_signal_decorr_on == 1 ) + if ( hDirACRend->proto_signal_decorr_on == 1 ) { /* decorrelate prototype frame */ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, + ivas_dirac_dec_decorr_process( rend_common_data->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, nchan_transport, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff + 2 * hDirAC->num_freq_bands * min( 4, nchan_transport ), + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff + 2 * rend_common_data->num_freq_bands * min( 4, nchan_transport ), onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); - v_multc( onset_filter, 0.25f, onset_filter, hDirAC->num_freq_bands ); - v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hDirAC->num_freq_bands ); + v_multc( onset_filter, 0.25f, onset_filter, rend_common_data->num_freq_bands ); + v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, rend_common_data->num_freq_bands ); p_onset_filter = onset_filter_subframe; } else { - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, + ivas_dirac_dec_decorr_process( rend_common_data->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, nchan_transport, - hDirAC->proto_frame_f, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, + hDirACRend->proto_frame_f, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, DirAC_mem.frame_dec_f, onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); - hDirAC->proto_frame_dec_f = DirAC_mem.frame_dec_f; + hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; p_onset_filter = onset_filter; } } else { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - set_f( onset_filter_subframe, 1.f, hDirAC->num_freq_bands ); + set_f( onset_filter_subframe, 1.f, rend_common_data->num_freq_bands ); p_onset_filter = onset_filter_subframe; } else { /* no frequency domain decorrelation: use prototype frame */ - hDirAC->proto_frame_dec_f = hDirAC->proto_frame_f; + hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; p_onset_filter = NULL; } } @@ -2825,10 +3070,10 @@ void ivas_dirac_dec_render_sf( * output synthesis *-----------------------------------------------------------------*/ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { /*Compute diffuse prototypes*/ - ivas_dirac_dec_compute_diffuse_proto( hDirAC, slot_idx ); + ivas_dirac_dec_compute_diffuse_proto( hDirACRend, rend_common_data->num_freq_bands, slot_idx ); } /*Compute PSDs*/ @@ -2838,12 +3083,14 @@ void ivas_dirac_dec_render_sf( p_onset_filter, azimuth, elevation, - hDirAC->diffuseness_vector[md_idx], + rend_common_data->diffuseness_vector[md_idx], hDirAC, + rend_common_data, + hDirACRend, st_ivas->hCombinedOrientationData->shd_rot_max_order, p_Rmat, st_ivas->hVBAPdata, - hDirAC->hOutSetup, + hDirACRend->hOutSetup, nchan_transport, md_idx, hodirac_flag ); @@ -2854,12 +3101,14 @@ void ivas_dirac_dec_render_sf( p_onset_filter, azimuth, elevation, - hDirAC->diffuseness_vector[md_idx], + rend_common_data->diffuseness_vector[md_idx], hDirAC, + rend_common_data, + hDirACRend, 0, 0, st_ivas->hVBAPdata, - hDirAC->hOutSetup, + hDirACRend->hOutSetup, nchan_transport, md_idx, hodirac_flag ); @@ -2867,26 +3116,28 @@ void ivas_dirac_dec_render_sf( if ( hDirAC->hConfig->dec_param_estim ) { - float fac = 1.0f / (float) hDirAC->subframe_nbslots[subframe_idx]; - v_multc_acc( hDirAC->diffuseness_vector[md_idx], fac, diffuseness_vector, hDirAC->num_freq_bands ); + float fac = 1.0f / (float) rend_common_data->subframe_nbslots[subframe_idx]; + v_multc_acc( rend_common_data->diffuseness_vector[md_idx], fac, diffuseness_vector, rend_common_data->num_freq_bands ); } - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); + v_add( reference_power, reference_power_smooth, reference_power_smooth, rend_common_data->num_freq_bands ); } } - ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); + ivas_dirac_dec_output_synthesis_get_interpolator( &hDirACRend->h_output_synthesis_psd_params, rend_common_data->subframe_nbslots[subframe_idx] ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC, + rend_common_data, + hDirACRend, nchan_transport, - hDirAC->subframe_nbslots[subframe_idx], + rend_common_data->subframe_nbslots[subframe_idx], p_onset_filter, diffuseness_vector, hodirac_flag ); @@ -2906,7 +3157,9 @@ void ivas_dirac_dec_render_sf( ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC, - hDirAC->subframe_nbslots[subframe_idx], + rend_common_data, + hDirACRend, + rend_common_data->subframe_nbslots[subframe_idx], diffuseness_vector, reference_power_smooth, qualityBasedSmFactor ); @@ -2924,7 +3177,7 @@ void ivas_dirac_dec_render_sf( ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, subframe_idx, - hDirAC->subframe_nbslots[subframe_idx], + rend_common_data->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, @@ -2937,7 +3190,7 @@ void ivas_dirac_dec_render_sf( float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; @@ -2945,19 +3198,19 @@ void ivas_dirac_dec_render_sf( cldfbSynthesis( RealBuffer, ImagBuffer, - &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], + &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), + rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); } } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) + for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], rend_common_data->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], rend_common_data->num_freq_bands ); } } } @@ -2970,23 +3223,23 @@ void ivas_dirac_dec_render_sf( idx_in = 0; idx_lfe = 0; - outchannels = hDirAC->hOutSetup.nchan_out_woLFE + hDirAC->hOutSetup.num_lfe; - if ( hDirAC->hOutSetup.separateChannelEnabled && ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || - ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; + if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || + ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) { outchannels++; } - if ( hDirAC->hOutSetup.separateChannelEnabled && hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) + if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) { float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - const int16_t subframe_start_sample = index_slot * hDirAC->num_freq_bands; - const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx]; + const int16_t subframe_start_sample = index_slot * rend_common_data->num_freq_bands; + const int16_t num_samples_subframe = rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx]; /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); @@ -2994,17 +3247,17 @@ void ivas_dirac_dec_render_sf( for ( ch = 0; ch < outchannels; ch++ ) { - if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) { /* Move the LFE channel to the correct place */ mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) { idx_lfe++; } } - else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) + else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) { /* Move the separated channel to the correct place. Thus, the separated channel is * combined with the synthesized channels here when there is a matching channel. */ @@ -3013,7 +3266,7 @@ void ivas_dirac_dec_render_sf( else { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; @@ -3035,32 +3288,32 @@ void ivas_dirac_dec_render_sf( { for ( ch = 0; ch < outchannels; ch++ ) { - if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) { - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled ) + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled ) { - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) + else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) { /* LFE has been synthesized in the time domain, do nothing. */ } else { - set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); + set_zero( &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->num_freq_bands ); } - if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) { idx_lfe++; } } - else if ( ( hDirAC->hOutSetup.separateChannelEnabled ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) + else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) { /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated * channel is combined with the synthesized channels here. */ @@ -3068,19 +3321,19 @@ void ivas_dirac_dec_render_sf( else { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); idx_in++; } } } } - hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; - hDirAC->subframes_rendered++; + rend_common_data->slots_rendered += rend_common_data->subframe_nbslots[subframe_idx]; + rend_common_data->subframes_rendered++; pop_wmops(); @@ -3828,12 +4081,13 @@ static void protoSignalComputation4( *------------------------------------------------------------------------*/ static void ivas_dirac_dec_compute_diffuse_proto( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + DIRAC_REND_HANDLE hDirACRend, + const int16_t num_freq_bands, const int16_t slot_idx /* i : slot index */ ) { int16_t k, l; - int16_t num_freq_bands, num_freq_bands_diff; + int16_t num_freq_bands_diff; float *p_diff_buffer, *p_diff_buffer_1; float *p_proto_diff, *p_power_smooth, *proto_frame_dec_f; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; @@ -3841,20 +4095,19 @@ static void ivas_dirac_dec_compute_diffuse_proto( int16_t m; float *p_hoa_enc; - proto_frame_dec_f = hDirAC->proto_frame_dec_f; - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + proto_frame_dec_f = hDirACRend->proto_frame_dec_f; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); - num_freq_bands = hDirAC->num_freq_bands; num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; - p_diff_buffer = h_dirac_output_synthesis_state->proto_diffuse_buffer_f + slot_idx * 2 * num_freq_bands_diff * hDirAC->hOutSetup.nchan_out_woLFE; + p_diff_buffer = h_dirac_output_synthesis_state->proto_diffuse_buffer_f + slot_idx * 2 * num_freq_bands_diff * hDirACRend->hOutSetup.nchan_out_woLFE; p_diff_buffer_1 = p_diff_buffer + 1; p_power_smooth = h_dirac_output_synthesis_state->proto_power_diff_smooth; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) { - for ( k = 0; k < hDirAC->hOutSetup.nchan_out_woLFE; k++ ) + for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) { p_proto_diff = proto_frame_dec_f + k * 2 * num_freq_bands; for ( l = 0; l < num_freq_bands_diff; l++ ) @@ -3870,22 +4123,22 @@ static void ivas_dirac_dec_compute_diffuse_proto( else { /*DIRAC_SYNTHESIS_PSD_SHD: Virtual LS->HOA encoding*/ - for ( k = 0; k < hDirAC->hOutSetup.nchan_out_woLFE; k++ ) + for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) { for ( l = 0; l < num_freq_bands_diff; l++ ) { - p_hoa_enc = hDirAC->hoa_encoder + k; + p_hoa_enc = hDirACRend->hoa_encoder + k; p_proto_diff = proto_frame_dec_f + 2 * l; *p_diff_buffer = 0.f; *p_diff_buffer_1 = 0.f; /*LS to HOA*/ - for ( m = 0; m < hDirAC->num_outputs_diff; m++ ) + for ( m = 0; m < hDirACRend->num_outputs_diff; m++ ) { *p_diff_buffer += ( *p_hoa_enc ) * ( *p_proto_diff ); *p_diff_buffer_1 += ( *p_hoa_enc ) * ( *( p_proto_diff + 1 ) ); - p_hoa_enc += hDirAC->hOutSetup.nchan_out_woLFE; + p_hoa_enc += hDirACRend->hOutSetup.nchan_out_woLFE; p_proto_diff += 2 * num_freq_bands; } diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 4f25d5a465..c10fda92dd 100755 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -87,7 +87,8 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha *------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_output_synthesis_open( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels */ const int32_t output_Fs, /* i : output sampling rate */ @@ -101,20 +102,20 @@ ivas_error ivas_dirac_dec_output_synthesis_open( float temp_alpha_synthesis[CLDFB_NO_CHANNELS_MAX]; /* pointers to structs for allocation */ - DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /* check / set input parameters */ - assert( hDirAC->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); - assert( hDirAC->hOutSetup.nchan_out_woLFE > 0 && "Error: Number of output channels > 0!" ); - assert( hDirAC->num_outputs_diff > 0 ); - assert( hDirAC->slot_size > 0 ); - assert( hDirAC->hOutSetup.is_loudspeaker_setup == 0 || hDirAC->hOutSetup.is_loudspeaker_setup == 1 ); - assert( hDirAC->diffuse_response_function != NULL ); + assert( rend_common_data->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); + assert( hDirACRend->hOutSetup.nchan_out_woLFE > 0 && "Error: Number of output channels > 0!" ); + assert( hDirACRend->num_outputs_diff > 0 ); + assert( rend_common_data->slot_size > 0 ); + assert( hDirACRend->hOutSetup.is_loudspeaker_setup == 0 || hDirACRend->hOutSetup.is_loudspeaker_setup == 1 ); + assert( hDirACRend->diffuse_response_function != NULL ); - if ( hDirAC->proto_signal_decorr_on ) + if ( hDirACRend->proto_signal_decorr_on ) { - dirac_output_synthesis_params->max_band_decorr = hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + dirac_output_synthesis_params->max_band_decorr = hDirACRend->h_freq_domain_decorr_ap_params->max_band_decorr; } else { @@ -126,16 +127,16 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *-----------------------------------------------------------------*/ dirac_output_synthesis_state->diffuse_responses_square = NULL; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( 2 * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -143,16 +144,16 @@ ivas_error ivas_dirac_dec_output_synthesis_open( /* prototype power buffers */ dirac_output_synthesis_state->proto_power_smooth_prev = NULL; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_protos_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_protos_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - if ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) + if ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) { - if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -171,42 +172,42 @@ ivas_error ivas_dirac_dec_output_synthesis_open( /* target PSD buffers */ if ( hodirac_flag ) { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS; + size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; } else { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir; + size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir; } if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -219,23 +220,23 @@ ivas_error ivas_dirac_dec_output_synthesis_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirAC->synthesisConf != DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_MONO ) { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -246,32 +247,32 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *-----------------------------------------------------------------*/ /* compute alpha */ - if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) + if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { - computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); + computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, rend_common_data->slot_size, rend_common_data->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); if ( ( dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis, dirac_output_synthesis_params->numAlphas ); - computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); + computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, rend_common_data->slot_size, rend_common_data->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); if ( ( dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis_fast, dirac_output_synthesis_params->numAlphasFast ); - if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, hDirAC->num_freq_bands ); - set_zero( dirac_output_synthesis_state->direction_smoothness_prev, hDirAC->num_freq_bands ); + set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, rend_common_data->num_freq_bands ); + set_zero( dirac_output_synthesis_state->direction_smoothness_prev, rend_common_data->num_freq_bands ); } else { @@ -288,13 +289,13 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } /* prepare diffuse response function */ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { num_diffuse_responses = 2; } else { - num_diffuse_responses = hDirAC->hOutSetup.nchan_out_woLFE; + num_diffuse_responses = hDirACRend->hOutSetup.nchan_out_woLFE; } if ( dirac_output_synthesis_state->diffuse_responses_square != NULL ) @@ -302,34 +303,34 @@ ivas_error ivas_dirac_dec_output_synthesis_open( for ( ch_idx = 0; ch_idx < num_diffuse_responses; ++ch_idx ) { /*dirac_output_synthesis_state->diffuse_responses_square[ch_idx] = pow(dirac_output_synthesis_params->diffuse_response_function[ch_idx]/max_response, 2.0f);*/ - tmp = hDirAC->diffuse_response_function[ch_idx]; + tmp = hDirACRend->diffuse_response_function[ch_idx]; dirac_output_synthesis_state->diffuse_responses_square[ch_idx] = tmp * tmp; } } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { int16_t diff_compensation_order; float diff_nrg_total, diff_nrg, diff_nrg_trans, diff_nrg_decorr; diff_compensation_order = nchan_transport >= 3 ? 3 : 2; /* compensate missing diffuseness modelling up order 2, except for HR*/ - diff_compensation_order = min( diff_compensation_order, hDirAC->hOutSetup.ambisonics_order ); + diff_compensation_order = min( diff_compensation_order, hDirACRend->hOutSetup.ambisonics_order ); diff_nrg_total = 0; diff_nrg_trans = 0; diff_nrg_decorr = 0; for ( ch_idx = 0; ch_idx < ( diff_compensation_order + 1 ) * ( diff_compensation_order + 1 ); ch_idx++ ) { - diff_nrg = hDirAC->diffuse_response_function[ch_idx] * hDirAC->diffuse_response_function[ch_idx]; + diff_nrg = hDirACRend->diffuse_response_function[ch_idx] * hDirACRend->diffuse_response_function[ch_idx]; diff_nrg_total += diff_nrg; /* is it a transport channel?*/ - if ( ch_idx == 0 || hDirAC->proto_index_dir[ch_idx] != 0 ) + if ( ch_idx == 0 || hDirACRend->proto_index_dir[ch_idx] != 0 ) { diff_nrg_trans += diff_nrg; } /* is it a decorrelated or transport channel?*/ - if ( ch_idx < hDirAC->num_outputs_diff ) + if ( ch_idx < hDirACRend->num_outputs_diff ) { diff_nrg_decorr += diff_nrg; } @@ -354,7 +355,8 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_init( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) @@ -364,8 +366,8 @@ void ivas_dirac_dec_output_synthesis_init( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /*-----------------------------------------------------------------* * init outputSynthesisPSD_Init @@ -374,45 +376,45 @@ void ivas_dirac_dec_output_synthesis_init( /* initialize buffers */ if ( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev != NULL ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( hodirac_flag ) { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS; + size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; } else { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir; + size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir; } set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff ); } - else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) + else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff ); } else { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( h_dirac_output_synthesis_state->proto_power_smooth_prev != NULL ) { - set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_protos_dir ); + set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_protos_dir ); } set_zero( h_dirac_output_synthesis_state->gains_dir_prev, size ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - set_zero( h_dirac_output_synthesis_state->gains_diff_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->gains_diff_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff ); } else { - set_zero( h_dirac_output_synthesis_state->gains_diff_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->gains_diff_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev != NULL ) @@ -431,12 +433,12 @@ void ivas_dirac_dec_output_synthesis_init( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: DirAC handle */ + DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ ) { /* pointers to structs for allocation */ - DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /*-----------------------------------------------------------------* * memory deallocation @@ -538,6 +540,8 @@ void ivas_dirac_dec_output_synthesis_process_slot( const int16_t *elevation, const float *diffuseness, DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t sh_rot_max_order, const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ @@ -555,8 +559,8 @@ void ivas_dirac_dec_output_synthesis_process_slot( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); h_dirac_output_synthesis_state->onset_filter = onset; @@ -565,19 +569,20 @@ void ivas_dirac_dec_output_synthesis_process_slot( *-----------------------------------------------------------------*/ /* collect some often used parameters */ - num_freq_bands = hDirAC->num_freq_bands; - num_channels_dir = hDirAC->num_outputs_dir; - num_channels_diff = hDirAC->num_outputs_diff; + num_freq_bands = rend_common_data->num_freq_bands; + num_channels_dir = hDirACRend->num_outputs_dir; + num_channels_diff = hDirACRend->num_outputs_diff; num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) { num_channels_dir = hOutSetup.nchan_out_woLFE; } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) { - ivas_dirac_dec_compute_directional_responses( hDirAC, + ivas_dirac_dec_compute_directional_responses( rend_common_data, + hDirACRend, hVBAPdata, NULL, azimuth, @@ -591,30 +596,30 @@ void ivas_dirac_dec_output_synthesis_process_slot( if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - v_multc( hDirAC->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); + v_multc( rend_common_data->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio1[md_idx], + mvr2r( rend_common_data->energy_ratio1[md_idx], h_dirac_output_synthesis_state->direct_power_factor, num_freq_bands ); mvr2r( aux_buf, h_dirac_output_synthesis_state->diffuse_power_factor, num_freq_bands ); - v_multc( hDirAC->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); + v_multc( rend_common_data->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio2[md_idx], - &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], + mvr2r( rend_common_data->energy_ratio2[md_idx], + &h_dirac_output_synthesis_state->direct_power_factor[rend_common_data->num_freq_bands], num_freq_bands ); mvr2r( aux_buf, - &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], + &h_dirac_output_synthesis_state->diffuse_power_factor[rend_common_data->num_freq_bands], num_freq_bands ); } else { ivas_dirac_dec_compute_gain_factors( num_freq_bands, - hDirAC->diffuseness_vector[md_idx], + rend_common_data->diffuseness_vector[md_idx], h_dirac_output_synthesis_params->max_band_decorr, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor ); @@ -625,7 +630,8 @@ void ivas_dirac_dec_output_synthesis_process_slot( { /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hDirAC, + ivas_dirac_dec_compute_directional_responses( rend_common_data, + hDirACRend, hVBAPdata, NULL, azimuth, @@ -636,7 +642,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( p_Rmat, hodirac_flag ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { ivas_dirac_dec_compute_gain_factors( num_freq_bands, diffuseness, @@ -710,7 +716,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) { v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], + hDirACRend->diffuse_response_function[ch_idx], aux_buf, num_freq_bands_diff ); @@ -738,7 +744,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( { computeTargetPSDs_diffuse_with_onsets( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, - hDirAC->proto_index_diff, + hDirACRend->proto_index_diff, h_dirac_output_synthesis_state->diffuse_power_factor, reference_power, h_dirac_output_synthesis_state->diffuse_responses_square, @@ -770,6 +776,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, @@ -798,15 +806,15 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ratio[DIRAC_HO_NUMSECTORS * CLDFB_NO_CHANNELS_MAX]; /* collect some often used parameters */ - h_dirac_output_synthesis_params = hDirAC->h_output_synthesis_psd_params; - h_dirac_output_synthesis_state = hDirAC->h_output_synthesis_psd_state; - proto_direct_index = hDirAC->proto_index_dir; + h_dirac_output_synthesis_params = hDirACRend->h_output_synthesis_psd_params; + h_dirac_output_synthesis_state = hDirACRend->h_output_synthesis_psd_state; + proto_direct_index = hDirACRend->proto_index_dir; - num_protos_dir = hDirAC->num_protos_dir; - num_freq_bands = hDirAC->num_freq_bands; + num_protos_dir = hDirACRend->num_protos_dir; + num_freq_bands = rend_common_data->num_freq_bands; num_freq_bands_diff = h_dirac_output_synthesis_params.max_band_decorr; - num_channels_dir = hDirAC->num_outputs_dir; - num_channels_diff = hDirAC->num_outputs_diff; + num_channels_dir = hDirACRend->num_outputs_dir; + num_channels_diff = hDirACRend->num_outputs_diff; nchan_transport_foa = min( 4, nchan_transport ); @@ -841,7 +849,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( l = 0; l < num_freq_bands; l++ ) { aux_buf[l] = 1.f - diffuseness[l]; - ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[hDirAC->num_freq_bands + l]; + ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[rend_common_data->num_freq_bands + l]; ratio[l + num_freq_bands] = 1.f - ratio[l]; } @@ -862,7 +870,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) { v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], + hDirACRend->diffuse_response_function[ch_idx], &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], num_freq_bands_diff ); } @@ -902,7 +910,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( /*Diffuse gain*/ for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) { - v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, hDirAC->diffuse_response_function[ch_idx], &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], num_freq_bands_diff ); + v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, hDirACRend->diffuse_response_function[ch_idx], &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], num_freq_bands_diff ); } } @@ -1116,8 +1124,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( l = 0; l < num_freq_bands_diff; l++ ) { g = g1 * ( *( p_gains_diff++ ) ) + g2 * ( *( p_gains_diff_prev++ ) ); - output_real[l * num_channels_dir + hDirAC->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); /* maps ch_idx 5 to 8 */ - output_imag[l * num_channels_dir + hDirAC->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); + output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); /* maps ch_idx 5 to 8 */ + output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); } } else @@ -1134,14 +1142,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( * Copy output or HOA decoder *-----------------------------------------------------------------*/ - if ( hDirAC->hOutSetup.is_loudspeaker_setup && hDirAC->hoa_decoder != NULL ) + if ( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) { float *p_real, *p_imag; const float *hoa_decoder; - hoa_decoder = hDirAC->hoa_decoder; + hoa_decoder = hDirACRend->hoa_decoder; - for ( ch_idx = 0; ch_idx < hDirAC->hOutSetup.nchan_out_woLFE; ch_idx++ ) + for ( ch_idx = 0; ch_idx < hDirACRend->hOutSetup.nchan_out_woLFE; ch_idx++ ) { p_real = RealBuffer[ch_idx][buf_idx]; p_imag = ImagBuffer[ch_idx][buf_idx]; @@ -1216,6 +1224,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nbslots, /* i : number of slots to process */ float *diffuseness_vector, float *reference_power_smooth, @@ -1252,14 +1262,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( push_wmops( "dirac_out_synth_sfr" ); - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); - proto_direct_index = hDirAC->proto_index_dir; - num_protos_dir = hDirAC->num_protos_dir; - nchan_out_woLFE = hDirAC->hOutSetup.nchan_out_woLFE; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + proto_direct_index = hDirACRend->proto_index_dir; + num_protos_dir = hDirACRend->num_protos_dir; + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; /* collect some often used parameters */ - num_freq_bands = hDirAC->num_freq_bands; + num_freq_bands = rend_common_data->num_freq_bands; /*-----------------------------------------------------------------* * compute target PSDs @@ -1269,7 +1279,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( { diff_start_band = h_dirac_output_synthesis_params->use_onset_filters == 1 ? h_dirac_output_synthesis_params->max_band_decorr : 0; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { nchan_target_psds = 2; } @@ -1297,11 +1307,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( * compute variables for stereo transport signal type detection *-----------------------------------------------------------------*/ - if ( hDirAC->masa_stereo_type_detect != NULL ) + if ( hDirACRend->masa_stereo_type_detect != NULL ) { + MASA_STEREO_TYPE_DETECT* masa_stereo_type_detect = hDirACRend->masa_stereo_type_detect; + p_cy_auto_dir_smooth = h_dirac_output_synthesis_state->cy_auto_dir_smooth; p_cy_auto_diff_smooth = h_dirac_output_synthesis_state->cy_auto_diff_smooth; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { target_power_y = p_cy_auto_dir_smooth[num_freq_bands] / ( sqrtf( h_dirac_output_synthesis_state->direct_power_factor[0] ) + EPSILON ); target_power_y += p_cy_auto_diff_smooth[num_freq_bands] / ( sqrtf( h_dirac_output_synthesis_state->diffuse_power_factor[0] ) + EPSILON ); @@ -1310,19 +1322,19 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( { target_power_y = p_cy_auto_dir_smooth[num_freq_bands] + p_cy_auto_diff_smooth[num_freq_bands]; } - subtract_power_y = hDirAC->masa_stereo_type_detect->subtract_power_y; + subtract_power_y = masa_stereo_type_detect->subtract_power_y; a = 0.0004f; /* Temporal smoothing coefficient */ b = 1.0f - a; /* Temporal smoothing coefficient */ - hDirAC->masa_stereo_type_detect->target_power_y_smooth = a * target_power_y + b * hDirAC->masa_stereo_type_detect->target_power_y_smooth; - hDirAC->masa_stereo_type_detect->subtract_power_y_smooth = a * subtract_power_y + b * hDirAC->masa_stereo_type_detect->subtract_power_y_smooth; + masa_stereo_type_detect->target_power_y_smooth = a * target_power_y + b * masa_stereo_type_detect->target_power_y_smooth; + masa_stereo_type_detect->subtract_power_y_smooth = a * subtract_power_y + b * masa_stereo_type_detect->subtract_power_y_smooth; - subtract_target_ratio = hDirAC->masa_stereo_type_detect->subtract_power_y_smooth / ( hDirAC->masa_stereo_type_detect->target_power_y_smooth + EPSILON ); + subtract_target_ratio = masa_stereo_type_detect->subtract_power_y_smooth / ( masa_stereo_type_detect->target_power_y_smooth + EPSILON ); subtract_target_ratio_db = 10.0f * log10f( subtract_target_ratio ); - hDirAC->masa_stereo_type_detect->subtract_target_ratio_db = subtract_target_ratio_db; + masa_stereo_type_detect->subtract_target_ratio_db = subtract_target_ratio_db; - hDirAC->masa_stereo_type_detect->subtract_power_y = 0.0f; + masa_stereo_type_detect->subtract_power_y = 0.0f; } /*-----------------------------------------------------------------* @@ -1731,7 +1743,8 @@ static void ivas_dirac_dec_get_response_split_order( *------------------------------------------------------------------------*/ void ivas_dirac_dec_compute_directional_responses( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int16_t *azimuth, @@ -1761,24 +1774,24 @@ void ivas_dirac_dec_compute_directional_responses( elevation2 = NULL; transport_signal_type = MASA_STEREO_NOT_DEFINED; - if ( hDirAC->masa_stereo_type_detect != NULL ) + if ( hDirACRend->masa_stereo_type_detect != NULL ) { - dipole_freq_range[0] = hDirAC->masa_stereo_type_detect->dipole_freq_range[0]; - dipole_freq_range[1] = hDirAC->masa_stereo_type_detect->dipole_freq_range[1]; - transport_signal_type = hDirAC->masa_stereo_type_detect->masa_stereo_type; + dipole_freq_range[0] = hDirACRend->masa_stereo_type_detect->dipole_freq_range[0]; + dipole_freq_range[1] = hDirACRend->masa_stereo_type_detect->dipole_freq_range[1]; + transport_signal_type = hDirACRend->masa_stereo_type_detect->masa_stereo_type; } - num_channels_dir = hDirAC->num_outputs_dir; - if ( hDirAC->numSimultaneousDirections == 2 ) + num_channels_dir = hDirACRend->num_outputs_dir; + if ( rend_common_data->numSimultaneousDirections == 2 ) { - azimuth2 = hDirAC->azimuth2[md_idx]; - elevation2 = hDirAC->elevation2[md_idx]; + azimuth2 = rend_common_data->azimuth2[md_idx]; + elevation2 = rend_common_data->elevation2[md_idx]; } codingBand = -1; assert( num_channels_dir <= MAX_OUTPUT_CHANNELS && "Number of channels is too high" ); - for ( k = 0; k < hDirAC->num_freq_bands; ++k ) + for ( k = 0; k < rend_common_data->num_freq_bands; ++k ) { if ( hMasa != NULL && k == MASA_band_grouping_24[hMasa->data.band_mapping[codingBand + 1]] ) { @@ -1787,24 +1800,24 @@ void ivas_dirac_dec_compute_directional_responses( if ( hMasa != NULL && k > MASA_band_grouping_24[hMasa->data.band_mapping[codingBand]] && k < MASA_band_grouping_24[hMasa->data.band_mapping[codingBand + 1]] && - k != hDirAC->h_output_synthesis_psd_params.max_band_decorr ) + k != hDirACRend->h_output_synthesis_psd_params.max_band_decorr ) { /* Panning gains have to be computed only for the first bin of the coding band in MASA, for other bins the previous values can be used */ - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - mvr2r_inc( &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k - 1], - hDirAC->num_freq_bands, &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k], - hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k - 1], + rend_common_data->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], + rend_common_data->num_freq_bands, num_channels_dir ); } - mvr2r_inc( &hDirAC->h_output_synthesis_psd_state.direct_responses[k - 1], - hDirAC->num_freq_bands, - &hDirAC->h_output_synthesis_psd_state.direct_responses[k], - hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( &hDirACRend->h_output_synthesis_psd_state.direct_responses[k - 1], + rend_common_data->num_freq_bands, + &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], + rend_common_data->num_freq_bands, num_channels_dir ); } else { /* HOA3 PANNING */ - if ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) + if ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 ) { set_f( direct_response_hoa, 1.0f, MAX_OUTPUT_CHANNELS ); set_f( direct_response_dir2, 1.0f, MAX_OUTPUT_CHANNELS ); @@ -1820,36 +1833,36 @@ void ivas_dirac_dec_compute_directional_responses( } else { - ivas_dirac_dec_get_response( azimuth[k], elevation[k], direct_response_hoa, hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( azimuth[k], elevation[k], direct_response_hoa, hDirACRend->hOutSetup.ambisonics_order ); if ( hodirac_flag ) { - ivas_dirac_dec_get_response( azimuth2[k], elevation2[k], direct_response_dir2, hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( azimuth2[k], elevation2[k], direct_response_dir2, hDirACRend->hOutSetup.ambisonics_order ); } } - if ( hMasa == NULL && hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hMasa == NULL && hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - mvr2r_inc( direct_response_hoa, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_hoa, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], rend_common_data->num_freq_bands, num_channels_dir ); if ( hodirac_flag ) { - mvr2r_inc( direct_response_dir2, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k + hDirAC->num_freq_bands * num_channels_dir], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_dir2, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k + rend_common_data->num_freq_bands * num_channels_dir], rend_common_data->num_freq_bands, num_channels_dir ); } } - else if ( ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) && ( hMasa != NULL ) ) || - hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) && ( hMasa != NULL ) ) || + hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ - spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); + spreadCoherencePanningHoa( azimuth[k], elevation[k], rend_common_data->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); /* Synthesize the second direction and combine the gains */ - if ( hDirAC->numSimultaneousDirections == 2 ) + if ( rend_common_data->numSimultaneousDirections == 2 ) { - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); + spreadCoherencePanningHoa( azimuth2[k], elevation2[k], rend_common_data->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); /* Combine gains from the two directions */ - totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; + totalDirect = rend_common_data->energy_ratio1[md_idx][k] + rend_common_data->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = rend_common_data->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = rend_common_data->energy_ratio2[md_idx][k] / totalDirect; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_hoa[l] *= directRatio[0]; @@ -1868,10 +1881,10 @@ void ivas_dirac_dec_compute_directional_responses( /* Set computed gains */ direct_response = direct_response_hoa; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { v_mult( direct_response, direct_response, direct_response_square, num_channels_dir ); - mvr2r_inc( direct_response_square, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], rend_common_data->num_freq_bands, num_channels_dir ); if ( transport_signal_type == MASA_STEREO_SPACED_MICS ) { @@ -1883,33 +1896,33 @@ void ivas_dirac_dec_compute_directional_responses( } else { - set_f( direct_response, 1.0f, hDirAC->num_protos_ambi ); + set_f( direct_response, 1.0f, hDirACRend->num_protos_ambi ); } } - mvr2r_inc( direct_response, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], rend_common_data->num_freq_bands, num_channels_dir ); } else { assert( 0 && "Not supported synthesis method!" ); } } - else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ + else if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ - spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); + spreadCoherencePanningVbap( azimuth[k], elevation[k], rend_common_data->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ - if ( hDirAC->numSimultaneousDirections == 2 ) + if ( rend_common_data->numSimultaneousDirections == 2 ) { - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); + spreadCoherencePanningVbap( azimuth2[k], elevation2[k], rend_common_data->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ - totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; + totalDirect = rend_common_data->energy_ratio1[md_idx][k] + rend_common_data->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = rend_common_data->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = rend_common_data->energy_ratio2[md_idx][k] / totalDirect; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= directRatio[0]; @@ -1924,12 +1937,12 @@ void ivas_dirac_dec_compute_directional_responses( int16_t num_channels_surrCoh; num_channels_surrCoh = num_channels_dir; - num_channels_surrCoh -= hDirAC->num_ele_spk_no_diffuse_rendering; + num_channels_surrCoh -= hDirACRend->num_ele_spk_no_diffuse_rendering; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= sqrtf( 1.0f - surCohRatio[k] ); - if ( hDirAC->diffuse_response_function[l] > 0.f ) + if ( hDirACRend->diffuse_response_function[l] > 0.f ) { direct_response_ls[l] += sqrtf( surCohRatio[k] / (float) num_channels_surrCoh ); } @@ -1940,8 +1953,8 @@ void ivas_dirac_dec_compute_directional_responses( /* Set computed gains */ direct_response = direct_response_ls; v_mult( direct_response, direct_response, direct_response_square, num_channels_dir ); - mvr2r_inc( direct_response_square, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k], hDirAC->num_freq_bands, num_channels_dir ); - mvr2r_inc( direct_response, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], rend_common_data->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], rend_common_data->num_freq_bands, num_channels_dir ); } else { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2294203053..b980f9e7d1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -888,77 +888,57 @@ ivas_error ivas_init_decoder( st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2; } } - else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { return error; } - if ( st_ivas->ivas_format == MASA_FORMAT ) + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } - else if ( st_ivas->ivas_format == SBA_FORMAT ) + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { - if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } + } - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) + { + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + else + { + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - } - else + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) { - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) - { - st_ivas->hSpar->enc_param_start_band = 0; - - set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); - st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; - } + st_ivas->hSpar->enc_param_start_band = 0; - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); - } - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && - st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->ivas_format != SBA_FORMAT ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { @@ -1006,6 +986,52 @@ ivas_error ivas_init_decoder( /* set CNA/CNG flags */ ivas_sba_set_cna_cng_flag( st_ivas ); } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + /* set CNA/CNG flags */ + ivas_sba_set_cna_cng_flag( st_ivas ); + } else if ( st_ivas->ivas_format == MC_FORMAT ) { if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -1140,7 +1166,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } @@ -1256,7 +1282,8 @@ ivas_error ivas_init_decoder( return error; } } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + /* ParamISM is handled separately from other common config */ + else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && (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_STEREO_PARAMETRIC ) { @@ -1671,6 +1698,8 @@ void ivas_initialize_handles_dec( /* rendering handles */ st_ivas->hBinRenderer = NULL; st_ivas->hDiracDecBin = NULL; + st_ivas->hDirACRend = NULL; + st_ivas->rend_common_data = NULL; st_ivas->hLsSetUpConversion = NULL; st_ivas->hEFAPdata = NULL; st_ivas->hVBAPdata = NULL; @@ -1781,10 +1810,12 @@ void ivas_destroy_dec( /* DirAC handle */ if ( st_ivas->ivas_format == ISM_FORMAT ) { - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &(st_ivas->rend_common_data), st_ivas->hDecoderConfig->output_config ); } else { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } @@ -1979,7 +2010,7 @@ void ivas_init_dec_get_num_cldfb_instances( { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } - else if ( st_ivas->nchan_transport == 1 && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + else if ( st_ivas->nchan_transport == 1 && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index c031ec8c4b..dc436c3c7a 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -65,11 +65,14 @@ static ivas_error ivas_ism_bitrate_switching( AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; error = IVAS_ERR_OK; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; + rend_common_data = st_ivas->rend_common_data; + /* we have to temporarily set the ism mode back to the old one, otherwise this can give wrong results*/ ism_mode = st_ivas->ism_mode; st_ivas->ism_mode = last_ism_mode; @@ -122,13 +125,13 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hDirAC != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) + if ( last_ism_mode == ISM_MODE_PARAM && rend_common_data != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; - mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered; + st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots; + st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered; + mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv @@ -166,7 +169,7 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { /* Deallocate the ParamISM struct */ - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &(st_ivas->rend_common_data), st_ivas->hDecoderConfig->output_config ); #ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) @@ -339,14 +342,14 @@ static ivas_error ivas_ism_bitrate_switching( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->hDirAC != NULL ) + if ( rend_common_data != NULL ) { - st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; + rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 2497f5ab98..7fd5aa5150 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -287,6 +287,7 @@ static void ivas_param_ism_compute_mixing_matrix( static void ivas_param_ism_render_slot( DIRAC_DEC_HANDLE hDirAC, + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX], float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -302,7 +303,7 @@ static void ivas_param_ism_render_slot( tmp_1 = hDirAC->hParamIsmRendering->interpolator[interpolator_idx]; - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) { /* smooth the mixing matrix */ for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) @@ -324,6 +325,7 @@ static void ivas_param_ism_render_slot( static void ivas_param_ism_rendering( DIRAC_DEC_HANDLE hDirAC, + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][4][CLDFB_NO_CHANNELS_MAX], @@ -339,7 +341,7 @@ static void ivas_param_ism_rendering( tmp_1 = hDirAC->hParamIsmRendering->interpolator[slot_idx]; - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) { /* smooth the mixing matrix */ for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) @@ -440,6 +442,7 @@ ivas_error ivas_param_ism_dec_open( int16_t i; DIRAC_DEC_HANDLE hDirAC; IVAS_OUTPUT_SETUP hOutSetup; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; AUDIO_CONFIG output_config; int32_t output_Fs; ivas_error error; @@ -457,6 +460,11 @@ ivas_error ivas_param_ism_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } + if ( ( rend_common_data = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + /* Assign memory to Param Object handle */ if ( ( hDirAC->hParamIsm = (PARAM_ISM_CONFIG_HANDLE) malloc( sizeof( PARAM_ISM_CONFIG_DATA ) ) ) == NULL ) { @@ -477,15 +485,15 @@ ivas_error ivas_param_ism_dec_open( * set input parameters *-----------------------------------------------------------------*/ - hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + rend_common_data->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); hDirAC->hConfig = NULL; - set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - hDirAC->subframes_rendered = 0; - hDirAC->slots_rendered = 0; - hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + set_s( rend_common_data->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( rend_common_data->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + rend_common_data->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + rend_common_data->subframes_rendered = 0; + rend_common_data->slots_rendered = 0; + rend_common_data->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + rend_common_data->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -493,9 +501,9 @@ ivas_error ivas_param_ism_dec_open( { hDirAC->hParamIsm->band_grouping[i] = Param_ISM_band_grouping[i]; - if ( hDirAC->hParamIsm->band_grouping[i] > hDirAC->num_freq_bands ) + if ( hDirAC->hParamIsm->band_grouping[i] > rend_common_data->num_freq_bands ) { - hDirAC->hParamIsm->band_grouping[i] = hDirAC->num_freq_bands; + hDirAC->hParamIsm->band_grouping[i] = rend_common_data->num_freq_bands; } } @@ -546,19 +554,19 @@ ivas_error ivas_param_ism_dec_open( set_zero( hDirAC->azimuth_values, MAX_NUM_OBJECTS ); set_zero( hDirAC->elevation_values, MAX_NUM_OBJECTS ); - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - hDirAC->dirac_bs_md_write_idx = 0; - hDirAC->dirac_read_idx = 0; + rend_common_data->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + rend_common_data->dirac_bs_md_write_idx = 0; + rend_common_data->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 1 ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 2 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 2 ) ) != IVAS_ERR_OK ) { return error; } @@ -567,6 +575,7 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hISMDTX.dtx_flag = 0; st_ivas->hDirAC = hDirAC; + st_ivas->rend_common_data = rend_common_data; if ( st_ivas->hDecoderConfig->voip_active ) { @@ -582,17 +591,17 @@ ivas_error ivas_param_ism_dec_open( } else { - if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } - set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands ); - if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } - set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands ); } if ( st_ivas->hTcBuffer == NULL ) { @@ -635,65 +644,69 @@ ivas_error ivas_param_ism_dec_open( void ivas_param_ism_dec_close( DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out, /* i/o: common spatial renderer data */ AUDIO_CONFIG output_config /* i : output audio configuration */ ) { - DIRAC_DEC_HANDLE hDirAC; - - if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + if ( hDirAC_out != NULL && *hDirAC_out != NULL ) { - return; - } - - hDirAC = *hDirAC_out; + DIRAC_DEC_HANDLE hDirAC; + hDirAC = *hDirAC_out; - /* Config & CLDFB */ - if ( hDirAC->hParamIsm != NULL ) - { - free( hDirAC->hParamIsm ); - hDirAC->hParamIsm = NULL; - } + /* Config & CLDFB */ + if ( hDirAC->hParamIsm != NULL ) + { + free( hDirAC->hParamIsm ); + hDirAC->hParamIsm = NULL; + } - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - ivas_dirac_deallocate_parameters( hDirAC, 1 ); - ivas_dirac_deallocate_parameters( hDirAC, 2 ); - } + if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) + { + /* Param ISM Rendering */ + if ( hDirAC->hParamIsmRendering->interpolator != NULL ) + { + free( hDirAC->hParamIsmRendering->interpolator ); + hDirAC->hParamIsmRendering->interpolator = NULL; + } + if ( hDirAC->hParamIsmRendering->proto_matrix != NULL ) + { + free( hDirAC->hParamIsmRendering->proto_matrix ); + hDirAC->hParamIsmRendering->proto_matrix = NULL; + } + } - if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) - { - /* Param ISM Rendering */ - if ( hDirAC->hParamIsmRendering->interpolator != NULL ) + if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) { - free( hDirAC->hParamIsmRendering->interpolator ); - hDirAC->hParamIsmRendering->interpolator = NULL; + free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; } - if ( hDirAC->hParamIsmRendering->proto_matrix != NULL ) + if ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc != NULL ) { - free( hDirAC->hParamIsmRendering->proto_matrix ); - hDirAC->hParamIsmRendering->proto_matrix = NULL; + free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); + hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } - } - if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) - { - free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); - hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; - } - if ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc != NULL ) - { - free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); - hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + if ( hDirAC->hParamIsmRendering != NULL ) + { + free( hDirAC->hParamIsmRendering ); + hDirAC->hParamIsmRendering = NULL; + } + + free( *hDirAC_out ); + *hDirAC_out = NULL; } - if ( hDirAC->hParamIsmRendering != NULL ) + if ( rend_common_data_out != NULL && *rend_common_data_out != NULL ) { - free( hDirAC->hParamIsmRendering ); - hDirAC->hParamIsmRendering = NULL; - } + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + ivas_dirac_deallocate_parameters( *rend_common_data_out, 1 ); + ivas_dirac_deallocate_parameters( *rend_common_data_out, 2 ); + } - free( *hDirAC_out ); - *hDirAC_out = NULL; + free( *rend_common_data_out ); + *rend_common_data_out = NULL; + } return; } @@ -735,12 +748,15 @@ void ivas_param_ism_dec( float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; IVAS_OUTPUT_SETUP hSetup; /* Initialization */ hDirAC = st_ivas->hDirAC; assert( hDirAC ); + rend_common_data = st_ivas->rend_common_data; + assert( rend_common_data ); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; @@ -873,14 +889,14 @@ void ivas_param_ism_dec( *-----------------------------------------------------------------*/ for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - cldfbAnalysis_ts( &( output_f[ch][hDirAC->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( output_f[ch][rend_common_data->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], rend_common_data->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); ivas_param_ism_collect_slot( hDirAC, Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], ch, ref_power, cx_diag ); } } /* Obtain Mixing Matrix on a frame-level */ - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) { set_f( mixing_matrix[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); } @@ -888,28 +904,28 @@ void ivas_param_ism_dec( /* Compute mixing matrix */ ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, mixing_matrix ); /* subframe loop for synthesis*/ - for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) + for ( subframe_idx = 0; subframe_idx < rend_common_data->nb_subframes; subframe_idx++ ) { - uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots[subframe_idx]; + uint16_t slot_idx_start = subframe_idx * rend_common_data->subframe_nbslots[subframe_idx]; uint16_t idx_in; uint16_t idx_lfe; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); - set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); } } - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; /* Compute bandwise rendering to target LS using covariance rendering */ - ivas_param_ism_rendering( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + ivas_param_ism_rendering( hDirAC, rend_common_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, mixing_matrix, slot_idx, index_slot, nchan_out_woLFE, nchan_transport ); } @@ -922,7 +938,7 @@ void ivas_param_ism_dec( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); + set_zero( &( output_f[ch][slot_idx_start * rend_common_data->num_freq_bands] ), rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->num_freq_bands ); if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -934,14 +950,14 @@ void ivas_param_ism_dec( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * rend_common_data->num_freq_bands] ), + rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); idx_in++; } @@ -1091,10 +1107,13 @@ void ivas_param_ism_dec_digest_tc( /* Direct Response/EFAP Gains */ float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; /* Initialization */ hDirAC = st_ivas->hDirAC; assert( hDirAC ); + rend_common_data = st_ivas->rend_common_data; + assert(rend_common_data); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; @@ -1233,16 +1252,16 @@ void ivas_param_ism_dec_digest_tc( float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - cldfbAnalysis_ts( &( transport_channels_f[ch][hDirAC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands], hDirAC->num_freq_bands ); - mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands], hDirAC->num_freq_bands ); + cldfbAnalysis_ts( &( transport_channels_f[ch][rend_common_data->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, rend_common_data->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands], rend_common_data->num_freq_bands ); + mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands], rend_common_data->num_freq_bands ); ivas_param_ism_collect_slot( hDirAC, RealBuffer, ImagBuffer, ch, ref_power, cx_diag ); } } /* Obtain Mixing Matrix on a frame-level */ - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) { set_f( hDirAC->hParamIsmRendering->mixing_matrix_lin[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); } @@ -1278,6 +1297,7 @@ static void ivas_ism_param_dec_render_sf( float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX]; float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX]; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; int16_t slot_idx_start; int16_t idx_in; @@ -1285,31 +1305,32 @@ static void ivas_ism_param_dec_render_sf( int16_t subframe_idx; hDirAC = st_ivas->hDirAC; - slot_idx_start = hDirAC->slots_rendered; - subframe_idx = hDirAC->subframes_rendered; + rend_common_data = st_ivas->rend_common_data; + slot_idx_start = rend_common_data->slots_rendered; + subframe_idx = rend_common_data->subframes_rendered; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); - set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); } } - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; for ( ch = 0; ch < nchan_transport; ch++ ) { - Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands]; - Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands]; + Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands]; + Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands]; } /* Compute bandwise rendering to target LS using covariance rendering */ - ivas_param_ism_render_slot( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + ivas_param_ism_render_slot( hDirAC, rend_common_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->hParamIsmRendering->mixing_matrix_lin, index_slot, slot_idx, nchan_out_woLFE, nchan_transport ); } @@ -1322,7 +1343,7 @@ static void ivas_ism_param_dec_render_sf( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( output_f[ch], hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); + set_zero( output_f[ch], rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->num_freq_bands ); if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1334,19 +1355,19 @@ static void ivas_ism_param_dec_render_sf( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } cldfbSynthesis( RealBuffer, ImagBuffer, output_f[ch], - hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); idx_in++; } } - hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; - hDirAC->subframes_rendered++; + rend_common_data->slots_rendered += rend_common_data->subframe_nbslots[subframe_idx]; + rend_common_data->subframes_rendered++; return; } @@ -1369,14 +1390,17 @@ void ivas_param_ism_dec_render( int16_t ch, slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, n_samples_sf; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; IVAS_OUTPUT_SETUP hSetup; int16_t nchan_transport, nchan_out, nchan_out_woLFE; float *output_f_local[MAX_OUTPUT_CHANNELS]; hDirAC = st_ivas->hDirAC; + rend_common_data = st_ivas->rend_common_data; hSetup = st_ivas->hIntSetup; #ifdef DEBUGGING assert( hDirAC ); + assert( rend_common_data ); #endif nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) @@ -1393,14 +1417,14 @@ void ivas_param_ism_dec_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( rend_common_data->num_slots - rend_common_data->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = hDirAC->subframes_rendered; + first_sf = rend_common_data->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + slots_to_render -= rend_common_data->subframe_nbslots[last_sf]; last_sf++; } #ifdef DEBUGGING @@ -1415,14 +1439,14 @@ void ivas_param_ism_dec_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { ivas_ism_param_dec_render_sf( st_ivas, hSetup, nchan_transport, nchan_out, nchan_out_woLFE, output_f_local ); - n_samples_sf = hDirAC->subframe_nbslots[subframe_idx] * st_ivas->hDirAC->slot_size; + n_samples_sf = rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->slot_size; for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] += n_samples_sf; } } - if ( hDirAC->slots_rendered == hDirAC->num_slots ) + if ( rend_common_data->slots_rendered == rend_common_data->num_slots ) { /* copy the memories */ /* store mixing matrix for next subframe */ @@ -1444,7 +1468,7 @@ void ivas_param_ism_dec_render( } } - *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + *nSamplesAvailable = ( rend_common_data->num_slots - rend_common_data->slots_rendered ) * slot_size; return; } @@ -1461,6 +1485,7 @@ void ivas_param_ism_params_to_masa_param_mapping( ) { DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; int16_t nBins; int16_t band_idx, bin_idx, sf_idx; int16_t brange[2]; @@ -1470,7 +1495,8 @@ void ivas_param_ism_params_to_masa_param_mapping( int32_t ivas_total_brate; hDirAC = st_ivas->hDirAC; - nBins = hDirAC->num_freq_bands; + rend_common_data = st_ivas->rend_common_data; + nBins = rend_common_data->num_freq_bands; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -1492,7 +1518,7 @@ void ivas_param_ism_params_to_masa_param_mapping( float energy_ratio; energy_ratio = powf( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence, 2.0f ); - hDirAC->numSimultaneousDirections = 1; + rend_common_data->numSimultaneousDirections = 1; azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); @@ -1500,19 +1526,19 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; + rend_common_data->azimuth[sf_idx][bin_idx] = azimuth[0]; + rend_common_data->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = energy_ratio; + rend_common_data->energy_ratio1[sf_idx][bin_idx] = energy_ratio; - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + rend_common_data->spreadCoherence[sf_idx][bin_idx] = 0.0f; + rend_common_data->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } else { - hDirAC->numSimultaneousDirections = 2; + rend_common_data->numSimultaneousDirections = 2; for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) { brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; @@ -1530,12 +1556,12 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; - hDirAC->azimuth2[sf_idx][bin_idx] = azimuth[1]; - hDirAC->elevation2[sf_idx][bin_idx] = elevation[1]; - hDirAC->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; + rend_common_data->azimuth[sf_idx][bin_idx] = azimuth[0]; + rend_common_data->elevation[sf_idx][bin_idx] = elevation[0]; + rend_common_data->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; + rend_common_data->azimuth2[sf_idx][bin_idx] = azimuth[1]; + rend_common_data->elevation2[sf_idx][bin_idx] = elevation[1]; + rend_common_data->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; } } } @@ -1544,16 +1570,16 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->spreadCoherence2[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + rend_common_data->spreadCoherence[sf_idx][bin_idx] = 0.0f; + rend_common_data->spreadCoherence2[sf_idx][bin_idx] = 0.0f; + rend_common_data->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } } else { - hDirAC->numSimultaneousDirections = 1; + rend_common_data->numSimultaneousDirections = 1; azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); @@ -1561,11 +1587,11 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = 1.0f; - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + rend_common_data->azimuth[sf_idx][bin_idx] = azimuth[0]; + rend_common_data->elevation[sf_idx][bin_idx] = elevation[0]; + rend_common_data->energy_ratio1[sf_idx][bin_idx] = 1.0f; + rend_common_data->spreadCoherence[sf_idx][bin_idx] = 0.0f; + rend_common_data->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ff28af051a..bef4160ee5 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -631,6 +631,7 @@ ivas_error ivas_jbm_dec_render( ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; float *p_tc[MAX_TRANSPORT_CHANNELS]; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; error = IVAS_ERR_OK; @@ -640,6 +641,7 @@ ivas_error ivas_jbm_dec_render( * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ + rend_common_data = st_ivas->rend_common_data; output_Fs = st_ivas->hDecoderConfig->output_Fs; nchan_out = st_ivas->hDecoderConfig->nchan_out; nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; @@ -844,7 +846,7 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - int16_t offset = st_ivas->hDirAC->slots_rendered * st_ivas->hDirAC->slot_size; + int16_t offset = rend_common_data->slots_rendered * rend_common_data->slot_size; 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 ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 0576fe8121..1a84415122 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -35,6 +35,7 @@ #include #include "ivas_cnst.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "prot.h" @@ -287,7 +288,7 @@ ivas_error ivas_masa_decode( } if ( st_ivas->hDirAC != NULL ) { - ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, ivas_format, 0, 0 ); + ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->rend_common_data, ivas_total_brate, ivas_format, 0, 0 ); } st->next_bit_pos = next_bit_pos_orig; @@ -973,7 +974,7 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); - if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->hDirAC == NULL ) + if ( (st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL) || ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin == NULL) ) { /* init a new DirAC dec */ if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) @@ -981,10 +982,16 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } - else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) + else if ( st_ivas->renderer_type == RENDERER_DISABLE ) { - /* close unnecessary DirAC dec */ - ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + if ( st_ivas->hDirAC != NULL ) + { + /* close all unnecessary parametric decoding and rendering */ + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + } } /* possible reconfigure is done later */ @@ -1003,6 +1010,14 @@ ivas_error ivas_masa_dec_reconfigure( sts = st_ivas->hSCE[sce_id]->hCoreCoder; sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hSCE[sce_id]->element_brate / FRAMES_PER_SEC ); + + if ( (st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin != NULL) + { + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) + { + return error; + } + } } for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -1023,7 +1038,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = 1; - if ( st_ivas->hDirAC != NULL ) + if ( (st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL) || ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin != NULL) ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1035,8 +1050,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = CPE_CHANNELS; - if ( st_ivas->hDirAC != NULL ) - { + if ( (st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL) || ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin != NULL) ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { return error; @@ -1044,22 +1058,12 @@ ivas_error ivas_masa_dec_reconfigure( } } } + if ( st_ivas->hDiracDecBin != NULL ) { /* regularization factor is bitrate-dependent */ st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); } - /*-----------------------------------------------------------------* - * TD Decorrelator - *-----------------------------------------------------------------*/ - - if ( st_ivas->hDiracDecBin != NULL ) - { - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } /*-----------------------------------------------------------------* * CLDFB instances @@ -1130,15 +1134,17 @@ void ivas_spar_param_to_masa_param_mapping( int16_t slot_idx, slot_idx_start, sf; SPAR_DEC_HANDLE hSpar; float slot_fac; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; /* Set values */ hDirAC = st_ivas->hDirAC; - hDirAC->numSimultaneousDirections = 1; - hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; + rend_common_data = st_ivas->rend_common_data; + rend_common_data->numSimultaneousDirections = 1; + hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; hSpar = st_ivas->hSpar; - dirac_write_idx = hDirAC->render_to_md_map[subframe]; + dirac_write_idx = rend_common_data->render_to_md_map[subframe]; /* Init arrays */ for ( i = 0; i < FOA_CHANNELS; i++ ) @@ -1210,7 +1216,7 @@ void ivas_spar_param_to_masa_param_mapping( set_zero( transportSignalEnergies[1], nBins ); set_zero( transportSignalCrossCorrelation, nBins ); - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -1270,13 +1276,13 @@ void ivas_spar_param_to_masa_param_mapping( ratio = I / fmaxf( 1e-12f, E ); /* Energy ratio */ ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) ); - hDirAC->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); - hDirAC->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); - hDirAC->energy_ratio1[dirac_write_idx][bin] = ratio; - hDirAC->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; + rend_common_data->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); + rend_common_data->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); + rend_common_data->energy_ratio1[dirac_write_idx][bin] = ratio; + rend_common_data->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; - hDirAC->spreadCoherence[dirac_write_idx][bin] = 0.0f; - hDirAC->surroundingCoherence[dirac_write_idx][bin] = 0.0f; + rend_common_data->spreadCoherence[dirac_write_idx][bin] = 0.0f; + rend_common_data->surroundingCoherence[dirac_write_idx][bin] = 0.0f; /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ if ( hDiffuseDist != NULL ) diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index 99b3ff6874..efdb0a8122 100755 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -82,7 +82,7 @@ ivas_error ivas_mcmasa_dec_reconfig( { if ( st_ivas->hDirAC == NULL ) { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } @@ -96,51 +96,5 @@ ivas_error ivas_mcmasa_dec_reconfig( } } - /*-------------------------------------------------------------------* - * Close binaural rendering handles and re-allocate proper ones - * in McMASA renderer_type can be only RENDERER_BINAURAL_PARAMETRIC, RENDERER_BINAURAL_PARAMETRIC_ROOM - *--------------------------------------------------------------------*/ - - if ( st_ivas->hBinRenderer != NULL ) - { - ivas_binRenderer_close( &st_ivas->hBinRenderer ); - } - - if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) - { - /* open parametric binaural renderer */ - if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDiracDecBin != NULL ) - { - if ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) - { - /* close unneeded renderer */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - } - else - { - /* if necessary, close/open td-decorrs */ - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* regularization factor is bitrate-dependent */ - st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); - } - } - return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 7742656899..d979117373 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -684,11 +684,13 @@ static ivas_error ivas_mc_dec_reconfig( int16_t tc_granularity_new; AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; error = IVAS_ERR_OK; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; nchan_transport_old = st_ivas->nchan_transport; + rend_common_data = st_ivas->rend_common_data; last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ @@ -737,13 +739,13 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hDirAC != NULL ) + else if ( last_mc_mode == MC_MODE_MCMASA && rend_common_data != NULL ) { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; - mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered; + st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots; + st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered; + mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv @@ -796,7 +798,9 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { - ivas_dirac_dec_close( &st_ivas->hDirAC ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -880,7 +884,9 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { - ivas_dirac_dec_close( &st_ivas->hDirAC ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -1111,6 +1117,8 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -1148,16 +1156,6 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } - else - { - /* useTdDecorr may change => close and re-open */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } } /* init necessary new renderers */ @@ -1168,21 +1166,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } } - else if ( st_ivas->hDiracDecBin == NULL && ( 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_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } else if ( st_ivas->hBinRendererTd == NULL && st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -1235,18 +1218,6 @@ static ivas_error ivas_mc_dec_reconfig( #endif } - /*-----------------------------------------------------------------* - * TD Decorrelator - *-----------------------------------------------------------------*/ - - if ( st_ivas->hDiracDecBin != NULL ) - { - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - /*-----------------------------------------------------------------* * CLDFB instances *-----------------------------------------------------------------*/ @@ -1292,13 +1263,13 @@ static ivas_error ivas_mc_dec_reconfig( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->hDirAC != NULL ) + if ( rend_common_data != NULL ) { - st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; + rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } else if ( st_ivas->hParamMC != NULL ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 22258a9365..7594c802be 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -65,7 +65,7 @@ void ivas_sba_set_cna_cng_flag( /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ /* st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; */ } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) + else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) { st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; @@ -111,15 +111,15 @@ ivas_error ivas_sba_dec_reconfigure( int32_t ivas_total_brate; int32_t last_ivas_total_brate; - RENDERER_TYPE old_renderer_type; - DECODER_CONFIG_HANDLE hDecoderConfig; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; ivas_error error; error = IVAS_ERR_OK; hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; + rend_common_data = st_ivas->rend_common_data; /*-----------------------------------------------------------------* * Set SBA high-level parameters @@ -144,13 +144,13 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( st_ivas->hDirAC != NULL ) + else if ( rend_common_data != NULL ) { - st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; - st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; - mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots; + st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered; + mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /*-----------------------------------------------------------------* @@ -216,7 +216,6 @@ ivas_error ivas_sba_dec_reconfigure( /* renderer might have changed */ intern_config_old = st_ivas->intern_config; - old_renderer_type = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); /* side effect of the renderer selection can be a changed internal config */ @@ -242,29 +241,6 @@ ivas_error ivas_sba_dec_reconfigure( ivas_binRenderer_close( &st_ivas->hBinRenderer ); } - if ( st_ivas->renderer_type != old_renderer_type ) - { - 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_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) ) - { - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - } - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -281,11 +257,14 @@ ivas_error ivas_sba_dec_reconfigure( } /* synchronize subframe info */ - st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + if ( rend_common_data != NULL ) + { + rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; + rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } } if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) @@ -295,6 +274,8 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->renderer_type == RENDERER_DISABLE ) { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -373,7 +354,7 @@ ivas_error ivas_sba_dec_reconfigure( } else { - if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { tc_nchan_to_allocate++; /* we need a channel for the CNG in this case*/ } @@ -480,9 +461,11 @@ void ivas_sba_dec_render( uint16_t slot_size, ch; uint16_t nchan_internal, nchan_out; SPAR_DEC_HANDLE hSpar; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float *output_f_local[MAX_OUTPUT_CHANNELS]; hSpar = st_ivas->hSpar; + rend_common_data = st_ivas->rend_common_data; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; @@ -531,11 +514,11 @@ void ivas_sba_dec_render( { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; } else { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; } } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 906a73b317..58318f4dc9 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -320,7 +320,7 @@ ivas_error ivas_spar_dec( /* read DirAC bitstream */ if ( st_ivas->hQMetaData != NULL ) { - ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hQMetaData, nb_bits_read, + ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->rend_common_data, st_ivas->hQMetaData, nb_bits_read, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); } @@ -1298,6 +1298,7 @@ void ivas_spar_dec_upmixer( ) { SPAR_DEC_HANDLE hSpar; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; int16_t nchan_transport, nchan_out; int16_t subframe_idx, n, i; int16_t n_samples_sf; @@ -1377,15 +1378,16 @@ void ivas_spar_dec_upmixer( st_ivas->hTcBuffer->tc[n] = NULL; } - if ( st_ivas->hDirAC != 0 ) + if ( st_ivas->hDirAC != NULL && st_ivas->rend_common_data != NULL ) { + rend_common_data = st_ivas->rend_common_data; if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; } else { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; } } @@ -1671,7 +1673,7 @@ void ivas_spar_dec_upmixer_sf( if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) { set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); - if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) + if ( idx_lfe < ( st_ivas->hDirACRend->hOutSetup.num_lfe - 1 ) ) { idx_lfe++; } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index e83aa7e617..d78595ba71 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2891,6 +2891,9 @@ void ivas_spar_to_dirac( end_band = min( num_bands_out, SPAR_DIRAC_SPLIT_START_BAND ) / bw; hDirAC = st_ivas->hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + rend_common_data = st_ivas->rend_common_data; + dirac_to_spar_md_bands = st_ivas->hSpar->dirac_to_spar_md_bands; enc_param_start_band = st_ivas->hSpar->enc_param_start_band / bw; active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; @@ -2995,8 +2998,8 @@ void ivas_spar_to_dirac( { int16_t ts_start, ts_end, ts; - ts_start = hDirAC->block_grouping[block]; - ts_end = hDirAC->block_grouping[block + 1]; + ts_start = DirAC_block_grouping[block]; + ts_end = DirAC_block_grouping[block + 1]; for ( b = qmf_band_start; b < qmf_band_end; b++ ) { @@ -3011,38 +3014,38 @@ void ivas_spar_to_dirac( ele_dith = ele[band]; #endif - hDirAC->energy_ratio1[block][b] = en_ratio; + rend_common_data->energy_ratio1[block][b] = en_ratio; tmp_write_idx_band = tmp_write_idx_param_band; if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele_dith; - hDirAC->azimuth[tmp_write_idx_band][b] = azi_dith; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + rend_common_data->elevation[tmp_write_idx_band][b] = ele_dith; + rend_common_data->azimuth[tmp_write_idx_band][b] = azi_dith; + rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; } else { for ( ts = ts_start; ts < ts_end; ts++ ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele_dith; - hDirAC->azimuth[tmp_write_idx_band][b] = azi_dith; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + rend_common_data->elevation[tmp_write_idx_band][b] = ele_dith; + rend_common_data->azimuth[tmp_write_idx_band][b] = azi_dith; + rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % rend_common_data->dirac_md_buffer_length; } } } - tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hDirAC->dirac_md_buffer_length; + tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % rend_common_data->dirac_md_buffer_length; } } /* update buffer write index */ if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % rend_common_data->dirac_md_buffer_length; } else { - hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % hDirAC->dirac_md_buffer_length; + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % rend_common_data->dirac_md_buffer_length; } } else diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 315cfbad66..005934c07f 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -442,53 +442,6 @@ typedef struct param_ism_rendering } PARAM_ISM_RENDERING_DATA, *PARAM_ISM_RENDERING_HANDLE; -/*Onset detector*/ -typedef struct dirac_onset_detection_params_structure -{ - int16_t num_freq_bands; - int16_t max_band_decorr; - -} DIRAC_ONSET_DETECTION_PARAMS; - -typedef struct dirac_onset_detection_state_structure -{ - float *onset_detector_1; - float *onset_detector_2; - -} DIRAC_ONSET_DETECTION_STATE; - -/*Decorrelator*/ -typedef struct dirac_decorr_params_structure -{ - int16_t max_band_decorr; - int16_t max_frequency; - - int16_t *pre_delay; - int16_t *filter_length; - float *filter_coeff_num_real; - float *filter_coeff_den_real; - float *phase_coeff_real; - float *phase_coeff_imag; - int16_t *split_frequency_bands; - int16_t num_split_frequency_bands; - - int16_t use_ducker; - int16_t add_back_onsets_on; - - DIRAC_ONSET_DETECTION_PARAMS h_onset_detection_power_params; - -} DIRAC_DECORR_PARAMS, *HANDLE_DIRAC_DECORR_PARAMS; - -typedef struct dirac_decorr_state_structure -{ - float *decorr_buffer; - float *direct_energy_smooth; - float *reverb_energy_smooth; - - DIRAC_ONSET_DETECTION_STATE h_onset_detection_power_state; - -} DIRAC_DECORR_STATE, *HANDLE_DIRAC_DECORR_STATE; - /*Output synthesis*/ typedef struct dirac_output_synthesis_params_structure { @@ -613,66 +566,44 @@ typedef struct } MASA_STEREO_TYPE_DETECT; -/* Diffuse sound directional distribution data structure */ -typedef struct ivas_diffuse_distribution_data_structure -{ - float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; - -} DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; - /* ===== DirAC main structure ===== */ typedef struct ivas_dirac_dec_data_structure { DIRAC_CONFIG_DATA_HANDLE hConfig; - IVAS_OUTPUT_SETUP hOutSetup; - - int16_t slot_size; - int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; - int16_t subframes_rendered; - int16_t slots_rendered; - int16_t num_slots; - int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; - int16_t nb_subframes; - int16_t num_freq_bands; /*Parameter decoding*/ float azimuth_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; float elevation_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - int16_t block_grouping[5]; - /* decoded, ungrouped and rounded values, we have 1 degree resolution anyway */ - int16_t **azimuth; - int16_t **elevation; - int16_t **azimuth2; - int16_t **elevation2; + int16_t dithering_seed; + int16_t spar_to_dirac_write_idx; + + /*sub-modules*/ + PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ + float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; + PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; - float **diffuseness_vector; - float **energy_ratio1; - float **energy_ratio2; + IVAS_FB_MIXER_HANDLE hFbMdft; - float **spreadCoherence; - float **spreadCoherence2; - float **surroundingCoherence; +} DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; - int16_t dithering_seed; - int16_t dirac_bs_md_write_idx; - int16_t dirac_read_idx; - int16_t dirac_estimator_idx; - int16_t spar_to_dirac_write_idx; - int16_t dirac_md_buffer_length; - int16_t numSimultaneousDirections; /* 1 or 2 */ - DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; +typedef struct ivas_dirac_rend_data_structure +{ + IVAS_OUTPUT_SETUP hOutSetup; /*Parameter estimation*/ int16_t index_buffer_intensity; float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; float *buffer_energy; + float *frequency_axis; + float *diffuse_response_function; + float *hoa_encoder; + const float *hoa_decoder; + /*Decoder parameters */ /*Prototypes*/ int16_t num_outputs_dir; @@ -683,15 +614,6 @@ typedef struct ivas_dirac_dec_data_structure DIRAC_SYNTHESIS_CONFIG synthesisConf; DIRAC_PANNING_CONFIG panningConf; - float *frequency_axis; - float *diffuse_response_function; - float *hoa_encoder; - const float *hoa_decoder; - - /*Options*/ - /* Decorrelator options */ - int16_t max_band_decorr; - /* prototype computing */ int16_t *proto_index_dir; int16_t *proto_index_diff; @@ -707,20 +629,15 @@ typedef struct ivas_dirac_dec_data_structure int16_t num_ele_spk_no_diffuse_rendering; - /*sub-modules*/ - HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; - HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; + const int16_t *sba_map_tc; DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_psd_params; DIRAC_OUTPUT_SYNTHESIS_STATE h_output_synthesis_psd_state; - PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ - float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; - PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; - IVAS_FB_MIXER_HANDLE hFbMdft; - const int16_t *sba_map_tc; + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; -} DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; +} DIRAC_REND_DATA, *DIRAC_REND_HANDLE; /*----------------------------------------------------------------------------------* @@ -1330,6 +1247,8 @@ typedef struct Decoder_Struct int32_t binaural_latency_ns; /* Binauralization latency in ns */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData; /* External orientation data structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; /* Combined external and head orientation data structure */ + DIRAC_REND_HANDLE hDirACRend; /* DirAC renderer handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; /* Spatial parametric (DirAC rend, ParamBin, ParamISM) rendering common data handle. */ /* JBM module */ DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 4616993f79..0ec9f113b0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -81,7 +81,7 @@ typedef struct hrtfGainCache static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); -static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); @@ -122,6 +122,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( int16_t j, k, bin; float binCenterFreq, tmpFloat; ivas_error error; + float frequency_axis[CLDFB_NO_CHANNELS_MAX]; hBinaural = st_ivas->hDiracDecBin; @@ -134,10 +135,12 @@ ivas_error ivas_dirac_dec_init_binaural_data( hBinaural->hTdDecorr = NULL; hBinaural->hReverb = NULL; + hBinaural->h_freq_domain_decorr_ap_params = NULL; + hBinaural->h_freq_domain_decorr_ap_state = NULL; } - nBins = st_ivas->hDirAC->num_freq_bands; output_Fs = st_ivas->hDecoderConfig->output_Fs; + nBins = st_ivas->rend_common_data->num_freq_bands; renderer_type = st_ivas->renderer_type; for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -220,16 +223,40 @@ ivas_error ivas_dirac_dec_init_binaural_data( assert( false ); } + hBinaural->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + if ( hBinaural->hTdDecorr == NULL ) { hBinaural->useTdDecorr = 0; } + if ( hBinaural->h_freq_domain_decorr_ap_params != NULL ) + { + ivas_dirac_dec_decorr_close( &hBinaural->h_freq_domain_decorr_ap_params, &hBinaural->h_freq_domain_decorr_ap_state ); + } + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hBinaural->hTdDecorr ), &( hBinaural->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } + if ( !hBinaural->useTdDecorr ) + { + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hBinaural->h_freq_domain_decorr_ap_params ), + &( hBinaural->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + hBinaural->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); st_ivas->hDiracDecBin = hBinaural; @@ -271,6 +298,10 @@ void ivas_dirac_dec_close_binaural_data( } ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); + if ( (*hBinaural)->h_freq_domain_decorr_ap_params != NULL ) + { + ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); + } free( *hBinaural ); *hBinaural = NULL; @@ -343,13 +374,13 @@ void ivas_dirac_dec_binaural_render( int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, ch; uint16_t nchan_out; - DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float *output_f_local[MAX_OUTPUT_CHANNELS]; - hDirAC = st_ivas->hDirAC; + rend_common_data = st_ivas->rend_common_data; nchan_out = BINAURAL_CHANNELS; #ifdef DEBUGGING - assert( hDirAC ); + assert( rend_common_data ); #endif for ( ch = 0; ch < nchan_out; ch++ ) { @@ -358,14 +389,14 @@ void ivas_dirac_dec_binaural_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( rend_common_data->num_slots - rend_common_data->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = hDirAC->subframes_rendered; + first_sf = rend_common_data->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + slots_to_render -= rend_common_data->subframe_nbslots[last_sf]; last_sf++; } @@ -374,7 +405,7 @@ void ivas_dirac_dec_binaural_render( #endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { - int16_t n_samples_sf = slot_size * hDirAC->subframe_nbslots[subframe_idx]; + int16_t n_samples_sf = slot_size * rend_common_data->subframe_nbslots[subframe_idx]; ivas_dirac_dec_binaural_internal( st_ivas, st_ivas->hCombinedOrientationData, output_f_local, nchan_transport, subframe_idx ); for ( ch = 0; ch < nchan_out; ch++ ) { @@ -382,12 +413,12 @@ void ivas_dirac_dec_binaural_render( } } - if ( hDirAC->slots_rendered == hDirAC->num_slots ) + if ( rend_common_data->slots_rendered == rend_common_data->num_slots ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; } - *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + *nSamplesAvailable = ( rend_common_data->num_slots - rend_common_data->slots_rendered ) * slot_size; return; } @@ -442,11 +473,13 @@ void ivas_dirac_dec_binaural( ) { int16_t subframe; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float cng_td_buffer[L_FRAME16k]; float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; int16_t slot_size; int16_t numInChannels; + rend_common_data = st_ivas->rend_common_data; slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) @@ -493,7 +526,7 @@ void ivas_dirac_dec_binaural( for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) { - int16_t n_samples_sf = slot_size * st_ivas->hDirAC->subframe_nbslots[subframe]; + int16_t n_samples_sf = slot_size * rend_common_data->subframe_nbslots[subframe]; ivas_dirac_dec_binaural_internal( st_ivas, hCombinedOrientationData, p_output, nchan_transport, subframe ); @@ -501,7 +534,7 @@ void ivas_dirac_dec_binaural( { p_output[ch] += n_samples_sf; } - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + 1 ) % st_ivas->hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + 1 ) % rend_common_data->dirac_md_buffer_length; } for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) @@ -525,7 +558,7 @@ static void ivas_dirac_dec_binaural_internal( const int16_t nchan_transport, const int16_t subframe ) { - DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; int16_t slot, ch, numInChannels; float Cldfb_RealBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -535,9 +568,9 @@ static void ivas_dirac_dec_binaural_internal( int16_t nBins, offsetSamples; int16_t i, j; - hDirAC = st_ivas->hDirAC; - nBins = hDirAC->num_freq_bands; - offsetSamples = hDirAC->slots_rendered * nBins; + rend_common_data = st_ivas->rend_common_data; + nBins = rend_common_data->num_freq_bands; + offsetSamples = rend_common_data->slots_rendered * nBins; /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; @@ -559,7 +592,7 @@ static void ivas_dirac_dec_binaural_internal( Rmat[2][2] = 1.0f; /* CLDFB Analysis of input */ - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) { for ( ch = 0; ch < numInChannels; ch++ ) { @@ -586,7 +619,7 @@ static void ivas_dirac_dec_binaural_internal( int16_t slotInFrame; numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; - slotInFrame = hDirAC->slots_rendered + slot; + slotInFrame = rend_common_data->slots_rendered + slot; generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], @@ -659,7 +692,7 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->ivas_format == SBA_FORMAT ) { - st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; + st_ivas->hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); @@ -678,9 +711,9 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { - adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); + adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, rend_common_data->subframe_nbslots[subframe], Rmat ); - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, rend_common_data->subframe_nbslots[subframe], Rmat ); } } @@ -697,25 +730,26 @@ static void ivas_dirac_dec_binaural_internal( } else { - max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + max_band_decorr = st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; } ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, subframe ); - st_ivas->hDirAC->hDiffuseDist = NULL; + st_ivas->hDiracDecBin->hDiffuseDist = NULL; - hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe]; - hDirAC->subframes_rendered++; + rend_common_data->slots_rendered += rend_common_data->subframe_nbslots[subframe]; + rend_common_data->subframes_rendered++; return; } static void ivas_dirac_dec_decorrelate_slot( - DIRAC_DEC_HANDLE hDirAC, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -725,37 +759,39 @@ static void ivas_dirac_dec_decorrelate_slot( int16_t offset, ch, bin; float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + float protoFrameF[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + const int16_t protoIndexDir[BINAURAL_CHANNELS] = {0, 1}; /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + offset = num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < num_freq_bands; bin++ ) { - hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; - hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; + protoFrameF[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; + protoFrameF[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; } } /* Decorrelate proto signal to decorrelatedFrameInterleaved */ - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, + ivas_dirac_dec_decorr_process( num_freq_bands, + BINAURAL_CHANNELS, BINAURAL_CHANNELS, - hDirAC->proto_frame_f, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, + DIRAC_SYNTHESIS_PSD_LS, + BINAURAL_CHANNELS, + protoFrameF, + BINAURAL_CHANNELS, + protoIndexDir, decorrelatedFrameInterleaved, onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); + hDiracDecBin->h_freq_domain_decorr_ap_params, + hDiracDecBin->h_freq_domain_decorr_ap_state ); /* De-interleave decorrelated signals*/ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + offset = num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < num_freq_bands; bin++ ) { decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; @@ -778,8 +814,8 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric uint8_t separateCenterChannelRendering; int16_t nBins, idx; float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; - DIRAC_DEC_HANDLE hDirAC; DIRAC_DEC_BIN_HANDLE h; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float IIReneLimiterFactor; float qualityBasedSmFactor; float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; @@ -788,10 +824,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; - hDirAC = st_ivas->hDirAC; + h = st_ivas->hDiracDecBin; + rend_common_data = st_ivas->rend_common_data; + separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = hDirAC->num_freq_bands; /* Actually bins */ + nBins = rend_common_data->num_freq_bands; /* Actually bins */ set_zero( h->ChCrossRe, nBins ); set_zero( h->ChCrossIm, nBins ); @@ -834,10 +872,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = hDirAC->render_to_md_map[subframe]; + dirac_read_idx = rend_common_data->render_to_md_map[subframe]; /* Calculate input covariance matrix */ - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -878,7 +916,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -905,7 +943,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - for ( dirIndex = 0; dirIndex < hDirAC->numSimultaneousDirections; dirIndex++ ) + for ( dirIndex = 0; dirIndex < rend_common_data->numSimultaneousDirections; dirIndex++ ) { int16_t aziDeg, eleDeg; float lRealp, lImagp, rRealp, rImagp; @@ -914,14 +952,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ { - aziDeg = hDirAC->azimuth[dirac_read_idx][bin]; - eleDeg = hDirAC->elevation[dirac_read_idx][bin]; - ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; - spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; + aziDeg = rend_common_data->azimuth[dirac_read_idx][bin]; + eleDeg = rend_common_data->elevation[dirac_read_idx][bin]; + ratio = rend_common_data->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = rend_common_data->spreadCoherence[dirac_read_idx][bin]; } else /* For second of the two simultaneous directions */ { - if ( ( ratio = hDirAC->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) + if ( ( ratio = rend_common_data->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) { /* This touches only MASA path where second direction always has smaller ratio and * for non-2dir it is zero. As the whole direction contribution is multiplied with @@ -929,9 +967,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * it is better to save complexity. */ continue; } - aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; - eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; - spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; + aziDeg = rend_common_data->azimuth2[dirac_read_idx][bin]; + eleDeg = rend_common_data->elevation2[dirac_read_idx][bin]; + spreadCoh = rend_common_data->spreadCoherence2[dirac_read_idx][bin]; } diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ @@ -1069,7 +1107,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Add diffuse / ambient part covariance matrix */ diffuseness = max( 0.0f, diffuseness ); diffEne = diffuseness * meanEnePerCh; - surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; + surCoh = rend_common_data->surroundingCoherence[dirac_read_idx][bin]; if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { if ( !h->renderStereoOutputInsteadOfBinaural ) @@ -1092,7 +1130,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric if ( st_ivas->ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) { float diffuseFieldCoherence; - diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; + diffuseFieldCoherence = h->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + h->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + h->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; } else @@ -1188,11 +1226,13 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( uint8_t separateCenterChannelRendering; int16_t nBins; DIRAC_DEC_BIN_HANDLE h; + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; PARAMBIN_HRTF_GAIN_CACHE gainCache; h = st_ivas->hDiracDecBin; + rend_common_data = st_ivas->rend_common_data; separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ + nBins = rend_common_data->num_freq_bands; /* Actually bins */ gainCache.azi = -1000; /* Use -1000 as value for uninitialized cache. */ @@ -1374,9 +1414,9 @@ static void ivas_dirac_dec_binaural_process_output( int16_t nSlots; h = st_ivas->hDiracDecBin; - nBins = st_ivas->hDirAC->num_freq_bands; + nBins = st_ivas->rend_common_data->num_freq_bands; offsetSamples = 0; - nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; + nSlots = st_ivas->rend_common_data->subframe_nbslots[subframe]; if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { @@ -1390,7 +1430,7 @@ static void ivas_dirac_dec_binaural_process_output( interpVal += 1.0f / (float) nSlots; if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { - ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); + ivas_dirac_dec_decorrelate_slot( st_ivas->hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c763630325..2e30aafd68 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -40,6 +40,7 @@ #include "stat_com.h" /* Note: Currently needed for CLDFB. */ #include "common_api_types.h" +//#include "ivas_stat_dec.h" /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) @@ -65,6 +66,91 @@ typedef struct ivas_output_setup_structure } IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; +/*----------------------------------------------------------------------------------* + * Spatial parametric rendering common structures + *----------------------------------------------------------------------------------*/ + +/*Onset detector*/ +typedef struct dirac_onset_detection_params_structure +{ + int16_t num_freq_bands; + int16_t max_band_decorr; + +} DIRAC_ONSET_DETECTION_PARAMS; + +typedef struct dirac_onset_detection_state_structure +{ + float *onset_detector_1; + float *onset_detector_2; + +} DIRAC_ONSET_DETECTION_STATE; + +/*Decorrelator*/ +typedef struct dirac_decorr_params_structure +{ + int16_t max_band_decorr; + int16_t max_frequency; + + int16_t *pre_delay; + int16_t *filter_length; + float *filter_coeff_num_real; + float *filter_coeff_den_real; + float *phase_coeff_real; + float *phase_coeff_imag; + int16_t *split_frequency_bands; + int16_t num_split_frequency_bands; + + int16_t use_ducker; + int16_t add_back_onsets_on; + + DIRAC_ONSET_DETECTION_PARAMS h_onset_detection_power_params; + +} DIRAC_DECORR_PARAMS, *HANDLE_DIRAC_DECORR_PARAMS; + +typedef struct dirac_decorr_state_structure +{ + float *decorr_buffer; + float *direct_energy_smooth; + float *reverb_energy_smooth; + + DIRAC_ONSET_DETECTION_STATE h_onset_detection_power_state; + +} DIRAC_DECORR_STATE, *HANDLE_DIRAC_DECORR_STATE; + +typedef struct ivas_spatial_parametric_rend_common_data_structure +{ + int16_t slot_size; + int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + int16_t subframes_rendered; + int16_t slots_rendered; + int16_t num_slots; + int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; + int16_t nb_subframes; + + int16_t num_freq_bands; + int16_t numSimultaneousDirections; /* 1 or 2 */ + + int16_t **azimuth; + int16_t **elevation; + int16_t **azimuth2; + int16_t **elevation2; + + float **diffuseness_vector; + float **energy_ratio1; + float **energy_ratio2; + + float **spreadCoherence; + float **spreadCoherence2; + float **surroundingCoherence; + + /* Metadata access indices and buffer size */ + int16_t dirac_bs_md_write_idx; + int16_t dirac_read_idx; + int16_t dirac_md_buffer_length; + +} SPAT_PARAM_REND_COMMON_DATA, *SPAT_PARAM_REND_COMMON_DATA_HANDLE; + + /*----------------------------------------------------------------------------------* * Binaural FastConv Rendering structure *----------------------------------------------------------------------------------*/ @@ -107,6 +193,17 @@ typedef struct ivas_binaural_reverb_struct } REVERB_STRUCT, *REVERB_STRUCT_HANDLE; + +/* Diffuse sound directional distribution data structure */ +typedef struct ivas_diffuse_distribution_data_structure +{ + float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; + float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; + float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; + +} DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; + + /* Parametric binaural data structure */ typedef struct ivas_dirac_dec_binaural_data_structure { @@ -138,11 +235,15 @@ typedef struct ivas_dirac_dec_binaural_data_structure float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; float reqularizationFactor; + DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; + + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; + } DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; typedef struct ivas_binaural_rendering_conv_module_struct diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4e75d5fea8..7f2c39d68b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2352,11 +2352,11 @@ static ivas_error initMasaDummyDecForMcOut( } decDummy->hQMetaData->coherence_flag = 1; - if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( decDummy, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - decDummy->hDirAC->dirac_bs_md_write_idx = 0; + decDummy->rend_common_data->dirac_bs_md_write_idx = 0; if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -2430,11 +2430,11 @@ static ivas_error initMasaDummyDecForSbaOut( } decDummy->hQMetaData->coherence_flag = 1; - if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( decDummy, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - decDummy->hDirAC->dirac_bs_md_write_idx = 0; + decDummy->rend_common_data->dirac_bs_md_write_idx = 0; numCldfbAnalyses = decDummy->nchan_transport; numCldfbSyntheses = decDummy->hDecoderConfig->nchan_out; @@ -2500,11 +2500,11 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy->ivas_format = MASA_FORMAT; decDummy->transport_config = AUDIO_CONFIG_INVALID; - if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( decDummy, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - decDummy->hDirAC->dirac_bs_md_write_idx = 0; + decDummy->rend_common_data->dirac_bs_md_write_idx = 0; if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -2770,6 +2770,8 @@ static void freeDecoderDummy( } /* DirAC handle */ + ivas_dirac_rend_close( &( pDecDummy->hDirACRend ) ); + ivas_spat_rend_common_data_close( &( pDecDummy->rend_common_data ) ); ivas_dirac_dec_close( &( pDecDummy->hDirAC ) ); /* Qmetadata handle */ @@ -5886,41 +5888,41 @@ static ivas_error renderActiveInputsSba( static void copyMasaMetadataToDiracRenderer( MASA_METADATA_FRAME *meta, - DIRAC_DEC_HANDLE hDirAC ) + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data ) { int16_t band, sf, bin; int16_t meta_write_index; - hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; + rend_common_data->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + sf ) % hDirAC->dirac_md_buffer_length; + meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + sf ) % rend_common_data->dirac_md_buffer_length; for ( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { for ( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1]; bin++ ) { - hDirAC->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; - hDirAC->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; - hDirAC->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; - hDirAC->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; - - if ( hDirAC->numSimultaneousDirections == 2 ) + rend_common_data->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; + rend_common_data->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; + rend_common_data->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; + rend_common_data->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; + rend_common_data->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; + rend_common_data->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; + + if ( rend_common_data->numSimultaneousDirections == 2 ) { - hDirAC->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; - hDirAC->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; - hDirAC->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; + rend_common_data->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; + rend_common_data->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; + rend_common_data->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; + rend_common_data->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; + rend_common_data->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; } } } } - hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + rend_common_data->dirac_bs_md_write_idx = ( rend_common_data->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % rend_common_data->dirac_md_buffer_length; return; } @@ -5932,7 +5934,7 @@ static void renderMasaToMc( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->rend_common_data ); if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -5955,7 +5957,7 @@ static void renderMasaToSba( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->rend_common_data ); ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); @@ -5971,7 +5973,7 @@ static void renderMasaToBinaural( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->rend_common_data ); ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index a4e3fd041f..74f395b093 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -754,6 +754,22 @@ ../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_HOA3.tst +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec MONO 48 bit testv/stv3OA48c.wav_sw_48-48_MONO.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv3OA48c.wav_sw_48-48_STEREO.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv3OA48c.wav_sw_48-48_BINAURAL.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec FOA 48 bit testv/stv3OA48c.wav_sw_48-48_FOA.tst + // SBA planar 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out ../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.wav_sw_48-48_7_1_4.tst @@ -928,10 +944,43 @@ ../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit ../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_5_1.tst +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_STEREO.tst + +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_BINAURAL.tst + +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec FOA 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_FOA.tst + // MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out ../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_BINAURAL.tst +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_MONO.tst + +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1 out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec 7_1 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_7_1.tst + +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_MONO.tst + +// MASA 2dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1 out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 7_1 48 bit testv/stv2MASA2TC48c.wav_sw_48-48_7_1.tst + +// MASA 2dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv2MASA2TC48c.wav_sw_48-48_BINAURAL.tst + + // Multi-channel 5_1 at 13.2 kbps, 48kHz in, 48kHz out @@ -1138,6 +1187,10 @@ ../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.wav bit ../IVAS_dec -FEC 5 STEREO 32 bit testv/stv714MC48c.wav_sw_48-32_stereo.tst +// Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.wav_sw_48-48_BINAURAL.tst + // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out (Model from file) ../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit @@ -1192,3 +1245,71 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // NON DIEGETiC PAN at 60 kbps, 48kHz in, 48kHz out, STEREO out ../IVAS_cod 64000 48 testv/stv48c.wav bit ../IVAS_dec -non_diegetic_pan -0.5 48 bit testv/stv48c.pcm_MONO_64000_48-48_STEREO_NON-DIEGETIC-PAN_-0.5.tst + + + + + + +// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 80 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 80000 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_80000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_64000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 32 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 32000 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_32000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 16.4 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 16400 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_16400_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, 7_1_4 out +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_7_1_4.tst + +// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_7_1_4.tst + +// Multi-channel 7_1_4 at 24.4 kbps, 48kHz in, 48kHz out, 7_1_4 out +../IVAS_cod -mc 7_1_4 24400 48 testv/stv714MC48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_24400_48-48_MC_7_1_4.tst + +// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_FOA.tst + +// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_FOA.tst + +// Multi-channel 7_1_4 at 24.4 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -mc 7_1_4 24400 48 testv/stv714MC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv714MC48c.wav_MC714_24400_48-48_MC_FOA.tst + +// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_MONO.tst + +// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_MONO.tst + +// Multi-channel 7_1_4 at 24.4 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -mc 7_1_4 24400 48 testv/stv714MC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_24400_48-48_MC_MONO.tst + + + -- GitLab From fec0f74d8937e347c2aa35faf1daee2ea24b443f Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 7 Jul 2023 07:54:02 +0200 Subject: [PATCH 266/591] fix tc offset for some cases --- lib_com/options.h | 2 +- lib_dec/ivas_jbm_dec.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..88daf4de64 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ - +#define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ff28af051a..dd06e265b8 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -701,8 +701,13 @@ ivas_error ivas_jbm_dec_render( *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; pan_right = 1.f - pan_left; +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + v_multc( p_tc[0], pan_right, output[1], *nSamplesRendered ); + v_multc( p_tc[0], pan_left, output[0], *nSamplesRendered ); +#else v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); +#endif } else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { @@ -729,8 +734,13 @@ ivas_error ivas_jbm_dec_render( { pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; pan_right = 1.f - pan_left; +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + v_multc( p_tc[0], pan_right, output[1], *nSamplesRendered ); + v_multc( p_tc[0], pan_left, output[0], *nSamplesRendered ); +#else v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); +#endif } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { @@ -816,8 +826,11 @@ ivas_error ivas_jbm_dec_render( { return error; } - +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); +#else ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -834,8 +847,11 @@ ivas_error ivas_jbm_dec_render( { return error; } - +#ifdef NONBE_FIX_589_JBM_TC_OFFSETS + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); +#else ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); +#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) -- GitLab From edcd2e30daaeb658605b2da4c568298715d06ee1 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 7 Jul 2023 09:36:17 +0300 Subject: [PATCH 267/591] Formatting and fixes to instrumented build and sanitizer. --- lib_dec/ivas_dirac_dec.c | 81 +++++++++----------- lib_dec/ivas_dirac_output_synthesis_dec.c | 44 +++++------ lib_dec/ivas_init_dec.c | 4 +- lib_dec/ivas_ism_dec.c | 2 +- lib_dec/ivas_ism_param_dec.c | 8 +- lib_dec/ivas_masa_dec.c | 9 ++- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 +- lib_rend/lib_rend.c | 7 +- 8 files changed, 79 insertions(+), 80 deletions(-) mode change 100755 => 100644 lib_dec/ivas_dirac_output_synthesis_dec.c diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ffc47bc30f..bd92a5c148 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -88,7 +88,7 @@ static void rotateAziEle_DirAC( int16_t *azi, int16_t *ele, const int16_t band1, ivas_error ivas_dirac_allocate_parameters( SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ - const int16_t params_flag /* i : set of parameters flag */ + const int16_t params_flag /* i : set of parameters flag */ ) { int16_t i; @@ -277,10 +277,9 @@ static ivas_error ivas_dirac_dec_config_internal( } static ivas_error ivas_dirac_rend_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ - const int16_t dec_param_estim_old -) + const int16_t dec_param_estim_old ) { DIRAC_DEC_HANDLE hDirAC; int16_t nchan_out_woLFE; @@ -1077,7 +1076,7 @@ ivas_error ivas_dirac_dec_config( { ivas_error error; int16_t hodirac_flag; - //int32_t output_Fs; + // int32_t output_Fs; int32_t ivas_total_brate; int16_t sparfoa_flag; DIRAC_CONFIG_FLAG dec_config_flag; @@ -1092,7 +1091,7 @@ ivas_error ivas_dirac_dec_config( /* Solve and setup flags for inits */ dec_config_flag = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; - //output_Fs = st_ivas->hDecoderConfig->output_Fs; + // output_Fs = st_ivas->hDecoderConfig->output_Fs; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE; @@ -1157,7 +1156,7 @@ ivas_error ivas_dirac_dec_config( if ( !sparfoa_flag ) { common_rend_config_flag = st_ivas->rend_common_data == NULL ? DIRAC_OPEN : flag_config_inp; - if ( (error = ivas_spat_rend_common_data_config( st_ivas, common_rend_config_flag ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spat_rend_common_data_config( st_ivas, common_rend_config_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -1191,7 +1190,7 @@ ivas_error ivas_dirac_dec_config( else { /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */ - if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !(st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 )) + if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) { ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); } @@ -1267,8 +1266,7 @@ ivas_error ivas_dirac_dec_config( *------------------------------------------------------------------------*/ void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE *hDirAC_out -) + DIRAC_DEC_HANDLE *hDirAC_out ) { DIRAC_DEC_HANDLE hDirAC; @@ -1293,8 +1291,7 @@ void ivas_dirac_dec_close( } void ivas_spat_rend_common_data_close( - SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out -) + SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out ) { if ( rend_common_data_out == NULL || *rend_common_data_out == NULL ) { @@ -1308,12 +1305,10 @@ void ivas_spat_rend_common_data_close( *rend_common_data_out = NULL; return; - } void ivas_dirac_rend_close( - DIRAC_REND_HANDLE *hDirACRend_out -) + DIRAC_REND_HANDLE *hDirACRend_out ) { int16_t i, j; DIRAC_REND_HANDLE hDirACRend; @@ -1409,7 +1404,6 @@ void ivas_dirac_rend_close( } - /*------------------------------------------------------------------------- * ivas_dirac_deallocate_parameters() * @@ -1417,18 +1411,19 @@ void ivas_dirac_rend_close( *-------------------------------------------------------------------------*/ void ivas_dirac_deallocate_parameters( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ - const int16_t params_flag /* i : set of parameters flag */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ ) { int16_t i; + int16_t md_buffer_length; if ( rend_common_data == NULL ) { return; } - int16_t md_buffer_length = rend_common_data->dirac_md_buffer_length; + md_buffer_length = rend_common_data->dirac_md_buffer_length; if ( params_flag == 1 ) { @@ -1863,14 +1858,14 @@ static void ivas_dirac_free_mem( *------------------------------------------------------------------------*/ void ivas_dirac_dec_read_BS( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - Decoder_State *st, /* i/o: decoder state structure */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t i, j, b, dir, orig_dirac_bands; @@ -2006,14 +2001,14 @@ void ivas_dirac_dec_read_BS( *-----------------------------------------------------------------------*/ void ivas_qmetadata_to_dirac( - const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ - MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ + MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t block, band; @@ -2502,16 +2497,14 @@ void ivas_dirac_dec_render( { int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, n_samples_sf, ch, nchan_intern; - DIRAC_DEC_HANDLE hDirAC; SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float *output_f_local[MAX_OUTPUT_CHANNELS]; - hDirAC = st_ivas->hDirAC; rend_common_data = st_ivas->rend_common_data; nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; #ifdef DEBUGGING - assert( hDirAC ); + assert( rend_common_data ); #endif for ( ch = 0; ch < nchan_intern; ch++ ) { @@ -3225,11 +3218,11 @@ void ivas_dirac_dec_render_sf( outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || - ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || + ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) { outchannels++; } @@ -4083,7 +4076,7 @@ static void protoSignalComputation4( static void ivas_dirac_dec_compute_diffuse_proto( DIRAC_REND_HANDLE hDirACRend, const int16_t num_freq_bands, - const int16_t slot_idx /* i : slot index */ + const int16_t slot_idx /* i : slot index */ ) { int16_t k, l; diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c old mode 100755 new mode 100644 index c10fda92dd..5e80d9176f --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -87,12 +87,12 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha *------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_output_synthesis_open( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - RENDERER_TYPE renderer_type, /* i : renderer type */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t idx, ch_idx; @@ -355,10 +355,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_init( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t size; @@ -539,9 +539,9 @@ void ivas_dirac_dec_output_synthesis_process_slot( const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t sh_rot_max_order, const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ @@ -776,8 +776,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, @@ -1224,8 +1224,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nbslots, /* i : number of slots to process */ float *diffuseness_vector, float *reference_power_smooth, @@ -1309,7 +1309,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( if ( hDirACRend->masa_stereo_type_detect != NULL ) { - MASA_STEREO_TYPE_DETECT* masa_stereo_type_detect = hDirACRend->masa_stereo_type_detect; + MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect = hDirACRend->masa_stereo_type_detect; p_cy_auto_dir_smooth = h_dirac_output_synthesis_state->cy_auto_dir_smooth; p_cy_auto_diff_smooth = h_dirac_output_synthesis_state->cy_auto_diff_smooth; @@ -1743,10 +1743,10 @@ static void ivas_dirac_dec_get_response_split_order( *------------------------------------------------------------------------*/ void ivas_dirac_dec_compute_directional_responses( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int16_t *azimuth, const int16_t *elevation, const int16_t md_idx, diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b980f9e7d1..6743e4beff 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1283,7 +1283,7 @@ ivas_error ivas_init_decoder( } } /* ParamISM is handled separately from other common config */ - else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && (st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )) + else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( 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_STEREO_PARAMETRIC ) { @@ -1810,7 +1810,7 @@ void ivas_destroy_dec( /* DirAC handle */ if ( st_ivas->ivas_format == ISM_FORMAT ) { - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &(st_ivas->rend_common_data), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->rend_common_data ), st_ivas->hDecoderConfig->output_config ); } else { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index dc436c3c7a..89699e3374 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -169,7 +169,7 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { /* Deallocate the ParamISM struct */ - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &(st_ivas->rend_common_data), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->rend_common_data ), st_ivas->hDecoderConfig->output_config ); #ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 7fd5aa5150..cf6e70d5d8 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -643,9 +643,9 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out, /* i/o: common spatial renderer data */ - AUDIO_CONFIG output_config /* i : output audio configuration */ + DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out, /* i/o: common spatial renderer data */ + AUDIO_CONFIG output_config /* i : output audio configuration */ ) { if ( hDirAC_out != NULL && *hDirAC_out != NULL ) @@ -1113,7 +1113,7 @@ void ivas_param_ism_dec_digest_tc( hDirAC = st_ivas->hDirAC; assert( hDirAC ); rend_common_data = st_ivas->rend_common_data; - assert(rend_common_data); + assert( rend_common_data ); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 1a84415122..74a23711d9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -974,7 +974,7 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); - if ( (st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL) || ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin == NULL) ) + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) { /* init a new DirAC dec */ if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) @@ -1011,7 +1011,7 @@ ivas_error ivas_masa_dec_reconfigure( sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hSCE[sce_id]->element_brate / FRAMES_PER_SEC ); - if ( (st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin != NULL) + if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1038,7 +1038,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = 1; - if ( (st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL) || ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin != NULL) ) + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1050,7 +1050,8 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = CPE_CHANNELS; - if ( (st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL) || ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM) && st_ivas->hDiracDecBin != NULL) ) { + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) + { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != 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 0ec9f113b0..329348f390 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -298,7 +298,7 @@ void ivas_dirac_dec_close_binaural_data( } ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); - if ( (*hBinaural)->h_freq_domain_decorr_ap_params != NULL ) + if ( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) { ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); } @@ -760,7 +760,7 @@ static void ivas_dirac_dec_decorrelate_slot( float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ float protoFrameF[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ - const int16_t protoIndexDir[BINAURAL_CHANNELS] = {0, 1}; + const int16_t protoIndexDir[BINAURAL_CHANNELS] = { 0, 1 }; /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7f2c39d68b..fd0a935fee 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2594,6 +2594,8 @@ static DecoderDummy *initDecoderDummy( decDummy->hVBAPdata = NULL; // note: not used at the moment decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; + decDummy->hDirACRend = NULL; + decDummy->rend_common_data = NULL; decDummy->hQMetaData = NULL; decDummy->hHrtfParambin = NULL; decDummy->hHeadTrackData = NULL; @@ -2770,7 +2772,7 @@ static void freeDecoderDummy( } /* DirAC handle */ - ivas_dirac_rend_close( &( pDecDummy->hDirACRend ) ); + ivas_dirac_rend_close( &( pDecDummy->hDirACRend ) ); ivas_spat_rend_common_data_close( &( pDecDummy->rend_common_data ) ); ivas_dirac_dec_close( &( pDecDummy->hDirAC ) ); @@ -2787,6 +2789,9 @@ static void freeDecoderDummy( pDecDummy->hoa_dec_mtx = NULL; } + /* Parametric binaural renderer HRTF structure */ + free( pDecDummy->hHrtfParambin ); + /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); -- GitLab From 9c543b0193ad225f14d40a3b0181c979ad5657b1 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 7 Jul 2023 10:13:42 +0300 Subject: [PATCH 268/591] Fix ISM rate switching in JBM. Apply same fix to SBA and MC pre-emptively. --- lib_dec/ivas_ism_dec.c | 27 ++++++++++++--------------- lib_dec/ivas_mct_dec.c | 26 ++++++++++++-------------- lib_dec/ivas_sba_dec.c | 26 ++++++++++++-------------- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 89699e3374..c684e470fc 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -65,14 +65,11 @@ static ivas_error ivas_ism_bitrate_switching( AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; error = IVAS_ERR_OK; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; - rend_common_data = st_ivas->rend_common_data; - /* we have to temporarily set the ism mode back to the old one, otherwise this can give wrong results*/ ism_mode = st_ivas->ism_mode; st_ivas->ism_mode = last_ism_mode; @@ -125,13 +122,13 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_ism_mode == ISM_MODE_PARAM && rend_common_data != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) + if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->rend_common_data != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) { - st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered; - st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots; - st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered; - mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered; + mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv @@ -342,14 +339,14 @@ static ivas_error ivas_ism_bitrate_switching( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( rend_common_data != NULL ) + if ( st_ivas->rend_common_data != NULL ) { - rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; - rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index d979117373..1ff66e098b 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -684,13 +684,11 @@ static ivas_error ivas_mc_dec_reconfig( int16_t tc_granularity_new; AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; error = IVAS_ERR_OK; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; nchan_transport_old = st_ivas->nchan_transport; - rend_common_data = st_ivas->rend_common_data; last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ @@ -739,13 +737,13 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( last_mc_mode == MC_MODE_MCMASA && rend_common_data != NULL ) + else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->rend_common_data != NULL ) { - st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered; - st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots; - st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered; - mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered; + mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv @@ -1263,13 +1261,13 @@ static ivas_error ivas_mc_dec_reconfig( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( rend_common_data != NULL ) + if ( st_ivas->rend_common_data != NULL ) { - rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; - rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } else if ( st_ivas->hParamMC != NULL ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 7594c802be..cb4033850b 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -112,14 +112,12 @@ ivas_error ivas_sba_dec_reconfigure( int32_t last_ivas_total_brate; DECODER_CONFIG_HANDLE hDecoderConfig; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; ivas_error error; error = IVAS_ERR_OK; hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; - rend_common_data = st_ivas->rend_common_data; /*-----------------------------------------------------------------* * Set SBA high-level parameters @@ -144,13 +142,13 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( rend_common_data != NULL ) + else if ( st_ivas->rend_common_data != NULL ) { - st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots; - st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes; - st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered; - st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered; - mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered; + mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /*-----------------------------------------------------------------* @@ -257,13 +255,13 @@ ivas_error ivas_sba_dec_reconfigure( } /* synchronize subframe info */ - if ( rend_common_data != NULL ) + if ( st_ivas->rend_common_data != NULL ) { - rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; - rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } -- GitLab From cd17d5b1acc789d80c175030830e215297245776 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 7 Jul 2023 12:05:16 +0200 Subject: [PATCH 269/591] [fix] move LC3plus MSVC solution to Workspace_msvc --- .../msvc => Workspace_msvc}/LC3plus.vcxproj | 156 +++++++++--------- Workspace_msvc/Workspace_msvc.sln | 2 +- Workspace_msvc/lib_com.vcxproj | 4 +- Workspace_msvc/lib_rend.vcxproj | 2 +- lc3plus/msvc/.gitignore | 1 - lc3plus/msvc/LC3plus.sln | 28 ---- 6 files changed, 82 insertions(+), 111 deletions(-) rename {lc3plus/msvc => Workspace_msvc}/LC3plus.vcxproj (52%) mode change 100755 => 100644 delete mode 100644 lc3plus/msvc/.gitignore delete mode 100755 lc3plus/msvc/LC3plus.sln diff --git a/lc3plus/msvc/LC3plus.vcxproj b/Workspace_msvc/LC3plus.vcxproj old mode 100755 new mode 100644 similarity index 52% rename from lc3plus/msvc/LC3plus.vcxproj rename to Workspace_msvc/LC3plus.vcxproj index ffbfdf344b..a70c61e5a8 --- a/lc3plus/msvc/LC3plus.vcxproj +++ b/Workspace_msvc/LC3plus.vcxproj @@ -67,7 +67,7 @@ Level3 - ..\..\lib_com;%(AdditionalIncludeDirectories) + ..\lib_com;%(AdditionalIncludeDirectories) Disabled MultiThreadedDebug WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) @@ -83,7 +83,7 @@ Level3 - ..\..\lib_com;%(AdditionalIncludeDirectories) + ..\lib_com;%(AdditionalIncludeDirectories) MaxSpeed MultiThreaded true @@ -99,84 +99,84 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln index d2a00f6c00..1d8e08ac9f 100644 --- a/Workspace_msvc/Workspace_msvc.sln +++ b/Workspace_msvc/Workspace_msvc.sln @@ -20,7 +20,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "..\lc3plus\msvc\LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3plus", "LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51160D4C-55C9-4C16-A792-D94507225746}" ProjectSection(SolutionItems) = preProject diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 6667182575..62f0c3b209 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -109,7 +109,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;../lc3plus;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) @@ -147,7 +147,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;../lc3plus;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 54c34de274..6e3943249f 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -272,7 +272,7 @@ {54509728-928b-44d9-a118-a6f92f08b34f} false - + {95030B82-70CD-4C6B-84D4-61096035BEA2} false diff --git a/lc3plus/msvc/.gitignore b/lc3plus/msvc/.gitignore deleted file mode 100644 index f40a919a54..0000000000 --- a/lc3plus/msvc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Win32/ \ No newline at end of file diff --git a/lc3plus/msvc/LC3plus.sln b/lc3plus/msvc/LC3plus.sln deleted file mode 100755 index a8ee38ea81..0000000000 --- a/lc3plus/msvc/LC3plus.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.168 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3_FL", "LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.Build.0 = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.Build.0 = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|x64 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.Build.0 = Release|x64 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.ActiveCfg = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal -- GitLab From 9d25f05fc2cd2d79fb9cbeee266fd9cc217ad4ad Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 7 Jul 2023 12:07:55 +0200 Subject: [PATCH 270/591] [cleanup] remove unnecessary makefile --- lc3plus/makefile | 143 ----------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100755 lc3plus/makefile diff --git a/lc3plus/makefile b/lc3plus/makefile deleted file mode 100755 index 16758fc306..0000000000 --- a/lc3plus/makefile +++ /dev/null @@ -1,143 +0,0 @@ -# GNU Makefile - -# Options -AFL = 0 -CLANG = 0 -GCOV = 0 -NO_POST_REL_CHANGES_TEST = 0 -OPTIM = 0 - -# Paths -VPATH = . -BUILD = build -CC = gcc -LINK = $(CC) - -# Binary Name -NAME_LC3 = LC3plus -# Shared Library Name -LIB_LC3 = libLC3plus.so - -# Default tool settings -CC = gcc -RM = rm -f - -# Preprocessor(-I/-D) / Compiler / Linker flags -CFLAGS += -std=c99 -fPIC \ - -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ - -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Werror-implicit-function-declaration - -LDFLAGS += -lm -g -# Include dependency flags -DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD)/$*.Td - -ifneq "$(DEBUG)" "0" - CFLAGS += -g3 - LDFLAGS += -g3 -endif - -ifeq "$(GCOV)" "1" - CFLAGS += -fprofile-arcs -ftest-coverage - LDFLAGS += -fprofile-arcs -ftest-coverage -endif - -OPTIM ?= 0 -CFLAGS += -O$(OPTIM) -CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) - -ifeq "$(NO_POST_REL_CHANGES_TEST)" "1" -CFLAGS += -DNO_POST_REL_CHANGES -endif - -# memory sanitizer, find use of uninitialized memory -ifeq "$(CLANG)" "1" - CC = clang - CFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer - LDFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer - OPTIM = 2 -endif - -# address sanitizer, find buffer overflows -ifeq "$(CLANG)" "2" - CC = clang - CFLAGS += -fsanitize=address -fno-omit-frame-pointer - LDFLAGS += -fsanitize=address -fno-omit-frame-pointer - OPTIM = 2 -endif - -# undefined behavior sanitizer, find bugs like integer overflows -ifeq "$(CLANG)" "3" - CC = clang - CFLAGS += -fsanitize=undefined - LDFLAGS += -fsanitize=undefined - OPTIM = 2 -endif - -# for code coverate test -ifeq "$(GCOV)" "1" - CFLAGS += -fprofile-arcs -ftest-coverage - LDFLAGS += -fprofile-arcs -ftest-coverage -endif - -# verbose output -ifneq "$(VERBOSE)" "1" - QUIET = @ -endif - -# dependency magic -CC_FLAGS = '$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)' -POSTCOMPILE = mv -f $(BUILD)/$*.Td $(BUILD)/$*.d && touch $@ - -######## Generate source / object lists ######## - -SRCS := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) -SRCS_LIB := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) -OBJS := $(addprefix $(BUILD)/, $(SRCS:.c=.o)) - -LIBSRCS := $(filter-out $(DIR)/ccConvert.c $(DIR)/codec_exe.c, $(SRCS)) -LIBOBJS := $(addprefix $(BUILD)/, $(LIBSRCS:.c=.o)) - -.PHONY: all clean help force - -.PRECIOUS: $(BUILD)/%.d - -all: $(NAME_LC3) - -help: - @echo 'Targets:' - @echo ' $(NAME_LC3) (default)' - @echo ' $(LIB_LC3)' - @echo 'Syntax: make [OPTION=VALUE ...]' - @echo 'Build options:' - @echo ' NO_POST_REL_CHANGES_TEST $(NO_POST_REL_CHANGES_TEST) [0,1]' - @echo ' OPTIM $(OPTIM) [0-3]' - @echo 'Debug options:' - @echo ' AFL $(AFL) [0,1]' - @echo ' CLANG $(CLANG) [0-3]' - @echo ' GCOV $(GCOV) [0,1]' - -$(NAME_LC3): $(OBJS) - @echo 'Linking' $@ - $(QUIET) $(LINK) $(OBJS) -o $@ $(LDFLAGS) - -$(LIB_LC3): $(LIBOBJS) - @echo 'Linking' $@ - $(QUIET) $(LINK) --shared $(OBJS) -o $@ $(LDFLAGS) - -clean: - $(QUIET) rm -rf $(NAME_LC3) $(LIB_LC3) $(BUILD) ccConvert - -$(BUILD)/%.o : %.c $(BUILD)/cc_flags - @echo 'Compiling' $< - $(QUIET) $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - $(QUIET) $(POSTCOMPILE) - -# force rebuild if compilation flags changed -$(BUILD)/cc_flags: force - $(QUIET) mkdir -p $(BUILD) - $(QUIET) echo $(CC_FLAGS) | cmp -s - $@ || echo $(CC_FLAGS) > $@ - -# force rebuild if include dependency changed -$(BUILD)/%.d: ; -include $(wildcard $(patsubst %, $(BUILD)/%.d, $(basename $(SRCS)))) -- GitLab From 21c4a6e754765786c53f41b34e3317122bff8cd8 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 7 Jul 2023 12:13:51 +0200 Subject: [PATCH 271/591] [cleanup] unset executable bit on LC3plus source files --- lc3plus/adjust_global_gain.c | 0 lc3plus/al_fec_fl.c | 0 lc3plus/apply_global_gain.c | 0 lc3plus/ari_codec.c | 0 lc3plus/attack_detector.c | 0 lc3plus/clib.h | 0 lc3plus/constants.c | 0 lc3plus/constants.h | 0 lc3plus/cutoff_bandwidth.c | 0 lc3plus/dct4.c | 0 lc3plus/dec_entropy.c | 0 lc3plus/dec_lc3_fl.c | 0 lc3plus/defines.h | 0 lc3plus/detect_cutoff_warped.c | 0 lc3plus/enc_entropy.c | 0 lc3plus/enc_lc3_fl.c | 0 lc3plus/estimate_global_gain.c | 0 lc3plus/fft/cfft.c | 0 lc3plus/fft/cfft.h | 0 lc3plus/fft/fft_15_16.h | 0 lc3plus/fft/fft_240_480.h | 0 lc3plus/fft/fft_2_9.h | 0 lc3plus/fft/fft_32.h | 0 lc3plus/fft/fft_384_768.h | 0 lc3plus/fft/fft_60_128.h | 0 lc3plus/fft/fft_generic.h | 0 lc3plus/fft/iis_fft.c | 0 lc3plus/fft/iis_fft.h | 0 lc3plus/fft/iisfft.c | 0 lc3plus/fft/iisfft.h | 0 lc3plus/functions.h | 0 lc3plus/imdct.c | 0 lc3plus/lc3.c | 0 lc3plus/lc3.h | 0 lc3plus/license.h | 0 lc3plus/ltpf_coder.c | 0 lc3plus/ltpf_decoder.c | 0 lc3plus/mdct.c | 0 lc3plus/mdct_shaping.c | 0 lc3plus/near_nyquist_detector.c | 0 lc3plus/noise_factor.c | 0 lc3plus/noise_filling.c | 0 lc3plus/olpa.c | 0 lc3plus/pc_apply.c | 0 lc3plus/pc_classify.c | 0 lc3plus/pc_main.c | 0 lc3plus/pc_update.c | 0 lc3plus/per_band_energy.c | 0 lc3plus/plc_classify.c | 0 lc3plus/plc_compute_stab_fac.c | 0 lc3plus/plc_damping_scrambling.c | 0 lc3plus/plc_main.c | 0 lc3plus/plc_noise_substitution.c | 0 lc3plus/plc_noise_substitution0.c | 0 lc3plus/plc_phecu_f0_refine_first.c | 0 lc3plus/plc_phecu_fec_hq.c | 0 lc3plus/plc_phecu_hq_ecu.c | 0 lc3plus/plc_phecu_lf_peak_analysis.c | 0 lc3plus/plc_phecu_rec_frame.c | 0 lc3plus/plc_phecu_setf0hz.c | 0 lc3plus/plc_phecu_spec_ana.c | 0 lc3plus/plc_phecu_subst_spec.c | 0 lc3plus/plc_phecu_tba_per_band_gain.c | 0 lc3plus/plc_phecu_tba_spect_Xavg.c | 0 lc3plus/plc_phecu_tba_trans_dect_gains.c | 0 lc3plus/plc_phecu_trans_burst_ana_sub.c | 0 lc3plus/plc_tdc.c | 0 lc3plus/plc_tdc_tdac.c | 0 lc3plus/plc_update.c | 0 lc3plus/quantize_spec.c | 0 lc3plus/reorder_bitstream.c | 0 lc3plus/resamp12k8.c | 0 lc3plus/residual_coding.c | 0 lc3plus/residual_decoding.c | 0 lc3plus/setup_com_lc3.c | 0 lc3plus/setup_dec_lc3.c | 0 lc3plus/setup_dec_lc3.h | 0 lc3plus/setup_enc_lc3.c | 0 lc3plus/setup_enc_lc3.h | 0 lc3plus/sns_compute_scf.c | 0 lc3plus/sns_interpolate_scf.c | 0 lc3plus/sns_quantize_scf.c | 0 lc3plus/structs.h | 0 lc3plus/tinywavein_c.h | 0 lc3plus/tinywaveout_c.h | 0 lc3plus/tns_coder.c | 0 lc3plus/tns_decoder.c | 0 lc3plus/util.h | 0 88 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lc3plus/adjust_global_gain.c mode change 100755 => 100644 lc3plus/al_fec_fl.c mode change 100755 => 100644 lc3plus/apply_global_gain.c mode change 100755 => 100644 lc3plus/ari_codec.c mode change 100755 => 100644 lc3plus/attack_detector.c mode change 100755 => 100644 lc3plus/clib.h mode change 100755 => 100644 lc3plus/constants.c mode change 100755 => 100644 lc3plus/constants.h mode change 100755 => 100644 lc3plus/cutoff_bandwidth.c mode change 100755 => 100644 lc3plus/dct4.c mode change 100755 => 100644 lc3plus/dec_entropy.c mode change 100755 => 100644 lc3plus/dec_lc3_fl.c mode change 100755 => 100644 lc3plus/defines.h mode change 100755 => 100644 lc3plus/detect_cutoff_warped.c mode change 100755 => 100644 lc3plus/enc_entropy.c mode change 100755 => 100644 lc3plus/enc_lc3_fl.c mode change 100755 => 100644 lc3plus/estimate_global_gain.c mode change 100755 => 100644 lc3plus/fft/cfft.c mode change 100755 => 100644 lc3plus/fft/cfft.h mode change 100755 => 100644 lc3plus/fft/fft_15_16.h mode change 100755 => 100644 lc3plus/fft/fft_240_480.h mode change 100755 => 100644 lc3plus/fft/fft_2_9.h mode change 100755 => 100644 lc3plus/fft/fft_32.h mode change 100755 => 100644 lc3plus/fft/fft_384_768.h mode change 100755 => 100644 lc3plus/fft/fft_60_128.h mode change 100755 => 100644 lc3plus/fft/fft_generic.h mode change 100755 => 100644 lc3plus/fft/iis_fft.c mode change 100755 => 100644 lc3plus/fft/iis_fft.h mode change 100755 => 100644 lc3plus/fft/iisfft.c mode change 100755 => 100644 lc3plus/fft/iisfft.h mode change 100755 => 100644 lc3plus/functions.h mode change 100755 => 100644 lc3plus/imdct.c mode change 100755 => 100644 lc3plus/lc3.c mode change 100755 => 100644 lc3plus/lc3.h mode change 100755 => 100644 lc3plus/license.h mode change 100755 => 100644 lc3plus/ltpf_coder.c mode change 100755 => 100644 lc3plus/ltpf_decoder.c mode change 100755 => 100644 lc3plus/mdct.c mode change 100755 => 100644 lc3plus/mdct_shaping.c mode change 100755 => 100644 lc3plus/near_nyquist_detector.c mode change 100755 => 100644 lc3plus/noise_factor.c mode change 100755 => 100644 lc3plus/noise_filling.c mode change 100755 => 100644 lc3plus/olpa.c mode change 100755 => 100644 lc3plus/pc_apply.c mode change 100755 => 100644 lc3plus/pc_classify.c mode change 100755 => 100644 lc3plus/pc_main.c mode change 100755 => 100644 lc3plus/pc_update.c mode change 100755 => 100644 lc3plus/per_band_energy.c mode change 100755 => 100644 lc3plus/plc_classify.c mode change 100755 => 100644 lc3plus/plc_compute_stab_fac.c mode change 100755 => 100644 lc3plus/plc_damping_scrambling.c mode change 100755 => 100644 lc3plus/plc_main.c mode change 100755 => 100644 lc3plus/plc_noise_substitution.c mode change 100755 => 100644 lc3plus/plc_noise_substitution0.c mode change 100755 => 100644 lc3plus/plc_phecu_f0_refine_first.c mode change 100755 => 100644 lc3plus/plc_phecu_fec_hq.c mode change 100755 => 100644 lc3plus/plc_phecu_hq_ecu.c mode change 100755 => 100644 lc3plus/plc_phecu_lf_peak_analysis.c mode change 100755 => 100644 lc3plus/plc_phecu_rec_frame.c mode change 100755 => 100644 lc3plus/plc_phecu_setf0hz.c mode change 100755 => 100644 lc3plus/plc_phecu_spec_ana.c mode change 100755 => 100644 lc3plus/plc_phecu_subst_spec.c mode change 100755 => 100644 lc3plus/plc_phecu_tba_per_band_gain.c mode change 100755 => 100644 lc3plus/plc_phecu_tba_spect_Xavg.c mode change 100755 => 100644 lc3plus/plc_phecu_tba_trans_dect_gains.c mode change 100755 => 100644 lc3plus/plc_phecu_trans_burst_ana_sub.c mode change 100755 => 100644 lc3plus/plc_tdc.c mode change 100755 => 100644 lc3plus/plc_tdc_tdac.c mode change 100755 => 100644 lc3plus/plc_update.c mode change 100755 => 100644 lc3plus/quantize_spec.c mode change 100755 => 100644 lc3plus/reorder_bitstream.c mode change 100755 => 100644 lc3plus/resamp12k8.c mode change 100755 => 100644 lc3plus/residual_coding.c mode change 100755 => 100644 lc3plus/residual_decoding.c mode change 100755 => 100644 lc3plus/setup_com_lc3.c mode change 100755 => 100644 lc3plus/setup_dec_lc3.c mode change 100755 => 100644 lc3plus/setup_dec_lc3.h mode change 100755 => 100644 lc3plus/setup_enc_lc3.c mode change 100755 => 100644 lc3plus/setup_enc_lc3.h mode change 100755 => 100644 lc3plus/sns_compute_scf.c mode change 100755 => 100644 lc3plus/sns_interpolate_scf.c mode change 100755 => 100644 lc3plus/sns_quantize_scf.c mode change 100755 => 100644 lc3plus/structs.h mode change 100755 => 100644 lc3plus/tinywavein_c.h mode change 100755 => 100644 lc3plus/tinywaveout_c.h mode change 100755 => 100644 lc3plus/tns_coder.c mode change 100755 => 100644 lc3plus/tns_decoder.c mode change 100755 => 100644 lc3plus/util.h diff --git a/lc3plus/adjust_global_gain.c b/lc3plus/adjust_global_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/al_fec_fl.c b/lc3plus/al_fec_fl.c old mode 100755 new mode 100644 diff --git a/lc3plus/apply_global_gain.c b/lc3plus/apply_global_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/ari_codec.c b/lc3plus/ari_codec.c old mode 100755 new mode 100644 diff --git a/lc3plus/attack_detector.c b/lc3plus/attack_detector.c old mode 100755 new mode 100644 diff --git a/lc3plus/clib.h b/lc3plus/clib.h old mode 100755 new mode 100644 diff --git a/lc3plus/constants.c b/lc3plus/constants.c old mode 100755 new mode 100644 diff --git a/lc3plus/constants.h b/lc3plus/constants.h old mode 100755 new mode 100644 diff --git a/lc3plus/cutoff_bandwidth.c b/lc3plus/cutoff_bandwidth.c old mode 100755 new mode 100644 diff --git a/lc3plus/dct4.c b/lc3plus/dct4.c old mode 100755 new mode 100644 diff --git a/lc3plus/dec_entropy.c b/lc3plus/dec_entropy.c old mode 100755 new mode 100644 diff --git a/lc3plus/dec_lc3_fl.c b/lc3plus/dec_lc3_fl.c old mode 100755 new mode 100644 diff --git a/lc3plus/defines.h b/lc3plus/defines.h old mode 100755 new mode 100644 diff --git a/lc3plus/detect_cutoff_warped.c b/lc3plus/detect_cutoff_warped.c old mode 100755 new mode 100644 diff --git a/lc3plus/enc_entropy.c b/lc3plus/enc_entropy.c old mode 100755 new mode 100644 diff --git a/lc3plus/enc_lc3_fl.c b/lc3plus/enc_lc3_fl.c old mode 100755 new mode 100644 diff --git a/lc3plus/estimate_global_gain.c b/lc3plus/estimate_global_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/cfft.c b/lc3plus/fft/cfft.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/cfft.h b/lc3plus/fft/cfft.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_15_16.h b/lc3plus/fft/fft_15_16.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_240_480.h b/lc3plus/fft/fft_240_480.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_2_9.h b/lc3plus/fft/fft_2_9.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_32.h b/lc3plus/fft/fft_32.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_384_768.h b/lc3plus/fft/fft_384_768.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_60_128.h b/lc3plus/fft/fft_60_128.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_generic.h b/lc3plus/fft/fft_generic.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iis_fft.c b/lc3plus/fft/iis_fft.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iis_fft.h b/lc3plus/fft/iis_fft.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iisfft.c b/lc3plus/fft/iisfft.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iisfft.h b/lc3plus/fft/iisfft.h old mode 100755 new mode 100644 diff --git a/lc3plus/functions.h b/lc3plus/functions.h old mode 100755 new mode 100644 diff --git a/lc3plus/imdct.c b/lc3plus/imdct.c old mode 100755 new mode 100644 diff --git a/lc3plus/lc3.c b/lc3plus/lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/lc3.h b/lc3plus/lc3.h old mode 100755 new mode 100644 diff --git a/lc3plus/license.h b/lc3plus/license.h old mode 100755 new mode 100644 diff --git a/lc3plus/ltpf_coder.c b/lc3plus/ltpf_coder.c old mode 100755 new mode 100644 diff --git a/lc3plus/ltpf_decoder.c b/lc3plus/ltpf_decoder.c old mode 100755 new mode 100644 diff --git a/lc3plus/mdct.c b/lc3plus/mdct.c old mode 100755 new mode 100644 diff --git a/lc3plus/mdct_shaping.c b/lc3plus/mdct_shaping.c old mode 100755 new mode 100644 diff --git a/lc3plus/near_nyquist_detector.c b/lc3plus/near_nyquist_detector.c old mode 100755 new mode 100644 diff --git a/lc3plus/noise_factor.c b/lc3plus/noise_factor.c old mode 100755 new mode 100644 diff --git a/lc3plus/noise_filling.c b/lc3plus/noise_filling.c old mode 100755 new mode 100644 diff --git a/lc3plus/olpa.c b/lc3plus/olpa.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_apply.c b/lc3plus/pc_apply.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_classify.c b/lc3plus/pc_classify.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_main.c b/lc3plus/pc_main.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_update.c b/lc3plus/pc_update.c old mode 100755 new mode 100644 diff --git a/lc3plus/per_band_energy.c b/lc3plus/per_band_energy.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_classify.c b/lc3plus/plc_classify.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_compute_stab_fac.c b/lc3plus/plc_compute_stab_fac.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_damping_scrambling.c b/lc3plus/plc_damping_scrambling.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_main.c b/lc3plus/plc_main.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_noise_substitution.c b/lc3plus/plc_noise_substitution.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_noise_substitution0.c b/lc3plus/plc_noise_substitution0.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_f0_refine_first.c b/lc3plus/plc_phecu_f0_refine_first.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_fec_hq.c b/lc3plus/plc_phecu_fec_hq.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_hq_ecu.c b/lc3plus/plc_phecu_hq_ecu.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_lf_peak_analysis.c b/lc3plus/plc_phecu_lf_peak_analysis.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_rec_frame.c b/lc3plus/plc_phecu_rec_frame.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_setf0hz.c b/lc3plus/plc_phecu_setf0hz.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_spec_ana.c b/lc3plus/plc_phecu_spec_ana.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_subst_spec.c b/lc3plus/plc_phecu_subst_spec.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_tba_per_band_gain.c b/lc3plus/plc_phecu_tba_per_band_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_tba_spect_Xavg.c b/lc3plus/plc_phecu_tba_spect_Xavg.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_tba_trans_dect_gains.c b/lc3plus/plc_phecu_tba_trans_dect_gains.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_trans_burst_ana_sub.c b/lc3plus/plc_phecu_trans_burst_ana_sub.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_tdc.c b/lc3plus/plc_tdc.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_tdc_tdac.c b/lc3plus/plc_tdc_tdac.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_update.c b/lc3plus/plc_update.c old mode 100755 new mode 100644 diff --git a/lc3plus/quantize_spec.c b/lc3plus/quantize_spec.c old mode 100755 new mode 100644 diff --git a/lc3plus/reorder_bitstream.c b/lc3plus/reorder_bitstream.c old mode 100755 new mode 100644 diff --git a/lc3plus/resamp12k8.c b/lc3plus/resamp12k8.c old mode 100755 new mode 100644 diff --git a/lc3plus/residual_coding.c b/lc3plus/residual_coding.c old mode 100755 new mode 100644 diff --git a/lc3plus/residual_decoding.c b/lc3plus/residual_decoding.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_com_lc3.c b/lc3plus/setup_com_lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_dec_lc3.c b/lc3plus/setup_dec_lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_dec_lc3.h b/lc3plus/setup_dec_lc3.h old mode 100755 new mode 100644 diff --git a/lc3plus/setup_enc_lc3.c b/lc3plus/setup_enc_lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_enc_lc3.h b/lc3plus/setup_enc_lc3.h old mode 100755 new mode 100644 diff --git a/lc3plus/sns_compute_scf.c b/lc3plus/sns_compute_scf.c old mode 100755 new mode 100644 diff --git a/lc3plus/sns_interpolate_scf.c b/lc3plus/sns_interpolate_scf.c old mode 100755 new mode 100644 diff --git a/lc3plus/sns_quantize_scf.c b/lc3plus/sns_quantize_scf.c old mode 100755 new mode 100644 diff --git a/lc3plus/structs.h b/lc3plus/structs.h old mode 100755 new mode 100644 diff --git a/lc3plus/tinywavein_c.h b/lc3plus/tinywavein_c.h old mode 100755 new mode 100644 diff --git a/lc3plus/tinywaveout_c.h b/lc3plus/tinywaveout_c.h old mode 100755 new mode 100644 diff --git a/lc3plus/tns_coder.c b/lc3plus/tns_coder.c old mode 100755 new mode 100644 diff --git a/lc3plus/tns_decoder.c b/lc3plus/tns_decoder.c old mode 100755 new mode 100644 diff --git a/lc3plus/util.h b/lc3plus/util.h old mode 100755 new mode 100644 -- GitLab From 07a3c48d8fbccd18ebe3bb4a32a9d64749124394 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 7 Jul 2023 12:31:31 +0200 Subject: [PATCH 272/591] [cleanup] modify CI script and try to fix job --- scripts/lc3plus_lib_setup/get_lc3plus.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index 51ead5aab2..d44e304565 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -12,7 +12,9 @@ unzip lc3plus_sources.zip -d . # Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) git apply --ignore-whitespace lc3plus.patch -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/makefile +rm -r ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc +find ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point -type f -exec chmod -x {} \; # Move to output dir rm -rf ../../lc3plus -- GitLab From 67ba9bb3adf510d81c47c69c422a34f64b55e0a5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 7 Jul 2023 12:41:42 +0200 Subject: [PATCH 273/591] [cleanup] remove duplicate files and modify CI script --- lc3plus/tinywavein_c.h | 605 --------------- lc3plus/tinywaveout_c.h | 892 ----------------------- scripts/lc3plus_lib_setup/get_lc3plus.sh | 6 +- 3 files changed, 5 insertions(+), 1498 deletions(-) delete mode 100644 lc3plus/tinywavein_c.h delete mode 100644 lc3plus/tinywaveout_c.h diff --git a/lc3plus/tinywavein_c.h b/lc3plus/tinywavein_c.h deleted file mode 100644 index c7bd58593c..0000000000 --- a/lc3plus/tinywavein_c.h +++ /dev/null @@ -1,605 +0,0 @@ -/****************************************************************************** -* ETSI TS 103 634 V1.4.1 * -* Low Complexity Communication Codec Plus (LC3plus) * -* * -* Copyright licence is solely granted through ETSI Intellectual Property * -* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -* estoppel or otherwise. * -******************************************************************************/ - - -#ifndef __TINYWAVEIN_C_H__ -#define __TINYWAVEIN_C_H__ - -/*#define SUPPORT_BWF*/ - -#include -#include -#include - - -#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ - defined(__aarch64__) -#define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ -#endif - -#if defined(__POWERPC__) -#define __TWI_BE /* _T_iny _W_ave _I_n _B_ig _E_ndian */ -#endif - -#if !defined(__TWI_LE) && !defined(__TWI_BE) -#error unknown processor -#endif - -#define __TWI_SUCCESS (0) -#define __TWI_ERROR (-1) - -#ifdef SUPPORT_BWF -typedef struct -{ - float loudnessVal; - float loudnessRange; - float maxTruePeakLevel; - float maxMomentaryLoudnes; - float maxShortTermLoudness; -} WAVEIN_LOUDNESSINFO; -#endif - -typedef struct __tinyWaveInHandle -{ - FILE * theFile; - fpos_t dataChunkPos; - unsigned int position; - unsigned int length; - unsigned int bps; -#ifdef SUPPORT_BWF - WAVEIN_LOUDNESSINFO *loudnessInfo; -#endif -} __tinyWaveInHandle, WAVEFILEIN; - -typedef struct -{ - short compressionCode; - short numberOfChannels; - unsigned int sampleRate; - unsigned int averageBytesPerSecond; - short blockAlign; - short bitsPerSample; - /* short extraFormatBytes ; */ -} SWavInfo; - -#ifdef SUPPORT_BWF -typedef struct -{ - unsigned char description[256]; - unsigned char originator[32]; - unsigned char originatorReference[32]; - unsigned char originatorDate[10]; /* ASCII: <> */ - unsigned char originationTime[8]; /* ASCII: <> */ - unsigned int timeReferenceLow; - unsigned int timeReferenceHigh; - unsigned short version; - unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ - - signed short loudnessVal; - signed short loudnessRange; - signed short maxTruePeakLevel; - signed short maxMomentaryLoudnes; - signed short maxShortTermLoudness; - - unsigned char Reserved[180]; - - unsigned char codingHistory; /* ASCII: <> */ -} SBwfWav; -#endif - -typedef struct -{ - char chunkID[4]; - unsigned int chunkSize; - /* long dataOffset ; */ /* never used */ -} SChunk; - -/* local wrapper, always returns correct endian */ -static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream); - -#ifdef __TWI_BE -static short BigEndian16(short v); -static int BigEndian32(int v); -#endif - -/*! - * \brief Read header from a WAVEfile. Host endianess is handled accordingly. - * \fp filepointer of type FILE*. - * \wavinfo SWavInfo struct where the decoded header info is stored into. - * \return 0 on success and non-zero on failure. - * - */ -static WAVEFILEIN *OpenWav(const char *filename, unsigned int *samplerate, short *channels, unsigned int *samplesInFile, - short *bps) -{ - WAVEFILEIN *self; - - SChunk fmt_chunk, data_chunk; - int offset; - unsigned int tmpSize; - char tmpFormat[4]; - SWavInfo wavinfo = {0, 0, 0, 0, 0, 0}; - - self = (WAVEFILEIN *)calloc(1, sizeof(WAVEFILEIN)); - if (!self) - goto bail; /* return NULL; */ - - if (!filename) - goto bail; - if (!samplerate) - goto bail; - if (!channels) - goto bail; - if (!samplesInFile) - goto bail; - if (!bps) - goto bail; - - self->theFile = fopen(filename, "rb"); - if (!self->theFile) - goto bail; - - /* read RIFF-chunk */ - if (fread(tmpFormat, 1, 4, self->theFile) != 4) - { - goto bail; - } - - if (strncmp("RIFF", tmpFormat, 4)) - { - goto bail; - } - - /* Read RIFF size. Ignored. */ - fread_LE(&tmpSize, 4, 1, self->theFile); - - /* read WAVE-chunk */ - if (fread(tmpFormat, 1, 4, self->theFile) != 4) - { - goto bail; - } - - if (strncmp("WAVE", tmpFormat, 4)) - { - goto bail; - } - - /* read format/bext-chunk */ - if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - -#ifdef SUPPORT_BWF - /* test for bext-chunk */ - if (!strncmp("bext", fmt_chunk.chunkID, 4)) - { - /*unsigned int i;*/ - unsigned int bextSize = 0; - - if (fread_LE(&bextSize, 1, 4, self->theFile) != 4) - { - goto bail; - } - - self->loudnessInfo = (WAVEIN_LOUDNESSINFO *)calloc(1, sizeof(WAVEIN_LOUDNESSINFO)); - - if (bextSize >= 602) - { /* minimum size bext-data, w/o 'CodingHistory' */ - int i; - signed short readBuf = 0; - signed int nulbuf = 0; - - /* first skip all descriptive data */ - for (i = 0; i < 412; i++) - { - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - bextSize -= 1; - } - /* second, read loudness data */ - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->loudnessVal = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->loudnessRange = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->maxTruePeakLevel = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->maxMomentaryLoudnes = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->maxShortTermLoudness = (float)readBuf * 0.01f; - - /* skip reserved data */ - for (i = 0; i < 180; i++) - { - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - bextSize -= 1; - } - } - - /* skip remaining data */ - while (bextSize) - { - int nulbuf; - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - bextSize -= 1; - } - - /* read next chunk header */ - if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - } -#endif - - /* skip some potential chunks up to fmt chunk */ - - while (strncmp("fmt ", fmt_chunk.chunkID, 4) != 0) - { - unsigned int chunkSize = 0; - - if (fread_LE(&chunkSize, 1, 4, self->theFile) != 4) - { - goto bail; - } - - /* skip chunk data */ - while (chunkSize) - { - int nulbuf; - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - chunkSize -= 1; - } - - /* read next chunk header */ - if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - } - - /* go on with fmt-chunk */ - if (strncmp("fmt ", fmt_chunk.chunkID, 4)) - { - goto bail; - } - - if (fread_LE(&fmt_chunk.chunkSize, 4, 1, self->theFile) != 1) - { /* should be 16 for PCM-format (uncompressed) */ - goto bail; - } - - - /* read info */ - fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); - fread_LE(&(wavinfo.numberOfChannels), 2, 1, self->theFile); - fread_LE(&(wavinfo.sampleRate), 4, 1, self->theFile); - fread_LE(&(wavinfo.averageBytesPerSecond), 4, 1, self->theFile); - fread_LE(&(wavinfo.blockAlign), 2, 1, self->theFile); - fread_LE(&(wavinfo.bitsPerSample), 2, 1, self->theFile); - - if (wavinfo.compressionCode == -2) - { - fseek(self->theFile, 8, SEEK_CUR); // skip channel mask - fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); // part of GUID - fseek(self->theFile, 14, SEEK_CUR); // skip rest of GUID - offset = fmt_chunk.chunkSize - 40; - } - else - offset = fmt_chunk.chunkSize - 16; - - if (wavinfo.compressionCode == 0x01) - { - if ((wavinfo.bitsPerSample != 16) && (wavinfo.bitsPerSample != 24) && (wavinfo.bitsPerSample != 32)) - /* we do only support 16,24 and 32 bit PCM audio */ - goto bail; - } - else - { - /* if(wavinfo.bitsPerSample != 32) */ - printf("compressioncode: %02x\n", wavinfo.compressionCode); - puts("Error! We only support 16,24 and 32 bit PCM audio"); - exit(1); - goto bail; - } - - /* Skip rest of fmt header if any. */ - for (; offset > 0; offset--) - { - fread(&tmpSize, 1, 1, self->theFile); - } - - do - { - - /* Read data chunk ID */ - if (fread(data_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - - /* Read chunk length. */ - - if (fread_LE(&offset, 4, 1, self->theFile) != 1) - { - goto bail; - } - - /* Check for data chunk signature. */ - if (strncmp("data", data_chunk.chunkID, 4) == 0) - { - data_chunk.chunkSize = offset; - break; - } - - /* unused 1 byte present, if size is odd */ - /* see https://www.daubnet.com/en/file-format-riff */ - if (offset % 2) - { - offset++; - } - - /* Jump over non data chunk. */ - for (; offset > 0; offset--) - { - fread(&tmpSize, 1, 1, self->theFile); - } - - } while (!feof(self->theFile)); - - /* success so far */ - *samplerate = wavinfo.sampleRate; - *channels = wavinfo.numberOfChannels; - *samplesInFile = data_chunk.chunkSize / wavinfo.numberOfChannels; - *samplesInFile /= ((wavinfo.bitsPerSample + 7) / 8); - *bps = wavinfo.bitsPerSample; - - self->position = 0; - self->bps = wavinfo.bitsPerSample; - self->length = *samplesInFile * wavinfo.numberOfChannels; - - fgetpos(self->theFile, &self->dataChunkPos); - - return self; - -bail: - free(self); - return NULL; -} - -#ifdef SUPPORT_BWF -static void ReadBWF(WAVEFILEIN *self, WAVEIN_LOUDNESSINFO **wavInLoudness) -{ - *wavInLoudness = self->loudnessInfo; -} -#endif - -static int __ReadSample16(WAVEFILEIN *self, int *sample) -{ - size_t cnt; - short v = 0; - - cnt = fread(&v, 2, 1, self->theFile); - - if (cnt != 1) - { - return __TWI_ERROR; - } - - self->position += 1; - -#ifdef __TWI_BE - v = BigEndian16(v); -#endif - *sample = v; - return __TWI_SUCCESS; -} - -static int __ReadSample24(WAVEFILEIN *self, int *sample) -{ - size_t cnt; - int v = 0; - - cnt = fread(&v, 3, 1, self->theFile); - - if (cnt != 1) - { - return __TWI_ERROR; - } - - self->position += 1; - -#ifdef __TWI_BE - v = BigEndian32(v); -#endif - - if (v >= 0x800000) - { - v |= 0xff000000; - } - - *sample = v; - - return __TWI_SUCCESS; -} - -static int __ReadSample32(WAVEFILEIN *self, int *sample) -{ - size_t cnt; - int v = 0; - - cnt = fread(&v, 4, 1, self->theFile); - - if (cnt != 1) - { - return __TWI_ERROR; - } - - self->position += 1; - -#ifdef __TWI_BE - v = BigEndian32(v); -#endif - - *sample = v >> 8; - - return __TWI_SUCCESS; -} - -static int __ReadSampleInternal(WAVEFILEIN *self, int *sample, int scale) -{ - int err; - - if (!self) - { - return __TWI_ERROR; - } - - switch (scale) - { - - case 16: err = __ReadSample16(self, sample); break; - - case 24: err = __ReadSample24(self, sample); break; - - case 32: err = __ReadSample32(self, sample); break; - - default: err = __TWI_ERROR; break; - } - - return err; -} - -/* this function returns normalized values in the range +8388607..-8388608 */ -static int ReadWavInt(WAVEFILEIN *self, int sampleBuffer[], unsigned int nSamplesToRead, unsigned int *nSamplesRead) -{ - unsigned int i; - int err = __TWI_SUCCESS; - *nSamplesRead = 0; - - if (!sampleBuffer) - { - return __TWI_ERROR; - } - - /* check if we have enough samples left, if not, - set nSamplesToRead to number of samples left. */ - if (self->position + nSamplesToRead > self->length) - { - nSamplesToRead = self->length - self->position; - } - - for (i = 0; i < nSamplesToRead; i++) - { - - int tmp; - err = __ReadSampleInternal(self, &tmp, self->bps); - if (err != __TWI_SUCCESS) - { - return err; - } - sampleBuffer[i] = tmp; - *nSamplesRead += 1; - } - - return __TWI_SUCCESS; -} - -static int CloseWavIn(WAVEFILEIN *self) -{ - if (self) - { - if (self->theFile) - { - fclose(self->theFile); - } - } - free(self); - - return __TWI_SUCCESS; -} -/* -static int ResetWavIn(WAVEFILEIN* self) -{ - if (self) { - if (self->theFile) { - fsetpos(self->theFile, &self->dataChunkPos); - self->position = 0; - } - } - return __TWI_SUCCESS; -} -*/ -/*------------- local subs ----------------*/ - -static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream) -{ -#ifdef __TWI_LE - return fread(ptr, size, nmemb, stream); -#endif -#ifdef __TWI_BE - - unsigned char x[sizeof(int)]; - unsigned char *y = (unsigned char *)ptr; - int i; - int len; - - len = fread(x, size, nmemb, stream); - - for (i = 0; i < size * nmemb; i++) - { - *y++ = x[size * nmemb - i - 1]; - } - - return len; -#endif -} - -#ifdef __TWI_BE -static short BigEndian16(short v) -{ - short a = (v & 0x0ff); - short b = (v & 0x0ff00) >> 8; - - return a << 8 | b; -} - -static int BigEndian32(int v) -{ - int a = (v & 0x0ff); - int b = (v & 0x0ff00) >> 8; - int c = (v & 0x0ff0000) >> 16; - int d = (v & 0xff000000) >> 24; - - return a << 24 | b << 16 | c << 8 | d; -} -#endif - -#endif /* __TINYWAVEIN_C_H__ */ diff --git a/lc3plus/tinywaveout_c.h b/lc3plus/tinywaveout_c.h deleted file mode 100644 index 323b09d51c..0000000000 --- a/lc3plus/tinywaveout_c.h +++ /dev/null @@ -1,892 +0,0 @@ -/****************************************************************************** -* ETSI TS 103 634 V1.4.1 * -* Low Complexity Communication Codec Plus (LC3plus) * -* * -* Copyright licence is solely granted through ETSI Intellectual Property * -* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -* estoppel or otherwise. * -******************************************************************************/ - - - - -#ifndef __TINYWAVEOUT_C_H__ -#define __TINYWAVEOUT_C_H__ - -/*#define TWO_SUPPORT_BWF*/ - -#include -#include -#include -#include -#ifdef TWO_SUPPORT_BWF -#include -#endif - -/***** Interface *********************************************************/ - -#ifndef TWO_UINT64 - #if !(defined(WIN32)) - #include - #define TWO_UINT64 uint64_t - #else - #define TWO_UINT64 unsigned __int64 - #endif -#endif - -typedef struct WAVEFILEOUT WAVEFILEOUT; -#ifdef TWO_SUPPORT_BWF -typedef struct WAVEOUT_LOUDNESSINFO WAVEOUT_LOUDNESSINFO; -#endif - -#define __TWO_SUCCESS (0) -#define __TWO_ERROR (-1) - -static WAVEFILEOUT* CreateWav( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps - ); - -#ifdef TWO_SUPPORT_BWF -static WAVEFILEOUT* CreateWavBWF( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps, - const WAVEOUT_LOUDNESSINFO *hBwfData - ); -#endif - -/* this function expects values in the 16 bit range +32767..-32768 */ -static int WriteWavShort( - WAVEFILEOUT* self, - short sampleBuffer[], - unsigned int nSamples - ); - -/* this function expects values in the 24 bit range +8388607..-8388608 */ -static int WriteWavLong( - WAVEFILEOUT* self, - int sampleBuffer[], - unsigned int nSamples - ); - -/* this function expects normalized values in the range +-1.0f */ -static int WriteWavFloat( - WAVEFILEOUT* self, - float sampleBuffer[], - unsigned int nSamples - ); - -static int CloseWav(WAVEFILEOUT* self); -#ifdef TWO_SUPPORT_BWF -static int CloseWavBWF(WAVEFILEOUT* self, WAVEOUT_LOUDNESSINFO bextData); -#endif - -/***** Implementation *********************************************************/ - -#if defined (__i386__) || defined (_M_IX86) || defined (_M_X64) || defined (__x86_64__) || defined (__arm__) || defined (__xtensa__) || defined (__aarch64__) || defined (__EMSCRIPTEN__) -#define __TWO_LE /* _T_iny _W_ave _O_ut _L_ittle _E_ndian */ -#endif - -#if defined (__POWERPC__) -#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ -#endif - -#if defined (__sparc__) -#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ -#endif - -#if ! defined (__TWO_LE) && ! defined (__TWO_BE) -#error unknown processor -#endif - -/*--- local types/structs ----------------------------------*/ - -#if defined(_MSC_VER) - #pragma pack(push, 1) -#else - #pragma pack(1) -#endif - - -#ifdef TWO_SUPPORT_BWF -struct WAVEOUT_LOUDNESSINFO { - float loudnessVal; - float loudnessRange; - float maxTruePeakLevel; - float maxMomentaryLoudnes; - float maxShortTermLoudness; -}; -#endif - - -typedef struct __tinyWaveOutHeader -{ - unsigned int riffType; /* 'RIFF/RF64' */ - unsigned int riffSize; /* file size/-1 */ - unsigned int waveType; /* 'WAVE' */ -} __tinyWaveOutHeader; - -typedef struct __tinyWaveOutDs64Chunk -{ - unsigned int formatType; /* = 'JUNK/ds64' */ - unsigned int formatSize; /* size info */ - TWO_UINT64 riffSize64; - TWO_UINT64 dataSize64; - TWO_UINT64 sampleCount64; - unsigned int tableLength; /* optional tables, always 0 for tinywaveout */ - /* here: optional tables */ -} __tinyWaveOutDs64Chunk; - -#ifdef TWO_SUPPORT_BWF -typedef struct __tinyWaveOutBextChunk -{ - unsigned int formatType; /* = 'bext' */ - unsigned int formatSize; /* size info */ - - unsigned char description[256]; - unsigned char originator[32]; - unsigned char originatorReference[32]; - unsigned char originatorDate[10]; /* ASCII: <> */ - unsigned char originationTime[8]; /* ASCII: <> */ - unsigned int timeReferenceLow; - unsigned int timeReferenceHigh; - unsigned short version; - unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ - - signed short loudnessVal; - signed short loudnessRange; - signed short maxTruePeakLevel; - signed short maxMomentaryLoudnes; - signed short maxShortTermLoudness; - - unsigned char Reserved[180]; - - unsigned char codingHistory; /* ASCII: <> - undefined length! */ - /* for variable length, mve this out of this struct */ -} __tinyWaveOutBextChunk; -#endif - -typedef struct __tinyWaveOutFmtChunk -{ - unsigned int formatType; - unsigned int formatSize; - - unsigned short formatTag; - unsigned short numChannels; - unsigned int sampleRate; - unsigned int bytesPerSecond; - unsigned short blockAlignment; - unsigned short bitsPerSample; - - /* wav fmt ext hdr here */ -} __tinyWaveOutFmtChunk; - -typedef struct __tinyWaveOutDataChunk -{ - unsigned int dataType; - unsigned int dataSize; - -} __tinyWaveOutDataChunk; - - -struct WAVEFILEOUT { - /* for reasons of memory alignment, have 64 bit data types first */ - TWO_UINT64 dataSize; - TWO_UINT64 dataSizeLimit; /* maximum size for data chunk for 4 GB files */ - TWO_UINT64 dataSizeLimit64; /* maximum size for data chunk for 2^64 B addressable files */ - TWO_UINT64 clipCount; - FILE* theFile; - unsigned int junkChunkOffset; - unsigned int fmtChunkOffset; -#ifdef TWO_SUPPORT_BWF - unsigned int bextChunkOffset; -#endif - unsigned int dataChunkOffset; - unsigned int bps; - - /* only needed for RF64: */ - unsigned int blockAlign; /* only needed for close() of ds64 chunk */ -}; - - -/*--- local protos --------------------------------------------------*/ -static __inline unsigned int BigEndian32(char, char, char, char); -static __inline unsigned int LittleEndian32(unsigned int); -static __inline unsigned int LittleEndian32s(int); -static __inline short LittleEndian16(short); -static __inline TWO_UINT64 LittleEndian64(TWO_UINT64); -#ifdef TWO_SUPPORT_BWF -static unsigned int EncodeLoudness(float); -#endif -static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ); - -#if defined(_MSC_VER) - #pragma pack(pop) -#else - #pragma pack() -#endif - - -#ifdef TWO_SUPPORT_BWF -static void setDefaultLoudness(WAVEOUT_LOUDNESSINFO *x) -{ - x->loudnessVal = 1.0f; - x->loudnessRange = 2.0f; - x->maxTruePeakLevel = 3.0f; - x->maxMomentaryLoudnes = 4.0f; - x->maxShortTermLoudness = 5.0f; -} -#endif - -static WAVEFILEOUT* __CreateWavInternal( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps -#ifdef TWO_SUPPORT_BWF - , - const WAVEOUT_LOUDNESSINFO *hBwfData -#endif - ) -{ - WAVEFILEOUT* self = NULL; - __tinyWaveOutHeader whdr; - __tinyWaveOutDs64Chunk ds64ch; -#ifdef TWO_SUPPORT_BWF - __tinyWaveOutBextChunk wbextch; -#endif - __tinyWaveOutFmtChunk wfch; - __tinyWaveOutDataChunk wdch; - unsigned int blockAlignment = 0; - unsigned int ByteCnt = 0; /* Byte counter for fwrite */ - - /* pseudo use to avoid unused symbols */ - (void)WriteWavShort; - (void)WriteWavLong; - (void)WriteWavFloat; -#ifdef TWI_SUPPORT_BWF - (void)CreateWavBWF; - (void)CloseWavBWF; - (void)setDefaultLoudness; -#endif - - /* param check */ - if (!fileName) goto bail; - if (sampleRate == 0) goto bail; - if (sampleRate > 768000) goto bail; - if (numChannels == 0) goto bail; - if (numChannels > 64) goto bail; - if (bps != 16 && bps != 24 && bps != 32) goto bail; - - self = (WAVEFILEOUT*)calloc(1, sizeof(WAVEFILEOUT)); - if (!self) goto bail; /* return NULL; */ - - self->theFile = fopen(fileName, "wb+"); - if (!self->theFile) goto bail; - - /* WAV-Header */ - whdr.riffType = BigEndian32('R','I','F','F'); - whdr.riffSize = LittleEndian32(0xffffffff); /* set to maximum, if fseek() doesn't work later */ - whdr.waveType = BigEndian32('W','A','V','E'); - /* write to file */ - ByteCnt = 0; - ByteCnt += fwrite(&whdr, 1, sizeof(whdr), self->theFile); - - /* ds64/JUNK-Chunk */ - ds64ch.formatType = BigEndian32('J','U','N','K'); - ds64ch.formatSize = LittleEndian32(sizeof(__tinyWaveOutDs64Chunk) - 8); - ds64ch.riffSize64 = (TWO_UINT64) -1; - ds64ch.dataSize64 = (TWO_UINT64) -1; - ds64ch.sampleCount64 = (TWO_UINT64) -1; - ds64ch.tableLength = 0; - self->junkChunkOffset = ByteCnt; - ByteCnt += fwrite(&ds64ch, 1, sizeof(ds64ch), self->theFile); - -#ifdef TWO_SUPPORT_BWF - /* BEXT-Chunk */ - if (hBwfData) { - memset(&wbextch, 0, sizeof(__tinyWaveOutBextChunk)); - wbextch.formatType = BigEndian32('b','e','x','t'); - wbextch.formatSize = LittleEndian32(sizeof(__tinyWaveOutBextChunk) - 8); - wbextch.version = 0x0002; - wbextch.loudnessVal = EncodeLoudness(hBwfData->loudnessVal); - wbextch.loudnessRange = EncodeLoudness(hBwfData->loudnessRange); - wbextch.maxTruePeakLevel = EncodeLoudness(hBwfData->maxTruePeakLevel); - wbextch.maxMomentaryLoudnes = EncodeLoudness(hBwfData->maxMomentaryLoudnes); - wbextch.maxShortTermLoudness = EncodeLoudness(hBwfData->maxShortTermLoudness); - /* t.b.d.: more values */ - - /* write to file */ - self->bextChunkOffset = ByteCnt; - ByteCnt += fwrite(&wbextch, 1, sizeof(wbextch), self->theFile); - } -#endif - - /* FMT-Chunk */ - wfch.formatType = BigEndian32('f','m','t',' '); - wfch.formatSize = LittleEndian32(16); - switch (bps) { - case 16: - case 24: - wfch.formatTag = LittleEndian16(0x0001); /* WAVE_FORMAT_PCM */ - break; - case 32: - wfch.formatTag = LittleEndian16(0x0003); /* WAVE_FORMAT_IEEE_FLOAT */ - break; - default: - goto bail; - } - self->bps = bps; - wfch.bitsPerSample = LittleEndian16(bps); - wfch.numChannels = LittleEndian16(numChannels); - blockAlignment = numChannels * (bps >> 3); - wfch.blockAlignment = LittleEndian16(blockAlignment); - wfch.sampleRate = LittleEndian32(sampleRate); - wfch.bytesPerSecond = LittleEndian32(sampleRate * blockAlignment); - /* tbd: wavfmt ext hdr here */ - /* write to file */ - self->fmtChunkOffset = ByteCnt; - ByteCnt += fwrite(&wfch, 1, sizeof(wfch), self->theFile); - - /* DATA-Chunk */ - self->dataChunkOffset = ByteCnt; - wdch.dataType = BigEndian32('d','a','t','a'); - wdch.dataSize = LittleEndian32(0xffffffff - ByteCnt); /* yet unknown. set to maximum of 4 GB file */ - /* write to file */ - ByteCnt += fwrite(&wdch, 1, sizeof(wdch), self->theFile); - - self->dataSize = 0; - - /* self->dataSizeLimit = 0x7fffffff - ByteCnt; */ /* maximum size for data chunk for 2 GB files */ - self->dataSizeLimit = 0xffffffff - ByteCnt; /* maximum size for data chunk for 4 GB files */ - self->dataSizeLimit64 = 0xffffffffffffffff - ByteCnt; /* maximum size for data chunk for 64 bit addressable files */ - - self->clipCount = 0; - self->blockAlign = blockAlignment; - - return self; - - bail: - if ( NULL != self) { - free(self); - } - - return NULL; -} - -static WAVEFILEOUT* CreateWav( - const char* fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps - ) -{ -#ifdef TWO_SUPPORT_BWF - return __CreateWavInternal(fileName, sampleRate, numChannels, bps, NULL); -#else - return __CreateWavInternal(fileName, sampleRate, numChannels, bps); -#endif -} - -#ifdef TWO_SUPPORT_BWF -static WAVEFILEOUT* CreateWavBWF( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps, - const WAVEOUT_LOUDNESSINFO *hBwfData - ) -{ - return __CreateWavInternal(fileName, sampleRate, numChannels, bps, hBwfData); -} -#endif - -#define MAX_PCM16 (+32767) -#define MIN_PCM16 (-32768) -static __inline int CLIP_PCM16(int sample, TWO_UINT64* clipcount) -{ - int tmp = sample; - - if (sample >= MAX_PCM16) { - tmp = MAX_PCM16; - (*clipcount)++; - } else { - if (sample <= MIN_PCM16) { - tmp = MIN_PCM16; - (*clipcount)++; - } - } - - return tmp; -} - -#define MAX_PCM24 (+8388607) -#define MIN_PCM24 (-8388608) -static __inline int CLIP_PCM24(int sample, TWO_UINT64* clipcount) -{ - int tmp = sample; - - if (sample >= MAX_PCM24) { - tmp = MAX_PCM24; - (*clipcount)++; - } else { - if (sample <= MIN_PCM24) { - tmp = MIN_PCM24; - (*clipcount)++; - } - } - - return tmp; -} - -#define MAX_FLOAT32 (+1.0f) -#define MIN_FLOAT32 (-1.0f) -static __inline float CLIP_FLOAT32(float sample, TWO_UINT64* clipcount) -{ - float tmp = sample; - - if (sample >= MAX_FLOAT32) { - tmp = MAX_FLOAT32; - (*clipcount)++; - } else { - if (sample <= MIN_FLOAT32) { - tmp = MIN_FLOAT32; - (*clipcount)++; - } - } - - return tmp; -} - - - -static int __WriteSample16( - WAVEFILEOUT* self, - int sample, - int scale - ) -{ - size_t cnt; - short v; - - if ((scale - 16) > 0) - sample = sample >> (scale - 16); - else - sample = (int) ((uint32_t) sample << (16 - scale)); - - v = (short)CLIP_PCM16(sample, &(self->clipCount)); -#ifdef __TWO_BE - v = LittleEndian16(v); -#endif - - cnt = fwrite(&v, sizeof(short), 1, self->theFile); - - if (cnt == 1) { - self->dataSize += 2; - return __TWO_SUCCESS; - } - - return __TWO_ERROR; -} - - -static int __WriteSample24( - WAVEFILEOUT* self, - int sample, - int scale - ) -{ - size_t cnt; - int v; - - if ((scale - 24) > 0) - sample = sample >> (scale - 24); - else - sample = (int) (((unsigned int)sample) << (24 - scale)); - - v = (int)CLIP_PCM24(sample, &(self->clipCount)); -#ifdef __TWO_BE - v = LittleEndian32s(v); -#endif - cnt = fwrite(&v, 3, 1, self->theFile); - - if (cnt == 1) { - self->dataSize += 3; - return __TWO_SUCCESS; - } - - return __TWO_ERROR; -} - - -static int __WriteSample32( - WAVEFILEOUT* self, - float sample - ) -{ - size_t cnt; - union fl_int { - float v_float; - int v_int; - }; - union fl_int v; - -#if CLIP_FLOAT - v.v_float = CLIP_FLOAT32(sample, &(self->clipCount)); -#else - v.v_float = sample; - if((sample > 1.0f) || (sample <-1.0f)) - self->clipCount++; -#endif - -#ifdef __TWO_BE - v.v_int = LittleEndian32s(v.v_int); -#endif - cnt = fwrite(&v, 4, 1, self->theFile); - - if (cnt == 1) { - self->dataSize += 4; - return __TWO_SUCCESS; - } - - return __TWO_ERROR; -} - - -static int __WriteSampleInt( - WAVEFILEOUT* self, - int sample, - int scale - ) -{ - int err; - - if (!self) return __TWO_ERROR; - - - switch (self->bps) { - - case 16: - err = __WriteSample16(self, sample, scale); - break; - - case 24: - err = __WriteSample24(self, sample, scale); - break; - - default: - err = __TWO_ERROR; - break; - } - - return err; -} - - -/* this function expects values in the 16 bit range +-32767/8 */ -static int WriteWavShort( - WAVEFILEOUT* self, - short sampleBuffer[], - unsigned int nSamples - ) -{ - unsigned long i; - int err = __TWO_SUCCESS; - - if (!self) return __TWO_ERROR; - if (!sampleBuffer) return __TWO_ERROR; - if (__dataSizeChk(self, nSamples * sizeof(short))) return __TWO_ERROR; - - for (i=0; i< nSamples; i++) { - if (self->bps == 32) - { - err = __WriteSample32(self, sampleBuffer[i] / 32768.0f); - } - else - { - err = __WriteSampleInt(self, (int)sampleBuffer[i], 16); - } - if (err != __TWO_SUCCESS) return err; - } - - return __TWO_SUCCESS; -} - - -/* this function expects values in the 24 bit range +-8388607/8 */ -static int WriteWavLong( - WAVEFILEOUT* self, - int sampleBuffer[], - unsigned int nSamples - ) -{ - unsigned long i; - int err = __TWO_SUCCESS; - - if (!self) return __TWO_ERROR; - if (!sampleBuffer) return __TWO_ERROR; - if (__dataSizeChk(self, nSamples * sizeof(int))) return __TWO_ERROR; - - for (i = 0; i < nSamples; i++) { - if (self->bps == 32) - { - err = __WriteSample32(self, sampleBuffer[i] / 8388608.0f); - } - else - { - err = __WriteSampleInt(self, sampleBuffer[i], 24); - } - if (err != __TWO_SUCCESS) return err; - } - - return __TWO_SUCCESS; -} - - -/* this function expects normalized values in the range +-1.0 */ -#define MAX_FL (+2.0f * 8388608.0f ) -#define MIN_FL (-2.0f * 8388608.0f ) -#define CLIP_FL(x) ( ((x) >= MAX_FL) ? MAX_FL : (((x) <= MIN_FL) ? MIN_FL : (x)) ) -static int WriteWavFloat( - WAVEFILEOUT* self, - float sampleBuffer[], - unsigned int nSamples - ) -{ - unsigned int i; - int err = __TWO_SUCCESS; - - if (!self) return __TWO_ERROR; - if (!sampleBuffer) return __TWO_ERROR; - if (__dataSizeChk(self, nSamples * sizeof(float))) return __TWO_ERROR; - - for (i=0; ibps == 32) - { - err = __WriteSample32(self, sampleBuffer[i]); - } - else - { - float tmp = CLIP_FL(sampleBuffer[i] * 8388608.0f); /* CLIP_FL is just to avoid an INT overrun before the actual cast to int, real clipping and counting is done below */ - err = __WriteSampleInt(self, (int) tmp, 24); - } - if (err != __TWO_SUCCESS) return err; - } - - return __TWO_SUCCESS; -} - - -static int CloseWav(WAVEFILEOUT* self) -{ - unsigned int riffSize_le = 0; - unsigned int dataSize_le = 0; - TWO_UINT64 riffSize64 = 0; - TWO_UINT64 dataSize64 = 0; - TWO_UINT64 sampleCount64 = 0; /* nr of samples in the WAVE sense: 1 sample are all pcm samples of all channels of one time slice */ - int mustWriteRF64 = 0; - - if (!self) return __TWO_ERROR; - - /* check for 4 GB (switch to RF64) */ - if ( self->dataSize > self->dataSizeLimit ) { - /* when we exceed 4 GB: switch from std wave header to RF64 header */ - mustWriteRF64 = 1; - } - - /* calc header values */ - if (mustWriteRF64 == 0) { - /* write padding byte if dataSize is uneven */ - int pad = 0; - if (self->dataSize % 2 > 0) { - char tmp= 0x00; - fwrite(&tmp, sizeof(char), 1, self->theFile); - pad = 1; - } - riffSize_le = LittleEndian32(self->dataChunkOffset - 8 + 8 + (unsigned int)self->dataSize + pad); /* sizeof(hdr) - (8 bytes of riff chunk header) + (8 bytes data chunk header) + sizeof(raw-pcm-data) + padding Byte */ - dataSize_le = LittleEndian32((unsigned int)self->dataSize); - } else { - riffSize_le = 0xffffffff; - dataSize_le = 0xffffffff; - riffSize64 = LittleEndian64( self->dataSize + (TWO_UINT64)self->dataChunkOffset ); - dataSize64 = LittleEndian64( self->dataSize ); - sampleCount64 = LittleEndian64( self->dataSize / (TWO_UINT64)self->blockAlign ); - } - - /* now overwrite length/size values in header with the actual/real ones */ - if (mustWriteRF64 == 0) { - /* riffsize32 */ - fseek(self->theFile, 4, SEEK_SET); - fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); - /* datasize32 */ - fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); - fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); - } else { - unsigned int rf64sig = BigEndian32('R','F','6','4'); - unsigned int ds64sig = BigEndian32('d','s','6','4'); - - /* replace RIFF->RF64 */ - fseek(self->theFile, 0, SEEK_SET); - fwrite(&rf64sig, sizeof(rf64sig), 1, self->theFile); - - /* riffsize32 */ - fseek(self->theFile, 4, SEEK_SET); - fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); - - /* replace JUNK->ds64 */ - fseek(self->theFile, self->junkChunkOffset, SEEK_SET); - fwrite(&ds64sig, sizeof(ds64sig), 1, self->theFile); - - /* riffSize64, dataSize64, sampleCount64 */ - fseek(self->theFile, self->junkChunkOffset + 8, SEEK_SET); - fwrite(&riffSize64, sizeof(riffSize64), 1, self->theFile); - fwrite(&dataSize64, sizeof(dataSize64), 1, self->theFile); - fwrite(&sampleCount64, sizeof(sampleCount64), 1, self->theFile); - - /* datasize32 */ - fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); - fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); - } - - fclose(self->theFile); - free(self); - - return __TWO_SUCCESS; -} - -#ifdef TWO_SUPPORT_BWF -static int CloseWavBWF( - WAVEFILEOUT* self, - WAVEOUT_LOUDNESSINFO bextData - ) -{ - int wordData; - - if (!self) return __TWO_ERROR; - - if (self->bextChunkOffset) { - /* Offset for Loudness Data in bext-chunk: 8: Chunk-Header, 412:prev.Data */ - fseek(self->theFile, self->bextChunkOffset+8+412, SEEK_SET); - - wordData = LittleEndian32(EncodeLoudness(bextData.loudnessVal)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.loudnessRange)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.maxTruePeakLevel)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.maxMomentaryLoudnes)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.maxShortTermLoudness)); - fwrite(&wordData, 2, 1, self->theFile); - } - - return CloseWav(self); -} -#endif - -/*------------- local subs ----------------*/ - -static __inline unsigned int BigEndian32(char a, char b, char c, char d) -{ -#ifdef __TWO_LE - return - (unsigned int) d << 24 | - (unsigned int) c << 16 | - (unsigned int) b << 8 | - (unsigned int) a ; -#else - return - (unsigned int) a << 24 | - (unsigned int) b << 16 | - (unsigned int) c << 8 | - (unsigned int) d ; -#endif -} - - -static __inline unsigned int LittleEndian32(unsigned int v) -{ -#ifdef __TWO_LE - return v; -#else - return - (v & 0x000000FF) << 24 | - (v & 0x0000FF00) << 8 | - (v & 0x00FF0000) >> 8 | - (v & 0xFF000000) >> 24 ; -#endif -} - - -/* signed version of the above */ -static __inline unsigned int LittleEndian32s(int v) -{ -#ifdef __TWO_LE - return v; -#else - return - (v & 0x000000FF) << 24 | - (v & 0x0000FF00) << 8 | - (v & 0x00FF0000) >> 8 | - (v & 0xFF000000) >> 24 ; -#endif -} - - -static __inline short LittleEndian16(short v) -{ -#ifdef __TWO_LE - return v; -#else - return ((v << 8) & 0xFF00) | ((v >> 8) & 0x00FF); -#endif -} - -static __inline TWO_UINT64 LittleEndian64(TWO_UINT64 v) -{ -#ifdef __TWO_LE - return v; -#else - return - (v & 0x00000000000000FF) << 56 | - (v & 0x000000000000FF00) << 40 | - (v & 0x0000000000FF0000) << 24 | - (v & 0x00000000FF000000) << 8 | - (v & 0x000000FF00000000) >> 8 | - (v & 0x0000FF0000000000) >> 24 | - (v & 0x00FF000000000000) >> 40 | - (v & 0xFF00000000000000) >> 56 ; -#endif -} - -#ifdef TWO_SUPPORT_BWF -static unsigned int EncodeLoudness(float x) -{ - int s = (x>0)-(x<0); - return (int)( x*100.0f + s*0.5f ); -} -#endif - -static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ) -{ - if (!self) return __TWO_ERROR; - - if ( (self->dataSize + ((TWO_UINT64)newbytes) ) > self->dataSizeLimit64 ) { - return __TWO_ERROR; - } - - return __TWO_SUCCESS; -} - -#endif /* __TINYWAVEOUT_C_H__ */ - - - diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index d44e304565..52152999cf 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -12,7 +12,11 @@ unzip lc3plus_sources.zip -d . # Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) git apply --ignore-whitespace lc3plus.patch -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/makefile +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/makefile +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywaveout_c.h rm -r ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc find ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point -type f -exec chmod -x {} \; -- GitLab From 7eab3dcffb2b648a20f9eecc7b4b43542d65c7f3 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 7 Jul 2023 15:46:51 +0300 Subject: [PATCH 274/591] Remove opening of decorrelator for ParamISM with ParamBin. --- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 329348f390..bddbc4f506 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -240,7 +240,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } - if ( !hBinaural->useTdDecorr ) + if ( !hBinaural->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) { ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); if ( ( error = ivas_dirac_dec_decorr_open( &( hBinaural->h_freq_domain_decorr_ap_params ), -- GitLab From adc6c370d3ad25f186b709399b057e1e32d2fd6d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Jul 2023 16:24:56 +0200 Subject: [PATCH 275/591] Missing include of stl.h --- lib_com/env_stab.c | 3 +++ lib_com/options.h | 1 + 2 files changed, 4 insertions(+) diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index b4da4ce9d7..1d9023eeeb 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -44,6 +44,9 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" +#ifdef FIX_594_STL_INCLUDE +#include "stl.h" +#endif #ifdef DEBUGGING #include "assert.h" #endif diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..fab827156f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ +#define FIX_594_STL_INCLUDE /* FhG: issue 594: Missing include of stl.h */ /* ################## End DEVELOPMENT switches ######################### */ -- GitLab From 2725e128e3d90c528e3e037fdb5ba426216912b9 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 10 Jul 2023 09:41:36 +0200 Subject: [PATCH 276/591] fix compilation with BASOP_NOGLOB disabled --- lib_com/env_stab.c | 4 ++++ lib_com/options.h | 1 + 2 files changed, 5 insertions(+) diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index b4da4ce9d7..e1acf8e952 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -92,8 +92,12 @@ float env_stability( #ifdef BASOP_NOGLOB Overflow = 0; env_delta = shl_o( *mem_env_delta, 1, &Overflow ); +#else +#ifdef FIX_595_SHL_NOGLOB + env_delta = shl( *mem_env_delta, 1 ); #else env_delta = shl_o( *mem_env_delta, 1 ); +#endif #endif } else diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..db31a750ae 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ +#define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ /* ################## End DEVELOPMENT switches ######################### */ -- GitLab From f0f5b5b93ea34196d771cdfefe8507bda0b2a9ca Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 10 Jul 2023 13:01:04 +0200 Subject: [PATCH 277/591] [cleanup] update patchfile to remove unnecessary patch to .vcxproj file --- scripts/lc3plus_lib_setup/lc3plus.patch | 431 ------------------------ 1 file changed, 431 deletions(-) diff --git a/scripts/lc3plus_lib_setup/lc3plus.patch b/scripts/lc3plus_lib_setup/lc3plus.patch index 9435fb4d22..14b81a3972 100644 --- a/scripts/lc3plus_lib_setup/lc3plus.patch +++ b/scripts/lc3plus_lib_setup/lc3plus.patch @@ -732,437 +732,6 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin @@ -0,0 +1 @@ +Win32/ \ No newline at end of file -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/LC3plus.vcxproj 2023-06-29 12:58:27 -@@ -1,243 +1,184 @@ -- -- -- -- -- Debug -- Win32 -- -- -- Debug -- x64 -- -- -- Release -- Win32 -- -- -- Release -- x64 -- -- -- -- {95030B82-70CD-4C6B-84D4-61096035BEA2} -- Win32Proj -- LC3_FL -- 10.0.17763.0 -- -- -- -- Application -- true -- v141 -- Unicode -- -- -- Application -- false -- v141 -- true -- Unicode -- -- -- Application -- true -- v141 -- Unicode -- -- -- Application -- false -- v141 -- true -- Unicode -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- true -- LC3plus -- $(Platform)\$(Configuration)\ -- $(Platform)\$(Configuration)\Obj\ -- -- -- true -- LC3plus -- $(Platform)\$(Configuration)\ -- $(Platform)\$(Configuration)\Obj\ -- -- -- false -- LC3plus -- $(Platform)\$(Configuration)\ -- $(Platform)\$(Configuration)\Obj\ -- -- -- false -- LC3plus -- $(Platform)\$(Configuration)\ -- $(Platform)\$(Configuration)\Obj\ -- -- -- -- -- -- Level3 -- Disabled -- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) -- 4305;4244;4996 -- -- -- Console -- true -- -- -- -- -- -- -- Level3 -- Disabled -- _DEBUG;_CONSOLE;%(PreprocessorDefinitions) -- -- -- Console -- true -- -- -- -- -- Level3 -- -- -- MaxSpeed -- true -- true -- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) -- 4244;4305;4996 -- -- -- Console -- true -- true -- true -- -- -- -- -- Level3 -- -- -- MaxSpeed -- true -- true -- NDEBUG;_CONSOLE;%(PreprocessorDefinitions) -- 4244;4305;4267;4996 -- -- -- Console -- true -- true -- true -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+ -+ -+ -+ -+ Debug -+ Win32 -+ -+ -+ Debug -+ x64 -+ -+ -+ Release -+ Win32 -+ -+ -+ Release -+ x64 -+ -+ -+ -+ {95030B82-70CD-4C6B-84D4-61096035BEA2} -+ Win32Proj -+ LC3_FL -+ 10.0.17763.0 -+ -+ -+ -+ StaticLibrary -+ true -+ v141 -+ Unicode -+ -+ -+ StaticLibrary -+ false -+ v141 -+ true -+ Unicode -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ true -+ LC3plus -+ $(Platform)\$(Configuration)\ -+ $(Platform)\$(Configuration)\Obj\ -+ -+ -+ false -+ LC3plus -+ $(Platform)\$(Configuration)\ -+ $(Platform)\$(Configuration)\Obj\ -+ -+ -+ -+ -+ -+ Level3 -+ ..\..\lib_com;%(AdditionalIncludeDirectories) -+ Disabled -+ MultiThreadedDebug -+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) -+ 4305;4244;4996 -+ -+ -+ Console -+ true -+ -+ -+ -+ -+ Level3 -+ -+ -+ ..\..\lib_com;%(AdditionalIncludeDirectories) -+ MaxSpeed -+ MultiThreaded -+ true -+ true -+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) -+ 4244;4305;4996 -+ -+ -+ Console -+ true -+ true -+ true -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - -\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 +++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35 -- GitLab From de588377f1aba2b5e3d012d265172887580a4f0a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 10 Jul 2023 13:02:38 +0200 Subject: [PATCH 278/591] [fix] clang-format --- apps/decoder.c | 6 +++--- lib_dec/ivas_spar_decoder.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index fd5cb7a00e..939085acd1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -579,10 +579,10 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ -#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && + arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 352d99ba9e..fc5be70877 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1678,11 +1678,11 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif - ) ) + ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -- GitLab From a5119a46c1feab2cb3292266f9930f7e7c89ea75 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 10 Jul 2023 13:53:29 +0200 Subject: [PATCH 279/591] Switch to Fastconv --- lib_dec/ivas_dec.c | 6 ++- lib_dec/ivas_jbm_dec.c | 9 +--- lib_dec/ivas_mc_paramupmix_dec.c | 79 ++++++++++++++++++-------------- lib_dec/ivas_output_config.c | 20 ++++++++ 4 files changed, 71 insertions(+), 43 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 439a90fb2c..2b88822d06 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -532,6 +532,10 @@ ivas_error ivas_dec( } /* Rendering */ +#ifdef JBM_PARAMUPMIX + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { +#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, @@ -539,7 +543,7 @@ ivas_error ivas_dec( { return error; } - +#endif ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); } else if ( st_ivas->renderer_type == RENDERER_MC ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 43ad5d59fe..ed672cac5c 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -896,15 +896,8 @@ ivas_error ivas_jbm_dec_render( } /* Rendering */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_output, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); } else if ( st_ivas->renderer_type == RENDERER_MC ) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 461072d79d..6ae1097e7e 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -181,7 +181,9 @@ void ivas_mc_paramupmix_dec( float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ int16_t noparamupmix_delay; AUDIO_CONFIG output_config; - +#ifdef JBM_PARAMUPMIX + float *p_output[MAX_OUTPUT_CHANNELS]; +#endif hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); @@ -198,6 +200,19 @@ void ivas_mc_paramupmix_dec( { first_empty_channel = 8; /* Don't upmix */ } +#ifdef JBM_PARAMUPMIX + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + /* Implement binaural rendering */ + first_empty_channel = 4; /* don't erase LFE */ + + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ ) + { + p_output[ch] = output_f[ch]; + } + ivas_binaural_cldfb( st_ivas, p_output ); + } +#endif else { first_empty_channel = 12; @@ -337,8 +352,7 @@ void ivas_mc_paramupmix_dec_render( uint16_t slot_size, ch; float *output_f_local[MAX_OUTPUT_CHANNELS]; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; - int16_t saved_subframes_rendered; - int16_t saved_slots_rendered; + hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); @@ -354,8 +368,6 @@ void ivas_mc_paramupmix_dec_render( /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - saved_subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - saved_slots_rendered = st_ivas->hTcBuffer->slots_rendered; first_sf = st_ivas->hTcBuffer->subframes_rendered; last_sf = first_sf; @@ -372,39 +384,40 @@ void ivas_mc_paramupmix_dec_render( #ifdef DEBUGGING assert( slots_to_render == 0 ); #endif - - for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + /* Implement binaural rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - mvr2r( hMCParamUpmix->alpha_prev[ch], hMCParamUpmix->alpha_sf[ch], IVAS_MAX_NUM_BANDS ); - mvr2r( hMCParamUpmix->beta_prev[ch], hMCParamUpmix->beta_sf[ch], IVAS_MAX_NUM_BANDS ); + ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, output_f_local ); } - - for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + else { - int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; - ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); - for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { - output_f_local[ch] += n_samples_sf; + mvr2r( hMCParamUpmix->alpha_prev[ch], hMCParamUpmix->alpha_sf[ch], IVAS_MAX_NUM_BANDS ); + mvr2r( hMCParamUpmix->beta_prev[ch], hMCParamUpmix->beta_sf[ch], IVAS_MAX_NUM_BANDS ); } - } - for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) - { - mvr2r( hMCParamUpmix->alphas[ch], hMCParamUpmix->alpha_prev[ch], IVAS_MAX_NUM_BANDS ); - mvr2r( hMCParamUpmix->betas[ch], hMCParamUpmix->beta_prev[ch], IVAS_MAX_NUM_BANDS ); - } + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; - *nSamplesAvailable = ( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered ) * slot_size; + ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + output_f_local[ch] += n_samples_sf; + } + } - /* Binaural renderer will do the slot rendering */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - st_ivas->hTcBuffer->slots_rendered = saved_slots_rendered; - st_ivas->hTcBuffer->subframes_rendered = saved_subframes_rendered; + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + mvr2r( hMCParamUpmix->alphas[ch], hMCParamUpmix->alpha_prev[ch], IVAS_MAX_NUM_BANDS ); + mvr2r( hMCParamUpmix->betas[ch], hMCParamUpmix->beta_prev[ch], IVAS_MAX_NUM_BANDS ); + } } + *nSamplesAvailable = ( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered ) * slot_size; + pop_wmops(); } #endif @@ -498,18 +511,16 @@ ivas_error ivas_mc_paramupmix_dec_open( nchan_tc = st_ivas->hDecoderConfig->nchan_out; nchan_to_allocate = nchan_tc; } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) + 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 ) { - 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; - } - hMCParamUpmix->free_param_interpolator = 1; + return error; } + hMCParamUpmix->free_param_interpolator = 1; + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); } #endif diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 16787b63cd..a068e97b79 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -199,7 +199,11 @@ void ivas_renderer_select( } else { +#ifdef JBM_PARAMUPMIX + if ( st_ivas->mc_mode == MC_MODE_MCT ) +#else if ( ( st_ivas->mc_mode == MC_MODE_MCT ) || ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) +#endif { *renderer_type = RENDERER_BINAURAL_MIXER_CONV; } @@ -223,11 +227,21 @@ void ivas_renderer_select( /* force HOA3 domain for rotation*/ *internal_config = AUDIO_CONFIG_HOA3; } +#ifdef JBM_PARAMUPMIX + if ( ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && ( *renderer_type == RENDERER_BINAURAL_FASTCONV ) ) + { + *internal_config = AUDIO_CONFIG_5_1_2; + } +#endif } } else { +#ifdef JBM_PARAMUPMIX + if ( st_ivas->mc_mode == MC_MODE_MCT ) +#else if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) +#endif { *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; } @@ -244,6 +258,12 @@ void ivas_renderer_select( { *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } +#endif +#ifdef JBM_PARAMUPMIX + if ( ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && ( *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) + { + *internal_config = AUDIO_CONFIG_5_1_2; + } #endif } } -- GitLab From b9fbb11ce406326888d2084c13b933fb4cc60fe2 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 10 Jul 2023 14:02:24 +0200 Subject: [PATCH 280/591] [cleanup] re-remove files added in merge and remove executable bit again --- lc3plus/adjust_global_gain.c | 0 lc3plus/al_fec_fl.c | 0 lc3plus/apply_global_gain.c | 0 lc3plus/ari_codec.c | 0 lc3plus/attack_detector.c | 0 lc3plus/clib.h | 0 lc3plus/constants.c | 0 lc3plus/constants.h | 0 lc3plus/cutoff_bandwidth.c | 0 lc3plus/dct4.c | 0 lc3plus/dec_entropy.c | 0 lc3plus/dec_lc3_fl.c | 0 lc3plus/defines.h | 0 lc3plus/detect_cutoff_warped.c | 0 lc3plus/enc_entropy.c | 0 lc3plus/enc_lc3_fl.c | 0 lc3plus/estimate_global_gain.c | 0 lc3plus/fft/cfft.c | 0 lc3plus/fft/cfft.h | 0 lc3plus/fft/fft_15_16.h | 0 lc3plus/fft/fft_240_480.h | 0 lc3plus/fft/fft_2_9.h | 0 lc3plus/fft/fft_32.h | 0 lc3plus/fft/fft_384_768.h | 0 lc3plus/fft/fft_60_128.h | 0 lc3plus/fft/fft_generic.h | 0 lc3plus/fft/iis_fft.c | 0 lc3plus/fft/iis_fft.h | 0 lc3plus/fft/iisfft.c | 0 lc3plus/fft/iisfft.h | 0 lc3plus/functions.h | 0 lc3plus/imdct.c | 0 lc3plus/lc3.c | 0 lc3plus/lc3.h | 0 lc3plus/license.h | 0 lc3plus/ltpf_coder.c | 0 lc3plus/ltpf_decoder.c | 0 lc3plus/makefile | 143 ---- lc3plus/mdct.c | 0 lc3plus/mdct_shaping.c | 0 lc3plus/msvc/.gitignore | 1 - lc3plus/msvc/LC3plus.sln | 28 - lc3plus/msvc/LC3plus.vcxproj | 184 ----- lc3plus/near_nyquist_detector.c | 0 lc3plus/noise_factor.c | 0 lc3plus/noise_filling.c | 0 lc3plus/olpa.c | 0 lc3plus/pc_apply.c | 0 lc3plus/pc_classify.c | 0 lc3plus/pc_main.c | 0 lc3plus/pc_update.c | 0 lc3plus/per_band_energy.c | 0 lc3plus/plc_classify.c | 0 lc3plus/plc_compute_stab_fac.c | 0 lc3plus/plc_damping_scrambling.c | 0 lc3plus/plc_main.c | 0 lc3plus/plc_noise_substitution.c | 0 lc3plus/plc_noise_substitution0.c | 0 lc3plus/plc_phecu_f0_refine_first.c | 0 lc3plus/plc_phecu_fec_hq.c | 0 lc3plus/plc_phecu_hq_ecu.c | 0 lc3plus/plc_phecu_lf_peak_analysis.c | 0 lc3plus/plc_phecu_rec_frame.c | 0 lc3plus/plc_phecu_setf0hz.c | 0 lc3plus/plc_phecu_spec_ana.c | 0 lc3plus/plc_phecu_subst_spec.c | 0 lc3plus/plc_phecu_tba_per_band_gain.c | 0 lc3plus/plc_phecu_tba_spect_Xavg.c | 0 lc3plus/plc_phecu_tba_trans_dect_gains.c | 0 lc3plus/plc_phecu_trans_burst_ana_sub.c | 0 lc3plus/plc_tdc.c | 0 lc3plus/plc_tdc_tdac.c | 0 lc3plus/plc_update.c | 0 lc3plus/quantize_spec.c | 0 lc3plus/reorder_bitstream.c | 0 lc3plus/resamp12k8.c | 0 lc3plus/residual_coding.c | 0 lc3plus/residual_decoding.c | 0 lc3plus/setup_com_lc3.c | 0 lc3plus/setup_dec_lc3.c | 0 lc3plus/setup_dec_lc3.h | 0 lc3plus/setup_enc_lc3.c | 0 lc3plus/setup_enc_lc3.h | 0 lc3plus/sns_compute_scf.c | 0 lc3plus/sns_interpolate_scf.c | 0 lc3plus/sns_quantize_scf.c | 0 lc3plus/structs.h | 0 lc3plus/tinywavein_c.h | 605 --------------- lc3plus/tinywaveout_c.h | 892 ----------------------- lc3plus/tns_coder.c | 0 lc3plus/tns_decoder.c | 0 lc3plus/util.h | 0 92 files changed, 1853 deletions(-) mode change 100755 => 100644 lc3plus/adjust_global_gain.c mode change 100755 => 100644 lc3plus/al_fec_fl.c mode change 100755 => 100644 lc3plus/apply_global_gain.c mode change 100755 => 100644 lc3plus/ari_codec.c mode change 100755 => 100644 lc3plus/attack_detector.c mode change 100755 => 100644 lc3plus/clib.h mode change 100755 => 100644 lc3plus/constants.c mode change 100755 => 100644 lc3plus/constants.h mode change 100755 => 100644 lc3plus/cutoff_bandwidth.c mode change 100755 => 100644 lc3plus/dct4.c mode change 100755 => 100644 lc3plus/dec_entropy.c mode change 100755 => 100644 lc3plus/dec_lc3_fl.c mode change 100755 => 100644 lc3plus/defines.h mode change 100755 => 100644 lc3plus/detect_cutoff_warped.c mode change 100755 => 100644 lc3plus/enc_entropy.c mode change 100755 => 100644 lc3plus/enc_lc3_fl.c mode change 100755 => 100644 lc3plus/estimate_global_gain.c mode change 100755 => 100644 lc3plus/fft/cfft.c mode change 100755 => 100644 lc3plus/fft/cfft.h mode change 100755 => 100644 lc3plus/fft/fft_15_16.h mode change 100755 => 100644 lc3plus/fft/fft_240_480.h mode change 100755 => 100644 lc3plus/fft/fft_2_9.h mode change 100755 => 100644 lc3plus/fft/fft_32.h mode change 100755 => 100644 lc3plus/fft/fft_384_768.h mode change 100755 => 100644 lc3plus/fft/fft_60_128.h mode change 100755 => 100644 lc3plus/fft/fft_generic.h mode change 100755 => 100644 lc3plus/fft/iis_fft.c mode change 100755 => 100644 lc3plus/fft/iis_fft.h mode change 100755 => 100644 lc3plus/fft/iisfft.c mode change 100755 => 100644 lc3plus/fft/iisfft.h mode change 100755 => 100644 lc3plus/functions.h mode change 100755 => 100644 lc3plus/imdct.c mode change 100755 => 100644 lc3plus/lc3.c mode change 100755 => 100644 lc3plus/lc3.h mode change 100755 => 100644 lc3plus/license.h mode change 100755 => 100644 lc3plus/ltpf_coder.c mode change 100755 => 100644 lc3plus/ltpf_decoder.c delete mode 100755 lc3plus/makefile mode change 100755 => 100644 lc3plus/mdct.c mode change 100755 => 100644 lc3plus/mdct_shaping.c delete mode 100644 lc3plus/msvc/.gitignore delete mode 100755 lc3plus/msvc/LC3plus.sln delete mode 100755 lc3plus/msvc/LC3plus.vcxproj mode change 100755 => 100644 lc3plus/near_nyquist_detector.c mode change 100755 => 100644 lc3plus/noise_factor.c mode change 100755 => 100644 lc3plus/noise_filling.c mode change 100755 => 100644 lc3plus/olpa.c mode change 100755 => 100644 lc3plus/pc_apply.c mode change 100755 => 100644 lc3plus/pc_classify.c mode change 100755 => 100644 lc3plus/pc_main.c mode change 100755 => 100644 lc3plus/pc_update.c mode change 100755 => 100644 lc3plus/per_band_energy.c mode change 100755 => 100644 lc3plus/plc_classify.c mode change 100755 => 100644 lc3plus/plc_compute_stab_fac.c mode change 100755 => 100644 lc3plus/plc_damping_scrambling.c mode change 100755 => 100644 lc3plus/plc_main.c mode change 100755 => 100644 lc3plus/plc_noise_substitution.c mode change 100755 => 100644 lc3plus/plc_noise_substitution0.c mode change 100755 => 100644 lc3plus/plc_phecu_f0_refine_first.c mode change 100755 => 100644 lc3plus/plc_phecu_fec_hq.c mode change 100755 => 100644 lc3plus/plc_phecu_hq_ecu.c mode change 100755 => 100644 lc3plus/plc_phecu_lf_peak_analysis.c mode change 100755 => 100644 lc3plus/plc_phecu_rec_frame.c mode change 100755 => 100644 lc3plus/plc_phecu_setf0hz.c mode change 100755 => 100644 lc3plus/plc_phecu_spec_ana.c mode change 100755 => 100644 lc3plus/plc_phecu_subst_spec.c mode change 100755 => 100644 lc3plus/plc_phecu_tba_per_band_gain.c mode change 100755 => 100644 lc3plus/plc_phecu_tba_spect_Xavg.c mode change 100755 => 100644 lc3plus/plc_phecu_tba_trans_dect_gains.c mode change 100755 => 100644 lc3plus/plc_phecu_trans_burst_ana_sub.c mode change 100755 => 100644 lc3plus/plc_tdc.c mode change 100755 => 100644 lc3plus/plc_tdc_tdac.c mode change 100755 => 100644 lc3plus/plc_update.c mode change 100755 => 100644 lc3plus/quantize_spec.c mode change 100755 => 100644 lc3plus/reorder_bitstream.c mode change 100755 => 100644 lc3plus/resamp12k8.c mode change 100755 => 100644 lc3plus/residual_coding.c mode change 100755 => 100644 lc3plus/residual_decoding.c mode change 100755 => 100644 lc3plus/setup_com_lc3.c mode change 100755 => 100644 lc3plus/setup_dec_lc3.c mode change 100755 => 100644 lc3plus/setup_dec_lc3.h mode change 100755 => 100644 lc3plus/setup_enc_lc3.c mode change 100755 => 100644 lc3plus/setup_enc_lc3.h mode change 100755 => 100644 lc3plus/sns_compute_scf.c mode change 100755 => 100644 lc3plus/sns_interpolate_scf.c mode change 100755 => 100644 lc3plus/sns_quantize_scf.c mode change 100755 => 100644 lc3plus/structs.h delete mode 100755 lc3plus/tinywavein_c.h delete mode 100755 lc3plus/tinywaveout_c.h mode change 100755 => 100644 lc3plus/tns_coder.c mode change 100755 => 100644 lc3plus/tns_decoder.c mode change 100755 => 100644 lc3plus/util.h diff --git a/lc3plus/adjust_global_gain.c b/lc3plus/adjust_global_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/al_fec_fl.c b/lc3plus/al_fec_fl.c old mode 100755 new mode 100644 diff --git a/lc3plus/apply_global_gain.c b/lc3plus/apply_global_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/ari_codec.c b/lc3plus/ari_codec.c old mode 100755 new mode 100644 diff --git a/lc3plus/attack_detector.c b/lc3plus/attack_detector.c old mode 100755 new mode 100644 diff --git a/lc3plus/clib.h b/lc3plus/clib.h old mode 100755 new mode 100644 diff --git a/lc3plus/constants.c b/lc3plus/constants.c old mode 100755 new mode 100644 diff --git a/lc3plus/constants.h b/lc3plus/constants.h old mode 100755 new mode 100644 diff --git a/lc3plus/cutoff_bandwidth.c b/lc3plus/cutoff_bandwidth.c old mode 100755 new mode 100644 diff --git a/lc3plus/dct4.c b/lc3plus/dct4.c old mode 100755 new mode 100644 diff --git a/lc3plus/dec_entropy.c b/lc3plus/dec_entropy.c old mode 100755 new mode 100644 diff --git a/lc3plus/dec_lc3_fl.c b/lc3plus/dec_lc3_fl.c old mode 100755 new mode 100644 diff --git a/lc3plus/defines.h b/lc3plus/defines.h old mode 100755 new mode 100644 diff --git a/lc3plus/detect_cutoff_warped.c b/lc3plus/detect_cutoff_warped.c old mode 100755 new mode 100644 diff --git a/lc3plus/enc_entropy.c b/lc3plus/enc_entropy.c old mode 100755 new mode 100644 diff --git a/lc3plus/enc_lc3_fl.c b/lc3plus/enc_lc3_fl.c old mode 100755 new mode 100644 diff --git a/lc3plus/estimate_global_gain.c b/lc3plus/estimate_global_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/cfft.c b/lc3plus/fft/cfft.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/cfft.h b/lc3plus/fft/cfft.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_15_16.h b/lc3plus/fft/fft_15_16.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_240_480.h b/lc3plus/fft/fft_240_480.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_2_9.h b/lc3plus/fft/fft_2_9.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_32.h b/lc3plus/fft/fft_32.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_384_768.h b/lc3plus/fft/fft_384_768.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_60_128.h b/lc3plus/fft/fft_60_128.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/fft_generic.h b/lc3plus/fft/fft_generic.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iis_fft.c b/lc3plus/fft/iis_fft.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iis_fft.h b/lc3plus/fft/iis_fft.h old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iisfft.c b/lc3plus/fft/iisfft.c old mode 100755 new mode 100644 diff --git a/lc3plus/fft/iisfft.h b/lc3plus/fft/iisfft.h old mode 100755 new mode 100644 diff --git a/lc3plus/functions.h b/lc3plus/functions.h old mode 100755 new mode 100644 diff --git a/lc3plus/imdct.c b/lc3plus/imdct.c old mode 100755 new mode 100644 diff --git a/lc3plus/lc3.c b/lc3plus/lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/lc3.h b/lc3plus/lc3.h old mode 100755 new mode 100644 diff --git a/lc3plus/license.h b/lc3plus/license.h old mode 100755 new mode 100644 diff --git a/lc3plus/ltpf_coder.c b/lc3plus/ltpf_coder.c old mode 100755 new mode 100644 diff --git a/lc3plus/ltpf_decoder.c b/lc3plus/ltpf_decoder.c old mode 100755 new mode 100644 diff --git a/lc3plus/makefile b/lc3plus/makefile deleted file mode 100755 index 16758fc306..0000000000 --- a/lc3plus/makefile +++ /dev/null @@ -1,143 +0,0 @@ -# GNU Makefile - -# Options -AFL = 0 -CLANG = 0 -GCOV = 0 -NO_POST_REL_CHANGES_TEST = 0 -OPTIM = 0 - -# Paths -VPATH = . -BUILD = build -CC = gcc -LINK = $(CC) - -# Binary Name -NAME_LC3 = LC3plus -# Shared Library Name -LIB_LC3 = libLC3plus.so - -# Default tool settings -CC = gcc -RM = rm -f - -# Preprocessor(-I/-D) / Compiler / Linker flags -CFLAGS += -std=c99 -fPIC \ - -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ - -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Werror-implicit-function-declaration - -LDFLAGS += -lm -g -# Include dependency flags -DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD)/$*.Td - -ifneq "$(DEBUG)" "0" - CFLAGS += -g3 - LDFLAGS += -g3 -endif - -ifeq "$(GCOV)" "1" - CFLAGS += -fprofile-arcs -ftest-coverage - LDFLAGS += -fprofile-arcs -ftest-coverage -endif - -OPTIM ?= 0 -CFLAGS += -O$(OPTIM) -CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) - -ifeq "$(NO_POST_REL_CHANGES_TEST)" "1" -CFLAGS += -DNO_POST_REL_CHANGES -endif - -# memory sanitizer, find use of uninitialized memory -ifeq "$(CLANG)" "1" - CC = clang - CFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer - LDFLAGS += -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer - OPTIM = 2 -endif - -# address sanitizer, find buffer overflows -ifeq "$(CLANG)" "2" - CC = clang - CFLAGS += -fsanitize=address -fno-omit-frame-pointer - LDFLAGS += -fsanitize=address -fno-omit-frame-pointer - OPTIM = 2 -endif - -# undefined behavior sanitizer, find bugs like integer overflows -ifeq "$(CLANG)" "3" - CC = clang - CFLAGS += -fsanitize=undefined - LDFLAGS += -fsanitize=undefined - OPTIM = 2 -endif - -# for code coverate test -ifeq "$(GCOV)" "1" - CFLAGS += -fprofile-arcs -ftest-coverage - LDFLAGS += -fprofile-arcs -ftest-coverage -endif - -# verbose output -ifneq "$(VERBOSE)" "1" - QUIET = @ -endif - -# dependency magic -CC_FLAGS = '$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)' -POSTCOMPILE = mv -f $(BUILD)/$*.Td $(BUILD)/$*.d && touch $@ - -######## Generate source / object lists ######## - -SRCS := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) -SRCS_LIB := $(notdir $(foreach DIR, $(VPATH), $(wildcard $(DIR)/*.c))) -OBJS := $(addprefix $(BUILD)/, $(SRCS:.c=.o)) - -LIBSRCS := $(filter-out $(DIR)/ccConvert.c $(DIR)/codec_exe.c, $(SRCS)) -LIBOBJS := $(addprefix $(BUILD)/, $(LIBSRCS:.c=.o)) - -.PHONY: all clean help force - -.PRECIOUS: $(BUILD)/%.d - -all: $(NAME_LC3) - -help: - @echo 'Targets:' - @echo ' $(NAME_LC3) (default)' - @echo ' $(LIB_LC3)' - @echo 'Syntax: make [OPTION=VALUE ...]' - @echo 'Build options:' - @echo ' NO_POST_REL_CHANGES_TEST $(NO_POST_REL_CHANGES_TEST) [0,1]' - @echo ' OPTIM $(OPTIM) [0-3]' - @echo 'Debug options:' - @echo ' AFL $(AFL) [0,1]' - @echo ' CLANG $(CLANG) [0-3]' - @echo ' GCOV $(GCOV) [0,1]' - -$(NAME_LC3): $(OBJS) - @echo 'Linking' $@ - $(QUIET) $(LINK) $(OBJS) -o $@ $(LDFLAGS) - -$(LIB_LC3): $(LIBOBJS) - @echo 'Linking' $@ - $(QUIET) $(LINK) --shared $(OBJS) -o $@ $(LDFLAGS) - -clean: - $(QUIET) rm -rf $(NAME_LC3) $(LIB_LC3) $(BUILD) ccConvert - -$(BUILD)/%.o : %.c $(BUILD)/cc_flags - @echo 'Compiling' $< - $(QUIET) $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - $(QUIET) $(POSTCOMPILE) - -# force rebuild if compilation flags changed -$(BUILD)/cc_flags: force - $(QUIET) mkdir -p $(BUILD) - $(QUIET) echo $(CC_FLAGS) | cmp -s - $@ || echo $(CC_FLAGS) > $@ - -# force rebuild if include dependency changed -$(BUILD)/%.d: ; -include $(wildcard $(patsubst %, $(BUILD)/%.d, $(basename $(SRCS)))) diff --git a/lc3plus/mdct.c b/lc3plus/mdct.c old mode 100755 new mode 100644 diff --git a/lc3plus/mdct_shaping.c b/lc3plus/mdct_shaping.c old mode 100755 new mode 100644 diff --git a/lc3plus/msvc/.gitignore b/lc3plus/msvc/.gitignore deleted file mode 100644 index f40a919a54..0000000000 --- a/lc3plus/msvc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Win32/ \ No newline at end of file diff --git a/lc3plus/msvc/LC3plus.sln b/lc3plus/msvc/LC3plus.sln deleted file mode 100755 index a8ee38ea81..0000000000 --- a/lc3plus/msvc/LC3plus.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.168 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LC3_FL", "LC3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x64.Build.0 = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.ActiveCfg = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Debug|x86.Build.0 = Debug|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.ActiveCfg = Release|x64 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x64.Build.0 = Release|x64 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.ActiveCfg = Release|Win32 - {95030B82-70CD-4C6B-84D4-61096035BEA2}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/lc3plus/msvc/LC3plus.vcxproj b/lc3plus/msvc/LC3plus.vcxproj deleted file mode 100755 index ffbfdf344b..0000000000 --- a/lc3plus/msvc/LC3plus.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {95030B82-70CD-4C6B-84D4-61096035BEA2} - Win32Proj - LC3_FL - 10.0.17763.0 - - - - StaticLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - true - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - false - LC3plus - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\Obj\ - - - - - - Level3 - ..\..\lib_com;%(AdditionalIncludeDirectories) - Disabled - MultiThreadedDebug - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - 4305;4244;4996 - - - Console - true - - - - - Level3 - - - ..\..\lib_com;%(AdditionalIncludeDirectories) - MaxSpeed - MultiThreaded - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - 4244;4305;4996 - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lc3plus/near_nyquist_detector.c b/lc3plus/near_nyquist_detector.c old mode 100755 new mode 100644 diff --git a/lc3plus/noise_factor.c b/lc3plus/noise_factor.c old mode 100755 new mode 100644 diff --git a/lc3plus/noise_filling.c b/lc3plus/noise_filling.c old mode 100755 new mode 100644 diff --git a/lc3plus/olpa.c b/lc3plus/olpa.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_apply.c b/lc3plus/pc_apply.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_classify.c b/lc3plus/pc_classify.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_main.c b/lc3plus/pc_main.c old mode 100755 new mode 100644 diff --git a/lc3plus/pc_update.c b/lc3plus/pc_update.c old mode 100755 new mode 100644 diff --git a/lc3plus/per_band_energy.c b/lc3plus/per_band_energy.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_classify.c b/lc3plus/plc_classify.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_compute_stab_fac.c b/lc3plus/plc_compute_stab_fac.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_damping_scrambling.c b/lc3plus/plc_damping_scrambling.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_main.c b/lc3plus/plc_main.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_noise_substitution.c b/lc3plus/plc_noise_substitution.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_noise_substitution0.c b/lc3plus/plc_noise_substitution0.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_f0_refine_first.c b/lc3plus/plc_phecu_f0_refine_first.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_fec_hq.c b/lc3plus/plc_phecu_fec_hq.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_hq_ecu.c b/lc3plus/plc_phecu_hq_ecu.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_lf_peak_analysis.c b/lc3plus/plc_phecu_lf_peak_analysis.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_rec_frame.c b/lc3plus/plc_phecu_rec_frame.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_setf0hz.c b/lc3plus/plc_phecu_setf0hz.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_spec_ana.c b/lc3plus/plc_phecu_spec_ana.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_subst_spec.c b/lc3plus/plc_phecu_subst_spec.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_tba_per_band_gain.c b/lc3plus/plc_phecu_tba_per_band_gain.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_tba_spect_Xavg.c b/lc3plus/plc_phecu_tba_spect_Xavg.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_tba_trans_dect_gains.c b/lc3plus/plc_phecu_tba_trans_dect_gains.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_phecu_trans_burst_ana_sub.c b/lc3plus/plc_phecu_trans_burst_ana_sub.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_tdc.c b/lc3plus/plc_tdc.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_tdc_tdac.c b/lc3plus/plc_tdc_tdac.c old mode 100755 new mode 100644 diff --git a/lc3plus/plc_update.c b/lc3plus/plc_update.c old mode 100755 new mode 100644 diff --git a/lc3plus/quantize_spec.c b/lc3plus/quantize_spec.c old mode 100755 new mode 100644 diff --git a/lc3plus/reorder_bitstream.c b/lc3plus/reorder_bitstream.c old mode 100755 new mode 100644 diff --git a/lc3plus/resamp12k8.c b/lc3plus/resamp12k8.c old mode 100755 new mode 100644 diff --git a/lc3plus/residual_coding.c b/lc3plus/residual_coding.c old mode 100755 new mode 100644 diff --git a/lc3plus/residual_decoding.c b/lc3plus/residual_decoding.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_com_lc3.c b/lc3plus/setup_com_lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_dec_lc3.c b/lc3plus/setup_dec_lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_dec_lc3.h b/lc3plus/setup_dec_lc3.h old mode 100755 new mode 100644 diff --git a/lc3plus/setup_enc_lc3.c b/lc3plus/setup_enc_lc3.c old mode 100755 new mode 100644 diff --git a/lc3plus/setup_enc_lc3.h b/lc3plus/setup_enc_lc3.h old mode 100755 new mode 100644 diff --git a/lc3plus/sns_compute_scf.c b/lc3plus/sns_compute_scf.c old mode 100755 new mode 100644 diff --git a/lc3plus/sns_interpolate_scf.c b/lc3plus/sns_interpolate_scf.c old mode 100755 new mode 100644 diff --git a/lc3plus/sns_quantize_scf.c b/lc3plus/sns_quantize_scf.c old mode 100755 new mode 100644 diff --git a/lc3plus/structs.h b/lc3plus/structs.h old mode 100755 new mode 100644 diff --git a/lc3plus/tinywavein_c.h b/lc3plus/tinywavein_c.h deleted file mode 100755 index c7bd58593c..0000000000 --- a/lc3plus/tinywavein_c.h +++ /dev/null @@ -1,605 +0,0 @@ -/****************************************************************************** -* ETSI TS 103 634 V1.4.1 * -* Low Complexity Communication Codec Plus (LC3plus) * -* * -* Copyright licence is solely granted through ETSI Intellectual Property * -* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -* estoppel or otherwise. * -******************************************************************************/ - - -#ifndef __TINYWAVEIN_C_H__ -#define __TINYWAVEIN_C_H__ - -/*#define SUPPORT_BWF*/ - -#include -#include -#include - - -#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ - defined(__aarch64__) -#define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ -#endif - -#if defined(__POWERPC__) -#define __TWI_BE /* _T_iny _W_ave _I_n _B_ig _E_ndian */ -#endif - -#if !defined(__TWI_LE) && !defined(__TWI_BE) -#error unknown processor -#endif - -#define __TWI_SUCCESS (0) -#define __TWI_ERROR (-1) - -#ifdef SUPPORT_BWF -typedef struct -{ - float loudnessVal; - float loudnessRange; - float maxTruePeakLevel; - float maxMomentaryLoudnes; - float maxShortTermLoudness; -} WAVEIN_LOUDNESSINFO; -#endif - -typedef struct __tinyWaveInHandle -{ - FILE * theFile; - fpos_t dataChunkPos; - unsigned int position; - unsigned int length; - unsigned int bps; -#ifdef SUPPORT_BWF - WAVEIN_LOUDNESSINFO *loudnessInfo; -#endif -} __tinyWaveInHandle, WAVEFILEIN; - -typedef struct -{ - short compressionCode; - short numberOfChannels; - unsigned int sampleRate; - unsigned int averageBytesPerSecond; - short blockAlign; - short bitsPerSample; - /* short extraFormatBytes ; */ -} SWavInfo; - -#ifdef SUPPORT_BWF -typedef struct -{ - unsigned char description[256]; - unsigned char originator[32]; - unsigned char originatorReference[32]; - unsigned char originatorDate[10]; /* ASCII: <> */ - unsigned char originationTime[8]; /* ASCII: <> */ - unsigned int timeReferenceLow; - unsigned int timeReferenceHigh; - unsigned short version; - unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ - - signed short loudnessVal; - signed short loudnessRange; - signed short maxTruePeakLevel; - signed short maxMomentaryLoudnes; - signed short maxShortTermLoudness; - - unsigned char Reserved[180]; - - unsigned char codingHistory; /* ASCII: <> */ -} SBwfWav; -#endif - -typedef struct -{ - char chunkID[4]; - unsigned int chunkSize; - /* long dataOffset ; */ /* never used */ -} SChunk; - -/* local wrapper, always returns correct endian */ -static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream); - -#ifdef __TWI_BE -static short BigEndian16(short v); -static int BigEndian32(int v); -#endif - -/*! - * \brief Read header from a WAVEfile. Host endianess is handled accordingly. - * \fp filepointer of type FILE*. - * \wavinfo SWavInfo struct where the decoded header info is stored into. - * \return 0 on success and non-zero on failure. - * - */ -static WAVEFILEIN *OpenWav(const char *filename, unsigned int *samplerate, short *channels, unsigned int *samplesInFile, - short *bps) -{ - WAVEFILEIN *self; - - SChunk fmt_chunk, data_chunk; - int offset; - unsigned int tmpSize; - char tmpFormat[4]; - SWavInfo wavinfo = {0, 0, 0, 0, 0, 0}; - - self = (WAVEFILEIN *)calloc(1, sizeof(WAVEFILEIN)); - if (!self) - goto bail; /* return NULL; */ - - if (!filename) - goto bail; - if (!samplerate) - goto bail; - if (!channels) - goto bail; - if (!samplesInFile) - goto bail; - if (!bps) - goto bail; - - self->theFile = fopen(filename, "rb"); - if (!self->theFile) - goto bail; - - /* read RIFF-chunk */ - if (fread(tmpFormat, 1, 4, self->theFile) != 4) - { - goto bail; - } - - if (strncmp("RIFF", tmpFormat, 4)) - { - goto bail; - } - - /* Read RIFF size. Ignored. */ - fread_LE(&tmpSize, 4, 1, self->theFile); - - /* read WAVE-chunk */ - if (fread(tmpFormat, 1, 4, self->theFile) != 4) - { - goto bail; - } - - if (strncmp("WAVE", tmpFormat, 4)) - { - goto bail; - } - - /* read format/bext-chunk */ - if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - -#ifdef SUPPORT_BWF - /* test for bext-chunk */ - if (!strncmp("bext", fmt_chunk.chunkID, 4)) - { - /*unsigned int i;*/ - unsigned int bextSize = 0; - - if (fread_LE(&bextSize, 1, 4, self->theFile) != 4) - { - goto bail; - } - - self->loudnessInfo = (WAVEIN_LOUDNESSINFO *)calloc(1, sizeof(WAVEIN_LOUDNESSINFO)); - - if (bextSize >= 602) - { /* minimum size bext-data, w/o 'CodingHistory' */ - int i; - signed short readBuf = 0; - signed int nulbuf = 0; - - /* first skip all descriptive data */ - for (i = 0; i < 412; i++) - { - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - bextSize -= 1; - } - /* second, read loudness data */ - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->loudnessVal = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->loudnessRange = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->maxTruePeakLevel = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->maxMomentaryLoudnes = (float)readBuf * 0.01f; - - fread_LE(&readBuf, 2, 1, self->theFile); - bextSize -= 2; - self->loudnessInfo->maxShortTermLoudness = (float)readBuf * 0.01f; - - /* skip reserved data */ - for (i = 0; i < 180; i++) - { - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - bextSize -= 1; - } - } - - /* skip remaining data */ - while (bextSize) - { - int nulbuf; - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - bextSize -= 1; - } - - /* read next chunk header */ - if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - } -#endif - - /* skip some potential chunks up to fmt chunk */ - - while (strncmp("fmt ", fmt_chunk.chunkID, 4) != 0) - { - unsigned int chunkSize = 0; - - if (fread_LE(&chunkSize, 1, 4, self->theFile) != 4) - { - goto bail; - } - - /* skip chunk data */ - while (chunkSize) - { - int nulbuf; - if (fread_LE(&nulbuf, 1, 1, self->theFile) != 1) - { - goto bail; - } - chunkSize -= 1; - } - - /* read next chunk header */ - if (fread(fmt_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - } - - /* go on with fmt-chunk */ - if (strncmp("fmt ", fmt_chunk.chunkID, 4)) - { - goto bail; - } - - if (fread_LE(&fmt_chunk.chunkSize, 4, 1, self->theFile) != 1) - { /* should be 16 for PCM-format (uncompressed) */ - goto bail; - } - - - /* read info */ - fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); - fread_LE(&(wavinfo.numberOfChannels), 2, 1, self->theFile); - fread_LE(&(wavinfo.sampleRate), 4, 1, self->theFile); - fread_LE(&(wavinfo.averageBytesPerSecond), 4, 1, self->theFile); - fread_LE(&(wavinfo.blockAlign), 2, 1, self->theFile); - fread_LE(&(wavinfo.bitsPerSample), 2, 1, self->theFile); - - if (wavinfo.compressionCode == -2) - { - fseek(self->theFile, 8, SEEK_CUR); // skip channel mask - fread_LE(&(wavinfo.compressionCode), 2, 1, self->theFile); // part of GUID - fseek(self->theFile, 14, SEEK_CUR); // skip rest of GUID - offset = fmt_chunk.chunkSize - 40; - } - else - offset = fmt_chunk.chunkSize - 16; - - if (wavinfo.compressionCode == 0x01) - { - if ((wavinfo.bitsPerSample != 16) && (wavinfo.bitsPerSample != 24) && (wavinfo.bitsPerSample != 32)) - /* we do only support 16,24 and 32 bit PCM audio */ - goto bail; - } - else - { - /* if(wavinfo.bitsPerSample != 32) */ - printf("compressioncode: %02x\n", wavinfo.compressionCode); - puts("Error! We only support 16,24 and 32 bit PCM audio"); - exit(1); - goto bail; - } - - /* Skip rest of fmt header if any. */ - for (; offset > 0; offset--) - { - fread(&tmpSize, 1, 1, self->theFile); - } - - do - { - - /* Read data chunk ID */ - if (fread(data_chunk.chunkID, 1, 4, self->theFile) != 4) - { - goto bail; - } - - /* Read chunk length. */ - - if (fread_LE(&offset, 4, 1, self->theFile) != 1) - { - goto bail; - } - - /* Check for data chunk signature. */ - if (strncmp("data", data_chunk.chunkID, 4) == 0) - { - data_chunk.chunkSize = offset; - break; - } - - /* unused 1 byte present, if size is odd */ - /* see https://www.daubnet.com/en/file-format-riff */ - if (offset % 2) - { - offset++; - } - - /* Jump over non data chunk. */ - for (; offset > 0; offset--) - { - fread(&tmpSize, 1, 1, self->theFile); - } - - } while (!feof(self->theFile)); - - /* success so far */ - *samplerate = wavinfo.sampleRate; - *channels = wavinfo.numberOfChannels; - *samplesInFile = data_chunk.chunkSize / wavinfo.numberOfChannels; - *samplesInFile /= ((wavinfo.bitsPerSample + 7) / 8); - *bps = wavinfo.bitsPerSample; - - self->position = 0; - self->bps = wavinfo.bitsPerSample; - self->length = *samplesInFile * wavinfo.numberOfChannels; - - fgetpos(self->theFile, &self->dataChunkPos); - - return self; - -bail: - free(self); - return NULL; -} - -#ifdef SUPPORT_BWF -static void ReadBWF(WAVEFILEIN *self, WAVEIN_LOUDNESSINFO **wavInLoudness) -{ - *wavInLoudness = self->loudnessInfo; -} -#endif - -static int __ReadSample16(WAVEFILEIN *self, int *sample) -{ - size_t cnt; - short v = 0; - - cnt = fread(&v, 2, 1, self->theFile); - - if (cnt != 1) - { - return __TWI_ERROR; - } - - self->position += 1; - -#ifdef __TWI_BE - v = BigEndian16(v); -#endif - *sample = v; - return __TWI_SUCCESS; -} - -static int __ReadSample24(WAVEFILEIN *self, int *sample) -{ - size_t cnt; - int v = 0; - - cnt = fread(&v, 3, 1, self->theFile); - - if (cnt != 1) - { - return __TWI_ERROR; - } - - self->position += 1; - -#ifdef __TWI_BE - v = BigEndian32(v); -#endif - - if (v >= 0x800000) - { - v |= 0xff000000; - } - - *sample = v; - - return __TWI_SUCCESS; -} - -static int __ReadSample32(WAVEFILEIN *self, int *sample) -{ - size_t cnt; - int v = 0; - - cnt = fread(&v, 4, 1, self->theFile); - - if (cnt != 1) - { - return __TWI_ERROR; - } - - self->position += 1; - -#ifdef __TWI_BE - v = BigEndian32(v); -#endif - - *sample = v >> 8; - - return __TWI_SUCCESS; -} - -static int __ReadSampleInternal(WAVEFILEIN *self, int *sample, int scale) -{ - int err; - - if (!self) - { - return __TWI_ERROR; - } - - switch (scale) - { - - case 16: err = __ReadSample16(self, sample); break; - - case 24: err = __ReadSample24(self, sample); break; - - case 32: err = __ReadSample32(self, sample); break; - - default: err = __TWI_ERROR; break; - } - - return err; -} - -/* this function returns normalized values in the range +8388607..-8388608 */ -static int ReadWavInt(WAVEFILEIN *self, int sampleBuffer[], unsigned int nSamplesToRead, unsigned int *nSamplesRead) -{ - unsigned int i; - int err = __TWI_SUCCESS; - *nSamplesRead = 0; - - if (!sampleBuffer) - { - return __TWI_ERROR; - } - - /* check if we have enough samples left, if not, - set nSamplesToRead to number of samples left. */ - if (self->position + nSamplesToRead > self->length) - { - nSamplesToRead = self->length - self->position; - } - - for (i = 0; i < nSamplesToRead; i++) - { - - int tmp; - err = __ReadSampleInternal(self, &tmp, self->bps); - if (err != __TWI_SUCCESS) - { - return err; - } - sampleBuffer[i] = tmp; - *nSamplesRead += 1; - } - - return __TWI_SUCCESS; -} - -static int CloseWavIn(WAVEFILEIN *self) -{ - if (self) - { - if (self->theFile) - { - fclose(self->theFile); - } - } - free(self); - - return __TWI_SUCCESS; -} -/* -static int ResetWavIn(WAVEFILEIN* self) -{ - if (self) { - if (self->theFile) { - fsetpos(self->theFile, &self->dataChunkPos); - self->position = 0; - } - } - return __TWI_SUCCESS; -} -*/ -/*------------- local subs ----------------*/ - -static size_t fread_LE(void *ptr, size_t size, size_t nmemb, FILE *stream) -{ -#ifdef __TWI_LE - return fread(ptr, size, nmemb, stream); -#endif -#ifdef __TWI_BE - - unsigned char x[sizeof(int)]; - unsigned char *y = (unsigned char *)ptr; - int i; - int len; - - len = fread(x, size, nmemb, stream); - - for (i = 0; i < size * nmemb; i++) - { - *y++ = x[size * nmemb - i - 1]; - } - - return len; -#endif -} - -#ifdef __TWI_BE -static short BigEndian16(short v) -{ - short a = (v & 0x0ff); - short b = (v & 0x0ff00) >> 8; - - return a << 8 | b; -} - -static int BigEndian32(int v) -{ - int a = (v & 0x0ff); - int b = (v & 0x0ff00) >> 8; - int c = (v & 0x0ff0000) >> 16; - int d = (v & 0xff000000) >> 24; - - return a << 24 | b << 16 | c << 8 | d; -} -#endif - -#endif /* __TINYWAVEIN_C_H__ */ diff --git a/lc3plus/tinywaveout_c.h b/lc3plus/tinywaveout_c.h deleted file mode 100755 index 323b09d51c..0000000000 --- a/lc3plus/tinywaveout_c.h +++ /dev/null @@ -1,892 +0,0 @@ -/****************************************************************************** -* ETSI TS 103 634 V1.4.1 * -* Low Complexity Communication Codec Plus (LC3plus) * -* * -* Copyright licence is solely granted through ETSI Intellectual Property * -* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -* estoppel or otherwise. * -******************************************************************************/ - - - - -#ifndef __TINYWAVEOUT_C_H__ -#define __TINYWAVEOUT_C_H__ - -/*#define TWO_SUPPORT_BWF*/ - -#include -#include -#include -#include -#ifdef TWO_SUPPORT_BWF -#include -#endif - -/***** Interface *********************************************************/ - -#ifndef TWO_UINT64 - #if !(defined(WIN32)) - #include - #define TWO_UINT64 uint64_t - #else - #define TWO_UINT64 unsigned __int64 - #endif -#endif - -typedef struct WAVEFILEOUT WAVEFILEOUT; -#ifdef TWO_SUPPORT_BWF -typedef struct WAVEOUT_LOUDNESSINFO WAVEOUT_LOUDNESSINFO; -#endif - -#define __TWO_SUCCESS (0) -#define __TWO_ERROR (-1) - -static WAVEFILEOUT* CreateWav( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps - ); - -#ifdef TWO_SUPPORT_BWF -static WAVEFILEOUT* CreateWavBWF( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps, - const WAVEOUT_LOUDNESSINFO *hBwfData - ); -#endif - -/* this function expects values in the 16 bit range +32767..-32768 */ -static int WriteWavShort( - WAVEFILEOUT* self, - short sampleBuffer[], - unsigned int nSamples - ); - -/* this function expects values in the 24 bit range +8388607..-8388608 */ -static int WriteWavLong( - WAVEFILEOUT* self, - int sampleBuffer[], - unsigned int nSamples - ); - -/* this function expects normalized values in the range +-1.0f */ -static int WriteWavFloat( - WAVEFILEOUT* self, - float sampleBuffer[], - unsigned int nSamples - ); - -static int CloseWav(WAVEFILEOUT* self); -#ifdef TWO_SUPPORT_BWF -static int CloseWavBWF(WAVEFILEOUT* self, WAVEOUT_LOUDNESSINFO bextData); -#endif - -/***** Implementation *********************************************************/ - -#if defined (__i386__) || defined (_M_IX86) || defined (_M_X64) || defined (__x86_64__) || defined (__arm__) || defined (__xtensa__) || defined (__aarch64__) || defined (__EMSCRIPTEN__) -#define __TWO_LE /* _T_iny _W_ave _O_ut _L_ittle _E_ndian */ -#endif - -#if defined (__POWERPC__) -#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ -#endif - -#if defined (__sparc__) -#define __TWO_BE /* _T_iny _W_ave _O_ut _B_ig _E_ndian */ -#endif - -#if ! defined (__TWO_LE) && ! defined (__TWO_BE) -#error unknown processor -#endif - -/*--- local types/structs ----------------------------------*/ - -#if defined(_MSC_VER) - #pragma pack(push, 1) -#else - #pragma pack(1) -#endif - - -#ifdef TWO_SUPPORT_BWF -struct WAVEOUT_LOUDNESSINFO { - float loudnessVal; - float loudnessRange; - float maxTruePeakLevel; - float maxMomentaryLoudnes; - float maxShortTermLoudness; -}; -#endif - - -typedef struct __tinyWaveOutHeader -{ - unsigned int riffType; /* 'RIFF/RF64' */ - unsigned int riffSize; /* file size/-1 */ - unsigned int waveType; /* 'WAVE' */ -} __tinyWaveOutHeader; - -typedef struct __tinyWaveOutDs64Chunk -{ - unsigned int formatType; /* = 'JUNK/ds64' */ - unsigned int formatSize; /* size info */ - TWO_UINT64 riffSize64; - TWO_UINT64 dataSize64; - TWO_UINT64 sampleCount64; - unsigned int tableLength; /* optional tables, always 0 for tinywaveout */ - /* here: optional tables */ -} __tinyWaveOutDs64Chunk; - -#ifdef TWO_SUPPORT_BWF -typedef struct __tinyWaveOutBextChunk -{ - unsigned int formatType; /* = 'bext' */ - unsigned int formatSize; /* size info */ - - unsigned char description[256]; - unsigned char originator[32]; - unsigned char originatorReference[32]; - unsigned char originatorDate[10]; /* ASCII: <> */ - unsigned char originationTime[8]; /* ASCII: <> */ - unsigned int timeReferenceLow; - unsigned int timeReferenceHigh; - unsigned short version; - unsigned char UMID[64]; /* Binary Bytes of SMPTE UMID */ - - signed short loudnessVal; - signed short loudnessRange; - signed short maxTruePeakLevel; - signed short maxMomentaryLoudnes; - signed short maxShortTermLoudness; - - unsigned char Reserved[180]; - - unsigned char codingHistory; /* ASCII: <> - undefined length! */ - /* for variable length, mve this out of this struct */ -} __tinyWaveOutBextChunk; -#endif - -typedef struct __tinyWaveOutFmtChunk -{ - unsigned int formatType; - unsigned int formatSize; - - unsigned short formatTag; - unsigned short numChannels; - unsigned int sampleRate; - unsigned int bytesPerSecond; - unsigned short blockAlignment; - unsigned short bitsPerSample; - - /* wav fmt ext hdr here */ -} __tinyWaveOutFmtChunk; - -typedef struct __tinyWaveOutDataChunk -{ - unsigned int dataType; - unsigned int dataSize; - -} __tinyWaveOutDataChunk; - - -struct WAVEFILEOUT { - /* for reasons of memory alignment, have 64 bit data types first */ - TWO_UINT64 dataSize; - TWO_UINT64 dataSizeLimit; /* maximum size for data chunk for 4 GB files */ - TWO_UINT64 dataSizeLimit64; /* maximum size for data chunk for 2^64 B addressable files */ - TWO_UINT64 clipCount; - FILE* theFile; - unsigned int junkChunkOffset; - unsigned int fmtChunkOffset; -#ifdef TWO_SUPPORT_BWF - unsigned int bextChunkOffset; -#endif - unsigned int dataChunkOffset; - unsigned int bps; - - /* only needed for RF64: */ - unsigned int blockAlign; /* only needed for close() of ds64 chunk */ -}; - - -/*--- local protos --------------------------------------------------*/ -static __inline unsigned int BigEndian32(char, char, char, char); -static __inline unsigned int LittleEndian32(unsigned int); -static __inline unsigned int LittleEndian32s(int); -static __inline short LittleEndian16(short); -static __inline TWO_UINT64 LittleEndian64(TWO_UINT64); -#ifdef TWO_SUPPORT_BWF -static unsigned int EncodeLoudness(float); -#endif -static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ); - -#if defined(_MSC_VER) - #pragma pack(pop) -#else - #pragma pack() -#endif - - -#ifdef TWO_SUPPORT_BWF -static void setDefaultLoudness(WAVEOUT_LOUDNESSINFO *x) -{ - x->loudnessVal = 1.0f; - x->loudnessRange = 2.0f; - x->maxTruePeakLevel = 3.0f; - x->maxMomentaryLoudnes = 4.0f; - x->maxShortTermLoudness = 5.0f; -} -#endif - -static WAVEFILEOUT* __CreateWavInternal( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps -#ifdef TWO_SUPPORT_BWF - , - const WAVEOUT_LOUDNESSINFO *hBwfData -#endif - ) -{ - WAVEFILEOUT* self = NULL; - __tinyWaveOutHeader whdr; - __tinyWaveOutDs64Chunk ds64ch; -#ifdef TWO_SUPPORT_BWF - __tinyWaveOutBextChunk wbextch; -#endif - __tinyWaveOutFmtChunk wfch; - __tinyWaveOutDataChunk wdch; - unsigned int blockAlignment = 0; - unsigned int ByteCnt = 0; /* Byte counter for fwrite */ - - /* pseudo use to avoid unused symbols */ - (void)WriteWavShort; - (void)WriteWavLong; - (void)WriteWavFloat; -#ifdef TWI_SUPPORT_BWF - (void)CreateWavBWF; - (void)CloseWavBWF; - (void)setDefaultLoudness; -#endif - - /* param check */ - if (!fileName) goto bail; - if (sampleRate == 0) goto bail; - if (sampleRate > 768000) goto bail; - if (numChannels == 0) goto bail; - if (numChannels > 64) goto bail; - if (bps != 16 && bps != 24 && bps != 32) goto bail; - - self = (WAVEFILEOUT*)calloc(1, sizeof(WAVEFILEOUT)); - if (!self) goto bail; /* return NULL; */ - - self->theFile = fopen(fileName, "wb+"); - if (!self->theFile) goto bail; - - /* WAV-Header */ - whdr.riffType = BigEndian32('R','I','F','F'); - whdr.riffSize = LittleEndian32(0xffffffff); /* set to maximum, if fseek() doesn't work later */ - whdr.waveType = BigEndian32('W','A','V','E'); - /* write to file */ - ByteCnt = 0; - ByteCnt += fwrite(&whdr, 1, sizeof(whdr), self->theFile); - - /* ds64/JUNK-Chunk */ - ds64ch.formatType = BigEndian32('J','U','N','K'); - ds64ch.formatSize = LittleEndian32(sizeof(__tinyWaveOutDs64Chunk) - 8); - ds64ch.riffSize64 = (TWO_UINT64) -1; - ds64ch.dataSize64 = (TWO_UINT64) -1; - ds64ch.sampleCount64 = (TWO_UINT64) -1; - ds64ch.tableLength = 0; - self->junkChunkOffset = ByteCnt; - ByteCnt += fwrite(&ds64ch, 1, sizeof(ds64ch), self->theFile); - -#ifdef TWO_SUPPORT_BWF - /* BEXT-Chunk */ - if (hBwfData) { - memset(&wbextch, 0, sizeof(__tinyWaveOutBextChunk)); - wbextch.formatType = BigEndian32('b','e','x','t'); - wbextch.formatSize = LittleEndian32(sizeof(__tinyWaveOutBextChunk) - 8); - wbextch.version = 0x0002; - wbextch.loudnessVal = EncodeLoudness(hBwfData->loudnessVal); - wbextch.loudnessRange = EncodeLoudness(hBwfData->loudnessRange); - wbextch.maxTruePeakLevel = EncodeLoudness(hBwfData->maxTruePeakLevel); - wbextch.maxMomentaryLoudnes = EncodeLoudness(hBwfData->maxMomentaryLoudnes); - wbextch.maxShortTermLoudness = EncodeLoudness(hBwfData->maxShortTermLoudness); - /* t.b.d.: more values */ - - /* write to file */ - self->bextChunkOffset = ByteCnt; - ByteCnt += fwrite(&wbextch, 1, sizeof(wbextch), self->theFile); - } -#endif - - /* FMT-Chunk */ - wfch.formatType = BigEndian32('f','m','t',' '); - wfch.formatSize = LittleEndian32(16); - switch (bps) { - case 16: - case 24: - wfch.formatTag = LittleEndian16(0x0001); /* WAVE_FORMAT_PCM */ - break; - case 32: - wfch.formatTag = LittleEndian16(0x0003); /* WAVE_FORMAT_IEEE_FLOAT */ - break; - default: - goto bail; - } - self->bps = bps; - wfch.bitsPerSample = LittleEndian16(bps); - wfch.numChannels = LittleEndian16(numChannels); - blockAlignment = numChannels * (bps >> 3); - wfch.blockAlignment = LittleEndian16(blockAlignment); - wfch.sampleRate = LittleEndian32(sampleRate); - wfch.bytesPerSecond = LittleEndian32(sampleRate * blockAlignment); - /* tbd: wavfmt ext hdr here */ - /* write to file */ - self->fmtChunkOffset = ByteCnt; - ByteCnt += fwrite(&wfch, 1, sizeof(wfch), self->theFile); - - /* DATA-Chunk */ - self->dataChunkOffset = ByteCnt; - wdch.dataType = BigEndian32('d','a','t','a'); - wdch.dataSize = LittleEndian32(0xffffffff - ByteCnt); /* yet unknown. set to maximum of 4 GB file */ - /* write to file */ - ByteCnt += fwrite(&wdch, 1, sizeof(wdch), self->theFile); - - self->dataSize = 0; - - /* self->dataSizeLimit = 0x7fffffff - ByteCnt; */ /* maximum size for data chunk for 2 GB files */ - self->dataSizeLimit = 0xffffffff - ByteCnt; /* maximum size for data chunk for 4 GB files */ - self->dataSizeLimit64 = 0xffffffffffffffff - ByteCnt; /* maximum size for data chunk for 64 bit addressable files */ - - self->clipCount = 0; - self->blockAlign = blockAlignment; - - return self; - - bail: - if ( NULL != self) { - free(self); - } - - return NULL; -} - -static WAVEFILEOUT* CreateWav( - const char* fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps - ) -{ -#ifdef TWO_SUPPORT_BWF - return __CreateWavInternal(fileName, sampleRate, numChannels, bps, NULL); -#else - return __CreateWavInternal(fileName, sampleRate, numChannels, bps); -#endif -} - -#ifdef TWO_SUPPORT_BWF -static WAVEFILEOUT* CreateWavBWF( - const char *fileName, - const unsigned int sampleRate, - const unsigned int numChannels, - const unsigned int bps, - const WAVEOUT_LOUDNESSINFO *hBwfData - ) -{ - return __CreateWavInternal(fileName, sampleRate, numChannels, bps, hBwfData); -} -#endif - -#define MAX_PCM16 (+32767) -#define MIN_PCM16 (-32768) -static __inline int CLIP_PCM16(int sample, TWO_UINT64* clipcount) -{ - int tmp = sample; - - if (sample >= MAX_PCM16) { - tmp = MAX_PCM16; - (*clipcount)++; - } else { - if (sample <= MIN_PCM16) { - tmp = MIN_PCM16; - (*clipcount)++; - } - } - - return tmp; -} - -#define MAX_PCM24 (+8388607) -#define MIN_PCM24 (-8388608) -static __inline int CLIP_PCM24(int sample, TWO_UINT64* clipcount) -{ - int tmp = sample; - - if (sample >= MAX_PCM24) { - tmp = MAX_PCM24; - (*clipcount)++; - } else { - if (sample <= MIN_PCM24) { - tmp = MIN_PCM24; - (*clipcount)++; - } - } - - return tmp; -} - -#define MAX_FLOAT32 (+1.0f) -#define MIN_FLOAT32 (-1.0f) -static __inline float CLIP_FLOAT32(float sample, TWO_UINT64* clipcount) -{ - float tmp = sample; - - if (sample >= MAX_FLOAT32) { - tmp = MAX_FLOAT32; - (*clipcount)++; - } else { - if (sample <= MIN_FLOAT32) { - tmp = MIN_FLOAT32; - (*clipcount)++; - } - } - - return tmp; -} - - - -static int __WriteSample16( - WAVEFILEOUT* self, - int sample, - int scale - ) -{ - size_t cnt; - short v; - - if ((scale - 16) > 0) - sample = sample >> (scale - 16); - else - sample = (int) ((uint32_t) sample << (16 - scale)); - - v = (short)CLIP_PCM16(sample, &(self->clipCount)); -#ifdef __TWO_BE - v = LittleEndian16(v); -#endif - - cnt = fwrite(&v, sizeof(short), 1, self->theFile); - - if (cnt == 1) { - self->dataSize += 2; - return __TWO_SUCCESS; - } - - return __TWO_ERROR; -} - - -static int __WriteSample24( - WAVEFILEOUT* self, - int sample, - int scale - ) -{ - size_t cnt; - int v; - - if ((scale - 24) > 0) - sample = sample >> (scale - 24); - else - sample = (int) (((unsigned int)sample) << (24 - scale)); - - v = (int)CLIP_PCM24(sample, &(self->clipCount)); -#ifdef __TWO_BE - v = LittleEndian32s(v); -#endif - cnt = fwrite(&v, 3, 1, self->theFile); - - if (cnt == 1) { - self->dataSize += 3; - return __TWO_SUCCESS; - } - - return __TWO_ERROR; -} - - -static int __WriteSample32( - WAVEFILEOUT* self, - float sample - ) -{ - size_t cnt; - union fl_int { - float v_float; - int v_int; - }; - union fl_int v; - -#if CLIP_FLOAT - v.v_float = CLIP_FLOAT32(sample, &(self->clipCount)); -#else - v.v_float = sample; - if((sample > 1.0f) || (sample <-1.0f)) - self->clipCount++; -#endif - -#ifdef __TWO_BE - v.v_int = LittleEndian32s(v.v_int); -#endif - cnt = fwrite(&v, 4, 1, self->theFile); - - if (cnt == 1) { - self->dataSize += 4; - return __TWO_SUCCESS; - } - - return __TWO_ERROR; -} - - -static int __WriteSampleInt( - WAVEFILEOUT* self, - int sample, - int scale - ) -{ - int err; - - if (!self) return __TWO_ERROR; - - - switch (self->bps) { - - case 16: - err = __WriteSample16(self, sample, scale); - break; - - case 24: - err = __WriteSample24(self, sample, scale); - break; - - default: - err = __TWO_ERROR; - break; - } - - return err; -} - - -/* this function expects values in the 16 bit range +-32767/8 */ -static int WriteWavShort( - WAVEFILEOUT* self, - short sampleBuffer[], - unsigned int nSamples - ) -{ - unsigned long i; - int err = __TWO_SUCCESS; - - if (!self) return __TWO_ERROR; - if (!sampleBuffer) return __TWO_ERROR; - if (__dataSizeChk(self, nSamples * sizeof(short))) return __TWO_ERROR; - - for (i=0; i< nSamples; i++) { - if (self->bps == 32) - { - err = __WriteSample32(self, sampleBuffer[i] / 32768.0f); - } - else - { - err = __WriteSampleInt(self, (int)sampleBuffer[i], 16); - } - if (err != __TWO_SUCCESS) return err; - } - - return __TWO_SUCCESS; -} - - -/* this function expects values in the 24 bit range +-8388607/8 */ -static int WriteWavLong( - WAVEFILEOUT* self, - int sampleBuffer[], - unsigned int nSamples - ) -{ - unsigned long i; - int err = __TWO_SUCCESS; - - if (!self) return __TWO_ERROR; - if (!sampleBuffer) return __TWO_ERROR; - if (__dataSizeChk(self, nSamples * sizeof(int))) return __TWO_ERROR; - - for (i = 0; i < nSamples; i++) { - if (self->bps == 32) - { - err = __WriteSample32(self, sampleBuffer[i] / 8388608.0f); - } - else - { - err = __WriteSampleInt(self, sampleBuffer[i], 24); - } - if (err != __TWO_SUCCESS) return err; - } - - return __TWO_SUCCESS; -} - - -/* this function expects normalized values in the range +-1.0 */ -#define MAX_FL (+2.0f * 8388608.0f ) -#define MIN_FL (-2.0f * 8388608.0f ) -#define CLIP_FL(x) ( ((x) >= MAX_FL) ? MAX_FL : (((x) <= MIN_FL) ? MIN_FL : (x)) ) -static int WriteWavFloat( - WAVEFILEOUT* self, - float sampleBuffer[], - unsigned int nSamples - ) -{ - unsigned int i; - int err = __TWO_SUCCESS; - - if (!self) return __TWO_ERROR; - if (!sampleBuffer) return __TWO_ERROR; - if (__dataSizeChk(self, nSamples * sizeof(float))) return __TWO_ERROR; - - for (i=0; ibps == 32) - { - err = __WriteSample32(self, sampleBuffer[i]); - } - else - { - float tmp = CLIP_FL(sampleBuffer[i] * 8388608.0f); /* CLIP_FL is just to avoid an INT overrun before the actual cast to int, real clipping and counting is done below */ - err = __WriteSampleInt(self, (int) tmp, 24); - } - if (err != __TWO_SUCCESS) return err; - } - - return __TWO_SUCCESS; -} - - -static int CloseWav(WAVEFILEOUT* self) -{ - unsigned int riffSize_le = 0; - unsigned int dataSize_le = 0; - TWO_UINT64 riffSize64 = 0; - TWO_UINT64 dataSize64 = 0; - TWO_UINT64 sampleCount64 = 0; /* nr of samples in the WAVE sense: 1 sample are all pcm samples of all channels of one time slice */ - int mustWriteRF64 = 0; - - if (!self) return __TWO_ERROR; - - /* check for 4 GB (switch to RF64) */ - if ( self->dataSize > self->dataSizeLimit ) { - /* when we exceed 4 GB: switch from std wave header to RF64 header */ - mustWriteRF64 = 1; - } - - /* calc header values */ - if (mustWriteRF64 == 0) { - /* write padding byte if dataSize is uneven */ - int pad = 0; - if (self->dataSize % 2 > 0) { - char tmp= 0x00; - fwrite(&tmp, sizeof(char), 1, self->theFile); - pad = 1; - } - riffSize_le = LittleEndian32(self->dataChunkOffset - 8 + 8 + (unsigned int)self->dataSize + pad); /* sizeof(hdr) - (8 bytes of riff chunk header) + (8 bytes data chunk header) + sizeof(raw-pcm-data) + padding Byte */ - dataSize_le = LittleEndian32((unsigned int)self->dataSize); - } else { - riffSize_le = 0xffffffff; - dataSize_le = 0xffffffff; - riffSize64 = LittleEndian64( self->dataSize + (TWO_UINT64)self->dataChunkOffset ); - dataSize64 = LittleEndian64( self->dataSize ); - sampleCount64 = LittleEndian64( self->dataSize / (TWO_UINT64)self->blockAlign ); - } - - /* now overwrite length/size values in header with the actual/real ones */ - if (mustWriteRF64 == 0) { - /* riffsize32 */ - fseek(self->theFile, 4, SEEK_SET); - fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); - /* datasize32 */ - fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); - fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); - } else { - unsigned int rf64sig = BigEndian32('R','F','6','4'); - unsigned int ds64sig = BigEndian32('d','s','6','4'); - - /* replace RIFF->RF64 */ - fseek(self->theFile, 0, SEEK_SET); - fwrite(&rf64sig, sizeof(rf64sig), 1, self->theFile); - - /* riffsize32 */ - fseek(self->theFile, 4, SEEK_SET); - fwrite(&riffSize_le, sizeof(riffSize_le), 1, self->theFile); - - /* replace JUNK->ds64 */ - fseek(self->theFile, self->junkChunkOffset, SEEK_SET); - fwrite(&ds64sig, sizeof(ds64sig), 1, self->theFile); - - /* riffSize64, dataSize64, sampleCount64 */ - fseek(self->theFile, self->junkChunkOffset + 8, SEEK_SET); - fwrite(&riffSize64, sizeof(riffSize64), 1, self->theFile); - fwrite(&dataSize64, sizeof(dataSize64), 1, self->theFile); - fwrite(&sampleCount64, sizeof(sampleCount64), 1, self->theFile); - - /* datasize32 */ - fseek(self->theFile, self->dataChunkOffset + 4, SEEK_SET); - fwrite(&dataSize_le, sizeof(dataSize_le), 1, self->theFile); - } - - fclose(self->theFile); - free(self); - - return __TWO_SUCCESS; -} - -#ifdef TWO_SUPPORT_BWF -static int CloseWavBWF( - WAVEFILEOUT* self, - WAVEOUT_LOUDNESSINFO bextData - ) -{ - int wordData; - - if (!self) return __TWO_ERROR; - - if (self->bextChunkOffset) { - /* Offset for Loudness Data in bext-chunk: 8: Chunk-Header, 412:prev.Data */ - fseek(self->theFile, self->bextChunkOffset+8+412, SEEK_SET); - - wordData = LittleEndian32(EncodeLoudness(bextData.loudnessVal)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.loudnessRange)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.maxTruePeakLevel)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.maxMomentaryLoudnes)); - fwrite(&wordData, 2, 1, self->theFile); - - wordData = LittleEndian32(EncodeLoudness(bextData.maxShortTermLoudness)); - fwrite(&wordData, 2, 1, self->theFile); - } - - return CloseWav(self); -} -#endif - -/*------------- local subs ----------------*/ - -static __inline unsigned int BigEndian32(char a, char b, char c, char d) -{ -#ifdef __TWO_LE - return - (unsigned int) d << 24 | - (unsigned int) c << 16 | - (unsigned int) b << 8 | - (unsigned int) a ; -#else - return - (unsigned int) a << 24 | - (unsigned int) b << 16 | - (unsigned int) c << 8 | - (unsigned int) d ; -#endif -} - - -static __inline unsigned int LittleEndian32(unsigned int v) -{ -#ifdef __TWO_LE - return v; -#else - return - (v & 0x000000FF) << 24 | - (v & 0x0000FF00) << 8 | - (v & 0x00FF0000) >> 8 | - (v & 0xFF000000) >> 24 ; -#endif -} - - -/* signed version of the above */ -static __inline unsigned int LittleEndian32s(int v) -{ -#ifdef __TWO_LE - return v; -#else - return - (v & 0x000000FF) << 24 | - (v & 0x0000FF00) << 8 | - (v & 0x00FF0000) >> 8 | - (v & 0xFF000000) >> 24 ; -#endif -} - - -static __inline short LittleEndian16(short v) -{ -#ifdef __TWO_LE - return v; -#else - return ((v << 8) & 0xFF00) | ((v >> 8) & 0x00FF); -#endif -} - -static __inline TWO_UINT64 LittleEndian64(TWO_UINT64 v) -{ -#ifdef __TWO_LE - return v; -#else - return - (v & 0x00000000000000FF) << 56 | - (v & 0x000000000000FF00) << 40 | - (v & 0x0000000000FF0000) << 24 | - (v & 0x00000000FF000000) << 8 | - (v & 0x000000FF00000000) >> 8 | - (v & 0x0000FF0000000000) >> 24 | - (v & 0x00FF000000000000) >> 40 | - (v & 0xFF00000000000000) >> 56 ; -#endif -} - -#ifdef TWO_SUPPORT_BWF -static unsigned int EncodeLoudness(float x) -{ - int s = (x>0)-(x<0); - return (int)( x*100.0f + s*0.5f ); -} -#endif - -static __inline int __dataSizeChk( WAVEFILEOUT* self, int newbytes ) -{ - if (!self) return __TWO_ERROR; - - if ( (self->dataSize + ((TWO_UINT64)newbytes) ) > self->dataSizeLimit64 ) { - return __TWO_ERROR; - } - - return __TWO_SUCCESS; -} - -#endif /* __TINYWAVEOUT_C_H__ */ - - - diff --git a/lc3plus/tns_coder.c b/lc3plus/tns_coder.c old mode 100755 new mode 100644 diff --git a/lc3plus/tns_decoder.c b/lc3plus/tns_decoder.c old mode 100755 new mode 100644 diff --git a/lc3plus/util.h b/lc3plus/util.h old mode 100755 new mode 100644 -- GitLab From 051013d9fe94149598b1c3cf02e35dc4f188f418 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 10 Jul 2023 14:16:18 +0200 Subject: [PATCH 281/591] CI: Do not run scripts for removing RAM_COUNTING_TOOL define This define no longer exists since the update of the WMC tool. --- .gitlab-ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4a7421142a..e04cd50f31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -347,7 +347,6 @@ codec-msan: needs: ["build-codec-sanitizers-linux"] script: - *print-common-info - - python3 ci/disable_ram_counting.py - make clean - make -j CLANG=1 - python3 scripts/self_test.py --create | tee test_output.txt @@ -370,7 +369,6 @@ codec-asan: needs: ["build-codec-sanitizers-linux"] script: - *print-common-info - - python3 ci/disable_ram_counting.py - make clean - make -j CLANG=2 - python3 scripts/self_test.py --create | tee test_output.txt @@ -413,7 +411,6 @@ renderer-asan: needs: ["build-codec-linux-cmake"] stage: test script: - - python3 ci/comment_defines.py -d RAM_COUNTING_TOOL -f lib_com/options.h - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py @@ -437,7 +434,6 @@ renderer-msan: needs: ["build-codec-linux-cmake"] stage: test script: - - python3 ci/comment_defines.py -d RAM_COUNTING_TOOL -f lib_com/options.h - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py -- GitLab From f23ebeb1908baf8cc07e7bc3c38b46ab53aae486 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 10 Jul 2023 14:55:04 +0200 Subject: [PATCH 282/591] Fix issue with non-100 speeds --- lib_com/ivas_prot.h | 3 +++ lib_dec/ivas_binRenderer_internal.c | 9 +++++++++ lib_dec/ivas_jbm_dec.c | 4 ++++ lib_dec/ivas_mc_paramupmix_dec.c | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 5f18f27668..094ebb7194 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5174,6 +5174,9 @@ void ivas_binaural_cldfb( void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ +#ifdef JBM_PARAMUPMIX + const int16_t slot_size, /* i : JBM slot size */ +#endif float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5bd09236e0..4cf4c52b22 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1027,6 +1027,9 @@ void ivas_binaural_cldfb( void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ +#ifdef JBM_PARAMUPMIX + const int16_t slot_size, /* i : JBM slot size */ +#endif float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { @@ -1035,12 +1038,18 @@ void ivas_binaural_cldfb_sf( float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; +#ifdef JBM_PARAMUPMIX + int16_t slots_to_render, first_sf, last_sf; +#else int16_t slot_size, slots_to_render, first_sf, last_sf; +#endif int16_t slot_index_start, slot_index_start_cldfb; /* Implement a 5 msec loops */ maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); +#ifndef JBM_PARAMUPMIX slot_size = st_ivas->hTcBuffer->nb_subframes; +#endif /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ed672cac5c..29fd38e55a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -797,7 +797,11 @@ ivas_error ivas_jbm_dec_render( #ifdef DEBUGGING else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef JBM_PARAMUPMIX + ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->nb_subframes, p_output ); +#else ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, p_output ); +#endif } #endif } diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 6ae1097e7e..3307356964 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -387,7 +387,7 @@ void ivas_mc_paramupmix_dec_render( /* Implement binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, output_f_local ); + ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, slot_size, output_f_local ); } else { -- GitLab From edbaf7a8a72cebff090d843a0773c494c8d2a317 Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 10 Jul 2023 15:33:57 +0200 Subject: [PATCH 283/591] Fix pipelines --- lib_com/ivas_prot.h | 19 +++++++++++++++---- lib_dec/ivas_binRenderer_internal.c | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 094ebb7194..5ef73792aa 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5165,7 +5165,7 @@ void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ ); -#ifdef DEBUGGING +#ifdef JBM_PARAMUPMIX void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -5174,14 +5174,25 @@ void ivas_binaural_cldfb( void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ -#ifdef JBM_PARAMUPMIX const int16_t slot_size, /* i : JBM slot size */ -#endif float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ - +); +#else +#ifdef DEBUGGING +void ivas_binaural_cldfb( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +void ivas_binaural_cldfb_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_samples_to_render, /* i : output frame length per channel */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ + +); #endif +#endif + void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 4cf4c52b22..dae1f9d037 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1028,9 +1028,9 @@ void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ #ifdef JBM_PARAMUPMIX - const int16_t slot_size, /* i : JBM slot size */ + const int16_t slot_size, /* i : JBM slot size */ #endif - float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -- GitLab From 86c53e8abea406b124e56210c5341bc85cfb6eaf Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 10 Jul 2023 15:50:07 +0200 Subject: [PATCH 284/591] More pipeline work --- lib_dec/ivas_binRenderer_internal.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index dae1f9d037..dd005934e0 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -942,7 +942,6 @@ void ivas_binaural_add_LFE( } -#ifdef DEBUGGING /*-------------------------------------------------------------------------* * ivas_binaural_cldfb() * @@ -1119,7 +1118,6 @@ void ivas_binaural_cldfb_sf( return; } -#endif /*------------------------------------------------------------------------- -- GitLab From e3fbab64472f7e944032ad197763807577331f4c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 10 Jul 2023 18:24:24 +0200 Subject: [PATCH 285/591] [wip] first version of split rendering pytest framework --- .gitignore | 3 + .../full_circle_in_15s_delayed.csv | 3020 +++++++++++++++++ .../rotate_yaw_pitch_roll1_delayed.csv | 2421 +++++++++++++ tests/split_rendering/__init__.py | 27 + tests/split_rendering/constants.py | 137 + .../split_renderer_config_384_3dof.txt | 10 + .../split_renderer_config_384_3dof_hq.txt | 10 + .../split_renderer_config_512_2dof.txt | 10 + .../split_renderer_config_768_1dof.txt | 10 + ...t_renderer_config_768_1dof_hoa_lc3plus.txt | 11 + .../split_renderer_config_768_2dof.txt | 10 + .../split_renderer_config_fc_384_3dof.txt | 10 + .../split_renderer_config_fc_384_3dof_hq.txt | 10 + .../split_renderer_config_fc_512_2dof.txt | 10 + .../split_renderer_config_fc_768_1dof.txt | 10 + tests/split_rendering/test_split_rendering.py | 164 + tests/split_rendering/utils.py | 189 ++ 17 files changed, 6062 insertions(+) create mode 100644 scripts/trajectories/full_circle_in_15s_delayed.csv create mode 100644 scripts/trajectories/rotate_yaw_pitch_roll1_delayed.csv create mode 100644 tests/split_rendering/__init__.py create mode 100644 tests/split_rendering/constants.py create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt create mode 100644 tests/split_rendering/test_split_rendering.py create mode 100644 tests/split_rendering/utils.py diff --git a/.gitignore b/.gitignore index 7bddb45991..363accb307 100644 --- a/.gitignore +++ b/.gitignore @@ -47,10 +47,13 @@ tests/renderer/cut tests/renderer/ref tests/dut tests/ref +tests/split_rendering/ref/* +tests/split_rendering/cut/* scripts/testv/*_cut*.pcm # default reference binary name IVAS_cod_ref IVAS_dec_ref +IVAS_rend_ref # Python files that pop up when running scripts __pycache__/ diff --git a/scripts/trajectories/full_circle_in_15s_delayed.csv b/scripts/trajectories/full_circle_in_15s_delayed.csv new file mode 100644 index 0000000000..6596193a69 --- /dev/null +++ b/scripts/trajectories/full_circle_in_15s_delayed.csv @@ -0,0 +1,3020 @@ +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +1.000000,0.000000,0.000000,0.000000 +0.999999,0.000000,0.000000,0.001047 +0.999998,0.000000,0.000000,0.002094 +0.999995,0.000000,0.000000,0.003142 +0.999991,0.000000,0.000000,0.004189 +0.999986,0.000000,0.000000,0.005236 +0.999980,0.000000,0.000000,0.006283 +0.999973,0.000000,0.000000,0.007330 +0.999965,0.000000,0.000000,0.008377 +0.999956,0.000000,0.000000,0.009425 +0.999945,0.000000,0.000000,0.010472 +0.999934,0.000000,0.000000,0.011519 +0.999921,0.000000,0.000000,0.012566 +0.999907,0.000000,0.000000,0.013613 +0.999893,0.000000,0.000000,0.014660 +0.999877,0.000000,0.000000,0.015707 +0.999860,0.000000,0.000000,0.016754 +0.999842,0.000000,0.000000,0.017801 +0.999822,0.000000,0.000000,0.018848 +0.999802,0.000000,0.000000,0.019895 +0.999781,0.000000,0.000000,0.020942 +0.999758,0.000000,0.000000,0.021989 +0.999735,0.000000,0.000000,0.023036 +0.999710,0.000000,0.000000,0.024083 +0.999684,0.000000,0.000000,0.025130 +0.999657,0.000000,0.000000,0.026177 +0.999629,0.000000,0.000000,0.027224 +0.999600,0.000000,0.000000,0.028271 +0.999570,0.000000,0.000000,0.029317 +0.999539,0.000000,0.000000,0.030364 +0.999507,0.000000,0.000000,0.031411 +0.999473,0.000000,0.000000,0.032457 +0.999439,0.000000,0.000000,0.033504 +0.999403,0.000000,0.000000,0.034551 +0.999366,0.000000,0.000000,0.035597 +0.999328,0.000000,0.000000,0.036644 +0.999289,0.000000,0.000000,0.037690 +0.999249,0.000000,0.000000,0.038737 +0.999208,0.000000,0.000000,0.039783 +0.999166,0.000000,0.000000,0.040829 +0.999123,0.000000,0.000000,0.041876 +0.999078,0.000000,0.000000,0.042922 +0.999033,0.000000,0.000000,0.043968 +0.998986,0.000000,0.000000,0.045014 +0.998939,0.000000,0.000000,0.046060 +0.998890,0.000000,0.000000,0.047106 +0.998840,0.000000,0.000000,0.048152 +0.998789,0.000000,0.000000,0.049198 +0.998737,0.000000,0.000000,0.050244 +0.998684,0.000000,0.000000,0.051290 +0.998630,0.000000,0.000000,0.052336 +0.998574,0.000000,0.000000,0.053382 +0.998518,0.000000,0.000000,0.054427 +0.998460,0.000000,0.000000,0.055473 +0.998402,0.000000,0.000000,0.056519 +0.998342,0.000000,0.000000,0.057564 +0.998281,0.000000,0.000000,0.058609 +0.998219,0.000000,0.000000,0.059655 +0.998156,0.000000,0.000000,0.060700 +0.998092,0.000000,0.000000,0.061745 +0.998027,0.000000,0.000000,0.062791 +0.997960,0.000000,0.000000,0.063836 +0.997893,0.000000,0.000000,0.064881 +0.997825,0.000000,0.000000,0.065926 +0.997755,0.000000,0.000000,0.066970 +0.997684,0.000000,0.000000,0.068015 +0.997613,0.000000,0.000000,0.069060 +0.997540,0.000000,0.000000,0.070105 +0.997466,0.000000,0.000000,0.071149 +0.997391,0.000000,0.000000,0.072194 +0.997314,0.000000,0.000000,0.073238 +0.997237,0.000000,0.000000,0.074283 +0.997159,0.000000,0.000000,0.075327 +0.997079,0.000000,0.000000,0.076371 +0.996999,0.000000,0.000000,0.077415 +0.996917,0.000000,0.000000,0.078459 +0.996835,0.000000,0.000000,0.079503 +0.996751,0.000000,0.000000,0.080547 +0.996666,0.000000,0.000000,0.081591 +0.996580,0.000000,0.000000,0.082634 +0.996493,0.000000,0.000000,0.083678 +0.996405,0.000000,0.000000,0.084721 +0.996315,0.000000,0.000000,0.085765 +0.996225,0.000000,0.000000,0.086808 +0.996134,0.000000,0.000000,0.087851 +0.996041,0.000000,0.000000,0.088894 +0.995947,0.000000,0.000000,0.089937 +0.995853,0.000000,0.000000,0.090980 +0.995757,0.000000,0.000000,0.092023 +0.995660,0.000000,0.000000,0.093066 +0.995562,0.000000,0.000000,0.094108 +0.995463,0.000000,0.000000,0.095151 +0.995363,0.000000,0.000000,0.096193 +0.995261,0.000000,0.000000,0.097235 +0.995159,0.000000,0.000000,0.098278 +0.995056,0.000000,0.000000,0.099320 +0.994951,0.000000,0.000000,0.100362 +0.994845,0.000000,0.000000,0.101404 +0.994739,0.000000,0.000000,0.102445 +0.994631,0.000000,0.000000,0.103487 +0.994522,0.000000,0.000000,0.104528 +0.994412,0.000000,0.000000,0.105570 +0.994301,0.000000,0.000000,0.106611 +0.994189,0.000000,0.000000,0.107652 +0.994075,0.000000,0.000000,0.108693 +0.993961,0.000000,0.000000,0.109734 +0.993845,0.000000,0.000000,0.110775 +0.993729,0.000000,0.000000,0.111816 +0.993611,0.000000,0.000000,0.112856 +0.993493,0.000000,0.000000,0.113897 +0.993373,0.000000,0.000000,0.114937 +0.993252,0.000000,0.000000,0.115977 +0.993130,0.000000,0.000000,0.117017 +0.993007,0.000000,0.000000,0.118057 +0.992883,0.000000,0.000000,0.119097 +0.992757,0.000000,0.000000,0.120137 +0.992631,0.000000,0.000000,0.121176 +0.992504,0.000000,0.000000,0.122216 +0.992375,0.000000,0.000000,0.123255 +0.992245,0.000000,0.000000,0.124294 +0.992115,0.000000,0.000000,0.125333 +0.991983,0.000000,0.000000,0.126372 +0.991850,0.000000,0.000000,0.127411 +0.991716,0.000000,0.000000,0.128449 +0.991581,0.000000,0.000000,0.129488 +0.991445,0.000000,0.000000,0.130526 +0.991308,0.000000,0.000000,0.131564 +0.991169,0.000000,0.000000,0.132602 +0.991030,0.000000,0.000000,0.133640 +0.990889,0.000000,0.000000,0.134678 +0.990748,0.000000,0.000000,0.135716 +0.990605,0.000000,0.000000,0.136753 +0.990461,0.000000,0.000000,0.137790 +0.990317,0.000000,0.000000,0.138827 +0.990171,0.000000,0.000000,0.139864 +0.990024,0.000000,0.000000,0.140901 +0.989876,0.000000,0.000000,0.141938 +0.989726,0.000000,0.000000,0.142974 +0.989576,0.000000,0.000000,0.144011 +0.989425,0.000000,0.000000,0.145047 +0.989272,0.000000,0.000000,0.146083 +0.989119,0.000000,0.000000,0.147119 +0.988964,0.000000,0.000000,0.148155 +0.988809,0.000000,0.000000,0.149190 +0.988652,0.000000,0.000000,0.150226 +0.988494,0.000000,0.000000,0.151261 +0.988335,0.000000,0.000000,0.152296 +0.988175,0.000000,0.000000,0.153331 +0.988014,0.000000,0.000000,0.154366 +0.987852,0.000000,0.000000,0.155400 +0.987688,0.000000,0.000000,0.156434 +0.987524,0.000000,0.000000,0.157469 +0.987359,0.000000,0.000000,0.158503 +0.987192,0.000000,0.000000,0.159537 +0.987024,0.000000,0.000000,0.160570 +0.986856,0.000000,0.000000,0.161604 +0.986686,0.000000,0.000000,0.162637 +0.986515,0.000000,0.000000,0.163670 +0.986343,0.000000,0.000000,0.164703 +0.986170,0.000000,0.000000,0.165736 +0.985996,0.000000,0.000000,0.166769 +0.985821,0.000000,0.000000,0.167801 +0.985645,0.000000,0.000000,0.168833 +0.985467,0.000000,0.000000,0.169866 +0.985289,0.000000,0.000000,0.170897 +0.985109,0.000000,0.000000,0.171929 +0.984929,0.000000,0.000000,0.172961 +0.984747,0.000000,0.000000,0.173992 +0.984564,0.000000,0.000000,0.175023 +0.984381,0.000000,0.000000,0.176054 +0.984196,0.000000,0.000000,0.177085 +0.984010,0.000000,0.000000,0.178115 +0.983823,0.000000,0.000000,0.179146 +0.983634,0.000000,0.000000,0.180176 +0.983445,0.000000,0.000000,0.181206 +0.983255,0.000000,0.000000,0.182236 +0.983064,0.000000,0.000000,0.183265 +0.982871,0.000000,0.000000,0.184294 +0.982678,0.000000,0.000000,0.185324 +0.982483,0.000000,0.000000,0.186353 +0.982287,0.000000,0.000000,0.187381 +0.982090,0.000000,0.000000,0.188410 +0.981893,0.000000,0.000000,0.189438 +0.981694,0.000000,0.000000,0.190466 +0.981494,0.000000,0.000000,0.191494 +0.981293,0.000000,0.000000,0.192522 +0.981091,0.000000,0.000000,0.193549 +0.980887,0.000000,0.000000,0.194577 +0.980683,0.000000,0.000000,0.195604 +0.980478,0.000000,0.000000,0.196631 +0.980271,0.000000,0.000000,0.197657 +0.980064,0.000000,0.000000,0.198684 +0.979855,0.000000,0.000000,0.199710 +0.979645,0.000000,0.000000,0.200736 +0.979435,0.000000,0.000000,0.201762 +0.979223,0.000000,0.000000,0.202787 +0.979010,0.000000,0.000000,0.203813 +0.978796,0.000000,0.000000,0.204838 +0.978581,0.000000,0.000000,0.205863 +0.978365,0.000000,0.000000,0.206887 +0.978148,0.000000,0.000000,0.207912 +0.977929,0.000000,0.000000,0.208936 +0.977710,0.000000,0.000000,0.209960 +0.977490,0.000000,0.000000,0.210984 +0.977268,0.000000,0.000000,0.212007 +0.977046,0.000000,0.000000,0.213030 +0.976822,0.000000,0.000000,0.214053 +0.976597,0.000000,0.000000,0.215076 +0.976371,0.000000,0.000000,0.216099 +0.976145,0.000000,0.000000,0.217121 +0.975917,0.000000,0.000000,0.218143 +0.975688,0.000000,0.000000,0.219165 +0.975458,0.000000,0.000000,0.220187 +0.975227,0.000000,0.000000,0.221208 +0.974994,0.000000,0.000000,0.222229 +0.974761,0.000000,0.000000,0.223250 +0.974527,0.000000,0.000000,0.224271 +0.974291,0.000000,0.000000,0.225291 +0.974055,0.000000,0.000000,0.226311 +0.973817,0.000000,0.000000,0.227331 +0.973579,0.000000,0.000000,0.228351 +0.973339,0.000000,0.000000,0.229370 +0.973099,0.000000,0.000000,0.230389 +0.972857,0.000000,0.000000,0.231408 +0.972614,0.000000,0.000000,0.232427 +0.972370,0.000000,0.000000,0.233445 +0.972125,0.000000,0.000000,0.234463 +0.971879,0.000000,0.000000,0.235481 +0.971632,0.000000,0.000000,0.236499 +0.971384,0.000000,0.000000,0.237516 +0.971134,0.000000,0.000000,0.238533 +0.970884,0.000000,0.000000,0.239550 +0.970633,0.000000,0.000000,0.240567 +0.970380,0.000000,0.000000,0.241583 +0.970127,0.000000,0.000000,0.242599 +0.969872,0.000000,0.000000,0.243615 +0.969616,0.000000,0.000000,0.244631 +0.969360,0.000000,0.000000,0.245646 +0.969102,0.000000,0.000000,0.246661 +0.968843,0.000000,0.000000,0.247675 +0.968583,0.000000,0.000000,0.248690 +0.968322,0.000000,0.000000,0.249704 +0.968060,0.000000,0.000000,0.250718 +0.967797,0.000000,0.000000,0.251732 +0.967533,0.000000,0.000000,0.252745 +0.967268,0.000000,0.000000,0.253758 +0.967001,0.000000,0.000000,0.254771 +0.966734,0.000000,0.000000,0.255783 +0.966466,0.000000,0.000000,0.256795 +0.966196,0.000000,0.000000,0.257807 +0.965926,0.000000,0.000000,0.258819 +0.965654,0.000000,0.000000,0.259830 +0.965382,0.000000,0.000000,0.260842 +0.965108,0.000000,0.000000,0.261852 +0.964833,0.000000,0.000000,0.262863 +0.964557,0.000000,0.000000,0.263873 +0.964281,0.000000,0.000000,0.264883 +0.964003,0.000000,0.000000,0.265893 +0.963724,0.000000,0.000000,0.266902 +0.963444,0.000000,0.000000,0.267911 +0.963163,0.000000,0.000000,0.268920 +0.962880,0.000000,0.000000,0.269928 +0.962597,0.000000,0.000000,0.270936 +0.962313,0.000000,0.000000,0.271944 +0.962028,0.000000,0.000000,0.272952 +0.961741,0.000000,0.000000,0.273959 +0.961454,0.000000,0.000000,0.274966 +0.961165,0.000000,0.000000,0.275973 +0.960876,0.000000,0.000000,0.276979 +0.960585,0.000000,0.000000,0.277985 +0.960294,0.000000,0.000000,0.278991 +0.960001,0.000000,0.000000,0.279997 +0.959707,0.000000,0.000000,0.281002 +0.959412,0.000000,0.000000,0.282007 +0.959117,0.000000,0.000000,0.283011 +0.958820,0.000000,0.000000,0.284015 +0.958522,0.000000,0.000000,0.285019 +0.958223,0.000000,0.000000,0.286023 +0.957923,0.000000,0.000000,0.287026 +0.957622,0.000000,0.000000,0.288029 +0.957319,0.000000,0.000000,0.289032 +0.957016,0.000000,0.000000,0.290034 +0.956712,0.000000,0.000000,0.291036 +0.956407,0.000000,0.000000,0.292038 +0.956100,0.000000,0.000000,0.293039 +0.955793,0.000000,0.000000,0.294040 +0.955485,0.000000,0.000000,0.295041 +0.955175,0.000000,0.000000,0.296041 +0.954865,0.000000,0.000000,0.297042 +0.954553,0.000000,0.000000,0.298041 +0.954240,0.000000,0.000000,0.299041 +0.953927,0.000000,0.000000,0.300040 +0.953612,0.000000,0.000000,0.301039 +0.953296,0.000000,0.000000,0.302037 +0.952979,0.000000,0.000000,0.303035 +0.952661,0.000000,0.000000,0.304033 +0.952343,0.000000,0.000000,0.305031 +0.952023,0.000000,0.000000,0.306028 +0.951702,0.000000,0.000000,0.307024 +0.951380,0.000000,0.000000,0.308021 +0.951057,0.000000,0.000000,0.309017 +0.950732,0.000000,0.000000,0.310013 +0.950407,0.000000,0.000000,0.311008 +0.950081,0.000000,0.000000,0.312003 +0.949754,0.000000,0.000000,0.312998 +0.949425,0.000000,0.000000,0.313992 +0.949096,0.000000,0.000000,0.314987 +0.948766,0.000000,0.000000,0.315980 +0.948434,0.000000,0.000000,0.316974 +0.948102,0.000000,0.000000,0.317967 +0.947768,0.000000,0.000000,0.318959 +0.947434,0.000000,0.000000,0.319952 +0.947098,0.000000,0.000000,0.320944 +0.946762,0.000000,0.000000,0.321935 +0.946424,0.000000,0.000000,0.322927 +0.946085,0.000000,0.000000,0.323917 +0.945746,0.000000,0.000000,0.324908 +0.945405,0.000000,0.000000,0.325898 +0.945063,0.000000,0.000000,0.326888 +0.944720,0.000000,0.000000,0.327878 +0.944376,0.000000,0.000000,0.328867 +0.944031,0.000000,0.000000,0.329855 +0.943686,0.000000,0.000000,0.330844 +0.943339,0.000000,0.000000,0.331832 +0.942991,0.000000,0.000000,0.332820 +0.942641,0.000000,0.000000,0.333807 +0.942291,0.000000,0.000000,0.334794 +0.941940,0.000000,0.000000,0.335780 +0.941588,0.000000,0.000000,0.336767 +0.941235,0.000000,0.000000,0.337752 +0.940881,0.000000,0.000000,0.338738 +0.940526,0.000000,0.000000,0.339723 +0.940169,0.000000,0.000000,0.340708 +0.939812,0.000000,0.000000,0.341692 +0.939454,0.000000,0.000000,0.342676 +0.939094,0.000000,0.000000,0.343660 +0.938734,0.000000,0.000000,0.344643 +0.938372,0.000000,0.000000,0.345626 +0.938010,0.000000,0.000000,0.346608 +0.937646,0.000000,0.000000,0.347590 +0.937282,0.000000,0.000000,0.348572 +0.936916,0.000000,0.000000,0.349553 +0.936550,0.000000,0.000000,0.350534 +0.936182,0.000000,0.000000,0.351515 +0.935814,0.000000,0.000000,0.352495 +0.935444,0.000000,0.000000,0.353475 +0.935073,0.000000,0.000000,0.354454 +0.934702,0.000000,0.000000,0.355433 +0.934329,0.000000,0.000000,0.356412 +0.933955,0.000000,0.000000,0.357390 +0.933580,0.000000,0.000000,0.358368 +0.933205,0.000000,0.000000,0.359345 +0.932828,0.000000,0.000000,0.360322 +0.932450,0.000000,0.000000,0.361299 +0.932071,0.000000,0.000000,0.362275 +0.931691,0.000000,0.000000,0.363251 +0.931310,0.000000,0.000000,0.364227 +0.930928,0.000000,0.000000,0.365202 +0.930545,0.000000,0.000000,0.366176 +0.930161,0.000000,0.000000,0.367151 +0.929776,0.000000,0.000000,0.368125 +0.929390,0.000000,0.000000,0.369098 +0.929003,0.000000,0.000000,0.370071 +0.928615,0.000000,0.000000,0.371044 +0.928226,0.000000,0.000000,0.372016 +0.927836,0.000000,0.000000,0.372988 +0.927445,0.000000,0.000000,0.373959 +0.927053,0.000000,0.000000,0.374930 +0.926660,0.000000,0.000000,0.375901 +0.926266,0.000000,0.000000,0.376871 +0.925871,0.000000,0.000000,0.377841 +0.925474,0.000000,0.000000,0.378810 +0.925077,0.000000,0.000000,0.379779 +0.924679,0.000000,0.000000,0.380748 +0.924280,0.000000,0.000000,0.381716 +0.923880,0.000000,0.000000,0.382683 +0.923478,0.000000,0.000000,0.383651 +0.923076,0.000000,0.000000,0.384618 +0.922673,0.000000,0.000000,0.385584 +0.922268,0.000000,0.000000,0.386550 +0.921863,0.000000,0.000000,0.387516 +0.921457,0.000000,0.000000,0.388481 +0.921050,0.000000,0.000000,0.389445 +0.920641,0.000000,0.000000,0.390410 +0.920232,0.000000,0.000000,0.391374 +0.919821,0.000000,0.000000,0.392337 +0.919410,0.000000,0.000000,0.393300 +0.918998,0.000000,0.000000,0.394263 +0.918584,0.000000,0.000000,0.395225 +0.918170,0.000000,0.000000,0.396187 +0.917755,0.000000,0.000000,0.397148 +0.917338,0.000000,0.000000,0.398109 +0.916921,0.000000,0.000000,0.399069 +0.916502,0.000000,0.000000,0.400029 +0.916083,0.000000,0.000000,0.400989 +0.915663,0.000000,0.000000,0.401948 +0.915241,0.000000,0.000000,0.402906 +0.914819,0.000000,0.000000,0.403865 +0.914395,0.000000,0.000000,0.404822 +0.913971,0.000000,0.000000,0.405780 +0.913545,0.000000,0.000000,0.406737 +0.913119,0.000000,0.000000,0.407693 +0.912692,0.000000,0.000000,0.408649 +0.912263,0.000000,0.000000,0.409605 +0.911834,0.000000,0.000000,0.410560 +0.911403,0.000000,0.000000,0.411514 +0.910972,0.000000,0.000000,0.412469 +0.910539,0.000000,0.000000,0.413422 +0.910106,0.000000,0.000000,0.414376 +0.909672,0.000000,0.000000,0.415328 +0.909236,0.000000,0.000000,0.416281 +0.908800,0.000000,0.000000,0.417233 +0.908362,0.000000,0.000000,0.418184 +0.907924,0.000000,0.000000,0.419135 +0.907484,0.000000,0.000000,0.420086 +0.907044,0.000000,0.000000,0.421036 +0.906603,0.000000,0.000000,0.421985 +0.906160,0.000000,0.000000,0.422935 +0.905717,0.000000,0.000000,0.423883 +0.905272,0.000000,0.000000,0.424832 +0.904827,0.000000,0.000000,0.425779 +0.904381,0.000000,0.000000,0.426727 +0.903933,0.000000,0.000000,0.427673 +0.903485,0.000000,0.000000,0.428620 +0.903036,0.000000,0.000000,0.429566 +0.902585,0.000000,0.000000,0.430511 +0.902134,0.000000,0.000000,0.431456 +0.901682,0.000000,0.000000,0.432401 +0.901228,0.000000,0.000000,0.433345 +0.900774,0.000000,0.000000,0.434288 +0.900319,0.000000,0.000000,0.435231 +0.899863,0.000000,0.000000,0.436174 +0.899405,0.000000,0.000000,0.437116 +0.898947,0.000000,0.000000,0.438057 +0.898488,0.000000,0.000000,0.438999 +0.898028,0.000000,0.000000,0.439939 +0.897566,0.000000,0.000000,0.440879 +0.897104,0.000000,0.000000,0.441819 +0.896641,0.000000,0.000000,0.442758 +0.896177,0.000000,0.000000,0.443697 +0.895712,0.000000,0.000000,0.444635 +0.895246,0.000000,0.000000,0.445573 +0.894779,0.000000,0.000000,0.446510 +0.894310,0.000000,0.000000,0.447447 +0.893841,0.000000,0.000000,0.448383 +0.893371,0.000000,0.000000,0.449319 +0.892900,0.000000,0.000000,0.450254 +0.892428,0.000000,0.000000,0.451189 +0.891955,0.000000,0.000000,0.452123 +0.891481,0.000000,0.000000,0.453057 +0.891007,0.000000,0.000000,0.453990 +0.890531,0.000000,0.000000,0.454923 +0.890054,0.000000,0.000000,0.455856 +0.889576,0.000000,0.000000,0.456787 +0.889097,0.000000,0.000000,0.457719 +0.888617,0.000000,0.000000,0.458650 +0.888136,0.000000,0.000000,0.459580 +0.887655,0.000000,0.000000,0.460510 +0.887172,0.000000,0.000000,0.461439 +0.886688,0.000000,0.000000,0.462368 +0.886204,0.000000,0.000000,0.463296 +0.885718,0.000000,0.000000,0.464224 +0.885231,0.000000,0.000000,0.465151 +0.884744,0.000000,0.000000,0.466078 +0.884255,0.000000,0.000000,0.467004 +0.883766,0.000000,0.000000,0.467930 +0.883275,0.000000,0.000000,0.468855 +0.882784,0.000000,0.000000,0.469780 +0.882291,0.000000,0.000000,0.470704 +0.881798,0.000000,0.000000,0.471628 +0.881303,0.000000,0.000000,0.472551 +0.880808,0.000000,0.000000,0.473473 +0.880312,0.000000,0.000000,0.474396 +0.879815,0.000000,0.000000,0.475317 +0.879316,0.000000,0.000000,0.476238 +0.878817,0.000000,0.000000,0.477159 +0.878317,0.000000,0.000000,0.478079 +0.877816,0.000000,0.000000,0.478998 +0.877314,0.000000,0.000000,0.479917 +0.876811,0.000000,0.000000,0.480836 +0.876307,0.000000,0.000000,0.481754 +0.875802,0.000000,0.000000,0.482671 +0.875296,0.000000,0.000000,0.483588 +0.874789,0.000000,0.000000,0.484504 +0.874281,0.000000,0.000000,0.485420 +0.873772,0.000000,0.000000,0.486335 +0.873262,0.000000,0.000000,0.487250 +0.872752,0.000000,0.000000,0.488164 +0.872240,0.000000,0.000000,0.489078 +0.871727,0.000000,0.000000,0.489991 +0.871214,0.000000,0.000000,0.490904 +0.870699,0.000000,0.000000,0.491816 +0.870184,0.000000,0.000000,0.492727 +0.869667,0.000000,0.000000,0.493638 +0.869150,0.000000,0.000000,0.494549 +0.868632,0.000000,0.000000,0.495459 +0.868112,0.000000,0.000000,0.496368 +0.867592,0.000000,0.000000,0.497277 +0.867071,0.000000,0.000000,0.498185 +0.866549,0.000000,0.000000,0.499093 +0.866025,0.000000,0.000000,0.500000 +0.865501,0.000000,0.000000,0.500907 +0.864976,0.000000,0.000000,0.501813 +0.864450,0.000000,0.000000,0.502718 +0.863923,0.000000,0.000000,0.503623 +0.863396,0.000000,0.000000,0.504528 +0.862867,0.000000,0.000000,0.505431 +0.862337,0.000000,0.000000,0.506335 +0.861806,0.000000,0.000000,0.507238 +0.861275,0.000000,0.000000,0.508140 +0.860742,0.000000,0.000000,0.509041 +0.860208,0.000000,0.000000,0.509943 +0.859674,0.000000,0.000000,0.510843 +0.859139,0.000000,0.000000,0.511743 +0.858602,0.000000,0.000000,0.512642 +0.858065,0.000000,0.000000,0.513541 +0.857527,0.000000,0.000000,0.514440 +0.856987,0.000000,0.000000,0.515337 +0.856447,0.000000,0.000000,0.516234 +0.855906,0.000000,0.000000,0.517131 +0.855364,0.000000,0.000000,0.518027 +0.854821,0.000000,0.000000,0.518922 +0.854277,0.000000,0.000000,0.519817 +0.853733,0.000000,0.000000,0.520712 +0.853187,0.000000,0.000000,0.521605 +0.852640,0.000000,0.000000,0.522499 +0.852093,0.000000,0.000000,0.523391 +0.851544,0.000000,0.000000,0.524283 +0.850994,0.000000,0.000000,0.525175 +0.850444,0.000000,0.000000,0.526066 +0.849893,0.000000,0.000000,0.526956 +0.849340,0.000000,0.000000,0.527846 +0.848787,0.000000,0.000000,0.528735 +0.848233,0.000000,0.000000,0.529623 +0.847678,0.000000,0.000000,0.530511 +0.847122,0.000000,0.000000,0.531399 +0.846565,0.000000,0.000000,0.532285 +0.846007,0.000000,0.000000,0.533172 +0.845448,0.000000,0.000000,0.534057 +0.844889,0.000000,0.000000,0.534942 +0.844328,0.000000,0.000000,0.535827 +0.843766,0.000000,0.000000,0.536711 +0.843204,0.000000,0.000000,0.537594 +0.842640,0.000000,0.000000,0.538477 +0.842076,0.000000,0.000000,0.539359 +0.841511,0.000000,0.000000,0.540240 +0.840945,0.000000,0.000000,0.541121 +0.840377,0.000000,0.000000,0.542002 +0.839809,0.000000,0.000000,0.542881 +0.839240,0.000000,0.000000,0.543760 +0.838671,0.000000,0.000000,0.544639 +0.838100,0.000000,0.000000,0.545517 +0.837528,0.000000,0.000000,0.546394 +0.836955,0.000000,0.000000,0.547271 +0.836382,0.000000,0.000000,0.548147 +0.835807,0.000000,0.000000,0.549023 +0.835232,0.000000,0.000000,0.549898 +0.834656,0.000000,0.000000,0.550772 +0.834078,0.000000,0.000000,0.551646 +0.833500,0.000000,0.000000,0.552519 +0.832921,0.000000,0.000000,0.553392 +0.832341,0.000000,0.000000,0.554263 +0.831760,0.000000,0.000000,0.555135 +0.831179,0.000000,0.000000,0.556006 +0.830596,0.000000,0.000000,0.556876 +0.830012,0.000000,0.000000,0.557745 +0.829428,0.000000,0.000000,0.558614 +0.828842,0.000000,0.000000,0.559482 +0.828256,0.000000,0.000000,0.560350 +0.827669,0.000000,0.000000,0.561217 +0.827081,0.000000,0.000000,0.562083 +0.826492,0.000000,0.000000,0.562949 +0.825902,0.000000,0.000000,0.563814 +0.825311,0.000000,0.000000,0.564679 +0.824719,0.000000,0.000000,0.565543 +0.824126,0.000000,0.000000,0.566406 +0.823533,0.000000,0.000000,0.567269 +0.822938,0.000000,0.000000,0.568131 +0.822343,0.000000,0.000000,0.568993 +0.821746,0.000000,0.000000,0.569853 +0.821149,0.000000,0.000000,0.570714 +0.820551,0.000000,0.000000,0.571573 +0.819952,0.000000,0.000000,0.572432 +0.819352,0.000000,0.000000,0.573290 +0.818751,0.000000,0.000000,0.574148 +0.818150,0.000000,0.000000,0.575005 +0.817547,0.000000,0.000000,0.575862 +0.816944,0.000000,0.000000,0.576718 +0.816339,0.000000,0.000000,0.577573 +0.815734,0.000000,0.000000,0.578427 +0.815128,0.000000,0.000000,0.579281 +0.814521,0.000000,0.000000,0.580134 +0.813913,0.000000,0.000000,0.580987 +0.813304,0.000000,0.000000,0.581839 +0.812694,0.000000,0.000000,0.582690 +0.812084,0.000000,0.000000,0.583541 +0.811472,0.000000,0.000000,0.584391 +0.810860,0.000000,0.000000,0.585241 +0.810246,0.000000,0.000000,0.586090 +0.809632,0.000000,0.000000,0.586938 +0.809017,0.000000,0.000000,0.587785 +0.808401,0.000000,0.000000,0.588632 +0.807784,0.000000,0.000000,0.589478 +0.807166,0.000000,0.000000,0.590324 +0.806548,0.000000,0.000000,0.591169 +0.805928,0.000000,0.000000,0.592013 +0.805308,0.000000,0.000000,0.592857 +0.804687,0.000000,0.000000,0.593700 +0.804064,0.000000,0.000000,0.594542 +0.803441,0.000000,0.000000,0.595384 +0.802817,0.000000,0.000000,0.596225 +0.802193,0.000000,0.000000,0.597065 +0.801567,0.000000,0.000000,0.597905 +0.800940,0.000000,0.000000,0.598744 +0.800313,0.000000,0.000000,0.599582 +0.799685,0.000000,0.000000,0.600420 +0.799055,0.000000,0.000000,0.601257 +0.798425,0.000000,0.000000,0.602094 +0.797794,0.000000,0.000000,0.602930 +0.797163,0.000000,0.000000,0.603765 +0.796530,0.000000,0.000000,0.604599 +0.795896,0.000000,0.000000,0.605433 +0.795262,0.000000,0.000000,0.606266 +0.794627,0.000000,0.000000,0.607098 +0.793990,0.000000,0.000000,0.607930 +0.793353,0.000000,0.000000,0.608761 +0.792715,0.000000,0.000000,0.609592 +0.792077,0.000000,0.000000,0.610422 +0.791437,0.000000,0.000000,0.611251 +0.790796,0.000000,0.000000,0.612079 +0.790155,0.000000,0.000000,0.612907 +0.789513,0.000000,0.000000,0.613734 +0.788870,0.000000,0.000000,0.614561 +0.788226,0.000000,0.000000,0.615386 +0.787581,0.000000,0.000000,0.616211 +0.786935,0.000000,0.000000,0.617036 +0.786288,0.000000,0.000000,0.617860 +0.785641,0.000000,0.000000,0.618683 +0.784993,0.000000,0.000000,0.619505 +0.784343,0.000000,0.000000,0.620327 +0.783693,0.000000,0.000000,0.621148 +0.783043,0.000000,0.000000,0.621968 +0.782391,0.000000,0.000000,0.622788 +0.781738,0.000000,0.000000,0.623607 +0.781085,0.000000,0.000000,0.624425 +0.780430,0.000000,0.000000,0.625243 +0.779775,0.000000,0.000000,0.626060 +0.779119,0.000000,0.000000,0.626876 +0.778462,0.000000,0.000000,0.627691 +0.777805,0.000000,0.000000,0.628506 +0.777146,0.000000,0.000000,0.629320 +0.776487,0.000000,0.000000,0.630134 +0.775826,0.000000,0.000000,0.630947 +0.775165,0.000000,0.000000,0.631759 +0.774503,0.000000,0.000000,0.632570 +0.773840,0.000000,0.000000,0.633381 +0.773177,0.000000,0.000000,0.634191 +0.772512,0.000000,0.000000,0.635000 +0.771847,0.000000,0.000000,0.635809 +0.771180,0.000000,0.000000,0.636617 +0.770513,0.000000,0.000000,0.637424 +0.769845,0.000000,0.000000,0.638231 +0.769177,0.000000,0.000000,0.639036 +0.768507,0.000000,0.000000,0.639841 +0.767836,0.000000,0.000000,0.640646 +0.767165,0.000000,0.000000,0.641450 +0.766493,0.000000,0.000000,0.642253 +0.765820,0.000000,0.000000,0.643055 +0.765146,0.000000,0.000000,0.643857 +0.764472,0.000000,0.000000,0.644657 +0.763796,0.000000,0.000000,0.645458 +0.763120,0.000000,0.000000,0.646257 +0.762443,0.000000,0.000000,0.647056 +0.761764,0.000000,0.000000,0.647854 +0.761086,0.000000,0.000000,0.648651 +0.760406,0.000000,0.000000,0.649448 +0.759725,0.000000,0.000000,0.650244 +0.759044,0.000000,0.000000,0.651039 +0.758362,0.000000,0.000000,0.651834 +0.757679,0.000000,0.000000,0.652628 +0.756995,0.000000,0.000000,0.653421 +0.756310,0.000000,0.000000,0.654213 +0.755625,0.000000,0.000000,0.655005 +0.754939,0.000000,0.000000,0.655796 +0.754251,0.000000,0.000000,0.656586 +0.753563,0.000000,0.000000,0.657375 +0.752875,0.000000,0.000000,0.658164 +0.752185,0.000000,0.000000,0.658952 +0.751494,0.000000,0.000000,0.659739 +0.750803,0.000000,0.000000,0.660526 +0.750111,0.000000,0.000000,0.661312 +0.749418,0.000000,0.000000,0.662097 +0.748724,0.000000,0.000000,0.662881 +0.748030,0.000000,0.000000,0.663665 +0.747334,0.000000,0.000000,0.664448 +0.746638,0.000000,0.000000,0.665230 +0.745941,0.000000,0.000000,0.666012 +0.745243,0.000000,0.000000,0.666793 +0.744545,0.000000,0.000000,0.667573 +0.743845,0.000000,0.000000,0.668352 +0.743145,0.000000,0.000000,0.669131 +0.742444,0.000000,0.000000,0.669908 +0.741742,0.000000,0.000000,0.670686 +0.741039,0.000000,0.000000,0.671462 +0.740335,0.000000,0.000000,0.672238 +0.739631,0.000000,0.000000,0.673013 +0.738926,0.000000,0.000000,0.673787 +0.738220,0.000000,0.000000,0.674560 +0.737513,0.000000,0.000000,0.675333 +0.736806,0.000000,0.000000,0.676105 +0.736097,0.000000,0.000000,0.676876 +0.735388,0.000000,0.000000,0.677646 +0.734678,0.000000,0.000000,0.678416 +0.733967,0.000000,0.000000,0.679185 +0.733255,0.000000,0.000000,0.679953 +0.732543,0.000000,0.000000,0.680721 +0.731830,0.000000,0.000000,0.681488 +0.731116,0.000000,0.000000,0.682254 +0.730401,0.000000,0.000000,0.683019 +0.729685,0.000000,0.000000,0.683783 +0.728969,0.000000,0.000000,0.684547 +0.728251,0.000000,0.000000,0.685310 +0.727533,0.000000,0.000000,0.686072 +0.726814,0.000000,0.000000,0.686834 +0.726095,0.000000,0.000000,0.687595 +0.725374,0.000000,0.000000,0.688355 +0.724653,0.000000,0.000000,0.689114 +0.723931,0.000000,0.000000,0.689872 +0.723208,0.000000,0.000000,0.690630 +0.722485,0.000000,0.000000,0.691387 +0.721760,0.000000,0.000000,0.692143 +0.721035,0.000000,0.000000,0.692899 +0.720309,0.000000,0.000000,0.693653 +0.719582,0.000000,0.000000,0.694407 +0.718855,0.000000,0.000000,0.695160 +0.718126,0.000000,0.000000,0.695913 +0.717397,0.000000,0.000000,0.696664 +0.716667,0.000000,0.000000,0.697415 +0.715936,0.000000,0.000000,0.698165 +0.715205,0.000000,0.000000,0.698915 +0.714473,0.000000,0.000000,0.699663 +0.713740,0.000000,0.000000,0.700411 +0.713006,0.000000,0.000000,0.701158 +0.712271,0.000000,0.000000,0.701904 +0.711536,0.000000,0.000000,0.702650 +0.710799,0.000000,0.000000,0.703395 +0.710062,0.000000,0.000000,0.704139 +0.709325,0.000000,0.000000,0.704882 +0.708586,0.000000,0.000000,0.705624 +0.707847,0.000000,0.000000,0.706366 +0.707107,0.000000,0.000000,0.707107 +0.706366,0.000000,0.000000,0.707847 +0.705624,0.000000,0.000000,0.708586 +0.704882,0.000000,0.000000,0.709325 +0.704139,0.000000,0.000000,0.710062 +0.703395,0.000000,0.000000,0.710799 +0.702650,0.000000,0.000000,0.711536 +0.701904,0.000000,0.000000,0.712271 +0.701158,0.000000,0.000000,0.713006 +0.700411,0.000000,0.000000,0.713740 +0.699663,0.000000,0.000000,0.714473 +0.698915,0.000000,0.000000,0.715205 +0.698165,0.000000,0.000000,0.715936 +0.697415,0.000000,0.000000,0.716667 +0.696664,0.000000,0.000000,0.717397 +0.695913,0.000000,0.000000,0.718126 +0.695160,0.000000,0.000000,0.718855 +0.694407,0.000000,0.000000,0.719582 +0.693653,0.000000,0.000000,0.720309 +0.692899,0.000000,0.000000,0.721035 +0.692143,0.000000,0.000000,0.721760 +0.691387,0.000000,0.000000,0.722485 +0.690630,0.000000,0.000000,0.723208 +0.689872,0.000000,0.000000,0.723931 +0.689114,0.000000,0.000000,0.724653 +0.688355,0.000000,0.000000,0.725374 +0.687595,0.000000,0.000000,0.726095 +0.686834,0.000000,0.000000,0.726814 +0.686072,0.000000,0.000000,0.727533 +0.685310,0.000000,0.000000,0.728251 +0.684547,0.000000,0.000000,0.728969 +0.683783,0.000000,0.000000,0.729685 +0.683019,0.000000,0.000000,0.730401 +0.682254,0.000000,0.000000,0.731116 +0.681488,0.000000,0.000000,0.731830 +0.680721,0.000000,0.000000,0.732543 +0.679953,0.000000,0.000000,0.733255 +0.679185,0.000000,0.000000,0.733967 +0.678416,0.000000,0.000000,0.734678 +0.677646,0.000000,0.000000,0.735388 +0.676876,0.000000,0.000000,0.736097 +0.676105,0.000000,0.000000,0.736806 +0.675333,0.000000,0.000000,0.737513 +0.674560,0.000000,0.000000,0.738220 +0.673787,0.000000,0.000000,0.738926 +0.673013,0.000000,0.000000,0.739631 +0.672238,0.000000,0.000000,0.740335 +0.671462,0.000000,0.000000,0.741039 +0.670686,0.000000,0.000000,0.741742 +0.669908,0.000000,0.000000,0.742444 +0.669131,0.000000,0.000000,0.743145 +0.668352,0.000000,0.000000,0.743845 +0.667573,0.000000,0.000000,0.744545 +0.666793,0.000000,0.000000,0.745243 +0.666012,0.000000,0.000000,0.745941 +0.665230,0.000000,0.000000,0.746638 +0.664448,0.000000,0.000000,0.747334 +0.663665,0.000000,0.000000,0.748030 +0.662881,0.000000,0.000000,0.748724 +0.662097,0.000000,0.000000,0.749418 +0.661312,0.000000,0.000000,0.750111 +0.660526,0.000000,0.000000,0.750803 +0.659739,0.000000,0.000000,0.751494 +0.658952,0.000000,0.000000,0.752185 +0.658164,0.000000,0.000000,0.752875 +0.657375,0.000000,0.000000,0.753563 +0.656586,0.000000,0.000000,0.754251 +0.655796,0.000000,0.000000,0.754939 +0.655005,0.000000,0.000000,0.755625 +0.654213,0.000000,0.000000,0.756310 +0.653421,0.000000,0.000000,0.756995 +0.652628,0.000000,0.000000,0.757679 +0.651834,0.000000,0.000000,0.758362 +0.651039,0.000000,0.000000,0.759044 +0.650244,0.000000,0.000000,0.759725 +0.649448,0.000000,0.000000,0.760406 +0.648651,0.000000,0.000000,0.761086 +0.647854,0.000000,0.000000,0.761764 +0.647056,0.000000,0.000000,0.762443 +0.646257,0.000000,0.000000,0.763120 +0.645458,0.000000,0.000000,0.763796 +0.644657,0.000000,0.000000,0.764472 +0.643857,0.000000,0.000000,0.765146 +0.643055,0.000000,0.000000,0.765820 +0.642253,0.000000,0.000000,0.766493 +0.641450,0.000000,0.000000,0.767165 +0.640646,0.000000,0.000000,0.767836 +0.639841,0.000000,0.000000,0.768507 +0.639036,0.000000,0.000000,0.769177 +0.638231,0.000000,0.000000,0.769845 +0.637424,0.000000,0.000000,0.770513 +0.636617,0.000000,0.000000,0.771180 +0.635809,0.000000,0.000000,0.771847 +0.635000,0.000000,0.000000,0.772512 +0.634191,0.000000,0.000000,0.773177 +0.633381,0.000000,0.000000,0.773840 +0.632570,0.000000,0.000000,0.774503 +0.631759,0.000000,0.000000,0.775165 +0.630947,0.000000,0.000000,0.775826 +0.630134,0.000000,0.000000,0.776487 +0.629320,0.000000,0.000000,0.777146 +0.628506,0.000000,0.000000,0.777805 +0.627691,0.000000,0.000000,0.778462 +0.626876,0.000000,0.000000,0.779119 +0.626060,0.000000,0.000000,0.779775 +0.625243,0.000000,0.000000,0.780430 +0.624425,0.000000,0.000000,0.781085 +0.623607,0.000000,0.000000,0.781738 +0.622788,0.000000,0.000000,0.782391 +0.621968,0.000000,0.000000,0.783043 +0.621148,0.000000,0.000000,0.783693 +0.620327,0.000000,0.000000,0.784343 +0.619505,0.000000,0.000000,0.784993 +0.618683,0.000000,0.000000,0.785641 +0.617860,0.000000,0.000000,0.786288 +0.617036,0.000000,0.000000,0.786935 +0.616211,0.000000,0.000000,0.787581 +0.615386,0.000000,0.000000,0.788226 +0.614561,0.000000,0.000000,0.788870 +0.613734,0.000000,0.000000,0.789513 +0.612907,0.000000,0.000000,0.790155 +0.612079,0.000000,0.000000,0.790796 +0.611251,0.000000,0.000000,0.791437 +0.610422,0.000000,0.000000,0.792077 +0.609592,0.000000,0.000000,0.792715 +0.608761,0.000000,0.000000,0.793353 +0.607930,0.000000,0.000000,0.793990 +0.607098,0.000000,0.000000,0.794627 +0.606266,0.000000,0.000000,0.795262 +0.605433,0.000000,0.000000,0.795896 +0.604599,0.000000,0.000000,0.796530 +0.603765,0.000000,0.000000,0.797163 +0.602930,0.000000,0.000000,0.797794 +0.602094,0.000000,0.000000,0.798425 +0.601257,0.000000,0.000000,0.799055 +0.600420,0.000000,0.000000,0.799685 +0.599582,0.000000,0.000000,0.800313 +0.598744,0.000000,0.000000,0.800940 +0.597905,0.000000,0.000000,0.801567 +0.597065,0.000000,0.000000,0.802193 +0.596225,0.000000,0.000000,0.802817 +0.595384,0.000000,0.000000,0.803441 +0.594542,0.000000,0.000000,0.804064 +0.593700,0.000000,0.000000,0.804687 +0.592857,0.000000,0.000000,0.805308 +0.592013,0.000000,0.000000,0.805928 +0.591169,0.000000,0.000000,0.806548 +0.590324,0.000000,0.000000,0.807166 +0.589478,0.000000,0.000000,0.807784 +0.588632,0.000000,0.000000,0.808401 +0.587785,0.000000,0.000000,0.809017 +0.586938,0.000000,0.000000,0.809632 +0.586090,0.000000,0.000000,0.810246 +0.585241,0.000000,0.000000,0.810860 +0.584391,0.000000,0.000000,0.811472 +0.583541,0.000000,0.000000,0.812084 +0.582690,0.000000,0.000000,0.812694 +0.581839,0.000000,0.000000,0.813304 +0.580987,0.000000,0.000000,0.813913 +0.580134,0.000000,0.000000,0.814521 +0.579281,0.000000,0.000000,0.815128 +0.578427,0.000000,0.000000,0.815734 +0.577573,0.000000,0.000000,0.816339 +0.576718,0.000000,0.000000,0.816944 +0.575862,0.000000,0.000000,0.817547 +0.575005,0.000000,0.000000,0.818150 +0.574148,0.000000,0.000000,0.818751 +0.573290,0.000000,0.000000,0.819352 +0.572432,0.000000,0.000000,0.819952 +0.571573,0.000000,0.000000,0.820551 +0.570714,0.000000,0.000000,0.821149 +0.569853,0.000000,0.000000,0.821746 +0.568993,0.000000,0.000000,0.822343 +0.568131,0.000000,0.000000,0.822938 +0.567269,0.000000,0.000000,0.823533 +0.566406,0.000000,0.000000,0.824126 +0.565543,0.000000,0.000000,0.824719 +0.564679,0.000000,0.000000,0.825311 +0.563814,0.000000,0.000000,0.825902 +0.562949,0.000000,0.000000,0.826492 +0.562083,0.000000,0.000000,0.827081 +0.561217,0.000000,0.000000,0.827669 +0.560350,0.000000,0.000000,0.828256 +0.559482,0.000000,0.000000,0.828842 +0.558614,0.000000,0.000000,0.829428 +0.557745,0.000000,0.000000,0.830012 +0.556876,0.000000,0.000000,0.830596 +0.556006,0.000000,0.000000,0.831179 +0.555135,0.000000,0.000000,0.831760 +0.554263,0.000000,0.000000,0.832341 +0.553392,0.000000,0.000000,0.832921 +0.552519,0.000000,0.000000,0.833500 +0.551646,0.000000,0.000000,0.834078 +0.550772,0.000000,0.000000,0.834656 +0.549898,0.000000,0.000000,0.835232 +0.549023,0.000000,0.000000,0.835807 +0.548147,0.000000,0.000000,0.836382 +0.547271,0.000000,0.000000,0.836955 +0.546394,0.000000,0.000000,0.837528 +0.545517,0.000000,0.000000,0.838100 +0.544639,0.000000,0.000000,0.838671 +0.543760,0.000000,0.000000,0.839240 +0.542881,0.000000,0.000000,0.839809 +0.542002,0.000000,0.000000,0.840377 +0.541121,0.000000,0.000000,0.840945 +0.540240,0.000000,0.000000,0.841511 +0.539359,0.000000,0.000000,0.842076 +0.538477,0.000000,0.000000,0.842640 +0.537594,0.000000,0.000000,0.843204 +0.536711,0.000000,0.000000,0.843766 +0.535827,0.000000,0.000000,0.844328 +0.534942,0.000000,0.000000,0.844889 +0.534057,0.000000,0.000000,0.845448 +0.533172,0.000000,0.000000,0.846007 +0.532285,0.000000,0.000000,0.846565 +0.531399,0.000000,0.000000,0.847122 +0.530511,0.000000,0.000000,0.847678 +0.529623,0.000000,0.000000,0.848233 +0.528735,0.000000,0.000000,0.848787 +0.527846,0.000000,0.000000,0.849340 +0.526956,0.000000,0.000000,0.849893 +0.526066,0.000000,0.000000,0.850444 +0.525175,0.000000,0.000000,0.850994 +0.524283,0.000000,0.000000,0.851544 +0.523391,0.000000,0.000000,0.852093 +0.522499,0.000000,0.000000,0.852640 +0.521605,0.000000,0.000000,0.853187 +0.520712,0.000000,0.000000,0.853733 +0.519817,0.000000,0.000000,0.854277 +0.518922,0.000000,0.000000,0.854821 +0.518027,0.000000,0.000000,0.855364 +0.517131,0.000000,0.000000,0.855906 +0.516234,0.000000,0.000000,0.856447 +0.515337,0.000000,0.000000,0.856987 +0.514440,0.000000,0.000000,0.857527 +0.513541,0.000000,0.000000,0.858065 +0.512642,0.000000,0.000000,0.858602 +0.511743,0.000000,0.000000,0.859139 +0.510843,0.000000,0.000000,0.859674 +0.509943,0.000000,0.000000,0.860208 +0.509041,0.000000,0.000000,0.860742 +0.508140,0.000000,0.000000,0.861275 +0.507238,0.000000,0.000000,0.861806 +0.506335,0.000000,0.000000,0.862337 +0.505431,0.000000,0.000000,0.862867 +0.504528,0.000000,0.000000,0.863396 +0.503623,0.000000,0.000000,0.863923 +0.502718,0.000000,0.000000,0.864450 +0.501813,0.000000,0.000000,0.864976 +0.500907,0.000000,0.000000,0.865501 +0.500000,0.000000,0.000000,0.866025 +0.499093,0.000000,0.000000,0.866549 +0.498185,0.000000,0.000000,0.867071 +0.497277,0.000000,0.000000,0.867592 +0.496368,0.000000,0.000000,0.868112 +0.495459,0.000000,0.000000,0.868632 +0.494549,0.000000,0.000000,0.869150 +0.493638,0.000000,0.000000,0.869667 +0.492727,0.000000,0.000000,0.870184 +0.491816,0.000000,0.000000,0.870699 +0.490904,0.000000,0.000000,0.871214 +0.489991,0.000000,0.000000,0.871727 +0.489078,0.000000,0.000000,0.872240 +0.488164,0.000000,0.000000,0.872752 +0.487250,0.000000,0.000000,0.873262 +0.486335,0.000000,0.000000,0.873772 +0.485420,0.000000,0.000000,0.874281 +0.484504,0.000000,0.000000,0.874789 +0.483588,0.000000,0.000000,0.875296 +0.482671,0.000000,0.000000,0.875802 +0.481754,0.000000,0.000000,0.876307 +0.480836,0.000000,0.000000,0.876811 +0.479917,0.000000,0.000000,0.877314 +0.478998,0.000000,0.000000,0.877816 +0.478079,0.000000,0.000000,0.878317 +0.477159,0.000000,0.000000,0.878817 +0.476238,0.000000,0.000000,0.879316 +0.475317,0.000000,0.000000,0.879815 +0.474396,0.000000,0.000000,0.880312 +0.473473,0.000000,0.000000,0.880808 +0.472551,0.000000,0.000000,0.881303 +0.471628,0.000000,0.000000,0.881798 +0.470704,0.000000,0.000000,0.882291 +0.469780,0.000000,0.000000,0.882784 +0.468855,0.000000,0.000000,0.883275 +0.467930,0.000000,0.000000,0.883766 +0.467004,0.000000,0.000000,0.884255 +0.466078,0.000000,0.000000,0.884744 +0.465151,0.000000,0.000000,0.885231 +0.464224,0.000000,0.000000,0.885718 +0.463296,0.000000,0.000000,0.886204 +0.462368,0.000000,0.000000,0.886688 +0.461439,0.000000,0.000000,0.887172 +0.460510,0.000000,0.000000,0.887655 +0.459580,0.000000,0.000000,0.888136 +0.458650,0.000000,0.000000,0.888617 +0.457719,0.000000,0.000000,0.889097 +0.456787,0.000000,0.000000,0.889576 +0.455856,0.000000,0.000000,0.890054 +0.454923,0.000000,0.000000,0.890531 +0.453990,0.000000,0.000000,0.891007 +0.453057,0.000000,0.000000,0.891481 +0.452123,0.000000,0.000000,0.891955 +0.451189,0.000000,0.000000,0.892428 +0.450254,0.000000,0.000000,0.892900 +0.449319,0.000000,0.000000,0.893371 +0.448383,0.000000,0.000000,0.893841 +0.447447,0.000000,0.000000,0.894310 +0.446510,0.000000,0.000000,0.894779 +0.445573,0.000000,0.000000,0.895246 +0.444635,0.000000,0.000000,0.895712 +0.443697,0.000000,0.000000,0.896177 +0.442758,0.000000,0.000000,0.896641 +0.441819,0.000000,0.000000,0.897104 +0.440879,0.000000,0.000000,0.897566 +0.439939,0.000000,0.000000,0.898028 +0.438999,0.000000,0.000000,0.898488 +0.438057,0.000000,0.000000,0.898947 +0.437116,0.000000,0.000000,0.899405 +0.436174,0.000000,0.000000,0.899863 +0.435231,0.000000,0.000000,0.900319 +0.434288,0.000000,0.000000,0.900774 +0.433345,0.000000,0.000000,0.901228 +0.432401,0.000000,0.000000,0.901682 +0.431456,0.000000,0.000000,0.902134 +0.430511,0.000000,0.000000,0.902585 +0.429566,0.000000,0.000000,0.903036 +0.428620,0.000000,0.000000,0.903485 +0.427673,0.000000,0.000000,0.903933 +0.426727,0.000000,0.000000,0.904381 +0.425779,0.000000,0.000000,0.904827 +0.424832,0.000000,0.000000,0.905272 +0.423883,0.000000,0.000000,0.905717 +0.422935,0.000000,0.000000,0.906160 +0.421985,0.000000,0.000000,0.906603 +0.421036,0.000000,0.000000,0.907044 +0.420086,0.000000,0.000000,0.907484 +0.419135,0.000000,0.000000,0.907924 +0.418184,0.000000,0.000000,0.908362 +0.417233,0.000000,0.000000,0.908800 +0.416281,0.000000,0.000000,0.909236 +0.415328,0.000000,0.000000,0.909672 +0.414376,0.000000,0.000000,0.910106 +0.413422,0.000000,0.000000,0.910539 +0.412469,0.000000,0.000000,0.910972 +0.411514,0.000000,0.000000,0.911403 +0.410560,0.000000,0.000000,0.911834 +0.409605,0.000000,0.000000,0.912263 +0.408649,0.000000,0.000000,0.912692 +0.407693,0.000000,0.000000,0.913119 +0.406737,0.000000,0.000000,0.913545 +0.405780,0.000000,0.000000,0.913971 +0.404822,0.000000,0.000000,0.914395 +0.403865,0.000000,0.000000,0.914819 +0.402906,0.000000,0.000000,0.915241 +0.401948,0.000000,0.000000,0.915663 +0.400989,0.000000,0.000000,0.916083 +0.400029,0.000000,0.000000,0.916502 +0.399069,0.000000,0.000000,0.916921 +0.398109,0.000000,0.000000,0.917338 +0.397148,0.000000,0.000000,0.917755 +0.396187,0.000000,0.000000,0.918170 +0.395225,0.000000,0.000000,0.918584 +0.394263,0.000000,0.000000,0.918998 +0.393300,0.000000,0.000000,0.919410 +0.392337,0.000000,0.000000,0.919821 +0.391374,0.000000,0.000000,0.920232 +0.390410,0.000000,0.000000,0.920641 +0.389445,0.000000,0.000000,0.921050 +0.388481,0.000000,0.000000,0.921457 +0.387516,0.000000,0.000000,0.921863 +0.386550,0.000000,0.000000,0.922268 +0.385584,0.000000,0.000000,0.922673 +0.384618,0.000000,0.000000,0.923076 +0.383651,0.000000,0.000000,0.923478 +0.382683,0.000000,0.000000,0.923880 +0.381716,0.000000,0.000000,0.924280 +0.380748,0.000000,0.000000,0.924679 +0.379779,0.000000,0.000000,0.925077 +0.378810,0.000000,0.000000,0.925474 +0.377841,0.000000,0.000000,0.925871 +0.376871,0.000000,0.000000,0.926266 +0.375901,0.000000,0.000000,0.926660 +0.374930,0.000000,0.000000,0.927053 +0.373959,0.000000,0.000000,0.927445 +0.372988,0.000000,0.000000,0.927836 +0.372016,0.000000,0.000000,0.928226 +0.371044,0.000000,0.000000,0.928615 +0.370071,0.000000,0.000000,0.929003 +0.369098,0.000000,0.000000,0.929390 +0.368125,0.000000,0.000000,0.929776 +0.367151,0.000000,0.000000,0.930161 +0.366176,0.000000,0.000000,0.930545 +0.365202,0.000000,0.000000,0.930928 +0.364227,0.000000,0.000000,0.931310 +0.363251,0.000000,0.000000,0.931691 +0.362275,0.000000,0.000000,0.932071 +0.361299,0.000000,0.000000,0.932450 +0.360322,0.000000,0.000000,0.932828 +0.359345,0.000000,0.000000,0.933205 +0.358368,0.000000,0.000000,0.933580 +0.357390,0.000000,0.000000,0.933955 +0.356412,0.000000,0.000000,0.934329 +0.355433,0.000000,0.000000,0.934702 +0.354454,0.000000,0.000000,0.935073 +0.353475,0.000000,0.000000,0.935444 +0.352495,0.000000,0.000000,0.935814 +0.351515,0.000000,0.000000,0.936182 +0.350534,0.000000,0.000000,0.936550 +0.349553,0.000000,0.000000,0.936916 +0.348572,0.000000,0.000000,0.937282 +0.347590,0.000000,0.000000,0.937646 +0.346608,0.000000,0.000000,0.938010 +0.345626,0.000000,0.000000,0.938372 +0.344643,0.000000,0.000000,0.938734 +0.343660,0.000000,0.000000,0.939094 +0.342676,0.000000,0.000000,0.939454 +0.341692,0.000000,0.000000,0.939812 +0.340708,0.000000,0.000000,0.940169 +0.339723,0.000000,0.000000,0.940526 +0.338738,0.000000,0.000000,0.940881 +0.337752,0.000000,0.000000,0.941235 +0.336767,0.000000,0.000000,0.941588 +0.335780,0.000000,0.000000,0.941940 +0.334794,0.000000,0.000000,0.942291 +0.333807,0.000000,0.000000,0.942641 +0.332820,0.000000,0.000000,0.942991 +0.331832,0.000000,0.000000,0.943339 +0.330844,0.000000,0.000000,0.943686 +0.329855,0.000000,0.000000,0.944031 +0.328867,0.000000,0.000000,0.944376 +0.327878,0.000000,0.000000,0.944720 +0.326888,0.000000,0.000000,0.945063 +0.325898,0.000000,0.000000,0.945405 +0.324908,0.000000,0.000000,0.945746 +0.323917,0.000000,0.000000,0.946085 +0.322927,0.000000,0.000000,0.946424 +0.321935,0.000000,0.000000,0.946762 +0.320944,0.000000,0.000000,0.947098 +0.319952,0.000000,0.000000,0.947434 +0.318959,0.000000,0.000000,0.947768 +0.317967,0.000000,0.000000,0.948102 +0.316974,0.000000,0.000000,0.948434 +0.315980,0.000000,0.000000,0.948766 +0.314987,0.000000,0.000000,0.949096 +0.313992,0.000000,0.000000,0.949425 +0.312998,0.000000,0.000000,0.949754 +0.312003,0.000000,0.000000,0.950081 +0.311008,0.000000,0.000000,0.950407 +0.310013,0.000000,0.000000,0.950732 +0.309017,0.000000,0.000000,0.951057 +0.308021,0.000000,0.000000,0.951380 +0.307024,0.000000,0.000000,0.951702 +0.306028,0.000000,0.000000,0.952023 +0.305031,0.000000,0.000000,0.952343 +0.304033,0.000000,0.000000,0.952661 +0.303035,0.000000,0.000000,0.952979 +0.302037,0.000000,0.000000,0.953296 +0.301039,0.000000,0.000000,0.953612 +0.300040,0.000000,0.000000,0.953927 +0.299041,0.000000,0.000000,0.954240 +0.298041,0.000000,0.000000,0.954553 +0.297042,0.000000,0.000000,0.954865 +0.296041,0.000000,0.000000,0.955175 +0.295041,0.000000,0.000000,0.955485 +0.294040,0.000000,0.000000,0.955793 +0.293039,0.000000,0.000000,0.956100 +0.292038,0.000000,0.000000,0.956407 +0.291036,0.000000,0.000000,0.956712 +0.290034,0.000000,0.000000,0.957016 +0.289032,0.000000,0.000000,0.957319 +0.288029,0.000000,0.000000,0.957622 +0.287026,0.000000,0.000000,0.957923 +0.286023,0.000000,0.000000,0.958223 +0.285019,0.000000,0.000000,0.958522 +0.284015,0.000000,0.000000,0.958820 +0.283011,0.000000,0.000000,0.959117 +0.282007,0.000000,0.000000,0.959412 +0.281002,0.000000,0.000000,0.959707 +0.279997,0.000000,0.000000,0.960001 +0.278991,0.000000,0.000000,0.960294 +0.277985,0.000000,0.000000,0.960585 +0.276979,0.000000,0.000000,0.960876 +0.275973,0.000000,0.000000,0.961165 +0.274966,0.000000,0.000000,0.961454 +0.273959,0.000000,0.000000,0.961741 +0.272952,0.000000,0.000000,0.962028 +0.271944,0.000000,0.000000,0.962313 +0.270936,0.000000,0.000000,0.962597 +0.269928,0.000000,0.000000,0.962880 +0.268920,0.000000,0.000000,0.963163 +0.267911,0.000000,0.000000,0.963444 +0.266902,0.000000,0.000000,0.963724 +0.265893,0.000000,0.000000,0.964003 +0.264883,0.000000,0.000000,0.964281 +0.263873,0.000000,0.000000,0.964557 +0.262863,0.000000,0.000000,0.964833 +0.261852,0.000000,0.000000,0.965108 +0.260842,0.000000,0.000000,0.965382 +0.259830,0.000000,0.000000,0.965654 +0.258819,0.000000,0.000000,0.965926 +0.257807,0.000000,0.000000,0.966196 +0.256795,0.000000,0.000000,0.966466 +0.255783,0.000000,0.000000,0.966734 +0.254771,0.000000,0.000000,0.967001 +0.253758,0.000000,0.000000,0.967268 +0.252745,0.000000,0.000000,0.967533 +0.251732,0.000000,0.000000,0.967797 +0.250718,0.000000,0.000000,0.968060 +0.249704,0.000000,0.000000,0.968322 +0.248690,0.000000,0.000000,0.968583 +0.247675,0.000000,0.000000,0.968843 +0.246661,0.000000,0.000000,0.969102 +0.245646,0.000000,0.000000,0.969360 +0.244631,0.000000,0.000000,0.969616 +0.243615,0.000000,0.000000,0.969872 +0.242599,0.000000,0.000000,0.970127 +0.241583,0.000000,0.000000,0.970380 +0.240567,0.000000,0.000000,0.970633 +0.239550,0.000000,0.000000,0.970884 +0.238533,0.000000,0.000000,0.971134 +0.237516,0.000000,0.000000,0.971384 +0.236499,0.000000,0.000000,0.971632 +0.235481,0.000000,0.000000,0.971879 +0.234463,0.000000,0.000000,0.972125 +0.233445,0.000000,0.000000,0.972370 +0.232427,0.000000,0.000000,0.972614 +0.231408,0.000000,0.000000,0.972857 +0.230389,0.000000,0.000000,0.973099 +0.229370,0.000000,0.000000,0.973339 +0.228351,0.000000,0.000000,0.973579 +0.227331,0.000000,0.000000,0.973817 +0.226311,0.000000,0.000000,0.974055 +0.225291,0.000000,0.000000,0.974291 +0.224271,0.000000,0.000000,0.974527 +0.223250,0.000000,0.000000,0.974761 +0.222229,0.000000,0.000000,0.974994 +0.221208,0.000000,0.000000,0.975227 +0.220187,0.000000,0.000000,0.975458 +0.219165,0.000000,0.000000,0.975688 +0.218143,0.000000,0.000000,0.975917 +0.217121,0.000000,0.000000,0.976145 +0.216099,0.000000,0.000000,0.976371 +0.215076,0.000000,0.000000,0.976597 +0.214053,0.000000,0.000000,0.976822 +0.213030,0.000000,0.000000,0.977046 +0.212007,0.000000,0.000000,0.977268 +0.210984,0.000000,0.000000,0.977490 +0.209960,0.000000,0.000000,0.977710 +0.208936,0.000000,0.000000,0.977929 +0.207912,0.000000,0.000000,0.978148 +0.206887,0.000000,0.000000,0.978365 +0.205863,0.000000,0.000000,0.978581 +0.204838,0.000000,0.000000,0.978796 +0.203813,0.000000,0.000000,0.979010 +0.202787,0.000000,0.000000,0.979223 +0.201762,0.000000,0.000000,0.979435 +0.200736,0.000000,0.000000,0.979645 +0.199710,0.000000,0.000000,0.979855 +0.198684,0.000000,0.000000,0.980064 +0.197657,0.000000,0.000000,0.980271 +0.196631,0.000000,0.000000,0.980478 +0.195604,0.000000,0.000000,0.980683 +0.194577,0.000000,0.000000,0.980887 +0.193549,0.000000,0.000000,0.981091 +0.192522,0.000000,0.000000,0.981293 +0.191494,0.000000,0.000000,0.981494 +0.190466,0.000000,0.000000,0.981694 +0.189438,0.000000,0.000000,0.981893 +0.188410,0.000000,0.000000,0.982090 +0.187381,0.000000,0.000000,0.982287 +0.186353,0.000000,0.000000,0.982483 +0.185324,0.000000,0.000000,0.982678 +0.184294,0.000000,0.000000,0.982871 +0.183265,0.000000,0.000000,0.983064 +0.182236,0.000000,0.000000,0.983255 +0.181206,0.000000,0.000000,0.983445 +0.180176,0.000000,0.000000,0.983634 +0.179146,0.000000,0.000000,0.983823 +0.178115,0.000000,0.000000,0.984010 +0.177085,0.000000,0.000000,0.984196 +0.176054,0.000000,0.000000,0.984381 +0.175023,0.000000,0.000000,0.984564 +0.173992,0.000000,0.000000,0.984747 +0.172961,0.000000,0.000000,0.984929 +0.171929,0.000000,0.000000,0.985109 +0.170897,0.000000,0.000000,0.985289 +0.169866,0.000000,0.000000,0.985467 +0.168833,0.000000,0.000000,0.985645 +0.167801,0.000000,0.000000,0.985821 +0.166769,0.000000,0.000000,0.985996 +0.165736,0.000000,0.000000,0.986170 +0.164703,0.000000,0.000000,0.986343 +0.163670,0.000000,0.000000,0.986515 +0.162637,0.000000,0.000000,0.986686 +0.161604,0.000000,0.000000,0.986856 +0.160570,0.000000,0.000000,0.987024 +0.159537,0.000000,0.000000,0.987192 +0.158503,0.000000,0.000000,0.987359 +0.157469,0.000000,0.000000,0.987524 +0.156434,0.000000,0.000000,0.987688 +0.155400,0.000000,0.000000,0.987852 +0.154366,0.000000,0.000000,0.988014 +0.153331,0.000000,0.000000,0.988175 +0.152296,0.000000,0.000000,0.988335 +0.151261,0.000000,0.000000,0.988494 +0.150226,0.000000,0.000000,0.988652 +0.149190,0.000000,0.000000,0.988809 +0.148155,0.000000,0.000000,0.988964 +0.147119,0.000000,0.000000,0.989119 +0.146083,0.000000,0.000000,0.989272 +0.145047,0.000000,0.000000,0.989425 +0.144011,0.000000,0.000000,0.989576 +0.142974,0.000000,0.000000,0.989726 +0.141938,0.000000,0.000000,0.989876 +0.140901,0.000000,0.000000,0.990024 +0.139864,0.000000,0.000000,0.990171 +0.138827,0.000000,0.000000,0.990317 +0.137790,0.000000,0.000000,0.990461 +0.136753,0.000000,0.000000,0.990605 +0.135716,0.000000,0.000000,0.990748 +0.134678,0.000000,0.000000,0.990889 +0.133640,0.000000,0.000000,0.991030 +0.132602,0.000000,0.000000,0.991169 +0.131564,0.000000,0.000000,0.991308 +0.130526,0.000000,0.000000,0.991445 +0.129488,0.000000,0.000000,0.991581 +0.128449,0.000000,0.000000,0.991716 +0.127411,0.000000,0.000000,0.991850 +0.126372,0.000000,0.000000,0.991983 +0.125333,0.000000,0.000000,0.992115 +0.124294,0.000000,0.000000,0.992245 +0.123255,0.000000,0.000000,0.992375 +0.122216,0.000000,0.000000,0.992504 +0.121176,0.000000,0.000000,0.992631 +0.120137,0.000000,0.000000,0.992757 +0.119097,0.000000,0.000000,0.992883 +0.118057,0.000000,0.000000,0.993007 +0.117017,0.000000,0.000000,0.993130 +0.115977,0.000000,0.000000,0.993252 +0.114937,0.000000,0.000000,0.993373 +0.113897,0.000000,0.000000,0.993493 +0.112856,0.000000,0.000000,0.993611 +0.111816,0.000000,0.000000,0.993729 +0.110775,0.000000,0.000000,0.993845 +0.109734,0.000000,0.000000,0.993961 +0.108693,0.000000,0.000000,0.994075 +0.107652,0.000000,0.000000,0.994189 +0.106611,0.000000,0.000000,0.994301 +0.105570,0.000000,0.000000,0.994412 +0.104528,0.000000,0.000000,0.994522 +0.103487,0.000000,0.000000,0.994631 +0.102445,0.000000,0.000000,0.994739 +0.101404,0.000000,0.000000,0.994845 +0.100362,0.000000,0.000000,0.994951 +0.099320,0.000000,0.000000,0.995056 +0.098278,0.000000,0.000000,0.995159 +0.097235,0.000000,0.000000,0.995261 +0.096193,0.000000,0.000000,0.995363 +0.095151,0.000000,0.000000,0.995463 +0.094108,0.000000,0.000000,0.995562 +0.093066,0.000000,0.000000,0.995660 +0.092023,0.000000,0.000000,0.995757 +0.090980,0.000000,0.000000,0.995853 +0.089937,0.000000,0.000000,0.995947 +0.088894,0.000000,0.000000,0.996041 +0.087851,0.000000,0.000000,0.996134 +0.086808,0.000000,0.000000,0.996225 +0.085765,0.000000,0.000000,0.996315 +0.084721,0.000000,0.000000,0.996405 +0.083678,0.000000,0.000000,0.996493 +0.082634,0.000000,0.000000,0.996580 +0.081591,0.000000,0.000000,0.996666 +0.080547,0.000000,0.000000,0.996751 +0.079503,0.000000,0.000000,0.996835 +0.078459,0.000000,0.000000,0.996917 +0.077415,0.000000,0.000000,0.996999 +0.076371,0.000000,0.000000,0.997079 +0.075327,0.000000,0.000000,0.997159 +0.074283,0.000000,0.000000,0.997237 +0.073238,0.000000,0.000000,0.997314 +0.072194,0.000000,0.000000,0.997391 +0.071149,0.000000,0.000000,0.997466 +0.070105,0.000000,0.000000,0.997540 +0.069060,0.000000,0.000000,0.997613 +0.068015,0.000000,0.000000,0.997684 +0.066970,0.000000,0.000000,0.997755 +0.065926,0.000000,0.000000,0.997825 +0.064881,0.000000,0.000000,0.997893 +0.063836,0.000000,0.000000,0.997960 +0.062791,0.000000,0.000000,0.998027 +0.061745,0.000000,0.000000,0.998092 +0.060700,0.000000,0.000000,0.998156 +0.059655,0.000000,0.000000,0.998219 +0.058609,0.000000,0.000000,0.998281 +0.057564,0.000000,0.000000,0.998342 +0.056519,0.000000,0.000000,0.998402 +0.055473,0.000000,0.000000,0.998460 +0.054427,0.000000,0.000000,0.998518 +0.053382,0.000000,0.000000,0.998574 +0.052336,0.000000,0.000000,0.998630 +0.051290,0.000000,0.000000,0.998684 +0.050244,0.000000,0.000000,0.998737 +0.049198,0.000000,0.000000,0.998789 +0.048152,0.000000,0.000000,0.998840 +0.047106,0.000000,0.000000,0.998890 +0.046060,0.000000,0.000000,0.998939 +0.045014,0.000000,0.000000,0.998986 +0.043968,0.000000,0.000000,0.999033 +0.042922,0.000000,0.000000,0.999078 +0.041876,0.000000,0.000000,0.999123 +0.040829,0.000000,0.000000,0.999166 +0.039783,0.000000,0.000000,0.999208 +0.038737,0.000000,0.000000,0.999249 +0.037690,0.000000,0.000000,0.999289 +0.036644,0.000000,0.000000,0.999328 +0.035597,0.000000,0.000000,0.999366 +0.034551,0.000000,0.000000,0.999403 +0.033504,0.000000,0.000000,0.999439 +0.032457,0.000000,0.000000,0.999473 +0.031411,0.000000,0.000000,0.999507 +0.030364,0.000000,0.000000,0.999539 +0.029317,0.000000,0.000000,0.999570 +0.028271,0.000000,0.000000,0.999600 +0.027224,0.000000,0.000000,0.999629 +0.026177,0.000000,0.000000,0.999657 +0.025130,0.000000,0.000000,0.999684 +0.024083,0.000000,0.000000,0.999710 +0.023036,0.000000,0.000000,0.999735 +0.021989,0.000000,0.000000,0.999758 +0.020942,0.000000,0.000000,0.999781 +0.019895,0.000000,0.000000,0.999802 +0.018848,0.000000,0.000000,0.999822 +0.017801,0.000000,0.000000,0.999842 +0.016754,0.000000,0.000000,0.999860 +0.015707,0.000000,0.000000,0.999877 +0.014660,0.000000,0.000000,0.999893 +0.013613,0.000000,0.000000,0.999907 +0.012566,0.000000,0.000000,0.999921 +0.011519,0.000000,0.000000,0.999934 +0.010472,0.000000,0.000000,0.999945 +0.009425,0.000000,0.000000,0.999956 +0.008377,0.000000,0.000000,0.999965 +0.007330,0.000000,0.000000,0.999973 +0.006283,0.000000,0.000000,0.999980 +0.005236,0.000000,0.000000,0.999986 +0.004189,0.000000,0.000000,0.999991 +0.003142,0.000000,0.000000,0.999995 +0.002094,0.000000,0.000000,0.999998 +0.001047,0.000000,0.000000,0.999999 +0.000000,0.000000,0.000000,1.000000 +-0.001047,-0.000000,0.000000,0.999999 +-0.002094,-0.000000,0.000000,0.999998 +-0.003142,-0.000000,0.000000,0.999995 +-0.004189,-0.000000,0.000000,0.999991 +-0.005236,-0.000000,0.000000,0.999986 +-0.006283,-0.000000,0.000000,0.999980 +-0.007330,-0.000000,0.000000,0.999973 +-0.008377,-0.000000,0.000000,0.999965 +-0.009425,-0.000000,0.000000,0.999956 +-0.010472,-0.000000,0.000000,0.999945 +-0.011519,-0.000000,0.000000,0.999934 +-0.012566,-0.000000,0.000000,0.999921 +-0.013613,-0.000000,0.000000,0.999907 +-0.014660,-0.000000,0.000000,0.999893 +-0.015707,-0.000000,0.000000,0.999877 +-0.016754,-0.000000,0.000000,0.999860 +-0.017801,-0.000000,0.000000,0.999842 +-0.018848,-0.000000,0.000000,0.999822 +-0.019895,-0.000000,0.000000,0.999802 +-0.020942,-0.000000,0.000000,0.999781 +-0.021989,-0.000000,0.000000,0.999758 +-0.023036,-0.000000,0.000000,0.999735 +-0.024083,-0.000000,0.000000,0.999710 +-0.025130,-0.000000,0.000000,0.999684 +-0.026177,-0.000000,0.000000,0.999657 +-0.027224,-0.000000,0.000000,0.999629 +-0.028271,-0.000000,0.000000,0.999600 +-0.029317,-0.000000,0.000000,0.999570 +-0.030364,-0.000000,0.000000,0.999539 +-0.031411,-0.000000,0.000000,0.999507 +-0.032457,-0.000000,0.000000,0.999473 +-0.033504,-0.000000,0.000000,0.999439 +-0.034551,-0.000000,0.000000,0.999403 +-0.035597,-0.000000,0.000000,0.999366 +-0.036644,-0.000000,0.000000,0.999328 +-0.037690,-0.000000,0.000000,0.999289 +-0.038737,-0.000000,0.000000,0.999249 +-0.039783,-0.000000,0.000000,0.999208 +-0.040829,-0.000000,0.000000,0.999166 +-0.041876,-0.000000,0.000000,0.999123 +-0.042922,-0.000000,0.000000,0.999078 +-0.043968,-0.000000,0.000000,0.999033 +-0.045014,-0.000000,0.000000,0.998986 +-0.046060,-0.000000,0.000000,0.998939 +-0.047106,-0.000000,0.000000,0.998890 +-0.048152,-0.000000,0.000000,0.998840 +-0.049198,-0.000000,0.000000,0.998789 +-0.050244,-0.000000,0.000000,0.998737 +-0.051290,-0.000000,0.000000,0.998684 +-0.052336,-0.000000,0.000000,0.998630 +-0.053382,-0.000000,0.000000,0.998574 +-0.054427,-0.000000,0.000000,0.998518 +-0.055473,-0.000000,0.000000,0.998460 +-0.056519,-0.000000,0.000000,0.998402 +-0.057564,-0.000000,0.000000,0.998342 +-0.058609,-0.000000,0.000000,0.998281 +-0.059655,-0.000000,0.000000,0.998219 +-0.060700,-0.000000,0.000000,0.998156 +-0.061745,-0.000000,0.000000,0.998092 +-0.062791,-0.000000,0.000000,0.998027 +-0.063836,-0.000000,0.000000,0.997960 +-0.064881,-0.000000,0.000000,0.997893 +-0.065926,-0.000000,0.000000,0.997825 +-0.066970,-0.000000,0.000000,0.997755 +-0.068015,-0.000000,0.000000,0.997684 +-0.069060,-0.000000,0.000000,0.997613 +-0.070105,-0.000000,0.000000,0.997540 +-0.071149,-0.000000,0.000000,0.997466 +-0.072194,-0.000000,0.000000,0.997391 +-0.073238,-0.000000,0.000000,0.997314 +-0.074283,-0.000000,0.000000,0.997237 +-0.075327,-0.000000,0.000000,0.997159 +-0.076371,-0.000000,0.000000,0.997079 +-0.077415,-0.000000,0.000000,0.996999 +-0.078459,-0.000000,0.000000,0.996917 +-0.079503,-0.000000,0.000000,0.996835 +-0.080547,-0.000000,0.000000,0.996751 +-0.081591,-0.000000,0.000000,0.996666 +-0.082634,-0.000000,0.000000,0.996580 +-0.083678,-0.000000,0.000000,0.996493 +-0.084721,-0.000000,0.000000,0.996405 +-0.085765,-0.000000,0.000000,0.996315 +-0.086808,-0.000000,0.000000,0.996225 +-0.087851,-0.000000,0.000000,0.996134 +-0.088894,-0.000000,0.000000,0.996041 +-0.089937,-0.000000,0.000000,0.995947 +-0.090980,-0.000000,0.000000,0.995853 +-0.092023,-0.000000,0.000000,0.995757 +-0.093066,-0.000000,0.000000,0.995660 +-0.094108,-0.000000,0.000000,0.995562 +-0.095151,-0.000000,0.000000,0.995463 +-0.096193,-0.000000,0.000000,0.995363 +-0.097235,-0.000000,0.000000,0.995261 +-0.098278,-0.000000,0.000000,0.995159 +-0.099320,-0.000000,0.000000,0.995056 +-0.100362,-0.000000,0.000000,0.994951 +-0.101404,-0.000000,0.000000,0.994845 +-0.102445,-0.000000,0.000000,0.994739 +-0.103487,-0.000000,0.000000,0.994631 +-0.104528,-0.000000,0.000000,0.994522 +-0.105570,-0.000000,0.000000,0.994412 +-0.106611,-0.000000,0.000000,0.994301 +-0.107652,-0.000000,0.000000,0.994189 +-0.108693,-0.000000,0.000000,0.994075 +-0.109734,-0.000000,0.000000,0.993961 +-0.110775,-0.000000,0.000000,0.993845 +-0.111816,-0.000000,0.000000,0.993729 +-0.112856,-0.000000,0.000000,0.993611 +-0.113897,-0.000000,0.000000,0.993493 +-0.114937,-0.000000,0.000000,0.993373 +-0.115977,-0.000000,0.000000,0.993252 +-0.117017,-0.000000,0.000000,0.993130 +-0.118057,-0.000000,0.000000,0.993007 +-0.119097,-0.000000,0.000000,0.992883 +-0.120137,-0.000000,0.000000,0.992757 +-0.121176,-0.000000,0.000000,0.992631 +-0.122216,-0.000000,0.000000,0.992504 +-0.123255,-0.000000,0.000000,0.992375 +-0.124294,-0.000000,0.000000,0.992245 +-0.125333,-0.000000,0.000000,0.992115 +-0.126372,-0.000000,0.000000,0.991983 +-0.127411,-0.000000,0.000000,0.991850 +-0.128449,-0.000000,0.000000,0.991716 +-0.129488,-0.000000,0.000000,0.991581 +-0.130526,-0.000000,0.000000,0.991445 +-0.131564,-0.000000,0.000000,0.991308 +-0.132602,-0.000000,0.000000,0.991169 +-0.133640,-0.000000,0.000000,0.991030 +-0.134678,-0.000000,0.000000,0.990889 +-0.135716,-0.000000,0.000000,0.990748 +-0.136753,-0.000000,0.000000,0.990605 +-0.137790,-0.000000,0.000000,0.990461 +-0.138827,-0.000000,0.000000,0.990317 +-0.139864,-0.000000,0.000000,0.990171 +-0.140901,-0.000000,0.000000,0.990024 +-0.141938,-0.000000,0.000000,0.989876 +-0.142974,-0.000000,0.000000,0.989726 +-0.144011,-0.000000,0.000000,0.989576 +-0.145047,-0.000000,0.000000,0.989425 +-0.146083,-0.000000,0.000000,0.989272 +-0.147119,-0.000000,0.000000,0.989119 +-0.148155,-0.000000,0.000000,0.988964 +-0.149190,-0.000000,0.000000,0.988809 +-0.150226,-0.000000,0.000000,0.988652 +-0.151261,-0.000000,0.000000,0.988494 +-0.152296,-0.000000,0.000000,0.988335 +-0.153331,-0.000000,0.000000,0.988175 +-0.154366,-0.000000,0.000000,0.988014 +-0.155400,-0.000000,0.000000,0.987852 +-0.156434,-0.000000,0.000000,0.987688 +-0.157469,-0.000000,0.000000,0.987524 +-0.158503,-0.000000,0.000000,0.987359 +-0.159537,-0.000000,0.000000,0.987192 +-0.160570,-0.000000,0.000000,0.987024 +-0.161604,-0.000000,0.000000,0.986856 +-0.162637,-0.000000,0.000000,0.986686 +-0.163670,-0.000000,0.000000,0.986515 +-0.164703,-0.000000,0.000000,0.986343 +-0.165736,-0.000000,0.000000,0.986170 +-0.166769,-0.000000,0.000000,0.985996 +-0.167801,-0.000000,0.000000,0.985821 +-0.168833,-0.000000,0.000000,0.985645 +-0.169866,-0.000000,0.000000,0.985467 +-0.170897,-0.000000,0.000000,0.985289 +-0.171929,-0.000000,0.000000,0.985109 +-0.172961,-0.000000,0.000000,0.984929 +-0.173992,-0.000000,0.000000,0.984747 +-0.175023,-0.000000,0.000000,0.984564 +-0.176054,-0.000000,0.000000,0.984381 +-0.177085,-0.000000,0.000000,0.984196 +-0.178115,-0.000000,0.000000,0.984010 +-0.179146,-0.000000,0.000000,0.983823 +-0.180176,-0.000000,0.000000,0.983634 +-0.181206,-0.000000,0.000000,0.983445 +-0.182236,-0.000000,0.000000,0.983255 +-0.183265,-0.000000,0.000000,0.983064 +-0.184294,-0.000000,0.000000,0.982871 +-0.185324,-0.000000,0.000000,0.982678 +-0.186353,-0.000000,0.000000,0.982483 +-0.187381,-0.000000,0.000000,0.982287 +-0.188410,-0.000000,0.000000,0.982090 +-0.189438,-0.000000,0.000000,0.981893 +-0.190466,-0.000000,0.000000,0.981694 +-0.191494,-0.000000,0.000000,0.981494 +-0.192522,-0.000000,0.000000,0.981293 +-0.193549,-0.000000,0.000000,0.981091 +-0.194577,-0.000000,0.000000,0.980887 +-0.195604,-0.000000,0.000000,0.980683 +-0.196631,-0.000000,0.000000,0.980478 +-0.197657,-0.000000,0.000000,0.980271 +-0.198684,-0.000000,0.000000,0.980064 +-0.199710,-0.000000,0.000000,0.979855 +-0.200736,-0.000000,0.000000,0.979645 +-0.201762,-0.000000,0.000000,0.979435 +-0.202787,-0.000000,0.000000,0.979223 +-0.203813,-0.000000,0.000000,0.979010 +-0.204838,-0.000000,0.000000,0.978796 +-0.205863,-0.000000,0.000000,0.978581 +-0.206887,-0.000000,0.000000,0.978365 +-0.207912,-0.000000,0.000000,0.978148 +-0.208936,-0.000000,0.000000,0.977929 +-0.209960,-0.000000,0.000000,0.977710 +-0.210984,-0.000000,0.000000,0.977490 +-0.212007,-0.000000,0.000000,0.977268 +-0.213030,-0.000000,0.000000,0.977046 +-0.214053,-0.000000,0.000000,0.976822 +-0.215076,-0.000000,0.000000,0.976597 +-0.216099,-0.000000,0.000000,0.976371 +-0.217121,-0.000000,0.000000,0.976145 +-0.218143,-0.000000,0.000000,0.975917 +-0.219165,-0.000000,0.000000,0.975688 +-0.220187,-0.000000,0.000000,0.975458 +-0.221208,-0.000000,0.000000,0.975227 +-0.222229,-0.000000,0.000000,0.974994 +-0.223250,-0.000000,0.000000,0.974761 +-0.224271,-0.000000,0.000000,0.974527 +-0.225291,-0.000000,0.000000,0.974291 +-0.226311,-0.000000,0.000000,0.974055 +-0.227331,-0.000000,0.000000,0.973817 +-0.228351,-0.000000,0.000000,0.973579 +-0.229370,-0.000000,0.000000,0.973339 +-0.230389,-0.000000,0.000000,0.973099 +-0.231408,-0.000000,0.000000,0.972857 +-0.232427,-0.000000,0.000000,0.972614 +-0.233445,-0.000000,0.000000,0.972370 +-0.234463,-0.000000,0.000000,0.972125 +-0.235481,-0.000000,0.000000,0.971879 +-0.236499,-0.000000,0.000000,0.971632 +-0.237516,-0.000000,0.000000,0.971384 +-0.238533,-0.000000,0.000000,0.971134 +-0.239550,-0.000000,0.000000,0.970884 +-0.240567,-0.000000,0.000000,0.970633 +-0.241583,-0.000000,0.000000,0.970380 +-0.242599,-0.000000,0.000000,0.970127 +-0.243615,-0.000000,0.000000,0.969872 +-0.244631,-0.000000,0.000000,0.969616 +-0.245646,-0.000000,0.000000,0.969360 +-0.246661,-0.000000,0.000000,0.969102 +-0.247675,-0.000000,0.000000,0.968843 +-0.248690,-0.000000,0.000000,0.968583 +-0.249704,-0.000000,0.000000,0.968322 +-0.250718,-0.000000,0.000000,0.968060 +-0.251732,-0.000000,0.000000,0.967797 +-0.252745,-0.000000,0.000000,0.967533 +-0.253758,-0.000000,0.000000,0.967268 +-0.254771,-0.000000,0.000000,0.967001 +-0.255783,-0.000000,0.000000,0.966734 +-0.256795,-0.000000,0.000000,0.966466 +-0.257807,-0.000000,0.000000,0.966196 +-0.258819,-0.000000,0.000000,0.965926 +-0.259830,-0.000000,0.000000,0.965654 +-0.260842,-0.000000,0.000000,0.965382 +-0.261852,-0.000000,0.000000,0.965108 +-0.262863,-0.000000,0.000000,0.964833 +-0.263873,-0.000000,0.000000,0.964557 +-0.264883,-0.000000,0.000000,0.964281 +-0.265893,-0.000000,0.000000,0.964003 +-0.266902,-0.000000,0.000000,0.963724 +-0.267911,-0.000000,0.000000,0.963444 +-0.268920,-0.000000,0.000000,0.963163 +-0.269928,-0.000000,0.000000,0.962880 +-0.270936,-0.000000,0.000000,0.962597 +-0.271944,-0.000000,0.000000,0.962313 +-0.272952,-0.000000,0.000000,0.962028 +-0.273959,-0.000000,0.000000,0.961741 +-0.274966,-0.000000,0.000000,0.961454 +-0.275973,-0.000000,0.000000,0.961165 +-0.276979,-0.000000,0.000000,0.960876 +-0.277985,-0.000000,0.000000,0.960585 +-0.278991,-0.000000,0.000000,0.960294 +-0.279997,-0.000000,0.000000,0.960001 +-0.281002,-0.000000,0.000000,0.959707 +-0.282007,-0.000000,0.000000,0.959412 +-0.283011,-0.000000,0.000000,0.959117 +-0.284015,-0.000000,0.000000,0.958820 +-0.285019,-0.000000,0.000000,0.958522 +-0.286023,-0.000000,0.000000,0.958223 +-0.287026,-0.000000,0.000000,0.957923 +-0.288029,-0.000000,0.000000,0.957622 +-0.289032,-0.000000,0.000000,0.957319 +-0.290034,-0.000000,0.000000,0.957016 +-0.291036,-0.000000,0.000000,0.956712 +-0.292038,-0.000000,0.000000,0.956407 +-0.293039,-0.000000,0.000000,0.956100 +-0.294040,-0.000000,0.000000,0.955793 +-0.295041,-0.000000,0.000000,0.955485 +-0.296041,-0.000000,0.000000,0.955175 +-0.297042,-0.000000,0.000000,0.954865 +-0.298041,-0.000000,0.000000,0.954553 +-0.299041,-0.000000,0.000000,0.954240 +-0.300040,-0.000000,0.000000,0.953927 +-0.301039,-0.000000,0.000000,0.953612 +-0.302037,-0.000000,0.000000,0.953296 +-0.303035,-0.000000,0.000000,0.952979 +-0.304033,-0.000000,0.000000,0.952661 +-0.305031,-0.000000,0.000000,0.952343 +-0.306028,-0.000000,0.000000,0.952023 +-0.307024,-0.000000,0.000000,0.951702 +-0.308021,-0.000000,0.000000,0.951380 +-0.309017,-0.000000,0.000000,0.951057 +-0.310013,-0.000000,0.000000,0.950732 +-0.311008,-0.000000,0.000000,0.950407 +-0.312003,-0.000000,0.000000,0.950081 +-0.312998,-0.000000,0.000000,0.949754 +-0.313992,-0.000000,0.000000,0.949425 +-0.314987,-0.000000,0.000000,0.949096 +-0.315980,-0.000000,0.000000,0.948766 +-0.316974,-0.000000,0.000000,0.948434 +-0.317967,-0.000000,0.000000,0.948102 +-0.318959,-0.000000,0.000000,0.947768 +-0.319952,-0.000000,0.000000,0.947434 +-0.320944,-0.000000,0.000000,0.947098 +-0.321935,-0.000000,0.000000,0.946762 +-0.322927,-0.000000,0.000000,0.946424 +-0.323917,-0.000000,0.000000,0.946085 +-0.324908,-0.000000,0.000000,0.945746 +-0.325898,-0.000000,0.000000,0.945405 +-0.326888,-0.000000,0.000000,0.945063 +-0.327878,-0.000000,0.000000,0.944720 +-0.328867,-0.000000,0.000000,0.944376 +-0.329855,-0.000000,0.000000,0.944031 +-0.330844,-0.000000,0.000000,0.943686 +-0.331832,-0.000000,0.000000,0.943339 +-0.332820,-0.000000,0.000000,0.942991 +-0.333807,-0.000000,0.000000,0.942641 +-0.334794,-0.000000,0.000000,0.942291 +-0.335780,-0.000000,0.000000,0.941940 +-0.336767,-0.000000,0.000000,0.941588 +-0.337752,-0.000000,0.000000,0.941235 +-0.338738,-0.000000,0.000000,0.940881 +-0.339723,-0.000000,0.000000,0.940526 +-0.340708,-0.000000,0.000000,0.940169 +-0.341692,-0.000000,0.000000,0.939812 +-0.342676,-0.000000,0.000000,0.939454 +-0.343660,-0.000000,0.000000,0.939094 +-0.344643,-0.000000,0.000000,0.938734 +-0.345626,-0.000000,0.000000,0.938372 +-0.346608,-0.000000,0.000000,0.938010 +-0.347590,-0.000000,0.000000,0.937646 +-0.348572,-0.000000,0.000000,0.937282 +-0.349553,-0.000000,0.000000,0.936916 +-0.350534,-0.000000,0.000000,0.936550 +-0.351515,-0.000000,0.000000,0.936182 +-0.352495,-0.000000,0.000000,0.935814 +-0.353475,-0.000000,0.000000,0.935444 +-0.354454,-0.000000,0.000000,0.935073 +-0.355433,-0.000000,0.000000,0.934702 +-0.356412,-0.000000,0.000000,0.934329 +-0.357390,-0.000000,0.000000,0.933955 +-0.358368,-0.000000,0.000000,0.933580 +-0.359345,-0.000000,0.000000,0.933205 +-0.360322,-0.000000,0.000000,0.932828 +-0.361299,-0.000000,0.000000,0.932450 +-0.362275,-0.000000,0.000000,0.932071 +-0.363251,-0.000000,0.000000,0.931691 +-0.364227,-0.000000,0.000000,0.931310 +-0.365202,-0.000000,0.000000,0.930928 +-0.366176,-0.000000,0.000000,0.930545 +-0.367151,-0.000000,0.000000,0.930161 +-0.368125,-0.000000,0.000000,0.929776 +-0.369098,-0.000000,0.000000,0.929390 +-0.370071,-0.000000,0.000000,0.929003 +-0.371044,-0.000000,0.000000,0.928615 +-0.372016,-0.000000,0.000000,0.928226 +-0.372988,-0.000000,0.000000,0.927836 +-0.373959,-0.000000,0.000000,0.927445 +-0.374930,-0.000000,0.000000,0.927053 +-0.375901,-0.000000,0.000000,0.926660 +-0.376871,-0.000000,0.000000,0.926266 +-0.377841,-0.000000,0.000000,0.925871 +-0.378810,-0.000000,0.000000,0.925474 +-0.379779,-0.000000,0.000000,0.925077 +-0.380748,-0.000000,0.000000,0.924679 +-0.381716,-0.000000,0.000000,0.924280 +-0.382683,-0.000000,0.000000,0.923880 +-0.383651,-0.000000,0.000000,0.923478 +-0.384618,-0.000000,0.000000,0.923076 +-0.385584,-0.000000,0.000000,0.922673 +-0.386550,-0.000000,0.000000,0.922268 +-0.387516,-0.000000,0.000000,0.921863 +-0.388481,-0.000000,0.000000,0.921457 +-0.389445,-0.000000,0.000000,0.921050 +-0.390410,-0.000000,0.000000,0.920641 +-0.391374,-0.000000,0.000000,0.920232 +-0.392337,-0.000000,0.000000,0.919821 +-0.393300,-0.000000,0.000000,0.919410 +-0.394263,-0.000000,0.000000,0.918998 +-0.395225,-0.000000,0.000000,0.918584 +-0.396187,-0.000000,0.000000,0.918170 +-0.397148,-0.000000,0.000000,0.917755 +-0.398109,-0.000000,0.000000,0.917338 +-0.399069,-0.000000,0.000000,0.916921 +-0.400029,-0.000000,0.000000,0.916502 +-0.400989,-0.000000,0.000000,0.916083 +-0.401948,-0.000000,0.000000,0.915663 +-0.402906,-0.000000,0.000000,0.915241 +-0.403865,-0.000000,0.000000,0.914819 +-0.404822,-0.000000,0.000000,0.914395 +-0.405780,-0.000000,0.000000,0.913971 +-0.406737,-0.000000,0.000000,0.913545 +-0.407693,-0.000000,0.000000,0.913119 +-0.408649,-0.000000,0.000000,0.912692 +-0.409605,-0.000000,0.000000,0.912263 +-0.410560,-0.000000,0.000000,0.911834 +-0.411514,-0.000000,0.000000,0.911403 +-0.412469,-0.000000,0.000000,0.910972 +-0.413422,-0.000000,0.000000,0.910539 +-0.414376,-0.000000,0.000000,0.910106 +-0.415328,-0.000000,0.000000,0.909672 +-0.416281,-0.000000,0.000000,0.909236 +-0.417233,-0.000000,0.000000,0.908800 +-0.418184,-0.000000,0.000000,0.908362 +-0.419135,-0.000000,0.000000,0.907924 +-0.420086,-0.000000,0.000000,0.907484 +-0.421036,-0.000000,0.000000,0.907044 +-0.421985,-0.000000,0.000000,0.906603 +-0.422935,-0.000000,0.000000,0.906160 +-0.423883,-0.000000,0.000000,0.905717 +-0.424832,-0.000000,0.000000,0.905272 +-0.425779,-0.000000,0.000000,0.904827 +-0.426727,-0.000000,0.000000,0.904381 +-0.427673,-0.000000,0.000000,0.903933 +-0.428620,-0.000000,0.000000,0.903485 +-0.429566,-0.000000,0.000000,0.903036 +-0.430511,-0.000000,0.000000,0.902585 +-0.431456,-0.000000,0.000000,0.902134 +-0.432401,-0.000000,0.000000,0.901682 +-0.433345,-0.000000,0.000000,0.901228 +-0.434288,-0.000000,0.000000,0.900774 +-0.435231,-0.000000,0.000000,0.900319 +-0.436174,-0.000000,0.000000,0.899863 +-0.437116,-0.000000,0.000000,0.899405 +-0.438057,-0.000000,0.000000,0.898947 +-0.438999,-0.000000,0.000000,0.898488 +-0.439939,-0.000000,0.000000,0.898028 +-0.440879,-0.000000,0.000000,0.897566 +-0.441819,-0.000000,0.000000,0.897104 +-0.442758,-0.000000,0.000000,0.896641 +-0.443697,-0.000000,0.000000,0.896177 +-0.444635,-0.000000,0.000000,0.895712 +-0.445573,-0.000000,0.000000,0.895246 +-0.446510,-0.000000,0.000000,0.894779 +-0.447447,-0.000000,0.000000,0.894310 +-0.448383,-0.000000,0.000000,0.893841 +-0.449319,-0.000000,0.000000,0.893371 +-0.450254,-0.000000,0.000000,0.892900 +-0.451189,-0.000000,0.000000,0.892428 +-0.452123,-0.000000,0.000000,0.891955 +-0.453057,-0.000000,0.000000,0.891481 +-0.453990,-0.000000,0.000000,0.891007 +-0.454923,-0.000000,0.000000,0.890531 +-0.455856,-0.000000,0.000000,0.890054 +-0.456787,-0.000000,0.000000,0.889576 +-0.457719,-0.000000,0.000000,0.889097 +-0.458650,-0.000000,0.000000,0.888617 +-0.459580,-0.000000,0.000000,0.888136 +-0.460510,-0.000000,0.000000,0.887655 +-0.461439,-0.000000,0.000000,0.887172 +-0.462368,-0.000000,0.000000,0.886688 +-0.463296,-0.000000,0.000000,0.886204 +-0.464224,-0.000000,0.000000,0.885718 +-0.465151,-0.000000,0.000000,0.885231 +-0.466078,-0.000000,0.000000,0.884744 +-0.467004,-0.000000,0.000000,0.884255 +-0.467930,-0.000000,0.000000,0.883766 +-0.468855,-0.000000,0.000000,0.883275 +-0.469780,-0.000000,0.000000,0.882784 +-0.470704,-0.000000,0.000000,0.882291 +-0.471628,-0.000000,0.000000,0.881798 +-0.472551,-0.000000,0.000000,0.881303 +-0.473473,-0.000000,0.000000,0.880808 +-0.474396,-0.000000,0.000000,0.880312 +-0.475317,-0.000000,0.000000,0.879815 +-0.476238,-0.000000,0.000000,0.879316 +-0.477159,-0.000000,0.000000,0.878817 +-0.478079,-0.000000,0.000000,0.878317 +-0.478998,-0.000000,0.000000,0.877816 +-0.479917,-0.000000,0.000000,0.877314 +-0.480836,-0.000000,0.000000,0.876811 +-0.481754,-0.000000,0.000000,0.876307 +-0.482671,-0.000000,0.000000,0.875802 +-0.483588,-0.000000,0.000000,0.875296 +-0.484504,-0.000000,0.000000,0.874789 +-0.485420,-0.000000,0.000000,0.874281 +-0.486335,-0.000000,0.000000,0.873772 +-0.487250,-0.000000,0.000000,0.873262 +-0.488164,-0.000000,0.000000,0.872752 +-0.489078,-0.000000,0.000000,0.872240 +-0.489991,-0.000000,0.000000,0.871727 +-0.490904,-0.000000,0.000000,0.871214 +-0.491816,-0.000000,0.000000,0.870699 +-0.492727,-0.000000,0.000000,0.870184 +-0.493638,-0.000000,0.000000,0.869667 +-0.494549,-0.000000,0.000000,0.869150 +-0.495459,-0.000000,0.000000,0.868632 +-0.496368,-0.000000,0.000000,0.868112 +-0.497277,-0.000000,0.000000,0.867592 +-0.498185,-0.000000,0.000000,0.867071 +-0.499093,-0.000000,0.000000,0.866549 +-0.500000,-0.000000,0.000000,0.866025 +-0.500907,-0.000000,0.000000,0.865501 +-0.501813,-0.000000,0.000000,0.864976 +-0.502718,-0.000000,0.000000,0.864450 +-0.503623,-0.000000,0.000000,0.863923 +-0.504528,-0.000000,0.000000,0.863396 +-0.505431,-0.000000,0.000000,0.862867 +-0.506335,-0.000000,0.000000,0.862337 +-0.507238,-0.000000,0.000000,0.861806 +-0.508140,-0.000000,0.000000,0.861275 +-0.509041,-0.000000,0.000000,0.860742 +-0.509943,-0.000000,0.000000,0.860208 +-0.510843,-0.000000,0.000000,0.859674 +-0.511743,-0.000000,0.000000,0.859139 +-0.512642,-0.000000,0.000000,0.858602 +-0.513541,-0.000000,0.000000,0.858065 +-0.514440,-0.000000,0.000000,0.857527 +-0.515337,-0.000000,0.000000,0.856987 +-0.516234,-0.000000,0.000000,0.856447 +-0.517131,-0.000000,0.000000,0.855906 +-0.518027,-0.000000,0.000000,0.855364 +-0.518922,-0.000000,0.000000,0.854821 +-0.519817,-0.000000,0.000000,0.854277 +-0.520712,-0.000000,0.000000,0.853733 +-0.521605,-0.000000,0.000000,0.853187 +-0.522499,-0.000000,0.000000,0.852640 +-0.523391,-0.000000,0.000000,0.852093 +-0.524283,-0.000000,0.000000,0.851544 +-0.525175,-0.000000,0.000000,0.850994 +-0.526066,-0.000000,0.000000,0.850444 +-0.526956,-0.000000,0.000000,0.849893 +-0.527846,-0.000000,0.000000,0.849340 +-0.528735,-0.000000,0.000000,0.848787 +-0.529623,-0.000000,0.000000,0.848233 +-0.530511,-0.000000,0.000000,0.847678 +-0.531399,-0.000000,0.000000,0.847122 +-0.532285,-0.000000,0.000000,0.846565 +-0.533172,-0.000000,0.000000,0.846007 +-0.534057,-0.000000,0.000000,0.845448 +-0.534942,-0.000000,0.000000,0.844889 +-0.535827,-0.000000,0.000000,0.844328 +-0.536711,-0.000000,0.000000,0.843766 +-0.537594,-0.000000,0.000000,0.843204 +-0.538477,-0.000000,0.000000,0.842640 +-0.539359,-0.000000,0.000000,0.842076 +-0.540240,-0.000000,0.000000,0.841511 +-0.541121,-0.000000,0.000000,0.840945 +-0.542002,-0.000000,0.000000,0.840377 +-0.542881,-0.000000,0.000000,0.839809 +-0.543760,-0.000000,0.000000,0.839240 +-0.544639,-0.000000,0.000000,0.838671 +-0.545517,-0.000000,0.000000,0.838100 +-0.546394,-0.000000,0.000000,0.837528 +-0.547271,-0.000000,0.000000,0.836955 +-0.548147,-0.000000,0.000000,0.836382 +-0.549023,-0.000000,0.000000,0.835807 +-0.549898,-0.000000,0.000000,0.835232 +-0.550772,-0.000000,0.000000,0.834656 +-0.551646,-0.000000,0.000000,0.834078 +-0.552519,-0.000000,0.000000,0.833500 +-0.553392,-0.000000,0.000000,0.832921 +-0.554263,-0.000000,0.000000,0.832341 +-0.555135,-0.000000,0.000000,0.831760 +-0.556006,-0.000000,0.000000,0.831179 +-0.556876,-0.000000,0.000000,0.830596 +-0.557745,-0.000000,0.000000,0.830012 +-0.558614,-0.000000,0.000000,0.829428 +-0.559482,-0.000000,0.000000,0.828842 +-0.560350,-0.000000,0.000000,0.828256 +-0.561217,-0.000000,0.000000,0.827669 +-0.562083,-0.000000,0.000000,0.827081 +-0.562949,-0.000000,0.000000,0.826492 +-0.563814,-0.000000,0.000000,0.825902 +-0.564679,-0.000000,0.000000,0.825311 +-0.565543,-0.000000,0.000000,0.824719 +-0.566406,-0.000000,0.000000,0.824126 +-0.567269,-0.000000,0.000000,0.823533 +-0.568131,-0.000000,0.000000,0.822938 +-0.568993,-0.000000,0.000000,0.822343 +-0.569853,-0.000000,0.000000,0.821746 +-0.570714,-0.000000,0.000000,0.821149 +-0.571573,-0.000000,0.000000,0.820551 +-0.572432,-0.000000,0.000000,0.819952 +-0.573290,-0.000000,0.000000,0.819352 +-0.574148,-0.000000,0.000000,0.818751 +-0.575005,-0.000000,0.000000,0.818150 +-0.575862,-0.000000,0.000000,0.817547 +-0.576718,-0.000000,0.000000,0.816944 +-0.577573,-0.000000,0.000000,0.816339 +-0.578427,-0.000000,0.000000,0.815734 +-0.579281,-0.000000,0.000000,0.815128 +-0.580134,-0.000000,0.000000,0.814521 +-0.580987,-0.000000,0.000000,0.813913 +-0.581839,-0.000000,0.000000,0.813304 +-0.582690,-0.000000,0.000000,0.812694 +-0.583541,-0.000000,0.000000,0.812084 +-0.584391,-0.000000,0.000000,0.811472 +-0.585241,-0.000000,0.000000,0.810860 +-0.586090,-0.000000,0.000000,0.810246 +-0.586938,-0.000000,0.000000,0.809632 +-0.587785,-0.000000,0.000000,0.809017 +-0.588632,-0.000000,0.000000,0.808401 +-0.589478,-0.000000,0.000000,0.807784 +-0.590324,-0.000000,0.000000,0.807166 +-0.591169,-0.000000,0.000000,0.806548 +-0.592013,-0.000000,0.000000,0.805928 +-0.592857,-0.000000,0.000000,0.805308 +-0.593700,-0.000000,0.000000,0.804687 +-0.594542,-0.000000,0.000000,0.804064 +-0.595384,-0.000000,0.000000,0.803441 +-0.596225,-0.000000,0.000000,0.802817 +-0.597065,-0.000000,0.000000,0.802193 +-0.597905,-0.000000,0.000000,0.801567 +-0.598744,-0.000000,0.000000,0.800940 +-0.599582,-0.000000,0.000000,0.800313 +-0.600420,-0.000000,0.000000,0.799685 +-0.601257,-0.000000,0.000000,0.799055 +-0.602094,-0.000000,0.000000,0.798425 +-0.602930,-0.000000,0.000000,0.797794 +-0.603765,-0.000000,0.000000,0.797163 +-0.604599,-0.000000,0.000000,0.796530 +-0.605433,-0.000000,0.000000,0.795896 +-0.606266,-0.000000,0.000000,0.795262 +-0.607098,-0.000000,0.000000,0.794627 +-0.607930,-0.000000,0.000000,0.793990 +-0.608761,-0.000000,0.000000,0.793353 +-0.609592,-0.000000,0.000000,0.792715 +-0.610422,-0.000000,0.000000,0.792077 +-0.611251,-0.000000,0.000000,0.791437 +-0.612079,-0.000000,0.000000,0.790796 +-0.612907,-0.000000,0.000000,0.790155 +-0.613734,-0.000000,0.000000,0.789513 +-0.614561,-0.000000,0.000000,0.788870 +-0.615386,-0.000000,0.000000,0.788226 +-0.616211,-0.000000,0.000000,0.787581 +-0.617036,-0.000000,0.000000,0.786935 +-0.617860,-0.000000,0.000000,0.786288 +-0.618683,-0.000000,0.000000,0.785641 +-0.619505,-0.000000,0.000000,0.784993 +-0.620327,-0.000000,0.000000,0.784343 +-0.621148,-0.000000,0.000000,0.783693 +-0.621968,-0.000000,0.000000,0.783043 +-0.622788,-0.000000,0.000000,0.782391 +-0.623607,-0.000000,0.000000,0.781738 +-0.624425,-0.000000,0.000000,0.781085 +-0.625243,-0.000000,0.000000,0.780430 +-0.626060,-0.000000,0.000000,0.779775 +-0.626876,-0.000000,0.000000,0.779119 +-0.627691,-0.000000,0.000000,0.778462 +-0.628506,-0.000000,0.000000,0.777805 +-0.629320,-0.000000,0.000000,0.777146 +-0.630134,-0.000000,0.000000,0.776487 +-0.630947,-0.000000,0.000000,0.775826 +-0.631759,-0.000000,0.000000,0.775165 +-0.632570,-0.000000,0.000000,0.774503 +-0.633381,-0.000000,0.000000,0.773840 +-0.634191,-0.000000,0.000000,0.773177 +-0.635000,-0.000000,0.000000,0.772512 +-0.635809,-0.000000,0.000000,0.771847 +-0.636617,-0.000000,0.000000,0.771180 +-0.637424,-0.000000,0.000000,0.770513 +-0.638231,-0.000000,0.000000,0.769845 +-0.639036,-0.000000,0.000000,0.769177 +-0.639841,-0.000000,0.000000,0.768507 +-0.640646,-0.000000,0.000000,0.767836 +-0.641450,-0.000000,0.000000,0.767165 +-0.642253,-0.000000,0.000000,0.766493 +-0.643055,-0.000000,0.000000,0.765820 +-0.643857,-0.000000,0.000000,0.765146 +-0.644657,-0.000000,0.000000,0.764472 +-0.645458,-0.000000,0.000000,0.763796 +-0.646257,-0.000000,0.000000,0.763120 +-0.647056,-0.000000,0.000000,0.762443 +-0.647854,-0.000000,0.000000,0.761764 +-0.648651,-0.000000,0.000000,0.761086 +-0.649448,-0.000000,0.000000,0.760406 +-0.650244,-0.000000,0.000000,0.759725 +-0.651039,-0.000000,0.000000,0.759044 +-0.651834,-0.000000,0.000000,0.758362 +-0.652628,-0.000000,0.000000,0.757679 +-0.653421,-0.000000,0.000000,0.756995 +-0.654213,-0.000000,0.000000,0.756310 +-0.655005,-0.000000,0.000000,0.755625 +-0.655796,-0.000000,0.000000,0.754939 +-0.656586,-0.000000,0.000000,0.754251 +-0.657375,-0.000000,0.000000,0.753563 +-0.658164,-0.000000,0.000000,0.752875 +-0.658952,-0.000000,0.000000,0.752185 +-0.659739,-0.000000,0.000000,0.751494 +-0.660526,-0.000000,0.000000,0.750803 +-0.661312,-0.000000,0.000000,0.750111 +-0.662097,-0.000000,0.000000,0.749418 +-0.662881,-0.000000,0.000000,0.748724 +-0.663665,-0.000000,0.000000,0.748030 +-0.664448,-0.000000,0.000000,0.747334 +-0.665230,-0.000000,0.000000,0.746638 +-0.666012,-0.000000,0.000000,0.745941 +-0.666793,-0.000000,0.000000,0.745243 +-0.667573,-0.000000,0.000000,0.744545 +-0.668352,-0.000000,0.000000,0.743845 +-0.669131,-0.000000,0.000000,0.743145 +-0.669908,-0.000000,0.000000,0.742444 +-0.670686,-0.000000,0.000000,0.741742 +-0.671462,-0.000000,0.000000,0.741039 +-0.672238,-0.000000,0.000000,0.740335 +-0.673013,-0.000000,0.000000,0.739631 +-0.673787,-0.000000,0.000000,0.738926 +-0.674560,-0.000000,0.000000,0.738220 +-0.675333,-0.000000,0.000000,0.737513 +-0.676105,-0.000000,0.000000,0.736806 +-0.676876,-0.000000,0.000000,0.736097 +-0.677646,-0.000000,0.000000,0.735388 +-0.678416,-0.000000,0.000000,0.734678 +-0.679185,-0.000000,0.000000,0.733967 +-0.679953,-0.000000,0.000000,0.733255 +-0.680721,-0.000000,0.000000,0.732543 +-0.681488,-0.000000,0.000000,0.731830 +-0.682254,-0.000000,0.000000,0.731116 +-0.683019,-0.000000,0.000000,0.730401 +-0.683783,-0.000000,0.000000,0.729685 +-0.684547,-0.000000,0.000000,0.728969 +-0.685310,-0.000000,0.000000,0.728251 +-0.686072,-0.000000,0.000000,0.727533 +-0.686834,-0.000000,0.000000,0.726814 +-0.687595,-0.000000,0.000000,0.726095 +-0.688355,-0.000000,0.000000,0.725374 +-0.689114,-0.000000,0.000000,0.724653 +-0.689872,-0.000000,0.000000,0.723931 +-0.690630,-0.000000,0.000000,0.723208 +-0.691387,-0.000000,0.000000,0.722485 +-0.692143,-0.000000,0.000000,0.721760 +-0.692899,-0.000000,0.000000,0.721035 +-0.693653,-0.000000,0.000000,0.720309 +-0.694407,-0.000000,0.000000,0.719582 +-0.695160,-0.000000,0.000000,0.718855 +-0.695913,-0.000000,0.000000,0.718126 +-0.696664,-0.000000,0.000000,0.717397 +-0.697415,-0.000000,0.000000,0.716667 +-0.698165,-0.000000,0.000000,0.715936 +-0.698915,-0.000000,0.000000,0.715205 +-0.699663,-0.000000,0.000000,0.714473 +-0.700411,-0.000000,0.000000,0.713740 +-0.701158,-0.000000,0.000000,0.713006 +-0.701904,-0.000000,0.000000,0.712271 +-0.702650,-0.000000,0.000000,0.711536 +-0.703395,-0.000000,0.000000,0.710799 +-0.704139,-0.000000,0.000000,0.710062 +-0.704882,-0.000000,0.000000,0.709325 +-0.705624,-0.000000,0.000000,0.708586 +-0.706366,-0.000000,0.000000,0.707847 +-0.707107,-0.000000,0.000000,0.707107 +-0.707847,-0.000000,0.000000,0.706366 +-0.708586,-0.000000,0.000000,0.705624 +-0.709325,-0.000000,0.000000,0.704882 +-0.710062,-0.000000,0.000000,0.704139 +-0.710799,-0.000000,0.000000,0.703395 +-0.711536,-0.000000,0.000000,0.702650 +-0.712271,-0.000000,0.000000,0.701904 +-0.713006,-0.000000,0.000000,0.701158 +-0.713740,-0.000000,0.000000,0.700411 +-0.714473,-0.000000,0.000000,0.699663 +-0.715205,-0.000000,0.000000,0.698915 +-0.715936,-0.000000,0.000000,0.698165 +-0.716667,-0.000000,0.000000,0.697415 +-0.717397,-0.000000,0.000000,0.696664 +-0.718126,-0.000000,0.000000,0.695913 +-0.718855,-0.000000,0.000000,0.695160 +-0.719582,-0.000000,0.000000,0.694407 +-0.720309,-0.000000,0.000000,0.693653 +-0.721035,-0.000000,0.000000,0.692899 +-0.721760,-0.000000,0.000000,0.692143 +-0.722485,-0.000000,0.000000,0.691387 +-0.723208,-0.000000,0.000000,0.690630 +-0.723931,-0.000000,0.000000,0.689872 +-0.724653,-0.000000,0.000000,0.689114 +-0.725374,-0.000000,0.000000,0.688355 +-0.726095,-0.000000,0.000000,0.687595 +-0.726814,-0.000000,0.000000,0.686834 +-0.727533,-0.000000,0.000000,0.686072 +-0.728251,-0.000000,0.000000,0.685310 +-0.728969,-0.000000,0.000000,0.684547 +-0.729685,-0.000000,0.000000,0.683783 +-0.730401,-0.000000,0.000000,0.683019 +-0.731116,-0.000000,0.000000,0.682254 +-0.731830,-0.000000,0.000000,0.681488 +-0.732543,-0.000000,0.000000,0.680721 +-0.733255,-0.000000,0.000000,0.679953 +-0.733967,-0.000000,0.000000,0.679185 +-0.734678,-0.000000,0.000000,0.678416 +-0.735388,-0.000000,0.000000,0.677646 +-0.736097,-0.000000,0.000000,0.676876 +-0.736806,-0.000000,0.000000,0.676105 +-0.737513,-0.000000,0.000000,0.675333 +-0.738220,-0.000000,0.000000,0.674560 +-0.738926,-0.000000,0.000000,0.673787 +-0.739631,-0.000000,0.000000,0.673013 +-0.740335,-0.000000,0.000000,0.672238 +-0.741039,-0.000000,0.000000,0.671462 +-0.741742,-0.000000,0.000000,0.670686 +-0.742444,-0.000000,0.000000,0.669908 +-0.743145,-0.000000,0.000000,0.669131 +-0.743845,-0.000000,0.000000,0.668352 +-0.744545,-0.000000,0.000000,0.667573 +-0.745243,-0.000000,0.000000,0.666793 +-0.745941,-0.000000,0.000000,0.666012 +-0.746638,-0.000000,0.000000,0.665230 +-0.747334,-0.000000,0.000000,0.664448 +-0.748030,-0.000000,0.000000,0.663665 +-0.748724,-0.000000,0.000000,0.662881 +-0.749418,-0.000000,0.000000,0.662097 +-0.750111,-0.000000,0.000000,0.661312 +-0.750803,-0.000000,0.000000,0.660526 +-0.751494,-0.000000,0.000000,0.659739 +-0.752185,-0.000000,0.000000,0.658952 +-0.752875,-0.000000,0.000000,0.658164 +-0.753563,-0.000000,0.000000,0.657375 +-0.754251,-0.000000,0.000000,0.656586 +-0.754939,-0.000000,0.000000,0.655796 +-0.755625,-0.000000,0.000000,0.655005 +-0.756310,-0.000000,0.000000,0.654213 +-0.756995,-0.000000,0.000000,0.653421 +-0.757679,-0.000000,0.000000,0.652628 +-0.758362,-0.000000,0.000000,0.651834 +-0.759044,-0.000000,0.000000,0.651039 +-0.759725,-0.000000,0.000000,0.650244 +-0.760406,-0.000000,0.000000,0.649448 +-0.761086,-0.000000,0.000000,0.648651 +-0.761764,-0.000000,0.000000,0.647854 +-0.762443,-0.000000,0.000000,0.647056 +-0.763120,-0.000000,0.000000,0.646257 +-0.763796,-0.000000,0.000000,0.645458 +-0.764472,-0.000000,0.000000,0.644657 +-0.765146,-0.000000,0.000000,0.643857 +-0.765820,-0.000000,0.000000,0.643055 +-0.766493,-0.000000,0.000000,0.642253 +-0.767165,-0.000000,0.000000,0.641450 +-0.767836,-0.000000,0.000000,0.640646 +-0.768507,-0.000000,0.000000,0.639841 +-0.769177,-0.000000,0.000000,0.639036 +-0.769845,-0.000000,0.000000,0.638231 +-0.770513,-0.000000,0.000000,0.637424 +-0.771180,-0.000000,0.000000,0.636617 +-0.771847,-0.000000,0.000000,0.635809 +-0.772512,-0.000000,0.000000,0.635000 +-0.773177,-0.000000,0.000000,0.634191 +-0.773840,-0.000000,0.000000,0.633381 +-0.774503,-0.000000,0.000000,0.632570 +-0.775165,-0.000000,0.000000,0.631759 +-0.775826,-0.000000,0.000000,0.630947 +-0.776487,-0.000000,0.000000,0.630134 +-0.777146,-0.000000,0.000000,0.629320 +-0.777805,-0.000000,0.000000,0.628506 +-0.778462,-0.000000,0.000000,0.627691 +-0.779119,-0.000000,0.000000,0.626876 +-0.779775,-0.000000,0.000000,0.626060 +-0.780430,-0.000000,0.000000,0.625243 +-0.781085,-0.000000,0.000000,0.624425 +-0.781738,-0.000000,0.000000,0.623607 +-0.782391,-0.000000,0.000000,0.622788 +-0.783043,-0.000000,0.000000,0.621968 +-0.783693,-0.000000,0.000000,0.621148 +-0.784343,-0.000000,0.000000,0.620327 +-0.784993,-0.000000,0.000000,0.619505 +-0.785641,-0.000000,0.000000,0.618683 +-0.786288,-0.000000,0.000000,0.617860 +-0.786935,-0.000000,0.000000,0.617036 +-0.787581,-0.000000,0.000000,0.616211 +-0.788226,-0.000000,0.000000,0.615386 +-0.788870,-0.000000,0.000000,0.614561 +-0.789513,-0.000000,0.000000,0.613734 +-0.790155,-0.000000,0.000000,0.612907 +-0.790796,-0.000000,0.000000,0.612079 +-0.791437,-0.000000,0.000000,0.611251 +-0.792077,-0.000000,0.000000,0.610422 +-0.792715,-0.000000,0.000000,0.609592 +-0.793353,-0.000000,0.000000,0.608761 +-0.793990,-0.000000,0.000000,0.607930 +-0.794627,-0.000000,0.000000,0.607098 +-0.795262,-0.000000,0.000000,0.606266 +-0.795896,-0.000000,0.000000,0.605433 +-0.796530,-0.000000,0.000000,0.604599 +-0.797163,-0.000000,0.000000,0.603765 +-0.797794,-0.000000,0.000000,0.602930 +-0.798425,-0.000000,0.000000,0.602094 +-0.799055,-0.000000,0.000000,0.601257 +-0.799685,-0.000000,0.000000,0.600420 +-0.800313,-0.000000,0.000000,0.599582 +-0.800940,-0.000000,0.000000,0.598744 +-0.801567,-0.000000,0.000000,0.597905 +-0.802193,-0.000000,0.000000,0.597065 +-0.802817,-0.000000,0.000000,0.596225 +-0.803441,-0.000000,0.000000,0.595384 +-0.804064,-0.000000,0.000000,0.594542 +-0.804687,-0.000000,0.000000,0.593700 +-0.805308,-0.000000,0.000000,0.592857 +-0.805928,-0.000000,0.000000,0.592013 +-0.806548,-0.000000,0.000000,0.591169 +-0.807166,-0.000000,0.000000,0.590324 +-0.807784,-0.000000,0.000000,0.589478 +-0.808401,-0.000000,0.000000,0.588632 +-0.809017,-0.000000,0.000000,0.587785 +-0.809632,-0.000000,0.000000,0.586938 +-0.810246,-0.000000,0.000000,0.586090 +-0.810860,-0.000000,0.000000,0.585241 +-0.811472,-0.000000,0.000000,0.584391 +-0.812084,-0.000000,0.000000,0.583541 +-0.812694,-0.000000,0.000000,0.582690 +-0.813304,-0.000000,0.000000,0.581839 +-0.813913,-0.000000,0.000000,0.580987 +-0.814521,-0.000000,0.000000,0.580134 +-0.815128,-0.000000,0.000000,0.579281 +-0.815734,-0.000000,0.000000,0.578427 +-0.816339,-0.000000,0.000000,0.577573 +-0.816944,-0.000000,0.000000,0.576718 +-0.817547,-0.000000,0.000000,0.575862 +-0.818150,-0.000000,0.000000,0.575005 +-0.818751,-0.000000,0.000000,0.574148 +-0.819352,-0.000000,0.000000,0.573290 +-0.819952,-0.000000,0.000000,0.572432 +-0.820551,-0.000000,0.000000,0.571573 +-0.821149,-0.000000,0.000000,0.570714 +-0.821746,-0.000000,0.000000,0.569853 +-0.822343,-0.000000,0.000000,0.568993 +-0.822938,-0.000000,0.000000,0.568131 +-0.823533,-0.000000,0.000000,0.567269 +-0.824126,-0.000000,0.000000,0.566406 +-0.824719,-0.000000,0.000000,0.565543 +-0.825311,-0.000000,0.000000,0.564679 +-0.825902,-0.000000,0.000000,0.563814 +-0.826492,-0.000000,0.000000,0.562949 +-0.827081,-0.000000,0.000000,0.562083 +-0.827669,-0.000000,0.000000,0.561217 +-0.828256,-0.000000,0.000000,0.560350 +-0.828842,-0.000000,0.000000,0.559482 +-0.829428,-0.000000,0.000000,0.558614 +-0.830012,-0.000000,0.000000,0.557745 +-0.830596,-0.000000,0.000000,0.556876 +-0.831179,-0.000000,0.000000,0.556006 +-0.831760,-0.000000,0.000000,0.555135 +-0.832341,-0.000000,0.000000,0.554263 +-0.832921,-0.000000,0.000000,0.553392 +-0.833500,-0.000000,0.000000,0.552519 +-0.834078,-0.000000,0.000000,0.551646 +-0.834656,-0.000000,0.000000,0.550772 +-0.835232,-0.000000,0.000000,0.549898 +-0.835807,-0.000000,0.000000,0.549023 +-0.836382,-0.000000,0.000000,0.548147 +-0.836955,-0.000000,0.000000,0.547271 +-0.837528,-0.000000,0.000000,0.546394 +-0.838100,-0.000000,0.000000,0.545517 +-0.838671,-0.000000,0.000000,0.544639 +-0.839240,-0.000000,0.000000,0.543760 +-0.839809,-0.000000,0.000000,0.542881 +-0.840377,-0.000000,0.000000,0.542002 +-0.840945,-0.000000,0.000000,0.541121 +-0.841511,-0.000000,0.000000,0.540240 +-0.842076,-0.000000,0.000000,0.539359 +-0.842640,-0.000000,0.000000,0.538477 +-0.843204,-0.000000,0.000000,0.537594 +-0.843766,-0.000000,0.000000,0.536711 +-0.844328,-0.000000,0.000000,0.535827 +-0.844889,-0.000000,0.000000,0.534942 +-0.845448,-0.000000,0.000000,0.534057 +-0.846007,-0.000000,0.000000,0.533172 +-0.846565,-0.000000,0.000000,0.532285 +-0.847122,-0.000000,0.000000,0.531399 +-0.847678,-0.000000,0.000000,0.530511 +-0.848233,-0.000000,0.000000,0.529623 +-0.848787,-0.000000,0.000000,0.528735 +-0.849340,-0.000000,0.000000,0.527846 +-0.849893,-0.000000,0.000000,0.526956 +-0.850444,-0.000000,0.000000,0.526066 +-0.850994,-0.000000,0.000000,0.525175 +-0.851544,-0.000000,0.000000,0.524283 +-0.852093,-0.000000,0.000000,0.523391 +-0.852640,-0.000000,0.000000,0.522499 +-0.853187,-0.000000,0.000000,0.521605 +-0.853733,-0.000000,0.000000,0.520712 +-0.854277,-0.000000,0.000000,0.519817 +-0.854821,-0.000000,0.000000,0.518922 +-0.855364,-0.000000,0.000000,0.518027 +-0.855906,-0.000000,0.000000,0.517131 +-0.856447,-0.000000,0.000000,0.516234 +-0.856987,-0.000000,0.000000,0.515337 +-0.857527,-0.000000,0.000000,0.514440 +-0.858065,-0.000000,0.000000,0.513541 +-0.858602,-0.000000,0.000000,0.512642 +-0.859139,-0.000000,0.000000,0.511743 +-0.859674,-0.000000,0.000000,0.510843 +-0.860208,-0.000000,0.000000,0.509943 +-0.860742,-0.000000,0.000000,0.509041 +-0.861275,-0.000000,0.000000,0.508140 +-0.861806,-0.000000,0.000000,0.507238 +-0.862337,-0.000000,0.000000,0.506335 +-0.862867,-0.000000,0.000000,0.505431 +-0.863396,-0.000000,0.000000,0.504528 +-0.863923,-0.000000,0.000000,0.503623 +-0.864450,-0.000000,0.000000,0.502718 +-0.864976,-0.000000,0.000000,0.501813 +-0.865501,-0.000000,0.000000,0.500907 +-0.866025,-0.000000,0.000000,0.500000 +-0.866549,-0.000000,0.000000,0.499093 +-0.867071,-0.000000,0.000000,0.498185 +-0.867592,-0.000000,0.000000,0.497277 +-0.868112,-0.000000,0.000000,0.496368 +-0.868632,-0.000000,0.000000,0.495459 +-0.869150,-0.000000,0.000000,0.494549 +-0.869667,-0.000000,0.000000,0.493638 +-0.870184,-0.000000,0.000000,0.492727 +-0.870699,-0.000000,0.000000,0.491816 +-0.871214,-0.000000,0.000000,0.490904 +-0.871727,-0.000000,0.000000,0.489991 +-0.872240,-0.000000,0.000000,0.489078 +-0.872752,-0.000000,0.000000,0.488164 +-0.873262,-0.000000,0.000000,0.487250 +-0.873772,-0.000000,0.000000,0.486335 +-0.874281,-0.000000,0.000000,0.485420 +-0.874789,-0.000000,0.000000,0.484504 +-0.875296,-0.000000,0.000000,0.483588 +-0.875802,-0.000000,0.000000,0.482671 +-0.876307,-0.000000,0.000000,0.481754 +-0.876811,-0.000000,0.000000,0.480836 +-0.877314,-0.000000,0.000000,0.479917 +-0.877816,-0.000000,0.000000,0.478998 +-0.878317,-0.000000,0.000000,0.478079 +-0.878817,-0.000000,0.000000,0.477159 +-0.879316,-0.000000,0.000000,0.476238 +-0.879815,-0.000000,0.000000,0.475317 +-0.880312,-0.000000,0.000000,0.474396 +-0.880808,-0.000000,0.000000,0.473473 +-0.881303,-0.000000,0.000000,0.472551 +-0.881798,-0.000000,0.000000,0.471628 +-0.882291,-0.000000,0.000000,0.470704 +-0.882784,-0.000000,0.000000,0.469780 +-0.883275,-0.000000,0.000000,0.468855 +-0.883766,-0.000000,0.000000,0.467930 +-0.884255,-0.000000,0.000000,0.467004 +-0.884744,-0.000000,0.000000,0.466078 +-0.885231,-0.000000,0.000000,0.465151 +-0.885718,-0.000000,0.000000,0.464224 +-0.886204,-0.000000,0.000000,0.463296 +-0.886688,-0.000000,0.000000,0.462368 +-0.887172,-0.000000,0.000000,0.461439 +-0.887655,-0.000000,0.000000,0.460510 +-0.888136,-0.000000,0.000000,0.459580 +-0.888617,-0.000000,0.000000,0.458650 +-0.889097,-0.000000,0.000000,0.457719 +-0.889576,-0.000000,0.000000,0.456787 +-0.890054,-0.000000,0.000000,0.455856 +-0.890531,-0.000000,0.000000,0.454923 +-0.891007,-0.000000,0.000000,0.453990 +-0.891481,-0.000000,0.000000,0.453057 +-0.891955,-0.000000,0.000000,0.452123 +-0.892428,-0.000000,0.000000,0.451189 +-0.892900,-0.000000,0.000000,0.450254 +-0.893371,-0.000000,0.000000,0.449319 +-0.893841,-0.000000,0.000000,0.448383 +-0.894310,-0.000000,0.000000,0.447447 +-0.894779,-0.000000,0.000000,0.446510 +-0.895246,-0.000000,0.000000,0.445573 +-0.895712,-0.000000,0.000000,0.444635 +-0.896177,-0.000000,0.000000,0.443697 +-0.896641,-0.000000,0.000000,0.442758 +-0.897104,-0.000000,0.000000,0.441819 +-0.897566,-0.000000,0.000000,0.440879 +-0.898028,-0.000000,0.000000,0.439939 +-0.898488,-0.000000,0.000000,0.438999 +-0.898947,-0.000000,0.000000,0.438057 +-0.899405,-0.000000,0.000000,0.437116 +-0.899863,-0.000000,0.000000,0.436174 +-0.900319,-0.000000,0.000000,0.435231 +-0.900774,-0.000000,0.000000,0.434288 +-0.901228,-0.000000,0.000000,0.433345 +-0.901682,-0.000000,0.000000,0.432401 +-0.902134,-0.000000,0.000000,0.431456 +-0.902585,-0.000000,0.000000,0.430511 +-0.903036,-0.000000,0.000000,0.429566 +-0.903485,-0.000000,0.000000,0.428620 +-0.903933,-0.000000,0.000000,0.427673 +-0.904381,-0.000000,0.000000,0.426727 +-0.904827,-0.000000,0.000000,0.425779 +-0.905272,-0.000000,0.000000,0.424832 +-0.905717,-0.000000,0.000000,0.423883 +-0.906160,-0.000000,0.000000,0.422935 +-0.906603,-0.000000,0.000000,0.421985 +-0.907044,-0.000000,0.000000,0.421036 +-0.907484,-0.000000,0.000000,0.420086 +-0.907924,-0.000000,0.000000,0.419135 +-0.908362,-0.000000,0.000000,0.418184 +-0.908800,-0.000000,0.000000,0.417233 +-0.909236,-0.000000,0.000000,0.416281 +-0.909672,-0.000000,0.000000,0.415328 +-0.910106,-0.000000,0.000000,0.414376 +-0.910539,-0.000000,0.000000,0.413422 +-0.910972,-0.000000,0.000000,0.412469 +-0.911403,-0.000000,0.000000,0.411514 +-0.911834,-0.000000,0.000000,0.410560 +-0.912263,-0.000000,0.000000,0.409605 +-0.912692,-0.000000,0.000000,0.408649 +-0.913119,-0.000000,0.000000,0.407693 +-0.913545,-0.000000,0.000000,0.406737 +-0.913971,-0.000000,0.000000,0.405780 +-0.914395,-0.000000,0.000000,0.404822 +-0.914819,-0.000000,0.000000,0.403865 +-0.915241,-0.000000,0.000000,0.402906 +-0.915663,-0.000000,0.000000,0.401948 +-0.916083,-0.000000,0.000000,0.400989 +-0.916502,-0.000000,0.000000,0.400029 +-0.916921,-0.000000,0.000000,0.399069 +-0.917338,-0.000000,0.000000,0.398109 +-0.917755,-0.000000,0.000000,0.397148 +-0.918170,-0.000000,0.000000,0.396187 +-0.918584,-0.000000,0.000000,0.395225 +-0.918998,-0.000000,0.000000,0.394263 +-0.919410,-0.000000,0.000000,0.393300 +-0.919821,-0.000000,0.000000,0.392337 +-0.920232,-0.000000,0.000000,0.391374 +-0.920641,-0.000000,0.000000,0.390410 +-0.921050,-0.000000,0.000000,0.389445 +-0.921457,-0.000000,0.000000,0.388481 +-0.921863,-0.000000,0.000000,0.387516 +-0.922268,-0.000000,0.000000,0.386550 +-0.922673,-0.000000,0.000000,0.385584 +-0.923076,-0.000000,0.000000,0.384618 +-0.923478,-0.000000,0.000000,0.383651 +-0.923880,-0.000000,0.000000,0.382683 +-0.924280,-0.000000,0.000000,0.381716 +-0.924679,-0.000000,0.000000,0.380748 +-0.925077,-0.000000,0.000000,0.379779 +-0.925474,-0.000000,0.000000,0.378810 +-0.925871,-0.000000,0.000000,0.377841 +-0.926266,-0.000000,0.000000,0.376871 +-0.926660,-0.000000,0.000000,0.375901 +-0.927053,-0.000000,0.000000,0.374930 +-0.927445,-0.000000,0.000000,0.373959 +-0.927836,-0.000000,0.000000,0.372988 +-0.928226,-0.000000,0.000000,0.372016 +-0.928615,-0.000000,0.000000,0.371044 +-0.929003,-0.000000,0.000000,0.370071 +-0.929390,-0.000000,0.000000,0.369098 +-0.929776,-0.000000,0.000000,0.368125 +-0.930161,-0.000000,0.000000,0.367151 +-0.930545,-0.000000,0.000000,0.366176 +-0.930928,-0.000000,0.000000,0.365202 +-0.931310,-0.000000,0.000000,0.364227 +-0.931691,-0.000000,0.000000,0.363251 +-0.932071,-0.000000,0.000000,0.362275 +-0.932450,-0.000000,0.000000,0.361299 +-0.932828,-0.000000,0.000000,0.360322 +-0.933205,-0.000000,0.000000,0.359345 +-0.933580,-0.000000,0.000000,0.358368 +-0.933955,-0.000000,0.000000,0.357390 +-0.934329,-0.000000,0.000000,0.356412 +-0.934702,-0.000000,0.000000,0.355433 +-0.935073,-0.000000,0.000000,0.354454 +-0.935444,-0.000000,0.000000,0.353475 +-0.935814,-0.000000,0.000000,0.352495 +-0.936182,-0.000000,0.000000,0.351515 +-0.936550,-0.000000,0.000000,0.350534 +-0.936916,-0.000000,0.000000,0.349553 +-0.937282,-0.000000,0.000000,0.348572 +-0.937646,-0.000000,0.000000,0.347590 +-0.938010,-0.000000,0.000000,0.346608 +-0.938372,-0.000000,0.000000,0.345626 +-0.938734,-0.000000,0.000000,0.344643 +-0.939094,-0.000000,0.000000,0.343660 +-0.939454,-0.000000,0.000000,0.342676 +-0.939812,-0.000000,0.000000,0.341692 +-0.940169,-0.000000,0.000000,0.340708 +-0.940526,-0.000000,0.000000,0.339723 +-0.940881,-0.000000,0.000000,0.338738 +-0.941235,-0.000000,0.000000,0.337752 +-0.941588,-0.000000,0.000000,0.336767 +-0.941940,-0.000000,0.000000,0.335780 +-0.942291,-0.000000,0.000000,0.334794 +-0.942641,-0.000000,0.000000,0.333807 +-0.942991,-0.000000,0.000000,0.332820 +-0.943339,-0.000000,0.000000,0.331832 +-0.943686,-0.000000,0.000000,0.330844 +-0.944031,-0.000000,0.000000,0.329855 +-0.944376,-0.000000,0.000000,0.328867 +-0.944720,-0.000000,0.000000,0.327878 +-0.945063,-0.000000,0.000000,0.326888 +-0.945405,-0.000000,0.000000,0.325898 +-0.945746,-0.000000,0.000000,0.324908 +-0.946085,-0.000000,0.000000,0.323917 +-0.946424,-0.000000,0.000000,0.322927 +-0.946762,-0.000000,0.000000,0.321935 +-0.947098,-0.000000,0.000000,0.320944 +-0.947434,-0.000000,0.000000,0.319952 +-0.947768,-0.000000,0.000000,0.318959 +-0.948102,-0.000000,0.000000,0.317967 +-0.948434,-0.000000,0.000000,0.316974 +-0.948766,-0.000000,0.000000,0.315980 +-0.949096,-0.000000,0.000000,0.314987 +-0.949425,-0.000000,0.000000,0.313992 +-0.949754,-0.000000,0.000000,0.312998 +-0.950081,-0.000000,0.000000,0.312003 +-0.950407,-0.000000,0.000000,0.311008 +-0.950732,-0.000000,0.000000,0.310013 +-0.951057,-0.000000,0.000000,0.309017 +-0.951380,-0.000000,0.000000,0.308021 +-0.951702,-0.000000,0.000000,0.307024 +-0.952023,-0.000000,0.000000,0.306028 +-0.952343,-0.000000,0.000000,0.305031 +-0.952661,-0.000000,0.000000,0.304033 +-0.952979,-0.000000,0.000000,0.303035 +-0.953296,-0.000000,0.000000,0.302037 +-0.953612,-0.000000,0.000000,0.301039 +-0.953927,-0.000000,0.000000,0.300040 +-0.954240,-0.000000,0.000000,0.299041 +-0.954553,-0.000000,0.000000,0.298041 +-0.954865,-0.000000,0.000000,0.297042 +-0.955175,-0.000000,0.000000,0.296041 +-0.955485,-0.000000,0.000000,0.295041 +-0.955793,-0.000000,0.000000,0.294040 +-0.956100,-0.000000,0.000000,0.293039 +-0.956407,-0.000000,0.000000,0.292038 +-0.956712,-0.000000,0.000000,0.291036 +-0.957016,-0.000000,0.000000,0.290034 +-0.957319,-0.000000,0.000000,0.289032 +-0.957622,-0.000000,0.000000,0.288029 +-0.957923,-0.000000,0.000000,0.287026 +-0.958223,-0.000000,0.000000,0.286023 +-0.958522,-0.000000,0.000000,0.285019 +-0.958820,-0.000000,0.000000,0.284015 +-0.959117,-0.000000,0.000000,0.283011 +-0.959412,-0.000000,0.000000,0.282007 +-0.959707,-0.000000,0.000000,0.281002 +-0.960001,-0.000000,0.000000,0.279997 +-0.960294,-0.000000,0.000000,0.278991 +-0.960585,-0.000000,0.000000,0.277985 +-0.960876,-0.000000,0.000000,0.276979 +-0.961165,-0.000000,0.000000,0.275973 +-0.961454,-0.000000,0.000000,0.274966 +-0.961741,-0.000000,0.000000,0.273959 +-0.962028,-0.000000,0.000000,0.272952 +-0.962313,-0.000000,0.000000,0.271944 +-0.962597,-0.000000,0.000000,0.270936 +-0.962880,-0.000000,0.000000,0.269928 +-0.963163,-0.000000,0.000000,0.268920 +-0.963444,-0.000000,0.000000,0.267911 +-0.963724,-0.000000,0.000000,0.266902 +-0.964003,-0.000000,0.000000,0.265893 +-0.964281,-0.000000,0.000000,0.264883 +-0.964557,-0.000000,0.000000,0.263873 +-0.964833,-0.000000,0.000000,0.262863 +-0.965108,-0.000000,0.000000,0.261852 +-0.965382,-0.000000,0.000000,0.260842 +-0.965654,-0.000000,0.000000,0.259830 +-0.965926,-0.000000,0.000000,0.258819 +-0.966196,-0.000000,0.000000,0.257807 +-0.966466,-0.000000,0.000000,0.256795 +-0.966734,-0.000000,0.000000,0.255783 +-0.967001,-0.000000,0.000000,0.254771 +-0.967268,-0.000000,0.000000,0.253758 +-0.967533,-0.000000,0.000000,0.252745 +-0.967797,-0.000000,0.000000,0.251732 +-0.968060,-0.000000,0.000000,0.250718 +-0.968322,-0.000000,0.000000,0.249704 +-0.968583,-0.000000,0.000000,0.248690 +-0.968843,-0.000000,0.000000,0.247675 +-0.969102,-0.000000,0.000000,0.246661 +-0.969360,-0.000000,0.000000,0.245646 +-0.969616,-0.000000,0.000000,0.244631 +-0.969872,-0.000000,0.000000,0.243615 +-0.970127,-0.000000,0.000000,0.242599 +-0.970380,-0.000000,0.000000,0.241583 +-0.970633,-0.000000,0.000000,0.240567 +-0.970884,-0.000000,0.000000,0.239550 +-0.971134,-0.000000,0.000000,0.238533 +-0.971384,-0.000000,0.000000,0.237516 +-0.971632,-0.000000,0.000000,0.236499 +-0.971879,-0.000000,0.000000,0.235481 +-0.972125,-0.000000,0.000000,0.234463 +-0.972370,-0.000000,0.000000,0.233445 +-0.972614,-0.000000,0.000000,0.232427 +-0.972857,-0.000000,0.000000,0.231408 +-0.973099,-0.000000,0.000000,0.230389 +-0.973339,-0.000000,0.000000,0.229370 +-0.973579,-0.000000,0.000000,0.228351 +-0.973817,-0.000000,0.000000,0.227331 +-0.974055,-0.000000,0.000000,0.226311 +-0.974291,-0.000000,0.000000,0.225291 +-0.974527,-0.000000,0.000000,0.224271 +-0.974761,-0.000000,0.000000,0.223250 +-0.974994,-0.000000,0.000000,0.222229 +-0.975227,-0.000000,0.000000,0.221208 +-0.975458,-0.000000,0.000000,0.220187 +-0.975688,-0.000000,0.000000,0.219165 +-0.975917,-0.000000,0.000000,0.218143 +-0.976145,-0.000000,0.000000,0.217121 +-0.976371,-0.000000,0.000000,0.216099 +-0.976597,-0.000000,0.000000,0.215076 +-0.976822,-0.000000,0.000000,0.214053 +-0.977046,-0.000000,0.000000,0.213030 +-0.977268,-0.000000,0.000000,0.212007 +-0.977490,-0.000000,0.000000,0.210984 +-0.977710,-0.000000,0.000000,0.209960 +-0.977929,-0.000000,0.000000,0.208936 +-0.978148,-0.000000,0.000000,0.207912 +-0.978365,-0.000000,0.000000,0.206887 +-0.978581,-0.000000,0.000000,0.205863 +-0.978796,-0.000000,0.000000,0.204838 +-0.979010,-0.000000,0.000000,0.203813 +-0.979223,-0.000000,0.000000,0.202787 +-0.979435,-0.000000,0.000000,0.201762 +-0.979645,-0.000000,0.000000,0.200736 +-0.979855,-0.000000,0.000000,0.199710 +-0.980064,-0.000000,0.000000,0.198684 +-0.980271,-0.000000,0.000000,0.197657 +-0.980478,-0.000000,0.000000,0.196631 +-0.980683,-0.000000,0.000000,0.195604 +-0.980887,-0.000000,0.000000,0.194577 +-0.981091,-0.000000,0.000000,0.193549 +-0.981293,-0.000000,0.000000,0.192522 +-0.981494,-0.000000,0.000000,0.191494 +-0.981694,-0.000000,0.000000,0.190466 +-0.981893,-0.000000,0.000000,0.189438 +-0.982090,-0.000000,0.000000,0.188410 +-0.982287,-0.000000,0.000000,0.187381 +-0.982483,-0.000000,0.000000,0.186353 +-0.982678,-0.000000,0.000000,0.185324 +-0.982871,-0.000000,0.000000,0.184294 +-0.983064,-0.000000,0.000000,0.183265 +-0.983255,-0.000000,0.000000,0.182236 +-0.983445,-0.000000,0.000000,0.181206 +-0.983634,-0.000000,0.000000,0.180176 +-0.983823,-0.000000,0.000000,0.179146 +-0.984010,-0.000000,0.000000,0.178115 +-0.984196,-0.000000,0.000000,0.177085 +-0.984381,-0.000000,0.000000,0.176054 +-0.984564,-0.000000,0.000000,0.175023 +-0.984747,-0.000000,0.000000,0.173992 +-0.984929,-0.000000,0.000000,0.172961 +-0.985109,-0.000000,0.000000,0.171929 +-0.985289,-0.000000,0.000000,0.170897 +-0.985467,-0.000000,0.000000,0.169866 +-0.985645,-0.000000,0.000000,0.168833 +-0.985821,-0.000000,0.000000,0.167801 +-0.985996,-0.000000,0.000000,0.166769 +-0.986170,-0.000000,0.000000,0.165736 +-0.986343,-0.000000,0.000000,0.164703 +-0.986515,-0.000000,0.000000,0.163670 +-0.986686,-0.000000,0.000000,0.162637 +-0.986856,-0.000000,0.000000,0.161604 +-0.987024,-0.000000,0.000000,0.160570 +-0.987192,-0.000000,0.000000,0.159537 +-0.987359,-0.000000,0.000000,0.158503 +-0.987524,-0.000000,0.000000,0.157469 +-0.987688,-0.000000,0.000000,0.156434 +-0.987852,-0.000000,0.000000,0.155400 +-0.988014,-0.000000,0.000000,0.154366 +-0.988175,-0.000000,0.000000,0.153331 +-0.988335,-0.000000,0.000000,0.152296 +-0.988494,-0.000000,0.000000,0.151261 +-0.988652,-0.000000,0.000000,0.150226 +-0.988809,-0.000000,0.000000,0.149190 +-0.988964,-0.000000,0.000000,0.148155 +-0.989119,-0.000000,0.000000,0.147119 +-0.989272,-0.000000,0.000000,0.146083 +-0.989425,-0.000000,0.000000,0.145047 +-0.989576,-0.000000,0.000000,0.144011 +-0.989726,-0.000000,0.000000,0.142974 +-0.989876,-0.000000,0.000000,0.141938 +-0.990024,-0.000000,0.000000,0.140901 +-0.990171,-0.000000,0.000000,0.139864 +-0.990317,-0.000000,0.000000,0.138827 +-0.990461,-0.000000,0.000000,0.137790 +-0.990605,-0.000000,0.000000,0.136753 +-0.990748,-0.000000,0.000000,0.135716 +-0.990889,-0.000000,0.000000,0.134678 +-0.991030,-0.000000,0.000000,0.133640 +-0.991169,-0.000000,0.000000,0.132602 +-0.991308,-0.000000,0.000000,0.131564 +-0.991445,-0.000000,0.000000,0.130526 +-0.991581,-0.000000,0.000000,0.129488 +-0.991716,-0.000000,0.000000,0.128449 +-0.991850,-0.000000,0.000000,0.127411 +-0.991983,-0.000000,0.000000,0.126372 +-0.992115,-0.000000,0.000000,0.125333 +-0.992245,-0.000000,0.000000,0.124294 +-0.992375,-0.000000,0.000000,0.123255 +-0.992504,-0.000000,0.000000,0.122216 +-0.992631,-0.000000,0.000000,0.121176 +-0.992757,-0.000000,0.000000,0.120137 +-0.992883,-0.000000,0.000000,0.119097 +-0.993007,-0.000000,0.000000,0.118057 +-0.993130,-0.000000,0.000000,0.117017 +-0.993252,-0.000000,0.000000,0.115977 +-0.993373,-0.000000,0.000000,0.114937 +-0.993493,-0.000000,0.000000,0.113897 +-0.993611,-0.000000,0.000000,0.112856 +-0.993729,-0.000000,0.000000,0.111816 +-0.993845,-0.000000,0.000000,0.110775 +-0.993961,-0.000000,0.000000,0.109734 +-0.994075,-0.000000,0.000000,0.108693 +-0.994189,-0.000000,0.000000,0.107652 +-0.994301,-0.000000,0.000000,0.106611 +-0.994412,-0.000000,0.000000,0.105570 +-0.994522,-0.000000,0.000000,0.104528 +-0.994631,-0.000000,0.000000,0.103487 +-0.994739,-0.000000,0.000000,0.102445 +-0.994845,-0.000000,0.000000,0.101404 +-0.994951,-0.000000,0.000000,0.100362 +-0.995056,-0.000000,0.000000,0.099320 +-0.995159,-0.000000,0.000000,0.098278 +-0.995261,-0.000000,0.000000,0.097235 +-0.995363,-0.000000,0.000000,0.096193 +-0.995463,-0.000000,0.000000,0.095151 +-0.995562,-0.000000,0.000000,0.094108 +-0.995660,-0.000000,0.000000,0.093066 +-0.995757,-0.000000,0.000000,0.092023 +-0.995853,-0.000000,0.000000,0.090980 +-0.995947,-0.000000,0.000000,0.089937 +-0.996041,-0.000000,0.000000,0.088894 +-0.996134,-0.000000,0.000000,0.087851 +-0.996225,-0.000000,0.000000,0.086808 +-0.996315,-0.000000,0.000000,0.085765 +-0.996405,-0.000000,0.000000,0.084721 +-0.996493,-0.000000,0.000000,0.083678 +-0.996580,-0.000000,0.000000,0.082634 +-0.996666,-0.000000,0.000000,0.081591 +-0.996751,-0.000000,0.000000,0.080547 +-0.996835,-0.000000,0.000000,0.079503 +-0.996917,-0.000000,0.000000,0.078459 +-0.996999,-0.000000,0.000000,0.077415 +-0.997079,-0.000000,0.000000,0.076371 +-0.997159,-0.000000,0.000000,0.075327 +-0.997237,-0.000000,0.000000,0.074283 +-0.997314,-0.000000,0.000000,0.073238 +-0.997391,-0.000000,0.000000,0.072194 +-0.997466,-0.000000,0.000000,0.071149 +-0.997540,-0.000000,0.000000,0.070105 +-0.997613,-0.000000,0.000000,0.069060 +-0.997684,-0.000000,0.000000,0.068015 +-0.997755,-0.000000,0.000000,0.066970 +-0.997825,-0.000000,0.000000,0.065926 +-0.997893,-0.000000,0.000000,0.064881 +-0.997960,-0.000000,0.000000,0.063836 +-0.998027,-0.000000,0.000000,0.062791 +-0.998092,-0.000000,0.000000,0.061745 +-0.998156,-0.000000,0.000000,0.060700 +-0.998219,-0.000000,0.000000,0.059655 +-0.998281,-0.000000,0.000000,0.058609 +-0.998342,-0.000000,0.000000,0.057564 +-0.998402,-0.000000,0.000000,0.056519 +-0.998460,-0.000000,0.000000,0.055473 +-0.998518,-0.000000,0.000000,0.054427 +-0.998574,-0.000000,0.000000,0.053382 +-0.998630,-0.000000,0.000000,0.052336 +-0.998684,-0.000000,0.000000,0.051290 +-0.998737,-0.000000,0.000000,0.050244 +-0.998789,-0.000000,0.000000,0.049198 +-0.998840,-0.000000,0.000000,0.048152 +-0.998890,-0.000000,0.000000,0.047106 +-0.998939,-0.000000,0.000000,0.046060 +-0.998986,-0.000000,0.000000,0.045014 +-0.999033,-0.000000,0.000000,0.043968 +-0.999078,-0.000000,0.000000,0.042922 +-0.999123,-0.000000,0.000000,0.041876 +-0.999166,-0.000000,0.000000,0.040829 +-0.999208,-0.000000,0.000000,0.039783 +-0.999249,-0.000000,0.000000,0.038737 +-0.999289,-0.000000,0.000000,0.037690 +-0.999328,-0.000000,0.000000,0.036644 +-0.999366,-0.000000,0.000000,0.035597 +-0.999403,-0.000000,0.000000,0.034551 +-0.999439,-0.000000,0.000000,0.033504 +-0.999473,-0.000000,0.000000,0.032457 +-0.999507,-0.000000,0.000000,0.031411 +-0.999539,-0.000000,0.000000,0.030364 +-0.999570,-0.000000,0.000000,0.029317 +-0.999600,-0.000000,0.000000,0.028271 +-0.999629,-0.000000,0.000000,0.027224 +-0.999657,-0.000000,0.000000,0.026177 +-0.999684,-0.000000,0.000000,0.025130 +-0.999710,-0.000000,0.000000,0.024083 +-0.999735,-0.000000,0.000000,0.023036 +-0.999758,-0.000000,0.000000,0.021989 +-0.999781,-0.000000,0.000000,0.020942 +-0.999802,-0.000000,0.000000,0.019895 +-0.999822,-0.000000,0.000000,0.018848 +-0.999842,-0.000000,0.000000,0.017801 +-0.999860,-0.000000,0.000000,0.016754 +-0.999877,-0.000000,0.000000,0.015707 +-0.999893,-0.000000,0.000000,0.014660 +-0.999907,-0.000000,0.000000,0.013613 +-0.999921,-0.000000,0.000000,0.012566 +-0.999934,-0.000000,0.000000,0.011519 +-0.999945,-0.000000,0.000000,0.010472 +-0.999956,-0.000000,0.000000,0.009425 +-0.999965,-0.000000,0.000000,0.008377 +-0.999973,-0.000000,0.000000,0.007330 +-0.999980,-0.000000,0.000000,0.006283 +-0.999986,-0.000000,0.000000,0.005236 +-0.999991,-0.000000,0.000000,0.004189 +-0.999995,-0.000000,0.000000,0.003142 +-0.999998,-0.000000,0.000000,0.002094 +-0.999999,-0.000000,0.000000,0.001047 diff --git a/scripts/trajectories/rotate_yaw_pitch_roll1_delayed.csv b/scripts/trajectories/rotate_yaw_pitch_roll1_delayed.csv new file mode 100644 index 0000000000..86c7a77bf8 --- /dev/null +++ b/scripts/trajectories/rotate_yaw_pitch_roll1_delayed.csv @@ -0,0 +1,2421 @@ +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-360.000000,0.000000,0.000000 +-3.0,-359.100000,0.000000,0.000000 +-3.0,-358.200000,0.000000,0.000000 +-3.0,-357.300000,0.000000,0.000000 +-3.0,-356.400000,0.000000,0.000000 +-3.0,-355.500000,0.000000,0.000000 +-3.0,-354.600000,0.000000,0.000000 +-3.0,-353.700000,0.000000,0.000000 +-3.0,-352.800000,0.000000,0.000000 +-3.0,-351.900000,0.000000,0.000000 +-3.0,-351.000000,0.000000,0.000000 +-3.0,-350.100000,0.000000,0.000000 +-3.0,-349.200000,0.000000,0.000000 +-3.0,-348.300000,0.000000,0.000000 +-3.0,-347.400000,0.000000,0.000000 +-3.0,-346.500000,0.000000,0.000000 +-3.0,-345.600000,0.000000,0.000000 +-3.0,-344.700000,0.000000,0.000000 +-3.0,-343.800000,0.000000,0.000000 +-3.0,-342.900000,0.000000,0.000000 +-3.0,-342.000000,0.000000,0.000000 +-3.0,-341.100000,0.000000,0.000000 +-3.0,-340.200000,0.000000,0.000000 +-3.0,-339.300000,0.000000,0.000000 +-3.0,-338.400000,0.000000,0.000000 +-3.0,-337.500000,0.000000,0.000000 +-3.0,-336.600000,0.000000,0.000000 +-3.0,-335.700000,0.000000,0.000000 +-3.0,-334.800000,0.000000,0.000000 +-3.0,-333.900000,0.000000,0.000000 +-3.0,-333.000000,0.000000,0.000000 +-3.0,-332.100000,0.000000,0.000000 +-3.0,-331.200000,0.000000,0.000000 +-3.0,-330.300000,0.000000,0.000000 +-3.0,-329.400000,0.000000,0.000000 +-3.0,-328.500000,0.000000,0.000000 +-3.0,-327.600000,0.000000,0.000000 +-3.0,-326.700000,0.000000,0.000000 +-3.0,-325.800000,0.000000,0.000000 +-3.0,-324.900000,0.000000,0.000000 +-3.0,-324.000000,0.000000,0.000000 +-3.0,-323.100000,0.000000,0.000000 +-3.0,-322.200000,0.000000,0.000000 +-3.0,-321.300000,0.000000,0.000000 +-3.0,-320.400000,0.000000,0.000000 +-3.0,-319.500000,0.000000,0.000000 +-3.0,-318.600000,0.000000,0.000000 +-3.0,-317.700000,0.000000,0.000000 +-3.0,-316.800000,0.000000,0.000000 +-3.0,-315.900000,0.000000,0.000000 +-3.0,-315.000000,0.000000,0.000000 +-3.0,-314.100000,0.000000,0.000000 +-3.0,-313.200000,0.000000,0.000000 +-3.0,-312.300000,0.000000,0.000000 +-3.0,-311.400000,0.000000,0.000000 +-3.0,-310.500000,0.000000,0.000000 +-3.0,-309.600000,0.000000,0.000000 +-3.0,-308.700000,0.000000,0.000000 +-3.0,-307.800000,0.000000,0.000000 +-3.0,-306.900000,0.000000,0.000000 +-3.0,-306.000000,0.000000,0.000000 +-3.0,-305.100000,0.000000,0.000000 +-3.0,-304.200000,0.000000,0.000000 +-3.0,-303.300000,0.000000,0.000000 +-3.0,-302.400000,0.000000,0.000000 +-3.0,-301.500000,0.000000,0.000000 +-3.0,-300.600000,0.000000,0.000000 +-3.0,-299.700000,0.000000,0.000000 +-3.0,-298.800000,0.000000,0.000000 +-3.0,-297.900000,0.000000,0.000000 +-3.0,-297.000000,0.000000,0.000000 +-3.0,-296.100000,0.000000,0.000000 +-3.0,-295.200000,0.000000,0.000000 +-3.0,-294.300000,0.000000,0.000000 +-3.0,-293.400000,0.000000,0.000000 +-3.0,-292.500000,0.000000,0.000000 +-3.0,-291.600000,0.000000,0.000000 +-3.0,-290.700000,0.000000,0.000000 +-3.0,-289.800000,0.000000,0.000000 +-3.0,-288.900000,0.000000,0.000000 +-3.0,-288.000000,0.000000,0.000000 +-3.0,-287.100000,0.000000,0.000000 +-3.0,-286.200000,0.000000,0.000000 +-3.0,-285.300000,0.000000,0.000000 +-3.0,-284.400000,0.000000,0.000000 +-3.0,-283.500000,0.000000,0.000000 +-3.0,-282.600000,0.000000,0.000000 +-3.0,-281.700000,0.000000,0.000000 +-3.0,-280.800000,0.000000,0.000000 +-3.0,-279.900000,0.000000,0.000000 +-3.0,-279.000000,0.000000,0.000000 +-3.0,-278.100000,0.000000,0.000000 +-3.0,-277.200000,0.000000,0.000000 +-3.0,-276.300000,0.000000,0.000000 +-3.0,-275.400000,0.000000,0.000000 +-3.0,-274.500000,0.000000,0.000000 +-3.0,-273.600000,0.000000,0.000000 +-3.0,-272.700000,0.000000,0.000000 +-3.0,-271.800000,0.000000,0.000000 +-3.0,-270.900000,0.000000,0.000000 +-3.0,-270.000000,0.000000,0.000000 +-3.0,-269.100000,0.000000,0.000000 +-3.0,-268.200000,0.000000,0.000000 +-3.0,-267.300000,0.000000,0.000000 +-3.0,-266.400000,0.000000,0.000000 +-3.0,-265.500000,0.000000,0.000000 +-3.0,-264.600000,0.000000,0.000000 +-3.0,-263.700000,0.000000,0.000000 +-3.0,-262.800000,0.000000,0.000000 +-3.0,-261.900000,0.000000,0.000000 +-3.0,-261.000000,0.000000,0.000000 +-3.0,-260.100000,0.000000,0.000000 +-3.0,-259.200000,0.000000,0.000000 +-3.0,-258.300000,0.000000,0.000000 +-3.0,-257.400000,0.000000,0.000000 +-3.0,-256.500000,0.000000,0.000000 +-3.0,-255.600000,0.000000,0.000000 +-3.0,-254.700000,0.000000,0.000000 +-3.0,-253.800000,0.000000,0.000000 +-3.0,-252.900000,0.000000,0.000000 +-3.0,-252.000000,0.000000,0.000000 +-3.0,-251.100000,0.000000,0.000000 +-3.0,-250.200000,0.000000,0.000000 +-3.0,-249.300000,0.000000,0.000000 +-3.0,-248.400000,0.000000,0.000000 +-3.0,-247.500000,0.000000,0.000000 +-3.0,-246.600000,0.000000,0.000000 +-3.0,-245.700000,0.000000,0.000000 +-3.0,-244.800000,0.000000,0.000000 +-3.0,-243.900000,0.000000,0.000000 +-3.0,-243.000000,0.000000,0.000000 +-3.0,-242.100000,0.000000,0.000000 +-3.0,-241.200000,0.000000,0.000000 +-3.0,-240.300000,0.000000,0.000000 +-3.0,-239.400000,0.000000,0.000000 +-3.0,-238.500000,0.000000,0.000000 +-3.0,-237.600000,0.000000,0.000000 +-3.0,-236.700000,0.000000,0.000000 +-3.0,-235.800000,0.000000,0.000000 +-3.0,-234.900000,0.000000,0.000000 +-3.0,-234.000000,0.000000,0.000000 +-3.0,-233.100000,0.000000,0.000000 +-3.0,-232.200000,0.000000,0.000000 +-3.0,-231.300000,0.000000,0.000000 +-3.0,-230.400000,0.000000,0.000000 +-3.0,-229.500000,0.000000,0.000000 +-3.0,-228.600000,0.000000,0.000000 +-3.0,-227.700000,0.000000,0.000000 +-3.0,-226.800000,0.000000,0.000000 +-3.0,-225.900000,0.000000,0.000000 +-3.0,-225.000000,0.000000,0.000000 +-3.0,-224.100000,0.000000,0.000000 +-3.0,-223.200000,0.000000,0.000000 +-3.0,-222.300000,0.000000,0.000000 +-3.0,-221.400000,0.000000,0.000000 +-3.0,-220.500000,0.000000,0.000000 +-3.0,-219.600000,0.000000,0.000000 +-3.0,-218.700000,0.000000,0.000000 +-3.0,-217.800000,0.000000,0.000000 +-3.0,-216.900000,0.000000,0.000000 +-3.0,-216.000000,0.000000,0.000000 +-3.0,-215.100000,0.000000,0.000000 +-3.0,-214.200000,0.000000,0.000000 +-3.0,-213.300000,0.000000,0.000000 +-3.0,-212.400000,0.000000,0.000000 +-3.0,-211.500000,0.000000,0.000000 +-3.0,-210.600000,0.000000,0.000000 +-3.0,-209.700000,0.000000,0.000000 +-3.0,-208.800000,0.000000,0.000000 +-3.0,-207.900000,0.000000,0.000000 +-3.0,-207.000000,0.000000,0.000000 +-3.0,-206.100000,0.000000,0.000000 +-3.0,-205.200000,0.000000,0.000000 +-3.0,-204.300000,0.000000,0.000000 +-3.0,-203.400000,0.000000,0.000000 +-3.0,-202.500000,0.000000,0.000000 +-3.0,-201.600000,0.000000,0.000000 +-3.0,-200.700000,0.000000,0.000000 +-3.0,-199.800000,0.000000,0.000000 +-3.0,-198.900000,0.000000,0.000000 +-3.0,-198.000000,0.000000,0.000000 +-3.0,-197.100000,0.000000,0.000000 +-3.0,-196.200000,0.000000,0.000000 +-3.0,-195.300000,0.000000,0.000000 +-3.0,-194.400000,0.000000,0.000000 +-3.0,-193.500000,0.000000,0.000000 +-3.0,-192.600000,0.000000,0.000000 +-3.0,-191.700000,0.000000,0.000000 +-3.0,-190.800000,0.000000,0.000000 +-3.0,-189.900000,0.000000,0.000000 +-3.0,-189.000000,0.000000,0.000000 +-3.0,-188.100000,0.000000,0.000000 +-3.0,-187.200000,0.000000,0.000000 +-3.0,-186.300000,0.000000,0.000000 +-3.0,-185.400000,0.000000,0.000000 +-3.0,-184.500000,0.000000,0.000000 +-3.0,-183.600000,0.000000,0.000000 +-3.0,-182.700000,0.000000,0.000000 +-3.0,-181.800000,0.000000,0.000000 +-3.0,-180.900000,0.000000,0.000000 +-3.0,-180.000000,0.000000,0.000000 +-3.0,-179.100000,0.000000,0.000000 +-3.0,-178.200000,0.000000,0.000000 +-3.0,-177.300000,0.000000,0.000000 +-3.0,-176.400000,0.000000,0.000000 +-3.0,-175.500000,0.000000,0.000000 +-3.0,-174.600000,0.000000,0.000000 +-3.0,-173.700000,0.000000,0.000000 +-3.0,-172.800000,0.000000,0.000000 +-3.0,-171.900000,0.000000,0.000000 +-3.0,-171.000000,0.000000,0.000000 +-3.0,-170.100000,0.000000,0.000000 +-3.0,-169.200000,0.000000,0.000000 +-3.0,-168.300000,0.000000,0.000000 +-3.0,-167.400000,0.000000,0.000000 +-3.0,-166.500000,0.000000,0.000000 +-3.0,-165.600000,0.000000,0.000000 +-3.0,-164.700000,0.000000,0.000000 +-3.0,-163.800000,0.000000,0.000000 +-3.0,-162.900000,0.000000,0.000000 +-3.0,-162.000000,0.000000,0.000000 +-3.0,-161.100000,0.000000,0.000000 +-3.0,-160.200000,0.000000,0.000000 +-3.0,-159.300000,0.000000,0.000000 +-3.0,-158.400000,0.000000,0.000000 +-3.0,-157.500000,0.000000,0.000000 +-3.0,-156.600000,0.000000,0.000000 +-3.0,-155.700000,0.000000,0.000000 +-3.0,-154.800000,0.000000,0.000000 +-3.0,-153.900000,0.000000,0.000000 +-3.0,-153.000000,0.000000,0.000000 +-3.0,-152.100000,0.000000,0.000000 +-3.0,-151.200000,0.000000,0.000000 +-3.0,-150.300000,0.000000,0.000000 +-3.0,-149.400000,0.000000,0.000000 +-3.0,-148.500000,0.000000,0.000000 +-3.0,-147.600000,0.000000,0.000000 +-3.0,-146.700000,0.000000,0.000000 +-3.0,-145.800000,0.000000,0.000000 +-3.0,-144.900000,0.000000,0.000000 +-3.0,-144.000000,0.000000,0.000000 +-3.0,-143.100000,0.000000,0.000000 +-3.0,-142.200000,0.000000,0.000000 +-3.0,-141.300000,0.000000,0.000000 +-3.0,-140.400000,0.000000,0.000000 +-3.0,-139.500000,0.000000,0.000000 +-3.0,-138.600000,0.000000,0.000000 +-3.0,-137.700000,0.000000,0.000000 +-3.0,-136.800000,0.000000,0.000000 +-3.0,-135.900000,0.000000,0.000000 +-3.0,-135.000000,0.000000,0.000000 +-3.0,-134.100000,0.000000,0.000000 +-3.0,-133.200000,0.000000,0.000000 +-3.0,-132.300000,0.000000,0.000000 +-3.0,-131.400000,0.000000,0.000000 +-3.0,-130.500000,0.000000,0.000000 +-3.0,-129.600000,0.000000,0.000000 +-3.0,-128.700000,0.000000,0.000000 +-3.0,-127.800000,0.000000,0.000000 +-3.0,-126.900000,0.000000,0.000000 +-3.0,-126.000000,0.000000,0.000000 +-3.0,-125.100000,0.000000,0.000000 +-3.0,-124.200000,0.000000,0.000000 +-3.0,-123.300000,0.000000,0.000000 +-3.0,-122.400000,0.000000,0.000000 +-3.0,-121.500000,0.000000,0.000000 +-3.0,-120.600000,0.000000,0.000000 +-3.0,-119.700000,0.000000,0.000000 +-3.0,-118.800000,0.000000,0.000000 +-3.0,-117.900000,0.000000,0.000000 +-3.0,-117.000000,0.000000,0.000000 +-3.0,-116.100000,0.000000,0.000000 +-3.0,-115.200000,0.000000,0.000000 +-3.0,-114.300000,0.000000,0.000000 +-3.0,-113.400000,0.000000,0.000000 +-3.0,-112.500000,0.000000,0.000000 +-3.0,-111.600000,0.000000,0.000000 +-3.0,-110.700000,0.000000,0.000000 +-3.0,-109.800000,0.000000,0.000000 +-3.0,-108.900000,0.000000,0.000000 +-3.0,-108.000000,0.000000,0.000000 +-3.0,-107.100000,0.000000,0.000000 +-3.0,-106.200000,0.000000,0.000000 +-3.0,-105.300000,0.000000,0.000000 +-3.0,-104.400000,0.000000,0.000000 +-3.0,-103.500000,0.000000,0.000000 +-3.0,-102.600000,0.000000,0.000000 +-3.0,-101.700000,0.000000,0.000000 +-3.0,-100.800000,0.000000,0.000000 +-3.0,-99.900000,0.000000,0.000000 +-3.0,-99.000000,0.000000,0.000000 +-3.0,-98.100000,0.000000,0.000000 +-3.0,-97.200000,0.000000,0.000000 +-3.0,-96.300000,0.000000,0.000000 +-3.0,-95.400000,0.000000,0.000000 +-3.0,-94.500000,0.000000,0.000000 +-3.0,-93.600000,0.000000,0.000000 +-3.0,-92.700000,0.000000,0.000000 +-3.0,-91.800000,0.000000,0.000000 +-3.0,-90.900000,0.000000,0.000000 +-3.0,-90.000000,0.000000,0.000000 +-3.0,-89.100000,0.000000,0.000000 +-3.0,-88.200000,0.000000,0.000000 +-3.0,-87.300000,0.000000,0.000000 +-3.0,-86.400000,0.000000,0.000000 +-3.0,-85.500000,0.000000,0.000000 +-3.0,-84.600000,0.000000,0.000000 +-3.0,-83.700000,0.000000,0.000000 +-3.0,-82.800000,0.000000,0.000000 +-3.0,-81.900000,0.000000,0.000000 +-3.0,-81.000000,0.000000,0.000000 +-3.0,-80.100000,0.000000,0.000000 +-3.0,-79.200000,0.000000,0.000000 +-3.0,-78.300000,0.000000,0.000000 +-3.0,-77.400000,0.000000,0.000000 +-3.0,-76.500000,0.000000,0.000000 +-3.0,-75.600000,0.000000,0.000000 +-3.0,-74.700000,0.000000,0.000000 +-3.0,-73.800000,0.000000,0.000000 +-3.0,-72.900000,0.000000,0.000000 +-3.0,-72.000000,0.000000,0.000000 +-3.0,-71.100000,0.000000,0.000000 +-3.0,-70.200000,0.000000,0.000000 +-3.0,-69.300000,0.000000,0.000000 +-3.0,-68.400000,0.000000,0.000000 +-3.0,-67.500000,0.000000,0.000000 +-3.0,-66.600000,0.000000,0.000000 +-3.0,-65.700000,0.000000,0.000000 +-3.0,-64.800000,0.000000,0.000000 +-3.0,-63.900000,0.000000,0.000000 +-3.0,-63.000000,0.000000,0.000000 +-3.0,-62.100000,0.000000,0.000000 +-3.0,-61.200000,0.000000,0.000000 +-3.0,-60.300000,0.000000,0.000000 +-3.0,-59.400000,0.000000,0.000000 +-3.0,-58.500000,0.000000,0.000000 +-3.0,-57.600000,0.000000,0.000000 +-3.0,-56.700000,0.000000,0.000000 +-3.0,-55.800000,0.000000,0.000000 +-3.0,-54.900000,0.000000,0.000000 +-3.0,-54.000000,0.000000,0.000000 +-3.0,-53.100000,0.000000,0.000000 +-3.0,-52.200000,0.000000,0.000000 +-3.0,-51.300000,0.000000,0.000000 +-3.0,-50.400000,0.000000,0.000000 +-3.0,-49.500000,0.000000,0.000000 +-3.0,-48.600000,0.000000,0.000000 +-3.0,-47.700000,0.000000,0.000000 +-3.0,-46.800000,0.000000,0.000000 +-3.0,-45.900000,0.000000,0.000000 +-3.0,-45.000000,0.000000,0.000000 +-3.0,-44.100000,0.000000,0.000000 +-3.0,-43.200000,0.000000,0.000000 +-3.0,-42.300000,0.000000,0.000000 +-3.0,-41.400000,0.000000,0.000000 +-3.0,-40.500000,0.000000,0.000000 +-3.0,-39.600000,0.000000,0.000000 +-3.0,-38.700000,0.000000,0.000000 +-3.0,-37.800000,0.000000,0.000000 +-3.0,-36.900000,0.000000,0.000000 +-3.0,-36.000000,0.000000,0.000000 +-3.0,-35.100000,0.000000,0.000000 +-3.0,-34.200000,0.000000,0.000000 +-3.0,-33.300000,0.000000,0.000000 +-3.0,-32.400000,0.000000,0.000000 +-3.0,-31.500000,0.000000,0.000000 +-3.0,-30.600000,0.000000,0.000000 +-3.0,-29.700000,0.000000,0.000000 +-3.0,-28.800000,0.000000,0.000000 +-3.0,-27.900000,0.000000,0.000000 +-3.0,-27.000000,0.000000,0.000000 +-3.0,-26.100000,0.000000,0.000000 +-3.0,-25.200000,0.000000,0.000000 +-3.0,-24.300000,0.000000,0.000000 +-3.0,-23.400000,0.000000,0.000000 +-3.0,-22.500000,0.000000,0.000000 +-3.0,-21.600000,0.000000,0.000000 +-3.0,-20.700000,0.000000,0.000000 +-3.0,-19.800000,0.000000,0.000000 +-3.0,-18.900000,0.000000,0.000000 +-3.0,-18.000000,0.000000,0.000000 +-3.0,-17.100000,0.000000,0.000000 +-3.0,-16.200000,0.000000,0.000000 +-3.0,-15.300000,0.000000,0.000000 +-3.0,-14.400000,0.000000,0.000000 +-3.0,-13.500000,0.000000,0.000000 +-3.0,-12.600000,0.000000,0.000000 +-3.0,-11.700000,0.000000,0.000000 +-3.0,-10.800000,0.000000,0.000000 +-3.0,-9.900000,0.000000,0.000000 +-3.0,-9.000000,0.000000,0.000000 +-3.0,-8.100000,0.000000,0.000000 +-3.0,-7.200000,0.000000,0.000000 +-3.0,-6.300000,0.000000,0.000000 +-3.0,-5.400000,0.000000,0.000000 +-3.0,-4.500000,0.000000,0.000000 +-3.0,-3.600000,0.000000,0.000000 +-3.0,-2.700000,0.000000,0.000000 +-3.0,-1.800000,0.000000,0.000000 +-3.0,-0.900000,0.000000,0.000000 +-3.0,0.000000,0.000000,0.000000 +-3.0,0.900000,0.000000,0.000000 +-3.0,1.800000,0.000000,0.000000 +-3.0,2.700000,0.000000,0.000000 +-3.0,3.600000,0.000000,0.000000 +-3.0,4.500000,0.000000,0.000000 +-3.0,5.400000,0.000000,0.000000 +-3.0,6.300000,0.000000,0.000000 +-3.0,7.200000,0.000000,0.000000 +-3.0,8.100000,0.000000,0.000000 +-3.0,9.000000,0.000000,0.000000 +-3.0,9.900000,0.000000,0.000000 +-3.0,10.800000,0.000000,0.000000 +-3.0,11.700000,0.000000,0.000000 +-3.0,12.600000,0.000000,0.000000 +-3.0,13.500000,0.000000,0.000000 +-3.0,14.400000,0.000000,0.000000 +-3.0,15.300000,0.000000,0.000000 +-3.0,16.200000,0.000000,0.000000 +-3.0,17.100000,0.000000,0.000000 +-3.0,18.000000,0.000000,0.000000 +-3.0,18.900000,0.000000,0.000000 +-3.0,19.800000,0.000000,0.000000 +-3.0,20.700000,0.000000,0.000000 +-3.0,21.600000,0.000000,0.000000 +-3.0,22.500000,0.000000,0.000000 +-3.0,23.400000,0.000000,0.000000 +-3.0,24.300000,0.000000,0.000000 +-3.0,25.200000,0.000000,0.000000 +-3.0,26.100000,0.000000,0.000000 +-3.0,27.000000,0.000000,0.000000 +-3.0,27.900000,0.000000,0.000000 +-3.0,28.800000,0.000000,0.000000 +-3.0,29.700000,0.000000,0.000000 +-3.0,30.600000,0.000000,0.000000 +-3.0,31.500000,0.000000,0.000000 +-3.0,32.400000,0.000000,0.000000 +-3.0,33.300000,0.000000,0.000000 +-3.0,34.200000,0.000000,0.000000 +-3.0,35.100000,0.000000,0.000000 +-3.0,36.000000,0.000000,0.000000 +-3.0,36.900000,0.000000,0.000000 +-3.0,37.800000,0.000000,0.000000 +-3.0,38.700000,0.000000,0.000000 +-3.0,39.600000,0.000000,0.000000 +-3.0,40.500000,0.000000,0.000000 +-3.0,41.400000,0.000000,0.000000 +-3.0,42.300000,0.000000,0.000000 +-3.0,43.200000,0.000000,0.000000 +-3.0,44.100000,0.000000,0.000000 +-3.0,45.000000,0.000000,0.000000 +-3.0,45.900000,0.000000,0.000000 +-3.0,46.800000,0.000000,0.000000 +-3.0,47.700000,0.000000,0.000000 +-3.0,48.600000,0.000000,0.000000 +-3.0,49.500000,0.000000,0.000000 +-3.0,50.400000,0.000000,0.000000 +-3.0,51.300000,0.000000,0.000000 +-3.0,52.200000,0.000000,0.000000 +-3.0,53.100000,0.000000,0.000000 +-3.0,54.000000,0.000000,0.000000 +-3.0,54.900000,0.000000,0.000000 +-3.0,55.800000,0.000000,0.000000 +-3.0,56.700000,0.000000,0.000000 +-3.0,57.600000,0.000000,0.000000 +-3.0,58.500000,0.000000,0.000000 +-3.0,59.400000,0.000000,0.000000 +-3.0,60.300000,0.000000,0.000000 +-3.0,61.200000,0.000000,0.000000 +-3.0,62.100000,0.000000,0.000000 +-3.0,63.000000,0.000000,0.000000 +-3.0,63.900000,0.000000,0.000000 +-3.0,64.800000,0.000000,0.000000 +-3.0,65.700000,0.000000,0.000000 +-3.0,66.600000,0.000000,0.000000 +-3.0,67.500000,0.000000,0.000000 +-3.0,68.400000,0.000000,0.000000 +-3.0,69.300000,0.000000,0.000000 +-3.0,70.200000,0.000000,0.000000 +-3.0,71.100000,0.000000,0.000000 +-3.0,72.000000,0.000000,0.000000 +-3.0,72.900000,0.000000,0.000000 +-3.0,73.800000,0.000000,0.000000 +-3.0,74.700000,0.000000,0.000000 +-3.0,75.600000,0.000000,0.000000 +-3.0,76.500000,0.000000,0.000000 +-3.0,77.400000,0.000000,0.000000 +-3.0,78.300000,0.000000,0.000000 +-3.0,79.200000,0.000000,0.000000 +-3.0,80.100000,0.000000,0.000000 +-3.0,81.000000,0.000000,0.000000 +-3.0,81.900000,0.000000,0.000000 +-3.0,82.800000,0.000000,0.000000 +-3.0,83.700000,0.000000,0.000000 +-3.0,84.600000,0.000000,0.000000 +-3.0,85.500000,0.000000,0.000000 +-3.0,86.400000,0.000000,0.000000 +-3.0,87.300000,0.000000,0.000000 +-3.0,88.200000,0.000000,0.000000 +-3.0,89.100000,0.000000,0.000000 +-3.0,90.000000,0.000000,0.000000 +-3.0,90.900000,0.000000,0.000000 +-3.0,91.800000,0.000000,0.000000 +-3.0,92.700000,0.000000,0.000000 +-3.0,93.600000,0.000000,0.000000 +-3.0,94.500000,0.000000,0.000000 +-3.0,95.400000,0.000000,0.000000 +-3.0,96.300000,0.000000,0.000000 +-3.0,97.200000,0.000000,0.000000 +-3.0,98.100000,0.000000,0.000000 +-3.0,99.000000,0.000000,0.000000 +-3.0,99.900000,0.000000,0.000000 +-3.0,100.800000,0.000000,0.000000 +-3.0,101.700000,0.000000,0.000000 +-3.0,102.600000,0.000000,0.000000 +-3.0,103.500000,0.000000,0.000000 +-3.0,104.400000,0.000000,0.000000 +-3.0,105.300000,0.000000,0.000000 +-3.0,106.200000,0.000000,0.000000 +-3.0,107.100000,0.000000,0.000000 +-3.0,108.000000,0.000000,0.000000 +-3.0,108.900000,0.000000,0.000000 +-3.0,109.800000,0.000000,0.000000 +-3.0,110.700000,0.000000,0.000000 +-3.0,111.600000,0.000000,0.000000 +-3.0,112.500000,0.000000,0.000000 +-3.0,113.400000,0.000000,0.000000 +-3.0,114.300000,0.000000,0.000000 +-3.0,115.200000,0.000000,0.000000 +-3.0,116.100000,0.000000,0.000000 +-3.0,117.000000,0.000000,0.000000 +-3.0,117.900000,0.000000,0.000000 +-3.0,118.800000,0.000000,0.000000 +-3.0,119.700000,0.000000,0.000000 +-3.0,120.600000,0.000000,0.000000 +-3.0,121.500000,0.000000,0.000000 +-3.0,122.400000,0.000000,0.000000 +-3.0,123.300000,0.000000,0.000000 +-3.0,124.200000,0.000000,0.000000 +-3.0,125.100000,0.000000,0.000000 +-3.0,126.000000,0.000000,0.000000 +-3.0,126.900000,0.000000,0.000000 +-3.0,127.800000,0.000000,0.000000 +-3.0,128.700000,0.000000,0.000000 +-3.0,129.600000,0.000000,0.000000 +-3.0,130.500000,0.000000,0.000000 +-3.0,131.400000,0.000000,0.000000 +-3.0,132.300000,0.000000,0.000000 +-3.0,133.200000,0.000000,0.000000 +-3.0,134.100000,0.000000,0.000000 +-3.0,135.000000,0.000000,0.000000 +-3.0,135.900000,0.000000,0.000000 +-3.0,136.800000,0.000000,0.000000 +-3.0,137.700000,0.000000,0.000000 +-3.0,138.600000,0.000000,0.000000 +-3.0,139.500000,0.000000,0.000000 +-3.0,140.400000,0.000000,0.000000 +-3.0,141.300000,0.000000,0.000000 +-3.0,142.200000,0.000000,0.000000 +-3.0,143.100000,0.000000,0.000000 +-3.0,144.000000,0.000000,0.000000 +-3.0,144.900000,0.000000,0.000000 +-3.0,145.800000,0.000000,0.000000 +-3.0,146.700000,0.000000,0.000000 +-3.0,147.600000,0.000000,0.000000 +-3.0,148.500000,0.000000,0.000000 +-3.0,149.400000,0.000000,0.000000 +-3.0,150.300000,0.000000,0.000000 +-3.0,151.200000,0.000000,0.000000 +-3.0,152.100000,0.000000,0.000000 +-3.0,153.000000,0.000000,0.000000 +-3.0,153.900000,0.000000,0.000000 +-3.0,154.800000,0.000000,0.000000 +-3.0,155.700000,0.000000,0.000000 +-3.0,156.600000,0.000000,0.000000 +-3.0,157.500000,0.000000,0.000000 +-3.0,158.400000,0.000000,0.000000 +-3.0,159.300000,0.000000,0.000000 +-3.0,160.200000,0.000000,0.000000 +-3.0,161.100000,0.000000,0.000000 +-3.0,162.000000,0.000000,0.000000 +-3.0,162.900000,0.000000,0.000000 +-3.0,163.800000,0.000000,0.000000 +-3.0,164.700000,0.000000,0.000000 +-3.0,165.600000,0.000000,0.000000 +-3.0,166.500000,0.000000,0.000000 +-3.0,167.400000,0.000000,0.000000 +-3.0,168.300000,0.000000,0.000000 +-3.0,169.200000,0.000000,0.000000 +-3.0,170.100000,0.000000,0.000000 +-3.0,171.000000,0.000000,0.000000 +-3.0,171.900000,0.000000,0.000000 +-3.0,172.800000,0.000000,0.000000 +-3.0,173.700000,0.000000,0.000000 +-3.0,174.600000,0.000000,0.000000 +-3.0,175.500000,0.000000,0.000000 +-3.0,176.400000,0.000000,0.000000 +-3.0,177.300000,0.000000,0.000000 +-3.0,178.200000,0.000000,0.000000 +-3.0,179.100000,0.000000,0.000000 +-3.0,180.000000,0.000000,0.000000 +-3.0,180.900000,0.000000,0.000000 +-3.0,181.800000,0.000000,0.000000 +-3.0,182.700000,0.000000,0.000000 +-3.0,183.600000,0.000000,0.000000 +-3.0,184.500000,0.000000,0.000000 +-3.0,185.400000,0.000000,0.000000 +-3.0,186.300000,0.000000,0.000000 +-3.0,187.200000,0.000000,0.000000 +-3.0,188.100000,0.000000,0.000000 +-3.0,189.000000,0.000000,0.000000 +-3.0,189.900000,0.000000,0.000000 +-3.0,190.800000,0.000000,0.000000 +-3.0,191.700000,0.000000,0.000000 +-3.0,192.600000,0.000000,0.000000 +-3.0,193.500000,0.000000,0.000000 +-3.0,194.400000,0.000000,0.000000 +-3.0,195.300000,0.000000,0.000000 +-3.0,196.200000,0.000000,0.000000 +-3.0,197.100000,0.000000,0.000000 +-3.0,198.000000,0.000000,0.000000 +-3.0,198.900000,0.000000,0.000000 +-3.0,199.800000,0.000000,0.000000 +-3.0,200.700000,0.000000,0.000000 +-3.0,201.600000,0.000000,0.000000 +-3.0,202.500000,0.000000,0.000000 +-3.0,203.400000,0.000000,0.000000 +-3.0,204.300000,0.000000,0.000000 +-3.0,205.200000,0.000000,0.000000 +-3.0,206.100000,0.000000,0.000000 +-3.0,207.000000,0.000000,0.000000 +-3.0,207.900000,0.000000,0.000000 +-3.0,208.800000,0.000000,0.000000 +-3.0,209.700000,0.000000,0.000000 +-3.0,210.600000,0.000000,0.000000 +-3.0,211.500000,0.000000,0.000000 +-3.0,212.400000,0.000000,0.000000 +-3.0,213.300000,0.000000,0.000000 +-3.0,214.200000,0.000000,0.000000 +-3.0,215.100000,0.000000,0.000000 +-3.0,216.000000,0.000000,0.000000 +-3.0,216.900000,0.000000,0.000000 +-3.0,217.800000,0.000000,0.000000 +-3.0,218.700000,0.000000,0.000000 +-3.0,219.600000,0.000000,0.000000 +-3.0,220.500000,0.000000,0.000000 +-3.0,221.400000,0.000000,0.000000 +-3.0,222.300000,0.000000,0.000000 +-3.0,223.200000,0.000000,0.000000 +-3.0,224.100000,0.000000,0.000000 +-3.0,225.000000,0.000000,0.000000 +-3.0,225.900000,0.000000,0.000000 +-3.0,226.800000,0.000000,0.000000 +-3.0,227.700000,0.000000,0.000000 +-3.0,228.600000,0.000000,0.000000 +-3.0,229.500000,0.000000,0.000000 +-3.0,230.400000,0.000000,0.000000 +-3.0,231.300000,0.000000,0.000000 +-3.0,232.200000,0.000000,0.000000 +-3.0,233.100000,0.000000,0.000000 +-3.0,234.000000,0.000000,0.000000 +-3.0,234.900000,0.000000,0.000000 +-3.0,235.800000,0.000000,0.000000 +-3.0,236.700000,0.000000,0.000000 +-3.0,237.600000,0.000000,0.000000 +-3.0,238.500000,0.000000,0.000000 +-3.0,239.400000,0.000000,0.000000 +-3.0,240.300000,0.000000,0.000000 +-3.0,241.200000,0.000000,0.000000 +-3.0,242.100000,0.000000,0.000000 +-3.0,243.000000,0.000000,0.000000 +-3.0,243.900000,0.000000,0.000000 +-3.0,244.800000,0.000000,0.000000 +-3.0,245.700000,0.000000,0.000000 +-3.0,246.600000,0.000000,0.000000 +-3.0,247.500000,0.000000,0.000000 +-3.0,248.400000,0.000000,0.000000 +-3.0,249.300000,0.000000,0.000000 +-3.0,250.200000,0.000000,0.000000 +-3.0,251.100000,0.000000,0.000000 +-3.0,252.000000,0.000000,0.000000 +-3.0,252.900000,0.000000,0.000000 +-3.0,253.800000,0.000000,0.000000 +-3.0,254.700000,0.000000,0.000000 +-3.0,255.600000,0.000000,0.000000 +-3.0,256.500000,0.000000,0.000000 +-3.0,257.400000,0.000000,0.000000 +-3.0,258.300000,0.000000,0.000000 +-3.0,259.200000,0.000000,0.000000 +-3.0,260.100000,0.000000,0.000000 +-3.0,261.000000,0.000000,0.000000 +-3.0,261.900000,0.000000,0.000000 +-3.0,262.800000,0.000000,0.000000 +-3.0,263.700000,0.000000,0.000000 +-3.0,264.600000,0.000000,0.000000 +-3.0,265.500000,0.000000,0.000000 +-3.0,266.400000,0.000000,0.000000 +-3.0,267.300000,0.000000,0.000000 +-3.0,268.200000,0.000000,0.000000 +-3.0,269.100000,0.000000,0.000000 +-3.0,270.000000,0.000000,0.000000 +-3.0,270.900000,0.000000,0.000000 +-3.0,271.800000,0.000000,0.000000 +-3.0,272.700000,0.000000,0.000000 +-3.0,273.600000,0.000000,0.000000 +-3.0,274.500000,0.000000,0.000000 +-3.0,275.400000,0.000000,0.000000 +-3.0,276.300000,0.000000,0.000000 +-3.0,277.200000,0.000000,0.000000 +-3.0,278.100000,0.000000,0.000000 +-3.0,279.000000,0.000000,0.000000 +-3.0,279.900000,0.000000,0.000000 +-3.0,280.800000,0.000000,0.000000 +-3.0,281.700000,0.000000,0.000000 +-3.0,282.600000,0.000000,0.000000 +-3.0,283.500000,0.000000,0.000000 +-3.0,284.400000,0.000000,0.000000 +-3.0,285.300000,0.000000,0.000000 +-3.0,286.200000,0.000000,0.000000 +-3.0,287.100000,0.000000,0.000000 +-3.0,288.000000,0.000000,0.000000 +-3.0,288.900000,0.000000,0.000000 +-3.0,289.800000,0.000000,0.000000 +-3.0,290.700000,0.000000,0.000000 +-3.0,291.600000,0.000000,0.000000 +-3.0,292.500000,0.000000,0.000000 +-3.0,293.400000,0.000000,0.000000 +-3.0,294.300000,0.000000,0.000000 +-3.0,295.200000,0.000000,0.000000 +-3.0,296.100000,0.000000,0.000000 +-3.0,297.000000,0.000000,0.000000 +-3.0,297.900000,0.000000,0.000000 +-3.0,298.800000,0.000000,0.000000 +-3.0,299.700000,0.000000,0.000000 +-3.0,300.600000,0.000000,0.000000 +-3.0,301.500000,0.000000,0.000000 +-3.0,302.400000,0.000000,0.000000 +-3.0,303.300000,0.000000,0.000000 +-3.0,304.200000,0.000000,0.000000 +-3.0,305.100000,0.000000,0.000000 +-3.0,306.000000,0.000000,0.000000 +-3.0,306.900000,0.000000,0.000000 +-3.0,307.800000,0.000000,0.000000 +-3.0,308.700000,0.000000,0.000000 +-3.0,309.600000,0.000000,0.000000 +-3.0,310.500000,0.000000,0.000000 +-3.0,311.400000,0.000000,0.000000 +-3.0,312.300000,0.000000,0.000000 +-3.0,313.200000,0.000000,0.000000 +-3.0,314.100000,0.000000,0.000000 +-3.0,315.000000,0.000000,0.000000 +-3.0,315.900000,0.000000,0.000000 +-3.0,316.800000,0.000000,0.000000 +-3.0,317.700000,0.000000,0.000000 +-3.0,318.600000,0.000000,0.000000 +-3.0,319.500000,0.000000,0.000000 +-3.0,320.400000,0.000000,0.000000 +-3.0,321.300000,0.000000,0.000000 +-3.0,322.200000,0.000000,0.000000 +-3.0,323.100000,0.000000,0.000000 +-3.0,324.000000,0.000000,0.000000 +-3.0,324.900000,0.000000,0.000000 +-3.0,325.800000,0.000000,0.000000 +-3.0,326.700000,0.000000,0.000000 +-3.0,327.600000,0.000000,0.000000 +-3.0,328.500000,0.000000,0.000000 +-3.0,329.400000,0.000000,0.000000 +-3.0,330.300000,0.000000,0.000000 +-3.0,331.200000,0.000000,0.000000 +-3.0,332.100000,0.000000,0.000000 +-3.0,333.000000,0.000000,0.000000 +-3.0,333.900000,0.000000,0.000000 +-3.0,334.800000,0.000000,0.000000 +-3.0,335.700000,0.000000,0.000000 +-3.0,336.600000,0.000000,0.000000 +-3.0,337.500000,0.000000,0.000000 +-3.0,338.400000,0.000000,0.000000 +-3.0,339.300000,0.000000,0.000000 +-3.0,340.200000,0.000000,0.000000 +-3.0,341.100000,0.000000,0.000000 +-3.0,342.000000,0.000000,0.000000 +-3.0,342.900000,0.000000,0.000000 +-3.0,343.800000,0.000000,0.000000 +-3.0,344.700000,0.000000,0.000000 +-3.0,345.600000,0.000000,0.000000 +-3.0,346.500000,0.000000,0.000000 +-3.0,347.400000,0.000000,0.000000 +-3.0,348.300000,0.000000,0.000000 +-3.0,349.200000,0.000000,0.000000 +-3.0,350.100000,0.000000,0.000000 +-3.0,351.000000,0.000000,0.000000 +-3.0,351.900000,0.000000,0.000000 +-3.0,352.800000,0.000000,0.000000 +-3.0,353.700000,0.000000,0.000000 +-3.0,354.600000,0.000000,0.000000 +-3.0,355.500000,0.000000,0.000000 +-3.0,356.400000,0.000000,0.000000 +-3.0,357.300000,0.000000,0.000000 +-3.0,358.200000,0.000000,0.000000 +-3.0,359.100000,0.000000,0.000000 +-3.0,0.000000,-360.000000,0.000000 +-3.0,0.000000,-359.100000,0.000000 +-3.0,0.000000,-358.200000,0.000000 +-3.0,0.000000,-357.300000,0.000000 +-3.0,0.000000,-356.400000,0.000000 +-3.0,0.000000,-355.500000,0.000000 +-3.0,0.000000,-354.600000,0.000000 +-3.0,0.000000,-353.700000,0.000000 +-3.0,0.000000,-352.800000,0.000000 +-3.0,0.000000,-351.900000,0.000000 +-3.0,0.000000,-351.000000,0.000000 +-3.0,0.000000,-350.100000,0.000000 +-3.0,0.000000,-349.200000,0.000000 +-3.0,0.000000,-348.300000,0.000000 +-3.0,0.000000,-347.400000,0.000000 +-3.0,0.000000,-346.500000,0.000000 +-3.0,0.000000,-345.600000,0.000000 +-3.0,0.000000,-344.700000,0.000000 +-3.0,0.000000,-343.800000,0.000000 +-3.0,0.000000,-342.900000,0.000000 +-3.0,0.000000,-342.000000,0.000000 +-3.0,0.000000,-341.100000,0.000000 +-3.0,0.000000,-340.200000,0.000000 +-3.0,0.000000,-339.300000,0.000000 +-3.0,0.000000,-338.400000,0.000000 +-3.0,0.000000,-337.500000,0.000000 +-3.0,0.000000,-336.600000,0.000000 +-3.0,0.000000,-335.700000,0.000000 +-3.0,0.000000,-334.800000,0.000000 +-3.0,0.000000,-333.900000,0.000000 +-3.0,0.000000,-333.000000,0.000000 +-3.0,0.000000,-332.100000,0.000000 +-3.0,0.000000,-331.200000,0.000000 +-3.0,0.000000,-330.300000,0.000000 +-3.0,0.000000,-329.400000,0.000000 +-3.0,0.000000,-328.500000,0.000000 +-3.0,0.000000,-327.600000,0.000000 +-3.0,0.000000,-326.700000,0.000000 +-3.0,0.000000,-325.800000,0.000000 +-3.0,0.000000,-324.900000,0.000000 +-3.0,0.000000,-324.000000,0.000000 +-3.0,0.000000,-323.100000,0.000000 +-3.0,0.000000,-322.200000,0.000000 +-3.0,0.000000,-321.300000,0.000000 +-3.0,0.000000,-320.400000,0.000000 +-3.0,0.000000,-319.500000,0.000000 +-3.0,0.000000,-318.600000,0.000000 +-3.0,0.000000,-317.700000,0.000000 +-3.0,0.000000,-316.800000,0.000000 +-3.0,0.000000,-315.900000,0.000000 +-3.0,0.000000,-315.000000,0.000000 +-3.0,0.000000,-314.100000,0.000000 +-3.0,0.000000,-313.200000,0.000000 +-3.0,0.000000,-312.300000,0.000000 +-3.0,0.000000,-311.400000,0.000000 +-3.0,0.000000,-310.500000,0.000000 +-3.0,0.000000,-309.600000,0.000000 +-3.0,0.000000,-308.700000,0.000000 +-3.0,0.000000,-307.800000,0.000000 +-3.0,0.000000,-306.900000,0.000000 +-3.0,0.000000,-306.000000,0.000000 +-3.0,0.000000,-305.100000,0.000000 +-3.0,0.000000,-304.200000,0.000000 +-3.0,0.000000,-303.300000,0.000000 +-3.0,0.000000,-302.400000,0.000000 +-3.0,0.000000,-301.500000,0.000000 +-3.0,0.000000,-300.600000,0.000000 +-3.0,0.000000,-299.700000,0.000000 +-3.0,0.000000,-298.800000,0.000000 +-3.0,0.000000,-297.900000,0.000000 +-3.0,0.000000,-297.000000,0.000000 +-3.0,0.000000,-296.100000,0.000000 +-3.0,0.000000,-295.200000,0.000000 +-3.0,0.000000,-294.300000,0.000000 +-3.0,0.000000,-293.400000,0.000000 +-3.0,0.000000,-292.500000,0.000000 +-3.0,0.000000,-291.600000,0.000000 +-3.0,0.000000,-290.700000,0.000000 +-3.0,0.000000,-289.800000,0.000000 +-3.0,0.000000,-288.900000,0.000000 +-3.0,0.000000,-288.000000,0.000000 +-3.0,0.000000,-287.100000,0.000000 +-3.0,0.000000,-286.200000,0.000000 +-3.0,0.000000,-285.300000,0.000000 +-3.0,0.000000,-284.400000,0.000000 +-3.0,0.000000,-283.500000,0.000000 +-3.0,0.000000,-282.600000,0.000000 +-3.0,0.000000,-281.700000,0.000000 +-3.0,0.000000,-280.800000,0.000000 +-3.0,0.000000,-279.900000,0.000000 +-3.0,0.000000,-279.000000,0.000000 +-3.0,0.000000,-278.100000,0.000000 +-3.0,0.000000,-277.200000,0.000000 +-3.0,0.000000,-276.300000,0.000000 +-3.0,0.000000,-275.400000,0.000000 +-3.0,0.000000,-274.500000,0.000000 +-3.0,0.000000,-273.600000,0.000000 +-3.0,0.000000,-272.700000,0.000000 +-3.0,0.000000,-271.800000,0.000000 +-3.0,0.000000,-270.900000,0.000000 +-3.0,0.000000,-270.000000,0.000000 +-3.0,0.000000,-269.100000,0.000000 +-3.0,0.000000,-268.200000,0.000000 +-3.0,0.000000,-267.300000,0.000000 +-3.0,0.000000,-266.400000,0.000000 +-3.0,0.000000,-265.500000,0.000000 +-3.0,0.000000,-264.600000,0.000000 +-3.0,0.000000,-263.700000,0.000000 +-3.0,0.000000,-262.800000,0.000000 +-3.0,0.000000,-261.900000,0.000000 +-3.0,0.000000,-261.000000,0.000000 +-3.0,0.000000,-260.100000,0.000000 +-3.0,0.000000,-259.200000,0.000000 +-3.0,0.000000,-258.300000,0.000000 +-3.0,0.000000,-257.400000,0.000000 +-3.0,0.000000,-256.500000,0.000000 +-3.0,0.000000,-255.600000,0.000000 +-3.0,0.000000,-254.700000,0.000000 +-3.0,0.000000,-253.800000,0.000000 +-3.0,0.000000,-252.900000,0.000000 +-3.0,0.000000,-252.000000,0.000000 +-3.0,0.000000,-251.100000,0.000000 +-3.0,0.000000,-250.200000,0.000000 +-3.0,0.000000,-249.300000,0.000000 +-3.0,0.000000,-248.400000,0.000000 +-3.0,0.000000,-247.500000,0.000000 +-3.0,0.000000,-246.600000,0.000000 +-3.0,0.000000,-245.700000,0.000000 +-3.0,0.000000,-244.800000,0.000000 +-3.0,0.000000,-243.900000,0.000000 +-3.0,0.000000,-243.000000,0.000000 +-3.0,0.000000,-242.100000,0.000000 +-3.0,0.000000,-241.200000,0.000000 +-3.0,0.000000,-240.300000,0.000000 +-3.0,0.000000,-239.400000,0.000000 +-3.0,0.000000,-238.500000,0.000000 +-3.0,0.000000,-237.600000,0.000000 +-3.0,0.000000,-236.700000,0.000000 +-3.0,0.000000,-235.800000,0.000000 +-3.0,0.000000,-234.900000,0.000000 +-3.0,0.000000,-234.000000,0.000000 +-3.0,0.000000,-233.100000,0.000000 +-3.0,0.000000,-232.200000,0.000000 +-3.0,0.000000,-231.300000,0.000000 +-3.0,0.000000,-230.400000,0.000000 +-3.0,0.000000,-229.500000,0.000000 +-3.0,0.000000,-228.600000,0.000000 +-3.0,0.000000,-227.700000,0.000000 +-3.0,0.000000,-226.800000,0.000000 +-3.0,0.000000,-225.900000,0.000000 +-3.0,0.000000,-225.000000,0.000000 +-3.0,0.000000,-224.100000,0.000000 +-3.0,0.000000,-223.200000,0.000000 +-3.0,0.000000,-222.300000,0.000000 +-3.0,0.000000,-221.400000,0.000000 +-3.0,0.000000,-220.500000,0.000000 +-3.0,0.000000,-219.600000,0.000000 +-3.0,0.000000,-218.700000,0.000000 +-3.0,0.000000,-217.800000,0.000000 +-3.0,0.000000,-216.900000,0.000000 +-3.0,0.000000,-216.000000,0.000000 +-3.0,0.000000,-215.100000,0.000000 +-3.0,0.000000,-214.200000,0.000000 +-3.0,0.000000,-213.300000,0.000000 +-3.0,0.000000,-212.400000,0.000000 +-3.0,0.000000,-211.500000,0.000000 +-3.0,0.000000,-210.600000,0.000000 +-3.0,0.000000,-209.700000,0.000000 +-3.0,0.000000,-208.800000,0.000000 +-3.0,0.000000,-207.900000,0.000000 +-3.0,0.000000,-207.000000,0.000000 +-3.0,0.000000,-206.100000,0.000000 +-3.0,0.000000,-205.200000,0.000000 +-3.0,0.000000,-204.300000,0.000000 +-3.0,0.000000,-203.400000,0.000000 +-3.0,0.000000,-202.500000,0.000000 +-3.0,0.000000,-201.600000,0.000000 +-3.0,0.000000,-200.700000,0.000000 +-3.0,0.000000,-199.800000,0.000000 +-3.0,0.000000,-198.900000,0.000000 +-3.0,0.000000,-198.000000,0.000000 +-3.0,0.000000,-197.100000,0.000000 +-3.0,0.000000,-196.200000,0.000000 +-3.0,0.000000,-195.300000,0.000000 +-3.0,0.000000,-194.400000,0.000000 +-3.0,0.000000,-193.500000,0.000000 +-3.0,0.000000,-192.600000,0.000000 +-3.0,0.000000,-191.700000,0.000000 +-3.0,0.000000,-190.800000,0.000000 +-3.0,0.000000,-189.900000,0.000000 +-3.0,0.000000,-189.000000,0.000000 +-3.0,0.000000,-188.100000,0.000000 +-3.0,0.000000,-187.200000,0.000000 +-3.0,0.000000,-186.300000,0.000000 +-3.0,0.000000,-185.400000,0.000000 +-3.0,0.000000,-184.500000,0.000000 +-3.0,0.000000,-183.600000,0.000000 +-3.0,0.000000,-182.700000,0.000000 +-3.0,0.000000,-181.800000,0.000000 +-3.0,0.000000,-180.900000,0.000000 +-3.0,0.000000,-180.000000,0.000000 +-3.0,0.000000,-179.100000,0.000000 +-3.0,0.000000,-178.200000,0.000000 +-3.0,0.000000,-177.300000,0.000000 +-3.0,0.000000,-176.400000,0.000000 +-3.0,0.000000,-175.500000,0.000000 +-3.0,0.000000,-174.600000,0.000000 +-3.0,0.000000,-173.700000,0.000000 +-3.0,0.000000,-172.800000,0.000000 +-3.0,0.000000,-171.900000,0.000000 +-3.0,0.000000,-171.000000,0.000000 +-3.0,0.000000,-170.100000,0.000000 +-3.0,0.000000,-169.200000,0.000000 +-3.0,0.000000,-168.300000,0.000000 +-3.0,0.000000,-167.400000,0.000000 +-3.0,0.000000,-166.500000,0.000000 +-3.0,0.000000,-165.600000,0.000000 +-3.0,0.000000,-164.700000,0.000000 +-3.0,0.000000,-163.800000,0.000000 +-3.0,0.000000,-162.900000,0.000000 +-3.0,0.000000,-162.000000,0.000000 +-3.0,0.000000,-161.100000,0.000000 +-3.0,0.000000,-160.200000,0.000000 +-3.0,0.000000,-159.300000,0.000000 +-3.0,0.000000,-158.400000,0.000000 +-3.0,0.000000,-157.500000,0.000000 +-3.0,0.000000,-156.600000,0.000000 +-3.0,0.000000,-155.700000,0.000000 +-3.0,0.000000,-154.800000,0.000000 +-3.0,0.000000,-153.900000,0.000000 +-3.0,0.000000,-153.000000,0.000000 +-3.0,0.000000,-152.100000,0.000000 +-3.0,0.000000,-151.200000,0.000000 +-3.0,0.000000,-150.300000,0.000000 +-3.0,0.000000,-149.400000,0.000000 +-3.0,0.000000,-148.500000,0.000000 +-3.0,0.000000,-147.600000,0.000000 +-3.0,0.000000,-146.700000,0.000000 +-3.0,0.000000,-145.800000,0.000000 +-3.0,0.000000,-144.900000,0.000000 +-3.0,0.000000,-144.000000,0.000000 +-3.0,0.000000,-143.100000,0.000000 +-3.0,0.000000,-142.200000,0.000000 +-3.0,0.000000,-141.300000,0.000000 +-3.0,0.000000,-140.400000,0.000000 +-3.0,0.000000,-139.500000,0.000000 +-3.0,0.000000,-138.600000,0.000000 +-3.0,0.000000,-137.700000,0.000000 +-3.0,0.000000,-136.800000,0.000000 +-3.0,0.000000,-135.900000,0.000000 +-3.0,0.000000,-135.000000,0.000000 +-3.0,0.000000,-134.100000,0.000000 +-3.0,0.000000,-133.200000,0.000000 +-3.0,0.000000,-132.300000,0.000000 +-3.0,0.000000,-131.400000,0.000000 +-3.0,0.000000,-130.500000,0.000000 +-3.0,0.000000,-129.600000,0.000000 +-3.0,0.000000,-128.700000,0.000000 +-3.0,0.000000,-127.800000,0.000000 +-3.0,0.000000,-126.900000,0.000000 +-3.0,0.000000,-126.000000,0.000000 +-3.0,0.000000,-125.100000,0.000000 +-3.0,0.000000,-124.200000,0.000000 +-3.0,0.000000,-123.300000,0.000000 +-3.0,0.000000,-122.400000,0.000000 +-3.0,0.000000,-121.500000,0.000000 +-3.0,0.000000,-120.600000,0.000000 +-3.0,0.000000,-119.700000,0.000000 +-3.0,0.000000,-118.800000,0.000000 +-3.0,0.000000,-117.900000,0.000000 +-3.0,0.000000,-117.000000,0.000000 +-3.0,0.000000,-116.100000,0.000000 +-3.0,0.000000,-115.200000,0.000000 +-3.0,0.000000,-114.300000,0.000000 +-3.0,0.000000,-113.400000,0.000000 +-3.0,0.000000,-112.500000,0.000000 +-3.0,0.000000,-111.600000,0.000000 +-3.0,0.000000,-110.700000,0.000000 +-3.0,0.000000,-109.800000,0.000000 +-3.0,0.000000,-108.900000,0.000000 +-3.0,0.000000,-108.000000,0.000000 +-3.0,0.000000,-107.100000,0.000000 +-3.0,0.000000,-106.200000,0.000000 +-3.0,0.000000,-105.300000,0.000000 +-3.0,0.000000,-104.400000,0.000000 +-3.0,0.000000,-103.500000,0.000000 +-3.0,0.000000,-102.600000,0.000000 +-3.0,0.000000,-101.700000,0.000000 +-3.0,0.000000,-100.800000,0.000000 +-3.0,0.000000,-99.900000,0.000000 +-3.0,0.000000,-99.000000,0.000000 +-3.0,0.000000,-98.100000,0.000000 +-3.0,0.000000,-97.200000,0.000000 +-3.0,0.000000,-96.300000,0.000000 +-3.0,0.000000,-95.400000,0.000000 +-3.0,0.000000,-94.500000,0.000000 +-3.0,0.000000,-93.600000,0.000000 +-3.0,0.000000,-92.700000,0.000000 +-3.0,0.000000,-91.800000,0.000000 +-3.0,0.000000,-90.900000,0.000000 +-3.0,0.000000,-90.000000,0.000000 +-3.0,0.000000,-89.100000,0.000000 +-3.0,0.000000,-88.200000,0.000000 +-3.0,0.000000,-87.300000,0.000000 +-3.0,0.000000,-86.400000,0.000000 +-3.0,0.000000,-85.500000,0.000000 +-3.0,0.000000,-84.600000,0.000000 +-3.0,0.000000,-83.700000,0.000000 +-3.0,0.000000,-82.800000,0.000000 +-3.0,0.000000,-81.900000,0.000000 +-3.0,0.000000,-81.000000,0.000000 +-3.0,0.000000,-80.100000,0.000000 +-3.0,0.000000,-79.200000,0.000000 +-3.0,0.000000,-78.300000,0.000000 +-3.0,0.000000,-77.400000,0.000000 +-3.0,0.000000,-76.500000,0.000000 +-3.0,0.000000,-75.600000,0.000000 +-3.0,0.000000,-74.700000,0.000000 +-3.0,0.000000,-73.800000,0.000000 +-3.0,0.000000,-72.900000,0.000000 +-3.0,0.000000,-72.000000,0.000000 +-3.0,0.000000,-71.100000,0.000000 +-3.0,0.000000,-70.200000,0.000000 +-3.0,0.000000,-69.300000,0.000000 +-3.0,0.000000,-68.400000,0.000000 +-3.0,0.000000,-67.500000,0.000000 +-3.0,0.000000,-66.600000,0.000000 +-3.0,0.000000,-65.700000,0.000000 +-3.0,0.000000,-64.800000,0.000000 +-3.0,0.000000,-63.900000,0.000000 +-3.0,0.000000,-63.000000,0.000000 +-3.0,0.000000,-62.100000,0.000000 +-3.0,0.000000,-61.200000,0.000000 +-3.0,0.000000,-60.300000,0.000000 +-3.0,0.000000,-59.400000,0.000000 +-3.0,0.000000,-58.500000,0.000000 +-3.0,0.000000,-57.600000,0.000000 +-3.0,0.000000,-56.700000,0.000000 +-3.0,0.000000,-55.800000,0.000000 +-3.0,0.000000,-54.900000,0.000000 +-3.0,0.000000,-54.000000,0.000000 +-3.0,0.000000,-53.100000,0.000000 +-3.0,0.000000,-52.200000,0.000000 +-3.0,0.000000,-51.300000,0.000000 +-3.0,0.000000,-50.400000,0.000000 +-3.0,0.000000,-49.500000,0.000000 +-3.0,0.000000,-48.600000,0.000000 +-3.0,0.000000,-47.700000,0.000000 +-3.0,0.000000,-46.800000,0.000000 +-3.0,0.000000,-45.900000,0.000000 +-3.0,0.000000,-45.000000,0.000000 +-3.0,0.000000,-44.100000,0.000000 +-3.0,0.000000,-43.200000,0.000000 +-3.0,0.000000,-42.300000,0.000000 +-3.0,0.000000,-41.400000,0.000000 +-3.0,0.000000,-40.500000,0.000000 +-3.0,0.000000,-39.600000,0.000000 +-3.0,0.000000,-38.700000,0.000000 +-3.0,0.000000,-37.800000,0.000000 +-3.0,0.000000,-36.900000,0.000000 +-3.0,0.000000,-36.000000,0.000000 +-3.0,0.000000,-35.100000,0.000000 +-3.0,0.000000,-34.200000,0.000000 +-3.0,0.000000,-33.300000,0.000000 +-3.0,0.000000,-32.400000,0.000000 +-3.0,0.000000,-31.500000,0.000000 +-3.0,0.000000,-30.600000,0.000000 +-3.0,0.000000,-29.700000,0.000000 +-3.0,0.000000,-28.800000,0.000000 +-3.0,0.000000,-27.900000,0.000000 +-3.0,0.000000,-27.000000,0.000000 +-3.0,0.000000,-26.100000,0.000000 +-3.0,0.000000,-25.200000,0.000000 +-3.0,0.000000,-24.300000,0.000000 +-3.0,0.000000,-23.400000,0.000000 +-3.0,0.000000,-22.500000,0.000000 +-3.0,0.000000,-21.600000,0.000000 +-3.0,0.000000,-20.700000,0.000000 +-3.0,0.000000,-19.800000,0.000000 +-3.0,0.000000,-18.900000,0.000000 +-3.0,0.000000,-18.000000,0.000000 +-3.0,0.000000,-17.100000,0.000000 +-3.0,0.000000,-16.200000,0.000000 +-3.0,0.000000,-15.300000,0.000000 +-3.0,0.000000,-14.400000,0.000000 +-3.0,0.000000,-13.500000,0.000000 +-3.0,0.000000,-12.600000,0.000000 +-3.0,0.000000,-11.700000,0.000000 +-3.0,0.000000,-10.800000,0.000000 +-3.0,0.000000,-9.900000,0.000000 +-3.0,0.000000,-9.000000,0.000000 +-3.0,0.000000,-8.100000,0.000000 +-3.0,0.000000,-7.200000,0.000000 +-3.0,0.000000,-6.300000,0.000000 +-3.0,0.000000,-5.400000,0.000000 +-3.0,0.000000,-4.500000,0.000000 +-3.0,0.000000,-3.600000,0.000000 +-3.0,0.000000,-2.700000,0.000000 +-3.0,0.000000,-1.800000,0.000000 +-3.0,0.000000,-0.900000,0.000000 +-3.0,0.000000,0.000000,0.000000 +-3.0,0.000000,0.900000,0.000000 +-3.0,0.000000,1.800000,0.000000 +-3.0,0.000000,2.700000,0.000000 +-3.0,0.000000,3.600000,0.000000 +-3.0,0.000000,4.500000,0.000000 +-3.0,0.000000,5.400000,0.000000 +-3.0,0.000000,6.300000,0.000000 +-3.0,0.000000,7.200000,0.000000 +-3.0,0.000000,8.100000,0.000000 +-3.0,0.000000,9.000000,0.000000 +-3.0,0.000000,9.900000,0.000000 +-3.0,0.000000,10.800000,0.000000 +-3.0,0.000000,11.700000,0.000000 +-3.0,0.000000,12.600000,0.000000 +-3.0,0.000000,13.500000,0.000000 +-3.0,0.000000,14.400000,0.000000 +-3.0,0.000000,15.300000,0.000000 +-3.0,0.000000,16.200000,0.000000 +-3.0,0.000000,17.100000,0.000000 +-3.0,0.000000,18.000000,0.000000 +-3.0,0.000000,18.900000,0.000000 +-3.0,0.000000,19.800000,0.000000 +-3.0,0.000000,20.700000,0.000000 +-3.0,0.000000,21.600000,0.000000 +-3.0,0.000000,22.500000,0.000000 +-3.0,0.000000,23.400000,0.000000 +-3.0,0.000000,24.300000,0.000000 +-3.0,0.000000,25.200000,0.000000 +-3.0,0.000000,26.100000,0.000000 +-3.0,0.000000,27.000000,0.000000 +-3.0,0.000000,27.900000,0.000000 +-3.0,0.000000,28.800000,0.000000 +-3.0,0.000000,29.700000,0.000000 +-3.0,0.000000,30.600000,0.000000 +-3.0,0.000000,31.500000,0.000000 +-3.0,0.000000,32.400000,0.000000 +-3.0,0.000000,33.300000,0.000000 +-3.0,0.000000,34.200000,0.000000 +-3.0,0.000000,35.100000,0.000000 +-3.0,0.000000,36.000000,0.000000 +-3.0,0.000000,36.900000,0.000000 +-3.0,0.000000,37.800000,0.000000 +-3.0,0.000000,38.700000,0.000000 +-3.0,0.000000,39.600000,0.000000 +-3.0,0.000000,40.500000,0.000000 +-3.0,0.000000,41.400000,0.000000 +-3.0,0.000000,42.300000,0.000000 +-3.0,0.000000,43.200000,0.000000 +-3.0,0.000000,44.100000,0.000000 +-3.0,0.000000,45.000000,0.000000 +-3.0,0.000000,45.900000,0.000000 +-3.0,0.000000,46.800000,0.000000 +-3.0,0.000000,47.700000,0.000000 +-3.0,0.000000,48.600000,0.000000 +-3.0,0.000000,49.500000,0.000000 +-3.0,0.000000,50.400000,0.000000 +-3.0,0.000000,51.300000,0.000000 +-3.0,0.000000,52.200000,0.000000 +-3.0,0.000000,53.100000,0.000000 +-3.0,0.000000,54.000000,0.000000 +-3.0,0.000000,54.900000,0.000000 +-3.0,0.000000,55.800000,0.000000 +-3.0,0.000000,56.700000,0.000000 +-3.0,0.000000,57.600000,0.000000 +-3.0,0.000000,58.500000,0.000000 +-3.0,0.000000,59.400000,0.000000 +-3.0,0.000000,60.300000,0.000000 +-3.0,0.000000,61.200000,0.000000 +-3.0,0.000000,62.100000,0.000000 +-3.0,0.000000,63.000000,0.000000 +-3.0,0.000000,63.900000,0.000000 +-3.0,0.000000,64.800000,0.000000 +-3.0,0.000000,65.700000,0.000000 +-3.0,0.000000,66.600000,0.000000 +-3.0,0.000000,67.500000,0.000000 +-3.0,0.000000,68.400000,0.000000 +-3.0,0.000000,69.300000,0.000000 +-3.0,0.000000,70.200000,0.000000 +-3.0,0.000000,71.100000,0.000000 +-3.0,0.000000,72.000000,0.000000 +-3.0,0.000000,72.900000,0.000000 +-3.0,0.000000,73.800000,0.000000 +-3.0,0.000000,74.700000,0.000000 +-3.0,0.000000,75.600000,0.000000 +-3.0,0.000000,76.500000,0.000000 +-3.0,0.000000,77.400000,0.000000 +-3.0,0.000000,78.300000,0.000000 +-3.0,0.000000,79.200000,0.000000 +-3.0,0.000000,80.100000,0.000000 +-3.0,0.000000,81.000000,0.000000 +-3.0,0.000000,81.900000,0.000000 +-3.0,0.000000,82.800000,0.000000 +-3.0,0.000000,83.700000,0.000000 +-3.0,0.000000,84.600000,0.000000 +-3.0,0.000000,85.500000,0.000000 +-3.0,0.000000,86.400000,0.000000 +-3.0,0.000000,87.300000,0.000000 +-3.0,0.000000,88.200000,0.000000 +-3.0,0.000000,89.100000,0.000000 +-3.0,0.000000,90.000000,0.000000 +-3.0,0.000000,90.900000,0.000000 +-3.0,0.000000,91.800000,0.000000 +-3.0,0.000000,92.700000,0.000000 +-3.0,0.000000,93.600000,0.000000 +-3.0,0.000000,94.500000,0.000000 +-3.0,0.000000,95.400000,0.000000 +-3.0,0.000000,96.300000,0.000000 +-3.0,0.000000,97.200000,0.000000 +-3.0,0.000000,98.100000,0.000000 +-3.0,0.000000,99.000000,0.000000 +-3.0,0.000000,99.900000,0.000000 +-3.0,0.000000,100.800000,0.000000 +-3.0,0.000000,101.700000,0.000000 +-3.0,0.000000,102.600000,0.000000 +-3.0,0.000000,103.500000,0.000000 +-3.0,0.000000,104.400000,0.000000 +-3.0,0.000000,105.300000,0.000000 +-3.0,0.000000,106.200000,0.000000 +-3.0,0.000000,107.100000,0.000000 +-3.0,0.000000,108.000000,0.000000 +-3.0,0.000000,108.900000,0.000000 +-3.0,0.000000,109.800000,0.000000 +-3.0,0.000000,110.700000,0.000000 +-3.0,0.000000,111.600000,0.000000 +-3.0,0.000000,112.500000,0.000000 +-3.0,0.000000,113.400000,0.000000 +-3.0,0.000000,114.300000,0.000000 +-3.0,0.000000,115.200000,0.000000 +-3.0,0.000000,116.100000,0.000000 +-3.0,0.000000,117.000000,0.000000 +-3.0,0.000000,117.900000,0.000000 +-3.0,0.000000,118.800000,0.000000 +-3.0,0.000000,119.700000,0.000000 +-3.0,0.000000,120.600000,0.000000 +-3.0,0.000000,121.500000,0.000000 +-3.0,0.000000,122.400000,0.000000 +-3.0,0.000000,123.300000,0.000000 +-3.0,0.000000,124.200000,0.000000 +-3.0,0.000000,125.100000,0.000000 +-3.0,0.000000,126.000000,0.000000 +-3.0,0.000000,126.900000,0.000000 +-3.0,0.000000,127.800000,0.000000 +-3.0,0.000000,128.700000,0.000000 +-3.0,0.000000,129.600000,0.000000 +-3.0,0.000000,130.500000,0.000000 +-3.0,0.000000,131.400000,0.000000 +-3.0,0.000000,132.300000,0.000000 +-3.0,0.000000,133.200000,0.000000 +-3.0,0.000000,134.100000,0.000000 +-3.0,0.000000,135.000000,0.000000 +-3.0,0.000000,135.900000,0.000000 +-3.0,0.000000,136.800000,0.000000 +-3.0,0.000000,137.700000,0.000000 +-3.0,0.000000,138.600000,0.000000 +-3.0,0.000000,139.500000,0.000000 +-3.0,0.000000,140.400000,0.000000 +-3.0,0.000000,141.300000,0.000000 +-3.0,0.000000,142.200000,0.000000 +-3.0,0.000000,143.100000,0.000000 +-3.0,0.000000,144.000000,0.000000 +-3.0,0.000000,144.900000,0.000000 +-3.0,0.000000,145.800000,0.000000 +-3.0,0.000000,146.700000,0.000000 +-3.0,0.000000,147.600000,0.000000 +-3.0,0.000000,148.500000,0.000000 +-3.0,0.000000,149.400000,0.000000 +-3.0,0.000000,150.300000,0.000000 +-3.0,0.000000,151.200000,0.000000 +-3.0,0.000000,152.100000,0.000000 +-3.0,0.000000,153.000000,0.000000 +-3.0,0.000000,153.900000,0.000000 +-3.0,0.000000,154.800000,0.000000 +-3.0,0.000000,155.700000,0.000000 +-3.0,0.000000,156.600000,0.000000 +-3.0,0.000000,157.500000,0.000000 +-3.0,0.000000,158.400000,0.000000 +-3.0,0.000000,159.300000,0.000000 +-3.0,0.000000,160.200000,0.000000 +-3.0,0.000000,161.100000,0.000000 +-3.0,0.000000,162.000000,0.000000 +-3.0,0.000000,162.900000,0.000000 +-3.0,0.000000,163.800000,0.000000 +-3.0,0.000000,164.700000,0.000000 +-3.0,0.000000,165.600000,0.000000 +-3.0,0.000000,166.500000,0.000000 +-3.0,0.000000,167.400000,0.000000 +-3.0,0.000000,168.300000,0.000000 +-3.0,0.000000,169.200000,0.000000 +-3.0,0.000000,170.100000,0.000000 +-3.0,0.000000,171.000000,0.000000 +-3.0,0.000000,171.900000,0.000000 +-3.0,0.000000,172.800000,0.000000 +-3.0,0.000000,173.700000,0.000000 +-3.0,0.000000,174.600000,0.000000 +-3.0,0.000000,175.500000,0.000000 +-3.0,0.000000,176.400000,0.000000 +-3.0,0.000000,177.300000,0.000000 +-3.0,0.000000,178.200000,0.000000 +-3.0,0.000000,179.100000,0.000000 +-3.0,0.000000,180.000000,0.000000 +-3.0,0.000000,180.900000,0.000000 +-3.0,0.000000,181.800000,0.000000 +-3.0,0.000000,182.700000,0.000000 +-3.0,0.000000,183.600000,0.000000 +-3.0,0.000000,184.500000,0.000000 +-3.0,0.000000,185.400000,0.000000 +-3.0,0.000000,186.300000,0.000000 +-3.0,0.000000,187.200000,0.000000 +-3.0,0.000000,188.100000,0.000000 +-3.0,0.000000,189.000000,0.000000 +-3.0,0.000000,189.900000,0.000000 +-3.0,0.000000,190.800000,0.000000 +-3.0,0.000000,191.700000,0.000000 +-3.0,0.000000,192.600000,0.000000 +-3.0,0.000000,193.500000,0.000000 +-3.0,0.000000,194.400000,0.000000 +-3.0,0.000000,195.300000,0.000000 +-3.0,0.000000,196.200000,0.000000 +-3.0,0.000000,197.100000,0.000000 +-3.0,0.000000,198.000000,0.000000 +-3.0,0.000000,198.900000,0.000000 +-3.0,0.000000,199.800000,0.000000 +-3.0,0.000000,200.700000,0.000000 +-3.0,0.000000,201.600000,0.000000 +-3.0,0.000000,202.500000,0.000000 +-3.0,0.000000,203.400000,0.000000 +-3.0,0.000000,204.300000,0.000000 +-3.0,0.000000,205.200000,0.000000 +-3.0,0.000000,206.100000,0.000000 +-3.0,0.000000,207.000000,0.000000 +-3.0,0.000000,207.900000,0.000000 +-3.0,0.000000,208.800000,0.000000 +-3.0,0.000000,209.700000,0.000000 +-3.0,0.000000,210.600000,0.000000 +-3.0,0.000000,211.500000,0.000000 +-3.0,0.000000,212.400000,0.000000 +-3.0,0.000000,213.300000,0.000000 +-3.0,0.000000,214.200000,0.000000 +-3.0,0.000000,215.100000,0.000000 +-3.0,0.000000,216.000000,0.000000 +-3.0,0.000000,216.900000,0.000000 +-3.0,0.000000,217.800000,0.000000 +-3.0,0.000000,218.700000,0.000000 +-3.0,0.000000,219.600000,0.000000 +-3.0,0.000000,220.500000,0.000000 +-3.0,0.000000,221.400000,0.000000 +-3.0,0.000000,222.300000,0.000000 +-3.0,0.000000,223.200000,0.000000 +-3.0,0.000000,224.100000,0.000000 +-3.0,0.000000,225.000000,0.000000 +-3.0,0.000000,225.900000,0.000000 +-3.0,0.000000,226.800000,0.000000 +-3.0,0.000000,227.700000,0.000000 +-3.0,0.000000,228.600000,0.000000 +-3.0,0.000000,229.500000,0.000000 +-3.0,0.000000,230.400000,0.000000 +-3.0,0.000000,231.300000,0.000000 +-3.0,0.000000,232.200000,0.000000 +-3.0,0.000000,233.100000,0.000000 +-3.0,0.000000,234.000000,0.000000 +-3.0,0.000000,234.900000,0.000000 +-3.0,0.000000,235.800000,0.000000 +-3.0,0.000000,236.700000,0.000000 +-3.0,0.000000,237.600000,0.000000 +-3.0,0.000000,238.500000,0.000000 +-3.0,0.000000,239.400000,0.000000 +-3.0,0.000000,240.300000,0.000000 +-3.0,0.000000,241.200000,0.000000 +-3.0,0.000000,242.100000,0.000000 +-3.0,0.000000,243.000000,0.000000 +-3.0,0.000000,243.900000,0.000000 +-3.0,0.000000,244.800000,0.000000 +-3.0,0.000000,245.700000,0.000000 +-3.0,0.000000,246.600000,0.000000 +-3.0,0.000000,247.500000,0.000000 +-3.0,0.000000,248.400000,0.000000 +-3.0,0.000000,249.300000,0.000000 +-3.0,0.000000,250.200000,0.000000 +-3.0,0.000000,251.100000,0.000000 +-3.0,0.000000,252.000000,0.000000 +-3.0,0.000000,252.900000,0.000000 +-3.0,0.000000,253.800000,0.000000 +-3.0,0.000000,254.700000,0.000000 +-3.0,0.000000,255.600000,0.000000 +-3.0,0.000000,256.500000,0.000000 +-3.0,0.000000,257.400000,0.000000 +-3.0,0.000000,258.300000,0.000000 +-3.0,0.000000,259.200000,0.000000 +-3.0,0.000000,260.100000,0.000000 +-3.0,0.000000,261.000000,0.000000 +-3.0,0.000000,261.900000,0.000000 +-3.0,0.000000,262.800000,0.000000 +-3.0,0.000000,263.700000,0.000000 +-3.0,0.000000,264.600000,0.000000 +-3.0,0.000000,265.500000,0.000000 +-3.0,0.000000,266.400000,0.000000 +-3.0,0.000000,267.300000,0.000000 +-3.0,0.000000,268.200000,0.000000 +-3.0,0.000000,269.100000,0.000000 +-3.0,0.000000,270.000000,0.000000 +-3.0,0.000000,270.900000,0.000000 +-3.0,0.000000,271.800000,0.000000 +-3.0,0.000000,272.700000,0.000000 +-3.0,0.000000,273.600000,0.000000 +-3.0,0.000000,274.500000,0.000000 +-3.0,0.000000,275.400000,0.000000 +-3.0,0.000000,276.300000,0.000000 +-3.0,0.000000,277.200000,0.000000 +-3.0,0.000000,278.100000,0.000000 +-3.0,0.000000,279.000000,0.000000 +-3.0,0.000000,279.900000,0.000000 +-3.0,0.000000,280.800000,0.000000 +-3.0,0.000000,281.700000,0.000000 +-3.0,0.000000,282.600000,0.000000 +-3.0,0.000000,283.500000,0.000000 +-3.0,0.000000,284.400000,0.000000 +-3.0,0.000000,285.300000,0.000000 +-3.0,0.000000,286.200000,0.000000 +-3.0,0.000000,287.100000,0.000000 +-3.0,0.000000,288.000000,0.000000 +-3.0,0.000000,288.900000,0.000000 +-3.0,0.000000,289.800000,0.000000 +-3.0,0.000000,290.700000,0.000000 +-3.0,0.000000,291.600000,0.000000 +-3.0,0.000000,292.500000,0.000000 +-3.0,0.000000,293.400000,0.000000 +-3.0,0.000000,294.300000,0.000000 +-3.0,0.000000,295.200000,0.000000 +-3.0,0.000000,296.100000,0.000000 +-3.0,0.000000,297.000000,0.000000 +-3.0,0.000000,297.900000,0.000000 +-3.0,0.000000,298.800000,0.000000 +-3.0,0.000000,299.700000,0.000000 +-3.0,0.000000,300.600000,0.000000 +-3.0,0.000000,301.500000,0.000000 +-3.0,0.000000,302.400000,0.000000 +-3.0,0.000000,303.300000,0.000000 +-3.0,0.000000,304.200000,0.000000 +-3.0,0.000000,305.100000,0.000000 +-3.0,0.000000,306.000000,0.000000 +-3.0,0.000000,306.900000,0.000000 +-3.0,0.000000,307.800000,0.000000 +-3.0,0.000000,308.700000,0.000000 +-3.0,0.000000,309.600000,0.000000 +-3.0,0.000000,310.500000,0.000000 +-3.0,0.000000,311.400000,0.000000 +-3.0,0.000000,312.300000,0.000000 +-3.0,0.000000,313.200000,0.000000 +-3.0,0.000000,314.100000,0.000000 +-3.0,0.000000,315.000000,0.000000 +-3.0,0.000000,315.900000,0.000000 +-3.0,0.000000,316.800000,0.000000 +-3.0,0.000000,317.700000,0.000000 +-3.0,0.000000,318.600000,0.000000 +-3.0,0.000000,319.500000,0.000000 +-3.0,0.000000,320.400000,0.000000 +-3.0,0.000000,321.300000,0.000000 +-3.0,0.000000,322.200000,0.000000 +-3.0,0.000000,323.100000,0.000000 +-3.0,0.000000,324.000000,0.000000 +-3.0,0.000000,324.900000,0.000000 +-3.0,0.000000,325.800000,0.000000 +-3.0,0.000000,326.700000,0.000000 +-3.0,0.000000,327.600000,0.000000 +-3.0,0.000000,328.500000,0.000000 +-3.0,0.000000,329.400000,0.000000 +-3.0,0.000000,330.300000,0.000000 +-3.0,0.000000,331.200000,0.000000 +-3.0,0.000000,332.100000,0.000000 +-3.0,0.000000,333.000000,0.000000 +-3.0,0.000000,333.900000,0.000000 +-3.0,0.000000,334.800000,0.000000 +-3.0,0.000000,335.700000,0.000000 +-3.0,0.000000,336.600000,0.000000 +-3.0,0.000000,337.500000,0.000000 +-3.0,0.000000,338.400000,0.000000 +-3.0,0.000000,339.300000,0.000000 +-3.0,0.000000,340.200000,0.000000 +-3.0,0.000000,341.100000,0.000000 +-3.0,0.000000,342.000000,0.000000 +-3.0,0.000000,342.900000,0.000000 +-3.0,0.000000,343.800000,0.000000 +-3.0,0.000000,344.700000,0.000000 +-3.0,0.000000,345.600000,0.000000 +-3.0,0.000000,346.500000,0.000000 +-3.0,0.000000,347.400000,0.000000 +-3.0,0.000000,348.300000,0.000000 +-3.0,0.000000,349.200000,0.000000 +-3.0,0.000000,350.100000,0.000000 +-3.0,0.000000,351.000000,0.000000 +-3.0,0.000000,351.900000,0.000000 +-3.0,0.000000,352.800000,0.000000 +-3.0,0.000000,353.700000,0.000000 +-3.0,0.000000,354.600000,0.000000 +-3.0,0.000000,355.500000,0.000000 +-3.0,0.000000,356.400000,0.000000 +-3.0,0.000000,357.300000,0.000000 +-3.0,0.000000,358.200000,0.000000 +-3.0,0.000000,359.100000,0.000000 +-3.0,90.000000,0.000000,-360.000000 +-3.0,90.000000,0.000000,-359.100000 +-3.0,90.000000,0.000000,-358.200000 +-3.0,90.000000,0.000000,-357.300000 +-3.0,90.000000,0.000000,-356.400000 +-3.0,90.000000,0.000000,-355.500000 +-3.0,90.000000,0.000000,-354.600000 +-3.0,90.000000,0.000000,-353.700000 +-3.0,90.000000,0.000000,-352.800000 +-3.0,90.000000,0.000000,-351.900000 +-3.0,90.000000,0.000000,-351.000000 +-3.0,90.000000,0.000000,-350.100000 +-3.0,90.000000,0.000000,-349.200000 +-3.0,90.000000,0.000000,-348.300000 +-3.0,90.000000,0.000000,-347.400000 +-3.0,90.000000,0.000000,-346.500000 +-3.0,90.000000,0.000000,-345.600000 +-3.0,90.000000,0.000000,-344.700000 +-3.0,90.000000,0.000000,-343.800000 +-3.0,90.000000,0.000000,-342.900000 +-3.0,90.000000,0.000000,-342.000000 +-3.0,90.000000,0.000000,-341.100000 +-3.0,90.000000,0.000000,-340.200000 +-3.0,90.000000,0.000000,-339.300000 +-3.0,90.000000,0.000000,-338.400000 +-3.0,90.000000,0.000000,-337.500000 +-3.0,90.000000,0.000000,-336.600000 +-3.0,90.000000,0.000000,-335.700000 +-3.0,90.000000,0.000000,-334.800000 +-3.0,90.000000,0.000000,-333.900000 +-3.0,90.000000,0.000000,-333.000000 +-3.0,90.000000,0.000000,-332.100000 +-3.0,90.000000,0.000000,-331.200000 +-3.0,90.000000,0.000000,-330.300000 +-3.0,90.000000,0.000000,-329.400000 +-3.0,90.000000,0.000000,-328.500000 +-3.0,90.000000,0.000000,-327.600000 +-3.0,90.000000,0.000000,-326.700000 +-3.0,90.000000,0.000000,-325.800000 +-3.0,90.000000,0.000000,-324.900000 +-3.0,90.000000,0.000000,-324.000000 +-3.0,90.000000,0.000000,-323.100000 +-3.0,90.000000,0.000000,-322.200000 +-3.0,90.000000,0.000000,-321.300000 +-3.0,90.000000,0.000000,-320.400000 +-3.0,90.000000,0.000000,-319.500000 +-3.0,90.000000,0.000000,-318.600000 +-3.0,90.000000,0.000000,-317.700000 +-3.0,90.000000,0.000000,-316.800000 +-3.0,90.000000,0.000000,-315.900000 +-3.0,90.000000,0.000000,-315.000000 +-3.0,90.000000,0.000000,-314.100000 +-3.0,90.000000,0.000000,-313.200000 +-3.0,90.000000,0.000000,-312.300000 +-3.0,90.000000,0.000000,-311.400000 +-3.0,90.000000,0.000000,-310.500000 +-3.0,90.000000,0.000000,-309.600000 +-3.0,90.000000,0.000000,-308.700000 +-3.0,90.000000,0.000000,-307.800000 +-3.0,90.000000,0.000000,-306.900000 +-3.0,90.000000,0.000000,-306.000000 +-3.0,90.000000,0.000000,-305.100000 +-3.0,90.000000,0.000000,-304.200000 +-3.0,90.000000,0.000000,-303.300000 +-3.0,90.000000,0.000000,-302.400000 +-3.0,90.000000,0.000000,-301.500000 +-3.0,90.000000,0.000000,-300.600000 +-3.0,90.000000,0.000000,-299.700000 +-3.0,90.000000,0.000000,-298.800000 +-3.0,90.000000,0.000000,-297.900000 +-3.0,90.000000,0.000000,-297.000000 +-3.0,90.000000,0.000000,-296.100000 +-3.0,90.000000,0.000000,-295.200000 +-3.0,90.000000,0.000000,-294.300000 +-3.0,90.000000,0.000000,-293.400000 +-3.0,90.000000,0.000000,-292.500000 +-3.0,90.000000,0.000000,-291.600000 +-3.0,90.000000,0.000000,-290.700000 +-3.0,90.000000,0.000000,-289.800000 +-3.0,90.000000,0.000000,-288.900000 +-3.0,90.000000,0.000000,-288.000000 +-3.0,90.000000,0.000000,-287.100000 +-3.0,90.000000,0.000000,-286.200000 +-3.0,90.000000,0.000000,-285.300000 +-3.0,90.000000,0.000000,-284.400000 +-3.0,90.000000,0.000000,-283.500000 +-3.0,90.000000,0.000000,-282.600000 +-3.0,90.000000,0.000000,-281.700000 +-3.0,90.000000,0.000000,-280.800000 +-3.0,90.000000,0.000000,-279.900000 +-3.0,90.000000,0.000000,-279.000000 +-3.0,90.000000,0.000000,-278.100000 +-3.0,90.000000,0.000000,-277.200000 +-3.0,90.000000,0.000000,-276.300000 +-3.0,90.000000,0.000000,-275.400000 +-3.0,90.000000,0.000000,-274.500000 +-3.0,90.000000,0.000000,-273.600000 +-3.0,90.000000,0.000000,-272.700000 +-3.0,90.000000,0.000000,-271.800000 +-3.0,90.000000,0.000000,-270.900000 +-3.0,90.000000,0.000000,-270.000000 +-3.0,90.000000,0.000000,-269.100000 +-3.0,90.000000,0.000000,-268.200000 +-3.0,90.000000,0.000000,-267.300000 +-3.0,90.000000,0.000000,-266.400000 +-3.0,90.000000,0.000000,-265.500000 +-3.0,90.000000,0.000000,-264.600000 +-3.0,90.000000,0.000000,-263.700000 +-3.0,90.000000,0.000000,-262.800000 +-3.0,90.000000,0.000000,-261.900000 +-3.0,90.000000,0.000000,-261.000000 +-3.0,90.000000,0.000000,-260.100000 +-3.0,90.000000,0.000000,-259.200000 +-3.0,90.000000,0.000000,-258.300000 +-3.0,90.000000,0.000000,-257.400000 +-3.0,90.000000,0.000000,-256.500000 +-3.0,90.000000,0.000000,-255.600000 +-3.0,90.000000,0.000000,-254.700000 +-3.0,90.000000,0.000000,-253.800000 +-3.0,90.000000,0.000000,-252.900000 +-3.0,90.000000,0.000000,-252.000000 +-3.0,90.000000,0.000000,-251.100000 +-3.0,90.000000,0.000000,-250.200000 +-3.0,90.000000,0.000000,-249.300000 +-3.0,90.000000,0.000000,-248.400000 +-3.0,90.000000,0.000000,-247.500000 +-3.0,90.000000,0.000000,-246.600000 +-3.0,90.000000,0.000000,-245.700000 +-3.0,90.000000,0.000000,-244.800000 +-3.0,90.000000,0.000000,-243.900000 +-3.0,90.000000,0.000000,-243.000000 +-3.0,90.000000,0.000000,-242.100000 +-3.0,90.000000,0.000000,-241.200000 +-3.0,90.000000,0.000000,-240.300000 +-3.0,90.000000,0.000000,-239.400000 +-3.0,90.000000,0.000000,-238.500000 +-3.0,90.000000,0.000000,-237.600000 +-3.0,90.000000,0.000000,-236.700000 +-3.0,90.000000,0.000000,-235.800000 +-3.0,90.000000,0.000000,-234.900000 +-3.0,90.000000,0.000000,-234.000000 +-3.0,90.000000,0.000000,-233.100000 +-3.0,90.000000,0.000000,-232.200000 +-3.0,90.000000,0.000000,-231.300000 +-3.0,90.000000,0.000000,-230.400000 +-3.0,90.000000,0.000000,-229.500000 +-3.0,90.000000,0.000000,-228.600000 +-3.0,90.000000,0.000000,-227.700000 +-3.0,90.000000,0.000000,-226.800000 +-3.0,90.000000,0.000000,-225.900000 +-3.0,90.000000,0.000000,-225.000000 +-3.0,90.000000,0.000000,-224.100000 +-3.0,90.000000,0.000000,-223.200000 +-3.0,90.000000,0.000000,-222.300000 +-3.0,90.000000,0.000000,-221.400000 +-3.0,90.000000,0.000000,-220.500000 +-3.0,90.000000,0.000000,-219.600000 +-3.0,90.000000,0.000000,-218.700000 +-3.0,90.000000,0.000000,-217.800000 +-3.0,90.000000,0.000000,-216.900000 +-3.0,90.000000,0.000000,-216.000000 +-3.0,90.000000,0.000000,-215.100000 +-3.0,90.000000,0.000000,-214.200000 +-3.0,90.000000,0.000000,-213.300000 +-3.0,90.000000,0.000000,-212.400000 +-3.0,90.000000,0.000000,-211.500000 +-3.0,90.000000,0.000000,-210.600000 +-3.0,90.000000,0.000000,-209.700000 +-3.0,90.000000,0.000000,-208.800000 +-3.0,90.000000,0.000000,-207.900000 +-3.0,90.000000,0.000000,-207.000000 +-3.0,90.000000,0.000000,-206.100000 +-3.0,90.000000,0.000000,-205.200000 +-3.0,90.000000,0.000000,-204.300000 +-3.0,90.000000,0.000000,-203.400000 +-3.0,90.000000,0.000000,-202.500000 +-3.0,90.000000,0.000000,-201.600000 +-3.0,90.000000,0.000000,-200.700000 +-3.0,90.000000,0.000000,-199.800000 +-3.0,90.000000,0.000000,-198.900000 +-3.0,90.000000,0.000000,-198.000000 +-3.0,90.000000,0.000000,-197.100000 +-3.0,90.000000,0.000000,-196.200000 +-3.0,90.000000,0.000000,-195.300000 +-3.0,90.000000,0.000000,-194.400000 +-3.0,90.000000,0.000000,-193.500000 +-3.0,90.000000,0.000000,-192.600000 +-3.0,90.000000,0.000000,-191.700000 +-3.0,90.000000,0.000000,-190.800000 +-3.0,90.000000,0.000000,-189.900000 +-3.0,90.000000,0.000000,-189.000000 +-3.0,90.000000,0.000000,-188.100000 +-3.0,90.000000,0.000000,-187.200000 +-3.0,90.000000,0.000000,-186.300000 +-3.0,90.000000,0.000000,-185.400000 +-3.0,90.000000,0.000000,-184.500000 +-3.0,90.000000,0.000000,-183.600000 +-3.0,90.000000,0.000000,-182.700000 +-3.0,90.000000,0.000000,-181.800000 +-3.0,90.000000,0.000000,-180.900000 +-3.0,90.000000,0.000000,-180.000000 +-3.0,90.000000,0.000000,-179.100000 +-3.0,90.000000,0.000000,-178.200000 +-3.0,90.000000,0.000000,-177.300000 +-3.0,90.000000,0.000000,-176.400000 +-3.0,90.000000,0.000000,-175.500000 +-3.0,90.000000,0.000000,-174.600000 +-3.0,90.000000,0.000000,-173.700000 +-3.0,90.000000,0.000000,-172.800000 +-3.0,90.000000,0.000000,-171.900000 +-3.0,90.000000,0.000000,-171.000000 +-3.0,90.000000,0.000000,-170.100000 +-3.0,90.000000,0.000000,-169.200000 +-3.0,90.000000,0.000000,-168.300000 +-3.0,90.000000,0.000000,-167.400000 +-3.0,90.000000,0.000000,-166.500000 +-3.0,90.000000,0.000000,-165.600000 +-3.0,90.000000,0.000000,-164.700000 +-3.0,90.000000,0.000000,-163.800000 +-3.0,90.000000,0.000000,-162.900000 +-3.0,90.000000,0.000000,-162.000000 +-3.0,90.000000,0.000000,-161.100000 +-3.0,90.000000,0.000000,-160.200000 +-3.0,90.000000,0.000000,-159.300000 +-3.0,90.000000,0.000000,-158.400000 +-3.0,90.000000,0.000000,-157.500000 +-3.0,90.000000,0.000000,-156.600000 +-3.0,90.000000,0.000000,-155.700000 +-3.0,90.000000,0.000000,-154.800000 +-3.0,90.000000,0.000000,-153.900000 +-3.0,90.000000,0.000000,-153.000000 +-3.0,90.000000,0.000000,-152.100000 +-3.0,90.000000,0.000000,-151.200000 +-3.0,90.000000,0.000000,-150.300000 +-3.0,90.000000,0.000000,-149.400000 +-3.0,90.000000,0.000000,-148.500000 +-3.0,90.000000,0.000000,-147.600000 +-3.0,90.000000,0.000000,-146.700000 +-3.0,90.000000,0.000000,-145.800000 +-3.0,90.000000,0.000000,-144.900000 +-3.0,90.000000,0.000000,-144.000000 +-3.0,90.000000,0.000000,-143.100000 +-3.0,90.000000,0.000000,-142.200000 +-3.0,90.000000,0.000000,-141.300000 +-3.0,90.000000,0.000000,-140.400000 +-3.0,90.000000,0.000000,-139.500000 +-3.0,90.000000,0.000000,-138.600000 +-3.0,90.000000,0.000000,-137.700000 +-3.0,90.000000,0.000000,-136.800000 +-3.0,90.000000,0.000000,-135.900000 +-3.0,90.000000,0.000000,-135.000000 +-3.0,90.000000,0.000000,-134.100000 +-3.0,90.000000,0.000000,-133.200000 +-3.0,90.000000,0.000000,-132.300000 +-3.0,90.000000,0.000000,-131.400000 +-3.0,90.000000,0.000000,-130.500000 +-3.0,90.000000,0.000000,-129.600000 +-3.0,90.000000,0.000000,-128.700000 +-3.0,90.000000,0.000000,-127.800000 +-3.0,90.000000,0.000000,-126.900000 +-3.0,90.000000,0.000000,-126.000000 +-3.0,90.000000,0.000000,-125.100000 +-3.0,90.000000,0.000000,-124.200000 +-3.0,90.000000,0.000000,-123.300000 +-3.0,90.000000,0.000000,-122.400000 +-3.0,90.000000,0.000000,-121.500000 +-3.0,90.000000,0.000000,-120.600000 +-3.0,90.000000,0.000000,-119.700000 +-3.0,90.000000,0.000000,-118.800000 +-3.0,90.000000,0.000000,-117.900000 +-3.0,90.000000,0.000000,-117.000000 +-3.0,90.000000,0.000000,-116.100000 +-3.0,90.000000,0.000000,-115.200000 +-3.0,90.000000,0.000000,-114.300000 +-3.0,90.000000,0.000000,-113.400000 +-3.0,90.000000,0.000000,-112.500000 +-3.0,90.000000,0.000000,-111.600000 +-3.0,90.000000,0.000000,-110.700000 +-3.0,90.000000,0.000000,-109.800000 +-3.0,90.000000,0.000000,-108.900000 +-3.0,90.000000,0.000000,-108.000000 +-3.0,90.000000,0.000000,-107.100000 +-3.0,90.000000,0.000000,-106.200000 +-3.0,90.000000,0.000000,-105.300000 +-3.0,90.000000,0.000000,-104.400000 +-3.0,90.000000,0.000000,-103.500000 +-3.0,90.000000,0.000000,-102.600000 +-3.0,90.000000,0.000000,-101.700000 +-3.0,90.000000,0.000000,-100.800000 +-3.0,90.000000,0.000000,-99.900000 +-3.0,90.000000,0.000000,-99.000000 +-3.0,90.000000,0.000000,-98.100000 +-3.0,90.000000,0.000000,-97.200000 +-3.0,90.000000,0.000000,-96.300000 +-3.0,90.000000,0.000000,-95.400000 +-3.0,90.000000,0.000000,-94.500000 +-3.0,90.000000,0.000000,-93.600000 +-3.0,90.000000,0.000000,-92.700000 +-3.0,90.000000,0.000000,-91.800000 +-3.0,90.000000,0.000000,-90.900000 +-3.0,90.000000,0.000000,-90.000000 +-3.0,90.000000,0.000000,-89.100000 +-3.0,90.000000,0.000000,-88.200000 +-3.0,90.000000,0.000000,-87.300000 +-3.0,90.000000,0.000000,-86.400000 +-3.0,90.000000,0.000000,-85.500000 +-3.0,90.000000,0.000000,-84.600000 +-3.0,90.000000,0.000000,-83.700000 +-3.0,90.000000,0.000000,-82.800000 +-3.0,90.000000,0.000000,-81.900000 +-3.0,90.000000,0.000000,-81.000000 +-3.0,90.000000,0.000000,-80.100000 +-3.0,90.000000,0.000000,-79.200000 +-3.0,90.000000,0.000000,-78.300000 +-3.0,90.000000,0.000000,-77.400000 +-3.0,90.000000,0.000000,-76.500000 +-3.0,90.000000,0.000000,-75.600000 +-3.0,90.000000,0.000000,-74.700000 +-3.0,90.000000,0.000000,-73.800000 +-3.0,90.000000,0.000000,-72.900000 +-3.0,90.000000,0.000000,-72.000000 +-3.0,90.000000,0.000000,-71.100000 +-3.0,90.000000,0.000000,-70.200000 +-3.0,90.000000,0.000000,-69.300000 +-3.0,90.000000,0.000000,-68.400000 +-3.0,90.000000,0.000000,-67.500000 +-3.0,90.000000,0.000000,-66.600000 +-3.0,90.000000,0.000000,-65.700000 +-3.0,90.000000,0.000000,-64.800000 +-3.0,90.000000,0.000000,-63.900000 +-3.0,90.000000,0.000000,-63.000000 +-3.0,90.000000,0.000000,-62.100000 +-3.0,90.000000,0.000000,-61.200000 +-3.0,90.000000,0.000000,-60.300000 +-3.0,90.000000,0.000000,-59.400000 +-3.0,90.000000,0.000000,-58.500000 +-3.0,90.000000,0.000000,-57.600000 +-3.0,90.000000,0.000000,-56.700000 +-3.0,90.000000,0.000000,-55.800000 +-3.0,90.000000,0.000000,-54.900000 +-3.0,90.000000,0.000000,-54.000000 +-3.0,90.000000,0.000000,-53.100000 +-3.0,90.000000,0.000000,-52.200000 +-3.0,90.000000,0.000000,-51.300000 +-3.0,90.000000,0.000000,-50.400000 +-3.0,90.000000,0.000000,-49.500000 +-3.0,90.000000,0.000000,-48.600000 +-3.0,90.000000,0.000000,-47.700000 +-3.0,90.000000,0.000000,-46.800000 +-3.0,90.000000,0.000000,-45.900000 +-3.0,90.000000,0.000000,-45.000000 +-3.0,90.000000,0.000000,-44.100000 +-3.0,90.000000,0.000000,-43.200000 +-3.0,90.000000,0.000000,-42.300000 +-3.0,90.000000,0.000000,-41.400000 +-3.0,90.000000,0.000000,-40.500000 +-3.0,90.000000,0.000000,-39.600000 +-3.0,90.000000,0.000000,-38.700000 +-3.0,90.000000,0.000000,-37.800000 +-3.0,90.000000,0.000000,-36.900000 +-3.0,90.000000,0.000000,-36.000000 +-3.0,90.000000,0.000000,-35.100000 +-3.0,90.000000,0.000000,-34.200000 +-3.0,90.000000,0.000000,-33.300000 +-3.0,90.000000,0.000000,-32.400000 +-3.0,90.000000,0.000000,-31.500000 +-3.0,90.000000,0.000000,-30.600000 +-3.0,90.000000,0.000000,-29.700000 +-3.0,90.000000,0.000000,-28.800000 +-3.0,90.000000,0.000000,-27.900000 +-3.0,90.000000,0.000000,-27.000000 +-3.0,90.000000,0.000000,-26.100000 +-3.0,90.000000,0.000000,-25.200000 +-3.0,90.000000,0.000000,-24.300000 +-3.0,90.000000,0.000000,-23.400000 +-3.0,90.000000,0.000000,-22.500000 +-3.0,90.000000,0.000000,-21.600000 +-3.0,90.000000,0.000000,-20.700000 +-3.0,90.000000,0.000000,-19.800000 +-3.0,90.000000,0.000000,-18.900000 +-3.0,90.000000,0.000000,-18.000000 +-3.0,90.000000,0.000000,-17.100000 +-3.0,90.000000,0.000000,-16.200000 +-3.0,90.000000,0.000000,-15.300000 +-3.0,90.000000,0.000000,-14.400000 +-3.0,90.000000,0.000000,-13.500000 +-3.0,90.000000,0.000000,-12.600000 +-3.0,90.000000,0.000000,-11.700000 +-3.0,90.000000,0.000000,-10.800000 +-3.0,90.000000,0.000000,-9.900000 +-3.0,90.000000,0.000000,-9.000000 +-3.0,90.000000,0.000000,-8.100000 +-3.0,90.000000,0.000000,-7.200000 +-3.0,90.000000,0.000000,-6.300000 +-3.0,90.000000,0.000000,-5.400000 +-3.0,90.000000,0.000000,-4.500000 +-3.0,90.000000,0.000000,-3.600000 +-3.0,90.000000,0.000000,-2.700000 +-3.0,90.000000,0.000000,-1.800000 +-3.0,90.000000,0.000000,-0.900000 +-3.0,90.000000,0.000000,0.000000 +-3.0,90.000000,0.000000,0.900000 +-3.0,90.000000,0.000000,1.800000 +-3.0,90.000000,0.000000,2.700000 +-3.0,90.000000,0.000000,3.600000 +-3.0,90.000000,0.000000,4.500000 +-3.0,90.000000,0.000000,5.400000 +-3.0,90.000000,0.000000,6.300000 +-3.0,90.000000,0.000000,7.200000 +-3.0,90.000000,0.000000,8.100000 +-3.0,90.000000,0.000000,9.000000 +-3.0,90.000000,0.000000,9.900000 +-3.0,90.000000,0.000000,10.800000 +-3.0,90.000000,0.000000,11.700000 +-3.0,90.000000,0.000000,12.600000 +-3.0,90.000000,0.000000,13.500000 +-3.0,90.000000,0.000000,14.400000 +-3.0,90.000000,0.000000,15.300000 +-3.0,90.000000,0.000000,16.200000 +-3.0,90.000000,0.000000,17.100000 +-3.0,90.000000,0.000000,18.000000 +-3.0,90.000000,0.000000,18.900000 +-3.0,90.000000,0.000000,19.800000 +-3.0,90.000000,0.000000,20.700000 +-3.0,90.000000,0.000000,21.600000 +-3.0,90.000000,0.000000,22.500000 +-3.0,90.000000,0.000000,23.400000 +-3.0,90.000000,0.000000,24.300000 +-3.0,90.000000,0.000000,25.200000 +-3.0,90.000000,0.000000,26.100000 +-3.0,90.000000,0.000000,27.000000 +-3.0,90.000000,0.000000,27.900000 +-3.0,90.000000,0.000000,28.800000 +-3.0,90.000000,0.000000,29.700000 +-3.0,90.000000,0.000000,30.600000 +-3.0,90.000000,0.000000,31.500000 +-3.0,90.000000,0.000000,32.400000 +-3.0,90.000000,0.000000,33.300000 +-3.0,90.000000,0.000000,34.200000 +-3.0,90.000000,0.000000,35.100000 +-3.0,90.000000,0.000000,36.000000 +-3.0,90.000000,0.000000,36.900000 +-3.0,90.000000,0.000000,37.800000 +-3.0,90.000000,0.000000,38.700000 +-3.0,90.000000,0.000000,39.600000 +-3.0,90.000000,0.000000,40.500000 +-3.0,90.000000,0.000000,41.400000 +-3.0,90.000000,0.000000,42.300000 +-3.0,90.000000,0.000000,43.200000 +-3.0,90.000000,0.000000,44.100000 +-3.0,90.000000,0.000000,45.000000 +-3.0,90.000000,0.000000,45.900000 +-3.0,90.000000,0.000000,46.800000 +-3.0,90.000000,0.000000,47.700000 +-3.0,90.000000,0.000000,48.600000 +-3.0,90.000000,0.000000,49.500000 +-3.0,90.000000,0.000000,50.400000 +-3.0,90.000000,0.000000,51.300000 +-3.0,90.000000,0.000000,52.200000 +-3.0,90.000000,0.000000,53.100000 +-3.0,90.000000,0.000000,54.000000 +-3.0,90.000000,0.000000,54.900000 +-3.0,90.000000,0.000000,55.800000 +-3.0,90.000000,0.000000,56.700000 +-3.0,90.000000,0.000000,57.600000 +-3.0,90.000000,0.000000,58.500000 +-3.0,90.000000,0.000000,59.400000 +-3.0,90.000000,0.000000,60.300000 +-3.0,90.000000,0.000000,61.200000 +-3.0,90.000000,0.000000,62.100000 +-3.0,90.000000,0.000000,63.000000 +-3.0,90.000000,0.000000,63.900000 +-3.0,90.000000,0.000000,64.800000 +-3.0,90.000000,0.000000,65.700000 +-3.0,90.000000,0.000000,66.600000 +-3.0,90.000000,0.000000,67.500000 +-3.0,90.000000,0.000000,68.400000 +-3.0,90.000000,0.000000,69.300000 +-3.0,90.000000,0.000000,70.200000 +-3.0,90.000000,0.000000,71.100000 +-3.0,90.000000,0.000000,72.000000 +-3.0,90.000000,0.000000,72.900000 +-3.0,90.000000,0.000000,73.800000 +-3.0,90.000000,0.000000,74.700000 +-3.0,90.000000,0.000000,75.600000 +-3.0,90.000000,0.000000,76.500000 +-3.0,90.000000,0.000000,77.400000 +-3.0,90.000000,0.000000,78.300000 +-3.0,90.000000,0.000000,79.200000 +-3.0,90.000000,0.000000,80.100000 +-3.0,90.000000,0.000000,81.000000 +-3.0,90.000000,0.000000,81.900000 +-3.0,90.000000,0.000000,82.800000 +-3.0,90.000000,0.000000,83.700000 +-3.0,90.000000,0.000000,84.600000 +-3.0,90.000000,0.000000,85.500000 +-3.0,90.000000,0.000000,86.400000 +-3.0,90.000000,0.000000,87.300000 +-3.0,90.000000,0.000000,88.200000 +-3.0,90.000000,0.000000,89.100000 +-3.0,90.000000,0.000000,90.000000 +-3.0,90.000000,0.000000,90.900000 +-3.0,90.000000,0.000000,91.800000 +-3.0,90.000000,0.000000,92.700000 +-3.0,90.000000,0.000000,93.600000 +-3.0,90.000000,0.000000,94.500000 +-3.0,90.000000,0.000000,95.400000 +-3.0,90.000000,0.000000,96.300000 +-3.0,90.000000,0.000000,97.200000 +-3.0,90.000000,0.000000,98.100000 +-3.0,90.000000,0.000000,99.000000 +-3.0,90.000000,0.000000,99.900000 +-3.0,90.000000,0.000000,100.800000 +-3.0,90.000000,0.000000,101.700000 +-3.0,90.000000,0.000000,102.600000 +-3.0,90.000000,0.000000,103.500000 +-3.0,90.000000,0.000000,104.400000 +-3.0,90.000000,0.000000,105.300000 +-3.0,90.000000,0.000000,106.200000 +-3.0,90.000000,0.000000,107.100000 +-3.0,90.000000,0.000000,108.000000 +-3.0,90.000000,0.000000,108.900000 +-3.0,90.000000,0.000000,109.800000 +-3.0,90.000000,0.000000,110.700000 +-3.0,90.000000,0.000000,111.600000 +-3.0,90.000000,0.000000,112.500000 +-3.0,90.000000,0.000000,113.400000 +-3.0,90.000000,0.000000,114.300000 +-3.0,90.000000,0.000000,115.200000 +-3.0,90.000000,0.000000,116.100000 +-3.0,90.000000,0.000000,117.000000 +-3.0,90.000000,0.000000,117.900000 +-3.0,90.000000,0.000000,118.800000 +-3.0,90.000000,0.000000,119.700000 +-3.0,90.000000,0.000000,120.600000 +-3.0,90.000000,0.000000,121.500000 +-3.0,90.000000,0.000000,122.400000 +-3.0,90.000000,0.000000,123.300000 +-3.0,90.000000,0.000000,124.200000 +-3.0,90.000000,0.000000,125.100000 +-3.0,90.000000,0.000000,126.000000 +-3.0,90.000000,0.000000,126.900000 +-3.0,90.000000,0.000000,127.800000 +-3.0,90.000000,0.000000,128.700000 +-3.0,90.000000,0.000000,129.600000 +-3.0,90.000000,0.000000,130.500000 +-3.0,90.000000,0.000000,131.400000 +-3.0,90.000000,0.000000,132.300000 +-3.0,90.000000,0.000000,133.200000 +-3.0,90.000000,0.000000,134.100000 +-3.0,90.000000,0.000000,135.000000 +-3.0,90.000000,0.000000,135.900000 +-3.0,90.000000,0.000000,136.800000 +-3.0,90.000000,0.000000,137.700000 +-3.0,90.000000,0.000000,138.600000 +-3.0,90.000000,0.000000,139.500000 +-3.0,90.000000,0.000000,140.400000 +-3.0,90.000000,0.000000,141.300000 +-3.0,90.000000,0.000000,142.200000 +-3.0,90.000000,0.000000,143.100000 +-3.0,90.000000,0.000000,144.000000 +-3.0,90.000000,0.000000,144.900000 +-3.0,90.000000,0.000000,145.800000 +-3.0,90.000000,0.000000,146.700000 +-3.0,90.000000,0.000000,147.600000 +-3.0,90.000000,0.000000,148.500000 +-3.0,90.000000,0.000000,149.400000 +-3.0,90.000000,0.000000,150.300000 +-3.0,90.000000,0.000000,151.200000 +-3.0,90.000000,0.000000,152.100000 +-3.0,90.000000,0.000000,153.000000 +-3.0,90.000000,0.000000,153.900000 +-3.0,90.000000,0.000000,154.800000 +-3.0,90.000000,0.000000,155.700000 +-3.0,90.000000,0.000000,156.600000 +-3.0,90.000000,0.000000,157.500000 +-3.0,90.000000,0.000000,158.400000 +-3.0,90.000000,0.000000,159.300000 +-3.0,90.000000,0.000000,160.200000 +-3.0,90.000000,0.000000,161.100000 +-3.0,90.000000,0.000000,162.000000 +-3.0,90.000000,0.000000,162.900000 +-3.0,90.000000,0.000000,163.800000 +-3.0,90.000000,0.000000,164.700000 +-3.0,90.000000,0.000000,165.600000 +-3.0,90.000000,0.000000,166.500000 +-3.0,90.000000,0.000000,167.400000 +-3.0,90.000000,0.000000,168.300000 +-3.0,90.000000,0.000000,169.200000 +-3.0,90.000000,0.000000,170.100000 +-3.0,90.000000,0.000000,171.000000 +-3.0,90.000000,0.000000,171.900000 +-3.0,90.000000,0.000000,172.800000 +-3.0,90.000000,0.000000,173.700000 +-3.0,90.000000,0.000000,174.600000 +-3.0,90.000000,0.000000,175.500000 +-3.0,90.000000,0.000000,176.400000 +-3.0,90.000000,0.000000,177.300000 +-3.0,90.000000,0.000000,178.200000 +-3.0,90.000000,0.000000,179.100000 +-3.0,90.000000,0.000000,180.000000 +-3.0,90.000000,0.000000,180.900000 +-3.0,90.000000,0.000000,181.800000 +-3.0,90.000000,0.000000,182.700000 +-3.0,90.000000,0.000000,183.600000 +-3.0,90.000000,0.000000,184.500000 +-3.0,90.000000,0.000000,185.400000 +-3.0,90.000000,0.000000,186.300000 +-3.0,90.000000,0.000000,187.200000 +-3.0,90.000000,0.000000,188.100000 +-3.0,90.000000,0.000000,189.000000 +-3.0,90.000000,0.000000,189.900000 +-3.0,90.000000,0.000000,190.800000 +-3.0,90.000000,0.000000,191.700000 +-3.0,90.000000,0.000000,192.600000 +-3.0,90.000000,0.000000,193.500000 +-3.0,90.000000,0.000000,194.400000 +-3.0,90.000000,0.000000,195.300000 +-3.0,90.000000,0.000000,196.200000 +-3.0,90.000000,0.000000,197.100000 +-3.0,90.000000,0.000000,198.000000 +-3.0,90.000000,0.000000,198.900000 +-3.0,90.000000,0.000000,199.800000 +-3.0,90.000000,0.000000,200.700000 +-3.0,90.000000,0.000000,201.600000 +-3.0,90.000000,0.000000,202.500000 +-3.0,90.000000,0.000000,203.400000 +-3.0,90.000000,0.000000,204.300000 +-3.0,90.000000,0.000000,205.200000 +-3.0,90.000000,0.000000,206.100000 +-3.0,90.000000,0.000000,207.000000 +-3.0,90.000000,0.000000,207.900000 +-3.0,90.000000,0.000000,208.800000 +-3.0,90.000000,0.000000,209.700000 +-3.0,90.000000,0.000000,210.600000 +-3.0,90.000000,0.000000,211.500000 +-3.0,90.000000,0.000000,212.400000 +-3.0,90.000000,0.000000,213.300000 +-3.0,90.000000,0.000000,214.200000 +-3.0,90.000000,0.000000,215.100000 +-3.0,90.000000,0.000000,216.000000 +-3.0,90.000000,0.000000,216.900000 +-3.0,90.000000,0.000000,217.800000 +-3.0,90.000000,0.000000,218.700000 +-3.0,90.000000,0.000000,219.600000 +-3.0,90.000000,0.000000,220.500000 +-3.0,90.000000,0.000000,221.400000 +-3.0,90.000000,0.000000,222.300000 +-3.0,90.000000,0.000000,223.200000 +-3.0,90.000000,0.000000,224.100000 +-3.0,90.000000,0.000000,225.000000 +-3.0,90.000000,0.000000,225.900000 +-3.0,90.000000,0.000000,226.800000 +-3.0,90.000000,0.000000,227.700000 +-3.0,90.000000,0.000000,228.600000 +-3.0,90.000000,0.000000,229.500000 +-3.0,90.000000,0.000000,230.400000 +-3.0,90.000000,0.000000,231.300000 +-3.0,90.000000,0.000000,232.200000 +-3.0,90.000000,0.000000,233.100000 +-3.0,90.000000,0.000000,234.000000 +-3.0,90.000000,0.000000,234.900000 +-3.0,90.000000,0.000000,235.800000 +-3.0,90.000000,0.000000,236.700000 +-3.0,90.000000,0.000000,237.600000 +-3.0,90.000000,0.000000,238.500000 +-3.0,90.000000,0.000000,239.400000 +-3.0,90.000000,0.000000,240.300000 +-3.0,90.000000,0.000000,241.200000 +-3.0,90.000000,0.000000,242.100000 +-3.0,90.000000,0.000000,243.000000 +-3.0,90.000000,0.000000,243.900000 +-3.0,90.000000,0.000000,244.800000 +-3.0,90.000000,0.000000,245.700000 +-3.0,90.000000,0.000000,246.600000 +-3.0,90.000000,0.000000,247.500000 +-3.0,90.000000,0.000000,248.400000 +-3.0,90.000000,0.000000,249.300000 +-3.0,90.000000,0.000000,250.200000 +-3.0,90.000000,0.000000,251.100000 +-3.0,90.000000,0.000000,252.000000 +-3.0,90.000000,0.000000,252.900000 +-3.0,90.000000,0.000000,253.800000 +-3.0,90.000000,0.000000,254.700000 +-3.0,90.000000,0.000000,255.600000 +-3.0,90.000000,0.000000,256.500000 +-3.0,90.000000,0.000000,257.400000 +-3.0,90.000000,0.000000,258.300000 +-3.0,90.000000,0.000000,259.200000 +-3.0,90.000000,0.000000,260.100000 +-3.0,90.000000,0.000000,261.000000 +-3.0,90.000000,0.000000,261.900000 +-3.0,90.000000,0.000000,262.800000 +-3.0,90.000000,0.000000,263.700000 +-3.0,90.000000,0.000000,264.600000 +-3.0,90.000000,0.000000,265.500000 +-3.0,90.000000,0.000000,266.400000 +-3.0,90.000000,0.000000,267.300000 +-3.0,90.000000,0.000000,268.200000 +-3.0,90.000000,0.000000,269.100000 +-3.0,90.000000,0.000000,270.000000 +-3.0,90.000000,0.000000,270.900000 +-3.0,90.000000,0.000000,271.800000 +-3.0,90.000000,0.000000,272.700000 +-3.0,90.000000,0.000000,273.600000 +-3.0,90.000000,0.000000,274.500000 +-3.0,90.000000,0.000000,275.400000 +-3.0,90.000000,0.000000,276.300000 +-3.0,90.000000,0.000000,277.200000 +-3.0,90.000000,0.000000,278.100000 +-3.0,90.000000,0.000000,279.000000 +-3.0,90.000000,0.000000,279.900000 +-3.0,90.000000,0.000000,280.800000 +-3.0,90.000000,0.000000,281.700000 +-3.0,90.000000,0.000000,282.600000 +-3.0,90.000000,0.000000,283.500000 +-3.0,90.000000,0.000000,284.400000 +-3.0,90.000000,0.000000,285.300000 +-3.0,90.000000,0.000000,286.200000 +-3.0,90.000000,0.000000,287.100000 +-3.0,90.000000,0.000000,288.000000 +-3.0,90.000000,0.000000,288.900000 +-3.0,90.000000,0.000000,289.800000 +-3.0,90.000000,0.000000,290.700000 +-3.0,90.000000,0.000000,291.600000 +-3.0,90.000000,0.000000,292.500000 +-3.0,90.000000,0.000000,293.400000 +-3.0,90.000000,0.000000,294.300000 +-3.0,90.000000,0.000000,295.200000 +-3.0,90.000000,0.000000,296.100000 +-3.0,90.000000,0.000000,297.000000 +-3.0,90.000000,0.000000,297.900000 +-3.0,90.000000,0.000000,298.800000 +-3.0,90.000000,0.000000,299.700000 +-3.0,90.000000,0.000000,300.600000 +-3.0,90.000000,0.000000,301.500000 +-3.0,90.000000,0.000000,302.400000 +-3.0,90.000000,0.000000,303.300000 +-3.0,90.000000,0.000000,304.200000 +-3.0,90.000000,0.000000,305.100000 +-3.0,90.000000,0.000000,306.000000 +-3.0,90.000000,0.000000,306.900000 +-3.0,90.000000,0.000000,307.800000 +-3.0,90.000000,0.000000,308.700000 +-3.0,90.000000,0.000000,309.600000 +-3.0,90.000000,0.000000,310.500000 +-3.0,90.000000,0.000000,311.400000 +-3.0,90.000000,0.000000,312.300000 +-3.0,90.000000,0.000000,313.200000 +-3.0,90.000000,0.000000,314.100000 +-3.0,90.000000,0.000000,315.000000 +-3.0,90.000000,0.000000,315.900000 +-3.0,90.000000,0.000000,316.800000 +-3.0,90.000000,0.000000,317.700000 +-3.0,90.000000,0.000000,318.600000 +-3.0,90.000000,0.000000,319.500000 +-3.0,90.000000,0.000000,320.400000 +-3.0,90.000000,0.000000,321.300000 +-3.0,90.000000,0.000000,322.200000 +-3.0,90.000000,0.000000,323.100000 +-3.0,90.000000,0.000000,324.000000 +-3.0,90.000000,0.000000,324.900000 +-3.0,90.000000,0.000000,325.800000 +-3.0,90.000000,0.000000,326.700000 +-3.0,90.000000,0.000000,327.600000 +-3.0,90.000000,0.000000,328.500000 +-3.0,90.000000,0.000000,329.400000 +-3.0,90.000000,0.000000,330.300000 +-3.0,90.000000,0.000000,331.200000 +-3.0,90.000000,0.000000,332.100000 +-3.0,90.000000,0.000000,333.000000 +-3.0,90.000000,0.000000,333.900000 +-3.0,90.000000,0.000000,334.800000 +-3.0,90.000000,0.000000,335.700000 +-3.0,90.000000,0.000000,336.600000 +-3.0,90.000000,0.000000,337.500000 +-3.0,90.000000,0.000000,338.400000 +-3.0,90.000000,0.000000,339.300000 +-3.0,90.000000,0.000000,340.200000 +-3.0,90.000000,0.000000,341.100000 +-3.0,90.000000,0.000000,342.000000 +-3.0,90.000000,0.000000,342.900000 +-3.0,90.000000,0.000000,343.800000 +-3.0,90.000000,0.000000,344.700000 +-3.0,90.000000,0.000000,345.600000 +-3.0,90.000000,0.000000,346.500000 +-3.0,90.000000,0.000000,347.400000 +-3.0,90.000000,0.000000,348.300000 +-3.0,90.000000,0.000000,349.200000 +-3.0,90.000000,0.000000,350.100000 +-3.0,90.000000,0.000000,351.000000 +-3.0,90.000000,0.000000,351.900000 +-3.0,90.000000,0.000000,352.800000 +-3.0,90.000000,0.000000,353.700000 +-3.0,90.000000,0.000000,354.600000 +-3.0,90.000000,0.000000,355.500000 +-3.0,90.000000,0.000000,356.400000 +-3.0,90.000000,0.000000,357.300000 +-3.0,90.000000,0.000000,358.200000 +-3.0,90.000000,0.000000,359.100000 + diff --git a/tests/split_rendering/__init__.py b/tests/split_rendering/__init__.py new file mode 100644 index 0000000000..8429fc9e1c --- /dev/null +++ b/tests/split_rendering/__init__.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +""" + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The Baseline Development Group consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership + rights in their respective contributions in the software. No license of any kind, including but not + limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or + otherwise. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and/or fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. +""" diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py new file mode 100644 index 0000000000..6081b7b283 --- /dev/null +++ b/tests/split_rendering/constants.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python3 + +""" + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The Baseline Development Group consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership + rights in their respective contributions in the software. No license of any kind, including but not + limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or + otherwise. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and/or fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. +""" + +from pathlib import Path +import sys + + +""" Set up paths """ +TESTS_DIR = Path(__file__).parent +RENDER_CFG_DIR = TESTS_DIR.joinpath("renderer_configs").resolve() + +OUTPUT_PATH_REF = TESTS_DIR.joinpath("ref") +OUTPUT_PATH_CUT = TESTS_DIR.joinpath("cut") + +SCRIPTS_DIR = TESTS_DIR.parents[1].joinpath("scripts").resolve() +CUSTOM_LAYOUT_DIR = SCRIPTS_DIR.joinpath("ls_layouts") +HR_TRAJECTORY_DIR = SCRIPTS_DIR.joinpath("trajectories") +TESTV_DIR = SCRIPTS_DIR.joinpath("testv") + +BIN_SUFFIX_MERGETARGET = "_ref" + +sys.path.append(TESTS_DIR) +from renderer.constants import ( + FORMAT_TO_FILE_COMPARETEST, + FORMAT_TO_METADATA_FILES, + INPUT_FORMATS_AMBI, + INPUT_FORMATS_ISM, + INPUT_FORMATS_MASA, + INPUT_FORMATS_MC, + CUSTOM_LS_TO_TEST, + METADATA_SCENES_TO_TEST, + HR_TRAJECTORIES_TO_TEST, +) + +""" Renderer configurations """ +RENDERER_CONFIGS_TO_TEST = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*.txt")] + +""" IVAS format mapping """ +FORMAT_TO_IVAS_COD_FORMAT = { + "MONO": "", + "STEREO": "-stereo", + "ISM1": ["-ism", "1"], + "ISM2": ["-ism", "2"], + "ISM3": ["-ism", "3"], + "ISM4": ["-ism", "4"], + "5_1": ["-mc", "5_1"], + "5_1_2": ["-mc", "5_1_2"], + "5_1_4": ["-mc", "5_1_4"], + "7_1": ["-mc", "7_1"], + "7_1_4": ["-mc", "7_1_4"], + "FOA": ["-sba", "1"], + "HOA2": ["-sba", "2"], + "HOA3": ["-sba", "3"], +} + +""" Encoder commandline template """ +SPLIT_PRE_COD_CMD = [ + str(TESTS_DIR.parent.parent.joinpath("IVAS_cod")), + "512000", + "48", + "", # 3 -> input file + "", # 4 -> output bitstream +] + +""" Split-pre Decoder commandline template """ +SPLIT_PRE_DEC_CMD = [ + str(TESTS_DIR.parent.parent.joinpath("IVAS_dec")), + "-T", + "", # 2 -> pre-trajectory file + "-render_config", + "", # 4 -> render config file + "BINAURAL_SPLIT_CLDFB", + "48", + "", # 7 -> encoder bitstream + "", # 8 -> split rendering bitstream +] + +""" Split-pre Renderer commandline template """ +SPLIT_PRE_REND_CMD = [ + str(TESTS_DIR.parent.parent.joinpath("IVAS_rend")), + "-fs", + "48", + "-render_config", + "", # 4 -> render config file + "-i", + "", # 6 -> input file + "-if", + "", # 8 -> input format + "-o", + "BINAURAL_SPLIT_CLDFB", + "-of", + "", # 10 -> split rendering bitstream + "-tf", + "", # 12 -> post-trajectory file +] + +""" Split-post Renderer commandline template """ +SPLIT_POST_REND_CMD = [ + str(TESTS_DIR.parent.parent.joinpath("IVAS_rend")), + "-fs", + "48", + "-i", + "", # 4 -> split rendering bitstream + "-if", + "BINAURAL_SPLIT_CLDFB", + "-o", + "", # 8 -> output file + "-of", + "BINAURAL", + "-tf", + "", # 12 -> post-trajectory file +] diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt new file mode 100644 index 0000000000..84f70f6d8a --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt b/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt new file mode 100644 index 0000000000..520ba5b8ae --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt new file mode 100644 index 0000000000..1a718cab03 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt new file mode 100644 index 0000000000..31d94203cc --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt new file mode 100644 index 0000000000..498c6add9b --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt @@ -0,0 +1,11 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; +CODEC = 1; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt new file mode 100644 index 0000000000..20488df35b --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = CREND; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt new file mode 100644 index 0000000000..5fbf7f7276 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 0; + +[GENERAL] +RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt new file mode 100644 index 0000000000..881f462661 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 1; + +[GENERAL] +RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; \ No newline at end of file diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt new file mode 100644 index 0000000000..3178a67e32 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 2; +HQMODE = 0; + +[GENERAL] +RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt new file mode 100644 index 0000000000..bd448d16b3 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt @@ -0,0 +1,10 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; + +[GENERAL] +RENDERER = FASTCONV; + +[ROOMACOUSTICS] +REVERB = FALSE; diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py new file mode 100644 index 0000000000..e875920f7f --- /dev/null +++ b/tests/split_rendering/test_split_rendering.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 + +""" + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The Baseline Development Group consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership + rights in their respective contributions in the software. No license of any kind, including but not + limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or + otherwise. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and/or fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. +""" + +import pytest +from .utils import * + +""" Ambisonics """ + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +""" Multichannel """ + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) +def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) +def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +""" ISM """ + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ism_external_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +""" MASA """ +# TODO + + +# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) +# def test_masa_full_chain_split(test_info, in_fmt, render_config, trajectory): +# trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) +# pre_trajectory = trajectory.with_stem(f"{trajectory.stem}_delayed.csv") +# post_trajectory = trajectory +# +# compare_full_chain_split_args( +# test_info, in_fmt, render_config, pre_trajectory, post_trajectory +# ) +# +# +# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) +# def test_masa_external_split(test_info, in_fmt, render_config, trajectory): +# trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) +# pre_trajectory = trajectory.with_stem(f"{trajectory.stem}_delayed.csv") +# post_trajectory = trajectory +# +# compare_external_split_args( +# test_info, in_fmt, render_config, pre_trajectory, post_trajectory +# ) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py new file mode 100644 index 0000000000..0cfeffa200 --- /dev/null +++ b/tests/split_rendering/utils.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python3 + +""" + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The Baseline Development Group consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership + rights in their respective contributions in the software. No license of any kind, including but not + limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or + otherwise. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and/or fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. +""" + +import logging +import subprocess as sp +import sys +from pathlib import Path +from tempfile import TemporaryDirectory + +import numpy as np +import pytest + +from .constants import * + +sys.path.append(TESTS_DIR) +from renderer.utils import check_BE, run_cmd, test_info + +sys.path.append(SCRIPTS_DIR) +from pyaudio3dtools.audiofile import readfile + + +def run_full_chain_split_rendering( + in_fmt: str, + render_config: Path, + pre_trajectory: Path, + post_trajectory: Path, + output_path_base: Path, + binary_suffix: str = "", +) -> Path: + """ + Runs the full split rendering chain consisting of + the IVAS encoder, decoder and split renderer + """ + with TemporaryDirectory() as tmp_dir: + tmp_dir = Path(tmp_dir) + ivas_bitstream = tmp_dir.joinpath("ivas.192") + split_bitstream = tmp_dir.joinpath("split.bit") + out_file = output_path_base.joinpath( + f"{in_fmt}_{pre_trajectory.stem}_to_split_binaural_{post_trajectory.stem}__config_{render_config.stem}.wav" + ) + + # check for metadata files + if in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): + in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] + else: + in_meta_files = None + + # run encoder + cmd = SPLIT_PRE_COD_CMD[:] + + cmd[0] += binary_suffix + cmd[3] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + cmd[4] = str(ivas_bitstream) + cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt] + + if in_meta_files: + cmd[2:2] = in_meta_files + + run_cmd(cmd) + + # decode to split-rendering bitstream + cmd = SPLIT_PRE_DEC_CMD[:] + + cmd[0] += binary_suffix + cmd[2] = str(pre_trajectory) + cmd[4] = str(render_config) + cmd[7] = str(ivas_bitstream) + cmd[8] = str(split_bitstream) + + run_cmd(cmd) + + # run split renderer + cmd = SPLIT_POST_REND_CMD[:] + + cmd[0] += binary_suffix + cmd[4] = str(split_bitstream) + cmd[8] = str(out_file) + cmd[12] = str(post_trajectory) + + run_cmd(cmd) + + return readfile(out_file) + + +def run_external_split_rendering( + in_fmt: str, + render_config: Path, + pre_trajectory: Path, + post_trajectory: Path, + output_path_base: Path, + binary_suffix: str = "", +) -> Path: + """ + Runs the exeternal split rendering chain consisting of + the IVAS renderer in split-pre and split-post rendering mode + """ + + with TemporaryDirectory() as tmp_dir: + tmp_dir = Path(tmp_dir) + split_bitstream = tmp_dir.joinpath("split.bit") + out_file = output_path_base.joinpath( + f"{in_fmt}_{pre_trajectory}_to_split_binaural_{post_trajectory}__config_{render_config.name}.wav" + ) + + # check for metadata files + if in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): + in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] + else: + in_meta_files = None + + # generate split-rendering bitstream + cmd = SPLIT_PRE_REND_CMD[:] + cmd[0] += binary_suffix + cmd[4] = str(render_config) + cmd[6] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + cmd[8] = in_fmt + cmd[10] = str(split_bitstream) + cmd[12] = str(pre_trajectory) + + if in_meta_files: + cmd[9:9] = ["-im", *in_meta_files] + + run_cmd(cmd) + + # run split renderer + cmd = SPLIT_POST_REND_CMD[:] + + cmd[0] += binary_suffix + cmd[4] = str(split_bitstream) + cmd[8] = str(out_file) + cmd[12] = str(post_trajectory) + + run_cmd(cmd) + + return readfile(out_file) + + +def compare_full_chain_split_args( + test_info, + **kwargs, +): + ref, ref_fs = run_full_chain_split_rendering( + output_path_base=OUTPUT_PATH_REF, + binary_suffix=BIN_SUFFIX_MERGETARGET, + **kwargs, + ) + cut, cut_fs = run_full_chain_split_rendering( + output_path_base=OUTPUT_PATH_CUT, + **kwargs, + ) + check_BE(test_info, ref, ref_fs, cut, cut_fs) + + +def compare_external_split_args(test_info, **kwargs): + ref, ref_fs = run_external_split_rendering( + output_path_base=OUTPUT_PATH_REF, + binary_suffix=BIN_SUFFIX_MERGETARGET, + **kwargs, + ) + cut, cut_fs = run_external_split_rendering( + output_path_base=OUTPUT_PATH_CUT, + **kwargs, + ) + check_BE(test_info, ref, ref_fs, cut, cut_fs) -- GitLab From 6024e22aead7f193d2da47cb479b10ecdf1767fc Mon Sep 17 00:00:00 2001 From: malenov Date: Tue, 11 Jul 2023 08:44:51 +0200 Subject: [PATCH 286/591] re-insert assert() to catch situations when the ind_list[] buffer runs out of memory --- lib_com/bitstream.c | 10 ++++++++++ lib_com/options.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 25d388aed1..8baffd6aac 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -862,7 +862,12 @@ ivas_error check_ind_list_limits( if ( ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ) >= *( hBstr->ivas_max_num_indices ) ) { #ifdef DEBUGGING +#ifdef DEBUG_IND_LIST_MEMORY + /* TODO: replace with the warning message below before the finalization of the IVAS codec */ + assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." ); +#else fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); +#endif #endif /* reallocate the buffer of indices with increased limit */ @@ -890,7 +895,12 @@ ivas_error check_ind_list_limits( if ( hBstr->ind_list >= ivas_ind_list_last ) { #ifdef DEBUGGING +#ifdef DEBUG_IND_LIST_MEMORY + /* TODO: replace with the warning message below before the finalization of the IVAS codec */ + assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." ); +#else fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); +#endif #endif /* no available empty slot -> need to re-allocate the buffer */ diff --git a/lib_com/options.h b/lib_com/options.h index e4d3a06b58..5c108181b9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -129,7 +129,7 @@ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ - +#define DEBUG_IND_LIST_MEMORY /* raise assert() when ind_list[] runs out of memory */ #endif /* #################### End DEBUGGING switches ############################ */ -- GitLab From 602a2b2991a4018f05d1df0293e555f2242bd6cc Mon Sep 17 00:00:00 2001 From: malenov Date: Tue, 11 Jul 2023 09:50:03 +0200 Subject: [PATCH 287/591] re-insert renderer ROM consumption into decoder output --- scripts/prepare_instrumentation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 70d6987496..fa3a7578d6 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -103,7 +103,7 @@ find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(u # run wmc_tool "tools/$system/wmc_tool" -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null -"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" >> /dev/null +"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null "tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null # automatically enable #define WMOPS in options.h -- GitLab From ef9f5155d2885ce3a07330e0a58a0bf37b3d7c80 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 10:34:27 +0200 Subject: [PATCH 288/591] [tests] split rendering : add both smoke test and BE comparison, add CI jobs and fix some bugs --- .gitlab-ci.yml | 76 ++++++++ tests/split_rendering/constants.py | 13 +- tests/split_rendering/test_split_rendering.py | 81 +++++---- .../test_split_rendering_be_comparison.py | 171 ++++++++++++++++++ tests/split_rendering/utils.py | 6 +- 5 files changed, 300 insertions(+), 47 deletions(-) create mode 100644 tests/split_rendering/test_split_rendering_be_comparison.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e04cd50f31..0e9e09a397 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -504,6 +504,82 @@ renderer-pytest-on-merge-request: junit: - report-junit.xml +# test split rendering +split-rendering-smoke-test: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-make"] + stage: test + script: + - make -j IVAS_rend + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "split rendering make pytest results" + reports: + junit: + - report-junit.xml + +# compare split-rendering bitexactness between target and source branch +split-rendering-pytest-on-merge-request: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-make"] + # TODO: set reasonable timeout, will most likely take less + timeout: "20 minutes" + stage: compare + script: + - *print-common-info + + # some helper variables - "|| true" to prevent failures from grep not finding anything + - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[split*[ -]*non[ -]*be\]") || true + # TODO: needs splitting the test between reference and cut generation + #- ref_using_main=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[ref[ -]*using[ -]*main\]") || true + + # store the current commit hash + - source_branch_commit_sha=$(git rev-parse HEAD) + + - *mr-fetch-target-branch + - *mr-get-target-commit + - git checkout $target_commit + + # build reference binaries + - make -j IVAS_rend + - mv IVAS_rend IVAS_rend_ref + + # back to source branch + - git checkout $source_branch_commit_sha + - make clean + - make -j IVAS_rend + + # run test + - exit_code=0 + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering_be_comparison.py || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 2 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "pytest split rendering results" + reports: + junit: + - report-junit.xml + # compare bit exactness between target and source branch ivas-pytest-on-merge-request: extends: diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index 6081b7b283..fa4d6f5d7b 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -26,9 +26,8 @@ the United Nations Convention on Contracts on the International Sales of Goods. """ -from pathlib import Path import sys - +from pathlib import Path """ Set up paths """ TESTS_DIR = Path(__file__).parent @@ -46,15 +45,15 @@ BIN_SUFFIX_MERGETARGET = "_ref" sys.path.append(TESTS_DIR) from renderer.constants import ( + CUSTOM_LS_TO_TEST, FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_METADATA_FILES, + HR_TRAJECTORIES_TO_TEST, INPUT_FORMATS_AMBI, INPUT_FORMATS_ISM, INPUT_FORMATS_MASA, INPUT_FORMATS_MC, - CUSTOM_LS_TO_TEST, METADATA_SCENES_TO_TEST, - HR_TRAJECTORIES_TO_TEST, ) """ Renderer configurations """ @@ -112,11 +111,11 @@ SPLIT_PRE_REND_CMD = [ "-if", "", # 8 -> input format "-o", - "BINAURAL_SPLIT_CLDFB", - "-of", "", # 10 -> split rendering bitstream + "-of", + "BINAURAL_SPLIT_CLDFB", "-tf", - "", # 12 -> post-trajectory file + "", # 14 -> post-trajectory file ] """ Split-post Renderer commandline template """ diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index e875920f7f..47e5252225 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -27,6 +27,7 @@ """ import pytest + from .utils import * """ Ambisonics """ @@ -36,15 +37,15 @@ from .utils import * @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): - post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) - pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - compare_full_chain_split_args( - test_info, + run_full_chain_split_rendering( in_fmt=in_fmt, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, ) @@ -52,15 +53,15 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): - post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) - pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - compare_full_chain_split_args( - test_info, + run_external_split_rendering( in_fmt=in_fmt, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, ) @@ -69,33 +70,33 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) -@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): - post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) - pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - compare_full_chain_split_args( - test_info, + run_full_chain_split_rendering( in_fmt=in_fmt, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, ) @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) -@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): - post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) - pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - compare_full_chain_split_args( - test_info, + run_external_split_rendering( in_fmt=in_fmt, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, ) @@ -106,15 +107,15 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): - post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) - pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - compare_full_chain_split_args( - test_info, + run_full_chain_split_rendering( in_fmt=in_fmt, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, ) @@ -122,15 +123,15 @@ def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): - post_trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) - pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed.csv") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - compare_full_chain_split_args( - test_info, + run_external_split_rendering( in_fmt=in_fmt, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, ) @@ -142,12 +143,15 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): # @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) # @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) # def test_masa_full_chain_split(test_info, in_fmt, render_config, trajectory): -# trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) -# pre_trajectory = trajectory.with_stem(f"{trajectory.stem}_delayed.csv") -# post_trajectory = trajectory +# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") +# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") # -# compare_full_chain_split_args( -# test_info, in_fmt, render_config, pre_trajectory, post_trajectory +# run_full_chain_split_rendering( +# in_fmt=in_fmt, +# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), +# pre_trajectory=pre_trajectory, +# post_trajectory=post_trajectory, +# output_path_base=OUTPUT_PATH_CUT, # ) # # @@ -155,10 +159,13 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): # @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) # @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) # def test_masa_external_split(test_info, in_fmt, render_config, trajectory): -# trajectory = HR_TRAJECTORY_DIR.joinpath(trajectory) -# pre_trajectory = trajectory.with_stem(f"{trajectory.stem}_delayed.csv") -# post_trajectory = trajectory +# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") +# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") # -# compare_external_split_args( -# test_info, in_fmt, render_config, pre_trajectory, post_trajectory -# ) +# run_external_split_rendering( +# in_fmt=in_fmt, +# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), +# pre_trajectory=pre_trajectory, +# post_trajectory=post_trajectory, +# output_path_base=OUTPUT_PATH_CUT, +# ) \ No newline at end of file diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py new file mode 100644 index 0000000000..359afb3359 --- /dev/null +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python3 + +""" + (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The Baseline Development Group consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, + Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership + rights in their respective contributions in the software. No license of any kind, including but not + limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or + otherwise. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and/or fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. +""" + +import pytest + +from .utils import * + +""" Ambisonics """ + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_external_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +""" Multichannel """ + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) +def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) +def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_external_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +""" ISM """ + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ism_external_split(test_info, in_fmt, render_config, trajectory): + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_external_split_args( + test_info, + in_fmt=in_fmt, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) + + +""" MASA """ +# TODO + + +# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) +# def test_masa_full_chain_split(test_info, in_fmt, render_config, trajectory): +# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") +# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") +# +# compare_full_chain_split_args( +# test_info, +# in_fmt=in_fmt, +# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), +# pre_trajectory=pre_trajectory, +# post_trajectory=post_trajectory, +# ) +# +# +# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) +# def test_masa_external_split(test_info, in_fmt, render_config, trajectory): +# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") +# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") +# +# compare_external_split_args( +# test_info, +# in_fmt=in_fmt, +# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), +# pre_trajectory=pre_trajectory, +# post_trajectory=post_trajectory, +# ) \ No newline at end of file diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 0cfeffa200..e1d455c533 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -61,7 +61,7 @@ def run_full_chain_split_rendering( ivas_bitstream = tmp_dir.joinpath("ivas.192") split_bitstream = tmp_dir.joinpath("split.bit") out_file = output_path_base.joinpath( - f"{in_fmt}_{pre_trajectory.stem}_to_split_binaural_{post_trajectory.stem}__config_{render_config.stem}.wav" + f"{in_fmt}_{pre_trajectory.stem}_split_full_{post_trajectory.stem}__config_{render_config.stem}.wav" ) # check for metadata files @@ -124,7 +124,7 @@ def run_external_split_rendering( tmp_dir = Path(tmp_dir) split_bitstream = tmp_dir.joinpath("split.bit") out_file = output_path_base.joinpath( - f"{in_fmt}_{pre_trajectory}_to_split_binaural_{post_trajectory}__config_{render_config.name}.wav" + f"{in_fmt}_{pre_trajectory.stem}_split_ext_{post_trajectory.stem}__config_{render_config.stem}.wav" ) # check for metadata files @@ -140,7 +140,7 @@ def run_external_split_rendering( cmd[6] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) cmd[8] = in_fmt cmd[10] = str(split_bitstream) - cmd[12] = str(pre_trajectory) + cmd[14] = str(pre_trajectory) if in_meta_files: cmd[9:9] = ["-im", *in_meta_files] -- GitLab From 57d3461b3eb8c59bbac8bf409465b393f0536243 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 10:41:08 +0200 Subject: [PATCH 289/591] [fix] formatting + use shorter testvectors for smoketest --- tests/split_rendering/constants.py | 1 + tests/split_rendering/test_split_rendering.py | 2 +- .../test_split_rendering_be_comparison.py | 2 +- tests/split_rendering/utils.py | 16 ++++++++++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index fa4d6f5d7b..3e41e019b0 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -47,6 +47,7 @@ sys.path.append(TESTS_DIR) from renderer.constants import ( CUSTOM_LS_TO_TEST, FORMAT_TO_FILE_COMPARETEST, + FORMAT_TO_FILE_SMOKETEST, FORMAT_TO_METADATA_FILES, HR_TRAJECTORIES_TO_TEST, INPUT_FORMATS_AMBI, diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 47e5252225..9ffa37d560 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -168,4 +168,4 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): # pre_trajectory=pre_trajectory, # post_trajectory=post_trajectory, # output_path_base=OUTPUT_PATH_CUT, -# ) \ No newline at end of file +# ) diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py index 359afb3359..8a9e5a8998 100644 --- a/tests/split_rendering/test_split_rendering_be_comparison.py +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -168,4 +168,4 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): # render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), # pre_trajectory=pre_trajectory, # post_trajectory=post_trajectory, -# ) \ No newline at end of file +# ) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index e1d455c533..8cfd36f917 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -51,6 +51,7 @@ def run_full_chain_split_rendering( post_trajectory: Path, output_path_base: Path, binary_suffix: str = "", + is_comparetest: bool = False, ) -> Path: """ Runs the full split rendering chain consisting of @@ -74,7 +75,10 @@ def run_full_chain_split_rendering( cmd = SPLIT_PRE_COD_CMD[:] cmd[0] += binary_suffix - cmd[3] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + if is_comparetest: + cmd[3] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + else: + cmd[3] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt]) cmd[4] = str(ivas_bitstream) cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt] @@ -114,6 +118,7 @@ def run_external_split_rendering( post_trajectory: Path, output_path_base: Path, binary_suffix: str = "", + is_comparetest: bool = False, ) -> Path: """ Runs the exeternal split rendering chain consisting of @@ -137,7 +142,10 @@ def run_external_split_rendering( cmd = SPLIT_PRE_REND_CMD[:] cmd[0] += binary_suffix cmd[4] = str(render_config) - cmd[6] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + if is_comparetest: + cmd[6] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + else: + cmd[6] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt]) cmd[8] = in_fmt cmd[10] = str(split_bitstream) cmd[14] = str(pre_trajectory) @@ -167,10 +175,12 @@ def compare_full_chain_split_args( ref, ref_fs = run_full_chain_split_rendering( output_path_base=OUTPUT_PATH_REF, binary_suffix=BIN_SUFFIX_MERGETARGET, + is_comparetest=True, **kwargs, ) cut, cut_fs = run_full_chain_split_rendering( output_path_base=OUTPUT_PATH_CUT, + is_comparetest=True, **kwargs, ) check_BE(test_info, ref, ref_fs, cut, cut_fs) @@ -180,10 +190,12 @@ def compare_external_split_args(test_info, **kwargs): ref, ref_fs = run_external_split_rendering( output_path_base=OUTPUT_PATH_REF, binary_suffix=BIN_SUFFIX_MERGETARGET, + is_comparetest=True, **kwargs, ) cut, cut_fs = run_external_split_rendering( output_path_base=OUTPUT_PATH_CUT, + is_comparetest=True, **kwargs, ) check_BE(test_info, ref, ref_fs, cut, cut_fs) -- GitLab From 850f42185e0de3c22edee3d16fd612241b298554 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 10:43:58 +0200 Subject: [PATCH 290/591] [fix] add test output folders to git --- tests/split_rendering/cut/.gitignore | 1 + tests/split_rendering/ref/.gitignore | 1 + 2 files changed, 2 insertions(+) create mode 100644 tests/split_rendering/cut/.gitignore create mode 100644 tests/split_rendering/ref/.gitignore diff --git a/tests/split_rendering/cut/.gitignore b/tests/split_rendering/cut/.gitignore new file mode 100644 index 0000000000..f935021a8f --- /dev/null +++ b/tests/split_rendering/cut/.gitignore @@ -0,0 +1 @@ +!.gitignore diff --git a/tests/split_rendering/ref/.gitignore b/tests/split_rendering/ref/.gitignore new file mode 100644 index 0000000000..f935021a8f --- /dev/null +++ b/tests/split_rendering/ref/.gitignore @@ -0,0 +1 @@ +!.gitignore -- GitLab From 9b1d142e6c7fa0fbf5e2a4e0ddfaf0ef0292d1f8 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 10:58:20 +0200 Subject: [PATCH 291/591] [ci] fix missing binaries for split-rendering jobs --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e9e09a397..ee6fb4d064 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -512,7 +512,7 @@ split-rendering-smoke-test: needs: ["build-codec-linux-make"] stage: test script: - - make -j IVAS_rend + - make -j - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" @@ -550,13 +550,15 @@ split-rendering-pytest-on-merge-request: - git checkout $target_commit # build reference binaries - - make -j IVAS_rend + - make -j + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref # back to source branch - git checkout $source_branch_commit_sha - make clean - - make -j IVAS_rend + - make -j # run test - exit_code=0 -- GitLab From 5b146951a354fc1efbbcd531112ea1598dff4553 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 11:19:32 +0200 Subject: [PATCH 292/591] [tests] fix bug in ISM tests and ignore split rendering tests for ivas-pytest job --- pytest.ini | 2 +- tests/split_rendering/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index 0cb53d22bb..14538fd90d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,7 +2,7 @@ # note: per convention, this file is placed in the root directory of the repository [pytest] # TODO remove ignore after tests are harmonized -addopts = -ra --tb=short --basetemp=./tmp -n auto -v --ignore=tests/renderer +addopts = -ra --tb=short --basetemp=./tmp -n auto -v --ignore=tests/renderer --ignore=tests/split_rendering # Write captured system-out log messages to JUnit report. junit_logging = system-out # Do not capture log information for passing tests to JUnit report. diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 8cfd36f917..c0d999df40 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -83,7 +83,7 @@ def run_full_chain_split_rendering( cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt] if in_meta_files: - cmd[2:2] = in_meta_files + cmd[3:3] = in_meta_files run_cmd(cmd) -- GitLab From 7d0f9972a91a850b14d4a716c05650d21eb7004f Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 11 Jul 2023 11:20:48 +0200 Subject: [PATCH 293/591] Use strings instead of numbers for CODEC in renderer config files --- ...t_renderer_config_768_1dof_hoa_lc3plus.txt | 2 +- .../split_renderer_config_pcm_3dof_hq.txt | 2 +- lib_util/render_config_reader.c | 49 +++++++++++++++++-- ...t_renderer_config_768_1dof_hoa_lc3plus.txt | 2 +- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt index 498c6add9b..ca6fbaf9d3 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt @@ -2,7 +2,7 @@ BITRATE = 768000; DOF = 1; HQMODE = 0; -CODEC = 1; +CODEC = LC3PLUS; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt index 6b33fc28cd..9063edab6c 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt @@ -2,7 +2,7 @@ BITRATE = 768000; DOF = 3; HQMODE = 1; -CODEC = 1; +CODEC = LC3PLUS; [GENERAL] RENDERER = CREND; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index cf89b3b7da..0ef96c40df 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -371,6 +371,10 @@ ivas_error RenderConfigReader_read( char *pValue; int16_t nBandsInput; int16_t nVectorsMissing; +#ifdef SPLIT_REND_LC3PLUS + bool dofProvided = false; + bool poseCorrProvided = false; +#endif fseek( pRenderConfigReader->pConfigFile, 0, SEEK_END ); file_size = ftell( pRenderConfigReader->pConfigFile ); @@ -517,20 +521,57 @@ ivas_error RenderConfigReader_read( } else if ( strcmp( item, "DOF" ) == 0 ) { +#ifdef SPLIT_REND_LC3PLUS + dofProvided = true; +#endif if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.dof ) ) { errorHandler( item, ERROR_VALUE_INVALID ); } +#ifdef SPLIT_REND_LC3PLUS + /* 0 DOF implies no pose correction */ + if ( hRenderConfig->split_rend_config.dof == 0 && !poseCorrProvided ) + { + hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; + } +#endif } #ifdef SPLIT_REND_LC3PLUS else if ( strcmp( item, "CODEC" ) == 0 ) { - int16_t tmp; - if ( !sscanf( pValue, "%hd", &tmp ) ) + if ( strcmp( pValue, "LCLD" ) == 0 ) { - errorHandler( item, ERROR_VALUE_INVALID ); + hRenderConfig->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + } + else if ( strcmp( pValue, "LC3PLUS" ) == 0 ) + { + hRenderConfig->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LC3PLUS; + } + else + { + errorHandler( pValue, ERROR_VALUE_INVALID ); + } + } + else if ( strcmp( item, "POSECORRECTION" ) == 0 ) + { + poseCorrProvided = true; + if ( strcmp( pValue, "CLDFB" ) == 0 ) + { + hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; + } + else if ( strcmp( pValue, "NONE" ) == 0 ) + { + hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; + /* no pose correction implies 0 DOF */ + if ( !dofProvided ) + { + hRenderConfig->split_rend_config.dof = 0; + } + } + else + { + errorHandler( pValue, ERROR_VALUE_INVALID ); } - hRenderConfig->split_rend_config.codec = tmp == 0 ? IVAS_SPLIT_REND_CODEC_LCLD : IVAS_SPLIT_REND_CODEC_LC3PLUS; } #endif diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt index 498c6add9b..ca6fbaf9d3 100644 --- a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt +++ b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt @@ -2,7 +2,7 @@ BITRATE = 768000; DOF = 1; HQMODE = 0; -CODEC = 1; +CODEC = LC3PLUS; [GENERAL] RENDERER = CREND; -- GitLab From 8087b57b2bd22396ea3e6694a0799f727ad6c1b8 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 11 Jul 2023 12:03:19 +0200 Subject: [PATCH 294/591] Remove duplicate source files from LC3plus CMake target --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a6cc317ca..270636eb5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,10 +134,8 @@ target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend lc3pl file(GLOB libLC3plusSrcs "lc3plus/*.c") file(GLOB libLC3plusHeaders "lc3plus/*.h") -file(GLOB libLC3plusFftSrcs "lc3plus/fft/*.c") -file(GLOB libLC3plusFftHeaders "lc3plus/fft/*.h") -add_library(lc3plus ${libLC3plusSrcs} ${libLC3plusFftSrcs} ${libLC3plusHeaders} ${libLC3plusFftHeaders}) -target_include_directories(lc3plus PUBLIC lc3plus PRIVATE lc3plus/fft ) +add_library(lc3plus ${libLC3plusSrcs} ${libLC3plusHeaders}) +target_include_directories(lc3plus PUBLIC lc3plus) target_link_libraries(lc3plus lib_com) # For including options.h, which is needed for instrumentation to work correctly if(WMOPS) target_link_libraries(lc3plus lib_debug) -- GitLab From 2c0440ed8c2f2dacb7314cbd8e12fc24cd55c3ed Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 11 Jul 2023 12:21:21 +0200 Subject: [PATCH 295/591] Remove unneeded file from LC3plus --- lc3plus/plc_noise_substitution0.c | 14 -------------- scripts/lc3plus_lib_setup/get_lc3plus.sh | 5 +++++ 2 files changed, 5 insertions(+), 14 deletions(-) delete mode 100644 lc3plus/plc_noise_substitution0.c diff --git a/lc3plus/plc_noise_substitution0.c b/lc3plus/plc_noise_substitution0.c deleted file mode 100644 index da050e3dd2..0000000000 --- a/lc3plus/plc_noise_substitution0.c +++ /dev/null @@ -1,14 +0,0 @@ -/****************************************************************************** -* ETSI TS 103 634 V1.4.1 * -* Low Complexity Communication Codec Plus (LC3plus) * -* * -* Copyright licence is solely granted through ETSI Intellectual Property * -* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -* estoppel or otherwise. * -******************************************************************************/ - - -#include "options.h" -#include "functions.h" - - diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index 52152999cf..01ad362b71 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -14,10 +14,15 @@ unzip lc3plus_sources.zip -d . git apply --ignore-whitespace lc3plus.patch rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c + +# Remove unneeded files rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/makefile rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywaveout_c.h +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c rm -r ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc + +# Limit file permissions find ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point -type f -exec chmod -x {} \; # Move to output dir -- GitLab From b7e3da16ab759d839547d19f18b2d2aaf3e4d5a0 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 11 Jul 2023 12:23:55 +0200 Subject: [PATCH 296/591] Fix visual studio build --- Workspace_msvc/LC3plus.vcxproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Workspace_msvc/LC3plus.vcxproj b/Workspace_msvc/LC3plus.vcxproj index a70c61e5a8..f79b35d290 100644 --- a/Workspace_msvc/LC3plus.vcxproj +++ b/Workspace_msvc/LC3plus.vcxproj @@ -134,7 +134,6 @@ - -- GitLab From 83202b25bcda8bd14dba403d4d621210d48b70e2 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 11 Jul 2023 12:32:35 +0200 Subject: [PATCH 297/591] Try to fix linker warning about incremental linking --- Workspace_msvc/LC3plus.vcxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/Workspace_msvc/LC3plus.vcxproj b/Workspace_msvc/LC3plus.vcxproj index f79b35d290..7871157b8f 100644 --- a/Workspace_msvc/LC3plus.vcxproj +++ b/Workspace_msvc/LC3plus.vcxproj @@ -51,13 +51,11 @@ - true LC3plus $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Obj\ - false LC3plus $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Obj\ -- GitLab From 930b36d3e33e0eae7cab3da6146e6e1172bef5e9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 13:05:13 +0200 Subject: [PATCH 298/591] [fix] MSVC warnings --- lib_rend/ivas_lc3plus_dec.c | 12 ++++++------ lib_rend/ivas_lc3plus_dec.h | 2 +- lib_rend/ivas_lc3plus_enc.c | 2 +- lib_rend/ivas_splitRenderer_utils.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_rend/ivas_lc3plus_dec.c b/lib_rend/ivas_lc3plus_dec.c index 45d56d3c63..628e876711 100644 --- a/lib_rend/ivas_lc3plus_dec.c +++ b/lib_rend/ivas_lc3plus_dec.c @@ -64,7 +64,7 @@ ivas_error IVAS_LC3PLUS_DEC_Open( #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING ( *handle )->cachingEnabled = enableCaching; #endif - numLC3plusFramesPerIvasFrame = config.ivas_frame_duration_us / config.lc3plus_frame_duration_us; + numLC3plusFramesPerIvasFrame = (int16_t) ( config.ivas_frame_duration_us / config.lc3plus_frame_duration_us ); #ifdef LC3PLUS_DEC_COLLECT_STATS ( *handle )->stats.action_histogram[DEC_ACTION_DECODE_AND_DROP] = 0; @@ -257,9 +257,9 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix( return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "invalid ivas_frame_duration_us/lc3plus_frame_duration_us values\n" ); } - effectiveIvasSubframeDuration = handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us / MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us; - numIvasSubFramesPerLC3frame = handle->config.lc3plus_frame_duration_us / effectiveIvasSubframeDuration; - actual_num_spatial_subframes = handle->config.ivas_frame_duration_us / effectiveIvasSubframeDuration; + effectiveIvasSubframeDuration = (int16_t) ( handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us / MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us ); + numIvasSubFramesPerLC3frame = (int16_t) handle->config.lc3plus_frame_duration_us / effectiveIvasSubframeDuration; + actual_num_spatial_subframes = (int16_t) handle->config.ivas_frame_duration_us / effectiveIvasSubframeDuration; // 0.5(0) = 10ms lc3plus, 5ms subframe if ( numIvasSubFramesPerLC3frame != 1 ) { @@ -495,7 +495,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( } lc3framesPerIvasFrame = handle->config.ivas_frame_duration_us / handle->config.lc3plus_frame_duration_us; - numSamplesPerLC3plusChannel = handle->config.samplerate / ( 1000000 / handle->config.ivas_frame_duration_us ) / lc3framesPerIvasFrame; + numSamplesPerLC3plusChannel = (int16_t) ( handle->config.samplerate / ( 1000000 / handle->config.ivas_frame_duration_us ) / lc3framesPerIvasFrame ); bitstreamOffsetPerCoder = bitstream_in_size / handle->num_decs / lc3framesPerIvasFrame; for ( iDec = 0; iDec < handle->num_decs; iDec++ ) { @@ -572,7 +572,7 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "bitstream_cache_capacity is too low for LC3plus frame size\n" ); } /* store bit rate of cached frame */ - mvc2c( bitstream_in_iter, handle->bitstream_caches[iDec]->bitstream_cache, bitstreamOffsetPerCoder ); + mvc2c( bitstream_in_iter, handle->bitstream_caches[iDec]->bitstream_cache, (int16_t) bitstreamOffsetPerCoder ); handle->bitstream_caches[iDec]->bitstream_cache_size = bitstreamOffsetPerCoder; /* log that this instance has skipped a frame and must decode twice once reactivated */ handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h index f834f4dcd8..572120d499 100644 --- a/lib_rend/ivas_lc3plus_dec.h +++ b/lib_rend/ivas_lc3plus_dec.h @@ -133,6 +133,6 @@ ivas_error IVAS_LC3PLUS_DEC_Conceal( float **pcm_out /* o: concealed samples */ ); -ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, uint32_t num_decs ); +ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, const uint32_t num_decs ); void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix ); diff --git a/lib_rend/ivas_lc3plus_enc.c b/lib_rend/ivas_lc3plus_enc.c index 1b655c6ce9..d83a471dee 100644 --- a/lib_rend/ivas_lc3plus_enc.c +++ b/lib_rend/ivas_lc3plus_enc.c @@ -270,7 +270,7 @@ ivas_error IVAS_LC3PLUS_ENC_Encode( for ( uint32_t iSampleInt16 = 0; iSampleInt16 < numSamplesPerLC3plusChannel; iSampleInt16++ ) { ivasSampleIndex = iSampleInt16 + iLc3plusFrame * numSamplesPerLC3plusChannel; - handle->pcm_conversion_buffer[iSampleInt16] = max( INT16_MIN, min( pcm_in[iEnc][ivasSampleIndex], INT16_MAX ) ); + handle->pcm_conversion_buffer[iSampleInt16] = (int16_t) max( INT16_MIN, min( pcm_in[iEnc][ivasSampleIndex], INT16_MAX ) ); } num_bytes = 0; diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 50d70ceb31..965ed46ec6 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -448,7 +448,7 @@ int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REN if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - int32_t inBandMdBps = 8 * FRAMES_PER_SECOND; + int32_t inBandMdBps = (int32_t) ( 8 * FRAMES_PER_SECOND ); return ivas_get_lcld_bitrate( SplitRendBitRate ) - inBandMdBps; } if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) @@ -536,7 +536,7 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL bitrate = ivas_get_lc3plus_bitrate( bitrate, poseCorrectionMode ); /* Return size in bytes */ - return bitrate / FRAMES_PER_SECOND / 8; + return (int32_t) ( bitrate / FRAMES_PER_SECOND / 8 ); } ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig ) -- GitLab From 359029dd5ecfcbecfea09c73cb9a77f1092bada6 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 13:13:11 +0200 Subject: [PATCH 299/591] [fix] MSVC Warning for debug info related to /EDITANDCONTINUE --- Workspace_msvc/LC3plus.vcxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Workspace_msvc/LC3plus.vcxproj b/Workspace_msvc/LC3plus.vcxproj index 7871157b8f..7cefc1816b 100644 --- a/Workspace_msvc/LC3plus.vcxproj +++ b/Workspace_msvc/LC3plus.vcxproj @@ -70,6 +70,7 @@ MultiThreadedDebug WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 4305;4244;4996 + OldStyle Console -- GitLab From bf3deba37316c02a0ac3de63bbb8c352663ca0c9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 11 Jul 2023 13:49:27 +0200 Subject: [PATCH 300/591] [fix] try to fix sanitizer errors --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6bd6ff62b2..afa16e703c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2525,7 +2525,7 @@ static void clearInputMc( } #ifdef SPLIT_REND_LC3PLUS_MC - for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) { -- GitLab From c79dc687f890569055cece15ca0a06a7f8f55648 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 11 Jul 2023 14:56:13 +0300 Subject: [PATCH 301/591] Perform major renaming and moving overhaul. Also fixes some minor parts left. --- Workspace_msvc/lib_dec.vcxproj | 3 - Workspace_msvc/lib_dec.vcxproj.filters | 9 - Workspace_msvc/lib_rend.vcxproj | 4 + lib_com/ivas_prot.h | 185 +- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_dirac_dec.c | 4396 +++++------------ lib_dec/ivas_init_dec.c | 6 +- lib_dec/ivas_ism_dec.c | 26 +- lib_dec/ivas_ism_param_dec.c | 214 +- lib_dec/ivas_jbm_dec.c | 8 +- lib_dec/ivas_masa_dec.c | 26 +- lib_dec/ivas_mct_dec.c | 30 +- lib_dec/ivas_sba_dec.c | 34 +- lib_dec/ivas_spar_decoder.c | 12 +- lib_dec/ivas_spar_md_dec.c | 26 +- lib_dec/ivas_stat_dec.h | 294 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 532 +- {lib_dec => lib_rend}/ivas_dirac_decorr_dec.c | 2 +- {lib_dec => lib_rend}/ivas_dirac_onsets_dec.c | 1 + .../ivas_dirac_output_synthesis_dec.c | 188 +- lib_rend/ivas_dirac_rend.c | 2030 ++++++++ lib_rend/ivas_prot_rend.h | 322 +- lib_rend/ivas_stat_rend.h | 257 + lib_rend/lib_rend.c | 50 +- 24 files changed, 4422 insertions(+), 4235 deletions(-) rename {lib_dec => lib_rend}/ivas_dirac_decorr_dec.c (99%) rename {lib_dec => lib_rend}/ivas_dirac_onsets_dec.c (99%) rename {lib_dec => lib_rend}/ivas_dirac_output_synthesis_dec.c (92%) create mode 100644 lib_rend/ivas_dirac_rend.c diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 80910aa5e7..5cad95348b 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -271,10 +271,7 @@ - - - diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters index 6284884920..a7eb87f148 100644 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -16,15 +16,6 @@ dec_ivas_c - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - dec_ivas_c diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index d1cda3290d..2bd4d96fe4 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -203,6 +203,10 @@ + + + + diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 484bb62fd3..0ddd58e1ee 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1037,7 +1037,7 @@ ivas_error ivas_param_ism_dec_open( void ivas_param_ism_dec_close( DIRAC_DEC_HANDLE *hDirAC, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out, /* i/o: common spatial renderer data */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ const AUDIO_CONFIG output_config /* i : output audio configuration */ ); @@ -3165,7 +3165,7 @@ void ivas_qmetadata_to_dirac( const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -3567,11 +3567,6 @@ ivas_error ivas_dirac_sba_config( const int16_t nbands /* i : number of frequency bands */ ); -ivas_error ivas_dirac_allocate_parameters( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ - const int16_t params_flag /* i : set of parameters flag */ -); - ivas_error ivas_dirac_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_configopen /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ @@ -3581,24 +3576,11 @@ void ivas_dirac_dec_close( DIRAC_DEC_HANDLE *hDirAC_out ); -void ivas_spat_rend_common_data_close( - SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out -); - -void ivas_dirac_rend_close( - DIRAC_REND_HANDLE *hDirACRend_out -); - -void ivas_dirac_deallocate_parameters( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ - const int16_t params_flag /* i : set of parameters flag */ -); - void ivas_dirac_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder Core state structure */ DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial rendering data handle */ + 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -3649,12 +3631,6 @@ ivas_error ivas_td_decorr_reconfig_dec( uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ ); -/*! r: Configured reqularization factor value */ -float configure_reqularization_factor( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int32_t ivas_total_brate /* i : total IVAS bitrate */ -); - void computeDiffuseness_mdft( float **buffer_intensity[DIRAC_NUM_DIMS], const float *buffer_energy, @@ -3681,116 +3657,6 @@ void computeDiffuseness( float *diffuseness ); -ivas_error ivas_dirac_dec_onset_detection_open( - const int16_t num_channels, - const int16_t num_freq_bands, - const int16_t max_band_decorr, - DIRAC_ONSET_DETECTION_PARAMS *ph_dirac_onset_detection_params, - DIRAC_ONSET_DETECTION_STATE *ph_dirac_onset_detection_state -); - -void ivas_dirac_dec_onset_detection_process( - const float *input_power_f, - float *onset_filter, - const int16_t num_protos_diff, - DIRAC_ONSET_DETECTION_PARAMS h_dirac_onset_detection_params, - DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state -); - -ivas_error ivas_dirac_dec_decorr_open( - DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, - DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, - const int16_t num_freq_bands, - int16_t num_outputs_diff, - const int16_t num_protos_diff, - const DIRAC_SYNTHESIS_CONFIG synthesisConf, - float *frequency_axis, - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs /* i : output sampling rate */ -); - -void ivas_dirac_dec_decorr_process( - const int16_t num_freq_bands, - int16_t num_channels, - const int16_t num_protos_diff, - const DIRAC_SYNTHESIS_CONFIG synthesisConf, - const int16_t nchan_transport, /* i : number of transport channels */ - const float *input_frame_f, - const int16_t num_protos_dir, - const int16_t *proto_index_dir, - float *frame_dec_f, - float *onset_filter, - HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params, - HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state -); - -void ivas_dirac_dec_decorr_close( - HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params, - HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state -); - -ivas_error ivas_dirac_dec_output_synthesis_open( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const RENDERER_TYPE renderer_type, /* i : renderer type */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_init( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_close( - DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ -); - -void ivas_dirac_dec_output_synthesis_process_slot( - const float *reference_power, /* i : Estimated power */ - const float *onset, /* i : onset filter */ - const int16_t *azimuth, - const int16_t *elevation, - const float *diffuseness, - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const int16_t sh_rot_max_order, - const float *p_Rmat, /* i : rotation matrix */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nbslots, /* i : number of slots to process */ - const float *onset_filter, - float *diffuseness, - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const int16_t nbslots, /* i : number of slots to process */ - float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ - float *reference_power_smooth, - float qualityBasedSmFactor -); void ivas_dirac_dec_get_response( const int16_t azimuth, @@ -3799,51 +3665,8 @@ void ivas_dirac_dec_get_response( const int16_t ambisonics_order ); -void compute_hoa_encoder_mtx( - const float *azimuth, - const float *elevation, - float *response, - const int16_t num_responses, - const int16_t ambisonics_order ); - -void ivas_dirac_dec_compute_gain_factors( - const int16_t num_freq_bands, - const float *diffuseness, - const int16_t max_band_decorr, - float *direct_gain_factor, - float *diffuse_gain_factor -); - -void ivas_dirac_dec_compute_power_factors( - const int16_t num_freq_bands, - const float *diffuseness, - const int16_t max_band_decorr, - float *direct_power_factor, - float *diffuse_power_factor -); - -void ivas_dirac_dec_compute_directional_responses( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - const int16_t *azimuth, - const int16_t *elevation, - const int16_t md_idx, - const float *surCohRatio, - const int16_t shd_rot_max_order, /* i : split-order rotation method */ - const float *p_Rmat, /* i : rotation matrix */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_get_frequency_axis( - float *frequency_axis, /* o : array of center frequencies of a real filter bank */ - const int32_t output_Fs, /* i : sampling frequency */ - const int16_t num_freq_bands /* i : number of frequency bands */ -); - void calculate_hodirac_sector_parameters( - DIRAC_ENC_HANDLE hDirAC, + DIRAC_ENC_HANDLE hDirAC, float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ const float beta, /* i : forgetting factor for average filtering */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 439a90fb2c..65532fb351 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -396,7 +396,7 @@ ivas_error ivas_dec( { #ifdef FIX_564 /* loudness correction */ - ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame ); + ivas_dirac_dec_binaural_sba_gain( output, nchan_remapped, output_frame ); #else float gain; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index bd92a5c148..6f2b89343c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -51,172 +51,6 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static ivas_error ivas_dirac_alloc_mem( DIRAC_REND_HANDLE hDirACRend, const RENDERER_TYPE renderer_type, const int16_t num_freq_bands, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, const int16_t hodirac_flag ); - -static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); - -static void initDiffuseResponses( float *diffuse_response_function, const int16_t num_channels, AUDIO_CONFIG output_config, IVAS_OUTPUT_SETUP hOutSetup, const int16_t ambisonics_order, const IVAS_FORMAT ivas_format, int16_t *num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG transport_config ); - -static void computeIntensityVector_dec( float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float *intensity_real_x, float *intensity_real_y, float *intensity_real_z ); - -static void protoSignalComputation_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_direct_buffer_f, float *proto_diffuse_buffer_f, float *reference_power, const int16_t slot_index, const int16_t num_inputs, const int16_t num_outputs_diff, const int16_t num_freq_bands, float *p_Rmat ); - -static void protoSignalComputation1( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands ); - -static void protoSignalComputation2( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t isloudspeaker, const int16_t slot_index, const int16_t num_freq_bands, MASA_STEREO_TYPE_DETECT *stereo_type_detect ); - -static void protoSignalComputation4( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands, const float *mtx_hoa_decoder, const int16_t nchan_transport, const int16_t *sba_map_tc_ind ); - -static void ivas_dirac_dec_compute_diffuse_proto( DIRAC_REND_HANDLE hDirACRend, const int16_t num_freq_bands, const int16_t slot_idx ); - -static void computeDirectionAngles( float *intensity_real_x, float *intensity_real_y, float *intensity_real_z, const int16_t num_frequency_bands, int16_t *azimuth, int16_t *elevation ); - -static void ivas_masa_init_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type_detect ); - -static void ivas_masa_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type_detect ); - -static void ivas_lfe_synth_with_cldfb( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t slot_index, const int16_t subframe_index, const int16_t nchan_transport ); - -static void rotateAziEle_DirAC( int16_t *azi, int16_t *ele, const int16_t band1, const int16_t band2, const float *p_Rmat ); - - -/*------------------------------------------------------------------------- - * ivas_dirac_allocate_parameters() - * - * Allocate and initialize DirAC parameters - *-------------------------------------------------------------------------*/ - -ivas_error ivas_dirac_allocate_parameters( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ - const int16_t params_flag /* i : set of parameters flag */ -) -{ - int16_t i; - - if ( params_flag == 1 ) - { - if ( ( rend_common_data->azimuth = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->elevation = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->diffuseness_vector = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->energy_ratio1 = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->spreadCoherence = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->surroundingCoherence = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - for ( i = 0; i < rend_common_data->dirac_md_buffer_length; i++ ) - { - if ( ( rend_common_data->azimuth[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( rend_common_data->azimuth[i], 0, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->elevation[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( rend_common_data->elevation[i], 0, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->diffuseness_vector[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( rend_common_data->diffuseness_vector[i], 1.0f, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->energy_ratio1[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( rend_common_data->energy_ratio1[i], 0.0f, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->spreadCoherence[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( rend_common_data->spreadCoherence[i], 0.0f, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->surroundingCoherence[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( rend_common_data->surroundingCoherence[i], 0.0f, rend_common_data->num_freq_bands ); - } - } - else if ( params_flag == 2 ) - { - if ( ( rend_common_data->azimuth2 = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->elevation2 = (int16_t **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->energy_ratio2 = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( rend_common_data->spreadCoherence2 = (float **) malloc( rend_common_data->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - for ( i = 0; i < rend_common_data->dirac_md_buffer_length; i++ ) - { - if ( ( rend_common_data->azimuth2[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( rend_common_data->azimuth2[i], 0, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->elevation2[i] = (int16_t *) malloc( rend_common_data->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( rend_common_data->elevation2[i], 0, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->energy_ratio2[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( rend_common_data->energy_ratio2[i], 0.0f, rend_common_data->num_freq_bands ); - - if ( ( rend_common_data->spreadCoherence2[i] = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( rend_common_data->spreadCoherence2[i], 0.0f, rend_common_data->num_freq_bands ); - } - } - - return IVAS_ERR_OK; -} - static ivas_error ivas_dirac_dec_config_internal( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ @@ -268,7 +102,7 @@ static ivas_error ivas_dirac_dec_config_internal( if ( flag_config == DIRAC_OPEN ) { - hDirAC->spar_to_dirac_write_idx = 0; + hDirAC->spar_to_dirac_write_idx = st_ivas->ivas_format == SBA_FORMAT ? DELAY_DIRAC_PARAM_DEC_SFR : 0; hDirAC->dithering_seed = DIRAC_DITH_SEED; st_ivas->hDirAC = hDirAC; } @@ -299,7 +133,7 @@ static ivas_error ivas_dirac_rend_config( int16_t hodirac_flag; DIRAC_CONFIG_FLAG flag_config; DIRAC_REND_HANDLE hDirACRend; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; error = IVAS_ERR_OK; @@ -310,7 +144,7 @@ static ivas_error ivas_dirac_rend_config( hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); hDirAC = st_ivas->hDirAC; - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; if ( flag_config == DIRAC_RECONFIGURE ) { @@ -424,13 +258,13 @@ static ivas_error ivas_dirac_rend_config( if ( flag_config == DIRAC_OPEN ) { - if ( ( hDirACRend->frequency_axis = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirACRend->frequency_axis, 0.0f, rend_common_data->num_freq_bands ); + set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); - ivas_dirac_dec_get_frequency_axis( hDirACRend->frequency_axis, output_Fs, rend_common_data->num_freq_bands ); + ivas_dirac_dec_get_frequency_axis( hDirACRend->frequency_axis, output_Fs, hSpatParamRendCom->num_freq_bands ); } if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) @@ -766,7 +600,7 @@ static ivas_error ivas_dirac_rend_config( { if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), - rend_common_data->num_freq_bands, + hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, hDirACRend->synthesisConf, @@ -788,7 +622,7 @@ static ivas_error ivas_dirac_rend_config( /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), rend_common_data->num_freq_bands, hDirACRend->num_outputs_diff, + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -799,7 +633,7 @@ static ivas_error ivas_dirac_rend_config( /* output synthesis */ if ( flag_config == DIRAC_OPEN ) { - if ( ( ivas_dirac_dec_output_synthesis_open( rend_common_data, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( hSpatParamRendCom, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -809,7 +643,7 @@ static ivas_error ivas_dirac_rend_config( { ivas_dirac_dec_output_synthesis_close( hDirACRend ); - if ( ( ivas_dirac_dec_output_synthesis_open( rend_common_data, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( hSpatParamRendCom, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -837,7 +671,7 @@ static ivas_error ivas_dirac_rend_config( { if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_frame_f == NULL ) ) { - if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * rend_common_data->num_freq_bands ) ) == NULL ) + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -846,7 +680,7 @@ static ivas_error ivas_dirac_rend_config( { proto_frame_f_old = hDirACRend->proto_frame_f; free( proto_frame_f_old ); - if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * rend_common_data->num_freq_bands ) ) == NULL ) + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -903,14 +737,14 @@ static ivas_error ivas_dirac_rend_config( } /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( rend_common_data, hDirACRend, nchan_out_woLFE, hodirac_flag ); + ivas_dirac_dec_output_synthesis_init( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, hodirac_flag ); /* Allocate stack memory */ if ( flag_config != DIRAC_OPEN ) { ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); } - if ( ( error = ivas_dirac_alloc_mem( hDirACRend, st_ivas->renderer_type, rend_common_data->num_freq_bands, &( hDirACRend->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_alloc_mem( hDirACRend, st_ivas->renderer_type, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -923,145 +757,6 @@ static ivas_error ivas_dirac_rend_config( return error; } -static ivas_error ivas_spat_rend_common_data_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ -) -{ - DIRAC_DEC_HANDLE hDirAC; - int32_t ivas_total_brate; - int32_t output_Fs; - ivas_error error; - int16_t hodirac_flag; - int16_t map_idx; - DIRAC_CONFIG_FLAG flag_config; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; - - flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; - error = IVAS_ERR_OK; - - rend_common_data = NULL; - hDirAC = st_ivas->hDirAC; - output_Fs = st_ivas->hDecoderConfig->output_Fs; - ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); - - if ( flag_config == DIRAC_RECONFIGURE ) - { - rend_common_data = st_ivas->rend_common_data; - } - else if ( flag_config == DIRAC_OPEN ) - { - /*-----------------------------------------------------------------* - * prepare library opening - *-----------------------------------------------------------------*/ - - if ( ( rend_common_data = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC meta\n" ) ); - } - - st_ivas->rend_common_data = rend_common_data; - } - - - if ( flag_config == DIRAC_OPEN ) - { - rend_common_data->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); - set_s( rend_common_data->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( rend_common_data->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - rend_common_data->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - rend_common_data->subframes_rendered = 0; - rend_common_data->slots_rendered = 0; - rend_common_data->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - rend_common_data->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); - } - - /*-----------------------------------------------------------------* - * set input parameters - *-----------------------------------------------------------------*/ - - if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE ) - { - if ( hodirac_flag && rend_common_data->azimuth2 == NULL ) - { - if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 2 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( !hodirac_flag && rend_common_data->azimuth2 != NULL ) - { - ivas_dirac_deallocate_parameters( rend_common_data, 2 ); - } - } - - if ( flag_config == DIRAC_OPEN ) - { - rend_common_data->dirac_md_buffer_length = 0; - rend_common_data->dirac_bs_md_write_idx = 0; - rend_common_data->dirac_read_idx = 0; - if ( st_ivas->mc_mode == MC_MODE_MCMASA ) - { - rend_common_data->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - - set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) - { - rend_common_data->render_to_md_map[map_idx] = map_idx; - } - } - else if ( st_ivas->ivas_format == MASA_FORMAT ) - { - rend_common_data->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; - rend_common_data->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; - - set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) - { - rend_common_data->render_to_md_map[map_idx] = map_idx; - } - } - else - { - int16_t num_slots_in_subfr; - num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; - rend_common_data->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); - rend_common_data->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - rend_common_data->dirac_read_idx = 0; - - set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS * num_slots_in_subfr; map_idx++ ) - { - rend_common_data->render_to_md_map[map_idx] = rend_common_data->dirac_read_idx + map_idx / num_slots_in_subfr; - } - } - - if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && hodirac_flag ) ) - { - if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 2 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - rend_common_data->azimuth2 = NULL; - rend_common_data->elevation2 = NULL; - rend_common_data->energy_ratio2 = NULL; - rend_common_data->spreadCoherence2 = NULL; - } - } - - return error; -} - /*------------------------------------------------------------------------- * ivas_dirac_dec_config() @@ -1075,9 +770,8 @@ ivas_error ivas_dirac_dec_config( ) { ivas_error error; + int32_t output_Fs; int16_t hodirac_flag; - // int32_t output_Fs; - int32_t ivas_total_brate; int16_t sparfoa_flag; DIRAC_CONFIG_FLAG dec_config_flag; DIRAC_CONFIG_FLAG rend_config_flag; @@ -1085,15 +779,15 @@ ivas_error ivas_dirac_dec_config( int16_t need_dirac_rend; int16_t need_parambin; int16_t dec_param_estim_old; + int16_t dec_param_estim_new; error = IVAS_ERR_OK; /* Solve and setup flags for inits */ dec_config_flag = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; - // output_Fs = st_ivas->hDecoderConfig->output_Fs; - ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE; @@ -1114,6 +808,7 @@ ivas_error ivas_dirac_dec_config( st_ivas->hDirAC->hConfig->dec_param_estim = FALSE; } + dec_param_estim_new = st_ivas->hDirAC->hConfig->dec_param_estim; /* Setup renderers and meta */ /* First, free everything if in reconfig and not the active renderer */ @@ -1155,8 +850,9 @@ ivas_error ivas_dirac_dec_config( if ( !sparfoa_flag ) { - common_rend_config_flag = st_ivas->rend_common_data == NULL ? DIRAC_OPEN : flag_config_inp; - if ( ( error = ivas_spat_rend_common_data_config( st_ivas, common_rend_config_flag ) ) != IVAS_ERR_OK ) + common_rend_config_flag = st_ivas->hSpatParamRendCom == NULL ? DIRAC_OPEN : flag_config_inp; + if ( ( error = ivas_spat_hSpatParamRendCom_config( &st_ivas->hSpatParamRendCom, common_rend_config_flag, dec_param_estim_new, + st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -1205,10 +901,10 @@ ivas_error ivas_dirac_dec_config( if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) { float frequency_axis[CLDFB_NO_CHANNELS_MAX]; - ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->rend_common_data->num_freq_bands ); + ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), - st_ivas->rend_common_data->num_freq_bands, + st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, DIRAC_SYNTHESIS_PSD_LS, @@ -1247,7 +943,7 @@ ivas_error ivas_dirac_dec_config( { nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, st_ivas->rend_common_data->slot_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, st_ivas->hSpatParamRendCom->slot_size ) ) != IVAS_ERR_OK ) { return error; } @@ -1290,561 +986,630 @@ void ivas_dirac_dec_close( return; } -void ivas_spat_rend_common_data_close( - SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out ) -{ - if ( rend_common_data_out == NULL || *rend_common_data_out == NULL ) - { - return; - } - - ivas_dirac_deallocate_parameters( *rend_common_data_out, 1 ); - ivas_dirac_deallocate_parameters( *rend_common_data_out, 2 ); - - free( *rend_common_data_out ); - *rend_common_data_out = NULL; - return; -} +/*------------------------------------------------------------------------- + * ivas_dirac_dec_read_BS() + * + * Read DirAC parameters from the bitstream + *------------------------------------------------------------------------*/ -void ivas_dirac_rend_close( - DIRAC_REND_HANDLE *hDirACRend_out ) +void ivas_dirac_dec_read_BS( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ +) { - int16_t i, j; - DIRAC_REND_HANDLE hDirACRend; - - if ( hDirACRend_out == NULL || *hDirACRend_out == NULL ) + int16_t i, j, b, dir, orig_dirac_bands; + int16_t next_bit_pos_orig; + *nb_bits = 0; + if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) { - return; - } - - hDirACRend = *hDirACRend_out; - - /* close Output synthesis sub-module */ - ivas_dirac_dec_output_synthesis_close( hDirACRend ); + next_bit_pos_orig = st->next_bit_pos; + st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); - /* close Decorrelator sub-module */ - if ( hDirACRend->proto_signal_decorr_on ) - { - ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); - } + /* 1 bit flag for signaling metadata to read */ + b = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits )++; - /* Params */ + if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ + { + orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - /* free frequency axis buffer */ - if ( hDirACRend->frequency_axis != NULL ) - { - free( hDirACRend->frequency_axis ); - hDirACRend->frequency_axis = NULL; - } + hQMetaData->sba_inactive_mode = 1; - if ( hDirACRend->diffuse_response_function != NULL ) - { - free( hDirACRend->diffuse_response_function ); - hDirACRend->diffuse_response_function = NULL; - } + /* if we start with a SID frame, we need to init the azi/ele arrays.*/ + if ( st->ini_frame == 0 ) + { + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + } - if ( hDirACRend->hoa_encoder != NULL ) - { - free( hDirACRend->hoa_encoder ); - hDirACRend->hoa_encoder = NULL; - } + *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; + } + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) + { + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; + } + } - /* prototype indexing */ - if ( hDirACRend->proto_index_dir != NULL ) - { - free( hDirACRend->proto_index_dir ); - hDirACRend->proto_index_dir = NULL; - } + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; + } + else + { + hQMetaData->sba_inactive_mode = 0; + hQMetaData->is_masa_ivas_format = 0; + if ( hQMetaData->useLowerRes ) + { + hQMetaData->q_direction[0].cfg.nblocks = 1; + } + else + { + hQMetaData->q_direction[0].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; + } - if ( hDirACRend->proto_index_diff != NULL ) - { - free( hDirACRend->proto_index_diff ); - hDirACRend->proto_index_dir = NULL; - } + *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), hodirac_flag ); + } - /* States */ +#ifdef DEBUGGING + assert( *nb_bits >= 0 ); +#endif - /* free prototype signal buffers */ - if ( hDirACRend->proto_frame_f != NULL ) - { - free( hDirACRend->proto_frame_f ); - hDirACRend->proto_frame_f = NULL; + st->next_bit_pos = next_bit_pos_orig; } - - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + else if ( !st->bfi && ivas_total_brate == IVAS_SID_5k2 ) { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + next_bit_pos_orig = st->next_bit_pos; + + /* subtract mode signaling bits, since bitstream was moved after mode reading */ + st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); + + /* 1 bit flag for SPAR/DirAC, already read in read format function */ + b = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits )++; + hQMetaData->sba_inactive_mode = 1; + orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; + + /* if we start with a SID frame, we need to init the azi/ele arrays.*/ + if ( st->ini_frame == 0 ) { - if ( hDirACRend->buffer_intensity_real[i][j] != NULL ) + for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) { - free( hDirACRend->buffer_intensity_real[i][j] ); - hDirACRend->buffer_intensity_real[i][j] = NULL; + for ( b = 0; b < hQMetaData->q_direction[dir].cfg.nbands; b++ ) + { + set_zero( hQMetaData->q_direction[dir].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[dir].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); + } } } - } - if ( hDirACRend->buffer_energy != NULL ) - { - free( hDirACRend->buffer_energy ); - hDirACRend->buffer_energy = NULL; + + *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; + } + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) + { + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; + } + } + + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; + + st->next_bit_pos = next_bit_pos_orig; } - if ( hDirACRend->masa_stereo_type_detect != NULL ) + if ( hDirAC != NULL && hSpatParamRendCom != NULL ) { - free( hDirACRend->masa_stereo_type_detect ); - hDirACRend->masa_stereo_type_detect = NULL; + ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, hSpatParamRendCom, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); } - ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); - - free( *hDirACRend_out ); - *hDirACRend_out = NULL; - return; } -/*------------------------------------------------------------------------- - * ivas_dirac_deallocate_parameters() +/*-----------------------------------------------------------------------* + * ivas_qmetadata_to_dirac() * - * Deallocate DirAC parameters - *-------------------------------------------------------------------------*/ + * Copy qmetedata to DirAC parameters for rendering + *-----------------------------------------------------------------------*/ -void ivas_dirac_deallocate_parameters( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common data for spatial parametric rendering */ - const int16_t params_flag /* i : set of parameters flag */ +void ivas_qmetadata_to_dirac( + const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ + MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { - int16_t i; - int16_t md_buffer_length; - - if ( rend_common_data == NULL ) - { - return; - } + int16_t block, band; + int16_t *seed_ptr; + int16_t band_start, band_end, diff_idx; + float diffuseness; + int16_t b, ele, azi; + float azimuth, elevation; + IVAS_QDIRECTION *q_direction; + int16_t *band_mapping; + int16_t *band_grouping; + int16_t start_band; + int16_t nbands = 0; + int16_t nblocks = 0; + int16_t qBand_idx; + int16_t idx_sec = 0; + int16_t no_secs = 1; - md_buffer_length = rend_common_data->dirac_md_buffer_length; + q_direction = &( hQMetaData->q_direction[0] ); + hSpatParamRendCom->numSimultaneousDirections = hQMetaData->no_directions; - if ( params_flag == 1 ) + if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { - if ( rend_common_data->azimuth != NULL ) + int16_t meta_write_index; + band_mapping = hMasa->data.band_mapping; + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - for ( i = 0; i < md_buffer_length; i++ ) + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + block ) % hSpatParamRendCom->dirac_md_buffer_length; + + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { - if ( rend_common_data->azimuth[i] != NULL ) + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { - free( rend_common_data->azimuth[i] ); - rend_common_data->azimuth[i] = NULL; - } - } + hSpatParamRendCom->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hSpatParamRendCom->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hSpatParamRendCom->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; - free( rend_common_data->azimuth ); - rend_common_data->azimuth = NULL; - } + if ( q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->spreadCoherence[meta_write_index][b] = 0.0f; + } - if ( rend_common_data->elevation != NULL ) - { - for ( i = 0; i < md_buffer_length; i++ ) - { - if ( rend_common_data->elevation[i] != NULL ) - { - free( rend_common_data->elevation[i] ); - rend_common_data->elevation[i] = NULL; + if ( hQMetaData->surcoh_band_data != NULL ) + { + hSpatParamRendCom->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->surroundingCoherence[meta_write_index][b] = 0.0f; + } } } - - free( rend_common_data->elevation ); - rend_common_data->elevation = NULL; } - if ( rend_common_data->energy_ratio1 != NULL ) + if ( hQMetaData->no_directions == 2 ) { - for ( i = 0; i < md_buffer_length; i++ ) + q_direction = &( hQMetaData->q_direction[1] ); + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - if ( rend_common_data->energy_ratio1[i] != NULL ) + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + block ) % hSpatParamRendCom->dirac_md_buffer_length; + + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { - free( rend_common_data->energy_ratio1[i] ); - rend_common_data->energy_ratio1[i] = NULL; + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { + hSpatParamRendCom->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hSpatParamRendCom->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hSpatParamRendCom->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; + + if ( q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->spreadCoherence2[meta_write_index][b] = 0.0f; + } + } } } - free( rend_common_data->energy_ratio1 ); - rend_common_data->energy_ratio1 = NULL; } - - if ( rend_common_data->diffuseness_vector != NULL ) + else if ( hSpatParamRendCom->azimuth2 != NULL && hSpatParamRendCom->elevation2 != NULL && hSpatParamRendCom->energy_ratio2 != NULL && hSpatParamRendCom->spreadCoherence2 != NULL ) { - for ( i = 0; i < md_buffer_length; i++ ) + /* zero out old dir2 data */ + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - if ( rend_common_data->diffuseness_vector[i] != NULL ) - { - free( rend_common_data->diffuseness_vector[i] ); - rend_common_data->diffuseness_vector[i] = NULL; - } + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + block ) % hSpatParamRendCom->dirac_md_buffer_length; + set_s( hSpatParamRendCom->azimuth2[meta_write_index], 0, hSpatParamRendCom->num_freq_bands ); + set_s( hSpatParamRendCom->elevation2[meta_write_index], 0, hSpatParamRendCom->num_freq_bands ); + set_zero( hSpatParamRendCom->energy_ratio2[meta_write_index], hSpatParamRendCom->num_freq_bands ); + set_zero( hSpatParamRendCom->spreadCoherence2[meta_write_index], hSpatParamRendCom->num_freq_bands ); } - - free( rend_common_data->diffuseness_vector ); - rend_common_data->diffuseness_vector = NULL; } + } + else /* SBA mode/SID/Zero frame*/ + { + int16_t tmp_write_idx_param_band; + int16_t tmp_write_idx_band; + float diffuseness_sec = 0.f; + + /* ungroup */ + seed_ptr = &hDirAC->dithering_seed; + nblocks = q_direction->cfg.nblocks; + nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; + band_grouping = hDirAC->band_grouping; - if ( rend_common_data->spreadCoherence != NULL ) + if ( ivas_total_brate <= IVAS_SID_5k2 && ivas_format != SBA_FORMAT ) { - for ( i = 0; i < md_buffer_length; i++ ) - { - if ( rend_common_data->spreadCoherence[i] != NULL ) - { - free( rend_common_data->spreadCoherence[i] ); - rend_common_data->spreadCoherence[i] = NULL; - } - } - free( rend_common_data->spreadCoherence ); - rend_common_data->spreadCoherence = NULL; + /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ + start_band = 0; + hDirAC->hConfig->nbands = 5; + ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, NULL, 0, 0, NULL ); + nbands = 5; } - - if ( rend_common_data->surroundingCoherence != NULL ) + else { - for ( i = 0; i < md_buffer_length; i++ ) + start_band = hDirAC->hConfig->enc_param_start_band; + if ( ivas_format == SBA_FORMAT ) { - if ( rend_common_data->surroundingCoherence[i] != NULL ) - { - free( rend_common_data->surroundingCoherence[i] ); - rend_common_data->surroundingCoherence[i] = NULL; - } + hDirAC->hConfig->nbands = IVAS_MAX_NUM_BANDS; } - free( rend_common_data->surroundingCoherence ); - rend_common_data->surroundingCoherence = NULL; - } - } - else if ( params_flag == 2 ) - { - if ( rend_common_data->azimuth2 != NULL ) - { - for ( i = 0; i < md_buffer_length; i++ ) + else { - if ( rend_common_data->azimuth2[i] != NULL ) - { - free( rend_common_data->azimuth2[i] ); - rend_common_data->azimuth2[i] = NULL; - } + hDirAC->hConfig->nbands = q_direction->cfg.nbands; } - free( rend_common_data->azimuth2 ); - rend_common_data->azimuth2 = NULL; - } - if ( rend_common_data->elevation2 != NULL ) - { - for ( i = 0; i < md_buffer_length; i++ ) + ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft ); + + nbands = hDirAC->hConfig->nbands; + if ( hQMetaData->q_direction[0].cfg.nblocks == 0 ) { - if ( rend_common_data->elevation2[i] != NULL ) - { - free( rend_common_data->elevation2[i] ); - rend_common_data->elevation2[i] = NULL; - } + /* No transmission -> no copy from qmetadata buffers*/ + nbands = start_band; } - free( rend_common_data->elevation2 ); - rend_common_data->elevation2 = NULL; } - if ( rend_common_data->energy_ratio2 != NULL ) + /* Low-Bands with no spatial data transmitted, analysis at decoder side */ + for ( band = 0; band < start_band; band++ ) { - for ( i = 0; i < md_buffer_length; i++ ) + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + tmp_write_idx_param_band = hSpatParamRendCom->dirac_bs_md_write_idx; + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - if ( rend_common_data->energy_ratio2[i] != NULL ) + for ( b = band_start; b < band_end; b++ ) { - free( rend_common_data->energy_ratio2[i] ); - rend_common_data->energy_ratio2[i] = NULL; + tmp_write_idx_band = tmp_write_idx_param_band; + hSpatParamRendCom->spreadCoherence[block][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[block][b] = 0.0f; + + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } - free( rend_common_data->energy_ratio2 ); - rend_common_data->energy_ratio2 = NULL; } - if ( rend_common_data->spreadCoherence2 != NULL ) + /* Bands with spatial data transmitted */ + if ( hodirac_flag ) + { + no_secs = DIRAC_HO_NUMSECTORS; + } + + for ( idx_sec = 0; idx_sec < no_secs; idx_sec++ ) { - for ( i = 0; i < md_buffer_length; i++ ) + for ( band = start_band; band < nbands; band++ ) { - if ( rend_common_data->spreadCoherence2[i] != NULL ) + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + tmp_write_idx_param_band = hSpatParamRendCom->dirac_bs_md_write_idx; + + if ( ivas_format == SBA_FORMAT ) { - free( rend_common_data->spreadCoherence2[i] ); - rend_common_data->spreadCoherence2[i] = NULL; + qBand_idx = dirac_to_spar_md_bands[band] - start_band; } - } - free( rend_common_data->spreadCoherence2 ); - rend_common_data->spreadCoherence2 = NULL; - } - } + else + { + qBand_idx = band; + } + diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; +#ifdef DEBUG_MODE_DIRAC + dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); +#endif + diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; - return; -} + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + int16_t block_qmetadata; + block_qmetadata = min( block, nblocks - 1 ); + block_qmetadata = max( block_qmetadata, 0 ); -/*------------------------------------------------------------------------- - * ivas_dirac_alloc_mem() - * - * Allocate stack memory for DirAC renderer - *------------------------------------------------------------------------*/ + if ( q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) + { + q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; + } -static ivas_error ivas_dirac_alloc_mem( - DIRAC_REND_HANDLE hDirACRend, - const RENDERER_TYPE renderer_type, - const int16_t num_freq_bands, - DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, - const int16_t hodirac_flag ) -{ - int16_t num_freq_bands_diff, size; - int16_t size_ho; - int16_t size_pf; - int16_t num_outputs_dir, num_outputs_diff; - int16_t num_protos_dir; + if ( hMasa == NULL && hodirac_flag ) + { + azimuth = q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata]; + elevation = q_direction[idx_sec].band_data[qBand_idx].elevation[block_qmetadata]; + diffuseness = 1.f - q_direction[0].band_data[qBand_idx].energy_ratio[block_qmetadata]; + diffuseness_sec = q_direction[1].band_data[qBand_idx].energy_ratio[block_qmetadata]; + assert( diffuseness_sec < 1.0001f && diffuseness_sec > -0.0001f ); + } + else + { + azimuth = q_direction->band_data[qBand_idx].azimuth[block_qmetadata]; + elevation = q_direction->band_data[qBand_idx].elevation[block_qmetadata]; + } - num_protos_dir = hDirACRend->num_protos_dir; + for ( b = band_start; b < band_end; b++ ) + { + tmp_write_idx_band = tmp_write_idx_param_band; - num_freq_bands_diff = hDirACRend->h_output_synthesis_psd_params.max_band_decorr; + if ( hodirac_flag ) + { + azi = (int16_t) ( azimuth + 0.5f ); + ele = (int16_t) ( elevation + 0.5f ); + } + else + { + azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); + ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); + /* limit the elevation to [-90, 90] */ + ele = min( 90, ele ); + ele = max( -90, ele ); + } - num_outputs_dir = hDirACRend->num_outputs_dir; - num_outputs_diff = hDirACRend->num_outputs_diff; + if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + } - size = num_freq_bands * num_outputs_dir; - if ( hodirac_flag ) - { - size_ho = size * DIRAC_HO_NUMSECTORS; - size_pf = num_freq_bands * DIRAC_HO_NUMSECTORS; - } - else - { - size_ho = size; - size_pf = num_freq_bands; - } + if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; + } + else + { + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + } - /* PSD related buffers */ - hDirAC_mem->cy_auto_dir_smooth = NULL; - hDirAC_mem->proto_power_smooth = NULL; - hDirAC_mem->proto_power_diff_smooth = NULL; - hDirAC_mem->direct_responses_square = NULL; - hDirAC_mem->frame_dec_f = NULL; - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; - if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->proto_power_smooth, size ); + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; - if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->proto_power_diff_smooth, size ); + if ( hodirac_flag ) + { + if ( idx_sec == 0 ) + { + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi; + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use + } + else + { + assert( idx_sec == 1 ); + hSpatParamRendCom->elevation2[tmp_write_idx_band][b] = ele; + hSpatParamRendCom->azimuth2[tmp_write_idx_band][b] = azi; + hSpatParamRendCom->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; + } + } + else + { + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi; + } + } + tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; - if ( ( hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->direct_responses_square, size ); - if ( hDirACRend->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) + } /* for ( block =...) */ + } /* for ( band = ...) */ + } /* for ( idx_sec = ...)*/ + + /* Bands not transmitted -> zeroed*/ + for ( b = band_grouping[band]; b < hSpatParamRendCom->num_freq_bands; b++ ) { - if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) + tmp_write_idx_band = hSpatParamRendCom->dirac_bs_md_write_idx; + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + + hSpatParamRendCom->spreadCoherence[block][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[block][b] = 0.0f; + hSpatParamRendCom->energy_ratio1[block][b] = 0; + + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; - hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; - hDirACRend->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; - /* Target and smoothed nrg factors/gains */ - if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); + /* update buffer write index */ + hSpatParamRendCom->dirac_bs_md_write_idx = ( hSpatParamRendCom->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->cy_auto_diff_smooth, size ); - } - else - { - if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); - } - hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; - hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; + return; +} - /*Responses (gains/factors)*/ - if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->direct_responses, size ); +/*------------------------------------------------------------------------- + * ivas_dirac_dec_set_md_map() + * + * Set metadata index mapping for DirAC + *------------------------------------------------------------------------*/ - hDirACRend->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; +void ivas_dirac_dec_set_md_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nCldfbTs /* i : number of CLDFB time slots */ +) +{ + int16_t num_slots_in_subfr; + DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - /* Prototypes */ - hDirAC_mem->proto_direct_buffer_f = NULL; - hDirAC_mem->proto_diffuse_buffer_f = NULL; - if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; +#ifdef DEBUGGING + assert( hDirAC ); + assert( hSpatParamRendCom ); +#endif - if ( hDirACRend->proto_signal_decorr_on ) - { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) - { - if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } - else - { - if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } - } - } - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; + /* adapt subframes */ + hSpatParamRendCom->num_slots = nCldfbTs; + hSpatParamRendCom->slots_rendered = 0; + num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + hSpatParamRendCom->subframes_rendered = 0; - /* Gains/power factors*/ - hDirAC_mem->direct_power_factor = NULL; - hDirAC_mem->diffuse_power_factor = NULL; + ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hSpatParamRendCom->subframe_nbslots, &hSpatParamRendCom->nb_subframes ); - if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } + /* set mapping according to dirac_read_idx */ - hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - hDirAC_mem->reference_power = NULL; - hDirAC_mem->onset_filter = NULL; - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) +#ifdef FIX_470_MASA_JBM_EXT + if ( st_ivas->ivas_format == MASA_FORMAT ) { - if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - if ( hDirACRend->proto_signal_decorr_on ) - { - if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } - } + ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); + } + else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) +#else + if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) +#endif + { + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); } else { - if ( num_protos_dir > 2 ) - { - if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hSpatParamRendCom->dirac_read_idx, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); + } - if ( hDirACRend->proto_signal_decorr_on ) + if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) + { + float tmp; + int16_t sf_idx, slot_idx, slot_idx_abs; + + slot_idx_abs = 0; + for ( sf_idx = 0; sf_idx < hSpatParamRendCom->nb_subframes; sf_idx++ ) { - if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + tmp = 0.0f; + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[sf_idx]; slot_idx++ ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + tmp += (float) hSpatParamRendCom->render_to_md_map[slot_idx_abs]; + slot_idx_abs++; } + hSpatParamRendCom->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) hSpatParamRendCom->subframe_nbslots[sf_idx] ) + hSpatParamRendCom->dirac_read_idx ) % hSpatParamRendCom->dirac_md_buffer_length; } + + set_s( &hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - hSpatParamRendCom->nb_subframes ); } - return IVAS_ERR_OK; + return; } -static void ivas_dirac_free_mem( - DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) +/*------------------------------------------------------------------------- + * ivas_dirac_dec() + * + * DirAC decoding process + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ +) { - if ( hDirAC_mem->cy_auto_dir_smooth != NULL ) - { - free( hDirAC_mem->cy_auto_dir_smooth ); - } - if ( hDirAC_mem->proto_power_smooth != NULL ) - { - free( hDirAC_mem->proto_power_smooth ); - } - if ( hDirAC_mem->proto_power_diff_smooth != NULL ) - { - free( hDirAC_mem->proto_power_diff_smooth ); - } - if ( hDirAC_mem->direct_responses_square != NULL ) - { - free( hDirAC_mem->direct_responses_square ); - } - if ( hDirAC_mem->frame_dec_f != NULL ) - { - free( hDirAC_mem->frame_dec_f ); - } - if ( hDirAC_mem->cy_cross_dir_smooth != NULL ) - { - free( hDirAC_mem->cy_cross_dir_smooth ); - } - if ( hDirAC_mem->cy_auto_diff_smooth != NULL ) + int16_t subframe_idx; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + float cng_td_buffer[L_FRAME16k]; + int16_t nchan_out, n, n_samples_sf; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + + n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * hSpatParamRendCom->slot_size; + + for ( n = 0; n < nchan_out; n++ ) { - free( hDirAC_mem->cy_auto_diff_smooth ); + output_f_local[n] = &output_f[n][0]; } - if ( hDirAC_mem->direct_responses != NULL ) + + for ( n = 0; n < nchan_transport; n++ ) { - free( hDirAC_mem->direct_responses ); + st_ivas->hTcBuffer->tc[n] = output_f[n]; } - if ( hDirAC_mem->proto_direct_buffer_f != NULL ) + + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) { - free( hDirAC_mem->proto_direct_buffer_f ); + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; + generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); } - if ( hDirAC_mem->proto_diffuse_buffer_f != NULL ) + + ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); + + for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { - free( hDirAC_mem->proto_diffuse_buffer_f ); + ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + for ( n = 0; n < nchan_out; n++ ) + { + output_f_local[n] += n_samples_sf; + } } - if ( hDirAC_mem->direct_power_factor != NULL ) + + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - free( hDirAC_mem->direct_power_factor ); + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } - if ( hDirAC_mem->diffuse_power_factor != NULL ) + else { - free( hDirAC_mem->diffuse_power_factor ); + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } - if ( hDirAC_mem->reference_power != NULL ) + + for ( n = 0; n < nchan_transport; n++ ) { - free( hDirAC_mem->reference_power ); + st_ivas->hTcBuffer->tc[n] = NULL; } - if ( hDirAC_mem->onset_filter != NULL ) + + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) { - free( hDirAC_mem->onset_filter ); + st_ivas->hTcBuffer->tc[nchan_transport] = NULL; } return; @@ -1852,2631 +1617,852 @@ static void ivas_dirac_free_mem( /*------------------------------------------------------------------------- - * ivas_dirac_dec_read_BS() + * ivas_dirac_dec_render() * - * Read DirAC parameters from the bitstream + * DirAC decoding renderer process *------------------------------------------------------------------------*/ -void ivas_dirac_dec_read_BS( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - Decoder_State *st, /* i/o: decoder state structure */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ +void ivas_dirac_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + 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 */ ) { - int16_t i, j, b, dir, orig_dirac_bands; - int16_t next_bit_pos_orig; - *nb_bits = 0; - if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) - { - next_bit_pos_orig = st->next_bit_pos; - st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); - - /* 1 bit flag for signaling metadata to read */ - b = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits )++; - - if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ - { - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - - hQMetaData->sba_inactive_mode = 1; - - /* if we start with a SID frame, we need to init the azi/ele arrays.*/ - if ( st->ini_frame == 0 ) - { - for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; - } - else - { - hQMetaData->sba_inactive_mode = 0; - hQMetaData->is_masa_ivas_format = 0; - if ( hQMetaData->useLowerRes ) - { - hQMetaData->q_direction[0].cfg.nblocks = 1; - } - else - { - hQMetaData->q_direction[0].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; - } + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, n_samples_sf, ch, nchan_intern; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + float *output_f_local[MAX_OUTPUT_CHANNELS]; - *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), hodirac_flag ); - } + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; #ifdef DEBUGGING - assert( *nb_bits >= 0 ); + assert( hSpatParamRendCom ); #endif - - st->next_bit_pos = next_bit_pos_orig; - } - else if ( !st->bfi && ivas_total_brate == IVAS_SID_5k2 ) - { - next_bit_pos_orig = st->next_bit_pos; - - /* subtract mode signaling bits, since bitstream was moved after mode reading */ - st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); - - /* 1 bit flag for SPAR/DirAC, already read in read format function */ - b = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits )++; - hQMetaData->sba_inactive_mode = 1; - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - - /* if we start with a SID frame, we need to init the azi/ele arrays.*/ - if ( st->ini_frame == 0 ) - { - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) - { - for ( b = 0; b < hQMetaData->q_direction[dir].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[dir].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[dir].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - } - - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; - - st->next_bit_pos = next_bit_pos_orig; - } - - if ( hDirAC != NULL && rend_common_data != NULL ) - { - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, rend_common_data, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); - } - - return; -} - - -/*-----------------------------------------------------------------------* - * ivas_qmetadata_to_dirac() - * - * Copy qmetedata to DirAC parameters for rendering - *-----------------------------------------------------------------------*/ - -void ivas_qmetadata_to_dirac( - const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ - MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ -) -{ - int16_t block, band; - int16_t *seed_ptr; - int16_t band_start, band_end, diff_idx; - float diffuseness; - int16_t b, ele, azi; - float azimuth, elevation; - IVAS_QDIRECTION *q_direction; - int16_t *band_mapping; - int16_t *band_grouping; - int16_t start_band; - int16_t nbands = 0; - int16_t nblocks = 0; - int16_t qBand_idx; - int16_t idx_sec = 0; - int16_t no_secs = 1; - - q_direction = &( hQMetaData->q_direction[0] ); - rend_common_data->numSimultaneousDirections = hQMetaData->no_directions; - - if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) + for ( ch = 0; ch < nchan_intern; ch++ ) { - int16_t meta_write_index; - band_mapping = hMasa->data.band_mapping; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + block ) % rend_common_data->dirac_md_buffer_length; - - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) - { - rend_common_data->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - rend_common_data->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; - rend_common_data->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; - rend_common_data->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; - - if ( q_direction->coherence_band_data != NULL ) - { - rend_common_data->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; - } - else - { - rend_common_data->spreadCoherence[meta_write_index][b] = 0.0f; - } - - if ( hQMetaData->surcoh_band_data != NULL ) - { - rend_common_data->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; - } - else - { - rend_common_data->surroundingCoherence[meta_write_index][b] = 0.0f; - } - } - } - } - - if ( hQMetaData->no_directions == 2 ) - { - q_direction = &( hQMetaData->q_direction[1] ); - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + block ) % rend_common_data->dirac_md_buffer_length; - - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) - { - rend_common_data->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - rend_common_data->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; - rend_common_data->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; - rend_common_data->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; - - if ( q_direction->coherence_band_data != NULL ) - { - rend_common_data->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; - } - else - { - rend_common_data->spreadCoherence2[meta_write_index][b] = 0.0f; - } - } - } - } - } - else if ( rend_common_data->azimuth2 != NULL && rend_common_data->elevation2 != NULL && rend_common_data->energy_ratio2 != NULL && rend_common_data->spreadCoherence2 != NULL ) - { - /* zero out old dir2 data */ - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + block ) % rend_common_data->dirac_md_buffer_length; - set_s( rend_common_data->azimuth2[meta_write_index], 0, rend_common_data->num_freq_bands ); - set_s( rend_common_data->elevation2[meta_write_index], 0, rend_common_data->num_freq_bands ); - set_zero( rend_common_data->energy_ratio2[meta_write_index], rend_common_data->num_freq_bands ); - set_zero( rend_common_data->spreadCoherence2[meta_write_index], rend_common_data->num_freq_bands ); - } - } + output_f_local[ch] = output_f[ch]; } - else /* SBA mode/SID/Zero frame*/ - { - int16_t tmp_write_idx_param_band; - int16_t tmp_write_idx_band; - float diffuseness_sec = 0.f; - - /* ungroup */ - seed_ptr = &hDirAC->dithering_seed; - nblocks = q_direction->cfg.nblocks; - nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; - band_grouping = hDirAC->band_grouping; - - if ( ivas_total_brate <= IVAS_SID_5k2 && ivas_format != SBA_FORMAT ) - { - /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ - start_band = 0; - hDirAC->hConfig->nbands = 5; - ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, NULL, 0, 0, NULL ); - nbands = 5; - } - else - { - start_band = hDirAC->hConfig->enc_param_start_band; - if ( ivas_format == SBA_FORMAT ) - { - hDirAC->hConfig->nbands = IVAS_MAX_NUM_BANDS; - } - else - { - hDirAC->hConfig->nbands = q_direction->cfg.nbands; - } - - ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft ); - - nbands = hDirAC->hConfig->nbands; - if ( hQMetaData->q_direction[0].cfg.nblocks == 0 ) - { - /* No transmission -> no copy from qmetadata buffers*/ - nbands = start_band; - } - } - - /* Low-Bands with no spatial data transmitted, analysis at decoder side */ - for ( band = 0; band < start_band; band++ ) - { - band_start = band_grouping[band]; - band_end = band_grouping[band + 1]; - tmp_write_idx_param_band = rend_common_data->dirac_bs_md_write_idx; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - for ( b = band_start; b < band_end; b++ ) - { - tmp_write_idx_band = tmp_write_idx_param_band; - rend_common_data->spreadCoherence[block][b] = 0.0f; - rend_common_data->surroundingCoherence[block][b] = 0.0f; + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - rend_common_data->elevation[tmp_write_idx_band][b] = 0; - rend_common_data->azimuth[tmp_write_idx_band][b] = 0; - rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = 0.f; - - rend_common_data->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - rend_common_data->energy_ratio1[tmp_write_idx_band][b] = 0; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % rend_common_data->dirac_md_buffer_length; - } - } - } - - /* Bands with spatial data transmitted */ - if ( hodirac_flag ) - { - no_secs = DIRAC_HO_NUMSECTORS; - } - - for ( idx_sec = 0; idx_sec < no_secs; idx_sec++ ) - { - for ( band = start_band; band < nbands; band++ ) - { - band_start = band_grouping[band]; - band_end = band_grouping[band + 1]; - tmp_write_idx_param_band = rend_common_data->dirac_bs_md_write_idx; - - if ( ivas_format == SBA_FORMAT ) - { - qBand_idx = dirac_to_spar_md_bands[band] - start_band; - } - else - { - qBand_idx = band; - } - diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; -#ifdef DEBUG_MODE_DIRAC - dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); -#endif - diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - int16_t block_qmetadata; - - block_qmetadata = min( block, nblocks - 1 ); - block_qmetadata = max( block_qmetadata, 0 ); - - if ( q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) - { - q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; - } - - if ( hMasa == NULL && hodirac_flag ) - { - azimuth = q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata]; - elevation = q_direction[idx_sec].band_data[qBand_idx].elevation[block_qmetadata]; - diffuseness = 1.f - q_direction[0].band_data[qBand_idx].energy_ratio[block_qmetadata]; - diffuseness_sec = q_direction[1].band_data[qBand_idx].energy_ratio[block_qmetadata]; - assert( diffuseness_sec < 1.0001f && diffuseness_sec > -0.0001f ); - } - else - { - azimuth = q_direction->band_data[qBand_idx].azimuth[block_qmetadata]; - elevation = q_direction->band_data[qBand_idx].elevation[block_qmetadata]; - } - - for ( b = band_start; b < band_end; b++ ) - { - tmp_write_idx_band = tmp_write_idx_param_band; - - if ( hodirac_flag ) - { - azi = (int16_t) ( azimuth + 0.5f ); - ele = (int16_t) ( elevation + 0.5f ); - } - else - { - azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); - ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); - /* limit the elevation to [-90, 90] */ - ele = min( 90, ele ); - ele = max( -90, ele ); - } - - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) - { - rend_common_data->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; - } - else - { - rend_common_data->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - } - - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) - { - rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; - } - else - { - rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - } - - rend_common_data->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; - - rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; - - if ( hodirac_flag ) - { - if ( idx_sec == 0 ) - { - rend_common_data->elevation[tmp_write_idx_band][b] = ele; - rend_common_data->azimuth[tmp_write_idx_band][b] = azi; - rend_common_data->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use - } - else - { - assert( idx_sec == 1 ); - rend_common_data->elevation2[tmp_write_idx_band][b] = ele; - rend_common_data->azimuth2[tmp_write_idx_band][b] = azi; - rend_common_data->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; - } - } - else - { - rend_common_data->elevation[tmp_write_idx_band][b] = ele; - rend_common_data->azimuth[tmp_write_idx_band][b] = azi; - } - } - tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % rend_common_data->dirac_md_buffer_length; - - } /* for ( block =...) */ - } /* for ( band = ...) */ - } /* for ( idx_sec = ...)*/ - - /* Bands not transmitted -> zeroed*/ - for ( b = band_grouping[band]; b < rend_common_data->num_freq_bands; b++ ) - { - tmp_write_idx_band = rend_common_data->dirac_bs_md_write_idx; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - - rend_common_data->spreadCoherence[block][b] = 0.0f; - rend_common_data->surroundingCoherence[block][b] = 0.0f; - rend_common_data->energy_ratio1[block][b] = 0; - - rend_common_data->elevation[tmp_write_idx_band][b] = 0; - rend_common_data->azimuth[tmp_write_idx_band][b] = 0; - rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = 0.f; - rend_common_data->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - rend_common_data->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - rend_common_data->energy_ratio1[tmp_write_idx_band][b] = 0; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % rend_common_data->dirac_md_buffer_length; - } - } - } - - /* update buffer write index */ - rend_common_data->dirac_bs_md_write_idx = ( rend_common_data->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % rend_common_data->dirac_md_buffer_length; - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_set_md_map() - * - * Set metadata index mapping for DirAC - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_set_md_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nCldfbTs /* i : number of CLDFB time slots */ -) -{ - int16_t num_slots_in_subfr; - DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; - - hDirAC = st_ivas->hDirAC; - rend_common_data = st_ivas->rend_common_data; -#ifdef DEBUGGING - assert( hDirAC ); - assert( rend_common_data ); -#endif - - /* adapt subframes */ - rend_common_data->num_slots = nCldfbTs; - rend_common_data->slots_rendered = 0; - num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; - rend_common_data->subframes_rendered = 0; - - ivas_jbm_dec_get_adapted_subframes( nCldfbTs, rend_common_data->subframe_nbslots, &rend_common_data->nb_subframes ); - - /* set mapping according to dirac_read_idx */ - - set_s( rend_common_data->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - -#ifdef FIX_470_MASA_JBM_EXT - if ( st_ivas->ivas_format == MASA_FORMAT ) - { - ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, rend_common_data->dirac_md_buffer_length, rend_common_data->render_to_md_map ); - } - else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) -#else - if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) -#endif - { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, rend_common_data->dirac_md_buffer_length, rend_common_data->render_to_md_map ); - } - else - { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, rend_common_data->dirac_read_idx, rend_common_data->dirac_md_buffer_length, rend_common_data->render_to_md_map ); - } - - if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) - { - float tmp; - int16_t sf_idx, slot_idx, slot_idx_abs; - - slot_idx_abs = 0; - for ( sf_idx = 0; sf_idx < rend_common_data->nb_subframes; sf_idx++ ) - { - tmp = 0.0f; - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[sf_idx]; slot_idx++ ) - { - tmp += (float) rend_common_data->render_to_md_map[slot_idx_abs]; - slot_idx_abs++; - } - rend_common_data->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) rend_common_data->subframe_nbslots[sf_idx] ) + rend_common_data->dirac_read_idx ) % rend_common_data->dirac_md_buffer_length; - } - - set_s( &rend_common_data->render_to_md_map[rend_common_data->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - rend_common_data->nb_subframes ); - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec() - * - * DirAC decoding process - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport /* i : number of transport channels */ -) -{ - int16_t subframe_idx; - float *output_f_local[MAX_OUTPUT_CHANNELS]; - float cng_td_buffer[L_FRAME16k]; - int16_t nchan_out, n, n_samples_sf; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; - - rend_common_data = st_ivas->rend_common_data; - nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; - - n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * rend_common_data->slot_size; - - for ( n = 0; n < nchan_out; n++ ) - { - output_f_local[n] = &output_f[n][0]; - } - - for ( n = 0; n < nchan_transport; n++ ) - { - st_ivas->hTcBuffer->tc[n] = output_f[n]; - } - - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; - generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); - } - - ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); - for ( n = 0; n < nchan_out; n++ ) - { - output_f_local[n] += n_samples_sf; - } - } - - if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) - { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; - } - else - { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; - } - - for ( n = 0; n < nchan_transport; n++ ) - { - st_ivas->hTcBuffer->tc[n] = NULL; - } - - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) - { - st_ivas->hTcBuffer->tc[nchan_transport] = NULL; - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_render() - * - * DirAC decoding renderer process - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - 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 */ -) -{ - int16_t slots_to_render, first_sf, last_sf, subframe_idx; - uint16_t slot_size, n_samples_sf, ch, nchan_intern; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; - float *output_f_local[MAX_OUTPUT_CHANNELS]; - - rend_common_data = st_ivas->rend_common_data; - - nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; -#ifdef DEBUGGING - assert( rend_common_data ); -#endif - for ( ch = 0; ch < nchan_intern; ch++ ) - { - output_f_local[ch] = output_f[ch]; - } - slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - - /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( rend_common_data->num_slots - rend_common_data->slots_rendered, nSamplesAsked / slot_size ); - *nSamplesRendered = slots_to_render * slot_size; - first_sf = rend_common_data->subframes_rendered; - last_sf = first_sf; - - while ( slots_to_render > 0 ) - { - slots_to_render -= rend_common_data->subframe_nbslots[last_sf]; - last_sf++; - } - -#ifdef DEBUGGING - assert( slots_to_render == 0 ); -#endif - for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) - { - ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); - n_samples_sf = rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->slot_size; - for ( ch = 0; ch < nchan_intern; ch++ ) - { - output_f_local[ch] += n_samples_sf; - } - } - - if ( rend_common_data->slots_rendered == rend_common_data->num_slots ) - { - if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) - { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; - } - else - { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; - } - } - - *nSamplesAvailable = ( rend_common_data->num_slots - rend_common_data->slots_rendered ) * slot_size; - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec() - * - * DirAC decoding process - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_render_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport, /* i : number of transport channels */ - float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) -{ - int16_t i, ch, idx_in, idx_lfe; - DIRAC_DEC_HANDLE hDirAC; - DIRAC_REND_HANDLE hDirACRend; - float dirEne; - float surCohEner; - float surCohRatio[CLDFB_NO_CHANNELS_MAX]; - int16_t subframe_idx; - int16_t slot_idx, index_slot; - int16_t hodirac_flag; - float *p_Rmat; - int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; - - /*CLDFB: last output channels reserved to LFT for CICPx*/ - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - int16_t index, num_freq_bands; - - /* local copies of azi, ele, diffuseness */ - int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; - int16_t elevation[CLDFB_NO_CHANNELS_MAX]; - float diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; - - DIRAC_DEC_STACK_MEM DirAC_mem; - float *reference_power, *reference_power_smooth; - float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; - uint16_t coherence_flag; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; - - push_wmops( "ivas_dirac_dec_render" ); - - /* Initialize aux buffers */ - hDirAC = st_ivas->hDirAC; - hDirACRend = st_ivas->hDirACRend; - rend_common_data = st_ivas->rend_common_data; - - DirAC_mem = hDirACRend->stack_mem; - - reference_power = DirAC_mem.reference_power; - reference_power_smooth = DirAC_mem.reference_power + rend_common_data->num_freq_bands; - onset_filter = DirAC_mem.onset_filter; - onset_filter_subframe = DirAC_mem.onset_filter + rend_common_data->num_freq_bands; - - hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); - - if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) - { - coherence_flag = st_ivas->hQMetaData->coherence_flag; - } - else - { - coherence_flag = 0; - } - -#ifdef DEBUG_MODE_DIRAC - { - int16_t n, tmp[IVAS_SPAR_MAX_CH * L_FRAME48k]; - char file_name[50] = { 0 }; - const int16_t output_frame = st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - - for ( n = 0; n < nchan_transport; n++ ) - { - for ( i = 0; i < output_frame; i++ ) - { - tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); - } - } - sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); - dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); - } -#endif - - /* Subframe loop */ - slot_idx_start = rend_common_data->slots_rendered; - slot_idx_start_cldfb_synth = 0; - - subframe_idx = rend_common_data->subframes_rendered; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - md_idx = rend_common_data->render_to_md_map[subframe_idx]; - } - else - { - md_idx = rend_common_data->render_to_md_map[slot_idx_start]; - } - /* ToDo: Another workaround for self test BE */ - - /* copy parameters into local buffers*/ - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - mvs2s( rend_common_data->azimuth[rend_common_data->render_to_md_map[subframe_idx]], azimuth, rend_common_data->num_freq_bands ); - mvs2s( rend_common_data->elevation[rend_common_data->render_to_md_map[subframe_idx]], elevation, rend_common_data->num_freq_bands ); - mvr2r( rend_common_data->diffuseness_vector[rend_common_data->render_to_md_map[subframe_idx]], diffuseness_vector, rend_common_data->num_freq_bands ); - } - else - { - set_zero( diffuseness_vector, rend_common_data->num_freq_bands ); - } - - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - set_zero( reference_power_smooth, rend_common_data->num_freq_bands ); - } - else - { - set_zero( onset_filter_subframe, rend_common_data->num_freq_bands ); - } - - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) - { - p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[subframe_idx][0][0]; - - if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, rend_common_data->num_freq_bands, p_Rmat ); - } - } - } - else - { - p_Rmat = 0; - } - - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - /* compute response */ - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_power_factors( rend_common_data->num_freq_bands, - diffuseness_vector, - hDirACRend->h_output_synthesis_psd_params.max_band_decorr, - hDirACRend->h_output_synthesis_psd_state.direct_power_factor, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); - - if ( coherence_flag ) - { - for ( i = 0; i < rend_common_data->num_freq_bands; i++ ) - { - dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i]; - surCohEner = hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] * rend_common_data->surroundingCoherence[md_idx][i]; - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; - - surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); - } - } - else - { - set_zero( surCohRatio, rend_common_data->num_freq_bands ); - } - } - else - { - ivas_dirac_dec_compute_gain_factors( rend_common_data->num_freq_bands, - rend_common_data->diffuseness_vector[md_idx], - hDirACRend->h_output_synthesis_psd_params.max_band_decorr, - hDirACRend->h_output_synthesis_psd_state.direct_power_factor, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); - - if ( coherence_flag ) - { - for ( i = 0; i < rend_common_data->num_freq_bands; i++ ) - { - surCohRatio[i] = rend_common_data->surroundingCoherence[md_idx][i]; - } - } - else - { - set_zero( surCohRatio, rend_common_data->num_freq_bands ); - } - } - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) - { - ivas_dirac_dec_compute_directional_responses( rend_common_data, - hDirACRend, - st_ivas->hVBAPdata, - st_ivas->hMasa, - azimuth, - elevation, - md_idx, - surCohRatio, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat, - hodirac_flag ); - } - else - { - ivas_dirac_dec_compute_directional_responses( rend_common_data, - hDirACRend, - st_ivas->hVBAPdata, - st_ivas->hMasa, - azimuth, - elevation, - md_idx, - surCohRatio, - 0, - NULL, - hodirac_flag ); - } - } - - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = slot_idx_start + slot_idx; - if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - md_idx = rend_common_data->render_to_md_map[index_slot]; - } - else - { - md_idx = rend_common_data->render_to_md_map[subframe_idx]; - } - - if ( st_ivas->ivas_format == SBA_FORMAT ) - { - for ( ch = 0; ch < nchan_transport; ch++ ) - { - mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], rend_common_data->num_freq_bands ); - mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], rend_common_data->num_freq_bands ); - } - } - else - { - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][rend_common_data->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - rend_common_data->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); - } - } - - /* CNG in DirAC, extra CLDFB ana for CNA*/ - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - - generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], - st_ivas->hTcBuffer->tc[1], - Cldfb_RealBuffer[1][0], - Cldfb_ImagBuffer[1][0], - index_slot, - st->cna_dirac_flag && st->flag_cna, - ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); - } - - /* LFE synthesis */ - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled && !( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirACRend->hOutSetup.num_lfe == 0 ) ) - { - ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, - Cldfb_RealBuffer, Cldfb_ImagBuffer, - Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], - slot_idx, - md_idx, - nchan_transport ); - } - - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) - { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirACRend->num_outputs_diff, - rend_common_data->num_freq_bands, - p_Rmat ); - } - else - { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirACRend->num_outputs_diff, - rend_common_data->num_freq_bands, - 0 ); - } - } - else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) - { - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - 0, slot_idx, rend_common_data->num_freq_bands, hDirACRend->masa_stereo_type_detect ); - } - else - { - switch ( nchan_transport ) - { - case 11: - case 8: - case 6: - case 4: - protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, hDirACRend->num_outputs_diff, - rend_common_data->num_freq_bands, - hDirACRend->hoa_decoder, - nchan_transport, - hDirACRend->sba_map_tc ); - break; - case 2: - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - hDirACRend->hOutSetup.is_loudspeaker_setup, - slot_idx, - rend_common_data->num_freq_bands, - hDirACRend->masa_stereo_type_detect ); - break; - case 1: - protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, - hDirACRend->num_protos_diff, - rend_common_data->num_freq_bands ); - break; - default: - return; - } - } - - - /*-----------------------------------------------------------------* - * Compute DirAC parameters at decoder side - *-----------------------------------------------------------------*/ - - if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - mvs2s( &rend_common_data->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], rend_common_data->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - mvs2s( &rend_common_data->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], rend_common_data->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, rend_common_data->num_freq_bands, p_Rmat ); - } - - hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ - - index = hDirACRend->index_buffer_intensity; - - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - - computeIntensityVector_dec( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - num_freq_bands, - hDirACRend->buffer_intensity_real[0][index - 1], - hDirACRend->buffer_intensity_real[1][index - 1], - hDirACRend->buffer_intensity_real[2][index - 1] ); - - computeDirectionAngles( hDirACRend->buffer_intensity_real[0][index - 1], - hDirACRend->buffer_intensity_real[1][index - 1], - hDirACRend->buffer_intensity_real[2][index - 1], - num_freq_bands, - azimuth, - elevation ); - - mvr2r( reference_power, &( hDirACRend->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - - computeDiffuseness( hDirACRend->buffer_intensity_real, hDirACRend->buffer_energy, num_freq_bands, rend_common_data->diffuseness_vector[md_idx] ); - } - -#ifdef DEBUG_MODE_DIRAC - { - static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; - - - if ( fp_direction_vector == NULL ) - fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); - if ( fp_diffuseness == NULL ) - fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); - if ( fp_referencePower == NULL ) - fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); - - - for ( i = 0; i < rend_common_data->num_freq_bands; i++ ) - { - float radius_length; - float dv[3]; - - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); - dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); - dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - - fwrite( dv, sizeof( float ), 3, fp_direction_vector ); - fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; - } - fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); - } - else - { - radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); - dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); - dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); - dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); - - fwrite( dv, sizeof( float ), 3, fp_direction_vector ); - fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); - fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); - } - } - } -#endif - - /*-----------------------------------------------------------------* - * frequency domain decorrelation - *-----------------------------------------------------------------*/ - - if ( hDirACRend->proto_signal_decorr_on == 1 ) - { - /* decorrelate prototype frame */ - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_decorr_process( rend_common_data->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - nchan_transport, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->proto_index_diff, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff + 2 * rend_common_data->num_freq_bands * min( 4, nchan_transport ), - onset_filter, - hDirACRend->h_freq_domain_decorr_ap_params, - hDirACRend->h_freq_domain_decorr_ap_state ); - - v_multc( onset_filter, 0.25f, onset_filter, rend_common_data->num_freq_bands ); - v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, rend_common_data->num_freq_bands ); - p_onset_filter = onset_filter_subframe; - } - else - { - ivas_dirac_dec_decorr_process( rend_common_data->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - nchan_transport, - hDirACRend->proto_frame_f, - hDirACRend->num_protos_diff, - hDirACRend->proto_index_diff, - DirAC_mem.frame_dec_f, - onset_filter, - hDirACRend->h_freq_domain_decorr_ap_params, - hDirACRend->h_freq_domain_decorr_ap_state ); - - hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; - p_onset_filter = onset_filter; - } - } - else - { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - set_f( onset_filter_subframe, 1.f, rend_common_data->num_freq_bands ); - p_onset_filter = onset_filter_subframe; - } - else - { - /* no frequency domain decorrelation: use prototype frame */ - hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; - p_onset_filter = NULL; - } - } - - /*-----------------------------------------------------------------* - * output synthesis - *-----------------------------------------------------------------*/ - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) - { - /*Compute diffuse prototypes*/ - ivas_dirac_dec_compute_diffuse_proto( hDirACRend, rend_common_data->num_freq_bands, slot_idx ); - } - - /*Compute PSDs*/ - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth, - elevation, - rend_common_data->diffuseness_vector[md_idx], - hDirAC, - rend_common_data, - hDirACRend, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat, - st_ivas->hVBAPdata, - hDirACRend->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag ); - } - else - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth, - elevation, - rend_common_data->diffuseness_vector[md_idx], - hDirAC, - rend_common_data, - hDirACRend, - 0, - 0, - st_ivas->hVBAPdata, - hDirACRend->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag ); - } - - if ( hDirAC->hConfig->dec_param_estim ) - { - float fac = 1.0f / (float) rend_common_data->subframe_nbslots[subframe_idx]; - v_multc_acc( rend_common_data->diffuseness_vector[md_idx], fac, diffuseness_vector, rend_common_data->num_freq_bands ); - } - - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - v_add( reference_power, reference_power_smooth, reference_power_smooth, rend_common_data->num_freq_bands ); - } - } - - ivas_dirac_dec_output_synthesis_get_interpolator( &hDirACRend->h_output_synthesis_psd_params, rend_common_data->subframe_nbslots[subframe_idx] ); - - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hDirAC, - rend_common_data, - hDirACRend, - nchan_transport, - rend_common_data->subframe_nbslots[subframe_idx], - p_onset_filter, - diffuseness_vector, - hodirac_flag ); - } - else - { - /* Determine encoding quality based additional smoothing factor */ - float qualityBasedSmFactor = 1.0f; - - if ( st_ivas->hMasa != NULL ) - { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; - } - - - ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hDirAC, - rend_common_data, - hDirACRend, - rend_common_data->subframe_nbslots[subframe_idx], - diffuseness_vector, - reference_power_smooth, - qualityBasedSmFactor ); - } - - /*-----------------------------------------------------------------* - * CLDFB synthesis (and binaural rendering) - *-----------------------------------------------------------------*/ - - index_slot = slot_idx_start_cldfb_synth; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - /* Perform binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - subframe_idx, - rend_common_data->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - Cldfb_RealBuffer, - Cldfb_ImagBuffer ); - - /* Inverse CLDFB*/ - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - - for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; - } - - cldfbSynthesis( RealBuffer, - ImagBuffer, - &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), - rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], - st_ivas->cldfbSynDec[ch] ); - } - } - else if ( st_ivas->ivas_format == SBA_FORMAT ) - { - for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) - { - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], rend_common_data->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], rend_common_data->num_freq_bands ); - } - } - } - else - { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t outchannels; - - idx_in = 0; - idx_lfe = 0; - - outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; - if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || - ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) - { - outchannels++; - } - - if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) - { - float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - const int16_t subframe_start_sample = index_slot * rend_common_data->num_freq_bands; - const int16_t num_samples_subframe = rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx]; - - /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ - mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); - - for ( ch = 0; ch < outchannels; ch++ ) - { - if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - /* Move the LFE channel to the correct place */ - mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - - if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) - { - /* Move the separated channel to the correct place. Thus, the separated channel is - * combined with the synthesized channels here when there is a matching channel. */ - mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); - - if ( !st_ivas->hLsSetupCustom->separate_ch_found ) - { - /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel - * is combined with the synthesized channels here when there is no matching channel. */ - v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } - - idx_in++; - } - } - } - else - { - for ( ch = 0; ch < outchannels; ch++ ) - { - if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled ) - { - for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); - } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) - { - /* LFE has been synthesized in the time domain, do nothing. */ - } - else - { - set_zero( &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->num_freq_bands ); - } - - if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) - { - /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated - * channel is combined with the synthesized channels here. */ - } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * rend_common_data->num_freq_bands] ), rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); - idx_in++; - } - } - } - } - rend_common_data->slots_rendered += rend_common_data->subframe_nbslots[subframe_idx]; - rend_common_data->subframes_rendered++; - - pop_wmops(); - - return; -} - - -/*------------------------------------------------------------------------- - * compute_hoa_encoder_mtx() - * - * - *------------------------------------------------------------------------*/ - -void compute_hoa_encoder_mtx( - const float *azimuth, - const float *elevation, - float *response, - const int16_t num_responses, - const int16_t ambisonics_order ) -{ - int16_t k, num_sh; - - num_sh = ivas_sba_get_nchan( ambisonics_order, 0 ); - - for ( k = 0; k < num_responses; k++ ) - { - ivas_dirac_dec_get_response( (const int16_t) azimuth[k], (const int16_t) elevation[k], &response[k * num_sh], ambisonics_order ); - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_get_frequency_axis() - * - * DirAC decoding initialization - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_get_frequency_axis( - float *frequency_axis, - const int32_t output_Fs, - const int16_t num_freq_bands ) -{ - int16_t k; - float const_part; - - /* calc cldfb frequency axis */ - const_part = (float) output_Fs / ( 2.0f * (float) num_freq_bands ); - for ( k = 0; k < num_freq_bands; ++k ) - { - frequency_axis[k] = ( (float) k + 0.5f ) * const_part; - } - - return; -} - - -/*------------------------------------------------------------------------- - * Local functions - *-------------------------------------------------------------------------*/ - -static void initDiffuseResponses( - float *diffuse_response_function, - const int16_t num_channels, - AUDIO_CONFIG output_config, - IVAS_OUTPUT_SETUP hOutSetup, - const int16_t ambisonics_order, - const IVAS_FORMAT ivas_format, - int16_t *num_ele_spk_no_diffuse_rendering, - AUDIO_CONFIG transport_config ) -{ - int16_t i, l, k, idx, num_horizontal_speakers; - *num_ele_spk_no_diffuse_rendering = 0; - - if ( output_config == AUDIO_CONFIG_MONO ) - { - diffuse_response_function[0] = 1.0f; - diffuse_response_function[1] = inv_sqrt( 3.0f ); - } - else if ( !( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) ) - { - /* set diffuse response function */ - if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_5_1_4 ) - { - num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; - - mvr2r( diffuse_response_CICP6, diffuse_response_function, num_horizontal_speakers ); - set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); - *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; - } - else if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_7_1_4 ) - { - num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; - - set_f( diffuse_response_function, sqrtf( 1.f / ( (float) num_horizontal_speakers ) ), num_horizontal_speakers ); - set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); - *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; - } - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) - { - mvr2r( diffuse_response_CICP6, diffuse_response_function, num_channels ); - } - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) - { - mvr2r( diffuse_response_CICP14, diffuse_response_function, num_channels ); - } - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) - { - mvr2r( diffuse_response_CICP16, diffuse_response_function, num_channels ); - } - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) - { - if ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) - { - /* Detect loudspeakers with elevation */ - for ( i = 0, num_horizontal_speakers = 0; i < num_channels; i++ ) - { - if ( fabsf( hOutSetup.ls_elevation[i] ) <= 5.f ) - { - num_horizontal_speakers++; - diffuse_response_function[i] = 1.f; - } - else - { - *num_ele_spk_no_diffuse_rendering += 1; - diffuse_response_function[i] = 0.f; - } - } - /* Diffuse only to horizontal plane if enough loudspeakers */ - if ( num_horizontal_speakers > 2 ) - { - for ( i = 0; i < num_channels; i++ ) - { - diffuse_response_function[i] *= sqrtf( 1.f / (float) num_horizontal_speakers ); - } - } - else - { - *num_ele_spk_no_diffuse_rendering = 0; - set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); - } - } - else - { - set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); - } - } - else - { - set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); - } - } - else - { - idx = 0; - for ( l = 0; l <= ambisonics_order; l++ ) - { - for ( k = 0; k < ( 2 * l + 1 ); k++ ) - { - diffuse_response_function[idx++] = inv_sqrt( 2.0f * l + 1.0f ); - } - } - } - - return; -} - - -static void protoSignalComputation_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_direct_buffer_f, - float *proto_diffuse_buffer_f, - float *reference_power, - const int16_t slot_index, - const int16_t num_inputs, - const int16_t num_outputs_diff, - const int16_t num_freq_bands, - float *p_Rmat ) -{ - int16_t l, k; - float *p_proto_direct_buffer; - float *p_proto_diffuse_buffer; - int16_t Rmat_k[4]; - float W_real, W_imag; - float Y_real, Y_imag; - float *p_k[4]; - - k = 0; /* to avoid compilation warning */ - - p_proto_direct_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_inputs; - p_proto_diffuse_buffer = proto_diffuse_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = hSpatParamRendCom->subframes_rendered; + last_sf = first_sf; - if ( num_inputs == 1 ) + while ( slots_to_render > 0 ) { - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_direct_buffer[2 * l] = RealBuffer[0][0][l]; - p_proto_direct_buffer[2 * l + 1] = ImagBuffer[0][0][l]; - } + slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; + last_sf++; } - else if ( num_inputs == 2 ) - { - if ( p_Rmat != 0 ) - { - assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); - - for ( l = 0; l < num_freq_bands; l++ ) - { - W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - Y_real = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - Y_imag = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - - p_proto_direct_buffer[2 * l] = W_real; - p_proto_direct_buffer[2 * l + 1] = W_imag; - p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = p_Rmat[0] * Y_real; - p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = p_Rmat[0] * Y_imag; - } - } - else +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + n_samples_sf = hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->slot_size; + for ( ch = 0; ch < nchan_intern; ch++ ) { - for ( l = 0; l < num_freq_bands; l++ ) - { - W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - p_proto_direct_buffer[2 * l] = W_real; - p_proto_direct_buffer[2 * l + 1] = W_imag; - { - p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - } - } + output_f_local[ch] += n_samples_sf; } } - else if ( num_inputs >= 4 ) + + if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { - p_k[0] = p_proto_direct_buffer; - p_k[1] = p_proto_direct_buffer + 2 * num_freq_bands; - p_k[2] = p_proto_direct_buffer + 4 * num_freq_bands; - p_k[3] = p_proto_direct_buffer + 6 * num_freq_bands; - Rmat_k[0] = 0; - Rmat_k[1] = 1; - Rmat_k[2] = 2; - Rmat_k[3] = 0; - - if ( p_Rmat != 0 ) + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); - - for ( l = 0; l < num_freq_bands; l++ ) - { - *( p_k[0] ) = RealBuffer[0][0][l]; - reference_power[l + num_freq_bands] = *( p_k[0] ) * *( p_k[0] ); - p_k[0]++; - *( p_k[0] ) = ImagBuffer[0][0][l]; - reference_power[l + num_freq_bands] += *( p_k[0] ) * *( p_k[0] ); - p_k[0]++; - reference_power[l] = 0.5f * reference_power[l + num_freq_bands]; - - for ( k = 1; k < 4; k++ ) - { - *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * RealBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * RealBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * RealBuffer[3][0][l]; - reference_power[l + ( k + 1 ) * num_freq_bands] = *( p_k[k] ) * *( p_k[k] ); - p_k[k]++; - *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * ImagBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * ImagBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * ImagBuffer[3][0][l]; - reference_power[l + ( k + 1 ) * num_freq_bands] += *( p_k[k] ) * *( p_k[k] ); - p_k[k]++; - reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); - } - - for ( k = 1; k < 4; k++ ) - { - RealBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l]; - ImagBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1]; - } - } + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - set_zero( reference_power, num_freq_bands ); - for ( k = 0; k < 4; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; - reference_power[l + ( k + 1 ) * num_freq_bands] = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; - reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); - } - } - } - - /* Additional transport channels = planar SBA components of degree higher than 1*/ - for ( ; k < num_inputs; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; - } + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } } - - /*Copy direct to diffuse proto*/ - mvr2r( p_proto_direct_buffer, p_proto_diffuse_buffer, 2 * num_freq_bands * min( num_outputs_diff, num_inputs ) ); - - if ( num_inputs == 1 ) - { - /* Add comfort noise addition (CNA) to diffuse proto only*/ - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_diffuse_buffer[2 * l] += RealBuffer[1][0][l]; - p_proto_diffuse_buffer[2 * l + 1] += ImagBuffer[1][0][l]; - } - } + *nSamplesAvailable = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered ) * slot_size; return; } -static void protoSignalComputation1( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_frame_f, - float *proto_direct_buffer_f, - float *reference_power, - float *proto_power_smooth, - const int16_t slot_index, - const int16_t num_outputs_diff, - const int16_t num_freq_bands ) -{ - int16_t l, k; - float *p_proto_buffer; - - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands; - - for ( l = 0; l < num_freq_bands; l++ ) - { - reference_power[l] = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - proto_power_smooth[l] += reference_power[l]; - p_proto_buffer[2 * l] = RealBuffer[0][0][l]; - p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; - - for ( k = 0; k < num_outputs_diff; k++ ) - { - proto_frame_f[2 * k * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * k * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - } - } +/*------------------------------------------------------------------------- + * ivas_dirac_dec() + * + * DirAC decoding process + *------------------------------------------------------------------------*/ - return; -} +void ivas_dirac_dec_render_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport, /* i : number of transport channels */ + float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], + float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) +{ + int16_t i, ch, idx_in, idx_lfe; + DIRAC_DEC_HANDLE hDirAC; + DIRAC_REND_HANDLE hDirACRend; + float dirEne; + float surCohEner; + float surCohRatio[CLDFB_NO_CHANNELS_MAX]; + int16_t subframe_idx; + int16_t slot_idx, index_slot; + int16_t hodirac_flag; + float *p_Rmat; + int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; + /*CLDFB: last output channels reserved to LFT for CICPx*/ + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + int16_t index, num_freq_bands; -static void protoSignalComputation2( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_frame_f, - float *proto_direct_buffer_f, - float *reference_power, - float *proto_power_smooth, - const int16_t isloudspeaker, - const int16_t slot_index, - const int16_t num_freq_bands, - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -{ - int16_t l; - float *p_proto_buffer; - float Real_aux, Imag_aux; + /* local copies of azi, ele, diffuseness */ + int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; + int16_t elevation[CLDFB_NO_CHANNELS_MAX]; + float diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; - float left_bb_power, right_bb_power, total_bb_power, lr_bb_power; - float lr_total_bb_ratio; - float a, b; + DIRAC_DEC_STACK_MEM DirAC_mem; + float *reference_power, *reference_power_smooth; + float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; + uint16_t coherence_flag; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - float left_hi_power, right_hi_power, total_hi_power, lr_hi_power; - float lr_total_hi_ratio; - float a2, b2; + push_wmops( "ivas_dirac_dec_render" ); - float sum_power; - float sum_total_ratio[MASA_SUM_FREQ_RANGE_BINS]; - float min_sum_total_ratio; - float min_sum_total_ratio_db; + /* Initialize aux buffers */ + hDirAC = st_ivas->hDirAC; + hDirACRend = st_ivas->hDirACRend; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; - float RealSubtract, ImagSubtract; + DirAC_mem = hDirACRend->stack_mem; - float interpolatorSpaced = 0.0f; - float interpolatorDmx = 1.0f; + reference_power = DirAC_mem.reference_power; + reference_power_smooth = DirAC_mem.reference_power + hSpatParamRendCom->num_freq_bands; + onset_filter = DirAC_mem.onset_filter; + onset_filter_subframe = DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands; - int16_t dipole_freq_range[2]; - float tempSpaced, tempDmx; + hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); - if ( isloudspeaker ) + if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) { - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 3; - - for ( l = 0; l < num_freq_bands; l++ ) - { - float Left_power; - float Right_power; - Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; - - reference_power[l] = Left_power + Right_power; - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - proto_power_smooth[l + num_freq_bands] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - - proto_power_smooth[l + 2 * num_freq_bands] += RealBuffer[1][0][l] * RealBuffer[1][0][l]; - proto_power_smooth[l + 2 * num_freq_bands] += ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; - p_proto_buffer[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - p_proto_buffer[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; - - proto_frame_f[2 * l] = Real_aux; - proto_frame_f[2 * l + 1] = Imag_aux; - - proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; - } + coherence_flag = st_ivas->hQMetaData->coherence_flag; } - else if ( stereo_type_detect != NULL ) + else { - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; - - left_bb_power = 0.0f; - right_bb_power = 0.0f; - total_bb_power = 0.0f; - - left_hi_power = 0.0f; - right_hi_power = 0.0f; - total_hi_power = 0.0f; - - dipole_freq_range[0] = stereo_type_detect->dipole_freq_range[0]; - dipole_freq_range[1] = stereo_type_detect->dipole_freq_range[1]; + coherence_flag = 0; + } - a = 0.01f; /* Temporal smoothing coefficient */ - b = 1.0f - a; /* Temporal smoothing coefficient */ - a2 = 0.1f; /* Temporal smoothing coefficient */ - b2 = 1.0f - a2; /* Temporal smoothing coefficient */ +#ifdef DEBUG_MODE_DIRAC + { + int16_t n, tmp[IVAS_SPAR_MAX_CH * L_FRAME48k]; + char file_name[50] = { 0 }; + const int16_t output_frame = st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - if ( stereo_type_detect->interpolator > 0 ) + for ( n = 0; n < nchan_transport; n++ ) { - if ( stereo_type_detect->type_change_direction == MASA_STEREO_SPACED_MICS ) - { - interpolatorSpaced = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); - interpolatorDmx = 1.0f - interpolatorSpaced; - } - else + for ( i = 0; i < output_frame; i++ ) { - interpolatorDmx = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); - interpolatorSpaced = 1.0f - interpolatorDmx; + tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); } } + sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); + dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); + } +#endif - for ( l = 0; l < num_freq_bands; l++ ) - { - float Left_power; - float Right_power; - - /* Compute sum signal */ - Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - /* Compute reference power */ - Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; - - reference_power[l] = Left_power + Right_power; - - left_bb_power += Left_power; - right_bb_power += Right_power; - total_bb_power += reference_power[l]; + /* Subframe loop */ + slot_idx_start = hSpatParamRendCom->slots_rendered; + slot_idx_start_cldfb_synth = 0; - if ( l > MASA_HI_FREQ_START_BIN ) - { - left_hi_power += Left_power; - right_hi_power += Right_power; - total_hi_power += reference_power[l]; - } + subframe_idx = hSpatParamRendCom->subframes_rendered; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; + } + else + { + md_idx = hSpatParamRendCom->render_to_md_map[slot_idx_start]; + } + /* ToDo: Another workaround for self test BE */ - if ( l < min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) - { - sum_power = Real_aux * Real_aux + Imag_aux * Imag_aux; + /* copy parameters into local buffers*/ + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + mvs2s( hSpatParamRendCom->azimuth[hSpatParamRendCom->render_to_md_map[subframe_idx]], azimuth, hSpatParamRendCom->num_freq_bands ); + mvs2s( hSpatParamRendCom->elevation[hSpatParamRendCom->render_to_md_map[subframe_idx]], elevation, hSpatParamRendCom->num_freq_bands ); + mvr2r( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + } + else + { + set_zero( diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + } - stereo_type_detect->sum_power[l] = a * sum_power + b * stereo_type_detect->sum_power[l]; - stereo_type_detect->total_power[l] = a * reference_power[l] + b * stereo_type_detect->total_power[l]; + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + set_zero( reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + } + else + { + set_zero( onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); + } - sum_total_ratio[l] = stereo_type_detect->sum_power[l] / ( stereo_type_detect->total_power[l] + EPSILON ); - } + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) + { + p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[subframe_idx][0][0]; - if ( l == 0 ) + if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + { + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - RealSubtract = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - ImagSubtract = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - stereo_type_detect->subtract_power_y += RealSubtract * RealSubtract + ImagSubtract * ImagSubtract; + rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat ); } + } + } + else + { + p_Rmat = 0; + } - /* Compute protos (and their power) for direct sound rendering */ + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + /* compute response */ + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_power_factors( hSpatParamRendCom->num_freq_bands, + diffuseness_vector, + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); - /* W prototype */ - if ( stereo_type_detect->interpolator > 0 ) - { - if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) - { - Real_aux = interpolatorSpaced * 0.5f * Real_aux + interpolatorDmx * Real_aux; - Imag_aux = interpolatorSpaced * 0.5f * Imag_aux + interpolatorDmx * Imag_aux; - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - } - else - { - tempSpaced = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - tempDmx = Real_aux * Real_aux + Imag_aux * Imag_aux; - proto_power_smooth[l] += interpolatorSpaced * tempSpaced + interpolatorDmx * tempDmx; - p_proto_buffer[2 * l] = interpolatorSpaced * RealBuffer[0][0][l] + interpolatorDmx * Real_aux; - p_proto_buffer[2 * l + 1] = interpolatorSpaced * ImagBuffer[0][0][l] + interpolatorDmx * Imag_aux; - } - } - else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + if ( coherence_flag ) { - if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) - { - Real_aux *= 0.5f; - Imag_aux *= 0.5f; - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - } - else + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - proto_power_smooth[l] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - p_proto_buffer[2 * l] = RealBuffer[0][0][l]; - p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i]; + surCohEner = hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] * hSpatParamRendCom->surroundingCoherence[md_idx][i]; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; + + surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); } } else { - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; + set_zero( surCohRatio, hSpatParamRendCom->num_freq_bands ); } + } + else + { + ivas_dirac_dec_compute_gain_factors( hSpatParamRendCom->num_freq_bands, + hSpatParamRendCom->diffuseness_vector[md_idx], + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); - /* Y prototype */ - if ( stereo_type_detect->interpolator > 0 ) + if ( coherence_flag ) { - if ( l < ( dipole_freq_range[0] ) ) + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + surCohRatio[i] = hSpatParamRendCom->surroundingCoherence[md_idx][i]; } - else if ( l < ( dipole_freq_range[1] ) ) - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ) + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * ( -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ) ) + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - } - else - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - } - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; } - else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + else { - if ( l < ( dipole_freq_range[0] ) ) /* proto = W */ - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; - proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; - } - else if ( l < ( dipole_freq_range[1] ) ) /* proto = -i * (x1-x2) * eq */ - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; - } - else /* proto = W */ - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; - proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; - } + set_zero( surCohRatio, hSpatParamRendCom->num_freq_bands ); } - else + } + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) + { + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + st_ivas->hVBAPdata, + st_ivas->hMasa, + azimuth, + elevation, + md_idx, + surCohRatio, + st_ivas->hCombinedOrientationData->shd_rot_max_order, + p_Rmat, + hodirac_flag ); + } + else + { + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + st_ivas->hVBAPdata, + st_ivas->hMasa, + azimuth, + elevation, + md_idx, + surCohRatio, + 0, + NULL, + hodirac_flag ); + } + } + + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + index_slot = slot_idx_start + slot_idx; + if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + md_idx = hSpatParamRendCom->render_to_md_map[index_slot]; + } + else + { + md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; + } + + if ( st_ivas->ivas_format == SBA_FORMAT ) + { + for ( ch = 0; ch < nchan_transport; ch++ ) { - p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); + mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); } - - /* Compute protos for decorrelation */ - proto_frame_f[2 * l] = Real_aux; - proto_frame_f[2 * l + 1] = Imag_aux; - proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; } - - if ( stereo_type_detect->interpolator > 0 ) + else { - stereo_type_detect->interpolator++; - if ( stereo_type_detect->interpolator == MASA_STEREO_INTERPOLATION_SLOTS ) + /* CLDFB Analysis*/ + for ( ch = 0; ch < nchan_transport; ch++ ) { - stereo_type_detect->interpolator = 0; - stereo_type_detect->current_stereo_type = stereo_type_detect->type_change_direction; + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][hSpatParamRendCom->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hSpatParamRendCom->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); } } - stereo_type_detect->left_bb_power = a * left_bb_power + b * stereo_type_detect->left_bb_power; - stereo_type_detect->right_bb_power = a * right_bb_power + b * stereo_type_detect->right_bb_power; - stereo_type_detect->total_bb_power = a * total_bb_power + b * stereo_type_detect->total_bb_power; - - lr_bb_power = ( stereo_type_detect->left_bb_power < stereo_type_detect->right_bb_power ) ? stereo_type_detect->left_bb_power : stereo_type_detect->right_bb_power; - lr_bb_power *= 2.0f; - lr_total_bb_ratio = 10.0f * log10f( lr_bb_power / ( stereo_type_detect->total_bb_power + EPSILON ) ); - - stereo_type_detect->left_hi_power = a2 * left_hi_power + b2 * stereo_type_detect->left_hi_power; - stereo_type_detect->right_hi_power = a2 * right_hi_power + b2 * stereo_type_detect->right_hi_power; - stereo_type_detect->total_hi_power = a2 * total_hi_power + b2 * stereo_type_detect->total_hi_power; - - lr_hi_power = ( stereo_type_detect->left_hi_power < stereo_type_detect->right_hi_power ) ? stereo_type_detect->left_hi_power : stereo_type_detect->right_hi_power; - lr_hi_power *= 2.0f; - lr_total_hi_ratio = 10.0f * log10f( lr_hi_power / ( stereo_type_detect->total_hi_power + EPSILON ) ); - - minimum( sum_total_ratio, min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ), &min_sum_total_ratio ); - min_sum_total_ratio_db = 10.0f * log10f( min_sum_total_ratio ); - - stereo_type_detect->lr_total_bb_ratio_db = lr_total_bb_ratio; - stereo_type_detect->lr_total_hi_ratio_db = lr_total_hi_ratio; - stereo_type_detect->min_sum_total_ratio_db = min_sum_total_ratio_db; - - ivas_masa_stereotype_detection( stereo_type_detect ); - } - else - { - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; - - for ( l = 0; l < num_freq_bands; l++ ) + /* CNG in DirAC, extra CLDFB ana for CNA*/ + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) { - Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - reference_power[l] = Real_aux * Real_aux + Imag_aux * Imag_aux; - proto_power_smooth[l] += reference_power[l]; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - - p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; - - proto_frame_f[2 * l] = Real_aux; - proto_frame_f[2 * l + 1] = Imag_aux; + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], + st_ivas->hTcBuffer->tc[1], + Cldfb_RealBuffer[1][0], + Cldfb_ImagBuffer[1][0], + index_slot, + st->cna_dirac_flag && st->flag_cna, + ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); } - } - - return; -} - - -static void protoSignalComputation4( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_frame_f, - float *proto_direct_buffer_f, - float *reference_power, - float *proto_power_smooth, - const int16_t slot_index, - const int16_t num_outputs_diff, - const int16_t num_freq_bands, - const float *mtx_hoa_decoder, - const int16_t nchan_transport, - const int16_t *sba_map_tc_ind ) -{ - int16_t k, l; - int16_t n; - float sq_tmp; - float *p_proto_buffer; - set_zero( reference_power, num_freq_bands ); - for ( k = 0; k < 4; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) + /* LFE synthesis */ + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled && !( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirACRend->hOutSetup.num_lfe == 0 ) ) { - sq_tmp = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; - reference_power[l] += 0.5f * sq_tmp; + ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, + Cldfb_RealBuffer, Cldfb_ImagBuffer, + Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], + slot_idx, + md_idx, + nchan_transport ); } - } - /*For decorrelated diffuseness*/ - for ( l = 0; l < num_outputs_diff; l++ ) - { - for ( k = 0; k < num_freq_bands; k++ ) + /*-----------------------------------------------------------------* + * protoype signal computation + *-----------------------------------------------------------------*/ + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - proto_frame_f[2 * l * num_freq_bands + 2 * k] = 0.f; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] = 0.f; - for ( n = 0; n < nchan_transport; n++ ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + { + protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + reference_power, slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + p_Rmat ); + } + else { - proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + reference_power, slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + 0 ); } } - } - - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; - for ( k = 0; k < num_outputs_diff; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - sq_tmp = proto_frame_f[k * 2 * num_freq_bands + 2 * l] * proto_frame_f[k * 2 * num_freq_bands + 2 * l] + proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1] * proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; - proto_power_smooth[l + k * num_freq_bands] += sq_tmp; - p_proto_buffer[k * 2 * num_freq_bands + 2 * l] = proto_frame_f[k * 2 * num_freq_bands + 2 * l]; - p_proto_buffer[k * 2 * num_freq_bands + 2 * l + 1] = proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect ); } - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_compute_diffuse_proto() - * - * Compute diffuse prototype buffer and smooth power, only for decorrelated bands - *------------------------------------------------------------------------*/ - -static void ivas_dirac_dec_compute_diffuse_proto( - DIRAC_REND_HANDLE hDirACRend, - const int16_t num_freq_bands, - const int16_t slot_idx /* i : slot index */ -) -{ - int16_t k, l; - int16_t num_freq_bands_diff; - float *p_diff_buffer, *p_diff_buffer_1; - float *p_proto_diff, *p_power_smooth, *proto_frame_dec_f; - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; - DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - int16_t m; - float *p_hoa_enc; - - proto_frame_dec_f = hDirACRend->proto_frame_dec_f; - h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); - - num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; - - p_diff_buffer = h_dirac_output_synthesis_state->proto_diffuse_buffer_f + slot_idx * 2 * num_freq_bands_diff * hDirACRend->hOutSetup.nchan_out_woLFE; - p_diff_buffer_1 = p_diff_buffer + 1; - p_power_smooth = h_dirac_output_synthesis_state->proto_power_diff_smooth; - - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) - { - for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) + else { - p_proto_diff = proto_frame_dec_f + k * 2 * num_freq_bands; - for ( l = 0; l < num_freq_bands_diff; l++ ) + switch ( nchan_transport ) { - *p_diff_buffer = *( p_proto_diff++ ); - *p_diff_buffer_1 = *( p_proto_diff++ ); - *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); - p_diff_buffer += 2; - p_diff_buffer_1 += 2; + case 11: + case 8: + case 6: + case 4: + protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + hDirACRend->hoa_decoder, + nchan_transport, + hDirACRend->sba_map_tc ); + break; + case 2: + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + hDirACRend->hOutSetup.is_loudspeaker_setup, + slot_idx, + hSpatParamRendCom->num_freq_bands, + hDirACRend->masa_stereo_type_detect ); + break; + case 1: + protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, + hDirACRend->num_protos_diff, + hSpatParamRendCom->num_freq_bands ); + break; + default: + return; } } - } - else - { - /*DIRAC_SYNTHESIS_PSD_SHD: Virtual LS->HOA encoding*/ - for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) - { - for ( l = 0; l < num_freq_bands_diff; l++ ) - { - p_hoa_enc = hDirACRend->hoa_encoder + k; - p_proto_diff = proto_frame_dec_f + 2 * l; - *p_diff_buffer = 0.f; - *p_diff_buffer_1 = 0.f; - /*LS to HOA*/ - for ( m = 0; m < hDirACRend->num_outputs_diff; m++ ) - { - *p_diff_buffer += ( *p_hoa_enc ) * ( *p_proto_diff ); - *p_diff_buffer_1 += ( *p_hoa_enc ) * ( *( p_proto_diff + 1 ) ); - p_hoa_enc += hDirACRend->hOutSetup.nchan_out_woLFE; - p_proto_diff += 2 * num_freq_bands; - } + /*-----------------------------------------------------------------* + * Compute DirAC parameters at decoder side + *-----------------------------------------------------------------*/ - *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); - p_diff_buffer += 2; - p_diff_buffer_1 += 2; + if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + mvs2s( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], hSpatParamRendCom->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); + mvs2s( &hSpatParamRendCom->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], hSpatParamRendCom->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); + if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + { + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat ); } - } - } - return; -} + hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + index = hDirACRend->index_buffer_intensity; -/*------------------------------------------------------------------------- - * computeDirectionAngles() - * - *------------------------------------------------------------------------*/ + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; -static void computeDirectionAngles( - float *intensity_real_x, - float *intensity_real_y, - float *intensity_real_z, - const int16_t num_frequency_bands, - int16_t *azimuth, - int16_t *elevation ) -{ - int16_t k; - float intensityNorm; - float x, y, z, radius; + computeIntensityVector_dec( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + num_freq_bands, + hDirACRend->buffer_intensity_real[0][index - 1], + hDirACRend->buffer_intensity_real[1][index - 1], + hDirACRend->buffer_intensity_real[2][index - 1] ); - for ( k = 0; k < num_frequency_bands; ++k ) + computeDirectionAngles( hDirACRend->buffer_intensity_real[0][index - 1], + hDirACRend->buffer_intensity_real[1][index - 1], + hDirACRend->buffer_intensity_real[2][index - 1], + num_freq_bands, + azimuth, + elevation ); - { - intensityNorm = *( intensity_real_x ) * *( intensity_real_x ) + - *( intensity_real_y ) * *( intensity_real_y ) + - *( intensity_real_z ) * *( intensity_real_z ); + mvr2r( reference_power, &( hDirACRend->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - if ( intensityNorm <= EPSILON ) - { - intensityNorm = 1.0f; - x = 1.0f; - y = 0.0f; - z = 0.0f; - intensity_real_x++; - intensity_real_y++; - intensity_real_z++; - } - else - { - intensityNorm = sqrtf( 1.f / intensityNorm ); - x = *( intensity_real_x++ ) * intensityNorm; - y = *( intensity_real_y++ ) * intensityNorm; - z = *( intensity_real_z++ ) * intensityNorm; + computeDiffuseness( hDirACRend->buffer_intensity_real, hDirACRend->buffer_energy, num_freq_bands, hSpatParamRendCom->diffuseness_vector[md_idx] ); } - radius = sqrtf( x * x + y * y ); - azimuth[k] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); - elevation[k] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_masa_init_stereotype_detection() - * - * Initialize stereo transport signal type detection - *------------------------------------------------------------------------*/ - -static void ivas_masa_init_stereotype_detection( - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -{ - stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; - stereo_type_detect->current_stereo_type = MASA_STEREO_DOWNMIX; - stereo_type_detect->type_change_direction = MASA_STEREO_DOWNMIX; - - stereo_type_detect->counter = 0; - stereo_type_detect->interpolator = 0; - stereo_type_detect->dipole_freq_range[0] = 1; - stereo_type_detect->dipole_freq_range[1] = 3; +#ifdef DEBUG_MODE_DIRAC + { + static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; - stereo_type_detect->left_bb_power = 0.0f; /* Broadband estimates */ - stereo_type_detect->right_bb_power = 0.0f; - stereo_type_detect->total_bb_power = 0.0f; - stereo_type_detect->left_hi_power = 0.0f; /* High-frequency estimates */ - stereo_type_detect->right_hi_power = 0.0f; - stereo_type_detect->total_hi_power = 0.0f; + if ( fp_direction_vector == NULL ) + fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); + if ( fp_diffuseness == NULL ) + fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); + if ( fp_referencePower == NULL ) + fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); - set_zero( stereo_type_detect->sum_power, MASA_SUM_FREQ_RANGE_BINS ); - set_zero( stereo_type_detect->total_power, MASA_SUM_FREQ_RANGE_BINS ); - stereo_type_detect->subtract_power_y = 0.0f; - stereo_type_detect->subtract_power_y_smooth = 0.0f; - stereo_type_detect->target_power_y_smooth = 0.0f; + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + float radius_length; + float dv[3]; - stereo_type_detect->lr_total_bb_ratio_db = 0.0f; - stereo_type_detect->lr_total_hi_ratio_db = 0.0f; - stereo_type_detect->min_sum_total_ratio_db = 0.0f; - stereo_type_detect->subtract_target_ratio_db = 0.0f; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - return; -} + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; + } + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); + } + else + { + radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); + } + } + } +#endif -/*------------------------------------------------------------------------- - * ivas_masa_stereotype_detection() - * - * Detect the type of the transport audio signals - *------------------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * frequency domain decorrelation + *-----------------------------------------------------------------*/ -static void ivas_masa_stereotype_detection( - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -{ - float lr_total_bb_ratio_db = stereo_type_detect->lr_total_bb_ratio_db; - float lr_total_hi_ratio_db = stereo_type_detect->lr_total_hi_ratio_db; - float min_sum_total_ratio_db = stereo_type_detect->min_sum_total_ratio_db; - float subtract_target_ratio_db = stereo_type_detect->subtract_target_ratio_db; - float change_to_spaced; - int16_t change_to_spaced_selection; - float change_to_downmix; - float change_to_downmix2; - int16_t change_to_downmix_selection; - float subtract_temp; - float min_sum_temp; - float lr_total_bb_temp; - float lr_total_hi_temp; - - /* Determine if the determined features match the spaced mic type */ - change_to_spaced_selection = 0; - if ( subtract_target_ratio_db < -3.0f ) - { - subtract_temp = ( -subtract_target_ratio_db - 3.0f ) / 3.0f; - min_sum_temp = max( -min_sum_total_ratio_db / 6.0f, 0.0f ); - lr_total_bb_temp = lr_total_bb_ratio_db / 6.0f; + if ( hDirACRend->proto_signal_decorr_on == 1 ) + { + /* decorrelate prototype frame */ + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport ), + onset_filter, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); - change_to_spaced = subtract_temp + min_sum_temp + lr_total_bb_temp; + v_multc( onset_filter, 0.25f, onset_filter, hSpatParamRendCom->num_freq_bands ); + v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; + } + else + { + ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->proto_frame_f, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + DirAC_mem.frame_dec_f, + onset_filter, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); - if ( change_to_spaced >= 1.0f ) + hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; + p_onset_filter = onset_filter; + } + } + else { - change_to_spaced_selection = 1; + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + set_f( onset_filter_subframe, 1.f, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; + } + else + { + /* no frequency domain decorrelation: use prototype frame */ + hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; + p_onset_filter = NULL; + } } - } - /* Determine if the determined features match the downmix type, according to a metric */ - change_to_downmix_selection = 0; - if ( subtract_target_ratio_db > 0.0f ) - { - subtract_temp = subtract_target_ratio_db / 3.0f; - min_sum_temp = ( min_sum_total_ratio_db + 1.0f ) / 6.0f; - lr_total_bb_temp = -lr_total_bb_ratio_db / 6.0f; - - change_to_downmix = subtract_temp + min_sum_temp + lr_total_bb_temp; + /*-----------------------------------------------------------------* + * output synthesis + *-----------------------------------------------------------------*/ - if ( change_to_downmix >= 1.0f ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - change_to_downmix_selection = 1; + /*Compute diffuse prototypes*/ + ivas_dirac_dec_compute_diffuse_proto( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); } - } - /* Determine if the determined features match the downmix type, according to another metric */ - if ( lr_total_hi_ratio_db < -12.0f ) - { - subtract_temp = ( subtract_target_ratio_db + 4.0f ) / 3.0f; - min_sum_temp = min_sum_total_ratio_db / 6.0f; - lr_total_hi_temp = ( -lr_total_hi_ratio_db - 12.0f ) / 3.0f; - - change_to_downmix2 = subtract_temp + min_sum_temp + lr_total_hi_temp; - - if ( change_to_downmix2 >= 1.0f ) + /*Compute PSDs*/ + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) { - change_to_downmix_selection = 1; + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector[md_idx], + hSpatParamRendCom, + hDirACRend, + st_ivas->hCombinedOrientationData->shd_rot_max_order, + p_Rmat, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); } - } - - if ( stereo_type_detect->counter < 400 ) - { - stereo_type_detect->counter++; - } - else - { - if ( change_to_spaced_selection == 1 ) + else { - stereo_type_detect->masa_stereo_type = MASA_STEREO_SPACED_MICS; + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector[md_idx], + hSpatParamRendCom, + hDirACRend, + 0, + 0, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); } - else if ( change_to_downmix_selection == 1 ) + + if ( hDirAC->hConfig->dec_param_estim ) { - stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; + float fac = 1.0f / (float) hSpatParamRendCom->subframe_nbslots[subframe_idx]; + v_multc_acc( hSpatParamRendCom->diffuseness_vector[md_idx], fac, diffuseness_vector, hSpatParamRendCom->num_freq_bands ); } - } - if ( stereo_type_detect->interpolator == 0 ) - { - if ( stereo_type_detect->current_stereo_type != stereo_type_detect->masa_stereo_type ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - stereo_type_detect->interpolator = 1; - stereo_type_detect->type_change_direction = stereo_type_detect->masa_stereo_type; + v_add( reference_power, reference_power_smooth, reference_power_smooth, hSpatParamRendCom->num_freq_bands ); } } - return; -} - + ivas_dirac_dec_output_synthesis_get_interpolator( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -/*------------------------------------------------------------------------- - * computeIntensityVector_dec() - * - * - *------------------------------------------------------------------------*/ -static void computeIntensityVector_dec( - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - const int16_t num_frequency_bands, - float *intensity_real_x, - float *intensity_real_y, - float *intensity_real_z ) -{ - /* - * W = a + ib; Y = c + id - * real(W*Y') = ac + bd - */ - int16_t i; - float real, img; - - for ( i = 0; i < num_frequency_bands; ++i ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - real = Cldfb_RealBuffer[0][0][i]; - img = Cldfb_ImagBuffer[0][0][i]; - intensity_real_x[i] = Cldfb_RealBuffer[3][0][i] * real + Cldfb_ImagBuffer[3][0][i] * img; - intensity_real_y[i] = Cldfb_RealBuffer[1][0][i] * real + Cldfb_ImagBuffer[1][0][i] * img; - intensity_real_z[i] = Cldfb_RealBuffer[2][0][i] * real + Cldfb_ImagBuffer[2][0][i] * img; + ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hSpatParamRendCom, + hDirACRend, + nchan_transport, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + p_onset_filter, + diffuseness_vector, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); } + else + { + /* Determine encoding quality based additional smoothing factor */ + float qualityBasedSmFactor = 1.0f; - return; -} - + if ( st_ivas->hMasa != NULL ) + { + qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; + qualityBasedSmFactor *= qualityBasedSmFactor; + } -/*------------------------------------------------------------------------- - * ivas_lfe_synth_with_cldfb() - * - * - *------------------------------------------------------------------------*/ -static void ivas_lfe_synth_with_cldfb( - MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - const int16_t slot_index, - const int16_t subframe_index, - const int16_t nchan_transport ) -{ - float lfeGain; - float transportGain; - float protoLfeReal, protoLfeImag; - int16_t i; - float transportEne, protoLfeEne, targetEneLfe, targetEneTrans; - - set_zero( RealBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); - set_zero( ImagBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); - - protoLfeReal = RealBuffer[0][0][0]; - protoLfeImag = ImagBuffer[0][0][0]; - transportEne = RealBuffer[0][0][0] * RealBuffer[0][0][0] + ImagBuffer[0][0][0] * ImagBuffer[0][0][0]; - for ( i = 1; i < nchan_transport; i++ ) - { - protoLfeReal += RealBuffer[i][0][0]; - protoLfeImag += ImagBuffer[i][0][0]; - transportEne += RealBuffer[i][0][0] * RealBuffer[i][0][0] + ImagBuffer[i][0][0] * ImagBuffer[i][0][0]; + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hSpatParamRendCom, + hDirACRend, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + diffuseness_vector, + reference_power_smooth, + qualityBasedSmFactor, + hDirAC->hConfig->enc_param_start_band ); } - protoLfeEne = protoLfeReal * protoLfeReal + protoLfeImag * protoLfeImag; - targetEneLfe = transportEne * hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index]; - targetEneTrans = transportEne * max( ( 1.0f - hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index] ), 0.01f ); + /*-----------------------------------------------------------------* + * CLDFB synthesis (and binaural rendering) + *-----------------------------------------------------------------*/ - hMasaLfeSynth->transportEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; - hMasaLfeSynth->protoLfeEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; - hMasaLfeSynth->targetEneLfeSmooth *= MCMASA_LFE_SYNTH_ALPHA; - hMasaLfeSynth->targetEneTransSmooth *= MCMASA_LFE_SYNTH_ALPHA; + index_slot = slot_idx_start_cldfb_synth; - hMasaLfeSynth->transportEneSmooth += transportEne; - hMasaLfeSynth->protoLfeEneSmooth += protoLfeEne; - hMasaLfeSynth->targetEneLfeSmooth += targetEneLfe; - hMasaLfeSynth->targetEneTransSmooth += targetEneTrans; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + /* Perform binaural rendering */ + ivas_binRenderer( st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + subframe_idx, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, + Cldfb_ImagBuffer ); - lfeGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneLfeSmooth / ( EPSILON + hMasaLfeSynth->protoLfeEneSmooth ) ) ); - transportGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneTransSmooth / ( EPSILON + hMasaLfeSynth->transportEneSmooth ) ) ); + /* Inverse CLDFB*/ + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - RealBufferLfe[slot_index][0] = protoLfeReal * lfeGain; - ImagBufferLfe[slot_index][0] = protoLfeImag * lfeGain; + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; + } - RealBuffer[0][0][0] *= transportGain; - ImagBuffer[0][0][0] *= transportGain; - for ( i = 1; i < nchan_transport; i++ ) + cldfbSynthesis( RealBuffer, + ImagBuffer, + &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], + st_ivas->cldfbSynDec[ch] ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT ) { - RealBuffer[i][0][0] *= transportGain; - ImagBuffer[i][0][0] *= transportGain; + for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + } + } } + else + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t outchannels; - return; -} + idx_in = 0; + idx_lfe = 0; + outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; + if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || + ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + { + outchannels++; + } -/*------------------------------------------------------------------------- - * rotateAziEle_DirAC() - * - * Apply rotation to DirAC DOAs - *------------------------------------------------------------------------*/ + if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + const int16_t subframe_start_sample = index_slot * hSpatParamRendCom->num_freq_bands; + const int16_t num_samples_subframe = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; -static void rotateAziEle_DirAC( - int16_t *azi, /* i/o: array of azimuth values */ - int16_t *ele, /* i/o: array of elevation values */ - const int16_t band1, /* i : bands to work on (lower limit) */ - const int16_t band2, /* i : bands to work on (upper bound) */ - const float *p_Rmat /* i : pointer to real-space rotation matrix */ -) -{ - int16_t b; - float dv_0, dv_1, dv_2; - float dv_r_0, dv_r_1, dv_r_2; - float w; + /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ + mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); + mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); - push_wmops( "rotateAziEle_DirAC" ); + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + { + /* Move the LFE channel to the correct place */ + mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - for ( b = band1; b < band2; b++ ) - { + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + { + /* Move the separated channel to the correct place. Thus, the separated channel is + * combined with the synthesized channels here when there is a matching channel. */ + mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); - /*Conversion spherical to cartesian coordinates*/ - w = cosf( ele[b] * PI_OVER_180 ); - dv_0 = w * cosf( azi[b] * PI_OVER_180 ); - dv_1 = w * sinf( azi[b] * PI_OVER_180 ); - dv_2 = sinf( ele[b] * PI_OVER_180 ); + if ( !st_ivas->hLsSetupCustom->separate_ch_found ) + { + /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel + * is combined with the synthesized channels here when there is no matching channel. */ + v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + } - dv_r_0 = p_Rmat[0] * dv_0 + p_Rmat[1] * dv_1 + p_Rmat[2] * dv_2; - dv_r_1 = p_Rmat[3] * dv_0 + p_Rmat[4] * dv_1 + p_Rmat[5] * dv_2; - dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; + idx_in++; + } + } + } + else + { + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + { + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled ) + { + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) + { + /* LFE has been synthesized in the time domain, do nothing. */ + } + else + { + set_zero( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); + } - /*Conversion spherical to cartesian coordinates*/ - azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); - ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); + idx_in++; + } + } + } } + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; + hSpatParamRendCom->subframes_rendered++; pop_wmops(); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 6743e4beff..db6a8c13e4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1699,7 +1699,7 @@ void ivas_initialize_handles_dec( st_ivas->hBinRenderer = NULL; st_ivas->hDiracDecBin = NULL; st_ivas->hDirACRend = NULL; - st_ivas->rend_common_data = NULL; + st_ivas->hSpatParamRendCom = NULL; st_ivas->hLsSetUpConversion = NULL; st_ivas->hEFAPdata = NULL; st_ivas->hVBAPdata = NULL; @@ -1810,12 +1810,12 @@ void ivas_destroy_dec( /* DirAC handle */ if ( st_ivas->ivas_format == ISM_FORMAT ) { - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->rend_common_data ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); } else { ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index c684e470fc..e3e3c1edf3 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -122,13 +122,13 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->rend_common_data != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) + if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) { - st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered; - mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv @@ -166,7 +166,7 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { /* Deallocate the ParamISM struct */ - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->rend_common_data ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); #ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) @@ -339,14 +339,14 @@ static ivas_error ivas_ism_bitrate_switching( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->rend_common_data != NULL ) + if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index cf6e70d5d8..4662304a4a 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -287,7 +287,7 @@ static void ivas_param_ism_compute_mixing_matrix( static void ivas_param_ism_render_slot( DIRAC_DEC_HANDLE hDirAC, - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX], float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -303,7 +303,7 @@ static void ivas_param_ism_render_slot( tmp_1 = hDirAC->hParamIsmRendering->interpolator[interpolator_idx]; - for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { /* smooth the mixing matrix */ for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) @@ -325,7 +325,7 @@ static void ivas_param_ism_render_slot( static void ivas_param_ism_rendering( DIRAC_DEC_HANDLE hDirAC, - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][4][CLDFB_NO_CHANNELS_MAX], @@ -341,7 +341,7 @@ static void ivas_param_ism_rendering( tmp_1 = hDirAC->hParamIsmRendering->interpolator[slot_idx]; - for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { /* smooth the mixing matrix */ for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) @@ -442,7 +442,7 @@ ivas_error ivas_param_ism_dec_open( int16_t i; DIRAC_DEC_HANDLE hDirAC; IVAS_OUTPUT_SETUP hOutSetup; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; AUDIO_CONFIG output_config; int32_t output_Fs; ivas_error error; @@ -460,7 +460,7 @@ ivas_error ivas_param_ism_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( rend_common_data = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + if ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -485,15 +485,15 @@ ivas_error ivas_param_ism_dec_open( * set input parameters *-----------------------------------------------------------------*/ - rend_common_data->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); hDirAC->hConfig = NULL; - set_s( rend_common_data->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( rend_common_data->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - rend_common_data->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - rend_common_data->subframes_rendered = 0; - rend_common_data->slots_rendered = 0; - rend_common_data->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - rend_common_data->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpatParamRendCom->subframes_rendered = 0; + hSpatParamRendCom->slots_rendered = 0; + hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -501,9 +501,9 @@ ivas_error ivas_param_ism_dec_open( { hDirAC->hParamIsm->band_grouping[i] = Param_ISM_band_grouping[i]; - if ( hDirAC->hParamIsm->band_grouping[i] > rend_common_data->num_freq_bands ) + if ( hDirAC->hParamIsm->band_grouping[i] > hSpatParamRendCom->num_freq_bands ) { - hDirAC->hParamIsm->band_grouping[i] = rend_common_data->num_freq_bands; + hDirAC->hParamIsm->band_grouping[i] = hSpatParamRendCom->num_freq_bands; } } @@ -554,19 +554,19 @@ ivas_error ivas_param_ism_dec_open( set_zero( hDirAC->azimuth_values, MAX_NUM_OBJECTS ); set_zero( hDirAC->elevation_values, MAX_NUM_OBJECTS ); - rend_common_data->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - rend_common_data->dirac_bs_md_write_idx = 0; - rend_common_data->dirac_read_idx = 0; + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + hSpatParamRendCom->dirac_bs_md_write_idx = 0; + hSpatParamRendCom->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_dirac_allocate_parameters( rend_common_data, 2 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) { return error; } @@ -575,7 +575,7 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hISMDTX.dtx_flag = 0; st_ivas->hDirAC = hDirAC; - st_ivas->rend_common_data = rend_common_data; + st_ivas->hSpatParamRendCom = hSpatParamRendCom; if ( st_ivas->hDecoderConfig->voip_active ) { @@ -591,17 +591,17 @@ ivas_error ivas_param_ism_dec_open( } else { - if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } - set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands ); - if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } - set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * rend_common_data->num_freq_bands ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands ); } if ( st_ivas->hTcBuffer == NULL ) { @@ -643,9 +643,9 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE *rend_common_data_out, /* i/o: common spatial renderer data */ - AUDIO_CONFIG output_config /* i : output audio configuration */ + DIRAC_DEC_HANDLE *hDirAC_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 ( hDirAC_out != NULL && *hDirAC_out != NULL ) @@ -696,16 +696,16 @@ void ivas_param_ism_dec_close( *hDirAC_out = NULL; } - if ( rend_common_data_out != NULL && *rend_common_data_out != NULL ) + if ( hSpatParamRendCom_out != NULL && *hSpatParamRendCom_out != NULL ) { if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - ivas_dirac_deallocate_parameters( *rend_common_data_out, 1 ); - ivas_dirac_deallocate_parameters( *rend_common_data_out, 2 ); + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 1 ); + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 2 ); } - free( *rend_common_data_out ); - *rend_common_data_out = NULL; + free( *hSpatParamRendCom_out ); + *hSpatParamRendCom_out = NULL; } return; @@ -748,15 +748,15 @@ void ivas_param_ism_dec( float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; IVAS_OUTPUT_SETUP hSetup; /* Initialization */ hDirAC = st_ivas->hDirAC; assert( hDirAC ); - rend_common_data = st_ivas->rend_common_data; - assert( rend_common_data ); + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + assert( hSpatParamRendCom ); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; @@ -889,14 +889,14 @@ void ivas_param_ism_dec( *-----------------------------------------------------------------*/ for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - cldfbAnalysis_ts( &( output_f[ch][rend_common_data->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], rend_common_data->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( output_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); ivas_param_ism_collect_slot( hDirAC, Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], ch, ref_power, cx_diag ); } } /* Obtain Mixing Matrix on a frame-level */ - for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { set_f( mixing_matrix[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); } @@ -904,28 +904,28 @@ void ivas_param_ism_dec( /* Compute mixing matrix */ ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, mixing_matrix ); /* subframe loop for synthesis*/ - for ( subframe_idx = 0; subframe_idx < rend_common_data->nb_subframes; subframe_idx++ ) + for ( subframe_idx = 0; subframe_idx < hSpatParamRendCom->nb_subframes; subframe_idx++ ) { - uint16_t slot_idx_start = subframe_idx * rend_common_data->subframe_nbslots[subframe_idx]; + uint16_t slot_idx_start = subframe_idx * hSpatParamRendCom->subframe_nbslots[subframe_idx]; uint16_t idx_in; uint16_t idx_lfe; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); - set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); } } - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; /* Compute bandwise rendering to target LS using covariance rendering */ - ivas_param_ism_rendering( hDirAC, rend_common_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + ivas_param_ism_rendering( hDirAC, hSpatParamRendCom, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, mixing_matrix, slot_idx, index_slot, nchan_out_woLFE, nchan_transport ); } @@ -938,7 +938,7 @@ void ivas_param_ism_dec( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( &( output_f[ch][slot_idx_start * rend_common_data->num_freq_bands] ), rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->num_freq_bands ); + set_zero( &( output_f[ch][slot_idx_start * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -950,14 +950,14 @@ void ivas_param_ism_dec( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * rend_common_data->num_freq_bands] ), - rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hSpatParamRendCom->num_freq_bands] ), + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); idx_in++; } @@ -1107,13 +1107,13 @@ void ivas_param_ism_dec_digest_tc( /* Direct Response/EFAP Gains */ float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; /* Initialization */ hDirAC = st_ivas->hDirAC; assert( hDirAC ); - rend_common_data = st_ivas->rend_common_data; - assert( rend_common_data ); + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + assert( hSpatParamRendCom ); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; @@ -1252,16 +1252,16 @@ void ivas_param_ism_dec_digest_tc( float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - cldfbAnalysis_ts( &( transport_channels_f[ch][rend_common_data->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, rend_common_data->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands], rend_common_data->num_freq_bands ); - mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands], rend_common_data->num_freq_bands ); + cldfbAnalysis_ts( &( transport_channels_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); + mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); ivas_param_ism_collect_slot( hDirAC, RealBuffer, ImagBuffer, ch, ref_power, cx_diag ); } } /* Obtain Mixing Matrix on a frame-level */ - for ( bin_idx = 0; bin_idx < rend_common_data->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { set_f( hDirAC->hParamIsmRendering->mixing_matrix_lin[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); } @@ -1297,7 +1297,7 @@ static void ivas_ism_param_dec_render_sf( float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX]; float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX]; DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; int16_t slot_idx_start; int16_t idx_in; @@ -1305,32 +1305,32 @@ static void ivas_ism_param_dec_render_sf( int16_t subframe_idx; hDirAC = st_ivas->hDirAC; - rend_common_data = st_ivas->rend_common_data; - slot_idx_start = rend_common_data->slots_rendered; - subframe_idx = rend_common_data->subframes_rendered; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + slot_idx_start = hSpatParamRendCom->slots_rendered; + subframe_idx = hSpatParamRendCom->subframes_rendered; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); - set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, rend_common_data->num_freq_bands ); + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); } } - for ( slot_idx = 0; slot_idx < rend_common_data->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; for ( ch = 0; ch < nchan_transport; ch++ ) { - Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands]; - Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * rend_common_data->num_freq_bands * nchan_transport + ch * rend_common_data->num_freq_bands]; + Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands]; + Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands]; } /* Compute bandwise rendering to target LS using covariance rendering */ - ivas_param_ism_render_slot( hDirAC, rend_common_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + ivas_param_ism_render_slot( hDirAC, hSpatParamRendCom, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->hParamIsmRendering->mixing_matrix_lin, index_slot, slot_idx, nchan_out_woLFE, nchan_transport ); } @@ -1343,7 +1343,7 @@ static void ivas_ism_param_dec_render_sf( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( output_f[ch], rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->num_freq_bands ); + set_zero( output_f[ch], hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1355,19 +1355,19 @@ static void ivas_ism_param_dec_render_sf( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < rend_common_data->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } cldfbSynthesis( RealBuffer, ImagBuffer, output_f[ch], - rend_common_data->num_freq_bands * rend_common_data->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); idx_in++; } } - rend_common_data->slots_rendered += rend_common_data->subframe_nbslots[subframe_idx]; - rend_common_data->subframes_rendered++; + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; + hSpatParamRendCom->subframes_rendered++; return; } @@ -1390,17 +1390,17 @@ void ivas_param_ism_dec_render( int16_t ch, slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, n_samples_sf; DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; IVAS_OUTPUT_SETUP hSetup; int16_t nchan_transport, nchan_out, nchan_out_woLFE; float *output_f_local[MAX_OUTPUT_CHANNELS]; hDirAC = st_ivas->hDirAC; - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSetup = st_ivas->hIntSetup; #ifdef DEBUGGING assert( hDirAC ); - assert( rend_common_data ); + assert( hSpatParamRendCom ); #endif nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) @@ -1417,14 +1417,14 @@ void ivas_param_ism_dec_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( rend_common_data->num_slots - rend_common_data->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = rend_common_data->subframes_rendered; + first_sf = hSpatParamRendCom->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= rend_common_data->subframe_nbslots[last_sf]; + slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; last_sf++; } #ifdef DEBUGGING @@ -1439,14 +1439,14 @@ void ivas_param_ism_dec_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { ivas_ism_param_dec_render_sf( st_ivas, hSetup, nchan_transport, nchan_out, nchan_out_woLFE, output_f_local ); - n_samples_sf = rend_common_data->subframe_nbslots[subframe_idx] * rend_common_data->slot_size; + n_samples_sf = hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->slot_size; for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] += n_samples_sf; } } - if ( rend_common_data->slots_rendered == rend_common_data->num_slots ) + if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { /* copy the memories */ /* store mixing matrix for next subframe */ @@ -1468,7 +1468,7 @@ void ivas_param_ism_dec_render( } } - *nSamplesAvailable = ( rend_common_data->num_slots - rend_common_data->slots_rendered ) * slot_size; + *nSamplesAvailable = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered ) * slot_size; return; } @@ -1485,7 +1485,7 @@ void ivas_param_ism_params_to_masa_param_mapping( ) { DIRAC_DEC_HANDLE hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; int16_t nBins; int16_t band_idx, bin_idx, sf_idx; int16_t brange[2]; @@ -1495,8 +1495,8 @@ void ivas_param_ism_params_to_masa_param_mapping( int32_t ivas_total_brate; hDirAC = st_ivas->hDirAC; - rend_common_data = st_ivas->rend_common_data; - nBins = rend_common_data->num_freq_bands; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nBins = hSpatParamRendCom->num_freq_bands; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -1518,7 +1518,7 @@ void ivas_param_ism_params_to_masa_param_mapping( float energy_ratio; energy_ratio = powf( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence, 2.0f ); - rend_common_data->numSimultaneousDirections = 1; + hSpatParamRendCom->numSimultaneousDirections = 1; azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); @@ -1526,19 +1526,19 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - rend_common_data->azimuth[sf_idx][bin_idx] = azimuth[0]; - rend_common_data->elevation[sf_idx][bin_idx] = elevation[0]; + hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; + hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; - rend_common_data->energy_ratio1[sf_idx][bin_idx] = energy_ratio; + hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = energy_ratio; - rend_common_data->spreadCoherence[sf_idx][bin_idx] = 0.0f; - rend_common_data->surroundingCoherence[sf_idx][bin_idx] = 0.0; + hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } else { - rend_common_data->numSimultaneousDirections = 2; + hSpatParamRendCom->numSimultaneousDirections = 2; for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) { brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; @@ -1556,12 +1556,12 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) { - rend_common_data->azimuth[sf_idx][bin_idx] = azimuth[0]; - rend_common_data->elevation[sf_idx][bin_idx] = elevation[0]; - rend_common_data->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; - rend_common_data->azimuth2[sf_idx][bin_idx] = azimuth[1]; - rend_common_data->elevation2[sf_idx][bin_idx] = elevation[1]; - rend_common_data->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; + hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; + hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; + hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; + hSpatParamRendCom->azimuth2[sf_idx][bin_idx] = azimuth[1]; + hSpatParamRendCom->elevation2[sf_idx][bin_idx] = elevation[1]; + hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; } } } @@ -1570,16 +1570,16 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - rend_common_data->spreadCoherence[sf_idx][bin_idx] = 0.0f; - rend_common_data->spreadCoherence2[sf_idx][bin_idx] = 0.0f; - rend_common_data->surroundingCoherence[sf_idx][bin_idx] = 0.0; + hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->spreadCoherence2[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } } else { - rend_common_data->numSimultaneousDirections = 1; + hSpatParamRendCom->numSimultaneousDirections = 1; azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); @@ -1587,11 +1587,11 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - rend_common_data->azimuth[sf_idx][bin_idx] = azimuth[0]; - rend_common_data->elevation[sf_idx][bin_idx] = elevation[0]; - rend_common_data->energy_ratio1[sf_idx][bin_idx] = 1.0f; - rend_common_data->spreadCoherence[sf_idx][bin_idx] = 0.0f; - rend_common_data->surroundingCoherence[sf_idx][bin_idx] = 0.0; + hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; + hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; + hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = 1.0f; + hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index bef4160ee5..ca0af62a31 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -298,7 +298,7 @@ ivas_error ivas_jbm_dec_tc( { #ifdef FIX_564 /* loudness correction */ - ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame ); + ivas_dirac_dec_binaural_sba_gain( output, nchan_remapped, output_frame ); #else float gain = 0.8414f; /* Todo: Temporary gain for roughly matching the loudness. To be tuned later together with other outputs. Also, this is not inline with ivas_dec() */ @@ -631,7 +631,7 @@ ivas_error ivas_jbm_dec_render( ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; float *p_tc[MAX_TRANSPORT_CHANNELS]; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; error = IVAS_ERR_OK; @@ -641,7 +641,7 @@ ivas_error ivas_jbm_dec_render( * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; output_Fs = st_ivas->hDecoderConfig->output_Fs; nchan_out = st_ivas->hDecoderConfig->nchan_out; nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; @@ -846,7 +846,7 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - int16_t offset = rend_common_data->slots_rendered * rend_common_data->slot_size; + int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size; 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 ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 74a23711d9..c2b1d2764a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -288,7 +288,7 @@ ivas_error ivas_masa_decode( } if ( st_ivas->hDirAC != NULL ) { - ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->rend_common_data, ivas_total_brate, ivas_format, 0, 0 ); + ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0 ); } st->next_bit_pos = next_bit_pos_orig; @@ -989,7 +989,7 @@ ivas_error ivas_masa_dec_reconfigure( /* close all unnecessary parametric decoding and rendering */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } } @@ -1135,17 +1135,17 @@ void ivas_spar_param_to_masa_param_mapping( int16_t slot_idx, slot_idx_start, sf; SPAR_DEC_HANDLE hSpar; float slot_fac; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; /* Set values */ hDirAC = st_ivas->hDirAC; - rend_common_data = st_ivas->rend_common_data; - rend_common_data->numSimultaneousDirections = 1; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + hSpatParamRendCom->numSimultaneousDirections = 1; hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; hSpar = st_ivas->hSpar; - dirac_write_idx = rend_common_data->render_to_md_map[subframe]; + dirac_write_idx = hSpatParamRendCom->render_to_md_map[subframe]; /* Init arrays */ for ( i = 0; i < FOA_CHANNELS; i++ ) @@ -1217,7 +1217,7 @@ void ivas_spar_param_to_masa_param_mapping( set_zero( transportSignalEnergies[1], nBins ); set_zero( transportSignalCrossCorrelation, nBins ); - for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -1277,13 +1277,13 @@ void ivas_spar_param_to_masa_param_mapping( ratio = I / fmaxf( 1e-12f, E ); /* Energy ratio */ ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) ); - rend_common_data->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); - rend_common_data->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); - rend_common_data->energy_ratio1[dirac_write_idx][bin] = ratio; - rend_common_data->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; + hSpatParamRendCom->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); + hSpatParamRendCom->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); + hSpatParamRendCom->energy_ratio1[dirac_write_idx][bin] = ratio; + hSpatParamRendCom->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; - rend_common_data->spreadCoherence[dirac_write_idx][bin] = 0.0f; - rend_common_data->surroundingCoherence[dirac_write_idx][bin] = 0.0f; + hSpatParamRendCom->spreadCoherence[dirac_write_idx][bin] = 0.0f; + hSpatParamRendCom->surroundingCoherence[dirac_write_idx][bin] = 0.0f; /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ if ( hDiffuseDist != NULL ) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 1ff66e098b..dd9305f668 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -737,13 +737,13 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->rend_common_data != NULL ) + else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered; - mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv @@ -797,7 +797,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -883,7 +883,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -1116,7 +1116,7 @@ static ivas_error ivas_mc_dec_reconfig( else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) { ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -1261,13 +1261,13 @@ static ivas_error ivas_mc_dec_reconfig( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->rend_common_data != NULL ) + if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } else if ( st_ivas->hParamMC != NULL ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index cb4033850b..cfa95af88e 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -142,13 +142,13 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( st_ivas->rend_common_data != NULL ) + else if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots; - st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes; - st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered; - mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /*-----------------------------------------------------------------* @@ -255,13 +255,13 @@ ivas_error ivas_sba_dec_reconfigure( } /* synchronize subframe info */ - if ( st_ivas->rend_common_data != NULL ) + if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } @@ -273,7 +273,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->renderer_type == RENDERER_DISABLE ) { ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( st_ivas->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -459,11 +459,11 @@ void ivas_sba_dec_render( uint16_t slot_size, ch; uint16_t nchan_internal, nchan_out; SPAR_DEC_HANDLE hSpar; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; hSpar = st_ivas->hSpar; - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; @@ -512,11 +512,11 @@ void ivas_sba_dec_render( { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 58318f4dc9..7be6de64c9 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -320,7 +320,7 @@ ivas_error ivas_spar_dec( /* read DirAC bitstream */ if ( st_ivas->hQMetaData != NULL ) { - ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->rend_common_data, st_ivas->hQMetaData, nb_bits_read, + ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); } @@ -1298,7 +1298,7 @@ void ivas_spar_dec_upmixer( ) { SPAR_DEC_HANDLE hSpar; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; int16_t nchan_transport, nchan_out; int16_t subframe_idx, n, i; int16_t n_samples_sf; @@ -1378,16 +1378,16 @@ void ivas_spar_dec_upmixer( st_ivas->hTcBuffer->tc[n] = NULL; } - if ( st_ivas->hDirAC != NULL && st_ivas->rend_common_data != NULL ) + if ( st_ivas->hDirAC != NULL && st_ivas->hSpatParamRendCom != NULL ) { - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index d78595ba71..b2d28f6f3d 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2891,8 +2891,8 @@ void ivas_spar_to_dirac( end_band = min( num_bands_out, SPAR_DIRAC_SPLIT_START_BAND ) / bw; hDirAC = st_ivas->hDirAC; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; - rend_common_data = st_ivas->rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; dirac_to_spar_md_bands = st_ivas->hSpar->dirac_to_spar_md_bands; enc_param_start_band = st_ivas->hSpar->enc_param_start_band / bw; @@ -3014,38 +3014,38 @@ void ivas_spar_to_dirac( ele_dith = ele[band]; #endif - rend_common_data->energy_ratio1[block][b] = en_ratio; + hSpatParamRendCom->energy_ratio1[block][b] = en_ratio; tmp_write_idx_band = tmp_write_idx_param_band; if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - rend_common_data->elevation[tmp_write_idx_band][b] = ele_dith; - rend_common_data->azimuth[tmp_write_idx_band][b] = azi_dith; - rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; } else { for ( ts = ts_start; ts < ts_end; ts++ ) { - rend_common_data->elevation[tmp_write_idx_band][b] = ele_dith; - rend_common_data->azimuth[tmp_write_idx_band][b] = azi_dith; - rend_common_data->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } } - tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % rend_common_data->dirac_md_buffer_length; + tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hSpatParamRendCom->dirac_md_buffer_length; } } /* update buffer write index */ if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % rend_common_data->dirac_md_buffer_length; + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % rend_common_data->dirac_md_buffer_length; + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % hSpatParamRendCom->dirac_md_buffer_length; } } else diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 005934c07f..c611017046 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -396,40 +396,9 @@ typedef struct } ISM_DTX_DATA_DEC; /*----------------------------------------------------------------------------------* - * DirAC decoder structure + * DirAC decoder structures *----------------------------------------------------------------------------------*/ -typedef struct dirac_dec_stack_mem -{ - /*Decorrelator*/ - float *frame_dec_f; - - /*Prototypes*/ - float *proto_direct_buffer_f; - float *proto_diffuse_buffer_f; - - /*Prototype NRGs*/ - float *proto_power_smooth; - float *proto_power_diff_smooth; - - /*Gain or power factors for directional and diffuse streams*/ - float *direct_power_factor; - float *diffuse_power_factor; - - /*Directional responses (gains & Nrg)*/ - float *direct_responses; - float *direct_responses_square; - - /* Target co-variance mtx */ - float *cy_auto_dir_smooth; - float *cy_cross_dir_smooth; - float *cy_auto_diff_smooth; - - float *reference_power; - float *onset_filter; - -} DIRAC_DEC_STACK_MEM, *DIRAC_DEC_STACK_MEM_HANDLE; - typedef struct param_ism_rendering { float *proto_matrix; @@ -442,68 +411,32 @@ typedef struct param_ism_rendering } PARAM_ISM_RENDERING_DATA, *PARAM_ISM_RENDERING_HANDLE; -/*Output synthesis*/ -typedef struct dirac_output_synthesis_params_structure -{ - int16_t max_band_decorr; - - int16_t use_onset_filters; - - float *interpolator; - float *alpha_synthesis; - float *alpha_synthesis_fast; - int16_t numAlphas; - int16_t numAlphasFast; - - float *proto_matrix; - - float diffuse_compensation_factor; - float diffuse_compensation_factor_decorr; - -} DIRAC_OUTPUT_SYNTHESIS_PARAMS; - -typedef struct dirac_output_synthesis_state_structure +/* ===== DirAC main structure ===== */ +typedef struct ivas_dirac_dec_data_structure { - /* only pointer to local buffers */ - float *direct_responses; /* direct responses for DOA of current frame. Size: num_freq_bands*num_channels. */ - float *direct_responses_square; - float *diffuse_responses_square; /* squared diffuse responses. Size: num_channels. */ - - /* only pointer to local buffers */ - float *direct_power_factor; - float *diffuse_power_factor; - - float *proto_power_smooth; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ - float *proto_power_smooth_prev; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ - - float *proto_power_diff_smooth; - float *proto_power_diff_smooth_prev; + DIRAC_CONFIG_DATA_HANDLE hConfig; - /* only pointer to local buffers */ - float *proto_direct_buffer_f; /* Buffer for direct sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ - float *proto_diffuse_buffer_f; /* Buffer for diffuse sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ + /*Parameter decoding*/ + float azimuth_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; + float elevation_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - /* Output gain memories */ - float *gains_dir_prev; /* Direct sound gains of current synthesis block. Size: num_freq_bands*num_channel. */ - float *gains_diff_prev; /* Diffuse sound gains of previous synthesis block. Size: num_freq_bands*num_channel. */ + int16_t dithering_seed; + int16_t spar_to_dirac_write_idx; - /* only pointer to local buffers */ - float *cy_auto_dir_smooth; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ - float *cy_cross_dir_smooth; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ - float *cy_auto_diff_smooth; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + /*sub-modules*/ + PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ + float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; + PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; - /* PSD memories */ - float *cy_auto_dir_smooth_prev; /* Target auto PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ - float *cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ - float *cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + IVAS_FB_MIXER_HANDLE hFbMdft; - const float *onset_filter; +} DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; - /* Temporal smoothing memories */ - float *reference_power_smooth_prev; - float *direction_smoothness_prev; -} DIRAC_OUTPUT_SYNTHESIS_STATE; +/*----------------------------------------------------------------------------------* + * ParamMC structures + *----------------------------------------------------------------------------------*/ typedef struct dirac_output_synthesis_cov_state_structure { @@ -532,118 +465,6 @@ typedef struct dirac_output_synthesis_cov_state_structure } DIRAC_OUTPUT_SYNTHESIS_COV_STATE; -/* MASA stereo transport signal type detection structure */ -typedef struct -{ - MASA_TRANSPORT_SIGNAL_TYPE masa_stereo_type; - MASA_TRANSPORT_SIGNAL_TYPE current_stereo_type; - MASA_TRANSPORT_SIGNAL_TYPE type_change_direction; - - int16_t dipole_freq_range[2]; - - float left_bb_power; - float right_bb_power; - float total_bb_power; - - float left_hi_power; - float right_hi_power; - float total_hi_power; - - float sum_power[MASA_SUM_FREQ_RANGE_BINS]; - float total_power[MASA_SUM_FREQ_RANGE_BINS]; - - float subtract_power_y; - float subtract_power_y_smooth; - float target_power_y_smooth; - - float lr_total_bb_ratio_db; - float lr_total_hi_ratio_db; - float min_sum_total_ratio_db; - float subtract_target_ratio_db; - - int16_t counter; - int16_t interpolator; - -} MASA_STEREO_TYPE_DETECT; - - -/* ===== DirAC main structure ===== */ -typedef struct ivas_dirac_dec_data_structure -{ - DIRAC_CONFIG_DATA_HANDLE hConfig; - - /*Parameter decoding*/ - float azimuth_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; - float elevation_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - int16_t dithering_seed; - int16_t spar_to_dirac_write_idx; - - /*sub-modules*/ - PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ - float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; - PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; - - IVAS_FB_MIXER_HANDLE hFbMdft; - -} DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; - - -typedef struct ivas_dirac_rend_data_structure -{ - IVAS_OUTPUT_SETUP hOutSetup; - - /*Parameter estimation*/ - int16_t index_buffer_intensity; - float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; - float *buffer_energy; - - float *frequency_axis; - float *diffuse_response_function; - float *hoa_encoder; - const float *hoa_decoder; - - /*Decoder parameters */ - /*Prototypes*/ - int16_t num_outputs_dir; - int16_t num_outputs_diff; - int16_t num_protos_dir; - int16_t num_protos_diff; - int16_t num_protos_ambi; - DIRAC_SYNTHESIS_CONFIG synthesisConf; - DIRAC_PANNING_CONFIG panningConf; - - /* prototype computing */ - int16_t *proto_index_dir; - int16_t *proto_index_diff; - - int16_t proto_signal_decorr_on; - - /*Decoder states=memories*/ - float *proto_frame_f; - float *proto_frame_dec_f; - - DIRAC_DEC_STACK_MEM stack_mem; - MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect; - - int16_t num_ele_spk_no_diffuse_rendering; - - const int16_t *sba_map_tc; - - DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_psd_params; - DIRAC_OUTPUT_SYNTHESIS_STATE h_output_synthesis_psd_state; - - HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; - HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; - -} DIRAC_REND_DATA, *DIRAC_REND_HANDLE; - - -/*----------------------------------------------------------------------------------* - * ParamMC structures - *----------------------------------------------------------------------------------*/ - typedef struct ivas_param_mc_diff_proto_info_structure { int16_t num_protos_diff; @@ -938,48 +759,6 @@ typedef struct ivas_lfe_dec_data_structure } LFE_DEC_DATA, *LFE_DEC_HANDLE; -// Note: the following structures are used only in lib_dec but this would likely change in the future -/*----------------------------------------------------------------------------------* - * VBAP structures - *----------------------------------------------------------------------------------*/ - -/* Defines a single virtual surface triplet of loudspeakers - * with a precalculated inverse matrix */ -typedef struct vbap_vs_triplet_structure -{ - uint8_t speaker_node[3]; - float inverse_matrix[3][3]; - -} VBAP_VS_TRIPLET; - - -/* Storage structure for fast runtime triplet search */ -typedef struct triplet_search_structure -{ - VBAP_VS_TRIPLET *triplets; - int16_t num_triplets; - int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; - -} VBAP_SEARCH_STRUCT; - - -/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ -typedef struct vbap_data_structure -{ - VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ - int16_t num_search_structs; - int16_t num_speaker_nodes; - int16_t num_speaker_nodes_internal; - int16_t top_virtual_speaker_node_index; /* These indices can be negative */ - int16_t bottom_virtual_speaker_node_index; - int16_t back_virtual_speaker_node_index; - float *bottom_virtual_speaker_node_division_gains; - float *top_virtual_speaker_node_division_gains; - float *back_virtual_speaker_node_division_gains; - -} VBAP_DATA, *VBAP_HANDLE; - - /*----------------------------------------------------------------------------------* * renderer structures *----------------------------------------------------------------------------------*/ @@ -1022,39 +801,6 @@ typedef struct ivas_binaural_rendering_struct * MASA decoder structures *----------------------------------------------------------------------------------*/ -/* McMASA LFE synthesis structure */ -typedef struct ivas_mcmasa_lfe_synth_struct -{ - float lfeToTotalEnergyRatio[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t lfeGainPrevIndex; - float transportEneSmooth; - float protoLfeEneSmooth; - float targetEneLfeSmooth; - float targetEneTransSmooth; - - float *lfeSynthRingBuffer; - int16_t ringBufferLoPointer; - int16_t ringBufferHiPointer; - float lowpassSum; - int16_t ringBufferSize; - - float *lfeSynthRingBuffer2; - int16_t ringBufferLoPointer2; - float lowpassSum2; - int16_t ringBufferSize2; - - float *delayBuffer_syncLp; - int16_t delayBuffer_syncLp_size; - - float *delayBuffer_syncDirAC; - int16_t delayBuffer_syncDirAC_size; - - float lfeGainPrev; - float transportGainPrev; - float interpolator[CLDFB_NO_CHANNELS_MAX]; - -} MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; - typedef struct ivas_masa_decoder_ext_out_meta_struct { MASA_DECRIPTIVE_META descriptiveMeta; @@ -1248,7 +994,7 @@ typedef struct Decoder_Struct EXTERNAL_ORIENTATION_HANDLE hExtOrientationData; /* External orientation data structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; /* Combined external and head orientation data structure */ DIRAC_REND_HANDLE hDirACRend; /* DirAC renderer handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; /* Spatial parametric (DirAC rend, ParamBin, ParamISM) rendering common data handle. */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; /* Spatial parametric (DirAC rend, ParamBin, ParamISM) rendering common data handle. */ /* JBM module */ DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index bddbc4f506..8a3f33b80b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -74,6 +74,18 @@ typedef struct hrtfGainCache float shVec[HRTF_SH_CHANNELS]; } PARAMBIN_HRTF_GAIN_CACHE; +typedef struct parambin_rend_config_data +{ + int16_t separateCenterChannelRendering; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; + float qualityBasedSmFactor; + int16_t processReverb; + +} PARAMBIN_REND_CONFIG, *PARAMBIN_REND_CONFIG_HANDLE; + /*------------------------------------------------------------------------- * Local function prototypes @@ -83,11 +95,11 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); -static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); +static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); -static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); +static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); @@ -104,18 +116,21 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); +// Todo Tapani refactor: Create separate init & render functions for MASA external renderer. The decoder versions would become too complex if generalized. + /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() * * Initialize parametric binaural renderer *------------------------------------------------------------------------*/ +// Todo Tapani refactor: To be moved to lib_dec ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ ) { - DIRAC_DEC_BIN_HANDLE hBinaural; + DIRAC_DEC_BIN_HANDLE hDiracDecBin; int16_t nBins; int32_t output_Fs; RENDERER_TYPE renderer_type; @@ -124,46 +139,46 @@ ivas_error ivas_dirac_dec_init_binaural_data( ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; - hBinaural = st_ivas->hDiracDecBin; + hDiracDecBin = st_ivas->hDiracDecBin; - if ( hBinaural == NULL ) + if ( hDiracDecBin == NULL ) { - if ( ( hBinaural = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } - hBinaural->hTdDecorr = NULL; - hBinaural->hReverb = NULL; - hBinaural->h_freq_domain_decorr_ap_params = NULL; - hBinaural->h_freq_domain_decorr_ap_state = NULL; + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; } output_Fs = st_ivas->hDecoderConfig->output_Fs; - nBins = st_ivas->rend_common_data->num_freq_bands; + nBins = st_ivas->hSpatParamRendCom->num_freq_bands; renderer_type = st_ivas->renderer_type; for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) { - set_zero( hBinaural->processMtxRe[j][k], nBins ); - set_zero( hBinaural->processMtxIm[j][k], nBins ); + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); } for ( k = 0; k < BINAURAL_CHANNELS; k++ ) { - set_zero( hBinaural->processMtxDecRe[j][k], nBins ); - set_zero( hBinaural->processMtxDecIm[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); } - set_zero( hBinaural->ChEnePrev[j], nBins ); - set_zero( hBinaural->ChEneOutPrev[j], nBins ); + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); } - set_zero( hBinaural->ChCrossRePrev, nBins ); - set_zero( hBinaural->ChCrossImPrev, nBins ); - set_zero( hBinaural->ChCrossReOutPrev, nBins ); - set_zero( hBinaural->ChCrossImOutPrev, nBins ); - hBinaural->renderStereoOutputInsteadOfBinaural = 0; + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; for ( bin = 0; bin < nBins; bin++ ) @@ -171,35 +186,35 @@ ivas_error ivas_dirac_dec_init_binaural_data( binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hBinaural->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); } for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) { - hBinaural->diffuseFieldCoherenceX[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; - hBinaural->diffuseFieldCoherenceY[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; - hBinaural->diffuseFieldCoherenceZ[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; + hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; + hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; } if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ { - set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hBinaural->hReverb = NULL; + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) || - ( hBinaural->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || + ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) { - ivas_binaural_reverb_close( &( hBinaural->hReverb ) ); + ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); } - if ( hBinaural->hReverb == NULL ) + if ( hDiracDecBin->hReverb == NULL ) { - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + if ( ( error = ivas_binaural_reverb_open( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, @@ -214,37 +229,37 @@ ivas_error ivas_dirac_dec_init_binaural_data( } else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) { - set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hBinaural->hReverb = NULL; - hBinaural->renderStereoOutputInsteadOfBinaural = 1; + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; } else /* Not valid renderer type for this renderer */ { assert( false ); } - hBinaural->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ - if ( hBinaural->hTdDecorr == NULL ) + if ( hDiracDecBin->hTdDecorr == NULL ) { - hBinaural->useTdDecorr = 0; + hDiracDecBin->useTdDecorr = 0; } - if ( hBinaural->h_freq_domain_decorr_ap_params != NULL ) + if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) { - ivas_dirac_dec_decorr_close( &hBinaural->h_freq_domain_decorr_ap_params, &hBinaural->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hBinaural->hTdDecorr ), &( hBinaural->useTdDecorr ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } - if ( !hBinaural->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) + if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) { ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hBinaural->h_freq_domain_decorr_ap_params ), - &( hBinaural->h_freq_domain_decorr_ap_state ), + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), nBins, BINAURAL_CHANNELS, BINAURAL_CHANNELS, @@ -257,9 +272,9 @@ ivas_error ivas_dirac_dec_init_binaural_data( } } - hBinaural->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); - st_ivas->hDiracDecBin = hBinaural; + st_ivas->hDiracDecBin = hDiracDecBin; /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) @@ -362,6 +377,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( * *------------------------------------------------------------------------*/ +// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -374,13 +390,13 @@ void ivas_dirac_dec_binaural_render( int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, ch; uint16_t nchan_out; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_out = BINAURAL_CHANNELS; #ifdef DEBUGGING - assert( rend_common_data ); + assert( hSpatParamRendCom ); #endif for ( ch = 0; ch < nchan_out; ch++ ) { @@ -389,14 +405,14 @@ void ivas_dirac_dec_binaural_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( rend_common_data->num_slots - rend_common_data->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = rend_common_data->subframes_rendered; + first_sf = hSpatParamRendCom->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= rend_common_data->subframe_nbslots[last_sf]; + slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; last_sf++; } @@ -405,7 +421,7 @@ void ivas_dirac_dec_binaural_render( #endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { - int16_t n_samples_sf = slot_size * rend_common_data->subframe_nbslots[subframe_idx]; + int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe_idx]; ivas_dirac_dec_binaural_internal( st_ivas, st_ivas->hCombinedOrientationData, output_f_local, nchan_transport, subframe_idx ); for ( ch = 0; ch < nchan_out; ch++ ) { @@ -413,12 +429,12 @@ void ivas_dirac_dec_binaural_render( } } - if ( rend_common_data->slots_rendered == rend_common_data->num_slots ) + if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } - *nSamplesAvailable = ( rend_common_data->num_slots - rend_common_data->slots_rendered ) * slot_size; + *nSamplesAvailable = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered ) * slot_size; return; } @@ -426,12 +442,13 @@ void ivas_dirac_dec_binaural_render( #ifdef FIX_564 /*------------------------------------------------------------------------- - * ivas_dirac_dec_binaural_gain() + * ivas_dirac_dec_binaural_sba_gain() * * loudness correction for parametric binaural renderer *------------------------------------------------------------------------*/ -void ivas_dirac_dec_binaural_gain( +// Todo Tapani refactor: To be moved to lib_dec +void ivas_dirac_dec_binaural_sba_gain( float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ @@ -465,6 +482,7 @@ void ivas_dirac_dec_binaural_gain( * Parametric binaural renderer main function *------------------------------------------------------------------------*/ +// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ @@ -473,13 +491,13 @@ void ivas_dirac_dec_binaural( ) { int16_t subframe; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float cng_td_buffer[L_FRAME16k]; float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; int16_t slot_size; int16_t numInChannels; - rend_common_data = st_ivas->rend_common_data; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) @@ -526,7 +544,7 @@ void ivas_dirac_dec_binaural( for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) { - int16_t n_samples_sf = slot_size * rend_common_data->subframe_nbslots[subframe]; + int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe]; ivas_dirac_dec_binaural_internal( st_ivas, hCombinedOrientationData, p_output, nchan_transport, subframe ); @@ -534,7 +552,7 @@ void ivas_dirac_dec_binaural( { p_output[ch] += n_samples_sf; } - rend_common_data->dirac_read_idx = ( rend_common_data->dirac_read_idx + 1 ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) @@ -550,7 +568,7 @@ void ivas_dirac_dec_binaural( * Local functions *------------------------------------------------------------------------*/ - +// Todo refactor: To be moved to lib_dec static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, @@ -558,7 +576,9 @@ static void ivas_dirac_dec_binaural_internal( const int16_t nchan_transport, const int16_t subframe ) { - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; + DIRAC_DEC_BIN_HANDLE hDiracDecBin; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + PARAMBIN_REND_CONFIG config_data; int16_t slot, ch, numInChannels; float Cldfb_RealBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -568,13 +588,24 @@ static void ivas_dirac_dec_binaural_internal( int16_t nBins, offsetSamples; int16_t i, j; - rend_common_data = st_ivas->rend_common_data; - nBins = rend_common_data->num_freq_bands; - offsetSamples = rend_common_data->slots_rendered * nBins; + hDiracDecBin = st_ivas->hDiracDecBin; + assert( hDiracDecBin ); + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nBins = hSpatParamRendCom->num_freq_bands; + offsetSamples = hSpatParamRendCom->slots_rendered * nBins; + + /* Setuo internal config */ + config_data.separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + config_data.ivas_format = st_ivas->ivas_format; + config_data.mc_mode = st_ivas->mc_mode; + config_data.ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + config_data.nchan_transport = st_ivas->nchan_transport; + config_data.qualityBasedSmFactor = st_ivas->hMasa != NULL ? st_ivas->hMasa->data.dir_decode_quality : 1.0f; + config_data.processReverb = st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; - if ( st_ivas->hOutSetup.separateChannelEnabled ) + if ( config_data.separateCenterChannelRendering ) { numInChannels++; } @@ -592,7 +623,7 @@ static void ivas_dirac_dec_binaural_internal( Rmat[2][2] = 1.0f; /* CLDFB Analysis of input */ - for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( ch = 0; ch < numInChannels; ch++ ) { @@ -604,7 +635,7 @@ static void ivas_dirac_dec_binaural_internal( Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); } - else if ( st_ivas->nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + else if ( config_data.nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ { /* At mono input duplicate the channel to dual-mono */ mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); @@ -619,7 +650,7 @@ static void ivas_dirac_dec_binaural_internal( int16_t slotInFrame; numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; - slotInFrame = rend_common_data->slots_rendered + slot; + slotInFrame = hSpatParamRendCom->slots_rendered + slot; generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], @@ -671,7 +702,7 @@ static void ivas_dirac_dec_binaural_internal( } } - if ( st_ivas->hDiracDecBin->useTdDecorr ) + if ( hDiracDecBin->useTdDecorr ) { for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { @@ -681,7 +712,7 @@ static void ivas_dirac_dec_binaural_internal( Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); - if ( st_ivas->nchan_transport == 1 && st_ivas->ivas_format == SBA_FORMAT ) + if ( config_data.nchan_transport == 1 && config_data.ivas_format == SBA_FORMAT ) { v_multc( Cldfb_RealBuffer_in[ch][slot], INV_SQRT_2, Cldfb_RealBuffer_in[ch][slot], nBins ); v_multc( Cldfb_ImagBuffer_in[ch][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[ch][slot], nBins ); @@ -690,9 +721,9 @@ static void ivas_dirac_dec_binaural_internal( } } - if ( st_ivas->ivas_format == SBA_FORMAT ) + if ( config_data.ivas_format == SBA_FORMAT ) { - st_ivas->hDiracDecBin->hDiffuseDist = &diffuseDistData; + hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); @@ -711,37 +742,37 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { - adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, rend_common_data->subframe_nbslots[subframe], Rmat ); + adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, rend_common_data->subframe_nbslots[subframe], Rmat ); + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); } } - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); - if ( st_ivas->ivas_format == ISM_FORMAT ) + if ( config_data.ivas_format == ISM_FORMAT ) { max_band_decorr = 0; } - else if ( st_ivas->hDiracDecBin->useTdDecorr ) + else if ( hDiracDecBin->useTdDecorr ) { max_band_decorr = CLDFB_NO_CHANNELS_MAX; } else { - max_band_decorr = st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; + max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; } - ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat, + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); - ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, subframe ); + ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); - st_ivas->hDiracDecBin->hDiffuseDist = NULL; + hDiracDecBin->hDiffuseDist = NULL; - rend_common_data->slots_rendered += rend_common_data->subframe_nbslots[subframe]; - rend_common_data->subframes_rendered++; + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; + hSpatParamRendCom->subframes_rendered++; return; } @@ -803,7 +834,9 @@ static void ivas_dirac_dec_decorrelate_slot( static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( - Decoder_Struct *st_ivas, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], @@ -811,11 +844,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric const int16_t isHeadtracked ) { int16_t ch, slot, bin; - uint8_t separateCenterChannelRendering; + int16_t separateCenterChannelRendering; int16_t nBins, idx; float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; - DIRAC_DEC_BIN_HANDLE h; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; float IIReneLimiterFactor; float qualityBasedSmFactor; float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; @@ -823,24 +854,30 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric int16_t dirac_read_idx; float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; - - - h = st_ivas->hDiracDecBin; - rend_common_data = st_ivas->rend_common_data; - - separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = rend_common_data->num_freq_bands; /* Actually bins */ - - set_zero( h->ChCrossRe, nBins ); - set_zero( h->ChCrossIm, nBins ); - set_zero( h->ChCrossReOut, nBins ); - set_zero( h->ChCrossImOut, nBins ); + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; + + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + qualityBasedSmFactor = hConfig->qualityBasedSmFactor; + qualityBasedSmFactor *= qualityBasedSmFactor; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + + set_zero( hDiracDecBin->ChCrossRe, nBins ); + set_zero( hDiracDecBin->ChCrossIm, nBins ); + set_zero( hDiracDecBin->ChCrossReOut, nBins ); + set_zero( hDiracDecBin->ChCrossImOut, nBins ); for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - set_zero( h->ChEne[ch], nBins ); - set_zero( h->ChEneOut[ch], nBins ); + set_zero( hDiracDecBin->ChEne[ch], nBins ); + set_zero( hDiracDecBin->ChEneOut[ch], nBins ); } - set_zero( h->frameMeanDiffuseness, nBins ); + set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); @@ -851,10 +888,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; - if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { applyLowBitRateEQ = 1; - if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_16k4 ) + if ( ivas_total_brate == IVAS_16k4 ) { for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { @@ -872,10 +909,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = rend_common_data->render_to_md_map[subframe]; + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; /* Calculate input covariance matrix */ - for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -885,13 +922,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); - h->ChEne[ch][bin] += instEne; + hDiracDecBin->ChEne[ch][bin] += instEne; subFrameTotalEne[bin] += instEne; } - h->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; - h->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; - h->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; - h->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; + hDiracDecBin->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + hDiracDecBin->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; } } @@ -910,13 +947,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 2 ) + if ( ivas_format == SBA_FORMAT && nchan_transport == 2 ) { float tempRe, tempIm; set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - for ( slot = 0; slot < rend_common_data->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -940,10 +977,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match * the early spectrum of the BRIR data, using the spectral correction data in * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ - meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + meanEnePerCh = hDiracDecBin->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - for ( dirIndex = 0; dirIndex < rend_common_data->numSimultaneousDirections; dirIndex++ ) + for ( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) { int16_t aziDeg, eleDeg; float lRealp, lImagp, rRealp, rImagp; @@ -952,14 +989,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ { - aziDeg = rend_common_data->azimuth[dirac_read_idx][bin]; - eleDeg = rend_common_data->elevation[dirac_read_idx][bin]; - ratio = rend_common_data->energy_ratio1[dirac_read_idx][bin]; - spreadCoh = rend_common_data->spreadCoherence[dirac_read_idx][bin]; + aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; + ratio = hSpatParamRendCom->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence[dirac_read_idx][bin]; } else /* For second of the two simultaneous directions */ { - if ( ( ratio = rend_common_data->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) + if ( ( ratio = hSpatParamRendCom->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) { /* This touches only MASA path where second direction always has smaller ratio and * for non-2dir it is zero. As the whole direction contribution is multiplied with @@ -967,9 +1004,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * it is better to save complexity. */ continue; } - aziDeg = rend_common_data->azimuth2[dirac_read_idx][bin]; - eleDeg = rend_common_data->elevation2[dirac_read_idx][bin]; - spreadCoh = rend_common_data->spreadCoherence2[dirac_read_idx][bin]; + aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence2[dirac_read_idx][bin]; } diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ @@ -987,9 +1024,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric spreadCoh = max( spreadCoh, altSpreadCoh ); } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); - if ( h->renderStereoOutputInsteadOfBinaural ) + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { /* Synthesizing spread coherence is not needed for stereo loudspeaker output, * as directional sound is reproduced with two loudspeakers in any case */ @@ -1030,7 +1067,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric rImagp *= centerMul; /* Apply the gain for the left source of the three coherent sources */ - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1040,7 +1077,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1068,7 +1105,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric w3 = 2.0f * spreadCoh - 1.0f; } - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) { idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); @@ -1098,68 +1135,60 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Add direct part (1 or 2) covariance matrix */ dirEne = ratio * meanEnePerCh; - h->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ - h->ChEneOut[1][bin] += dirEne * hrtfEne[1]; - h->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ - h->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + hDiracDecBin->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + hDiracDecBin->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + hDiracDecBin->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + hDiracDecBin->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ } /* Add diffuse / ambient part covariance matrix */ diffuseness = max( 0.0f, diffuseness ); diffEne = diffuseness * meanEnePerCh; - surCoh = rend_common_data->surroundingCoherence[dirac_read_idx][bin]; - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + surCoh = hSpatParamRendCom->surroundingCoherence[dirac_read_idx][bin]; + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) { - if ( !h->renderStereoOutputInsteadOfBinaural ) + if ( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; } } - h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ - h->ChEneOut[1][bin] += diffEne; + hDiracDecBin->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + hDiracDecBin->ChEneOut[1][bin] += diffEne; - if ( h->renderStereoOutputInsteadOfBinaural ) + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ - h->ChCrossReOut[bin] += surCoh * diffEne; + hDiracDecBin->ChCrossReOut[bin] += surCoh * diffEne; } else /* When rendering binaural, ambience has frequency dependent ICC. */ { - if ( st_ivas->ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + if ( ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) { float diffuseFieldCoherence; - diffuseFieldCoherence = h->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + h->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + h->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; - h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + diffuseFieldCoherence = hDiracDecBin->hDiffuseDist->diffuseRatioX[bin] * hDiracDecBin->diffuseFieldCoherenceX[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioY[bin] * hDiracDecBin->diffuseFieldCoherenceY[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioZ[bin] * hDiracDecBin->diffuseFieldCoherenceZ[bin]; + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; } else { - h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * h->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * hDiracDecBin->diffuseFieldCoherence[bin] + surCoh ) * diffEne; } } /* Store parameters for formulating average diffuseness over frame */ - h->frameMeanDiffuseness[bin] += diffEne; + hDiracDecBin->frameMeanDiffuseness[bin] += diffEne; frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; } /* Formulate average diffuseness over frame */ for ( bin = 0; bin < nBins; bin++ ) { - h->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); - } - - /* Determine encoding quality based additional smoothing factor */ - qualityBasedSmFactor = 1.0f; - if ( st_ivas->hMasa != NULL ) - { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; + hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); } - /* Temporal IIR-type smoothing of covariance matrices */ - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); } @@ -1174,41 +1203,41 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that * the energy history (IIR) must not be more than double of the current frame energy. This provides more * robust performance at energy offsets when compared to typical IIR averaging. */ - eneRatio = ( h->ChEne[0][bin] + h->ChEne[1][bin] ) / fmaxf( 1e-12f, ( h->ChEnePrev[0][bin] + h->ChEnePrev[1][bin] ) ); + eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); - h->ChCrossRe[bin] *= qualityBasedSmFactor; - h->ChCrossIm[bin] *= qualityBasedSmFactor; - h->ChCrossReOut[bin] *= qualityBasedSmFactor; - h->ChCrossImOut[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - h->ChEne[ch][bin] *= qualityBasedSmFactor; - h->ChEneOut[ch][bin] *= qualityBasedSmFactor; + hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; + hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; } - h->ChCrossRe[bin] += IIReneLimiter * h->ChCrossRePrev[bin]; - h->ChCrossIm[bin] += IIReneLimiter * h->ChCrossImPrev[bin]; - h->ChCrossReOut[bin] += IIReneLimiter * h->ChCrossReOutPrev[bin]; - h->ChCrossImOut[bin] += IIReneLimiter * h->ChCrossImOutPrev[bin]; + hDiracDecBin->ChCrossRe[bin] += IIReneLimiter * hDiracDecBin->ChCrossRePrev[bin]; + hDiracDecBin->ChCrossIm[bin] += IIReneLimiter * hDiracDecBin->ChCrossImPrev[bin]; + hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossReOutPrev[bin]; + hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossImOutPrev[bin]; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - h->ChEne[ch][bin] += IIReneLimiter * h->ChEnePrev[ch][bin]; - h->ChEneOut[ch][bin] += IIReneLimiter * h->ChEneOutPrev[ch][bin]; + hDiracDecBin->ChEne[ch][bin] += IIReneLimiter * hDiracDecBin->ChEnePrev[ch][bin]; + hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter * hDiracDecBin->ChEneOutPrev[ch][bin]; } /* Store energy values and coefficients for next round */ - h->ChCrossRePrev[bin] = h->ChCrossRe[bin]; - h->ChCrossImPrev[bin] = h->ChCrossIm[bin]; - h->ChCrossReOutPrev[bin] = h->ChCrossReOut[bin]; - h->ChCrossImOutPrev[bin] = h->ChCrossImOut[bin]; + hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; + hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; + hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; + hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - h->ChEnePrev[ch][bin] = h->ChEne[ch][bin]; - h->ChEneOutPrev[ch][bin] = h->ChEneOut[ch][bin]; + hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; + hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; } } @@ -1217,22 +1246,28 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric static void ivas_dirac_dec_binaural_determine_processing_matrices( - Decoder_Struct *st_ivas, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ) { int16_t chA, chB, bin; - uint8_t separateCenterChannelRendering; + int16_t separateCenterChannelRendering; int16_t nBins; - DIRAC_DEC_BIN_HANDLE h; - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data; PARAMBIN_HRTF_GAIN_CACHE gainCache; - - h = st_ivas->hDiracDecBin; - rend_common_data = st_ivas->rend_common_data; - separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = rend_common_data->num_freq_bands; /* Actually bins */ + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; + + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ gainCache.azi = -1000; /* Use -1000 as value for uninitialized cache. */ @@ -1250,21 +1285,21 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( CrEneR = 0.0f; /* Formulate main processing matrix M */ - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], - h->ChCrossRe[bin], h->ChCrossIm[bin], - h->ChEneOut[0][bin], h->ChEneOut[1][bin], - h->ChCrossReOut[bin], h->ChCrossImOut[bin], - prototypeMtx, Mre, Mim, h->reqularizationFactor ); + formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], + hDiracDecBin->ChCrossRe[bin], hDiracDecBin->ChCrossIm[bin], + hDiracDecBin->ChEneOut[0][bin], hDiracDecBin->ChEneOut[1][bin], + hDiracDecBin->ChCrossReOut[bin], hDiracDecBin->ChCrossImOut[bin], + prototypeMtx, Mre, Mim, hDiracDecBin->reqularizationFactor ); /* Load estimated covariance matrix to the [2][2] matrix form */ - CxRe[0][0] = h->ChEne[0][bin]; - CxRe[1][1] = h->ChEne[1][bin]; - CxRe[1][0] = h->ChCrossRe[bin]; - CxRe[0][1] = h->ChCrossRe[bin]; + CxRe[0][0] = hDiracDecBin->ChEne[0][bin]; + CxRe[1][1] = hDiracDecBin->ChEne[1][bin]; + CxRe[1][0] = hDiracDecBin->ChCrossRe[bin]; + CxRe[0][1] = hDiracDecBin->ChCrossRe[bin]; CxIm[0][0] = 0.0f; CxIm[1][1] = 0.0f; - CxIm[1][0] = h->ChCrossIm[bin]; - CxIm[0][1] = -h->ChCrossIm[bin]; + CxIm[1][0] = hDiracDecBin->ChCrossIm[bin]; + CxIm[0][1] = -hDiracDecBin->ChCrossIm[bin]; /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ matrixMul( Mre, Mim, CxRe, CxIm, tmpMtxRe, tmpMtxIm ); @@ -1280,30 +1315,30 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( /* Subtract the resulting covariance matrix from the target covariance matrix to determine * what signal component is missing. The result is the target covariance matrix for the residual signal, i.e., * a residual covariance matrix. */ - CrEneL = max( 0.0f, h->ChEneOut[0][bin] - resultMtxRe[0][0] ); - CrEneR = max( 0.0f, h->ChEneOut[1][bin] - resultMtxRe[1][1] ); - CrCrossRe = h->ChCrossReOut[bin] - resultMtxRe[1][0]; - CrCrossIm = h->ChCrossImOut[bin] - resultMtxIm[1][0]; + CrEneL = max( 0.0f, hDiracDecBin->ChEneOut[0][bin] - resultMtxRe[0][0] ); + CrEneR = max( 0.0f, hDiracDecBin->ChEneOut[1][bin] - resultMtxRe[1][1] ); + CrCrossRe = hDiracDecBin->ChCrossReOut[bin] - resultMtxRe[1][0]; + CrCrossIm = hDiracDecBin->ChCrossImOut[bin] - resultMtxIm[1][0]; /* The amount of the decorrelated sound is further controlled based on the spatial metadata, * by determining an energy-suppressed residual covariance matrix that is a control parameter * that guides the processing of the decorrelated sound to a residual signal. * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { decorrelationReductionFactor = 1.0f; } - else if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 1 ) ) + else if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) || ( ivas_format == MASA_FORMAT && nchan_transport == 1 ) ) { - decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ) ); + decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ) ); } - else if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 1 ) + else if ( ivas_format == SBA_FORMAT && nchan_transport == 1 ) { decorrelationReductionFactor = 1.0f; } else { - decorrelationReductionFactor = fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ); + decorrelationReductionFactor = fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ); } CrEneL *= decorrelationReductionFactor; CrEneR *= decorrelationReductionFactor; @@ -1312,7 +1347,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( /* Determine a residual mixing matrix Mdec for processing the decorrelated signal to obtain * the residual signal (that has the residual covariance matrix) */ - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], + formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], 0.0f, 0.0f, /* Decorrelated signal has ideally no cross-terms */ CrEneL, CrEneR, CrCrossRe, CrCrossIm, @@ -1329,7 +1364,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ realizedOutputEne = CrEneL + CrEneR + resultMtxRe[0][0] + resultMtxRe[1][1]; - targetOutputEne = h->ChEneOut[0][bin] + h->ChEneOut[1][bin]; + targetOutputEne = hDiracDecBin->ChEneOut[0][bin] + hDiracDecBin->ChEneOut[1][bin]; missingOutputEne = fmaxf( 0.0f, targetOutputEne - realizedOutputEne ); gain = sqrtf( ( resultMtxRe[0][0] + resultMtxRe[1][1] + missingOutputEne ) / @@ -1350,15 +1385,15 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - h->processMtxRePrev[chA][chB][bin] = h->processMtxRe[chA][chB][bin]; - h->processMtxImPrev[chA][chB][bin] = h->processMtxIm[chA][chB][bin]; - h->processMtxDecRePrev[chA][chB][bin] = h->processMtxDecRe[chA][chB][bin]; - h->processMtxDecImPrev[chA][chB][bin] = h->processMtxDecIm[chA][chB][bin]; - - h->processMtxRe[chA][chB][bin] = Mre[chA][chB]; - h->processMtxIm[chA][chB][bin] = Mim[chA][chB]; - h->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; - h->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; + hDiracDecBin->processMtxRePrev[chA][chB][bin] = hDiracDecBin->processMtxRe[chA][chB][bin]; + hDiracDecBin->processMtxImPrev[chA][chB][bin] = hDiracDecBin->processMtxIm[chA][chB][bin]; + hDiracDecBin->processMtxDecRePrev[chA][chB][bin] = hDiracDecBin->processMtxDecRe[chA][chB][bin]; + hDiracDecBin->processMtxDecImPrev[chA][chB][bin] = hDiracDecBin->processMtxDecIm[chA][chB][bin]; + + hDiracDecBin->processMtxRe[chA][chB][bin] = Mre[chA][chB]; + hDiracDecBin->processMtxIm[chA][chB][bin] = Mim[chA][chB]; + hDiracDecBin->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; + hDiracDecBin->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; } } @@ -1371,19 +1406,19 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( int16_t aziDeg = 0; int16_t eleDeg = 0; - gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); + gainFactor = 0.8414f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - h->processMtxRePrev[chA][2][bin] = h->processMtxRe[chA][2][bin]; - h->processMtxImPrev[chA][2][bin] = h->processMtxIm[chA][2][bin]; + hDiracDecBin->processMtxRePrev[chA][2][bin] = hDiracDecBin->processMtxRe[chA][2][bin]; + hDiracDecBin->processMtxImPrev[chA][2][bin] = hDiracDecBin->processMtxIm[chA][2][bin]; } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache, isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache, isHeadtracked ); - h->processMtxRe[0][2][bin] = lRealp * gainFactor; - h->processMtxIm[0][2][bin] = lImagp * gainFactor; - h->processMtxRe[1][2][bin] = rRealp * gainFactor; - h->processMtxIm[1][2][bin] = rImagp * gainFactor; + hDiracDecBin->processMtxRe[0][2][bin] = lRealp * gainFactor; + hDiracDecBin->processMtxIm[0][2][bin] = lImagp * gainFactor; + hDiracDecBin->processMtxRe[1][2][bin] = rRealp * gainFactor; + hDiracDecBin->processMtxIm[1][2][bin] = rImagp * gainFactor; } } @@ -1392,12 +1427,15 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( static void ivas_dirac_dec_binaural_process_output( - Decoder_Struct *st_ivas, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, + const int16_t processReverb, const int16_t subframe ) { int16_t slot, bin, chA, chB; @@ -1406,31 +1444,29 @@ static void ivas_dirac_dec_binaural_process_output( float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - DIRAC_DEC_BIN_HANDLE h; float interpVal; float *decSlotRePointer; float *decSlotImPointer; int16_t offsetSamples; int16_t nSlots; - h = st_ivas->hDiracDecBin; - nBins = st_ivas->rend_common_data->num_freq_bands; + nBins = hSpatParamRendCom->num_freq_bands; offsetSamples = 0; - nSlots = st_ivas->rend_common_data->subframe_nbslots[subframe]; + nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + if ( processReverb ) { /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); + ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); } interpVal = 0.0f; for ( slot = 0; slot < nSlots; slot++ ) { interpVal += 1.0f / (float) nSlots; - if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) + if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { - ivas_dirac_dec_decorrelate_slot( st_ivas->hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); + ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -1443,7 +1479,7 @@ static void ivas_dirac_dec_binaural_process_output( /* Processing of the first / HRTF part of the binaural output. */ for ( chB = 0; chB < numInChannels; chB++ ) { - if ( st_ivas->hDiracDecBin->useTdDecorr ) + if ( hDiracDecBin->useTdDecorr ) { decSlotRePointer = inRe[chB + 2][slot]; decSlotImPointer = inIm[chB + 2][slot]; @@ -1459,33 +1495,33 @@ static void ivas_dirac_dec_binaural_process_output( float gain; /* Mixing using the formulated processing matrix M */ - gain = ( 1.0f - interpVal ) * h->processMtxRePrev[chA][chB][bin] + - interpVal * h->processMtxRe[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxRePrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxRe[chA][chB][bin]; outSlotRe[bin] += gain * inRe[chB][slot][bin]; outSlotIm[bin] += gain * inIm[chB][slot][bin]; - gain = ( 1.0f - interpVal ) * h->processMtxImPrev[chA][chB][bin] + - interpVal * h->processMtxIm[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxImPrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; outSlotRe[bin] -= gain * inIm[chB][slot][bin]; outSlotIm[bin] += gain * inRe[chB][slot][bin]; /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ if ( bin < max_band_decorr && chB < 2 ) { - gain = ( 1.0f - interpVal ) * h->processMtxDecRePrev[chA][chB][bin] + - interpVal * h->processMtxDecRe[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecRePrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; outSlotRe[bin] += gain * decSlotRePointer[bin]; outSlotIm[bin] += gain * decSlotImPointer[bin]; - gain = ( 1.0f - interpVal ) * h->processMtxDecImPrev[chA][chB][bin] + - interpVal * h->processMtxDecIm[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecImPrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxDecIm[chA][chB][bin]; outSlotRe[bin] -= gain * decSlotImPointer[bin]; outSlotIm[bin] += gain * decSlotRePointer[bin]; } } } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + if ( processReverb ) { /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); @@ -1496,7 +1532,7 @@ static void ivas_dirac_dec_binaural_process_output( outSlotImPr = &( outSlotIm[0] ); /* Inverse filter bank */ - cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, st_ivas->cldfbSynDec[chA] ); + cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); } } diff --git a/lib_dec/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c similarity index 99% rename from lib_dec/ivas_dirac_decorr_dec.c rename to lib_rend/ivas_dirac_decorr_dec.c index 3687ed53b1..e831188881 100644 --- a/lib_dec/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -37,9 +37,9 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" -#include "ivas_rom_com.h" #include "ivas_rom_dec.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_dec/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c similarity index 99% rename from lib_dec/ivas_dirac_onsets_dec.c rename to lib_rend/ivas_dirac_onsets_dec.c index c094b45ff6..8a03dc2c50 100644 --- a/lib_dec/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c similarity index 92% rename from lib_dec/ivas_dirac_output_synthesis_dec.c rename to lib_rend/ivas_dirac_output_synthesis_dec.c index 5e80d9176f..2788c7f0e1 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" @@ -87,12 +88,12 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha *------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_output_synthesis_open( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - RENDERER_TYPE renderer_type, /* i : renderer type */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t idx, ch_idx; @@ -106,10 +107,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open( DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /* check / set input parameters */ - assert( rend_common_data->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); + assert( hSpatParamRendCom->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); assert( hDirACRend->hOutSetup.nchan_out_woLFE > 0 && "Error: Number of output channels > 0!" ); assert( hDirACRend->num_outputs_diff > 0 ); - assert( rend_common_data->slot_size > 0 ); + assert( hSpatParamRendCom->slot_size > 0 ); assert( hDirACRend->hOutSetup.is_loudspeaker_setup == 0 || hDirACRend->hOutSetup.is_loudspeaker_setup == 1 ); assert( hDirACRend->diffuse_response_function != NULL ); @@ -146,7 +147,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open( dirac_output_synthesis_state->proto_power_smooth_prev = NULL; if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_protos_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -172,11 +173,11 @@ ivas_error ivas_dirac_dec_output_synthesis_open( /* target PSD buffers */ if ( hodirac_flag ) { - size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; } else { - size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) { @@ -193,21 +194,21 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } else { - if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -229,14 +230,14 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_MONO ) { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -249,30 +250,30 @@ ivas_error ivas_dirac_dec_output_synthesis_open( /* compute alpha */ if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { - computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, rend_common_data->slot_size, rend_common_data->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); + computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); if ( ( dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis, dirac_output_synthesis_params->numAlphas ); - computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, rend_common_data->slot_size, rend_common_data->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); + computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); if ( ( dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis_fast, dirac_output_synthesis_params->numAlphasFast ); - if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( rend_common_data->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, rend_common_data->num_freq_bands ); - set_zero( dirac_output_synthesis_state->direction_smoothness_prev, rend_common_data->num_freq_bands ); + set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, hSpatParamRendCom->num_freq_bands ); + set_zero( dirac_output_synthesis_state->direction_smoothness_prev, hSpatParamRendCom->num_freq_bands ); } else { @@ -355,10 +356,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_init( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t size; @@ -376,16 +377,16 @@ void ivas_dirac_dec_output_synthesis_init( /* initialize buffers */ if ( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev != NULL ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( hodirac_flag ) { - size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; } else { - size = rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); @@ -395,16 +396,16 @@ void ivas_dirac_dec_output_synthesis_init( } else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); } else { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( h_dirac_output_synthesis_state->proto_power_smooth_prev != NULL ) { - set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, rend_common_data->num_freq_bands * hDirACRend->num_protos_dir ); + set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir ); } set_zero( h_dirac_output_synthesis_state->gains_dir_prev, size ); @@ -414,7 +415,7 @@ void ivas_dirac_dec_output_synthesis_init( } else { - set_zero( h_dirac_output_synthesis_state->gains_diff_prev, rend_common_data->num_freq_bands * hDirACRend->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->gains_diff_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev != NULL ) @@ -539,17 +540,16 @@ void ivas_dirac_dec_output_synthesis_process_slot( const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t sh_rot_max_order, const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport, /* i : number of transport channels*/ const int16_t md_idx, - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -) + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim ) { int16_t num_freq_bands, num_channels_dir; int16_t num_freq_bands_diff, num_channels_diff; @@ -569,7 +569,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( *-----------------------------------------------------------------*/ /* collect some often used parameters */ - num_freq_bands = rend_common_data->num_freq_bands; + num_freq_bands = hSpatParamRendCom->num_freq_bands; num_channels_dir = hDirACRend->num_outputs_dir; num_channels_diff = hDirACRend->num_outputs_diff; num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; @@ -581,7 +581,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) { - ivas_dirac_dec_compute_directional_responses( rend_common_data, + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, hDirACRend, hVBAPdata, NULL, @@ -594,43 +594,43 @@ void ivas_dirac_dec_output_synthesis_process_slot( hodirac_flag ); } - if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + if ( dec_param_estim == FALSE && hodirac_flag ) { if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - v_multc( rend_common_data->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); + v_multc( hSpatParamRendCom->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( rend_common_data->energy_ratio1[md_idx], + mvr2r( hSpatParamRendCom->energy_ratio1[md_idx], h_dirac_output_synthesis_state->direct_power_factor, num_freq_bands ); mvr2r( aux_buf, h_dirac_output_synthesis_state->diffuse_power_factor, num_freq_bands ); - v_multc( rend_common_data->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); + v_multc( hSpatParamRendCom->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( rend_common_data->energy_ratio2[md_idx], - &h_dirac_output_synthesis_state->direct_power_factor[rend_common_data->num_freq_bands], + mvr2r( hSpatParamRendCom->energy_ratio2[md_idx], + &h_dirac_output_synthesis_state->direct_power_factor[hSpatParamRendCom->num_freq_bands], num_freq_bands ); mvr2r( aux_buf, - &h_dirac_output_synthesis_state->diffuse_power_factor[rend_common_data->num_freq_bands], + &h_dirac_output_synthesis_state->diffuse_power_factor[hSpatParamRendCom->num_freq_bands], num_freq_bands ); } else { ivas_dirac_dec_compute_gain_factors( num_freq_bands, - rend_common_data->diffuseness_vector[md_idx], + hSpatParamRendCom->diffuseness_vector[md_idx], h_dirac_output_synthesis_params->max_band_decorr, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor ); } } - else // ( hDirAC->hConfig->dec_param_estim == TRUE ) - if ( hDirAC->hConfig->dec_param_estim == TRUE ) + else // ( dec_param_estim == TRUE ) + if ( dec_param_estim == TRUE ) { /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( rend_common_data, + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, hDirACRend, hVBAPdata, NULL, @@ -755,7 +755,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( } /* process other PSDs only slot wise for 4 transport channels */ - if ( hDirAC->hConfig->dec_param_estim == TRUE ) + if ( dec_param_estim == TRUE ) { computeTargetPSDs_direct( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor, reference_power, h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth ); @@ -775,15 +775,14 @@ void ivas_dirac_dec_output_synthesis_process_slot( void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, float *diffuseness, - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -) + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim ) { int16_t buf_idx, ch_idx, i, l; int16_t num_freq_bands, num_freq_bands_diff; @@ -811,7 +810,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( proto_direct_index = hDirACRend->proto_index_dir; num_protos_dir = hDirACRend->num_protos_dir; - num_freq_bands = rend_common_data->num_freq_bands; + num_freq_bands = hSpatParamRendCom->num_freq_bands; num_freq_bands_diff = h_dirac_output_synthesis_params.max_band_decorr; num_channels_dir = hDirACRend->num_outputs_dir; num_channels_diff = hDirACRend->num_outputs_diff; @@ -824,7 +823,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( if ( hodirac_flag ) { - assert( hDirAC->hConfig->dec_param_estim == FALSE ); /*Direct gain*/ for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) { @@ -849,7 +847,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( l = 0; l < num_freq_bands; l++ ) { aux_buf[l] = 1.f - diffuseness[l]; - ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[rend_common_data->num_freq_bands + l]; + ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[hSpatParamRendCom->num_freq_bands + l]; ratio[l + num_freq_bands] = 1.f - ratio[l]; } @@ -875,7 +873,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( num_freq_bands_diff ); } } - else if ( hDirAC->hConfig->dec_param_estim == FALSE ) + else if ( dec_param_estim == FALSE ) { /*Direct gain*/ for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) @@ -1223,13 +1221,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nbslots, /* i : number of slots to process */ float *diffuseness_vector, float *reference_power_smooth, - float qualityBasedSmFactor ) + float qualityBasedSmFactor, + const int16_t enc_param_start_band ) { int16_t buf_idx, num_freq_bands; int16_t diff_start_band; @@ -1269,13 +1267,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; /* collect some often used parameters */ - num_freq_bands = rend_common_data->num_freq_bands; + num_freq_bands = hSpatParamRendCom->num_freq_bands; /*-----------------------------------------------------------------* * compute target PSDs *-----------------------------------------------------------------*/ - if ( hDirAC->hConfig->enc_param_start_band == 0 ) + if ( enc_param_start_band == 0 ) { diff_start_band = h_dirac_output_synthesis_params->use_onset_filters == 1 ? h_dirac_output_synthesis_params->max_band_decorr : 0; @@ -1743,10 +1741,10 @@ static void ivas_dirac_dec_get_response_split_order( *------------------------------------------------------------------------*/ void ivas_dirac_dec_compute_directional_responses( - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data, /* i/o: common spatial renderer data handle */ - DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int16_t *azimuth, const int16_t *elevation, const int16_t md_idx, @@ -1782,16 +1780,16 @@ void ivas_dirac_dec_compute_directional_responses( } num_channels_dir = hDirACRend->num_outputs_dir; - if ( rend_common_data->numSimultaneousDirections == 2 ) + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) { - azimuth2 = rend_common_data->azimuth2[md_idx]; - elevation2 = rend_common_data->elevation2[md_idx]; + azimuth2 = hSpatParamRendCom->azimuth2[md_idx]; + elevation2 = hSpatParamRendCom->elevation2[md_idx]; } codingBand = -1; assert( num_channels_dir <= MAX_OUTPUT_CHANNELS && "Number of channels is too high" ); - for ( k = 0; k < rend_common_data->num_freq_bands; ++k ) + for ( k = 0; k < hSpatParamRendCom->num_freq_bands; ++k ) { if ( hMasa != NULL && k == MASA_band_grouping_24[hMasa->data.band_mapping[codingBand + 1]] ) { @@ -1806,13 +1804,13 @@ void ivas_dirac_dec_compute_directional_responses( if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { mvr2r_inc( &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k - 1], - rend_common_data->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], - rend_common_data->num_freq_bands, num_channels_dir ); + hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], + hSpatParamRendCom->num_freq_bands, num_channels_dir ); } mvr2r_inc( &hDirACRend->h_output_synthesis_psd_state.direct_responses[k - 1], - rend_common_data->num_freq_bands, + hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], - rend_common_data->num_freq_bands, num_channels_dir ); + hSpatParamRendCom->num_freq_bands, num_channels_dir ); } else { @@ -1843,26 +1841,26 @@ void ivas_dirac_dec_compute_directional_responses( if ( hMasa == NULL && hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - mvr2r_inc( direct_response_hoa, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], rend_common_data->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_hoa, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); if ( hodirac_flag ) { - mvr2r_inc( direct_response_dir2, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k + rend_common_data->num_freq_bands * num_channels_dir], rend_common_data->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_dir2, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k + hSpatParamRendCom->num_freq_bands * num_channels_dir], hSpatParamRendCom->num_freq_bands, num_channels_dir ); } } else if ( ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) && ( hMasa != NULL ) ) || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ - spreadCoherencePanningHoa( azimuth[k], elevation[k], rend_common_data->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); + spreadCoherencePanningHoa( azimuth[k], elevation[k], hSpatParamRendCom->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); /* Synthesize the second direction and combine the gains */ - if ( rend_common_data->numSimultaneousDirections == 2 ) + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) { - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], rend_common_data->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); + spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hSpatParamRendCom->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); /* Combine gains from the two directions */ - totalDirect = rend_common_data->energy_ratio1[md_idx][k] + rend_common_data->energy_ratio2[md_idx][k] + EPSILON; - directRatio[0] = rend_common_data->energy_ratio1[md_idx][k] / totalDirect; - directRatio[1] = rend_common_data->energy_ratio2[md_idx][k] / totalDirect; + totalDirect = hSpatParamRendCom->energy_ratio1[md_idx][k] + hSpatParamRendCom->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = hSpatParamRendCom->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = hSpatParamRendCom->energy_ratio2[md_idx][k] / totalDirect; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_hoa[l] *= directRatio[0]; @@ -1884,7 +1882,7 @@ void ivas_dirac_dec_compute_directional_responses( if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { v_mult( direct_response, direct_response, direct_response_square, num_channels_dir ); - mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], rend_common_data->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); if ( transport_signal_type == MASA_STEREO_SPACED_MICS ) { @@ -1900,7 +1898,7 @@ void ivas_dirac_dec_compute_directional_responses( } } - mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], rend_common_data->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); } else { @@ -1910,19 +1908,19 @@ void ivas_dirac_dec_compute_directional_responses( else if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ - spreadCoherencePanningVbap( azimuth[k], elevation[k], rend_common_data->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); + spreadCoherencePanningVbap( azimuth[k], elevation[k], hSpatParamRendCom->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ - if ( rend_common_data->numSimultaneousDirections == 2 ) + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) { - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], rend_common_data->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); + spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hSpatParamRendCom->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ - totalDirect = rend_common_data->energy_ratio1[md_idx][k] + rend_common_data->energy_ratio2[md_idx][k] + EPSILON; - directRatio[0] = rend_common_data->energy_ratio1[md_idx][k] / totalDirect; - directRatio[1] = rend_common_data->energy_ratio2[md_idx][k] / totalDirect; + totalDirect = hSpatParamRendCom->energy_ratio1[md_idx][k] + hSpatParamRendCom->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = hSpatParamRendCom->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = hSpatParamRendCom->energy_ratio2[md_idx][k] / totalDirect; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= directRatio[0]; @@ -1953,8 +1951,8 @@ void ivas_dirac_dec_compute_directional_responses( /* Set computed gains */ direct_response = direct_response_ls; v_mult( direct_response, direct_response, direct_response_square, num_channels_dir ); - mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], rend_common_data->num_freq_bands, num_channels_dir ); - mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], rend_common_data->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); } else { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c new file mode 100644 index 0000000000..84ce30d1bc --- /dev/null +++ b/lib_rend/ivas_dirac_rend.c @@ -0,0 +1,2030 @@ +/****************************************************************************************************** + +(C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +the software. This notice grants no license of any kind, including but not limited to patent +license, nor is any license granted by implication, estoppel or otherwise. + +Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include "options.h" +#include +#include "cnst.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_cnst.h" +#include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +/*------------------------------------------------------------------------- + * ivas_dirac_allocate_parameters() + * + * Allocate and initialize DirAC parameters + *-------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_allocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +) +{ + int16_t i; + + if ( params_flag == 1 ) + { + if ( ( hSpatParamRendCom->azimuth = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->elevation = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->diffuseness_vector = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->energy_ratio1 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->spreadCoherence = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->surroundingCoherence = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + for ( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + { + if ( ( hSpatParamRendCom->azimuth[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->azimuth[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->elevation[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->elevation[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->diffuseness_vector[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->diffuseness_vector[i], 1.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->energy_ratio1[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->energy_ratio1[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->spreadCoherence[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->spreadCoherence[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->surroundingCoherence[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->surroundingCoherence[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + } + } + else if ( params_flag == 2 ) + { + if ( ( hSpatParamRendCom->azimuth2 = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->elevation2 = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->energy_ratio2 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->spreadCoherence2 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + for ( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + { + if ( ( hSpatParamRendCom->azimuth2[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->azimuth2[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->elevation2[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->elevation2[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->energy_ratio2[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->energy_ratio2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->spreadCoherence2[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->spreadCoherence2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + } + } + + return IVAS_ERR_OK; +} + + +ivas_error ivas_spat_hSpatParamRendCom_config( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const int16_t dec_param_estim_flag, + const IVAS_FORMAT ivas_format, + const MC_MODE mc_mode, + const int32_t output_Fs, + const int16_t hodirac_flag ) +{ + ivas_error error; + int16_t map_idx; + DIRAC_CONFIG_FLAG flag_config; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; + error = IVAS_ERR_OK; + + hSpatParamRendCom = NULL; + + if ( flag_config == DIRAC_RECONFIGURE ) + { + hSpatParamRendCom = *hSpatParamRendCom_out; + } + else if ( flag_config == DIRAC_OPEN ) + { + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC meta\n" ) ); + } + + *hSpatParamRendCom_out = hSpatParamRendCom; + } + + + if ( flag_config == DIRAC_OPEN ) + { + hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpatParamRendCom->subframes_rendered = 0; + hSpatParamRendCom->slots_rendered = 0; + hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + } + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + if ( ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE ) + { + if ( hodirac_flag && hSpatParamRendCom->azimuth2 == NULL ) + { + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( !hodirac_flag && hSpatParamRendCom->azimuth2 != NULL ) + { + ivas_dirac_deallocate_parameters( hSpatParamRendCom, 2 ); + } + } + + if ( flag_config == DIRAC_OPEN ) + { + hSpatParamRendCom->dirac_md_buffer_length = 0; + hSpatParamRendCom->dirac_bs_md_write_idx = 0; + hSpatParamRendCom->dirac_read_idx = 0; + if ( mc_mode == MC_MODE_MCMASA ) + { + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) + { + hSpatParamRendCom->render_to_md_map[map_idx] = map_idx; + } + } + else if ( ivas_format == MASA_FORMAT ) + { + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; + hSpatParamRendCom->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) + { + hSpatParamRendCom->render_to_md_map[map_idx] = map_idx; + } + } + else + { + int16_t num_slots_in_subfr; + num_slots_in_subfr = dec_param_estim_flag ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; + hSpatParamRendCom->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); + hSpatParamRendCom->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + hSpatParamRendCom->dirac_read_idx = 0; + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS * num_slots_in_subfr; map_idx++ ) + { + hSpatParamRendCom->render_to_md_map[map_idx] = hSpatParamRendCom->dirac_read_idx + map_idx / num_slots_in_subfr; + } + } + + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ivas_format == MASA_FORMAT || ( ivas_format == SBA_FORMAT && hodirac_flag ) ) + { + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + hSpatParamRendCom->azimuth2 = NULL; + hSpatParamRendCom->elevation2 = NULL; + hSpatParamRendCom->energy_ratio2 = NULL; + hSpatParamRendCom->spreadCoherence2 = NULL; + } + } + + return error; +} + + +void ivas_spat_hSpatParamRendCom_close( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out ) +{ + if ( hSpatParamRendCom_out == NULL || *hSpatParamRendCom_out == NULL ) + { + return; + } + + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 1 ); + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 2 ); + + free( *hSpatParamRendCom_out ); + *hSpatParamRendCom_out = NULL; + + return; +} + +void ivas_dirac_rend_close( + DIRAC_REND_HANDLE *hDirACRend_out ) +{ + int16_t i, j; + DIRAC_REND_HANDLE hDirACRend; + + if ( hDirACRend_out == NULL || *hDirACRend_out == NULL ) + { + return; + } + + hDirACRend = *hDirACRend_out; + + /* close Output synthesis sub-module */ + ivas_dirac_dec_output_synthesis_close( hDirACRend ); + + /* close Decorrelator sub-module */ + if ( hDirACRend->proto_signal_decorr_on ) + { + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); + } + + /* Params */ + + /* free frequency axis buffer */ + if ( hDirACRend->frequency_axis != NULL ) + { + free( hDirACRend->frequency_axis ); + hDirACRend->frequency_axis = NULL; + } + + if ( hDirACRend->diffuse_response_function != NULL ) + { + free( hDirACRend->diffuse_response_function ); + hDirACRend->diffuse_response_function = NULL; + } + + if ( hDirACRend->hoa_encoder != NULL ) + { + free( hDirACRend->hoa_encoder ); + hDirACRend->hoa_encoder = NULL; + } + + /* prototype indexing */ + if ( hDirACRend->proto_index_dir != NULL ) + { + free( hDirACRend->proto_index_dir ); + hDirACRend->proto_index_dir = NULL; + } + + if ( hDirACRend->proto_index_diff != NULL ) + { + free( hDirACRend->proto_index_diff ); + hDirACRend->proto_index_dir = NULL; + } + + /* States */ + + /* free prototype signal buffers */ + if ( hDirACRend->proto_frame_f != NULL ) + { + free( hDirACRend->proto_frame_f ); + hDirACRend->proto_frame_f = NULL; + } + + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + if ( hDirACRend->buffer_intensity_real[i][j] != NULL ) + { + free( hDirACRend->buffer_intensity_real[i][j] ); + hDirACRend->buffer_intensity_real[i][j] = NULL; + } + } + } + if ( hDirACRend->buffer_energy != NULL ) + { + free( hDirACRend->buffer_energy ); + hDirACRend->buffer_energy = NULL; + } + + if ( hDirACRend->masa_stereo_type_detect != NULL ) + { + free( hDirACRend->masa_stereo_type_detect ); + hDirACRend->masa_stereo_type_detect = NULL; + } + + ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); + + free( *hDirACRend_out ); + *hDirACRend_out = NULL; + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_deallocate_parameters() + * + * Deallocate DirAC parameters + *-------------------------------------------------------------------------*/ + +void ivas_dirac_deallocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +) +{ + int16_t i; + int16_t md_buffer_length; + + if ( hSpatParamRendCom == NULL ) + { + return; + } + + md_buffer_length = hSpatParamRendCom->dirac_md_buffer_length; + + if ( params_flag == 1 ) + { + if ( hSpatParamRendCom->azimuth != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->azimuth[i] != NULL ) + { + free( hSpatParamRendCom->azimuth[i] ); + hSpatParamRendCom->azimuth[i] = NULL; + } + } + + free( hSpatParamRendCom->azimuth ); + hSpatParamRendCom->azimuth = NULL; + } + + if ( hSpatParamRendCom->elevation != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->elevation[i] != NULL ) + { + free( hSpatParamRendCom->elevation[i] ); + hSpatParamRendCom->elevation[i] = NULL; + } + } + + free( hSpatParamRendCom->elevation ); + hSpatParamRendCom->elevation = NULL; + } + + if ( hSpatParamRendCom->energy_ratio1 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->energy_ratio1[i] != NULL ) + { + free( hSpatParamRendCom->energy_ratio1[i] ); + hSpatParamRendCom->energy_ratio1[i] = NULL; + } + } + free( hSpatParamRendCom->energy_ratio1 ); + hSpatParamRendCom->energy_ratio1 = NULL; + } + + if ( hSpatParamRendCom->diffuseness_vector != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->diffuseness_vector[i] != NULL ) + { + free( hSpatParamRendCom->diffuseness_vector[i] ); + hSpatParamRendCom->diffuseness_vector[i] = NULL; + } + } + + free( hSpatParamRendCom->diffuseness_vector ); + hSpatParamRendCom->diffuseness_vector = NULL; + } + + if ( hSpatParamRendCom->spreadCoherence != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->spreadCoherence[i] != NULL ) + { + free( hSpatParamRendCom->spreadCoherence[i] ); + hSpatParamRendCom->spreadCoherence[i] = NULL; + } + } + free( hSpatParamRendCom->spreadCoherence ); + hSpatParamRendCom->spreadCoherence = NULL; + } + + if ( hSpatParamRendCom->surroundingCoherence != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->surroundingCoherence[i] != NULL ) + { + free( hSpatParamRendCom->surroundingCoherence[i] ); + hSpatParamRendCom->surroundingCoherence[i] = NULL; + } + } + free( hSpatParamRendCom->surroundingCoherence ); + hSpatParamRendCom->surroundingCoherence = NULL; + } + } + else if ( params_flag == 2 ) + { + if ( hSpatParamRendCom->azimuth2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->azimuth2[i] != NULL ) + { + free( hSpatParamRendCom->azimuth2[i] ); + hSpatParamRendCom->azimuth2[i] = NULL; + } + } + free( hSpatParamRendCom->azimuth2 ); + hSpatParamRendCom->azimuth2 = NULL; + } + + if ( hSpatParamRendCom->elevation2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->elevation2[i] != NULL ) + { + free( hSpatParamRendCom->elevation2[i] ); + hSpatParamRendCom->elevation2[i] = NULL; + } + } + free( hSpatParamRendCom->elevation2 ); + hSpatParamRendCom->elevation2 = NULL; + } + + if ( hSpatParamRendCom->energy_ratio2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->energy_ratio2[i] != NULL ) + { + free( hSpatParamRendCom->energy_ratio2[i] ); + hSpatParamRendCom->energy_ratio2[i] = NULL; + } + } + free( hSpatParamRendCom->energy_ratio2 ); + hSpatParamRendCom->energy_ratio2 = NULL; + } + + if ( hSpatParamRendCom->spreadCoherence2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->spreadCoherence2[i] != NULL ) + { + free( hSpatParamRendCom->spreadCoherence2[i] ); + hSpatParamRendCom->spreadCoherence2[i] = NULL; + } + } + free( hSpatParamRendCom->spreadCoherence2 ); + hSpatParamRendCom->spreadCoherence2 = NULL; + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_alloc_mem() + * + * Allocate stack memory for DirAC renderer + *------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_alloc_mem( + DIRAC_REND_HANDLE hDirACRend, + const RENDERER_TYPE renderer_type, + const int16_t num_freq_bands, + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, + const int16_t hodirac_flag ) +{ + int16_t num_freq_bands_diff, size; + int16_t size_ho; + int16_t size_pf; + int16_t num_outputs_dir, num_outputs_diff; + int16_t num_protos_dir; + + num_protos_dir = hDirACRend->num_protos_dir; + + num_freq_bands_diff = hDirACRend->h_output_synthesis_psd_params.max_band_decorr; + + num_outputs_dir = hDirACRend->num_outputs_dir; + num_outputs_diff = hDirACRend->num_outputs_diff; + + size = num_freq_bands * num_outputs_dir; + if ( hodirac_flag ) + { + size_ho = size * DIRAC_HO_NUMSECTORS; + size_pf = num_freq_bands * DIRAC_HO_NUMSECTORS; + } + else + { + size_ho = size; + size_pf = num_freq_bands; + } + + /* PSD related buffers */ + hDirAC_mem->cy_auto_dir_smooth = NULL; + hDirAC_mem->proto_power_smooth = NULL; + hDirAC_mem->proto_power_diff_smooth = NULL; + hDirAC_mem->direct_responses_square = NULL; + hDirAC_mem->frame_dec_f = NULL; + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); + + if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->proto_power_smooth, size ); + + if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->proto_power_diff_smooth, size ); + + if ( ( hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->direct_responses_square, size ); + if ( hDirACRend->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) + { + if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; + hDirACRend->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; + + /* Target and smoothed nrg factors/gains */ + if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); + + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_auto_diff_smooth, size ); + } + else + { + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); + } + hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; + + /*Responses (gains/factors)*/ + if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->direct_responses, size ); + + + hDirACRend->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; + + /* Prototypes */ + hDirAC_mem->proto_direct_buffer_f = NULL; + hDirAC_mem->proto_diffuse_buffer_f = NULL; + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + { + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + else + { + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + } + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; + + /* Gains/power factors*/ + hDirAC_mem->direct_power_factor = NULL; + hDirAC_mem->diffuse_power_factor = NULL; + + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + + hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; + + hDirAC_mem->reference_power = NULL; + hDirAC_mem->onset_filter = NULL; + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + } + else + { + if ( num_protos_dir > 2 ) + { + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + + return IVAS_ERR_OK; +} + + +void ivas_dirac_free_mem( + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) +{ + if ( hDirAC_mem->cy_auto_dir_smooth != NULL ) + { + free( hDirAC_mem->cy_auto_dir_smooth ); + } + if ( hDirAC_mem->proto_power_smooth != NULL ) + { + free( hDirAC_mem->proto_power_smooth ); + } + if ( hDirAC_mem->proto_power_diff_smooth != NULL ) + { + free( hDirAC_mem->proto_power_diff_smooth ); + } + if ( hDirAC_mem->direct_responses_square != NULL ) + { + free( hDirAC_mem->direct_responses_square ); + } + if ( hDirAC_mem->frame_dec_f != NULL ) + { + free( hDirAC_mem->frame_dec_f ); + } + if ( hDirAC_mem->cy_cross_dir_smooth != NULL ) + { + free( hDirAC_mem->cy_cross_dir_smooth ); + } + if ( hDirAC_mem->cy_auto_diff_smooth != NULL ) + { + free( hDirAC_mem->cy_auto_diff_smooth ); + } + if ( hDirAC_mem->direct_responses != NULL ) + { + free( hDirAC_mem->direct_responses ); + } + if ( hDirAC_mem->proto_direct_buffer_f != NULL ) + { + free( hDirAC_mem->proto_direct_buffer_f ); + } + if ( hDirAC_mem->proto_diffuse_buffer_f != NULL ) + { + free( hDirAC_mem->proto_diffuse_buffer_f ); + } + if ( hDirAC_mem->direct_power_factor != NULL ) + { + free( hDirAC_mem->direct_power_factor ); + } + if ( hDirAC_mem->diffuse_power_factor != NULL ) + { + free( hDirAC_mem->diffuse_power_factor ); + } + if ( hDirAC_mem->reference_power != NULL ) + { + free( hDirAC_mem->reference_power ); + } + if ( hDirAC_mem->onset_filter != NULL ) + { + free( hDirAC_mem->onset_filter ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * compute_hoa_encoder_mtx() + * + * + *------------------------------------------------------------------------*/ + +void compute_hoa_encoder_mtx( + const float *azimuth, + const float *elevation, + float *response, + const int16_t num_responses, + const int16_t ambisonics_order ) +{ + int16_t k, num_sh; + + num_sh = ivas_sba_get_nchan( ambisonics_order, 0 ); + + for ( k = 0; k < num_responses; k++ ) + { + ivas_dirac_dec_get_response( (const int16_t) azimuth[k], (const int16_t) elevation[k], &response[k * num_sh], ambisonics_order ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_get_frequency_axis() + * + * DirAC decoding initialization + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_get_frequency_axis( + float *frequency_axis, + const int32_t output_Fs, + const int16_t num_freq_bands ) +{ + int16_t k; + float const_part; + + /* calc cldfb frequency axis */ + const_part = (float) output_Fs / ( 2.0f * (float) num_freq_bands ); + for ( k = 0; k < num_freq_bands; ++k ) + { + frequency_axis[k] = ( (float) k + 0.5f ) * const_part; + } + + return; +} + + +/*------------------------------------------------------------------------- + * Local functions + *-------------------------------------------------------------------------*/ + +void initDiffuseResponses( + float *diffuse_response_function, + const int16_t num_channels, + AUDIO_CONFIG output_config, + IVAS_OUTPUT_SETUP hOutSetup, + const int16_t ambisonics_order, + const IVAS_FORMAT ivas_format, + int16_t *num_ele_spk_no_diffuse_rendering, + AUDIO_CONFIG transport_config ) +{ + int16_t i, l, k, idx, num_horizontal_speakers; + *num_ele_spk_no_diffuse_rendering = 0; + + if ( output_config == AUDIO_CONFIG_MONO ) + { + diffuse_response_function[0] = 1.0f; + diffuse_response_function[1] = inv_sqrt( 3.0f ); + } + else if ( !( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) ) + { + /* set diffuse response function */ + if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_5_1_4 ) + { + num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; + + mvr2r( diffuse_response_CICP6, diffuse_response_function, num_horizontal_speakers ); + set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); + *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; + } + else if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_7_1_4 ) + { + num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; + + set_f( diffuse_response_function, sqrtf( 1.f / ( (float) num_horizontal_speakers ) ), num_horizontal_speakers ); + set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); + *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; + } + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) + { + mvr2r( diffuse_response_CICP6, diffuse_response_function, num_channels ); + } + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) + { + mvr2r( diffuse_response_CICP14, diffuse_response_function, num_channels ); + } + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) + { + mvr2r( diffuse_response_CICP16, diffuse_response_function, num_channels ); + } + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) + { + if ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) + { + /* Detect loudspeakers with elevation */ + for ( i = 0, num_horizontal_speakers = 0; i < num_channels; i++ ) + { + if ( fabsf( hOutSetup.ls_elevation[i] ) <= 5.f ) + { + num_horizontal_speakers++; + diffuse_response_function[i] = 1.f; + } + else + { + *num_ele_spk_no_diffuse_rendering += 1; + diffuse_response_function[i] = 0.f; + } + } + /* Diffuse only to horizontal plane if enough loudspeakers */ + if ( num_horizontal_speakers > 2 ) + { + for ( i = 0; i < num_channels; i++ ) + { + diffuse_response_function[i] *= sqrtf( 1.f / (float) num_horizontal_speakers ); + } + } + else + { + *num_ele_spk_no_diffuse_rendering = 0; + set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); + } + } + else + { + set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); + } + } + else + { + set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); + } + } + else + { + idx = 0; + for ( l = 0; l <= ambisonics_order; l++ ) + { + for ( k = 0; k < ( 2 * l + 1 ); k++ ) + { + diffuse_response_function[idx++] = inv_sqrt( 2.0f * l + 1.0f ); + } + } + } + + return; +} + + +void protoSignalComputation_shd( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_direct_buffer_f, + float *proto_diffuse_buffer_f, + float *reference_power, + const int16_t slot_index, + const int16_t num_inputs, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + float *p_Rmat ) +{ + int16_t l, k; + float *p_proto_direct_buffer; + float *p_proto_diffuse_buffer; + int16_t Rmat_k[4]; + float W_real, W_imag; + float Y_real, Y_imag; + float *p_k[4]; + + k = 0; /* to avoid compilation warning */ + + p_proto_direct_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_inputs; + p_proto_diffuse_buffer = proto_diffuse_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; + + if ( num_inputs == 1 ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_direct_buffer[2 * l] = RealBuffer[0][0][l]; + p_proto_direct_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + } + } + else if ( num_inputs == 2 ) + { + if ( p_Rmat != 0 ) + { + assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); + + for ( l = 0; l < num_freq_bands; l++ ) + { + W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + Y_real = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + Y_imag = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + + p_proto_direct_buffer[2 * l] = W_real; + p_proto_direct_buffer[2 * l + 1] = W_imag; + p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = p_Rmat[0] * Y_real; + p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = p_Rmat[0] * Y_imag; + } + } + else + { + for ( l = 0; l < num_freq_bands; l++ ) + { + W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + p_proto_direct_buffer[2 * l] = W_real; + p_proto_direct_buffer[2 * l + 1] = W_imag; + { + p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + } + } + } + } + else if ( num_inputs >= 4 ) + { + p_k[0] = p_proto_direct_buffer; + p_k[1] = p_proto_direct_buffer + 2 * num_freq_bands; + p_k[2] = p_proto_direct_buffer + 4 * num_freq_bands; + p_k[3] = p_proto_direct_buffer + 6 * num_freq_bands; + Rmat_k[0] = 0; + Rmat_k[1] = 1; + Rmat_k[2] = 2; + Rmat_k[3] = 0; + + if ( p_Rmat != 0 ) + { + assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); + + for ( l = 0; l < num_freq_bands; l++ ) + { + *( p_k[0] ) = RealBuffer[0][0][l]; + reference_power[l + num_freq_bands] = *( p_k[0] ) * *( p_k[0] ); + p_k[0]++; + *( p_k[0] ) = ImagBuffer[0][0][l]; + reference_power[l + num_freq_bands] += *( p_k[0] ) * *( p_k[0] ); + p_k[0]++; + reference_power[l] = 0.5f * reference_power[l + num_freq_bands]; + + for ( k = 1; k < 4; k++ ) + { + *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * RealBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * RealBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * RealBuffer[3][0][l]; + reference_power[l + ( k + 1 ) * num_freq_bands] = *( p_k[k] ) * *( p_k[k] ); + p_k[k]++; + *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * ImagBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * ImagBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * ImagBuffer[3][0][l]; + reference_power[l + ( k + 1 ) * num_freq_bands] += *( p_k[k] ) * *( p_k[k] ); + p_k[k]++; + reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); + } + + for ( k = 1; k < 4; k++ ) + { + RealBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l]; + ImagBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1]; + } + } + } + else + { + set_zero( reference_power, num_freq_bands ); + for ( k = 0; k < 4; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; + reference_power[l + ( k + 1 ) * num_freq_bands] = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; + reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); + } + } + } + + /* Additional transport channels = planar SBA components of degree higher than 1*/ + for ( ; k < num_inputs; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; + } + } + } + + + /*Copy direct to diffuse proto*/ + mvr2r( p_proto_direct_buffer, p_proto_diffuse_buffer, 2 * num_freq_bands * min( num_outputs_diff, num_inputs ) ); + + if ( num_inputs == 1 ) + { + /* Add comfort noise addition (CNA) to diffuse proto only*/ + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_diffuse_buffer[2 * l] += RealBuffer[1][0][l]; + p_proto_diffuse_buffer[2 * l + 1] += ImagBuffer[1][0][l]; + } + } + + return; +} + + +void protoSignalComputation1( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands ) +{ + int16_t l, k; + float *p_proto_buffer; + + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands; + + for ( l = 0; l < num_freq_bands; l++ ) + { + reference_power[l] = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + proto_power_smooth[l] += reference_power[l]; + p_proto_buffer[2 * l] = RealBuffer[0][0][l]; + p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + + for ( k = 0; k < num_outputs_diff; k++ ) + { + proto_frame_f[2 * k * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * k * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + } + } + + return; +} + + +void protoSignalComputation2( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t isloudspeaker, + const int16_t slot_index, + const int16_t num_freq_bands, + MASA_STEREO_TYPE_DETECT *stereo_type_detect ) +{ + int16_t l; + float *p_proto_buffer; + float Real_aux, Imag_aux; + + float left_bb_power, right_bb_power, total_bb_power, lr_bb_power; + float lr_total_bb_ratio; + float a, b; + + float left_hi_power, right_hi_power, total_hi_power, lr_hi_power; + float lr_total_hi_ratio; + float a2, b2; + + float sum_power; + float sum_total_ratio[MASA_SUM_FREQ_RANGE_BINS]; + float min_sum_total_ratio; + float min_sum_total_ratio_db; + + float RealSubtract, ImagSubtract; + + float interpolatorSpaced = 0.0f; + float interpolatorDmx = 1.0f; + + int16_t dipole_freq_range[2]; + float tempSpaced, tempDmx; + + if ( isloudspeaker ) + { + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 3; + + for ( l = 0; l < num_freq_bands; l++ ) + { + float Left_power; + float Right_power; + Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; + + reference_power[l] = Left_power + Right_power; + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + proto_power_smooth[l + num_freq_bands] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + + proto_power_smooth[l + 2 * num_freq_bands] += RealBuffer[1][0][l] * RealBuffer[1][0][l]; + proto_power_smooth[l + 2 * num_freq_bands] += ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; + p_proto_buffer[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + p_proto_buffer[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + + proto_frame_f[2 * l] = Real_aux; + proto_frame_f[2 * l + 1] = Imag_aux; + + proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + } + } + else if ( stereo_type_detect != NULL ) + { + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; + + left_bb_power = 0.0f; + right_bb_power = 0.0f; + total_bb_power = 0.0f; + + left_hi_power = 0.0f; + right_hi_power = 0.0f; + total_hi_power = 0.0f; + + dipole_freq_range[0] = stereo_type_detect->dipole_freq_range[0]; + dipole_freq_range[1] = stereo_type_detect->dipole_freq_range[1]; + + a = 0.01f; /* Temporal smoothing coefficient */ + b = 1.0f - a; /* Temporal smoothing coefficient */ + a2 = 0.1f; /* Temporal smoothing coefficient */ + b2 = 1.0f - a2; /* Temporal smoothing coefficient */ + + if ( stereo_type_detect->interpolator > 0 ) + { + if ( stereo_type_detect->type_change_direction == MASA_STEREO_SPACED_MICS ) + { + interpolatorSpaced = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); + interpolatorDmx = 1.0f - interpolatorSpaced; + } + else + { + interpolatorDmx = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); + interpolatorSpaced = 1.0f - interpolatorDmx; + } + } + + for ( l = 0; l < num_freq_bands; l++ ) + { + float Left_power; + float Right_power; + + /* Compute sum signal */ + Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + /* Compute reference power */ + Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; + + reference_power[l] = Left_power + Right_power; + + left_bb_power += Left_power; + right_bb_power += Right_power; + total_bb_power += reference_power[l]; + + if ( l > MASA_HI_FREQ_START_BIN ) + { + left_hi_power += Left_power; + right_hi_power += Right_power; + total_hi_power += reference_power[l]; + } + + if ( l < min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) + { + sum_power = Real_aux * Real_aux + Imag_aux * Imag_aux; + + stereo_type_detect->sum_power[l] = a * sum_power + b * stereo_type_detect->sum_power[l]; + stereo_type_detect->total_power[l] = a * reference_power[l] + b * stereo_type_detect->total_power[l]; + + sum_total_ratio[l] = stereo_type_detect->sum_power[l] / ( stereo_type_detect->total_power[l] + EPSILON ); + } + + if ( l == 0 ) + { + RealSubtract = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + ImagSubtract = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + stereo_type_detect->subtract_power_y += RealSubtract * RealSubtract + ImagSubtract * ImagSubtract; + } + + /* Compute protos (and their power) for direct sound rendering */ + + /* W prototype */ + if ( stereo_type_detect->interpolator > 0 ) + { + if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) + { + Real_aux = interpolatorSpaced * 0.5f * Real_aux + interpolatorDmx * Real_aux; + Imag_aux = interpolatorSpaced * 0.5f * Imag_aux + interpolatorDmx * Imag_aux; + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + } + else + { + tempSpaced = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + tempDmx = Real_aux * Real_aux + Imag_aux * Imag_aux; + proto_power_smooth[l] += interpolatorSpaced * tempSpaced + interpolatorDmx * tempDmx; + p_proto_buffer[2 * l] = interpolatorSpaced * RealBuffer[0][0][l] + interpolatorDmx * Real_aux; + p_proto_buffer[2 * l + 1] = interpolatorSpaced * ImagBuffer[0][0][l] + interpolatorDmx * Imag_aux; + } + } + else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + { + if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) + { + Real_aux *= 0.5f; + Imag_aux *= 0.5f; + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + } + else + { + proto_power_smooth[l] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + p_proto_buffer[2 * l] = RealBuffer[0][0][l]; + p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + } + } + else + { + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + } + + /* Y prototype */ + if ( stereo_type_detect->interpolator > 0 ) + { + if ( l < ( dipole_freq_range[0] ) ) + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + } + else if ( l < ( dipole_freq_range[1] ) ) + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ) + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * ( -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ) ) + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + } + else + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + } + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + } + else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + { + if ( l < ( dipole_freq_range[0] ) ) /* proto = W */ + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; + proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; + } + else if ( l < ( dipole_freq_range[1] ) ) /* proto = -i * (x1-x2) * eq */ + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + } + else /* proto = W */ + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; + proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; + } + } + else + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + } + + /* Compute protos for decorrelation */ + proto_frame_f[2 * l] = Real_aux; + proto_frame_f[2 * l + 1] = Imag_aux; + proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + } + + if ( stereo_type_detect->interpolator > 0 ) + { + stereo_type_detect->interpolator++; + if ( stereo_type_detect->interpolator == MASA_STEREO_INTERPOLATION_SLOTS ) + { + stereo_type_detect->interpolator = 0; + stereo_type_detect->current_stereo_type = stereo_type_detect->type_change_direction; + } + } + + stereo_type_detect->left_bb_power = a * left_bb_power + b * stereo_type_detect->left_bb_power; + stereo_type_detect->right_bb_power = a * right_bb_power + b * stereo_type_detect->right_bb_power; + stereo_type_detect->total_bb_power = a * total_bb_power + b * stereo_type_detect->total_bb_power; + + lr_bb_power = ( stereo_type_detect->left_bb_power < stereo_type_detect->right_bb_power ) ? stereo_type_detect->left_bb_power : stereo_type_detect->right_bb_power; + lr_bb_power *= 2.0f; + lr_total_bb_ratio = 10.0f * log10f( lr_bb_power / ( stereo_type_detect->total_bb_power + EPSILON ) ); + + stereo_type_detect->left_hi_power = a2 * left_hi_power + b2 * stereo_type_detect->left_hi_power; + stereo_type_detect->right_hi_power = a2 * right_hi_power + b2 * stereo_type_detect->right_hi_power; + stereo_type_detect->total_hi_power = a2 * total_hi_power + b2 * stereo_type_detect->total_hi_power; + + lr_hi_power = ( stereo_type_detect->left_hi_power < stereo_type_detect->right_hi_power ) ? stereo_type_detect->left_hi_power : stereo_type_detect->right_hi_power; + lr_hi_power *= 2.0f; + lr_total_hi_ratio = 10.0f * log10f( lr_hi_power / ( stereo_type_detect->total_hi_power + EPSILON ) ); + + minimum( sum_total_ratio, min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ), &min_sum_total_ratio ); + min_sum_total_ratio_db = 10.0f * log10f( min_sum_total_ratio ); + + stereo_type_detect->lr_total_bb_ratio_db = lr_total_bb_ratio; + stereo_type_detect->lr_total_hi_ratio_db = lr_total_hi_ratio; + stereo_type_detect->min_sum_total_ratio_db = min_sum_total_ratio_db; + + ivas_masa_stereotype_detection( stereo_type_detect ); + } + else + { + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; + + for ( l = 0; l < num_freq_bands; l++ ) + { + Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + reference_power[l] = Real_aux * Real_aux + Imag_aux * Imag_aux; + proto_power_smooth[l] += reference_power[l]; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + + p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + + proto_frame_f[2 * l] = Real_aux; + proto_frame_f[2 * l + 1] = Imag_aux; + + proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + } + } + + return; +} + + +void protoSignalComputation4( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + const float *mtx_hoa_decoder, + const int16_t nchan_transport, + const int16_t *sba_map_tc_ind ) +{ + int16_t k, l; + int16_t n; + float sq_tmp; + float *p_proto_buffer; + + set_zero( reference_power, num_freq_bands ); + for ( k = 0; k < 4; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + sq_tmp = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; + reference_power[l] += 0.5f * sq_tmp; + } + } + + /*For decorrelated diffuseness*/ + for ( l = 0; l < num_outputs_diff; l++ ) + { + for ( k = 0; k < num_freq_bands; k++ ) + { + proto_frame_f[2 * l * num_freq_bands + 2 * k] = 0.f; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] = 0.f; + for ( n = 0; n < nchan_transport; n++ ) + { + proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + } + } + } + + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; + for ( k = 0; k < num_outputs_diff; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + sq_tmp = proto_frame_f[k * 2 * num_freq_bands + 2 * l] * proto_frame_f[k * 2 * num_freq_bands + 2 * l] + proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1] * proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; + proto_power_smooth[l + k * num_freq_bands] += sq_tmp; + p_proto_buffer[k * 2 * num_freq_bands + 2 * l] = proto_frame_f[k * 2 * num_freq_bands + 2 * l]; + p_proto_buffer[k * 2 * num_freq_bands + 2 * l + 1] = proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_compute_diffuse_proto() + * + * Compute diffuse prototype buffer and smooth power, only for decorrelated bands + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_compute_diffuse_proto( + DIRAC_REND_HANDLE hDirACRend, + const int16_t num_freq_bands, + const int16_t slot_idx /* i : slot index */ +) +{ + int16_t k, l; + int16_t num_freq_bands_diff; + float *p_diff_buffer, *p_diff_buffer_1; + float *p_proto_diff, *p_power_smooth, *proto_frame_dec_f; + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + int16_t m; + float *p_hoa_enc; + + proto_frame_dec_f = hDirACRend->proto_frame_dec_f; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + + num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; + + p_diff_buffer = h_dirac_output_synthesis_state->proto_diffuse_buffer_f + slot_idx * 2 * num_freq_bands_diff * hDirACRend->hOutSetup.nchan_out_woLFE; + p_diff_buffer_1 = p_diff_buffer + 1; + p_power_smooth = h_dirac_output_synthesis_state->proto_power_diff_smooth; + + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) + { + for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) + { + p_proto_diff = proto_frame_dec_f + k * 2 * num_freq_bands; + for ( l = 0; l < num_freq_bands_diff; l++ ) + { + *p_diff_buffer = *( p_proto_diff++ ); + *p_diff_buffer_1 = *( p_proto_diff++ ); + *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); + p_diff_buffer += 2; + p_diff_buffer_1 += 2; + } + } + } + else + { + /*DIRAC_SYNTHESIS_PSD_SHD: Virtual LS->HOA encoding*/ + for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) + { + for ( l = 0; l < num_freq_bands_diff; l++ ) + { + p_hoa_enc = hDirACRend->hoa_encoder + k; + p_proto_diff = proto_frame_dec_f + 2 * l; + + *p_diff_buffer = 0.f; + *p_diff_buffer_1 = 0.f; + + /*LS to HOA*/ + for ( m = 0; m < hDirACRend->num_outputs_diff; m++ ) + { + *p_diff_buffer += ( *p_hoa_enc ) * ( *p_proto_diff ); + *p_diff_buffer_1 += ( *p_hoa_enc ) * ( *( p_proto_diff + 1 ) ); + p_hoa_enc += hDirACRend->hOutSetup.nchan_out_woLFE; + p_proto_diff += 2 * num_freq_bands; + } + + *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); + p_diff_buffer += 2; + p_diff_buffer_1 += 2; + } + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * computeDirectionAngles() + * + *------------------------------------------------------------------------*/ + +void computeDirectionAngles( + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z, + const int16_t num_frequency_bands, + int16_t *azimuth, + int16_t *elevation ) +{ + int16_t k; + float intensityNorm; + float x, y, z, radius; + + for ( k = 0; k < num_frequency_bands; ++k ) + + { + intensityNorm = *( intensity_real_x ) * *( intensity_real_x ) + + *( intensity_real_y ) * *( intensity_real_y ) + + *( intensity_real_z ) * *( intensity_real_z ); + + if ( intensityNorm <= EPSILON ) + { + intensityNorm = 1.0f; + x = 1.0f; + y = 0.0f; + z = 0.0f; + intensity_real_x++; + intensity_real_y++; + intensity_real_z++; + } + else + { + intensityNorm = sqrtf( 1.f / intensityNorm ); + x = *( intensity_real_x++ ) * intensityNorm; + y = *( intensity_real_y++ ) * intensityNorm; + z = *( intensity_real_z++ ) * intensityNorm; + } + radius = sqrtf( x * x + y * y ); + azimuth[k] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); + elevation[k] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_masa_init_stereotype_detection() + * + * Initialize stereo transport signal type detection + *------------------------------------------------------------------------*/ + +void ivas_masa_init_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect ) +{ + stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; + stereo_type_detect->current_stereo_type = MASA_STEREO_DOWNMIX; + stereo_type_detect->type_change_direction = MASA_STEREO_DOWNMIX; + + stereo_type_detect->counter = 0; + stereo_type_detect->interpolator = 0; + + stereo_type_detect->dipole_freq_range[0] = 1; + stereo_type_detect->dipole_freq_range[1] = 3; + + stereo_type_detect->left_bb_power = 0.0f; /* Broadband estimates */ + stereo_type_detect->right_bb_power = 0.0f; + stereo_type_detect->total_bb_power = 0.0f; + + stereo_type_detect->left_hi_power = 0.0f; /* High-frequency estimates */ + stereo_type_detect->right_hi_power = 0.0f; + stereo_type_detect->total_hi_power = 0.0f; + + set_zero( stereo_type_detect->sum_power, MASA_SUM_FREQ_RANGE_BINS ); + set_zero( stereo_type_detect->total_power, MASA_SUM_FREQ_RANGE_BINS ); + + stereo_type_detect->subtract_power_y = 0.0f; + stereo_type_detect->subtract_power_y_smooth = 0.0f; + stereo_type_detect->target_power_y_smooth = 0.0f; + + stereo_type_detect->lr_total_bb_ratio_db = 0.0f; + stereo_type_detect->lr_total_hi_ratio_db = 0.0f; + stereo_type_detect->min_sum_total_ratio_db = 0.0f; + stereo_type_detect->subtract_target_ratio_db = 0.0f; + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_masa_stereotype_detection() + * + * Detect the type of the transport audio signals + *------------------------------------------------------------------------*/ + +void ivas_masa_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect ) +{ + float lr_total_bb_ratio_db = stereo_type_detect->lr_total_bb_ratio_db; + float lr_total_hi_ratio_db = stereo_type_detect->lr_total_hi_ratio_db; + float min_sum_total_ratio_db = stereo_type_detect->min_sum_total_ratio_db; + float subtract_target_ratio_db = stereo_type_detect->subtract_target_ratio_db; + float change_to_spaced; + int16_t change_to_spaced_selection; + float change_to_downmix; + float change_to_downmix2; + int16_t change_to_downmix_selection; + float subtract_temp; + float min_sum_temp; + float lr_total_bb_temp; + float lr_total_hi_temp; + + /* Determine if the determined features match the spaced mic type */ + change_to_spaced_selection = 0; + if ( subtract_target_ratio_db < -3.0f ) + { + subtract_temp = ( -subtract_target_ratio_db - 3.0f ) / 3.0f; + min_sum_temp = max( -min_sum_total_ratio_db / 6.0f, 0.0f ); + lr_total_bb_temp = lr_total_bb_ratio_db / 6.0f; + + change_to_spaced = subtract_temp + min_sum_temp + lr_total_bb_temp; + + if ( change_to_spaced >= 1.0f ) + { + change_to_spaced_selection = 1; + } + } + + /* Determine if the determined features match the downmix type, according to a metric */ + change_to_downmix_selection = 0; + if ( subtract_target_ratio_db > 0.0f ) + { + subtract_temp = subtract_target_ratio_db / 3.0f; + min_sum_temp = ( min_sum_total_ratio_db + 1.0f ) / 6.0f; + lr_total_bb_temp = -lr_total_bb_ratio_db / 6.0f; + + change_to_downmix = subtract_temp + min_sum_temp + lr_total_bb_temp; + + if ( change_to_downmix >= 1.0f ) + { + change_to_downmix_selection = 1; + } + } + + /* Determine if the determined features match the downmix type, according to another metric */ + if ( lr_total_hi_ratio_db < -12.0f ) + { + subtract_temp = ( subtract_target_ratio_db + 4.0f ) / 3.0f; + min_sum_temp = min_sum_total_ratio_db / 6.0f; + lr_total_hi_temp = ( -lr_total_hi_ratio_db - 12.0f ) / 3.0f; + + change_to_downmix2 = subtract_temp + min_sum_temp + lr_total_hi_temp; + + if ( change_to_downmix2 >= 1.0f ) + { + change_to_downmix_selection = 1; + } + } + + if ( stereo_type_detect->counter < 400 ) + { + stereo_type_detect->counter++; + } + else + { + if ( change_to_spaced_selection == 1 ) + { + stereo_type_detect->masa_stereo_type = MASA_STEREO_SPACED_MICS; + } + else if ( change_to_downmix_selection == 1 ) + { + stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; + } + } + + if ( stereo_type_detect->interpolator == 0 ) + { + if ( stereo_type_detect->current_stereo_type != stereo_type_detect->masa_stereo_type ) + { + stereo_type_detect->interpolator = 1; + stereo_type_detect->type_change_direction = stereo_type_detect->masa_stereo_type; + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * computeIntensityVector_dec() + * + * + *------------------------------------------------------------------------*/ + +void computeIntensityVector_dec( + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t num_frequency_bands, + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z ) +{ + /* + * W = a + ib; Y = c + id + * real(W*Y') = ac + bd + */ + int16_t i; + float real, img; + + for ( i = 0; i < num_frequency_bands; ++i ) + { + real = Cldfb_RealBuffer[0][0][i]; + img = Cldfb_ImagBuffer[0][0][i]; + intensity_real_x[i] = Cldfb_RealBuffer[3][0][i] * real + Cldfb_ImagBuffer[3][0][i] * img; + intensity_real_y[i] = Cldfb_RealBuffer[1][0][i] * real + Cldfb_ImagBuffer[1][0][i] * img; + intensity_real_z[i] = Cldfb_RealBuffer[2][0][i] * real + Cldfb_ImagBuffer[2][0][i] * img; + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_lfe_synth_with_cldfb() + * + * + *------------------------------------------------------------------------*/ + +void ivas_lfe_synth_with_cldfb( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t slot_index, + const int16_t subframe_index, + const int16_t nchan_transport ) +{ + float lfeGain; + float transportGain; + float protoLfeReal, protoLfeImag; + int16_t i; + float transportEne, protoLfeEne, targetEneLfe, targetEneTrans; + + set_zero( RealBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); + set_zero( ImagBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); + + protoLfeReal = RealBuffer[0][0][0]; + protoLfeImag = ImagBuffer[0][0][0]; + transportEne = RealBuffer[0][0][0] * RealBuffer[0][0][0] + ImagBuffer[0][0][0] * ImagBuffer[0][0][0]; + for ( i = 1; i < nchan_transport; i++ ) + { + protoLfeReal += RealBuffer[i][0][0]; + protoLfeImag += ImagBuffer[i][0][0]; + transportEne += RealBuffer[i][0][0] * RealBuffer[i][0][0] + ImagBuffer[i][0][0] * ImagBuffer[i][0][0]; + } + protoLfeEne = protoLfeReal * protoLfeReal + protoLfeImag * protoLfeImag; + + targetEneLfe = transportEne * hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index]; + targetEneTrans = transportEne * max( ( 1.0f - hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index] ), 0.01f ); + + hMasaLfeSynth->transportEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; + hMasaLfeSynth->protoLfeEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; + hMasaLfeSynth->targetEneLfeSmooth *= MCMASA_LFE_SYNTH_ALPHA; + hMasaLfeSynth->targetEneTransSmooth *= MCMASA_LFE_SYNTH_ALPHA; + + hMasaLfeSynth->transportEneSmooth += transportEne; + hMasaLfeSynth->protoLfeEneSmooth += protoLfeEne; + hMasaLfeSynth->targetEneLfeSmooth += targetEneLfe; + hMasaLfeSynth->targetEneTransSmooth += targetEneTrans; + + lfeGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneLfeSmooth / ( EPSILON + hMasaLfeSynth->protoLfeEneSmooth ) ) ); + transportGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneTransSmooth / ( EPSILON + hMasaLfeSynth->transportEneSmooth ) ) ); + + RealBufferLfe[slot_index][0] = protoLfeReal * lfeGain; + ImagBufferLfe[slot_index][0] = protoLfeImag * lfeGain; + + RealBuffer[0][0][0] *= transportGain; + ImagBuffer[0][0][0] *= transportGain; + for ( i = 1; i < nchan_transport; i++ ) + { + RealBuffer[i][0][0] *= transportGain; + ImagBuffer[i][0][0] *= transportGain; + } + + return; +} + + +/*------------------------------------------------------------------------- + * rotateAziEle_DirAC() + * + * Apply rotation to DirAC DOAs + *------------------------------------------------------------------------*/ + +void rotateAziEle_DirAC( + int16_t *azi, /* i/o: array of azimuth values */ + int16_t *ele, /* i/o: array of elevation values */ + const int16_t band1, /* i : bands to work on (lower limit) */ + const int16_t band2, /* i : bands to work on (upper bound) */ + const float *p_Rmat /* i : pointer to real-space rotation matrix */ +) +{ + int16_t b; + float dv_0, dv_1, dv_2; + float dv_r_0, dv_r_1, dv_r_2; + float w; + + push_wmops( "rotateAziEle_DirAC" ); + + for ( b = band1; b < band2; b++ ) + { + + /*Conversion spherical to cartesian coordinates*/ + w = cosf( ele[b] * PI_OVER_180 ); + dv_0 = w * cosf( azi[b] * PI_OVER_180 ); + dv_1 = w * sinf( azi[b] * PI_OVER_180 ); + dv_2 = sinf( ele[b] * PI_OVER_180 ); + + dv_r_0 = p_Rmat[0] * dv_0 + p_Rmat[1] * dv_1 + p_Rmat[2] * dv_2; + dv_r_1 = p_Rmat[3] * dv_0 + p_Rmat[4] * dv_1 + p_Rmat[5] * dv_2; + dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; + + /*Conversion spherical to cartesian coordinates*/ + azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); + ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); + } + + pop_wmops(); + + return; +} diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 803a612502..5dd5079d7d 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -37,6 +37,7 @@ #include "options.h" #include "ivas_error.h" #include "lib_rend.h" +#include "ivas_stat_rend.h" #include "ivas_stat_dec.h" // Note: needed until #156 is resolved /* clang-format off */ @@ -133,7 +134,7 @@ void efap_determine_gains( /*----------------------------------------------------------------------------------* - * SBA rendering + * DirAC/MASA rendering *----------------------------------------------------------------------------------*/ void ivas_sba_prototype_renderer( @@ -151,7 +152,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( #ifdef FIX_564 -void ivas_dirac_dec_binaural_gain( +void ivas_dirac_dec_binaural_sba_gain( float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ @@ -187,6 +188,323 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ); +/*! r: Configured reqularization factor value */ +float configure_reqularization_factor( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : total IVAS bitrate */ +); + +ivas_error ivas_dirac_alloc_mem( + DIRAC_REND_HANDLE hDirACRend, + const RENDERER_TYPE renderer_type, + const int16_t num_freq_bands, + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, + const int16_t hodirac_flag +); + +void ivas_dirac_free_mem( + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem +); + +void initDiffuseResponses( + float *diffuse_response_function, + const int16_t num_channels, + AUDIO_CONFIG output_config, + IVAS_OUTPUT_SETUP hOutSetup, + const int16_t ambisonics_order, + const IVAS_FORMAT ivas_format, + int16_t *num_ele_spk_no_diffuse_rendering, + AUDIO_CONFIG transport_config +); + +void computeIntensityVector_dec( + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t num_frequency_bands, + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z +); + +void protoSignalComputation_shd( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_direct_buffer_f, + float *proto_diffuse_buffer_f, + float *reference_power, + const int16_t slot_index, + const int16_t num_inputs, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + float *p_Rmat +); + +void protoSignalComputation1( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands +); + +void protoSignalComputation2( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t isloudspeaker, + const int16_t slot_index, + const int16_t num_freq_bands, + MASA_STEREO_TYPE_DETECT *stereo_type_detect +); + +void protoSignalComputation4( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + const + float *mtx_hoa_decoder, + const int16_t nchan_transport, + const int16_t *sba_map_tc_ind +); + +void ivas_dirac_dec_compute_diffuse_proto( + DIRAC_REND_HANDLE hDirACRend, + const int16_t num_freq_bands, + const int16_t slot_idx +); + +void computeDirectionAngles( + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z, + const int16_t num_frequency_bands, + int16_t *azimuth, + int16_t *elevation +); + +void ivas_masa_init_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect +); + +void ivas_masa_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect +); + +void ivas_lfe_synth_with_cldfb( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t slot_index, + const int16_t subframe_index, + const int16_t nchan_transport +); + +void rotateAziEle_DirAC( + int16_t *azi, + int16_t *ele, + const int16_t band1, + const int16_t band2, + const float *p_Rmat +); + +ivas_error ivas_dirac_dec_onset_detection_open( + const int16_t num_channels, + const int16_t num_freq_bands, + const int16_t max_band_decorr, + DIRAC_ONSET_DETECTION_PARAMS *ph_dirac_onset_detection_params, + DIRAC_ONSET_DETECTION_STATE *ph_dirac_onset_detection_state +); + +void ivas_dirac_dec_onset_detection_process( + const float *input_power_f, + float *onset_filter, + const int16_t num_protos_diff, + DIRAC_ONSET_DETECTION_PARAMS h_dirac_onset_detection_params, + DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state +); + +ivas_error ivas_dirac_dec_decorr_open( + DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, + DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, + const int16_t num_freq_bands, + int16_t num_outputs_diff, + const int16_t num_protos_diff, + const DIRAC_SYNTHESIS_CONFIG synthesisConf, + float *frequency_axis, + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs /* i : output sampling rate */ +); + +void ivas_dirac_dec_decorr_process( + const int16_t num_freq_bands, + int16_t num_channels, + const int16_t num_protos_diff, + const DIRAC_SYNTHESIS_CONFIG synthesisConf, + const int16_t nchan_transport, /* i : number of transport channels */ + const float *input_frame_f, + const int16_t num_protos_dir, + const int16_t *proto_index_dir, + float *frame_dec_f, + float *onset_filter, + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params, + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state +); + +void ivas_dirac_dec_decorr_close( + HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params, + HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state +); + +ivas_error ivas_dirac_dec_output_synthesis_open( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +void ivas_dirac_dec_output_synthesis_init( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +void ivas_dirac_dec_output_synthesis_close( + DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ +); + +void ivas_dirac_dec_output_synthesis_process_slot( + const float *reference_power, /* i : Estimated power */ + const float *onset, /* i : onset filter */ + const int16_t *azimuth, + const int16_t *elevation, + const float *diffuseness, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t sh_rot_max_order, + const float *p_Rmat, /* i : rotation matrix */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim /* i : flag to indicate parameter estimation mode */ +); + +void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nbslots, /* i : number of slots to process */ + const float *onset_filter, + float *diffuseness, + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim /* i : flag to indicate parameter estimation mode */ +); + +void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nbslots, /* i : number of slots to process */ + float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + float *reference_power_smooth, + float qualityBasedSmFactor, + const int16_t enc_param_start_band +); + +void compute_hoa_encoder_mtx( + const float *azimuth, + const float *elevation, + float *response, + const int16_t num_responses, + const int16_t ambisonics_order ); + +void ivas_dirac_dec_compute_gain_factors( + const int16_t num_freq_bands, + const float *diffuseness, + const int16_t max_band_decorr, + float *direct_gain_factor, + float *diffuse_gain_factor +); + +void ivas_dirac_dec_compute_power_factors( + const int16_t num_freq_bands, + const float *diffuseness, + const int16_t max_band_decorr, + float *direct_power_factor, + float *diffuse_power_factor +); + +void ivas_dirac_dec_compute_directional_responses( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + const int16_t *azimuth, + const int16_t *elevation, + const int16_t md_idx, + const float *surCohRatio, + const int16_t shd_rot_max_order, /* i : split-order rotation method */ + const float *p_Rmat, /* i : rotation matrix */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +void ivas_dirac_dec_get_frequency_axis( + float *frequency_axis, /* o : array of center frequencies of a real filter bank */ + const int32_t output_Fs, /* i : sampling frequency */ + const int16_t num_freq_bands /* i : number of frequency bands */ +); + +ivas_error ivas_spat_hSpatParamRendCom_config( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const int16_t dec_param_estim_flag, + const IVAS_FORMAT ivas_format, + const MC_MODE mc_mode, + const int32_t output_Fs, + const int16_t hodirac_flag +); + +void ivas_spat_hSpatParamRendCom_close( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out +); + +void ivas_dirac_rend_close( + DIRAC_REND_HANDLE *hDirACRend_out +); + +ivas_error ivas_dirac_allocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +); + +void ivas_dirac_deallocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +); + + /*----------------------------------------------------------------------------------* * HRTF diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2e30aafd68..accb05bc87 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -151,6 +151,263 @@ typedef struct ivas_spatial_parametric_rend_common_data_structure } SPAT_PARAM_REND_COMMON_DATA, *SPAT_PARAM_REND_COMMON_DATA_HANDLE; +/*----------------------------------------------------------------------------------* + * DirAC rendering structures + *----------------------------------------------------------------------------------*/ + +typedef struct dirac_dec_stack_mem +{ + /*Decorrelator*/ + float *frame_dec_f; + + /*Prototypes*/ + float *proto_direct_buffer_f; + float *proto_diffuse_buffer_f; + + /*Prototype NRGs*/ + float *proto_power_smooth; + float *proto_power_diff_smooth; + + /*Gain or power factors for directional and diffuse streams*/ + float *direct_power_factor; + float *diffuse_power_factor; + + /*Directional responses (gains & Nrg)*/ + float *direct_responses; + float *direct_responses_square; + + /* Target co-variance mtx */ + float *cy_auto_dir_smooth; + float *cy_cross_dir_smooth; + float *cy_auto_diff_smooth; + + float *reference_power; + float *onset_filter; + +} DIRAC_DEC_STACK_MEM, *DIRAC_DEC_STACK_MEM_HANDLE; + +/*Output synthesis*/ +typedef struct dirac_output_synthesis_params_structure +{ + int16_t max_band_decorr; + + int16_t use_onset_filters; + + float *interpolator; + float *alpha_synthesis; + float *alpha_synthesis_fast; + int16_t numAlphas; + int16_t numAlphasFast; + + float *proto_matrix; + + float diffuse_compensation_factor; + float diffuse_compensation_factor_decorr; + +} DIRAC_OUTPUT_SYNTHESIS_PARAMS; + +typedef struct dirac_output_synthesis_state_structure +{ + /* only pointer to local buffers */ + float *direct_responses; /* direct responses for DOA of current frame. Size: num_freq_bands*num_channels. */ + float *direct_responses_square; + float *diffuse_responses_square; /* squared diffuse responses. Size: num_channels. */ + + /* only pointer to local buffers */ + float *direct_power_factor; + float *diffuse_power_factor; + + float *proto_power_smooth; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ + float *proto_power_smooth_prev; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ + + float *proto_power_diff_smooth; + float *proto_power_diff_smooth_prev; + + /* only pointer to local buffers */ + float *proto_direct_buffer_f; /* Buffer for direct sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ + float *proto_diffuse_buffer_f; /* Buffer for diffuse sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ + + /* Output gain memories */ + float *gains_dir_prev; /* Direct sound gains of current synthesis block. Size: num_freq_bands*num_channel. */ + float *gains_diff_prev; /* Diffuse sound gains of previous synthesis block. Size: num_freq_bands*num_channel. */ + + /* only pointer to local buffers */ + float *cy_auto_dir_smooth; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ + float *cy_cross_dir_smooth; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ + float *cy_auto_diff_smooth; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + + /* PSD memories */ + float *cy_auto_dir_smooth_prev; /* Target auto PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + float *cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + float *cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + + const float *onset_filter; + + /* Temporal smoothing memories */ + float *reference_power_smooth_prev; + float *direction_smoothness_prev; + +} DIRAC_OUTPUT_SYNTHESIS_STATE; + +/* MASA stereo transport signal type detection structure */ +typedef struct +{ + MASA_TRANSPORT_SIGNAL_TYPE masa_stereo_type; + MASA_TRANSPORT_SIGNAL_TYPE current_stereo_type; + MASA_TRANSPORT_SIGNAL_TYPE type_change_direction; + + int16_t dipole_freq_range[2]; + + float left_bb_power; + float right_bb_power; + float total_bb_power; + + float left_hi_power; + float right_hi_power; + float total_hi_power; + + float sum_power[MASA_SUM_FREQ_RANGE_BINS]; + float total_power[MASA_SUM_FREQ_RANGE_BINS]; + + float subtract_power_y; + float subtract_power_y_smooth; + float target_power_y_smooth; + + float lr_total_bb_ratio_db; + float lr_total_hi_ratio_db; + float min_sum_total_ratio_db; + float subtract_target_ratio_db; + + int16_t counter; + int16_t interpolator; + +} MASA_STEREO_TYPE_DETECT; + +/* McMASA LFE synthesis structure */ +typedef struct ivas_mcmasa_lfe_synth_struct +{ + float lfeToTotalEnergyRatio[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t lfeGainPrevIndex; + float transportEneSmooth; + float protoLfeEneSmooth; + float targetEneLfeSmooth; + float targetEneTransSmooth; + + float *lfeSynthRingBuffer; + int16_t ringBufferLoPointer; + int16_t ringBufferHiPointer; + float lowpassSum; + int16_t ringBufferSize; + + float *lfeSynthRingBuffer2; + int16_t ringBufferLoPointer2; + float lowpassSum2; + int16_t ringBufferSize2; + + float *delayBuffer_syncLp; + int16_t delayBuffer_syncLp_size; + + float *delayBuffer_syncDirAC; + int16_t delayBuffer_syncDirAC_size; + + float lfeGainPrev; + float transportGainPrev; + float interpolator[CLDFB_NO_CHANNELS_MAX]; + +} MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; + +/* DirAC renderer main structure */ +typedef struct ivas_dirac_rend_data_structure +{ + IVAS_OUTPUT_SETUP hOutSetup; + + /*Parameter estimation*/ + int16_t index_buffer_intensity; + float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; + float *buffer_energy; + + float *frequency_axis; + float *diffuse_response_function; + float *hoa_encoder; + const float *hoa_decoder; + + /*Decoder parameters */ + /*Prototypes*/ + int16_t num_outputs_dir; + int16_t num_outputs_diff; + int16_t num_protos_dir; + int16_t num_protos_diff; + int16_t num_protos_ambi; + DIRAC_SYNTHESIS_CONFIG synthesisConf; + DIRAC_PANNING_CONFIG panningConf; + + /* prototype computing */ + int16_t *proto_index_dir; + int16_t *proto_index_diff; + + int16_t proto_signal_decorr_on; + + /*Decoder states=memories*/ + float *proto_frame_f; + float *proto_frame_dec_f; + + DIRAC_DEC_STACK_MEM stack_mem; + MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect; + + int16_t num_ele_spk_no_diffuse_rendering; + + const int16_t *sba_map_tc; + + DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_psd_params; + DIRAC_OUTPUT_SYNTHESIS_STATE h_output_synthesis_psd_state; + + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; + +} DIRAC_REND_DATA, *DIRAC_REND_HANDLE; + + +/*----------------------------------------------------------------------------------* + * VBAP structures + *----------------------------------------------------------------------------------*/ + +/* Defines a single virtual surface triplet of loudspeakers + * with a precalculated inverse matrix */ +typedef struct vbap_vs_triplet_structure +{ + uint8_t speaker_node[3]; + float inverse_matrix[3][3]; + +} VBAP_VS_TRIPLET; + + +/* Storage structure for fast runtime triplet search */ +typedef struct triplet_search_structure +{ + VBAP_VS_TRIPLET *triplets; + int16_t num_triplets; + int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; + +} VBAP_SEARCH_STRUCT; + + +/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ +typedef struct vbap_data_structure +{ + VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ + int16_t num_search_structs; + int16_t num_speaker_nodes; + int16_t num_speaker_nodes_internal; + int16_t top_virtual_speaker_node_index; /* These indices can be negative */ + int16_t bottom_virtual_speaker_node_index; + int16_t back_virtual_speaker_node_index; + float *bottom_virtual_speaker_node_division_gains; + float *top_virtual_speaker_node_division_gains; + float *back_virtual_speaker_node_division_gains; + +} VBAP_DATA, *VBAP_HANDLE; + + /*----------------------------------------------------------------------------------* * Binaural FastConv Rendering structure *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index fd0a935fee..b3b53300f8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2356,7 +2356,7 @@ static ivas_error initMasaDummyDecForMcOut( { return error; } - decDummy->rend_common_data->dirac_bs_md_write_idx = 0; + decDummy->hSpatParamRendCom->dirac_bs_md_write_idx = 0; if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -2434,7 +2434,7 @@ static ivas_error initMasaDummyDecForSbaOut( { return error; } - decDummy->rend_common_data->dirac_bs_md_write_idx = 0; + decDummy->hSpatParamRendCom->dirac_bs_md_write_idx = 0; numCldfbAnalyses = decDummy->nchan_transport; numCldfbSyntheses = decDummy->hDecoderConfig->nchan_out; @@ -2504,7 +2504,7 @@ static ivas_error initMasaDummyDecForBinauralOut( { return error; } - decDummy->rend_common_data->dirac_bs_md_write_idx = 0; + decDummy->hSpatParamRendCom->dirac_bs_md_write_idx = 0; if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -2595,7 +2595,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; decDummy->hDirACRend = NULL; - decDummy->rend_common_data = NULL; + decDummy->hSpatParamRendCom = NULL; decDummy->hQMetaData = NULL; decDummy->hHrtfParambin = NULL; decDummy->hHeadTrackData = NULL; @@ -2773,7 +2773,7 @@ static void freeDecoderDummy( /* DirAC handle */ ivas_dirac_rend_close( &( pDecDummy->hDirACRend ) ); - ivas_spat_rend_common_data_close( &( pDecDummy->rend_common_data ) ); + ivas_spat_hSpatParamRendCom_close( &( pDecDummy->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( pDecDummy->hDirAC ) ); /* Qmetadata handle */ @@ -5893,41 +5893,41 @@ static ivas_error renderActiveInputsSba( static void copyMasaMetadataToDiracRenderer( MASA_METADATA_FRAME *meta, - SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data ) + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom ) { int16_t band, sf, bin; int16_t meta_write_index; - rend_common_data->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; + hSpatParamRendCom->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - meta_write_index = ( rend_common_data->dirac_bs_md_write_idx + sf ) % rend_common_data->dirac_md_buffer_length; + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + sf ) % hSpatParamRendCom->dirac_md_buffer_length; for ( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { for ( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1]; bin++ ) { - rend_common_data->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; - rend_common_data->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; - rend_common_data->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; - rend_common_data->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - rend_common_data->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; - rend_common_data->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; - - if ( rend_common_data->numSimultaneousDirections == 2 ) + hSpatParamRendCom->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; + hSpatParamRendCom->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; + hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; + hSpatParamRendCom->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; + hSpatParamRendCom->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; + + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) { - rend_common_data->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; - rend_common_data->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; - rend_common_data->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; - rend_common_data->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - rend_common_data->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; + hSpatParamRendCom->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; + hSpatParamRendCom->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; + hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; + hSpatParamRendCom->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; } } } } - rend_common_data->dirac_bs_md_write_idx = ( rend_common_data->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % rend_common_data->dirac_md_buffer_length; + hSpatParamRendCom->dirac_bs_md_write_idx = ( hSpatParamRendCom->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; return; } @@ -5939,7 +5939,7 @@ static void renderMasaToMc( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->rend_common_data ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -5962,7 +5962,7 @@ static void renderMasaToSba( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->rend_common_data ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); @@ -5978,7 +5978,7 @@ static void renderMasaToBinaural( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->rend_common_data ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); -- GitLab From 665b79205864e8ceaf9e5f8e28fe122c80a99085 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 11 Jul 2023 11:59:02 +0000 Subject: [PATCH 302/591] Removes extra MC tests from self-test --- scripts/config/self_test.prm | 68 ------------------------------------ 1 file changed, 68 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 74f395b093..f0b30c28cf 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1245,71 +1245,3 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // NON DIEGETiC PAN at 60 kbps, 48kHz in, 48kHz out, STEREO out ../IVAS_cod 64000 48 testv/stv48c.wav bit ../IVAS_dec -non_diegetic_pan -0.5 48 bit testv/stv48c.pcm_MONO_64000_48-48_STEREO_NON-DIEGETIC-PAN_-0.5.tst - - - - - - -// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_binaural.tst - -// Multi-channel 7_1_4 at 80 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 7_1_4 80000 48 testv/stv714MC48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_80000_48-48_MC_binaural.tst - -// Multi-channel 7_1_4 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_64000_48-48_MC_binaural.tst - -// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_binaural.tst - -// Multi-channel 7_1_4 at 32 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 7_1_4 32000 48 testv/stv714MC48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_32000_48-48_MC_binaural.tst - -// Multi-channel 7_1_4 at 16.4 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 7_1_4 16400 48 testv/stv714MC48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_16400_48-48_MC_binaural.tst - -// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit -../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_7_1_4.tst - -// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit -../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_7_1_4.tst - -// Multi-channel 7_1_4 at 24.4 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 7_1_4 24400 48 testv/stv714MC48c.wav bit -../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_24400_48-48_MC_7_1_4.tst - -// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit -../IVAS_dec FOA 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_FOA.tst - -// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit -../IVAS_dec FOA 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_FOA.tst - -// Multi-channel 7_1_4 at 24.4 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -mc 7_1_4 24400 48 testv/stv714MC48c.wav bit -../IVAS_dec FOA 48 bit testv/stv714MC48c.wav_MC714_24400_48-48_MC_FOA.tst - -// Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit -../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_MC_MONO.tst - -// Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit -../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_MC_MONO.tst - -// Multi-channel 7_1_4 at 24.4 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 7_1_4 24400 48 testv/stv714MC48c.wav bit -../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_24400_48-48_MC_MONO.tst - - - -- GitLab From b38131320feeee24a697be046b889e660be894f1 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 11 Jul 2023 22:54:14 +1000 Subject: [PATCH 303/591] pred quant range fix and euler to rot matrix fix --- apps/renderer.c | 3 + lib_com/ivas_cnst.h | 6 ++ lib_com/options.h | 2 + lib_dec/ivas_spar_decoder.c | 4 +- lib_rend/ivas_rotation.c | 30 +------ lib_rend/ivas_splitRendererPre.c | 136 +++++++++++++++++++++++++++++++ lib_rend/ivas_stat_rend.h | 28 ++++--- lib_rend/lib_rend.c | 8 ++ 8 files changed, 176 insertions(+), 41 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 967f6ce946..e7172c84aa 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1984,6 +1984,9 @@ int main( IsmPositionProvider_close( positionProvider ); RenderConfigReader_close( &renderConfigReader ); +#ifdef DEBUGGING + dbgclose(); +#endif #ifdef WMOPS print_wmops(); print_mem( NULL ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 70e63ad65d..020a16bf5b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1554,8 +1554,14 @@ typedef enum #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) #define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) #define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) +#ifdef SPLIT_REND_QUANT_RANGE_INC +#define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.4f ) +#define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.4f ) +#else #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.0f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT #define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f) #define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f) diff --git a/lib_com/options.h b/lib_com/options.h index 247c850a0e..6cadbaf3c6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,8 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER +//#define SPLIT_POSE_CORRECTION_DEBUG +#define SPLIT_REND_QUANT_RANGE_INC #define SPLIT_REND_CLDFB_ISM diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index fc5be70877..352d99ba9e 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1678,11 +1678,11 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif - ) ) + ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 01d6b68420..9f599bdb27 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -156,33 +156,9 @@ void QuatToRotMat( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( quat.w == -3.0 ) { - float c1, c2, c3, s1, s2, s3; - /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention - * - * yaw: rotate scene counter-clockwise in the horizontal plane - * pitch: rotate scene in the median plane, increase elevation with positive values - * roll: rotate scene from the right ear to the top - */ - - c1 = cosf( quat.z / _180_OVER_PI ); - c2 = cosf( quat.y / _180_OVER_PI ); - c3 = cosf( quat.x / _180_OVER_PI ); - - s1 = sinf( quat.z / _180_OVER_PI ); - s2 = sinf( -quat.y / _180_OVER_PI ); - s3 = sinf( quat.x / _180_OVER_PI ); - - Rmat[0][0] = c2 * c3; - Rmat[0][1] = -c2 * s3; - Rmat[0][2] = s2; - - Rmat[1][0] = c1 * s3 + c3 * s1 * s2; - Rmat[1][1] = c1 * c3 - s1 * s2 * s3; - Rmat[1][2] = -c2 * s1; - - Rmat[2][0] = s1 * s3 - c1 * c3 * s2; - Rmat[2][1] = c3 * s1 + c1 * s2 * s3; - Rmat[2][2] = c1 * c2; + IVAS_QUATERNION quat_local; + Euler2Quat( deg2rad( quat.x ), deg2rad( quat.y ), deg2rad( quat.z ), &quat_local ); + QuatToRotMat( quat_local, Rmat ); } else #endif diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 2c213b0d98..0e9d40ce0b 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -54,6 +54,10 @@ #endif #include "wmc_auto.h" +#ifdef DBG_WAV_WRITER +#include "string.h" +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_BAND_SMOOTH ( 1 ) @@ -1460,6 +1464,107 @@ void ivas_rend_CldfbSplitPreRendProcess( low_res_pre_rend_rot, target_md_bits ); +#ifdef SPLIT_POSE_CORRECTION_DEBUG + float tmpCrendBuffer[2][L_FRAME48k], quant_val, step, minv, maxv; + IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t sf_idx, pos_idx, b, ch1, ch2; + int32_t read_off, write_off; + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + QuaternionsPost[sf_idx].w = -3.0f; + QuaternionsPost[sf_idx].x = 0.0f; + QuaternionsPost[sf_idx].y = 0.0f; + QuaternionsPost[sf_idx].z = 0.0f; + } + +#if 0 + read_off = pBits->bits_read; + write_off = pBits->bits_written; + ivas_splitBinPostRendMdDec( + pBits, + hBinHrSplitPreRend->hBinHrSplitPostRend, + pMultiBinPoseData ); + pMultiBinPoseData->poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; + pBits->bits_read = read_off; + pBits->bits_written = write_off; +#else + hBinHrSplitPreRend->hBinHrSplitPostRend->low_Res = 1; + set_fix_rotation_mat( hBinHrSplitPreRend->hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData ); + set_pose_types( hBinHrSplitPreRend->hBinHrSplitPostRend->pose_type, pMultiBinPoseData ); + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx] = headPositions[sf_idx]; + } + for ( sf_idx = 0; sf_idx < 1; sf_idx++ ) + { + for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ ) + { + for ( b = 0; b < MAX_SPLIT_REND_MD_BANDS; b++ ) + { + hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] = + hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; +#if 0 + BIN_HR_SPLIT_REND_MD_HANDLE hMd; + hMd = &hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + minv = -1.4f; + maxv = 1.4f; + step = ( maxv - minv ) / 30.0f; + if ( b >= 20 ) + { + float sign; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sign = ( hMd->pred_mat_re[ch1][ch2] >= 0.0f ) ? 1.0f : -1.0f; + IVAS_CALCULATE_ABS( hMd->pred_mat_re[ch1][ch2], hMd->pred_mat_im[ch1][ch2], hMd->pred_mat_re[ch1][ch2] ); + hMd->pred_mat_re[ch1][ch2] *= sign; + hMd->pred_mat_im[ch1][ch2] = 0.0f; + } + } + } + + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + quant_val = hMd->pred_mat_re[ch1][ch2] - hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx][ch1][ch2]; + quant_val = min( maxv, max( quant_val, minv ) ); + quant_val = (int16_t) roundf( quant_val / step ); + hMd->pred_mat_re[ch1][ch2] = quant_val * step; + hMd->pred_mat_re[ch1][ch2] += hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx][ch1][ch2]; + + quant_val = hMd->pred_mat_im[ch1][ch2]; + quant_val = min( maxv, max( quant_val, minv ) ); + quant_val = (int16_t) roundf( quant_val / step ); + hMd->pred_mat_im[ch1][ch2] = quant_val * step; + } + } +#endif + } + } + } + +#endif + ivas_rend_CldfbSplitPostRendProcess( + hBinHrSplitPreRend->hBinHrSplitPostRend, + pMultiBinPoseData, + QuaternionsPost, + Cldfb_In_BinReal[0], + Cldfb_In_BinImag[0], + tmpCrendBuffer, + 1 ); + + { + float *pOut[2]; + char fname[200] = "ref_act_pos.wav"; + pOut[0] = tmpCrendBuffer[0]; + pOut[1] = tmpCrendBuffer[1]; + dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * hBinHrSplitPreRend->hBinHrSplitPostRend->cldfbSyn[0]->no_channels, + fname, 48000, 2 ); + } +#endif + pop_wmops(); return; @@ -1521,6 +1626,14 @@ ivas_error ivas_splitBinPreRendOpen( set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData ); set_pose_types( hBinRend->pose_type, pMultiBinPoseData ); ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg ); + +#ifdef SPLIT_POSE_CORRECTION_DEBUG + ivas_splitBinPostRendOpen( + &hBinRend->hBinHrSplitPostRend, + pMultiBinPoseData, + 48000 ); +#endif + *hBinHrSplitPreRend = hBinRend; return error; } @@ -1545,6 +1658,10 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend } } #endif +#ifdef SPLIT_POSE_CORRECTION_DEBUG + ivas_splitBinPostRendClose( &( *hBinHrSplitPreRend )->hBinHrSplitPostRend ); +#endif + free( ( *hBinHrSplitPreRend ) ); ( *hBinHrSplitPreRend ) = NULL; } @@ -1945,6 +2062,25 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) #endif { + +#ifdef SPLIT_POSE_CORRECTION_DEBUG + { + float *pOut[2]; + char fname[200] = "ref_out_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + + pOut[0] = in_delayed[2 * pos_idx]; + pOut[1] = in_delayed[2 * pos_idx + 1]; + dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * max_bands, + fname, 48000, 2 ); + } + +#endif + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 674ba95d6c..f9b540b5db 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -210,18 +210,6 @@ typedef struct ivas_binaural_head_rot_split_rendering_huff_struct int16_t p_gd_diff_base2_code_len; int16_t p_gd_diff_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS]; } BIN_HR_SPLIT_REND_HUFF, *BIN_HR_SPLIT_REND_HUFF_HANDLE; - -typedef struct ivas_binaural_head_rot_split_pre_rendering_struct -{ - BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; - float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1]; - BIN_HR_SPLIT_REND_HUFF huff_cfg; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS]; -#endif -} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE; - typedef struct ivas_binaural_head_rot_split_post_rendering_struct { BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; @@ -248,6 +236,22 @@ typedef struct ivas_binaural_head_rot_split_post_rendering_struct #endif } BIN_HR_SPLIT_POST_REND, *BIN_HR_SPLIT_POST_REND_HANDLE; +typedef struct ivas_binaural_head_rot_split_pre_rendering_struct +{ + BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS]; + float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1]; + BIN_HR_SPLIT_REND_HUFF huff_cfg; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS]; +#endif + +#ifdef SPLIT_POSE_CORRECTION_DEBUG + BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend; +#endif +} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE; + + typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct { void *pLcld_enc; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6bd6ff62b2..b46ec46a34 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3720,6 +3720,14 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; + +#ifdef SPLIT_REND_LC3PLUS_MC + for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsMc[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsMc[i].splitTdRendWrappers ) ); ++j ) + { + hIvasRend->inputsMc[i].splitTdRendWrappers[j].hBinRendererTd = NULL; + hIvasRend->inputsMc[i].splitTdRendWrappers[j].hHrtfTD = NULL; + } +#endif } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) -- GitLab From 24b8224c8380fb8e5b000614642a675e9806dfd0 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 11 Jul 2023 23:47:30 +1000 Subject: [PATCH 304/591] crash fix in MC split rendering mode with external renderer --- lib_rend/lib_rend.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index dd65a6d30a..10c5dad02d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8590,7 +8590,13 @@ ivas_error IVAS_REND_GetSamples( /* Use internal buffer if outputting split rendering bitstream */ if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && - ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) +#ifdef SPLIT_REND_LC3PLUS_MC + ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || + ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) +#else + ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) +#endif + ) ) { outAudio = hIvasRend->splitRendEncBuffer; } -- GitLab From 56989b93a093cea0d655f97a3ed119980aa6517c Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Tue, 11 Jul 2023 18:07:37 +0200 Subject: [PATCH 305/591] Choose default split codec as agreed: TD -> LC3plus, CLDFB -> LCLD --- lib_com/common_api_types.h | 1 + lib_dec/ivas_init_dec.c | 10 ++++++++++ lib_dec/lib_dec.c | 2 +- lib_rend/ivas_prot_rend.h | 9 ++++++++- lib_rend/ivas_render_config.c | 2 +- lib_rend/ivas_splitRendererPre.c | 6 +++++- lib_rend/ivas_splitRenderer_utils.c | 23 ++++++++++++++++++----- lib_rend/lib_rend.c | 2 +- 8 files changed, 45 insertions(+), 10 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 909a16b514..3c1897331e 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -116,6 +116,7 @@ typedef enum { IVAS_SPLIT_REND_CODEC_LCLD, IVAS_SPLIT_REND_CODEC_LC3PLUS, + IVAS_SPLIT_REND_CODEC_DEFAULT, /* Will use LCLD for CLDFB rendering paths and LC3plus for TD rendering paths */ IVAS_SPLIT_REND_CODEC_NONE } IVAS_SPLIT_REND_CODEC; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cfb45b5eb0..f5e9d9b0d1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1273,6 +1273,10 @@ ivas_error ivas_init_decoder( if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { +#ifdef SPLIT_REND_LC3PLUS + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 0 ); +#endif + #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING error = #endif @@ -1329,6 +1333,8 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) #endif { + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1 ); + ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->splitBinRend.splitrend.multiBinPoseData, @@ -1396,6 +1402,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) { +#ifdef SPLIT_REND_LC3PLUS + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1 ); +#endif + ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->splitBinRend.splitrend.multiBinPoseData, diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 86f08ac778..314fdc447d 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1532,7 +1532,7 @@ ivas_error IVAS_DEC_GetRenderConfig( hRCout->split_rend_config.codec_delay_ms = 0; #endif #ifdef SPLIT_REND_LC3PLUS - hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; #endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 123d147ac4..c0a567d969 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1166,7 +1166,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], const int32_t SplitRendBitRate, #ifdef SPLIT_REND_LC3PLUS - const IVAS_SPLIT_REND_CODEC splitCodec, + IVAS_SPLIT_REND_CODEC splitCodec, #endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1376,6 +1376,13 @@ void masaPrerendClose( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ); +#ifdef SPLIT_REND_LC3PLUS +void ivas_split_rend_choose_default_codec( + IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ + int16_t isRenderingInTd /* i : flag: is rendering done in TD? */ +); +#endif + /* clang-format on */ #endif /* IVAS_PROT_REND_H */ diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 99923860dd..28e6935120 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -132,7 +132,7 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; #endif #ifdef SPLIT_REND_LC3PLUS - ( *hRenderConfig )->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + ( *hRenderConfig )->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; ( *hRenderConfig )->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; #endif diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 0e9d40ce0b..ae342f7955 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2222,7 +2222,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], const int32_t SplitRendBitRate, #ifdef SPLIT_REND_LC3PLUS - const IVAS_SPLIT_REND_CODEC splitCodec, + IVAS_SPLIT_REND_CODEC splitCodec, #endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -2244,6 +2244,10 @@ ivas_error ivas_renderMultiBinToSplitBinaural( set_fix_rotation_mat( hSplitBin->hBinHrSplitPreRend->fix_pos_rot_mat, &hSplitBin->multiBinPoseData ); set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); +#ifdef SPLIT_REND_LC3PLUS + ivas_split_rend_choose_default_codec( &splitCodec, td_input ); +#endif + if ( #ifdef SPLIT_REND_LC3PLUS td_input diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 965ed46ec6..cac6a83b54 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -544,7 +544,7 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p /* Valid DOF range is 0-3 */ if ( pSplitRendConfig->dof < 0 || pSplitRendConfig->dof > 3 ) { - return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Valid DOF range is 0-3" ); } if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD ) @@ -552,20 +552,20 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p /* LCLD only supports CLDFB head pose correction */ if ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "LCLD only supports CLDFB head pose correction" ); } /* LCLD doesn't support 0-DOF */ if ( pSplitRendConfig->dof == 0 ) { - return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "LCLD doesn't support 0-DOF" ); } } /* Only CLDFB pose correction supports HQ mode */ if ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB && pSplitRendConfig->hq_mode != 0 ) { - return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Only CLDFB pose correction supports HQ mode" ); } /* Validate bitrate */ @@ -581,7 +581,7 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p /* Only valid with 0 DOF */ if ( pSplitRendConfig->dof != 0 ) { - return IVAS_ERR_INVALID_SPLIT_REND_CONFIG; + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "320 kpbs is only valid with 0 DOF" ); } break; default: @@ -801,3 +801,16 @@ void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData return; } #endif + + +#ifdef SPLIT_REND_LC3PLUS +void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, int16_t isRenderingInTd ) +{ + if ( *pCodec == IVAS_SPLIT_REND_CODEC_DEFAULT ) + { + *pCodec = isRenderingInTd ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; + } + + return; +} +#endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 10c5dad02d..c589084aaf 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5017,7 +5017,7 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.codec_delay_ms = 0; #endif #ifdef SPLIT_REND_LC3PLUS - hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LCLD; + hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; #endif -- GitLab From bbda05b201e8dd0aac320951b5b67184bf88fa8e Mon Sep 17 00:00:00 2001 From: azmill Date: Mon, 10 Jul 2023 14:07:59 +1000 Subject: [PATCH 306/591] Adding matlab scripts to convert SD HRIRs to SHD HRIRs --- .../matlab_hrir_generation_scripts/README.md | 5 + .../convert_SD2SHD_HRIRs.m | 60 +++ .../generate_HOA_HRIRs_MOD_lens.m | 131 ++++++ .../generate_rom_tables.m | 250 ++++++++++ .../get_allpass_IRs.m | 70 +++ .../hrtf_library_loader.m | 435 ++++++++++++++++++ .../hrtf_support_coefs.mat | 3 + .../matlab_hrir_generation_scripts/m_dft.m | 72 +++ .../m_hilbert.m | 40 ++ .../matlab_hrir_generation_scripts/m_idft.m | 68 +++ .../mag2min_phase.m | 47 ++ .../make_unit_vectors.m | 85 ++++ .../sphere_packing_2562.mat | 3 + 13 files changed, 1269 insertions(+) create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_support_coefs.mat create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/mag2min_phase.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/make_unit_vectors.m create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/sphere_packing_2562.mat diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md new file mode 100644 index 0000000000..d5dd3f6a65 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md @@ -0,0 +1,5 @@ + +### 2023-07-07 +Entry point to convert SD HRTFs to SHD HRTFs is the convert_SD2SHD_HRIRs.m script. + +Python 3.9.x needs to be installed with the sofar python module. The convert_SD2SHD_HRIRs.m script needs the path to this python. diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m new file mode 100644 index 0000000000..bdd0145e4b --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m @@ -0,0 +1,60 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function convert_SD2SHD_HRIRs(python_path, sofa_path, sofa_file, IR_size) + +data_struct = struct.empty(3,0); + +sr = [48000, 32000, 16000]; +sr_short = [48, 32, 16]; +sr_dft_size = [240, 160, 80]; + +% FOA +data_struct(1).IR_data = generate_HOA_HRIRs_MOD_lens(1, python_path, sofa_path, sofa_file, IR_size); +data_struct(1).HOA_name = 'FOA'; +data_struct(1).n_HOA_ch = 4; +data_struct(1).sr = sr; +data_struct(1).sr_short = sr_short; +data_struct(1).sr_dft_size = sr_dft_size; + +% HOA2 +data_struct(2).IR_data = generate_HOA_HRIRs_MOD_lens(2, python_path, sofa_path, sofa_file, IR_size); +data_struct(2).HOA_name = 'HOA2'; +data_struct(2).n_HOA_ch = 9; +data_struct(2).sr = sr; +data_struct(2).sr_short = sr_short; +data_struct(2).sr_dft_size = sr_dft_size; + +% HOA3 +data_struct(3).IR_data = generate_HOA_HRIRs_MOD_lens(3, python_path, sofa_path, sofa_file, IR_size); +data_struct(3).HOA_name = 'HOA3'; +data_struct(3).n_HOA_ch = 16; +data_struct(3).sr = sr; +data_struct(3).sr_short = sr_short; +data_struct(3).sr_dft_size = sr_dft_size; + +generate_rom_tables(data_struct) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m new file mode 100644 index 0000000000..089baafff3 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m @@ -0,0 +1,131 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function IR_data = generate_HOA_HRIRs_MOD_lens(order, python_path, sofa_path, sofa_file_name, ir_len) + % HRIR convertor - Takes sphere sampled HRIRs and converts them to + % HOA HRIRs. + % + % order - HOA order to be converted to. + % python_path - path that points to the python binary that has the + % sofar python module installed. sofar is needed to read the .sofa + % files that contain the HRIRs. + % sofa_path - path to the directory that contains the sofa files to be + % converted. + % sofa_file - file name of the HRTFs to be converted + % ir_len - length of the IRs to be used. + % + % Typical usage: + % generate_HOA_HRIRs_MOD_lens(1, "~/.pyenv/versions/3.8.16/bin/python", '~/git/ivas-pc-testfiles/sofa-files/', 'HRIR_128_48000.sofa', 128) + % + +% Pointing to the correct python binary +pyenv(Version=python_path); + +% Load in the support coefs +load('hrtf_support_coefs.mat', 'hrtf_support_coefs'); +rmsSphere = hrtf_support_coefs(order).rmsSphere; +LR_Odd = hrtf_support_coefs(order).LR_Odd; +XYZ_to_Pan = hrtf_support_coefs(order).XYZ_to_Pan; +AllPass = hrtf_support_coefs(order).AP; + +% Choose a hi-res set of positions to sample the input HRTFs +Vs_hi_res = load("sphere_packing_2562.mat"); +Vs_hi_res = Vs_hi_res.Vs_hi_res; +N = 512; + +% Fetch the HRTFs, and figure out the ITD for every direction +% name = ['HRIR_', num2str(ir_len), '_Meth5_IRC_53_Q10_symL_Itrp1_48000']; +H = hrtf_library_loader(); +H.readSOFA(char(fullfile(sofa_path, sofa_file_name))); + +IRs_hi_res = H.XYZ_to_IR(Vs_hi_res); +FRs_hi_res = m_dft(IRs_hi_res, N); % freq x ears x Vs + +FRs_hi_res_minP = mag2min_phase(FRs_hi_res); + +Excess_Phase = squeeze(unwrap(diff(angle(FRs_hi_res), 1, 2) - ... + diff(angle(FRs_hi_res_minP), 1, 2))); + +bin1200 = ceil( 1200/24000*N ); +ITD_hi_res = Excess_Phase(bin1200,:)' / ((bin1200-0.5)/N*24000*2*pi); + +MaxDel = max(ITD_hi_res, [], 'all'); + +% Create 2 ears +Ear_dels_hi_res = (repmat(ITD_hi_res, 1, 2) .* [0.5 -0.5]) + 0.5*MaxDel .* ... + (1 - 2/pi*cos(ITD_hi_res * pi/2 / MaxDel)); + +MRs_hi_res = abs(FRs_hi_res_minP); +% Generate permutation +[~, perm] = ismembertol(... + Vs_hi_res', Vs_hi_res'.*[1,-1,1], ... + 1e-4, "ByRows",true); +MRs_hi_res(:,2,:) = MRs_hi_res(:,2,perm); + +New_FreqResp_L = mag2min_phase(squeeze(mean(MRs_hi_res, 2))) .* ... + m_dft(get_allpass_IRs(AllPass, Ear_dels_hi_res(:, 1) * 48000), N, 1); + +% Create solving weights +weights = abs(New_FreqResp_L); +weights(weights < 0.1) = 0.1; +weights = 1 ./ (sqrt(sqrt(weights))); + +% Solve to compute the HOA frequency responses. +[m, ~] = size(XYZ_to_Pan); +FreqResp_HOA = zeros(m, N); +for k=1:N + Aw = New_FreqResp_L(k,:) .* weights(k,:); + Bw = XYZ_to_Pan .* weights(k,:); + + FreqResp_HOA(:,k) = Aw * pinv(Bw, 0); +end + +FreqResp_HOA_abs2 = real(FreqResp_HOA.*conj(FreqResp_HOA)); +FreqResp_HOA = FreqResp_HOA .* mag2min_phase(((FreqResp_HOA_abs2' * rmsSphere.^2) .^ (-0.5)), 1).'; +% Convert back to IRs +IR_HOA = m_idft(FreqResp_HOA.', [], 1); + +IR_HOA = cat(3, IR_HOA, (IR_HOA .* (1-2*LR_Odd)')); +% Put matrix dimensions in the right order +IR_HOA = permute(IR_HOA, [3, 1, 2]); + +% Get the IRs to the right length +IR_HOA = IR_HOA(:,1:ir_len,:) .* sin(interp1([0,150/192*ir_len,ir_len+1],[1,1,0]*pi/2, 1:ir_len)); + +IR = permute(IR_HOA, [2, 1, 3]); +HOAformat_str = ['HOA',num2str(order),'S']; +save(fullfile(erase(sofa_file_name, ".sofa") + "_converted_" + HOAformat_str + ".mat"), "IR") + +H.updateSOFA(IR); +H.writeSOFA(fullfile(erase(sofa_file_name, ".sofa") + "_converted_" + HOAformat_str + ".sofa")); + +IR_data = IR; + + + + + diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m new file mode 100644 index 0000000000..ef61544ba1 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m @@ -0,0 +1,250 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function generate_rom_tables(data_struct) + + h_file_name = 'ivas_rom_binaural_crend_head.h'; + c_file_name = 'ivas_rom_binaural_crend_head.c'; + tab = ' '; + + copyright_str = string(join({ + '/******************************************************************************************************' + '' + ' (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,' + ' Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,' + ' Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,' + ' Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other' + ' contributors to this repository. All Rights Reserved.' + '' + ' This software is protected by copyright law and by international treaties.' + ' The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,' + ' Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,' + ' Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,' + ' Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other' + ' contributors to this repository retain full ownership rights in their respective contributions in' + ' the software. This notice grants no license of any kind, including but not limited to patent' + ' license, nor is any license granted by implication, estoppel or otherwise.' + '' + ' Contributors are required to enter into the IVAS codec Public Collaboration agreement before making' + ' contributions.' + '' + ' This software is provided "AS IS", without any express or implied warranties. The software is in the' + ' development stage. It is intended exclusively for experts who have experience with such software and' + ' solely for the purpose of inspection. All implied warranties of non-infringement, merchantability' + ' and fitness for a particular purpose are hereby disclaimed and excluded.' + '' + ' Any dispute, controversy or claim arising under or in relation to providing this software shall be' + ' submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in' + ' accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and' + ' the United Nations Convention on Contracts on the International Sales of Goods.' + '' + '*******************************************************************************************************/' + '' + '/* clang-format off */' + '' + '/*-------------------------------------------------------------------------' + ' * Binaural rendering related ROM tables' + ' *------------------------------------------------------------------------*/' + '' + '/* Binaural rendering data set based on HRIRs */' + '/* Tables generated by scripts/binauralRenderer_interface/generate_cren_ivas_tables.c, see mixer_conv_sofa_to_rom_table_converter_readme.txt */' + '/* Can be replaced by your own generated HRIR or BRIR tables */' + '' + '' + }, newline)); + + %% Write out the header + fileID = fopen(h_file_name,'w'); + fprintf(fileID,'%s', copyright_str); + + h_file_content = string(join({ + '' + '' + '#ifndef _IVAS_ROM_BINAURAL_CREND_HEAD_' + '#define _IVAS_ROM_BINAURAL_CREND_HEAD_' + '' + '#include "ivas_cnst.h"' + '' + '' + }, newline)); + fprintf(fileID,'%s', h_file_content); + + for hoa_idx=1:length(data_struct) + HOA_name = data_struct(hoa_idx).HOA_name; + n_HOA_ch = data_struct(hoa_idx).n_HOA_ch; + + h_file_content = string(join({ + sprintf('\n/********************** CRendBin_%s_HRIR **********************/', HOA_name) + '' + sprintf('extern float CRendBin_%s_HRIR_latency_s;', HOA_name) + '' + }, newline)); + fprintf(fileID,'%s', h_file_content); + for sr_idx=1:length(data_struct(hoa_idx).sr) + sr = data_struct(hoa_idx).sr(sr_idx); + sr_short = data_struct(hoa_idx).sr_short(sr_idx); + sr_dft_size = data_struct(hoa_idx).sr_dft_size(sr_idx); + + fprintf(fileID, '\n/* Sample Rate = %d */\n\n', sr); + fprintf(fileID, 'extern int16_t CRendBin_%s_HRIR_max_num_iterations_%dkHz;\n', HOA_name, sr_short); + fprintf(fileID, 'extern uint16_t CRendBin_%s_HRIR_num_iterations_%dkHz[%d][BINAURAL_CHANNELS];\n', HOA_name, sr_short, n_HOA_ch); + fprintf(fileID, 'extern uint16_t CRendBin_%s_HRIR_num_iterations_diffuse_%dkHz[BINAURAL_CHANNELS];\n', HOA_name, sr_short); + fprintf(fileID, 'extern uint16_t CRendBin_%s_HRIR_pIndex_frequency_max_%dkHz[%d][BINAURAL_CHANNELS][1];\n', HOA_name, sr_short, n_HOA_ch); + fprintf(fileID, 'extern uint16_t CRendBin_%s_HRIR_index_frequency_max_diffuse_%dkHz;\n', HOA_name, sr_short); + fprintf(fileID, 'extern float CRendBin_%s_HRIR_inv_diffuse_weight_%dkHz[%d];\n', HOA_name, sr_short, n_HOA_ch); + fprintf(fileID, 'extern uint16_t *CRendBin_%s_HRIR_pIndex_frequency_max_diffuse_%dkHz[BINAURAL_CHANNELS];\n', HOA_name, sr_short); + fprintf(fileID, 'extern float CRendBin_%s_HRIR_coeff_re_%dkHz[%d][BINAURAL_CHANNELS][%d];\n', HOA_name, sr_short, n_HOA_ch, sr_dft_size); + fprintf(fileID, 'extern float CRendBin_%s_HRIR_coeff_im_%dkHz[%d][BINAURAL_CHANNELS][%d];\n', HOA_name, sr_short, n_HOA_ch, sr_dft_size); + fprintf(fileID, 'extern float *CRendBin_%s_HRIR_coeff_diffuse_re_%dkHz[BINAURAL_CHANNELS];\n', HOA_name, sr_short); + fprintf(fileID, 'extern float *CRendBin_%s_HRIR_coeff_diffuse_im_%dkHz[BINAURAL_CHANNELS];\n', HOA_name, sr_short); + end + end + fprintf(fileID,'%s\n', '#endif /* _IVAS_ROM_BINAURAL_CREND_HEAD_ */'); + fclose(fileID); + + %% Write out the c file + fileID = fopen(c_file_name,'w'); + fprintf(fileID,'%s', copyright_str); + + c_file_content = string(join({ + '' + '' + '#include ' + '#include "ivas_cnst.h"' + '' + '/* clang-format off */' + '' + '#define WMC_TOOL_SKIP' + '' + '' + '' + }, newline)); + fprintf(fileID,'%s', c_file_content); + + for hoa_idx=1:length(data_struct) + HOA_name = data_struct(hoa_idx).HOA_name; + n_HOA_ch = data_struct(hoa_idx).n_HOA_ch; + + % First Sample rate must be 48k + assert(data_struct(hoa_idx).sr(1) == 48000) + + % Compute latency of IRs + [~, I] = max(abs(data_struct(hoa_idx).IR_data)); + latency = (min(squeeze(I), [], "all") - 1) / data_struct(hoa_idx).sr(1); + latency = latency + 0.000000001; + + fprintf(fileID,'\n/********************** CRendBin_%s_HRIR **********************/\n\n', HOA_name); + fprintf(fileID,'const float CRendBin_%s_HRIR_latency_s = %10.9ff;\n', HOA_name, latency); + + % 48k data + resampled_data{1} = data_struct(hoa_idx).IR_data; + % Resample to 32k + resampled_data{2} = resample(data_struct(hoa_idx).IR_data, 2, 3, 128, 'Dimension', 1); + % Resample to 16k + resampled_data{3} = resample(data_struct(hoa_idx).IR_data, 1, 3, 128, 'Dimension', 1); + for sr_idx=1:length(data_struct(hoa_idx).sr) + sr = data_struct(hoa_idx).sr(sr_idx); + sr_short = data_struct(hoa_idx).sr_short(sr_idx); + sr_dft_size = data_struct(hoa_idx).sr_dft_size(sr_idx); + + FR = m_dft(resampled_data{1}, data_struct(hoa_idx).sr_dft_size(sr_idx), 1); + + fprintf(fileID, '\n'); + fprintf(fileID, '/* Sample Rate = %d */\n', sr); + fprintf(fileID, '\n'); + fprintf(fileID, 'const int16_t CRendBin_%s_HRIR_max_num_iterations_%dkHz = 1;\n', HOA_name, sr_short); + fprintf(fileID, 'const uint16_t CRendBin_%s_HRIR_num_iterations_%dkHz[%d][BINAURAL_CHANNELS]={', HOA_name, sr_short, n_HOA_ch); + c_file_content = ''; + for ch_idx=1:n_HOA_ch + c_file_content = [c_file_content, '{1, 1}, ']; + end + c_file_content(end-1:end) = []; + fprintf(fileID, '%s', c_file_content); + fprintf(fileID, ' };\n'); + fprintf(fileID, 'const uint16_t CRendBin_%s_HRIR_num_iterations_diffuse_%dkHz[BINAURAL_CHANNELS] = {0, 0};\n', HOA_name, sr_short); + fprintf(fileID, 'const uint16_t CRendBin_%s_HRIR_pIndex_frequency_max_%dkHz[%d][BINAURAL_CHANNELS][1]={', HOA_name, sr_short, n_HOA_ch); + c_file_content = ''; + for ch_idx=1:n_HOA_ch + c_file_content = [c_file_content '{']; + for ear_idx=1:2 + c_file_content = [c_file_content, sprintf('{%d},', sr_dft_size)]; + end + c_file_content(end) = []; + c_file_content = [c_file_content '},']; + end + c_file_content(end) = []; + fprintf(fileID, '%s', c_file_content); + fprintf(fileID, '};\n'); + fprintf(fileID, 'const uint16_t CRendBin_%s_HRIR_index_frequency_max_diffuse_%dkHz = 0;\n', HOA_name, sr_short); + fprintf(fileID, 'const float CRendBin_%s_HRIR_inv_diffuse_weight_%dkHz[%d]={', HOA_name, sr_short, n_HOA_ch); + c_file_content = ''; + for ch_idx=1:data_struct(hoa_idx).n_HOA_ch + c_file_content = [c_file_content, sprintf('%ff, ', 0.0)]; + end + c_file_content(end-1:end) = []; + fprintf(fileID, '%s', c_file_content); + fprintf(fileID, '};\n'); + fprintf(fileID, 'const uint16_t *CRendBin_%s_HRIR_pIndex_frequency_max_diffuse_%dkHz[BINAURAL_CHANNELS]={NULL,NULL};\n', HOA_name, sr_short); + + % Real Part + write_out_HRIR(fileID, tab, n_HOA_ch, 2, sr_dft_size, FR, @real, 're', HOA_name, sr_short); + % Imag Part + write_out_HRIR(fileID, tab, n_HOA_ch, 2, sr_dft_size, FR, @imag, 'im', HOA_name, sr_short); + + fprintf(fileID, 'const float *CRendBin_%s_HRIR_coeff_diffuse_re_%dkHz[BINAURAL_CHANNELS]={NULL,NULL};\n', HOA_name, sr_short); + fprintf(fileID, 'const float *CRendBin_%s_HRIR_coeff_diffuse_im_%dkHz[BINAURAL_CHANNELS]={NULL,NULL};\n', HOA_name, sr_short); + end + end + fprintf(fileID, '\n#undef WMC_TOOL_SKIP\n\n'); + + fclose(fileID); + +end + +function write_out_HRIR(fileID, tab, n_hoa_ch, n_ears, dft_size, freq_resp, func_handle, func_name, hoa_name, sr_short) + fprintf(fileID,'%s\n', sprintf('const float CRendBin_%s_HRIR_coeff_%s_%dkHz[%d][BINAURAL_CHANNELS][%d]={', hoa_name, func_name, sr_short, n_hoa_ch, dft_size)); + for hoa_idx=1:n_hoa_ch + fprintf(fileID,'%s%s\n', tab, '{'); + for ear_idx=1:n_ears + fprintf(fileID,'%s%s%s', tab, tab, '{'); + for bin_idx=1:dft_size + fprintf(fileID,'%ff, ', func_handle(freq_resp(bin_idx, ear_idx, hoa_idx))); + if(mod(bin_idx, 96) == 0) + fprintf(fileID,'\n%s%s', tab, tab); + end + end + fseek(fileID, -2, "cof"); + fprintf(fileID,'%s,\n', '}'); + end + fseek(fileID, -2, "cof"); + fprintf(fileID,'\n%s%s,\n', tab, '}'); + end + fseek(fileID, -2, "cof"); + fprintf(fileID,'\n%s;\n', '}'); +end + + diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m new file mode 100644 index 0000000000..11b9948eb5 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m @@ -0,0 +1,70 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function IR = get_allpass_IRs(AllPass, dels) + XSet = poly2XSet(AllPass.proto_poly, (dels(:)'-16)*AllPass.upper_freq/AllPass.proto_bw); + + IR = makeIRs(XSet, AllPass.upper_freq); +end + +function XSet = poly2XSet(p, dels_samples) + XSet = zeros(size(p,1), numel(dels_samples)); + for k = 1:size(p,1) + XSet(k,:) = polyval(p(k,:),dels_samples(:)'/32); + end +end + +function irs = makeIRs(X,bw) + irs = map_poles2irs( map2poles(X,bw) ); +end + +function p = map2poles(X,bw) + p = map_2_s_poles(X) * bw; + for k = 1:size(p(:,:),2) + p(:,k) = bilinear(p(:,k),p(:,k),1,48000,bw); + end +end + +function irs = map_poles2irs(p) + irs = zeros(512,size(p(:,:),2)); + for k = 1:size(irs,2) + [~,A] = zp2tf(p(:,k),p(:,k),1); + irs(:,k) = filter(fliplr(A),A, [1;zeros(511,1)]); + end +end + +function p = map_2_s_poles(X) + Order = size(X,1); + if Order==0 + p=[]; + elseif Order==1 + p=-2*pi*X; + else + ang = atan(X(2,:))/2+pi/4; + p = [-2*pi*X(1,:).*exp(1i*[1;-1]*ang) ; map_2_s_poles(X(3:end,:))]; + end +end \ No newline at end of file diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m new file mode 100644 index 0000000000..cfa10d12b5 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m @@ -0,0 +1,435 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +classdef hrtf_library_loader < handle + % HRTF Library Loader and Interpolator + % + % Typical usage: + % H1 = hrtf_library_loader('CIPIC_137_cleaned', 48000); + % H1.setLen(64); + % IR_L = H1.getHRTF_L([1;1;0]); + % IR_R = H1.getHRTF_R([1;1;0]); + + properties + Len=0; % The currently selected HRTF length + Window=[]; % The window used to set the HRTF length + Lib_Name = []; % The name of the library (as supplied to the class constructor + Lib_SampleRate = []; % The sample rate of the library + SourceRadius = []; % The source distance for HRTFs in this library + PlaybackRadius = []; % The radius for HRTFs during playback + Info = {''}; % A cell array of strings with info about this library + end + properties (Access=protected) + % Define the set of uni-vectors for the HRTF directions in a discrete Library + % If our library is Discrete, we will always specifiy a set of unit-vectors: + Discrete_UnitVectors = []; + % A Discrete Library is generally defined by a set of HRTF Impulse Responses + Discrete_HRTFs = []; + % Define the HRTFs in terms of GroupDelay and Power spectrum. + % Sometimes we will convert the impulse responses into + % GroupDelay/Magnitude format, to allow a better mode of interpolation. + % Sometimes, our library already contains these GD_Mag responses, so we + % don't need to generate them in this class + Discrete_HRTFs_GD_Mag = []; + + % Sometimes we aim to get a smoother group-delay (as a function of + % angle) by using a simplified model. If the following member variable + % is not empty, then we will use this model to compute the group-delay + GD_Model=[]; + + % For the GD_Mag interpolation method, we need to define the FFT length + GD_Mag_FFTLen=[]; + % For the GD_Mag interpolation method, we need to define the freq bands + GD_Mag_Band2FR=[]; + % For the GD_Mag interpolation method, low-pass filter applied to imp-resps + GD_Mag_LoPass=[]; + + % Keep the most recntly computed HRTFs: + % To save us the pain of recalcuating a whole lot of stuff when we + % make consecutive calls the get the Left and Right HRTFs, we store the + % most recent HRTFs, and their associated unit-vectors. + Last_HRTFs=[]; + % Remember the unit vectors for the most recent HRTFs computed + Last_UV=[]; + + Sofa_File = []; + end + + methods + function obj = hrtf_library_loader() + end + + function readSOFA(obj, Lib_Name) + + % Read in the sofa file using 'sofar' python module + sofa_file = py.sofar.read_sofa(Lib_Name); + + % This looks like a library built from a bunch of discrete + % locations in free field + % Let's figure out the source locations used in the HRTF library: + Pos = double(sofa_file.SourcePosition)'; + Units = strtrim(strsplit(string(sofa_file.SourcePosition_Units), ',')); + + assert( any(strcmpi(Units{1}, {'degree','radian'})), 'Unknown units'); + if strcmpi(Units{1},'degree'), Pos(1,:)=Pos(1,:)*pi/180; end + assert( any(strcmpi(Units{2}, {'degree','radian'})), 'Unknown units'); + if strcmpi(Units{2},'degree'), Pos(2,:)=Pos(2,:)*pi/180; end + assert( any(strcmpi(Units{3}, {'metre','meter','inch'})), 'Unknown units'); + if strcmpi(Units{3},'inch' ), Pos(3,:)=Pos(3,:)*0.0254; end + Pos = Pos(3,:) .* ... + [cos(Pos(2,:)).*[cos(Pos(1,:));sin(Pos(1,:))];sin(Pos(2,:))]; + + Radii = sqrt(sum(Pos.*Pos,1)); + XYZ = make_unit_vectors(Pos); + NumLoc = size(XYZ,2); + + % Now, get the impulse repsonses: + assert( isprop(sofa_file, 'GLOBAL_DataType'), 'Expected field: GLOBAL_DataType'); + Data.IR = double(sofa_file.Data_IR); + Data.SamplingRate = double(sofa_file.Data_SamplingRate); + Data.SamplingRate_Units = string(sofa_file.Data_SamplingRate_Units); + Data.Delay = double(sofa_file.Data_Delay); + switch lower(string(sofa_file.GLOBAL_DataType)) + case 'fir' + assert( size(Data.IR,2)>=2, 'Expecting 2 receivers (ears)'); + if size(Data.IR,2)>2 + Data.IR = Data.IR(:,1:2,:); + Data.Delay = Data.Delay(:,1:2); + end + assert( size(Data.IR,1)==NumLoc, 'IR is incorrect size'); + IRLen = size(Data.IR,3); + assert( all(diff(Data.Delay,1,2)==0), ... + 'Non-zero inter-aural delay offset not (yet) implemented'); + HRTF_L = reshape( Data.IR(:,1,:), NumLoc, IRLen)'; + HRTF_R = reshape( Data.IR(:,2,:), NumLoc, IRLen)'; + Fs = Data.SamplingRate; + assert(strcmp(Data.SamplingRate_Units,'hertz'), 'unknown samplerate units'); + otherwise + error(['unknown GLOBAL_DataType = ', hrtf.GLOBAL_DataType]); + end + + % Normalise for unity gain around 1kHz + FFTLen=1024; + Mid_Bin_1K=round(FFTLen*1000/Fs); + FR_L=fft(HRTF_L,FFTLen); + FR_R=fft(HRTF_R,FFTLen); + MeanG=sqrt(mean(mean(abs([FR_L(Mid_Bin_1K+(-1:1),:),FR_R(Mid_Bin_1K+(-1:1),:)]).^2,1),2)); + HRTF_L = HRTF_L/MeanG; + HRTF_R = HRTF_R/MeanG; + + H = struct('Info',struct()); + H.SourceRadius = mean(Radii); + H.UnitVectors = XYZ; + H.HRTF_L = HRTF_L; + H.HRTF_R = HRTF_R; + + [~,NameRoot,~] = fileparts(Lib_Name); + H.Info.Name = NameRoot; + H.Info.Source = 'SOFA(Description Goes Here)'; + H.Info.SpatialSize = sprintf('%d discrete directions',NumLoc); + H.Info.FilterSize = sprintf('%d-tap FIR',IRLen); + H.Info.Scaling = 'Normalised to unity gain at 1kHz'; + + obj.process_lib(H, Data.SamplingRate); + obj.Sofa_File = sofa_file; + end + + function updateSOFA(obj, data) + right_shape = permute(data, [3, 2, 1]); + obj.Sofa_File.Data_IR = py.numpy.array(right_shape); + d = size(right_shape); + obj.Sofa_File.SourcePosition = py.numpy.array(zeros(d(1), 3)); + end + + function writeSOFA(obj, file_name) + py.sofar.write_sofa(file_name, obj.Sofa_File); + end + + function IR = XYZ_to_IR( this, XYZ ) + IR = permute(cat(3,this.getHRTF_L(XYZ),this.getHRTF_R(XYZ)),[1,3,2]); + end + + end % methods + + methods (Access=private) + + function process_lib(obj, hrtf_lib, SampleRate) + + MatData = hrtf_lib; + + % Hopefully, this file contains an 'Info' field + if isfield(MatData, 'Info') + obj.Info=MatData.Info; + obj.Lib_Name=obj.Info.Name; + else + obj.Lib_Name=hrtf_lib; + end + + if ~isempty(SampleRate) && isfield(MatData, 'FSample') && SampleRate~=MatData.FSample + error('Sample rate set in Library (%d) does not match requested rate (%d)', ... + MatData.FSample, SampleRate); + end + if isfield(MatData, 'SourceRadius') + obj.SourceRadius = MatData.SourceRadius; + else + fprintf('Warning - no source radius specififed in library\n'); + obj.SourceRadius = 10.0; + end + obj.PlaybackRadius = obj.SourceRadius; + if isfield(MatData, 'FSample') + obj.Lib_SampleRate=MatData.FSample; + elseif ~isempty(SampleRate) + obj.Lib_SampleRate=SampleRate; + else + obj.Lib_SampleRate=48000; % Default, if sample rate not specified anywhere else + end + + obj.Discrete_UnitVectors = MatData.UnitVectors; + if isfield(MatData, 'HRTF_L') + obj.Discrete_HRTFs = cat(3, MatData.HRTF_L, MatData.HRTF_R); + elseif isfield(MatData, 'Band_FR_L') && isfield(MatData, 'GD_Model') + obj.GD_Model = MatData.GD_Model; + obj.buildBand2FR(); + obj.Discrete_HRTFs_GD_Mag = cat(3, ... + [zeros(1,size(MatData.Band_FR_L,2));MatData.Band_FR_L], ... + [zeros(1,size(MatData.Band_FR_L,2));MatData.Band_FR_R]); + else + error('Discrete HRTF library has some data missing'); + end + + obj.buildGDMag(); + obj.Last_UV=[]; + obj.setLen(512); + end + + function setLen(obj,Len) + % SETLEN Set the length of the HRTFs generated by this object + % Example: + % H.setLen(48); + assert(isscalar(Len) && (Len>1) && (Len<4096)); + obj.Len=Len; + obj.Window = sin(min(1,(Len:-1:1)'*4/Len)*pi/2).^2; + obj.Last_UV=[]; + end + + function HRTFs = getHRTF_L(obj,varargin) + % GETHRTF_L Get one or more Left-ear HRTFs from the library + % Given [N] direction-of-arrival vectors, returns an array + % of size [Len]x[N], containing the N left-ear HRTFs. + % Examples: + % HRTFs = H.getHRTF_L(Az,El) % Az and El are both Nx1 or 1xN vectors (in radians) + % HRTFs = H.getHRTF_L( Angles ) % Angles is a 2xN array of Az,El column pairs (in radians) + % HRTFs = H.getHRTF_L(X, Y, Z) % X,Y,Z are all 1xN or Nx1 vectors + % HRTFs = H.getHRTF_L(Vects) % Vects is a 3xN array of X,Y,Z column vectors + UnitVecs = make_unit_vectors(varargin{:}); + if any(size(UnitVecs)~=size(obj.Last_UV)) || ... + any(UnitVecs(:)~=obj.Last_UV(:)) + obj.Interpolate_HRTFs(UnitVecs); + end + HRTFs = obj.Last_HRTFs(:,:,1); + end + + function HRTFs = getHRTF_R(obj,varargin) + % GETHRTF_R Get one or more Right-ear HRTFs from the library + % Given [N] direction-of-arrival vectors, returns an array + % of size [Len]x[N], containing the N right-ear HRTFs. + % Examples: + % HRTFs = H.getHRTF_R(Az,El) % Az and El are both Nx1 or 1xN vectors (in radians) + % HRTFs = H.getHRTF_R( Angles ) % Angles is a 2xN array of Az,El column pairs (in radians) + % HRTFs = H.getHRTF_R(X, Y, Z) % X,Y,Z are all 1xN or Nx1 vectors + % HRTFs = H.getHRTF_R(Vects) % Vects is a 3xN array of X,Y,Z column vectors + UnitVecs = make_unit_vectors(varargin{:}); + if any(size(UnitVecs)~=size(obj.Last_UV)) || ... + any(UnitVecs(:)~=obj.Last_UV(:)) + obj.Interpolate_HRTFs(UnitVecs); + end + HRTFs = obj.Last_HRTFs(:,:,2); + end + + function buildBand2FR(obj) + obj.GD_Mag_FFTLen=2^ceil(log2(obj.Lib_SampleRate)-6.8); + while ~isempty(obj.Discrete_HRTFs) && obj.GD_Mag_FFTLen<2*size(obj.Discrete_HRTFs,1) + obj.GD_Mag_FFTLen = obj.GD_Mag_FFTLen*2; + end + obj.GD_Mag_Band2FR=hrtf_library_loader.MakeBand2FR(obj.GD_Mag_FFTLen,obj.Lib_SampleRate); + + [B,A]=butter(2,0.9); + obj.GD_Mag_LoPass = freqz(B,A,(0:obj.GD_Mag_FFTLen/2)'/obj.GD_Mag_FFTLen*2*pi); + end + + function buildGDMag(obj) + obj.buildBand2FR(); + FR2Band = pinv(obj.GD_Mag_Band2FR); + obj.Discrete_HRTFs_GD_Mag=zeros( ... + size(obj.GD_Mag_Band2FR,2)+1,size(obj.Discrete_HRTFs,2),2); + for k=1:size(obj.Discrete_HRTFs,2) + HRTF_L = obj.Discrete_HRTFs(:,k,1); + HRTF_R = obj.Discrete_HRTFs(:,k,2); + for p=1:2 + % Get mag resp in each band + FR = fft(HRTF_L,obj.GD_Mag_FFTLen); + Mag = FR2Band * (abs(FR(1:end/2+1)).^2); + Mag(1)=abs(FR(1)).^2; % special case for DC + % Now, get the group-delay (excess phase at 1200Hz) + % Let's use mdft for the GD calculation + N = obj.GD_Mag_FFTLen/2; + GD_Bin = 1+floor(1200*2*N/obj.Lib_SampleRate); + FR = m_dft(HRTF_L, N); + Ph = unwrap(angle(FR)); + PhM = -imag(m_hilbert(log(max(1e-4,abs(FR))))); + GD = (PhM(GD_Bin)-Ph(GD_Bin))/pi*N/(GD_Bin-0.5)/obj.Lib_SampleRate; + obj.Discrete_HRTFs_GD_Mag(:,k,p)=[GD;Mag]; + HRTF_L=HRTF_R; + end + obj.Discrete_HRTFs_GD_Mag(1,k,:)=obj.Discrete_HRTFs_GD_Mag(1,k,:)- ... + min(obj.Discrete_HRTFs_GD_Mag(1,k,:)); + end + obj.Last_UV=[]; + end + + function IR=gdMag_to_IR(obj,GDMag) + GD=GDMag(1,:)*obj.Lib_SampleRate + 10; + Mag=GDMag(2:end,:); + if (size(Mag,1)1e-20 + tmpV=tmpV/sqrt(sum(tmpV.^2)); + tmpV=tmpV-v*(tmpV'*v); + IndSubset = IndSubset(tmpV'*obj.Discrete_UnitVectors(:,IndSubset)>0); + end + end + W2=zeros(size(obj.Discrete_UnitVectors,2),1); + W2(GotSet)=lsqnonneg([obj.Discrete_UnitVectors(:,GotSet);0*obj.Discrete_UnitVectors(1,GotSet)+1],[UnitVecs(:,k);1]); + + TempL(:,k)=obj.Discrete_HRTFs_GD_Mag(:,GotSet,1)*W2(GotSet); + TempR(:,k)=obj.Discrete_HRTFs_GD_Mag(:,GotSet,2)*W2(GotSet); + end + end + end % private methods + + methods(Static=true) + + function [Band2FR,FCs]=MakeBand2FR(FFTLen,FSample) + % Compute the standard band filters for freq domain representations + % + % [Band2FR,FCs]=MakeBand2FR(FFTLen,FSample) + % Builds a column vector, FCs, of size NBx1 (where NB equals the + % number of bands) indicating the center-frequency of the + % bands. These center frequencies are spaced at 200Hz intervals at + % low frequencies and 1/12 octave intervals at higher frequencies. + % + % Band2FR is a real matrix of size (FFTLen/2+1)*NB, where each column + % contains the band-pass filter coefficients, and where the following + % identity is true: + % sum(Band2FR,2)==ones(FFTLen/2+1,1) + % + Band2FR=[]; + FCs=[]; + + TransLen=512; + Tmp=cumsum(sinc((-TransLen/2:TransLen/2)*4/TransLen))'; + Trans=1-Tmp(1:end-1)/Tmp(end-1); + + LastLP=0; + LastBin=1; + while 1 + NewBin = max( LastBin+200/FSample*FFTLen, ... + 1+(LastBin-1)*(2^(1/12))); % 200Hz or 1/12 oct steps + if NewBin>=FFTLen/2, break; end + NewLP=interp1( [-1e10;(0.5:TransLen)'/TransLen*4-1.5;1e10] , ... + [1;Trans;0] , ((1:FFTLen/2+1)'-LastBin)/(NewBin-LastBin) ); + FCs = [FCs ; (LastBin-1)*FSample/FFTLen]; + Band2FR = [Band2FR NewLP(:)-LastLP(:)]; + LastLP=NewLP; + LastBin=NewBin; + end + FCs = [FCs ; (LastBin-1)*FSample/FFTLen]; + Band2FR = [Band2FR 1-LastLP(:)]; + end + end % static methods +end diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_support_coefs.mat b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_support_coefs.mat new file mode 100644 index 0000000000..a5d6a0ec5f --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_support_coefs.mat @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8fdb6bc599e4b8b122c4def021d506ddc9c57b82000608cce742a24b3e368a3 +size 395637 diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m new file mode 100644 index 0000000000..b1e208bb02 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m @@ -0,0 +1,72 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function Y=m_dft(X,Len,Dim) +% MDFT - Modified transform, for use in convolution +% +% Y=M_DFT(X,Len) +% +% Input vector should be Real, and length should be '2*Len'. Output vector +% will be Complex, and length with be 'Len' +% +% Note that M_DFT, and M_IDFT, use a frequency bin re-ording (not normally +% used in DSP implementations) to keep the frequency bins in monotonic +% frequency order. +% +% See also M_IDFT + +% Sort out which dimension we operate along: +if nargin<3 + Dim=[]; +end +[X,shift_perm,nshifts] = shiftdata(X,Dim); +dimensions = size(X); +X=X(:,:); + +% Figure out what length we use using: +if nargin<2 || isempty(Len) + Len=size(X,1)/2; +end +Len=double(ceil(Len)); + +% If the user-selected length is longer than data, zero-pad it +if size(X,1)<(2*Len) + X(2*Len,1)=0; +end + +% Do the MDFT: +Y= fft((X(1:Len,:) - X(Len+1:2*Len,:)*1i) .* ... + repmat(exp(-(0:Len-1)'*1i*pi/Len/2),1,size(X,2)) ,Len,1); +Y(round(size(Y,1)/2+1):end,:) = conj (Y(round(size(Y,1)/2+1):end,:) ); + +Tmp=[1:(Len+1)/2 ; Len:-1:(Len+1)/2]; +Y=Y(Tmp(1:Len),:); + +% restore the original dimensions +dimensions(1) = size(Y,1); +Y = reshape(Y, [size(Y,1), dimensions(2:end)]); +Y = unshiftdata(Y,shift_perm,nshifts); diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m new file mode 100644 index 0000000000..4e929a40fe --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m @@ -0,0 +1,40 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function x = m_hilbert(xr) +% M_HILBERT - compute the hilbert transform assuming the signal is even and +% periodic + +[xr,shift_dim_n] = shiftdim(xr); +dimensions = size(xr); +xr=xr(:,:); + +tmp = hilbert([xr;conj(flipud(xr))]); +x=tmp(1:end/2,:); + +x = reshape(x, [size(x,1), dimensions(2:end)]); +x = shiftdim(x, -shift_dim_n); diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m new file mode 100644 index 0000000000..99726a1ee6 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m @@ -0,0 +1,68 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function Y=m_idft(X,Len,Dim) +% M_IDFT - Modified transform, for use in convolution +% +% Y=M_IDFT(X,Len) +% +% Input vector should be Complex, and length should be 'Len'. Output vector +% will be Real, and length with be '2*Len' +% +% Note that M_DFT, and M_IDFT, use a frequency bin re-ording (not normally +% used in DSP implementations) to keep the frequency bins in monotonic +% frequency order. +% +% See also M_DFT + +% Sort out which dimension we operate along: +if nargin<3, + Dim=[]; +end; +[X,shift_perm,nshifts] = shiftdata(X,Dim); +dimensions = size(X); +X=X(:,:); + +% Figure out what length we use using: +if nargin<2 || isempty(Len), + Len=size(X,1); +end; +if size(X,1) Date: Wed, 12 Jul 2023 18:01:59 +1000 Subject: [PATCH 307/591] MC, ISM bug fixes, pose none fixes, sample script addition, minor clean up --- .../split_renderer_config_384_3dof.txt | 1 + .../split_renderer_config_384_3dof_hq.txt | 1 + .../split_renderer_config_512_2dof.txt | 1 + .../split_renderer_config_768_1dof.txt | 1 + .../split_renderer_config_768_2dof.txt | 1 + .../split_renderer_config_fc_384_3dof.txt | 1 + .../split_renderer_config_fc_384_3dof_hq.txt | 1 + .../split_renderer_config_fc_512_2dof.txt | 1 + .../split_renderer_config_fc_768_1dof.txt | 1 + .../split_renderer_config_pcm_3dof_hq.txt | 1 - ...mple_split_rend_script_ivas_enc_dec_ism.py | 170 ++++++++++++++++++ .../sample_split_rend_script_ivas_rend_mc.py | 145 +++++++++++++++ lib_dec/ivas_binRenderer_internal.c | 2 +- lib_dec/ivas_init_dec.c | 34 ++-- lib_dec/ivas_output_config.c | 8 +- lib_dec/lib_dec.c | 2 +- lib_rend/ivas_objectRenderer.c | 2 +- lib_rend/ivas_prot_rend.h | 9 +- lib_rend/ivas_splitRendererPre.c | 95 +++------- lib_rend/ivas_splitRenderer_utils.c | 136 ++++++++------ lib_rend/lib_rend.c | 42 +++-- 21 files changed, 497 insertions(+), 158 deletions(-) create mode 100644 Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py create mode 100644 Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt index 84f70f6d8a..0889c6f2d0 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt @@ -2,6 +2,7 @@ BITRATE = 384000; DOF = 3; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt index 520ba5b8ae..fb8adf64cf 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt @@ -2,6 +2,7 @@ BITRATE = 384000; DOF = 3; HQMODE = 1; +CODEC = LCLD; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt index 1a718cab03..ec4418eca3 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt @@ -2,6 +2,7 @@ BITRATE = 512000; DOF = 2; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt index 31d94203cc..02b4665e72 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt @@ -2,6 +2,7 @@ BITRATE = 768000; DOF = 1; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt index 20488df35b..8aaccb64fe 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt @@ -2,6 +2,7 @@ BITRATE = 768000; DOF = 2; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt index 5fbf7f7276..dccf44a9f3 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt @@ -2,6 +2,7 @@ BITRATE = 384000; DOF = 3; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt index 881f462661..5a9770e61d 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt @@ -2,6 +2,7 @@ BITRATE = 384000; DOF = 3; HQMODE = 1; +CODEC = LCLD; [GENERAL] RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt index 3178a67e32..112177d636 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt @@ -2,6 +2,7 @@ BITRATE = 512000; DOF = 2; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt index bd448d16b3..68221b269e 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt @@ -2,6 +2,7 @@ BITRATE = 768000; DOF = 1; HQMODE = 0; +CODEC = LCLD; [GENERAL] RENDERER = FASTCONV; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt index 9063edab6c..4e38b77145 100644 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt +++ b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt @@ -2,7 +2,6 @@ BITRATE = 768000; DOF = 3; HQMODE = 1; -CODEC = LC3PLUS; [GENERAL] RENDERER = CREND; diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py new file mode 100644 index 0000000000..16e1cfec97 --- /dev/null +++ b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py @@ -0,0 +1,170 @@ +from scipy.io.wavfile import read, write +from scipy import signal +import subprocess +import numpy as np +import sys +import os + +## dimension of following 2 arrays should be same, that is for each file name there should be a tag +file_names = [ +'../scripts/testv/stv4ISM48s.wav' +]; +ism_md_file_names = [ +'../scripts/testv/stvISM1.csv', +'../scripts/testv/stvISM2.csv', +'../scripts/testv/stvISM3.csv', +'../scripts/testv/stvISM4.csv' +]; +file_tags = [ +'test_ISM' +]; + +## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag +pre_hr_file_names = [ +'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' +]; +post_hr_file_names = [ +'trajectories/post-renderer_pose_files/post_0static.csv' +]; +hr_file_tags = [ +'yaw20static' +]; + +renderers = [ +('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), +('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), +('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), +('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), +('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), +('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), +('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), +('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), +('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; + +split_md_file_name = 'split_md.bin'; + +split_rend_file_outs = ['recons_out_pos0.wav', + 'recons_out_pos1.wav', + 'recons_out_pos2.wav', + 'rotated_ref_pos0.wav', + 'rotated_ref_pos1.wav', + 'rotated_ref_pos2.wav', + 'rotated_ref_RefPos.wav', + 'split_rend_MD_bitrate.txt'] + + +def check_and_makedir(dir_path): + if not os.path.exists(dir_path): + try: + os.makedirs(dir_path) + except OSError as e: + if e.errno != errno.EEXIST: + raise # raises the error again + + +def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): + check_and_makedir(out_dir); + for idx in range(0, len(file_tags)): + for hr_idx in range(0, len(hr_file_tags)): + for rend in range(0, len(renderers)): + bitrate = '384000'; + filename = file_names[idx]; + file_in = os.path.join(file_dir, filename); + enc_exe = os.path.join(exe_dir, 'IVAS_cod.exe'); + dec_exe = os.path.join(exe_dir, 'IVAS_dec.exe'); + rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); + file_pkt_name = '_'.join([file_tags[idx], bitrate, 'out.pkt']); + file_pkt = os.path.join(out_dir, file_pkt_name); + if renderers[rend][2] == '0': + bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_CLDFB'; + else: + bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_PCM'; + md_out_arg = ['-om', split_md_file_name]; + md_in_arg = ['-im', split_md_file_name]; + file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); + file_out = os.path.join(out_dir, file_out_name); + + print(file_in) + print(bs_file_out) + print(file_out) + print(file_pkt) + + hr_pre_file_name = pre_hr_file_names[hr_idx]; + hr_pre_file = os.path.join(file_dir, hr_pre_file_name); + hr_post_file_name = post_hr_file_names[hr_idx]; + hr_post_file = os.path.join(file_dir, hr_post_file_name); + + enc_cmd = [ + enc_exe, + '-ism', '4', ism_md_file_names[0], ism_md_file_names[1], ism_md_file_names[2], ism_md_file_names[3], + '-max_band', 'FB', + bitrate, + '48', + file_in, + file_pkt + ] + + print(enc_cmd) + test_status = subprocess.call(enc_cmd, shell=False) + + dec_cmd = [ + dec_exe, + '-RENDER_CONFIG', renderers[rend][1], + md_out_arg[0], md_out_arg[1], + '-t', hr_pre_file, + out_fmt, + '48', + file_pkt, + bs_file_out + ] + + print(dec_cmd) + test_status = subprocess.call(dec_cmd, shell=False) + + + post_rend_cmd = [ + rend_exe, + md_in_arg[0], md_in_arg[1], + '-i', bs_file_out, + '-if', out_fmt, + '-o', file_out, + '-of', 'BINAURAL', + '-fs', '48', + '-tf', hr_post_file, + ] + + + print(post_rend_cmd) + test_status = subprocess.call(post_rend_cmd, shell=False) + + if os.path.exists(file_pkt): + os.remove(file_pkt); + + if os.path.exists(bs_file_out): + os.remove(bs_file_out); + + if os.path.exists(split_md_file_name): + os.remove(split_md_file_name); + + + for fo in split_rend_file_outs: + file_old = os.path.join(os. getcwd(), fo); + file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); + file_new = os.path.join(out_dir, file_out_name); + if os.path.exists(file_old): + os.rename(file_old, file_new); + + +def main(argv): + print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') + if len(argv) < 3: + return print(len(argv)) + return generate_split_rend_lis_items(*argv[1:]) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py b/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py new file mode 100644 index 0000000000..e1dbbdcefb --- /dev/null +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py @@ -0,0 +1,145 @@ +from scipy.io.wavfile import read, write +from scipy import signal +import subprocess +import numpy as np +import sys +import os + +## dimension of following 2 arrays should be same, that is for each file name there should be a tag +file_names = [ +'../scripts/testv/stv714MC48c.wav' +]; + +file_tags = [ +'test_MC714' +]; + +## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag +pre_hr_file_names = [ +'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' +]; +post_hr_file_names = [ +'trajectories/post-renderer_pose_files/post_0static.csv' +]; +hr_file_tags = [ +'yaw20static' +]; + +renderers = [ +('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), +('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), +('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), +('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), +('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), +('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), +('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), +('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), +('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; + +split_md_file_name = 'split_md.bin'; + +split_rend_file_outs = ['recons_out_pos0.wav', + 'recons_out_pos1.wav', + 'recons_out_pos2.wav', + 'rotated_ref_pos0.wav', + 'rotated_ref_pos1.wav', + 'rotated_ref_pos2.wav', + 'rotated_ref_RefPos.wav', + 'split_rend_MD_bitrate.txt'] + + +def check_and_makedir(dir_path): + if not os.path.exists(dir_path): + try: + os.makedirs(dir_path) + except OSError as e: + if e.errno != errno.EEXIST: + raise # raises the error again + + +def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): + check_and_makedir(out_dir); + for idx in range(0, len(file_tags)): + for hr_idx in range(0, len(hr_file_tags)): + for rend in range(0, len(renderers)): + filename = file_names[idx]; + file_in = os.path.join(file_dir, filename); + rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); + if renderers[rend][2] == '0': + bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_CLDFB'; + else: + bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); + bs_file_out = os.path.join(out_dir, bs_file_out_name); + out_fmt = 'BINAURAL_SPLIT_PCM'; + md_out_arg = ['-om', split_md_file_name]; + md_in_arg = ['-im', split_md_file_name]; + file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); + file_out = os.path.join(out_dir, file_out_name); + + print(file_in) + print(bs_file_out) + print(file_out) + + hr_pre_file_name = pre_hr_file_names[hr_idx]; + hr_pre_file = os.path.join(file_dir, hr_pre_file_name); + hr_post_file_name = post_hr_file_names[hr_idx]; + hr_post_file = os.path.join(file_dir, hr_post_file_name); + + pre_rend_cmd = [ + rend_exe, + '-rc', renderers[rend][1], + md_out_arg[0], md_out_arg[1], + '-i', file_in, + '-if', '7_1_4', + '-o', bs_file_out, + '-of', out_fmt, + '-fs', '48', + '-tf', hr_pre_file, + ] + + + print(pre_rend_cmd) + test_status = subprocess.call(pre_rend_cmd, shell=False) + + + post_rend_cmd = [ + rend_exe, + md_in_arg[0], md_in_arg[1], + '-i', bs_file_out, + '-if', out_fmt, + '-o', file_out, + '-of', 'BINAURAL', + '-fs', '48', + '-tf', hr_post_file, + ] + + + print(post_rend_cmd) + test_status = subprocess.call(post_rend_cmd, shell=False) + + if os.path.exists(bs_file_out): + os.remove(bs_file_out); + + if os.path.exists(split_md_file_name): + os.remove(split_md_file_name); + + + for fo in split_rend_file_outs: + file_old = os.path.join(os. getcwd(), fo); + file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); + file_new = os.path.join(out_dir, file_out_name); + if os.path.exists(file_old): + os.rename(file_old, file_new); + + +def main(argv): + print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') + if len(argv) < 3: + return print(len(argv)) + return generate_split_rend_lis_items(*argv[1:]) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index c29d8a6858..096f02680d 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1664,7 +1664,7 @@ void ivas_rend_CldfbMultiBinRendProcess( if ( ( *pCombinedOrientationData ) != NULL ) { - if ( low_res_pre_rend_rot ) + if ( ( low_res_pre_rend_rot ) && ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ) { ( *pCombinedOrientationData )->Quaternions[sf_idx] = ( *pCombinedOrientationData )->Quaternions[0]; for ( i = 0; i < 3; i++ ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f5e9d9b0d1..2b711e96fd 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1274,7 +1274,8 @@ ivas_error ivas_init_decoder( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 0 ); + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 0, + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); #endif #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING @@ -1333,16 +1334,14 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) #endif { - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1 ); + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->splitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis ); - /* Split rendering with MC/ISMs only supported with LC3plus */ -#ifndef SPLIT_REND_CLDFB_ISM - assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ); -#endif + #ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING error = #endif @@ -1391,6 +1390,9 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { +#ifdef SPLIT_REND_LC3PLUS_MC + int16_t num_poses; +#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) @@ -1400,10 +1402,14 @@ ivas_error ivas_init_decoder( } #ifdef SPLIT_REND_LC3PLUS_MC - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { + int16_t pcm_out; + pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; #ifdef SPLIT_REND_LC3PLUS - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1 ); + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, + pcm_out ); #endif ivas_renderSplitGetMultiBinPoseData( @@ -1411,16 +1417,18 @@ ivas_error ivas_init_decoder( &st_ivas->splitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis ); - /* Split rendering with MC only supported with LC3plus */ - assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ); - error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 0, 0 ); + hDecoderConfig->output_Fs, 0, pcm_out ); if ( error != IVAS_ERR_OK ) { return error; } + num_poses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; + } + else + { + num_poses = 1; } #endif @@ -1429,7 +1437,7 @@ ivas_error ivas_init_decoder( #ifdef SPLIT_REND_WITH_HEAD_ROT , #ifdef SPLIT_REND_LC3PLUS_MC - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses : 1 + num_poses #else 1 #endif diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 0684349a59..96851f24c5 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -100,7 +100,11 @@ void ivas_renderer_select( } else /* ISM_MODE_DISC */ { - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { #ifdef DEBUGGING if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) @@ -466,7 +470,7 @@ void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS hCombinedOrientationData->sr_pose_pred_axis ); #ifdef SPLIT_REND_IVAS_DEC_HT_TR - if ( hCombinedOrientationData != NULL ) + if ( ( hCombinedOrientationData != NULL ) && ( hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ) { int16_t sf, i, j; for ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 314fdc447d..9fa79cd22c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1592,7 +1592,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; } - if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ef68bb7112..75833b2de5 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -740,7 +740,7 @@ void ObjRenderIvasFrame_splitBinaural( pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; /* If not yet allocated, open additional instances of TD renderer */ - for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + for ( i = 0; i < pMultiBinPoseData->num_poses - 1; ++i ) { if ( st_ivas->splitBinRend.splitrend.hTdRendHandles[i] != NULL ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index c0a567d969..aa2ebe24dc 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -586,13 +586,13 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( int16_t subframe_idx ); void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); -int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate ); +int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out ); #ifdef SPLIT_REND_LC3PLUS int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ); int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); -ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig ); +ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t is_pcm_out ); #endif void ivas_split_rend_get_quant_params( const int16_t num_md_bands, @@ -1379,8 +1379,9 @@ void masaPrerendClose( #ifdef SPLIT_REND_LC3PLUS void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ - int16_t isRenderingInTd /* i : flag: is rendering done in TD? */ -); + int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */ + int16_t pcm_out /*i : flag to indicate PCM output*/ + ); #endif /* clang-format on */ diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index ae342f7955..5d5a3e856c 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1763,7 +1763,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, uint8_t isCldfbNeeded = 0; cldfbMode = CLDFB_ANALYSIS; - if ( ( error = ivas_split_rend_validate_config( pSplitRendConfig ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_split_rend_validate_config( pSplitRendConfig, is_pcm_out ) ) != IVAS_ERR_OK ) { return error; } @@ -1828,24 +1828,28 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, } } - error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend, - &hSplitRendWrapper->multiBinPoseData + if ( pSplitRendConfig->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + error = ivas_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend, + &hSplitRendWrapper->multiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - , - OutSampleRate + , + OutSampleRate #endif - ); - if ( error != IVAS_ERR_OK ) - { - return error; + ); + if ( error != IVAS_ERR_OK ) + { + return error; + } } + if ( is_pcm_out == 0 ) { #ifdef SPLIT_REND_LC3PLUS if ( !useLc3plus ) { #endif - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate ) ); + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ); if ( error != IVAS_ERR_OK ) { return error; @@ -1982,29 +1986,17 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( ivas_error error; int32_t bit_len, available_bits, target_md_bits, actual_md_bits; int16_t num_cldfb_bands, ch, slot_idx, pos_idx, num_poses; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#else float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#endif -#ifdef SPLIT_REND_LC3PLUS uint8_t useLc3plus; float *in_delayed[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; int32_t i; -#endif push_wmops( "ivas_renderMultiTDBinToSplitBinaural" ); error = IVAS_ERR_OK; -#ifndef SPLIT_REND_LC3PLUS - assert( hSplitBin->hCldfbHandles != NULL ); - num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; -#endif num_poses = hSplitBin->multiBinPoseData.num_poses; -#ifdef SPLIT_REND_LC3PLUS useLc3plus = hSplitBin->hLc3plusEnc != NULL; if ( useLc3plus ) @@ -2026,41 +2018,15 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( in_delayed[i] = in[i]; } } -#endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) - { - float *pPcm[BINAURAL_CHANNELS]; - - char fname[200] = "rotated_ref_pos"; - char tag[2]; - tag[0] = (char) ( '0' + pos_idx ); - tag[1] = '\0'; - strcat( fname, tag ); - strcat( fname, ".wav" ); - for ( int i = 0; i < BINAURAL_CHANNELS; i++ ) - { - pPcm[i] = in[pos_idx * BINAURAL_CHANNELS + i]; - } - dbgwrite_wav( pPcm, 960, - fname, 48000, BINAURAL_CHANNELS ); - } -#endif -#ifdef SPLIT_REND_LC3PLUS actual_md_bits = pBits->bits_written; - if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + if ( ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) || + ( !useLc3plus && !pcm_out ) ) { num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; -#endif /* CLDFB Analysis*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < num_poses + 1; pos_idx++ ) -#else - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) -#endif + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { #ifdef SPLIT_POSE_CORRECTION_DEBUG @@ -2080,16 +2046,11 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( } #endif - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { -#ifdef SPLIT_REND_LC3PLUS cldfbAnalysis_ts( &( in_delayed[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), -#else - cldfbAnalysis_ts( &( in[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), -#endif Cldfb_In_BinReal[pos_idx][ch][slot_idx], Cldfb_In_BinImag[pos_idx][ch][slot_idx], max_bands, @@ -2097,7 +2058,10 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( } } } + } + if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; actual_md_bits = pBits->bits_written; ivas_rend_CldfbSplitPreRendProcess( @@ -2113,15 +2077,10 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( if ( pcm_out == 0 ) { -#ifdef SPLIT_REND_LC3PLUS pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; /* TODO(sgi): useLc3plus could be changed to splitCodec */ -#endif - -#ifdef SPLIT_REND_LC3PLUS if ( !useLc3plus ) { -#endif // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; available_bits = SplitRendBitRate * L_FRAME48k / 48000; actual_md_bits = pBits->bits_written - actual_md_bits; @@ -2132,7 +2091,6 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( Cldfb_In_BinImag[0], available_bits, pBits ); -#ifdef SPLIT_REND_LC3PLUS } else { @@ -2141,15 +2099,12 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( return error; } } -#endif } -#ifdef SPLIT_REND_LC3PLUS else { pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; pBits->codec = IVAS_SPLIT_REND_CODEC_NONE; } -#endif /*zero pad*/ bit_len = SplitRendBitRate / FRAMES_PER_SEC; @@ -2189,6 +2144,7 @@ static void lc3plusTimeAlignCldfbPoseCorr( } /* Delay existing columns by 2 slots */ + /*TODO : shouldnt the delay be 7.5 ms ? 5ms + LC3plus delay */ for ( slot_idx = CLDFB_NO_COL_MAX - 2 - 1; slot_idx >= 0; --slot_idx ) { mvr2r( Cldfb_In_BinReal[pose][ch][slot_idx], Cldfb_In_BinReal[pose][ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); @@ -2241,11 +2197,14 @@ ivas_error ivas_renderMultiBinToSplitBinaural( push_wmops( "ivas_renderMultiBinToSplitBinaural" ); - set_fix_rotation_mat( hSplitBin->hBinHrSplitPreRend->fix_pos_rot_mat, &hSplitBin->multiBinPoseData ); - set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); + if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + set_fix_rotation_mat( hSplitBin->hBinHrSplitPreRend->fix_pos_rot_mat, &hSplitBin->multiBinPoseData ); + set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); + } #ifdef SPLIT_REND_LC3PLUS - ivas_split_rend_choose_default_codec( &splitCodec, td_input ); + ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out ); #endif if ( diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index cac6a83b54..49e5adbe70 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -412,27 +412,34 @@ int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, con return md_bitrate; } -int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate ) +int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ) { - switch ( SplitRendBitRate ) + if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - case SPLIT_REND_768k: - { - return IVAS_384k; - } - case SPLIT_REND_512k: - { - return IVAS_384k; - } - case SPLIT_REND_384k: - { - return IVAS_256k; - } - default: + switch ( SplitRendBitRate ) { - break; + case SPLIT_REND_768k: + { + return IVAS_512k; + } + case SPLIT_REND_512k: + { + return IVAS_384k; + } + case SPLIT_REND_384k: + { + return IVAS_256k; + } + default: + { + assert( 0 ); + } } } + else + { + return SplitRendBitRate; + } return -1; } @@ -449,7 +456,7 @@ int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REN if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { int32_t inBandMdBps = (int32_t) ( 8 * FRAMES_PER_SECOND ); - return ivas_get_lcld_bitrate( SplitRendBitRate ) - inBandMdBps; + return ivas_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode ) - inBandMdBps; } if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) { @@ -539,7 +546,7 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL return (int32_t) ( bitrate / FRAMES_PER_SECOND / 8 ); } -ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig ) +ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t is_pcm_out ) { /* Valid DOF range is 0-3 */ if ( pSplitRendConfig->dof < 0 || pSplitRendConfig->dof > 3 ) @@ -547,21 +554,6 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Valid DOF range is 0-3" ); } - if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD ) - { - /* LCLD only supports CLDFB head pose correction */ - if ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "LCLD only supports CLDFB head pose correction" ); - } - - /* LCLD doesn't support 0-DOF */ - if ( pSplitRendConfig->dof == 0 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "LCLD doesn't support 0-DOF" ); - } - } - /* Only CLDFB pose correction supports HQ mode */ if ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB && pSplitRendConfig->hq_mode != 0 ) { @@ -569,23 +561,50 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p } /* Validate bitrate */ - switch ( pSplitRendConfig->splitRendBitRate ) + if ( is_pcm_out == 0 ) { - case SPLIT_REND_256k: - case SPLIT_REND_384k: - case SPLIT_REND_512k: - case SPLIT_REND_768k: - /* Always valid */ - break; - case SPLIT_REND_320k: - /* Only valid with 0 DOF */ - if ( pSplitRendConfig->dof != 0 ) + switch ( pSplitRendConfig->splitRendBitRate ) + { + case SPLIT_REND_384k: + case SPLIT_REND_512k: + case SPLIT_REND_768k: + /* Always valid */ + break; + case SPLIT_REND_256k: + case SPLIT_REND_320k: + /* Only valid with 0 DOF */ + if ( pSplitRendConfig->dof != 0 ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "bitrates below 320 kpbs are only valid with 0 DOF" ); + } + break; + default: + return IVAS_ERR_LC3PLUS_INVALID_BITRATE; + } + } + else + { + if ( pSplitRendConfig->dof == 1 ) + { + if ( pSplitRendConfig->splitRendBitRate < 50000 ) { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "320 kpbs is only valid with 0 DOF" ); + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "1DOF metadata needs atleast 50 kbps" ); } - break; - default: - return IVAS_ERR_LC3PLUS_INVALID_BITRATE; + } + else if ( pSplitRendConfig->dof == 2 ) + { + if ( pSplitRendConfig->splitRendBitRate < 66000 ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "2DOF metadata needs atleast 66 kbps" ); + } + } + else if ( pSplitRendConfig->dof == 3 ) + { + if ( pSplitRendConfig->splitRendBitRate < 128000 ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "3DOF metadata needs atleast 128 kbps" ); + } + } } return IVAS_ERR_OK; @@ -723,7 +742,7 @@ void ivas_renderSplitGetMultiBinPoseData( } } } - else + else if ( pSplit_rend_config->dof == 3 ) { if ( pSplit_rend_config->hq_mode == 1 ) { @@ -744,6 +763,13 @@ void ivas_renderSplitGetMultiBinPoseData( num_roll_poses = 1; } } + else + { + /*0 DOF*/ + num_yaw_poses = 0; + num_pitch_poses = 0; + num_roll_poses = 0; + } pMultiBinPoseData->num_poses = num_yaw_poses + num_pitch_poses + num_roll_poses + 1; assert( pMultiBinPoseData->num_poses <= MAX_HEAD_ROT_POSES ); @@ -804,13 +830,19 @@ void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #ifdef SPLIT_REND_LC3PLUS -void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, int16_t isRenderingInTd ) +void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, int16_t isRenderingInTd, int16_t pcm_out ) { - if ( *pCodec == IVAS_SPLIT_REND_CODEC_DEFAULT ) + if ( pcm_out == 0 ) { - *pCodec = isRenderingInTd ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; + if ( *pCodec == IVAS_SPLIT_REND_CODEC_DEFAULT ) + { + *pCodec = isRenderingInTd ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; + } + } + else + { + *pCodec = IVAS_SPLIT_REND_CODEC_NONE; } - return; } #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c589084aaf..303056cc1e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2249,6 +2249,7 @@ static ivas_error initMcBinauralRendering( // } // if ( initTDRend ) + /*TODO : why do we need to allocate both TD rend and CREND ??*/ { if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -5080,7 +5081,7 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->split_rend_config.codec = renderConfig.split_rend_config.codec; - if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -6133,7 +6134,7 @@ static ivas_error renderIsmToSplitBinaural( pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData; /* If not yet allocated, open additional instances of TD renderer */ - for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + for ( i = 0; i < pMultiBinPoseData->num_poses - 1; ++i ) { if ( ismInput->splitTdRendWrappers[i].hBinRendererTd != NULL ) { @@ -6155,9 +6156,12 @@ static ivas_error renderIsmToSplitBinaural( pCombinedOrientationData = *ismInput->base.ctx.pCombinedOrientationData; - for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - pCombinedOrientationData->Quaternions[i] = pCombinedOrientationData->Quaternions[0]; + for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) + { + pCombinedOrientationData->Quaternions[i] = pCombinedOrientationData->Quaternions[0]; + } } /* Save current head positions */ @@ -6858,14 +6862,17 @@ static ivas_error renderMcToSplitBinaural( /* save current head positions */ pCombinedOrientationDataLocal = *mcInput->base.ctx.pCombinedOrientationData; combinedOrientationDataLocal = *pCombinedOrientationDataLocal; - for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) + if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; - for ( i = 0; i < 3; i++ ) + for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) { - for ( j = 0; j < 3; j++ ) + combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; + for ( i = 0; i < 3; i++ ) { - combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + for ( j = 0; j < 3; j++ ) + { + combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + } } } } @@ -7385,16 +7392,21 @@ static ivas_error renderSbaToMultiBinaural( } #endif push_wmops( "renderSbaToMultiBinaural" ); + pMultiBinPoseData = &sbaInput->splitRendWrapper.multiBinPoseData; + pCombinedOrientationDataLocal = *sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationDataLocal = *pCombinedOrientationDataLocal; - for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; sf++ ) + if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; - for ( i = 0; i < 3; i++ ) + for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; sf++ ) { - for ( j = 0; j < 3; j++ ) + combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; + for ( i = 0; i < 3; i++ ) { - combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + for ( j = 0; j < 3; j++ ) + { + combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + } } } } @@ -7402,7 +7414,6 @@ static ivas_error renderSbaToMultiBinaural( tmpRotBuffer = sbaInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); - pMultiBinPoseData = &sbaInput->splitRendWrapper.multiBinPoseData; for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; @@ -7521,6 +7532,7 @@ static ivas_error renderSbaToSplitBinaural( push_wmops( "renderSbaToSplitBinaural" ); error = IVAS_ERR_OK; + /*TODO : call this at the begining of renderer process for all formats*/ ivas_renderSplitGetMultiBinPoseData( &sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config, &sbaInput->splitRendWrapper.multiBinPoseData, -- GitLab From 9279347ac5dae5ff13bd3c62d626678321ef314f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 10:23:17 +0200 Subject: [PATCH 308/591] [tests] fix import paths --- tests/split_rendering/constants.py | 3 +-- tests/split_rendering/test_split_rendering.py | 2 +- .../test_split_rendering_be_comparison.py | 2 +- tests/split_rendering/utils.py | 10 ++-------- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index 3e41e019b0..4ef78bae05 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -43,8 +43,7 @@ TESTV_DIR = SCRIPTS_DIR.joinpath("testv") BIN_SUFFIX_MERGETARGET = "_ref" -sys.path.append(TESTS_DIR) -from renderer.constants import ( +from tests.renderer.constants import ( CUSTOM_LS_TO_TEST, FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_FILE_SMOKETEST, diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 9ffa37d560..6e11f64d68 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -28,7 +28,7 @@ import pytest -from .utils import * +from tests.split_rendering.utils import * """ Ambisonics """ diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py index 8a9e5a8998..1e4ccfb3fd 100644 --- a/tests/split_rendering/test_split_rendering_be_comparison.py +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -28,7 +28,7 @@ import pytest -from .utils import * +from tests.split_rendering.utils import * """ Ambisonics """ diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index c0d999df40..b763970379 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -26,19 +26,13 @@ the United Nations Convention on Contracts on the International Sales of Goods. """ -import logging -import subprocess as sp import sys from pathlib import Path from tempfile import TemporaryDirectory -import numpy as np -import pytest +from tests.split_rendering.constants import * -from .constants import * - -sys.path.append(TESTS_DIR) -from renderer.utils import check_BE, run_cmd, test_info +from tests.renderer.utils import check_BE, run_cmd, test_info sys.path.append(SCRIPTS_DIR) from pyaudio3dtools.audiofile import readfile -- GitLab From 5c436bcaf2656d29612a92bfa8e29d78d37dcb0c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 12 Jul 2023 13:00:01 +0200 Subject: [PATCH 309/591] remove inactive code within ENABLE_DITHER --- lib_dec/ivas_spar_md_dec.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index e83aa7e617..84f375622d 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2873,9 +2873,6 @@ void ivas_spar_to_dirac( float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; float radius; float en_ratio, res_pow; -#ifdef ENABLE_DITHER - int16_t *seed_ptr; -#endif int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; @@ -2898,9 +2895,6 @@ void ivas_spar_to_dirac( if ( hDirAC != NULL && ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ) == 0 ) { band_grouping = hDirAC->band_grouping; -#ifdef ENABLE_DITHER - seed_ptr = &hDirAC->dithering_seed; -#endif num_slots_in_subfr = st_ivas->hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; for ( band = start_band; band < end_band; band++ ) @@ -2975,18 +2969,11 @@ void ivas_spar_to_dirac( for ( band = start_band; band < end_band; band++ ) { -#ifdef ENABLE_DITHER - int16_t diff_idx, azi_dith, ele_dith; -#else int16_t azi_dith, ele_dith; -#endif tmp_write_idx_param_band = hDirAC->spar_to_dirac_write_idx; en_ratio = 1.0f - diffuseness[band]; -#ifdef ENABLE_DITHER - diff_idx = -#endif - masa_sq( 1.0f - en_ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + masa_sq( 1.0f - en_ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); qmf_band_start = band_grouping[band]; qmf_band_end = band_grouping[band + 1]; @@ -3000,16 +2987,8 @@ void ivas_spar_to_dirac( for ( b = qmf_band_start; b < qmf_band_end; b++ ) { -#ifdef ENABLE_DITHER - azi_dith = (int16_t) ( azi[band] + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); - ele_dith = (int16_t) ( ele[band] + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); - /* limit the elevation to [-90, 90] */ - ele_dith = min( 90, ele_dith ); - ele_dith = max( -90, ele_dith ); -#else azi_dith = azi[band]; ele_dith = ele[band]; -#endif hDirAC->energy_ratio1[block][b] = en_ratio; tmp_write_idx_band = tmp_write_idx_param_band; -- GitLab From 6911e237aec196b2ac54626d501a5b43be0d8304 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 12 Jul 2023 14:20:27 +0200 Subject: [PATCH 310/591] Try to fix "Invalid buffer size" errors --- lib_rend/lib_rend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 303056cc1e..0e5e32d0ad 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4781,7 +4781,11 @@ ivas_error IVAS_REND_FeedInputAudio( mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; +#else inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; +#endif return IVAS_ERR_OK; } -- GitLab From 1763c37dc47b1720170bb632cb4565c0c5f09fff Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 14:26:07 +0200 Subject: [PATCH 311/591] [tests] clean up renderer config files and add expected failures --- tests/split_rendering/constants.py | 9 ++++++++- .../split_renderer_config_0dof_256k.txt | 5 +++++ .../split_renderer_config_0dof_320k.txt | 5 +++++ .../split_renderer_config_0dof_384k.txt | 5 +++++ .../split_renderer_config_0dof_512k.txt | 5 +++++ .../split_renderer_config_0dof_768k.txt | 5 +++++ .../split_renderer_config_1dof_512k.txt | 5 +++++ .../split_renderer_config_1dof_768k.txt | 5 +++++ .../split_renderer_config_2dof_512k.txt | 5 +++++ .../split_renderer_config_2dof_768k.txt | 5 +++++ .../split_renderer_config_384_3dof.txt | 10 ---------- .../split_renderer_config_384_3dof_hq.txt | 10 ---------- .../split_renderer_config_3dof_512k.txt | 5 +++++ .../split_renderer_config_3dof_768k.txt | 5 +++++ .../split_renderer_config_3dofhq_512k.txt | 5 +++++ .../split_renderer_config_3dofhq_768k.txt | 5 +++++ .../split_renderer_config_512_2dof.txt | 10 ---------- .../split_renderer_config_768_1dof.txt | 10 ---------- ...it_renderer_config_768_1dof_hoa_lc3plus.txt | 11 ----------- .../split_renderer_config_768_2dof.txt | 10 ---------- .../split_renderer_config_fc_384_3dof.txt | 10 ---------- .../split_renderer_config_fc_384_3dof_hq.txt | 10 ---------- .../split_renderer_config_fc_512_2dof.txt | 10 ---------- .../split_renderer_config_fc_768_1dof.txt | 10 ---------- tests/split_rendering/test_split_rendering.py | 18 ++++++++++++++++++ .../test_split_rendering_be_comparison.py | 18 ++++++++++++++++++ tests/split_rendering/utils.py | 5 +++++ 27 files changed, 114 insertions(+), 102 deletions(-) create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt delete mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index 4ef78bae05..3dae6039f3 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -59,7 +59,7 @@ from tests.renderer.constants import ( """ Renderer configurations """ RENDERER_CONFIGS_TO_TEST = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*.txt")] -""" IVAS format mapping """ +""" IVAS specific constants """ FORMAT_TO_IVAS_COD_FORMAT = { "MONO": "", "STEREO": "-stereo", @@ -77,6 +77,13 @@ FORMAT_TO_IVAS_COD_FORMAT = { "HOA3": ["-sba", "3"], } +IVAS_MAX_ISM_BITRATE = { + "1": "128000", + "2": "256000", + "3": "384000", + "4": "512000", +} + """ Encoder commandline template """ SPLIT_PRE_COD_CMD = [ str(TESTS_DIR.parent.parent.joinpath("IVAS_cod")), diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k.txt new file mode 100644 index 0000000000..6da658ebb8 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 256000; +DOF = 0; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k.txt new file mode 100644 index 0000000000..55a27f4d74 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 320000; +DOF = 0; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k.txt new file mode 100644 index 0000000000..ecb8dd3c50 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 0; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k.txt new file mode 100644 index 0000000000..e8c49a1c27 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 0; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k.txt new file mode 100644 index 0000000000..787f937999 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 0; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k.txt new file mode 100644 index 0000000000..960a21405f --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 1; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k.txt new file mode 100644 index 0000000000..5afce7d0f4 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 1; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k.txt new file mode 100644 index 0000000000..39368ddcee --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 2; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k.txt new file mode 100644 index 0000000000..ae3151a51b --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 2; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt deleted file mode 100644 index 84f70f6d8a..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt b/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt deleted file mode 100644 index 520ba5b8ae..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_384_3dof_hq.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k.txt new file mode 100644 index 0000000000..90a9ffd264 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 3; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k.txt new file mode 100644 index 0000000000..954944f002 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 3; +HQMODE = 0; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k.txt new file mode 100644 index 0000000000..614b218450 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 3; +HQMODE = 1; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k.txt new file mode 100644 index 0000000000..a64a5fbee1 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 3; +HQMODE = 1; + diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt deleted file mode 100644 index 1a718cab03..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_512_2dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 512000; -DOF = 2; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt deleted file mode 100644 index 31d94203cc..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt deleted file mode 100644 index ca6fbaf9d3..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; -CODEC = LC3PLUS; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt deleted file mode 100644 index 20488df35b..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_768_2dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 2; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt deleted file mode 100644 index 5fbf7f7276..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 0; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt deleted file mode 100644 index 881f462661..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 1; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; \ No newline at end of file diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt deleted file mode 100644 index 3178a67e32..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_fc_512_2dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 512000; -DOF = 2; -HQMODE = 0; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt b/tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt deleted file mode 100644 index bd448d16b3..0000000000 --- a/tests/split_rendering/renderer_configs/split_renderer_config_fc_768_1dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 6e11f64d68..76f114b689 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -37,6 +37,9 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): + if in_fmt != "HOA3": + pytest.xfail("Split Rendering currently only supported with HOA3") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -53,6 +56,9 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): + if in_fmt != "HOA3": + pytest.xfail("Split Rendering currently only supported with HOA3") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -72,6 +78,9 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -88,6 +97,9 @@ def test_multichannel_full_chain_split(test_info, in_fmt, render_config, traject @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -107,6 +119,9 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -123,6 +138,9 @@ def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py index 1e4ccfb3fd..5f0d07b23a 100644 --- a/tests/split_rendering/test_split_rendering_be_comparison.py +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -37,6 +37,9 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): + if in_fmt != "HOA3": + pytest.xfail("Split Rendering currently only supported with HOA3") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -53,6 +56,9 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): + if in_fmt != "HOA3": + pytest.xfail("Split Rendering currently only supported with HOA3") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -72,6 +78,9 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -88,6 +97,9 @@ def test_multichannel_full_chain_split(test_info, in_fmt, render_config, traject @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -107,6 +119,9 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -123,6 +138,9 @@ def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): + if "768k" in render_config: + pytest.xfail("Unsupported bitrate for LC3plus") + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index b763970379..6215b3e8a1 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -74,6 +74,11 @@ def run_full_chain_split_rendering( else: cmd[3] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt]) cmd[4] = str(ivas_bitstream) + + # set maximum ISM bitrate based on number of objects + if in_fmt.upper().startswith("ISM"): + cmd[1] = IVAS_MAX_ISM_BITRATE[in_fmt[3]] + cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt] if in_meta_files: -- GitLab From 1466ecd339f128daa3066e982c6be47399f03fb1 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 14:32:13 +0200 Subject: [PATCH 312/591] [cleanup] remove some incorrectly added #defines --- lib_com/ivas_cnst.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 020a16bf5b..2f91f15ab9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1530,10 +1530,6 @@ typedef enum #ifdef SPLIT_REND_LC3PLUS #define SPLIT_REND_MAX_DOF (3) -#define SPLIT_REND_MSPC_NPOSES_0DOF (1) -#define SPLIT_REND_MSPC_NPOSES_1DOF (3) -#define SPLIT_REND_MSPC_NPOSES_2DOF (7) -#define SPLIT_REND_MSPC_NPOSES_3DOF (8) #endif #ifdef SPLIT_REND_WITH_HEAD_ROT -- GitLab From 2124631fa31de32f8d9348b45f8a2a66361f20f5 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 12 Jul 2023 14:40:45 +0200 Subject: [PATCH 313/591] fixes to handling of inputs with lower sampling rate: OMASA_FIX_LOW_FS. increase bitstream index buffer size to avoid reallocation that currently fails: OMASA_BIT_BUFF_SZ. --- lib_com/bitstream.c | 4 ++++ lib_com/options.h | 2 ++ lib_enc/ivas_enc.c | 7 +++++++ lib_enc/ivas_masa_enc.c | 17 ++++++++++++++++- lib_enc/ivas_omasa_enc.c | 12 ++++++++++-- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 97892f8771..2874e37ec1 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -434,7 +434,11 @@ int16_t get_ivas_max_num_indices( } else if ( ivas_total_brate <= IVAS_256k ) { +#ifdef OMASA_BIT_BUFF_SZ + return 1300; +#else return 1150; +#endif } else if ( ivas_total_brate <= IVAS_384k ) { diff --git a/lib_com/options.h b/lib_com/options.h index 3d341e277b..dfac881d21 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,6 +167,8 @@ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix #define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ +#define OMASA_FIX_LOW_FS /* Nokia: fixes related to lower input signal sampling rates */ +#define OMASA_BIT_BUFF_SZ /* Nokia: increase bitstream index buffer initial size */ #endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index a450be0ac4..10066a104e 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -298,6 +298,11 @@ ivas_error ivas_enc( flag_omasa_ener_brate = 0; +#ifdef OMASA_FIX_LOW_FS + /* Estimate TF-tile energy for the input MASA stream */ + ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); +#endif + if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -313,8 +318,10 @@ ivas_error ivas_enc( set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); idx_separated_object = 0; +#ifndef OMASA_FIX_LOW_FS /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); +#endif /* put audio object data in SCE's */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 443c086a2a..abe899a794 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -745,6 +745,9 @@ ivas_error ivas_masa_enc_config( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t ism_total_brate; +#ifdef OMASA_FIX_LOW_FS + int32_t masa_total_brate; +#endif #endif error = IVAS_ERR_OK; @@ -900,8 +903,16 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS st_ivas->hQMetaData->q_direction->cfg.inactiveBands = 0; - +#ifdef OMASA_FIX_LOW_FS + masa_total_brate = ivas_total_brate; + if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + masa_total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); + } + if ( masa_total_brate >= IVAS_384k && ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) ) +#else if ( ivas_total_brate > IVAS_256k && ivas_format == MASA_FORMAT ) +#endif #else if ( ivas_total_brate > IVAS_256k ) #endif @@ -933,8 +944,12 @@ ivas_error ivas_masa_enc_config( st_ivas->hQMetaData->q_direction->cfg.inactiveBands = 0; } } +#ifdef OMASA_FIX_LOW_FS + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, masa_total_brate >= IVAS_384k, NULL ); +#else masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, ivas_total_brate > IVAS_256k, NULL ); +#endif if ( hMasa->config.numTwoDirBands >= hMasa->config.numCodingBands ) { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 7b8206de4b..aaa4627361 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -60,7 +60,6 @@ static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldf static void computeReferencePower_omasa( const int16_t *band_grouping, float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float *reference_power, const int16_t enc_param_start_band, const int16_t num_freq_bands ); - /*--------------------------------------------------------------------------* * ivas_omasa_enc_open() * @@ -532,10 +531,14 @@ void ivas_omasa_enc( } /* force computation into high resolution */ +#ifndef OMASA_FIX_LOW_FS n_bands_orig = hOMasa->nbands; +#endif n_subframes_orig = hOMasa->nSubframes; +#ifndef OMASA_FIX_LOW_FS hOMasa->nbands = MASA_FREQUENCY_BANDS; +#endif hOMasa->nSubframes = MAX_PARAM_SPATIAL_SUBFRAMES; /* Estimate MASA parameters from the objects */ @@ -553,14 +556,20 @@ void ivas_omasa_enc( } /* restore resolution parameters */ +#ifndef OMASA_FIX_LOW_FS hOMasa->nbands = n_bands_orig; +#endif hOMasa->nSubframes = n_subframes_orig; /* perform MASA+ISM merge in full resolution */ numCodingBands_orig = hMasa->config.numCodingBands; joinedSubframes_orig = hMasa->config.joinedSubframes; +#ifndef OMASA_FIX_LOW_FS hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; +#else + hMasa->config.numCodingBands = hOMasa->nbands; +#endif hMasa->config.joinedSubframes = 0; ivas_merge_masa_metadata( hMasa, hOMasaMeta ); /* => merge result in hMasa->masaMetadata */ @@ -926,7 +935,6 @@ static void ivas_omasa_param_est_enc( } ivas_qmetadata_direction_vector_to_azimuth_elevation( dir_v, &azimuth_m_values[block_m_idx][band_m_idx], &elevation_m_values[block_m_idx][band_m_idx] ); } - /* Set coherences to zero, as this mode is used at lowest bit rates where the coherences are not transmitted */ for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) { -- GitLab From 1c0df3402cb8f10bb11c964d15088bfc9c4130fb Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 14:47:16 +0200 Subject: [PATCH 314/591] [fix] missing split rendering bitrate in function and some formatting --- lib_dec/ivas_spar_decoder.c | 4 ++-- lib_rend/ivas_splitRenderer_utils.c | 23 ++++++++++++++++------- lib_rend/lib_rend.c | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) mode change 100755 => 100644 lib_dec/ivas_spar_decoder.c diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c old mode 100755 new mode 100644 index 352d99ba9e..fc5be70877 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1678,11 +1678,11 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif - ) ) + ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 49e5adbe70..6ed5428297 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -480,17 +480,21 @@ int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ) { case SPLIT_REND_768k: { - return 3; + return 4; } case SPLIT_REND_512k: { - return 2; + return 3; } case SPLIT_REND_384k: { - return 1; + return 2; } case SPLIT_REND_320k: + { + return 1; + } + case SPLIT_REND_256k: { return 0; } @@ -514,26 +518,31 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL switch ( SplitRendBitRateId ) { - case 3: + case 4: { bitrate = SPLIT_REND_768k; break; } - case 2: + case 3: { bitrate = SPLIT_REND_512k; break; } - case 1: + case 2: { bitrate = SPLIT_REND_384k; break; } - case 0: + case 1: { bitrate = SPLIT_REND_320k; break; } + case 0: + { + bitrate = SPLIT_REND_256k; + break; + } default: { return -1; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0e5e32d0ad..22c34ddd67 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2249,7 +2249,7 @@ static ivas_error initMcBinauralRendering( // } // if ( initTDRend ) - /*TODO : why do we need to allocate both TD rend and CREND ??*/ + /* Allocate TD binaural renderer for planar MC layouts or custom MC layouts with headrotation, CREND for the rest */ { if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { -- GitLab From ad943542c4c4466a154a919530b6f9eab2e5280c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:04:31 +0200 Subject: [PATCH 315/591] [fix] bug causing wrong TD rend instance to be used for MC split rendering --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 22c34ddd67..6e2e0b6859 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6912,7 +6912,7 @@ static ivas_error renderMcToSplitBinaural( copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); /* Render */ - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->splitTdRendWrappers[pos_idx - 1], + if ( ( error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &mcInput->tdRendWrapper : &mcInput->splitTdRendWrappers[pos_idx - 1], mcInput->base.inConfig, &mcInput->customLsInput, &pCombinedOrientationDataLocal, -- GitLab From 46751a685188b64aab0b129a42d955b6c6e28bac Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:14:14 +0200 Subject: [PATCH 316/591] [fix] crash for 1ISM with right binaural channel written to invalid pointer --- lib_rend/ivas_objectRenderer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 75833b2de5..5f2df8a9e4 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -803,7 +803,8 @@ void ObjRenderIvasFrame_splitBinaural( } } #ifdef SPLIT_REND_LC3PLUS_MC - for ( i = 0; i < st_ivas->nchan_transport; ++i ) + /* Handle the 1 ISM case where there is only one channel in the input buffer */ + for ( i = 0; i < max( st_ivas->nchan_transport, BINAURAL_CHANNELS ); ++i ) #else for ( i = 0; i < BINAURAL_CHANNELS; i++ ) #endif -- GitLab From 8051c716ccd15392219a242e80f6ead1ec0227a8 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:25:45 +0200 Subject: [PATCH 317/591] [cleanup] rename BINAURAL_SPLIT_CLDFB to BINAURAL_SPLIT_CODED globally --- .../sample_split_rend_script_ivas_enc_dec.py | 4 +- ...mple_split_rend_script_ivas_enc_dec_ism.py | 2 +- .../sample_split_rend_script_ivas_rend.py | 2 +- .../sample_split_rend_script_ivas_rend_ism.py | 2 +- .../sample_split_rend_script_ivas_rend_mc.py | 2 +- apps/decoder.c | 4 +- apps/renderer.c | 18 +++--- lib_com/delay_comp.c | 2 +- lib_com/ivas_cnst.h | 4 +- lib_dec/ivas_binRenderer_internal.c | 4 +- lib_dec/ivas_dec.c | 12 ++-- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_init_dec.c | 14 ++--- lib_dec/ivas_output_config.c | 10 ++-- lib_dec/ivas_sba_dec.c | 4 +- lib_dec/ivas_spar_decoder.c | 2 +- lib_dec/lib_dec.c | 8 +-- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_output_init.c | 4 +- lib_rend/lib_rend.c | 56 +++++++++---------- lib_rend/lib_rend.h | 2 +- .../lc3plus/split_rend_lc3plus_cmdlines.py | 6 +- tests/split_rendering/constants.py | 6 +- 23 files changed, 86 insertions(+), 86 deletions(-) diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py index 7de05dba01..2c545b4239 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py @@ -91,7 +91,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): dec_exe, '-RENDER_CONFIG', renderers[rend][1], '-t', hr_pre_file, - 'BINAURAL_SPLIT_CLDFB', + 'BINAURAL_SPLIT_CODED', '48', file_pkt, bs_file_out @@ -104,7 +104,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): post_rend_cmd = [ rend_exe, '-i', bs_file_out, - '-if', 'BINAURAL_SPLIT_CLDFB', + '-if', 'BINAURAL_SPLIT_CODED', '-o', file_out, '-of', 'BINAURAL', '-fs', '48', diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py index 16e1cfec97..61c9d65963 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py @@ -78,7 +78,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): if renderers[rend][2] == '0': bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CLDFB'; + out_fmt = 'BINAURAL_SPLIT_CODED'; else: bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); bs_file_out = os.path.join(out_dir, bs_file_out_name); diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend.py b/Workspace_msvc/sample_split_rend_script_ivas_rend.py index 12ed4e09b3..fe81a2c39d 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend.py @@ -70,7 +70,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): if renderers[rend][2] == '0': bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CLDFB'; + out_fmt = 'BINAURAL_SPLIT_CODED'; else: bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); bs_file_out = os.path.join(out_dir, bs_file_out_name); diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py b/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py index a6bd2c04a4..e4e4c5beba 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py @@ -73,7 +73,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): if renderers[rend][2] == '0': bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CLDFB'; + out_fmt = 'BINAURAL_SPLIT_CODED'; else: bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); bs_file_out = os.path.join(out_dir, bs_file_out_name); diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py b/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py index e1dbbdcefb..ba258091f9 100644 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py +++ b/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py @@ -68,7 +68,7 @@ def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): if renderers[rend][2] == '0': bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CLDFB'; + out_fmt = 'BINAURAL_SPLIT_CODED'; else: bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); bs_file_out = os.path.join(out_dir, bs_file_out_name); diff --git a/apps/decoder.c b/apps/decoder.c index 939085acd1..1c7b7d198c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -854,7 +854,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( output_config = IVAS_DEC_OUTPUT_BINAURAL; } #ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CLDFB" ) == 0 ) + else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CODED" ) == 0 ) { output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB; } @@ -1433,7 +1433,7 @@ static void usage_dec( void ) fprintf( stdout, "---------------------\n" ); #ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); - fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, BINAURAL_SPLIT_CLDFB, BINAURAL_SPLIT_PCM, EXT\n" ); + fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM, EXT\n" ); #else fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index e7172c84aa..ec42d1ebe5 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -685,7 +685,7 @@ static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER #ifdef DEBUGGING cldfb_in = 1; #endif - if ( audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { cldfb_in = 1; } @@ -699,7 +699,7 @@ static int16_t is_split_post_rend_mode( CmdlnArgs *args ) int16_t flag; flag = 0; if ( ( args->inConfig.numBinBuses > 0 ) && - ( ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) ) + ( ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) ) { flag = 1; } @@ -711,7 +711,7 @@ static int16_t is_split_pre_rend_mode( CmdlnArgs *args ) { int16_t flag; flag = 0; - if ( ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { flag = 1; @@ -929,7 +929,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT /*if split renderer is running in post renderer mode*/ - if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) + if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath ); if ( error != IVAS_ERR_OK ) @@ -1307,7 +1307,7 @@ int main( #endif #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp ); @@ -2082,7 +2082,7 @@ static bool parseInConfig( inConfig->ambisonicsBuses[0].gain_dB = 0.0f; break; #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: inConfig->numBinBuses = 1; inConfig->binBuses[0].audioConfig = audioConfig; @@ -2337,9 +2337,9 @@ static IVAS_REND_AudioConfig parseAudioConfig( { return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; } - if ( strcmp( charBuf, "BINAURAL_SPLIT_CLDFB" ) == 0 ) + if ( strcmp( charBuf, "BINAURAL_SPLIT_CODED" ) == 0 ) { - return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; + return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } #endif if ( strcmp( charBuf, "BINAURAL_ROOM_IR" ) == 0 ) @@ -3533,7 +3533,7 @@ static void printSupportedAudioConfigs() "BINAURAL (output only)", #ifdef SPLIT_REND_WITH_HEAD_ROT "BINAURAL_SPLIT_PCM", - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", #endif "BINAURAL_ROOM_IR (output only)", "BINAURAL_ROOM_REVERB (output only)", diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 97b5472309..61c1a4d81e 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -103,7 +103,7 @@ int32_t get_delay( delay = IVAS_DEC_DELAY_NS; #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) #endif { if ( hCldfb != NULL ) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2f91f15ab9..f3b4b108f5 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -102,8 +102,8 @@ typedef enum AUDIO_CONFIG_OBA, /* object based audio */ AUDIO_CONFIG_BINAURAL, /* binaural with HRIR */ #ifdef SPLIT_REND_WITH_HEAD_ROT - AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB, /* split binaural with CLDFB coded output */ - AUDIO_CONFIG_BINAURAL_SPLIT_PCM, /* split binaural with PCM coded output */ + AUDIO_CONFIG_BINAURAL_SPLIT_CODED, /* split binaural with CLDFB coded output */ + AUDIO_CONFIG_BINAURAL_SPLIT_PCM, /* split binaural with PCM coded output */ #endif AUDIO_CONFIG_BINAURAL_ROOM_IR, /* binaural with BRIR */ AUDIO_CONFIG_BINAURAL_ROOM_REVERB, /* binaural with HRIR + reverb */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 096f02680d..acd2bee6bc 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -725,7 +725,7 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->hInputSetup->is_loudspeaker_setup = 0; getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE ); - if ( ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + if ( ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG hBinRenderer->numPoses = pMultiBinPoseData->num_poses + 1; @@ -791,7 +791,7 @@ ivas_error ivas_binRenderer_open( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 6db9d8417c..4c1f0d32f4 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -117,7 +117,7 @@ ivas_error ivas_dec( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS @@ -276,10 +276,10 @@ ivas_error ivas_dec( { #ifdef SPLIT_REND_LC3PLUS #ifdef SPLIT_REND_CLDFB_ISM - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) #endif { ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); @@ -519,7 +519,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { #ifdef SPLIT_REND_LC3PLUS_MC - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); } @@ -554,7 +554,7 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { #ifdef SPLIT_REND_LC3PLUS_MC - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); // TODO tmu check } @@ -781,7 +781,7 @@ ivas_error ivas_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /*split rendering process calls*/ - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index dc36c64f9f..78c7cc70aa 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2944,7 +2944,7 @@ void ivas_dirac_dec_render_sf( Cldfb_RealBuffer, Cldfb_ImagBuffer ); #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t pos_idx; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2b711e96fd..2054f0c345 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -674,7 +674,7 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -1256,7 +1256,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_renderSplitGetMultiBinPoseData( @@ -1270,7 +1270,7 @@ ivas_error ivas_init_decoder( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS @@ -1328,10 +1328,10 @@ ivas_error ivas_init_decoder( #ifdef SPLIT_REND_LC3PLUS #ifdef SPLIT_REND_CLDFB_ISM - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) #endif { ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, @@ -1402,7 +1402,7 @@ ivas_error ivas_init_decoder( } #ifdef SPLIT_REND_LC3PLUS_MC - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t pcm_out; @@ -2300,7 +2300,7 @@ static ivas_error doSanityChecks_IVAS( { if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 96851f24c5..ce8614b941 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -81,7 +81,7 @@ void ivas_renderer_select( if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -102,7 +102,7 @@ void ivas_renderer_select( { if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -140,7 +140,7 @@ void ivas_renderer_select( *internal_config = output_config; if ( output_config == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -157,7 +157,7 @@ void ivas_renderer_select( if ( output_config == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -208,7 +208,7 @@ void ivas_renderer_select( { *internal_config = transport_config; #ifdef SPLIT_REND_LC3PLUS_MC - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) #else if ( output_config == AUDIO_CONFIG_BINAURAL ) #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 51bac11136..0d93ccd557 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -232,7 +232,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_renderSplitGetMultiBinPoseData( @@ -247,7 +247,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index fc5be70877..cf5e2e11a2 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1680,7 +1680,7 @@ void ivas_spar_dec_upmixer_sf( { if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9fa79cd22c..0e8edba3ce 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -386,7 +386,7 @@ static AUDIO_CONFIG mapOutputFormat( #ifdef SPLIT_REND_WITH_HEAD_ROT else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) { - output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; + output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { @@ -1221,7 +1221,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( #ifdef SPLIT_REND_WITH_HEAD_ROT #ifndef EUALER2QUAT_FIX /* TODO: temp change until Euler2Quat() is fixed*/ - if ( ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) && + if ( ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #endif #endif @@ -2529,9 +2529,9 @@ static ivas_error get_channel_config( strcpy( str, "Binaural: room with reverb" ); } #ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + else if ( config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { - strcpy( str, "Binaural_Split_CLDFB" ); + strcpy( str, "BINAURAL_SPLIT_CODED" ); } else if ( config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 05c8945e3c..186a4a25a3 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -182,7 +182,7 @@ static ivas_error ivas_rend_initCrend( if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index d6a873d26d..e931b796a3 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -92,7 +92,7 @@ int16_t audioCfg2channels( break; case AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif case AUDIO_CONFIG_BINAURAL_ROOM_IR: @@ -224,7 +224,7 @@ void ivas_output_init( break; case AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif case AUDIO_CONFIG_BINAURAL_ROOM_IR: diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6e2e0b6859..7b3d40c350 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -559,8 +559,8 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( case IVAS_REND_AUDIO_CONFIG_BINAURAL: return AUDIO_CONFIG_BINAURAL; #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: - return AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + return AUDIO_CONFIG_BINAURAL_SPLIT_CODED; case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: return AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif @@ -597,8 +597,8 @@ IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( case AUDIO_CONFIG_BINAURAL: return IVAS_REND_AUDIO_CONFIG_BINAURAL; #ifdef SPLIT_REND_WITH_HEAD_ROT - case AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: - return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB; + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif @@ -652,7 +652,7 @@ static ivas_error validateOutputAudioConfig( case IVAS_REND_AUDIO_CONFIG_HOA3: case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: @@ -730,7 +730,7 @@ ivas_error getAudioConfigNumChannels( case IVAS_REND_AUDIO_CONFIG_STEREO: case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: @@ -1427,7 +1427,7 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_LC3PLUS - || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -2139,7 +2139,7 @@ static ivas_error updateMcPanGains( { case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_LC3PLUS_MC - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif break; /* Do nothing */ @@ -2257,7 +2257,7 @@ static ivas_error initMcBinauralRendering( } #ifdef SPLIT_REND_LC3PLUS_MC - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Open TD renderer wrappers */ for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) @@ -2292,7 +2292,7 @@ static ivas_error initMcBinauralRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT , #ifdef SPLIT_REND_LC3PLUS_MC - ( ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 + ( ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 #else 1 #endif @@ -2652,7 +2652,7 @@ updateSplitPostRendPanGains( *rendCtx.pOutSampleRate #ifndef SPLIT_REND_LC3PLUS , - ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 + ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ? 1 : 0 #endif ); if ( error != IVAS_ERR_OK ) @@ -2660,7 +2660,7 @@ updateSplitPostRendPanGains( return error; } #ifndef SPLIT_REND_LC3PLUS - if ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { error = ivas_splitBinLCLDDecOpen( &inputSplitPostRend->splitPostRendWrapper.hSplitBinLCLDDec, *rendCtx.pOutSampleRate, numOutChannels ); if ( error != IVAS_ERR_OK ) @@ -2701,7 +2701,7 @@ updateSbaPanGains( switch ( outConfig ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { int16_t is_cldfb_in; @@ -3184,7 +3184,7 @@ static ivas_error initMasaDummyDecForBinauralOut( ivas_output_init( &( decDummy->hOutSetup ), output_config ); if ( output_config == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -3540,7 +3540,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN IVAS_REND_AudioBufferConfig bufConfig; ivas_init_split_rend_handles( pSplitRendWrapper ); - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) @@ -4206,7 +4206,7 @@ ivas_error IVAS_REND_AddInput( inputStructSize = sizeof( *hIvasRend->inputsIsm ); activateInput = setRendInputActiveIsm; #ifdef SPLIT_REND_LC3PLUS - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { /* Hack to override default split rendering codec from Dolby CLDFB to LC3plus. This will not be necessary once the split rendering codec becomes selectable by the lib user. */ @@ -5136,7 +5136,7 @@ ivas_error IVAS_REND_SetHeadRotation( if ( headRot == NULL ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { hIvasRend->headRotData.headRotEnabled = 1; @@ -5165,9 +5165,9 @@ ivas_error IVAS_REND_SetHeadRotation( if ( headRot[i].w == -3.0f ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || - ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifndef EUALER2QUAT_FIX @@ -6314,7 +6314,7 @@ static ivas_error renderInputIsm( break; #ifdef SPLIT_REND_LC3PLUS - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderIsmToSplitBinaural( ismInput, outAudio ); break; @@ -7057,7 +7057,7 @@ static ivas_error renderInputMc( } break; #ifdef SPLIT_REND_LC3PLUS_MC - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderMcToSplitBinaural( mcInput, outConfig, outAudio ); break; @@ -7288,7 +7288,7 @@ static ivas_error renderSplitBinauralWithPostRot( hSplitBin->multiBinPoseData.poseCorrectionMode = bits.pose_correction; #endif - if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { #ifdef SPLIT_REND_LC3PLUS if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) @@ -7337,14 +7337,14 @@ static ivas_error renderSplitBinauralWithPostRot( isPostRendInputCldfb ); } #else /* SPLIT_REND_LC3PLUS */ - ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ? 1 : 0 ); + ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ? 1 : 0 ); #endif /* SPLIT_REND_LC3PLUS */ #ifdef SPLIT_REND_PLC } else { - if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) + if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { int16_t ch_idx; for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) @@ -7907,7 +7907,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_LC3PLUS if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && - ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) ) + ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) #else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif @@ -7935,7 +7935,7 @@ static ivas_error renderInputSba( switch ( outConfig ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderSbaToSplitBinaural( sbaInput, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -8604,7 +8604,7 @@ ivas_error IVAS_REND_GetSamples( outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && #ifdef SPLIT_REND_LC3PLUS_MC ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || @@ -8670,7 +8670,7 @@ ivas_error IVAS_REND_GetSamples( #endif #ifdef SPLIT_REND_LC3PLUS - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED #ifdef SPLIT_REND_CLDFB_ISM || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 3bae23f1fb..9e65b9786b 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -138,7 +138,7 @@ typedef enum #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 3, - IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 4, + IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 4, #endif IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 2, diff --git a/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py b/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py index f72fce6a87..d328cc6759 100755 --- a/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py +++ b/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py @@ -76,7 +76,7 @@ def full_chain(num_objects, ivas_bitrate, pre_head_rot_file, render_config_file, "-i", split_bs_name, "-if", - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", "-of", "BINAURAL", "-fs", @@ -106,7 +106,7 @@ def rend_chain(num_objects, pre_head_rot_file, render_config_file, post_head_rot "-im", *[metadata_for_ism(i + 1) for i in range(num_objects)], "-of", - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", "-fs", "48", *render_config_args, @@ -122,7 +122,7 @@ def rend_chain(num_objects, pre_head_rot_file, render_config_file, post_head_rot "-i", split_bs_name, "-if", - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", "-of", "BINAURAL", "-fs", diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index 3dae6039f3..aa9e367220 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -100,7 +100,7 @@ SPLIT_PRE_DEC_CMD = [ "", # 2 -> pre-trajectory file "-render_config", "", # 4 -> render config file - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", "48", "", # 7 -> encoder bitstream "", # 8 -> split rendering bitstream @@ -120,7 +120,7 @@ SPLIT_PRE_REND_CMD = [ "-o", "", # 10 -> split rendering bitstream "-of", - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", "-tf", "", # 14 -> post-trajectory file ] @@ -133,7 +133,7 @@ SPLIT_POST_REND_CMD = [ "-i", "", # 4 -> split rendering bitstream "-if", - "BINAURAL_SPLIT_CLDFB", + "BINAURAL_SPLIT_CODED", "-o", "", # 8 -> output file "-of", -- GitLab From 7898ecbd711feec523b222ca34df33982d74be05 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:33:52 +0200 Subject: [PATCH 318/591] [cleanup] accept FIX_SPLIT_REND_OPEN_ERROR_HANDLING --- lib_com/options.h | 2 -- lib_dec/ivas_init_dec.c | 30 ++++++++++-------------------- lib_dec/ivas_sba_dec.c | 11 +++-------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index cc9dd0300c..593cda60ed 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,6 @@ #define FIX_SPLIT_REND_MERGE /* Resolving the compilation warnings after splitrenderer main updation */ - //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER //#define SPLIT_POSE_CORRECTION_DEBUG @@ -220,7 +219,6 @@ #define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ #define SPLIT_REND_LC3PLUS_MC /* FhG: split rendering using LC3plus codec for Multichannel content */ -#define FIX_SPLIT_REND_OPEN_ERROR_HANDLING /* adds missing error handling around ivas_split_renderer_open calls */ // #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2054f0c345..c29f10ab8e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1278,20 +1278,15 @@ ivas_error ivas_init_decoder( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); #endif -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING - error = -#endif - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, - 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, + 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING if ( error != IVAS_ERR_OK ) { return error; } -#endif } #endif } @@ -1342,25 +1337,20 @@ ivas_error ivas_init_decoder( &st_ivas->splitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis ); -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING - error = -#endif - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 0, + error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 0, #ifdef SPLIT_REND_CLDFB_ISM - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 #else - 0 + 0 #endif - ); + ); -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING if ( error != IVAS_ERR_OK ) { return error; } -#endif } #endif if ( st_ivas->hDecoderConfig->voip_active ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 0d93ccd557..98799b231a 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -253,18 +253,13 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef SPLIT_REND_LC3PLUS assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LCLD ); #endif -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING - error = -#endif - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { return error; } -#endif } #endif } -- GitLab From ad5f52b8befc370ead53502f409ce321de72ae59 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:37:09 +0200 Subject: [PATCH 319/591] [cleanup] accept SPLIT_REND_LC3PLUS_MC --- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 14 +------------- lib_dec/ivas_init_dec.c | 8 -------- lib_dec/ivas_output_config.c | 4 ---- 4 files changed, 1 insertion(+), 26 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 593cda60ed..ec19d31d2b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -218,7 +218,6 @@ #define SPLIT_REND_STACK_OPT #define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ -#define SPLIT_REND_LC3PLUS_MC /* FhG: split rendering using LC3plus codec for Multichannel content */ // #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4c1f0d32f4..be84d20b2f 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -121,14 +121,10 @@ ivas_error ivas_dec( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_LC3PLUS -#ifdef SPLIT_REND_LC3PLUS_MC assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); -#else - assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA or discrete ISM format and 48k sampling rate only" ); -#endif #else assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); #endif @@ -518,14 +514,12 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef SPLIT_REND_LC3PLUS_MC if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); } else { -#endif if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -539,9 +533,7 @@ ivas_error ivas_dec( } ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#ifdef SPLIT_REND_LC3PLUS_MC } -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -553,23 +545,19 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef SPLIT_REND_LC3PLUS_MC if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { - ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); // TODO tmu check + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } else { -#endif if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) { return error; } ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#ifdef SPLIT_REND_LC3PLUS_MC } -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index c29f10ab8e..d52480ef1f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1380,9 +1380,7 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef SPLIT_REND_LC3PLUS_MC int16_t num_poses; -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) @@ -1390,7 +1388,6 @@ ivas_error ivas_init_decoder( return error; } } -#ifdef SPLIT_REND_LC3PLUS_MC if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) @@ -1420,17 +1417,12 @@ ivas_error ivas_init_decoder( { num_poses = 1; } -#endif if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , -#ifdef SPLIT_REND_LC3PLUS_MC num_poses -#else - 1 -#endif #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index ce8614b941..e1375cfa80 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -207,11 +207,7 @@ void ivas_renderer_select( else { *internal_config = transport_config; -#ifdef SPLIT_REND_LC3PLUS_MC if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( output_config == AUDIO_CONFIG_BINAURAL ) -#endif { #ifdef DEBUGGING if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) -- GitLab From 160c614b1ae26ebc17457f94470103deae1f4608 Mon Sep 17 00:00:00 2001 From: malenov Date: Wed, 12 Jul 2023 15:45:43 +0200 Subject: [PATCH 320/591] fix failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted --- lib_com/bitstream.c | 136 ++++++++++++++++++++++++++ lib_com/options.h | 2 +- lib_com/prot.h | 8 ++ lib_enc/init_enc.c | 3 + lib_enc/ivas_corecoder_enc_reconfig.c | 3 + lib_enc/ivas_cpe_enc.c | 3 + lib_enc/ivas_sce_enc.c | 3 + lib_enc/ivas_spar_md_enc.c | 3 + lib_enc/ivas_stereo_td_enc.c | 3 + lib_enc/stat_enc.h | 4 +- 10 files changed, 166 insertions(+), 2 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 25d388aed1..cbb9358d8a 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -169,6 +169,131 @@ Word16 rate2EVSmode( * Re-allocate the list of indices *-------------------------------------------------------------------*/ +#ifdef FIX_MEM_REALLOC_IND_LIST +ivas_error ind_list_realloc( + INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ + const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ +) +{ + int16_t i, n, ch, n_channels, ind_list_pos, is_metadata, ivas_max_num_indices; + INDICE_HANDLE new_ind_list; + BSTR_ENC_HANDLE hBstr; + + if (st_ivas == NULL) + { + return IVAS_ERR_OK; + } + + /* get the pointer to the beginning of the old buffer of indices (either metadata or core coders) */ + if ( old_ind_list == st_ivas->ind_list_metadata ) + { + is_metadata = 1; + ivas_max_num_indices = st_ivas->ivas_max_num_indices_metadata; + } + else + { + is_metadata = 0; + ivas_max_num_indices = st_ivas->ivas_max_num_indices; + } + + /* allocate new buffer of indices */ + if ( ( new_ind_list = (INDICE_HANDLE) malloc( max_num_indices * sizeof( Indice ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for buffer of indices!\n" ) ); + } + + /* move indices from the old list to the new list */ + for ( i = 0; i < min( max_num_indices, ivas_max_num_indices ); i++ ) + { + if ( old_ind_list[i].nb_bits > -1 ) + { + new_ind_list[i].id = old_ind_list[i].id; + new_ind_list[i].value = old_ind_list[i].value; + } + new_ind_list[i].nb_bits = old_ind_list[i].nb_bits; + } + + /* reset nb_bits of all other indices to -1 */ + for ( ; i < max_num_indices; i++ ) + { + new_ind_list[i].nb_bits = -1; + } + + /* update parameters in all SCE elements */ + for ( n = 0; n < st_ivas->nSCE; n++ ) + { + /* get the pointer to hBstr */ + if ( is_metadata ) + { + hBstr = st_ivas->hSCE[n]->hMetaData; + } + else + { + hBstr = st_ivas->hSCE[n]->hCoreCoder[0]->hBstr; + } + + if ( hBstr != NULL ) + { + /* get the current position inside the old list */ + ind_list_pos = ( int16_t )( hBstr->ind_list - old_ind_list ); + + /* set pointers in the new list */ + *( hBstr->ivas_ind_list_zero ) = new_ind_list; + hBstr->ind_list = &new_ind_list[ind_list_pos]; + + /* set the new maximum number of indices */ + *( hBstr->ivas_max_num_indices ) = max_num_indices; + } + } + + /* update parameters in all CPE elements */ + for ( n = 0; n < st_ivas->nCPE; n++ ) + { + /* get the pointer to hBstr */ + if ( is_metadata ) + { + n_channels = 1; + } + else + { + n_channels = CPE_CHANNELS; + } + + for ( ch = 0; ch < n_channels; ch++ ) + { + if ( is_metadata ) + { + hBstr = st_ivas->hCPE[n]->hMetaData; + } + else + { + hBstr = st_ivas->hCPE[n]->hCoreCoder[ch]->hBstr; + } + + if ( hBstr != NULL ) + { + /* get the current position inside the old list */ + ind_list_pos = ( int16_t )( hBstr->ind_list - old_ind_list ); + + /* set pointers in the new list */ + *( hBstr->ivas_ind_list_zero ) = new_ind_list; + hBstr->ind_list = &new_ind_list[ind_list_pos]; + + /* set the new maximum number of indices */ + *( hBstr->ivas_max_num_indices ) = max_num_indices; + } + } + } + + /* free the old list */ + free( old_ind_list ); + + return IVAS_ERR_OK; +} + +#else + ivas_error ind_list_realloc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ @@ -216,6 +341,8 @@ ivas_error ind_list_realloc( return IVAS_ERR_OK; } +#endif + /*-----------------------------------------------------------------------* * get_ivas_max_num_indices() @@ -468,6 +595,7 @@ int16_t get_core_max_num_indices( const int32_t total_brate /* i : total bitrate */ ) { + /* set the maximum number of indices in the core coder */ if ( core == ACELP_CORE || core == AMR_WB_CORE ) { @@ -866,7 +994,11 @@ ivas_error check_ind_list_limits( #endif /* reallocate the buffer of indices with increased limit */ +#ifdef FIX_MEM_REALLOC_IND_LIST + if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES , hBstr->st_ivas) ) != IVAS_ERR_OK ) +#else if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -894,7 +1026,11 @@ ivas_error check_ind_list_limits( #endif /* no available empty slot -> need to re-allocate the buffer */ +#ifdef FIX_MEM_REALLOC_IND_LIST + if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK ) +#else if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_com/options.h b/lib_com/options.h index a66408dd60..ebe810b16c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -127,7 +127,6 @@ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ /*#define DEBUG_AGC_ENCODER_CMD_OPTION*/ /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ - #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ #endif @@ -167,6 +166,7 @@ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ #define FIX_593_STL_INCLUDE /* FhG: Issue 593: correct include of stl.h in lib_enc/ivas_stereo_eclvq_enc.c */ #define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ +#define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 592d0253d3..1667745077 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -538,10 +538,18 @@ int16_t get_ivas_max_num_indices_metadata( const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); +#ifdef FIX_MEM_REALLOC_IND_LIST ivas_error ind_list_realloc( + INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ + const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ +); +#else + ivas_error ind_list_realloc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ ); +#endif ivas_error check_ind_list_limits( BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 8cde5b838b..96d32aa77e 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -126,6 +126,9 @@ ivas_error init_encoder( st->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices; st->hBstr->nb_ind_tot = 0; st->hBstr->nb_bits_tot = 0; +#ifdef FIX_MEM_REALLOC_IND_LIST + st->hBstr->st_ivas = st_ivas; +#endif } else { diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index 10c627c91b..ff79dd11b0 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -468,6 +468,9 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata; st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot = 0; st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_bits_tot = 0; +#ifdef FIX_MEM_REALLOC_IND_LIST + st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->st_ivas = st_ivas; +#endif } reset_indices_enc( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot ); diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 3c1d7a61c6..09cd09eacc 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -812,6 +812,9 @@ ivas_error create_cpe_enc( hCPE->hMetaData->ind_list = st_ivas->ind_list_metadata; hCPE->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; hCPE->hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata; +#ifdef FIX_MEM_REALLOC_IND_LIST + hCPE->hMetaData->st_ivas = st_ivas; +#endif reset_indices_enc( hCPE->hMetaData, st_ivas->ivas_max_num_indices_metadata ); } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 97992ecb9f..b9e6a85527 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -316,6 +316,9 @@ ivas_error create_sce_enc( hSCE->hMetaData->ind_list = st_ivas->ind_list_metadata; hSCE->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; hSCE->hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata; +#ifdef FIX_MEM_REALLOC_IND_LIST + hSCE->hMetaData->st_ivas = st_ivas; +#endif reset_indices_enc( hSCE->hMetaData, st_ivas->ivas_max_num_indices_metadata ); } else diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 3a93f3d0a1..66dc292fdf 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -627,6 +627,9 @@ ivas_error ivas_spar_md_enc_process( max_num_indices_tmp = MAX_BITS_METADATA; hMetaData_tmp.ivas_max_num_indices = &max_num_indices_tmp; hMetaData_tmp.ivas_ind_list_zero = (Indice **) ( &hMetaData_tmp.ind_list ); +#ifdef FIX_MEM_REALLOC_IND_LIST + hMetaData_tmp.st_ivas = NULL; +#endif /* Save state of metadata bitstream buffer */ bit_pos_start = hMetaData->nb_bits_tot; diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 3f8fe55809..a59ac93e49 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -128,6 +128,9 @@ void stereo_td_init_enc( hStereoTD->tdm_hBstr_tmp.ivas_ind_list_zero = (Indice **) ( &hStereoTD->tdm_hBstr_tmp.ind_list ); hStereoTD->max_ind_tdm_tmp = MAX_IND_TDM_TMP; hStereoTD->tdm_hBstr_tmp.ivas_max_num_indices = &hStereoTD->max_ind_tdm_tmp; +#ifdef FIX_MEM_REALLOC_IND_LIST + hStereoTD->tdm_hBstr_tmp.st_ivas = NULL; +#endif reset_indices_enc( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); return; diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 2e7924f371..e6d9e863d0 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -46,7 +46,6 @@ #include "cnst.h" #include "ivas_cnst.h" - /*------------------------------------------------------------------------------------------* * Indice *------------------------------------------------------------------------------------------*/ @@ -69,6 +68,9 @@ typedef struct bitstream_enc_data_structure Indice *ind_list; /* list of indices */ int16_t *ivas_max_num_indices; /* maximum total number of indices in the list */ Indice **ivas_ind_list_zero; /* beginning of the buffer of indices */ +#ifdef FIX_MEM_REALLOC_IND_LIST + void *st_ivas; /* IVAS encoder structure */ +#endif } BSTR_ENC_DATA, *BSTR_ENC_HANDLE; /*----------------------------------------------------------------------------------* -- GitLab From cbdd88f44ff196b9df8388789a0cf1bc18c8cfb5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:46:23 +0200 Subject: [PATCH 321/591] [cleanup] reorganise options.h and rename EUALER2QUAT_FIX to EULER2QUAT_FIX --- lib_com/options.h | 17 ++++++++++------- lib_dec/lib_dec.c | 2 +- lib_rend/ivas_rotation.c | 4 ++-- lib_rend/lib_rend.c | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ec19d31d2b..0e1dfb4d1f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,7 +175,14 @@ /* ################## End BE DEVELOPMENT switches ######################### */ -#define SPLIT_REND_WITH_HEAD_ROT +/* Fixes for bugs found during split rendering contribution development */ +#define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ +#define EULER2QUAT_FIX /* Dlb: Fix for Euler2Quat()/Quat2EulerDegree functions */ +#define SBA_CREND_ROT_OPT /* Dlb: Optimisation for rotateFrameSba() used for SHD rotations in external renderer */ + + +#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ + #ifdef SPLIT_REND_WITH_HEAD_ROT #define FIX_SPLIT_REND_MERGE /* Resolving the compilation warnings after splitrenderer main updation */ @@ -206,20 +213,16 @@ #define USE_BIT_COUNT_MERGE_COST #define OPTIMIZE_DPCM_QUANT #define SPLIT_REND_PLC +#define ROM_TO_RAM /* switch to convert CQMF decoder tables to RAM */ /*CLDFB CODEC SWITCHES -- END*/ -#define REND_STATIC_MEM_OPT -#define EUALER2QUAT_FIX -#define SBA_CREND_ROT_OPT - -#define ROM_TO_RAM /*switch to convert CQMF decoder tables to RAM*/ #define SPLIT_REND_CLANG_SAN_FIX #define SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_STACK_OPT #define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ // #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* ################## End DEVELOPMENT switches ######################### */ /* #################### Start NON-BE CR switches ########################## */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0e8edba3ce..ba321a758e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1219,7 +1219,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( { /* check for Euler angle signaling */ #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifndef EUALER2QUAT_FIX +#ifndef EULER2QUAT_FIX /* TODO: temp change until Euler2Quat() is fixed*/ if ( ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 9f599bdb27..7cd9b533f6 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -223,11 +223,11 @@ void Quat2EulerDegree( { if ( quat.w != -3.0 ) { -#ifdef EUALER2QUAT_FIX +#ifdef EULER2QUAT_FIX float p; #endif *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); -#ifdef EUALER2QUAT_FIX +#ifdef EULER2QUAT_FIX p = 2 * ( quat.w * quat.y - quat.z * quat.x ); p = max( -1.0f, min( 1.0f, p ) ); *pitch = asinf( p ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7b3d40c350..fe0ff4e1a1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5170,7 +5170,7 @@ ivas_error IVAS_REND_SetHeadRotation( ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { -#ifndef EUALER2QUAT_FIX +#ifndef EULER2QUAT_FIX rotQuat = headRot[i]; /* TODO: temp change until Euler2Quat() is fixed*/ #else Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); -- GitLab From a0ae7d6d53d362e802955c405987f04286e5a65e Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Wed, 12 Jul 2023 15:57:58 +0200 Subject: [PATCH 322/591] formatting --- lib_com/bitstream.c | 16 ++++++++-------- lib_com/prot.h | 8 ++++---- lib_enc/stat_enc.h | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index cbb9358d8a..dee02c69b6 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -171,20 +171,20 @@ Word16 rate2EVSmode( #ifdef FIX_MEM_REALLOC_IND_LIST ivas_error ind_list_realloc( - INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ - const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ - Encoder_Struct *st_ivas /* i : IVAS encoder structure */ + INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ + const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ ) { int16_t i, n, ch, n_channels, ind_list_pos, is_metadata, ivas_max_num_indices; INDICE_HANDLE new_ind_list; BSTR_ENC_HANDLE hBstr; - if (st_ivas == NULL) + if ( st_ivas == NULL ) { return IVAS_ERR_OK; } - + /* get the pointer to the beginning of the old buffer of indices (either metadata or core coders) */ if ( old_ind_list == st_ivas->ind_list_metadata ) { @@ -236,7 +236,7 @@ ivas_error ind_list_realloc( if ( hBstr != NULL ) { /* get the current position inside the old list */ - ind_list_pos = ( int16_t )( hBstr->ind_list - old_ind_list ); + ind_list_pos = (int16_t) ( hBstr->ind_list - old_ind_list ); /* set pointers in the new list */ *( hBstr->ivas_ind_list_zero ) = new_ind_list; @@ -274,7 +274,7 @@ ivas_error ind_list_realloc( if ( hBstr != NULL ) { /* get the current position inside the old list */ - ind_list_pos = ( int16_t )( hBstr->ind_list - old_ind_list ); + ind_list_pos = (int16_t) ( hBstr->ind_list - old_ind_list ); /* set pointers in the new list */ *( hBstr->ivas_ind_list_zero ) = new_ind_list; @@ -995,7 +995,7 @@ ivas_error check_ind_list_limits( /* reallocate the buffer of indices with increased limit */ #ifdef FIX_MEM_REALLOC_IND_LIST - if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES , hBstr->st_ivas) ) != IVAS_ERR_OK ) + if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index 1667745077..4abc410b70 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -540,12 +540,12 @@ int16_t get_ivas_max_num_indices_metadata( #ifdef FIX_MEM_REALLOC_IND_LIST ivas_error ind_list_realloc( - INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ - const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ - Encoder_Struct *st_ivas /* i : IVAS encoder structure */ + INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ + const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ ); #else - ivas_error ind_list_realloc( +ivas_error ind_list_realloc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t max_num_indices /* i : new maximum number of allowed indices in the list */ ); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index e6d9e863d0..45d01ac6ca 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -69,7 +69,7 @@ typedef struct bitstream_enc_data_structure int16_t *ivas_max_num_indices; /* maximum total number of indices in the list */ Indice **ivas_ind_list_zero; /* beginning of the buffer of indices */ #ifdef FIX_MEM_REALLOC_IND_LIST - void *st_ivas; /* IVAS encoder structure */ + void *st_ivas; /* IVAS encoder structure */ #endif } BSTR_ENC_DATA, *BSTR_ENC_HANDLE; -- GitLab From 41b1b8ab7a4b28fff1f6ddbe2bef0ff7aff19e86 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 15:59:43 +0200 Subject: [PATCH 323/591] [cleanup] strip SPLIT_REND_LC3PLUS_HBR_DBG --- apps/renderer.c | 3 --- lib_com/ivas_cnst.h | 3 --- lib_com/options.h | 1 - lib_rend/ivas_lc3plus_enc.c | 6 ------ lib_rend/ivas_splitRenderer_utils.c | 27 --------------------------- lib_rend/lib_rend.c | 6 ------ 6 files changed, 46 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index ec42d1ebe5..77c6c63089 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1350,9 +1350,6 @@ int main( #else bitsBufferSize = (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC; bitsBufferSize = ( bitsBufferSize + 7 ) >> 3; -#endif -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - bitsBufferSize = ( SPLIT_REND_LC3PLUS_HBR * MAX_HEAD_ROT_POSES /* Max head poses */ * BINAURAL_CHANNELS /* Ech pose is 2 channels */ + 256000 /* Max metadata bitrate */ ) / FRAMES_PER_SEC / 8; #endif } else diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f3b4b108f5..8531a09156 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1821,9 +1821,6 @@ typedef enum #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 #define SPLIT_REND_MAX_BRATE SPLIT_REND_768k -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG -#define SPLIT_REND_LC3PLUS_HBR 128000 /* bitrate per LC3plus core */ -#endif #ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) diff --git a/lib_com/options.h b/lib_com/options.h index 0e1dfb4d1f..3e2023b82c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -221,7 +221,6 @@ #define SPLIT_REND_STACK_OPT #define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ -// #define SPLIT_REND_LC3PLUS_HBR_DBG /* Override bitrate per LC3 core */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_lc3plus_enc.c b/lib_rend/ivas_lc3plus_enc.c index d83a471dee..36e9015b5d 100644 --- a/lib_rend/ivas_lc3plus_enc.c +++ b/lib_rend/ivas_lc3plus_enc.c @@ -54,12 +54,6 @@ ivas_error IVAS_LC3PLUS_ENC_Open( return IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid number of channels\n" ); } bitsPerSecondPerChannel = bitsPerSecond / config.channels; -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - if ( bitsPerSecond == (uint32_t) -1 ) - { - bitsPerSecondPerChannel = SPLIT_REND_LC3PLUS_HBR; - } -#endif encoder_size = lc3plus_enc_get_size( config.samplerate, 1 ); if ( 0 == encoder_size ) diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 6ed5428297..bff717fa4b 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -396,13 +396,6 @@ int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, con md_bitrate = 128000; break; } -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - case -1: - { - md_bitrate = 256000; - break; - } -#endif default: { return -1; @@ -446,13 +439,6 @@ int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_ #ifdef SPLIT_REND_LC3PLUS int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ) { -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - if ( SplitRendBitRate == -1 ) - { - return -1; - } -#endif - if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { int32_t inBandMdBps = (int32_t) ( 8 * FRAMES_PER_SECOND ); @@ -470,12 +456,6 @@ int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REN int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ) { -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - if ( SplitRendBitRate == -1 ) - { - return 3; - } -#endif switch ( SplitRendBitRate ) { case SPLIT_REND_768k: @@ -509,13 +489,6 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL { int32_t bitrate; -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - if ( SplitRendBitRateId == 3 ) - { - return -1; - } -#endif - switch ( SplitRendBitRateId ) { case 4: diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index fe0ff4e1a1..5cad760aaf 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7166,12 +7166,6 @@ static ivas_error splitBinLc3plusDecode( /* Read LC3plus bitstream size info */ lc3plusBitrateId = ivas_split_rend_bitstream_read_int32( bits, 8 ); lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( (int8_t) lc3plusBitrateId, pose_correction ); -#ifdef SPLIT_REND_LC3PLUS_HBR_DBG - if ( lc3plusBitstreamSize == -1 ) - { - lc3plusBitstreamSize = hSplitBin->hLc3plusDec->num_decs * SPLIT_REND_LC3PLUS_HBR / FRAMES_PER_SECOND / 8; - } -#endif for ( int16_t i = 0; i < BINAURAL_CHANNELS * hSplitBin->multiBinPoseData.num_poses; ++i ) { -- GitLab From c72483b2ec90da352fd5e5b5725f66e9de8f7fbd Mon Sep 17 00:00:00 2001 From: malenov Date: Wed, 12 Jul 2023 16:02:32 +0200 Subject: [PATCH 324/591] cleanup of BITSTREAM_INDICES_MEMORY --- lib_enc/lib_enc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 18cfb9247d..f0957726e8 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -110,13 +110,7 @@ ivas_error IVAS_ENC_Open( * Allocate and initialize IVAS application encoder handle *-----------------------------------------------------------------*/ -#ifdef BITSTREAM_INDICES_MEMORY -#define WMC_TOOL_SKIP if ( ( *phIvasEnc = (IVAS_ENC_HANDLE) malloc( sizeof( struct IVAS_ENC ) ) ) == NULL ) -#undef WMC_TOOL_SKIP -#else - if ( ( *phIvasEnc = (IVAS_ENC_HANDLE) malloc( sizeof( struct IVAS_ENC ) ) ) == NULL ) -#endif { return IVAS_ERR_FAILED_ALLOC; } @@ -205,13 +199,7 @@ void IVAS_ENC_Close( ( *phIvasEnc )->st_ivas = NULL; -#ifdef BITSTREAM_INDICES_MEMORY -#define WMC_TOOL_SKIP free( *phIvasEnc ); -#undef WMC_TOOL_SKIP -#else - free( *phIvasEnc ); -#endif *phIvasEnc = NULL; phIvasEnc = NULL; -- GitLab From 28585fbb03cc47e6f8382c07fe80f63530338c9c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 16:06:25 +0200 Subject: [PATCH 325/591] [cleanup] rearrange options.h again --- lib_com/options.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4aad36e94b..0276028f1e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,12 +143,6 @@ /* only BE switches wrt operation points tested in selection */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ - - -#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ -#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ -#define RENAME_GWLPR /* FhG: Rename clashing symbol */ - #define VLBR_20MS_MD /* Dlb: SBA VLBR 20ms Optimization*/ #define FIX_563_PARAMMC_LIMITER /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set */ #define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ @@ -173,14 +167,13 @@ #define FIX_593_STL_INCLUDE /* FhG: Issue 593: correct include of stl.h in lib_enc/ivas_stereo_eclvq_enc.c */ #define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ -/* ################## End BE DEVELOPMENT switches ######################### */ - - /* Fixes for bugs found during split rendering contribution development */ #define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ #define EULER2QUAT_FIX /* Dlb: Fix for Euler2Quat()/Quat2EulerDegree functions */ #define SBA_CREND_ROT_OPT /* Dlb: Optimisation for rotateFrameSba() used for SHD rotations in external renderer */ - +#define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ +#define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ +#define RENAME_GWLPR /* FhG: Rename clashing symbol */ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ @@ -224,7 +217,9 @@ #define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ -/* ################## End DEVELOPMENT switches ######################### */ +/* ################## End BE DEVELOPMENT switches ######################### */ + + /* #################### Start NON-BE CR switches ########################## */ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -- GitLab From 0f75e58172d828f621cc90a8409afeb26ee014a1 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 16:52:17 +0200 Subject: [PATCH 326/591] [cleanup] actually accept SPLIT_REND_LC3PLUS_MC (buggy coan on arm64 :( ) --- lib_rend/ivas_crend.c | 2 - lib_rend/ivas_objectRenderer.c | 16 ------- lib_rend/ivas_prot_rend.h | 2 - lib_rend/lib_rend.c | 81 ---------------------------------- 4 files changed, 101 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 186a4a25a3..c50aa7aa6a 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1741,7 +1741,6 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_LC3PLUS_MC /*-----------------------------------------------------------------------------------------* @@ -1861,4 +1860,3 @@ ivas_error ivas_rend_crendProcessSplitBin( return IVAS_ERR_OK; } -#endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 5f2df8a9e4..772def7ed3 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -718,17 +718,9 @@ void ObjRenderIvasFrame_splitBinaural( ) { int32_t i; -#ifdef SPLIT_REND_LC3PLUS_MC float tmpProcessing[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#else - float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k]; -#endif float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k]; -#ifdef SPLIT_REND_LC3PLUS_MC float *p_tmpProcessing[MAX_OUTPUT_CHANNELS]; -#else - float *p_tmpProcessing[MAX_NUM_OBJECTS]; -#endif int16_t pos_idx; IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -766,11 +758,7 @@ void ObjRenderIvasFrame_splitBinaural( /* Copy input audio to a processing buffer. Cannot render in-place because binaurally rendered * audio would overwrite original material, which is still needed for rendering next head pose. */ -#ifdef SPLIT_REND_LC3PLUS_MC for ( i = 0; i < st_ivas->nchan_transport; ++i ) -#else - for ( i = 0; i < MAX_NUM_OBJECTS; ++i ) -#endif { mvr2r( output[i], tmpProcessing[i], output_frame ); } @@ -802,12 +790,8 @@ void ObjRenderIvasFrame_splitBinaural( } } } -#ifdef SPLIT_REND_LC3PLUS_MC /* Handle the 1 ISM case where there is only one channel in the input buffer */ for ( i = 0; i < max( st_ivas->nchan_transport, BINAURAL_CHANNELS ); ++i ) -#else - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) -#endif { p_tmpProcessing[i] = tmpProcessing[i]; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index aa2ebe24dc..d79956dc7d 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -637,14 +637,12 @@ ivas_error ivas_rend_crendProcessSubframe( const int32_t output_Fs /* i : output sampling rate */ ); -#ifdef SPLIT_REND_LC3PLUS_MC /* TODO tmu : interface cleanup */ ivas_error ivas_rend_crendProcessSplitBin( Decoder_Struct *st_ivas, float output[][L_FRAME48k], const int16_t output_frame ); -#endif /*----------------------------------------------------------------------------------* * Reverberator diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5cad760aaf..7227783c86 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -177,9 +177,7 @@ typedef struct EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; -#ifdef SPLIT_REND_LC3PLUS_MC TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ -#endif REVERB_HANDLE hReverb; rotation_gains rot_gains_prev; int16_t nonDiegeticPan; @@ -2138,10 +2136,8 @@ static ivas_error updateMcPanGains( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_LC3PLUS_MC case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif break; /* Do nothing */ case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: @@ -2188,9 +2184,7 @@ static ivas_error initMcBinauralRendering( RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; -#ifdef SPLIT_REND_LC3PLUS_MC int16_t i; -#endif int32_t outSampleRate; /* check if re-initialization */ @@ -2200,7 +2194,6 @@ static ivas_error initMcBinauralRendering( inputMc->tdRendWrapper.hHrtfTD = NULL; } -#ifdef SPLIT_REND_LC3PLUS_MC for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) @@ -2209,7 +2202,6 @@ static ivas_error initMcBinauralRendering( inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; } } -#endif ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2256,7 +2248,6 @@ static ivas_error initMcBinauralRendering( return error; } -#ifdef SPLIT_REND_LC3PLUS_MC if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Open TD renderer wrappers */ @@ -2276,7 +2267,6 @@ static ivas_error initMcBinauralRendering( } } -#endif if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) @@ -2291,11 +2281,7 @@ static ivas_error initMcBinauralRendering( NULL, outSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , -#ifdef SPLIT_REND_LC3PLUS_MC ( ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 -#else - 1 -#endif #endif ) ) != IVAS_ERR_OK ) { @@ -2411,9 +2397,7 @@ static ivas_error setRendInputActiveMc( const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { -#ifdef SPLIT_REND_LC3PLUS_MC int16_t i; -#endif ivas_error error; rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; @@ -2448,19 +2432,13 @@ static ivas_error setRendInputActiveMc( inputMc->hMcMasa = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); -#ifdef SPLIT_REND_LC3PLUS_MC for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { inputMc->splitTdRendWrappers[i] = defaultTdRendWrapper(); } -#endif -#ifdef SPLIT_REND_LC3PLUS_MC if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) -#else - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { @@ -2487,9 +2465,7 @@ static ivas_error setRendInputActiveMc( static void clearInputMc( input_mc *inputMc ) { -#ifdef SPLIT_REND_LC3PLUS_MC int16_t i; -#endif rendering_context rendCtx; rendCtx = inputMc->base.ctx; @@ -2525,7 +2501,6 @@ static void clearInputMc( inputMc->tdRendWrapper.hHrtfTD = NULL; } -#ifdef SPLIT_REND_LC3PLUS_MC for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) @@ -2534,7 +2509,6 @@ static void clearInputMc( inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; } } -#endif ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); @@ -3722,13 +3696,11 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; -#ifdef SPLIT_REND_LC3PLUS_MC for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsMc[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsMc[i].splitTdRendWrappers ) ); ++j ) { hIvasRend->inputsMc[i].splitTdRendWrappers[j].hBinRendererTd = NULL; hIvasRend->inputsMc[i].splitTdRendWrappers[j].hHrtfTD = NULL; } -#endif } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) @@ -4318,11 +4290,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } -#ifdef SPLIT_REND_LC3PLUS_MC if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) -#else - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { @@ -6370,24 +6338,16 @@ static ivas_error renderActiveInputsIsm( static ivas_error renderLfeToBinaural( const input_mc *mcInput, -#ifdef SPLIT_REND_LC3PLUS_MC const IVAS_REND_AudioConfig outConfig, -#endif IVAS_REND_AudioBuffer outAudio ) { int16_t i; int16_t lfe_idx; -#ifdef SPLIT_REND_LC3PLUS_MC int16_t pose_idx, num_poses; -#endif float gain; float *readPtr, *writePtr; -#ifdef SPLIT_REND_LC3PLUS_MC assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); -#else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); -#endif push_wmops( "renderLfeToBinaural" ); @@ -6407,7 +6367,6 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_LC3PLUS_MC /* Copy LFE to left and right binaural channels */ if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) { @@ -6434,22 +6393,6 @@ static ivas_error renderLfeToBinaural( *writePtr++ += gain * ( *readPtr++ ); } } -#else - /* Copy LFE to left and right ears */ - readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); - writePtr = getSmplPtr( outAudio, 0, 0 ); - for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) - { - *writePtr++ += gain * ( *readPtr++ ); - } - - readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); - writePtr = getSmplPtr( outAudio, 1, 0 ); - for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) - { - *writePtr++ += gain * ( *readPtr++ ); - } -#endif pop_wmops(); @@ -6548,11 +6491,7 @@ static ivas_error renderMcToBinaural( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#ifdef SPLIT_REND_LC3PLUS_MC if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6650,11 +6589,7 @@ static ivas_error renderMcToBinauralRoom( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#ifdef SPLIT_REND_LC3PLUS_MC if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6752,11 +6687,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); -#ifdef SPLIT_REND_LC3PLUS_MC if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6831,7 +6762,6 @@ static ivas_error renderMcToMasa( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_LC3PLUS_MC static ivas_error renderMcToSplitBinaural( input_mc *mcInput, const IVAS_REND_AudioConfig outConfig, @@ -7005,7 +6935,6 @@ static ivas_error renderMcToSplitBinaural( return IVAS_ERR_OK; } -#endif static ivas_error renderInputMc( input_mc *mcInput, IVAS_REND_AudioConfig outConfig, @@ -7056,12 +6985,10 @@ static ivas_error renderInputMc( error = renderMcToBinauralRoom( mcInput, outConfig, outAudio ); } break; -#ifdef SPLIT_REND_LC3PLUS_MC case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderMcToSplitBinaural( mcInput, outConfig, outAudio ); break; -#endif default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -8600,12 +8527,8 @@ ivas_error IVAS_REND_GetSamples( /* Use internal buffer if outputting split rendering bitstream */ if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && -#ifdef SPLIT_REND_LC3PLUS_MC ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) -#else - ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) -#endif ) ) { outAudio = hIvasRend->splitRendEncBuffer; @@ -8670,12 +8593,8 @@ ivas_error IVAS_REND_GetSamples( #endif ) /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ -#ifdef SPLIT_REND_LC3PLUS_MC && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) -#else - && hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) -#endif { /* TODO: doesn't work for multiple SBA inputs, needs to be updated like the ISM path for TD */ ivas_split_rend_bits_t bits; -- GitLab From aa2e977386a1591e38af320a99d391780598685e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 16:59:24 +0200 Subject: [PATCH 327/591] [fix] MSVC warnings --- lib_rend/ivas_splitRenderer_utils.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index bff717fa4b..a4afbbbafa 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -656,15 +656,18 @@ void ivas_renderSplitGetMultiBinPoseData( pMultiBinPoseData->relative_head_poses[pos_idx][2] = 0.0f; } + /* 0 DOF defaults */ num_yaw_poses = 0; num_pitch_poses = 0; num_roll_poses = 0; + /* defaults for all DOF except 3DOF HQ */ + relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq; + relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq; + relative_roll_angles = split_rend_relative_roll_pos_angles_hq; + if ( pSplit_rend_config->dof == 1 ) { - relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq; - relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq; - relative_roll_angles = split_rend_relative_roll_pos_angles_hq; switch ( rot_axis ) { case DEFAULT_AXIS: @@ -691,9 +694,6 @@ void ivas_renderSplitGetMultiBinPoseData( } else if ( pSplit_rend_config->dof == 2 ) { - relative_yaw_angles = split_rend_relative_yaw_pos_angles_hq; - relative_pitch_angles = split_rend_relative_pitch_pos_angles_hq; - relative_roll_angles = split_rend_relative_roll_pos_angles_hq; switch ( rot_axis ) { case DEFAULT_AXIS: @@ -745,13 +745,6 @@ void ivas_renderSplitGetMultiBinPoseData( num_roll_poses = 1; } } - else - { - /*0 DOF*/ - num_yaw_poses = 0; - num_pitch_poses = 0; - num_roll_poses = 0; - } pMultiBinPoseData->num_poses = num_yaw_poses + num_pitch_poses + num_roll_poses + 1; assert( pMultiBinPoseData->num_poses <= MAX_HEAD_ROT_POSES ); -- GitLab From d40bf14ea4e7574c6bc8bcec633fed1bcd4fafa4 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 17:05:26 +0200 Subject: [PATCH 328/591] [cleanup] rename alternate output name variation SPLIT_BINAURAL_CLDFB to SPLIT_BINAURAL_CODED --- apps/decoder.c | 16 ++++++++-------- lib_dec/lib_dec.c | 2 +- lib_dec/lib_dec.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 1c7b7d198c..5473327203 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -304,7 +304,7 @@ int main( /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -408,7 +408,7 @@ int main( /* sanity check */ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -427,7 +427,7 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { arg.enableHeadRotation = true; } @@ -581,7 +581,7 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB && + arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); @@ -856,7 +856,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( #ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CODED" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB; + output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED; } else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_PCM" ) == 0 ) { @@ -1561,7 +1561,7 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_CLDFB_ISM if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || - ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) + ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { pFullDelayNumSamples[0] = 0; } @@ -1589,7 +1589,7 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) + if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -2033,7 +2033,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written #ifdef SPLIT_REND_LC3PLUS diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ba321a758e..69a6740000 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -384,7 +384,7 @@ static AUDIO_CONFIG mapOutputFormat( output_config = AUDIO_CONFIG_BINAURAL_ROOM_REVERB; } #ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) + else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 4e884f4536..9edc1a130c 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -56,7 +56,7 @@ typedef enum _IVAS_DEC_OUTPUT_CONFIG IVAS_DEC_OUTPUT_HOA3, IVAS_DEC_OUTPUT_BINAURAL, #ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB, /* ToDo: Also includes LC3plus, should be renamed during harmonization */ + IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED, IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM, #endif IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR, -- GitLab From 0b058fa313a72fa1be546973bf9c26da85fda292 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 17:27:10 +0200 Subject: [PATCH 329/591] [fix] wrap changes in SPLIT_REND_WITH_HEAD_ROT --- lib_rend/ivas_crend.c | 2 + lib_rend/ivas_prot_rend.h | 2 + lib_rend/lib_rend.c | 115 ++++++++++++++++++++++++++++++-------- 3 files changed, 97 insertions(+), 22 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index c50aa7aa6a..88b1c3385f 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1743,6 +1743,7 @@ ivas_error ivas_rend_crendProcessSubframe( } +#ifdef SPLIT_REND_WITH_HEAD_ROT /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crend_ProcessSplitBin() * @@ -1860,3 +1861,4 @@ ivas_error ivas_rend_crendProcessSplitBin( return IVAS_ERR_OK; } +#endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index d79956dc7d..adbd82a0f1 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -637,12 +637,14 @@ ivas_error ivas_rend_crendProcessSubframe( const int32_t output_Fs /* i : output sampling rate */ ); +#ifdef SPLIT_REND_WITH_HEAD_ROT /* TODO tmu : interface cleanup */ ivas_error ivas_rend_crendProcessSplitBin( Decoder_Struct *st_ivas, float output[][L_FRAME48k], const int16_t output_frame ); +#endif /*----------------------------------------------------------------------------------* * Reverberator diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7227783c86..233f1b7fb8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -177,7 +177,9 @@ typedef struct EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; +#ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ +#endif REVERB_HANDLE hReverb; rotation_gains rot_gains_prev; int16_t nonDiegeticPan; @@ -2136,8 +2138,10 @@ static ivas_error updateMcPanGains( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: +#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: +#endif break; /* Do nothing */ case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: @@ -2184,7 +2188,9 @@ static ivas_error initMcBinauralRendering( RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; +#endif int32_t outSampleRate; /* check if re-initialization */ @@ -2194,6 +2200,7 @@ static ivas_error initMcBinauralRendering( inputMc->tdRendWrapper.hHrtfTD = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) @@ -2202,6 +2209,7 @@ static ivas_error initMcBinauralRendering( inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; } } +#endif ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2248,6 +2256,7 @@ static ivas_error initMcBinauralRendering( return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Open TD renderer wrappers */ @@ -2267,6 +2276,7 @@ static ivas_error initMcBinauralRendering( } } +#endif if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) @@ -2397,7 +2407,9 @@ static ivas_error setRendInputActiveMc( const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; +#endif ivas_error error; rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; @@ -2432,13 +2444,19 @@ static ivas_error setRendInputActiveMc( inputMc->hMcMasa = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { inputMc->splitTdRendWrappers[i] = defaultTdRendWrapper(); } +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) +#else + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { @@ -2465,7 +2483,9 @@ static ivas_error setRendInputActiveMc( static void clearInputMc( input_mc *inputMc ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; +#endif rendering_context rendCtx; rendCtx = inputMc->base.ctx; @@ -2501,6 +2521,7 @@ static void clearInputMc( inputMc->tdRendWrapper.hHrtfTD = NULL; } +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) @@ -2509,6 +2530,7 @@ static void clearInputMc( inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; } } +#endif ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); @@ -3696,12 +3718,14 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsMc[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsMc[i].splitTdRendWrappers ) ); ++j ) { hIvasRend->inputsMc[i].splitTdRendWrappers[j].hBinRendererTd = NULL; hIvasRend->inputsMc[i].splitTdRendWrappers[j].hHrtfTD = NULL; } } +#endif for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { @@ -4290,7 +4314,11 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) +#else + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { @@ -4704,7 +4732,7 @@ ivas_error IVAS_REND_FeedInputAudio( if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) #else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -4718,8 +4746,8 @@ ivas_error IVAS_REND_FeedInputAudio( if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #endif { /* Binaural rendering requires specific frame size */ @@ -4752,7 +4780,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; #else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; #endif return IVAS_ERR_OK; @@ -5121,7 +5149,7 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.headRotEnabled = 0; } #else - hIvasRend->headRotData.headRotEnabled = 0; + hIvasRend->headRotData.headRotEnabled = 0; #endif } else @@ -5634,7 +5662,7 @@ static ivas_error rotateFrameSba( #ifdef SBA_CREND_ROT_OPT float *writePtr; #else - float *readPtr, *writePtr; + float *readPtr, *writePtr; #endif rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; @@ -5709,10 +5737,10 @@ static ivas_error rotateFrameSba( /* crossfade with previous rotation gains */ tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val ); #else - readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); - /* crossfade with previous rotation gains */ - tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + - ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); + readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); + /* crossfade with previous rotation gains */ + tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + + ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); #endif } } @@ -6338,16 +6366,24 @@ static ivas_error renderActiveInputsIsm( static ivas_error renderLfeToBinaural( const input_mc *mcInput, +#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_REND_AudioConfig outConfig, +#endif IVAS_REND_AudioBuffer outAudio ) { int16_t i; int16_t lfe_idx; +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pose_idx, num_poses; +#endif float gain; float *readPtr, *writePtr; +#ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); +#else + assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); +#endif push_wmops( "renderLfeToBinaural" ); @@ -6377,6 +6413,7 @@ static ivas_error renderLfeToBinaural( num_poses = 1; } +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pose_idx = 0; pose_idx < num_poses; ++pose_idx ) { readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); @@ -6393,6 +6430,23 @@ static ivas_error renderLfeToBinaural( *writePtr++ += gain * ( *readPtr++ ); } } +#else + /* Copy LFE to left and right ears */ + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + writePtr = getSmplPtr( outAudio, 0, 0 ); + for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + writePtr = getSmplPtr( outAudio, 1, 0 ); + for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + +#endif pop_wmops(); @@ -6491,7 +6545,12 @@ static ivas_error renderMcToBinaural( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) +#else + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) +#endif + { return error; } @@ -6589,7 +6648,12 @@ static ivas_error renderMcToBinauralRoom( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) +#else + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) +#endif + { return error; } @@ -6687,7 +6751,11 @@ static ivas_error renderMcCustomLsToBinauralRoom( accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) +#else + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) +#endif ) { return error; } @@ -6762,6 +6830,7 @@ static ivas_error renderMcToMasa( return IVAS_ERR_OK; } +#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderMcToSplitBinaural( input_mc *mcInput, const IVAS_REND_AudioConfig outConfig, @@ -6934,6 +7003,7 @@ static ivas_error renderMcToSplitBinaural( return IVAS_ERR_OK; } +#endif static ivas_error renderInputMc( input_mc *mcInput, @@ -6985,10 +7055,12 @@ static ivas_error renderInputMc( error = renderMcToBinauralRoom( mcInput, outConfig, outAudio ); } break; +#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderMcToSplitBinaural( mcInput, outConfig, outAudio ); break; +#endif default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -7602,7 +7674,7 @@ renderSbaToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) @@ -7618,7 +7690,7 @@ renderSbaToBinaural( #ifdef FIX_SPLIT_REND_MERGE p_tmpCrendBuffer, #else - tmpCrendBuffer, + tmpCrendBuffer, #endif *sbaInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -7691,7 +7763,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -7830,7 +7902,7 @@ static ivas_error renderInputSba( if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) #else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ @@ -8456,7 +8528,7 @@ ivas_error IVAS_REND_GetSamples( 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 - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8470,8 +8542,8 @@ ivas_error IVAS_REND_GetSamples( if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #endif { /* Binaural rendering requires specific frame size */ @@ -8528,8 +8600,7 @@ ivas_error IVAS_REND_GetSamples( if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || - ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) - ) ) + ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) ) { outAudio = hIvasRend->splitRendEncBuffer; } @@ -8581,9 +8652,9 @@ ivas_error IVAS_REND_GetSamples( #else #ifdef DEBUGGING - hIvasRend->numClipping += + hIvasRend->numClipping += #endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif #ifdef SPLIT_REND_LC3PLUS @@ -8592,7 +8663,7 @@ ivas_error IVAS_REND_GetSamples( || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) - /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ + /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) { -- GitLab From 67280d09b09e2dd6b73be38f6571b663dbd8f9af Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 17:27:49 +0200 Subject: [PATCH 330/591] [ci] disable merge request comparison job until branch is merged --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f3aa9e100..5606885c76 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -527,7 +527,8 @@ split-rendering-smoke-test: - report-junit.xml # compare split-rendering bitexactness between target and source branch -split-rendering-pytest-on-merge-request: +# TODO activate after MR !818 is merged ( https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/merge_requests/818 ) +.split-rendering-pytest-on-merge-request: extends: - .test-job-linux - .rules-merge-request -- GitLab From 7047e27423658533eb7cd3bbe373ea03c9d51860 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 12 Jul 2023 18:17:23 +0200 Subject: [PATCH 331/591] [cleanup] merge SPLIT_REND_LC3PLUS into SPLIT_REND_WITH_HEAD_ROT and remove nested occurences --- apps/decoder.c | 28 ++--- apps/renderer.c | 16 +-- lib_com/common_api_types.h | 8 -- lib_com/ivas_cnst.h | 31 ++--- lib_com/ivas_error.h | 4 +- lib_com/options.h | 2 - lib_dec/ivas_dec.c | 12 +- lib_dec/ivas_init_dec.c | 6 +- lib_dec/ivas_rom_dec.c | 12 +- lib_dec/ivas_sba_dec.c | 2 - lib_dec/lib_dec.c | 31 +---- lib_rend/ivas_objectRenderer.c | 6 +- lib_rend/ivas_prot_rend.h | 24 +--- lib_rend/ivas_render_config.c | 2 - lib_rend/ivas_splitRendererPost.c | 20 +--- lib_rend/ivas_splitRendererPre.c | 56 +-------- lib_rend/ivas_splitRenderer_utils.c | 8 -- lib_rend/ivas_stat_rend.h | 14 +-- lib_rend/lib_rend.c | 144 ++++++------------------ lib_rend/lib_rend.h | 2 +- lib_util/render_config_reader.c | 8 +- lib_util/split_render_file_read_write.c | 34 +++--- lib_util/split_render_file_read_write.h | 38 ++++--- 23 files changed, 116 insertions(+), 392 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 5473327203..a255b4a300 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -79,10 +79,8 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_SPLIT_REND_BITRATE ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/ -#else -#define MAX_SPLIT_REND_BITRATE ( 768000 ) #endif #define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #endif @@ -1640,12 +1638,8 @@ static ivas_error initOnFirstGoodFrame( IVAS_SPLIT_REND_BITS splitRendBitsZero; splitRendBitsZero.bits_written = 0; splitRendBitsZero.bits_read = 0; - if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written -#ifdef SPLIT_REND_LC3PLUS - , - -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE -#endif - ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written, + -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); @@ -2035,12 +2029,8 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { - if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written -#ifdef SPLIT_REND_LC3PLUS - , - splitRendBits.codec, splitRendBits.pose_correction -#endif - ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, + splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); @@ -2052,12 +2042,8 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) { - if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written -#ifdef SPLIT_REND_LC3PLUS - , - splitRendBits.codec, splitRendBits.pose_correction -#endif - ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, + splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); diff --git a/apps/renderer.c b/apps/renderer.c index 77c6c63089..537017b97a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1440,12 +1440,8 @@ int main( { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; - error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten -#ifdef SPLIT_REND_LC3PLUS - , - &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection -#endif - ); + error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, + &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection ); if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) @@ -1773,12 +1769,8 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && is_split_pre_rend_mode( &args ) ) { - if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten -#ifdef SPLIT_REND_LC3PLUS - , - bitsBuffer.config.codec, bitsBuffer.config.poseCorrection -#endif - ) != IVAS_ERR_OK ) + if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, + bitsBuffer.config.codec, bitsBuffer.config.poseCorrection ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 3c1897331e..461088bea5 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -103,15 +103,12 @@ typedef enum #endif #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_LC3PLUS typedef enum { IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB, } IVAS_SPLIT_REND_POSE_CORRECTION_MODE; -#endif -#ifdef SPLIT_REND_LC3PLUS typedef enum { IVAS_SPLIT_REND_CODEC_LCLD, @@ -119,7 +116,6 @@ typedef enum IVAS_SPLIT_REND_CODEC_DEFAULT, /* Will use LCLD for CLDFB rendering paths and LC3plus for TD rendering paths */ IVAS_SPLIT_REND_CODEC_NONE } IVAS_SPLIT_REND_CODEC; -#endif typedef struct ivas_split_rend_bits_t { @@ -127,10 +123,8 @@ typedef struct ivas_split_rend_bits_t int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ int32_t bits_written; int32_t bits_read; -#ifdef SPLIT_REND_LC3PLUS IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; -#endif } ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS, *IVAS_SPLIT_REND_BITS_HANDLE; #endif typedef struct @@ -199,10 +193,8 @@ typedef struct _IVAS_SPLIT_REND_CONFIG 3 - (3dof correction. By default YAW, PITCH and ROLL correction) */ int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ -#ifdef SPLIT_REND_LC3PLUS IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; IVAS_SPLIT_REND_CODEC codec; -#endif } IVAS_SPLIT_REND_CONFIG_DATA; #endif diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 8531a09156..0602576352 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1528,23 +1528,13 @@ typedef enum #define SPLIT_REND_MAX_ONE_AXIS_MD_POSES (2) #define MAX_EXTRAPOLATION_ANGLE (15.0f) /* this means additional 15 degrees can be extrapolated on top of MD probing poses*/ -#ifdef SPLIT_REND_LC3PLUS #define SPLIT_REND_MAX_DOF (3) -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_LC3PLUS #define MAX_HEAD_ROT_POSES (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) /* TODO tmu : revisit for harmonization */ -#else -#define MAX_HEAD_ROT_POSES (1 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) -#endif -#else -#define MAX_HEAD_ROT_POSES (1 + SPLIT_REND_MAX_YAW_ONLY_POSES) -#endif -#define MAX_SPLIT_REND_MD_BANDS (20) -#define MAX_SPLIT_MD_SUBFRAMES (1) -#define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS) -#define COMPLEX_MD_BAND_THRESH_LOW (5) +#define MAX_SPLIT_REND_MD_BANDS (20) +#define MAX_SPLIT_MD_SUBFRAMES (1) +#define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS) +#define COMPLEX_MD_BAND_THRESH_LOW (5) #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) @@ -1558,14 +1548,10 @@ typedef enum #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT #define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f) #define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f) #define IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS ( IVAS_SPLIT_REND_D_QUANT_PNTS ) #define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f ) -#else -#define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f ) -#endif #define IVAS_SPLIT_REND_D_MAX_VAL ( 1.0f ) #define IVAS_SPLIT_REND_PRED_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )) @@ -1580,7 +1566,7 @@ typedef enum #define IVAS_SPLIT_REND_DOF_BITS (2) #define IVAS_SPLIT_REND_HQ_MODE_BITS (1) #define IVAS_SPLIT_REND_ROT_AXIS_BITS (3) -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ #define HRTF_SH_ORDER 3 #define HRTF_SH_CHANNELS 16 @@ -1806,17 +1792,13 @@ typedef enum #define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS ) #define CLDFB_PAR_WEIGHT_START_BAND 7 +#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * Split rendering bitrate constants *----------------------------------------------------------------------------------*/ -#ifndef SPLIT_REND_LC3PLUS -#define SIZE_SPLIT_REND_BRATE_TBL (4) -#endif #define SPLIT_REND_256k 256000 -#ifdef SPLIT_REND_LC3PLUS #define SPLIT_REND_320k 320000 -#endif #define SPLIT_REND_384k 384000 #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 @@ -1830,6 +1812,7 @@ typedef enum #define QUANT_STRAT_2 2 +#endif /*----------------------------------------------------------------------------------* * Limiter constants *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 49e907fe3d..e04b404680 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -135,7 +135,7 @@ typedef enum IVAS_ERR_INVALID_INPUT_ID, IVAS_ERR_WRONG_NUM_CHANNELS, IVAS_ERR_INVALID_BUFFER_SIZE, -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_ERR_LC3PLUS_INVALID_BITRATE, IVAS_ERR_INVALID_SPLIT_REND_CONFIG, #endif @@ -237,7 +237,7 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Wrong mode"; case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED: return "Head rotation not supported"; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_ERR_LC3PLUS_INVALID_BITRATE: return "Specified split rendering bit rate is not supported"; case IVAS_ERR_INVALID_SPLIT_REND_CONFIG: diff --git a/lib_com/options.h b/lib_com/options.h index 0276028f1e..f5b0eef4f6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -213,8 +213,6 @@ #define SPLIT_REND_CLANG_SAN_FIX #define SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_STACK_OPT - -#define SPLIT_REND_LC3PLUS /* FhG: split rendering using LC3plus codec */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4d7ae71f5a..b2dcc4109a 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -123,14 +123,10 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { -#ifdef SPLIT_REND_LC3PLUS assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); -#else - assert( st_ivas->ivas_format == SBA_FORMAT && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA format and 48k sampling rate only" ); -#endif ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits ); } #endif @@ -273,7 +269,7 @@ ivas_error ivas_dec( /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_CLDFB_ISM if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) @@ -290,7 +286,7 @@ ivas_error ivas_dec( { return error; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT } #endif } @@ -790,16 +786,12 @@ ivas_error ivas_dec( ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, -#ifdef SPLIT_REND_LC3PLUS st_ivas->hRenderConfig->split_rend_config.codec, -#endif hSplitBinRend->hSplitRendBits, hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, max_band, output, 1, -#ifdef SPLIT_REND_LC3PLUS st_ivas->ivas_format != SBA_FORMAT, -#endif pcm_out ); free( st_ivas->splitBinRend.hMultiBinCldfbData ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d52480ef1f..2e8b993917 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1273,10 +1273,8 @@ ivas_error ivas_init_decoder( if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { -#ifdef SPLIT_REND_LC3PLUS ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 0, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); -#endif error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, @@ -1321,7 +1319,7 @@ ivas_error ivas_init_decoder( } } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_CLDFB_ISM if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) @@ -1394,7 +1392,7 @@ ivas_error ivas_init_decoder( { int16_t pcm_out; pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, pcm_out ); #endif diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 5a12186cff..5ca2f3fe0f 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -546,16 +546,6 @@ const float dmxmtx_table[BINAURAL_CHANNELS][11] = * split rendering ROM tables *-----------------------------------------------------------------------*/ -#ifndef SPLIT_REND_LC3PLUS /* Functionality moved to ivas_split_rend_validate_config() */ -/*----------------------------------------------------------------------------------* - * Table of Split rendering bitrates - *----------------------------------------------------------------------------------*/ -const int32_t split_rend_brate_tbl[SIZE_SPLIT_REND_BRATE_TBL] = -{ - SPLIT_REND_256k, SPLIT_REND_384k, SPLIT_REND_512k, SPLIT_REND_768k -}; -#endif - /*rotations in this array are relative to ref rotation */ const float split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f}; const float split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f}; @@ -614,7 +604,7 @@ const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][ {10,7,124},{11,8,252},{12,9,508},{13,9,509}, {14,10,1022},{15,10,1023}, }; -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* clang-format on */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index e3d0f1b675..a0577a4c4d 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -268,9 +268,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { -#ifdef SPLIT_REND_LC3PLUS assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LCLD ); -#endif error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 69a6740000..82686a2af3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -220,30 +220,6 @@ ivas_error IVAS_DEC_Open( return IVAS_ERR_WRONG_PARAMS; } -#ifndef SPLIT_REND_LC3PLUS /* Functionality moved to ivas_split_rend_validate_config() */ -#ifdef SPLIT_REND_WITH_HEAD_ROT -/*-------------------------------------------------------------------* - * is_SplitRend_BitRate() - * - * check if the bitrate is SPLIT REND supported active bitrate - *-------------------------------------------------------------------*/ -static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) -{ - int16_t j; - - j = 0; - while ( j < SIZE_SPLIT_REND_BRATE_TBL && splitRendBitRate != split_rend_brate_tbl[j] ) - { - j++; - } - if ( j >= SIZE_SPLIT_REND_BRATE_TBL ) - { - return 0; - } - return 1; -} -#endif -#endif /*---------------------------------------------------------------------* * init_decoder_config() @@ -1530,8 +1506,6 @@ ivas_error IVAS_DEC_GetRenderConfig( hRCout->split_rend_config.dof = 3; hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; -#endif -#ifdef SPLIT_REND_LC3PLUS hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; #endif @@ -1552,7 +1526,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; #endif @@ -1584,8 +1558,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( #ifdef SPLIT_REND_WITH_HEAD_ROT hRenderConfig->split_rend_config = renderConfig.split_rend_config; -#endif -#ifdef SPLIT_REND_LC3PLUS + /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ if ( hRenderConfig->split_rend_config.dof == 0 ) { diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 772def7ed3..46a2613604 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -36,7 +36,7 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_prot.h" #endif #include @@ -705,7 +705,7 @@ ivas_error ivas_td_binaural_renderer_ext( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* * ObjRenderIvasFrame_splitBinaural() * @@ -837,7 +837,7 @@ void ObjRenderIvasFrame_splitBinaural( pop_wmops(); } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /*---------------------------------------------------------------------* diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index adbd82a0f1..47310907eb 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -229,7 +229,7 @@ void ivas_HRTF_CRend_binary_close( * TD object renderer *----------------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT /* TODO(sgi): Rework interface */ void ObjRenderIvasFrame_splitBinaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -551,13 +551,12 @@ ivas_error ivas_rend_openCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], const IVAS_REND_AudioConfig inConfig, const int32_t output_Fs ); + ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, -#ifdef SPLIT_REND_WITH_HEAD_ROT MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#endif const int32_t output_Fs ); void ivas_mat_mult_2by2_complex( float in_re1[2][2], @@ -588,12 +587,10 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out ); -#ifdef SPLIT_REND_LC3PLUS int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); int8_t ivas_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ); int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int16_t is_pcm_out ); -#endif void ivas_split_rend_get_quant_params( const int16_t num_md_bands, int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], @@ -604,7 +601,7 @@ void ivas_split_rend_get_quant_params( int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t *num_quant_strats, int16_t *num_complex_bands ); -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, @@ -1142,9 +1139,6 @@ ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs -#ifndef SPLIT_REND_LC3PLUS - ,const int16_t is_cldfb_in -#endif ); @@ -1155,28 +1149,22 @@ void ivas_renderSplitGetMultiBinPoseData( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const IVAS_SPLIT_REND_ROT_AXIS rot_axis); -#ifdef SPLIT_REND_LC3PLUS void ivas_renderSplitUpdateNoCorrectionPoseData( const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); -#endif ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], const int32_t SplitRendBitRate, -#ifdef SPLIT_REND_LC3PLUS IVAS_SPLIT_REND_CODEC splitCodec, -#endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, -#ifdef SPLIT_REND_LC3PLUS int16_t td_input, -#endif const int16_t pcm_out ); @@ -1238,7 +1226,7 @@ void ivas_splitBinRendPLC( float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t num_chs ); -#endif +#endif /* SPLIT_REND_PLC */ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG void ivas_log_cldfb2wav_data( @@ -1267,7 +1255,7 @@ void ivas_SplitRenderer_PostRenderer( float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES]); -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /*----------------------------------------------------------------------------------* * Rendering & merging to MASA format *----------------------------------------------------------------------------------*/ @@ -1376,7 +1364,7 @@ void masaPrerendClose( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ); -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */ diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 28e6935120..e3fcb382f6 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -130,8 +130,6 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->split_rend_config.dof = 3; ( *hRenderConfig )->split_rend_config.hq_mode = 0; ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; -#endif -#ifdef SPLIT_REND_LC3PLUS ( *hRenderConfig )->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; ( *hRenderConfig )->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; #endif diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 78ad146699..3910cbcf2a 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -55,12 +55,7 @@ ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const int32_t output_Fs -#ifndef SPLIT_REND_LC3PLUS - , - const int16_t is_cldfb_in -#endif -) + const int32_t output_Fs ) { BIN_HR_SPLIT_POST_REND_HANDLE hBinRend; ivas_error error; @@ -94,17 +89,10 @@ ivas_error ivas_splitBinPostRendOpen( { return error; } -#ifndef SPLIT_REND_LC3PLUS - if ( is_cldfb_in == 0 ) + if ( ( error = openCldfb( &( hBinRend->cldfbAna[ch] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { -#endif - if ( ( error = openCldfb( &( hBinRend->cldfbAna[ch] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifndef SPLIT_REND_LC3PLUS + return error; } -#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1857,9 +1845,7 @@ void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapp { hSplitRendWrapper->hBinHrSplitPostRend = NULL; hSplitRendWrapper->hSplitBinLCLDDec = NULL; -#ifdef SPLIT_REND_LC3PLUS hSplitRendWrapper->hLc3plusDec = NULL; -#endif ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); #ifdef SPLIT_REND_PLC hSplitRendWrapper->first_good_frame_received = 0; diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 5d5a3e856c..40f0eec054 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -46,9 +46,7 @@ #include "ivas_rom_binauralRenderer.h" #include "lib_rend.h" #include "ivas_prot_rend.h" -#ifdef SPLIT_REND_LC3PLUS #include "ivas_lc3plus_enc.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -1670,14 +1668,11 @@ void ivas_splitBinPreRendClose( BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ) { -#ifdef SPLIT_REND_LC3PLUS int32_t i; -#endif hSplitRendWrapper->hBinHrSplitPreRend = NULL; hSplitRendWrapper->hCldfbHandles = NULL; hSplitRendWrapper->hSplitBinLCLDEnc = NULL; -#ifdef SPLIT_REND_LC3PLUS hSplitRendWrapper->hLc3plusEnc = NULL; for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { @@ -1688,13 +1683,11 @@ void ivas_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ) hSplitRendWrapper->lc3plusDelayBuffers[i] = NULL; } hSplitRendWrapper->lc3plusDelaySamples = 0; -#endif ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); return; } -#ifdef SPLIT_REND_LC3PLUS static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate ) @@ -1748,7 +1741,6 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra return IVAS_ERR_OK; } -#endif ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, @@ -1757,7 +1749,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const int16_t is_pcm_out ) { ivas_error error, ch, num_ch; -#ifdef SPLIT_REND_LC3PLUS CLDFB_TYPE cldfbMode; uint8_t useLc3plus; uint8_t isCldfbNeeded = 0; @@ -1769,10 +1760,8 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, } useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ -#endif error = IVAS_ERR_OK; -#ifdef SPLIT_REND_LC3PLUS if ( is_cldfb_in == 0 ) { @@ -1784,15 +1773,10 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, isCldfbNeeded = 1; cldfbMode = CLDFB_SYNTHESIS; } -#endif hSplitRendWrapper->hCldfbHandles = NULL; if ( -#ifdef SPLIT_REND_LC3PLUS isCldfbNeeded ) -#else - is_cldfb_in == 0 ) -#endif { if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) { @@ -1816,11 +1800,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, for ( ch = 0; ch < num_ch; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), -#ifdef SPLIT_REND_LC3PLUS cldfbMode, -#else - CLDFB_ANALYSIS, -#endif OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; @@ -1845,16 +1825,13 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, if ( is_pcm_out == 0 ) { -#ifdef SPLIT_REND_LC3PLUS if ( !useLc3plus ) { -#endif error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ); if ( error != IVAS_ERR_OK ) { return error; } -#ifdef SPLIT_REND_LC3PLUS } else { @@ -1864,7 +1841,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, return error; } } -#endif } return error; } @@ -1902,7 +1878,6 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) hSplitBinRend->hCldfbHandles = NULL; } -#ifdef SPLIT_REND_LC3PLUS if ( hSplitBinRend->hLc3plusEnc != NULL ) { IVAS_LC3PLUS_ENC_Close( &hSplitBinRend->hLc3plusEnc ); @@ -1925,12 +1900,10 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) ivas_td_binaural_close( &hSplitBinRend->hTdRendHandles[i] ); } } -#endif return; } -#ifdef SPLIT_REND_LC3PLUS static ivas_error splitRendLc3plusEncodeAndWrite( SPLIT_REND_WRAPPER *hSplitBin, ivas_split_rend_bits_t *pBits, @@ -1971,7 +1944,6 @@ static ivas_error splitRendLc3plusEncodeAndWrite( pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; return IVAS_ERR_OK; } -#endif static ivas_error ivas_renderMultiTDBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, @@ -2118,7 +2090,6 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( return error; } -#ifdef SPLIT_REND_LC3PLUS static void lc3plusTimeAlignCldfbPoseCorr( SPLIT_REND_WRAPPER *hSplitBin, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -2171,24 +2142,19 @@ static void lc3plusTimeAlignCldfbPoseCorr( } } } -#endif ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], const int32_t SplitRendBitRate, -#ifdef SPLIT_REND_LC3PLUS IVAS_SPLIT_REND_CODEC splitCodec, -#endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, -#ifdef SPLIT_REND_LC3PLUS int16_t td_input, -#endif const int16_t pcm_out ) { ivas_error error; @@ -2203,17 +2169,10 @@ ivas_error ivas_renderMultiBinToSplitBinaural( set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); } -#ifdef SPLIT_REND_LC3PLUS ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out ); -#endif if ( -#ifdef SPLIT_REND_LC3PLUS - td_input -#else - hSplitBin->hCldfbHandles != NULL -#endif - ) + td_input ) { /*TD input*/ /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ @@ -2223,7 +2182,6 @@ ivas_error ivas_renderMultiBinToSplitBinaural( return error; } -#ifdef SPLIT_REND_LC3PLUS if ( splitCodec == IVAS_SPLIT_REND_CODEC_LC3PLUS && hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { /* Time-align pose correction to delay of LC3plus */ @@ -2233,7 +2191,6 @@ ivas_error ivas_renderMultiBinToSplitBinaural( actual_md_bits = pBits->bits_written; if ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#endif target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out ) * L_FRAME48k / 48000; actual_md_bits = pBits->bits_written; ivas_rend_CldfbSplitPreRendProcess( @@ -2245,19 +2202,15 @@ ivas_error ivas_renderMultiBinToSplitBinaural( pBits, target_md_bits, low_res_pre_rend_rot ); -#ifdef SPLIT_REND_LC3PLUS } -#endif if ( pcm_out == 0 ) { -#ifdef SPLIT_REND_LC3PLUS pBits->codec = splitCodec; pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; if ( splitCodec == IVAS_SPLIT_REND_CODEC_LCLD ) { -#endif // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; available_bits = SplitRendBitRate * L_FRAME48k / 48000; actual_md_bits = pBits->bits_written - actual_md_bits; @@ -2268,8 +2221,6 @@ ivas_error ivas_renderMultiBinToSplitBinaural( Cldfb_In_BinImag[0], available_bits, pBits ); - -#ifdef SPLIT_REND_LC3PLUS } else { @@ -2293,15 +2244,12 @@ ivas_error ivas_renderMultiBinToSplitBinaural( return error; } } -#endif } -#ifdef SPLIT_REND_LC3PLUS else { pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; pBits->codec = IVAS_SPLIT_REND_CODEC_NONE; } -#endif /*zero pad*/ /*TODO: do this inside the LCLD ENC codec */ @@ -2316,4 +2264,4 @@ ivas_error ivas_renderMultiBinToSplitBinaural( return error; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index a4afbbbafa..bafa2cc0c5 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -436,7 +436,6 @@ int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_ return -1; } -#ifdef SPLIT_REND_LC3PLUS int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ) { if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) @@ -591,7 +590,6 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p return IVAS_ERR_OK; } -#endif void ivas_split_rend_get_quant_params( const int16_t num_md_bands, @@ -764,14 +762,11 @@ void ivas_renderSplitGetMultiBinPoseData( pMultiBinPoseData->dof = pSplit_rend_config->dof; pMultiBinPoseData->hq_mode = pSplit_rend_config->hq_mode; pMultiBinPoseData->rot_axis = rot_axis; -#ifdef SPLIT_REND_LC3PLUS pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode; -#endif return; } -#ifdef SPLIT_REND_LC3PLUS void ivas_renderSplitUpdateNoCorrectionPoseData( const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) @@ -782,7 +777,6 @@ void ivas_renderSplitUpdateNoCorrectionPoseData( assert( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ); pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode; } -#endif void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ) { @@ -801,10 +795,8 @@ void ivas_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData return; } -#endif -#ifdef SPLIT_REND_LC3PLUS void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, int16_t isRenderingInTd, int16_t pcm_out ) { if ( pcm_out == 0 ) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f9b540b5db..cb310c02c8 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -43,8 +43,6 @@ #include "stat_com.h" #include "ivas_CQMFEncoder.h" #include "ivas_CQMFDecoder.h" -#endif -#ifdef SPLIT_REND_LC3PLUS #include "ivas_lc3plus_enc.h" #include "ivas_lc3plus_dec.h" #endif @@ -309,7 +307,6 @@ typedef struct #endif } CLDFB_HANDLES_WRAPPER, *CLDFB_HANDLES_WRAPPER_HANDLE; -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct { int16_t num_poses; @@ -317,19 +314,14 @@ typedef struct int16_t dof; int16_t hq_mode; IVAS_SPLIT_REND_ROT_AXIS rot_axis; -#ifdef SPLIT_REND_LC3PLUS IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; -#endif } MULTI_BIN_REND_POSE_DATA; -#endif -#ifdef SPLIT_REND_LC3PLUS /* Forward declaration of TD_OBJECT_RENDERER_HANDLE. This avoids shifting the entire definition of TD Renderer structs above this line, which could cause merge conflicts. Can be cleaned up later. */ typedef struct ivas_binaural_td_rendering_struct *TD_OBJECT_RENDERER_HANDLE; -#endif typedef struct { @@ -337,12 +329,10 @@ typedef struct BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend; BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc; CLDFB_HANDLES_WRAPPER_HANDLE hCldfbHandles; -#ifdef SPLIT_REND_LC3PLUS IVAS_LC3PLUS_ENC_HANDLE hLc3plusEnc; TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1]; float *lc3plusDelayBuffers[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /* Used to time-align head pose correction metadata with LC3plus-coded reference audio */ int32_t lc3plusDelaySamples; -#endif } SPLIT_REND_WRAPPER; typedef struct @@ -353,11 +343,9 @@ typedef struct #ifdef SPLIT_REND_PLC int16_t first_good_frame_received; #endif -#ifdef SPLIT_REND_LC3PLUS IVAS_LC3PLUS_DEC_HANDLE hLc3plusDec; -#endif } SPLIT_POST_REND_WRAPPER; -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /*----------------------------------------------------------------------------------* * EFAP structures diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 233f1b7fb8..169488e38d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -108,7 +108,7 @@ typedef struct #ifdef SPLIT_REND_PLC const int16_t *pSplitRendBFI; #endif -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT const SPLIT_REND_WRAPPER *pSplitRendWrapper; #endif @@ -143,7 +143,7 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ #endif #ifdef REND_STATIC_MEM_OPT @@ -262,7 +262,7 @@ struct IVAS_REND IVAS_REND_AudioConfig outputConfig; EFAP_WRAPPER efapOutWrapper; IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT SPLIT_REND_WRAPPER splitRendWrapper; IVAS_REND_AudioBuffer splitRendEncBuffer; #endif @@ -335,10 +335,8 @@ static void convertBitsBufferToInternalBitsBuff( hBits->bits_read = outBits.config.bitsRead; hBits->bits_written = outBits.config.bitsWritten; hBits->buf_len = outBits.config.bufLenInBytes; -#ifdef SPLIT_REND_LC3PLUS hBits->codec = outBits.config.codec; hBits->pose_correction = outBits.config.poseCorrection; -#endif return; } @@ -351,14 +349,12 @@ static void convertInternalBitsBuffToBitsBuffer( hOutBits->config.bitsRead = bits.bits_read; hOutBits->config.bitsWritten = bits.bits_written; hOutBits->config.bufLenInBytes = bits.buf_len; -#ifdef SPLIT_REND_LC3PLUS hOutBits->config.codec = bits.codec; hOutBits->config.poseCorrection = bits.pose_correction; -#endif return; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef SPLIT_REND_WITH_HEAD_ROT static void copyBufferToCLDFBarray( @@ -1291,7 +1287,7 @@ static rendering_context getRendCtx( #ifdef SPLIT_REND_PLC ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; #endif -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT ctx.pSplitRendWrapper = &hIvasRend->splitRendWrapper; #endif ctx.pCombinedOrientationData = &hIvasRend->hCombinedOrientationData; @@ -1383,7 +1379,7 @@ static ivas_error setRendInputActiveIsm( rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; input_ism *inputIsm; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; #endif @@ -1415,7 +1411,7 @@ static ivas_error setRendInputActiveIsm( inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) { inputIsm->splitTdRendWrappers[i] = defaultTdRendWrapper(); @@ -1426,7 +1422,7 @@ static ivas_error setRendInputActiveIsm( error = IVAS_ERR_OK; if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) @@ -1507,7 +1503,7 @@ static void clearInputIsm( input_ism *inputIsm ) { rendering_context rendCtx; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; #endif @@ -1539,7 +1535,7 @@ static void clearInputIsm( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); inputIsm->tdRendWrapper.hHrtfTD = NULL; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) { ivas_td_binaural_close( &inputIsm->splitTdRendWrappers[i].hBinRendererTd ); @@ -2645,26 +2641,11 @@ updateSplitPostRendPanGains( error = ivas_splitBinPostRendOpen( &inputSplitPostRend->splitPostRendWrapper.hBinHrSplitPostRend, &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, - *rendCtx.pOutSampleRate -#ifndef SPLIT_REND_LC3PLUS - , - ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ? 1 : 0 -#endif - ); + *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; } -#ifndef SPLIT_REND_LC3PLUS - if ( inputSplitPostRend->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) - { - error = ivas_splitBinLCLDDecOpen( &inputSplitPostRend->splitPostRendWrapper.hSplitBinLCLDDec, *rendCtx.pOutSampleRate, numOutChannels ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - } -#endif return IVAS_ERR_OK; } @@ -2957,17 +2938,15 @@ static void clearInputSplitRend( { ivas_splitBinLCLDDecClose( &inputSplitRend->splitPostRendWrapper.hSplitBinLCLDDec ); } -#ifdef SPLIT_REND_LC3PLUS if ( inputSplitRend->splitPostRendWrapper.hLc3plusDec != NULL ) { IVAS_LC3PLUS_DEC_Close( &inputSplitRend->splitPostRendWrapper.hLc3plusDec ); } -#endif return; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ static void clearInputSba( input_sba *inputSba ) { @@ -3529,7 +3508,7 @@ static void clearInputMasa( return; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_REND_AudioConfig outConfig ) { ivas_error error; @@ -3587,7 +3566,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN return IVAS_ERR_OK; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, @@ -3597,7 +3576,7 @@ ivas_error IVAS_REND_Open( const float nonDiegeticPanGain ) { int16_t i; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t j; #endif IVAS_REND_HANDLE hIvasRend; @@ -3684,7 +3663,7 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsIsm[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsIsm[i].splitTdRendWrappers ) ); ++j ) { hIvasRend->inputsIsm[i].splitTdRendWrappers[j].hBinRendererTd = NULL; @@ -4156,7 +4135,7 @@ static ivas_error findFreeInputSlot( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer ) { ivas_split_renderer_close( pSplitRendWrapper ); @@ -4201,7 +4180,7 @@ ivas_error IVAS_REND_AddInput( inputsArray = hIvasRend->inputsIsm; inputStructSize = sizeof( *hIvasRend->inputsIsm ); activateInput = setRendInputActiveIsm; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { /* Hack to override default split rendering codec from Dolby CLDFB to LC3plus. @@ -4667,7 +4646,6 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSplitPost[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef SPLIT_REND_LC3PLUS latency_ns = 0; if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec != NULL ) { @@ -4675,15 +4653,10 @@ ivas_error IVAS_REND_GetDelay( IVAS_LC3PLUS_DEC_GetDelay( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec, &lc3plusDelaySamples ); latency_ns = (int32_t) roundf( lc3plusDelaySamples * 1000000000.f / *timeScale ); } -#endif -#ifdef SPLIT_REND_LC3PLUS if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#endif latency_ns += IVAS_FB_DEC_DELAY_NS; -#ifdef SPLIT_REND_LC3PLUS } -#endif max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -4936,7 +4909,7 @@ ivas_error IVAS_REND_InitConfig( hIvasRend->hRendererConfig = NULL; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT /* ToDo: The entire contents of this function should be part of IVAS_REND_Open - otherwise renderer handle is partly uninitialized after opening */ /* Initialize split rendering */ if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) @@ -4948,25 +4921,6 @@ ivas_error IVAS_REND_InitConfig( return IVAS_ERR_OK; } -#ifndef SPLIT_REND_LC3PLUS /* Functionality moved to ivas_split_rend_validate_config() */ -#ifdef SPLIT_REND_WITH_HEAD_ROT -static int16_t is_SplitRend_BitRate( const int32_t splitRendBitRate ) -{ - int16_t j; - - j = 0; - while ( j < SIZE_SPLIT_REND_BRATE_TBL && splitRendBitRate != split_rend_brate_tbl[j] ) - { - j++; - } - if ( j >= SIZE_SPLIT_REND_BRATE_TBL ) - { - return 0; - } - return 1; -} -#endif -#endif /*-------------------------------------------------------------------* * IVAS_REND_GetRenderConfig() @@ -5016,8 +4970,6 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.dof = 3; hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; -#endif -#ifdef SPLIT_REND_LC3PLUS hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; #endif @@ -5038,7 +4990,7 @@ int16_t IVAS_REND_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; #endif @@ -5071,8 +5023,6 @@ int16_t IVAS_REND_FeedRenderConfig( #ifdef SPLIT_REND_WITH_HEAD_ROT hRenderConfig->split_rend_config = renderConfig.split_rend_config; -#endif -#ifdef SPLIT_REND_LC3PLUS /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ if ( hRenderConfig->split_rend_config.dof == 0 ) { @@ -6112,7 +6062,7 @@ static ivas_error renderIsmToSba( return error; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderIsmToSplitBinaural( input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) @@ -6252,7 +6202,7 @@ static ivas_error renderIsmToSplitBinaural( return IVAS_ERR_OK; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* Encoding to split rendering bitstream done at a higher level */ static ivas_error renderIsmToMasa( input_ism *ismInput, @@ -6309,7 +6259,7 @@ static ivas_error renderInputIsm( error = renderIsmToBinauralRoom( ismInput, outAudio ); break; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderIsmToSplitBinaural( ismInput, outAudio ); @@ -6755,7 +6705,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif ) +#endif { return error; } @@ -7142,7 +7092,7 @@ static void renderSbaToSba( return; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error splitBinLc3plusDecode( SPLIT_POST_REND_WRAPPER *hSplitBin, ivas_split_rend_bits_t *bits, @@ -7182,7 +7132,7 @@ static ivas_error splitBinLc3plusDecode( return IVAS_ERR_OK; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSplitBinauralWithPostRot( @@ -7204,11 +7154,9 @@ static ivas_error renderSplitBinauralWithPostRot( float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; COMBINED_ORIENTATION_HANDLE pCombinedOrientationData; SPLIT_POST_REND_WRAPPER *hSplitBin; -#ifdef SPLIT_REND_LC3PLUS int8_t isPostRendInputCldfb; isPostRendInputCldfb = 0; -#endif /* SPLIT_REND_LC3PLUS */ push_wmops( "renderSplitBinauralWithPostRot" ); @@ -7218,7 +7166,6 @@ static ivas_error renderSplitBinauralWithPostRot( hSplitBin = &splitBinInput->splitPostRendWrapper; convertBitsBufferToInternalBitsBuff( *hBits, &bits ); -#ifdef SPLIT_REND_LC3PLUS if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD && splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec == NULL ) { error = ivas_splitBinLCLDDecOpen( &splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec, *splitBinInput->base.ctx.pOutSampleRate, BINAURAL_CHANNELS ); @@ -7241,7 +7188,6 @@ static ivas_error renderSplitBinauralWithPostRot( #endif &splitBinInput->splitPostRendWrapper.hLc3plusDec ); } -#endif /* SPLIT_REND_LC3PLUS */ for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { @@ -7277,16 +7223,12 @@ static ivas_error renderSplitBinauralWithPostRot( } } /*copy pose correction after MD is parsed*/ -#ifdef SPLIT_REND_LC3PLUS hSplitBin->multiBinPoseData.poseCorrectionMode = bits.pose_correction; -#endif if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { -#ifdef SPLIT_REND_LC3PLUS if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) { -#endif /* SPLIT_REND_LC3PLUS */ ivas_splitBinLCLDDecProcess( hSplitBin->hSplitBinLCLDDec, &bits, @@ -7297,7 +7239,6 @@ static ivas_error renderSplitBinauralWithPostRot( SplitRendBFI #endif /* SPLIT_REND_PLC */ ); -#ifdef SPLIT_REND_LC3PLUS isPostRendInputCldfb = 1; } else @@ -7308,17 +7249,14 @@ static ivas_error renderSplitBinauralWithPostRot( return error; } } -#endif } else { copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); } -#ifdef SPLIT_REND_LC3PLUS if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#endif /* SPLIT_REND_LC3PLUS */ ivas_rend_CldfbSplitPostRendProcess( hSplitBin->hBinHrSplitPostRend, &hSplitBin->multiBinPoseData, @@ -7326,12 +7264,8 @@ static ivas_error renderSplitBinauralWithPostRot( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, tmpCrendBuffer, -#ifdef SPLIT_REND_LC3PLUS isPostRendInputCldfb ); } -#else /* SPLIT_REND_LC3PLUS */ - ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ? 1 : 0 ); -#endif /* SPLIT_REND_LC3PLUS */ #ifdef SPLIT_REND_PLC } @@ -7362,7 +7296,6 @@ static ivas_error renderSplitBinauralWithPostRot( #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, @@ -7475,7 +7408,6 @@ static ivas_error renderSbaToMultiBinaural( return IVAS_ERR_OK; } -#endif #ifdef SPLIT_REND_STACK_OPT static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, @@ -7503,9 +7435,7 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_REND_AudioConfig outConfig, -#endif IVAS_REND_AudioBuffer outAudio, IVAS_REND_BitstreamBuffer *hBits ) { @@ -7520,9 +7450,7 @@ static ivas_error renderSbaToSplitBinaural( #endif ivas_split_rend_bits_t bits; int16_t low_res_pre_rend_rot, max_band; -#ifdef SPLIT_REND_LC3PLUS int16_t td_input; -#endif low_res_pre_rend_rot = 1; //( *sbaInput->base.ctx.pSplitRendBitRate == SPLIT_REND_768k ) ? 0 : 1; @@ -7561,9 +7489,7 @@ static ivas_error renderSbaToSplitBinaural( low_res_pre_rend_rot ); #endif max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; -#ifdef SPLIT_REND_LC3PLUS td_input = 0; -#endif } else #endif @@ -7577,9 +7503,7 @@ static ivas_error renderSbaToSplitBinaural( { accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); } -#ifdef SPLIT_REND_LC3PLUS td_input = 1; -#endif } /*SPLIT pre rendering MD and CLDFB coding*/ @@ -7588,18 +7512,14 @@ static ivas_error renderSbaToSplitBinaural( ivas_renderMultiBinToSplitBinaural( &sbaInput->splitRendWrapper, sbaInput->base.ctx.pHeadRotData->headPositions, sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.splitRendBitRate, -#ifdef SPLIT_REND_LC3PLUS sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.codec, -#endif &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, max_band, tmpCrendBuffer, low_res_pre_rend_rot, -#ifdef SPLIT_REND_LC3PLUS td_input, -#endif ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); convertInternalBitsBuffToBitsBuffer( hBits, bits ); @@ -7608,7 +7528,7 @@ static ivas_error renderSbaToSplitBinaural( return error; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ static ivas_error renderSbaToBinaural( @@ -7898,7 +7818,7 @@ static ivas_error renderInputSba( inAudio = sbaInput->base.inputBuffer; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) #else @@ -8591,7 +8511,7 @@ ivas_error IVAS_REND_GetSamples( return IVAS_ERR_WRONG_NUM_CHANNELS; } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT /* Clear original output buffer */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); @@ -8657,7 +8577,7 @@ ivas_error IVAS_REND_GetSamples( limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED #ifdef SPLIT_REND_CLDFB_ISM || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM @@ -8702,7 +8622,7 @@ ivas_error IVAS_REND_GetSamples( outAudio = outAudioOrig; accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ return IVAS_ERR_OK; @@ -8763,7 +8683,7 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); #endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 9e65b9786b..0b9d79aa28 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -68,7 +68,7 @@ typedef struct int32_t bufLenInBytes; int32_t bitsWritten; int32_t bitsRead; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; #endif diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 0ef96c40df..dd4c72fb6e 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -371,7 +371,7 @@ ivas_error RenderConfigReader_read( char *pValue; int16_t nBandsInput; int16_t nVectorsMissing; -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT bool dofProvided = false; bool poseCorrProvided = false; #endif @@ -521,14 +521,14 @@ ivas_error RenderConfigReader_read( } else if ( strcmp( item, "DOF" ) == 0 ) { -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT dofProvided = true; #endif if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.dof ) ) { errorHandler( item, ERROR_VALUE_INVALID ); } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT /* 0 DOF implies no pose correction */ if ( hRenderConfig->split_rend_config.dof == 0 && !poseCorrProvided ) { @@ -536,7 +536,7 @@ ivas_error RenderConfigReader_read( } #endif } -#ifdef SPLIT_REND_LC3PLUS +#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( item, "CODEC" ) == 0 ) { if ( strcmp( pValue, "LCLD" ) == 0 ) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 2e9547ce08..9b2b1f0daf 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -148,13 +148,13 @@ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileR return IVAS_ERR_OK; } -ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written -#ifdef SPLIT_REND_LC3PLUS - , - IVAS_SPLIT_REND_CODEC codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection -#endif -) +ivas_error split_rend_write_bitstream_to_file( + SplitFileReadWrite *hSplitRendFileReadWrite, + uint8_t *bits, + int32_t *bits_read, + int32_t *bits_written, + IVAS_SPLIT_REND_CODEC codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection ) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; size_t header_len, i, num_bytes; @@ -180,7 +180,6 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil } } -#ifdef SPLIT_REND_LC3PLUS /* Write codec signalling */ if ( fwrite( &codec, sizeof( codec ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -191,7 +190,6 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil { return IVAS_ERR_FAILED_FILE_WRITE; } -#endif /*write num bytes*/ if ( fwrite( bits_written, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) @@ -211,13 +209,13 @@ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFil return IVAS_ERR_OK; } -ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written -#ifdef SPLIT_REND_LC3PLUS - , - IVAS_SPLIT_REND_CODEC *codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection -#endif -) +ivas_error split_rend_read_bits_from_file( + SplitFileReadWrite *hSplitRendFileReadWrite, + uint8_t *bits, + int32_t *bits_read, + int32_t *bits_written, + IVAS_SPLIT_REND_CODEC *codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection ) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; @@ -249,7 +247,6 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea return IVAS_ERR_FAILED_FILE_READ; } -#ifdef SPLIT_REND_LC3PLUS /* read codec signalling */ if ( fread( codec, sizeof( *codec ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -260,7 +257,6 @@ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileRea { return IVAS_ERR_FAILED_FILE_READ; } -#endif /*write num bytes*/ if ( fread( &bit_len, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) @@ -295,4 +291,4 @@ ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFile *delay_ns = hSplitRendFileReadWrite->delay_ns; return IVAS_ERR_OK; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 2ec0cdcb54..1531c0f5f8 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -44,30 +44,36 @@ ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite /* Allocates and initializes a a split renderer writer instance */ -ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename, int16_t delayNumSamples, int32_t delayTimeScale ); +ivas_error split_rend_writer_open( + SplitFileReadWrite **hhSplitRendFileReadWrite, + char *filename, + int16_t delayNumSamples, + int32_t delayTimeScale ); /* Closes the split renderer reader/writer and deallocates memory */ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite ); /*write split rend coded bitstream to file*/ -ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written -#ifdef SPLIT_REND_LC3PLUS - , - IVAS_SPLIT_REND_CODEC codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection -#endif -); +ivas_error split_rend_write_bitstream_to_file( + SplitFileReadWrite *hSplitRendFileReadWrite, + uint8_t *bits, + int32_t *bits_read, + int32_t *bits_written, + IVAS_SPLIT_REND_CODEC codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection ); /*read split rend coded bits from file*/ -ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written -#ifdef SPLIT_REND_LC3PLUS - , - IVAS_SPLIT_REND_CODEC *codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection -#endif -); +ivas_error split_rend_read_bits_from_file( + SplitFileReadWrite *hSplitRendFileReadWrite, + uint8_t *bits, + int32_t *bits_read, + int32_t *bits_written, + IVAS_SPLIT_REND_CODEC *codec, + IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection ); /*read split pre rend delay*/ -ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ); +ivas_error split_rend_read_pre_rend_delay_ns( + SplitFileReadWrite *hSplitRendFileReadWrite, + uint32_t *delay_ns ); #endif -- GitLab From 1f02e7cc07c6f9f31d4069e1e0213ddc02a682cb Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 12 Jul 2023 18:25:23 +0200 Subject: [PATCH 332/591] FIx some ASAN failures --- lib_rend/ivas_crend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 88b1c3385f..5b916dd199 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1797,7 +1797,7 @@ ivas_error ivas_rend_crendProcessSplitBin( } /* copy LFE to tmpLfeBuffer and apply gain only once */ - mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); + mvr2r( output[st_ivas->hTransSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame ); -- GitLab From ddc854cf31fa2f38c2d0d1529e7ec58697fad8b8 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 13 Jul 2023 12:33:41 +1000 Subject: [PATCH 333/591] adding support for MC fast conv and TD renderer --- lib_dec/ivas_dec.c | 64 ++++++++++++++++++++++++-------- lib_dec/ivas_mc_param_dec.c | 23 +++++++++++- lib_rend/ivas_splitRendererPre.c | 1 + 3 files changed, 71 insertions(+), 17 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index b2dcc4109a..e46abc99a9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -518,12 +518,15 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); } else { +#endif if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -537,7 +540,9 @@ ivas_error ivas_dec( } ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -549,19 +554,24 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } else { +#endif if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) { return error; } ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -596,18 +606,30 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT - , - 0 -#endif - ) ) != IVAS_ERR_OK ) + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - return error; + ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); } + else + { +#endif + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + } +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -626,12 +648,24 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - return error; + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); // TODO tmu check } + else + { +#endif + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + } +#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -791,7 +825,7 @@ ivas_error ivas_dec( hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, max_band, output, 1, - st_ivas->ivas_format != SBA_FORMAT, + st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV, pcm_out ); free( st_ivas->splitBinRend.hMultiBinCldfbData ); diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index bd55264e5b..6c43a12bb5 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1554,8 +1554,8 @@ void ivas_param_mc_dec_render( float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; #ifdef SPLIT_REND_WITH_HEAD_ROT - float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; #else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -1766,6 +1766,25 @@ void ivas_param_mc_dec_render( NULL, #endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + int16_t pos_idx; + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) + { + for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + for ( ch = 0; ch < nchan_out_cldfb; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands ); + } + } + } + } +#endif } else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) { diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 40f0eec054..30d49e67d8 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2169,6 +2169,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); } + /*TODO : why should this be called during run time ?*/ ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out ); if ( -- GitLab From 30b728200fac1f2b05e423e4165c9c8ddaf16bad Mon Sep 17 00:00:00 2001 From: azmill Date: Thu, 13 Jul 2023 14:42:20 +1000 Subject: [PATCH 334/591] Updating the HRTF loader so that it can be used by older version of matlab --- .../generate_HOA_HRIRs_MOD_lens.m | 11 +++-- .../hrtf_library_loader.m | 45 +++++++++++++++++-- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m index 089baafff3..8c35cc416a 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m @@ -25,7 +25,7 @@ % the United Nations Convention on Contracts on the International Sales of Goods. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -function IR_data = generate_HOA_HRIRs_MOD_lens(order, python_path, sofa_path, sofa_file_name, ir_len) +function IR_data = generate_HOA_HRIRs_MOD_lens(order, python_path, sofa_path, sofa_file_name, ir_len, write_out_sofa) % HRIR convertor - Takes sphere sampled HRIRs and converts them to % HOA HRIRs. % @@ -37,13 +37,14 @@ function IR_data = generate_HOA_HRIRs_MOD_lens(order, python_path, sofa_path, so % converted. % sofa_file - file name of the HRTFs to be converted % ir_len - length of the IRs to be used. + % write_out_sofa - boolean to enable/disable writing out of sofa % % Typical usage: % generate_HOA_HRIRs_MOD_lens(1, "~/.pyenv/versions/3.8.16/bin/python", '~/git/ivas-pc-testfiles/sofa-files/', 'HRIR_128_48000.sofa', 128) % % Pointing to the correct python binary -pyenv(Version=python_path); +pyenv('Version', python_path); % Load in the support coefs load('hrtf_support_coefs.mat', 'hrtf_support_coefs'); @@ -120,8 +121,10 @@ IR = permute(IR_HOA, [2, 1, 3]); HOAformat_str = ['HOA',num2str(order),'S']; save(fullfile(erase(sofa_file_name, ".sofa") + "_converted_" + HOAformat_str + ".mat"), "IR") -H.updateSOFA(IR); -H.writeSOFA(fullfile(erase(sofa_file_name, ".sofa") + "_converted_" + HOAformat_str + ".sofa")); +if (write_out_sofa == 1) + H.updateSOFA(IR); + H.writeSOFA(fullfile(erase(sofa_file_name, ".sofa") + "_converted_" + HOAformat_str + ".sofa")); +end IR_data = IR; diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m index cfa10d12b5..f2eec776fd 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m @@ -80,6 +80,7 @@ classdef hrtf_library_loader < handle end methods + function obj = hrtf_library_loader() end @@ -91,7 +92,7 @@ classdef hrtf_library_loader < handle % This looks like a library built from a bunch of discrete % locations in free field % Let's figure out the source locations used in the HRTF library: - Pos = double(sofa_file.SourcePosition)'; + Pos = hrtf_library_loader.convert_numpy_2darray(sofa_file.SourcePosition)'; Units = strtrim(strsplit(string(sofa_file.SourcePosition_Units), ',')); assert( any(strcmpi(Units{1}, {'degree','radian'})), 'Unknown units'); @@ -109,10 +110,10 @@ classdef hrtf_library_loader < handle % Now, get the impulse repsonses: assert( isprop(sofa_file, 'GLOBAL_DataType'), 'Expected field: GLOBAL_DataType'); - Data.IR = double(sofa_file.Data_IR); + Data.IR = hrtf_library_loader.convert_numpy_3darray(sofa_file.Data_IR); Data.SamplingRate = double(sofa_file.Data_SamplingRate); Data.SamplingRate_Units = string(sofa_file.Data_SamplingRate_Units); - Data.Delay = double(sofa_file.Data_Delay); + Data.Delay = hrtf_library_loader.convert_numpy_2darray(sofa_file.Data_Delay); switch lower(string(sofa_file.GLOBAL_DataType)) case 'fir' assert( size(Data.IR,2)>=2, 'Expecting 2 receivers (ears)'); @@ -393,6 +394,44 @@ classdef hrtf_library_loader < handle end % private methods methods(Static=true) + + function mat = convert_numpy_2darray(np_array) + py_list = np_array.tolist(); + % List to cell + matCell = cell(py_list)'; + shape = cell(np_array.shape); + shape_mat = zeros(1, length(shape)); + for i=1:length(shape) + shape_mat(i) = double(shape{i}); + end + mat = zeros(shape_mat); + for i = 1:length(matCell) + if isa(matCell{i}, 'py.list') + mat(i,:) = cell2mat(cell(matCell{i})); + end + end + end + + function mat = convert_numpy_3darray(np_array) + py_list = np_array.tolist(); + % List to cell + matCell = cell(py_list)'; + shape = cell(np_array.shape); + shape_mat = zeros(1, length(shape)); + for i=1:length(shape) + shape_mat(i) = double(shape{i}); + end + mat = zeros(shape_mat); + for i = 1:length(matCell) + if isa(matCell{i}, 'py.list') + for j = 1:length(matCell{i}) + if isa(matCell{i}, 'py.list') + mat(i,j,:) = cell2mat(cell(matCell{i}{j})); + end + end + end + end + end function [Band2FR,FCs]=MakeBand2FR(FFTLen,FSample) % Compute the standard band filters for freq domain representations -- GitLab From 866ec24c6db8771d879828cd3867a8b5fd9e9944 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 13 Jul 2023 08:11:25 +0200 Subject: [PATCH 335/591] remove leftovers of JBM_TSM_ON_TCS --- lib_rend/lib_rend.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4e75d5fea8..ebcf96c0e2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4835,19 +4835,8 @@ static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { -#ifdef JBM_TSM_ON_TCS - int16_t i; -#endif float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; -#ifdef JBM_TSM_ON_TCS - float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; - - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - p_tmpRendBuffer[i] = tmpRendBuffer[i]; - } -#endif push_wmops( "renderIsmToBinauralRoom" ); -- GitLab From cb9b71a0aacfb1ef838358277d636a043f6b640a Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Thu, 13 Jul 2023 08:29:23 +0200 Subject: [PATCH 336/591] Update switch --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index fb40c0e4e9..fd193beb7c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,6 +166,7 @@ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ #define FIX_593_STL_INCLUDE /* FhG: Issue 593: correct include of stl.h in lib_enc/ivas_stereo_eclvq_enc.c */ #define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ +#define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ /* ################## End BE DEVELOPMENT switches ######################### */ @@ -173,7 +174,6 @@ /* #################### Start NON-BE CR switches ########################## */ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -#define JBM_PARAMUPMIX /* ##################### End NON-BE CR switches ########################### */ -- GitLab From 5cf02aa39dd18dbe1ff83b87a1c03ef54410298b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 08:39:10 +0200 Subject: [PATCH 337/591] [fix] partial fixes for compilation when SPLIT_REND_WITH_HEAD_ROT is deactivated --- lib_com/ivas_cnst.h | 7 +++---- lib_dec/ivas_binRenderer_internal.c | 21 +++------------------ lib_dec/ivas_init_dec.c | 6 +++--- lib_dec/ivas_output_config.c | 4 ++++ lib_dec/ivas_spar_md_dec.c | 2 ++ lib_rend/ivas_lc3plus_common.c | 3 +++ lib_rend/ivas_splitRendererPre.c | 3 +-- lib_rend/lib_rend.c | 15 +++++++++++---- lib_util/split_rend_bfi_file_reader.c | 3 +++ lib_util/split_rend_bfi_file_reader.h | 3 +++ lib_util/split_render_file_read_write.h | 5 ++++- 11 files changed, 40 insertions(+), 32 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0602576352..93fd9d0b4c 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1792,6 +1792,9 @@ typedef enum #define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS ) #define CLDFB_PAR_WEIGHT_START_BAND 7 +#define QUANT_STRAT_0 0 +#define QUANT_STRAT_2 2 + #ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * Split rendering bitrate constants @@ -1808,10 +1811,6 @@ typedef enum #define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) #endif -#define QUANT_STRAT_0 0 -#define QUANT_STRAT_2 2 - - #endif /*----------------------------------------------------------------------------------* * Limiter constants diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index acd2bee6bc..408f708ad1 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1506,12 +1506,7 @@ void ivas_binRenderer( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer, 0 ); #else - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - 0 -#endif - ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1542,12 +1537,7 @@ void ivas_binRenderer( QuatToRotMat( Quaternions_rel, Rmat_local ); rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - pos_idx -#endif - ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer, pos_idx ); } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1567,12 +1557,7 @@ void ivas_binRenderer( QuatToRotMat( Quaternions_rel, Rmat_local ); rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[num_poses], Cldfb_ImagBuffer_Binaural[num_poses], RealBuffer, ImagBuffer, hBinRenderer -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - num_poses -#endif - ); + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[num_poses], Cldfb_ImagBuffer_Binaural[num_poses], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer, num_poses ); } #endif } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2e8b993917..ef194bdab3 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1378,7 +1378,6 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - int16_t num_poses; if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) @@ -1387,15 +1386,15 @@ ivas_error ivas_init_decoder( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t num_poses; if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t pcm_out; pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, pcm_out ); -#endif ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, @@ -1415,6 +1414,7 @@ ivas_error ivas_init_decoder( { num_poses = 1; } +#endif if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index e1375cfa80..160a04a5b0 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -207,7 +207,11 @@ void ivas_renderer_select( else { *internal_config = transport_config; +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( output_config == AUDIO_CONFIG_BINAURAL ) +#endif { #ifdef DEBUGGING if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 11cdd47ce8..3a87f5c9d3 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -82,7 +82,9 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); +#ifdef FIX_SPLIT_REND_MERGE static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); +#endif static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); diff --git a/lib_rend/ivas_lc3plus_common.c b/lib_rend/ivas_lc3plus_common.c index 1f0dea1043..9f175feaf3 100644 --- a/lib_rend/ivas_lc3plus_common.c +++ b/lib_rend/ivas_lc3plus_common.c @@ -30,10 +30,12 @@ *******************************************************************************************************/ +#include "options.h" #include "ivas_lc3plus_common.h" #include "ivas_error.h" #include "lc3.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ) { switch ( lc3PlusError ) @@ -47,3 +49,4 @@ ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ) } return IVAS_ERR_INTERNAL; } +#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 30d49e67d8..905e2524d9 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2172,8 +2172,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( /*TODO : why should this be called during run time ?*/ ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out ); - if ( - td_input ) + if ( td_input ) { /*TD input*/ /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 169488e38d..68cfc5e19b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2873,17 +2873,24 @@ static ivas_error setRendInputActiveSba( } #ifdef REND_STATIC_MEM_OPT +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) +#else + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) +#endif { return error; } #endif - initRendInputBase( &inputSba->base, inConfig, id, rendCtx #ifdef REND_STATIC_MEM_OPT - , - inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH +#ifdef SPLIT_REND_WITH_HEAD_ROT + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); +#else + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); +#endif +#else + initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); #endif - ); setZeroPanMatrix( inputSba->hoaDecMtx ); #ifdef SPLIT_REND_WITH_HEAD_ROT inputSba->crendWrapper = NULL; diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 2c1fe4e3b8..1c1a96e59a 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -31,12 +31,14 @@ *******************************************************************************************************/ #include "split_rend_bfi_file_reader.h" +#include "options.h" #include #include #include #include #include "prot.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT struct SplitRendBFIFileReader { FILE *bfiFile; @@ -159,3 +161,4 @@ const char *SplitRendBFIFileReader_getFilePath( return SplitRendBFIReader->file_path; } +#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_util/split_rend_bfi_file_reader.h b/lib_util/split_rend_bfi_file_reader.h index 97df1c7fbb..8d82aace7a 100644 --- a/lib_util/split_rend_bfi_file_reader.h +++ b/lib_util/split_rend_bfi_file_reader.h @@ -33,10 +33,12 @@ #ifndef IVAS_SR_BFI_FILE_READER_H #define IVAS_SR_BFI_FILE_READER_H +#include "options.h" #include "common_api_types.h" #include "ivas_error.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct SplitRendBFIFileReader SplitRendBFIFileReader; ivas_error SplitRendBFIFileReader_open( @@ -57,4 +59,5 @@ const char *SplitRendBFIFileReader_getFilePath( ); +#endif /* SPLIT_REND_WITH_HEAD_ROT */ #endif /* IVAS_SR_BFI_FILE_READER_H */ diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 1531c0f5f8..a21d0d2463 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -33,10 +33,12 @@ #ifndef SPLIT_RENDER_FILE_READ_WRITE_H #define SPLIT_RENDER_FILE_READ_WRITE_H +#include "options.h" #include "common_api_types.h" #include "ivas_error.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct SplitFileReadWrite SplitFileReadWrite; /* Allocates and initializes a a split renderer reader instance */ @@ -76,4 +78,5 @@ ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ); -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ +#endif /* SPLIT_RENDER_FILE_READ_WRITE_H */ -- GitLab From 07c78ba873ac0a53b327ab8149b038234aff13a7 Mon Sep 17 00:00:00 2001 From: hmund Date: Thu, 13 Jul 2023 08:41:11 +0200 Subject: [PATCH 338/591] merged from 450-Provide-scripts-for-generation-of-SHD-HRIRs-from-SD-HRIRs --- .../SHD_2_ROM.m | 368 ++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m new file mode 100644 index 0000000000..30df2d17f0 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -0,0 +1,368 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function IR_cldfb = SHD_2_ROM( py_path, rom_c_file, sofa_file ) +% SHD_2_ROM( python_path, rom_c_file, sofa_file ) +% +% - converts sphere-sampled Head Related Impulse Responses (HRIRs) given in sofa_file to the Spherical Harmonics domain (SHD) +% - converts SHD HRIRs to Complex Low Delay Filter Bank (CLDFB) domain +% - writes CLDFB HRIRs to c-code ROM tables. +% +% Processing chain: +% +% HRIRs --> SHD --> CLDFB --> ROM +% HRIRs --> SHD: Using ./generate_HOA_HRIRs_MOD_lens.m +% SHD --> CLDFB: Least squares optimization +% CLDFB --> ROM: Using ../param_bin/writeData3L.m +[thispath,~,~] = fileparts(mfilename('fullpath')); +thispath = [thispath,filesep]; + +%py_path = 'C:\Users\xxxx\AppData\Local\Programs\Python\Python39\python.exe'; % may look like this +if ~exist('sofa_file','var') || isempty(sofa_file) + sofa_file = fullfile(thispath,'..','HRIRs_sofa','HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa'); +end + +%% convert sphere-sampled HRIRs to SHD HRIRs +% requires: +% python -m pip install sofar +% python -m pip install numpy + +% convert sphere-sampled HRIRs to SHD HRIRs +hrir_len = 128; +ambi_order = 3; +[sofa_path,sofa_name, sofa_ext] = fileparts(sofa_file); +IR = generate_HOA_HRIRs_MOD_lens(ambi_order, py_path, sofa_path, [sofa_name,sofa_ext], hrir_len); +% load([thispath,'HRIR_128_48000_dolby_SBA3.mat'],'IR'); gives the same data as the above with default sofa file + +%% SHD -> CLDFB via least squares error optimization +[~,num_ears,num_ch] = size(IR); +num_cldfb_taps = 3; +IR_cldfb = zeros(60,num_cldfb_taps,num_ears,num_ch); % 60 frequency bands +eval_flag = 0; % optional, = 1 requires signal processing toolbox (fftfilt) +for pos = 1:num_ch + disp(['Channel ',num2str(pos),'/',num2str(num_ch)]) + for ear = 1:num_ears + IR_cldfb(:,:,ear,pos) = fir_to_cldfb_fir( IR(:,ear,pos), num_cldfb_taps, eval_flag ); + end +end + +%% CLDFB -> ROM +% Note: The following section is copied from generate_HRIR_in_SHD_CLDFB_FASTCONV.m provided by @emerit +latency_s = 2.083333333333333e-05; % No added latency from conversion method +max_band = 50; % Compute 60 bands, but only use 50 in ROM table + +IR_cldfb_rom = permute(IR_cldfb, [3 1 4 2]); % after permute: [ears(2), bands(60), chans(16), taps(3)] +order_int = (round(sqrt(size(IR_cldfb_rom,3))-1)); +if order_int == 1 + order = 'FOA'; +else + order = ['HOA' int2str(order_int)]; +end +if ~exist('rom_c_file','var') || isempty(rom_c_file) + rom_c_file = [thispath,'ivas_rom_binauralRenderer_',order,'.c']; % fullfile(thispath,'..','..','..','lib_rend',['ivas_rom_binauralRenderer_',order,'.c']); +end +fid = fopen(rom_c_file,'wt'); + +fprintf(fid, ['const float FASTCONV_' order '_latency_s = %10.9ff;\n'], latency_s); + +addpath(fullfile(thispath,'..','param_bin')); % for writeData3L() +writeData3L(fid, ['const float leftHRIRReal_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], real( squeeze(IR_cldfb_rom(1,1:max_band,:,:)))); +writeData3L(fid, ['const float leftHRIRImag_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], imag( squeeze(IR_cldfb_rom(1,1:max_band,:,:)))); +writeData3L(fid, ['const float rightHRIRReal_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], real( squeeze(IR_cldfb_rom(2,1:max_band,:,:)))); +writeData3L(fid, ['const float rightHRIRImag_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], imag( squeeze(IR_cldfb_rom(2,1:max_band,:,:)))); + +fclose(fid); +rmpath(fullfile(thispath,'..','param_bin')); + +function F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag ) + +[pFilter, D, S, L] = get_cldfb_filter; +cldfb_delay = D - S + 1; % processing delay given stride +pFilt = sqrt(S)/L * pFilter(:); +N = length(pFilt); +legacy_flag = 1; % = 1 used to indicate slightly too short buffers as used to generate tested coefficients + +% Filter Bank analysis / synthesis filters +cldfb_mod_mat = exp(1i*((0:N-1)'-D/2) * ((0:L-1)+0.5) * pi/L ); % N x L modulation matrix with alternating sign periodicity of 2*L in time (row) direction +cldfb_ansyn_filters = pFilt .* cldfb_mod_mat; % all (L) analysis/synthesis filters + +target_fir = target_fir(:); +fir_length = length(target_fir); + +%% brute force least squares +if legacy_flag + num_slots = ceil(fir_length/S) + 10; % used to generate tested IVAS coefficients in CLDFB HRIR ROM with slightly too short buffers + inp_len = S * num_slots; + len = inp_len - cldfb_delay; + idx_opt = cldfb_delay + (1:len); + pos_offset = 200; +else + num_slots = ceil((fir_length + 2 * N - 1) / S); % convolution with target fir, analysis + synthesis filters (of length N each) + len = S * num_slots; + inp_len = len; + idx_opt = (1:len); % use all output samples in the optimization, including the filter bank delay + pos_offset = 0; +end + +% Big trial and error +Nbins = num_cldfb_taps * L; +Vreal = zeros(S*len, Nbins); % all real for all shifts concatenated for each mask bin, +Vimag = zeros(S*len, Nbins); % then all imag +r = zeros(S*len,1); % right hand side all shifts concatenated + +x = zeros(inp_len,1); +for pos = 1:S + % input dirac pulse + x(:) = 0; + + % target impulse response y0 for input pulse at pos + out = x; + out(pos+pos_offset+(0:fir_length-1)) = target_fir; + y0 = [zeros(cldfb_delay,1);out(1:end-cldfb_delay)]; + r(len*(pos-1)+(1:len)) = y0(idx_opt); + fprintf('.'); + + % CLDFB analysis for impulse input + x(pos+pos_offset) = 1; + X = zeros(L,num_slots); + frm_idx = (1:N)'; + x_tmp = [zeros(N-S,1);x]; + for slt = 1:num_slots + X(:,slt) = sum(cldfb_ansyn_filters.*flipud(x_tmp(frm_idx))).'; + frm_idx = frm_idx + S; + end + for cldfb_bin = 1:Nbins + cldfb_band = rem(cldfb_bin-1,L)+1; + cldfb_lag = fix((cldfb_bin-1)/L); + + % real-valued filter contribution of a single tap + frm_idx = cldfb_lag * S + (1:N)'; + y_tmp = zeros( num_slots * S + N - S,1); + for slt = cldfb_lag+1:num_slots + y_tmp(frm_idx) = y_tmp(frm_idx) + real(X(cldfb_band,slt-cldfb_lag) * cldfb_ansyn_filters(:,cldfb_band)); + frm_idx = frm_idx + S; + end + Vreal(len*(pos-1)+1:len*pos,cldfb_bin) = y_tmp(idx_opt); + + % imaginary-valued filter contribution of a single tap + frm_idx = cldfb_lag * S + (1:N)'; + y_tmp(:) = 0; + for slt = cldfb_lag+1:num_slots + y_tmp(frm_idx) = y_tmp(frm_idx) + real(1i*X(cldfb_band,slt-cldfb_lag) * cldfb_ansyn_filters(:,cldfb_band)); + frm_idx = frm_idx + S; + end + Vimag(len*(pos-1)+1:len*pos,cldfb_bin) = y_tmp(idx_opt); + end % bin +end % pos +fprintf('\n'); + +% solve lsq +V = [Vreal,Vimag]; +M = V'*V; +Mrel = M + 1e-8*norm(M)*eye(size(M)); +c = Mrel\(V'*r); + +% map back to mask locations +F = zeros(L,num_cldfb_taps); +for cldfb_bin = 1:Nbins + F(cldfb_bin) = c(cldfb_bin)+1i*c(Nbins+cldfb_bin); +end + +if eval_flag + % evaluation (not needed for table generation, needs signal processing toolbox) + get_snr( target_fir, F, cldfb_ansyn_filters, cldfb_delay, S ); +end + +function get_snr( target_fir, cldfb_firs, cldfb_ansyn_filters, cldfb_delay, S ) + +rng(0); +num_samples = 5*48000; +x = randn(num_samples,1); + +% Filter noise in time domain +y1 = fftfilt(target_fir,x); + +% Filter noise in CLDFB domain +[N,L] = size(cldfb_ansyn_filters); +num_slots = ceil((num_samples + cldfb_delay) / S); +% analysis +X = zeros(L,num_slots); +frm_idx = (1:N)'; +x_tmp = [zeros(N-S,1);x;zeros(cldfb_delay,1)]; +for slt = 1:num_slots + X(:,slt) = sum(cldfb_ansyn_filters.*flipud(x_tmp(frm_idx))).'; + frm_idx = frm_idx + S; +end +% filter +X = fftfilt(cldfb_firs.',X.').'; +% synthesis +frm_idx = (1:N)'; +y_tmp = zeros( num_slots * S + N - S,1); +for slt = 1:num_slots + y_tmp(frm_idx) = y_tmp(frm_idx) + real(sum(X(:,slt).' .* cldfb_ansyn_filters,2)); + frm_idx = frm_idx + S; +end +y2 = y_tmp(cldfb_delay+(1:num_samples)); + +plot(y1), hold on, plot(y2,'r--'), plot(y1-y2,'k'), hold off +set(gca,'xlim',[1,num_samples]) +fprintf('SNR: %.1f dB \n', 10*log10(sum(y1.^2)/sum((y1-y2).^2))); +legend('time domain','CLDFB domain','difference') +title('Filtered noise') + +function [h, D, S, L] = get_cldfb_filter() +% const float LDQMF_60[] in \lib_com\rom_com.c, line 5219 +S = 60; % stride +L = 60; % frequency bands +D = 240 + S - 1; % system delay +h = [ + 0.0000953076, 0.0001230230, 0.0001279964, 0.0001260533, 0.0001211219 + 0.0001122123, 0.0001010860, 0.0000876540, 0.0000719883, 0.0000545472 + 0.0000352143, 0.0000145686, -0.0000074264, -0.0000303788, -0.0000539205 + -0.0000782743, -0.0001028838, -0.0001275374, -0.0001520015, -0.0001760167 + -0.0001997108, -0.0002226708, -0.0002446725, -0.0002655797, -0.0002852145 + -0.0003034996, -0.0003203036, -0.0003356283, -0.0003493345, -0.0003614030 + -0.0003719004, -0.0003807641, -0.0003881051, -0.0003939842, -0.0003985357 + -0.0004019095, -0.0004041938, -0.0004056677, -0.0004065430, -0.0004069925 + -0.0004072535, -0.0004075877, -0.0004083676, -0.0004098394, -0.0004122990 + -0.0004160839, -0.0004214063, -0.0004285777, -0.0004378651, -0.0004495422 + -0.0004637682, -0.0004806494, -0.0005003878, -0.0005231378, -0.0005489803 + -0.0005777747, -0.0006095612, -0.0006443121, -0.0006813223, -0.0007226231 + -0.0007722576, -0.0008268412, -0.0008839625, -0.0009417336, -0.0010004630 + -0.0010601623, -0.0011206097, -0.0011817788, -0.0012432419, -0.0013045983 + -0.0013656860, -0.0014260965, -0.0014855355, -0.0015435946, -0.0015999591 + -0.0016543545, -0.0017062968, -0.0017554691, -0.0018015467, -0.0018441341 + -0.0018829798, -0.0019177221, -0.0019480695, -0.0019736972, -0.0019943134 + -0.0020097434, -0.0020197174, -0.0020240925, -0.0020226294, -0.0020152442 + -0.0020017736, -0.0019820682, -0.0019561697, -0.0019240153, -0.0018855907 + -0.0018409232, -0.0017900462, -0.0017330211, -0.0016699535, -0.0016009507 + -0.0015261442, -0.0014456788, -0.0013597424, -0.0012685407, -0.0011722331 + -0.0010710671, -0.0009652392, -0.0008549765, -0.0007405236, -0.0006221444 + -0.0005001140, -0.0003745670, -0.0002458634, -0.0001142541, 0.0000199491 + 0.0001564174, 0.0002949402, 0.0004350246, 0.0005769439, 0.0007203126 + -0.0008803223, -0.0010328424, -0.0011841310, -0.0013346316, -0.0014848098 + -0.0016343417, -0.0017832819, -0.0019316213, -0.0020790498, -0.0022252349 + -0.0023701149, -0.0025136294, -0.0026556554, -0.0027960713, -0.0029348312 + -0.0030717771, -0.0032068293, -0.0033399195, -0.0034709862, -0.0035999804 + -0.0037267797, -0.0038513308, -0.0039736414, -0.0040935921, -0.0042111278 + -0.0043262239, -0.0044388464, -0.0045489701, -0.0046565188, -0.0047614835 + -0.0048637423, -0.0049632201, -0.0050599808, -0.0051539382, -0.0052450863 + -0.0053333500, -0.0054187514, -0.0055012843, -0.0055808770, -0.0056575472 + -0.0057313135, -0.0058021732, -0.0058701355, -0.0059352517, -0.0059975707 + -0.0060571772, -0.0061141332, -0.0061685541, -0.0062205540, -0.0062703062 + -0.0063179093, -0.0063635921, -0.0064075105, -0.0064498796, -0.0064908965 + -0.0065308069, -0.0065698619, -0.0066083665, -0.0066466411, -0.0066849431 + -0.0067233290, -0.0067621553, -0.0068021296, -0.0068436749, -0.0068870094 + -0.0069324085, -0.0069801519, -0.0070305937, -0.0070840055, -0.0071406048 + -0.0072006541, -0.0072644479, -0.0073321410, -0.0074039386, -0.0074799177 + -0.0075602704, -0.0076450342, -0.0077342330, -0.0078278277, -0.0079257628 + -0.0080279401, -0.0081341872, -0.0082442267, -0.0083577875, -0.0084744738 + -0.0085938899, -0.0087156557, -0.0088391500, -0.0089637861, -0.0090888245 + -0.0092134504, -0.0093367994, -0.0094579896, -0.0095760096, -0.0096898535 + -0.0097982995, -0.0099003557, -0.0099947909, -0.0100801717, -0.0101551116 + -0.0102182031, -0.0102678994, -0.0103026126, -0.0103207529, -0.0103206923 + -0.0103006857, -0.0102590285, -0.0101939747, -0.0101036867, -0.0099863587 + -0.0098401112, -0.0096632261, -0.0094537362, -0.0092098210, -0.0089295702 + -0.0086111929, -0.0082527259, -0.0078523541, -0.0074084769, -0.0069190590 + 0.0063841688, 0.0057985946, 0.0051621343, 0.0044734711, 0.0037309236 + 0.0029329660, 0.0020781513, 0.0011651339, 0.0001925042, -0.0008409545 + -0.0019364181, -0.0030950012, -0.0043176264, -0.0056051607, -0.0069584334 + -0.0083780792, -0.0098646237, -0.0114185056, -0.0130400723, -0.0147295250 + -0.0164868534, -0.0183120724, -0.0202049762, -0.0221651513, -0.0241921283 + -0.0262852497, -0.0284437388, -0.0306666382, -0.0329528190, -0.0353010744 + -0.0377098918, -0.0401776619, -0.0427025780, -0.0452826768, -0.0479161367 + -0.0506004691, -0.0533332452, -0.0561118126, -0.0589331910, -0.0617944039 + -0.0646922663, -0.0676232576, -0.0705836788, -0.0735698044, -0.0765774846 + -0.0796026587, -0.0826408863, -0.0856874809, -0.0887378305, -0.0917868018 + -0.0948293805, -0.0978601947, -0.1008738130, -0.1038645208, -0.1068264544 + -0.1097536832, -0.1126400903, -0.1154794544, -0.1182654947, -0.1209914312 + -0.1236500666, -0.1262341589, -0.1287376434, -0.1311538219, -0.1334753036 + -0.1356947273, -0.1378047168, -0.1397978216, -0.1416664869, -0.1434033662 + -0.1450008005, -0.1464512348, -0.1477471888, -0.1488809884, -0.1498452872 + -0.1506324410, -0.1512351334, -0.1516460329, -0.1518578976, -0.1518635303 + -0.1516559124, -0.1512281001, -0.1505732536, -0.1496847868, -0.1485562176 + -0.1471813470, -0.1455538720, -0.1436681300, -0.1415183097, -0.1390990764 + -0.1364052594, -0.1334318966, -0.1301742792, -0.1266280264, -0.1227891371 + -0.1186537445, -0.1142183766, -0.1094799563, -0.1044355705, -0.0990828425 + -0.0934195668, -0.0874440819, -0.0811550021, -0.0745511875, -0.0676321834 + -0.0603975877, -0.0528475679, -0.0449828543, -0.0368040986, -0.0283128861 + -0.0195108838, -0.0104003223, -0.0009837818, 0.0087356847, 0.0187546927 + 0.0290693250, 0.0396753438, 0.0505682528, 0.0617432520, 0.0731955394 + -0.0849232078, -0.0969054326, -0.1091460735, -0.1216373071, -0.1343720406 + -0.1473424733, -0.1605402082, -0.1739567965, -0.1875831038, -0.2014097124 + -0.2154271752, -0.2296251506, -0.2439934313, -0.2585212290, -0.2731975317 + -0.2880111337, -0.3029502928, -0.3180032372, -0.3331578076, -0.3484017253 + -0.3637222052, -0.3791064322, -0.3945416212, -0.4100143015, -0.4255111217 + -0.4410185516, -0.4565227628, -0.4720100164, -0.4874662757, -0.5028775334 + -0.5182296634, -0.5335084200, -0.5486994982, -0.5637886524, -0.5787616372 + -0.5936041474, -0.6083019376, -0.6228409410, -0.6372069120, -0.6513859630 + -0.6653640866, -0.6791275144, -0.6926627755, -0.7059561610, -0.7189947963 + -0.7317654490, -0.7442554235, -0.7564523220, -0.7683438063, -0.7799182534 + -0.7911639810, -0.8020697832, -0.8126249313, -0.8228194118, -0.8326428533 + -0.8420860767, -0.8511404991, -0.8597975969, -0.8680517077, -0.8758881092 + -0.8832823634, -0.8902196884, -0.8967157602, -0.9027729034, -0.9083824754 + -0.9135394692, -0.9182395935, -0.9224776030, -0.9262499809, -0.9295535684 + -0.9323854446, -0.9347436428, -0.9366261959, -0.9380323887, -0.9389615655 + -0.9394137263, -0.9393896461, -0.9388904572, -0.9379178882, -0.9364743829 + -0.9345626831, -0.9321863055, -0.9293491840, -0.9260557890, -0.9223110080 + -0.9181203246, -0.9134896994, -0.9084255695, -0.9029349089, -0.8970250487 + -0.8907034993, -0.8839784265, -0.8768582940, -0.8693521619, -0.8614694476 + -0.8532197475, -0.8446131349, -0.8356599212, -0.8263708353, -0.8167568445 + -0.8068289757, -0.7965991497, -0.7860788107, -0.7752800584, -0.7642148733 + -0.7528960109, -0.7413358092, -0.7295469642, -0.7175422311, -0.7053351402 + -0.6929380894, -0.6803644896, -0.6676273942, -0.6547405124, -0.6417166591 + -0.6285686493, -0.6153115034, -0.6019562483, -0.5885198116, -0.5750215650 + 0.5615197420, 0.5478612781, 0.5341838002, 0.5204906464, 0.5067980289 + 0.4931168854, 0.4794588387, 0.4658361673, 0.4522601366, 0.4387422502 + 0.4252935350, 0.4119254053, 0.3986486793, 0.3854739666, 0.3724119067 + 0.3594728410, 0.3466667533, 0.3340034485, 0.3214924335, 0.3091430366 + 0.2969639599, 0.2849639654, 0.2731511295, 0.2615332901, 0.2501178682 + 0.2389119864, 0.2279221565, 0.2171545923, 0.2066148520, 0.1963084787 + 0.1862401515, 0.1764142811, 0.1668347418, 0.1575049609, 0.1484276950 + 0.1396053135, 0.1310400218, 0.1227331311, 0.1146853194, 0.1068974212 + 0.0993694067, 0.0921007246, 0.0850901082, 0.0783365741, 0.0718384907 + 0.0655927584, 0.0595967993, 0.0538481586, 0.0483424664, 0.0430756323 + 0.0380428955, 0.0332404599, 0.0286619961, 0.0242999699, 0.0201510899 + 0.0162059069, 0.0124559226, 0.0088928537, 0.0054926532, 0.0023052765 + -0.0005515143, -0.0030201224, -0.0052712574, -0.0073737046, -0.0093160523 + -0.0111072771, -0.0127562135, -0.0142635731, -0.0156361461, -0.0168790054 + -0.0179969221, -0.0189934950, -0.0198726747, -0.0206398536, -0.0212980714 + -0.0218509119, -0.0223025978, -0.0226570386, -0.0229178313, -0.0230882075 + -0.0231725387, -0.0231746566, -0.0230979007, -0.0229462404, -0.0227237809 + -0.0224345829, -0.0220820960, -0.0216706358, -0.0212045144, -0.0206875466 + -0.0201238506, -0.0195175279, -0.0188730918, -0.0181944817, -0.0174855441 + -0.0167510118, -0.0159947462, -0.0152208358, -0.0144332750, -0.0136361914 + -0.0128338682, -0.0120294262, -0.0112272501, -0.0104311826, -0.0096443929 + -0.0088709844, -0.0081134979, -0.0073764324, -0.0066623385, -0.0059733889 + -0.0053142183, -0.0046856776, -0.0040914025, -0.0035321070, -0.0030089030 + -0.0025271603, -0.0020749648, -0.0016621647, -0.0012705614, -0.0008115423 +]; +h = h.'; +h = h(:); +h(1*120+(1:120)) = -h(1*120+(1:120)); +h(3*120+(1:120)) = -h(3*120+(1:120)); +h(:) = h(end:-1:1); \ No newline at end of file -- GitLab From 62974bf0432ea9d68a2acc6f835200eea1dab288 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 09:08:47 +0200 Subject: [PATCH 339/591] [fix] compilation with main switch deactivated --- lib_rend/lib_rend.c | 78 +++++++++---------- .../lc3plus/ivas_lc3plus_unit_test.c | 3 + 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 68cfc5e19b..217911ad66 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3710,8 +3710,8 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].splitTdRendWrappers[j].hBinRendererTd = NULL; hIvasRend->inputsMc[i].splitTdRendWrappers[j].hHrtfTD = NULL; } - } #endif + } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { @@ -4303,7 +4303,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) @@ -4712,7 +4712,7 @@ ivas_error IVAS_REND_FeedInputAudio( if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) #else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -4726,8 +4726,8 @@ ivas_error IVAS_REND_FeedInputAudio( if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #endif { /* Binaural rendering requires specific frame size */ @@ -4760,7 +4760,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; #else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; #endif return IVAS_ERR_OK; @@ -5106,7 +5106,7 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.headRotEnabled = 0; } #else - hIvasRend->headRotData.headRotEnabled = 0; + hIvasRend->headRotData.headRotEnabled = 0; #endif } else @@ -5619,7 +5619,7 @@ static ivas_error rotateFrameSba( #ifdef SBA_CREND_ROT_OPT float *writePtr; #else - float *readPtr, *writePtr; + float *readPtr, *writePtr; #endif rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; @@ -5694,10 +5694,10 @@ static ivas_error rotateFrameSba( /* crossfade with previous rotation gains */ tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val ); #else - readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); - /* crossfade with previous rotation gains */ - tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + - ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); + readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); + /* crossfade with previous rotation gains */ + tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + + ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); #endif } } @@ -6339,7 +6339,7 @@ static ivas_error renderLfeToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); #else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); + assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); #endif push_wmops( "renderLfeToBinaural" ); @@ -6361,6 +6361,7 @@ static ivas_error renderLfeToBinaural( } /* Copy LFE to left and right binaural channels */ +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) { num_poses = mcInput->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; @@ -6370,7 +6371,6 @@ static ivas_error renderLfeToBinaural( num_poses = 1; } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pose_idx = 0; pose_idx < num_poses; ++pose_idx ) { readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); @@ -6388,20 +6388,20 @@ static ivas_error renderLfeToBinaural( } } #else - /* Copy LFE to left and right ears */ - readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); - writePtr = getSmplPtr( outAudio, 0, 0 ); - for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) - { - *writePtr++ += gain * ( *readPtr++ ); - } + /* Copy LFE to left and right ears */ + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + writePtr = getSmplPtr( outAudio, 0, 0 ); + for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } - readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); - writePtr = getSmplPtr( outAudio, 1, 0 ); - for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) - { - *writePtr++ += gain * ( *readPtr++ ); - } + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + writePtr = getSmplPtr( outAudio, 1, 0 ); + for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } #endif @@ -6505,7 +6505,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { @@ -6608,7 +6608,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { @@ -6711,7 +6711,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7601,7 +7601,7 @@ renderSbaToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) @@ -7617,7 +7617,7 @@ renderSbaToBinaural( #ifdef FIX_SPLIT_REND_MERGE p_tmpCrendBuffer, #else - tmpCrendBuffer, + tmpCrendBuffer, #endif *sbaInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -7690,7 +7690,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -7829,7 +7829,7 @@ static ivas_error renderInputSba( if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) #else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ @@ -8455,7 +8455,7 @@ ivas_error IVAS_REND_GetSamples( 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 - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8469,8 +8469,8 @@ ivas_error IVAS_REND_GetSamples( if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) #endif { /* Binaural rendering requires specific frame size */ @@ -8579,9 +8579,9 @@ ivas_error IVAS_REND_GetSamples( #else #ifdef DEBUGGING - hIvasRend->numClipping += + hIvasRend->numClipping += #endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c index c27809c2e7..cdabaedcf4 100644 --- a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c @@ -32,11 +32,13 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include #include +#include "options.h" #include "ivas_lc3plus_enc.h" #include "ivas_lc3plus_common.h" #include "ivas_lc3plus_dec.h" #include "ivas_error_utils.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_SAMPLES_PER_CHANNEL 960 static int encodeAndDecodeOneStereoFrame( LC3PLUS_CONFIG config ) @@ -630,3 +632,4 @@ int main( #endif return ret; } +#endif /* SPLIT_REND_WITH_HEAD_ROT */ -- GitLab From 84874664854155483be7e92331fb4cabc746dd40 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 13 Jul 2023 17:35:05 +1000 Subject: [PATCH 340/591] MC split rendering IVAS decoder fixes --- lib_dec/ivas_dec.c | 6 ++--- lib_dec/ivas_output_config.c | 2 +- lib_rend/ivas_crend.c | 43 +++++++++++++++++++++++++++--------- lib_rend/ivas_rotation.c | 33 ++++++++++++++++++++++++++- lib_rend/ivas_stat_rend.h | 4 ++++ 5 files changed, 73 insertions(+), 15 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e46abc99a9..c087529e35 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -124,8 +124,8 @@ ivas_error ivas_dec( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { assert( ( st_ivas->ivas_format == SBA_FORMAT || - ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) || - ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ) && + ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) || + ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits ); } @@ -558,7 +558,7 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } else { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 160a04a5b0..3b8dfd788c 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -232,7 +232,7 @@ void ivas_renderer_select( *renderer_type = RENDERER_BINAURAL_FASTCONV; } -#ifdef DEBUGGING +#if 0 // def DEBUGGING /*temp disabling this as paramMC crashes with CREND*/ if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) { *renderer_type = RENDERER_BINAURAL_MIXER_CONV; diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 5b916dd199..1f9707540b 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1771,7 +1771,7 @@ ivas_error ivas_rend_crendProcessSplitBin( pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; /* copy input */ - for ( i = 0; i < st_ivas->nchan_transport; ++i ) + for ( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE; ++i ) { mvr2r( output[i], tmpInputBuffer[i], output_frame ); } @@ -1784,22 +1784,32 @@ ivas_error ivas_rend_crendProcessSplitBin( /* save current head positions */ pCombinedOrientationDataLocal = st_ivas->hCombinedOrientationData; combinedOrientationDataLocal = *pCombinedOrientationDataLocal; - for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) + if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; - for ( i = 0; i < 3; i++ ) + for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) { - for ( j = 0; j < 3; j++ ) + combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; + for ( i = 0; i < 3; i++ ) { - combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + for ( j = 0; j < 3; j++ ) + { + combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j]; + } } } } /* copy LFE to tmpLfeBuffer and apply gain only once */ - mvr2r( output[st_ivas->hTransSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); - gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; - v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame ); + if ( st_ivas->hIntSetup.num_lfe > 0 && st_ivas->hIntSetup.index_lfe[0] != -1 ) + { + mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); + gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; + v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame ); + } + else + { + set_zero( tmpLfeBuffer, output_frame ); + } for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; ++pos_idx ) { @@ -1820,6 +1830,11 @@ ivas_error ivas_rend_crendProcessSplitBin( /* render inplace to first two channels of tmpInputBuffer */ pCombinedOrientationDataLocal = &combinedOrientationDataLocal; + + for ( i = 0; i < 3; i++ ) + { + mvr2r( st_ivas->hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 ); + } if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, @@ -1833,6 +1848,10 @@ ivas_error ivas_rend_crendProcessSplitBin( { return error; } + for ( i = 0; i < 3; i++ ) + { + mvr2r( pCombinedOrientationDataLocal->Rmat_prev[0][i], st_ivas->hCombinedOrientationData->Rmat_prev[pos_idx][i], 3 ); + } for ( i = 0; i < BINAURAL_CHANNELS; ++i ) { @@ -1841,8 +1860,11 @@ ivas_error ivas_rend_crendProcessSplitBin( /* move to split bin output buffer */ mvr2r( tmpInputBuffer[i], tmpSplitBinBuffer[pos_idx * BINAURAL_CHANNELS + i], output_frame ); + } - /* overwrite rendered channels with input again for next iteration */ + /* overwrite rendered channels with input again for next iteration */ + for ( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE; ++i ) + { mvr2r( output[i], tmpInputBuffer[i], output_frame ); } @@ -1853,6 +1875,7 @@ ivas_error ivas_rend_crendProcessSplitBin( } } + /* copy split binaural rendered signals to final output */ for ( i = 0; i < BINAURAL_CHANNELS * pMultiBinPoseData->num_poses; ++i ) { diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7cd9b533f6..ee7ec16b46 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -363,7 +363,12 @@ void rotateFrame_shd( /* calculate ambisonics rotation matrices for the previous and current frames */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev[0], shd_rot_max_order ); +#else SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev, shd_rot_max_order ); +#endif + SHrotmatgen( SHrotmat, hCombinedOrientationData->Rmat[subframe_idx], shd_rot_max_order ); for ( i = 0; i < subframe_len; i++ ) @@ -416,7 +421,11 @@ void rotateFrame_shd( /* move Rmat to Rmat_prev */ for ( i = 0; i < 3; i++ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[0][i], 3 ); +#else mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[i], 3 ); +#endif } return; @@ -483,7 +492,12 @@ void rotateFrame_sd( ch_in_woLFE = ( ch_in >= index_lfe ) ? ch_in - 1 : ch_in; /* gains for previous subframe rotation */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + rotateAziEle( hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev[0], hTransSetup.is_planar_setup ); +#else rotateAziEle( hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev, hTransSetup.is_planar_setup ); +#endif + if ( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) ) { efap_determine_gains( hEFAPdata, tmp_gains, azimuth, elevation, EFAP_MODE_EFAP ); @@ -541,7 +555,11 @@ void rotateFrame_sd( /* move Rmat to Rmat_prev */ for ( i = 0; i < 3; i++ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[0][i], 3 ); +#else mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[i], 3 ); +#endif } /* copy to output */ @@ -830,6 +848,9 @@ ivas_error ivas_combined_orientation_open( int16_t i, j; IVAS_QUATERNION identity; IVAS_VECTOR3 origo; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx; +#endif identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; @@ -867,12 +888,22 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f; } } - +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + for ( j = 0; j < 3; j++ ) + { + set_zero( ( *hCombinedOrientationData )->Rmat_prev[pos_idx][j], 3 ); + ( *hCombinedOrientationData )->Rmat_prev[pos_idx][j][j] = 1.0f; + } + } +#else for ( j = 0; j < 3; j++ ) { set_zero( ( *hCombinedOrientationData )->Rmat_prev[j], 3 ); ( *hCombinedOrientationData )->Rmat_prev[j][j] = 1.0f; } +#endif set_zero( ( *hCombinedOrientationData )->chEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hCombinedOrientationData )->chEneIIR[1], MASA_FREQUENCY_BANDS ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index cb310c02c8..9d75bbbe2f 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -501,7 +501,11 @@ typedef struct ivas_combined_orientation_struct IVAS_QUATERNION Quaternions_ext_interpolation_start; IVAS_QUATERNION Quaternions_ext_interpolation_target; float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Rmat_prev[MAX_HEAD_ROT_POSES][3][3]; +#else float Rmat_prev[3][3]; +#endif float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ float procChEneIIR[2][MASA_FREQUENCY_BANDS]; int16_t shd_rot_max_order; -- GitLab From 7792d3cdd2e9df102631bd433f68615a57b0126a Mon Sep 17 00:00:00 2001 From: hmund Date: Thu, 13 Jul 2023 09:50:17 +0200 Subject: [PATCH 341/591] restructure code to convert to CLDFB domain --- .../SHD_2_ROM.m | 10 +- .../fir_to_cldfb_fir.m | 300 ++++++++++++++++++ 2 files changed, 306 insertions(+), 4 deletions(-) create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m index 30df2d17f0..0d3271c80c 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -54,8 +54,9 @@ end % convert sphere-sampled HRIRs to SHD HRIRs hrir_len = 128; ambi_order = 3; +write_out_sofa = 0; [sofa_path,sofa_name, sofa_ext] = fileparts(sofa_file); -IR = generate_HOA_HRIRs_MOD_lens(ambi_order, py_path, sofa_path, [sofa_name,sofa_ext], hrir_len); +IR = generate_HOA_HRIRs_MOD_lens(ambi_order, py_path, sofa_path, [sofa_name,sofa_ext], hrir_len, write_out_sofa); % load([thispath,'HRIR_128_48000_dolby_SBA3.mat'],'IR'); gives the same data as the above with default sofa file %% SHD -> CLDFB via least squares error optimization @@ -63,10 +64,11 @@ IR = generate_HOA_HRIRs_MOD_lens(ambi_order, py_path, sofa_path, [sofa_name,sofa num_cldfb_taps = 3; IR_cldfb = zeros(60,num_cldfb_taps,num_ears,num_ch); % 60 frequency bands eval_flag = 0; % optional, = 1 requires signal processing toolbox (fftfilt) +legacy_flag = 1; % = 1 used to indicate slightly too short buffers as used to generate tested coefficients for pos = 1:num_ch disp(['Channel ',num2str(pos),'/',num2str(num_ch)]) for ear = 1:num_ears - IR_cldfb(:,:,ear,pos) = fir_to_cldfb_fir( IR(:,ear,pos), num_cldfb_taps, eval_flag ); + IR_cldfb(:,:,ear,pos) = fir_to_cldfb_fir( IR(:,ear,pos), num_cldfb_taps, eval_flag, legacy_flag ); end end @@ -98,13 +100,13 @@ writeData3L(fid, ['const float rightHRIRImag_' order '[BINAURAL_CONVBANDS][' ord fclose(fid); rmpath(fullfile(thispath,'..','param_bin')); -function F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag ) +function F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag, legacy_flag ) [pFilter, D, S, L] = get_cldfb_filter; cldfb_delay = D - S + 1; % processing delay given stride pFilt = sqrt(S)/L * pFilter(:); N = length(pFilt); -legacy_flag = 1; % = 1 used to indicate slightly too short buffers as used to generate tested coefficients +%legacy_flag = 1; % = 1 used to indicate slightly too short buffers as used to generate tested coefficients % Filter Bank analysis / synthesis filters cldfb_mod_mat = exp(1i*((0:N-1)'-D/2) * ((0:L-1)+0.5) * pi/L ); % N x L modulation matrix with alternating sign periodicity of 2*L in time (row) direction diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m new file mode 100644 index 0000000000..6baf2c863d --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m @@ -0,0 +1,300 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag, legacy_flag ) +% F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag, legacy_flag ) +% +% computes complex-valued FIR coefficients to be applied in the CLDFB analysis domain +% which approximate time domain filtering with given target FIR coefficients +% in a least squares sense. + +[pFilter, D, S, L] = get_cldfb_filter; +cldfb_delay = D - S + 1; % processing delay given stride +pFilt = sqrt(S)/L * pFilter(:); +N = length(pFilt); +%legacy_flag = 1; % = 1 used to indicate slightly too short buffers as used to generate tested coefficients + +% Filter Bank analysis / synthesis filters +cldfb_mod_mat = exp(1i*((0:N-1)'-D/2) * ((0:L-1)+0.5) * pi/L ); % N x L modulation matrix with alternating sign periodicity of 2*L in time (row) direction +cldfb_ansyn_filters = pFilt .* cldfb_mod_mat; % all (L) analysis/synthesis filters + +target_fir = target_fir(:); +fir_length = length(target_fir); + +%% brute force least squares +if legacy_flag + num_slots = ceil(fir_length/S) + 10; % used to generate tested IVAS coefficients in CLDFB HRIR ROM with slightly too short buffers + inp_len = S * num_slots; + len = inp_len - cldfb_delay; + idx_opt = cldfb_delay + (1:len); + pos_offset = 200; +else + num_slots = ceil((fir_length + 2 * N - 1) / S); % convolution with target fir, analysis + synthesis filters (of length N each) + len = S * num_slots; + inp_len = len; + idx_opt = (1:len); % use all output samples in the optimization, including the filter bank delay + pos_offset = 0; +end + +% Big trial and error +Nbins = num_cldfb_taps * L; +Vreal = zeros(S*len, Nbins); % all real for all shifts concatenated for each mask bin, +Vimag = zeros(S*len, Nbins); % then all imag +r = zeros(S*len,1); % right hand side all shifts concatenated + +x = zeros(inp_len,1); +for pos = 1:S + % input dirac pulse + x(:) = 0; + + % target impulse response y0 for input pulse at pos + out = x; + out(pos+pos_offset+(0:fir_length-1)) = target_fir; + y0 = [zeros(cldfb_delay,1);out(1:end-cldfb_delay)]; + r(len*(pos-1)+(1:len)) = y0(idx_opt); + fprintf('.'); + + % CLDFB analysis for impulse input + x(pos+pos_offset) = 1; + X = zeros(L,num_slots); + frm_idx = (1:N)'; + x_tmp = [zeros(N-S,1);x]; + for slt = 1:num_slots + X(:,slt) = sum(cldfb_ansyn_filters.*flipud(x_tmp(frm_idx))).'; + frm_idx = frm_idx + S; + end + for cldfb_bin = 1:Nbins + cldfb_band = rem(cldfb_bin-1,L)+1; + cldfb_lag = fix((cldfb_bin-1)/L); + + % real-valued filter contribution of a single tap + frm_idx = cldfb_lag * S + (1:N)'; + y_tmp = zeros( num_slots * S + N - S,1); + for slt = cldfb_lag+1:num_slots + y_tmp(frm_idx) = y_tmp(frm_idx) + real(X(cldfb_band,slt-cldfb_lag) * cldfb_ansyn_filters(:,cldfb_band)); + frm_idx = frm_idx + S; + end + Vreal(len*(pos-1)+1:len*pos,cldfb_bin) = y_tmp(idx_opt); + + % imaginary-valued filter contribution of a single tap + frm_idx = cldfb_lag * S + (1:N)'; + y_tmp(:) = 0; + for slt = cldfb_lag+1:num_slots + y_tmp(frm_idx) = y_tmp(frm_idx) + real(1i*X(cldfb_band,slt-cldfb_lag) * cldfb_ansyn_filters(:,cldfb_band)); + frm_idx = frm_idx + S; + end + Vimag(len*(pos-1)+1:len*pos,cldfb_bin) = y_tmp(idx_opt); + end % bin +end % pos +fprintf('\n'); + +% solve lsq +V = [Vreal,Vimag]; +M = V'*V; +Mrel = M + 1e-8*norm(M)*eye(size(M)); +c = Mrel\(V'*r); + +% map back to mask locations +F = zeros(L,num_cldfb_taps); +for cldfb_bin = 1:Nbins + F(cldfb_bin) = c(cldfb_bin)+1i*c(Nbins+cldfb_bin); +end + +if eval_flag + % evaluation (not needed for table generation, needs signal processing toolbox) + get_snr( target_fir, F, cldfb_ansyn_filters, cldfb_delay, S ); +end + +function get_snr( target_fir, cldfb_firs, cldfb_ansyn_filters, cldfb_delay, S ) + +rng(0); +num_samples = 5*48000; +x = randn(num_samples,1); + +% Filter noise in time domain +y1 = fftfilt(target_fir,x); + +% Filter noise in CLDFB domain +[N,L] = size(cldfb_ansyn_filters); +num_slots = ceil((num_samples + cldfb_delay) / S); +% analysis +X = zeros(L,num_slots); +frm_idx = (1:N)'; +x_tmp = [zeros(N-S,1);x;zeros(cldfb_delay,1)]; +for slt = 1:num_slots + X(:,slt) = sum(cldfb_ansyn_filters.*flipud(x_tmp(frm_idx))).'; + frm_idx = frm_idx + S; +end +% filter +X = fftfilt(cldfb_firs.',X.').'; +% synthesis +frm_idx = (1:N)'; +y_tmp = zeros( num_slots * S + N - S,1); +for slt = 1:num_slots + y_tmp(frm_idx) = y_tmp(frm_idx) + real(sum(X(:,slt).' .* cldfb_ansyn_filters,2)); + frm_idx = frm_idx + S; +end +y2 = y_tmp(cldfb_delay+(1:num_samples)); + +plot(y1), hold on, plot(y2,'r--'), plot(y1-y2,'k'), hold off +set(gca,'xlim',[1,num_samples]) +fprintf('SNR: %.1f dB \n', 10*log10(sum(y1.^2)/sum((y1-y2).^2))); +legend('time domain','CLDFB domain','difference') +title('Filtered noise') + +function [h, D, S, L] = get_cldfb_filter() +% const float LDQMF_60[] in \lib_com\rom_com.c, line 5219 +S = 60; % stride +L = 60; % frequency bands +D = 240 + S - 1; % system delay +h = [ + 0.0000953076, 0.0001230230, 0.0001279964, 0.0001260533, 0.0001211219 + 0.0001122123, 0.0001010860, 0.0000876540, 0.0000719883, 0.0000545472 + 0.0000352143, 0.0000145686, -0.0000074264, -0.0000303788, -0.0000539205 + -0.0000782743, -0.0001028838, -0.0001275374, -0.0001520015, -0.0001760167 + -0.0001997108, -0.0002226708, -0.0002446725, -0.0002655797, -0.0002852145 + -0.0003034996, -0.0003203036, -0.0003356283, -0.0003493345, -0.0003614030 + -0.0003719004, -0.0003807641, -0.0003881051, -0.0003939842, -0.0003985357 + -0.0004019095, -0.0004041938, -0.0004056677, -0.0004065430, -0.0004069925 + -0.0004072535, -0.0004075877, -0.0004083676, -0.0004098394, -0.0004122990 + -0.0004160839, -0.0004214063, -0.0004285777, -0.0004378651, -0.0004495422 + -0.0004637682, -0.0004806494, -0.0005003878, -0.0005231378, -0.0005489803 + -0.0005777747, -0.0006095612, -0.0006443121, -0.0006813223, -0.0007226231 + -0.0007722576, -0.0008268412, -0.0008839625, -0.0009417336, -0.0010004630 + -0.0010601623, -0.0011206097, -0.0011817788, -0.0012432419, -0.0013045983 + -0.0013656860, -0.0014260965, -0.0014855355, -0.0015435946, -0.0015999591 + -0.0016543545, -0.0017062968, -0.0017554691, -0.0018015467, -0.0018441341 + -0.0018829798, -0.0019177221, -0.0019480695, -0.0019736972, -0.0019943134 + -0.0020097434, -0.0020197174, -0.0020240925, -0.0020226294, -0.0020152442 + -0.0020017736, -0.0019820682, -0.0019561697, -0.0019240153, -0.0018855907 + -0.0018409232, -0.0017900462, -0.0017330211, -0.0016699535, -0.0016009507 + -0.0015261442, -0.0014456788, -0.0013597424, -0.0012685407, -0.0011722331 + -0.0010710671, -0.0009652392, -0.0008549765, -0.0007405236, -0.0006221444 + -0.0005001140, -0.0003745670, -0.0002458634, -0.0001142541, 0.0000199491 + 0.0001564174, 0.0002949402, 0.0004350246, 0.0005769439, 0.0007203126 + -0.0008803223, -0.0010328424, -0.0011841310, -0.0013346316, -0.0014848098 + -0.0016343417, -0.0017832819, -0.0019316213, -0.0020790498, -0.0022252349 + -0.0023701149, -0.0025136294, -0.0026556554, -0.0027960713, -0.0029348312 + -0.0030717771, -0.0032068293, -0.0033399195, -0.0034709862, -0.0035999804 + -0.0037267797, -0.0038513308, -0.0039736414, -0.0040935921, -0.0042111278 + -0.0043262239, -0.0044388464, -0.0045489701, -0.0046565188, -0.0047614835 + -0.0048637423, -0.0049632201, -0.0050599808, -0.0051539382, -0.0052450863 + -0.0053333500, -0.0054187514, -0.0055012843, -0.0055808770, -0.0056575472 + -0.0057313135, -0.0058021732, -0.0058701355, -0.0059352517, -0.0059975707 + -0.0060571772, -0.0061141332, -0.0061685541, -0.0062205540, -0.0062703062 + -0.0063179093, -0.0063635921, -0.0064075105, -0.0064498796, -0.0064908965 + -0.0065308069, -0.0065698619, -0.0066083665, -0.0066466411, -0.0066849431 + -0.0067233290, -0.0067621553, -0.0068021296, -0.0068436749, -0.0068870094 + -0.0069324085, -0.0069801519, -0.0070305937, -0.0070840055, -0.0071406048 + -0.0072006541, -0.0072644479, -0.0073321410, -0.0074039386, -0.0074799177 + -0.0075602704, -0.0076450342, -0.0077342330, -0.0078278277, -0.0079257628 + -0.0080279401, -0.0081341872, -0.0082442267, -0.0083577875, -0.0084744738 + -0.0085938899, -0.0087156557, -0.0088391500, -0.0089637861, -0.0090888245 + -0.0092134504, -0.0093367994, -0.0094579896, -0.0095760096, -0.0096898535 + -0.0097982995, -0.0099003557, -0.0099947909, -0.0100801717, -0.0101551116 + -0.0102182031, -0.0102678994, -0.0103026126, -0.0103207529, -0.0103206923 + -0.0103006857, -0.0102590285, -0.0101939747, -0.0101036867, -0.0099863587 + -0.0098401112, -0.0096632261, -0.0094537362, -0.0092098210, -0.0089295702 + -0.0086111929, -0.0082527259, -0.0078523541, -0.0074084769, -0.0069190590 + 0.0063841688, 0.0057985946, 0.0051621343, 0.0044734711, 0.0037309236 + 0.0029329660, 0.0020781513, 0.0011651339, 0.0001925042, -0.0008409545 + -0.0019364181, -0.0030950012, -0.0043176264, -0.0056051607, -0.0069584334 + -0.0083780792, -0.0098646237, -0.0114185056, -0.0130400723, -0.0147295250 + -0.0164868534, -0.0183120724, -0.0202049762, -0.0221651513, -0.0241921283 + -0.0262852497, -0.0284437388, -0.0306666382, -0.0329528190, -0.0353010744 + -0.0377098918, -0.0401776619, -0.0427025780, -0.0452826768, -0.0479161367 + -0.0506004691, -0.0533332452, -0.0561118126, -0.0589331910, -0.0617944039 + -0.0646922663, -0.0676232576, -0.0705836788, -0.0735698044, -0.0765774846 + -0.0796026587, -0.0826408863, -0.0856874809, -0.0887378305, -0.0917868018 + -0.0948293805, -0.0978601947, -0.1008738130, -0.1038645208, -0.1068264544 + -0.1097536832, -0.1126400903, -0.1154794544, -0.1182654947, -0.1209914312 + -0.1236500666, -0.1262341589, -0.1287376434, -0.1311538219, -0.1334753036 + -0.1356947273, -0.1378047168, -0.1397978216, -0.1416664869, -0.1434033662 + -0.1450008005, -0.1464512348, -0.1477471888, -0.1488809884, -0.1498452872 + -0.1506324410, -0.1512351334, -0.1516460329, -0.1518578976, -0.1518635303 + -0.1516559124, -0.1512281001, -0.1505732536, -0.1496847868, -0.1485562176 + -0.1471813470, -0.1455538720, -0.1436681300, -0.1415183097, -0.1390990764 + -0.1364052594, -0.1334318966, -0.1301742792, -0.1266280264, -0.1227891371 + -0.1186537445, -0.1142183766, -0.1094799563, -0.1044355705, -0.0990828425 + -0.0934195668, -0.0874440819, -0.0811550021, -0.0745511875, -0.0676321834 + -0.0603975877, -0.0528475679, -0.0449828543, -0.0368040986, -0.0283128861 + -0.0195108838, -0.0104003223, -0.0009837818, 0.0087356847, 0.0187546927 + 0.0290693250, 0.0396753438, 0.0505682528, 0.0617432520, 0.0731955394 + -0.0849232078, -0.0969054326, -0.1091460735, -0.1216373071, -0.1343720406 + -0.1473424733, -0.1605402082, -0.1739567965, -0.1875831038, -0.2014097124 + -0.2154271752, -0.2296251506, -0.2439934313, -0.2585212290, -0.2731975317 + -0.2880111337, -0.3029502928, -0.3180032372, -0.3331578076, -0.3484017253 + -0.3637222052, -0.3791064322, -0.3945416212, -0.4100143015, -0.4255111217 + -0.4410185516, -0.4565227628, -0.4720100164, -0.4874662757, -0.5028775334 + -0.5182296634, -0.5335084200, -0.5486994982, -0.5637886524, -0.5787616372 + -0.5936041474, -0.6083019376, -0.6228409410, -0.6372069120, -0.6513859630 + -0.6653640866, -0.6791275144, -0.6926627755, -0.7059561610, -0.7189947963 + -0.7317654490, -0.7442554235, -0.7564523220, -0.7683438063, -0.7799182534 + -0.7911639810, -0.8020697832, -0.8126249313, -0.8228194118, -0.8326428533 + -0.8420860767, -0.8511404991, -0.8597975969, -0.8680517077, -0.8758881092 + -0.8832823634, -0.8902196884, -0.8967157602, -0.9027729034, -0.9083824754 + -0.9135394692, -0.9182395935, -0.9224776030, -0.9262499809, -0.9295535684 + -0.9323854446, -0.9347436428, -0.9366261959, -0.9380323887, -0.9389615655 + -0.9394137263, -0.9393896461, -0.9388904572, -0.9379178882, -0.9364743829 + -0.9345626831, -0.9321863055, -0.9293491840, -0.9260557890, -0.9223110080 + -0.9181203246, -0.9134896994, -0.9084255695, -0.9029349089, -0.8970250487 + -0.8907034993, -0.8839784265, -0.8768582940, -0.8693521619, -0.8614694476 + -0.8532197475, -0.8446131349, -0.8356599212, -0.8263708353, -0.8167568445 + -0.8068289757, -0.7965991497, -0.7860788107, -0.7752800584, -0.7642148733 + -0.7528960109, -0.7413358092, -0.7295469642, -0.7175422311, -0.7053351402 + -0.6929380894, -0.6803644896, -0.6676273942, -0.6547405124, -0.6417166591 + -0.6285686493, -0.6153115034, -0.6019562483, -0.5885198116, -0.5750215650 + 0.5615197420, 0.5478612781, 0.5341838002, 0.5204906464, 0.5067980289 + 0.4931168854, 0.4794588387, 0.4658361673, 0.4522601366, 0.4387422502 + 0.4252935350, 0.4119254053, 0.3986486793, 0.3854739666, 0.3724119067 + 0.3594728410, 0.3466667533, 0.3340034485, 0.3214924335, 0.3091430366 + 0.2969639599, 0.2849639654, 0.2731511295, 0.2615332901, 0.2501178682 + 0.2389119864, 0.2279221565, 0.2171545923, 0.2066148520, 0.1963084787 + 0.1862401515, 0.1764142811, 0.1668347418, 0.1575049609, 0.1484276950 + 0.1396053135, 0.1310400218, 0.1227331311, 0.1146853194, 0.1068974212 + 0.0993694067, 0.0921007246, 0.0850901082, 0.0783365741, 0.0718384907 + 0.0655927584, 0.0595967993, 0.0538481586, 0.0483424664, 0.0430756323 + 0.0380428955, 0.0332404599, 0.0286619961, 0.0242999699, 0.0201510899 + 0.0162059069, 0.0124559226, 0.0088928537, 0.0054926532, 0.0023052765 + -0.0005515143, -0.0030201224, -0.0052712574, -0.0073737046, -0.0093160523 + -0.0111072771, -0.0127562135, -0.0142635731, -0.0156361461, -0.0168790054 + -0.0179969221, -0.0189934950, -0.0198726747, -0.0206398536, -0.0212980714 + -0.0218509119, -0.0223025978, -0.0226570386, -0.0229178313, -0.0230882075 + -0.0231725387, -0.0231746566, -0.0230979007, -0.0229462404, -0.0227237809 + -0.0224345829, -0.0220820960, -0.0216706358, -0.0212045144, -0.0206875466 + -0.0201238506, -0.0195175279, -0.0188730918, -0.0181944817, -0.0174855441 + -0.0167510118, -0.0159947462, -0.0152208358, -0.0144332750, -0.0136361914 + -0.0128338682, -0.0120294262, -0.0112272501, -0.0104311826, -0.0096443929 + -0.0088709844, -0.0081134979, -0.0073764324, -0.0066623385, -0.0059733889 + -0.0053142183, -0.0046856776, -0.0040914025, -0.0035321070, -0.0030089030 + -0.0025271603, -0.0020749648, -0.0016621647, -0.0012705614, -0.0008115423 +]; +h = h.'; +h = h(:); +h(1*120+(1:120)) = -h(1*120+(1:120)); +h(3*120+(1:120)) = -h(3*120+(1:120)); +h(:) = h(end:-1:1); \ No newline at end of file -- GitLab From eaf9690d5dc5af81cee87d7456550271b11d2607 Mon Sep 17 00:00:00 2001 From: hmund Date: Thu, 13 Jul 2023 09:51:15 +0200 Subject: [PATCH 342/591] avoid trying to reload pyenv --- .../generate_HOA_HRIRs_MOD_lens.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m index 8c35cc416a..db4aee721b 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m @@ -44,7 +44,10 @@ function IR_data = generate_HOA_HRIRs_MOD_lens(order, python_path, sofa_path, so % % Pointing to the correct python binary -pyenv('Version', python_path); +py_env = pyenv; +if ~strcmp(py_env.Executable, python_path) + pyenv('Version', python_path); +end % Load in the support coefs load('hrtf_support_coefs.mat', 'hrtf_support_coefs'); -- GitLab From 9730dd97f585754363ad51de3eddacbabcb25eaa Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 13 Jul 2023 17:53:44 +1000 Subject: [PATCH 343/591] fix clang formatting --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 82686a2af3..1c3a6b4816 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1558,7 +1558,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( #ifdef SPLIT_REND_WITH_HEAD_ROT hRenderConfig->split_rend_config = renderConfig.split_rend_config; - + /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ if ( hRenderConfig->split_rend_config.dof == 0 ) { -- GitLab From 2bd1e704987d2e946823a6a16637d77fde2d17ac Mon Sep 17 00:00:00 2001 From: hmund Date: Thu, 13 Jul 2023 09:54:30 +0200 Subject: [PATCH 344/591] remove code that was moved to seperate function fir_to_cldfb_fir --- .../SHD_2_ROM.m | 269 ------------------ 1 file changed, 269 deletions(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m index 0d3271c80c..a5450625f3 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -99,272 +99,3 @@ writeData3L(fid, ['const float rightHRIRImag_' order '[BINAURAL_CONVBANDS][' ord fclose(fid); rmpath(fullfile(thispath,'..','param_bin')); - -function F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag, legacy_flag ) - -[pFilter, D, S, L] = get_cldfb_filter; -cldfb_delay = D - S + 1; % processing delay given stride -pFilt = sqrt(S)/L * pFilter(:); -N = length(pFilt); -%legacy_flag = 1; % = 1 used to indicate slightly too short buffers as used to generate tested coefficients - -% Filter Bank analysis / synthesis filters -cldfb_mod_mat = exp(1i*((0:N-1)'-D/2) * ((0:L-1)+0.5) * pi/L ); % N x L modulation matrix with alternating sign periodicity of 2*L in time (row) direction -cldfb_ansyn_filters = pFilt .* cldfb_mod_mat; % all (L) analysis/synthesis filters - -target_fir = target_fir(:); -fir_length = length(target_fir); - -%% brute force least squares -if legacy_flag - num_slots = ceil(fir_length/S) + 10; % used to generate tested IVAS coefficients in CLDFB HRIR ROM with slightly too short buffers - inp_len = S * num_slots; - len = inp_len - cldfb_delay; - idx_opt = cldfb_delay + (1:len); - pos_offset = 200; -else - num_slots = ceil((fir_length + 2 * N - 1) / S); % convolution with target fir, analysis + synthesis filters (of length N each) - len = S * num_slots; - inp_len = len; - idx_opt = (1:len); % use all output samples in the optimization, including the filter bank delay - pos_offset = 0; -end - -% Big trial and error -Nbins = num_cldfb_taps * L; -Vreal = zeros(S*len, Nbins); % all real for all shifts concatenated for each mask bin, -Vimag = zeros(S*len, Nbins); % then all imag -r = zeros(S*len,1); % right hand side all shifts concatenated - -x = zeros(inp_len,1); -for pos = 1:S - % input dirac pulse - x(:) = 0; - - % target impulse response y0 for input pulse at pos - out = x; - out(pos+pos_offset+(0:fir_length-1)) = target_fir; - y0 = [zeros(cldfb_delay,1);out(1:end-cldfb_delay)]; - r(len*(pos-1)+(1:len)) = y0(idx_opt); - fprintf('.'); - - % CLDFB analysis for impulse input - x(pos+pos_offset) = 1; - X = zeros(L,num_slots); - frm_idx = (1:N)'; - x_tmp = [zeros(N-S,1);x]; - for slt = 1:num_slots - X(:,slt) = sum(cldfb_ansyn_filters.*flipud(x_tmp(frm_idx))).'; - frm_idx = frm_idx + S; - end - for cldfb_bin = 1:Nbins - cldfb_band = rem(cldfb_bin-1,L)+1; - cldfb_lag = fix((cldfb_bin-1)/L); - - % real-valued filter contribution of a single tap - frm_idx = cldfb_lag * S + (1:N)'; - y_tmp = zeros( num_slots * S + N - S,1); - for slt = cldfb_lag+1:num_slots - y_tmp(frm_idx) = y_tmp(frm_idx) + real(X(cldfb_band,slt-cldfb_lag) * cldfb_ansyn_filters(:,cldfb_band)); - frm_idx = frm_idx + S; - end - Vreal(len*(pos-1)+1:len*pos,cldfb_bin) = y_tmp(idx_opt); - - % imaginary-valued filter contribution of a single tap - frm_idx = cldfb_lag * S + (1:N)'; - y_tmp(:) = 0; - for slt = cldfb_lag+1:num_slots - y_tmp(frm_idx) = y_tmp(frm_idx) + real(1i*X(cldfb_band,slt-cldfb_lag) * cldfb_ansyn_filters(:,cldfb_band)); - frm_idx = frm_idx + S; - end - Vimag(len*(pos-1)+1:len*pos,cldfb_bin) = y_tmp(idx_opt); - end % bin -end % pos -fprintf('\n'); - -% solve lsq -V = [Vreal,Vimag]; -M = V'*V; -Mrel = M + 1e-8*norm(M)*eye(size(M)); -c = Mrel\(V'*r); - -% map back to mask locations -F = zeros(L,num_cldfb_taps); -for cldfb_bin = 1:Nbins - F(cldfb_bin) = c(cldfb_bin)+1i*c(Nbins+cldfb_bin); -end - -if eval_flag - % evaluation (not needed for table generation, needs signal processing toolbox) - get_snr( target_fir, F, cldfb_ansyn_filters, cldfb_delay, S ); -end - -function get_snr( target_fir, cldfb_firs, cldfb_ansyn_filters, cldfb_delay, S ) - -rng(0); -num_samples = 5*48000; -x = randn(num_samples,1); - -% Filter noise in time domain -y1 = fftfilt(target_fir,x); - -% Filter noise in CLDFB domain -[N,L] = size(cldfb_ansyn_filters); -num_slots = ceil((num_samples + cldfb_delay) / S); -% analysis -X = zeros(L,num_slots); -frm_idx = (1:N)'; -x_tmp = [zeros(N-S,1);x;zeros(cldfb_delay,1)]; -for slt = 1:num_slots - X(:,slt) = sum(cldfb_ansyn_filters.*flipud(x_tmp(frm_idx))).'; - frm_idx = frm_idx + S; -end -% filter -X = fftfilt(cldfb_firs.',X.').'; -% synthesis -frm_idx = (1:N)'; -y_tmp = zeros( num_slots * S + N - S,1); -for slt = 1:num_slots - y_tmp(frm_idx) = y_tmp(frm_idx) + real(sum(X(:,slt).' .* cldfb_ansyn_filters,2)); - frm_idx = frm_idx + S; -end -y2 = y_tmp(cldfb_delay+(1:num_samples)); - -plot(y1), hold on, plot(y2,'r--'), plot(y1-y2,'k'), hold off -set(gca,'xlim',[1,num_samples]) -fprintf('SNR: %.1f dB \n', 10*log10(sum(y1.^2)/sum((y1-y2).^2))); -legend('time domain','CLDFB domain','difference') -title('Filtered noise') - -function [h, D, S, L] = get_cldfb_filter() -% const float LDQMF_60[] in \lib_com\rom_com.c, line 5219 -S = 60; % stride -L = 60; % frequency bands -D = 240 + S - 1; % system delay -h = [ - 0.0000953076, 0.0001230230, 0.0001279964, 0.0001260533, 0.0001211219 - 0.0001122123, 0.0001010860, 0.0000876540, 0.0000719883, 0.0000545472 - 0.0000352143, 0.0000145686, -0.0000074264, -0.0000303788, -0.0000539205 - -0.0000782743, -0.0001028838, -0.0001275374, -0.0001520015, -0.0001760167 - -0.0001997108, -0.0002226708, -0.0002446725, -0.0002655797, -0.0002852145 - -0.0003034996, -0.0003203036, -0.0003356283, -0.0003493345, -0.0003614030 - -0.0003719004, -0.0003807641, -0.0003881051, -0.0003939842, -0.0003985357 - -0.0004019095, -0.0004041938, -0.0004056677, -0.0004065430, -0.0004069925 - -0.0004072535, -0.0004075877, -0.0004083676, -0.0004098394, -0.0004122990 - -0.0004160839, -0.0004214063, -0.0004285777, -0.0004378651, -0.0004495422 - -0.0004637682, -0.0004806494, -0.0005003878, -0.0005231378, -0.0005489803 - -0.0005777747, -0.0006095612, -0.0006443121, -0.0006813223, -0.0007226231 - -0.0007722576, -0.0008268412, -0.0008839625, -0.0009417336, -0.0010004630 - -0.0010601623, -0.0011206097, -0.0011817788, -0.0012432419, -0.0013045983 - -0.0013656860, -0.0014260965, -0.0014855355, -0.0015435946, -0.0015999591 - -0.0016543545, -0.0017062968, -0.0017554691, -0.0018015467, -0.0018441341 - -0.0018829798, -0.0019177221, -0.0019480695, -0.0019736972, -0.0019943134 - -0.0020097434, -0.0020197174, -0.0020240925, -0.0020226294, -0.0020152442 - -0.0020017736, -0.0019820682, -0.0019561697, -0.0019240153, -0.0018855907 - -0.0018409232, -0.0017900462, -0.0017330211, -0.0016699535, -0.0016009507 - -0.0015261442, -0.0014456788, -0.0013597424, -0.0012685407, -0.0011722331 - -0.0010710671, -0.0009652392, -0.0008549765, -0.0007405236, -0.0006221444 - -0.0005001140, -0.0003745670, -0.0002458634, -0.0001142541, 0.0000199491 - 0.0001564174, 0.0002949402, 0.0004350246, 0.0005769439, 0.0007203126 - -0.0008803223, -0.0010328424, -0.0011841310, -0.0013346316, -0.0014848098 - -0.0016343417, -0.0017832819, -0.0019316213, -0.0020790498, -0.0022252349 - -0.0023701149, -0.0025136294, -0.0026556554, -0.0027960713, -0.0029348312 - -0.0030717771, -0.0032068293, -0.0033399195, -0.0034709862, -0.0035999804 - -0.0037267797, -0.0038513308, -0.0039736414, -0.0040935921, -0.0042111278 - -0.0043262239, -0.0044388464, -0.0045489701, -0.0046565188, -0.0047614835 - -0.0048637423, -0.0049632201, -0.0050599808, -0.0051539382, -0.0052450863 - -0.0053333500, -0.0054187514, -0.0055012843, -0.0055808770, -0.0056575472 - -0.0057313135, -0.0058021732, -0.0058701355, -0.0059352517, -0.0059975707 - -0.0060571772, -0.0061141332, -0.0061685541, -0.0062205540, -0.0062703062 - -0.0063179093, -0.0063635921, -0.0064075105, -0.0064498796, -0.0064908965 - -0.0065308069, -0.0065698619, -0.0066083665, -0.0066466411, -0.0066849431 - -0.0067233290, -0.0067621553, -0.0068021296, -0.0068436749, -0.0068870094 - -0.0069324085, -0.0069801519, -0.0070305937, -0.0070840055, -0.0071406048 - -0.0072006541, -0.0072644479, -0.0073321410, -0.0074039386, -0.0074799177 - -0.0075602704, -0.0076450342, -0.0077342330, -0.0078278277, -0.0079257628 - -0.0080279401, -0.0081341872, -0.0082442267, -0.0083577875, -0.0084744738 - -0.0085938899, -0.0087156557, -0.0088391500, -0.0089637861, -0.0090888245 - -0.0092134504, -0.0093367994, -0.0094579896, -0.0095760096, -0.0096898535 - -0.0097982995, -0.0099003557, -0.0099947909, -0.0100801717, -0.0101551116 - -0.0102182031, -0.0102678994, -0.0103026126, -0.0103207529, -0.0103206923 - -0.0103006857, -0.0102590285, -0.0101939747, -0.0101036867, -0.0099863587 - -0.0098401112, -0.0096632261, -0.0094537362, -0.0092098210, -0.0089295702 - -0.0086111929, -0.0082527259, -0.0078523541, -0.0074084769, -0.0069190590 - 0.0063841688, 0.0057985946, 0.0051621343, 0.0044734711, 0.0037309236 - 0.0029329660, 0.0020781513, 0.0011651339, 0.0001925042, -0.0008409545 - -0.0019364181, -0.0030950012, -0.0043176264, -0.0056051607, -0.0069584334 - -0.0083780792, -0.0098646237, -0.0114185056, -0.0130400723, -0.0147295250 - -0.0164868534, -0.0183120724, -0.0202049762, -0.0221651513, -0.0241921283 - -0.0262852497, -0.0284437388, -0.0306666382, -0.0329528190, -0.0353010744 - -0.0377098918, -0.0401776619, -0.0427025780, -0.0452826768, -0.0479161367 - -0.0506004691, -0.0533332452, -0.0561118126, -0.0589331910, -0.0617944039 - -0.0646922663, -0.0676232576, -0.0705836788, -0.0735698044, -0.0765774846 - -0.0796026587, -0.0826408863, -0.0856874809, -0.0887378305, -0.0917868018 - -0.0948293805, -0.0978601947, -0.1008738130, -0.1038645208, -0.1068264544 - -0.1097536832, -0.1126400903, -0.1154794544, -0.1182654947, -0.1209914312 - -0.1236500666, -0.1262341589, -0.1287376434, -0.1311538219, -0.1334753036 - -0.1356947273, -0.1378047168, -0.1397978216, -0.1416664869, -0.1434033662 - -0.1450008005, -0.1464512348, -0.1477471888, -0.1488809884, -0.1498452872 - -0.1506324410, -0.1512351334, -0.1516460329, -0.1518578976, -0.1518635303 - -0.1516559124, -0.1512281001, -0.1505732536, -0.1496847868, -0.1485562176 - -0.1471813470, -0.1455538720, -0.1436681300, -0.1415183097, -0.1390990764 - -0.1364052594, -0.1334318966, -0.1301742792, -0.1266280264, -0.1227891371 - -0.1186537445, -0.1142183766, -0.1094799563, -0.1044355705, -0.0990828425 - -0.0934195668, -0.0874440819, -0.0811550021, -0.0745511875, -0.0676321834 - -0.0603975877, -0.0528475679, -0.0449828543, -0.0368040986, -0.0283128861 - -0.0195108838, -0.0104003223, -0.0009837818, 0.0087356847, 0.0187546927 - 0.0290693250, 0.0396753438, 0.0505682528, 0.0617432520, 0.0731955394 - -0.0849232078, -0.0969054326, -0.1091460735, -0.1216373071, -0.1343720406 - -0.1473424733, -0.1605402082, -0.1739567965, -0.1875831038, -0.2014097124 - -0.2154271752, -0.2296251506, -0.2439934313, -0.2585212290, -0.2731975317 - -0.2880111337, -0.3029502928, -0.3180032372, -0.3331578076, -0.3484017253 - -0.3637222052, -0.3791064322, -0.3945416212, -0.4100143015, -0.4255111217 - -0.4410185516, -0.4565227628, -0.4720100164, -0.4874662757, -0.5028775334 - -0.5182296634, -0.5335084200, -0.5486994982, -0.5637886524, -0.5787616372 - -0.5936041474, -0.6083019376, -0.6228409410, -0.6372069120, -0.6513859630 - -0.6653640866, -0.6791275144, -0.6926627755, -0.7059561610, -0.7189947963 - -0.7317654490, -0.7442554235, -0.7564523220, -0.7683438063, -0.7799182534 - -0.7911639810, -0.8020697832, -0.8126249313, -0.8228194118, -0.8326428533 - -0.8420860767, -0.8511404991, -0.8597975969, -0.8680517077, -0.8758881092 - -0.8832823634, -0.8902196884, -0.8967157602, -0.9027729034, -0.9083824754 - -0.9135394692, -0.9182395935, -0.9224776030, -0.9262499809, -0.9295535684 - -0.9323854446, -0.9347436428, -0.9366261959, -0.9380323887, -0.9389615655 - -0.9394137263, -0.9393896461, -0.9388904572, -0.9379178882, -0.9364743829 - -0.9345626831, -0.9321863055, -0.9293491840, -0.9260557890, -0.9223110080 - -0.9181203246, -0.9134896994, -0.9084255695, -0.9029349089, -0.8970250487 - -0.8907034993, -0.8839784265, -0.8768582940, -0.8693521619, -0.8614694476 - -0.8532197475, -0.8446131349, -0.8356599212, -0.8263708353, -0.8167568445 - -0.8068289757, -0.7965991497, -0.7860788107, -0.7752800584, -0.7642148733 - -0.7528960109, -0.7413358092, -0.7295469642, -0.7175422311, -0.7053351402 - -0.6929380894, -0.6803644896, -0.6676273942, -0.6547405124, -0.6417166591 - -0.6285686493, -0.6153115034, -0.6019562483, -0.5885198116, -0.5750215650 - 0.5615197420, 0.5478612781, 0.5341838002, 0.5204906464, 0.5067980289 - 0.4931168854, 0.4794588387, 0.4658361673, 0.4522601366, 0.4387422502 - 0.4252935350, 0.4119254053, 0.3986486793, 0.3854739666, 0.3724119067 - 0.3594728410, 0.3466667533, 0.3340034485, 0.3214924335, 0.3091430366 - 0.2969639599, 0.2849639654, 0.2731511295, 0.2615332901, 0.2501178682 - 0.2389119864, 0.2279221565, 0.2171545923, 0.2066148520, 0.1963084787 - 0.1862401515, 0.1764142811, 0.1668347418, 0.1575049609, 0.1484276950 - 0.1396053135, 0.1310400218, 0.1227331311, 0.1146853194, 0.1068974212 - 0.0993694067, 0.0921007246, 0.0850901082, 0.0783365741, 0.0718384907 - 0.0655927584, 0.0595967993, 0.0538481586, 0.0483424664, 0.0430756323 - 0.0380428955, 0.0332404599, 0.0286619961, 0.0242999699, 0.0201510899 - 0.0162059069, 0.0124559226, 0.0088928537, 0.0054926532, 0.0023052765 - -0.0005515143, -0.0030201224, -0.0052712574, -0.0073737046, -0.0093160523 - -0.0111072771, -0.0127562135, -0.0142635731, -0.0156361461, -0.0168790054 - -0.0179969221, -0.0189934950, -0.0198726747, -0.0206398536, -0.0212980714 - -0.0218509119, -0.0223025978, -0.0226570386, -0.0229178313, -0.0230882075 - -0.0231725387, -0.0231746566, -0.0230979007, -0.0229462404, -0.0227237809 - -0.0224345829, -0.0220820960, -0.0216706358, -0.0212045144, -0.0206875466 - -0.0201238506, -0.0195175279, -0.0188730918, -0.0181944817, -0.0174855441 - -0.0167510118, -0.0159947462, -0.0152208358, -0.0144332750, -0.0136361914 - -0.0128338682, -0.0120294262, -0.0112272501, -0.0104311826, -0.0096443929 - -0.0088709844, -0.0081134979, -0.0073764324, -0.0066623385, -0.0059733889 - -0.0053142183, -0.0046856776, -0.0040914025, -0.0035321070, -0.0030089030 - -0.0025271603, -0.0020749648, -0.0016621647, -0.0012705614, -0.0008115423 -]; -h = h.'; -h = h(:); -h(1*120+(1:120)) = -h(1*120+(1:120)); -h(3*120+(1:120)) = -h(3*120+(1:120)); -h(:) = h(end:-1:1); \ No newline at end of file -- GitLab From 289b54934d71763fba20784c5da76974a4cc2754 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 13 Jul 2023 18:08:44 +1000 Subject: [PATCH 345/591] revert commit e6b45e18 as it failed selection tests --- lib_com/ivas_prot.h | 20 +------ lib_com/options.h | 3 +- lib_dec/ivas_dec.c | 8 --- lib_dec/ivas_jbm_dec.c | 8 --- lib_dec/ivas_masa_dec.c | 4 -- lib_dec/ivas_sba_dec.c | 18 ------ lib_dec/ivas_sba_rendering_internal.c | 9 --- lib_dec/ivas_spar_md_dec.c | 80 ++++++--------------------- lib_rend/ivas_sba_rendering.c | 7 --- 9 files changed, 21 insertions(+), 136 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b8449126e7..9bc253776d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4227,10 +4227,6 @@ void ivas_sba_mix_matrix_determiner( const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ -#ifdef VLBR_20MS_MD - , - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ -#endif ); /* AGC */ @@ -4529,19 +4525,9 @@ void ivas_get_spar_md_from_dirac( /*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int32_t ivas_total_brate ); -#ifdef VLBR_20MS_MD - -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 */ - 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 */ - const int16_t num_channels ); /* i : number of internal channels */ - -#endif + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +); + ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 0d74abfa7d..a66408dd60 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,7 +143,8 @@ /* only BE switches wrt operation points tested in selection */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define VLBR_20MS_MD /* Dlb: SBA VLBR 20ms Optimization*/ + + #define FIX_563_PARAMMC_LIMITER /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set */ #define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ #define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index cb50503079..439a90fb2c 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -67,9 +67,6 @@ ivas_error ivas_dec( float pan_left, pan_right; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; -#ifdef VLBR_20MS_MD - int16_t num_md_sub_frames; -#endif error = IVAS_ERR_OK; @@ -383,12 +380,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { -#ifdef VLBR_20MS_MD - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); -#else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); -#endif } else if ( st_ivas->renderer_type != RENDERER_DISABLE ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 8e96be31ee..ff28af051a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -82,9 +82,6 @@ ivas_error ivas_jbm_dec_tc( AUDIO_CONFIG output_config; ivas_error error; float *p_output[MAX_TRANSPORT_CHANNELS]; -#ifdef VLBR_20MS_MD - int16_t num_md_sub_frames; -#endif error = IVAS_ERR_OK; @@ -285,12 +282,7 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { -#ifdef VLBR_20MS_MD - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); -#else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); -#endif } else { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 03c26d51c3..0576fe8121 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1169,11 +1169,7 @@ void ivas_spar_param_to_masa_param_mapping( } else { -#ifdef VLBR_20MS_MD - mixer_mat_index = ( ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) == 1 ) ? 0 : ( sf - SPAR_META_DELAY_SUBFRAMES ); -#else mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; -#endif for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { for ( i = 0; i < FOA_CHANNELS; i++ ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index f7a55b6fe0..22258a9365 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -111,9 +111,6 @@ ivas_error ivas_sba_dec_reconfigure( int32_t ivas_total_brate; int32_t last_ivas_total_brate; -#ifdef VLBR_20MS_MD - int16_t num_channels, num_md_sub_frames; -#endif RENDERER_TYPE old_renderer_type; DECODER_CONFIG_HANDLE hDecoderConfig; @@ -183,22 +180,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } -#ifdef VLBR_20MS_MD - 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 ); - if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, - num_md_sub_frames ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif 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 diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 643c7b5a6c..6f3dd13b7a 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -578,10 +578,6 @@ void ivas_sba_mix_matrix_determiner( const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ -#ifdef VLBR_20MS_MD - , - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ -#endif ) { int16_t i, ch; @@ -625,13 +621,8 @@ void ivas_sba_mix_matrix_determiner( /* Mixing matrix determiner */ num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; -#ifdef VLBR_20MS_MD - ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, - num_md_sub_frames ); -#else ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif return; } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index bc75fcba88..e83aa7e617 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -92,21 +92,15 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder * * Allocate and initialize SPAR MD decoder matrices *------------------------------------------------------------------------*/ -#ifdef VLBR_20MS_MD -ivas_error ivas_spar_md_dec_matrix_open -#else -static ivas_error ivas_spar_md_dec_matrix_open -#endif - ( - 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 /* i : number of MD subframes */ - ) + +static 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 */ + const int16_t num_md_sub_frames /* i : number of MD subframes */ +) { int16_t i, j; -#ifdef VLBR_20MS_MD - int16_t k; -#endif + if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * num_md_sub_frames * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); @@ -243,22 +237,7 @@ static ivas_error ivas_spar_md_dec_matrix_open } } } -#ifdef VLBR_20MS_MD - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0.0f; - hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0.0f; - hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0.0f; - hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0.0f; - } - } - } -#endif return IVAS_ERR_OK; } @@ -285,12 +264,7 @@ int16_t ivas_get_spar_dec_md_num_subframes( num_subframes = 1; } } -#ifdef VLBR_20MS_MD - if ( ivas_total_brate < IVAS_24k4 ) - { - num_subframes = 1; - } -#endif + return ( num_subframes ); } @@ -358,15 +332,11 @@ ivas_error ivas_spar_md_dec_open( * * Deallocate SPAR MD decoder matrices *------------------------------------------------------------------------*/ -#ifdef VLBR_20MS_MD -void ivas_spar_md_dec_matrix_close -#else -static void ivas_spar_md_dec_matrix_close -#endif - ( - ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels /* i : number of internal channels */ - ) + +static void ivas_spar_md_dec_matrix_close( + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ +) { int16_t i, j; @@ -509,11 +479,7 @@ ivas_error ivas_spar_md_dec_init( const int16_t sba_order /* i : SBA order */ ) { -#ifdef VLBR_20MS_MD - int16_t i, j; -#else int16_t i, j, k; -#endif int16_t nchan_transport; float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; @@ -555,7 +521,7 @@ ivas_error ivas_spar_md_dec_init( set_s( hMdDec->base_band_age, 0, IVAS_MAX_NUM_BANDS ); hMdDec->spar_plc_num_lost_frames = 0; hMdDec->spar_plc_enable_fadeout_flag = 1; -#ifndef VLBR_20MS_MD + for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) @@ -599,7 +565,7 @@ ivas_error ivas_spar_md_dec_init( } } } -#endif + hMdDec->dtx_md_smoothing_cntr = 1; ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); @@ -3125,12 +3091,7 @@ void ivas_spar_to_dirac( } } } -#ifdef VLBR_20MS_MD - int16_t num_md_sub_frames; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate ); - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, - end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); -#else + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hQMetaData->useLowerRes ) { @@ -3139,17 +3100,12 @@ void ivas_spar_to_dirac( ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_subframes, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); -#endif if ( st_ivas->hQMetaData->useLowerRes && dtx_vad ) { for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) { -#ifdef VLBR_20MS_MD - for ( block = 1; block < num_md_sub_frames; block++ ) -#else for ( block = 1; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#endif { for ( i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ { @@ -3163,11 +3119,7 @@ void ivas_spar_to_dirac( } } /* expand DirAC TC 20ms MD for residual channels to all subframes*/ -#ifdef VLBR_20MS_MD - for ( block = 0; block < num_md_sub_frames; block++ ) -#else for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#endif { for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) { diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 5af6a46efd..0974677922 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -67,10 +67,6 @@ void ivas_sba_prototype_renderer( int16_t out_ch, in_ch; int16_t firstInCh, inChEnd, firstOutCh, outChEnd; int16_t slot_idx_start, md_idx; -#ifdef VLBR_20MS_MD - int16_t num_md_sub_frames; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); -#endif push_wmops( "ivas_sba_prototype_renderer" ); @@ -152,9 +148,6 @@ void ivas_sba_prototype_renderer( { /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; -#ifdef VLBR_20MS_MD - md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; -#endif hSpar->i_subframe++; hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); -- GitLab From 5c9742706204ec660a15fa7f1b2db57bd7bce3e4 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 13 Jul 2023 15:20:00 +0530 Subject: [PATCH 346/591] Cleaned up few switches --- lib_com/options.h | 6 --- lib_rend/ivas_CQMFDecoder.c | 58 +++++----------------- lib_rend/ivas_CQMFEncoder.c | 88 +++++++--------------------------- lib_rend/ivas_RMSEnvGrouping.c | 44 +++-------------- lib_rend/ivas_RMSEnvGrouping.h | 4 -- 5 files changed, 34 insertions(+), 166 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f5b0eef4f6..8d5382a01b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -201,13 +201,7 @@ #define SPLIT_REND_IVAS_DEC_HT_TR /*CLDFB CODEC SWITCHES -- START*/ -#define ENABLE_MS_PRED -#define BUG_FIX_03_15_23_INIT_GROUPING -#define FORCE_GROUPS_OF_2 -#define USE_BIT_COUNT_MERGE_COST -#define OPTIMIZE_DPCM_QUANT #define SPLIT_REND_PLC -#define ROM_TO_RAM /* switch to convert CQMF decoder tables to RAM */ /*CLDFB CODEC SWITCHES -- END*/ #define SPLIT_REND_CLANG_SAN_FIX diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index b5fe0b38ea..5bdc15fbba 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -48,9 +48,7 @@ Nations Convention on Contracts on the International Sales of Goods. #include #include #include -#ifdef ENABLE_MS_PRED #include "ivas_MSPred.h" -#endif #include "ivas_PredDecoder.h" #include "ivas_prot_rend.h" #include "wmc_auto.h" @@ -88,10 +86,8 @@ struct CQMF_DECODER uint32_t ( *c_apauiHuffDecTable_RAM[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE]; uint32_t num_decode_table[2 * ALLOC_TABLE_SIZE]; #endif -#ifdef ENABLE_MS_PRED int32_t piMSPredCoefs[MAX_BANDS]; int32_t piLRPhaseDiffs[MAX_BANDS]; -#endif #ifdef ENABLE_PMOD_ADJUST int32_t **ppiHiSMRFlags; #endif @@ -374,13 +370,11 @@ CQMFDecoder *CreateCQMFDecoder( const int32_t iSampleRate, psCQMFDecoder->iMSMode = 0; psCQMFDecoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); -#ifdef ENABLE_MS_PRED for ( n = 0; n < MAX_BANDS; n++ ) { psCQMFDecoder->piLRPhaseDiffs[n] = 0; psCQMFDecoder->piMSPredCoefs[n] = 0; } -#endif #ifdef ENABLE_PMOD_ADJUST psCQMFDecoder->ppiHiSMRFlags = (int32_t **) malloc( psCQMFDecoder->iChannels * sizeof( int32_t * ) ); @@ -690,24 +684,13 @@ static void InvQuantizeSpectrum( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, int32_t **ppiAlloc, int32_t **ppiQReal, int32_t **ppiQImag, float **ppfReal, float **ppfImag, NoiseGen *psNoiseGen ); // Nullable -static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, -#ifdef ENABLE_MS_PRED - const int32_t *piLRPhaseDiffs, - const int32_t *piMSPredCoefs, -#endif - float ***pppfReal, - float ***pppfImag ); +static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, float ***pppfReal, float ***pppfImag ); /* Currently only the number of bands in frame */ static int32_t ReadHeaderInformation( int32_t *piNumBands, ivas_split_rend_bits_t *pBits ); -static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, -#ifdef ENABLE_MS_PRED - int32_t *piLRPhaseDiffs, - int32_t *piMSPredCoefs, -#endif - ivas_split_rend_bits_t *pBits ); +static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, ivas_split_rend_bits_t *pBits ); static int32_t ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, @@ -760,9 +743,7 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, iBitsRead += ReadMSInformation( psCQMFDecoder->iNumBands, &psCQMFDecoder->iMSMode, psCQMFDecoder->piMSFlags, -#ifdef ENABLE_MS_PRED psCQMFDecoder->piLRPhaseDiffs, psCQMFDecoder->piMSPredCoefs, -#endif pBits ); } iBitsRead += ReadPredictors( psCQMFDecoder->psPredictionDecoder, @@ -877,10 +858,8 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, InvMSCoding( psCQMFDecoder->iNumBlocks, psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths, psCQMFDecoder->iMSMode, (const int32_t *) psCQMFDecoder->piMSFlags, -#ifdef ENABLE_MS_PRED (const int32_t *) psCQMFDecoder->piLRPhaseDiffs, (const int32_t *) psCQMFDecoder->piMSPredCoefs, -#endif pppfCQMFReal, pppfCQMFImag ); } @@ -1019,24 +998,16 @@ static void InvQuantizeSpectrum( } } -static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, -#ifdef ENABLE_MS_PRED - const int32_t *piLRPhaseDiffs, - const int32_t *piMSPredCoefs, -#endif - float ***pppfReal, - float ***pppfImag ) +static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, float ***pppfReal, float ***pppfImag ) { if ( iMSMode > 0 ) { int32_t b; int32_t iFBOffset; -#ifdef ENABLE_MS_PRED int32_t bms = 0; #if defined SIMPLE_PHASE void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_m_pi_2, &rot_pm_pi, &rot_p_pi_2 }; -#endif #endif iFBOffset = 0; @@ -1045,7 +1016,7 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons if ( piMSFlags[b] == 1 ) { int32_t n; -#if defined ENABLE_MS_PRED && defined SIMPLE_PHASE +#if defined SIMPLE_PHASE void ( *pFuncPhaseRotate )( float *, float * ) = pFuncPhaseRotateOptions[piLRPhaseDiffs[bms]]; #endif @@ -1058,7 +1029,7 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons float fLeftImag; float fRightReal; float fRightImag; -#ifdef ENABLE_MS_PRED + if ( iMSMode == 3 ) { float fPred; @@ -1066,14 +1037,14 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons pppfReal[1][k][iFBOffset] += fPred * pppfReal[0][k][iFBOffset]; pppfImag[1][k][iFBOffset] += fPred * pppfImag[0][k][iFBOffset]; } -#endif + fLeftReal = ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); fLeftImag = ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); fRightReal = ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); fRightImag = ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); -#ifdef ENABLE_MS_PRED + if ( iMSMode == 3 ) { #ifdef SIMPLE_PHASE @@ -1085,7 +1056,7 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons -c_afRotRealImag[phaseIdx][1] ); #endif } -#endif + pppfReal[0][k][iFBOffset] = fLeftReal; pppfReal[1][k][iFBOffset] = fRightReal; pppfImag[0][k][iFBOffset] = fLeftImag; @@ -1093,9 +1064,8 @@ static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, cons } iFBOffset++; } -#ifdef ENABLE_MS_PRED + bms++; -#endif } else { @@ -1118,12 +1088,7 @@ static int32_t ReadHeaderInformation( int32_t *piNumBands, return iBitsRead; } -static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, -#ifdef ENABLE_MS_PRED - int32_t *piLRPhaseDiffs, - int32_t *piMSPredCoefs, -#endif - ivas_split_rend_bits_t *pBits ) +static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, ivas_split_rend_bits_t *pBits ) { int32_t iBitsRead; @@ -1156,7 +1121,7 @@ static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, in iBitsRead += 1; } } -#ifdef ENABLE_MS_PRED + else if ( *piMSMode == 3 ) { int32_t n; @@ -1247,7 +1212,6 @@ static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, in } #endif } -#endif else { printf( "ERROR UNSUPPORTED MS MODE\n" ); diff --git a/lib_rend/ivas_CQMFEncoder.c b/lib_rend/ivas_CQMFEncoder.c index 755fb670f4..0a7205e473 100644 --- a/lib_rend/ivas_CQMFEncoder.c +++ b/lib_rend/ivas_CQMFEncoder.c @@ -43,9 +43,7 @@ #include "ivas_PerceptualModel.h" #include "ivas_cldfb_codec_bitstream.h" #include "ivas_prot_rend.h" -#ifdef ENABLE_MS_PRED #include "ivas_MSPred.h" -#endif #ifdef ENABLE_PMOD_ADJUST #include "ton_corr.h" #endif @@ -66,11 +64,10 @@ struct CQMF_ENCODER int32_t iMSMode; int32_t *piMSFlags; -#ifdef ENABLE_MS_PRED int32_t piMSPredCoefs[MAX_BANDS]; int32_t piLRPhaseDiffs[MAX_BANDS]; int32_t iAllowSidePred; -#endif + #ifdef ENABLE_PMOD_ADJUST int32_t **ppiHiSMRFlags; #endif @@ -122,14 +119,14 @@ CQMFEncoder *CreateCQMFEncoder( const int32_t iSampleRate, psCQMFEncoder->iMSMode = 0; psCQMFEncoder->piMSFlags = (int32_t *) malloc( MAX_BANDS * sizeof( int32_t ) ); -#ifdef ENABLE_MS_PRED + for ( n = 0; n < MAX_BANDS; n++ ) { psCQMFEncoder->piLRPhaseDiffs[n] = 0; psCQMFEncoder->piMSPredCoefs[n] = 0; } psCQMFEncoder->iAllowSidePred = iAllowSidePred; -#endif + psCQMFEncoder->psRMSEnvelopeGrouping = CreateRMSEnvelopeGrouping( psCQMFEncoder->iNumBlocks ); psCQMFEncoder->iCommonGrouping = 1; // Common grouping always on only impacts stereo @@ -362,11 +359,9 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, float ***pppfReal, float ***pppfImag, int32_t *piMSMode, -#ifdef ENABLE_MS_PRED int32_t *piLRPhaseDiff, int32_t *piMSPredCoef, const int32_t iAllowSidePred, -#endif int32_t *piMSFlags ); static void RemoveRMSEnvelope( const int32_t iNumBands, @@ -399,11 +394,9 @@ static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, static int32_t WriteMSInformation( const int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, -#ifdef ENABLE_MS_PRED const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, int32_t iNumMSPredBands, -#endif ivas_split_rend_bits_t *pBits ); static int32_t WriteGroupInformation( const int32_t iChannels, @@ -470,11 +463,9 @@ int32_t EncodeFrame( CQMFEncoder *psCQMFEncoder, float ***pppfCQMFReal, float ** pppfCQMFReal, pppfCQMFImag, &psCQMFEncoder->iMSMode, -#ifdef ENABLE_MS_PRED psCQMFEncoder->piLRPhaseDiffs, psCQMFEncoder->piMSPredCoefs, psCQMFEncoder->iAllowSidePred, -#endif psCQMFEncoder->piMSFlags ); if ( psCQMFEncoder->iMSMode > 0 ) @@ -496,10 +487,6 @@ int32_t EncodeFrame( CQMFEncoder *psCQMFEncoder, float ***pppfCQMFReal, float ** psCQMFEncoder->piBandwidths, pppfCQMFReal, pppfCQMFImag, -#ifndef USE_BIT_COUNT_MERGE_COST - 8.0, - 20.0, // Use these to trade off RMS Env bits and quantizer loading -#endif &psCQMFEncoder->piNumGroups[0], psCQMFEncoder->ppiGroupLengths[0], psCQMFEncoder->pppiRMSEnvelope ); @@ -520,10 +507,6 @@ int32_t EncodeFrame( CQMFEncoder *psCQMFEncoder, float ***pppfCQMFReal, float ** psCQMFEncoder->piBandwidths, &pppfCQMFReal[n], &pppfCQMFImag[n], -#ifndef USE_BIT_COUNT_MERGE_COST - 8.0, - 20.0, // Use these to trade off RMS Env bits and quantizer loading -#endif &psCQMFEncoder->piNumGroups[n], psCQMFEncoder->ppiGroupLengths[n], &psCQMFEncoder->pppiRMSEnvelope[n] ); @@ -553,11 +536,9 @@ int32_t EncodeFrame( CQMFEncoder *psCQMFEncoder, float ***pppfCQMFReal, float ** iBitsWritten += WriteMSInformation( psCQMFEncoder->iNumBands, psCQMFEncoder->iMSMode, (const int32_t *) psCQMFEncoder->piMSFlags, -#ifdef ENABLE_MS_PRED (const int32_t *) psCQMFEncoder->piLRPhaseDiffs, (const int32_t *) psCQMFEncoder->piMSPredCoefs, iNumMSBands, -#endif pBits ); } @@ -666,17 +647,14 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, float ***pppfReal, float ***pppfImag, int32_t *piMSMode, -#ifdef ENABLE_MS_PRED int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, const int32_t iAllowSidePred, -#endif int32_t *piMSFlags ) { int32_t b; int32_t iFBOffset; int32_t iNumMSBands; -#ifdef ENABLE_MS_PRED int32_t piMSPredFlags[MAX_BANDS] = { 0 }; int32_t iNumMSPredBands = 0; float msBitsReduction = 0.0f; @@ -684,11 +662,10 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, int32_t msBits; int32_t msPredBits; float fPred; -#if defined ENABLE_MS_PRED && defined SIMPLE_PHASE +#if defined SIMPLE_PHASE void( *pFuncPhaseRotateOptions[4] ) = { &rot_zero, &rot_p_pi_2, &rot_pm_pi, &rot_m_pi_2 }; #endif const float one_by_log10_2 = 3.32192809488736f; -#endif *piMSMode = 0; iFBOffset = 0; iNumMSBands = 0; @@ -701,7 +678,6 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, float fSideEnergy; float fLRRatio; float fMSRatio; -#ifdef ENABLE_MS_PRED float fMSPredRatio; float fMidEnergyPred; float fSideEnergyPred; @@ -710,7 +686,6 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, int32_t iPhase; int32_t iPred; int32_t tabIdx = 0; -#endif fLeftEnergy = 0.0f; fRightEnergy = 0.0f; @@ -737,15 +712,13 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, fMidEnergy += ( fMidReal * fMidReal + fMidImag * fMidImag ); fSideEnergy += ( fSideReal * fSideReal + fSideImag * fSideImag ); -#ifdef ENABLE_MS_PRED fLRCovReal += ( pppfReal[0][k][iFBOffset] * pppfReal[1][k][iFBOffset] + pppfImag[0][k][iFBOffset] * pppfImag[1][k][iFBOffset] ); fLRCovImag += ( pppfImag[0][k][iFBOffset] * pppfReal[1][k][iFBOffset] - pppfImag[1][k][iFBOffset] * pppfReal[0][k][iFBOffset] ); -#endif } iFBOffset++; } -#ifdef ENABLE_MS_PRED + /* compute L/R phase difference if high coherence */ if ( fLRCovReal * fLRCovReal + fLRCovImag * fLRCovImag > 0.5f * fLeftEnergy * fRightEnergy ) { @@ -779,7 +752,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, fSideEnergyPred += ( fPred * fPred * fMidEnergyPred - 2.0f * fPred * 0.25f * ( fLeftEnergy - fRightEnergy ) ); /* -= fPred * fPred * fMidEnergyPred doesn't work because fPred is quantized and does not match MS/MM exactly */ fMSPredRatio = (float) log10f( ( fMidEnergyPred + 1e-12f ) / ( fSideEnergyPred + 1e-12f ) ); -#endif + fLeftEnergy = log10f( fLeftEnergy + 1e-12f ); fRightEnergy = log10f( fRightEnergy + 1e-12f ); fMidEnergy = log10f( fMidEnergy + 1e-12f ); @@ -812,7 +785,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, { piMSFlags[b] = 0; } -#ifdef ENABLE_MS_PRED + if ( fMSRatio > fLRRatio ) { float maskThresShift_dB_by_10 = ( fMSRatio - fLRRatio ) * (float) c_aiDefaultTheta48[b] / 16.0f; @@ -829,10 +802,8 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, { piMSPredFlags[b] = 0; } -#endif } -#ifdef ENABLE_MS_PRED msPredBits = CountMSBits( iNumBands, 3, piMSPredFlags, piLRPhaseDiffs, piMSPredCoefs ); msPredBitsReduction = max( msPredBitsReduction - (float) msPredBits, 0.0f ); msBits = CountMSBits( iNumBands, 2, piMSFlags, NULL, NULL ); @@ -857,7 +828,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, iNumMSBands = iNumMSPredBands; } else -#endif + if ( iNumMSBands == iNumBands ) { *piMSMode = 1; @@ -876,7 +847,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, iFBOffset = 0; for ( b = 0; b < iNumBands; b++ ) { -#if defined ENABLE_MS_PRED && defined SIMPLE_PHASE +#if defined SIMPLE_PHASE void ( *pFuncPhaseRotate )( float *, float * ) = pFuncPhaseRotateOptions[piLRPhaseDiffs[b]]; #endif if ( piMSFlags[b] == 1 ) @@ -891,7 +862,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, float fMidImag; float fSideReal; float fSideImag; -#ifdef ENABLE_MS_PRED + if ( *piMSMode == 3 ) { #ifdef SIMPLE_PHASE @@ -903,19 +874,19 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, cplxmult( &pppfReal[1][k][iFBOffset], &pppfImag[1][k][iFBOffset], c_afRotRealImag[phaseIdx][0], c_afRotRealImag[phaseIdx][1] ); #endif } -#endif + fMidReal = 0.5f * ( pppfReal[0][k][iFBOffset] + pppfReal[1][k][iFBOffset] ); fMidImag = 0.5f * ( pppfImag[0][k][iFBOffset] + pppfImag[1][k][iFBOffset] ); fSideReal = 0.5f * ( pppfReal[0][k][iFBOffset] - pppfReal[1][k][iFBOffset] ); fSideImag = 0.5f * ( pppfImag[0][k][iFBOffset] - pppfImag[1][k][iFBOffset] ); -#ifdef ENABLE_MS_PRED + if ( *piMSMode == 3 ) { fPred = dequantPred( piMSPredCoefs[b] ); fSideReal -= fPred * fMidReal; fSideImag -= fPred * fMidImag; } -#endif + pppfReal[0][k][iFBOffset] = fMidReal; pppfReal[1][k][iFBOffset] = fSideReal; pppfImag[0][k][iFBOffset] = fMidImag; @@ -930,7 +901,7 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, } } } -#ifdef ENABLE_MS_PRED + #ifdef DEBUG_WRITE_MS_PRED { static FILE *fid = 0; @@ -972,7 +943,6 @@ static int32_t MSModeCalculation( const int32_t iNumBlocks, } #endif } -#endif return iNumMSBands; } @@ -1437,33 +1407,26 @@ static int32_t WriteHeaderInformation( const int32_t iNumBands, static int32_t WriteMSInformation( const int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, -#ifdef ENABLE_MS_PRED const int32_t *piLRPhaseDiff, const int32_t *piMSPredCoef, int32_t iNumMSPredBands, -#endif ivas_split_rend_bits_t *pBits ) { int32_t iBitsWritten; -#ifdef ENABLE_MS_PRED int32_t iMSPredAll = ( iNumMSPredBands == iNumBands ); #ifdef DEBUG_WRITE_MS_PRED int32_t iBitsWrittenTmp = 0; -#endif #endif iBitsWritten = 0; ivas_split_rend_bitstream_write_int32( pBits, iMSMode, 2 ); iBitsWritten += 2; -#ifdef ENABLE_MS_PRED + if ( iMSMode == 3 ) { ivas_split_rend_bitstream_write_int32( pBits, iMSPredAll, 1 ); iBitsWritten += 1; } if ( iMSMode == 2 || ( iMSMode == 3 && !iMSPredAll ) ) -#else - if ( iMSMode == 2 ) -#endif { int32_t n; for ( n = 0; n < iNumBands; n++ ) @@ -1472,7 +1435,7 @@ static int32_t WriteMSInformation( const int32_t iNumBands, iBitsWritten += 1; } } -#ifdef ENABLE_MS_PRED + #ifdef DEBUG_WRITE_MS_PRED iBitsWrittenTmp = iBitsWritten; #endif @@ -1549,7 +1512,6 @@ static int32_t WriteMSInformation( const int32_t iNumBands, } fprintf( fid, "%f\n", (float) ( ( iBitsWritten - iBitsWrittenTmp ) * ( iMSMode == 3 ) * 50 ) / 1000.0f ); /*kb/s*/ } -#endif #endif return iBitsWritten; @@ -1963,7 +1925,7 @@ static int32_t ComputeAllocation( const int32_t iChannels, pppiAlloc[n][k][b] = iAlloc; } } -#ifdef OPTIMIZE_DPCM_QUANT + QuantizeSpectrumDPCM_Opt( piNumGroups[n], (const int32_t *) ppiGroupLengths[n], iNumBands, @@ -1978,22 +1940,6 @@ static int32_t ComputeAllocation( const int32_t iChannels, ppiPredEnable[n], ppfA1Real[n], ppfA1Imag[n] ); -#else - QuantizeSpectrumDPCM( piNumGroups[n], - (const int32_t *) ppiGroupLengths[n], - iNumBands, - piBandwidths, - pppiAlloc[n], - pppfReal[n], - pppfImag[n], - pppiQReal[n], - pppiQImag[n], - pppiSignReal[n], - pppiSignImag[n], - ppiPredEnable[n], - ppfA1Real[n], - ppfA1Imag[n] ); -#endif iBitsUsed += CountCQMFBits( piNumGroups[n], (const int32_t *) ppiGroupLengths[n], diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c index f5e18c3c1c..0ebb591fc7 100644 --- a/lib_rend/ivas_RMSEnvGrouping.c +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -77,11 +77,8 @@ RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks ) psRMSEnvelopeGrouping = (RMSEnvelopeGrouping *) malloc( sizeof( RMSEnvelopeGrouping ) ); psRMSEnvelopeGrouping->iNumBlocks = iNumBlocks; -#ifdef FORCE_GROUPS_OF_2 + psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks >> 1; -#else - psRMSEnvelopeGrouping->iMaxGroups = iNumBlocks; -#endif psRMSEnvelopeGrouping->ppfBandEnergy = (float **) malloc( psRMSEnvelopeGrouping->iNumBlocks * sizeof( float * ) ); psRMSEnvelopeGrouping->ppfBandEnergydB = (float **) malloc( psRMSEnvelopeGrouping->iNumBlocks * sizeof( float * ) ); @@ -441,7 +438,7 @@ static float ComputeSNRPenalty( const int32_t iChannels, { fSNRPenalty += 1e10f; // Some large number to prevent clipping } - else /*if(fDeltadB < 0.0)*/ + else /*if(fDeltadB < 0.0)*/ { fSNRPenalty += fabsf( c_fiDefaultTheta48[b] * fDeltadB - fDeltadB ) * 2.0f * (float) piBandwidths[b] / 6.0f; } @@ -811,10 +808,6 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, const int32_t *piBandwidths, // pass in absolute thresh float ***pppfReal, float ***pppfImag, -#ifndef USE_BIT_COUNT_MERGE_COST - const float fMeanAllowedDiffdB, - const float fMaxAllowedDiffdB, -#endif int32_t *piNumGroups, int32_t *piGroupLengths, int32_t ***pppiRMSEnvelope ) @@ -834,14 +827,12 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, psRMSEnvelopeGrouping->ppfWeight ); /* Init GMNodes */ -#ifdef FORCE_GROUPS_OF_2 psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0; psRMSEnvelopeGrouping->psGMNodes[0].iGroupLength = 2; psRMSEnvelopeGrouping->psGMNodes[0].psNext = NULL; -#ifdef BUG_FIX_03_15_23_INIT_GROUPING psRMSEnvelopeGrouping->psGMNodes[0].iGroupRMSEnvelopeCost = -1; psRMSEnvelopeGrouping->psGMNodes[0].fGroupSNRPenalty = -1.0f; -#endif + for ( n = 1; n < psRMSEnvelopeGrouping->iMaxGroups; n++ ) { psRMSEnvelopeGrouping->psGMNodes[n - 1].psNext = &psRMSEnvelopeGrouping->psGMNodes[n]; @@ -851,32 +842,9 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty = -1.0; psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; } -#else - psRMSEnvelopeGrouping->psGMNodes[0].iGroupStart = 0; - psRMSEnvelopeGrouping->psGMNodes[0].iGroupLength = 1; - psRMSEnvelopeGrouping->psGMNodes[0].psNext = NULL; -#ifdef BUG_FIX_03_15_23_INIT_GROUPING - psRMSEnvelopeGrouping->psGMNodes[0].iGroupRMSEnvelopeCost = -1; - psRMSEnvelopeGrouping->psGMNodes[0].fGroupSNRPenalty = -1.0f; -#endif - for ( n = 1; n < psRMSEnvelopeGrouping->iMaxGroups; n++ ) - { - psRMSEnvelopeGrouping->psGMNodes[n - 1].psNext = &psRMSEnvelopeGrouping->psGMNodes[n]; - psRMSEnvelopeGrouping->psGMNodes[n].iGroupStart = n; - psRMSEnvelopeGrouping->psGMNodes[n].iGroupLength = 1; - psRMSEnvelopeGrouping->psGMNodes[n].iGroupRMSEnvelopeCost = -1; - psRMSEnvelopeGrouping->psGMNodes[n].fGroupSNRPenalty = -1.0; - psRMSEnvelopeGrouping->psGMNodes[n].psNext = NULL; - } -#endif + /* Perform grouping via Greedy Merge */ -#ifndef USE_BIT_COUNT_MERGE_COST - ComputeGreedyGroups( psRMSEnvelopeGrouping, - iChannels, - iNumBands, - fMeanAllowedDiffdB, - fMaxAllowedDiffdB ); -#else + /*ComputeGreedyGroups2(psRMSEnvelopeGrouping, iChannels, iNumBands, @@ -887,7 +855,7 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, iNumBands, piBandwidths, CQMF_BLOCKS_PER_FRAME ); -#endif + /* Calc Groups from Merge Results */ *piNumGroups = 0; diff --git a/lib_rend/ivas_RMSEnvGrouping.h b/lib_rend/ivas_RMSEnvGrouping.h index fff7e99965..49fae8918e 100644 --- a/lib_rend/ivas_RMSEnvGrouping.h +++ b/lib_rend/ivas_RMSEnvGrouping.h @@ -51,10 +51,6 @@ extern "C" const int32_t *piBandwidths, float ***pppfReal, float ***pppfImag, -#ifndef USE_BIT_COUNT_MERGE_COST - const float fMeanAllowedDiffdB, - const float fMaxAllowedDiffdB, -#endif int32_t *piNumGroups, int32_t *piGroupLengths, int32_t ***pppiRMSEnvelope ); -- GitLab From 69e5acdbaf32e11121bddc555b003e6e2ae5704d Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 13 Jul 2023 15:41:32 +0530 Subject: [PATCH 347/591] Fix clang formatting --- lib_rend/ivas_RMSEnvGrouping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c index 0ebb591fc7..c7925d7475 100644 --- a/lib_rend/ivas_RMSEnvGrouping.c +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -438,7 +438,7 @@ static float ComputeSNRPenalty( const int32_t iChannels, { fSNRPenalty += 1e10f; // Some large number to prevent clipping } - else /*if(fDeltadB < 0.0)*/ + else /*if(fDeltadB < 0.0)*/ { fSNRPenalty += fabsf( c_fiDefaultTheta48[b] * fDeltadB - fDeltadB ) * 2.0f * (float) piBandwidths[b] / 6.0f; } -- GitLab From f3c1c2f74b567db02f8266dd1262b0e8f481671f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:15:12 +0200 Subject: [PATCH 348/591] [cleanup] accept nested sub-switch SPLIT_REND_CLANG_SAN_FIX --- lib_com/options.h | 1 - lib_rend/ivas_CQMFDecoder.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8d5382a01b..4dbd13cccc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -204,7 +204,6 @@ #define SPLIT_REND_PLC /*CLDFB CODEC SWITCHES -- END*/ -#define SPLIT_REND_CLANG_SAN_FIX #define SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_STACK_OPT #endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 5bdc15fbba..8b04ec753d 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -1587,39 +1587,31 @@ ReadCQMFData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int ppiSignReal[iBlockOffest][iFBOffset] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); iBitsRead += 1; } -#ifdef SPLIT_REND_CLANG_SAN_FIX else { ppiSignReal[iBlockOffest][iFBOffset] = 0; } -#endif if ( iQuantValue2 > 0 ) { ppiSignImag[iBlockOffest][iFBOffset] = ivas_split_rend_bitstream_read_int32( pBits, 1 ); iBitsRead += 1; } -#ifdef SPLIT_REND_CLANG_SAN_FIX else { ppiSignImag[iBlockOffest][iFBOffset] = 0; } -#endif iFBOffset++; } } else { -#ifdef SPLIT_REND_CLANG_SAN_FIX for ( m = 0; m < piBandwidths[b]; m++ ) { ppiSignReal[iBlockOffest][iFBOffset] = 0; ppiSignImag[iBlockOffest][iFBOffset] = 0; iFBOffset++; } -#else - iFBOffset += piBandwidths[b]; -#endif } } -- GitLab From 4ea88c8e1f742458b806f672b38c31dae55d83a9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:17:19 +0200 Subject: [PATCH 349/591] [cleanup] accept/consolidate SPLIT_REND_CLDFB_HUFF_SAN_FIX --- apps/renderer.c | 7 +------ lib_com/ivas_cnst.h | 3 --- lib_com/options.h | 1 - lib_util/split_render_file_read_write.c | 2 -- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 537017b97a..db80ae716e 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -67,7 +67,7 @@ #define RENDERER_MAX_METADATA_LENGTH 8192 #define RENDERER_MAX_METADATA_LINE_LENGTH 1024 -#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX +#ifdef SPLIT_REND_WITH_HEAD_ROT #define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC ) + 7 ) >> 3 ) + SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) #endif @@ -1345,12 +1345,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( is_split_pre_rend_mode( &args ) || is_split_post_rend_mode( &args ) ) { -#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; -#else - bitsBufferSize = (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC; - bitsBufferSize = ( bitsBufferSize + 7 ) >> 3; -#endif } else { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 93fd9d0b4c..4e74fa830d 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1806,10 +1806,7 @@ typedef enum #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 #define SPLIT_REND_MAX_BRATE SPLIT_REND_768k - -#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) -#endif #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/options.h b/lib_com/options.h index 4dbd13cccc..8fbdb36cc8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -204,7 +204,6 @@ #define SPLIT_REND_PLC /*CLDFB CODEC SWITCHES -- END*/ -#define SPLIT_REND_CLDFB_HUFF_SAN_FIX #define SPLIT_REND_STACK_OPT #endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 9b2b1f0daf..801c57e32a 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -269,12 +269,10 @@ ivas_error split_rend_read_bits_from_file( { return IVAS_ERR_FAILED_FILE_READ; } -#ifdef SPLIT_REND_CLDFB_HUFF_SAN_FIX for ( i = 0; i < SPLIT_REND_ADDITIONAL_BYTES_TO_READ; i++ ) { bits[num_bytes + i] = 0; } -#endif *bits_read = 0; *bits_written = bit_len; -- GitLab From 750a848928bef3209a64b14b1aa22c5981ac8cb9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:20:21 +0200 Subject: [PATCH 350/591] [cleanup] accept nested sub-switch SPLIT_REND_STACK_OPT --- lib_com/options.h | 1 - lib_rend/lib_rend.c | 36 ------------------------------------ 2 files changed, 37 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8fbdb36cc8..9d8cbeaa15 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -204,7 +204,6 @@ #define SPLIT_REND_PLC /*CLDFB CODEC SWITCHES -- END*/ -#define SPLIT_REND_STACK_OPT #endif /* SPLIT_REND_WITH_HEAD_ROT */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 217911ad66..31f528f783 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7416,7 +7416,6 @@ static ivas_error renderSbaToMultiBinaural( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_STACK_OPT static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -7438,7 +7437,6 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, low_res_pre_rend_rot ); return IVAS_ERR_OK; } -#endif static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, @@ -7474,27 +7472,10 @@ static ivas_error renderSbaToSplitBinaural( if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { -#ifdef SPLIT_REND_STACK_OPT renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, low_res_pre_rend_rot ); -#else - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - - copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - - ivas_rend_CldfbMultiBinRendProcess( - sbaInput->cldfbRendWrapper.hCldfbRend, - sbaInput->base.ctx.pHeadRotData, - &sbaInput->splitRendWrapper.multiBinPoseData, - Cldfb_RealBuffer, - Cldfb_ImagBuffer, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - low_res_pre_rend_rot ); -#endif max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; td_input = 0; } @@ -7553,27 +7534,10 @@ renderSbaToBinaural( { float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_STACK_OPT renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, 0 ); -#else - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - - copyBufferToCLDFBarray( sbaInput->base.inputBuffer, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - - ivas_rend_CldfbMultiBinRendProcess( - sbaInput->cldfbRendWrapper.hCldfbRend, - sbaInput->base.ctx.pHeadRotData, - &sbaInput->splitRendWrapper.multiBinPoseData, - Cldfb_RealBuffer, - Cldfb_ImagBuffer, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - 0 ); -#endif accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], &outAudio ); } else -- GitLab From c0bb696a09dea71fb62d9e0ab28a5048845fbd41 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:22:43 +0200 Subject: [PATCH 351/591] [cleanup] accept nested sub-switch SPLIT_REND_IVAS_DEC_HT_TR --- lib_com/options.h | 1 - lib_dec/ivas_output_config.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9d8cbeaa15..8f99d233dc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -198,7 +198,6 @@ //#define USE_DOLBY_HRTFS_WITH_LIB_REND_HOA3 //#define SPLIT_MD_CODING_DEBUG -#define SPLIT_REND_IVAS_DEC_HT_TR /*CLDFB CODEC SWITCHES -- START*/ #define SPLIT_REND_PLC diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 3b8dfd788c..5c8236ce6a 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -469,7 +469,6 @@ void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS &hSplitBinRend->splitrend.multiBinPoseData, hCombinedOrientationData->sr_pose_pred_axis ); -#ifdef SPLIT_REND_IVAS_DEC_HT_TR if ( ( hCombinedOrientationData != NULL ) && ( hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ) { int16_t sf, i, j; @@ -485,7 +484,6 @@ void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS } } } -#endif return; } -- GitLab From 2d326ce8c6ae609beb383d33085a58df82d0543e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:26:03 +0200 Subject: [PATCH 352/591] [cleanup] accept nested sub-switch SPLIT_REND_ZERO_OUT_YAW_D --- lib_com/options.h | 1 - lib_rend/ivas_splitRendererPost.c | 41 ----------------------------- lib_rend/ivas_splitRendererPre.c | 6 +---- lib_rend/ivas_splitRenderer_utils.c | 4 --- 4 files changed, 1 insertion(+), 51 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8f99d233dc..482cee06d7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -190,7 +190,6 @@ #define SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT -#define SPLIT_REND_ZERO_OUT_YAW_D //#define SPLIT_REND_REAL_ONLY_ROLL //#define SPIT_ABS_SCALING_INTERP diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 3910cbcf2a..4a647c320e 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1415,9 +1415,6 @@ void ivas_SplitRenderer_PostRenderer( #else BIN_HR_SPLIT_REND_MD rot_md_act[1][MAX_SPLIT_REND_MD_BANDS]; #endif -#endif -#ifndef SPLIT_REND_ZERO_OUT_YAW_D - float gd_cf, gd_cf_abs; #endif int16_t interp_yaw_pose_idx[2], interp_pitch_pose_idx[2], interp_roll_pose_idx[2]; float interp_yaw_fact, interp_pitch_fact, interp_roll_fact; @@ -1589,32 +1586,6 @@ void ivas_SplitRenderer_PostRenderer( #endif } -#ifndef SPLIT_REND_ZERO_OUT_YAW_D -#ifdef SPLIT_REND_PLC - if ( hBinPostRenderer->cf_flag ) - { - gd_cf = fade * rot_md_act[pos_idx][b].gd + - ( 1 - fade ) * hBinPostRenderer->gd_mem[pos_idx][b]; - } - else - { - gd_cf = rot_md_act[pos_idx][b].gd; - } -#else - if ( hBinPostRenderer->cf_flag ) - { - gd_cf = fade * hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd + - ( 1 - fade ) * hBinPostRenderer->gd_mem[pos_idx][b]; - } - else - { - gd_cf = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; - } -#endif - - gd_cf_abs = (float) fabs( gd_cf ); -#endif - brange[0] = pBand_grouping[b]; brange[1] = pBand_grouping[b + 1]; for ( b2 = brange[0]; b2 < brange[1]; b2++ ) @@ -1641,19 +1612,7 @@ void ivas_SplitRenderer_PostRenderer( pred_out_im[ch_idx1] += tmp_im; } -#ifndef SPLIT_REND_ZERO_OUT_YAW_D - // Apply decorrelation - if ( 1 ) - { - tmp_re = Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2] + Cldfb_RealBuffer_Ref_Binaural[1][index_slot][b2]; - tmp_im = Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2] + Cldfb_ImagBuffer_Ref_Binaural[1][index_slot][b2]; - pred_out_re[0] += ( gd_cf_abs * tmp_re ); - pred_out_im[0] += ( gd_cf_abs * tmp_im ); - pred_out_re[1] += ( gd_cf * tmp_re ); - pred_out_im[1] += ( gd_cf * tmp_im ); - } -#endif for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 905e2524d9..34f5ce4da7 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -635,11 +635,7 @@ static void ComputeCoeffs( } } -#ifdef SPLIT_REND_ZERO_OUT_YAW_D - if ( 1 ) -#else - if ( pose_type != ANY_YAW ) -#endif + if ( 1 ) /* TODO FhG2Dlb : can the else block be removed entirely? */ { gd2 = 0.0f; sigma_d = 0.0f; diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index bafa2cc0c5..97bb230215 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -622,11 +622,7 @@ void ivas_split_rend_get_quant_params( pred_imag_bands_roll[q] = *num_complex_bands; } -#ifdef SPLIT_REND_ZERO_OUT_YAW_D d_bands_yaw[0] = 0; -#else - d_bands_yaw[0] = num_md_bands; -#endif bands_pitch[0] = num_md_bands; for ( q = 1; q < *num_quant_strats; q++ ) { -- GitLab From 3f9061a4112f67f8430c3426ccf9780e4deb65a9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:28:47 +0200 Subject: [PATCH 353/591] [cleanup] accept nested sub-switch SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT --- lib_com/options.h | 1 - lib_rend/ivas_splitRendererPost.c | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 482cee06d7..412f0b6db0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -188,7 +188,6 @@ #define SPLIT_REND_CLDFB_ISM -#define SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT //#define SPLIT_REND_REAL_ONLY_ROLL diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 4a647c320e..3526ce2599 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -919,7 +919,7 @@ void ivas_splitBinPostRendMdDec( return; } -#define REAL_IMAG_INTERPOLATION +#define REAL_IMAG_INTERPOLATION /* TODO FhG2Dlb : can this define be removed? */ static void wrap_around_angle( float *a ) { if ( ( *a ) > 180.0f ) @@ -952,7 +952,6 @@ static float get_interp_fact( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t in n = p[ind[0]] - p[ind[1]]; d = p[ind[0]] - p_t; interp_fact = d / n; -#ifdef SPLIT_SIN_SCALING_AND_EXTRAPOL_LIMIT if ( interp_fact < 0.0f ) { d = max( -1.0f * MAX_EXTRAPOLATION_ANGLE, ( min( MAX_EXTRAPOLATION_ANGLE, d ) ) ); @@ -960,7 +959,6 @@ static float get_interp_fact( float p[MAX_HEAD_ROT_POSES], float p_t, int16_t in d = sinf( d * ( EVS_PI / 180.0f ) ); interp_fact = d / n; } -#endif } else { -- GitLab From 168a6787104355ed81b49c2eae4a7fc6b17e6e34 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:32:33 +0200 Subject: [PATCH 354/591] [cleanup] accept nested sub-switch SPLIT_REND_CLDFB_ISM --- apps/decoder.c | 2 +- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 4 ---- lib_dec/ivas_init_dec.c | 8 -------- lib_rend/lib_rend.c | 25 ++++--------------------- 5 files changed, 5 insertions(+), 35 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a255b4a300..6cb38ece51 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1557,7 +1557,7 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } -#ifdef SPLIT_REND_CLDFB_ISM +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { diff --git a/lib_com/options.h b/lib_com/options.h index 412f0b6db0..d3c3bb5928 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -186,7 +186,6 @@ //#define SPLIT_POSE_CORRECTION_DEBUG #define SPLIT_REND_QUANT_RANGE_INC -#define SPLIT_REND_CLDFB_ISM //#define SPLIT_REND_REAL_ONLY_ROLL diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index c087529e35..39f051af9d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -270,12 +270,8 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_CLDFB_ISM if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) -#endif { ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ef194bdab3..fb1eee59b9 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1320,12 +1320,8 @@ ivas_error ivas_init_decoder( } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_CLDFB_ISM if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) -#endif { ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); @@ -1338,11 +1334,7 @@ ivas_error ivas_init_decoder( error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, hDecoderConfig->output_Fs, 0, -#ifdef SPLIT_REND_CLDFB_ISM ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 -#else - 0 -#endif ); if ( error != IVAS_ERR_OK ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 31f528f783..3f89f65062 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3537,14 +3537,8 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, - 0, -#ifdef SPLIT_REND_CLDFB_ISM - ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 -#else - 0 -#endif - ); + ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { return error; @@ -4193,9 +4187,7 @@ ivas_error IVAS_REND_AddInput( /* Hack to override default split rendering codec from Dolby CLDFB to LC3plus. This will not be necessary once the split rendering codec becomes selectable by the lib user. */ closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); -#ifndef SPLIT_REND_CLDFB_ISM - hIvasRend->hRendererConfig->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_LC3PLUS; -#endif + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; @@ -8549,11 +8541,7 @@ ivas_error IVAS_REND_GetSamples( #endif #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED -#ifdef SPLIT_REND_CLDFB_ISM - || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) @@ -8579,12 +8567,7 @@ ivas_error IVAS_REND_GetSamples( tmpBinaural, 1, 1, -#ifdef SPLIT_REND_CLDFB_ISM - ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 -#else - 0 -#endif - ); + ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { return error; -- GitLab From a800f1c8bfb8091100921f1e42dfd791ada6138b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:34:20 +0200 Subject: [PATCH 355/591] [cleanup] accept nested sub-switch SPLIT_REND_QUANT_RANGE_INC --- lib_com/ivas_cnst.h | 5 ----- lib_com/options.h | 1 - 2 files changed, 6 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4e74fa830d..398aa31c0d 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1540,13 +1540,8 @@ typedef enum #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) #define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) #define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) -#ifdef SPLIT_REND_QUANT_RANGE_INC #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.4f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.4f ) -#else -#define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.0f ) -#define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.0f ) -#endif #define IVAS_SPLIT_REND_PITCH_G_MIN_VAL (0.5f) #define IVAS_SPLIT_REND_PITCH_G_MAX_VAL (1.5f) diff --git a/lib_com/options.h b/lib_com/options.h index d3c3bb5928..7057e480da 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,7 +184,6 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER //#define SPLIT_POSE_CORRECTION_DEBUG -#define SPLIT_REND_QUANT_RANGE_INC -- GitLab From 74142fe0111c6331cf19ebba67e1d1bfd72fa81e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:43:10 +0200 Subject: [PATCH 356/591] [cleanup] accept/consolidate FIX_SPLIT_REND_MERGE --- lib_com/ivas_prot.h | 2 +- lib_com/options.h | 1 - lib_dec/ivas_binRenderer_internal.c | 4 ++-- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_spar_md_dec.c | 2 +- lib_rend/ivas_crend.c | 6 +++--- lib_rend/lib_rend.c | 18 +++++------------- 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2839f6bac2..5abdc3b90f 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4965,7 +4965,7 @@ void ivas_quantise_real_values( float *quant, const int16_t dim ); -#ifndef FIX_SPLIT_REND_MERGE +#ifndef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, diff --git a/lib_com/options.h b/lib_com/options.h index 7057e480da..872811fef9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,6 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT -#define FIX_SPLIT_REND_MERGE /* Resolving the compilation warnings after splitrenderer main updation */ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 408f708ad1..e674ebdf18 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1317,7 +1317,7 @@ void ivas_binaural_cldfb_sf( { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #else @@ -1390,7 +1390,7 @@ void ivas_binaural_cldfb_sf( for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) { -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[0][ch][slot_idx]; ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[0][ch][slot_idx]; #else diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 78c7cc70aa..229a70684d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2974,7 +2974,7 @@ void ivas_dirac_dec_render_sf( for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) { -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; #else diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 3a87f5c9d3..fb672f8bc3 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -82,7 +82,7 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); #endif diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 1f9707540b..0cba59b88c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1546,7 +1546,7 @@ ivas_error ivas_rend_crendProcess( if ( hCrend->hReverb != NULL ) { -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_reverb_process( pCrend->hCrend[pos_idx]->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) @@ -1689,7 +1689,7 @@ ivas_error ivas_rend_crendProcessSubframe( if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, tc_local, p_pcm_tmp, output_Fs, 0, 0 ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, tc_local, p_pcm_tmp, output_Fs, 0 ) ) != IVAS_ERR_OK ) @@ -1698,7 +1698,7 @@ ivas_error ivas_rend_crendProcessSubframe( { return error; } -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pCrend->hCrend[0]->hReverb != NULL ) { if ( ( error = ivas_reverb_process( pCrend->hCrend[0]->hReverb, in_config, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3f89f65062..74f9160cdb 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1427,10 +1427,10 @@ static ivas_error setRendInputActiveIsm( #endif ) { -#ifndef FIX_SPLIT_REND_MERGE +#ifndef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, NULL, *rendCtx.pOutSampleRate -#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT /* TODO FhG2Dlb : switch nesting needs review */ , 1 #endif @@ -1454,7 +1454,7 @@ static ivas_error setRendInputActiveIsm( } else { -#ifndef FIX_SPLIT_REND_MERGE +#ifndef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -7302,10 +7302,8 @@ static ivas_error renderSbaToMultiBinaural( float out[][L_FRAME48k] ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#ifdef FIX_SPLIT_REND_MERGE float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; -#endif int16_t sf, i, j, pos_idx; COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; @@ -7314,12 +7312,10 @@ static ivas_error renderSbaToMultiBinaural( ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; -#ifdef FIX_SPLIT_REND_MERGE for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif push_wmops( "renderSbaToMultiBinaural" ); pMultiBinPoseData = &sbaInput->splitRendWrapper.multiBinPoseData; @@ -7378,11 +7374,7 @@ static ivas_error renderSbaToMultiBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#ifdef FIX_SPLIT_REND_MERGE p_tmpCrendBuffer, -#else - tmpCrendBuffer -#endif *sbaInput->base.ctx.pOutSampleRate, pos_idx ) ) != IVAS_ERR_OK ) { @@ -7537,7 +7529,7 @@ renderSbaToBinaural( { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; for ( int16_t i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { @@ -7570,7 +7562,7 @@ renderSbaToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, -#ifdef FIX_SPLIT_REND_MERGE +#ifdef SPLIT_REND_WITH_HEAD_ROT p_tmpCrendBuffer, #else tmpCrendBuffer, -- GitLab From 19db87022b6acecdf377b5a12f763ce2f12b20f2 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:53:40 +0200 Subject: [PATCH 357/591] [cleanup] strip SPLIT_REND_REAL_ONLY_ROLL --- lib_com/options.h | 1 - lib_rend/ivas_splitRendererPost.c | 49 ----------------------------- lib_rend/ivas_splitRenderer_utils.c | 4 --- 3 files changed, 54 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 17c0ea3133..b66fcd5150 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -187,7 +187,6 @@ -//#define SPLIT_REND_REAL_ONLY_ROLL //#define SPIT_ABS_SCALING_INTERP diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 3526ce2599..cf4105bdea 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1232,13 +1232,11 @@ static void interpolate_rend_md( float interp_roll_fact ) { int16_t ch_idx1, idx1, idx2; -#ifndef SPLIT_REND_REAL_ONLY_ROLL float mix_mat_re1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float mix_mat_im1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float mix_mat_re3[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float mix_mat_im3[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t ch_idx2; -#endif float gd1, gd2, gd3, gd4, diff, pitch_gain_r, pitch_gain_l; gd1 = 0.0f; @@ -1329,52 +1327,6 @@ static void interpolate_rend_md( idx1 = interp_roll_pose_idx[0]; idx2 = interp_roll_pose_idx[1]; -#ifdef SPLIT_REND_REAL_ONLY_ROLL - if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) - { - gd1 = 1.0f; - gd2 = 1.0f; - - gd3 = 1.0f; - gd4 = 1.0f; - - if ( idx1 != 0 ) - { - gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd; - gd3 = rot_md[idx1 - 1][sf_idx][band_idx].gd2; - } - if ( idx2 != 0 ) - { - gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd; - gd4 = rot_md[idx2 - 1][sf_idx][band_idx].gd2; - } -#if 0 - diff = gd1 / gd2; - pitch_gain_l = gd2 * powf( diff, 1.0f - interp_roll_fact ); - pitch_gain_l = max( 0.0f, pitch_gain_l ); - - diff = gd3 / gd4; - pitch_gain_r = gd4 * powf( diff, 1.0f - interp_roll_fact ); - pitch_gain_r = max( 0.0f, pitch_gain_r ); -#else - diff = gd1 - gd2; - pitch_gain_l = gd1 - ( diff * interp_roll_fact ); - pitch_gain_l = max( 0.0f, pitch_gain_l ); - - diff = gd3 - gd4; - pitch_gain_r = gd3 - ( diff * interp_roll_fact ); - pitch_gain_r = max( 0.0f, pitch_gain_r ); -#endif - - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - mix_mat_re[ch_idx1][0] *= pitch_gain_l; - mix_mat_re[ch_idx1][1] *= pitch_gain_r; - mix_mat_im[ch_idx1][0] *= pitch_gain_l; - mix_mat_im[ch_idx1][1] *= pitch_gain_r; - } - } -#else if ( ( idx1 != 0 ) || ( idx2 != 0 ) ) { @@ -1392,7 +1344,6 @@ static void interpolate_rend_md( } } } -#endif return; } diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 97bb230215..2e63bccf0d 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -217,11 +217,7 @@ void set_pose_types( IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1] } else if ( fabs( pMultiBinPoseData->relative_head_poses[pos_idx + 1][2] ) > EPSILON ) { -#ifdef SPLIT_REND_REAL_ONLY_ROLL - pose_type[pos_idx] = PITCH_ONLY; -#else pose_type[pos_idx] = ANY_ROLL; -#endif } else { -- GitLab From a91d5d6ae80371be93864d54f299f9487c183d09 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 13 Jul 2023 12:53:39 +0200 Subject: [PATCH 358/591] Remove options.h include from lc3plus code The header is no longer needed with updated WMC tool --- lc3plus/adjust_global_gain.c | 1 - lc3plus/al_fec_fl.c | 1 - lc3plus/apply_global_gain.c | 1 - lc3plus/ari_codec.c | 1 - lc3plus/attack_detector.c | 1 - lc3plus/constants.c | 1 - lc3plus/cutoff_bandwidth.c | 1 - lc3plus/dct4.c | 1 - lc3plus/dec_entropy.c | 1 - lc3plus/dec_lc3_fl.c | 1 - lc3plus/detect_cutoff_warped.c | 1 - lc3plus/enc_entropy.c | 1 - lc3plus/enc_lc3_fl.c | 1 - lc3plus/estimate_global_gain.c | 1 - lc3plus/fft/cfft.c | 1 - lc3plus/fft/iis_fft.c | 1 - lc3plus/fft/iisfft.c | 1 - lc3plus/imdct.c | 1 - lc3plus/lc3.c | 1 - lc3plus/lc3plus_fft.c | 26 +- lc3plus/ltpf_coder.c | 1 - lc3plus/ltpf_decoder.c | 1 - lc3plus/mdct.c | 1 - lc3plus/mdct_shaping.c | 1 - lc3plus/near_nyquist_detector.c | 1 - lc3plus/noise_factor.c | 1 - lc3plus/noise_filling.c | 1 - lc3plus/olpa.c | 1 - lc3plus/pc_apply.c | 1 - lc3plus/pc_classify.c | 1 - lc3plus/pc_main.c | 1 - lc3plus/pc_update.c | 1 - lc3plus/per_band_energy.c | 1 - lc3plus/plc_classify.c | 1 - lc3plus/plc_compute_stab_fac.c | 1 - lc3plus/plc_damping_scrambling.c | 1 - lc3plus/plc_main.c | 1 - lc3plus/plc_noise_substitution.c | 1 - lc3plus/plc_phecu_f0_refine_first.c | 1 - lc3plus/plc_phecu_fec_hq.c | 1 - lc3plus/plc_phecu_hq_ecu.c | 1 - lc3plus/plc_phecu_lf_peak_analysis.c | 1 - lc3plus/plc_phecu_rec_frame.c | 1 - lc3plus/plc_phecu_setf0hz.c | 1 - lc3plus/plc_phecu_spec_ana.c | 1 - lc3plus/plc_phecu_subst_spec.c | 1 - lc3plus/plc_phecu_tba_per_band_gain.c | 1 - lc3plus/plc_phecu_tba_spect_Xavg.c | 1 - lc3plus/plc_phecu_tba_trans_dect_gains.c | 1 - lc3plus/plc_phecu_trans_burst_ana_sub.c | 1 - lc3plus/plc_tdc.c | 1 - lc3plus/plc_tdc_tdac.c | 1 - lc3plus/plc_update.c | 1 - lc3plus/quantize_spec.c | 1 - lc3plus/reorder_bitstream.c | 1 - lc3plus/resamp12k8.c | 1 - lc3plus/residual_coding.c | 1 - lc3plus/residual_decoding.c | 1 - lc3plus/setup_com_lc3.c | 1 - lc3plus/setup_dec_lc3.c | 1 - lc3plus/setup_enc_lc3.c | 1 - lc3plus/sns_compute_scf.c | 1 - lc3plus/sns_interpolate_scf.c | 1 - lc3plus/sns_quantize_scf.c | 1 - lc3plus/tns_coder.c | 1 - lc3plus/tns_decoder.c | 1 - scripts/lc3plus_lib_setup/get_lc3plus.sh | 2 +- scripts/lc3plus_lib_setup/lc3plus.patch | 913 ++--------------------- 68 files changed, 94 insertions(+), 912 deletions(-) diff --git a/lc3plus/adjust_global_gain.c b/lc3plus/adjust_global_gain.c index e7674dd710..803240f748 100644 --- a/lc3plus/adjust_global_gain.c +++ b/lc3plus/adjust_global_gain.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff --git a/lc3plus/al_fec_fl.c b/lc3plus/al_fec_fl.c index 0cae36dade..fd0b55b91e 100644 --- a/lc3plus/al_fec_fl.c +++ b/lc3plus/al_fec_fl.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "stdint.h" #include #include diff --git a/lc3plus/apply_global_gain.c b/lc3plus/apply_global_gain.c index c67432e2c3..45bfae5343 100644 --- a/lc3plus/apply_global_gain.c +++ b/lc3plus/apply_global_gain.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff --git a/lc3plus/ari_codec.c b/lc3plus/ari_codec.c index 80c75fcf0c..238e2a1268 100644 --- a/lc3plus/ari_codec.c +++ b/lc3plus/ari_codec.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static void ac_shift_fl(Encoder_State_fl* st); diff --git a/lc3plus/attack_detector.c b/lc3plus/attack_detector.c index c9f7c0a94c..83643d76c2 100644 --- a/lc3plus/attack_detector.c +++ b/lc3plus/attack_detector.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, diff --git a/lc3plus/constants.c b/lc3plus/constants.c index 8189761a04..b32edab9e6 100644 --- a/lc3plus/constants.c +++ b/lc3plus/constants.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" /* DCT */ diff --git a/lc3plus/cutoff_bandwidth.c b/lc3plus/cutoff_bandwidth.c index 642b2afda2..ea8ad00c9d 100644 --- a/lc3plus/cutoff_bandwidth.c +++ b/lc3plus/cutoff_bandwidth.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff --git a/lc3plus/dct4.c b/lc3plus/dct4.c index 8fd5784b28..b470430b94 100644 --- a/lc3plus/dct4.c +++ b/lc3plus/dct4.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void dct2_init(Dct2* dct, int length) diff --git a/lc3plus/dec_entropy.c b/lc3plus/dec_entropy.c index d8512a1068..ec7c09708d 100644 --- a/lc3plus/dec_entropy.c +++ b/lc3plus/dec_entropy.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); diff --git a/lc3plus/dec_lc3_fl.c b/lc3plus/dec_lc3_fl.c index 88c528b0f6..51c430060d 100644 --- a/lc3plus/dec_lc3_fl.c +++ b/lc3plus/dec_lc3_fl.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/detect_cutoff_warped.c b/lc3plus/detect_cutoff_warped.c index 9392867208..b34a88a4c0 100644 --- a/lc3plus/detect_cutoff_warped.c +++ b/lc3plus/detect_cutoff_warped.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) diff --git a/lc3plus/enc_entropy.c b/lc3plus/enc_entropy.c index a7ff8cd700..ed34bca7b8 100644 --- a/lc3plus/enc_entropy.c +++ b/lc3plus/enc_entropy.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, diff --git a/lc3plus/enc_lc3_fl.c b/lc3plus/enc_lc3_fl.c index c89f7244ca..5bf05465a4 100644 --- a/lc3plus/enc_lc3_fl.c +++ b/lc3plus/enc_lc3_fl.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff --git a/lc3plus/estimate_global_gain.c b/lc3plus/estimate_global_gain.c index df9b1f5f23..df4b1bc546 100644 --- a/lc3plus/estimate_global_gain.c +++ b/lc3plus/estimate_global_gain.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/fft/cfft.c b/lc3plus/fft/cfft.c index 4bd8d29ade..e1bcc2806f 100644 --- a/lc3plus/fft/cfft.c +++ b/lc3plus/fft/cfft.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "cfft.h" #include "iisfft.h" /* for M_PIl */ #include /* for abs() */ diff --git a/lc3plus/fft/iis_fft.c b/lc3plus/fft/iis_fft.c index b1f8ab5ab8..1ff9b8303e 100644 --- a/lc3plus/fft/iis_fft.c +++ b/lc3plus/fft/iis_fft.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include #include #include diff --git a/lc3plus/fft/iisfft.c b/lc3plus/fft/iisfft.c index 227d2b6037..2b5829b220 100644 --- a/lc3plus/fft/iisfft.c +++ b/lc3plus/fft/iisfft.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include #include /* for mmove */ diff --git a/lc3plus/imdct.c b/lc3plus/imdct.c index 5d38aa6cc7..597c21e0df 100644 --- a/lc3plus/imdct.c +++ b/lc3plus/imdct.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" /* Function expects already flipped window */ diff --git a/lc3plus/lc3.c b/lc3plus/lc3.c index 17d2ccb712..8b4ebafaa6 100644 --- a/lc3plus/lc3.c +++ b/lc3plus/lc3.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "lc3.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/lc3plus_fft.c b/lc3plus/lc3plus_fft.c index 14f443f860..89c6eff2a2 100644 --- a/lc3plus/lc3plus_fft.c +++ b/lc3plus/lc3plus_fft.c @@ -6,9 +6,8 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ + - -#include "options.h" #include "functions.h" #include "fft/iis_fft.c" #include "fft/iisfft.c" @@ -16,14 +15,14 @@ void fft_init(Fft* fft, int length) { + assert(length % 2 == 0); HANDLE_IIS_FFT handle = NULL; IIS_FFT_ERROR error = 0; - assert(length % 2 == 0); - + fft->length = length; - + error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); - + assert(error == IIS_FFT_NO_ERROR); fft->handle = handle; } @@ -31,10 +30,10 @@ void fft_init(Fft* fft, int length) void fft_free(Fft* fft) { IIS_FFT_ERROR error = 0; - + if (fft) { error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); - + assert(error == IIS_FFT_NO_ERROR); memset(fft, 0, sizeof(*fft)); } @@ -54,8 +53,8 @@ void real_fft_free(Fft* fft) void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) { - IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; fft->length = length; @@ -67,8 +66,8 @@ void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) { - IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ + IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; fft->length = length; @@ -82,7 +81,7 @@ void fft_apply(Fft* fft, const Complex* input, Complex* output) { IIS_FFT_ERROR error = 0; error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); - + assert(error == IIS_FFT_NO_ERROR); } @@ -90,10 +89,11 @@ void fft_apply(Fft* fft, const Complex* input, Complex* output) void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) { IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; - + UNUSED(error); - error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); + error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); assert(error == IIS_FFT_NO_ERROR); } + diff --git a/lc3plus/ltpf_coder.c b/lc3plus/ltpf_coder.c index fac8c481c0..5f8cff63ac 100644 --- a/lc3plus/ltpf_coder.c +++ b/lc3plus/ltpf_coder.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); diff --git a/lc3plus/ltpf_decoder.c b/lc3plus/ltpf_decoder.c index a40c85213a..c881801618 100644 --- a/lc3plus/ltpf_decoder.c +++ b/lc3plus/ltpf_decoder.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff --git a/lc3plus/mdct.c b/lc3plus/mdct.c index 11618b9465..8b50397a8e 100644 --- a/lc3plus/mdct.c +++ b/lc3plus/mdct.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) diff --git a/lc3plus/mdct_shaping.c b/lc3plus/mdct_shaping.c index 1876192504..1033802ac5 100644 --- a/lc3plus/mdct_shaping.c +++ b/lc3plus/mdct_shaping.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) diff --git a/lc3plus/near_nyquist_detector.c b/lc3plus/near_nyquist_detector.c index ce94351302..215e309e2e 100644 --- a/lc3plus/near_nyquist_detector.c +++ b/lc3plus/near_nyquist_detector.c @@ -8,7 +8,6 @@ ******************************************************************************/ #include "functions.h" -#include "options.h" void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, diff --git a/lc3plus/noise_factor.c b/lc3plus/noise_factor.c index c5aa582e45..c92a94158c 100644 --- a/lc3plus/noise_factor.c +++ b/lc3plus/noise_factor.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, diff --git a/lc3plus/noise_filling.c b/lc3plus/noise_filling.c index 7fac5e0f72..a5a6b4b424 100644 --- a/lc3plus/noise_filling.c +++ b/lc3plus/noise_filling.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) diff --git a/lc3plus/olpa.c b/lc3plus/olpa.c index 6bec50952e..cc6e763716 100644 --- a/lc3plus/olpa.c +++ b/lc3plus/olpa.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); diff --git a/lc3plus/pc_apply.c b/lc3plus/pc_apply.c index 1d1bc40005..e9cd3e62b6 100644 --- a/lc3plus/pc_apply.c +++ b/lc3plus/pc_apply.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/pc_classify.c b/lc3plus/pc_classify.c index 71196edb89..96be029119 100644 --- a/lc3plus/pc_classify.c +++ b/lc3plus/pc_classify.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/pc_main.c b/lc3plus/pc_main.c index 268ee94d2a..b0d853d6a7 100644 --- a/lc3plus/pc_main.c +++ b/lc3plus/pc_main.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/pc_update.c b/lc3plus/pc_update.c index 57539b5079..62b9d3f8dc 100644 --- a/lc3plus/pc_update.c +++ b/lc3plus/pc_update.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/per_band_energy.c b/lc3plus/per_band_energy.c index db1b5b2d0f..538f6e6615 100644 --- a/lc3plus/per_band_energy.c +++ b/lc3plus/per_band_energy.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) diff --git a/lc3plus/plc_classify.c b/lc3plus/plc_classify.c index 619a1f7419..20f577b366 100644 --- a/lc3plus/plc_classify.c +++ b/lc3plus/plc_classify.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_compute_stab_fac.c b/lc3plus/plc_compute_stab_fac.c index 4a1111a2c7..049c072514 100644 --- a/lc3plus/plc_compute_stab_fac.c +++ b/lc3plus/plc_compute_stab_fac.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_damping_scrambling.c b/lc3plus/plc_damping_scrambling.c index ecea32be5f..347276ab1d 100644 --- a/lc3plus/plc_damping_scrambling.c +++ b/lc3plus/plc_damping_scrambling.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_main.c b/lc3plus/plc_main.c index df3fd184d9..877196b7ff 100644 --- a/lc3plus/plc_main.c +++ b/lc3plus/plc_main.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, diff --git a/lc3plus/plc_noise_substitution.c b/lc3plus/plc_noise_substitution.c index 4913ee53e5..94c3aa37aa 100644 --- a/lc3plus/plc_noise_substitution.c +++ b/lc3plus/plc_noise_substitution.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_f0_refine_first.c b/lc3plus/plc_phecu_f0_refine_first.c index 11ebf276b1..5b2309586d 100644 --- a/lc3plus/plc_phecu_f0_refine_first.c +++ b/lc3plus/plc_phecu_f0_refine_first.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_fec_hq.c b/lc3plus/plc_phecu_fec_hq.c index c25466c3e9..b9d63e36ac 100644 --- a/lc3plus/plc_phecu_fec_hq.c +++ b/lc3plus/plc_phecu_fec_hq.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_hq_ecu.c b/lc3plus/plc_phecu_hq_ecu.c index 5b1978bcab..8429d422c9 100644 --- a/lc3plus/plc_phecu_hq_ecu.c +++ b/lc3plus/plc_phecu_hq_ecu.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_lf_peak_analysis.c b/lc3plus/plc_phecu_lf_peak_analysis.c index 0bcc98d7a4..6c519071b8 100644 --- a/lc3plus/plc_phecu_lf_peak_analysis.c +++ b/lc3plus/plc_phecu_lf_peak_analysis.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_rec_frame.c b/lc3plus/plc_phecu_rec_frame.c index 0e6570743a..6b86a7a743 100644 --- a/lc3plus/plc_phecu_rec_frame.c +++ b/lc3plus/plc_phecu_rec_frame.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_setf0hz.c b/lc3plus/plc_phecu_setf0hz.c index b14327e2b2..b713fd93a8 100644 --- a/lc3plus/plc_phecu_setf0hz.c +++ b/lc3plus/plc_phecu_setf0hz.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_spec_ana.c b/lc3plus/plc_phecu_spec_ana.c index b496900305..89724d1575 100644 --- a/lc3plus/plc_phecu_spec_ana.c +++ b/lc3plus/plc_phecu_spec_ana.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_subst_spec.c b/lc3plus/plc_phecu_subst_spec.c index 43f806339b..7b44ccc78c 100644 --- a/lc3plus/plc_phecu_subst_spec.c +++ b/lc3plus/plc_phecu_subst_spec.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" #include "constants.h" diff --git a/lc3plus/plc_phecu_tba_per_band_gain.c b/lc3plus/plc_phecu_tba_per_band_gain.c index 9f585f28dd..6cd8168811 100644 --- a/lc3plus/plc_phecu_tba_per_band_gain.c +++ b/lc3plus/plc_phecu_tba_per_band_gain.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_tba_spect_Xavg.c b/lc3plus/plc_phecu_tba_spect_Xavg.c index 600b9714e4..e8cca43309 100644 --- a/lc3plus/plc_phecu_tba_spect_Xavg.c +++ b/lc3plus/plc_phecu_tba_spect_Xavg.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_tba_trans_dect_gains.c b/lc3plus/plc_phecu_tba_trans_dect_gains.c index e5f0d3caae..61107dec58 100644 --- a/lc3plus/plc_phecu_tba_trans_dect_gains.c +++ b/lc3plus/plc_phecu_tba_trans_dect_gains.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_trans_burst_ana_sub.c b/lc3plus/plc_phecu_trans_burst_ana_sub.c index c860cd6ce3..34eadd7cf7 100644 --- a/lc3plus/plc_phecu_trans_burst_ana_sub.c +++ b/lc3plus/plc_phecu_trans_burst_ana_sub.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_tdc.c b/lc3plus/plc_tdc.c index 1a1a408f4d..bbee9e0651 100644 --- a/lc3plus/plc_tdc.c +++ b/lc3plus/plc_tdc.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" /***************************************************************************\ * contents/description: Main function for Time domain concealment \***************************************************************************/ diff --git a/lc3plus/plc_tdc_tdac.c b/lc3plus/plc_tdc_tdac.c index 329361b14c..4d36d870ad 100644 --- a/lc3plus/plc_tdc_tdac.c +++ b/lc3plus/plc_tdc_tdac.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_update.c b/lc3plus/plc_update.c index a151420eb7..e19515fd7a 100644 --- a/lc3plus/plc_update.c +++ b/lc3plus/plc_update.c @@ -8,7 +8,6 @@ ******************************************************************************/ #include "functions.h" -#include "options.h" void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, diff --git a/lc3plus/quantize_spec.c b/lc3plus/quantize_spec.c index 7886b4586d..95f4433f5a 100644 --- a/lc3plus/quantize_spec.c +++ b/lc3plus/quantize_spec.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static LC3_INT sign(LC3_FLOAT x); diff --git a/lc3plus/reorder_bitstream.c b/lc3plus/reorder_bitstream.c index 77b50d7a13..e69809eb32 100644 --- a/lc3plus/reorder_bitstream.c +++ b/lc3plus/reorder_bitstream.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" diff --git a/lc3plus/resamp12k8.c b/lc3plus/resamp12k8.c index 0cab5daae9..fa8d3c828c 100644 --- a/lc3plus/resamp12k8.c +++ b/lc3plus/resamp12k8.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], diff --git a/lc3plus/residual_coding.c b/lc3plus/residual_coding.c index 42094d275f..e5d90124c0 100644 --- a/lc3plus/residual_coding.c +++ b/lc3plus/residual_coding.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits diff --git a/lc3plus/residual_decoding.c b/lc3plus/residual_decoding.c index 97fd94afc3..f0b9d64815 100644 --- a/lc3plus/residual_decoding.c +++ b/lc3plus/residual_decoding.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits diff --git a/lc3plus/setup_com_lc3.c b/lc3plus/setup_com_lc3.c index 17054d1ffc..ca876eb78d 100644 --- a/lc3plus/setup_com_lc3.c +++ b/lc3plus/setup_com_lc3.c @@ -8,7 +8,6 @@ ******************************************************************************/ #include "functions.h" -#include "options.h" LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) { diff --git a/lc3plus/setup_dec_lc3.c b/lc3plus/setup_dec_lc3.c index c14309720e..8cf92311c9 100644 --- a/lc3plus/setup_dec_lc3.c +++ b/lc3plus/setup_dec_lc3.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "setup_dec_lc3.h" #include "functions.h" #include diff --git a/lc3plus/setup_enc_lc3.c b/lc3plus/setup_enc_lc3.c index 986b43d608..27401aca19 100644 --- a/lc3plus/setup_enc_lc3.c +++ b/lc3plus/setup_enc_lc3.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "setup_enc_lc3.h" #include "functions.h" #include diff --git a/lc3plus/sns_compute_scf.c b/lc3plus/sns_compute_scf.c index 5cb041925b..744d9e2d6d 100644 --- a/lc3plus/sns_compute_scf.c +++ b/lc3plus/sns_compute_scf.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) diff --git a/lc3plus/sns_interpolate_scf.c b/lc3plus/sns_interpolate_scf.c index 4419397890..49bf0afe37 100644 --- a/lc3plus/sns_interpolate_scf.c +++ b/lc3plus/sns_interpolate_scf.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) diff --git a/lc3plus/sns_quantize_scf.c b/lc3plus/sns_quantize_scf.c index 704127cce7..738738eb32 100644 --- a/lc3plus/sns_quantize_scf.c +++ b/lc3plus/sns_quantize_scf.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); diff --git a/lc3plus/tns_coder.c b/lc3plus/tns_coder.c index ff3883d2b5..257e2b32ad 100644 --- a/lc3plus/tns_coder.c +++ b/lc3plus/tns_coder.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); diff --git a/lc3plus/tns_decoder.c b/lc3plus/tns_decoder.c index d3aeefc3a3..8b20652e5c 100644 --- a/lc3plus/tns_decoder.c +++ b/lc3plus/tns_decoder.c @@ -8,7 +8,6 @@ ******************************************************************************/ -#include "options.h" #include "functions.h" void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index 01ad362b71..36faf111bd 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -12,7 +12,7 @@ unzip lc3plus_sources.zip -d . # Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) git apply --ignore-whitespace lc3plus.patch -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c +mv ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c # Remove unneeded files diff --git a/scripts/lc3plus_lib_setup/lc3plus.patch b/scripts/lc3plus_lib_setup/lc3plus.patch index 14b81a3972..fdf8a69f5b 100644 --- a/scripts/lc3plus_lib_setup/lc3plus.patch +++ b/scripts/lc3plus_lib_setup/lc3plus.patch @@ -1,26 +1,7 @@ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "stdint.h" - #include - #include -@@ -1010,8 +1011,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-07-13 12:41:20 +@@ -1010,8 +1010,8 @@ LC3_UINT8 blacklist[FEC_N_MODES]; LC3_INT32 rop; @@ -30,29 +11,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* initialization */ blacklist[0] = 0; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void ac_shift_fl(Encoder_State_fl* st); -@@ -620,7 +621,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-07-13 12:41:20 +@@ -620,7 +620,7 @@ if (st.pc_c_bp_side != 0) { @@ -61,7 +23,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } } -@@ -891,7 +892,7 @@ +@@ -891,7 +891,7 @@ { LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0; @@ -70,7 +32,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin mask = ((LC3_INT)pow(2, 24) - 1) >> bits; val = st->low + mask; over1 = val >> 24; -@@ -1078,8 +1079,8 @@ +@@ -1078,8 +1078,8 @@ } /* Residual bits */ @@ -81,51 +43,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (st.cache >= 0) { nbits_ari = nbits_ari + 8; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - /* DCT */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void dct2_init(Dct2* dct, int length) -@@ -27,11 +28,11 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-07-13 12:41:20 +@@ -27,11 +27,11 @@ void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output) { @@ -138,7 +59,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (i = 0; i < len / 2; i++) { tmp1[i] = cmplx(input[i * 2], 0); -@@ -49,8 +50,8 @@ +@@ -49,8 +49,8 @@ void dct4_init(Dct4* dct, int length) { @@ -148,7 +69,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin dct->length = length; dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); -@@ -73,12 +74,12 @@ +@@ -73,12 +73,12 @@ void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output) { @@ -164,16 +85,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); -@@ -53,7 +54,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-07-13 12:41:20 +@@ -53,7 +53,7 @@ LC3_INT nbbytes = nbbits >> 3; LC3_INT lastnz; LC3_INT bw_cutoff_idx; @@ -182,7 +95,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (nbits > nbbits) { -@@ -173,7 +174,7 @@ +@@ -173,7 +173,7 @@ } /* Last non-zero tuple */ @@ -193,16 +106,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (*lastnz > N) { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -@@ -53,8 +54,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-07-13 12:41:20 +@@ -53,8 +53,8 @@ if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1) { @@ -214,7 +119,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin # ifdef ENABLE_025_DMS_MODE diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-06-29 12:58:27 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-07-13 12:41:20 @@ -24,13 +24,13 @@ typedef uint32_t LC3_UINT32; @@ -244,16 +149,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define LC3_SQRT(x) (sqrtf(x)) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) -@@ -68,7 +69,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-07-13 12:41:20 +@@ -68,7 +68,7 @@ dist = bw_dist[counter]; for (i = stop; i >= stop - dist; i--) { @@ -264,16 +161,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin brickwall = 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, -@@ -33,11 +34,11 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-07-13 12:41:20 +@@ -33,11 +33,11 @@ /* Last non zero touple */ if (bfi_ext == 1) { @@ -287,29 +176,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } /* LSB mode bit */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -@@ -60,8 +61,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-07-13 12:41:20 +@@ -60,8 +60,8 @@ } else { g_min = x_max / (32767 - 0.375); } @@ -320,7 +190,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS); -@@ -76,7 +77,7 @@ +@@ -76,7 +76,7 @@ tmp += x[i + 1] * x[i + 1]; tmp += x[i + 2] * x[i + 2]; tmp += x[i + 3] * x[i + 3]; @@ -331,24 +201,20 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-06-29 12:58:27 -@@ -8,7 +8,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-07-13 12:41:20 +@@ -8,7 +8,6 @@ ******************************************************************************/ - -+#include "options.h" #include "cfft.h" #include "iisfft.h" /* for M_PIl */ #include /* for abs() */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-06-29 12:58:27 -@@ -8,14 +8,15 @@ - ******************************************************************************/ - ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-07-13 12:41:20 +@@ -10,12 +10,12 @@ -+#include "options.h" #include #include -#include "iis_fft.h" @@ -362,7 +228,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /**************************************************************************************************/ /* AFFT uses two fft implementations -@@ -24,9 +25,6 @@ +@@ -24,9 +24,6 @@ fast lengths, check the fft_n function. */ @@ -372,7 +238,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define FFT_COMPLEX 1 #define FFT_REAL 2 -@@ -122,12 +120,13 @@ +@@ -122,12 +119,13 @@ IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output) { @@ -389,7 +255,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-06-29 12:58:27 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-07-13 12:41:20 @@ -12,6 +12,7 @@ #define IIS_FFT_H @@ -398,20 +264,9 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include "cfft.h" #ifdef __cplusplus -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - - #include - #include /* for mmove */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-06-29 12:58:27 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-07-13 12:41:20 @@ -11,6 +11,7 @@ #ifndef IISFFT_H #define IISFFT_H @@ -420,29 +275,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #ifndef M_PIl #define M_PIl 3.1415926535897932384626433832795029L /* pi */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - /* Function expects already flipped window */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "lc3.h" - #include "defines.h" - #include "functions.h" -@@ -48,8 +49,9 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-07-13 12:41:20 +@@ -48,8 +48,9 @@ case 44100: return 1; case 48000: return 1; case 96000: return 1; @@ -453,7 +289,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) -@@ -58,8 +60,9 @@ +@@ -58,8 +59,9 @@ { case LC3PLUS_PLC_ADVANCED: /* fallthru */ return 1; @@ -464,7 +300,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } static int lc3plus_frame_size_supported(float frame_ms) -@@ -69,8 +72,9 @@ +@@ -69,8 +71,9 @@ case 25: /* fallthru */ case 50: /* fallthru */ case 100: return 1; @@ -475,7 +311,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } static int null_in_list(void **list, int n) -@@ -97,13 +101,14 @@ +@@ -97,13 +100,14 @@ /* encoder functions *********************************************************/ LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]) { @@ -491,7 +327,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < channels; ch++) { RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); -@@ -142,6 +147,7 @@ +@@ -142,6 +146,7 @@ int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder) { int ch = 0, totalBytes = 0; @@ -499,7 +335,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin RETURN_IF(encoder == NULL, 0); RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR); -@@ -150,7 +156,7 @@ +@@ -150,7 +155,7 @@ totalBytes += encoder->channel_setup[ch]->targetBytes; } @@ -508,7 +344,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (encoder->fs_in == 44100) { -@@ -191,11 +197,13 @@ +@@ -191,11 +196,13 @@ LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth) { @@ -523,7 +359,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (encoder->bandwidth != bandwidth) { if (encoder->fs_in > 40000) { effective_fs = 40000; -@@ -338,9 +346,9 @@ +@@ -338,9 +345,9 @@ LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder) { @@ -534,7 +370,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < encoder->channels; ch++) { mdct_free(&encoder->channel_setup[ch]->mdctStruct); dct2_free(&encoder->channel_setup[ch]->dct2StructSNS); -@@ -351,9 +359,9 @@ +@@ -351,9 +358,9 @@ LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder) { @@ -545,7 +381,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < decoder->channels; ch++) { dct4_free(&decoder->channel_setup[ch]->dct4structImdct); real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft); -@@ -378,11 +386,14 @@ +@@ -378,11 +385,14 @@ LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode) { @@ -562,143 +398,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (error != LC3PLUS_OK) { encoder->epmode = oldEpmode; // preserve old epmode in case of failure -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-06-29 12:58:27 -@@ -0,0 +1,99 @@ -+/****************************************************************************** -+* ETSI TS 103 634 V1.4.1 * -+* Low Complexity Communication Codec Plus (LC3plus) * -+* * -+* Copyright licence is solely granted through ETSI Intellectual Property * -+* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -+* estoppel or otherwise. * -+******************************************************************************/ -+ -+ -+#include "options.h" -+#include "functions.h" -+#include "fft/iis_fft.c" -+#include "fft/iisfft.c" -+#include "fft/cfft.c" -+ -+void fft_init(Fft* fft, int length) -+{ -+ HANDLE_IIS_FFT handle = NULL; -+ IIS_FFT_ERROR error = 0; -+ assert(length % 2 == 0); -+ -+ fft->length = length; -+ -+ error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ fft->handle = handle; -+} -+ -+void fft_free(Fft* fft) -+{ -+ IIS_FFT_ERROR error = 0; -+ -+ if (fft) { -+ error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ memset(fft, 0, sizeof(*fft)); -+ } -+} -+ -+void real_fft_free(Fft* fft) -+{ -+ IIS_FFT_ERROR error = 0; -+ -+ if (fft) { -+ error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ memset(fft, 0, sizeof(*fft)); -+ } -+} -+ -+void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) -+{ -+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -+ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ -+ -+ fft->length = length; -+ -+ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); -+ assert(error == IIS_FFT_NO_ERROR); -+ fft->handle = *handle; -+} -+ -+ -+void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) -+{ -+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -+ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ -+ -+ fft->length = length; -+ -+ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ fft->handle = *handle; -+} -+ -+void fft_apply(Fft* fft, const Complex* input, Complex* output) -+{ -+ IIS_FFT_ERROR error = 0; -+ error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+} -+ -+ -+void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) -+{ -+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -+ -+ UNUSED(error); -+ -+ error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+} -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) -@@ -104,6 +105,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-07-13 12:41:20 +@@ -104,6 +104,7 @@ { LC3_FLOAT tmp[MAX_LEN * 2] = {0}; LC3_INT i = 0; @@ -706,7 +409,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin move_float(tmp, mdct->mem, mdct->mem_length); move_float(tmp + mdct->mem_length, input, mdct->length); -@@ -112,7 +114,7 @@ +@@ -112,7 +113,7 @@ mult_vec(tmp, mdct->window, mdct->length * 2); @@ -715,34 +418,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (i = 0; i < hlen; i++) { output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i]; output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 2023-06-29 12:58:27 -@@ -0,0 +1 @@ -+Win32/ -\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35 -@@ -8,15 +8,16 @@ - ******************************************************************************/ - - #include "functions.h" -+#include "options.h" - - - void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-07-13 12:50:08 +@@ -14,9 +14,9 @@ const LC3_INT bands_number, const LC3_FLOAT* ener) { *near_nyquist_flag = 0; @@ -754,139 +433,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin LC3_INT i = 0; LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, -@@ -56,6 +57,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-07-13 12:41:20 +@@ -56,6 +56,8 @@ { case 2: { @@ -895,7 +445,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin assert(decoder->fs_idx == floor(decoder->fs / 10000)); // phaseECU supports only 10ms framing assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100); -@@ -69,7 +72,7 @@ +@@ -69,7 +71,7 @@ } /* call phaseEcu */ @@ -904,106 +454,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (prev_bfi_plc2 == 0) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -@@ -135,13 +136,13 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-07-13 12:41:20 +@@ -135,13 +135,13 @@ if (max_xfp_abs >= 0.5) { @@ -1021,16 +475,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - #include "constants.h" -@@ -30,6 +31,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-07-13 12:41:20 +@@ -30,6 +30,7 @@ LC3_INT32 segmentLen, e; LC3_FLOAT Xph; LC3_FLOAT seed_local; @@ -1038,7 +484,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin UNUSED(corr_phase_dbg); UNUSED(X_i_new_re_dbg); -@@ -49,8 +51,8 @@ +@@ -49,8 +50,8 @@ // EVOLVE PHASE ----------------- @@ -1049,7 +495,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin one_peak_flag_mask = -1; if (n_plocs < 3 && n_plocs > 0) { -@@ -219,9 +221,10 @@ +@@ -219,9 +220,10 @@ } static LC3_INT32 own_rand(LC3_INT32 seed) { @@ -1065,15 +511,14 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-29 12:58:35 -@@ -6,13 +6,14 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-07-13 12:50:08 +@@ -6,13 +6,13 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - + -+#include "options.h" #include "defines.h" #include "functions.h" @@ -1083,7 +528,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { LC3_INT32 i; -@@ -34,10 +35,10 @@ +@@ -34,10 +34,10 @@ trans[i] = 1.0; /* 0/0 no transient , no power change */ } } @@ -1096,39 +541,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin + return; } -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-29 12:58:35 -@@ -6,16 +6,17 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-07-13 12:50:08 +@@ -6,16 +6,16 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - + -+#include "options.h" #include "defines.h" #include "functions.h" @@ -1143,7 +565,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { LC3_FLOAT gr_pow_left[MAX_LGW]; LC3_FLOAT gr_pow_right[MAX_LGW]; -@@ -27,7 +28,7 @@ +@@ -27,7 +27,7 @@ LC3_INT32 attDegreeFrames; LC3_FLOAT thresh_dbg; @@ -1152,7 +574,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin UNUSED(tr_dec_dbg); UNUSED(gpc_dbg); -@@ -39,7 +40,7 @@ +@@ -39,7 +39,7 @@ } @@ -1161,73 +583,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg); return; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - /***************************************************************************\ - * contents/description: Main function for Time domain concealment - \***************************************************************************/ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - #include "functions.h" -+#include "options.h" - - - void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static LC3_INT sign(LC3_FLOAT x); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], -@@ -17,6 +18,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-07-13 12:41:20 +@@ -17,6 +17,8 @@ LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0; LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0}; @@ -1236,7 +595,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin const LC3_FLOAT *filter; const LC3_FLOAT *filt_input, *filt_coeff; -@@ -49,12 +52,12 @@ +@@ -49,12 +51,12 @@ /* Upsampling & Low-pass Filtering & Downsampling */ @@ -1255,7 +614,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin k = 0; for (i = 0; i < N12k8; i++) { -@@ -78,9 +81,8 @@ +@@ -78,9 +80,8 @@ /* 50Hz High-Pass */ @@ -1267,51 +626,10 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (i = 0; i < len_12k8; i++) { LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - #include "functions.h" -+#include "options.h" - - LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) - { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "setup_dec_lc3.h" - #include "functions.h" - #include -@@ -32,6 +33,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-07-13 12:41:20 +@@ -32,6 +32,7 @@ LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu; HANDLE_IIS_FFT handle_fft_phaseecu; HANDLE_IIS_FFT handle_ifft_phaseecu; @@ -1319,7 +637,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < channels; ch++) { DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); -@@ -56,7 +58,7 @@ +@@ -56,7 +57,7 @@ sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); @@ -1328,7 +646,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (decoder) { decoder->channel_setup[ch] = setup; -@@ -346,6 +348,7 @@ +@@ -346,6 +347,7 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) { int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0; @@ -1336,7 +654,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (decoder->hrmode) { -@@ -375,7 +378,7 @@ +@@ -375,7 +377,7 @@ channel_bytes = nBytes; @@ -1347,16 +665,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "setup_enc_lc3.h" - #include "functions.h" - #include -@@ -33,6 +34,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-07-13 12:41:20 +@@ -33,6 +33,7 @@ , int32_t lfe_channel_array[] ) { @@ -1364,7 +674,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels)); alloc_encoder(encoder, channels); -@@ -56,7 +58,6 @@ +@@ -56,7 +57,6 @@ encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; encoder->r12k8_mem_out_len = 24; @@ -1372,7 +682,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < encoder->channels; ch++) { encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; -@@ -220,6 +221,7 @@ +@@ -220,6 +220,7 @@ if (encoder->hrmode) { @@ -1380,7 +690,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin switch (encoder->frame_dms) { case 25: -@@ -243,6 +245,7 @@ +@@ -243,6 +244,7 @@ default: return LC3PLUS_HRMODE_ERROR; } @@ -1388,7 +698,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { -@@ -368,7 +371,7 @@ +@@ -368,7 +370,7 @@ setup->total_bits = setup->targetBytes << 3; setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits - encoder->noise_fac_bits - encoder->BW_cutoff_bits - @@ -1399,16 +709,8 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin setup->targetBitsInit = setup->targetBitsInit - 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) -@@ -109,7 +110,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-07-13 12:41:20 +@@ -109,7 +109,7 @@ /* Log-domain */ for (i = 0; i < 64; i++) { @@ -1417,58 +719,3 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } /* Downsampling */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-06-29 12:58:27 -@@ -17,6 +17,7 @@ - #include - #include - -+ - #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ - defined(__aarch64__) - #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) -- GitLab From 80d96fbc4f656f0e24b37d2ad19b9e59e1af5fc2 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:54:33 +0200 Subject: [PATCH 359/591] [cleanup] strip SPIT_ABS_SCALING_INTERP --- lib_com/options.h | 1 - lib_rend/ivas_splitRendererPost.c | 34 ------------------------------- 2 files changed, 35 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b66fcd5150..fb317df267 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -188,7 +188,6 @@ -//#define SPIT_ABS_SCALING_INTERP //#define USE_DOLBY_HRTFS_WITH_LIB_REND_HOA3 diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index cf4105bdea..f65cd47c9d 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1128,10 +1128,6 @@ static void interpolate_pred_matrix( float mix_mat_im1[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float mix_mat_re2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float mix_mat_im2[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; -#ifdef SPIT_ABS_SCALING_INTERP - float abs1, abs2; - float mix_mat_abs[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; -#endif for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { @@ -1172,20 +1168,6 @@ static void interpolate_pred_matrix( } } -#ifdef SPIT_ABS_SCALING_INTERP - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) - { - IVAS_CALCULATE_ABS( mix_mat_re1[ch_idx1][ch_idx2], mix_mat_im1[ch_idx1][ch_idx2], abs1 ); - IVAS_CALCULATE_ABS( mix_mat_re2[ch_idx1][ch_idx2], mix_mat_im2[ch_idx1][ch_idx2], abs2 ); - diff = abs1 - abs2; - mix_mat_abs[ch_idx1][ch_idx2] = abs1 - ( diff * interp_fact ); - mix_mat_abs[ch_idx1][ch_idx2] = fabsf( mix_mat_abs[ch_idx1][ch_idx2] ); - } - } -#endif - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) @@ -1198,22 +1180,6 @@ static void interpolate_pred_matrix( } } -#ifdef SPIT_ABS_SCALING_INTERP - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ ) - { - IVAS_CALCULATE_ABS( mat_re[ch_idx1][ch_idx2], mat_im[ch_idx1][ch_idx2], abs1 ); - if ( abs1 > 1e-10 ) - { - abs1 = mix_mat_abs[ch_idx1][ch_idx2] / abs1; - mat_re[ch_idx1][ch_idx2] = mat_re[ch_idx1][ch_idx2] * abs1; - mat_im[ch_idx1][ch_idx2] = mat_im[ch_idx1][ch_idx2] * abs1; - } - } - } -#endif - return; } -- GitLab From 8e4c83825124c5cc2892079f83dd03db74b870b4 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 12:55:18 +0200 Subject: [PATCH 360/591] [cleanup] strip USE_DOLBY_HRTFS_WITH_LIB_REND_HOA3 --- lib_com/options.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fb317df267..9670bf64ab 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,13 +184,6 @@ //#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes //#define DBG_WAV_WRITER //#define SPLIT_POSE_CORRECTION_DEBUG - - - - - -//#define USE_DOLBY_HRTFS_WITH_LIB_REND_HOA3 - //#define SPLIT_MD_CODING_DEBUG /*CLDFB CODEC SWITCHES -- START*/ -- GitLab From e2aa726eb28e59d429a74d2a24ee60771cfec8c5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 13:04:23 +0200 Subject: [PATCH 361/591] [cleanup] move split rendering debugging switches into appropriate section and clean up options.h --- lib_com/options.h | 18 +++++++----------- .../lc3plus/ivas_lc3plus_unit_test.c | 8 -------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9670bf64ab..ca36e2ec62 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -130,7 +130,13 @@ #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ -#endif +/*Split Rendering Debug switches*/ +/*#define DBG_WAV_WRITER*/ /* add debugging function dbgwrite_wav() */ +/*#define SPLIT_REND_WITH_HEAD_ROT_DEBUG*/ /* debugging switch for split rendering */ +/*#define SPLIT_POSE_CORRECTION_DEBUG*/ /* debugging switch for split rendering pose correction */ +/*#define SPLIT_MD_CODING_DEBUG*/ /* debugging switch for split rendering metadata coding */ + +#endif /* DEBUGGING */ /* #################### End DEBUGGING switches ############################ */ @@ -179,17 +185,7 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #ifdef SPLIT_REND_WITH_HEAD_ROT - - -//#define SPLIT_REND_WITH_HEAD_ROT_DEBUG // only for debugging purposes -//#define DBG_WAV_WRITER -//#define SPLIT_POSE_CORRECTION_DEBUG -//#define SPLIT_MD_CODING_DEBUG - -/*CLDFB CODEC SWITCHES -- START*/ #define SPLIT_REND_PLC -/*CLDFB CODEC SWITCHES -- END*/ - #endif /* SPLIT_REND_WITH_HEAD_ROT */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c index cdabaedcf4..b8a5563c13 100644 --- a/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c +++ b/scripts/split_rendering/lc3plus/ivas_lc3plus_unit_test.c @@ -621,14 +621,6 @@ int main( ret = selectiveDecIvas20msLc3plus5ms_48kHz_scenario_per_subframe_switches_dec_first_no_caching(); if ( ret != 0 ) return ret; -#endif -#if 0 - ret = selectiveDecIvas5msLc3plus5ms_48kHz_scenario_decode_all_subframes(); - if(ret != 0) - return ret; - ret = selectiveDecIvas5msLc3plus5ms_48kHz_scenario_dont_decode_last_subframes(); - if(ret != 0) - return ret; #endif return ret; } -- GitLab From 54d273710f1e1b9fa6248626e0d76deadfeb7271 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 13 Jul 2023 13:07:28 +0200 Subject: [PATCH 362/591] Clean up todo comments --- lib_rend/ivas_prot_rend.h | 1 - lib_rend/ivas_splitRendererPre.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 47310907eb..1e9c4c6206 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -230,7 +230,6 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT -/* TODO(sgi): Rework interface */ void ObjRenderIvasFrame_splitBinaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 34f5ce4da7..c1dc87051d 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1746,7 +1746,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, { ivas_error error, ch, num_ch; CLDFB_TYPE cldfbMode; - uint8_t useLc3plus; uint8_t isCldfbNeeded = 0; cldfbMode = CLDFB_ANALYSIS; @@ -1755,7 +1754,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, return error; } - useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ error = IVAS_ERR_OK; if ( @@ -1821,7 +1819,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, if ( is_pcm_out == 0 ) { - if ( !useLc3plus ) + if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD ) { error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ); if ( error != IVAS_ERR_OK ) @@ -2046,7 +2044,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( if ( pcm_out == 0 ) { pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; - pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; /* TODO(sgi): useLc3plus could be changed to splitCodec */ + pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; if ( !useLc3plus ) { // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; -- GitLab From 3552f3612d58dfbdf87ab4969ba70217f88fbcee Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 13:15:59 +0200 Subject: [PATCH 363/591] [cleanup] accept/consolidate SPLIT_REND_PLC --- apps/renderer.c | 18 ++------ lib_com/cnst.h | 2 +- lib_com/options.h | 4 -- lib_rend/ivas_prot_rend.h | 7 +-- lib_rend/ivas_splitRend_lcld_dec.c | 16 +------ lib_rend/ivas_splitRendererPLC.c | 2 +- lib_rend/ivas_splitRendererPost.c | 52 ---------------------- lib_rend/ivas_stat_rend.h | 6 --- lib_rend/lib_rend.c | 69 +++++++----------------------- lib_rend/lib_rend.h | 2 +- 10 files changed, 25 insertions(+), 153 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index db80ae716e..6fb985504d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -33,8 +33,6 @@ #include "lib_rend.h" #ifdef SPLIT_REND_WITH_HEAD_ROT #include "split_render_file_read_write.h" -#endif -#ifdef SPLIT_REND_PLC #include "split_rend_bfi_file_reader.h" #endif #include @@ -156,7 +154,7 @@ typedef struct char outMetadataFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #endif char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT char splitRendBFIFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; #endif char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; @@ -201,8 +199,6 @@ typedef enum CmdLnOptionId_inputGain, #ifdef SPLIT_REND_WITH_HEAD_ROT CmdLnOptionId_outputMetadata, -#endif -#ifdef SPLIT_REND_PLC CmdLnOptionId_SplitRendBFIFile, #endif CmdLnOptionId_referenceVectorFile, @@ -263,8 +259,6 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "om", .description = "coded metadata file for BINAURAL_SPLIT_PCM output mode", }, -#endif -#ifdef SPLIT_REND_PLC { .id = CmdLnOptionId_SplitRendBFIFile, .match = "post_rend_bfi_file", @@ -739,8 +733,6 @@ int main( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS]; HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS]; int16_t cldfb_in, CLDFBframeSize_smpls; -#endif -#ifdef SPLIT_REND_PLC SplitRendBFIFileReader *splitRendBFIReader = NULL; #endif Vector3PairFileReader *referenceVectorReader = NULL; @@ -853,7 +845,7 @@ int main( } } -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( !isEmptyString( args.splitRendBFIFilePath ) ) { convert_backslash( args.splitRendBFIFilePath ); @@ -1549,7 +1541,7 @@ int main( } } -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL ) { @@ -2467,8 +2459,6 @@ static CmdlnArgs defaultArgs( clearString( args.headRotationFilePath ); #ifdef SPLIT_REND_WITH_HEAD_ROT clearString( args.outMetadataFilePath ); -#endif -#ifdef SPLIT_REND_PLC clearString( args.splitRendBFIFilePath ); #endif clearString( args.referenceVectorFilePath ); @@ -2558,8 +2548,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->outMetadataFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#endif -#ifdef SPLIT_REND_PLC case CmdLnOptionId_SplitRendBFIFile: assert( numOptionValues == 1 ); strncpy( args->splitRendBFIFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); diff --git a/lib_com/cnst.h b/lib_com/cnst.h index b5d414d29e..43987411ad 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -626,7 +626,7 @@ enum #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT #define CLDFB_PLC_XF 2 /* Length of cross-fade into first good frame after frame loss in CLDFB cols. */ #endif diff --git a/lib_com/options.h b/lib_com/options.h index ca36e2ec62..b018e97495 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,10 +184,6 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REND_PLC -#endif /* SPLIT_REND_WITH_HEAD_ROT */ - /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 47310907eb..45df8452fc 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1119,11 +1119,8 @@ void ivas_splitBinLCLDDecProcess( BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, ivas_split_rend_bits_t *pBits, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] -#ifdef SPLIT_REND_PLC - , + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t bfi -#endif ); ivas_error ivas_splitBinPreRendOpen( @@ -1202,7 +1199,6 @@ void ivas_splitBinPostRendMdDec( #endif ); -#ifdef SPLIT_REND_PLC ivas_error ivas_splitBinRendPLCOpen( SPLIT_REND_PLC_HANDLE* phSplitRendPLC ); @@ -1226,7 +1222,6 @@ void ivas_splitBinRendPLC( float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t num_chs ); -#endif /* SPLIT_REND_PLC */ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG void ivas_log_cldfb2wav_data( diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index 641d642152..9f12d9544d 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -100,9 +100,7 @@ ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, fwrite( &iChannels, sizeof( int ), 1, splitBinLCLDDec->cldfbOut ); fwrite( &num_bands, sizeof( int ), 1, splitBinLCLDDec->cldfbOut ); #endif -#ifdef SPLIT_REND_PLC ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC ); -#endif *hSplitBinLCLDDec = splitBinLCLDDec; return error; @@ -131,9 +129,7 @@ void ivas_splitBinLCLDDecClose( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec ) fclose( ( *hSplitBinLCLDDec )->cldfbOut ); } #endif -#ifdef SPLIT_REND_PLC ivas_splitBinRendPLCClose( &( *hSplitBinLCLDDec )->hSplitRendPLC ); -#endif free( *hSplitBinLCLDDec ); *hSplitBinLCLDDec = NULL; @@ -145,12 +141,8 @@ void ivas_splitBinLCLDDecProcess( BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, ivas_split_rend_bits_t *pBits, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] -#ifdef SPLIT_REND_PLC - , - const int16_t bfi -#endif -) + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] , + const int16_t bfi) { push_wmops( "ivas_splitBinLCLDDecProcess" ); @@ -162,10 +154,8 @@ void ivas_splitBinLCLDDecProcess( #ifdef CLDFB_DEBUG printf( "Bytes read = %d\n", iBytesWritten ); #endif -#ifdef SPLIT_REND_PLC if ( !bfi ) { -#endif // Initialized with zeros....... :( for ( int32_t n = 0; n < hSplitBinLCLDDec->iChannels; n++ ) { @@ -204,7 +194,6 @@ void ivas_splitBinLCLDDecProcess( } } #endif -#ifdef SPLIT_REND_PLC if ( hSplitBinLCLDDec->hSplitRendPLC->prev_bfi != 0 ) { /* cross-fade recovered frame into good frame */ @@ -218,7 +207,6 @@ void ivas_splitBinLCLDDecProcess( } /* save PLC state */ ivas_splitBinRendPLCsaveState( hSplitBinLCLDDec->hSplitRendPLC, Cldfb_Out_Real, Cldfb_Out_Imag, (int16_t) hSplitBinLCLDDec->iChannels ); -#endif pop_wmops(); diff --git a/lib_rend/ivas_splitRendererPLC.c b/lib_rend/ivas_splitRendererPLC.c index eafc5617dd..8df9a29cd9 100644 --- a/lib_rend/ivas_splitRendererPLC.c +++ b/lib_rend/ivas_splitRendererPLC.c @@ -34,7 +34,7 @@ #include "options.h" #include -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "ivas_prot.h" #include "prot.h" diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index f65cd47c9d..a0466bcf12 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1324,12 +1324,10 @@ void ivas_SplitRenderer_PostRenderer( int16_t pos_idx, b, brange[2], ch_idx1; int16_t num_md_bands, slot_idx, b2, sf_idx, index_slot, num_subframes, num_slots, sf_idx_md; float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int; -#ifdef SPLIT_REND_PLC #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG BIN_HR_SPLIT_REND_MD rot_md_act[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS]; #else BIN_HR_SPLIT_REND_MD rot_md_act[1][MAX_SPLIT_REND_MD_BANDS]; -#endif #endif int16_t interp_yaw_pose_idx[2], interp_pitch_pose_idx[2], interp_roll_pose_idx[2]; float interp_yaw_fact, interp_pitch_fact, interp_roll_fact; @@ -1381,20 +1379,12 @@ void ivas_SplitRenderer_PostRenderer( for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { -#ifdef SPLIT_REND_PLC /*update the prediction matrix with interpolated matrix*/ rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; rot_md_act[pos_idx][b].gd = gd_int; -#else - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = gd_int; -#endif } } @@ -1422,7 +1412,6 @@ void ivas_SplitRenderer_PostRenderer( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; } -#ifdef SPLIT_REND_PLC for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { @@ -1433,7 +1422,6 @@ void ivas_SplitRenderer_PostRenderer( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; rot_md_act[pos_idx][b].gd = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; } -#endif } } @@ -1454,7 +1442,6 @@ void ivas_SplitRenderer_PostRenderer( { for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { -#ifdef SPLIT_REND_PLC if ( hBinPostRenderer->cf_flag ) { pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; @@ -1476,29 +1463,6 @@ void ivas_SplitRenderer_PostRenderer( mix_mat_im[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0]; mix_mat_im[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1]; } -#else - if ( hBinPostRenderer->cf_flag ) - { - pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; - pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1]; - mix_mat_re[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0] ) + - ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0]; - mix_mat_re[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1] ) + - ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1]; - - mix_mat_im[ch_idx1][0] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0] ) + - ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0]; - mix_mat_im[ch_idx1][1] = fade * ( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1] ) + - ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1]; - } - else - { - mix_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; - mix_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; - mix_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; - mix_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; - } -#endif } brange[0] = pBand_grouping[b]; @@ -1549,7 +1513,6 @@ void ivas_SplitRenderer_PostRenderer( pos_idx = 0; #endif { -#ifdef SPLIT_REND_PLC for ( b = 0; b < num_md_bands; b++ ) { for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) @@ -1561,19 +1524,6 @@ void ivas_SplitRenderer_PostRenderer( } hBinPostRenderer->gd_mem[pos_idx][b] = rot_md_act[pos_idx][b].gd; } -#else - for ( b = 0; b < num_md_bands; b++ ) - { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; - hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; - hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; - hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; - } - hBinPostRenderer->gd_mem[pos_idx][b] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; - } -#endif } hBinPostRenderer->cf_flag = 1; @@ -1721,9 +1671,7 @@ void ivas_init_split_post_rend_handles( SPLIT_POST_REND_WRAPPER *hSplitRendWrapp hSplitRendWrapper->hSplitBinLCLDDec = NULL; hSplitRendWrapper->hLc3plusDec = NULL; ivas_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData ); -#ifdef SPLIT_REND_PLC hSplitRendWrapper->first_good_frame_received = 0; -#endif return; } #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9d75bbbe2f..45d558777a 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -263,7 +263,6 @@ typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct #endif } BIN_HR_SPLIT_LCLD_ENC, *BIN_HR_SPLIT_LCLD_ENC_HANDLE; -#ifdef SPLIT_REND_PLC typedef struct { float Cldfb_Prev_BinReal[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX + CLDFB_PLC_XF][CLDFB_NO_CHANNELS_MAX]; @@ -279,7 +278,6 @@ typedef struct int16_t prev_bfi; int16_t bf_count; } SPLIT_REND_PLC_STRUCT, *SPLIT_REND_PLC_HANDLE; -#endif typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct { @@ -292,9 +290,7 @@ typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct FILE *cldfbOut; int numFrame; #endif -#ifdef SPLIT_REND_PLC SPLIT_REND_PLC_HANDLE hSplitRendPLC; -#endif } BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE; typedef struct @@ -340,9 +336,7 @@ typedef struct MULTI_BIN_REND_POSE_DATA multiBinPoseData; BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend; BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec; -#ifdef SPLIT_REND_PLC int16_t first_good_frame_received; -#endif IVAS_LC3PLUS_DEC_HANDLE hLc3plusDec; } SPLIT_POST_REND_WRAPPER; #endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 74f9160cdb..9341c4f0da 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -104,11 +104,7 @@ typedef struct const IVAS_REND_HeadRotData *pHeadRotData; #ifdef SPLIT_REND_WITH_HEAD_ROT const RENDER_CONFIG_HANDLE *hhRendererConfig; -#endif -#ifdef SPLIT_REND_PLC const int16_t *pSplitRendBFI; -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT const SPLIT_REND_WRAPPER *pSplitRendWrapper; #endif @@ -268,7 +264,7 @@ struct IVAS_REND #endif IVAS_REND_HeadRotData headRotData; -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t splitRendBFI; #endif @@ -1283,11 +1279,7 @@ static rendering_context getRendCtx( ctx.pHeadRotData = &hIvasRend->headRotData; #ifdef SPLIT_REND_WITH_HEAD_ROT ctx.hhRendererConfig = &hIvasRend->hRendererConfig; -#endif -#ifdef SPLIT_REND_PLC ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT ctx.pSplitRendWrapper = &hIvasRend->splitRendWrapper; #endif ctx.pCombinedOrientationData = &hIvasRend->hCombinedOrientationData; @@ -3755,7 +3747,7 @@ ivas_error IVAS_REND_Open( #endif ); ivas_init_split_post_rend_handles( &hIvasRend->inputsSplitPost[i].splitPostRendWrapper ); -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->splitRendBFI = 0; #endif #ifdef REND_STATIC_MEM_OPT @@ -5144,7 +5136,7 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_REND_SetSplitRendBFI( IVAS_REND_HANDLE hIvasRend, const int16_t bfi ) @@ -7137,12 +7129,8 @@ static ivas_error splitBinLc3plusDecode( static ivas_error renderSplitBinauralWithPostRot( input_split_post_rend *splitBinInput, IVAS_REND_AudioBuffer outAudio, - IVAS_REND_BitstreamBuffer *hBits -#ifdef SPLIT_REND_PLC - , - const int16_t SplitRendBFI -#endif /* SPLIT_REND_PLC */ -) + IVAS_REND_BitstreamBuffer *hBits, + const int16_t SplitRendBFI ) { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -7193,22 +7181,16 @@ static ivas_error renderSplitBinauralWithPostRot( QuaternionsPost[sf_idx] = ivas_split_rend_get_sf_rot_data( pCombinedOrientationData->Quaternions, sf_idx ); } -#ifdef SPLIT_REND_PLC if ( !SplitRendBFI ) { hSplitBin->first_good_frame_received = 1; } -#endif /* SPLIT_REND_PLC */ -#ifdef SPLIT_REND_PLC if ( hSplitBin->first_good_frame_received == 1 ) { -#endif /* SPLIT_REND_PLC */ if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#ifdef SPLIT_REND_PLC if ( !SplitRendBFI ) /* ToDo: this is always true */ -#endif /* SPLIT_REND_PLC */ { ivas_splitBinPostRendMdDec( &bits, @@ -7232,12 +7214,8 @@ static ivas_error renderSplitBinauralWithPostRot( hSplitBin->hSplitBinLCLDDec, &bits, Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural -#ifdef SPLIT_REND_PLC - , - SplitRendBFI -#endif /* SPLIT_REND_PLC */ - ); + Cldfb_ImagBuffer_Binaural, + SplitRendBFI ); isPostRendInputCldfb = 1; } else @@ -7265,8 +7243,6 @@ static ivas_error renderSplitBinauralWithPostRot( tmpCrendBuffer, isPostRendInputCldfb ); } - -#ifdef SPLIT_REND_PLC } else { @@ -7283,7 +7259,6 @@ static ivas_error renderSplitBinauralWithPostRot( copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); } } -#endif /* SPLIT_REND_PLC */ convertInternalBitsBuffToBitsBuffer( hBits, bits ); accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); @@ -7293,9 +7268,7 @@ static ivas_error renderSplitBinauralWithPostRot( return error; } -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, @@ -7695,12 +7668,8 @@ static ivas_error renderInputSplitBin( input_split_post_rend *splitBinInput, const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio, - IVAS_REND_BitstreamBuffer *hBits -#ifdef SPLIT_REND_PLC - , - const int16_t SplitRendBFI -#endif -) + IVAS_REND_BitstreamBuffer *hBits, + const int16_t SplitRendBFI ) { ivas_error error; IVAS_REND_AudioBuffer inAudio; @@ -7723,12 +7692,8 @@ static ivas_error renderInputSplitBin( { case IVAS_REND_AUDIO_CONFIG_BINAURAL: error = renderSplitBinauralWithPostRot( splitBinInput, outAudio, - hBits -#ifdef SPLIT_REND_PLC - , - SplitRendBFI -#endif - ); + hBits, + SplitRendBFI ); break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -7852,12 +7817,8 @@ static ivas_error renderActiveInputsSplitBin( continue; } - if ( ( error = renderInputSplitBin( pCurrentInput, hIvasRend->outputConfig, outAudio, hBits -#ifdef SPLIT_REND_PLC - , - hIvasRend->splitRendBFI -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = renderInputSplitBin( pCurrentInput, hIvasRend->outputConfig, outAudio, hBits, + hIvasRend->splitRendBFI ) ) != IVAS_ERR_OK ) { return error; } @@ -7865,7 +7826,9 @@ static ivas_error renderActiveInputsSplitBin( return IVAS_ERR_OK; } -#endif + + +#endif /* SPLIT_REND_WITH_HEAD_ROT */ static ivas_error renderActiveInputsSba( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 0b9d79aa28..5ecb7c65cb 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -308,7 +308,7 @@ ivas_error IVAS_REND_SetReferenceVector( const IVAS_VECTOR3 refPos /* i : Reference position */ ); -#ifdef SPLIT_REND_PLC +#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_REND_SetSplitRendBFI( IVAS_REND_HANDLE hIvasRend, const int16_t bfi); -- GitLab From fec86360abbb3d36d873f3c2e5559f8b96776a9a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 13:20:46 +0200 Subject: [PATCH 364/591] [cleanup] address some TODO comments --- lib_rend/ivas_splitRendererPost.c | 1 - lib_rend/ivas_splitRendererPre.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index a0466bcf12..6bc5025a60 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -919,7 +919,6 @@ void ivas_splitBinPostRendMdDec( return; } -#define REAL_IMAG_INTERPOLATION /* TODO FhG2Dlb : can this define be removed? */ static void wrap_around_angle( float *a ) { if ( ( *a ) > 180.0f ) diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index c1dc87051d..751fcdccc6 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -635,11 +635,14 @@ static void ComputeCoeffs( } } - if ( 1 ) /* TODO FhG2Dlb : can the else block be removed entirely? */ +#if 0 + if ( 1 ) { - gd2 = 0.0f; - sigma_d = 0.0f; - hMd->gd = 0.0f; +#endif + gd2 = 0.0f; + sigma_d = 0.0f; + hMd->gd = 0.0f; +#if 0 } else { @@ -694,6 +697,7 @@ static void ComputeCoeffs( gd2 = min( gd2, cov_oo_norm_re[0][0] / sigma_d ); gd2 = min( gd2, cov_oo_norm_re[1][1] / sigma_d ); } +#endif /* 0 */ if ( postpred_cov_re[0][0] > EPSILON ) { -- GitLab From 1610d2288bb4e867403e8262d06fc26d24bfbf69 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 13 Jul 2023 13:37:52 +0200 Subject: [PATCH 365/591] change Path objects to strings in cmd line lists depending on python version, subprocess.run does not like them --- tests/codec_be_on_mr_selection/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codec_be_on_mr_selection/__init__.py b/tests/codec_be_on_mr_selection/__init__.py index 2302cec387..34a307a739 100644 --- a/tests/codec_be_on_mr_selection/__init__.py +++ b/tests/codec_be_on_mr_selection/__init__.py @@ -94,7 +94,7 @@ def apply_error_pattern_on_bitstream( if in_bitstream == out_bitstream: in_bitstream = Path(tmpdir).joinpath(in_bitstream.name) - cmd = ["eid-xor", "-vbr", "-fer", in_bitstream, error_pattern, out_bitstream] + cmd = ["eid-xor", "-vbr", "-fer", str(in_bitstream), str(error_pattern), str(out_bitstream)] subprocess.run(cmd) -- GitLab From 2ea8d50da0199b2527e2034241d465c841d623d0 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 13 Jul 2023 13:53:50 +0200 Subject: [PATCH 366/591] Revert "Clean up todo comments" This reverts commit 54d273710f1e1b9fa6248626e0d76deadfeb7271. --- lib_rend/ivas_prot_rend.h | 1 + lib_rend/ivas_splitRendererPre.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7e8dbbe250..45df8452fc 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -230,6 +230,7 @@ void ivas_HRTF_CRend_binary_close( *----------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT +/* TODO(sgi): Rework interface */ void ObjRenderIvasFrame_splitBinaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 751fcdccc6..604dd79ef7 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1750,6 +1750,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, { ivas_error error, ch, num_ch; CLDFB_TYPE cldfbMode; + uint8_t useLc3plus; uint8_t isCldfbNeeded = 0; cldfbMode = CLDFB_ANALYSIS; @@ -1758,6 +1759,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, return error; } + useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ error = IVAS_ERR_OK; if ( @@ -1823,7 +1825,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, if ( is_pcm_out == 0 ) { - if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD ) + if ( !useLc3plus ) { error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ); if ( error != IVAS_ERR_OK ) @@ -2048,7 +2050,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( if ( pcm_out == 0 ) { pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; - pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; + pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; /* TODO(sgi): useLc3plus could be changed to splitCodec */ if ( !useLc3plus ) { // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; -- GitLab From 5addf2b5cc77ba711081527f76889f20a9d90977 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 13 Jul 2023 15:44:47 +0200 Subject: [PATCH 367/591] Ensure changes are cleanly wrapped in SPLIT_REND_WITH_HEAD_ROT (WIP) --- lib_dec/ivas_binRenderer_internal.c | 25 +++++++--- lib_dec/ivas_init_dec.c | 3 -- lib_dec/ivas_rom_dec.h | 2 +- lib_dec/ivas_spar_md_dec.c | 1 - lib_dec/ivas_stat_dec.h | 3 -- lib_rend/ivas_PerceptualModel.h | 5 ++ lib_rend/ivas_PredTables.h | 4 ++ lib_rend/ivas_RMSEnvGrouping.c | 5 +- lib_rend/ivas_RMSEnvGrouping.h | 7 ++- lib_rend/ivas_rotation.c | 4 ++ lib_rend/ivas_splitRend_lcld_dec.c | 5 +- lib_rend/ivas_splitRend_lcld_enc.c | 5 +- lib_rend/ivas_splitRendererPLC.c | 4 +- lib_rend/ivas_splitRendererPost.c | 5 +- lib_rend/ivas_splitRendererPre.c | 5 +- lib_rend/ivas_splitRenderer_utils.c | 5 +- lib_rend/lib_rend.c | 62 +++++++++++-------------- lib_rend/lib_rend.h | 5 +- lib_util/hrtf_file_reader.c | 4 ++ lib_util/render_config_reader.c | 4 ++ lib_util/split_rend_bfi_file_reader.c | 5 +- lib_util/split_rend_bfi_file_reader.h | 4 +- lib_util/split_render_file_read_write.c | 4 +- lib_util/split_render_file_read_write.h | 4 +- 24 files changed, 107 insertions(+), 73 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index e674ebdf18..72f744b4ad 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -339,7 +339,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* set memories */ @@ -381,6 +381,11 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifndef SPLIT_REND_WITH_HEAD_ROT + /* set the memories to zero */ + set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); + set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); +#endif if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftBRIRReal[bandIdx][tmp]; @@ -398,6 +403,12 @@ static ivas_error ivas_binRenderer_convModuleOpen( } else { +#ifndef SPLIT_REND_WITH_HEAD_ROT + /* set the memories to zero */ + set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTaps ); + set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTaps ); +#endif + if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal[bandIdx][tmp]; @@ -754,7 +765,7 @@ ivas_error ivas_rend_openCldfbRend( return error; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /*------------------------------------------------------------------------- * ivas_binRenderer_open() @@ -1069,7 +1080,7 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; -#else +#else /* SPLIT_REND_WITH_HEAD_ROT */ for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) @@ -1093,7 +1104,7 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; @@ -1472,7 +1483,7 @@ void ivas_binRenderer( set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); } } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* Head rotation in HOA3 or CICPx */ if ( @@ -1563,7 +1574,7 @@ void ivas_binRenderer( } } } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) @@ -1692,4 +1703,4 @@ void ivas_rend_CldfbMultiBinRendProcess( return; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index fb1eee59b9..8b8a32c6cb 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1923,9 +1923,6 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural renderer handle */ ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); - -#else - #endif /* Parametric binaural renderer handle */ diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index d3287d05ee..c2b879f2bf 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -143,7 +143,7 @@ extern const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT extern const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; extern const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; extern const int32_t split_rend_brate_tbl[]; -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ extern const int16_t huff_nodes_first_band_alpha[32][2]; extern const int16_t huff_nodes_first_band_alpha_coarse[16][2]; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 7ef2a8d741..998d1a51f6 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2811,7 +2811,6 @@ static void ivas_parse_parameter_bitstream_dtx( * * Deindex real index *-----------------------------------------------------------------------------------------*/ - ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 991e00614e..57b270b2a7 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1098,9 +1098,6 @@ typedef struct ivas_binaural_rendering_struct float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; REVERB_STRUCT_HANDLE hReverb; -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t numPoses; -#endif } BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; #endif diff --git a/lib_rend/ivas_PerceptualModel.h b/lib_rend/ivas_PerceptualModel.h index 269bfa4a3f..b7d75d16da 100644 --- a/lib_rend/ivas_PerceptualModel.h +++ b/lib_rend/ivas_PerceptualModel.h @@ -37,6 +37,9 @@ extern "C" { #endif +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT + #include #define LOG_ADD_TABLE_LENGTH ( 512 ) @@ -68,6 +71,8 @@ extern "C" int32_t *piSMR0, int32_t *piSMR1 ); +#endif /* SPLIT_REND_WITH_HEAD_ROT */ + #ifdef __cplusplus } #endif diff --git a/lib_rend/ivas_PredTables.h b/lib_rend/ivas_PredTables.h index 71bdf21437..dbecc24c40 100644 --- a/lib_rend/ivas_PredTables.h +++ b/lib_rend/ivas_PredTables.h @@ -38,6 +38,8 @@ extern "C" { #endif +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT #define PRED_QUNAT_FILTER_MAG_BITS ( 3 ) #define PRED_QUANT_FILTER_PHASE_BITS ( 5 ) @@ -46,6 +48,8 @@ extern "C" #define PRED_QUANT_FILTER_PHASE_MIN ( -16 ) #define PRED_QUANT_FILTER_PHASE_MAX ( 15 ) +#endif + #ifdef __cplusplus } #endif diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c index c7925d7475..11ba4874e2 100644 --- a/lib_rend/ivas_RMSEnvGrouping.c +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -30,6 +30,9 @@ *******************************************************************************************************/ +#include "options.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT + #include "ivas_RMSEnvGrouping.h" /* Double check cost function calculation */ @@ -38,7 +41,6 @@ #include #include #include -#include "options.h" #include "prot.h" #include "ivas_prot_rend.h" #include "ivas_lcld_tables.h" @@ -888,3 +890,4 @@ void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, } } } +#endif diff --git a/lib_rend/ivas_RMSEnvGrouping.h b/lib_rend/ivas_RMSEnvGrouping.h index 49fae8918e..2bc3902a02 100644 --- a/lib_rend/ivas_RMSEnvGrouping.h +++ b/lib_rend/ivas_RMSEnvGrouping.h @@ -37,8 +37,11 @@ extern "C" { #endif -#include #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT + +#include typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping; RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( int32_t iNumBlocks ); @@ -55,6 +58,8 @@ extern "C" int32_t *piGroupLengths, int32_t ***pppiRMSEnvelope ); +#endif + #ifdef __cplusplus } #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index ee7ec16b46..f84956ec4d 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1479,7 +1479,11 @@ static float SHrot_w( if ( m == 0 ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT assert( 0 && "ERROR should not be called\n" ); +#else + printf( "ERROR should not be called\n" ); +#endif return 0.0f; } else diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index 9f12d9544d..8f7e562b80 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -35,6 +35,9 @@ Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ +#include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "cnst.h" #include "ivas_cnst.h" #include "ivas_prot_rend.h" @@ -44,7 +47,6 @@ Nations Convention on Contracts on the International Sales of Goods. #include "ivas_rom_dec.h" #include "ivas_rom_rend.h" #include "lib_rend.h" -#include "options.h" #include "prot.h" #include #include @@ -54,7 +56,6 @@ Nations Convention on Contracts on the International Sales of Goods. #endif #include "wmc_auto.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_splitBinLCLDDecOpen( BIN_HR_SPLIT_LCLD_DEC_HANDLE *hSplitBinLCLDDec, int32_t iSampleRate, diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index 1904f895b3..bb96064529 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -35,6 +35,9 @@ Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ +#include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "cnst.h" #include "ivas_cnst.h" #include "ivas_prot_rend.h" @@ -44,7 +47,6 @@ Nations Convention on Contracts on the International Sales of Goods. #include "ivas_rom_dec.h" #include "ivas_rom_rend.h" #include "lib_rend.h" -#include "options.h" #include "prot.h" #include #include @@ -54,7 +56,6 @@ Nations Convention on Contracts on the International Sales of Goods. #endif #include "wmc_auto.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_splitBinLCLDEncOpen( BIN_HR_SPLIT_LCLD_ENC_HANDLE *hSplitBinLCLDEnc, int32_t iSampleRate, diff --git a/lib_rend/ivas_splitRendererPLC.c b/lib_rend/ivas_splitRendererPLC.c index 8df9a29cd9..dfa5e71a23 100644 --- a/lib_rend/ivas_splitRendererPLC.c +++ b/lib_rend/ivas_splitRendererPLC.c @@ -30,11 +30,11 @@ *******************************************************************************************************/ -#include #include "options.h" -#include #ifdef SPLIT_REND_WITH_HEAD_ROT +#include +#include #include #include "ivas_prot.h" #include "prot.h" diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 6bc5025a60..74fb7fae68 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -30,8 +30,10 @@ *******************************************************************************************************/ -#include #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include #include #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG #include @@ -51,7 +53,6 @@ #endif #include "wmc_auto.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_splitBinPostRendOpen( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 604dd79ef7..90bec03e90 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -30,8 +30,10 @@ *******************************************************************************************************/ -#include #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include #include #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG #include @@ -57,7 +59,6 @@ #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_BAND_SMOOTH ( 1 ) #define SMOOTH_NORM_FACTOR ( 5.0f ) diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 2e63bccf0d..b1068054f8 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -30,8 +30,10 @@ *******************************************************************************************************/ -#include #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include #include #include "ivas_prot.h" #include "prot.h" @@ -48,7 +50,6 @@ #endif #include "wmc_auto.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_mat_mult_2by2_complex( float in_re1[2][2], float in_im1[2][2], diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9341c4f0da..c1e82fd193 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -51,7 +51,9 @@ /* Maximum buffer length (per channel) in samples. * Keep this separate from L_FRAME48k in case we want to support different size later */ #define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +#ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) +#endif /* Maximum buffer length (total) in samples. */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -200,7 +202,6 @@ typedef struct rotation_gains rot_gains_prev[MAX_HEAD_ROT_POSES]; #else rotation_gains rot_gains_prev; - #endif #ifdef REND_STATIC_MEM_OPT @@ -350,9 +351,7 @@ static void convertInternalBitsBuffToBitsBuffer( return; } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ -#ifdef SPLIT_REND_WITH_HEAD_ROT static void copyBufferToCLDFBarray( const IVAS_REND_AudioBuffer buffer, float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -416,7 +415,7 @@ static void accumulateCLDFBArrayToBuffer( return; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ static void copyBufferTo2dArray( const IVAS_REND_AudioBuffer buffer, @@ -444,7 +443,10 @@ static void copyBufferTo2dArray( static void accumulate2dArrayToBuffer( float array[MAX_OUTPUT_CHANNELS][L_FRAME48k], - const IVAS_REND_AudioBuffer *buffer ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + const +#endif + IVAS_REND_AudioBuffer *buffer ) { int16_t smplIdx, chnlIdx; float *writePtr; @@ -1484,7 +1486,7 @@ static ivas_error setRendInputActiveIsm( return error; } } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ } @@ -2438,9 +2440,6 @@ static ivas_error setRendInputActiveMc( inputMc->splitTdRendWrappers[i] = defaultTdRendWrapper(); } -#endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) @@ -2642,8 +2641,8 @@ updateSplitPostRendPanGains( return IVAS_ERR_OK; } #endif -static ivas_error -updateSbaPanGains( + +static ivas_error updateSbaPanGains( input_sba *inputSba, const IVAS_REND_AudioConfig outConfig, RENDER_CONFIG_DATA *hRendCfg ) @@ -2838,6 +2837,7 @@ static ivas_error initSbaMasaRendering( { return error; } + return IVAS_ERR_OK; } @@ -2869,20 +2869,18 @@ static ivas_error setRendInputActiveSba( if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #else if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ { return error; } -#endif -#ifdef REND_STATIC_MEM_OPT #ifdef SPLIT_REND_WITH_HEAD_ROT initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); #else initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); -#endif -#else +#endif /* SPLIT_REND_WITH_HEAD_ROT */ +#else /* REND_STATIC_MEM_OPT */ initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); -#endif +#endif /* REND_STATIC_MEM_OPT */ setZeroPanMatrix( inputSba->hoaDecMtx ); #ifdef SPLIT_REND_WITH_HEAD_ROT inputSba->crendWrapper = NULL; @@ -2894,7 +2892,7 @@ static ivas_error setRendInputActiveSba( inputSba->crendWrapper = NULL; inputSba->hDirAC = NULL; initRotGains( inputSba->rot_gains_prev ); -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ if ( outConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || outConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) { @@ -4661,6 +4659,7 @@ ivas_error IVAS_REND_GetDelay( max_latency_ns = max( max_latency_ns, latency_ns ); } } + *nSamples = (int16_t) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); return IVAS_ERR_OK; @@ -4706,6 +4705,7 @@ ivas_error IVAS_REND_FeedInputAudio( { return IVAS_ERR_WRONG_NUM_CHANNELS; } + #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) @@ -6371,7 +6371,7 @@ static ivas_error renderLfeToBinaural( *writePtr++ += gain * ( *readPtr++ ); } } -#else +#else /* SPLIT_REND_WITH_HEAD_ROT */ /* Copy LFE to left and right ears */ readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); writePtr = getSmplPtr( outAudio, 0, 0 ); @@ -6387,7 +6387,7 @@ static ivas_error renderLfeToBinaural( *writePtr++ += gain * ( *readPtr++ ); } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6944,7 +6944,7 @@ static ivas_error renderMcToSplitBinaural( return IVAS_ERR_OK; } -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ static ivas_error renderInputMc( input_mc *mcInput, @@ -7123,9 +7123,7 @@ static ivas_error splitBinLc3plusDecode( return IVAS_ERR_OK; } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSplitBinauralWithPostRot( input_split_post_rend *splitBinInput, IVAS_REND_AudioBuffer outAudio, @@ -7475,8 +7473,7 @@ static ivas_error renderSbaToSplitBinaural( } #endif /* SPLIT_REND_WITH_HEAD_ROT */ -static ivas_error -renderSbaToBinaural( +static ivas_error renderSbaToBinaural( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) @@ -7663,6 +7660,7 @@ static ivas_error renderSbaToBinauralRoom( return IVAS_ERR_OK; } + #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderInputSplitBin( input_split_post_rend *splitBinInput, @@ -7720,7 +7718,6 @@ static ivas_error renderSbaToMasa( return IVAS_ERR_OK; } - static ivas_error renderInputSba( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, @@ -7826,9 +7823,8 @@ static ivas_error renderActiveInputsSplitBin( return IVAS_ERR_OK; } - - #endif /* SPLIT_REND_WITH_HEAD_ROT */ + static ivas_error renderActiveInputsSba( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio @@ -8129,7 +8125,7 @@ static ivas_error renderInputMasa( case IVAS_REND_AUDIO_CONFIG_BINAURAL: renderMasaToBinaural( masaInput, outAudio ); break; - /* ToDo */ + /* ToDo */ //#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: @@ -8476,10 +8472,7 @@ ivas_error IVAS_REND_GetSamples( { return error; } -#endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outAudio.config.is_cldfb == 0 ) { #ifdef DEBUGGING @@ -8487,13 +8480,12 @@ ivas_error IVAS_REND_GetSamples( #endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); } - -#else +#else /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef DEBUGGING hIvasRend->numClipping += #endif limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); -#endif +#endif /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 5ecb7c65cb..94472687c1 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -63,21 +63,21 @@ typedef struct float *data; } IVAS_REND_AudioBuffer; +#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct { int32_t bufLenInBytes; int32_t bitsWritten; int32_t bitsRead; -#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; -#endif } IVAS_REND_BitstreamBufferConfig; typedef struct { IVAS_REND_BitstreamBufferConfig config; uint8_t *bits; } IVAS_REND_BitstreamBuffer; +#endif typedef struct { @@ -381,4 +381,5 @@ int32_t IVAS_REND_GetCntFramesLimited( #endif /* clang-format on */ + #endif diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index e6850743b5..18766fa339 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1030,7 +1030,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( // if ( hHRTF == NULL ) // { +#ifdef SPLIT_REND_WITH_HEAD_ROT // if ( ( ( *hHRTF ) = (HRTFS_FASTCONV_HANDLE) malloc( sizeof( HRTFS_FASTCONV ) ) ) == NULL ) +#else + // if ( ( ( *hHRTF ) = (HRTFS_FASTCONV_HANDLE) count_malloc( sizeof( HRTFS_FASTCONV ) ) ) == NULL ) +#endif // { // return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Can not allocate memory for Fastconv HRTF binary\n" ); // } diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index dd4c72fb6e..0da2450876 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -175,7 +175,11 @@ static void strip_spaces_upper( while ( pStr[read_idx] ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( !isspace( pStr[read_idx] ) && !iscntrl( pStr[read_idx] ) ) +#else if ( !isspace( (int32_t) pStr[read_idx] ) && !iscntrl( (int32_t) pStr[read_idx] ) ) +#endif { pStr[write_idx++] = pStr[read_idx]; } diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 1c1a96e59a..40767f6828 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -30,15 +30,16 @@ *******************************************************************************************************/ -#include "split_rend_bfi_file_reader.h" #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "split_rend_bfi_file_reader.h" #include #include #include #include #include "prot.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT struct SplitRendBFIFileReader { FILE *bfiFile; diff --git a/lib_util/split_rend_bfi_file_reader.h b/lib_util/split_rend_bfi_file_reader.h index 8d82aace7a..3541883513 100644 --- a/lib_util/split_rend_bfi_file_reader.h +++ b/lib_util/split_rend_bfi_file_reader.h @@ -34,11 +34,11 @@ #define IVAS_SR_BFI_FILE_READER_H #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" #include "ivas_error.h" - -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct SplitRendBFIFileReader SplitRendBFIFileReader; ivas_error SplitRendBFIFileReader_open( diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 801c57e32a..b596a5781c 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -30,6 +30,9 @@ *******************************************************************************************************/ +#include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "split_render_file_read_write.h" #include #include @@ -49,7 +52,6 @@ * Type definitions *------------------------------------------------------------------------------------------*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT struct SplitFileReadWrite { FILE *file; diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index a21d0d2463..19b4b7cf27 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -34,11 +34,11 @@ #define SPLIT_RENDER_FILE_READ_WRITE_H #include "options.h" + +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" #include "ivas_error.h" - -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct SplitFileReadWrite SplitFileReadWrite; /* Allocates and initializes a a split renderer reader instance */ -- GitLab From b1cea74c68947826eff86e0ee513ee27d7e669cc Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 16:07:26 +0200 Subject: [PATCH 368/591] Ensure changes are cleanly wrapped in SPLIT_REND_WITH_HEAD_ROT (WIP) Part 2 --- apps/decoder.c | 47 +++++++---- apps/renderer.c | 116 ++++++++++++++-------------- lib_com/common_api_types.h | 6 +- lib_com/delay_comp.c | 4 +- lib_com/ivas_cnst.h | 3 +- lib_com/ivas_prot.h | 2 + lib_com/ivas_tools.c | 1 + lib_debug/debug.c | 1 + lib_debug/debug.h | 1 + lib_dec/ivas_binRenderer_internal.c | 19 ++--- lib_dec/ivas_dec.c | 4 +- lib_dec/ivas_dirac_dec.c | 1 + lib_dec/ivas_mc_param_dec.c | 3 +- lib_dec/ivas_spar_md_dec.c | 3 +- lib_dec/ivas_stat_dec.h | 2 + lib_dec/lib_dec.c | 7 +- lib_rend/ivas_render_config.c | 2 +- lib_rend/ivas_reverb.c | 2 + lib_rend/ivas_rotation.c | 6 +- lib_rend/ivas_stat_rend.h | 6 +- 20 files changed, 135 insertions(+), 101 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 6cb38ece51..6e3e23bb47 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -33,7 +33,7 @@ #include #include #include -#include "assert.h" +#include #include "options.h" #include "lib_dec.h" #include "cmdl_tools.h" @@ -72,16 +72,18 @@ static #endif int32_t frame = 0; /* Counter of frames */ -#define MIN_NUM_BITS_ACTIVE_FRAME 56 -#define NUM_BITS_SID_IVAS_5K2 104 -#define NUM_FRAMES_PER_SEC 50 -#define MAX_FRAME_SIZE ( 48000 / NUM_FRAMES_PER_SEC ) +#define MIN_NUM_BITS_ACTIVE_FRAME 56 +#define NUM_BITS_SID_IVAS_5K2 104 +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define NUM_FRAMES_PER_SEC 50 +#define MAX_FRAME_SIZE ( 48000 / NUM_FRAMES_PER_SEC ) +#else +#define MAX_FRAME_SIZE ( 48000 / 50 ) +#endif #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define MAX_SPLIT_REND_BITRATE ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/ -#endif +#define MAX_SPLIT_REND_BITRATE ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/ #define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #endif #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) @@ -154,6 +156,7 @@ typedef struct uint16_t frontendFetchSizeMs; #endif #endif + } DecArguments; @@ -877,6 +880,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( return output_config; } + /*---------------------------------------------------------------------* * parseCmdlIVAS_dec() * @@ -1571,7 +1575,6 @@ static ivas_error initOnFirstGoodFrame( } *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; - if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumOutputChannels, code: %d\n", error ); @@ -1601,9 +1604,7 @@ static ivas_error initOnFirstGoodFrame( *ppAfWriter = NULL; } else -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { int16_t delayNumSamples_temp[3]; @@ -1625,7 +1626,10 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif + int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); @@ -1646,8 +1650,8 @@ static ivas_error initOnFirstGoodFrame( } } else -#endif { +#endif if ( *pRemainingDelayNumSamples < numOutSamples ) { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) @@ -1661,7 +1665,9 @@ static ivas_error initOnFirstGoodFrame( { *pRemainingDelayNumSamples -= numOutSamples; } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif } free( zeroBuf ); @@ -1906,6 +1912,7 @@ static ivas_error decodeG192( if ( arg.enableHeadRotation ) { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + #ifdef SPLIT_REND_WITH_HEAD_ROT if ( headRotReader == NULL ) { @@ -1918,8 +1925,8 @@ static ivas_error decodeG192( } } else -#endif { +#endif for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) @@ -1929,7 +1936,9 @@ static ivas_error decodeG192( goto cleanup; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2037,9 +2046,7 @@ static ivas_error decodeG192( } } else -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, @@ -2063,7 +2070,9 @@ static ivas_error decodeG192( { delayNumSamples -= nOutSamples; } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif } /* Write ISM metadata to external file(s) */ @@ -2138,14 +2147,18 @@ static ivas_error decodeG192( memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( afWriter != NULL ) { +#endif if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif /*------------------------------------------------------------------------------------------* * Printouts after decoding has finished @@ -2192,10 +2205,12 @@ cleanup: split_rend_reader_writer_close( &hSplitRendFileReadWrite ); } if ( afWriter != NULL ) -#endif { +#endif AudioFileWriter_close( &afWriter ); +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif MasaFileWriter_close( &masaWriter ); for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) { diff --git a/apps/renderer.c b/apps/renderer.c index 6fb985504d..239e792162 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -932,24 +932,30 @@ int main( audioReader = NULL; } else -#endif { +#endif if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening file: %s\n", audioFilePath ); exit( -1 ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif int32_t inFileSampleRate = 0; +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( audioReader != NULL ) { +#endif error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); +#ifdef SPLIT_REND_WITH_HEAD_ROT } else { inFileSampleRate = args.sampleRate; } +#endif switch ( error ) { case IVAS_ERR_OK: @@ -978,23 +984,20 @@ int main( } int16_t inFileNumChannels = 0; +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( audioReader != NULL ) { +#endif error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } - } - const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); - -#ifndef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT - const int16_t CLDFBframeSize_smpls = (int16_t) frameSize_smpls * 2; - cldfb_in = get_cldfb_in_flag( &args ); -#endif + } #endif + const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; @@ -1044,7 +1047,11 @@ int main( if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n", ivas_error_to_string( error ) ); +#else + fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); +#endif exit( -1 ); } @@ -1061,7 +1068,11 @@ int main( if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n", ivas_error_to_string( error ) ); +#else + fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); +#endif exit( -1 ); } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1296,9 +1307,7 @@ int main( { rend_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ); } -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ); @@ -1331,20 +1340,8 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif - inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( is_split_pre_rend_mode( &args ) || is_split_post_rend_mode( &args ) ) - { - bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; - } - else - { - bitsBufferSize = 0; - } -#endif - inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in == 0 ) @@ -1361,29 +1358,27 @@ int main( outFloatBuffer = malloc( CLDFBframeSize_smpls * totalNumInChannels * sizeof( float ) ); outBuffer.config.numSamplesPerChannel = (int16_t) CLDFBframeSize_smpls; } -#else - inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; - inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); - outFloatBuffer = malloc( outBufferSize * sizeof( float ) ); - outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; -#endif outInt16Buffer = malloc( outBufferSize * sizeof( int16_t ) ); -#ifdef SPLIT_REND_WITH_HEAD_ROT inBuffer.config.is_cldfb = cldfb_in; -#endif inBuffer.config.numChannels = (int16_t) totalNumInChannels; inBuffer.data = inFloatBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT outBuffer.config.is_cldfb = cldfb_in; -#endif outBuffer.config.numChannels = (int16_t) numOutChannels; outBuffer.data = outFloatBuffer; + memset( outBuffer.data, 0, outBuffer.config.numSamplesPerChannel * outBuffer.config.numChannels * sizeof( float ) ); + if ( is_split_pre_rend_mode( &args ) || is_split_post_rend_mode( &args ) ) + { + bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; + } + else + { + bitsBufferSize = 0; + } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( bitsBufferSize > 0 ) { bitsBufferData = malloc( bitsBufferSize * sizeof( uint8_t ) ); @@ -1393,12 +1388,22 @@ int main( bitsBufferData = NULL; } -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT bitsBuffer.bits = bitsBufferData; bitsBuffer.config.bitsRead = 0; bitsBuffer.config.bitsWritten = 0; bitsBuffer.config.bufLenInBytes = bitsBufferSize; +#else + inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); + outInt16Buffer = malloc( outBufferSize * sizeof( int16_t ) ); + outFloatBuffer = malloc( outBufferSize * sizeof( float ) ); + + inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; + inBuffer.config.numChannels = (int16_t) totalNumInChannels; + inBuffer.data = inFloatBuffer; + + outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; + outBuffer.config.numChannels = (int16_t) numOutChannels; + outBuffer.data = outFloatBuffer; #endif #ifdef WMOPS @@ -1443,15 +1448,17 @@ int main( } } if ( audioReader != NULL ) -#endif { +#endif /* Read the input data */ if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); exit( -1 ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif if ( numSamplesRead == 0 ) { @@ -1534,7 +1541,6 @@ int main( #endif ); if ( error != IVAS_ERR_OK && error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) - { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1706,7 +1712,11 @@ int main( #endif ) ) != IVAS_ERR_OK ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "Error %s\n", ivas_error_to_string( error ) ); +#else + fprintf( stderr, "Error in getting samples\n" ); +#endif exit( -1 ); } @@ -1764,8 +1774,8 @@ int main( } } if ( audioWriter != NULL ) -#endif { +#endif if ( delayNumSamples < outBufferSize ) { if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) @@ -1779,8 +1789,8 @@ int main( { delayNumSamples -= (int16_t) outBufferSize; } - } #ifdef SPLIT_REND_WITH_HEAD_ROT + } bitsBuffer.config.bitsRead = 0; bitsBuffer.config.bitsWritten = 0; #endif @@ -1875,15 +1885,17 @@ int main( /* add zeros at the end to have equal length of synthesized signals */ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( audioWriter != NULL ) -#endif { +#endif memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); exit( -1 ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif if ( !args.quietModeEnabled && args.delayCompensationEnabled ) { @@ -1925,25 +1937,13 @@ int main( { rend_closeCldfb( cldfbAna, cldfbSyn ); } -#endif - -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( audioReader != NULL ) -#endif - { - AudioFileReader_close( &audioReader ); - } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hSplitRendFileReadWrite != NULL ) { split_rend_reader_writer_close( &hSplitRendFileReadWrite ); } - if ( audioWriter != NULL ) #endif - { - AudioFileWriter_close( &audioWriter ); - } + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { LfeRoutingConfig_close( lfeRoutingConfigs[i] ); @@ -2021,6 +2021,7 @@ static bool parseInConfig( #ifdef SPLIT_REND_WITH_HEAD_ROT inConfig->numBinBuses = 0; #endif + /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */ strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 ); charBuf[sizeof( charBuf ) - 1] = '\0'; @@ -2401,7 +2402,6 @@ static bool checkRequiredArgs( args.inConfig.numMultiChannelBuses != 0 || args.inConfig.numMasaBuses != 0; #endif - if ( !args.sceneDescriptionInput && !singleInputSpecified ) { /* Neither scene description input nor single-type input was specified on command line */ @@ -3649,8 +3649,8 @@ static void convertInputBuffer( } } else -#endif { +#endif for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) { for ( chnl = 0; chnl < numChannels; ++chnl ) @@ -3667,7 +3667,9 @@ static void convertInputBuffer( ++i; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif return; } @@ -3742,8 +3744,8 @@ static void convertOutputBuffer( } } else -#endif { +#endif for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) { for ( chnl = 0; chnl < numChannels; ++chnl ) @@ -3763,7 +3765,9 @@ static void convertOutputBuffer( ++i; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif return; } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 461088bea5..b2a40a5adb 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -100,9 +100,7 @@ typedef enum YAW_ROLL, PITCH_ROLL } IVAS_SPLIT_REND_ROT_AXIS; -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef enum { IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, @@ -149,7 +147,7 @@ typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifdef DEBUGGING typedef enum { IVAS_RENDER_TYPE_OVERRIDE_NONE, @@ -200,7 +198,7 @@ typedef struct _IVAS_SPLIT_REND_CONFIG typedef struct _IVAS_RENDER_CONFIG { -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifdef DEBUGGING IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 61c1a4d81e..7d2d5deb52 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -104,14 +104,16 @@ int32_t get_delay( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) -#endif { +#endif if ( hCldfb != NULL ) { /* compensate for filterbank delay */ delay += IVAS_FB_DEC_DELAY_NS; } +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif if ( ivas_format == MASA_FORMAT ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 398aa31c0d..5691f023e7 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -117,7 +117,7 @@ typedef enum } AUDIO_CONFIG; -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifdef DEBUGGING typedef enum { RENDER_TYPE_OVERRIDE_NONE, @@ -1804,6 +1804,7 @@ typedef enum #define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) #endif + /*----------------------------------------------------------------------------------* * Limiter constants *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 0dfc8f18ca..919aa223e4 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4951,6 +4951,7 @@ void ivas_quantise_real_values( float *quant, const int16_t dim ); + #ifndef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_deindex_real_index( const int16_t *index, @@ -4959,6 +4960,7 @@ ivas_error ivas_deindex_real_index( const float max_value, float *quant, const int16_t num_ch_dim2 ); + #endif void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index ea2f059b25..6679a70a0e 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -1157,6 +1157,7 @@ void v_sort_ind( return; } + /*-------------------------------------------------------------------* * is_IVAS_bitrate() * diff --git a/lib_debug/debug.c b/lib_debug/debug.c index 26fe37acbf..65497dda0a 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -402,6 +402,7 @@ void dbgclose() fclose( out_fileptr[i] ); free( out_filename[i] ); } + #ifdef DBG_WAV_WRITER for ( i = 0; i < out_wav_count; i++ ) { diff --git a/lib_debug/debug.h b/lib_debug/debug.h index 5b7e455858..ac2ac689b8 100644 --- a/lib_debug/debug.h +++ b/lib_debug/debug.h @@ -97,6 +97,7 @@ int16_t dbgwrite( const char *const filename #endif ); + #ifdef DBG_WAV_WRITER int16_t dbgwrite_wav( const float *buffer[], /* i : Write buffer */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 72f744b4ad..ce46ca62ba 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -128,6 +128,7 @@ static void ivas_binRenderer_filterModule( return; } + /*------------------------------------------------------------------------- * ivas_binRenderer_convModuleOpen() * @@ -254,6 +255,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } } + #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hBinRenConvModule->filterStatesLeftReal = (float ****) malloc( num_poses * sizeof( float *** ) ) ) == NULL ) { @@ -342,7 +344,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( #endif /* SPLIT_REND_WITH_HEAD_ROT */ /* set memories */ - for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) @@ -386,6 +387,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); #endif + if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftBRIRReal[bandIdx][tmp]; @@ -464,18 +466,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } -#else - for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) - { - for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) - { - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - } - } -#endif +#endif hBinRenderer->hBinRenConvModule = hBinRenConvModule; return IVAS_ERR_OK; @@ -1048,6 +1040,7 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterTapsRightImag ); hBinRenConvModule->filterTapsRightImag = NULL; + #ifdef SPLIT_REND_WITH_HEAD_ROT for ( posIdx = 0; posIdx < num_poses; posIdx++ ) { @@ -1106,6 +1099,7 @@ static void ivas_binRenderer_convModuleClose( hBinRenConvModule->filterStatesLeftImag = NULL; #endif /* SPLIT_REND_WITH_HEAD_ROT */ + free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; @@ -1422,6 +1416,7 @@ void ivas_binaural_cldfb_sf( } #endif + /*------------------------------------------------------------------------- * ivas_binRenderer() * diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 26505e7bc8..db6b81b486 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -44,6 +44,7 @@ #endif #include "wmc_auto.h" + /*--------------------------------------------------------------------------* * ivas_dec() * @@ -640,7 +641,7 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); // TODO tmu check + ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } else { @@ -818,6 +819,7 @@ ivas_error ivas_dec( free( st_ivas->splitBinRend.hMultiBinCldfbData ); } + #endif /*----------------------------------------------------------------* * Write IVAS output channels diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 229a70684d..0c7249366b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2943,6 +2943,7 @@ void ivas_dirac_dec_render_sf( Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 6c43a12bb5..48c402f509 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1397,7 +1397,6 @@ void ivas_param_mc_dec_digest_tc( int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; int16_t nchan_out_cov; /*CLDFB*/ - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float real_part, imag_part; @@ -1766,8 +1765,8 @@ void ivas_param_mc_dec_render( NULL, #endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - #ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 998d1a51f6..5ed9980458 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2811,7 +2811,8 @@ static void ivas_parse_parameter_bitstream_dtx( * * Deindex real index *-----------------------------------------------------------------------------------------*/ -ivas_error ivas_deindex_real_index( + +static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 57b270b2a7..cc4017e383 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1075,6 +1075,7 @@ typedef struct renderer_struct } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; + #ifndef SPLIT_REND_WITH_HEAD_ROT /* Fastconv binaural data structure */ typedef struct ivas_binaural_rendering_struct @@ -1101,6 +1102,7 @@ typedef struct ivas_binaural_rendering_struct } BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; #endif + /*----------------------------------------------------------------------------------* * MASA decoder structures *----------------------------------------------------------------------------------*/ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 1c3a6b4816..ba69f3fa56 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1213,9 +1213,13 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Pos[i].z = Pos[i].z; } +#ifdef SPLIT_REND_WITH_HEAD_ROT hHeadTrackData->num_quaternions = 0; - +#else + hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT + hHeadTrackData->sr_pose_pred_axis = rot_axis; #endif @@ -1603,6 +1607,7 @@ ivas_error IVAS_DEC_GetDelay( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; + #ifdef SPLIT_REND_WITH_HEAD_ROT nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], hDecoderConfig->output_config ) ); #else diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index e3fcb382f6..9f4185af87 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -107,7 +107,7 @@ ivas_error ivas_render_config_init_from_rom( return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifdef DEBUGGING ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; #endif ( *hRenderConfig )->roomAcoustics.override = FALSE; diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 35dc1c220f..39e1616342 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1607,6 +1607,7 @@ ivas_error ivas_reverb_process( return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * ivas_binaural_reverb_processSubFrame() * @@ -1767,6 +1768,7 @@ void ivas_binaural_reverb_processSubframe( return; } + /*------------------------------------------------------------------------- * ivas_binaural_reverb_open() * diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index f84956ec4d..51372de35d 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -161,8 +161,8 @@ void QuatToRotMat( QuatToRotMat( quat_local, Rmat ); } else -#endif { +#endif Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); @@ -174,7 +174,9 @@ void QuatToRotMat( Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; +#ifdef SPLIT_REND_WITH_HEAD_ROT } +#endif return; } @@ -185,6 +187,7 @@ void QuatToRotMat( * * Calculate corresponding Quaternion from Euler angles in radians *------------------------------------------------------------------------*/ + void Euler2Quat( const float yaw, /* i : yaw (x) */ const float pitch, /* i : pitch (y) */ @@ -198,7 +201,6 @@ void Euler2Quat( float sp = sinf( pitch * 0.5f ); float cy = cosf( yaw * 0.5f ); float sy = sinf( yaw * 0.5f ); - quat->w = cr * cp * cy + sr * sp * sy; quat->x = sr * cp * cy - cr * sp * sy; quat->y = sr * cp * sy + cr * sp * cy; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 45d558777a..7eb280d358 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -530,7 +530,7 @@ typedef struct ivas_roomAcoustics_t typedef struct ivas_render_config_t { -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifdef DEBUGGING ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; @@ -1097,8 +1097,8 @@ typedef struct ivas_LS_setup_custom } LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; - #ifdef SPLIT_REND_WITH_HEAD_ROT + /*----------------------------------------------------------------------------------* * CLDFB renderer wrapper *----------------------------------------------------------------------------------*/ @@ -1109,8 +1109,8 @@ typedef struct BINAURAL_RENDERER_HANDLE hCldfbRend; HRTFS_FASTCONV_HANDLE hHrtfFastConv; } CLDFB_REND_WRAPPER; -#endif +#endif /* Channel types in a channel-based config */ typedef enum { -- GitLab From 2750150f0421f312e4c0e90681bcd9e1e62219f9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 13 Jul 2023 16:25:47 +0200 Subject: [PATCH 369/591] Ensure changes are cleanly wrapped in SPLIT_REND_WITH_HEAD_ROT (WIP) Part 3 --- lib_rend/lib_rend.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c1e82fd193..0b2a7af7a5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1248,6 +1248,7 @@ static void initRendInputBase( set_zero( inputBase->inputBuffer.data, dataBufSize ); } #endif + return; } @@ -2878,7 +2879,7 @@ static ivas_error setRendInputActiveSba( #else initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); #endif /* SPLIT_REND_WITH_HEAD_ROT */ -#else /* REND_STATIC_MEM_OPT */ +#else /* REND_STATIC_MEM_OPT */ initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); #endif /* REND_STATIC_MEM_OPT */ setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -5889,7 +5890,9 @@ static ivas_error renderIsmToBinauralRoom( { return error; } + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); + free( tmpMcBuffer.data ); pop_wmops(); @@ -6388,7 +6391,6 @@ static ivas_error renderLfeToBinaural( } #endif /* SPLIT_REND_WITH_HEAD_ROT */ - pop_wmops(); return IVAS_ERR_OK; @@ -8355,6 +8357,7 @@ ivas_error IVAS_REND_GetSamples( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + #ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; #endif @@ -8372,6 +8375,7 @@ ivas_error IVAS_REND_GetSamples( { return IVAS_ERR_WRONG_NUM_CHANNELS; } + #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) -- GitLab From 044dd2d36077f8cd0f29844cfa0e98101ee7799f Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Thu, 13 Jul 2023 16:36:19 +0200 Subject: [PATCH 370/591] renamed switch from FIX_585_MASA_2TC_DTX_EXT to CR_FIX_585_MASA_2TC_DTX_EXT since the behaviour in selection test operation points will be changed --- lib_com/ivas_prot.h | 2 +- lib_com/options.h | 2 +- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_jbm_dec.c | 2 +- lib_dec/ivas_masa_dec.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f39e5a4aa5..37373dbd75 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5121,7 +5121,7 @@ void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ const int16_t output_frame /* i : output frame length per channel */ -#ifdef FIX_585_MASA_2TC_DTX_EXT +#ifdef CR_FIX_585_MASA_2TC_DTX_EXT , const int16_t nchan_remapped /* i : number of transports used in core */ #endif diff --git a/lib_com/options.h b/lib_com/options.h index 0e0ef4307d..8dbe846c07 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,11 +170,11 @@ /* ################## End BE DEVELOPMENT switches ######################### */ -#define FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ /* #################### Start NON-BE CR switches ########################## */ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ +#define CR_FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ /* ##################### End NON-BE CR switches ########################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 6ba9a31bb1..a5d4abd6aa 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -390,7 +390,7 @@ ivas_error ivas_dec( if ( st_ivas->ivas_format == MASA_FORMAT ) { -#ifdef FIX_585_MASA_2TC_DTX_EXT +#ifdef CR_FIX_585_MASA_2TC_DTX_EXT ivas_masa_prerender( st_ivas, output, output_frame, nchan_remapped ); #else ivas_masa_prerender( st_ivas, output, output_frame ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9c0fc76955..1c0e1af518 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -292,7 +292,7 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->ivas_format == MASA_FORMAT ) { -#ifdef FIX_585_MASA_2TC_DTX_EXT +#ifdef CR_FIX_585_MASA_2TC_DTX_EXT ivas_masa_prerender( st_ivas, output, output_frame, nchan_remapped ); #else ivas_masa_prerender( st_ivas, output, output_frame ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 1ad0a36427..d44d81d54e 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -566,13 +566,13 @@ void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ const int16_t output_frame /* i : output frame length per channel */ -#ifdef FIX_585_MASA_2TC_DTX_EXT +#ifdef CR_FIX_585_MASA_2TC_DTX_EXT , const int16_t nchan_remapped /* i : number of transports used in core */ #endif ) { -#ifdef FIX_585_MASA_2TC_DTX_EXT +#ifdef CR_FIX_585_MASA_2TC_DTX_EXT if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && nchan_remapped == 1 ) #else if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) -- GitLab From a8f6213ee8a98942996a6ddefac33aafd5c4023e Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 13 Jul 2023 16:53:37 +0200 Subject: [PATCH 371/591] Ensure changes are cleanly wrapped in SPLIT_REND_WITH_HEAD_ROT, another pass --- lib_com/ivas_cnst.h | 1 - lib_com/ivas_prot.h | 11 ----------- lib_dec/ivas_binRenderer_internal.c | 4 +++- lib_dec/ivas_spar_md_dec.c | 2 -- lib_dec/lib_dec.c | 4 +--- lib_rend/ivas_PredDecoder.c | 3 ++- lib_rend/ivas_PredEncoder.c | 3 ++- lib_rend/ivas_RMSEnvGrouping.c | 2 +- lib_rend/ivas_RMSEnvGrouping.h | 2 +- lib_rend/ivas_output_init.c | 1 - lib_rend/ivas_prot_rend.h | 6 ++---- lib_rend/ivas_rotation.c | 2 +- lib_rend/ivas_stat_rend.h | 1 + lib_rend/lib_rend.c | 19 +++++++------------ lib_rend/lib_rend.h | 5 ++--- lib_util/render_config_reader.c | 4 ++-- 16 files changed, 25 insertions(+), 45 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5691f023e7..ba2776ff0b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1802,7 +1802,6 @@ typedef enum #define SPLIT_REND_768k 768000 #define SPLIT_REND_MAX_BRATE SPLIT_REND_768k #define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) - #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 919aa223e4..87eaee4081 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4952,16 +4952,6 @@ void ivas_quantise_real_values( const int16_t dim ); -#ifndef SPLIT_REND_WITH_HEAD_ROT -ivas_error ivas_deindex_real_index( - const int16_t *index, - const int16_t q_levels, - const float min_value, - const float max_value, - float *quant, - const int16_t num_ch_dim2 ); - -#endif void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, const int16_t table_idx @@ -5180,7 +5170,6 @@ void ivas_binRenderer( #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, #endif - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ int16_t subframe_idx, /* i : subframe index */ const int16_t numTimeSlots, /* i: : number of time slots to process */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index ce46ca62ba..a5e6d99c81 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -306,6 +306,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } #else + if ( ( hBinRenConvModule->filterStatesLeftReal = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); @@ -466,8 +467,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } - #endif + hBinRenderer->hBinRenConvModule = hBinRenConvModule; return IVAS_ERR_OK; @@ -1074,6 +1075,7 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; #else /* SPLIT_REND_WITH_HEAD_ROT */ + for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 5ed9980458..e83aa7e617 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -82,9 +82,7 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); -#endif static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ba69f3fa56..b66d4ac420 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1218,8 +1218,8 @@ ivas_error IVAS_DEC_FeedHeadTrackData( #else hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT hHeadTrackData->sr_pose_pred_axis = rot_axis; #endif @@ -1613,9 +1613,7 @@ ivas_error IVAS_DEC_GetDelay( #else nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) ); #endif - nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f ); - nSamples[0] = nSamples[1] + nSamples[2]; if ( st_ivas->ivas_format == MASA_FORMAT ) diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index 0105abedb5..067232318c 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -30,9 +30,10 @@ *******************************************************************************************************/ -#include "ivas_PredDecoder.h" #include "options.h" + #ifdef SPLIT_REND_WITH_HEAD_ROT +#include "ivas_PredDecoder.h" #include #include #include diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index e982cf7eed..e04d9f6359 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -30,9 +30,10 @@ *******************************************************************************************************/ -#include "ivas_PredEncoder.h" #include "options.h" + #ifdef SPLIT_REND_WITH_HEAD_ROT +#include "ivas_PredEncoder.h" #include #include #include diff --git a/lib_rend/ivas_RMSEnvGrouping.c b/lib_rend/ivas_RMSEnvGrouping.c index 11ba4874e2..d82fdb8943 100644 --- a/lib_rend/ivas_RMSEnvGrouping.c +++ b/lib_rend/ivas_RMSEnvGrouping.c @@ -31,8 +31,8 @@ *******************************************************************************************************/ #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_RMSEnvGrouping.h" /* Double check cost function calculation */ diff --git a/lib_rend/ivas_RMSEnvGrouping.h b/lib_rend/ivas_RMSEnvGrouping.h index 2bc3902a02..41b3eb1921 100644 --- a/lib_rend/ivas_RMSEnvGrouping.h +++ b/lib_rend/ivas_RMSEnvGrouping.h @@ -37,10 +37,10 @@ extern "C" { #endif + #include "options.h" #ifdef SPLIT_REND_WITH_HEAD_ROT - #include typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping; diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index e931b796a3..9459023565 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -97,7 +97,6 @@ int16_t audioCfg2channels( #endif case AUDIO_CONFIG_BINAURAL_ROOM_IR: case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - nchan_out = 2; break; case AUDIO_CONFIG_ISM1: diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 45df8452fc..7fadde1af1 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -534,9 +534,7 @@ ivas_error ivas_rend_openMultiBinCrend( const IVAS_REND_AudioConfig outConfig, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData, @@ -611,8 +609,8 @@ ivas_error ivas_rend_crendProcess( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, - float *output[], /* i/o: input/output audio channels */ - const int32_t output_Fs + float *output[], /* i/o: input/output audio channels */ + const int32_t output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t pos_idx diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 51372de35d..c5f0f959f6 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -370,7 +370,6 @@ void rotateFrame_shd( #else SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev, shd_rot_max_order ); #endif - SHrotmatgen( SHrotmat, hCombinedOrientationData->Rmat[subframe_idx], shd_rot_max_order ); for ( i = 0; i < subframe_len; i++ ) @@ -669,6 +668,7 @@ void rotateFrame_shd_cldfb( return; } + /*------------------------------------------------------------------------- * rotateFrame_sd_cldfb() * diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 7eb280d358..ee5a88cdc2 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -47,6 +47,7 @@ #include "ivas_lc3plus_dec.h" #endif + /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9d033b1236..1350e64148 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -61,9 +61,9 @@ #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) -#else +#else /* REND_STATIC_MEM_OPT */ #define MAX_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) -#endif +#endif /* REND_STATIC_MEM_OPT */ #else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) @@ -1415,7 +1415,6 @@ static ivas_error setRendInputActiveIsm( inputIsm->hOMasa = NULL; error = IVAS_ERR_OK; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM @@ -2435,6 +2434,7 @@ static ivas_error setRendInputActiveMc( inputMc->hMcMasa = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); + #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { @@ -2943,8 +2943,8 @@ static void clearInputSplitRend( return; } - #endif /* SPLIT_REND_WITH_HEAD_ROT */ + static void clearInputSba( input_sba *inputSba ) { @@ -3688,7 +3688,6 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; - #ifdef SPLIT_REND_WITH_HEAD_ROT for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsMc[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsMc[i].splitTdRendWrappers ) ); ++j ) { @@ -4685,6 +4684,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t cldfb2tdSampleFact; #endif + /* Validate function arguments */ if ( hIvasRend == NULL || inputAudio.data == NULL ) { @@ -4993,7 +4993,6 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig = hIvasRend->hRendererConfig; #if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -6241,18 +6240,15 @@ static ivas_error renderInputIsm( case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: error = renderIsmToBinauralRoom( ismInput, outAudio ); break; - #ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderIsmToSplitBinaural( ismInput, outAudio ); break; #endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderIsmToBinauralReverb( ismInput, outAudio ); break; - default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -6336,8 +6332,8 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } - /* Copy LFE to left and right binaural channels */ #ifdef SPLIT_REND_WITH_HEAD_ROT + /* Copy LFE to left and right binaural channels */ if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) { num_poses = mcInput->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; @@ -6378,7 +6374,6 @@ static ivas_error renderLfeToBinaural( { *writePtr++ += gain * ( *readPtr++ ); } - #endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6585,7 +6580,6 @@ static ivas_error renderMcToBinauralRoom( #else if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif - { return error; } @@ -8474,6 +8468,7 @@ ivas_error IVAS_REND_GetSamples( limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); } #else /* SPLIT_REND_WITH_HEAD_ROT */ + #ifdef DEBUGGING hIvasRend->numClipping += #endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 94472687c1..4ca14b7df1 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -135,13 +135,12 @@ typedef enum IVAS_REND_AUDIO_CONFIG_OBJECT = IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED << 8 | 0, IVAS_REND_AUDIO_CONFIG_BINAURAL = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 0, - + IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, + IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 2, #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 3, IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 4, #endif - IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, - IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 2, IVAS_REND_AUDIO_CONFIG_MASA1 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 0, IVAS_REND_AUDIO_CONFIG_MASA2 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 1, diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 0da2450876..d2941713f7 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -176,9 +176,9 @@ static void strip_spaces_upper( while ( pStr[read_idx] ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( !isspace( pStr[read_idx] ) && !iscntrl( pStr[read_idx] ) ) -#else if ( !isspace( (int32_t) pStr[read_idx] ) && !iscntrl( (int32_t) pStr[read_idx] ) ) +#else + if ( !isspace( pStr[read_idx] ) && !iscntrl( pStr[read_idx] ) ) #endif { pStr[write_idx++] = pStr[read_idx]; -- GitLab From af83a608f70dcf902d84bc7a6a88876b00bb3094 Mon Sep 17 00:00:00 2001 From: hmund Date: Thu, 13 Jul 2023 17:57:36 +0200 Subject: [PATCH 372/591] avoid depency when writing the rom table --- .../SHD_2_ROM.m | 57 ++++++++++++++----- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m index a5450625f3..8780dfdfdf 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -28,16 +28,10 @@ function IR_cldfb = SHD_2_ROM( py_path, rom_c_file, sofa_file ) % SHD_2_ROM( python_path, rom_c_file, sofa_file ) % -% - converts sphere-sampled Head Related Impulse Responses (HRIRs) given in sofa_file to the Spherical Harmonics domain (SHD) +% - converts sphere-sampled Head Related Impulse Responses (HRIRs) given in sofa_file to the Spherical Harmonics domain (SHD) using generate_HOA_HRIRs_MOD_lens.m % - converts SHD HRIRs to Complex Low Delay Filter Bank (CLDFB) domain % - writes CLDFB HRIRs to c-code ROM tables. -% -% Processing chain: -% -% HRIRs --> SHD --> CLDFB --> ROM -% HRIRs --> SHD: Using ./generate_HOA_HRIRs_MOD_lens.m -% SHD --> CLDFB: Least squares optimization -% CLDFB --> ROM: Using ../param_bin/writeData3L.m + [thispath,~,~] = fileparts(mfilename('fullpath')); thispath = [thispath,filesep]; @@ -78,6 +72,7 @@ latency_s = 2.083333333333333e-05; % No added latency from conversion method max_band = 50; % Compute 60 bands, but only use 50 in ROM table IR_cldfb_rom = permute(IR_cldfb, [3 1 4 2]); % after permute: [ears(2), bands(60), chans(16), taps(3)] +IR_cldfb_rom = IR_cldfb_rom(:,1:max_band,:,:); order_int = (round(sqrt(size(IR_cldfb_rom,3))-1)); if order_int == 1 order = 'FOA'; @@ -87,15 +82,47 @@ end if ~exist('rom_c_file','var') || isempty(rom_c_file) rom_c_file = [thispath,'ivas_rom_binauralRenderer_',order,'.c']; % fullfile(thispath,'..','..','..','lib_rend',['ivas_rom_binauralRenderer_',order,'.c']); end + fid = fopen(rom_c_file,'wt'); fprintf(fid, ['const float FASTCONV_' order '_latency_s = %10.9ff;\n'], latency_s); - -addpath(fullfile(thispath,'..','param_bin')); % for writeData3L() -writeData3L(fid, ['const float leftHRIRReal_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], real( squeeze(IR_cldfb_rom(1,1:max_band,:,:)))); -writeData3L(fid, ['const float leftHRIRImag_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], imag( squeeze(IR_cldfb_rom(1,1:max_band,:,:)))); -writeData3L(fid, ['const float rightHRIRReal_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], real( squeeze(IR_cldfb_rom(2,1:max_band,:,:)))); -writeData3L(fid, ['const float rightHRIRImag_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]'], imag( squeeze(IR_cldfb_rom(2,1:max_band,:,:)))); +write_one_ear( fid, ['const float leftHRIRReal_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]='], real(IR_cldfb_rom(1,:,:,:))); +write_one_ear( fid, ['const float leftHRIRImag_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]='], imag(IR_cldfb_rom(1,:,:,:))); +write_one_ear( fid, ['const float rightHRIRReal_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]='], real(IR_cldfb_rom(2,:,:,:))); +write_one_ear( fid, ['const float rightHRIRImag_' order '[BINAURAL_CONVBANDS][' order '_CHANNELS][BINAURAL_NTAPS_SBA]='], imag(IR_cldfb_rom(2,:,:,:))); fclose(fid); -rmpath(fullfile(thispath,'..','param_bin')); + +function write_one_ear( fid, first_line, IR_cldfb_rom) +IR_cldfb_rom = squeeze(IR_cldfb_rom); +[num_bands,num_chans, num_taps] = size(IR_cldfb_rom); +num_spaces = 4; +num_spaces_cur = 0; +fprintf(fid,[first_line,'\n{\n']); +num_spaces_cur = num_spaces_cur + num_spaces; +for band = 1:num_bands + fprintf(fid,[blanks(num_spaces_cur),'{\n']); + num_spaces_cur = num_spaces_cur + num_spaces; + for chan = 1:num_chans + fprintf(fid,[blanks(num_spaces_cur),'{']); + for tap = 1:num_taps + if tap == num_taps + fprintf(fid,'%+ff',IR_cldfb_rom(band,chan,tap)); + else + fprintf(fid,'%+ff, ',IR_cldfb_rom(band,chan,tap)); + end + end + if chan == num_chans + fprintf(fid,'}\n'); + else + fprintf(fid,'},\n'); + end + end + num_spaces_cur = num_spaces_cur - num_spaces; + if band == num_bands + fprintf(fid,[blanks(num_spaces_cur),'}\n']); + else + fprintf(fid,[blanks(num_spaces_cur),'},\n']); + end +end +fprintf(fid,'};\n\n'); -- GitLab From c644b54f602114940d67b0e9f8e0f38bda860f69 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 13 Jul 2023 22:39:03 +0200 Subject: [PATCH 373/591] add job to upload selection-BE-test result --- .gitlab-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69e55c89d7..ba233dfc03 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1310,6 +1310,21 @@ complexity-StereoDmxEVS-stereo-in-mono-out: # Other jobs # --------------------------------------------------------------- +upload-selection-BE-log: + rules: + - if: $UPLOAD_SELECTION_BE_RESULTS && $CI_PIPELINE_SOURCE == 'trigger' + when: always + timeout: 5 minutes + tags: + - ericsson-windows-runner + script: + - cp -r $SELECTION_BE_RESULT ./selection-BE-result + artifacts: + paths: + - selection-BE-result/public_log--sha-*.txt + when: always + expire_in: 1 week + # job that sets up gitlab pages website pages: stage: deploy -- GitLab From 19042ac0eaa17df7447993196eb810d869fab919 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 13 Jul 2023 22:49:55 +0200 Subject: [PATCH 374/591] add trigger pipeline to workflow --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba233dfc03..afcdee03a2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,7 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Scheduled in main - if: $CI_PIPELINE_SOURCE == 'web' # for testing + - if: $CI_PIPELINE_SOURCE == 'trigger' stages: - .pre -- GitLab From 8adf644f8c5a208c918b4f2851f6098f921e9d60 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Fri, 14 Jul 2023 00:17:30 +0200 Subject: [PATCH 375/591] Don't run triggered pipeline by default --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afcdee03a2..734c0925bc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -137,6 +137,8 @@ stages: - if: $CI_PIPELINE_SOURCE == 'schedule' # Don't run in any scheduled pipelines by default (use schedule templates below to enable again for certain conditions) when: never - when: on_success + - if: $CI_PIPELINE_SOURCE == 'trigger' # Don't run triggered pipeline by default + when: never .rules-merge-request: extends: .rules-basis -- GitLab From 4e1fe3f5944141d0a494bbe8e517e139dd57fe71 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 14 Jul 2023 14:49:28 +1000 Subject: [PATCH 376/591] unused variable warning fixes in pre renderer --- lib_rend/ivas_splitRendererPre.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 90bec03e90..46e3052db0 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -543,26 +543,12 @@ static void ComputeCoeffs( float cov_io_norm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float cov_io_norm_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float cov_oo_norm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float sigma_d, rho_hat, rho, gd, gd2, gl2, gr2, cov_norm_fact; - float aa, bb, cc, dd, sign; + float sigma_d, gd, gd2, gl2, gr2, cov_norm_fact; + // float aa, bb, cc, dd, sign, rho, rho_hat; int16_t i, j; if ( pose_type == PITCH_ONLY ) { -#if 0 - float gd_tmp; - - gd_tmp = cov_ii_re[0][0] + cov_ii_re[1][1]; - if ( gd_tmp < EPSILON ) - { - hMd->gd = 1.0f; - } - else - { - gd_tmp = ( cov_oo_re[0][0] + cov_oo_re[1][1] ) / gd_tmp; - hMd->gd = sqrtf( gd_tmp ); - } -#else float gd_tmp[BINAURAL_CHANNELS]; for ( i = 0; i < BINAURAL_CHANNELS; i++ ) @@ -580,8 +566,6 @@ static void ComputeCoeffs( } hMd->gd = gd_tmp[0]; hMd->gd2 = gd_tmp[1]; - -#endif } else { -- GitLab From e17d385b8af2cccb980d15d36396ed3dcd261b97 Mon Sep 17 00:00:00 2001 From: hmund Date: Fri, 14 Jul 2023 07:50:11 +0200 Subject: [PATCH 377/591] removed comment left-over --- .../matlab_hrir_generation_scripts/SHD_2_ROM.m | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m index 8780dfdfdf..72f5f96ee6 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -67,7 +67,6 @@ for pos = 1:num_ch end %% CLDFB -> ROM -% Note: The following section is copied from generate_HRIR_in_SHD_CLDFB_FASTCONV.m provided by @emerit latency_s = 2.083333333333333e-05; % No added latency from conversion method max_band = 50; % Compute 60 bands, but only use 50 in ROM table -- GitLab From ada10dd0cbd5bb20561a53278712cc3143234f63 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 14 Jul 2023 16:55:31 +1000 Subject: [PATCH 378/591] clang format fix --- lib_dec/ivas_binRenderer_internal.c | 2 +- lib_dec/ivas_init_dec.c | 3 +-- lib_rend/ivas_splitRend_lcld_dec.c | 4 ++-- lib_rend/lib_rend.c | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index a5e6d99c81..6ce4026c05 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1074,7 +1074,7 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; -#else /* SPLIT_REND_WITH_HEAD_ROT */ +#else /* SPLIT_REND_WITH_HEAD_ROT */ for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 8b8a32c6cb..37dfdbc687 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1334,8 +1334,7 @@ ivas_error ivas_init_decoder( error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, hDecoderConfig->output_Fs, 0, - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 - ); + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index 8f7e562b80..49987f18f2 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -142,8 +142,8 @@ void ivas_splitBinLCLDDecProcess( BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, ivas_split_rend_bits_t *pBits, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] , - const int16_t bfi) + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t bfi ) { push_wmops( "ivas_splitBinLCLDDecProcess" ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1350e64148..89072f7a5f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -50,7 +50,7 @@ /* Maximum buffer length (per channel) in samples. * Keep this separate from L_FRAME48k in case we want to support different size later */ -#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) #ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) #endif @@ -6359,7 +6359,7 @@ static ivas_error renderLfeToBinaural( *writePtr++ += gain * ( *readPtr++ ); } } -#else /* SPLIT_REND_WITH_HEAD_ROT */ +#else /* SPLIT_REND_WITH_HEAD_ROT */ /* Copy LFE to left and right ears */ readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); writePtr = getSmplPtr( outAudio, 0, 0 ); -- GitLab From 133e13564bd27cc8046597a0b8329a1d32fbcbf1 Mon Sep 17 00:00:00 2001 From: hmund Date: Fri, 14 Jul 2023 09:02:57 +0200 Subject: [PATCH 379/591] add ambisonics order and hrir length as optional input arguments --- .../SHD_2_ROM.m | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m index 72f5f96ee6..4bfee24763 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -25,13 +25,13 @@ % the United Nations Convention on Contracts on the International Sales of Goods. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -function IR_cldfb = SHD_2_ROM( py_path, rom_c_file, sofa_file ) -% SHD_2_ROM( python_path, rom_c_file, sofa_file ) +function IR_cldfb = SHD_2_ROM( py_path, rom_c_file, sofa_file, ambi_order, hrir_len ) +% SHD_2_ROM( python_path, rom_c_file, sofa_file, ambisonics_order, hrir_length ) % -% - converts sphere-sampled Head Related Impulse Responses (HRIRs) given in sofa_file to the Spherical Harmonics domain (SHD) using generate_HOA_HRIRs_MOD_lens.m -% - converts SHD HRIRs to Complex Low Delay Filter Bank (CLDFB) domain +% - converts sphere-sampled Head Related Impulse Responses (HRIRs) given in sofa_file +% to the Spherical Harmonics domain (SHD) using generate_HOA_HRIRs_MOD_lens.m +% - converts SHD HRIRs to Complex Low Delay Filter Bank (CLDFB) domain using fir_to_cldfb_fir.m % - writes CLDFB HRIRs to c-code ROM tables. - [thispath,~,~] = fileparts(mfilename('fullpath')); thispath = [thispath,filesep]; @@ -39,19 +39,21 @@ thispath = [thispath,filesep]; if ~exist('sofa_file','var') || isempty(sofa_file) sofa_file = fullfile(thispath,'..','HRIRs_sofa','HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa'); end - +if ~exist('ambi_order','var') + ambi_order = 3; +end +if ~exist('hrir_len','var') + hrir_len = 128; +end %% convert sphere-sampled HRIRs to SHD HRIRs % requires: % python -m pip install sofar % python -m pip install numpy % convert sphere-sampled HRIRs to SHD HRIRs -hrir_len = 128; -ambi_order = 3; write_out_sofa = 0; [sofa_path,sofa_name, sofa_ext] = fileparts(sofa_file); IR = generate_HOA_HRIRs_MOD_lens(ambi_order, py_path, sofa_path, [sofa_name,sofa_ext], hrir_len, write_out_sofa); -% load([thispath,'HRIR_128_48000_dolby_SBA3.mat'],'IR'); gives the same data as the above with default sofa file %% SHD -> CLDFB via least squares error optimization [~,num_ears,num_ch] = size(IR); @@ -72,11 +74,10 @@ max_band = 50; % Compute 60 bands, but only use 50 in ROM t IR_cldfb_rom = permute(IR_cldfb, [3 1 4 2]); % after permute: [ears(2), bands(60), chans(16), taps(3)] IR_cldfb_rom = IR_cldfb_rom(:,1:max_band,:,:); -order_int = (round(sqrt(size(IR_cldfb_rom,3))-1)); -if order_int == 1 +if ambi_order == 1 order = 'FOA'; else - order = ['HOA' int2str(order_int)]; + order = ['HOA' int2str(ambi_order)]; end if ~exist('rom_c_file','var') || isempty(rom_c_file) rom_c_file = [thispath,'ivas_rom_binauralRenderer_',order,'.c']; % fullfile(thispath,'..','..','..','lib_rend',['ivas_rom_binauralRenderer_',order,'.c']); -- GitLab From 6c1d604fb09a7ecc0756fd3be72ba1439d85d55d Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Fri, 14 Jul 2023 10:09:16 +0200 Subject: [PATCH 380/591] skip build jobs for triggered pipeline --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 734c0925bc..255dc6c90a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -136,9 +136,9 @@ stages: when: never - if: $CI_PIPELINE_SOURCE == 'schedule' # Don't run in any scheduled pipelines by default (use schedule templates below to enable again for certain conditions) when: never - - when: on_success - if: $CI_PIPELINE_SOURCE == 'trigger' # Don't run triggered pipeline by default when: never + - when: on_success .rules-merge-request: extends: .rules-basis -- GitLab From 7a9763809dea81a1ada4c3311feca4bae3088e53 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 14 Jul 2023 11:36:47 +0200 Subject: [PATCH 381/591] add helper script for writing tables to ROM --- .../writeData3L.m | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m new file mode 100644 index 0000000000..40319c0ff4 --- /dev/null +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m @@ -0,0 +1,82 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, +% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership +% rights in their respective contributions in the software. No license of any kind, including but not +% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or +% otherwise. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and/or fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function writeData3L(fid_source, startstring, data) +indices=size(data); + +indent = 4; + +fprintf(fid_source,startstring); +fprintf(fid_source,'=\n{'); +for A = 1:indices(1) + fprintf(fid_source,'\n'); + fprintf(fid_source,repmat(' ',1,indent)); + fprintf(fid_source,'{'); + for B = 1:indices(2) + fprintf(fid_source,'\n'); + fprintf(fid_source,repmat(' ',1,indent*2)); + fprintf(fid_source,'{'); + if( indices(3) > 10 ) + fprintf(fid_source,'\n'); + fprintf(fid_source,repmat(' ',1,indent*3)); + end + counter=1; + for C = 1:indices(3) + fprintf(fid_source,'%+ff',real(data(A,B,C))); + if C < indices(3) + if mod(counter,10) == 0 + fprintf(fid_source,','); + else + fprintf(fid_source,', '); + end + end + if mod(counter,10) == 0 && counter ~= indices(3) + fprintf(fid_source,'\n'); + fprintf(fid_source,repmat(' ',1,indent*3)); + end + counter = counter+1; + end + if( indices(3) > 10 ) + fprintf(fid_source,'\n'); + fprintf(fid_source,repmat(' ',1,indent*2)); + end + fprintf(fid_source,'}'); + if B < indices(2) + fprintf(fid_source,','); + end + end + fprintf(fid_source,'\n'); + fprintf(fid_source,repmat(' ',1,indent)); + fprintf(fid_source,'}'); + if A < indices(1) + fprintf(fid_source,','); + end +end +fprintf(fid_source,'\n};\n\n'); + +end % function + -- GitLab From 98668a65b7b7a076bd17f20dca64e9a17c9875c7 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 14 Jul 2023 15:22:46 +0530 Subject: [PATCH 382/591] Fix failures for DTX selection testing: Issue#609 --- lib_com/ivas_prot.h | 11 +++++++++- lib_dec/ivas_dec.c | 10 ++++++++-- lib_dec/ivas_jbm_dec.c | 14 +++++++++++-- lib_dec/ivas_masa_dec.c | 13 +++++++++--- lib_dec/ivas_sba_dec.c | 7 ++++++- lib_dec/ivas_sba_dirac_stereo_dec.c | 7 ++++++- lib_dec/ivas_spar_decoder.c | 28 +++++++++++++++++++++----- lib_dec/ivas_spar_md_dec.c | 31 +++++++++++++++++++++++++---- lib_rend/ivas_sba_rendering.c | 3 ++- 9 files changed, 104 insertions(+), 20 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b8449126e7..a5f01ebade 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4529,7 +4529,12 @@ void ivas_get_spar_md_from_dirac( /*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int32_t ivas_total_brate ); + const int32_t ivas_total_brate +#ifdef VLBR_20MS_MD + , + const int32_t ivas_last_active_brate /* i : IVAS last active bitrate */ +#endif +); #ifdef VLBR_20MS_MD ivas_error ivas_spar_md_dec_matrix_open( @@ -4548,6 +4553,10 @@ ivas_error ivas_spar_md_dec_open( const int16_t num_channels, /* i : number of internal channels */ const int16_t sba_order, /* i : SBA order */ const int16_t sid_format /* i : SID format */ +#ifdef VLBR_20MS_MD + , + const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ +#endif ); void ivas_spar_md_dec_close( diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index cb50503079..19f0f876db 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -360,7 +360,12 @@ ivas_error ivas_dec( } 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 ) ); + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ) ); } ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -384,7 +389,8 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { #ifdef VLBR_20MS_MD - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, + st_ivas->last_active_ivas_total_brate ); ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 8e96be31ee..1bd8aa8b3a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -262,7 +262,12 @@ ivas_error ivas_jbm_dec_tc( } 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 ) ); + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ) ); } ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -286,7 +291,12 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { #ifdef VLBR_20MS_MD - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ); ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 03c26d51c3..70ae4fa664 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -846,9 +846,9 @@ static int16_t decode_lfe_to_total_energy_ratio( lfeBitsRead = 0; byteBuffer = bitstream[( *index )--]; lfeBitsRead += 1; - lfeToTotalEnergyRatioIndices[0] = byteBuffer; /* First LFE index */ + lfeToTotalEnergyRatioIndices[0] = byteBuffer; /* First LFE index */ - if ( ivas_total_brate == IVAS_13k2 ) /* 1-bit adaptive LFE gain quantizer at 13.2 kbps */ + if ( ivas_total_brate == IVAS_13k2 ) /* 1-bit adaptive LFE gain quantizer at 13.2 kbps */ { lfeToTotalEnergyRatioTemp = hMasaLfeSynth->lfeToTotalEnergyRatio[3]; /* Take memory from the last subframe */ if ( lfeToTotalEnergyRatioIndices[0] == 1 ) @@ -1170,7 +1170,14 @@ void ivas_spar_param_to_masa_param_mapping( else { #ifdef VLBR_20MS_MD - mixer_mat_index = ( ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) == 1 ) ? 0 : ( sf - SPAR_META_DELAY_SUBFRAMES ); + mixer_mat_index = ( ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ) == 1 ) + ? 0 + : ( sf - SPAR_META_DELAY_SUBFRAMES ); #else mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index f7a55b6fe0..de3882ca6b 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -191,7 +191,12 @@ ivas_error ivas_sba_dec_reconfigure( 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 ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ); if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 6c1649d087..f743f2072b 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -885,7 +885,12 @@ void ivas_sba_dirac_stereo_dec( ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, - ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ) ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 906a73b317..2f3c9f2651 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -114,7 +114,12 @@ ivas_error ivas_spar_dec_open( } /* MD handle */ - if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate /* i : IVAS last active bitrate */ +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -725,7 +730,12 @@ static void ivas_spar_dec_MD( bfi = st_ivas->bfi; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; num_channels = ivas_sba_get_nchan_metadata( sba_order, ivas_total_brate ); - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ); num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; @@ -1200,7 +1210,12 @@ void ivas_spar_dec_set_render_params( nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi, - ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ) ); ivas_spar_dec_set_render_map( st_ivas, n_cldfb_slots ); @@ -1431,9 +1446,12 @@ void ivas_spar_dec_upmixer_sf( num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - +#ifdef VLBR_20MS_MD + 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 ); +#else num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate ); - +#endif slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); slot_idx_start = hSpar->slots_rendered; for ( i = 0; i < nchan_internal; i++ ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index bc75fcba88..65d0215742 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -273,6 +273,10 @@ static ivas_error ivas_spar_md_dec_matrix_open int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ +#ifdef VLBR_20MS_MD + , + const int32_t ivas_last_active_brate /* i : IVAS last active bitrate */ +#endif ) { int16_t num_subframes; @@ -286,7 +290,7 @@ int16_t ivas_get_spar_dec_md_num_subframes( } } #ifdef VLBR_20MS_MD - if ( ivas_total_brate < IVAS_24k4 ) + if ( ivas_total_brate < IVAS_24k4 && ( ivas_total_brate > IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) ) { num_subframes = 1; } @@ -307,6 +311,10 @@ ivas_error ivas_spar_md_dec_open( const int16_t num_channels, /* i : number of internal channels */ const int16_t sba_order, /* i : SBA order */ const int16_t sid_format /* i : SID format */ +#ifdef VLBR_20MS_MD + , + const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ +#endif ) { ivas_spar_md_dec_state_t *hMdDec; @@ -320,7 +328,12 @@ ivas_error ivas_spar_md_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD decoder" ); } - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + last_active_ivas_total_brate /* i : IVAS last active bitrate */ +#endif + ); if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) { @@ -718,7 +731,12 @@ void ivas_spar_md_dec_process( num_md_chs = ivas_sba_get_nchan_metadata( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ); ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); @@ -3127,7 +3145,12 @@ void ivas_spar_to_dirac( } #ifdef VLBR_20MS_MD int16_t num_md_sub_frames; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate +#ifdef VLBR_20MS_MD + , + st_ivas->last_active_ivas_total_brate +#endif + ); ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); #else diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 5af6a46efd..f4f627daab 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -69,7 +69,8 @@ void ivas_sba_prototype_renderer( int16_t slot_idx_start, md_idx; #ifdef VLBR_20MS_MD int16_t num_md_sub_frames; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, + st_ivas->last_active_ivas_total_brate ); #endif push_wmops( "ivas_sba_prototype_renderer" ); -- GitLab From 9dd4211a927cdec5618c9272a586efd1749d70d4 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 14 Jul 2023 19:57:01 +1000 Subject: [PATCH 383/591] harmonizing SBA split rend with MC and ISM split rend --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_binRenderer_internal.c | 14 +- lib_dec/ivas_dirac_dec.c | 9 +- lib_dec/ivas_mc_param_dec.c | 4 +- lib_dec/ivas_stat_dec.h | 9 +- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_prot_rend.h | 22 +-- lib_rend/ivas_splitRendererPre.c | 151 +++++++----------- lib_rend/lib_rend.c | 236 ++++++++++------------------ 9 files changed, 166 insertions(+), 283 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 87eaee4081..e646b9c356 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5165,7 +5165,7 @@ void ivas_binaural_cldfb_sf( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, #endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 6ce4026c05..3c9adc27ac 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -684,7 +684,7 @@ ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { BINAURAL_RENDERER_HANDLE hBinRenderer; @@ -1428,7 +1428,7 @@ void ivas_binaural_cldfb_sf( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, #endif COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ int16_t subframe_idx, /* i : subframe index */ @@ -1623,11 +1623,11 @@ void ivas_binRenderer( void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Real[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot ) { int16_t sf_idx, slot_idx, ch_idx, idx, pose_idx, i, j; @@ -1691,8 +1691,8 @@ void ivas_rend_CldfbMultiBinRendProcess( idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx; for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { - mvr2r( &Cldfb_RealBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Real[pose_idx][ch_idx][idx][0], hCldfbRend->max_band ); - mvr2r( &Cldfb_ImagBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Imag[pose_idx][ch_idx][idx][0], hCldfbRend->max_band ); + mvr2r( &Cldfb_RealBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band ); + mvr2r( &Cldfb_ImagBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band ); } } } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 0c7249366b..415182dfc9 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2351,13 +2351,8 @@ void ivas_dirac_dec_render_sf( float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#else float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif #else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -2959,8 +2954,8 @@ void ivas_dirac_dec_render_sf( { for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { - mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); } } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 48c402f509..8f750fa819 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1777,8 +1777,8 @@ void ivas_param_mc_dec_render( { for ( ch = 0; ch < nchan_out_cldfb; ch++ ) { - mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands ); + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands ); } } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index cc4017e383..eafa25ff57 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1203,13 +1203,8 @@ typedef struct decoder_config_structure #ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct { -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#endif + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; } IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA, *IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE; typedef struct { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 0cba59b88c..0f5a1ff848 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -984,7 +984,7 @@ ivas_error ivas_rend_openMultiBinCrend( CREND_WRAPPER_HANDLE *pCrend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { ivas_error error; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7fadde1af1..381929a965 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -532,17 +532,17 @@ ivas_error ivas_rend_openMultiBinCrend( CREND_WRAPPER_HANDLE *pCrend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); void ivas_rend_CldfbMultiBinRendProcess( const BINAURAL_RENDERER_HANDLE hCldfbRend, const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Real[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot ); ivas_error ivas_rend_openCldfb( @@ -554,7 +554,7 @@ ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); void ivas_mat_mult_2by2_complex( float in_re1[2][2], @@ -1154,8 +1154,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_CODEC splitCodec, ivas_split_rend_bits_t *pBits, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, @@ -1167,8 +1167,8 @@ void ivas_rend_CldfbSplitPreRendProcess( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], ivas_split_rend_bits_t *pBits, const int32_t target_md_bits, const int16_t low_res_pre_rend_rot); @@ -1237,8 +1237,8 @@ void ivas_log_cldfb2wav_data( void ivas_SplitRenderer_GetRotMd( BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ int16_t low_res); void ivas_SplitRenderer_PostRenderer( diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 46e3052db0..1b8a157f5b 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -267,8 +267,10 @@ static void ComputePostPredCov( static void ComputeBandedCrossCov( float Cldfb_RealBuffer1[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer1[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t ch_start_idx1, float Cldfb_RealBuffer2[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer2[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t ch_start_idx2, float out_cov_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float out_cov_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const int16_t num_chs, @@ -299,12 +301,12 @@ static void ComputeBandedCrossCov( for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { out_cov_re[ch_idx1][ch_idx2] += - Cldfb_RealBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_idx2][sf][cldfb_band_idx] + - Cldfb_ImagBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_idx2][sf][cldfb_band_idx]; + Cldfb_RealBuffer1[ch_start_idx1 + ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_start_idx2 + ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer1[ch_start_idx1 + ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_start_idx2 + ch_idx2][sf][cldfb_band_idx]; out_cov_im[ch_idx1][ch_idx2] += - Cldfb_RealBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_idx2][sf][cldfb_band_idx] - - Cldfb_ImagBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_idx2][sf][cldfb_band_idx]; + Cldfb_RealBuffer1[ch_start_idx1 + ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_start_idx2 + ch_idx2][sf][cldfb_band_idx] - + Cldfb_ImagBuffer1[ch_start_idx1 + ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_start_idx2 + ch_idx2][sf][cldfb_band_idx]; } } } @@ -315,8 +317,8 @@ static void ComputeBandedCrossCov( for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { out_cov_re[ch_idx1][ch_idx2] += - Cldfb_RealBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_idx2][sf][cldfb_band_idx] + - Cldfb_ImagBuffer1[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_idx2][sf][cldfb_band_idx]; + Cldfb_RealBuffer1[ch_start_idx1 + ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer2[ch_start_idx2 + ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer1[ch_start_idx1 + ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer2[ch_start_idx2 + ch_idx2][sf][cldfb_band_idx]; out_cov_im[ch_idx1][ch_idx2] = 0.0f; } @@ -332,6 +334,7 @@ static void ComputeBandedCrossCov( static void ComputeBandedCov( float Cldfb_RealBuffer[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t ch_start_idx, float out_cov_re[][BINAURAL_CHANNELS], float out_cov_im[][BINAURAL_CHANNELS], const int16_t num_chs, @@ -362,12 +365,12 @@ static void ComputeBandedCov( for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { out_cov_re[ch_idx1][ch_idx2] += - Cldfb_RealBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_idx2][sf][cldfb_band_idx] + - Cldfb_ImagBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_idx2][sf][cldfb_band_idx]; + Cldfb_RealBuffer[ch_start_idx + ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_start_idx + ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer[ch_start_idx + ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_start_idx + ch_idx2][sf][cldfb_band_idx]; out_cov_im[ch_idx1][ch_idx2] += - Cldfb_RealBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_idx2][sf][cldfb_band_idx] - - Cldfb_ImagBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_idx2][sf][cldfb_band_idx]; + Cldfb_RealBuffer[ch_start_idx + ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_start_idx + ch_idx2][sf][cldfb_band_idx] - + Cldfb_ImagBuffer[ch_start_idx + ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_start_idx + ch_idx2][sf][cldfb_band_idx]; } } } @@ -378,8 +381,8 @@ static void ComputeBandedCov( for ( cldfb_band_idx = brange[0]; cldfb_band_idx < brange[1]; cldfb_band_idx++ ) { out_cov_re[ch_idx1][ch_idx2] += - Cldfb_RealBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_idx2][sf][cldfb_band_idx] + - Cldfb_ImagBuffer[ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_idx2][sf][cldfb_band_idx]; + Cldfb_RealBuffer[ch_start_idx + ch_idx1][sf][cldfb_band_idx] * Cldfb_RealBuffer[ch_start_idx + ch_idx2][sf][cldfb_band_idx] + + Cldfb_ImagBuffer[ch_start_idx + ch_idx1][sf][cldfb_band_idx] * Cldfb_ImagBuffer[ch_start_idx + ch_idx2][sf][cldfb_band_idx]; out_cov_im[ch_idx1][ch_idx2] = 0.0f; } @@ -1296,8 +1299,8 @@ static void ivas_SplitRenderer_quant_code( void ivas_SplitRenderer_GetRotMd( BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - float Cldfb_RealBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ + float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */ int16_t low_res ) { float cov_ii_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -1308,7 +1311,7 @@ void ivas_SplitRenderer_GetRotMd( float cov_io_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t real_only = 0; - int16_t pos_idx, b, sf_idx, start_slot_idx, num_slots, num_subframes; + int16_t pos_idx, b, sf_idx, start_slot_idx, num_slots, num_subframes, ch_s_idx1, ch_s_idx2; int16_t num_md_bands, num_poses; const int16_t *pBand_grouping = SplitRend_band_grouping; num_md_bands = MAX_SPLIT_REND_MD_BANDS; @@ -1341,8 +1344,10 @@ void ivas_SplitRenderer_GetRotMd( { real_only = 1; } - ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[0], - Cldfb_ImagBuffer_Ref_Binaural[0], + ch_s_idx1 = 0; + ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural, + Cldfb_ImagBuffer_Ref_Binaural, + ch_s_idx1, cov_ii_re, cov_ii_im, BINAURAL_CHANNELS, pBand_grouping, @@ -1351,17 +1356,21 @@ void ivas_SplitRenderer_GetRotMd( /*compute rotated signal covariance*/ for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ ) { - ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural[0], - Cldfb_ImagBuffer_Ref_Binaural[0], - Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], - Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + ch_s_idx2 = ( pos_idx + 1 ) * BINAURAL_CHANNELS; + ComputeBandedCrossCov( Cldfb_RealBuffer_Ref_Binaural, + Cldfb_ImagBuffer_Ref_Binaural, + ch_s_idx1, + Cldfb_RealBuffer_Ref_Binaural, + Cldfb_ImagBuffer_Ref_Binaural, + ch_s_idx2, cov_io_re, cov_io_im, BINAURAL_CHANNELS, pBand_grouping, num_slots, start_slot_idx, b, real_only ); - ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], - Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], + ComputeBandedCov( Cldfb_RealBuffer_Ref_Binaural, + Cldfb_ImagBuffer_Ref_Binaural, + ch_s_idx2, cov_oo_re, cov_oo_im, BINAURAL_CHANNELS, pBand_grouping, @@ -1377,42 +1386,6 @@ void ivas_SplitRenderer_GetRotMd( real_only ); } } - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - { - int16_t num_cldfb_bands; - num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; - for ( pos_idx = 0; pos_idx < num_poses - 1; pos_idx++ ) - { - char fname[200] = "rotated_cldfbref_pos"; - char tag[2]; - tag[0] = (char) ( '0' + pos_idx ); - tag[1] = '\0'; - strcat( fname, tag ); - strcat( fname, ".wav" ); - ivas_log_cldfb2wav_data( - Cldfb_RealBuffer_Ref_Binaural[pos_idx + 1], - Cldfb_ImagBuffer_Ref_Binaural[pos_idx + 1], - hBinHrSplitPreRend->cldfbSynRotBinDec[pos_idx], - BINAURAL_CHANNELS, - num_cldfb_bands, - 48000, - num_slots, - start_slot_idx, - fname ); - } - ivas_log_cldfb2wav_data( - Cldfb_RealBuffer_Ref_Binaural[0], - Cldfb_ImagBuffer_Ref_Binaural[0], - hBinHrSplitPreRend->cldfbSynRotBinDec[MAX_HEAD_ROT_POSES], - BINAURAL_CHANNELS, - num_cldfb_bands, - 48000, - num_slots, - start_slot_idx, - "rotated_cldfbref_RefPos.wav" ); - } -#endif } pop_wmops(); @@ -1424,8 +1397,8 @@ void ivas_rend_CldfbSplitPreRendProcess( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], ivas_split_rend_bits_t *pBits, const int32_t target_md_bits, const int16_t low_res_pre_rend_rot ) @@ -1747,8 +1720,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ error = IVAS_ERR_OK; - if ( - is_cldfb_in == 0 ) + if ( is_cldfb_in == 0 ) { isCldfbNeeded = 1; cldfbMode = CLDFB_ANALYSIS; @@ -1760,27 +1732,20 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, } hSplitRendWrapper->hCldfbHandles = NULL; - if ( - isCldfbNeeded ) + if ( isCldfbNeeded ) { if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - num_ch = ( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS; -#else + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; -#endif for ( ch = 0; ch < num_ch; ch++ ) { hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - num_ch = ( 1 + hSplitRendWrapper->multiBinPoseData.num_poses ) * BINAURAL_CHANNELS; -#else + num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; -#endif for ( ch = 0; ch < num_ch; ch++ ) { @@ -1943,8 +1908,8 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( ivas_error error; int32_t bit_len, available_bits, target_md_bits, actual_md_bits; int16_t num_cldfb_bands, ch, slot_idx, pos_idx, num_poses; - float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; uint8_t useLc3plus; float *in_delayed[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; int32_t i; @@ -2008,8 +1973,8 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { cldfbAnalysis_ts( &( in_delayed[pos_idx * BINAURAL_CHANNELS + ch][num_cldfb_bands * slot_idx] ), - Cldfb_In_BinReal[pos_idx][ch][slot_idx], - Cldfb_In_BinImag[pos_idx][ch][slot_idx], + Cldfb_In_BinReal[pos_idx * BINAURAL_CHANNELS + ch][slot_idx], + Cldfb_In_BinImag[pos_idx * BINAURAL_CHANNELS + ch][slot_idx], max_bands, hSplitBin->hCldfbHandles->cldfbAna[pos_idx * BINAURAL_CHANNELS + ch] ); } @@ -2044,8 +2009,8 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( available_bits -= actual_md_bits; ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0], + Cldfb_In_BinReal, + Cldfb_In_BinImag, available_bits, pBits ); } @@ -2077,8 +2042,8 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( static void lc3plusTimeAlignCldfbPoseCorr( SPLIT_REND_WRAPPER *hSplitBin, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) { float Cldfb_In_BinReal_tmp[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][2][CLDFB_NO_CHANNELS_MAX]; float Cldfb_In_BinImag_tmp[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][2][CLDFB_NO_CHANNELS_MAX]; @@ -2095,24 +2060,24 @@ static void lc3plusTimeAlignCldfbPoseCorr( /* Save last 2 columns for next frame */ for ( slot_idx = 0; slot_idx < 2; ++slot_idx ) { - mvr2r( Cldfb_In_BinReal[pose][ch][CLDFB_NO_COL_MAX - 2 + slot_idx], Cldfb_In_BinReal_tmp[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); - mvr2r( Cldfb_In_BinImag[pose][ch][CLDFB_NO_COL_MAX - 2 + slot_idx], Cldfb_In_BinImag_tmp[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + mvr2r( Cldfb_In_BinReal[pose * BINAURAL_CHANNELS + ch][CLDFB_NO_COL_MAX - 2 + slot_idx], Cldfb_In_BinReal_tmp[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + mvr2r( Cldfb_In_BinImag[pose * BINAURAL_CHANNELS + ch][CLDFB_NO_COL_MAX - 2 + slot_idx], Cldfb_In_BinImag_tmp[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); } /* Delay existing columns by 2 slots */ /*TODO : shouldnt the delay be 7.5 ms ? 5ms + LC3plus delay */ for ( slot_idx = CLDFB_NO_COL_MAX - 2 - 1; slot_idx >= 0; --slot_idx ) { - mvr2r( Cldfb_In_BinReal[pose][ch][slot_idx], Cldfb_In_BinReal[pose][ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); - mvr2r( Cldfb_In_BinImag[pose][ch][slot_idx], Cldfb_In_BinImag[pose][ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); + mvr2r( Cldfb_In_BinReal[pose * BINAURAL_CHANNELS + ch][slot_idx], Cldfb_In_BinReal[pose * BINAURAL_CHANNELS + ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); + mvr2r( Cldfb_In_BinImag[pose * BINAURAL_CHANNELS + ch][slot_idx], Cldfb_In_BinImag[pose * BINAURAL_CHANNELS + ch][slot_idx + 2], CLDFB_NO_CHANNELS_MAX ); } /* Fill 2 first columns from buffer */ for ( slot_idx = 0; slot_idx < 2; ++slot_idx ) { - mvr2r( bufRead, Cldfb_In_BinReal[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + mvr2r( bufRead, Cldfb_In_BinReal[pose * BINAURAL_CHANNELS + ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); bufRead += CLDFB_NO_CHANNELS_MAX; - mvr2r( bufRead, Cldfb_In_BinImag[pose][ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); + mvr2r( bufRead, Cldfb_In_BinImag[pose * BINAURAL_CHANNELS + ch][slot_idx], CLDFB_NO_CHANNELS_MAX ); bufRead += CLDFB_NO_CHANNELS_MAX; } @@ -2134,8 +2099,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_CODEC splitCodec, ivas_split_rend_bits_t *pBits, - float Cldfb_In_BinReal[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, float out[][L_FRAME48k], const int16_t low_res_pre_rend_rot, @@ -2202,8 +2167,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural( available_bits -= actual_md_bits; ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, - Cldfb_In_BinReal[0], - Cldfb_In_BinImag[0], + Cldfb_In_BinReal, + Cldfb_In_BinImag, available_bits, pBits ); } @@ -2218,8 +2183,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural( for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[0][ch][slot_idx]; - Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[0][ch][slot_idx]; + Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx]; + Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], -1, hSplitBin->hCldfbHandles->cldfbAna[ch] ); } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 89072f7a5f..aa529763cd 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -195,7 +195,6 @@ typedef struct pan_matrix hoaDecMtx; #ifdef SPLIT_REND_WITH_HEAD_ROT CLDFB_REND_WRAPPER cldfbRendWrapper; - SPLIT_REND_WRAPPER splitRendWrapper; #endif CREND_WRAPPER_HANDLE crendWrapper; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -385,8 +384,8 @@ static void copyBufferToCLDFBarray( } static void accumulateCLDFBArrayToBuffer( - float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float re[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float im[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], IVAS_REND_AudioBuffer *buffer ) { uint32_t smplIdx, slotIdx; @@ -2673,27 +2672,18 @@ static ivas_error updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { - int16_t is_cldfb_in; - - is_cldfb_in = 1; - ivas_renderSplitGetMultiBinPoseData( - &rendCtx.hhRendererConfig[0]->split_rend_config, - &inputSba->splitRendWrapper.multiBinPoseData, - rendCtx.pHeadRotData->sr_pose_pred_axis ); - #if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT /* TODO: redundant nested switch SPLIT_REND_WITH_HEAD_ROT */ if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, - &inputSba->splitRendWrapper.multiBinPoseData, + &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; } - is_cldfb_in = 1; } else @@ -2701,19 +2691,13 @@ static ivas_error updateSbaPanGains( { assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" ); error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, - &inputSba->splitRendWrapper.multiBinPoseData, + &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; } - is_cldfb_in = 0; } - - error = ivas_split_renderer_open( &inputSba->splitRendWrapper, - &inputSba->base.ctx.hhRendererConfig[0]->split_rend_config, - *rendCtx.pOutSampleRate, - is_cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); break; } #endif @@ -2723,7 +2707,7 @@ static ivas_error updateSbaPanGains( { error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, - &inputSba->splitRendWrapper.multiBinPoseData, + &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { @@ -2964,12 +2948,11 @@ static void clearInputSba( /* Free input's internal handles */ #ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->splitRendWrapper.multiBinPoseData.num_poses ); + ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ); if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); } - ivas_split_renderer_close( &inputSba->splitRendWrapper ); #else ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif @@ -3512,7 +3495,6 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; - ivas_init_split_rend_handles( pSplitRendWrapper ); if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { @@ -3535,9 +3517,10 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN return error; } - bufConfig.numSamplesPerChannel = MAX_BUFFER_LENGTH_PER_CHANNEL; - bufConfig.numChannels = BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; - bufConfig.is_cldfb = 0; + /*allocate for CLDFB in and change to TD during process if needed*/ + bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; + bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; + bufConfig.is_cldfb = 1; pSplitRendEncBuffer->config = bufConfig; pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ); if ( pSplitRendEncBuffer->data == NULL ) @@ -3644,6 +3627,11 @@ ivas_error IVAS_REND_Open( } /* Initialize inputs */ +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_init_split_rend_handles( &hIvasRend->splitRendWrapper ); + hIvasRend->splitRendEncBuffer.data = NULL; +#endif + for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) @@ -3709,7 +3697,6 @@ ivas_error IVAS_REND_Open( #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; hIvasRend->inputsSba[i].cldfbRendWrapper.hHrtfFastConv = NULL; - ivas_init_split_rend_handles( &hIvasRend->inputsSba[i].splitRendWrapper ); #endif #ifdef REND_STATIC_MEM_OPT hIvasRend->inputsSba[i].bufferData = NULL; @@ -4164,6 +4151,16 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( hIvasRend->splitRendEncBuffer.data == NULL ) + { + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + switch ( getAudioConfigType( inConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: @@ -4171,19 +4168,6 @@ ivas_error IVAS_REND_AddInput( inputsArray = hIvasRend->inputsIsm; inputStructSize = sizeof( *hIvasRend->inputsIsm ); activateInput = setRendInputActiveIsm; -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) - { - /* Hack to override default split rendering codec from Dolby CLDFB to LC3plus. - This will not be necessary once the split rendering codec becomes selectable by the lib user. */ - closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif break; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; @@ -4602,7 +4586,7 @@ ivas_error IVAS_REND_GetDelay( if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hIvasRend->inputsSba[i].splitRendWrapper.hBinHrSplitPreRend != NULL ) + if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL ) { #if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) if ( hIvasRend->hRendererConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) @@ -4901,15 +4885,6 @@ ivas_error IVAS_REND_InitConfig( hIvasRend->hRendererConfig = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* ToDo: The entire contents of this function should be part of IVAS_REND_Open - otherwise renderer handle is partly uninitialized after opening */ - /* Initialize split rendering */ - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - return IVAS_ERR_OK; } @@ -5026,13 +5001,6 @@ int16_t IVAS_REND_FeedRenderConfig( { return error; } - - /* Must re-initialize split rendering config which depends on renderer config */ - closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } #endif return IVAS_ERR_OK; @@ -7267,13 +7235,13 @@ static ivas_error renderSbaToMultiBinaural( ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } push_wmops( "renderSbaToMultiBinaural" ); - pMultiBinPoseData = &sbaInput->splitRendWrapper.multiBinPoseData; + pMultiBinPoseData = &sbaInput->base.ctx.pSplitRendWrapper->multiBinPoseData; pCombinedOrientationDataLocal = *sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationDataLocal = *pCombinedOrientationDataLocal; @@ -7357,8 +7325,8 @@ static ivas_error renderSbaToMultiBinaural( } static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, - float Cldfb_Out_Real[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Imag[][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot ) { float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -7369,7 +7337,7 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, ivas_rend_CldfbMultiBinRendProcess( sbaInput->cldfbRendWrapper.hCldfbRend, sbaInput->base.ctx.pCombinedOrientationData, - &sbaInput->splitRendWrapper.multiBinPoseData, + &sbaInput->base.ctx.pSplitRendWrapper->multiBinPoseData, Cldfb_RealBuffer, Cldfb_ImagBuffer, Cldfb_Out_Real, @@ -7381,33 +7349,19 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, - IVAS_REND_AudioBuffer outAudio, - IVAS_REND_BitstreamBuffer *hBits ) + IVAS_REND_AudioBuffer outAudio ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#endif - ivas_split_rend_bits_t bits; - int16_t low_res_pre_rend_rot, max_band; - int16_t td_input; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + int16_t low_res_pre_rend_rot; - low_res_pre_rend_rot = 1; //( *sbaInput->base.ctx.pSplitRendBitRate == SPLIT_REND_768k ) ? 0 : 1; + low_res_pre_rend_rot = 1; push_wmops( "renderSbaToSplitBinaural" ); error = IVAS_ERR_OK; - /*TODO : call this at the begining of renderer process for all formats*/ - ivas_renderSplitGetMultiBinPoseData( - &sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config, - &sbaInput->splitRendWrapper.multiBinPoseData, - sbaInput->base.ctx.pHeadRotData->sr_pose_pred_axis ); - #if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -7416,8 +7370,7 @@ static ivas_error renderSbaToSplitBinaural( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, low_res_pre_rend_rot ); - max_band = sbaInput->cldfbRendWrapper.hCldfbRend->max_band; - td_input = 0; + accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } else #endif @@ -7426,32 +7379,9 @@ static ivas_error renderSbaToSplitBinaural( sbaInput, outConfig, tmpCrendBuffer ); - max_band = (int16_t) ( ( BINAURAL_MAXBANDS * ( *sbaInput->base.ctx.pOutSampleRate ) ) / 48000 ); - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); - } - td_input = 1; + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); } - /*SPLIT pre rendering MD and CLDFB coding*/ - convertBitsBufferToInternalBitsBuff( *hBits, &bits ); - - ivas_renderMultiBinToSplitBinaural( &sbaInput->splitRendWrapper, - sbaInput->base.ctx.pHeadRotData->headPositions, - sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.splitRendBitRate, - sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.codec, - &bits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - max_band, - tmpCrendBuffer, - low_res_pre_rend_rot, - td_input, - ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - - convertInternalBitsBuffToBitsBuffer( hBits, bits ); - pop_wmops(); return error; @@ -7471,13 +7401,13 @@ static ivas_error renderSbaToBinaural( #if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { - float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, 0 ); - accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], &outAudio ); + accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } else #endif @@ -7706,12 +7636,7 @@ static ivas_error renderSbaToMasa( static ivas_error renderInputSba( input_sba *sbaInput, const IVAS_REND_AudioConfig outConfig, - IVAS_REND_AudioBuffer outAudio -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - IVAS_REND_BitstreamBuffer *hBits -#endif -) + IVAS_REND_AudioBuffer outAudio ) { ivas_error error; IVAS_REND_AudioBuffer inAudio; @@ -7756,8 +7681,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_WITH_HEAD_ROT outConfig, #endif - outAudio, - hBits ); + outAudio ); break; #endif case IVAS_REND_AUDIO_CONFIG_BINAURAL: @@ -7812,12 +7736,7 @@ static ivas_error renderActiveInputsSplitBin( static ivas_error renderActiveInputsSba( IVAS_REND_HANDLE hIvasRend, - IVAS_REND_AudioBuffer outAudio -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - IVAS_REND_BitstreamBuffer *hBits -#endif -) + IVAS_REND_AudioBuffer outAudio ) { int16_t i; input_sba *pCurrentInput; @@ -7831,12 +7750,7 @@ static ivas_error renderActiveInputsSba( continue; } - if ( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - hBits -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; } @@ -8412,24 +8326,34 @@ ivas_error IVAS_REND_GetSamples( return IVAS_ERR_WRONG_NUM_CHANNELS; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /* Clear original output buffer */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); +#ifdef SPLIT_REND_WITH_HEAD_ROT outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && - ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || - ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) ) + ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { + int16_t num_poses_orig; + num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses; outAudio = hIvasRend->splitRendEncBuffer; + if ( outAudioOrig.config.is_cldfb == 0 ) + { + outAudio.config.is_cldfb = 0; + outAudio.config.numSamplesPerChannel >>= 1; + } + 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 */ + set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); } #endif - /* Clear output buffer */ - set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); - if ( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -8440,12 +8364,7 @@ ivas_error IVAS_REND_GetSamples( return error; } - if ( ( error = renderActiveInputsSba( hIvasRend, outAudio -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - hBits -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = renderActiveInputsSba( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { return error; } @@ -8476,18 +8395,24 @@ ivas_error IVAS_REND_GetSamples( #endif /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */ - && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) || - ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) ) + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - /* TODO: doesn't work for multiple SBA inputs, needs to be updated like the ISM path for TD */ ivas_split_rend_bits_t bits; - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + int16_t td_input; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; - copyBufferTo2dArray( outAudio, tmpBinaural ); + if ( ( outAudio.config.is_cldfb == 1 ) ) + { + td_input = 0; + copyBufferToCLDFBarray( outAudio, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural ); + } + else + { + td_input = 1; + copyBufferTo2dArray( outAudio, tmpBinaural ); + } /* Encode split rendering bitstream */ convertBitsBufferToInternalBitsBuff( *hBits, &bits ); @@ -8501,7 +8426,7 @@ ivas_error IVAS_REND_GetSamples( ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, - 1, + td_input, ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { @@ -8509,7 +8434,10 @@ ivas_error IVAS_REND_GetSamples( } convertInternalBitsBuffToBitsBuffer( hBits, bits ); outAudio = outAudioOrig; - accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); + } } #endif /* SPLIT_REND_WITH_HEAD_ROT */ -- GitLab From bd79a058fb025a897122b85b0932644b6a4f0cc3 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 14 Jul 2023 15:52:10 +0530 Subject: [PATCH 384/591] Fix clang formatting --- lib_dec/ivas_masa_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 70ae4fa664..10f260ad7a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -846,9 +846,9 @@ static int16_t decode_lfe_to_total_energy_ratio( lfeBitsRead = 0; byteBuffer = bitstream[( *index )--]; lfeBitsRead += 1; - lfeToTotalEnergyRatioIndices[0] = byteBuffer; /* First LFE index */ + lfeToTotalEnergyRatioIndices[0] = byteBuffer; /* First LFE index */ - if ( ivas_total_brate == IVAS_13k2 ) /* 1-bit adaptive LFE gain quantizer at 13.2 kbps */ + if ( ivas_total_brate == IVAS_13k2 ) /* 1-bit adaptive LFE gain quantizer at 13.2 kbps */ { lfeToTotalEnergyRatioTemp = hMasaLfeSynth->lfeToTotalEnergyRatio[3]; /* Take memory from the last subframe */ if ( lfeToTotalEnergyRatioIndices[0] == 1 ) -- GitLab From 9b1198eddb475bd1fc32baf988d49eac4cc468b8 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 14 Jul 2023 17:15:57 +0530 Subject: [PATCH 385/591] Modified the fix --- lib_dec/ivas_dec.c | 1 - lib_dec/ivas_jbm_dec.c | 1 - lib_dec/ivas_spar_md_dec.c | 11 +++++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index b54c38cd6e..19f0f876db 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -395,7 +395,6 @@ ivas_error ivas_dec( #else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); #endif - } else if ( st_ivas->renderer_type != RENDERER_DISABLE ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 3e76b4d700..2b7e7e5052 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -301,7 +301,6 @@ ivas_error ivas_jbm_dec_tc( #else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); #endif - } else { diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 8952e5b552..4c9a83ce38 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -291,9 +291,16 @@ int16_t ivas_get_spar_dec_md_num_subframes( } #ifdef VLBR_20MS_MD - if ( ivas_total_brate < IVAS_24k4 && ( ivas_total_brate > IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) ) + if ( ivas_total_brate < IVAS_24k4 ) { - num_subframes = 1; + if(( ivas_total_brate <= IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) ) + { + num_subframes = 1; + } + else if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate < IVAS_24k4 ) ) + { + num_subframes = 1; + } } #endif -- GitLab From 78f7d0a56cb74df35539ee5a7a9ffe7dcc16dc40 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 14 Jul 2023 17:43:22 +0530 Subject: [PATCH 386/591] Clang formatting fix --- lib_dec/ivas_spar_md_dec.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 4c9a83ce38..0d17dbb09c 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -291,16 +291,10 @@ int16_t ivas_get_spar_dec_md_num_subframes( } #ifdef VLBR_20MS_MD - if ( ivas_total_brate < IVAS_24k4 ) + if ( ( ivas_total_brate < IVAS_24k4 ) && ( ( ivas_total_brate <= IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) || ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate < IVAS_24k4 ) ) ) { - if(( ivas_total_brate <= IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) ) - { - num_subframes = 1; - } - else if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate < IVAS_24k4 ) ) - { - num_subframes = 1; - } + + num_subframes = 1; } #endif -- GitLab From 0d52c9e0bff12771190b83804109f7f0782413db Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 14 Jul 2023 14:18:22 +0200 Subject: [PATCH 387/591] [fix] try to fix instrumented build --- lib_com/common_api_types.h | 4 ++-- lib_com/ivas_cnst.h | 2 +- lib_rend/ivas_render_config.c | 2 +- lib_rend/ivas_stat_rend.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index b2a40a5adb..59f6387935 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -147,7 +147,7 @@ typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -#ifdef DEBUGGING +#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering typedef enum { IVAS_RENDER_TYPE_OVERRIDE_NONE, @@ -198,7 +198,7 @@ typedef struct _IVAS_SPLIT_REND_CONFIG typedef struct _IVAS_RENDER_CONFIG { -#ifdef DEBUGGING +#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index ba2776ff0b..1a2b36151b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -117,7 +117,7 @@ typedef enum } AUDIO_CONFIG; -#ifdef DEBUGGING +#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering typedef enum { RENDER_TYPE_OVERRIDE_NONE, diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 9f4185af87..8579794141 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -107,7 +107,7 @@ ivas_error ivas_render_config_init_from_rom( return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } -#ifdef DEBUGGING +#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; #endif ( *hRenderConfig )->roomAcoustics.override = FALSE; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index ee5a88cdc2..3994372080 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -531,7 +531,7 @@ typedef struct ivas_roomAcoustics_t typedef struct ivas_render_config_t { -#ifdef DEBUGGING +#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; -- GitLab From 40f5952a96b6afd3d438b706802d5b3f3e75f839 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Fri, 14 Jul 2023 14:29:57 +0200 Subject: [PATCH 388/591] display log content --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 255dc6c90a..c04e5359bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1322,6 +1322,7 @@ upload-selection-BE-log: - ericsson-windows-runner script: - cp -r $SELECTION_BE_RESULT ./selection-BE-result + - Get-Content -Path selection-BE-result/public_log--sha-*.txt artifacts: paths: - selection-BE-result/public_log--sha-*.txt -- GitLab From 9c8faf36911cb8f34bb2095c7b9e0ec836ce7abc Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Fri, 14 Jul 2023 18:18:49 +0530 Subject: [PATCH 389/591] optimising memory allocation in fastconv renderer --- apps/decoder.c | 1 - lib_com/ivas_prot.h | 12 + lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 397 +++++++++++++++++++++++++++- lib_dec/ivas_init_dec.c | 5 +- lib_rend/ivas_stat_rend.h | 22 +- lib_util/hrtf_file_reader.c | 40 ++- 7 files changed, 468 insertions(+), 10 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index e210ebe95e..64587e4a28 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -617,7 +617,6 @@ int main( } IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL; IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ); - if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfCRendFileName ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9bc253776d..9b6c592ee7 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5144,6 +5144,18 @@ void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ ); +#ifdef FIX_1720_HRTF_FASTCONV +void ivas_binaural_hrtf_close( + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ +); + +ivas_error ivas_allocate_binaural_hrtf( + HRTFS_FASTCONV *HrtfFastConv, /* i : fastconv HRTF handle */ + AUDIO_CONFIG output_config, /* i : ouput audio config */ + BINAURAL_INPUT_AUDIO_CONFIG output_config_bin /* i : binaural input audio config */ +); +#endif + #ifdef DEBUGGING void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index fbad020371..8daca52aaa 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ #define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ +#define FIX_1720_HRTF_FASTCONV /* Dlb : Binaural format RAM saving in SBA mode */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5bd09236e0..837f2a4d4f 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -46,6 +46,9 @@ #include "debug.h" #endif #include "wmc_auto.h" +#ifdef FIX_1720_HRTF_FASTCONV +#include +#endif /*------------------------------------------------------------------------- @@ -381,6 +384,216 @@ static ivas_error ivas_binRenderer_convModuleOpen( return IVAS_ERR_OK; } +#ifdef FIX_1720_HRTF_FASTCONV +/*-------------------------------------------------------------------------* + * ivas_allocate_binaural_hrtf() + * + * Allocate memory for HrtfFastConv structure elements + *-------------------------------------------------------------------------*/ + +ivas_error ivas_allocate_binaural_hrtf( + HRTFS_FASTCONV *HrtfFastConv, + AUDIO_CONFIG output_config, + BINAURAL_INPUT_AUDIO_CONFIG output_config_bin ) +{ + int16_t i, j; + /*malloc for HOA3, HOA2, FOA*/ + if ( output_config == AUDIO_CONFIG_HOA3 || output_config_bin == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3 != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( ( HrtfFastConv->leftHRIRReal_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + } + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + } + } + } + } + } + else if ( output_config == AUDIO_CONFIG_HOA2 || output_config_bin == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( ( HrtfFastConv->leftHRIRReal_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + } + for ( j = 0; j < 9; j++ ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + } + } + } + } + } + else if ( output_config == AUDIO_CONFIG_FOA || output_config_bin == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) + { + if ( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( ( HrtfFastConv->leftHRIRReal_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->leftHRIRImag_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRReal_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRImag_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftHRIRReal_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->leftHRIRImag_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRReal_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRImag_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } + for ( j = 0; j < 4; j++ ) + { + if ( ( HrtfFastConv->leftHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->leftHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } + } + } + } + } + return IVAS_ERR_OK; +} +#endif + /*-------------------------------------------------------------------------* * ivas_binaural_HRTF_open() * @@ -388,7 +601,11 @@ static ivas_error ivas_binRenderer_convModuleOpen( *-------------------------------------------------------------------------*/ static ivas_error ivas_binaural_hrtf_open( - HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ + HRTFS_FASTCONV_HANDLE *hHrtfFastConv +#ifdef FIX_1720_HRTF_FASTCONV + , + AUDIO_CONFIG output_config +#endif ) { int16_t i, j; @@ -407,12 +624,31 @@ static ivas_error ivas_binaural_hrtf_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for FastConv HRTF tables" ); } + +#ifdef FIX_1720_HRTF_FASTCONV + memset( HrtfFastConv, 0x00, sizeof( HRTFS_FASTCONV ) ); + HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; + if ( output_config == AUDIO_CONFIG_HOA2 ) + { + HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; + } + else if ( output_config == AUDIO_CONFIG_HOA3 ) + { + HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; + } + else if ( output_config == AUDIO_CONFIG_FOA ) + { + HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; + } + HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; + ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, 0 ); +#else HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; - +#endif for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) @@ -428,7 +664,40 @@ static ivas_error ivas_binaural_hrtf_open( mvr2r( rightBRIRReal[i][j], HrtfFastConv->rightBRIRReal[i][j], BINAURAL_NTAPS_MAX ); mvr2r( rightBRIRImag[i][j], HrtfFastConv->rightBRIRImag[i][j], BINAURAL_NTAPS_MAX ); } +#ifdef FIX_1720_HRTF_FASTCONV + if ( output_config == AUDIO_CONFIG_HOA3 ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRImag_HOA3[i][j], HrtfFastConv->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRReal_HOA3[i][j], HrtfFastConv->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); + } + } + else if ( output_config == AUDIO_CONFIG_HOA2 ) + { + for ( j = 0; j < 9; j++ ) + { + mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRImag_HOA2[i][j], HrtfFastConv->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRReal_HOA2[i][j], HrtfFastConv->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); + } + } + else if ( output_config == AUDIO_CONFIG_FOA ) + { + + for ( j = 0; j < 4; j++ ) + { + mvr2r( leftHRIRReal_FOA[i][j], HrtfFastConv->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRImag_FOA[i][j], HrtfFastConv->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS ); + } + } +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); @@ -450,8 +719,8 @@ static ivas_error ivas_binaural_hrtf_open( mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS ); mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS ); } +#endif } - mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); @@ -648,7 +917,11 @@ ivas_error ivas_binRenderer_open( } /* Load HRTF tables */ +#ifdef FIX_1720_HRTF_FASTCONV + ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config ); +#else ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv ); +#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && ( st_ivas->hIntSetup.is_loudspeaker_setup == 0 ) ) { @@ -893,6 +1166,124 @@ void ivas_binRenderer_close( return; } +#ifdef FIX_1720_HRTF_FASTCONV +/*------------------------------------------------------------------------- + * ivas_binaural_hrtf_close() + * + * Close fastconv binaural renderer hrtf memories + *------------------------------------------------------------------------*/ + +void ivas_binaural_hrtf_close( + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ +) +{ + int16_t i, j; + if ( hHrtfFastConv == NULL || *hHrtfFastConv == NULL ) + { + return; + } + if ( ( *hHrtfFastConv )->leftHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA3 != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i] ); + ( *hHrtfFastConv )->leftHRIRReal_HOA3[i] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA3[i] ); + ( *hHrtfFastConv )->leftHRIRImag_HOA3[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA3[i] ); + ( *hHrtfFastConv )->rightHRIRReal_HOA3[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA3[i] ); + ( *hHrtfFastConv )->rightHRIRImag_HOA3[i] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal_HOA3 ); + ( *hHrtfFastConv )->leftHRIRReal_HOA3 = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA3 ); + ( *hHrtfFastConv )->leftHRIRImag_HOA3 = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA3 ); + ( *hHrtfFastConv )->rightHRIRReal_HOA3 = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA3 ); + ( *hHrtfFastConv )->rightHRIRImag_HOA3 = NULL; + } + else if ( ( *hHrtfFastConv )->leftHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA2 != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i] ); + ( *hHrtfFastConv )->leftHRIRReal_HOA2[i] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA2[i] ); + ( *hHrtfFastConv )->leftHRIRImag_HOA2[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA2[i] ); + ( *hHrtfFastConv )->rightHRIRReal_HOA2[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA2[i] ); + ( *hHrtfFastConv )->rightHRIRImag_HOA2[i] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal_HOA2 ); + ( *hHrtfFastConv )->leftHRIRReal_HOA2 = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA2 ); + ( *hHrtfFastConv )->leftHRIRImag_HOA2 = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA2 ); + ( *hHrtfFastConv )->rightHRIRReal_HOA2 = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA2 ); + ( *hHrtfFastConv )->rightHRIRImag_HOA2 = NULL; + } + else if ( ( *hHrtfFastConv )->leftHRIRReal_FOA != NULL && ( *hHrtfFastConv )->leftHRIRImag_FOA != NULL && ( *hHrtfFastConv )->rightHRIRReal_FOA != NULL && ( *hHrtfFastConv )->rightHRIRImag_FOA != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i] ); + ( *hHrtfFastConv )->leftHRIRReal_FOA[i] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_FOA[i] ); + ( *hHrtfFastConv )->leftHRIRImag_FOA[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_FOA[i] ); + ( *hHrtfFastConv )->rightHRIRReal_FOA[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_FOA[i] ); + ( *hHrtfFastConv )->rightHRIRImag_FOA[i] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal_FOA ); + ( *hHrtfFastConv )->leftHRIRReal_FOA = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_FOA ); + ( *hHrtfFastConv )->leftHRIRImag_FOA = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_FOA ); + ( *hHrtfFastConv )->rightHRIRReal_FOA = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_FOA ); + ( *hHrtfFastConv )->rightHRIRImag_FOA = NULL; + } + return; +} +#endif /*-------------------------------------------------------------------------* * ivas_binaural_add_LFE() diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2294203053..0e17432233 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -661,7 +661,6 @@ ivas_error ivas_init_decoder_front( { return error; } - if ( ( error = ivas_HRTF_parambin_binary_open( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -1874,7 +1873,9 @@ void ivas_destroy_dec( /* CRend binaural renderer handle */ ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); - +#ifdef FIX_1720_HRTF_FASTCONV + ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv ); +#endif /* Fastconv HRTF filters */ ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c763630325..f192ccee0c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -756,21 +756,39 @@ typedef struct ivas_hrtfs_fastconv_struct float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; float FASTCONV_HOA3_latency_s; + float FASTCONV_HOA2_latency_s; + float FASTCONV_FOA_latency_s; +#ifdef FIX_1720_HRTF_FASTCONV + float ***leftHRIRReal_HOA3; + float ***leftHRIRImag_HOA3; + float ***rightHRIRReal_HOA3; + float ***rightHRIRImag_HOA3; + + float ***leftHRIRReal_HOA2; + float ***leftHRIRImag_HOA2; + float ***rightHRIRReal_HOA2; + float ***rightHRIRImag_HOA2; + + float ***leftHRIRReal_FOA; + float ***leftHRIRImag_FOA; + float ***rightHRIRReal_FOA; + float ***rightHRIRImag_FOA; +#else float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; - float FASTCONV_HOA2_latency_s; float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]; float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]; float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]; float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][9][BINAURAL_NTAPS]; - float FASTCONV_FOA_latency_s; + float leftHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; +#endif float FASTCONV_BRIR_latency_s; float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index e2181ca6e1..3e078c96f5 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -34,7 +34,9 @@ #include #include "prot.h" #include "ivas_prot_rend.h" - +#ifdef FIX_1720_HRTF_FASTCONV +#include "ivas_prot.h" +#endif /*---------------------------------------------------------------------* * Local structures @@ -1027,6 +1029,9 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { int16_t i, j; char *hrtf_data_rptr; +#ifdef FIX_1720_HRTF_FASTCONV + ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg ); +#endif // if ( hHRTF == NULL ) // { @@ -1173,7 +1178,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 9; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1181,7 +1190,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 9; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1189,7 +1202,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 9; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1197,7 +1214,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 9; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1224,7 +1245,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 4; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1232,7 +1257,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 4; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1240,7 +1269,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 4; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1248,7 +1281,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { +#ifdef FIX_1720_HRTF_FASTCONV + for ( j = 0; j < 4; j++ ) +#else for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) +#endif { memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1385,7 +1422,6 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } - /* Create the HRTF reading the raw data from the binary file */ if ( ( create_fastconv_HRTF_from_rawdata( &hHrtfFastConv, hrtf_data, hrtf_header.rend_type, hrtf_header.input_cfg ) ) != IVAS_ERR_OK ) { -- GitLab From 27d572c44c11a119e91f522e8d01f4ea0a8bc1ea Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 14 Jul 2023 14:57:56 +0200 Subject: [PATCH 390/591] [cleanup] interface for ivas_rend_crendProcessSplitBin() --- lib_dec/ivas_dec.c | 24 ++++++++++++++++-- lib_rend/ivas_crend.c | 51 ++++++++++++++++++++++----------------- lib_rend/ivas_prot_rend.h | 14 ++++++++--- lib_rend/lib_rend.c | 2 +- 4 files changed, 62 insertions(+), 29 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index db6b81b486..0bdb75b6f6 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -511,7 +511,17 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); + ivas_rend_crendProcessSplitBin( + st_ivas->hCrendWrapper, + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hDecoderConfig, + st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, + st_ivas->hEFAPdata, + p_output, + output_Fs ); } else { @@ -599,7 +609,17 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - ivas_rend_crendProcessSplitBin( st_ivas, output, output_frame ); + ivas_rend_crendProcessSplitBin( + st_ivas->hCrendWrapper, + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hDecoderConfig, + st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, + st_ivas->hEFAPdata, + p_output, + output_Fs ); } else { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 0f5a1ff848..3f2a3aa70d 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1751,27 +1751,32 @@ ivas_error ivas_rend_crendProcessSubframe( *-----------------------------------------------------------------------------------------*/ ivas_error ivas_rend_crendProcessSplitBin( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ -) + const CREND_WRAPPER *pCrend, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + DECODER_CONFIG_HANDLE hDecoderConfig, + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, + const IVAS_OUTPUT_SETUP_HANDLE hIntSetup, + EFAP_HANDLE hEFAPdata, + float *output[], + const int32_t output_Fs ) { int16_t i, j, sf; - int16_t pos_idx; + int16_t pos_idx, output_frame; ivas_error error; float gain_lfe; float tmpLfeBuffer[L_FRAME48k]; float tmpInputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_tmpInputBuffer[MAX_OUTPUT_CHANNELS]; float tmpSplitBinBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; - pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; + output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); /* copy input */ - for ( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE; ++i ) + for ( i = 0; i < hIntSetup->nchan_out_woLFE; ++i ) { mvr2r( output[i], tmpInputBuffer[i], output_frame ); } @@ -1782,7 +1787,7 @@ ivas_error ivas_rend_crendProcessSplitBin( } /* save current head positions */ - pCombinedOrientationDataLocal = st_ivas->hCombinedOrientationData; + pCombinedOrientationDataLocal = hCombinedOrientationData; combinedOrientationDataLocal = *pCombinedOrientationDataLocal; if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { @@ -1800,10 +1805,12 @@ ivas_error ivas_rend_crendProcessSplitBin( } /* copy LFE to tmpLfeBuffer and apply gain only once */ - if ( st_ivas->hIntSetup.num_lfe > 0 && st_ivas->hIntSetup.index_lfe[0] != -1 ) + if ( hIntSetup->num_lfe > 0 && hIntSetup->index_lfe[0] != -1 ) { - mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame ); - gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; + mvr2r( output[hIntSetup->index_lfe[0]], tmpLfeBuffer, output_frame ); + gain_lfe = ( ( pCrend != NULL ) && ( pCrend->hHrtfCrend != NULL ) ) + ? pCrend->hHrtfCrend->gain_lfe + : GAIN_LFE; v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame ); } else @@ -1833,24 +1840,24 @@ ivas_error ivas_rend_crendProcessSplitBin( for ( i = 0; i < 3; i++ ) { - mvr2r( st_ivas->hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 ); + mvr2r( hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 ); } - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, - st_ivas->intern_config, - st_ivas->hOutSetup.output_config, - st_ivas->hDecoderConfig, + if ( ( error = ivas_rend_crendProcess( pCrend, + inConfig, + outConfig, + hDecoderConfig, pCombinedOrientationDataLocal, - &st_ivas->hIntSetup, - st_ivas->hEFAPdata, + hIntSetup, + hEFAPdata, p_tmpInputBuffer, - st_ivas->hDecoderConfig->output_Fs, + output_Fs, pos_idx ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < 3; i++ ) { - mvr2r( pCombinedOrientationDataLocal->Rmat_prev[0][i], st_ivas->hCombinedOrientationData->Rmat_prev[pos_idx][i], 3 ); + mvr2r( pCombinedOrientationDataLocal->Rmat_prev[0][i], hCombinedOrientationData->Rmat_prev[pos_idx][i], 3 ); } for ( i = 0; i < BINAURAL_CHANNELS; ++i ) @@ -1863,7 +1870,7 @@ ivas_error ivas_rend_crendProcessSplitBin( } /* overwrite rendered channels with input again for next iteration */ - for ( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE; ++i ) + for ( i = 0; i < hIntSetup->nchan_out_woLFE; ++i ) { mvr2r( output[i], tmpInputBuffer[i], output_frame ); } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 381929a965..8b0f91114c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -633,11 +633,17 @@ ivas_error ivas_rend_crendProcessSubframe( ); #ifdef SPLIT_REND_WITH_HEAD_ROT -/* TODO tmu : interface cleanup */ ivas_error ivas_rend_crendProcessSplitBin( - Decoder_Struct *st_ivas, - float output[][L_FRAME48k], - const int16_t output_frame + const CREND_WRAPPER *pCrend, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + DECODER_CONFIG_HANDLE hDecoderConfig, + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, + const IVAS_OUTPUT_SETUP_HANDLE hIntSetup, + EFAP_HANDLE hEFAPdata, + float *output[], + const int32_t output_Fs ); #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index aa529763cd..ea69179570 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8403,7 +8403,7 @@ ivas_error IVAS_REND_GetSamples( float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; - if ( ( outAudio.config.is_cldfb == 1 ) ) + if ( outAudio.config.is_cldfb == 1 ) { td_input = 0; copyBufferToCLDFBarray( outAudio, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural ); -- GitLab From 710d27312ef14dd1a978aad0ca9b48ecac9ed924 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Fri, 14 Jul 2023 18:40:19 +0530 Subject: [PATCH 391/591] Minor modification --- lib_dec/ivas_spar_md_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 0d17dbb09c..eaaece2cb4 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -291,7 +291,7 @@ int16_t ivas_get_spar_dec_md_num_subframes( } #ifdef VLBR_20MS_MD - if ( ( ivas_total_brate < IVAS_24k4 ) && ( ( ivas_total_brate <= IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) || ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate < IVAS_24k4 ) ) ) + if ( ( ivas_total_brate <= IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) || ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate < IVAS_24k4 ) ) { num_subframes = 1; -- GitLab From b3b134b1cf6695ae6e2a958063672fc15ce42d87 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 14 Jul 2023 15:41:31 +0200 Subject: [PATCH 392/591] [cleanup] remove redundant switch nesting and cleanup changes to setRendInputActiveIsm() --- lib_rend/lib_rend.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ea69179570..b5509b706d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1414,20 +1414,15 @@ static ivas_error setRendInputActiveIsm( inputIsm->hOMasa = NULL; error = IVAS_ERR_OK; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else + if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) #endif - ) { #ifndef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, - NULL, *rendCtx.pOutSampleRate -#ifdef SPLIT_REND_WITH_HEAD_ROT /* TODO FhG2Dlb : switch nesting needs review */ - , - 1 -#endif - ) ) != IVAS_ERR_OK ) + NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From ad05b48b7340775dff6e253a32e38a0f9d40c318 Mon Sep 17 00:00:00 2001 From: azmill Date: Mon, 17 Jul 2023 11:14:37 +1000 Subject: [PATCH 393/591] Updating the README and forcing latency to be 1 sample for all HOA formats --- .../matlab_hrir_generation_scripts/README.md | 6 ++++-- .../matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m | 6 +++--- .../matlab_hrir_generation_scripts/generate_rom_tables.m | 5 ++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md index d5dd3f6a65..25a3fcfeff 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md @@ -1,5 +1,7 @@ -### 2023-07-07 -Entry point to convert SD HRTFs to SHD HRTFs is the convert_SD2SHD_HRIRs.m script. +### 2023-07-17 +Entry point to convert SD HRIRs to SHD HRIRs is the convert_SD2SHD_HRIRs.m script. +Entry point to convert SHD HRIRs to CLDFB domain HRIRs is SHD_2_ROM.m. Python 3.9.x needs to be installed with the sofar python module. The convert_SD2SHD_HRIRs.m script needs the path to this python. +Matlab 2020 has seen some issues with using python, so use a newer version if possible. diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m index bdd0145e4b..116fb9b7cd 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m @@ -34,7 +34,7 @@ sr_short = [48, 32, 16]; sr_dft_size = [240, 160, 80]; % FOA -data_struct(1).IR_data = generate_HOA_HRIRs_MOD_lens(1, python_path, sofa_path, sofa_file, IR_size); +data_struct(1).IR_data = generate_HOA_HRIRs_MOD_lens(1, python_path, sofa_path, sofa_file, IR_size, 0); data_struct(1).HOA_name = 'FOA'; data_struct(1).n_HOA_ch = 4; data_struct(1).sr = sr; @@ -42,7 +42,7 @@ data_struct(1).sr_short = sr_short; data_struct(1).sr_dft_size = sr_dft_size; % HOA2 -data_struct(2).IR_data = generate_HOA_HRIRs_MOD_lens(2, python_path, sofa_path, sofa_file, IR_size); +data_struct(2).IR_data = generate_HOA_HRIRs_MOD_lens(2, python_path, sofa_path, sofa_file, IR_size, 0); data_struct(2).HOA_name = 'HOA2'; data_struct(2).n_HOA_ch = 9; data_struct(2).sr = sr; @@ -50,7 +50,7 @@ data_struct(2).sr_short = sr_short; data_struct(2).sr_dft_size = sr_dft_size; % HOA3 -data_struct(3).IR_data = generate_HOA_HRIRs_MOD_lens(3, python_path, sofa_path, sofa_file, IR_size); +data_struct(3).IR_data = generate_HOA_HRIRs_MOD_lens(3, python_path, sofa_path, sofa_file, IR_size, 0); data_struct(3).HOA_name = 'HOA3'; data_struct(3).n_HOA_ch = 16; data_struct(3).sr = sr; diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m index ef61544ba1..c39d608822 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m @@ -152,9 +152,8 @@ function generate_rom_tables(data_struct) % First Sample rate must be 48k assert(data_struct(hoa_idx).sr(1) == 48000) - % Compute latency of IRs - [~, I] = max(abs(data_struct(hoa_idx).IR_data)); - latency = (min(squeeze(I), [], "all") - 1) / data_struct(hoa_idx).sr(1); + % Force Latency of HRIRs to 1 sample to retain bit exactness + latency = 1 / data_struct(hoa_idx).sr(1); latency = latency + 0.000000001; fprintf(fileID,'\n/********************** CRendBin_%s_HRIR **********************/\n\n', HOA_name); -- GitLab From 8e2b2e40478849515b8ea349c659c7cea6e4021c Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 17 Jul 2023 11:40:16 +1000 Subject: [PATCH 394/591] fix for combined orientation handling and compilation errors when disabling SPLIT_REND_WITH_HEAD_ROT in renderSbaToBinaural() --- lib_rend/lib_rend.c | 70 +++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b5509b706d..ac8461c13c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7388,8 +7388,14 @@ static ivas_error renderSbaToBinaural( const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { + float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; + float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; + int16_t i; + const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; + int8_t combinedOrientationEnabled; + int16_t subframe_idx; push_wmops( "renderSbaToBinaural" ); @@ -7406,48 +7412,61 @@ static ivas_error renderSbaToBinaural( } else #endif - { - float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#ifdef SPLIT_REND_WITH_HEAD_ROT - float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; - for ( int16_t i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif - tmpRotBuffer = sbaInput->base.inputBuffer; - tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); - /* copy input for in-place rotation */ - mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; + combinedOrientationEnabled = 0; + if ( hCombinedOrientationData != NULL ) + { + for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) + { + if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) + { + combinedOrientationEnabled = 1; + break; + } + } + } - if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, + /* apply rotation */ + if ( combinedOrientationEnabled ) + { + tmpRotBuffer = sbaInput->base.inputBuffer; + tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + + /* copy input for in-place rotation */ + mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, #ifdef SPLIT_REND_WITH_HEAD_ROT - sbaInput->rot_gains_prev[0], + sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif - tmpRotBuffer ) ) != IVAS_ERR_OK ) + tmpRotBuffer ) ) != IVAS_ERR_OK ) + + { + return error; + } + copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); + free( tmpRotBuffer.data ); + } + else { - return error; + copyBufferTo2dArray( sbaInput->base.inputBuffer, tmpCrendBuffer ); } - copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); - free( tmpRotBuffer.data ); /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, -#ifdef SPLIT_REND_WITH_HEAD_ROT - p_tmpCrendBuffer, -#else - tmpCrendBuffer, -#endif - *sbaInput->base.ctx.pOutSampleRate + NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -7456,6 +7475,7 @@ static ivas_error renderSbaToBinaural( { return error; } + accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); } -- GitLab From 19ccc7cfd5fb0770a55c670770fc008179b7bb2e Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 17 Jul 2023 09:06:24 +0530 Subject: [PATCH 395/591] Minor fix --- lib_dec/ivas_binRenderer_internal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 837f2a4d4f..408976a63b 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1219,7 +1219,7 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + for ( j = 0; j < 9; j++ ) { free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] ); ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] = NULL; @@ -1252,7 +1252,7 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + for ( j = 0; j < 4; j++ ) { free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] ); ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] = NULL; -- GitLab From dc492454551ba38a5a465e1be12752ed18ab3ab3 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 17 Jul 2023 15:21:02 +1000 Subject: [PATCH 396/591] moving renderer override flag setting outside debugging switch for external renderer --- lib_com/ivas_cnst.h | 2 -- lib_rend/ivas_render_config.c | 7 ++++-- lib_rend/ivas_stat_rend.h | 6 ++++- lib_rend/lib_rend.c | 43 ++++++++++++++++++++++++++--------- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 1a2b36151b..a6f37fe286 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -117,14 +117,12 @@ typedef enum } AUDIO_CONFIG; -#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering typedef enum { RENDER_TYPE_OVERRIDE_NONE, RENDER_TYPE_OVERRIDE_CREND, RENDER_TYPE_OVERRIDE_FASTCONV } ivas_renderTypeOverride; -#endif /*----------------------------------------------------------------------------------* * IVAS rendering configurations diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 8579794141..9bd86138e1 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -106,8 +106,11 @@ ivas_error ivas_render_config_init_from_rom( { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } - -#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering +#ifndef SPLIT_REND_WITH_HEAD_ROT +#ifdef DEBUGGING + ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; +#endif +#else ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; #endif ( *hRenderConfig )->roomAcoustics.override = FALSE; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 616c67f58f..2be636d76a 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -539,7 +539,11 @@ typedef struct ivas_roomAcoustics_t typedef struct ivas_render_config_t { -#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering +#ifndef SPLIT_REND_WITH_HEAD_ROT +#ifdef DEBUGGING + ivas_renderTypeOverride renderer_type_override; +#endif +#else ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ac8461c13c..1a427c44a1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2667,7 +2667,6 @@ static ivas_error updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { -#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT /* TODO: redundant nested switch SPLIT_REND_WITH_HEAD_ROT */ if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -2682,7 +2681,6 @@ static ivas_error updateSbaPanGains( } else -#endif { assert( ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural crend mode is currently supported with 48k sampling rate only" ); error = ivas_rend_openMultiBinCrend( &inputSba->crendWrapper, inConfig, outConfig, @@ -2697,7 +2695,7 @@ static ivas_error updateSbaPanGains( } #endif case IVAS_REND_AUDIO_CONFIG_BINAURAL: -#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -4583,13 +4581,11 @@ ivas_error IVAS_REND_GetDelay( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL ) { -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) if ( hIvasRend->hRendererConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; } else -#endif { latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; } @@ -4903,7 +4899,22 @@ int16_t IVAS_REND_GetRenderConfig( } hRCin = hIvasRend->hRendererConfig; -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifndef SPLIT_REND_WITH_HEAD_ROT +#ifdef DEBUGGING + switch ( hRCin->renderer_type_override ) + { + case RENDER_TYPE_OVERRIDE_CREND: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; + break; + case RENDER_TYPE_OVERRIDE_FASTCONV: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; + break; + default: + hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; + break; + } +#endif +#else switch ( hRCin->renderer_type_override ) { case RENDER_TYPE_OVERRIDE_CREND: @@ -4961,8 +4972,19 @@ int16_t IVAS_REND_FeedRenderConfig( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } hRenderConfig = hIvasRend->hRendererConfig; - -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifndef SPLIT_REND_WITH_HEAD_ROT +#ifdef DEBUGGING + hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; + if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) + { + hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_FASTCONV; + } + if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) + { + hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; + } +#endif +#else hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -4973,6 +4995,7 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; } #endif + hRenderConfig->roomAcoustics.override = renderConfig.room_acoustics.override; hRenderConfig->roomAcoustics.nBands = renderConfig.room_acoustics.nBands; hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.room_acoustics.acousticPreDelay; @@ -7357,7 +7380,6 @@ static ivas_error renderSbaToSplitBinaural( push_wmops( "renderSbaToSplitBinaural" ); error = IVAS_ERR_OK; -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { @@ -7368,7 +7390,6 @@ static ivas_error renderSbaToSplitBinaural( accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } else -#endif { renderSbaToMultiBinaural( sbaInput, @@ -7399,7 +7420,7 @@ static ivas_error renderSbaToBinaural( push_wmops( "renderSbaToBinaural" ); -#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT +#ifdef SPLIT_REND_WITH_HEAD_ROT if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -- GitLab From 11b4e9e69173a28230d1b4fe63dfd96061a30a3d Mon Sep 17 00:00:00 2001 From: Simon Plain Date: Mon, 17 Jul 2023 11:19:50 +0200 Subject: [PATCH 397/591] Cosmetic changes --- lib_com/cnst.h | 2 ++ lib_com/ivas_cnst.h | 8 ++++++++ lib_dec/ivas_mc_paramupmix_dec.c | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index e1362b0d75..a93a2a890e 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -2237,11 +2237,13 @@ enum VOIP_RTPDUMP }; +#ifndef JBM_PARAMUPMIX typedef enum _COV_SMOOTHING_TYPE { COV_SMOOTH_SPAR, COV_SMOOTH_MC } COV_SMOOTHING_TYPE; +#endif /* clang-format on */ #endif /* CNST_H */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 60807f62cb..aa75d3261e 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1332,6 +1332,14 @@ typedef enum #define MC_PARAMUPMIX_NCH 2 /* number of channels to combine into 1 */ #define MC_PARAMUPMIX_MIN_CLDFB 8 +#ifdef JBM_PARAMUPMIX +typedef enum _COV_SMOOTHING_TYPE +{ + COV_SMOOTH_SPAR, + COV_SMOOTH_MC +} COV_SMOOTHING_TYPE; +#endif + typedef struct { const int32_t *value; const uint16_t *length; diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 3307356964..9ae580ae3a 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -478,16 +478,16 @@ ivas_error ivas_mc_paramupmix_dec_open( ivas_td_decorr_dec_open( &( hMCParamUpmix->hTdDecorr[i] ), output_Fs, 2, 1 ); } +#ifdef JBM_PARAMUPMIX for ( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ ) { - if ( ( hMCParamUpmix->pcm_delay[i] = (float *) malloc( 240 * sizeof( float ) ) ) == NULL ) + if ( ( hMCParamUpmix->pcm_delay[i] = (float *) malloc( NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for delay buffer\n" ) ); } - set_zero( hMCParamUpmix->pcm_delay[i], 240 ); + set_zero( hMCParamUpmix->pcm_delay[i], NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) ); } -#ifdef JBM_PARAMUPMIX /* allocate transport channels*/ hMCParamUpmix->free_param_interpolator = 0; hMCParamUpmix->param_interpolator = NULL; -- GitLab From e3c654ed354720a85e814c21b1d9d578722e478e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 17 Jul 2023 15:01:02 +0200 Subject: [PATCH 398/591] [fix] 0DOF with LCLD codec was unsupported resulting in sanitizer errors --- lib_rend/lib_rend.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1a427c44a1..e60268e8a8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7175,6 +7175,7 @@ static ivas_error renderSplitBinauralWithPostRot( /*copy pose correction after MD is parsed*/ hSplitBin->multiBinPoseData.poseCorrectionMode = bits.pose_correction; + /* decode audio */ if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) @@ -7201,7 +7202,31 @@ static ivas_error renderSplitBinauralWithPostRot( copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); } - if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + /* apply pose correction if enabled */ + if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE && isPostRendInputCldfb ) + { + /* 0DOF with LCLD codec requires CLDFB synthesis */ + int16_t ch_idx, slot_idx; + + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + float *RealBuffer[CLDFB_NO_COL_MAX]; + float *ImagBuffer[CLDFB_NO_COL_MAX]; + + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; + } + + cldfbSynthesis( RealBuffer, + ImagBuffer, + &( tmpCrendBuffer[ch_idx][0] ), + hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, + hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); + } + } + else if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { ivas_rend_CldfbSplitPostRendProcess( hSplitBin->hBinHrSplitPostRend, -- GitLab From eaeb63310e9d8e1d3d7acc26b686cb87033ae91c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Jul 2023 17:31:23 +0200 Subject: [PATCH 399/591] add --selection_be_md5_file parameter --- tests/codec_be_on_mr_selection/__init__.py | 28 +++++++++++++++------- tests/conftest.py | 11 +++++++++ tests/testconfig.py | 2 ++ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/tests/codec_be_on_mr_selection/__init__.py b/tests/codec_be_on_mr_selection/__init__.py index 34a307a739..9adfe47b44 100644 --- a/tests/codec_be_on_mr_selection/__init__.py +++ b/tests/codec_be_on_mr_selection/__init__.py @@ -35,6 +35,7 @@ import filecmp from pathlib import Path import subprocess from .constants import OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT, DTX_ON, FER_5PERC +from ..testconfig import MD5_REF_DICT HERE = Path(__file__).parent # set environment variables in CI job @@ -98,8 +99,20 @@ def apply_error_pattern_on_bitstream( subprocess.run(cmd) -def files_equal(dut_file, ref_file): - return filecmp.cmp(dut_file, ref_file) +def is_be_to_ref(dut_file): + """ + Check bitexactness either by comparing files directly or by comparing MD5 sums + """ + if MD5_REF_DICT == dict(): + ref_file = REF_PATH.joinpath(dut_file.name) + is_be = filecmp.cmp(dut_file, ref_file) + else: + md5_ref = MD5_REF_DICT[dut_file.name] + cmd = f"powershell.exe (Get-FileHash {str(dut_file)} -Algorithm MD5).Hash" + md5_dut = subprocess.check_output(cmd, shell=True).decode().splitlines()[-1] + is_be = md5_ref == md5_dut + + return is_be def run_check( @@ -147,9 +160,8 @@ def run_check( add_option_list=options + [str(f) for f in metadata], ) - ref_bitstream = REF_PATH.joinpath(dut_bitstream.name) - if not is_ref_creation and not files_equal(dut_bitstream, ref_bitstream): - pytest.fail("Bitstream file differs from reference") + if not is_be_to_ref(dut_bitstream): + pytest.fail(f"Bitstream file differs from reference") dut_bitstream_to_decoder = dut_bitstream if error_pattern is not None: @@ -168,12 +180,10 @@ def run_check( # this should not be a problem as both the reference and the tdut output was generated by the codec, so # diverging headers should also indicate a problem - still, keep in mind if something bogus happens if not is_ref_creation: - ref_output = REF_PATH.joinpath(dut_output.name) - if not files_equal(dut_output, ref_output): + if not is_be_to_ref(dut_output): pytest.fail("Decoder output differs from reference") for md in metadata: md_suffix = "".join(md.suffixes) dut_md = DUT_PATH.joinpath(dut_output.with_suffix(md_suffix).name) - ref_md = REF_PATH.joinpath(dut_output.with_suffix(md_suffix).name) - if not files_equal(dut_md, ref_md): + if not is_be_to_ref(dut_md): pytest.fail("Metadata file {md.name} differs from reference") diff --git a/tests/conftest.py b/tests/conftest.py index 12b62caccd..365245e6f3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -133,6 +133,13 @@ def pytest_addoption(parser): " Use --keep_files to prevent these deletions.", ) + parser.addoption( + "--selection_be_md5_file", + type=Path, + default=Path(), + help="Path to file with md5 sums for the reference signals of the selection-BE test" + ) + @pytest.fixture(scope="session", autouse=True) def update_ref(request): @@ -513,3 +520,7 @@ def pytest_configure(config): ) if config.option.param_file: testconfig.PARAM_FILE = config.option.param_file + if config.option.selection_be_md5_file: + md5_file_path = config.option.selection_be_md5_file + with open(md5_file_path) as f: + testconfig.MD5_REF_DICT = {line.split()[0]: line.split()[1] for line in f.readlines()} \ No newline at end of file diff --git a/tests/testconfig.py b/tests/testconfig.py index 12d170ba8d..1dbfbb8403 100644 --- a/tests/testconfig.py +++ b/tests/testconfig.py @@ -35,3 +35,5 @@ To configure test modules. """ PARAM_FILE = "scripts/config/self_test.prm" + +MD5_REF_DICT = dict() \ No newline at end of file -- GitLab From 768916189f3cbab6da53c2f86aafc60565794ace Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Jul 2023 17:51:14 +0200 Subject: [PATCH 400/591] re-use keep_files flag in selection-BE test --- tests/codec_be_on_mr_selection/__init__.py | 6 ++++++ tests/codec_be_on_mr_selection/test_experiments.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tests/codec_be_on_mr_selection/__init__.py b/tests/codec_be_on_mr_selection/__init__.py index 9adfe47b44..b7f4cd8efe 100644 --- a/tests/codec_be_on_mr_selection/__init__.py +++ b/tests/codec_be_on_mr_selection/__init__.py @@ -126,6 +126,7 @@ def run_check( decoder_frontend, is_ref_creation, input_file_num=None, + keep_files=True, ): sampling_rate = 48 output_mode, options = OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT[experiment] @@ -182,8 +183,13 @@ def run_check( if not is_ref_creation: if not is_be_to_ref(dut_output): pytest.fail("Decoder output differs from reference") + elif not keep_files: + os.remove(dut_output) + os.remove(dut_bitstream) for md in metadata: md_suffix = "".join(md.suffixes) dut_md = DUT_PATH.joinpath(dut_output.with_suffix(md_suffix).name) if not is_be_to_ref(dut_md): pytest.fail("Metadata file {md.name} differs from reference") + elif not keep_files: + os.remove(dut_md) diff --git a/tests/codec_be_on_mr_selection/test_experiments.py b/tests/codec_be_on_mr_selection/test_experiments.py index a0a4aa780a..5b2f516893 100644 --- a/tests/codec_be_on_mr_selection/test_experiments.py +++ b/tests/codec_be_on_mr_selection/test_experiments.py @@ -52,6 +52,7 @@ def test_p800( dut_encoder_frontend, dut_decoder_frontend, update_ref, + keep_files, ): run_check( experiment, @@ -63,6 +64,7 @@ def test_p800( dut_encoder_frontend, dut_decoder_frontend, update_ref == 1, + keep_files=keep_files, ) @@ -79,6 +81,7 @@ def test_bs1534_no_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref, + keep_files, ): category = "" run_check( @@ -92,6 +95,7 @@ def test_bs1534_no_masa( dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, + keep_files=keep_files, ) @@ -111,6 +115,7 @@ def test_bs1534_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref, + keep_files, ): run_check( experiment, @@ -123,4 +128,5 @@ def test_bs1534_masa( dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, + keep_files=keep_files, ) -- GitLab From 73a5cdb7f24dd03e30185a53535317080a0b8496 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 18 Jul 2023 07:31:20 +0300 Subject: [PATCH 401/591] correct normalization of energy ratios at 384k MASA --- lib_com/options.h | 2 +- lib_dec/ivas_qmetadata_dec.c | 58 +++++++++++++++++++++++++++++++- lib_enc/ivas_qmetadata_enc.c | 65 ++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1fe1bb999c..8fc5b39ac9 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,7 @@ /* ##################### End NON-BE CR switches ########################### */ - +#define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 9e2d01f4dd..7dd2b540d7 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -908,6 +908,60 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } if ( hQMetaData->no_directions == 2 ) { +#ifdef NONBE_FIX_539_MASA_384K_CHIRP + float ratioSum; + if ( bits_sph_idx == 16 ) + { + for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) + { + for ( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = 1.0f - diffuseness_reconstructions_hr[hQMetaData->q_direction[1].band_data[b].energy_ratio_index[m]]; + + /* Scale energy ratios that sum to over one */ + ratioSum = hQMetaData->q_direction[0].band_data[b].energy_ratio[m] + hQMetaData->q_direction[1].band_data[b].energy_ratio[m]; + + if ( ratioSum > 1.0f ) + { + hQMetaData->q_direction[0].band_data[b].energy_ratio[m] /= ratioSum; + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] /= ratioSum; + } + } + } + } + else + { + int16_t pos_2dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; + d = 0; + for ( b = hQMetaData->q_direction[0].cfg.start_band; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + if ( hQMetaData->twoDirBands[b] == 1 ) + { + pos_2dir_band[d] = b; + d++; + } + else + { + pos_2dir_band[d] = 0; + } + } + for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) + { + for ( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = 1.0f - diffuseness_reconstructions_hr[hQMetaData->q_direction[1].band_data[b].energy_ratio_index[m]]; + + ratioSum = hQMetaData->q_direction[0].band_data[pos_2dir_band[b]].energy_ratio[m] + hQMetaData->q_direction[1].band_data[b].energy_ratio[m]; + + if ( ratioSum > 1.0f ) + { + hQMetaData->q_direction[0].band_data[pos_2dir_band[b]].energy_ratio[m] /= ratioSum; + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] /= ratioSum; + } + } + } + } +#else #ifdef FIX_566_2DIR_MASA_384K float ratioSum; for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) @@ -938,6 +992,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } +#endif #endif } @@ -1085,7 +1140,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } - +#ifndef NONBE_FIX_539_MASA_384K_CHIRP /* Scale energy ratios that sum to over one */ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { @@ -1101,6 +1156,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } +#endif } #ifdef DEBUG_MODE_QMETADATA diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 3355db5b66..75492b4f9a 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -1552,6 +1552,70 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( if ( hQMetaData->no_directions == 2 ) { +#ifdef NONBE_FIX_539_MASA_384K_CHIRP + float ratioSum; + if ( bits_dir_hr == 16 ) + { + for ( j = hQMetaData->q_direction[1].cfg.start_band; j < hQMetaData->q_direction[1].cfg.nbands; j++ ) + { + for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) + { + index = masa_sq( 1.0f - hQMetaData->q_direction[1].band_data[j].energy_ratio[k], diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); + push_next_indice( hMetaData, index, MASA_BITS_ER_HR ); + hQMetaData->q_direction[1].band_data[j].energy_ratio_index[k] = index; + hQMetaData->q_direction[1].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index]; + + ratioSum = hQMetaData->q_direction[0].band_data[j].energy_ratio[k] + hQMetaData->q_direction[1].band_data[j].energy_ratio[k]; + if ( ratioSum > 1.0f ) + { + hQMetaData->q_direction[0].band_data[j].energy_ratio[k] /= ratioSum; + hQMetaData->q_direction[1].band_data[j].energy_ratio[k] /= ratioSum; + } + + needed_bits[1] += MASA_BITS_ER_HR; + hQMetaData->q_direction[1].band_data[j].bits_sph_idx[k] = bits_dir_hr; + } + } + } + else + { + int16_t pos_2dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; + k = 0; + for ( j = hQMetaData->q_direction[0].cfg.start_band; j < hQMetaData->q_direction[0].cfg.nbands; j++ ) + { + if ( hQMetaData->twoDirBands[j] == 1 ) + { + pos_2dir_band[k] = j; + k++; + } + else + { + pos_2dir_band[k] = 0; + } + } + for ( j = hQMetaData->q_direction[1].cfg.start_band; j < hQMetaData->q_direction[1].cfg.nbands; j++ ) + { + for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) + { + index = masa_sq( 1.0f - hQMetaData->q_direction[1].band_data[j].energy_ratio[k], diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); + push_next_indice( hMetaData, index, MASA_BITS_ER_HR ); + hQMetaData->q_direction[1].band_data[j].energy_ratio_index[k] = index; + hQMetaData->q_direction[1].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index]; + + ratioSum = hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio[k] + hQMetaData->q_direction[1].band_data[j].energy_ratio[k]; + + if ( ratioSum > 1.0f ) + { + hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio[k] /= ratioSum; + hQMetaData->q_direction[1].band_data[j].energy_ratio[k] /= ratioSum; + } + + needed_bits[1] += MASA_BITS_ER_HR; + hQMetaData->q_direction[1].band_data[j].bits_sph_idx[k] = bits_dir_hr; + } + } + } +#else #ifdef FIX_566_2DIR_MASA_384K float ratioSum; #endif @@ -1580,6 +1644,7 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( hQMetaData->q_direction[1].band_data[j].bits_sph_idx[k] = bits_dir_hr; } } +#endif } return; -- GitLab From 7fa50dbe71cdb2164be3d6e14294b6d383323888 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 18 Jul 2023 08:31:09 +0300 Subject: [PATCH 402/591] fix formatting --- lib_dec/ivas_qmetadata_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 7dd2b540d7..ba31d0e09c 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -908,7 +908,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } if ( hQMetaData->no_directions == 2 ) { -#ifdef NONBE_FIX_539_MASA_384K_CHIRP +#ifdef NONBE_FIX_539_MASA_384K_CHIRP float ratioSum; if ( bits_sph_idx == 16 ) { -- GitLab From bffb501ff7827de7f0f46e35e1e6631ddd943ab3 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 18 Jul 2023 09:21:03 +0300 Subject: [PATCH 403/591] fix formatting 2 --- lib_dec/ivas_qmetadata_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index ba31d0e09c..c87b027572 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1140,7 +1140,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } -#ifndef NONBE_FIX_539_MASA_384K_CHIRP +#ifndef NONBE_FIX_539_MASA_384K_CHIRP /* Scale energy ratios that sum to over one */ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { -- GitLab From 14fbca632728cdede852e3996a2643c2a3a99fcb Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 18 Jul 2023 08:33:45 +0200 Subject: [PATCH 404/591] set exit value based on test success - fail job if selection-BE test failed --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c04e5359bf..5c5931cfee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1323,6 +1323,8 @@ upload-selection-BE-log: script: - cp -r $SELECTION_BE_RESULT ./selection-BE-result - Get-Content -Path selection-BE-result/public_log--sha-*.txt + - $has_failed = (Select-String -Path selection-BE-result/public_log--sha-*.txt -Pattern '^FAILED tests' -CaseSensitive).Line + - If($has_failed) {exit -1} artifacts: paths: - selection-BE-result/public_log--sha-*.txt -- GitLab From a5656a0f35461c27629d2fa441de6c2d8f9d27f4 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 18 Jul 2023 08:53:23 +0200 Subject: [PATCH 405/591] Add explicit type cast and correct to round instead of floor operation --- lib_rend/lib_rend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c0df231b7d..c4518a259d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4675,7 +4675,7 @@ static ivas_error renderIsmToBinaural( push_wmops( "renderIsmToBinaural" ); #ifdef FIX_488_SYNC_DELAY /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ - ism_md_subframe_update_ext = floor( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer ); @@ -4856,7 +4856,7 @@ static ivas_error renderIsmToBinauralReverb( #ifdef FIX_488_SYNC_DELAY /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ - ism_md_subframe_update_ext = floor( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); -- GitLab From 224ac6ffc27d69f43947e51170510937afe78faf Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 18 Jul 2023 10:17:47 +0200 Subject: [PATCH 406/591] move switch --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8fc5b39ac9..165b060d5b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,6 +170,7 @@ #define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ +#define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ /* ################## End BE DEVELOPMENT switches ######################### */ @@ -180,7 +181,6 @@ /* ##################### End NON-BE CR switches ########################### */ -#define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ /* clang-format on */ #endif -- GitLab From 1c2839543a29af0b1330d3600cb09d77429daa3c Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 18 Jul 2023 11:43:40 +0200 Subject: [PATCH 407/591] remove default for MD5 file to fix other tests --- tests/conftest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 365245e6f3..2540d7f065 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -136,7 +136,6 @@ def pytest_addoption(parser): parser.addoption( "--selection_be_md5_file", type=Path, - default=Path(), help="Path to file with md5 sums for the reference signals of the selection-BE test" ) @@ -523,4 +522,4 @@ def pytest_configure(config): if config.option.selection_be_md5_file: md5_file_path = config.option.selection_be_md5_file with open(md5_file_path) as f: - testconfig.MD5_REF_DICT = {line.split()[0]: line.split()[1] for line in f.readlines()} \ No newline at end of file + testconfig.MD5_REF_DICT = {line.split()[0]: line.split()[1] for line in f.readlines()} -- GitLab From 4125b4e2278bd2213b3b76404b44feb2b3265238 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Tue, 18 Jul 2023 15:39:43 +0530 Subject: [PATCH 408/591] added changes for HRIR and BRIR --- lib_com/ivas_prot.h | 1 + lib_dec/ivas_binRenderer_internal.c | 277 +++++++++++++++++++++++++--- lib_rend/ivas_stat_rend.h | 30 ++- lib_util/hrtf_file_reader.c | 129 +++++++++---- 4 files changed, 367 insertions(+), 70 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9b6c592ee7..b888ab42e2 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5153,6 +5153,7 @@ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i : fastconv HRTF handle */ AUDIO_CONFIG output_config, /* i : ouput audio config */ BINAURAL_INPUT_AUDIO_CONFIG output_config_bin /* i : binaural input audio config */ + , RENDERER_TYPE renderer_type ); #endif diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 408976a63b..a93a315d53 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -394,11 +394,12 @@ static ivas_error ivas_binRenderer_convModuleOpen( ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, AUDIO_CONFIG output_config, - BINAURAL_INPUT_AUDIO_CONFIG output_config_bin ) + BINAURAL_INPUT_AUDIO_CONFIG input_config, + RENDERER_TYPE renderer_type ) { int16_t i, j; /*malloc for HOA3, HOA2, FOA*/ - if ( output_config == AUDIO_CONFIG_HOA3 || output_config_bin == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) + if ( output_config == AUDIO_CONFIG_HOA3 || input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { if ( ( HrtfFastConv->leftHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3 != NULL ) ) { @@ -462,7 +463,7 @@ ivas_error ivas_allocate_binaural_hrtf( } } } - else if ( output_config == AUDIO_CONFIG_HOA2 || output_config_bin == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) + else if ( output_config == AUDIO_CONFIG_HOA2 || input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { if ( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) { @@ -526,7 +527,7 @@ ivas_error ivas_allocate_binaural_hrtf( } } } - else if ( output_config == AUDIO_CONFIG_FOA || output_config_bin == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) + else if ( output_config == AUDIO_CONFIG_FOA || input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { if ( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) { @@ -590,6 +591,134 @@ ivas_error ivas_allocate_binaural_hrtf( } } } + if ( renderer_type == RENDERER_BINAURAL_FASTCONV || input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + if ( ( HrtfFastConv->leftHRIRReal != NULL ) && ( HrtfFastConv->leftHRIRImag != NULL ) && ( HrtfFastConv->rightHRIRReal != NULL ) && ( HrtfFastConv->rightHRIRImag != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( ( HrtfFastConv->leftHRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); + } + if ( ( HrtfFastConv->leftHRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); + } + if ( ( HrtfFastConv->rightHRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); + } + if ( ( HrtfFastConv->rightHRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftHRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); + } + if ( ( HrtfFastConv->leftHRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); + } + if ( ( HrtfFastConv->rightHRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + } + if ( ( HrtfFastConv->rightHRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + } + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + if ( ( HrtfFastConv->leftHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); + } + if ( ( HrtfFastConv->leftHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); + } + if ( ( HrtfFastConv->rightHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); + } + if ( ( HrtfFastConv->rightHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + } + } + } + } + } + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } + } + } return IVAS_ERR_OK; } #endif @@ -604,7 +733,8 @@ static ivas_error ivas_binaural_hrtf_open( HRTFS_FASTCONV_HANDLE *hHrtfFastConv #ifdef FIX_1720_HRTF_FASTCONV , - AUDIO_CONFIG output_config + AUDIO_CONFIG output_config, + RENDERER_TYPE renderer_type #endif ) { @@ -627,21 +757,27 @@ static ivas_error ivas_binaural_hrtf_open( #ifdef FIX_1720_HRTF_FASTCONV memset( HrtfFastConv, 0x00, sizeof( HRTFS_FASTCONV ) ); - HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; + if ( output_config == AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; + } if ( output_config == AUDIO_CONFIG_HOA2 ) { HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; } - else if ( output_config == AUDIO_CONFIG_HOA3 ) + if ( output_config == AUDIO_CONFIG_HOA3 ) { HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; } - else if ( output_config == AUDIO_CONFIG_FOA ) + if ( output_config == AUDIO_CONFIG_FOA ) { HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; } - HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; - ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, 0 ); + if ( output_config == AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; + } + ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, HrtfFastConv->input_cfg_var, renderer_type ); #else HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; @@ -651,20 +787,28 @@ static ivas_error ivas_binaural_hrtf_open( #endif for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) +#ifdef FIX_1720_HRTF_FASTCONV + if ( renderer_type == RENDERER_BINAURAL_FASTCONV ) { - mvr2r( leftHRIRReal[i][j], HrtfFastConv->leftHRIRReal[i][j], BINAURAL_NTAPS ); - mvr2r( leftHRIRImag[i][j], HrtfFastConv->leftHRIRImag[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRReal[i][j], HrtfFastConv->rightHRIRReal[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRImag[i][j], HrtfFastConv->rightHRIRImag[i][j], BINAURAL_NTAPS ); - - mvr2r( leftBRIRReal[i][j], HrtfFastConv->leftBRIRReal[i][j], BINAURAL_NTAPS_MAX ); - mvr2r( leftBRIRImag[i][j], HrtfFastConv->leftBRIRImag[i][j], BINAURAL_NTAPS_MAX ); - mvr2r( rightBRIRReal[i][j], HrtfFastConv->rightBRIRReal[i][j], BINAURAL_NTAPS_MAX ); - mvr2r( rightBRIRImag[i][j], HrtfFastConv->rightBRIRImag[i][j], BINAURAL_NTAPS_MAX ); + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + mvr2r( leftHRIRReal[i][j], HrtfFastConv->leftHRIRReal[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRImag[i][j], HrtfFastConv->leftHRIRImag[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRReal[i][j], HrtfFastConv->rightHRIRReal[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRImag[i][j], HrtfFastConv->rightHRIRImag[i][j], BINAURAL_NTAPS ); + } + } + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + mvr2r( leftBRIRReal[i][j], HrtfFastConv->leftBRIRReal[i][j], BINAURAL_NTAPS_MAX ); + mvr2r( leftBRIRImag[i][j], HrtfFastConv->leftBRIRImag[i][j], BINAURAL_NTAPS_MAX ); + mvr2r( rightBRIRReal[i][j], HrtfFastConv->rightBRIRReal[i][j], BINAURAL_NTAPS_MAX ); + mvr2r( rightBRIRImag[i][j], HrtfFastConv->rightBRIRImag[i][j], BINAURAL_NTAPS_MAX ); + } } -#ifdef FIX_1720_HRTF_FASTCONV if ( output_config == AUDIO_CONFIG_HOA3 ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) @@ -675,9 +819,8 @@ static ivas_error ivas_binaural_hrtf_open( mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); } } - else if ( output_config == AUDIO_CONFIG_HOA2 ) + if ( output_config == AUDIO_CONFIG_HOA2 ) { - for ( j = 0; j < 9; j++ ) { mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); @@ -686,7 +829,7 @@ static ivas_error ivas_binaural_hrtf_open( mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); } } - else if ( output_config == AUDIO_CONFIG_FOA ) + if ( output_config == AUDIO_CONFIG_FOA ) { for ( j = 0; j < 4; j++ ) @@ -698,6 +841,19 @@ static ivas_error ivas_binaural_hrtf_open( } } #else + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + mvr2r( leftHRIRReal[i][j], HrtfFastConv->leftHRIRReal[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRImag[i][j], HrtfFastConv->leftHRIRImag[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRReal[i][j], HrtfFastConv->rightHRIRReal[i][j], BINAURAL_NTAPS ); + mvr2r( rightHRIRImag[i][j], HrtfFastConv->rightHRIRImag[i][j], BINAURAL_NTAPS ); + + + mvr2r( leftBRIRReal[i][j], HrtfFastConv->leftBRIRReal[i][j], BINAURAL_NTAPS_MAX ); + mvr2r( leftBRIRImag[i][j], HrtfFastConv->leftBRIRImag[i][j], BINAURAL_NTAPS_MAX ); + mvr2r( rightBRIRReal[i][j], HrtfFastConv->rightBRIRReal[i][j], BINAURAL_NTAPS_MAX ); + mvr2r( rightBRIRImag[i][j], HrtfFastConv->rightBRIRImag[i][j], BINAURAL_NTAPS_MAX ); + } for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) { mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); @@ -918,7 +1074,7 @@ ivas_error ivas_binRenderer_open( /* Load HRTF tables */ #ifdef FIX_1720_HRTF_FASTCONV - ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config ); + ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ); #else ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv ); #endif @@ -1182,6 +1338,72 @@ void ivas_binaural_hrtf_close( { return; } + if ( ( *hHrtfFastConv )->leftHRIRReal != NULL && ( *hHrtfFastConv )->leftHRIRImag != NULL && ( *hHrtfFastConv )->rightHRIRReal != NULL && ( *hHrtfFastConv )->rightHRIRImag != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag[i][j] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal[i] ); + ( *hHrtfFastConv )->leftHRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag[i] ); + ( *hHrtfFastConv )->leftHRIRImag[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal[i] ); + ( *hHrtfFastConv )->rightHRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag[i] ); + ( *hHrtfFastConv )->rightHRIRImag[i] = NULL; + } + free( ( *hHrtfFastConv )->leftHRIRReal ); + ( *hHrtfFastConv )->leftHRIRReal = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag ); + ( *hHrtfFastConv )->leftHRIRImag = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal ); + ( *hHrtfFastConv )->rightHRIRReal = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag ); + ( *hHrtfFastConv )->rightHRIRImag = NULL; + } + if ( ( *hHrtfFastConv )->leftBRIRReal != NULL && ( *hHrtfFastConv )->leftBRIRImag != NULL && ( *hHrtfFastConv )->rightBRIRReal != NULL && ( *hHrtfFastConv )->rightBRIRImag != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftBRIRReal[i][j] ); + ( *hHrtfFastConv )->leftBRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag[i][j] ); + ( *hHrtfFastConv )->leftBRIRImag[i][j] = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal[i][j] ); + ( *hHrtfFastConv )->rightBRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag[i][j] ); + ( *hHrtfFastConv )->rightBRIRImag[i][j] = NULL; + } + free( ( *hHrtfFastConv )->leftBRIRReal[i] ); + ( *hHrtfFastConv )->leftBRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag[i] ); + ( *hHrtfFastConv )->leftBRIRImag[i] = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal[i] ); + ( *hHrtfFastConv )->rightBRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag[i] ); + ( *hHrtfFastConv )->rightBRIRImag[i] = NULL; + } + free( ( *hHrtfFastConv )->leftBRIRReal ); + ( *hHrtfFastConv )->leftBRIRReal = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag ); + ( *hHrtfFastConv )->leftBRIRImag = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal ); + ( *hHrtfFastConv )->rightBRIRReal = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag ); + ( *hHrtfFastConv )->rightBRIRImag = NULL; + } if ( ( *hHrtfFastConv )->leftHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA3 != NULL ) { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) @@ -1215,7 +1437,7 @@ void ivas_binaural_hrtf_close( free( ( *hHrtfFastConv )->rightHRIRImag_HOA3 ); ( *hHrtfFastConv )->rightHRIRImag_HOA3 = NULL; } - else if ( ( *hHrtfFastConv )->leftHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA2 != NULL ) + if ( ( *hHrtfFastConv )->leftHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA2 != NULL ) { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { @@ -1248,7 +1470,7 @@ void ivas_binaural_hrtf_close( free( ( *hHrtfFastConv )->rightHRIRImag_HOA2 ); ( *hHrtfFastConv )->rightHRIRImag_HOA2 = NULL; } - else if ( ( *hHrtfFastConv )->leftHRIRReal_FOA != NULL && ( *hHrtfFastConv )->leftHRIRImag_FOA != NULL && ( *hHrtfFastConv )->rightHRIRReal_FOA != NULL && ( *hHrtfFastConv )->rightHRIRImag_FOA != NULL ) + if ( ( *hHrtfFastConv )->leftHRIRReal_FOA != NULL && ( *hHrtfFastConv )->leftHRIRImag_FOA != NULL && ( *hHrtfFastConv )->rightHRIRReal_FOA != NULL && ( *hHrtfFastConv )->rightHRIRImag_FOA != NULL ) { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { @@ -1281,7 +1503,6 @@ void ivas_binaural_hrtf_close( free( ( *hHrtfFastConv )->rightHRIRImag_FOA ); ( *hHrtfFastConv )->rightHRIRImag_FOA = NULL; } - return; } #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 47e541a00e..487b65dd75 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -758,15 +758,20 @@ typedef struct ivas_hrtfs_crend_structure typedef struct ivas_hrtfs_fastconv_struct { float FASTCONV_HRIR_latency_s; - float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; - float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; - float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; - float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; - float FASTCONV_HOA3_latency_s; float FASTCONV_HOA2_latency_s; float FASTCONV_FOA_latency_s; #ifdef FIX_1720_HRTF_FASTCONV + float ***leftHRIRReal; + float ***leftHRIRImag; + float ***rightHRIRReal; + float ***rightHRIRImag; + + float ***leftBRIRReal; + float ***leftBRIRImag; + float ***rightBRIRReal; + float ***rightBRIRImag; + float ***leftHRIRReal_HOA3; float ***leftHRIRImag_HOA3; float ***rightHRIRReal_HOA3; @@ -781,6 +786,9 @@ typedef struct ivas_hrtfs_fastconv_struct float ***leftHRIRImag_FOA; float ***rightHRIRReal_FOA; float ***rightHRIRImag_FOA; + + BINAURAL_INPUT_AUDIO_CONFIG input_cfg_var; + #else float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; @@ -796,13 +804,21 @@ typedef struct ivas_hrtfs_fastconv_struct float leftHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float rightHRIRReal_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; float rightHRIRImag_FOA[BINAURAL_CONVBANDS][4][BINAURAL_NTAPS]; -#endif - float FASTCONV_BRIR_latency_s; + float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; + float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; + float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; + float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; + float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; +#endif + + float FASTCONV_BRIR_latency_s; + + float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 3e078c96f5..73fd4856bc 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1000,7 +1000,6 @@ static ivas_error init_fastconv_HRTF_handle( } } - hHrtf->FASTCONV_BRIR_latency_s = 0; for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { @@ -1030,7 +1029,8 @@ static ivas_error create_fastconv_HRTF_from_rawdata( int16_t i, j; char *hrtf_data_rptr; #ifdef FIX_1720_HRTF_FASTCONV - ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg ); + ( *hHRTF )->input_cfg_var = input_cfg; + ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type ); #endif // if ( hHRTF == NULL ) @@ -1124,7 +1124,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); } hrtf_data_rptr += sizeof( uint16_t ); - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) @@ -1163,8 +1162,8 @@ static ivas_error create_fastconv_HRTF_from_rawdata( /* HRIR_HOA2 */ ( *hHRTF )->FASTCONV_HOA2_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); - - if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) +#ifdef FIX_1720_HRTF_FASTCONV + if ( 9 != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); } @@ -1178,11 +1177,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 9; j++ ) -#else - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1190,11 +1185,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 9; j++ ) -#else - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1202,11 +1193,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 9; j++ ) -#else - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1214,24 +1201,66 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 9; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } #else + if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); } } +#endif } else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { /* HRIR_FOA */ ( *hHRTF )->FASTCONV_FOA_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); - - if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) +#ifdef FIX_1720_HRTF_FASTCONV + if ( 4 != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); } @@ -1245,11 +1274,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 4; j++ ) -#else - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1257,11 +1282,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 4; j++ ) -#else - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1269,11 +1290,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 4; j++ ) -#else - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); @@ -1281,16 +1298,58 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -#ifdef FIX_1720_HRTF_FASTCONV for ( j = 0; j < 4; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } #else + if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) -#endif { memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); } } +#endif } /* BRIR */ else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) -- GitLab From fb1bd5b05d82b55e866c30124ad7ffd7e8a37e53 Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 18 Jul 2023 14:49:02 +0200 Subject: [PATCH 409/591] add check for windows when using MD5 comparison --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 2540d7f065..ecca54374a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -521,5 +521,7 @@ def pytest_configure(config): testconfig.PARAM_FILE = config.option.param_file if config.option.selection_be_md5_file: md5_file_path = config.option.selection_be_md5_file + if not platform.system == "Windows": + raise NotImplementedError("MD5 comparison is currently hardcoded for windows") with open(md5_file_path) as f: testconfig.MD5_REF_DICT = {line.split()[0]: line.split()[1] for line in f.readlines()} -- GitLab From 0481f7fb36942e247d68b7f2aba9d47238aa85ef Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 18 Jul 2023 15:31:43 +0200 Subject: [PATCH 410/591] fix ubsan error in sns_avq_dec --- lib_com/options.h | 1 + lib_dec/ivas_sns_dec.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 57154a5247..43b9197066 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_582_INDEX_OUT_OF_BOUNDS_SNS_AVQ_DEC /* FhG: fix an undefined behaviour error in SNS AVQ decoding */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_sns_dec.c b/lib_dec/ivas_sns_dec.c index e11551d2a6..adcfe88186 100644 --- a/lib_dec/ivas_sns_dec.c +++ b/lib_dec/ivas_sns_dec.c @@ -161,7 +161,11 @@ void sns_avq_dec( { for ( i = 0; i < M; i++ ) { +#ifdef FIX_582_INDEX_OUT_OF_BOUNDS_SNS_AVQ_DEC + SNS_Q[0][i] = SNS_Q[1][i]; +#else SNS_Q[0][i] = SNS_Q[0][M + i]; +#endif } sns_2st_dec( SNS_Q[0], index ); } -- GitLab From a836b4e8e3a7f30a3ec7986561c3b527f4f516ed Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 18 Jul 2023 16:03:55 +0200 Subject: [PATCH 411/591] fix issue 613 by moving hSpar member access under guardian condition. switch FIX_613_DIRAC_NULL_PTR_USAN --- lib_com/ivas_dirac_com.c | 16 ++++++++++++++++ lib_com/options.h | 1 + 2 files changed, 17 insertions(+) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 20f4b24953..504aea5d6c 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -111,12 +111,20 @@ ivas_error ivas_dirac_config( if ( ( (Encoder_Struct *) st_ivas )->hSpar != NULL ) { hFbMdft = ( (Encoder_Struct *) st_ivas )->hSpar->hFbMixer; +#ifdef FIX_613_DIRAC_NULL_PTR_USAN + dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; +#endif } else { hFbMdft = NULL; +#ifdef FIX_613_DIRAC_NULL_PTR_USAN + dirac_to_spar_md_bands = NULL; +#endif } +#ifndef FIX_613_DIRAC_NULL_PTR_USAN dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; +#endif } else { @@ -131,13 +139,21 @@ ivas_error ivas_dirac_config( if ( ( (Decoder_Struct *) st_ivas )->hSpar != NULL ) { hFbMdft = ( (Decoder_Struct *) st_ivas )->hSpar->hFbMixer; +#ifdef FIX_613_DIRAC_NULL_PTR_USAN + dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; +#endif } else { hFbMdft = NULL; +#ifdef FIX_613_DIRAC_NULL_PTR_USAN + dirac_to_spar_md_bands = NULL; +#endif } ( (Decoder_Struct *) st_ivas )->hDirAC->hFbMdft = hFbMdft; +#ifndef FIX_613_DIRAC_NULL_PTR_USAN dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; +#endif } if ( ivas_format == SBA_FORMAT ) diff --git a/lib_com/options.h b/lib_com/options.h index 57154a5247..df23d4fa6a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_613_DIRAC_NULL_PTR_USAN /* Nokia: Issue #613: USAN in DirAC decoder setup */ /* ################## End BE DEVELOPMENT switches ######################### */ -- GitLab From dd1035f3d617190f9939892350f6c333fe7ff553 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 19 Jul 2023 10:48:36 +1000 Subject: [PATCH 412/591] fix for failing MC smoke tests --- lib_dec/ivas_output_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index d25c51da20..abc9a9012d 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -228,7 +228,7 @@ void ivas_renderer_select( *internal_config = transport_config; #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) #else if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif /* SPLIT_REND_WITH_HEAD_ROT */ -- GitLab From 865d7f6e524bdba36656648adee54faa654529ff Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 19 Jul 2023 10:42:25 +0200 Subject: [PATCH 413/591] add fix for usan error in dirac setup --- lib_com/options.h | 1 + lib_dec/ivas_dirac_dec.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c7204c05fa..21e81f33ad 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,6 +176,7 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_614_ADD_TO_NULL_PTR_DIRAC_SETUP /* FhG: Issue 614: prevent adding to a null pointer in dirac setup code */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index f3ea6912f3..03443a2196 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2374,7 +2374,11 @@ void ivas_dirac_dec_render_sf( reference_power = DirAC_mem.reference_power; reference_power_smooth = DirAC_mem.reference_power + hDirAC->num_freq_bands; onset_filter = DirAC_mem.onset_filter; +#ifdef FIX_614_ADD_TO_NULL_PTR_DIRAC_SETUP + onset_filter_subframe = ( DirAC_mem.onset_filter == NULL ) ? NULL : DirAC_mem.onset_filter + hDirAC->num_freq_bands; +#else onset_filter_subframe = DirAC_mem.onset_filter + hDirAC->num_freq_bands; +#endif hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); -- GitLab From b0e79d25b5da2457445753e6c57e2afae53307c4 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Wed, 19 Jul 2023 15:51:20 +0530 Subject: [PATCH 414/591] ASAN fix --- lib_dec/ivas_binRenderer_internal.c | 95 ++++++++++++++--------------- lib_rend/ivas_hrtf.c | 7 ++- lib_util/hrtf_file_reader.c | 18 +----- 3 files changed, 55 insertions(+), 65 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 067751e0f8..95e61f0475 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -436,37 +436,37 @@ ivas_error ivas_allocate_binaural_hrtf( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - if ( ( HrtfFastConv->leftHRIRReal_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRReal_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); } - if ( ( HrtfFastConv->leftHRIRImag_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRImag_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); } - if ( ( HrtfFastConv->rightHRIRReal_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRReal_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); } - if ( ( HrtfFastConv->rightHRIRImag_HOA3[i] = (float **) malloc( HRTF_SH_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRImag_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); } - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + for ( j = 0; j < HOA3_CHANNELS; j++ ) { - if ( ( HrtfFastConv->leftHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); } - if ( ( HrtfFastConv->leftHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); } - if ( ( HrtfFastConv->rightHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); } - if ( ( HrtfFastConv->rightHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); } @@ -474,7 +474,7 @@ ivas_error ivas_allocate_binaural_hrtf( } } } - else if ( output_config == AUDIO_CONFIG_HOA2 || input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) + if ( output_config == AUDIO_CONFIG_HOA2 || input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { if ( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) { @@ -500,37 +500,37 @@ ivas_error ivas_allocate_binaural_hrtf( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - if ( ( HrtfFastConv->leftHRIRReal_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRReal_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); } - if ( ( HrtfFastConv->leftHRIRImag_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRImag_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); } - if ( ( HrtfFastConv->rightHRIRReal_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRReal_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); } - if ( ( HrtfFastConv->rightHRIRImag_HOA2[i] = (float **) malloc( 9 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRImag_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); } - for ( j = 0; j < 9; j++ ) + for ( j = 0; j < HOA2_CHANNELS; j++ ) { - if ( ( HrtfFastConv->leftHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); } - if ( ( HrtfFastConv->leftHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); } - if ( ( HrtfFastConv->rightHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); } - if ( ( HrtfFastConv->rightHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); } @@ -538,7 +538,7 @@ ivas_error ivas_allocate_binaural_hrtf( } } } - else if ( output_config == AUDIO_CONFIG_FOA || input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) + if ( output_config == AUDIO_CONFIG_FOA || input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { if ( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) { @@ -564,37 +564,37 @@ ivas_error ivas_allocate_binaural_hrtf( } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - if ( ( HrtfFastConv->leftHRIRReal_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRReal_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); } - if ( ( HrtfFastConv->leftHRIRImag_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRImag_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); } - if ( ( HrtfFastConv->rightHRIRReal_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRReal_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); } - if ( ( HrtfFastConv->rightHRIRImag_FOA[i] = (float **) malloc( 4 * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRImag_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); } - for ( j = 0; j < 4; j++ ) + for ( j = 0; j < FOA_CHANNELS; j++ ) { - if ( ( HrtfFastConv->leftHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); } - if ( ( HrtfFastConv->leftHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); } - if ( ( HrtfFastConv->rightHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); } - if ( ( HrtfFastConv->rightHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); } @@ -822,33 +822,32 @@ static ivas_error ivas_binaural_hrtf_open( } if ( output_config == AUDIO_CONFIG_HOA3 ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + for ( j = 0; j < HOA3_CHANNELS; j++ ) { - mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); - mvr2r( leftHRIRImag_HOA3[i][j], HrtfFastConv->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRReal_HOA3[i][j], HrtfFastConv->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( leftHRIRImag_HOA3[i][j], HrtfFastConv->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRReal_HOA3[i][j], HrtfFastConv->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); } } if ( output_config == AUDIO_CONFIG_HOA2 ) { - for ( j = 0; j < 9; j++ ) + for ( j = 0; j < HOA2_CHANNELS; j++ ) { - mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); - mvr2r( leftHRIRImag_HOA2[i][j], HrtfFastConv->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRReal_HOA2[i][j], HrtfFastConv->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( leftHRIRImag_HOA2[i][j], HrtfFastConv->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRReal_HOA2[i][j], HrtfFastConv->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); } } if ( output_config == AUDIO_CONFIG_FOA ) { - - for ( j = 0; j < 4; j++ ) + for ( j = 0; j < FOA_CHANNELS; j++ ) { - mvr2r( leftHRIRReal_FOA[i][j], HrtfFastConv->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS ); - mvr2r( leftHRIRImag_FOA[i][j], HrtfFastConv->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS ); + mvr2r( leftHRIRReal_FOA[i][j], HrtfFastConv->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( leftHRIRImag_FOA[i][j], HrtfFastConv->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); + mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); } } #else @@ -1451,7 +1450,7 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + for ( j = 0; j < HOA3_CHANNELS; j++ ) { free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] ); ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] = NULL; @@ -1484,7 +1483,7 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < 9; j++ ) + for ( j = 0; j < HOA2_CHANNELS; j++ ) { free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] ); ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] = NULL; @@ -1517,7 +1516,7 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < 4; j++ ) + for ( j = 0; j < FOA_CHANNELS; j++ ) { free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] ); ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] = NULL; diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 136873668b..926491c8fb 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -36,6 +36,9 @@ #include "ivas_prot_rend.h" #include "ivas_error.h" #include "wmc_auto.h" +#ifdef FIX_1720_HRTF_FASTCONV +#include +#endif /*-----------------------------------------------------------------------* * ivas_HRTF_binary_open() @@ -139,7 +142,9 @@ ivas_error ivas_HRTF_fastconv_binary_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FASTCONV HRTF tables!" ); } - +#ifdef FIX_1720_HRTF_FASTCONV + memset( *hHrtfFastConv, 0x00, sizeof( HRTFS_FASTCONV ) ); +#endif return IVAS_ERR_OK; } diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 44f3151f97..183b278bfc 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1231,12 +1231,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( /* HRIR_HOA2 */ ( *hHRTF )->FASTCONV_HOA2_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); -#ifdef FIX_1720_HRTF_FASTCONV - if ( 9 != *( (uint16_t *) ( hrtf_data_rptr ) ) ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); - } - hrtf_data_rptr += sizeof( uint16_t ); #ifdef UPDATE_FASTCONV_SBA_FILTER if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1323,19 +1317,12 @@ static ivas_error create_fastconv_HRTF_from_rawdata( #endif } } -#endif } else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { /* HRIR_FOA */ ( *hHRTF )->FASTCONV_FOA_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); -#ifdef FIX_1720_HRTF_FASTCONV - if ( 4 != *( (uint16_t *) ( hrtf_data_rptr ) ) ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); - } - hrtf_data_rptr += sizeof( uint16_t ); #ifdef UPDATE_FASTCONV_SBA_FILTER if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1422,7 +1409,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( #endif } } -#endif } /* BRIR */ else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) @@ -1535,9 +1521,9 @@ ivas_error load_fastconv_HRTF_from_binary( } /* Read & load */ - +#ifndef FIX_1720_HRTF_FASTCONV memset( hHrtfFastConv, 0x00, sizeof( HRTFS_FASTCONV ) ); - +#endif for ( hrtf_id = 0; hrtf_id < hrtfs_file_header.nb_hrtf; hrtf_id++ ) { if ( read_hrtf_binary_header( &hrtf_header, f_hrtf ) != IVAS_ERR_OK ) -- GitLab From eab440236673e415a9fe0d9f74543820150d888a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 19 Jul 2023 12:50:12 +0200 Subject: [PATCH 415/591] [ci] enable split rendering BE comparison test for pipeline --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91e6b506b3..216c9815dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -531,7 +531,7 @@ split-rendering-smoke-test: # compare split-rendering bitexactness between target and source branch # TODO activate after MR !818 is merged ( https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/merge_requests/818 ) -.split-rendering-pytest-on-merge-request: +split-rendering-pytest-on-merge-request: extends: - .test-job-linux - .rules-merge-request -- GitLab From 0c72c504186a5aeb1e496e7b40c9ffbc78d3f154 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 19 Jul 2023 12:52:35 +0200 Subject: [PATCH 416/591] [ci-skip] remove TODO comment in .gitlab-ci.yml --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 216c9815dd..57de2467ec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -530,8 +530,7 @@ split-rendering-smoke-test: - report-junit.xml # compare split-rendering bitexactness between target and source branch -# TODO activate after MR !818 is merged ( https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/merge_requests/818 ) -split-rendering-pytest-on-merge-request: +.split-rendering-pytest-on-merge-request: extends: - .test-job-linux - .rules-merge-request -- GitLab From c2b4b7838517f06b52a0d3851616151b330965fc Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 19 Jul 2023 12:56:12 +0200 Subject: [PATCH 417/591] accidental disabling of job with last change --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57de2467ec..760f908abd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -530,7 +530,7 @@ split-rendering-smoke-test: - report-junit.xml # compare split-rendering bitexactness between target and source branch -.split-rendering-pytest-on-merge-request: +split-rendering-pytest-on-merge-request: extends: - .test-job-linux - .rules-merge-request -- GitLab From 0c5f9f0331c4e44c65a1c246a429322d8d0dcd7b Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 19 Jul 2023 13:37:47 +0200 Subject: [PATCH 418/591] fix usan error by adding extra val in enum --- lib_com/ivas_cnst.h | 5 +++++ lib_com/options.h | 2 ++ lib_dec/ivas_mdct_core_dec.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4080485f60..0c84499778 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -887,7 +887,12 @@ enum fea_names #define MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE 3 typedef enum { +#ifdef FIX_619_ADD_UNDEF_VAL_FOR_CONCEALMENT_MODE + NOISE_GEN_MODE_UNDEF = -1, + EQUAL_CORES = 0, +#else EQUAL_CORES, +#endif TCX10_IN_0_TCX20_IN_1, TCX20_IN_0_TCX10_IN_1, } TONALMDCTCONC_NOISE_GEN_MODE; diff --git a/lib_com/options.h b/lib_com/options.h index b02e63cd1e..a06afa8838 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -194,6 +194,8 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ +#define FIX_619_ADD_UNDEF_VAL_FOR_CONCEALMENT_MODE /* FhG: fix usan error */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index deb6294066..f201decee1 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -526,7 +526,11 @@ void ivas_mdct_core_invQ( sts = hCPE->hCoreCoder; bfi = sts[0]->bfi; +#ifdef FIX_619_ADD_UNDEF_VAL_FOR_CONCEALMENT_MODE + noise_gen_mode_bfi = NOISE_GEN_MODE_UNDEF; +#else noise_gen_mode_bfi = -1; +#endif set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); set_s( total_nbbits, 0, CPE_CHANNELS ); -- GitLab From 104e551b4249ff979a9d4a2e9936c27ceb336666 Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 19 Jul 2023 15:21:13 +0200 Subject: [PATCH 419/591] fix usan error --- lib_com/ifft_rel.c | 4 ++++ lib_com/options.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lib_com/ifft_rel.c b/lib_com/ifft_rel.c index fc267a7a10..44272cecce 100644 --- a/lib_com/ifft_rel.c +++ b/lib_com/ifft_rel.c @@ -229,7 +229,11 @@ void ifft_rel( *-----------------------------------------------------------------*/ idx = fft256_read_indexes; +#ifdef FIX_622_SILENCE_USAN_WARNING + xi0 = &temp[0] - 1; +#else xi0 = temp - 1; +#endif if ( n == 128 ) { for ( i = 0; i < n; i++ ) diff --git a/lib_com/options.h b/lib_com/options.h index b02e63cd1e..15db8559fb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -194,6 +194,8 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ +#define FIX_622_SILENCE_USAN_WARNING /* FhG: silenceusan warning in ifft code */ + /* ################## End BE DEVELOPMENT switches ######################### */ -- GitLab From 1fe9c21c7b2222a7063c0ade3571c8491b18ea48 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 15:45:15 +0200 Subject: [PATCH 420/591] replaced << with BASOPs shl() funtion. to calm UBSAN down --- lib_com/lsf_tools.c | 26 ++++++- lib_com/options.h | 2 + lib_enc/lsf_msvq_ma_enc.c | 151 +++++++++++++++++++++----------------- 3 files changed, 108 insertions(+), 71 deletions(-) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 2f22dafa61..fcabcf54b4 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -245,7 +245,7 @@ void isp2a( *-----------------------------------------------------------------*/ get_isppol( &isp[0], f1, nc ); - get_isppol( &isp[1], f2, (int16_t) ( nc - 1 ) ); + get_isppol( &isp[1], f2, ( int16_t )( nc - 1 ) ); /*-----------------------------------------------------------------* * Multiply F2(z) by (1 - z^-2) * @@ -2072,7 +2072,25 @@ void dec_FDCNG_MSVQ_stage1( for ( col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++ ) { +#ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT +#if 0 + + if ( cbpW8[col] <= -127 && dct_col_shift_tab[col]==4 ) + { + float tmp_old = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); /*ANSI-C does not support left shift of negative numbers */ + float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[col] ) << dct_col_shift_tab[col] ) ); /* cast to unsigned, shift, cast back */ + float tmp_new2 = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); /* use the BASOP shl() function */ + float tmp_new3 = (float) ( ((Word16)cbpW8[col]) * ( (Word16)1U << dct_col_shift_tab[col] ) ); /* simulate BASOP shl(), by using integer multiplication */ + + + printf( "\n Syn: cbpW8=%03d, shift=%d, old=%6.0f, new1=%6.0f, new2=%6.0f new3=%6.0f ", cbpW8[col], dct_col_shift_tab[col], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); + tmp_old = tmp_new1; + } +#endif + dct_vec[col] = (float) shl((Word16) cbpW8[col] , dct_col_shift_tab[col] ); +#else dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); +#endif /* LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); in BASOP: s_and(for W8->W16), shl(), sub() */ @@ -2161,7 +2179,7 @@ void msvq_dec( FOR( j = 0; j < n; ++j ) { move16(); - uq_ind[start + j] = add( uq_ind[start + j], (Word16) ( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); + uq_ind[start + j] = add( uq_ind[start + j], ( Word16 )( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); } } #undef WMC_TOOL_SKIP @@ -2428,7 +2446,7 @@ void a2isf( spec2isf( RealOut, ImagOut, 128, isf, old_isf ); - isf[lpcOrder - 1] = (Float32) ( acos( a[lpcOrder] ) * SCALE1_HALF ); + isf[lpcOrder - 1] = ( Float32 )( acos( a[lpcOrder] ) * SCALE1_HALF ); return; } @@ -2611,7 +2629,7 @@ void create_IDCT_N_Matrix( for ( c = 0; c < mat_cpy_size; c++ ) { - idx = (Word16) ( idx_ptr[c] ); + idx = ( Word16 )( idx_ptr[c] ); W16_val = absval_ptr[abs( idx )]; if ( idx < 0 ) diff --git a/lib_com/options.h b/lib_com/options.h index ad3554576e..7cb73b1e02 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,6 +176,8 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_612_MSVQ_UBSAN_LEFTSHIFT /* Eri: Issue 612 : UBSAN: left shift of negative values in 1st stage of MSVQ */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 349fb4f60f..fc1893f405 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -148,7 +148,24 @@ int16_t msvq_stage1_dct_search( for ( c2 = 0; c2 < cols_per_segment[segm]; c2++ ) { #define WMC_TOOL_SKIP +#ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT +#if 0 + if ( cbpW8[c2] <= -127 && dct_col_shift_tab[c2]==4 ) + { + float tmp_old = (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* UBSAN:: ANSI-C does not support left shift of negative numbers */ + float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[c2] ) << dct_col_shift_tab[c2] ) ); /* cast to unsigned ans see happens */ + float tmp_new2 = (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* use the BASOP shl() function */ + float tmp_new3 = (float) ( ((Word16)cbpW8[c2]) * ((Word16)1U << dct_col_shift_tab[c2] ) ); /* simulate BASOP shl(), by using integer multiplication */ + + printf( "\n Search: cbpW8=%03d,shift=%d old=%6.0f, new1=%6.0f new2=%6.0f new3=%6.0f ", cbpW8[c2], dct_col_shift_tab[c2], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); + tmp_old = tmp_new1; + } +#endif + tmp = dct_target[c2] - (float) shl((Word16)cbpW8[c2], dct_col_shift_tab[c2]); /* note: BASOP shift left defined for signed integers */ + +#else tmp = dct_target[c2] - (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* Word8 storage MSE inner loop */ +#endif LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ @@ -453,36 +470,85 @@ void msvq_enc( else /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ + { + /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ + /* dist[0][0] */ + for ( j = 0; j < levels[s]; j++ ) { - /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) + { + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; + } + cbp += maxn; /* pointer is incremented */ + + pTmp = &resid[0][0]; + /* Tmp */ + tmp = ( *pTmp++ ) * Tmp[0]; + for ( c2 = 1; c2 < N; c2++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) + tmp += ( *pTmp++ ) * Tmp[c2]; + } + tmp = en - 2.0f * tmp; + tmp += dist[0][0]; + if ( tmp < dist[1][p_max] ) + { + /* Replace worst */ + dist[1][p_max] = tmp; + indices[1][p_max * stages] = j; + parents[p_max] = 0; + + p_max = 0; + for ( c2 = 1; c2 < maxC; c2++ ) { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; + if ( dist[1][c2] > dist[1][p_max] ) + { + p_max = c2; + } } - cbp += maxn; /* pointer is incremented */ + } /* if (tmp <= dist[1][p_max]) */ + } /* for (j=0; j dist[1][p_max] ) - { - p_max = c2; - } - } - } /* if (tmp <= dist[1][p_max]) */ - } /* for(c=0; c Date: Wed, 19 Jul 2023 16:33:20 +0200 Subject: [PATCH 421/591] cleanup of debug code and clang-format application --- lib_com/lsf_tools.c | 28 ++----- lib_enc/lsf_msvq_ma_enc.c | 151 +++++++++++++++++--------------------- 2 files changed, 76 insertions(+), 103 deletions(-) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index fcabcf54b4..1a2d018cdd 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -245,7 +245,7 @@ void isp2a( *-----------------------------------------------------------------*/ get_isppol( &isp[0], f1, nc ); - get_isppol( &isp[1], f2, ( int16_t )( nc - 1 ) ); + get_isppol( &isp[1], f2, (int16_t) ( nc - 1 ) ); /*-----------------------------------------------------------------* * Multiply F2(z) by (1 - z^-2) * @@ -2073,26 +2073,12 @@ void dec_FDCNG_MSVQ_stage1( for ( col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++ ) { #ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT -#if 0 - - if ( cbpW8[col] <= -127 && dct_col_shift_tab[col]==4 ) - { - float tmp_old = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); /*ANSI-C does not support left shift of negative numbers */ - float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[col] ) << dct_col_shift_tab[col] ) ); /* cast to unsigned, shift, cast back */ - float tmp_new2 = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); /* use the BASOP shl() function */ - float tmp_new3 = (float) ( ((Word16)cbpW8[col]) * ( (Word16)1U << dct_col_shift_tab[col] ) ); /* simulate BASOP shl(), by using integer multiplication */ - - - printf( "\n Syn: cbpW8=%03d, shift=%d, old=%6.0f, new1=%6.0f, new2=%6.0f new3=%6.0f ", cbpW8[col], dct_col_shift_tab[col], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); - tmp_old = tmp_new1; - } -#endif - dct_vec[col] = (float) shl((Word16) cbpW8[col] , dct_col_shift_tab[col] ); + dct_vec[col] = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); #else dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); #endif - /* LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); - in BASOP: s_and(for W8->W16), shl(), sub() + /* LOGIC( 1 ) , SHIFT( 1 ); + in BASOP: s_and(for W8->W16), shl() */ } dctT2_N_apply_matrix( (const float *) dct_vec, idct_vec, cdk1_ivas_cols_per_segment[segm_ind], n, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, idcttype ); @@ -2179,7 +2165,7 @@ void msvq_dec( FOR( j = 0; j < n; ++j ) { move16(); - uq_ind[start + j] = add( uq_ind[start + j], ( Word16 )( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); + uq_ind[start + j] = add( uq_ind[start + j], (Word16) ( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); } } #undef WMC_TOOL_SKIP @@ -2446,7 +2432,7 @@ void a2isf( spec2isf( RealOut, ImagOut, 128, isf, old_isf ); - isf[lpcOrder - 1] = ( Float32 )( acos( a[lpcOrder] ) * SCALE1_HALF ); + isf[lpcOrder - 1] = (Float32) ( acos( a[lpcOrder] ) * SCALE1_HALF ); return; } @@ -2629,7 +2615,7 @@ void create_IDCT_N_Matrix( for ( c = 0; c < mat_cpy_size; c++ ) { - idx = ( Word16 )( idx_ptr[c] ); + idx = (Word16) ( idx_ptr[c] ); W16_val = absval_ptr[abs( idx )]; if ( idx < 0 ) diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index fc1893f405..abd03ca899 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -149,23 +149,10 @@ int16_t msvq_stage1_dct_search( { #define WMC_TOOL_SKIP #ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT -#if 0 - if ( cbpW8[c2] <= -127 && dct_col_shift_tab[c2]==4 ) - { - float tmp_old = (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* UBSAN:: ANSI-C does not support left shift of negative numbers */ - float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[c2] ) << dct_col_shift_tab[c2] ) ); /* cast to unsigned ans see happens */ - float tmp_new2 = (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* use the BASOP shl() function */ - float tmp_new3 = (float) ( ((Word16)cbpW8[c2]) * ((Word16)1U << dct_col_shift_tab[c2] ) ); /* simulate BASOP shl(), by using integer multiplication */ - - printf( "\n Search: cbpW8=%03d,shift=%d old=%6.0f, new1=%6.0f new2=%6.0f new3=%6.0f ", cbpW8[c2], dct_col_shift_tab[c2], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); - tmp_old = tmp_new1; - } -#endif - tmp = dct_target[c2] - (float) shl((Word16)cbpW8[c2], dct_col_shift_tab[c2]); /* note: BASOP shift left defined for signed integers */ - + tmp = dct_target[c2] - (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* note: BASOP shift left defined for signed integers */ #else tmp = dct_target[c2] - (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* Word8 storage MSE inner loop */ -#endif +#endif LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ @@ -470,85 +457,36 @@ void msvq_enc( else /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ - { - /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) - { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; - } - cbp += maxn; /* pointer is incremented */ - - pTmp = &resid[0][0]; - /* Tmp */ - tmp = ( *pTmp++ ) * Tmp[0]; - for ( c2 = 1; c2 < N; c2++ ) - { - tmp += ( *pTmp++ ) * Tmp[c2]; - } - tmp = en - 2.0f * tmp; - tmp += dist[0][0]; - if ( tmp < dist[1][p_max] ) + /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ + /* dist[0][0] */ + for ( j = 0; j < levels[s]; j++ ) { - /* Replace worst */ - dist[1][p_max] = tmp; - indices[1][p_max * stages] = j; - parents[p_max] = 0; - - p_max = 0; - for ( c2 = 1; c2 < maxC; c2++ ) + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) { - if ( dist[1][c2] > dist[1][p_max] ) - { - p_max = c2; - } + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; } - } /* if (tmp <= dist[1][p_max]) */ - } /* for (j=0; j dist[1][p_max] ) + { + p_max = c2; + } + } + } /* if (tmp <= dist[1][p_max]) */ + } /* for(c=0; c Date: Wed, 19 Jul 2023 17:03:36 +0200 Subject: [PATCH 422/591] added fix for #621, UBSAN complaint of offset addition to NULL ptr --- lib_com/options.h | 2 +- lib_enc/lsf_msvq_ma_enc.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2448a84269..6c541be09a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,7 +184,7 @@ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ #define FIX_612_MSVQ_UBSAN_LEFTSHIFT /* Eri: Issue 612 : UBSAN: left shift of negative values in 1st stage of MSVQ */ - +#define FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET /* Eri: Issue 621 : UBSAN: applying non-zero offset 7200 to null pointer in lsf_msvq_ma_enc.c */ /* Fixes for bugs found during split rendering contribution development */ #define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index abd03ca899..a91928c048 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -559,7 +559,14 @@ void msvq_enc( { /* Subtract codebook entry from residual vector of parent node */ p1 = resid[0] + parents[c] * N; +#ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET + if (cb_stage != NULL ) + { + p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ + } +#else p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ +#endif if ( s == 0 && applyDCT_flag != 0 ) { p2 = (const float *) &( st1_syn_vec_ptr[c * FDCNG_VQ_MAX_LEN] ); /*ptr init of stage 1 */ -- GitLab From 40b51fdf5e76fd4a5a5ece1426602abd0305a2a2 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 17:14:34 +0200 Subject: [PATCH 423/591] MSVQ compile time warning for p2 initilization fixed --- lib_enc/lsf_msvq_ma_enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index a91928c048..c229d5bc4a 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -560,6 +560,7 @@ void msvq_enc( /* Subtract codebook entry from residual vector of parent node */ p1 = resid[0] + parents[c] * N; #ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET + p2 = NULL; if (cb_stage != NULL ) { p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ -- GitLab From fcfdadfa560bf39a545527c2e26d5b88c89fc80c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 19 Jul 2023 17:47:12 +0200 Subject: [PATCH 424/591] fix for issue 194: introduce a delay buffer for LFE to binaural rendering --- lib_com/options.h | 1 + lib_rend/lib_rend.c | 115 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b02e63cd1e..a0d5d2aa1b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -183,6 +183,7 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_194_LFE_DELAY_EXTREND /* FhG: Issue 194: Fix delay alignment of LFE in external renderer */ /* Fixes for bugs found during split rendering contribution development */ #define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e60268e8a8..c565e34b68 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -185,6 +185,10 @@ typedef struct lfe_routing lfeRouting; #ifdef REND_STATIC_MEM_OPT float *bufferData; +#endif +#ifdef FIX_194_LFE_DELAY_EXTREND + int16_t binauralDelaySmp; + float *lfeDelayBuffer; #endif MCMASA_ANA_HANDLE hMcMasa; } input_mc; @@ -305,6 +309,30 @@ static void freeInputBaseBufferData( float **data ) } #endif +#ifdef FIX_194_LFE_DELAY_EXTREND +static ivas_error allocateMcLfeDelayBuffer( float **lfeDelayBuffer, const int16_t data_size ) +{ + *lfeDelayBuffer = (float *) malloc( data_size * sizeof( float ) ); + if ( *lfeDelayBuffer == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for LFE delay buffer" ); + } + + return IVAS_ERR_OK; +} + +static void freeMcLfeDelayBuffer( float **lfeDelayBuffer ) +{ + if ( *lfeDelayBuffer != NULL ) + { + free( *lfeDelayBuffer ); + *lfeDelayBuffer = NULL; + } + + return; +} +#endif + static IVAS_QUATERNION quaternionInit( void ) { @@ -2174,6 +2202,9 @@ static ivas_error initMcBinauralRendering( ivas_error error; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; +#endif +#ifdef FIX_194_LFE_DELAY_EXTREND + int32_t binauralDelayNs; #endif int32_t outSampleRate; @@ -2292,6 +2323,15 @@ static ivas_error initMcBinauralRendering( } } +#ifdef FIX_194_LFE_DELAY_EXTREND + /* determine binaural delay ( used for aligning LFE to output signal ) */ + binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, + ( &inputMc->tdRendWrapper != NULL ) ? inputMc->tdRendWrapper.binaural_latency_ns : 0 ); + inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); + + assert( ( inputMc->binauralDelaySmp < L_FRAME48k >> 2 ) && "Invalid delay for LFE binaural rendering!" ); + +#endif /* FIX_194_LFE_DELAY_EXTREND */ return IVAS_ERR_OK; } @@ -2408,6 +2448,13 @@ static ivas_error setRendInputActiveMc( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } +#ifdef FIX_194_LFE_DELAY_EXTREND + if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, L_FRAME48k >> 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + +#endif #ifdef REND_STATIC_MEM_OPT if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { @@ -2428,6 +2475,9 @@ static ivas_error setRendInputActiveMc( inputMc->hMcMasa = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); +#ifdef FIX_194_LFE_DELAY_EXTREND + set_zero( inputMc->lfeDelayBuffer, L_FRAME48k >> 2 ); +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) @@ -2472,6 +2522,9 @@ static void clearInputMc( rendCtx = inputMc->base.ctx; +#ifdef FIX_194_LFE_DELAY_EXTREND + freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); +#endif #ifdef REND_STATIC_MEM_OPT freeInputBaseBufferData( &inputMc->bufferData ); #endif @@ -6287,11 +6340,17 @@ static ivas_error renderLfeToBinaural( IVAS_REND_AudioBuffer outAudio ) { int16_t i; +#ifdef FIX_194_LFE_DELAY_EXTREND + int16_t ear_idx; +#endif int16_t lfe_idx; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pose_idx, num_poses; #endif float gain; +#ifdef FIX_194_LFE_DELAY_EXTREND + float *tmpLfeBuffer; +#endif float *readPtr, *writePtr; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6318,8 +6377,38 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } +#ifdef FIX_194_LFE_DELAY_EXTREND + /* Render LFE first to a temporary buffer to avoid applying gain multiple times */ + tmpLfeBuffer = malloc( mcInput->base.inputBuffer.config.numSamplesPerChannel * sizeof( float ) ); + if ( tmpLfeBuffer == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to allocate memory for temporary LFE to Binaural buffer" ); + } + + /* 1. read from the LFE delay buffer and acc. to temp buffer + 2. read remaining samples from the input LFE channel and acc. to temp buffer */ + readPtr = mcInput->lfeDelayBuffer; + writePtr = tmpLfeBuffer; + for ( i = 0; i < mcInput->binauralDelaySmp; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + for ( ; i < ( mcInput->base.inputBuffer.config.numSamplesPerChannel - mcInput->binauralDelaySmp ); i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + + /* save leftover samples in the LFE delay buffer for next frame */ + writePtr = mcInput->lfeDelayBuffer; + for ( i = 0; i < mcInput->binauralDelaySmp; i++ ) + { + *writePtr++ += gain * ( *readPtr++ ); + } + +#endif /* FIX_194_LFE_DELAY_EXTREND */ #ifdef SPLIT_REND_WITH_HEAD_ROT - /* Copy LFE to left and right binaural channels */ + /* Copy LFE to left and right binaural channels for all poses */ if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) { num_poses = mcInput->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; @@ -6331,6 +6420,14 @@ static ivas_error renderLfeToBinaural( for ( pose_idx = 0; pose_idx < num_poses; ++pose_idx ) { +#ifdef FIX_194_LFE_DELAY_EXTREND + for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) + { + mvr2r( tmpLfeBuffer, + getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS + ear_idx, 0 ), + mcInput->base.inputBuffer.config.numSamplesPerChannel ); + } +#else readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); writePtr = getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS, 0 ); for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) @@ -6344,9 +6441,18 @@ static ivas_error renderLfeToBinaural( { *writePtr++ += gain * ( *readPtr++ ); } +#endif /* FIX_194_LFE_DELAY_EXTREND */ } -#else /* SPLIT_REND_WITH_HEAD_ROT */ +#else /* SPLIT_REND_WITH_HEAD_ROT */ /* Copy LFE to left and right ears */ +#ifdef FIX_194_LFE_DELAY_EXTREND + for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) + { + mvr2r( tmpLfeBuffer, + getSmplPtr( outAudio, ear_idx, 0 ), + mcInput->base.inputBuffer.config.numSamplesPerChannel ); + } +#else readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); writePtr = getSmplPtr( outAudio, 0, 0 ); for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ ) @@ -6360,8 +6466,11 @@ static ivas_error renderLfeToBinaural( { *writePtr++ += gain * ( *readPtr++ ); } +#endif /* FIX_194_LFE_DELAY_EXTREND */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ - pop_wmops(); +#ifdef FIX_194_LFE_DELAY_EXTREND + free( tmpLfeBuffer ); +#endif /* FIX_194_LFE_DELAY_EXTREND */ return IVAS_ERR_OK; } -- GitLab From 60a1e33f48d2140966210a37425591d4b39509c5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 19 Jul 2023 17:50:05 +0200 Subject: [PATCH 425/591] [fix] accidentally removed pop_wmops() + whitespace --- lib_rend/lib_rend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c565e34b68..bb0d673f58 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -331,8 +331,8 @@ static void freeMcLfeDelayBuffer( float **lfeDelayBuffer ) return; } -#endif +#endif static IVAS_QUATERNION quaternionInit( void ) { @@ -6472,6 +6472,8 @@ static ivas_error renderLfeToBinaural( free( tmpLfeBuffer ); #endif /* FIX_194_LFE_DELAY_EXTREND */ + pop_wmops(); + return IVAS_ERR_OK; } -- GitLab From 34137c8040d4cd7a0754b71d7202a0ef376b2b4a Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 17:53:21 +0200 Subject: [PATCH 426/591] added editorial fix for issue #600 --- lib_com/options.h | 1 + lib_com/pvq_com.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 6c541be09a..62411edbdf 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,6 +185,7 @@ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ #define FIX_612_MSVQ_UBSAN_LEFTSHIFT /* Eri: Issue 612 : UBSAN: left shift of negative values in 1st stage of MSVQ */ #define FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET /* Eri: Issue 621 : UBSAN: applying non-zero offset 7200 to null pointer in lsf_msvq_ma_enc.c */ +#define FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION /* Eri: Issue 600 : removed manual WMCtool instrumentation outside of WMC_TOOL_SKIP defines */ /* Fixes for bugs found during split rendering contribution development */ #define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index 133b7b62f7..6e7121751b 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -200,7 +200,9 @@ static void dsDiracPerQuanta( if ( t_quanta_o > sv[nsv >> 1] ) { dsIndex = nsv - dsIndex; /*single op*/ +#ifndef FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION ADD( 1 ); +#endif } for ( i = frQuanta[0][td] - 1; i >= 0; i-- ) { -- GitLab From e2749cf7d6d7fa4e4edf6b39d073907c63a19565 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 19 Jul 2023 18:08:24 +0200 Subject: [PATCH 427/591] [fix] pointer not set to NULL causing MSAN errors --- lib_rend/lib_rend.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index bb0d673f58..9750087862 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3718,6 +3718,9 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; #ifdef REND_STATIC_MEM_OPT hIvasRend->inputsMc[i].bufferData = NULL; +#endif +#ifdef FIX_194_LFE_DELAY_EXTREND + hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; #endif hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; -- GitLab From 2a60a6d6019f1257811574db7bd5c625bb690590 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 18:11:59 +0200 Subject: [PATCH 428/591] clang format --- lib_com/lsf_tools.c | 2 +- lib_com/pvq_com.c | 4 ++-- lib_enc/lsf_msvq_ma_enc.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 1a2d018cdd..42688ee145 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2077,7 +2077,7 @@ void dec_FDCNG_MSVQ_stage1( #else dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); #endif - /* LOGIC( 1 ) , SHIFT( 1 ); + /* LOGIC( 1 ) , SHIFT( 1 ); in BASOP: s_and(for W8->W16), shl() */ } diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index 6e7121751b..d655dd7d4a 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -200,9 +200,9 @@ static void dsDiracPerQuanta( if ( t_quanta_o > sv[nsv >> 1] ) { dsIndex = nsv - dsIndex; /*single op*/ -#ifndef FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION +#ifndef FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION ADD( 1 ); -#endif +#endif } for ( i = frQuanta[0][td] - 1; i >= 0; i-- ) { diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index c229d5bc4a..cbc57a3b7b 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -559,15 +559,15 @@ void msvq_enc( { /* Subtract codebook entry from residual vector of parent node */ p1 = resid[0] + parents[c] * N; -#ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET +#ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET p2 = NULL; - if (cb_stage != NULL ) + if ( cb_stage != NULL ) { p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ } -#else - p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ -#endif +#else + p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ +#endif if ( s == 0 && applyDCT_flag != 0 ) { p2 = (const float *) &( st1_syn_vec_ptr[c * FDCNG_VQ_MAX_LEN] ); /*ptr init of stage 1 */ -- GitLab From bc9f98af82b7c6c6c084960d3c596c9f19922b0f Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 20 Jul 2023 11:33:40 +1000 Subject: [PATCH 429/591] fix for UBSAN issue 615 --- lib_com/ivas_spar_com.c | 4 ++++ lib_com/options.h | 1 + lib_enc/ivas_spar_encoder.c | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index ebc9c89466..1836d0cb4d 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1750,7 +1750,11 @@ void ivas_get_spar_md_from_dirac( { for ( band = start_band; band < end_band; band++ ) { +#ifdef FIX_615_UBSAN_SPAR_TO_DIRAC + ndm = hSpar_md_cfg->num_dmx_chans_per_band[band]; +#else ndm = hSpar_md_cfg->num_dmx_chans_per_band[band - 1]; +#endif /*SPAR from DirAC*/ set_f( response_avg, 0.0f, MAX_OUTPUT_CHANNELS ); diff --git a/lib_com/options.h b/lib_com/options.h index b02e63cd1e..629d6c175c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -194,6 +194,7 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ +#define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5f382c4719..7fdc8212ea 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -571,8 +571,11 @@ static ivas_error ivas_spar_enc_process( float Wscale_d[IVAS_MAX_NUM_BANDS]; int16_t d_start_band, d_end_band; int16_t dirac_band_idx; - +#ifdef FIX_615_UBSAN_SPAR_TO_DIRAC + d_start_band = SPAR_DIRAC_SPLIT_START_BAND; +#else d_start_band = hSpar->enc_param_start_band; +#endif d_end_band = IVAS_MAX_NUM_BANDS; for ( b = d_start_band; b < d_end_band; b++ ) -- GitLab From 8faab99acffba5a72493f61b5dadf4d2c8623cff Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 20 Jul 2023 12:34:33 +1000 Subject: [PATCH 430/591] fixing dirac start idx back to what it was --- lib_enc/ivas_spar_encoder.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 7fdc8212ea..5f382c4719 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -571,11 +571,8 @@ static ivas_error ivas_spar_enc_process( float Wscale_d[IVAS_MAX_NUM_BANDS]; int16_t d_start_band, d_end_band; int16_t dirac_band_idx; -#ifdef FIX_615_UBSAN_SPAR_TO_DIRAC - d_start_band = SPAR_DIRAC_SPLIT_START_BAND; -#else + d_start_band = hSpar->enc_param_start_band; -#endif d_end_band = IVAS_MAX_NUM_BANDS; for ( b = d_start_band; b < d_end_band; b++ ) -- GitLab From f28f44873430429f69e09581c825dc2603d4dc53 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 20 Jul 2023 15:26:23 +1000 Subject: [PATCH 431/591] merge issue fix in options.h --- lib_com/options.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 675ef76c62..9a0f6f3067 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,9 @@ #define FIX_570_SF_EXT_ORIENTATION #define FIX_593_STL_INCLUDE /* FhG: Issue 593: correct include of stl.h in lib_enc/ivas_stereo_eclvq_enc.c */ #define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ -#define COVARIANCE_MEMORY_OPT /* Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ +#define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ +#define CODE_CLEAN_UP_DIRAC /* Dlb : code clean up*/ +#define COVARIANCE_MEMORY_OPT /* Dlb : Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ #define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ @@ -204,7 +206,6 @@ #define CR_FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ - /* ##################### End NON-BE CR switches ########################### */ -- GitLab From 75ff4837bef721a992df10b1632d25885a0a41d3 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 20 Jul 2023 15:59:00 +1000 Subject: [PATCH 432/591] dummy commit --- lib_dec/ivas_spar_md_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 6d7e58829e..a4ee09adc1 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -598,6 +598,7 @@ ivas_error ivas_spar_md_dec_init( { set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); } + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { for ( j = 0; j < IVAS_SPAR_MAX_CH; j++ ) -- GitLab From b87395d1a46e26d87e377706c583da5e6922c774 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Thu, 20 Jul 2023 14:30:34 +0530 Subject: [PATCH 433/591] smoke-test fix --- lib_util/hrtf_file_reader.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 183b278bfc..73ba942f04 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1531,7 +1531,22 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "HRTF binary file not compliant (number of HRTF)" ); } - +#ifdef FIX_1720_HRTF_FASTCONV + if ( ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) + { + if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) + { + free( hrtf_data ); + return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); + } + /* Create the HRTF reading the raw data from the binary file */ + if ( ( create_fastconv_HRTF_from_rawdata( &hHrtfFastConv, hrtf_data, hrtf_header.rend_type, hrtf_header.input_cfg ) ) != IVAS_ERR_OK ) + { + free( hrtf_data ); + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create HRTF from binary file" ); + } + } +#else if ( ( hrtf_header.frequency == 48000 ) && ( ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { @@ -1547,6 +1562,7 @@ ivas_error load_fastconv_HRTF_from_binary( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create HRTF from binary file" ); } } +#endif else { fseek( f_hrtf, hrtf_header.data_size, SEEK_CUR ); @@ -1806,13 +1822,18 @@ ivas_error create_SetOfHRTF_from_binary( } free( hrtf_data ); - if ( ( ( *hSetOfHRTF ).hHRTF_hrir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_brir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_hrir_hoa3 == NULL ) ) { +#ifdef FIX_1720_HRTF_FASTCONV + if ( destroy_SetOfHRTF( hSetOfHRTF ) != IVAS_ERR_OK ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create all the HRTF from binary file" ); + } +#else destroy_SetOfHRTF( hSetOfHRTF ); return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create all the HRTF from binary file" ); +#endif } - return IVAS_ERR_OK; } -- GitLab From 08136bc6676740dd6ee5a2bac34b0f4efeb9bd01 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 20 Jul 2023 11:59:49 +0200 Subject: [PATCH 434/591] [fix] LFE buffer sizes and uninitialised reads --- lib_rend/lib_rend.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9750087862..c83484295b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -65,6 +65,10 @@ #define MAX_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #endif /* REND_STATIC_MEM_OPT */ +#ifdef FIX_194_LFE_DELAY_EXTREND +#define MAX_BIN_DELAY_SAMPLES 50 /* Maximum supported rendering latency for binaural IRs */ +#endif + #else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #endif @@ -2326,10 +2330,13 @@ static ivas_error initMcBinauralRendering( #ifdef FIX_194_LFE_DELAY_EXTREND /* determine binaural delay ( used for aligning LFE to output signal ) */ binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, - ( &inputMc->tdRendWrapper != NULL ) ? inputMc->tdRendWrapper.binaural_latency_ns : 0 ); + inputMc->tdRendWrapper.binaural_latency_ns ); inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); - assert( ( inputMc->binauralDelaySmp < L_FRAME48k >> 2 ) && "Invalid delay for LFE binaural rendering!" ); + if ( inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)" ); + } #endif /* FIX_194_LFE_DELAY_EXTREND */ return IVAS_ERR_OK; @@ -2449,7 +2456,7 @@ static ivas_error setRendInputActiveMc( } #ifdef FIX_194_LFE_DELAY_EXTREND - if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, L_FRAME48k >> 2 ) ) != IVAS_ERR_OK ) + if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) { return error; } @@ -2476,7 +2483,7 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); #ifdef FIX_194_LFE_DELAY_EXTREND - set_zero( inputMc->lfeDelayBuffer, L_FRAME48k >> 2 ); + set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6388,25 +6395,25 @@ static ivas_error renderLfeToBinaural( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to allocate memory for temporary LFE to Binaural buffer" ); } - /* 1. read from the LFE delay buffer and acc. to temp buffer - 2. read remaining samples from the input LFE channel and acc. to temp buffer */ + /* 1. read from the LFE delay buffer into temp buffer + 2. read remaining samples from the input LFE channel into temp buffer */ readPtr = mcInput->lfeDelayBuffer; writePtr = tmpLfeBuffer; for ( i = 0; i < mcInput->binauralDelaySmp; i++ ) { - *writePtr++ += gain * ( *readPtr++ ); + *writePtr++ = gain * ( *readPtr++ ); } readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); for ( ; i < ( mcInput->base.inputBuffer.config.numSamplesPerChannel - mcInput->binauralDelaySmp ); i++ ) { - *writePtr++ += gain * ( *readPtr++ ); + *writePtr++ = gain * ( *readPtr++ ); } /* save leftover samples in the LFE delay buffer for next frame */ writePtr = mcInput->lfeDelayBuffer; for ( i = 0; i < mcInput->binauralDelaySmp; i++ ) { - *writePtr++ += gain * ( *readPtr++ ); + *writePtr++ = gain * ( *readPtr++ ); } #endif /* FIX_194_LFE_DELAY_EXTREND */ -- GitLab From 7ea4b5031574822a4bba2b1ae798c773b1d2b1c9 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Thu, 20 Jul 2023 15:53:33 +0530 Subject: [PATCH 435/591] resolve build errros --- lib_dec/ivas_binRenderer_internal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 3dd5888ffd..d014312fa6 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1201,7 +1201,12 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->numPoses = 1; } /* Load HRTF tables */ +#ifdef FIX_1720_HRTF_FASTCONV + ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV ); +#else ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv ); +#endif + /* Allocate memories and buffers needed for convolutional module */ if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, in_config, -- GitLab From dea5994716b240c1b0ad56d39e9e5d875ab0805e Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 20 Jul 2023 12:44:18 +0200 Subject: [PATCH 436/591] Clean up LFE delay compensation --- lib_rend/lib_rend.c | 69 +++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c83484295b..a9a0469790 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6349,19 +6349,21 @@ static ivas_error renderLfeToBinaural( #endif IVAS_REND_AudioBuffer outAudio ) { - int16_t i; -#ifdef FIX_194_LFE_DELAY_EXTREND - int16_t ear_idx; -#endif int16_t lfe_idx; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pose_idx, num_poses; #endif float gain; #ifdef FIX_194_LFE_DELAY_EXTREND - float *tmpLfeBuffer; -#endif + int16_t ear_idx; + float tmpLfeBuffer[MAX_BUFFER_LENGTH_PER_CHANNEL]; + int16_t frame_size, num_cpy_smpl_cur_frame, num_cpy_smpl_prev_frame; + const float *lfeInput; + float *writePtr; +#else + int16_t i; float *readPtr, *writePtr; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); @@ -6388,35 +6390,21 @@ static ivas_error renderLfeToBinaural( } #ifdef FIX_194_LFE_DELAY_EXTREND - /* Render LFE first to a temporary buffer to avoid applying gain multiple times */ - tmpLfeBuffer = malloc( mcInput->base.inputBuffer.config.numSamplesPerChannel * sizeof( float ) ); - if ( tmpLfeBuffer == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to allocate memory for temporary LFE to Binaural buffer" ); - } - - /* 1. read from the LFE delay buffer into temp buffer - 2. read remaining samples from the input LFE channel into temp buffer */ - readPtr = mcInput->lfeDelayBuffer; - writePtr = tmpLfeBuffer; - for ( i = 0; i < mcInput->binauralDelaySmp; i++ ) - { - *writePtr++ = gain * ( *readPtr++ ); - } - readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); - for ( ; i < ( mcInput->base.inputBuffer.config.numSamplesPerChannel - mcInput->binauralDelaySmp ); i++ ) - { - *writePtr++ = gain * ( *readPtr++ ); - } - - /* save leftover samples in the LFE delay buffer for next frame */ - writePtr = mcInput->lfeDelayBuffer; - for ( i = 0; i < mcInput->binauralDelaySmp; i++ ) - { - *writePtr++ = gain * ( *readPtr++ ); - } + /* --- Prepare LFE signal to be added to binaural output --- */ + lfeInput = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); + frame_size = mcInput->base.inputBuffer.config.numSamplesPerChannel; + num_cpy_smpl_prev_frame = mcInput->binauralDelaySmp; + num_cpy_smpl_cur_frame = frame_size - num_cpy_smpl_prev_frame; + /* Assuming LFE should be delayed by less that the duration of one frame */ + assert( mcInput->binauralDelaySmp < frame_size ); + /* Get delayed LFE signal from previous frame, apply gain and save in tmp buffer */ + v_multc( mcInput->lfeDelayBuffer, gain, tmpLfeBuffer, num_cpy_smpl_prev_frame ); + /* Continue filling tmp buffer, now with LFE signal from current frame */ + v_multc( lfeInput, gain, tmpLfeBuffer + num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); + /* Save remaining LFE samples of current frame for next frame */ + mvr2r( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer, num_cpy_smpl_prev_frame ); +#endif -#endif /* FIX_194_LFE_DELAY_EXTREND */ #ifdef SPLIT_REND_WITH_HEAD_ROT /* Copy LFE to left and right binaural channels for all poses */ if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) @@ -6433,9 +6421,8 @@ static ivas_error renderLfeToBinaural( #ifdef FIX_194_LFE_DELAY_EXTREND for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) { - mvr2r( tmpLfeBuffer, - getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS + ear_idx, 0 ), - mcInput->base.inputBuffer.config.numSamplesPerChannel ); + writePtr = getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS + ear_idx, 0 ); + v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); } #else readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); @@ -6458,9 +6445,8 @@ static ivas_error renderLfeToBinaural( #ifdef FIX_194_LFE_DELAY_EXTREND for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) { - mvr2r( tmpLfeBuffer, - getSmplPtr( outAudio, ear_idx, 0 ), - mcInput->base.inputBuffer.config.numSamplesPerChannel ); + writePtr = getSmplPtr( outAudio, pose_idx * BINAURAL_CHANNELS + ear_idx, 0 ); + v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); } #else readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 ); @@ -6478,9 +6464,6 @@ static ivas_error renderLfeToBinaural( } #endif /* FIX_194_LFE_DELAY_EXTREND */ #endif /* SPLIT_REND_WITH_HEAD_ROT */ -#ifdef FIX_194_LFE_DELAY_EXTREND - free( tmpLfeBuffer ); -#endif /* FIX_194_LFE_DELAY_EXTREND */ pop_wmops(); -- GitLab From 6a83549ea6b92a933da34468628edf09eaadb2a9 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 20 Jul 2023 16:41:25 +0200 Subject: [PATCH 437/591] added initilizations and asserts for issue #617 DTX and IO16(enc) IO32(dec) --- lib_com/options.h | 3 +++ lib_dec/cng_dec.c | 33 ++++++++++++++++++++++++++++++++- lib_dec/ivas_stereo_cng_dec.c | 10 ++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b02e63cd1e..81557dce9a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -194,6 +194,9 @@ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ + +#define FIX617_UBSAN_DIVBYZERO_STEREOCNG /* Eri: Issue 617: Decoder UBSAN: division by zero in stereo cng when inut is 16kHz and output is 32kHz */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index 64403736c4..664e333701 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -728,7 +728,7 @@ static void shb_CNG_decod( if ( hTdCngDec->trans_cnt > 0 ) { - i = (int16_t) ( (float) hTdCngDec->trans_cnt / 15.0f * 255 ); + i = ( int16_t )( (float) hTdCngDec->trans_cnt / 15.0f * 255 ); ener = hTdCngDec->shb_cng_ener + sin_table256[i] * ( hTdCngDec->last_shb_ener - hTdCngDec->shb_cng_ener ); hTdCngDec->trans_cnt--; } @@ -737,9 +737,15 @@ static void shb_CNG_decod( ener = hTdCngDec->shb_cng_ener; } + gain = (float) sqrt( pow( 10, 0.1f * ener ) * L_FRAME16k / ener_excSHB ); st->hTdCngDec->shb_cng_gain = ener; +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG +#ifdef DEBUGGING + /* note: state shb_cng_gain is actually an energy value in dB */ +#endif +#endif for ( i = 0; i < L_FRAME16k; i++ ) { @@ -783,6 +789,20 @@ void td_cng_dec_init( mvr2r( st->lsp_old, st->lspCNG, M ); hTdCngDec->last_allow_cn_step = 0; hTdCngDec->shb_cng_ener = -6.02f; +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + if ( st->element_mode != EVS_MONO ) + { + set_f( hTdCngDec->shb_lpcCNG, 0.0f, LPC_SHB_ORDER + 1 ); + hTdCngDec->shb_lpcCNG[0] = 1.0f; + hTdCngDec->shb_cng_gain = -82.0; /* a dB value approximately corresponding to shb index 0(used as index -15) */ + } + /* + else { + EVS_MONO case + } + */ +#endif + hTdCngDec->wb_cng_ener = -6.02f; hTdCngDec->last_wb_cng_ener = -6.02f; hTdCngDec->last_shb_cng_ener = -6.02f; @@ -825,7 +845,18 @@ void td_cng_dec_init( hTdCngDec->shb_dtx_count = 0; hTdCngDec->trans_cnt = 0; hTdCngDec->burst_cnt = 0; +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + if ( st->element_mode != EVS_MONO ) + { + hTdCngDec->last_shb_ener = -82.0f; /* in dB domain */ + } + else + { + hTdCngDec->last_shb_ener = 0.001f; + } +#else hTdCngDec->last_shb_ener = 0.001f; +#endif set_f( hTdCngDec->interpol_3_2_cng_dec, 0.0f, INTERP_3_2_MEM_LEN ); diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index c12498c015..99a568d61d 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -375,9 +375,16 @@ static void stereo_dft_generate_comfort_noise( ptr0 = shb_shape; ptr1 = ptr0 + 2; ptr2 = ptr1 + 1; + for ( i = 0; i < L_FRAME16k / 2 - 1; i++ ) { +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + ftmp = ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); + assert( ftmp != 0.0f ); + ftmp = 1.0f / ftmp; +#else ftmp = 1.0f / ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); +#endif enr += ftmp; *ptr0++ = sqrtf( ftmp ); ptr1 += 2; @@ -455,6 +462,9 @@ static void stereo_dft_generate_comfort_noise( { /* high band generation, flipped spectrum */ +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + assert( enr != 0.0f ); +#endif scale = sqrtf( powf( 10, 0.1f * st->hTdCngDec->shb_cng_gain ) / enr ); ptr_shb = shb_shape + L_FRAME16k / 2 - 1; /* Averaging for Nyquist frequency */ -- GitLab From a989e6844734598e1bb90cf7df94f5cd2930f996 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 20 Jul 2023 17:18:32 +0200 Subject: [PATCH 438/591] [fix] add missing paranthesis --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index ecca54374a..e4de453b0e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -521,7 +521,7 @@ def pytest_configure(config): testconfig.PARAM_FILE = config.option.param_file if config.option.selection_be_md5_file: md5_file_path = config.option.selection_be_md5_file - if not platform.system == "Windows": + if not platform.system() == "Windows": raise NotImplementedError("MD5 comparison is currently hardcoded for windows") with open(md5_file_path) as f: testconfig.MD5_REF_DICT = {line.split()[0]: line.split()[1] for line in f.readlines()} -- GitLab From 206ff2ecdf8978bf25a9f3e3aca979e4d7fced1a Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 20 Jul 2023 18:09:09 +0200 Subject: [PATCH 439/591] separated initilization value fix into its own define and deactivated it, clang formatting applied --- lib_com/options.h | 3 ++- lib_dec/cng_dec.c | 14 +++++++------- lib_dec/ivas_stereo_cng_dec.c | 22 ++++++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b8c83b19ed..2864a43764 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -204,7 +204,8 @@ #define FIX_622_SILENCE_USAN_WARNING /* FhG: silenceusan warning in ifft code */ -#define FIX617_UBSAN_DIVBYZERO_STEREOCNG /* Eri: Issue 617: Decoder UBSAN: division by zero in stereo cng when inut is 16kHz and output is 32kHz */ +#define FIX617_UBSAN_DIVBYZERO_STEREOCNG /* Eri: Issue 617: Decoder UBSAN: division by zero in stereo cng when inut is 16kHz and output is 32kHz */ +//#define FIX617_UBSAN_DIVBYZERO_STEREOCNG_LAST_SHB_ENER_INIT /* Eri: Issue 617: old EVS initilization leads to incorrect interpolation in dB domain, likely not BE */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index 664e333701..23ef2f7ad9 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -728,7 +728,7 @@ static void shb_CNG_decod( if ( hTdCngDec->trans_cnt > 0 ) { - i = ( int16_t )( (float) hTdCngDec->trans_cnt / 15.0f * 255 ); + i = (int16_t) ( (float) hTdCngDec->trans_cnt / 15.0f * 255 ); ener = hTdCngDec->shb_cng_ener + sin_table256[i] * ( hTdCngDec->last_shb_ener - hTdCngDec->shb_cng_ener ); hTdCngDec->trans_cnt--; } @@ -745,7 +745,7 @@ static void shb_CNG_decod( #ifdef DEBUGGING /* note: state shb_cng_gain is actually an energy value in dB */ #endif -#endif +#endif for ( i = 0; i < L_FRAME16k; i++ ) { @@ -796,10 +796,10 @@ void td_cng_dec_init( hTdCngDec->shb_lpcCNG[0] = 1.0f; hTdCngDec->shb_cng_gain = -82.0; /* a dB value approximately corresponding to shb index 0(used as index -15) */ } - /* + /* else { - EVS_MONO case - } + EVS_MONO case + } */ #endif @@ -845,10 +845,10 @@ void td_cng_dec_init( hTdCngDec->shb_dtx_count = 0; hTdCngDec->trans_cnt = 0; hTdCngDec->burst_cnt = 0; -#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG_LAST_SHB_ENER_INIT if ( st->element_mode != EVS_MONO ) { - hTdCngDec->last_shb_ener = -82.0f; /* in dB domain */ + hTdCngDec->last_shb_ener = -82.0f; /* low level in dB domain corresspodning to index 0(-15) */ } else { diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 99a568d61d..70c95bfb4e 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -378,13 +378,19 @@ static void stereo_dft_generate_comfort_noise( for ( i = 0; i < L_FRAME16k / 2 - 1; i++ ) { -#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG - ftmp = ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); - assert( ftmp != 0.0f ); - ftmp = 1.0f / ftmp; +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + ftmp = ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); + assert( ftmp != 0.0f ); + ftmp = 1.0f / ftmp; + /* in float: + both a = "div"=(1/(x^2+y^2) and sqrt(a) is used and summed up in the same loop. + + in BASOP: + sum up using inv_sqrt( *ptr1 * *ptr1 + *ptr2 * *ptr2 ), in this loop + and then sum up enr = sum( *ptr0 * *ptr0 ), in a subsequent MAC loop */ #else ftmp = 1.0f / ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); -#endif +#endif enr += ftmp; *ptr0++ = sqrtf( ftmp ); ptr1 += 2; @@ -462,9 +468,9 @@ static void stereo_dft_generate_comfort_noise( { /* high band generation, flipped spectrum */ -#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG - assert( enr != 0.0f ); -#endif +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + assert( enr != 0.0f ); +#endif scale = sqrtf( powf( 10, 0.1f * st->hTdCngDec->shb_cng_gain ) / enr ); ptr_shb = shb_shape + L_FRAME16k / 2 - 1; /* Averaging for Nyquist frequency */ -- GitLab From ffa2407b8e6403f976f542c799b909a55e001f00 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 20 Jul 2023 18:35:58 +0200 Subject: [PATCH 440/591] clang formatting applied again --- lib_dec/cng_dec.c | 2 +- lib_dec/ivas_stereo_cng_dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index 23ef2f7ad9..26b5ce543e 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -745,7 +745,7 @@ static void shb_CNG_decod( #ifdef DEBUGGING /* note: state shb_cng_gain is actually an energy value in dB */ #endif -#endif +#endif for ( i = 0; i < L_FRAME16k; i++ ) { diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 70c95bfb4e..dd7b1653f2 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -386,7 +386,7 @@ static void stereo_dft_generate_comfort_noise( both a = "div"=(1/(x^2+y^2) and sqrt(a) is used and summed up in the same loop. in BASOP: - sum up using inv_sqrt( *ptr1 * *ptr1 + *ptr2 * *ptr2 ), in this loop + sum up using inv_sqrt( *ptr1 * *ptr1 + *ptr2 * *ptr2 ), in this loop and then sum up enr = sum( *ptr0 * *ptr0 ), in a subsequent MAC loop */ #else ftmp = 1.0f / ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); -- GitLab From 993c6285ea69205a0784c0b52ee198eb5ee9f2e3 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 20 Jul 2023 19:00:48 +0200 Subject: [PATCH 441/591] added additional DivByZero asserts in the stereo dtx decoder --- lib_dec/ivas_stereo_cng_dec.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index dd7b1653f2..88fa786656 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -342,12 +342,25 @@ static void stereo_dft_generate_comfort_noise( ptr0 = cngNoiseLevel_upd; ptr1 = ptr0 + 2; ptr2 = ptr1 + 1; +#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG + assert( st->lp_ener > 0.0f ); + factor = 2.0f * sqrtf( st->lp_ener / st->L_frame * 0.5f ); /* fixed factor in the loop below */ + for ( i = 0; i < st->L_frame / 2 - 1; i++ ) + { + ftmp = *ptr1 * *ptr1 + *ptr2 * *ptr2; + assert( ftmp > 0.0f ); + *ptr0++ = factor * inv_sqrt( ftmp ); + ptr1 += 2; + ptr2 += 2; + } +#else for ( i = 0; i < st->L_frame / 2 - 1; i++ ) { *ptr0++ = 2.0f * sqrtf( st->lp_ener / st->L_frame * 0.5f ) * inv_sqrt( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); ptr1 += 2; ptr2 += 2; } +#endif if ( min( output_frame, L_FRAME32k ) - hFdCngCom->stopFFTbin > 0 ) { @@ -380,7 +393,7 @@ static void stereo_dft_generate_comfort_noise( { #ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG ftmp = ( *ptr1 * *ptr1 + *ptr2 * *ptr2 ); - assert( ftmp != 0.0f ); + assert( ftmp > 0.0f ); ftmp = 1.0f / ftmp; /* in float: both a = "div"=(1/(x^2+y^2) and sqrt(a) is used and summed up in the same loop. -- GitLab From c42f42580633312595edfd54eb80373b5c9e2fff Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 20 Jul 2023 19:23:39 +0200 Subject: [PATCH 442/591] clang-format applied --- lib_dec/ivas_stereo_cng_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 88fa786656..c674f8bec9 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -344,7 +344,7 @@ static void stereo_dft_generate_comfort_noise( ptr2 = ptr1 + 1; #ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG assert( st->lp_ener > 0.0f ); - factor = 2.0f * sqrtf( st->lp_ener / st->L_frame * 0.5f ); /* fixed factor in the loop below */ + factor = 2.0f * sqrtf( st->lp_ener / st->L_frame * 0.5f ); /* fixed factor in the loop below */ for ( i = 0; i < st->L_frame / 2 - 1; i++ ) { ftmp = *ptr1 * *ptr1 + *ptr2 * *ptr2; @@ -360,7 +360,7 @@ static void stereo_dft_generate_comfort_noise( ptr1 += 2; ptr2 += 2; } -#endif +#endif if ( min( output_frame, L_FRAME32k ) - hFdCngCom->stopFFTbin > 0 ) { -- GitLab From b69b886c180417a48097806223ccce7cc0b6292e Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 21 Jul 2023 09:16:53 +0200 Subject: [PATCH 443/591] add check for build warnings also for clang builds --- .gitlab-ci.yml | 4 +++- ci/build_codec_sanitizers_linux.sh | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 760f908abd..342a6c4dc8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -281,11 +281,13 @@ build-codec-instrumented-linux: # make sure that the codec builds with msan, asan and usan build-codec-sanitizers-linux: extends: - - .build-job-linux + - .build-job-with-check-for-warnings - .rules-basis script: - *print-common-info - bash ci/build_codec_sanitizers_linux.sh + # need to use the "|| exit $?" suffix to get the allowed_failure return code, otherwise the job fails with code 1...< + - ci/check_for_warnings.py $BUILD_OUTPUT || exit $? build-codec-windows-cmake: extends: diff --git a/ci/build_codec_sanitizers_linux.sh b/ci/build_codec_sanitizers_linux.sh index d352fa32ec..9eadfb3899 100755 --- a/ci/build_codec_sanitizers_linux.sh +++ b/ci/build_codec_sanitizers_linux.sh @@ -40,4 +40,5 @@ make CLANG=1 -j make clean make CLANG=2 -j make clean -make CLANG=3 -j +# write out one build for warnings check +make CLANG=3 -j | tee build_output.txt -- GitLab From 5320594653ea6080b0272e4628c0be2e1fca3025 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 21 Jul 2023 11:55:49 +0200 Subject: [PATCH 444/591] change variable type to fix usan complaint --- lib_com/options.h | 1 + lib_dec/tonalMDCTconcealment.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index cfbad5ab4f..ad545161f9 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -210,6 +210,7 @@ #define FIX_622_SILENCE_USAN_WARNING /* FhG: silenceusan warning in ifft code */ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ +#define FIX_626_VARIABLE_TYPE_MDCT_CONC /* FhG: trivial fix to fix USAN error */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 86340ab181..e4d033d7fb 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -126,7 +126,11 @@ void TonalMDCTConceal_SaveFreqSignal( const int16_t infoIGFStartLine ) { float *temp; +#ifdef FIX_626_VARIABLE_TYPE_MDCT_CONC + uint16_t nOldSamples; +#else int16_t nOldSamples; +#endif assert( nNewSamples > 0 && nNewSamples <= 2 * L_FRAME_MAX ); -- GitLab From 4692a685cac334a021ed2f0b88c8d7b88746e719 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Fri, 21 Jul 2023 12:36:04 +0200 Subject: [PATCH 445/591] Rename the variable ism_md_subframe_ext to ism_metadata_delay_ms in inputIsm struct --- lib_rend/lib_rend.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ed1439be61..0f9591dfb0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -152,7 +152,7 @@ typedef struct OMASA_ANA_HANDLE hOMasa; uint16_t total_num_objects; #ifdef FIX_488_SYNC_DELAY - int16_t ism_md_subframe_update_ext; + int16_t ism_metadata_delay_ms; #endif } input_ism; @@ -5724,7 +5724,7 @@ static ivas_error renderIsmToBinaural( push_wmops( "renderIsmToBinaural" ); #ifdef FIX_488_SYNC_DELAY /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ - ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer ); @@ -5910,7 +5910,7 @@ static ivas_error renderIsmToBinauralReverb( #ifdef FIX_488_SYNC_DELAY /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ - ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); @@ -6150,7 +6150,7 @@ static ivas_error renderIsmToSplitBinaural( &ismInput->currentPos, NULL, #ifdef FIX_488_SYNC_DELAY - ismInput->ism_md_subframe_update_ext, /* ToDo: Ism Audio Metadata Delay Sync in ms for External Renderer */ + ismInput->ism_metadata_delay_ms, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ #endif output_frame, tmpProcessing ); @@ -6168,7 +6168,7 @@ static ivas_error renderIsmToSplitBinaural( &ismInput->currentPos, NULL, #ifdef FIX_488_SYNC_DELAY - ismInput->ism_md_subframe_update_ext, /* ToDo: Ism Audio Metadata Delay Sync in ms for External Renderer */ + ismInput->ism_metadata_delay_ms, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ #endif output_frame, tmpProcessing ); @@ -6296,10 +6296,7 @@ static ivas_error renderActiveInputsIsm( /* Skip inactive inputs */ continue; } -#ifdef FIX_488_SYNC_DELAY - /* Metadata Delay in subframes to sync with audio delay */ - pCurrentInput->ism_md_subframe_update_ext = hIvasRend->inputsIsm[0].ism_md_subframe_update_ext; -#endif + if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { @@ -8346,7 +8343,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - hIvasRend->inputsIsm[0].ism_md_subframe_update_ext = sync_md_delay; + hIvasRend->inputsIsm[0].ism_metadata_delay_ms = sync_md_delay; return IVAS_ERR_OK; } -- GitLab From 9d33bfd12d623d3ca135012ec93c3e267e4100b6 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Fri, 21 Jul 2023 13:36:31 +0200 Subject: [PATCH 446/591] Corrected the comments --- lib_rend/lib_rend.c | 4 ++-- lib_rend/lib_rend.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0f9591dfb0..25b1ab8a1b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8330,12 +8330,12 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( /*---------------------------------------------------------------------* * IVAS_REND_SetIsmMetadataDelay( ) * - * Set the total number of objects to the first object data + * Set the Metadata Delay in ms in order to sync with audio delay *---------------------------------------------------------------------*/ ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const uint16_t sync_md_delay /* i: total number of objects */ + const uint16_t sync_md_delay /* i: Ism Metadata Delay in ms to sync with audio delay */ ) { if ( hIvasRend == NULL ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 41fa28ebc6..1497d404c7 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -352,7 +352,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( #ifdef FIX_488_SYNC_DELAY ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const uint16_t sync_md_delay /* i: Metadata Delay in subframes to sync with audio delay */ + const uint16_t sync_md_delay /* i: Metadata Delay in ms to sync with audio delay */ ); #endif -- GitLab From 344f8ecde5f427370834ac4f7cb679d4d2feeff2 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 21 Jul 2023 13:42:23 +0200 Subject: [PATCH 447/591] also redirect stderr to actually capture warnings --- ci/build_codec_sanitizers_linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_codec_sanitizers_linux.sh b/ci/build_codec_sanitizers_linux.sh index 9eadfb3899..4e40f89b9a 100755 --- a/ci/build_codec_sanitizers_linux.sh +++ b/ci/build_codec_sanitizers_linux.sh @@ -41,4 +41,4 @@ make clean make CLANG=2 -j make clean # write out one build for warnings check -make CLANG=3 -j | tee build_output.txt +make CLANG=3 -j 2>&1 | tee build_output.txt -- GitLab From 8aca3b9428976403361572764967fc047374c055 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Fri, 21 Jul 2023 14:08:36 +0200 Subject: [PATCH 448/591] apply clang formatting --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c64816a0cd..9f121bb5c1 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2662,7 +2662,7 @@ static ivas_error printConfigInfo_dec( #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MC_FORMAT ) #else - else /* MC_FORMAT */ + else /* MC_FORMAT */ #endif { if ( ( error = get_channel_config( st_ivas->transport_config, &config_str[0] ) ) != IVAS_ERR_OK ) -- GitLab From cff9a68e65d6f8128235c68dcd897bce045b8206 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Fri, 21 Jul 2023 15:32:42 +0200 Subject: [PATCH 449/591] removed inactive define FIX617_UBSAN_DIVBYZERO_STEREOCNG_LAST_SHB_ENER_INIT , now in issue #628 --- lib_com/options.h | 1 - lib_dec/cng_dec.c | 13 ++----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2864a43764..95a35e7f15 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -205,7 +205,6 @@ #define FIX617_UBSAN_DIVBYZERO_STEREOCNG /* Eri: Issue 617: Decoder UBSAN: division by zero in stereo cng when inut is 16kHz and output is 32kHz */ -//#define FIX617_UBSAN_DIVBYZERO_STEREOCNG_LAST_SHB_ENER_INIT /* Eri: Issue 617: old EVS initilization leads to incorrect interpolation in dB domain, likely not BE */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index 26b5ce543e..d5e1404a7f 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -845,18 +845,9 @@ void td_cng_dec_init( hTdCngDec->shb_dtx_count = 0; hTdCngDec->trans_cnt = 0; hTdCngDec->burst_cnt = 0; -#ifdef FIX617_UBSAN_DIVBYZERO_STEREOCNG_LAST_SHB_ENER_INIT - if ( st->element_mode != EVS_MONO ) - { - hTdCngDec->last_shb_ener = -82.0f; /* low level in dB domain corresspodning to index 0(-15) */ - } - else - { - hTdCngDec->last_shb_ener = 0.001f; - } -#else + hTdCngDec->last_shb_ener = 0.001f; -#endif + set_f( hTdCngDec->interpol_3_2_cng_dec, 0.0f, INTERP_3_2_MEM_LEN ); -- GitLab From 76924b5bb3f1ff54685eae436744244347d16950 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 21 Jul 2023 16:37:33 +0200 Subject: [PATCH 450/591] Add MR pipeline jobs for USAN + suppression file --- .gitlab-ci.yml | 49 +++++++++++++++++++++++++++++ CMakeLists.txt | 16 ++++++++-- Makefile | 8 +++-- scripts/ubsan.supp | 56 +++++++++++++++++++++++++++++++++ tests/renderer/test_renderer.py | 32 ++++++++++++------- tests/renderer/utils.py | 23 +++++++++----- 6 files changed, 161 insertions(+), 23 deletions(-) create mode 100644 scripts/ubsan.supp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 342a6c4dc8..cc24ab729e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -388,6 +388,28 @@ codec-asan: - test_output.txt expose_as: "asan selftest results" +# code selftest testvectors with address-sanitizer binaries +codec-usan: + extends: + - .test-job-linux + - .rules-merge-request + stage: test + needs: ["build-codec-sanitizers-linux"] + script: + - *print-common-info + - make clean + - make -j CLANG=3 + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 scripts/self_test.py --create + - grep_exit_code=0 + - grep UndefinedBehaviorSanitizer scripts/ref/logs/* || grep_exit_code=$? + - if [ $grep_exit_code != 1 ] ; then echo "Run errors in self_test.py with Clang undefined-behavior-sanitizer"; exit 1; fi + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + paths: + - scripts/ref/logs/ + expose_as: "usan selftest results" + # test renderer executable renderer-smoke-test: extends: @@ -455,6 +477,33 @@ renderer-msan: junit: - report-junit.xml +# test renderer executable with cmake + usan +renderer-usan: + extends: + - .test-job-linux + - .rules-merge-request + needs: ["build-codec-linux-cmake"] + stage: test + script: + - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - cmake --build cmake-build -- -j + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py + - grep_exit_code=0 + - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest + - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? + - if [ $grep_exit_code != 1 ] ; then echo "Run errors in test_renderer.py with Clang undefined-behavior-sanitizer"; exit 1; fi + + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + expose_as: "renderer usan pytest results" + reports: + junit: + - report-junit.xml + # compare renderer bitexactness between target and source branch renderer-pytest-on-merge-request: extends: diff --git a/CMakeLists.txt b/CMakeLists.txt index 270636eb5e..d08135676c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,20 @@ if(UNIX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") elseif("${CLANG}" MATCHES "3" OR "${CLANG}" MATCHES "usan") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined") + # NOTE: keep in sync with list in Makefile + set(USAN_CHECKS_ENABLE + undefined # Default checks + # Extra checks + float-divide-by-zero + implicit-conversion + local-bounds + ) + list(JOIN USAN_CHECKS_ENABLE "," USAN_CHECKS_ENABLE) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${USAN_CHECKS_ENABLE} -fsanitize-recover=${USAN_CHECKS_ENABLE}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${USAN_CHECKS_ENABLE} -fsanitize-recover=${USAN_CHECKS_ENABLE}") + else() + message(FATAL_ERROR "Unknown CLANG setting: ${CLANG}") endif() endif() # GCOV diff --git a/Makefile b/Makefile index d14ddfbd1b..138a4cdaed 100644 --- a/Makefile +++ b/Makefile @@ -77,8 +77,12 @@ LDFLAGS += -fsanitize=address endif ifeq "$(CLANG)" "3" CC = $(CCCLANG) -CFLAGS += -fsanitize=undefined -LDFLAGS += -fsanitize=undefined +# NOTE: keep in sync with list in CMakeLists.txt +usan_checks = undefined,float-divide-by-zero,implicit-conversion,local-bounds +CFLAGS += -fsanitize=$(usan_checks) +CFLAGS += -fsanitize-recover=$(usan_checks) +LDFLAGS += -fsanitize=$(usan_checks) +LDFLAGS += -fsanitize-recover=$(usan_checks) endif ifeq "$(RELEASE)" "1" diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp new file mode 100644 index 0000000000..54461a31dd --- /dev/null +++ b/scripts/ubsan.supp @@ -0,0 +1,56 @@ +# From self_test.py +alignment:hrtf_file_reader.c +bounds:dec_acelp.c +bounds:enc_acelp.c +bounds:enc_gain.c +bounds:ivas_spar_decoder.c +bounds:trans_direct.c +bounds:trans_inv.c +float-cast-overflow:ivas_dirac_com.c +float-cast-overflow:ivas_mct_core_enc.c +float-divide-by-zero:ivas_mct_core_enc.c +float-divide-by-zero:ivas_stereo_cng_dec.c +float-divide-by-zero:swb_tbe_enc.c +implicit-integer-sign-change:ACcontextMapping.c +implicit-integer-sign-change:avq_dec.c +implicit-integer-sign-change:bitstream.c +implicit-integer-sign-change:cod4t64.c +implicit-integer-sign-change:dec_prm.c +implicit-integer-sign-change:dec4t64.c +implicit-integer-sign-change:enc_acelp.c +implicit-integer-sign-change:enc_prm.c +implicit-integer-sign-change:enh40.c +implicit-integer-sign-change:inov_dec.c +implicit-integer-sign-change:inov_enc.c +implicit-integer-sign-change:ivas_mdct_core_dec.c +implicit-integer-sign-change:jbm_jb4sb.c +implicit-integer-sign-change:jbm_pcmdsp_apa.c +implicit-integer-sign-change:cod4t64_fast.c +implicit-integer-sign-change:range_enc.c +implicit-integer-sign-change:tcq_position_arith.c +implicit-integer-sign-change:tonalMDCTconcealment.c +implicit-signed-integer-truncation:ACcontextMapping_dec.c +implicit-signed-integer-truncation:ACcontextMapping_enc.c +implicit-signed-integer-truncation:cng_dec.c +implicit-signed-integer-truncation:cod_tcx.c +implicit-signed-integer-truncation:dec_tcx.c +implicit-signed-integer-truncation:hdecnrm.c +implicit-signed-integer-truncation:ivas_qmetadata_enc.c +implicit-signed-integer-truncation:lib_dec.c +implicit-signed-integer-truncation:longarith.c +implicit-signed-integer-truncation:pvq_core_dec.c +implicit-signed-integer-truncation:pvq_core_enc.c +implicit-signed-integer-truncation:tcq_position_arith.c +implicit-signed-integer-truncation:tools.c +null:ivas_dirac_com.c +pointer-overflow:ivas_dirac_dec.c +pointer-overflow:ivas_dirac_output_synthesis_dec.c +shift-base:basop32.c +shift-base:enh40.c +shift-base:enh40.h +shift-base:enh1632.c +shift-base:hq_lr_dec.c +signed-integer-overflow:basop32.c + +# renderer test +null:lib_rend.c diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 22f439c8b1..c057ff9a02 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -36,13 +36,13 @@ from .utils import * @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:]) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics(test_info, in_fmt, out_fmt): - run_renderer(in_fmt, out_fmt) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt): - run_renderer(in_fmt, out_fmt) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @@ -52,6 +52,7 @@ def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): run_renderer( in_fmt, out_fmt, + test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), ) @@ -251,7 +252,7 @@ def test_ambisonics_binaural_headrotation_refveclev_vs_refvec( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:]) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) def test_multichannel(test_info, in_fmt, out_fmt): - run_renderer(in_fmt, out_fmt) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @@ -260,7 +261,7 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt): if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") - run_renderer(in_fmt, out_fmt) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @@ -274,12 +275,14 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file run_renderer( in_fmt, out_fmt, + test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), ) else: run_renderer( in_fmt, out_fmt, + test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), ) @@ -319,7 +322,7 @@ def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, o @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:]) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism(test_info, in_fmt, out_fmt): - run_renderer(in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt]) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt]) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @@ -331,9 +334,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fmt): in_meta_files = None if out_fmt == "BINAURAL": - run_renderer(in_fmt, out_fmt, in_meta_files=in_meta_files) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, in_meta_files=in_meta_files) else: - run_renderer(in_fmt, out_fmt, in_meta_files=in_meta_files) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, in_meta_files=in_meta_files) @pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) @@ -349,6 +352,7 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): run_renderer( in_fmt, out_fmt, + test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, ) @@ -356,6 +360,7 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): run_renderer( in_fmt, out_fmt, + test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), in_meta_files=in_meta_files, ) @@ -400,7 +405,7 @@ def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa(test_info, in_fmt, out_fmt): - run_renderer(in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt]) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt]) """ Custom loudspeaker layouts """ @@ -409,7 +414,7 @@ def test_masa(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:]) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) def test_custom_ls_input(test_info, in_layout, out_fmt): - run_renderer(CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt) + run_renderer(CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, test_case_name=test_info.node.name) @pytest.mark.parametrize("out_fmt", CUSTOM_LS_TO_TEST) @@ -418,6 +423,7 @@ def test_custom_ls_output(test_info, in_fmt, out_fmt): run_renderer( in_fmt, CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), + test_case_name=test_info.node.name, ) @@ -427,6 +433,7 @@ def test_custom_ls_input_output(test_info, in_fmt, out_fmt): run_renderer( CUSTOM_LAYOUT_DIR.joinpath(f"{in_fmt}.txt"), CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), + test_case_name=test_info.node.name, ) @@ -436,6 +443,7 @@ def test_custom_ls_input_binaural(test_info, in_layout, out_fmt): run_renderer( CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, + test_case_name=test_info.node.name, ) @@ -446,6 +454,7 @@ def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, tr run_renderer( CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, + test_case_name=test_info.node.name, trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), ) @@ -459,6 +468,7 @@ def test_metadata(test_info, in_fmt, out_fmt): run_renderer( "META", out_fmt, + test_case_name=test_info.node.name, metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"), ) @@ -470,11 +480,11 @@ def test_metadata(test_info, in_fmt, out_fmt): @pytest.mark.parametrize("in_fmt", ["MONO"]) @pytest.mark.parametrize("non_diegetic_pan", ["0", "-30", "45", "90", "-90"]) def test_non_diegetic_pan_static(test_info, in_fmt, out_fmt, non_diegetic_pan): - run_renderer(in_fmt, out_fmt, non_diegetic_pan=non_diegetic_pan) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, non_diegetic_pan=non_diegetic_pan) @pytest.mark.parametrize("out_fmt", ["STEREO"]) @pytest.mark.parametrize("in_fmt", ["ISM1"]) @pytest.mark.parametrize("non_diegetic_pan", ["0", "-30", "45", "90", "-90"]) def test_non_diegetic_pan_ism_static(test_info, in_fmt, out_fmt, non_diegetic_pan): - run_renderer(in_fmt, out_fmt, non_diegetic_pan=non_diegetic_pan) + run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, non_diegetic_pan=non_diegetic_pan) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 356902ff47..cf4bbd1bdf 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -29,6 +29,7 @@ import logging import subprocess as sp import sys +import os from pathlib import Path from tempfile import TemporaryDirectory from typing import Optional, Tuple, Dict @@ -47,11 +48,10 @@ import pyaudio3dtools def test_info(request): return request - -def run_cmd(cmd): +def run_cmd(cmd, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") try: - sp.run(cmd, check=True, capture_output=True, text=True) + sp.run(cmd, check=True, capture_output=True, text=True, env=env) except sp.CalledProcessError as e: raise SystemError( f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" @@ -114,6 +114,7 @@ def run_renderer( output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", is_comparetest: Optional[bool] = False, + test_case_name: Optional[str] = None, ) -> Tuple[np.ndarray, int]: """CuT creation with standalone renderer""" if trj_file is not None: @@ -200,7 +201,12 @@ def run_renderer( if config_file is not None: cmd.extend(["-rc", str(config_file)]) - run_cmd(cmd) + # Set env variables for UBSAN + env = os.environ.copy() + if test_case_name and "UBSAN_OPTIONS" in env.keys(): + env["UBSAN_OPTIONS"] = env["UBSAN_OPTIONS"] + f",log_path=usan_log_{test_case_name}" + + run_cmd(cmd, env) return pyaudio3dtools.audiofile.readfile(out_file) @@ -208,20 +214,21 @@ def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_renderer( in_fmt, out_fmt, + test_case_name=test_info.node.name, binary_suffix=BIN_SUFFIX_MERGETARGET, output_path_base=OUTPUT_PATH_REF, **kwargs, ) - cut, cut_fs = run_renderer(in_fmt, out_fmt, **kwargs) + cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs) check_BE(test_info, ref, ref_fs, cut, cut_fs) def compare_renderer_vs_pyscripts(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_pyscripts(in_fmt, out_fmt, **kwargs) - cut, cut_fs = run_renderer(in_fmt, out_fmt, **kwargs) + cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs) check_BE(test_info, ref, ref_fs, cut, cut_fs) def compare_renderer_args(test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict): - ref, ref_fs = run_renderer(in_fmt, out_fmt, **ref_kwargs) - cut, cut_fs = run_renderer(in_fmt, out_fmt, **cut_kwargs) + ref, ref_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **ref_kwargs) + cut, cut_fs = run_renderer(in_fmt, out_fmt, test_case_name=test_info.node.name, **cut_kwargs) check_BE(test_info, ref, ref_fs, cut, cut_fs) \ No newline at end of file -- GitLab From 6717da41159d71ff969768eba6a01c78733077e3 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 21 Jul 2023 17:04:25 +0200 Subject: [PATCH 451/591] [fix] NULL check for renderConfig prior to calling initSplitRend() --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e60268e8a8..1a3a1dd8ba 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4145,7 +4145,7 @@ ivas_error IVAS_REND_AddInput( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hIvasRend->splitRendEncBuffer.data == NULL ) + if ( hIvasRend->splitRendEncBuffer.data == NULL && hIvasRend->hRendererConfig != NULL ) { if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { -- GitLab From 55f0e8c9d7e8d325dced9701b9f0edbc31226c01 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Sat, 22 Jul 2023 12:22:26 +0200 Subject: [PATCH 452/591] Change representation of sync delay to float under FIX_488_SYNC_DELAY --- apps/renderer.c | 4 ++-- lib_rend/lib_rend.c | 15 +++++++++++---- lib_rend/lib_rend.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index eea2daae2a..acb49ce39d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -176,7 +176,7 @@ typedef struct bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; #ifdef FIX_488_SYNC_DELAY - int16_t syncMdDelay; + float syncMdDelay; #endif } CmdlnArgs; @@ -2656,7 +2656,7 @@ static void parseOption( case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); /* Metadata Delay to sync with audio delay in ms */ - args->syncMdDelay = (int16_t) strtof( optionValues[0], NULL ); + args->syncMdDelay = strtof( optionValues[0], NULL ); break; #endif default: diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 25b1ab8a1b..73eed402f4 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -152,7 +152,7 @@ typedef struct OMASA_ANA_HANDLE hOMasa; uint16_t total_num_objects; #ifdef FIX_488_SYNC_DELAY - int16_t ism_metadata_delay_ms; + float ism_metadata_delay_ms; #endif } input_ism; @@ -6066,11 +6066,18 @@ static ivas_error renderIsmToSplitBinaural( float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; int16_t output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel; COMBINED_ORIENTATION_HANDLE pCombinedOrientationData; +#ifdef FIX_488_SYNC_DELAY + int16_t ism_md_subframe_update_ext; +#endif push_wmops( "renderIsmToSplitBinaural" ); pSplitRendWrapper = ismInput->base.ctx.pSplitRendWrapper; pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData; +#ifdef FIX_488_SYNC_DELAY + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ + ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); +#endif /* If not yet allocated, open additional instances of TD renderer */ for ( i = 0; i < pMultiBinPoseData->num_poses - 1; ++i ) @@ -6150,7 +6157,7 @@ static ivas_error renderIsmToSplitBinaural( &ismInput->currentPos, NULL, #ifdef FIX_488_SYNC_DELAY - ismInput->ism_metadata_delay_ms, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ + ism_md_subframe_update_ext, #endif output_frame, tmpProcessing ); @@ -6168,7 +6175,7 @@ static ivas_error renderIsmToSplitBinaural( &ismInput->currentPos, NULL, #ifdef FIX_488_SYNC_DELAY - ismInput->ism_metadata_delay_ms, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ + ism_md_subframe_update_ext, #endif output_frame, tmpProcessing ); @@ -8335,7 +8342,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const uint16_t sync_md_delay /* i: Ism Metadata Delay in ms to sync with audio delay */ + const float sync_md_delay /* i: Ism Metadata Delay in ms to sync with audio delay */ ) { if ( hIvasRend == NULL ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 1497d404c7..c86b8bcbf2 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -352,7 +352,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( #ifdef FIX_488_SYNC_DELAY ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const uint16_t sync_md_delay /* i: Metadata Delay in ms to sync with audio delay */ + const float sync_md_delay /* i: Metadata Delay in ms to sync with audio delay */ ); #endif -- GitLab From 1abaacd76f9cb45237348735ce64481d36f6c5ec Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Sat, 22 Jul 2023 13:30:25 +0200 Subject: [PATCH 453/591] Apply synch value for all isms -- resolve msan error --- lib_rend/lib_rend.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 73eed402f4..0efe833aa5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8341,16 +8341,21 @@ 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; + if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - hIvasRend->inputsIsm[0].ism_metadata_delay_ms = sync_md_delay; + for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) + { + hIvasRend->inputsIsm[i].ism_metadata_delay_ms = sync_md_delay; + } return IVAS_ERR_OK; } -- GitLab From 830e0964ef9db5a948fb32e0a439f847e61d48d2 Mon Sep 17 00:00:00 2001 From: azmill Date: Mon, 24 Jul 2023 13:55:23 +1000 Subject: [PATCH 454/591] Fixing warnings on OSX with clang --- apps/decoder.c | 2 -- apps/renderer.c | 2 +- lib_debug/debug.c | 2 +- lib_debug/snr.c | 2 +- lib_rend/ivas_CQMFDecoder.c | 21 ++++++++------------- lib_rend/ivas_PredEncoder.c | 7 ------- lib_rend/ivas_efap.c | 21 +-------------------- 7 files changed, 12 insertions(+), 45 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 6e3e23bb47..74aa3d7376 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2352,7 +2352,6 @@ static ivas_error decodeVoIP( uint32_t nextPacketRcvTime_ms = 0; uint32_t systemTime_ms = 0; uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; - int32_t nFramesWritten = 0; int32_t nFramesFed = 0; @@ -2710,7 +2709,6 @@ static ivas_error decodeVoIP( frame++; systemTime_ms += systemTimeInc_ms; - nFramesWritten++; #ifdef WMOPS update_mem(); diff --git a/apps/renderer.c b/apps/renderer.c index 239e792162..c2b952755f 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3485,7 +3485,7 @@ static void parseSceneDescriptionFile( return; } -static void printSupportedAudioConfigs() +static void printSupportedAudioConfigs( void ) { uint16_t i; const char *supportedFormats[] = { diff --git a/lib_debug/debug.c b/lib_debug/debug.c index 65497dda0a..736f35d43d 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -387,7 +387,7 @@ int16_t dbgread( * Closes opened files and frees allocated memory *--------------------------------------------------------------------*/ -void dbgclose() +void dbgclose( void ) { int16_t i; diff --git a/lib_debug/snr.c b/lib_debug/snr.c index f6e6fa9d52..5efefe8737 100644 --- a/lib_debug/snr.c +++ b/lib_debug/snr.c @@ -423,7 +423,7 @@ void snr_celp( * Finalizes and presents accumulated SNR data *--------------------------------------------------------------------*/ -void print_snr() +void print_snr( void ) { int16_t i; double snr, segsnr, wsegsnr; diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 8b04ec753d..33d9d49422 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -731,43 +731,38 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, float ***pppfCQMFImag ) { int32_t n; - int32_t iBitsRead; - - iBitsRead = 0; - iBitsRead += - ReadHeaderInformation( &psCQMFDecoder->iNumBands, pBits ); + ReadHeaderInformation( &psCQMFDecoder->iNumBands, pBits ); if ( psCQMFDecoder->iChannels == 2 ) { - iBitsRead += ReadMSInformation( + ReadMSInformation( psCQMFDecoder->iNumBands, &psCQMFDecoder->iMSMode, psCQMFDecoder->piMSFlags, psCQMFDecoder->piLRPhaseDiffs, psCQMFDecoder->piMSPredCoefs, pBits ); } - iBitsRead += ReadPredictors( psCQMFDecoder->psPredictionDecoder, + ReadPredictors( psCQMFDecoder->psPredictionDecoder, pBits ); - iBitsRead += ReadGroupInformation( + ReadGroupInformation( psCQMFDecoder->iChannels, psCQMFDecoder->iNumBlocks, &psCQMFDecoder->iCommonGrouping, psCQMFDecoder->piNumGroups, psCQMFDecoder->ppiGroupLengths, pBits ); - iBitsRead += ReadRMSEnvelope( + ReadRMSEnvelope( psCQMFDecoder->iChannels, (const int32_t *) psCQMFDecoder->piNumGroups, psCQMFDecoder->iNumBands, psCQMFDecoder->pppiRMSEnvelope, pBits ); #ifdef ENABLE_PMOD_ADJUST - iBitsRead += - ReadPmodInformation( psCQMFDecoder->ppiHiSMRFlags, psCQMFDecoder->psBSRead, + ReadPmodInformation( psCQMFDecoder->ppiHiSMRFlags, psCQMFDecoder->psBSRead, psCQMFDecoder->iChannels, psCQMFDecoder->iNumBands ); #endif - iBitsRead += ReadAllocInformation( &psCQMFDecoder->iAllocOffset, + ReadAllocInformation( &psCQMFDecoder->iAllocOffset, pBits ); if ( psCQMFDecoder->iChannels == 2 && @@ -807,7 +802,7 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, for ( n = 0; n < psCQMFDecoder->iChannels; n++ ) { - iBitsRead += ReadCQMFData( + ReadCQMFData( psCQMFDecoder->piNumGroups[n], (const int32_t *) psCQMFDecoder->ppiGroupLengths[n], psCQMFDecoder->iNumBands, psCQMFDecoder->piBandwidths, diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index e04d9f6359..6381588dda 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -145,9 +145,7 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) { int32_t b; - float fChanPredictionGainBits; psPredictionEncoder->piNumPredBands[c] = 50; - fChanPredictionGainBits = 0.0; for ( b = 0; b < psPredictionEncoder->piNumPredBands[c]; b++ ) { int32_t n; @@ -267,11 +265,6 @@ int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, psPredictionEncoder->ppfA1Imag[c][b] = fA1Imag; psPredictionEncoder->ppiA1Mag[c][b] = iA1Mag; psPredictionEncoder->ppiA1Phase[c][b] = iA1Phase; - - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - fChanPredictionGainBits += fBitGain; // change this calculation - } } #if 0 // Estimate if the savings outway the signaling cost diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 4301d75dec..98277e3544 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -719,7 +719,7 @@ static void add_ghost_speakers( int16_t numVertex; int16_t lengthVertGhst; /* Nb of vertical ghost added */ int16_t lengthHorGhst; /* Nb of Horizontal Ghost */ - int16_t i, j, k, n, a; /* Integer for loops */ + int16_t i, j, k, a; /* Integer for loops */ int16_t num_new; /* Number of new vertices to add */ float maxAngle; /* Max azimuth tolerance for extend the LS setup horizontaly */ float newDiff; /* Angle differences that will help us set the extended LS setup */ @@ -842,12 +842,8 @@ static void add_ghost_speakers( } /* Adding new virtual speakers */ - n = 0; - for ( i = 0; i < k; ++i ) { - ++n; - if ( sectors[i] > 1 ) { newDiff = tmpAngleDiff[i] / sectors[i]; @@ -858,7 +854,6 @@ static void add_ghost_speakers( newAzi = tmpAzi[i] + ( j + 1 ) * newDiff; add_vertex( vertexArray, newAzi, 0, numVertex + a, EFAP_DMX_INTENSITY ); - ++n; ++a; if ( j > 0 ) @@ -1016,7 +1011,6 @@ static void visible_edges( int16_t maxVertex; int16_t i, j, k; int16_t a, b; - int16_t nbOfEdges; int16_t tmpSurface[4]; int16_t counter[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; int16_t counterTranspose[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; @@ -1059,19 +1053,6 @@ static void visible_edges( } } - nbOfEdges = 0; - for ( i = 0; i < maxVertex + 1; ++i ) - { - for ( j = 0; j < maxVertex + 1; ++j ) - { - counter[i][j] = counterTranspose[i][j] + counterTranspose[j][i]; - if ( counter[i][j] == 1 ) - { - ++nbOfEdges; - } - } - } - /* Finding the edges */ k = 0; -- GitLab From e07ca4f8b8b01a2f5edfbe79f636cbc7d5e697af Mon Sep 17 00:00:00 2001 From: azmill Date: Mon, 24 Jul 2023 14:13:06 +1000 Subject: [PATCH 455/591] Fixing formating for #620 warnings fixes. --- lib_rend/ivas_CQMFDecoder.c | 6 +++--- lib_rend/ivas_efap.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_CQMFDecoder.c b/lib_rend/ivas_CQMFDecoder.c index 33d9d49422..cea424d3d7 100644 --- a/lib_rend/ivas_CQMFDecoder.c +++ b/lib_rend/ivas_CQMFDecoder.c @@ -743,7 +743,7 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, pBits ); } ReadPredictors( psCQMFDecoder->psPredictionDecoder, - pBits ); + pBits ); ReadGroupInformation( @@ -759,11 +759,11 @@ int32_t DecodeFrame( CQMFDecoder *psCQMFDecoder, #ifdef ENABLE_PMOD_ADJUST ReadPmodInformation( psCQMFDecoder->ppiHiSMRFlags, psCQMFDecoder->psBSRead, - psCQMFDecoder->iChannels, psCQMFDecoder->iNumBands ); + psCQMFDecoder->iChannels, psCQMFDecoder->iNumBands ); #endif ReadAllocInformation( &psCQMFDecoder->iAllocOffset, - pBits ); + pBits ); if ( psCQMFDecoder->iChannels == 2 && psCQMFDecoder->iCommonGrouping == 1 ) diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 98277e3544..5663a4ce7c 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -719,7 +719,7 @@ static void add_ghost_speakers( int16_t numVertex; int16_t lengthVertGhst; /* Nb of vertical ghost added */ int16_t lengthHorGhst; /* Nb of Horizontal Ghost */ - int16_t i, j, k, a; /* Integer for loops */ + int16_t i, j, k, a; /* Integer for loops */ int16_t num_new; /* Number of new vertices to add */ float maxAngle; /* Max azimuth tolerance for extend the LS setup horizontaly */ float newDiff; /* Angle differences that will help us set the extended LS setup */ -- GitLab From 5a7ab3ed552a3f548f6b58aa73cc7113c336d73b Mon Sep 17 00:00:00 2001 From: azmill Date: Mon, 24 Jul 2023 14:19:56 +1000 Subject: [PATCH 456/591] Removed too much code when fixing warnings from #620, restoring it back --- lib_rend/ivas_efap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 5663a4ce7c..42ef8beaa3 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -1053,6 +1053,14 @@ static void visible_edges( } } + for ( i = 0; i < maxVertex + 1; ++i ) + { + for ( j = 0; j < maxVertex + 1; ++j ) + { + counter[i][j] = counterTranspose[i][j] + counterTranspose[j][i]; + } + } + /* Finding the edges */ k = 0; -- GitLab From cb82daf932fe12e4ba36b7d9f5eb6470e49f9b32 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Mon, 24 Jul 2023 10:13:59 +0530 Subject: [PATCH 457/591] LS channel allocation and alternative for copying hrtfs --- lib_com/ivas_prot.h | 6 +- lib_dec/ivas_binRenderer_internal.c | 744 +++++++++++++++++++++------- lib_rend/ivas_stat_rend.h | 2 + lib_util/hrtf_file_reader.c | 3 +- 4 files changed, 578 insertions(+), 177 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a46f3c7a96..c195ceab52 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5187,8 +5187,10 @@ void ivas_binaural_hrtf_close( ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i : fastconv HRTF handle */ AUDIO_CONFIG output_config, /* i : ouput audio config */ - BINAURAL_INPUT_AUDIO_CONFIG output_config_bin /* i : binaural input audio config */ - , RENDERER_TYPE renderer_type + BINAURAL_INPUT_AUDIO_CONFIG output_config_bin, /* i : binaural input audio config */ + RENDERER_TYPE renderer_type, + int8_t is_loudspeaker_setup, + int16_t allocate_init_flag ); #endif diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d014312fa6..5868f4a572 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -499,7 +499,9 @@ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, AUDIO_CONFIG output_config, BINAURAL_INPUT_AUDIO_CONFIG input_config, - RENDERER_TYPE renderer_type ) + RENDERER_TYPE renderer_type, + int8_t is_loudspeaker_setup, + int16_t allocate_init_flag ) { int16_t i, j; /*malloc for HOA3, HOA2, FOA*/ @@ -545,23 +547,26 @@ ivas_error ivas_allocate_binaural_hrtf( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); } - for ( j = 0; j < HOA3_CHANNELS; j++ ) + if ( allocate_init_flag == 0 ) { - if ( ( HrtfFastConv->leftHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); - } - if ( ( HrtfFastConv->leftHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); - } - if ( ( HrtfFastConv->rightHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); - } - if ( ( HrtfFastConv->rightHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + for ( j = 0; j < HOA3_CHANNELS; j++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + if ( ( HrtfFastConv->leftHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + } } } } @@ -609,23 +614,26 @@ ivas_error ivas_allocate_binaural_hrtf( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); } - for ( j = 0; j < HOA2_CHANNELS; j++ ) + if ( allocate_init_flag == 0 ) { - if ( ( HrtfFastConv->leftHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); - } - if ( ( HrtfFastConv->leftHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); - } - if ( ( HrtfFastConv->rightHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); - } - if ( ( HrtfFastConv->rightHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + for ( j = 0; j < HOA2_CHANNELS; j++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + if ( ( HrtfFastConv->leftHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->leftHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); + } + if ( ( HrtfFastConv->rightHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + } } } } @@ -673,23 +681,26 @@ ivas_error ivas_allocate_binaural_hrtf( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); } - for ( j = 0; j < FOA_CHANNELS; j++ ) + if ( allocate_init_flag == 0 ) { - if ( ( HrtfFastConv->leftHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); - } - if ( ( HrtfFastConv->leftHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); - } - if ( ( HrtfFastConv->rightHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); - } - if ( ( HrtfFastConv->rightHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + for ( j = 0; j < FOA_CHANNELS; j++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + if ( ( HrtfFastConv->leftHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->leftHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); + } + if ( ( HrtfFastConv->rightHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } } } } @@ -737,88 +748,415 @@ ivas_error ivas_allocate_binaural_hrtf( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); } - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + if ( ( HrtfFastConv->leftHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); + } + if ( ( HrtfFastConv->leftHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); + } + if ( ( HrtfFastConv->rightHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); + } + if ( ( HrtfFastConv->rightHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + } + } + } + } + } + } + if ( allocate_init_flag == 1 ) + { + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && is_loudspeaker_setup == 0 ) /*7_1_4*/ + { + HrtfFastConv->nChannels = 15; + if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) { - if ( ( HrtfFastConv->leftHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); } - if ( ( HrtfFastConv->leftHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); } - if ( ( HrtfFastConv->rightHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); } - if ( ( HrtfFastConv->rightHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) + if ( allocate_init_flag == 0 ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + for ( j = 0; j < HrtfFastConv->nChannels; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } } } } } - } - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) - { - if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) - { - return IVAS_ERR_OK; - } - else + else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && is_loudspeaker_setup == 1 ) /*5_1 and others*/ { - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( output_config == AUDIO_CONFIG_5_1 ) + { + HrtfFastConv->nChannels = 7; + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < HrtfFastConv->nChannels; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } + } + } + else if ( output_config == AUDIO_CONFIG_7_1 ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + HrtfFastConv->nChannels = 5; + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < HrtfFastConv->nChannels; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } + } } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + else if ( output_config == AUDIO_CONFIG_5_1_2 ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + HrtfFastConv->nChannels = 11; + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < HrtfFastConv->nChannels; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } + } } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + else if ( output_config == AUDIO_CONFIG_5_1_4 ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + HrtfFastConv->nChannels = 13; + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < HrtfFastConv->nChannels; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } + } } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + } + } + else if ( allocate_init_flag == 0 ) + { + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + return IVAS_ERR_OK; } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + else { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) + if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); } - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } } } } @@ -838,7 +1176,8 @@ static ivas_error ivas_binaural_hrtf_open( #ifdef FIX_1720_HRTF_FASTCONV , AUDIO_CONFIG output_config, - RENDERER_TYPE renderer_type + RENDERER_TYPE renderer_type, + int8_t is_loudspeaker_setup #endif ) { @@ -881,7 +1220,8 @@ static ivas_error ivas_binaural_hrtf_open( { HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; } - ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, HrtfFastConv->input_cfg_var, renderer_type ); + HrtfFastConv->allocate_init_flag = 1; + ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, HrtfFastConv->input_cfg_var, renderer_type, is_loudspeaker_setup, HrtfFastConv->allocate_init_flag ); #else HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; @@ -894,53 +1234,52 @@ static ivas_error ivas_binaural_hrtf_open( #ifdef FIX_1720_HRTF_FASTCONV if ( renderer_type == RENDERER_BINAURAL_FASTCONV ) { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - mvr2r( leftHRIRReal[i][j], HrtfFastConv->leftHRIRReal[i][j], BINAURAL_NTAPS ); - mvr2r( leftHRIRImag[i][j], HrtfFastConv->leftHRIRImag[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRReal[i][j], HrtfFastConv->rightHRIRReal[i][j], BINAURAL_NTAPS ); - mvr2r( rightHRIRImag[i][j], HrtfFastConv->rightHRIRImag[i][j], BINAURAL_NTAPS ); + HrtfFastConv->leftHRIRReal[i][j] = leftHRIRReal[i][j]; + HrtfFastConv->leftHRIRImag[i][j] = leftHRIRImag[i][j]; + HrtfFastConv->rightHRIRReal[i][j] = rightHRIRReal[i][j]; + HrtfFastConv->rightHRIRImag[i][j] = rightHRIRImag[i][j]; } } if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + for ( j = 0; j < HrtfFastConv->nChannels; j++ ) { - mvr2r( leftBRIRReal[i][j], HrtfFastConv->leftBRIRReal[i][j], BINAURAL_NTAPS_MAX ); - mvr2r( leftBRIRImag[i][j], HrtfFastConv->leftBRIRImag[i][j], BINAURAL_NTAPS_MAX ); - mvr2r( rightBRIRReal[i][j], HrtfFastConv->rightBRIRReal[i][j], BINAURAL_NTAPS_MAX ); - mvr2r( rightBRIRImag[i][j], HrtfFastConv->rightBRIRImag[i][j], BINAURAL_NTAPS_MAX ); + HrtfFastConv->leftBRIRReal[i][j] = leftBRIRReal[i][j]; + HrtfFastConv->leftBRIRImag[i][j] = leftBRIRImag[i][j]; + HrtfFastConv->rightBRIRReal[i][j] = rightBRIRReal[i][j]; + HrtfFastConv->rightBRIRImag[i][j] = rightBRIRImag[i][j]; } } if ( output_config == AUDIO_CONFIG_HOA3 ) { for ( j = 0; j < HOA3_CHANNELS; j++ ) { - mvr2r( leftHRIRReal_HOA3[i][j], HrtfFastConv->leftHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( leftHRIRImag_HOA3[i][j], HrtfFastConv->leftHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( rightHRIRReal_HOA3[i][j], HrtfFastConv->rightHRIRReal_HOA3[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( rightHRIRImag_HOA3[i][j], HrtfFastConv->rightHRIRImag_HOA3[i][j], BINAURAL_NTAPS_SBA ); + HrtfFastConv->leftHRIRReal_HOA3[i][j] = leftHRIRReal_HOA3[i][j]; + HrtfFastConv->leftHRIRImag_HOA3[i][j] = leftHRIRImag_HOA3[i][j]; + HrtfFastConv->rightHRIRReal_HOA3[i][j] = rightHRIRReal_HOA3[i][j]; + HrtfFastConv->rightHRIRImag_HOA3[i][j] = rightHRIRImag_HOA3[i][j]; } } if ( output_config == AUDIO_CONFIG_HOA2 ) { for ( j = 0; j < HOA2_CHANNELS; j++ ) { - mvr2r( leftHRIRReal_HOA2[i][j], HrtfFastConv->leftHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( leftHRIRImag_HOA2[i][j], HrtfFastConv->leftHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( rightHRIRReal_HOA2[i][j], HrtfFastConv->rightHRIRReal_HOA2[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( rightHRIRImag_HOA2[i][j], HrtfFastConv->rightHRIRImag_HOA2[i][j], BINAURAL_NTAPS_SBA ); + HrtfFastConv->leftHRIRReal_HOA2[i][j] = leftHRIRReal_HOA2[i][j]; + HrtfFastConv->leftHRIRImag_HOA2[i][j] = leftHRIRImag_HOA2[i][j]; + HrtfFastConv->rightHRIRReal_HOA2[i][j] = rightHRIRReal_HOA2[i][j]; + HrtfFastConv->rightHRIRImag_HOA2[i][j] = rightHRIRImag_HOA2[i][j]; } } if ( output_config == AUDIO_CONFIG_FOA ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { - mvr2r( leftHRIRReal_FOA[i][j], HrtfFastConv->leftHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( leftHRIRImag_FOA[i][j], HrtfFastConv->leftHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( rightHRIRReal_FOA[i][j], HrtfFastConv->rightHRIRReal_FOA[i][j], BINAURAL_NTAPS_SBA ); - mvr2r( rightHRIRImag_FOA[i][j], HrtfFastConv->rightHRIRImag_FOA[i][j], BINAURAL_NTAPS_SBA ); + HrtfFastConv->leftHRIRReal_FOA[i][j] = leftHRIRReal_FOA[i][j]; + HrtfFastConv->leftHRIRImag_FOA[i][j] = leftHRIRImag_FOA[i][j]; + HrtfFastConv->rightHRIRReal_FOA[i][j] = rightHRIRReal_FOA[i][j]; + HrtfFastConv->rightHRIRImag_FOA[i][j] = rightHRIRImag_FOA[i][j]; } } #else @@ -1202,7 +1541,7 @@ ivas_error ivas_rend_openCldfbRend( } /* Load HRTF tables */ #ifdef FIX_1720_HRTF_FASTCONV - ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV ); + ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup ); #else ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv ); #endif @@ -1308,7 +1647,7 @@ ivas_error ivas_binRenderer_open( /* Load HRTF tables */ #ifdef FIX_1720_HRTF_FASTCONV - ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ); + ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup ); #else ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv ); #endif @@ -1660,16 +1999,19 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) { - free( ( *hHrtfFastConv )->leftHRIRReal[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag[i][j] = NULL; + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag[i][j] = NULL; + } } free( ( *hHrtfFastConv )->leftHRIRReal[i] ); ( *hHrtfFastConv )->leftHRIRReal[i] = NULL; @@ -1689,53 +2031,101 @@ void ivas_binaural_hrtf_close( free( ( *hHrtfFastConv )->rightHRIRImag ); ( *hHrtfFastConv )->rightHRIRImag = NULL; } - if ( ( *hHrtfFastConv )->leftBRIRReal != NULL && ( *hHrtfFastConv )->leftBRIRImag != NULL && ( *hHrtfFastConv )->rightBRIRReal != NULL && ( *hHrtfFastConv )->rightBRIRImag != NULL ) + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) { - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + if ( ( *hHrtfFastConv )->leftBRIRReal != NULL && ( *hHrtfFastConv )->leftBRIRImag != NULL && ( *hHrtfFastConv )->rightBRIRReal != NULL && ( *hHrtfFastConv )->rightBRIRImag != NULL ) { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftBRIRReal[i][j] ); + ( *hHrtfFastConv )->leftBRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag[i][j] ); + ( *hHrtfFastConv )->leftBRIRImag[i][j] = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal[i][j] ); + ( *hHrtfFastConv )->rightBRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag[i][j] ); + ( *hHrtfFastConv )->rightBRIRImag[i][j] = NULL; + } + } + free( ( *hHrtfFastConv )->leftBRIRReal[i] ); + ( *hHrtfFastConv )->leftBRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag[i] ); + ( *hHrtfFastConv )->leftBRIRImag[i] = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal[i] ); + ( *hHrtfFastConv )->rightBRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag[i] ); + ( *hHrtfFastConv )->rightBRIRImag[i] = NULL; + } + free( ( *hHrtfFastConv )->leftBRIRReal ); + ( *hHrtfFastConv )->leftBRIRReal = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag ); + ( *hHrtfFastConv )->leftBRIRImag = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal ); + ( *hHrtfFastConv )->rightBRIRReal = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag ); + ( *hHrtfFastConv )->rightBRIRImag = NULL; + } + } + if ( ( *hHrtfFastConv )->allocate_init_flag == 1 ) + { + if ( ( *hHrtfFastConv )->leftBRIRReal != NULL && ( *hHrtfFastConv )->leftBRIRImag != NULL && ( *hHrtfFastConv )->rightBRIRReal != NULL && ( *hHrtfFastConv )->rightBRIRImag != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - free( ( *hHrtfFastConv )->leftBRIRReal[i][j] ); - ( *hHrtfFastConv )->leftBRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag[i][j] ); - ( *hHrtfFastConv )->leftBRIRImag[i][j] = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal[i][j] ); - ( *hHrtfFastConv )->rightBRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag[i][j] ); - ( *hHrtfFastConv )->rightBRIRImag[i][j] = NULL; - } - free( ( *hHrtfFastConv )->leftBRIRReal[i] ); - ( *hHrtfFastConv )->leftBRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag[i] ); - ( *hHrtfFastConv )->leftBRIRImag[i] = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal[i] ); - ( *hHrtfFastConv )->rightBRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag[i] ); - ( *hHrtfFastConv )->rightBRIRImag[i] = NULL; - } - free( ( *hHrtfFastConv )->leftBRIRReal ); - ( *hHrtfFastConv )->leftBRIRReal = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag ); - ( *hHrtfFastConv )->leftBRIRImag = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal ); - ( *hHrtfFastConv )->rightBRIRReal = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag ); - ( *hHrtfFastConv )->rightBRIRImag = NULL; + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) + { + for ( j = 0; j < ( *hHrtfFastConv )->nChannels; j++ ) + { + free( ( *hHrtfFastConv )->leftBRIRReal[i][j] ); + ( *hHrtfFastConv )->leftBRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag[i][j] ); + ( *hHrtfFastConv )->leftBRIRImag[i][j] = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal[i][j] ); + ( *hHrtfFastConv )->rightBRIRReal[i][j] = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag[i][j] ); + ( *hHrtfFastConv )->rightBRIRImag[i][j] = NULL; + } + } + free( ( *hHrtfFastConv )->leftBRIRReal[i] ); + ( *hHrtfFastConv )->leftBRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag[i] ); + ( *hHrtfFastConv )->leftBRIRImag[i] = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal[i] ); + ( *hHrtfFastConv )->rightBRIRReal[i] = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag[i] ); + ( *hHrtfFastConv )->rightBRIRImag[i] = NULL; + } + free( ( *hHrtfFastConv )->leftBRIRReal ); + ( *hHrtfFastConv )->leftBRIRReal = NULL; + free( ( *hHrtfFastConv )->leftBRIRImag ); + ( *hHrtfFastConv )->leftBRIRImag = NULL; + free( ( *hHrtfFastConv )->rightBRIRReal ); + ( *hHrtfFastConv )->rightBRIRReal = NULL; + free( ( *hHrtfFastConv )->rightBRIRImag ); + ( *hHrtfFastConv )->rightBRIRImag = NULL; + } } if ( ( *hHrtfFastConv )->leftHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA3 != NULL ) { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HOA3_CHANNELS; j++ ) + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) { - free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] = NULL; + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] = NULL; + } } free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i] ); ( *hHrtfFastConv )->leftHRIRReal_HOA3[i] = NULL; @@ -1759,16 +2149,19 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < HOA2_CHANNELS; j++ ) + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) { - free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] = NULL; + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] = NULL; + } } free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i] ); ( *hHrtfFastConv )->leftHRIRReal_HOA2[i] = NULL; @@ -1792,16 +2185,19 @@ void ivas_binaural_hrtf_close( { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - for ( j = 0; j < FOA_CHANNELS; j++ ) + if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) { - free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] = NULL; + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] ); + ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] = NULL; + free( ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] ); + ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] ); + ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] = NULL; + free( ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] ); + ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] = NULL; + } } free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i] ); ( *hHrtfFastConv )->leftHRIRReal_FOA[i] = NULL; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9318ad36a0..56294ae114 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1021,6 +1021,8 @@ typedef struct ivas_hrtfs_fastconv_struct float ***rightHRIRImag_FOA; float FASTCONV_FOA_latency_s; BINAURAL_INPUT_AUDIO_CONFIG input_cfg_var; + int16_t allocate_init_flag; + int16_t nChannels; #else #ifdef UPDATE_FASTCONV_SBA_FILTER float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index a18c653ce8..fd7e339084 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1057,7 +1057,8 @@ static ivas_error create_fastconv_HRTF_from_rawdata( char *hrtf_data_rptr; #ifdef FIX_1720_HRTF_FASTCONV ( *hHRTF )->input_cfg_var = input_cfg; - ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type ); + ( *hHRTF )->allocate_init_flag = 0; + ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type, 0, ( *hHRTF )->allocate_init_flag ); #endif // if ( hHRTF == NULL ) -- GitLab From 94dfbd9e931a9886e3d54cdd7fa03f21801772dc Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Mon, 24 Jul 2023 09:11:26 +0200 Subject: [PATCH 458/591] [fix] issue 616: UBSAN division by zero error in MCT --- lib_com/options.h | 2 ++ lib_enc/ivas_mct_core_enc.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b35772ecc1..886c8e5acb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -211,6 +211,8 @@ #define FIX_622_SILENCE_USAN_WARNING /* FhG: silenceusan warning in ifft code */ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ +#define FIX_616_DIV_ZERO_MCT /*FhG : Fix UBSAN division by zero error of issue 616*/ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 0c98f82d05..2a048ed2ea 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -143,8 +143,13 @@ static void AdjustChannelRatios( } for ( i = 3; i < nChannels; i++ ) { +#ifdef FIX_616_DIV_ZERO_MCT + cur_ratio = (float) chBitRatios[i] / ( sum_ratio + FLT_MIN ); + tar_ratio = (float) force_ch_bit_ratios[i] / ( sum_tar_ratio + FLT_MIN ); +#else cur_ratio = (float) chBitRatios[i] / sum_ratio; tar_ratio = (float) force_ch_bit_ratios[i] / sum_tar_ratio; +#endif tar_ratio = min( tar_ratio, cur_ratio ); chBitRatios[i] = (int16_t) ( tar_ratio * sum_tar_ratio ); @@ -196,7 +201,7 @@ void ivas_mct_core_enc( int16_t ch, ch_core, nSubframes, L_subframeTCX; int16_t i, cpe_id, n, nAvailBits; int16_t nCPE; - float *orig_spectrum[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */ + float *orig_spectrum[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */ float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k]; float powerSpecMsInv_long[MCT_MAX_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */ float *powerSpecMsInv[MCT_MAX_CHANNELS][2]; -- GitLab From beac45cea6abdbea12b2fc9d9f36608767097796 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 24 Jul 2023 09:35:35 +0200 Subject: [PATCH 459/591] initial support for parambin renderer in split rendering in decoder. switch: SPLIT_REND_WITH_HEAD_ROT_PARAMBIN --- lib_com/options.h | 3 + lib_dec/ivas_dec.c | 19 + lib_dec/ivas_dirac_dec.c | 79 +- lib_dec/ivas_init_dec.c | 46 +- lib_dec/ivas_ism_dec.c | 9 +- lib_dec/ivas_ism_param_dec.c | 13 + lib_dec/ivas_masa_dec.c | 39 + lib_dec/ivas_mct_dec.c | 8 + lib_dec/ivas_sba_dec.c | 21 + lib_dec/ivas_stat_dec.h | 4 + lib_rend/ivas_dirac_dec_binaural_functions.c | 1003 ++++++++++++++--- lib_rend/lib_rend.c | 22 +- tests/split_rendering/test_split_rendering.py | 8 +- 13 files changed, 1120 insertions(+), 154 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b35772ecc1..e8a5a8b4d1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -211,6 +211,9 @@ #define FIX_622_SILENCE_USAN_WARNING /* FhG: silenceusan warning in ifft code */ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ +#define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN /* Nokia: Issue 623: Split rendering support for parambin renderer */ +#define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT /* Nokia: Issue 623: Split rendering support for parambin renderer, computational optimization */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 5ca878a00e..e945f04525 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -124,10 +124,20 @@ ivas_error ivas_dec( if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN assert( ( st_ivas->ivas_format == SBA_FORMAT || + st_ivas->ivas_format == MASA_FORMAT || + st_ivas->ivas_format == ISM_FORMAT || + st_ivas->ivas_format == MC_FORMAT ) && + ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, MASA, discrete and parametric ISM, or MC formats and 48 kHz sampling rate only" ); +#else + assert( ( st_ivas->ivas_format == SBA_FORMAT || + st_ivas->ivas_format == MASA_FORMAT || + st_ivas->ivas_format == ISM_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) && ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); +#endif ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits ); } #endif @@ -845,6 +855,11 @@ ivas_error ivas_dec( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; int16_t max_band; int16_t pcm_out; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + int16_t td_input; + + td_input = st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC; +#endif hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; @@ -857,7 +872,11 @@ ivas_error ivas_dec( hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, max_band, output, 1, +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + td_input, +#else st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV, +#endif pcm_out ); free( st_ivas->splitBinRend.hMultiBinCldfbData ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 766f4ff08f..3e9987e5da 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -826,7 +826,11 @@ ivas_error ivas_dirac_dec_config( if ( !need_parambin ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); +#endif } need_dirac_rend = 0; @@ -870,13 +874,48 @@ ivas_error ivas_dirac_dec_config( { if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + /* populate pMultiBinPoseData with the additional poses determined from the DoF */ + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + } +#endif if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } } - +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + /* TODO: can we keep isRenderingInTd fixed? */ + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, + 0, /* isRenderingInTd */ + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* pcm_out */ + + error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + st_ivas->hDecoderConfig->output_Fs, + 1, /* is_cldfb_in */ + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* is_pcm_out */ + + if ( error != IVAS_ERR_OK ) + { + return error; + } + } +#endif +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0] == NULL ) +#else if ( st_ivas->hDiracDecBin == NULL ) +#endif { if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -886,24 +925,55 @@ ivas_error ivas_dirac_dec_config( else { /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) +#else if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) +#endif { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ); +#else ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); +#endif } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) +#endif { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + /* copy td-decorr flag to split renderer side rendereres */ + for ( int16_t pos_idx = 1; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ ) + { + st_ivas->hDiracDecBin[pos_idx]->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr; + } + + if ( !st_ivas->hDiracDecBin[0]->useTdDecorr ) +#else if ( !st_ivas->hDiracDecBin->useTdDecorr ) +#endif { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params == NULL ) +#else if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) +#endif { float frequency_axis[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ), + &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ), +#else if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), +#endif st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, @@ -917,7 +987,14 @@ ivas_error ivas_dirac_dec_config( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + for ( int16_t pos_idx = 0; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ ) + { + st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + } +#else st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif } } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 616069f25f..2087e7c9e4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1319,6 +1319,16 @@ ivas_error ivas_init_decoder( /* ParamISM is handled separately from other common config */ else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + } +#endif if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1331,6 +1341,26 @@ ivas_error ivas_init_decoder( { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + error = +#endif + ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + hDecoderConfig->output_Fs, + 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + +#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING + if ( error != IVAS_ERR_OK ) + { + return error; + } +#endif + } +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -1820,7 +1850,14 @@ void ivas_initialize_handles_dec( st_ivas->splitBinRend.hSplitRendBits = NULL; ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend ); #endif +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) + { + st_ivas->hDiracDecBin[i] = NULL; + } +#else st_ivas->hDiracDecBin = NULL; +#endif st_ivas->hDirACRend = NULL; st_ivas->hSpatParamRendCom = NULL; st_ivas->hLsSetUpConversion = NULL; @@ -1984,7 +2021,11 @@ void ivas_destroy_dec( #endif /* Parametric binaural renderer handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); +#endif /* Crend handle */ ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) @@ -2103,8 +2144,11 @@ void ivas_init_dec_get_num_cldfb_instances( { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } - +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0]->useTdDecorr ) +#else if ( st_ivas->hDiracDecBin->useTdDecorr ) +#endif { *numCldfbAnalyses += 2; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index fa5783d90a..95cf886cb3 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -178,8 +178,11 @@ static ivas_error ivas_ism_bitrate_switching( #endif { /* close the parametric binaural renderer */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - +#endif /* Open the TD Binaural renderer */ if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) { @@ -221,7 +224,11 @@ static ivas_error ivas_ism_bitrate_switching( #endif { /* close the parametric binaural renderer */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); +#endif /* Open Crend Binaural renderer */ if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 4662304a4a..1e8b2f3083 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -386,7 +386,11 @@ static ivas_error ivas_param_ism_rendering_init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM) ) +#else if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) +#endif { /* computation of proto matrix */ ivas_ism_get_proto_matrix( hOutSetup, nchan_transport, hParamIsmRendering->proto_matrix ); @@ -540,8 +544,13 @@ ivas_error ivas_param_ism_dec_open( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || + output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) +#endif { /* Initialize efap handle */ if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth, hOutSetup.ls_elevation, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) @@ -559,7 +568,11 @@ ivas_error ivas_param_ism_dec_open( hSpatParamRendCom->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) +#endif { if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 4a6053ccd5..ca48e4bdf2 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -971,6 +971,9 @@ ivas_error ivas_masa_dec_reconfigure( int32_t ivas_total_brate, last_ivas_total_brate; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; ivas_error error; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + int16_t pos_idx; +#endif error = IVAS_ERR_OK; @@ -982,7 +985,11 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] == NULL ) ) +#else if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) +#endif { /* init a new DirAC dec */ if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) @@ -995,7 +1002,11 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->hDirAC != NULL ) { /* close all unnecessary parametric decoding and rendering */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); +#endif ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); @@ -1019,7 +1030,11 @@ ivas_error ivas_masa_dec_reconfigure( sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hSCE[sce_id]->element_brate / FRAMES_PER_SEC ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) +#else if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) +#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1046,7 +1061,11 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = 1; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) ) +#else if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) +#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1058,7 +1077,11 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = CPE_CHANNELS; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) ) +#else if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) +#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1068,10 +1091,22 @@ ivas_error ivas_masa_dec_reconfigure( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + if ( st_ivas->hDiracDecBin[pos_idx] != NULL ) + { +#else if ( st_ivas->hDiracDecBin != NULL ) { +#endif /* regularization factor is bitrate-dependent */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + } +#else st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif } /*-----------------------------------------------------------------* @@ -1149,7 +1184,11 @@ void ivas_spar_param_to_masa_param_mapping( hDirAC = st_ivas->hDirAC; hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSpatParamRendCom->numSimultaneousDirections = 1; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + hDiffuseDist = st_ivas->hDiracDecBin[0]->hDiffuseDist; /* TODO: this may need to use different pose indices */ +#else hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; +#endif nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; hSpar = st_ivas->hSpar; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index e99cf63fa6..f31aff2327 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1161,11 +1161,19 @@ static ivas_error ivas_mc_dec_reconfig( ivas_td_binaural_close( &st_ivas->hBinRendererTd ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0] != NULL ) +#else if ( st_ivas->hDiracDecBin != NULL ) +#endif { if ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); +#endif } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 763a1b222f..5659a96b24 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -357,12 +357,21 @@ ivas_error ivas_sba_dec_reconfigure( * TD Decorrelator *-----------------------------------------------------------------*/ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0] != NULL ) + { + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( st_ivas->hDiracDecBin != NULL ) { if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } +#endif } /*-----------------------------------------------------------------* @@ -450,7 +459,11 @@ ivas_error ivas_sba_dec_digest_tc( ivas_spar_dec_digest_tc( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0] != NULL && ( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) +#else if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) +#endif { int16_t nSamplesLeftForTD, default_frame; float *decorr_signal[BINAURAL_CHANNELS]; @@ -468,9 +481,17 @@ ivas_error ivas_sba_dec_digest_tc( while ( nSamplesLeftForTD ) { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0]->hTdDecorr ) +#else if ( st_ivas->hDiracDecBin->hTdDecorr ) +#endif { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_td_decorr_process( st_ivas->hDiracDecBin[0]->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); +#else ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); +#endif } for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5c70409ac2..003a45056c 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -997,7 +997,11 @@ typedef struct Decoder_Struct BINAURAL_RENDERER_HANDLE hBinRenderer; /* fastconv binaural renderer handle */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; /* Time domain binaural object renderer handle */ TDREND_HRFILT_FiltSet_t *hHrtfTD; /* pointer to HRTF data for TD renderer */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + DIRAC_DEC_BIN_HANDLE hDiracDecBin[MAX_HEAD_ROT_POSES]; /* parametric binaural renderer handle */ +#else DIRAC_DEC_BIN_HANDLE hDiracDecBin; /* parametric binaural renderer handle */ +#endif LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; /* MC LS configuration convertion handle */ EFAP_HANDLE hEFAPdata; /* EFAP structure */ VBAP_HANDLE hVBAPdata; /* VBAP structure */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 8a3f33b80b..258a8bf7d8 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -95,11 +95,26 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT +static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, const int16_t isHeadtracked, float *subFrameTotalEne, float *IIReneLimiter ); +static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const float *subFrameTotalEne, const float *IIReneLimiter ); +#else static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); +#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN +static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], + float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe, + float outRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float outIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float reverbRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float decorrRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const uint8_t recompute ); +#else static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); +#endif static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); @@ -138,143 +153,169 @@ ivas_error ivas_dirac_dec_init_binaural_data( float binCenterFreq, tmpFloat; ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + int16_t pos_idx; + for ( pos_idx = 0; pos_idx < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ ) + { + hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; +#else hDiracDecBin = st_ivas->hDiracDecBin; +#endif - if ( hDiracDecBin == NULL ) - { - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + if ( hDiracDecBin == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + } + + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; } - hDiracDecBin->hTdDecorr = NULL; - hDiracDecBin->hReverb = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; - } + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nBins = st_ivas->hSpatParamRendCom->num_freq_bands; + renderer_type = st_ivas->renderer_type; - output_Fs = st_ivas->hDecoderConfig->output_Fs; - nBins = st_ivas->hSpatParamRendCom->num_freq_bands; - renderer_type = st_ivas->renderer_type; + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) + { + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); + } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) + { + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); + } + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + } + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + + + for ( bin = 0; bin < nBins; bin++ ) { - set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); + binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); + /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ + tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); } - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) + for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) { - set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); + hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; + hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; + hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; } - set_zero( hDiracDecBin->ChEnePrev[j], nBins ); - set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); - } - set_zero( hDiracDecBin->ChCrossRePrev, nBins ); - set_zero( hDiracDecBin->ChCrossImPrev, nBins ); - set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); - set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); - for ( bin = 0; bin < nBins; bin++ ) - { - binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); - /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); - } + /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ + if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || + ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + { + ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); + } - for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) - { - hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; - hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; - hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; - } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ +#else + if ( hDiracDecBin->hReverb == NULL ) +#endif + { + if ( ( error = ivas_binaural_reverb_open( &hDiracDecBin->hReverb, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, + st_ivas->hIntSetup.output_config, + output_Fs, + RENDERER_BINAURAL_PARAMETRIC_ROOM, + st_ivas->hHrtfFastConv, + st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ - { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + + if ( hDiracDecBin->hTdDecorr == NULL ) + { + hDiracDecBin->useTdDecorr = 0; + } - /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || - ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) { - ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); + ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } - if ( hDiracDecBin->hReverb == NULL ) +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( pos_idx == 0) /* open decorrelator only for the main direction */ { - if ( ( error = ivas_binaural_reverb_open( &hDiracDecBin->hReverb, - nBins, - CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, - st_ivas->hIntSetup.output_config, - output_Fs, - RENDERER_BINAURAL_PARAMETRIC_ROOM, - st_ivas->hHrtfFastConv, - st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } + if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) + { + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN } - } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; - } - else /* Not valid renderer type for this renderer */ - { - assert( false ); - } - - hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ - - if ( hDiracDecBin->hTdDecorr == NULL ) - { - hDiracDecBin->useTdDecorr = 0; - } - - if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) - { - ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); - } - - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) - { - ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) + else { - return error; + hDiracDecBin->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr; /* copy the flag, but the implementation re-uses the decorrelated signal */ } - } +#endif - hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + st_ivas->hDiracDecBin[pos_idx] = hDiracDecBin; + } +#else st_ivas->hDiracDecBin = hDiracDecBin; +#endif /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) @@ -302,11 +343,31 @@ void ivas_dirac_dec_close_binaural_data( DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + int16_t pos_idx; +#endif if ( hBinaural == NULL || *hBinaural == NULL ) { return; } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + if ( hBinaural[pos_idx] != NULL ) + { + if ( hBinaural[pos_idx]->hReverb != NULL ) + { + ivas_binaural_reverb_close( &( hBinaural[pos_idx]->hReverb ) ); + } + + ivas_td_decorr_dec_close( &( hBinaural[pos_idx]->hTdDecorr ) ); + + free( hBinaural[pos_idx] ); + hBinaural[pos_idx] = NULL; + } + } +#else if ( ( *hBinaural )->hReverb != NULL ) { ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); @@ -320,6 +381,7 @@ void ivas_dirac_dec_close_binaural_data( free( *hBinaural ); *hBinaural = NULL; +#endif return; } @@ -423,6 +485,7 @@ void ivas_dirac_dec_binaural_render( { int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe_idx]; ivas_dirac_dec_binaural_internal( st_ivas, st_ivas->hCombinedOrientationData, output_f_local, nchan_transport, subframe_idx ); + for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] += n_samples_sf; @@ -519,8 +582,11 @@ void ivas_dirac_dec_binaural( { ivas_spar_dec_set_render_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); } - +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0]->useTdDecorr ) +#else if ( st_ivas->hDiracDecBin->useTdDecorr ) +#endif { float *decorr_signal[BINAURAL_CHANNELS]; int16_t output_frame; @@ -532,7 +598,11 @@ void ivas_dirac_dec_binaural( } output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_td_decorr_process( st_ivas->hDiracDecBin[0]->hTdDecorr, p_output, decorr_signal, output_frame ); +#else ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_output, decorr_signal, output_frame ); +#endif } if ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) @@ -588,13 +658,31 @@ static void ivas_dirac_dec_binaural_internal( 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; + float tmp_Cldfb_out_re[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float tmp_Cldfb_out_im[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + /* these allow re-using the reverb and freq-domain decorrelator signals from ivas_dirac_dec_binaural_process_output() in split rendering for the side renderings */ + float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float decorrRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float decorrIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT + float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; + float IIReneLimiter[CLDFB_NO_CHANNELS_MAX]; +#endif + + hDiracDecBin = st_ivas->hDiracDecBin[0]; +#else hDiracDecBin = st_ivas->hDiracDecBin; +#endif assert( hDiracDecBin ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; nBins = hSpatParamRendCom->num_freq_bands; offsetSamples = hSpatParamRendCom->slots_rendered * nBins; - /* Setuo internal config */ + /* Setup internal config */ config_data.separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; config_data.ivas_format = st_ivas->ivas_format; config_data.mc_mode = st_ivas->mc_mode; @@ -726,7 +814,6 @@ static void ivas_dirac_dec_binaural_internal( hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); - ivas_sba_prototype_renderer( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); } @@ -742,14 +829,19 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + /* in case of split rendering, determine the prototype rotation based on the main direction and use the same prototypes for the offset directions */ +#endif adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); } } +#ifndef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); +#endif if ( config_data.ivas_format == ISM_FORMAT ) { @@ -764,13 +856,121 @@ static void ivas_dirac_dec_binaural_internal( max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT + ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, + subFrameTotalEne, IIReneLimiter ); + ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, + subFrameTotalEne, IIReneLimiter ); +#else + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); +#endif +#endif ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); - ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData; + + if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 ) + { + ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im, + reverbRe, reverbIm, decorrRe, decorrIm, 1 ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) + { + mvr2r(tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); + mvr2r(tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); + } + } + } + else + { + ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + max_band_decorr, numInChannels, config_data.processReverb, subframe, NULL, NULL, + reverbRe, reverbIm, decorrRe, decorrIm, 1 ); + } +#endif hDiracDecBin->hDiffuseDist = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 ) + { + /* quaternion-based rotation from ivas_binRenderer_internal.c:ivas_binRenderer(), but using absolute rotation instead of delta rotations */ + IVAS_QUATERNION Quaternions_rot, Quaternions_abs, *Quaternions_ref; + float Rmat_local[3][3]; + + if ( hCombinedOrientationData ) + { + Quaternions_ref = &hCombinedOrientationData->Quaternions[0]; + Quaternions_rot.w = -3.0f; /* signal to use Euler */ + Quaternions_abs.w = -3.0f; /* signal to use Euler */ + Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ + + for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) + { + Quaternions_rot.x = Quaternions_abs.x + pMultiBinPoseData->relative_head_poses[pos_idx][0]; + Quaternions_rot.y = Quaternions_abs.y + pMultiBinPoseData->relative_head_poses[pos_idx][1]; + Quaternions_rot.z = Quaternions_abs.z + pMultiBinPoseData->relative_head_poses[pos_idx][2]; + + QuatToRotMat( Quaternions_rot, Rmat_local ); + + hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; + assert(hDiracDecBin != NULL && "No DiracDecBin handle for this position"); + if ( config_data.ivas_format == SBA_FORMAT ) + { + hDiracDecBin->hDiffuseDist = &diffuseDistData; + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT + /* re-use input covariance for the side renderings */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + mvr2r(st_ivas->hDiracDecBin[0]->ChEne[ch], hDiracDecBin->ChEne[ch], hSpatParamRendCom->num_freq_bands); + } + mvr2r(st_ivas->hDiracDecBin[0]->ChCrossRe, hDiracDecBin->ChCrossRe, hSpatParamRendCom->num_freq_bands); + mvr2r(st_ivas->hDiracDecBin[0]->ChCrossIm, hDiracDecBin->ChCrossIm, hSpatParamRendCom->num_freq_bands); + + ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat_local, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, + subFrameTotalEne, IIReneLimiter ); + +#else + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat_local, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); +#endif + + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_local, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); + + /* re-use reverb and decorr from main direction for the sides */ + ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im, + reverbRe, reverbIm, + decorrRe, decorrIm, 0); + + /* copy from temporary buffer to the main split rendering buffer */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) + { + mvr2r(tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); + mvr2r(tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); + } + } + + hDiracDecBin->hDiffuseDist = NULL; + } + } + } + /* update this counter only after the last rendering of split directions */ +#endif hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; hSpatParamRendCom->subframes_rendered++; @@ -832,36 +1032,29 @@ static void ivas_dirac_dec_decorrelate_slot( return; } - -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT +static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float Rmat[3][3], const int16_t subframe, - const int16_t isHeadtracked ) + const int16_t isHeadtracked, + float *subFrameTotalEne, + float *IIReneLimiter ) { int16_t ch, slot, bin; - int16_t separateCenterChannelRendering; - int16_t nBins, idx; - float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + int16_t nBins; float IIReneLimiterFactor; float qualityBasedSmFactor; float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; uint8_t applyLowBitRateEQ; - int16_t dirac_read_idx; - float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; - PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; IVAS_FORMAT ivas_format; - MC_MODE mc_mode; int32_t ivas_total_brate; int16_t nchan_transport; - separateCenterChannelRendering = hConfig->separateCenterChannelRendering; ivas_format = hConfig->ivas_format; - mc_mode = hConfig->mc_mode; ivas_total_brate = hConfig->ivas_total_brate; nchan_transport = hConfig->nchan_transport; qualityBasedSmFactor = hConfig->qualityBasedSmFactor; @@ -870,20 +1063,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric set_zero( hDiracDecBin->ChCrossRe, nBins ); set_zero( hDiracDecBin->ChCrossIm, nBins ); - set_zero( hDiracDecBin->ChCrossReOut, nBins ); - set_zero( hDiracDecBin->ChCrossImOut, nBins ); for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { set_zero( hDiracDecBin->ChEne[ch], nBins ); - set_zero( hDiracDecBin->ChEneOut[ch], nBins ); - } - set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); - - set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); - - for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) - { - gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ } /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ @@ -909,7 +1091,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; /* Calculate input covariance matrix */ for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) @@ -964,6 +1145,96 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); + } + for ( bin = 0; bin < nBins; bin++ ) + { + float eneRatio; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); + IIReneLimiter[bin] = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); + + hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; + } + + hDiracDecBin->ChCrossRe[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossRePrev[bin]; + hDiracDecBin->ChCrossIm[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossImPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne[ch][bin] += IIReneLimiter[bin] * hDiracDecBin->ChEnePrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; + hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; + } + } + + return; +} + +static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, + float Rmat[3][3], + const int16_t subframe, + const int16_t isHeadtracked, + const float *subFrameTotalEne, + const float *IIReneLimiter ) +{ + int16_t ch, bin; + int16_t separateCenterChannelRendering; + int16_t nBins, idx; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + float qualityBasedSmFactor; + int16_t dirac_read_idx; + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + qualityBasedSmFactor = hConfig->qualityBasedSmFactor; + qualityBasedSmFactor *= qualityBasedSmFactor; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + + set_zero( hDiracDecBin->ChCrossReOut, nBins ); + set_zero( hDiracDecBin->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( hDiracDecBin->ChEneOut[ch], nBins ); + } + set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) + { + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + } + + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + /* Determine target covariance matrix containing target binaural properties */ for ( bin = 0; bin < nBins; bin++ ) { @@ -1187,14 +1458,400 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); } - /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ - if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); - } - else + for ( bin = 0; bin < nBins; bin++ ) { - IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); + hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; + } + + hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossReOutPrev[bin]; + hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossImOutPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter[bin] * hDiracDecBin->ChEneOutPrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; + hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; + } + } + + return; +} + +#else +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float Rmat[3][3], + const int16_t subframe, + const int16_t isHeadtracked ) +{ + int16_t ch, slot, bin; + int16_t separateCenterChannelRendering; + int16_t nBins, idx; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + float IIReneLimiterFactor; + float qualityBasedSmFactor; + float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; + uint8_t applyLowBitRateEQ; + int16_t dirac_read_idx; + float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; + + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + qualityBasedSmFactor = hConfig->qualityBasedSmFactor; + qualityBasedSmFactor *= qualityBasedSmFactor; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + + set_zero( hDiracDecBin->ChCrossRe, nBins ); + set_zero( hDiracDecBin->ChCrossIm, nBins ); + set_zero( hDiracDecBin->ChCrossReOut, nBins ); + set_zero( hDiracDecBin->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( hDiracDecBin->ChEne[ch], nBins ); + set_zero( hDiracDecBin->ChEneOut[ch], nBins ); + } + set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) + { + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + } + + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ + applyLowBitRateEQ = 0; + if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + applyLowBitRateEQ = 1; + if ( ivas_total_brate == IVAS_16k4 ) + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; + } + } + else + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; + } + } + } + + /* Formulate input and target covariance matrices for this subframe */ + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + + /* Calculate input covariance matrix */ + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float instEne; + + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + hDiracDecBin->ChEne[ch][bin] += instEne; + subFrameTotalEne[bin] += instEne; + } + hDiracDecBin->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + hDiracDecBin->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; + } + } + + /* Apply EQ at low bit rates */ + if ( applyLowBitRateEQ ) + { + int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; + + for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[bin]; + } + for ( ; bin < nBins; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; + } + } + + if ( ivas_format == SBA_FORMAT && nchan_transport == 2 ) + { + float tempRe, tempIm; + + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + tempRe = inRe[0][slot][bin] + inRe[1][slot][bin]; + tempIm = inIm[0][slot][bin] + inIm[1][slot][bin]; + subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; + } + } + } + + /* Determine target covariance matrix containing target binaural properties */ + for ( bin = 0; bin < nBins; bin++ ) + { + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ + float diffEne, dirEne, meanEnePerCh; + int16_t dirIndex; + + /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. + * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the + * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match + * the early spectrum of the BRIR data, using the spectral correction data in + * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ + meanEnePerCh = hDiracDecBin->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + + /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + for ( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) + { + int16_t aziDeg, eleDeg; + float lRealp, lImagp, rRealp, rImagp; + float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; + float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; + + if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ + { + aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; + ratio = hSpatParamRendCom->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence[dirac_read_idx][bin]; + } + else /* For second of the two simultaneous directions */ + { + if ( ( ratio = hSpatParamRendCom->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) + { + /* This touches only MASA path where second direction always has smaller ratio and + * for non-2dir it is zero. As the whole direction contribution is multiplied with + * the ratio, a very small ratio does not contribute any energy to output. Thus, + * it is better to save complexity. */ + continue; + } + aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence2[dirac_read_idx][bin]; + } + diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ + + if ( separateCenterChannelRendering ) + { + /* In masa + mono rendering mode, the center directions originate from phantom sources, so the + * spread coherence is increased */ + float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; + + aziRad = (float) aziDeg * PI_OVER_180; + eleRad = (float) eleDeg * PI_OVER_180; + doaVectorX = cosf( aziRad ) * cosf( eleRad ); + spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; + altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); + spreadCoh = max( spreadCoh, altSpreadCoh ); + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); + + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + /* Synthesizing spread coherence is not needed for stereo loudspeaker output, + * as directional sound is reproduced with two loudspeakers in any case */ + spreadCoh = 0.0f; + } + + if ( spreadCoh > 0.0f ) + { + float centerMul, sidesMul; + float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; + float w1, w2, w3, eq; + + hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. + * The following formulas determine the gains for these sources. + * spreadCoh = 0: Only panning + * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) + * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ + if ( spreadCoh < 0.5f ) + { + /* 0.0f < spreadCoh < 0.5f */ + sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ + centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; + } + else + { + /* 0.5f <= spreadCoh < 1.0f */ + centerMul = 2.0f - ( 2.0f * spreadCoh ); + sidesMul = inv_sqrt( centerMul + 2.0f ); + centerMul *= sidesMul; + } + + /* Apply the gain for the center source of the three coherent sources */ + lRealp *= centerMul; + lImagp *= centerMul; + rRealp *= centerMul; + rImagp *= centerMul; + + /* Apply the gain for the left source of the three coherent sources */ + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); + + hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Apply the gain for the right source of the three coherent sources. + * -30 degrees to 330 wrapping due to internal functions. */ + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); + + hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ + hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + + ( hrtfEneCenter * centerMul * centerMul ) ) / + max( 1e-12f, hrtfEneRealized ); + + /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ + if ( spreadCoh < 0.5 ) + { + w1 = 1.0f - 2.0f * spreadCoh; + w2 = 2.0f * spreadCoh; + w3 = 0.0f; + } + else + { + w1 = 0.0f; + w2 = 2.0f - 2.0f * spreadCoh; + w3 = 2.0f * spreadCoh - 1.0f; + } + + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + + /* Apply the target spectrum to the eneCorrectionFactor */ + if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ + { + eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; + } + else + { + eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; + } + } + + /* Equalize the spread coherent combined HRTFs */ + eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); + lRealp *= eq; + lImagp *= eq; + rRealp *= eq; + rImagp *= eq; + } + + hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); + hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); + hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); + hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); + + /* Add direct part (1 or 2) covariance matrix */ + dirEne = ratio * meanEnePerCh; + hDiracDecBin->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + hDiracDecBin->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + hDiracDecBin->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + hDiracDecBin->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + } + + /* Add diffuse / ambient part covariance matrix */ + diffuseness = max( 0.0f, diffuseness ); + diffEne = diffuseness * meanEnePerCh; + surCoh = hSpatParamRendCom->surroundingCoherence[dirac_read_idx][bin]; + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + { + if ( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; + } + } + hDiracDecBin->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + hDiracDecBin->ChEneOut[1][bin] += diffEne; + + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ + hDiracDecBin->ChCrossReOut[bin] += surCoh * diffEne; + } + else /* When rendering binaural, ambience has frequency dependent ICC. */ + { + if ( ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + { + float diffuseFieldCoherence; + diffuseFieldCoherence = hDiracDecBin->hDiffuseDist->diffuseRatioX[bin] * hDiracDecBin->diffuseFieldCoherenceX[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioY[bin] * hDiracDecBin->diffuseFieldCoherenceY[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioZ[bin] * hDiracDecBin->diffuseFieldCoherenceZ[bin]; + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + } + else + { + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * hDiracDecBin->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + } + } + + /* Store parameters for formulating average diffuseness over frame */ + hDiracDecBin->frameMeanDiffuseness[bin] += diffEne; + frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; + } + + /* Formulate average diffuseness over frame */ + for ( bin = 0; bin < nBins; bin++ ) + { + hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); + } + + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); } for ( bin = 0; bin < nBins; bin++ ) { @@ -1243,7 +1900,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric return; } - +#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, @@ -1436,14 +2093,27 @@ static void ivas_dirac_dec_binaural_process_output( const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, - const int16_t subframe ) + const int16_t subframe +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + , + float outRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float outIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float reverbRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float reverbIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float decorrRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const uint8_t recompute +#endif + ) { int16_t slot, bin, chA, chB; int16_t nBins; float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; +#ifndef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#endif float interpVal; float *decSlotRePointer; float *decSlotImPointer; @@ -1457,7 +2127,14 @@ static void ivas_dirac_dec_binaural_process_output( if ( processReverb ) { /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( recompute == 1 ) + { +#endif + ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + } +#endif } interpVal = 0.0f; @@ -1466,7 +2143,27 @@ static void ivas_dirac_dec_binaural_process_output( interpVal += 1.0f / (float) nSlots; if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { - ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( recompute == 1 ) + { +#endif + ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + mvr2r(decSlotRe[chA], decorrRe[chA][slot], CLDFB_NO_CHANNELS_MAX); + mvr2r(decSlotIm[chA], decorrIm[chA][slot], CLDFB_NO_CHANNELS_MAX); + } + } + else + { + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + mvr2r(decorrRe[chA][slot], decSlotRe[chA], CLDFB_NO_CHANNELS_MAX); + mvr2r(decorrIm[chA][slot], decSlotIm[chA], CLDFB_NO_CHANNELS_MAX); + } + } +#endif } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -1531,8 +2228,22 @@ static void ivas_dirac_dec_binaural_process_output( outSlotRePr = &( outSlotRe[0] ); outSlotImPr = &( outSlotIm[0] ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( outRe != NULL && outIm != NULL ) + { + /* provide the data outside in CLDFB domain => mainly for split rendering */ + mvr2r(outSlotRePr, outRe[chA][slot], CLDFB_NO_CHANNELS_MAX); + mvr2r(outSlotImPr, outIm[chA][slot], CLDFB_NO_CHANNELS_MAX); + } + if ( recompute == 1 ) + { + /* Inverse filter bank */ + cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); + } +#else /* Inverse filter bank */ cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); +#endif } } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c8c4cabc3b..473ea1c24e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3244,7 +3244,14 @@ 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++ ) + { + decDummy->hDiracDecBin[i] = NULL; + } +#else decDummy->hDiracDecBin = NULL; +#endif decDummy->hDirACRend = NULL; decDummy->hSpatParamRendCom = NULL; decDummy->hQMetaData = NULL; @@ -3370,7 +3377,9 @@ static ivas_error setRendInputActiveMasa( { inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); inputMasa->metadataHasBeenFed = false; - +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + inputMasa->decDummy->hRenderConfig = hRendCfg; +#endif if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK ) { return error; @@ -3455,7 +3464,11 @@ static void freeDecoderDummy( free( pDecDummy->hHrtfParambin ); /* Parametric binaural renderer handle */ +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + ivas_dirac_dec_close_binaural_data( pDecDummy->hDiracDecBin ); +#else ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); +#endif /* TC buffer */ ivas_jbm_dec_tc_buffer_close( &pDecDummy->hTcBuffer ); @@ -8101,6 +8114,13 @@ static ivas_error renderInputMasa( //#endif // renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); // break; +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + /* TODO: implement */ + renderMasaToBinaural( masaInput, outAudio ); + break; +#endif default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 76f114b689..3d93ee980a 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -37,8 +37,8 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): - if in_fmt != "HOA3": - pytest.xfail("Split Rendering currently only supported with HOA3") + if in_fmt in ("MONO", "STEREO",): + pytest.xfail("Split Rendering currently not supported with MONO or STEREO") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -56,8 +56,8 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): - if in_fmt != "HOA3": - pytest.xfail("Split Rendering currently only supported with HOA3") + if in_fmt in ("MONO", "STEREO",): + pytest.xfail("Split Rendering currently not supported with MONO or STEREO") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") -- GitLab From c4a81ef0fa284dc56991e40d1061e61ec1370b4e Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 24 Jul 2023 09:38:45 +0200 Subject: [PATCH 460/591] remove switch SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT --- lib_com/options.h | 1 - lib_rend/ivas_dirac_dec_binaural_functions.c | 429 ------------------- 2 files changed, 430 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e8a5a8b4d1..1566e2d7b9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -212,7 +212,6 @@ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ #define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN /* Nokia: Issue 623: Split rendering support for parambin renderer */ -#define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT /* Nokia: Issue 623: Split rendering support for parambin renderer, computational optimization */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 258a8bf7d8..0d659479f6 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -95,12 +95,8 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, const int16_t isHeadtracked, float *subFrameTotalEne, float *IIReneLimiter ); static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const float *subFrameTotalEne, const float *IIReneLimiter ); -#else -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); -#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); @@ -668,10 +664,8 @@ static void ivas_dirac_dec_binaural_internal( float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float decorrRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float decorrIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; float IIReneLimiter[CLDFB_NO_CHANNELS_MAX]; -#endif hDiracDecBin = st_ivas->hDiracDecBin[0]; #else @@ -857,17 +851,12 @@ static void ivas_dirac_dec_binaural_internal( } #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, subFrameTotalEne, IIReneLimiter ); ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, subFrameTotalEne, IIReneLimiter ); -#else - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); -#endif #endif ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); @@ -927,7 +916,6 @@ static void ivas_dirac_dec_binaural_internal( hDiracDecBin->hDiffuseDist = &diffuseDistData; } -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT /* re-use input covariance for the side renderings */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -940,10 +928,6 @@ static void ivas_dirac_dec_binaural_internal( hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, subFrameTotalEne, IIReneLimiter ); -#else - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat_local, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); -#endif ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat_local, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); @@ -1032,7 +1016,6 @@ static void ivas_dirac_dec_decorrelate_slot( return; } -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN_OPT static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, @@ -1489,418 +1472,6 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( return; } -#else -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( - DIRAC_DEC_BIN_HANDLE hDiracDecBin, - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - PARAMBIN_REND_CONFIG_HANDLE hConfig, - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float Rmat[3][3], - const int16_t subframe, - const int16_t isHeadtracked ) -{ - int16_t ch, slot, bin; - int16_t separateCenterChannelRendering; - int16_t nBins, idx; - float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; - float IIReneLimiterFactor; - float qualityBasedSmFactor; - float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; - uint8_t applyLowBitRateEQ; - int16_t dirac_read_idx; - float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; - PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; - IVAS_FORMAT ivas_format; - MC_MODE mc_mode; - int32_t ivas_total_brate; - int16_t nchan_transport; - - separateCenterChannelRendering = hConfig->separateCenterChannelRendering; - ivas_format = hConfig->ivas_format; - mc_mode = hConfig->mc_mode; - ivas_total_brate = hConfig->ivas_total_brate; - nchan_transport = hConfig->nchan_transport; - qualityBasedSmFactor = hConfig->qualityBasedSmFactor; - qualityBasedSmFactor *= qualityBasedSmFactor; - nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ - - set_zero( hDiracDecBin->ChCrossRe, nBins ); - set_zero( hDiracDecBin->ChCrossIm, nBins ); - set_zero( hDiracDecBin->ChCrossReOut, nBins ); - set_zero( hDiracDecBin->ChCrossImOut, nBins ); - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - set_zero( hDiracDecBin->ChEne[ch], nBins ); - set_zero( hDiracDecBin->ChEneOut[ch], nBins ); - } - set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); - - set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); - - for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) - { - gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ - } - - /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ - applyLowBitRateEQ = 0; - if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - applyLowBitRateEQ = 1; - if ( ivas_total_brate == IVAS_16k4 ) - { - for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) - { - lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; - } - } - else - { - for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) - { - lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; - } - } - } - - /* Formulate input and target covariance matrices for this subframe */ - set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; - - /* Calculate input covariance matrix */ - for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) - { - for ( bin = 0; bin < nBins; bin++ ) - { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - float instEne; - - instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); - instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); - hDiracDecBin->ChEne[ch][bin] += instEne; - subFrameTotalEne[bin] += instEne; - } - hDiracDecBin->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; - hDiracDecBin->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; - hDiracDecBin->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; - hDiracDecBin->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; - } - } - - /* Apply EQ at low bit rates */ - if ( applyLowBitRateEQ ) - { - int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; - - for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) - { - subFrameTotalEne[bin] *= lowBitRateEQ[bin]; - } - for ( ; bin < nBins; bin++ ) - { - subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; - } - } - - if ( ivas_format == SBA_FORMAT && nchan_transport == 2 ) - { - float tempRe, tempIm; - - set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - - for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) - { - for ( bin = 0; bin < nBins; bin++ ) - { - tempRe = inRe[0][slot][bin] + inRe[1][slot][bin]; - tempIm = inIm[0][slot][bin] + inIm[1][slot][bin]; - subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; - } - } - } - - /* Determine target covariance matrix containing target binaural properties */ - for ( bin = 0; bin < nBins; bin++ ) - { - float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ - float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ - float diffEne, dirEne, meanEnePerCh; - int16_t dirIndex; - - /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. - * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the - * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match - * the early spectrum of the BRIR data, using the spectral correction data in - * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ - meanEnePerCh = hDiracDecBin->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; - - /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - for ( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) - { - int16_t aziDeg, eleDeg; - float lRealp, lImagp, rRealp, rImagp; - float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; - float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; - - if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ - { - aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; - eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; - ratio = hSpatParamRendCom->energy_ratio1[dirac_read_idx][bin]; - spreadCoh = hSpatParamRendCom->spreadCoherence[dirac_read_idx][bin]; - } - else /* For second of the two simultaneous directions */ - { - if ( ( ratio = hSpatParamRendCom->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) - { - /* This touches only MASA path where second direction always has smaller ratio and - * for non-2dir it is zero. As the whole direction contribution is multiplied with - * the ratio, a very small ratio does not contribute any energy to output. Thus, - * it is better to save complexity. */ - continue; - } - aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; - eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; - spreadCoh = hSpatParamRendCom->spreadCoherence2[dirac_read_idx][bin]; - } - diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ - - if ( separateCenterChannelRendering ) - { - /* In masa + mono rendering mode, the center directions originate from phantom sources, so the - * spread coherence is increased */ - float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; - - aziRad = (float) aziDeg * PI_OVER_180; - eleRad = (float) eleDeg * PI_OVER_180; - doaVectorX = cosf( aziRad ) * cosf( eleRad ); - spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; - altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); - spreadCoh = max( spreadCoh, altSpreadCoh ); - } - - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); - - if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) - { - /* Synthesizing spread coherence is not needed for stereo loudspeaker output, - * as directional sound is reproduced with two loudspeakers in any case */ - spreadCoh = 0.0f; - } - - if ( spreadCoh > 0.0f ) - { - float centerMul, sidesMul; - float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; - float w1, w2, w3, eq; - - hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); - - /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. - * The following formulas determine the gains for these sources. - * spreadCoh = 0: Only panning - * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) - * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ - if ( spreadCoh < 0.5f ) - { - /* 0.0f < spreadCoh < 0.5f */ - sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ - centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; - } - else - { - /* 0.5f <= spreadCoh < 1.0f */ - centerMul = 2.0f - ( 2.0f * spreadCoh ); - sidesMul = inv_sqrt( centerMul + 2.0f ); - centerMul *= sidesMul; - } - - /* Apply the gain for the center source of the three coherent sources */ - lRealp *= centerMul; - lImagp *= centerMul; - rRealp *= centerMul; - rImagp *= centerMul; - - /* Apply the gain for the left source of the three coherent sources */ - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); - - hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); - lRealp += sidesMul * lRealpTmp; - lImagp += sidesMul * lImagpTmp; - rRealp += sidesMul * rRealpTmp; - rImagp += sidesMul * rImagpTmp; - - /* Apply the gain for the right source of the three coherent sources. - * -30 degrees to 330 wrapping due to internal functions. */ - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); - - hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); - lRealp += sidesMul * lRealpTmp; - lImagp += sidesMul * lImagpTmp; - rRealp += sidesMul * rRealpTmp; - rImagp += sidesMul * rImagpTmp; - - /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ - hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); - eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + - ( hrtfEneCenter * centerMul * centerMul ) ) / - max( 1e-12f, hrtfEneRealized ); - - /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ - if ( spreadCoh < 0.5 ) - { - w1 = 1.0f - 2.0f * spreadCoh; - w2 = 2.0f * spreadCoh; - w3 = 0.0f; - } - else - { - w1 = 0.0f; - w2 = 2.0f - 2.0f * spreadCoh; - w3 = 2.0f * spreadCoh - 1.0f; - } - - if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) - { - idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); - - /* Apply the target spectrum to the eneCorrectionFactor */ - if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ - { - eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; - } - else - { - eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; - } - } - - /* Equalize the spread coherent combined HRTFs */ - eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); - lRealp *= eq; - lImagp *= eq; - rRealp *= eq; - rImagp *= eq; - } - - hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); - hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); - hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); - hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); - - /* Add direct part (1 or 2) covariance matrix */ - dirEne = ratio * meanEnePerCh; - hDiracDecBin->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ - hDiracDecBin->ChEneOut[1][bin] += dirEne * hrtfEne[1]; - hDiracDecBin->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ - hDiracDecBin->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ - } - - /* Add diffuse / ambient part covariance matrix */ - diffuseness = max( 0.0f, diffuseness ); - diffEne = diffuseness * meanEnePerCh; - surCoh = hSpatParamRendCom->surroundingCoherence[dirac_read_idx][bin]; - if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) - { - if ( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) - { - idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); - /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ - diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; - } - } - hDiracDecBin->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ - hDiracDecBin->ChEneOut[1][bin] += diffEne; - - if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) - { - /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ - hDiracDecBin->ChCrossReOut[bin] += surCoh * diffEne; - } - else /* When rendering binaural, ambience has frequency dependent ICC. */ - { - if ( ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) - { - float diffuseFieldCoherence; - diffuseFieldCoherence = hDiracDecBin->hDiffuseDist->diffuseRatioX[bin] * hDiracDecBin->diffuseFieldCoherenceX[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioY[bin] * hDiracDecBin->diffuseFieldCoherenceY[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioZ[bin] * hDiracDecBin->diffuseFieldCoherenceZ[bin]; - hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; - } - else - { - hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * hDiracDecBin->diffuseFieldCoherence[bin] + surCoh ) * diffEne; - } - } - - /* Store parameters for formulating average diffuseness over frame */ - hDiracDecBin->frameMeanDiffuseness[bin] += diffEne; - frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; - } - - /* Formulate average diffuseness over frame */ - for ( bin = 0; bin < nBins; bin++ ) - { - hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); - } - - /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ - if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); - } - else - { - IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); - } - for ( bin = 0; bin < nBins; bin++ ) - { - float eneRatio, IIReneLimiter; - - /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that - * the energy history (IIR) must not be more than double of the current frame energy. This provides more - * robust performance at energy offsets when compared to typical IIR averaging. */ - eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); - IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); - - hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; - hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; - hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; - hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; - hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; - } - - hDiracDecBin->ChCrossRe[bin] += IIReneLimiter * hDiracDecBin->ChCrossRePrev[bin]; - hDiracDecBin->ChCrossIm[bin] += IIReneLimiter * hDiracDecBin->ChCrossImPrev[bin]; - hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossReOutPrev[bin]; - hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossImOutPrev[bin]; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEne[ch][bin] += IIReneLimiter * hDiracDecBin->ChEnePrev[ch][bin]; - hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter * hDiracDecBin->ChEneOutPrev[ch][bin]; - } - - /* Store energy values and coefficients for next round */ - hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; - hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; - hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; - hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; - hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; - } - } - - return; -} -#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, -- GitLab From b7934d3f35d75fd55a80d389087bdf7adeab5212 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Mon, 24 Jul 2023 09:48:34 +0200 Subject: [PATCH 461/591] clang format --- lib_enc/ivas_mct_core_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 lib_enc/ivas_mct_core_enc.c diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c old mode 100755 new mode 100644 index 2a048ed2ea..99eb1d9eb5 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -201,7 +201,7 @@ void ivas_mct_core_enc( int16_t ch, ch_core, nSubframes, L_subframeTCX; int16_t i, cpe_id, n, nAvailBits; int16_t nCPE; - float *orig_spectrum[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */ + float *orig_spectrum[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */ float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k]; float powerSpecMsInv_long[MCT_MAX_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */ float *powerSpecMsInv[MCT_MAX_CHANNELS][2]; -- GitLab From 63d92d3df743fadd67dacf00f271d830b6466cc5 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 24 Jul 2023 10:11:19 +0200 Subject: [PATCH 462/591] remove unused parameter --- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 0d659479f6..e77fabf73c 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -95,7 +95,7 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); -static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, const int16_t isHeadtracked, float *subFrameTotalEne, float *IIReneLimiter ); +static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, float *subFrameTotalEne, float *IIReneLimiter ); static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const float *subFrameTotalEne, const float *IIReneLimiter ); static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); @@ -852,7 +852,6 @@ static void ivas_dirac_dec_binaural_internal( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, subFrameTotalEne, IIReneLimiter ); ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, @@ -1023,7 +1022,6 @@ static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, - const int16_t isHeadtracked, float *subFrameTotalEne, float *IIReneLimiter ) { -- GitLab From 6d11ef1ccf8a13a04df2b587c194dd60ed3613d6 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 24 Jul 2023 10:18:28 +0200 Subject: [PATCH 463/591] Convert floor to round in the printout message --- apps/renderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/renderer.c b/apps/renderer.c index acb49ce39d..bc7756ee81 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1919,7 +1919,7 @@ int main( #ifdef FIX_488_SYNC_DELAY if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) floor( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); + fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); } #endif -- GitLab From 3381064cace5933c4058dcaf5481c369f7c492d2 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 24 Jul 2023 10:33:04 +0200 Subject: [PATCH 464/591] fix memory leak --- lib_rend/ivas_dirac_dec_binaural_functions.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index e77fabf73c..a408af8d4f 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -359,6 +359,11 @@ void ivas_dirac_dec_close_binaural_data( ivas_td_decorr_dec_close( &( hBinaural[pos_idx]->hTdDecorr ) ); + if ( hBinaural[pos_idx]->h_freq_domain_decorr_ap_params != NULL ) + { + ivas_dirac_dec_decorr_close( &(hBinaural[pos_idx]->h_freq_domain_decorr_ap_params), &(hBinaural[pos_idx]->h_freq_domain_decorr_ap_state) ); + } + free( hBinaural[pos_idx] ); hBinaural[pos_idx] = NULL; } -- GitLab From 38e787590386f0de9d04ca6dedc75a10c32a1ec2 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 24 Jul 2023 10:39:03 +0200 Subject: [PATCH 465/591] fix double-free in renderer --- lib_rend/lib_rend.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 473ea1c24e..c60a2cdfe6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3377,9 +3377,7 @@ static ivas_error setRendInputActiveMasa( { inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); inputMasa->metadataHasBeenFed = false; -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - inputMasa->decDummy->hRenderConfig = hRendCfg; -#endif + if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK ) { return error; -- GitLab From 15e1ca83decc98ab21924d293e1be579a5e2f571 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Mon, 24 Jul 2023 14:10:41 +0530 Subject: [PATCH 466/591] address review comments --- lib_com/options.h | 2 +- lib_dec/ivas_binRenderer_internal.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1c93d7f080..c207df684f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -187,7 +187,7 @@ #define COVARIANCE_MEMORY_OPT /* Dlb : Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ #define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ -#define FIX_1720_HRTF_FASTCONV /* Dlb : Binaural format RAM saving in SBA mode */ +#define FIX_1720_HRTF_FASTCONV /* Dlb : Binaural and Binaural room format RAM saving in SBA mode */ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ #define FIX_582_INDEX_OUT_OF_BOUNDS_SNS_AVQ_DEC /* FhG: fix an undefined behaviour error in SNS AVQ decoding */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5868f4a572..b3b9663bf6 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1172,12 +1172,12 @@ ivas_error ivas_allocate_binaural_hrtf( *-------------------------------------------------------------------------*/ static ivas_error ivas_binaural_hrtf_open( - HRTFS_FASTCONV_HANDLE *hHrtfFastConv + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ #ifdef FIX_1720_HRTF_FASTCONV , - AUDIO_CONFIG output_config, - RENDERER_TYPE renderer_type, - int8_t is_loudspeaker_setup + AUDIO_CONFIG output_config, /* i : output configuration */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + int8_t is_loudspeaker_setup /* i : loudspeaker setup information */ #endif ) { @@ -1228,6 +1228,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; + #endif for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { -- GitLab From c4943885a1442c6c5d902b66ead971f08139c265 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 24 Jul 2023 14:45:34 +0530 Subject: [PATCH 467/591] Fix for issue#624 --- lib_com/options.h | 1 + lib_enc/ivas_spar_encoder.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index b35772ecc1..7f752d7e7b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -211,6 +211,7 @@ #define FIX_622_SILENCE_USAN_WARNING /* FhG: silenceusan warning in ifft code */ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ +#define FIX_624_PLANAR_SBA_WB /*Dlb : Fix for unintialised value issue 624 */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 7233234f49..c46141767c 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -433,6 +433,13 @@ static ivas_error ivas_spar_cov_md_process( { cov_real[i][j] = cov_real_buf[i][j]; cov_dtx_real[i][j] = cov_dtx_real_buf[i][j]; +#ifdef FIX_624_PLANAR_SBA_WB + for ( b = hSpar->hFbMixer->pFb->filterbank_num_bands; b < IVAS_MAX_NUM_BANDS; b++ ) + { + cov_real[i][j][b] = 0.0f; + cov_dtx_real[i][j][b] = 0.0f; + } +#endif } } -- GitLab From 00b80aeb912016090af1d247a692a23e5a73b18f Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:47:01 +0200 Subject: [PATCH 468/591] accept FIX_563_PARAMMC_LIMITER --- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_enc/ivas_mc_param_enc.c | 10 ---------- 3 files changed, 13 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0c84499778..b2c6a167b9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1432,9 +1432,7 @@ typedef enum #define PARAM_MC_MAX_BAND_ABS_COV_DEC 10 #define PARAM_MC_ENER_LIMIT_INTRAFRAME (1.5f) #define PARAM_MC_ENER_LIMIT_INTERFRAME (2.0f) -#ifdef FIX_563_PARAMMC_LIMITER #define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC (15.0f) -#endif #ifdef FIX_580_PARAMMC_ENER_BURSTS #define PARAM_MC_NUM_ATTACK_ILD_THRESH (3) #endif diff --git a/lib_com/options.h b/lib_com/options.h index b35772ecc1..c937d818e2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ #define VLBR_20MS_MD /* Dlb: SBA VLBR 20ms Optimization*/ #define SBA_MODE_CLEANUP_2 /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ -#define FIX_563_PARAMMC_LIMITER /* FhG: issue 563: fix ILD limiter when coming from silence w/o transient set */ #define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ #define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index fe4f8e8cfc..95bb61c12d 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -932,11 +932,7 @@ static void ivas_param_mc_param_est_enc( for ( ; cur_param_band < num_parameter_bands; cur_param_band += 2 ) { -#ifdef FIX_563_PARAMMC_LIMITER if ( cur_param_band < num_parameter_bands ) -#else - if ( cur_param_band + 1 < num_parameter_bands ) -#endif { for ( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { @@ -1332,11 +1328,7 @@ static void ivas_param_mc_quantize_ilds( ener_fac = 10.0f * log10f( ( tot_ener + EPSILON ) / ( dmx_ener + EPSILON ) ); delta_fac = ener_fac - hParamMC->ener_fac[freq_idx]; -#ifdef FIX_563_PARAMMC_LIMITER if ( !hParamMC->hMetadataPMC.bAttackPresent && ( delta_fac > PARAM_MC_ENER_LIMIT_INTERFRAME ) && ( delta_fac < PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC ) ) -#else - if ( !hParamMC->hMetadataPMC.bAttackPresent && ( delta_fac > PARAM_MC_ENER_LIMIT_INTERFRAME ) ) -#endif { float limit_fac; limit_fac = powf( 10.0f, ( ( 0.3f * logf( delta_fac - PARAM_MC_ENER_LIMIT_INTERFRAME + 1.0f ) - ( delta_fac - PARAM_MC_ENER_LIMIT_INTERFRAME ) ) / 10.0f ) ); @@ -1346,13 +1338,11 @@ static void ivas_param_mc_quantize_ilds( hParamMC->ener_fac[freq_idx] = ener_fac; -#ifdef FIX_563_PARAMMC_LIMITER /* update also combined bands ener_fac when in transient frame */ if ( hParamMC->hMetadataPMC.bAttackPresent && ( ( freq_idx + 1 ) < hParamMC->hMetadataPMC.nbands_coded ) ) { hParamMC->ener_fac[freq_idx + 1] = ener_fac; } -#endif for ( k = 0; k < num_ilds_to_code; ++k ) { -- GitLab From 09b3632cc45b5ea1bd9c0e97ea27002cb471b812 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:47:02 +0200 Subject: [PATCH 469/591] accept FIX_560_VAD_FLAG --- lib_com/options.h | 1 - lib_enc/ivas_core_pre_proc_front.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c937d818e2..99060e6afd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ #define VLBR_20MS_MD /* Dlb: SBA VLBR 20ms Optimization*/ #define SBA_MODE_CLEANUP_2 /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ -#define FIX_560_VAD_FLAG /* Eri: Issue 560 - VAD flag issue for unified stereo */ #define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 20c2f16452..92c66f0de3 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -161,9 +161,6 @@ ivas_error pre_proc_front_ivas( float temp1F_icatdmResampBuf[L_FILT_MAX]; /* temp buffers for ICA TDM resamplers */ int16_t old_pitch1; /* previous frame OL pitch[1] @12.8 kHz */ int16_t LR_localVAD; -#ifndef FIX_560_VAD_FLAG - int16_t LR_vad_flag; -#endif ivas_error error; push_wmops( "pre_proc_front" ); @@ -180,9 +177,6 @@ ivas_error pre_proc_front_ivas( res_cod_SNR_M = tmpF; LR_localVAD = 0; -#ifndef FIX_560_VAD_FLAG - LR_vad_flag = 0; -#endif if ( hSCE != NULL ) { @@ -210,9 +204,6 @@ ivas_error pre_proc_front_ivas( { /* Combine localVAD and vad_flag from LR processing */ LR_localVAD = hCPE->hCoreCoder[0]->localVAD || hCPE->hCoreCoder[1]->localVAD; -#ifndef FIX_560_VAD_FLAG - LR_vad_flag = hCPE->hFrontVad[0]->hVAD->vad_flag || hCPE->hFrontVad[1]->hVAD->vad_flag; -#endif } if ( hCPE->hStereoTD != NULL ) @@ -466,10 +457,6 @@ ivas_error pre_proc_front_ivas( /* Add down mix stereo activity to LR vad_flag_dtx */ *vad_flag_dtx = *vad_flag_dtx || st->vad_flag; -#ifndef FIX_560_VAD_FLAG - /* Combine the LR VAD flag and stereo downmix VAD flag */ - st->vad_flag = ( LR_vad_flag || st->vad_flag ); -#endif /* Determine hangover flag status based on LR localVAD and downmix localVAD */ *vad_hover_flag = *vad_flag_dtx && !( LR_localVAD || st->localVAD ); -- GitLab From b9e7d776a19b8769a3a171796478757f60867759 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:06 +0200 Subject: [PATCH 470/591] accept FIX_549_DMX_GAIN --- lib_com/ivas_ism_com.c | 2 -- lib_com/ivas_stat_com.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_ism_param_dec.c | 12 ------------ lib_enc/ivas_ism_param_enc.c | 20 -------------------- 5 files changed, 37 deletions(-) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index d57f658500..54cae6789b 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -510,10 +510,8 @@ void ivas_param_ism_config( hParamIsm->last_el_sgn[i] = 1; } -#ifdef FIX_549_DMX_GAIN hParamIsm->last_dmx_gain = 1.0f; set_f( hParamIsm->last_cardioid_left, 1.0f, MAX_NUM_OBJECTS ); -#endif return; } diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 51337f1c5c..6d2ed4c4e9 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -169,10 +169,8 @@ typedef struct ivas_param_ism_data_structure int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE]; int16_t flag_equal_energy; -#ifdef FIX_549_DMX_GAIN float last_dmx_gain; float last_cardioid_left[MAX_NUM_OBJECTS]; -#endif } PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index 99060e6afd..408cc68e15 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ #define VLBR_20MS_MD /* Dlb: SBA VLBR 20ms Optimization*/ #define SBA_MODE_CLEANUP_2 /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ -#define FIX_549_DMX_GAIN /* FhG: issue 549: ParamISM output too quiet */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 4662304a4a..8cea5347b4 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -726,11 +726,9 @@ void ivas_param_ism_dec( int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; int16_t subframe_idx, slot_idx, index_slot, bin_idx; int32_t ivas_total_brate; -#ifdef FIX_549_DMX_GAIN int16_t output_frame; float gain, ene_tc, ene_sum, grad; float last_gain; -#endif float ref_power[CLDFB_NO_CHANNELS_MAX]; float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; /* CLDFB Input Buffers */ @@ -757,12 +755,10 @@ void ivas_param_ism_dec( assert( hDirAC ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; assert( hSpatParamRendCom ); -#ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain; output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) @@ -846,7 +842,6 @@ void ivas_param_ism_dec( } } -#ifdef FIX_549_DMX_GAIN /* Energy Compensation */ for ( i = 0; i < output_frame; i++ ) { @@ -880,7 +875,6 @@ void ivas_param_ism_dec( } } st_ivas->hDirAC->hParamIsm->last_dmx_gain = gain; -#endif for ( ch = 0; ch < nchan_transport; ch++ ) { @@ -1097,11 +1091,9 @@ void ivas_param_ism_dec_digest_tc( int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; int16_t slot_idx, bin_idx; int32_t ivas_total_brate; -#ifdef FIX_549_DMX_GAIN int16_t output_frame; float gain, ene_tc, ene_sum, grad; float last_gain; -#endif float ref_power[CLDFB_NO_CHANNELS_MAX]; float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; /* Direct Response/EFAP Gains */ @@ -1114,12 +1106,10 @@ void ivas_param_ism_dec_digest_tc( assert( hDirAC ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; assert( hSpatParamRendCom ); -#ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain; output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif nchan_transport = st_ivas->nchan_transport; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -1206,7 +1196,6 @@ void ivas_param_ism_dec_digest_tc( } } -#ifdef FIX_549_DMX_GAIN /* Energy Compensation */ for ( i = 0; i < output_frame; i++ ) { @@ -1240,7 +1229,6 @@ void ivas_param_ism_dec_digest_tc( } } st_ivas->hDirAC->hParamIsm->last_dmx_gain = gain; -#endif for ( ch = 0; ch < nchan_transport; ch++ ) { diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index c3d50d24db..7c99c49184 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -222,11 +222,9 @@ void ivas_param_ism_stereo_dmx( float alpha, azi_shift, tmp, tmp_1; float cardioid_left[MAX_NUM_OBJECTS], cardioid_right[MAX_NUM_OBJECTS]; float stereo_dmx[2][L_FRAME48k]; -#ifdef FIX_549_DMX_GAIN float dmx_gain, ene_dmx, ene_data, grad; float last_dmx_gain; float last_cardioid_left; -#endif ISM_METADATA_HANDLE hIsmMetaData; push_wmops( "ivas_param_ism_st_dmx" ); @@ -234,12 +232,10 @@ void ivas_param_ism_stereo_dmx( /*Initialization*/ alpha = 0.5; azi_shift = 0; -#ifdef FIX_549_DMX_GAIN dmx_gain = 0; ene_dmx = 0; ene_data = 0; last_dmx_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain; -#endif /* Set the stereo dmx to zero */ set_zero( stereo_dmx[0], L_FRAME48k ); @@ -249,24 +245,11 @@ void ivas_param_ism_stereo_dmx( for ( i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) { hIsmMetaData = st_ivas->hIsmMetaData[i]; -#ifdef FIX_549_DMX_GAIN last_cardioid_left = st_ivas->hDirAC->hParamIsm->last_cardioid_left[i]; -#endif /*Compute the Cardioids for the corresponding object direction */ tmp = hIsmMetaData->azimuth * ( EVS_PI / 180 ); tmp_1 = ( EVS_PI / 2 ) + azi_shift; cardioid_left[i] = alpha + ( 1 - alpha ) * cosf( tmp - tmp_1 ); -#ifndef FIX_549_DMX_GAIN - cardioid_right[i] = alpha + ( 1 - alpha ) * cosf( tmp + tmp_1 ); - - /* Loop over all samples */ - for ( j = 0; j < input_frame; j++ ) - { - tmp = data[i][j]; - stereo_dmx[0][j] += cardioid_left[i] * tmp; /* DMX Left */ - stereo_dmx[1][j] += cardioid_right[i] * tmp; /* DMX Right */ - } -#else if ( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 0 ) { float last_cardioid_right; @@ -306,10 +289,8 @@ void ivas_param_ism_stereo_dmx( } } st_ivas->hDirAC->hParamIsm->last_cardioid_left[i] = cardioid_left[i]; -#endif } -#ifdef FIX_549_DMX_GAIN /* Energy compensation */ for ( j = 0; j < input_frame; j++ ) { @@ -342,7 +323,6 @@ void ivas_param_ism_stereo_dmx( } } st_ivas->hDirAC->hParamIsm->last_dmx_gain = dmx_gain; -#endif /* Copy the stereo dmx to data variable */ mvr2r( stereo_dmx[0], data[0], input_frame ); mvr2r( stereo_dmx[1], data[1], input_frame ); -- GitLab From adaa09bb8b5e75346b09a5b26ad2be92f5b5d364 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:07 +0200 Subject: [PATCH 471/591] accept ISM_FB --- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_sce_dec.c | 4 ---- lib_enc/bw_detect.c | 4 ---- lib_enc/ivas_decision_matrix_enc.c | 4 ---- lib_enc/lib_enc.c | 6 ------ 6 files changed, 21 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index b2c6a167b9..0a9c2960af 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -313,13 +313,11 @@ typedef enum #define MIN_BRATE_SWB_SCE ACELP_9k60 /* min. SCE bitrate where SWB is supported */ #define MIN_BRATE_SWB_STEREO IVAS_13k2 /* min. stereo bitrate where SWB is supported */ #define MIN_BRATE_FB_STEREO IVAS_32k /* min. SCE and stereo bitrate where FB is supported */ -#ifdef ISM_FB #ifdef ISM_FB_16k4 #define MIN_BRATE_FB_ISM 16000 /* min. SCE bitrate where FB is supported in ISM format */ #else #define MIN_BRATE_FB_ISM 24000 /* min. SCE bitrate where FB is supported in ISM format */ #endif -#endif #define MIN_TDM_BRATE_WB_TBE_1k05 12000 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ #define MIN_BRATE_WB_TBE_1k05 9650 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ diff --git a/lib_com/options.h b/lib_com/options.h index 408cc68e15..247b040c84 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,6 @@ #define SBA_MODE_CLEANUP_2 /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ -#define ISM_FB /* issue 556: change SWB to FB coding in 1ISM at 24.4 kbps */ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 2e10552296..ec0e17107c 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -123,12 +123,8 @@ ivas_error ivas_sce_dec( /* only WB is supported */ st->bwidth = WB; } -#ifdef ISM_FB else if ( ( hSCE->element_brate < MIN_BRATE_FB_STEREO && !st->is_ism_format ) || ( hSCE->element_brate < MIN_BRATE_FB_ISM && st->is_ism_format ) ) -#else - else if ( hSCE->element_brate < MIN_BRATE_FB_STEREO ) -#endif { /* WB and SWB are supported */ st->bwidth = get_next_indice( st, 1 ) + WB; diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index e1e068ab2c..121754e1dc 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -579,12 +579,8 @@ void set_bw( { st->bwidth = WB; } -#ifdef ISM_FB else if ( st->bwidth > SWB && ( ( element_brate < MIN_BRATE_FB_STEREO && !st->is_ism_format ) || ( element_brate < MIN_BRATE_FB_ISM && st->is_ism_format ) ) ) -#else - else if ( element_brate < MIN_BRATE_FB_STEREO && st->bwidth > SWB ) -#endif { st->bwidth = SWB; } diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index b160193ad3..3fcf9154f7 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -453,12 +453,8 @@ void ivas_signaling_enc( { /* only WB is supported */ } -#ifdef ISM_FB else if ( ( element_brate < MIN_BRATE_FB_STEREO && !st->is_ism_format ) || ( element_brate < MIN_BRATE_FB_ISM && st->is_ism_format ) ) -#else - else if ( element_brate < MIN_BRATE_FB_STEREO ) -#endif { /* WB and SWB are supported */ ind = st->bwidth - WB; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index ff7e2a6638..5e051e41b7 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1649,13 +1649,11 @@ static ivas_error printConfigInfo_enc( { if ( newBandwidthApi != hEncoderConfig->max_bwidth ) { -#ifdef ISM_FB if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { fprintf( stdout, "\nFB coding not supported below %.2f kbps for %i objects. Switching to SWB.\n", hEncoderConfig->nchan_ism * MIN_BRATE_FB_ISM / 1000.f, hEncoderConfig->nchan_ism ); } else -#endif { fprintf( stdout, "\nFB coding not supported below %.2f kbps. Switching to SWB.\n", MIN_BRATE_FB_STEREO / 1000.f ); } @@ -1955,12 +1953,8 @@ static ivas_error sanitizeBandwidth( } else { -#ifdef ISM_FB if ( max_bwidth_tmp == FB && ( ( hEncoderConfig->ivas_format != ISM_FORMAT && hEncoderConfig->ivas_total_brate < MIN_BRATE_FB_STEREO ) || ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->ivas_total_brate / hEncoderConfig->nchan_ism < MIN_BRATE_FB_ISM ) ) ) -#else - if ( max_bwidth_tmp == FB && hEncoderConfig->ivas_total_brate < MIN_BRATE_FB_STEREO ) -#endif { max_bwidth_tmp = SWB; } -- GitLab From 4cd5b64665c592c960491ddde99bed45b4222366 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:07 +0200 Subject: [PATCH 472/591] accept FIX_558_PLC_DISCONT --- lib_com/options.h | 1 - lib_dec/ivas_post_proc.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 247b040c84..e10b05ce3f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,6 @@ #define SBA_MODE_CLEANUP_2 /* Dlb : changes part of fix issue #523 for unused signaling bit in SBA SID*/ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ -#define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ #define FIX_568_ISM_BITRATE_SWITCHING /* Philips: Issue 568: Bugfix for renderer re-initialization by ISM and bitrate switching */ diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 7f1c84983b..417cd7c5b4 100755 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -208,11 +208,7 @@ void stereo_dft_dec_core_switching( lerp( hCPE->input_mem_BPF[0], hCPE->input_mem_BPF[0], NS2SA( st->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), NS2SA( st->last_L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ) ); } -#ifdef FIX_558_PLC_DISCONT if ( st->prev_bfi && !( st->last_core_bfi == ACELP_CORE && st->last_con_tcx == 1 ) ) -#else - if ( st->prev_bfi ) -#endif { /* last_core needed for correctly decoding ACELP->TCX/HQ switching frames in ivas_core_dec(). In the following steps the decoder needs to consider if the core was changed due to a lost frame to apply the correct transition */ -- GitLab From 6cf3b7ffb6b208eeb80ded665a349dbde2c9e4a8 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:08 +0200 Subject: [PATCH 473/591] accept FIX_566_2DIR_MASA_384K --- lib_com/options.h | 1 - lib_dec/ivas_qmetadata_dec.c | 14 -------------- lib_enc/ivas_qmetadata_enc.c | 11 ----------- 3 files changed, 26 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e10b05ce3f..cc774a5ab5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,7 +155,6 @@ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ -#define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ #define FIX_568_ISM_BITRATE_SWITCHING /* Philips: Issue 568: Bugfix for renderer re-initialization by ISM and bitrate switching */ #define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ #define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 3e978a59b9..e4c69cd288 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -962,7 +962,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } #else -#ifdef FIX_566_2DIR_MASA_384K float ratioSum; for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) { @@ -980,19 +979,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } -#else - for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) - { - for ( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) - { - hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = 1.0f - diffuseness_reconstructions_hr[hQMetaData->q_direction[1].band_data[b].energy_ratio_index[m]]; - if ( hQMetaData->q_direction[1].band_data[b].energy_ratio[m] > 1.0f - hQMetaData->q_direction[0].band_data[b].energy_ratio[m] ) - { - hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = 1.0f - hQMetaData->q_direction[0].band_data[b].energy_ratio[m]; - } - } - } -#endif #endif } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 122bbf2283..7cf68d677d 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -759,7 +759,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( bits_no_dirs_coh += #endif write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); -#ifdef FIX_566_2DIR_MASA_384K d = 0; for ( i = hQMetaData->q_direction[1].cfg.start_band; i < hQMetaData->q_direction[1].cfg.nbands; i++ ) { @@ -776,7 +775,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( d++; } } -#endif for ( i = hQMetaData->numTwoDirBands; i < hQMetaData->q_direction[0].cfg.nbands; i++ ) { set_f( hQMetaData->q_direction[1].band_data[i].energy_ratio, 0.0f, hQMetaData->q_direction[1].cfg.nblocks ); @@ -1622,9 +1620,7 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( } } #else -#ifdef FIX_566_2DIR_MASA_384K float ratioSum; -#endif for ( j = hQMetaData->q_direction[1].cfg.start_band; j < hQMetaData->q_direction[1].cfg.nbands; ++j ) { for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) @@ -1633,19 +1629,12 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( push_next_indice( hMetaData, index, MASA_BITS_ER_HR ); hQMetaData->q_direction[1].band_data[j].energy_ratio_index[k] = index; hQMetaData->q_direction[1].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index]; -#ifdef FIX_566_2DIR_MASA_384K ratioSum = hQMetaData->q_direction[0].band_data[j].energy_ratio[k] + hQMetaData->q_direction[1].band_data[j].energy_ratio[k]; if ( ratioSum > 1.0f ) { hQMetaData->q_direction[0].band_data[j].energy_ratio[k] /= ratioSum; hQMetaData->q_direction[1].band_data[j].energy_ratio[k] /= ratioSum; } -#else - if ( hQMetaData->q_direction[1].band_data[j].energy_ratio[k] > 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[k] ) - { - hQMetaData->q_direction[1].band_data[j].energy_ratio[k] = 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[k]; - } -#endif needed_bits[1] += MASA_BITS_ER_HR; hQMetaData->q_direction[1].band_data[j].bits_sph_idx[k] = bits_dir_hr; } -- GitLab From e0a4cb89b80ce0e52468947152fe06abb0e122a0 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:08 +0200 Subject: [PATCH 474/591] accept FIX_568_ISM_BITRATE_SWITCHING --- lib_com/options.h | 1 - lib_dec/ivas_ism_dec.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index cc774a5ab5..431a755f75 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,7 +155,6 @@ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ -#define FIX_568_ISM_BITRATE_SWITCHING /* Philips: Issue 568: Bugfix for renderer re-initialization by ISM and bitrate switching */ #define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ #define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index fa5783d90a..63464def7f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -171,11 +171,7 @@ static ivas_error ivas_ism_bitrate_switching( /* Deallocate the ParamISM struct */ ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); -#ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) -#endif { /* close the parametric binaural renderer */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); @@ -214,11 +210,7 @@ static ivas_error ivas_ism_bitrate_switching( } } -#ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR ) -#else - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { /* close the parametric binaural renderer */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); @@ -246,11 +238,7 @@ static ivas_error ivas_ism_bitrate_switching( { return error; } -#ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) -#endif { /* open the parametric binaural renderer */ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -296,11 +284,7 @@ static ivas_error ivas_ism_bitrate_switching( } } -#ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR ) -#else - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { /* open the parametric binaural renderer */ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -- GitLab From 65169a29b0c3e206e8b2bba57452f0ac4529956e Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:09 +0200 Subject: [PATCH 475/591] accept FIX_565_SBA_BURST_IN_FEC --- lib_com/options.h | 1 - lib_dec/FEC.c | 8 -------- lib_dec/ivas_sce_dec.c | 7 ------- lib_dec/ivas_spar_decoder.c | 2 -- 4 files changed, 18 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 431a755f75..a1989e1479 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,7 +155,6 @@ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ -#define FIX_565_SBA_BURST_IN_FEC /* VA: Issue 565: Fix noise burst during FEC, due to wrong total_brate initialization */ #define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index 2a49ff3b1f..0a46a263cb 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -331,11 +331,7 @@ void FEC_exc_estim( /*-----------------------------------------------------------------* * Replicate the last spectrum in case the last good frame was coded by GSC *-----------------------------------------------------------------*/ -#ifndef FIX_565_SBA_BURST_IN_FEC - if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= ACELP_24k40 && !st->Opt_AMR_WB ) -#else if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB ) -#endif { /* Replication of the last spectrum, with a slight downscaling of its dynamic */ st->GSC_noisy_speech = st->Last_GSC_noisy_speech_flag; @@ -407,11 +403,7 @@ void FEC_exc_estim( /*-----------------------------------------------------------------* * Total excitation *-----------------------------------------------------------------*/ -#ifndef FIX_565_SBA_BURST_IN_FEC - if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= ACELP_24k40 && !st->Opt_AMR_WB ) -#else if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB ) -#endif { /* For GSC - the excitation is already computed */ mvr2r( exc, exc2, st->L_frame ); diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index ec0e17107c..9bb7fc227d 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -185,17 +185,10 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } -#ifndef FIX_565_SBA_BURST_IN_FEC - else if ( st_ivas->ivas_format != ISM_FORMAT ) /* note: in ISMs, total_brate[] is set in ivas_ism_config() */ - { - st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; - } -#else else if ( !st_ivas->bfi && st_ivas->ivas_format != ISM_FORMAT ) /* note: in ISMs, total_brate[] is set in ivas_ism_config() */ { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } -#endif /*----------------------------------------------------------------* * Core codec configuration *----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index dd8fbdc851..1c839316e5 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -345,9 +345,7 @@ ivas_error ivas_spar_dec( st0->bit_stream = bstr_meta; st0->next_bit_pos = 0; st0->bits_frame = min( MAX_BITS_METADATA, last_bit_pos + 1 ); -#ifdef FIX_565_SBA_BURST_IN_FEC if ( !st0->bfi ) -#endif { st0->total_brate = hDecoderConfig->ivas_total_brate; /* to avoid BER detect */ } -- GitLab From 8ce0c56e9e2dbecb11782288da4a35bfc038d557 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:10 +0200 Subject: [PATCH 476/591] accept FIX_562_ISM2_64KBPS --- lib_com/ivas_ism_com.c | 4 ---- lib_com/options.h | 1 - lib_dec/ivas_ism_metadata_dec.c | 4 ---- lib_enc/ivas_ism_metadata_enc.c | 4 ---- 4 files changed, 13 deletions(-) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 54cae6789b..7944311470 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -54,9 +54,7 @@ #define BETA_ISM_LOW_IMP 0.6f #define BETA_ISM_MEDIUM_IMP 0.8f -#ifdef FIX_562_ISM2_64KBPS #define MAX_BRATE_TCX_32k 48000 -#endif /*-------------------------------------------------------------------* @@ -292,7 +290,6 @@ ivas_error ivas_ism_config( bits_CoreCoder[ch] = tmp; } -#ifdef FIX_562_ISM2_64KBPS /* limitaton to avoid too high bitrate in one active TCX channel */ if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k ) { @@ -307,7 +304,6 @@ ivas_error ivas_ism_config( bits_CoreCoder[ch] = tmp; } } -#endif if ( diff > 0 ) { diff --git a/lib_com/options.h b/lib_com/options.h index a1989e1479..82436315fe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,7 +155,6 @@ #define FIX_137_SID_MD_BITS /* Dlb: Fix issue #137 , SID bitrate mismatch correction */ #define FIX_470_MASA_JBM_EXT /* Nokia: Issue 470, fix MASA EXT output with JBM */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ -#define FIX_562_ISM2_64KBPS /* VA: issue 562: fix ISM2 at 64kbps issue */ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_572_LFE_LPF_ENC /* FhG: issue 572: always apply the low pass filter to the LFE channel */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 86c43f0ffd..f5ed58974f 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -512,12 +512,8 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_562_ISM2_64KBPS if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) || ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) ) -#else - if ( ism_imp[ch] == ISM_NO_META && total_brate[ch] < ACELP_8k00 ) -#endif { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index cbf3d945de..ed43af153d 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -576,12 +576,8 @@ ivas_error ivas_ism_metadata_enc( hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( ism_mode == ISM_MODE_DISC ) { -#ifdef FIX_562_ISM2_64KBPS if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) || ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) ) -#else - if ( ism_imp[ch] == ISM_NO_META && total_brate[ch] < ACELP_8k00 ) -#endif { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; } -- GitLab From 0f0b21ccf577cdf25e34da4b05961040cb072ef1 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:10 +0200 Subject: [PATCH 477/591] accept FIX_572_LFE_LPF_ENC --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 1 - lib_enc/ivas_enc.c | 2 -- lib_enc/ivas_init_enc.c | 6 ------ lib_enc/ivas_lfe_enc.c | 13 ------------- lib_enc/ivas_stat_enc.h | 5 ----- 6 files changed, 29 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 3b6c1558be..885de08281 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5372,7 +5372,6 @@ void ivas_lfe_synth_with_filters( ); -#ifdef FIX_572_LFE_LPF_ENC /*----------------------------------------------------------------------------------* * LFE encoder low pass filter prototypes *----------------------------------------------------------------------------------*/ @@ -5391,7 +5390,6 @@ void ivas_lfe_lpf_enc_apply( float data_lfe_ch[], /* i/o: LFE signal */ const int16_t input_frame /* i : input frame length per channel */ ); -#endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/options.h b/lib_com/options.h index 82436315fe..905ef21c5b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,6 @@ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ -#define FIX_572_LFE_LPF_ENC /* FhG: issue 572: always apply the low pass filter to the LFE channel */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ #define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ #define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 854354ceb8..86d9dc3ec6 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -276,10 +276,8 @@ ivas_error ivas_enc( hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; -#ifdef FIX_572_LFE_LPF_ENC /* LFE low pass filter */ ivas_lfe_lpf_enc_apply( st_ivas->hLfeLpf, data_f[LFE_CHANNEL], input_frame ); -#endif /* LFE channel encoder */ if ( st_ivas->mc_mode == MC_MODE_MCT ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index fdb562243c..6d0b1086c1 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -314,10 +314,8 @@ void ivas_initialize_handles_enc( /* LFE handle */ st_ivas->hLFE = NULL; -#ifdef FIX_572_LFE_LPF_ENC /* LFE low pass filter handle */ st_ivas->hLfeLpf = NULL; -#endif return; } @@ -548,12 +546,10 @@ ivas_error ivas_init_encoder( hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); -#ifdef FIX_572_LFE_LPF_ENC if ( ( error = ivas_create_lfe_lpf_enc( &st_ivas->hLfeLpf, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) { @@ -956,10 +952,8 @@ void ivas_destroy_enc( /* LFE handle */ ivas_lfe_enc_close( &( st_ivas->hLFE ) ); -#ifdef FIX_572_LFE_LPF_ENC /* LFE low pass filter state */ ivas_lfe_lpf_enc_close( &( st_ivas->hLfeLpf ) ); -#endif /* Param-Upmix MC handle */ ivas_mc_paramupmix_enc_close( &( st_ivas->hMCParamUpmix ), st_ivas->hEncoderConfig->input_Fs ); diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index 61072cc187..75952fe62c 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -344,10 +344,6 @@ void ivas_lfe_enc( zero_pad_len = hLFE->pWindow_state->zero_pad_len; pWindow_coeffs = hLFE->pWindow_state->pWindow_coeffs; -#ifndef FIX_572_LFE_LPF_ENC - /*Low Pass Filter */ - ivas_filter_process( &hLFE->filter_state, data_lfe_ch, input_frame ); -#endif /* Windowing */ ivas_dct_windowing( fade_len, full_len, dct_len, zero_pad_len, pWindow_coeffs, input_frame, wtda_audio, hLFE->old_wtda_audio, data_lfe_ch ); @@ -382,9 +378,6 @@ ivas_error ivas_create_lfe_enc( { int16_t input_frame; LFE_ENC_HANDLE hLFE; -#ifndef FIX_572_LFE_LPF_ENC - const float *filt_coeff; -#endif int16_t i, j; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); @@ -426,10 +419,6 @@ ivas_error ivas_create_lfe_enc( lfe_window_init( hLFE->pWindow_state, input_Fs, input_frame ); -#ifndef FIX_572_LFE_LPF_ENC - ivas_lfe_lpf_select_filt_coeff( input_Fs, IVAS_FILTER_ORDER_4, &filt_coeff ); - ivas_filters_init( &hLFE->filter_state, filt_coeff, IVAS_FILTER_ORDER_4 ); -#endif /* Initialization for entropy coding */ hLFE->cum_freq_models[0][0] = ivas_str_lfe_freq_models.entropy_coder_model_fine_sg1; @@ -489,7 +478,6 @@ void ivas_lfe_enc_close( return; } -#ifdef FIX_572_LFE_LPF_ENC /*------------------------------------------------------------------------- * ivas_create_lfe_lpf_enc() * @@ -563,4 +551,3 @@ void ivas_lfe_lpf_enc_apply( return; } -#endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 12e0bd7d30..9a37f8f9cf 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1061,9 +1061,6 @@ typedef struct stereo_dmx_evs_enc_data_structure typedef struct ivas_lfe_enc_data_structure { -#ifndef FIX_572_LFE_LPF_ENC - ivas_filters_process_state_t filter_state; -#endif LFE_WINDOW_HANDLE pWindow_state; BSTR_ENC_HANDLE hBstr; /* pointer to encoder bitstream handle */ const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; @@ -1166,9 +1163,7 @@ typedef struct MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; /* MC Param-Upmix handle */ MCMASA_ENC_HANDLE hMcMasa; /* Multi-channel MASA data handle */ LFE_ENC_HANDLE hLFE; /* LFE data handle */ -#ifdef FIX_572_LFE_LPF_ENC ivas_filters_process_state_t *hLfeLpf; /* low pass filter state for LFE */ -#endif ISM_MODE ism_mode; /* ISM format mode */ MC_MODE mc_mode; /* MC format mode */ -- GitLab From 19c0c55b07c4977c9e9df0e31a0129cd2c4888c7 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:11 +0200 Subject: [PATCH 478/591] accept FIX_578_PARAMMC_ILD_BS --- lib_com/options.h | 1 - lib_dec/ivas_mc_param_dec.c | 10 ---------- lib_enc/ivas_mc_param_enc.c | 8 -------- 3 files changed, 19 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 905ef21c5b..eeb8e57926 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ #define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 8f750fa819..0ba001d415 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -3090,19 +3090,13 @@ static void ivas_param_mc_bs_decode_parameter_values( int16_t i, j, k; float dequant_seq[PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE]; float dequant_ordered[PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE]; -#ifdef FIX_578_PARAMMC_ILD_BS int16_t n_lfe_idx; -#endif range_coding = bit_buffer[( *bit_pos )++]; /* Decoding the sequence */ -#ifdef FIX_578_PARAMMC_ILD_BS n_lfe_idx = map_size - map_size_wo_lfe; sz_seq = num_param_bands * ( map_size_wo_lfe ) + num_lfe_bands * n_lfe_idx; -#else - sz_seq = num_param_bands * ( map_size_wo_lfe ) + num_lfe_bands; -#endif set_s( idx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); set_zero( dequant_ordered, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); @@ -3163,14 +3157,10 @@ static void ivas_param_mc_bs_decode_parameter_values( for ( i = 0; i < num_lfe_bands; i++ ) { -#ifdef FIX_578_PARAMMC_ILD_BS for ( j = 0; j < n_lfe_idx; j++ ) { dequant_ordered[map_size - n_lfe_idx + j + i * map_size] = dequant_seq[k++]; } -#else - dequant_ordered[map_size - 1 + i * map_size] = dequant_seq[k++]; -#endif } if ( !( *BER_detect ) ) diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 95bb61c12d..248cae9e4d 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -1734,7 +1734,6 @@ static void ivas_param_mc_encode_parameter( if ( hMetadataPMC->bAttackPresent || hMetadataPMC->param_frame_idx == hMetadataPMC->coding_band_mapping[i] ) { /* LFE ICC/ILDs are always the last ones in coding band 0 */ -#ifdef FIX_578_PARAMMC_ILD_BS int16_t n_lfe_idx, k; n_lfe_idx = map_size - map_size_wo_lfe; for ( k = 0; k < n_lfe_idx; k++ ) @@ -1745,13 +1744,6 @@ static void ivas_param_mc_encode_parameter( idx_prev = idx; sz_seq++; } -#else - idx = quant_idx[( i + 1 ) * map_size - 1]; - seq[sz_seq] = idx; - seq_delta[sz_seq] = idx - idx_prev + idx_offset; - idx_prev = idx; - sz_seq++; -#endif } } } -- GitLab From e4754cd74fe52f6ae8ed860732970d83d3ce2333 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:11 +0200 Subject: [PATCH 479/591] accept FIX_UNCLR_ISSUE --- lib_com/options.h | 1 - lib_enc/ivas_stereo_classifier.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index eeb8e57926..6caea5eb61 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index eb0c054cd3..555a27d725 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -107,10 +107,8 @@ int16_t select_stereo_mode( /* set binary flag indicating LRTD mode based on unclr/xtalk classifiers' decisions */ hStereoClassif->prev_lrtd_mode = hStereoClassif->lrtd_mode; -#ifdef FIX_UNCLR_ISSUE hStereoClassif->unclr_decision = ( hStereoClassif->unclr_decision && hCPE->hCoreCoder[0]->flag_noisy_speech_snr == 0 && hCPE->element_brate > IVAS_16k4 ); -#endif hStereoClassif->lrtd_mode = ( ( hStereoClassif->unclr_decision | hStereoClassif->xtalk_decision ) && is_speech ); stereo_switching_flag = 1; -- GitLab From 9f8407bf00b266be7567b5aec8d0f60eceb8efe8 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:12 +0200 Subject: [PATCH 480/591] accept FIX_TCX_LOWRATE_LIMITATION --- lib_com/options.h | 1 - lib_enc/ivas_decision_matrix_enc.c | 29 ----------------------------- 2 files changed, 30 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6caea5eb61..9515c9eb2c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ #define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 3fcf9154f7..d381d34f8d 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -165,19 +165,6 @@ void ivas_decision_matrix_enc( st->core = mdct_classifier( st, fft_buff, enerBuffer, st->bits_frame_nominal * FRAMES_PER_SEC ); } -#ifndef FIX_TCX_LOWRATE_LIMITATION - /* Warning: TCX not available at low bitrates -> replace it by GSC */ - if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) - { - st->core = ACELP_CORE; - st->coder_type = AUDIO; - st->sp_aud_decision2 = 0; - if ( st->low_rate_mode ) - { - st->coder_type = INACTIVE; - } - } -#endif } /* do not allow TD stereo ACELP core -> DFT stereo TCX core switching as it is on the WC complexity path */ @@ -224,23 +211,8 @@ void ivas_decision_matrix_enc( } } -#ifndef FIX_TCX_LOWRATE_LIMITATION - /* TCX not available at low bitrates -> replace it by GSC */ - if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) - { - st->core = ACELP_CORE; - st->coder_type = AUDIO; - st->sp_aud_decision2 = 0; - - if ( st->low_rate_mode ) - { - st->coder_type = INACTIVE; - } - } -#endif #endif -#ifdef FIX_TCX_LOWRATE_LIMITATION /* TCX not available at low bitrates -> replace it by GSC */ if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) { @@ -253,7 +225,6 @@ void ivas_decision_matrix_enc( st->coder_type = INACTIVE; } } -#endif /*---------------------------------------------------------------------* * Select ACELP and GSC extension layer -- GitLab From 5d6d71ab9b8a5693b193ca8637c963b21a85c546 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:12 +0200 Subject: [PATCH 481/591] accept FIX_575_LOW_OVERLAP_PLC_RECOVERY --- lib_com/options.h | 1 - lib_dec/dec_tcx.c | 28 ---------------------------- 2 files changed, 29 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9515c9eb2c..29f0c7e2e3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ #define FIX_559_EXTL_IGF_MISMATCH /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ #define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ #define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index dd10cef293..cffb6a1092 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -377,11 +377,7 @@ void IMDCT( TCX_MDCT_Inverse( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, st->element_mode ); } -#ifndef FIX_575_LOW_OVERLAP_PLC_RECOVERY - tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core_bfi, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); -#else tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); -#endif if ( w > 0 ) { @@ -398,13 +394,11 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->prev_bfi && frame_cnt == 0 && st->last_core != st->last_core_bfi && st->last_core_bfi == ACELP_CORE ) { tcx_windowing_synthesis_past_frame( old_syn_overl, tcx_aldo_window_1_trunc, tcx_mdct_window_half, tcx_mdct_window_minimum, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, hTcxCfg->tcx_last_overlap_mode ); v_add( xn_buf, old_syn_overl, xn_buf, overlap ); } -#endif } else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ) @@ -1252,7 +1246,6 @@ void decoder_tcx_noisefilling( if ( ( frame_cnt == 0 ) && ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) && ( !st->tonal_mdct_plc_active ) && ( st->nbLostCmpt == 1 ) && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) { E_2ndlast = E_last = EPSILON; -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) @@ -1269,19 +1262,11 @@ void decoder_tcx_noisefilling( E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } -#else - for ( i = 0; i < infoIGFStartLine; i = i + 2 ) - { - E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; - E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; - } -#endif tmp2 = E_2ndlast / E_last; /* replace higher energy TCX5 frame by lower one to avoid energy fluctuation */ if ( tmp2 > 2 ) { -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) @@ -1296,16 +1281,9 @@ void decoder_tcx_noisefilling( st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } -#else - for ( i = 0; i < infoIGFStartLine; i = i + 2 ) - { - st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; - } -#endif } else if ( tmp2 < 0.5 ) { -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) @@ -1320,12 +1298,6 @@ void decoder_tcx_noisefilling( st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } } -#else - for ( i = 0; i < infoIGFStartLine; i = i + 2 ) - { - st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; - } -#endif } } -- GitLab From ba792e5898ce7d62100533100636fc6266f27e94 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:13 +0200 Subject: [PATCH 482/591] accept ISM_FB_16k4 --- lib_com/ivas_cnst.h | 4 ---- lib_com/options.h | 1 - lib_dec/gs_dec.c | 4 ---- 3 files changed, 9 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0a9c2960af..88b26c1454 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -313,11 +313,7 @@ typedef enum #define MIN_BRATE_SWB_SCE ACELP_9k60 /* min. SCE bitrate where SWB is supported */ #define MIN_BRATE_SWB_STEREO IVAS_13k2 /* min. stereo bitrate where SWB is supported */ #define MIN_BRATE_FB_STEREO IVAS_32k /* min. SCE and stereo bitrate where FB is supported */ -#ifdef ISM_FB_16k4 #define MIN_BRATE_FB_ISM 16000 /* min. SCE bitrate where FB is supported in ISM format */ -#else -#define MIN_BRATE_FB_ISM 24000 /* min. SCE bitrate where FB is supported in ISM format */ -#endif #define MIN_TDM_BRATE_WB_TBE_1k05 12000 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ #define MIN_BRATE_WB_TBE_1k05 9650 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ diff --git a/lib_com/options.h b/lib_com/options.h index 29f0c7e2e3..6a400ec2b1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,7 +161,6 @@ #define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ #define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ #define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ -#define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ #define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ #define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index 1244f97793..5ed7aa92c4 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -104,11 +104,7 @@ void decod_audio( } /* safety check in case of bit errors */ -#ifdef ISM_FB_16k4 if ( st->GSC_noisy_speech && st->bwidth < SWB && st->GSC_IVAS_mode == 0 ) -#else - if ( st->GSC_noisy_speech && st->bwidth != SWB && st->GSC_IVAS_mode == 0 ) -#endif { st->BER_detect = 1; st->GSC_noisy_speech = 0; -- GitLab From f3f0387a3f3f96657a047b58ee0965676b07bcc6 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:14 +0200 Subject: [PATCH 483/591] accept FIX_580_PARAMMC_ENER_BURSTS --- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_enc/ivas_mc_param_enc.c | 13 ------------- lib_enc/ivas_rom_enc.c | 2 -- lib_enc/ivas_rom_enc.h | 2 -- lib_enc/ivas_stat_enc.h | 2 -- 6 files changed, 22 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 88b26c1454..4cd06c6ed4 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1427,9 +1427,7 @@ typedef enum #define PARAM_MC_ENER_LIMIT_INTRAFRAME (1.5f) #define PARAM_MC_ENER_LIMIT_INTERFRAME (2.0f) #define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC (15.0f) -#ifdef FIX_580_PARAMMC_ENER_BURSTS #define PARAM_MC_NUM_ATTACK_ILD_THRESH (3) -#endif #define PARAM_MC_LFE_ON_THRESH (8000.0f) #define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */ #define PARAM_MC_SLOT_ENC_NS 2500000L diff --git a/lib_com/options.h b/lib_com/options.h index 6a400ec2b1..20a6deb336 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,7 +161,6 @@ #define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ #define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ #define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ -#define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ #define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ #define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ #define FIX_570_SF_EXT_ORIENTATION diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 248cae9e4d..3292796656 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -35,9 +35,7 @@ #include "options.h" #include "cnst.h" #include "rom_enc.h" -#ifdef FIX_580_PARAMMC_ENER_BURSTS #include "ivas_rom_enc.h" -#endif #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" @@ -215,13 +213,11 @@ ivas_error ivas_param_mc_enc_open( /* Init total/dmx ener factors */ set_f( hParamMC->ener_fac, 0.0f, PARAM_MC_MAX_PARAMETER_BANDS ); -#ifdef FIX_580_PARAMMC_ENER_BURSTS /* init previous ILDs */ for ( i = 0; i < PARAM_MC_MAX_PARAMETER_BANDS; i++ ) { set_zero( hParamMC->prev_ilds[i], PARAM_MC_SZ_ILD_MAP ); } -#endif st_ivas->hParamMC = hParamMC; @@ -494,9 +490,6 @@ void ivas_param_mc_enc( hParamMC->hMetadataPMC.attackIndex = 0; } -#ifndef FIX_580_PARAMMC_ENER_BURSTS - band_step = hParamMC->hMetadataPMC.bAttackPresent ? PARAM_MC_TRANSIENT_BAND_STEP : 1; -#endif } break; #ifdef DEBUGGING @@ -509,9 +502,7 @@ void ivas_param_mc_enc( /* parameter estimation*/ ivas_param_mc_param_est_enc( hParamMC, data_f, Cy_sum, Cx_sum, input_frame, nchan_inp, st_ivas->nchan_transport ); -#ifdef FIX_580_PARAMMC_ENER_BURSTS band_step = hParamMC->hMetadataPMC.bAttackPresent ? PARAM_MC_TRANSIENT_BAND_STEP : 1; -#endif /* ILD parameter quantization */ @@ -847,7 +838,6 @@ static void ivas_param_mc_param_est_enc( } } -#ifdef FIX_580_PARAMMC_ENER_BURSTS if ( !hParamMC->hMetadataPMC.bAttackPresent ) { const PARAM_MC_ILD_MAPPING *h_ild_mapping; @@ -903,7 +893,6 @@ static void ivas_param_mc_param_est_enc( hParamMC->hMetadataPMC.bAttackPresent = 1; } } -#endif if ( hParamMC->hMetadataPMC.bAttackPresent ) @@ -1356,13 +1345,11 @@ static void ivas_param_mc_quantize_ilds( ref_ener += Cx[ref_channel_idx][ref_channel_idx]; } ILD[k] = 10.0f * log10f( ( Nrg[h_ild_mapping->ild_index[k]] + EPSILON ) / ( hParamMC->hMetadataPMC.ild_factors[k] * ref_ener + EPSILON ) ); -#ifdef FIX_580_PARAMMC_ENER_BURSTS hParamMC->prev_ilds[freq_idx][k] = ILD[k]; if ( hParamMC->hMetadataPMC.bAttackPresent && ( ( freq_idx + 1 ) < hParamMC->hMetadataPMC.nbands_coded ) ) { hParamMC->prev_ilds[freq_idx + 1][k] = ILD[k]; } -#endif } diff --git a/lib_enc/ivas_rom_enc.c b/lib_enc/ivas_rom_enc.c index a031d6df28..ce24de702d 100644 --- a/lib_enc/ivas_rom_enc.c +++ b/lib_enc/ivas_rom_enc.c @@ -837,13 +837,11 @@ const HUFF_TABLE huff_beta_table[2] = const int16_t mc_paramupmix_fb_remix_order[4] = {0, 1, 2, 3}; -#ifdef FIX_580_PARAMMC_ENER_BURSTS /*----------------------------------------------------------------------------------* * ParamMC ROM tables *----------------------------------------------------------------------------------*/ const float param_mc_ild_diff_threshold[20] = { 8.0f, 8.0f, 10.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f }; -#endif /* clang-format on */ diff --git a/lib_enc/ivas_rom_enc.h b/lib_enc/ivas_rom_enc.h index 170bf31820..fa45706cab 100644 --- a/lib_enc/ivas_rom_enc.h +++ b/lib_enc/ivas_rom_enc.h @@ -130,12 +130,10 @@ extern const HUFF_TABLE huff_alpha_table[2]; extern const HUFF_TABLE huff_beta_table[2]; extern const int16_t mc_paramupmix_fb_remix_order[4]; -#ifdef FIX_580_PARAMMC_ENER_BURSTS /*----------------------------------------------------------------------------------* * ParamMC ROM tables *----------------------------------------------------------------------------------*/ extern const float param_mc_ild_diff_threshold[20]; -#endif #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 9a37f8f9cf..59abb33a0a 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -729,9 +729,7 @@ typedef struct ivas_param_mc_enc_data_structure int16_t lfe_index; int16_t icc_map_index[PARAM_MC_PARAMETER_FRAMES][PARAM_MC_SZ_ICC_MAP]; int16_t max_param_band_abs_cov; -#ifdef FIX_580_PARAMMC_ENER_BURSTS float prev_ilds[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP]; -#endif float ener_fac[PARAM_MC_MAX_PARAMETER_BANDS]; -- GitLab From 0609449a180a554eaf566bbc9e4843076151380a Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:14 +0200 Subject: [PATCH 484/591] accept FIX_593_STL_INCLUDE --- lib_com/options.h | 1 - lib_enc/ivas_stereo_eclvq_enc.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 20a6deb336..a3af537486 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,7 +164,6 @@ #define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ #define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ #define FIX_570_SF_EXT_ORIENTATION -#define FIX_593_STL_INCLUDE /* FhG: Issue 593: correct include of stl.h in lib_enc/ivas_stereo_eclvq_enc.c */ #define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ #define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ #define CODE_CLEAN_UP_DIRAC /* Dlb : code clean up*/ diff --git a/lib_enc/ivas_stereo_eclvq_enc.c b/lib_enc/ivas_stereo_eclvq_enc.c index 71f0bc805f..f71beece82 100644 --- a/lib_enc/ivas_stereo_eclvq_enc.c +++ b/lib_enc/ivas_stereo_eclvq_enc.c @@ -41,11 +41,7 @@ #include "prot.h" #include "wmc_auto.h" /* used only for norm_s in the code_length_from_count function */ -#ifdef FIX_593_STL_INCLUDE #include "stl.h" -#else -#include "basop32.h" -#endif /*--------------------------------------------------------------- -- GitLab From f8c9e32317f5bd26829f5de8714eca02116e1375 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:15 +0200 Subject: [PATCH 485/591] accept FIX_583_CLANG_TRANS_DET --- lib_com/options.h | 1 - lib_enc/stat_enc.h | 4 ---- lib_enc/transient_detection.c | 4 ---- 3 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a3af537486..1fc9f4fdd7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,7 +164,6 @@ #define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ #define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ #define FIX_570_SF_EXT_ORIENTATION -#define FIX_583_CLANG_TRANS_DET /* FhG: Issue 583: clang left shift on ramp_up_flag in transient detector */ #define FIX_280_PLANAR_CP /* Dlb : fix issue 28 : remove planarCP=1 related code*/ #define CODE_CLEAN_UP_DIRAC /* Dlb : code clean up*/ #define COVARIANCE_MEMORY_OPT /* Dlb : Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 45d01ac6ca..34efc3da7f 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -126,11 +126,7 @@ typedef struct float firState1; float firState2; -#ifdef FIX_583_CLANG_TRANS_DET uint16_t ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */ -#else - int16_t ramp_up_flag; /* bit map flags to indicate a ramp up in beginning of TCX frame */ -#endif } SubblockEnergies; diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index 3b345b7333..04cf8ea247 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -241,11 +241,7 @@ void RunTransientDetection( UpdateDelayBuffer( filteredInput, length, &hTranDet->delayBuffer ); /* compute ramp up flag */ -#ifdef FIX_583_CLANG_TRANS_DET pSubblockEnergies->ramp_up_flag = ( ( pSubblockEnergies->ramp_up_flag << 1 ) & 0x0003 ); -#else - pSubblockEnergies->ramp_up_flag = pSubblockEnergies->ramp_up_flag << 1; -#endif e0 = dotp( filteredInput + length / 2, filteredInput + length / 2, pSubblockEnergies->pDelayBuffer->nSubblockSize / 2 ) + 0.5f * MIN_BLOCK_ENERGY; e1 = pSubblockEnergies->subblockNrg[pSubblockEnergies->nDelay + 4] - e0; if ( e1 > e0 ) -- GitLab From 791ff315b9ebcb6cd46e09ed680ccd53b16e8977 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:15 +0200 Subject: [PATCH 486/591] accept FIX_581_CLANG_OFFSET_TO_NULL --- lib_com/options.h | 1 - lib_enc/ivas_stereo_mdct_stereo_enc.c | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1fc9f4fdd7..9fc5ffb8b5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,7 +169,6 @@ #define COVARIANCE_MEMORY_OPT /* Dlb : Issue 231: define SPAR covariance buffers in stack instead of inter-frame heap */ #define NONBE_FIX_589_JBM_TC_OFFSETS /* FhG: issue 589: wrong offset into the TC buffers is used in some rendering paths in the JBM main rendering function */ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ -#define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ #define FIX_582_INDEX_OUT_OF_BOUNDS_SNS_AVQ_DEC /* FhG: fix an undefined behaviour error in SNS AVQ decoding */ #define FIX_614_ADD_TO_NULL_PTR_DIRAC_SETUP /* FhG: Issue 614: prevent adding to a null pointer in dirac setup code */ diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 3d277e241d..d959cdba2f 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -1133,29 +1133,15 @@ void initMdctStereoEncData( set_s( hStereoMdct->mdct_stereo_mode, -1, 2 ); /*Initialize sfb parameteres for TCX20 */ -#ifdef FIX_581_CLANG_OFFSET_TO_NULL stereo_mdct_init_bands( tcx_coded_lines, TCX_20_CORE, element_brate, igf, igf ? &hIgfGrid[IGF_GRID_LB_NORM] : NULL, &hStereoMdct->stbParamsTCX20.sfbOffset[0], &hStereoMdct->stbParamsTCX20.sfbCnt ); -#else - stereo_mdct_init_bands( tcx_coded_lines, TCX_20_CORE, element_brate, igf, &hIgfGrid[IGF_GRID_LB_NORM], &hStereoMdct->stbParamsTCX20.sfbOffset[0], &hStereoMdct->stbParamsTCX20.sfbCnt ); -#endif /*Initialize sfb parameteres for TCX10 */ -#ifdef FIX_581_CLANG_OFFSET_TO_NULL stereo_mdct_init_bands( tcx_coded_lines, TCX_10_CORE, element_brate, igf, igf ? &hIgfGrid[IGF_GRID_LB_SHORT] : NULL, &hStereoMdct->stbParamsTCX10.sfbOffset[0], &hStereoMdct->stbParamsTCX10.sfbCnt ); -#else - stereo_mdct_init_bands( tcx_coded_lines, TCX_10_CORE, element_brate, igf, &hIgfGrid[IGF_GRID_LB_SHORT], - &hStereoMdct->stbParamsTCX10.sfbOffset[0], &hStereoMdct->stbParamsTCX10.sfbCnt ); -#endif /*Initialize sfb parameteres for transitions */ -#ifdef FIX_581_CLANG_OFFSET_TO_NULL stereo_mdct_init_bands( tcx_coded_lines, -1, element_brate, igf, igf ? &hIgfGrid[IGF_GRID_LB_TRAN] : NULL, &hStereoMdct->stbParamsTCX20afterACELP.sfbOffset[0], &hStereoMdct->stbParamsTCX20afterACELP.sfbCnt ); -#else - stereo_mdct_init_bands( tcx_coded_lines, -1, element_brate, igf, &hIgfGrid[IGF_GRID_LB_TRAN], - &hStereoMdct->stbParamsTCX20afterACELP.sfbOffset[0], &hStereoMdct->stbParamsTCX20afterACELP.sfbCnt ); -#endif set_s( hStereoMdct->IGFStereoMode, -1, 2 ); -- GitLab From fb4a10a363096159ce0b47058396537652f8a51b Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:16 +0200 Subject: [PATCH 487/591] accept REND_STATIC_MEM_OPT --- lib_com/options.h | 1 - lib_rend/lib_rend.c | 87 --------------------------------------------- 2 files changed, 88 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9fc5ffb8b5..612df0fdf2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,6 @@ #define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ /* Fixes for bugs found during split rendering contribution development */ -#define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ #define EULER2QUAT_FIX /* Dlb: Fix for Euler2Quat()/Quat2EulerDegree functions */ #define SBA_CREND_ROT_OPT /* Dlb: Optimisation for rotateFrameSba() used for SHD rotations in external renderer */ #define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c8c4cabc3b..87f6947c6a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -57,13 +57,9 @@ /* Maximum buffer length (total) in samples. */ #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef REND_STATIC_MEM_OPT #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) -#else /* REND_STATIC_MEM_OPT */ -#define MAX_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) -#endif /* REND_STATIC_MEM_OPT */ #else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) @@ -124,9 +120,6 @@ typedef struct IVAS_REND_AudioConfig inConfig; IVAS_REND_InputId id; IVAS_REND_AudioBuffer inputBuffer; -#ifndef REND_STATIC_MEM_OPT - float bufferData[MAX_BUFFER_LENGTH]; -#endif float gain; /* Linear, not in dB */ rendering_context ctx; int32_t numNewSamplesPerChannel; /* Used to keep track how much new audio was fed before rendering current frame */ @@ -144,9 +137,7 @@ typedef struct #ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ #endif -#ifdef REND_STATIC_MEM_OPT float *bufferData; -#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; OMASA_ANA_HANDLE hOMasa; @@ -183,9 +174,7 @@ typedef struct int16_t nonDiegeticPan; float nonDiegeticPanGain; lfe_routing lfeRouting; -#ifdef REND_STATIC_MEM_OPT float *bufferData; -#endif MCMASA_ANA_HANDLE hMcMasa; } input_mc; @@ -203,9 +192,7 @@ typedef struct rotation_gains rot_gains_prev; #endif -#ifdef REND_STATIC_MEM_OPT float *bufferData; -#endif DIRAC_ANA_HANDLE hDirAC; } input_sba; @@ -214,9 +201,7 @@ typedef struct { input_base base; SPLIT_POST_REND_WRAPPER splitPostRendWrapper; -#ifdef REND_STATIC_MEM_OPT float *bufferData; -#endif } input_split_post_rend; #endif @@ -230,9 +215,7 @@ typedef struct DecoderDummy *decDummy; MASA_METADATA_FRAME masaMetadata; bool metadataHasBeenFed; -#ifdef REND_STATIC_MEM_OPT float *bufferData; -#endif MASA_PREREND_HANDLE hMasaPrerend; } input_masa; @@ -281,7 +264,6 @@ struct IVAS_REND * Local functions *-------------------------------------------------------------------*/ -#ifdef REND_STATIC_MEM_OPT static ivas_error allocateInputBaseBufferData( float **data, const int16_t data_size ) { *data = (float *) malloc( data_size * sizeof( float ) ); @@ -303,7 +285,6 @@ static void freeInputBaseBufferData( float **data ) return; } -#endif static IVAS_QUATERNION quaternionInit( void ) @@ -1221,11 +1202,9 @@ static void initRendInputBase( const IVAS_REND_AudioConfig inConfig, const IVAS_REND_InputId id, const rendering_context rendCtx -#ifdef REND_STATIC_MEM_OPT , float *dataBuf, const int16_t dataBufSize -#endif ) { inputBase->inConfig = inConfig; @@ -1236,17 +1215,11 @@ static void initRendInputBase( inputBase->inputBuffer.config.numSamplesPerChannel = 0; inputBase->inputBuffer.config.numChannels = 0; -#ifndef REND_STATIC_MEM_OPT - inputBase->inputBuffer.data = inputBase->bufferData; - - set_zero( inputBase->bufferData, MAX_BUFFER_LENGTH ); -#else inputBase->inputBuffer.data = dataBuf; if ( inputBase->inputBuffer.data != NULL ) { set_zero( inputBase->inputBuffer.data, dataBufSize ); } -#endif return; } @@ -1386,17 +1359,13 @@ static ivas_error setRendInputActiveIsm( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#ifdef REND_STATIC_MEM_OPT if ( ( error = allocateInputBaseBufferData( &inputIsm->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } -#endif initRendInputBase( &inputIsm->base, inConfig, id, rendCtx -#ifdef REND_STATIC_MEM_OPT , inputIsm->bufferData, MAX_BUFFER_LENGTH -#endif ); inputIsm->currentPos = defaultObjectPosition(); @@ -1497,14 +1466,10 @@ static void clearInputIsm( rendCtx = inputIsm->base.ctx; -#ifdef REND_STATIC_MEM_OPT freeInputBaseBufferData( &inputIsm->base.inputBuffer.data ); -#endif initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); /* Free input's internal handles */ @@ -2408,17 +2373,13 @@ static ivas_error setRendInputActiveMc( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#ifdef REND_STATIC_MEM_OPT if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } -#endif initRendInputBase( &inputMc->base, inConfig, id, rendCtx -#ifdef REND_STATIC_MEM_OPT , inputMc->bufferData, MAX_BUFFER_LENGTH -#endif ); setZeroPanMatrix( inputMc->panGains ); inputMc->customLsInput = defaultCustomLs(); @@ -2472,14 +2433,10 @@ static void clearInputMc( rendCtx = inputMc->base.ctx; -#ifdef REND_STATIC_MEM_OPT freeInputBaseBufferData( &inputMc->bufferData ); -#endif initRendInputBase( &inputMc->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); /* Free input's internal handles */ @@ -2777,17 +2734,13 @@ static ivas_error setRendInputActiveSplitPostRend( rendCtx = inputSplitPostRend->base.ctx; outConfig = *rendCtx.pOutConfig; -#ifdef REND_STATIC_MEM_OPT if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, MAX_BIN_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } -#endif initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx -#ifdef REND_STATIC_MEM_OPT , inputSplitPostRend->bufferData, MAX_BIN_BUFFER_LENGTH -#endif ); if ( ( error = updateSplitPostRendPanGains( inputSplitPostRend, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) @@ -2842,7 +2795,6 @@ static ivas_error setRendInputActiveSba( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#ifdef REND_STATIC_MEM_OPT #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #else @@ -2856,9 +2808,6 @@ static ivas_error setRendInputActiveSba( #else initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); #endif /* SPLIT_REND_WITH_HEAD_ROT */ -#else /* REND_STATIC_MEM_OPT */ - initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); -#endif /* REND_STATIC_MEM_OPT */ setZeroPanMatrix( inputSba->hoaDecMtx ); #ifdef SPLIT_REND_WITH_HEAD_ROT inputSba->crendWrapper = NULL; @@ -2896,14 +2845,10 @@ static void clearInputSplitRend( rendCtx = inputSplitRend->base.ctx; -#ifdef REND_STATIC_MEM_OPT freeInputBaseBufferData( &inputSplitRend->bufferData ); -#endif initRendInputBase( &inputSplitRend->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); if ( inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend != NULL ) { @@ -2929,14 +2874,10 @@ static void clearInputSba( rendCtx = inputSba->base.ctx; -#ifdef REND_STATIC_MEM_OPT freeInputBaseBufferData( &inputSba->bufferData ); -#endif initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); /* Free input's internal handles */ @@ -3341,17 +3282,13 @@ static ivas_error setRendInputActiveMasa( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#ifdef REND_STATIC_MEM_OPT if ( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } -#endif initRendInputBase( &inputMasa->base, inConfig, id, rendCtx -#ifdef REND_STATIC_MEM_OPT , inputMasa->bufferData, MAX_BUFFER_LENGTH -#endif ); if ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) @@ -3473,16 +3410,12 @@ static void clearInputMasa( rendCtx = inputMasa->base.ctx; -#ifdef REND_STATIC_MEM_OPT freeInputBaseBufferData( &inputMasa->bufferData ); -#endif masaPrerendClose( &inputMasa->hMasaPrerend ); initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); freeDecoderDummy( &inputMasa->decDummy ); @@ -3635,10 +3568,8 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; @@ -3650,9 +3581,7 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].splitTdRendWrappers[j].hHrtfTD = NULL; } #endif -#ifdef REND_STATIC_MEM_OPT hIvasRend->inputsIsm[i].bufferData = NULL; -#endif hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsIsm[i].hOMasa = NULL; @@ -3661,18 +3590,14 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; hIvasRend->inputsMc[i].hReverb = NULL; hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; -#ifdef REND_STATIC_MEM_OPT hIvasRend->inputsMc[i].bufferData = NULL; -#endif hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; @@ -3688,35 +3613,27 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); hIvasRend->inputsSba[i].crendWrapper = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; hIvasRend->inputsSba[i].cldfbRendWrapper.hHrtfFastConv = NULL; #endif -#ifdef REND_STATIC_MEM_OPT hIvasRend->inputsSba[i].bufferData = NULL; -#endif hIvasRend->inputsSba[i].hDirAC = NULL; } for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); hIvasRend->inputsMasa[i].decDummy = NULL; hIvasRend->inputsMasa[i].metadataHasBeenFed = false; -#ifdef REND_STATIC_MEM_OPT hIvasRend->inputsMasa[i].bufferData = NULL; -#endif hIvasRend->inputsMasa[i].hMasaPrerend = NULL; } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -3726,19 +3643,15 @@ ivas_error IVAS_REND_Open( IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) -#ifdef REND_STATIC_MEM_OPT , NULL, 0 -#endif ); ivas_init_split_post_rend_handles( &hIvasRend->inputsSplitPost[i].splitPostRendWrapper ); #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->splitRendBFI = 0; #endif -#ifdef REND_STATIC_MEM_OPT hIvasRend->inputsSplitPost[i].bufferData = NULL; -#endif } #endif -- GitLab From d960ffa1e43260fd6cb707e2fa34753b2660bf5b Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:17 +0200 Subject: [PATCH 488/591] accept EULER2QUAT_FIX --- lib_com/options.h | 1 - lib_dec/lib_dec.c | 5 ----- lib_rend/ivas_rotation.c | 6 ------ lib_rend/lib_rend.c | 4 ---- 4 files changed, 16 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 612df0fdf2..84fd0427f7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,6 @@ #define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ /* Fixes for bugs found during split rendering contribution development */ -#define EULER2QUAT_FIX /* Dlb: Fix for Euler2Quat()/Quat2EulerDegree functions */ #define SBA_CREND_ROT_OPT /* Dlb: Optimisation for rotateFrameSba() used for SHD rotations in external renderer */ #define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ #define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b66d4ac420..686a4b6da7 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1195,11 +1195,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( { /* check for Euler angle signaling */ #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifndef EULER2QUAT_FIX - /* TODO: temp change until Euler2Quat() is fixed*/ - if ( ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && - ( hIvasDec->st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#endif #endif { if ( orientation[i].w == -3.0f ) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index a3bf1f1d92..c7d372d65d 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -225,17 +225,11 @@ void Quat2EulerDegree( { if ( quat.w != -3.0 ) { -#ifdef EULER2QUAT_FIX float p; -#endif *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); -#ifdef EULER2QUAT_FIX p = 2 * ( quat.w * quat.y - quat.z * quat.x ); p = max( -1.0f, min( 1.0f, p ) ); *pitch = asinf( p ); -#else - *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); -#endif *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); *yaw *= _180_OVER_PI; *pitch *= _180_OVER_PI; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 87f6947c6a..5f90e361ce 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5013,11 +5013,7 @@ ivas_error IVAS_REND_SetHeadRotation( ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { -#ifndef EULER2QUAT_FIX - rotQuat = headRot[i]; /* TODO: temp change until Euler2Quat() is fixed*/ -#else Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); -#endif } else #endif -- GitLab From 06abef459449d5fd02e129aff87982eeee03f77f Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 11:48:17 +0200 Subject: [PATCH 489/591] accept SBA_CREND_ROT_OPT --- lib_com/options.h | 1 - lib_rend/lib_rend.c | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 84fd0427f7..b56d19f88d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,6 @@ #define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ /* Fixes for bugs found during split rendering contribution development */ -#define SBA_CREND_ROT_OPT /* Dlb: Optimisation for rotateFrameSba() used for SHD rotations in external renderer */ #define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ #define TD_REND_FIX_DIV_BY_ZERO /* FhG: avoid division by zero in sincResample fn */ #define RENAME_GWLPR /* FhG: Rename clashing symbol */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5f90e361ce..cde8417714 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5502,19 +5502,13 @@ static ivas_error rotateFrameSba( int16_t m1, m2; int16_t shd_rot_max_order; int16_t subframe_idx, subframe_len; -#ifdef SBA_CREND_ROT_OPT float *writePtr; -#else - float *readPtr, *writePtr; -#endif rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; rotation_gains gains; ivas_error error; -#ifdef SBA_CREND_ROT_OPT int16_t idx; float val, cf, oneminuscf; -#endif push_wmops( "rotateFrameSba" ); @@ -5555,11 +5549,9 @@ static ivas_error rotateFrameSba( for ( i = 0; i < subframe_len; i++ ) { -#ifdef SBA_CREND_ROT_OPT idx = subframe_idx * subframe_len + i; cf = headRotData->crossfade[i]; oneminuscf = 1 - cf; -#endif /* As the rotation matrix becomes block diagonal in a SH basis, we can*/ /* apply each angular-momentum block individually to save complexity. */ @@ -5575,16 +5567,9 @@ static ivas_error rotateFrameSba( for ( m = m1; m < m2; m++ ) { -#ifdef SBA_CREND_ROT_OPT val = inAudio.data[m * inAudio.config.numSamplesPerChannel + idx]; /* crossfade with previous rotation gains */ tmpRot[n - m1] += ( cf * gains[n][m] * val + oneminuscf * gains_prev[n][m] * val ); -#else - readPtr = getSmplPtr( inAudio, m, subframe_idx * subframe_len + i ); - /* crossfade with previous rotation gains */ - tmpRot[n - m1] += headRotData->crossfade[i] * gains[n][m] * ( *readPtr ) + - ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); -#endif } } /* write back the result */ -- GitLab From 1577f8d841b0df2559f00f3637e7708ed7c66f88 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 24 Jul 2023 12:38:40 +0200 Subject: [PATCH 490/591] apply clang-format --- lib_enc/ivas_decision_matrix_enc.c | 1 - lib_enc/ivas_mc_param_enc.c | 1 - lib_rend/lib_rend.c | 91 ++++++++++-------------------- 3 files changed, 30 insertions(+), 63 deletions(-) diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index d381d34f8d..c731eeff02 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -164,7 +164,6 @@ void ivas_decision_matrix_enc( /* select TCX core or HQ core using bits_frame_nominal to match the TCX configuration bitrate */ st->core = mdct_classifier( st, fft_buff, enerBuffer, st->bits_frame_nominal * FRAMES_PER_SEC ); } - } /* do not allow TD stereo ACELP core -> DFT stereo TCX core switching as it is on the WC complexity path */ diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 3292796656..2979a9bdb5 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -489,7 +489,6 @@ void ivas_param_mc_enc( { hParamMC->hMetadataPMC.attackIndex = 0; } - } break; #ifdef DEBUGGING diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index cde8417714..9509f11bc5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1201,11 +1201,9 @@ static void initRendInputBase( input_base *inputBase, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_InputId id, - const rendering_context rendCtx - , + const rendering_context rendCtx, float *dataBuf, - const int16_t dataBufSize -) + const int16_t dataBufSize ) { inputBase->inConfig = inConfig; inputBase->id = id; @@ -1363,10 +1361,8 @@ static ivas_error setRendInputActiveIsm( { return error; } - initRendInputBase( &inputIsm->base, inConfig, id, rendCtx - , - inputIsm->bufferData, MAX_BUFFER_LENGTH - ); + initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, + inputIsm->bufferData, MAX_BUFFER_LENGTH ); inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); @@ -1467,10 +1463,8 @@ static void clearInputIsm( rendCtx = inputIsm->base.ctx; freeInputBaseBufferData( &inputIsm->base.inputBuffer.data ); - initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx - , - NULL, 0 - ); + initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + NULL, 0 ); /* Free input's internal handles */ @@ -2377,10 +2371,8 @@ static ivas_error setRendInputActiveMc( { return error; } - initRendInputBase( &inputMc->base, inConfig, id, rendCtx - , - inputMc->bufferData, MAX_BUFFER_LENGTH - ); + initRendInputBase( &inputMc->base, inConfig, id, rendCtx, + inputMc->bufferData, MAX_BUFFER_LENGTH ); setZeroPanMatrix( inputMc->panGains ); inputMc->customLsInput = defaultCustomLs(); inputMc->tdRendWrapper = defaultTdRendWrapper(); @@ -2434,10 +2426,8 @@ static void clearInputMc( rendCtx = inputMc->base.ctx; freeInputBaseBufferData( &inputMc->bufferData ); - initRendInputBase( &inputMc->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx - , - NULL, 0 - ); + initRendInputBase( &inputMc->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + NULL, 0 ); /* Free input's internal handles */ if ( inputMc->efapInWrapper.hEfap != NULL ) @@ -2738,10 +2728,8 @@ static ivas_error setRendInputActiveSplitPostRend( { return error; } - initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx - , - inputSplitPostRend->bufferData, MAX_BIN_BUFFER_LENGTH - ); + initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx, + inputSplitPostRend->bufferData, MAX_BIN_BUFFER_LENGTH ); if ( ( error = updateSplitPostRendPanGains( inputSplitPostRend, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { @@ -2846,10 +2834,8 @@ static void clearInputSplitRend( rendCtx = inputSplitRend->base.ctx; freeInputBaseBufferData( &inputSplitRend->bufferData ); - initRendInputBase( &inputSplitRend->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx - , - NULL, 0 - ); + initRendInputBase( &inputSplitRend->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + NULL, 0 ); if ( inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend != NULL ) { ivas_splitBinPostRendClose( &inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend ); @@ -2875,10 +2861,8 @@ static void clearInputSba( rendCtx = inputSba->base.ctx; freeInputBaseBufferData( &inputSba->bufferData ); - initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx - , - NULL, 0 - ); + initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + NULL, 0 ); /* Free input's internal handles */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -3286,10 +3270,8 @@ static ivas_error setRendInputActiveMasa( { return error; } - initRendInputBase( &inputMasa->base, inConfig, id, rendCtx - , - inputMasa->bufferData, MAX_BUFFER_LENGTH - ); + initRendInputBase( &inputMasa->base, inConfig, id, rendCtx, + inputMasa->bufferData, MAX_BUFFER_LENGTH ); if ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) { @@ -3413,10 +3395,8 @@ static void clearInputMasa( freeInputBaseBufferData( &inputMasa->bufferData ); masaPrerendClose( &inputMasa->hMasaPrerend ); - initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx - , - NULL, 0 - ); + initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + NULL, 0 ); freeDecoderDummy( &inputMasa->decDummy ); return; @@ -3567,10 +3547,8 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) - , - NULL, 0 - ); + initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + NULL, 0 ); hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; @@ -3589,10 +3567,8 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) - , - NULL, 0 - ); + initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + NULL, 0 ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; hIvasRend->inputsMc[i].hReverb = NULL; @@ -3612,10 +3588,8 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) - , - NULL, 0 - ); + initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + NULL, 0 ); hIvasRend->inputsSba[i].crendWrapper = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; @@ -3627,10 +3601,8 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) - , - NULL, 0 - ); + initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + NULL, 0 ); hIvasRend->inputsMasa[i].decDummy = NULL; hIvasRend->inputsMasa[i].metadataHasBeenFed = false; hIvasRend->inputsMasa[i].bufferData = NULL; @@ -3642,16 +3614,13 @@ ivas_error IVAS_REND_Open( initRendInputBase( &hIvasRend->inputsSplitPost[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, - getRendCtx( hIvasRend ) - , - NULL, 0 - ); + getRendCtx( hIvasRend ), + NULL, 0 ); ivas_init_split_post_rend_handles( &hIvasRend->inputsSplitPost[i].splitPostRendWrapper ); #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->splitRendBFI = 0; #endif hIvasRend->inputsSplitPost[i].bufferData = NULL; - } #endif -- GitLab From b2c699554f83bcc18c40d47b88370e182ad7de9b Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Mon, 24 Jul 2023 16:16:43 +0530 Subject: [PATCH 491/591] adding comments and removing extra line --- apps/decoder.c | 1 + lib_dec/ivas_binRenderer_internal.c | 13 +++++++------ lib_dec/ivas_init_dec.c | 2 ++ lib_rend/ivas_stat_rend.h | 5 +++-- lib_util/hrtf_file_reader.c | 2 ++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index c430e9d041..6e3e23bb47 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -664,6 +664,7 @@ int main( } IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL; IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ); + if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfCRendFileName ); diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index b3b9663bf6..5b81375d30 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -496,12 +496,13 @@ static ivas_error ivas_binRenderer_convModuleOpen( *-------------------------------------------------------------------------*/ ivas_error ivas_allocate_binaural_hrtf( - HRTFS_FASTCONV *HrtfFastConv, - AUDIO_CONFIG output_config, - BINAURAL_INPUT_AUDIO_CONFIG input_config, - RENDERER_TYPE renderer_type, - int8_t is_loudspeaker_setup, - int16_t allocate_init_flag ) + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + AUDIO_CONFIG output_config, /* i : output audio configuration */ + BINAURAL_INPUT_AUDIO_CONFIG input_config, /* i : binaural input audio config */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + int8_t is_loudspeaker_setup, /* i : loudspeaker setup information */ + int16_t allocate_init_flag /* i : Memory allocation flag */ +) { int16_t i, j; /*malloc for HOA3, HOA2, FOA*/ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f5e754d826..48733a8846 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -663,6 +663,7 @@ ivas_error ivas_init_decoder_front( { return error; } + if ( ( error = ivas_HRTF_parambin_binary_open( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -2037,6 +2038,7 @@ void ivas_destroy_dec( /* CRend binaural renderer handle */ ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); #ifdef FIX_1720_HRTF_FASTCONV + /* Fastconv HRTF memories */ ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv ); #endif /* Fastconv HRTF filters */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 131199e14c..ab4c53364b 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1378,9 +1378,10 @@ typedef struct ivas_hrtfs_fastconv_struct float ***rightHRIRReal_FOA; float ***rightHRIRImag_FOA; float FASTCONV_FOA_latency_s; + BINAURAL_INPUT_AUDIO_CONFIG input_cfg_var; - int16_t allocate_init_flag; - int16_t nChannels; + int16_t allocate_init_flag; /*Memory allocation flag 0: if the hrtf pointers are allocated at application level , 1: of allocated at ivas_binaural_hrtf_open() */ + int16_t nChannels; /*Number of channels updated based on maximum of cicp table*/ #else #ifdef UPDATE_FASTCONV_SBA_FILTER float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index fd7e339084..78024cfddc 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -34,6 +34,7 @@ #include #include "prot.h" #include "ivas_prot_rend.h" + #ifdef FIX_1720_HRTF_FASTCONV #include "ivas_prot.h" #endif @@ -1544,6 +1545,7 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } + /* Create the HRTF reading the raw data from the binary file */ if ( ( create_fastconv_HRTF_from_rawdata( &hHrtfFastConv, hrtf_data, hrtf_header.rend_type, hrtf_header.input_cfg ) ) != IVAS_ERR_OK ) { -- GitLab From 0f487f6b2b7131efed64bdba20cef7b1b340d53c Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 24 Jul 2023 22:58:16 +1000 Subject: [PATCH 492/591] rtyag comments --- lib_dec/ivas_binRenderer_internal.c | 11 ++++++++++- lib_util/hrtf_file_reader.c | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5b81375d30..2b266e5012 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -494,7 +494,9 @@ static ivas_error ivas_binRenderer_convModuleOpen( * * Allocate memory for HrtfFastConv structure elements *-------------------------------------------------------------------------*/ - +/*output_config is actually input_config. So please rename. +BINAURAL_INPUT_AUDIO_CONFIG input_config can renamed as BINAURAL_INPUT_AUDIO_CONFIG bin_input_config +*/ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ AUDIO_CONFIG output_config, /* i : output audio configuration */ @@ -514,6 +516,9 @@ ivas_error ivas_allocate_binaural_hrtf( } else { + /*Too much code duplication. Add a function that takes in tripple pointer and 3 dimension lengths as input and just call that function + for leftHRIRReal_HOA3, leftHRIRReal_HOA2, leftHRIRReal_FOA, leftHRIRReal, leftBRIRReal + */ if ( ( HrtfFastConv->leftHRIRReal_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); @@ -774,6 +779,7 @@ ivas_error ivas_allocate_binaural_hrtf( } } } + /*its not clear why BRIR buffer cant be allocated for HRTF_LS_CHANNELS always ?? and why we need to have all if checks for different LS configs*/ if ( allocate_init_flag == 1 ) { if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && is_loudspeaker_setup == 0 ) /*7_1_4*/ @@ -1248,6 +1254,9 @@ static ivas_error ivas_binaural_hrtf_open( { for ( j = 0; j < HrtfFastConv->nChannels; j++ ) { + /*HrtfFastConv->leftBRIRReal[i][j] can always be allocated for 15 channels. + No need to have HrtfFastConv->nChannels, simply use HRTF_LS_CHANNELS + */ HrtfFastConv->leftBRIRReal[i][j] = leftBRIRReal[i][j]; HrtfFastConv->leftBRIRImag[i][j] = leftBRIRImag[i][j]; HrtfFastConv->rightBRIRReal[i][j] = rightBRIRReal[i][j]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 78024cfddc..4a88d85005 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1436,6 +1436,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { + /*here it seems to be always execting HRTF_LS_CHANNELS channels*/ for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { memcpy( ( *hHRTF )->leftBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); -- GitLab From 9b02e1c81ded7b5fcbcc0dafcb0432b7293ee97c Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 24 Jul 2023 23:30:39 +1000 Subject: [PATCH 493/591] split rend MC 160 fixes, CLDFB interface placeholder, finer quantization for pose correction MD --- lib_com/ivas_cnst.h | 19 +++++ lib_com/options.h | 4 +- lib_dec/ivas_binRenderer_internal.c | 102 ++++++++++++++++++++++-- lib_dec/ivas_dec.c | 51 +++--------- lib_dec/ivas_dirac_dec.c | 23 +++++- lib_dec/ivas_init_dec.c | 22 ++++- lib_dec/ivas_rom_dec.c | 104 +++++++++++++++++++++--- lib_dec/ivas_rom_dec.h | 8 ++ lib_dec/ivas_stat_dec.h | 9 +++ lib_dec/lib_dec.c | 58 ++++++++++++++ lib_dec/lib_dec.h | 11 +++ lib_rend/ivas_splitRendererPost.c | 107 +++++++++++++++++++++++-- lib_rend/ivas_splitRendererPre.c | 119 ++++++++++++++++++++++++++-- lib_rend/ivas_splitRenderer_utils.c | 25 ++++++ lib_rend/ivas_stat_rend.h | 12 +++ 15 files changed, 601 insertions(+), 73 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4080485f60..addd0ad017 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1512,6 +1512,9 @@ typedef enum PITCH_ONLY, ANY_ROLL, PRED_ONLY, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + PRED_ROLL_ONLY, +#endif COM_GAIN_ONLY, LR_GAIN_ONLY } IVAS_SPLIT_REND_POSE_TYPE; @@ -1552,7 +1555,13 @@ typedef enum #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS +#define IVAS_SPLIT_REND_PRED_63QUANT_PNTS ( 63 ) +#define IVAS_SPLIT_REND_PRED_31QUANT_PNTS ( 31 ) +#define IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS ( 31 ) +#else #define IVAS_SPLIT_REND_PRED_QUANT_PNTS ( 31 ) +#endif #define IVAS_SPLIT_REND_D_QUANT_PNTS ( 15 ) #define IVAS_SPLIT_REND_PRED_MIN_VAL ( -1.4f ) #define IVAS_SPLIT_REND_PRED_MAX_VAL ( 1.4f ) @@ -1563,8 +1572,18 @@ typedef enum #define IVAS_SPLIT_REND_D_MIN_VAL ( 0.0f ) #define IVAS_SPLIT_REND_D_MAX_VAL ( 1.0f ) +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS +#define IVAS_SPLIT_REND_PRED_ROLL_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 )) +#define IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP (( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL )) +#define IVAS_SPLIT_REND_PRED31_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 )) +#define IVAS_SPLIT_REND_PRED31_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL )) +#define IVAS_SPLIT_REND_PRED63_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_63QUANT_PNTS - 1 )) +#define IVAS_SPLIT_REND_PRED63_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_63QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL )) +#else #define IVAS_SPLIT_REND_PRED_Q_STEP (( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL ) / ( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )) #define IVAS_SPLIT_REND_PRED_1BYQ_STEP (( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PRED_MAX_VAL - IVAS_SPLIT_REND_PRED_MIN_VAL )) +#endif + #define IVAS_SPLIT_REND_D_Q_STEP (( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL ) / ( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 )) #define IVAS_SPLIT_REND_D_1BYQ_STEP (( IVAS_SPLIT_REND_D_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_D_MAX_VAL - IVAS_SPLIT_REND_D_MIN_VAL )) #define IVAS_SPLIT_REND_PITCH_G_Q_STEP (( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) / ( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 )) diff --git a/lib_com/options.h b/lib_com/options.h index 570d275dd2..5f83da8175 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -195,7 +195,9 @@ #define RENAME_GWLPR /* FhG: Rename clashing symbol */ #define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ - +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define SPLIT_REND_PRED_QUANT_63_PNTS +#endif /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 1c7372c932..f8d000e429 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1270,8 +1270,8 @@ void ivas_binaural_cldfb( float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #ifdef SPLIT_REND_WITH_HEAD_ROT - float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -1309,6 +1309,33 @@ void ivas_binaural_cldfb( idx_in++; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*LFE handling for split rendering cases*/ + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) + { + ch = st_ivas->hIntSetup.index_lfe[idx_lfe]; + cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ), + Cldfb_RealBuffer[idx_in][slot_idx], + Cldfb_ImagBuffer[idx_in][slot_idx], + maxBand, st_ivas->cldfbAnaDec[idx_in] ); + idx_in++; + } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) + { + for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand ); + } + st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config; + } +#endif + } +#endif } /* Implement binaural rendering */ @@ -1325,6 +1352,44 @@ void ivas_binaural_cldfb( Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + int16_t pos_idx; + for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) + { + if ( st_ivas->hIntSetup.num_lfe > 0 ) + { + v_multc( Cldfb_RealBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], GAIN_LFE, Cldfb_RealBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], maxBand ); + v_multc( Cldfb_ImagBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], GAIN_LFE, Cldfb_ImagBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], maxBand ); + } + } + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) + { + for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) + { + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + if ( st_ivas->hIntSetup.num_lfe > 0 ) + { + v_add( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], + Cldfb_RealBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], + Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], + maxBand ); + v_add( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], + Cldfb_ImagBuffer[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], + Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], + maxBand ); + } + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand ); + } + } + } + } +#endif + /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -1370,8 +1435,8 @@ void ivas_binaural_cldfb_sf( float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #ifdef SPLIT_REND_WITH_HEAD_ROT - float Cldfb_RealBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[1][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; #else float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -1440,6 +1505,25 @@ void ivas_binaural_cldfb_sf( #endif st_ivas->hCombinedOrientationData, subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + int16_t pos_idx; + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) + { + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) + { + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand ); + } + } + } + } +#endif + /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -1594,7 +1678,15 @@ void ivas_binRenderer( QuatToRotMat( Quaternions_rel, Rmat_local ); - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) + { + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); + } + else + { + rotateFrame_sd_cldfb( Rmat_local, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); + } + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer, pos_idx ); } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 5fa8d4bec4..01b9fc0464 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -124,7 +124,7 @@ ivas_error ivas_dec( assert( ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) && - ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); + ( output_Fs == 48000 ) && "split binaural mode is currently not supported with paramteric renderers and 16/32 kHz sampling rates" ); ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits ); } #endif @@ -593,11 +593,16 @@ ivas_error ivas_dec( ivas_mc_paramupmix_dec( st_ivas, output ); /* HP filtering */ - for ( n = 0; n < st_ivas->nchan_transport; n++ ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) +#endif { - if ( n != LFE_CHANNEL ) + for ( n = 0; n < st_ivas->nchan_transport; n++ ) { - hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + if ( n != LFE_CHANNEL ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } } } @@ -610,45 +615,15 @@ ivas_error ivas_dec( #ifdef JBM_PARAMUPMIX if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - ivas_rend_crendProcessSplitBin( - st_ivas->hCrendWrapper, - st_ivas->intern_config, - st_ivas->hOutSetup.output_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, - st_ivas->hEFAPdata, - p_output, - output_Fs ); - } - else - { + if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && + ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #endif - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - 0 -#endif - ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifdef SPLIT_REND_WITH_HEAD_ROT + { ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); } -#endif -#endif /* JBM_PARAMUPMIX */ } +#endif /* JBM_PARAMUPMIX */ else if ( st_ivas->renderer_type == RENDERER_MC ) { if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index c1ea3765a2..5bcceab9a5 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2929,6 +2929,25 @@ void ivas_dirac_dec_render_sf( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) + { + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + for ( ch = 0; ch < st_ivas->hBinRenderer->nInChannels; ch++ ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); + } + } + st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config; + } + } +#endif + /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2947,11 +2966,7 @@ void ivas_dirac_dec_render_sf( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t pos_idx; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) -#else for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) -#endif { for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ee15c79faa..fe5b4eca09 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1265,6 +1265,13 @@ ivas_error ivas_init_decoder( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->splitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis ); + if ( st_ivas->splitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + if ( ( st_ivas->splitBinRend.hCldfbDataOut = (IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) ); + } + } } #endif if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -1486,8 +1493,14 @@ ivas_error ivas_init_decoder( { if ( st_ivas->hBinRenderer->render_lfe ) { - /* Account for filterbank delay */ - binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && + ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#endif + { + /* Account for filterbank delay */ + binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; + } } else { @@ -1791,6 +1804,7 @@ void ivas_initialize_handles_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT st_ivas->splitBinRend.hMultiBinCldfbData = NULL; st_ivas->splitBinRend.hSplitRendBits = NULL; + st_ivas->splitBinRend.hCldfbDataOut = NULL; ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend ); #endif st_ivas->hDiracDecBin = NULL; @@ -1950,6 +1964,10 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural renderer handle */ ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); + if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) + { + free( st_ivas->splitBinRend.hCldfbDataOut ); + } #endif /* Parametric binaural renderer handle */ diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 5ca2f3fe0f..f89b22022c 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -584,17 +584,95 @@ const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] = { { 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 }, { 12, 13, 8190 },{ 13, 14, 16382 },{ 14, 14, 16383 } }; -const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3] = { - /* - { -15, 16, 65532 },{ -14, 16, 65533 },{ -13, 15, 32764 },{ -12, 14, 16380 }, - { -11, 13, 8188 },{ -10, 12, 4092 },{ -9, 11, 2044 },{ -8, 10, 1020 },{ -7, 9, 508 }, - { -6, 8, 252 },{ -5, 7, 124 },{ -4, 6, 60 },{ -3, 5, 28 }, - { -2, 4, 12 },{ -1, 3, 4 },{ 0, 1, 0 },{ 1, 3, 5 }, - { 2, 4, 13 },{ 3, 5, 29 },{ 4, 6, 61 },{ 5, 7, 125 }, - { 6, 8, 253 },{ 7, 9, 509 },{ 8, 10, 1021 },{ 9, 11, 2045 }, - { 10, 12, 4093 },{ 11, 13, 8189 },{ 12, 14, 16381 },{ 13, 15, 32765 }, - { 14, 16, 65534 },{ 15, 16, 65535 }*/ +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS +const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_63QUANT_PNTS][3] = { +{-31,11,2040}, +{-30,11,2041}, +{-29,11,2042}, +{-28,11,2043}, +{-27,10,1012}, +{-26,10,1013}, +{-25,10,1014}, +{-24,10,1015}, +{-23,9,498}, +{-22,9,499}, +{-21,9,500}, +{-20,9,501}, +{-19,8,242}, +{-18,8,243}, +{-17,8,244}, +{-16,8,245}, +{-15,7,112}, +{-14,7,113}, +{-13,7,114}, +{-12,7,115}, +{-11,6,48}, +{-10,6,49}, +{-9,6,50}, +{-8,6,51}, +{-7,5,16}, +{-6,5,17}, +{-5,5,18}, +{-4,5,19}, +{-3,4,2}, +{-2,4,3}, +{-1,4,4}, +{0,3,0}, +{1,4,5}, +{2,4,6}, +{3,4,7}, +{4,5,20}, +{5,5,21}, +{6,5,22}, +{7,5,23}, +{8,6,52}, +{9,6,53}, +{10,6,54}, +{11,6,55}, +{12,7,116}, +{13,7,117}, +{14,7,118}, +{15,7,119}, +{16,7,120}, +{17,8,246}, +{18,8,247}, +{19,8,248}, +{20,9,502}, +{21,9,503}, +{22,9,504}, +{23,9,505}, +{24,10,1016}, +{25,10,1017}, +{26,10,1018}, +{27,10,1019}, +{28,11,2044}, +{29,11,2045}, +{30,11,2046}, +{31,11,2047}, +}; +const int32_t ivas_split_rend_huff_pred31_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3] = { +{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507}, +{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121}, +{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8}, +{-2,4,9},{-1,3,2},{0,2,0},{1,3,3}, +{2,4,10},{3,4,11},{4,5,26},{5,5,27}, +{6,6,58},{7,6,59},{8,7,122},{9,7,123}, +{10,7,124},{11,8,252},{12,9,508},{13,9,509}, +{14,10,1022},{15,10,1023}, +}; +const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3] = { +{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507}, +{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121}, +{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8}, +{-2,4,9},{-1,3,2},{0,2,0},{1,3,3}, +{2,4,10},{3,4,11},{4,5,26},{5,5,27}, +{6,6,58},{7,6,59},{8,7,122},{9,7,123}, +{10,7,124},{11,8,252},{12,9,508},{13,9,509}, +{14,10,1022},{15,10,1023}, +}; +#else +const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3] = { {-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507}, {-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121}, {-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8}, @@ -604,11 +682,9 @@ const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][ {10,7,124},{11,8,252},{12,9,508},{13,9,509}, {14,10,1022},{15,10,1023}, }; +#endif #endif /* SPLIT_REND_WITH_HEAD_ROT */ -/* clang-format on */ - - const int16_t huff_nodes_first_band_alpha[32][2] = { /* Alpha Fine Huffman table df0 */ { -17, 1 }, { 3, 2 }, @@ -894,3 +970,5 @@ HUFF_NODE_TABLE huff_nodes_dt = { { huff_nodes_alpha_1D_DT, huff_nodes_alpha_1D_DT_coarse }, { huff_nodes_beta_1D_DT, huff_nodes_beta_1D_DT_coarse } }; + +/* clang-format on */ diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index c2b879f2bf..e47f66807f 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -139,7 +139,15 @@ extern const float split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_O extern const float split_rend_relative_pos_angles[MAX_HEAD_ROT_POSES][3]; extern const int16_t SplitRend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1]; extern const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS +extern const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3]; +extern const int32_t ivas_split_rend_huff_pred31_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3]; +#else extern const int32_t ivas_split_rend_huff_pred_consts[IVAS_SPLIT_REND_PRED_QUANT_PNTS][3]; +#endif +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS +extern const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3]; +#endif extern const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; extern const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3]; extern const int32_t split_rend_brate_tbl[]; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 94953f63a4..cd102fb7e2 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1212,11 +1212,20 @@ typedef struct float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; } IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA, *IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE; + +typedef struct +{ + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + AUDIO_CONFIG config; +} IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA, *IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE; + typedef struct { IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE hMultiBinCldfbData; /*scratch buffer for frame by frame processing*/ IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; /*scratch buffer for frame by frame processing*/ SPLIT_REND_WRAPPER splitrend; + IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/ } IVAS_DEC_SPLIT_REND_WRAPPER; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b66d4ac420..f2fd7407f2 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3237,3 +3237,61 @@ ivas_error IVAS_DEC_VoIP_reconfigure( return error; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*---------------------------------------------------------------------* + * IVAS_DEC_GetCldfbSamples() + * + * + *---------------------------------------------------------------------*/ +ivas_error IVAS_DEC_GetCldfbSamples( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + float *out_real, /* o: buffer for decoded PCM real output in CLDFB domain */ + float *out_imag, /* o: buffer for decoded PCM imag output in CLDFB domain */ + IVAS_DEC_AUDIO_CONFIG *audio_config, + int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ +) +{ + Decoder_Struct *st_ivas; + ivas_error error; + int16_t ch, b, slot_idx, num_chs, maxBand, num_samples; + + error = IVAS_ERR_OK; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + st_ivas = hIvasDec->st_ivas; + num_samples = 0; + if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) + { + *audio_config = st_ivas->splitBinRend.hCldfbDataOut->config; + if ( st_ivas->splitBinRend.hCldfbDataOut->config != AUDIO_CONFIG_INVALID ) + { + getAudioConfigNumChannels( st_ivas->splitBinRend.hCldfbDataOut->config, &num_chs ); + maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + for ( b = 0; b < maxBand; b++ ) + { + for ( ch = 0; ch < num_chs; ch++ ) + { + *out_real++ = st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx][b]; + *out_imag++ = st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx][b]; + } + } + } + num_samples = CLDFB_NO_COL_MAX * maxBand; + } + } + else + { + *audio_config = AUDIO_CONFIG_INVALID; + } + *nOutSamples = num_samples; + return error; +} +#endif \ No newline at end of file diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 9edc1a130c..1f2c62e5fd 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -182,6 +182,17 @@ ivas_error IVAS_DEC_GetSamples( #endif ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*! r: decoder error code */ +ivas_error IVAS_DEC_GetCldfbSamples( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + float *out_real, /* o: buffer for decoded PCM real output in CLDFB domain */ + float *out_imag, /* o: buffer for decoded PCM imag output in CLDFB domain */ + IVAS_DEC_AUDIO_CONFIG *audio_config, + int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ +); +#endif + /*! r: error code */ ivas_error IVAS_DEC_GetObjectMetadata( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 74fb7fae68..0e97a78dbf 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -260,14 +260,36 @@ static void ivas_split_rend_unquant_md( int16_t ch1, ch2; int16_t gd_idx_min; - if ( pose_type == PRED_ONLY ) + if ( pose_type == PRED_ONLY +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + || pose_type == PRED_ROLL_ONLY +#endif + ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + float quantstep; +#endif + +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + if ( pose_type == PRED_ONLY ) + { + quantstep = IVAS_SPLIT_REND_PRED31_Q_STEP; + } + else + { + quantstep = IVAS_SPLIT_REND_PRED_ROLL_Q_STEP; + } +#endif for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * quantstep; +#else hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; +#endif hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2]; } } @@ -287,7 +309,11 @@ static void ivas_split_rend_unquant_md( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + hMd->pred_mat_im[ch1][ch2] = hMd->pred_mat_im_idx[ch1][ch2] * quantstep; +#else hMd->pred_mat_im[ch1][ch2] = hMd->pred_mat_im_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; +#endif } } } @@ -329,15 +355,28 @@ static void ivas_splitBinPostRendMdBase2Dec( { int16_t sf_idx, pos_idx, b, ch1, ch2; int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len; + int16_t min_pred_roll_idx, pred_roll_code_len; int16_t code; BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; + min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; +#else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; + min_pred_roll_idx = min_pred_idx; +#endif min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0]; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_code_len = pHuff_cfg->pred_base2_code_len[0]; + pred_roll_code_len = pHuff_cfg->pred_roll_base2_code_len; +#else pred_code_len = pHuff_cfg->pred_base2_code_len; + pred_roll_code_len = pred_code_len; +#endif gd_code_len = pHuff_cfg->gd_base2_code_len; p_gd_code_len = pHuff_cfg->p_gd_base2_code_len; @@ -398,8 +437,8 @@ static void ivas_splitBinPostRendMdBase2Dec( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); - hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx; + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_roll_code_len ); + hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_roll_idx; } } } @@ -410,8 +449,8 @@ static void ivas_splitBinPostRendMdBase2Dec( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_code_len ); - hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_idx; + code = (int16_t) ivas_split_rend_bitstream_read_int32( pBits, pred_roll_code_len ); + hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_roll_idx; } } } @@ -438,13 +477,25 @@ static void ivas_splitBinPostRendMdHuffDec( int16_t ch1, ch2; int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t min_pred_idx, max_pred_idx; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t min_pred_roll_idx, max_pred_roll_idx; +#endif BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; + max_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 ) * 3]; +#else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; +#endif +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; + max_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 ) * 3]; +#endif for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { @@ -459,7 +510,11 @@ static void ivas_splitBinPostRendMdHuffDec( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred[0], pBits, pHuff_cfg->pred_idx_trav[0] ); +#else sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); +#endif // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); } } @@ -472,7 +527,11 @@ static void ivas_splitBinPostRendMdHuffDec( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred[0], pBits, pHuff_cfg->pred_idx_trav[0] ); +#else sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); +#endif // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred, pBits ); } } @@ -498,6 +557,35 @@ static void ivas_splitBinPostRendMdHuffDec( } else { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + for ( b = 0; b < pred_real_bands_roll; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred_roll, pBits ); + } + } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_roll_idx, max_pred_roll_idx ); + } + for ( b = 0; b < pred_imag_bands_roll; b++ ) + { + hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav ); + // sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode( &pHuff_cfg->pred_roll, pBits ); + } + } + ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_roll_idx, max_pred_roll_idx ); + } +#else for ( b = 0; b < pred_real_bands_roll; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -524,6 +612,7 @@ static void ivas_splitBinPostRendMdHuffDec( } ivas_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx ); } +#endif } } } @@ -797,14 +886,22 @@ void ivas_splitBinPostRendMdDec( { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_unquant_md( hMd, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + PRED_ROLL_ONLY, +#else PRED_ONLY, +#endif 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); } for ( ; b < pred_real_bands_roll[quant_strat]; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_unquant_md( hMd, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + PRED_ROLL_ONLY, +#else PRED_ONLY, +#endif 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); } for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 1b8a157f5b..5e446f7b2f 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -465,8 +465,27 @@ static void ivas_split_rend_quant_md( int16_t gd_idx_min; float sign, quant_val; - if ( pose_type == PRED_ONLY ) + if ( pose_type == PRED_ONLY +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + || pose_type == PRED_ROLL_ONLY +#endif + ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + float onebyquantstep; +#endif + +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + if ( pose_type == PRED_ONLY ) + { + onebyquantstep = IVAS_SPLIT_REND_PRED31_1BYQ_STEP; + } + else + { + onebyquantstep = IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP; + } + +#endif if ( real_only == 1 ) { for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) @@ -486,7 +505,11 @@ static void ivas_split_rend_quant_md( { quant_val = hMd->pred_mat_re[ch1][ch2] - fix_pos_rot_mat[ch1][ch2]; quant_val = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( quant_val, IVAS_SPLIT_REND_PRED_MIN_VAL ) ); +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + hMd->pred_mat_re_idx[ch1][ch2] = (int16_t) roundf( onebyquantstep * quant_val ); +#else hMd->pred_mat_re_idx[ch1][ch2] = (int16_t) roundf( IVAS_SPLIT_REND_PRED_1BYQ_STEP * quant_val ); +#endif // hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; } } @@ -497,7 +520,11 @@ static void ivas_split_rend_quant_md( for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { quant_val = min( IVAS_SPLIT_REND_PRED_MAX_VAL, max( hMd->pred_mat_im[ch1][ch2], IVAS_SPLIT_REND_PRED_MIN_VAL ) ); +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + hMd->pred_mat_im_idx[ch1][ch2] = (int16_t) roundf( onebyquantstep * quant_val ); +#else hMd->pred_mat_im_idx[ch1][ch2] = (int16_t) roundf( IVAS_SPLIT_REND_PRED_1BYQ_STEP * quant_val ); +#endif // hMd->pred_mat_im[ch1][ch2] = hMd->pred_mat_im_idx[ch1][ch2] * IVAS_SPLIT_REND_PRED_Q_STEP; } } @@ -739,9 +766,17 @@ static void get_base2_bits( int32_t base2bits[IVAS_SPLIT_REND_NUM_QUANT_STRATS] ) { int16_t pred_bits, d_gain_bits, pitch_gain_bits, pose_idx, q; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_roll_bits; +#endif IVAS_SPLIT_REND_POSE_TYPE pose_type; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_PRED_31QUANT_PNTS ) ); + pred_roll_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS ) ); +#else pred_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_PRED_QUANT_PNTS ) ); +#endif d_gain_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_D_QUANT_PNTS ) ); pitch_gain_bits = d_gain_bits; @@ -768,8 +803,13 @@ static void get_base2_bits( } else { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + base2bits[q] += pred_roll_bits * pred_real_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; + base2bits[q] += pred_roll_bits * pred_imag_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; +#else base2bits[q] += pred_bits * pred_real_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; base2bits[q] += pred_bits * pred_imag_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; +#endif } } } @@ -791,14 +831,27 @@ static void ivas_SplitRenderer_code_md_base2( { int16_t pos_idx, b, ch1, ch2, sf_idx; int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len, num_poses; + int16_t min_pred_roll_idx, pred_roll_code_len; int32_t code; BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPreRend->huff_cfg; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; + min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; +#else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; + min_pred_roll_idx = min_pred_idx; +#endif min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0]; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_code_len = pHuff_cfg->pred_base2_code_len[0]; + pred_roll_code_len = pHuff_cfg->pred_roll_base2_code_len; +#else pred_code_len = pHuff_cfg->pred_base2_code_len; + pred_roll_code_len = pred_code_len; +#endif gd_code_len = pHuff_cfg->gd_base2_code_len; p_gd_code_len = pHuff_cfg->p_gd_base2_code_len; @@ -863,8 +916,8 @@ static void ivas_SplitRenderer_code_md_base2( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_idx; - ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_roll_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_roll_code_len ); } } } @@ -876,8 +929,8 @@ static void ivas_SplitRenderer_code_md_base2( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { - code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_idx; - ivas_split_rend_bitstream_write_int32( pBits, code, pred_code_len ); + code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_roll_idx; + ivas_split_rend_bitstream_write_int32( pBits, code, pred_roll_code_len ); } } } @@ -922,12 +975,23 @@ static void ivas_SplitRenderer_code_md_huff( int16_t pos_idx, b, ch1, ch2, sf_idx, num_poses; int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t min_pred_idx, max_pred_idx; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t min_pred_roll_idx, max_pred_roll_idx; +#endif int32_t code, len; BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPreRend->huff_cfg; + +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; + max_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 ) * 3]; + min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; + max_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 ) * 3]; +#else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; +#endif num_poses = pMultiBinPoseData->num_poses; @@ -945,7 +1009,11 @@ static void ivas_SplitRenderer_code_md_huff( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + ivas_split_rend_huffman_encode( &pHuff_cfg->pred[0], sym_adj_idx[ch1][ch2], &code, &len ); +#else ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); +#endif ivas_split_rend_bitstream_write_int32( pBits, code, len ); } } @@ -958,7 +1026,11 @@ static void ivas_SplitRenderer_code_md_huff( { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + ivas_split_rend_huffman_encode( &pHuff_cfg->pred[0], sym_adj_idx[ch1][ch2], &code, &len ); +#else ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); +#endif ivas_split_rend_bitstream_write_int32( pBits, code, len ); } } @@ -984,6 +1056,34 @@ static void ivas_SplitRenderer_code_md_huff( } else { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + for ( b = 0; b < pred_real_bands_roll; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_roll_idx, max_pred_roll_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred_roll, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + } + for ( b = 0; b < pred_imag_bands_roll; b++ ) + { + hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; + ivas_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_roll_idx, max_pred_roll_idx ); + for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) + { + for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) + { + ivas_split_rend_huffman_encode( &pHuff_cfg->pred_roll, sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_bitstream_write_int32( pBits, code, len ); + } + } + } +#else for ( b = 0; b < pred_real_bands_roll; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; @@ -1010,6 +1110,7 @@ static void ivas_SplitRenderer_code_md_huff( } } } +#endif } } } @@ -1158,14 +1259,22 @@ static void ivas_SplitRenderer_quant_code( { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_quant_md( hMd, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + PRED_ROLL_ONLY, +#else PRED_ONLY, +#endif 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); } for ( ; b < pred_real_bands_roll[q]; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_quant_md( hMd, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + PRED_ROLL_ONLY, +#else PRED_ONLY, +#endif 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); } } diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index b1068054f8..5f7c46eb33 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -160,12 +160,37 @@ static void ivas_split_huff_get_idx_trav_list( int16_t *idx_list, ivas_split_ren void ivas_split_rend_init_huff_cfg( BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pHuff_cfg->pred[0].codebook = &ivas_split_rend_huff_pred31_consts[0][0]; + pHuff_cfg->pred[0].sym_len = IVAS_SPLIT_REND_PRED_31QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred[0] ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->pred_idx_trav[0], &pHuff_cfg->pred[0] ); + pHuff_cfg->pred_base2_code_len[0] = (int16_t) ceilf( log2f( pHuff_cfg->pred[0].sym_len ) ); + + pHuff_cfg->pred[1].codebook = &ivas_split_rend_huff_pred63_consts[0][0]; + pHuff_cfg->pred[1].sym_len = IVAS_SPLIT_REND_PRED_63QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred[1] ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->pred_idx_trav[1], &pHuff_cfg->pred[1] ); + pHuff_cfg->pred_base2_code_len[1] = (int16_t) ceilf( log2f( pHuff_cfg->pred[1].sym_len ) ); + +#else pHuff_cfg->pred.codebook = &ivas_split_rend_huff_pred_consts[0][0]; pHuff_cfg->pred.sym_len = IVAS_SPLIT_REND_PRED_QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred ); ivas_split_huff_get_idx_trav_list( pHuff_cfg->pred_idx_trav, &pHuff_cfg->pred ); pHuff_cfg->pred_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->pred.sym_len ) ); +#endif + +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pHuff_cfg->pred_roll.codebook = &ivas_split_rend_huff_roll_pred_consts[0][0]; + pHuff_cfg->pred_roll.sym_len = IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS; + ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred_roll ); + ivas_split_huff_get_idx_trav_list( pHuff_cfg->pred_roll_idx_trav, &pHuff_cfg->pred_roll ); + pHuff_cfg->pred_roll_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->pred_roll.sym_len ) ); +#endif + pHuff_cfg->gd.codebook = &ivas_split_rend_huff_d_consts[0][0]; pHuff_cfg->gd.sym_len = IVAS_SPLIT_REND_D_QUANT_PNTS; ivas_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->gd ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 04cfd144ed..8690ac593b 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -196,9 +196,21 @@ typedef struct ivas_split_rend_huffman_cfg_t typedef struct ivas_binaural_head_rot_split_rendering_huff_struct { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + ivas_split_rend_huffman_cfg_t pred[2]; + int16_t pred_idx_trav[2][IVAS_SPLIT_REND_PRED_63QUANT_PNTS]; + int16_t pred_base2_code_len[2]; +#else ivas_split_rend_huffman_cfg_t pred; int16_t pred_idx_trav[IVAS_SPLIT_REND_PRED_QUANT_PNTS]; int16_t pred_base2_code_len; +#endif + +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + ivas_split_rend_huffman_cfg_t pred_roll; + int16_t pred_roll_idx_trav[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS]; + int16_t pred_roll_base2_code_len; +#endif ivas_split_rend_huffman_cfg_t gd; int16_t gd_base2_code_len; int16_t gd_idx_trav[IVAS_SPLIT_REND_D_QUANT_PNTS]; -- GitLab From 000d40099b78f5bd2a3c2439e8bebf06d9e35205 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 24 Jul 2023 16:55:56 +0200 Subject: [PATCH 494/591] support of EXT output configuration for OMASA DISC mode; under OMASA_EXT_OUTPUT --- apps/decoder.c | 102 ++++++++++++++++++++++++++++++----- lib_com/bitstream.c | 2 +- lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 20 ++++++- lib_dec/ivas_masa_dec.c | 4 ++ lib_dec/ivas_output_config.c | 6 +++ lib_dec/lib_dec.c | 24 +++++++++ lib_dec/lib_dec.h | 3 ++ 8 files changed, 147 insertions(+), 15 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index d29f92417d..de686f756d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1742,7 +1742,11 @@ static ivas_error initOnFirstGoodFrame( } /* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */ +#ifdef OMASA_EXT_OUTPUT + if ( *pBsFormat == IVAS_DEC_BS_OBJ || *pBsFormat == IVAS_DEC_BS_MASA_ISM ) +#else if ( *pBsFormat == IVAS_DEC_BS_OBJ ) +#endif { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, pNumObj ) ) != IVAS_ERR_OK ) { @@ -1780,8 +1784,13 @@ static ivas_error initOnFirstGoodFrame( } } } + /* If outputting MASA, open output file and write metadata for initial bad frames */ +#ifdef OMASA_EXT_OUTPUT + if ( *pBsFormat == IVAS_DEC_BS_MASA || *pBsFormat == IVAS_DEC_BS_MASA_ISM ) +#else else if ( *pBsFormat == IVAS_DEC_BS_MASA ) +#endif { if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK ) { @@ -1789,26 +1798,33 @@ static ivas_error initOnFirstGoodFrame( return error; } - /* Duplicate good first frame metadata to fill the beginning of stream. */ - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; +#ifdef OMASA_EXT_OUTPUT + if ( numInitialBadFrames > 0 ) + { +#endif + /* Duplicate good first frame metadata to fill the beginning of stream. */ + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; #ifdef FIX_470_MASA_JBM_EXT - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif - { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - return error; - } - - for ( int16_t j = 0; j < numInitialBadFrames; ++j ) - { - if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } + + for ( int16_t j = 0; j < numInitialBadFrames; ++j ) + { + if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); + return error; + } + } +#ifdef OMASA_EXT_OUTPUT } +#endif } } @@ -2135,10 +2151,14 @@ static ivas_error decodeG192( #endif } - /* Write ISM metadata to external file(s) */ + /* Write MASA/ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { +#ifdef OMASA_EXT_OUTPUT + if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else if ( bsFormat == IVAS_DEC_BS_OBJ ) +#endif { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { @@ -2163,7 +2183,12 @@ static ivas_error decodeG192( } } } +#ifdef OMASA_EXT_OUTPUT + + if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else else if ( bsFormat == IVAS_DEC_BS_MASA ) +#endif { MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef FIX_470_MASA_JBM_EXT @@ -2250,6 +2275,18 @@ static ivas_error decodeG192( { fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } +#ifdef OMASA_EXT_OUTPUT + else if ( bsFormat == IVAS_DEC_BS_MASA_ISM ) + { + for ( i = 0; i < numObj; i++ ) + { + fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); + } + fprintf( stdout, "\n" ); + + fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + } +#endif } /*------------------------------------------------------------------------------------------* @@ -2716,7 +2753,11 @@ static ivas_error decodeVoIP( { int16_t i; +#ifdef OMASA_EXT_OUTPUT + if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else if ( bsFormat == IVAS_DEC_BS_OBJ ) +#endif { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { @@ -2741,7 +2782,12 @@ static ivas_error decodeVoIP( } } } +#ifdef OMASA_EXT_OUTPUT + + if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else else if ( bsFormat == IVAS_DEC_BS_MASA ) +#endif { MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef FIX_470_MASA_JBM_EXT @@ -3146,7 +3192,11 @@ static ivas_error decodeVariableSpeed( /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { +#ifdef OMASA_EXT_OUTPUT + if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else if ( bsFormat == IVAS_DEC_BS_OBJ ) +#endif { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { @@ -3171,7 +3221,12 @@ static ivas_error decodeVariableSpeed( } } } +#ifdef OMASA_EXT_OUTPUT + + if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else else if ( bsFormat == IVAS_DEC_BS_MASA ) +#endif { MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef FIX_470_MASA_JBM_EXT @@ -3325,7 +3380,11 @@ static ivas_error decodeVariableSpeed( /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { +#ifdef OMASA_EXT_OUTPUT + if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else if ( bsFormat == IVAS_DEC_BS_OBJ ) +#endif { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { @@ -3350,7 +3409,12 @@ static ivas_error decodeVariableSpeed( } } } +#ifdef OMASA_EXT_OUTPUT + + if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) +#else else if ( bsFormat == IVAS_DEC_BS_MASA ) +#endif { MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef FIX_470_MASA_JBM_EXT @@ -3414,6 +3478,18 @@ static ivas_error decodeVariableSpeed( { fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } +#ifdef OMASA_EXT_OUTPUT + else if ( bsFormat == IVAS_DEC_BS_MASA_ISM ) + { + for ( i = 0; i < numObj; i++ ) + { + fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); + } + fprintf( stdout, "\n" ); + + fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + } +#endif } /* add zeros at the end to have equal length of synthesized signals */ diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index fb27e89e00..5e46868064 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -562,7 +562,7 @@ int16_t get_ivas_max_num_indices( else if ( ivas_total_brate <= IVAS_256k ) { #ifdef OMASA_BIT_BUFF_SZ - return 1300; + return 1450; #else return 1150; #endif diff --git a/lib_com/options.h b/lib_com/options.h index 82815ac317..1b47d0dd5c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -219,6 +219,7 @@ #define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ #define OMASA_FIX_LOW_FS /* Nokia: fixes related to lower input signal sampling rates */ #define OMASA_BIT_BUFF_SZ /* Nokia: increase bitstream index buffer initial size */ +#define OMASA_EXT_OUTPUT /* VA: support of EXT output configuration for OMASA DISC mode */ #endif /* #################### Start NON-BE CR switches ########################## */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9640e90253..111a9ab18b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -784,10 +784,18 @@ ivas_error ivas_init_decoder( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { - if ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) +#ifdef OMASA_EXT_OUTPUT + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + hDecoderConfig->nchan_out = st_ivas->nchan_transport + st_ivas->nchan_ism; + } + else +#endif + if ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) { hDecoderConfig->nchan_out = st_ivas->nchan_transport; } + st_ivas->hOutSetup.nchan_out_woLFE = hDecoderConfig->nchan_out; } @@ -2559,5 +2567,15 @@ static ivas_error doSanityChecks_IVAS( } #endif +#ifdef OMASA_EXT_OUTPUT + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && output_config == AUDIO_CONFIG_EXTERNAL ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); + } + } +#endif + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index fb446cf11a..1c9cc56417 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -571,7 +571,11 @@ ivas_error ivas_masa_decode( } } +#ifdef OMASA_EXT_OUTPUT + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) +#else if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) +#endif { create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index ec95f65428..fb5469fe43 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -441,6 +441,12 @@ void ivas_renderer_select( { *renderer_type = RENDERER_STEREO_PARAMETRIC; } +#ifdef OMASA_EXT_OUTPUT + else if ( output_config == AUDIO_CONFIG_EXTERNAL ) + { + *renderer_type = RENDERER_DISABLE; + } +#endif } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9f121bb5c1..470ed95f1a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -408,6 +408,10 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( return IVAS_DEC_BS_SBA; case MASA_FORMAT: return IVAS_DEC_BS_MASA; +#ifdef OMASA_EXT_OUTPUT + case MASA_ISM_FORMAT: + return IVAS_DEC_BS_MASA_ISM; +#endif default: break; } @@ -1003,9 +1007,17 @@ ivas_error IVAS_DEC_GetNumObjects( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef OMASA_EXT_OUTPUT + if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT ) +#else if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT ) +#endif { +#ifdef OMASA_EXT_OUTPUT + *numObjects = hIvasDec->st_ivas->nchan_ism; +#else *numObjects = hIvasDec->st_ivas->hDecoderConfig->nchan_out; +#endif } else { @@ -1088,12 +1100,20 @@ ivas_error IVAS_DEC_GetObjectMetadata( st_ivas = hIvasDec->st_ivas; +#ifdef OMASA_EXT_OUTPUT + if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->ivas_format != MASA_ISM_FORMAT ) +#else if ( st_ivas->ivas_format != ISM_FORMAT ) +#endif { return IVAS_ERR_WRONG_MODE; } +#ifdef OMASA_EXT_OUTPUT + if ( objectIdx >= st_ivas->nchan_ism ) +#else if ( objectIdx >= st_ivas->hDecoderConfig->nchan_out ) +#endif { return IVAS_ERR_INVALID_INDEX; } @@ -1149,7 +1169,11 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef OMASA_EXT_OUTPUT + if ( hIvasDec->st_ivas->ivas_format != MASA_FORMAT && hIvasDec->st_ivas->ivas_format != MASA_ISM_FORMAT ) +#else if ( hIvasDec->st_ivas->ivas_format != MASA_FORMAT ) +#endif { return IVAS_ERR_WRONG_MODE; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 18b37d7b80..e214796629 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -116,6 +116,9 @@ typedef enum _IVAS_DEC_BS_FORMAT IVAS_DEC_BS_SBA, IVAS_DEC_BS_OBJ, IVAS_DEC_BS_MASA, +#ifdef OMASA_EXT_OUTPUT + IVAS_DEC_BS_MASA_ISM, +#endif IVAS_DEC_BS_UNKOWN = 0xffff } IVAS_DEC_BS_FORMAT; -- GitLab From 6fabfe47b140f40358bee8c00d304576629c1179 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 24 Jul 2023 17:06:50 +0200 Subject: [PATCH 495/591] adapt FIX_562_ISM2_64KBPS for OMASA, fix is under MASA_AND_OBJECTS --- lib_com/bitstream.c | 2 +- lib_com/ivas_ism_com.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 5e46868064..fb27e89e00 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -562,7 +562,7 @@ int16_t get_ivas_max_num_indices( else if ( ivas_total_brate <= IVAS_256k ) { #ifdef OMASA_BIT_BUFF_SZ - return 1450; + return 1300; #else return 1150; #endif diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index e1c68593c5..1c25269f6b 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -120,7 +120,7 @@ ivas_error ivas_ism_config( error = IVAS_ERR_OK; #ifdef MASA_AND_OBJECTS - if ( combined_format_flag == 1 ) + if ( combined_format_flag ) { n_ISms = nchan_ism; } @@ -365,7 +365,7 @@ ivas_error ivas_ism_config( } #ifdef FIX_562_ISM2_64KBPS - /* limitaton to avoid too high bitrate in one active TCX channel */ + /* limitation to avoid too high bitrate in one active TCX channel */ if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k ) { diff = 0; @@ -402,6 +402,13 @@ ivas_error ivas_ism_config( printf( "\nWarning: ISM bitbudget equal to SID!\n" ); } #endif + +#ifdef MASA_AND_OBJECTS + if ( combined_format_flag ) + { + diff = 0; + } +#endif break; } } @@ -409,7 +416,7 @@ ivas_error ivas_ism_config( } #ifdef MASA_AND_OBJECTS - if ( combined_format_flag == 1 ) + if ( combined_format_flag ) { if ( diff > 0 ) { -- GitLab From 32f030f13cff386f46e9861b7d1b1ad4bccc1ce7 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Tue, 25 Jul 2023 00:08:33 +0530 Subject: [PATCH 496/591] address review comments --- lib_com/ivas_prot.h | 11 +- lib_dec/ivas_binRenderer_internal.c | 668 ++++------------------------ lib_util/hrtf_file_reader.c | 3 +- 3 files changed, 90 insertions(+), 592 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a047b462b0..c5561ae2be 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5047,12 +5047,11 @@ void ivas_binaural_hrtf_close( ); ivas_error ivas_allocate_binaural_hrtf( - HRTFS_FASTCONV *HrtfFastConv, /* i : fastconv HRTF handle */ - AUDIO_CONFIG output_config, /* i : ouput audio config */ - BINAURAL_INPUT_AUDIO_CONFIG output_config_bin, /* i : binaural input audio config */ - RENDERER_TYPE renderer_type, - int8_t is_loudspeaker_setup, - int16_t allocate_init_flag + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + AUDIO_CONFIG input_config, /* i : input audio configuration */ + BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + int16_t allocate_init_flag /* i : Memory allocation flag */ ); #endif diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 2b266e5012..2bf0c14992 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -489,26 +489,59 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #ifdef FIX_1720_HRTF_FASTCONV +/*-------------------------------------------------------------------------* + * ivas_alloc_pppMem() + * + * Allocate memory for tripple pointer elements + *-------------------------------------------------------------------------*/ + +static ivas_error ivas_alloc_pppMem( float ****pppMem, int32_t dim1, int32_t dim2, int32_t dim3, int16_t allocate_init_flag ) +{ + int32_t i, j; + float ***localMem = NULL; + + if ( ( localMem = (float ***) malloc( dim1 * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + for ( i = 0; i < dim1; i++ ) + { + if ( ( localMem[i] = (float **) malloc( dim2 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < dim2; j++ ) + { + if ( ( localMem[i][j] = (float *) malloc( dim3 * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + } + } + } + + *pppMem = localMem; + + return IVAS_ERR_OK; +} + /*-------------------------------------------------------------------------* * ivas_allocate_binaural_hrtf() * * Allocate memory for HrtfFastConv structure elements *-------------------------------------------------------------------------*/ -/*output_config is actually input_config. So please rename. -BINAURAL_INPUT_AUDIO_CONFIG input_config can renamed as BINAURAL_INPUT_AUDIO_CONFIG bin_input_config -*/ + ivas_error ivas_allocate_binaural_hrtf( - HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ - AUDIO_CONFIG output_config, /* i : output audio configuration */ - BINAURAL_INPUT_AUDIO_CONFIG input_config, /* i : binaural input audio config */ - RENDERER_TYPE renderer_type, /* i : renderer type */ - int8_t is_loudspeaker_setup, /* i : loudspeaker setup information */ - int16_t allocate_init_flag /* i : Memory allocation flag */ + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + AUDIO_CONFIG input_config, /* i : input audio configuration */ + BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + int16_t allocate_init_flag /* i : Memory allocation flag */ ) { - int16_t i, j; - /*malloc for HOA3, HOA2, FOA*/ - if ( output_config == AUDIO_CONFIG_HOA3 || input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) + if ( input_config == AUDIO_CONFIG_HOA3 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { if ( ( HrtfFastConv->leftHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3 != NULL ) ) { @@ -516,69 +549,25 @@ ivas_error ivas_allocate_binaural_hrtf( } else { - /*Too much code duplication. Add a function that takes in tripple pointer and 3 dimension lengths as input and just call that function - for leftHRIRReal_HOA3, leftHRIRReal_HOA2, leftHRIRReal_FOA, leftHRIRReal, leftBRIRReal - */ - if ( ( HrtfFastConv->leftHRIRReal_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); } - if ( ( HrtfFastConv->leftHRIRImag_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); } - if ( ( HrtfFastConv->rightHRIRReal_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); } - if ( ( HrtfFastConv->rightHRIRImag_HOA3 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftHRIRReal_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); - } - if ( ( HrtfFastConv->leftHRIRImag_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); - } - if ( ( HrtfFastConv->rightHRIRReal_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); - } - if ( ( HrtfFastConv->rightHRIRImag_HOA3[i] = (float **) malloc( HOA3_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HOA3_CHANNELS; j++ ) - { - if ( ( HrtfFastConv->leftHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); - } - if ( ( HrtfFastConv->leftHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); - } - if ( ( HrtfFastConv->rightHRIRReal_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); - } - if ( ( HrtfFastConv->rightHRIRImag_HOA3[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); - } - } - } - } } } - if ( output_config == AUDIO_CONFIG_HOA2 || input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) + if ( input_config == AUDIO_CONFIG_HOA2 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { if ( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) { @@ -586,66 +575,25 @@ ivas_error ivas_allocate_binaural_hrtf( } else { - if ( ( HrtfFastConv->leftHRIRReal_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); } - if ( ( HrtfFastConv->leftHRIRImag_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); } - if ( ( HrtfFastConv->rightHRIRReal_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); } - if ( ( HrtfFastConv->rightHRIRImag_HOA2 = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftHRIRReal_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); - } - if ( ( HrtfFastConv->leftHRIRImag_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); - } - if ( ( HrtfFastConv->rightHRIRReal_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); - } - if ( ( HrtfFastConv->rightHRIRImag_HOA2[i] = (float **) malloc( HOA2_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HOA2_CHANNELS; j++ ) - { - if ( ( HrtfFastConv->leftHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); - } - if ( ( HrtfFastConv->leftHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); - } - if ( ( HrtfFastConv->rightHRIRReal_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); - } - if ( ( HrtfFastConv->rightHRIRImag_HOA2[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); - } - } - } - } } } - if ( output_config == AUDIO_CONFIG_FOA || input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) + if ( input_config == AUDIO_CONFIG_FOA || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { if ( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) { @@ -653,66 +601,25 @@ ivas_error ivas_allocate_binaural_hrtf( } else { - if ( ( HrtfFastConv->leftHRIRReal_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); } - if ( ( HrtfFastConv->leftHRIRImag_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); } - if ( ( HrtfFastConv->rightHRIRReal_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); } - if ( ( HrtfFastConv->rightHRIRImag_FOA = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftHRIRReal_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); - } - if ( ( HrtfFastConv->leftHRIRImag_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); - } - if ( ( HrtfFastConv->rightHRIRReal_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); - } - if ( ( HrtfFastConv->rightHRIRImag_FOA[i] = (float **) malloc( FOA_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < FOA_CHANNELS; j++ ) - { - if ( ( HrtfFastConv->leftHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); - } - if ( ( HrtfFastConv->leftHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); - } - if ( ( HrtfFastConv->rightHRIRReal_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); - } - if ( ( HrtfFastConv->rightHRIRImag_FOA[i][j] = (float *) malloc( BINAURAL_NTAPS_SBA * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); - } - } - } - } } } - if ( renderer_type == RENDERER_BINAURAL_FASTCONV || input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + if ( renderer_type == RENDERER_BINAURAL_FASTCONV || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { if ( ( HrtfFastConv->leftHRIRReal != NULL ) && ( HrtfFastConv->leftHRIRImag != NULL ) && ( HrtfFastConv->rightHRIRReal != NULL ) && ( HrtfFastConv->rightHRIRImag != NULL ) ) { @@ -720,451 +627,48 @@ ivas_error ivas_allocate_binaural_hrtf( } else { - if ( ( HrtfFastConv->leftHRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); } - if ( ( HrtfFastConv->leftHRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); } - if ( ( HrtfFastConv->rightHRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); } - if ( ( HrtfFastConv->rightHRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftHRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); - } - if ( ( HrtfFastConv->leftHRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); - } - if ( ( HrtfFastConv->rightHRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); - } - if ( ( HrtfFastConv->rightHRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) - { - if ( ( HrtfFastConv->leftHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); - } - if ( ( HrtfFastConv->leftHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); - } - if ( ( HrtfFastConv->rightHRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); - } - if ( ( HrtfFastConv->rightHRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); - } - } - } - } } } - /*its not clear why BRIR buffer cant be allocated for HRTF_LS_CHANNELS always ?? and why we need to have all if checks for different LS configs*/ - if ( allocate_init_flag == 1 ) + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && is_loudspeaker_setup == 0 ) /*7_1_4*/ + if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) { - HrtfFastConv->nChannels = 15; - if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) - { - return IVAS_ERR_OK; - } - else - { - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HrtfFastConv->nChannels; j++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } - } - } - } + return IVAS_ERR_OK; } - else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && is_loudspeaker_setup == 1 ) /*5_1 and others*/ + else { - if ( output_config == AUDIO_CONFIG_5_1 ) - { - HrtfFastConv->nChannels = 7; - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HrtfFastConv->nChannels; j++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } - } - } - } - else if ( output_config == AUDIO_CONFIG_7_1 ) - { - HrtfFastConv->nChannels = 5; - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HrtfFastConv->nChannels; j++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } - } - } - } - else if ( output_config == AUDIO_CONFIG_5_1_2 ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) { - HrtfFastConv->nChannels = 11; - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HrtfFastConv->nChannels; j++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } - } - } + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); } - else if ( output_config == AUDIO_CONFIG_5_1_4 ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) { - HrtfFastConv->nChannels = 13; - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HrtfFastConv->nChannels * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HrtfFastConv->nChannels; j++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } - } - } + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); } - } - } - else if ( allocate_init_flag == 0 ) - { - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) - { - if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) { - return IVAS_ERR_OK; + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); } - else + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) { - if ( ( HrtfFastConv->leftBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag = (float ***) malloc( BINAURAL_CONVBANDS * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i] = (float **) malloc( HRTF_LS_CHANNELS * sizeof( float * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - if ( allocate_init_flag == 0 ) - { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) - { - if ( ( HrtfFastConv->leftBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - if ( ( HrtfFastConv->leftBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - if ( ( HrtfFastConv->rightBRIRReal[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - if ( ( HrtfFastConv->rightBRIRImag[i][j] = (float *) malloc( BINAURAL_NTAPS_MAX * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } - } - } + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); } } } @@ -1182,9 +686,8 @@ static ivas_error ivas_binaural_hrtf_open( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ #ifdef FIX_1720_HRTF_FASTCONV , - AUDIO_CONFIG output_config, /* i : output configuration */ - RENDERER_TYPE renderer_type, /* i : renderer type */ - int8_t is_loudspeaker_setup /* i : loudspeaker setup information */ + AUDIO_CONFIG output_config, /* i : output configuration */ + RENDERER_TYPE renderer_type /* i : renderer type */ #endif ) { @@ -1228,7 +731,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; } HrtfFastConv->allocate_init_flag = 1; - ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, HrtfFastConv->input_cfg_var, renderer_type, is_loudspeaker_setup, HrtfFastConv->allocate_init_flag ); + ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, HrtfFastConv->input_cfg_var, renderer_type, HrtfFastConv->allocate_init_flag ); #else HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; @@ -1250,13 +753,10 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->rightHRIRImag[i][j] = rightHRIRImag[i][j]; } } - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - for ( j = 0; j < HrtfFastConv->nChannels; j++ ) + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - /*HrtfFastConv->leftBRIRReal[i][j] can always be allocated for 15 channels. - No need to have HrtfFastConv->nChannels, simply use HRTF_LS_CHANNELS - */ HrtfFastConv->leftBRIRReal[i][j] = leftBRIRReal[i][j]; HrtfFastConv->leftBRIRImag[i][j] = leftBRIRImag[i][j]; HrtfFastConv->rightBRIRReal[i][j] = rightBRIRReal[i][j]; @@ -1552,7 +1052,7 @@ ivas_error ivas_rend_openCldfbRend( } /* Load HRTF tables */ #ifdef FIX_1720_HRTF_FASTCONV - ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup ); + ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv, hBinRenderer->hInputSetup->output_config, RENDERER_BINAURAL_FASTCONV ); #else ivas_binaural_hrtf_open( &pCldfbRend->hHrtfFastConv ); #endif @@ -1658,7 +1158,7 @@ ivas_error ivas_binRenderer_open( /* Load HRTF tables */ #ifdef FIX_1720_HRTF_FASTCONV - ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup ); + ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ); #else ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv ); #endif diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 4a88d85005..fbc842b6be 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1059,7 +1059,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( #ifdef FIX_1720_HRTF_FASTCONV ( *hHRTF )->input_cfg_var = input_cfg; ( *hHRTF )->allocate_init_flag = 0; - ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type, 0, ( *hHRTF )->allocate_init_flag ); + ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); #endif // if ( hHRTF == NULL ) @@ -1436,7 +1436,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - /*here it seems to be always execting HRTF_LS_CHANNELS channels*/ for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { memcpy( ( *hHRTF )->leftBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); -- GitLab From b01a62fb7db36a12221be596d3d47ff2c041b370 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Tue, 25 Jul 2023 11:05:49 +0530 Subject: [PATCH 497/591] address review comments - 2 --- lib_com/ivas_prot.h | 4 + lib_dec/ivas_binRenderer_internal.c | 383 +++++++++++----------------- lib_rend/ivas_stat_rend.h | 2 - lib_util/hrtf_file_reader.c | 1 - 4 files changed, 155 insertions(+), 235 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c5561ae2be..f841cbb1b6 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5046,6 +5046,10 @@ void ivas_binaural_hrtf_close( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ ); +ivas_error ivas_init_binaural_hrtf( + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ +); + ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ AUDIO_CONFIG input_config, /* i : input audio configuration */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 2bf0c14992..6887040363 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -489,6 +489,58 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #ifdef FIX_1720_HRTF_FASTCONV +/*-------------------------------------------------------------------------* + * ivas_init_binaural_hrtf() + * + * initialize memory for HrtfFastConv structure elements + *-------------------------------------------------------------------------*/ + +ivas_error ivas_init_binaural_hrtf( + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ +) +{ + int16_t i; + HrtfFastConv->leftHRIRReal_HOA3 = NULL; + HrtfFastConv->leftHRIRImag_HOA3 = NULL; + HrtfFastConv->rightHRIRReal_HOA3 = NULL; + HrtfFastConv->rightHRIRImag_HOA3 = NULL; + HrtfFastConv->FASTCONV_HOA3_latency_s = 0x00; + + HrtfFastConv->leftHRIRReal = NULL; + HrtfFastConv->leftHRIRImag = NULL; + HrtfFastConv->rightHRIRReal = NULL; + HrtfFastConv->rightHRIRImag = NULL; + HrtfFastConv->FASTCONV_HRIR_latency_s = 0x00; + + HrtfFastConv->leftBRIRReal = NULL; + HrtfFastConv->leftBRIRImag = NULL; + HrtfFastConv->rightBRIRReal = NULL; + HrtfFastConv->rightBRIRImag = NULL; + HrtfFastConv->FASTCONV_BRIR_latency_s = 0x00; + + HrtfFastConv->leftHRIRReal_HOA2 = NULL; + HrtfFastConv->leftHRIRImag_HOA2 = NULL; + HrtfFastConv->rightHRIRReal_HOA2 = NULL; + HrtfFastConv->rightHRIRImag_HOA2 = NULL; + HrtfFastConv->FASTCONV_HOA2_latency_s = 0x00; + + HrtfFastConv->leftHRIRReal_FOA = NULL; + HrtfFastConv->leftHRIRImag_FOA = NULL; + HrtfFastConv->rightHRIRReal_FOA = NULL; + HrtfFastConv->rightHRIRImag_FOA = NULL; + HrtfFastConv->FASTCONV_FOA_latency_s = 0x00; + + HrtfFastConv->allocate_init_flag = 0x00; + + for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + HrtfFastConv->fastconvReverberationEneCorrections[i] = 0x00; + HrtfFastConv->fastconvReverberationEneCorrections[i] = 0x00; + } + + return IVAS_ERR_OK; +} + /*-------------------------------------------------------------------------* * ivas_alloc_pppMem() * @@ -686,7 +738,7 @@ static ivas_error ivas_binaural_hrtf_open( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ #ifdef FIX_1720_HRTF_FASTCONV , - AUDIO_CONFIG output_config, /* i : output configuration */ + AUDIO_CONFIG input_config, /* i : output configuration */ RENDERER_TYPE renderer_type /* i : renderer type */ #endif ) @@ -709,29 +761,29 @@ static ivas_error ivas_binaural_hrtf_open( #ifdef FIX_1720_HRTF_FASTCONV - memset( HrtfFastConv, 0x00, sizeof( HRTFS_FASTCONV ) ); - if ( output_config == AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV ) + ivas_init_binaural_hrtf( HrtfFastConv ); + if ( input_config == AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV ) { HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; } - if ( output_config == AUDIO_CONFIG_HOA2 ) + if ( input_config == AUDIO_CONFIG_HOA2 ) { HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; } - if ( output_config == AUDIO_CONFIG_HOA3 ) + if ( input_config == AUDIO_CONFIG_HOA3 ) { HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; } - if ( output_config == AUDIO_CONFIG_FOA ) + if ( input_config == AUDIO_CONFIG_FOA ) { HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; } - if ( output_config == AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + if ( input_config == AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; } HrtfFastConv->allocate_init_flag = 1; - ivas_allocate_binaural_hrtf( HrtfFastConv, output_config, HrtfFastConv->input_cfg_var, renderer_type, HrtfFastConv->allocate_init_flag ); + ivas_allocate_binaural_hrtf( HrtfFastConv, input_config, BINAURAL_INPUT_AUDIO_CONFIG_INVALID, renderer_type, HrtfFastConv->allocate_init_flag ); #else HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; @@ -763,7 +815,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->rightBRIRImag[i][j] = rightBRIRImag[i][j]; } } - if ( output_config == AUDIO_CONFIG_HOA3 ) + if ( input_config == AUDIO_CONFIG_HOA3 ) { for ( j = 0; j < HOA3_CHANNELS; j++ ) { @@ -773,7 +825,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->rightHRIRImag_HOA3[i][j] = rightHRIRImag_HOA3[i][j]; } } - if ( output_config == AUDIO_CONFIG_HOA2 ) + if ( input_config == AUDIO_CONFIG_HOA2 ) { for ( j = 0; j < HOA2_CHANNELS; j++ ) { @@ -783,7 +835,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->rightHRIRImag_HOA2[i][j] = rightHRIRImag_HOA2[i][j]; } } - if ( output_config == AUDIO_CONFIG_FOA ) + if ( input_config == AUDIO_CONFIG_FOA ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { @@ -1492,242 +1544,109 @@ void ivas_binRenderer_close( #ifdef FIX_1720_HRTF_FASTCONV /*------------------------------------------------------------------------- - * ivas_binaural_hrtf_close() + * ivas_free_pppHrtfMem() * - * Close fastconv binaural renderer hrtf memories + * Free fastconv binaural renderer hrtf memories *------------------------------------------------------------------------*/ - -void ivas_binaural_hrtf_close( - HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ -) +static void ivas_free_pppHrtfMem( float ****ppppHRIR, int16_t dim, int16_t alloc_init ) { int16_t i, j; - if ( hHrtfFastConv == NULL || *hHrtfFastConv == NULL ) - { - return; - } - if ( ( *hHrtfFastConv )->leftHRIRReal != NULL && ( *hHrtfFastConv )->leftHRIRImag != NULL && ( *hHrtfFastConv )->rightHRIRReal != NULL && ( *hHrtfFastConv )->rightHRIRImag != NULL ) + if ( *ppppHRIR != NULL ) { for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) + if ( alloc_init == 0 ) { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + for ( j = 0; j < dim; j++ ) { - free( ( *hHrtfFastConv )->leftHRIRReal[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag[i][j] = NULL; + free( ( *ppppHRIR )[i][j] ); + ( *ppppHRIR )[i][j] = NULL; } } - free( ( *hHrtfFastConv )->leftHRIRReal[i] ); - ( *hHrtfFastConv )->leftHRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag[i] ); - ( *hHrtfFastConv )->leftHRIRImag[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal[i] ); - ( *hHrtfFastConv )->rightHRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag[i] ); - ( *hHrtfFastConv )->rightHRIRImag[i] = NULL; + free( ( *ppppHRIR )[i] ); + ( *ppppHRIR )[i] = NULL; } - free( ( *hHrtfFastConv )->leftHRIRReal ); - ( *hHrtfFastConv )->leftHRIRReal = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag ); - ( *hHrtfFastConv )->leftHRIRImag = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal ); - ( *hHrtfFastConv )->rightHRIRReal = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag ); - ( *hHrtfFastConv )->rightHRIRImag = NULL; } - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) - { - if ( ( *hHrtfFastConv )->leftBRIRReal != NULL && ( *hHrtfFastConv )->leftBRIRImag != NULL && ( *hHrtfFastConv )->rightBRIRReal != NULL && ( *hHrtfFastConv )->rightBRIRImag != NULL ) - { - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) - { - for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) - { - free( ( *hHrtfFastConv )->leftBRIRReal[i][j] ); - ( *hHrtfFastConv )->leftBRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag[i][j] ); - ( *hHrtfFastConv )->leftBRIRImag[i][j] = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal[i][j] ); - ( *hHrtfFastConv )->rightBRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag[i][j] ); - ( *hHrtfFastConv )->rightBRIRImag[i][j] = NULL; - } - } - free( ( *hHrtfFastConv )->leftBRIRReal[i] ); - ( *hHrtfFastConv )->leftBRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag[i] ); - ( *hHrtfFastConv )->leftBRIRImag[i] = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal[i] ); - ( *hHrtfFastConv )->rightBRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag[i] ); - ( *hHrtfFastConv )->rightBRIRImag[i] = NULL; - } - free( ( *hHrtfFastConv )->leftBRIRReal ); - ( *hHrtfFastConv )->leftBRIRReal = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag ); - ( *hHrtfFastConv )->leftBRIRImag = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal ); - ( *hHrtfFastConv )->rightBRIRReal = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag ); - ( *hHrtfFastConv )->rightBRIRImag = NULL; - } - } - if ( ( *hHrtfFastConv )->allocate_init_flag == 1 ) - { - if ( ( *hHrtfFastConv )->leftBRIRReal != NULL && ( *hHrtfFastConv )->leftBRIRImag != NULL && ( *hHrtfFastConv )->rightBRIRReal != NULL && ( *hHrtfFastConv )->rightBRIRImag != NULL ) - { - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) - { - for ( j = 0; j < ( *hHrtfFastConv )->nChannels; j++ ) - { - free( ( *hHrtfFastConv )->leftBRIRReal[i][j] ); - ( *hHrtfFastConv )->leftBRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag[i][j] ); - ( *hHrtfFastConv )->leftBRIRImag[i][j] = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal[i][j] ); - ( *hHrtfFastConv )->rightBRIRReal[i][j] = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag[i][j] ); - ( *hHrtfFastConv )->rightBRIRImag[i][j] = NULL; - } - } - free( ( *hHrtfFastConv )->leftBRIRReal[i] ); - ( *hHrtfFastConv )->leftBRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag[i] ); - ( *hHrtfFastConv )->leftBRIRImag[i] = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal[i] ); - ( *hHrtfFastConv )->rightBRIRReal[i] = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag[i] ); - ( *hHrtfFastConv )->rightBRIRImag[i] = NULL; - } - free( ( *hHrtfFastConv )->leftBRIRReal ); - ( *hHrtfFastConv )->leftBRIRReal = NULL; - free( ( *hHrtfFastConv )->leftBRIRImag ); - ( *hHrtfFastConv )->leftBRIRImag = NULL; - free( ( *hHrtfFastConv )->rightBRIRReal ); - ( *hHrtfFastConv )->rightBRIRReal = NULL; - free( ( *hHrtfFastConv )->rightBRIRImag ); - ( *hHrtfFastConv )->rightBRIRImag = NULL; - } - } - if ( ( *hHrtfFastConv )->leftHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA3 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA3 != NULL ) - { - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) - { - for ( j = 0; j < HOA3_CHANNELS; j++ ) - { - free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal_HOA3[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag_HOA3[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal_HOA3[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag_HOA3[i][j] = NULL; - } - } - free( ( *hHrtfFastConv )->leftHRIRReal_HOA3[i] ); - ( *hHrtfFastConv )->leftHRIRReal_HOA3[i] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA3[i] ); - ( *hHrtfFastConv )->leftHRIRImag_HOA3[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA3[i] ); - ( *hHrtfFastConv )->rightHRIRReal_HOA3[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA3[i] ); - ( *hHrtfFastConv )->rightHRIRImag_HOA3[i] = NULL; - } - free( ( *hHrtfFastConv )->leftHRIRReal_HOA3 ); - ( *hHrtfFastConv )->leftHRIRReal_HOA3 = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA3 ); - ( *hHrtfFastConv )->leftHRIRImag_HOA3 = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA3 ); - ( *hHrtfFastConv )->rightHRIRReal_HOA3 = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA3 ); - ( *hHrtfFastConv )->rightHRIRImag_HOA3 = NULL; - } - if ( ( *hHrtfFastConv )->leftHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->leftHRIRImag_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRReal_HOA2 != NULL && ( *hHrtfFastConv )->rightHRIRImag_HOA2 != NULL ) - { - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) - { - for ( j = 0; j < HOA2_CHANNELS; j++ ) - { - free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal_HOA2[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag_HOA2[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal_HOA2[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag_HOA2[i][j] = NULL; - } - } - free( ( *hHrtfFastConv )->leftHRIRReal_HOA2[i] ); - ( *hHrtfFastConv )->leftHRIRReal_HOA2[i] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA2[i] ); - ( *hHrtfFastConv )->leftHRIRImag_HOA2[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA2[i] ); - ( *hHrtfFastConv )->rightHRIRReal_HOA2[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA2[i] ); - ( *hHrtfFastConv )->rightHRIRImag_HOA2[i] = NULL; - } - free( ( *hHrtfFastConv )->leftHRIRReal_HOA2 ); - ( *hHrtfFastConv )->leftHRIRReal_HOA2 = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_HOA2 ); - ( *hHrtfFastConv )->leftHRIRImag_HOA2 = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_HOA2 ); - ( *hHrtfFastConv )->rightHRIRReal_HOA2 = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_HOA2 ); - ( *hHrtfFastConv )->rightHRIRImag_HOA2 = NULL; - } - if ( ( *hHrtfFastConv )->leftHRIRReal_FOA != NULL && ( *hHrtfFastConv )->leftHRIRImag_FOA != NULL && ( *hHrtfFastConv )->rightHRIRReal_FOA != NULL && ( *hHrtfFastConv )->rightHRIRImag_FOA != NULL ) +} +/*------------------------------------------------------------------------- + * ivas_binaural_hrtf_close() + * + * Close fastconv binaural renderer hrtf memories + *------------------------------------------------------------------------*/ + +void ivas_binaural_hrtf_close( + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ +) +{ + + if ( hHrtfFastConv == NULL || *hHrtfFastConv == NULL ) { - for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) - { - if ( ( *hHrtfFastConv )->allocate_init_flag == 0 ) - { - for ( j = 0; j < FOA_CHANNELS; j++ ) - { - free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] ); - ( *hHrtfFastConv )->leftHRIRReal_FOA[i][j] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] ); - ( *hHrtfFastConv )->leftHRIRImag_FOA[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] ); - ( *hHrtfFastConv )->rightHRIRReal_FOA[i][j] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] ); - ( *hHrtfFastConv )->rightHRIRImag_FOA[i][j] = NULL; - } - } - free( ( *hHrtfFastConv )->leftHRIRReal_FOA[i] ); - ( *hHrtfFastConv )->leftHRIRReal_FOA[i] = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_FOA[i] ); - ( *hHrtfFastConv )->leftHRIRImag_FOA[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_FOA[i] ); - ( *hHrtfFastConv )->rightHRIRReal_FOA[i] = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_FOA[i] ); - ( *hHrtfFastConv )->rightHRIRImag_FOA[i] = NULL; - } - free( ( *hHrtfFastConv )->leftHRIRReal_FOA ); - ( *hHrtfFastConv )->leftHRIRReal_FOA = NULL; - free( ( *hHrtfFastConv )->leftHRIRImag_FOA ); - ( *hHrtfFastConv )->leftHRIRImag_FOA = NULL; - free( ( *hHrtfFastConv )->rightHRIRReal_FOA ); - ( *hHrtfFastConv )->rightHRIRReal_FOA = NULL; - free( ( *hHrtfFastConv )->rightHRIRImag_FOA ); - ( *hHrtfFastConv )->rightHRIRImag_FOA = NULL; + return; } + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRReal ); + ( *hHrtfFastConv )->leftHRIRReal = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRImag ); + ( *hHrtfFastConv )->leftHRIRImag = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRReal ); + ( *hHrtfFastConv )->rightHRIRReal = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRImag ); + ( *hHrtfFastConv )->rightHRIRImag = NULL; + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftBRIRReal ); + ( *hHrtfFastConv )->leftBRIRReal = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftBRIRImag ); + ( *hHrtfFastConv )->leftBRIRImag = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightBRIRReal ); + ( *hHrtfFastConv )->rightBRIRReal = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightBRIRImag ); + ( *hHrtfFastConv )->rightBRIRImag = NULL; + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRReal_HOA3 ); + ( *hHrtfFastConv )->leftHRIRReal_HOA3 = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRImag_HOA3 ); + ( *hHrtfFastConv )->leftHRIRImag_HOA3 = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRReal_HOA3 ); + ( *hHrtfFastConv )->rightHRIRReal_HOA3 = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRImag_HOA3 ); + ( *hHrtfFastConv )->rightHRIRImag_HOA3 = NULL; + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRReal_HOA2 ); + ( *hHrtfFastConv )->leftHRIRReal_HOA2 = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRImag_HOA2 ); + ( *hHrtfFastConv )->leftHRIRImag_HOA2 = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRReal_HOA2 ); + ( *hHrtfFastConv )->rightHRIRReal_HOA2 = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRImag_HOA2 ); + ( *hHrtfFastConv )->rightHRIRImag_HOA2 = NULL; + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRReal_FOA ); + ( *hHrtfFastConv )->leftHRIRReal_FOA = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->leftHRIRImag_FOA ); + ( *hHrtfFastConv )->leftHRIRImag_FOA = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRReal_FOA ); + ( *hHrtfFastConv )->rightHRIRReal_FOA = NULL; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); + free( ( *hHrtfFastConv )->rightHRIRImag_FOA ); + ( *hHrtfFastConv )->rightHRIRImag_FOA = NULL; } #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index ab4c53364b..5a9cf2d028 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1379,9 +1379,7 @@ typedef struct ivas_hrtfs_fastconv_struct float ***rightHRIRImag_FOA; float FASTCONV_FOA_latency_s; - BINAURAL_INPUT_AUDIO_CONFIG input_cfg_var; int16_t allocate_init_flag; /*Memory allocation flag 0: if the hrtf pointers are allocated at application level , 1: of allocated at ivas_binaural_hrtf_open() */ - int16_t nChannels; /*Number of channels updated based on maximum of cicp table*/ #else #ifdef UPDATE_FASTCONV_SBA_FILTER float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index fbc842b6be..df2c5c66f3 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1057,7 +1057,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( int16_t i, j; char *hrtf_data_rptr; #ifdef FIX_1720_HRTF_FASTCONV - ( *hHRTF )->input_cfg_var = input_cfg; ( *hHRTF )->allocate_init_flag = 0; ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); #endif -- GitLab From 9d1489a48cb17ad1128698814241a65112495414 Mon Sep 17 00:00:00 2001 From: azmill Date: Tue, 25 Jul 2023 16:28:29 +1000 Subject: [PATCH 498/591] Fixing the copyright headers --- .../SHD_2_ROM.m | 54 ++++++++++--------- .../convert_SD2SHD_HRIRs.m | 54 ++++++++++--------- .../fir_to_cldfb_fir.m | 54 ++++++++++--------- .../generate_HOA_HRIRs_MOD_lens.m | 54 ++++++++++--------- .../generate_rom_tables.m | 54 ++++++++++--------- .../get_allpass_IRs.m | 54 ++++++++++--------- .../hrtf_library_loader.m | 54 ++++++++++--------- .../matlab_hrir_generation_scripts/m_dft.m | 54 ++++++++++--------- .../m_hilbert.m | 54 ++++++++++--------- .../matlab_hrir_generation_scripts/m_idft.m | 54 ++++++++++--------- .../mag2min_phase.m | 54 ++++++++++--------- .../make_unit_vectors.m | 54 ++++++++++--------- .../writeData3L.m | 54 ++++++++++--------- 13 files changed, 377 insertions(+), 325 deletions(-) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m index 4bfee24763..3fb9a9e8ea 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/SHD_2_ROM.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function IR_cldfb = SHD_2_ROM( py_path, rom_c_file, sofa_file, ambi_order, hrir_len ) % SHD_2_ROM( python_path, rom_c_file, sofa_file, ambisonics_order, hrir_length ) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m index 116fb9b7cd..dceee36e4a 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function convert_SD2SHD_HRIRs(python_path, sofa_path, sofa_file, IR_size) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m index 6baf2c863d..5043f4f2c7 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/fir_to_cldfb_fir.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag, legacy_flag ) % F = fir_to_cldfb_fir( target_fir, num_cldfb_taps, eval_flag, legacy_flag ) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m index db4aee721b..ff42cf79c4 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_HOA_HRIRs_MOD_lens.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function IR_data = generate_HOA_HRIRs_MOD_lens(order, python_path, sofa_path, sofa_file_name, ir_len, write_out_sofa) % HRIR convertor - Takes sphere sampled HRIRs and converts them to diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m index c39d608822..4f0e959c6d 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/generate_rom_tables.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function generate_rom_tables(data_struct) diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m index 11b9948eb5..ed4ef76faf 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/get_allpass_IRs.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function IR = get_allpass_IRs(AllPass, dels) XSet = poly2XSet(AllPass.proto_poly, (dels(:)'-16)*AllPass.upper_freq/AllPass.proto_bw); diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m index f2eec776fd..f080160362 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/hrtf_library_loader.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% classdef hrtf_library_loader < handle % HRTF Library Loader and Interpolator diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m index b1e208bb02..b4c04c07ed 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_dft.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function Y=m_dft(X,Len,Dim) % MDFT - Modified transform, for use in convolution diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m index 4e929a40fe..ba4179dd00 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_hilbert.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function x = m_hilbert(xr) % M_HILBERT - compute the hilbert transform assuming the signal is even and diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m index 99726a1ee6..85141c44f2 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/m_idft.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function Y=m_idft(X,Len,Dim) % M_IDFT - Modified transform, for use in convolution diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/mag2min_phase.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/mag2min_phase.m index 437ae36f5a..627761a215 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/mag2min_phase.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/mag2min_phase.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function Y = mag2min_phase(X, opt_Dim, opt_do_HF_rolloff) % mag2min_phase - make a minimum-phase response from a magnitude response diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/make_unit_vectors.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/make_unit_vectors.m index 7416fddb38..649cb6913a 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/make_unit_vectors.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/make_unit_vectors.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function UnitVecs = make_unit_vectors(varargin) % Take a variable input argument set, and return a 3xN matrix of unit vectors diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m index 40319c0ff4..0ef63f01f2 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/writeData3L.m @@ -1,29 +1,33 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. -% -% This software is protected by copyright law and by international treaties. -% The Baseline Development Group consisting of Dolby International AB, Ericsson AB, -% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange, -% Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership -% rights in their respective contributions in the software. No license of any kind, including but not -% limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or -% otherwise. -% -% This software is provided "AS IS", without any express or implied warranties. The software is in the -% development stage. It is intended exclusively for experts who have experience with such software and -% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -% and/or fitness for a particular purpose are hereby disclaimed and excluded. -% -% Any dispute, controversy or claim arising under or in relation to providing this software shall be -% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -% the United Nations Convention on Contracts on the International Sales of Goods. -% +% +% (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository. All Rights Reserved. +% +% This software is protected by copyright law and by international treaties. +% The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +% Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +% Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +% Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +% contributors to this repository retain full ownership rights in their respective contributions in +% the software. This notice grants no license of any kind, including but not limited to patent +% license, nor is any license granted by implication, estoppel or otherwise. +% +% Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +% contributions. +% +% This software is provided "AS IS", without any express or implied warranties. The software is in the +% development stage. It is intended exclusively for experts who have experience with such software and +% solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +% and fitness for a particular purpose are hereby disclaimed and excluded. +% +% Any dispute, controversy or claim arising under or in relation to providing this software shall be +% submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +% accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +% the United Nations Convention on Contracts on the International Sales of Goods. +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function writeData3L(fid_source, startstring, data) indices=size(data); -- GitLab From f633d6627217d9948122f2fbb9ed4826e890b700 Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Tue, 25 Jul 2023 12:04:25 +0530 Subject: [PATCH 499/591] minor change --- lib_dec/ivas_binRenderer_internal.c | 93 +++++++++-------------------- 1 file changed, 28 insertions(+), 65 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 6887040363..3b0f1838d1 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1566,6 +1566,8 @@ static void ivas_free_pppHrtfMem( float ****ppppHRIR, int16_t dim, int16_t alloc free( ( *ppppHRIR )[i] ); ( *ppppHRIR )[i] = NULL; } + free( *ppppHRIR ); + *ppppHRIR = NULL; } } /*------------------------------------------------------------------------- @@ -1578,75 +1580,36 @@ void ivas_binaural_hrtf_close( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ ) { - + int16_t allocate_init_flag; if ( hHrtfFastConv == NULL || *hHrtfFastConv == NULL ) { return; } - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRReal ); - ( *hHrtfFastConv )->leftHRIRReal = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRImag ); - ( *hHrtfFastConv )->leftHRIRImag = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRReal ); - ( *hHrtfFastConv )->rightHRIRReal = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRImag ); - ( *hHrtfFastConv )->rightHRIRImag = NULL; - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftBRIRReal ); - ( *hHrtfFastConv )->leftBRIRReal = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftBRIRImag ); - ( *hHrtfFastConv )->leftBRIRImag = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRReal, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightBRIRReal ); - ( *hHrtfFastConv )->rightBRIRReal = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRImag, HRTF_LS_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightBRIRImag ); - ( *hHrtfFastConv )->rightBRIRImag = NULL; - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRReal_HOA3 ); - ( *hHrtfFastConv )->leftHRIRReal_HOA3 = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRImag_HOA3 ); - ( *hHrtfFastConv )->leftHRIRImag_HOA3 = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRReal_HOA3 ); - ( *hHrtfFastConv )->rightHRIRReal_HOA3 = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA3, HOA3_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRImag_HOA3 ); - ( *hHrtfFastConv )->rightHRIRImag_HOA3 = NULL; - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRReal_HOA2 ); - ( *hHrtfFastConv )->leftHRIRReal_HOA2 = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRImag_HOA2 ); - ( *hHrtfFastConv )->leftHRIRImag_HOA2 = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRReal_HOA2 ); - ( *hHrtfFastConv )->rightHRIRReal_HOA2 = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA2, HOA2_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRImag_HOA2 ); - ( *hHrtfFastConv )->rightHRIRImag_HOA2 = NULL; - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRReal_FOA ); - ( *hHrtfFastConv )->leftHRIRReal_FOA = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->leftHRIRImag_FOA ); - ( *hHrtfFastConv )->leftHRIRImag_FOA = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRReal_FOA ); - ( *hHrtfFastConv )->rightHRIRReal_FOA = NULL; - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_FOA, FOA_CHANNELS, ( *hHrtfFastConv )->allocate_init_flag ); - free( ( *hHrtfFastConv )->rightHRIRImag_FOA ); - ( *hHrtfFastConv )->rightHRIRImag_FOA = NULL; + allocate_init_flag = ( *hHrtfFastConv )->allocate_init_flag; + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA3, HOA3_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA3, HOA3_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA3, HOA3_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA3, HOA3_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA2, HOA2_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA2, HOA2_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA2, HOA2_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA2, HOA2_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_FOA, FOA_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_FOA, FOA_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_FOA, FOA_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_FOA, FOA_CHANNELS, allocate_init_flag ); } #endif -- GitLab From 15f077ed5816b23cd3b56773ce8eea225ff0e935 Mon Sep 17 00:00:00 2001 From: azmill Date: Tue, 25 Jul 2023 17:22:25 +1000 Subject: [PATCH 500/591] Updating README and adding in license notice for sofar --- .../matlab_hrir_generation_scripts/README.md | 2 +- scripts/thirdPartyLegalNotices/sofar.txt | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 scripts/thirdPartyLegalNotices/sofar.txt diff --git a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md index 25a3fcfeff..f6eb2cfad6 100644 --- a/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md +++ b/scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md @@ -4,4 +4,4 @@ Entry point to convert SD HRIRs to SHD HRIRs is the convert_SD2SHD_HRIRs.m scrip Entry point to convert SHD HRIRs to CLDFB domain HRIRs is SHD_2_ROM.m. Python 3.9.x needs to be installed with the sofar python module. The convert_SD2SHD_HRIRs.m script needs the path to this python. -Matlab 2020 has seen some issues with using python, so use a newer version if possible. +Matlab 2020 has seen some issues with using python, so use a newer version if possible. If you are unable to use a newer matlab version, try loading in the OS default python, as this works sometimes. diff --git a/scripts/thirdPartyLegalNotices/sofar.txt b/scripts/thirdPartyLegalNotices/sofar.txt new file mode 100644 index 0000000000..132366686a --- /dev/null +++ b/scripts/thirdPartyLegalNotices/sofar.txt @@ -0,0 +1,21 @@ +Applies to sofar + +Copyright (c) [2021] [The pyfar developers] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file -- GitLab From 4c814379456ce90514b7dbf1351060af5e70d38a Mon Sep 17 00:00:00 2001 From: Shikha Shetgeri <100861@ittiam.com> Date: Tue, 25 Jul 2023 13:02:33 +0530 Subject: [PATCH 501/591] minor clean up --- lib_dec/ivas_binRenderer_internal.c | 3 --- lib_rend/ivas_hrtf.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 3b0f1838d1..808e124713 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -50,9 +50,6 @@ #include "debug.h" #endif #include "wmc_auto.h" -#ifdef FIX_1720_HRTF_FASTCONV -#include -#endif /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 926491c8fb..a64867ea6b 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -37,7 +37,7 @@ #include "ivas_error.h" #include "wmc_auto.h" #ifdef FIX_1720_HRTF_FASTCONV -#include +#include "ivas_prot.h" #endif /*-----------------------------------------------------------------------* @@ -143,7 +143,7 @@ ivas_error ivas_HRTF_fastconv_binary_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FASTCONV HRTF tables!" ); } #ifdef FIX_1720_HRTF_FASTCONV - memset( *hHrtfFastConv, 0x00, sizeof( HRTFS_FASTCONV ) ); + ivas_init_binaural_hrtf( *hHrtfFastConv ); #endif return IVAS_ERR_OK; } -- GitLab From eeef5c123d069bae466d9d251bb5c99fe64d226f Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 25 Jul 2023 13:09:43 +0530 Subject: [PATCH 502/591] Fix for issue#629 --- lib_com/ivas_dirac_com.c | 4 ++++ lib_com/options.h | 1 + 2 files changed, 5 insertions(+) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 504aea5d6c..35fadda709 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -385,7 +385,11 @@ void ivas_get_dirac_sba_max_md_bits( *bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); *metadata_max_bits = MAX16B; /* no limit */ } +#ifdef FIX_629_UBSAN_MD_MAX_BITS + *metadata_max_bits = (int16_t) min( (float) MAX16B, ceilf( (float) *metadata_max_bits * nbands / 5 ) ); +#else *metadata_max_bits = (int16_t) ceilf( (float) *metadata_max_bits * nbands / 5 ); +#endif *qmetadata_max_bit_req = QMETADATA_MAXBIT_REQ_SBA >> 1; return; diff --git a/lib_com/options.h b/lib_com/options.h index 7f752d7e7b..d4030b33ef 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -212,6 +212,7 @@ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ #define FIX_624_PLANAR_SBA_WB /*Dlb : Fix for unintialised value issue 624 */ +#define FIX_629_UBSAN_MD_MAX_BITS /*Dlb : Fix for UBSAN issue 629 for MD MAX bits calculation*/ /* ################## End BE DEVELOPMENT switches ######################### */ -- GitLab From 3984d9afd8ef1b7318e143ebcccfa261bf50d441 Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 25 Jul 2023 12:25:05 +0200 Subject: [PATCH 503/591] update suppression file --- scripts/ubsan.supp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp index 54461a31dd..8f312aa15a 100644 --- a/scripts/ubsan.supp +++ b/scripts/ubsan.supp @@ -7,8 +7,6 @@ bounds:ivas_spar_decoder.c bounds:trans_direct.c bounds:trans_inv.c float-cast-overflow:ivas_dirac_com.c -float-cast-overflow:ivas_mct_core_enc.c -float-divide-by-zero:ivas_mct_core_enc.c float-divide-by-zero:ivas_stereo_cng_dec.c float-divide-by-zero:swb_tbe_enc.c implicit-integer-sign-change:ACcontextMapping.c @@ -45,12 +43,10 @@ implicit-signed-integer-truncation:tools.c null:ivas_dirac_com.c pointer-overflow:ivas_dirac_dec.c pointer-overflow:ivas_dirac_output_synthesis_dec.c +pointer-overflow:ivas_dirac_rend.c shift-base:basop32.c shift-base:enh40.c shift-base:enh40.h shift-base:enh1632.c shift-base:hq_lr_dec.c signed-integer-overflow:basop32.c - -# renderer test -null:lib_rend.c -- GitLab From f3edea3a23241997faf48838c0aaefc68c6ac323 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Jul 2023 13:38:53 +0200 Subject: [PATCH 504/591] fix issue 618 - UBSAN: division-by-zero in stereo bitrate switching; under FIX_618_STEREO_SW_DIV_BY_ZERO --- lib_com/options.h | 2 ++ lib_enc/swb_tbe_enc.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c2bc0b866b..318f5df710 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,6 +209,8 @@ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ #define FIX_626_VARIABLE_TYPE_MDCT_CONC /* FhG: trivial fix to fix USAN error */ #define FIX_616_DIV_ZERO_MCT /*FhG : Fix UBSAN division by zero error of issue 616*/ +#define FIX_618_STEREO_SW_DIV_BY_ZERO /* VA: fix issue 618 - UBSAN: division-by-zero in stereo bitrate switching */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index 38a0fb73ff..a57e381eb4 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -1259,7 +1259,11 @@ void swb_tbe_enc( GainFrame *= temp; } +#ifdef FIX_618_STEREO_SW_DIV_BY_ZERO + if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && ( st->last_extl == SWB_TBE || st->last_extl == FB_TBE ) && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) +#else if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) +#endif { float fac = GainFrame / hBWE_TD->prev_gainFr_SHB; -- GitLab From ac0f7407a44e4c203e177a5e24cf390c06970c42 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 25 Jul 2023 21:45:02 +1000 Subject: [PATCH 505/591] 63 quant point support for pred coeffs --- lib_com/ivas_cnst.h | 5 +- lib_rend/ivas_prot_rend.h | 5 + lib_rend/ivas_splitRendererPost.c | 113 ++++++++++++++++++----- lib_rend/ivas_splitRendererPre.c | 137 ++++++++++++++++++++++------ lib_rend/ivas_splitRenderer_utils.c | 36 +++++++- 5 files changed, 244 insertions(+), 52 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index addd0ad017..d441d8f0ed 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1553,8 +1553,11 @@ typedef enum #define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS) #define COMPLEX_MD_BAND_THRESH_LOW (5) - +#ifndef SPLIT_REND_PRED_QUANT_63_PNTS #define IVAS_SPLIT_REND_NUM_QUANT_STRATS (3) +#else +#define IVAS_SPLIT_REND_NUM_QUANT_STRATS (4) +#endif #ifdef SPLIT_REND_PRED_QUANT_63_PNTS #define IVAS_SPLIT_REND_PRED_63QUANT_PNTS ( 63 ) #define IVAS_SPLIT_REND_PRED_31QUANT_PNTS ( 31 ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index e64fdce77a..d2f0285ebe 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -596,6 +596,11 @@ void ivas_split_rend_get_quant_params( const int16_t num_md_bands, int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + float pred_quantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + float pred_1byquantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], +#endif int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 0e97a78dbf..1adf977496 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -255,7 +255,12 @@ static void ivas_split_rend_unquant_md( BIN_HR_SPLIT_REND_MD_HANDLE hMd, IVAS_SPLIT_REND_POSE_TYPE pose_type, int16_t real_only, - float fix_pos_rot_mat[][BINAURAL_CHANNELS] ) + float fix_pos_rot_mat[][BINAURAL_CHANNELS] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + float pred_quant_step +#endif +) { int16_t ch1, ch2; int16_t gd_idx_min; @@ -271,14 +276,7 @@ static void ivas_split_rend_unquant_md( #endif #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - if ( pose_type == PRED_ONLY ) - { - quantstep = IVAS_SPLIT_REND_PRED31_Q_STEP; - } - else - { - quantstep = IVAS_SPLIT_REND_PRED_ROLL_Q_STEP; - } + quantstep = pred_quant_step; #endif for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) @@ -348,6 +346,9 @@ static void ivas_splitBinPostRendMdBase2Dec( const int16_t num_subframes, const int16_t pred_real_bands_yaw, const int16_t pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + const int16_t pred_quant_pnts_yaw, +#endif const int16_t d_bands_yaw, const int16_t bands_pitch, const int16_t pred_real_bands_roll, @@ -356,13 +357,24 @@ static void ivas_splitBinPostRendMdBase2Dec( int16_t sf_idx, pos_idx, b, ch1, ch2; int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len; int16_t min_pred_roll_idx, pred_roll_code_len; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_cb_idx; +#endif int16_t code; BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; + if ( pred_quant_pnts_yaw == IVAS_SPLIT_REND_PRED_63QUANT_PNTS ) + { + pred_cb_idx = 1; + } + else + { + pred_cb_idx = 0; + } + min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0]; min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; #else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; @@ -371,7 +383,7 @@ static void ivas_splitBinPostRendMdBase2Dec( min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0]; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - pred_code_len = pHuff_cfg->pred_base2_code_len[0]; + pred_code_len = pHuff_cfg->pred_base2_code_len[pred_cb_idx]; pred_roll_code_len = pHuff_cfg->pred_roll_base2_code_len; #else pred_code_len = pHuff_cfg->pred_base2_code_len; @@ -468,6 +480,9 @@ static void ivas_splitBinPostRendMdHuffDec( const int16_t num_subframes, const int16_t pred_real_bands_yaw, const int16_t pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + const int16_t pred_quant_pnts_yaw, +#endif const int16_t d_bands_yaw, const int16_t bands_pitch, const int16_t pred_real_bands_roll, @@ -478,15 +493,23 @@ static void ivas_splitBinPostRendMdHuffDec( int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t min_pred_idx, max_pred_idx; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - int16_t min_pred_roll_idx, max_pred_roll_idx; + int16_t min_pred_roll_idx, max_pred_roll_idx, pred_cb_idx; #endif BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPostRend->huff_cfg; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; - max_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 ) * 3]; + if ( pred_quant_pnts_yaw == IVAS_SPLIT_REND_PRED_63QUANT_PNTS ) + { + pred_cb_idx = 1; + } + else + { + pred_cb_idx = 0; + } + min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0]; + max_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[( pred_quant_pnts_yaw - 1 ) * 3]; #else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; max_pred_idx = (int16_t) pHuff_cfg->pred.codebook[( IVAS_SPLIT_REND_PRED_QUANT_PNTS - 1 ) * 3]; @@ -511,7 +534,7 @@ static void ivas_splitBinPostRendMdHuffDec( for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred[0], pBits, pHuff_cfg->pred_idx_trav[0] ); + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] ); #else sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); #endif @@ -528,7 +551,7 @@ static void ivas_splitBinPostRendMdHuffDec( for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred[0], pBits, pHuff_cfg->pred_idx_trav[0] ); + sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] ); #else sym_adj_idx[ch1][ch2] = ivas_split_rend_huffman_decode_opt( &pHuff_cfg->pred, pBits, pHuff_cfg->pred_idx_trav ); #endif @@ -636,6 +659,11 @@ void ivas_splitBinPostRendMdDec( int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; int16_t num_complex_bands, num_quant_strats; int32_t quant_strat_bits, is_huff_coding, quant_strat; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + float pred_1byquantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + float pred_quantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG int16_t ch1, ch2; #endif @@ -681,6 +709,11 @@ void ivas_splitBinPostRendMdDec( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw, + pred_quantstep_yaw, + pred_1byquantstep_yaw, +#endif d_bands_yaw, bands_pitch, pred_real_bands_roll, @@ -700,6 +733,9 @@ void ivas_splitBinPostRendMdDec( num_subframes, pred_real_bands_yaw[quant_strat], pred_imag_bands_yaw[quant_strat], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw[quant_strat], +#endif d_bands_yaw[quant_strat], bands_pitch[quant_strat], pred_real_bands_roll[quant_strat], @@ -713,6 +749,9 @@ void ivas_splitBinPostRendMdDec( num_subframes, pred_real_bands_yaw[quant_strat], pred_imag_bands_yaw[quant_strat], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw[quant_strat], +#endif d_bands_yaw[quant_strat], bands_pitch[quant_strat], pred_real_bands_roll[quant_strat], @@ -832,14 +871,24 @@ void ivas_splitBinPostRendMdDec( hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_unquant_md( hMd, PRED_ONLY, - 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + pred_quantstep_yaw[quant_strat] +#endif + ); } for ( ; b < pred_real_bands_yaw[quant_strat]; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_unquant_md( hMd, PRED_ONLY, - 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + pred_quantstep_yaw[quant_strat] +#endif + ); } for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { @@ -856,7 +905,12 @@ void ivas_splitBinPostRendMdDec( hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_unquant_md( hMd, COM_GAIN_ONLY, - 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + 0 +#endif + ); } for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { @@ -871,7 +925,12 @@ void ivas_splitBinPostRendMdDec( hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_unquant_md( hMd, LR_GAIN_ONLY, - 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + 0 +#endif + ); } for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { @@ -891,7 +950,12 @@ void ivas_splitBinPostRendMdDec( #else PRED_ONLY, #endif - 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + IVAS_SPLIT_REND_PRED_ROLL_Q_STEP +#endif + ); } for ( ; b < pred_real_bands_roll[quant_strat]; b++ ) { @@ -902,7 +966,12 @@ void ivas_splitBinPostRendMdDec( #else PRED_ONLY, #endif - 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + IVAS_SPLIT_REND_PRED_ROLL_Q_STEP +#endif + ); } for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ ) { diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 5e446f7b2f..a8c9f3fb6e 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -459,7 +459,12 @@ static void ivas_split_rend_quant_md( BIN_HR_SPLIT_REND_MD_HANDLE hMd, IVAS_SPLIT_REND_POSE_TYPE pose_type, int16_t real_only, - float fix_pos_rot_mat[][BINAURAL_CHANNELS] ) + float fix_pos_rot_mat[][BINAURAL_CHANNELS] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + float pred_1byquantstep +#endif +) { int16_t ch1, ch2; int16_t gd_idx_min; @@ -476,15 +481,7 @@ static void ivas_split_rend_quant_md( #endif #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - if ( pose_type == PRED_ONLY ) - { - onebyquantstep = IVAS_SPLIT_REND_PRED31_1BYQ_STEP; - } - else - { - onebyquantstep = IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP; - } - + onebyquantstep = pred_1byquantstep; #endif if ( real_only == 1 ) { @@ -543,12 +540,10 @@ static void ivas_split_rend_quant_md( quant_val = min( IVAS_SPLIT_REND_PITCH_G_MAX_VAL, max( hMd->gd, IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) ); gd_idx_min = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * IVAS_SPLIT_REND_PITCH_G_MIN_VAL ); hMd->gd_idx = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * quant_val ); - // hMd->gd = hMd->gd_idx * IVAS_SPLIT_REND_PITCH_G_Q_STEP; hMd->gd_idx = hMd->gd_idx - gd_idx_min; quant_val = min( IVAS_SPLIT_REND_PITCH_G_MAX_VAL, max( hMd->gd2, IVAS_SPLIT_REND_PITCH_G_MIN_VAL ) ); hMd->gd2_idx = (int16_t) roundf( IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP * quant_val ); - // hMd->gd2 = hMd->gd2_idx * IVAS_SPLIT_REND_PITCH_G_Q_STEP; hMd->gd2_idx = hMd->gd2_idx - gd_idx_min; } @@ -759,20 +754,29 @@ static void get_base2_bits( const int16_t num_quant_strats, const int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], const int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], +#endif const int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], const int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS], const int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], const int16_t pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int32_t base2bits[IVAS_SPLIT_REND_NUM_QUANT_STRATS] ) { - int16_t pred_bits, d_gain_bits, pitch_gain_bits, pose_idx, q; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS int16_t pred_roll_bits; + int16_t d_gain_bits, pitch_gain_bits, pose_idx, q; + int16_t pred_yaw_bits[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; +#else + int16_t pred_bits, d_gain_bits, pitch_gain_bits, pose_idx, q; #endif IVAS_SPLIT_REND_POSE_TYPE pose_type; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - pred_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_PRED_31QUANT_PNTS ) ); + for ( q = 0; q < num_quant_strats; q++ ) + { + pred_yaw_bits[q] = (int16_t) ceilf( log2f( pred_quant_pnts_yaw[q] ) ); + } pred_roll_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS ) ); #else pred_bits = (int16_t) ceilf( log2f( IVAS_SPLIT_REND_PRED_QUANT_PNTS ) ); @@ -792,8 +796,13 @@ static void get_base2_bits( pose_type = hBinHrSplitPreRend->pose_type[pose_idx]; if ( pose_type == ANY_YAW ) { +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + base2bits[q] += pred_yaw_bits[q] * pred_real_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; + base2bits[q] += pred_yaw_bits[q] * pred_imag_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; +#else base2bits[q] += pred_bits * pred_real_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; base2bits[q] += pred_bits * pred_imag_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; +#endif base2bits[q] += d_gain_bits * d_bands_yaw[q] * num_subframes; } else if ( pose_type == PITCH_ONLY ) @@ -823,6 +832,9 @@ static void ivas_SplitRenderer_code_md_base2( const int16_t num_subframes, const int16_t pred_real_bands_yaw, const int16_t pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + const int16_t pred_quant_pnts_yaw, +#endif const int16_t d_bands_yaw, const int16_t bands_pitch, const int16_t pred_real_bands_roll, @@ -832,12 +844,23 @@ static void ivas_SplitRenderer_code_md_base2( int16_t pos_idx, b, ch1, ch2, sf_idx; int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len, num_poses; int16_t min_pred_roll_idx, pred_roll_code_len; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_cb_idx; +#endif int32_t code; BIN_HR_SPLIT_REND_MD_HANDLE hMd; BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg; pHuff_cfg = &hBinHrSplitPreRend->huff_cfg; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; + if ( pred_quant_pnts_yaw == IVAS_SPLIT_REND_PRED_63QUANT_PNTS ) + { + pred_cb_idx = 1; + } + else + { + pred_cb_idx = 0; + } + min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0]; min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; #else min_pred_idx = (int16_t) pHuff_cfg->pred.codebook[0]; @@ -846,7 +869,7 @@ static void ivas_SplitRenderer_code_md_base2( min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0]; min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0]; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - pred_code_len = pHuff_cfg->pred_base2_code_len[0]; + pred_code_len = pHuff_cfg->pred_base2_code_len[pred_cb_idx]; pred_roll_code_len = pHuff_cfg->pred_roll_base2_code_len; #else pred_code_len = pHuff_cfg->pred_base2_code_len; @@ -966,6 +989,9 @@ static void ivas_SplitRenderer_code_md_huff( const int16_t num_subframes, const int16_t pred_real_bands_yaw, const int16_t pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + const int16_t pred_quant_pnts_yaw, +#endif const int16_t d_bands_yaw, const int16_t bands_pitch, const int16_t pred_real_bands_roll, @@ -976,7 +1002,7 @@ static void ivas_SplitRenderer_code_md_huff( int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; int16_t min_pred_idx, max_pred_idx; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - int16_t min_pred_roll_idx, max_pred_roll_idx; + int16_t min_pred_roll_idx, max_pred_roll_idx, pred_cb_idx; #endif int32_t code, len; BIN_HR_SPLIT_REND_MD_HANDLE hMd; @@ -984,8 +1010,16 @@ static void ivas_SplitRenderer_code_md_huff( pHuff_cfg = &hBinHrSplitPreRend->huff_cfg; #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - min_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[0]; - max_pred_idx = (int16_t) pHuff_cfg->pred[0].codebook[( IVAS_SPLIT_REND_PRED_31QUANT_PNTS - 1 ) * 3]; + if ( pred_quant_pnts_yaw == IVAS_SPLIT_REND_PRED_63QUANT_PNTS ) + { + pred_cb_idx = 1; + } + else + { + pred_cb_idx = 0; + } + min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0]; + max_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[( pred_quant_pnts_yaw - 1 ) * 3]; min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0]; max_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[( IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 ) * 3]; #else @@ -1010,7 +1044,7 @@ static void ivas_SplitRenderer_code_md_huff( for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - ivas_split_rend_huffman_encode( &pHuff_cfg->pred[0], sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_huffman_encode( &pHuff_cfg->pred[pred_cb_idx], sym_adj_idx[ch1][ch2], &code, &len ); #else ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); #endif @@ -1027,7 +1061,7 @@ static void ivas_SplitRenderer_code_md_huff( for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) { #ifdef SPLIT_REND_PRED_QUANT_63_PNTS - ivas_split_rend_huffman_encode( &pHuff_cfg->pred[0], sym_adj_idx[ch1][ch2], &code, &len ); + ivas_split_rend_huffman_encode( &pHuff_cfg->pred[pred_cb_idx], sym_adj_idx[ch1][ch2], &code, &len ); #else ivas_split_rend_huffman_encode( &pHuff_cfg->pred, sym_adj_idx[ch1][ch2], &code, &len ); #endif @@ -1150,6 +1184,11 @@ static void ivas_SplitRenderer_quant_code( int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; int32_t base2bits[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + float pred_1byquantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; + float pred_quantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS]; +#endif BIN_HR_SPLIT_REND_MD_HANDLE hMd; if ( low_res_pre_rend_rot ) @@ -1191,6 +1230,11 @@ static void ivas_SplitRenderer_quant_code( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw, + pred_quantstep_yaw, + pred_1byquantstep_yaw, +#endif d_bands_yaw, bands_pitch, pred_real_bands_roll, @@ -1207,6 +1251,9 @@ static void ivas_SplitRenderer_quant_code( num_quant_strats, pred_real_bands_yaw, pred_imag_bands_yaw, +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw, +#endif d_bands_yaw, bands_pitch, pred_real_bands_roll, @@ -1226,21 +1273,36 @@ static void ivas_SplitRenderer_quant_code( hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_quant_md( hMd, PRED_ONLY, - 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + pred_1byquantstep_yaw[q] +#endif + ); } for ( ; b < pred_real_bands_yaw[q]; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_quant_md( hMd, PRED_ONLY, - 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + pred_1byquantstep_yaw[q] +#endif + ); } for ( b = 0; b < d_bands_yaw[q]; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_quant_md( hMd, COM_GAIN_ONLY, - 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + 0 +#endif + ); } } else if ( hBinHrSplitPreRend->pose_type[pos_idx] == PITCH_ONLY ) @@ -1250,7 +1312,12 @@ static void ivas_SplitRenderer_quant_code( hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; ivas_split_rend_quant_md( hMd, LR_GAIN_ONLY, - 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + 0 +#endif + ); } } else @@ -1264,7 +1331,12 @@ static void ivas_SplitRenderer_quant_code( #else PRED_ONLY, #endif - 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + 0, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP +#endif + ); } for ( ; b < pred_real_bands_roll[q]; b++ ) { @@ -1275,7 +1347,12 @@ static void ivas_SplitRenderer_quant_code( #else PRED_ONLY, #endif - 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] ); + 1, hBinHrSplitPreRend->fix_pos_rot_mat[pos_idx] +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + , + IVAS_SPLIT_REND_PRED_ROLL_1BYQ_STEP +#endif + ); } } } @@ -1293,6 +1370,9 @@ static void ivas_SplitRenderer_quant_code( num_subframes, pred_real_bands_yaw[q], pred_imag_bands_yaw[q], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw[q], +#endif d_bands_yaw[q], bands_pitch[q], pred_real_bands_roll[q], @@ -1312,6 +1392,9 @@ static void ivas_SplitRenderer_quant_code( num_subframes, pred_real_bands_yaw[q], pred_imag_bands_yaw[q], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw[q], +#endif d_bands_yaw[q], bands_pitch[q], pred_real_bands_roll[q], diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 5f7c46eb33..baa5f79139 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -617,6 +617,11 @@ void ivas_split_rend_get_quant_params( const int16_t num_md_bands, int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_imag_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + int16_t pred_quant_pnts_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + float pred_quantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], + float pred_1byquantstep_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], +#endif int16_t d_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t bands_pitch[IVAS_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_real_bands_roll[IVAS_SPLIT_REND_NUM_QUANT_STRATS], @@ -629,7 +634,17 @@ void ivas_split_rend_get_quant_params( *num_quant_strats = IVAS_SPLIT_REND_NUM_QUANT_STRATS; *num_complex_bands = COMPLEX_MD_BAND_THRESH_LOW; assert( *num_complex_bands <= num_md_bands ); - +#ifdef SPLIT_REND_PRED_QUANT_63_PNTS + pred_quant_pnts_yaw[0] = IVAS_SPLIT_REND_PRED_63QUANT_PNTS; + pred_quantstep_yaw[0] = IVAS_SPLIT_REND_PRED63_Q_STEP; + pred_1byquantstep_yaw[0] = IVAS_SPLIT_REND_PRED63_1BYQ_STEP; + for ( q = 1; q < *num_quant_strats; q++ ) + { + pred_quant_pnts_yaw[q] = IVAS_SPLIT_REND_PRED_31QUANT_PNTS; + pred_quantstep_yaw[q] = IVAS_SPLIT_REND_PRED31_Q_STEP; + pred_1byquantstep_yaw[q] = IVAS_SPLIT_REND_PRED31_1BYQ_STEP; + } +#endif for ( q = 0; q < *num_quant_strats; q++ ) { @@ -638,12 +653,22 @@ void ivas_split_rend_get_quant_params( } pred_imag_bands_yaw[0] = num_md_bands; pred_imag_bands_roll[0] = num_md_bands; +#ifndef SPLIT_REND_PRED_QUANT_63_PNTS for ( q = 1; q < *num_quant_strats; q++ ) +#else + pred_imag_bands_yaw[1] = num_md_bands; + pred_imag_bands_roll[1] = num_md_bands; + for ( q = 2; q < *num_quant_strats; q++ ) +#endif { +#ifndef SPLIT_REND_PRED_QUANT_63_PNTS pred_imag_bands_yaw[q] = ( q == 1 ) ? num_md_bands : *num_complex_bands; +#else + pred_imag_bands_yaw[q] = ( q < ( *num_quant_strats - 1 ) ) ? num_md_bands : *num_complex_bands; +#endif pred_imag_bands_roll[q] = *num_complex_bands; } - +#ifndef SPLIT_REND_PRED_QUANT_63_PNTS d_bands_yaw[0] = 0; bands_pitch[0] = num_md_bands; for ( q = 1; q < *num_quant_strats; q++ ) @@ -651,6 +676,13 @@ void ivas_split_rend_get_quant_params( d_bands_yaw[q] = 0; bands_pitch[q] = num_md_bands; } +#else + for ( q = 0; q < *num_quant_strats; q++ ) + { + d_bands_yaw[q] = 0; + bands_pitch[q] = num_md_bands; + } +#endif return; } -- GitLab From 066d126b7b14c65bdea2ad36568de66883f3ae3c Mon Sep 17 00:00:00 2001 From: rhb Date: Tue, 25 Jul 2023 14:31:10 +0200 Subject: [PATCH 506/591] fix issue 625: UBSAN index out-of-bounds --- lib_com/options.h | 1 + lib_dec/ivas_spar_decoder.c | 4 ++++ 2 files changed, 5 insertions(+) mode change 100644 => 100755 lib_dec/ivas_spar_decoder.c diff --git a/lib_com/options.h b/lib_com/options.h index c2bc0b866b..1cd3e0754c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,6 +209,7 @@ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ #define FIX_626_VARIABLE_TYPE_MDCT_CONC /* FhG: trivial fix to fix USAN error */ #define FIX_616_DIV_ZERO_MCT /*FhG : Fix UBSAN division by zero error of issue 616*/ +#define FIX_625_IDX_OOB /* FhG: Fix index out-of-bounds UBSAN error (issue 625) */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c old mode 100644 new mode 100755 index 1c839316e5..281c5e9f11 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1026,7 +1026,11 @@ static void ivas_spar_calc_smooth_facs( /* calculate band-wise subframe energies */ subframe_band_nrg[b] = 0.f; +#ifdef FIX_625_IDX_OOB + while ( bin < CLDFB_NO_CHANNELS_MAX && b == bin2band->p_cldfb_map_to_spar_band[bin] ) +#else while ( b == bin2band->p_cldfb_map_to_spar_band[bin] ) +#endif { for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { -- GitLab From b5c153f643d54e1d0997359784f1964d074a0346 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Tue, 25 Jul 2023 16:48:03 +0200 Subject: [PATCH 507/591] Fix 549: binaural output too quiet in ParamISM. --- lib_com/options.h | 2 ++ lib_dec/ivas_dec.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c2bc0b866b..a87998242b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -210,6 +210,8 @@ #define FIX_626_VARIABLE_TYPE_MDCT_CONC /* FhG: trivial fix to fix USAN error */ #define FIX_616_DIV_ZERO_MCT /*FhG : Fix UBSAN division by zero error of issue 616*/ +#define FIX_549_PARAM_ISM_BIN_GAIN /* FhG: Issue 549 : fix too quiet binaural output in ParamISM */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 5ca878a00e..8a66e36024 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -212,6 +212,11 @@ ivas_error ivas_dec( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { +#ifdef FIX_549_PARAM_ISM_BIN_GAIN + /* loudness correction */ + ivas_dirac_dec_binaural_sba_gain( output, st_ivas->nchan_transport, output_frame ); +#endif + ivas_param_ism_params_to_masa_param_mapping( st_ivas ); ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport ); -- GitLab From 8ca9b8650d35413166def65d6efe375f4e056028 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 26 Jul 2023 11:16:26 +0530 Subject: [PATCH 508/591] Cleaned up unused function and some TODO comments:issue #279 --- lib_com/options.h | 2 +- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_dec/ivas_spar_md_dec.c | 28 ++++++++++++++++++++++------ lib_enc/ivas_qmetadata_enc.c | 3 +-- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c2bc0b866b..db95f7daa0 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,7 +209,7 @@ #define FIX_615_UBSAN_SPAR_TO_DIRAC /*Dlb : Fix for UBSAN issue 615*/ #define FIX_626_VARIABLE_TYPE_MDCT_CONC /* FhG: trivial fix to fix USAN error */ #define FIX_616_DIV_ZERO_MCT /*FhG : Fix UBSAN division by zero error of issue 616*/ - +#define FIX_279_CODE_COVERAGE /*Dlb : issue 279 , clean up unused function*/ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index e4c69cd288..453e27b320 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1455,7 +1455,7 @@ int16_t ivas_qmetadata_dec_sid_decode( } } } - /* TODO: temporary hack to keep BE */ + if ( ivas_format != SBA_FORMAT ) { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index c61effd673..ec363399e4 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -72,15 +72,20 @@ static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_St static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type, const int16_t planarCP ); #else +#ifndef FIX_279_CODE_COVERAGE static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t strat, const int32_t ivas_total_brate ); +#else +static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t strat, const int32_t ivas_total_brate ); +#endif static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw ); static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type ); #endif +#ifndef FIX_279_CODE_COVERAGE static void ivas_get_band_idx_from_differential( ivas_spar_md_t *pSpar_md, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const ivas_coeffs_type_t coeff_type ); - +#endif static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi, const int16_t num_md_sub_frames ); @@ -1799,7 +1804,11 @@ static void ivas_spar_dec_parse_md_bs( int16_t ii, jj, ndec, ndm, b, idx; uint16_t qsi; ivas_quant_strat_t qs; +#ifndef FIX_279_CODE_COVERAGE int16_t strat, freq_diff, no_ec; +#else + int16_t strat, no_ec; +#endif int16_t do_diff[IVAS_MAX_NUM_BANDS]; #ifndef FIX_280_PLANAR_CP int16_t planarCP; @@ -1931,7 +1940,9 @@ static void ivas_spar_dec_parse_md_bs( #ifdef SPAR_HOA_DBG /*fprintf(stdout, "\n\n no_ec = %d, strat = %d\n", no_ec, strat);*/ #endif +#ifndef FIX_279_CODE_COVERAGE freq_diff = 0; +#endif no_ec = 0; if ( strat < 2 ) @@ -1986,7 +1997,10 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { - ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, +#ifndef FIX_279_CODE_COVERAGE + freq_diff, +#endif #ifndef FIX_280_PLANAR_CP planarCP, #endif @@ -2141,7 +2155,9 @@ static void ivas_decode_arith_bs( const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, +#ifndef FIX_279_CODE_COVERAGE const int16_t freq_diff, +#endif #ifndef FIX_280_PLANAR_CP const int16_t planarCP, #endif @@ -2331,7 +2347,7 @@ static void ivas_decode_arith_bs( planarCP #endif ); - +#ifndef FIX_279_CODE_COVERAGE if ( freq_diff == 1 ) { #ifdef SPAR_HOA_DBG @@ -2342,11 +2358,11 @@ static void ivas_decode_arith_bs( ivas_get_band_idx_from_differential( &hMdDec->spar_md, hMdDec->spar_md_cfg.quant_strat->P_r.q_levels, 1, nB, DECD_COEFF ); ivas_get_band_idx_from_differential( &hMdDec->spar_md, hMdDec->spar_md_cfg.quant_strat->P_c.q_levels, 0, nB, DECX_COEFF ); } - +#endif return; } - +#ifndef FIX_279_CODE_COVERAGE /*-----------------------------------------------------------------------------------------* * Function ivas_get_band_idx_from_differential() * @@ -2430,7 +2446,7 @@ static void ivas_get_band_idx_from_differential( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_fill_band_coeffs_idx() * diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 7cf68d677d..591b37fdbb 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -988,7 +988,7 @@ void ivas_qmetadata_enc_sid_encode( else { #ifdef FIX_QMETA_SID_5k2 - /* TODO: still use old sid frame size to keep bitexactness */ + metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; #else metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; @@ -1231,7 +1231,6 @@ void ivas_qmetadata_enc_sid_encode( } #endif - /* TODO: temporary to keep BE */ if ( ivas_format != SBA_FORMAT ) { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -- GitLab From b24d2290c53096b6a6d224e522905b3170c2266b Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 10:03:15 +0200 Subject: [PATCH 509/591] removed outdated todos in ivas_qmetadata_dec_sid_decode() --- lib_dec/ivas_qmetadata_dec.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index e4c69cd288..25c3d417b4 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1265,7 +1265,7 @@ int16_t ivas_qmetadata_dec_sid_decode( start_index = *index; /* read MASA SID descriptor */ - if ( ivas_format == MASA_FORMAT && nchan_transport == 2 ) /* corresponding to SID_MASA case; Todo: needs to be checked for SBA */ + if ( ivas_format == MASA_FORMAT && nchan_transport == 2 ) { b = bitstream[( *index )--]; if ( b ) @@ -1455,12 +1455,14 @@ int16_t ivas_qmetadata_dec_sid_decode( } } } + +#if !( #defined FIX_137_SID_MD_BITS && #defined FIX_QMETA_SID_5k2 ) /* TODO: temporary hack to keep BE */ if ( ivas_format != SBA_FORMAT ) { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } - +#endif /*Read filling bits*/ while ( start_index - *index < metadata_sid_bits ) { @@ -2372,7 +2374,7 @@ static uint16_t ivas_qmetadata_DecodeQuasiUniform( uint16_t tresh, value; #ifdef DEBUGGING - assert( ( alphabet_size >= 1 ) ); /* ToDo: fcs: to check if this additional conditon is really needed: && (alphabet_size <= (1U << 31) - 1));*/ + assert( ( alphabet_size >= 1 ) ); #endif bits = 30 - norm_l( alphabet_size ); /* bits = floor(log2(alphabet_size)) */ -- GitLab From 6cc20862d4681f98641bd3e1163219d42de16654 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 10:15:54 +0200 Subject: [PATCH 510/591] removed outdated todos in ivas_qmetadata_enc_sid_decode() --- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_enc/ivas_qmetadata_enc.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 25c3d417b4..d1ccc4a321 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1456,7 +1456,7 @@ int16_t ivas_qmetadata_dec_sid_decode( } } -#if !( #defined FIX_137_SID_MD_BITS && #defined FIX_QMETA_SID_5k2 ) +#if !( defined FIX_137_SID_MD_BITS && defined FIX_QMETA_SID_5k2 ) /* TODO: temporary hack to keep BE */ if ( ivas_format != SBA_FORMAT ) { diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 7cf68d677d..b955581d11 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -988,9 +988,9 @@ void ivas_qmetadata_enc_sid_encode( else { #ifdef FIX_QMETA_SID_5k2 - /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; #else + /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; #endif } @@ -1231,12 +1231,13 @@ void ivas_qmetadata_enc_sid_encode( } #endif +#if !( defined FIX_137_SID_MD_BITS && defined FIX_QMETA_SID_5k2 ) /* TODO: temporary to keep BE */ if ( ivas_format != SBA_FORMAT ) { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } - +#endif /* fill bits*/ assert( ( hMetaData->nb_bits_tot - bit_pos_start ) <= metadata_sid_bits && "Too many written bits!" ); while ( ( hMetaData->nb_bits_tot - bit_pos_start ) < metadata_sid_bits ) @@ -2273,7 +2274,7 @@ static void ivas_qmetadata_encode_quasi_uniform( int16_t bits; uint16_t tresh; #ifdef DEBUGGING - assert( ( alphabet_size >= 1 ) ); /* ToDo: fcs: to check if this additional conditon is really needed: && (alphabet_size <= (1U << 31) - 1));*/ + assert( ( alphabet_size >= 1 ) ); assert( value < alphabet_size ); #endif @@ -2512,7 +2513,7 @@ static int16_t ivas_qmetadata_encode_quasi_uniform_length( int16_t bits; uint16_t tresh; #ifdef DEBUGGING - assert( ( alphabet_size >= 1 ) ); /* ToDo: fcs: to check if this additional conditon is really needed: && (alphabet_size <= (1U << 31) - 1));*/ + assert( ( alphabet_size >= 1 ) ); assert( value < alphabet_size ); #endif -- GitLab From fbd4808b251995e801defe0019ce5a885cd71a8f Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Wed, 26 Jul 2023 18:26:19 +1000 Subject: [PATCH 511/591] Add renderer configs and IVAS bitrates to split rendering tests --- tests/split_rendering/constants.py | 41 ++++++++++- ...lit_renderer_config_0dof_256k_default.txt} | 0 ...lit_renderer_config_0dof_320k_default.txt} | 0 ...lit_renderer_config_0dof_384k_default.txt} | 0 ...lit_renderer_config_0dof_512k_default.txt} | 0 ...lit_renderer_config_0dof_768k_default.txt} | 0 ...lit_renderer_config_1dof_512k_default.txt} | 0 ...lit_renderer_config_1dof_768k_default.txt} | 0 ...lit_renderer_config_2dof_512k_default.txt} | 0 ...lit_renderer_config_2dof_768k_default.txt} | 0 ...plit_renderer_config_3dof_384k_lc3plus.txt | 5 ++ .../split_renderer_config_3dof_384k_lcld.txt | 5 ++ ...lit_renderer_config_3dof_512k_default.txt} | 0 ...lit_renderer_config_3dof_768k_default.txt} | 0 ...plit_renderer_config_3dof_768k_lc3plus.txt | 5 ++ .../split_renderer_config_3dof_768k_lcld.txt | 5 ++ ...t_renderer_config_3dofhq_512k_default.txt} | 0 ...it_renderer_config_3dofhq_512k_lc3plus.txt | 5 ++ ...split_renderer_config_3dofhq_512k_lcld.txt | 5 ++ ...t_renderer_config_3dofhq_768k_default.txt} | 0 ...it_renderer_config_3dofhq_768k_lc3plus.txt | 5 ++ ...split_renderer_config_3dofhq_768k_lcld.txt | 5 ++ tests/split_rendering/test_split_rendering.py | 71 ++++++++++-------- .../test_split_rendering_be_comparison.py | 72 +++++++++++-------- tests/split_rendering/utils.py | 26 +++++-- 25 files changed, 188 insertions(+), 62 deletions(-) rename tests/split_rendering/renderer_configs/{split_renderer_config_0dof_256k.txt => split_renderer_config_0dof_256k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_0dof_320k.txt => split_renderer_config_0dof_320k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_0dof_384k.txt => split_renderer_config_0dof_384k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_0dof_512k.txt => split_renderer_config_0dof_512k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_0dof_768k.txt => split_renderer_config_0dof_768k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_1dof_512k.txt => split_renderer_config_1dof_512k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_1dof_768k.txt => split_renderer_config_1dof_768k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_2dof_512k.txt => split_renderer_config_2dof_512k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_2dof_768k.txt => split_renderer_config_2dof_768k_default.txt} (100%) create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lc3plus.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lcld.txt rename tests/split_rendering/renderer_configs/{split_renderer_config_3dof_512k.txt => split_renderer_config_3dof_512k_default.txt} (100%) rename tests/split_rendering/renderer_configs/{split_renderer_config_3dof_768k.txt => split_renderer_config_3dof_768k_default.txt} (100%) create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lc3plus.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lcld.txt rename tests/split_rendering/renderer_configs/{split_renderer_config_3dofhq_512k.txt => split_renderer_config_3dofhq_512k_default.txt} (100%) create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lc3plus.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lcld.txt rename tests/split_rendering/renderer_configs/{split_renderer_config_3dofhq_768k.txt => split_renderer_config_3dofhq_768k_default.txt} (100%) create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lc3plus.txt create mode 100644 tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lcld.txt diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index aa9e367220..e50d916cf6 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -57,7 +57,14 @@ from tests.renderer.constants import ( ) """ Renderer configurations """ -RENDERER_CONFIGS_TO_TEST = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*.txt")] +RENDERER_CONFIGS_DEFAULT_CODEC = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_default.txt")] +RENDERER_CONFIGS_LCLD_CODEC = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_lcld.txt")] +RENDERER_CONFIGS_LC3PLUS_CODEC = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_lc3plus.txt")] + +RENDERER_CONFIGS_TO_TEST_AMBI = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LC3PLUS_CODEC +RENDERER_CONFIGS_TO_TEST_MC = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LCLD_CODEC +RENDERER_CONFIGS_TO_TEST_ISM = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LCLD_CODEC +RENDERER_CONFIGS_TO_TEST_MASA = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LC3PLUS_CODEC """ IVAS specific constants """ FORMAT_TO_IVAS_COD_FORMAT = { @@ -75,8 +82,36 @@ FORMAT_TO_IVAS_COD_FORMAT = { "FOA": ["-sba", "1"], "HOA2": ["-sba", "2"], "HOA3": ["-sba", "3"], + # "MASA1": ["-masa", "1"], + # "MASA2": ["-masa", "2"], +} + +FORMAT_TO_NCHAN = { + "MONO": 1, + "STEREO": 2, + "ISM1": 1, + "ISM2": 2, + "ISM3": 3, + "ISM4": 4, + "5_1": 6, + "5_1_2": 8, + "5_1_4": 10, + "7_1": 8, + "7_1_4": 12, + "FOA": 4, + "HOA2": 9, + "HOA3": 16, + # "MASA1": 1, + # "MASA2": 2, } +IVAS_BITRATES_AMBI = ["96000", "512000"] +IVAS_BITRATES_MC = ["128000", "384000"] +# TODO: Enable after MC 160kbps split rendering support +# IVAS_BITRATES_MC = ["128000", "160000", "384000"] +IVAS_BITRATES_ISM = ["128000"] +# IVAS_BITRATES_MASA = ["128000"] + IVAS_MAX_ISM_BITRATE = { "1": "128000", "2": "256000", @@ -84,10 +119,12 @@ IVAS_MAX_ISM_BITRATE = { "4": "512000", } +INPUT_DURATION_SEC = 5 + """ Encoder commandline template """ SPLIT_PRE_COD_CMD = [ str(TESTS_DIR.parent.parent.joinpath("IVAS_cod")), - "512000", + "", # 1 -> bitrate "48", "", # 3 -> input file "", # 4 -> output bitstream diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_0dof_256k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_0dof_320k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_0dof_384k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_0dof_512k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_0dof_768k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_1dof_512k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_1dof_768k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_2dof_512k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_2dof_768k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lc3plus.txt new file mode 100644 index 0000000000..2a726e8470 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lc3plus.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 0; +CODEC = LC3PLUS; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lcld.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lcld.txt new file mode 100644 index 0000000000..c2172074d4 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_384k_lcld.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 384000; +DOF = 3; +HQMODE = 0; +CODEC = LCLD; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_3dof_512k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lc3plus.txt new file mode 100644 index 0000000000..0caa653c0d --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lc3plus.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 3; +HQMODE = 0; +CODEC = LC3PLUS; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lcld.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lcld.txt new file mode 100644 index 0000000000..825543d57f --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_lcld.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 3; +HQMODE = 0; +CODEC = LCLD; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lc3plus.txt new file mode 100644 index 0000000000..378cca9c25 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lc3plus.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 3; +HQMODE = 1; +CODEC = LC3PLUS; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lcld.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lcld.txt new file mode 100644 index 0000000000..226600ab06 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_512k_lcld.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 512000; +DOF = 3; +HQMODE = 1; +CODEC = LCLD; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_default.txt similarity index 100% rename from tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k.txt rename to tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_default.txt diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lc3plus.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lc3plus.txt new file mode 100644 index 0000000000..d9df2f2254 --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lc3plus.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 3; +HQMODE = 1; +CODEC = LC3PLUS; diff --git a/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lcld.txt b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lcld.txt new file mode 100644 index 0000000000..e8f2ff8acb --- /dev/null +++ b/tests/split_rendering/renderer_configs/split_renderer_config_3dofhq_768k_lcld.txt @@ -0,0 +1,5 @@ +[SPLITREND] +BITRATE = 768000; +DOF = 3; +HQMODE = 1; +CODEC = LCLD; diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 76f114b689..42419a6df4 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -34,17 +34,19 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) -def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): - if in_fmt != "HOA3": - pytest.xfail("Split Rendering currently only supported with HOA3") +def test_ambisonics_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_lc3plus" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") run_full_chain_split_rendering( in_fmt=in_fmt, + bitrate=bitrate, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, @@ -53,11 +55,11 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): - if in_fmt != "HOA3": - pytest.xfail("Split Rendering currently only supported with HOA3") + if "0dof_768k_lc3plus" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -75,17 +77,19 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) -def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") +def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") run_full_chain_split_rendering( in_fmt=in_fmt, + bitrate=bitrate, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, @@ -94,11 +98,11 @@ def test_multichannel_full_chain_split(test_info, in_fmt, render_config, traject @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -116,17 +120,21 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) -def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") +def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + elif int(bitrate) > int(IVAS_MAX_ISM_BITRATE[in_fmt[-1]]): + pytest.skip(f"Unsupported configuration with {in_fmt} at {bitrate}bps") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") run_full_chain_split_rendering( in_fmt=in_fmt, + bitrate=bitrate, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, @@ -135,11 +143,11 @@ def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -158,28 +166,35 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): # @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) +# @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) # @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) -# def test_masa_full_chain_split(test_info, in_fmt, render_config, trajectory): +# def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): +# if "0dof_768k_lc3plus" in render_config: +# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + # post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") # pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") -# + # run_full_chain_split_rendering( # in_fmt=in_fmt, +# bitrate=bitrate, # render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), # pre_trajectory=pre_trajectory, # post_trajectory=post_trajectory, # output_path_base=OUTPUT_PATH_CUT, # ) -# -# + # @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) # @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) # def test_masa_external_split(test_info, in_fmt, render_config, trajectory): +# if "0dof_768k_lc3plus" in render_config: +# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + # post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") # pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") -# + # run_external_split_rendering( # in_fmt=in_fmt, # render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py index 5f0d07b23a..70ee753af2 100644 --- a/tests/split_rendering/test_split_rendering_be_comparison.py +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -34,11 +34,12 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) -def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajectory): - if in_fmt != "HOA3": - pytest.xfail("Split Rendering currently only supported with HOA3") +def test_ambisonics_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_lc3plus" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -46,6 +47,7 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector compare_full_chain_split_args( test_info, in_fmt=in_fmt, + bitrate=bitrate, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, @@ -53,11 +55,11 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): - if in_fmt != "HOA3": - pytest.xfail("Split Rendering currently only supported with HOA3") + if "0dof_768k_lc3plus" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -75,11 +77,12 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) -def test_multichannel_full_chain_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") +def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -87,6 +90,7 @@ def test_multichannel_full_chain_split(test_info, in_fmt, render_config, traject compare_full_chain_split_args( test_info, in_fmt=in_fmt, + bitrate=bitrate, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, @@ -94,11 +98,11 @@ def test_multichannel_full_chain_split(test_info, in_fmt, render_config, traject @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -116,11 +120,14 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) -def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") +def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + elif int(bitrate) > int(IVAS_MAX_ISM_BITRATE[in_fmt[-1]]): + pytest.skip(f"Unsupported configuration with {in_fmt} at {bitrate}bps") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -128,6 +135,7 @@ def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): compare_full_chain_split_args( test_info, in_fmt=in_fmt, + bitrate=bitrate, render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), pre_trajectory=pre_trajectory, post_trajectory=post_trajectory, @@ -135,11 +143,11 @@ def test_ism_full_chain_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): - if "768k" in render_config: - pytest.xfail("Unsupported bitrate for LC3plus") + if "0dof_768k_default" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -158,28 +166,36 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): # @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) +# @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) # @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) -# def test_masa_full_chain_split(test_info, in_fmt, render_config, trajectory): +# def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): +# if "0dof_768k_lc3plus" in render_config: +# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + # post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") # pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") -# + # compare_full_chain_split_args( # test_info, # in_fmt=in_fmt, +# bitrate=bitrate, # render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), # pre_trajectory=pre_trajectory, # post_trajectory=post_trajectory, # ) -# -# + + # @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST) +# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) # @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) # def test_masa_external_split(test_info, in_fmt, render_config, trajectory): +# if "0dof_768k_lc3plus" in render_config: +# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + # post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") # pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") -# + # compare_external_split_args( # test_info, # in_fmt=in_fmt, diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 6215b3e8a1..21fe2304ba 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -27,12 +27,15 @@ """ import sys +import numpy as np from pathlib import Path from tempfile import TemporaryDirectory +from typing import Tuple from tests.split_rendering.constants import * from tests.renderer.utils import check_BE, run_cmd, test_info +from tests.cut_pcm import cut_samples sys.path.append(SCRIPTS_DIR) from pyaudio3dtools.audiofile import readfile @@ -40,23 +43,25 @@ from pyaudio3dtools.audiofile import readfile def run_full_chain_split_rendering( in_fmt: str, + bitrate: str, render_config: Path, pre_trajectory: Path, post_trajectory: Path, output_path_base: Path, binary_suffix: str = "", is_comparetest: bool = False, -) -> Path: +) -> Tuple[np.ndarray, int]: """ Runs the full split rendering chain consisting of the IVAS encoder, decoder and split renderer """ with TemporaryDirectory() as tmp_dir: tmp_dir = Path(tmp_dir) + cut_in_file = tmp_dir.joinpath("cut_input.wav") ivas_bitstream = tmp_dir.joinpath("ivas.192") split_bitstream = tmp_dir.joinpath("split.bit") out_file = output_path_base.joinpath( - f"{in_fmt}_{pre_trajectory.stem}_split_full_{post_trajectory.stem}__config_{render_config.stem}.wav" + f"{in_fmt}_{bitrate}bps_{pre_trajectory.stem}_split_full_{post_trajectory.stem}__config_{render_config.stem}.wav" ) # check for metadata files @@ -69,8 +74,21 @@ def run_full_chain_split_rendering( cmd = SPLIT_PRE_COD_CMD[:] cmd[0] += binary_suffix + cmd[1] = bitrate if is_comparetest: - cmd[3] = str(FORMAT_TO_FILE_COMPARETEST[in_fmt]) + # Cut input if longer than INPUT_DURATION_SEC + in_file = FORMAT_TO_FILE_COMPARETEST[in_fmt] + in_data, in_fs = readfile(in_file) + if len(in_data) > INPUT_DURATION_SEC * in_fs: + cut_samples(in_file=in_file, + out_file=cut_in_file, + num_channels=FORMAT_TO_NCHAN[in_fmt], + sample_rate=in_fs, + start=0, + duration=INPUT_DURATION_SEC) + cmd[3] = str(cut_in_file) + else: + cmd[3] = str(in_file) else: cmd[3] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt]) cmd[4] = str(ivas_bitstream) @@ -118,7 +136,7 @@ def run_external_split_rendering( output_path_base: Path, binary_suffix: str = "", is_comparetest: bool = False, -) -> Path: +) -> Tuple[np.ndarray, int]: """ Runs the exeternal split rendering chain consisting of the IVAS renderer in split-pre and split-post rendering mode -- GitLab From d8ae2b06de36eaa74b7b65627dc9f2aeba04d170 Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 26 Jul 2023 14:51:37 +0200 Subject: [PATCH 512/591] don't compare bitstreams when creating references --- tests/codec_be_on_mr_selection/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/codec_be_on_mr_selection/__init__.py b/tests/codec_be_on_mr_selection/__init__.py index b7f4cd8efe..da1d8c3578 100644 --- a/tests/codec_be_on_mr_selection/__init__.py +++ b/tests/codec_be_on_mr_selection/__init__.py @@ -161,8 +161,9 @@ def run_check( add_option_list=options + [str(f) for f in metadata], ) - if not is_be_to_ref(dut_bitstream): - pytest.fail(f"Bitstream file differs from reference") + if not is_ref_creation: + if not is_be_to_ref(dut_bitstream): + pytest.fail(f"Bitstream file differs from reference") dut_bitstream_to_decoder = dut_bitstream if error_pattern is not None: -- GitLab From ad98bf5a8669fac4cf06434d8c1b347f28ccc460 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 26 Jul 2023 15:25:14 +0200 Subject: [PATCH 513/591] remove re-introduced/dupliacted switches --- lib_com/options.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c2bc0b866b..ba42ad211f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,10 +159,6 @@ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ -#define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ -#define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ -#define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_488_SYNC_DELAY /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */ @@ -170,14 +166,6 @@ #define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ #define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ -#define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ - -#define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ - -#define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ -#define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ -#define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ - #define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ #define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ #define FIX_570_SF_EXT_ORIENTATION -- GitLab From ce7069c6fa31a88de97c55fa0a894457ff5d7f7f Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 26 Jul 2023 16:42:04 +0200 Subject: [PATCH 514/591] fix DirAC refactoring merge issues in OMASA branch. fix memory leak in separate object renderer. --- lib_com/bitstream.c | 4 + lib_com/ivas_ism_com.c | 5 + lib_com/ivas_prot.h | 283 +- lib_com/options.h | 3 + lib_dec/ivas_cpe_dec.c | 2 +- lib_dec/ivas_dec.c | 10 +- lib_dec/ivas_dirac_dec.c | 5105 ++++++----------- lib_dec/ivas_init_dec.c | 154 +- lib_dec/ivas_ism_dec.c | 26 +- lib_dec/ivas_ism_param_dec.c | 278 +- lib_dec/ivas_ism_renderer.c | 53 +- lib_dec/ivas_jbm_dec.c | 6 +- lib_dec/ivas_masa_dec.c | 88 +- lib_dec/ivas_mcmasa_dec.c | 48 +- lib_dec/ivas_mct_dec.c | 71 +- lib_dec/ivas_omasa_dec.c | 25 +- lib_dec/ivas_sba_dec.c | 63 +- lib_dec/ivas_spar_decoder.c | 12 +- lib_dec/ivas_spar_md_dec.c | 29 +- lib_dec/ivas_stat_dec.h | 397 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 736 ++- {lib_dec => lib_rend}/ivas_dirac_decorr_dec.c | 2 +- {lib_dec => lib_rend}/ivas_dirac_onsets_dec.c | 1 + .../ivas_dirac_output_synthesis_dec.c | 613 +- lib_rend/ivas_dirac_rend.c | 2061 +++++++ lib_rend/ivas_prot_rend.h | 325 +- lib_rend/ivas_stat_rend.h | 370 +- lib_rend/lib_rend.c | 61 +- 28 files changed, 5744 insertions(+), 5087 deletions(-) rename {lib_dec => lib_rend}/ivas_dirac_decorr_dec.c (99%) rename {lib_dec => lib_rend}/ivas_dirac_onsets_dec.c (99%) rename {lib_dec => lib_rend}/ivas_dirac_output_synthesis_dec.c (79%) create mode 100644 lib_rend/ivas_dirac_rend.c diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index fb27e89e00..6b5ea4d6e7 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -553,7 +553,11 @@ int16_t get_ivas_max_num_indices( } else if ( ivas_total_brate <= IVAS_160k ) { +#ifdef OMASA_BIT_BUFF_SZ1 + return 900; +#else return 850; +#endif } else if ( ivas_total_brate <= IVAS_192k ) { diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 1c25269f6b..46ca2e5c27 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -366,7 +366,12 @@ ivas_error ivas_ism_config( #ifdef FIX_562_ISM2_64KBPS /* limitation to avoid too high bitrate in one active TCX channel */ +#ifdef FIX_ISM2_64KBPS_COMBINED_FORMAT + /* Todo: the alternative is to make sure there are less than n_ism -1 objects inactive; but this way is simpler (Todo VE to check )*/ + if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k && combined_format_flag == 0 ) +#else if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k ) +#endif { diff = 0; limit_high = MAX_BRATE_TCX_32k / FRAMES_PER_SEC; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 63395cccd7..e7d52e0a9f 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -789,8 +789,8 @@ ivas_error ivas_jbm_dec_flush_renderer( ivas_error 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*/ + 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*/ float *data /* i/o: transport channels/output synthesis signal */ ); @@ -1074,6 +1074,7 @@ ivas_error ivas_param_ism_dec_open( void ivas_param_ism_dec_close( DIRAC_DEC_HANDLE *hDirAC, /* i/o: decoder DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ const AUDIO_CONFIG output_config /* i : output audio configuration */ ); @@ -1088,8 +1089,8 @@ void ivas_ism_dec_digest_tc( void ivas_param_ism_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); void ivas_param_ism_dec_render( @@ -3215,8 +3216,9 @@ int16_t ivas_qmetadata_dec_sid_decode( void ivas_qmetadata_to_dirac( const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -3544,7 +3546,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ ); void ivas_sba2mc_cldfb( @@ -3580,12 +3582,12 @@ void ivas_dirac_enc( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ float data_f[][L_FRAME48k], /* 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 */ - int16_t hodirac_flag /* i : hodirac flag */ + 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 */ + int16_t hodirac_flag /* i : hodirac flag */ ); ivas_error ivas_dirac_config( void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ @@ -3618,33 +3620,20 @@ ivas_error ivas_dirac_sba_config( const int16_t nbands /* i : number of frequency bands */ ); -ivas_error ivas_dirac_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -ivas_error ivas_dirac_allocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - const int16_t params_flag /* i : set of parameters flag */ -); - ivas_error ivas_dirac_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_configopen /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ ); void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE *hDirAC /* i/o: decoder DirAC handle */ -); - -void ivas_dirac_deallocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - const int16_t params_flag /* i : set of parameters flag */ + DIRAC_DEC_HANDLE *hDirAC_out ); void ivas_dirac_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder Core state structure */ DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ @@ -3695,12 +3684,6 @@ ivas_error ivas_td_decorr_reconfig_dec( uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ ); -/*! r: Configured reqularization factor value */ -float configure_reqularization_factor( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int32_t ivas_total_brate /* i : total IVAS bitrate */ -); - void computeDiffuseness_mdft( float **buffer_intensity[DIRAC_NUM_DIMS], const float *buffer_energy, @@ -3727,109 +3710,6 @@ void computeDiffuseness( float *diffuseness ); -ivas_error ivas_dirac_dec_onset_detection_open( - const int16_t num_channels, - const int16_t num_freq_bands, - const int16_t max_band_decorr, - DIRAC_ONSET_DETECTION_PARAMS *ph_dirac_onset_detection_params, - DIRAC_ONSET_DETECTION_STATE *ph_dirac_onset_detection_state -); - -void ivas_dirac_dec_onset_detection_process( - const float *input_power_f, - float *onset_filter, - const int16_t num_protos_diff, - DIRAC_ONSET_DETECTION_PARAMS h_dirac_onset_detection_params, - DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state -); - -ivas_error ivas_dirac_dec_decorr_open( - DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, - DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, - const int16_t num_freq_bands, - int16_t num_outputs_diff, - const int16_t num_protos_diff, - const DIRAC_SYNTHESIS_CONFIG synthesisConf, - float *frequency_axis, - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs /* i : output sampling rate */ -); - -void ivas_dirac_dec_decorr_process( - const int16_t num_freq_bands, - int16_t num_channels, - const int16_t num_protos_diff, - const DIRAC_SYNTHESIS_CONFIG synthesisConf, - const int16_t nchan_transport, /* i : number of transport channels */ - const float *input_frame_f, - const int16_t num_protos_dir, - const int16_t *proto_index_dir, - float *frame_dec_f, - float *onset_filter, - HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params, - HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state -); - -void ivas_dirac_dec_decorr_close( - HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params, - HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state -); - -ivas_error ivas_dirac_dec_output_synthesis_open( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const RENDERER_TYPE renderer_type, /* i : renderer type */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs /* i : output sampling rate */ - , - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_init( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: DirAC handle */ -); - -void ivas_dirac_dec_output_synthesis_process_slot( - const float *reference_power, /* i : Estimated power */ - const float *onset, /* i : onset filter */ - const int16_t *azimuth, - const int16_t *elevation, - const float *diffuseness, - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t sh_rot_max_order, - const float *p_Rmat, /* i : rotation matrix */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nbslots, /* i : number of slots to process */ - const float *onset_filter, - float *diffuseness, - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nbslots, /* i : number of slots to process */ - float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ - float *reference_power_smooth, - float qualityBasedSmFactor -); void ivas_dirac_dec_get_response( const int16_t azimuth, @@ -3838,99 +3718,54 @@ void ivas_dirac_dec_get_response( const int16_t ambisonics_order ); -void compute_hoa_encoder_mtx( - const float *azimuth, - const float *elevation, - float *response, - const int16_t num_responses, - const int16_t ambisonics_order ); - -void ivas_dirac_dec_compute_gain_factors( - const int16_t num_freq_bands, - const float *diffuseness, - const int16_t max_band_decorr, - float *direct_gain_factor, - float *diffuse_gain_factor -); - -void ivas_dirac_dec_compute_power_factors( - const int16_t num_freq_bands, - const float *diffuseness, - const int16_t max_band_decorr, - float *direct_power_factor, - float *diffuse_power_factor -); - -void ivas_dirac_dec_compute_directional_responses( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ -#ifdef MASA_AND_OBJECTS - MASA_ISM_DATA_HANDLE hMasaIsm, /* i : MASA_ISM data structure */ -#endif - const int16_t *azimuth, - const int16_t *elevation, - const int16_t md_idx, - const float *surCohRatio, - const int16_t shd_rot_max_order, /* i : split-order rotation method */ - const float *p_Rmat, /* i : rotation matrix */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -); - -void ivas_dirac_dec_get_frequency_axis( - float *frequency_axis, /* o : array of center frequencies of a real filter bank */ - const int32_t output_Fs, /* i : sampling frequency */ - const int16_t num_freq_bands /* i : number of frequency bands */ -); - void calculate_hodirac_sector_parameters( - DIRAC_ENC_HANDLE hDirAC, - float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ - float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ - const float beta, /* i : forgetting factor for average filtering */ - const int16_t *band_grouping, /* i : indices of band groups */ - const int16_t N_bands, /* i : number of bands (groups) */ - const int16_t enc_param_start_band, /* i : first band to process */ - float *azi, /* o : array of sector azimuth angles, flat */ - float *ele, /* o : array of sector elevation angles, flat */ - float *diff, /* o : array of sector diffuseness values, flat */ - float *ene /* o : array of sector energy values, flat */ + DIRAC_ENC_HANDLE hDirAC, + float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ + float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ + const float beta, /* i : forgetting factor for average filtering */ + const int16_t *band_grouping, /* i : indices of band groups */ + const int16_t N_bands, /* i : number of bands (groups) */ + const int16_t enc_param_start_band, /* i : first band to process */ + float *azi, /* o : array of sector azimuth angles, flat */ + float *ele, /* o : array of sector elevation angles, flat */ + float *diff, /* o : array of sector diffuseness values, flat */ + float *ene /* o : array of sector energy values, flat */ ); void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ float data_f[][L_FRAME48k], /* i/o: input: MC data */ - const int16_t input_frame /* i : input frame length */ + const int16_t input_frame /* i : input frame length */ ); ivas_error ivas_mc_paramupmix_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mc_paramupmix_enc_close( - MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ const int32_t input_Fs /* i : input sampling rate */ ); void ivas_mc_paramupmix_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); ivas_error ivas_mc_paramupmix_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_mc_paramupmix_dec_close( - MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ ); void ivas_mc_paramupmix_dec_read_BS( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Decoder_State *st, /* i/o: decoder state structure */ - MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ - int16_t *nb_bits /* o : number of bits written */ + Decoder_State *st, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ ); #ifdef JBM_PARAMUPMIX @@ -4019,7 +3854,7 @@ void ivas_param_mc_dec_read_BS( void ivas_param_mc_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 uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output*/ ); @@ -4669,7 +4504,7 @@ void ivas_spar_to_dirac( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t bw /* i : band joining factor */ + const int16_t bw /* i : band joining factor */ ); void ivas_spar_update_md_hist( @@ -4679,13 +4514,13 @@ void ivas_spar_update_md_hist( void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_setup_md_smoothing( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_dec_gen_umx_mat( @@ -4763,7 +4598,7 @@ void ivas_transient_det_close( void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len, /* i : frame length in samples */ + const int16_t frame_len, /* i : frame length in samples */ int16_t transient_det[2] /* o : transient det outputs */ ); @@ -4954,14 +4789,14 @@ void ivas_spar_arith_coeffs_com_init( ); int16_t ivas_arith_encode_cmplx_cell_array( - ivas_arith_t *pArith_re, - ivas_arith_t *pArith_re_diff, - const int16_t *pDo_diff, - const int16_t nB, - int16_t *pSymbol_re, - int16_t *pSymbol_old_re, - ivas_cell_dim_t *pCell_dims, - BSTR_ENC_HANDLE hMetaData, + ivas_arith_t *pArith_re, + ivas_arith_t *pArith_re_diff, + const int16_t *pDo_diff, + const int16_t nB, + int16_t *pSymbol_re, + int16_t *pSymbol_old_re, + ivas_cell_dim_t *pCell_dims, + BSTR_ENC_HANDLE hMetaData, const int16_t any_diff , const int16_t wc_strat_arith ); @@ -5114,7 +4949,7 @@ ivas_error ivas_masa_enc_open( ); void ivas_masa_enc_close( - MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); void ivas_masa_enc_reconfigure( @@ -5159,7 +4994,7 @@ ivas_error ivas_masa_enc_config( ); void ivas_masa_set_elements( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int32_t ivas_total_brate, /* i : codec total bitrate */ const int16_t mc_mode, /* i : MC format mode */ const int16_t nchan_transport, /* i : number of MASA input/transport channels */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -5261,7 +5096,7 @@ void ivas_get_stereo_panning_gains( void ivas_masa_set_coding_config( MASA_CODEC_CONFIG* config, /* i/o: MASA coding config structure */ int16_t* band_mapping, /* o : Band mapping used */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int32_t ivas_total_brate, /* i : codec total bitrate */ const int16_t nchan_transport, /* i : number of transport channel (mono/stereo) */ const uint8_t isMcMasa /* i : toggle for selecting McMASA specific config */ ); @@ -5599,7 +5434,7 @@ void ivas_mcmasa_set_separate_channel_mode( void ivas_mcmasa_split_brate( const uint8_t separateChannelEnabled, /* i : Transport running in "separate channel" mode */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate available to be split */ + const int32_t ivas_total_brate, /* i : Total bitrate available to be split */ const int16_t nSCE, /* i : Number of SCEs in use (0 or 1) */ const int16_t nCPE, /* i : Number of CPEs in use (0 or 1) */ int32_t *brate_sce, /* o : Pointer to SCE element bitrate */ @@ -5930,6 +5765,12 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ ); +#ifdef OMASA_OBJ_REND_CLOSE +ivas_error ivas_masa_ism_separate_object_renderer_close( + Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ +); +#endif + void ivas_masa_ism_separate_object_render( Decoder_Struct* st_ivas, /* i/o: IVAS decoder structure */ float input_f[][L_FRAME48k], /* i : separated object signal */ diff --git a/lib_com/options.h b/lib_com/options.h index 1b47d0dd5c..34396208ee 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -220,6 +220,9 @@ #define OMASA_FIX_LOW_FS /* Nokia: fixes related to lower input signal sampling rates */ #define OMASA_BIT_BUFF_SZ /* Nokia: increase bitstream index buffer initial size */ #define OMASA_EXT_OUTPUT /* VA: support of EXT output configuration for OMASA DISC mode */ +#define OMASA_BIT_BUFF_SZ1 /* Nokia: increase bitstream index buffer initial size */ +#define FIX_ISM2_64KBPS_COMBINED_FORMAT /* Nokia: Making the fix_562 work with combined format */ +#define OMASA_OBJ_REND_CLOSE /* Nokia: close OMASA separate object renderer */ #endif /* #################### Start NON-BE CR switches ########################## */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 365101b8bf..96542eb104 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -691,7 +691,7 @@ ivas_error create_cpe_dec( } #ifdef MASA_AND_OBJECTS - if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { cpe_brate = element_brate; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index facefc96cd..10e1aac313 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -452,7 +452,7 @@ ivas_error ivas_dec( { #ifdef FIX_564 /* loudness correction */ - ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame ); + ivas_dirac_dec_binaural_sba_gain( output, nchan_remapped, output_frame ); #else float gain; @@ -508,15 +508,15 @@ ivas_error ivas_dec( /* Set the number of objects for the parametric rendering */ dirac_bs_md_write_idx = 0; - if ( st_ivas->hDirAC != NULL ) + if ( st_ivas->hDirAC != NULL ) /* TODO: should this check for st_ivas->hSpatParamRendCom != NULL ? */ { - st_ivas->hDirAC->numIsmDirections = 0; + st_ivas->hSpatParamRendCom->numIsmDirections = 0; if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { - st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; + st_ivas->hSpatParamRendCom->numIsmDirections = st_ivas->nchan_ism; } - dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ + dirac_bs_md_write_idx = st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx; /* Store the write-index for this frame */ } /* MASA metadata decoding */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ef2ec470a2..ed17e9f090 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -51,206 +51,69 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, const int16_t hodirac_flag ); - -static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); - -static void initDiffuseResponses( float *diffuse_response_function, const int16_t num_channels, AUDIO_CONFIG output_config, IVAS_OUTPUT_SETUP hOutSetup, const int16_t ambisonics_order, const IVAS_FORMAT ivas_format, int16_t *num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG transport_config ); - -static void computeIntensityVector_dec( float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float *intensity_real_x, float *intensity_real_y, float *intensity_real_z ); - -static void protoSignalComputation_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_direct_buffer_f, float *proto_diffuse_buffer_f, float *reference_power, const int16_t slot_index, const int16_t num_inputs, const int16_t num_outputs_diff, const int16_t num_freq_bands, float *p_Rmat ); - -static void protoSignalComputation1( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands ); - -static void protoSignalComputation2( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t isloudspeaker, const int16_t slot_index, const int16_t num_freq_bands, MASA_STEREO_TYPE_DETECT *stereo_type_detect ); - -static void protoSignalComputation4( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands, const float *mtx_hoa_decoder, const int16_t nchan_transport, const int16_t *sba_map_tc_ind ); - -static void ivas_dirac_dec_compute_diffuse_proto( DIRAC_DEC_HANDLE hDirAC, const int16_t slot_idx ); - -static void computeDirectionAngles( float *intensity_real_x, float *intensity_real_y, float *intensity_real_z, const int16_t num_frequency_bands, int16_t *azimuth, int16_t *elevation ); - -static void ivas_masa_init_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type_detect ); - -static void ivas_masa_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type_detect ); - -static void ivas_lfe_synth_with_cldfb( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t slot_index, const int16_t subframe_index, const int16_t nchan_transport ); - -static void rotateAziEle_DirAC( int16_t *azi, int16_t *ele, const int16_t band1, const int16_t band2, const float *p_Rmat ); - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_open() - * - * Open decoder DirAC handle - *-------------------------------------------------------------------------*/ - -ivas_error ivas_dirac_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +static ivas_error ivas_dirac_dec_config_internal( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ ) { + DIRAC_DEC_HANDLE hDirAC; ivas_error error; + DIRAC_CONFIG_FLAG flag_config; + flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; error = IVAS_ERR_OK; - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) - { - return error; - } - - return error; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_allocate_parameters() - * - * Allocate and initialize DirAC parameters - *-------------------------------------------------------------------------*/ - -ivas_error ivas_dirac_allocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - const int16_t params_flag /* i : set of parameters flag */ -) -{ - int16_t i; + hDirAC = NULL; - if ( params_flag == 1 ) + if ( flag_config == DIRAC_RECONFIGURE ) { - if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) - { - if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); - - if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); - - if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); - - if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); - - if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); - - if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); - } + hDirAC = st_ivas->hDirAC; } - else if ( params_flag == 2 ) + else if ( flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ - if ( ( hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + if ( ( hDirAC = (DIRAC_DEC_HANDLE) malloc( sizeof( DIRAC_DEC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + if ( ( hDirAC->hConfig = (DIRAC_CONFIG_DATA_HANDLE) malloc( sizeof( DIRAC_CONFIG_DATA ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); } - if ( ( hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } + hDirAC->hParamIsm = NULL; + hDirAC->hParamIsmRendering = NULL; + st_ivas->hDirAC = hDirAC; + } - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) - { - if ( ( hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); - if ( ( hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); + /*-----------------------------------------------------------------* + * DirAC main configuration + *-----------------------------------------------------------------*/ - if ( ( hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); + if ( ( error = ivas_dirac_config( (void *) st_ivas, DEC ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); - } + if ( flag_config == DIRAC_OPEN ) + { + hDirAC->spar_to_dirac_write_idx = st_ivas->ivas_format == SBA_FORMAT ? DELAY_DIRAC_PARAM_DEC_SFR : 0; + hDirAC->dithering_seed = DIRAC_DITH_SEED; + st_ivas->hDirAC = hDirAC; } - return IVAS_ERR_OK; + return error; } - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_config() - * - * Open or reconfigure decoder DirAC/MASA handle - *-------------------------------------------------------------------------*/ - -ivas_error ivas_dirac_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ -) +static ivas_error ivas_dirac_rend_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const int16_t dec_param_estim_old ) { DIRAC_DEC_HANDLE hDirAC; int16_t nchan_out_woLFE; @@ -262,27 +125,30 @@ ivas_error ivas_dirac_dec_config( float *proto_frame_f_old; int16_t proto_signal_decorr_on_old; uint16_t i, j, k; - int16_t dec_param_estim_old; float ls_azimuth[MAX_OUTPUT_CHANNELS]; float ls_elevation[MAX_OUTPUT_CHANNELS]; int32_t output_Fs, ivas_total_brate; ivas_error error; int16_t nchan_transport_orig; int16_t hodirac_flag; - int16_t map_idx; DIRAC_CONFIG_FLAG flag_config; + DIRAC_REND_HANDLE hDirACRend; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; error = IVAS_ERR_OK; - hDirAC = NULL; + hDirACRend = NULL; output_Fs = st_ivas->hDecoderConfig->output_Fs; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); + hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + if ( flag_config == DIRAC_RECONFIGURE ) { - hDirAC = st_ivas->hDirAC; + hDirACRend = st_ivas->hDirACRend; } else if ( flag_config == DIRAC_OPEN ) { @@ -290,29 +156,21 @@ ivas_error ivas_dirac_dec_config( * prepare library opening *-----------------------------------------------------------------*/ - if ( ( hDirAC = (DIRAC_DEC_HANDLE) malloc( sizeof( DIRAC_DEC_DATA ) ) ) == NULL ) + if ( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC renderer\n" ) ); } - if ( ( hDirAC->hConfig = (DIRAC_CONFIG_DATA_HANDLE) malloc( sizeof( DIRAC_CONFIG_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); - } nchan_transport_old = 0; - hDirAC->hParamIsm = NULL; - hDirAC->hParamIsmRendering = NULL; - st_ivas->hDirAC = hDirAC; } - dec_param_estim_old = ( flag_config == DIRAC_RECONFIGURE ) ? hDirAC->hConfig->dec_param_estim : FALSE; nchan_transport_old = 0; num_outputs_dir_old = 0; num_outputs_diff_old = 0; num_protos_diff_old = 0; nchan_transport_orig = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == SBA_FORMAT && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + if ( st_ivas->ivas_format == SBA_FORMAT ) { st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); } @@ -329,58 +187,40 @@ ivas_error ivas_dirac_dec_config( ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport_old, st_ivas->sba_planar, &tmp1, &tmp2, &tmp3 ); } - /*-----------------------------------------------------------------* - * DirAC main configuration - *-----------------------------------------------------------------*/ - - if ( ( error = ivas_dirac_config( (void *) st_ivas, DEC ) ) != IVAS_ERR_OK ) - { - return error; - } - /*-----------------------------------------------------------------* * output setup: for parametric binaural renderer, use output setup, otherwise internal setup *-----------------------------------------------------------------*/ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - hDirAC->hOutSetup = st_ivas->hOutSetup; - - hDirAC->hConfig->dec_param_estim = FALSE; - } - else - { - hDirAC->hOutSetup = st_ivas->hIntSetup; - } - nchan_out_woLFE = hDirAC->hOutSetup.nchan_out_woLFE; + hDirACRend->hOutSetup = st_ivas->hIntSetup; + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; - if ( hDirAC->hOutSetup.ls_azimuth != NULL && hDirAC->hOutSetup.ls_elevation != NULL ) + if ( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) { - mvr2r( hDirAC->hOutSetup.ls_azimuth, ls_azimuth, nchan_out_woLFE ); - mvr2r( hDirAC->hOutSetup.ls_elevation, ls_elevation, nchan_out_woLFE ); + mvr2r( hDirACRend->hOutSetup.ls_azimuth, ls_azimuth, nchan_out_woLFE ); + mvr2r( hDirACRend->hOutSetup.ls_elevation, ls_elevation, nchan_out_woLFE ); } - if ( hDirAC->hOutSetup.ambisonics_order == -1 ) + if ( hDirACRend->hOutSetup.ambisonics_order == -1 ) { - hDirAC->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ - if ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_MONO || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_STEREO ) + hDirACRend->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ + if ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_MONO || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_STEREO ) { - hDirAC->hOutSetup.ambisonics_order = SBA_FOA_ORDER; + hDirACRend->hOutSetup.ambisonics_order = SBA_FOA_ORDER; } } - else if ( hDirAC->hOutSetup.ambisonics_order >= SBA_FOA_ORDER ) + else if ( hDirACRend->hOutSetup.ambisonics_order >= SBA_FOA_ORDER ) { mvr2r( ls_azimuth_4d4, ls_azimuth, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); mvr2r( ls_elevation_4d4, ls_elevation, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); } - if ( hDirAC->hOutSetup.separateChannelEnabled && ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) { /* Remove the channel of the separated signal from the output setup of the spatial synthesis */ - hDirAC->hOutSetup.nchan_out_woLFE--; - nchan_out_woLFE = hDirAC->hOutSetup.nchan_out_woLFE; - mvr2r( &ls_azimuth[hDirAC->hOutSetup.separateChannelIndex + 1], &ls_azimuth[hDirAC->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirAC->hOutSetup.separateChannelIndex ); - mvr2r( &ls_elevation[hDirAC->hOutSetup.separateChannelIndex + 1], &ls_elevation[hDirAC->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirAC->hOutSetup.separateChannelIndex ); + hDirACRend->hOutSetup.nchan_out_woLFE--; + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; + mvr2r( &ls_azimuth[hDirACRend->hOutSetup.separateChannelIndex + 1], &ls_azimuth[hDirACRend->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirACRend->hOutSetup.separateChannelIndex ); + mvr2r( &ls_elevation[hDirACRend->hOutSetup.separateChannelIndex + 1], &ls_elevation[hDirACRend->hOutSetup.separateChannelIndex], nchan_out_woLFE - hDirACRend->hOutSetup.separateChannelIndex ); } /*-----------------------------------------------------------------* @@ -389,112 +229,74 @@ ivas_error ivas_dirac_dec_config( st_ivas->nchan_transport = nchan_transport_orig; - if ( flag_config == DIRAC_OPEN ) - { - hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); - set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - hDirAC->subframes_rendered = 0; - hDirAC->slots_rendered = 0; - hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - } - - if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE && ( ( ivas_total_brate > IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_256k ) || ( ivas_total_brate <= IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate > IVAS_256k ) ) ) - { - if ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k && hDirAC->azimuth2 == NULL ) - { - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 2 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_256k && hDirAC->azimuth2 != NULL ) - { - ivas_dirac_deallocate_parameters( hDirAC, 2 ); - } - } - - /* band config needed only for SPAR with FOA output */ - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) - { - return IVAS_ERR_OK; - } - - if ( nchan_transport_orig > 2 && hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC && !hodirac_flag ) - { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; - hDirAC->panningConf = DIRAC_PANNING_VBAP; - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + if ( nchan_transport_orig > 2 && hDirACRend->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC && !hodirac_flag ) { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; - hDirAC->panningConf = DIRAC_PANNING_VBAP; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; + hDirACRend->panningConf = DIRAC_PANNING_VBAP; } - else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.output_config == AUDIO_CONFIG_MONO ) + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_MONO ) { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_MONO; - hDirAC->panningConf = DIRAC_PANNING_HOA3; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_MONO; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; nchan_out_woLFE = 1; } #ifdef MASA_AND_OBJECTS - else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.is_loudspeaker_setup ) + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->hOutSetup.is_loudspeaker_setup ) #else - else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->hOutSetup.is_loudspeaker_setup ) + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->hOutSetup.is_loudspeaker_setup ) #endif { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; - hDirAC->panningConf = DIRAC_PANNING_VBAP; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; + hDirACRend->panningConf = DIRAC_PANNING_VBAP; } #ifdef MASA_AND_OBJECTS - else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && !hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) + else if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && !hDirACRend->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) #else - else if ( st_ivas->ivas_format == MASA_FORMAT && !hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) + else if ( st_ivas->ivas_format == MASA_FORMAT && !hDirACRend->hOutSetup.is_loudspeaker_setup && st_ivas->nchan_transport > 1 ) #endif { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; - hDirAC->panningConf = DIRAC_PANNING_HOA3; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; } else { - hDirAC->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; - hDirAC->panningConf = DIRAC_PANNING_HOA3; + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; } if ( flag_config == DIRAC_OPEN ) { - hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); - if ( ( hDirAC->frequency_axis = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->frequency_axis, 0.0f, hDirAC->num_freq_bands ); + set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); - ivas_dirac_dec_get_frequency_axis( hDirAC->frequency_axis, output_Fs, hDirAC->num_freq_bands ); + ivas_dirac_dec_get_frequency_axis( hDirACRend->frequency_axis, output_Fs, hSpatParamRendCom->num_freq_bands ); } - if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirAC->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) && hDirACRend->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) { - if ( ( flag_config == DIRAC_RECONFIGURE && hDirAC->masa_stereo_type_detect == NULL ) || flag_config == DIRAC_OPEN ) + if ( ( flag_config == DIRAC_RECONFIGURE && hDirACRend->masa_stereo_type_detect == NULL ) || flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + if ( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - ivas_masa_init_stereotype_detection( hDirAC->masa_stereo_type_detect ); + ivas_masa_init_stereotype_detection( hDirACRend->masa_stereo_type_detect ); } else { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->masa_stereo_type_detect != NULL ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->masa_stereo_type_detect != NULL ) { - free( hDirAC->masa_stereo_type_detect ); + free( hDirACRend->masa_stereo_type_detect ); } - hDirAC->masa_stereo_type_detect = NULL; + hDirACRend->masa_stereo_type_detect = NULL; } #ifdef MASA_AND_OBJECTS - hDirAC->numIsmDirections = 0; /* By default, no ism directions, set correct number runtime when needed */ + hSpatParamRendCom->numIsmDirections = 0; /* By default, no ism directions, set correct number runtime when needed */ #endif /*-----------------------------------------------------------------* @@ -504,45 +306,39 @@ ivas_error ivas_dirac_dec_config( /* prototype signal computation */ if ( flag_config == DIRAC_RECONFIGURE ) { - num_outputs_dir_old = hDirAC->num_outputs_dir; - num_outputs_diff_old = hDirAC->num_outputs_diff; - num_protos_diff_old = hDirAC->num_protos_diff; + num_outputs_dir_old = hDirACRend->num_outputs_dir; + num_outputs_diff_old = hDirACRend->num_outputs_diff; + num_protos_diff_old = hDirACRend->num_protos_diff; } /* allocate output setup related arrays */ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - /* Two channels in parametric binaural rendering */ - hDirAC->num_outputs_diff = 2; - hDirAC->num_outputs_dir = 2; - } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) { /* Directional and diffuses components in output LS format */ - hDirAC->num_outputs_diff = nchan_out_woLFE; - hDirAC->num_outputs_dir = nchan_out_woLFE; + hDirACRend->num_outputs_diff = nchan_out_woLFE; + hDirACRend->num_outputs_dir = nchan_out_woLFE; } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /* Directional and diffuses components in SHD */ /* Diffuseness components up to 1st order */ - hDirAC->num_outputs_diff = ( min( hDirAC->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirAC->hOutSetup.ambisonics_order, 1 ) + 1 ); - if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ivas_total_brate >= IVAS_96k ) && ( hDirAC->hOutSetup.ambisonics_order > 1 ) && ( nchan_transport < 4 ) ) + hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); + if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ivas_total_brate >= IVAS_96k ) && ( hDirACRend->hOutSetup.ambisonics_order > 1 ) && ( nchan_transport < 4 ) ) { - hDirAC->num_outputs_diff += 2; /* Add 2nd-order planar components for HRs */ + hDirACRend->num_outputs_diff += 2; /* Add 2nd-order planar components for HRs */ } - hDirAC->num_outputs_dir = ivas_sba_get_nchan( hDirAC->hOutSetup.ambisonics_order, 0 ); + hDirACRend->num_outputs_dir = ivas_sba_get_nchan( hDirACRend->hOutSetup.ambisonics_order, 0 ); } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - hDirAC->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; - hDirAC->num_outputs_dir = nchan_out_woLFE; + hDirACRend->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; + hDirACRend->num_outputs_dir = nchan_out_woLFE; } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - hDirAC->num_outputs_diff = 1; /* There is one output channel in mono */ - hDirAC->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ + hDirACRend->num_outputs_diff = 1; /* There is one output channel in mono */ + hDirACRend->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ } else { @@ -551,154 +347,135 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - num_outputs_dir_old = hDirAC->num_outputs_dir; - if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + num_outputs_dir_old = hDirACRend->num_outputs_dir; + if ( ( hDirACRend->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - num_outputs_diff_old = hDirAC->num_outputs_diff; - if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + num_outputs_diff_old = hDirACRend->num_outputs_diff; + if ( ( hDirACRend->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - if ( hDirAC->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) + if ( hDirACRend->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) { - free( hDirAC->proto_index_dir ); - if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + free( hDirACRend->proto_index_dir ); + if ( ( hDirACRend->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_s( hDirAC->proto_index_dir, 0, hDirAC->num_outputs_dir ); + set_s( hDirACRend->proto_index_dir, 0, hDirACRend->num_outputs_dir ); - if ( hDirAC->num_outputs_diff != num_outputs_diff_old && flag_config == DIRAC_RECONFIGURE ) + if ( hDirACRend->num_outputs_diff != num_outputs_diff_old && flag_config == DIRAC_RECONFIGURE ) { - free( hDirAC->proto_index_diff ); - if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + free( hDirACRend->proto_index_diff ); + if ( ( hDirACRend->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); + set_s( hDirACRend->proto_index_diff, 0, hDirACRend->num_outputs_diff ); - hDirAC->sba_map_tc = sba_map_tc; + hDirACRend->sba_map_tc = sba_map_tc; if ( st_ivas->ivas_format == SBA_FORMAT ) { if ( st_ivas->sba_order > SBA_FOA_ORDER && ivas_total_brate >= IVAS_512k ) { - hDirAC->sba_map_tc = sba_map_tc_512; + hDirACRend->sba_map_tc = sba_map_tc_512; } } if ( nchan_transport == 1 ) { - hDirAC->num_protos_ambi = 1; - hDirAC->num_protos_dir = 1; - hDirAC->num_protos_diff = 1; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - hDirAC->num_protos_dir = 2; - hDirAC->num_protos_diff = 2; - hDirAC->proto_index_dir[0] = 0; - hDirAC->proto_index_dir[1] = 1; - hDirAC->proto_index_diff[0] = 0; - hDirAC->proto_index_diff[1] = 1; - } + hDirACRend->num_protos_ambi = 1; + hDirACRend->num_protos_dir = 1; + hDirACRend->num_protos_diff = 1; } else if ( nchan_transport == 2 ) { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - hDirAC->num_protos_ambi = 2; - hDirAC->num_protos_diff = 1; - hDirAC->num_protos_dir = 2; - hDirAC->proto_index_dir[1] = 1; - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC->num_protos_dir = 2; - hDirAC->num_protos_diff = 2; - hDirAC->proto_index_dir[0] = 0; - hDirAC->proto_index_dir[1] = 1; - hDirAC->proto_index_diff[0] = 0; - hDirAC->proto_index_diff[1] = 1; + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_diff = 1; + hDirACRend->num_protos_dir = 2; + hDirACRend->proto_index_dir[1] = 1; } - else if ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_MONO ) + else if ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_MONO ) { /* Following the foa rendering for code compatibility */ - hDirAC->num_protos_ambi = 2; - hDirAC->num_protos_dir = 2; - hDirAC->num_protos_diff = 3; - hDirAC->proto_index_dir[0] = 0; - hDirAC->proto_index_diff[0] = 0; + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_dir = 2; + hDirACRend->num_protos_diff = 3; + hDirACRend->proto_index_dir[0] = 0; + hDirACRend->proto_index_diff[0] = 0; } else { - hDirAC->num_protos_ambi = 2; - hDirAC->num_protos_diff = 3; + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_diff = 3; - for ( k = 0; k < hDirAC->num_outputs_diff; k++ ) + for ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { if ( ls_azimuth[k] > 0.0f ) { - hDirAC->proto_index_diff[k] = 1; + hDirACRend->proto_index_diff[k] = 1; } else if ( ls_azimuth[k] < 0.0f ) { - hDirAC->proto_index_diff[k] = 2; + hDirACRend->proto_index_diff[k] = 2; } else { - hDirAC->proto_index_diff[k] = 0; + hDirACRend->proto_index_diff[k] = 0; } } - if ( hDirAC->hOutSetup.is_loudspeaker_setup ) + if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - hDirAC->num_protos_dir = 3; - mvs2s( hDirAC->proto_index_diff, hDirAC->proto_index_dir, nchan_out_woLFE ); + hDirACRend->num_protos_dir = 3; + mvs2s( hDirACRend->proto_index_diff, hDirACRend->proto_index_dir, nchan_out_woLFE ); } else { - hDirAC->num_protos_dir = 2; - hDirAC->proto_index_dir[1] = 1; + hDirACRend->num_protos_dir = 2; + hDirACRend->proto_index_dir[1] = 1; } } } else /* nchan_transport > 2 */ { - hDirAC->num_protos_ambi = 4; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + hDirACRend->num_protos_ambi = 4; + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) { - hDirAC->num_protos_diff = hDirAC->num_outputs_diff; - for ( k = 0; k < hDirAC->num_outputs_diff; k++ ) + hDirACRend->num_protos_diff = hDirACRend->num_outputs_diff; + for ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { - hDirAC->proto_index_diff[k] = k; + hDirACRend->proto_index_diff[k] = k; } - hDirAC->num_protos_dir = hDirAC->num_outputs_dir; - for ( k = 0; k < hDirAC->num_outputs_dir; k++ ) + hDirACRend->num_protos_dir = hDirACRend->num_outputs_dir; + for ( k = 0; k < hDirACRend->num_outputs_dir; k++ ) { - hDirAC->proto_index_dir[k] = k; + hDirACRend->proto_index_dir[k] = k; } } else { - hDirAC->num_protos_diff = 1; - hDirAC->num_protos_dir = nchan_transport; - if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT ) ) ) + hDirACRend->num_protos_diff = 1; + hDirACRend->num_protos_dir = nchan_transport; + if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT ) ) ) // Todo Dolby/FhG refactor: Is this ever true? { - hDirAC->num_protos_dir++; + hDirACRend->num_protos_dir++; } - for ( k = 0; k < min( hDirAC->num_outputs_dir, hDirAC->num_protos_dir ); k++ ) + for ( k = 0; k < min( hDirACRend->num_outputs_dir, hDirACRend->num_protos_dir ); k++ ) { - if ( hDirAC->sba_map_tc[k] < hDirAC->num_outputs_dir ) + if ( hDirACRend->sba_map_tc[k] < hDirACRend->num_outputs_dir ) { - hDirAC->proto_index_dir[hDirAC->sba_map_tc[k]] = k; + hDirACRend->proto_index_dir[hDirACRend->sba_map_tc[k]] = k; } } } @@ -707,61 +484,61 @@ ivas_error ivas_dirac_dec_config( /* direct/diffuse responses */ if ( flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } /* reallocate static memory */ - else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->num_outputs_dir != num_outputs_dir_old ) + else if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->num_outputs_dir != num_outputs_dir_old ) { - free( hDirAC->diffuse_response_function ); - hDirAC->diffuse_response_function = NULL; - if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + free( hDirACRend->diffuse_response_function ); + hDirACRend->diffuse_response_function = NULL; + if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - if ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) + if ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) { - initDiffuseResponses( hDirAC->diffuse_response_function, nchan_out_woLFE, hDirAC->hOutSetup.output_config, - hDirAC->hOutSetup, hDirAC->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirAC->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); + initDiffuseResponses( hDirACRend->diffuse_response_function, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, + hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); } else { - initDiffuseResponses( hDirAC->diffuse_response_function, hDirAC->num_outputs_dir, AUDIO_CONFIG_FOA, - hDirAC->hOutSetup, hDirAC->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirAC->num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG_INVALID ); + initDiffuseResponses( hDirACRend->diffuse_response_function, hDirACRend->num_outputs_dir, AUDIO_CONFIG_FOA, + hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG_INVALID ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { if ( flag_config == DIRAC_OPEN ) { - if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder && ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) + else if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->hoa_encoder && ( hDirACRend->num_outputs_diff != num_outputs_diff_old ) ) { - free( hDirAC->hoa_encoder ); - hDirAC->hoa_encoder = NULL; - if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + free( hDirACRend->hoa_encoder ); + hDirACRend->hoa_encoder = NULL; + if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_f( hDirAC->hoa_encoder, 0.0f, nchan_out_woLFE * hDirAC->num_outputs_diff ); - compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirAC->hoa_encoder, hDirAC->num_outputs_diff, hDirAC->hOutSetup.ambisonics_order ); + set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); + compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirACRend->hoa_encoder, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); } else { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->hoa_encoder ) { - free( hDirAC->hoa_encoder ); + free( hDirACRend->hoa_encoder ); } - hDirAC->hoa_encoder = NULL; + hDirACRend->hoa_encoder = NULL; } /* VBAP */ @@ -770,7 +547,7 @@ ivas_error ivas_dirac_dec_config( st_ivas->hVBAPdata = NULL; } - if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) + if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) { if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { @@ -789,13 +566,13 @@ ivas_error ivas_dirac_dec_config( } #endif } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } - hDirAC->hoa_decoder = NULL; + hDirACRend->hoa_decoder = NULL; } else if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { @@ -805,67 +582,67 @@ ivas_error ivas_dirac_dec_config( /* HOA panning/dec */ if ( flag_config == DIRAC_OPEN ) { - hDirAC->hoa_decoder = NULL; - if ( ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->ivas_format == SBA_FORMAT || ( nchan_transport > 2 ) ) + hDirACRend->hoa_decoder = NULL; + if ( ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->ivas_format == SBA_FORMAT || ( nchan_transport > 2 ) ) { - if ( hDirAC->hOutSetup.is_loudspeaker_setup ) + if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { if ( st_ivas->hoa_dec_mtx != NULL ) { free( st_ivas->hoa_dec_mtx ); st_ivas->hoa_dec_mtx = NULL; } - if ( ( error = ivas_sba_get_hoa_dec_matrix( hDirAC->hOutSetup, &st_ivas->hoa_dec_mtx, hDirAC->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_get_hoa_dec_matrix( hDirACRend->hOutSetup, &st_ivas->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } - hDirAC->hoa_decoder = st_ivas->hoa_dec_mtx; + hDirACRend->hoa_decoder = st_ivas->hoa_dec_mtx; } } } /* decorrelation */ - proto_signal_decorr_on_old = ( flag_config == DIRAC_RECONFIGURE ) ? hDirAC->proto_signal_decorr_on : 0; - hDirAC->proto_signal_decorr_on = 1; - if ( ( nchan_transport > 2 ) && ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) ) + proto_signal_decorr_on_old = ( flag_config == DIRAC_RECONFIGURE ) ? hDirACRend->proto_signal_decorr_on : 0; + hDirACRend->proto_signal_decorr_on = 1; + if ( ( nchan_transport > 2 ) && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) ) { /*switch off decorrelation for 4 transport channels*/ - hDirAC->proto_signal_decorr_on = 0; + hDirACRend->proto_signal_decorr_on = 0; } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - hDirAC->proto_signal_decorr_on = 0; + hDirACRend->proto_signal_decorr_on = 0; } - if ( ( flag_config == DIRAC_OPEN && hDirAC->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) + if ( ( flag_config == DIRAC_OPEN && hDirACRend->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirACRend->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), + &( hDirACRend->h_freq_domain_decorr_ap_state ), + hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + hDirACRend->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; } } - else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) + else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirACRend->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { - ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); } - else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) + else if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_signal_decorr_on && proto_signal_decorr_on_old ) { - if ( nchan_transport != nchan_transport_old || hDirAC->num_outputs_diff != num_outputs_diff_old || flag_config_inp == DIRAC_RECONFIGURE_MODE ) + if ( nchan_transport != nchan_transport_old || hDirACRend->num_outputs_diff != num_outputs_diff_old || flag_config_inp == DIRAC_RECONFIGURE_MODE ) { /* close and reopen the decorrelator */ - ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), &( hDirAC->h_freq_domain_decorr_ap_state ), hDirAC->num_freq_bands, hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, hDirAC->synthesisConf, hDirAC->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -875,54 +652,54 @@ ivas_error ivas_dirac_dec_config( /* output synthesis */ if ( flag_config == DIRAC_OPEN ) { - if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( hSpatParamRendCom, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } - hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; } - else if ( ( flag_config == DIRAC_RECONFIGURE ) && ( ( nchan_transport != nchan_transport_old ) || ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) ) + else if ( ( flag_config == DIRAC_RECONFIGURE ) && ( ( nchan_transport != nchan_transport_old ) || ( hDirACRend->num_outputs_diff != num_outputs_diff_old ) ) ) { - ivas_dirac_dec_output_synthesis_close( hDirAC ); + ivas_dirac_dec_output_synthesis_close( hDirACRend ); - if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( hSpatParamRendCom, hDirACRend, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } - hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC->h_output_synthesis_psd_params.use_onset_filters = 0; + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = 0; } /*-----------------------------------------------------------------* * memory allocation *-----------------------------------------------------------------*/ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_frame_f ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_frame_f ) { - free( hDirAC->proto_frame_f ); + free( hDirACRend->proto_frame_f ); } - hDirAC->proto_frame_f = NULL; + hDirACRend->proto_frame_f = NULL; } else { - if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_frame_f == NULL ) ) + if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirACRend->proto_frame_f == NULL ) ) { - if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - else if ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->num_protos_diff != num_protos_diff_old ) ) + else if ( flag_config == DIRAC_RECONFIGURE && ( hDirACRend->num_protos_diff != num_protos_diff_old ) ) { - proto_frame_f_old = hDirAC->proto_frame_f; + proto_frame_f_old = hDirACRend->proto_frame_f; free( proto_frame_f_old ); - if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -932,31 +709,31 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - hDirAC->buffer_energy = NULL; + hDirACRend->buffer_energy = NULL; } if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == TRUE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == TRUE && dec_param_estim_old == FALSE ) ) ) { - hDirAC->index_buffer_intensity = 0; + hDirACRend->index_buffer_intensity = 0; for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); + set_f( hDirACRend->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); } } - if ( hDirAC->buffer_energy == NULL ) + if ( hDirACRend->buffer_energy == NULL ) { - if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + if ( ( hDirACRend->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); + set_f( hDirACRend->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } else if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == FALSE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == FALSE && dec_param_estim_old == TRUE ) ) ) { @@ -964,132 +741,227 @@ ivas_error ivas_dirac_dec_config( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - if ( flag_config == DIRAC_RECONFIGURE && hDirAC->buffer_intensity_real[i][j] ) + if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->buffer_intensity_real[i][j] ) { - free( hDirAC->buffer_intensity_real[i][j] ); + free( hDirACRend->buffer_intensity_real[i][j] ); } - hDirAC->buffer_intensity_real[i][j] = NULL; + hDirACRend->buffer_intensity_real[i][j] = NULL; } } - if ( hDirAC->buffer_energy != NULL ) + if ( hDirACRend->buffer_energy != NULL ) { - free( hDirAC->buffer_energy ); - hDirAC->buffer_energy = NULL; + free( hDirACRend->buffer_energy ); + hDirACRend->buffer_energy = NULL; } } /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE, hodirac_flag ); + ivas_dirac_dec_output_synthesis_init( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, hodirac_flag ); /* Allocate stack memory */ if ( flag_config != DIRAC_OPEN ) { - ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); + ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); } - if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_alloc_mem( hDirACRend, st_ivas->renderer_type, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } - mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); - if ( flag_config == DIRAC_OPEN ) { - hDirAC->dirac_md_buffer_length = 0; - hDirAC->dirac_bs_md_write_idx = 0; - hDirAC->dirac_read_idx = 0; - hDirAC->spar_to_dirac_write_idx = 0; - if ( st_ivas->mc_mode == MC_MODE_MCMASA ) - { - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + st_ivas->hDirACRend = hDirACRend; + } - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) - { - hDirAC->render_to_md_map[map_idx] = map_idx; - } - } -#ifdef MASA_AND_OBJECTS - else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) -#else - else if ( st_ivas->ivas_format == MASA_FORMAT ) -#endif - { - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; - hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; + return error; +} - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) - { - hDirAC->render_to_md_map[map_idx] = map_idx; - } - } - else - { - int16_t num_slots_in_subfr; - num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; - hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); - hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - hDirAC->dirac_read_idx = 0; - hDirAC->dirac_estimator_idx = 0; - - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS * num_slots_in_subfr; map_idx++ ) - { - hDirAC->render_to_md_map[map_idx] = hDirAC->dirac_read_idx + map_idx / num_slots_in_subfr; - } - } - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } +/*------------------------------------------------------------------------- + * ivas_dirac_dec_config() + * + * Open or reconfigure decoder DirAC/MASA handle + *-------------------------------------------------------------------------*/ -#ifdef MASA_AND_OBJECTS - if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) ) -#endif - { - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 2 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - hDirAC->azimuth2 = NULL; - hDirAC->elevation2 = NULL; - hDirAC->energy_ratio2 = NULL; - hDirAC->spreadCoherence2 = NULL; - } +ivas_error ivas_dirac_dec_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ +) +{ + ivas_error error; + int32_t output_Fs; + int16_t hodirac_flag; + int16_t sparfoa_flag; + DIRAC_CONFIG_FLAG dec_config_flag; + DIRAC_CONFIG_FLAG rend_config_flag; + DIRAC_CONFIG_FLAG common_rend_config_flag; + int16_t need_dirac_rend; + int16_t need_parambin; + int16_t dec_param_estim_old; + int16_t dec_param_estim_new; - hDirAC->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + error = IVAS_ERR_OK; - hDirAC->dithering_seed = DIRAC_DITH_SEED; - st_ivas->hDirAC = hDirAC; - } + /* Solve and setup flags for inits */ + dec_config_flag = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; - /* allocate transport channels*/ - if ( flag_config == DIRAC_OPEN ) + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); + dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE; + + + sparfoa_flag = 0; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) + { + sparfoa_flag = 1; + } + + if ( ( error = ivas_dirac_dec_config_internal( st_ivas, dec_config_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* This is required for parambin */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + st_ivas->hDirAC->hConfig->dec_param_estim = FALSE; + } + + dec_param_estim_new = st_ivas->hDirAC->hConfig->dec_param_estim; + + /* Setup renderers and meta */ + /* First, free everything if in reconfig and not the active renderer */ + need_parambin = 0; + switch ( st_ivas->renderer_type ) + { + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + case RENDERER_STEREO_PARAMETRIC: + need_parambin = 1; + break; + default: + need_parambin = 0; + } + + if ( !need_parambin ) + { + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + } + + need_dirac_rend = 0; + switch ( st_ivas->renderer_type ) + { + case RENDERER_DIRAC: + case RENDERER_BINAURAL_FASTCONV: + case RENDERER_BINAURAL_FASTCONV_ROOM: + case RENDERER_SBA_LINEAR_ENC: + case RENDERER_SBA_LINEAR_DEC: + need_dirac_rend = 1; + break; + default: + need_dirac_rend = 0; + } + + if ( !need_dirac_rend ) + { + ivas_dirac_rend_close( &st_ivas->hDirACRend ); + } + + if ( !sparfoa_flag ) + { + common_rend_config_flag = st_ivas->hSpatParamRendCom == NULL ? DIRAC_OPEN : flag_config_inp; + if ( ( error = ivas_spat_hSpatParamRendCom_config( &st_ivas->hSpatParamRendCom, common_rend_config_flag, dec_param_estim_new, + st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( need_dirac_rend ) + { + rend_config_flag = st_ivas->hDirACRend == NULL ? DIRAC_OPEN : flag_config_inp; + if ( ( error = ivas_dirac_rend_config( st_ivas, rend_config_flag, dec_param_estim_old ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( need_parambin ) + { + if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( st_ivas->hDiracDecBin == NULL ) + { + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */ + /* TODO: refactor merge: does this need to be adapted for OMASA? */ + if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) + { + ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); + } + + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( !st_ivas->hDiracDecBin->useTdDecorr ) + { + if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) + { + float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); + if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), + st_ivas->hSpatParamRendCom->num_freq_bands, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + } + } + } + + /* Allocate transport channel buffers for SBA format when in JBM */ + if ( dec_config_flag == DIRAC_OPEN ) { if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { if ( st_ivas->ivas_format == SBA_FORMAT ) { int16_t nchan_to_allocate; + int16_t nchan_transport; + + nchan_transport = st_ivas->nchan_transport; nchan_to_allocate = nchan_transport; - if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { nchan_to_allocate++; /* we need a channel for the CNG in this case*/ } - 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 ) { nchan_to_allocate = 2 * BINAURAL_CHANNELS; } - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, hDirAC->slot_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, st_ivas->hSpatParamRendCom->slot_size ) ) != IVAS_ERR_OK ) { return error; } @@ -1108,10 +980,8 @@ ivas_error ivas_dirac_dec_config( *------------------------------------------------------------------------*/ void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE *hDirAC_out /* i/o: decoder DirAC handle */ -) + DIRAC_DEC_HANDLE *hDirAC_out ) { - int16_t i, j; DIRAC_DEC_HANDLE hDirAC; if ( hDirAC_out == NULL || *hDirAC_out == NULL ) @@ -1128,86 +998,6 @@ void ivas_dirac_dec_close( hDirAC->hConfig = NULL; } - /* close Output synthesis sub-module */ - ivas_dirac_dec_output_synthesis_close( hDirAC ); - - /* close Decorrelator sub-module */ - if ( hDirAC->proto_signal_decorr_on ) - { - ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); - } - - /* Params */ - - /* free frequency axis buffer */ - if ( hDirAC->frequency_axis != NULL ) - { - free( hDirAC->frequency_axis ); - hDirAC->frequency_axis = NULL; - } - - if ( hDirAC->diffuse_response_function != NULL ) - { - free( hDirAC->diffuse_response_function ); - hDirAC->diffuse_response_function = NULL; - } - - if ( hDirAC->hoa_encoder != NULL ) - { - free( hDirAC->hoa_encoder ); - hDirAC->hoa_encoder = NULL; - } - - /* prototype indexing */ - if ( hDirAC->proto_index_dir != NULL ) - { - free( hDirAC->proto_index_dir ); - hDirAC->proto_index_dir = NULL; - } - - if ( hDirAC->proto_index_diff != NULL ) - { - free( hDirAC->proto_index_diff ); - hDirAC->proto_index_dir = NULL; - } - - /* States */ - - /* free prototype signal buffers */ - if ( hDirAC->proto_frame_f != NULL ) - { - free( hDirAC->proto_frame_f ); - hDirAC->proto_frame_f = NULL; - } - - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - if ( hDirAC->buffer_intensity_real[i][j] != NULL ) - { - free( hDirAC->buffer_intensity_real[i][j] ); - hDirAC->buffer_intensity_real[i][j] = NULL; - } - } - } - if ( hDirAC->buffer_energy != NULL ) - { - free( hDirAC->buffer_energy ); - hDirAC->buffer_energy = NULL; - } - - ivas_dirac_deallocate_parameters( hDirAC, 1 ); - ivas_dirac_deallocate_parameters( hDirAC, 2 ); - - if ( hDirAC->masa_stereo_type_detect != NULL ) - { - free( hDirAC->masa_stereo_type_detect ); - hDirAC->masa_stereo_type_detect = NULL; - } - - ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); - free( *hDirAC_out ); *hDirAC_out = NULL; @@ -1216,2019 +1006,562 @@ void ivas_dirac_dec_close( /*------------------------------------------------------------------------- - * ivas_dirac_deallocate_parameters() + * ivas_dirac_dec_read_BS() * - * Deallocate DirAC parameters - *-------------------------------------------------------------------------*/ + * Read DirAC parameters from the bitstream + *------------------------------------------------------------------------*/ -void ivas_dirac_deallocate_parameters( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - const int16_t params_flag /* i : set of parameters flag */ +void ivas_dirac_dec_read_BS( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + 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 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { - int16_t i; - - if ( params_flag == 1 ) + int16_t i, j, b, dir, orig_dirac_bands; + int16_t next_bit_pos_orig; + *nb_bits = 0; + if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) { - if ( hDirAC->azimuth != NULL ) - { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) - { - if ( hDirAC->azimuth[i] != NULL ) - { - free( hDirAC->azimuth[i] ); - hDirAC->azimuth[i] = NULL; - } - } + next_bit_pos_orig = st->next_bit_pos; + st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); - free( hDirAC->azimuth ); - hDirAC->azimuth = NULL; - } + /* 1 bit flag for signaling metadata to read */ + b = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits )++; - if ( hDirAC->elevation != NULL ) + if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) - { - if ( hDirAC->elevation[i] != NULL ) - { - free( hDirAC->elevation[i] ); - hDirAC->elevation[i] = NULL; - } - } + orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - free( hDirAC->elevation ); - hDirAC->elevation = NULL; - } + hQMetaData->sba_inactive_mode = 1; - if ( hDirAC->energy_ratio1 != NULL ) - { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + /* if we start with a SID frame, we need to init the azi/ele arrays.*/ + if ( st->ini_frame == 0 ) { - if ( hDirAC->energy_ratio1[i] != NULL ) + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { - free( hDirAC->energy_ratio1[i] ); - hDirAC->energy_ratio1[i] = NULL; + set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); } } - free( hDirAC->energy_ratio1 ); - hDirAC->energy_ratio1 = NULL; - } - if ( hDirAC->diffuseness_vector != NULL ) - { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; + } + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - if ( hDirAC->diffuseness_vector[i] != NULL ) + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { - free( hDirAC->diffuseness_vector[i] ); - hDirAC->diffuseness_vector[i] = NULL; + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } } - free( hDirAC->diffuseness_vector ); - hDirAC->diffuseness_vector = NULL; + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } - - if ( hDirAC->spreadCoherence != NULL ) + else { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + hQMetaData->sba_inactive_mode = 0; + hQMetaData->is_masa_ivas_format = 0; + if ( hQMetaData->useLowerRes ) { - if ( hDirAC->spreadCoherence[i] != NULL ) - { - free( hDirAC->spreadCoherence[i] ); - hDirAC->spreadCoherence[i] = NULL; - } + hQMetaData->q_direction[0].cfg.nblocks = 1; } - free( hDirAC->spreadCoherence ); - hDirAC->spreadCoherence = NULL; - } - - if ( hDirAC->surroundingCoherence != NULL ) - { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + else { - if ( hDirAC->surroundingCoherence[i] != NULL ) - { - free( hDirAC->surroundingCoherence[i] ); - hDirAC->surroundingCoherence[i] = NULL; - } + hQMetaData->q_direction[0].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; } - free( hDirAC->surroundingCoherence ); - hDirAC->surroundingCoherence = NULL; + + *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), hodirac_flag ); } + +#ifdef DEBUGGING + assert( *nb_bits >= 0 ); +#endif + + st->next_bit_pos = next_bit_pos_orig; } - else if ( params_flag == 2 ) + else if ( !st->bfi && ivas_total_brate == IVAS_SID_5k2 ) { - if ( hDirAC->azimuth2 != NULL ) - { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) - { - if ( hDirAC->azimuth2[i] != NULL ) - { - free( hDirAC->azimuth2[i] ); - hDirAC->azimuth2[i] = NULL; - } - } - free( hDirAC->azimuth2 ); - hDirAC->azimuth2 = NULL; - } + next_bit_pos_orig = st->next_bit_pos; + + /* subtract mode signaling bits, since bitstream was moved after mode reading */ + st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); +#ifndef SBA_MODE_CLEANUP_2 + /* 1 bit flag for SPAR/DirAC, already read in read format function */ +#else + /* 1 bit flag for signaling metadata to read */ +#endif + b = st->bit_stream[( st->next_bit_pos )--]; + ( *nb_bits )++; + hQMetaData->sba_inactive_mode = 1; + orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - if ( hDirAC->elevation2 != NULL ) + /* if we start with a SID frame, we need to init the azi/ele arrays.*/ + if ( st->ini_frame == 0 ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) { - if ( hDirAC->elevation2[i] != NULL ) + for ( b = 0; b < hQMetaData->q_direction[dir].cfg.nbands; b++ ) { - free( hDirAC->elevation2[i] ); - hDirAC->elevation2[i] = NULL; + set_zero( hQMetaData->q_direction[dir].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[dir].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); } } - free( hDirAC->elevation2 ); - hDirAC->elevation2 = NULL; } - if ( hDirAC->energy_ratio2 != NULL ) + *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) - { - if ( hDirAC->energy_ratio2[i] != NULL ) - { - free( hDirAC->energy_ratio2[i] ); - hDirAC->energy_ratio2[i] = NULL; - } - } - free( hDirAC->energy_ratio2 ); - hDirAC->energy_ratio2 = NULL; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; } - - if ( hDirAC->spreadCoherence2 != NULL ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { - if ( hDirAC->spreadCoherence2[i] != NULL ) - { - free( hDirAC->spreadCoherence2[i] ); - hDirAC->spreadCoherence2[i] = NULL; - } + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } - free( hDirAC->spreadCoherence2 ); - hDirAC->spreadCoherence2 = NULL; } + + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; + + st->next_bit_pos = next_bit_pos_orig; + } + + if ( hDirAC != NULL && hSpatParamRendCom != NULL ) + { + ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, hSpatParamRendCom, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); } return; } -/*------------------------------------------------------------------------- - * ivas_dirac_alloc_mem() +/*-----------------------------------------------------------------------* + * ivas_qmetadata_to_dirac() * - * Allocate stack memory for DirAC renderer - *------------------------------------------------------------------------*/ + * Copy qmetedata to DirAC parameters for rendering + *-----------------------------------------------------------------------*/ -static ivas_error ivas_dirac_alloc_mem( - DIRAC_DEC_HANDLE hDirAC, - const RENDERER_TYPE renderer_type, - DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, - const int16_t hodirac_flag ) +void ivas_qmetadata_to_dirac( + const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ + MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ +) { - int16_t num_freq_bands, num_freq_bands_diff, size; - int16_t size_ho; - int16_t size_pf; - int16_t num_outputs_dir, num_outputs_diff; - int16_t num_protos_dir; + int16_t block, band; + int16_t *seed_ptr; + int16_t band_start, band_end, diff_idx; + float diffuseness; + int16_t b, ele, azi; + float azimuth, elevation; + IVAS_QDIRECTION *q_direction; + int16_t *band_mapping; + int16_t *band_grouping; + int16_t start_band; + int16_t nbands = 0; + int16_t nblocks = 0; + int16_t qBand_idx; + int16_t idx_sec = 0; + int16_t no_secs = 1; - num_protos_dir = hDirAC->num_protos_dir; - - num_freq_bands = hDirAC->num_freq_bands; - num_freq_bands_diff = hDirAC->h_output_synthesis_psd_params.max_band_decorr; - - num_outputs_dir = hDirAC->num_outputs_dir; - num_outputs_diff = hDirAC->num_outputs_diff; + q_direction = &( hQMetaData->q_direction[0] ); +#ifdef MASA_AND_OBJECTS + hSpatParamRendCom->numParametricDirections = hQMetaData->no_directions; + hSpatParamRendCom->numSimultaneousDirections = hSpatParamRendCom->numParametricDirections + hSpatParamRendCom->numIsmDirections; +#else + hSpatParamRendCom->numSimultaneousDirections = hQMetaData->no_directions; +#endif - size = num_freq_bands * num_outputs_dir; - if ( hodirac_flag ) - { - size_ho = size * DIRAC_HO_NUMSECTORS; - size_pf = num_freq_bands * DIRAC_HO_NUMSECTORS; - } - else + if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { - size_ho = size; - size_pf = num_freq_bands; - } + int16_t meta_write_index; + band_mapping = hMasa->data.band_mapping; - /* PSD related buffers */ - hDirAC_mem->cy_auto_dir_smooth = NULL; - hDirAC_mem->proto_power_smooth = NULL; - hDirAC_mem->proto_power_diff_smooth = NULL; - hDirAC_mem->direct_responses_square = NULL; - hDirAC_mem->frame_dec_f = NULL; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + block ) % hSpatParamRendCom->dirac_md_buffer_length; - if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->proto_power_smooth, size ); + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { + hSpatParamRendCom->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hSpatParamRendCom->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hSpatParamRendCom->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; - if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->proto_power_diff_smooth, size ); + if ( q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->spreadCoherence[meta_write_index][b] = 0.0f; + } - if ( ( hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + if ( hQMetaData->surcoh_band_data != NULL ) + { + hSpatParamRendCom->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->surroundingCoherence[meta_write_index][b] = 0.0f; + } + } + } } - set_zero( hDirAC_mem->direct_responses_square, size ); - if ( hDirAC->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) + + if ( hQMetaData->no_directions == 2 ) { - if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) + q_direction = &( hQMetaData->q_direction[1] ); + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } - } - hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; - hDirAC->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; - hDirAC->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; - hDirAC->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + block ) % hSpatParamRendCom->dirac_md_buffer_length; - /* Target and smoothed nrg factors/gains */ - if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + { + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + { + hSpatParamRendCom->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hSpatParamRendCom->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hSpatParamRendCom->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + if ( q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->spreadCoherence2[meta_write_index][b] = 0.0f; + } + } + } + } } - set_zero( hDirAC_mem->cy_auto_diff_smooth, size ); - } - else - { - if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ) ) == NULL ) + else if ( hSpatParamRendCom->azimuth2 != NULL && hSpatParamRendCom->elevation2 != NULL && hSpatParamRendCom->energy_ratio2 != NULL && hSpatParamRendCom->spreadCoherence2 != NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + /* zero out old dir2 data */ + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + block ) % hSpatParamRendCom->dirac_md_buffer_length; + set_s( hSpatParamRendCom->azimuth2[meta_write_index], 0, hSpatParamRendCom->num_freq_bands ); + set_s( hSpatParamRendCom->elevation2[meta_write_index], 0, hSpatParamRendCom->num_freq_bands ); + set_zero( hSpatParamRendCom->energy_ratio2[meta_write_index], hSpatParamRendCom->num_freq_bands ); + set_zero( hSpatParamRendCom->spreadCoherence2[meta_write_index], hSpatParamRendCom->num_freq_bands ); + } } - set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); } - hDirAC->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; - hDirAC->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; - - /*Responses (gains/factors)*/ - if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) + else /* SBA mode/SID/Zero frame*/ { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - set_zero( hDirAC_mem->direct_responses, size ); - + int16_t tmp_write_idx_param_band; + int16_t tmp_write_idx_band; + float diffuseness_sec = 0.f; - hDirAC->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; + /* ungroup */ + seed_ptr = &hDirAC->dithering_seed; + nblocks = q_direction->cfg.nblocks; + nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; + band_grouping = hDirAC->band_grouping; - /* Prototypes */ - hDirAC_mem->proto_direct_buffer_f = NULL; - hDirAC_mem->proto_diffuse_buffer_f = NULL; - if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ) ) == NULL ) + if ( ivas_total_brate <= IVAS_SID_5k2 && ivas_format != SBA_FORMAT ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ + start_band = 0; + hDirAC->hConfig->nbands = 5; + ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, NULL, 0, 0, NULL ); + nbands = 5; } - - if ( hDirAC->proto_signal_decorr_on ) + else { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + start_band = hDirAC->hConfig->enc_param_start_band; + if ( ivas_format == SBA_FORMAT ) { - if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + hDirAC->hConfig->nbands = IVAS_MAX_NUM_BANDS; } else { - if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + hDirAC->hConfig->nbands = q_direction->cfg.nbands; } - } - } - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; - /* Gains/power factors*/ - hDirAC_mem->direct_power_factor = NULL; - hDirAC_mem->diffuse_power_factor = NULL; + ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft ); - if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + nbands = hDirAC->hConfig->nbands; + if ( hQMetaData->q_direction[0].cfg.nblocks == 0 ) + { + /* No transmission -> no copy from qmetadata buffers*/ + nbands = start_band; + } } - } - - hDirAC->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; - hDirAC_mem->reference_power = NULL; - hDirAC_mem->onset_filter = NULL; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + /* Low-Bands with no spatial data transmitted, analysis at decoder side */ + for ( band = 0; band < start_band; band++ ) { - if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - if ( hDirAC->proto_signal_decorr_on ) + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + tmp_write_idx_param_band = hSpatParamRendCom->dirac_bs_md_write_idx; + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) + for ( b = band_start; b < band_end; b++ ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + tmp_write_idx_band = tmp_write_idx_param_band; + hSpatParamRendCom->spreadCoherence[block][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[block][b] = 0.0f; + + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } } - } - else - { - if ( num_protos_dir > 2 ) + + /* Bands with spatial data transmitted */ + if ( hodirac_flag ) { - if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } + no_secs = DIRAC_HO_NUMSECTORS; } - if ( hDirAC->proto_signal_decorr_on ) + for ( idx_sec = 0; idx_sec < no_secs; idx_sec++ ) { - if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + for ( band = start_band; band < nbands; band++ ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); - } - } - } - - return IVAS_ERR_OK; -} - + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + tmp_write_idx_param_band = hSpatParamRendCom->dirac_bs_md_write_idx; -static void ivas_dirac_free_mem( - DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) -{ - if ( hDirAC_mem->cy_auto_dir_smooth != NULL ) - { - free( hDirAC_mem->cy_auto_dir_smooth ); - } - if ( hDirAC_mem->proto_power_smooth != NULL ) - { - free( hDirAC_mem->proto_power_smooth ); - } - if ( hDirAC_mem->proto_power_diff_smooth != NULL ) - { - free( hDirAC_mem->proto_power_diff_smooth ); - } - if ( hDirAC_mem->direct_responses_square != NULL ) - { - free( hDirAC_mem->direct_responses_square ); - } - if ( hDirAC_mem->frame_dec_f != NULL ) - { - free( hDirAC_mem->frame_dec_f ); - } - if ( hDirAC_mem->cy_cross_dir_smooth != NULL ) - { - free( hDirAC_mem->cy_cross_dir_smooth ); - } - if ( hDirAC_mem->cy_auto_diff_smooth != NULL ) - { - free( hDirAC_mem->cy_auto_diff_smooth ); - } - if ( hDirAC_mem->direct_responses != NULL ) - { - free( hDirAC_mem->direct_responses ); - } - if ( hDirAC_mem->proto_direct_buffer_f != NULL ) - { - free( hDirAC_mem->proto_direct_buffer_f ); - } - if ( hDirAC_mem->proto_diffuse_buffer_f != NULL ) - { - free( hDirAC_mem->proto_diffuse_buffer_f ); - } - if ( hDirAC_mem->direct_power_factor != NULL ) - { - free( hDirAC_mem->direct_power_factor ); - } - if ( hDirAC_mem->diffuse_power_factor != NULL ) - { - free( hDirAC_mem->diffuse_power_factor ); - } - if ( hDirAC_mem->reference_power != NULL ) - { - free( hDirAC_mem->reference_power ); - } - if ( hDirAC_mem->onset_filter != NULL ) - { - free( hDirAC_mem->onset_filter ); - } + if ( ivas_format == SBA_FORMAT ) + { + qBand_idx = dirac_to_spar_md_bands[band] - start_band; + } + else + { + qBand_idx = band; + } + diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; +#ifdef DEBUG_MODE_DIRAC + dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); +#endif + diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; - return; -} + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + int16_t block_qmetadata; + block_qmetadata = min( block, nblocks - 1 ); + block_qmetadata = max( block_qmetadata, 0 ); -/*------------------------------------------------------------------------- - * ivas_dirac_dec_read_BS() - * - * Read DirAC parameters from the bitstream - *------------------------------------------------------------------------*/ + if ( q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) + { + q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; + } -void ivas_dirac_dec_read_BS( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - Decoder_State *st, /* i/o: decoder state structure */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata */ - int16_t *nb_bits, /* o : number of bits read */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ -) -{ - int16_t i, j, b, dir, orig_dirac_bands; - int16_t next_bit_pos_orig; - *nb_bits = 0; - if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) - { - next_bit_pos_orig = st->next_bit_pos; - st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); + if ( hMasa == NULL && hodirac_flag ) + { + azimuth = q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata]; + elevation = q_direction[idx_sec].band_data[qBand_idx].elevation[block_qmetadata]; + diffuseness = 1.f - q_direction[0].band_data[qBand_idx].energy_ratio[block_qmetadata]; + diffuseness_sec = q_direction[1].band_data[qBand_idx].energy_ratio[block_qmetadata]; + assert( diffuseness_sec < 1.0001f && diffuseness_sec > -0.0001f ); + } + else + { + azimuth = q_direction->band_data[qBand_idx].azimuth[block_qmetadata]; + elevation = q_direction->band_data[qBand_idx].elevation[block_qmetadata]; + } - /* 1 bit flag for signaling metadata to read */ - b = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits )++; + for ( b = band_start; b < band_end; b++ ) + { + tmp_write_idx_band = tmp_write_idx_param_band; - if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ - { - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; + if ( hodirac_flag ) + { + azi = (int16_t) ( azimuth + 0.5f ); + ele = (int16_t) ( elevation + 0.5f ); + } + else + { + azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); + ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); + /* limit the elevation to [-90, 90] */ + ele = min( 90, ele ); + ele = max( -90, ele ); + } - hQMetaData->sba_inactive_mode = 1; + if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; + } + else + { + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + } - /* if we start with a SID frame, we need to init the azi/ele arrays.*/ - if ( st->ini_frame == 0 ) - { - for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; - } - else - { - hQMetaData->sba_inactive_mode = 0; - hQMetaData->is_masa_ivas_format = 0; - if ( hQMetaData->useLowerRes ) - { - hQMetaData->q_direction[0].cfg.nblocks = 1; - } - else - { - hQMetaData->q_direction[0].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; - } - - *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), hodirac_flag ); - } - -#ifdef DEBUGGING - assert( *nb_bits >= 0 ); -#endif - - st->next_bit_pos = next_bit_pos_orig; - } - else if ( !st->bfi && ivas_total_brate == IVAS_SID_5k2 ) - { - next_bit_pos_orig = st->next_bit_pos; - - /* subtract mode signaling bits, since bitstream was moved after mode reading */ - st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); -#ifndef SBA_MODE_CLEANUP_2 - /* 1 bit flag for SPAR/DirAC, already read in read format function */ -#else - /* 1 bit flag for signaling metadata to read */ -#endif - b = st->bit_stream[( st->next_bit_pos )--]; - ( *nb_bits )++; - hQMetaData->sba_inactive_mode = 1; - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - - /* if we start with a SID frame, we need to init the azi/ele arrays.*/ - if ( st->ini_frame == 0 ) - { - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) - { - for ( b = 0; b < hQMetaData->q_direction[dir].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[dir].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[dir].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - } - - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; - - st->next_bit_pos = next_bit_pos_orig; - } - - if ( hDirAC != NULL ) - { - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); - } - - return; -} - - -/*-----------------------------------------------------------------------* - * ivas_qmetadata_to_dirac() - * - * Copy qmetedata to DirAC parameters for rendering - *-----------------------------------------------------------------------*/ - -void ivas_qmetadata_to_dirac( - const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ - MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ -) -{ - int16_t block, band; - int16_t *seed_ptr; - int16_t band_start, band_end, diff_idx; - float diffuseness; - int16_t b, ele, azi; - float azimuth, elevation; - IVAS_QDIRECTION *q_direction; - int16_t *band_mapping; - int16_t *band_grouping; - int16_t start_band; - int16_t nbands = 0; - int16_t nblocks = 0; - int16_t qBand_idx; - int16_t idx_sec = 0; - int16_t no_secs = 1; - - q_direction = &( hQMetaData->q_direction[0] ); -#ifdef MASA_AND_OBJECTS - hDirAC->numParametricDirections = hQMetaData->no_directions; - hDirAC->numSimultaneousDirections = hDirAC->numParametricDirections + hDirAC->numIsmDirections; -#else - hDirAC->numSimultaneousDirections = hQMetaData->no_directions; -#endif - - if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) - { - int16_t meta_write_index; - band_mapping = hMasa->data.band_mapping; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) - { - hDirAC->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; - - if ( q_direction->coherence_band_data != NULL ) - { - hDirAC->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; - } - else - { - hDirAC->spreadCoherence[meta_write_index][b] = 0.0f; - } - - if ( hQMetaData->surcoh_band_data != NULL ) - { - hDirAC->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; - } - else - { - hDirAC->surroundingCoherence[meta_write_index][b] = 0.0f; - } - } - } - } - - if ( hQMetaData->no_directions == 2 ) - { - q_direction = &( hQMetaData->q_direction[1] ); - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) - { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) - { - hDirAC->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; - - if ( q_direction->coherence_band_data != NULL ) - { - hDirAC->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; - } - else - { - hDirAC->spreadCoherence2[meta_write_index][b] = 0.0f; - } - } - } - } - } - else if ( hDirAC->azimuth2 != NULL && hDirAC->elevation2 != NULL && hDirAC->energy_ratio2 != NULL && hDirAC->spreadCoherence2 != NULL ) - { - /* zero out old dir2 data */ - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; - set_s( hDirAC->azimuth2[meta_write_index], 0, hDirAC->num_freq_bands ); - set_s( hDirAC->elevation2[meta_write_index], 0, hDirAC->num_freq_bands ); - set_zero( hDirAC->energy_ratio2[meta_write_index], hDirAC->num_freq_bands ); - set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); - } - } - } - else /* SBA mode/SID/Zero frame*/ - { - int16_t tmp_write_idx_param_band; - int16_t tmp_write_idx_band; - float diffuseness_sec = 0.f; - - /* ungroup */ - seed_ptr = &hDirAC->dithering_seed; - nblocks = q_direction->cfg.nblocks; - nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; - band_grouping = hDirAC->band_grouping; - - if ( ivas_total_brate <= IVAS_SID_5k2 && ivas_format != SBA_FORMAT ) - { - /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ - start_band = 0; - hDirAC->hConfig->nbands = 5; - ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, NULL, 0, 0, NULL ); - nbands = 5; - } - else - { - start_band = hDirAC->hConfig->enc_param_start_band; - if ( ivas_format == SBA_FORMAT ) - { - hDirAC->hConfig->nbands = IVAS_MAX_NUM_BANDS; - } - else - { - hDirAC->hConfig->nbands = q_direction->cfg.nbands; - } - - ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft ); - - nbands = hDirAC->hConfig->nbands; - if ( hQMetaData->q_direction[0].cfg.nblocks == 0 ) - { - /* No transmission -> no copy from qmetadata buffers*/ - nbands = start_band; - } - } - - /* Low-Bands with no spatial data transmitted, analysis at decoder side */ - for ( band = 0; band < start_band; band++ ) - { - band_start = band_grouping[band]; - band_end = band_grouping[band + 1]; - tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - for ( b = band_start; b < band_end; b++ ) - { - tmp_write_idx_band = tmp_write_idx_param_band; - hDirAC->spreadCoherence[block][b] = 0.0f; - hDirAC->surroundingCoherence[block][b] = 0.0f; - - hDirAC->elevation[tmp_write_idx_band][b] = 0; - hDirAC->azimuth[tmp_write_idx_band][b] = 0; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; - - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; - } - } - } - - /* Bands with spatial data transmitted */ - if ( hodirac_flag ) - { - no_secs = DIRAC_HO_NUMSECTORS; - } - - for ( idx_sec = 0; idx_sec < no_secs; idx_sec++ ) - { - for ( band = start_band; band < nbands; band++ ) - { - band_start = band_grouping[band]; - band_end = band_grouping[band + 1]; - tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; - - if ( ivas_format == SBA_FORMAT ) - { - qBand_idx = dirac_to_spar_md_bands[band] - start_band; - } - else - { - qBand_idx = band; - } - diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; -#ifdef DEBUG_MODE_DIRAC - dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); -#endif - diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - int16_t block_qmetadata; - - block_qmetadata = min( block, nblocks - 1 ); - block_qmetadata = max( block_qmetadata, 0 ); - - if ( q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) - { - q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; - } - - if ( hMasa == NULL && hodirac_flag ) - { - azimuth = q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata]; - elevation = q_direction[idx_sec].band_data[qBand_idx].elevation[block_qmetadata]; - diffuseness = 1.f - q_direction[0].band_data[qBand_idx].energy_ratio[block_qmetadata]; - diffuseness_sec = q_direction[1].band_data[qBand_idx].energy_ratio[block_qmetadata]; - assert( diffuseness_sec < 1.0001f && diffuseness_sec > -0.0001f ); - } - else - { - azimuth = q_direction->band_data[qBand_idx].azimuth[block_qmetadata]; - elevation = q_direction->band_data[qBand_idx].elevation[block_qmetadata]; - } - - for ( b = band_start; b < band_end; b++ ) - { - tmp_write_idx_band = tmp_write_idx_param_band; - - if ( hodirac_flag ) - { - azi = (int16_t) ( azimuth + 0.5f ); - ele = (int16_t) ( elevation + 0.5f ); - } - else - { - azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); - ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); - /* limit the elevation to [-90, 90] */ - ele = min( 90, ele ); - ele = max( -90, ele ); - } - - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) - { - hDirAC->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; - } - else - { - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - } - - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) - { - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; - } - else - { - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - } - - hDirAC->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; - - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; - - if ( hodirac_flag ) - { - if ( idx_sec == 0 ) - { - hDirAC->elevation[tmp_write_idx_band][b] = ele; - hDirAC->azimuth[tmp_write_idx_band][b] = azi; - hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use - } - else - { - assert( idx_sec == 1 ); - hDirAC->elevation2[tmp_write_idx_band][b] = ele; - hDirAC->azimuth2[tmp_write_idx_band][b] = azi; - hDirAC->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; - } - } - else - { - hDirAC->elevation[tmp_write_idx_band][b] = ele; - hDirAC->azimuth[tmp_write_idx_band][b] = azi; - } - } - tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % hDirAC->dirac_md_buffer_length; - - } /* for ( block =...) */ - } /* for ( band = ...) */ - } /* for ( idx_sec = ...)*/ - - /* Bands not transmitted -> zeroed*/ - for ( b = band_grouping[band]; b < hDirAC->num_freq_bands; b++ ) - { - tmp_write_idx_band = hDirAC->dirac_bs_md_write_idx; - - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - - hDirAC->spreadCoherence[block][b] = 0.0f; - hDirAC->surroundingCoherence[block][b] = 0.0f; - hDirAC->energy_ratio1[block][b] = 0; - - hDirAC->elevation[tmp_write_idx_band][b] = 0; - hDirAC->azimuth[tmp_write_idx_band][b] = 0; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; - hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; - } - } - } - - /* update buffer write index */ - hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_set_md_map() - * - * Set metadata index mapping for DirAC - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_set_md_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nCldfbTs /* i : number of CLDFB time slots */ -) -{ - int16_t num_slots_in_subfr; - DIRAC_DEC_HANDLE hDirAC; - - hDirAC = st_ivas->hDirAC; -#ifdef DEBUGGING - assert( hDirAC ); -#endif - - /* adapt subframes */ - hDirAC->num_slots = nCldfbTs; - hDirAC->slots_rendered = 0; - num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; - hDirAC->subframes_rendered = 0; - - ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hDirAC->subframe_nbslots, &hDirAC->nb_subframes ); - - /* set mapping according to dirac_read_idx */ - - set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - -#ifdef FIX_470_MASA_JBM_EXT - if ( st_ivas->ivas_format == MASA_FORMAT ) - { - ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); - } - else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) -#else - if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) -#endif - { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); - } - else - { - ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hDirAC->dirac_read_idx, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); - } - - if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) - { - float tmp; - int16_t sf_idx, slot_idx, slot_idx_abs; - - slot_idx_abs = 0; - for ( sf_idx = 0; sf_idx < hDirAC->nb_subframes; sf_idx++ ) - { - tmp = 0.0f; - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[sf_idx]; slot_idx++ ) - { - tmp += (float) hDirAC->render_to_md_map[slot_idx_abs]; - slot_idx_abs++; - } - hDirAC->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) hDirAC->subframe_nbslots[sf_idx] ) + hDirAC->dirac_read_idx ) % hDirAC->dirac_md_buffer_length; - } - - set_s( &hDirAC->render_to_md_map[hDirAC->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - hDirAC->nb_subframes ); - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec() - * - * DirAC decoding process - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport /* i : number of transport channels */ -) -{ - int16_t subframe_idx; - float *output_f_local[MAX_OUTPUT_CHANNELS]; - float cng_td_buffer[L_FRAME16k]; - int16_t nchan_out, n, n_samples_sf; - nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; - - n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * st_ivas->hDirAC->slot_size; - - for ( n = 0; n < nchan_out; n++ ) - { - output_f_local[n] = &output_f[n][0]; - } - - for ( n = 0; n < nchan_transport; n++ ) - { - st_ivas->hTcBuffer->tc[n] = output_f[n]; - } - - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; - generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); - } - - ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); - for ( n = 0; n < nchan_out; n++ ) - { - output_f_local[n] += n_samples_sf; - } - } - - if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) - { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; - } - else - { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; - } - - for ( n = 0; n < nchan_transport; n++ ) - { - st_ivas->hTcBuffer->tc[n] = NULL; - } - - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) - { - st_ivas->hTcBuffer->tc[nchan_transport] = NULL; - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_render() - * - * DirAC decoding renderer process - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t nchan_transport, /* i : number of transport channels */ - 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 */ -) -{ - int16_t slots_to_render, first_sf, last_sf, subframe_idx; - uint16_t slot_size, n_samples_sf, ch, nchan_intern; - DIRAC_DEC_HANDLE hDirAC; - float *output_f_local[MAX_OUTPUT_CHANNELS]; - - hDirAC = st_ivas->hDirAC; - - nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; -#ifdef DEBUGGING - assert( hDirAC ); -#endif - for ( ch = 0; ch < nchan_intern; ch++ ) - { - output_f_local[ch] = output_f[ch]; - } - slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - - /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); - *nSamplesRendered = slots_to_render * slot_size; - first_sf = hDirAC->subframes_rendered; - last_sf = first_sf; - - while ( slots_to_render > 0 ) - { - slots_to_render -= hDirAC->subframe_nbslots[last_sf]; - last_sf++; - } - -#ifdef DEBUGGING - assert( slots_to_render == 0 ); -#endif - for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) - { - ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); - n_samples_sf = hDirAC->subframe_nbslots[subframe_idx] * st_ivas->hDirAC->slot_size; - for ( ch = 0; ch < nchan_intern; ch++ ) - { - output_f_local[ch] += n_samples_sf; - } - } - - if ( hDirAC->slots_rendered == hDirAC->num_slots ) - { - if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) - { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; - } - else - { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; - } - } - - *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec() - * - * DirAC decoding process - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_render_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport, /* i : number of transport channels */ - float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) -{ - int16_t i, ch, idx_in, idx_lfe; - DIRAC_DEC_HANDLE hDirAC; - float dirEne; - float surCohEner; - float surCohRatio[CLDFB_NO_CHANNELS_MAX]; - int16_t subframe_idx; - int16_t slot_idx, index_slot; - int16_t hodirac_flag; - float *p_Rmat; - int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; - - /*CLDFB: last output channels reserved to LFT for CICPx*/ - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT - float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif -#ifdef MASA_AND_OBJECTS - float Cldfb_RealBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ - float Cldfb_ImagBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ -#endif - int16_t index, num_freq_bands; - - /* local copies of azi, ele, diffuseness */ - int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; - int16_t elevation[CLDFB_NO_CHANNELS_MAX]; - float diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; - - DIRAC_DEC_STACK_MEM DirAC_mem; - float *reference_power, *reference_power_smooth; - float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; - uint16_t coherence_flag; - - push_wmops( "ivas_dirac_dec_render" ); - - /* Initialize aux buffers */ - hDirAC = st_ivas->hDirAC; - - DirAC_mem = st_ivas->hDirAC->stack_mem; - - reference_power = DirAC_mem.reference_power; - reference_power_smooth = DirAC_mem.reference_power + hDirAC->num_freq_bands; - onset_filter = DirAC_mem.onset_filter; -#ifdef FIX_614_ADD_TO_NULL_PTR_DIRAC_SETUP - onset_filter_subframe = ( DirAC_mem.onset_filter == NULL ) ? NULL : DirAC_mem.onset_filter + hDirAC->num_freq_bands; -#else - onset_filter_subframe = DirAC_mem.onset_filter + hDirAC->num_freq_bands; -#endif - - hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); - - if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) - { - coherence_flag = st_ivas->hQMetaData->coherence_flag; - } - else - { - coherence_flag = 0; - } - -#ifdef DEBUG_MODE_DIRAC - { - int16_t n, tmp[IVAS_SPAR_MAX_CH * L_FRAME48k]; - char file_name[50] = { 0 }; - const int16_t output_frame = st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - - for ( n = 0; n < nchan_transport; n++ ) - { - for ( i = 0; i < output_frame; i++ ) - { - tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); - } - } - sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); - dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); - } -#endif - - /* Subframe loop */ - slot_idx_start = hDirAC->slots_rendered; - slot_idx_start_cldfb_synth = 0; - - subframe_idx = hDirAC->subframes_rendered; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - md_idx = hDirAC->render_to_md_map[subframe_idx]; - } - else - { - md_idx = hDirAC->render_to_md_map[slot_idx_start]; - } - /* ToDo: Another workaround for self test BE */ - - /* copy parameters into local buffers*/ - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[subframe_idx]], azimuth, hDirAC->num_freq_bands ); - mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[subframe_idx]], elevation, hDirAC->num_freq_bands ); - mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[subframe_idx]], diffuseness_vector, hDirAC->num_freq_bands ); - } - else - { - set_zero( diffuseness_vector, hDirAC->num_freq_bands ); - } - - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - set_zero( reference_power_smooth, hDirAC->num_freq_bands ); - } - else - { - set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); - } - - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) - { - p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[subframe_idx][0][0]; - - if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); - } - } - } - else - { - p_Rmat = 0; - } - - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - /* compute response */ - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_power_factors( hDirAC->num_freq_bands, - diffuseness_vector, - hDirAC->h_output_synthesis_psd_params.max_band_decorr, - hDirAC->h_output_synthesis_psd_state.direct_power_factor, - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); - - if ( coherence_flag ) - { - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) - { - dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[md_idx][i]; - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; - hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; - - surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); - } - } - else - { - set_zero( surCohRatio, hDirAC->num_freq_bands ); - } - } - else - { - ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands, - hDirAC->diffuseness_vector[md_idx], - hDirAC->h_output_synthesis_psd_params.max_band_decorr, - hDirAC->h_output_synthesis_psd_state.direct_power_factor, - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); - - if ( coherence_flag ) - { - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) - { - surCohRatio[i] = hDirAC->surroundingCoherence[md_idx][i]; - } - } - else - { - set_zero( surCohRatio, hDirAC->num_freq_bands ); - } - } - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) - { - ivas_dirac_dec_compute_directional_responses( hDirAC, - st_ivas->hVBAPdata, - st_ivas->hMasa, -#ifdef MASA_AND_OBJECTS - st_ivas->hMasaIsmData, -#endif - azimuth, - elevation, - md_idx, - surCohRatio, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat, - hodirac_flag ); - } - else - { - ivas_dirac_dec_compute_directional_responses( hDirAC, - st_ivas->hVBAPdata, - st_ivas->hMasa, -#ifdef MASA_AND_OBJECTS - st_ivas->hMasaIsmData, -#endif - azimuth, - elevation, - md_idx, - surCohRatio, - 0, - NULL, - hodirac_flag ); - } - } - -#ifdef MASA_AND_OBJECTS - // Todo OMASA JBM: This might need adjustments - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) - { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = slot_idx_start + slot_idx; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer_Temp[ch][slot_idx], - Cldfb_ImagBuffer_Temp[ch][slot_idx], - hDirAC->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); - } - } - - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) - { - preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, hDirAC->num_freq_bands, subframe_idx ); - } - } -#endif - - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = slot_idx_start + slot_idx; - if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - md_idx = hDirAC->render_to_md_map[index_slot]; - } - else - { - md_idx = hDirAC->render_to_md_map[subframe_idx]; - } - - if ( st_ivas->ivas_format == SBA_FORMAT ) - { - for ( ch = 0; ch < nchan_transport; ch++ ) - { - mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); - mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); - } - } -#ifdef MASA_AND_OBJECTS - // Todo OMASA JBM: This might need adjustments - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) - { - for ( ch = 0; ch < nchan_transport; ch++ ) - { - mvr2r( Cldfb_RealBuffer_Temp[ch][slot_idx], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Temp[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); - } - } -#endif - else - { - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hDirAC->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); - } - } - - /* CNG in DirAC, extra CLDFB ana for CNA*/ - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - - generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], - st_ivas->hTcBuffer->tc[1], - Cldfb_RealBuffer[1][0], - Cldfb_ImagBuffer[1][0], - index_slot, - st->cna_dirac_flag && st->flag_cna, - ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); - } - - /* LFE synthesis */ - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled && !( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirAC->hOutSetup.num_lfe == 0 ) ) - { - ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, - Cldfb_RealBuffer, Cldfb_ImagBuffer, - Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], - slot_idx, - md_idx, - nchan_transport ); - } - - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ - - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) - { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - p_Rmat ); - } - else - { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - 0 ); - } - } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) - { - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - 0, slot_idx, hDirAC->num_freq_bands, hDirAC->masa_stereo_type_detect ); - } - else - { - switch ( nchan_transport ) - { - case 11: - case 8: - case 6: - case 4: - protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - hDirAC->hoa_decoder, - nchan_transport, - hDirAC->sba_map_tc ); - break; - case 2: - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - hDirAC->hOutSetup.is_loudspeaker_setup, - slot_idx, - hDirAC->num_freq_bands, - hDirAC->masa_stereo_type_detect ); - break; - case 1: - protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, - hDirAC->num_protos_diff, - hDirAC->num_freq_bands ); - break; - default: - return; - } - } - - - /*-----------------------------------------------------------------* - * Compute DirAC parameters at decoder side - *-----------------------------------------------------------------*/ - - if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - mvs2s( &hDirAC->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], hDirAC->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - mvs2s( &hDirAC->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], hDirAC->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); - } - - hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ - - index = hDirAC->index_buffer_intensity; - - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - - computeIntensityVector_dec( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - num_freq_bands, - hDirAC->buffer_intensity_real[0][index - 1], - hDirAC->buffer_intensity_real[1][index - 1], - hDirAC->buffer_intensity_real[2][index - 1] ); - - computeDirectionAngles( hDirAC->buffer_intensity_real[0][index - 1], - hDirAC->buffer_intensity_real[1][index - 1], - hDirAC->buffer_intensity_real[2][index - 1], - num_freq_bands, - azimuth, - elevation ); - - mvr2r( reference_power, &( hDirAC->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - - computeDiffuseness( hDirAC->buffer_intensity_real, hDirAC->buffer_energy, num_freq_bands, hDirAC->diffuseness_vector[md_idx] ); - } - -#ifdef DEBUG_MODE_DIRAC - { - static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; - - - if ( fp_direction_vector == NULL ) - fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); - if ( fp_diffuseness == NULL ) - fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); - if ( fp_referencePower == NULL ) - fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); - - - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) - { - float radius_length; - float dv[3]; - - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); - dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); - dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - - fwrite( dv, sizeof( float ), 3, fp_direction_vector ); - fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; - } - fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); - } - else - { - radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); - dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); - dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); - dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); - - fwrite( dv, sizeof( float ), 3, fp_direction_vector ); - fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); - fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); - } - } - } -#endif - - /*-----------------------------------------------------------------* - * frequency domain decorrelation - *-----------------------------------------------------------------*/ - - if ( hDirAC->proto_signal_decorr_on == 1 ) - { - /* decorrelate prototype frame */ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - nchan_transport, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff + 2 * hDirAC->num_freq_bands * min( 4, nchan_transport ), - onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); - - v_multc( onset_filter, 0.25f, onset_filter, hDirAC->num_freq_bands ); - v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hDirAC->num_freq_bands ); - p_onset_filter = onset_filter_subframe; - } - else - { - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - nchan_transport, - hDirAC->proto_frame_f, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, - DirAC_mem.frame_dec_f, - onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); - - hDirAC->proto_frame_dec_f = DirAC_mem.frame_dec_f; - p_onset_filter = onset_filter; - } - } - else - { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - set_f( onset_filter_subframe, 1.f, hDirAC->num_freq_bands ); - p_onset_filter = onset_filter_subframe; - } - else - { - /* no frequency domain decorrelation: use prototype frame */ - hDirAC->proto_frame_dec_f = hDirAC->proto_frame_f; - p_onset_filter = NULL; - } - } - - /*-----------------------------------------------------------------* - * output synthesis - *-----------------------------------------------------------------*/ - - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) - { - /*Compute diffuse prototypes*/ - ivas_dirac_dec_compute_diffuse_proto( hDirAC, slot_idx ); - } - - /*Compute PSDs*/ - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth, - elevation, - hDirAC->diffuseness_vector[md_idx], - hDirAC, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag ); - } - else - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth, - elevation, - hDirAC->diffuseness_vector[md_idx], - hDirAC, - 0, - 0, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag ); - } - - if ( hDirAC->hConfig->dec_param_estim ) - { - float fac = 1.0f / (float) hDirAC->subframe_nbslots[subframe_idx]; - v_multc_acc( hDirAC->diffuseness_vector[md_idx], fac, diffuseness_vector, hDirAC->num_freq_bands ); - } - - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); - } - } - - ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); - - - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hDirAC, - nchan_transport, - hDirAC->subframe_nbslots[subframe_idx], - p_onset_filter, - diffuseness_vector, - hodirac_flag ); - } - else - { - /* Determine encoding quality based additional smoothing factor */ - float qualityBasedSmFactor = 1.0f; - - if ( st_ivas->hMasa != NULL ) - { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; - } - - - ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hDirAC, - hDirAC->subframe_nbslots[subframe_idx], - diffuseness_vector, - reference_power_smooth, - qualityBasedSmFactor ); - } - - /*-----------------------------------------------------------------* - * CLDFB synthesis (and binaural rendering) - *-----------------------------------------------------------------*/ - - index_slot = slot_idx_start_cldfb_synth; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - /* Perform binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef SPLIT_REND_WITH_HEAD_ROT - &st_ivas->splitBinRend.splitrend.multiBinPoseData, -#endif - st_ivas->hCombinedOrientationData, - subframe_idx, - hDirAC->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - Cldfb_RealBuffer, - Cldfb_ImagBuffer ); - -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - int16_t pos_idx; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) -#else - for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) -#endif - { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { - mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hDirAC->num_freq_bands ); - } - } - } - } -#endif - /* Inverse CLDFB*/ - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; -#else - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; -#endif - } - - cldfbSynthesis( RealBuffer, - ImagBuffer, - &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], - st_ivas->cldfbSynDec[ch] ); - } - } - else if ( st_ivas->ivas_format == SBA_FORMAT ) - { - for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) - { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hDirAC->num_freq_bands ); - } - } - } - else - { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t outchannels; - - idx_in = 0; - idx_lfe = 0; - - outchannels = hDirAC->hOutSetup.nchan_out_woLFE + hDirAC->hOutSetup.num_lfe; - if ( hDirAC->hOutSetup.separateChannelEnabled && ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || - ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) - { - outchannels++; - } - - if ( hDirAC->hOutSetup.separateChannelEnabled && hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) - { - float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - const int16_t subframe_start_sample = index_slot * hDirAC->num_freq_bands; - const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx]; + if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) + { + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; + } + else + { + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + } - /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ - mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; - for ( ch = 0; ch < outchannels; ch++ ) - { - if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - /* Move the LFE channel to the correct place */ - mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; - if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) - { - /* Move the separated channel to the correct place. Thus, the separated channel is - * combined with the synthesized channels here when there is a matching channel. */ - mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + if ( hodirac_flag ) + { + if ( idx_sec == 0 ) + { + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi; + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use + } + else + { + assert( idx_sec == 1 ); + hSpatParamRendCom->elevation2[tmp_write_idx_band][b] = ele; + hSpatParamRendCom->azimuth2[tmp_write_idx_band][b] = azi; + hSpatParamRendCom->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; + } + } + else + { + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi; + } } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); + tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; - if ( !st_ivas->hLsSetupCustom->separate_ch_found ) - { - /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel - * is combined with the synthesized channels here when there is no matching channel. */ - v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } + } /* for ( block =...) */ + } /* for ( band = ...) */ + } /* for ( idx_sec = ...)*/ - idx_in++; - } - } - } - else + /* Bands not transmitted -> zeroed*/ + for ( b = band_grouping[band]; b < hSpatParamRendCom->num_freq_bands; b++ ) { - for ( ch = 0; ch < outchannels; ch++ ) + tmp_write_idx_band = hSpatParamRendCom->dirac_bs_md_write_idx; + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled ) - { - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); - } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) - { - /* LFE has been synthesized in the time domain, do nothing. */ - } - else - { - set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); - } - if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( hDirAC->hOutSetup.separateChannelEnabled ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) - { - /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated - * channel is combined with the synthesized channels here. */ - } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); - idx_in++; - } + hSpatParamRendCom->spreadCoherence[block][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[block][b] = 0.0f; + hSpatParamRendCom->energy_ratio1[block][b] = 0; + + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = 0; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + hSpatParamRendCom->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hSpatParamRendCom->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } } - hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; - hDirAC->subframes_rendered++; - pop_wmops(); + /* update buffer write index */ + hSpatParamRendCom->dirac_bs_md_write_idx = ( hSpatParamRendCom->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; return; } /*------------------------------------------------------------------------- - * compute_hoa_encoder_mtx() - * + * ivas_dirac_dec_set_md_map() * + * Set metadata index mapping for DirAC *------------------------------------------------------------------------*/ -void compute_hoa_encoder_mtx( - const float *azimuth, - const float *elevation, - float *response, - const int16_t num_responses, - const int16_t ambisonics_order ) +void ivas_dirac_dec_set_md_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nCldfbTs /* i : number of CLDFB time slots */ +) { - int16_t k, num_sh; + int16_t num_slots_in_subfr; + DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - num_sh = ivas_sba_get_nchan( ambisonics_order, 0 ); + hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; +#ifdef DEBUGGING + assert( hDirAC ); + assert( hSpatParamRendCom ); +#endif + + /* adapt subframes */ + hSpatParamRendCom->num_slots = nCldfbTs; + hSpatParamRendCom->slots_rendered = 0; + num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + hSpatParamRendCom->subframes_rendered = 0; + + ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hSpatParamRendCom->subframe_nbslots, &hSpatParamRendCom->nb_subframes ); + + /* set mapping according to dirac_read_idx */ + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + +#ifdef FIX_470_MASA_JBM_EXT + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); + } + else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) +#else + if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) +#endif + { + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); + } + else + { + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hSpatParamRendCom->dirac_read_idx, hSpatParamRendCom->dirac_md_buffer_length, hSpatParamRendCom->render_to_md_map ); + } - for ( k = 0; k < num_responses; k++ ) + if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) { - ivas_dirac_dec_get_response( (const int16_t) azimuth[k], (const int16_t) elevation[k], &response[k * num_sh], ambisonics_order ); + float tmp; + int16_t sf_idx, slot_idx, slot_idx_abs; + + slot_idx_abs = 0; + for ( sf_idx = 0; sf_idx < hSpatParamRendCom->nb_subframes; sf_idx++ ) + { + tmp = 0.0f; + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[sf_idx]; slot_idx++ ) + { + tmp += (float) hSpatParamRendCom->render_to_md_map[slot_idx_abs]; + slot_idx_abs++; + } + hSpatParamRendCom->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) hSpatParamRendCom->subframe_nbslots[sf_idx] ) + hSpatParamRendCom->dirac_read_idx ) % hSpatParamRendCom->dirac_md_buffer_length; + } + + set_s( &hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - hSpatParamRendCom->nb_subframes ); } return; @@ -3236,1138 +1569,1012 @@ void compute_hoa_encoder_mtx( /*------------------------------------------------------------------------- - * ivas_dirac_dec_get_frequency_axis() + * ivas_dirac_dec() * - * DirAC decoding initialization + * DirAC decoding process *------------------------------------------------------------------------*/ -void ivas_dirac_dec_get_frequency_axis( - float *frequency_axis, - const int32_t output_Fs, - const int16_t num_freq_bands ) +void ivas_dirac_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ +) { - int16_t k; - float const_part; + int16_t subframe_idx; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + float cng_td_buffer[L_FRAME16k]; + int16_t nchan_out, n, n_samples_sf; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - /* calc cldfb frequency axis */ - const_part = (float) output_Fs / ( 2.0f * (float) num_freq_bands ); - for ( k = 0; k < num_freq_bands; ++k ) + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + + n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * hSpatParamRendCom->slot_size; + + for ( n = 0; n < nchan_out; n++ ) { - frequency_axis[k] = ( (float) k + 0.5f ) * const_part; + output_f_local[n] = &output_f[n][0]; } - return; -} + for ( n = 0; n < nchan_transport; n++ ) + { + st_ivas->hTcBuffer->tc[n] = output_f[n]; + } + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) + { + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; + generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); + } -/*------------------------------------------------------------------------- - * Local functions - *-------------------------------------------------------------------------*/ + ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -static void initDiffuseResponses( - float *diffuse_response_function, - const int16_t num_channels, - AUDIO_CONFIG output_config, - IVAS_OUTPUT_SETUP hOutSetup, - const int16_t ambisonics_order, - const IVAS_FORMAT ivas_format, - int16_t *num_ele_spk_no_diffuse_rendering, - AUDIO_CONFIG transport_config ) -{ - int16_t i, l, k, idx, num_horizontal_speakers; - *num_ele_spk_no_diffuse_rendering = 0; + for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) + { + ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + for ( n = 0; n < nchan_out; n++ ) + { + output_f_local[n] += n_samples_sf; + } + } - if ( output_config == AUDIO_CONFIG_MONO ) + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - diffuse_response_function[0] = 1.0f; - diffuse_response_function[1] = inv_sqrt( 3.0f ); + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } - else if ( !( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) ) + else { - /* set diffuse response function */ - if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_5_1_4 ) - { - num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; - - mvr2r( diffuse_response_CICP6, diffuse_response_function, num_horizontal_speakers ); - set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); - *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; - } - else if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_7_1_4 ) - { - num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; + } - set_f( diffuse_response_function, sqrtf( 1.f / ( (float) num_horizontal_speakers ) ), num_horizontal_speakers ); - set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); - *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; - } -#ifdef MASA_AND_OBJECTS - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) -#else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) -#endif - { - mvr2r( diffuse_response_CICP6, diffuse_response_function, num_channels ); - } -#ifdef MASA_AND_OBJECTS - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_2 ) && ( num_channels == 7 ) ) -#else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) -#endif - { - mvr2r( diffuse_response_CICP14, diffuse_response_function, num_channels ); - } -#ifdef MASA_AND_OBJECTS - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) -#else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) -#endif - { - mvr2r( diffuse_response_CICP16, diffuse_response_function, num_channels ); - } -#ifdef MASA_AND_OBJECTS - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) -#else - else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) -#endif - { - if ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) - { - /* Detect loudspeakers with elevation */ - for ( i = 0, num_horizontal_speakers = 0; i < num_channels; i++ ) - { - if ( fabsf( hOutSetup.ls_elevation[i] ) <= 5.f ) - { - num_horizontal_speakers++; - diffuse_response_function[i] = 1.f; - } - else - { - *num_ele_spk_no_diffuse_rendering += 1; - diffuse_response_function[i] = 0.f; - } - } - /* Diffuse only to horizontal plane if enough loudspeakers */ - if ( num_horizontal_speakers > 2 ) - { - for ( i = 0; i < num_channels; i++ ) - { - diffuse_response_function[i] *= sqrtf( 1.f / (float) num_horizontal_speakers ); - } - } - else - { - *num_ele_spk_no_diffuse_rendering = 0; - set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); - } - } - else - { - set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); - } - } - else - { - set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); - } + for ( n = 0; n < nchan_transport; n++ ) + { + st_ivas->hTcBuffer->tc[n] = NULL; } - else + + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) { - idx = 0; - for ( l = 0; l <= ambisonics_order; l++ ) - { - for ( k = 0; k < ( 2 * l + 1 ); k++ ) - { - diffuse_response_function[idx++] = inv_sqrt( 2.0f * l + 1.0f ); - } - } + st_ivas->hTcBuffer->tc[nchan_transport] = NULL; } return; } -static void protoSignalComputation_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_direct_buffer_f, - float *proto_diffuse_buffer_f, - float *reference_power, - const int16_t slot_index, - const int16_t num_inputs, - const int16_t num_outputs_diff, - const int16_t num_freq_bands, - float *p_Rmat ) -{ - int16_t l, k; - float *p_proto_direct_buffer; - float *p_proto_diffuse_buffer; - int16_t Rmat_k[4]; - float W_real, W_imag; - float Y_real, Y_imag; - float *p_k[4]; +/*------------------------------------------------------------------------- + * ivas_dirac_dec_render() + * + * DirAC decoding renderer process + *------------------------------------------------------------------------*/ - k = 0; /* to avoid compilation warning */ +void ivas_dirac_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + 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 */ +) +{ + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, n_samples_sf, ch, nchan_intern; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + float *output_f_local[MAX_OUTPUT_CHANNELS]; - p_proto_direct_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_inputs; - p_proto_diffuse_buffer = proto_diffuse_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; - if ( num_inputs == 1 ) + nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; +#ifdef DEBUGGING + assert( hSpatParamRendCom ); +#endif + for ( ch = 0; ch < nchan_intern; ch++ ) { - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_direct_buffer[2 * l] = RealBuffer[0][0][l]; - p_proto_direct_buffer[2 * l + 1] = ImagBuffer[0][0][l]; - } + output_f_local[ch] = output_f[ch]; } - else if ( num_inputs == 2 ) - { - if ( p_Rmat != 0 ) - { - assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - for ( l = 0; l < num_freq_bands; l++ ) - { - W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = hSpatParamRendCom->subframes_rendered; + last_sf = first_sf; - Y_real = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - Y_imag = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + while ( slots_to_render > 0 ) + { + slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; + last_sf++; + } - p_proto_direct_buffer[2 * l] = W_real; - p_proto_direct_buffer[2 * l + 1] = W_imag; - p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = p_Rmat[0] * Y_real; - p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = p_Rmat[0] * Y_imag; - } - } - else +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + n_samples_sf = hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->slot_size; + for ( ch = 0; ch < nchan_intern; ch++ ) { - for ( l = 0; l < num_freq_bands; l++ ) - { - W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - p_proto_direct_buffer[2 * l] = W_real; - p_proto_direct_buffer[2 * l + 1] = W_imag; - { - p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - } - } + output_f_local[ch] += n_samples_sf; } } - else if ( num_inputs >= 4 ) + + if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { - p_k[0] = p_proto_direct_buffer; - p_k[1] = p_proto_direct_buffer + 2 * num_freq_bands; - p_k[2] = p_proto_direct_buffer + 4 * num_freq_bands; - p_k[3] = p_proto_direct_buffer + 6 * num_freq_bands; - Rmat_k[0] = 0; - Rmat_k[1] = 1; - Rmat_k[2] = 2; - Rmat_k[3] = 0; - - if ( p_Rmat != 0 ) + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); - - for ( l = 0; l < num_freq_bands; l++ ) - { - *( p_k[0] ) = RealBuffer[0][0][l]; - reference_power[l + num_freq_bands] = *( p_k[0] ) * *( p_k[0] ); - p_k[0]++; - *( p_k[0] ) = ImagBuffer[0][0][l]; - reference_power[l + num_freq_bands] += *( p_k[0] ) * *( p_k[0] ); - p_k[0]++; - reference_power[l] = 0.5f * reference_power[l + num_freq_bands]; - - for ( k = 1; k < 4; k++ ) - { - *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * RealBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * RealBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * RealBuffer[3][0][l]; - reference_power[l + ( k + 1 ) * num_freq_bands] = *( p_k[k] ) * *( p_k[k] ); - p_k[k]++; - *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * ImagBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * ImagBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * ImagBuffer[3][0][l]; - reference_power[l + ( k + 1 ) * num_freq_bands] += *( p_k[k] ) * *( p_k[k] ); - p_k[k]++; - reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); - } - - for ( k = 1; k < 4; k++ ) - { - RealBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l]; - ImagBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1]; - } - } + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - set_zero( reference_power, num_freq_bands ); - for ( k = 0; k < 4; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; - reference_power[l + ( k + 1 ) * num_freq_bands] = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; - reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); - } - } - } - - /* Additional transport channels = planar SBA components of degree higher than 1*/ - for ( ; k < num_inputs; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; - p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; - } + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } } - - /*Copy direct to diffuse proto*/ - mvr2r( p_proto_direct_buffer, p_proto_diffuse_buffer, 2 * num_freq_bands * min( num_outputs_diff, num_inputs ) ); - - if ( num_inputs == 1 ) - { - /* Add comfort noise addition (CNA) to diffuse proto only*/ - for ( l = 0; l < num_freq_bands; l++ ) - { - p_proto_diffuse_buffer[2 * l] += RealBuffer[1][0][l]; - p_proto_diffuse_buffer[2 * l + 1] += ImagBuffer[1][0][l]; - } - } + *nSamplesAvailable = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered ) * slot_size; return; } -static void protoSignalComputation1( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_frame_f, - float *proto_direct_buffer_f, - float *reference_power, - float *proto_power_smooth, - const int16_t slot_index, - const int16_t num_outputs_diff, - const int16_t num_freq_bands ) -{ - int16_t l, k; - float *p_proto_buffer; - - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands; - - for ( l = 0; l < num_freq_bands; l++ ) - { - reference_power[l] = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - proto_power_smooth[l] += reference_power[l]; - p_proto_buffer[2 * l] = RealBuffer[0][0][l]; - p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; - - for ( k = 0; k < num_outputs_diff; k++ ) - { - proto_frame_f[2 * k * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * k * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - } - } +/*------------------------------------------------------------------------- + * ivas_dirac_dec() + * + * DirAC decoding process + *------------------------------------------------------------------------*/ - return; -} +void ivas_dirac_dec_render_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport, /* i : number of transport channels */ + float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], + float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) +{ + int16_t i, ch, idx_in, idx_lfe; + DIRAC_DEC_HANDLE hDirAC; + DIRAC_REND_HANDLE hDirACRend; + float dirEne; + float surCohEner; + float surCohRatio[CLDFB_NO_CHANNELS_MAX]; + int16_t subframe_idx; + int16_t slot_idx, index_slot; + int16_t hodirac_flag; + float *p_Rmat; + int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; + /*CLDFB: last output channels reserved to LFT for CICPx*/ + float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#ifdef SPLIT_REND_WITH_HEAD_ROT + float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#else + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif +#ifdef MASA_AND_OBJECTS + float Cldfb_RealBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ + float Cldfb_ImagBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /* Todo Nokia: Temporary, to be removed once function calls have been refactored to accept another size */ +#endif + int16_t index, num_freq_bands; -static void protoSignalComputation2( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_frame_f, - float *proto_direct_buffer_f, - float *reference_power, - float *proto_power_smooth, - const int16_t isloudspeaker, - const int16_t slot_index, - const int16_t num_freq_bands, - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -{ - int16_t l; - float *p_proto_buffer; - float Real_aux, Imag_aux; + /* local copies of azi, ele, diffuseness */ + int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; + int16_t elevation[CLDFB_NO_CHANNELS_MAX]; + float diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; - float left_bb_power, right_bb_power, total_bb_power, lr_bb_power; - float lr_total_bb_ratio; - float a, b; + DIRAC_DEC_STACK_MEM DirAC_mem; + float *reference_power, *reference_power_smooth; + float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; + uint16_t coherence_flag; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - float left_hi_power, right_hi_power, total_hi_power, lr_hi_power; - float lr_total_hi_ratio; - float a2, b2; + push_wmops( "ivas_dirac_dec_render" ); - float sum_power; - float sum_total_ratio[MASA_SUM_FREQ_RANGE_BINS]; - float min_sum_total_ratio; - float min_sum_total_ratio_db; + /* Initialize aux buffers */ + hDirAC = st_ivas->hDirAC; + hDirACRend = st_ivas->hDirACRend; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; - float RealSubtract, ImagSubtract; + DirAC_mem = hDirACRend->stack_mem; - float interpolatorSpaced = 0.0f; - float interpolatorDmx = 1.0f; + reference_power = DirAC_mem.reference_power; + reference_power_smooth = DirAC_mem.reference_power + hSpatParamRendCom->num_freq_bands; + onset_filter = DirAC_mem.onset_filter; +#ifdef FIX_614_ADD_TO_NULL_PTR_DIRAC_SETUP + onset_filter_subframe = ( DirAC_mem.onset_filter == NULL ) ? NULL : DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands; +#else + onset_filter_subframe = DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands; +#endif - int16_t dipole_freq_range[2]; - float tempSpaced, tempDmx; + hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); - if ( isloudspeaker ) + if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) { - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 3; - - for ( l = 0; l < num_freq_bands; l++ ) - { - float Left_power; - float Right_power; - Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; - - reference_power[l] = Left_power + Right_power; - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - proto_power_smooth[l + num_freq_bands] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - - proto_power_smooth[l + 2 * num_freq_bands] += RealBuffer[1][0][l] * RealBuffer[1][0][l]; - proto_power_smooth[l + 2 * num_freq_bands] += ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; - p_proto_buffer[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - p_proto_buffer[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; - - proto_frame_f[2 * l] = Real_aux; - proto_frame_f[2 * l + 1] = Imag_aux; - - proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; - } + coherence_flag = st_ivas->hQMetaData->coherence_flag; } - else if ( stereo_type_detect != NULL ) + else { - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; - - left_bb_power = 0.0f; - right_bb_power = 0.0f; - total_bb_power = 0.0f; - - left_hi_power = 0.0f; - right_hi_power = 0.0f; - total_hi_power = 0.0f; - - dipole_freq_range[0] = stereo_type_detect->dipole_freq_range[0]; - dipole_freq_range[1] = stereo_type_detect->dipole_freq_range[1]; + coherence_flag = 0; + } - a = 0.01f; /* Temporal smoothing coefficient */ - b = 1.0f - a; /* Temporal smoothing coefficient */ - a2 = 0.1f; /* Temporal smoothing coefficient */ - b2 = 1.0f - a2; /* Temporal smoothing coefficient */ +#ifdef DEBUG_MODE_DIRAC + { + int16_t n, tmp[IVAS_SPAR_MAX_CH * L_FRAME48k]; + char file_name[50] = { 0 }; + const int16_t output_frame = st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - if ( stereo_type_detect->interpolator > 0 ) + for ( n = 0; n < nchan_transport; n++ ) { - if ( stereo_type_detect->type_change_direction == MASA_STEREO_SPACED_MICS ) - { - interpolatorSpaced = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); - interpolatorDmx = 1.0f - interpolatorSpaced; - } - else + for ( i = 0; i < output_frame; i++ ) { - interpolatorDmx = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); - interpolatorSpaced = 1.0f - interpolatorDmx; + tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); } } + sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); + dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); + } +#endif - for ( l = 0; l < num_freq_bands; l++ ) - { - float Left_power; - float Right_power; - - /* Compute sum signal */ - Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - /* Compute reference power */ - Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; - - reference_power[l] = Left_power + Right_power; - - left_bb_power += Left_power; - right_bb_power += Right_power; - total_bb_power += reference_power[l]; + /* Subframe loop */ + slot_idx_start = hSpatParamRendCom->slots_rendered; + slot_idx_start_cldfb_synth = 0; - if ( l > MASA_HI_FREQ_START_BIN ) - { - left_hi_power += Left_power; - right_hi_power += Right_power; - total_hi_power += reference_power[l]; - } + subframe_idx = hSpatParamRendCom->subframes_rendered; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; + } + else + { + md_idx = hSpatParamRendCom->render_to_md_map[slot_idx_start]; + } + /* ToDo: Another workaround for self test BE */ - if ( l < min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) - { - sum_power = Real_aux * Real_aux + Imag_aux * Imag_aux; + /* copy parameters into local buffers*/ + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + mvs2s( hSpatParamRendCom->azimuth[hSpatParamRendCom->render_to_md_map[subframe_idx]], azimuth, hSpatParamRendCom->num_freq_bands ); + mvs2s( hSpatParamRendCom->elevation[hSpatParamRendCom->render_to_md_map[subframe_idx]], elevation, hSpatParamRendCom->num_freq_bands ); + mvr2r( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + } + else + { + set_zero( diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + } - stereo_type_detect->sum_power[l] = a * sum_power + b * stereo_type_detect->sum_power[l]; - stereo_type_detect->total_power[l] = a * reference_power[l] + b * stereo_type_detect->total_power[l]; + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + set_zero( reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + } + else + { + set_zero( onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); + } - sum_total_ratio[l] = stereo_type_detect->sum_power[l] / ( stereo_type_detect->total_power[l] + EPSILON ); - } + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) + { + p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[subframe_idx][0][0]; - if ( l == 0 ) + if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + { + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - RealSubtract = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - ImagSubtract = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - stereo_type_detect->subtract_power_y += RealSubtract * RealSubtract + ImagSubtract * ImagSubtract; + rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat ); } + } + } + else + { + p_Rmat = 0; + } - /* Compute protos (and their power) for direct sound rendering */ + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + /* compute response */ + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_power_factors( hSpatParamRendCom->num_freq_bands, + diffuseness_vector, + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); - /* W prototype */ - if ( stereo_type_detect->interpolator > 0 ) - { - if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) - { - Real_aux = interpolatorSpaced * 0.5f * Real_aux + interpolatorDmx * Real_aux; - Imag_aux = interpolatorSpaced * 0.5f * Imag_aux + interpolatorDmx * Imag_aux; - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - } - else - { - tempSpaced = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - tempDmx = Real_aux * Real_aux + Imag_aux * Imag_aux; - proto_power_smooth[l] += interpolatorSpaced * tempSpaced + interpolatorDmx * tempDmx; - p_proto_buffer[2 * l] = interpolatorSpaced * RealBuffer[0][0][l] + interpolatorDmx * Real_aux; - p_proto_buffer[2 * l + 1] = interpolatorSpaced * ImagBuffer[0][0][l] + interpolatorDmx * Imag_aux; - } - } - else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + if ( coherence_flag ) { - if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) - { - Real_aux *= 0.5f; - Imag_aux *= 0.5f; - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - } - else + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - proto_power_smooth[l] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; - p_proto_buffer[2 * l] = RealBuffer[0][0][l]; - p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i]; + surCohEner = hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] * hSpatParamRendCom->surroundingCoherence[md_idx][i]; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; + + surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); } } else { - proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; + set_zero( surCohRatio, hSpatParamRendCom->num_freq_bands ); } + } + else + { + ivas_dirac_dec_compute_gain_factors( hSpatParamRendCom->num_freq_bands, + hSpatParamRendCom->diffuseness_vector[md_idx], + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); - /* Y prototype */ - if ( stereo_type_detect->interpolator > 0 ) - { - if ( l < ( dipole_freq_range[0] ) ) - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - } - else if ( l < ( dipole_freq_range[1] ) ) - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ) + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * ( -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ) ) + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - } - else - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - } - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; - } - else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + if ( coherence_flag ) { - if ( l < ( dipole_freq_range[0] ) ) /* proto = W */ - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; - proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; - } - else if ( l < ( dipole_freq_range[1] ) ) /* proto = -i * (x1-x2) * eq */ - { - p_proto_buffer[2 * num_freq_bands + 2 * l] = ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; - } - else /* proto = W */ + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; - proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; + surCohRatio[i] = hSpatParamRendCom->surroundingCoherence[md_idx][i]; } } else { - p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + set_zero( surCohRatio, hSpatParamRendCom->num_freq_bands ); } - - /* Compute protos for decorrelation */ - proto_frame_f[2 * l] = Real_aux; - proto_frame_f[2 * l + 1] = Imag_aux; - proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; } - - if ( stereo_type_detect->interpolator > 0 ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) { - stereo_type_detect->interpolator++; - if ( stereo_type_detect->interpolator == MASA_STEREO_INTERPOLATION_SLOTS ) - { - stereo_type_detect->interpolator = 0; - stereo_type_detect->current_stereo_type = stereo_type_detect->type_change_direction; - } + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + st_ivas->hVBAPdata, + st_ivas->hMasa, +#ifdef MASA_AND_OBJECTS + st_ivas->hMasaIsmData, +#endif + azimuth, + elevation, + md_idx, + surCohRatio, + st_ivas->hCombinedOrientationData->shd_rot_max_order, + p_Rmat, + hodirac_flag ); + } + else + { + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + st_ivas->hVBAPdata, + st_ivas->hMasa, +#ifdef MASA_AND_OBJECTS + st_ivas->hMasaIsmData, +#endif + azimuth, + elevation, + md_idx, + surCohRatio, + 0, + NULL, + hodirac_flag ); } - - stereo_type_detect->left_bb_power = a * left_bb_power + b * stereo_type_detect->left_bb_power; - stereo_type_detect->right_bb_power = a * right_bb_power + b * stereo_type_detect->right_bb_power; - stereo_type_detect->total_bb_power = a * total_bb_power + b * stereo_type_detect->total_bb_power; - - lr_bb_power = ( stereo_type_detect->left_bb_power < stereo_type_detect->right_bb_power ) ? stereo_type_detect->left_bb_power : stereo_type_detect->right_bb_power; - lr_bb_power *= 2.0f; - lr_total_bb_ratio = 10.0f * log10f( lr_bb_power / ( stereo_type_detect->total_bb_power + EPSILON ) ); - - stereo_type_detect->left_hi_power = a2 * left_hi_power + b2 * stereo_type_detect->left_hi_power; - stereo_type_detect->right_hi_power = a2 * right_hi_power + b2 * stereo_type_detect->right_hi_power; - stereo_type_detect->total_hi_power = a2 * total_hi_power + b2 * stereo_type_detect->total_hi_power; - - lr_hi_power = ( stereo_type_detect->left_hi_power < stereo_type_detect->right_hi_power ) ? stereo_type_detect->left_hi_power : stereo_type_detect->right_hi_power; - lr_hi_power *= 2.0f; - lr_total_hi_ratio = 10.0f * log10f( lr_hi_power / ( stereo_type_detect->total_hi_power + EPSILON ) ); - - minimum( sum_total_ratio, min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ), &min_sum_total_ratio ); - min_sum_total_ratio_db = 10.0f * log10f( min_sum_total_ratio ); - - stereo_type_detect->lr_total_bb_ratio_db = lr_total_bb_ratio; - stereo_type_detect->lr_total_hi_ratio_db = lr_total_hi_ratio; - stereo_type_detect->min_sum_total_ratio_db = min_sum_total_ratio_db; - - ivas_masa_stereotype_detection( stereo_type_detect ); } - else - { - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; - for ( l = 0; l < num_freq_bands; l++ ) +#ifdef MASA_AND_OBJECTS + // Todo OMASA JBM: This might need adjustments + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) + { + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; - Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; - - reference_power[l] = Real_aux * Real_aux + Imag_aux * Imag_aux; - proto_power_smooth[l] += reference_power[l]; - p_proto_buffer[2 * l] = Real_aux; - p_proto_buffer[2 * l + 1] = Imag_aux; - - p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; - p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; - proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + index_slot = slot_idx_start + slot_idx; - proto_frame_f[2 * l] = Real_aux; - proto_frame_f[2 * l + 1] = Imag_aux; + /* CLDFB Analysis*/ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][hSpatParamRendCom->num_freq_bands * index_slot] ), + Cldfb_RealBuffer_Temp[ch][slot_idx], + Cldfb_ImagBuffer_Temp[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); + } + } - proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; - proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; - proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + { + preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, hSpatParamRendCom->num_freq_bands, subframe_idx ); } } +#endif - return; -} - - -static void protoSignalComputation4( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_frame_f, - float *proto_direct_buffer_f, - float *reference_power, - float *proto_power_smooth, - const int16_t slot_index, - const int16_t num_outputs_diff, - const int16_t num_freq_bands, - const float *mtx_hoa_decoder, - const int16_t nchan_transport, - const int16_t *sba_map_tc_ind ) -{ - int16_t k, l; - int16_t n; - float sq_tmp; - float *p_proto_buffer; - - set_zero( reference_power, num_freq_bands ); - for ( k = 0; k < 4; k++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - for ( l = 0; l < num_freq_bands; l++ ) + index_slot = slot_idx_start + slot_idx; + if ( hDirAC->hConfig->dec_param_estim == TRUE ) { - sq_tmp = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; - reference_power[l] += 0.5f * sq_tmp; + md_idx = hSpatParamRendCom->render_to_md_map[index_slot]; + } + else + { + md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; } - } - /*For decorrelated diffuseness*/ - for ( l = 0; l < num_outputs_diff; l++ ) - { - for ( k = 0; k < num_freq_bands; k++ ) + if ( st_ivas->ivas_format == SBA_FORMAT ) { - proto_frame_f[2 * l * num_freq_bands + 2 * k] = 0.f; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] = 0.f; - for ( n = 0; n < nchan_transport; n++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { - proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); + mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); } } - } - - p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; - for ( k = 0; k < num_outputs_diff; k++ ) - { - for ( l = 0; l < num_freq_bands; l++ ) +#ifdef MASA_AND_OBJECTS + // Todo OMASA JBM: This might need adjustments + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) { - sq_tmp = proto_frame_f[k * 2 * num_freq_bands + 2 * l] * proto_frame_f[k * 2 * num_freq_bands + 2 * l] + proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1] * proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; - proto_power_smooth[l + k * num_freq_bands] += sq_tmp; - p_proto_buffer[k * 2 * num_freq_bands + 2 * l] = proto_frame_f[k * 2 * num_freq_bands + 2 * l]; - p_proto_buffer[k * 2 * num_freq_bands + 2 * l + 1] = proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; + for ( ch = 0; ch < nchan_transport; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Temp[ch][slot_idx], Cldfb_RealBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Temp[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); + } + } +#endif + else + { + /* CLDFB Analysis*/ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][hSpatParamRendCom->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hSpatParamRendCom->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); + } } - } - return; -} + /* CNG in DirAC, extra CLDFB ana for CNA*/ + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) + { + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], + st_ivas->hTcBuffer->tc[1], + Cldfb_RealBuffer[1][0], + Cldfb_ImagBuffer[1][0], + index_slot, + st->cna_dirac_flag && st->flag_cna, + ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); + } -/*------------------------------------------------------------------------- - * ivas_dirac_dec_compute_diffuse_proto() - * - * Compute diffuse prototype buffer and smooth power, only for decorrelated bands - *------------------------------------------------------------------------*/ + /* LFE synthesis */ + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled && !( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirACRend->hOutSetup.num_lfe == 0 ) ) + { + ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, + Cldfb_RealBuffer, Cldfb_ImagBuffer, + Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], + slot_idx, + md_idx, + nchan_transport ); + } -static void ivas_dirac_dec_compute_diffuse_proto( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t slot_idx /* i : slot index */ -) -{ - int16_t k, l; - int16_t num_freq_bands, num_freq_bands_diff; - float *p_diff_buffer, *p_diff_buffer_1; - float *p_proto_diff, *p_power_smooth, *proto_frame_dec_f; - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; - DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - int16_t m; - float *p_hoa_enc; - - proto_frame_dec_f = hDirAC->proto_frame_dec_f; - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); - - num_freq_bands = hDirAC->num_freq_bands; - num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; - - p_diff_buffer = h_dirac_output_synthesis_state->proto_diffuse_buffer_f + slot_idx * 2 * num_freq_bands_diff * hDirAC->hOutSetup.nchan_out_woLFE; - p_diff_buffer_1 = p_diff_buffer + 1; - p_power_smooth = h_dirac_output_synthesis_state->proto_power_diff_smooth; - - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) - { - for ( k = 0; k < hDirAC->hOutSetup.nchan_out_woLFE; k++ ) + /*-----------------------------------------------------------------* + * protoype signal computation + *-----------------------------------------------------------------*/ + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - p_proto_diff = proto_frame_dec_f + k * 2 * num_freq_bands; - for ( l = 0; l < num_freq_bands_diff; l++ ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + { + protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + reference_power, slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + p_Rmat ); + } + else { - *p_diff_buffer = *( p_proto_diff++ ); - *p_diff_buffer_1 = *( p_proto_diff++ ); - *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); - p_diff_buffer += 2; - p_diff_buffer_1 += 2; + protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + reference_power, slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + 0 ); } } - } - else - { - /*DIRAC_SYNTHESIS_PSD_SHD: Virtual LS->HOA encoding*/ - for ( k = 0; k < hDirAC->hOutSetup.nchan_out_woLFE; k++ ) + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) + { + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect ); + } + else { - for ( l = 0; l < num_freq_bands_diff; l++ ) + switch ( nchan_transport ) { - p_hoa_enc = hDirAC->hoa_encoder + k; - p_proto_diff = proto_frame_dec_f + 2 * l; - - *p_diff_buffer = 0.f; - *p_diff_buffer_1 = 0.f; - - /*LS to HOA*/ - for ( m = 0; m < hDirAC->num_outputs_diff; m++ ) - { - *p_diff_buffer += ( *p_hoa_enc ) * ( *p_proto_diff ); - *p_diff_buffer_1 += ( *p_hoa_enc ) * ( *( p_proto_diff + 1 ) ); - p_hoa_enc += hDirAC->hOutSetup.nchan_out_woLFE; - p_proto_diff += 2 * num_freq_bands; - } - - *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); - p_diff_buffer += 2; - p_diff_buffer_1 += 2; + case 11: + case 8: + case 6: + case 4: + protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + hDirACRend->hoa_decoder, + nchan_transport, + hDirACRend->sba_map_tc ); + break; + case 2: + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + hDirACRend->hOutSetup.is_loudspeaker_setup, + slot_idx, + hSpatParamRendCom->num_freq_bands, + hDirACRend->masa_stereo_type_detect ); + break; + case 1: + protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, + hDirACRend->num_protos_diff, + hSpatParamRendCom->num_freq_bands ); + break; + default: + return; } } - } - - return; -} - -/*------------------------------------------------------------------------- - * computeDirectionAngles() - * - *------------------------------------------------------------------------*/ -static void computeDirectionAngles( - float *intensity_real_x, - float *intensity_real_y, - float *intensity_real_z, - const int16_t num_frequency_bands, - int16_t *azimuth, - int16_t *elevation ) -{ - int16_t k; - float intensityNorm; - float x, y, z, radius; + /*-----------------------------------------------------------------* + * Compute DirAC parameters at decoder side + *-----------------------------------------------------------------*/ - for ( k = 0; k < num_frequency_bands; ++k ) + if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + mvs2s( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], hSpatParamRendCom->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); + mvs2s( &hSpatParamRendCom->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], hSpatParamRendCom->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); + if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + { + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat ); + } - { - intensityNorm = *( intensity_real_x ) * *( intensity_real_x ) + - *( intensity_real_y ) * *( intensity_real_y ) + - *( intensity_real_z ) * *( intensity_real_z ); + hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ - if ( intensityNorm <= EPSILON ) - { - intensityNorm = 1.0f; - x = 1.0f; - y = 0.0f; - z = 0.0f; - intensity_real_x++; - intensity_real_y++; - intensity_real_z++; - } - else - { - intensityNorm = sqrtf( 1.f / intensityNorm ); - x = *( intensity_real_x++ ) * intensityNorm; - y = *( intensity_real_y++ ) * intensityNorm; - z = *( intensity_real_z++ ) * intensityNorm; - } - radius = sqrtf( x * x + y * y ); - azimuth[k] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); - elevation[k] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); - } + index = hDirACRend->index_buffer_intensity; - return; -} + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + computeIntensityVector_dec( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + num_freq_bands, + hDirACRend->buffer_intensity_real[0][index - 1], + hDirACRend->buffer_intensity_real[1][index - 1], + hDirACRend->buffer_intensity_real[2][index - 1] ); -/*------------------------------------------------------------------------- - * ivas_masa_init_stereotype_detection() - * - * Initialize stereo transport signal type detection - *------------------------------------------------------------------------*/ + computeDirectionAngles( hDirACRend->buffer_intensity_real[0][index - 1], + hDirACRend->buffer_intensity_real[1][index - 1], + hDirACRend->buffer_intensity_real[2][index - 1], + num_freq_bands, + azimuth, + elevation ); -static void ivas_masa_init_stereotype_detection( - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -{ - stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; - stereo_type_detect->current_stereo_type = MASA_STEREO_DOWNMIX; - stereo_type_detect->type_change_direction = MASA_STEREO_DOWNMIX; + mvr2r( reference_power, &( hDirACRend->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - stereo_type_detect->counter = 0; - stereo_type_detect->interpolator = 0; + computeDiffuseness( hDirACRend->buffer_intensity_real, hDirACRend->buffer_energy, num_freq_bands, hSpatParamRendCom->diffuseness_vector[md_idx] ); + } - stereo_type_detect->dipole_freq_range[0] = 1; - stereo_type_detect->dipole_freq_range[1] = 3; +#ifdef DEBUG_MODE_DIRAC + { + static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; - stereo_type_detect->left_bb_power = 0.0f; /* Broadband estimates */ - stereo_type_detect->right_bb_power = 0.0f; - stereo_type_detect->total_bb_power = 0.0f; - stereo_type_detect->left_hi_power = 0.0f; /* High-frequency estimates */ - stereo_type_detect->right_hi_power = 0.0f; - stereo_type_detect->total_hi_power = 0.0f; + if ( fp_direction_vector == NULL ) + fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); + if ( fp_diffuseness == NULL ) + fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); + if ( fp_referencePower == NULL ) + fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); - set_zero( stereo_type_detect->sum_power, MASA_SUM_FREQ_RANGE_BINS ); - set_zero( stereo_type_detect->total_power, MASA_SUM_FREQ_RANGE_BINS ); - stereo_type_detect->subtract_power_y = 0.0f; - stereo_type_detect->subtract_power_y_smooth = 0.0f; - stereo_type_detect->target_power_y_smooth = 0.0f; + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + float radius_length; + float dv[3]; - stereo_type_detect->lr_total_bb_ratio_db = 0.0f; - stereo_type_detect->lr_total_hi_ratio_db = 0.0f; - stereo_type_detect->min_sum_total_ratio_db = 0.0f; - stereo_type_detect->subtract_target_ratio_db = 0.0f; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - return; -} + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; + } + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); + } + else + { + radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); + } + } + } +#endif -/*------------------------------------------------------------------------- - * ivas_masa_stereotype_detection() - * - * Detect the type of the transport audio signals - *------------------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * frequency domain decorrelation + *-----------------------------------------------------------------*/ -static void ivas_masa_stereotype_detection( - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -{ - float lr_total_bb_ratio_db = stereo_type_detect->lr_total_bb_ratio_db; - float lr_total_hi_ratio_db = stereo_type_detect->lr_total_hi_ratio_db; - float min_sum_total_ratio_db = stereo_type_detect->min_sum_total_ratio_db; - float subtract_target_ratio_db = stereo_type_detect->subtract_target_ratio_db; - float change_to_spaced; - int16_t change_to_spaced_selection; - float change_to_downmix; - float change_to_downmix2; - int16_t change_to_downmix_selection; - float subtract_temp; - float min_sum_temp; - float lr_total_bb_temp; - float lr_total_hi_temp; - - /* Determine if the determined features match the spaced mic type */ - change_to_spaced_selection = 0; - if ( subtract_target_ratio_db < -3.0f ) - { - subtract_temp = ( -subtract_target_ratio_db - 3.0f ) / 3.0f; - min_sum_temp = max( -min_sum_total_ratio_db / 6.0f, 0.0f ); - lr_total_bb_temp = lr_total_bb_ratio_db / 6.0f; + if ( hDirACRend->proto_signal_decorr_on == 1 ) + { + /* decorrelate prototype frame */ + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport ), + onset_filter, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); - change_to_spaced = subtract_temp + min_sum_temp + lr_total_bb_temp; + v_multc( onset_filter, 0.25f, onset_filter, hSpatParamRendCom->num_freq_bands ); + v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; + } + else + { + ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->proto_frame_f, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + DirAC_mem.frame_dec_f, + onset_filter, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); - if ( change_to_spaced >= 1.0f ) + hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; + p_onset_filter = onset_filter; + } + } + else { - change_to_spaced_selection = 1; + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + set_f( onset_filter_subframe, 1.f, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; + } + else + { + /* no frequency domain decorrelation: use prototype frame */ + hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; + p_onset_filter = NULL; + } } - } - - /* Determine if the determined features match the downmix type, according to a metric */ - change_to_downmix_selection = 0; - if ( subtract_target_ratio_db > 0.0f ) - { - subtract_temp = subtract_target_ratio_db / 3.0f; - min_sum_temp = ( min_sum_total_ratio_db + 1.0f ) / 6.0f; - lr_total_bb_temp = -lr_total_bb_ratio_db / 6.0f; - change_to_downmix = subtract_temp + min_sum_temp + lr_total_bb_temp; + /*-----------------------------------------------------------------* + * output synthesis + *-----------------------------------------------------------------*/ - if ( change_to_downmix >= 1.0f ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - change_to_downmix_selection = 1; + /*Compute diffuse prototypes*/ + ivas_dirac_dec_compute_diffuse_proto( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); } - } - - /* Determine if the determined features match the downmix type, according to another metric */ - if ( lr_total_hi_ratio_db < -12.0f ) - { - subtract_temp = ( subtract_target_ratio_db + 4.0f ) / 3.0f; - min_sum_temp = min_sum_total_ratio_db / 6.0f; - lr_total_hi_temp = ( -lr_total_hi_ratio_db - 12.0f ) / 3.0f; - change_to_downmix2 = subtract_temp + min_sum_temp + lr_total_hi_temp; - - if ( change_to_downmix2 >= 1.0f ) + /*Compute PSDs*/ + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) { - change_to_downmix_selection = 1; + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector[md_idx], + hSpatParamRendCom, + hDirACRend, + st_ivas->hCombinedOrientationData->shd_rot_max_order, + p_Rmat, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); } - } - - if ( stereo_type_detect->counter < 400 ) - { - stereo_type_detect->counter++; - } - else - { - if ( change_to_spaced_selection == 1 ) + else { - stereo_type_detect->masa_stereo_type = MASA_STEREO_SPACED_MICS; + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector[md_idx], + hSpatParamRendCom, + hDirACRend, + 0, + 0, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); } - else if ( change_to_downmix_selection == 1 ) + + if ( hDirAC->hConfig->dec_param_estim ) { - stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; + float fac = 1.0f / (float) hSpatParamRendCom->subframe_nbslots[subframe_idx]; + v_multc_acc( hSpatParamRendCom->diffuseness_vector[md_idx], fac, diffuseness_vector, hSpatParamRendCom->num_freq_bands ); } - } - if ( stereo_type_detect->interpolator == 0 ) - { - if ( stereo_type_detect->current_stereo_type != stereo_type_detect->masa_stereo_type ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - stereo_type_detect->interpolator = 1; - stereo_type_detect->type_change_direction = stereo_type_detect->masa_stereo_type; + v_add( reference_power, reference_power_smooth, reference_power_smooth, hSpatParamRendCom->num_freq_bands ); } } - return; -} + ivas_dirac_dec_output_synthesis_get_interpolator( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -/*------------------------------------------------------------------------- - * computeIntensityVector_dec() - * - * - *------------------------------------------------------------------------*/ - -static void computeIntensityVector_dec( - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - const int16_t num_frequency_bands, - float *intensity_real_x, - float *intensity_real_y, - float *intensity_real_z ) -{ - /* - * W = a + ib; Y = c + id - * real(W*Y') = ac + bd - */ - int16_t i; - float real, img; - - for ( i = 0; i < num_frequency_bands; ++i ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - real = Cldfb_RealBuffer[0][0][i]; - img = Cldfb_ImagBuffer[0][0][i]; - intensity_real_x[i] = Cldfb_RealBuffer[3][0][i] * real + Cldfb_ImagBuffer[3][0][i] * img; - intensity_real_y[i] = Cldfb_RealBuffer[1][0][i] * real + Cldfb_ImagBuffer[1][0][i] * img; - intensity_real_z[i] = Cldfb_RealBuffer[2][0][i] * real + Cldfb_ImagBuffer[2][0][i] * img; + ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hSpatParamRendCom, + hDirACRend, + nchan_transport, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + p_onset_filter, + diffuseness_vector, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); } + else + { + /* Determine encoding quality based additional smoothing factor */ + float qualityBasedSmFactor = 1.0f; - return; -} - + if ( st_ivas->hMasa != NULL ) + { + qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; + qualityBasedSmFactor *= qualityBasedSmFactor; + } -/*------------------------------------------------------------------------- - * ivas_lfe_synth_with_cldfb() - * - * - *------------------------------------------------------------------------*/ -static void ivas_lfe_synth_with_cldfb( - MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - const int16_t slot_index, - const int16_t subframe_index, - const int16_t nchan_transport ) -{ - float lfeGain; - float transportGain; - float protoLfeReal, protoLfeImag; - int16_t i; - float transportEne, protoLfeEne, targetEneLfe, targetEneTrans; - - set_zero( RealBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); - set_zero( ImagBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); - - protoLfeReal = RealBuffer[0][0][0]; - protoLfeImag = ImagBuffer[0][0][0]; - transportEne = RealBuffer[0][0][0] * RealBuffer[0][0][0] + ImagBuffer[0][0][0] * ImagBuffer[0][0][0]; - for ( i = 1; i < nchan_transport; i++ ) - { - protoLfeReal += RealBuffer[i][0][0]; - protoLfeImag += ImagBuffer[i][0][0]; - transportEne += RealBuffer[i][0][0] * RealBuffer[i][0][0] + ImagBuffer[i][0][0] * ImagBuffer[i][0][0]; + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hSpatParamRendCom, + hDirACRend, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + diffuseness_vector, + reference_power_smooth, + qualityBasedSmFactor, + hDirAC->hConfig->enc_param_start_band ); } - protoLfeEne = protoLfeReal * protoLfeReal + protoLfeImag * protoLfeImag; - targetEneLfe = transportEne * hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index]; - targetEneTrans = transportEne * max( ( 1.0f - hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index] ), 0.01f ); + /*-----------------------------------------------------------------* + * CLDFB synthesis (and binaural rendering) + *-----------------------------------------------------------------*/ - hMasaLfeSynth->transportEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; - hMasaLfeSynth->protoLfeEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; - hMasaLfeSynth->targetEneLfeSmooth *= MCMASA_LFE_SYNTH_ALPHA; - hMasaLfeSynth->targetEneTransSmooth *= MCMASA_LFE_SYNTH_ALPHA; + index_slot = slot_idx_start_cldfb_synth; - hMasaLfeSynth->transportEneSmooth += transportEne; - hMasaLfeSynth->protoLfeEneSmooth += protoLfeEne; - hMasaLfeSynth->targetEneLfeSmooth += targetEneLfe; - hMasaLfeSynth->targetEneTransSmooth += targetEneTrans; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + /* Perform binaural rendering */ + ivas_binRenderer( st_ivas->hBinRenderer, +#ifdef SPLIT_REND_WITH_HEAD_ROT + &st_ivas->splitBinRend.splitrend.multiBinPoseData, +#endif + st_ivas->hCombinedOrientationData, + subframe_idx, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, + Cldfb_ImagBuffer ); - lfeGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneLfeSmooth / ( EPSILON + hMasaLfeSynth->protoLfeEneSmooth ) ) ); - transportGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneTransSmooth / ( EPSILON + hMasaLfeSynth->transportEneSmooth ) ) ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + int16_t pos_idx; +#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) +#else + for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ ) +#endif + { + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands ); + } + } + } + } +#endif + /* Inverse CLDFB*/ + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - RealBufferLfe[slot_index][0] = protoLfeReal * lfeGain; - ImagBufferLfe[slot_index][0] = protoLfeImag * lfeGain; + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { +#ifdef SPLIT_REND_WITH_HEAD_ROT + RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; +#else + RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; +#endif + } - RealBuffer[0][0][0] *= transportGain; - ImagBuffer[0][0][0] *= transportGain; - for ( i = 1; i < nchan_transport; i++ ) + cldfbSynthesis( RealBuffer, + ImagBuffer, + &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], + st_ivas->cldfbSynDec[ch] ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT ) { - RealBuffer[i][0][0] *= transportGain; - ImagBuffer[i][0][0] *= transportGain; + for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + } + } } + else + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t outchannels; - return; -} + idx_in = 0; + idx_lfe = 0; + outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; + if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || + ( hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + { + outchannels++; + } -/*------------------------------------------------------------------------- - * rotateAziEle_DirAC() - * - * Apply rotation to DirAC DOAs - *------------------------------------------------------------------------*/ + if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + const int16_t subframe_start_sample = index_slot * hSpatParamRendCom->num_freq_bands; + const int16_t num_samples_subframe = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; -static void rotateAziEle_DirAC( - int16_t *azi, /* i/o: array of azimuth values */ - int16_t *ele, /* i/o: array of elevation values */ - const int16_t band1, /* i : bands to work on (lower limit) */ - const int16_t band2, /* i : bands to work on (upper bound) */ - const float *p_Rmat /* i : pointer to real-space rotation matrix */ -) -{ - int16_t b; - float dv_0, dv_1, dv_2; - float dv_r_0, dv_r_1, dv_r_2; - float w; + /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ + mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); + mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); - push_wmops( "rotateAziEle_DirAC" ); + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + { + /* Move the LFE channel to the correct place */ + mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - for ( b = band1; b < band2; b++ ) - { + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + { + /* Move the separated channel to the correct place. Thus, the separated channel is + * combined with the synthesized channels here when there is a matching channel. */ + mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); - /*Conversion spherical to cartesian coordinates*/ - w = cosf( ele[b] * PI_OVER_180 ); - dv_0 = w * cosf( azi[b] * PI_OVER_180 ); - dv_1 = w * sinf( azi[b] * PI_OVER_180 ); - dv_2 = sinf( ele[b] * PI_OVER_180 ); + if ( !st_ivas->hLsSetupCustom->separate_ch_found ) + { + /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel + * is combined with the synthesized channels here when there is no matching channel. */ + v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + } - dv_r_0 = p_Rmat[0] * dv_0 + p_Rmat[1] * dv_1 + p_Rmat[2] * dv_2; - dv_r_1 = p_Rmat[3] * dv_0 + p_Rmat[4] * dv_1 + p_Rmat[5] * dv_2; - dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; + idx_in++; + } + } + } + else + { + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + { + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled ) + { + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) + { + /* LFE has been synthesized in the time domain, do nothing. */ + } + else + { + set_zero( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); + } - /*Conversion spherical to cartesian coordinates*/ - azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); - ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); + idx_in++; + } + } + } } + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; + hSpatParamRendCom->subframes_rendered++; pop_wmops(); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 111a9ab18b..b8d708b261 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -959,82 +959,57 @@ ivas_error ivas_init_decoder( st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2; } } - else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { return error; } - if ( st_ivas->ivas_format == MASA_FORMAT ) + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { -#ifdef MASA_AND_OBJECTS - /* if we start in ISM_MODE_NONE in MASA_ISM, that appears as normal MASA, but we may change to a mode with ISMs */ - st_ivas->ism_extmeta_active = -1; - st_ivas->ism_extmeta_cnt = 0; -#endif - if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } - else if ( st_ivas->ivas_format == SBA_FORMAT ) + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { - if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } + } - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) + { + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + else + { + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - } - else + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) { - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) - { - st_ivas->hSpar->enc_param_start_band = 0; - - set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); - st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; - } + st_ivas->hSpar->enc_param_start_band = 0; - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); - } - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && - st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->ivas_format != SBA_FORMAT ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { @@ -1079,6 +1054,57 @@ ivas_error ivas_init_decoder( } } + /* set CNA/CNG flags */ + ivas_sba_set_cna_cng_flag( st_ivas ); + } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { +#ifdef MASA_AND_OBJECTS + /* if we start in ISM_MODE_NONE in MASA_ISM, that appears as normal MASA, but we may change to a mode with ISMs */ + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; +#endif + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + /* set CNA/CNG flags */ ivas_sba_set_cna_cng_flag( st_ivas ); } @@ -1152,9 +1178,14 @@ ivas_error ivas_init_decoder( return error; } - if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) +#if 0 + /* TODO: dirac refactor merge: check! */ + if (st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX) +#else + if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) +#endif { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } @@ -1277,7 +1308,7 @@ ivas_error ivas_init_decoder( } } - if ( st_ivas->nCPE > 1 ) // VE: TBV - is this needed? + if ( st_ivas->nCPE > 1 ) { if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1305,7 +1336,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } @@ -1453,7 +1484,8 @@ ivas_error ivas_init_decoder( } #endif } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + /* ParamISM is handled separately from other common config */ + else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( 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_STEREO_PARAMETRIC ) { @@ -1986,6 +2018,8 @@ void ivas_initialize_handles_dec( ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend ); #endif st_ivas->hDiracDecBin = NULL; + st_ivas->hDirACRend = NULL; + st_ivas->hSpatParamRendCom = NULL; st_ivas->hLsSetUpConversion = NULL; st_ivas->hEFAPdata = NULL; st_ivas->hVBAPdata = NULL; @@ -2103,10 +2137,12 @@ void ivas_destroy_dec( /* DirAC handle */ if ( st_ivas->ivas_format == ISM_FORMAT ) { - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); } else { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } @@ -2354,7 +2390,7 @@ void ivas_init_dec_get_num_cldfb_instances( { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } - else if ( st_ivas->nchan_transport == 1 && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + else if ( st_ivas->nchan_transport == 1 && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index d3d3baa85e..7d96cf605e 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -127,13 +127,13 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hDirAC != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) + if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; - mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv @@ -174,7 +174,7 @@ static ivas_error ivas_ism_bitrate_switching( if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) { /* Deallocate the ParamISM struct */ - ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); #ifdef FIX_568_ISM_BITRATE_SWITCHING if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) @@ -374,14 +374,14 @@ static ivas_error ivas_ism_bitrate_switching( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->hDirAC != NULL ) + if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 2497f5ab98..4662304a4a 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -287,6 +287,7 @@ static void ivas_param_ism_compute_mixing_matrix( static void ivas_param_ism_render_slot( DIRAC_DEC_HANDLE hDirAC, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX], float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -302,7 +303,7 @@ static void ivas_param_ism_render_slot( tmp_1 = hDirAC->hParamIsmRendering->interpolator[interpolator_idx]; - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { /* smooth the mixing matrix */ for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) @@ -324,6 +325,7 @@ static void ivas_param_ism_render_slot( static void ivas_param_ism_rendering( DIRAC_DEC_HANDLE hDirAC, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][4][CLDFB_NO_CHANNELS_MAX], @@ -339,7 +341,7 @@ static void ivas_param_ism_rendering( tmp_1 = hDirAC->hParamIsmRendering->interpolator[slot_idx]; - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { /* smooth the mixing matrix */ for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) @@ -440,6 +442,7 @@ ivas_error ivas_param_ism_dec_open( int16_t i; DIRAC_DEC_HANDLE hDirAC; IVAS_OUTPUT_SETUP hOutSetup; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; AUDIO_CONFIG output_config; int32_t output_Fs; ivas_error error; @@ -457,6 +460,11 @@ ivas_error ivas_param_ism_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } + if ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + /* Assign memory to Param Object handle */ if ( ( hDirAC->hParamIsm = (PARAM_ISM_CONFIG_HANDLE) malloc( sizeof( PARAM_ISM_CONFIG_DATA ) ) ) == NULL ) { @@ -477,15 +485,15 @@ ivas_error ivas_param_ism_dec_open( * set input parameters *-----------------------------------------------------------------*/ - hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); hDirAC->hConfig = NULL; - set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - hDirAC->subframes_rendered = 0; - hDirAC->slots_rendered = 0; - hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpatParamRendCom->subframes_rendered = 0; + hSpatParamRendCom->slots_rendered = 0; + hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -493,9 +501,9 @@ ivas_error ivas_param_ism_dec_open( { hDirAC->hParamIsm->band_grouping[i] = Param_ISM_band_grouping[i]; - if ( hDirAC->hParamIsm->band_grouping[i] > hDirAC->num_freq_bands ) + if ( hDirAC->hParamIsm->band_grouping[i] > hSpatParamRendCom->num_freq_bands ) { - hDirAC->hParamIsm->band_grouping[i] = hDirAC->num_freq_bands; + hDirAC->hParamIsm->band_grouping[i] = hSpatParamRendCom->num_freq_bands; } } @@ -546,19 +554,19 @@ ivas_error ivas_param_ism_dec_open( set_zero( hDirAC->azimuth_values, MAX_NUM_OBJECTS ); set_zero( hDirAC->elevation_values, MAX_NUM_OBJECTS ); - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - hDirAC->dirac_bs_md_write_idx = 0; - hDirAC->dirac_read_idx = 0; + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + hSpatParamRendCom->dirac_bs_md_write_idx = 0; + hSpatParamRendCom->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 2 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) { return error; } @@ -567,6 +575,7 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hISMDTX.dtx_flag = 0; st_ivas->hDirAC = hDirAC; + st_ivas->hSpatParamRendCom = hSpatParamRendCom; if ( st_ivas->hDecoderConfig->voip_active ) { @@ -582,17 +591,17 @@ ivas_error ivas_param_ism_dec_open( } else { - if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } - set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands ); - if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } - set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands ); } if ( st_ivas->hTcBuffer == NULL ) { @@ -634,66 +643,70 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ - AUDIO_CONFIG output_config /* i : output audio configuration */ + DIRAC_DEC_HANDLE *hDirAC_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 */ ) { - DIRAC_DEC_HANDLE hDirAC; - - if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + if ( hDirAC_out != NULL && *hDirAC_out != NULL ) { - return; - } - - hDirAC = *hDirAC_out; + DIRAC_DEC_HANDLE hDirAC; + hDirAC = *hDirAC_out; - /* Config & CLDFB */ - if ( hDirAC->hParamIsm != NULL ) - { - free( hDirAC->hParamIsm ); - hDirAC->hParamIsm = NULL; - } + /* Config & CLDFB */ + if ( hDirAC->hParamIsm != NULL ) + { + free( hDirAC->hParamIsm ); + hDirAC->hParamIsm = NULL; + } - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - ivas_dirac_deallocate_parameters( hDirAC, 1 ); - ivas_dirac_deallocate_parameters( hDirAC, 2 ); - } + if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) + { + /* Param ISM Rendering */ + if ( hDirAC->hParamIsmRendering->interpolator != NULL ) + { + free( hDirAC->hParamIsmRendering->interpolator ); + hDirAC->hParamIsmRendering->interpolator = NULL; + } + if ( hDirAC->hParamIsmRendering->proto_matrix != NULL ) + { + free( hDirAC->hParamIsmRendering->proto_matrix ); + hDirAC->hParamIsmRendering->proto_matrix = NULL; + } + } - if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) - { - /* Param ISM Rendering */ - if ( hDirAC->hParamIsmRendering->interpolator != NULL ) + if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) { - free( hDirAC->hParamIsmRendering->interpolator ); - hDirAC->hParamIsmRendering->interpolator = NULL; + free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; } - if ( hDirAC->hParamIsmRendering->proto_matrix != NULL ) + if ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc != NULL ) { - free( hDirAC->hParamIsmRendering->proto_matrix ); - hDirAC->hParamIsmRendering->proto_matrix = NULL; + free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); + hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } - } - if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) - { - free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); - hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; - } - if ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc != NULL ) - { - free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); - hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + if ( hDirAC->hParamIsmRendering != NULL ) + { + free( hDirAC->hParamIsmRendering ); + hDirAC->hParamIsmRendering = NULL; + } + + free( *hDirAC_out ); + *hDirAC_out = NULL; } - if ( hDirAC->hParamIsmRendering != NULL ) + if ( hSpatParamRendCom_out != NULL && *hSpatParamRendCom_out != NULL ) { - free( hDirAC->hParamIsmRendering ); - hDirAC->hParamIsmRendering = NULL; - } + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 1 ); + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 2 ); + } - free( *hDirAC_out ); - *hDirAC_out = NULL; + free( *hSpatParamRendCom_out ); + *hSpatParamRendCom_out = NULL; + } return; } @@ -735,12 +748,15 @@ void ivas_param_ism_dec( float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; IVAS_OUTPUT_SETUP hSetup; /* Initialization */ hDirAC = st_ivas->hDirAC; assert( hDirAC ); + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + assert( hSpatParamRendCom ); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; @@ -873,14 +889,14 @@ void ivas_param_ism_dec( *-----------------------------------------------------------------*/ for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { - cldfbAnalysis_ts( &( output_f[ch][hDirAC->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( output_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); ivas_param_ism_collect_slot( hDirAC, Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], ch, ref_power, cx_diag ); } } /* Obtain Mixing Matrix on a frame-level */ - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { set_f( mixing_matrix[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); } @@ -888,28 +904,28 @@ void ivas_param_ism_dec( /* Compute mixing matrix */ ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, mixing_matrix ); /* subframe loop for synthesis*/ - for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) + for ( subframe_idx = 0; subframe_idx < hSpatParamRendCom->nb_subframes; subframe_idx++ ) { - uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots[subframe_idx]; + uint16_t slot_idx_start = subframe_idx * hSpatParamRendCom->subframe_nbslots[subframe_idx]; uint16_t idx_in; uint16_t idx_lfe; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); - set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); } } - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; /* Compute bandwise rendering to target LS using covariance rendering */ - ivas_param_ism_rendering( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + ivas_param_ism_rendering( hDirAC, hSpatParamRendCom, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, mixing_matrix, slot_idx, index_slot, nchan_out_woLFE, nchan_transport ); } @@ -922,7 +938,7 @@ void ivas_param_ism_dec( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); + set_zero( &( output_f[ch][slot_idx_start * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -934,14 +950,14 @@ void ivas_param_ism_dec( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hSpatParamRendCom->num_freq_bands] ), + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); idx_in++; } @@ -1091,10 +1107,13 @@ void ivas_param_ism_dec_digest_tc( /* Direct Response/EFAP Gains */ float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; /* Initialization */ hDirAC = st_ivas->hDirAC; assert( hDirAC ); + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + assert( hSpatParamRendCom ); #ifdef FIX_549_DMX_GAIN ene_tc = 0.0f; ene_sum = 0.0f; @@ -1233,16 +1252,16 @@ void ivas_param_ism_dec_digest_tc( float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - cldfbAnalysis_ts( &( transport_channels_f[ch][hDirAC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands], hDirAC->num_freq_bands ); - mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands], hDirAC->num_freq_bands ); + cldfbAnalysis_ts( &( transport_channels_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); + mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); ivas_param_ism_collect_slot( hDirAC, RealBuffer, ImagBuffer, ch, ref_power, cx_diag ); } } /* Obtain Mixing Matrix on a frame-level */ - for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + for ( bin_idx = 0; bin_idx < hSpatParamRendCom->num_freq_bands; bin_idx++ ) { set_f( hDirAC->hParamIsmRendering->mixing_matrix_lin[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); } @@ -1278,6 +1297,7 @@ static void ivas_ism_param_dec_render_sf( float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX]; float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX]; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; int16_t slot_idx_start; int16_t idx_in; @@ -1285,31 +1305,32 @@ static void ivas_ism_param_dec_render_sf( int16_t subframe_idx; hDirAC = st_ivas->hDirAC; - slot_idx_start = hDirAC->slots_rendered; - subframe_idx = hDirAC->subframes_rendered; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + slot_idx_start = hSpatParamRendCom->slots_rendered; + subframe_idx = hSpatParamRendCom->subframes_rendered; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); - set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hSpatParamRendCom->num_freq_bands ); } } - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = slot_idx_start + slot_idx; for ( ch = 0; ch < nchan_transport; ch++ ) { - Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands]; - Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands]; + Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands]; + Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands]; } /* Compute bandwise rendering to target LS using covariance rendering */ - ivas_param_ism_render_slot( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + ivas_param_ism_render_slot( hDirAC, hSpatParamRendCom, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->hParamIsmRendering->mixing_matrix_lin, index_slot, slot_idx, nchan_out_woLFE, nchan_transport ); } @@ -1322,7 +1343,7 @@ static void ivas_ism_param_dec_render_sf( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( output_f[ch], hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); + set_zero( output_f[ch], hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1334,19 +1355,19 @@ static void ivas_ism_param_dec_render_sf( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } cldfbSynthesis( RealBuffer, ImagBuffer, output_f[ch], - hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); idx_in++; } } - hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; - hDirAC->subframes_rendered++; + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; + hSpatParamRendCom->subframes_rendered++; return; } @@ -1369,14 +1390,17 @@ void ivas_param_ism_dec_render( int16_t ch, slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, n_samples_sf; DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; IVAS_OUTPUT_SETUP hSetup; int16_t nchan_transport, nchan_out, nchan_out_woLFE; float *output_f_local[MAX_OUTPUT_CHANNELS]; hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSetup = st_ivas->hIntSetup; #ifdef DEBUGGING assert( hDirAC ); + assert( hSpatParamRendCom ); #endif nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) @@ -1393,14 +1417,14 @@ void ivas_param_ism_dec_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = hDirAC->subframes_rendered; + first_sf = hSpatParamRendCom->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; last_sf++; } #ifdef DEBUGGING @@ -1415,14 +1439,14 @@ void ivas_param_ism_dec_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { ivas_ism_param_dec_render_sf( st_ivas, hSetup, nchan_transport, nchan_out, nchan_out_woLFE, output_f_local ); - n_samples_sf = hDirAC->subframe_nbslots[subframe_idx] * st_ivas->hDirAC->slot_size; + n_samples_sf = hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->slot_size; for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] += n_samples_sf; } } - if ( hDirAC->slots_rendered == hDirAC->num_slots ) + if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { /* copy the memories */ /* store mixing matrix for next subframe */ @@ -1444,7 +1468,7 @@ void ivas_param_ism_dec_render( } } - *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + *nSamplesAvailable = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered ) * slot_size; return; } @@ -1461,6 +1485,7 @@ void ivas_param_ism_params_to_masa_param_mapping( ) { DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; int16_t nBins; int16_t band_idx, bin_idx, sf_idx; int16_t brange[2]; @@ -1470,7 +1495,8 @@ void ivas_param_ism_params_to_masa_param_mapping( int32_t ivas_total_brate; hDirAC = st_ivas->hDirAC; - nBins = hDirAC->num_freq_bands; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nBins = hSpatParamRendCom->num_freq_bands; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -1492,7 +1518,7 @@ void ivas_param_ism_params_to_masa_param_mapping( float energy_ratio; energy_ratio = powf( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence, 2.0f ); - hDirAC->numSimultaneousDirections = 1; + hSpatParamRendCom->numSimultaneousDirections = 1; azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); @@ -1500,19 +1526,19 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; + hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; + hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = energy_ratio; + hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = energy_ratio; - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } else { - hDirAC->numSimultaneousDirections = 2; + hSpatParamRendCom->numSimultaneousDirections = 2; for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) { brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; @@ -1530,12 +1556,12 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; - hDirAC->azimuth2[sf_idx][bin_idx] = azimuth[1]; - hDirAC->elevation2[sf_idx][bin_idx] = elevation[1]; - hDirAC->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; + hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; + hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; + hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; + hSpatParamRendCom->azimuth2[sf_idx][bin_idx] = azimuth[1]; + hSpatParamRendCom->elevation2[sf_idx][bin_idx] = elevation[1]; + hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; } } } @@ -1544,16 +1570,16 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->spreadCoherence2[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->spreadCoherence2[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } } else { - hDirAC->numSimultaneousDirections = 1; + hSpatParamRendCom->numSimultaneousDirections = 1; azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); @@ -1561,11 +1587,11 @@ void ivas_param_ism_params_to_masa_param_mapping( { for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = 1.0f; - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; + hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; + hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = 1.0f; + hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 9c4479374d..24ce4e86a9 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -412,6 +412,49 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( } +#ifdef OMASA_OBJ_REND_CLOSE +/*-------------------------------------------------------------------------* + * ivas_masa_ism_separate_object_renderer_close() + * + * Close structures, reserve memory, and init values. + *-------------------------------------------------------------------------*/ + +ivas_error ivas_masa_ism_separate_object_renderer_close( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t i; + if ( st_ivas->hMasaIsmData != NULL ) + { + if ( st_ivas->hMasaIsmData->delayBuffer != NULL ) + { + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + { + if ( st_ivas->hMasaIsmData->delayBuffer[i] != NULL ) + { + free(st_ivas->hMasaIsmData->delayBuffer[i] ); + st_ivas->hMasaIsmData->delayBuffer[i] = NULL; + } + } + free( st_ivas->hMasaIsmData->delayBuffer ); + st_ivas->hMasaIsmData->delayBuffer = NULL; + } + } + if ( st_ivas->hIsmRendererData != NULL ) + { + if ( st_ivas->hIsmRendererData->interpolator != NULL ) + { + free( st_ivas->hIsmRendererData->interpolator ); + st_ivas->hIsmRendererData->interpolator = NULL; + } + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } + + return IVAS_ERR_OK; +} +#endif + /*-------------------------------------------------------------------------* * ivas_masa_ism_separate_object_render() * @@ -445,7 +488,7 @@ void ivas_masa_ism_separate_object_render( hVBAPdata = st_ivas->hVBAPdata; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; hRendererData = st_ivas->hIsmRendererData; - lfe_index = st_ivas->hDirAC->hOutSetup.index_lfe[0]; + lfe_index = st_ivas->hDirACRend->hOutSetup.index_lfe[0]; subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) @@ -466,7 +509,7 @@ void ivas_masa_ism_separate_object_render( for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { idx_offset = block * subframe_len; - dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + dirac_read_idx = ( st_ivas->hSpatParamRendCom->dirac_read_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; if ( single_separated ) { @@ -491,12 +534,12 @@ void ivas_masa_ism_separate_object_render( } else { - ivas_dirac_dec_get_response( azimuth, elevation, gains, st_ivas->hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( azimuth, elevation, gains, st_ivas->hDirACRend->hOutSetup.ambisonics_order ); } for ( j = 0; j < nchan_out_woLFE; j++ ) { - if ( st_ivas->hDirAC->hOutSetup.num_lfe > 0 ) + if ( st_ivas->hDirACRend->hOutSetup.num_lfe > 0 ) { j2 = j + ( j >= lfe_index ); } @@ -519,7 +562,7 @@ void ivas_masa_ism_separate_object_render( } } - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % st_ivas->hDirAC->dirac_md_buffer_length; + st_ivas->hSpatParamRendCom->dirac_read_idx = ( st_ivas->hSpatParamRendCom->dirac_read_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; return; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 98b0672af3..e1a7a9cbd2 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -320,7 +320,7 @@ ivas_error ivas_jbm_dec_tc( { #ifdef FIX_564 /* loudness correction */ - ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame ); + ivas_dirac_dec_binaural_sba_gain( output, nchan_remapped, output_frame ); #else float gain = 0.8414f; /* Todo: Temporary gain for roughly matching the loudness. To be tuned later together with other outputs. Also, this is not inline with ivas_dec() */ @@ -691,6 +691,7 @@ ivas_error ivas_jbm_dec_render( ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; float *p_tc[MAX_TRANSPORT_CHANNELS]; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; error = IVAS_ERR_OK; @@ -700,6 +701,7 @@ ivas_error ivas_jbm_dec_render( * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ + hSpatParamRendCom = st_ivas->hSpatParamRendCom; output_Fs = st_ivas->hDecoderConfig->output_Fs; nchan_out = st_ivas->hDecoderConfig->nchan_out; nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; @@ -967,7 +969,7 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - int16_t offset = st_ivas->hDirAC->slots_rendered * st_ivas->hDirAC->slot_size; + int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size; 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 ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 1c9cc56417..a0d98f56dc 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -35,6 +35,7 @@ #include #include "ivas_cnst.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_stat_dec.h" #include "prot.h" @@ -323,7 +324,7 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hDirAC->dirac_bs_md_write_idx, st_ivas->hDirAC->dirac_md_buffer_length ); + st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, st_ivas->hSpatParamRendCom->dirac_md_buffer_length ); for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) { @@ -334,7 +335,7 @@ ivas_error ivas_masa_decode( for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - meta_write_index = ( st_ivas->hDirAC->dirac_bs_md_write_idx + sf ) % st_ivas->hDirAC->dirac_md_buffer_length; + meta_write_index = ( st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx + sf ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->azimuth_ism[obj][meta_write_index]; st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = st_ivas->hMasaIsmData->elevation_ism[obj][meta_write_index]; } @@ -473,10 +474,9 @@ ivas_error ivas_masa_decode( { #ifdef MASA_AND_OBJECTS // Todo OMASA JBM: This might need adjustments - dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */ + dirac_bs_md_write_idx = st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx; /* Store the write-index for this frame */ #endif - - ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, ivas_format, 0, 0 ); + ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0 ); } #ifdef MASA_AND_OBJECTS @@ -496,26 +496,26 @@ ivas_error ivas_masa_decode( int16_t block; int16_t meta_write_index; - for ( i = 0; i < st_ivas->hDirAC->numIsmDirections; i++ ) /* Todo Nokia: Probably there is a better place for this eventually */ + for ( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) /* Todo Nokia: Probably there is a better place for this eventually */ { for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { // Todo OMASA JBM: This might need adjustments - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { - st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][meta_write_index][b]; + st_ivas->hSpatParamRendCom->diffuseness_vector[meta_write_index][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][meta_write_index][b]; } } } for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) { - st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] = max( 0.0f, st_ivas->hDirAC->diffuseness_vector[meta_write_index][b] ); + st_ivas->hSpatParamRendCom->diffuseness_vector[meta_write_index][b] = max( 0.0f, st_ivas->hSpatParamRendCom->diffuseness_vector[meta_write_index][b] ); } } } @@ -795,6 +795,7 @@ static ivas_error ivas_masa_dec_config( } #else ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); #endif #ifdef MASA_AND_OBJECTS @@ -1291,10 +1292,13 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); -#ifdef OMASA_BRSW_MONO_FIX - if ( ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) && st_ivas->hDirAC == NULL ) +/* Todo: Check this */ +#if 0 && defined(OMASA_BRSW_MONO_FIX) /* TODO */ + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || + ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) #else - if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->hDirAC == NULL ) + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || + ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) #endif { /* init a new DirAC dec */ @@ -1303,14 +1307,20 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } -#ifdef OMASA_BRSW_MONO_FIX - else if ( ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) && st_ivas->hDirAC != NULL ) +#if 0 && defined(OMASA_BRSW_MONO_FIX) + else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) #else - else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) + else if ( st_ivas->renderer_type == RENDERER_DISABLE ) #endif { - /* close unnecessary DirAC dec */ - ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + if ( st_ivas->hDirAC != NULL ) + { + /* close all unnecessary parametric decoding and rendering */ + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + } } /* possible reconfigure is done later */ @@ -1329,6 +1339,15 @@ ivas_error ivas_masa_dec_reconfigure( sts = st_ivas->hSCE[sce_id]->hCoreCoder; sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hSCE[sce_id]->element_brate / FRAMES_PER_SEC ); + + /* TODO refactor merge: this is not in the pre-refactor version */ + if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) + { + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) + { + return error; + } + } } for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -1349,7 +1368,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = 1; - if ( st_ivas->hDirAC != NULL ) + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1361,7 +1380,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = CPE_CHANNELS; - if ( st_ivas->hDirAC != NULL ) + if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1370,6 +1389,7 @@ ivas_error ivas_masa_dec_reconfigure( } } } + if ( st_ivas->hDiracDecBin != NULL ) { /* regularization factor is bitrate-dependent */ @@ -1380,6 +1400,8 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching within OMASA is handled in ivas_omasa_dec_config() */ { #endif +#if 1 + /* TODO refactor merge: do we need this or similar?*/ /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ @@ -1391,7 +1413,7 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } - +#endif /*-----------------------------------------------------------------* * CLDFB instances *-----------------------------------------------------------------*/ @@ -1494,18 +1516,20 @@ void ivas_spar_param_to_masa_param_mapping( int16_t slot_idx, slot_idx_start, sf; SPAR_DEC_HANDLE hSpar; float slot_fac; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; /* Set values */ hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; #ifdef MASA_AND_OBJECTS - hDirAC->numParametricDirections = 1; + hSpatParamRendCom->numParametricDirections = 1; #endif - hDirAC->numSimultaneousDirections = 1; - hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; + hSpatParamRendCom->numSimultaneousDirections = 1; + hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; hSpar = st_ivas->hSpar; - dirac_write_idx = hDirAC->render_to_md_map[subframe]; + dirac_write_idx = hSpatParamRendCom->render_to_md_map[subframe]; /* Init arrays */ for ( i = 0; i < FOA_CHANNELS; i++ ) @@ -1590,7 +1614,7 @@ void ivas_spar_param_to_masa_param_mapping( set_zero( transportSignalEnergies[1], nBins ); set_zero( transportSignalCrossCorrelation, nBins ); - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -1650,13 +1674,13 @@ void ivas_spar_param_to_masa_param_mapping( ratio = I / fmaxf( 1e-12f, E ); /* Energy ratio */ ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) ); - hDirAC->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); - hDirAC->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); - hDirAC->energy_ratio1[dirac_write_idx][bin] = ratio; - hDirAC->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; + hSpatParamRendCom->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); + hSpatParamRendCom->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); + hSpatParamRendCom->energy_ratio1[dirac_write_idx][bin] = ratio; + hSpatParamRendCom->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; - hDirAC->spreadCoherence[dirac_write_idx][bin] = 0.0f; - hDirAC->surroundingCoherence[dirac_write_idx][bin] = 0.0f; + hSpatParamRendCom->spreadCoherence[dirac_write_idx][bin] = 0.0f; + hSpatParamRendCom->surroundingCoherence[dirac_write_idx][bin] = 0.0f; /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ if ( hDiffuseDist != NULL ) diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index 99b3ff6874..efdb0a8122 100755 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -82,7 +82,7 @@ ivas_error ivas_mcmasa_dec_reconfig( { if ( st_ivas->hDirAC == NULL ) { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } @@ -96,51 +96,5 @@ ivas_error ivas_mcmasa_dec_reconfig( } } - /*-------------------------------------------------------------------* - * Close binaural rendering handles and re-allocate proper ones - * in McMASA renderer_type can be only RENDERER_BINAURAL_PARAMETRIC, RENDERER_BINAURAL_PARAMETRIC_ROOM - *--------------------------------------------------------------------*/ - - if ( st_ivas->hBinRenderer != NULL ) - { - ivas_binRenderer_close( &st_ivas->hBinRenderer ); - } - - if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) - { - /* open parametric binaural renderer */ - if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDiracDecBin != NULL ) - { - if ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) - { - /* close unneeded renderer */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - } - else - { - /* if necessary, close/open td-decorrs */ - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* regularization factor is bitrate-dependent */ - st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); - } - } - return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 1350b9656c..e99cf63fa6 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -737,13 +737,13 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hDirAC != NULL ) + else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; - mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv @@ -800,7 +800,9 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { - ivas_dirac_dec_close( &st_ivas->hDirAC ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -884,7 +886,9 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { - ivas_dirac_dec_close( &st_ivas->hDirAC ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -1115,6 +1119,8 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -1161,16 +1167,6 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } - else - { - /* useTdDecorr may change => close and re-open */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } } /* init necessary new renderers */ @@ -1181,21 +1177,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } } - else if ( st_ivas->hDiracDecBin == NULL && ( 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_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } else if ( st_ivas->hBinRendererTd == NULL && st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -1267,18 +1248,6 @@ static ivas_error ivas_mc_dec_reconfig( #endif } - /*-----------------------------------------------------------------* - * TD Decorrelator - *-----------------------------------------------------------------*/ - - if ( st_ivas->hDiracDecBin != NULL ) - { - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - /*-----------------------------------------------------------------* * CLDFB instances *-----------------------------------------------------------------*/ @@ -1324,13 +1293,13 @@ static ivas_error ivas_mc_dec_reconfig( } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->hDirAC != NULL ) + if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } else if ( st_ivas->hParamMC != NULL ) { diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b419da1b59..326fc64674 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -329,12 +329,19 @@ ivas_error ivas_omasa_dec_config( st_ivas->hHrtfTD = NULL; } +#ifdef OMASA_OBJ_REND_CLOSE + if ( ( error = ivas_masa_ism_separate_object_renderer_close( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else /* ISM renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) { free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } +#endif } } @@ -355,12 +362,19 @@ ivas_error ivas_omasa_dec_config( } else { +#ifdef OMASA_OBJ_REND_CLOSE + if ( ( error = ivas_masa_ism_separate_object_renderer_close( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else /* ISM renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) { free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } +#endif } } @@ -368,6 +382,8 @@ ivas_error ivas_omasa_dec_config( * TD Decorrelator *-----------------------------------------------------------------*/ +#if 1 + /* TODO: executed already in ivas_masa_dec_reconfigure */ if ( st_ivas->hDiracDecBin != NULL ) { if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) @@ -384,6 +400,7 @@ ivas_error ivas_omasa_dec_config( { return error; } +#endif } return IVAS_ERR_OK; @@ -526,7 +543,7 @@ ivas_error ivas_omasa_ism_metadata_dec( for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; st_ivas->hMasaIsmData->azimuth_ism[n][meta_write_index] = azimuth_ism; st_ivas->hMasaIsmData->elevation_ism[n][meta_write_index] = elevation_ism; } @@ -539,7 +556,7 @@ ivas_error ivas_omasa_ism_metadata_dec( for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hDirAC->dirac_md_buffer_length; + meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; st_ivas->hMasaIsmData->azimuth_separated_ism[meta_write_index] = azimuth_ism; st_ivas->hMasaIsmData->elevation_separated_ism[meta_write_index] = elevation_ism; } @@ -579,11 +596,11 @@ void ivas_omasa_dirac_rend( } } - dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; + dirac_read_idx = st_ivas->hSpatParamRendCom->dirac_read_idx; ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport ); - st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ + st_ivas->hSpatParamRendCom->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index fb97faf0de..763a1b222f 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -65,7 +65,7 @@ void ivas_sba_set_cna_cng_flag( /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ /* st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; */ } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) + else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) { st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; @@ -114,8 +114,6 @@ ivas_error ivas_sba_dec_reconfigure( int16_t num_channels, num_md_sub_frames; #endif - RENDERER_TYPE old_renderer_type; - DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; error = IVAS_ERR_OK; @@ -147,13 +145,13 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - else if ( st_ivas->hDirAC != NULL ) + else if ( st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; - st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; - mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } /*-----------------------------------------------------------------* @@ -240,7 +238,6 @@ ivas_error ivas_sba_dec_reconfigure( /* renderer might have changed */ intern_config_old = st_ivas->intern_config; - old_renderer_type = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); /* side effect of the renderer selection can be a changed internal config */ @@ -293,29 +290,6 @@ ivas_error ivas_sba_dec_reconfigure( #endif } - if ( st_ivas->renderer_type != old_renderer_type ) - { - 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_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) ) - { - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - } - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -332,11 +306,14 @@ ivas_error ivas_sba_dec_reconfigure( } /* synchronize subframe info */ - st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + if ( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } } if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) @@ -346,6 +323,8 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->renderer_type == RENDERER_DISABLE ) { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); @@ -424,7 +403,7 @@ ivas_error ivas_sba_dec_reconfigure( } else { - if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { tc_nchan_to_allocate++; /* we need a channel for the CNG in this case*/ } @@ -531,9 +510,11 @@ void ivas_sba_dec_render( uint16_t slot_size, ch; uint16_t nchan_internal, nchan_out; SPAR_DEC_HANDLE hSpar; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; hSpar = st_ivas->hSpar; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; @@ -582,11 +563,11 @@ void ivas_sba_dec_render( { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 79ed6c7cf3..dd8fbdc851 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -325,7 +325,7 @@ ivas_error ivas_spar_dec( /* read DirAC bitstream */ if ( st_ivas->hQMetaData != NULL ) { - ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hQMetaData, nb_bits_read, + ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); } @@ -1313,6 +1313,7 @@ void ivas_spar_dec_upmixer( ) { SPAR_DEC_HANDLE hSpar; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; int16_t nchan_transport, nchan_out; int16_t subframe_idx, n, i; int16_t n_samples_sf; @@ -1392,15 +1393,16 @@ void ivas_spar_dec_upmixer( st_ivas->hTcBuffer->tc[n] = NULL; } - if ( st_ivas->hDirAC != 0 ) + if ( st_ivas->hDirAC != NULL && st_ivas->hSpatParamRendCom != NULL ) { + hSpatParamRendCom = st_ivas->hSpatParamRendCom; if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } } @@ -1689,7 +1691,7 @@ void ivas_spar_dec_upmixer_sf( if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) { set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); - if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) + if ( idx_lfe < ( st_ivas->hDirACRend->hOutSetup.num_lfe - 1 ) ) { idx_lfe++; } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index a1d3e98392..c61effd673 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -3051,6 +3051,9 @@ void ivas_spar_to_dirac( end_band = min( num_bands_out, SPAR_DIRAC_SPLIT_START_BAND ) / bw; hDirAC = st_ivas->hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + dirac_to_spar_md_bands = st_ivas->hSpar->dirac_to_spar_md_bands; enc_param_start_band = st_ivas->hSpar->enc_param_start_band / bw; active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; @@ -3145,46 +3148,46 @@ void ivas_spar_to_dirac( { int16_t ts_start, ts_end, ts; - ts_start = hDirAC->block_grouping[block]; - ts_end = hDirAC->block_grouping[block + 1]; + ts_start = DirAC_block_grouping[block]; + ts_end = DirAC_block_grouping[block + 1]; for ( b = qmf_band_start; b < qmf_band_end; b++ ) { azi_dith = azi[band]; ele_dith = ele[band]; - hDirAC->energy_ratio1[block][b] = en_ratio; + hSpatParamRendCom->energy_ratio1[block][b] = en_ratio; tmp_write_idx_band = tmp_write_idx_param_band; if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele_dith; - hDirAC->azimuth[tmp_write_idx_band][b] = azi_dith; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; } else { for ( ts = ts_start; ts < ts_end; ts++ ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele_dith; - hDirAC->azimuth[tmp_write_idx_band][b] = azi_dith; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } } - tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hDirAC->dirac_md_buffer_length; + tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hSpatParamRendCom->dirac_md_buffer_length; } } /* update buffer write index */ if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; } else { - hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % hDirAC->dirac_md_buffer_length; + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % hSpatParamRendCom->dirac_md_buffer_length; } } else diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index d5144018e5..4706c6d89b 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -396,40 +396,9 @@ typedef struct } ISM_DTX_DATA_DEC; /*----------------------------------------------------------------------------------* - * DirAC decoder structure + * DirAC decoder structures *----------------------------------------------------------------------------------*/ -typedef struct dirac_dec_stack_mem -{ - /*Decorrelator*/ - float *frame_dec_f; - - /*Prototypes*/ - float *proto_direct_buffer_f; - float *proto_diffuse_buffer_f; - - /*Prototype NRGs*/ - float *proto_power_smooth; - float *proto_power_diff_smooth; - - /*Gain or power factors for directional and diffuse streams*/ - float *direct_power_factor; - float *diffuse_power_factor; - - /*Directional responses (gains & Nrg)*/ - float *direct_responses; - float *direct_responses_square; - - /* Target co-variance mtx */ - float *cy_auto_dir_smooth; - float *cy_cross_dir_smooth; - float *cy_auto_diff_smooth; - - float *reference_power; - float *onset_filter; - -} DIRAC_DEC_STACK_MEM, *DIRAC_DEC_STACK_MEM_HANDLE; - typedef struct param_ism_rendering { float *proto_matrix; @@ -442,115 +411,32 @@ typedef struct param_ism_rendering } PARAM_ISM_RENDERING_DATA, *PARAM_ISM_RENDERING_HANDLE; -/*Onset detector*/ -typedef struct dirac_onset_detection_params_structure -{ - int16_t num_freq_bands; - int16_t max_band_decorr; - -} DIRAC_ONSET_DETECTION_PARAMS; - -typedef struct dirac_onset_detection_state_structure -{ - float *onset_detector_1; - float *onset_detector_2; - -} DIRAC_ONSET_DETECTION_STATE; - -/*Decorrelator*/ -typedef struct dirac_decorr_params_structure -{ - int16_t max_band_decorr; - int16_t max_frequency; - - int16_t *pre_delay; - int16_t *filter_length; - float *filter_coeff_num_real; - float *filter_coeff_den_real; - float *phase_coeff_real; - float *phase_coeff_imag; - int16_t *split_frequency_bands; - int16_t num_split_frequency_bands; - - int16_t use_ducker; - int16_t add_back_onsets_on; - - DIRAC_ONSET_DETECTION_PARAMS h_onset_detection_power_params; - -} DIRAC_DECORR_PARAMS, *HANDLE_DIRAC_DECORR_PARAMS; - -typedef struct dirac_decorr_state_structure -{ - float *decorr_buffer; - float *direct_energy_smooth; - float *reverb_energy_smooth; - - DIRAC_ONSET_DETECTION_STATE h_onset_detection_power_state; - -} DIRAC_DECORR_STATE, *HANDLE_DIRAC_DECORR_STATE; - -/*Output synthesis*/ -typedef struct dirac_output_synthesis_params_structure -{ - int16_t max_band_decorr; - - int16_t use_onset_filters; - - float *interpolator; - float *alpha_synthesis; - float *alpha_synthesis_fast; - int16_t numAlphas; - int16_t numAlphasFast; - - float *proto_matrix; - - float diffuse_compensation_factor; - float diffuse_compensation_factor_decorr; - -} DIRAC_OUTPUT_SYNTHESIS_PARAMS; - -typedef struct dirac_output_synthesis_state_structure +/* ===== DirAC main structure ===== */ +typedef struct ivas_dirac_dec_data_structure { - /* only pointer to local buffers */ - float *direct_responses; /* direct responses for DOA of current frame. Size: num_freq_bands*num_channels. */ - float *direct_responses_square; - float *diffuse_responses_square; /* squared diffuse responses. Size: num_channels. */ - - /* only pointer to local buffers */ - float *direct_power_factor; - float *diffuse_power_factor; - - float *proto_power_smooth; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ - float *proto_power_smooth_prev; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ - - float *proto_power_diff_smooth; - float *proto_power_diff_smooth_prev; + DIRAC_CONFIG_DATA_HANDLE hConfig; - /* only pointer to local buffers */ - float *proto_direct_buffer_f; /* Buffer for direct sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ - float *proto_diffuse_buffer_f; /* Buffer for diffuse sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ + /*Parameter decoding*/ + float azimuth_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; + float elevation_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - /* Output gain memories */ - float *gains_dir_prev; /* Direct sound gains of current synthesis block. Size: num_freq_bands*num_channel. */ - float *gains_diff_prev; /* Diffuse sound gains of previous synthesis block. Size: num_freq_bands*num_channel. */ + int16_t dithering_seed; + int16_t spar_to_dirac_write_idx; - /* only pointer to local buffers */ - float *cy_auto_dir_smooth; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ - float *cy_cross_dir_smooth; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ - float *cy_auto_diff_smooth; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + /*sub-modules*/ + PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ + float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; + PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; - /* PSD memories */ - float *cy_auto_dir_smooth_prev; /* Target auto PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ - float *cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ - float *cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + IVAS_FB_MIXER_HANDLE hFbMdft; - const float *onset_filter; +} DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; - /* Temporal smoothing memories */ - float *reference_power_smooth_prev; - float *direction_smoothness_prev; -} DIRAC_OUTPUT_SYNTHESIS_STATE; +/*----------------------------------------------------------------------------------* + * ParamMC structures + *----------------------------------------------------------------------------------*/ typedef struct dirac_output_synthesis_cov_state_structure { @@ -579,160 +465,6 @@ typedef struct dirac_output_synthesis_cov_state_structure } DIRAC_OUTPUT_SYNTHESIS_COV_STATE; -/* MASA stereo transport signal type detection structure */ -typedef struct -{ - MASA_TRANSPORT_SIGNAL_TYPE masa_stereo_type; - MASA_TRANSPORT_SIGNAL_TYPE current_stereo_type; - MASA_TRANSPORT_SIGNAL_TYPE type_change_direction; - - int16_t dipole_freq_range[2]; - - float left_bb_power; - float right_bb_power; - float total_bb_power; - - float left_hi_power; - float right_hi_power; - float total_hi_power; - - float sum_power[MASA_SUM_FREQ_RANGE_BINS]; - float total_power[MASA_SUM_FREQ_RANGE_BINS]; - - float subtract_power_y; - float subtract_power_y_smooth; - float target_power_y_smooth; - - float lr_total_bb_ratio_db; - float lr_total_hi_ratio_db; - float min_sum_total_ratio_db; - float subtract_target_ratio_db; - - int16_t counter; - int16_t interpolator; - -} MASA_STEREO_TYPE_DETECT; - -/* Diffuse sound directional distribution data structure */ -typedef struct ivas_diffuse_distribution_data_structure -{ - float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; - -} DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; - - -/* ===== DirAC main structure ===== */ -typedef struct ivas_dirac_dec_data_structure -{ - DIRAC_CONFIG_DATA_HANDLE hConfig; - IVAS_OUTPUT_SETUP hOutSetup; - - int16_t slot_size; - int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; - int16_t subframes_rendered; - int16_t slots_rendered; - int16_t num_slots; - int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; - int16_t nb_subframes; - int16_t num_freq_bands; - - /*Parameter decoding*/ - float azimuth_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; - float elevation_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - int16_t block_grouping[5]; - /* decoded, ungrouped and rounded values, we have 1 degree resolution anyway */ - int16_t **azimuth; - int16_t **elevation; - int16_t **azimuth2; - int16_t **elevation2; - - float **diffuseness_vector; - float **energy_ratio1; - float **energy_ratio2; - - float **spreadCoherence; - float **spreadCoherence2; - float **surroundingCoherence; - - int16_t dithering_seed; - int16_t dirac_bs_md_write_idx; - int16_t dirac_read_idx; - int16_t dirac_estimator_idx; - int16_t spar_to_dirac_write_idx; - int16_t dirac_md_buffer_length; - -#ifdef MASA_AND_OBJECTS - int16_t numSimultaneousDirections; /* From 1 to 2 + MAX_NUM_OBJECTS */ - int16_t numParametricDirections; /* 1 or 2 */ - int16_t numIsmDirections; /* From 0 to MAX_NUM_OBJECTS */ -#else - int16_t numSimultaneousDirections; /* 1 or 2 */ -#endif - DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; - - /*Parameter estimation*/ - int16_t index_buffer_intensity; - float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; - float *buffer_energy; - - /*Decoder parameters */ - /*Prototypes*/ - int16_t num_outputs_dir; - int16_t num_outputs_diff; - int16_t num_protos_dir; - int16_t num_protos_diff; - int16_t num_protos_ambi; - DIRAC_SYNTHESIS_CONFIG synthesisConf; - DIRAC_PANNING_CONFIG panningConf; - - float *frequency_axis; - float *diffuse_response_function; - float *hoa_encoder; - const float *hoa_decoder; - - /*Options*/ - /* Decorrelator options */ - int16_t max_band_decorr; - - /* prototype computing */ - int16_t *proto_index_dir; - int16_t *proto_index_diff; - - int16_t proto_signal_decorr_on; - - /*Decoder states=memories*/ - float *proto_frame_f; - float *proto_frame_dec_f; - - DIRAC_DEC_STACK_MEM stack_mem; - MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect; - - int16_t num_ele_spk_no_diffuse_rendering; - - /*sub-modules*/ - HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; - HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; - - DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_psd_params; - DIRAC_OUTPUT_SYNTHESIS_STATE h_output_synthesis_psd_state; - - PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ - float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; - PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; - IVAS_FB_MIXER_HANDLE hFbMdft; - const int16_t *sba_map_tc; - -} DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; - - -/*----------------------------------------------------------------------------------* - * ParamMC structures - *----------------------------------------------------------------------------------*/ - typedef struct ivas_param_mc_diff_proto_info_structure { int16_t num_protos_diff; @@ -1037,53 +769,6 @@ typedef struct ivas_lfe_dec_data_structure } LFE_DEC_DATA, *LFE_DEC_HANDLE; -// Note: the following structures are used only in lib_dec but this would likely change in the future -/*----------------------------------------------------------------------------------* - * VBAP structures - *----------------------------------------------------------------------------------*/ - -/* Defines a single virtual surface triplet of loudspeakers - * with a precalculated inverse matrix */ -typedef struct vbap_vs_triplet_structure -{ - uint8_t speaker_node[3]; - float inverse_matrix[3][3]; - -} VBAP_VS_TRIPLET; - - -/* Storage structure for fast runtime triplet search */ -typedef struct triplet_search_structure -{ - VBAP_VS_TRIPLET *triplets; - int16_t num_triplets; - int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; - -} VBAP_SEARCH_STRUCT; - - -/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ -typedef struct vbap_data_structure -{ - VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ - int16_t num_search_structs; - int16_t num_speaker_nodes; - int16_t num_speaker_nodes_internal; - int16_t top_virtual_speaker_node_index; /* These indices can be negative */ - int16_t bottom_virtual_speaker_node_index; - int16_t back_virtual_speaker_node_index; - float *bottom_virtual_speaker_node_division_gains; - float *top_virtual_speaker_node_division_gains; - float *back_virtual_speaker_node_division_gains; -#ifdef MASA_AND_OBJECTS - float *object_mode_bottom_virtual_speaker_node_division_gains; - float *object_mode_top_virtual_speaker_node_division_gains; - float *object_mode_back_virtual_speaker_node_division_gains; -#endif - -} VBAP_DATA, *VBAP_HANDLE; - - /*----------------------------------------------------------------------------------* * renderer structures *----------------------------------------------------------------------------------*/ @@ -1128,39 +813,6 @@ typedef struct ivas_binaural_rendering_struct * MASA decoder structures *----------------------------------------------------------------------------------*/ -/* McMASA LFE synthesis structure */ -typedef struct ivas_mcmasa_lfe_synth_struct -{ - float lfeToTotalEnergyRatio[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t lfeGainPrevIndex; - float transportEneSmooth; - float protoLfeEneSmooth; - float targetEneLfeSmooth; - float targetEneTransSmooth; - - float *lfeSynthRingBuffer; - int16_t ringBufferLoPointer; - int16_t ringBufferHiPointer; - float lowpassSum; - int16_t ringBufferSize; - - float *lfeSynthRingBuffer2; - int16_t ringBufferLoPointer2; - float lowpassSum2; - int16_t ringBufferSize2; - - float *delayBuffer_syncLp; - int16_t delayBuffer_syncLp_size; - - float *delayBuffer_syncDirAC; - int16_t delayBuffer_syncDirAC_size; - - float lfeGainPrev; - float transportGainPrev; - float interpolator[CLDFB_NO_CHANNELS_MAX]; - -} MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; - typedef struct ivas_masa_decoder_ext_out_meta_struct { MASA_DECRIPTIVE_META descriptiveMeta; @@ -1393,19 +1045,20 @@ typedef struct Decoder_Struct MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ CREND_WRAPPER_HANDLE hCrendWrapper; /* Crend handle */ REVERB_HANDLE hReverb; /* Reverb handle */ - HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ + HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ LSSETUP_CUSTOM_HANDLE hLsSetupCustom; /* Custom LS configuration handle */ float *hoa_dec_mtx; /* Pointer to decoder matrix for SBA */ HEAD_TRACK_DATA_HANDLE hHeadTrackData; /* Head tracking data structure */ RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */ - int32_t binaural_latency_ns; /* binauralization latency in ns */ -#ifdef MASA_AND_OBJECTS - MASA_ISM_DATA_HANDLE hMasaIsmData; /* MASA_ISM rendering structure */ + int32_t binaural_latency_ns; /* Binauralization latency in ns */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData; /* External orientation data structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; /* Combined external and head orientation data structure */ - + DIRAC_REND_HANDLE hDirACRend; /* DirAC renderer handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; /* Spatial parametric (DirAC rend, ParamBin, ParamISM) rendering common data handle. */ +#ifdef MASA_AND_OBJECTS + MASA_ISM_DATA_HANDLE hMasaIsmData; /* MASA_ISM rendering structure */ uint8_t editing_ism_enabled; /* Todo Nokia: Temporary, used until proper ISM control available */ int16_t index_of_edited_ism; /* Todo Nokia: Temporary, used until proper ISM control available */ int16_t azimuth_edited; /* Todo Nokia: Temporary, used until proper ISM control available */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 5ca721b331..7e30145256 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -82,6 +82,20 @@ typedef struct hrtfGainCache float shVec[HRTF_SH_CHANNELS]; } PARAMBIN_HRTF_GAIN_CACHE; +typedef struct parambin_rend_config_data +{ + int16_t separateCenterChannelRendering; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; + float qualityBasedSmFactor; + int16_t processReverb; +#ifdef MASA_AND_OBJECTS + ISM_MODE ism_mode; +#endif +} PARAMBIN_REND_CONFIG, *PARAMBIN_REND_CONFIG_HANDLE; + /*------------------------------------------------------------------------- * Local function prototypes @@ -89,13 +103,21 @@ typedef struct hrtfGainCache static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); -static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); +#ifdef MASA_AND_OBJECTS +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const MASA_ISM_DATA_HANDLE hMasaIsmData ); +#else +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); +#endif -static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); +#ifdef MASA_AND_OBJECTS +static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked, const int16_t nchanSeparateChannels, const MASA_ISM_DATA_HANDLE hMasaIsmData ); +#else +static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); +#endif -static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); +static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); @@ -112,40 +134,46 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); +// Todo Tapani refactor: Create separate init & render functions for MASA external renderer. The decoder versions would become too complex if generalized. + /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() * * Initialize parametric binaural renderer *------------------------------------------------------------------------*/ +// Todo Tapani refactor: To be moved to lib_dec ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ ) { - DIRAC_DEC_BIN_HANDLE hBinaural; + DIRAC_DEC_BIN_HANDLE hDiracDecBin; int16_t nBins; int32_t output_Fs; RENDERER_TYPE renderer_type; int16_t j, k, bin; float binCenterFreq, tmpFloat; ivas_error error; + float frequency_axis[CLDFB_NO_CHANNELS_MAX]; - hBinaural = st_ivas->hDiracDecBin; + hDiracDecBin = st_ivas->hDiracDecBin; - if ( hBinaural == NULL ) + if ( hDiracDecBin == NULL ) { - if ( ( hBinaural = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } - hBinaural->hTdDecorr = NULL; - hBinaural->hReverb = NULL; + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; } - nBins = st_ivas->hDirAC->num_freq_bands; output_Fs = st_ivas->hDecoderConfig->output_Fs; + nBins = st_ivas->hSpatParamRendCom->num_freq_bands; renderer_type = st_ivas->renderer_type; for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -156,23 +184,23 @@ ivas_error ivas_dirac_dec_init_binaural_data( for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) #endif { - set_zero( hBinaural->processMtxRe[j][k], nBins ); - set_zero( hBinaural->processMtxIm[j][k], nBins ); + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); } for ( k = 0; k < BINAURAL_CHANNELS; k++ ) { - set_zero( hBinaural->processMtxDecRe[j][k], nBins ); - set_zero( hBinaural->processMtxDecIm[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); } - set_zero( hBinaural->ChEnePrev[j], nBins ); - set_zero( hBinaural->ChEneOutPrev[j], nBins ); + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); } - set_zero( hBinaural->ChCrossRePrev, nBins ); - set_zero( hBinaural->ChCrossImPrev, nBins ); - set_zero( hBinaural->ChCrossReOutPrev, nBins ); - set_zero( hBinaural->ChCrossImOutPrev, nBins ); - hBinaural->renderStereoOutputInsteadOfBinaural = 0; + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; for ( bin = 0; bin < nBins; bin++ ) @@ -180,35 +208,35 @@ ivas_error ivas_dirac_dec_init_binaural_data( binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hBinaural->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); } for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) { - hBinaural->diffuseFieldCoherenceX[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; - hBinaural->diffuseFieldCoherenceY[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; - hBinaural->diffuseFieldCoherenceZ[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; + hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; + hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; } if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ { - set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hBinaural->hReverb = NULL; + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) || - ( hBinaural->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || + ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) { - ivas_binaural_reverb_close( &( hBinaural->hReverb ) ); + ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); } - if ( hBinaural->hReverb == NULL ) + if ( hDiracDecBin->hReverb == NULL ) { - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + if ( ( error = ivas_binaural_reverb_open( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, @@ -223,28 +251,52 @@ ivas_error ivas_dirac_dec_init_binaural_data( } else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) { - set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hBinaural->hReverb = NULL; - hBinaural->renderStereoOutputInsteadOfBinaural = 1; + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; } else /* Not valid renderer type for this renderer */ { assert( false ); } - if ( hBinaural->hTdDecorr == NULL ) + hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + + if ( hDiracDecBin->hTdDecorr == NULL ) + { + hDiracDecBin->useTdDecorr = 0; + } + + if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) { - hBinaural->useTdDecorr = 0; + ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hBinaural->hTdDecorr ), &( hBinaural->useTdDecorr ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } - hBinaural->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) + { + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); - st_ivas->hDiracDecBin = hBinaural; + st_ivas->hDiracDecBin = hDiracDecBin; /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) @@ -283,6 +335,10 @@ void ivas_dirac_dec_close_binaural_data( } ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); + if ( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) + { + ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); + } free( *hBinaural ); *hBinaural = NULL; @@ -343,6 +399,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( * *------------------------------------------------------------------------*/ +// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -355,13 +412,13 @@ void ivas_dirac_dec_binaural_render( int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, ch; uint16_t nchan_out; - DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; - hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_out = BINAURAL_CHANNELS; #ifdef DEBUGGING - assert( hDirAC ); + assert( hSpatParamRendCom ); #endif for ( ch = 0; ch < nchan_out; ch++ ) { @@ -370,14 +427,14 @@ void ivas_dirac_dec_binaural_render( slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + slots_to_render = min( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered, nSamplesAsked / slot_size ); *nSamplesRendered = slots_to_render * slot_size; - first_sf = hDirAC->subframes_rendered; + first_sf = hSpatParamRendCom->subframes_rendered; last_sf = first_sf; while ( slots_to_render > 0 ) { - slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + slots_to_render -= hSpatParamRendCom->subframe_nbslots[last_sf]; last_sf++; } @@ -386,7 +443,7 @@ void ivas_dirac_dec_binaural_render( #endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { - int16_t n_samples_sf = slot_size * hDirAC->subframe_nbslots[subframe_idx]; + int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe_idx]; ivas_dirac_dec_binaural_internal( st_ivas, st_ivas->hCombinedOrientationData, output_f_local, nchan_transport, subframe_idx ); for ( ch = 0; ch < nchan_out; ch++ ) { @@ -394,12 +451,12 @@ void ivas_dirac_dec_binaural_render( } } - if ( hDirAC->slots_rendered == hDirAC->num_slots ) + if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; } - *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + *nSamplesAvailable = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->slots_rendered ) * slot_size; return; } @@ -407,12 +464,13 @@ void ivas_dirac_dec_binaural_render( #ifdef FIX_564 /*------------------------------------------------------------------------- - * ivas_dirac_dec_binaural_gain() + * ivas_dirac_dec_binaural_sba_gain() * * loudness correction for parametric binaural renderer *------------------------------------------------------------------------*/ -void ivas_dirac_dec_binaural_gain( +// Todo Tapani refactor: To be moved to lib_dec +void ivas_dirac_dec_binaural_sba_gain( float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ @@ -446,6 +504,7 @@ void ivas_dirac_dec_binaural_gain( * Parametric binaural renderer main function *------------------------------------------------------------------------*/ +// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ @@ -454,11 +513,13 @@ void ivas_dirac_dec_binaural( ) { int16_t subframe; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float cng_td_buffer[L_FRAME16k]; float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; int16_t slot_size; int16_t numInChannels; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) @@ -517,7 +578,7 @@ void ivas_dirac_dec_binaural( for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) { - int16_t n_samples_sf = slot_size * st_ivas->hDirAC->subframe_nbslots[subframe]; + int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe]; ivas_dirac_dec_binaural_internal( st_ivas, hCombinedOrientationData, p_output, nchan_transport, subframe ); @@ -525,7 +586,7 @@ void ivas_dirac_dec_binaural( { p_output[ch] += n_samples_sf; } - st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + 1 ) % st_ivas->hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) @@ -541,7 +602,7 @@ void ivas_dirac_dec_binaural( * Local functions *------------------------------------------------------------------------*/ - +// Todo refactor: To be moved to lib_dec static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, @@ -549,11 +610,14 @@ static void ivas_dirac_dec_binaural_internal( const int16_t nchan_transport, const int16_t subframe ) { - DIRAC_DEC_HANDLE hDirAC; + DIRAC_DEC_BIN_HANDLE hDiracDecBin; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + PARAMBIN_REND_CONFIG config_data; int16_t slot, ch, numInChannels; #ifdef MASA_AND_OBJECTS float Cldfb_RealBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + int16_t nchanSeparateChannels; #else float Cldfb_RealBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -564,14 +628,35 @@ static void ivas_dirac_dec_binaural_internal( int16_t nBins, offsetSamples; int16_t i, j; - hDirAC = st_ivas->hDirAC; - nBins = hDirAC->num_freq_bands; - offsetSamples = hDirAC->slots_rendered * nBins; + hDiracDecBin = st_ivas->hDiracDecBin; + assert( hDiracDecBin ); + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + nBins = hSpatParamRendCom->num_freq_bands; + offsetSamples = hSpatParamRendCom->slots_rendered * nBins; + + /* Setuo internal config */ + config_data.separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + config_data.ivas_format = st_ivas->ivas_format; + config_data.mc_mode = st_ivas->mc_mode; + config_data.ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + config_data.nchan_transport = st_ivas->nchan_transport; + config_data.qualityBasedSmFactor = st_ivas->hMasa != NULL ? st_ivas->hMasa->data.dir_decode_quality : 1.0f; + config_data.processReverb = st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; +#ifdef MASA_AND_OBJECTS + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + config_data.ism_mode = st_ivas->ism_mode; + } + else + { + config_data.ism_mode = ISM_MODE_NONE; + } +#endif /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; #ifdef MASA_AND_OBJECTS - if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + if ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) { numInChannels++; } @@ -580,7 +665,7 @@ static void ivas_dirac_dec_binaural_internal( numInChannels += (uint8_t) st_ivas->nchan_ism; } #else - if ( st_ivas->hOutSetup.separateChannelEnabled ) + if ( config_data.separateCenterChannelRendering ) { numInChannels++; } @@ -599,7 +684,7 @@ static void ivas_dirac_dec_binaural_internal( Rmat[2][2] = 1.0f; /* CLDFB Analysis of input */ - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( ch = 0; ch < numInChannels; ch++ ) { @@ -611,7 +696,7 @@ static void ivas_dirac_dec_binaural_internal( Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); } - else if ( st_ivas->nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + else if ( config_data.nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ { /* At mono input duplicate the channel to dual-mono */ mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); @@ -626,7 +711,7 @@ static void ivas_dirac_dec_binaural_internal( int16_t slotInFrame; numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; - slotInFrame = hDirAC->slots_rendered + slot; + slotInFrame = hSpatParamRendCom->slots_rendered + slot; generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], @@ -678,7 +763,7 @@ static void ivas_dirac_dec_binaural_internal( } } - if ( st_ivas->hDiracDecBin->useTdDecorr ) + if ( hDiracDecBin->useTdDecorr ) { for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { @@ -688,7 +773,7 @@ static void ivas_dirac_dec_binaural_internal( Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); - if ( st_ivas->nchan_transport == 1 && st_ivas->ivas_format == SBA_FORMAT ) + if ( config_data.nchan_transport == 1 && config_data.ivas_format == SBA_FORMAT ) { v_multc( Cldfb_RealBuffer_in[ch][slot], INV_SQRT_2, Cldfb_RealBuffer_in[ch][slot], nBins ); v_multc( Cldfb_ImagBuffer_in[ch][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[ch][slot], nBins ); @@ -697,9 +782,9 @@ static void ivas_dirac_dec_binaural_internal( } } - if ( st_ivas->ivas_format == SBA_FORMAT ) + if ( config_data.ivas_format == SBA_FORMAT ) { - st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; + hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); @@ -725,44 +810,67 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { - adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); + adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); } } - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, +#ifdef MASA_AND_OBJECTS + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, st_ivas->hMasaIsmData ); +#else + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); +#endif - if ( st_ivas->ivas_format == ISM_FORMAT ) + if ( config_data.ivas_format == ISM_FORMAT ) { max_band_decorr = 0; } - else if ( st_ivas->hDiracDecBin->useTdDecorr ) + else if ( hDiracDecBin->useTdDecorr ) { max_band_decorr = CLDFB_NO_CHANNELS_MAX; } else { - max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; } - ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat, +#ifdef MASA_AND_OBJECTS + nchanSeparateChannels = 0; + if ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + { + nchanSeparateChannels = 1; + } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; + } + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, + nchanSeparateChannels, st_ivas->hMasaIsmData ); +#else + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); - ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, subframe ); +#endif + ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); - st_ivas->hDirAC->hDiffuseDist = NULL; + hDiracDecBin->hDiffuseDist = NULL; +#ifdef MASA_AND_OBJECTS // Todo OMASA JBM: This change could have some side effects - hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe]; - hDirAC->subframes_rendered++; +#endif + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; + hSpatParamRendCom->subframes_rendered++; return; } static void ivas_dirac_dec_decorrelate_slot( - DIRAC_DEC_HANDLE hDirAC, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -772,37 +880,39 @@ static void ivas_dirac_dec_decorrelate_slot( int16_t offset, ch, bin; float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + float protoFrameF[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + const int16_t protoIndexDir[BINAURAL_CHANNELS] = { 0, 1 }; /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + offset = num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < num_freq_bands; bin++ ) { - hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; - hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; + protoFrameF[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; + protoFrameF[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; } } /* Decorrelate proto signal to decorrelatedFrameInterleaved */ - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, + ivas_dirac_dec_decorr_process( num_freq_bands, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, BINAURAL_CHANNELS, - hDirAC->proto_frame_f, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, + protoFrameF, + BINAURAL_CHANNELS, + protoIndexDir, decorrelatedFrameInterleaved, onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); + hDiracDecBin->h_freq_domain_decorr_ap_params, + hDiracDecBin->h_freq_domain_decorr_ap_state ); /* De-interleave decorrelated signals*/ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + offset = num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < num_freq_bands; bin++ ) { decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; @@ -814,19 +924,23 @@ static void ivas_dirac_dec_decorrelate_slot( static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( - Decoder_Struct *st_ivas, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, - const int16_t isHeadtracked ) + const int16_t isHeadtracked +#ifdef MASA_AND_OBJECTS + , const MASA_ISM_DATA_HANDLE hMasaIsmData +#endif +) { int16_t ch, slot, bin; - uint8_t separateCenterChannelRendering; + int16_t separateCenterChannelRendering; int16_t nBins, idx; float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; - DIRAC_DEC_HANDLE hDirAC; - DIRAC_DEC_BIN_HANDLE h; float IIReneLimiterFactor; float qualityBasedSmFactor; float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; @@ -834,25 +948,33 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric int16_t dirac_read_idx; float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; #ifdef MASA_AND_OBJECTS int16_t gainCacheBaseIndex; #endif - hDirAC = st_ivas->hDirAC; - h = st_ivas->hDiracDecBin; - separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = hDirAC->num_freq_bands; /* Actually bins */ - - set_zero( h->ChCrossRe, nBins ); - set_zero( h->ChCrossIm, nBins ); - set_zero( h->ChCrossReOut, nBins ); - set_zero( h->ChCrossImOut, nBins ); + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + qualityBasedSmFactor = hConfig->qualityBasedSmFactor; + qualityBasedSmFactor *= qualityBasedSmFactor; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + + set_zero( hDiracDecBin->ChCrossRe, nBins ); + set_zero( hDiracDecBin->ChCrossIm, nBins ); + set_zero( hDiracDecBin->ChCrossReOut, nBins ); + set_zero( hDiracDecBin->ChCrossImOut, nBins ); for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - set_zero( h->ChEne[ch], nBins ); - set_zero( h->ChEneOut[ch], nBins ); + set_zero( hDiracDecBin->ChEne[ch], nBins ); + set_zero( hDiracDecBin->ChEneOut[ch], nBins ); } - set_zero( h->frameMeanDiffuseness, nBins ); + set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); @@ -863,10 +985,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; - if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { applyLowBitRateEQ = 1; - if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_16k4 ) + if ( ivas_total_brate == IVAS_16k4 ) { for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { @@ -884,10 +1006,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = hDirAC->render_to_md_map[subframe]; + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; /* Calculate input covariance matrix */ - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -897,13 +1019,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); - h->ChEne[ch][bin] += instEne; + hDiracDecBin->ChEne[ch][bin] += instEne; subFrameTotalEne[bin] += instEne; } - h->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; - h->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; - h->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; - h->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; + hDiracDecBin->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + hDiracDecBin->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; } } @@ -922,13 +1044,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } } - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 2 ) + if ( ivas_format == SBA_FORMAT && nchan_transport == 2 ) { float tempRe, tempIm; set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { for ( bin = 0; bin < nBins; bin++ ) { @@ -956,10 +1078,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match * the early spectrum of the BRIR data, using the spectral correction data in * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ - meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + meanEnePerCh = hDiracDecBin->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - for ( dirIndex = 0; dirIndex < hDirAC->numSimultaneousDirections; dirIndex++ ) + for ( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) { int16_t aziDeg, eleDeg; float lRealp, lImagp, rRealp, rImagp; @@ -971,21 +1093,21 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ { - aziDeg = hDirAC->azimuth[dirac_read_idx][bin]; - eleDeg = hDirAC->elevation[dirac_read_idx][bin]; - ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; - spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; + aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; + ratio = hSpatParamRendCom->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence[dirac_read_idx][bin]; #ifdef MASA_AND_OBJECTS gainCacheBaseIndex = 0; #endif } #ifdef MASA_AND_OBJECTS - else if ( st_ivas->ivas_format != MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_ISM_FORMAT && dirIndex < hDirAC->numParametricDirections ) ) /* For second of the two simultaneous directions */ + else if ( ivas_format != MASA_ISM_FORMAT || ( ivas_format == MASA_ISM_FORMAT && dirIndex < hSpatParamRendCom->numParametricDirections ) ) /* For second of the two simultaneous directions */ #else else /* For second of the two simultaneous directions */ #endif { - if ( ( ratio = hDirAC->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) + if ( ( ratio = hSpatParamRendCom->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) { /* This touches only MASA path where second direction always has smaller ratio and * for non-2dir it is zero. As the whole direction contribution is multiplied with @@ -993,9 +1115,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * it is better to save complexity. */ continue; } - aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; - eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; - spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; + aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence2[dirac_read_idx][bin]; #ifdef MASA_AND_OBJECTS gainCacheBaseIndex = 3; #endif @@ -1005,18 +1127,19 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { isIsmDirection = 1; uint16_t ismDirIndex; - ismDirIndex = dirIndex - hDirAC->numParametricDirections; - if ( st_ivas->hMasaIsmData->ism_is_edited[ismDirIndex] ) + ismDirIndex = dirIndex - hSpatParamRendCom->numParametricDirections; + assert( hMasaIsmData != NULL && "hMasaIsmData should not be NULL if we use it"); + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) { - aziDeg = st_ivas->hMasaIsmData->azimuth_ism_edited[ismDirIndex]; - eleDeg = st_ivas->hMasaIsmData->elevation_ism_edited[ismDirIndex]; + aziDeg = hMasaIsmData->azimuth_ism_edited[ismDirIndex]; + eleDeg = hMasaIsmData->elevation_ism_edited[ismDirIndex]; } else { - aziDeg = st_ivas->hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; - eleDeg = st_ivas->hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; + aziDeg = hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; + eleDeg = hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; } - ratio = st_ivas->hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; + ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; spreadCoh = 0.0f; gainCacheBaseIndex = 6 + ismDirIndex; } @@ -1055,12 +1178,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } #ifdef MASA_AND_OBJECTS - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked ); #else - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); #endif - if ( h->renderStereoOutputInsteadOfBinaural ) + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { /* Synthesizing spread coherence is not needed for stereo loudspeaker output, * as directional sound is reproduced with two loudspeakers in any case */ @@ -1102,9 +1225,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the left source of the three coherent sources */ #ifdef MASA_AND_OBJECTS - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); #else - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); #endif hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); @@ -1116,11 +1239,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ #ifdef MASA_AND_OBJECTS - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); #else - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); #endif - hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; lImagp += sidesMul * lImagpTmp; @@ -1147,7 +1269,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric w3 = 2.0f * spreadCoh - 1.0f; } - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) { idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); @@ -1177,25 +1299,25 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Add direct part (1 or 2) covariance matrix */ dirEne = ratio * meanEnePerCh; - h->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ - h->ChEneOut[1][bin] += dirEne * hrtfEne[1]; - h->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ - h->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + hDiracDecBin->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + hDiracDecBin->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + hDiracDecBin->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + hDiracDecBin->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ } /* Add diffuse / ambient part covariance matrix */ diffuseness = max( 0.0f, diffuseness ); diffEne = diffuseness * meanEnePerCh; - surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; + surCoh = hSpatParamRendCom->surroundingCoherence[dirac_read_idx][bin]; #ifdef MASA_AND_OBJECTS diffusenessValForDecorrelationReduction = max( 0.0f, diffusenessValForDecorrelationReduction ); diffEneValForDecorrelationReduction = diffusenessValForDecorrelationReduction * meanEnePerCh; #endif - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) { - if ( !h->renderStereoOutputInsteadOfBinaural ) + if ( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { #ifdef MASA_AND_OBJECTS float spectrumModVal; @@ -1216,33 +1338,33 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #endif } } - h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ - h->ChEneOut[1][bin] += diffEne; + hDiracDecBin->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + hDiracDecBin->ChEneOut[1][bin] += diffEne; - if ( h->renderStereoOutputInsteadOfBinaural ) + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ - h->ChCrossReOut[bin] += surCoh * diffEne; + hDiracDecBin->ChCrossReOut[bin] += surCoh * diffEne; } else /* When rendering binaural, ambience has frequency dependent ICC. */ { - if ( st_ivas->ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + if ( ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) { float diffuseFieldCoherence; - diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; - h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + diffuseFieldCoherence = hDiracDecBin->hDiffuseDist->diffuseRatioX[bin] * hDiracDecBin->diffuseFieldCoherenceX[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioY[bin] * hDiracDecBin->diffuseFieldCoherenceY[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioZ[bin] * hDiracDecBin->diffuseFieldCoherenceZ[bin]; + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; } else { - h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * h->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * hDiracDecBin->diffuseFieldCoherence[bin] + surCoh ) * diffEne; } } /* Store parameters for formulating average diffuseness over frame */ #ifdef MASA_AND_OBJECTS - h->frameMeanDiffuseness[bin] += diffEneValForDecorrelationReduction; + hDiracDecBin->frameMeanDiffuseness[bin] += diffEneValForDecorrelationReduction; #else - h->frameMeanDiffuseness[bin] += diffEne; + hDiracDecBin->frameMeanDiffuseness[bin] += diffEne; #endif frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; } @@ -1250,19 +1372,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate average diffuseness over frame */ for ( bin = 0; bin < nBins; bin++ ) { - h->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); + hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); } - /* Determine encoding quality based additional smoothing factor */ - qualityBasedSmFactor = 1.0f; - if ( st_ivas->hMasa != NULL ) - { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; - } - - /* Temporal IIR-type smoothing of covariance matrices */ - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); } @@ -1277,41 +1391,41 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that * the energy history (IIR) must not be more than double of the current frame energy. This provides more * robust performance at energy offsets when compared to typical IIR averaging. */ - eneRatio = ( h->ChEne[0][bin] + h->ChEne[1][bin] ) / fmaxf( 1e-12f, ( h->ChEnePrev[0][bin] + h->ChEnePrev[1][bin] ) ); + eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); - h->ChCrossRe[bin] *= qualityBasedSmFactor; - h->ChCrossIm[bin] *= qualityBasedSmFactor; - h->ChCrossReOut[bin] *= qualityBasedSmFactor; - h->ChCrossImOut[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - h->ChEne[ch][bin] *= qualityBasedSmFactor; - h->ChEneOut[ch][bin] *= qualityBasedSmFactor; + hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; + hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; } - h->ChCrossRe[bin] += IIReneLimiter * h->ChCrossRePrev[bin]; - h->ChCrossIm[bin] += IIReneLimiter * h->ChCrossImPrev[bin]; - h->ChCrossReOut[bin] += IIReneLimiter * h->ChCrossReOutPrev[bin]; - h->ChCrossImOut[bin] += IIReneLimiter * h->ChCrossImOutPrev[bin]; + hDiracDecBin->ChCrossRe[bin] += IIReneLimiter * hDiracDecBin->ChCrossRePrev[bin]; + hDiracDecBin->ChCrossIm[bin] += IIReneLimiter * hDiracDecBin->ChCrossImPrev[bin]; + hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossReOutPrev[bin]; + hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossImOutPrev[bin]; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - h->ChEne[ch][bin] += IIReneLimiter * h->ChEnePrev[ch][bin]; - h->ChEneOut[ch][bin] += IIReneLimiter * h->ChEneOutPrev[ch][bin]; + hDiracDecBin->ChEne[ch][bin] += IIReneLimiter * hDiracDecBin->ChEnePrev[ch][bin]; + hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter * hDiracDecBin->ChEneOutPrev[ch][bin]; } /* Store energy values and coefficients for next round */ - h->ChCrossRePrev[bin] = h->ChCrossRe[bin]; - h->ChCrossImPrev[bin] = h->ChCrossIm[bin]; - h->ChCrossReOutPrev[bin] = h->ChCrossReOut[bin]; - h->ChCrossImOutPrev[bin] = h->ChCrossImOut[bin]; + hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; + hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; + hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; + hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - h->ChEnePrev[ch][bin] = h->ChEne[ch][bin]; - h->ChEneOutPrev[ch][bin] = h->ChEneOut[ch][bin]; + hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; + hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; } } @@ -1320,51 +1434,52 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric static void ivas_dirac_dec_binaural_determine_processing_matrices( - Decoder_Struct *st_ivas, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], - const int16_t isHeadtracked ) -{ - int16_t chA, chB, bin; - uint8_t separateCenterChannelRendering; + const int16_t isHeadtracked #ifdef MASA_AND_OBJECTS - uint8_t nchanSeparateChannels; + , const int16_t nchanSeparateChannels, + const MASA_ISM_DATA_HANDLE hMasaIsmData #endif + ) +{ + int16_t chA, chB, bin; + int16_t separateCenterChannelRendering; int16_t nBins; #ifdef MASA_AND_OBJECTS int16_t dirac_read_idx; #endif - DIRAC_DEC_BIN_HANDLE h; #ifdef MASA_AND_OBJECTS PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_NUM_OBJECTS]; int16_t idx; + ISM_MODE ism_mode; #else PARAMBIN_HRTF_GAIN_CACHE gainCache; #endif + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; - h = st_ivas->hDiracDecBin; + ivas_format = hConfig->ivas_format; #ifdef MASA_AND_OBJECTS - separateCenterChannelRendering = 0; - nchanSeparateChannels = 0; - - if ( st_ivas->hOutSetup.separateChannelEnabled || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) - { - separateCenterChannelRendering = 1; - nchanSeparateChannels = 1; - } - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) - { - separateCenterChannelRendering = 1; - nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; - } + separateCenterChannelRendering = nchanSeparateChannels > 0; #else - separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; #endif + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ - nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ #ifdef MASA_AND_OBJECTS + ism_mode = hConfig->ism_mode; + // Todo OMASA JBM: This is probably not correct now. We should get the index from JBM - dirac_read_idx = st_ivas->hDirAC->dirac_read_idx; + dirac_read_idx = hSpatParamRendCom->dirac_read_idx; #endif #ifdef MASA_AND_OBJECTS @@ -1390,21 +1505,21 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( CrEneR = 0.0f; /* Formulate main processing matrix M */ - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], - h->ChCrossRe[bin], h->ChCrossIm[bin], - h->ChEneOut[0][bin], h->ChEneOut[1][bin], - h->ChCrossReOut[bin], h->ChCrossImOut[bin], - prototypeMtx, Mre, Mim, h->reqularizationFactor ); + formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], + hDiracDecBin->ChCrossRe[bin], hDiracDecBin->ChCrossIm[bin], + hDiracDecBin->ChEneOut[0][bin], hDiracDecBin->ChEneOut[1][bin], + hDiracDecBin->ChCrossReOut[bin], hDiracDecBin->ChCrossImOut[bin], + prototypeMtx, Mre, Mim, hDiracDecBin->reqularizationFactor ); /* Load estimated covariance matrix to the [2][2] matrix form */ - CxRe[0][0] = h->ChEne[0][bin]; - CxRe[1][1] = h->ChEne[1][bin]; - CxRe[1][0] = h->ChCrossRe[bin]; - CxRe[0][1] = h->ChCrossRe[bin]; + CxRe[0][0] = hDiracDecBin->ChEne[0][bin]; + CxRe[1][1] = hDiracDecBin->ChEne[1][bin]; + CxRe[1][0] = hDiracDecBin->ChCrossRe[bin]; + CxRe[0][1] = hDiracDecBin->ChCrossRe[bin]; CxIm[0][0] = 0.0f; CxIm[1][1] = 0.0f; - CxIm[1][0] = h->ChCrossIm[bin]; - CxIm[0][1] = -h->ChCrossIm[bin]; + CxIm[1][0] = hDiracDecBin->ChCrossIm[bin]; + CxIm[0][1] = -hDiracDecBin->ChCrossIm[bin]; /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ matrixMul( Mre, Mim, CxRe, CxIm, tmpMtxRe, tmpMtxIm ); @@ -1420,30 +1535,30 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( /* Subtract the resulting covariance matrix from the target covariance matrix to determine * what signal component is missing. The result is the target covariance matrix for the residual signal, i.e., * a residual covariance matrix. */ - CrEneL = max( 0.0f, h->ChEneOut[0][bin] - resultMtxRe[0][0] ); - CrEneR = max( 0.0f, h->ChEneOut[1][bin] - resultMtxRe[1][1] ); - CrCrossRe = h->ChCrossReOut[bin] - resultMtxRe[1][0]; - CrCrossIm = h->ChCrossImOut[bin] - resultMtxIm[1][0]; + CrEneL = max( 0.0f, hDiracDecBin->ChEneOut[0][bin] - resultMtxRe[0][0] ); + CrEneR = max( 0.0f, hDiracDecBin->ChEneOut[1][bin] - resultMtxRe[1][1] ); + CrCrossRe = hDiracDecBin->ChCrossReOut[bin] - resultMtxRe[1][0]; + CrCrossIm = hDiracDecBin->ChCrossImOut[bin] - resultMtxIm[1][0]; /* The amount of the decorrelated sound is further controlled based on the spatial metadata, * by determining an energy-suppressed residual covariance matrix that is a control parameter * that guides the processing of the decorrelated sound to a residual signal. * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { decorrelationReductionFactor = 1.0f; } - else if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 1 ) ) + else if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) || ( ivas_format == MASA_FORMAT && nchan_transport == 1 ) ) { - decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ) ); + decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ) ); } - else if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 1 ) + else if ( ivas_format == SBA_FORMAT && nchan_transport == 1 ) { decorrelationReductionFactor = 1.0f; } else { - decorrelationReductionFactor = fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ); + decorrelationReductionFactor = fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ); } CrEneL *= decorrelationReductionFactor; CrEneR *= decorrelationReductionFactor; @@ -1452,7 +1567,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( /* Determine a residual mixing matrix Mdec for processing the decorrelated signal to obtain * the residual signal (that has the residual covariance matrix) */ - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], + formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], 0.0f, 0.0f, /* Decorrelated signal has ideally no cross-terms */ CrEneL, CrEneR, CrCrossRe, CrCrossIm, @@ -1469,7 +1584,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ realizedOutputEne = CrEneL + CrEneR + resultMtxRe[0][0] + resultMtxRe[1][1]; - targetOutputEne = h->ChEneOut[0][bin] + h->ChEneOut[1][bin]; + targetOutputEne = hDiracDecBin->ChEneOut[0][bin] + hDiracDecBin->ChEneOut[1][bin]; missingOutputEne = fmaxf( 0.0f, targetOutputEne - realizedOutputEne ); gain = sqrtf( ( resultMtxRe[0][0] + resultMtxRe[1][1] + missingOutputEne ) / @@ -1490,15 +1605,15 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( { for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - h->processMtxRePrev[chA][chB][bin] = h->processMtxRe[chA][chB][bin]; - h->processMtxImPrev[chA][chB][bin] = h->processMtxIm[chA][chB][bin]; - h->processMtxDecRePrev[chA][chB][bin] = h->processMtxDecRe[chA][chB][bin]; - h->processMtxDecImPrev[chA][chB][bin] = h->processMtxDecIm[chA][chB][bin]; - - h->processMtxRe[chA][chB][bin] = Mre[chA][chB]; - h->processMtxIm[chA][chB][bin] = Mim[chA][chB]; - h->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; - h->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; + hDiracDecBin->processMtxRePrev[chA][chB][bin] = hDiracDecBin->processMtxRe[chA][chB][bin]; + hDiracDecBin->processMtxImPrev[chA][chB][bin] = hDiracDecBin->processMtxIm[chA][chB][bin]; + hDiracDecBin->processMtxDecRePrev[chA][chB][bin] = hDiracDecBin->processMtxDecRe[chA][chB][bin]; + hDiracDecBin->processMtxDecImPrev[chA][chB][bin] = hDiracDecBin->processMtxDecIm[chA][chB][bin]; + + hDiracDecBin->processMtxRe[chA][chB][bin] = Mre[chA][chB]; + hDiracDecBin->processMtxIm[chA][chB][bin] = Mim[chA][chB]; + hDiracDecBin->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; + hDiracDecBin->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; } } @@ -1513,68 +1628,68 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( #ifdef MASA_AND_OBJECTS uint8_t instantChange = 0; - if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + if ( ivas_format == MASA_ISM_FORMAT ) { - gainFactor = 0.7943f * sqrtf( h->earlyPartEneCorrection[bin] ); /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ + gainFactor = 0.7943f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); /* Todo Nokia: Temporary gain for roughly matching the loudness of other processing paths. */ } else { - gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); + gainFactor = 0.8414f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); } for ( chB = 0; chB < nchanSeparateChannels; chB++ ) { - if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + if ( ivas_format == MASA_ISM_FORMAT ) { - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + if ( ism_mode == ISM_MASA_MODE_DISC ) { - aziDeg = st_ivas->hMasaIsmData->azimuth_ism[chB][dirac_read_idx]; - eleDeg = st_ivas->hMasaIsmData->elevation_ism[chB][dirac_read_idx]; + aziDeg = hMasaIsmData->azimuth_ism[chB][dirac_read_idx]; + eleDeg = hMasaIsmData->elevation_ism[chB][dirac_read_idx]; } else { - aziDeg = st_ivas->hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; - eleDeg = st_ivas->hMasaIsmData->elevation_separated_ism[dirac_read_idx]; + aziDeg = hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; + eleDeg = hMasaIsmData->elevation_separated_ism[dirac_read_idx]; instantChange = 1; } } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - h->processMtxRePrev[chA][chB + 2][bin] = h->processMtxRe[chA][chB + 2][bin]; - h->processMtxImPrev[chA][chB + 2][bin] = h->processMtxIm[chA][chB + 2][bin]; + hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; + hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); - h->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; - h->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; - h->processMtxRe[1][chB + 2][bin] = rRealp * gainFactor; - h->processMtxIm[1][chB + 2][bin] = rImagp * gainFactor; + hDiracDecBin->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; + hDiracDecBin->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; + hDiracDecBin->processMtxRe[1][chB + 2][bin] = rRealp * gainFactor; + hDiracDecBin->processMtxIm[1][chB + 2][bin] = rImagp * gainFactor; if ( instantChange ) { for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - h->processMtxRePrev[chA][chB + 2][bin] = h->processMtxRe[chA][chB + 2][bin]; - h->processMtxImPrev[chA][chB + 2][bin] = h->processMtxIm[chA][chB + 2][bin]; + hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; + hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; } } } #else - gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); + gainFactor = 0.8414f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - h->processMtxRePrev[chA][2][bin] = h->processMtxRe[chA][2][bin]; - h->processMtxImPrev[chA][2][bin] = h->processMtxIm[chA][2][bin]; + hDiracDecBin->processMtxRePrev[chA][2][bin] = hDiracDecBin->processMtxRe[chA][2][bin]; + hDiracDecBin->processMtxImPrev[chA][2][bin] = hDiracDecBin->processMtxIm[chA][2][bin]; } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache, isHeadtracked ); + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache, isHeadtracked ); - h->processMtxRe[0][2][bin] = lRealp * gainFactor; - h->processMtxIm[0][2][bin] = lImagp * gainFactor; - h->processMtxRe[1][2][bin] = rRealp * gainFactor; - h->processMtxIm[1][2][bin] = rImagp * gainFactor; + hDiracDecBin->processMtxRe[0][2][bin] = lRealp * gainFactor; + hDiracDecBin->processMtxIm[0][2][bin] = lImagp * gainFactor; + hDiracDecBin->processMtxRe[1][2][bin] = rRealp * gainFactor; + hDiracDecBin->processMtxIm[1][2][bin] = rImagp * gainFactor; #endif } } @@ -1584,12 +1699,15 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( static void ivas_dirac_dec_binaural_process_output( - Decoder_Struct *st_ivas, + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, + const int16_t processReverb, const int16_t subframe ) { int16_t slot, bin, chA, chB; @@ -1598,31 +1716,29 @@ static void ivas_dirac_dec_binaural_process_output( float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - DIRAC_DEC_BIN_HANDLE h; float interpVal; float *decSlotRePointer; float *decSlotImPointer; int16_t offsetSamples; int16_t nSlots; - h = st_ivas->hDiracDecBin; - nBins = st_ivas->hDirAC->num_freq_bands; + nBins = hSpatParamRendCom->num_freq_bands; offsetSamples = 0; - nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; + nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + if ( processReverb ) { /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); + ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); } interpVal = 0.0f; for ( slot = 0; slot < nSlots; slot++ ) { interpVal += 1.0f / (float) nSlots; - if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) + if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { - ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); + ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -1635,7 +1751,7 @@ static void ivas_dirac_dec_binaural_process_output( /* Processing of the first / HRTF part of the binaural output. */ for ( chB = 0; chB < numInChannels; chB++ ) { - if ( st_ivas->hDiracDecBin->useTdDecorr ) + if ( hDiracDecBin->useTdDecorr ) { decSlotRePointer = inRe[chB + 2][slot]; decSlotImPointer = inIm[chB + 2][slot]; @@ -1651,33 +1767,33 @@ static void ivas_dirac_dec_binaural_process_output( float gain; /* Mixing using the formulated processing matrix M */ - gain = ( 1.0f - interpVal ) * h->processMtxRePrev[chA][chB][bin] + - interpVal * h->processMtxRe[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxRePrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxRe[chA][chB][bin]; outSlotRe[bin] += gain * inRe[chB][slot][bin]; outSlotIm[bin] += gain * inIm[chB][slot][bin]; - gain = ( 1.0f - interpVal ) * h->processMtxImPrev[chA][chB][bin] + - interpVal * h->processMtxIm[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxImPrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; outSlotRe[bin] -= gain * inIm[chB][slot][bin]; outSlotIm[bin] += gain * inRe[chB][slot][bin]; /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ if ( bin < max_band_decorr && chB < 2 ) { - gain = ( 1.0f - interpVal ) * h->processMtxDecRePrev[chA][chB][bin] + - interpVal * h->processMtxDecRe[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecRePrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; outSlotRe[bin] += gain * decSlotRePointer[bin]; outSlotIm[bin] += gain * decSlotImPointer[bin]; - gain = ( 1.0f - interpVal ) * h->processMtxDecImPrev[chA][chB][bin] + - interpVal * h->processMtxDecIm[chA][chB][bin]; + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecImPrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxDecIm[chA][chB][bin]; outSlotRe[bin] -= gain * decSlotImPointer[bin]; outSlotIm[bin] += gain * decSlotRePointer[bin]; } } } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + if ( processReverb ) { /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); @@ -1688,7 +1804,7 @@ static void ivas_dirac_dec_binaural_process_output( outSlotImPr = &( outSlotIm[0] ); /* Inverse filter bank */ - cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, st_ivas->cldfbSynDec[chA] ); + cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); } } @@ -2365,7 +2481,10 @@ static void hrtfShGetHrtf( { float shVec[HRTF_SH_CHANNELS]; - ivas_dirac_dec_get_response( aziDeg, eleDeg, shVec, HRTF_SH_ORDER ); + ivas_dirac_dec_get_response( aziDeg, + eleDeg, + shVec, + HRTF_SH_ORDER ); for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) { @@ -2396,7 +2515,6 @@ float configure_reqularization_factor( ) { float reqularizationFactor; - reqularizationFactor = 1.0f; /* Default value */ if ( ivas_format == MASA_FORMAT ) @@ -2447,7 +2565,7 @@ float configure_reqularization_factor( } } - /* For SBA and parametric ISM, default value of 1.0f. */ + /* For SBA and parametric ISM, currently in default value of 1.0f. */ return reqularizationFactor; } @@ -2468,13 +2586,13 @@ void preProcessStereoTransportsForMovedObjects( const int16_t subframe ) { int16_t bin, ch, inCh, outCh, ismDirIndex, slot; - DIRAC_DEC_HANDLE hDirAC; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; MASA_ISM_DATA_HANDLE hMasaIsmData; uint8_t enableCentering; int16_t dirac_read_idx; int16_t nSlots; - hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; hMasaIsmData = st_ivas->hMasaIsmData; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) @@ -2489,7 +2607,7 @@ void preProcessStereoTransportsForMovedObjects( /* Bypass processing until first object is moved */ if ( hMasaIsmData->objectsMoved == 0 ) { - for ( ismDirIndex = 0; ismDirIndex < hDirAC->numIsmDirections; ismDirIndex++ ) + for ( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) { if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) { @@ -2505,8 +2623,8 @@ void preProcessStereoTransportsForMovedObjects( /* Perform object-movement based processing */ // Todo OMASA JBM: Fixed but might be still wrong somehow - nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; - dirac_read_idx = st_ivas->hDirAC->render_to_md_map[subframe]; + nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; for ( bin = 0; bin < nBins; bin++ ) { @@ -2544,7 +2662,7 @@ void preProcessStereoTransportsForMovedObjects( /* For each ismDir, formulate a mix-matrix that moves object audio signals between * left and right channels when needed. Make a combined matrix by a ratio-weighted sum */ - for ( ismDirIndex = 0; ismDirIndex < hDirAC->numIsmDirections; ismDirIndex++ ) + for ( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) { float panGainsOut[2]; float panGainsIn[2]; diff --git a/lib_dec/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c similarity index 99% rename from lib_dec/ivas_dirac_decorr_dec.c rename to lib_rend/ivas_dirac_decorr_dec.c index 3687ed53b1..e831188881 100644 --- a/lib_dec/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -37,9 +37,9 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" -#include "ivas_rom_com.h" #include "ivas_rom_dec.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_dec/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c similarity index 99% rename from lib_dec/ivas_dirac_onsets_dec.c rename to lib_rend/ivas_dirac_onsets_dec.c index c094b45ff6..8a03dc2c50 100644 --- a/lib_dec/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c similarity index 79% rename from lib_dec/ivas_dirac_output_synthesis_dec.c rename to lib_rend/ivas_dirac_output_synthesis_dec.c index 68bd32528f..b4b9f71e01 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" @@ -87,11 +88,12 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha *------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_output_synthesis_open( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - RENDERER_TYPE renderer_type, /* i : renderer type */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t idx, ch_idx; @@ -101,20 +103,20 @@ ivas_error ivas_dirac_dec_output_synthesis_open( float temp_alpha_synthesis[CLDFB_NO_CHANNELS_MAX]; /* pointers to structs for allocation */ - DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /* check / set input parameters */ - assert( hDirAC->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); - assert( hDirAC->hOutSetup.nchan_out_woLFE > 0 && "Error: Number of output channels > 0!" ); - assert( hDirAC->num_outputs_diff > 0 ); - assert( hDirAC->slot_size > 0 ); - assert( hDirAC->hOutSetup.is_loudspeaker_setup == 0 || hDirAC->hOutSetup.is_loudspeaker_setup == 1 ); - assert( hDirAC->diffuse_response_function != NULL ); + assert( hSpatParamRendCom->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); + assert( hDirACRend->hOutSetup.nchan_out_woLFE > 0 && "Error: Number of output channels > 0!" ); + assert( hDirACRend->num_outputs_diff > 0 ); + assert( hSpatParamRendCom->slot_size > 0 ); + assert( hDirACRend->hOutSetup.is_loudspeaker_setup == 0 || hDirACRend->hOutSetup.is_loudspeaker_setup == 1 ); + assert( hDirACRend->diffuse_response_function != NULL ); - if ( hDirAC->proto_signal_decorr_on ) + if ( hDirACRend->proto_signal_decorr_on ) { - dirac_output_synthesis_params->max_band_decorr = hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + dirac_output_synthesis_params->max_band_decorr = hDirACRend->h_freq_domain_decorr_ap_params->max_band_decorr; } else { @@ -126,16 +128,16 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *-----------------------------------------------------------------*/ dirac_output_synthesis_state->diffuse_responses_square = NULL; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( 2 * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -143,16 +145,16 @@ ivas_error ivas_dirac_dec_output_synthesis_open( /* prototype power buffers */ dirac_output_synthesis_state->proto_power_smooth_prev = NULL; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_protos_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - if ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) + if ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) { - if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -171,42 +173,42 @@ ivas_error ivas_dirac_dec_output_synthesis_open( /* target PSD buffers */ if ( hodirac_flag ) { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; } else { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -219,23 +221,23 @@ ivas_error ivas_dirac_dec_output_synthesis_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirAC->synthesisConf != DIRAC_SYNTHESIS_MONO ) + else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_MONO ) { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } else { - if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -246,32 +248,32 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *-----------------------------------------------------------------*/ /* compute alpha */ - if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) + if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { - computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); + computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); if ( ( dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis, dirac_output_synthesis_params->numAlphas ); - computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); + computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands, hDirACRend->frequency_axis, output_Fs ); if ( ( dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis_fast, dirac_output_synthesis_params->numAlphasFast ); - if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, hDirAC->num_freq_bands ); - set_zero( dirac_output_synthesis_state->direction_smoothness_prev, hDirAC->num_freq_bands ); + set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, hSpatParamRendCom->num_freq_bands ); + set_zero( dirac_output_synthesis_state->direction_smoothness_prev, hSpatParamRendCom->num_freq_bands ); } else { @@ -288,13 +290,13 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } /* prepare diffuse response function */ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { num_diffuse_responses = 2; } else { - num_diffuse_responses = hDirAC->hOutSetup.nchan_out_woLFE; + num_diffuse_responses = hDirACRend->hOutSetup.nchan_out_woLFE; } if ( dirac_output_synthesis_state->diffuse_responses_square != NULL ) @@ -302,34 +304,34 @@ ivas_error ivas_dirac_dec_output_synthesis_open( for ( ch_idx = 0; ch_idx < num_diffuse_responses; ++ch_idx ) { /*dirac_output_synthesis_state->diffuse_responses_square[ch_idx] = pow(dirac_output_synthesis_params->diffuse_response_function[ch_idx]/max_response, 2.0f);*/ - tmp = hDirAC->diffuse_response_function[ch_idx]; + tmp = hDirACRend->diffuse_response_function[ch_idx]; dirac_output_synthesis_state->diffuse_responses_square[ch_idx] = tmp * tmp; } } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { int16_t diff_compensation_order; float diff_nrg_total, diff_nrg, diff_nrg_trans, diff_nrg_decorr; diff_compensation_order = nchan_transport >= 3 ? 3 : 2; /* compensate missing diffuseness modelling up order 2, except for HR*/ - diff_compensation_order = min( diff_compensation_order, hDirAC->hOutSetup.ambisonics_order ); + diff_compensation_order = min( diff_compensation_order, hDirACRend->hOutSetup.ambisonics_order ); diff_nrg_total = 0; diff_nrg_trans = 0; diff_nrg_decorr = 0; for ( ch_idx = 0; ch_idx < ( diff_compensation_order + 1 ) * ( diff_compensation_order + 1 ); ch_idx++ ) { - diff_nrg = hDirAC->diffuse_response_function[ch_idx] * hDirAC->diffuse_response_function[ch_idx]; + diff_nrg = hDirACRend->diffuse_response_function[ch_idx] * hDirACRend->diffuse_response_function[ch_idx]; diff_nrg_total += diff_nrg; /* is it a transport channel?*/ - if ( ch_idx == 0 || hDirAC->proto_index_dir[ch_idx] != 0 ) + if ( ch_idx == 0 || hDirACRend->proto_index_dir[ch_idx] != 0 ) { diff_nrg_trans += diff_nrg; } /* is it a decorrelated or transport channel?*/ - if ( ch_idx < hDirAC->num_outputs_diff ) + if ( ch_idx < hDirACRend->num_outputs_diff ) { diff_nrg_decorr += diff_nrg; } @@ -354,9 +356,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_init( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t size; @@ -364,8 +367,8 @@ void ivas_dirac_dec_output_synthesis_init( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /*-----------------------------------------------------------------* * init outputSynthesisPSD_Init @@ -374,45 +377,45 @@ void ivas_dirac_dec_output_synthesis_init( /* initialize buffers */ if ( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev != NULL ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( hodirac_flag ) { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * DIRAC_HO_NUMSECTORS; } else { - size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir; + size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff ); } - else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) + else if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); } else { - set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( h_dirac_output_synthesis_state->proto_power_smooth_prev != NULL ) { - set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_protos_dir ); + set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir ); } set_zero( h_dirac_output_synthesis_state->gains_dir_prev, size ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - set_zero( h_dirac_output_synthesis_state->gains_diff_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff ); + set_zero( h_dirac_output_synthesis_state->gains_diff_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff ); } else { - set_zero( h_dirac_output_synthesis_state->gains_diff_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); + set_zero( h_dirac_output_synthesis_state->gains_diff_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } if ( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev != NULL ) @@ -431,12 +434,12 @@ void ivas_dirac_dec_output_synthesis_init( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: DirAC handle */ + DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ ) { /* pointers to structs for allocation */ - DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + DIRAC_OUTPUT_SYNTHESIS_PARAMS *dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + DIRAC_OUTPUT_SYNTHESIS_STATE *dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); /*-----------------------------------------------------------------* * memory deallocation @@ -537,15 +540,16 @@ void ivas_dirac_dec_output_synthesis_process_slot( const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t sh_rot_max_order, const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport, /* i : number of transport channels*/ const int16_t md_idx, - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -) + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim ) { int16_t num_freq_bands, num_channels_dir; int16_t num_freq_bands_diff, num_channels_diff; @@ -555,8 +559,8 @@ void ivas_dirac_dec_output_synthesis_process_slot( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); h_dirac_output_synthesis_state->onset_filter = onset; @@ -565,19 +569,20 @@ void ivas_dirac_dec_output_synthesis_process_slot( *-----------------------------------------------------------------*/ /* collect some often used parameters */ - num_freq_bands = hDirAC->num_freq_bands; - num_channels_dir = hDirAC->num_outputs_dir; - num_channels_diff = hDirAC->num_outputs_diff; + num_freq_bands = hSpatParamRendCom->num_freq_bands; + num_channels_dir = hDirACRend->num_outputs_dir; + num_channels_diff = hDirACRend->num_outputs_diff; num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) { num_channels_dir = hOutSetup.nchan_out_woLFE; } - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) { - ivas_dirac_dec_compute_directional_responses( hDirAC, + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, hVBAPdata, NULL, #ifdef MASA_AND_OBJECTS @@ -592,157 +597,160 @@ void ivas_dirac_dec_output_synthesis_process_slot( hodirac_flag ); } - if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + if ( dec_param_estim == FALSE && hodirac_flag ) { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - v_multc( hDirAC->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); + v_multc( hSpatParamRendCom->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio1[md_idx], + mvr2r( hSpatParamRendCom->energy_ratio1[md_idx], h_dirac_output_synthesis_state->direct_power_factor, num_freq_bands ); mvr2r( aux_buf, h_dirac_output_synthesis_state->diffuse_power_factor, num_freq_bands ); - v_multc( hDirAC->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); + v_multc( hSpatParamRendCom->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio2[md_idx], - &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], + mvr2r( hSpatParamRendCom->energy_ratio2[md_idx], + &h_dirac_output_synthesis_state->direct_power_factor[hSpatParamRendCom->num_freq_bands], num_freq_bands ); mvr2r( aux_buf, - &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], + &h_dirac_output_synthesis_state->diffuse_power_factor[hSpatParamRendCom->num_freq_bands], num_freq_bands ); } else { ivas_dirac_dec_compute_gain_factors( num_freq_bands, - hDirAC->diffuseness_vector[md_idx], + hSpatParamRendCom->diffuseness_vector[md_idx], h_dirac_output_synthesis_params->max_band_decorr, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor ); } } - else if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hDirAC, - hVBAPdata, - NULL, + else // ( dec_param_estim == TRUE ) + if ( dec_param_estim == TRUE ) + { + + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + hVBAPdata, + NULL, #ifdef MASA_AND_OBJECTS - NULL, + NULL, #endif - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); - - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) - { - int16_t k; - if ( ch_idx != 0 ) + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) { - float a, b, c; - - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) + int16_t k; + if ( ch_idx != 0 ) { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + float a, b, c; + + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } } - for ( ; k < num_freq_bands; k++ ) + else { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } } - else + + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - } - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); - } + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirACRend->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + return; + } + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } - - return; - } - else - { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); } - } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) { computeTargetPSDs_diffuse_with_onsets( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, - hDirAC->proto_index_diff, + hDirACRend->proto_index_diff, h_dirac_output_synthesis_state->diffuse_power_factor, reference_power, h_dirac_output_synthesis_state->diffuse_responses_square, @@ -753,7 +761,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( } /* process other PSDs only slot wise for 4 transport channels */ - if ( hDirAC->hConfig->dec_param_estim == TRUE ) + if ( dec_param_estim == TRUE ) { computeTargetPSDs_direct( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor, reference_power, h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth ); @@ -773,13 +781,14 @@ void ivas_dirac_dec_output_synthesis_process_slot( void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, float *diffuseness, - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ -) + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim ) { int16_t buf_idx, ch_idx, i, l; int16_t num_freq_bands, num_freq_bands_diff; @@ -802,15 +811,15 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ratio[DIRAC_HO_NUMSECTORS * CLDFB_NO_CHANNELS_MAX]; /* collect some often used parameters */ - h_dirac_output_synthesis_params = hDirAC->h_output_synthesis_psd_params; - h_dirac_output_synthesis_state = hDirAC->h_output_synthesis_psd_state; - proto_direct_index = hDirAC->proto_index_dir; + h_dirac_output_synthesis_params = hDirACRend->h_output_synthesis_psd_params; + h_dirac_output_synthesis_state = hDirACRend->h_output_synthesis_psd_state; + proto_direct_index = hDirACRend->proto_index_dir; - num_protos_dir = hDirAC->num_protos_dir; - num_freq_bands = hDirAC->num_freq_bands; + num_protos_dir = hDirACRend->num_protos_dir; + num_freq_bands = hSpatParamRendCom->num_freq_bands; num_freq_bands_diff = h_dirac_output_synthesis_params.max_band_decorr; - num_channels_dir = hDirAC->num_outputs_dir; - num_channels_diff = hDirAC->num_outputs_diff; + num_channels_dir = hDirACRend->num_outputs_dir; + num_channels_diff = hDirACRend->num_outputs_diff; nchan_transport_foa = min( 4, nchan_transport ); @@ -820,7 +829,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( if ( hodirac_flag ) { - assert( hDirAC->hConfig->dec_param_estim == FALSE ); /*Direct gain*/ for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) { @@ -845,7 +853,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( l = 0; l < num_freq_bands; l++ ) { aux_buf[l] = 1.f - diffuseness[l]; - ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[hDirAC->num_freq_bands + l]; + ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[hSpatParamRendCom->num_freq_bands + l]; ratio[l + num_freq_bands] = 1.f - ratio[l]; } @@ -866,12 +874,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) { v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, - hDirAC->diffuse_response_function[ch_idx], + hDirACRend->diffuse_response_function[ch_idx], &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], num_freq_bands_diff ); } } - else if ( hDirAC->hConfig->dec_param_estim == FALSE ) + else if ( dec_param_estim == FALSE ) { /*Direct gain*/ for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) @@ -906,7 +914,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( /*Diffuse gain*/ for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) { - v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, hDirAC->diffuse_response_function[ch_idx], &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], num_freq_bands_diff ); + v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, hDirACRend->diffuse_response_function[ch_idx], &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], num_freq_bands_diff ); } } @@ -1120,8 +1128,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( l = 0; l < num_freq_bands_diff; l++ ) { g = g1 * ( *( p_gains_diff++ ) ) + g2 * ( *( p_gains_diff_prev++ ) ); - output_real[l * num_channels_dir + hDirAC->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); /* maps ch_idx 5 to 8 */ - output_imag[l * num_channels_dir + hDirAC->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); + output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); /* maps ch_idx 5 to 8 */ + output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); } } else @@ -1138,14 +1146,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( * Copy output or HOA decoder *-----------------------------------------------------------------*/ - if ( hDirAC->hOutSetup.is_loudspeaker_setup && hDirAC->hoa_decoder != NULL ) + if ( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) { float *p_real, *p_imag; const float *hoa_decoder; - hoa_decoder = hDirAC->hoa_decoder; + hoa_decoder = hDirACRend->hoa_decoder; - for ( ch_idx = 0; ch_idx < hDirAC->hOutSetup.nchan_out_woLFE; ch_idx++ ) + for ( ch_idx = 0; ch_idx < hDirACRend->hOutSetup.nchan_out_woLFE; ch_idx++ ) { p_real = RealBuffer[ch_idx][buf_idx]; p_imag = ImagBuffer[ch_idx][buf_idx]; @@ -1219,11 +1227,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ const int16_t nbslots, /* i : number of slots to process */ float *diffuseness_vector, float *reference_power_smooth, - float qualityBasedSmFactor ) + float qualityBasedSmFactor, + const int16_t enc_param_start_band ) { int16_t buf_idx, num_freq_bands; int16_t diff_start_band; @@ -1256,24 +1266,24 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( push_wmops( "dirac_out_synth_sfr" ); - h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); - proto_direct_index = hDirAC->proto_index_dir; - num_protos_dir = hDirAC->num_protos_dir; - nchan_out_woLFE = hDirAC->hOutSetup.nchan_out_woLFE; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + proto_direct_index = hDirACRend->proto_index_dir; + num_protos_dir = hDirACRend->num_protos_dir; + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; /* collect some often used parameters */ - num_freq_bands = hDirAC->num_freq_bands; + num_freq_bands = hSpatParamRendCom->num_freq_bands; /*-----------------------------------------------------------------* * compute target PSDs *-----------------------------------------------------------------*/ - if ( hDirAC->hConfig->enc_param_start_band == 0 ) + if ( enc_param_start_band == 0 ) { diff_start_band = h_dirac_output_synthesis_params->use_onset_filters == 1 ? h_dirac_output_synthesis_params->max_band_decorr : 0; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { nchan_target_psds = 2; } @@ -1301,11 +1311,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( * compute variables for stereo transport signal type detection *-----------------------------------------------------------------*/ - if ( hDirAC->masa_stereo_type_detect != NULL ) + if ( hDirACRend->masa_stereo_type_detect != NULL ) { + MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect = hDirACRend->masa_stereo_type_detect; + p_cy_auto_dir_smooth = h_dirac_output_synthesis_state->cy_auto_dir_smooth; p_cy_auto_diff_smooth = h_dirac_output_synthesis_state->cy_auto_diff_smooth; - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { target_power_y = p_cy_auto_dir_smooth[num_freq_bands] / ( sqrtf( h_dirac_output_synthesis_state->direct_power_factor[0] ) + EPSILON ); target_power_y += p_cy_auto_diff_smooth[num_freq_bands] / ( sqrtf( h_dirac_output_synthesis_state->diffuse_power_factor[0] ) + EPSILON ); @@ -1314,19 +1326,19 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( { target_power_y = p_cy_auto_dir_smooth[num_freq_bands] + p_cy_auto_diff_smooth[num_freq_bands]; } - subtract_power_y = hDirAC->masa_stereo_type_detect->subtract_power_y; + subtract_power_y = masa_stereo_type_detect->subtract_power_y; a = 0.0004f; /* Temporal smoothing coefficient */ b = 1.0f - a; /* Temporal smoothing coefficient */ - hDirAC->masa_stereo_type_detect->target_power_y_smooth = a * target_power_y + b * hDirAC->masa_stereo_type_detect->target_power_y_smooth; - hDirAC->masa_stereo_type_detect->subtract_power_y_smooth = a * subtract_power_y + b * hDirAC->masa_stereo_type_detect->subtract_power_y_smooth; + masa_stereo_type_detect->target_power_y_smooth = a * target_power_y + b * masa_stereo_type_detect->target_power_y_smooth; + masa_stereo_type_detect->subtract_power_y_smooth = a * subtract_power_y + b * masa_stereo_type_detect->subtract_power_y_smooth; - subtract_target_ratio = hDirAC->masa_stereo_type_detect->subtract_power_y_smooth / ( hDirAC->masa_stereo_type_detect->target_power_y_smooth + EPSILON ); + subtract_target_ratio = masa_stereo_type_detect->subtract_power_y_smooth / ( masa_stereo_type_detect->target_power_y_smooth + EPSILON ); subtract_target_ratio_db = 10.0f * log10f( subtract_target_ratio ); - hDirAC->masa_stereo_type_detect->subtract_target_ratio_db = subtract_target_ratio_db; + masa_stereo_type_detect->subtract_target_ratio_db = subtract_target_ratio_db; - hDirAC->masa_stereo_type_detect->subtract_power_y = 0.0f; + masa_stereo_type_detect->subtract_power_y = 0.0f; } /*-----------------------------------------------------------------* @@ -1735,9 +1747,10 @@ static void ivas_dirac_dec_get_response_split_order( *------------------------------------------------------------------------*/ void ivas_dirac_dec_compute_directional_responses( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ - const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ #ifdef MASA_AND_OBJECTS MASA_ISM_DATA_HANDLE hMasaIsm, /* i : MASA_ISM data structure */ #endif @@ -1768,29 +1781,29 @@ void ivas_dirac_dec_compute_directional_responses( elevation2 = NULL; transport_signal_type = MASA_STEREO_NOT_DEFINED; - if ( hDirAC->masa_stereo_type_detect != NULL ) + if ( hDirACRend->masa_stereo_type_detect != NULL ) { - dipole_freq_range[0] = hDirAC->masa_stereo_type_detect->dipole_freq_range[0]; - dipole_freq_range[1] = hDirAC->masa_stereo_type_detect->dipole_freq_range[1]; - transport_signal_type = hDirAC->masa_stereo_type_detect->masa_stereo_type; + dipole_freq_range[0] = hDirACRend->masa_stereo_type_detect->dipole_freq_range[0]; + dipole_freq_range[1] = hDirACRend->masa_stereo_type_detect->dipole_freq_range[1]; + transport_signal_type = hDirACRend->masa_stereo_type_detect->masa_stereo_type; } - num_channels_dir = hDirAC->num_outputs_dir; + num_channels_dir = hDirACRend->num_outputs_dir; #ifdef MASA_AND_OBJECTS - if ( hDirAC->numParametricDirections == 2 ) + if ( hSpatParamRendCom->numParametricDirections == 2 ) #else - if ( hDirAC->numSimultaneousDirections == 2 ) + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) #endif { - azimuth2 = hDirAC->azimuth2[md_idx]; - elevation2 = hDirAC->elevation2[md_idx]; + azimuth2 = hSpatParamRendCom->azimuth2[md_idx]; + elevation2 = hSpatParamRendCom->elevation2[md_idx]; } codingBand = -1; assert( num_channels_dir <= MAX_OUTPUT_CHANNELS && "Number of channels is too high" ); - for ( k = 0; k < hDirAC->num_freq_bands; ++k ) + for ( k = 0; k < hSpatParamRendCom->num_freq_bands; ++k ) { if ( hMasa != NULL && k == MASA_band_grouping_24[hMasa->data.band_mapping[codingBand + 1]] ) { @@ -1799,24 +1812,24 @@ void ivas_dirac_dec_compute_directional_responses( if ( hMasa != NULL && k > MASA_band_grouping_24[hMasa->data.band_mapping[codingBand]] && k < MASA_band_grouping_24[hMasa->data.band_mapping[codingBand + 1]] && - k != hDirAC->h_output_synthesis_psd_params.max_band_decorr ) + k != hDirACRend->h_output_synthesis_psd_params.max_band_decorr ) { /* Panning gains have to be computed only for the first bin of the coding band in MASA, for other bins the previous values can be used */ - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - mvr2r_inc( &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k - 1], - hDirAC->num_freq_bands, &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k], - hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k - 1], + hSpatParamRendCom->num_freq_bands, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], + hSpatParamRendCom->num_freq_bands, num_channels_dir ); } - mvr2r_inc( &hDirAC->h_output_synthesis_psd_state.direct_responses[k - 1], - hDirAC->num_freq_bands, - &hDirAC->h_output_synthesis_psd_state.direct_responses[k], - hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( &hDirACRend->h_output_synthesis_psd_state.direct_responses[k - 1], + hSpatParamRendCom->num_freq_bands, + &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], + hSpatParamRendCom->num_freq_bands, num_channels_dir ); } else { /* HOA3 PANNING */ - if ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) + if ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 ) { set_f( direct_response_hoa, 1.0f, MAX_OUTPUT_CHANNELS ); set_f( direct_response_dir2, 1.0f, MAX_OUTPUT_CHANNELS ); @@ -1832,41 +1845,40 @@ void ivas_dirac_dec_compute_directional_responses( } else { - ivas_dirac_dec_get_response( azimuth[k], elevation[k], direct_response_hoa, hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( azimuth[k], elevation[k], direct_response_hoa, hDirACRend->hOutSetup.ambisonics_order ); if ( hodirac_flag ) { - ivas_dirac_dec_get_response( azimuth2[k], elevation2[k], direct_response_dir2, hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( azimuth2[k], elevation2[k], direct_response_dir2, hDirACRend->hOutSetup.ambisonics_order ); } } - if ( hMasa == NULL && hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hMasa == NULL && hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - mvr2r_inc( direct_response_hoa, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_hoa, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); if ( hodirac_flag ) { - mvr2r_inc( direct_response_dir2, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k + hDirAC->num_freq_bands * num_channels_dir], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_dir2, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k + hSpatParamRendCom->num_freq_bands * num_channels_dir], hSpatParamRendCom->num_freq_bands, num_channels_dir ); } } - else if ( ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) && ( hMasa != NULL ) ) || - hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else if ( ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) && ( hMasa != NULL ) ) || + hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ - spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); - + spreadCoherencePanningHoa( azimuth[k], elevation[k], hSpatParamRendCom->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); /* Synthesize the second direction and combine the gains */ #ifdef MASA_AND_OBJECTS - if ( hDirAC->numParametricDirections == 2 ) + if ( hSpatParamRendCom->numParametricDirections == 2 ) #else - if ( hDirAC->numSimultaneousDirections == 2 ) + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) #endif { - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); + spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hSpatParamRendCom->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirACRend->hOutSetup.ambisonics_order ); /* Combine gains from the two directions */ - totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; + totalDirect = hSpatParamRendCom->energy_ratio1[md_idx][k] + hSpatParamRendCom->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = hSpatParamRendCom->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = hSpatParamRendCom->energy_ratio2[md_idx][k] / totalDirect; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_hoa[l] *= directRatio[0]; @@ -1876,7 +1888,7 @@ void ivas_dirac_dec_compute_directional_responses( #ifdef MASA_AND_OBJECTS // Todo OMASA JBM: Here we probably need to use md_idx for meta access - if ( hDirAC->numIsmDirections > 0 ) + if ( hSpatParamRendCom->numIsmDirections > 0 ) { int16_t dir; float direct_response_temp[MAX_OUTPUT_CHANNELS]; @@ -1886,33 +1898,33 @@ void ivas_dirac_dec_compute_directional_responses( set_zero( direct_response_ism, num_channels_dir ); - for ( dir = 0; dir < hDirAC->numIsmDirections; dir++ ) + for ( dir = 0; dir < hSpatParamRendCom->numIsmDirections; dir++ ) { if ( hMasaIsm->ism_is_edited[dir] ) { - ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism_edited[dir], hMasaIsm->elevation_ism_edited[dir], direct_response_temp, hDirACRend->hOutSetup.ambisonics_order ); } else { - ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], direct_response_temp, hDirAC->hOutSetup.ambisonics_order ); + ivas_dirac_dec_get_response( hMasaIsm->azimuth_ism[dir][hSpatParamRendCom->dirac_read_idx], hMasaIsm->elevation_ism[dir][hSpatParamRendCom->dirac_read_idx], direct_response_temp, hDirACRend->hOutSetup.ambisonics_order ); } for ( l = 0; l < num_channels_dir; l++ ) { - direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; + direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hSpatParamRendCom->dirac_read_idx][k]; } } - masaDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + EPSILON; - if ( hDirAC->numParametricDirections == 2 ) + masaDirect = hSpatParamRendCom->energy_ratio1[hSpatParamRendCom->dirac_read_idx][k] + EPSILON; + if ( hSpatParamRendCom->numParametricDirections == 2 ) { - masaDirect += hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k]; + masaDirect += hSpatParamRendCom->energy_ratio2[hSpatParamRendCom->dirac_read_idx][k]; } - ismDirect = hMasaIsm->energy_ratio_ism[0][hDirAC->dirac_read_idx][k]; - for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) + ismDirect = hMasaIsm->energy_ratio_ism[0][hSpatParamRendCom->dirac_read_idx][k]; + for ( dir = 1; dir < hSpatParamRendCom->numIsmDirections; dir++ ) { - ismDirect += hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; + ismDirect += hMasaIsm->energy_ratio_ism[dir][hSpatParamRendCom->dirac_read_idx][k]; } totalDirect = masaDirect + ismDirect; @@ -1937,10 +1949,10 @@ void ivas_dirac_dec_compute_directional_responses( /* Set computed gains */ direct_response = direct_response_hoa; - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { v_mult( direct_response, direct_response, direct_response_square, num_channels_dir ); - mvr2r_inc( direct_response_square, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); if ( transport_signal_type == MASA_STEREO_SPACED_MICS ) { @@ -1952,38 +1964,37 @@ void ivas_dirac_dec_compute_directional_responses( } else { - set_f( direct_response, 1.0f, hDirAC->num_protos_ambi ); + set_f( direct_response, 1.0f, hDirACRend->num_protos_ambi ); } } - mvr2r_inc( direct_response, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); } else { assert( 0 && "Not supported synthesis method!" ); } } - else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ + else if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ - spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); + spreadCoherencePanningVbap( azimuth[k], elevation[k], hSpatParamRendCom->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ #ifdef MASA_AND_OBJECTS - if ( hDirAC->numParametricDirections == 2 ) + if ( hSpatParamRendCom->numParametricDirections == 2 ) #else - if ( hDirAC->numSimultaneousDirections == 2 ) + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) #endif - { - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); + spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hSpatParamRendCom->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ - totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; + totalDirect = hSpatParamRendCom->energy_ratio1[md_idx][k] + hSpatParamRendCom->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = hSpatParamRendCom->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = hSpatParamRendCom->energy_ratio2[md_idx][k] / totalDirect; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= directRatio[0]; @@ -1994,7 +2005,7 @@ void ivas_dirac_dec_compute_directional_responses( #ifdef MASA_AND_OBJECTS // Todo OMASA JBM: Here we also probably need md_idx - if ( hDirAC->numIsmDirections > 0 ) + if ( hSpatParamRendCom->numIsmDirections > 0 ) { int16_t dir; float direct_response_temp[MAX_OUTPUT_CHANNELS]; @@ -2004,7 +2015,7 @@ void ivas_dirac_dec_compute_directional_responses( set_zero( direct_response_ism, num_channels_dir ); - for ( dir = 0; dir < hDirAC->numIsmDirections; dir++ ) + for ( dir = 0; dir < hSpatParamRendCom->numIsmDirections; dir++ ) { if ( hMasaIsm->ism_is_edited[dir] ) { @@ -2012,26 +2023,26 @@ void ivas_dirac_dec_compute_directional_responses( } else { - vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir][hDirAC->dirac_read_idx], hMasaIsm->elevation_ism[dir][hDirAC->dirac_read_idx], 1 ); + vbap_determine_gains( hVBAPdata, direct_response_temp, hMasaIsm->azimuth_ism[dir][hSpatParamRendCom->dirac_read_idx], hMasaIsm->elevation_ism[dir][hSpatParamRendCom->dirac_read_idx], 1 ); } for ( l = 0; l < num_channels_dir; l++ ) { - direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; + direct_response_ism[l] += direct_response_temp[l] * hMasaIsm->energy_ratio_ism[dir][hSpatParamRendCom->dirac_read_idx][k]; } } normalizePanningGains( direct_response_ism, num_channels_dir ); - masaDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + EPSILON; - if ( hDirAC->numParametricDirections == 2 ) + masaDirect = hSpatParamRendCom->energy_ratio1[hSpatParamRendCom->dirac_read_idx][k] + EPSILON; + if ( hSpatParamRendCom->numParametricDirections == 2 ) { - masaDirect += hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k]; + masaDirect += hSpatParamRendCom->energy_ratio2[hSpatParamRendCom->dirac_read_idx][k]; } - ismDirect = hMasaIsm->energy_ratio_ism[0][hDirAC->dirac_read_idx][k]; - for ( dir = 1; dir < hDirAC->numIsmDirections; dir++ ) + ismDirect = hMasaIsm->energy_ratio_ism[0][hSpatParamRendCom->dirac_read_idx][k]; + for ( dir = 1; dir < hSpatParamRendCom->numIsmDirections; dir++ ) { - ismDirect += hMasaIsm->energy_ratio_ism[dir][hDirAC->dirac_read_idx][k]; + ismDirect += hMasaIsm->energy_ratio_ism[dir][hSpatParamRendCom->dirac_read_idx][k]; } totalDirect = masaDirect + ismDirect; @@ -2051,12 +2062,12 @@ void ivas_dirac_dec_compute_directional_responses( int16_t num_channels_surrCoh; num_channels_surrCoh = num_channels_dir; - num_channels_surrCoh -= hDirAC->num_ele_spk_no_diffuse_rendering; + num_channels_surrCoh -= hDirACRend->num_ele_spk_no_diffuse_rendering; for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= sqrtf( 1.0f - surCohRatio[k] ); - if ( hDirAC->diffuse_response_function[l] > 0.f ) + if ( hDirACRend->diffuse_response_function[l] > 0.f ) { direct_response_ls[l] += sqrtf( surCohRatio[k] / (float) num_channels_surrCoh ); } @@ -2067,8 +2078,8 @@ void ivas_dirac_dec_compute_directional_responses( /* Set computed gains */ direct_response = direct_response_ls; v_mult( direct_response, direct_response, direct_response_square, num_channels_dir ); - mvr2r_inc( direct_response_square, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses_square[k], hDirAC->num_freq_bands, num_channels_dir ); - mvr2r_inc( direct_response, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response_square, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses_square[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); + mvr2r_inc( direct_response, 1, &hDirACRend->h_output_synthesis_psd_state.direct_responses[k], hSpatParamRendCom->num_freq_bands, num_channels_dir ); } else { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c new file mode 100644 index 0000000000..d5bb1052c0 --- /dev/null +++ b/lib_rend/ivas_dirac_rend.c @@ -0,0 +1,2061 @@ +/****************************************************************************************************** + +(C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +the software. This notice grants no license of any kind, including but not limited to patent +license, nor is any license granted by implication, estoppel or otherwise. + +Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include "options.h" +#include +#include "cnst.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_cnst.h" +#include "ivas_rom_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +/*------------------------------------------------------------------------- + * ivas_dirac_allocate_parameters() + * + * Allocate and initialize DirAC parameters + *-------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_allocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +) +{ + int16_t i; + + if ( params_flag == 1 ) + { + if ( ( hSpatParamRendCom->azimuth = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->elevation = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->diffuseness_vector = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->energy_ratio1 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->spreadCoherence = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->surroundingCoherence = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + for ( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + { + if ( ( hSpatParamRendCom->azimuth[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->azimuth[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->elevation[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->elevation[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->diffuseness_vector[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->diffuseness_vector[i], 1.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->energy_ratio1[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->energy_ratio1[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->spreadCoherence[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->spreadCoherence[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->surroundingCoherence[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->surroundingCoherence[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + } + } + else if ( params_flag == 2 ) + { + if ( ( hSpatParamRendCom->azimuth2 = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->elevation2 = (int16_t **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->energy_ratio2 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hSpatParamRendCom->spreadCoherence2 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + for ( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + { + if ( ( hSpatParamRendCom->azimuth2[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->azimuth2[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->elevation2[i] = (int16_t *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hSpatParamRendCom->elevation2[i], 0, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->energy_ratio2[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->energy_ratio2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + + if ( ( hSpatParamRendCom->spreadCoherence2[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hSpatParamRendCom->spreadCoherence2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + } + } + + return IVAS_ERR_OK; +} + + +ivas_error ivas_spat_hSpatParamRendCom_config( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const int16_t dec_param_estim_flag, + const IVAS_FORMAT ivas_format, + const MC_MODE mc_mode, + const int32_t output_Fs, + const int16_t hodirac_flag ) +{ + ivas_error error; + int16_t map_idx; + DIRAC_CONFIG_FLAG flag_config; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; + error = IVAS_ERR_OK; + + hSpatParamRendCom = NULL; + + if ( flag_config == DIRAC_RECONFIGURE ) + { + hSpatParamRendCom = *hSpatParamRendCom_out; + } + else if ( flag_config == DIRAC_OPEN ) + { + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC meta\n" ) ); + } + + *hSpatParamRendCom_out = hSpatParamRendCom; + } + + + if ( flag_config == DIRAC_OPEN ) + { + hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpatParamRendCom->subframes_rendered = 0; + hSpatParamRendCom->slots_rendered = 0; + hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); +#ifdef MASA_AND_OBJECTS + hSpatParamRendCom->numSimultaneousDirections = 0; + hSpatParamRendCom->numParametricDirections = 0; + hSpatParamRendCom->numIsmDirections = 0; +#else + hSpatParamRendCom->numSimultaneousDirections = 0; +#endif + } + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + if ( ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE ) + { + if ( hodirac_flag && hSpatParamRendCom->azimuth2 == NULL ) + { + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( !hodirac_flag && hSpatParamRendCom->azimuth2 != NULL ) + { + ivas_dirac_deallocate_parameters( hSpatParamRendCom, 2 ); + } + } + + if ( flag_config == DIRAC_OPEN ) + { + hSpatParamRendCom->dirac_md_buffer_length = 0; + hSpatParamRendCom->dirac_bs_md_write_idx = 0; + hSpatParamRendCom->dirac_read_idx = 0; + if ( mc_mode == MC_MODE_MCMASA ) + { + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) + { + hSpatParamRendCom->render_to_md_map[map_idx] = map_idx; + } + } +#ifdef MASA_AND_OBJECTS + else if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) +#else + else if ( ivas_format == MASA_FORMAT ) +#endif + { + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; + hSpatParamRendCom->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) + { + hSpatParamRendCom->render_to_md_map[map_idx] = map_idx; + } + } + else + { + int16_t num_slots_in_subfr; + num_slots_in_subfr = dec_param_estim_flag ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; + hSpatParamRendCom->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); + hSpatParamRendCom->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + hSpatParamRendCom->dirac_read_idx = 0; + + set_s( hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS * num_slots_in_subfr; map_idx++ ) + { + hSpatParamRendCom->render_to_md_map[map_idx] = hSpatParamRendCom->dirac_read_idx + map_idx / num_slots_in_subfr; + } + } + + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + +#ifdef MASA_AND_OBJECTS + if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ( ivas_format == SBA_FORMAT && hodirac_flag ) ) +#else + if ( ivas_format == MASA_FORMAT || ( ivas_format == SBA_FORMAT && hodirac_flag ) ) +#endif + { + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + hSpatParamRendCom->azimuth2 = NULL; + hSpatParamRendCom->elevation2 = NULL; + hSpatParamRendCom->energy_ratio2 = NULL; + hSpatParamRendCom->spreadCoherence2 = NULL; + } + } + + return error; +} + + +void ivas_spat_hSpatParamRendCom_close( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out ) +{ + if ( hSpatParamRendCom_out == NULL || *hSpatParamRendCom_out == NULL ) + { + return; + } + + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 1 ); + ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 2 ); + + free( *hSpatParamRendCom_out ); + *hSpatParamRendCom_out = NULL; + + return; +} + +void ivas_dirac_rend_close( + DIRAC_REND_HANDLE *hDirACRend_out ) +{ + int16_t i, j; + DIRAC_REND_HANDLE hDirACRend; + + if ( hDirACRend_out == NULL || *hDirACRend_out == NULL ) + { + return; + } + + hDirACRend = *hDirACRend_out; + + /* close Output synthesis sub-module */ + ivas_dirac_dec_output_synthesis_close( hDirACRend ); + + /* close Decorrelator sub-module */ + if ( hDirACRend->proto_signal_decorr_on ) + { + ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); + } + + /* Params */ + + /* free frequency axis buffer */ + if ( hDirACRend->frequency_axis != NULL ) + { + free( hDirACRend->frequency_axis ); + hDirACRend->frequency_axis = NULL; + } + + if ( hDirACRend->diffuse_response_function != NULL ) + { + free( hDirACRend->diffuse_response_function ); + hDirACRend->diffuse_response_function = NULL; + } + + if ( hDirACRend->hoa_encoder != NULL ) + { + free( hDirACRend->hoa_encoder ); + hDirACRend->hoa_encoder = NULL; + } + + /* prototype indexing */ + if ( hDirACRend->proto_index_dir != NULL ) + { + free( hDirACRend->proto_index_dir ); + hDirACRend->proto_index_dir = NULL; + } + + if ( hDirACRend->proto_index_diff != NULL ) + { + free( hDirACRend->proto_index_diff ); + hDirACRend->proto_index_dir = NULL; + } + + /* States */ + + /* free prototype signal buffers */ + if ( hDirACRend->proto_frame_f != NULL ) + { + free( hDirACRend->proto_frame_f ); + hDirACRend->proto_frame_f = NULL; + } + + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + if ( hDirACRend->buffer_intensity_real[i][j] != NULL ) + { + free( hDirACRend->buffer_intensity_real[i][j] ); + hDirACRend->buffer_intensity_real[i][j] = NULL; + } + } + } + if ( hDirACRend->buffer_energy != NULL ) + { + free( hDirACRend->buffer_energy ); + hDirACRend->buffer_energy = NULL; + } + + if ( hDirACRend->masa_stereo_type_detect != NULL ) + { + free( hDirACRend->masa_stereo_type_detect ); + hDirACRend->masa_stereo_type_detect = NULL; + } + + ivas_dirac_free_mem( &( hDirACRend->stack_mem ) ); + + free( *hDirACRend_out ); + *hDirACRend_out = NULL; + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_deallocate_parameters() + * + * Deallocate DirAC parameters + *-------------------------------------------------------------------------*/ + +void ivas_dirac_deallocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +) +{ + int16_t i; + int16_t md_buffer_length; + + if ( hSpatParamRendCom == NULL ) + { + return; + } + + md_buffer_length = hSpatParamRendCom->dirac_md_buffer_length; + + if ( params_flag == 1 ) + { + if ( hSpatParamRendCom->azimuth != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->azimuth[i] != NULL ) + { + free( hSpatParamRendCom->azimuth[i] ); + hSpatParamRendCom->azimuth[i] = NULL; + } + } + + free( hSpatParamRendCom->azimuth ); + hSpatParamRendCom->azimuth = NULL; + } + + if ( hSpatParamRendCom->elevation != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->elevation[i] != NULL ) + { + free( hSpatParamRendCom->elevation[i] ); + hSpatParamRendCom->elevation[i] = NULL; + } + } + + free( hSpatParamRendCom->elevation ); + hSpatParamRendCom->elevation = NULL; + } + + if ( hSpatParamRendCom->energy_ratio1 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->energy_ratio1[i] != NULL ) + { + free( hSpatParamRendCom->energy_ratio1[i] ); + hSpatParamRendCom->energy_ratio1[i] = NULL; + } + } + free( hSpatParamRendCom->energy_ratio1 ); + hSpatParamRendCom->energy_ratio1 = NULL; + } + + if ( hSpatParamRendCom->diffuseness_vector != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->diffuseness_vector[i] != NULL ) + { + free( hSpatParamRendCom->diffuseness_vector[i] ); + hSpatParamRendCom->diffuseness_vector[i] = NULL; + } + } + + free( hSpatParamRendCom->diffuseness_vector ); + hSpatParamRendCom->diffuseness_vector = NULL; + } + + if ( hSpatParamRendCom->spreadCoherence != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->spreadCoherence[i] != NULL ) + { + free( hSpatParamRendCom->spreadCoherence[i] ); + hSpatParamRendCom->spreadCoherence[i] = NULL; + } + } + free( hSpatParamRendCom->spreadCoherence ); + hSpatParamRendCom->spreadCoherence = NULL; + } + + if ( hSpatParamRendCom->surroundingCoherence != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->surroundingCoherence[i] != NULL ) + { + free( hSpatParamRendCom->surroundingCoherence[i] ); + hSpatParamRendCom->surroundingCoherence[i] = NULL; + } + } + free( hSpatParamRendCom->surroundingCoherence ); + hSpatParamRendCom->surroundingCoherence = NULL; + } + } + else if ( params_flag == 2 ) + { + if ( hSpatParamRendCom->azimuth2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->azimuth2[i] != NULL ) + { + free( hSpatParamRendCom->azimuth2[i] ); + hSpatParamRendCom->azimuth2[i] = NULL; + } + } + free( hSpatParamRendCom->azimuth2 ); + hSpatParamRendCom->azimuth2 = NULL; + } + + if ( hSpatParamRendCom->elevation2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->elevation2[i] != NULL ) + { + free( hSpatParamRendCom->elevation2[i] ); + hSpatParamRendCom->elevation2[i] = NULL; + } + } + free( hSpatParamRendCom->elevation2 ); + hSpatParamRendCom->elevation2 = NULL; + } + + if ( hSpatParamRendCom->energy_ratio2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->energy_ratio2[i] != NULL ) + { + free( hSpatParamRendCom->energy_ratio2[i] ); + hSpatParamRendCom->energy_ratio2[i] = NULL; + } + } + free( hSpatParamRendCom->energy_ratio2 ); + hSpatParamRendCom->energy_ratio2 = NULL; + } + + if ( hSpatParamRendCom->spreadCoherence2 != NULL ) + { + for ( i = 0; i < md_buffer_length; i++ ) + { + if ( hSpatParamRendCom->spreadCoherence2[i] != NULL ) + { + free( hSpatParamRendCom->spreadCoherence2[i] ); + hSpatParamRendCom->spreadCoherence2[i] = NULL; + } + } + free( hSpatParamRendCom->spreadCoherence2 ); + hSpatParamRendCom->spreadCoherence2 = NULL; + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_alloc_mem() + * + * Allocate stack memory for DirAC renderer + *------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_alloc_mem( + DIRAC_REND_HANDLE hDirACRend, + const RENDERER_TYPE renderer_type, + const int16_t num_freq_bands, + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, + const int16_t hodirac_flag ) +{ + int16_t num_freq_bands_diff, size; + int16_t size_ho; + int16_t size_pf; + int16_t num_outputs_dir, num_outputs_diff; + int16_t num_protos_dir; + + num_protos_dir = hDirACRend->num_protos_dir; + + num_freq_bands_diff = hDirACRend->h_output_synthesis_psd_params.max_band_decorr; + + num_outputs_dir = hDirACRend->num_outputs_dir; + num_outputs_diff = hDirACRend->num_outputs_diff; + + size = num_freq_bands * num_outputs_dir; + if ( hodirac_flag ) + { + size_ho = size * DIRAC_HO_NUMSECTORS; + size_pf = num_freq_bands * DIRAC_HO_NUMSECTORS; + } + else + { + size_ho = size; + size_pf = num_freq_bands; + } + + /* PSD related buffers */ + hDirAC_mem->cy_auto_dir_smooth = NULL; + hDirAC_mem->proto_power_smooth = NULL; + hDirAC_mem->proto_power_diff_smooth = NULL; + hDirAC_mem->direct_responses_square = NULL; + hDirAC_mem->frame_dec_f = NULL; + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); + + if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->proto_power_smooth, size ); + + if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->proto_power_diff_smooth, size ); + + if ( ( hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->direct_responses_square, size ); + if ( hDirACRend->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) + { + if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; + hDirACRend->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; + + /* Target and smoothed nrg factors/gains */ + if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); + + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_auto_diff_smooth, size ); + } + else + { + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); + } + hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; + hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; + + /*Responses (gains/factors)*/ + if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->direct_responses, size ); + + + hDirACRend->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; + + /* Prototypes */ + hDirAC_mem->proto_direct_buffer_f = NULL; + hDirAC_mem->proto_diffuse_buffer_f = NULL; + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + { + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + else + { + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + } + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; + + /* Gains/power factors*/ + hDirAC_mem->direct_power_factor = NULL; + hDirAC_mem->diffuse_power_factor = NULL; + + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + + hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; + + hDirAC_mem->reference_power = NULL; + hDirAC_mem->onset_filter = NULL; + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + } + else + { + if ( num_protos_dir > 2 ) + { + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + } + } + + return IVAS_ERR_OK; +} + + +void ivas_dirac_free_mem( + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) +{ + if ( hDirAC_mem->cy_auto_dir_smooth != NULL ) + { + free( hDirAC_mem->cy_auto_dir_smooth ); + } + if ( hDirAC_mem->proto_power_smooth != NULL ) + { + free( hDirAC_mem->proto_power_smooth ); + } + if ( hDirAC_mem->proto_power_diff_smooth != NULL ) + { + free( hDirAC_mem->proto_power_diff_smooth ); + } + if ( hDirAC_mem->direct_responses_square != NULL ) + { + free( hDirAC_mem->direct_responses_square ); + } + if ( hDirAC_mem->frame_dec_f != NULL ) + { + free( hDirAC_mem->frame_dec_f ); + } + if ( hDirAC_mem->cy_cross_dir_smooth != NULL ) + { + free( hDirAC_mem->cy_cross_dir_smooth ); + } + if ( hDirAC_mem->cy_auto_diff_smooth != NULL ) + { + free( hDirAC_mem->cy_auto_diff_smooth ); + } + if ( hDirAC_mem->direct_responses != NULL ) + { + free( hDirAC_mem->direct_responses ); + } + if ( hDirAC_mem->proto_direct_buffer_f != NULL ) + { + free( hDirAC_mem->proto_direct_buffer_f ); + } + if ( hDirAC_mem->proto_diffuse_buffer_f != NULL ) + { + free( hDirAC_mem->proto_diffuse_buffer_f ); + } + if ( hDirAC_mem->direct_power_factor != NULL ) + { + free( hDirAC_mem->direct_power_factor ); + } + if ( hDirAC_mem->diffuse_power_factor != NULL ) + { + free( hDirAC_mem->diffuse_power_factor ); + } + if ( hDirAC_mem->reference_power != NULL ) + { + free( hDirAC_mem->reference_power ); + } + if ( hDirAC_mem->onset_filter != NULL ) + { + free( hDirAC_mem->onset_filter ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * compute_hoa_encoder_mtx() + * + * + *------------------------------------------------------------------------*/ + +void compute_hoa_encoder_mtx( + const float *azimuth, + const float *elevation, + float *response, + const int16_t num_responses, + const int16_t ambisonics_order ) +{ + int16_t k, num_sh; + + num_sh = ivas_sba_get_nchan( ambisonics_order, 0 ); + + for ( k = 0; k < num_responses; k++ ) + { + ivas_dirac_dec_get_response( (const int16_t) azimuth[k], (const int16_t) elevation[k], &response[k * num_sh], ambisonics_order ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_get_frequency_axis() + * + * DirAC decoding initialization + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_get_frequency_axis( + float *frequency_axis, + const int32_t output_Fs, + const int16_t num_freq_bands ) +{ + int16_t k; + float const_part; + + /* calc cldfb frequency axis */ + const_part = (float) output_Fs / ( 2.0f * (float) num_freq_bands ); + for ( k = 0; k < num_freq_bands; ++k ) + { + frequency_axis[k] = ( (float) k + 0.5f ) * const_part; + } + + return; +} + + +/*------------------------------------------------------------------------- + * Local functions + *-------------------------------------------------------------------------*/ + +void initDiffuseResponses( + float *diffuse_response_function, + const int16_t num_channels, + AUDIO_CONFIG output_config, + IVAS_OUTPUT_SETUP hOutSetup, + const int16_t ambisonics_order, + const IVAS_FORMAT ivas_format, + int16_t *num_ele_spk_no_diffuse_rendering, + AUDIO_CONFIG transport_config ) +{ + int16_t i, l, k, idx, num_horizontal_speakers; + *num_ele_spk_no_diffuse_rendering = 0; + + if ( output_config == AUDIO_CONFIG_MONO ) + { + diffuse_response_function[0] = 1.0f; + diffuse_response_function[1] = inv_sqrt( 3.0f ); + } + else if ( !( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) ) + { + /* set diffuse response function */ + if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_5_1_4 ) + { + num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; + + mvr2r( diffuse_response_CICP6, diffuse_response_function, num_horizontal_speakers ); + set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); + *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; + } + else if ( ivas_format == MC_FORMAT && ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) && output_config == AUDIO_CONFIG_7_1_4 ) + { + num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; + + set_f( diffuse_response_function, sqrtf( 1.f / ( (float) num_horizontal_speakers ) ), num_horizontal_speakers ); + set_zero( &diffuse_response_function[num_horizontal_speakers], NUM_ELEVATED_SPEAKERS ); + *num_ele_spk_no_diffuse_rendering = NUM_ELEVATED_SPEAKERS; + } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) +#else + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1 && num_channels == 5 ) +#endif + { + mvr2r( diffuse_response_CICP6, diffuse_response_function, num_channels ); + } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) +#else + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && output_config == AUDIO_CONFIG_5_1_2 && num_channels == 7 ) +#endif + { + mvr2r( diffuse_response_CICP14, diffuse_response_function, num_channels ); + } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) +#else + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_5_1_4 ) && ( num_channels == 9 ) ) +#endif + { + mvr2r( diffuse_response_CICP16, diffuse_response_function, num_channels ); + } +#ifdef MASA_AND_OBJECTS + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) +#else + else if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ( output_config == AUDIO_CONFIG_LS_CUSTOM ) ) +#endif + { + if ( transport_config == AUDIO_CONFIG_5_1 || transport_config == AUDIO_CONFIG_7_1 ) + { + /* Detect loudspeakers with elevation */ + for ( i = 0, num_horizontal_speakers = 0; i < num_channels; i++ ) + { + if ( fabsf( hOutSetup.ls_elevation[i] ) <= 5.f ) + { + num_horizontal_speakers++; + diffuse_response_function[i] = 1.f; + } + else + { + *num_ele_spk_no_diffuse_rendering += 1; + diffuse_response_function[i] = 0.f; + } + } + /* Diffuse only to horizontal plane if enough loudspeakers */ + if ( num_horizontal_speakers > 2 ) + { + for ( i = 0; i < num_channels; i++ ) + { + diffuse_response_function[i] *= sqrtf( 1.f / (float) num_horizontal_speakers ); + } + } + else + { + *num_ele_spk_no_diffuse_rendering = 0; + set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); + } + } + else + { + set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); + } + } + else + { + set_f( diffuse_response_function, sqrtf( 1.f / (float) num_channels ), num_channels ); + } + } + else + { + idx = 0; + for ( l = 0; l <= ambisonics_order; l++ ) + { + for ( k = 0; k < ( 2 * l + 1 ); k++ ) + { + diffuse_response_function[idx++] = inv_sqrt( 2.0f * l + 1.0f ); + } + } + } + + return; +} + + +void protoSignalComputation_shd( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_direct_buffer_f, + float *proto_diffuse_buffer_f, + float *reference_power, + const int16_t slot_index, + const int16_t num_inputs, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + float *p_Rmat ) +{ + int16_t l, k; + float *p_proto_direct_buffer; + float *p_proto_diffuse_buffer; + int16_t Rmat_k[4]; + float W_real, W_imag; + float Y_real, Y_imag; + float *p_k[4]; + + k = 0; /* to avoid compilation warning */ + + p_proto_direct_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_inputs; + p_proto_diffuse_buffer = proto_diffuse_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; + + if ( num_inputs == 1 ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_direct_buffer[2 * l] = RealBuffer[0][0][l]; + p_proto_direct_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + } + } + else if ( num_inputs == 2 ) + { + if ( p_Rmat != 0 ) + { + assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); + + for ( l = 0; l < num_freq_bands; l++ ) + { + W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + Y_real = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + Y_imag = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + + p_proto_direct_buffer[2 * l] = W_real; + p_proto_direct_buffer[2 * l + 1] = W_imag; + p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = p_Rmat[0] * Y_real; + p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = p_Rmat[0] * Y_imag; + } + } + else + { + for ( l = 0; l < num_freq_bands; l++ ) + { + W_real = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + W_imag = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + p_proto_direct_buffer[2 * l] = W_real; + p_proto_direct_buffer[2 * l + 1] = W_imag; + { + p_proto_direct_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + p_proto_direct_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + } + } + } + } + else if ( num_inputs >= 4 ) + { + p_k[0] = p_proto_direct_buffer; + p_k[1] = p_proto_direct_buffer + 2 * num_freq_bands; + p_k[2] = p_proto_direct_buffer + 4 * num_freq_bands; + p_k[3] = p_proto_direct_buffer + 6 * num_freq_bands; + Rmat_k[0] = 0; + Rmat_k[1] = 1; + Rmat_k[2] = 2; + Rmat_k[3] = 0; + + if ( p_Rmat != 0 ) + { + assert( num_inputs == 4 && "This code block should never be run with num_inputs != 4!" ); + + for ( l = 0; l < num_freq_bands; l++ ) + { + *( p_k[0] ) = RealBuffer[0][0][l]; + reference_power[l + num_freq_bands] = *( p_k[0] ) * *( p_k[0] ); + p_k[0]++; + *( p_k[0] ) = ImagBuffer[0][0][l]; + reference_power[l + num_freq_bands] += *( p_k[0] ) * *( p_k[0] ); + p_k[0]++; + reference_power[l] = 0.5f * reference_power[l + num_freq_bands]; + + for ( k = 1; k < 4; k++ ) + { + *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * RealBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * RealBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * RealBuffer[3][0][l]; + reference_power[l + ( k + 1 ) * num_freq_bands] = *( p_k[k] ) * *( p_k[k] ); + p_k[k]++; + *( p_k[k] ) = p_Rmat[3 * Rmat_k[k] + 1] * ImagBuffer[1][0][l] + p_Rmat[3 * Rmat_k[k] + 2] * ImagBuffer[2][0][l] + p_Rmat[3 * Rmat_k[k] + 0] * ImagBuffer[3][0][l]; + reference_power[l + ( k + 1 ) * num_freq_bands] += *( p_k[k] ) * *( p_k[k] ); + p_k[k]++; + reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); + } + + for ( k = 1; k < 4; k++ ) + { + RealBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l]; + ImagBuffer[k][0][l] = p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1]; + } + } + } + else + { + set_zero( reference_power, num_freq_bands ); + for ( k = 0; k < 4; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; + reference_power[l + ( k + 1 ) * num_freq_bands] = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; + reference_power[l] += 0.5f * ( reference_power[l + ( k + 1 ) * num_freq_bands] ); + } + } + } + + /* Additional transport channels = planar SBA components of degree higher than 1*/ + for ( ; k < num_inputs; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l] = RealBuffer[k][0][l]; + p_proto_direct_buffer[k * 2 * num_freq_bands + 2 * l + 1] = ImagBuffer[k][0][l]; + } + } + } + + + /*Copy direct to diffuse proto*/ + mvr2r( p_proto_direct_buffer, p_proto_diffuse_buffer, 2 * num_freq_bands * min( num_outputs_diff, num_inputs ) ); + + if ( num_inputs == 1 ) + { + /* Add comfort noise addition (CNA) to diffuse proto only*/ + for ( l = 0; l < num_freq_bands; l++ ) + { + p_proto_diffuse_buffer[2 * l] += RealBuffer[1][0][l]; + p_proto_diffuse_buffer[2 * l + 1] += ImagBuffer[1][0][l]; + } + } + + return; +} + + +void protoSignalComputation1( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands ) +{ + int16_t l, k; + float *p_proto_buffer; + + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands; + + for ( l = 0; l < num_freq_bands; l++ ) + { + reference_power[l] = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + proto_power_smooth[l] += reference_power[l]; + p_proto_buffer[2 * l] = RealBuffer[0][0][l]; + p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + + for ( k = 0; k < num_outputs_diff; k++ ) + { + proto_frame_f[2 * k * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * k * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + } + } + + return; +} + + +void protoSignalComputation2( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t isloudspeaker, + const int16_t slot_index, + const int16_t num_freq_bands, + MASA_STEREO_TYPE_DETECT *stereo_type_detect ) +{ + int16_t l; + float *p_proto_buffer; + float Real_aux, Imag_aux; + + float left_bb_power, right_bb_power, total_bb_power, lr_bb_power; + float lr_total_bb_ratio; + float a, b; + + float left_hi_power, right_hi_power, total_hi_power, lr_hi_power; + float lr_total_hi_ratio; + float a2, b2; + + float sum_power; + float sum_total_ratio[MASA_SUM_FREQ_RANGE_BINS]; + float min_sum_total_ratio; + float min_sum_total_ratio_db; + + float RealSubtract, ImagSubtract; + + float interpolatorSpaced = 0.0f; + float interpolatorDmx = 1.0f; + + int16_t dipole_freq_range[2]; + float tempSpaced, tempDmx; + + if ( isloudspeaker ) + { + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 3; + + for ( l = 0; l < num_freq_bands; l++ ) + { + float Left_power; + float Right_power; + Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; + + reference_power[l] = Left_power + Right_power; + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + proto_power_smooth[l + num_freq_bands] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + + proto_power_smooth[l + 2 * num_freq_bands] += RealBuffer[1][0][l] * RealBuffer[1][0][l]; + proto_power_smooth[l + 2 * num_freq_bands] += ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; + p_proto_buffer[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + p_proto_buffer[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + + proto_frame_f[2 * l] = Real_aux; + proto_frame_f[2 * l + 1] = Imag_aux; + + proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + } + } + else if ( stereo_type_detect != NULL ) + { + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; + + left_bb_power = 0.0f; + right_bb_power = 0.0f; + total_bb_power = 0.0f; + + left_hi_power = 0.0f; + right_hi_power = 0.0f; + total_hi_power = 0.0f; + + dipole_freq_range[0] = stereo_type_detect->dipole_freq_range[0]; + dipole_freq_range[1] = stereo_type_detect->dipole_freq_range[1]; + + a = 0.01f; /* Temporal smoothing coefficient */ + b = 1.0f - a; /* Temporal smoothing coefficient */ + a2 = 0.1f; /* Temporal smoothing coefficient */ + b2 = 1.0f - a2; /* Temporal smoothing coefficient */ + + if ( stereo_type_detect->interpolator > 0 ) + { + if ( stereo_type_detect->type_change_direction == MASA_STEREO_SPACED_MICS ) + { + interpolatorSpaced = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); + interpolatorDmx = 1.0f - interpolatorSpaced; + } + else + { + interpolatorDmx = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); + interpolatorSpaced = 1.0f - interpolatorDmx; + } + } + + for ( l = 0; l < num_freq_bands; l++ ) + { + float Left_power; + float Right_power; + + /* Compute sum signal */ + Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + /* Compute reference power */ + Left_power = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + Right_power = RealBuffer[1][0][l] * RealBuffer[1][0][l] + ImagBuffer[1][0][l] * ImagBuffer[1][0][l]; + + reference_power[l] = Left_power + Right_power; + + left_bb_power += Left_power; + right_bb_power += Right_power; + total_bb_power += reference_power[l]; + + if ( l > MASA_HI_FREQ_START_BIN ) + { + left_hi_power += Left_power; + right_hi_power += Right_power; + total_hi_power += reference_power[l]; + } + + if ( l < min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ) ) + { + sum_power = Real_aux * Real_aux + Imag_aux * Imag_aux; + + stereo_type_detect->sum_power[l] = a * sum_power + b * stereo_type_detect->sum_power[l]; + stereo_type_detect->total_power[l] = a * reference_power[l] + b * stereo_type_detect->total_power[l]; + + sum_total_ratio[l] = stereo_type_detect->sum_power[l] / ( stereo_type_detect->total_power[l] + EPSILON ); + } + + if ( l == 0 ) + { + RealSubtract = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + ImagSubtract = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + stereo_type_detect->subtract_power_y += RealSubtract * RealSubtract + ImagSubtract * ImagSubtract; + } + + /* Compute protos (and their power) for direct sound rendering */ + + /* W prototype */ + if ( stereo_type_detect->interpolator > 0 ) + { + if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) + { + Real_aux = interpolatorSpaced * 0.5f * Real_aux + interpolatorDmx * Real_aux; + Imag_aux = interpolatorSpaced * 0.5f * Imag_aux + interpolatorDmx * Imag_aux; + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + } + else + { + tempSpaced = RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + tempDmx = Real_aux * Real_aux + Imag_aux * Imag_aux; + proto_power_smooth[l] += interpolatorSpaced * tempSpaced + interpolatorDmx * tempDmx; + p_proto_buffer[2 * l] = interpolatorSpaced * RealBuffer[0][0][l] + interpolatorDmx * Real_aux; + p_proto_buffer[2 * l + 1] = interpolatorSpaced * ImagBuffer[0][0][l] + interpolatorDmx * Imag_aux; + } + } + else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + { + if ( l < ( dipole_freq_range[1] - 1 ) || l >= MASA_SUM_PROTO_START_BIN ) + { + Real_aux *= 0.5f; + Imag_aux *= 0.5f; + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + } + else + { + proto_power_smooth[l] += RealBuffer[0][0][l] * RealBuffer[0][0][l] + ImagBuffer[0][0][l] * ImagBuffer[0][0][l]; + p_proto_buffer[2 * l] = RealBuffer[0][0][l]; + p_proto_buffer[2 * l + 1] = ImagBuffer[0][0][l]; + } + } + else + { + proto_power_smooth[l] += Real_aux * Real_aux + Imag_aux * Imag_aux; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + } + + /* Y prototype */ + if ( stereo_type_detect->interpolator > 0 ) + { + if ( l < ( dipole_freq_range[0] ) ) + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + } + else if ( l < ( dipole_freq_range[1] ) ) + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ) + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * ( -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ) ) + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + } + else + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = interpolatorSpaced * p_proto_buffer[2 * l] + interpolatorDmx * ( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = interpolatorSpaced * p_proto_buffer[2 * l + 1] + interpolatorDmx * ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + } + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + } + else if ( stereo_type_detect->masa_stereo_type == MASA_STEREO_SPACED_MICS ) + { + if ( l < ( dipole_freq_range[0] ) ) /* proto = W */ + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; + proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; + } + else if ( l < ( dipole_freq_range[1] ) ) /* proto = -i * (x1-x2) * eq */ + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = ( ImagBuffer[0][0][l] - ImagBuffer[1][0][l] ); + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = -( RealBuffer[0][0][l] - RealBuffer[1][0][l] ); + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + } + else /* proto = W */ + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = p_proto_buffer[2 * l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = p_proto_buffer[2 * l + 1]; + proto_power_smooth[l + num_freq_bands] = proto_power_smooth[l]; + } + } + else + { + p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + } + + /* Compute protos for decorrelation */ + proto_frame_f[2 * l] = Real_aux; + proto_frame_f[2 * l + 1] = Imag_aux; + proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + } + + if ( stereo_type_detect->interpolator > 0 ) + { + stereo_type_detect->interpolator++; + if ( stereo_type_detect->interpolator == MASA_STEREO_INTERPOLATION_SLOTS ) + { + stereo_type_detect->interpolator = 0; + stereo_type_detect->current_stereo_type = stereo_type_detect->type_change_direction; + } + } + + stereo_type_detect->left_bb_power = a * left_bb_power + b * stereo_type_detect->left_bb_power; + stereo_type_detect->right_bb_power = a * right_bb_power + b * stereo_type_detect->right_bb_power; + stereo_type_detect->total_bb_power = a * total_bb_power + b * stereo_type_detect->total_bb_power; + + lr_bb_power = ( stereo_type_detect->left_bb_power < stereo_type_detect->right_bb_power ) ? stereo_type_detect->left_bb_power : stereo_type_detect->right_bb_power; + lr_bb_power *= 2.0f; + lr_total_bb_ratio = 10.0f * log10f( lr_bb_power / ( stereo_type_detect->total_bb_power + EPSILON ) ); + + stereo_type_detect->left_hi_power = a2 * left_hi_power + b2 * stereo_type_detect->left_hi_power; + stereo_type_detect->right_hi_power = a2 * right_hi_power + b2 * stereo_type_detect->right_hi_power; + stereo_type_detect->total_hi_power = a2 * total_hi_power + b2 * stereo_type_detect->total_hi_power; + + lr_hi_power = ( stereo_type_detect->left_hi_power < stereo_type_detect->right_hi_power ) ? stereo_type_detect->left_hi_power : stereo_type_detect->right_hi_power; + lr_hi_power *= 2.0f; + lr_total_hi_ratio = 10.0f * log10f( lr_hi_power / ( stereo_type_detect->total_hi_power + EPSILON ) ); + + minimum( sum_total_ratio, min( num_freq_bands, MASA_SUM_FREQ_RANGE_BINS ), &min_sum_total_ratio ); + min_sum_total_ratio_db = 10.0f * log10f( min_sum_total_ratio ); + + stereo_type_detect->lr_total_bb_ratio_db = lr_total_bb_ratio; + stereo_type_detect->lr_total_hi_ratio_db = lr_total_hi_ratio; + stereo_type_detect->min_sum_total_ratio_db = min_sum_total_ratio_db; + + ivas_masa_stereotype_detection( stereo_type_detect ); + } + else + { + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * 2; + + for ( l = 0; l < num_freq_bands; l++ ) + { + Real_aux = RealBuffer[0][0][l] + RealBuffer[1][0][l]; + Imag_aux = ImagBuffer[0][0][l] + ImagBuffer[1][0][l]; + + reference_power[l] = Real_aux * Real_aux + Imag_aux * Imag_aux; + proto_power_smooth[l] += reference_power[l]; + p_proto_buffer[2 * l] = Real_aux; + p_proto_buffer[2 * l + 1] = Imag_aux; + + p_proto_buffer[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l] - RealBuffer[1][0][l]; + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l] - ImagBuffer[1][0][l]; + proto_power_smooth[l + num_freq_bands] += p_proto_buffer[2 * num_freq_bands + 2 * l] * p_proto_buffer[2 * num_freq_bands + 2 * l] + p_proto_buffer[2 * num_freq_bands + 2 * l + 1] * p_proto_buffer[2 * num_freq_bands + 2 * l + 1]; + + proto_frame_f[2 * l] = Real_aux; + proto_frame_f[2 * l + 1] = Imag_aux; + + proto_frame_f[2 * num_freq_bands + 2 * l] = RealBuffer[0][0][l]; + proto_frame_f[2 * num_freq_bands + 2 * l + 1] = ImagBuffer[0][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l] = RealBuffer[1][0][l]; + proto_frame_f[4 * num_freq_bands + 2 * l + 1] = ImagBuffer[1][0][l]; + } + } + + return; +} + + +void protoSignalComputation4( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + const float *mtx_hoa_decoder, + const int16_t nchan_transport, + const int16_t *sba_map_tc_ind ) +{ + int16_t k, l; + int16_t n; + float sq_tmp; + float *p_proto_buffer; + + set_zero( reference_power, num_freq_bands ); + for ( k = 0; k < 4; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + sq_tmp = RealBuffer[k][0][l] * RealBuffer[k][0][l] + ImagBuffer[k][0][l] * ImagBuffer[k][0][l]; + reference_power[l] += 0.5f * sq_tmp; + } + } + + /*For decorrelated diffuseness*/ + for ( l = 0; l < num_outputs_diff; l++ ) + { + for ( k = 0; k < num_freq_bands; k++ ) + { + proto_frame_f[2 * l * num_freq_bands + 2 * k] = 0.f; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] = 0.f; + for ( n = 0; n < nchan_transport; n++ ) + { + proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + } + } + } + + p_proto_buffer = proto_direct_buffer_f + slot_index * 2 * num_freq_bands * num_outputs_diff; + for ( k = 0; k < num_outputs_diff; k++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + sq_tmp = proto_frame_f[k * 2 * num_freq_bands + 2 * l] * proto_frame_f[k * 2 * num_freq_bands + 2 * l] + proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1] * proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; + proto_power_smooth[l + k * num_freq_bands] += sq_tmp; + p_proto_buffer[k * 2 * num_freq_bands + 2 * l] = proto_frame_f[k * 2 * num_freq_bands + 2 * l]; + p_proto_buffer[k * 2 * num_freq_bands + 2 * l + 1] = proto_frame_f[k * 2 * num_freq_bands + 2 * l + 1]; + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_compute_diffuse_proto() + * + * Compute diffuse prototype buffer and smooth power, only for decorrelated bands + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_compute_diffuse_proto( + DIRAC_REND_HANDLE hDirACRend, + const int16_t num_freq_bands, + const int16_t slot_idx /* i : slot index */ +) +{ + int16_t k, l; + int16_t num_freq_bands_diff; + float *p_diff_buffer, *p_diff_buffer_1; + float *p_proto_diff, *p_power_smooth, *proto_frame_dec_f; + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + int16_t m; + float *p_hoa_enc; + + proto_frame_dec_f = hDirACRend->proto_frame_dec_f; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + + num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; + + p_diff_buffer = h_dirac_output_synthesis_state->proto_diffuse_buffer_f + slot_idx * 2 * num_freq_bands_diff * hDirACRend->hOutSetup.nchan_out_woLFE; + p_diff_buffer_1 = p_diff_buffer + 1; + p_power_smooth = h_dirac_output_synthesis_state->proto_power_diff_smooth; + + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD ) + { + for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) + { + p_proto_diff = proto_frame_dec_f + k * 2 * num_freq_bands; + for ( l = 0; l < num_freq_bands_diff; l++ ) + { + *p_diff_buffer = *( p_proto_diff++ ); + *p_diff_buffer_1 = *( p_proto_diff++ ); + *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); + p_diff_buffer += 2; + p_diff_buffer_1 += 2; + } + } + } + else + { + /*DIRAC_SYNTHESIS_PSD_SHD: Virtual LS->HOA encoding*/ + for ( k = 0; k < hDirACRend->hOutSetup.nchan_out_woLFE; k++ ) + { + for ( l = 0; l < num_freq_bands_diff; l++ ) + { + p_hoa_enc = hDirACRend->hoa_encoder + k; + p_proto_diff = proto_frame_dec_f + 2 * l; + + *p_diff_buffer = 0.f; + *p_diff_buffer_1 = 0.f; + + /*LS to HOA*/ + for ( m = 0; m < hDirACRend->num_outputs_diff; m++ ) + { + *p_diff_buffer += ( *p_hoa_enc ) * ( *p_proto_diff ); + *p_diff_buffer_1 += ( *p_hoa_enc ) * ( *( p_proto_diff + 1 ) ); + p_hoa_enc += hDirACRend->hOutSetup.nchan_out_woLFE; + p_proto_diff += 2 * num_freq_bands; + } + + *( p_power_smooth++ ) += ( *p_diff_buffer ) * ( *p_diff_buffer ) + ( *p_diff_buffer_1 ) * ( *p_diff_buffer_1 ); + p_diff_buffer += 2; + p_diff_buffer_1 += 2; + } + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * computeDirectionAngles() + * + *------------------------------------------------------------------------*/ + +void computeDirectionAngles( + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z, + const int16_t num_frequency_bands, + int16_t *azimuth, + int16_t *elevation ) +{ + int16_t k; + float intensityNorm; + float x, y, z, radius; + + for ( k = 0; k < num_frequency_bands; ++k ) + + { + intensityNorm = *( intensity_real_x ) * *( intensity_real_x ) + + *( intensity_real_y ) * *( intensity_real_y ) + + *( intensity_real_z ) * *( intensity_real_z ); + + if ( intensityNorm <= EPSILON ) + { + intensityNorm = 1.0f; + x = 1.0f; + y = 0.0f; + z = 0.0f; + intensity_real_x++; + intensity_real_y++; + intensity_real_z++; + } + else + { + intensityNorm = sqrtf( 1.f / intensityNorm ); + x = *( intensity_real_x++ ) * intensityNorm; + y = *( intensity_real_y++ ) * intensityNorm; + z = *( intensity_real_z++ ) * intensityNorm; + } + radius = sqrtf( x * x + y * y ); + azimuth[k] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); + elevation[k] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_masa_init_stereotype_detection() + * + * Initialize stereo transport signal type detection + *------------------------------------------------------------------------*/ + +void ivas_masa_init_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect ) +{ + stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; + stereo_type_detect->current_stereo_type = MASA_STEREO_DOWNMIX; + stereo_type_detect->type_change_direction = MASA_STEREO_DOWNMIX; + + stereo_type_detect->counter = 0; + stereo_type_detect->interpolator = 0; + + stereo_type_detect->dipole_freq_range[0] = 1; + stereo_type_detect->dipole_freq_range[1] = 3; + + stereo_type_detect->left_bb_power = 0.0f; /* Broadband estimates */ + stereo_type_detect->right_bb_power = 0.0f; + stereo_type_detect->total_bb_power = 0.0f; + + stereo_type_detect->left_hi_power = 0.0f; /* High-frequency estimates */ + stereo_type_detect->right_hi_power = 0.0f; + stereo_type_detect->total_hi_power = 0.0f; + + set_zero( stereo_type_detect->sum_power, MASA_SUM_FREQ_RANGE_BINS ); + set_zero( stereo_type_detect->total_power, MASA_SUM_FREQ_RANGE_BINS ); + + stereo_type_detect->subtract_power_y = 0.0f; + stereo_type_detect->subtract_power_y_smooth = 0.0f; + stereo_type_detect->target_power_y_smooth = 0.0f; + + stereo_type_detect->lr_total_bb_ratio_db = 0.0f; + stereo_type_detect->lr_total_hi_ratio_db = 0.0f; + stereo_type_detect->min_sum_total_ratio_db = 0.0f; + stereo_type_detect->subtract_target_ratio_db = 0.0f; + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_masa_stereotype_detection() + * + * Detect the type of the transport audio signals + *------------------------------------------------------------------------*/ + +void ivas_masa_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect ) +{ + float lr_total_bb_ratio_db = stereo_type_detect->lr_total_bb_ratio_db; + float lr_total_hi_ratio_db = stereo_type_detect->lr_total_hi_ratio_db; + float min_sum_total_ratio_db = stereo_type_detect->min_sum_total_ratio_db; + float subtract_target_ratio_db = stereo_type_detect->subtract_target_ratio_db; + float change_to_spaced; + int16_t change_to_spaced_selection; + float change_to_downmix; + float change_to_downmix2; + int16_t change_to_downmix_selection; + float subtract_temp; + float min_sum_temp; + float lr_total_bb_temp; + float lr_total_hi_temp; + + /* Determine if the determined features match the spaced mic type */ + change_to_spaced_selection = 0; + if ( subtract_target_ratio_db < -3.0f ) + { + subtract_temp = ( -subtract_target_ratio_db - 3.0f ) / 3.0f; + min_sum_temp = max( -min_sum_total_ratio_db / 6.0f, 0.0f ); + lr_total_bb_temp = lr_total_bb_ratio_db / 6.0f; + + change_to_spaced = subtract_temp + min_sum_temp + lr_total_bb_temp; + + if ( change_to_spaced >= 1.0f ) + { + change_to_spaced_selection = 1; + } + } + + /* Determine if the determined features match the downmix type, according to a metric */ + change_to_downmix_selection = 0; + if ( subtract_target_ratio_db > 0.0f ) + { + subtract_temp = subtract_target_ratio_db / 3.0f; + min_sum_temp = ( min_sum_total_ratio_db + 1.0f ) / 6.0f; + lr_total_bb_temp = -lr_total_bb_ratio_db / 6.0f; + + change_to_downmix = subtract_temp + min_sum_temp + lr_total_bb_temp; + + if ( change_to_downmix >= 1.0f ) + { + change_to_downmix_selection = 1; + } + } + + /* Determine if the determined features match the downmix type, according to another metric */ + if ( lr_total_hi_ratio_db < -12.0f ) + { + subtract_temp = ( subtract_target_ratio_db + 4.0f ) / 3.0f; + min_sum_temp = min_sum_total_ratio_db / 6.0f; + lr_total_hi_temp = ( -lr_total_hi_ratio_db - 12.0f ) / 3.0f; + + change_to_downmix2 = subtract_temp + min_sum_temp + lr_total_hi_temp; + + if ( change_to_downmix2 >= 1.0f ) + { + change_to_downmix_selection = 1; + } + } + + if ( stereo_type_detect->counter < 400 ) + { + stereo_type_detect->counter++; + } + else + { + if ( change_to_spaced_selection == 1 ) + { + stereo_type_detect->masa_stereo_type = MASA_STEREO_SPACED_MICS; + } + else if ( change_to_downmix_selection == 1 ) + { + stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; + } + } + + if ( stereo_type_detect->interpolator == 0 ) + { + if ( stereo_type_detect->current_stereo_type != stereo_type_detect->masa_stereo_type ) + { + stereo_type_detect->interpolator = 1; + stereo_type_detect->type_change_direction = stereo_type_detect->masa_stereo_type; + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * computeIntensityVector_dec() + * + * + *------------------------------------------------------------------------*/ + +void computeIntensityVector_dec( + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t num_frequency_bands, + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z ) +{ + /* + * W = a + ib; Y = c + id + * real(W*Y') = ac + bd + */ + int16_t i; + float real, img; + + for ( i = 0; i < num_frequency_bands; ++i ) + { + real = Cldfb_RealBuffer[0][0][i]; + img = Cldfb_ImagBuffer[0][0][i]; + intensity_real_x[i] = Cldfb_RealBuffer[3][0][i] * real + Cldfb_ImagBuffer[3][0][i] * img; + intensity_real_y[i] = Cldfb_RealBuffer[1][0][i] * real + Cldfb_ImagBuffer[1][0][i] * img; + intensity_real_z[i] = Cldfb_RealBuffer[2][0][i] * real + Cldfb_ImagBuffer[2][0][i] * img; + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_lfe_synth_with_cldfb() + * + * + *------------------------------------------------------------------------*/ + +void ivas_lfe_synth_with_cldfb( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t slot_index, + const int16_t subframe_index, + const int16_t nchan_transport ) +{ + float lfeGain; + float transportGain; + float protoLfeReal, protoLfeImag; + int16_t i; + float transportEne, protoLfeEne, targetEneLfe, targetEneTrans; + + set_zero( RealBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); + set_zero( ImagBufferLfe[slot_index], CLDFB_NO_CHANNELS_MAX ); + + protoLfeReal = RealBuffer[0][0][0]; + protoLfeImag = ImagBuffer[0][0][0]; + transportEne = RealBuffer[0][0][0] * RealBuffer[0][0][0] + ImagBuffer[0][0][0] * ImagBuffer[0][0][0]; + for ( i = 1; i < nchan_transport; i++ ) + { + protoLfeReal += RealBuffer[i][0][0]; + protoLfeImag += ImagBuffer[i][0][0]; + transportEne += RealBuffer[i][0][0] * RealBuffer[i][0][0] + ImagBuffer[i][0][0] * ImagBuffer[i][0][0]; + } + protoLfeEne = protoLfeReal * protoLfeReal + protoLfeImag * protoLfeImag; + + targetEneLfe = transportEne * hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index]; + targetEneTrans = transportEne * max( ( 1.0f - hMasaLfeSynth->lfeToTotalEnergyRatio[subframe_index] ), 0.01f ); + + hMasaLfeSynth->transportEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; + hMasaLfeSynth->protoLfeEneSmooth *= MCMASA_LFE_SYNTH_ALPHA; + hMasaLfeSynth->targetEneLfeSmooth *= MCMASA_LFE_SYNTH_ALPHA; + hMasaLfeSynth->targetEneTransSmooth *= MCMASA_LFE_SYNTH_ALPHA; + + hMasaLfeSynth->transportEneSmooth += transportEne; + hMasaLfeSynth->protoLfeEneSmooth += protoLfeEne; + hMasaLfeSynth->targetEneLfeSmooth += targetEneLfe; + hMasaLfeSynth->targetEneTransSmooth += targetEneTrans; + + lfeGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneLfeSmooth / ( EPSILON + hMasaLfeSynth->protoLfeEneSmooth ) ) ); + transportGain = min( 1.0f, sqrtf( hMasaLfeSynth->targetEneTransSmooth / ( EPSILON + hMasaLfeSynth->transportEneSmooth ) ) ); + + RealBufferLfe[slot_index][0] = protoLfeReal * lfeGain; + ImagBufferLfe[slot_index][0] = protoLfeImag * lfeGain; + + RealBuffer[0][0][0] *= transportGain; + ImagBuffer[0][0][0] *= transportGain; + for ( i = 1; i < nchan_transport; i++ ) + { + RealBuffer[i][0][0] *= transportGain; + ImagBuffer[i][0][0] *= transportGain; + } + + return; +} + + +/*------------------------------------------------------------------------- + * rotateAziEle_DirAC() + * + * Apply rotation to DirAC DOAs + *------------------------------------------------------------------------*/ + +void rotateAziEle_DirAC( + int16_t *azi, /* i/o: array of azimuth values */ + int16_t *ele, /* i/o: array of elevation values */ + const int16_t band1, /* i : bands to work on (lower limit) */ + const int16_t band2, /* i : bands to work on (upper bound) */ + const float *p_Rmat /* i : pointer to real-space rotation matrix */ +) +{ + int16_t b; + float dv_0, dv_1, dv_2; + float dv_r_0, dv_r_1, dv_r_2; + float w; + + push_wmops( "rotateAziEle_DirAC" ); + + for ( b = band1; b < band2; b++ ) + { + + /*Conversion spherical to cartesian coordinates*/ + w = cosf( ele[b] * PI_OVER_180 ); + dv_0 = w * cosf( azi[b] * PI_OVER_180 ); + dv_1 = w * sinf( azi[b] * PI_OVER_180 ); + dv_2 = sinf( ele[b] * PI_OVER_180 ); + + dv_r_0 = p_Rmat[0] * dv_0 + p_Rmat[1] * dv_1 + p_Rmat[2] * dv_2; + dv_r_1 = p_Rmat[3] * dv_0 + p_Rmat[4] * dv_1 + p_Rmat[5] * dv_2; + dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; + + /*Conversion spherical to cartesian coordinates*/ + azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); + ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); + } + + pop_wmops(); + + return; +} diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index e64fdce77a..13daf58297 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -37,6 +37,7 @@ #include "options.h" #include "ivas_error.h" #include "lib_rend.h" +#include "ivas_stat_rend.h" #include "ivas_stat_dec.h" // Note: needed until #156 is resolved /* clang-format off */ @@ -133,7 +134,7 @@ void efap_determine_gains( /*----------------------------------------------------------------------------------* - * SBA rendering + * DirAC/MASA rendering *----------------------------------------------------------------------------------*/ void ivas_sba_prototype_renderer( @@ -151,7 +152,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( #ifdef FIX_564 -void ivas_dirac_dec_binaural_gain( +void ivas_dirac_dec_binaural_sba_gain( float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ @@ -187,6 +188,326 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ); +/*! r: Configured reqularization factor value */ +float configure_reqularization_factor( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : total IVAS bitrate */ +); + +ivas_error ivas_dirac_alloc_mem( + DIRAC_REND_HANDLE hDirACRend, + const RENDERER_TYPE renderer_type, + const int16_t num_freq_bands, + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem, + const int16_t hodirac_flag +); + +void ivas_dirac_free_mem( + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem +); + +void initDiffuseResponses( + float *diffuse_response_function, + const int16_t num_channels, + AUDIO_CONFIG output_config, + IVAS_OUTPUT_SETUP hOutSetup, + const int16_t ambisonics_order, + const IVAS_FORMAT ivas_format, + int16_t *num_ele_spk_no_diffuse_rendering, + AUDIO_CONFIG transport_config +); + +void computeIntensityVector_dec( + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t num_frequency_bands, + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z +); + +void protoSignalComputation_shd( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_direct_buffer_f, + float *proto_diffuse_buffer_f, + float *reference_power, + const int16_t slot_index, + const int16_t num_inputs, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + float *p_Rmat +); + +void protoSignalComputation1( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands +); + +void protoSignalComputation2( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t isloudspeaker, + const int16_t slot_index, + const int16_t num_freq_bands, + MASA_STEREO_TYPE_DETECT *stereo_type_detect +); + +void protoSignalComputation4( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float *proto_frame_f, + float *proto_direct_buffer_f, + float *reference_power, + float *proto_power_smooth, + const int16_t slot_index, + const int16_t num_outputs_diff, + const int16_t num_freq_bands, + const + float *mtx_hoa_decoder, + const int16_t nchan_transport, + const int16_t *sba_map_tc_ind +); + +void ivas_dirac_dec_compute_diffuse_proto( + DIRAC_REND_HANDLE hDirACRend, + const int16_t num_freq_bands, + const int16_t slot_idx +); + +void computeDirectionAngles( + float *intensity_real_x, + float *intensity_real_y, + float *intensity_real_z, + const int16_t num_frequency_bands, + int16_t *azimuth, + int16_t *elevation +); + +void ivas_masa_init_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect +); + +void ivas_masa_stereotype_detection( + MASA_STEREO_TYPE_DETECT *stereo_type_detect +); + +void ivas_lfe_synth_with_cldfb( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], + const int16_t slot_index, + const int16_t subframe_index, + const int16_t nchan_transport +); + +void rotateAziEle_DirAC( + int16_t *azi, + int16_t *ele, + const int16_t band1, + const int16_t band2, + const float *p_Rmat +); + +ivas_error ivas_dirac_dec_onset_detection_open( + const int16_t num_channels, + const int16_t num_freq_bands, + const int16_t max_band_decorr, + DIRAC_ONSET_DETECTION_PARAMS *ph_dirac_onset_detection_params, + DIRAC_ONSET_DETECTION_STATE *ph_dirac_onset_detection_state +); + +void ivas_dirac_dec_onset_detection_process( + const float *input_power_f, + float *onset_filter, + const int16_t num_protos_diff, + DIRAC_ONSET_DETECTION_PARAMS h_dirac_onset_detection_params, + DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state +); + +ivas_error ivas_dirac_dec_decorr_open( + DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, + DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, + const int16_t num_freq_bands, + int16_t num_outputs_diff, + const int16_t num_protos_diff, + const DIRAC_SYNTHESIS_CONFIG synthesisConf, + float *frequency_axis, + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs /* i : output sampling rate */ +); + +void ivas_dirac_dec_decorr_process( + const int16_t num_freq_bands, + int16_t num_channels, + const int16_t num_protos_diff, + const DIRAC_SYNTHESIS_CONFIG synthesisConf, + const int16_t nchan_transport, /* i : number of transport channels */ + const float *input_frame_f, + const int16_t num_protos_dir, + const int16_t *proto_index_dir, + float *frame_dec_f, + float *onset_filter, + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params, + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state +); + +void ivas_dirac_dec_decorr_close( + HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params, + HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state +); + +ivas_error ivas_dirac_dec_output_synthesis_open( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +void ivas_dirac_dec_output_synthesis_init( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_out_woLFE, /* i : number of output audio channels without LFE */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +void ivas_dirac_dec_output_synthesis_close( + DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ +); + +void ivas_dirac_dec_output_synthesis_process_slot( + const float *reference_power, /* i : Estimated power */ + const float *onset, /* i : onset filter */ + const int16_t *azimuth, + const int16_t *elevation, + const float *diffuseness, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t sh_rot_max_order, + const float *p_Rmat, /* i : rotation matrix */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t ind_slot, /* i : index of the slot to be added to the input covariance */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim /* i : flag to indicate parameter estimation mode */ +); + +void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nbslots, /* i : number of slots to process */ + const float *onset_filter, + float *diffuseness, + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t dec_param_estim /* i : flag to indicate parameter estimation mode */ +); + +void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const int16_t nbslots, /* i : number of slots to process */ + float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + float *reference_power_smooth, + float qualityBasedSmFactor, + const int16_t enc_param_start_band +); + +void compute_hoa_encoder_mtx( + const float *azimuth, + const float *elevation, + float *response, + const int16_t num_responses, + const int16_t ambisonics_order ); + +void ivas_dirac_dec_compute_gain_factors( + const int16_t num_freq_bands, + const float *diffuseness, + const int16_t max_band_decorr, + float *direct_gain_factor, + float *diffuse_gain_factor +); + +void ivas_dirac_dec_compute_power_factors( + const int16_t num_freq_bands, + const float *diffuseness, + const int16_t max_band_decorr, + float *direct_power_factor, + float *diffuse_power_factor +); + +void ivas_dirac_dec_compute_directional_responses( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ +#ifdef MASA_AND_OBJECTS + MASA_ISM_DATA_HANDLE hMasaIsm, /* i : MASA_ISM data structure */ +#endif + const int16_t *azimuth, + const int16_t *elevation, + const int16_t md_idx, + const float *surCohRatio, + const int16_t shd_rot_max_order, /* i : split-order rotation method */ + const float *p_Rmat, /* i : rotation matrix */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ +); + +void ivas_dirac_dec_get_frequency_axis( + float *frequency_axis, /* o : array of center frequencies of a real filter bank */ + const int32_t output_Fs, /* i : sampling frequency */ + const int16_t num_freq_bands /* i : number of frequency bands */ +); + +ivas_error ivas_spat_hSpatParamRendCom_config( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: IVAS decoder structure */ + const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ + const int16_t dec_param_estim_flag, + const IVAS_FORMAT ivas_format, + const MC_MODE mc_mode, + const int32_t output_Fs, + const int16_t hodirac_flag +); + +void ivas_spat_hSpatParamRendCom_close( + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out +); + +void ivas_dirac_rend_close( + DIRAC_REND_HANDLE *hDirACRend_out +); + +ivas_error ivas_dirac_allocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +); + +void ivas_dirac_deallocate_parameters( + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ + const int16_t params_flag /* i : set of parameters flag */ +); + + /*----------------------------------------------------------------------------------* * HRTF diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 40d8127437..2878c78cbc 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -72,6 +72,359 @@ typedef struct ivas_output_setup_structure } IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; +/*----------------------------------------------------------------------------------* + * Spatial parametric rendering common structures + *----------------------------------------------------------------------------------*/ + +/*Onset detector*/ +typedef struct dirac_onset_detection_params_structure +{ + int16_t num_freq_bands; + int16_t max_band_decorr; + +} DIRAC_ONSET_DETECTION_PARAMS; + +typedef struct dirac_onset_detection_state_structure +{ + float *onset_detector_1; + float *onset_detector_2; + +} DIRAC_ONSET_DETECTION_STATE; + +/*Decorrelator*/ +typedef struct dirac_decorr_params_structure +{ + int16_t max_band_decorr; + int16_t max_frequency; + + int16_t *pre_delay; + int16_t *filter_length; + float *filter_coeff_num_real; + float *filter_coeff_den_real; + float *phase_coeff_real; + float *phase_coeff_imag; + int16_t *split_frequency_bands; + int16_t num_split_frequency_bands; + + int16_t use_ducker; + int16_t add_back_onsets_on; + + DIRAC_ONSET_DETECTION_PARAMS h_onset_detection_power_params; + +} DIRAC_DECORR_PARAMS, *HANDLE_DIRAC_DECORR_PARAMS; + +typedef struct dirac_decorr_state_structure +{ + float *decorr_buffer; + float *direct_energy_smooth; + float *reverb_energy_smooth; + + DIRAC_ONSET_DETECTION_STATE h_onset_detection_power_state; + +} DIRAC_DECORR_STATE, *HANDLE_DIRAC_DECORR_STATE; + +typedef struct ivas_spatial_parametric_rend_common_data_structure +{ + int16_t slot_size; + int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + int16_t subframes_rendered; + int16_t slots_rendered; + int16_t num_slots; + int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; + int16_t nb_subframes; + + int16_t num_freq_bands; +#ifdef MASA_AND_OBJECTS + int16_t numSimultaneousDirections; /* From 1 to 2 + MAX_NUM_OBJECTS */ + int16_t numParametricDirections; /* 1 or 2 */ + int16_t numIsmDirections; /* From 0 to MAX_NUM_OBJECTS */ +#else + int16_t numSimultaneousDirections; /* 1 or 2 */ +#endif + + int16_t **azimuth; + int16_t **elevation; + int16_t **azimuth2; + int16_t **elevation2; + + float **diffuseness_vector; + float **energy_ratio1; + float **energy_ratio2; + + float **spreadCoherence; + float **spreadCoherence2; + float **surroundingCoherence; + + /* Metadata access indices and buffer size */ + int16_t dirac_bs_md_write_idx; + int16_t dirac_read_idx; + int16_t dirac_md_buffer_length; + +} SPAT_PARAM_REND_COMMON_DATA, *SPAT_PARAM_REND_COMMON_DATA_HANDLE; + + +/*----------------------------------------------------------------------------------* + * DirAC rendering structures + *----------------------------------------------------------------------------------*/ + +typedef struct dirac_dec_stack_mem +{ + /*Decorrelator*/ + float *frame_dec_f; + + /*Prototypes*/ + float *proto_direct_buffer_f; + float *proto_diffuse_buffer_f; + + /*Prototype NRGs*/ + float *proto_power_smooth; + float *proto_power_diff_smooth; + + /*Gain or power factors for directional and diffuse streams*/ + float *direct_power_factor; + float *diffuse_power_factor; + + /*Directional responses (gains & Nrg)*/ + float *direct_responses; + float *direct_responses_square; + + /* Target co-variance mtx */ + float *cy_auto_dir_smooth; + float *cy_cross_dir_smooth; + float *cy_auto_diff_smooth; + + float *reference_power; + float *onset_filter; + +} DIRAC_DEC_STACK_MEM, *DIRAC_DEC_STACK_MEM_HANDLE; + +/*Output synthesis*/ +typedef struct dirac_output_synthesis_params_structure +{ + int16_t max_band_decorr; + + int16_t use_onset_filters; + + float *interpolator; + float *alpha_synthesis; + float *alpha_synthesis_fast; + int16_t numAlphas; + int16_t numAlphasFast; + + float *proto_matrix; + + float diffuse_compensation_factor; + float diffuse_compensation_factor_decorr; + +} DIRAC_OUTPUT_SYNTHESIS_PARAMS; + +typedef struct dirac_output_synthesis_state_structure +{ + /* only pointer to local buffers */ + float *direct_responses; /* direct responses for DOA of current frame. Size: num_freq_bands*num_channels. */ + float *direct_responses_square; + float *diffuse_responses_square; /* squared diffuse responses. Size: num_channels. */ + + /* only pointer to local buffers */ + float *direct_power_factor; + float *diffuse_power_factor; + + float *proto_power_smooth; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ + float *proto_power_smooth_prev; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ + + float *proto_power_diff_smooth; + float *proto_power_diff_smooth_prev; + + /* only pointer to local buffers */ + float *proto_direct_buffer_f; /* Buffer for direct sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ + float *proto_diffuse_buffer_f; /* Buffer for diffuse sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ + + /* Output gain memories */ + float *gains_dir_prev; /* Direct sound gains of current synthesis block. Size: num_freq_bands*num_channel. */ + float *gains_diff_prev; /* Diffuse sound gains of previous synthesis block. Size: num_freq_bands*num_channel. */ + + /* only pointer to local buffers */ + float *cy_auto_dir_smooth; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ + float *cy_cross_dir_smooth; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ + float *cy_auto_diff_smooth; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + + /* PSD memories */ + float *cy_auto_dir_smooth_prev; /* Target auto PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + float *cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + float *cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound of previous synthesis block. Size: num_freq_bands*num_channels. */ + + const float *onset_filter; + + /* Temporal smoothing memories */ + float *reference_power_smooth_prev; + float *direction_smoothness_prev; + +} DIRAC_OUTPUT_SYNTHESIS_STATE; + +/* MASA stereo transport signal type detection structure */ +typedef struct +{ + MASA_TRANSPORT_SIGNAL_TYPE masa_stereo_type; + MASA_TRANSPORT_SIGNAL_TYPE current_stereo_type; + MASA_TRANSPORT_SIGNAL_TYPE type_change_direction; + + int16_t dipole_freq_range[2]; + + float left_bb_power; + float right_bb_power; + float total_bb_power; + + float left_hi_power; + float right_hi_power; + float total_hi_power; + + float sum_power[MASA_SUM_FREQ_RANGE_BINS]; + float total_power[MASA_SUM_FREQ_RANGE_BINS]; + + float subtract_power_y; + float subtract_power_y_smooth; + float target_power_y_smooth; + + float lr_total_bb_ratio_db; + float lr_total_hi_ratio_db; + float min_sum_total_ratio_db; + float subtract_target_ratio_db; + + int16_t counter; + int16_t interpolator; + +} MASA_STEREO_TYPE_DETECT; + +/* McMASA LFE synthesis structure */ +typedef struct ivas_mcmasa_lfe_synth_struct +{ + float lfeToTotalEnergyRatio[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t lfeGainPrevIndex; + float transportEneSmooth; + float protoLfeEneSmooth; + float targetEneLfeSmooth; + float targetEneTransSmooth; + + float *lfeSynthRingBuffer; + int16_t ringBufferLoPointer; + int16_t ringBufferHiPointer; + float lowpassSum; + int16_t ringBufferSize; + + float *lfeSynthRingBuffer2; + int16_t ringBufferLoPointer2; + float lowpassSum2; + int16_t ringBufferSize2; + + float *delayBuffer_syncLp; + int16_t delayBuffer_syncLp_size; + + float *delayBuffer_syncDirAC; + int16_t delayBuffer_syncDirAC_size; + + float lfeGainPrev; + float transportGainPrev; + float interpolator[CLDFB_NO_CHANNELS_MAX]; + +} MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; + +/* DirAC renderer main structure */ +typedef struct ivas_dirac_rend_data_structure +{ + IVAS_OUTPUT_SETUP hOutSetup; + + /*Parameter estimation*/ + int16_t index_buffer_intensity; + float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; + float *buffer_energy; + + float *frequency_axis; + float *diffuse_response_function; + float *hoa_encoder; + const float *hoa_decoder; + + /*Decoder parameters */ + /*Prototypes*/ + int16_t num_outputs_dir; + int16_t num_outputs_diff; + int16_t num_protos_dir; + int16_t num_protos_diff; + int16_t num_protos_ambi; + DIRAC_SYNTHESIS_CONFIG synthesisConf; + DIRAC_PANNING_CONFIG panningConf; + + /* prototype computing */ + int16_t *proto_index_dir; + int16_t *proto_index_diff; + + int16_t proto_signal_decorr_on; + + /*Decoder states=memories*/ + float *proto_frame_f; + float *proto_frame_dec_f; + + DIRAC_DEC_STACK_MEM stack_mem; + MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect; + + int16_t num_ele_spk_no_diffuse_rendering; + + const int16_t *sba_map_tc; + + DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_psd_params; + DIRAC_OUTPUT_SYNTHESIS_STATE h_output_synthesis_psd_state; + + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; + +} DIRAC_REND_DATA, *DIRAC_REND_HANDLE; + + +/*----------------------------------------------------------------------------------* + * VBAP structures + *----------------------------------------------------------------------------------*/ + +/* Defines a single virtual surface triplet of loudspeakers + * with a precalculated inverse matrix */ +typedef struct vbap_vs_triplet_structure +{ + uint8_t speaker_node[3]; + float inverse_matrix[3][3]; + +} VBAP_VS_TRIPLET; + + +/* Storage structure for fast runtime triplet search */ +typedef struct triplet_search_structure +{ + VBAP_VS_TRIPLET *triplets; + int16_t num_triplets; + int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; + +} VBAP_SEARCH_STRUCT; + + +/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ +typedef struct vbap_data_structure +{ + VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ + int16_t num_search_structs; + int16_t num_speaker_nodes; + int16_t num_speaker_nodes_internal; + int16_t top_virtual_speaker_node_index; /* These indices can be negative */ + int16_t bottom_virtual_speaker_node_index; + int16_t back_virtual_speaker_node_index; + float *bottom_virtual_speaker_node_division_gains; + float *top_virtual_speaker_node_division_gains; + float *back_virtual_speaker_node_division_gains; +#ifdef MASA_AND_OBJECTS + float *object_mode_bottom_virtual_speaker_node_division_gains; + float *object_mode_top_virtual_speaker_node_division_gains; + float *object_mode_back_virtual_speaker_node_division_gains; +#endif + +} VBAP_DATA, *VBAP_HANDLE; + + /*----------------------------------------------------------------------------------* * Binaural FastConv Rendering structure *----------------------------------------------------------------------------------*/ @@ -114,6 +467,17 @@ typedef struct ivas_binaural_reverb_struct } REVERB_STRUCT, *REVERB_STRUCT_HANDLE; + +/* Diffuse sound directional distribution data structure */ +typedef struct ivas_diffuse_distribution_data_structure +{ + float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; + float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; + float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; + +} DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; + + /* Parametric binaural data structure */ typedef struct ivas_dirac_dec_binaural_data_structure { @@ -155,11 +519,15 @@ typedef struct ivas_dirac_dec_binaural_data_structure #endif float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; float reqularizationFactor; + DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; + + HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; + HANDLE_DIRAC_DECORR_STATE h_freq_domain_decorr_ap_state; + } DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; typedef struct ivas_binaural_rendering_conv_module_struct diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6ad462c711..1a40a57bf2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2994,11 +2994,11 @@ static ivas_error initMasaDummyDecForMcOut( } decDummy->hQMetaData->coherence_flag = 1; - if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( decDummy, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - decDummy->hDirAC->dirac_bs_md_write_idx = 0; + decDummy->hSpatParamRendCom->dirac_bs_md_write_idx = 0; if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -3072,11 +3072,11 @@ static ivas_error initMasaDummyDecForSbaOut( } decDummy->hQMetaData->coherence_flag = 1; - if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( decDummy, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - decDummy->hDirAC->dirac_bs_md_write_idx = 0; + decDummy->hSpatParamRendCom->dirac_bs_md_write_idx = 0; numCldfbAnalyses = decDummy->nchan_transport; numCldfbSyntheses = decDummy->hDecoderConfig->nchan_out; @@ -3146,11 +3146,11 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy->ivas_format = MASA_FORMAT; decDummy->transport_config = AUDIO_CONFIG_INVALID; - if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_config( decDummy, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } - decDummy->hDirAC->dirac_bs_md_write_idx = 0; + decDummy->hSpatParamRendCom->dirac_bs_md_write_idx = 0; if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -3245,6 +3245,8 @@ static DecoderDummy *initDecoderDummy( decDummy->hVBAPdata = NULL; // note: not used at the moment decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; + decDummy->hDirACRend = NULL; + decDummy->hSpatParamRendCom = NULL; decDummy->hQMetaData = NULL; decDummy->hHrtfParambin = NULL; decDummy->hHeadTrackData = NULL; @@ -3432,6 +3434,8 @@ static void freeDecoderDummy( } /* DirAC handle */ + ivas_dirac_rend_close( &( pDecDummy->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( pDecDummy->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( pDecDummy->hDirAC ) ); /* Qmetadata handle */ @@ -3447,6 +3451,9 @@ static void freeDecoderDummy( pDecDummy->hoa_dec_mtx = NULL; } + /* Parametric binaural renderer HRTF structure */ + free( pDecDummy->hHrtfParambin ); + /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); @@ -7821,44 +7828,44 @@ static ivas_error renderActiveInputsSba( static void copyMasaMetadataToDiracRenderer( MASA_METADATA_FRAME *meta, - DIRAC_DEC_HANDLE hDirAC ) + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom ) { int16_t band, sf, bin; int16_t meta_write_index; #ifdef MASA_AND_OBJECTS - hDirAC->numParametricDirections = meta->descriptive_meta.numberOfDirections + 1; + hSpatParamRendCom->numParametricDirections = meta->descriptive_meta.numberOfDirections + 1; #endif - hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; + hSpatParamRendCom->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - meta_write_index = ( hDirAC->dirac_bs_md_write_idx + sf ) % hDirAC->dirac_md_buffer_length; + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + sf ) % hSpatParamRendCom->dirac_md_buffer_length; for ( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { for ( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1]; bin++ ) { - hDirAC->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; - hDirAC->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; - hDirAC->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; - hDirAC->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; - - if ( hDirAC->numSimultaneousDirections == 2 ) + hSpatParamRendCom->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; + hSpatParamRendCom->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; + hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; + hSpatParamRendCom->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; + hSpatParamRendCom->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; + + if ( hSpatParamRendCom->numSimultaneousDirections == 2 ) { - hDirAC->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; - hDirAC->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; - hDirAC->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; + hSpatParamRendCom->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; + hSpatParamRendCom->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; + hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; + hSpatParamRendCom->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; } } } } - hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + hSpatParamRendCom->dirac_bs_md_write_idx = ( hSpatParamRendCom->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; return; } @@ -7870,7 +7877,7 @@ static void renderMasaToMc( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -7893,7 +7900,7 @@ static void renderMasaToSba( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); @@ -7909,7 +7916,7 @@ static void renderMasaToBinaural( float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); -- GitLab From 4c8efefb7b3bb6e6ad96bf44c30c72f0a62ac42a Mon Sep 17 00:00:00 2001 From: rhb Date: Wed, 26 Jul 2023 17:28:57 +0200 Subject: [PATCH 515/591] add another safety check --- lib_dec/ivas_spar_decoder.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 281c5e9f11..195bf57dfb 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1019,7 +1019,11 @@ static void ivas_spar_calc_smooth_facs( bin = 0; for ( b = 0; b < nbands_spar; b++ ) { +#ifdef FIX_625_IDX_OOB + if ( bin >= CLDFB_NO_CHANNELS_MAX || ( b > 0 && bin2band->p_cldfb_map_to_spar_band[bin] < bin2band->p_cldfb_map_to_spar_band[bin - 1] ) ) +#else if ( b > 0 && bin2band->p_cldfb_map_to_spar_band[bin] < bin2band->p_cldfb_map_to_spar_band[bin - 1] ) +#endif { break; } -- GitLab From 230ea69f335a799a3b36a3398a5e3d1f5e069310 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 18:28:10 +0200 Subject: [PATCH 516/591] - fix logic around FIX_ISM2_64KBPS / FIX_ISM2_64KBPS_COMBINED_FORMAT - clang format --- lib_com/ivas_ism_com.c | 47 +++++++++----------- lib_com/options.h | 6 ++- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_ism_renderer.c | 2 +- lib_dec/ivas_masa_dec.c | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 10 +++-- lib_rend/ivas_stat_rend.h | 2 +- lib_rend/lib_rend.c | 2 +- 8 files changed, 37 insertions(+), 38 deletions(-) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 0af16be8a6..b01577dacd 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -363,10 +363,6 @@ ivas_error ivas_ism_config( } /* limitation to avoid too high bitrate in one active TCX channel */ -#ifdef FIX_ISM2_64KBPS_COMBINED_FORMAT - /* Todo: the alternative is to make sure there are less than n_ism -1 objects inactive; but this way is simpler (Todo VE to check )*/ - if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k && combined_format_flag == 0 ) -#else if ( element_brate[0] >= SCE_CORE_16k_LOW_LIMIT && element_brate[0] <= IVAS_32k ) { diff = 0; @@ -380,41 +376,40 @@ ivas_error ivas_ism_config( bits_CoreCoder[ch] = tmp; } } -#endif - if ( diff > 0 ) + if ( diff > 0 ) + { + ch = 0; + for ( ch = 0; ch < n_ISms; ch++ ) { - ch = 0; - for ( ch = 0; ch < n_ISms; ch++ ) + if ( flag_higher[ch] == 0 ) { - if ( flag_higher[ch] == 0 ) + if ( diff > limit_high ) { - if ( diff > limit_high ) + diff += bits_CoreCoder[ch] - limit_high; + bits_CoreCoder[ch] = limit_high; + } + else + { + bits_CoreCoder[ch] += diff; +#ifdef DEBUGGING + if ( bits_CoreCoder[ch] == SID_2k40 / FRAMES_PER_SEC ) { - diff += bits_CoreCoder[ch] - limit_high; - bits_CoreCoder[ch] = limit_high; + printf( "\nWarning: ISM bitbudget equal to SID!\n" ); } - else - { - bits_CoreCoder[ch] += diff; -#ifdef DEBUGGING - if ( bits_CoreCoder[ch] == SID_2k40 / FRAMES_PER_SEC ) - { - printf( "\nWarning: ISM bitbudget equal to SID!\n" ); - } #endif #ifdef MASA_AND_OBJECTS - if ( combined_format_flag ) - { - diff = 0; - } -#endif - break; + if ( combined_format_flag ) + { + diff = 0; } +#endif + break; } } } + } #ifdef MASA_AND_OBJECTS if ( combined_format_flag ) diff --git a/lib_com/options.h b/lib_com/options.h index aca3c591a0..749f328875 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -210,7 +210,8 @@ #define FIX_626_VARIABLE_TYPE_MDCT_CONC /* FhG: trivial fix to fix USAN error */ #define FIX_616_DIV_ZERO_MCT /*FhG : Fix UBSAN division by zero error of issue 616*/ -/* ################## End BE DEVELOPMENT switches ######################### */ + +/* OMASA */ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ @@ -220,10 +221,11 @@ #define OMASA_BIT_BUFF_SZ /* Nokia: increase bitstream index buffer initial size */ #define OMASA_EXT_OUTPUT /* VA: support of EXT output configuration for OMASA DISC mode */ #define OMASA_BIT_BUFF_SZ1 /* Nokia: increase bitstream index buffer initial size */ -#define FIX_ISM2_64KBPS_COMBINED_FORMAT /* Nokia: Making the fix_562 work with combined format */ #define OMASA_OBJ_REND_CLOSE /* Nokia: close OMASA separate object renderer */ #endif +/* ################## End BE DEVELOPMENT switches ######################### */ + /* #################### Start NON-BE CR switches ########################## */ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 10e1aac313..495a117bef 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -508,7 +508,7 @@ ivas_error ivas_dec( /* Set the number of objects for the parametric rendering */ dirac_bs_md_write_idx = 0; - if ( st_ivas->hDirAC != NULL ) /* TODO: should this check for st_ivas->hSpatParamRendCom != NULL ? */ + if ( st_ivas->hDirAC != NULL ) /* TODO: should this check for st_ivas->hSpatParamRendCom != NULL ? */ { st_ivas->hSpatParamRendCom->numIsmDirections = 0; if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 24ce4e86a9..e977f99b88 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -432,7 +432,7 @@ ivas_error ivas_masa_ism_separate_object_renderer_close( { if ( st_ivas->hMasaIsmData->delayBuffer[i] != NULL ) { - free(st_ivas->hMasaIsmData->delayBuffer[i] ); + free( st_ivas->hMasaIsmData->delayBuffer[i] ); st_ivas->hMasaIsmData->delayBuffer[i] = NULL; } } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a0d98f56dc..eadfbd594b 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1293,7 +1293,7 @@ ivas_error ivas_masa_dec_reconfigure( ivas_renderer_select( st_ivas ); /* Todo: Check this */ -#if 0 && defined(OMASA_BRSW_MONO_FIX) /* TODO */ +#if 0 && defined( OMASA_BRSW_MONO_FIX ) /* TODO */ if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) #else @@ -1307,7 +1307,7 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } -#if 0 && defined(OMASA_BRSW_MONO_FIX) +#if 0 && defined( OMASA_BRSW_MONO_FIX ) else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) #else else if ( st_ivas->renderer_type == RENDERER_DISABLE ) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 7e30145256..33fec578c3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -933,7 +933,8 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric const int16_t subframe, const int16_t isHeadtracked #ifdef MASA_AND_OBJECTS - , const MASA_ISM_DATA_HANDLE hMasaIsmData + , + const MASA_ISM_DATA_HANDLE hMasaIsmData #endif ) { @@ -1128,7 +1129,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric isIsmDirection = 1; uint16_t ismDirIndex; ismDirIndex = dirIndex - hSpatParamRendCom->numParametricDirections; - assert( hMasaIsmData != NULL && "hMasaIsmData should not be NULL if we use it"); + assert( hMasaIsmData != NULL && "hMasaIsmData should not be NULL if we use it" ); if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) { aziDeg = hMasaIsmData->azimuth_ism_edited[ismDirIndex]; @@ -1441,10 +1442,11 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( float Rmat[3][3], const int16_t isHeadtracked #ifdef MASA_AND_OBJECTS - , const int16_t nchanSeparateChannels, + , + const int16_t nchanSeparateChannels, const MASA_ISM_DATA_HANDLE hMasaIsmData #endif - ) +) { int16_t chA, chB, bin; int16_t separateCenterChannelRendering; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2878c78cbc..7311d72778 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -139,7 +139,7 @@ typedef struct ivas_spatial_parametric_rend_common_data_structure int16_t numParametricDirections; /* 1 or 2 */ int16_t numIsmDirections; /* From 0 to MAX_NUM_OBJECTS */ #else - int16_t numSimultaneousDirections; /* 1 or 2 */ + int16_t numSimultaneousDirections; /* 1 or 2 */ #endif int16_t **azimuth; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 582e0d8bfd..24ef348af9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8534,7 +8534,7 @@ ivas_error IVAS_REND_GetSamples( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, td_input, -- GitLab From 3fddf874fc1e37d0415ed1081a69b508849a3eca Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 19:41:29 +0200 Subject: [PATCH 517/591] accept OMASA_EXT_OUTPUT --- apps/decoder.c | 28 ++++++++++++++-------------- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 3 +-- lib_dec/ivas_init_dec.c | 23 +++++++++-------------- lib_dec/ivas_masa_dec.c | 4 ---- lib_dec/ivas_output_config.c | 2 -- lib_dec/lib_dec.c | 12 ++++++------ lib_dec/lib_dec.h | 2 +- 8 files changed, 31 insertions(+), 44 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index bcd54f56f1..cb39dd0f1e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1742,7 +1742,7 @@ static ivas_error initOnFirstGoodFrame( } /* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */ -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( *pBsFormat == IVAS_DEC_BS_OBJ || *pBsFormat == IVAS_DEC_BS_MASA_ISM ) #else if ( *pBsFormat == IVAS_DEC_BS_OBJ ) @@ -1786,7 +1786,7 @@ static ivas_error initOnFirstGoodFrame( } /* If outputting MASA, open output file and write metadata for initial bad frames */ -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( *pBsFormat == IVAS_DEC_BS_MASA || *pBsFormat == IVAS_DEC_BS_MASA_ISM ) #else else if ( *pBsFormat == IVAS_DEC_BS_MASA ) @@ -1798,7 +1798,7 @@ static ivas_error initOnFirstGoodFrame( return error; } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( numInitialBadFrames > 0 ) { #endif @@ -1822,7 +1822,7 @@ static ivas_error initOnFirstGoodFrame( return error; } } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS } #endif } @@ -2154,7 +2154,7 @@ static ivas_error decodeG192( /* Write MASA/ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else if ( bsFormat == IVAS_DEC_BS_OBJ ) @@ -2183,7 +2183,7 @@ static ivas_error decodeG192( } } } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else @@ -2275,7 +2275,7 @@ static ivas_error decodeG192( { fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS else if ( bsFormat == IVAS_DEC_BS_MASA_ISM ) { for ( i = 0; i < numObj; i++ ) @@ -2750,7 +2750,7 @@ static ivas_error decodeVoIP( { int16_t i; -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else if ( bsFormat == IVAS_DEC_BS_OBJ ) @@ -2779,7 +2779,7 @@ static ivas_error decodeVoIP( } } } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else @@ -3188,7 +3188,7 @@ static ivas_error decodeVariableSpeed( /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else if ( bsFormat == IVAS_DEC_BS_OBJ ) @@ -3217,7 +3217,7 @@ static ivas_error decodeVariableSpeed( } } } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else @@ -3376,7 +3376,7 @@ static ivas_error decodeVariableSpeed( /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else if ( bsFormat == IVAS_DEC_BS_OBJ ) @@ -3405,7 +3405,7 @@ static ivas_error decodeVariableSpeed( } } } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) #else @@ -3474,7 +3474,7 @@ static ivas_error decodeVariableSpeed( { fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS else if ( bsFormat == IVAS_DEC_BS_MASA_ISM ) { for ( i = 0; i < numObj; i++ ) diff --git a/lib_com/options.h b/lib_com/options.h index 749f328875..3f2547b42b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -219,7 +219,6 @@ #define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ #define OMASA_FIX_LOW_FS /* Nokia: fixes related to lower input signal sampling rates */ #define OMASA_BIT_BUFF_SZ /* Nokia: increase bitstream index buffer initial size */ -#define OMASA_EXT_OUTPUT /* VA: support of EXT output configuration for OMASA DISC mode */ #define OMASA_BIT_BUFF_SZ1 /* Nokia: increase bitstream index buffer initial size */ #define OMASA_OBJ_REND_CLOSE /* Nokia: close OMASA separate object renderer */ #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 495a117bef..bd0f071ab9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -589,7 +589,7 @@ ivas_error ivas_dec( ivas_omasa_dirac_rend( st_ivas, output, output_frame ); } -#ifdef OMASA_EXT_OUTPUT + /* external output */ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { /* sanity check in case of bitrate switching */ @@ -609,7 +609,6 @@ ivas_error ivas_dec( mvr2r( output[MAX_OUTPUT_CHANNELS - 2], output[n], output_frame ); mvr2r( output[MAX_OUTPUT_CHANNELS - 1], output[++n], output_frame ); } -#endif } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b8d708b261..5bf780788f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -784,14 +784,11 @@ ivas_error ivas_init_decoder( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { -#ifdef OMASA_EXT_OUTPUT if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { hDecoderConfig->nchan_out = st_ivas->nchan_transport + st_ivas->nchan_ism; } - else -#endif - if ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) + else if ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) { hDecoderConfig->nchan_out = st_ivas->nchan_transport; } @@ -2591,6 +2588,14 @@ static ivas_error doSanityChecks_IVAS( } } + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && output_config == AUDIO_CONFIG_EXTERNAL ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); + } + } + #ifdef DEBUGGING if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != AUDIO_CONFIG_BINAURAL && output_config != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) { @@ -2603,15 +2608,5 @@ static ivas_error doSanityChecks_IVAS( } #endif -#ifdef OMASA_EXT_OUTPUT - if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) - { - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && output_config == AUDIO_CONFIG_EXTERNAL ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); - } - } -#endif - return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index eadfbd594b..6306881c9c 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -571,11 +571,7 @@ ivas_error ivas_masa_decode( } } -#ifdef OMASA_EXT_OUTPUT if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) -#endif { create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index fb5469fe43..60ec7bb665 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -441,12 +441,10 @@ void ivas_renderer_select( { *renderer_type = RENDERER_STEREO_PARAMETRIC; } -#ifdef OMASA_EXT_OUTPUT else if ( output_config == AUDIO_CONFIG_EXTERNAL ) { *renderer_type = RENDERER_DISABLE; } -#endif } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index d32b153035..64a3a2b2af 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -408,7 +408,7 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( return IVAS_DEC_BS_SBA; case MASA_FORMAT: return IVAS_DEC_BS_MASA; -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS case MASA_ISM_FORMAT: return IVAS_DEC_BS_MASA_ISM; #endif @@ -1007,13 +1007,13 @@ ivas_error IVAS_DEC_GetNumObjects( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT ) #else if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT ) #endif { -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS *numObjects = hIvasDec->st_ivas->nchan_ism; #else *numObjects = hIvasDec->st_ivas->hDecoderConfig->nchan_out; @@ -1100,7 +1100,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( st_ivas = hIvasDec->st_ivas; -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->ivas_format != MASA_ISM_FORMAT ) #else if ( st_ivas->ivas_format != ISM_FORMAT ) @@ -1109,7 +1109,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( return IVAS_ERR_WRONG_MODE; } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( objectIdx >= st_ivas->nchan_ism ) #else if ( objectIdx >= st_ivas->hDecoderConfig->nchan_out ) @@ -1169,7 +1169,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS if ( hIvasDec->st_ivas->ivas_format != MASA_FORMAT && hIvasDec->st_ivas->ivas_format != MASA_ISM_FORMAT ) #else if ( hIvasDec->st_ivas->ivas_format != MASA_FORMAT ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index e214796629..52155ec89e 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -116,7 +116,7 @@ typedef enum _IVAS_DEC_BS_FORMAT IVAS_DEC_BS_SBA, IVAS_DEC_BS_OBJ, IVAS_DEC_BS_MASA, -#ifdef OMASA_EXT_OUTPUT +#ifdef MASA_AND_OBJECTS IVAS_DEC_BS_MASA_ISM, #endif IVAS_DEC_BS_UNKOWN = 0xffff -- GitLab From 84c744e657a484b3ab7ffaa956fa8ac6067d1efb Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 19:46:21 +0200 Subject: [PATCH 518/591] accept OMASA_OBJ_REND_CLOSE (with simplification), OMASA_BIT_BUFF_SZ and OMASA_BIT_BUFF_SZ1 --- lib_com/bitstream.c | 8 -------- lib_com/ivas_prot.h | 4 +--- lib_com/options.h | 3 --- lib_dec/ivas_ism_renderer.c | 11 +++++++---- lib_dec/ivas_omasa_dec.c | 30 ++++-------------------------- 5 files changed, 12 insertions(+), 44 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 6b5ea4d6e7..604ddc2b96 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -553,11 +553,7 @@ int16_t get_ivas_max_num_indices( } else if ( ivas_total_brate <= IVAS_160k ) { -#ifdef OMASA_BIT_BUFF_SZ1 - return 900; -#else return 850; -#endif } else if ( ivas_total_brate <= IVAS_192k ) { @@ -565,11 +561,7 @@ int16_t get_ivas_max_num_indices( } else if ( ivas_total_brate <= IVAS_256k ) { -#ifdef OMASA_BIT_BUFF_SZ return 1300; -#else - return 1150; -#endif } else if ( ivas_total_brate <= IVAS_384k ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9cce927c29..3080698450 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5763,11 +5763,9 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef OMASA_OBJ_REND_CLOSE -ivas_error ivas_masa_ism_separate_object_renderer_close( +void ivas_masa_ism_separate_object_renderer_close( Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ ); -#endif void ivas_masa_ism_separate_object_render( Decoder_Struct* st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 3f2547b42b..ac72906433 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -218,9 +218,6 @@ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix #define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ #define OMASA_FIX_LOW_FS /* Nokia: fixes related to lower input signal sampling rates */ -#define OMASA_BIT_BUFF_SZ /* Nokia: increase bitstream index buffer initial size */ -#define OMASA_BIT_BUFF_SZ1 /* Nokia: increase bitstream index buffer initial size */ -#define OMASA_OBJ_REND_CLOSE /* Nokia: close OMASA separate object renderer */ #endif /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index e977f99b88..08017af46f 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -412,18 +412,18 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( } -#ifdef OMASA_OBJ_REND_CLOSE /*-------------------------------------------------------------------------* * ivas_masa_ism_separate_object_renderer_close() * * Close structures, reserve memory, and init values. *-------------------------------------------------------------------------*/ -ivas_error ivas_masa_ism_separate_object_renderer_close( +void ivas_masa_ism_separate_object_renderer_close( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { int16_t i; + if ( st_ivas->hMasaIsmData != NULL ) { if ( st_ivas->hMasaIsmData->delayBuffer != NULL ) @@ -436,10 +436,12 @@ ivas_error ivas_masa_ism_separate_object_renderer_close( st_ivas->hMasaIsmData->delayBuffer[i] = NULL; } } + free( st_ivas->hMasaIsmData->delayBuffer ); st_ivas->hMasaIsmData->delayBuffer = NULL; } } + if ( st_ivas->hIsmRendererData != NULL ) { if ( st_ivas->hIsmRendererData->interpolator != NULL ) @@ -447,13 +449,14 @@ ivas_error ivas_masa_ism_separate_object_renderer_close( free( st_ivas->hIsmRendererData->interpolator ); st_ivas->hIsmRendererData->interpolator = NULL; } + free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } - return IVAS_ERR_OK; + return; } -#endif + /*-------------------------------------------------------------------------* * ivas_masa_ism_separate_object_render() diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 326fc64674..e8add408ef 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -329,19 +329,8 @@ ivas_error ivas_omasa_dec_config( st_ivas->hHrtfTD = NULL; } -#ifdef OMASA_OBJ_REND_CLOSE - if ( ( error = ivas_masa_ism_separate_object_renderer_close( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#else - /* ISM renderer handle */ - if ( st_ivas->hIsmRendererData != NULL ) - { - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; - } -#endif + /* ISM renderer handle + ISM data handle */ + ivas_masa_ism_separate_object_renderer_close( st_ivas ); } } @@ -362,19 +351,8 @@ ivas_error ivas_omasa_dec_config( } else { -#ifdef OMASA_OBJ_REND_CLOSE - if ( ( error = ivas_masa_ism_separate_object_renderer_close( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#else - /* ISM renderer handle */ - if ( st_ivas->hIsmRendererData != NULL ) - { - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; - } -#endif + /* ISM renderer handle + ISM data handle */ + ivas_masa_ism_separate_object_renderer_close( st_ivas ); } } -- GitLab From 45405eedf9740c6a135ef53754502f1bdb3cf893 Mon Sep 17 00:00:00 2001 From: advasila Date: Wed, 26 Jul 2023 20:47:27 +0300 Subject: [PATCH 519/591] fix issue 635 --- lib_com/options.h | 1 + lib_enc/ivas_qmetadata_enc.c | 41 +++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c2bc0b866b..a6fbfe775b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -195,6 +195,7 @@ #define FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET /* Eri: Issue 621 : UBSAN: applying non-zero offset 7200 to null pointer in lsf_msvq_ma_enc.c */ #define FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION /* Eri: Issue 600 : removed manual WMCtool instrumentation outside of WMC_TOOL_SKIP defines */ #define NONBE_FIX_539_MASA_384K_CHIRP /* Nokia: issue 539, puts the normalization of the energy ratios at the correct place, affect MASA 384k only */ +#define FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA /* Nokia: issue 635 adding cast to uint16_t in q_metadata_enc */ /* Fixes for bugs found during split rendering contribution development */ #define TD_TDREND_FIX_NULLPTR_ACCESS /* FhG: avoid nullptr access in ivas_rend_TDObjRendOpen */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 7cf68d677d..9350b1c09d 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2673,15 +2673,30 @@ static int16_t ivas_qmetadata_entropy_encode_dir( } else { +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + if ( sign_th < 0 ) + { + avg_elevation_index = ( avg_elevation_alphabet >> 1 ) - avg_elevation_index; + } + else + { + avg_elevation_index += ( avg_elevation_alphabet >> 1 ); + } + avg_elevation *= sign_th; +#else if ( sign_th < 0 ) { avg_elevation_index = -avg_elevation_index; } avg_elevation *= sign_th; avg_elevation_index += ( avg_elevation_alphabet >> 1 ); +#endif } +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + avg_azimuth_index = (uint16_t) ( quantize_phi( avg_azimuth + 180, 0, &avg_azimuth, avg_azimuth_alphabet ) ); +#else avg_azimuth_index = quantize_phi( avg_azimuth + 180, 0, &avg_azimuth, avg_azimuth_alphabet ); - +#endif /* Elevation only if not 2D */ if ( q_direction->not_in_2D > 0 ) { @@ -2692,6 +2707,18 @@ static int16_t ivas_qmetadata_entropy_encode_dir( for ( avg_elevation_offset = 0; avg_elevation_offset < q_direction->cfg.search_effort; avg_elevation_offset++ ) { +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) + { + avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + avg_elevation_offset ); + } + else + { + avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ) ); + } + + avg_elevation_index = (uint16_t) ( ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet ); +#else if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { avg_elevation_index = avg_elevation_index_initial + avg_elevation_offset; @@ -2700,7 +2727,7 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { avg_elevation_index = avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ); } - +#endif avg_elevation_index = ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet; all_zero_dist_elevation_indexes = 1; @@ -2804,7 +2831,11 @@ static int16_t ivas_qmetadata_entropy_encode_dir( if ( ( nbands - start_band >= 5 ) && ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) && ( nblocks > 1 ) ) { use_adapt_avg = calc_var_azi( q_direction, diffuseness_index_max_ec_frame, avg_azimuth - 180, &avg_azimuth ); +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + avg_azimuth_index = (uint16_t) ( quantize_phi( avg_azimuth + 180, 0, &avg_azimuth, avg_azimuth_alphabet ) ); +#else avg_azimuth_index = quantize_phi( avg_azimuth + 180, 0, &avg_azimuth, avg_azimuth_alphabet ); +#endif } avg_azimuth_index_initial = avg_azimuth_index; /* avg_azimuth_index;*/ azimuth_bits_ec_best = MAX16B; @@ -2814,9 +2845,13 @@ static int16_t ivas_qmetadata_entropy_encode_dir( for ( avg_azimuth_offset = 0; avg_azimuth_offset < q_direction->cfg.search_effort; avg_azimuth_offset++ ) { set_zero( avg_direction_vector, 3 ); +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + avg_azimuth_index = (uint16_t) ( avg_azimuth_index_initial + ivas_qmetadata_dereorder_generic( avg_azimuth_offset ) ); + avg_azimuth_index = (uint16_t) ( ( avg_azimuth_index + avg_azimuth_alphabet ) % avg_azimuth_alphabet ); +#else avg_azimuth_index = avg_azimuth_index_initial + ivas_qmetadata_dereorder_generic( avg_azimuth_offset ); avg_azimuth_index = ( avg_azimuth_index + avg_azimuth_alphabet ) % avg_azimuth_alphabet; - +#endif all_zero_dist_azimuth_indexes = 1; azimuth_bits_ec = ivas_qmetadata_encode_quasi_uniform_length( ivas_qmetadata_reorder_generic( avg_azimuth_index - ( avg_azimuth_alphabet >> 1 ) ), avg_azimuth_alphabet ); -- GitLab From 7bc3e3643ad6c35308beb8cdb8267f16cabf5bff Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 20:06:07 +0200 Subject: [PATCH 520/591] accept switches from #637 --- lib_com/ivas_cnst.h | 13 -- lib_com/options.h | 15 -- lib_dec/dec_tcx.c | 28 ---- lib_dec/gs_dec.c | 4 - lib_dec/ivas_mc_param_dec.c | 10 -- lib_enc/ivas_decision_matrix_enc.c | 31 ---- lib_enc/ivas_mc_param_enc.c | 8 -- lib_enc/ivas_stereo_classifier.c | 5 +- lib_rend/ivas_objectRenderer.c | 48 +------ lib_rend/ivas_objectRenderer_hrFilt.c | 21 +-- lib_rend/ivas_objectRenderer_mix.c | 5 - lib_rend/ivas_objectRenderer_sources.c | 191 ++++++++++--------------- lib_rend/ivas_prot_rend.h | 2 - 13 files changed, 83 insertions(+), 298 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 7790b6d9c1..c747e2e143 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -318,11 +318,7 @@ typedef enum #define MIN_BRATE_SWB_SCE ACELP_9k60 /* min. SCE bitrate where SWB is supported */ #define MIN_BRATE_SWB_STEREO IVAS_13k2 /* min. stereo bitrate where SWB is supported */ #define MIN_BRATE_FB_STEREO IVAS_32k /* min. SCE and stereo bitrate where FB is supported */ -#ifdef ISM_FB_16k4 #define MIN_BRATE_FB_ISM 16000 /* min. SCE bitrate where FB is supported in ISM format */ -#else -#define MIN_BRATE_FB_ISM 24000 /* min. SCE bitrate where FB is supported in ISM format */ -#endif #define MIN_TDM_BRATE_WB_TBE_1k05 12000 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ #define MIN_BRATE_WB_TBE_1k05 9650 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ @@ -1678,22 +1674,13 @@ typedef enum typedef enum { TDREND_POSTYPE_ABSOLUTE, /* The source position is in absolute coordinates */ -#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT TDREND_POSTYPE_NON_DIEGETIC /* The source position is non-diegetic */ -#else - TDREND_POSTYPE_RELATIVE_TO_LISTENER /* The source position is relative to the listener */ -#endif } TDREND_PosType_t; typedef enum { TDREND_PLAYSTATUS_INITIAL, -#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT - TDREND_PLAYSTATUS_PLAYING, - TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC -#else TDREND_PLAYSTATUS_PLAYING -#endif } TDREND_PlayStatus_t; typedef enum diff --git a/lib_com/options.h b/lib_com/options.h index ac72906433..dd46315152 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,25 +159,10 @@ #define FIX_571_REVERB_NOT_ACTIVATED_ISM /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */ #define FIX_QMETA_SID_5k2 /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */ -#define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ -#define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ -#define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ -#define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ - #define FIX_488_SYNC_DELAY /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */ -#define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ -#define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ -#define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ - -#define ISM_FB_16k4 /* VA: Issue: 579: change BW from SWB to FB in NxISM conditions to match the EVS codec */ - #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ -#define FIX_550_FIRST_FRAME_ACCESS /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */ -#define FIX_550_FIRST_FRAME_ACCESS_ALT /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */ -#define FIX_569_TD_FILTER_LENGTH /* Eri: Issue 569: If an HRTF binary file exceeds the SFX_SPAT_BIN_MAX_FILTER_LENGTH the decoder crashes. This truncates the filter when generated from the model. */ - #define FIX_595_SHL_NOGLOB /* FhG: Issue 595: compilation with BASOP_NOGLOB disabled */ #define UPDATE_FASTCONV_SBA_FILTER /* Dlb: Issue 584: Update SBA CLDFB-Domain HRTFs */ #define FIX_570_SF_EXT_ORIENTATION diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index dd10cef293..cffb6a1092 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -377,11 +377,7 @@ void IMDCT( TCX_MDCT_Inverse( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, st->element_mode ); } -#ifndef FIX_575_LOW_OVERLAP_PLC_RECOVERY - tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core_bfi, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); -#else tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); -#endif if ( w > 0 ) { @@ -398,13 +394,11 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->prev_bfi && frame_cnt == 0 && st->last_core != st->last_core_bfi && st->last_core_bfi == ACELP_CORE ) { tcx_windowing_synthesis_past_frame( old_syn_overl, tcx_aldo_window_1_trunc, tcx_mdct_window_half, tcx_mdct_window_minimum, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, hTcxCfg->tcx_last_overlap_mode ); v_add( xn_buf, old_syn_overl, xn_buf, overlap ); } -#endif } else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ) @@ -1252,7 +1246,6 @@ void decoder_tcx_noisefilling( if ( ( frame_cnt == 0 ) && ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) && ( !st->tonal_mdct_plc_active ) && ( st->nbLostCmpt == 1 ) && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) { E_2ndlast = E_last = EPSILON; -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) @@ -1269,19 +1262,11 @@ void decoder_tcx_noisefilling( E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } -#else - for ( i = 0; i < infoIGFStartLine; i = i + 2 ) - { - E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; - E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; - } -#endif tmp2 = E_2ndlast / E_last; /* replace higher energy TCX5 frame by lower one to avoid energy fluctuation */ if ( tmp2 > 2 ) { -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) @@ -1296,16 +1281,9 @@ void decoder_tcx_noisefilling( st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } -#else - for ( i = 0; i < infoIGFStartLine; i = i + 2 ) - { - st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; - } -#endif } else if ( tmp2 < 0.5 ) { -#ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) @@ -1320,12 +1298,6 @@ void decoder_tcx_noisefilling( st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } } -#else - for ( i = 0; i < infoIGFStartLine; i = i + 2 ) - { - st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; - } -#endif } } diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index 1244f97793..5ed7aa92c4 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -104,11 +104,7 @@ void decod_audio( } /* safety check in case of bit errors */ -#ifdef ISM_FB_16k4 if ( st->GSC_noisy_speech && st->bwidth < SWB && st->GSC_IVAS_mode == 0 ) -#else - if ( st->GSC_noisy_speech && st->bwidth != SWB && st->GSC_IVAS_mode == 0 ) -#endif { st->BER_detect = 1; st->GSC_noisy_speech = 0; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 8f750fa819..0ba001d415 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -3090,19 +3090,13 @@ static void ivas_param_mc_bs_decode_parameter_values( int16_t i, j, k; float dequant_seq[PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE]; float dequant_ordered[PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE]; -#ifdef FIX_578_PARAMMC_ILD_BS int16_t n_lfe_idx; -#endif range_coding = bit_buffer[( *bit_pos )++]; /* Decoding the sequence */ -#ifdef FIX_578_PARAMMC_ILD_BS n_lfe_idx = map_size - map_size_wo_lfe; sz_seq = num_param_bands * ( map_size_wo_lfe ) + num_lfe_bands * n_lfe_idx; -#else - sz_seq = num_param_bands * ( map_size_wo_lfe ) + num_lfe_bands; -#endif set_s( idx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); set_zero( dequant_ordered, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); @@ -3163,14 +3157,10 @@ static void ivas_param_mc_bs_decode_parameter_values( for ( i = 0; i < num_lfe_bands; i++ ) { -#ifdef FIX_578_PARAMMC_ILD_BS for ( j = 0; j < n_lfe_idx; j++ ) { dequant_ordered[map_size - n_lfe_idx + j + i * map_size] = dequant_seq[k++]; } -#else - dequant_ordered[map_size - 1 + i * map_size] = dequant_seq[k++]; -#endif } if ( !( *BER_detect ) ) diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index ec4cae5845..a30ae27740 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -164,20 +164,6 @@ void ivas_decision_matrix_enc( /* select TCX core or HQ core using bits_frame_nominal to match the TCX configuration bitrate */ st->core = mdct_classifier( st, fft_buff, enerBuffer, st->bits_frame_nominal * FRAMES_PER_SEC ); } - -#ifndef FIX_TCX_LOWRATE_LIMITATION - /* Warning: TCX not available at low bitrates -> replace it by GSC */ - if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) - { - st->core = ACELP_CORE; - st->coder_type = AUDIO; - st->sp_aud_decision2 = 0; - if ( st->low_rate_mode ) - { - st->coder_type = INACTIVE; - } - } -#endif } /* do not allow TD stereo ACELP core -> DFT stereo TCX core switching as it is on the WC complexity path */ @@ -223,24 +209,8 @@ void ivas_decision_matrix_enc( st->core = HQ_CORE; } } - -#ifndef FIX_TCX_LOWRATE_LIMITATION - /* TCX not available at low bitrates -> replace it by GSC */ - if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) - { - st->core = ACELP_CORE; - st->coder_type = AUDIO; - st->sp_aud_decision2 = 0; - - if ( st->low_rate_mode ) - { - st->coder_type = INACTIVE; - } - } -#endif #endif -#ifdef FIX_TCX_LOWRATE_LIMITATION /* TCX not available at low bitrates -> replace it by GSC */ if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) { @@ -253,7 +223,6 @@ void ivas_decision_matrix_enc( st->coder_type = INACTIVE; } } -#endif /*---------------------------------------------------------------------* * Select ACELP and GSC extension layer diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 95bb61c12d..248cae9e4d 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -1734,7 +1734,6 @@ static void ivas_param_mc_encode_parameter( if ( hMetadataPMC->bAttackPresent || hMetadataPMC->param_frame_idx == hMetadataPMC->coding_band_mapping[i] ) { /* LFE ICC/ILDs are always the last ones in coding band 0 */ -#ifdef FIX_578_PARAMMC_ILD_BS int16_t n_lfe_idx, k; n_lfe_idx = map_size - map_size_wo_lfe; for ( k = 0; k < n_lfe_idx; k++ ) @@ -1745,13 +1744,6 @@ static void ivas_param_mc_encode_parameter( idx_prev = idx; sz_seq++; } -#else - idx = quant_idx[( i + 1 ) * map_size - 1]; - seq[sz_seq] = idx; - seq_delta[sz_seq] = idx - idx_prev + idx_offset; - idx_prev = idx; - sz_seq++; -#endif } } } diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index 5d672616fc..cedccea00e 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -107,10 +107,7 @@ int16_t select_stereo_mode( /* set binary flag indicating LRTD mode based on unclr/xtalk classifiers' decisions */ hStereoClassif->prev_lrtd_mode = hStereoClassif->lrtd_mode; -#ifdef FIX_UNCLR_ISSUE - hStereoClassif->unclr_decision = ( hStereoClassif->unclr_decision && hCPE->hCoreCoder[0]->flag_noisy_speech_snr == 0 && - hCPE->element_brate > IVAS_16k4 ); -#endif + hStereoClassif->unclr_decision = ( hStereoClassif->unclr_decision && hCPE->hCoreCoder[0]->flag_noisy_speech_snr == 0 && hCPE->element_brate > IVAS_16k4 ); hStereoClassif->lrtd_mode = ( ( hStereoClassif->unclr_decision | hStereoClassif->xtalk_decision ) && is_speech ); stereo_switching_flag = 1; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index fc7f3b8f9a..be161c50e9 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -307,21 +307,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; c_indx++; } -#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT -#ifdef FIX_550_FIRST_FRAME_ACCESS - if ( ivas_format == ISM_FORMAT ) - { - if ( hIsmMetaData[nS]->non_diegetic_flag ) - { - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); - } - else - { - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - } - } -#endif -#endif } for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) @@ -348,7 +333,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( return error; } -#ifdef FIX_550_FIRST_FRAME_ACCESS /* Advance subframe pointer */ c_indx = 0; for ( nS = 0; nS < num_src; nS++ ) @@ -359,7 +343,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( c_indx++; } } -#endif } if ( hReverb != NULL ) @@ -396,9 +379,6 @@ ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; -#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT - float pan_left, pan_right; -#endif int16_t subframe_update_flag; subframe_update_flag = subframe_idx == ism_md_subframe_update; @@ -434,21 +414,6 @@ ivas_error TDREND_GetMix( { error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); } - -#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT - if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ) ) - { - pan_left = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; - pan_right = 1.f - pan_left; -#ifdef FIX_550_FIRST_FRAME_ACCESS - v_multc_acc( Src_p->InputFrame_p, pan_left, output_buf[0], subframe_length ); - v_multc_acc( Src_p->InputFrame_p, pan_right, output_buf[1], subframe_length ); -#else - v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_left, output_buf[0], subframe_length ); - v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_right, output_buf[1], subframe_length ); -#endif - } -#endif } /* Populate output variable */ @@ -529,24 +494,13 @@ void TDREND_Update_object_positions( Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; Pos[2] = 0; TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); -#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT hBinRendererTd->Sources[nS]->SrcSpatial_p->PosType = TDREND_POSTYPE_NON_DIEGETIC; -#else -#ifndef FIX_550_FIRST_FRAME_ACCESS - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); -#endif -#endif } else { -#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT hBinRendererTd->Sources[nS]->SrcSpatial_p->PosType = TDREND_POSTYPE_ABSOLUTE; -#else -#ifndef FIX_550_FIRST_FRAME_ACCESS - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); -#endif -#endif } + TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); } } diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 8fb081da22..c73b28a531 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -79,11 +79,6 @@ ivas_error TDREND_REND_RenderSourceHRFilt( v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); v_add( RightOutputFrame, output_buf[1], output_buf[1], subframe_length ); -#ifndef FIX_550_FIRST_FRAME_ACCESS - Src_p->InputFrame_p += subframe_length; /* Increment input pointer */ -#endif - - return IVAS_ERR_OK; } @@ -99,24 +94,18 @@ void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ float Azim, /* i : Azimuth, degrees */ -#ifdef FIX_569_TD_FILTER_LENGTH - const int16_t filterlength, /* i : Filter length */ -#endif - float *hrf_left, /* o : Left HR filter */ - float *hrf_right, /* o : Right HR filter */ - int16_t *itd /* o : ITD value */ + const int16_t filterlength, /* i : Filter length */ + float *hrf_left, /* o : Left HR filter */ + float *hrf_right, /* o : Right HR filter */ + int16_t *itd /* o : ITD value */ ) { GenerateFilter( Elev, Azim, &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); -#ifdef FIX_569_TD_FILTER_LENGTH mvr2r( HrFiltSet_p->ModelEval.hrfModL, hrf_left, filterlength ); mvr2r( HrFiltSet_p->ModelEval.hrfModR, hrf_right, filterlength ); -#else - mvr2r( HrFiltSet_p->ModelEval.hrfModL, hrf_left, HrFiltSet_p->ModelParams.K ); - mvr2r( HrFiltSet_p->ModelEval.hrfModR, hrf_right, HrFiltSet_p->ModelParams.K ); -#endif + /* 4. Evaluate the ITD */ if ( HrFiltSet_p->ModelParams.UseItdModel ) { diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index e218002345..60a66b168c 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -309,17 +309,12 @@ ivas_error TDREND_MIX_AddSrc( } else { -#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT if ( ( PosType < TDREND_POSTYPE_ABSOLUTE ) || ( PosType > TDREND_POSTYPE_NON_DIEGETIC ) ) -#else - if ( ( PosType < TDREND_POSTYPE_ABSOLUTE ) || ( PosType > TDREND_POSTYPE_RELATIVE_TO_LISTENER ) ) -#endif { return ( IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid position type!\n" ) ); } else { - /* Alloc and init a complete source: signal+spatial+rend components */ if ( ( error = TDREND_SRC_Alloc( &Src_p ) ) != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 72fc1b4da4..50d68e8944 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -218,11 +218,8 @@ static void TDREND_SRC_REND_Init( /* Internal state */ SrcRend_p->InputAvailable = FALSE; -#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT SrcRend_p->PlayStatus = TDREND_PLAYSTATUS_PLAYING; -#else - SrcRend_p->PlayStatus = TDREND_PLAYSTATUS_INITIAL; -#endif + /* SrcGain */ for ( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { @@ -279,132 +276,101 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( Listener_p = hBinRendererTd->Listener_p; HrFiltSet_p = hBinRendererTd->HrFiltSet_p; -#ifdef FIX_569_TD_FILTER_LENGTH *filterlength = min( HrFiltSet_p->FiltLength, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); -#else - *filterlength = HrFiltSet_p->FiltLength; -#endif -#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT - /* 1. Map source pos to the coordinate system of the listener */ - switch ( SrcSpatial_p->PosType ) - { - case TDREND_POSTYPE_RELATIVE_TO_LISTENER: - /* Listener relative position */ - mvr2r( SrcSpatial_p->Pos_p, ListRelPos, 3 ); - break; - case TDREND_POSTYPE_ABSOLUTE: - /* Absolute position */ - TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); - break; - default: /* Illegal position type */ -#ifdef DEBUGGING - printf( "Warning! TDREND_SRC_REND_UpdateFiltersFromSpatialParams: Invalid position type. Assuming absolute position!\n" ); -#endif - /* Assume absolute position */ - TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); - break; - } -#else if ( SrcSpatial_p->PosType == TDREND_POSTYPE_ABSOLUTE ) { /* Absolute position */ TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); -#endif - ListRelDist = TDREND_SPATIAL_VecNorm( ListRelPos ); + ListRelDist = TDREND_SPATIAL_VecNorm( ListRelPos ); - /* 2. Evaluate the Elevation and Azimuth angles */ - if ( ( ListRelPos[0] == 0 ) && ( ListRelPos[1] == 0 ) && ( ListRelPos[2] == 0 ) ) - { - Elev = 0.0; - Azim = 0.0; - } - else - { - Elev = _180_OVER_PI * atan2f( ListRelPos[2], sqrtf( ListRelPos[0] * ListRelPos[0] + ListRelPos[1] * ListRelPos[1] ) ); - /* Basis set is [front, right, up], which is a left-handed coordinate system. Minus sign here is to change to a positive-left system for azimuth */ - Azim = -1.0f * _180_OVER_PI * (float) atan2f( ListRelPos[1], ListRelPos[0] ); - } + /* 2. Evaluate the Elevation and Azimuth angles */ + if ( ( ListRelPos[0] == 0 ) && ( ListRelPos[1] == 0 ) && ( ListRelPos[2] == 0 ) ) + { + Elev = 0.0; + Azim = 0.0; + } + else + { + Elev = _180_OVER_PI * atan2f( ListRelPos[2], sqrtf( ListRelPos[0] * ListRelPos[0] + ListRelPos[1] * ListRelPos[1] ) ); + /* Basis set is [front, right, up], which is a left-handed coordinate system. Minus sign here is to change to a positive-left system for azimuth */ + Azim = -1.0f * _180_OVER_PI * (float) atan2f( ListRelPos[1], ListRelPos[0] ); + } -#ifdef FIX_569_TD_FILTER_LENGTH - GetFilterFromAngle( HrFiltSet_p, Elev, Azim, *filterlength, hrf_left, hrf_right, itd ); -#else - GetFilterFromAngle( HrFiltSet_p, Elev, Azim, hrf_left, hrf_right, itd ); -#endif + GetFilterFromAngle( HrFiltSet_p, Elev, Azim, *filterlength, hrf_left, hrf_right, itd ); - /* 6. Evaluate the directional and distance gains */ - /* Directional gain */ - *SrcRend_p->DirGain_p = 1.0f; - if ( SrcSpatial_p->DirAttenEnabled ) - { - *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs ); - } + /* 6. Evaluate the directional and distance gains */ + /* Directional gain */ + *SrcRend_p->DirGain_p = 1.0f; + if ( SrcSpatial_p->DirAttenEnabled ) + { + *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs ); + } - /* Distance gain */ - *SrcRend_p->DistGain_p = 1.0f; - if ( hBinRendererTd->UseCommonDistAttenModel ) - { - if ( hBinRendererTd->DistAttenEnabled ) + /* Distance gain */ + *SrcRend_p->DistGain_p = 1.0f; + if ( hBinRendererTd->UseCommonDistAttenModel ) { - SrcSpatial_p->DistAtten.DistAttenModel = hBinRendererTd->DistAttenModel; - *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); + if ( hBinRendererTd->DistAttenEnabled ) + { + SrcSpatial_p->DistAtten.DistAttenModel = hBinRendererTd->DistAttenModel; + *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); + } } - } - else - { - if ( SrcSpatial_p->DistAttenEnabled ) + else { - *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); + if ( SrcSpatial_p->DistAttenEnabled ) + { + *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); + } } - } - /* Update total gains */ - *Gain = ( *SrcRend_p->SrcGain_p ) * ( *SrcRend_p->DirGain_p ) * ( *SrcRend_p->DistGain_p ) * hBinRendererTd->Gain; + /* Update total gains */ + *Gain = ( *SrcRend_p->SrcGain_p ) * ( *SrcRend_p->DirGain_p ) * ( *SrcRend_p->DistGain_p ) * hBinRendererTd->Gain; - /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ - elev_delta = Elev - Src_p->elev_prev; - azim_delta = Azim - Src_p->azim_prev; - Src_p->elev_prev = Elev; - Src_p->azim_prev = Azim; + /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ + elev_delta = Elev - Src_p->elev_prev; + azim_delta = Azim - Src_p->azim_prev; + Src_p->elev_prev = Elev; + Src_p->azim_prev = Azim; - azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ - *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); -#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT -} -else /* TDREND_POSTYPE_NON_DIEGETIC */ -{ - *itd = 0; - *Gain = 1.0f; - set_f( hrf_left, 0.0f, *filterlength ); - set_f( hrf_right, 0.0f, *filterlength ); - hrf_left[0] = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; - hrf_right[0] = 1.f - hrf_left[0]; - *intp_count = MAX_INTERPOLATION_STEPS; - Src_p->elev_prev = 0; - Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ -} -#endif + azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ + *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); + } + else /* TDREND_POSTYPE_NON_DIEGETIC */ + { + *itd = 0; + *Gain = 1.0f; + set_f( hrf_left, 0.0f, *filterlength ); + set_f( hrf_right, 0.0f, *filterlength ); + hrf_left[0] = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; + hrf_right[0] = 1.f - hrf_left[0]; + *intp_count = MAX_INTERPOLATION_STEPS; + Src_p->elev_prev = 0; + Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ + } -if ( ( *intp_count > 0 ) && subframe_update_flag ) -{ - /* Set deltas for interpolation */ - v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); - v_multc( hrf_left_delta, 1.0f / *intp_count, hrf_left_delta, *filterlength ); - v_sub( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); - v_multc( hrf_right_delta, 1.0f / *intp_count, hrf_right_delta, *filterlength ); -} -else -{ - /* No interpolation, just set the new filters and reset deltas */ - mvr2r( hrf_left, hrf_left_prev, *filterlength ); - mvr2r( hrf_right, hrf_right_prev, *filterlength ); - set_f( hrf_left_delta, 0.0f, *filterlength ); - set_f( hrf_right_delta, 0.0f, *filterlength ); -} -return; + if ( ( *intp_count > 0 ) && subframe_update_flag ) + { + /* Set deltas for interpolation */ + v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); + v_multc( hrf_left_delta, 1.0f / *intp_count, hrf_left_delta, *filterlength ); + v_sub( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); + v_multc( hrf_right_delta, 1.0f / *intp_count, hrf_right_delta, *filterlength ); + } + else + { + /* No interpolation, just set the new filters and reset deltas */ + mvr2r( hrf_left, hrf_left_prev, *filterlength ); + mvr2r( hrf_right, hrf_right_prev, *filterlength ); + set_f( hrf_left_delta, 0.0f, *filterlength ); + set_f( hrf_right_delta, 0.0f, *filterlength ); + } + + return; } @@ -709,11 +675,8 @@ void TDREND_SRC_Init( /* Reset memory buffers */ Src_p->itd = 0; Src_p->previtd = 0; -#ifdef FIX_550_FIRST_FRAME_ACCESS Src_p->filterlength = 1; /* Init to unit impulse of length 1 */ -#else - Src_p->filterlength = -1; -#endif + set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); @@ -724,9 +687,7 @@ void TDREND_SRC_Init( Src_p->hrf_right_prev[0] = 1; Src_p->azim_prev = 0.0f; Src_p->elev_prev = 0.0f; -#ifdef FIX_550_FIRST_FRAME_ACCESS Src_p->Gain = 1; -#endif Src_p->prevGain = 1.0f; return; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index b6045045a8..f12c4597c8 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -647,9 +647,7 @@ void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ float Azim, /* i : Azimuth, degrees */ -#ifdef FIX_569_TD_FILTER_LENGTH const int16_t filterlength, /* i : Filter length */ -#endif float *LeftFilter, /* o : Left HR filter */ float *RightFilter, /* o : Right HR filter */ int16_t *itd /* o : ITD value */ -- GitLab From bc344f842cafcd5a273f40de438fe59c73ccc66c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 20:32:40 +0200 Subject: [PATCH 521/591] revert unintentional changes in scripts --- .gitlab-ci.yml | 354 +----------------- Makefile | 2 +- tests/codec_be_on_mr_selection/__init__.py | 29 +- .../test_experiments.py | 6 + tests/conftest.py | 12 + tests/testconfig.py | 2 + 6 files changed, 47 insertions(+), 358 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4ea77138a..881da24acb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -281,11 +281,13 @@ build-codec-instrumented-linux: # make sure that the codec builds with msan, asan and usan build-codec-sanitizers-linux: extends: - - .build-job-linux + - .build-job-with-check-for-warnings - .rules-basis script: - *print-common-info - bash ci/build_codec_sanitizers_linux.sh + # need to use the "|| exit $?" suffix to get the allowed_failure return code, otherwise the job fails with code 1...< + - ci/check_for_warnings.py $BUILD_OUTPUT || exit $? build-codec-windows-cmake: extends: @@ -696,286 +698,6 @@ evs-pytest-on-merge-request: script: - *print-common-info - *merge-request-comparison-setup-codec - - # some helper variables - "|| true" to prevent failures from grep not finding anything - - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[evs[ -]*non[ -]*be\]") || true - - ref_using_main=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[ref[ -]*using[ -]*main\]") || true - - ### If ref_using_main is not set, checkoug the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi - - ### prepare pytest - # create references - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm - - ### Run test using branch scripts and input - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi - - ### run pytest for EVS cases - - exit_code=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_evs.prm --html=report.html --self-contained-html --junit-xml=report-junit-evs.xml || exit_code=$? - - zero_errors=$(cat report-junit-evs.xml | grep -c 'errors="0"') || true - - - *merge-request-comparison-check - - allow_failure: - exit_codes: - - 123 - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" - expire_in: 1 week - when: always - paths: - - report-junit-evs.xml - - report.html - expose_as: "pytest evs results" - reports: - junit: - - report-junit-evs.xml - -voip-be-on-merge-request: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - stage: compare # Or should it be test? Comparison is done within one git revision - needs: ["build-codec-linux-make", codec-smoke-test] - timeout: "10 minutes" - script: - - *print-common-info - - bash ci/ivas_voip_be_test.sh - -clang-format-check: - extends: - - .test-job-linux - - .rules-merge-request - variables: - ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix" - stage: validate - needs: [] - timeout: "5 minutes" - script: - # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there - - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch - - > - INSTRUCTIONS_GITLAB="To fix formatting issues:\n - - download the diff patch available as artifact of this job\n - - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n - - run: git apply $PATCH_FILE_NAME\n - - commit new changes" - - > - INSTRUCTIONS_README="To fix formatting issues:\n - - place the patch file in the root directory of your local IVAS repo\n - - run: git apply $PATCH_FILE_NAME\n - - commit new changes" - - - scripts/check-format.sh -af -p 8 || format_problems=$? - - if [ $format_problems == 0 ] ; then exit 0; fi - - - mkdir tmp-formatting-fix - - git diff > "tmp-formatting-fix/$PATCH_FILE_NAME" - - # Print instructions to job output - - echo -e "$INSTRUCTIONS_GITLAB" - - # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) - - echo -e "$INSTRUCTIONS_README" > "tmp-formatting-fix/readme.txt" - - - exit $format_problems - artifacts: - expire_in: 1 day - paths: - - tmp-formatting-fix/ - when: on_failure - name: "$ARTIFACT_BASE_NAME" - expose_as: 'formatting patch' - -# check for crashes if first received frame on decoder side is an SID -check-first-frame-is-sid: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - tags: - - ivas-linux - stage: test - # needs: ["build-codec-linux-cmake"] - script: - - *print-common-info - - *update-ltv-repo - - *check-for-testvectors - - cmake . - - make -j - - # TODO: for some MASA modes, we currently do not have testvectors that actually trigger DTX - # SBA is run separately to use shorter part of file - - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep -v MASA | grep -v SBA) - - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500 -U 0:20 || exit_code_no_sba=$? - - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep SBA) - - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500 -U 70:80 || exit_code_sba=$? - - if [ $exit_code_no_sba != 0 || $exit_code_sba != 0]; then exit 1; fi - artifacts: - paths: - - out/logs - when: on_failure - name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart" - expose_as: "logs-sidstart" - expire_in: "5 days" - -selection-test-processing: - extends: - - .test-job-linux-needs-testv-dir - - .rules-merge-request - tags: - - processing-scripts-linux - stage: test - needs: ["build-codec-linux-make"] - script: - # get processing script code - - git clone https://forge.3gpp.org/rep/ivas-codec-pc/ivas-processing-scripts.git --single-branch -b main - - - mkdir -p ivas-processing-scripts/tests/data/testv - - cp -r scripts/testv/* ivas-processing-scripts/tests/data/testv/ - - # copy binaries into local bin dir, those should take precendence over PATH - - cp $PROCESSING_SCRIPTS_BIN_DIR/* ivas-processing-scripts/ivas_processing_scripts/bin/ - # for testing with native binaries - - rm ivas-processing-scripts/ivas_processing_scripts/bin/IVAS*.exe - - rm ivas-processing-scripts/ivas_processing_scripts/bin/EVS*.exe - - # build codec and put into bin dir - - make -j - - cp ./IVAS_* ivas-processing-scripts/ivas_processing_scripts/bin/ - - # patch the use_windows_codec_binaries key (weird folding is needed so colons are accepted) - - > - sed -i "s/use_windows_codec_binaries: true/use_windows_codec_binaries: false/" ivas-processing-scripts/experiments/selection/*/config/*.yml - - # run experiments test - - cd ivas-processing-scripts - - python3 -m pytest tests/test_experiments.py::test_generate_test_items -n auto | tee log.txt - artifacts: - paths: - - ivas-processing-scripts/experiments/selection/*/proc_output/*.log - - log.txt - when: on_failure - expire_in: 1 week - -lc3plus-ensure-no-code-changes: - extends: - - .test-job-linux - - .rules-merge-request - stage: validate - needs: [] - timeout: "5 minutes" - script: - # Replace code commited to repo with code downloaded from ETSI - - ./scripts/lc3plus_lib_setup/get_lc3plus.sh - - # Ensure git reports no changes - - modified_files=$(git status -s) - - if [[ $modified_files ]]; then printf 'LC3plus codebase was modified!\n\n'"$modified_files"'\n\n'; exit $EXIT_CODE_FAIL; fi - - -# --------------------------------------------------------------- -# Test jobs for main branch -# --------------------------------------------------------------- - -# check bitexactness to EVS windows binaries -be-2-evs-windows: - extends: - - .rules-main-push - tags: - - ivas-windows - stage: test - needs: ["build-codec-windows-msbuild"] - timeout: "20 minutes" # To be revisited - script: - - *print-common-info-windows - - - $winoutdata = $null - - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Release | tee -variable winoutdata - - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 - - # copy over to never change the testvector dir - - cp -r $EVS_BE_WIN_TEST_DIR ./evs_be_win_test - - cp IVAS_cod.exe ./evs_be_win_test/bin/IVAS_cod.exe - - cp IVAS_dec.exe ./evs_be_win_test/bin/IVAS_dec.exe - - - cd evs_be_win_test - - python ../ci/run_evs_be_win_test.py - -# check bitexactness to EVS -be-2-evs-linux: - extends: - - .test-job-linux - - .rules-main-push - tags: - - be-2-evs-temp - stage: test - needs: ["build-codec-linux-cmake"] - timeout: "20 minutes" # To be revisited - script: - - *print-common-info - - - mkdir build - - cd build - - cmake .. - - make -j - - cd .. - - # copy over to never change the testvector dir - - cp -r $EVS_BE_TEST_DIR ./evs_be_test - - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod - - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec - - - cd evs_be_test - - python3 ../ci/run_evs_be_test.py - -codec-comparison-on-main-push: - extends: - - .test-job-linux - - .rules-main-push - stage: compare - needs: ["build-codec-linux-cmake"] - timeout: "30 minutes" # To be revisited - script: - - *print-common-info - - latest_commit=$(git rev-parse HEAD) # Latest commit - - *get-previous-merge-commit-sha # Stored in previous_merge_commit shell variable now - - echo "Comparing changes from $previous_merge_commit to $latest_commit" - - git --no-pager diff --stat $previous_merge_commit..$latest_commit - - # Rest is more or less placeholder adapted from MR self test. This should be replaced with more complex tests. - - ### build test binaries, initial clean for paranoia reasons - - make clean - - mkdir build - - cd build - - cmake .. - - make -j - - mv IVAS_cod ../IVAS_cod_test - - mv IVAS_dec ../IVAS_dec_test - - cd .. - - rm -rf build/* - - ### compare to the previous merge commit in the main branch - - git fetch origin main - - git checkout $previous_merge_commit - - ### build reference binaries - - cd build - - cmake .. - - make -j - - mv IVAS_cod ../IVAS_cod_ref - - mv IVAS_dec ../IVAS_dec_ref - - cd .. - - # helper variable - "|| true" to prevent failures from grep not finding anything - - non_be_flag=$(echo $CI_COMMIT_MESSAGE | grep -c --ignore-case "\[non[ -]*be\]") || true - - ref_using_main=$(echo $CI_COMMIT_MESSAGE | grep -c --ignore-case "\[ref[ -]*using[ -]*main\]") || true - - ### re-checkout the latest commit in the main branch, if ref_using_main is not set - - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi - ### prepare pytest # create short test vectors - python3 tests/create_short_testvectors.py @@ -1116,76 +838,6 @@ sanitizer-test-masa: extends: .sanitizer-test-schedule-A rules: - if: $SANITIZER_SCHEDULE_A - when: delayed - start_in: 21 hours - timeout: 3 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS - -### --- sanitizer schedule B --- - -.sanitizer-test-schedule-B: - extends: - - .sanitizer-test-template - timeout: 4 hours - -sanitizer-test-mc-5_1: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 5_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS - -sanitizer-test-mc-5_1_2: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 4 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 5_1_2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS - -sanitizer-test-mc-5_1_4: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 8 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 5_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS - -sanitizer-test-mc-7_1: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 12 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 7_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS - -sanitizer-test-mc-7_1_4: - extends: .sanitizer-test-schedule-B - rules: - - if: $SANITIZER_SCHEDULE_B - when: delayed - start_in: 16 hours - script: - - *update-ltv-repo - - python3 ci/run_scheduled_sanitizer_test.py 7_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS - -### --- sanitizer schedule C --- - -.sanitizer-test-schedule-C: - extends: - - .sanitizer-test-template - timeout: 6 hours - -sanitizer-test-sba: extends: .sanitizer-test-schedule-C rules: - if: $SANITIZER_SCHEDULE_C diff --git a/Makefile b/Makefile index b63c3a6873..138a4cdaed 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ LDLIBS += -lm CCCLANG = clang ifeq "$(CLANG)" "1" CC = $(CCCLANG) -CFLAGS += -fsanitize=memory -fsanitize-memory-track-origins +CFLAGS += -fsanitize=memory LDFLAGS += -fsanitize=memory endif ifeq "$(CLANG)" "2" diff --git a/tests/codec_be_on_mr_selection/__init__.py b/tests/codec_be_on_mr_selection/__init__.py index acfa6c2336..da1d8c3578 100644 --- a/tests/codec_be_on_mr_selection/__init__.py +++ b/tests/codec_be_on_mr_selection/__init__.py @@ -35,6 +35,7 @@ import filecmp from pathlib import Path import subprocess from .constants import OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT, DTX_ON, FER_5PERC +from ..testconfig import MD5_REF_DICT HERE = Path(__file__).parent # set environment variables in CI job @@ -98,8 +99,20 @@ def apply_error_pattern_on_bitstream( subprocess.run(cmd) -def files_equal(dut_file, ref_file): - return filecmp.cmp(dut_file, ref_file) +def is_be_to_ref(dut_file): + """ + Check bitexactness either by comparing files directly or by comparing MD5 sums + """ + if MD5_REF_DICT == dict(): + ref_file = REF_PATH.joinpath(dut_file.name) + is_be = filecmp.cmp(dut_file, ref_file) + else: + md5_ref = MD5_REF_DICT[dut_file.name] + cmd = f"powershell.exe (Get-FileHash {str(dut_file)} -Algorithm MD5).Hash" + md5_dut = subprocess.check_output(cmd, shell=True).decode().splitlines()[-1] + is_be = md5_ref == md5_dut + + return is_be def run_check( @@ -113,6 +126,7 @@ def run_check( decoder_frontend, is_ref_creation, input_file_num=None, + keep_files=True, ): sampling_rate = 48 output_mode, options = OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT[experiment] @@ -168,12 +182,15 @@ def run_check( # this should not be a problem as both the reference and the tdut output was generated by the codec, so # diverging headers should also indicate a problem - still, keep in mind if something bogus happens if not is_ref_creation: - ref_output = REF_PATH.joinpath(dut_output.name) - if not files_equal(dut_output, ref_output): + if not is_be_to_ref(dut_output): pytest.fail("Decoder output differs from reference") + elif not keep_files: + os.remove(dut_output) + os.remove(dut_bitstream) for md in metadata: md_suffix = "".join(md.suffixes) dut_md = DUT_PATH.joinpath(dut_output.with_suffix(md_suffix).name) - ref_md = REF_PATH.joinpath(dut_output.with_suffix(md_suffix).name) - if not files_equal(dut_md, ref_md): + if not is_be_to_ref(dut_md): pytest.fail("Metadata file {md.name} differs from reference") + elif not keep_files: + os.remove(dut_md) diff --git a/tests/codec_be_on_mr_selection/test_experiments.py b/tests/codec_be_on_mr_selection/test_experiments.py index a0a4aa780a..5b2f516893 100644 --- a/tests/codec_be_on_mr_selection/test_experiments.py +++ b/tests/codec_be_on_mr_selection/test_experiments.py @@ -52,6 +52,7 @@ def test_p800( dut_encoder_frontend, dut_decoder_frontend, update_ref, + keep_files, ): run_check( experiment, @@ -63,6 +64,7 @@ def test_p800( dut_encoder_frontend, dut_decoder_frontend, update_ref == 1, + keep_files=keep_files, ) @@ -79,6 +81,7 @@ def test_bs1534_no_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref, + keep_files, ): category = "" run_check( @@ -92,6 +95,7 @@ def test_bs1534_no_masa( dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, + keep_files=keep_files, ) @@ -111,6 +115,7 @@ def test_bs1534_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref, + keep_files, ): run_check( experiment, @@ -123,4 +128,5 @@ def test_bs1534_masa( dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, + keep_files=keep_files, ) diff --git a/tests/conftest.py b/tests/conftest.py index 12b62caccd..e4de453b0e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -133,6 +133,12 @@ def pytest_addoption(parser): " Use --keep_files to prevent these deletions.", ) + parser.addoption( + "--selection_be_md5_file", + type=Path, + help="Path to file with md5 sums for the reference signals of the selection-BE test" + ) + @pytest.fixture(scope="session", autouse=True) def update_ref(request): @@ -513,3 +519,9 @@ def pytest_configure(config): ) if config.option.param_file: testconfig.PARAM_FILE = config.option.param_file + if config.option.selection_be_md5_file: + md5_file_path = config.option.selection_be_md5_file + if not platform.system() == "Windows": + raise NotImplementedError("MD5 comparison is currently hardcoded for windows") + with open(md5_file_path) as f: + testconfig.MD5_REF_DICT = {line.split()[0]: line.split()[1] for line in f.readlines()} diff --git a/tests/testconfig.py b/tests/testconfig.py index 12d170ba8d..404073b08e 100644 --- a/tests/testconfig.py +++ b/tests/testconfig.py @@ -35,3 +35,5 @@ To configure test modules. """ PARAM_FILE = "scripts/config/self_test.prm" + +MD5_REF_DICT = dict() -- GitLab From cfc64ddf603cb3329707309279c90d687caaac5a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 20:42:43 +0200 Subject: [PATCH 522/591] revert unintentional changes in scripts --- .gitlab-ci.yml | 350 ++++++++++++++++++++++++++++++ scripts/config/self_test.prm | 409 ++--------------------------------- tests/testconfig.py | 2 +- 3 files changed, 372 insertions(+), 389 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 881da24acb..cc24ab729e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -698,6 +698,286 @@ evs-pytest-on-merge-request: script: - *print-common-info - *merge-request-comparison-setup-codec + + # some helper variables - "|| true" to prevent failures from grep not finding anything + - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[evs[ -]*non[ -]*be\]") || true + - ref_using_main=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[ref[ -]*using[ -]*main\]") || true + + ### If ref_using_main is not set, checkoug the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + + ### prepare pytest + # create references + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm + + ### Run test using branch scripts and input + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + ### run pytest for EVS cases + - exit_code=0 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_evs.prm --html=report.html --self-contained-html --junit-xml=report-junit-evs.xml || exit_code=$? + - zero_errors=$(cat report-junit-evs.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit-evs.xml + - report.html + expose_as: "pytest evs results" + reports: + junit: + - report-junit-evs.xml + +voip-be-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + stage: compare # Or should it be test? Comparison is done within one git revision + needs: ["build-codec-linux-make", codec-smoke-test] + timeout: "10 minutes" + script: + - *print-common-info + - bash ci/ivas_voip_be_test.sh + +clang-format-check: + extends: + - .test-job-linux + - .rules-merge-request + variables: + ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix" + stage: validate + needs: [] + timeout: "5 minutes" + script: + # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there + - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch + - > + INSTRUCTIONS_GITLAB="To fix formatting issues:\n + - download the diff patch available as artifact of this job\n + - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n + - run: git apply $PATCH_FILE_NAME\n + - commit new changes" + - > + INSTRUCTIONS_README="To fix formatting issues:\n + - place the patch file in the root directory of your local IVAS repo\n + - run: git apply $PATCH_FILE_NAME\n + - commit new changes" + + - scripts/check-format.sh -af -p 8 || format_problems=$? + - if [ $format_problems == 0 ] ; then exit 0; fi + + - mkdir tmp-formatting-fix + - git diff > "tmp-formatting-fix/$PATCH_FILE_NAME" + + # Print instructions to job output + - echo -e "$INSTRUCTIONS_GITLAB" + + # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) + - echo -e "$INSTRUCTIONS_README" > "tmp-formatting-fix/readme.txt" + + - exit $format_problems + artifacts: + expire_in: 1 day + paths: + - tmp-formatting-fix/ + when: on_failure + name: "$ARTIFACT_BASE_NAME" + expose_as: 'formatting patch' + +# check for crashes if first received frame on decoder side is an SID +check-first-frame-is-sid: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + tags: + - ivas-linux + stage: test + # needs: ["build-codec-linux-cmake"] + script: + - *print-common-info + - *update-ltv-repo + - *check-for-testvectors + - cmake . + - make -j + + # TODO: for some MASA modes, we currently do not have testvectors that actually trigger DTX + # SBA is run separately to use shorter part of file + - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep -v MASA | grep -v SBA) + - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500 -U 0:20 || exit_code_no_sba=$? + - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep SBA) + - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500 -U 70:80 || exit_code_sba=$? + - if [ $exit_code_no_sba != 0 || $exit_code_sba != 0]; then exit 1; fi + artifacts: + paths: + - out/logs + when: on_failure + name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart" + expose_as: "logs-sidstart" + expire_in: "5 days" + +selection-test-processing: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + tags: + - processing-scripts-linux + stage: test + needs: ["build-codec-linux-make"] + script: + # get processing script code + - git clone https://forge.3gpp.org/rep/ivas-codec-pc/ivas-processing-scripts.git --single-branch -b main + + - mkdir -p ivas-processing-scripts/tests/data/testv + - cp -r scripts/testv/* ivas-processing-scripts/tests/data/testv/ + + # copy binaries into local bin dir, those should take precendence over PATH + - cp $PROCESSING_SCRIPTS_BIN_DIR/* ivas-processing-scripts/ivas_processing_scripts/bin/ + # for testing with native binaries + - rm ivas-processing-scripts/ivas_processing_scripts/bin/IVAS*.exe + - rm ivas-processing-scripts/ivas_processing_scripts/bin/EVS*.exe + + # build codec and put into bin dir + - make -j + - cp ./IVAS_* ivas-processing-scripts/ivas_processing_scripts/bin/ + + # patch the use_windows_codec_binaries key (weird folding is needed so colons are accepted) + - > + sed -i "s/use_windows_codec_binaries: true/use_windows_codec_binaries: false/" ivas-processing-scripts/experiments/selection/*/config/*.yml + + # run experiments test + - cd ivas-processing-scripts + - python3 -m pytest tests/test_experiments.py::test_generate_test_items -n auto | tee log.txt + artifacts: + paths: + - ivas-processing-scripts/experiments/selection/*/proc_output/*.log + - log.txt + when: on_failure + expire_in: 1 week + +lc3plus-ensure-no-code-changes: + extends: + - .test-job-linux + - .rules-merge-request + stage: validate + needs: [] + timeout: "5 minutes" + script: + # Replace code commited to repo with code downloaded from ETSI + - ./scripts/lc3plus_lib_setup/get_lc3plus.sh + + # Ensure git reports no changes + - modified_files=$(git status -s) + - if [[ $modified_files ]]; then printf 'LC3plus codebase was modified!\n\n'"$modified_files"'\n\n'; exit $EXIT_CODE_FAIL; fi + + +# --------------------------------------------------------------- +# Test jobs for main branch +# --------------------------------------------------------------- + +# check bitexactness to EVS windows binaries +be-2-evs-windows: + extends: + - .rules-main-push + tags: + - ivas-windows + stage: test + needs: ["build-codec-windows-msbuild"] + timeout: "20 minutes" # To be revisited + script: + - *print-common-info-windows + + - $winoutdata = $null + - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Release | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 + + # copy over to never change the testvector dir + - cp -r $EVS_BE_WIN_TEST_DIR ./evs_be_win_test + - cp IVAS_cod.exe ./evs_be_win_test/bin/IVAS_cod.exe + - cp IVAS_dec.exe ./evs_be_win_test/bin/IVAS_dec.exe + + - cd evs_be_win_test + - python ../ci/run_evs_be_win_test.py + +# check bitexactness to EVS +be-2-evs-linux: + extends: + - .test-job-linux + - .rules-main-push + tags: + - be-2-evs-temp + stage: test + needs: ["build-codec-linux-cmake"] + timeout: "20 minutes" # To be revisited + script: + - *print-common-info + + - mkdir build + - cd build + - cmake .. + - make -j + - cd .. + + # copy over to never change the testvector dir + - cp -r $EVS_BE_TEST_DIR ./evs_be_test + - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod + - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec + + - cd evs_be_test + - python3 ../ci/run_evs_be_test.py + +codec-comparison-on-main-push: + extends: + - .test-job-linux + - .rules-main-push + stage: compare + needs: ["build-codec-linux-cmake"] + timeout: "30 minutes" # To be revisited + script: + - *print-common-info + - latest_commit=$(git rev-parse HEAD) # Latest commit + - *get-previous-merge-commit-sha # Stored in previous_merge_commit shell variable now + - echo "Comparing changes from $previous_merge_commit to $latest_commit" + - git --no-pager diff --stat $previous_merge_commit..$latest_commit + + # Rest is more or less placeholder adapted from MR self test. This should be replaced with more complex tests. + + ### build test binaries, initial clean for paranoia reasons + - make clean + - mkdir build + - cd build + - cmake .. + - make -j + - mv IVAS_cod ../IVAS_cod_test + - mv IVAS_dec ../IVAS_dec_test + - cd .. + - rm -rf build/* + + ### compare to the previous merge commit in the main branch + - git fetch origin main + - git checkout $previous_merge_commit + + ### build reference binaries + - cd build + - cmake .. + - make -j + - mv IVAS_cod ../IVAS_cod_ref + - mv IVAS_dec ../IVAS_dec_ref + - cd .. + + # helper variable - "|| true" to prevent failures from grep not finding anything + - non_be_flag=$(echo $CI_COMMIT_MESSAGE | grep -c --ignore-case "\[non[ -]*be\]") || true + - ref_using_main=$(echo $CI_COMMIT_MESSAGE | grep -c --ignore-case "\[ref[ -]*using[ -]*main\]") || true + + ### re-checkout the latest commit in the main branch, if ref_using_main is not set + - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi + ### prepare pytest # create short test vectors - python3 tests/create_short_testvectors.py @@ -838,6 +1118,76 @@ sanitizer-test-masa: extends: .sanitizer-test-schedule-A rules: - if: $SANITIZER_SCHEDULE_A + when: delayed + start_in: 21 hours + timeout: 3 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS + +### --- sanitizer schedule B --- + +.sanitizer-test-schedule-B: + extends: + - .sanitizer-test-template + timeout: 4 hours + +sanitizer-test-mc-5_1: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 5_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS + +sanitizer-test-mc-5_1_2: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 4 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 5_1_2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS + +sanitizer-test-mc-5_1_4: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 8 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 5_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS + +sanitizer-test-mc-7_1: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 12 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 7_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS + +sanitizer-test-mc-7_1_4: + extends: .sanitizer-test-schedule-B + rules: + - if: $SANITIZER_SCHEDULE_B + when: delayed + start_in: 16 hours + script: + - *update-ltv-repo + - python3 ci/run_scheduled_sanitizer_test.py 7_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS + +### --- sanitizer schedule C --- + +.sanitizer-test-schedule-C: + extends: + - .sanitizer-test-template + timeout: 6 hours + +sanitizer-test-sba: extends: .sanitizer-test-schedule-C rules: - if: $SANITIZER_SCHEDULE_C diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index a4e3fd041f..aff7ebcc99 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -418,286 +418,6 @@ ../IVAS_dec -fec 5 BINAURAL_ROOM_IR 48 bit testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FEC5.tst // 4 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit -../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst - -// 4 ISM with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit -../IVAS_dec HOA2 48 bit testv/stv4ISM48s.wav_80000_48-48_HOA2.tst - -// 4 ISM with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit -../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.wav_96000_48-48_MC_custom_setup.tst - -// 4 ISM with metadata at 96 kbps, 48 kHz in, 48 kHz out, EXT out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit -../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_96000_48-48_EXT.tst - -// 4 ISM with metadata at 128 kbps, 48 kHz in, 48 kHz out, EXT out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 128000 48 testv/stv4ISM48s.wav bit -../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_128000_48-48_EXT.tst - -// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, EXT out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_256000_48-48_EXT.tst - -// 4 ISM with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit -../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_160000_48-48_STEREO.tst - -// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural.tst - -// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural_file_TDHR.tst - -// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, external orientation -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -t testv/headrot_case03_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural_file_TDHR_EXOF.tst - -// 4 ISM with metadata at 512 kbps, 48 kHz in, 48 kHz out, 5_1 -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stv4ISM48s.wav bit -../IVAS_dec 5_1 48 bit testv/stv4ISM48s.wav_512000_48-48_5_1.tst - -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst - -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, external orientation, Orientation tracking -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_EXOF_OtrAvg.tst - -// 4 ISM with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, EXT out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit -../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_EXT.tst - -// 4 ISm with and without metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, HOA3 out -../IVAS_cod -dtx -ism 4 testv/stvISM1.csv NULL NULL testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit -../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst - -// 4 ISM with extended metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, directivity configuration, random FEC at 5% -../IVAS_cod -ism +4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -fec 5 -render_config testv/config_directivity.cfg -t testv/headrot_case04_3000_q.csv BINAURAL 48 bit testv/stv+4ISM48s.wav_256000_48-48_binaural_file_TDHR_DirConfig_FEC5.tst - -// 4 ISM with extended metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, external orientation, directivity configuration, random FEC at 5% -../IVAS_cod -ism +4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec -fec 5 -render_config testv/config_directivity.cfg -t testv/headrot_case04_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv+4ISM48s.wav_256000_48-48_binaural_file_TDHR_EXOF_DirConfig_FEC5.tst - -// 4 ISM with and without extended metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, EXT out -../IVAS_cod -dtx -ism +4 testv/stvISM1.csv NULL testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit -../IVAS_dec EXT 48 bit testv/stv+4ISM48s.wav_brate_sw_48-48_DTX_EXT.tst - -// 4 ISM with extended metadata and non diegetic pan object switching bitrate 256 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out -../IVAS_cod -dtx -ism +4 testv/stvISM1.csv NULL testv/stvISM_with_no_diegetic_switch.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv+4ISM48s+non_diegetic_pan.wav_brate_256000-48_DTX_binaural.tst - - -// SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out -../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_HOA3.tst - -// SBA at 13.2 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit -../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_stereo.tst - -// SBA at 16.4 kbps, 32kHz in, 32kHz out, 7_1_4 out -../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit -../IVAS_dec 7_1_4 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_7_1_4.tst - -// SBA at 16.4 kbps, 32kHz in, 32kHz out, BINAURAL out -../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit -../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_Binaural.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_stereo.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Subframe_FEC5.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, external orientation -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot_EXOF.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, external orientation, Orientation tracking -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_EXOF_OtrAvg.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FEC5.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot.tst - -// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation, external orientation -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot_EXOF.tst - -// SBA at 32 kbps, 32kHz in, 32kHz out, FOA out -../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_FOA.tst - -// SBA at 32 kbps, 32kHz in, 32kHz out, BINAURAL out, 6% FEC pattern -../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit -../IVAS_dec -fec testv/FEC_6pct.bin BINAURAL 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_FEC6.tst - -// SBA at 32 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM out -../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_ROOM.tst - -// SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX -../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit -../IVAS_dec MONO 48 bit testv/stvFOA48c.wav_SBA_32000_48-48_DTX_MONO.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -fec 5 MONO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_MONO_FEC5.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_stereo.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Subframe.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot_EXOF.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrAvg.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking, external orientation -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPos.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode, external orientation -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPosLev.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot.tst - -// SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation, external orientation -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot_EXOF.tst - -// SBA at 48 kbps, 48kHz in, 48kHz out, 5_1_2 out -../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit -../IVAS_dec 5_1_2 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_5_1_2.tst - -// SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX, random FEC at 5% -../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit -../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.wav_SBA_64000_32-32_DTX_FOA.tst - -// SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out -../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_5_1_4.tst - -// SBA at 64 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_7_1_4.tst - -// SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL.tst - -// SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL_ROOM out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst - -// SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_HOA3.tst - -// SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_FEC5.tst - -// SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_Headrot.tst - -// SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, external orientation -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_Headrot_EXOF.tst - -// SBA at 96 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 1 96000 32 testv/stvFOA32c.wav bit -../IVAS_dec STEREO 32 bit testv/stvFOA32c.wav_SBA_96000_32-32_STEREO.tst - -// SBA at 96 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit -../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_96000_48-48_FOA.tst - -// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst - -// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot_EXOF.tst - -// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst - -// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_EXOF_OtrAvg.tst - -// SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% -../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit -../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FEC5.tst - -// SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit -../IVAS_dec 5_1 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_DTX_5_1.tst - // SBA at 160 kbps, 32kHz in, 32kHz out, FOA out ../IVAS_cod -sba 1 160000 32 testv/stvFOA32c.wav bit ../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_160000_32-32_FOA.tst @@ -754,6 +474,22 @@ ../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_HOA3.tst +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec MONO 48 bit testv/stv3OA48c.wav_sw_48-48_MONO.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv3OA48c.wav_sw_48-48_STEREO.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv3OA48c.wav_sw_48-48_BINAURAL.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec FOA 48 bit testv/stv3OA48c.wav_sw_48-48_FOA.tst + // SBA planar 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out ../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.wav_sw_48-48_7_1_4.tst @@ -822,115 +558,8 @@ // MASA 1dir 2TC at 13.2 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 13200 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv1MASA2TC48c.wav_13200_48-48_5_1_FEC5.tst - -// MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 16400 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48c.wav_16400_48-48_5_1.tst +../IVAS_dec BINAURAL 48 bit testv/stv2MASA2TC48c.wav_sw_48-48_BINAURAL.tst -// MASA 1dir 2TC at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 24400 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_24400_48-48_STEREO.tst - -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom.tst - -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst - -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, external orientation -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot_EXOF.tst - -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst - -// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_EXOF_OtrAvg.tst - -// MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 48000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA2TC48c.wav_48000_48-48_7_1_4_FEC5.tst - -// MASA 1dir 2TC at 80 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 80000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_80000_48-48_STEREO.tst - -// MASA 1dir 2TC at 96 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 96000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec MONO 48 bit testv/stv1MASA2TC48c.wav_96000_48-48_MONO.tst - -// MASA 1dir 2TC at 160 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 160000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv1MASA2TC48c.wav_160000_48-48_HOA3_FEC5.tst - -// MASA 1dir 2TC at 256 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 256000 48 testv/stv1MASA2TC48c.wav bit -../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48c.wav_256000_48-48_5_1.tst - -// MASA 2dir 2TC at 48 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 48000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.wav_48000_48-48_5_1.tst - -// MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, EXTERNAL out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec -fec 5 EXT 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_external_FEC5.tst - -// MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_BINAURAL_Headrot.tst - -// MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation, external orientation -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_BINAURAL_Headrot_EXOF.tst - -// MASA 2dir 2TC at 128 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 128000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec FOA 48 bit testv/stv2MASA2TC48c.wav_128000_48-48_FOA.tst - -// MASA 2dir 2TC at 192 kbps, 48kHz in, 48kHz out, 5_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 192000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec -fec 5 5_1_4 48 bit testv/stv2MASA2TC48c.wav_192000_48-48_5_1_4_FEC5.tst - -// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv2MASA2TC48c.wav_384000_48-48_BinauralRoom.tst - -// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv2MASA2TC48c.wav_384000_48-48_BinauralRoom_Subframe.tst - -// MASA 2dir 2TC at 512 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 512000 48 testv/stv2MASA2TC48c.wav bit -../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.wav_512000_48-48_5_1.tst - -// MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 13200 48 testv/stv1MASA1TC48n.wav bit -../IVAS_dec 7_1_4 48 bit testv/stv1MASA1TC48n.wav_13200_48-48_DTX_7_1_4.tst - -// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 24400 48 testv/stv1MASA1TC48n.wav bit -../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_24400_48-48_DTX_5_1.tst - -// MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 16400 48 testv/stv1MASA2TC48n.wav bit -../IVAS_dec 7_1_4 48 bit testv/stv1MASA2TC48n.wav_16400_48-48_DTX_7_1_4.tst - -// MASA 1dir 2TC at 32.0 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 32000 48 testv/stv1MASA2TC48n.wav bit -../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48n.wav_32000_48-48_DTX_5_1.tst - -// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit -../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_5_1.tst - -// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit -../IVAS_dec BINAURAL 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_BINAURAL.tst @@ -1138,6 +767,10 @@ ../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.wav bit ../IVAS_dec -FEC 5 STEREO 32 bit testv/stv714MC48c.wav_sw_48-32_stereo.tst +// Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.wav_sw_48-48_BINAURAL.tst + // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out (Model from file) ../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit diff --git a/tests/testconfig.py b/tests/testconfig.py index 404073b08e..1dbfbb8403 100644 --- a/tests/testconfig.py +++ b/tests/testconfig.py @@ -36,4 +36,4 @@ To configure test modules. PARAM_FILE = "scripts/config/self_test.prm" -MD5_REF_DICT = dict() +MD5_REF_DICT = dict() \ No newline at end of file -- GitLab From 15689a0c5f8dec823e431f48a233870d46e87b22 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 26 Jul 2023 20:51:06 +0200 Subject: [PATCH 523/591] revert unintentional changes in scripts --- ci/build_codec_sanitizers_linux.sh | 3 +- scripts/config/self_test.prm | 420 +++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 1 deletion(-) diff --git a/ci/build_codec_sanitizers_linux.sh b/ci/build_codec_sanitizers_linux.sh index d352fa32ec..4e40f89b9a 100755 --- a/ci/build_codec_sanitizers_linux.sh +++ b/ci/build_codec_sanitizers_linux.sh @@ -40,4 +40,5 @@ make CLANG=1 -j make clean make CLANG=2 -j make clean -make CLANG=3 -j +# write out one build for warnings check +make CLANG=3 -j 2>&1 | tee build_output.txt diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index aff7ebcc99..f0b30c28cf 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -418,6 +418,286 @@ ../IVAS_dec -fec 5 BINAURAL_ROOM_IR 48 bit testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FEC5.tst // 4 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst + +// 4 ISM with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit +../IVAS_dec HOA2 48 bit testv/stv4ISM48s.wav_80000_48-48_HOA2.tst + +// 4 ISM with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit +../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.wav_96000_48-48_MC_custom_setup.tst + +// 4 ISM with metadata at 96 kbps, 48 kHz in, 48 kHz out, EXT out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit +../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_96000_48-48_EXT.tst + +// 4 ISM with metadata at 128 kbps, 48 kHz in, 48 kHz out, EXT out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 128000 48 testv/stv4ISM48s.wav bit +../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_128000_48-48_EXT.tst + +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, EXT out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_256000_48-48_EXT.tst + +// 4 ISM with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit +../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_160000_48-48_STEREO.tst + +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural.tst + +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural_file_TDHR.tst + +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, external orientation +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot_case03_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural_file_TDHR_EXOF.tst + +// 4 ISM with metadata at 512 kbps, 48 kHz in, 48 kHz out, 5_1 +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stv4ISM48s.wav bit +../IVAS_dec 5_1 48 bit testv/stv4ISM48s.wav_512000_48-48_5_1.tst + +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst + +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, external orientation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_EXOF_OtrAvg.tst + +// 4 ISM with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, EXT out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec EXT 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_EXT.tst + +// 4 ISm with and without metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, HOA3 out +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv NULL NULL testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst + +// 4 ISM with extended metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, directivity configuration, random FEC at 5% +../IVAS_cod -ism +4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -fec 5 -render_config testv/config_directivity.cfg -t testv/headrot_case04_3000_q.csv BINAURAL 48 bit testv/stv+4ISM48s.wav_256000_48-48_binaural_file_TDHR_DirConfig_FEC5.tst + +// 4 ISM with extended metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, external orientation, directivity configuration, random FEC at 5% +../IVAS_cod -ism +4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -fec 5 -render_config testv/config_directivity.cfg -t testv/headrot_case04_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv+4ISM48s.wav_256000_48-48_binaural_file_TDHR_EXOF_DirConfig_FEC5.tst + +// 4 ISM with and without extended metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, EXT out +../IVAS_cod -dtx -ism +4 testv/stvISM1.csv NULL testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec EXT 48 bit testv/stv+4ISM48s.wav_brate_sw_48-48_DTX_EXT.tst + +// 4 ISM with extended metadata and non diegetic pan object switching bitrate 256 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out +../IVAS_cod -dtx -ism +4 testv/stvISM1.csv NULL testv/stvISM_with_no_diegetic_switch.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv+4ISM48s+non_diegetic_pan.wav_brate_256000-48_DTX_binaural.tst + + +// SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out +../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_HOA3.tst + +// SBA at 13.2 kbps, 32kHz in, 32kHz out, STEREO out +../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_stereo.tst + +// SBA at 16.4 kbps, 32kHz in, 32kHz out, 7_1_4 out +../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit +../IVAS_dec 7_1_4 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_7_1_4.tst + +// SBA at 16.4 kbps, 32kHz in, 32kHz out, BINAURAL out +../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_Binaural.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, STEREO out +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_stereo.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Subframe_FEC5.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, external orientation +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot_EXOF.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, external orientation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_EXOF_OtrAvg.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FEC5.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation, external orientation +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot_EXOF.tst + +// SBA at 32 kbps, 32kHz in, 32kHz out, FOA out +../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit +../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_FOA.tst + +// SBA at 32 kbps, 32kHz in, 32kHz out, BINAURAL out, 6% FEC pattern +../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit +../IVAS_dec -fec testv/FEC_6pct.bin BINAURAL 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_FEC6.tst + +// SBA at 32 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM out +../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_ROOM.tst + +// SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX +../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit +../IVAS_dec MONO 48 bit testv/stvFOA48c.wav_SBA_32000_48-48_DTX_MONO.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 MONO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_MONO_FEC5.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, STEREO out +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_stereo.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Subframe.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot_EXOF.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrAvg.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking, external orientation +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPos.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode, external orientation +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPosLev.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation, external orientation +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot_EXOF.tst + +// SBA at 48 kbps, 48kHz in, 48kHz out, 5_1_2 out +../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit +../IVAS_dec 5_1_2 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_5_1_2.tst + +// SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX, random FEC at 5% +../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit +../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.wav_SBA_64000_32-32_DTX_FOA.tst + +// SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_5_1_4.tst + +// SBA at 64 kbps, 48kHz in, 48kHz out, 7_1_4 out +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_7_1_4.tst + +// SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL out, DTX +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL.tst + +// SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL_ROOM out, DTX +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst + +// SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_HOA3.tst + +// SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_FEC5.tst + +// SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_Headrot.tst + +// SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, external orientation +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_Headrot_EXOF.tst + +// SBA at 96 kbps, 32kHz in, 32kHz out, STEREO out +../IVAS_cod -sba 1 96000 32 testv/stvFOA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvFOA32c.wav_SBA_96000_32-32_STEREO.tst + +// SBA at 96 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit +../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_96000_48-48_FOA.tst + +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst + +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, external orientation +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot_case00_3000_q.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot_EXOF.tst + +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst + +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_EXOF_OtrAvg.tst + +// SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% +../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit +../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FEC5.tst + +// SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out +../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_DTX_5_1.tst + // SBA at 160 kbps, 32kHz in, 32kHz out, FOA out ../IVAS_cod -sba 1 160000 32 testv/stvFOA32c.wav bit ../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_160000_32-32_FOA.tst @@ -558,6 +838,146 @@ // MASA 1dir 2TC at 13.2 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% ../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 13200 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv1MASA2TC48c.wav_13200_48-48_5_1_FEC5.tst + +// MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 16400 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48c.wav_16400_48-48_5_1.tst + +// MASA 1dir 2TC at 24.4 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 24400 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_24400_48-48_STEREO.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, external orientation +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL_ROOM_IR 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot_EXOF.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking, external orientation +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL_ROOM_IR 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_EXOF_OtrAvg.tst + +// MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 48000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA2TC48c.wav_48000_48-48_7_1_4_FEC5.tst + +// MASA 1dir 2TC at 80 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 80000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_80000_48-48_STEREO.tst + +// MASA 1dir 2TC at 96 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 96000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA2TC48c.wav_96000_48-48_MONO.tst + +// MASA 1dir 2TC at 160 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 160000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv1MASA2TC48c.wav_160000_48-48_HOA3_FEC5.tst + +// MASA 1dir 2TC at 256 kbps, 48kHz in, 48kHz out, 5_1 out +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 256000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48c.wav_256000_48-48_5_1.tst + +// MASA 2dir 2TC at 48 kbps, 48kHz in, 48kHz out, 5_1 out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 48000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.wav_48000_48-48_5_1.tst + +// MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, EXTERNAL out, random FEC at 5% +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 EXT 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_external_FEC5.tst + +// MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_BINAURAL_Headrot.tst + +// MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation, external orientation +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_BINAURAL_Headrot_EXOF.tst + +// MASA 2dir 2TC at 128 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 128000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv2MASA2TC48c.wav_128000_48-48_FOA.tst + +// MASA 2dir 2TC at 192 kbps, 48kHz in, 48kHz out, 5_1_4 out, random FEC at 5% +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 192000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 5_1_4 48 bit testv/stv2MASA2TC48c.wav_192000_48-48_5_1_4_FEC5.tst + +// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv2MASA2TC48c.wav_384000_48-48_BinauralRoom.tst + +// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stv2MASA2TC48c.wav_384000_48-48_BinauralRoom_Subframe.tst + +// MASA 2dir 2TC at 512 kbps, 48kHz in, 48kHz out, 5_1 out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 512000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.wav_512000_48-48_5_1.tst + +// MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 13200 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA1TC48n.wav_13200_48-48_DTX_7_1_4.tst + +// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 24400 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_24400_48-48_DTX_5_1.tst + +// MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 16400 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA2TC48n.wav_16400_48-48_DTX_7_1_4.tst + +// MASA 1dir 2TC at 32.0 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 32000 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48n.wav_32000_48-48_DTX_5_1.tst + +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, 5_1 out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_5_1.tst + +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_STEREO.tst + +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_BINAURAL.tst + +// MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec FOA 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_FOA.tst + +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_BINAURAL.tst + +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_MONO.tst + +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1 out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec 7_1 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_7_1.tst + +// MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_MONO.tst + +// MASA 2dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1 out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 7_1 48 bit testv/stv2MASA2TC48c.wav_sw_48-48_7_1.tst + +// MASA 2dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv2MASA2TC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv2MASA2TC48c.wav_sw_48-48_BINAURAL.tst -- GitLab From b9e29d838914214d684da29c865fb2e6b90ee83c Mon Sep 17 00:00:00 2001 From: advasila Date: Wed, 26 Jul 2023 21:52:47 +0300 Subject: [PATCH 524/591] fix clang and remove exception from ubsan.supp script --- lib_enc/ivas_qmetadata_enc.c | 2 +- scripts/ubsan.supp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 9350b1c09d..a5960dab6c 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2833,7 +2833,7 @@ static int16_t ivas_qmetadata_entropy_encode_dir( use_adapt_avg = calc_var_azi( q_direction, diffuseness_index_max_ec_frame, avg_azimuth - 180, &avg_azimuth ); #ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA avg_azimuth_index = (uint16_t) ( quantize_phi( avg_azimuth + 180, 0, &avg_azimuth, avg_azimuth_alphabet ) ); -#else +#else avg_azimuth_index = quantize_phi( avg_azimuth + 180, 0, &avg_azimuth, avg_azimuth_alphabet ); #endif } diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp index 8f312aa15a..485535e281 100644 --- a/scripts/ubsan.supp +++ b/scripts/ubsan.supp @@ -33,7 +33,6 @@ implicit-signed-integer-truncation:cng_dec.c implicit-signed-integer-truncation:cod_tcx.c implicit-signed-integer-truncation:dec_tcx.c implicit-signed-integer-truncation:hdecnrm.c -implicit-signed-integer-truncation:ivas_qmetadata_enc.c implicit-signed-integer-truncation:lib_dec.c implicit-signed-integer-truncation:longarith.c implicit-signed-integer-truncation:pvq_core_dec.c -- GitLab From 478c21d2e6f13f0ac688315f521acaf4204447f2 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 27 Jul 2023 11:58:43 +1000 Subject: [PATCH 525/591] rend MC fix --- lib_rend/lib_rend.c | 57 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 10ea4d47a7..be15911337 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -177,7 +177,11 @@ typedef struct TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ #endif REVERB_HANDLE hReverb; +#ifdef SPLIT_REND_WITH_HEAD_ROT + rotation_gains rot_gains_prev[MAX_HEAD_ROT_POSES]; +#else rotation_gains rot_gains_prev; +#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; lfe_routing lfeRouting; @@ -2407,6 +2411,9 @@ static ivas_error setRendInputActiveMc( rendering_context rendCtx; IVAS_REND_AudioConfig outConfig; input_mc *inputMc; +#ifdef SPLIT_REND_WITH_HEAD_ROT + int16_t pos_idx; +#endif inputMc = (input_mc *) input; rendCtx = inputMc->base.ctx; @@ -2436,7 +2443,14 @@ static ivas_error setRendInputActiveMc( inputMc->crendWrapper = NULL; inputMc->hReverb = NULL; inputMc->hMcMasa = NULL; +#ifdef SPLIT_REND_WITH_HEAD_ROT + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + initRotGains( inputMc->rot_gains_prev[pos_idx] ); + } +#else initRotGains( inputMc->rot_gains_prev ); +#endif inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); #ifdef FIX_194_LFE_DELAY_EXTREND set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); @@ -6453,7 +6467,12 @@ static ivas_error renderMcToBinaural( 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 ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + mcInput->rot_gains_prev[0], +#else + mcInput->rot_gains_prev, +#endif + mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -6561,7 +6580,12 @@ static ivas_error renderMcToBinauralRoom( 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 ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + mcInput->rot_gains_prev[0], +#else + mcInput->rot_gains_prev, +#endif + mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -6652,7 +6676,12 @@ static ivas_error renderMcCustomLsToBinauralRoom( 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 ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + mcInput->rot_gains_prev[0], +#else + mcInput->rot_gains_prev, +#endif + mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -6895,7 +6924,11 @@ static ivas_error renderMcToSplitBinaural( 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 ) { @@ -8116,15 +8149,15 @@ static ivas_error renderInputMasa( case IVAS_REND_AUDIO_CONFIG_BINAURAL: renderMasaToBinaural( masaInput, outAudio ); break; - /* ToDo */ - //#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG - // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - //#else - // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: - //#endif - // renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); - // break; + /* ToDo */ + //#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG + // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: + // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + //#else + // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: + //#endif + // renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); + // break; #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -- GitLab From ef2b80ef258296ca2acef7e11b8cb86b899aff38 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 27 Jul 2023 12:20:18 +1000 Subject: [PATCH 526/591] build sanitizer fix, clang formatting fix --- lib_dec/ivas_dirac_dec.c | 8 +- lib_dec/ivas_ism_param_dec.c | 2 +- lib_dec/ivas_masa_dec.c | 4 +- lib_dec/lib_dec.c | 95 +++++++++++++++++++- lib_rend/ivas_dirac_dec_binaural_functions.c | 54 +++++------ 5 files changed, 123 insertions(+), 40 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index b2c34ca2de..e9443fda32 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -896,14 +896,14 @@ ivas_error ivas_dirac_dec_config( { /* TODO: can we keep isRenderingInTd fixed? */ ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, - 0, /* isRenderingInTd */ - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* pcm_out */ + 0, /* isRenderingInTd */ + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* pcm_out */ error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, - 1, /* is_cldfb_in */ - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* is_pcm_out */ + 1, /* is_cldfb_in */ + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* is_pcm_out */ if ( error != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index e536d8f25b..b64c52bc71 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -387,7 +387,7 @@ static ivas_error ivas_param_ism_rendering_init( } #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM) ) + if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index ca48e4bdf2..6eea8591f5 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1100,7 +1100,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->hDiracDecBin != NULL ) { #endif - /* regularization factor is bitrate-dependent */ + /* regularization factor is bitrate-dependent */ #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); } @@ -1185,7 +1185,7 @@ void ivas_spar_param_to_masa_param_mapping( hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSpatParamRendCom->numSimultaneousDirections = 1; #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - hDiffuseDist = st_ivas->hDiracDecBin[0]->hDiffuseDist; /* TODO: this may need to use different pose indices */ + hDiffuseDist = st_ivas->hDiracDecBin[0]->hDiffuseDist; /* TODO: this may need to use different pose indices */ #else hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 3fbbb27d8f..969590e2a3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -286,7 +286,96 @@ void IVAS_DEC_Close( return; } +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*---------------------------------------------------------------------* + * mapAudioConfig2DecAudoioConfig() + * + * + *---------------------------------------------------------------------*/ + +static IVAS_DEC_AUDIO_CONFIG mapAudioConfig2DecAudoioConfig( + const AUDIO_CONFIG audio_config ) +{ + IVAS_DEC_AUDIO_CONFIG dec_audio_config; + if ( audio_config == AUDIO_CONFIG_EXTERNAL ) /* external renderer */ + { + dec_audio_config = IVAS_DEC_OUTPUT_EXT; + } + else if ( audio_config == AUDIO_CONFIG_MONO ) + { + dec_audio_config = IVAS_DEC_OUTPUT_MONO; + } + else if ( audio_config == AUDIO_CONFIG_STEREO ) + { + dec_audio_config = IVAS_DEC_OUTPUT_STEREO; + } + else if ( audio_config == AUDIO_CONFIG_5_1 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_5_1; + } + else if ( audio_config == AUDIO_CONFIG_7_1 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_7_1; + } + else if ( audio_config == AUDIO_CONFIG_5_1_2 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_5_1_2; + } + else if ( audio_config == AUDIO_CONFIG_5_1_4 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_5_1_4; + } + else if ( audio_config == AUDIO_CONFIG_7_1_4 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_7_1_4; + } + else if ( audio_config == AUDIO_CONFIG_LS_CUSTOM ) + { + dec_audio_config = IVAS_DEC_OUTPUT_LS_CUSTOM; + } + else if ( audio_config == AUDIO_CONFIG_FOA ) + { + dec_audio_config = IVAS_DEC_OUTPUT_FOA; + } + else if ( audio_config == AUDIO_CONFIG_HOA2 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_HOA2; + } + else if ( audio_config == AUDIO_CONFIG_HOA3 ) + { + dec_audio_config = IVAS_DEC_OUTPUT_HOA3; + } + else if ( audio_config == AUDIO_CONFIG_BINAURAL ) + { + dec_audio_config = IVAS_DEC_OUTPUT_BINAURAL; + } + else if ( audio_config == AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + dec_audio_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR; + } + else if ( audio_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + dec_audio_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB; + } +#ifdef SPLIT_REND_WITH_HEAD_ROT + else if ( audio_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) + { + dec_audio_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED; + } + else if ( audio_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + dec_audio_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM; + } +#endif + else + { + dec_audio_config = IVAS_DEC_OUTPUT_UNKNOWN; + } + + return dec_audio_config; +} +#endif /*---------------------------------------------------------------------* * mapOutputFormat() @@ -3262,10 +3351,10 @@ ivas_error IVAS_DEC_GetCldfbSamples( num_samples = 0; if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) { - *audio_config = st_ivas->splitBinRend.hCldfbDataOut->config; + *audio_config = mapAudioConfig2DecAudoioConfig( st_ivas->splitBinRend.hCldfbDataOut->config ); if ( st_ivas->splitBinRend.hCldfbDataOut->config != AUDIO_CONFIG_INVALID ) { - getAudioConfigNumChannels( st_ivas->splitBinRend.hCldfbDataOut->config, &num_chs ); + num_chs = audioCfg2channels( st_ivas->splitBinRend.hCldfbDataOut->config ); maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) @@ -3284,7 +3373,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( } else { - *audio_config = AUDIO_CONFIG_INVALID; + *audio_config = IVAS_DEC_OUTPUT_UNKNOWN; } *nOutSamples = num_samples; return error; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a408af8d4f..f0085cee84 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -101,13 +101,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( DIRAC_ static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN -static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], - float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe, - float outRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float outIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float reverbRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float decorrRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const uint8_t recompute ); +static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe, float outRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float outIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const uint8_t recompute ); #else static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); #endif @@ -231,9 +225,9 @@ ivas_error ivas_dirac_dec_init_binaural_data( } #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ + if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ #else - if ( hDiracDecBin->hReverb == NULL ) + if ( hDiracDecBin->hReverb == NULL ) #endif { if ( ( error = ivas_binaural_reverb_open( &hDiracDecBin->hReverb, @@ -273,7 +267,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( } #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( pos_idx == 0) /* open decorrelator only for the main direction */ + if ( pos_idx == 0 ) /* open decorrelator only for the main direction */ { #endif if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) @@ -300,7 +294,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( } else { - hDiracDecBin->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr; /* copy the flag, but the implementation re-uses the decorrelated signal */ + hDiracDecBin->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr; /* copy the flag, but the implementation re-uses the decorrelated signal */ } #endif @@ -361,7 +355,7 @@ void ivas_dirac_dec_close_binaural_data( if ( hBinaural[pos_idx]->h_freq_domain_decorr_ap_params != NULL ) { - ivas_dirac_dec_decorr_close( &(hBinaural[pos_idx]->h_freq_domain_decorr_ap_params), &(hBinaural[pos_idx]->h_freq_domain_decorr_ap_state) ); + ivas_dirac_dec_decorr_close( &( hBinaural[pos_idx]->h_freq_domain_decorr_ap_params ), &( hBinaural[pos_idx]->h_freq_domain_decorr_ap_state ) ); } free( hBinaural[pos_idx] ); @@ -877,8 +871,8 @@ static void ivas_dirac_dec_binaural_internal( { for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) { - mvr2r(tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); - mvr2r(tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); + mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); + mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); } } } @@ -901,8 +895,8 @@ static void ivas_dirac_dec_binaural_internal( if ( hCombinedOrientationData ) { Quaternions_ref = &hCombinedOrientationData->Quaternions[0]; - Quaternions_rot.w = -3.0f; /* signal to use Euler */ - Quaternions_abs.w = -3.0f; /* signal to use Euler */ + Quaternions_rot.w = -3.0f; /* signal to use Euler */ + Quaternions_abs.w = -3.0f; /* signal to use Euler */ Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) @@ -914,7 +908,7 @@ static void ivas_dirac_dec_binaural_internal( QuatToRotMat( Quaternions_rot, Rmat_local ); hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; - assert(hDiracDecBin != NULL && "No DiracDecBin handle for this position"); + assert( hDiracDecBin != NULL && "No DiracDecBin handle for this position" ); if ( config_data.ivas_format == SBA_FORMAT ) { hDiracDecBin->hDiffuseDist = &diffuseDistData; @@ -923,10 +917,10 @@ static void ivas_dirac_dec_binaural_internal( /* re-use input covariance for the side renderings */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - mvr2r(st_ivas->hDiracDecBin[0]->ChEne[ch], hDiracDecBin->ChEne[ch], hSpatParamRendCom->num_freq_bands); + mvr2r( st_ivas->hDiracDecBin[0]->ChEne[ch], hDiracDecBin->ChEne[ch], hSpatParamRendCom->num_freq_bands ); } - mvr2r(st_ivas->hDiracDecBin[0]->ChCrossRe, hDiracDecBin->ChCrossRe, hSpatParamRendCom->num_freq_bands); - mvr2r(st_ivas->hDiracDecBin[0]->ChCrossIm, hDiracDecBin->ChCrossIm, hSpatParamRendCom->num_freq_bands); + mvr2r( st_ivas->hDiracDecBin[0]->ChCrossRe, hDiracDecBin->ChCrossRe, hSpatParamRendCom->num_freq_bands ); + mvr2r( st_ivas->hDiracDecBin[0]->ChCrossIm, hDiracDecBin->ChCrossIm, hSpatParamRendCom->num_freq_bands ); ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat_local, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0, @@ -940,15 +934,15 @@ static void ivas_dirac_dec_binaural_internal( ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im, reverbRe, reverbIm, - decorrRe, decorrIm, 0); + decorrRe, decorrIm, 0 ); /* copy from temporary buffer to the main split rendering buffer */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) { - mvr2r(tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); - mvr2r(tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX); + mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); + mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); } } @@ -1678,7 +1672,7 @@ static void ivas_dirac_dec_binaural_process_output( float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const uint8_t recompute #endif - ) +) { int16_t slot, bin, chA, chB; int16_t nBins; @@ -1725,16 +1719,16 @@ static void ivas_dirac_dec_binaural_process_output( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - mvr2r(decSlotRe[chA], decorrRe[chA][slot], CLDFB_NO_CHANNELS_MAX); - mvr2r(decSlotIm[chA], decorrIm[chA][slot], CLDFB_NO_CHANNELS_MAX); + mvr2r( decSlotRe[chA], decorrRe[chA][slot], CLDFB_NO_CHANNELS_MAX ); + mvr2r( decSlotIm[chA], decorrIm[chA][slot], CLDFB_NO_CHANNELS_MAX ); } } else { for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - mvr2r(decorrRe[chA][slot], decSlotRe[chA], CLDFB_NO_CHANNELS_MAX); - mvr2r(decorrIm[chA][slot], decSlotIm[chA], CLDFB_NO_CHANNELS_MAX); + mvr2r( decorrRe[chA][slot], decSlotRe[chA], CLDFB_NO_CHANNELS_MAX ); + mvr2r( decorrIm[chA][slot], decSlotIm[chA], CLDFB_NO_CHANNELS_MAX ); } } #endif @@ -1806,8 +1800,8 @@ static void ivas_dirac_dec_binaural_process_output( if ( outRe != NULL && outIm != NULL ) { /* provide the data outside in CLDFB domain => mainly for split rendering */ - mvr2r(outSlotRePr, outRe[chA][slot], CLDFB_NO_CHANNELS_MAX); - mvr2r(outSlotImPr, outIm[chA][slot], CLDFB_NO_CHANNELS_MAX); + mvr2r( outSlotRePr, outRe[chA][slot], CLDFB_NO_CHANNELS_MAX ); + mvr2r( outSlotImPr, outIm[chA][slot], CLDFB_NO_CHANNELS_MAX ); } if ( recompute == 1 ) { -- GitLab From 557547b5ac7fbd5b6a43b9de05ca8b8192745b0f Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 27 Jul 2023 12:32:11 +1000 Subject: [PATCH 527/591] new line warning fix --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 969590e2a3..e83e5a7e3c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3378,4 +3378,4 @@ ivas_error IVAS_DEC_GetCldfbSamples( *nOutSamples = num_samples; return error; } -#endif \ No newline at end of file +#endif -- GitLab From 775d29c21762daf4f34606a42ff1ce78a110e626 Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 27 Jul 2023 15:00:16 +1000 Subject: [PATCH 528/591] JBM fix in MC param upmix path in SR mode --- lib_dec/ivas_binRenderer_internal.c | 27 +++++++++++++++++++++++++++ lib_dec/ivas_jbm_dec.c | 21 +++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f8d000e429..555333785e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1496,6 +1496,33 @@ void ivas_binaural_cldfb_sf( idx_in++; } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*LFE handling for split rendering cases*/ + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) + { + ch = st_ivas->hIntSetup.index_lfe[idx_lfe]; + cldfbAnalysis_ts( &( output_f[ch][maxBand * index_slot] ), + Cldfb_RealBuffer[idx_in][slot_idx], + Cldfb_ImagBuffer[idx_in][slot_idx], + maxBand, st_ivas->cldfbAnaDec[idx_in] ); + idx_in++; + } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) + { + for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->splitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand ); + } + st_ivas->splitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config; + } +#endif + } +#endif } /* Implement binaural rendering */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index e1a7a9cbd2..436c08c417 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -926,11 +926,17 @@ ivas_error ivas_jbm_dec_render( ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc, p_output ); /* HP filtering */ - for ( n = 0; n < st_ivas->nchan_transport; n++ ) +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*no HPF when rendering is already done*/ + if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) +#endif { - if ( n != LFE_CHANNEL ) + for ( n = 0; n < st_ivas->nchan_transport; n++ ) { - hp20( p_output[n], *nSamplesRendered, st_ivas->mem_hp20_out[n], output_Fs ); + if ( n != LFE_CHANNEL ) + { + hp20( p_output[n], *nSamplesRendered, st_ivas->mem_hp20_out[n], output_Fs ); + } } } @@ -942,7 +948,14 @@ ivas_error ivas_jbm_dec_render( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*handled in CLDFB domain already*/ + if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && + ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#endif + { + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + } } else if ( st_ivas->renderer_type == RENDERER_MC ) { -- GitLab From 27c6afaecf76581fcba4a0000ce5c3597fd5572a Mon Sep 17 00:00:00 2001 From: advasila Date: Thu, 27 Jul 2023 11:43:50 +0300 Subject: [PATCH 529/591] merge switch OMASA_FIX_LOW_FS --- lib_com/options.h | 1 - lib_enc/ivas_enc.c | 6 ------ lib_enc/ivas_masa_enc.c | 12 +----------- lib_enc/ivas_omasa_enc.c | 15 +-------------- 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index dd46315152..ae51810807 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -202,7 +202,6 @@ #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix #define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ -#define OMASA_FIX_LOW_FS /* Nokia: fixes related to lower input signal sampling rates */ #endif /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 33ab5a156b..429a18e0d2 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -298,10 +298,8 @@ ivas_error ivas_enc( flag_omasa_ener_brate = 0; -#ifdef OMASA_FIX_LOW_FS /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); -#endif if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -318,10 +316,6 @@ ivas_error ivas_enc( set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); idx_separated_object = 0; -#ifndef OMASA_FIX_LOW_FS - /* Estimate TF-tile energy for the input MASA stream */ - ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); -#endif /* put audio object data in SCE's */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index abe899a794..f717f1c174 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -745,9 +745,7 @@ ivas_error ivas_masa_enc_config( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t ism_total_brate; -#ifdef OMASA_FIX_LOW_FS int32_t masa_total_brate; -#endif #endif error = IVAS_ERR_OK; @@ -903,16 +901,12 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS st_ivas->hQMetaData->q_direction->cfg.inactiveBands = 0; -#ifdef OMASA_FIX_LOW_FS masa_total_brate = ivas_total_brate; if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { masa_total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); } if ( masa_total_brate >= IVAS_384k && ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) ) -#else - if ( ivas_total_brate > IVAS_256k && ivas_format == MASA_FORMAT ) -#endif #else if ( ivas_total_brate > IVAS_256k ) #endif @@ -944,12 +938,8 @@ ivas_error ivas_masa_enc_config( st_ivas->hQMetaData->q_direction->cfg.inactiveBands = 0; } } -#ifdef OMASA_FIX_LOW_FS - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, masa_total_brate >= IVAS_384k, NULL ); -#else - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, ivas_total_brate > IVAS_256k, NULL ); -#endif + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, masa_total_brate >= IVAS_384k, NULL ); if ( hMasa->config.numTwoDirBands >= hMasa->config.numCodingBands ) { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index aaa4627361..503eeb4732 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -531,14 +531,8 @@ void ivas_omasa_enc( } /* force computation into high resolution */ -#ifndef OMASA_FIX_LOW_FS - n_bands_orig = hOMasa->nbands; -#endif - n_subframes_orig = hOMasa->nSubframes; -#ifndef OMASA_FIX_LOW_FS - hOMasa->nbands = MASA_FREQUENCY_BANDS; -#endif + n_subframes_orig = hOMasa->nSubframes; hOMasa->nSubframes = MAX_PARAM_SPATIAL_SUBFRAMES; /* Estimate MASA parameters from the objects */ @@ -556,20 +550,13 @@ void ivas_omasa_enc( } /* restore resolution parameters */ -#ifndef OMASA_FIX_LOW_FS - hOMasa->nbands = n_bands_orig; -#endif hOMasa->nSubframes = n_subframes_orig; /* perform MASA+ISM merge in full resolution */ numCodingBands_orig = hMasa->config.numCodingBands; joinedSubframes_orig = hMasa->config.joinedSubframes; -#ifndef OMASA_FIX_LOW_FS - hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS; -#else hMasa->config.numCodingBands = hOMasa->nbands; -#endif hMasa->config.joinedSubframes = 0; ivas_merge_masa_metadata( hMasa, hOMasaMeta ); /* => merge result in hMasa->masaMetadata */ -- GitLab From 6c4ccc90972eb31acea61f23f7f849c6c12a829e Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Thu, 27 Jul 2023 11:10:36 +0200 Subject: [PATCH 530/591] remove OMASA_BRSW_MONO_FIX since this was made unnecessary by the DirAC refactoring. close function comment fix. remove unnecessary "#if 1" and "#if 0". remove refactoring TODOs. --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 5 ----- lib_dec/ivas_ism_renderer.c | 2 +- lib_dec/ivas_masa_dec.c | 15 +-------------- lib_dec/ivas_omasa_dec.c | 4 +--- 5 files changed, 3 insertions(+), 24 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ae51810807..f08ad0edc1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -201,7 +201,6 @@ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ #define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix -#define OMASA_BRSW_MONO_FIX /* Nokia: fix renderer config under rateswitching and MONO output */ #endif /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5bf780788f..247174990d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1175,12 +1175,7 @@ ivas_error ivas_init_decoder( return error; } -#if 0 - /* TODO: dirac refactor merge: check! */ - if (st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MONO_DOWNMIX) -#else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 08017af46f..6e776d3577 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -415,7 +415,7 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( /*-------------------------------------------------------------------------* * ivas_masa_ism_separate_object_renderer_close() * - * Close structures, reserve memory, and init values. + * Close structures, free memory. *-------------------------------------------------------------------------*/ void ivas_masa_ism_separate_object_renderer_close( diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 6306881c9c..7ee3fad666 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1288,14 +1288,8 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); -/* Todo: Check this */ -#if 0 && defined( OMASA_BRSW_MONO_FIX ) /* TODO */ if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) -#else - if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) -#endif { /* init a new DirAC dec */ if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) @@ -1303,11 +1297,7 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } -#if 0 && defined( OMASA_BRSW_MONO_FIX ) - else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) -#else else if ( st_ivas->renderer_type == RENDERER_DISABLE ) -#endif { if ( st_ivas->hDirAC != NULL ) { @@ -1336,7 +1326,6 @@ ivas_error ivas_masa_dec_reconfigure( sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hSCE[sce_id]->element_brate / FRAMES_PER_SEC ); - /* TODO refactor merge: this is not in the pre-refactor version */ if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) @@ -1396,8 +1385,6 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching within OMASA is handled in ivas_omasa_dec_config() */ { #endif -#if 1 - /* TODO refactor merge: do we need this or similar?*/ /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ @@ -1409,7 +1396,7 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } -#endif + /*-----------------------------------------------------------------* * CLDFB instances *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index e8add408ef..2f3af704b1 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -360,8 +360,6 @@ ivas_error ivas_omasa_dec_config( * TD Decorrelator *-----------------------------------------------------------------*/ -#if 1 - /* TODO: executed already in ivas_masa_dec_reconfigure */ if ( st_ivas->hDiracDecBin != NULL ) { if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) @@ -378,7 +376,7 @@ ivas_error ivas_omasa_dec_config( { return error; } -#endif + } return IVAS_ERR_OK; -- GitLab From 5e69e35df50ef2388545191c891b2cd982f3edbe Mon Sep 17 00:00:00 2001 From: hmund Date: Thu, 27 Jul 2023 11:11:22 +0200 Subject: [PATCH 531/591] remove inactive code under SBA_TD_RESIDUAL --- lib_enc/ivas_spar_encoder.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 7233234f49..0007aa6160 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -890,29 +890,6 @@ static ivas_error ivas_spar_enc_process( } } -#if 0 /* SBA_TD_RESIDUAL */ - { - static FILE *fid = 0; - static int samplesWritten = 0; - int s; - if (!fid) - { - fid = fopen("enc_pcm.txt", "wt"); - } - if (samplesWritten < 8 * 48000) - { - for (s = 0; s < input_frame; s++) - { - for (i = 0; i < hSpar->hFbMixer->fb_cfg->num_out_chans; i++) - { - fprintf(fid, "%.8f ", p_pcm_tmp[i][s]); - } - fprintf(fid, "\n"); - } - samplesWritten += input_frame; - } - } -#endif /*-----------------------------------------------------------------------------------------* * PCA encoder *-----------------------------------------------------------------------------------------*/ -- GitLab From 0bf80e6c45ac4e92efbe333f49e04e9692f69a04 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 27 Jul 2023 11:53:29 +0200 Subject: [PATCH 532/591] - accept FIX_356_ISM_METADATA_SYNC_OMASA - fix compilation without MASA_AND_OBJECTS --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 7 ++++++- lib_dec/ivas_masa_dec.c | 4 ++++ lib_dec/ivas_objectRenderer_internal.c | 4 ++-- lib_dec/ivas_omasa_dec.c | 1 - lib_enc/ivas_ism_metadata_enc.c | 3 ++- lib_enc/ivas_masa_enc.c | 4 ++++ 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f08ad0edc1..468cdbfed5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -200,7 +200,6 @@ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ #ifdef MASA_AND_OBJECTS #define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix #endif /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 247174990d..0ee4567521 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -784,11 +784,14 @@ ivas_error ivas_init_decoder( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef MASA_AND_OBJECTS if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { hDecoderConfig->nchan_out = st_ivas->nchan_transport + st_ivas->nchan_ism; } - else if ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) + else +#endif + if ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) { hDecoderConfig->nchan_out = st_ivas->nchan_transport; } @@ -2583,6 +2586,7 @@ static ivas_error doSanityChecks_IVAS( } } +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && output_config == AUDIO_CONFIG_EXTERNAL ) @@ -2590,6 +2594,7 @@ static ivas_error doSanityChecks_IVAS( return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); } } +#endif #ifdef DEBUGGING if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != AUDIO_CONFIG_BINAURAL && output_config != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 7ee3fad666..c63f4af93f 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -571,7 +571,11 @@ ivas_error ivas_masa_decode( } } +#ifdef MASA_AND_OBJECTS if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) +#else + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) +#endif { create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 95ffee7423..497ae240f2 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -107,10 +107,10 @@ ivas_error ivas_td_binaural_renderer( ism_md_subframe_update = 2; } -#ifdef FIX_356_ISM_METADATA_SYNC_OMASA +#ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { - ism_md_subframe_update = 0; + ism_md_subframe_update = 0; // ToDo (for Mikko-Ville): verify whether it should not be 2 } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 2f3af704b1..3a41019ccb 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -376,7 +376,6 @@ ivas_error ivas_omasa_dec_config( { return error; } - } return IVAS_ERR_OK; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 52a6a634dc..301576d870 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -747,7 +747,8 @@ ivas_error ivas_ism_metadata_enc( hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; if ( ism_mode == ISM_MODE_DISC ) { - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) + if ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) || + ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index f717f1c174..d86b52e9b5 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -939,7 +939,11 @@ ivas_error ivas_masa_enc_config( } } +#ifdef MASA_AND_OBJECTS masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, masa_total_brate >= IVAS_384k, NULL ); +#else + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, ivas_total_brate > IVAS_256k, NULL ); +#endif if ( hMasa->config.numTwoDirBands >= hMasa->config.numCodingBands ) { -- GitLab From caeb93db6ed251c384c5672f0ed7fdf253fe2c21 Mon Sep 17 00:00:00 2001 From: malenov Date: Thu, 27 Jul 2023 12:21:25 +0200 Subject: [PATCH 533/591] remove the comments IVAS-219: QCToDo: --- lib_enc/ivas_stereo_icbwe_enc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_enc/ivas_stereo_icbwe_enc.c b/lib_enc/ivas_stereo_icbwe_enc.c index 43ae497df8..14bf01e32b 100644 --- a/lib_enc/ivas_stereo_icbwe_enc.c +++ b/lib_enc/ivas_stereo_icbwe_enc.c @@ -417,7 +417,6 @@ void stereo_icBWE_enc( /* core switching reset */ if ( st->last_core != ACELP_CORE || st->core != ACELP_CORE || st->bwidth < SWB || st->extl == -1 ) { - /* IVAS-219: QCToDo: ICBWEDFT for WB TBV */ ic_bwe_enc_reset( hStereoICBWE ); if ( st->core != ACELP_CORE || st->bwidth < SWB || st->input_Fs < 32000 || st->extl == -1 ) { @@ -505,7 +504,6 @@ void stereo_icBWE_enc( mvr2r( shb_frame_nonref + L_FRAME16k, hStereoICBWE->mem_shb_speech_nonref, L_LOOK_16k ); /* core switching reset */ - /* IVAS-219: QCToDo: check this "if condition" if IVAS_CPE_TD is needed? */ if ( st->last_core != ACELP_CORE || st->core != ACELP_CORE || st->bwidth < SWB || st->element_mode != IVAS_CPE_TD || st->extl == -1 ) { ic_bwe_enc_reset( hStereoICBWE ); @@ -517,7 +515,7 @@ void stereo_icBWE_enc( } /* resets done here. Need to move them to a separate function */ - if ( ( hStereoICBWE->prev_refChanIndx_bwe != hStereoICBWE->refChanIndx_bwe ) || ( st->last_extl != st->extl ) || st->flag_ACELP16k != 1 ) /* IVAS-219: QCToDo: dont reset for SWB<->FB */ + if ( ( hStereoICBWE->prev_refChanIndx_bwe != hStereoICBWE->refChanIndx_bwe ) || ( st->last_extl != st->extl ) || st->flag_ACELP16k != 1 ) { hStereoICBWE->prevSpecMapping = 0; hStereoICBWE->memShbSpecMapping = 0; -- GitLab From 4654968cc25ba524913493b9a9bbe4c598017be2 Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Fri, 28 Jul 2023 11:21:14 +1000 Subject: [PATCH 534/591] Uncomment split rendering tests with MASA input and MC 160kbps --- tests/renderer/constants.py | 4 +- tests/split_rendering/constants.py | 14 ++-- tests/split_rendering/test_split_rendering.py | 65 ++++++------------- .../test_split_rendering_be_comparison.py | 62 ++++++------------ 4 files changed, 49 insertions(+), 96 deletions(-) diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index 877a1454c2..4967f66da6 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -164,9 +164,7 @@ FORMAT_TO_METADATA_FILES = { INPUT_FORMATS_AMBI = ["FOA", "HOA2", "HOA3"] INPUT_FORMATS_MC = ["MONO", "STEREO", "5_1", "5_1_2", "5_1_4", "7_1", "7_1_4"] INPUT_FORMATS_ISM = ["ISM1", "ISM2", "ISM3", "ISM4"] -INPUT_FORMATS_MASA = [ - "MASA2" -] # ["MASA1", "MASA2"] # Disable MASA1 tests until MASA1 can be implemented properly +INPUT_FORMATS_MASA = ["MASA1", "MASA2"] """ Non binaural / parametric output formats """ OUTPUT_FORMATS = [ diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index e50d916cf6..e500f526d2 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -82,8 +82,8 @@ FORMAT_TO_IVAS_COD_FORMAT = { "FOA": ["-sba", "1"], "HOA2": ["-sba", "2"], "HOA3": ["-sba", "3"], - # "MASA1": ["-masa", "1"], - # "MASA2": ["-masa", "2"], + "MASA1": ["-masa", "1"], + "MASA2": ["-masa", "2"], } FORMAT_TO_NCHAN = { @@ -101,16 +101,14 @@ FORMAT_TO_NCHAN = { "FOA": 4, "HOA2": 9, "HOA3": 16, - # "MASA1": 1, - # "MASA2": 2, + "MASA1": 1, + "MASA2": 2, } IVAS_BITRATES_AMBI = ["96000", "512000"] -IVAS_BITRATES_MC = ["128000", "384000"] -# TODO: Enable after MC 160kbps split rendering support -# IVAS_BITRATES_MC = ["128000", "160000", "384000"] +IVAS_BITRATES_MC = ["128000", "160000", "384000"] IVAS_BITRATES_ISM = ["128000"] -# IVAS_BITRATES_MASA = ["128000"] +IVAS_BITRATES_MASA = ["24400", "128000"] IVAS_MAX_ISM_BITRATE = { "1": "128000", diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 82e8a0ac58..ecfa875f4a 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -83,8 +83,6 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): if "0dof_768k_default" in render_config: pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - if in_fmt in ("MONO", "STEREO",): - pytest.xfail("Split Rendering currently not supported with MONO or STEREO") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -105,8 +103,6 @@ def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): if "0dof_768k_default" in render_config: pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - if in_fmt in ("MONO", "STEREO",): - pytest.xfail("Split Rendering currently not supported with MONO or STEREO") post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -166,43 +162,24 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): """ MASA """ -# TODO - - -# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) -# @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) -# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) -# def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): -# if "0dof_768k_lc3plus" in render_config: -# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - -# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") -# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - -# run_full_chain_split_rendering( -# in_fmt=in_fmt, -# bitrate=bitrate, -# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), -# pre_trajectory=pre_trajectory, -# post_trajectory=post_trajectory, -# output_path_base=OUTPUT_PATH_CUT, -# ) - -# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) -# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) -# def test_masa_external_split(test_info, in_fmt, render_config, trajectory): -# if "0dof_768k_lc3plus" in render_config: -# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - -# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") -# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - -# run_external_split_rendering( -# in_fmt=in_fmt, -# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), -# pre_trajectory=pre_trajectory, -# post_trajectory=post_trajectory, -# output_path_base=OUTPUT_PATH_CUT, -# ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) +def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_lc3plus" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + run_full_chain_split_rendering( + in_fmt=in_fmt, + bitrate=bitrate, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + output_path_base=OUTPUT_PATH_CUT, + ) diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py index 70ee753af2..3cd037233a 100644 --- a/tests/split_rendering/test_split_rendering_be_comparison.py +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -162,44 +162,24 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): """ MASA """ -# TODO - - -# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) -# @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) -# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) -# def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): -# if "0dof_768k_lc3plus" in render_config: -# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - -# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") -# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - -# compare_full_chain_split_args( -# test_info, -# in_fmt=in_fmt, -# bitrate=bitrate, -# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), -# pre_trajectory=pre_trajectory, -# post_trajectory=post_trajectory, -# ) - - -# @pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) -# @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) -# @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) -# def test_masa_external_split(test_info, in_fmt, render_config, trajectory): -# if "0dof_768k_lc3plus" in render_config: -# pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - -# post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") -# pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") - -# compare_external_split_args( -# test_info, -# in_fmt=in_fmt, -# render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), -# pre_trajectory=pre_trajectory, -# post_trajectory=post_trajectory, -# ) + + +@pytest.mark.parametrize("trajectory", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA) +@pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) +def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): + if "0dof_768k_lc3plus" in render_config: + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + + post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") + pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") + + compare_full_chain_split_args( + test_info, + in_fmt=in_fmt, + bitrate=bitrate, + render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"), + pre_trajectory=pre_trajectory, + post_trajectory=post_trajectory, + ) -- GitLab From 2ceeb4d4aaee7dbd51ea619b68c888518bbf239f Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Fri, 28 Jul 2023 11:29:02 +1000 Subject: [PATCH 535/591] Remove unused split rendering scripts, renderer configs, and trajectories --- .../split_renderer_config_384_3dof.txt | 11 -- .../split_renderer_config_384_3dof_hq.txt | 11 -- .../split_renderer_config_512_2dof.txt | 11 -- .../split_renderer_config_768_1dof.txt | 11 -- ...t_renderer_config_768_1dof_hoa_lc3plus.txt | 11 -- .../split_renderer_config_768_2dof.txt | 11 -- .../split_renderer_config_fc_384_3dof.txt | 11 -- .../split_renderer_config_fc_384_3dof_hq.txt | 11 -- .../split_renderer_config_fc_512_2dof.txt | 11 -- .../split_renderer_config_fc_768_1dof.txt | 11 -- .../split_renderer_config_pcm_1dof.txt | 10 -- .../split_renderer_config_pcm_2dof.txt | 10 -- .../split_renderer_config_pcm_3dof.txt | 10 -- .../split_renderer_config_pcm_3dof_hq.txt | 10 -- .../sample_split_rend_script_ivas_enc_dec.py | 138 -------------- ...mple_split_rend_script_ivas_enc_dec_ism.py | 170 ------------------ .../sample_split_rend_script_ivas_rend.py | 147 --------------- .../sample_split_rend_script_ivas_rend_ism.py | 151 ---------------- .../sample_split_rend_script_ivas_rend_mc.py | 145 --------------- .../post-renderer_pose_files/post_0static.csv | 4 - .../pre_pitch-20static.csv | 4 - .../pre_pitch20static.csv | 4 - .../pre_roll-20static.csv | 4 - .../pre_roll20static.csv | 4 - .../pre_yaw-20pitch-20static.csv | 4 - .../pre_yaw-20static.csv | 4 - .../pre_yaw20pitch20static.csv | 4 - .../pre_yaw20static.csv | 4 - 28 files changed, 937 deletions(-) delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt delete mode 100644 Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt delete mode 100644 Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py delete mode 100644 Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py delete mode 100644 Workspace_msvc/sample_split_rend_script_ivas_rend.py delete mode 100644 Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py delete mode 100644 Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py delete mode 100644 Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv delete mode 100644 Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt deleted file mode 100644 index 0889c6f2d0..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt deleted file mode 100644 index fb8adf64cf..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_384_3dof_hq.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 1; -CODEC = LCLD; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt deleted file mode 100644 index ec4418eca3..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 512000; -DOF = 2; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt deleted file mode 100644 index 02b4665e72..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt deleted file mode 100644 index ca6fbaf9d3..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; -CODEC = LC3PLUS; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt deleted file mode 100644 index 8aaccb64fe..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_768_2dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 2; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt deleted file mode 100644 index dccf44a9f3..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt deleted file mode 100644 index 5a9770e61d..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_384_3dof_hq.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 3; -HQMODE = 1; -CODEC = LCLD; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; \ No newline at end of file diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt deleted file mode 100644 index 112177d636..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_512_2dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 512000; -DOF = 2; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt deleted file mode 100644 index 68221b269e..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_fc_768_1dof.txt +++ /dev/null @@ -1,11 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 1; -HQMODE = 0; -CODEC = LCLD; - -[GENERAL] -RENDERER = FASTCONV; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt deleted file mode 100644 index d956b90ce6..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_1dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 256000; -DOF = 1; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt deleted file mode 100644 index d8eb266458..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_2dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 384000; -DOF = 2; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt deleted file mode 100644 index e8c9088862..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 512000; -DOF = 3; -HQMODE = 0; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt b/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt deleted file mode 100644 index 4e38b77145..0000000000 --- a/Workspace_msvc/renderer_configs/split_renderer_config_pcm_3dof_hq.txt +++ /dev/null @@ -1,10 +0,0 @@ -[SPLITREND] -BITRATE = 768000; -DOF = 3; -HQMODE = 1; - -[GENERAL] -RENDERER = CREND; - -[ROOMACOUSTICS] -REVERB = FALSE; diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py deleted file mode 100644 index 2c545b4239..0000000000 --- a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec.py +++ /dev/null @@ -1,138 +0,0 @@ -from scipy.io.wavfile import read, write -from scipy import signal -import subprocess -import numpy as np -import sys -import os - -## dimension of following 2 arrays should be same, that is for each file name there should be a tag -file_names = [ -'../scripts/testv/stv3OA48c.wav' -]; -file_tags = [ -'test_HOA3' -]; - -## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag -pre_hr_file_names = [ -'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' -]; -post_hr_file_names = [ -'trajectories/post-renderer_pose_files/post_0static.csv' -]; -hr_file_tags = [ -'yaw20static' -]; - -renderers = [ -('fast_conv_768_1dof', 'renderer_configs/split_renderer_config_fc_768_1dof.txt', '0'), -('fast_conv_512_2dof', 'renderer_configs/split_renderer_config_fc_512_2dof.txt', '0'), -('fast_conv_384_3dof', 'renderer_configs/split_renderer_config_fc_384_3dof.txt', '0'), -('fast_conv_384_3dof_hq', 'renderer_configs/split_renderer_config_fc_384_3dof_hq.txt', '0')]; - - -split_rend_file_outs = ['recons_out_pos0.wav', - 'recons_out_pos1.wav', - 'recons_out_pos2.wav', - 'rotated_ref_pos0.wav', - 'rotated_ref_pos1.wav', - 'rotated_ref_pos2.wav', - 'rotated_ref_RefPos.wav', - 'split_rend_MD_bitrate.txt'] - -def check_and_makedir(dir_path): - if not os.path.exists(dir_path): - try: - os.makedirs(dir_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise # raises the error again - - -def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): - check_and_makedir(out_dir); - for idx in range(0, len(file_tags)): - for hr_idx in range(0, len(hr_file_tags)): - for rend in range(0, len(renderers)): - bitrate = '384000'; - filename = file_names[idx]; - file_in = os.path.join(file_dir, filename); - enc_exe = os.path.join(exe_dir, 'IVAS_cod.exe'); - dec_exe = os.path.join(exe_dir, 'IVAS_dec.exe'); - rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); - file_pkt_name = '_'.join([file_tags[idx], bitrate, 'out.pkt']); - file_pkt = os.path.join(out_dir, file_pkt_name); - file_out_name = '_'.join([file_tags[idx], bitrate, renderers[rend][0], 'out.wav']); - file_out = os.path.join(out_dir, file_out_name); - bs_file_out_name = '_'.join([file_tags[idx], '_ivas_dec_out.pkt']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - - print(file_in) - print(file_pkt) - print(bs_file_out) - print(file_out) - - enc_cmd = [ - enc_exe, - '-sba', '3', - '-max_band', 'FB', - bitrate, - '48', - file_in, - file_pkt - ] - - hr_pre_file_name = pre_hr_file_names[hr_idx]; - hr_pre_file = os.path.join(file_dir, hr_pre_file_name); - hr_post_file_name = post_hr_file_names[hr_idx]; - hr_post_file = os.path.join(file_dir, hr_post_file_name); - - dec_cmd = [ - dec_exe, - '-RENDER_CONFIG', renderers[rend][1], - '-t', hr_pre_file, - 'BINAURAL_SPLIT_CODED', - '48', - file_pkt, - bs_file_out - ] - print(enc_cmd) - print(dec_cmd) - test_status = subprocess.call(enc_cmd, shell=False) - test_status = subprocess.call(dec_cmd, shell=False) - - post_rend_cmd = [ - rend_exe, - '-i', bs_file_out, - '-if', 'BINAURAL_SPLIT_CODED', - '-o', file_out, - '-of', 'BINAURAL', - '-fs', '48', - '-tf', hr_post_file, - ] - print(post_rend_cmd) - test_status = subprocess.call(post_rend_cmd, shell=False) - - if os.path.isfile(file_pkt): - os.remove(file_pkt) - - if os.path.exists(bs_file_out): - os.remove(bs_file_out); - - for fo in split_rend_file_outs: - file_old = os.path.join(os. getcwd(), fo); - file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], fo]); - file_new = os.path.join(out_dir, file_out_name); - if os.path.exists(file_old): - os.rename(file_old, file_new); - - -def main(argv): - print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') - if len(argv) < 3: - return print(len(argv)) - return generate_split_rend_lis_items(*argv[1:]) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py b/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py deleted file mode 100644 index 61c9d65963..0000000000 --- a/Workspace_msvc/sample_split_rend_script_ivas_enc_dec_ism.py +++ /dev/null @@ -1,170 +0,0 @@ -from scipy.io.wavfile import read, write -from scipy import signal -import subprocess -import numpy as np -import sys -import os - -## dimension of following 2 arrays should be same, that is for each file name there should be a tag -file_names = [ -'../scripts/testv/stv4ISM48s.wav' -]; -ism_md_file_names = [ -'../scripts/testv/stvISM1.csv', -'../scripts/testv/stvISM2.csv', -'../scripts/testv/stvISM3.csv', -'../scripts/testv/stvISM4.csv' -]; -file_tags = [ -'test_ISM' -]; - -## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag -pre_hr_file_names = [ -'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' -]; -post_hr_file_names = [ -'trajectories/post-renderer_pose_files/post_0static.csv' -]; -hr_file_tags = [ -'yaw20static' -]; - -renderers = [ -('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), -('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), -('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), -('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), -('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), -('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), -('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), -('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), -('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; - -split_md_file_name = 'split_md.bin'; - -split_rend_file_outs = ['recons_out_pos0.wav', - 'recons_out_pos1.wav', - 'recons_out_pos2.wav', - 'rotated_ref_pos0.wav', - 'rotated_ref_pos1.wav', - 'rotated_ref_pos2.wav', - 'rotated_ref_RefPos.wav', - 'split_rend_MD_bitrate.txt'] - - -def check_and_makedir(dir_path): - if not os.path.exists(dir_path): - try: - os.makedirs(dir_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise # raises the error again - - -def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): - check_and_makedir(out_dir); - for idx in range(0, len(file_tags)): - for hr_idx in range(0, len(hr_file_tags)): - for rend in range(0, len(renderers)): - bitrate = '384000'; - filename = file_names[idx]; - file_in = os.path.join(file_dir, filename); - enc_exe = os.path.join(exe_dir, 'IVAS_cod.exe'); - dec_exe = os.path.join(exe_dir, 'IVAS_dec.exe'); - rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); - file_pkt_name = '_'.join([file_tags[idx], bitrate, 'out.pkt']); - file_pkt = os.path.join(out_dir, file_pkt_name); - if renderers[rend][2] == '0': - bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CODED'; - else: - bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_PCM'; - md_out_arg = ['-om', split_md_file_name]; - md_in_arg = ['-im', split_md_file_name]; - file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); - file_out = os.path.join(out_dir, file_out_name); - - print(file_in) - print(bs_file_out) - print(file_out) - print(file_pkt) - - hr_pre_file_name = pre_hr_file_names[hr_idx]; - hr_pre_file = os.path.join(file_dir, hr_pre_file_name); - hr_post_file_name = post_hr_file_names[hr_idx]; - hr_post_file = os.path.join(file_dir, hr_post_file_name); - - enc_cmd = [ - enc_exe, - '-ism', '4', ism_md_file_names[0], ism_md_file_names[1], ism_md_file_names[2], ism_md_file_names[3], - '-max_band', 'FB', - bitrate, - '48', - file_in, - file_pkt - ] - - print(enc_cmd) - test_status = subprocess.call(enc_cmd, shell=False) - - dec_cmd = [ - dec_exe, - '-RENDER_CONFIG', renderers[rend][1], - md_out_arg[0], md_out_arg[1], - '-t', hr_pre_file, - out_fmt, - '48', - file_pkt, - bs_file_out - ] - - print(dec_cmd) - test_status = subprocess.call(dec_cmd, shell=False) - - - post_rend_cmd = [ - rend_exe, - md_in_arg[0], md_in_arg[1], - '-i', bs_file_out, - '-if', out_fmt, - '-o', file_out, - '-of', 'BINAURAL', - '-fs', '48', - '-tf', hr_post_file, - ] - - - print(post_rend_cmd) - test_status = subprocess.call(post_rend_cmd, shell=False) - - if os.path.exists(file_pkt): - os.remove(file_pkt); - - if os.path.exists(bs_file_out): - os.remove(bs_file_out); - - if os.path.exists(split_md_file_name): - os.remove(split_md_file_name); - - - for fo in split_rend_file_outs: - file_old = os.path.join(os. getcwd(), fo); - file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); - file_new = os.path.join(out_dir, file_out_name); - if os.path.exists(file_old): - os.rename(file_old, file_new); - - -def main(argv): - print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') - if len(argv) < 3: - return print(len(argv)) - return generate_split_rend_lis_items(*argv[1:]) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend.py b/Workspace_msvc/sample_split_rend_script_ivas_rend.py deleted file mode 100644 index fe81a2c39d..0000000000 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend.py +++ /dev/null @@ -1,147 +0,0 @@ -from scipy.io.wavfile import read, write -from scipy import signal -import subprocess -import numpy as np -import sys -import os - -## dimension of following 2 arrays should be same, that is for each file name there should be a tag -file_names = [ -'../scripts/testv/stv3OA48c.wav' -]; -file_tags = [ -'test_HOA3' -]; - -## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag -pre_hr_file_names = [ -'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' -]; -post_hr_file_names = [ -'trajectories/post-renderer_pose_files/post_0static.csv' -]; -hr_file_tags = [ -'yaw20static' -]; - -renderers = [ -('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), -('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), -('fast_conv_768_1dof', 'renderer_configs/split_renderer_config_fc_768_1dof.txt', '0'), -('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), -('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), -('fast_conv_512_2dof', 'renderer_configs/split_renderer_config_fc_512_2dof.txt', '0'), -('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), -('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), -('fast_conv_384_3dof', 'renderer_configs/split_renderer_config_fc_384_3dof.txt', '0'), -('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), -('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), -('fast_conv_384_3dof_hq', 'renderer_configs/split_renderer_config_fc_384_3dof_hq.txt', '0')]; - -split_md_file_name = 'split_md.bin'; - -split_rend_file_outs = ['recons_out_pos0.wav', - 'recons_out_pos1.wav', - 'recons_out_pos2.wav', - 'rotated_ref_pos0.wav', - 'rotated_ref_pos1.wav', - 'rotated_ref_pos2.wav', - 'rotated_ref_RefPos.wav', - 'split_rend_MD_bitrate.txt'] - - -def check_and_makedir(dir_path): - if not os.path.exists(dir_path): - try: - os.makedirs(dir_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise # raises the error again - - -def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): - check_and_makedir(out_dir); - for idx in range(0, len(file_tags)): - for hr_idx in range(0, len(hr_file_tags)): - for rend in range(0, len(renderers)): - filename = file_names[idx]; - file_in = os.path.join(file_dir, filename); - rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); - if renderers[rend][2] == '0': - bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CODED'; - else: - bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_PCM'; - md_out_arg = ['-om', split_md_file_name]; - md_in_arg = ['-im', split_md_file_name]; - file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); - file_out = os.path.join(out_dir, file_out_name); - - print(file_in) - print(bs_file_out) - print(file_out) - - hr_pre_file_name = pre_hr_file_names[hr_idx]; - hr_pre_file = os.path.join(file_dir, hr_pre_file_name); - hr_post_file_name = post_hr_file_names[hr_idx]; - hr_post_file = os.path.join(file_dir, hr_post_file_name); - - pre_rend_cmd = [ - rend_exe, - '-rc', renderers[rend][1], - md_out_arg[0], md_out_arg[1], - '-i', file_in, - '-if', 'HOA3', - '-o', bs_file_out, - '-of', out_fmt, - '-fs', '48', - '-tf', hr_pre_file, - ] - - - print(pre_rend_cmd) - test_status = subprocess.call(pre_rend_cmd, shell=False) - - - post_rend_cmd = [ - rend_exe, - md_in_arg[0], md_in_arg[1], - '-i', bs_file_out, - '-if', out_fmt, - '-o', file_out, - '-of', 'BINAURAL', - '-fs', '48', - '-tf', hr_post_file, - ] - - - print(post_rend_cmd) - test_status = subprocess.call(post_rend_cmd, shell=False) - - if os.path.exists(bs_file_out): - os.remove(bs_file_out); - - if os.path.exists(split_md_file_name): - os.remove(split_md_file_name); - - - for fo in split_rend_file_outs: - file_old = os.path.join(os. getcwd(), fo); - file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); - file_new = os.path.join(out_dir, file_out_name); - if os.path.exists(file_old): - os.rename(file_old, file_new); - - -def main(argv): - print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') - if len(argv) < 3: - return print(len(argv)) - return generate_split_rend_lis_items(*argv[1:]) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py b/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py deleted file mode 100644 index e4e4c5beba..0000000000 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py +++ /dev/null @@ -1,151 +0,0 @@ -from scipy.io.wavfile import read, write -from scipy import signal -import subprocess -import numpy as np -import sys -import os - -## dimension of following 2 arrays should be same, that is for each file name there should be a tag -file_names = [ -'../scripts/testv/stv4ISM48s.wav' -]; -ism_md_file_names = [ -'../scripts/testv/stvISM1.csv', -'../scripts/testv/stvISM2.csv', -'../scripts/testv/stvISM3.csv', -'../scripts/testv/stvISM4.csv' -]; -file_tags = [ -'test_ISM' -]; - -## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag -pre_hr_file_names = [ -'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' -]; -post_hr_file_names = [ -'trajectories/post-renderer_pose_files/post_0static.csv' -]; -hr_file_tags = [ -'yaw20static' -]; - -renderers = [ -('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), -('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), -('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), -('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), -('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), -('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), -('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), -('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), -('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; - -split_md_file_name = 'split_md.bin'; - -split_rend_file_outs = ['recons_out_pos0.wav', - 'recons_out_pos1.wav', - 'recons_out_pos2.wav', - 'rotated_ref_pos0.wav', - 'rotated_ref_pos1.wav', - 'rotated_ref_pos2.wav', - 'rotated_ref_RefPos.wav', - 'split_rend_MD_bitrate.txt'] - - -def check_and_makedir(dir_path): - if not os.path.exists(dir_path): - try: - os.makedirs(dir_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise # raises the error again - - -def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): - check_and_makedir(out_dir); - for idx in range(0, len(file_tags)): - for hr_idx in range(0, len(hr_file_tags)): - for rend in range(0, len(renderers)): - filename = file_names[idx]; - file_in = os.path.join(file_dir, filename); - rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); - if renderers[rend][2] == '0': - bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CODED'; - else: - bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_PCM'; - md_out_arg = ['-om', split_md_file_name]; - md_in_arg = ['-im', split_md_file_name]; - file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); - file_out = os.path.join(out_dir, file_out_name); - - print(file_in) - print(bs_file_out) - print(file_out) - - hr_pre_file_name = pre_hr_file_names[hr_idx]; - hr_pre_file = os.path.join(file_dir, hr_pre_file_name); - hr_post_file_name = post_hr_file_names[hr_idx]; - hr_post_file = os.path.join(file_dir, hr_post_file_name); - - pre_rend_cmd = [ - rend_exe, - '-rc', renderers[rend][1], - md_out_arg[0], md_out_arg[1], - '-i', file_in, - '-if', 'ISM4', - '-im', ism_md_file_names[0], ism_md_file_names[1], ism_md_file_names[2], ism_md_file_names[3], - '-o', bs_file_out, - '-of', out_fmt, - '-fs', '48', - '-tf', hr_pre_file, - ] - - - print(pre_rend_cmd) - test_status = subprocess.call(pre_rend_cmd, shell=False) - - - post_rend_cmd = [ - rend_exe, - md_in_arg[0], md_in_arg[1], - '-i', bs_file_out, - '-if', out_fmt, - '-o', file_out, - '-of', 'BINAURAL', - '-fs', '48', - '-tf', hr_post_file, - ] - - - print(post_rend_cmd) - test_status = subprocess.call(post_rend_cmd, shell=False) - - if os.path.exists(bs_file_out): - os.remove(bs_file_out); - - if os.path.exists(split_md_file_name): - os.remove(split_md_file_name); - - - for fo in split_rend_file_outs: - file_old = os.path.join(os. getcwd(), fo); - file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); - file_new = os.path.join(out_dir, file_out_name); - if os.path.exists(file_old): - os.rename(file_old, file_new); - - -def main(argv): - print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') - if len(argv) < 3: - return print(len(argv)) - return generate_split_rend_lis_items(*argv[1:]) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py b/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py deleted file mode 100644 index ba258091f9..0000000000 --- a/Workspace_msvc/sample_split_rend_script_ivas_rend_mc.py +++ /dev/null @@ -1,145 +0,0 @@ -from scipy.io.wavfile import read, write -from scipy import signal -import subprocess -import numpy as np -import sys -import os - -## dimension of following 2 arrays should be same, that is for each file name there should be a tag -file_names = [ -'../scripts/testv/stv714MC48c.wav' -]; - -file_tags = [ -'test_MC714' -]; - -## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag -pre_hr_file_names = [ -'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' -]; -post_hr_file_names = [ -'trajectories/post-renderer_pose_files/post_0static.csv' -]; -hr_file_tags = [ -'yaw20static' -]; - -renderers = [ -('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), -('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), -('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), -('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), -('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), -('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), -('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), -('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), -('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; - -split_md_file_name = 'split_md.bin'; - -split_rend_file_outs = ['recons_out_pos0.wav', - 'recons_out_pos1.wav', - 'recons_out_pos2.wav', - 'rotated_ref_pos0.wav', - 'rotated_ref_pos1.wav', - 'rotated_ref_pos2.wav', - 'rotated_ref_RefPos.wav', - 'split_rend_MD_bitrate.txt'] - - -def check_and_makedir(dir_path): - if not os.path.exists(dir_path): - try: - os.makedirs(dir_path) - except OSError as e: - if e.errno != errno.EEXIST: - raise # raises the error again - - -def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): - check_and_makedir(out_dir); - for idx in range(0, len(file_tags)): - for hr_idx in range(0, len(hr_file_tags)): - for rend in range(0, len(renderers)): - filename = file_names[idx]; - file_in = os.path.join(file_dir, filename); - rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); - if renderers[rend][2] == '0': - bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_CODED'; - else: - bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); - bs_file_out = os.path.join(out_dir, bs_file_out_name); - out_fmt = 'BINAURAL_SPLIT_PCM'; - md_out_arg = ['-om', split_md_file_name]; - md_in_arg = ['-im', split_md_file_name]; - file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); - file_out = os.path.join(out_dir, file_out_name); - - print(file_in) - print(bs_file_out) - print(file_out) - - hr_pre_file_name = pre_hr_file_names[hr_idx]; - hr_pre_file = os.path.join(file_dir, hr_pre_file_name); - hr_post_file_name = post_hr_file_names[hr_idx]; - hr_post_file = os.path.join(file_dir, hr_post_file_name); - - pre_rend_cmd = [ - rend_exe, - '-rc', renderers[rend][1], - md_out_arg[0], md_out_arg[1], - '-i', file_in, - '-if', '7_1_4', - '-o', bs_file_out, - '-of', out_fmt, - '-fs', '48', - '-tf', hr_pre_file, - ] - - - print(pre_rend_cmd) - test_status = subprocess.call(pre_rend_cmd, shell=False) - - - post_rend_cmd = [ - rend_exe, - md_in_arg[0], md_in_arg[1], - '-i', bs_file_out, - '-if', out_fmt, - '-o', file_out, - '-of', 'BINAURAL', - '-fs', '48', - '-tf', hr_post_file, - ] - - - print(post_rend_cmd) - test_status = subprocess.call(post_rend_cmd, shell=False) - - if os.path.exists(bs_file_out): - os.remove(bs_file_out); - - if os.path.exists(split_md_file_name): - os.remove(split_md_file_name); - - - for fo in split_rend_file_outs: - file_old = os.path.join(os. getcwd(), fo); - file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); - file_new = os.path.join(out_dir, file_out_name); - if os.path.exists(file_old): - os.rename(file_old, file_new); - - -def main(argv): - print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') - if len(argv) < 3: - return print(len(argv)) - return generate_split_rend_lis_items(*argv[1:]) - - -if __name__ == "__main__": - sys.exit(main(sys.argv)) \ No newline at end of file diff --git a/Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv b/Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv deleted file mode 100644 index a292a3576c..0000000000 --- a/Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,0,0,0 --3,0,0,0 --3,0,0,0 --3,0,0,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv deleted file mode 100644 index dab3c6940a..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch-20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,0,-20,0 --3,0,-20,0 --3,0,-20,0 --3,0,-20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv deleted file mode 100644 index ae6ac9cd9c..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_pitch20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,0,20,0 --3,0,20,0 --3,0,20,0 --3,0,20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv deleted file mode 100644 index 5db0b1cab3..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll-20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,0,0,-20 --3,0,0,-20 --3,0,0,-20 --3,0,0,-20 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv deleted file mode 100644 index 5bd8c2c4d9..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_roll20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,0,0,20 --3,0,0,20 --3,0,0,20 --3,0,0,20 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv deleted file mode 100644 index e48c0a58f5..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20pitch-20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,-20,-20,0 --3,-20,-20,0 --3,-20,-20,0 --3,-20,-20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv deleted file mode 100644 index 6e446847a9..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,-20,0,0 --3,-20,0,0 --3,-20,0,0 --3,-20,0,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv deleted file mode 100644 index 58788cc7de..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20pitch20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,20,20,0 --3,20,20,0 --3,20,20,0 --3,20,20,0 diff --git a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv b/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv deleted file mode 100644 index 2d674f971b..0000000000 --- a/Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw20static.csv +++ /dev/null @@ -1,4 +0,0 @@ --3,20,0,0 --3,20,0,0 --3,20,0,0 --3,20,0,0 -- GitLab From 9f6e86f9dfe9c56d6094e8dce4ebb0f12c46930f Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Fri, 28 Jul 2023 12:10:08 +1000 Subject: [PATCH 536/591] Revert the uncommenting of MASA1 input format in tests/renderer/constants.py --- tests/renderer/constants.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index 4967f66da6..877a1454c2 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -164,7 +164,9 @@ FORMAT_TO_METADATA_FILES = { INPUT_FORMATS_AMBI = ["FOA", "HOA2", "HOA3"] INPUT_FORMATS_MC = ["MONO", "STEREO", "5_1", "5_1_2", "5_1_4", "7_1", "7_1_4"] INPUT_FORMATS_ISM = ["ISM1", "ISM2", "ISM3", "ISM4"] -INPUT_FORMATS_MASA = ["MASA1", "MASA2"] +INPUT_FORMATS_MASA = [ + "MASA2" +] # ["MASA1", "MASA2"] # Disable MASA1 tests until MASA1 can be implemented properly """ Non binaural / parametric output formats """ OUTPUT_FORMATS = [ -- GitLab From 3471be7f002d51385e4e6b669d0885ca38c24d37 Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Fri, 28 Jul 2023 15:42:16 +1000 Subject: [PATCH 537/591] Add README.md for split rendering tests --- tests/split_rendering/README.md | 104 ++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 tests/split_rendering/README.md diff --git a/tests/split_rendering/README.md b/tests/split_rendering/README.md new file mode 100644 index 0000000000..27dad9f32d --- /dev/null +++ b/tests/split_rendering/README.md @@ -0,0 +1,104 @@ + + +# IVAS Split Rendering Tests +The IVAS split rendering tests are implemented using `pytest`. + +## Overview +The split rendering tests consist of: +* Smoke tests +* BE (bit exact) comparison tests + +The tests cover the following IVAS formats: +* Ambisonics +* Multi-Channel +* ISM +* MASA + +The tests include both split rendering operating modes: +* Full chain: encoder, decoder, external renderer +* External: external renderer only + +Note: MASA format only supports the full chain split rendering mode. + +Furthermore, the tests iterate over the following parameters: +* Renderer config file which specifies DoF (degrees of freedom), split rendering bitrate, and split rendering codec +* Trajectory file +* Encoder/decoder bitrate (only for full-chain split rendering mode) + +## Directory Structure + +``` +ivas-codec +├── tests +| ├── split_rendering +| | ├── test_split_rendering.py -> split rendering smoke tests +| | ├── test_split_rendering_be_comparison.py -> split rendering BE comparison tests +| | ├── constants.py -> split rendering constants +| | ├── utils.py -> split rendering functions +| | └── renderer_configs -> directory of render config files +| └── renderer +| ├── constants.py -> renderer constants +| └── utils.py -> renderer functions +└── scripts + └── trajectories -> directory of trajectory files +``` + +## Running Tests +### Smoke Tests +```bash +python3 -m pytest -n auto -rA tests/split_rendering/test_split_rendering.py +``` + +### BE Comparison Tests +```bash +python3 -m pytest -n auto -rA tests/split_rendering/test_split_rendering_be_comparison.py +``` + +## Useful pytest Options + +* `-h`: Help options +* `-n N`: Run tests in parallel using `N` processes (requires `pytest-xdist` package) +* `-rA`: Report all test results +* `-k KEYWORD`: Only run tests which match `KEYWORD` +* `--collect-only`: Only collect tests without running them + +## Example Commands for Split Rendering + +Commands executed for a test can be found from the corresponding test output. + +### Full Chain Split Rendering - Ambisonics HOA3 +```bash +IVAS_cod -sba 3 512000 48 tests/renderer/data/spectral_test_16ch_48kHz.wav ivas.192 + +IVAS_dec -T scripts/trajectories/rotate_yaw_pitch_roll1_delayed.csv -render_config tests/split_rendering/renderer_configs/split_renderer_config_3dof_768k_default.txt BINAURAL_SPLIT_CODED 48 ivas.192 split.bit + +IVAS_rend -fs 48 -i split.bit -if BINAURAL_SPLIT_CODED -o tests/split_rendering/cut/HOA3_512000bps_rotate_yaw_pitch_roll1_delayed_split_full_rotate_yaw_pitch_roll1__config_split_renderer_config_3dof_768k_default.wav -of BINAURAL -tf scripts/trajectories/rotate_yaw_pitch_roll1.csv +``` -- GitLab From 419227735cc20f86cbe01ae1fe7ef1b8f432613d Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 28 Jul 2023 19:12:52 +1000 Subject: [PATCH 538/591] bitrate switching fixes, MASA ext renderer fixes, clean up --- lib_com/ivas_prot.h | 6 + lib_dec/ivas_dirac_dec.c | 33 +--- lib_dec/ivas_init_dec.c | 302 ++++++++++++++++++------------- lib_dec/ivas_ism_dec.c | 16 +- lib_dec/ivas_mct_dec.c | 10 +- lib_dec/ivas_output_config.c | 12 +- lib_dec/ivas_sba_dec.c | 27 --- lib_rend/ivas_splitRendererPre.c | 26 ++- lib_rend/lib_rend.c | 106 ++++++++--- 9 files changed, 321 insertions(+), 217 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 885de08281..9cf8c3e168 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -314,6 +314,12 @@ ivas_error ivas_dec( #endif ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +ivas_error ivas_dec_init_split_rend( + Decoder_Struct *st_ivas /* i : IVAS decoder structure */ +); +#endif + 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) */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index e9443fda32..2c495a4b35 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -874,43 +874,12 @@ ivas_error ivas_dirac_dec_config( { if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - /* populate pMultiBinPoseData with the additional poses determined from the DoF */ - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - } -#endif if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - /* TODO: can we keep isRenderingInTd fixed? */ - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, - 0, /* isRenderingInTd */ - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* pcm_out */ - - error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - st_ivas->hDecoderConfig->output_Fs, - 1, /* is_cldfb_in */ - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); /* is_pcm_out */ - - if ( error != IVAS_ERR_OK ) - { - return error; - } - } -#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN if ( st_ivas->hDiracDecBin[0] == NULL ) #else diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d5c385e24d..1bb5ed5e2d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -53,7 +53,159 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_read ); static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); +#ifdef SPLIT_REND_WITH_HEAD_ROT +static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas ); +#endif + +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*-------------------------------------------------------------------* + * ivas_dec_reconfig_split_rend() + * + * IVAS decoder split rend reconfig + *-------------------------------------------------------------------*/ +static ivas_error ivas_dec_reconfig_split_rend( + Decoder_Struct *st_ivas /* i : IVAS decoder structure */ +) +{ + ivas_error error; + int16_t cldfb_in, num_ch, ch, isCldfbNeeded, i, pcm_out; + SPLIT_REND_WRAPPER *hSplitRendWrapper; + CLDFB_TYPE cldfbMode; + + hSplitRendWrapper = &st_ivas->splitBinRend.splitrend; + pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; + cldfb_in = 0; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || + st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + cldfb_in = 1; + } + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &hSplitRendWrapper->multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + + isCldfbNeeded = 0; + cldfbMode = CLDFB_ANALYSIS; + if ( st_ivas->renderer_type != RENDERER_DISABLE ) + { + if ( cldfb_in == 0 ) + { + isCldfbNeeded = 1; + cldfbMode = CLDFB_ANALYSIS; + } + else if ( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && cldfb_in ) + { + isCldfbNeeded = 1; + cldfbMode = CLDFB_SYNTHESIS; + } + else if ( pcm_out && cldfb_in ) + { + isCldfbNeeded = 1; + cldfbMode = CLDFB_SYNTHESIS; + } + } + + if ( isCldfbNeeded == 1 && hSplitRendWrapper->hCldfbHandles == NULL ) + { + if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) ); + } + + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; + for ( ch = 0; ch < num_ch; ch++ ) + { + hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; + } + + num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; + + for ( ch = 0; ch < num_ch; ch++ ) + { + if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), + cldfbMode, + st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) ); + } + } + } + else if ( isCldfbNeeded == 0 && hSplitRendWrapper->hCldfbHandles != NULL ) + { + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; + for ( ch = 0; ch < num_ch; ch++ ) + { + if ( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] != NULL ) + { + deleteCldfb( &hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ); + hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; + } + } + free( hSplitRendWrapper->hCldfbHandles ); + hSplitRendWrapper->hCldfbHandles = NULL; + } + + if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) + { + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + if ( hSplitRendWrapper->hTdRendHandles[i] != NULL ) + { + hSplitRendWrapper->hTdRendHandles[i]->HrFiltSet_p = NULL; + ivas_td_binaural_close( &hSplitRendWrapper->hTdRendHandles[i] ); + } + } + } + + return IVAS_ERR_OK; +} + +/*-------------------------------------------------------------------* + * ivas_dec_init_split_rend() + * + * IVAS decoder split rend init + *-------------------------------------------------------------------*/ +ivas_error ivas_dec_init_split_rend( + Decoder_Struct *st_ivas /* i : IVAS decoder structure */ +) +{ + ivas_error error; + int16_t cldfb_in, pcm_out; + + pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; + cldfb_in = 0; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || + st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + cldfb_in = 1; + } + ivas_renderSplitGetMultiBinPoseData( + &st_ivas->hRenderConfig->split_rend_config, + &st_ivas->splitBinRend.splitrend.multiBinPoseData, + st_ivas->hHeadTrackData->sr_pose_pred_axis ); + if ( cldfb_in == 1 && ( st_ivas->splitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) + { + if ( ( st_ivas->splitBinRend.hCldfbDataOut = (IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) ); + } + } + ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, ( cldfb_in == 0 ), pcm_out ); + + error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, + &st_ivas->hRenderConfig->split_rend_config, + st_ivas->hDecoderConfig->output_Fs, + cldfb_in, pcm_out ); + + return error; +} +#endif /*-------------------------------------------------------------------* * ivas_dec_setup() @@ -313,6 +465,17 @@ ivas_error ivas_dec_setup( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*-----------------------------------------------------------------* + * reconfig split rendering as renderer might change after bitrate switching + *-----------------------------------------------------------------*/ + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + ivas_dec_reconfig_split_rend( st_ivas ); + } +#endif + /*-------------------------------------------------------------------* * Initialize decoder in the first good frame based on IVAS format * and number of transport channels @@ -533,7 +696,6 @@ int16_t getNumChanSynthesis( return n; } - /*-------------------------------------------------------------------* * copy_decoder_config() * @@ -802,6 +964,21 @@ ivas_error ivas_init_decoder( } } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /*-----------------------------------------------------------------* + * Initialize split rendering + *-----------------------------------------------------------------*/ + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + ivas_dec_init_split_rend( st_ivas ); + } + else + { + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses = 1; + } +#endif + /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ @@ -1280,62 +1457,16 @@ ivas_error ivas_init_decoder( /*-------------------------------------------------------------------* * Allocate and initialize rendering handles *--------------------------------------------------------------------*/ - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - if ( st_ivas->splitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) - { - if ( ( st_ivas->splitBinRend.hCldfbDataOut = (IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) ); - } - } - } -#endif if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 0, - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - - error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, - 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - - if ( error != IVAS_ERR_OK ) - { - return error; - } - } -#endif } /* ParamISM is handled separately from other common config */ else if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - } -#endif if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1348,26 +1479,6 @@ ivas_error ivas_init_decoder( { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING - error = -#endif - ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, - 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - -#ifdef FIX_SPLIT_REND_OPEN_ERROR_HANDLING - if ( error != IVAS_ERR_OK ) - { - return error; - } -#endif - } -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -1385,29 +1496,6 @@ ivas_error ivas_init_decoder( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - - error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 0, - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - - if ( error != IVAS_ERR_OK ) - { - return error; - } - } -#endif if ( st_ivas->hDecoderConfig->voip_active ) { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -1443,41 +1531,11 @@ ivas_error ivas_init_decoder( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t num_poses; - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - int16_t pcm_out; - pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, 1, - pcm_out ); - - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - - error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 0, pcm_out ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - num_poses = st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses; - } - else - { - num_poses = 1; - } -#endif - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , - num_poses + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses #endif ) ) != IVAS_ERR_OK ) { @@ -2049,7 +2107,7 @@ void ivas_destroy_dec( ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses #endif ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 485511c23d..11b8b37bc1 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -171,7 +171,11 @@ static ivas_error ivas_ism_bitrate_switching( /* Deallocate the ParamISM struct */ ivas_param_ism_dec_close( &( st_ivas->hDirAC ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { /* close the parametric binaural renderer */ #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN @@ -226,7 +230,7 @@ static ivas_error ivas_ism_bitrate_switching( if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses #endif ) ) != IVAS_ERR_OK ) { @@ -245,7 +249,11 @@ static ivas_error ivas_ism_bitrate_switching( { return error; } - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { /* open the parametric binaural renderer */ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -308,7 +316,7 @@ static ivas_error ivas_ism_bitrate_switching( ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses #endif ); } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index f31aff2327..ed5bd79d7a 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1134,7 +1134,11 @@ static ivas_error ivas_mc_dec_reconfig( output_config = st_ivas->hDecoderConfig->output_config; /* binaural renderers*/ - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { /* remove unneeded binaural renderers */ if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -1151,7 +1155,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses #endif ); } @@ -1225,7 +1229,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index abc9a9012d..0df70ac4d1 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -90,7 +90,11 @@ void ivas_renderer_select( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { #ifdef FIX_571_REVERB_NOT_ACTIVATED_ISM - if ( output_config == AUDIO_CONFIG_BINAURAL ) + if ( output_config == AUDIO_CONFIG_BINAURAL +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) #else if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif @@ -214,7 +218,11 @@ void ivas_renderer_select( if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { *internal_config = output_config; - if ( output_config == AUDIO_CONFIG_BINAURAL ) + if ( output_config == AUDIO_CONFIG_BINAURAL +#ifdef SPLIT_REND_WITH_HEAD_ROT + || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM +#endif + ) { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5659a96b24..e1c95812ac 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -252,42 +252,15 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - ivas_renderSplitGetMultiBinPoseData( - &st_ivas->hRenderConfig->split_rend_config, - &st_ivas->splitBinRend.splitrend.multiBinPoseData, - st_ivas->hHeadTrackData->sr_pose_pred_axis ); - } -#endif /* open fastconv binaural renderer */ if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - assert( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LCLD ); - error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend, - &st_ivas->hRenderConfig->split_rend_config, - hDecoderConfig->output_Fs, 1, ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); - if ( error != IVAS_ERR_OK ) - { - return error; - } - } -#endif } else if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) { ivas_binRenderer_close( &st_ivas->hBinRenderer ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_split_renderer_close( &st_ivas->splitBinRend.splitrend ); -#endif } if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) ) diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index a8c9f3fb6e..83159854ed 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1922,6 +1922,11 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, isCldfbNeeded = 1; cldfbMode = CLDFB_SYNTHESIS; } + else if ( is_pcm_out && is_cldfb_in ) + { + isCldfbNeeded = 1; + cldfbMode = CLDFB_SYNTHESIS; + } hSplitRendWrapper->hCldfbHandles = NULL; if ( isCldfbNeeded ) @@ -2003,11 +2008,7 @@ void ivas_split_renderer_close( SPLIT_REND_WRAPPER *hSplitBinRend ) if ( hSplitBinRend->hCldfbHandles != NULL ) { int16_t num_ch, ch; -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - num_ch = ( 1 + MAX_HEAD_ROT_POSES ) * BINAURAL_CHANNELS; -#else num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; -#endif for ( ch = 0; ch < num_ch; ch++ ) { if ( hSplitBinRend->hCldfbHandles->cldfbAna[ch] != NULL ) @@ -2378,7 +2379,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx]; Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], -1, hSplitBin->hCldfbHandles->cldfbAna[ch] ); + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); } if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, out ) ) != IVAS_ERR_OK ) @@ -2389,6 +2390,21 @@ ivas_error ivas_renderMultiBinToSplitBinaural( } else { + int16_t ch, slot_idx; + /* CLDFB synthesis of main pose */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float *Cldfb_In_BinReal_p[CLDFB_NO_COL_MAX]; + float *Cldfb_In_BinImag_p[CLDFB_NO_COL_MAX]; + + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx]; + Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; + } + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); + } + pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; pBits->codec = IVAS_SPLIT_REND_CODEC_NONE; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index be15911337..ee9ec89fac 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1360,7 +1360,7 @@ static ivas_error initIsmMasaRendering( ivas_rend_closeCrend( &inputIsm->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); ivas_reverb_close( &inputIsm->hReverb ); @@ -1477,7 +1477,7 @@ static ivas_error setRendInputActiveIsm( NULL, *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ) ) != IVAS_ERR_OK ) { @@ -1510,7 +1510,7 @@ static void clearInputIsm( ivas_rend_closeCrend( &inputIsm->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); @@ -2199,7 +2199,7 @@ static ivas_error initMcBinauralRendering( ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); @@ -2323,7 +2323,7 @@ static ivas_error initMcMasaRendering( ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); ivas_reverb_close( &inputMc->hReverb ); @@ -2515,7 +2515,7 @@ static void clearInputMc( ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); @@ -2742,7 +2742,7 @@ static ivas_error updateSbaPanGains( *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); } @@ -2762,7 +2762,7 @@ static ivas_error updateSbaPanGains( *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); break; @@ -2825,7 +2825,7 @@ static ivas_error initSbaMasaRendering( ivas_rend_closeCrend( &inputSba->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , - 1 + inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); @@ -3213,7 +3213,12 @@ static DecoderDummy *initDecoderDummy( const int32_t sampleRate, const int16_t numTransChannels, const IVAS_REND_AudioConfig outConfig, - const uint8_t enableRenderConfig ) + const uint8_t enableRenderConfig +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const SPLIT_REND_WRAPPER *pSplitRendWrapper +#endif +) { ivas_error error; int16_t i; @@ -3238,6 +3243,14 @@ static DecoderDummy *initDecoderDummy( decDummy->splitBinRend.hSplitRendBits = NULL; decDummy->splitBinRend.hMultiBinCldfbData = NULL; ivas_init_split_rend_handles( &decDummy->splitBinRend.splitrend ); + decDummy->splitBinRend.splitrend = *pSplitRendWrapper; + if ( decDummy->splitBinRend.splitrend.multiBinPoseData.num_poses > 1 ) + { + if ( ( decDummy->splitBinRend.hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) + { + assert( error == IVAS_ERR_OK ); + } + } #endif decDummy->hEFAPdata = NULL; decDummy->hCrendWrapper = NULL; @@ -3371,7 +3384,12 @@ static ivas_error setRendInputActiveMasa( } else { - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + rendCtx.pSplitRendWrapper +#endif + ); inputMasa->metadataHasBeenFed = false; if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK ) @@ -3457,6 +3475,14 @@ static void freeDecoderDummy( /* Parametric binaural renderer HRTF structure */ free( pDecDummy->hHrtfParambin ); +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( pDecDummy->splitBinRend.hMultiBinCldfbData != NULL ) + { + free( pDecDummy->splitBinRend.hMultiBinCldfbData ); + pDecDummy->splitBinRend.hMultiBinCldfbData = NULL; + } +#endif + /* Parametric binaural renderer handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_close_binaural_data( pDecDummy->hDiracDecBin ); @@ -3491,7 +3517,7 @@ static void clearInputMasa( } #ifdef SPLIT_REND_WITH_HEAD_ROT -static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_REND_AudioConfig outConfig ) +static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_REND_AudioConfig outConfig, const int16_t cldfb_in ) { ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; @@ -3511,7 +3537,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, - 0, + cldfb_in, ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { @@ -4127,7 +4153,14 @@ ivas_error IVAS_REND_AddInput( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->splitRendEncBuffer.data == NULL && hIvasRend->hRendererConfig != NULL ) { - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + int16_t cldfb_in; + cldfb_in = 0; + if ( ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) || + ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS && hIvasRend->hRendererConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) ) + { + cldfb_in = 1; + } + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in ) ) != IVAS_ERR_OK ) { return error; } @@ -7772,7 +7805,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && - ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) + ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif @@ -7966,7 +7999,12 @@ static void renderMasaToSba( static void renderMasaToBinaural( input_masa *masaInput, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_AudioBuffer outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + const int16_t is_split_rend_mode +#endif +) { float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7974,8 +8012,17 @@ static void renderMasaToBinaural( copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); - - accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); + if ( is_split_rend_mode ) + { + accumulateCLDFBArrayToBuffer( + masaInput->decDummy->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, + masaInput->decDummy->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, + &outAudio ); + } + else + { + accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); + } return; } @@ -8121,8 +8168,12 @@ static ivas_error renderInputMasa( } inAudio = masaInput->base.inputBuffer; - +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && + ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) +#endif { /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8147,7 +8198,12 @@ static ivas_error renderInputMasa( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: - renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 0 +#endif + ); break; /* ToDo */ //#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG @@ -8162,7 +8218,12 @@ static ivas_error renderInputMasa( case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: /* TODO: implement */ - renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + 1 +#endif + ); break; #endif default: @@ -8498,7 +8559,8 @@ ivas_error IVAS_REND_GetSamples( int16_t num_poses_orig; num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses; outAudio = hIvasRend->splitRendEncBuffer; - if ( outAudioOrig.config.is_cldfb == 0 ) + if ( ( outAudioOrig.config.is_cldfb == 0 ) && + ( hIvasRend->inputsMasa[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) { outAudio.config.is_cldfb = 0; outAudio.config.numSamplesPerChannel >>= 1; -- GitLab From f84b1fba0ee64475eef93e3f89fefee1d19483f2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 28 Jul 2023 11:48:02 +0200 Subject: [PATCH 539/591] fix differences wrt. main --- lib_com/ivas_cnst.h | 9 ++ lib_rend/ivas_objectRenderer.c | 47 ++++++ lib_rend/ivas_objectRenderer_hrFilt.c | 20 ++- lib_rend/ivas_objectRenderer_mix.c | 4 + lib_rend/ivas_objectRenderer_sources.c | 192 +++++++++++++++---------- lib_rend/ivas_prot_rend.h | 2 + 6 files changed, 193 insertions(+), 81 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index e5f2b270d6..d19c779269 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1672,13 +1672,22 @@ typedef enum typedef enum { TDREND_POSTYPE_ABSOLUTE, /* The source position is in absolute coordinates */ +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT TDREND_POSTYPE_NON_DIEGETIC /* The source position is non-diegetic */ +#else + TDREND_POSTYPE_RELATIVE_TO_LISTENER /* The source position is relative to the listener */ +#endif } TDREND_PosType_t; typedef enum { TDREND_PLAYSTATUS_INITIAL, +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT + TDREND_PLAYSTATUS_PLAYING, + TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC +#else TDREND_PLAYSTATUS_PLAYING +#endif } TDREND_PlayStatus_t; typedef enum diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index be161c50e9..3aa9e6d80b 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -307,6 +307,21 @@ ivas_error ivas_td_binaural_renderer_unwrap( hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; c_indx++; } +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT +#ifdef FIX_550_FIRST_FRAME_ACCESS + if ( ivas_format == ISM_FORMAT ) + { + if ( hIsmMetaData[nS]->non_diegetic_flag ) + { + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); + } + else + { + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); + } + } +#endif +#endif } for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) @@ -333,6 +348,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( return error; } +#ifdef FIX_550_FIRST_FRAME_ACCESS /* Advance subframe pointer */ c_indx = 0; for ( nS = 0; nS < num_src; nS++ ) @@ -343,6 +359,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( c_indx++; } } +#endif } if ( hReverb != NULL ) @@ -379,6 +396,9 @@ ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT + float pan_left, pan_right; +#endif int16_t subframe_update_flag; subframe_update_flag = subframe_idx == ism_md_subframe_update; @@ -414,6 +434,21 @@ ivas_error TDREND_GetMix( { error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); } + +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT + if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ) ) + { + pan_left = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; + pan_right = 1.f - pan_left; +#ifdef FIX_550_FIRST_FRAME_ACCESS + v_multc_acc( Src_p->InputFrame_p, pan_left, output_buf[0], subframe_length ); + v_multc_acc( Src_p->InputFrame_p, pan_right, output_buf[1], subframe_length ); +#else + v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_left, output_buf[0], subframe_length ); + v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_right, output_buf[1], subframe_length ); +#endif + } +#endif } /* Populate output variable */ @@ -494,11 +529,23 @@ void TDREND_Update_object_positions( Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; Pos[2] = 0; TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT hBinRendererTd->Sources[nS]->SrcSpatial_p->PosType = TDREND_POSTYPE_NON_DIEGETIC; +#else +#ifndef FIX_550_FIRST_FRAME_ACCESS + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); +#endif +#endif } else { +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT hBinRendererTd->Sources[nS]->SrcSpatial_p->PosType = TDREND_POSTYPE_ABSOLUTE; +#else +#ifndef FIX_550_FIRST_FRAME_ACCESS + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); +#endif +#endif } TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index c73b28a531..0f8904e2aa 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -79,6 +79,11 @@ ivas_error TDREND_REND_RenderSourceHRFilt( v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); v_add( RightOutputFrame, output_buf[1], output_buf[1], subframe_length ); +#ifndef FIX_550_FIRST_FRAME_ACCESS + Src_p->InputFrame_p += subframe_length; /* Increment input pointer */ +#endif + + return IVAS_ERR_OK; } @@ -94,17 +99,24 @@ void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ float Azim, /* i : Azimuth, degrees */ - const int16_t filterlength, /* i : Filter length */ - float *hrf_left, /* o : Left HR filter */ - float *hrf_right, /* o : Right HR filter */ - int16_t *itd /* o : ITD value */ +#ifdef FIX_569_TD_FILTER_LENGTH + const int16_t filterlength, /* i : Filter length */ +#endif + float *hrf_left, /* o : Left HR filter */ + float *hrf_right, /* o : Right HR filter */ + int16_t *itd /* o : ITD value */ ) { GenerateFilter( Elev, Azim, &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); +#ifdef FIX_569_TD_FILTER_LENGTH mvr2r( HrFiltSet_p->ModelEval.hrfModL, hrf_left, filterlength ); mvr2r( HrFiltSet_p->ModelEval.hrfModR, hrf_right, filterlength ); +#else + mvr2r( HrFiltSet_p->ModelEval.hrfModL, hrf_left, HrFiltSet_p->ModelParams.K ); + mvr2r( HrFiltSet_p->ModelEval.hrfModR, hrf_right, HrFiltSet_p->ModelParams.K ); +#endif /* 4. Evaluate the ITD */ if ( HrFiltSet_p->ModelParams.UseItdModel ) diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 60a66b168c..7f3edb41af 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -309,7 +309,11 @@ ivas_error TDREND_MIX_AddSrc( } else { +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT if ( ( PosType < TDREND_POSTYPE_ABSOLUTE ) || ( PosType > TDREND_POSTYPE_NON_DIEGETIC ) ) +#else + if ( ( PosType < TDREND_POSTYPE_ABSOLUTE ) || ( PosType > TDREND_POSTYPE_RELATIVE_TO_LISTENER ) ) +#endif { return ( IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid position type!\n" ) ); } diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 50d68e8944..438c1e0f0a 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -218,8 +218,11 @@ static void TDREND_SRC_REND_Init( /* Internal state */ SrcRend_p->InputAvailable = FALSE; +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT SrcRend_p->PlayStatus = TDREND_PLAYSTATUS_PLAYING; - +#else + SrcRend_p->PlayStatus = TDREND_PLAYSTATUS_INITIAL; +#endif /* SrcGain */ for ( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { @@ -276,101 +279,131 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( Listener_p = hBinRendererTd->Listener_p; HrFiltSet_p = hBinRendererTd->HrFiltSet_p; +#ifdef FIX_569_TD_FILTER_LENGTH *filterlength = min( HrFiltSet_p->FiltLength, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); +#else + *filterlength = HrFiltSet_p->FiltLength; +#endif +#ifndef FIX_550_FIRST_FRAME_ACCESS_ALT + /* 1. Map source pos to the coordinate system of the listener */ + switch ( SrcSpatial_p->PosType ) + { + case TDREND_POSTYPE_RELATIVE_TO_LISTENER: + /* Listener relative position */ + mvr2r( SrcSpatial_p->Pos_p, ListRelPos, 3 ); + break; + case TDREND_POSTYPE_ABSOLUTE: + /* Absolute position */ + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); + break; + default: /* Illegal position type */ +#ifdef DEBUGGING + printf( "Warning! TDREND_SRC_REND_UpdateFiltersFromSpatialParams: Invalid position type. Assuming absolute position!\n" ); +#endif + /* Assume absolute position */ + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); + break; + } +#else if ( SrcSpatial_p->PosType == TDREND_POSTYPE_ABSOLUTE ) { /* Absolute position */ TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); +#endif + ListRelDist = TDREND_SPATIAL_VecNorm( ListRelPos ); - ListRelDist = TDREND_SPATIAL_VecNorm( ListRelPos ); - - /* 2. Evaluate the Elevation and Azimuth angles */ - if ( ( ListRelPos[0] == 0 ) && ( ListRelPos[1] == 0 ) && ( ListRelPos[2] == 0 ) ) - { - Elev = 0.0; - Azim = 0.0; - } - else - { - Elev = _180_OVER_PI * atan2f( ListRelPos[2], sqrtf( ListRelPos[0] * ListRelPos[0] + ListRelPos[1] * ListRelPos[1] ) ); - /* Basis set is [front, right, up], which is a left-handed coordinate system. Minus sign here is to change to a positive-left system for azimuth */ - Azim = -1.0f * _180_OVER_PI * (float) atan2f( ListRelPos[1], ListRelPos[0] ); - } + /* 2. Evaluate the Elevation and Azimuth angles */ + if ( ( ListRelPos[0] == 0 ) && ( ListRelPos[1] == 0 ) && ( ListRelPos[2] == 0 ) ) + { + Elev = 0.0; + Azim = 0.0; + } + else + { + Elev = _180_OVER_PI * atan2f( ListRelPos[2], sqrtf( ListRelPos[0] * ListRelPos[0] + ListRelPos[1] * ListRelPos[1] ) ); + /* Basis set is [front, right, up], which is a left-handed coordinate system. Minus sign here is to change to a positive-left system for azimuth */ + Azim = -1.0f * _180_OVER_PI * (float) atan2f( ListRelPos[1], ListRelPos[0] ); + } - GetFilterFromAngle( HrFiltSet_p, Elev, Azim, *filterlength, hrf_left, hrf_right, itd ); +#ifdef FIX_569_TD_FILTER_LENGTH + GetFilterFromAngle( HrFiltSet_p, Elev, Azim, *filterlength, hrf_left, hrf_right, itd ); +#else + GetFilterFromAngle( HrFiltSet_p, Elev, Azim, hrf_left, hrf_right, itd ); +#endif - /* 6. Evaluate the directional and distance gains */ - /* Directional gain */ - *SrcRend_p->DirGain_p = 1.0f; - if ( SrcSpatial_p->DirAttenEnabled ) - { - *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs ); - } + /* 6. Evaluate the directional and distance gains */ + /* Directional gain */ + *SrcRend_p->DirGain_p = 1.0f; + if ( SrcSpatial_p->DirAttenEnabled ) + { + *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs ); + } - /* Distance gain */ - *SrcRend_p->DistGain_p = 1.0f; - if ( hBinRendererTd->UseCommonDistAttenModel ) + /* Distance gain */ + *SrcRend_p->DistGain_p = 1.0f; + if ( hBinRendererTd->UseCommonDistAttenModel ) + { + if ( hBinRendererTd->DistAttenEnabled ) { - if ( hBinRendererTd->DistAttenEnabled ) - { - SrcSpatial_p->DistAtten.DistAttenModel = hBinRendererTd->DistAttenModel; - *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); - } + SrcSpatial_p->DistAtten.DistAttenModel = hBinRendererTd->DistAttenModel; + *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); } - else + } + else + { + if ( SrcSpatial_p->DistAttenEnabled ) { - if ( SrcSpatial_p->DistAttenEnabled ) - { - *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); - } + *SrcRend_p->DistGain_p = TDREND_SRC_SPATIAL_GetDistGain( &SrcSpatial_p->DistAtten, ListRelDist ); } + } - /* Update total gains */ - *Gain = ( *SrcRend_p->SrcGain_p ) * ( *SrcRend_p->DirGain_p ) * ( *SrcRend_p->DistGain_p ) * hBinRendererTd->Gain; - - /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ - elev_delta = Elev - Src_p->elev_prev; - azim_delta = Azim - Src_p->azim_prev; - Src_p->elev_prev = Elev; - Src_p->azim_prev = Azim; + /* Update total gains */ + *Gain = ( *SrcRend_p->SrcGain_p ) * ( *SrcRend_p->DirGain_p ) * ( *SrcRend_p->DistGain_p ) * hBinRendererTd->Gain; - azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ - *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); - } - else /* TDREND_POSTYPE_NON_DIEGETIC */ - { - *itd = 0; - *Gain = 1.0f; - set_f( hrf_left, 0.0f, *filterlength ); - set_f( hrf_right, 0.0f, *filterlength ); - hrf_left[0] = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; - hrf_right[0] = 1.f - hrf_left[0]; - *intp_count = MAX_INTERPOLATION_STEPS; - Src_p->elev_prev = 0; - Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ - } + /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ + elev_delta = Elev - Src_p->elev_prev; + azim_delta = Azim - Src_p->azim_prev; + Src_p->elev_prev = Elev; + Src_p->azim_prev = Azim; + azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ + *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); +#ifdef FIX_550_FIRST_FRAME_ACCESS_ALT +} +else /* TDREND_POSTYPE_NON_DIEGETIC */ +{ + *itd = 0; + *Gain = 1.0f; + set_f( hrf_left, 0.0f, *filterlength ); + set_f( hrf_right, 0.0f, *filterlength ); + hrf_left[0] = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; + hrf_right[0] = 1.f - hrf_left[0]; + *intp_count = MAX_INTERPOLATION_STEPS; + Src_p->elev_prev = 0; + Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ +} +#endif - if ( ( *intp_count > 0 ) && subframe_update_flag ) - { - /* Set deltas for interpolation */ - v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); - v_multc( hrf_left_delta, 1.0f / *intp_count, hrf_left_delta, *filterlength ); - v_sub( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); - v_multc( hrf_right_delta, 1.0f / *intp_count, hrf_right_delta, *filterlength ); - } - else - { - /* No interpolation, just set the new filters and reset deltas */ - mvr2r( hrf_left, hrf_left_prev, *filterlength ); - mvr2r( hrf_right, hrf_right_prev, *filterlength ); - set_f( hrf_left_delta, 0.0f, *filterlength ); - set_f( hrf_right_delta, 0.0f, *filterlength ); - } +if ( ( *intp_count > 0 ) && subframe_update_flag ) +{ + /* Set deltas for interpolation */ + v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); + v_multc( hrf_left_delta, 1.0f / *intp_count, hrf_left_delta, *filterlength ); + v_sub( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); + v_multc( hrf_right_delta, 1.0f / *intp_count, hrf_right_delta, *filterlength ); +} +else +{ + /* No interpolation, just set the new filters and reset deltas */ + mvr2r( hrf_left, hrf_left_prev, *filterlength ); + mvr2r( hrf_right, hrf_right_prev, *filterlength ); + set_f( hrf_left_delta, 0.0f, *filterlength ); + set_f( hrf_right_delta, 0.0f, *filterlength ); +} - return; +return; } @@ -675,8 +708,11 @@ void TDREND_SRC_Init( /* Reset memory buffers */ Src_p->itd = 0; Src_p->previtd = 0; +#ifdef FIX_550_FIRST_FRAME_ACCESS Src_p->filterlength = 1; /* Init to unit impulse of length 1 */ - +#else + Src_p->filterlength = -1; +#endif set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); @@ -687,7 +723,9 @@ void TDREND_SRC_Init( Src_p->hrf_right_prev[0] = 1; Src_p->azim_prev = 0.0f; Src_p->elev_prev = 0.0f; +#ifdef FIX_550_FIRST_FRAME_ACCESS Src_p->Gain = 1; +#endif Src_p->prevGain = 1.0f; return; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index f12c4597c8..b6045045a8 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -647,7 +647,9 @@ void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ float Azim, /* i : Azimuth, degrees */ +#ifdef FIX_569_TD_FILTER_LENGTH const int16_t filterlength, /* i : Filter length */ +#endif float *LeftFilter, /* o : Left HR filter */ float *RightFilter, /* o : Right HR filter */ int16_t *itd /* o : ITD value */ -- GitLab From 8f4cb001188b1f0919e4f5b4bea20fcdca468b5c Mon Sep 17 00:00:00 2001 From: malenovsky Date: Fri, 28 Jul 2023 11:19:07 +0000 Subject: [PATCH 540/591] Add condition mandating hBWE_TD->prev_gainFr_SHB != 0 --- lib_enc/swb_tbe_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index a57e381eb4..972a0b177d 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -1260,7 +1260,7 @@ void swb_tbe_enc( } #ifdef FIX_618_STEREO_SW_DIV_BY_ZERO - if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && ( st->last_extl == SWB_TBE || st->last_extl == FB_TBE ) && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) + if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && hBWE_TD->prev_gainFr_SHB != 0 && ( st->last_extl == SWB_TBE || st->last_extl == FB_TBE ) && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) #else if ( st->element_mode > EVS_MONO && st->L_frame != st->last_L_frame && st->coder_type == TRANSITION && st->coder_type_raw != VOICED && st->clas == VOICED_CLAS && st->last_clas == VOICED_CLAS && ( 3.0f * voice_factors[0] < voice_factors[( st->L_frame >> 6 ) - 1] ) ) #endif -- GitLab From 4599611975cd0978ca5e977078c1710d136fd433 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 28 Jul 2023 14:45:55 +0200 Subject: [PATCH 541/591] remove corresponding entry from ubsan.supp --- scripts/ubsan.supp | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp index 8f312aa15a..f0d062d29e 100644 --- a/scripts/ubsan.supp +++ b/scripts/ubsan.supp @@ -8,7 +8,6 @@ bounds:trans_direct.c bounds:trans_inv.c float-cast-overflow:ivas_dirac_com.c float-divide-by-zero:ivas_stereo_cng_dec.c -float-divide-by-zero:swb_tbe_enc.c implicit-integer-sign-change:ACcontextMapping.c implicit-integer-sign-change:avq_dec.c implicit-integer-sign-change:bitstream.c -- GitLab From 872695ed3d612c7e68dd9a31c6c9f60997025362 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 28 Jul 2023 14:56:28 +0200 Subject: [PATCH 542/591] update upsan.supp after the issue #629 is fixed --- scripts/ubsan.supp | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp index 8f312aa15a..5e9609340a 100644 --- a/scripts/ubsan.supp +++ b/scripts/ubsan.supp @@ -6,7 +6,6 @@ bounds:enc_gain.c bounds:ivas_spar_decoder.c bounds:trans_direct.c bounds:trans_inv.c -float-cast-overflow:ivas_dirac_com.c float-divide-by-zero:ivas_stereo_cng_dec.c float-divide-by-zero:swb_tbe_enc.c implicit-integer-sign-change:ACcontextMapping.c -- GitLab From 281880790698d68d7bed7260c9dc7cfe977207c9 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 28 Jul 2023 14:57:55 +0200 Subject: [PATCH 543/591] update upsan.supp after the issue #617 is fixed --- scripts/ubsan.supp | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ubsan.supp b/scripts/ubsan.supp index 5e9609340a..bea726ffbf 100644 --- a/scripts/ubsan.supp +++ b/scripts/ubsan.supp @@ -6,7 +6,6 @@ bounds:enc_gain.c bounds:ivas_spar_decoder.c bounds:trans_direct.c bounds:trans_inv.c -float-divide-by-zero:ivas_stereo_cng_dec.c float-divide-by-zero:swb_tbe_enc.c implicit-integer-sign-change:ACcontextMapping.c implicit-integer-sign-change:avq_dec.c -- GitLab From 24966dbcd46d0fed8e0476fa5548a718ac5313f0 Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 31 Jul 2023 12:00:16 +0300 Subject: [PATCH 544/591] fix OMASA for MASA 1 TC --- lib_enc/ivas_enc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 429a18e0d2..4a54136079 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -298,6 +298,14 @@ ivas_error ivas_enc( flag_omasa_ener_brate = 0; + /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */ + if ( ( st_ivas->hEncoderConfig->nchan_inp - hEncoderConfig->nchan_ism ) == 1 ) + { + v_multc( data_f[hEncoderConfig->nchan_ism], 1.0f / SQRT2, data_f[hEncoderConfig->nchan_ism], input_frame ); + mvr2r( data_f[hEncoderConfig->nchan_ism], data_f[hEncoderConfig->nchan_ism + 1], input_frame ); + } + + /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); @@ -306,13 +314,6 @@ ivas_error ivas_enc( return error; } - /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */ - if ( ( st_ivas->hEncoderConfig->nchan_inp - hEncoderConfig->nchan_ism ) == 1 ) - { - v_multc( data_f[hEncoderConfig->nchan_ism], 1.0f / SQRT2, data_f[hEncoderConfig->nchan_ism], input_frame ); - mvr2r( data_f[hEncoderConfig->nchan_ism], data_f[hEncoderConfig->nchan_ism + 1], input_frame ); - } - set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); idx_separated_object = 0; -- GitLab From 2cde9e6be0c49d46379c83f005a0a721bb30aca9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 11:09:05 +0200 Subject: [PATCH 545/591] Revert "Remove options.h include from lc3plus code" This reverts commit a91d5d6ae80371be93864d54f299f9487c183d09. --- lc3plus/adjust_global_gain.c | 1 + lc3plus/al_fec_fl.c | 1 + lc3plus/apply_global_gain.c | 1 + lc3plus/ari_codec.c | 1 + lc3plus/attack_detector.c | 1 + lc3plus/constants.c | 1 + lc3plus/cutoff_bandwidth.c | 1 + lc3plus/dct4.c | 1 + lc3plus/dec_entropy.c | 1 + lc3plus/dec_lc3_fl.c | 1 + lc3plus/detect_cutoff_warped.c | 1 + lc3plus/enc_entropy.c | 1 + lc3plus/enc_lc3_fl.c | 1 + lc3plus/estimate_global_gain.c | 1 + lc3plus/fft/cfft.c | 1 + lc3plus/fft/iis_fft.c | 1 + lc3plus/fft/iisfft.c | 1 + lc3plus/imdct.c | 1 + lc3plus/lc3.c | 1 + lc3plus/lc3plus_fft.c | 26 +- lc3plus/ltpf_coder.c | 1 + lc3plus/ltpf_decoder.c | 1 + lc3plus/mdct.c | 1 + lc3plus/mdct_shaping.c | 1 + lc3plus/near_nyquist_detector.c | 1 + lc3plus/noise_factor.c | 1 + lc3plus/noise_filling.c | 1 + lc3plus/olpa.c | 1 + lc3plus/pc_apply.c | 1 + lc3plus/pc_classify.c | 1 + lc3plus/pc_main.c | 1 + lc3plus/pc_update.c | 1 + lc3plus/per_band_energy.c | 1 + lc3plus/plc_classify.c | 1 + lc3plus/plc_compute_stab_fac.c | 1 + lc3plus/plc_damping_scrambling.c | 1 + lc3plus/plc_main.c | 1 + lc3plus/plc_noise_substitution.c | 1 + lc3plus/plc_phecu_f0_refine_first.c | 1 + lc3plus/plc_phecu_fec_hq.c | 1 + lc3plus/plc_phecu_hq_ecu.c | 1 + lc3plus/plc_phecu_lf_peak_analysis.c | 1 + lc3plus/plc_phecu_rec_frame.c | 1 + lc3plus/plc_phecu_setf0hz.c | 1 + lc3plus/plc_phecu_spec_ana.c | 1 + lc3plus/plc_phecu_subst_spec.c | 1 + lc3plus/plc_phecu_tba_per_band_gain.c | 1 + lc3plus/plc_phecu_tba_spect_Xavg.c | 1 + lc3plus/plc_phecu_tba_trans_dect_gains.c | 1 + lc3plus/plc_phecu_trans_burst_ana_sub.c | 1 + lc3plus/plc_tdc.c | 1 + lc3plus/plc_tdc_tdac.c | 1 + lc3plus/plc_update.c | 1 + lc3plus/quantize_spec.c | 1 + lc3plus/reorder_bitstream.c | 1 + lc3plus/resamp12k8.c | 1 + lc3plus/residual_coding.c | 1 + lc3plus/residual_decoding.c | 1 + lc3plus/setup_com_lc3.c | 1 + lc3plus/setup_dec_lc3.c | 1 + lc3plus/setup_enc_lc3.c | 1 + lc3plus/sns_compute_scf.c | 1 + lc3plus/sns_interpolate_scf.c | 1 + lc3plus/sns_quantize_scf.c | 1 + lc3plus/tns_coder.c | 1 + lc3plus/tns_decoder.c | 1 + scripts/lc3plus_lib_setup/get_lc3plus.sh | 2 +- scripts/lc3plus_lib_setup/lc3plus.patch | 913 +++++++++++++++++++++-- 68 files changed, 912 insertions(+), 94 deletions(-) diff --git a/lc3plus/adjust_global_gain.c b/lc3plus/adjust_global_gain.c index 803240f748..e7674dd710 100644 --- a/lc3plus/adjust_global_gain.c +++ b/lc3plus/adjust_global_gain.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff --git a/lc3plus/al_fec_fl.c b/lc3plus/al_fec_fl.c index fd0b55b91e..0cae36dade 100644 --- a/lc3plus/al_fec_fl.c +++ b/lc3plus/al_fec_fl.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "stdint.h" #include #include diff --git a/lc3plus/apply_global_gain.c b/lc3plus/apply_global_gain.c index 45bfae5343..c67432e2c3 100644 --- a/lc3plus/apply_global_gain.c +++ b/lc3plus/apply_global_gain.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff --git a/lc3plus/ari_codec.c b/lc3plus/ari_codec.c index 238e2a1268..80c75fcf0c 100644 --- a/lc3plus/ari_codec.c +++ b/lc3plus/ari_codec.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static void ac_shift_fl(Encoder_State_fl* st); diff --git a/lc3plus/attack_detector.c b/lc3plus/attack_detector.c index 83643d76c2..c9f7c0a94c 100644 --- a/lc3plus/attack_detector.c +++ b/lc3plus/attack_detector.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, diff --git a/lc3plus/constants.c b/lc3plus/constants.c index b32edab9e6..8189761a04 100644 --- a/lc3plus/constants.c +++ b/lc3plus/constants.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" /* DCT */ diff --git a/lc3plus/cutoff_bandwidth.c b/lc3plus/cutoff_bandwidth.c index ea8ad00c9d..642b2afda2 100644 --- a/lc3plus/cutoff_bandwidth.c +++ b/lc3plus/cutoff_bandwidth.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff --git a/lc3plus/dct4.c b/lc3plus/dct4.c index b470430b94..8fd5784b28 100644 --- a/lc3plus/dct4.c +++ b/lc3plus/dct4.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void dct2_init(Dct2* dct, int length) diff --git a/lc3plus/dec_entropy.c b/lc3plus/dec_entropy.c index ec7c09708d..d8512a1068 100644 --- a/lc3plus/dec_entropy.c +++ b/lc3plus/dec_entropy.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); diff --git a/lc3plus/dec_lc3_fl.c b/lc3plus/dec_lc3_fl.c index 51c430060d..88c528b0f6 100644 --- a/lc3plus/dec_lc3_fl.c +++ b/lc3plus/dec_lc3_fl.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/detect_cutoff_warped.c b/lc3plus/detect_cutoff_warped.c index b34a88a4c0..9392867208 100644 --- a/lc3plus/detect_cutoff_warped.c +++ b/lc3plus/detect_cutoff_warped.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) diff --git a/lc3plus/enc_entropy.c b/lc3plus/enc_entropy.c index ed34bca7b8..a7ff8cd700 100644 --- a/lc3plus/enc_entropy.c +++ b/lc3plus/enc_entropy.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, diff --git a/lc3plus/enc_lc3_fl.c b/lc3plus/enc_lc3_fl.c index 5bf05465a4..c89f7244ca 100644 --- a/lc3plus/enc_lc3_fl.c +++ b/lc3plus/enc_lc3_fl.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff --git a/lc3plus/estimate_global_gain.c b/lc3plus/estimate_global_gain.c index df4b1bc546..df9b1f5f23 100644 --- a/lc3plus/estimate_global_gain.c +++ b/lc3plus/estimate_global_gain.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/fft/cfft.c b/lc3plus/fft/cfft.c index e1bcc2806f..4bd8d29ade 100644 --- a/lc3plus/fft/cfft.c +++ b/lc3plus/fft/cfft.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "cfft.h" #include "iisfft.h" /* for M_PIl */ #include /* for abs() */ diff --git a/lc3plus/fft/iis_fft.c b/lc3plus/fft/iis_fft.c index 1ff9b8303e..b1f8ab5ab8 100644 --- a/lc3plus/fft/iis_fft.c +++ b/lc3plus/fft/iis_fft.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include #include #include diff --git a/lc3plus/fft/iisfft.c b/lc3plus/fft/iisfft.c index 2b5829b220..227d2b6037 100644 --- a/lc3plus/fft/iisfft.c +++ b/lc3plus/fft/iisfft.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include #include /* for mmove */ diff --git a/lc3plus/imdct.c b/lc3plus/imdct.c index 597c21e0df..5d38aa6cc7 100644 --- a/lc3plus/imdct.c +++ b/lc3plus/imdct.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" /* Function expects already flipped window */ diff --git a/lc3plus/lc3.c b/lc3plus/lc3.c index 8b4ebafaa6..17d2ccb712 100644 --- a/lc3plus/lc3.c +++ b/lc3plus/lc3.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "lc3.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/lc3plus_fft.c b/lc3plus/lc3plus_fft.c index 89c6eff2a2..14f443f860 100644 --- a/lc3plus/lc3plus_fft.c +++ b/lc3plus/lc3plus_fft.c @@ -6,8 +6,9 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - + +#include "options.h" #include "functions.h" #include "fft/iis_fft.c" #include "fft/iisfft.c" @@ -15,14 +16,14 @@ void fft_init(Fft* fft, int length) { - assert(length % 2 == 0); HANDLE_IIS_FFT handle = NULL; IIS_FFT_ERROR error = 0; - + assert(length % 2 == 0); + fft->length = length; - + error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); - + assert(error == IIS_FFT_NO_ERROR); fft->handle = handle; } @@ -30,10 +31,10 @@ void fft_init(Fft* fft, int length) void fft_free(Fft* fft) { IIS_FFT_ERROR error = 0; - + if (fft) { error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); - + assert(error == IIS_FFT_NO_ERROR); memset(fft, 0, sizeof(*fft)); } @@ -53,8 +54,8 @@ void real_fft_free(Fft* fft) void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) { - assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ fft->length = length; @@ -66,8 +67,8 @@ void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) { - assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; + assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ fft->length = length; @@ -81,7 +82,7 @@ void fft_apply(Fft* fft, const Complex* input, Complex* output) { IIS_FFT_ERROR error = 0; error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); - + assert(error == IIS_FFT_NO_ERROR); } @@ -89,11 +90,10 @@ void fft_apply(Fft* fft, const Complex* input, Complex* output) void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) { IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; - + UNUSED(error); - error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); + error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); assert(error == IIS_FFT_NO_ERROR); } - diff --git a/lc3plus/ltpf_coder.c b/lc3plus/ltpf_coder.c index 5f8cff63ac..fac8c481c0 100644 --- a/lc3plus/ltpf_coder.c +++ b/lc3plus/ltpf_coder.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); diff --git a/lc3plus/ltpf_decoder.c b/lc3plus/ltpf_decoder.c index c881801618..a40c85213a 100644 --- a/lc3plus/ltpf_decoder.c +++ b/lc3plus/ltpf_decoder.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff --git a/lc3plus/mdct.c b/lc3plus/mdct.c index 8b50397a8e..11618b9465 100644 --- a/lc3plus/mdct.c +++ b/lc3plus/mdct.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) diff --git a/lc3plus/mdct_shaping.c b/lc3plus/mdct_shaping.c index 1033802ac5..1876192504 100644 --- a/lc3plus/mdct_shaping.c +++ b/lc3plus/mdct_shaping.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) diff --git a/lc3plus/near_nyquist_detector.c b/lc3plus/near_nyquist_detector.c index 215e309e2e..ce94351302 100644 --- a/lc3plus/near_nyquist_detector.c +++ b/lc3plus/near_nyquist_detector.c @@ -8,6 +8,7 @@ ******************************************************************************/ #include "functions.h" +#include "options.h" void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, diff --git a/lc3plus/noise_factor.c b/lc3plus/noise_factor.c index c92a94158c..c5aa582e45 100644 --- a/lc3plus/noise_factor.c +++ b/lc3plus/noise_factor.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, diff --git a/lc3plus/noise_filling.c b/lc3plus/noise_filling.c index a5a6b4b424..7fac5e0f72 100644 --- a/lc3plus/noise_filling.c +++ b/lc3plus/noise_filling.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) diff --git a/lc3plus/olpa.c b/lc3plus/olpa.c index cc6e763716..6bec50952e 100644 --- a/lc3plus/olpa.c +++ b/lc3plus/olpa.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); diff --git a/lc3plus/pc_apply.c b/lc3plus/pc_apply.c index e9cd3e62b6..1d1bc40005 100644 --- a/lc3plus/pc_apply.c +++ b/lc3plus/pc_apply.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/pc_classify.c b/lc3plus/pc_classify.c index 96be029119..71196edb89 100644 --- a/lc3plus/pc_classify.c +++ b/lc3plus/pc_classify.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/pc_main.c b/lc3plus/pc_main.c index b0d853d6a7..268ee94d2a 100644 --- a/lc3plus/pc_main.c +++ b/lc3plus/pc_main.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/pc_update.c b/lc3plus/pc_update.c index 62b9d3f8dc..57539b5079 100644 --- a/lc3plus/pc_update.c +++ b/lc3plus/pc_update.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/per_band_energy.c b/lc3plus/per_band_energy.c index 538f6e6615..db1b5b2d0f 100644 --- a/lc3plus/per_band_energy.c +++ b/lc3plus/per_band_energy.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) diff --git a/lc3plus/plc_classify.c b/lc3plus/plc_classify.c index 20f577b366..619a1f7419 100644 --- a/lc3plus/plc_classify.c +++ b/lc3plus/plc_classify.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_compute_stab_fac.c b/lc3plus/plc_compute_stab_fac.c index 049c072514..4a1111a2c7 100644 --- a/lc3plus/plc_compute_stab_fac.c +++ b/lc3plus/plc_compute_stab_fac.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_damping_scrambling.c b/lc3plus/plc_damping_scrambling.c index 347276ab1d..ecea32be5f 100644 --- a/lc3plus/plc_damping_scrambling.c +++ b/lc3plus/plc_damping_scrambling.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_main.c b/lc3plus/plc_main.c index 877196b7ff..df3fd184d9 100644 --- a/lc3plus/plc_main.c +++ b/lc3plus/plc_main.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, diff --git a/lc3plus/plc_noise_substitution.c b/lc3plus/plc_noise_substitution.c index 94c3aa37aa..4913ee53e5 100644 --- a/lc3plus/plc_noise_substitution.c +++ b/lc3plus/plc_noise_substitution.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_f0_refine_first.c b/lc3plus/plc_phecu_f0_refine_first.c index 5b2309586d..11ebf276b1 100644 --- a/lc3plus/plc_phecu_f0_refine_first.c +++ b/lc3plus/plc_phecu_f0_refine_first.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_fec_hq.c b/lc3plus/plc_phecu_fec_hq.c index b9d63e36ac..c25466c3e9 100644 --- a/lc3plus/plc_phecu_fec_hq.c +++ b/lc3plus/plc_phecu_fec_hq.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_hq_ecu.c b/lc3plus/plc_phecu_hq_ecu.c index 8429d422c9..5b1978bcab 100644 --- a/lc3plus/plc_phecu_hq_ecu.c +++ b/lc3plus/plc_phecu_hq_ecu.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_lf_peak_analysis.c b/lc3plus/plc_phecu_lf_peak_analysis.c index 6c519071b8..0bcc98d7a4 100644 --- a/lc3plus/plc_phecu_lf_peak_analysis.c +++ b/lc3plus/plc_phecu_lf_peak_analysis.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_rec_frame.c b/lc3plus/plc_phecu_rec_frame.c index 6b86a7a743..0e6570743a 100644 --- a/lc3plus/plc_phecu_rec_frame.c +++ b/lc3plus/plc_phecu_rec_frame.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_setf0hz.c b/lc3plus/plc_phecu_setf0hz.c index b713fd93a8..b14327e2b2 100644 --- a/lc3plus/plc_phecu_setf0hz.c +++ b/lc3plus/plc_phecu_setf0hz.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_spec_ana.c b/lc3plus/plc_phecu_spec_ana.c index 89724d1575..b496900305 100644 --- a/lc3plus/plc_phecu_spec_ana.c +++ b/lc3plus/plc_phecu_spec_ana.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_subst_spec.c b/lc3plus/plc_phecu_subst_spec.c index 7b44ccc78c..43f806339b 100644 --- a/lc3plus/plc_phecu_subst_spec.c +++ b/lc3plus/plc_phecu_subst_spec.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" #include "constants.h" diff --git a/lc3plus/plc_phecu_tba_per_band_gain.c b/lc3plus/plc_phecu_tba_per_band_gain.c index 6cd8168811..9f585f28dd 100644 --- a/lc3plus/plc_phecu_tba_per_band_gain.c +++ b/lc3plus/plc_phecu_tba_per_band_gain.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_tba_spect_Xavg.c b/lc3plus/plc_phecu_tba_spect_Xavg.c index e8cca43309..600b9714e4 100644 --- a/lc3plus/plc_phecu_tba_spect_Xavg.c +++ b/lc3plus/plc_phecu_tba_spect_Xavg.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_tba_trans_dect_gains.c b/lc3plus/plc_phecu_tba_trans_dect_gains.c index 61107dec58..e5f0d3caae 100644 --- a/lc3plus/plc_phecu_tba_trans_dect_gains.c +++ b/lc3plus/plc_phecu_tba_trans_dect_gains.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_phecu_trans_burst_ana_sub.c b/lc3plus/plc_phecu_trans_burst_ana_sub.c index 34eadd7cf7..c860cd6ce3 100644 --- a/lc3plus/plc_phecu_trans_burst_ana_sub.c +++ b/lc3plus/plc_phecu_trans_burst_ana_sub.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "defines.h" #include "functions.h" diff --git a/lc3plus/plc_tdc.c b/lc3plus/plc_tdc.c index bbee9e0651..1a1a408f4d 100644 --- a/lc3plus/plc_tdc.c +++ b/lc3plus/plc_tdc.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" /***************************************************************************\ * contents/description: Main function for Time domain concealment \***************************************************************************/ diff --git a/lc3plus/plc_tdc_tdac.c b/lc3plus/plc_tdc_tdac.c index 4d36d870ad..329361b14c 100644 --- a/lc3plus/plc_tdc_tdac.c +++ b/lc3plus/plc_tdc_tdac.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/plc_update.c b/lc3plus/plc_update.c index e19515fd7a..a151420eb7 100644 --- a/lc3plus/plc_update.c +++ b/lc3plus/plc_update.c @@ -8,6 +8,7 @@ ******************************************************************************/ #include "functions.h" +#include "options.h" void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, diff --git a/lc3plus/quantize_spec.c b/lc3plus/quantize_spec.c index 95f4433f5a..7886b4586d 100644 --- a/lc3plus/quantize_spec.c +++ b/lc3plus/quantize_spec.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static LC3_INT sign(LC3_FLOAT x); diff --git a/lc3plus/reorder_bitstream.c b/lc3plus/reorder_bitstream.c index e69809eb32..77b50d7a13 100644 --- a/lc3plus/reorder_bitstream.c +++ b/lc3plus/reorder_bitstream.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" diff --git a/lc3plus/resamp12k8.c b/lc3plus/resamp12k8.c index fa8d3c828c..0cab5daae9 100644 --- a/lc3plus/resamp12k8.c +++ b/lc3plus/resamp12k8.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], diff --git a/lc3plus/residual_coding.c b/lc3plus/residual_coding.c index e5d90124c0..42094d275f 100644 --- a/lc3plus/residual_coding.c +++ b/lc3plus/residual_coding.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits diff --git a/lc3plus/residual_decoding.c b/lc3plus/residual_decoding.c index f0b9d64815..97fd94afc3 100644 --- a/lc3plus/residual_decoding.c +++ b/lc3plus/residual_decoding.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits diff --git a/lc3plus/setup_com_lc3.c b/lc3plus/setup_com_lc3.c index ca876eb78d..17054d1ffc 100644 --- a/lc3plus/setup_com_lc3.c +++ b/lc3plus/setup_com_lc3.c @@ -8,6 +8,7 @@ ******************************************************************************/ #include "functions.h" +#include "options.h" LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) { diff --git a/lc3plus/setup_dec_lc3.c b/lc3plus/setup_dec_lc3.c index 8cf92311c9..c14309720e 100644 --- a/lc3plus/setup_dec_lc3.c +++ b/lc3plus/setup_dec_lc3.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "setup_dec_lc3.h" #include "functions.h" #include diff --git a/lc3plus/setup_enc_lc3.c b/lc3plus/setup_enc_lc3.c index 27401aca19..986b43d608 100644 --- a/lc3plus/setup_enc_lc3.c +++ b/lc3plus/setup_enc_lc3.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "setup_enc_lc3.h" #include "functions.h" #include diff --git a/lc3plus/sns_compute_scf.c b/lc3plus/sns_compute_scf.c index 744d9e2d6d..5cb041925b 100644 --- a/lc3plus/sns_compute_scf.c +++ b/lc3plus/sns_compute_scf.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) diff --git a/lc3plus/sns_interpolate_scf.c b/lc3plus/sns_interpolate_scf.c index 49bf0afe37..4419397890 100644 --- a/lc3plus/sns_interpolate_scf.c +++ b/lc3plus/sns_interpolate_scf.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) diff --git a/lc3plus/sns_quantize_scf.c b/lc3plus/sns_quantize_scf.c index 738738eb32..704127cce7 100644 --- a/lc3plus/sns_quantize_scf.c +++ b/lc3plus/sns_quantize_scf.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); diff --git a/lc3plus/tns_coder.c b/lc3plus/tns_coder.c index 257e2b32ad..ff3883d2b5 100644 --- a/lc3plus/tns_coder.c +++ b/lc3plus/tns_coder.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); diff --git a/lc3plus/tns_decoder.c b/lc3plus/tns_decoder.c index 8b20652e5c..d3aeefc3a3 100644 --- a/lc3plus/tns_decoder.c +++ b/lc3plus/tns_decoder.c @@ -8,6 +8,7 @@ ******************************************************************************/ +#include "options.h" #include "functions.h" void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index 36faf111bd..01ad362b71 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -12,7 +12,7 @@ unzip lc3plus_sources.zip -d . # Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) git apply --ignore-whitespace lc3plus.patch -mv ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c +rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c # Remove unneeded files diff --git a/scripts/lc3plus_lib_setup/lc3plus.patch b/scripts/lc3plus_lib_setup/lc3plus.patch index fdf8a69f5b..14b81a3972 100644 --- a/scripts/lc3plus_lib_setup/lc3plus.patch +++ b/scripts/lc3plus_lib_setup/lc3plus.patch @@ -1,7 +1,26 @@ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-07-13 12:41:20 -@@ -1010,8 +1010,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "stdint.h" + #include + #include +@@ -1010,8 +1011,8 @@ LC3_UINT8 blacklist[FEC_N_MODES]; LC3_INT32 rop; @@ -11,10 +30,29 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /* initialization */ blacklist[0] = 0; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-07-13 12:41:20 -@@ -620,7 +620,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void ac_shift_fl(Encoder_State_fl* st); +@@ -620,7 +621,7 @@ if (st.pc_c_bp_side != 0) { @@ -23,7 +61,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } } -@@ -891,7 +891,7 @@ +@@ -891,7 +892,7 @@ { LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0; @@ -32,7 +70,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin mask = ((LC3_INT)pow(2, 24) - 1) >> bits; val = st->low + mask; over1 = val >> 24; -@@ -1078,8 +1078,8 @@ +@@ -1078,8 +1079,8 @@ } /* Residual bits */ @@ -43,10 +81,51 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (st.cache >= 0) { nbits_ari = nbits_ari + 8; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + /* DCT */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-07-13 12:41:20 -@@ -27,11 +27,11 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void dct2_init(Dct2* dct, int length) +@@ -27,11 +28,11 @@ void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output) { @@ -59,7 +138,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (i = 0; i < len / 2; i++) { tmp1[i] = cmplx(input[i * 2], 0); -@@ -49,8 +49,8 @@ +@@ -49,8 +50,8 @@ void dct4_init(Dct4* dct, int length) { @@ -69,7 +148,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin dct->length = length; dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); -@@ -73,12 +73,12 @@ +@@ -73,12 +74,12 @@ void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output) { @@ -85,8 +164,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-07-13 12:41:20 -@@ -53,7 +53,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); +@@ -53,7 +54,7 @@ LC3_INT nbbytes = nbbits >> 3; LC3_INT lastnz; LC3_INT bw_cutoff_idx; @@ -95,7 +182,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (nbits > nbbits) { -@@ -173,7 +173,7 @@ +@@ -173,7 +174,7 @@ } /* Last non-zero tuple */ @@ -106,8 +193,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (*lastnz > N) { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-07-13 12:41:20 -@@ -53,8 +53,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +@@ -53,8 +54,8 @@ if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1) { @@ -119,7 +214,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin # ifdef ENABLE_025_DMS_MODE diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-07-13 12:41:20 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-06-29 12:58:27 @@ -24,13 +24,13 @@ typedef uint32_t LC3_UINT32; @@ -149,8 +244,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define LC3_SQRT(x) (sqrtf(x)) diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-07-13 12:41:20 -@@ -68,7 +68,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) +@@ -68,7 +69,7 @@ dist = bw_dist[counter]; for (i = stop; i >= stop - dist; i--) { @@ -161,8 +264,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin brickwall = 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-07-13 12:41:20 -@@ -33,11 +33,11 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, +@@ -33,11 +34,11 @@ /* Last non zero touple */ if (bfi_ext == 1) { @@ -176,10 +287,29 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } /* LSB mode bit */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-07-13 12:41:20 -@@ -60,8 +60,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +@@ -60,8 +61,8 @@ } else { g_min = x_max / (32767 - 0.375); } @@ -190,7 +320,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS); -@@ -76,7 +76,7 @@ +@@ -76,7 +77,7 @@ tmp += x[i + 1] * x[i + 1]; tmp += x[i + 2] * x[i + 2]; tmp += x[i + 3] * x[i + 3]; @@ -201,20 +331,24 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-07-13 12:41:20 -@@ -8,7 +8,6 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-06-29 12:58:27 +@@ -8,7 +8,7 @@ ******************************************************************************/ - ++#include "options.h" #include "cfft.h" #include "iisfft.h" /* for M_PIl */ #include /* for abs() */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-07-13 12:41:20 -@@ -10,12 +10,12 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-06-29 12:58:27 +@@ -8,14 +8,15 @@ + ******************************************************************************/ + ++#include "options.h" #include #include -#include "iis_fft.h" @@ -228,7 +362,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin /**************************************************************************************************/ /* AFFT uses two fft implementations -@@ -24,9 +24,6 @@ +@@ -24,9 +25,6 @@ fast lengths, check the fft_n function. */ @@ -238,7 +372,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #define FFT_COMPLEX 1 #define FFT_REAL 2 -@@ -122,12 +119,13 @@ +@@ -122,12 +120,13 @@ IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output) { @@ -255,7 +389,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-07-13 12:41:20 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-06-29 12:58:27 @@ -12,6 +12,7 @@ #define IIS_FFT_H @@ -264,9 +398,20 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #include "cfft.h" #ifdef __cplusplus +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + + #include + #include /* for mmove */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-07-13 12:41:20 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-06-29 12:58:27 @@ -11,6 +11,7 @@ #ifndef IISFFT_H #define IISFFT_H @@ -275,10 +420,29 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin #ifndef M_PIl #define M_PIl 3.1415926535897932384626433832795029L /* pi */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + /* Function expects already flipped window */ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-07-13 12:41:20 -@@ -48,8 +48,9 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "lc3.h" + #include "defines.h" + #include "functions.h" +@@ -48,8 +49,9 @@ case 44100: return 1; case 48000: return 1; case 96000: return 1; @@ -289,7 +453,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) -@@ -58,8 +59,9 @@ +@@ -58,8 +60,9 @@ { case LC3PLUS_PLC_ADVANCED: /* fallthru */ return 1; @@ -300,7 +464,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } static int lc3plus_frame_size_supported(float frame_ms) -@@ -69,8 +71,9 @@ +@@ -69,8 +72,9 @@ case 25: /* fallthru */ case 50: /* fallthru */ case 100: return 1; @@ -311,7 +475,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } static int null_in_list(void **list, int n) -@@ -97,13 +100,14 @@ +@@ -97,13 +101,14 @@ /* encoder functions *********************************************************/ LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]) { @@ -327,7 +491,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < channels; ch++) { RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); -@@ -142,6 +146,7 @@ +@@ -142,6 +147,7 @@ int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder) { int ch = 0, totalBytes = 0; @@ -335,7 +499,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin RETURN_IF(encoder == NULL, 0); RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR); -@@ -150,7 +155,7 @@ +@@ -150,7 +156,7 @@ totalBytes += encoder->channel_setup[ch]->targetBytes; } @@ -344,7 +508,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (encoder->fs_in == 44100) { -@@ -191,11 +196,13 @@ +@@ -191,11 +197,13 @@ LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth) { @@ -359,7 +523,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (encoder->bandwidth != bandwidth) { if (encoder->fs_in > 40000) { effective_fs = 40000; -@@ -338,9 +345,9 @@ +@@ -338,9 +346,9 @@ LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder) { @@ -370,7 +534,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < encoder->channels; ch++) { mdct_free(&encoder->channel_setup[ch]->mdctStruct); dct2_free(&encoder->channel_setup[ch]->dct2StructSNS); -@@ -351,9 +358,9 @@ +@@ -351,9 +359,9 @@ LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder) { @@ -381,7 +545,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < decoder->channels; ch++) { dct4_free(&decoder->channel_setup[ch]->dct4structImdct); real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft); -@@ -378,11 +385,14 @@ +@@ -378,11 +386,14 @@ LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode) { @@ -398,10 +562,143 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (error != LC3PLUS_OK) { encoder->epmode = oldEpmode; // preserve old epmode in case of failure +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-06-29 12:58:27 +@@ -0,0 +1,99 @@ ++/****************************************************************************** ++* ETSI TS 103 634 V1.4.1 * ++* Low Complexity Communication Codec Plus (LC3plus) * ++* * ++* Copyright licence is solely granted through ETSI Intellectual Property * ++* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * ++* estoppel or otherwise. * ++******************************************************************************/ ++ ++ ++#include "options.h" ++#include "functions.h" ++#include "fft/iis_fft.c" ++#include "fft/iisfft.c" ++#include "fft/cfft.c" ++ ++void fft_init(Fft* fft, int length) ++{ ++ HANDLE_IIS_FFT handle = NULL; ++ IIS_FFT_ERROR error = 0; ++ assert(length % 2 == 0); ++ ++ fft->length = length; ++ ++ error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ fft->handle = handle; ++} ++ ++void fft_free(Fft* fft) ++{ ++ IIS_FFT_ERROR error = 0; ++ ++ if (fft) { ++ error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ memset(fft, 0, sizeof(*fft)); ++ } ++} ++ ++void real_fft_free(Fft* fft) ++{ ++ IIS_FFT_ERROR error = 0; ++ ++ if (fft) { ++ error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ memset(fft, 0, sizeof(*fft)); ++ } ++} ++ ++void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) ++{ ++ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; ++ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ ++ ++ fft->length = length; ++ ++ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); ++ assert(error == IIS_FFT_NO_ERROR); ++ fft->handle = *handle; ++} ++ ++ ++void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) ++{ ++ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; ++ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ ++ ++ fft->length = length; ++ ++ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++ fft->handle = *handle; ++} ++ ++void fft_apply(Fft* fft, const Complex* input, Complex* output) ++{ ++ IIS_FFT_ERROR error = 0; ++ error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++} ++ ++ ++void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) ++{ ++ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; ++ ++ UNUSED(error); ++ ++ error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); ++ ++ assert(error == IIS_FFT_NO_ERROR); ++} +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-07-13 12:41:20 -@@ -104,6 +104,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) +@@ -104,6 +105,7 @@ { LC3_FLOAT tmp[MAX_LEN * 2] = {0}; LC3_INT i = 0; @@ -409,7 +706,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin move_float(tmp, mdct->mem, mdct->mem_length); move_float(tmp + mdct->mem_length, input, mdct->length); -@@ -112,7 +113,7 @@ +@@ -112,7 +114,7 @@ mult_vec(tmp, mdct->window, mdct->length * 2); @@ -418,10 +715,34 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (i = 0; i < hlen; i++) { output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i]; output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 1970-01-01 01:00:00 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 2023-06-29 12:58:27 +@@ -0,0 +1 @@ ++Win32/ +\ No newline at end of file diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-07-13 12:50:08 -@@ -14,9 +14,9 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35 +@@ -8,15 +8,16 @@ + ******************************************************************************/ + + #include "functions.h" ++#include "options.h" + + + void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, const LC3_INT bands_number, const LC3_FLOAT* ener) { *near_nyquist_flag = 0; @@ -433,10 +754,139 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin LC3_INT i = 0; LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-07-13 12:41:20 -@@ -56,6 +56,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, +@@ -56,6 +57,8 @@ { case 2: { @@ -445,7 +895,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin assert(decoder->fs_idx == floor(decoder->fs / 10000)); // phaseECU supports only 10ms framing assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100); -@@ -69,7 +71,7 @@ +@@ -69,7 +72,7 @@ } /* call phaseEcu */ @@ -454,10 +904,106 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (prev_bfi_plc2 == 0) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-07-13 12:41:20 -@@ -135,13 +135,13 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +@@ -135,13 +136,13 @@ if (max_xfp_abs >= 0.5) { @@ -475,8 +1021,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-07-13 12:41:20 -@@ -30,6 +30,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + #include "constants.h" +@@ -30,6 +31,7 @@ LC3_INT32 segmentLen, e; LC3_FLOAT Xph; LC3_FLOAT seed_local; @@ -484,7 +1038,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin UNUSED(corr_phase_dbg); UNUSED(X_i_new_re_dbg); -@@ -49,8 +50,8 @@ +@@ -49,8 +51,8 @@ // EVOLVE PHASE ----------------- @@ -495,7 +1049,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin one_peak_flag_mask = -1; if (n_plocs < 3 && n_plocs > 0) { -@@ -219,9 +220,10 @@ +@@ -219,9 +221,10 @@ } static LC3_INT32 own_rand(LC3_INT32 seed) { @@ -511,14 +1065,15 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-07-13 12:50:08 -@@ -6,13 +6,13 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-29 12:58:35 +@@ -6,13 +6,14 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - + ++#include "options.h" #include "defines.h" #include "functions.h" @@ -528,7 +1083,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { LC3_INT32 i; -@@ -34,10 +34,10 @@ +@@ -34,10 +35,10 @@ trans[i] = 1.0; /* 0/0 no transient , no power change */ } } @@ -541,16 +1096,39 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin + return; } +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "defines.h" + #include "functions.h" + diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-07-13 12:50:08 -@@ -6,16 +6,16 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-29 12:58:35 +@@ -6,16 +6,17 @@ * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - + ++#include "options.h" #include "defines.h" #include "functions.h" @@ -565,7 +1143,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { LC3_FLOAT gr_pow_left[MAX_LGW]; LC3_FLOAT gr_pow_right[MAX_LGW]; -@@ -27,7 +27,7 @@ +@@ -27,7 +28,7 @@ LC3_INT32 attDegreeFrames; LC3_FLOAT thresh_dbg; @@ -574,7 +1152,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin UNUSED(tr_dec_dbg); UNUSED(gpc_dbg); -@@ -39,7 +39,7 @@ +@@ -39,7 +40,7 @@ } @@ -583,10 +1161,73 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg); return; +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + /***************************************************************************\ + * contents/description: Main function for Time domain concealment + \***************************************************************************/ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + #include "functions.h" ++#include "options.h" + + + void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static LC3_INT sign(LC3_FLOAT x); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-07-13 12:41:20 -@@ -17,6 +17,8 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], +@@ -17,6 +18,8 @@ LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0; LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0}; @@ -595,7 +1236,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin const LC3_FLOAT *filter; const LC3_FLOAT *filt_input, *filt_coeff; -@@ -49,12 +51,12 @@ +@@ -49,12 +52,12 @@ /* Upsampling & Low-pass Filtering & Downsampling */ @@ -614,7 +1255,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin k = 0; for (i = 0; i < N12k8; i++) { -@@ -78,9 +80,8 @@ +@@ -78,9 +81,8 @@ /* 50Hz High-Pass */ @@ -626,10 +1267,51 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (i = 0; i < len_12k8; i++) { LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + #include "functions.h" ++#include "options.h" + + LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) + { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-07-13 12:41:20 -@@ -32,6 +32,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "setup_dec_lc3.h" + #include "functions.h" + #include +@@ -32,6 +33,7 @@ LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu; HANDLE_IIS_FFT handle_fft_phaseecu; HANDLE_IIS_FFT handle_ifft_phaseecu; @@ -637,7 +1319,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < channels; ch++) { DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); -@@ -56,7 +57,7 @@ +@@ -56,7 +58,7 @@ sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); @@ -646,7 +1328,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (decoder) { decoder->channel_setup[ch] = setup; -@@ -346,6 +347,7 @@ +@@ -346,6 +348,7 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) { int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0; @@ -654,7 +1336,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin if (decoder->hrmode) { -@@ -375,7 +377,7 @@ +@@ -375,7 +378,7 @@ channel_bytes = nBytes; @@ -665,8 +1347,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin { diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-07-13 12:41:20 -@@ -33,6 +33,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "setup_enc_lc3.h" + #include "functions.h" + #include +@@ -33,6 +34,7 @@ , int32_t lfe_channel_array[] ) { @@ -674,7 +1364,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels)); alloc_encoder(encoder, channels); -@@ -56,7 +57,6 @@ +@@ -56,7 +58,6 @@ encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; encoder->r12k8_mem_out_len = 24; @@ -682,7 +1372,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin for (ch = 0; ch < encoder->channels; ch++) { encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; -@@ -220,6 +220,7 @@ +@@ -220,6 +221,7 @@ if (encoder->hrmode) { @@ -690,7 +1380,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin switch (encoder->frame_dms) { case 25: -@@ -243,6 +244,7 @@ +@@ -243,6 +245,7 @@ default: return LC3PLUS_HRMODE_ERROR; } @@ -698,7 +1388,7 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } else { -@@ -368,7 +370,7 @@ +@@ -368,7 +371,7 @@ setup->total_bits = setup->targetBytes << 3; setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits - encoder->noise_fac_bits - encoder->BW_cutoff_bits - @@ -709,8 +1399,16 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin setup->targetBitsInit = setup->targetBitsInit - 1; diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c --- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-07-13 12:41:20 -@@ -109,7 +109,7 @@ ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) +@@ -109,7 +110,7 @@ /* Log-domain */ for (i = 0; i < 64; i++) { @@ -719,3 +1417,58 @@ diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_poin } /* Downsampling */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-06-29 12:58:27 +@@ -17,6 +17,7 @@ + #include + #include + ++ + #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ + defined(__aarch64__) + #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); +diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c +--- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 ++++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-06-29 12:58:27 +@@ -8,6 +8,7 @@ + ******************************************************************************/ + + ++#include "options.h" + #include "functions.h" + + void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) -- GitLab From 7a3216a36e6b55702c81b5ac8d66be3db7b0eab1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 31 Jul 2023 12:41:54 +0200 Subject: [PATCH 546/591] turn avg_elevation_index_initial, avg_elevation_offset into uint16_t --- lib_enc/ivas_qmetadata_enc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index a5960dab6c..e9786e146c 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2551,7 +2551,12 @@ static int16_t ivas_qmetadata_entropy_encode_dir( float avg_direction_vector[3], direction_vector[3], avg_azimuth, avg_elevation; int16_t avg_azimuth_alphabet, avg_elevation_alphabet; uint16_t avg_azimuth_index, avg_elevation_index; +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + uint16_t avg_elevation_index_initial, avg_elevation_offset; + int16_t avg_elevation_index_projected; +#else int16_t avg_elevation_index_initial, avg_elevation_offset, avg_elevation_index_projected; +#endif int16_t avg_azimuth_index_initial, avg_azimuth_offset, avg_azimuth_index_projected; int16_t elevation_bits_ec_best, azimuth_bits_ec_best; @@ -2710,11 +2715,11 @@ static int16_t ivas_qmetadata_entropy_encode_dir( #ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { - avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + avg_elevation_offset ); + avg_elevation_index = avg_elevation_index_initial + avg_elevation_offset; } else { - avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ) ); + avg_elevation_index = avg_elevation_index_initial + (uint16_t) ivas_qmetadata_dereorder_generic( avg_elevation_offset ); } avg_elevation_index = (uint16_t) ( ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet ); -- GitLab From 1bda08b4f7845baa7fa03356c896da387c5ccb62 Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 31 Jul 2023 13:54:21 +0300 Subject: [PATCH 547/591] make avg_ele/azi_index_initial and _offset uint16_t --- lib_enc/ivas_qmetadata_enc.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index a5960dab6c..e6ab19b51d 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2551,9 +2551,15 @@ static int16_t ivas_qmetadata_entropy_encode_dir( float avg_direction_vector[3], direction_vector[3], avg_azimuth, avg_elevation; int16_t avg_azimuth_alphabet, avg_elevation_alphabet; uint16_t avg_azimuth_index, avg_elevation_index; +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + int16_t avg_elevation_index_projected; + int16_t avg_azimuth_index_projected; + uint16_t avg_elevation_index_initial, avg_elevation_offset; + uint16_t avg_azimuth_index_initial, avg_azimuth_offset; +#else int16_t avg_elevation_index_initial, avg_elevation_offset, avg_elevation_index_projected; int16_t avg_azimuth_index_initial, avg_azimuth_offset, avg_azimuth_index_projected; - +#endif int16_t elevation_bits_ec_best, azimuth_bits_ec_best; int16_t gr_param_elevation_best = 0, avg_elevation_index_best = 0; @@ -2707,28 +2713,23 @@ static int16_t ivas_qmetadata_entropy_encode_dir( for ( avg_elevation_offset = 0; avg_elevation_offset < q_direction->cfg.search_effort; avg_elevation_offset++ ) { -#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA - if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) - { - avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + avg_elevation_offset ); - } - else - { - avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ) ); - } - - avg_elevation_index = (uint16_t) ( ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet ); -#else if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { avg_elevation_index = avg_elevation_index_initial + avg_elevation_offset; } else { +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + avg_elevation_index = avg_elevation_index_initial + (uint16_t) ( ivas_qmetadata_dereorder_generic( avg_elevation_offset ) ); +#else avg_elevation_index = avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ); - } #endif + } +#ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA + avg_elevation_index = (uint16_t) (( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet); +#else avg_elevation_index = ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet; +#endif all_zero_dist_elevation_indexes = 1; if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) @@ -2846,7 +2847,7 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { set_zero( avg_direction_vector, 3 ); #ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA - avg_azimuth_index = (uint16_t) ( avg_azimuth_index_initial + ivas_qmetadata_dereorder_generic( avg_azimuth_offset ) ); + avg_azimuth_index = avg_azimuth_index_initial + (uint16_t) ( ivas_qmetadata_dereorder_generic( avg_azimuth_offset ) ); avg_azimuth_index = (uint16_t) ( ( avg_azimuth_index + avg_azimuth_alphabet ) % avg_azimuth_alphabet ); #else avg_azimuth_index = avg_azimuth_index_initial + ivas_qmetadata_dereorder_generic( avg_azimuth_offset ); -- GitLab From 1ff945ad659c995a403bafaf0a68b3f39fdbc292 Mon Sep 17 00:00:00 2001 From: malenov Date: Mon, 31 Jul 2023 13:16:35 +0200 Subject: [PATCH 548/591] remove obsolete comment related to IVAS-220 (N dependency on input Fs) --- lib_com/ivas_stereo_ica_com.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/ivas_stereo_ica_com.c b/lib_com/ivas_stereo_ica_com.c index f2fd09eca3..a68a9a709a 100644 --- a/lib_com/ivas_stereo_ica_com.c +++ b/lib_com/ivas_stereo_ica_com.c @@ -77,7 +77,6 @@ static void interpTargetChannel( return; } - /* IVAS-220: QCToDo: (check N for dependency on the inputFs) */ N = L_shift_adapt; factor = ( (float) N ) / abs( d ); interp_factor2 = factor / INTERP_FACTOR1; -- GitLab From 0b1dbf98e25f17654ad78c675cefdf1857e4cf36 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 31 Jul 2023 14:22:01 +0200 Subject: [PATCH 549/591] add OMASA self-test cases --- scripts/config/self_test.prm | 120 ++++++++++++++++++ .../sw_omasa_3obj_techs_start_160k_2fr.bin | 3 + .../sw_omasa_3obj_techs_start_24k4_2fr.bin | 3 + .../sw_omasa_3obj_techs_start_48k_2fr.bin | 3 + .../sw_omasa_4obj_techs_start_32k_2fr.bin | 3 + .../sw_omasa_4obj_techs_start_384k_2fr.bin | 3 + .../sw_omasa_4obj_techs_start_80k_2fr.bin | 3 + scripts/testv/stvOMASA_1ISM_1MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_1ISM_2MASA1TC32c.wav | 3 + scripts/testv/stvOMASA_1ISM_2MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_2ISM_1MASA1TC16c.wav | 3 + scripts/testv/stvOMASA_2ISM_1MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_2ISM_2MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_3ISM_1MASA1TC32c.wav | 3 + scripts/testv/stvOMASA_3ISM_1MASA2TC16c.wav | 3 + scripts/testv/stvOMASA_3ISM_1MASA2TC32c.wav | 3 + scripts/testv/stvOMASA_3ISM_1MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_3ISM_2MASA1TC48c.wav | 3 + scripts/testv/stvOMASA_3ISM_2MASA2TC32c.wav | 3 + scripts/testv/stvOMASA_3ISM_2MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_4ISM_1MASA1TC48c.wav | 3 + scripts/testv/stvOMASA_4ISM_1MASA2TC48c.wav | 3 + scripts/testv/stvOMASA_4ISM_2MASA1TC48c.wav | 3 + scripts/testv/stvOMASA_4ISM_2MASA2TC48c.wav | 3 + 24 files changed, 189 insertions(+) create mode 100644 scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin create mode 100644 scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin create mode 100644 scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin create mode 100644 scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin create mode 100644 scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin create mode 100644 scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin create mode 100644 scripts/testv/stvOMASA_1ISM_1MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_1ISM_2MASA1TC32c.wav create mode 100644 scripts/testv/stvOMASA_1ISM_2MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_2ISM_1MASA1TC16c.wav create mode 100644 scripts/testv/stvOMASA_2ISM_1MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_2ISM_2MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_1MASA1TC32c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_1MASA2TC16c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_1MASA2TC32c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_1MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_2MASA1TC48c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_2MASA2TC32c.wav create mode 100644 scripts/testv/stvOMASA_3ISM_2MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_4ISM_1MASA1TC48c.wav create mode 100644 scripts/testv/stvOMASA_4ISM_1MASA2TC48c.wav create mode 100644 scripts/testv/stvOMASA_4ISM_2MASA1TC48c.wav create mode 100644 scripts/testv/stvOMASA_4ISM_2MASA2TC48c.wav diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index f0b30c28cf..1dedab4556 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1245,3 +1245,123 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // NON DIEGETiC PAN at 60 kbps, 48kHz in, 48kHz out, STEREO out ../IVAS_cod 64000 48 testv/stv48c.wav bit ../IVAS_dec -non_diegetic_pan -0.5 48 bit testv/stv48c.pcm_MONO_64000_48-48_STEREO_NON-DIEGETIC-PAN_-0.5.tst + + + +// OMASA 2Dir2TC 1ISM at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -ism_masa 1 2 NULL testv/stv2MASA2TC48c.met 13200 48 testv/stvOMASA_1ISM_2MASA2TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stvOMASA_1ISM_2MASA2TC48c.wav_BINAURAL_13200_48-48.tst + +// OMASA 1Dir2TC 1ISM at 128 kbps, 48kHz in, 48kHz out, EXT out +../IVAS_cod -ism_masa 1 2 testv/stvISM1.csv testv/stv1MASA2TC48c.met 128000 48 testv/stvOMASA_1ISM_1MASA2TC48c.wav bit +../IVAS_dec EXT 48 bit testv/stvOMASA_1ISM_1MASA2TC48c.wav_EXT_128000_48-48.tst + +// OMASA 2Dir1TC 1ISM at 512 kbps, 32kHz in, 48kHz out, 7.1.4 out, FEC at 5% +../IVAS_cod -ism_masa 1 1 testv/stvISM1.csv testv/stv2MASA1TC48c.met 512000 32 testv/stvOMASA_1ISM_2MASA1TC32c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stvOMASA_1ISM_2MASA1TC32c.wav_7_1_4_512000_32-48.tst + + +// OMASA 1Dir1TC 2ISM at 16.4 kbps, 16kHz in, 48kHz out, 5.1 out +../IVAS_cod -ism_masa 2 1 testv/stvISM1.csv testv/stvISM2.csv testv/stv1MASA1TC48c.met 16400 16 testv/stvOMASA_2ISM_1MASA1TC16c.wav bit +../IVAS_dec 5_1 48 bit testv/stvOMASA_2ISM_1MASA1TC16c.wav_5_1_16400_16-48.tst + +// OMASA 2Dir2TC 2ISM at 32 kbps, 48kHz in, 48kHz out, STEREO out, FEC at 5% +../IVAS_cod -ism_masa 2 2 testv/stvISM1.csv testv/stvISM2.csv testv/stv2MASA2TC48c.met 32000 48 testv/stvOMASA_2ISM_2MASA2TC48c.wav bit +../IVAS_dec -fec 5 STEREO 48 bit testv/stvOMASA_2ISM_2MASA2TC48c.wav_STEREO_32000_48-48.tst + +// OMASA 1Dir2TC 2ISM at 256 kbps, 48kHz in, 32kHz out, BINAURAL_ROOM_IR out +../IVAS_cod -ism_masa 2 2 testv/stvISM1.csv NULL testv/stv1MASA2TC48c.met 256000 48 testv/stvOMASA_2ISM_1MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stvOMASA_2ISM_1MASA2TC48c.wav_BINAURAL_ROOM_IR_256000_48-32.tst + + +// OMASA 2Dir1TC 3ISM at 24.4 kbps, 48kHz in, 16kHz out, FOA out, FEC at 1% +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met 24400 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit +../IVAS_dec -fec 10 FOA 16 bit testv/stvOMASA_3ISM_2MASA1TC48c.wav_FOA_24400_48-16.tst + +// OMASA 1Dir2TC 3ISM at 32 kbps, 48kHz in, 16kHz out, STEREO out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met 32000 48 testv/stvOMASA_3ISM_1MASA2TC48c.wav bit +../IVAS_dec STEREO 16 bit testv/stvOMASA_3ISM_1MASA2TC48c.wav_STEREO_32000_48-16.tst + +// OMASA 2Dir2TC 3ISM at 32 kbps, 48kHz in, 48kHz out, 5.1.2 out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv NULL testv/stvISM3.csv testv/stv2MASA2TC48c.met 32000 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit +../IVAS_dec 5_1_2 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_5_1_2_32000_48-48.tst + +// OMASA 2Dir2TC 3ISM at 48 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met 48000 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_MONO_48000_48-48.tst + +// OMASA 1Dir1TC 3ISM at 64 kbps, 32kHz in, 32kHz out, BINAURAL out +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA1TC48c.met 64000 48 testv/stvOMASA_3ISM_1MASA1TC32c.wav bit +../IVAS_dec BINAURAL 32 bit testv/stvOMASA_3ISM_1MASA1TC32c.wav_BINAURAL_64000_32-32.tst + +// OMASA 2Dir2TC 3ISM at 80 kbps, 32kHz in, 16kHz out, 5.1.4 out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met 80000 48 testv/stvOMASA_3ISM_2MASA2TC32c.wav bit +../IVAS_dec 5_1_4 16 bit testv/stvOMASA_3ISM_2MASA2TC32c.wav_5_1_4_80000_32-16.tst + +// OMASA 2Dir1TC 3ISM at 96 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met 96000 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stvOMASA_3ISM_2MASA1TC48c.wav_MONO_96000_48-48.tst + +// OMASA 1Dir2TC 3ISM at 160 kbps, 16kHz in, 32kHz out, HOA3 out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met 160000 16 testv/stvOMASA_3ISM_1MASA2TC16c.wav bit +../IVAS_dec HOA3 32 bit testv/stvOMASA_3ISM_1MASA2TC16c.wav_HOA3_160000_16-32.tst + + +// OMASA 2Dir2TC 4ISM at 13.2 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met 13200 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_MONO_13200_48-48.tst + +// OMASA 2Dir1TC 4ISM at 24.4 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA1TC48c.met 24400 48 testv/stvOMASA_4ISM_2MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stvOMASA_4ISM_2MASA1TC48c.wav_STEREO_24400_48-48.tst + +// OMASA 1Dir2TC 4ISM at 32 kbps, 48kHz in, 48kHz out, FOA out, FEC at 5% +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met 32000 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit +../IVAS_dec -fec 5 FOA 48 bit testv/stvOMASA_4ISM_1MASA2TC48c.wav_FOA_32000_48-48.tst + +// OMASA 1Dir1TC 4ISM at 48 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out +../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA1TC48c.met 48000 48 testv/stvOMASA_4ISM_1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM_REVERB 48 bit testv/stvOMASA_4ISM_1MASA1TC48c.wav_BINAURAL_ROOM_REVERB_48000_48-48.tst + +// OMASA 2Dir2TC 4ISM at 64 kbps, 48kHz in, 48kHz out, HOA2 out +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv NULL NULL testv/stvISM4.csv testv/stv2MASA2TC48c.met 64000 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_dec HOA2 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_HOA2_64000_48-48.tst + +// OMASA 1Dir2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met 80000 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stvOMASA_4ISM_1MASA2TC48c.wav_MONO_80000_48-48.tst + +// OMASA 2Dir2TC 4ISM at 192 kbps, 48kHz in, 48kHz out, STEREO out +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met 192000 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_STEREO_192000_48-48.tst + +// OMASA 2Dir2TC 4ISM at 384 kbps, 48kHz in, 48kHz out, EXT out +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met 384000 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_dec EXT 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_EXT_384000_48-48.tst + + + +// OMASA 2Dir2TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 160 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_MONO_sw_48-48.tst + +// OMASA 2Dir1TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 48 kbps, 48kHz in, 32kHz out, STEREO out, FEC at 10% +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit +../IVAS_dec -fec 10 STEREO 32 bit testv/stvOMASA_3ISM_2MASA1TC48c.wav_STEREO_sw_48-32.tst + +// OMASA 1Dir2TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 24.4 kbps, 32kHz in, 48kHz out, 5.1.4 out +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin 32 testv/stvOMASA_3ISM_1MASA2TC32c.wav bit +../IVAS_dec 5_1_4 48 bit testv/stvOMASA_3ISM_1MASA2TC32c.wav_5_1_4_sw_32-48.tst + +// OMASA 1Dir1TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, FEC at 5% +../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA1TC48c.met scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin 48 testv/stvOMASA_4ISM_1MASA1TC48c.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stvOMASA_4ISM_1MASA1TC48c.wav_BINAURAL_sw_48-48.tst + +// OMASA 1Dir2TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, HOA3 out +../IVAS_cod -ism_masa 4 2 NULL testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit +../IVAS_dec HOA3 48 bit testv/stvOMASA_4ISM_1MASA2TC48c.wav_HOA3_sw_48-48.tst + +// OMASA 2Dir2TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM_REVERB 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_BINAURAL_ROOM_REVERB_sw_48-48.tst + diff --git a/scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin b/scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin new file mode 100644 index 0000000000..ff23abcf67 --- /dev/null +++ b/scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45dcea7873d3d7dcb400df7ca3203f00e6e15e860e82c5e4f9896dacb9041ef5 +size 60000 diff --git a/scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin b/scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin new file mode 100644 index 0000000000..8290cde916 --- /dev/null +++ b/scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d541c5670f27e7e0a6f12fb3c3477fa6d4c397c2fb58e1c2eb1bdfc927e72590 +size 60000 diff --git a/scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin b/scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin new file mode 100644 index 0000000000..f82831bb80 --- /dev/null +++ b/scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55bb67a9aa0ed5422b9aed489a7739a0dbc533eed6c0311199d0f573fc2cee2b +size 60000 diff --git a/scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin b/scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin new file mode 100644 index 0000000000..0c1248dec6 --- /dev/null +++ b/scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08bff7e0e16b2ef49917dbe871c0791a196479966a2a8f8f826b9f8cf6bc9a52 +size 60000 diff --git a/scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin b/scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin new file mode 100644 index 0000000000..9af47cd931 --- /dev/null +++ b/scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be6e64e869b55b7f97f1669feddee19447ac5a16e1e4922559a061ba6422767f +size 60000 diff --git a/scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin b/scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin new file mode 100644 index 0000000000..57dcddb9b3 --- /dev/null +++ b/scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0802b746ff110e01484e089af248de3b7c40a770677e3d8726f46d80cea324d0 +size 60000 diff --git a/scripts/testv/stvOMASA_1ISM_1MASA2TC48c.wav b/scripts/testv/stvOMASA_1ISM_1MASA2TC48c.wav new file mode 100644 index 0000000000..e38b586989 --- /dev/null +++ b/scripts/testv/stvOMASA_1ISM_1MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0328094fb152136a12c4316a959fd7eb6c01e95925de740933cf166803ee455b +size 1728044 diff --git a/scripts/testv/stvOMASA_1ISM_2MASA1TC32c.wav b/scripts/testv/stvOMASA_1ISM_2MASA1TC32c.wav new file mode 100644 index 0000000000..a32a121147 --- /dev/null +++ b/scripts/testv/stvOMASA_1ISM_2MASA1TC32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6458ac1d9e2c35b8a723f1b6625d7024a0d2bfc182a65420699ac6d514a7ea18 +size 768044 diff --git a/scripts/testv/stvOMASA_1ISM_2MASA2TC48c.wav b/scripts/testv/stvOMASA_1ISM_2MASA2TC48c.wav new file mode 100644 index 0000000000..98e6a80b29 --- /dev/null +++ b/scripts/testv/stvOMASA_1ISM_2MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4adfd69a7ea776730d9a743aa32a6b1ae873ff73994ec8ea23afe027ccd14f3d +size 864044 diff --git a/scripts/testv/stvOMASA_2ISM_1MASA1TC16c.wav b/scripts/testv/stvOMASA_2ISM_1MASA1TC16c.wav new file mode 100644 index 0000000000..05d9086160 --- /dev/null +++ b/scripts/testv/stvOMASA_2ISM_1MASA1TC16c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fff09aa34ffb52f578597cbaaff28526eaeb52153e7c2796e17bb7dce2a140d6 +size 288044 diff --git a/scripts/testv/stvOMASA_2ISM_1MASA2TC48c.wav b/scripts/testv/stvOMASA_2ISM_1MASA2TC48c.wav new file mode 100644 index 0000000000..1324f26319 --- /dev/null +++ b/scripts/testv/stvOMASA_2ISM_1MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a09d27aa61242801679ee93c34048bff61b4664a0493ee357ba82c65d107eef +size 2304044 diff --git a/scripts/testv/stvOMASA_2ISM_2MASA2TC48c.wav b/scripts/testv/stvOMASA_2ISM_2MASA2TC48c.wav new file mode 100644 index 0000000000..eec1e1a5dd --- /dev/null +++ b/scripts/testv/stvOMASA_2ISM_2MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23e6378a5e5bc722975f89c5418435b940b1e7822c1e43d7ee7c35f741763756 +size 1152044 diff --git a/scripts/testv/stvOMASA_3ISM_1MASA1TC32c.wav b/scripts/testv/stvOMASA_3ISM_1MASA1TC32c.wav new file mode 100644 index 0000000000..c7544e46e6 --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_1MASA1TC32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88a64e96dcbaa95e5a50613671befc574e64bde6eaa5cb050b130eac1c321356 +size 768044 diff --git a/scripts/testv/stvOMASA_3ISM_1MASA2TC16c.wav b/scripts/testv/stvOMASA_3ISM_1MASA2TC16c.wav new file mode 100644 index 0000000000..709efa573b --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_1MASA2TC16c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:890fb6d23af090364b2fd7bda81ebcdd59c59d29dc3a303328d7e9302c0a0f05 +size 960044 diff --git a/scripts/testv/stvOMASA_3ISM_1MASA2TC32c.wav b/scripts/testv/stvOMASA_3ISM_1MASA2TC32c.wav new file mode 100644 index 0000000000..f53a7298ce --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_1MASA2TC32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ceef3d334c210d8ced18971e87d5744f07e6c94fd7e2ec551b877c5e91ea7f8 +size 1920044 diff --git a/scripts/testv/stvOMASA_3ISM_1MASA2TC48c.wav b/scripts/testv/stvOMASA_3ISM_1MASA2TC48c.wav new file mode 100644 index 0000000000..ae75c67ccd --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_1MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f250d763522eea6432efdd570dfe6c7ecea10219ced29323b764ad4137788082 +size 2880044 diff --git a/scripts/testv/stvOMASA_3ISM_2MASA1TC48c.wav b/scripts/testv/stvOMASA_3ISM_2MASA1TC48c.wav new file mode 100644 index 0000000000..7dd19d4043 --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_2MASA1TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d456b6503afe8e7ba564591b7ec552622db0d69793dc9ef6162676f795efb11a +size 2304044 diff --git a/scripts/testv/stvOMASA_3ISM_2MASA2TC32c.wav b/scripts/testv/stvOMASA_3ISM_2MASA2TC32c.wav new file mode 100644 index 0000000000..85469214bb --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_2MASA2TC32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6732fb2f8d3c704b73df69f0a0c823f3fa7ebf385bdabaaabfaa72e67640b530 +size 960044 diff --git a/scripts/testv/stvOMASA_3ISM_2MASA2TC48c.wav b/scripts/testv/stvOMASA_3ISM_2MASA2TC48c.wav new file mode 100644 index 0000000000..a0fad593df --- /dev/null +++ b/scripts/testv/stvOMASA_3ISM_2MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9f3b674dd74719711542e051f2e7669c2413bcfce3e43892d31e0a6eb539bf8 +size 1440044 diff --git a/scripts/testv/stvOMASA_4ISM_1MASA1TC48c.wav b/scripts/testv/stvOMASA_4ISM_1MASA1TC48c.wav new file mode 100644 index 0000000000..257b9b0d13 --- /dev/null +++ b/scripts/testv/stvOMASA_4ISM_1MASA1TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3be277b69272b3ba762d020c6b9470b0fe1f5c2bdf2fc232f4c5dd20601067bc +size 1440044 diff --git a/scripts/testv/stvOMASA_4ISM_1MASA2TC48c.wav b/scripts/testv/stvOMASA_4ISM_1MASA2TC48c.wav new file mode 100644 index 0000000000..7e14bf21d4 --- /dev/null +++ b/scripts/testv/stvOMASA_4ISM_1MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85342c4644bbe41c45c4be9e1d4fb0a8ce2f84ef545555acd27decba1d50278a +size 3456044 diff --git a/scripts/testv/stvOMASA_4ISM_2MASA1TC48c.wav b/scripts/testv/stvOMASA_4ISM_2MASA1TC48c.wav new file mode 100644 index 0000000000..399c5fb559 --- /dev/null +++ b/scripts/testv/stvOMASA_4ISM_2MASA1TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:398e16af0e508bc42f60a31988d8a5bcfd60ba2e125067b0278d3de0e3cc0731 +size 2880044 diff --git a/scripts/testv/stvOMASA_4ISM_2MASA2TC48c.wav b/scripts/testv/stvOMASA_4ISM_2MASA2TC48c.wav new file mode 100644 index 0000000000..70b494f201 --- /dev/null +++ b/scripts/testv/stvOMASA_4ISM_2MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5dd8a743f64ef52285c3ca6e6d938a5eb4522aa1ce7ddd308241e6c06de1e96 +size 1728044 -- GitLab From 40566c22110a38a4becccf214ae6a2ae100e9a6a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 14:32:34 +0200 Subject: [PATCH 550/591] [cleanup] validation fixes and some cleanup --- apps/decoder.c | 2 +- lib_com/ivas_cnst.h | 2 +- lib_dec/ivas_dec.c | 25 ++++---- lib_rend/ivas_splitRendererPre.c | 14 ++--- lib_rend/ivas_splitRenderer_utils.c | 37 ++++++++--- lib_rend/lib_rend.c | 58 ++++++++++++++---- lib_util/split_render_file_read_write.c | 2 +- tests/split_rendering/test_split_rendering.py | 61 +++++++++++++------ 8 files changed, 143 insertions(+), 58 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 74aa3d7376..9c94396675 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -83,7 +83,7 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) #ifdef SPLIT_REND_WITH_HEAD_ROT -#define MAX_SPLIT_REND_BITRATE ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/ +#define MAX_SPLIT_REND_BITRATE ( 768000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ? */ #define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #endif #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 827d7f7b3f..6bf206fb78 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1542,7 +1542,7 @@ typedef enum #define SPLIT_REND_MAX_DOF (3) -#define MAX_HEAD_ROT_POSES (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) /* TODO tmu : revisit for harmonization */ +#define MAX_HEAD_ROT_POSES (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) #define MAX_SPLIT_REND_MD_BANDS (20) #define MAX_SPLIT_MD_SUBFRAMES (1) #define COMPLEX_MD_BAND_THRESH (MAX_SPLIT_REND_MD_BANDS) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index befac6dcc3..cbecd3c619 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -844,20 +844,23 @@ ivas_error ivas_dec( max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; - ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, - st_ivas->hHeadTrackData->Quaternions, - st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, - st_ivas->hRenderConfig->split_rend_config.codec, - hSplitBinRend->hSplitRendBits, - hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, - hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, - max_band, output, 1, + if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, + st_ivas->hHeadTrackData->Quaternions, + st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, + st_ivas->hRenderConfig->split_rend_config.codec, + hSplitBinRend->hSplitRendBits, + hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, + hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, + max_band, output, 1, #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - td_input, + td_input, #else - st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV, + st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV, #endif - pcm_out ); + pcm_out ) ) != IVAS_ERR_OK ) + { + return error; + } free( st_ivas->splitBinRend.hMultiBinCldfbData ); } diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 83159854ed..0d7e1ed19e 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1900,7 +1900,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, { ivas_error error, ch, num_ch; CLDFB_TYPE cldfbMode; - uint8_t useLc3plus; uint8_t isCldfbNeeded = 0; cldfbMode = CLDFB_ANALYSIS; @@ -1909,7 +1908,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, return error; } - useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */ error = IVAS_ERR_OK; if ( is_cldfb_in == 0 ) @@ -1972,9 +1970,9 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, if ( is_pcm_out == 0 ) { - if ( !useLc3plus ) + if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) { - error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ); + error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; @@ -1982,7 +1980,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, } else { - error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate ); + error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) ); if ( error != IVAS_ERR_OK ) { return error; @@ -2193,7 +2191,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( if ( pcm_out == 0 ) { pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; - pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; /* TODO(sgi): useLc3plus could be changed to splitCodec */ + pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; if ( !useLc3plus ) { // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000; @@ -2312,7 +2310,9 @@ ivas_error ivas_renderMultiBinToSplitBinaural( set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); } - /*TODO : why should this be called during run time ?*/ + /* Needs to be done at runtime. If this was in another API function, + * there would be no guarantee that the user did not change + * the split rendering config before calling the main rendering function */ ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out ); if ( td_input ) diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index baa5f79139..70c218fb1f 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -539,7 +539,8 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL } default: { - return -1; + bitrate = -1; + break; } } @@ -563,22 +564,44 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Only CLDFB pose correction supports HQ mode" ); } + /* Split rendering with no pose correction - 0 DOF and pose correction NONE must only ever be set together */ + if ( ( pSplitRendConfig->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE && pSplitRendConfig->dof != 0 ) || + ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE && pSplitRendConfig->dof == 0 ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "0 DOF and pose correction NONE must only ever be set together" ); + } + /* Validate bitrate */ if ( is_pcm_out == 0 ) { switch ( pSplitRendConfig->splitRendBitRate ) { - case SPLIT_REND_384k: - case SPLIT_REND_512k: - case SPLIT_REND_768k: - /* Always valid */ - break; case SPLIT_REND_256k: + if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Unsupported bitrate for LCLD codec" ); + } + + if ( pSplitRendConfig->dof != 0 ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrates of 320 kbps and lower are only valid with 0 DOF" ); + } + break; case SPLIT_REND_320k: /* Only valid with 0 DOF */ if ( pSplitRendConfig->dof != 0 ) { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "bitrates below 320 kpbs are only valid with 0 DOF" ); + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrates of 320 kbps and lower are only valid with 0 DOF" ); + } + break; + case SPLIT_REND_384k: + case SPLIT_REND_512k: + /* Always valid */ + break; + case SPLIT_REND_768k: + if ( pSplitRendConfig->dof == 0 && pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrate is too high for LC3plus with 0 DOF" ); } break; default: diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ee9ec89fac..b132f2e343 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3538,7 +3538,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN pSplit_rend_config, outputSampleRate, cldfb_in, - ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); if ( error != IVAS_ERR_OK ) { return error; @@ -4119,6 +4119,7 @@ static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_Aud if ( pSplitRendEncBuffer->data != NULL ) { free( pSplitRendEncBuffer->data ); + pSplitRendEncBuffer->data = NULL; } pSplitRendEncBuffer->config.numChannels = 0; pSplitRendEncBuffer->config.numSamplesPerChannel = 0; @@ -4160,7 +4161,13 @@ ivas_error IVAS_REND_AddInput( { cldfb_in = 1; } - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in ) ) != IVAS_ERR_OK ) + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, + &hIvasRend->splitRendEncBuffer, + &hIvasRend->hRendererConfig->split_rend_config, + hIvasRend->headRotData, + hIvasRend->sampleRateOut, + hIvasRend->outputConfig, + cldfb_in ) ) != IVAS_ERR_OK ) { return error; } @@ -5032,6 +5039,22 @@ int16_t IVAS_REND_FeedRenderConfig( { return error; } + + /* Must re-initialize split rendering config in case renderer config is updated after adding renderer inputs */ + closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, + 1, + hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); + if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, + &hIvasRend->splitRendEncBuffer, + &hIvasRend->hRendererConfig->split_rend_config, + hIvasRend->headRotData, + hIvasRend->sampleRateOut, + hIvasRend->outputConfig, + 0 ) ) != IVAS_ERR_OK ) + { + return error; + } #endif return IVAS_ERR_OK; @@ -6193,10 +6216,11 @@ static ivas_error renderIsmToSplitBinaural( accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); pop_wmops(); + /* Encoding to split rendering bitstream done at a higher level */ return IVAS_ERR_OK; } #endif /* SPLIT_REND_WITH_HEAD_ROT */ -/* Encoding to split rendering bitstream done at a higher level */ + static ivas_error renderIsmToMasa( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -6882,6 +6906,12 @@ static ivas_error renderMcToSplitBinaural( } } + /* temporary buffer for rotation in source format for CREND */ + tmpRotBuffer = mcInput->base.inputBuffer; + if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inConfig != IVAS_REND_AUDIO_CONFIG_5_1 && inConfig != IVAS_REND_AUDIO_CONFIG_7_1 ) + { + tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + } for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { @@ -6942,9 +6972,6 @@ static ivas_error renderMcToSplitBinaural( * 4. LFE mixing * 5. tmpSplitBinBuffer accumulated to outBuffer */ - /* temporary buffer for rotation in source format */ - tmpRotBuffer = mcInput->base.inputBuffer; - tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); /* copy input for in-place rotation */ mvr2r( mcInput->base.inputBuffer.data, tmpRotBuffer.data, @@ -6989,8 +7016,6 @@ static ivas_error renderMcToSplitBinaural( * overwrite original audio, which is still needed for rendering next head pose. */ mvr2r( tmpRendBuffer[0], tmpSplitBinauralBuffer[2 * pos_idx], output_frame ); mvr2r( tmpRendBuffer[1], tmpSplitBinauralBuffer[2 * pos_idx + 1], output_frame ); - - free( tmpRotBuffer.data ); } /* restore original headrotation data */ @@ -7000,7 +7025,12 @@ static ivas_error renderMcToSplitBinaural( } } - /* TODO tmu : needs delay compensation */ + if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inConfig != IVAS_REND_AUDIO_CONFIG_5_1 && inConfig != IVAS_REND_AUDIO_CONFIG_7_1 ) + { + /* free temporary buffer for rotation in source format for CREND */ + free( tmpRotBuffer.data ); + } + if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -7235,11 +7265,15 @@ static ivas_error renderSplitBinauralWithPostRot( config.channels = BINAURAL_CHANNELS; config.samplerate = *splitBinInput->base.ctx.pOutSampleRate; - IVAS_LC3PLUS_DEC_Open( config, + error = IVAS_LC3PLUS_DEC_Open( config, #ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING - 0 /* caching disabled */, + 0 /* caching disabled */, #endif - &splitBinInput->splitPostRendWrapper.hLc3plusDec ); + &splitBinInput->splitPostRendWrapper.hLc3plusDec ); + if ( error != IVAS_ERR_OK ) + { + return error; + } } for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index b596a5781c..bb75f9fa9d 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -235,7 +235,7 @@ ivas_error split_rend_read_bits_from_file( header_len = strlen( header ); - /*write frame header*/ + /*read frame header*/ for ( i = 0; i < header_len; i++ ) { if ( fread( &header_read[i], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index ecfa875f4a..207c229681 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -30,6 +30,36 @@ import pytest from tests.split_rendering.utils import * + +def check_xfail(test_info, in_fmt, render_config, bitrate=None): + if "768k" in render_config and ( + "lc3plus" in render_config + or (in_fmt in INPUT_FORMATS_ISM or in_fmt in INPUT_FORMATS_MC) + or ( + "external_split" in test_info.node.name and in_fmt in INPUT_FORMATS_AMBI + ) # CREND for external renderer ambisonics rendering uses LC3plus by default + ): + pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + + if "256k" in render_config and ( + "lcld" in render_config + or (in_fmt in INPUT_FORMATS_AMBI or in_fmt in INPUT_FORMATS_MASA) + or ( + "full_chain_split" in test_info.node.name + and in_fmt in INPUT_FORMATS_MC + and bitrate <= IVAS_BITRATES_MC[1] + ) # FastConv for ParamMC/ParamUpmix modes uses LCLD by default + ): + pytest.xfail("Unsupported bitrate for LCLD codec") + + if ( + bitrate + and (in_fmt in INPUT_FORMATS_ISM) + and (int(bitrate) > int(IVAS_MAX_ISM_BITRATE[in_fmt[-1]])) + ): + pytest.skip(f"Unsupported configuration with {in_fmt} at {bitrate}bps") + + """ Ambisonics """ @@ -37,9 +67,10 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) @pytest.mark.parametrize("bitrate", IVAS_BITRATES_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) -def test_ambisonics_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_lc3plus" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") +def test_ambisonics_full_chain_split( + test_info, in_fmt, bitrate, render_config, trajectory +): + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -58,8 +89,7 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, bitrate, render_config, @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): - if "0dof_768k_lc3plus" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -80,9 +110,10 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) -def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") +def test_multichannel_full_chain_split( + test_info, in_fmt, bitrate, render_config, trajectory +): + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -101,8 +132,7 @@ def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -124,10 +154,7 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("bitrate", IVAS_BITRATES_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - elif int(bitrate) > int(IVAS_MAX_ISM_BITRATE[in_fmt[-1]]): - pytest.skip(f"Unsupported configuration with {in_fmt} at {bitrate}bps") + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -146,8 +173,7 @@ def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, traject @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -169,8 +195,7 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_lc3plus" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") -- GitLab From 105cd5659dc3109d614b2beff41e3ec6c1bfefe5 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Mon, 31 Jul 2023 15:13:19 +0200 Subject: [PATCH 551/591] return the prototype of the original function divided in split rendering version under the else path of the switch --- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index f0085cee84..5315d5e219 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -95,8 +95,12 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, float *subFrameTotalEne, float *IIReneLimiter ); static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const float *subFrameTotalEne, const float *IIReneLimiter ); +#else +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked ); +#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t isHeadtracked ); -- GitLab From 4bdb67d90c28506a0088cbd0dd95aebda7d2532f Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 31 Jul 2023 16:15:43 +0300 Subject: [PATCH 552/591] fix clang and new ubsan --- lib_enc/ivas_qmetadata_enc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 97ff923d92..e8ae02b7c8 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2719,13 +2719,13 @@ static int16_t ivas_qmetadata_entropy_encode_dir( else { #ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA - avg_elevation_index = avg_elevation_index_initial + (uint16_t) ( ivas_qmetadata_dereorder_generic( avg_elevation_offset ) ); + avg_elevation_index = (uint16_t) ( avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ) ); #else avg_elevation_index = avg_elevation_index_initial + ivas_qmetadata_dereorder_generic( avg_elevation_offset ); #endif } #ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA - avg_elevation_index = (uint16_t) (( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet); + avg_elevation_index = (uint16_t) ( ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet ); #else avg_elevation_index = ( avg_elevation_index + avg_elevation_alphabet ) % avg_elevation_alphabet; #endif @@ -2846,7 +2846,7 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { set_zero( avg_direction_vector, 3 ); #ifdef FIX_635_UBSAN_UNDEFINED_BEHAVIOUR_QMETA - avg_azimuth_index = avg_azimuth_index_initial + (uint16_t) ( ivas_qmetadata_dereorder_generic( avg_azimuth_offset ) ); + avg_azimuth_index = (uint16_t) ( avg_azimuth_index_initial + ivas_qmetadata_dereorder_generic( avg_azimuth_offset ) ); avg_azimuth_index = (uint16_t) ( ( avg_azimuth_index + avg_azimuth_alphabet ) % avg_azimuth_alphabet ); #else avg_azimuth_index = avg_azimuth_index_initial + ivas_qmetadata_dereorder_generic( avg_azimuth_offset ); -- GitLab From bc5608f80d18cea91bfd09564a0dd281a88c9665 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 16:01:06 +0200 Subject: [PATCH 553/591] [fix] move split rendering related renderer selection to a subkey of SPLITREND in the renderer config, and restore the original override to be only enabled with DEBUGGING + small readme update --- apps/renderer.c | 2 +- lib_com/common_api_types.h | 14 +++++++++-- lib_dec/lib_dec.c | 1 + lib_rend/ivas_render_config.c | 5 +--- lib_rend/ivas_stat_rend.h | 4 ---- lib_rend/lib_rend.c | 41 ++++++--------------------------- lib_util/render_config_reader.c | 34 +++++++++++++++++++-------- readme.txt | 34 +++++++++++++++++++++++++-- 8 files changed, 79 insertions(+), 56 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 17c84d9b81..817b423383 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -688,7 +688,7 @@ static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER { int16_t cldfb_in; cldfb_in = 0; - if ( renderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) + if ( renderConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { #ifdef DEBUGGING cldfb_in = 1; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 59f6387935..79bda1eaa6 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -115,6 +115,15 @@ typedef enum IVAS_SPLIT_REND_CODEC_NONE } IVAS_SPLIT_REND_CODEC; +typedef enum +{ + IVAS_SPLIT_REND_RENDERER_SELECTION_CREND, + IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV, + IVAS_SPLIT_REND_RENDERER_SELECTION_PARAMBIN, + IVAS_SPLIT_REND_RENDERER_SELECTION_TDREND, + IVAS_SPLIT_REND_RENDERER_SELECTION_DEFAULT, +} IVAS_SPLIT_REND_RENDERER_SELECTION; + typedef struct ivas_split_rend_bits_t { uint8_t *bits_buf; @@ -147,7 +156,7 @@ typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering +#ifdef DEBUGGING typedef enum { IVAS_RENDER_TYPE_OVERRIDE_NONE, @@ -193,12 +202,13 @@ typedef struct _IVAS_SPLIT_REND_CONFIG int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; IVAS_SPLIT_REND_CODEC codec; + IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection; } IVAS_SPLIT_REND_CONFIG_DATA; #endif typedef struct _IVAS_RENDER_CONFIG { -#if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering +#ifdef DEBUGGING IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index e83e5a7e3c..bbfd0a10d6 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1596,6 +1596,7 @@ ivas_error IVAS_DEC_GetRenderConfig( hRCout->split_rend_config.codec_delay_ms = 0; hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; + hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; #endif return IVAS_ERR_OK; diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 9bd86138e1..e4a62d217f 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -106,12 +106,8 @@ ivas_error ivas_render_config_init_from_rom( { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } -#ifndef SPLIT_REND_WITH_HEAD_ROT #ifdef DEBUGGING ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; -#endif -#else - ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; #endif ( *hRenderConfig )->roomAcoustics.override = FALSE; ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; @@ -135,6 +131,7 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; ( *hRenderConfig )->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; ( *hRenderConfig )->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; + ( *hRenderConfig )->split_rend_config.rendererSelection = IVAS_SPLIT_REND_RENDERER_SELECTION_DEFAULT; #endif return IVAS_ERR_OK; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index cf345c1305..5b1971eda3 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -909,12 +909,8 @@ typedef struct ivas_roomAcoustics_t typedef struct ivas_render_config_t { -#ifndef SPLIT_REND_WITH_HEAD_ROT #ifdef DEBUGGING ivas_renderTypeOverride renderer_type_override; -#endif -#else - ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; float directivity[3]; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b132f2e343..7592f9ea1d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2691,7 +2691,7 @@ static ivas_error updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { - if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + if ( hRendCfg->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); @@ -2720,8 +2720,7 @@ static ivas_error updateSbaPanGains( #endif case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hRendCfg->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) - + if ( hRendCfg->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, @@ -4157,7 +4156,7 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in; cldfb_in = 0; if ( ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) || - ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS && hIvasRend->hRendererConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) ) + ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS && hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) ) { cldfb_in = 1; } @@ -4601,7 +4600,7 @@ ivas_error IVAS_REND_GetDelay( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL ) { - if ( hIvasRend->hRendererConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; } @@ -4919,7 +4918,6 @@ int16_t IVAS_REND_GetRenderConfig( } hRCin = hIvasRend->hRendererConfig; -#ifndef SPLIT_REND_WITH_HEAD_ROT #ifdef DEBUGGING switch ( hRCin->renderer_type_override ) { @@ -4933,20 +4931,6 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; break; } -#endif -#else - switch ( hRCin->renderer_type_override ) - { - case RENDER_TYPE_OVERRIDE_CREND: - hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; - break; - case RENDER_TYPE_OVERRIDE_FASTCONV: - hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; - break; - default: - hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; - break; - } #endif hRCout->room_acoustics.override = hRCin->roomAcoustics.override; hRCout->room_acoustics.nBands = hRCin->roomAcoustics.nBands; @@ -4965,6 +4949,7 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.codec_delay_ms = 0; hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; + hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; #endif return IVAS_ERR_OK; @@ -4992,7 +4977,6 @@ int16_t IVAS_REND_FeedRenderConfig( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } hRenderConfig = hIvasRend->hRendererConfig; -#ifndef SPLIT_REND_WITH_HEAD_ROT #ifdef DEBUGGING hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) @@ -5004,17 +4988,6 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; } #endif -#else - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; - if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) - { - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_FASTCONV; - } - if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) - { - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; - } -#endif hRenderConfig->roomAcoustics.override = renderConfig.room_acoustics.override; hRenderConfig->roomAcoustics.nBands = renderConfig.room_acoustics.nBands; @@ -7536,7 +7509,7 @@ static ivas_error renderSbaToSplitBinaural( push_wmops( "renderSbaToSplitBinaural" ); error = IVAS_ERR_OK; - if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + if ( sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { renderSbaToMultiBinauralCldfb( sbaInput, @@ -7577,7 +7550,7 @@ static ivas_error renderSbaToBinaural( push_wmops( "renderSbaToBinaural" ); #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( sbaInput->base.ctx.hhRendererConfig[0]->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + if ( sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index d2941713f7..cf73c78942 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -525,22 +525,17 @@ ivas_error RenderConfigReader_read( } else if ( strcmp( item, "DOF" ) == 0 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT dofProvided = true; -#endif if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.dof ) ) { errorHandler( item, ERROR_VALUE_INVALID ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT /* 0 DOF implies no pose correction */ if ( hRenderConfig->split_rend_config.dof == 0 && !poseCorrProvided ) { hRenderConfig->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; } -#endif } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( item, "CODEC" ) == 0 ) { if ( strcmp( pValue, "LCLD" ) == 0 ) @@ -577,8 +572,29 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } -#endif - + else if ( strcmp( item, "RENDERER" ) == 0 ) + { + if ( strcmp( pValue, "CREND" ) == 0 ) + { + hRenderConfig->split_rend_config.rendererSelection = IVAS_SPLIT_REND_RENDERER_SELECTION_CREND; + } + else if ( strcmp( pValue, "FASTCONV" ) == 0 ) + { + hRenderConfig->split_rend_config.rendererSelection = IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV; + } + else if ( strcmp( pValue, "PARAMBIN" ) == 0 ) + { + hRenderConfig->split_rend_config.rendererSelection = IVAS_SPLIT_REND_RENDERER_SELECTION_PARAMBIN; + } + else if ( strcmp( pValue, "TDREND" ) == 0 ) + { + hRenderConfig->split_rend_config.rendererSelection = IVAS_SPLIT_REND_RENDERER_SELECTION_TDREND; + } + else + { + errorHandler( pValue, ERROR_VALUE_INVALID ); + } + } #ifdef DEBUGGING else { @@ -588,8 +604,8 @@ ivas_error RenderConfigReader_read( } free( pValue ); } -#endif -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#endif /* SPLIT_REND_WITH_HEAD_ROT */ +#ifdef DEBUGGING else if ( strcmp( chapter, "GENERAL" ) == 0 && strlen( pParams ) != 0 ) { params_idx = 0; diff --git a/readme.txt b/readme.txt index 6ae443abf3..d24e41adf9 100644 --- a/readme.txt +++ b/readme.txt @@ -228,7 +228,7 @@ Usage for IVAS: IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file Mandatory parameters: --------------------- OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA, - HOA2, HOA3, BINAURAL, BINAURAL_ROOM, EXT + HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM, EXT By default, channel order and loudspeaker positions are equal to the encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker layout file. See below for details. @@ -274,7 +274,37 @@ Options: The usage of the "IVAS_rend" program is as follows: --------------------------------------------------- -TBD +Usage: IVAS_rend [options] + +Valid options: + --input_file, -i Path to the input file (WAV, raw PCM or scene description file) + --input_format, -if Audio format of input file (e.g. 5_1 or HOA3 or META, use -l for a list) + --input_metadata, -im Space-separated list of path to metadata files for ISM or MASA inputs or BINAURAL_SPLIT_PCM input mode + --output_file, -o Path to the output file + --output_format, -of Output format to render. + Alternatively, can be a custom loudspeaker layout file + --sample_rate, -fs Input sampling rate in kHz (16, 32, 48) - required only with raw PCM inputs + --trajectory_file, -tf Head rotation trajectory file for simulation of head tracking (only for binaural outputs) + --output_metadata, -om coded metadata file for BINAURAL_SPLIT_PCM output mode + --post_rend_bfi_file, -prbfi Split rendering option: bfi file + --reference_rotation_file, -rf Reference rotation trajectory file for simulation of head tracking (only for binaural outputs) + --custom_hrtf, -hrtf Custom HRTF file for binaural rendering (only for binaural outputs) + --render_config, -rc Binaural renderer configuration file (only for binaural outputs) + --non_diegetic_pan, -ndp Panning mono non diegetic sound to stereo -90<= pan <= 90 + left or l or 90->left, right or r or -90->right, center or c or 0 ->middle + + --tracking_type, -otr Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for binaural outputs) + --lfe_position, -lp Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear (like --gain, -g) and azimuth, elevation are in degrees. + If specified, overrides the default behavior which attempts to map input to output LFE channel(s) + --lfe_matrix, -lm LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). + If specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s) + --no_delay_cmp, -ndc [flag] Turn off delay compensation + --quiet, -q [flag] Limit printouts to terminal + --gain, -g Input gain (linear, not in dB) to be applied to input audio file + --list, -l List supported audio formats + --reference_vector_file, -rvf Reference vector trajectory file for simulation of head tracking (only for binaural outputs) + --exterior_orientation_file, -exof External orientation trajectory file for simulation of external orientations + --sync_md_delay, -smd Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes) MULTICHANNEL LOUDSPEAKER INPUT / OUTPUT CONFIGURATIONS -- GitLab From df6e8f0d8d327844a5f1e7b269632a1bfeb1bf74 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 16:24:48 +0200 Subject: [PATCH 554/591] [cleanup] change some pragma once to include guards --- lib_rend/ivas_lc3plus_common.h | 6 +++++- lib_rend/ivas_lc3plus_dec.h | 5 ++++- lib_rend/ivas_lc3plus_enc.h | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_lc3plus_common.h b/lib_rend/ivas_lc3plus_common.h index eae0a5396b..93a37488cc 100644 --- a/lib_rend/ivas_lc3plus_common.h +++ b/lib_rend/ivas_lc3plus_common.h @@ -30,7 +30,9 @@ *******************************************************************************************************/ -#pragma once +#ifndef IVAS_LC3PLUS_COM_H +#define IVAS_LC3PLUS_COM_H + #include #include "ivas_error.h" @@ -51,3 +53,5 @@ typedef struct LC3PLUS_CONFIG /*! utility function to convert LC3PLUS_Errors to the suitable ivas_error */ ivas_error IVAS_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ); + +#endif /* IVAS_LC3PLUS_COM_H */ diff --git a/lib_rend/ivas_lc3plus_dec.h b/lib_rend/ivas_lc3plus_dec.h index 572120d499..b7592fd740 100644 --- a/lib_rend/ivas_lc3plus_dec.h +++ b/lib_rend/ivas_lc3plus_dec.h @@ -30,7 +30,8 @@ *******************************************************************************************************/ -#pragma once +#ifndef IVAS_LC3PLUS_DEC_H +#define IVAS_LC3PLUS_DEC_H #include #include "lc3.h" @@ -136,3 +137,5 @@ ivas_error IVAS_LC3PLUS_DEC_Conceal( ivas_error IVAS_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( int16_t ***subframeChannelMatrix, const uint32_t num_decs ); void IVAS_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix ); + +#endif /* IVAS_LC3PLUS_DEC_H */ diff --git a/lib_rend/ivas_lc3plus_enc.h b/lib_rend/ivas_lc3plus_enc.h index 1eea994a7e..b54f16996b 100644 --- a/lib_rend/ivas_lc3plus_enc.h +++ b/lib_rend/ivas_lc3plus_enc.h @@ -30,7 +30,8 @@ *******************************************************************************************************/ -#pragma once +#ifndef IVAS_LC3PLUS_ENC_H +#define IVAS_LC3PLUS_ENC_H #include #include "lc3.h" @@ -71,3 +72,5 @@ ivas_error IVAS_LC3PLUS_ENC_Encode( float **pcm_in, /* i: pointer input samples */ void *bitstream_out /* o: pointer to bitstream frame */ ); + +#endif /* IVAS_LC3PLUS_ENC_H */ -- GitLab From 4e31bf0b11d3638f9855616345c575ca76a02b39 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 16:46:09 +0200 Subject: [PATCH 555/591] [fix] instrumented build --- lib_util/render_config_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index cf73c78942..e93baa3c3f 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -294,7 +294,7 @@ static ivas_error RenderConfigReader_checkValues( return IVAS_ERR_WRONG_PARAMS; } -#if ( defined DEBUGGING ) || ( defined SPLIT_REND_WITH_HEAD_ROT ) +#ifdef DEBUGGING /* Specific limits for Jot reverb */ if ( hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) { -- GitLab From a1e9bdb8df35d86c97835ab40d4126860f88b898 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 17:01:59 +0200 Subject: [PATCH 556/591] [cleanup] code readability and whitespace --- lib_dec/ivas_binRenderer_internal.c | 6 +++--- lib_dec/ivas_dec.c | 9 ++++----- lib_dec/ivas_init_dec.c | 1 + lib_dec/lib_dec.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 555333785e..babfa29259 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1705,13 +1705,13 @@ void ivas_binRenderer( QuatToRotMat( Quaternions_rel, Rmat_local ); - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); + rotateFrame_sd_cldfb( Rmat_local, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); } else { - rotateFrame_sd_cldfb( Rmat_local, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); } ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[pos_idx], Cldfb_ImagBuffer_Binaural[pos_idx], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer, pos_idx ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index cbecd3c619..13db40e8b5 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -125,11 +125,10 @@ ivas_error ivas_dec( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - assert( ( st_ivas->ivas_format == SBA_FORMAT || - st_ivas->ivas_format == MASA_FORMAT || - st_ivas->ivas_format == ISM_FORMAT || - st_ivas->ivas_format == MC_FORMAT ) && - ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, MASA, discrete and parametric ISM, or MC formats and 48 kHz sampling rate only" ); + assert( ( st_ivas->ivas_format != UNDEFINED_FORMAT && + st_ivas->ivas_format != MONO_FORMAT && + st_ivas->ivas_format != STEREO_FORMAT ) && + ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, MASA, ISM, or MC formats and 48 kHz sampling rate only" ); #else assert( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1bb5ed5e2d..f0f4f0eb57 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -696,6 +696,7 @@ int16_t getNumChanSynthesis( return n; } + /*-------------------------------------------------------------------* * copy_decoder_config() * diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index bbfd0a10d6..0783ec30f2 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -288,12 +288,12 @@ void IVAS_DEC_Close( } #ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* - * mapAudioConfig2DecAudoioConfig() + * mapAudioConfig2DecAudioConfig() * * *---------------------------------------------------------------------*/ -static IVAS_DEC_AUDIO_CONFIG mapAudioConfig2DecAudoioConfig( +static IVAS_DEC_AUDIO_CONFIG mapAudioConfig2DecAudioConfig( const AUDIO_CONFIG audio_config ) { IVAS_DEC_AUDIO_CONFIG dec_audio_config; @@ -3352,7 +3352,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( num_samples = 0; if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) { - *audio_config = mapAudioConfig2DecAudoioConfig( st_ivas->splitBinRend.hCldfbDataOut->config ); + *audio_config = mapAudioConfig2DecAudioConfig( st_ivas->splitBinRend.hCldfbDataOut->config ); if ( st_ivas->splitBinRend.hCldfbDataOut->config != AUDIO_CONFIG_INVALID ) { num_chs = audioCfg2channels( st_ivas->splitBinRend.hCldfbDataOut->config ); -- GitLab From 91807c4e1485c4a957d32543e222085d1b1fecc7 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 31 Jul 2023 17:07:28 +0200 Subject: [PATCH 557/591] [tests] update BE comparison test too + formatting (isort && black) --- tests/split_rendering/constants.py | 30 ++++++++++++----- tests/split_rendering/test_split_rendering.py | 2 +- .../test_split_rendering_be_comparison.py | 32 ++++++++----------- tests/split_rendering/utils.py | 20 ++++++------ 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/tests/split_rendering/constants.py b/tests/split_rendering/constants.py index e500f526d2..c53455f66c 100644 --- a/tests/split_rendering/constants.py +++ b/tests/split_rendering/constants.py @@ -57,14 +57,28 @@ from tests.renderer.constants import ( ) """ Renderer configurations """ -RENDERER_CONFIGS_DEFAULT_CODEC = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_default.txt")] -RENDERER_CONFIGS_LCLD_CODEC = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_lcld.txt")] -RENDERER_CONFIGS_LC3PLUS_CODEC = [str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_lc3plus.txt")] - -RENDERER_CONFIGS_TO_TEST_AMBI = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LC3PLUS_CODEC -RENDERER_CONFIGS_TO_TEST_MC = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LCLD_CODEC -RENDERER_CONFIGS_TO_TEST_ISM = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LCLD_CODEC -RENDERER_CONFIGS_TO_TEST_MASA = RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LC3PLUS_CODEC +RENDERER_CONFIGS_DEFAULT_CODEC = [ + str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_default.txt") +] +RENDERER_CONFIGS_LCLD_CODEC = [ + str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_lcld.txt") +] +RENDERER_CONFIGS_LC3PLUS_CODEC = [ + str(cfg.stem) for cfg in RENDER_CFG_DIR.glob("*_lc3plus.txt") +] + +RENDERER_CONFIGS_TO_TEST_AMBI = ( + RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LC3PLUS_CODEC +) +RENDERER_CONFIGS_TO_TEST_MC = ( + RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LCLD_CODEC +) +RENDERER_CONFIGS_TO_TEST_ISM = ( + RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LCLD_CODEC +) +RENDERER_CONFIGS_TO_TEST_MASA = ( + RENDERER_CONFIGS_DEFAULT_CODEC + RENDERER_CONFIGS_LC3PLUS_CODEC +) """ IVAS specific constants """ FORMAT_TO_IVAS_COD_FORMAT = { diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 207c229681..06fa85e413 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -48,7 +48,7 @@ def check_xfail(test_info, in_fmt, render_config, bitrate=None): "full_chain_split" in test_info.node.name and in_fmt in INPUT_FORMATS_MC and bitrate <= IVAS_BITRATES_MC[1] - ) # FastConv for ParamMC/ParamUpmix modes uses LCLD by default + ) # FastConv for ParamMC/ParamUpmix modes uses LCLD by default ): pytest.xfail("Unsupported bitrate for LCLD codec") diff --git a/tests/split_rendering/test_split_rendering_be_comparison.py b/tests/split_rendering/test_split_rendering_be_comparison.py index 3cd037233a..c4566c0ced 100644 --- a/tests/split_rendering/test_split_rendering_be_comparison.py +++ b/tests/split_rendering/test_split_rendering_be_comparison.py @@ -28,6 +28,7 @@ import pytest +from tests.split_rendering.test_split_rendering import check_xfail from tests.split_rendering.utils import * """ Ambisonics """ @@ -37,9 +38,10 @@ from tests.split_rendering.utils import * @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) @pytest.mark.parametrize("bitrate", IVAS_BITRATES_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) -def test_ambisonics_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_lc3plus" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") +def test_ambisonics_full_chain_split( + test_info, in_fmt, bitrate, render_config, trajectory +): + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -58,8 +60,7 @@ def test_ambisonics_full_chain_split(test_info, in_fmt, bitrate, render_config, @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory): - if "0dof_768k_lc3plus" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -80,9 +81,10 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory) @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) -def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") +def test_multichannel_full_chain_split( + test_info, in_fmt, bitrate, render_config, trajectory +): + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -101,8 +103,7 @@ def test_multichannel_full_chain_split(test_info, in_fmt, bitrate, render_config @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:]) def test_multichannel_external_split(test_info, in_fmt, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -124,10 +125,7 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector @pytest.mark.parametrize("bitrate", IVAS_BITRATES_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - elif int(bitrate) > int(IVAS_MAX_ISM_BITRATE[in_fmt[-1]]): - pytest.skip(f"Unsupported configuration with {in_fmt} at {bitrate}bps") + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -146,8 +144,7 @@ def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, traject @pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) def test_ism_external_split(test_info, in_fmt, render_config, trajectory): - if "0dof_768k_default" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") @@ -169,8 +166,7 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory): @pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajectory): - if "0dof_768k_lc3plus" in render_config: - pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") + check_xfail(test_info, in_fmt, render_config, bitrate) post_trajectory = HR_TRAJECTORY_DIR.joinpath(f"{trajectory}.csv") pre_trajectory = post_trajectory.with_stem(f"{post_trajectory.stem}_delayed") diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 21fe2304ba..d00a65f0c1 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -27,15 +27,15 @@ """ import sys -import numpy as np from pathlib import Path from tempfile import TemporaryDirectory from typing import Tuple -from tests.split_rendering.constants import * +import numpy as np -from tests.renderer.utils import check_BE, run_cmd, test_info from tests.cut_pcm import cut_samples +from tests.renderer.utils import check_BE, run_cmd, test_info +from tests.split_rendering.constants import * sys.path.append(SCRIPTS_DIR) from pyaudio3dtools.audiofile import readfile @@ -80,12 +80,14 @@ def run_full_chain_split_rendering( in_file = FORMAT_TO_FILE_COMPARETEST[in_fmt] in_data, in_fs = readfile(in_file) if len(in_data) > INPUT_DURATION_SEC * in_fs: - cut_samples(in_file=in_file, - out_file=cut_in_file, - num_channels=FORMAT_TO_NCHAN[in_fmt], - sample_rate=in_fs, - start=0, - duration=INPUT_DURATION_SEC) + cut_samples( + in_file=in_file, + out_file=cut_in_file, + num_channels=FORMAT_TO_NCHAN[in_fmt], + sample_rate=in_fs, + start=0, + duration=INPUT_DURATION_SEC, + ) cmd[3] = str(cut_in_file) else: cmd[3] = str(in_file) -- GitLab From 6983ec746dba0d008db709fdbdbc2fec81910011 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 31 Jul 2023 18:17:17 +0200 Subject: [PATCH 558/591] properly exit when DTX operation is requested on the command-line --- lib_enc/ivas_init_enc.c | 5 ----- lib_enc/lib_enc.c | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index b678125363..f3eada2892 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -178,11 +178,6 @@ void ivas_write_format_sid( ind = SID_MASA_2TC; } break; -#ifdef MASA_AND_OBJECTS - case MASA_ISM_FORMAT: /* TODO Nokia: Finalize for SID case */ - ind = 8; - break; -#endif default: assert( !"Reserved SID format symbol written." ); break; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 249d243fe6..1d80309090 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -941,7 +941,11 @@ static ivas_error configureEncoder( if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && ( ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || - hEncoderConfig->ivas_format == MC_FORMAT ) ) + hEncoderConfig->ivas_format == MC_FORMAT +#ifdef MASA_AND_OBJECTS + || hEncoderConfig->ivas_format == MASA_ISM_FORMAT +#endif + ) ) { return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } -- GitLab From 2e84f606bfe778894af8258537c59009f468beb4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 31 Jul 2023 18:33:17 +0200 Subject: [PATCH 559/591] replace a magic number by macro IVAS_BRATE_OMASA_STEREO_SW_THR --- lib_enc/ivas_stereo_td_analysis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 8f86f25986..92bcd319d2 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -82,6 +82,10 @@ #define RMS_THR 100 #define RATIO_PG_LRTD 0.96f +#ifdef MASA_AND_OBJECTS +#define IVAS_BRATE_OMASA_STEREO_SW_THR 15000 +#endif + /*-------------------------------------------------------------------* * Local function prototypes @@ -202,7 +206,7 @@ int16_t stereo_tdm_ener_analysis( if ( ivas_format == MASA_ISM_FORMAT ) { - if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < 15000 ) ) + if ( ( hCPE->hStereoClassif->lrtd_mode == 1 || hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 ) && ( hCPE->element_brate - 50 * FRAMES_PER_SEC + hCPE->brate_surplus + hCPE->brate_surplus < IVAS_BRATE_OMASA_STEREO_SW_THR ) ) { hStereoTD->prev_fr_LRTD_TD_dec = 0; } -- GitLab From 6d197de51354fd7c4d6355815bf22951e9999632 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 31 Jul 2023 23:03:12 +0200 Subject: [PATCH 560/591] fix format --- lib_enc/ivas_stereo_icbwe_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_stereo_icbwe_enc.c b/lib_enc/ivas_stereo_icbwe_enc.c index 14bf01e32b..f17786e173 100644 --- a/lib_enc/ivas_stereo_icbwe_enc.c +++ b/lib_enc/ivas_stereo_icbwe_enc.c @@ -515,7 +515,7 @@ void stereo_icBWE_enc( } /* resets done here. Need to move them to a separate function */ - if ( ( hStereoICBWE->prev_refChanIndx_bwe != hStereoICBWE->refChanIndx_bwe ) || ( st->last_extl != st->extl ) || st->flag_ACELP16k != 1 ) + if ( ( hStereoICBWE->prev_refChanIndx_bwe != hStereoICBWE->refChanIndx_bwe ) || ( st->last_extl != st->extl ) || st->flag_ACELP16k != 1 ) { hStereoICBWE->prevSpecMapping = 0; hStereoICBWE->memShbSpecMapping = 0; -- GitLab From b9d295d16aa36e960adb55d0c0057b41f7589984 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 1 Aug 2023 05:38:31 +0000 Subject: [PATCH 561/591] Removes leftover refactor todo comments --- lib_rend/ivas_dirac_dec_binaural_functions.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 8a3f33b80b..e97143dd22 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -116,7 +116,6 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); -// Todo Tapani refactor: Create separate init & render functions for MASA external renderer. The decoder versions would become too complex if generalized. /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() @@ -124,7 +123,6 @@ static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], f * Initialize parametric binaural renderer *------------------------------------------------------------------------*/ -// Todo Tapani refactor: To be moved to lib_dec ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ @@ -377,7 +375,6 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( * *------------------------------------------------------------------------*/ -// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -447,7 +444,6 @@ void ivas_dirac_dec_binaural_render( * loudness correction for parametric binaural renderer *------------------------------------------------------------------------*/ -// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural_sba_gain( float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ @@ -482,7 +478,6 @@ void ivas_dirac_dec_binaural_sba_gain( * Parametric binaural renderer main function *------------------------------------------------------------------------*/ -// Todo Tapani refactor: To be moved to lib_dec void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ @@ -568,7 +563,6 @@ void ivas_dirac_dec_binaural( * Local functions *------------------------------------------------------------------------*/ -// Todo refactor: To be moved to lib_dec static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, -- GitLab From 7796d2e8148e9f66cfb45495ffef365834637cd3 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 08:16:12 +0200 Subject: [PATCH 562/591] added the implementation of the divided function into the else path of SPLIT_REND_WITH_HEAD_ROT_PARAMBIN --- lib_rend/ivas_dirac_dec_binaural_functions.c | 412 +++++++++++++++++++ 1 file changed, 412 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 5315d5e219..7fe09ddade 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1018,6 +1018,7 @@ static void ivas_dirac_dec_decorrelate_slot( return; } +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, @@ -1472,7 +1473,418 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( return; } +#else +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + PARAMBIN_REND_CONFIG_HANDLE hConfig, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float Rmat[3][3], + const int16_t subframe, + const int16_t isHeadtracked ) +{ + int16_t ch, slot, bin; + int16_t separateCenterChannelRendering; + int16_t nBins, idx; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + float IIReneLimiterFactor; + float qualityBasedSmFactor; + float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; + uint8_t applyLowBitRateEQ; + int16_t dirac_read_idx; + float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; + + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + qualityBasedSmFactor = hConfig->qualityBasedSmFactor; + qualityBasedSmFactor *= qualityBasedSmFactor; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + + set_zero( hDiracDecBin->ChCrossRe, nBins ); + set_zero( hDiracDecBin->ChCrossIm, nBins ); + set_zero( hDiracDecBin->ChCrossReOut, nBins ); + set_zero( hDiracDecBin->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( hDiracDecBin->ChEne[ch], nBins ); + set_zero( hDiracDecBin->ChEneOut[ch], nBins ); + } + set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) + { + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + } + + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ + applyLowBitRateEQ = 0; + if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + applyLowBitRateEQ = 1; + if ( ivas_total_brate == IVAS_16k4 ) + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; + } + } + else + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; + } + } + } + + /* Formulate input and target covariance matrices for this subframe */ + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + + /* Calculate input covariance matrix */ + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float instEne; + + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + hDiracDecBin->ChEne[ch][bin] += instEne; + subFrameTotalEne[bin] += instEne; + } + hDiracDecBin->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + hDiracDecBin->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; + hDiracDecBin->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; + } + } + + /* Apply EQ at low bit rates */ + if ( applyLowBitRateEQ ) + { + int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; + + for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[bin]; + } + for ( ; bin < nBins; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; + } + } + if ( ivas_format == SBA_FORMAT && nchan_transport == 2 ) + { + float tempRe, tempIm; + + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + tempRe = inRe[0][slot][bin] + inRe[1][slot][bin]; + tempIm = inIm[0][slot][bin] + inIm[1][slot][bin]; + subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; + } + } + } + + /* Determine target covariance matrix containing target binaural properties */ + for ( bin = 0; bin < nBins; bin++ ) + { + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ + float diffEne, dirEne, meanEnePerCh; + int16_t dirIndex; + + /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. + * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the + * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match + * the early spectrum of the BRIR data, using the spectral correction data in + * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ + meanEnePerCh = hDiracDecBin->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + + /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + for ( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) + { + int16_t aziDeg, eleDeg; + float lRealp, lImagp, rRealp, rImagp; + float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; + float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; + + if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ + { + aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; + ratio = hSpatParamRendCom->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence[dirac_read_idx][bin]; + } + else /* For second of the two simultaneous directions */ + { + if ( ( ratio = hSpatParamRendCom->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) + { + /* This touches only MASA path where second direction always has smaller ratio and + * for non-2dir it is zero. As the whole direction contribution is multiplied with + * the ratio, a very small ratio does not contribute any energy to output. Thus, + * it is better to save complexity. */ + continue; + } + aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; + eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; + spreadCoh = hSpatParamRendCom->spreadCoherence2[dirac_read_idx][bin]; + } + diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ + + if ( separateCenterChannelRendering ) + { + /* In masa + mono rendering mode, the center directions originate from phantom sources, so the + * spread coherence is increased */ + float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; + + aziRad = (float) aziDeg * PI_OVER_180; + eleRad = (float) eleDeg * PI_OVER_180; + doaVectorX = cosf( aziRad ) * cosf( eleRad ); + spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; + altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); + spreadCoh = max( spreadCoh, altSpreadCoh ); + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 )], isHeadtracked ); + + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + /* Synthesizing spread coherence is not needed for stereo loudspeaker output, + * as directional sound is reproduced with two loudspeakers in any case */ + spreadCoh = 0.0f; + } + + if ( spreadCoh > 0.0f ) + { + float centerMul, sidesMul; + float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; + float w1, w2, w3, eq; + + hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. + * The following formulas determine the gains for these sources. + * spreadCoh = 0: Only panning + * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) + * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ + if ( spreadCoh < 0.5f ) + { + /* 0.0f < spreadCoh < 0.5f */ + sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ + centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; + } + else + { + /* 0.5f <= spreadCoh < 1.0f */ + centerMul = 2.0f - ( 2.0f * spreadCoh ); + sidesMul = inv_sqrt( centerMul + 2.0f ); + centerMul *= sidesMul; + } + + /* Apply the gain for the center source of the three coherent sources */ + lRealp *= centerMul; + lImagp *= centerMul; + rRealp *= centerMul; + rImagp *= centerMul; + + /* Apply the gain for the left source of the three coherent sources */ + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 1 )], isHeadtracked ); + + hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Apply the gain for the right source of the three coherent sources. + * -30 degrees to 330 wrapping due to internal functions. */ + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[( dirIndex * 3 + 2 )], isHeadtracked ); + + hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ + hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + + ( hrtfEneCenter * centerMul * centerMul ) ) / + max( 1e-12f, hrtfEneRealized ); + + /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ + if ( spreadCoh < 0.5 ) + { + w1 = 1.0f - 2.0f * spreadCoh; + w2 = 2.0f * spreadCoh; + w3 = 0.0f; + } + else + { + w1 = 0.0f; + w2 = 2.0f - 2.0f * spreadCoh; + w3 = 2.0f * spreadCoh - 1.0f; + } + + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + + /* Apply the target spectrum to the eneCorrectionFactor */ + if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ + { + eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; + } + else + { + eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; + } + } + + /* Equalize the spread coherent combined HRTFs */ + eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); + lRealp *= eq; + lImagp *= eq; + rRealp *= eq; + rImagp *= eq; + } + + hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); + hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); + hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); + hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); + + /* Add direct part (1 or 2) covariance matrix */ + dirEne = ratio * meanEnePerCh; + hDiracDecBin->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + hDiracDecBin->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + hDiracDecBin->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + hDiracDecBin->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + } + + /* Add diffuse / ambient part covariance matrix */ + diffuseness = max( 0.0f, diffuseness ); + diffEne = diffuseness * meanEnePerCh; + surCoh = hSpatParamRendCom->surroundingCoherence[dirac_read_idx][bin]; + if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + { + if ( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; + } + } + hDiracDecBin->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + hDiracDecBin->ChEneOut[1][bin] += diffEne; + + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ + hDiracDecBin->ChCrossReOut[bin] += surCoh * diffEne; + } + else /* When rendering binaural, ambience has frequency dependent ICC. */ + { + if ( ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + { + float diffuseFieldCoherence; + diffuseFieldCoherence = hDiracDecBin->hDiffuseDist->diffuseRatioX[bin] * hDiracDecBin->diffuseFieldCoherenceX[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioY[bin] * hDiracDecBin->diffuseFieldCoherenceY[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioZ[bin] * hDiracDecBin->diffuseFieldCoherenceZ[bin]; + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + } + else + { + hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * hDiracDecBin->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + } + } + + /* Store parameters for formulating average diffuseness over frame */ + hDiracDecBin->frameMeanDiffuseness[bin] += diffEne; + frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; + } + + /* Formulate average diffuseness over frame */ + for ( bin = 0; bin < nBins; bin++ ) + { + hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); + } + + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); + } + for ( bin = 0; bin < nBins; bin++ ) + { + float eneRatio, IIReneLimiter; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); + IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); + + hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; + hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; + } + + hDiracDecBin->ChCrossRe[bin] += IIReneLimiter * hDiracDecBin->ChCrossRePrev[bin]; + hDiracDecBin->ChCrossIm[bin] += IIReneLimiter * hDiracDecBin->ChCrossImPrev[bin]; + hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossReOutPrev[bin]; + hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossImOutPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne[ch][bin] += IIReneLimiter * hDiracDecBin->ChEnePrev[ch][bin]; + hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter * hDiracDecBin->ChEneOutPrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; + hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; + hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; + hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; + hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; + } + } + + return; +} +#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, -- GitLab From 30ac6c1cc480d0e41bbae206bd1bf7c2d16d8a57 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 1 Aug 2023 09:34:20 +0300 Subject: [PATCH 563/591] Apply clang format --- lib_rend/ivas_dirac_dec_binaural_functions.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index e97143dd22..805c80c9f3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -116,7 +116,6 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); - /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() * -- GitLab From bd4fa789caa637817ff45af32cffaf0db1c0676c Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Tue, 1 Aug 2023 17:08:41 +1000 Subject: [PATCH 564/591] Add condition for not 0 DoF in check_xfail for 256kbps LCLD codec --- tests/split_rendering/test_split_rendering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 06fa85e413..6bc75b4867 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -41,7 +41,7 @@ def check_xfail(test_info, in_fmt, render_config, bitrate=None): ): pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - if "256k" in render_config and ( + if "256k" in render_config and "0dof" not in render_config and ( "lcld" in render_config or (in_fmt in INPUT_FORMATS_AMBI or in_fmt in INPUT_FORMATS_MASA) or ( -- GitLab From 11041ed3078774a9e42c8b433a111bd4a485ee9b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 1 Aug 2023 10:23:55 +0200 Subject: [PATCH 565/591] [tests] update high bitrate xfail for LC3plus to only fail for 0 DoF --- tests/split_rendering/test_split_rendering.py | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 6bc75b4867..6bcbc42123 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -32,23 +32,31 @@ from tests.split_rendering.utils import * def check_xfail(test_info, in_fmt, render_config, bitrate=None): - if "768k" in render_config and ( - "lc3plus" in render_config - or (in_fmt in INPUT_FORMATS_ISM or in_fmt in INPUT_FORMATS_MC) - or ( - "external_split" in test_info.node.name and in_fmt in INPUT_FORMATS_AMBI - ) # CREND for external renderer ambisonics rendering uses LC3plus by default + if ( + "768k" in render_config + and "0dof" in render_config + and ( + "lc3plus" in render_config + or (in_fmt in INPUT_FORMATS_ISM or in_fmt in INPUT_FORMATS_MC) + or ( + "external_split" in test_info.node.name and in_fmt in INPUT_FORMATS_AMBI + ) # CREND for external renderer ambisonics rendering uses LC3plus by default + ) ): pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") - if "256k" in render_config and "0dof" not in render_config and ( - "lcld" in render_config - or (in_fmt in INPUT_FORMATS_AMBI or in_fmt in INPUT_FORMATS_MASA) - or ( - "full_chain_split" in test_info.node.name - and in_fmt in INPUT_FORMATS_MC - and bitrate <= IVAS_BITRATES_MC[1] - ) # FastConv for ParamMC/ParamUpmix modes uses LCLD by default + if ( + "256k" in render_config + and "0dof" not in render_config + and ( + "lcld" in render_config + or (in_fmt in INPUT_FORMATS_AMBI or in_fmt in INPUT_FORMATS_MASA) + or ( + "full_chain_split" in test_info.node.name + and in_fmt in INPUT_FORMATS_MC + and bitrate <= IVAS_BITRATES_MC[1] + ) # FastConv for ParamMC/ParamUpmix modes uses LCLD by default + ) ): pytest.xfail("Unsupported bitrate for LCLD codec") -- GitLab From e7a6d9e4b7bdd0d0acd77221e0d9970f55f77265 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 10:49:28 +0200 Subject: [PATCH 566/591] remove outdated comments --- lib_dec/ivas_masa_dec.c | 4 ++-- lib_enc/ivas_init_enc.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index c63f4af93f..62b642f449 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -496,7 +496,7 @@ ivas_error ivas_masa_decode( int16_t block; int16_t meta_write_index; - for ( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) /* Todo Nokia: Probably there is a better place for this eventually */ + for ( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) { for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { @@ -509,6 +509,7 @@ ivas_error ivas_masa_decode( } } } + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; @@ -2235,7 +2236,6 @@ static void decode_ism_ratios( /* save previous subframe index values */ if ( sf < numSf - 1 ) { - /* Todo Nokia: can be moved to the read_ism_ratio ... function */ for ( band = 0; band < nbands; band++ ) { mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], n_ism ); diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index f3eada2892..330046a5cd 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -528,7 +528,7 @@ ivas_error ivas_init_encoder( } } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { @@ -707,7 +707,7 @@ ivas_error ivas_init_encoder( return error; } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { if ( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { @@ -746,7 +746,7 @@ ivas_error ivas_init_encoder( ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) // VE: TBV - is this loop needed? + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { if ( ( error = create_sce_enc( st_ivas, sce_id, brate_sce ) ) != IVAS_ERR_OK ) { @@ -754,7 +754,7 @@ ivas_error ivas_init_encoder( } } - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) // VE: TBV - is this loop needed? + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; -- GitLab From 039dddd15a70d6729936e45e8f5cd13e64789648 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 11:48:10 +0200 Subject: [PATCH 567/591] changed one omasa self-test to use all-NONE ISM metadata. renamed omasa brswitching sequences. --- scripts/config/self_test.prm | 14 +++++++------- ...w_13k2_512k_2fr_start_160k_omasatechs_3ism.bin} | 0 ...w_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin} | 0 ...sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin} | 0 ...w_13k2_512k_2fr_start_384k_omasatechs_4ism.bin} | 0 ...sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin} | 0 ...sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin} | 0 7 files changed, 7 insertions(+), 7 deletions(-) rename scripts/switchPaths/{sw_omasa_3obj_techs_start_160k_2fr.bin => sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin} (100%) rename scripts/switchPaths/{sw_omasa_3obj_techs_start_24k4_2fr.bin => sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin} (100%) rename scripts/switchPaths/{sw_omasa_4obj_techs_start_32k_2fr.bin => sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin} (100%) rename scripts/switchPaths/{sw_omasa_4obj_techs_start_384k_2fr.bin => sw_13k2_512k_2fr_start_384k_omasatechs_4ism.bin} (100%) rename scripts/switchPaths/{sw_omasa_3obj_techs_start_48k_2fr.bin => sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin} (100%) rename scripts/switchPaths/{sw_omasa_4obj_techs_start_80k_2fr.bin => sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin} (100%) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 1dedab4556..26604d6b55 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1283,7 +1283,7 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec STEREO 16 bit testv/stvOMASA_3ISM_1MASA2TC48c.wav_STEREO_32000_48-16.tst // OMASA 2Dir2TC 3ISM at 32 kbps, 48kHz in, 48kHz out, 5.1.2 out -../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv NULL testv/stvISM3.csv testv/stv2MASA2TC48c.met 32000 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit +../IVAS_cod -ism_masa 3 2 NULL NULL NULL testv/stv2MASA2TC48c.met 32000 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit ../IVAS_dec 5_1_2 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_5_1_2_32000_48-48.tst // OMASA 2Dir2TC 3ISM at 48 kbps, 48kHz in, 48kHz out, MONO out @@ -1342,26 +1342,26 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // OMASA 2Dir2TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 160 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit ../IVAS_dec MONO 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_MONO_sw_48-48.tst // OMASA 2Dir1TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 48 kbps, 48kHz in, 32kHz out, STEREO out, FEC at 10% -../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit ../IVAS_dec -fec 10 STEREO 32 bit testv/stvOMASA_3ISM_2MASA1TC48c.wav_STEREO_sw_48-32.tst // OMASA 1Dir2TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 24.4 kbps, 32kHz in, 48kHz out, 5.1.4 out -../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin 32 testv/stvOMASA_3ISM_1MASA2TC32c.wav bit +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin 32 testv/stvOMASA_3ISM_1MASA2TC32c.wav bit ../IVAS_dec 5_1_4 48 bit testv/stvOMASA_3ISM_1MASA2TC32c.wav_5_1_4_sw_32-48.tst // OMASA 1Dir1TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, FEC at 5% -../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA1TC48c.met scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin 48 testv/stvOMASA_4ISM_1MASA1TC48c.wav bit +../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA1TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_1MASA1TC48c.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stvOMASA_4ISM_1MASA1TC48c.wav_BINAURAL_sw_48-48.tst // OMASA 1Dir2TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -ism_masa 4 2 NULL testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit +../IVAS_cod -ism_masa 4 2 NULL testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit ../IVAS_dec HOA3 48 bit testv/stvOMASA_4ISM_1MASA2TC48c.wav_HOA3_sw_48-48.tst // OMASA 2Dir2TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out -../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_384k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit ../IVAS_dec BINAURAL_ROOM_REVERB 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_BINAURAL_ROOM_REVERB_sw_48-48.tst diff --git a/scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin b/scripts/switchPaths/sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin similarity index 100% rename from scripts/switchPaths/sw_omasa_3obj_techs_start_160k_2fr.bin rename to scripts/switchPaths/sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin diff --git a/scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin b/scripts/switchPaths/sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin similarity index 100% rename from scripts/switchPaths/sw_omasa_3obj_techs_start_24k4_2fr.bin rename to scripts/switchPaths/sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin diff --git a/scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin b/scripts/switchPaths/sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin similarity index 100% rename from scripts/switchPaths/sw_omasa_4obj_techs_start_32k_2fr.bin rename to scripts/switchPaths/sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin diff --git a/scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin b/scripts/switchPaths/sw_13k2_512k_2fr_start_384k_omasatechs_4ism.bin similarity index 100% rename from scripts/switchPaths/sw_omasa_4obj_techs_start_384k_2fr.bin rename to scripts/switchPaths/sw_13k2_512k_2fr_start_384k_omasatechs_4ism.bin diff --git a/scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin b/scripts/switchPaths/sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin similarity index 100% rename from scripts/switchPaths/sw_omasa_3obj_techs_start_48k_2fr.bin rename to scripts/switchPaths/sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin diff --git a/scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin b/scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin similarity index 100% rename from scripts/switchPaths/sw_omasa_4obj_techs_start_80k_2fr.bin rename to scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin -- GitLab From 44fdd16d51e5cefc0d282ee0d96c4f6c746597c2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 11:48:46 +0200 Subject: [PATCH 568/591] address todo: introduce handle 'hOmasaData' --- lib_com/ivas_cnst.h | 2 +- lib_enc/ivas_cpe_enc.c | 8 +-- lib_enc/ivas_ism_enc.c | 2 +- lib_enc/ivas_masa_enc.c | 131 +++++++++++++++++++++++---------------- lib_enc/ivas_omasa_enc.c | 48 +++++++------- lib_enc/ivas_sce_enc.c | 2 +- lib_enc/ivas_stat_enc.h | 106 ++++++++++++++++--------------- 7 files changed, 164 insertions(+), 135 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index d19c779269..ad50e34a72 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1270,13 +1270,13 @@ enum #define MAXIMUM_OMASA_FREQ_BANDS 8 /* Corresponds to maximum number of coding bands at 32 kbps */ #ifdef MASA_AND_OBJECTS #define OMASA_STEREO_SW_CNT_MAX 100 -#define OMASA_STEREO_SW_CNT_MAX2 5 #endif #endif #define MASA_BIT_REDUCT_PARAM 10 #define MASA_MAXIMUM_TWO_DIR_BANDS 24 #define NBITS_HR_COH 4 + typedef enum { MASA_STEREO_NOT_DEFINED, diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index e45949bbb2..2d7c49c781 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -1230,15 +1230,15 @@ static void stereo_mode_combined_format_enc( { if ( hCPE->element_brate + hCPE->brate_surplus > IVAS_64k ) { - st_ivas->hMasa->data.omasa_stereo_sw_cnt = 0; + st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt = 0; } else { - st_ivas->hMasa->data.omasa_stereo_sw_cnt++; - st_ivas->hMasa->data.omasa_stereo_sw_cnt = min( st_ivas->hMasa->data.omasa_stereo_sw_cnt, OMASA_STEREO_SW_CNT_MAX ); + st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt++; + st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt = min( st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt, OMASA_STEREO_SW_CNT_MAX ); } - if ( st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) + if ( st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) { hCPE->element_mode = IVAS_CPE_MDCT; hCPE->element_brate = IVAS_64k; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 472ff1a642..6dbc40f1b4 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -273,7 +273,7 @@ ivas_error ivas_ism_enc( ism_total_brate_ref = ism_total_brate; ivas_ism_metadata_enc( &ism_total_brate, nchan_ism, nchan_transport_ism, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, - nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.lp_noise_CPE : 0, flag_omasa_ener_brate, st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.omasa_stereo_sw_cnt ) : NULL ); + nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag, st_ivas->hMasa != NULL ? st_ivas->hMasa->data.hOmasaData->lp_noise_CPE : 0, flag_omasa_ener_brate, st_ivas->hMasa != NULL ? &( st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt ) : NULL ); if ( st_ivas->hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index d86b52e9b5..6b2db322ca 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -61,7 +61,7 @@ static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate ); #ifdef MASA_AND_OBJECTS -static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks, const int16_t idx_separated_object, const int16_t ism_imp ); +static void ivas_encode_masaism_metadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, ISM_METADATA_HANDLE hIsmMeta[], const int16_t nchan_ism, const int16_t low_bitrate_mode, const int16_t omasa_nbands, const int16_t omasa_nblocks, const int16_t idx_separated_object, const int16_t ism_imp ); static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); #else @@ -180,9 +180,24 @@ ivas_error ivas_masa_enc_open( set_zero( hMasa->data.dir_align_state.previous_ele_dir2, MASA_FREQUENCY_BANDS ); #ifdef MASA_AND_OBJECTS - hMasa->data.lp_noise_CPE = -1; - hMasa->data.omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; - hMasa->data.omasa_stereo_sw_cnt2 = OMASA_STEREO_SW_CNT_MAX2; + if ( hEncoderConfig->ivas_format == MASA_ISM_FORMAT ) + { + OMASA_ENCODER_DATA_HANDLE hOmasaData; + + if ( ( hOmasaData = (OMASA_ENCODER_DATA_HANDLE) malloc( sizeof( OMASA_ENCODER_DATA_STATE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA data encoder\n" ) ); + } + + hOmasaData->lp_noise_CPE = -1; + hOmasaData->omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; + + hMasa->data.hOmasaData = hOmasaData; + } + else + { + hMasa->data.hOmasaData = NULL; + } #endif st_ivas->hMasa = hMasa; @@ -213,6 +228,14 @@ void ivas_masa_enc_close( deleteCldfb( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } +#ifdef MASA_AND_OBJECTS + if ( ( *hMasa )->data.hOmasaData == NULL ) + { + free( ( *hMasa )->data.hOmasaData ); + ( *hMasa )->data.hOmasaData = NULL; + } +#endif + free( ( *hMasa ) ); ( *hMasa ) = NULL; @@ -238,14 +261,13 @@ ivas_error ivas_masa_encode( const int16_t element_mode /* i : element mode */ #ifdef MASA_AND_OBJECTS , - const ISM_MODE ism_mode, /* i : ISM format mode */ - const int16_t nchan_ism, /* i : number of ISM channels */ - ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ - const int16_t idx_separated_object, /* i : index of the separated object */ - OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ - const int16_t ism_imp /* i : importance of separated object */ - , - const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ + const ISM_MODE ism_mode, /* i : ISM format mode */ + const int16_t nchan_ism, /* i : number of ISM channels */ + ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata handle */ + const int16_t idx_separated_object, /* i : index of the separated object */ + OMASA_ENC_HANDLE hOMasa, /* i : OMASA encoder handle */ + const int16_t ism_imp, /* i : importance of separated object */ + const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ #endif ) { @@ -362,7 +384,7 @@ ivas_error ivas_masa_encode( hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; /* write index of separated object if needed */ - if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && hMasa->data.nchan_ism > 1 ) + if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && nchan_ism > 1 ) { push_next_indice( hMetaData, idx_separated_object, NO_BITS_MASA_ISM_NO_OBJ ); hQMetaData->metadata_max_bits -= NO_BITS_MASA_ISM_NO_OBJ; @@ -528,7 +550,7 @@ ivas_error ivas_masa_encode( if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { /* encode MASA/ISM energy ratios */ - ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes, + ivas_encode_masaism_metadata( hMasa, hQMetaData, hMetaData, hIsmMetaData, nchan_ism, low_bitrate_mode, hOMasa->nCodingBands, hOMasa->nSubframes, idx_separated_object, ism_imp ); } else @@ -969,13 +991,13 @@ ivas_error ivas_masa_enc_config( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { - if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT || st_ivas->hMasa->data.omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) + if ( st_ivas->hCPE[0]->element_mode == IVAS_CPE_DFT || st_ivas->hMasa->data.hOmasaData->omasa_stereo_sw_cnt < OMASA_STEREO_SW_CNT_MAX ) { - st_ivas->hMasa->data.lp_noise_CPE = st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise; + st_ivas->hMasa->data.hOmasaData->lp_noise_CPE = st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise; } else { - st_ivas->hMasa->data.lp_noise_CPE = ( st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise + st_ivas->hCPE[0]->hCoreCoder[1]->lp_noise ) / CPE_CHANNELS; + st_ivas->hMasa->data.hOmasaData->lp_noise_CPE = ( st_ivas->hCPE[0]->hCoreCoder[0]->lp_noise + st_ivas->hCPE[0]->hCoreCoder[1]->lp_noise ) / CPE_CHANNELS; } } #endif @@ -2728,7 +2750,6 @@ void ivas_merge_masa_metadata( numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4; hMeta = &( hMasa->masaMetadata ); - for ( sf = 0; sf < numSf; sf++ ) { for ( band = 0; band < numCodingBands; band++ ) @@ -2755,7 +2776,7 @@ void ivas_merge_masa_metadata( { eneBand += hMasa->data.energy[sf][bin]; } - energyMerged[sf][band] = eneBand + hMasa->data.energy_ism[sf][band]; + energyMerged[sf][band] = eneBand + hMasa->data.hOmasaData->energy_ism[sf][band]; /* Compute weights */ energyTimesRatioMASA[0] = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band]; @@ -2770,7 +2791,7 @@ void ivas_merge_masa_metadata( /* target is original MASA diffuseness */ total_diff_nrg = eneBand * hMeta->common_meta.diffuse_to_total_ratio[sf][band]; /* criterion is mean of ISM ratio and new ratio */ - energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.energy_ism[sf][band]; + energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.hOmasaData->energy_ism[sf][band]; /* Determine combined metadata based on the weights */ merge_dest = -1; @@ -2791,7 +2812,7 @@ void ivas_merge_masa_metadata( hMeta->directional_meta[merge_dest].azimuth[sf][band] = hOMasaMeta->directional_meta[0].azimuth[sf][band]; hMeta->directional_meta[merge_dest].elevation[sf][band] = hOMasaMeta->directional_meta[0].elevation[sf][band]; /* limit with the earlier direct-energy ratio */ - dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.energy_ism[sf][band] ); /* new dir ratio */ + dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ); /* new dir ratio */ hMeta->directional_meta[merge_dest].energy_ratio[sf][band] = min( dir_sum, hOMasaMeta->directional_meta[0].energy_ratio[sf][band] ); /* clip with original ISM dir */ hMeta->common_meta.diffuse_to_total_ratio[sf][band] = 1.0f - hMeta->directional_meta[merge_dest].energy_ratio[sf][band]; @@ -3475,6 +3496,7 @@ static void ivas_encode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t nchan_ism, /* i : number of ISM channels */ const int16_t low_bitrate_mode, /* i : is low bitrate more? 1/0 */ const int16_t omasa_nbands, const int16_t omasa_nblocks, @@ -3499,7 +3521,7 @@ static void ivas_encode_masaism_metadata( float energy_ism, energy_ism_ind[MAX_NUM_OBJECTS]; int16_t tmp, rotate; int16_t n_ism_tmp, i; - + OMASA_ENCODER_DATA_HANDLE hOmasaData = hMasa->data.hOmasaData; /* use the values from hQMetaData */ numCodingBands = (uint8_t) hQMetaData->q_direction->cfg.nbands; @@ -3511,7 +3533,7 @@ static void ivas_encode_masaism_metadata( for ( sf = 0; sf < numSf; sf++ ) { - if ( sum_f( hMasa->data.energy_ism[sf], omasa_nbands ) == 0.0f ) + if ( sum_f( hOmasaData->energy_ism[sf], omasa_nbands ) == 0.0f ) { hQMetaData->masa_to_total_energy_ratio[sf][0] = 1.0f; } @@ -3526,23 +3548,23 @@ static void ivas_encode_masaism_metadata( } energy_ism = 0.0f; - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + for ( obj = 0; obj < nchan_ism; obj++ ) { energy_ism_ind[obj] = 0.0f; } for ( band = 0; band < omasa_nbands; band++ ) { - energy_ism += hMasa->data.energy_ism[sf][band]; - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + energy_ism += hOmasaData->energy_ism[sf][band]; + for ( obj = 0; obj < nchan_ism; obj++ ) { - energy_ism_ind[obj] += hMasa->data.energy_ism[sf][band] * hMasa->data.energy_ratio_ism[sf][band][obj]; + energy_ism_ind[obj] += hOmasaData->energy_ism[sf][band] * hOmasaData->energy_ratio_ism[sf][band][obj]; } } - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + for ( obj = 0; obj < nchan_ism; obj++ ) { - hMasa->data.energy_ratio_ism[sf][0][obj] = energy_ism_ind[obj] / energy_ism; + hOmasaData->energy_ratio_ism[sf][0][obj] = energy_ism_ind[obj] / energy_ism; } hQMetaData->masa_to_total_energy_ratio[sf][0] = eneBand / ( eneBand + energy_ism + EPSILON ); } @@ -3555,16 +3577,16 @@ static void ivas_encode_masaism_metadata( for ( band = 0; band < numCodingBands; band++ ) { energy_ism = 0.0f; /* ISM energy for current subband */ - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + for ( obj = 0; obj < nchan_ism; obj++ ) { energy_ism_ind[obj] = 0.0f; } for ( sf = 0; sf < omasa_nblocks; sf++ ) { - energy_ism += hMasa->data.energy_ism[sf][band]; - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + energy_ism += hOmasaData->energy_ism[sf][band]; + for ( obj = 0; obj < nchan_ism; obj++ ) { - energy_ism_ind[obj] += hMasa->data.energy_ism[sf][band] * hMasa->data.energy_ratio_ism[sf][band][obj]; + energy_ism_ind[obj] += hOmasaData->energy_ism[sf][band] * hOmasaData->energy_ratio_ism[sf][band][obj]; } } @@ -3574,9 +3596,9 @@ static void ivas_encode_masaism_metadata( } else { - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + for ( obj = 0; obj < nchan_ism; obj++ ) { - hMasa->data.energy_ratio_ism[0][band][obj] = energy_ism_ind[obj] / energy_ism; + hOmasaData->energy_ratio_ism[0][band][obj] = energy_ism_ind[obj] / energy_ism; } brange[0] = hMasa->data.band_mapping[band]; brange[1] = hMasa->data.band_mapping[band + 1]; @@ -3599,7 +3621,7 @@ static void ivas_encode_masaism_metadata( { for ( band = 0; band < numCodingBands; band++ ) { - if ( hMasa->data.energy_ism[sf][band] == 0.0f ) + if ( hOmasaData->energy_ism[sf][band] == 0.0f ) { hQMetaData->masa_to_total_energy_ratio[sf][band] = 1.0f; } @@ -3613,7 +3635,7 @@ static void ivas_encode_masaism_metadata( { eneBand += hMasa->data.energy[sf][bin]; } - hQMetaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hMasa->data.energy_ism[sf][band] + EPSILON ); + hQMetaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hOmasaData->energy_ism[sf][band] + EPSILON ); } } } @@ -3622,7 +3644,7 @@ static void ivas_encode_masaism_metadata( encode_masa_to_total( hQMetaData, hMetaData, low_bitrate_mode, numCodingBands, numSf ); /* quantize ism_ratios */ - if ( hMasa->data.nchan_ism > 1 ) + if ( nchan_ism > 1 ) { inv_step = ( ( 1 << PARAM_ISM_POW_RATIO_NBITS ) - 1 ); step = 1.0f / inv_step; @@ -3634,14 +3656,14 @@ static void ivas_encode_masaism_metadata( { for ( band = 0; band < numCodingBands; band++ ) { - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + for ( obj = 0; obj < nchan_ism; obj++ ) { - assert( ( hMasa->data.energy_ratio_ism[sf][band][obj] >= 0 ) && ( hMasa->data.energy_ratio_ism[sf][band][obj] <= 1 ) ); - ratio_ism[band][obj] = hMasa->data.energy_ratio_ism[sf][band][obj]; + assert( ( hOmasaData->energy_ratio_ism[sf][band][obj] >= 0 ) && ( hOmasaData->energy_ratio_ism[sf][band][obj] <= 1 ) ); + ratio_ism[band][obj] = hOmasaData->energy_ratio_ism[sf][band][obj]; } /* Quantize ISM ratios */ - quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], hMasa->data.nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band], idx_separated_object ); + quantize_ratio_ism_vector( ratio_ism[band], ratio_ism_idx[band], nchan_ism, hQMetaData->masa_to_total_energy_ratio[sf][band], idx_separated_object ); if ( n_ism_tmp == numCodingBands && ratio_ism_idx[band][idx_separated_object] != 0 && hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) { @@ -3654,7 +3676,7 @@ static void ivas_encode_masaism_metadata( ratio_ism_idx[band][idx_separated_object]--; } i++; - if ( i == hMasa->data.nchan_ism ) + if ( i == nchan_ism ) { i = 0; } @@ -3662,11 +3684,10 @@ static void ivas_encode_masaism_metadata( } /* reconstructed values */ - reconstruct_ism_ratios( ratio_ism_idx[band], hMasa->data.nchan_ism, step, hMasa->data.q_energy_ratio_ism[sf][band] ); - /* encode vector */ + reconstruct_ism_ratios( ratio_ism_idx[band], nchan_ism, step, hMasa->data.hOmasaData->q_energy_ratio_ism[sf][band] ); } - if ( ( hMasa->data.nchan_ism > 2 ) && ( idx_separated_object == hMasa->data.nchan_ism - 1 ) ) + if ( ( nchan_ism > 2 ) && ( idx_separated_object == nchan_ism - 1 ) ) { /* rotate components */ rotate = 1; @@ -3674,8 +3695,8 @@ static void ivas_encode_masaism_metadata( { if ( hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) { - tmp = ratio_ism_idx[band][hMasa->data.nchan_ism - 1]; - ratio_ism_idx[band][hMasa->data.nchan_ism - 1] = ratio_ism_idx[band][0]; + tmp = ratio_ism_idx[band][nchan_ism - 1]; + ratio_ism_idx[band][nchan_ism - 1] = ratio_ism_idx[band][0]; ratio_ism_idx[band][0] = tmp; if ( sf == 0 && tmp == 0 ) { @@ -3709,18 +3730,18 @@ static void ivas_encode_masaism_metadata( /* encode data for current subframe */ if ( sf > 0 && n_ism_tmp == numCodingBands ) { - encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 1, idx_separated_object ); + encode_ratio_ism_subframe( ratio_ism_idx, nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 1, idx_separated_object ); } else { - encode_ratio_ism_subframe( ratio_ism_idx, hMasa->data.nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 0, idx_separated_object ); + encode_ratio_ism_subframe( ratio_ism_idx, nchan_ism, numCodingBands, sf, ratio_ism_idx_prev_sf, hMetaData, hQMetaData->masa_to_total_energy_ratio[sf], 0, idx_separated_object ); } /* calculate quantized ISM ratios */ /* save previous subframe indexes */ for ( band = 0; band < numCodingBands; band++ ) { - mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], hMasa->data.nchan_ism ); + mvs2s( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], nchan_ism ); } if ( rotate ) @@ -3729,8 +3750,8 @@ static void ivas_encode_masaism_metadata( { if ( hQMetaData->masa_to_total_energy_ratio[sf][band] < MASA2TOTAL_THR ) { - tmp = ratio_ism_idx[band][hMasa->data.nchan_ism - 1]; - ratio_ism_idx[band][hMasa->data.nchan_ism - 1] = ratio_ism_idx[band][0]; + tmp = ratio_ism_idx[band][nchan_ism - 1]; + ratio_ism_idx[band][nchan_ism - 1] = ratio_ism_idx[band][0]; ratio_ism_idx[band][0] = tmp; } } @@ -3738,10 +3759,10 @@ static void ivas_encode_masaism_metadata( } } - calculate_nbits_meta( hMasa->data.nchan_ism, hMasa->data.q_energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); + calculate_nbits_meta( nchan_ism, hOmasaData->q_energy_ratio_ism, hQMetaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); /* quantize directions */ - for ( obj = 0; obj < hMasa->data.nchan_ism; obj++ ) + for ( obj = 0; obj < nchan_ism; obj++ ) { if ( bits_ism[obj] < 8 ) { diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 503eeb4732..72a10f7675 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -50,9 +50,9 @@ * Local function prototypes *------------------------------------------------------------------------*/ -static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); +static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); -static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, MASA_ENCODER_HANDLE hMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); +static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); @@ -80,7 +80,7 @@ ivas_error ivas_omasa_enc_open( assert( st_ivas->hMasa != NULL && "MASA encoder handle is not present" ); - if ( ( hOMasa = (OMASA_ENC_HANDLE) malloc( sizeof( OMASA_ENC_DATA ) ) ) == NULL ) + if ( ( hOMasa = (OMASA_ENC_HANDLE) malloc( sizeof( OMASA_ENC_STATE ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA encoder\n" ) ); } @@ -538,7 +538,7 @@ void ivas_omasa_enc( /* Estimate MASA parameters from the objects */ /* NB: only first direction is populated */ /* NB2: in energy_ratios and surround_coherence only first sub-frame contains valid data */ - ivas_omasa_param_est_enc( hOMasa, hMasa, hIsmMeta, data_in_f, hOMasaMeta->directional_meta[0].elevation, hOMasaMeta->directional_meta[0].azimuth, hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].spread_coherence, hOMasaMeta->common_meta.surround_coherence[0], + ivas_omasa_param_est_enc( hOMasa, hMasa->data.hOmasaData, hIsmMeta, data_in_f, hOMasaMeta->directional_meta[0].elevation, hOMasaMeta->directional_meta[0].azimuth, hOMasaMeta->directional_meta[0].energy_ratio[0], hOMasaMeta->directional_meta[0].spread_coherence, hOMasaMeta->common_meta.surround_coherence[0], hOMasaMeta->common_meta.diffuse_to_total_ratio[0], input_frame, nchan_ism ); /* copy energy_ratios and surrCoh from first sub-frame to the remaining ones */ @@ -567,7 +567,7 @@ void ivas_omasa_enc( else if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { /* Estimate energies and ratios */ - ivas_omasa_energy_and_ratio_est( hOMasa, hMasa, data_in_f, input_frame, nchan_ism ); + ivas_omasa_energy_and_ratio_est( hOMasa, hMasa->data.hOmasaData, data_in_f, input_frame, nchan_ism ); } /* Move the ISM metadata to the first entry for encoding in the MASA_ONE_OBJ mode */ @@ -763,7 +763,7 @@ int16_t ivas_omasa_ener_brate( /* Estimate MASA parameters from the objects */ static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, - MASA_ENCODER_HANDLE hMasa, + OMASA_ENCODER_DATA_HANDLE hOmasaData, ISM_METADATA_HANDLE hIsmMeta[], float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], @@ -822,7 +822,7 @@ static void ivas_omasa_param_est_enc( hOMasa->direction_vector_m[2][block_m_idx][band_m_idx] = 0.0f; } - set_zero( hMasa->data.energy_ism[block_m_idx], num_freq_bands ); + set_zero( hOmasaData->energy_ism[block_m_idx], num_freq_bands ); for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { @@ -840,7 +840,7 @@ static void ivas_omasa_param_est_enc( { for ( k = 0; k < nchan_ism; k++ ) { - hMasa->data.energy_ism[block_m_idx][i] += Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j]; + hOmasaData->energy_ism[block_m_idx][i] += Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j]; } } } @@ -920,8 +920,10 @@ static void ivas_omasa_param_est_enc( { dir_v[d] = hOMasa->direction_vector_m[d][block_m_idx][band_m_idx]; } + ivas_qmetadata_direction_vector_to_azimuth_elevation( dir_v, &azimuth_m_values[block_m_idx][band_m_idx], &elevation_m_values[block_m_idx][band_m_idx] ); } + /* Set coherences to zero, as this mode is used at lowest bit rates where the coherences are not transmitted */ for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) { @@ -952,10 +954,10 @@ static void ivas_omasa_param_est_enc( /* Estimate energies and ratios */ static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, - MASA_ENCODER_HANDLE hMasa, + OMASA_ENCODER_DATA_HANDLE hOmasaData, float data_f[][L_FRAME48k], const int16_t input_frame, - const int16_t nchan_inp ) + const int16_t nchan_ism ) { int16_t ts, i, j, k; int16_t num_freq_bands; @@ -979,14 +981,14 @@ static void ivas_omasa_energy_and_ratio_est( /* Reset variable */ for ( i = 0; i < hOMasa->nbands; i++ ) { - set_zero( hMasa->data.energy_ratio_ism[block_m_idx][i], nchan_inp ); + set_zero( hOmasaData->energy_ratio_ism[block_m_idx][i], nchan_ism ); } - set_zero( hMasa->data.energy_ism[block_m_idx], num_freq_bands ); + set_zero( hOmasaData->energy_ism[block_m_idx], num_freq_bands ); /* Compute CLDFB */ for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - for ( i = 0; i < nchan_inp; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Chnl_RealBuffer[i], Chnl_ImagBuffer[i], l_ts, hOMasa->cldfbAnaEnc[i] ); } @@ -998,11 +1000,11 @@ static void ivas_omasa_energy_and_ratio_est( brange[1] = hOMasa->band_grouping[i + 1]; for ( j = brange[0]; j < brange[1]; j++ ) { - for ( k = 0; k < nchan_inp; k++ ) + for ( k = 0; k < nchan_ism; k++ ) { tftile_energy = Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j]; - hMasa->data.energy_ism[block_m_idx][i] += tftile_energy; - hMasa->data.energy_ratio_ism[block_m_idx][i][k] += tftile_energy; + hOmasaData->energy_ism[block_m_idx][i] += tftile_energy; + hOmasaData->energy_ratio_ism[block_m_idx][i][k] += tftile_energy; } } } @@ -1012,22 +1014,21 @@ static void ivas_omasa_energy_and_ratio_est( for ( i = 0; i < num_freq_bands; i++ ) { ism_ratio_sum = 0.0f; - for ( j = 0; j < nchan_inp; j++ ) + for ( j = 0; j < nchan_ism; j++ ) { - hMasa->data.energy_ratio_ism[block_m_idx][i][j] /= ( hMasa->data.energy_ism[block_m_idx][i] + EPSILON ); - ism_ratio_sum += hMasa->data.energy_ratio_ism[block_m_idx][i][j]; + hOmasaData->energy_ratio_ism[block_m_idx][i][j] /= ( hOmasaData->energy_ism[block_m_idx][i] + EPSILON ); + ism_ratio_sum += hOmasaData->energy_ratio_ism[block_m_idx][i][j]; } if ( ism_ratio_sum == 0.0f ) { - float temp_ism_ratio = 1.0f / ( (float) nchan_inp ); - for ( j = 0; j < nchan_inp; j++ ) + float temp_ism_ratio = 1.0f / ( (float) nchan_ism ); + for ( j = 0; j < nchan_ism; j++ ) { - hMasa->data.energy_ratio_ism[block_m_idx][i][j] = temp_ism_ratio; + hOmasaData->energy_ratio_ism[block_m_idx][i][j] = temp_ism_ratio; } } } - hMasa->data.nchan_ism = nchan_inp; } return; @@ -1050,7 +1051,6 @@ static void ivas_omasa_dmx( float gains[MASA_MAX_TRANSPORT_CHANNELS]; float g1, g2; - for ( i = 0; i < nchan_transport; i++ ) { set_zero( data_out_f[i], input_frame ); diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 07ba653dcd..2193c892fb 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -217,7 +217,7 @@ ivas_error ivas_sce_enc( if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); + set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.hOmasaData->lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_PARAM_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ) - nb_bits_metadata * FRAMES_PER_SEC; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 3e280d6efb..d5aec62a0d 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -753,6 +753,59 @@ typedef struct ivas_mc_paramupmix_enc_data_structure } MC_PARAMUPMIX_ENC_DATA, *MC_PARAMUPMIX_ENC_HANDLE; + +#ifdef MASA_AND_OBJECTS +/*----------------------------------------------------------------------------------* + * Object MASA (OMASA) encoder structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_omasa_enc_state_structure +{ + uint8_t nbands; + uint8_t nCodingBands; + uint8_t nSubframes; + + /* CLDFB analysis */ + int16_t num_Cldfb_instances; + HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_OBJECTS]; + + /* DirAC parameter estimation */ + float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ + int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; + int16_t block_grouping[5]; + + /* diffuseness */ + int16_t index_buffer_intensity; + float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; + float buffer_energy[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; + + float chnlToFoaMtx[DIRAC_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; + + float interpolator[L_FRAME48k]; + + float prev_object_dm_gains[MAX_NUM_OBJECTS][MASA_MAX_TRANSPORT_CHANNELS]; + float broadband_energy_sm[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; + float broadband_energy_prev[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; + int16_t prev_selected_object; + uint8_t changing_object; + float fade_out_gain[L_FRAME48k]; + float fade_in_gain[L_FRAME48k]; + +} OMASA_ENC_STATE, *OMASA_ENC_HANDLE; + + +typedef struct ivas_omasa_encoder_one_data_struct +{ + float energy_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* TODO Nokia: Make an own MASAISM struct for these, and reserve it only for OMASA */ + float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; + float lp_noise_CPE; /* LP filterend total noise estimation */ + int16_t omasa_stereo_sw_cnt; + +} OMASA_ENCODER_DATA_STATE, *OMASA_ENCODER_DATA_HANDLE; +#endif + + /*----------------------------------------------------------------------------------* * MASA encoder structures *----------------------------------------------------------------------------------*/ @@ -780,15 +833,6 @@ typedef struct ivas_masa_sync_struct typedef struct ivas_masa_encoder_data_struct { float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#ifdef MASA_AND_OBJECTS - float energy_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* TODO Nokia: Make an own MASAISM struct for these, and reserve it only for OMASA */ - float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; - float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; - int16_t nchan_ism; - float lp_noise_CPE; /* LP filterend total noise estimation */ - int16_t omasa_stereo_sw_cnt; - int16_t omasa_stereo_sw_cnt2; -#endif int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_ENC_CLDFB_INSTANCES]; @@ -807,6 +851,10 @@ typedef struct ivas_masa_encoder_data_struct MASA_DIR_ALIGN_STATE dir_align_state; +#ifdef MASA_AND_OBJECTS + OMASA_ENCODER_DATA_HANDLE hOmasaData; +#endif + } MASA_ENCODER_DATA; typedef struct ivas_masa_encoder_struct @@ -876,46 +924,6 @@ typedef struct ivas_mcmasa_enc_data_structure } MCMASA_ENC_DATA, *MCMASA_ENC_HANDLE; -#ifdef MASA_AND_OBJECTS -/*----------------------------------------------------------------------------------* - * Object MASA (OMASA) encoder structure - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_omasa_enc_data_structure -{ - uint8_t nbands; - uint8_t nCodingBands; - uint8_t nSubframes; - - /* CLDFB analysis */ - int16_t num_Cldfb_instances; - HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_OBJECTS]; - - /* DirAC parameter estimation */ - float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ - int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; - int16_t block_grouping[5]; - - /* diffuseness */ - int16_t index_buffer_intensity; - float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; - float buffer_energy[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; - - float chnlToFoaMtx[DIRAC_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; - - float interpolator[L_FRAME48k]; - - float prev_object_dm_gains[MAX_NUM_OBJECTS][MASA_MAX_TRANSPORT_CHANNELS]; - float broadband_energy_sm[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; - float broadband_energy_prev[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS]; - int16_t prev_selected_object; - uint8_t changing_object; - float fade_out_gain[L_FRAME48k]; - float fade_in_gain[L_FRAME48k]; - -} OMASA_ENC_DATA, *OMASA_ENC_HANDLE; -#endif - /*----------------------------------------------------------------------------------* * Stereo CNG handle -- GitLab From b30035cdb02eb707e40bbccac3fcb1006db456c5 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 1 Aug 2023 12:52:35 +0300 Subject: [PATCH 569/591] remove EDIT_ISM and correct the nr of indices --- apps/decoder.c | 58 +-------------------------------------------- lib_com/bitstream.c | 14 +++++------ lib_com/options.h | 4 +--- lib_dec/lib_dec.c | 28 ---------------------- lib_dec/lib_dec.h | 8 ------- 5 files changed, 9 insertions(+), 103 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index cb39dd0f1e..1796a9be97 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -156,12 +156,6 @@ typedef struct uint16_t frontendFetchSizeMs; #endif #endif -#ifdef MASAISM_EDIT_OBJECTS - bool editing_ism_enabled; - int16_t index_of_edited_ism; - int16_t azimuth_edited_ism; - int16_t elevation_edited_ism; -#endif } DecArguments; @@ -684,16 +678,6 @@ int main( } } -#ifdef MASAISM_EDIT_OBJECTS - /*------------------------------------------------------------------------------------------* - * Set edited object positions - *------------------------------------------------------------------------------------------*/ - - if ( arg.editing_ism_enabled ) - { - IVAS_DEC_SetEditedIsmPositions( hIvasDec, arg.index_of_edited_ism, arg.azimuth_edited_ism, arg.elevation_edited_ism ); - } -#endif /*-----------------------------------------------------------------* * Decoding @@ -911,9 +895,7 @@ static bool parseCmdlIVAS_dec( { int16_t i; char argv_to_upper[FILENAME_MAX]; -#ifdef MASAISM_EDIT_OBJECTS - int32_t tmp1; -#endif + #ifdef DEBUGGING float ftmp; @@ -983,12 +965,6 @@ static bool parseCmdlIVAS_dec( #endif #endif -#ifdef MASAISM_EDIT_OBJECTS - arg->editing_ism_enabled = false; - arg->index_of_edited_ism = 0; - arg->azimuth_edited_ism = 0; - arg->elevation_edited_ism = 0; -#endif /*-----------------------------------------------------------------* * Initialization @@ -1351,38 +1327,6 @@ static bool parseCmdlIVAS_dec( } } -#ifdef MASAISM_EDIT_OBJECTS - else if ( strcmp( argv_to_upper, "-EDIT_ISM" ) == 0 ) /* Edit ISM position: objectID, azimuth (deg), elevation (deg) */ - { - arg->editing_ism_enabled = true; - i++; - - if ( argc - i <= 6 || argv[i][0] == '-' ) - { - fprintf( stderr, "Error: Edited ISM position parameters not defined! \n\n" ); - usage_dec(); - return false; - } - - if ( sscanf( argv[i], "%d", &tmp1 ) > 0 ) - { - arg->index_of_edited_ism = (int16_t) tmp1; - i++; - } - - if ( sscanf( argv[i], "%d", &tmp1 ) > 0 ) - { - arg->azimuth_edited_ism = (int16_t) tmp1; - i++; - } - - if ( sscanf( argv[i], "%d", &tmp1 ) > 0 ) - { - arg->elevation_edited_ism = (int16_t) tmp1; - i++; - } - } -#endif /*-----------------------------------------------------------------* * Option not recognized diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 604ddc2b96..e69240d1fe 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -545,31 +545,31 @@ int16_t get_ivas_max_num_indices( } else if ( ivas_total_brate <= IVAS_48k ) { - return 650; + return 750; } else if ( ivas_total_brate <= IVAS_80k ) { - return 750; + return 950; } else if ( ivas_total_brate <= IVAS_160k ) { - return 850; + return 1150; } else if ( ivas_total_brate <= IVAS_192k ) { - return 950; + return 1250; } else if ( ivas_total_brate <= IVAS_256k ) { - return 1300; + return 1400; } else if ( ivas_total_brate <= IVAS_384k ) { - return 1450; + return 1650; } else { - return 1650; + return 1850; } } #endif diff --git a/lib_com/options.h b/lib_com/options.h index 6043962403..26c638e283 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -207,9 +207,7 @@ #define FIX_549_PARAM_ISM_BIN_GAIN /* FhG: Issue 549 : fix too quiet binaural output in ParamISM */ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ -#ifdef MASA_AND_OBJECTS -#define MASAISM_EDIT_OBJECTS /* Nokia: Temporary command line editing of object directions in the decoder */ -#endif + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 64a3a2b2af..1d608cc6f4 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1447,34 +1447,6 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle( } -#ifdef MASAISM_EDIT_OBJECTS -/*---------------------------------------------------------------------* - * IVAS_DEC_SetEditedIsmPositions( ) - * - * - *---------------------------------------------------------------------*/ - -ivas_error IVAS_DEC_SetEditedIsmPositions( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t index_of_edited_ism, /* i : Index of edited ISM */ - int16_t azimuth_edited_ism, /* i : Azimuth */ - int16_t elevation_edited_ism /* i : Elevation */ -) -{ - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - hIvasDec->st_ivas->editing_ism_enabled = 1; - hIvasDec->st_ivas->index_of_edited_ism = index_of_edited_ism; - hIvasDec->st_ivas->azimuth_edited = azimuth_edited_ism; - hIvasDec->st_ivas->elevation_edited = elevation_edited_ism; - - return IVAS_ERR_OK; -} -#endif - /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfFastConvHandle( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 52155ec89e..0444037351 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -370,14 +370,6 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ); -#ifdef MASAISM_EDIT_OBJECTS -ivas_error IVAS_DEC_SetEditedIsmPositions( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t index_of_edited_ism, /* i : Index of edited ISM */ - int16_t azimuth_edited_ism, /* i : Azimuth */ - int16_t elevation_edited_ism /* i : Elevation */ -); -#endif /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( -- GitLab From 0f1d92138d175c9bbf9b72d8b5287971730f2a77 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 1 Aug 2023 13:23:05 +0300 Subject: [PATCH 570/591] fix clang --- lib_com/bitstream.c | 4 ++-- lib_dec/lib_dec.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index e69240d1fe..940d8ff59a 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -545,11 +545,11 @@ int16_t get_ivas_max_num_indices( } else if ( ivas_total_brate <= IVAS_48k ) { - return 750; + return 650; } else if ( ivas_total_brate <= IVAS_80k ) { - return 950; + return 750; } else if ( ivas_total_brate <= IVAS_160k ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 1d608cc6f4..8458bb867a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1447,7 +1447,6 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle( } - /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfFastConvHandle( ) * -- GitLab From e7d355e1c7f9fcaae9d2e8e04bef925f38994f23 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 12:40:39 +0200 Subject: [PATCH 571/591] formatting --- lib_com/ivas_prot.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 3080698450..827638d213 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5619,7 +5619,7 @@ void ivas_filter_process( *---------------------------------------------------------------------------------*/ ivas_error ivas_omasa_enc_open( - Encoder_Struct* st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_omasa_enc_close( @@ -5723,7 +5723,7 @@ void ivas_merge_masa_transports( ); ivas_error ivas_masa_ism_data_open( - Decoder_Struct* st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_masa_ism_data_close( @@ -5760,15 +5760,15 @@ void preProcessStereoTransportsForMovedObjects( ); ivas_error ivas_masa_ism_separate_object_renderer_open( - Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_masa_ism_separate_object_renderer_close( - Decoder_Struct* st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_masa_ism_separate_object_render( - Decoder_Struct* st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float input_f[][L_FRAME48k], /* i : separated object signal */ float output_f[][L_FRAME48k], /* i/o: output signals */ const int16_t output_frame /* i : output frame length per channel */ @@ -5787,8 +5787,8 @@ void encode_masa_to_total( ); void decode_masa_to_total( - uint16_t* bit_stream, - int16_t* index, + uint16_t *bit_stream, + int16_t *index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t nbands, const int16_t nblocks -- GitLab From 6811beb32b1eedb6909c9623fdfd982692ab9d48 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 1 Aug 2023 11:10:46 +0000 Subject: [PATCH 572/591] Change path to rate switching files for OMASA self-test --- scripts/config/self_test.prm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 26604d6b55..bfd7566f12 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1342,26 +1342,26 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // OMASA 2Dir2TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 160 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin 48 testv/stvOMASA_3ISM_2MASA2TC48c.wav bit ../IVAS_dec MONO 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_MONO_sw_48-48.tst // OMASA 2Dir1TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 48 kbps, 48kHz in, 32kHz out, STEREO out, FEC at 10% -../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA1TC48c.met ../scripts/switchPaths/sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin 48 testv/stvOMASA_3ISM_2MASA1TC48c.wav bit ../IVAS_dec -fec 10 STEREO 32 bit testv/stvOMASA_3ISM_2MASA1TC48c.wav_STEREO_sw_48-32.tst // OMASA 1Dir2TC 3ISM at bitrate switching techs 13.2 to 512 kbps start 24.4 kbps, 32kHz in, 48kHz out, 5.1.4 out -../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin 32 testv/stvOMASA_3ISM_1MASA2TC32c.wav bit +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin 32 testv/stvOMASA_3ISM_1MASA2TC32c.wav bit ../IVAS_dec 5_1_4 48 bit testv/stvOMASA_3ISM_1MASA2TC32c.wav_5_1_4_sw_32-48.tst // OMASA 1Dir1TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, FEC at 5% -../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA1TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_1MASA1TC48c.wav bit +../IVAS_cod -ism_masa 4 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA1TC48c.met ../scripts/switchPaths/sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_1MASA1TC48c.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stvOMASA_4ISM_1MASA1TC48c.wav_BINAURAL_sw_48-48.tst // OMASA 1Dir2TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -ism_masa 4 2 NULL testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit +../IVAS_cod -ism_masa 4 2 NULL testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv1MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_1MASA2TC48c.wav bit ../IVAS_dec HOA3 48 bit testv/stvOMASA_4ISM_1MASA2TC48c.wav_HOA3_sw_48-48.tst // OMASA 2Dir2TC 4ISM at bitrate switching techs 13.2 to 512 kbps start 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out -../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met scripts/switchPaths/sw_13k2_512k_2fr_start_384k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit +../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met ../scripts/switchPaths/sw_13k2_512k_2fr_start_384k_omasatechs_4ism.bin 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit ../IVAS_dec BINAURAL_ROOM_REVERB 48 bit testv/stvOMASA_4ISM_2MASA2TC48c.wav_BINAURAL_ROOM_REVERB_sw_48-48.tst -- GitLab From 64200ac089a09035d6bcb113d1c859febd1e964e Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 13:59:22 +0200 Subject: [PATCH 573/591] fix memory leak of the newly introduced hOmasaData handle --- lib_enc/ivas_masa_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 6b2db322ca..5e5fcc672f 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -229,7 +229,7 @@ void ivas_masa_enc_close( } #ifdef MASA_AND_OBJECTS - if ( ( *hMasa )->data.hOmasaData == NULL ) + if ( ( *hMasa )->data.hOmasaData != NULL ) { free( ( *hMasa )->data.hOmasaData ); ( *hMasa )->data.hOmasaData = NULL; -- GitLab From 4588f712d995b34eb8a7a15c92fc5b866683bfac Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 14:23:04 +0200 Subject: [PATCH 574/591] harmonize OMASA function names --- lib_com/ivas_masa_com.c | 6 ++--- lib_com/ivas_prot.h | 28 +++++++++----------- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_init_dec.c | 10 +++---- lib_dec/ivas_ism_renderer.c | 12 ++++----- lib_dec/ivas_masa_dec.c | 8 +++--- lib_dec/ivas_omasa_dec.c | 22 +++++++-------- lib_dec/ivas_qmetadata_dec.c | 4 +-- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_masa_enc.c | 4 +-- lib_enc/ivas_omasa_enc.c | 4 +-- lib_enc/ivas_qmetadata_enc.c | 4 +-- lib_enc/ivas_sce_enc.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 7 ++--- 15 files changed, 58 insertions(+), 59 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 94d537494e..2746b05a21 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -883,14 +883,14 @@ void reconstruct_ism_ratios( /*--------------------------------------------------------------- - * modify_masa_energy_ratios() + * ivas_omasa_modify_masa_energy_ratios() * * Updates energy ratios by taking into account the MASA content contribution * to the total audio scene *---------------------------------------------------------------*/ -void modify_masa_energy_ratios( - IVAS_QMETADATA_HANDLE hQMetaData /* i/o: Metadata handle */ +void ivas_omasa_modify_masa_energy_ratios( + IVAS_QMETADATA_HANDLE hQMetaData /* i/o: q_metadata handle */ ) { int16_t i, m, d, b; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 78d3920199..8432cef489 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5685,7 +5685,7 @@ void ivas_set_surplus_brate_dec( int32_t *ism_total_brate /* i : ISM total bitrate */ ); -void set_ism_importance_interformat( +void ivas_set_ism_importance_interformat( const int32_t ism_total_brate, /* i/o: ISms total bitrate */ const int16_t nchan_transport, /* i : number of transported channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -5694,7 +5694,6 @@ void set_ism_importance_interformat( int16_t ism_imp[] /* o : ISM importance flags */ ); -#ifdef MASA_AND_OBJECTS /*! r: flag for using less bitrate for objects in OMASA */ int16_t ivas_omasa_ener_brate( const int16_t nchan_ism, /* i : number of ISMs */ @@ -5702,7 +5701,6 @@ int16_t ivas_omasa_ener_brate( float data_f[][L_FRAME48k], /* i : Input / transport audio signals */ const int16_t input_frame /* i : Input frame size */ ); -#endif /*! r: adjusted bitrate */ int32_t ivas_interformat_brate( @@ -5740,11 +5738,11 @@ void ivas_merge_masa_transports( const int16_t num_transport_channels /* i : Number of transport audio signals */ ); -ivas_error ivas_masa_ism_data_open( +ivas_error ivas_omasa_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); -void ivas_masa_ism_data_close( +void ivas_omasa_data_close( MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ); @@ -5769,34 +5767,34 @@ void ivas_omasa_dirac_rend( const int16_t output_frame /* i : output frame length per channel */ ); -void preProcessStereoTransportsForMovedObjects( - Decoder_Struct* st_ivas, +void ivas_omasa_preProcessStereoTransportsForMovedObjects( + Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t subframe ); -ivas_error ivas_masa_ism_separate_object_renderer_open( +ivas_error ivas_omasa_separate_object_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void ivas_masa_ism_separate_object_renderer_close( +void ivas_omasa_separate_object_renderer_close( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void ivas_masa_ism_separate_object_render( +void ivas_omasa_separate_object_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float input_f[][L_FRAME48k], /* i : separated object signal */ float output_f[][L_FRAME48k], /* i/o: output signals */ const int16_t output_frame /* i : output frame length per channel */ ); -void ivas_masa_ism_set_edited_objects( +void ivas_omasa_set_edited_objects( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void encode_masa_to_total( +void ivas_omasa_encode_masa_to_total( IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, const int16_t low_bitrate_mode, @@ -5804,7 +5802,7 @@ void encode_masa_to_total( const int16_t nblocks ); -void decode_masa_to_total( +void ivas_omasa_decode_masa_to_total( uint16_t *bit_stream, int16_t *index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], @@ -5812,8 +5810,8 @@ void decode_masa_to_total( const int16_t nblocks ); -void modify_masa_energy_ratios( - IVAS_QMETADATA_HANDLE hQMetaData +void ivas_omasa_modify_masa_energy_ratios( + IVAS_QMETADATA_HANDLE hQMetaData /* i/o: q_metadata handle */ ); #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e605d2e8cf..abc2e9a72c 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -568,7 +568,7 @@ ivas_error ivas_dec( } /* Set edited object positions, if editing enabled */ - ivas_masa_ism_set_edited_objects( st_ivas ); + ivas_omasa_set_edited_objects( st_ivas ); /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ed17e9f090..9dc36c272c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1975,7 +1975,7 @@ void ivas_dirac_dec_render_sf( if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { - preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, hSpatParamRendCom->num_freq_bands, subframe_idx ); + ivas_omasa_preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, hSpatParamRendCom->num_freq_bands, subframe_idx ); } } #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d5bd182137..393d331f31 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1173,7 +1173,7 @@ ivas_error ivas_init_decoder( return error; } - if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1662,7 +1662,7 @@ ivas_error ivas_init_decoder( } /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1671,7 +1671,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -2214,8 +2214,8 @@ void ivas_destroy_dec( } #ifdef MASA_AND_OBJECTS - /* MASA ISM structure */ - ivas_masa_ism_data_close( &st_ivas->hMasaIsmData ); + /* OMASA structure */ + ivas_omasa_data_close( &st_ivas->hMasaIsmData ); #endif /* Head track data handle */ diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 6e776d3577..33d3598e0e 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -342,12 +342,12 @@ void ivas_ism_get_stereo_gains( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------------* - * ivas_masa_ism_separate_object_renderer_open() + * ivas_masa_oism_separate_object_renderer_open() * * Open structures, reserve memory, and init values. *-------------------------------------------------------------------------*/ -ivas_error ivas_masa_ism_separate_object_renderer_open( +ivas_error ivas_omasa_separate_object_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { @@ -413,12 +413,12 @@ ivas_error ivas_masa_ism_separate_object_renderer_open( /*-------------------------------------------------------------------------* - * ivas_masa_ism_separate_object_renderer_close() + * ivas_omasa_separate_object_renderer_close() * * Close structures, free memory. *-------------------------------------------------------------------------*/ -void ivas_masa_ism_separate_object_renderer_close( +void ivas_omasa_separate_object_renderer_close( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { @@ -459,13 +459,13 @@ void ivas_masa_ism_separate_object_renderer_close( /*-------------------------------------------------------------------------* - * ivas_masa_ism_separate_object_render() + * ivas_omasa_separate_object_render() * * Rendering separated objects and mixing them to the parametrically rendered signals *-------------------------------------------------------------------------*/ // Todo OMASA JBM: This might need adjustments -void ivas_masa_ism_separate_object_render( +void ivas_omasa_separate_object_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float input_f[][L_FRAME48k], /* i : separated object signal */ float output_f[][L_FRAME48k], /* i/o: output signals */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 62b642f449..07818ec8a2 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -383,7 +383,7 @@ ivas_error ivas_masa_decode( if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { /* Modify spatial metadata based on the MASA-to-total energy ratios */ - modify_masa_energy_ratios( hQMetaData ); + ivas_omasa_modify_masa_energy_ratios( hQMetaData ); } #endif @@ -2314,7 +2314,7 @@ static int16_t ivas_decode_masaism_metadata( nblocks = hQMetaData->q_direction->cfg.nblocks; /* To do: what if other value than 4? */ /* Read MASA-to-total energy ratios */ - decode_masa_to_total( bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio, nbands, nblocks ); + ivas_omasa_decode_masa_to_total( bit_stream, next_bit_pos, hQMetaData->masa_to_total_energy_ratio, nbands, nblocks ); if ( nchan_ism > 1 ) { /* read ISM ratios */ @@ -2436,12 +2436,12 @@ static int16_t ivas_decode_masaism_metadata( /*-------------------------------------------------------------------* - * ivas_masa_ism_set_edited_objects() + * ivas_omasa_set_edited_objects() * * *-------------------------------------------------------------------*/ -void ivas_masa_ism_set_edited_objects( +void ivas_omasa_set_edited_objects( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 3a41019ccb..5e1126a315 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -44,12 +44,12 @@ #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------* - * ivas_masa_ism_data_open() + * ivas_omasa_data_open() * * Allocate and initialize MASA_ISM rendering handle *-------------------------------------------------------------------*/ -ivas_error ivas_masa_ism_data_open( +ivas_error ivas_omasa_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { @@ -103,12 +103,12 @@ ivas_error ivas_masa_ism_data_open( /*-------------------------------------------------------------------* - * ivas_masa_ism_data_close() + * ivas_omasa_data_close() * * Deallocate MASA_ISM rendering handle *-------------------------------------------------------------------*/ -void ivas_masa_ism_data_close( +void ivas_omasa_data_close( MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ) { @@ -201,7 +201,7 @@ ivas_error ivas_omasa_dec_config( /* OMASA reconfig. */ if ( st_ivas->hMasaIsmData == NULL && st_ivas->ivas_format == MASA_ISM_FORMAT ) { - if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -297,7 +297,7 @@ ivas_error ivas_omasa_dec_config( /* objects renderer reconfig. */ if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) { - ivas_masa_ism_data_close( &( st_ivas->hMasaIsmData ) ); + ivas_omasa_data_close( &( st_ivas->hMasaIsmData ) ); } if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) @@ -311,7 +311,7 @@ ivas_error ivas_omasa_dec_config( } /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -330,7 +330,7 @@ ivas_error ivas_omasa_dec_config( } /* ISM renderer handle + ISM data handle */ - ivas_masa_ism_separate_object_renderer_close( st_ivas ); + ivas_omasa_separate_object_renderer_close( st_ivas ); } } @@ -344,7 +344,7 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -352,7 +352,7 @@ ivas_error ivas_omasa_dec_config( else { /* ISM renderer handle + ISM data handle */ - ivas_masa_ism_separate_object_renderer_close( st_ivas ); + ivas_omasa_separate_object_renderer_close( st_ivas ); } } @@ -577,7 +577,7 @@ void ivas_omasa_dirac_rend( st_ivas->hSpatParamRendCom->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ - ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); + ivas_omasa_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); return; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 1dfba8f212..7b465ed3bf 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -4510,11 +4510,11 @@ static void read_stream_dct_coeffs_omasa( /*------------------------------------------------------------------------- - * decode_masa_to_total() + * ivas_omasa_decode_masa_to_total() * *------------------------------------------------------------------------*/ -void decode_masa_to_total( +void ivas_omasa_decode_masa_to_total( uint16_t *bit_stream, int16_t *index, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 301576d870..3154eb56a7 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -233,7 +233,7 @@ ivas_error ivas_ism_metadata_enc( * Rate importance of particular ISM streams in combined format coding *----------------------------------------------------------------*/ - set_ism_importance_interformat( *ism_total_brate, nchan_transport, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); + ivas_set_ism_importance_interformat( *ism_total_brate, nchan_transport, hIsmMeta, hSCE, lp_noise_CPE, ism_imp ); } else { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 6b2db322ca..177768c9d7 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -600,7 +600,7 @@ ivas_error ivas_masa_encode( if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { /* Modify spatial metadata based on the MASA-to-total energy ratios */ - modify_masa_energy_ratios( hQMetaData ); + ivas_omasa_modify_masa_energy_ratios( hQMetaData ); } #endif @@ -3641,7 +3641,7 @@ static void ivas_encode_masaism_metadata( } } - encode_masa_to_total( hQMetaData, hMetaData, low_bitrate_mode, numCodingBands, numSf ); + ivas_omasa_encode_masa_to_total( hQMetaData, hMetaData, low_bitrate_mode, numCodingBands, numSf ); /* quantize ism_ratios */ if ( nchan_ism > 1 ) diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 72a10f7675..ea782115bb 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -588,12 +588,12 @@ void ivas_omasa_enc( /*-------------------------------------------------------------------------* - * set_ism_importance_interformat() + * ivas_set_ism_importance_interformat() * * Set the importance of particular ISM streams in combined-format coding *-------------------------------------------------------------------------*/ -void set_ism_importance_interformat( +void ivas_set_ism_importance_interformat( const int32_t ism_total_brate, /* i/o: ISms total bitrate */ const int16_t nchan_transport, /* i : number of transported channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 3ba709b939..6be126ac83 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -6396,11 +6396,11 @@ static int16_t write_stream_dct_coeffs_omasa( /*------------------------------------------------------------------------- - * encode_masa_to_total() + * ivas_omasa_encode_masa_to_total() * *------------------------------------------------------------------------*/ -void encode_masa_to_total( +void ivas_omasa_encode_masa_to_total( IVAS_QMETADATA_HANDLE hQMetaData, BSTR_ENC_HANDLE hMetaData, const int16_t low_bitrate_mode, diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 2193c892fb..ed6d74c71a 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -217,7 +217,7 @@ ivas_error ivas_sce_enc( if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.hOmasaData->lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); + ivas_set_ism_importance_interformat( hSCE->element_brate, 1, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hMasa->data.hOmasaData->lp_noise_CPE, &st_ivas->hIsmMetaData[0]->ism_imp ); st->total_brate = ivas_interformat_brate( ISM_MASA_MODE_PARAM_ONE_OBJ, 1, hSCE->element_brate, st_ivas->hIsmMetaData[0]->ism_imp, 0 ) - nb_bits_metadata * FRAMES_PER_SEC; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3208b77ba3..30f99d065c 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -787,7 +787,7 @@ static void ivas_dirac_dec_binaural_internal( #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { - preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, subframe ); + ivas_omasa_preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, subframe ); } #endif @@ -2568,12 +2568,13 @@ float configure_reqularization_factor( #ifdef MASA_AND_OBJECTS /*-------------------------------------------------------------------* - * preProcessStereoTransportsForMovedObjects() + * ivas_omasa_preProcessStereoTransportsForMovedObjects() * * *-------------------------------------------------------------------*/ + // Todo OMASA JBM: This might need further adjustments -void preProcessStereoTransportsForMovedObjects( +void ivas_omasa_preProcessStereoTransportsForMovedObjects( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], -- GitLab From 3526ff892c67ad4578e2f030c355593cfd51aa7b Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 1 Aug 2023 15:33:46 +0300 Subject: [PATCH 575/591] Add fix to decorrelator pointer assignment to satiate USAN. --- lib_rend/ivas_dirac_dec_binaural_functions.c | 28 ++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 30f99d065c..3cf1103655 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1746,16 +1746,28 @@ static void ivas_dirac_dec_binaural_process_output( /* Processing of the first / HRTF part of the binaural output. */ for ( chB = 0; chB < numInChannels; chB++ ) { - if ( hDiracDecBin->useTdDecorr ) - { - decSlotRePointer = inRe[chB + 2][slot]; - decSlotImPointer = inIm[chB + 2][slot]; - } - else +#ifdef MASA_AND_OBJECTS + if ( chB < BINAURAL_CHANNELS ) { - decSlotRePointer = decSlotRe[chB]; - decSlotImPointer = decSlotIm[chB]; + /* Decorrelator signal for TD decorrelation is stored in two input channels above the two normal inputs. + * It should be noted that TD decorrelation is used only in cases where numInChannels is 2. If this + * changes, additional adjustments are required. When using CLDFB decorrelator, we simply assign the + * pointers to buffers. */ +#endif + if ( hDiracDecBin->useTdDecorr ) + { + decSlotRePointer = inRe[chB + 2][slot]; + decSlotImPointer = inIm[chB + 2][slot]; + } + else + { + decSlotRePointer = decSlotRe[chB]; + decSlotImPointer = decSlotIm[chB]; + } +#ifdef MASA_AND_OBJECTS } +#endif + for ( bin = 0; bin < nBins; bin++ ) { -- GitLab From 48a851c0f262bf44ee6329e3b312a8884c70454a Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 15:08:10 +0200 Subject: [PATCH 576/591] fix self-test input sampling rate to match the signal --- scripts/config/self_test.prm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index bfd7566f12..ba47886cd4 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1291,11 +1291,11 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec MONO 48 bit testv/stvOMASA_3ISM_2MASA2TC48c.wav_MONO_48000_48-48.tst // OMASA 1Dir1TC 3ISM at 64 kbps, 32kHz in, 32kHz out, BINAURAL out -../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA1TC48c.met 64000 48 testv/stvOMASA_3ISM_1MASA1TC32c.wav bit +../IVAS_cod -ism_masa 3 1 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv1MASA1TC48c.met 64000 32 testv/stvOMASA_3ISM_1MASA1TC32c.wav bit ../IVAS_dec BINAURAL 32 bit testv/stvOMASA_3ISM_1MASA1TC32c.wav_BINAURAL_64000_32-32.tst // OMASA 2Dir2TC 3ISM at 80 kbps, 32kHz in, 16kHz out, 5.1.4 out -../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met 80000 48 testv/stvOMASA_3ISM_2MASA2TC32c.wav bit +../IVAS_cod -ism_masa 3 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stv2MASA2TC48c.met 80000 32 testv/stvOMASA_3ISM_2MASA2TC32c.wav bit ../IVAS_dec 5_1_4 16 bit testv/stvOMASA_3ISM_2MASA2TC32c.wav_5_1_4_80000_32-16.tst // OMASA 2Dir1TC 3ISM at 96 kbps, 48kHz in, 48kHz out, MONO out -- GitLab From 265c846a5ec3e6b9bb314ba3237d6e7147d453d7 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 15:17:10 +0200 Subject: [PATCH 577/591] fix over-indexing of frequency bands --- lib_dec/ivas_masa_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 07818ec8a2..001465bf51 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -503,7 +503,7 @@ ivas_error ivas_masa_decode( // Todo OMASA JBM: This might need adjustments meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; - for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + for ( b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) { st_ivas->hSpatParamRendCom->diffuseness_vector[meta_write_index][b] -= st_ivas->hMasaIsmData->energy_ratio_ism[i][meta_write_index][b]; } @@ -514,7 +514,7 @@ ivas_error ivas_masa_decode( { meta_write_index = ( dirac_bs_md_write_idx + block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; - for ( b = 0; b < CLDFB_NO_CHANNELS_MAX; b++ ) + for ( b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) { st_ivas->hSpatParamRendCom->diffuseness_vector[meta_write_index][b] = max( 0.0f, st_ivas->hSpatParamRendCom->diffuseness_vector[meta_write_index][b] ); } -- GitLab From 7bf4f6d7a03ef92a1ed513e7fe715030e822d68c Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 1 Aug 2023 16:19:48 +0300 Subject: [PATCH 578/591] fix usan error in masa config for omasa cases --- lib_com/ivas_masa_com.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 2746b05a21..b270285f1b 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -256,7 +256,15 @@ void ivas_masa_set_coding_config( if ( ivas_total_brate <= ivas_brate_tbl[i + SIZE_IVAS_BRATE_TBL - IVAS_NUM_ACTIVE_BRATES] ) { int16_t idx_bands; - idx_bands = i; + if ( ivas_total_brate < IVAS_48k && nchan_transport == 2 && i > 3 ) + { + /* because it uses the bitallocation for the lower bit rates from 'masa_bits_LR_stereo' and it has 4 elements */ + idx_bands = 3; + } + else + { + idx_bands = i; + } if ( config->numberOfDirections > 1 ) { -- GitLab From 7ec2f581fbffb66cc191f6c6446e6a144daeef27 Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 1 Aug 2023 17:08:19 +0300 Subject: [PATCH 579/591] correct fix for usan --- lib_com/ivas_masa_com.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index b270285f1b..ca188d6239 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -259,12 +259,10 @@ void ivas_masa_set_coding_config( if ( ivas_total_brate < IVAS_48k && nchan_transport == 2 && i > 3 ) { /* because it uses the bitallocation for the lower bit rates from 'masa_bits_LR_stereo' and it has 4 elements */ - idx_bands = 3; - } - else - { - idx_bands = i; + i = 3; } + idx_bands = i; + if ( config->numberOfDirections > 1 ) { -- GitLab From 14edcd272e08a64a8ef56346efce2b5870950041 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 16:16:29 +0200 Subject: [PATCH 580/591] fix Win build warning of potentially uninitialized variables --- lib_rend/ivas_dirac_dec_binaural_functions.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3cf1103655..d118334fe3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1766,6 +1766,11 @@ static void ivas_dirac_dec_binaural_process_output( } #ifdef MASA_AND_OBJECTS } + else + { + decSlotRePointer = NULL; /* below these pointers are used only for chB < 2 */ + decSlotImPointer = NULL; + } #endif -- GitLab From 66792433bf3ba9a91958b133a04d065f10c69511 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 18:02:56 +0200 Subject: [PATCH 581/591] allocate structures only when necessary --- lib_dec/ivas_ism_renderer.c | 48 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 33d3598e0e..dd2b9b14ed 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -354,10 +354,14 @@ ivas_error ivas_omasa_separate_object_renderer_open( int16_t interpolator_length; int16_t i; int16_t init_interpolator_length; + int16_t delayBuffer_nchan_new; - if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) + if ( st_ivas->hIsmRendererData == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer \n" ) ); + if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer \n" ) ); + } } for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) @@ -376,6 +380,12 @@ ivas_error ivas_omasa_separate_object_renderer_open( init_interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); interpolator_length = init_interpolator_length; } + + if ( st_ivas->hIsmRendererData->interpolator != NULL ) + { + free( st_ivas->hIsmRendererData->interpolator ); + st_ivas->hIsmRendererData->interpolator = NULL; + } st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ); for ( i = 0; i < interpolator_length; i++ ) @@ -387,24 +397,46 @@ ivas_error ivas_omasa_separate_object_renderer_open( if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - st_ivas->hMasaIsmData->delayBuffer_nchan = 1; + delayBuffer_nchan_new = 1; } else { - st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; + delayBuffer_nchan_new = st_ivas->nchan_ism; } - if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) + if ( st_ivas->hMasaIsmData->delayBuffer != NULL && delayBuffer_nchan_new != st_ivas->hMasaIsmData->delayBuffer_nchan ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + { + if ( st_ivas->hMasaIsmData->delayBuffer[i] != NULL ) + { + free( st_ivas->hMasaIsmData->delayBuffer[i] ); + st_ivas->hMasaIsmData->delayBuffer[i] = NULL; + } + } + free( st_ivas->hMasaIsmData->delayBuffer ); + st_ivas->hMasaIsmData->delayBuffer = NULL; } - for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + st_ivas->hMasaIsmData->delayBuffer_nchan = delayBuffer_nchan_new; + + if ( st_ivas->hMasaIsmData->delayBuffer == NULL ) { - if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) + if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); } + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + { + if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); + } + } + } + + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) + { set_zero( st_ivas->hMasaIsmData->delayBuffer[i], st_ivas->hMasaIsmData->delayBuffer_size ); } -- GitLab From 2415360625a7398cc4d2d8cb8d214827bc273c58 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 16:21:49 +0000 Subject: [PATCH 582/591] Revert "allocate structures only when necessary" This reverts commit 66792433bf3ba9a91958b133a04d065f10c69511 --- lib_dec/ivas_ism_renderer.c | 48 +++++++------------------------------ 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index dd2b9b14ed..33d3598e0e 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -354,14 +354,10 @@ ivas_error ivas_omasa_separate_object_renderer_open( int16_t interpolator_length; int16_t i; int16_t init_interpolator_length; - int16_t delayBuffer_nchan_new; - if ( st_ivas->hIsmRendererData == NULL ) + if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) { - if ( ( st_ivas->hIsmRendererData = (ISM_RENDERER_HANDLE) malloc( sizeof( ISM_RENDERER_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer \n" ) ); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer \n" ) ); } for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) @@ -380,12 +376,6 @@ ivas_error ivas_omasa_separate_object_renderer_open( init_interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); interpolator_length = init_interpolator_length; } - - if ( st_ivas->hIsmRendererData->interpolator != NULL ) - { - free( st_ivas->hIsmRendererData->interpolator ); - st_ivas->hIsmRendererData->interpolator = NULL; - } st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ); for ( i = 0; i < interpolator_length; i++ ) @@ -397,46 +387,24 @@ ivas_error ivas_omasa_separate_object_renderer_open( if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) { - delayBuffer_nchan_new = 1; + st_ivas->hMasaIsmData->delayBuffer_nchan = 1; } else { - delayBuffer_nchan_new = st_ivas->nchan_ism; + st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; } - if ( st_ivas->hMasaIsmData->delayBuffer != NULL && delayBuffer_nchan_new != st_ivas->hMasaIsmData->delayBuffer_nchan ) + if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) { - for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) - { - if ( st_ivas->hMasaIsmData->delayBuffer[i] != NULL ) - { - free( st_ivas->hMasaIsmData->delayBuffer[i] ); - st_ivas->hMasaIsmData->delayBuffer[i] = NULL; - } - } - free( st_ivas->hMasaIsmData->delayBuffer ); - st_ivas->hMasaIsmData->delayBuffer = NULL; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); } - st_ivas->hMasaIsmData->delayBuffer_nchan = delayBuffer_nchan_new; - - if ( st_ivas->hMasaIsmData->delayBuffer == NULL ) + for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) { - if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) + if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); } - for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) - { - if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - } - } - - for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) - { set_zero( st_ivas->hMasaIsmData->delayBuffer[i], st_ivas->hMasaIsmData->delayBuffer_size ); } -- GitLab From b61b381c581761aeb9b235aec33b5ee860c35053 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Tue, 1 Aug 2023 18:29:21 +0200 Subject: [PATCH 583/591] full renderer close instead of trying to be conservative --- lib_dec/ivas_omasa_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 5e1126a315..9ba6877cfb 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -295,9 +295,9 @@ ivas_error ivas_omasa_dec_config( } /* objects renderer reconfig. */ - if ( st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hIsmRendererData != NULL ) + if ( st_ivas->hMasaIsmData != NULL ) { - ivas_omasa_data_close( &( st_ivas->hMasaIsmData ) ); + ivas_omasa_separate_object_renderer_close( st_ivas ); } if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) -- GitLab From 5f7d8124d036bbc4be707d34f8c547dc2f91cb58 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 1 Aug 2023 19:52:47 +0300 Subject: [PATCH 584/591] Apply clang format --- lib_com/ivas_masa_com.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index ca188d6239..0ca65e4da3 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -262,7 +262,7 @@ void ivas_masa_set_coding_config( i = 3; } idx_bands = i; - + if ( config->numberOfDirections > 1 ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index d118334fe3..ab6241c4f9 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1768,7 +1768,7 @@ static void ivas_dirac_dec_binaural_process_output( } else { - decSlotRePointer = NULL; /* below these pointers are used only for chB < 2 */ + decSlotRePointer = NULL; /* below these pointers are used only for chB < 2 */ decSlotImPointer = NULL; } #endif -- GitLab From d7ffdab1e5c4154dcb2ca194cc9da46491bae6d9 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 2 Aug 2023 13:02:55 +1000 Subject: [PATCH 585/591] linux warning fix --- lib_dec/ivas_masa_dec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index cbbad15c7c..7027d49250 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1429,8 +1429,11 @@ ivas_error ivas_masa_dec_reconfigure( /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ - - if ( st_ivas->hDiracDecBin != NULL ) +#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN + if ( st_ivas->hDiracDecBin[0] != NULL ) +#else + if ( st_ivas->hDiracDecBin != NULL ) +#endif { #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) -- GitLab From 8fd9d8901b30561733d7673b54060f7250ea44ee Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 2 Aug 2023 13:28:25 +1000 Subject: [PATCH 586/591] clang format fix --- lib_dec/ivas_dirac_dec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 48c4429dff..491d2f48b6 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -985,7 +985,6 @@ ivas_error ivas_dirac_dec_config( #else st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); #endif - } } } -- GitLab From 096c3d105a9f631096e35280eaedcf35c9cc02b5 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 2 Aug 2023 09:06:18 +0300 Subject: [PATCH 587/591] Fix sanitizer error in OMASA rate switching due to incorrect check. --- lib_dec/ivas_omasa_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 012f701d64..70cba6176b 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -361,9 +361,9 @@ ivas_error ivas_omasa_dec_config( *-----------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - if ( st_ivas->hDiracDecBin[0] == NULL ) + if ( st_ivas->hDiracDecBin[0] != NULL ) #else - if ( st_ivas->hDiracDecBin == NULL ) + if ( st_ivas->hDiracDecBin != NULL ) #endif { #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN -- GitLab From 1b7c6fdcc5662c9a1f00ce2e7e4e4fe6352a8061 Mon Sep 17 00:00:00 2001 From: Ke Zhao Date: Wed, 2 Aug 2023 17:06:24 +1000 Subject: [PATCH 588/591] Update pytest xfail check to support <=320kbps with only 0DoF --- tests/split_rendering/test_split_rendering.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/split_rendering/test_split_rendering.py b/tests/split_rendering/test_split_rendering.py index 6bcbc42123..ff35b3fc6e 100644 --- a/tests/split_rendering/test_split_rendering.py +++ b/tests/split_rendering/test_split_rendering.py @@ -46,19 +46,9 @@ def check_xfail(test_info, in_fmt, render_config, bitrate=None): pytest.xfail("0DOF 768kbps LC3plus codec is unsupported") if ( - "256k" in render_config - and "0dof" not in render_config - and ( - "lcld" in render_config - or (in_fmt in INPUT_FORMATS_AMBI or in_fmt in INPUT_FORMATS_MASA) - or ( - "full_chain_split" in test_info.node.name - and in_fmt in INPUT_FORMATS_MC - and bitrate <= IVAS_BITRATES_MC[1] - ) # FastConv for ParamMC/ParamUpmix modes uses LCLD by default - ) - ): - pytest.xfail("Unsupported bitrate for LCLD codec") + "256k" in render_config or "320k" in render_config + ) and "0dof" not in render_config: + pytest.xfail("320kbps and lower are only supported with 0DOF") if ( bitrate -- GitLab From d1edf7a4ccad032e82de7e090c4be68eab70f09f Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 2 Aug 2023 17:25:42 +1000 Subject: [PATCH 589/591] increasing the timeout of SR tests --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc24ab729e..82738a8e51 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -587,7 +587,7 @@ split-rendering-pytest-on-merge-request: - .rules-merge-request needs: ["build-codec-linux-make"] # TODO: set reasonable timeout, will most likely take less - timeout: "20 minutes" + timeout: "30 minutes" stage: compare script: - *print-common-info -- GitLab From 2eaa1f09962b9855747564429f7f8b8d71f66ef3 Mon Sep 17 00:00:00 2001 From: Jouni Paulus Date: Wed, 2 Aug 2023 11:51:31 +0200 Subject: [PATCH 590/591] add missing inclusion of wmc_auto.h --- lib_dec/ivas_omasa_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 70cba6176b..7cff26a856 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -40,6 +40,7 @@ #ifdef DEBUGGING #include "debug.h" #endif +#include "wmc_auto.h" #ifdef MASA_AND_OBJECTS -- GitLab From b1523ce77c2db7877e6dd19d006368e357ae24ae Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 2 Aug 2023 15:05:20 +0300 Subject: [PATCH 591/591] Fix by setting last_ivas_format in JBM dec. --- lib_dec/ivas_jbm_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 436c08c417..276fdff4e3 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -555,6 +555,10 @@ ivas_error ivas_jbm_dec_tc( st_ivas->ini_active_frame++; } +#ifdef MASA_AND_OBJECTS + st_ivas->last_ivas_format = st_ivas->ivas_format; +#endif + #ifdef DEBUG_MODE_INFO dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); -- GitLab